gitlab.com/danp128/sqlite@v1.0.0/internal/mptest/mptest_linux_386.go (about)

     1  // Code generated by ccgo. DO NOT EDIT.
     2  
     3  // mptest
     4  //  /*
     5  //  ** 2013-04-05
     6  //  **
     7  //  ** The author disclaims copyright to this source code.  In place of
     8  //  ** a legal notice, here is a blessing:
     9  //  **
    10  //  **    May you do good and not evil.
    11  //  **    May you find forgiveness for yourself and forgive others.
    12  //  **    May you share freely, never taking more than you give.
    13  //  **
    14  //  *************************************************************************
    15  //  **
    16  //  ** This is a program used for testing SQLite, and specifically for testing
    17  //  ** the ability of independent processes to access the same SQLite database
    18  //  ** concurrently.
    19  //  **
    20  //  ** Compile this program as follows:
    21  //  **
    22  //  **    gcc -g -c -Wall sqlite3.c $(OPTS)
    23  //  **    gcc -g -o mptest mptest.c sqlite3.o $(LIBS)
    24  //  **
    25  //  ** Recommended options:
    26  //  **
    27  //  **    -DHAVE_USLEEP
    28  //  **    -DSQLITE_NO_SYNC
    29  //  **    -DSQLITE_THREADSAFE=0
    30  //  **    -DSQLITE_OMIT_LOAD_EXTENSION
    31  //  **
    32  //  ** Run like this:
    33  //  **
    34  //  **     ./mptest $database $script
    35  //  **
    36  //  ** where $database is the database to use for testing and $script is a
    37  //  ** test script.
    38  //  */
    39  package main
    40  
    41  import (
    42  	"math"
    43  	"os"
    44  	"unsafe"
    45  
    46  	"modernc.org/ccgo/crt"
    47  	"modernc.org/sqlite/internal/bin"
    48  )
    49  
    50  var argv []*int8
    51  
    52  func main() {
    53  	for _, v := range os.Args {
    54  		argv = append(argv, (*int8)(crt.CString(v)))
    55  	}
    56  	argv = append(argv, nil)
    57  	X_start(crt.NewTLS(), int32(len(os.Args)), &argv[0])
    58  }
    59  
    60  func X_start(tls *crt.TLS, _argc int32, _argv **int8) {
    61  	crt.X__register_stdfiles(tls, Xstdin, Xstdout, Xstderr)
    62  	crt.X__builtin_exit(tls, Xmain(tls, _argc, _argv))
    63  }
    64  
    65  var Xstdin unsafe.Pointer
    66  
    67  func init() {
    68  	Xstdin = unsafe.Pointer(&X__stdfiles)
    69  }
    70  
    71  var X__stdfiles [3]unsafe.Pointer
    72  
    73  var Xstdout unsafe.Pointer
    74  
    75  func init() {
    76  	Xstdout = unsafe.Pointer(uintptr(unsafe.Pointer(&X__stdfiles)) + 4)
    77  }
    78  
    79  var Xstderr unsafe.Pointer
    80  
    81  func init() {
    82  	Xstderr = unsafe.Pointer(uintptr(unsafe.Pointer(&X__stdfiles)) + 8)
    83  }
    84  
    85  func Xmain(tls *crt.TLS, _argc int32, _argv **int8) (r0 int32) {
    86  	var _iClient, _n, _i, _openFlags, _rc, _taskId, _nRep, _iRep, _iTmout, _7_nTry, _15_iTimeout int32
    87  	var _zClient, _zScript, _zTrace, _zCOption, _zJMode, _zNRep, _zTmout, _14_zTaskName *int8
    88  	var _15_pStmt unsafe.Pointer
    89  	r0 = int32(0)
    90  	_openFlags = int32(2)
    91  	_nRep = int32(1)
    92  	_iTmout = int32(0)
    93  	_g.Xargv0 = *elem0(_argv, 0)
    94  	_g.XiTrace = int32(1)
    95  	if _argc < int32(2) {
    96  		_usage(tls, *elem0(_argv, 0))
    97  	}
    98  	_g.XzDbFile = *elem0(_argv, uintptr(1))
    99  	if Xstrglob(tls, str(0), _g.XzDbFile) != 0 {
   100  		_usage(tls, *elem0(_argv, 0))
   101  	}
   102  	if crt.Xstrcmp(tls, bin.Xsqlite3_sourceid(tls), str(7)) != int32(0) {
   103  		crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(92), unsafe.Pointer(bin.Xsqlite3_sourceid(tls)), unsafe.Pointer(str(7)))
   104  		crt.Xexit(tls, int32(1))
   105  	}
   106  	_n = _argc - int32(2)
   107  	bin.Xsqlite3_snprintf(tls, int32(32), (*int8)(unsafe.Pointer(&_g.XzName)), str(152), crt.Xgetpid(tls))
   108  	_zJMode = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(164), int32(1))
   109  	_zNRep = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(176), int32(1))
   110  	if _zNRep != nil {
   111  		_nRep = crt.Xatoi(tls, _zNRep)
   112  	}
   113  	if _nRep < int32(1) {
   114  		_nRep = int32(1)
   115  	}
   116  	_g.XzVfs = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(183), int32(1))
   117  	_zClient = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(187), int32(1))
   118  	_g.XzErrLog = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(194), int32(1))
   119  	_g.XzLog = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(201), int32(1))
   120  	_zTrace = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(205), int32(1))
   121  	if _zTrace != nil {
   122  		_g.XiTrace = crt.Xatoi(tls, _zTrace)
   123  	}
   124  	if _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(211), int32(0)) != nil {
   125  		_g.XiTrace = int32(0)
   126  	}
   127  	_zTmout = _findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(217), int32(1))
   128  	if _zTmout != nil {
   129  		_iTmout = crt.Xatoi(tls, _zTmout)
   130  	}
   131  	_g.XbSqlTrace = bool2int(_findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(225), int32(0)) != nil)
   132  	_g.XbSync = bool2int(_findOption(tls, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))), &_n, str(234), int32(0)) != nil)
   133  	if _g.XzErrLog != nil {
   134  		*(**crt.XFILE)(unsafe.Pointer(&_g.XpErrLog)) = crt.Xfopen64(tls, _g.XzErrLog, str(239))
   135  		goto _9
   136  	}
   137  	*(**crt.XFILE)(unsafe.Pointer(&_g.XpErrLog)) = (*crt.XFILE)(Xstderr)
   138  _9:
   139  	if _g.XzLog != nil {
   140  		*(**crt.XFILE)(unsafe.Pointer(&_g.XpLog)) = crt.Xfopen64(tls, _g.XzLog, str(239))
   141  		goto _11
   142  	}
   143  	*(**crt.XFILE)(unsafe.Pointer(&_g.XpLog)) = (*crt.XFILE)(Xstdout)
   144  _11:
   145  	bin.Xsqlite3_config(tls, int32(16), _sqlErrorCallback, int32(0))
   146  	if _zClient == nil {
   147  		goto _12
   148  	}
   149  	_iClient = crt.Xatoi(tls, _zClient)
   150  	if _iClient < int32(1) {
   151  		_fatalError(tls, str(241), _iClient)
   152  	}
   153  	bin.Xsqlite3_snprintf(tls, int32(32), (*int8)(unsafe.Pointer(&_g.XzName)), str(268), crt.Xgetpid(tls), _iClient)
   154  	goto _14
   155  _12:
   156  	_7_nTry = int32(0)
   157  	if _g.XiTrace <= int32(0) {
   158  		goto _15
   159  	}
   160  	crt.Xprintf(tls, str(284), unsafe.Pointer(*elem0(_argv, 0)))
   161  	_i = int32(1)
   162  _16:
   163  	if _i >= _argc {
   164  		goto _19
   165  	}
   166  	crt.Xprintf(tls, str(294), unsafe.Pointer(*elem0(_argv, uintptr(_i))))
   167  	_i += 1
   168  	goto _16
   169  _19:
   170  	crt.Xprintf(tls, str(298))
   171  	crt.Xprintf(tls, str(300))
   172  	_i = int32(0)
   173  _20:
   174  	if store1(&_zCOption, bin.Xsqlite3_compileoption_get(tls, _i)) == nil {
   175  		goto _23
   176  	}
   177  	crt.Xprintf(tls, str(405), unsafe.Pointer(_zCOption))
   178  	_i += 1
   179  	goto _20
   180  _23:
   181  	crt.Xfflush(tls, (*crt.XFILE)(Xstdout))
   182  _15:
   183  	_iClient = int32(0)
   184  _24:
   185  	if (_7_nTry % int32(5)) == int32(4) {
   186  		crt.Xprintf(tls, str(418), unsafe.Pointer(func() *int8 {
   187  			if _7_nTry > int32(5) {
   188  				return str(447)
   189  			}
   190  			return str(454)
   191  		}()), unsafe.Pointer(_g.XzDbFile))
   192  	}
   193  	_rc = crt.Xunlink(tls, _g.XzDbFile)
   194  	if _rc != 0 && ((*crt.X__errno_location(tls)) == int32(2)) {
   195  		_rc = int32(0)
   196  	}
   197  	if ((_rc != int32(0)) && (preInc2(&_7_nTry, 1) < int32(60))) && (bin.Xsqlite3_sleep(tls, int32(1000)) > int32(0)) {
   198  		goto _24
   199  	}
   200  	if _rc != int32(0) {
   201  		_fatalError(tls, str(455), unsafe.Pointer(_g.XzDbFile), _7_nTry)
   202  	}
   203  	_openFlags |= int32(4)
   204  _14:
   205  	_rc = bin.Xsqlite3_open_v2(tls, _g.XzDbFile, (**bin.Xsqlite3)(unsafe.Pointer(&_g.Xdb)), _openFlags, _g.XzVfs)
   206  	if _rc != 0 {
   207  		_fatalError(tls, str(496), unsafe.Pointer(_g.XzDbFile))
   208  	}
   209  	if _iTmout > int32(0) {
   210  		bin.Xsqlite3_busy_timeout(tls, (*bin.Xsqlite3)(_g.Xdb), _iTmout)
   211  	}
   212  	if _zJMode != nil {
   213  		_runSql(tls, str(513), unsafe.Pointer(_zJMode))
   214  	}
   215  	if _g.XbSync == 0 {
   216  		_trySql(tls, str(537))
   217  	}
   218  	bin.Xsqlite3_enable_load_extension(tls, (*bin.Xsqlite3)(_g.Xdb), int32(1))
   219  	bin.Xsqlite3_busy_handler(tls, (*bin.Xsqlite3)(_g.Xdb), _busyHandler, nil)
   220  	bin.Xsqlite3_create_function(tls, (*bin.Xsqlite3)(_g.Xdb), str(560), int32(0), int32(1), nil, func() func(*crt.TLS, *bin.Xsqlite3_context, int32, **bin.XMem) {
   221  		v := _vfsNameFunc
   222  		return *(*func(*crt.TLS, *bin.Xsqlite3_context, int32, **bin.XMem))(unsafe.Pointer(&v))
   223  	}(), nil, nil)
   224  	bin.Xsqlite3_create_function(tls, (*bin.Xsqlite3)(_g.Xdb), str(568), int32(1), int32(1), nil, func() func(*crt.TLS, *bin.Xsqlite3_context, int32, **bin.XMem) {
   225  		v := _evalFunc
   226  		return *(*func(*crt.TLS, *bin.Xsqlite3_context, int32, **bin.XMem))(unsafe.Pointer(&v))
   227  	}(), nil, nil)
   228  	_g.XiTimeout = int32(10000)
   229  	if _g.XbSqlTrace != 0 {
   230  		bin.Xsqlite3_trace(tls, (*bin.Xsqlite3)(_g.Xdb), _sqlTraceCallback, nil)
   231  	}
   232  	if _iClient <= int32(0) {
   233  		goto _38
   234  	}
   235  	if _n > int32(0) {
   236  		_unrecognizedArguments(tls, *elem0(_argv, 0), _n, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))))
   237  	}
   238  	if _g.XiTrace != 0 {
   239  		_logMessage(tls, str(573))
   240  	}
   241  _40:
   242  	_14_zTaskName = nil
   243  	_rc = _startScript(tls, _iClient, &_zScript, &_taskId, &_14_zTaskName)
   244  	if _rc == int32(101) {
   245  		goto _42
   246  	}
   247  	if _g.XiTrace != 0 {
   248  		_logMessage(tls, str(586), unsafe.Pointer(_14_zTaskName), _taskId)
   249  	}
   250  	_runScript(tls, _iClient, _taskId, _zScript, _14_zTaskName)
   251  	if _g.XiTrace != 0 {
   252  		_logMessage(tls, str(600), unsafe.Pointer(_14_zTaskName), _taskId)
   253  	}
   254  	_finishScript(tls, _iClient, _taskId, int32(0))
   255  	bin.Xsqlite3_free(tls, unsafe.Pointer(_14_zTaskName))
   256  	bin.Xsqlite3_sleep(tls, int32(10))
   257  	goto _40
   258  _42:
   259  	if _g.XiTrace != 0 {
   260  		_logMessage(tls, str(612))
   261  	}
   262  	goto _47
   263  _38:
   264  	if _n == int32(0) {
   265  		_fatalError(tls, str(623))
   266  	}
   267  	if _n > int32(1) {
   268  		_unrecognizedArguments(tls, *elem0(_argv, 0), _n, (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv))+uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(int32(2))*uintptr(unsafe.Pointer((**int8)(unsafe.Pointer(uintptr(4))))))))))))
   269  	}
   270  	_runSql(tls, str(647))
   271  	_zScript = _readFile(tls, *elem0(_argv, uintptr(2)))
   272  	_iRep = int32(1)
   273  _50:
   274  	if _iRep > _nRep {
   275  		goto _53
   276  	}
   277  	if _g.XiTrace != 0 {
   278  		_logMessage(tls, str(1083), unsafe.Pointer(*elem0(_argv, uintptr(2))), _iRep)
   279  	}
   280  	_runScript(tls, int32(0), int32(0), _zScript, *elem0(_argv, uintptr(2)))
   281  	if _g.XiTrace != 0 {
   282  		_logMessage(tls, str(1111), unsafe.Pointer(*elem0(_argv, uintptr(2))), _iRep)
   283  	}
   284  	_iRep += 1
   285  	goto _50
   286  _53:
   287  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zScript))
   288  	_waitForClient(tls, int32(0), int32(2000), str(1137))
   289  	_trySql(tls, str(1157))
   290  	bin.Xsqlite3_sleep(tls, int32(10))
   291  	_g.XiTimeout = int32(0)
   292  	_15_iTimeout = int32(1000)
   293  _56:
   294  	if ((store2(&_rc, _trySql(tls, str(1186))) == int32(5)) || (_rc == int32(100))) && (_15_iTimeout > int32(0)) {
   295  		bin.Xsqlite3_sleep(tls, int32(10))
   296  		_15_iTimeout -= int32(10)
   297  		goto _56
   298  	}
   299  	bin.Xsqlite3_sleep(tls, int32(100))
   300  	_15_pStmt = _prepareSql(tls, str(1207))
   301  	_15_iTimeout = int32(1000)
   302  _60:
   303  	if (store2(&_rc, bin.Xsqlite3_step(tls, _15_pStmt)) == int32(5)) && (_15_iTimeout > int32(0)) {
   304  		bin.Xsqlite3_sleep(tls, int32(10))
   305  		_15_iTimeout -= int32(10)
   306  		goto _60
   307  	}
   308  	if _rc == int32(100) {
   309  		_g.XnError += bin.Xsqlite3_column_int(tls, _15_pStmt, int32(0))
   310  		_g.XnTest += bin.Xsqlite3_column_int(tls, _15_pStmt, int32(1))
   311  	}
   312  	bin.Xsqlite3_finalize(tls, _15_pStmt)
   313  _47:
   314  	bin.Xsqlite3_close(tls, (*bin.Xsqlite3)(_g.Xdb))
   315  	_maybeClose(tls, (*crt.XFILE)(_g.XpLog))
   316  	_maybeClose(tls, (*crt.XFILE)(_g.XpErrLog))
   317  	if _iClient != int32(0) {
   318  		goto _64
   319  	}
   320  	crt.Xprintf(tls, str(1242), _g.XnError, _g.XnTest)
   321  	crt.Xprintf(tls, str(1278), unsafe.Pointer(*elem0(_argv, 0)))
   322  	_i = int32(1)
   323  _65:
   324  	if _i >= _argc {
   325  		goto _68
   326  	}
   327  	crt.Xprintf(tls, str(294), unsafe.Pointer(*elem0(_argv, uintptr(_i))))
   328  	_i += 1
   329  	goto _65
   330  _68:
   331  	crt.Xprintf(tls, str(298))
   332  _64:
   333  	return bool2int(_g.XnError > int32(0))
   334  }
   335  
   336  // C comment
   337  //  /* Global data
   338  //  */
   339  var _g TGlobal
   340  
   341  // C comment
   342  //  /* Print a usage message for the program and exit */
   343  func _usage(tls *crt.TLS, _argv0 *int8) {
   344  	var _i int32
   345  	var _zTail *int8
   346  	_zTail = _argv0
   347  	_i = int32(0)
   348  _0:
   349  	if (*elem1(_argv0, uintptr(_i))) == 0 {
   350  		goto _3
   351  	}
   352  	if int32(*elem1(_argv0, uintptr(_i))) == int32(47) {
   353  		_zTail = (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_argv0))+uintptr(_i))))) + uintptr(int32(1))))
   354  	}
   355  	_i += 1
   356  	goto _0
   357  _3:
   358  	crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(1286), unsafe.Pointer(_zTail))
   359  	crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(1325))
   360  	crt.Xexit(tls, int32(1))
   361  }
   362  
   363  // C comment
   364  //  /*
   365  //  ** Return TRUE if string z[] matches glob pattern zGlob[].
   366  //  ** Return FALSE if the pattern does not match.
   367  //  **
   368  //  ** Globbing rules:
   369  //  **
   370  //  **      '*'       Matches any sequence of zero or more characters.
   371  //  **
   372  //  **      '?'       Matches exactly one character.
   373  //  **
   374  //  **     [...]      Matches one character from the enclosed list of
   375  //  **                characters.
   376  //  **
   377  //  **     [^...]     Matches one character not in the enclosed list.
   378  //  **
   379  //  **      '#'       Matches any sequence of one or more digits with an
   380  //  **                optional + or - sign in front
   381  //  */
   382  func Xstrglob(tls *crt.TLS, _zGlob *int8, _z *int8) (r0 int32) {
   383  	var _c, _c2, _invert, _seen, _10_prior_c int32
   384  _0:
   385  	if store2(&_c, int32(*postInc1(&_zGlob, 1))) == int32(0) {
   386  		goto _1
   387  	}
   388  	if _c != int32(42) {
   389  		goto _2
   390  	}
   391  _3:
   392  	if store2(&_c, int32(*postInc1(&_zGlob, 1))) != int32(42) && _c != int32(63) {
   393  		goto _4
   394  	}
   395  	if (_c == int32(63)) && (int32(*postInc1(&_z, 1)) == int32(0)) {
   396  		return int32(0)
   397  	}
   398  	goto _3
   399  _4:
   400  	if _c == int32(0) {
   401  		return int32(1)
   402  	}
   403  	if _c != int32(91) {
   404  		goto _10
   405  	}
   406  _11:
   407  	if ((*_z) != 0) && Xstrglob(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zGlob))-uintptr(int32(1)))), _z) != 0 {
   408  		*(*uintptr)(unsafe.Pointer(&_z)) += uintptr(1)
   409  		goto _11
   410  	}
   411  	return bool2int(int32(*_z) != int32(0))
   412  
   413  _10:
   414  	if store2(&_c2, int32(*postInc1(&_z, 1))) == int32(0) {
   415  		goto _15
   416  	}
   417  _16:
   418  	if _c2 == _c {
   419  		goto _17
   420  	}
   421  	_c2 = int32(*postInc1(&_z, 1))
   422  	if _c2 == int32(0) {
   423  		return int32(0)
   424  	}
   425  	goto _16
   426  _17:
   427  	if Xstrglob(tls, _zGlob, _z) != 0 {
   428  		return int32(1)
   429  	}
   430  	goto _10
   431  _15:
   432  	return int32(0)
   433  
   434  _2:
   435  	if _c != int32(63) {
   436  		goto _21
   437  	}
   438  	if int32(*postInc1(&_z, 1)) == int32(0) {
   439  		return int32(0)
   440  	}
   441  	goto _50
   442  _21:
   443  	if _c != int32(91) {
   444  		goto _24
   445  	}
   446  	_10_prior_c = int32(0)
   447  	_seen = int32(0)
   448  	_invert = int32(0)
   449  	_c = int32(*postInc1(&_z, 1))
   450  	if _c == int32(0) {
   451  		return int32(0)
   452  	}
   453  	_c2 = int32(*postInc1(&_zGlob, 1))
   454  	if _c2 == int32(94) {
   455  		_invert = int32(1)
   456  		_c2 = int32(*postInc1(&_zGlob, 1))
   457  	}
   458  	if _c2 != int32(93) {
   459  		goto _27
   460  	}
   461  	if _c == int32(93) {
   462  		_seen = int32(1)
   463  	}
   464  	_c2 = int32(*postInc1(&_zGlob, 1))
   465  _27:
   466  	if _c2 == 0 || _c2 == int32(93) {
   467  		goto _30
   468  	}
   469  	if _c2 != int32(45) || int32(*elem1(_zGlob, 0)) == int32(93) || int32(*elem1(_zGlob, 0)) == int32(0) || _10_prior_c <= int32(0) {
   470  		goto _35
   471  	}
   472  	_c2 = int32(*postInc1(&_zGlob, 1))
   473  	if (_c >= _10_prior_c) && (_c <= _c2) {
   474  		_seen = int32(1)
   475  	}
   476  	_10_prior_c = int32(0)
   477  	goto _38
   478  _35:
   479  	if _c == _c2 {
   480  		_seen = int32(1)
   481  	}
   482  	_10_prior_c = _c2
   483  _38:
   484  	_c2 = int32(*postInc1(&_zGlob, 1))
   485  	goto _27
   486  _30:
   487  	if (_c2 == int32(0)) || ((_seen ^ _invert) == int32(0)) {
   488  		return int32(0)
   489  	}
   490  	goto _50
   491  _24:
   492  	if _c != int32(35) {
   493  		goto _43
   494  	}
   495  	if ((int32(*elem1(_z, 0)) == int32(45)) || (int32(*elem1(_z, 0)) == int32(43))) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(1)))))))&int32(2048)) != 0 {
   496  		*(*uintptr)(unsafe.Pointer(&_z)) += uintptr(1)
   497  	}
   498  	if (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, 0)))))) & int32(2048)) == 0 {
   499  		return int32(0)
   500  	}
   501  	*(*uintptr)(unsafe.Pointer(&_z)) += uintptr(1)
   502  _48:
   503  	if (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, 0)))))) & int32(2048)) != 0 {
   504  		*(*uintptr)(unsafe.Pointer(&_z)) += uintptr(1)
   505  		goto _48
   506  	}
   507  	goto _50
   508  _43:
   509  	if _c != int32(*postInc1(&_z, 1)) {
   510  		return int32(0)
   511  	}
   512  _50:
   513  	goto _0
   514  _1:
   515  	return bool2int(int32(*_z) == int32(0))
   516  }
   517  
   518  // C comment
   519  //  /*
   520  //  ** Look for a command-line option.  If present, return a pointer.
   521  //  ** Return NULL if missing.
   522  //  **
   523  //  ** hasArg==0 means the option is a flag.  It is either present or not.
   524  //  ** hasArg==1 means the option has an argument.  Return a pointer to the
   525  //  ** argument.
   526  //  */
   527  func _findOption(tls *crt.TLS, _azArg **int8, _pnArg *int32, _zOption *int8, _hasArg int32) (r0 *int8) {
   528  	var _i, _j, _nArg int32
   529  	var _zReturn, _1_z *int8
   530  	_zReturn = nil
   531  	_nArg = *_pnArg
   532  	func() {
   533  		if _hasArg != int32(0) && _hasArg != int32(1) {
   534  			crt.X__builtin_fprintf(tls, Xstderr, str(1897), unsafe.Pointer(str(1933)), int32(1211), unsafe.Pointer(&_findOptionØ00__func__Ø000), unsafe.Pointer(str(1988)))
   535  			crt.X__builtin_abort(tls)
   536  		}
   537  	}()
   538  	_i = int32(0)
   539  _3:
   540  	if _i >= _nArg {
   541  		goto _6
   542  	}
   543  	if (_i + _hasArg) >= _nArg {
   544  		goto _6
   545  	}
   546  	_1_z = *elem0(_azArg, uintptr(_i))
   547  	if int32(*elem1(_1_z, 0)) != int32(45) {
   548  		goto _4
   549  	}
   550  	*(*uintptr)(unsafe.Pointer(&_1_z)) += uintptr(1)
   551  	if int32(*elem1(_1_z, 0)) != int32(45) {
   552  		goto _9
   553  	}
   554  	if int32(*elem1(_1_z, uintptr(1))) == int32(0) {
   555  		goto _6
   556  	}
   557  	*(*uintptr)(unsafe.Pointer(&_1_z)) += uintptr(1)
   558  _9:
   559  	if crt.Xstrcmp(tls, _1_z, _zOption) != int32(0) {
   560  		goto _11
   561  	}
   562  	if _hasArg != 0 && (_i == (_nArg - int32(1))) {
   563  		_fatalError(tls, str(2011), unsafe.Pointer(_1_z))
   564  	}
   565  	if _hasArg != 0 {
   566  		_zReturn = *elem0(_azArg, uintptr(_i+int32(1)))
   567  		goto _15
   568  	}
   569  	_zReturn = *elem0(_azArg, uintptr(_i))
   570  _15:
   571  	_j = (_i + int32(1)) + bool2int(_hasArg != int32(0))
   572  _16:
   573  	if _j < _nArg {
   574  		*elem0(_azArg, uintptr(postInc2(&_i, 1))) = *elem0(_azArg, uintptr(postInc2(&_j, 1)))
   575  		goto _16
   576  	}
   577  	*_pnArg = _i
   578  	return _zReturn
   579  
   580  _11:
   581  _4:
   582  	_i += 1
   583  	goto _3
   584  _6:
   585  	return _zReturn
   586  }
   587  
   588  var _findOptionØ00__func__Ø000 [11]int8
   589  
   590  func init() {
   591  	crt.Xstrncpy(nil, &_findOptionØ00__func__Ø000[0], str(2059), 11)
   592  }
   593  
   594  // C comment
   595  //  /*
   596  //  ** Print an error message and then quit.
   597  //  */
   598  func _fatalError(tls *crt.TLS, _zFormat *int8, args ...interface{}) {
   599  	var _3_nTry int32
   600  	var _zMsg *int8
   601  	var _ap []interface{}
   602  	var _zPrefix [30]int8
   603  	_ap = args
   604  	_zMsg = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
   605  	_ap = nil
   606  	bin.Xsqlite3_snprintf(tls, int32(30), (*int8)(unsafe.Pointer(&_zPrefix)), str(2070), unsafe.Pointer(&_g.XzName))
   607  	if _g.XpLog != nil {
   608  		_printWithPrefix(tls, (*crt.XFILE)(_g.XpLog), (*int8)(unsafe.Pointer(&_zPrefix)), _zMsg)
   609  		crt.Xfflush(tls, (*crt.XFILE)(_g.XpLog))
   610  		_maybeClose(tls, (*crt.XFILE)(_g.XpLog))
   611  	}
   612  	if (_g.XpErrLog != nil) && _safe_strcmp(tls, _g.XzErrLog, _g.XzLog) != 0 {
   613  		_printWithPrefix(tls, (*crt.XFILE)(_g.XpErrLog), (*int8)(unsafe.Pointer(&_zPrefix)), _zMsg)
   614  		crt.Xfflush(tls, (*crt.XFILE)(_g.XpErrLog))
   615  		_maybeClose(tls, (*crt.XFILE)(_g.XpErrLog))
   616  	}
   617  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zMsg))
   618  	if _g.Xdb == nil {
   619  		goto _3
   620  	}
   621  	_3_nTry = int32(0)
   622  	_g.XiTimeout = int32(0)
   623  _4:
   624  	if (_trySql(tls, str(2081)) == int32(5)) && (postInc2(&_3_nTry, 1) < int32(100)) {
   625  		bin.Xsqlite3_sleep(tls, int32(10))
   626  		goto _4
   627  	}
   628  _3:
   629  	bin.Xsqlite3_close(tls, (*bin.Xsqlite3)(_g.Xdb))
   630  	crt.Xexit(tls, int32(1))
   631  	_ = _zPrefix
   632  	_ = _3_nTry
   633  }
   634  
   635  // C comment
   636  //  /*
   637  //  ** Print a message adding zPrefix[] to the beginning of every line.
   638  //  */
   639  func _printWithPrefix(tls *crt.TLS, _pOut *crt.XFILE, _zPrefix *int8, _zMsg *int8) {
   640  	var _1_i int32
   641  _0:
   642  	if _zMsg == nil || (*elem1(_zMsg, 0)) == 0 {
   643  		goto _1
   644  	}
   645  	_1_i = int32(0)
   646  _3:
   647  	if (*elem1(_zMsg, uintptr(_1_i))) == 0 || int32(*elem1(_zMsg, uintptr(_1_i))) == int32(10) || int32(*elem1(_zMsg, uintptr(_1_i))) == int32(13) {
   648  		goto _8
   649  	}
   650  	_1_i += 1
   651  	goto _3
   652  _8:
   653  	crt.Xfprintf(tls, _pOut, str(2111), unsafe.Pointer(_zPrefix), _1_i, unsafe.Pointer(_zMsg))
   654  	*(*uintptr)(unsafe.Pointer(&_zMsg)) += uintptr(_1_i)
   655  _9:
   656  	if (int32(*elem1(_zMsg, 0)) == int32(10)) || (int32(*elem1(_zMsg, 0)) == int32(13)) {
   657  		*(*uintptr)(unsafe.Pointer(&_zMsg)) += uintptr(1)
   658  		goto _9
   659  	}
   660  	goto _0
   661  _1:
   662  }
   663  
   664  // C comment
   665  //  /*
   666  //  ** Close output stream pOut if it is not stdout or stderr
   667  //  */
   668  func _maybeClose(tls *crt.TLS, _pOut *crt.XFILE) {
   669  	if (unsafe.Pointer(_pOut) != Xstdout) && (_pOut != (*crt.XFILE)(Xstderr)) {
   670  		crt.Xfclose(tls, _pOut)
   671  	}
   672  }
   673  
   674  // C comment
   675  //  /*
   676  //  ** Compare two pointers to strings, where the pointers might be NULL.
   677  //  */
   678  func _safe_strcmp(tls *crt.TLS, _a *int8, _b *int8) (r0 int32) {
   679  	if _a == _b {
   680  		return int32(0)
   681  	}
   682  	if _a == nil {
   683  		return int32(-1)
   684  	}
   685  	if _b == nil {
   686  		return int32(1)
   687  	}
   688  	return crt.Xstrcmp(tls, _a, _b)
   689  }
   690  
   691  // C comment
   692  //  /*
   693  //  ** Try to run arbitrary SQL.  Return success code.
   694  //  */
   695  func _trySql(tls *crt.TLS, _zFormat *int8, args ...interface{}) (r0 int32) {
   696  	var _rc int32
   697  	var _zSql *int8
   698  	var _ap []interface{}
   699  	_ap = args
   700  	_zSql = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
   701  	_ap = nil
   702  	_rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_g.Xdb), _zSql, nil, nil, nil)
   703  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
   704  	return _rc
   705  }
   706  
   707  // C comment
   708  //  /*
   709  //  ** SQL error log callback
   710  //  */
   711  func _sqlErrorCallback(tls *crt.TLS, _pArg unsafe.Pointer, _iErrCode int32, _zMsg *int8) {
   712  	if (_iErrCode == int32(1)) && _g.XbIgnoreSqlErrors != 0 {
   713  		return
   714  	}
   715  	if ((_iErrCode & int32(255)) == int32(17)) && (_g.XiTrace < int32(3)) {
   716  		return
   717  	}
   718  	if ((_g.XiTimeout == int32(0)) && ((_iErrCode & int32(255)) == int32(5))) && (_g.XiTrace < int32(3)) {
   719  		return
   720  	}
   721  	if (_iErrCode & int32(255)) == int32(27) {
   722  		_logMessage(tls, str(2119), unsafe.Pointer(_zMsg))
   723  		goto _8
   724  	}
   725  	_errorMessage(tls, str(2129), _iErrCode, unsafe.Pointer(_zMsg))
   726  _8:
   727  }
   728  
   729  // C comment
   730  //  /*
   731  //  ** Print a log message
   732  //  */
   733  func _logMessage(tls *crt.TLS, _zFormat *int8, args ...interface{}) {
   734  	var _zMsg *int8
   735  	var _ap []interface{}
   736  	var _zPrefix [30]int8
   737  	_ap = args
   738  	_zMsg = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
   739  	_ap = nil
   740  	bin.Xsqlite3_snprintf(tls, int32(30), (*int8)(unsafe.Pointer(&_zPrefix)), str(2145), unsafe.Pointer(&_g.XzName))
   741  	if _g.XpLog != nil {
   742  		_printWithPrefix(tls, (*crt.XFILE)(_g.XpLog), (*int8)(unsafe.Pointer(&_zPrefix)), _zMsg)
   743  		crt.Xfflush(tls, (*crt.XFILE)(_g.XpLog))
   744  	}
   745  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zMsg))
   746  	_ = _zPrefix
   747  }
   748  
   749  // C comment
   750  //  /*
   751  //  ** Print an error message
   752  //  */
   753  func _errorMessage(tls *crt.TLS, _zFormat *int8, args ...interface{}) {
   754  	var _zMsg *int8
   755  	var _ap []interface{}
   756  	var _zPrefix [30]int8
   757  	_ap = args
   758  	_zMsg = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
   759  	_ap = nil
   760  	bin.Xsqlite3_snprintf(tls, int32(30), (*int8)(unsafe.Pointer(&_zPrefix)), str(2150), unsafe.Pointer(&_g.XzName))
   761  	if _g.XpLog != nil {
   762  		_printWithPrefix(tls, (*crt.XFILE)(_g.XpLog), (*int8)(unsafe.Pointer(&_zPrefix)), _zMsg)
   763  		crt.Xfflush(tls, (*crt.XFILE)(_g.XpLog))
   764  	}
   765  	if (_g.XpErrLog != nil) && _safe_strcmp(tls, _g.XzErrLog, _g.XzLog) != 0 {
   766  		_printWithPrefix(tls, (*crt.XFILE)(_g.XpErrLog), (*int8)(unsafe.Pointer(&_zPrefix)), _zMsg)
   767  		crt.Xfflush(tls, (*crt.XFILE)(_g.XpErrLog))
   768  	}
   769  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zMsg))
   770  	_g.XnError += 1
   771  	_ = _zPrefix
   772  }
   773  
   774  // C comment
   775  //  /*
   776  //  ** Run arbitrary SQL.  Issue a fatal error on failure.
   777  //  */
   778  func _runSql(tls *crt.TLS, _zFormat *int8, args ...interface{}) {
   779  	var _rc int32
   780  	var _zSql *int8
   781  	var _ap []interface{}
   782  	_ap = args
   783  	_zSql = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
   784  	_ap = nil
   785  	_rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_g.Xdb), _zSql, nil, nil, nil)
   786  	if _rc != int32(0) {
   787  		_fatalError(tls, str(2161), unsafe.Pointer(bin.Xsqlite3_errmsg(tls, (*bin.Xsqlite3)(_g.Xdb))), unsafe.Pointer(_zSql))
   788  	}
   789  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
   790  }
   791  
   792  // C comment
   793  //  /*
   794  //  ** Busy handler with a g.iTimeout-millisecond timeout
   795  //  */
   796  func _busyHandler(tls *crt.TLS, _pCD unsafe.Pointer, _count int32) (r0 int32) {
   797  	if (_count * int32(10)) <= _g.XiTimeout {
   798  		goto _0
   799  	}
   800  	if _g.XiTimeout > int32(0) {
   801  		_errorMessage(tls, str(2168), _g.XiTimeout)
   802  	}
   803  	return int32(0)
   804  
   805  _0:
   806  	bin.Xsqlite3_sleep(tls, int32(10))
   807  	return int32(1)
   808  }
   809  
   810  // C comment
   811  //  /*
   812  //  ** Auxiliary SQL function to return the name of the VFS
   813  //  */
   814  func _vfsNameFunc(tls *crt.TLS, _context unsafe.Pointer, _argc int32, _argv *unsafe.Pointer) {
   815  	var _zVfs *int8
   816  	var _db unsafe.Pointer
   817  	_db = unsafe.Pointer(bin.Xsqlite3_context_db_handle(tls, (*bin.Xsqlite3_context)(_context)))
   818  	_zVfs = nil
   819  
   820  	bin.Xsqlite3_file_control(tls, (*bin.Xsqlite3)(_db), str(2187), int32(12), unsafe.Pointer(&_zVfs))
   821  	if _zVfs != nil {
   822  		bin.Xsqlite3_result_text(tls, (*bin.Xsqlite3_context)(_context), _zVfs, int32(-1), bin.Xsqlite3_free)
   823  	}
   824  }
   825  
   826  // C comment
   827  //  /*
   828  //  ** Auxiliary SQL function to recursively evaluate SQL.
   829  //  */
   830  func _evalFunc(tls *crt.TLS, _context unsafe.Pointer, _argc int32, _argv *unsafe.Pointer) {
   831  	var _rc int32
   832  	var _zSql, _zErrMsg *int8
   833  	var _db unsafe.Pointer
   834  	var _res XString
   835  	_db = unsafe.Pointer(bin.Xsqlite3_context_db_handle(tls, (*bin.Xsqlite3_context)(_context)))
   836  	_zSql = (*int8)(unsafe.Pointer(bin.Xsqlite3_value_text(tls, (*bin.XMem)(*elem4(_argv, 0)))))
   837  	_zErrMsg = nil
   838  
   839  	crt.Xmemset(tls, unsafe.Pointer(&_res), int32(0), uint32(12))
   840  	_rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_db), _zSql, _evalCallback, unsafe.Pointer(&_res), &_zErrMsg)
   841  	if _zErrMsg != nil {
   842  		bin.Xsqlite3_result_error(tls, (*bin.Xsqlite3_context)(_context), _zErrMsg, int32(-1))
   843  		bin.Xsqlite3_free(tls, unsafe.Pointer(_zErrMsg))
   844  		goto _3
   845  	}
   846  	if _rc != 0 {
   847  		bin.Xsqlite3_result_error_code(tls, (*bin.Xsqlite3_context)(_context), _rc)
   848  		goto _3
   849  	}
   850  	bin.Xsqlite3_result_text(tls, (*bin.Xsqlite3_context)(_context), _res.Xz, int32(-1), *(*func(*crt.TLS, unsafe.Pointer))(unsafe.Pointer(&struct{ f uintptr }{4294967295})))
   851  _3:
   852  	_stringFree(tls, &_res)
   853  }
   854  
   855  // C comment
   856  //  /*
   857  //  ** Callback function for evalSql()
   858  //  */
   859  func _evalCallback(tls *crt.TLS, _pCData unsafe.Pointer, _argc int32, _argv **int8, _azCol **int8) (r0 int32) {
   860  	var _i int32
   861  	var _p *XString
   862  	_p = (*XString)(_pCData)
   863  
   864  	_i = int32(0)
   865  _0:
   866  	if _i >= _argc {
   867  		goto _3
   868  	}
   869  	_stringAppendTerm(tls, _p, *elem0(_argv, uintptr(_i)))
   870  	_i += 1
   871  	goto _0
   872  _3:
   873  	return int32(0)
   874  }
   875  
   876  // C comment
   877  //  /* Append a new token onto the end of the string */
   878  func _stringAppendTerm(tls *crt.TLS, _p *XString, _z *int8) {
   879  	var _i int32
   880  	if _p.Xn != 0 {
   881  		_stringAppend(tls, _p, str(2192), int32(1))
   882  	}
   883  	if _z == nil {
   884  		_stringAppend(tls, _p, str(2194), int32(3))
   885  		return
   886  	}
   887  	_i = int32(0)
   888  _2:
   889  	if (*elem1(_z, uintptr(_i))) == 0 || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_i)))))))&int32(8192)) != 0 {
   890  		goto _6
   891  	}
   892  	_i += 1
   893  	goto _2
   894  _6:
   895  	if (_i > int32(0)) && (int32(*elem1(_z, uintptr(_i))) == int32(0)) {
   896  		_stringAppend(tls, _p, _z, _i)
   897  		return
   898  	}
   899  	_stringAppend(tls, _p, str(2198), int32(1))
   900  _9:
   901  	if (*elem1(_z, 0)) == 0 {
   902  		goto _10
   903  	}
   904  	_i = int32(0)
   905  _11:
   906  	if (*elem1(_z, uintptr(_i))) == 0 || int32(*elem1(_z, uintptr(_i))) == int32(39) {
   907  		goto _15
   908  	}
   909  	_i += 1
   910  	goto _11
   911  _15:
   912  	if (*elem1(_z, uintptr(_i))) != 0 {
   913  		_stringAppend(tls, _p, _z, _i+int32(1))
   914  		_stringAppend(tls, _p, str(2198), int32(1))
   915  		*(*uintptr)(unsafe.Pointer(&_z)) += uintptr(_i + int32(1))
   916  		goto _17
   917  	}
   918  	_stringAppend(tls, _p, _z, _i)
   919  	goto _10
   920  _17:
   921  	goto _9
   922  _10:
   923  	_stringAppend(tls, _p, str(2198), int32(1))
   924  }
   925  
   926  // C comment
   927  //  /* Append n bytes of text to a string.  If n<0 append the entire string. */
   928  func _stringAppend(tls *crt.TLS, _p *XString, _z *int8, _n int32) {
   929  	var _1_nAlloc int32
   930  	var _1_zNew *int8
   931  	if _n < int32(0) {
   932  		_n = int32(crt.Xstrlen(tls, _z))
   933  	}
   934  	if (_p.Xn + _n) < _p.XnAlloc {
   935  		goto _1
   936  	}
   937  	_1_nAlloc = ((_p.XnAlloc * int32(2)) + _n) + int32(100)
   938  	_1_zNew = (*int8)(bin.Xsqlite3_realloc(tls, unsafe.Pointer(_p.Xz), _1_nAlloc))
   939  	if _1_zNew == nil {
   940  		_fatalError(tls, str(2200))
   941  	}
   942  	_p.Xz = _1_zNew
   943  	_p.XnAlloc = _1_nAlloc
   944  _1:
   945  	crt.Xmemcpy(tls, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_p.Xz))+uintptr(_p.Xn)))), unsafe.Pointer(_z), uint32(_n))
   946  	_p.Xn += _n
   947  	*elem1(_p.Xz, uintptr(_p.Xn)) = 0
   948  }
   949  
   950  // C comment
   951  //  /* Free a string */
   952  func _stringFree(tls *crt.TLS, _p *XString) {
   953  	if _p.Xz != nil {
   954  		bin.Xsqlite3_free(tls, unsafe.Pointer(_p.Xz))
   955  	}
   956  	crt.Xmemset(tls, unsafe.Pointer(_p), int32(0), uint32(12))
   957  }
   958  
   959  // C comment
   960  //  /*
   961  //  ** SQL Trace callback
   962  //  */
   963  func _sqlTraceCallback(tls *crt.TLS, _NotUsed1 unsafe.Pointer, _zSql *int8) {
   964  	_logMessage(tls, str(2214), _clipLength(tls, _zSql), unsafe.Pointer(_zSql))
   965  }
   966  
   967  // C comment
   968  //  /*
   969  //  ** Return the length of a string omitting trailing whitespace
   970  //  */
   971  func _clipLength(tls *crt.TLS, _z *int8) (r0 int32) {
   972  	var _n int32
   973  	_n = int32(crt.Xstrlen(tls, _z))
   974  _0:
   975  	if (_n > int32(0)) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_n-int32(1))))))))&int32(8192)) != 0 {
   976  		_n -= 1
   977  		goto _0
   978  	}
   979  	return _n
   980  }
   981  
   982  // C comment
   983  //  /* Report on unrecognized arguments */
   984  func _unrecognizedArguments(tls *crt.TLS, _argv0 *int8, _nArg int32, _azArg **int8) {
   985  	var _i int32
   986  	crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(2221), unsafe.Pointer(_argv0))
   987  	_i = int32(0)
   988  _0:
   989  	if _i >= _nArg {
   990  		goto _3
   991  	}
   992  	crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(294), unsafe.Pointer(*elem0(_azArg, uintptr(_i))))
   993  	_i += 1
   994  	goto _0
   995  _3:
   996  	crt.Xfprintf(tls, (*crt.XFILE)(Xstderr), str(298))
   997  	crt.Xexit(tls, int32(1))
   998  }
   999  
  1000  // C comment
  1001  //  /*
  1002  //  ** Look up the next task for client iClient in the database.
  1003  //  ** Return the task script and the task number and mark that
  1004  //  ** task as being under way.
  1005  //  */
  1006  func _startScript(tls *crt.TLS, _iClient int32, _pzScript **int8, _pTaskId *int32, _pzTaskName **int8) (r0 int32) {
  1007  	var _taskId, _rc, _totalTime, _6_n int32
  1008  	var _pStmt unsafe.Pointer
  1009  	_pStmt = nil
  1010  	_totalTime = int32(0)
  1011  	*_pzScript = nil
  1012  	_g.XiTimeout = int32(0)
  1013  _0:
  1014  	_rc = _trySql(tls, str(2249))
  1015  	if _rc == int32(5) {
  1016  		bin.Xsqlite3_sleep(tls, int32(10))
  1017  		_totalTime += int32(10)
  1018  		goto _0
  1019  	}
  1020  	if _rc != int32(0) {
  1021  		_fatalError(tls, str(2265), unsafe.Pointer(bin.Xsqlite3_errmsg(tls, (*bin.Xsqlite3)(_g.Xdb))))
  1022  	}
  1023  	if _g.XnError != 0 || _g.XnTest != 0 {
  1024  		_runSql(tls, str(2284), _g.XnError, _g.XnTest)
  1025  		_g.XnError = int32(0)
  1026  		_g.XnTest = int32(0)
  1027  	}
  1028  	_pStmt = _prepareSql(tls, str(2337), _iClient)
  1029  	_rc = bin.Xsqlite3_step(tls, _pStmt)
  1030  	bin.Xsqlite3_finalize(tls, _pStmt)
  1031  	if _rc == int32(100) {
  1032  		_runSql(tls, str(2383), _iClient)
  1033  		_g.XiTimeout = int32(10000)
  1034  		_runSql(tls, str(2414))
  1035  		return int32(101)
  1036  	}
  1037  	_pStmt = _prepareSql(tls, str(2434), _iClient)
  1038  	_rc = bin.Xsqlite3_step(tls, _pStmt)
  1039  	if _rc == int32(100) {
  1040  		_6_n = bin.Xsqlite3_column_bytes(tls, _pStmt, int32(0))
  1041  		*_pzScript = (*int8)(bin.Xsqlite3_malloc(tls, _6_n+int32(1)))
  1042  		crt.Xstrcpy(tls, *_pzScript, (*int8)(unsafe.Pointer(bin.Xsqlite3_column_text(tls, _pStmt, int32(0)))))
  1043  		*_pTaskId = store2(&_taskId, bin.Xsqlite3_column_int(tls, _pStmt, int32(1)))
  1044  		*_pzTaskName = bin.Xsqlite3_mprintf(tls, str(2526), unsafe.Pointer(bin.Xsqlite3_column_text(tls, _pStmt, int32(2))))
  1045  		bin.Xsqlite3_finalize(tls, _pStmt)
  1046  		_runSql(tls, str(2529), _taskId)
  1047  		_g.XiTimeout = int32(10000)
  1048  		_runSql(tls, str(2414))
  1049  		return int32(0)
  1050  	}
  1051  	bin.Xsqlite3_finalize(tls, _pStmt)
  1052  	if _rc != int32(101) {
  1053  		goto _8
  1054  	}
  1055  	if _totalTime > int32(30000) {
  1056  		_errorMessage(tls, str(2612))
  1057  		_runSql(tls, str(2661), _iClient)
  1058  		bin.Xsqlite3_close(tls, (*bin.Xsqlite3)(_g.Xdb))
  1059  		crt.Xexit(tls, int32(1))
  1060  	}
  1061  _9:
  1062  	if _trySql(tls, str(2701)) == int32(5) {
  1063  		bin.Xsqlite3_sleep(tls, int32(10))
  1064  		_totalTime += int32(10)
  1065  		goto _9
  1066  	}
  1067  	bin.Xsqlite3_sleep(tls, int32(100))
  1068  	_totalTime += int32(100)
  1069  	goto _0
  1070  _8:
  1071  	_fatalError(tls, str(2526), unsafe.Pointer(bin.Xsqlite3_errmsg(tls, (*bin.Xsqlite3)(_g.Xdb))))
  1072  	goto _0
  1073  }
  1074  
  1075  // C comment
  1076  //  /*
  1077  //  ** Prepare an SQL statement.  Issue a fatal error if unable.
  1078  //  */
  1079  func _prepareSql(tls *crt.TLS, _zFormat *int8, args ...interface{}) (r0 unsafe.Pointer) {
  1080  	var _rc int32
  1081  	var _zSql *int8
  1082  	var _pStmt unsafe.Pointer
  1083  	var _ap []interface{}
  1084  	_pStmt = nil
  1085  	_ap = args
  1086  	_zSql = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
  1087  	_ap = nil
  1088  	_rc = bin.Xsqlite3_prepare_v2(tls, (*bin.Xsqlite3)(_g.Xdb), _zSql, int32(-1), &_pStmt, nil)
  1089  	if _rc != int32(0) {
  1090  		bin.Xsqlite3_finalize(tls, _pStmt)
  1091  		_fatalError(tls, str(2161), unsafe.Pointer(bin.Xsqlite3_errmsg(tls, (*bin.Xsqlite3)(_g.Xdb))), unsafe.Pointer(_zSql))
  1092  	}
  1093  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
  1094  	return _pStmt
  1095  }
  1096  
  1097  // C comment
  1098  //  /*
  1099  //  ** Run a script.
  1100  //  */
  1101  func _runScript(tls *crt.TLS, _iClient int32, _taskId int32, _zScript *int8, _zFilename *int8) {
  1102  	var _lineno, _prevLine, _ii, _iBegin, _n, _c, _j, _len, _nArg, _8_rc, _12_jj, _15_jj, _15_isGlob, _20_k, _23_jj, _25_jj, _25_rc, _30_iNewClient, _32_iTimeout, _33_iTarget, _33_iEnd int32
  1103  	var _4_zSql, _12_zAns, _15_zAns, _15_zCopy, _19_zNewFile, _19_zNewScript, _19_zToDel, _33_zTask, _33_zTName, _41_zSql *int8
  1104  	var _25_pStmt unsafe.Pointer
  1105  	var _zError [1000]int8
  1106  	var _zCmd [30]int8
  1107  	var _sResult XString
  1108  	var _azArg [2][100]int8
  1109  	_lineno = int32(1)
  1110  	_prevLine = int32(1)
  1111  	_ii = int32(0)
  1112  	_iBegin = int32(0)
  1113  	crt.Xmemset(tls, unsafe.Pointer(&_sResult), int32(0), uint32(12))
  1114  	_stringReset(tls, &_sResult)
  1115  _0:
  1116  	if store2(&_c, int32(*elem1(_zScript, uintptr(_ii)))) == int32(0) {
  1117  		goto _1
  1118  	}
  1119  	_prevLine = _lineno
  1120  	_len = _tokenLength(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii))), &_lineno)
  1121  	if (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(_c)))))&int32(8192)) != 0 || ((_c == int32(47)) && (int32(*elem1(_zScript, uintptr(_ii+int32(1)))) == int32(42))) {
  1122  		_ii += _len
  1123  		goto _0
  1124  	}
  1125  	if ((_c != int32(45)) || (int32(*elem1(_zScript, uintptr(_ii+int32(1)))) != int32(45))) || ((int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(*elem1(_zScript, uintptr(_ii+int32(2))))))) & int32(1024)) == 0) {
  1126  		_ii += _len
  1127  		goto _0
  1128  	}
  1129  	if _ii > _iBegin {
  1130  		_4_zSql = bin.Xsqlite3_mprintf(tls, str(2708), _ii-_iBegin, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_iBegin)))))
  1131  		_evalSql(tls, &_sResult, _4_zSql)
  1132  		bin.Xsqlite3_free(tls, unsafe.Pointer(_4_zSql))
  1133  		_iBegin = _ii + _len
  1134  	}
  1135  	if _g.XiTrace >= int32(2) {
  1136  		_logMessage(tls, str(2708), _len, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))
  1137  	}
  1138  	_n = _extractToken(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(int32(2)))), _len-int32(2), (*int8)(unsafe.Pointer(&_zCmd)), int32(30))
  1139  	_nArg = int32(0)
  1140  _10:
  1141  	if _n >= (_len-int32(2)) || _nArg >= int32(2) {
  1142  		goto _14
  1143  	}
  1144  _15:
  1145  	if (_n < (_len - int32(2))) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_zScript, uintptr((_ii+int32(2))+_n)))))))&int32(8192)) != 0 {
  1146  		_n += 1
  1147  		goto _15
  1148  	}
  1149  	if _n >= (_len - int32(2)) {
  1150  		goto _14
  1151  	}
  1152  	_n += _extractToken(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(int32(2))))))+uintptr(_n))), (_len-int32(2))-_n, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), uintptr(_nArg)))), int32(100))
  1153  	_nArg += 1
  1154  	goto _10
  1155  _14:
  1156  	_j = _nArg
  1157  _19:
  1158  	if _j >= int32(2) {
  1159  		goto _22
  1160  	}
  1161  	*elem1((*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), uintptr(postInc2(&_j, 1))))), 0) = 0
  1162  	_j += 1
  1163  	goto _19
  1164  _22:
  1165  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2713)) == int32(0) {
  1166  		bin.Xsqlite3_sleep(tls, crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0)))))
  1167  		goto _108
  1168  	}
  1169  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2719)) != int32(0) {
  1170  		goto _25
  1171  	}
  1172  	_8_rc = crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0))))
  1173  	_finishScript(tls, _iClient, _taskId, int32(1))
  1174  	if _8_rc == int32(0) {
  1175  		bin.Xsqlite3_close(tls, (*bin.Xsqlite3)(_g.Xdb))
  1176  	}
  1177  	crt.Xexit(tls, _8_rc)
  1178  	goto _108
  1179  _25:
  1180  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2724)) != int32(0) {
  1181  		goto _28
  1182  	}
  1183  	if _g.XiTrace == int32(1) {
  1184  		_logMessage(tls, str(2708), _len-int32(1), unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))
  1185  	}
  1186  	_stringReset(tls, &_sResult)
  1187  	goto _108
  1188  _28:
  1189  	if (crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2733)) == int32(0)) && (_iClient > int32(0)) {
  1190  		_finishScript(tls, _iClient, _taskId, int32(1))
  1191  		goto _108
  1192  	}
  1193  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2740)) == int32(0) {
  1194  		_stringReset(tls, &_sResult)
  1195  		goto _108
  1196  	}
  1197  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2746)) != int32(0) {
  1198  		goto _36
  1199  	}
  1200  	_12_zAns = (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript)) + uintptr(_ii)))
  1201  	_12_jj = int32(7)
  1202  _37:
  1203  	if _12_jj >= (_len-int32(1)) || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_12_zAns, uintptr(_12_jj)))))))&int32(8192)) == 0 {
  1204  		goto _41
  1205  	}
  1206  	_12_jj += 1
  1207  	goto _37
  1208  _41:
  1209  	*(*uintptr)(unsafe.Pointer(&_12_zAns)) += uintptr(_12_jj)
  1210  	if (((_len - _12_jj) - int32(1)) != _sResult.Xn) || crt.Xstrncmp(tls, _sResult.Xz, _12_zAns, uint32((_len-_12_jj)-int32(1))) != 0 {
  1211  		_errorMessage(tls, str(2752), _prevLine, unsafe.Pointer(_zFilename), (_len-_12_jj)-int32(1), unsafe.Pointer(_12_zAns), unsafe.Pointer(_sResult.Xz))
  1212  	}
  1213  	_g.XnTest += 1
  1214  	_stringReset(tls, &_sResult)
  1215  	goto _108
  1216  _36:
  1217  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2797)) != int32(0) && crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2802)) != int32(0) {
  1218  		goto _46
  1219  	}
  1220  	_15_zAns = (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript)) + uintptr(_ii)))
  1221  	_15_isGlob = bool2int(int32(*elem1((*int8)(unsafe.Pointer(&_zCmd)), 0)) == int32(103))
  1222  	_15_jj = int32(9) - (int32(3) * _15_isGlob)
  1223  _47:
  1224  	if _15_jj >= (_len-int32(1)) || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_15_zAns, uintptr(_15_jj)))))))&int32(8192)) == 0 {
  1225  		goto _51
  1226  	}
  1227  	_15_jj += 1
  1228  	goto _47
  1229  _51:
  1230  	*(*uintptr)(unsafe.Pointer(&_15_zAns)) += uintptr(_15_jj)
  1231  	_15_zCopy = bin.Xsqlite3_mprintf(tls, str(2708), (_len-_15_jj)-int32(1), unsafe.Pointer(_15_zAns))
  1232  	if (bool2int(bin.Xsqlite3_strglob(tls, _15_zCopy, _sResult.Xz) == int32(0)) ^ _15_isGlob) != 0 {
  1233  		_errorMessage(tls, str(2810), _prevLine, unsafe.Pointer(_zFilename), unsafe.Pointer(_15_zCopy), unsafe.Pointer(_sResult.Xz))
  1234  	}
  1235  	bin.Xsqlite3_free(tls, unsafe.Pointer(_15_zCopy))
  1236  	_g.XnTest += 1
  1237  	_stringReset(tls, &_sResult)
  1238  	goto _108
  1239  _46:
  1240  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2853)) == int32(0) {
  1241  		_logMessage(tls, str(2526), unsafe.Pointer(_sResult.Xz))
  1242  		goto _108
  1243  	}
  1244  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2860)) != int32(0) {
  1245  		goto _56
  1246  	}
  1247  	_19_zToDel = nil
  1248  	_19_zNewFile = (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0)))
  1249  	if int32(*elem1(_19_zNewFile, 0)) == int32(47) {
  1250  		goto _57
  1251  	}
  1252  	_20_k = int32(crt.Xstrlen(tls, _zFilename)) - int32(1)
  1253  _58:
  1254  	if _20_k < int32(0) || int32(*elem1(_zFilename, uintptr(_20_k))) == int32(47) {
  1255  		goto _62
  1256  	}
  1257  	_20_k -= 1
  1258  	goto _58
  1259  _62:
  1260  	if _20_k > int32(0) {
  1261  		_19_zNewFile = store1(&_19_zToDel, bin.Xsqlite3_mprintf(tls, str(2867), _20_k, unsafe.Pointer(_zFilename), unsafe.Pointer(_19_zNewFile)))
  1262  	}
  1263  _57:
  1264  	_19_zNewScript = _readFile(tls, _19_zNewFile)
  1265  	if _g.XiTrace != 0 {
  1266  		_logMessage(tls, str(2875), unsafe.Pointer(_19_zNewFile))
  1267  	}
  1268  	_runScript(tls, int32(0), int32(0), _19_zNewScript, _19_zNewFile)
  1269  	bin.Xsqlite3_free(tls, unsafe.Pointer(_19_zNewScript))
  1270  	if _g.XiTrace != 0 {
  1271  		_logMessage(tls, str(2894), unsafe.Pointer(_19_zNewFile))
  1272  	}
  1273  	bin.Xsqlite3_free(tls, unsafe.Pointer(_19_zToDel))
  1274  	goto _108
  1275  _56:
  1276  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2911)) != int32(0) {
  1277  		goto _67
  1278  	}
  1279  	_23_jj = int32(7)
  1280  _68:
  1281  	if _23_jj >= _len || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_zScript, uintptr(_ii+_23_jj)))))))&int32(8192)) == 0 {
  1282  		goto _72
  1283  	}
  1284  	_23_jj += 1
  1285  	goto _68
  1286  _72:
  1287  	_logMessage(tls, str(2708), _len-_23_jj, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_23_jj)))))
  1288  	goto _108
  1289  _67:
  1290  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2917)) != int32(0) {
  1291  		goto _74
  1292  	}
  1293  	_25_jj = int32(4)
  1294  _75:
  1295  	if _25_jj >= _len || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_zScript, uintptr(_ii+_25_jj)))))))&int32(8192)) == 0 {
  1296  		goto _79
  1297  	}
  1298  	_25_jj += 1
  1299  	goto _75
  1300  _79:
  1301  	_25_pStmt = _prepareSql(tls, str(2920), _len-_25_jj, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_25_jj)))))
  1302  	_25_rc = bin.Xsqlite3_step(tls, _25_pStmt)
  1303  	if (_25_rc != int32(100)) || (bin.Xsqlite3_column_int(tls, _25_pStmt, int32(0)) == int32(0)) {
  1304  		_ii += _findEndif(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_len))), int32(1), &_lineno)
  1305  	}
  1306  	bin.Xsqlite3_finalize(tls, _25_pStmt)
  1307  	goto _108
  1308  _74:
  1309  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2932)) == int32(0) {
  1310  		_ii += _findEndif(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_len))), int32(0), &_lineno)
  1311  		goto _108
  1312  	}
  1313  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2937)) == int32(0) {
  1314  		goto _108
  1315  	}
  1316  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2943)) != int32(0) || _iClient != int32(0) {
  1317  		goto _88
  1318  	}
  1319  	_30_iNewClient = crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0))))
  1320  	if _30_iNewClient > int32(0) {
  1321  		_startClient(tls, _30_iNewClient)
  1322  	}
  1323  	goto _108
  1324  _88:
  1325  	if (crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2949)) == int32(0)) && (_iClient == int32(0)) {
  1326  		_32_iTimeout = func() int32 {
  1327  			if _nArg >= int32(2) {
  1328  				return crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), uintptr(1)))))
  1329  			}
  1330  			return int32(10000)
  1331  		}()
  1332  		bin.Xsqlite3_snprintf(tls, int32(1000), (*int8)(unsafe.Pointer(&_zError)), str(2954), _prevLine, unsafe.Pointer(_zFilename))
  1333  		_waitForClient(tls, crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0)))), _32_iTimeout, (*int8)(unsafe.Pointer(&_zError)))
  1334  		goto _108
  1335  	}
  1336  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(2969)) != int32(0) || _iClient != int32(0) {
  1337  		goto _97
  1338  	}
  1339  	_33_iTarget = crt.Xatoi(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0))))
  1340  	_33_iEnd = _findEnd(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_len))), &_lineno)
  1341  	if _33_iTarget < int32(0) {
  1342  		_errorMessage(tls, str(2974), _prevLine, unsafe.Pointer(_zFilename), _33_iTarget)
  1343  		goto _99
  1344  	}
  1345  	_33_zTask = bin.Xsqlite3_mprintf(tls, str(2708), _33_iEnd, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_len)))))
  1346  	if _nArg > int32(1) {
  1347  		_33_zTName = bin.Xsqlite3_mprintf(tls, str(2526), unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), uintptr(1))))
  1348  		goto _101
  1349  	}
  1350  	_33_zTName = bin.Xsqlite3_mprintf(tls, str(3011), unsafe.Pointer(_filenameTail(tls, _zFilename)), _prevLine)
  1351  _101:
  1352  	_startClient(tls, _33_iTarget)
  1353  	_runSql(tls, str(3017), _33_iTarget, unsafe.Pointer(_33_zTask), unsafe.Pointer(_33_zTName))
  1354  	bin.Xsqlite3_free(tls, unsafe.Pointer(_33_zTask))
  1355  	bin.Xsqlite3_free(tls, unsafe.Pointer(_33_zTName))
  1356  _99:
  1357  	_33_iEnd += _tokenLength(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_ii)))))+uintptr(_len)))))+uintptr(_33_iEnd))), &_lineno)
  1358  	_len += _33_iEnd
  1359  	_iBegin = _ii + _len
  1360  	goto _108
  1361  _97:
  1362  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(3073)) == int32(0) {
  1363  		_test_breakpoint(tls)
  1364  		goto _108
  1365  	}
  1366  	if crt.Xstrcmp(tls, (*int8)(unsafe.Pointer(&_zCmd)), str(3084)) == int32(0) {
  1367  		_g.XbIgnoreSqlErrors = func() int32 {
  1368  			if _nArg >= int32(1) {
  1369  				return bool2int(_booleanValue(tls, (*int8)(unsafe.Pointer(elem5((*[100]int8)(unsafe.Pointer(&_azArg)), 0)))) == 0)
  1370  			}
  1371  			return int32(1)
  1372  		}()
  1373  		goto _108
  1374  	}
  1375  	_errorMessage(tls, str(3100), _prevLine, unsafe.Pointer(_zFilename), unsafe.Pointer(&_zCmd))
  1376  _108:
  1377  	_ii += _len
  1378  	goto _0
  1379  _1:
  1380  	if _iBegin < _ii {
  1381  		_41_zSql = bin.Xsqlite3_mprintf(tls, str(2708), _ii-_iBegin, unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_zScript))+uintptr(_iBegin)))))
  1382  		_runSql(tls, _41_zSql)
  1383  		bin.Xsqlite3_free(tls, unsafe.Pointer(_41_zSql))
  1384  	}
  1385  	_stringFree(tls, &_sResult)
  1386  	_ = _zCmd
  1387  	_ = _zError
  1388  	_ = _azArg
  1389  }
  1390  
  1391  // C comment
  1392  //  /* Reset a string to an empty string */
  1393  func _stringReset(tls *crt.TLS, _p *XString) {
  1394  	if _p.Xz == nil {
  1395  		_stringAppend(tls, _p, str(2192), int32(1))
  1396  	}
  1397  	_p.Xn = int32(0)
  1398  	*elem1(_p.Xz, 0) = 0
  1399  }
  1400  
  1401  // C comment
  1402  //  /*
  1403  //  ** Return the length of the next token.
  1404  //  */
  1405  func _tokenLength(tls *crt.TLS, _z *int8, _pnLine *int32) (r0 int32) {
  1406  	var _n, _1_inC, _1_c, _10_delim, _13_c int32
  1407  	_n = int32(0)
  1408  	if (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, 0))))))&int32(8192)) == 0 && (int32(*elem1(_z, 0)) != int32(47) || int32(*elem1(_z, uintptr(1))) != int32(42)) {
  1409  		goto _2
  1410  	}
  1411  	_1_inC = int32(0)
  1412  	if int32(*elem1(_z, 0)) == int32(47) {
  1413  		_1_inC = int32(1)
  1414  		_n = int32(2)
  1415  	}
  1416  _3:
  1417  	if store2(&_1_c, int32(*elem1(_z, uintptr(postInc2(&_n, 1))))) == int32(0) {
  1418  		goto _5
  1419  	}
  1420  	if _1_c == int32(10) {
  1421  		*_pnLine += 1
  1422  	}
  1423  	if (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(_1_c))))) & int32(8192)) != 0 {
  1424  		goto _3
  1425  	}
  1426  	if (_1_inC != 0 && (_1_c == int32(42))) && (int32(*elem1(_z, uintptr(_n))) == int32(47)) {
  1427  		_n += 1
  1428  		_1_inC = int32(0)
  1429  		goto _16
  1430  	}
  1431  	if ((_1_inC == 0) && (_1_c == int32(47))) && (int32(*elem1(_z, uintptr(_n))) == int32(42)) {
  1432  		_n += 1
  1433  		_1_inC = int32(1)
  1434  		goto _16
  1435  	}
  1436  	if _1_inC == 0 {
  1437  		goto _5
  1438  	}
  1439  _16:
  1440  	goto _3
  1441  _5:
  1442  	_n -= 1
  1443  	goto _36
  1444  _2:
  1445  	if int32(*elem1(_z, 0)) != int32(45) || int32(*elem1(_z, uintptr(1))) != int32(45) {
  1446  		goto _19
  1447  	}
  1448  	_n = int32(2)
  1449  _20:
  1450  	if (*elem1(_z, uintptr(_n))) == 0 || int32(*elem1(_z, uintptr(_n))) == int32(10) {
  1451  		goto _24
  1452  	}
  1453  	_n += 1
  1454  	goto _20
  1455  _24:
  1456  	if (*elem1(_z, uintptr(_n))) != 0 {
  1457  		*_pnLine += 1
  1458  		_n += 1
  1459  	}
  1460  	goto _36
  1461  _19:
  1462  	if int32(*elem1(_z, 0)) != int32(34) && int32(*elem1(_z, 0)) != int32(39) {
  1463  		goto _28
  1464  	}
  1465  	_10_delim = int32(*elem1(_z, 0))
  1466  	_n = int32(1)
  1467  _29:
  1468  	if (*elem1(_z, uintptr(_n))) == 0 {
  1469  		goto _32
  1470  	}
  1471  	if int32(*elem1(_z, uintptr(_n))) == int32(10) {
  1472  		*_pnLine += 1
  1473  	}
  1474  	if int32(*elem1(_z, uintptr(_n))) != _10_delim {
  1475  		goto _34
  1476  	}
  1477  	_n += 1
  1478  	if int32(*elem1(_z, uintptr(_n+int32(1)))) != _10_delim {
  1479  		goto _32
  1480  	}
  1481  _34:
  1482  	_n += 1
  1483  	goto _29
  1484  _32:
  1485  	goto _36
  1486  _28:
  1487  	_n = int32(1)
  1488  _37:
  1489  	if store2(&_13_c, int32(*elem1(_z, uintptr(_n)))) == int32(0) || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(_13_c)))))&int32(8192)) != 0 || _13_c == int32(34) || _13_c == int32(39) || _13_c == int32(59) {
  1490  		goto _44
  1491  	}
  1492  	_n += 1
  1493  	goto _37
  1494  _44:
  1495  _36:
  1496  	return _n
  1497  }
  1498  
  1499  // C comment
  1500  //  /*
  1501  //  ** Run arbitrary SQL and record the results in an output string
  1502  //  ** given by the first parameter.
  1503  //  */
  1504  func _evalSql(tls *crt.TLS, _p *XString, _zFormat *int8, args ...interface{}) (r0 int32) {
  1505  	var _rc int32
  1506  	var _zSql, _zErrMsg *int8
  1507  	var _ap []interface{}
  1508  	var _1_zErr [30]int8
  1509  	_zErrMsg = nil
  1510  	_ap = args
  1511  	_zSql = bin.Xsqlite3_vmprintf(tls, _zFormat, _ap)
  1512  	_ap = nil
  1513  	func() {
  1514  		if _g.XiTimeout <= int32(0) {
  1515  			crt.X__builtin_fprintf(tls, Xstderr, str(1897), unsafe.Pointer(str(1933)), int32(494), unsafe.Pointer(&_evalSqlØ00__func__Ø000), unsafe.Pointer(str(3136)))
  1516  			crt.X__builtin_abort(tls)
  1517  		}
  1518  	}()
  1519  	_rc = bin.Xsqlite3_exec(tls, (*bin.Xsqlite3)(_g.Xdb), _zSql, _evalCallback, unsafe.Pointer(_p), &_zErrMsg)
  1520  	bin.Xsqlite3_free(tls, unsafe.Pointer(_zSql))
  1521  	if _rc == 0 {
  1522  		goto _2
  1523  	}
  1524  	bin.Xsqlite3_snprintf(tls, int32(30), (*int8)(unsafe.Pointer(&_1_zErr)), str(3149), _rc)
  1525  	_stringAppendTerm(tls, _p, (*int8)(unsafe.Pointer(&_1_zErr)))
  1526  	if _zErrMsg != nil {
  1527  		_stringAppendTerm(tls, _p, _zErrMsg)
  1528  		bin.Xsqlite3_free(tls, unsafe.Pointer(_zErrMsg))
  1529  	}
  1530  _2:
  1531  	return _rc
  1532  
  1533  	_ = _1_zErr
  1534  	panic(0)
  1535  }
  1536  
  1537  var _evalSqlØ00__func__Ø000 [8]int8
  1538  
  1539  func init() {
  1540  	crt.Xstrncpy(nil, &_evalSqlØ00__func__Ø000[0], str(3159), 8)
  1541  }
  1542  
  1543  // C comment
  1544  //  /*
  1545  //  ** Copy a single token into a string buffer.
  1546  //  */
  1547  func _extractToken(tls *crt.TLS, _zIn *int8, _nIn int32, _zOut *int8, _nOut int32) (r0 int32) {
  1548  	var _i int32
  1549  	if _nIn <= int32(0) {
  1550  		*elem1(_zOut, 0) = 0
  1551  		return int32(0)
  1552  	}
  1553  	_i = int32(0)
  1554  _1:
  1555  	if _i >= _nIn || _i >= (_nOut-int32(1)) || (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_zIn, uintptr(_i)))))))&int32(8192)) != 0 {
  1556  		goto _6
  1557  	}
  1558  	*elem1(_zOut, uintptr(_i)) = *elem1(_zIn, uintptr(_i))
  1559  	_i += 1
  1560  	goto _1
  1561  _6:
  1562  	*elem1(_zOut, uintptr(_i)) = 0
  1563  	return _i
  1564  }
  1565  
  1566  // C comment
  1567  //  /*
  1568  //  ** Mark a script as having finished.   Remove the CLIENT table entry
  1569  //  ** if bShutdown is true.
  1570  //  */
  1571  func _finishScript(tls *crt.TLS, _iClient int32, _taskId int32, _bShutdown int32) (r0 int32) {
  1572  	_runSql(tls, str(3167), _taskId)
  1573  	if _bShutdown != 0 {
  1574  		_runSql(tls, str(2383), _iClient)
  1575  	}
  1576  	return int32(0)
  1577  }
  1578  
  1579  // C comment
  1580  //  /*
  1581  //  ** Read the entire content of a file into memory
  1582  //  */
  1583  func _readFile(tls *crt.TLS, _zFilename *int8) (r0 *int8) {
  1584  	var _sz int32
  1585  	var _z *int8
  1586  	var _in *crt.XFILE
  1587  	_in = crt.Xfopen64(tls, _zFilename, str(3248))
  1588  	if _in == nil {
  1589  		_fatalError(tls, str(3251), unsafe.Pointer(_zFilename))
  1590  	}
  1591  	crt.Xfseek(tls, _in, int32(0), int32(2))
  1592  	_sz = crt.Xftell(tls, _in)
  1593  	crt.Xrewind(tls, _in)
  1594  	_z = (*int8)(bin.Xsqlite3_malloc(tls, _sz+int32(1)))
  1595  	_sz = int32(crt.Xfread(tls, unsafe.Pointer(_z), uint32(1), uint32(_sz), _in))
  1596  	*elem1(_z, uintptr(_sz)) = 0
  1597  	crt.Xfclose(tls, _in)
  1598  	return _z
  1599  }
  1600  
  1601  // C comment
  1602  //  /*
  1603  //  ** Find the number of characters up to the first character past the
  1604  //  ** of the next "--endif"  or "--else" token. Nested --if commands are
  1605  //  ** also skipped.
  1606  //  */
  1607  func _findEndif(tls *crt.TLS, _z *int8, _stopAtElse int32, _pnLine *int32) (r0 int32) {
  1608  	var _n, _1_len, _3_skip int32
  1609  	_n = int32(0)
  1610  _0:
  1611  	if (*elem1(_z, uintptr(_n))) == 0 {
  1612  		goto _1
  1613  	}
  1614  	_1_len = _tokenLength(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), _pnLine)
  1615  	if ((crt.Xstrncmp(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), str(3280), uint32(7)) == int32(0)) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_n+int32(7))))))))&int32(8192)) != 0) || ((_stopAtElse != 0 && (crt.Xstrncmp(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), str(3288), uint32(6)) == int32(0))) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_n+int32(6))))))))&int32(8192)) != 0) {
  1616  		return _n + _1_len
  1617  	}
  1618  	if (crt.Xstrncmp(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), str(3295), uint32(4)) == int32(0)) && (int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_n+int32(4))))))))&int32(8192)) != 0 {
  1619  		_3_skip = _findEndif(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer((*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n)))))+uintptr(_1_len))), int32(0), _pnLine)
  1620  		_n += _3_skip + _1_len
  1621  		goto _9
  1622  	}
  1623  	_n += _1_len
  1624  _9:
  1625  	goto _0
  1626  _1:
  1627  	return _n
  1628  }
  1629  
  1630  // C comment
  1631  //  /*
  1632  //  ** Start up a client process for iClient, if it is not already
  1633  //  ** running.  If the client is already running, then this routine
  1634  //  ** is a no-op.
  1635  //  */
  1636  func _startClient(tls *crt.TLS, _iClient int32) {
  1637  	var _1_rc int32
  1638  	var _1_zSys *int8
  1639  	_runSql(tls, str(3300), _iClient)
  1640  	if bin.Xsqlite3_changes(tls, (*bin.Xsqlite3)(_g.Xdb)) == 0 {
  1641  		goto _0
  1642  	}
  1643  	_1_zSys = bin.Xsqlite3_mprintf(tls, str(3342), unsafe.Pointer(_g.Xargv0), unsafe.Pointer(_g.XzDbFile), _iClient, _g.XiTrace)
  1644  	if _g.XbSqlTrace != 0 {
  1645  		_1_zSys = bin.Xsqlite3_mprintf(tls, str(3373), unsafe.Pointer(_1_zSys))
  1646  	}
  1647  	if _g.XbSync != 0 {
  1648  		_1_zSys = bin.Xsqlite3_mprintf(tls, str(3387), unsafe.Pointer(_1_zSys))
  1649  	}
  1650  	if _g.XzVfs != nil {
  1651  		_1_zSys = bin.Xsqlite3_mprintf(tls, str(3397), unsafe.Pointer(_1_zSys), unsafe.Pointer(_g.XzVfs))
  1652  	}
  1653  	if _g.XiTrace >= int32(2) {
  1654  		_logMessage(tls, str(3411), unsafe.Pointer(_1_zSys))
  1655  	}
  1656  	_1_zSys = bin.Xsqlite3_mprintf(tls, str(3424), unsafe.Pointer(_1_zSys))
  1657  	_1_rc = crt.Xsystem(tls, _1_zSys)
  1658  	if _1_rc != 0 {
  1659  		_errorMessage(tls, str(3429), _1_rc)
  1660  	}
  1661  	bin.Xsqlite3_free(tls, unsafe.Pointer(_1_zSys))
  1662  _0:
  1663  }
  1664  
  1665  // C comment
  1666  //  /*
  1667  //  ** Wait for a client process to complete all its tasks
  1668  //  */
  1669  func _waitForClient(tls *crt.TLS, _iClient int32, _iTimeout int32, _zErrPrefix *int8) {
  1670  	var _rc int32
  1671  	var _pStmt unsafe.Pointer
  1672  	if _iClient > int32(0) {
  1673  		_pStmt = _prepareSql(tls, str(3463), _iClient)
  1674  		goto _1
  1675  	}
  1676  	_pStmt = _prepareSql(tls, str(3559))
  1677  _1:
  1678  	_g.XiTimeout = int32(0)
  1679  _2:
  1680  	if ((store2(&_rc, bin.Xsqlite3_step(tls, _pStmt)) == int32(5)) || (_rc == int32(100))) && (_iTimeout > int32(0)) {
  1681  		bin.Xsqlite3_reset(tls, _pStmt)
  1682  		bin.Xsqlite3_sleep(tls, int32(50))
  1683  		_iTimeout -= int32(50)
  1684  		goto _2
  1685  	}
  1686  	bin.Xsqlite3_finalize(tls, _pStmt)
  1687  	_g.XiTimeout = int32(10000)
  1688  	if _rc == int32(101) {
  1689  		goto _6
  1690  	}
  1691  	if _zErrPrefix == nil {
  1692  		_zErrPrefix = str(454)
  1693  	}
  1694  	if _iClient > int32(0) {
  1695  		_errorMessage(tls, str(3640), unsafe.Pointer(_zErrPrefix), _iClient)
  1696  		goto _9
  1697  	}
  1698  	_errorMessage(tls, str(3672), unsafe.Pointer(_zErrPrefix))
  1699  _9:
  1700  _6:
  1701  }
  1702  
  1703  // C comment
  1704  //  /*
  1705  //  ** Find the number of characters up to the start of the next "--end" token.
  1706  //  */
  1707  func _findEnd(tls *crt.TLS, _z *int8, _pnLine *int32) (r0 int32) {
  1708  	var _n int32
  1709  	_n = int32(0)
  1710  _0:
  1711  	if ((*elem1(_z, uintptr(_n))) != 0) && (crt.Xstrncmp(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), str(3706), uint32(5)) != 0 || ((int32(*elem3(*crt.X__ctype_b_loc(tls), uintptr(int32(uint8(*elem1(_z, uintptr(_n+int32(5)))))))) & int32(8192)) == 0)) {
  1712  		_n += _tokenLength(tls, (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z))+uintptr(_n))), _pnLine)
  1713  		goto _0
  1714  	}
  1715  	return _n
  1716  }
  1717  
  1718  // C comment
  1719  //  /* Return a pointer to the tail of a filename
  1720  //  */
  1721  func _filenameTail(tls *crt.TLS, _z *int8) (r0 *int8) {
  1722  	var _i, _j int32
  1723  	_i = store2(&_j, int32(0))
  1724  _0:
  1725  	if (*elem1(_z, uintptr(_i))) == 0 {
  1726  		goto _3
  1727  	}
  1728  	if int32(*elem1(_z, uintptr(_i))) == int32(47) {
  1729  		_j = _i + int32(1)
  1730  	}
  1731  	_i += 1
  1732  	goto _0
  1733  _3:
  1734  	return (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(_z)) + uintptr(_j)))
  1735  }
  1736  
  1737  // C comment
  1738  //  /* This routine exists as a convenient place to set a debugger
  1739  //  ** breakpoint.
  1740  //  */
  1741  func _test_breakpoint(tls *crt.TLS) {
  1742  	_test_breakpointØ00cntØ001 += 1
  1743  }
  1744  
  1745  // C comment
  1746  //  /* This routine exists as a convenient place to set a debugger
  1747  //  ** breakpoint.
  1748  //  */
  1749  var _test_breakpointØ00cntØ001 int32
  1750  
  1751  // C comment
  1752  //  /*
  1753  //  ** Interpret zArg as a boolean value.  Return either 0 or 1.
  1754  //  */
  1755  func _booleanValue(tls *crt.TLS, _zArg *int8) (r0 int32) {
  1756  	var _i int32
  1757  	if _zArg == nil {
  1758  		return int32(0)
  1759  	}
  1760  	_i = int32(0)
  1761  _1:
  1762  	if int32(*elem1(_zArg, uintptr(_i))) < int32(48) || int32(*elem1(_zArg, uintptr(_i))) > int32(57) {
  1763  		goto _5
  1764  	}
  1765  	_i += 1
  1766  	goto _1
  1767  _5:
  1768  	if (_i > int32(0)) && (int32(*elem1(_zArg, uintptr(_i))) == int32(0)) {
  1769  		return crt.Xatoi(tls, _zArg)
  1770  	}
  1771  	if (bin.Xsqlite3_stricmp(tls, _zArg, str(3712)) == int32(0)) || (bin.Xsqlite3_stricmp(tls, _zArg, str(3715)) == int32(0)) {
  1772  		return int32(1)
  1773  	}
  1774  	if (bin.Xsqlite3_stricmp(tls, _zArg, str(3719)) == int32(0)) || (bin.Xsqlite3_stricmp(tls, _zArg, str(3723)) == int32(0)) {
  1775  		return int32(0)
  1776  	}
  1777  	_errorMessage(tls, str(3726), unsafe.Pointer(_zArg))
  1778  	return int32(0)
  1779  }
  1780  
  1781  func bool2int(b bool) int32 {
  1782  	if b {
  1783  		return 1
  1784  	}
  1785  	return 0
  1786  }
  1787  func bug20530(interface{}) {} //TODO remove when https://github.com/golang/go/issues/20530 is fixed.
  1788  func init()                { nzf32 *= -1; nzf64 *= -1 }
  1789  
  1790  var inf = math.Inf(1)
  1791  var nzf32 float32 // -0.0
  1792  var nzf64 float64 // -0.0
  1793  func elem0(a **int8, index uintptr) **int8 {
  1794  	return (**int8)(unsafe.Pointer(uintptr(unsafe.Pointer(a)) + 4*index))
  1795  }
  1796  func elem4(a *unsafe.Pointer, index uintptr) *unsafe.Pointer {
  1797  	return (*unsafe.Pointer)(unsafe.Pointer(uintptr(unsafe.Pointer(a)) + 4*index))
  1798  }
  1799  func elem5(a *[100]int8, index uintptr) *[100]int8 {
  1800  	return (*[100]int8)(unsafe.Pointer(uintptr(unsafe.Pointer(a)) + 100*index))
  1801  }
  1802  func elem1(a *int8, index uintptr) *int8 {
  1803  	return (*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(a)) + 1*index))
  1804  }
  1805  func elem3(a *uint16, index uintptr) *uint16 {
  1806  	return (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(a)) + 2*index))
  1807  }
  1808  func postInc1(p **int8, d int) *int8 {
  1809  	q := (*uintptr)(unsafe.Pointer(p))
  1810  	v := *q
  1811  	*q += uintptr(d)
  1812  	return (*int8)(unsafe.Pointer(v))
  1813  }
  1814  func postInc2(p *int32, d int32) int32 { v := *p; *p += d; return v }
  1815  func preInc2(p *int32, d int32) int32  { v := *p + d; *p = v; return v }
  1816  func store1(p **int8, v *int8) *int8   { *p = v; return v }
  1817  func store2(p *int32, v int32) int32   { *p = v; return v }
  1818  
  1819  type TGlobal struct {
  1820  	Xargv0            *int8
  1821  	XzVfs             *int8
  1822  	XzDbFile          *int8
  1823  	Xdb               unsafe.Pointer
  1824  	XzErrLog          *int8
  1825  	XpErrLog          unsafe.Pointer
  1826  	XzLog             *int8
  1827  	XpLog             unsafe.Pointer
  1828  	XzName            [32]int8
  1829  	XtaskId           int32
  1830  	XiTrace           int32
  1831  	XbSqlTrace        int32
  1832  	XbIgnoreSqlErrors int32
  1833  	XnError           int32
  1834  	XnTest            int32
  1835  	XiTimeout         int32
  1836  	XbSync            int32
  1837  } // t6 struct{argv0 *int8,zVfs *int8,zDbFile *int8,db *struct{},zErrLog *int8,pErrLog *struct{},zLog *int8,pLog *struct{},zName [32]int8,taskId int32,iTrace int32,bSqlTrace int32,bIgnoreSqlErrors int32,nError int32,nTest int32,iTimeout int32,bSync int32}
  1838  
  1839  type XString struct {
  1840  	Xz      *int8
  1841  	Xn      int32
  1842  	XnAlloc int32
  1843  }                       // t7 struct{z *int8,n int32,nAlloc int32}
  1844  func str(n int) *int8   { return (*int8)(unsafe.Pointer(&strTab[n])) }
  1845  func wstr(n int) *int32 { return (*int32)(unsafe.Pointer(&strTab[n])) }
  1846  
  1847  var strTab = []byte("*.test\x002017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b\x00SQLite library and header mismatch\x0aLibrary: %s\x0aHeader:  %s\x0a\x00%05d.mptest\x00journalmode\x00repeat\x00vfs\x00client\x00errlog\x00log\x00trace\x00quiet\x00timeout\x00sqltrace\x00sync\x00a\x00illegal client number: %d\x0a\x00%05d.client%02d\x00BEGIN: %s\x00 %s\x00\x0a\x00With SQLite 3.19.3 2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b\x0a\x00-DSQLITE_%s\x0a\x00... %strying to unlink '%s'\x0a\x00still \x00\x00unable to unlink '%s' after %d attempts\x0a\x00cannot open [%s]\x00PRAGMA journal_mode=%Q;\x00PRAGMA synchronous=OFF\x00vfsname\x00eval\x00start-client\x00begin %s (%d)\x00end %s (%d)\x00end-client\x00missing script filename\x00DROP TABLE IF EXISTS task;\x0aDROP TABLE IF EXISTS counters;\x0aDROP TABLE IF EXISTS client;\x0aCREATE TABLE task(\x0a  id INTEGER PRIMARY KEY,\x0a  name TEXT,\x0a  client INTEGER,\x0a  starttime DATE,\x0a  endtime DATE,\x0a  script TEXT\x0a);CREATE INDEX task_i1 ON task(client, starttime);\x0aCREATE INDEX task_i2 ON task(client, endtime);\x0aCREATE TABLE counters(nError,nTest);\x0aINSERT INTO counters VALUES(0,0);\x0aCREATE TABLE client(id INTEGER PRIMARY KEY, wantHalt);\x0a\x00begin script [%s] cycle %d\x0a\x00end script [%s] cycle %d\x0a\x00during shutdown...\x0a\x00UPDATE client SET wantHalt=1\x00SELECT 1 FROM client\x00SELECT nError, nTest FROM counters\x00Summary: %d errors out of %d tests\x0a\x00END: %s\x00Usage: %s DATABASE ?OPTIONS? ?SCRIPT?\x0a\x00Options:\x0a   --errlog FILENAME           Write errors to FILENAME\x0a   --journalmode MODE          Use MODE as the journal_mode\x0a   --log FILENAME              Log messages to FILENAME\x0a   --quiet                     Suppress unnecessary output\x0a   --vfs NAME                  Use NAME as the VFS\x0a   --repeat N                  Repeat the test N times\x0a   --sqltrace                  Enable SQL tracing\x0a   --sync                      Enable synchronous disk writes\x0a   --timeout MILLISEC          Busy timeout is MILLISEC\x0a   --trace BOOLEAN             Enable or disable tracing\x0a\x00%s:%i: assertion failure in %s: %s\x0a\x00../../../sqlite.org/sqlite-src-3190300/mptest/mptest.c\x00hasArg==0 || hasArg==1\x00command-line option \"--%s\" requires an argument\x00findOption\x00%s:FATAL: \x00UPDATE client SET wantHalt=1;\x00%s%.*s\x0a\x00(info) %s\x00(errcode=%d) %s\x00%s: \x00%s:ERROR: \x00%s\x0a%s\x0a\x00timeout after %dms\x00main\x00 \x00nil\x00'\x00out of memory\x00[%.*s]\x00%s: unrecognized arguments:\x00BEGIN IMMEDIATE\x00in startScript: %s\x00UPDATE counters SET nError=nError+%d, nTest=nTest+%d\x00SELECT 1 FROM client WHERE id=%d AND wantHalt\x00DELETE FROM client WHERE id=%d\x00COMMIT TRANSACTION;\x00SELECT script, id, name FROM task WHERE client=%d AND starttime IS NULL ORDER BY id LIMIT 1\x00%s\x00UPDATE task   SET starttime=strftime('%%Y-%%m-%%d %%H:%%M:%%f','now') WHERE id=%d;\x00Waited over 30 seconds with no work.  Giving up.\x00DELETE FROM client WHERE id=%d; COMMIT;\x00COMMIT\x00%.*s\x00sleep\x00exit\x00testcase\x00finish\x00reset\x00match\x00line %d of %s:\x0aExpected [%.*s]\x0a     Got [%s]\x00glob\x00notglob\x00line %d of %s:\x0aExpected [%s]\x0a     Got [%s]\x00output\x00source\x00%.*s/%s\x00begin script [%s]\x0a\x00end script [%s]\x0a\x00print\x00if\x00SELECT %.*s\x00else\x00endif\x00start\x00wait\x00line %d of %s\x0a\x00task\x00line %d of %s: bad client number: %d\x00%s:%d\x00INSERT INTO task(client,script,name) VALUES(%d,'%q',%Q)\x00breakpoint\x00show-sql-errors\x00line %d of %s: unknown command --%s\x00g.iTimeout>0\x00error(%d)\x00evalSql\x00UPDATE task   SET endtime=strftime('%%Y-%%m-%%d %%H:%%M:%%f','now') WHERE id=%d;\x00rb\x00cannot open \"%s\" for reading\x00--endif\x00--else\x00--if\x00INSERT OR IGNORE INTO client VALUES(%d,0)\x00%s \"%s\" --client %d --trace %d\x00%z --sqltrace\x00%z --sync\x00%z --vfs \"%s\"\x00system('%q')\x00%z &\x00system() fails with error code %d\x00SELECT 1 FROM task WHERE client=%d   AND client IN (SELECT id FROM client)  AND endtime IS NULL\x00SELECT 1 FROM task WHERE client IN (SELECT id FROM client)   AND endtime IS NULL\x00%stimeout waiting for client %d\x00%stimeout waiting for all clients\x00--end\x00on\x00yes\x00off\x00no\x00unknown boolean: [%s]\x00")