github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/internal/testfixture/testfixture_freebsd_amd64.go (about)

     1  // Code generated by 'ccgo -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_SERIES_CONSTRAINT_VERIFY=1 -DSQLITE_SERVER=1 -DTCLSH_INIT_PROC=sqlite3TestInit -D_HAVE_SQLITE_CONFIG_H -I/usr/include/tcl8.6 -export-defines "" -export-fields F -trace-translation-units -volatile=sqlite3_io_error_pending,sqlite3_open_file_count,sqlite3_pager_readdb_count,sqlite3_pager_writedb_count,sqlite3_pager_writej_count,sqlite3_search_count,sqlite3_sort_count,saved_cnt -lmodernc.org/sqlite/libtest -lmodernc.org/tcl/lib -lmodernc.org/z/lib -o internal/testfixture/testfixture_freebsd_amd64.go -Itestdata/sqlite-src-3360000/ext/async -Itestdata/sqlite-src-3360000/ext/fts3 -Itestdata/sqlite-src-3360000/ext/icu -Itestdata/sqlite-src-3360000/ext/rtree -Itestdata/sqlite-src-3360000/ext/session -Itestdata/sqlite-src-3360000/ext/userauth -Itestdata/sqlite-src-3360000/src -Itestdata/sqlite-amalgamation-3360000 -Itestdata/sqlite-src-3360000 testdata/sqlite-src-3360000/ext/expert/sqlite3expert.c testdata/sqlite-src-3360000/ext/expert/test_expert.c testdata/sqlite-src-3360000/ext/fts3/fts3_term.c testdata/sqlite-src-3360000/ext/fts3/fts3_test.c testdata/sqlite-src-3360000/ext/fts5/fts5_tcl.c testdata/sqlite-src-3360000/ext/fts5/fts5_test_mi.c testdata/sqlite-src-3360000/ext/fts5/fts5_test_tok.c testdata/sqlite-src-3360000/ext/misc/appendvfs.c testdata/sqlite-src-3360000/ext/misc/amatch.c testdata/sqlite-src-3360000/ext/misc/carray.c testdata/sqlite-src-3360000/ext/misc/cksumvfs.c testdata/sqlite-src-3360000/ext/misc/closure.c testdata/sqlite-src-3360000/ext/misc/csv.c testdata/sqlite-src-3360000/ext/misc/decimal.c testdata/sqlite-src-3360000/ext/misc/eval.c testdata/sqlite-src-3360000/ext/misc/explain.c testdata/sqlite-src-3360000/ext/misc/fileio.c testdata/sqlite-src-3360000/ext/misc/fuzzer.c testdata/sqlite-src-3360000/ext/misc/ieee754.c testdata/sqlite-src-3360000/ext/misc/mmapwarm.c testdata/sqlite-src-3360000/ext/misc/nextchar.c testdata/sqlite-src-3360000/ext/misc/normalize.c testdata/sqlite-src-3360000/ext/misc/percentile.c testdata/sqlite-src-3360000/ext/misc/prefixes.c testdata/sqlite-src-3360000/ext/misc/regexp.c testdata/sqlite-src-3360000/ext/misc/remember.c testdata/sqlite-src-3360000/ext/misc/series.c testdata/sqlite-src-3360000/ext/misc/spellfix.c testdata/sqlite-src-3360000/ext/misc/totype.c testdata/sqlite-src-3360000/ext/misc/unionvtab.c testdata/sqlite-src-3360000/ext/misc/wholenumber.c testdata/sqlite-src-3360000/ext/misc/zipfile.c testdata/sqlite-src-3360000/ext/rbu/test_rbu.c testdata/sqlite-src-3360000/ext/session/test_session.c testdata/sqlite-src-3360000/ext/userauth/userauth.c testdata/sqlite-src-3360000/src/tclsqlite.c testdata/sqlite-src-3360000/src/test1.c testdata/sqlite-src-3360000/src/test2.c testdata/sqlite-src-3360000/src/test3.c testdata/sqlite-src-3360000/src/test4.c testdata/sqlite-src-3360000/src/test5.c testdata/sqlite-src-3360000/src/test6.c testdata/sqlite-src-3360000/src/test7.c testdata/sqlite-src-3360000/src/test8.c testdata/sqlite-src-3360000/src/test9.c testdata/sqlite-src-3360000/src/test_async.c testdata/sqlite-src-3360000/src/test_autoext.c testdata/sqlite-src-3360000/src/test_backup.c testdata/sqlite-src-3360000/src/test_bestindex.c testdata/sqlite-src-3360000/src/test_blob.c testdata/sqlite-src-3360000/src/test_btree.c testdata/sqlite-src-3360000/src/test_config.c testdata/sqlite-src-3360000/src/test_delete.c testdata/sqlite-src-3360000/src/test_demovfs.c testdata/sqlite-src-3360000/src/test_devsym.c testdata/sqlite-src-3360000/src/test_fs.c testdata/sqlite-src-3360000/src/test_func.c testdata/sqlite-src-3360000/src/test_hexio.c testdata/sqlite-src-3360000/src/test_init.c testdata/sqlite-src-3360000/src/test_intarray.c testdata/sqlite-src-3360000/src/test_journal.c testdata/sqlite-src-3360000/src/test_malloc.c testdata/sqlite-src-3360000/src/test_md5.c testdata/sqlite-src-3360000/src/test_multiplex.c testdata/sqlite-src-3360000/src/test_mutex.c testdata/sqlite-src-3360000/src/test_onefile.c testdata/sqlite-src-3360000/src/test_osinst.c testdata/sqlite-src-3360000/src/test_pcache.c testdata/sqlite-src-3360000/src/test_quota.c testdata/sqlite-src-3360000/src/test_rtree.c testdata/sqlite-src-3360000/src/test_schema.c testdata/sqlite-src-3360000/src/test_server.c testdata/sqlite-src-3360000/src/test_superlock.c testdata/sqlite-src-3360000/src/test_syscall.c testdata/sqlite-src-3360000/src/test_tclsh.c testdata/sqlite-src-3360000/src/test_tclvar.c testdata/sqlite-src-3360000/src/test_thread.c testdata/sqlite-src-3360000/src/test_vdbecov.c testdata/sqlite-src-3360000/src/test_vfs.c testdata/sqlite-src-3360000/src/test_windirent.c testdata/sqlite-src-3360000/src/test_window.c testdata/sqlite-src-3360000/src/test_wsd.c -DNDEBUG -DHAVE_USLEEP -DLONGDOUBLE_TYPE=double -DSQLITE_CKSUMVFS_STATIC -DSQLITE_CORE -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_PAGE_SIZE=1024 -DSQLITE_ENABLE_BYTECODE_VTAB -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_DESERIALIZE -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_OFFSET_SQL_FUNC -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_RBU -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_SNAPSHOT -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_HAVE_ZLIB=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_MUTEX_APPDEF=1 -DSQLITE_SOUNDEX -DSQLITE_TEMP_STORE=1 -DSQLITE_TEST -DSQLITE_THREADSAFE=1 -DSQLITE_MUTEX_NOOP -lmodernc.org/sqlite/internal/libc2', DO NOT EDIT.
     2  
     3  package main
     4  
     5  import (
     6  	"math"
     7  	"reflect"
     8  	"sync/atomic"
     9  	"unsafe"
    10  
    11  	"modernc.org/libc"
    12  	"modernc.org/libc/sys/types"
    13  	"modernc.org/sqlite/internal/libc2"
    14  	"modernc.org/sqlite/libtest"
    15  	"modernc.org/tcl/lib"
    16  	"modernc.org/z/lib"
    17  )
    18  
    19  var _ = math.Pi
    20  var _ reflect.Kind
    21  var _ atomic.Value
    22  var _ unsafe.Pointer
    23  var _ types.Size_t
    24  
    25  func main() { libc.Start(main1) }
    26  
    27  const (
    28  	BUFSIZ                                = 1024
    29  	EOF                                   = -1
    30  	EXPERT_CONFIG_SAMPLE                  = 1
    31  	EXPERT_REPORT_CANDIDATES              = 4
    32  	EXPERT_REPORT_INDEXES                 = 2
    33  	EXPERT_REPORT_PLAN                    = 3
    34  	EXPERT_REPORT_SQL                     = 1
    35  	FILENAME_MAX                          = 1024
    36  	FOPEN_MAX                             = 20
    37  	FTS5_TOKENIZE_AUX                     = 0x0008
    38  	FTS5_TOKENIZE_DOCUMENT                = 0x0004
    39  	FTS5_TOKENIZE_PREFIX                  = 0x0002
    40  	FTS5_TOKENIZE_QUERY                   = 0x0001
    41  	FTS5_TOKEN_COLOCATED                  = 0x0001
    42  	FULLY_WITHIN                          = 2
    43  	HAVE_USLEEP                           = 1
    44  	IDX_HASH_SIZE                         = 1023
    45  	L_ctermid                             = 1024
    46  	L_cuserid                             = 17
    47  	L_tmpnam                              = 1024
    48  	NDEBUG                                = 1
    49  	NOT_WITHIN                            = 0
    50  	PARTLY_WITHIN                         = 1
    51  	P_tmpdir                              = "/tmp/"
    52  	SEEK_CUR                              = 1
    53  	SEEK_END                              = 2
    54  	SEEK_SET                              = 0
    55  	SQLITE3_H                             = 0
    56  	SQLITE3_TEXT                          = 3
    57  	SQLITEEXPERT_H                        = 1
    58  	SQLITE_ABORT                          = 4
    59  	SQLITE_ABORT_ROLLBACK                 = 516
    60  	SQLITE_ACCESS_EXISTS                  = 0
    61  	SQLITE_ACCESS_READ                    = 2
    62  	SQLITE_ACCESS_READWRITE               = 1
    63  	SQLITE_ALTER_TABLE                    = 26
    64  	SQLITE_ANALYZE                        = 28
    65  	SQLITE_ANY                            = 5
    66  	SQLITE_API                            = 0
    67  	SQLITE_APICALL                        = 0
    68  	SQLITE_ATTACH                         = 24
    69  	SQLITE_AUTH                           = 23
    70  	SQLITE_AUTH_USER                      = 279
    71  	SQLITE_BLOB                           = 4
    72  	SQLITE_BUSY                           = 5
    73  	SQLITE_BUSY_RECOVERY                  = 261
    74  	SQLITE_BUSY_SNAPSHOT                  = 517
    75  	SQLITE_BUSY_TIMEOUT                   = 773
    76  	SQLITE_CALLBACK                       = 0
    77  	SQLITE_CANTOPEN                       = 14
    78  	SQLITE_CANTOPEN_CONVPATH              = 1038
    79  	SQLITE_CANTOPEN_DIRTYWAL              = 1294
    80  	SQLITE_CANTOPEN_FULLPATH              = 782
    81  	SQLITE_CANTOPEN_ISDIR                 = 526
    82  	SQLITE_CANTOPEN_NOTEMPDIR             = 270
    83  	SQLITE_CANTOPEN_SYMLINK               = 1550
    84  	SQLITE_CDECL                          = 0
    85  	SQLITE_CHANGESETAPPLY_INVERT          = 0x0002
    86  	SQLITE_CHANGESETAPPLY_NOSAVEPOINT     = 0x0001
    87  	SQLITE_CHANGESETSTART_INVERT          = 0x0002
    88  	SQLITE_CHANGESET_ABORT                = 2
    89  	SQLITE_CHANGESET_CONFLICT             = 3
    90  	SQLITE_CHANGESET_CONSTRAINT           = 4
    91  	SQLITE_CHANGESET_DATA                 = 1
    92  	SQLITE_CHANGESET_FOREIGN_KEY          = 5
    93  	SQLITE_CHANGESET_NOTFOUND             = 2
    94  	SQLITE_CHANGESET_OMIT                 = 0
    95  	SQLITE_CHANGESET_REPLACE              = 1
    96  	SQLITE_CHECKPOINT_FULL                = 1
    97  	SQLITE_CHECKPOINT_PASSIVE             = 0
    98  	SQLITE_CHECKPOINT_RESTART             = 2
    99  	SQLITE_CHECKPOINT_TRUNCATE            = 3
   100  	SQLITE_CKSUMVFS_STATIC                = 1
   101  	SQLITE_CONFIG_COVERING_INDEX_SCAN     = 20
   102  	SQLITE_CONFIG_GETMALLOC               = 5
   103  	SQLITE_CONFIG_GETMUTEX                = 11
   104  	SQLITE_CONFIG_GETPCACHE               = 15
   105  	SQLITE_CONFIG_GETPCACHE2              = 19
   106  	SQLITE_CONFIG_HEAP                    = 8
   107  	SQLITE_CONFIG_LOG                     = 16
   108  	SQLITE_CONFIG_LOOKASIDE               = 13
   109  	SQLITE_CONFIG_MALLOC                  = 4
   110  	SQLITE_CONFIG_MEMDB_MAXSIZE           = 29
   111  	SQLITE_CONFIG_MEMSTATUS               = 9
   112  	SQLITE_CONFIG_MMAP_SIZE               = 22
   113  	SQLITE_CONFIG_MULTITHREAD             = 2
   114  	SQLITE_CONFIG_MUTEX                   = 10
   115  	SQLITE_CONFIG_PAGECACHE               = 7
   116  	SQLITE_CONFIG_PCACHE                  = 14
   117  	SQLITE_CONFIG_PCACHE2                 = 18
   118  	SQLITE_CONFIG_PCACHE_HDRSZ            = 24
   119  	SQLITE_CONFIG_PMASZ                   = 25
   120  	SQLITE_CONFIG_SCRATCH                 = 6
   121  	SQLITE_CONFIG_SERIALIZED              = 3
   122  	SQLITE_CONFIG_SINGLETHREAD            = 1
   123  	SQLITE_CONFIG_SMALL_MALLOC            = 27
   124  	SQLITE_CONFIG_SORTERREF_SIZE          = 28
   125  	SQLITE_CONFIG_SQLLOG                  = 21
   126  	SQLITE_CONFIG_STMTJRNL_SPILL          = 26
   127  	SQLITE_CONFIG_URI                     = 17
   128  	SQLITE_CONFIG_WIN32_HEAPSIZE          = 23
   129  	SQLITE_CONSTRAINT                     = 19
   130  	SQLITE_CONSTRAINT_CHECK               = 275
   131  	SQLITE_CONSTRAINT_COMMITHOOK          = 531
   132  	SQLITE_CONSTRAINT_FOREIGNKEY          = 787
   133  	SQLITE_CONSTRAINT_FUNCTION            = 1043
   134  	SQLITE_CONSTRAINT_NOTNULL             = 1299
   135  	SQLITE_CONSTRAINT_PINNED              = 2835
   136  	SQLITE_CONSTRAINT_PRIMARYKEY          = 1555
   137  	SQLITE_CONSTRAINT_ROWID               = 2579
   138  	SQLITE_CONSTRAINT_TRIGGER             = 1811
   139  	SQLITE_CONSTRAINT_UNIQUE              = 2067
   140  	SQLITE_CONSTRAINT_VTAB                = 2323
   141  	SQLITE_COPY                           = 0
   142  	SQLITE_CORE                           = 1
   143  	SQLITE_CORRUPT                        = 11
   144  	SQLITE_CORRUPT_INDEX                  = 779
   145  	SQLITE_CORRUPT_SEQUENCE               = 523
   146  	SQLITE_CORRUPT_VTAB                   = 267
   147  	SQLITE_CREATE_INDEX                   = 1
   148  	SQLITE_CREATE_TABLE                   = 2
   149  	SQLITE_CREATE_TEMP_INDEX              = 3
   150  	SQLITE_CREATE_TEMP_TABLE              = 4
   151  	SQLITE_CREATE_TEMP_TRIGGER            = 5
   152  	SQLITE_CREATE_TEMP_VIEW               = 6
   153  	SQLITE_CREATE_TRIGGER                 = 7
   154  	SQLITE_CREATE_VIEW                    = 8
   155  	SQLITE_CREATE_VTABLE                  = 29
   156  	SQLITE_DBCONFIG_DEFENSIVE             = 1010
   157  	SQLITE_DBCONFIG_DQS_DDL               = 1014
   158  	SQLITE_DBCONFIG_DQS_DML               = 1013
   159  	SQLITE_DBCONFIG_ENABLE_FKEY           = 1002
   160  	SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004
   161  	SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005
   162  	SQLITE_DBCONFIG_ENABLE_QPSG           = 1007
   163  	SQLITE_DBCONFIG_ENABLE_TRIGGER        = 1003
   164  	SQLITE_DBCONFIG_ENABLE_VIEW           = 1015
   165  	SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    = 1012
   166  	SQLITE_DBCONFIG_LEGACY_FILE_FORMAT    = 1016
   167  	SQLITE_DBCONFIG_LOOKASIDE             = 1001
   168  	SQLITE_DBCONFIG_MAINDBNAME            = 1000
   169  	SQLITE_DBCONFIG_MAX                   = 1017
   170  	SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      = 1006
   171  	SQLITE_DBCONFIG_RESET_DATABASE        = 1009
   172  	SQLITE_DBCONFIG_TRIGGER_EQP           = 1008
   173  	SQLITE_DBCONFIG_TRUSTED_SCHEMA        = 1017
   174  	SQLITE_DBCONFIG_WRITABLE_SCHEMA       = 1011
   175  	SQLITE_DBSTATUS_CACHE_HIT             = 7
   176  	SQLITE_DBSTATUS_CACHE_MISS            = 8
   177  	SQLITE_DBSTATUS_CACHE_SPILL           = 12
   178  	SQLITE_DBSTATUS_CACHE_USED            = 1
   179  	SQLITE_DBSTATUS_CACHE_USED_SHARED     = 11
   180  	SQLITE_DBSTATUS_CACHE_WRITE           = 9
   181  	SQLITE_DBSTATUS_DEFERRED_FKS          = 10
   182  	SQLITE_DBSTATUS_LOOKASIDE_HIT         = 4
   183  	SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL   = 6
   184  	SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE   = 5
   185  	SQLITE_DBSTATUS_LOOKASIDE_USED        = 0
   186  	SQLITE_DBSTATUS_MAX                   = 12
   187  	SQLITE_DBSTATUS_SCHEMA_USED           = 2
   188  	SQLITE_DBSTATUS_STMT_USED             = 3
   189  	SQLITE_DEFAULT_MEMSTATUS              = 0
   190  	SQLITE_DEFAULT_PAGE_SIZE              = 1024
   191  	SQLITE_DELETE                         = 9
   192  	SQLITE_DENY                           = 1
   193  	SQLITE_DEPRECATED                     = 0
   194  	SQLITE_DESERIALIZE_FREEONCLOSE        = 1
   195  	SQLITE_DESERIALIZE_READONLY           = 4
   196  	SQLITE_DESERIALIZE_RESIZEABLE         = 2
   197  	SQLITE_DETACH                         = 25
   198  	SQLITE_DETERMINISTIC                  = 0x000000800
   199  	SQLITE_DIRECTONLY                     = 0x000080000
   200  	SQLITE_DONE                           = 101
   201  	SQLITE_DROP_INDEX                     = 10
   202  	SQLITE_DROP_TABLE                     = 11
   203  	SQLITE_DROP_TEMP_INDEX                = 12
   204  	SQLITE_DROP_TEMP_TABLE                = 13
   205  	SQLITE_DROP_TEMP_TRIGGER              = 14
   206  	SQLITE_DROP_TEMP_VIEW                 = 15
   207  	SQLITE_DROP_TRIGGER                   = 16
   208  	SQLITE_DROP_VIEW                      = 17
   209  	SQLITE_DROP_VTABLE                    = 30
   210  	SQLITE_EMPTY                          = 16
   211  	SQLITE_ENABLE_BYTECODE_VTAB           = 1
   212  	SQLITE_ENABLE_COLUMN_METADATA         = 1
   213  	SQLITE_ENABLE_DBPAGE_VTAB             = 1
   214  	SQLITE_ENABLE_DBSTAT_VTAB             = 1
   215  	SQLITE_ENABLE_DESERIALIZE             = 1
   216  	SQLITE_ENABLE_EXPLAIN_COMMENTS        = 1
   217  	SQLITE_ENABLE_FTS5                    = 1
   218  	SQLITE_ENABLE_GEOPOLY                 = 1
   219  	SQLITE_ENABLE_JSON1                   = 1
   220  	SQLITE_ENABLE_MEMORY_MANAGEMENT       = 1
   221  	SQLITE_ENABLE_OFFSET_SQL_FUNC         = 1
   222  	SQLITE_ENABLE_PREUPDATE_HOOK          = 1
   223  	SQLITE_ENABLE_RBU                     = 1
   224  	SQLITE_ENABLE_RTREE                   = 1
   225  	SQLITE_ENABLE_SESSION                 = 1
   226  	SQLITE_ENABLE_SNAPSHOT                = 1
   227  	SQLITE_ENABLE_STAT4                   = 1
   228  	SQLITE_ENABLE_STMTVTAB                = 1
   229  	SQLITE_ENABLE_UNLOCK_NOTIFY           = 1
   230  	SQLITE_ERROR                          = 1
   231  	SQLITE_ERROR_MISSING_COLLSEQ          = 257
   232  	SQLITE_ERROR_RETRY                    = 513
   233  	SQLITE_ERROR_SNAPSHOT                 = 769
   234  	SQLITE_EXPERIMENTAL                   = 0
   235  	SQLITE_FAIL                           = 3
   236  	SQLITE_FCNTL_BEGIN_ATOMIC_WRITE       = 31
   237  	SQLITE_FCNTL_BUSYHANDLER              = 15
   238  	SQLITE_FCNTL_CHUNK_SIZE               = 6
   239  	SQLITE_FCNTL_CKPT_DONE                = 37
   240  	SQLITE_FCNTL_CKPT_START               = 39
   241  	SQLITE_FCNTL_CKSM_FILE                = 41
   242  	SQLITE_FCNTL_COMMIT_ATOMIC_WRITE      = 32
   243  	SQLITE_FCNTL_COMMIT_PHASETWO          = 22
   244  	SQLITE_FCNTL_DATA_VERSION             = 35
   245  	SQLITE_FCNTL_EXTERNAL_READER          = 40
   246  	SQLITE_FCNTL_FILE_POINTER             = 7
   247  	SQLITE_FCNTL_GET_LOCKPROXYFILE        = 2
   248  	SQLITE_FCNTL_HAS_MOVED                = 20
   249  	SQLITE_FCNTL_JOURNAL_POINTER          = 28
   250  	SQLITE_FCNTL_LAST_ERRNO               = 4
   251  	SQLITE_FCNTL_LOCKSTATE                = 1
   252  	SQLITE_FCNTL_LOCK_TIMEOUT             = 34
   253  	SQLITE_FCNTL_MMAP_SIZE                = 18
   254  	SQLITE_FCNTL_OVERWRITE                = 11
   255  	SQLITE_FCNTL_PDB                      = 30
   256  	SQLITE_FCNTL_PERSIST_WAL              = 10
   257  	SQLITE_FCNTL_POWERSAFE_OVERWRITE      = 13
   258  	SQLITE_FCNTL_PRAGMA                   = 14
   259  	SQLITE_FCNTL_RBU                      = 26
   260  	SQLITE_FCNTL_RESERVE_BYTES            = 38
   261  	SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE    = 33
   262  	SQLITE_FCNTL_SET_LOCKPROXYFILE        = 3
   263  	SQLITE_FCNTL_SIZE_HINT                = 5
   264  	SQLITE_FCNTL_SIZE_LIMIT               = 36
   265  	SQLITE_FCNTL_SYNC                     = 21
   266  	SQLITE_FCNTL_SYNC_OMITTED             = 8
   267  	SQLITE_FCNTL_TEMPFILENAME             = 16
   268  	SQLITE_FCNTL_TRACE                    = 19
   269  	SQLITE_FCNTL_VFSNAME                  = 12
   270  	SQLITE_FCNTL_VFS_POINTER              = 27
   271  	SQLITE_FCNTL_WAL_BLOCK                = 24
   272  	SQLITE_FCNTL_WIN32_AV_RETRY           = 9
   273  	SQLITE_FCNTL_WIN32_GET_HANDLE         = 29
   274  	SQLITE_FCNTL_WIN32_SET_HANDLE         = 23
   275  	SQLITE_FCNTL_ZIPVFS                   = 25
   276  	SQLITE_FLOAT                          = 2
   277  	SQLITE_FORMAT                         = 24
   278  	SQLITE_FULL                           = 13
   279  	SQLITE_FUNCTION                       = 31
   280  	SQLITE_GET_LOCKPROXYFILE              = 2
   281  	SQLITE_HAVE_ZLIB                      = 1
   282  	SQLITE_IGNORE                         = 2
   283  	SQLITE_INDEX_CONSTRAINT_EQ            = 2
   284  	SQLITE_INDEX_CONSTRAINT_FUNCTION      = 150
   285  	SQLITE_INDEX_CONSTRAINT_GE            = 32
   286  	SQLITE_INDEX_CONSTRAINT_GLOB          = 66
   287  	SQLITE_INDEX_CONSTRAINT_GT            = 4
   288  	SQLITE_INDEX_CONSTRAINT_IS            = 72
   289  	SQLITE_INDEX_CONSTRAINT_ISNOT         = 69
   290  	SQLITE_INDEX_CONSTRAINT_ISNOTNULL     = 70
   291  	SQLITE_INDEX_CONSTRAINT_ISNULL        = 71
   292  	SQLITE_INDEX_CONSTRAINT_LE            = 8
   293  	SQLITE_INDEX_CONSTRAINT_LIKE          = 65
   294  	SQLITE_INDEX_CONSTRAINT_LT            = 16
   295  	SQLITE_INDEX_CONSTRAINT_MATCH         = 64
   296  	SQLITE_INDEX_CONSTRAINT_NE            = 68
   297  	SQLITE_INDEX_CONSTRAINT_REGEXP        = 67
   298  	SQLITE_INDEX_SCAN_UNIQUE              = 1
   299  	SQLITE_INNOCUOUS                      = 0x000200000
   300  	SQLITE_INSERT                         = 18
   301  	SQLITE_INTEGER                        = 1
   302  	SQLITE_INTERNAL                       = 2
   303  	SQLITE_INTERRUPT                      = 9
   304  	SQLITE_IOCAP_ATOMIC                   = 0x00000001
   305  	SQLITE_IOCAP_ATOMIC16K                = 0x00000040
   306  	SQLITE_IOCAP_ATOMIC1K                 = 0x00000004
   307  	SQLITE_IOCAP_ATOMIC2K                 = 0x00000008
   308  	SQLITE_IOCAP_ATOMIC32K                = 0x00000080
   309  	SQLITE_IOCAP_ATOMIC4K                 = 0x00000010
   310  	SQLITE_IOCAP_ATOMIC512                = 0x00000002
   311  	SQLITE_IOCAP_ATOMIC64K                = 0x00000100
   312  	SQLITE_IOCAP_ATOMIC8K                 = 0x00000020
   313  	SQLITE_IOCAP_BATCH_ATOMIC             = 0x00004000
   314  	SQLITE_IOCAP_IMMUTABLE                = 0x00002000
   315  	SQLITE_IOCAP_POWERSAFE_OVERWRITE      = 0x00001000
   316  	SQLITE_IOCAP_SAFE_APPEND              = 0x00000200
   317  	SQLITE_IOCAP_SEQUENTIAL               = 0x00000400
   318  	SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN    = 0x00000800
   319  	SQLITE_IOERR                          = 10
   320  	SQLITE_IOERR_ACCESS                   = 3338
   321  	SQLITE_IOERR_AUTH                     = 7178
   322  	SQLITE_IOERR_BEGIN_ATOMIC             = 7434
   323  	SQLITE_IOERR_BLOCKED                  = 2826
   324  	SQLITE_IOERR_CHECKRESERVEDLOCK        = 3594
   325  	SQLITE_IOERR_CLOSE                    = 4106
   326  	SQLITE_IOERR_COMMIT_ATOMIC            = 7690
   327  	SQLITE_IOERR_CONVPATH                 = 6666
   328  	SQLITE_IOERR_CORRUPTFS                = 8458
   329  	SQLITE_IOERR_DATA                     = 8202
   330  	SQLITE_IOERR_DELETE                   = 2570
   331  	SQLITE_IOERR_DELETE_NOENT             = 5898
   332  	SQLITE_IOERR_DIR_CLOSE                = 4362
   333  	SQLITE_IOERR_DIR_FSYNC                = 1290
   334  	SQLITE_IOERR_FSTAT                    = 1802
   335  	SQLITE_IOERR_FSYNC                    = 1034
   336  	SQLITE_IOERR_GETTEMPPATH              = 6410
   337  	SQLITE_IOERR_LOCK                     = 3850
   338  	SQLITE_IOERR_MMAP                     = 6154
   339  	SQLITE_IOERR_NOMEM                    = 3082
   340  	SQLITE_IOERR_RDLOCK                   = 2314
   341  	SQLITE_IOERR_READ                     = 266
   342  	SQLITE_IOERR_ROLLBACK_ATOMIC          = 7946
   343  	SQLITE_IOERR_SEEK                     = 5642
   344  	SQLITE_IOERR_SHMLOCK                  = 5130
   345  	SQLITE_IOERR_SHMMAP                   = 5386
   346  	SQLITE_IOERR_SHMOPEN                  = 4618
   347  	SQLITE_IOERR_SHMSIZE                  = 4874
   348  	SQLITE_IOERR_SHORT_READ               = 522
   349  	SQLITE_IOERR_TRUNCATE                 = 1546
   350  	SQLITE_IOERR_UNLOCK                   = 2058
   351  	SQLITE_IOERR_VNODE                    = 6922
   352  	SQLITE_IOERR_WRITE                    = 778
   353  	SQLITE_LAST_ERRNO                     = 4
   354  	SQLITE_LIKE_DOESNT_MATCH_BLOBS        = 1
   355  	SQLITE_LIMIT_ATTACHED                 = 7
   356  	SQLITE_LIMIT_COLUMN                   = 2
   357  	SQLITE_LIMIT_COMPOUND_SELECT          = 4
   358  	SQLITE_LIMIT_EXPR_DEPTH               = 3
   359  	SQLITE_LIMIT_FUNCTION_ARG             = 6
   360  	SQLITE_LIMIT_LENGTH                   = 0
   361  	SQLITE_LIMIT_LIKE_PATTERN_LENGTH      = 8
   362  	SQLITE_LIMIT_SQL_LENGTH               = 1
   363  	SQLITE_LIMIT_TRIGGER_DEPTH            = 10
   364  	SQLITE_LIMIT_VARIABLE_NUMBER          = 9
   365  	SQLITE_LIMIT_VDBE_OP                  = 5
   366  	SQLITE_LIMIT_WORKER_THREADS           = 11
   367  	SQLITE_LOCKED                         = 6
   368  	SQLITE_LOCKED_SHAREDCACHE             = 262
   369  	SQLITE_LOCKED_VTAB                    = 518
   370  	SQLITE_LOCK_EXCLUSIVE                 = 4
   371  	SQLITE_LOCK_NONE                      = 0
   372  	SQLITE_LOCK_PENDING                   = 3
   373  	SQLITE_LOCK_RESERVED                  = 2
   374  	SQLITE_LOCK_SHARED                    = 1
   375  	SQLITE_MISMATCH                       = 20
   376  	SQLITE_MISUSE                         = 21
   377  	SQLITE_MUTEX_APPDEF                   = 1
   378  	SQLITE_MUTEX_FAST                     = 0
   379  	SQLITE_MUTEX_NOOP                     = 1
   380  	SQLITE_MUTEX_RECURSIVE                = 1
   381  	SQLITE_MUTEX_STATIC_APP1              = 8
   382  	SQLITE_MUTEX_STATIC_APP2              = 9
   383  	SQLITE_MUTEX_STATIC_APP3              = 10
   384  	SQLITE_MUTEX_STATIC_LRU               = 6
   385  	SQLITE_MUTEX_STATIC_LRU2              = 7
   386  	SQLITE_MUTEX_STATIC_MAIN              = 2
   387  	SQLITE_MUTEX_STATIC_MASTER            = 2
   388  	SQLITE_MUTEX_STATIC_MEM               = 3
   389  	SQLITE_MUTEX_STATIC_MEM2              = 4
   390  	SQLITE_MUTEX_STATIC_OPEN              = 4
   391  	SQLITE_MUTEX_STATIC_PMEM              = 7
   392  	SQLITE_MUTEX_STATIC_PRNG              = 5
   393  	SQLITE_MUTEX_STATIC_VFS1              = 11
   394  	SQLITE_MUTEX_STATIC_VFS2              = 12
   395  	SQLITE_MUTEX_STATIC_VFS3              = 13
   396  	SQLITE_NOLFS                          = 22
   397  	SQLITE_NOMEM                          = 7
   398  	SQLITE_NOTADB                         = 26
   399  	SQLITE_NOTFOUND                       = 12
   400  	SQLITE_NOTICE                         = 27
   401  	SQLITE_NOTICE_RECOVER_ROLLBACK        = 539
   402  	SQLITE_NOTICE_RECOVER_WAL             = 283
   403  	SQLITE_NULL                           = 5
   404  	SQLITE_OK                             = 0
   405  	SQLITE_OK_LOAD_PERMANENTLY            = 256
   406  	SQLITE_OK_SYMLINK                     = 512
   407  	SQLITE_OMIT_LOAD_EXTENSION            = 1
   408  	SQLITE_OPEN_AUTOPROXY                 = 0x00000020
   409  	SQLITE_OPEN_CREATE                    = 0x00000004
   410  	SQLITE_OPEN_DELETEONCLOSE             = 0x00000008
   411  	SQLITE_OPEN_EXCLUSIVE                 = 0x00000010
   412  	SQLITE_OPEN_FULLMUTEX                 = 0x00010000
   413  	SQLITE_OPEN_MAIN_DB                   = 0x00000100
   414  	SQLITE_OPEN_MAIN_JOURNAL              = 0x00000800
   415  	SQLITE_OPEN_MASTER_JOURNAL            = 0x00004000
   416  	SQLITE_OPEN_MEMORY                    = 0x00000080
   417  	SQLITE_OPEN_NOFOLLOW                  = 0x01000000
   418  	SQLITE_OPEN_NOMUTEX                   = 0x00008000
   419  	SQLITE_OPEN_PRIVATECACHE              = 0x00040000
   420  	SQLITE_OPEN_READONLY                  = 0x00000001
   421  	SQLITE_OPEN_READWRITE                 = 0x00000002
   422  	SQLITE_OPEN_SHAREDCACHE               = 0x00020000
   423  	SQLITE_OPEN_SUBJOURNAL                = 0x00002000
   424  	SQLITE_OPEN_SUPER_JOURNAL             = 0x00004000
   425  	SQLITE_OPEN_TEMP_DB                   = 0x00000200
   426  	SQLITE_OPEN_TEMP_JOURNAL              = 0x00001000
   427  	SQLITE_OPEN_TRANSIENT_DB              = 0x00000400
   428  	SQLITE_OPEN_URI                       = 0x00000040
   429  	SQLITE_OPEN_WAL                       = 0x00080000
   430  	SQLITE_PERM                           = 3
   431  	SQLITE_PRAGMA                         = 19
   432  	SQLITE_PREPARE_NORMALIZE              = 0x02
   433  	SQLITE_PREPARE_NO_VTAB                = 0x04
   434  	SQLITE_PREPARE_PERSISTENT             = 0x01
   435  	SQLITE_PROTOCOL                       = 15
   436  	SQLITE_RANGE                          = 25
   437  	SQLITE_READ                           = 20
   438  	SQLITE_READONLY                       = 8
   439  	SQLITE_READONLY_CANTINIT              = 1288
   440  	SQLITE_READONLY_CANTLOCK              = 520
   441  	SQLITE_READONLY_DBMOVED               = 1032
   442  	SQLITE_READONLY_DIRECTORY             = 1544
   443  	SQLITE_READONLY_RECOVERY              = 264
   444  	SQLITE_READONLY_ROLLBACK              = 776
   445  	SQLITE_RECURSIVE                      = 33
   446  	SQLITE_REINDEX                        = 27
   447  	SQLITE_REPLACE                        = 5
   448  	SQLITE_ROLLBACK                       = 1
   449  	SQLITE_ROW                            = 100
   450  	SQLITE_SAVEPOINT                      = 32
   451  	SQLITE_SCANSTAT_EST                   = 2
   452  	SQLITE_SCANSTAT_EXPLAIN               = 4
   453  	SQLITE_SCANSTAT_NAME                  = 3
   454  	SQLITE_SCANSTAT_NLOOP                 = 0
   455  	SQLITE_SCANSTAT_NVISIT                = 1
   456  	SQLITE_SCANSTAT_SELECTID              = 5
   457  	SQLITE_SCHEMA                         = 17
   458  	SQLITE_SELECT                         = 21
   459  	SQLITE_SERIALIZE_NOCOPY               = 0x001
   460  	SQLITE_SERIES_CONSTRAINT_VERIFY       = 1
   461  	SQLITE_SERVER                         = 1
   462  	SQLITE_SESSION_CONFIG_STRMSIZE        = 1
   463  	SQLITE_SESSION_OBJCONFIG_SIZE         = 1
   464  	SQLITE_SET_LOCKPROXYFILE              = 3
   465  	SQLITE_SHM_EXCLUSIVE                  = 8
   466  	SQLITE_SHM_LOCK                       = 2
   467  	SQLITE_SHM_NLOCK                      = 8
   468  	SQLITE_SHM_SHARED                     = 4
   469  	SQLITE_SHM_UNLOCK                     = 1
   470  	SQLITE_SOUNDEX                        = 1
   471  	SQLITE_SOURCE_ID                      = "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5"
   472  	SQLITE_STATUS_MALLOC_COUNT            = 9
   473  	SQLITE_STATUS_MALLOC_SIZE             = 5
   474  	SQLITE_STATUS_MEMORY_USED             = 0
   475  	SQLITE_STATUS_PAGECACHE_OVERFLOW      = 2
   476  	SQLITE_STATUS_PAGECACHE_SIZE          = 7
   477  	SQLITE_STATUS_PAGECACHE_USED          = 1
   478  	SQLITE_STATUS_PARSER_STACK            = 6
   479  	SQLITE_STATUS_SCRATCH_OVERFLOW        = 4
   480  	SQLITE_STATUS_SCRATCH_SIZE            = 8
   481  	SQLITE_STATUS_SCRATCH_USED            = 3
   482  	SQLITE_STDCALL                        = 0
   483  	SQLITE_STMTSTATUS_AUTOINDEX           = 3
   484  	SQLITE_STMTSTATUS_FULLSCAN_STEP       = 1
   485  	SQLITE_STMTSTATUS_MEMUSED             = 99
   486  	SQLITE_STMTSTATUS_REPREPARE           = 5
   487  	SQLITE_STMTSTATUS_RUN                 = 6
   488  	SQLITE_STMTSTATUS_SORT                = 2
   489  	SQLITE_STMTSTATUS_VM_STEP             = 4
   490  	SQLITE_SUBTYPE                        = 0x000100000
   491  	SQLITE_SYNC_DATAONLY                  = 0x00010
   492  	SQLITE_SYNC_FULL                      = 0x00003
   493  	SQLITE_SYNC_NORMAL                    = 0x00002
   494  	SQLITE_SYSAPI                         = 0
   495  	SQLITE_TEMP_STORE                     = 1
   496  	SQLITE_TEST                           = 1
   497  	SQLITE_TESTCTRL_ALWAYS                = 13
   498  	SQLITE_TESTCTRL_ASSERT                = 12
   499  	SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS   = 10
   500  	SQLITE_TESTCTRL_BITVEC_TEST           = 8
   501  	SQLITE_TESTCTRL_BYTEORDER             = 22
   502  	SQLITE_TESTCTRL_EXPLAIN_STMT          = 19
   503  	SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS   = 29
   504  	SQLITE_TESTCTRL_FAULT_INSTALL         = 9
   505  	SQLITE_TESTCTRL_FIRST                 = 5
   506  	SQLITE_TESTCTRL_IMPOSTER              = 25
   507  	SQLITE_TESTCTRL_INTERNAL_FUNCTIONS    = 17
   508  	SQLITE_TESTCTRL_ISINIT                = 23
   509  	SQLITE_TESTCTRL_ISKEYWORD             = 16
   510  	SQLITE_TESTCTRL_LAST                  = 32
   511  	SQLITE_TESTCTRL_LOCALTIME_FAULT       = 18
   512  	SQLITE_TESTCTRL_NEVER_CORRUPT         = 20
   513  	SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD  = 19
   514  	SQLITE_TESTCTRL_OPTIMIZATIONS         = 15
   515  	SQLITE_TESTCTRL_PARSER_COVERAGE       = 26
   516  	SQLITE_TESTCTRL_PENDING_BYTE          = 11
   517  	SQLITE_TESTCTRL_PRNG_RESET            = 7
   518  	SQLITE_TESTCTRL_PRNG_RESTORE          = 6
   519  	SQLITE_TESTCTRL_PRNG_SAVE             = 5
   520  	SQLITE_TESTCTRL_PRNG_SEED             = 28
   521  	SQLITE_TESTCTRL_RESERVE               = 14
   522  	SQLITE_TESTCTRL_RESULT_INTREAL        = 27
   523  	SQLITE_TESTCTRL_SCRATCHMALLOC         = 17
   524  	SQLITE_TESTCTRL_SEEK_COUNT            = 30
   525  	SQLITE_TESTCTRL_SORTER_MMAP           = 24
   526  	SQLITE_TESTCTRL_TRACEFLAGS            = 31
   527  	SQLITE_TESTCTRL_TUNE                  = 32
   528  	SQLITE_TESTCTRL_VDBE_COVERAGE         = 21
   529  	SQLITE_TEXT                           = 3
   530  	SQLITE_THREADSAFE                     = 1
   531  	SQLITE_TOOBIG                         = 18
   532  	SQLITE_TRACE_CLOSE                    = 0x08
   533  	SQLITE_TRACE_PROFILE                  = 0x02
   534  	SQLITE_TRACE_ROW                      = 0x04
   535  	SQLITE_TRACE_STMT                     = 0x01
   536  	SQLITE_TRANSACTION                    = 22
   537  	SQLITE_TXN_NONE                       = 0
   538  	SQLITE_TXN_READ                       = 1
   539  	SQLITE_TXN_WRITE                      = 2
   540  	SQLITE_UPDATE                         = 23
   541  	SQLITE_UTF16                          = 4
   542  	SQLITE_UTF16BE                        = 3
   543  	SQLITE_UTF16LE                        = 2
   544  	SQLITE_UTF16_ALIGNED                  = 8
   545  	SQLITE_UTF8                           = 1
   546  	SQLITE_VERSION                        = "3.36.0"
   547  	SQLITE_VERSION_NUMBER                 = 3036000
   548  	SQLITE_VTAB_CONSTRAINT_SUPPORT        = 1
   549  	SQLITE_VTAB_DIRECTONLY                = 3
   550  	SQLITE_VTAB_INNOCUOUS                 = 2
   551  	SQLITE_WARNING                        = 28
   552  	SQLITE_WARNING_AUTOINDEX              = 284
   553  	SQLITE_WIN32_DATA_DIRECTORY_TYPE      = 1
   554  	SQLITE_WIN32_TEMP_DIRECTORY_TYPE      = 2
   555  	TMP_MAX                               = 308915776
   556  	UNIQUE_TABLE_NAME                     = "t592690916721053953805701627921227776"
   557  	X_ANSI_STDARG_H_                      = 0
   558  	X_ASSERT_H_                           = 0
   559  	X_ERRNO_T_DEFINED                     = 0
   560  	X_FILE_OFFSET_BITS                    = 64
   561  	X_FSTDIO                              = 0
   562  	X_FTRUNCATE_DECLARED                  = 0
   563  	X_FTS5_H                              = 0
   564  	X_HAVE_SQLITE_CONFIG_H                = 1
   565  	X_IOFBF                               = 0
   566  	X_IOLBF                               = 1
   567  	X_IONBF                               = 2
   568  	X_LOCALE_T_DEFINED                    = 0
   569  	X_LP64                                = 1
   570  	X_LSEEK_DECLARED                      = 0
   571  	X_MACHINE__LIMITS_H_                  = 0
   572  	X_MACHINE__TYPES_H_                   = 0
   573  	X_MMAP_DECLARED                       = 0
   574  	X_Nonnull                             = 0
   575  	X_Null_unspecified                    = 0
   576  	X_Nullable                            = 0
   577  	X_OFF64_T_DECLARED                    = 0
   578  	X_OFF_T_DECLARED                      = 0
   579  	X_RSIZE_T_DEFINED                     = 0
   580  	X_SIZE_T_DECLARED                     = 0
   581  	X_SQLITE3RTREE_H_                     = 0
   582  	X_SSIZE_T_DECLARED                    = 0
   583  	X_STDARG_H                            = 0
   584  	X_STDFILE_DECLARED                    = 0
   585  	X_STDIO_H_                            = 0
   586  	X_STDSTREAM_DECLARED                  = 0
   587  	X_STRINGS_H_                          = 0
   588  	X_STRING_H_                           = 0
   589  	X_SWAB_DECLARED                       = 0
   590  	X_SYS_CDEFS_H_                        = 0
   591  	X_SYS__TYPES_H_                       = 0
   592  	X_TRUNCATE_DECLARED                   = 0
   593  	X_VA_LIST                             = 0
   594  	X_VA_LIST_DECLARED                    = 0
   595  	X_VA_LIST_DEFINED                     = 0
   596  	X_VA_LIST_T_H                         = 0
   597  	X_XLOCALE_STRING1_H                   = 0
   598  	X_XLOCALE_STRINGS1_H                  = 0
   599  	Unix                                  = 1
   600  	CRTIMPORT                             = 0
   601  	DLLIMPORT                             = 0
   602  	INLINE                                = 0
   603  	MP_DIGIT_DECLARED                     = 0
   604  	MP_INT_DECLARED                       = 0
   605  	NUM_STATIC_TOKENS                     = 20
   606  	SQLITE_TCLAPI                         = 0
   607  	TCL_ALLOW_INLINE_COMPILATION          = 0x20000
   608  	TCL_ALL_EVENTS                        = -3
   609  	TCL_ALPHA_RELEASE                     = 0
   610  	TCL_APPEND_VALUE                      = 4
   611  	TCL_ARGV_CONSTANT                     = 15
   612  	TCL_ARGV_END                          = 23
   613  	TCL_ARGV_FLOAT                        = 19
   614  	TCL_ARGV_FUNC                         = 20
   615  	TCL_ARGV_GENFUNC                      = 21
   616  	TCL_ARGV_HELP                         = 22
   617  	TCL_ARGV_INT                          = 16
   618  	TCL_ARGV_REST                         = 18
   619  	TCL_ARGV_STRING                       = 17
   620  	TCL_BETA_RELEASE                      = 1
   621  	TCL_BREAK                             = 3
   622  	TCL_CANCEL_UNWIND                     = 0x100000
   623  	TCL_CHANNEL_THREAD_INSERT             = 0
   624  	TCL_CHANNEL_THREAD_REMOVE             = 1
   625  	TCL_CLOSE_READ                        = 2
   626  	TCL_CLOSE_WRITE                       = 4
   627  	TCL_CONTINUE                          = 4
   628  	TCL_CONVERT_MULTIBYTE                 = -1
   629  	TCL_CONVERT_NOSPACE                   = -4
   630  	TCL_CONVERT_SYNTAX                    = -2
   631  	TCL_CONVERT_UNKNOWN                   = -3
   632  	TCL_CREATE_HARD_LINK                  = 0x02
   633  	TCL_CREATE_SYMBOLIC_LINK              = 0x01
   634  	TCL_CUSTOM_PTR_KEYS                   = -1
   635  	TCL_CUSTOM_TYPE_KEYS                  = -2
   636  	TCL_DONT_QUOTE_HASH                   = 8
   637  	TCL_DONT_USE_BRACES                   = 1
   638  	TCL_DONT_WAIT                         = 2
   639  	TCL_DOUBLE_SPACE                      = 27
   640  	TCL_DSTRING_STATIC_SIZE               = 200
   641  	TCL_ENCODING_CHAR_LIMIT               = 0x10
   642  	TCL_ENCODING_END                      = 0x02
   643  	TCL_ENCODING_NO_TERMINATE             = 0x08
   644  	TCL_ENCODING_START                    = 0x01
   645  	TCL_ENCODING_STOPONERROR              = 0x04
   646  	TCL_ENFORCE_MODE                      = 16
   647  	TCL_ENSEMBLE_PREFIX                   = 0x02
   648  	TCL_ERROR                             = 1
   649  	TCL_EVAL_DIRECT                       = 0x040000
   650  	TCL_EVAL_GLOBAL                       = 0x020000
   651  	TCL_EVAL_INVOKE                       = 0x080000
   652  	TCL_EVAL_NOERR                        = 0x200000
   653  	TCL_EXACT                             = 1
   654  	TCL_EXCEPTION                         = 8
   655  	TCL_FILE_EVENTS                       = 8
   656  	TCL_FINAL_RELEASE                     = 2
   657  	TCL_GLOBAL_ONLY                       = 1
   658  	TCL_GLOB_PERM_HIDDEN                  = 2
   659  	TCL_GLOB_PERM_R                       = 4
   660  	TCL_GLOB_PERM_RONLY                   = 1
   661  	TCL_GLOB_PERM_W                       = 8
   662  	TCL_GLOB_PERM_X                       = 16
   663  	TCL_GLOB_TYPE_BLOCK                   = 1
   664  	TCL_GLOB_TYPE_CHAR                    = 2
   665  	TCL_GLOB_TYPE_DIR                     = 4
   666  	TCL_GLOB_TYPE_FILE                    = 16
   667  	TCL_GLOB_TYPE_LINK                    = 32
   668  	TCL_GLOB_TYPE_MOUNT                   = 128
   669  	TCL_GLOB_TYPE_PIPE                    = 8
   670  	TCL_GLOB_TYPE_SOCK                    = 64
   671  	TCL_HASH_KEY_RANDOMIZE_HASH           = 0x1
   672  	TCL_HASH_KEY_STORE_HASH               = 1
   673  	TCL_HASH_KEY_SYSTEM_HASH              = 0x2
   674  	TCL_HASH_KEY_TYPE_VERSION             = 1
   675  	TCL_IDLE_EVENTS                       = 32
   676  	TCL_INTEGER_SPACE                     = 24
   677  	TCL_INTERP_DESTROYED                  = 0x100
   678  	TCL_LEAVE_ERR_MSG                     = 0x200
   679  	TCL_LIMIT_COMMANDS                    = 0x01
   680  	TCL_LIMIT_TIME                        = 0x02
   681  	TCL_LINK_BOOLEAN                      = 3
   682  	TCL_LINK_CHAR                         = 6
   683  	TCL_LINK_DOUBLE                       = 2
   684  	TCL_LINK_FLOAT                        = 13
   685  	TCL_LINK_INT                          = 1
   686  	TCL_LINK_LONG                         = 11
   687  	TCL_LINK_READ_ONLY                    = 0x80
   688  	TCL_LINK_SHORT                        = 8
   689  	TCL_LINK_STRING                       = 4
   690  	TCL_LINK_UCHAR                        = 7
   691  	TCL_LINK_UINT                         = 10
   692  	TCL_LINK_ULONG                        = 12
   693  	TCL_LINK_USHORT                       = 9
   694  	TCL_LINK_WIDE_INT                     = 5
   695  	TCL_LINK_WIDE_UINT                    = 14
   696  	TCL_LIST_ELEMENT                      = 8
   697  	TCL_LL_MODIFIER                       = "ll"
   698  	TCL_LOAD_GLOBAL                       = 1
   699  	TCL_LOAD_LAZY                         = 2
   700  	TCL_MAJOR_VERSION                     = 8
   701  	TCL_MATCH_NOCASE                      = 1
   702  	TCL_MAX_PREC                          = 17
   703  	TCL_MINOR_VERSION                     = 6
   704  	TCL_MODE_BLOCKING                     = 0
   705  	TCL_MODE_NONBLOCKING                  = 1
   706  	TCL_NAMESPACE_ONLY                    = 2
   707  	TCL_NORETURN1                         = 0
   708  	TCL_NO_EVAL                           = 0x010000
   709  	TCL_OK                                = 0
   710  	TCL_ONE_WORD_KEYS                     = 1
   711  	TCL_PARSE_BAD_NUMBER                  = 9
   712  	TCL_PARSE_BRACE_EXTRA                 = 2
   713  	TCL_PARSE_MISSING_BRACE               = 3
   714  	TCL_PARSE_MISSING_BRACKET             = 4
   715  	TCL_PARSE_MISSING_PAREN               = 5
   716  	TCL_PARSE_MISSING_QUOTE               = 6
   717  	TCL_PARSE_MISSING_VAR_BRACE           = 7
   718  	TCL_PARSE_PART1                       = 0x400
   719  	TCL_PARSE_QUOTE_EXTRA                 = 1
   720  	TCL_PARSE_SUCCESS                     = 0
   721  	TCL_PARSE_SYNTAX                      = 8
   722  	TCL_PATCH_LEVEL                       = "8.6.10"
   723  	TCL_READABLE                          = 2
   724  	TCL_REG_ADVANCED                      = 000003
   725  	TCL_REG_ADVF                          = 000002
   726  	TCL_REG_BASIC                         = 000000
   727  	TCL_REG_CANMATCH                      = 001000
   728  	TCL_REG_EXPANDED                      = 000040
   729  	TCL_REG_EXTENDED                      = 000001
   730  	TCL_REG_NEWLINE                       = 000300
   731  	TCL_REG_NLANCH                        = 000200
   732  	TCL_REG_NLSTOP                        = 000100
   733  	TCL_REG_NOCASE                        = 000010
   734  	TCL_REG_NOSUB                         = 000020
   735  	TCL_REG_NOTBOL                        = 0001
   736  	TCL_REG_NOTEOL                        = 0002
   737  	TCL_REG_QUOTE                         = 000004
   738  	TCL_RELEASE_LEVEL                     = 2
   739  	TCL_RELEASE_SERIAL                    = 10
   740  	TCL_RESULT_SIZE                       = 200
   741  	TCL_RETURN                            = 2
   742  	TCL_SERVICE_ALL                       = 1
   743  	TCL_SERVICE_NONE                      = 0
   744  	TCL_SMALL_HASH_TABLE                  = 4
   745  	TCL_STDERR                            = 8
   746  	TCL_STDIN                             = 2
   747  	TCL_STDOUT                            = 4
   748  	TCL_STORAGE_CLASS                     = 0
   749  	TCL_STRING_KEYS                       = 0
   750  	TCL_SUBST_ALL                         = 007
   751  	TCL_SUBST_BACKSLASHES                 = 004
   752  	TCL_SUBST_COMMANDS                    = 001
   753  	TCL_SUBST_VARIABLES                   = 002
   754  	TCL_THREAD_CREATE_RETURN              = 0
   755  	TCL_THREAD_JOINABLE                   = 1
   756  	TCL_THREAD_NOFLAGS                    = 0
   757  	TCL_THREAD_STACK_DEFAULT              = 0
   758  	TCL_TIMER_EVENTS                      = 16
   759  	TCL_TOKEN_BS                          = 8
   760  	TCL_TOKEN_COMMAND                     = 16
   761  	TCL_TOKEN_EXPAND_WORD                 = 256
   762  	TCL_TOKEN_OPERATOR                    = 128
   763  	TCL_TOKEN_SIMPLE_WORD                 = 2
   764  	TCL_TOKEN_SUB_EXPR                    = 64
   765  	TCL_TOKEN_TEXT                        = 4
   766  	TCL_TOKEN_VARIABLE                    = 32
   767  	TCL_TOKEN_WORD                        = 1
   768  	TCL_TRACE_ARRAY                       = 0x800
   769  	TCL_TRACE_DELETE                      = 0x4000
   770  	TCL_TRACE_DESTROYED                   = 0x80
   771  	TCL_TRACE_OLD_STYLE                   = 0x1000
   772  	TCL_TRACE_READS                       = 0x10
   773  	TCL_TRACE_RENAME                      = 0x2000
   774  	TCL_TRACE_RESULT_DYNAMIC              = 0x8000
   775  	TCL_TRACE_RESULT_OBJECT               = 0x10000
   776  	TCL_TRACE_UNSETS                      = 0x40
   777  	TCL_TRACE_WRITES                      = 0x20
   778  	TCL_UNLOAD_DETACH_FROM_INTERPRETER    = 1
   779  	TCL_UNLOAD_DETACH_FROM_PROCESS        = 2
   780  	TCL_UTF_MAX                           = 3
   781  	TCL_VERSION                           = "8.6"
   782  	TCL_WINDOW_EVENTS                     = 4
   783  	TCL_WRITABLE                          = 4
   784  	TCL_ZLIB_COMPRESS_BEST                = 9
   785  	TCL_ZLIB_COMPRESS_DEFAULT             = -1
   786  	TCL_ZLIB_COMPRESS_FAST                = 1
   787  	TCL_ZLIB_COMPRESS_NONE                = 0
   788  	TCL_ZLIB_FINALIZE                     = 4
   789  	TCL_ZLIB_FLUSH                        = 2
   790  	TCL_ZLIB_FORMAT_AUTO                  = 8
   791  	TCL_ZLIB_FORMAT_GZIP                  = 4
   792  	TCL_ZLIB_FORMAT_RAW                   = 1
   793  	TCL_ZLIB_FORMAT_ZLIB                  = 2
   794  	TCL_ZLIB_FULLFLUSH                    = 3
   795  	TCL_ZLIB_NO_FLUSH                     = 0
   796  	TCL_ZLIB_STREAM_DEFLATE               = 16
   797  	TCL_ZLIB_STREAM_INFLATE               = 32
   798  	X_CLIENTDATA                          = 0
   799  	X_TCL                                 = 0
   800  	X_TCLDECLS                            = 0
   801  	X_TCLPLATDECLS                        = 0
   802  	X_FTSINT_H                            = 0
   803  	FTS3_TOK_SCHEMA                       = "CREATE TABLE x(input HIDDEN, token, start, end, position)"
   804  	APND_MARK_FOS_SZ                      = 8
   805  	APND_MARK_PREFIX                      = "Start-Of-SQLite3-"
   806  	APND_MARK_PREFIX_SZ                   = 17
   807  	APND_MARK_SIZE                        = 25
   808  	APND_MAX_SIZE                         = 1073741824
   809  	APND_ROUNDUP                          = 4096
   810  	SQLITE3EXT_H                          = 0
   811  	SQLITE_EXTENSION_INIT1                = 0
   812  	SQLITE_EXTENSION_INIT3                = 0
   813  	AMATCH_COL_COMMAND                    = 3
   814  	AMATCH_COL_DISTANCE                   = 1
   815  	AMATCH_COL_LANGUAGE                   = 2
   816  	AMATCH_COL_NWORD                      = 4
   817  	AMATCH_COL_WORD                       = 0
   818  	AMATCH_MX_COST                        = 1000
   819  	AMATCH_MX_LANGID                      = 2147483647
   820  	AMATCH_MX_LENGTH                      = 50
   821  	EXIT_FAILURE                          = 1
   822  	EXIT_SUCCESS                          = 0
   823  	RAND_MAX                              = 0x7fffffff
   824  	X_CACHED_RUNES                        = 256
   825  	X_CRMASK                              = -256
   826  	X_CTYPE_A                             = 0x00000100
   827  	X_CTYPE_B                             = 0x00020000
   828  	X_CTYPE_C                             = 0x00000200
   829  	X_CTYPE_D                             = 0x00000400
   830  	X_CTYPE_G                             = 0x00000800
   831  	X_CTYPE_H_                            = 0
   832  	X_CTYPE_I                             = 0x00080000
   833  	X_CTYPE_L                             = 0x00001000
   834  	X_CTYPE_N                             = 0x00400000
   835  	X_CTYPE_P                             = 0x00002000
   836  	X_CTYPE_Q                             = 0x00200000
   837  	X_CTYPE_R                             = 0x00040000
   838  	X_CTYPE_S                             = 0x00004000
   839  	X_CTYPE_SW0                           = 0x20000000
   840  	X_CTYPE_SW1                           = 0x40000000
   841  	X_CTYPE_SW2                           = 0x80000000
   842  	X_CTYPE_SW3                           = 0xc0000000
   843  	X_CTYPE_SWM                           = 0xe0000000
   844  	X_CTYPE_SWS                           = 30
   845  	X_CTYPE_T                             = 0x00100000
   846  	X_CTYPE_U                             = 0x00008000
   847  	X_CTYPE_X                             = 0x00010000
   848  	X_MKDTEMP_DECLARED                    = 0
   849  	X_MKSTEMP_DECLARED                    = 0
   850  	X_MKTEMP_DECLARED                     = 0
   851  	X_RUNETYPE_H_                         = 0
   852  	X_RUNE_MAGIC_1                        = "RuneMagi"
   853  	X_RUNE_T_DECLARED                     = 0
   854  	X_STDLIB_H_                           = 0
   855  	X_WCHAR_T_DECLARED                    = 0
   856  	X_XLOCALE_CTYPE_H                     = 0
   857  	X_XLOCALE_RUN_FUNCTIONS_DEFINED       = 1
   858  	CARRAY_COLUMN_COUNT                   = 2
   859  	CARRAY_COLUMN_CTYPE                   = 3
   860  	CARRAY_COLUMN_POINTER                 = 1
   861  	CARRAY_COLUMN_VALUE                   = 0
   862  	CARRAY_DOUBLE                         = 2
   863  	CARRAY_INT32                          = 0
   864  	CARRAY_INT64                          = 1
   865  	CARRAY_TEXT                           = 3
   866  	CLOSURE_COL_DEPTH                     = 1
   867  	CLOSURE_COL_ID                        = 0
   868  	CLOSURE_COL_IDCOLUMN                  = 4
   869  	CLOSURE_COL_PARENTCOLUMN              = 5
   870  	CLOSURE_COL_ROOT                      = 2
   871  	CLOSURE_COL_TABLENAME                 = 3
   872  	CSVTEST_FIDX                          = 0x0001
   873  	CSV_INBUFSZ                           = 1024
   874  	CSV_MXERR                             = 200
   875  	EXPLN_COLUMN_ADDR                     = 0
   876  	EXPLN_COLUMN_COMMENT                  = 7
   877  	EXPLN_COLUMN_OPCODE                   = 1
   878  	EXPLN_COLUMN_P1                       = 2
   879  	EXPLN_COLUMN_P2                       = 3
   880  	EXPLN_COLUMN_P3                       = 4
   881  	EXPLN_COLUMN_P4                       = 5
   882  	EXPLN_COLUMN_P5                       = 6
   883  	EXPLN_COLUMN_SQL                      = 8
   884  	ACCESSPERMS                           = 511
   885  	ALLPERMS                              = 4095
   886  	AT_EACCESS                            = 0x0100
   887  	AT_FDCWD                              = -100
   888  	AT_REMOVEDIR                          = 0x0800
   889  	AT_RESOLVE_BENEATH                    = 0x2000
   890  	AT_SYMLINK_FOLLOW                     = 0x0400
   891  	AT_SYMLINK_NOFOLLOW                   = 0x0200
   892  	BIG_ENDIAN                            = 4321
   893  	BYTE_ORDER                            = 1234
   894  	CLK_TCK                               = 128
   895  	CLOCKS_PER_SEC                        = 128
   896  	CLOCK_MONOTONIC                       = 4
   897  	CLOCK_MONOTONIC_FAST                  = 12
   898  	CLOCK_MONOTONIC_PRECISE               = 11
   899  	CLOCK_PROCESS_CPUTIME_ID              = 15
   900  	CLOCK_PROF                            = 2
   901  	CLOCK_REALTIME                        = 0
   902  	CLOCK_REALTIME_FAST                   = 10
   903  	CLOCK_REALTIME_PRECISE                = 9
   904  	CLOCK_SECOND                          = 13
   905  	CLOCK_THREAD_CPUTIME_ID               = 14
   906  	CLOCK_UPTIME                          = 5
   907  	CLOCK_UPTIME_FAST                     = 8
   908  	CLOCK_UPTIME_PRECISE                  = 7
   909  	CLOCK_VIRTUAL                         = 1
   910  	CPUCLOCK_WHICH_PID                    = 0
   911  	CPUCLOCK_WHICH_TID                    = 1
   912  	DEFFILEMODE                           = 438
   913  	DIRBLKSIZ                             = 1024
   914  	DST_AUST                              = 2
   915  	DST_CAN                               = 6
   916  	DST_EET                               = 5
   917  	DST_MET                               = 4
   918  	DST_NONE                              = 0
   919  	DST_USA                               = 1
   920  	DST_WET                               = 3
   921  	DTF_HIDEW                             = 0x0001
   922  	DTF_NODUP                             = 0x0002
   923  	DTF_REWIND                            = 0x0004
   924  	DT_BLK                                = 6
   925  	DT_CHR                                = 2
   926  	DT_DIR                                = 4
   927  	DT_FIFO                               = 1
   928  	DT_LNK                                = 10
   929  	DT_REG                                = 8
   930  	DT_SOCK                               = 12
   931  	DT_UNKNOWN                            = 0
   932  	DT_WHT                                = 14
   933  	E2BIG                                 = 7
   934  	EACCES                                = 13
   935  	EADDRINUSE                            = 48
   936  	EADDRNOTAVAIL                         = 49
   937  	EAFNOSUPPORT                          = 47
   938  	EAGAIN                                = 35
   939  	EALREADY                              = 37
   940  	EAUTH                                 = 80
   941  	EBADF                                 = 9
   942  	EBADMSG                               = 89
   943  	EBADRPC                               = 72
   944  	EBUSY                                 = 16
   945  	ECANCELED                             = 85
   946  	ECAPMODE                              = 94
   947  	ECHILD                                = 10
   948  	ECONNABORTED                          = 53
   949  	ECONNREFUSED                          = 61
   950  	ECONNRESET                            = 54
   951  	EDEADLK                               = 11
   952  	EDESTADDRREQ                          = 39
   953  	EDOM                                  = 33
   954  	EDOOFUS                               = 88
   955  	EDQUOT                                = 69
   956  	EEXIST                                = 17
   957  	EFAULT                                = 14
   958  	EFBIG                                 = 27
   959  	EFTYPE                                = 79
   960  	EHOSTDOWN                             = 64
   961  	EHOSTUNREACH                          = 65
   962  	EIDRM                                 = 82
   963  	EILSEQ                                = 86
   964  	EINPROGRESS                           = 36
   965  	EINTEGRITY                            = 97
   966  	EINTR                                 = 4
   967  	EINVAL                                = 22
   968  	EIO                                   = 5
   969  	EISCONN                               = 56
   970  	EISDIR                                = 21
   971  	ELAST                                 = 97
   972  	ELOOP                                 = 62
   973  	EMFILE                                = 24
   974  	EMLINK                                = 31
   975  	EMSGSIZE                              = 40
   976  	EMULTIHOP                             = 90
   977  	ENAMETOOLONG                          = 63
   978  	ENEEDAUTH                             = 81
   979  	ENETDOWN                              = 50
   980  	ENETRESET                             = 52
   981  	ENETUNREACH                           = 51
   982  	ENFILE                                = 23
   983  	ENOATTR                               = 87
   984  	ENOBUFS                               = 55
   985  	ENODEV                                = 19
   986  	ENOENT                                = 2
   987  	ENOEXEC                               = 8
   988  	ENOLCK                                = 77
   989  	ENOLINK                               = 91
   990  	ENOMEM                                = 12
   991  	ENOMSG                                = 83
   992  	ENOPROTOOPT                           = 42
   993  	ENOSPC                                = 28
   994  	ENOSYS                                = 78
   995  	ENOTBLK                               = 15
   996  	ENOTCAPABLE                           = 93
   997  	ENOTCONN                              = 57
   998  	ENOTDIR                               = 20
   999  	ENOTEMPTY                             = 66
  1000  	ENOTRECOVERABLE                       = 95
  1001  	ENOTSOCK                              = 38
  1002  	ENOTSUP                               = 45
  1003  	ENOTTY                                = 25
  1004  	ENXIO                                 = 6
  1005  	EOPNOTSUPP                            = 45
  1006  	EOVERFLOW                             = 84
  1007  	EOWNERDEAD                            = 96
  1008  	EPERM                                 = 1
  1009  	EPFNOSUPPORT                          = 46
  1010  	EPIPE                                 = 32
  1011  	EPROCLIM                              = 67
  1012  	EPROCUNAVAIL                          = 76
  1013  	EPROGMISMATCH                         = 75
  1014  	EPROGUNAVAIL                          = 74
  1015  	EPROTO                                = 92
  1016  	EPROTONOSUPPORT                       = 43
  1017  	EPROTOTYPE                            = 41
  1018  	ERANGE                                = 34
  1019  	EREMOTE                               = 71
  1020  	EROFS                                 = 30
  1021  	ERPCMISMATCH                          = 73
  1022  	ESHUTDOWN                             = 58
  1023  	ESOCKTNOSUPPORT                       = 44
  1024  	ESPIPE                                = 29
  1025  	ESRCH                                 = 3
  1026  	ESTALE                                = 70
  1027  	ETIMEDOUT                             = 60
  1028  	ETOOMANYREFS                          = 59
  1029  	ETXTBSY                               = 26
  1030  	EUSERS                                = 68
  1031  	EWOULDBLOCK                           = 35
  1032  	EXDEV                                 = 18
  1033  	FAPPEND                               = 8
  1034  	FASYNC                                = 64
  1035  	FDSYNC                                = 16777216
  1036  	FD_CLOEXEC                            = 1
  1037  	FD_NONE                               = -200
  1038  	FD_SETSIZE                            = 1024
  1039  	FFSYNC                                = 128
  1040  	FNDELAY                               = 4
  1041  	FNONBLOCK                             = 4
  1042  	FRDAHEAD                              = 512
  1043  	FREAD                                 = 0x0001
  1044  	FSDIR_COLUMN_DATA                     = 3
  1045  	FSDIR_COLUMN_DIR                      = 5
  1046  	FSDIR_COLUMN_MODE                     = 1
  1047  	FSDIR_COLUMN_MTIME                    = 2
  1048  	FSDIR_COLUMN_NAME                     = 0
  1049  	FSDIR_COLUMN_PATH                     = 4
  1050  	FSDIR_SCHEMA                          = "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"
  1051  	FWRITE                                = 0x0002
  1052  	F_ADD_SEALS                           = 19
  1053  	F_CANCEL                              = 5
  1054  	F_DUP2FD                              = 10
  1055  	F_DUP2FD_CLOEXEC                      = 18
  1056  	F_DUPFD                               = 0
  1057  	F_DUPFD_CLOEXEC                       = 17
  1058  	F_GETFD                               = 1
  1059  	F_GETFL                               = 3
  1060  	F_GETLK                               = 11
  1061  	F_GETOWN                              = 5
  1062  	F_GET_SEALS                           = 20
  1063  	F_ISUNIONSTACK                        = 21
  1064  	F_LOCK                                = 1
  1065  	F_OGETLK                              = 7
  1066  	F_OK                                  = 0
  1067  	F_OSETLK                              = 8
  1068  	F_OSETLKW                             = 9
  1069  	F_RDAHEAD                             = 16
  1070  	F_RDLCK                               = 1
  1071  	F_READAHEAD                           = 15
  1072  	F_SEAL_GROW                           = 0x0004
  1073  	F_SEAL_SEAL                           = 0x0001
  1074  	F_SEAL_SHRINK                         = 0x0002
  1075  	F_SEAL_WRITE                          = 0x0008
  1076  	F_SETFD                               = 2
  1077  	F_SETFL                               = 4
  1078  	F_SETLK                               = 12
  1079  	F_SETLKW                              = 13
  1080  	F_SETLK_REMOTE                        = 14
  1081  	F_SETOWN                              = 6
  1082  	F_TEST                                = 3
  1083  	F_TLOCK                               = 2
  1084  	F_ULOCK                               = 0
  1085  	F_UNLCK                               = 2
  1086  	F_UNLCKSYS                            = 4
  1087  	F_WRLCK                               = 3
  1088  	ITIMER_PROF                           = 2
  1089  	ITIMER_REAL                           = 0
  1090  	ITIMER_VIRTUAL                        = 1
  1091  	LITTLE_ENDIAN                         = 1234
  1092  	LOCK_EX                               = 0x02
  1093  	LOCK_NB                               = 0x04
  1094  	LOCK_SH                               = 0x01
  1095  	LOCK_UN                               = 0x08
  1096  	L_INCR                                = 1
  1097  	L_SET                                 = 0
  1098  	L_XTND                                = 2
  1099  	MAXNAMLEN                             = 255
  1100  	O_ACCMODE                             = 0x0003
  1101  	O_APPEND                              = 0x0008
  1102  	O_ASYNC                               = 0x0040
  1103  	O_CLOEXEC                             = 0x00100000
  1104  	O_CREAT                               = 0x0200
  1105  	O_DIRECT                              = 0x00010000
  1106  	O_DIRECTORY                           = 0x00020000
  1107  	O_DSYNC                               = 0x01000000
  1108  	O_EXCL                                = 0x0800
  1109  	O_EXEC                                = 0x00040000
  1110  	O_EXLOCK                              = 0x0020
  1111  	O_FSYNC                               = 0x0080
  1112  	O_NDELAY                              = 4
  1113  	O_NOCTTY                              = 0x8000
  1114  	O_NOFOLLOW                            = 0x0100
  1115  	O_NONBLOCK                            = 0x0004
  1116  	O_RDONLY                              = 0x0000
  1117  	O_RDWR                                = 0x0002
  1118  	O_RESOLVE_BENEATH                     = 0x00800000
  1119  	O_SEARCH                              = 262144
  1120  	O_SHLOCK                              = 0x0010
  1121  	O_SYNC                                = 0x0080
  1122  	O_TRUNC                               = 0x0400
  1123  	O_TTY_INIT                            = 0x00080000
  1124  	O_VERIFY                              = 0x00200000
  1125  	O_WRONLY                              = 0x0001
  1126  	PDP_ENDIAN                            = 3412
  1127  	POSIX_FADV_DONTNEED                   = 4
  1128  	POSIX_FADV_NOREUSE                    = 5
  1129  	POSIX_FADV_NORMAL                     = 0
  1130  	POSIX_FADV_RANDOM                     = 1
  1131  	POSIX_FADV_SEQUENTIAL                 = 2
  1132  	POSIX_FADV_WILLNEED                   = 3
  1133  	RFCENVG                               = 2048
  1134  	RFCFDG                                = 4096
  1135  	RFCNAMEG                              = 1024
  1136  	RFENVG                                = 2
  1137  	RFFDG                                 = 4
  1138  	RFFLAGS                               = 2416930932
  1139  	RFHIGHPID                             = 262144
  1140  	RFKERNELONLY                          = 268828672
  1141  	RFLINUXTHPN                           = 65536
  1142  	RFMEM                                 = 32
  1143  	RFNAMEG                               = 1
  1144  	RFNOTEG                               = 8
  1145  	RFNOWAIT                              = 64
  1146  	RFPPWAIT                              = 2147483648
  1147  	RFPROC                                = 16
  1148  	RFPROCDESC                            = 268435456
  1149  	RFSIGSHARE                            = 16384
  1150  	RFSPAWN                               = 2147483648
  1151  	RFSTOPPED                             = 131072
  1152  	RFTHREAD                              = 8192
  1153  	RFTSIGMASK                            = 0xFF
  1154  	RFTSIGSHIFT                           = 20
  1155  	RFTSIGZMB                             = 524288
  1156  	R_OK                                  = 0x04
  1157  	SBT_MAX                               = 0x7fffffffffffffff
  1158  	SEEK_DATA                             = 3
  1159  	SEEK_HOLE                             = 4
  1160  	SF_APPEND                             = 0x00040000
  1161  	SF_ARCHIVED                           = 0x00010000
  1162  	SF_IMMUTABLE                          = 0x00020000
  1163  	SF_NOUNLINK                           = 0x00100000
  1164  	SF_SETTABLE                           = 0xffff0000
  1165  	SF_SNAPSHOT                           = 0x00200000
  1166  	STDERR_FILENO                         = 2
  1167  	STDIN_FILENO                          = 0
  1168  	STDOUT_FILENO                         = 1
  1169  	S_BLKSIZE                             = 512
  1170  	S_IEXEC                               = 64
  1171  	S_IFBLK                               = 0060000
  1172  	S_IFCHR                               = 0020000
  1173  	S_IFDIR                               = 0040000
  1174  	S_IFIFO                               = 0010000
  1175  	S_IFLNK                               = 0120000
  1176  	S_IFMT                                = 0170000
  1177  	S_IFREG                               = 0100000
  1178  	S_IFSOCK                              = 0140000
  1179  	S_IFWHT                               = 0160000
  1180  	S_IREAD                               = 256
  1181  	S_IRGRP                               = 0000040
  1182  	S_IROTH                               = 0000004
  1183  	S_IRUSR                               = 0000400
  1184  	S_IRWXG                               = 0000070
  1185  	S_IRWXO                               = 0000007
  1186  	S_IRWXU                               = 0000700
  1187  	S_ISGID                               = 0002000
  1188  	S_ISTXT                               = 0001000
  1189  	S_ISUID                               = 0004000
  1190  	S_ISVTX                               = 0001000
  1191  	S_IWGRP                               = 0000020
  1192  	S_IWOTH                               = 0000002
  1193  	S_IWRITE                              = 128
  1194  	S_IWUSR                               = 0000200
  1195  	S_IXGRP                               = 0000010
  1196  	S_IXOTH                               = 0000001
  1197  	S_IXUSR                               = 0000100
  1198  	TIMER_ABSTIME                         = 0x1
  1199  	TIMER_RELTIME                         = 0x0
  1200  	TIME_UTC                              = 1
  1201  	UF_APPEND                             = 0x00000004
  1202  	UF_ARCHIVE                            = 0x00000800
  1203  	UF_HIDDEN                             = 0x00008000
  1204  	UF_IMMUTABLE                          = 0x00000002
  1205  	UF_NODUMP                             = 0x00000001
  1206  	UF_NOUNLINK                           = 0x00000010
  1207  	UF_OFFLINE                            = 0x00000200
  1208  	UF_OPAQUE                             = 0x00000008
  1209  	UF_READONLY                           = 0x00001000
  1210  	UF_REPARSE                            = 0x00000400
  1211  	UF_SETTABLE                           = 0x0000ffff
  1212  	UF_SPARSE                             = 0x00000100
  1213  	UF_SYSTEM                             = 0x00000080
  1214  	UTIME_NOW                             = -1
  1215  	UTIME_OMIT                            = -2
  1216  	W_OK                                  = 0x02
  1217  	X_OK                                  = 0x01
  1218  	X_ACCMODE_T_DECLARED                  = 0
  1219  	X_BIG_ENDIAN                          = 4321
  1220  	X_BLKCNT_T_DECLARED                   = 0
  1221  	X_BLKSIZE_T_DECLARED                  = 0
  1222  	X_BYTE_ORDER                          = 1234
  1223  	X_CAP_IOCTL_T_DECLARED                = 0
  1224  	X_CAP_RIGHTS_T_DECLARED               = 0
  1225  	X_CLOCKID_T_DECLARED                  = 0
  1226  	X_CLOCK_T_DECLARED                    = 0
  1227  	X_CS_PATH                             = 1
  1228  	X_CS_POSIX_V6_ILP32_OFF32_CFLAGS      = 2
  1229  	X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS     = 3
  1230  	X_CS_POSIX_V6_ILP32_OFF32_LIBS        = 4
  1231  	X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS     = 5
  1232  	X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS    = 6
  1233  	X_CS_POSIX_V6_ILP32_OFFBIG_LIBS       = 7
  1234  	X_CS_POSIX_V6_LP64_OFF64_CFLAGS       = 8
  1235  	X_CS_POSIX_V6_LP64_OFF64_LDFLAGS      = 9
  1236  	X_CS_POSIX_V6_LP64_OFF64_LIBS         = 10
  1237  	X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS     = 11
  1238  	X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS    = 12
  1239  	X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS       = 13
  1240  	X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS   = 14
  1241  	X_DEV_T_DECLARED                      = 0
  1242  	X_DIRENT_H_                           = 0
  1243  	X_FFLAGS_T_DECLARED                   = 0
  1244  	X_FSBLKCNT_T_DECLARED                 = 0
  1245  	X_GETOPT_DECLARED                     = 0
  1246  	X_GID_T_DECLARED                      = 0
  1247  	X_ID_T_DECLARED                       = 0
  1248  	X_INO_T_DECLARED                      = 0
  1249  	X_INT16_T_DECLARED                    = 0
  1250  	X_INT32_T_DECLARED                    = 0
  1251  	X_INT64_T_DECLARED                    = 0
  1252  	X_INT8_T_DECLARED                     = 0
  1253  	X_INTMAX_T_DECLARED                   = 0
  1254  	X_INTPTR_T_DECLARED                   = 0
  1255  	X_IN_ADDR_T_DECLARED                  = 0
  1256  	X_IN_PORT_T_DECLARED                  = 0
  1257  	X_KEY_T_DECLARED                      = 0
  1258  	X_LITTLE_ENDIAN                       = 1234
  1259  	X_LWPID_T_DECLARED                    = 0
  1260  	X_MACHINE_ENDIAN_H_                   = 0
  1261  	X_MKNOD_DECLARED                      = 0
  1262  	X_MODE_T_DECLARED                     = 0
  1263  	X_MQD_T_DECLARED                      = 0
  1264  	X_NLINK_T_DECLARED                    = 0
  1265  	X_OPTRESET_DECLARED                   = 0
  1266  	X_PC_ACL_EXTENDED                     = 59
  1267  	X_PC_ACL_NFS4                         = 64
  1268  	X_PC_ACL_PATH_MAX                     = 60
  1269  	X_PC_ALLOC_SIZE_MIN                   = 10
  1270  	X_PC_ASYNC_IO                         = 53
  1271  	X_PC_CAP_PRESENT                      = 61
  1272  	X_PC_CHOWN_RESTRICTED                 = 7
  1273  	X_PC_FILESIZEBITS                     = 12
  1274  	X_PC_INF_PRESENT                      = 62
  1275  	X_PC_LINK_MAX                         = 1
  1276  	X_PC_MAC_PRESENT                      = 63
  1277  	X_PC_MAX_CANON                        = 2
  1278  	X_PC_MAX_INPUT                        = 3
  1279  	X_PC_MIN_HOLE_SIZE                    = 21
  1280  	X_PC_NAME_MAX                         = 4
  1281  	X_PC_NO_TRUNC                         = 8
  1282  	X_PC_PATH_MAX                         = 5
  1283  	X_PC_PIPE_BUF                         = 6
  1284  	X_PC_PRIO_IO                          = 54
  1285  	X_PC_REC_INCR_XFER_SIZE               = 14
  1286  	X_PC_REC_MAX_XFER_SIZE                = 15
  1287  	X_PC_REC_MIN_XFER_SIZE                = 16
  1288  	X_PC_REC_XFER_ALIGN                   = 17
  1289  	X_PC_SYMLINK_MAX                      = 18
  1290  	X_PC_SYNC_IO                          = 55
  1291  	X_PC_VDISABLE                         = 9
  1292  	X_PDP_ENDIAN                          = 3412
  1293  	X_PID_T_DECLARED                      = 0
  1294  	X_POSIX2_CHAR_TERM                    = 1
  1295  	X_POSIX2_C_BIND                       = 200112
  1296  	X_POSIX2_C_DEV                        = -1
  1297  	X_POSIX2_FORT_DEV                     = -1
  1298  	X_POSIX2_FORT_RUN                     = 200112
  1299  	X_POSIX2_LOCALEDEF                    = -1
  1300  	X_POSIX2_PBS                          = -1
  1301  	X_POSIX2_PBS_ACCOUNTING               = -1
  1302  	X_POSIX2_PBS_CHECKPOINT               = -1
  1303  	X_POSIX2_PBS_LOCATE                   = -1
  1304  	X_POSIX2_PBS_MESSAGE                  = -1
  1305  	X_POSIX2_PBS_TRACK                    = -1
  1306  	X_POSIX2_SW_DEV                       = -1
  1307  	X_POSIX2_UPE                          = 200112
  1308  	X_POSIX2_VERSION                      = 199212
  1309  	X_POSIX_ADVISORY_INFO                 = 200112
  1310  	X_POSIX_ASYNCHRONOUS_IO               = 200112
  1311  	X_POSIX_BARRIERS                      = 200112
  1312  	X_POSIX_CHOWN_RESTRICTED              = 1
  1313  	X_POSIX_CLOCK_SELECTION               = -1
  1314  	X_POSIX_CPUTIME                       = 200112
  1315  	X_POSIX_FSYNC                         = 200112
  1316  	X_POSIX_IPV6                          = 0
  1317  	X_POSIX_JOB_CONTROL                   = 1
  1318  	X_POSIX_MAPPED_FILES                  = 200112
  1319  	X_POSIX_MEMLOCK                       = -1
  1320  	X_POSIX_MEMLOCK_RANGE                 = 200112
  1321  	X_POSIX_MEMORY_PROTECTION             = 200112
  1322  	X_POSIX_MESSAGE_PASSING               = 200112
  1323  	X_POSIX_MONOTONIC_CLOCK               = 200112
  1324  	X_POSIX_NO_TRUNC                      = 1
  1325  	X_POSIX_PRIORITIZED_IO                = -1
  1326  	X_POSIX_PRIORITY_SCHEDULING           = 0
  1327  	X_POSIX_RAW_SOCKETS                   = 200112
  1328  	X_POSIX_READER_WRITER_LOCKS           = 200112
  1329  	X_POSIX_REALTIME_SIGNALS              = 200112
  1330  	X_POSIX_REGEXP                        = 1
  1331  	X_POSIX_SEMAPHORES                    = 200112
  1332  	X_POSIX_SHARED_MEMORY_OBJECTS         = 200112
  1333  	X_POSIX_SHELL                         = 1
  1334  	X_POSIX_SPAWN                         = 200112
  1335  	X_POSIX_SPIN_LOCKS                    = 200112
  1336  	X_POSIX_SPORADIC_SERVER               = -1
  1337  	X_POSIX_SYNCHRONIZED_IO               = -1
  1338  	X_POSIX_THREADS                       = 200112
  1339  	X_POSIX_THREAD_ATTR_STACKADDR         = 200112
  1340  	X_POSIX_THREAD_ATTR_STACKSIZE         = 200112
  1341  	X_POSIX_THREAD_CPUTIME                = 200112
  1342  	X_POSIX_THREAD_PRIORITY_SCHEDULING    = 200112
  1343  	X_POSIX_THREAD_PRIO_INHERIT           = 200112
  1344  	X_POSIX_THREAD_PRIO_PROTECT           = 200112
  1345  	X_POSIX_THREAD_PROCESS_SHARED         = 200112
  1346  	X_POSIX_THREAD_SAFE_FUNCTIONS         = -1
  1347  	X_POSIX_THREAD_SPORADIC_SERVER        = -1
  1348  	X_POSIX_TIMEOUTS                      = 200112
  1349  	X_POSIX_TIMERS                        = 200112
  1350  	X_POSIX_TRACE                         = -1
  1351  	X_POSIX_TRACE_EVENT_FILTER            = -1
  1352  	X_POSIX_TRACE_INHERIT                 = -1
  1353  	X_POSIX_TRACE_LOG                     = -1
  1354  	X_POSIX_TYPED_MEMORY_OBJECTS          = -1
  1355  	X_POSIX_VDISABLE                      = 0xff
  1356  	X_POSIX_VERSION                       = 200112
  1357  	X_PTHREAD_T_DECLARED                  = 0
  1358  	X_QUAD_HIGHWORD                       = 1
  1359  	X_QUAD_LOWWORD                        = 0
  1360  	X_RLIM_T_DECLARED                     = 0
  1361  	X_SC_2_CHAR_TERM                      = 20
  1362  	X_SC_2_C_BIND                         = 18
  1363  	X_SC_2_C_DEV                          = 19
  1364  	X_SC_2_FORT_DEV                       = 21
  1365  	X_SC_2_FORT_RUN                       = 22
  1366  	X_SC_2_LOCALEDEF                      = 23
  1367  	X_SC_2_PBS                            = 59
  1368  	X_SC_2_PBS_ACCOUNTING                 = 60
  1369  	X_SC_2_PBS_CHECKPOINT                 = 61
  1370  	X_SC_2_PBS_LOCATE                     = 62
  1371  	X_SC_2_PBS_MESSAGE                    = 63
  1372  	X_SC_2_PBS_TRACK                      = 64
  1373  	X_SC_2_SW_DEV                         = 24
  1374  	X_SC_2_UPE                            = 25
  1375  	X_SC_2_VERSION                        = 17
  1376  	X_SC_ADVISORY_INFO                    = 65
  1377  	X_SC_AIO_LISTIO_MAX                   = 42
  1378  	X_SC_AIO_MAX                          = 43
  1379  	X_SC_AIO_PRIO_DELTA_MAX               = 44
  1380  	X_SC_ARG_MAX                          = 1
  1381  	X_SC_ASYNCHRONOUS_IO                  = 28
  1382  	X_SC_ATEXIT_MAX                       = 107
  1383  	X_SC_BARRIERS                         = 66
  1384  	X_SC_BC_BASE_MAX                      = 9
  1385  	X_SC_BC_DIM_MAX                       = 10
  1386  	X_SC_BC_SCALE_MAX                     = 11
  1387  	X_SC_BC_STRING_MAX                    = 12
  1388  	X_SC_CHILD_MAX                        = 2
  1389  	X_SC_CLK_TCK                          = 3
  1390  	X_SC_CLOCK_SELECTION                  = 67
  1391  	X_SC_COLL_WEIGHTS_MAX                 = 13
  1392  	X_SC_CPUSET_SIZE                      = 122
  1393  	X_SC_CPUTIME                          = 68
  1394  	X_SC_DELAYTIMER_MAX                   = 45
  1395  	X_SC_EXPR_NEST_MAX                    = 14
  1396  	X_SC_FILE_LOCKING                     = 69
  1397  	X_SC_FSYNC                            = 38
  1398  	X_SC_GETGR_R_SIZE_MAX                 = 70
  1399  	X_SC_GETPW_R_SIZE_MAX                 = 71
  1400  	X_SC_HOST_NAME_MAX                    = 72
  1401  	X_SC_IOV_MAX                          = 56
  1402  	X_SC_IPV6                             = 118
  1403  	X_SC_JOB_CONTROL                      = 6
  1404  	X_SC_LINE_MAX                         = 15
  1405  	X_SC_LOGIN_NAME_MAX                   = 73
  1406  	X_SC_MAPPED_FILES                     = 29
  1407  	X_SC_MEMLOCK                          = 30
  1408  	X_SC_MEMLOCK_RANGE                    = 31
  1409  	X_SC_MEMORY_PROTECTION                = 32
  1410  	X_SC_MESSAGE_PASSING                  = 33
  1411  	X_SC_MONOTONIC_CLOCK                  = 74
  1412  	X_SC_MQ_OPEN_MAX                      = 46
  1413  	X_SC_MQ_PRIO_MAX                      = 75
  1414  	X_SC_NGROUPS_MAX                      = 4
  1415  	X_SC_NPROCESSORS_CONF                 = 57
  1416  	X_SC_NPROCESSORS_ONLN                 = 58
  1417  	X_SC_OPEN_MAX                         = 5
  1418  	X_SC_PAGESIZE                         = 47
  1419  	X_SC_PAGE_SIZE                        = 47
  1420  	X_SC_PHYS_PAGES                       = 121
  1421  	X_SC_PRIORITIZED_IO                   = 34
  1422  	X_SC_PRIORITY_SCHEDULING              = 35
  1423  	X_SC_RAW_SOCKETS                      = 119
  1424  	X_SC_READER_WRITER_LOCKS              = 76
  1425  	X_SC_REALTIME_SIGNALS                 = 36
  1426  	X_SC_REGEXP                           = 77
  1427  	X_SC_RE_DUP_MAX                       = 16
  1428  	X_SC_RTSIG_MAX                        = 48
  1429  	X_SC_SAVED_IDS                        = 7
  1430  	X_SC_SEMAPHORES                       = 37
  1431  	X_SC_SEM_NSEMS_MAX                    = 49
  1432  	X_SC_SEM_VALUE_MAX                    = 50
  1433  	X_SC_SHARED_MEMORY_OBJECTS            = 39
  1434  	X_SC_SHELL                            = 78
  1435  	X_SC_SIGQUEUE_MAX                     = 51
  1436  	X_SC_SPAWN                            = 79
  1437  	X_SC_SPIN_LOCKS                       = 80
  1438  	X_SC_SPORADIC_SERVER                  = 81
  1439  	X_SC_STREAM_MAX                       = 26
  1440  	X_SC_SYMLOOP_MAX                      = 120
  1441  	X_SC_SYNCHRONIZED_IO                  = 40
  1442  	X_SC_THREADS                          = 96
  1443  	X_SC_THREAD_ATTR_STACKADDR            = 82
  1444  	X_SC_THREAD_ATTR_STACKSIZE            = 83
  1445  	X_SC_THREAD_CPUTIME                   = 84
  1446  	X_SC_THREAD_DESTRUCTOR_ITERATIONS     = 85
  1447  	X_SC_THREAD_KEYS_MAX                  = 86
  1448  	X_SC_THREAD_PRIORITY_SCHEDULING       = 89
  1449  	X_SC_THREAD_PRIO_INHERIT              = 87
  1450  	X_SC_THREAD_PRIO_PROTECT              = 88
  1451  	X_SC_THREAD_PROCESS_SHARED            = 90
  1452  	X_SC_THREAD_SAFE_FUNCTIONS            = 91
  1453  	X_SC_THREAD_SPORADIC_SERVER           = 92
  1454  	X_SC_THREAD_STACK_MIN                 = 93
  1455  	X_SC_THREAD_THREADS_MAX               = 94
  1456  	X_SC_TIMEOUTS                         = 95
  1457  	X_SC_TIMERS                           = 41
  1458  	X_SC_TIMER_MAX                        = 52
  1459  	X_SC_TRACE                            = 97
  1460  	X_SC_TRACE_EVENT_FILTER               = 98
  1461  	X_SC_TRACE_INHERIT                    = 99
  1462  	X_SC_TRACE_LOG                        = 100
  1463  	X_SC_TTY_NAME_MAX                     = 101
  1464  	X_SC_TYPED_MEMORY_OBJECTS             = 102
  1465  	X_SC_TZNAME_MAX                       = 27
  1466  	X_SC_V6_ILP32_OFF32                   = 103
  1467  	X_SC_V6_ILP32_OFFBIG                  = 104
  1468  	X_SC_V6_LP64_OFF64                    = 105
  1469  	X_SC_V6_LPBIG_OFFBIG                  = 106
  1470  	X_SC_VERSION                          = 8
  1471  	X_SC_XOPEN_CRYPT                      = 108
  1472  	X_SC_XOPEN_ENH_I18N                   = 109
  1473  	X_SC_XOPEN_LEGACY                     = 110
  1474  	X_SC_XOPEN_REALTIME                   = 111
  1475  	X_SC_XOPEN_REALTIME_THREADS           = 112
  1476  	X_SC_XOPEN_SHM                        = 113
  1477  	X_SC_XOPEN_STREAMS                    = 114
  1478  	X_SC_XOPEN_UNIX                       = 115
  1479  	X_SC_XOPEN_VERSION                    = 116
  1480  	X_SC_XOPEN_XCU_VERSION                = 117
  1481  	X_SELECT_DECLARED                     = 0
  1482  	X_SIGSET_T_DECLARED                   = 0
  1483  	X_SIG_MAXSIG                          = 128
  1484  	X_SIG_WORDS                           = 4
  1485  	X_SUSECONDS_T_DECLARED                = 0
  1486  	X_SYS_DIRENT_H_                       = 0
  1487  	X_SYS_ERRNO_H_                        = 0
  1488  	X_SYS_FCNTL_H_                        = 0
  1489  	X_SYS_SELECT_H_                       = 0
  1490  	X_SYS_STAT_H_                         = 0
  1491  	X_SYS_TIMESPEC_H_                     = 0
  1492  	X_SYS_TIME_H_                         = 0
  1493  	X_SYS_TYPES_H_                        = 0
  1494  	X_SYS_UNISTD_H_                       = 0
  1495  	X_SYS__PTHREADTYPES_H_                = 0
  1496  	X_SYS__SIGSET_H_                      = 0
  1497  	X_SYS__STDINT_H_                      = 0
  1498  	X_SYS__TIMESPEC_H_                    = 0
  1499  	X_SYS__TIMEVAL_H_                     = 0
  1500  	X_TIMER_T_DECLARED                    = 0
  1501  	X_TIME_H_                             = 0
  1502  	X_TIME_T_DECLARED                     = 0
  1503  	X_UID_T_DECLARED                      = 0
  1504  	X_UINT16_T_DECLARED                   = 0
  1505  	X_UINT32_T_DECLARED                   = 0
  1506  	X_UINT64_T_DECLARED                   = 0
  1507  	X_UINT8_T_DECLARED                    = 0
  1508  	X_UINTMAX_T_DECLARED                  = 0
  1509  	X_UINTPTR_T_DECLARED                  = 0
  1510  	X_UNISTD_H_                           = 0
  1511  	X_USECONDS_T_DECLARED                 = 0
  1512  	X_UTIME_H_                            = 0
  1513  	X_V6_ILP32_OFF32                      = -1
  1514  	X_V6_ILP32_OFFBIG                     = 0
  1515  	X_V6_LP64_OFF64                       = 0
  1516  	X_V6_LPBIG_OFFBIG                     = -1
  1517  	X_XLOCALE_LOCALE1_H                   = 0
  1518  	X_XOPEN_CRYPT                         = -1
  1519  	X_XOPEN_ENH_I18N                      = -1
  1520  	X_XOPEN_LEGACY                        = -1
  1521  	X_XOPEN_REALTIME                      = -1
  1522  	X_XOPEN_REALTIME_THREADS              = -1
  1523  	X_XOPEN_SHM                           = 1
  1524  	X_XOPEN_STREAMS                       = -1
  1525  	X_XOPEN_UNIX                          = -1
  1526  	FUZZER_HASH                           = 4001
  1527  	FUZZER_MX_COST                        = 1000
  1528  	FUZZER_MX_LENGTH                      = 50
  1529  	FUZZER_MX_OUTPUT_LENGTH               = 100
  1530  	FUZZER_MX_RULEID                      = 2147483647
  1531  	FUZZER_NQUEUE                         = 20
  1532  	CC_AND                                = 24
  1533  	CC_BANG                               = 15
  1534  	CC_COMMA                              = 23
  1535  	CC_DIGIT                              = 3
  1536  	CC_DOLLAR                             = 4
  1537  	CC_DOT                                = 26
  1538  	CC_EQ                                 = 14
  1539  	CC_GT                                 = 13
  1540  	CC_ID                                 = 2
  1541  	CC_ILLEGAL                            = 27
  1542  	CC_KYWD                               = 1
  1543  	CC_LP                                 = 17
  1544  	CC_LT                                 = 12
  1545  	CC_MINUS                              = 11
  1546  	CC_PERCENT                            = 22
  1547  	CC_PIPE                               = 10
  1548  	CC_PLUS                               = 20
  1549  	CC_QUOTE                              = 8
  1550  	CC_QUOTE2                             = 9
  1551  	CC_RP                                 = 18
  1552  	CC_SEMI                               = 19
  1553  	CC_SLASH                              = 16
  1554  	CC_SPACE                              = 7
  1555  	CC_STAR                               = 21
  1556  	CC_TILDA                              = 25
  1557  	CC_VARALPHA                           = 5
  1558  	CC_VARNUM                             = 6
  1559  	CC_X                                  = 0
  1560  	TK_BITAND                             = 3
  1561  	TK_BITNOT                             = 3
  1562  	TK_BITOR                              = 3
  1563  	TK_BLOB                               = 2
  1564  	TK_COMMA                              = 3
  1565  	TK_CONCAT                             = 3
  1566  	TK_DOT                                = 3
  1567  	TK_EQ                                 = 3
  1568  	TK_ERROR                              = 4
  1569  	TK_FLOAT                              = 2
  1570  	TK_GE                                 = 3
  1571  	TK_GT                                 = 3
  1572  	TK_ID                                 = 1
  1573  	TK_ILLEGAL                            = 4
  1574  	TK_INTEGER                            = 2
  1575  	TK_LE                                 = 3
  1576  	TK_LITERAL                            = 2
  1577  	TK_LP                                 = 3
  1578  	TK_LSHIFT                             = 3
  1579  	TK_LT                                 = 3
  1580  	TK_MINUS                              = 3
  1581  	TK_NAME                               = 1
  1582  	TK_NE                                 = 3
  1583  	TK_PLUS                               = 3
  1584  	TK_PUNCT                              = 3
  1585  	TK_REM                                = 3
  1586  	TK_RP                                 = 3
  1587  	TK_RSHIFT                             = 3
  1588  	TK_SEMI                               = 3
  1589  	TK_SLASH                              = 3
  1590  	TK_SPACE                              = 0
  1591  	TK_STAR                               = 3
  1592  	TK_STRING                             = 2
  1593  	TK_VARIABLE                           = 2
  1594  	Deliberate_fall_through               = 0
  1595  	RE_EOF                                = 0
  1596  	RE_OP_ACCEPT                          = 6
  1597  	RE_OP_ANY                             = 2
  1598  	RE_OP_ANYSTAR                         = 3
  1599  	RE_OP_BOUNDARY                        = 17
  1600  	RE_OP_CC_EXC                          = 8
  1601  	RE_OP_CC_INC                          = 7
  1602  	RE_OP_CC_RANGE                        = 10
  1603  	RE_OP_CC_VALUE                        = 9
  1604  	RE_OP_DIGIT                           = 13
  1605  	RE_OP_FORK                            = 4
  1606  	RE_OP_GOTO                            = 5
  1607  	RE_OP_MATCH                           = 1
  1608  	RE_OP_NOTDIGIT                        = 14
  1609  	RE_OP_NOTSPACE                        = 16
  1610  	RE_OP_NOTWORD                         = 12
  1611  	RE_OP_SPACE                           = 15
  1612  	RE_OP_WORD                            = 11
  1613  	SERIES_COLUMN_START                   = 1
  1614  	SERIES_COLUMN_STEP                    = 3
  1615  	SERIES_COLUMN_STOP                    = 2
  1616  	SERIES_COLUMN_VALUE                   = 0
  1617  	CCLASS_B                              = 2
  1618  	CCLASS_C                              = 3
  1619  	CCLASS_D                              = 4
  1620  	CCLASS_DIGIT                          = 10
  1621  	CCLASS_H                              = 5
  1622  	CCLASS_L                              = 6
  1623  	CCLASS_M                              = 8
  1624  	CCLASS_OTHER                          = 12
  1625  	CCLASS_R                              = 7
  1626  	CCLASS_SILENT                         = 0
  1627  	CCLASS_SPACE                          = 11
  1628  	CCLASS_VOWEL                          = 1
  1629  	CCLASS_Y                              = 9
  1630  	FINAL_INS_COST_DIV                    = 4
  1631  	SCRIPT_ARABIC                         = 0x0010
  1632  	SCRIPT_CYRILLIC                       = 0x0002
  1633  	SCRIPT_GREEK                          = 0x0004
  1634  	SCRIPT_HEBREW                         = 0x0008
  1635  	SCRIPT_LATIN                          = 0x0001
  1636  	SPELLFIX_COL_COMMAND                  = 11
  1637  	SPELLFIX_COL_DISTANCE                 = 2
  1638  	SPELLFIX_COL_LANGID                   = 3
  1639  	SPELLFIX_COL_MATCHLEN                 = 5
  1640  	SPELLFIX_COL_PHONEHASH                = 6
  1641  	SPELLFIX_COL_RANK                     = 1
  1642  	SPELLFIX_COL_SCOPE                    = 8
  1643  	SPELLFIX_COL_SCORE                    = 4
  1644  	SPELLFIX_COL_SOUNDSLIKE               = 10
  1645  	SPELLFIX_COL_SRCHCNT                  = 9
  1646  	SPELLFIX_COL_TOP                      = 7
  1647  	SPELLFIX_COL_WORD                     = 0
  1648  	SPELLFIX_IDXNUM_DIST                  = 48
  1649  	SPELLFIX_IDXNUM_DISTLE                = 0x20
  1650  	SPELLFIX_IDXNUM_DISTLT                = 0x10
  1651  	SPELLFIX_IDXNUM_LANGID                = 0x02
  1652  	SPELLFIX_IDXNUM_MATCH                 = 0x01
  1653  	SPELLFIX_IDXNUM_ROWID                 = 0x40
  1654  	SPELLFIX_IDXNUM_SCOPE                 = 0x08
  1655  	SPELLFIX_IDXNUM_TOP                   = 0x04
  1656  	SPELLFIX_MX_HASH                      = 32
  1657  	SPELLFIX_MX_RUN                       = 1
  1658  	SQLITE_SPELLFIX_STACKALLOC_SZ         = 1024
  1659  	TOTYPE_BIGENDIAN                      = 0
  1660  	TOTYPE_LITTLEENDIAN                   = 1
  1661  	SWARMVTAB_MAX_OPEN                    = 9
  1662  	ARG_MAX                               = 524288
  1663  	BC_BASE_MAX                           = 99
  1664  	BC_DIM_MAX                            = 2048
  1665  	BC_SCALE_MAX                          = 99
  1666  	BC_STRING_MAX                         = 1000
  1667  	CHARCLASS_NAME_MAX                    = 14
  1668  	CHAR_BIT                              = 8
  1669  	CHAR_MAX                              = 127
  1670  	CHAR_MIN                              = -128
  1671  	CHILD_MAX                             = 40
  1672  	COLL_WEIGHTS_MAX                      = 10
  1673  	EXPR_NEST_MAX                         = 32
  1674  	FAR                                   = 0
  1675  	GID_MAX                               = 4294967295
  1676  	INT_MAX                               = 2147483647
  1677  	INT_MIN                               = -2147483648
  1678  	IOV_MAX                               = 1024
  1679  	LINE_MAX                              = 2048
  1680  	LLONG_MAX                             = 9223372036854775807
  1681  	LLONG_MIN                             = -9223372036854775808
  1682  	LONG_BIT                              = 64
  1683  	LONG_MAX                              = 9223372036854775807
  1684  	LONG_MIN                              = -9223372036854775808
  1685  	MAX_CANON                             = 255
  1686  	MAX_INPUT                             = 255
  1687  	MAX_MEM_LEVEL                         = 9
  1688  	MAX_WBITS                             = 15
  1689  	MB_LEN_MAX                            = 6
  1690  	MQ_PRIO_MAX                           = 64
  1691  	NAME_MAX                              = 255
  1692  	NGROUPS_MAX                           = 1023
  1693  	NL_ARGMAX                             = 4096
  1694  	NL_LANGMAX                            = 31
  1695  	NL_MSGMAX                             = 32767
  1696  	NL_NMAX                               = 1
  1697  	NL_SETMAX                             = 255
  1698  	NL_TEXTMAX                            = 2048
  1699  	OFF_MAX                               = 9223372036854775807
  1700  	OFF_MIN                               = -9223372036854775808
  1701  	OPEN_MAX                              = 64
  1702  	PASS_MAX                              = 128
  1703  	PATH_MAX                              = 1024
  1704  	PIPE_BUF                              = 512
  1705  	QUAD_MAX                              = 9223372036854775807
  1706  	QUAD_MIN                              = -9223372036854775808
  1707  	RE_DUP_MAX                            = 255
  1708  	SCHAR_MAX                             = 127
  1709  	SCHAR_MIN                             = -128
  1710  	SHRT_MAX                              = 32767
  1711  	SHRT_MIN                              = -32768
  1712  	SIZE_T_MAX                            = 18446744073709551615
  1713  	SSIZE_MAX                             = 9223372036854775807
  1714  	STDC                                  = 0
  1715  	STDC99                                = 0
  1716  	UCHAR_MAX                             = 255
  1717  	UID_MAX                               = 4294967295
  1718  	UINT_MAX                              = 4294967295
  1719  	ULLONG_MAX                            = 18446744073709551615
  1720  	ULONG_MAX                             = 18446744073709551615
  1721  	UQUAD_MAX                             = 18446744073709551615
  1722  	USHRT_MAX                             = 65535
  1723  	WORD_BIT                              = 32
  1724  	ZCONF_H                               = 0
  1725  	ZEXPORT                               = 0
  1726  	ZEXPORTVA                             = 0
  1727  	ZIPFILE_BUFFER_SIZE                   = 65536
  1728  	ZIPFILE_CDS_FIXED_SZ                  = 46
  1729  	ZIPFILE_CDS_NFILE_OFF                 = 28
  1730  	ZIPFILE_CDS_SZCOMPRESSED_OFF          = 20
  1731  	ZIPFILE_EOCD_FIXED_SZ                 = 22
  1732  	ZIPFILE_EXTRA_TIMESTAMP               = 0x5455
  1733  	ZIPFILE_F_COLUMN_IDX                  = 7
  1734  	ZIPFILE_LFH_FIXED_SZ                  = 30
  1735  	ZIPFILE_NEWENTRY_FLAGS                = 0x800
  1736  	ZIPFILE_NEWENTRY_MADEBY               = 798
  1737  	ZIPFILE_NEWENTRY_REQUIRED             = 20
  1738  	ZIPFILE_SIGNATURE_CDS                 = 0x02014b50
  1739  	ZIPFILE_SIGNATURE_EOCD                = 0x06054b50
  1740  	ZIPFILE_SIGNATURE_LFH                 = 0x04034b50
  1741  	ZLIB_H                                = 0
  1742  	ZLIB_VERNUM                           = 0x12b0
  1743  	ZLIB_VERSION                          = "1.2.11"
  1744  	ZLIB_VER_MAJOR                        = 1
  1745  	ZLIB_VER_MINOR                        = 2
  1746  	ZLIB_VER_REVISION                     = 11
  1747  	ZLIB_VER_SUBREVISION                  = 0
  1748  	Z_ASCII                               = 1
  1749  	Z_BEST_COMPRESSION                    = 9
  1750  	Z_BEST_SPEED                          = 1
  1751  	Z_BINARY                              = 0
  1752  	Z_BLOCK                               = 5
  1753  	Z_BUF_ERROR                           = -5
  1754  	Z_DATA_ERROR                          = -3
  1755  	Z_DEFAULT_COMPRESSION                 = -1
  1756  	Z_DEFAULT_STRATEGY                    = 0
  1757  	Z_DEFLATED                            = 8
  1758  	Z_ERRNO                               = -1
  1759  	Z_FILTERED                            = 1
  1760  	Z_FINISH                              = 4
  1761  	Z_FIXED                               = 4
  1762  	Z_FULL_FLUSH                          = 3
  1763  	Z_HUFFMAN_ONLY                        = 2
  1764  	Z_MEM_ERROR                           = -4
  1765  	Z_NEED_DICT                           = 2
  1766  	Z_NO_COMPRESSION                      = 0
  1767  	Z_NO_FLUSH                            = 0
  1768  	Z_NULL                                = 0
  1769  	Z_OK                                  = 0
  1770  	Z_PARTIAL_FLUSH                       = 1
  1771  	Z_RLE                                 = 3
  1772  	Z_STREAM_END                          = 1
  1773  	Z_STREAM_ERROR                        = -2
  1774  	Z_SYNC_FLUSH                          = 2
  1775  	Z_TEXT                                = 1
  1776  	Z_TREES                               = 6
  1777  	Z_UNKNOWN                             = 2
  1778  	Z_VERSION_ERROR                       = -6
  1779  	X_ANSI_STDDEF_H                       = 0
  1780  	X_BSD_PTRDIFF_T_                      = 0
  1781  	X_GCC_MAX_ALIGN_T                     = 0
  1782  	X_GCC_PTRDIFF_T                       = 0
  1783  	X_GCC_WCHAR_T                         = 0
  1784  	X_LIMITS_H_                           = 0
  1785  	X_POSIX2_BC_BASE_MAX                  = 99
  1786  	X_POSIX2_BC_DIM_MAX                   = 2048
  1787  	X_POSIX2_BC_SCALE_MAX                 = 99
  1788  	X_POSIX2_BC_STRING_MAX                = 1000
  1789  	X_POSIX2_CHARCLASS_NAME_MAX           = 14
  1790  	X_POSIX2_COLL_WEIGHTS_MAX             = 2
  1791  	X_POSIX2_EQUIV_CLASS_MAX              = 2
  1792  	X_POSIX2_EXPR_NEST_MAX                = 32
  1793  	X_POSIX2_LINE_MAX                     = 2048
  1794  	X_POSIX2_RE_DUP_MAX                   = 255
  1795  	X_POSIX_AIO_LISTIO_MAX                = 2
  1796  	X_POSIX_AIO_MAX                       = 1
  1797  	X_POSIX_ARG_MAX                       = 4096
  1798  	X_POSIX_CHILD_MAX                     = 25
  1799  	X_POSIX_CLOCKRES_MIN                  = 20000000
  1800  	X_POSIX_DELAYTIMER_MAX                = 32
  1801  	X_POSIX_HOST_NAME_MAX                 = 255
  1802  	X_POSIX_LINK_MAX                      = 8
  1803  	X_POSIX_LOGIN_NAME_MAX                = 9
  1804  	X_POSIX_MAX_CANON                     = 255
  1805  	X_POSIX_MAX_INPUT                     = 255
  1806  	X_POSIX_MQ_OPEN_MAX                   = 8
  1807  	X_POSIX_MQ_PRIO_MAX                   = 32
  1808  	X_POSIX_NAME_MAX                      = 14
  1809  	X_POSIX_NGROUPS_MAX                   = 8
  1810  	X_POSIX_OPEN_MAX                      = 20
  1811  	X_POSIX_PATH_MAX                      = 256
  1812  	X_POSIX_PIPE_BUF                      = 512
  1813  	X_POSIX_RE_DUP_MAX                    = 255
  1814  	X_POSIX_RTSIG_MAX                     = 8
  1815  	X_POSIX_SEM_NSEMS_MAX                 = 256
  1816  	X_POSIX_SEM_VALUE_MAX                 = 32767
  1817  	X_POSIX_SIGQUEUE_MAX                  = 32
  1818  	X_POSIX_SSIZE_MAX                     = 32767
  1819  	X_POSIX_SS_REPL_MAX                   = 4
  1820  	X_POSIX_STREAM_MAX                    = 8
  1821  	X_POSIX_SYMLINK_MAX                   = 255
  1822  	X_POSIX_SYMLOOP_MAX                   = 8
  1823  	X_POSIX_THREAD_DESTRUCTOR_ITERATIONS  = 4
  1824  	X_POSIX_THREAD_KEYS_MAX               = 128
  1825  	X_POSIX_THREAD_THREADS_MAX            = 64
  1826  	X_POSIX_TIMER_MAX                     = 32
  1827  	X_POSIX_TRACE_EVENT_NAME_MAX          = 30
  1828  	X_POSIX_TRACE_NAME_MAX                = 8
  1829  	X_POSIX_TRACE_SYS_MAX                 = 8
  1830  	X_POSIX_TRACE_USER_EVENT_MAX          = 32
  1831  	X_POSIX_TTY_NAME_MAX                  = 9
  1832  	X_POSIX_TZNAME_MAX                    = 6
  1833  	X_PTRDIFF_T                           = 0
  1834  	X_PTRDIFF_T_                          = 0
  1835  	X_PTRDIFF_T_DECLARED                  = 0
  1836  	X_STDDEF_H                            = 0
  1837  	X_STDDEF_H_                           = 0
  1838  	X_SYS_LIMITS_H_                       = 0
  1839  	X_SYS_SYSLIMITS_H_                    = 0
  1840  	X_T_PTRDIFF                           = 0
  1841  	X_T_PTRDIFF_                          = 0
  1842  	X_T_WCHAR                             = 0
  1843  	X_T_WCHAR_                            = 0
  1844  	X_WCHAR_T                             = 0
  1845  	X_WCHAR_T_                            = 0
  1846  	X_WCHAR_T_DEFINED                     = 0
  1847  	X_WCHAR_T_DEFINED_                    = 0
  1848  	X_WCHAR_T_H                           = 0
  1849  	X_XOPEN_IOV_MAX                       = 16
  1850  	X_XOPEN_NAME_MAX                      = 255
  1851  	X_XOPEN_PATH_MAX                      = 1024
  1852  	Z_const                               = 0
  1853  	SQLITE_RBU_STATE_CHECKPOINT           = 3
  1854  	SQLITE_RBU_STATE_DONE                 = 4
  1855  	SQLITE_RBU_STATE_ERROR                = 5
  1856  	SQLITE_RBU_STATE_MOVE                 = 2
  1857  	SQLITE_RBU_STATE_OAL                  = 1
  1858  	X_SQLITE3RBU_H                        = 0
  1859  	SESSION_STREAM_TCL_VAR                = "sqlite3session_streams"
  1860  	BUS_ADRALN                            = 1
  1861  	BUS_ADRERR                            = 2
  1862  	BUS_OBJERR                            = 3
  1863  	BUS_OOMERR                            = 100
  1864  	CLD_CONTINUED                         = 6
  1865  	CLD_DUMPED                            = 3
  1866  	CLD_EXITED                            = 1
  1867  	CLD_KILLED                            = 2
  1868  	CLD_STOPPED                           = 5
  1869  	CLD_TRAPPED                           = 4
  1870  	FPE_FLTDIV                            = 3
  1871  	FPE_FLTINV                            = 7
  1872  	FPE_FLTOVF                            = 4
  1873  	FPE_FLTRES                            = 6
  1874  	FPE_FLTSUB                            = 8
  1875  	FPE_FLTUND                            = 5
  1876  	FPE_INTDIV                            = 2
  1877  	FPE_INTOVF                            = 1
  1878  	ILL_BADSTK                            = 8
  1879  	ILL_COPROC                            = 7
  1880  	ILL_ILLADR                            = 3
  1881  	ILL_ILLOPC                            = 1
  1882  	ILL_ILLOPN                            = 2
  1883  	ILL_ILLTRP                            = 4
  1884  	ILL_PRVOPC                            = 5
  1885  	ILL_PRVREG                            = 6
  1886  	MAX_PREPARED_STMTS                    = 100
  1887  	MINSIGSTKSZ                           = 2048
  1888  	NSIG                                  = 32
  1889  	NUM_PREPARED_STMTS                    = 10
  1890  	POLL_ERR                              = 4
  1891  	POLL_HUP                              = 6
  1892  	POLL_IN                               = 1
  1893  	POLL_MSG                              = 3
  1894  	POLL_OUT                              = 2
  1895  	POLL_PRI                              = 5
  1896  	SA_NOCLDSTOP                          = 0x0008
  1897  	SA_NOCLDWAIT                          = 0x0020
  1898  	SA_NODEFER                            = 0x0010
  1899  	SA_ONSTACK                            = 0x0001
  1900  	SA_RESETHAND                          = 0x0004
  1901  	SA_RESTART                            = 0x0002
  1902  	SA_SIGINFO                            = 0x0040
  1903  	SEGV_ACCERR                           = 2
  1904  	SEGV_MAPERR                           = 1
  1905  	SEGV_PKUERR                           = 100
  1906  	SIGABRT                               = 6
  1907  	SIGALRM                               = 14
  1908  	SIGBUS                                = 10
  1909  	SIGCHLD                               = 20
  1910  	SIGCONT                               = 19
  1911  	SIGEMT                                = 7
  1912  	SIGEV_KEVENT                          = 3
  1913  	SIGEV_NONE                            = 0
  1914  	SIGEV_SIGNAL                          = 1
  1915  	SIGEV_THREAD                          = 2
  1916  	SIGEV_THREAD_ID                       = 4
  1917  	SIGFPE                                = 8
  1918  	SIGHUP                                = 1
  1919  	SIGILL                                = 4
  1920  	SIGINFO                               = 29
  1921  	SIGINT                                = 2
  1922  	SIGIO                                 = 23
  1923  	SIGIOT                                = 6
  1924  	SIGKILL                               = 9
  1925  	SIGLIBRT                              = 33
  1926  	SIGLWP                                = 32
  1927  	SIGPIPE                               = 13
  1928  	SIGPROF                               = 27
  1929  	SIGQUIT                               = 3
  1930  	SIGRTMAX                              = 126
  1931  	SIGRTMIN                              = 65
  1932  	SIGSEGV                               = 11
  1933  	SIGSTKSZ                              = 34816
  1934  	SIGSTOP                               = 17
  1935  	SIGSYS                                = 12
  1936  	SIGTERM                               = 15
  1937  	SIGTHR                                = 32
  1938  	SIGTRAP                               = 5
  1939  	SIGTSTP                               = 18
  1940  	SIGTTIN                               = 21
  1941  	SIGTTOU                               = 22
  1942  	SIGURG                                = 16
  1943  	SIGUSR1                               = 30
  1944  	SIGUSR2                               = 31
  1945  	SIGVTALRM                             = 26
  1946  	SIGWINCH                              = 28
  1947  	SIGXCPU                               = 24
  1948  	SIGXFSZ                               = 25
  1949  	SIG_BLOCK                             = 1
  1950  	SIG_SETMASK                           = 3
  1951  	SIG_UNBLOCK                           = 2
  1952  	SI_ASYNCIO                            = 0x10004
  1953  	SI_KERNEL                             = 0x10006
  1954  	SI_LWP                                = 0x10007
  1955  	SI_MESGQ                              = 0x10005
  1956  	SI_NOINFO                             = 0
  1957  	SI_QUEUE                              = 0x10002
  1958  	SI_TIMER                              = 0x10003
  1959  	SI_UNDEFINED                          = 0
  1960  	SI_USER                               = 0x10001
  1961  	SQLITE_EVAL_WITHOUTNULLS              = 0x00001
  1962  	SQLITE_TCL_NRE                        = 1
  1963  	SS_DISABLE                            = 0x0004
  1964  	SS_ONSTACK                            = 0x0001
  1965  	SV_INTERRUPT                          = 2
  1966  	SV_NOCLDSTOP                          = 8
  1967  	SV_NODEFER                            = 16
  1968  	SV_ONSTACK                            = 1
  1969  	SV_RESETHAND                          = 4
  1970  	SV_SIGINFO                            = 64
  1971  	TCLSH                                 = 1
  1972  	TRAP_BRKPT                            = 1
  1973  	TRAP_CAP                              = 4
  1974  	TRAP_DTRACE                           = 3
  1975  	TRAP_TRACE                            = 2
  1976  	X_MC_FLAG_MASK                        = 7
  1977  	X_MC_FPFMT_NODEV                      = 0x10000
  1978  	X_MC_FPFMT_XMM                        = 0x10002
  1979  	X_MC_FPOWNED_FPU                      = 0x20001
  1980  	X_MC_FPOWNED_NONE                     = 0x20000
  1981  	X_MC_FPOWNED_PCB                      = 0x20002
  1982  	X_MC_HASBASES                         = 0x2
  1983  	X_MC_HASFPXSTATE                      = 0x4
  1984  	X_MC_HASSEGS                          = 0x1
  1985  	X_SIGNAL_H_                           = 0
  1986  	X_SYS_SIGNAL_H_                       = 0
  1987  	X_SYS__UCONTEXT_H_                    = 0
  1988  	X_X86_SIGNAL_H                        = 1
  1989  	X_X86_UCONTEXT_H_                     = 0
  1990  	ALT_SCHEMA_TABLE                      = "sqlite_schema"
  1991  	ALT_TEMP_SCHEMA_TABLE                 = "sqlite_temp_schema"
  1992  	BTREE_APPEND                          = 0x08
  1993  	BTREE_APPLICATION_ID                  = 8
  1994  	BTREE_AUTOVACUUM_FULL                 = 1
  1995  	BTREE_AUTOVACUUM_INCR                 = 2
  1996  	BTREE_AUTOVACUUM_NONE                 = 0
  1997  	BTREE_AUXDELETE                       = 0x04
  1998  	BTREE_BLOBKEY                         = 2
  1999  	BTREE_BULKLOAD                        = 0x00000001
  2000  	BTREE_DATA_VERSION                    = 15
  2001  	BTREE_DEFAULT_CACHE_SIZE              = 3
  2002  	BTREE_FILE_FORMAT                     = 2
  2003  	BTREE_FORDELETE                       = 0x00000008
  2004  	BTREE_FREE_PAGE_COUNT                 = 0
  2005  	BTREE_HINT_RANGE                      = 0
  2006  	BTREE_INCR_VACUUM                     = 7
  2007  	BTREE_INTKEY                          = 1
  2008  	BTREE_LARGEST_ROOT_PAGE               = 4
  2009  	BTREE_MEMORY                          = 2
  2010  	BTREE_OMIT_JOURNAL                    = 1
  2011  	BTREE_PREFORMAT                       = 0x80
  2012  	BTREE_SAVEPOSITION                    = 0x02
  2013  	BTREE_SCHEMA_VERSION                  = 1
  2014  	BTREE_SEEK_EQ                         = 0x00000002
  2015  	BTREE_SINGLE                          = 4
  2016  	BTREE_TEXT_ENCODING                   = 5
  2017  	BTREE_UNORDERED                       = 8
  2018  	BTREE_USER_VERSION                    = 6
  2019  	BTREE_WRCSR                           = 0x00000004
  2020  	CACHE_STALE                           = 0
  2021  	COLFLAG_BUSY                          = 0x0100
  2022  	COLFLAG_GENERATED                     = 0x0060
  2023  	COLFLAG_HASTYPE                       = 0x0004
  2024  	COLFLAG_HIDDEN                        = 0x0002
  2025  	COLFLAG_NOINSERT                      = 0x0062
  2026  	COLFLAG_NOTAVAIL                      = 0x0080
  2027  	COLFLAG_PRIMKEY                       = 0x0001
  2028  	COLFLAG_SORTERREF                     = 0x0010
  2029  	COLFLAG_STORED                        = 0x0040
  2030  	COLFLAG_UNIQUE                        = 0x0008
  2031  	COLFLAG_VIRTUAL                       = 0x0020
  2032  	COLNAME_COLUMN                        = 4
  2033  	COLNAME_DATABASE                      = 2
  2034  	COLNAME_DECLTYPE                      = 1
  2035  	COLNAME_N                             = 5
  2036  	COLNAME_NAME                          = 0
  2037  	COLNAME_TABLE                         = 3
  2038  	CPUSTATES                             = 5
  2039  	CP_IDLE                               = 4
  2040  	CP_INTR                               = 3
  2041  	CP_NICE                               = 1
  2042  	CP_SYS                                = 2
  2043  	CP_USER                               = 0
  2044  	CURTYPE_BTREE                         = 0
  2045  	CURTYPE_PSEUDO                        = 3
  2046  	CURTYPE_SORTER                        = 1
  2047  	CURTYPE_VTAB                          = 2
  2048  	DBFLAG_EncodingFixed                  = 0x0040
  2049  	DBFLAG_InternalFunc                   = 0x0020
  2050  	DBFLAG_PreferBuiltin                  = 0x0002
  2051  	DBFLAG_SchemaChange                   = 0x0001
  2052  	DBFLAG_SchemaKnownOk                  = 0x0010
  2053  	DBFLAG_Vacuum                         = 0x0004
  2054  	DBFLAG_VacuumInto                     = 0x0008
  2055  	DB_ResetWanted                        = 0x0008
  2056  	DB_SchemaLoaded                       = 0x0001
  2057  	DB_UnresetViews                       = 0x0002
  2058  	DFLT_SCHEMA_TABLE                     = "sqlite_master"
  2059  	DFLT_TEMP_SCHEMA_TABLE                = "sqlite_temp_master"
  2060  	ENAME_NAME                            = 0
  2061  	ENAME_SPAN                            = 1
  2062  	ENAME_TAB                             = 2
  2063  	EP_Agg                                = 0x000010
  2064  	EP_CanBeNull                          = 0x100000
  2065  	EP_Collate                            = 0x000100
  2066  	EP_Commuted                           = 0x000200
  2067  	EP_ConstFunc                          = 0x080000
  2068  	EP_DblQuoted                          = 0x000040
  2069  	EP_Distinct                           = 0x000002
  2070  	EP_FixedCol                           = 0x000008
  2071  	EP_FromDDL                            = 0x40000000
  2072  	EP_FromJoin                           = 0x000001
  2073  	EP_HasFunc                            = 0x000004
  2074  	EP_IfNullRow                          = 0x020000
  2075  	EP_Immutable                          = 0x02
  2076  	EP_InfixFunc                          = 0x000080
  2077  	EP_IntValue                           = 0x000400
  2078  	EP_IsFalse                            = 0x20000000
  2079  	EP_IsTrue                             = 0x10000000
  2080  	EP_Leaf                               = 0x800000
  2081  	EP_MemToken                           = 0x010000
  2082  	EP_NoReduce                           = 0x01
  2083  	EP_Propagate                          = 2097412
  2084  	EP_Quoted                             = 0x4000000
  2085  	EP_Reduced                            = 0x002000
  2086  	EP_Skip                               = 0x001000
  2087  	EP_Static                             = 0x8000000
  2088  	EP_Subquery                           = 0x200000
  2089  	EP_Subrtn                             = 0x2000000
  2090  	EP_TokenOnly                          = 0x004000
  2091  	EP_Unlikely                           = 0x040000
  2092  	EP_VarSelect                          = 0x000020
  2093  	EP_Win                                = 0x008000
  2094  	EP_WinFunc                            = 0x1000000
  2095  	EP_xIsSelect                          = 0x000800
  2096  	EXCLUSIVE_LOCK                        = 4
  2097  	EXPRDUP_REDUCE                        = 0x0001
  2098  	GCC_VERSION                           = 10003000
  2099  	HAVE_DLFCN_H                          = 1
  2100  	HAVE_FCHOWN                           = 1
  2101  	HAVE_FDATASYNC                        = 1
  2102  	HAVE_GMTIME_R                         = 1
  2103  	HAVE_INT16_T                          = 1
  2104  	HAVE_INT32_T                          = 1
  2105  	HAVE_INT64_T                          = 1
  2106  	HAVE_INT8_T                           = 1
  2107  	HAVE_INTPTR_T                         = 1
  2108  	HAVE_INTTYPES_H                       = 1
  2109  	HAVE_ISNAN                            = 1
  2110  	HAVE_LOCALTIME_R                      = 1
  2111  	HAVE_LSTAT                            = 1
  2112  	HAVE_MALLOC_H                         = 1
  2113  	HAVE_MALLOC_USABLE_SIZE               = 1
  2114  	HAVE_MEMORY_H                         = 1
  2115  	HAVE_PREAD                            = 1
  2116  	HAVE_PWRITE                           = 1
  2117  	HAVE_READLINK                         = 1
  2118  	HAVE_STDINT_H                         = 1
  2119  	HAVE_STDLIB_H                         = 1
  2120  	HAVE_STRCHRNUL                        = 1
  2121  	HAVE_STRINGS_H                        = 1
  2122  	HAVE_STRING_H                         = 1
  2123  	HAVE_SYS_STAT_H                       = 1
  2124  	HAVE_SYS_TYPES_H                      = 1
  2125  	HAVE_UINT16_T                         = 1
  2126  	HAVE_UINT32_T                         = 1
  2127  	HAVE_UINT64_T                         = 1
  2128  	HAVE_UINT8_T                          = 1
  2129  	HAVE_UINTPTR_T                        = 1
  2130  	HAVE_UNISTD_H                         = 1
  2131  	HAVE_UTIME                            = 1
  2132  	INITFLAG_AlterDrop                    = 0x0002
  2133  	INITFLAG_AlterRename                  = 0x0001
  2134  	INLINEFUNC_affinity                   = 4
  2135  	INLINEFUNC_coalesce                   = 0
  2136  	INLINEFUNC_expr_compare               = 3
  2137  	INLINEFUNC_expr_implies_expr          = 2
  2138  	INLINEFUNC_iif                        = 5
  2139  	INLINEFUNC_implies_nonnull_row        = 1
  2140  	INLINEFUNC_unlikely                   = 99
  2141  	INT16_MAX                             = 0x7fff
  2142  	INT16_MIN                             = -32768
  2143  	INT32_MAX                             = 0x7fffffff
  2144  	INT32_MIN                             = -2147483648
  2145  	INT64_MAX                             = 0x7fffffffffffffff
  2146  	INT64_MIN                             = -9223372036854775808
  2147  	INT8_MAX                              = 0x7f
  2148  	INT8_MIN                              = -128
  2149  	INTMAX_MAX                            = 9223372036854775807
  2150  	INTMAX_MIN                            = -9223372036854775808
  2151  	INTPTR_MAX                            = 9223372036854775807
  2152  	INTPTR_MIN                            = -9223372036854775808
  2153  	INT_FAST16_MAX                        = 2147483647
  2154  	INT_FAST16_MIN                        = -2147483648
  2155  	INT_FAST32_MAX                        = 2147483647
  2156  	INT_FAST32_MIN                        = -2147483648
  2157  	INT_FAST64_MAX                        = 9223372036854775807
  2158  	INT_FAST64_MIN                        = -9223372036854775808
  2159  	INT_FAST8_MAX                         = 2147483647
  2160  	INT_FAST8_MIN                         = -2147483648
  2161  	INT_LEAST16_MAX                       = 32767
  2162  	INT_LEAST16_MIN                       = -32768
  2163  	INT_LEAST32_MAX                       = 2147483647
  2164  	INT_LEAST32_MIN                       = -2147483648
  2165  	INT_LEAST64_MAX                       = 9223372036854775807
  2166  	INT_LEAST64_MIN                       = -9223372036854775808
  2167  	INT_LEAST8_MAX                        = 127
  2168  	INT_LEAST8_MIN                        = -128
  2169  	IN_INDEX_EPH                          = 2
  2170  	IN_INDEX_INDEX_ASC                    = 3
  2171  	IN_INDEX_INDEX_DESC                   = 4
  2172  	IN_INDEX_LOOP                         = 0x0004
  2173  	IN_INDEX_MEMBERSHIP                   = 0x0002
  2174  	IN_INDEX_NOOP                         = 5
  2175  	IN_INDEX_NOOP_OK                      = 0x0001
  2176  	IN_INDEX_ROWID                        = 1
  2177  	JT_CROSS                              = 0x0002
  2178  	JT_ERROR                              = 0x0040
  2179  	JT_INNER                              = 0x0001
  2180  	JT_LEFT                               = 0x0008
  2181  	JT_NATURAL                            = 0x0004
  2182  	JT_OUTER                              = 0x0020
  2183  	JT_RIGHT                              = 0x0010
  2184  	KEYINFO_ORDER_BIGNULL                 = 0x02
  2185  	KEYINFO_ORDER_DESC                    = 0x01
  2186  	LOCATE_NOERR                          = 0x02
  2187  	LOCATE_VIEW                           = 0x01
  2188  	LOOKASIDE_SMALL                       = 128
  2189  	LT_OBJDIR                             = ".libs/"
  2190  	M10d_Any                              = 1
  2191  	M10d_No                               = 2
  2192  	M10d_Yes                              = 0
  2193  	MEMTYPE_HEAP                          = 0x01
  2194  	MEMTYPE_LOOKASIDE                     = 0x02
  2195  	MEMTYPE_PCACHE                        = 0x04
  2196  	MEM_AffMask                           = 0x003f
  2197  	MEM_Agg                               = 0x2000
  2198  	MEM_Blob                              = 0x0010
  2199  	MEM_Cleared                           = 0x0100
  2200  	MEM_Dyn                               = 0x0400
  2201  	MEM_Ephem                             = 0x1000
  2202  	MEM_FromBind                          = 0x0040
  2203  	MEM_Int                               = 0x0004
  2204  	MEM_IntReal                           = 0x0020
  2205  	MEM_Null                              = 0x0001
  2206  	MEM_Real                              = 0x0008
  2207  	MEM_Static                            = 0x0800
  2208  	MEM_Str                               = 0x0002
  2209  	MEM_Subtype                           = 0x8000
  2210  	MEM_Term                              = 0x0200
  2211  	MEM_TypeMask                          = 0xc1bf
  2212  	MEM_Undefined                         = 0x0080
  2213  	MEM_Zero                              = 0x4000
  2214  	MSVC_VERSION                          = 0
  2215  	NC_AllowAgg                           = 0x00001
  2216  	NC_AllowWin                           = 0x04000
  2217  	NC_Complex                            = 0x02000
  2218  	NC_FromDDL                            = 0x40000
  2219  	NC_GenCol                             = 0x00008
  2220  	NC_HasAgg                             = 0x00010
  2221  	NC_HasWin                             = 0x08000
  2222  	NC_IdxExpr                            = 0x00020
  2223  	NC_InAggFunc                          = 0x20000
  2224  	NC_IsCheck                            = 0x00004
  2225  	NC_IsDDL                              = 0x10000
  2226  	NC_MinMaxAgg                          = 0x01000
  2227  	NC_NoSelect                           = 0x80000
  2228  	NC_PartIdx                            = 0x00002
  2229  	NC_SelfRef                            = 0x0002e
  2230  	NC_UAggInfo                           = 0x00100
  2231  	NC_UBaseReg                           = 0x00400
  2232  	NC_UEList                             = 0x00080
  2233  	NC_UUpsert                            = 0x00200
  2234  	NC_VarSelect                          = 0x00040
  2235  	NO_LOCK                               = 0
  2236  	OE_Abort                              = 2
  2237  	OE_Cascade                            = 10
  2238  	OE_Default                            = 11
  2239  	OE_Fail                               = 3
  2240  	OE_Ignore                             = 4
  2241  	OE_None                               = 0
  2242  	OE_Replace                            = 5
  2243  	OE_Restrict                           = 7
  2244  	OE_Rollback                           = 1
  2245  	OE_SetDflt                            = 9
  2246  	OE_SetNull                            = 8
  2247  	OE_Update                             = 6
  2248  	OMIT_TEMPDB                           = 0
  2249  	ONEPASS_MULTI                         = 2
  2250  	ONEPASS_OFF                           = 0
  2251  	ONEPASS_SINGLE                        = 1
  2252  	OPFLAG_APPEND                         = 0x08
  2253  	OPFLAG_AUXDELETE                      = 0x04
  2254  	OPFLAG_BULKCSR                        = 0x01
  2255  	OPFLAG_EPHEM                          = 0x01
  2256  	OPFLAG_FORDELETE                      = 0x08
  2257  	OPFLAG_ISNOOP                         = 0x40
  2258  	OPFLAG_ISUPDATE                       = 0x04
  2259  	OPFLAG_LASTROWID                      = 0x20
  2260  	OPFLAG_LENGTHARG                      = 0x40
  2261  	OPFLAG_NCHANGE                        = 0x01
  2262  	OPFLAG_NOCHNG                         = 0x01
  2263  	OPFLAG_NOCHNG_MAGIC                   = 0x6d
  2264  	OPFLAG_P2ISREG                        = 0x10
  2265  	OPFLAG_PERMUTE                        = 0x01
  2266  	OPFLAG_PREFORMAT                      = 0x80
  2267  	OPFLAG_SAVEPOSITION                   = 0x02
  2268  	OPFLAG_SEEKEQ                         = 0x02
  2269  	OPFLAG_TYPEOFARG                      = 0x80
  2270  	OPFLAG_USESEEKRESULT                  = 0x10
  2271  	OPFLG_IN1                             = 0x02
  2272  	OPFLG_IN2                             = 0x04
  2273  	OPFLG_IN3                             = 0x08
  2274  	OPFLG_JUMP                            = 0x01
  2275  	OPFLG_OUT2                            = 0x10
  2276  	OPFLG_OUT3                            = 0x20
  2277  	OP_Abortable                          = 179
  2278  	OP_Add                                = 106
  2279  	OP_AddImm                             = 83
  2280  	OP_Affinity                           = 92
  2281  	OP_AggFinal                           = 161
  2282  	OP_AggInverse                         = 157
  2283  	OP_AggStep                            = 158
  2284  	OP_AggStep1                           = 159
  2285  	OP_AggValue                           = 160
  2286  	OP_And                                = 44
  2287  	OP_AutoCommit                         = 1
  2288  	OP_BitAnd                             = 102
  2289  	OP_BitNot                             = 113
  2290  	OP_BitOr                              = 103
  2291  	OP_Blob                               = 74
  2292  	OP_Cast                               = 85
  2293  	OP_Checkpoint                         = 6
  2294  	OP_ChngCntRow                         = 80
  2295  	OP_Clear                              = 141
  2296  	OP_Close                              = 118
  2297  	OP_CollSeq                            = 82
  2298  	OP_Column                             = 91
  2299  	OP_ColumnsUsed                        = 119
  2300  	OP_Compare                            = 87
  2301  	OP_Concat                             = 111
  2302  	OP_Copy                               = 77
  2303  	OP_Count                              = 94
  2304  	OP_CreateBtree                        = 143
  2305  	OP_CursorHint                         = 175
  2306  	OP_CursorLock                         = 163
  2307  	OP_CursorUnlock                       = 164
  2308  	OP_DecrJumpZero                       = 59
  2309  	OP_DeferredSeek                       = 137
  2310  	OP_Delete                             = 126
  2311  	OP_Destroy                            = 140
  2312  	OP_Divide                             = 109
  2313  	OP_DropIndex                          = 148
  2314  	OP_DropTable                          = 147
  2315  	OP_DropTrigger                        = 149
  2316  	OP_ElseEq                             = 58
  2317  	OP_EndCoroutine                       = 66
  2318  	OP_Eq                                 = 53
  2319  	OP_Expire                             = 162
  2320  	OP_Explain                            = 178
  2321  	OP_FinishSeek                         = 139
  2322  	OP_FkCounter                          = 154
  2323  	OP_FkIfZero                           = 47
  2324  	OP_Found                              = 30
  2325  	OP_Function                           = 64
  2326  	OP_Ge                                 = 57
  2327  	OP_Gosub                              = 12
  2328  	OP_Goto                               = 11
  2329  	OP_Gt                                 = 54
  2330  	OP_Halt                               = 68
  2331  	OP_HaltIfNull                         = 67
  2332  	OP_IdxDelete                          = 136
  2333  	OP_IdxGE                              = 41
  2334  	OP_IdxGT                              = 39
  2335  	OP_IdxInsert                          = 134
  2336  	OP_IdxLE                              = 38
  2337  	OP_IdxLT                              = 40
  2338  	OP_IdxRowid                           = 138
  2339  	OP_If                                 = 18
  2340  	OP_IfNoHope                           = 27
  2341  	OP_IfNot                              = 20
  2342  	OP_IfNotOpen                          = 26
  2343  	OP_IfNotZero                          = 49
  2344  	OP_IfNullRow                          = 21
  2345  	OP_IfPos                              = 48
  2346  	OP_IfSmaller                          = 34
  2347  	OP_IncrVacuum                         = 60
  2348  	OP_Init                               = 62
  2349  	OP_InitCoroutine                      = 13
  2350  	OP_Insert                             = 124
  2351  	OP_Int64                              = 70
  2352  	OP_IntCopy                            = 79
  2353  	OP_Integer                            = 69
  2354  	OP_IntegrityCk                        = 150
  2355  	OP_IsNull                             = 50
  2356  	OP_IsTrue                             = 88
  2357  	OP_JournalMode                        = 7
  2358  	OP_Jump                               = 16
  2359  	OP_Last                               = 33
  2360  	OP_Le                                 = 55
  2361  	OP_LoadAnalysis                       = 146
  2362  	OP_Lt                                 = 56
  2363  	OP_MakeRecord                         = 93
  2364  	OP_MaxPgcnt                           = 173
  2365  	OP_MemMax                             = 155
  2366  	OP_Move                               = 76
  2367  	OP_Multiply                           = 108
  2368  	OP_MustBeInt                          = 15
  2369  	OP_Ne                                 = 52
  2370  	OP_NewRowid                           = 123
  2371  	OP_Next                               = 5
  2372  	OP_NoConflict                         = 28
  2373  	OP_Noop                               = 177
  2374  	OP_Not                                = 19
  2375  	OP_NotExists                          = 32
  2376  	OP_NotFound                           = 29
  2377  	OP_NotNull                            = 51
  2378  	OP_Null                               = 72
  2379  	OP_NullRow                            = 132
  2380  	OP_Offset                             = 90
  2381  	OP_OffsetLimit                        = 156
  2382  	OP_Once                               = 17
  2383  	OP_OpenAutoindex                      = 101
  2384  	OP_OpenDup                            = 100
  2385  	OP_OpenEphemeral                      = 112
  2386  	OP_OpenPseudo                         = 117
  2387  	OP_OpenRead                           = 98
  2388  	OP_OpenWrite                          = 99
  2389  	OP_Or                                 = 43
  2390  	OP_Pagecount                          = 172
  2391  	OP_Param                              = 153
  2392  	OP_ParseSchema                        = 145
  2393  	OP_Permutation                        = 86
  2394  	OP_Prev                               = 4
  2395  	OP_Program                            = 46
  2396  	OP_PureFunc                           = 63
  2397  	OP_ReadCookie                         = 95
  2398  	OP_Real                               = 152
  2399  	OP_RealAffinity                       = 84
  2400  	OP_ReleaseReg                         = 176
  2401  	OP_Remainder                          = 110
  2402  	OP_ReopenIdx                          = 97
  2403  	OP_ResetCount                         = 127
  2404  	OP_ResetSorter                        = 142
  2405  	OP_ResultRow                          = 81
  2406  	OP_Return                             = 65
  2407  	OP_Rewind                             = 37
  2408  	OP_RowCell                            = 125
  2409  	OP_RowData                            = 130
  2410  	OP_RowSetAdd                          = 151
  2411  	OP_RowSetRead                         = 42
  2412  	OP_RowSetTest                         = 45
  2413  	OP_Rowid                              = 131
  2414  	OP_SCopy                              = 78
  2415  	OP_Savepoint                          = 0
  2416  	OP_SeekEnd                            = 133
  2417  	OP_SeekGE                             = 24
  2418  	OP_SeekGT                             = 25
  2419  	OP_SeekHit                            = 121
  2420  	OP_SeekLE                             = 23
  2421  	OP_SeekLT                             = 22
  2422  	OP_SeekRowid                          = 31
  2423  	OP_SeekScan                           = 120
  2424  	OP_Sequence                           = 122
  2425  	OP_SequenceTest                       = 115
  2426  	OP_SetCookie                          = 96
  2427  	OP_ShiftLeft                          = 104
  2428  	OP_ShiftRight                         = 105
  2429  	OP_SoftNull                           = 73
  2430  	OP_Sort                               = 36
  2431  	OP_SorterCompare                      = 128
  2432  	OP_SorterData                         = 129
  2433  	OP_SorterInsert                       = 135
  2434  	OP_SorterNext                         = 3
  2435  	OP_SorterOpen                         = 114
  2436  	OP_SorterSort                         = 35
  2437  	OP_SqlExec                            = 144
  2438  	OP_String                             = 71
  2439  	OP_String8                            = 116
  2440  	OP_Subtract                           = 107
  2441  	OP_TableLock                          = 165
  2442  	OP_Trace                              = 174
  2443  	OP_Transaction                        = 2
  2444  	OP_VBegin                             = 166
  2445  	OP_VColumn                            = 170
  2446  	OP_VCreate                            = 167
  2447  	OP_VDestroy                           = 168
  2448  	OP_VFilter                            = 9
  2449  	OP_VNext                              = 61
  2450  	OP_VOpen                              = 169
  2451  	OP_VRename                            = 171
  2452  	OP_VUpdate                            = 10
  2453  	OP_Vacuum                             = 8
  2454  	OP_Variable                           = 75
  2455  	OP_Yield                              = 14
  2456  	OP_ZeroOrNull                         = 89
  2457  	OS_VXWORKS                            = 0
  2458  	P4_ADVANCE                            = -5
  2459  	P4_COLLSEQ                            = -2
  2460  	P4_DYNAMIC                            = -7
  2461  	P4_DYNBLOB                            = -17
  2462  	P4_EXPR                               = -10
  2463  	P4_FREE_IF_LE                         = -7
  2464  	P4_FUNCCTX                            = -16
  2465  	P4_FUNCDEF                            = -8
  2466  	P4_INT32                              = -3
  2467  	P4_INT64                              = -14
  2468  	P4_INTARRAY                           = -15
  2469  	P4_KEYINFO                            = -9
  2470  	P4_MEM                                = -11
  2471  	P4_NOTUSED                            = 0
  2472  	P4_REAL                               = -13
  2473  	P4_STATIC                             = -1
  2474  	P4_SUBPROGRAM                         = -4
  2475  	P4_TABLE                              = -6
  2476  	P4_TRANSIENT                          = 0
  2477  	P4_VTAB                               = -12
  2478  	P5_ConstraintCheck                    = 3
  2479  	P5_ConstraintFK                       = 4
  2480  	P5_ConstraintNotNull                  = 1
  2481  	P5_ConstraintUnique                   = 2
  2482  	PACKAGE_BUGREPORT                     = ""
  2483  	PACKAGE_NAME                          = "sqlite"
  2484  	PACKAGE_STRING                        = "sqlite 3.36.0"
  2485  	PACKAGE_TARNAME                       = "sqlite"
  2486  	PAGER_CACHESPILL                      = 0x20
  2487  	PAGER_CKPT_FULLFSYNC                  = 0x10
  2488  	PAGER_FLAGS_MASK                      = 0x38
  2489  	PAGER_FULLFSYNC                       = 0x08
  2490  	PAGER_GET_NOCONTENT                   = 0x01
  2491  	PAGER_GET_READONLY                    = 0x02
  2492  	PAGER_JOURNALMODE_DELETE              = 0
  2493  	PAGER_JOURNALMODE_MEMORY              = 4
  2494  	PAGER_JOURNALMODE_OFF                 = 2
  2495  	PAGER_JOURNALMODE_PERSIST             = 1
  2496  	PAGER_JOURNALMODE_QUERY               = -1
  2497  	PAGER_JOURNALMODE_TRUNCATE            = 3
  2498  	PAGER_JOURNALMODE_WAL                 = 5
  2499  	PAGER_LOCKINGMODE_EXCLUSIVE           = 1
  2500  	PAGER_LOCKINGMODE_NORMAL              = 0
  2501  	PAGER_LOCKINGMODE_QUERY               = -1
  2502  	PAGER_MEMORY                          = 0x0002
  2503  	PAGER_OMIT_JOURNAL                    = 0x0001
  2504  	PAGER_SYNCHRONOUS_EXTRA               = 0x04
  2505  	PAGER_SYNCHRONOUS_FULL                = 0x03
  2506  	PAGER_SYNCHRONOUS_MASK                = 0x07
  2507  	PAGER_SYNCHRONOUS_NORMAL              = 0x02
  2508  	PAGER_SYNCHRONOUS_OFF                 = 0x01
  2509  	PARSE_MODE_DECLARE_VTAB               = 1
  2510  	PARSE_MODE_NORMAL                     = 0
  2511  	PARSE_MODE_RENAME                     = 2
  2512  	PARSE_MODE_UNMAP                      = 3
  2513  	PENDING_LOCK                          = 3
  2514  	PGHDR_CLEAN                           = 0x001
  2515  	PGHDR_DIRTY                           = 0x002
  2516  	PGHDR_DONT_WRITE                      = 0x010
  2517  	PGHDR_MMAP                            = 0x020
  2518  	PGHDR_NEED_SYNC                       = 0x008
  2519  	PGHDR_WAL_APPEND                      = 0x040
  2520  	PGHDR_WRITEABLE                       = 0x004
  2521  	PRIO_MAX                              = 20
  2522  	PRIO_MIN                              = -20
  2523  	PRIO_PGRP                             = 1
  2524  	PRIO_PROCESS                          = 0
  2525  	PRIO_USER                             = 2
  2526  	PRIX16                                = "X"
  2527  	PRIX32                                = "X"
  2528  	PRIX8                                 = "X"
  2529  	PRIXFAST16                            = "X"
  2530  	PRIXFAST32                            = "X"
  2531  	PRIXFAST8                             = "X"
  2532  	PRIXLEAST16                           = "X"
  2533  	PRIXLEAST32                           = "X"
  2534  	PRIXLEAST8                            = "X"
  2535  	PRIXMAX                               = "jX"
  2536  	PRId16                                = "d"
  2537  	PRId32                                = "d"
  2538  	PRId8                                 = "d"
  2539  	PRIdFAST16                            = "d"
  2540  	PRIdFAST32                            = "d"
  2541  	PRIdFAST8                             = "d"
  2542  	PRIdLEAST16                           = "d"
  2543  	PRIdLEAST32                           = "d"
  2544  	PRIdLEAST8                            = "d"
  2545  	PRIdMAX                               = "jd"
  2546  	PRIi16                                = "i"
  2547  	PRIi32                                = "i"
  2548  	PRIi8                                 = "i"
  2549  	PRIiFAST16                            = "i"
  2550  	PRIiFAST32                            = "i"
  2551  	PRIiFAST8                             = "i"
  2552  	PRIiLEAST16                           = "i"
  2553  	PRIiLEAST32                           = "i"
  2554  	PRIiLEAST8                            = "i"
  2555  	PRIiMAX                               = "ji"
  2556  	PRIo16                                = "o"
  2557  	PRIo32                                = "o"
  2558  	PRIo8                                 = "o"
  2559  	PRIoFAST16                            = "o"
  2560  	PRIoFAST32                            = "o"
  2561  	PRIoFAST8                             = "o"
  2562  	PRIoLEAST16                           = "o"
  2563  	PRIoLEAST32                           = "o"
  2564  	PRIoLEAST8                            = "o"
  2565  	PRIoMAX                               = "jo"
  2566  	PRIu16                                = "u"
  2567  	PRIu32                                = "u"
  2568  	PRIu8                                 = "u"
  2569  	PRIuFAST16                            = "u"
  2570  	PRIuFAST32                            = "u"
  2571  	PRIuFAST8                             = "u"
  2572  	PRIuLEAST16                           = "u"
  2573  	PRIuLEAST32                           = "u"
  2574  	PRIuLEAST8                            = "u"
  2575  	PRIuMAX                               = "ju"
  2576  	PRIx16                                = "x"
  2577  	PRIx32                                = "x"
  2578  	PRIx8                                 = "x"
  2579  	PRIxFAST16                            = "x"
  2580  	PRIxFAST32                            = "x"
  2581  	PRIxFAST8                             = "x"
  2582  	PRIxLEAST16                           = "x"
  2583  	PRIxLEAST32                           = "x"
  2584  	PRIxLEAST8                            = "x"
  2585  	PRIxMAX                               = "jx"
  2586  	PTRDIFF_MAX                           = 9223372036854775807
  2587  	PTRDIFF_MIN                           = -9223372036854775808
  2588  	RESERVED_LOCK                         = 2
  2589  	RLIMIT_AS                             = 10
  2590  	RLIMIT_CORE                           = 4
  2591  	RLIMIT_CPU                            = 0
  2592  	RLIMIT_DATA                           = 2
  2593  	RLIMIT_FSIZE                          = 1
  2594  	RLIMIT_KQUEUES                        = 13
  2595  	RLIMIT_MEMLOCK                        = 6
  2596  	RLIMIT_NOFILE                         = 8
  2597  	RLIMIT_NPROC                          = 7
  2598  	RLIMIT_NPTS                           = 11
  2599  	RLIMIT_RSS                            = 5
  2600  	RLIMIT_SBSIZE                         = 9
  2601  	RLIMIT_STACK                          = 3
  2602  	RLIMIT_SWAP                           = 12
  2603  	RLIMIT_UMTXP                          = 14
  2604  	RLIMIT_VMEM                           = 10
  2605  	RLIM_NLIMITS                          = 15
  2606  	RSIZE_MAX                             = 9223372036854775807
  2607  	RUSAGE_CHILDREN                       = -1
  2608  	RUSAGE_SELF                           = 0
  2609  	RUSAGE_THREAD                         = 1
  2610  	SAVEPOINT_BEGIN                       = 0
  2611  	SAVEPOINT_RELEASE                     = 1
  2612  	SAVEPOINT_ROLLBACK                    = 2
  2613  	SCHEMA_ROOT                           = 1
  2614  	SCNd16                                = "hd"
  2615  	SCNd32                                = "d"
  2616  	SCNd8                                 = "hhd"
  2617  	SCNdFAST16                            = "d"
  2618  	SCNdFAST32                            = "d"
  2619  	SCNdFAST8                             = "d"
  2620  	SCNdLEAST16                           = "hd"
  2621  	SCNdLEAST32                           = "d"
  2622  	SCNdLEAST8                            = "hhd"
  2623  	SCNdMAX                               = "jd"
  2624  	SCNi16                                = "hi"
  2625  	SCNi32                                = "i"
  2626  	SCNi8                                 = "hhi"
  2627  	SCNiFAST16                            = "i"
  2628  	SCNiFAST32                            = "i"
  2629  	SCNiFAST8                             = "i"
  2630  	SCNiLEAST16                           = "hi"
  2631  	SCNiLEAST32                           = "i"
  2632  	SCNiLEAST8                            = "hhi"
  2633  	SCNiMAX                               = "ji"
  2634  	SCNo16                                = "ho"
  2635  	SCNo32                                = "o"
  2636  	SCNo8                                 = "hho"
  2637  	SCNoFAST16                            = "o"
  2638  	SCNoFAST32                            = "o"
  2639  	SCNoFAST8                             = "o"
  2640  	SCNoLEAST16                           = "ho"
  2641  	SCNoLEAST32                           = "o"
  2642  	SCNoLEAST8                            = "hho"
  2643  	SCNoMAX                               = "jo"
  2644  	SCNu16                                = "hu"
  2645  	SCNu32                                = "u"
  2646  	SCNu8                                 = "hhu"
  2647  	SCNuFAST16                            = "u"
  2648  	SCNuFAST32                            = "u"
  2649  	SCNuFAST8                             = "u"
  2650  	SCNuLEAST16                           = "hu"
  2651  	SCNuLEAST32                           = "u"
  2652  	SCNuLEAST8                            = "hhu"
  2653  	SCNuMAX                               = "ju"
  2654  	SCNx16                                = "hx"
  2655  	SCNx32                                = "x"
  2656  	SCNx8                                 = "hhx"
  2657  	SCNxFAST16                            = "x"
  2658  	SCNxFAST32                            = "x"
  2659  	SCNxFAST8                             = "x"
  2660  	SCNxLEAST16                           = "hx"
  2661  	SCNxLEAST32                           = "x"
  2662  	SCNxLEAST8                            = "hhx"
  2663  	SCNxMAX                               = "jx"
  2664  	SELECTTRACE_ENABLED                   = 0
  2665  	SF_Aggregate                          = 0x0000008
  2666  	SF_All                                = 0x0000002
  2667  	SF_ComplexResult                      = 0x0040000
  2668  	SF_Compound                           = 0x0000100
  2669  	SF_Converted                          = 0x0010000
  2670  	SF_CopyCte                            = 0x4000000
  2671  	SF_Distinct                           = 0x0000001
  2672  	SF_Expanded                           = 0x0000040
  2673  	SF_FixedLimit                         = 0x0004000
  2674  	SF_HasAgg                             = 0x0000010
  2675  	SF_HasTypeInfo                        = 0x0000080
  2676  	SF_IncludeHidden                      = 0x0020000
  2677  	SF_MaybeConvert                       = 0x0008000
  2678  	SF_MinMaxAgg                          = 0x0001000
  2679  	SF_MultiPart                          = 0x2000000
  2680  	SF_MultiValue                         = 0x0000400
  2681  	SF_NestedFrom                         = 0x0000800
  2682  	SF_NoopOrderBy                        = 0x0400000
  2683  	SF_PushDown                           = 0x1000000
  2684  	SF_Recursive                          = 0x0002000
  2685  	SF_Resolved                           = 0x0000004
  2686  	SF_UpdateFrom                         = 0x0800000
  2687  	SF_UsesEphemeral                      = 0x0000020
  2688  	SF_Values                             = 0x0000200
  2689  	SF_View                               = 0x0200000
  2690  	SF_WhereBegin                         = 0x0080000
  2691  	SF_WinRewrite                         = 0x0100000
  2692  	SHARED_LOCK                           = 1
  2693  	SHARED_SIZE                           = 510
  2694  	SIG_ATOMIC_MAX                        = 9223372036854775807
  2695  	SIG_ATOMIC_MIN                        = -9223372036854775808
  2696  	SIZE_MAX                              = 18446744073709551615
  2697  	SQLITECONFIG_H                        = 1
  2698  	SQLITEINT_H                           = 0
  2699  	SQLITE_AFF_BLOB                       = 0x41
  2700  	SQLITE_AFF_INTEGER                    = 0x44
  2701  	SQLITE_AFF_MASK                       = 0x47
  2702  	SQLITE_AFF_NONE                       = 0x40
  2703  	SQLITE_AFF_NUMERIC                    = 0x43
  2704  	SQLITE_AFF_REAL                       = 0x45
  2705  	SQLITE_AFF_TEXT                       = 0x42
  2706  	SQLITE_ASCII                          = 1
  2707  	SQLITE_AllOpts                        = 0xffffffff
  2708  	SQLITE_AutoIndex                      = 0x00008000
  2709  	SQLITE_BIGENDIAN                      = 0
  2710  	SQLITE_BIG_DBL                        = 0
  2711  	SQLITE_BTREE_H                        = 0
  2712  	SQLITE_BYTEORDER                      = 1234
  2713  	SQLITE_CacheSpill                     = 0x00000020
  2714  	SQLITE_CellSizeCk                     = 0x00200000
  2715  	SQLITE_CkptFullFSync                  = 0x00000010
  2716  	SQLITE_CountOfView                    = 0x00000200
  2717  	SQLITE_CoverIdxScan                   = 0x00000020
  2718  	SQLITE_CursorHints                    = 0x00000400
  2719  	SQLITE_DEFAULT_AUTOVACUUM             = 0
  2720  	SQLITE_DEFAULT_CACHE_SIZE             = -2000
  2721  	SQLITE_DEFAULT_FILE_FORMAT            = 4
  2722  	SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT     = -1
  2723  	SQLITE_DEFAULT_MMAP_SIZE              = 0
  2724  	SQLITE_DEFAULT_PCACHE_INITSZ          = 20
  2725  	SQLITE_DEFAULT_RECURSIVE_TRIGGERS     = 0
  2726  	SQLITE_DEFAULT_SECTOR_SIZE            = 4096
  2727  	SQLITE_DEFAULT_SORTERREF_SIZE         = 0x7fffffff
  2728  	SQLITE_DEFAULT_SYNCHRONOUS            = 2
  2729  	SQLITE_DEFAULT_WAL_AUTOCHECKPOINT     = 1000
  2730  	SQLITE_DEFAULT_WAL_SYNCHRONOUS        = 2
  2731  	SQLITE_DEFAULT_WORKER_THREADS         = 0
  2732  	SQLITE_Defensive                      = 0x10000000
  2733  	SQLITE_DeferFKs                       = 0x00080000
  2734  	SQLITE_DistinctOpt                    = 0x00000010
  2735  	SQLITE_DqsDDL                         = 0x20000000
  2736  	SQLITE_DqsDML                         = 0x40000000
  2737  	SQLITE_ECEL_DUP                       = 0x01
  2738  	SQLITE_ECEL_FACTOR                    = 0x02
  2739  	SQLITE_ECEL_OMITREF                   = 0x08
  2740  	SQLITE_ECEL_REF                       = 0x04
  2741  	SQLITE_ENABLE_LOCKING_STYLE           = 0
  2742  	SQLITE_EnableQPSG                     = 0x00800000
  2743  	SQLITE_EnableTrigger                  = 0x00040000
  2744  	SQLITE_EnableView                     = 0x80000000
  2745  	SQLITE_FAULTINJECTOR_COUNT            = 1
  2746  	SQLITE_FAULTINJECTOR_MALLOC           = 0
  2747  	SQLITE_FCNTL_DB_UNCHANGED             = 0xca093fa0
  2748  	SQLITE_FRAME_MAGIC                    = 0x879fb71e
  2749  	SQLITE_FUNC_CASE                      = 0x0008
  2750  	SQLITE_FUNC_CONSTANT                  = 0x0800
  2751  	SQLITE_FUNC_COUNT                     = 0x0100
  2752  	SQLITE_FUNC_DIRECT                    = 0x00080000
  2753  	SQLITE_FUNC_ENCMASK                   = 0x0003
  2754  	SQLITE_FUNC_EPHEM                     = 0x0010
  2755  	SQLITE_FUNC_HASH_SZ                   = 23
  2756  	SQLITE_FUNC_INLINE                    = 0x00400000
  2757  	SQLITE_FUNC_INTERNAL                  = 0x00040000
  2758  	SQLITE_FUNC_LENGTH                    = 0x0040
  2759  	SQLITE_FUNC_LIKE                      = 0x0004
  2760  	SQLITE_FUNC_MINMAX                    = 0x1000
  2761  	SQLITE_FUNC_NEEDCOLL                  = 0x0020
  2762  	SQLITE_FUNC_OFFSET                    = 0x8000
  2763  	SQLITE_FUNC_SLOCHNG                   = 0x2000
  2764  	SQLITE_FUNC_SUBTYPE                   = 0x00100000
  2765  	SQLITE_FUNC_TEST                      = 0x4000
  2766  	SQLITE_FUNC_TYPEOF                    = 0x0080
  2767  	SQLITE_FUNC_UNLIKELY                  = 0x0400
  2768  	SQLITE_FUNC_UNSAFE                    = 0x00200000
  2769  	SQLITE_FUNC_WINDOW                    = 0x00010000
  2770  	SQLITE_FactorOutConst                 = 0x00000008
  2771  	SQLITE_ForeignKeys                    = 0x00004000
  2772  	SQLITE_Fts3Tokenizer                  = 0x00400000
  2773  	SQLITE_FullColNames                   = 0x00000004
  2774  	SQLITE_FullFSync                      = 0x00000008
  2775  	SQLITE_GroupByOrder                   = 0x00000004
  2776  	SQLITE_HASH_H                         = 0
  2777  	SQLITE_HAVE_C99_MATH_FUNCS            = 1
  2778  	SQLITE_HAVE_OS_TRACE                  = 0
  2779  	SQLITE_IDXTYPE_APPDEF                 = 0
  2780  	SQLITE_IDXTYPE_IPK                    = 3
  2781  	SQLITE_IDXTYPE_PRIMARYKEY             = 2
  2782  	SQLITE_IDXTYPE_UNIQUE                 = 1
  2783  	SQLITE_IOERR_NOMEM_BKPT               = 3082
  2784  	SQLITE_IgnoreChecks                   = 0x00000200
  2785  	SQLITE_JUMPIFNULL                     = 0x10
  2786  	SQLITE_LITTLEENDIAN                   = 1
  2787  	SQLITE_LegacyAlter                    = 0x04000000
  2788  	SQLITE_LegacyFileFmt                  = 0x00000002
  2789  	SQLITE_LoadExtFunc                    = 0x00020000
  2790  	SQLITE_LoadExtension                  = 0x00010000
  2791  	SQLITE_MAGIC_BUSY                     = 0xf03b7906
  2792  	SQLITE_MAGIC_CLOSED                   = 0x9f3c2d33
  2793  	SQLITE_MAGIC_ERROR                    = 0xb5357930
  2794  	SQLITE_MAGIC_OPEN                     = 0xa029a697
  2795  	SQLITE_MAGIC_SICK                     = 0x4b771290
  2796  	SQLITE_MAGIC_ZOMBIE                   = 0x64cffc7f
  2797  	SQLITE_MALLOC_SOFT_LIMIT              = 1024
  2798  	SQLITE_MAX_ATTACHED                   = 10
  2799  	SQLITE_MAX_COLUMN                     = 2000
  2800  	SQLITE_MAX_COMPOUND_SELECT            = 500
  2801  	SQLITE_MAX_DB                         = 12
  2802  	SQLITE_MAX_DEFAULT_PAGE_SIZE          = 8192
  2803  	SQLITE_MAX_EXPR_DEPTH                 = 1000
  2804  	SQLITE_MAX_FILE_FORMAT                = 4
  2805  	SQLITE_MAX_FUNCTION_ARG               = 127
  2806  	SQLITE_MAX_LENGTH                     = 1000000000
  2807  	SQLITE_MAX_LIKE_PATTERN_LENGTH        = 50000
  2808  	SQLITE_MAX_MMAP_SIZE                  = 0x7fff0000
  2809  	SQLITE_MAX_PAGE_COUNT                 = 1073741823
  2810  	SQLITE_MAX_PAGE_SIZE                  = 65536
  2811  	SQLITE_MAX_PATHLEN                    = 1024
  2812  	SQLITE_MAX_SCHEMA_RETRY               = 50
  2813  	SQLITE_MAX_SQL_LENGTH                 = 1000000000
  2814  	SQLITE_MAX_TRIGGER_DEPTH              = 1000
  2815  	SQLITE_MAX_VARIABLE_NUMBER            = 32766
  2816  	SQLITE_MAX_VDBE_OP                    = 250000000
  2817  	SQLITE_MAX_WORKER_THREADS             = 8
  2818  	SQLITE_MSVC_H                         = 0
  2819  	SQLITE_MX_JUMP_OPCODE                 = 62
  2820  	SQLITE_MinMaxOpt                      = 0x00010000
  2821  	SQLITE_NEED_ERR_NAME                  = 0
  2822  	SQLITE_NOMEM_BKPT                     = 7
  2823  	SQLITE_NOTNULL                        = 0x90
  2824  	SQLITE_NTUNE                          = 6
  2825  	SQLITE_NULLEQ                         = 0x80
  2826  	SQLITE_N_BTREE_META                   = 16
  2827  	SQLITE_N_LIMIT                        = 12
  2828  	SQLITE_NoCkptOnClose                  = 0x00000800
  2829  	SQLITE_NoSchemaError                  = 0x08000000
  2830  	SQLITE_NullCallback                   = 0x00000100
  2831  	SQLITE_OS_OTHER                       = 0
  2832  	SQLITE_OS_SETUP_H                     = 0
  2833  	SQLITE_OS_UNIX                        = 1
  2834  	SQLITE_OS_WIN                         = 0
  2835  	SQLITE_OmitNoopJoin                   = 0x00000100
  2836  	SQLITE_OrderByIdxJoin                 = 0x00000040
  2837  	SQLITE_PAGER_H                        = 0
  2838  	SQLITE_POWERSAFE_OVERWRITE            = 1
  2839  	SQLITE_PREPARE_MASK                   = 0x0f
  2840  	SQLITE_PREPARE_SAVESQL                = 0x80
  2841  	SQLITE_PRINTF_INTERNAL                = 0x01
  2842  	SQLITE_PRINTF_MALLOCED                = 0x04
  2843  	SQLITE_PRINTF_SQLFUNC                 = 0x02
  2844  	SQLITE_PTRSIZE                        = 8
  2845  	SQLITE_PropagateConst                 = 0x00008000
  2846  	SQLITE_PushDown                       = 0x00001000
  2847  	SQLITE_QueryFlattener                 = 0x00000001
  2848  	SQLITE_QueryOnly                      = 0x00100000
  2849  	SQLITE_ReadUncommit                   = 0x00000400
  2850  	SQLITE_RecTriggers                    = 0x00002000
  2851  	SQLITE_ResetDatabase                  = 0x02000000
  2852  	SQLITE_ReverseOrder                   = 0x00001000
  2853  	SQLITE_SO_ASC                         = 0
  2854  	SQLITE_SO_DESC                        = 1
  2855  	SQLITE_SO_UNDEFINED                   = -1
  2856  	SQLITE_SYSTEM_MALLOC                  = 1
  2857  	SQLITE_SeekScan                       = 0x00020000
  2858  	SQLITE_ShortColNames                  = 0x00000040
  2859  	SQLITE_SimplifyJoin                   = 0x00002000
  2860  	SQLITE_SkipScan                       = 0x00004000
  2861  	SQLITE_Stat4                          = 0x00000800
  2862  	SQLITE_TEMP_FILE_PREFIX               = "etilqs_"
  2863  	SQLITE_TOKEN_KEYWORD                  = 0x2
  2864  	SQLITE_TOKEN_QUOTED                   = 0x1
  2865  	SQLITE_TRACE_LEGACY                   = 0x40
  2866  	SQLITE_TRACE_NONLEGACY_MASK           = 0x0f
  2867  	SQLITE_TRACE_XPROFILE                 = 0x80
  2868  	SQLITE_Transitive                     = 0x00000080
  2869  	SQLITE_TriggerEQP                     = 0x01000000
  2870  	SQLITE_TrustedSchema                  = 0x00000080
  2871  	SQLITE_UTF16NATIVE                    = 2
  2872  	SQLITE_VDBEINT_H                      = 0
  2873  	SQLITE_VDBE_H                         = 0
  2874  	SQLITE_VTABRISK_High                  = 2
  2875  	SQLITE_VTABRISK_Low                   = 0
  2876  	SQLITE_VTABRISK_Normal                = 1
  2877  	SQLITE_WSD                            = 0
  2878  	SQLITE_WindowFunc                     = 0x00000002
  2879  	SQLITE_WriteSchema                    = 0x00000001
  2880  	SRT_Coroutine                         = 13
  2881  	SRT_Discard                           = 4
  2882  	SRT_DistFifo                          = 5
  2883  	SRT_DistQueue                         = 6
  2884  	SRT_EphemTab                          = 12
  2885  	SRT_Except                            = 2
  2886  	SRT_Exists                            = 3
  2887  	SRT_Fifo                              = 8
  2888  	SRT_Mem                               = 10
  2889  	SRT_Output                            = 9
  2890  	SRT_Queue                             = 7
  2891  	SRT_Set                               = 11
  2892  	SRT_Table                             = 14
  2893  	SRT_Union                             = 1
  2894  	SRT_Upfrom                            = 15
  2895  	STDC_HEADERS                          = 1
  2896  	TF_Autoincrement                      = 0x0008
  2897  	TF_Ephemeral                          = 0x4000
  2898  	TF_Eponymous                          = 0x8000
  2899  	TF_HasGenerated                       = 0x0060
  2900  	TF_HasHidden                          = 0x0002
  2901  	TF_HasNotNull                         = 0x0800
  2902  	TF_HasPrimaryKey                      = 0x0004
  2903  	TF_HasStat1                           = 0x0010
  2904  	TF_HasStat4                           = 0x2000
  2905  	TF_HasStored                          = 0x0040
  2906  	TF_HasVirtual                         = 0x0020
  2907  	TF_NoVisibleRowid                     = 0x0200
  2908  	TF_OOOHidden                          = 0x0400
  2909  	TF_Readonly                           = 0x0001
  2910  	TF_Shadow                             = 0x1000
  2911  	TF_StatsUsed                          = 0x0100
  2912  	TF_WithoutRowid                       = 0x0080
  2913  	TK_ABORT                              = 27
  2914  	TK_ACTION                             = 28
  2915  	TK_ADD                                = 162
  2916  	TK_AFTER                              = 29
  2917  	TK_AGG_COLUMN                         = 168
  2918  	TK_AGG_FUNCTION                       = 167
  2919  	TK_ALL                                = 134
  2920  	TK_ALTER                              = 161
  2921  	TK_ALWAYS                             = 96
  2922  	TK_ANALYZE                            = 30
  2923  	TK_AND                                = 44
  2924  	TK_ANY                                = 101
  2925  	TK_AS                                 = 24
  2926  	TK_ASC                                = 31
  2927  	TK_ASTERISK                           = 179
  2928  	TK_ATTACH                             = 32
  2929  	TK_AUTOINCR                           = 125
  2930  	TK_BEFORE                             = 33
  2931  	TK_BEGIN                              = 5
  2932  	TK_BETWEEN                            = 48
  2933  	TK_BY                                 = 34
  2934  	TK_CASCADE                            = 35
  2935  	TK_CASE                               = 156
  2936  	TK_CAST                               = 36
  2937  	TK_CHECK                              = 123
  2938  	TK_COLLATE                            = 112
  2939  	TK_COLUMN                             = 166
  2940  	TK_COLUMNKW                           = 60
  2941  	TK_COMMIT                             = 10
  2942  	TK_CONFLICT                           = 37
  2943  	TK_CONSTRAINT                         = 118
  2944  	TK_CREATE                             = 17
  2945  	TK_CTIME_KW                           = 100
  2946  	TK_CURRENT                            = 85
  2947  	TK_DATABASE                           = 38
  2948  	TK_DEFAULT                            = 119
  2949  	TK_DEFERRABLE                         = 130
  2950  	TK_DEFERRED                           = 7
  2951  	TK_DELETE                             = 127
  2952  	TK_DESC                               = 39
  2953  	TK_DETACH                             = 40
  2954  	TK_DISTINCT                           = 139
  2955  	TK_DO                                 = 61
  2956  	TK_DROP                               = 132
  2957  	TK_EACH                               = 41
  2958  	TK_ELSE                               = 159
  2959  	TK_END                                = 11
  2960  	TK_ESCAPE                             = 58
  2961  	TK_EXCEPT                             = 135
  2962  	TK_EXCLUDE                            = 91
  2963  	TK_EXCLUSIVE                          = 9
  2964  	TK_EXISTS                             = 20
  2965  	TK_EXPLAIN                            = 2
  2966  	TK_FAIL                               = 42
  2967  	TK_FILTER                             = 165
  2968  	TK_FIRST                              = 83
  2969  	TK_FOLLOWING                          = 86
  2970  	TK_FOR                                = 62
  2971  	TK_FOREIGN                            = 131
  2972  	TK_FROM                               = 141
  2973  	TK_FUNCTION                           = 171
  2974  	TK_GENERATED                          = 95
  2975  	TK_GROUP                              = 145
  2976  	TK_GROUPS                             = 92
  2977  	TK_HAVING                             = 146
  2978  	TK_IF                                 = 18
  2979  	TK_IF_NULL_ROW                        = 178
  2980  	TK_IGNORE                             = 63
  2981  	TK_IMMEDIATE                          = 8
  2982  	TK_IN                                 = 49
  2983  	TK_INDEX                              = 160
  2984  	TK_INDEXED                            = 115
  2985  	TK_INITIALLY                          = 64
  2986  	TK_INSERT                             = 126
  2987  	TK_INSTEAD                            = 65
  2988  	TK_INTERSECT                          = 136
  2989  	TK_INTO                               = 150
  2990  	TK_IS                                 = 45
  2991  	TK_ISNOT                              = 170
  2992  	TK_ISNULL                             = 50
  2993  	TK_JOIN                               = 142
  2994  	TK_JOIN_KW                            = 117
  2995  	TK_KEY                                = 67
  2996  	TK_LAST                               = 84
  2997  	TK_LIKE_KW                            = 47
  2998  	TK_LIMIT                              = 147
  2999  	TK_MATCH                              = 46
  3000  	TK_MATERIALIZED                       = 97
  3001  	TK_NO                                 = 66
  3002  	TK_NOT                                = 19
  3003  	TK_NOTHING                            = 151
  3004  	TK_NOTNULL                            = 51
  3005  	TK_NULL                               = 120
  3006  	TK_NULLS                              = 82
  3007  	TK_OF                                 = 68
  3008  	TK_OFFSET                             = 69
  3009  	TK_ON                                 = 114
  3010  	TK_OR                                 = 43
  3011  	TK_ORDER                              = 144
  3012  	TK_OTHERS                             = 93
  3013  	TK_OVER                               = 164
  3014  	TK_PARTITION                          = 87
  3015  	TK_PLAN                               = 4
  3016  	TK_PRAGMA                             = 70
  3017  	TK_PRECEDING                          = 88
  3018  	TK_PRIMARY                            = 121
  3019  	TK_QUERY                              = 3
  3020  	TK_RAISE                              = 71
  3021  	TK_RANGE                              = 89
  3022  	TK_RECURSIVE                          = 72
  3023  	TK_REFERENCES                         = 124
  3024  	TK_REGISTER                           = 175
  3025  	TK_REINDEX                            = 98
  3026  	TK_RELEASE                            = 14
  3027  	TK_RENAME                             = 99
  3028  	TK_REPLACE                            = 73
  3029  	TK_RESTRICT                           = 74
  3030  	TK_RETURNING                          = 149
  3031  	TK_ROLLBACK                           = 12
  3032  	TK_ROW                                = 75
  3033  	TK_ROWS                               = 76
  3034  	TK_SAVEPOINT                          = 13
  3035  	TK_SELECT                             = 137
  3036  	TK_SELECT_COLUMN                      = 177
  3037  	TK_SET                                = 129
  3038  	TK_SPAN                               = 180
  3039  	TK_TABLE                              = 16
  3040  	TK_TEMP                               = 21
  3041  	TK_THEN                               = 158
  3042  	TK_TIES                               = 94
  3043  	TK_TO                                 = 15
  3044  	TK_TRANSACTION                        = 6
  3045  	TK_TRIGGER                            = 77
  3046  	TK_TRUEFALSE                          = 169
  3047  	TK_TRUTH                              = 174
  3048  	TK_UMINUS                             = 172
  3049  	TK_UNBOUNDED                          = 90
  3050  	TK_UNION                              = 133
  3051  	TK_UNIQUE                             = 122
  3052  	TK_UPDATE                             = 128
  3053  	TK_UPLUS                              = 173
  3054  	TK_USING                              = 143
  3055  	TK_VACUUM                             = 78
  3056  	TK_VALUES                             = 138
  3057  	TK_VECTOR                             = 176
  3058  	TK_VIEW                               = 79
  3059  	TK_VIRTUAL                            = 80
  3060  	TK_WHEN                               = 157
  3061  	TK_WHERE                              = 148
  3062  	TK_WINDOW                             = 163
  3063  	TK_WITH                               = 81
  3064  	TK_WITHOUT                            = 25
  3065  	TRIGGER_AFTER                         = 2
  3066  	TRIGGER_BEFORE                        = 1
  3067  	UINT16_MAX                            = 0xffff
  3068  	UINT32_MAX                            = 0xffffffff
  3069  	UINT64_MAX                            = 0xffffffffffffffff
  3070  	UINT8_MAX                             = 0xff
  3071  	UINTMAX_MAX                           = 18446744073709551615
  3072  	UINTPTR_MAX                           = 18446744073709551615
  3073  	UINT_FAST16_MAX                       = 4294967295
  3074  	UINT_FAST32_MAX                       = 4294967295
  3075  	UINT_FAST64_MAX                       = 18446744073709551615
  3076  	UINT_FAST8_MAX                        = 4294967295
  3077  	UINT_LEAST16_MAX                      = 65535
  3078  	UINT_LEAST32_MAX                      = 4294967295
  3079  	UINT_LEAST64_MAX                      = 18446744073709551615
  3080  	UINT_LEAST8_MAX                       = 255
  3081  	VDBE_DISPLAY_P4                       = 1
  3082  	VDBE_MAGIC_DEAD                       = 0x5606c3c8
  3083  	VDBE_MAGIC_HALT                       = 0x319c2973
  3084  	VDBE_MAGIC_INIT                       = 0x16bceaa5
  3085  	VDBE_MAGIC_RESET                      = 0x48fa9f76
  3086  	VDBE_MAGIC_RUN                        = 0x2df20da3
  3087  	WCHAR_MAX                             = 2147483647
  3088  	WCHAR_MIN                             = -2147483648
  3089  	WHERE_AGG_DISTINCT                    = 0x0400
  3090  	WHERE_DISTINCTBY                      = 0x0080
  3091  	WHERE_DISTINCT_NOOP                   = 0
  3092  	WHERE_DISTINCT_ORDERED                = 2
  3093  	WHERE_DISTINCT_UNIQUE                 = 1
  3094  	WHERE_DISTINCT_UNORDERED              = 3
  3095  	WHERE_DUPLICATES_OK                   = 0x0010
  3096  	WHERE_GROUPBY                         = 0x0040
  3097  	WHERE_ONEPASS_DESIRED                 = 0x0004
  3098  	WHERE_ONEPASS_MULTIROW                = 0x0008
  3099  	WHERE_ORDERBY_LIMIT                   = 0x0800
  3100  	WHERE_ORDERBY_MAX                     = 0x0002
  3101  	WHERE_ORDERBY_MIN                     = 0x0001
  3102  	WHERE_ORDERBY_NORMAL                  = 0x0000
  3103  	WHERE_OR_SUBCLAUSE                    = 0x0020
  3104  	WHERE_SORTBYGROUP                     = 0x0200
  3105  	WHERE_USE_LIMIT                       = 0x4000
  3106  	WHERE_WANT_DISTINCT                   = 0x0100
  3107  	WINT_MAX                              = 2147483647
  3108  	WINT_MIN                              = -2147483648
  3109  	WRC_Abort                             = 2
  3110  	WRC_Continue                          = 0
  3111  	WRC_Prune                             = 1
  3112  	XN_EXPR                               = -2
  3113  	XN_ROWID                              = -1
  3114  	X_GCC_WRAP_STDINT_H                   = 0
  3115  	X_GNU_SOURCE                          = 0
  3116  	X_INTTYPES_H_                         = 0
  3117  	X_LARGEFILE_SOURCE                    = 1
  3118  	X_LARGE_FILE                          = 1
  3119  	X_MACHINE_INTTYPES_H_                 = 0
  3120  	X_MACHINE__STDINT_H_                  = 0
  3121  	X_SQLITE_OS_H_                        = 0
  3122  	X_SYS_RESOURCE_H_                     = 0
  3123  	X_SYS_STDINT_H_                       = 0
  3124  	X_XOPEN_SOURCE                        = 600
  3125  	BTCF_AtLast                           = 0x08
  3126  	BTCF_Incrblob                         = 0x10
  3127  	BTCF_Multiple                         = 0x20
  3128  	BTCF_Pinned                           = 0x40
  3129  	BTCF_ValidNKey                        = 0x02
  3130  	BTCF_ValidOvfl                        = 0x04
  3131  	BTCF_WriteFlag                        = 0x01
  3132  	BTCURSOR_MAX_DEPTH                    = 20
  3133  	BTS_EXCLUSIVE                         = 0x0040
  3134  	BTS_FAST_SECURE                       = 0x000c
  3135  	BTS_INITIALLY_EMPTY                   = 0x0010
  3136  	BTS_NO_WAL                            = 0x0020
  3137  	BTS_OVERWRITE                         = 0x0008
  3138  	BTS_PAGESIZE_FIXED                    = 0x0002
  3139  	BTS_PENDING                           = 0x0080
  3140  	BTS_READ_ONLY                         = 0x0001
  3141  	BTS_SECURE_DELETE                     = 0x0004
  3142  	CURSOR_FAULT                          = 4
  3143  	CURSOR_INVALID                        = 1
  3144  	CURSOR_REQUIRESEEK                    = 3
  3145  	CURSOR_SKIPNEXT                       = 2
  3146  	CURSOR_VALID                          = 0
  3147  	PTF_INTKEY                            = 0x01
  3148  	PTF_LEAF                              = 0x08
  3149  	PTF_LEAFDATA                          = 0x04
  3150  	PTF_ZERODATA                          = 0x02
  3151  	PTRMAP_BTREE                          = 5
  3152  	PTRMAP_FREEPAGE                       = 2
  3153  	PTRMAP_OVERFLOW1                      = 3
  3154  	PTRMAP_OVERFLOW2                      = 4
  3155  	PTRMAP_ROOTPAGE                       = 1
  3156  	READ_LOCK                             = 1
  3157  	SQLITE_FILE_HEADER                    = "SQLite format 3"
  3158  	TRANS_NONE                            = 0
  3159  	TRANS_READ                            = 1
  3160  	TRANS_WRITE                           = 2
  3161  	WRITE_LOCK                            = 2
  3162  	N_THREAD                              = 26
  3163  	PTHREAD_BARRIER_SERIAL_THREAD         = -1
  3164  	PTHREAD_CANCEL_ASYNCHRONOUS           = 2
  3165  	PTHREAD_CANCEL_DEFERRED               = 0
  3166  	PTHREAD_CANCEL_DISABLE                = 1
  3167  	PTHREAD_CANCEL_ENABLE                 = 0
  3168  	PTHREAD_CREATE_DETACHED               = 1
  3169  	PTHREAD_CREATE_JOINABLE               = 0
  3170  	PTHREAD_DESTRUCTOR_ITERATIONS         = 4
  3171  	PTHREAD_DETACHED                      = 0x1
  3172  	PTHREAD_DONE_INIT                     = 1
  3173  	PTHREAD_EXPLICIT_SCHED                = 0
  3174  	PTHREAD_INHERIT_SCHED                 = 0x4
  3175  	PTHREAD_KEYS_MAX                      = 256
  3176  	PTHREAD_MUTEX_ROBUST                  = 1
  3177  	PTHREAD_MUTEX_STALLED                 = 0
  3178  	PTHREAD_NEEDS_INIT                    = 0
  3179  	PTHREAD_NOFLOAT                       = 0x8
  3180  	PTHREAD_PRIO_INHERIT                  = 1
  3181  	PTHREAD_PRIO_NONE                     = 0
  3182  	PTHREAD_PRIO_PROTECT                  = 2
  3183  	PTHREAD_PROCESS_PRIVATE               = 0
  3184  	PTHREAD_PROCESS_SHARED                = 1
  3185  	PTHREAD_SCOPE_PROCESS                 = 0
  3186  	PTHREAD_SCOPE_SYSTEM                  = 0x2
  3187  	PTHREAD_STACK_MIN                     = 2048
  3188  	PTHREAD_THREADS_MAX                   = 18446744073709551615
  3189  	SCHED_FIFO                            = 1
  3190  	SCHED_OTHER                           = 2
  3191  	SCHED_RR                              = 3
  3192  	X_PTHREAD_H_                          = 0
  3193  	X_SCHED_H_                            = 0
  3194  	TCL_THREADS                           = 0
  3195  	MX_CHUNK_NUMBER                       = 299
  3196  	SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET   = 400
  3197  	SQLITE_MULTIPLEX_WAL_8_3_OFFSET       = 700
  3198  	DEVSYM_MAX_PATHNAME                   = 512
  3199  	DEVSYM_VFS_NAME                       = "devsym"
  3200  	WRITECRASH_NAME                       = "writecrash"
  3201  	SQLITE_INTARRAY_H                     = 0
  3202  	JT_MAX_PATHNAME                       = 512
  3203  	JT_VFS_NAME                           = "jt"
  3204  	MALLOC_LOG_FRAMES                     = 10
  3205  	DEFAULT_SECTOR_SIZE                   = 0x1000
  3206  	MAX_PAGE_SIZE                         = 0x10000
  3207  	MULTIPLEX_CTRL_ENABLE                 = 214014
  3208  	MULTIPLEX_CTRL_SET_CHUNK_SIZE         = 214015
  3209  	MULTIPLEX_CTRL_SET_MAX_CHUNKS         = 214016
  3210  	SQLITE_MULTIPLEX_CHUNK_SIZE           = 2147418112
  3211  	SQLITE_MULTIPLEX_MAX_CHUNKS           = 12
  3212  	SQLITE_MULTIPLEX_VFS_NAME             = "multiplex"
  3213  	SQLITE_TEST_MULTIPLEX_H               = 0
  3214  	MAX_MUTEXES                           = 14
  3215  	STATIC_MUTEXES                        = 12
  3216  	BLOBSIZE                              = 10485760
  3217  	BLOCKSIZE                             = 512
  3218  	DATABASE_FILE                         = 1
  3219  	FS_VFS_NAME                           = "fs"
  3220  	JOURNAL_FILE                          = 2
  3221  	INST_MAX_PATHNAME                     = 512
  3222  	OS_ACCESS                             = 1
  3223  	OS_ANNOTATE                           = 28
  3224  	OS_CHECKRESERVEDLOCK                  = 2
  3225  	OS_CLOSE                              = 3
  3226  	OS_CURRENTTIME                        = 4
  3227  	OS_DELETE                             = 5
  3228  	OS_DEVCHAR                            = 6
  3229  	OS_FILECONTROL                        = 7
  3230  	OS_FILESIZE                           = 8
  3231  	OS_FULLPATHNAME                       = 9
  3232  	OS_LOCK                               = 11
  3233  	OS_NUMEVENTS                          = 29
  3234  	OS_OPEN                               = 12
  3235  	OS_RANDOMNESS                         = 13
  3236  	OS_READ                               = 14
  3237  	OS_SECTORSIZE                         = 15
  3238  	OS_SHMBARRIER                         = 26
  3239  	OS_SHMLOCK                            = 25
  3240  	OS_SHMMAP                             = 23
  3241  	OS_SHMUNMAP                           = 22
  3242  	OS_SLEEP                              = 16
  3243  	OS_SYNC                               = 17
  3244  	OS_TRUNCATE                           = 18
  3245  	OS_UNLOCK                             = 19
  3246  	OS_WRITE                              = 20
  3247  	VFSLOG_BUFFERSIZE                     = 8192
  3248  	TESTPCACHE_CLEAR                      = 0xd42670d4
  3249  	TESTPCACHE_NPAGE                      = 217
  3250  	TESTPCACHE_RESERVE                    = 17
  3251  	TESTPCACHE_VALID                      = 0x364585fd
  3252  	MSG_Close                             = 6
  3253  	MSG_Done                              = 7
  3254  	MSG_Finalize                          = 5
  3255  	MSG_Open                              = 1
  3256  	MSG_Prepare                           = 2
  3257  	MSG_Reset                             = 4
  3258  	MSG_Step                              = 3
  3259  	INHERIT_COPY                          = 1
  3260  	INHERIT_NONE                          = 2
  3261  	INHERIT_SHARE                         = 0
  3262  	INHERIT_ZERO                          = 3
  3263  	MADV_AUTOSYNC                         = 7
  3264  	MADV_CORE                             = 9
  3265  	MADV_DONTNEED                         = 4
  3266  	MADV_FREE                             = 5
  3267  	MADV_NOCORE                           = 8
  3268  	MADV_NORMAL                           = 0
  3269  	MADV_NOSYNC                           = 6
  3270  	MADV_PROTECT                          = 10
  3271  	MADV_RANDOM                           = 1
  3272  	MADV_SEQUENTIAL                       = 2
  3273  	MADV_WILLNEED                         = 3
  3274  	MAP_32BIT                             = 0x00080000
  3275  	MAP_ALIGNED_SUPER                     = 16777216
  3276  	MAP_ALIGNMENT_MASK                    = 4278190080
  3277  	MAP_ALIGNMENT_SHIFT                   = 24
  3278  	MAP_ANON                              = 0x1000
  3279  	MAP_ANONYMOUS                         = 4096
  3280  	MAP_COPY                              = 2
  3281  	MAP_EXCL                              = 0x00004000
  3282  	MAP_FILE                              = 0x0000
  3283  	MAP_FIXED                             = 0x0010
  3284  	MAP_GUARD                             = 0x00002000
  3285  	MAP_HASSEMAPHORE                      = 0x0200
  3286  	MAP_NOCORE                            = 0x00020000
  3287  	MAP_NOSYNC                            = 0x0800
  3288  	MAP_PREFAULT_READ                     = 0x00040000
  3289  	MAP_PRIVATE                           = 0x0002
  3290  	MAP_RESERVED0020                      = 0x0020
  3291  	MAP_RESERVED0040                      = 0x0040
  3292  	MAP_RESERVED0080                      = 0x0080
  3293  	MAP_RESERVED0100                      = 0x0100
  3294  	MAP_SHARED                            = 0x0001
  3295  	MAP_STACK                             = 0x0400
  3296  	MCL_CURRENT                           = 0x0001
  3297  	MCL_FUTURE                            = 0x0002
  3298  	MFD_ALLOW_SEALING                     = 0x00000002
  3299  	MFD_CLOEXEC                           = 0x00000001
  3300  	MFD_HUGETLB                           = 0x00000004
  3301  	MFD_HUGE_16GB                         = 2281701376
  3302  	MFD_HUGE_16MB                         = 1610612736
  3303  	MFD_HUGE_1GB                          = 2013265920
  3304  	MFD_HUGE_1MB                          = 1342177280
  3305  	MFD_HUGE_256MB                        = 1879048192
  3306  	MFD_HUGE_2GB                          = 2080374784
  3307  	MFD_HUGE_2MB                          = 1409286144
  3308  	MFD_HUGE_32MB                         = 1677721600
  3309  	MFD_HUGE_512KB                        = 1275068416
  3310  	MFD_HUGE_512MB                        = 1946157056
  3311  	MFD_HUGE_64KB                         = 1073741824
  3312  	MFD_HUGE_8MB                          = 1543503872
  3313  	MFD_HUGE_MASK                         = 0xFC000000
  3314  	MFD_HUGE_SHIFT                        = 26
  3315  	MINCORE_INCORE                        = 0x1
  3316  	MINCORE_MODIFIED                      = 0x4
  3317  	MINCORE_MODIFIED_OTHER                = 0x10
  3318  	MINCORE_REFERENCED                    = 0x2
  3319  	MINCORE_REFERENCED_OTHER              = 0x8
  3320  	MINCORE_SUPER                         = 0x60
  3321  	MS_ASYNC                              = 0x0001
  3322  	MS_INVALIDATE                         = 0x0002
  3323  	MS_SYNC                               = 0x0000
  3324  	POSIX_MADV_DONTNEED                   = 4
  3325  	POSIX_MADV_NORMAL                     = 0
  3326  	POSIX_MADV_RANDOM                     = 1
  3327  	POSIX_MADV_SEQUENTIAL                 = 2
  3328  	POSIX_MADV_WILLNEED                   = 3
  3329  	PROT_EXEC                             = 0x04
  3330  	PROT_NONE                             = 0x00
  3331  	PROT_READ                             = 0x01
  3332  	PROT_WRITE                            = 0x02
  3333  	SHM_ALLOW_SEALING                     = 0x00000001
  3334  	SHM_GROW_ON_WRITE                     = 0x00000002
  3335  	SHM_LARGEPAGE                         = 0x00000004
  3336  	SHM_LARGEPAGE_ALLOC_DEFAULT           = 0
  3337  	SHM_LARGEPAGE_ALLOC_HARD              = 2
  3338  	SHM_LARGEPAGE_ALLOC_NOWAIT            = 1
  3339  	SHM_RENAME_EXCHANGE                   = 2
  3340  	SHM_RENAME_NOREPLACE                  = 1
  3341  	X_MADV_DONTNEED                       = 4
  3342  	X_MADV_NORMAL                         = 0
  3343  	X_MADV_RANDOM                         = 1
  3344  	X_MADV_SEQUENTIAL                     = 2
  3345  	X_MADV_WILLNEED                       = 3
  3346  	X_PROT_ALL                            = 7
  3347  	X_PROT_MAX_SHIFT                      = 16
  3348  	X_SYS_MMAN_H_                         = 0
  3349  	TCLVAR_NAME_EQ                        = 101
  3350  	TCLVAR_NAME_MATCH                     = 109
  3351  	TCLVAR_VALUE_GLOB                     = 103
  3352  	TCLVAR_VALUE_LIKE                     = 108
  3353  	TCLVAR_VALUE_REGEXP                   = 114
  3354  	FAULT_INJECT_NONE                     = 0
  3355  	FAULT_INJECT_PERSISTENT               = 2
  3356  	FAULT_INJECT_TRANSIENT                = 1
  3357  	TESTVFS_ACCESS_MASK                   = 0x00004000
  3358  	TESTVFS_ALL_MASK                      = 0x001FFFFF
  3359  	TESTVFS_CKLOCK_MASK                   = 0x00080000
  3360  	TESTVFS_CLOSE_MASK                    = 0x00000800
  3361  	TESTVFS_DELETE_MASK                   = 0x00000400
  3362  	TESTVFS_FCNTL_MASK                    = 0x00100000
  3363  	TESTVFS_FULLPATHNAME_MASK             = 0x00008000
  3364  	TESTVFS_LOCK_MASK                     = 0x00040000
  3365  	TESTVFS_MAX_ARGS                      = 12
  3366  	TESTVFS_MAX_PAGES                     = 1024
  3367  	TESTVFS_OPEN_MASK                     = 0x00000100
  3368  	TESTVFS_READ_MASK                     = 0x00010000
  3369  	TESTVFS_SHMBARRIER_MASK               = 0x00000040
  3370  	TESTVFS_SHMCLOSE_MASK                 = 0x00000080
  3371  	TESTVFS_SHMLOCK_MASK                  = 0x00000010
  3372  	TESTVFS_SHMMAP_MASK                   = 0x00000020
  3373  	TESTVFS_SHMOPEN_MASK                  = 0x00000001
  3374  	TESTVFS_SYNC_MASK                     = 0x00000200
  3375  	TESTVFS_TRUNCATE_MASK                 = 0x00002000
  3376  	TESTVFS_UNLOCK_MASK                   = 0x00020000
  3377  	TESTVFS_WRITE_MASK                    = 0x00001000
  3378  )
  3379  
  3380  // Run-time invariant values:
  3381  
  3382  // Flags for threads and thread attributes.
  3383  
  3384  // Values for process shared/private attributes.
  3385  
  3386  // Flags for cancelling threads
  3387  
  3388  // Flags for once initialization.
  3389  
  3390  // Static once initialization values.
  3391  
  3392  // Static initialization values.
  3393  
  3394  // Default attribute arguments (draft 4, deprecated).
  3395  
  3396  // Mutex types (Single UNIX Specification, Version 2, 1997).
  3397  //
  3398  // Note that a mutex attribute with one of the following types:
  3399  //
  3400  //	PTHREAD_MUTEX_NORMAL
  3401  //	PTHREAD_MUTEX_RECURSIVE
  3402  //
  3403  // will deviate from POSIX specified semantics.
  3404  const ( /* pthread.h:130:1: */
  3405  	PTHREAD_MUTEX_ERRORCHECK  = 1 // Default POSIX mutex
  3406  	PTHREAD_MUTEX_RECURSIVE   = 2 // Recursive mutex
  3407  	PTHREAD_MUTEX_NORMAL      = 3 // No error checking
  3408  	PTHREAD_MUTEX_ADAPTIVE_NP = 4 // Adaptive mutex, spins briefly before blocking on lock
  3409  	PTHREAD_MUTEX_TYPE_MAX    = 5
  3410  )
  3411  
  3412  // Positions to pass to Tcl_QueueEvent:
  3413  
  3414  const ( /* tcl.h:1387:1: */
  3415  	TCL_QUEUE_TAIL = 0
  3416  	TCL_QUEUE_HEAD = 1
  3417  	TCL_QUEUE_MARK = 2
  3418  )
  3419  
  3420  // The following flags determine whether the blockModeProc above should set
  3421  // the channel into blocking or nonblocking mode. They are passed as arguments
  3422  // to the blockModeProc function in the above structure.
  3423  
  3424  //----------------------------------------------------------------------------
  3425  // Enum for different types of file paths.
  3426  
  3427  const ( /* tcl.h:1609:1: */
  3428  	TCL_PATH_ABSOLUTE        = 0
  3429  	TCL_PATH_RELATIVE        = 1
  3430  	TCL_PATH_VOLUME_RELATIVE = 2
  3431  )
  3432  
  3433  //----------------------------------------------------------------------------
  3434  // When a TCL command returns, the interpreter contains a result from the
  3435  // command. Programmers are strongly encouraged to use one of the functions
  3436  // Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's
  3437  // result. See the SetResult man page for details. Besides this result, the
  3438  // command function returns an integer code, which is one of the following:
  3439  //
  3440  // TCL_OK		Command completed normally; the interpreter's result
  3441  //			contains the command's result.
  3442  // TCL_ERROR		The command couldn't be completed successfully; the
  3443  //			interpreter's result describes what went wrong.
  3444  // TCL_RETURN		The command requests that the current function return;
  3445  //			the interpreter's result contains the function's
  3446  //			return value.
  3447  // TCL_BREAK		The command requests that the innermost loop be
  3448  //			exited; the interpreter's result is meaningless.
  3449  // TCL_CONTINUE		Go on to the next iteration of the current loop; the
  3450  //			interpreter's result is meaningless.
  3451  
  3452  //----------------------------------------------------------------------------
  3453  // Flags to control what substitutions are performed by Tcl_SubstObj():
  3454  
  3455  // Argument descriptors for math function callbacks in expressions:
  3456  
  3457  const ( /* tcl.h:690:1: */
  3458  	TCL_INT      = 0
  3459  	TCL_DOUBLE   = 1
  3460  	TCL_EITHER   = 2
  3461  	TCL_WIDE_INT = 3
  3462  )
  3463  
  3464  type ptrdiff_t = int64 /* <builtin>:3:26 */
  3465  
  3466  type size_t = uint64 /* <builtin>:9:23 */
  3467  
  3468  type wchar_t = int32 /* <builtin>:15:24 */
  3469  
  3470  // Define the standard macros for the user,
  3471  //    if this invocation was from the user program.
  3472  
  3473  // Define va_list, if desired, from __gnuc_va_list.
  3474  // We deliberately do not define va_list when called from
  3475  //    stdio.h, because ANSI C says that stdio.h is not supposed to define
  3476  //    va_list.  stdio.h needs to have access to that data type,
  3477  //    but must not use that name.  It should use the name __gnuc_va_list,
  3478  //    which is safe because it is reserved for the implementation.
  3479  
  3480  // The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  3481  //    But on BSD NET2 we must not test or define or undef it.
  3482  //    (Note that the comments in NET 2's ansi.h
  3483  //    are incorrect for _VA_LIST_--see stdio.h!)
  3484  // The macro _VA_LIST_DEFINED is used in Windows NT 3.5
  3485  // The macro _VA_LIST is used in SCO Unix 3.2.
  3486  // The macro _VA_LIST_T_H is used in the Bull dpx2
  3487  // The macro __va_list__ is used by BeOS.
  3488  type va_list = uintptr /* stdarg.h:99:24 */
  3489  
  3490  // CAPI3REF: Database Connection Handle
  3491  // KEYWORDS: {database connection} {database connections}
  3492  //
  3493  // Each open SQLite database is represented by a pointer to an instance of
  3494  // the opaque structure named "sqlite3".  It is useful to think of an sqlite3
  3495  // pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
  3496  // [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
  3497  // and [sqlite3_close_v2()] are its destructors.  There are many other
  3498  // interfaces (such as
  3499  // [sqlite3_prepare_v2()], [sqlite3_create_function()], and
  3500  // [sqlite3_busy_timeout()] to name but three) that are methods on an
  3501  // sqlite3 object.
  3502  type sqlite32 = struct {
  3503  	FpVfs                   uintptr
  3504  	FpVdbe                  uintptr
  3505  	FpDfltColl              uintptr
  3506  	Fmutex                  uintptr
  3507  	FaDb                    uintptr
  3508  	FnDb                    int32
  3509  	FmDbFlags               u32
  3510  	Fflags                  u64
  3511  	FlastRowid              i64
  3512  	FszMmap                 i64
  3513  	FnSchemaLock            u32
  3514  	FopenFlags              uint32
  3515  	FerrCode                int32
  3516  	FerrMask                int32
  3517  	FiSysErrno              int32
  3518  	FdbOptFlags             u32
  3519  	Fenc                    u8
  3520  	FautoCommit             u8
  3521  	Ftemp_store             u8
  3522  	FmallocFailed           u8
  3523  	FbBenignMalloc          u8
  3524  	FdfltLockMode           u8
  3525  	FnextAutovac            int8
  3526  	FsuppressErr            u8
  3527  	FvtabOnConflict         u8
  3528  	FisTransactionSavepoint u8
  3529  	FmTrace                 u8
  3530  	FnoSharedCache          u8
  3531  	FnSqlExec               u8
  3532  	_                       [3]byte
  3533  	FnextPagesize           int32
  3534  	Fmagic                  u32
  3535  	FnChange                int32
  3536  	FnTotalChange           int32
  3537  	FaLimit                 [12]int32
  3538  	FnMaxSorterMmap         int32
  3539  	_                       [4]byte
  3540  	Finit                   struct {
  3541  		FnewTnum       Pgno
  3542  		FiDb           u8
  3543  		Fbusy          u8
  3544  		_              [2]byte
  3545  		ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */
  3546  		_              [7]byte
  3547  		FazInit        uintptr
  3548  	}
  3549  	FnVdbeActive        int32
  3550  	FnVdbeRead          int32
  3551  	FnVdbeWrite         int32
  3552  	FnVdbeExec          int32
  3553  	FnVDestroy          int32
  3554  	FnExtension         int32
  3555  	FaExtension         uintptr
  3556  	Ftrace              struct{ FxLegacy uintptr }
  3557  	FpTraceArg          uintptr
  3558  	FxProfile           uintptr
  3559  	FpProfileArg        uintptr
  3560  	FpCommitArg         uintptr
  3561  	FxCommitCallback    uintptr
  3562  	FpRollbackArg       uintptr
  3563  	FxRollbackCallback  uintptr
  3564  	FpUpdateArg         uintptr
  3565  	FxUpdateCallback    uintptr
  3566  	FpParse             uintptr
  3567  	FpPreUpdateArg      uintptr
  3568  	FxPreUpdateCallback uintptr
  3569  	FpPreUpdate         uintptr
  3570  	FxWalCallback       uintptr
  3571  	FpWalArg            uintptr
  3572  	FxCollNeeded        uintptr
  3573  	FxCollNeeded16      uintptr
  3574  	FpCollNeededArg     uintptr
  3575  	FpErr               uintptr
  3576  	Fu1                 struct {
  3577  		_              [0]uint64
  3578  		FisInterrupted int32
  3579  		_              [4]byte
  3580  	}
  3581  	Flookaside           Lookaside
  3582  	FxAuth               sqlite3_xauth
  3583  	FpAuthArg            uintptr
  3584  	FxProgress           uintptr
  3585  	FpProgressArg        uintptr
  3586  	FnProgressOps        uint32
  3587  	FnVTrans             int32
  3588  	FaModule             Hash
  3589  	FpVtabCtx            uintptr
  3590  	FaVTrans             uintptr
  3591  	FpDisconnect         uintptr
  3592  	FaFunc               Hash
  3593  	FaCollSeq            Hash
  3594  	FbusyHandler         BusyHandler
  3595  	FaDbStatic           [2]Db
  3596  	FpSavepoint          uintptr
  3597  	FnAnalysisLimit      int32
  3598  	FbusyTimeout         int32
  3599  	FnSavepoint          int32
  3600  	FnStatement          int32
  3601  	FnDeferredCons       i64
  3602  	FnDeferredImmCons    i64
  3603  	FpnBytesFreed        uintptr
  3604  	FpBlockingConnection uintptr
  3605  	FpUnlockConnection   uintptr
  3606  	FpUnlockArg          uintptr
  3607  	FxUnlockNotify       uintptr
  3608  	FpNextBlocked        uintptr
  3609  } /* sqlite3.h:249:9 */
  3610  
  3611  // CAPI3REF: 64-Bit Integer Types
  3612  // KEYWORDS: sqlite_int64 sqlite_uint64
  3613  //
  3614  // Because there is no cross-platform way to specify 64-bit integer types
  3615  // SQLite includes typedefs for 64-bit signed and unsigned integers.
  3616  //
  3617  // The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
  3618  // The sqlite_int64 and sqlite_uint64 types are supported for backwards
  3619  // compatibility only.
  3620  //
  3621  // ^The sqlite3_int64 and sqlite_int64 types can store integer values
  3622  // between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
  3623  // sqlite3_uint64 and sqlite_uint64 types can store integer values
  3624  // between 0 and +18446744073709551615 inclusive.
  3625  type sqlite_int64 = int64           /* sqlite3.h:278:25 */
  3626  type sqlite_uint64 = uint64         /* sqlite3.h:279:34 */
  3627  type sqlite3_int64 = sqlite_int64   /* sqlite3.h:281:22 */
  3628  type sqlite3_uint64 = sqlite_uint64 /* sqlite3.h:282:23 */
  3629  
  3630  // The type for a callback function.
  3631  // This is legacy and deprecated.  It is included for historical
  3632  // compatibility and is not documented.
  3633  type sqlite3_callback = uintptr /* sqlite3.h:338:13 */
  3634  
  3635  // CAPI3REF: Result Codes
  3636  // KEYWORDS: {result code definitions}
  3637  //
  3638  // Many SQLite functions return an integer result code from the set shown
  3639  // here in order to indicate success or failure.
  3640  //
  3641  // New error codes may be added in future versions of SQLite.
  3642  //
  3643  // See also: [extended result code definitions]
  3644  // beginning-of-error-codes
  3645  // end-of-error-codes
  3646  
  3647  // CAPI3REF: Extended Result Codes
  3648  // KEYWORDS: {extended result code definitions}
  3649  //
  3650  // In its default configuration, SQLite API routines return one of 30 integer
  3651  // [result codes].  However, experience has shown that many of
  3652  // these result codes are too coarse-grained.  They do not provide as
  3653  // much information about problems as programmers might like.  In an effort to
  3654  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  3655  // and later) include
  3656  // support for additional result codes that provide more detailed information
  3657  // about errors. These [extended result codes] are enabled or disabled
  3658  // on a per database connection basis using the
  3659  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  3660  // the most recent error can be obtained using
  3661  // [sqlite3_extended_errcode()].
  3662  
  3663  // CAPI3REF: Flags For File Open Operations
  3664  //
  3665  // These bit values are intended for use in the
  3666  // 3rd parameter to the [sqlite3_open_v2()] interface and
  3667  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  3668  
  3669  // Reserved:                         0x00F00000
  3670  // Legacy compatibility:
  3671  
  3672  // CAPI3REF: Device Characteristics
  3673  //
  3674  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  3675  // object returns an integer which is a vector of these
  3676  // bit values expressing I/O characteristics of the mass storage
  3677  // device that holds the file that the [sqlite3_io_methods]
  3678  // refers to.
  3679  //
  3680  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  3681  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  3682  // mean that writes of blocks that are nnn bytes in size and
  3683  // are aligned to an address which is an integer multiple of
  3684  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  3685  // that when data is appended to a file, the data is appended
  3686  // first then the size of the file is extended, never the other
  3687  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  3688  // information is written to disk in the same order as calls
  3689  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  3690  // after reboot following a crash or power loss, the only bytes in a
  3691  // file that were written at the application level might have changed
  3692  // and that adjacent bytes, even bytes within the same sector are
  3693  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  3694  // flag indicates that a file cannot be deleted when open.  The
  3695  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  3696  // read-only media and cannot be changed even by processes with
  3697  // elevated privileges.
  3698  //
  3699  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  3700  // filesystem supports doing multiple write operations atomically when those
  3701  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  3702  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  3703  
  3704  // CAPI3REF: File Locking Levels
  3705  //
  3706  // SQLite uses one of these integer values as the second
  3707  // argument to calls it makes to the xLock() and xUnlock() methods
  3708  // of an [sqlite3_io_methods] object.
  3709  
  3710  // CAPI3REF: Synchronization Type Flags
  3711  //
  3712  // When SQLite invokes the xSync() method of an
  3713  // [sqlite3_io_methods] object it uses a combination of
  3714  // these integer values as the second argument.
  3715  //
  3716  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  3717  // sync operation only needs to flush data to mass storage.  Inode
  3718  // information need not be flushed. If the lower four bits of the flag
  3719  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  3720  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  3721  // to use Mac OS X style fullsync instead of fsync().
  3722  //
  3723  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  3724  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  3725  // settings.  The [synchronous pragma] determines when calls to the
  3726  // xSync VFS method occur and applies uniformly across all platforms.
  3727  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  3728  // energetic or rigorous or forceful the sync operations are and
  3729  // only make a difference on Mac OSX for the default SQLite code.
  3730  // (Third-party VFS implementations might also make the distinction
  3731  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  3732  // operating systems natively supported by SQLite, only Mac OSX
  3733  // cares about the difference.)
  3734  
  3735  // CAPI3REF: OS Interface Open File Handle
  3736  //
  3737  // An [sqlite3_file] object represents an open file in the
  3738  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  3739  // implementations will
  3740  // want to subclass this object by appending additional fields
  3741  // for their own use.  The pMethods entry is a pointer to an
  3742  // [sqlite3_io_methods] object that defines methods for performing
  3743  // I/O operations on the open file.
  3744  type sqlite3_file1 = struct{ FpMethods uintptr } /* sqlite3.h:684:9 */
  3745  
  3746  // CAPI3REF: Result Codes
  3747  // KEYWORDS: {result code definitions}
  3748  //
  3749  // Many SQLite functions return an integer result code from the set shown
  3750  // here in order to indicate success or failure.
  3751  //
  3752  // New error codes may be added in future versions of SQLite.
  3753  //
  3754  // See also: [extended result code definitions]
  3755  // beginning-of-error-codes
  3756  // end-of-error-codes
  3757  
  3758  // CAPI3REF: Extended Result Codes
  3759  // KEYWORDS: {extended result code definitions}
  3760  //
  3761  // In its default configuration, SQLite API routines return one of 30 integer
  3762  // [result codes].  However, experience has shown that many of
  3763  // these result codes are too coarse-grained.  They do not provide as
  3764  // much information about problems as programmers might like.  In an effort to
  3765  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  3766  // and later) include
  3767  // support for additional result codes that provide more detailed information
  3768  // about errors. These [extended result codes] are enabled or disabled
  3769  // on a per database connection basis using the
  3770  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  3771  // the most recent error can be obtained using
  3772  // [sqlite3_extended_errcode()].
  3773  
  3774  // CAPI3REF: Flags For File Open Operations
  3775  //
  3776  // These bit values are intended for use in the
  3777  // 3rd parameter to the [sqlite3_open_v2()] interface and
  3778  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  3779  
  3780  // Reserved:                         0x00F00000
  3781  // Legacy compatibility:
  3782  
  3783  // CAPI3REF: Device Characteristics
  3784  //
  3785  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  3786  // object returns an integer which is a vector of these
  3787  // bit values expressing I/O characteristics of the mass storage
  3788  // device that holds the file that the [sqlite3_io_methods]
  3789  // refers to.
  3790  //
  3791  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  3792  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  3793  // mean that writes of blocks that are nnn bytes in size and
  3794  // are aligned to an address which is an integer multiple of
  3795  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  3796  // that when data is appended to a file, the data is appended
  3797  // first then the size of the file is extended, never the other
  3798  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  3799  // information is written to disk in the same order as calls
  3800  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  3801  // after reboot following a crash or power loss, the only bytes in a
  3802  // file that were written at the application level might have changed
  3803  // and that adjacent bytes, even bytes within the same sector are
  3804  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  3805  // flag indicates that a file cannot be deleted when open.  The
  3806  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  3807  // read-only media and cannot be changed even by processes with
  3808  // elevated privileges.
  3809  //
  3810  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  3811  // filesystem supports doing multiple write operations atomically when those
  3812  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  3813  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  3814  
  3815  // CAPI3REF: File Locking Levels
  3816  //
  3817  // SQLite uses one of these integer values as the second
  3818  // argument to calls it makes to the xLock() and xUnlock() methods
  3819  // of an [sqlite3_io_methods] object.
  3820  
  3821  // CAPI3REF: Synchronization Type Flags
  3822  //
  3823  // When SQLite invokes the xSync() method of an
  3824  // [sqlite3_io_methods] object it uses a combination of
  3825  // these integer values as the second argument.
  3826  //
  3827  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  3828  // sync operation only needs to flush data to mass storage.  Inode
  3829  // information need not be flushed. If the lower four bits of the flag
  3830  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  3831  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  3832  // to use Mac OS X style fullsync instead of fsync().
  3833  //
  3834  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  3835  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  3836  // settings.  The [synchronous pragma] determines when calls to the
  3837  // xSync VFS method occur and applies uniformly across all platforms.
  3838  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  3839  // energetic or rigorous or forceful the sync operations are and
  3840  // only make a difference on Mac OSX for the default SQLite code.
  3841  // (Third-party VFS implementations might also make the distinction
  3842  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  3843  // operating systems natively supported by SQLite, only Mac OSX
  3844  // cares about the difference.)
  3845  
  3846  // CAPI3REF: OS Interface Open File Handle
  3847  //
  3848  // An [sqlite3_file] object represents an open file in the
  3849  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  3850  // implementations will
  3851  // want to subclass this object by appending additional fields
  3852  // for their own use.  The pMethods entry is a pointer to an
  3853  // [sqlite3_io_methods] object that defines methods for performing
  3854  // I/O operations on the open file.
  3855  type sqlite3_file = sqlite3_file1 /* sqlite3.h:684:29 */
  3856  type sqlite3_io_methods1 = struct {
  3857  	FiVersion               int32
  3858  	_                       [4]byte
  3859  	FxClose                 uintptr
  3860  	FxRead                  uintptr
  3861  	FxWrite                 uintptr
  3862  	FxTruncate              uintptr
  3863  	FxSync                  uintptr
  3864  	FxFileSize              uintptr
  3865  	FxLock                  uintptr
  3866  	FxUnlock                uintptr
  3867  	FxCheckReservedLock     uintptr
  3868  	FxFileControl           uintptr
  3869  	FxSectorSize            uintptr
  3870  	FxDeviceCharacteristics uintptr
  3871  	FxShmMap                uintptr
  3872  	FxShmLock               uintptr
  3873  	FxShmBarrier            uintptr
  3874  	FxShmUnmap              uintptr
  3875  	FxFetch                 uintptr
  3876  	FxUnfetch               uintptr
  3877  } /* sqlite3.h:684:9 */
  3878  
  3879  // CAPI3REF: OS Interface File Virtual Methods Object
  3880  //
  3881  // Every file opened by the [sqlite3_vfs.xOpen] method populates an
  3882  // [sqlite3_file] object (or, more commonly, a subclass of the
  3883  // [sqlite3_file] object) with a pointer to an instance of this object.
  3884  // This object defines the methods used to perform various operations
  3885  // against the open file represented by the [sqlite3_file] object.
  3886  //
  3887  // If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
  3888  // to a non-NULL pointer, then the sqlite3_io_methods.xClose method
  3889  // may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The
  3890  // only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
  3891  // is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
  3892  // to NULL.
  3893  //
  3894  // The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
  3895  // [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
  3896  // The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]
  3897  // flag may be ORed in to indicate that only the data of the file
  3898  // and not its inode needs to be synced.
  3899  //
  3900  // The integer values to xLock() and xUnlock() are one of
  3901  // <ul>
  3902  // <li> [SQLITE_LOCK_NONE],
  3903  // <li> [SQLITE_LOCK_SHARED],
  3904  // <li> [SQLITE_LOCK_RESERVED],
  3905  // <li> [SQLITE_LOCK_PENDING], or
  3906  // <li> [SQLITE_LOCK_EXCLUSIVE].
  3907  // </ul>
  3908  // xLock() increases the lock. xUnlock() decreases the lock.
  3909  // The xCheckReservedLock() method checks whether any database connection,
  3910  // either in this process or in some other process, is holding a RESERVED,
  3911  // PENDING, or EXCLUSIVE lock on the file.  It returns true
  3912  // if such a lock exists and false otherwise.
  3913  //
  3914  // The xFileControl() method is a generic interface that allows custom
  3915  // VFS implementations to directly control an open file using the
  3916  // [sqlite3_file_control()] interface.  The second "op" argument is an
  3917  // integer opcode.  The third argument is a generic pointer intended to
  3918  // point to a structure that may contain arguments or space in which to
  3919  // write return values.  Potential uses for xFileControl() might be
  3920  // functions to enable blocking locks with timeouts, to change the
  3921  // locking strategy (for example to use dot-file locks), to inquire
  3922  // about the status of a lock, or to break stale locks.  The SQLite
  3923  // core reserves all opcodes less than 100 for its own use.
  3924  // A [file control opcodes | list of opcodes] less than 100 is available.
  3925  // Applications that define a custom xFileControl method should use opcodes
  3926  // greater than 100 to avoid conflicts.  VFS implementations should
  3927  // return [SQLITE_NOTFOUND] for file control opcodes that they do not
  3928  // recognize.
  3929  //
  3930  // The xSectorSize() method returns the sector size of the
  3931  // device that underlies the file.  The sector size is the
  3932  // minimum write that can be performed without disturbing
  3933  // other bytes in the file.  The xDeviceCharacteristics()
  3934  // method returns a bit vector describing behaviors of the
  3935  // underlying device:
  3936  //
  3937  // <ul>
  3938  // <li> [SQLITE_IOCAP_ATOMIC]
  3939  // <li> [SQLITE_IOCAP_ATOMIC512]
  3940  // <li> [SQLITE_IOCAP_ATOMIC1K]
  3941  // <li> [SQLITE_IOCAP_ATOMIC2K]
  3942  // <li> [SQLITE_IOCAP_ATOMIC4K]
  3943  // <li> [SQLITE_IOCAP_ATOMIC8K]
  3944  // <li> [SQLITE_IOCAP_ATOMIC16K]
  3945  // <li> [SQLITE_IOCAP_ATOMIC32K]
  3946  // <li> [SQLITE_IOCAP_ATOMIC64K]
  3947  // <li> [SQLITE_IOCAP_SAFE_APPEND]
  3948  // <li> [SQLITE_IOCAP_SEQUENTIAL]
  3949  // <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
  3950  // <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
  3951  // <li> [SQLITE_IOCAP_IMMUTABLE]
  3952  // <li> [SQLITE_IOCAP_BATCH_ATOMIC]
  3953  // </ul>
  3954  //
  3955  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  3956  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  3957  // mean that writes of blocks that are nnn bytes in size and
  3958  // are aligned to an address which is an integer multiple of
  3959  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  3960  // that when data is appended to a file, the data is appended
  3961  // first then the size of the file is extended, never the other
  3962  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  3963  // information is written to disk in the same order as calls
  3964  // to xWrite().
  3965  //
  3966  // If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
  3967  // in the unread portions of the buffer with zeros.  A VFS that
  3968  // fails to zero-fill short reads might seem to work.  However,
  3969  // failure to zero-fill short reads will eventually lead to
  3970  // database corruption.
  3971  type sqlite3_io_methods = sqlite3_io_methods1 /* sqlite3.h:783:35 */
  3972  
  3973  // CAPI3REF: Standard File Control Opcodes
  3974  // KEYWORDS: {file control opcodes} {file control opcode}
  3975  //
  3976  // These integer constants are opcodes for the xFileControl method
  3977  // of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
  3978  // interface.
  3979  //
  3980  // <ul>
  3981  // <li>[[SQLITE_FCNTL_LOCKSTATE]]
  3982  // The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
  3983  // opcode causes the xFileControl method to write the current state of
  3984  // the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
  3985  // [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
  3986  // into an integer that the pArg argument points to. This capability
  3987  // is used during testing and is only available when the SQLITE_TEST
  3988  // compile-time option is used.
  3989  //
  3990  // <li>[[SQLITE_FCNTL_SIZE_HINT]]
  3991  // The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
  3992  // layer a hint of how large the database file will grow to be during the
  3993  // current transaction.  This hint is not guaranteed to be accurate but it
  3994  // is often close.  The underlying VFS might choose to preallocate database
  3995  // file space based on this hint in order to help writes to the database
  3996  // file run faster.
  3997  //
  3998  // <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
  3999  // The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
  4000  // implements [sqlite3_deserialize()] to set an upper bound on the size
  4001  // of the in-memory database.  The argument is a pointer to a [sqlite3_int64].
  4002  // If the integer pointed to is negative, then it is filled in with the
  4003  // current limit.  Otherwise the limit is set to the larger of the value
  4004  // of the integer pointed to and the current database size.  The integer
  4005  // pointed to is set to the new limit.
  4006  //
  4007  // <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
  4008  // The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
  4009  // extends and truncates the database file in chunks of a size specified
  4010  // by the user. The fourth argument to [sqlite3_file_control()] should
  4011  // point to an integer (type int) containing the new chunk-size to use
  4012  // for the nominated database. Allocating database file space in large
  4013  // chunks (say 1MB at a time), may reduce file-system fragmentation and
  4014  // improve performance on some systems.
  4015  //
  4016  // <li>[[SQLITE_FCNTL_FILE_POINTER]]
  4017  // The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
  4018  // to the [sqlite3_file] object associated with a particular database
  4019  // connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].
  4020  //
  4021  // <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
  4022  // The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
  4023  // to the [sqlite3_file] object associated with the journal file (either
  4024  // the [rollback journal] or the [write-ahead log]) for a particular database
  4025  // connection.  See also [SQLITE_FCNTL_FILE_POINTER].
  4026  //
  4027  // <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
  4028  // No longer in use.
  4029  //
  4030  // <li>[[SQLITE_FCNTL_SYNC]]
  4031  // The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
  4032  // sent to the VFS immediately before the xSync method is invoked on a
  4033  // database file descriptor. Or, if the xSync method is not invoked
  4034  // because the user has configured SQLite with
  4035  // [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
  4036  // of the xSync method. In most cases, the pointer argument passed with
  4037  // this file-control is NULL. However, if the database file is being synced
  4038  // as part of a multi-database commit, the argument points to a nul-terminated
  4039  // string containing the transactions super-journal file name. VFSes that
  4040  // do not need this signal should silently ignore this opcode. Applications
  4041  // should not call [sqlite3_file_control()] with this opcode as doing so may
  4042  // disrupt the operation of the specialized VFSes that do require it.
  4043  //
  4044  // <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
  4045  // The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
  4046  // and sent to the VFS after a transaction has been committed immediately
  4047  // but before the database is unlocked. VFSes that do not need this signal
  4048  // should silently ignore this opcode. Applications should not call
  4049  // [sqlite3_file_control()] with this opcode as doing so may disrupt the
  4050  // operation of the specialized VFSes that do require it.
  4051  //
  4052  // <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
  4053  // ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
  4054  // retry counts and intervals for certain disk I/O operations for the
  4055  // windows [VFS] in order to provide robustness in the presence of
  4056  // anti-virus programs.  By default, the windows VFS will retry file read,
  4057  // file write, and file delete operations up to 10 times, with a delay
  4058  // of 25 milliseconds before the first retry and with the delay increasing
  4059  // by an additional 25 milliseconds with each subsequent retry.  This
  4060  // opcode allows these two values (10 retries and 25 milliseconds of delay)
  4061  // to be adjusted.  The values are changed for all database connections
  4062  // within the same process.  The argument is a pointer to an array of two
  4063  // integers where the first integer is the new retry count and the second
  4064  // integer is the delay.  If either integer is negative, then the setting
  4065  // is not changed but instead the prior value of that setting is written
  4066  // into the array entry, allowing the current retry settings to be
  4067  // interrogated.  The zDbName parameter is ignored.
  4068  //
  4069  // <li>[[SQLITE_FCNTL_PERSIST_WAL]]
  4070  // ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
  4071  // persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
  4072  // write ahead log ([WAL file]) and shared memory
  4073  // files used for transaction control
  4074  // are automatically deleted when the latest connection to the database
  4075  // closes.  Setting persistent WAL mode causes those files to persist after
  4076  // close.  Persisting the files is useful when other processes that do not
  4077  // have write permission on the directory containing the database file want
  4078  // to read the database file, as the WAL and shared memory files must exist
  4079  // in order for the database to be readable.  The fourth parameter to
  4080  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
  4081  // That integer is 0 to disable persistent WAL mode or 1 to enable persistent
  4082  // WAL mode.  If the integer is -1, then it is overwritten with the current
  4083  // WAL persistence setting.
  4084  //
  4085  // <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
  4086  // ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
  4087  // persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting
  4088  // determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
  4089  // xDeviceCharacteristics methods. The fourth parameter to
  4090  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
  4091  // That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
  4092  // mode.  If the integer is -1, then it is overwritten with the current
  4093  // zero-damage mode setting.
  4094  //
  4095  // <li>[[SQLITE_FCNTL_OVERWRITE]]
  4096  // ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
  4097  // a write transaction to indicate that, unless it is rolled back for some
  4098  // reason, the entire database file will be overwritten by the current
  4099  // transaction. This is used by VACUUM operations.
  4100  //
  4101  // <li>[[SQLITE_FCNTL_VFSNAME]]
  4102  // ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
  4103  // all [VFSes] in the VFS stack.  The names are of all VFS shims and the
  4104  // final bottom-level VFS are written into memory obtained from
  4105  // [sqlite3_malloc()] and the result is stored in the char* variable
  4106  // that the fourth parameter of [sqlite3_file_control()] points to.
  4107  // The caller is responsible for freeing the memory when done.  As with
  4108  // all file-control actions, there is no guarantee that this will actually
  4109  // do anything.  Callers should initialize the char* variable to a NULL
  4110  // pointer in case this file-control is not implemented.  This file-control
  4111  // is intended for diagnostic use only.
  4112  //
  4113  // <li>[[SQLITE_FCNTL_VFS_POINTER]]
  4114  // ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
  4115  // [VFSes] currently in use.  ^(The argument X in
  4116  // sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
  4117  // of type "[sqlite3_vfs] **".  This opcodes will set *X
  4118  // to a pointer to the top-level VFS.)^
  4119  // ^When there are multiple VFS shims in the stack, this opcode finds the
  4120  // upper-most shim only.
  4121  //
  4122  // <li>[[SQLITE_FCNTL_PRAGMA]]
  4123  // ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
  4124  // file control is sent to the open [sqlite3_file] object corresponding
  4125  // to the database file to which the pragma statement refers. ^The argument
  4126  // to the [SQLITE_FCNTL_PRAGMA] file control is an array of
  4127  // pointers to strings (char**) in which the second element of the array
  4128  // is the name of the pragma and the third element is the argument to the
  4129  // pragma or NULL if the pragma has no argument.  ^The handler for an
  4130  // [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
  4131  // of the char** argument point to a string obtained from [sqlite3_mprintf()]
  4132  // or the equivalent and that string will become the result of the pragma or
  4133  // the error message if the pragma fails. ^If the
  4134  // [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
  4135  // [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]
  4136  // file control returns [SQLITE_OK], then the parser assumes that the
  4137  // VFS has handled the PRAGMA itself and the parser generates a no-op
  4138  // prepared statement if result string is NULL, or that returns a copy
  4139  // of the result string if the string is non-NULL.
  4140  // ^If the [SQLITE_FCNTL_PRAGMA] file control returns
  4141  // any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
  4142  // that the VFS encountered an error while handling the [PRAGMA] and the
  4143  // compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]
  4144  // file control occurs at the beginning of pragma statement analysis and so
  4145  // it is able to override built-in [PRAGMA] statements.
  4146  //
  4147  // <li>[[SQLITE_FCNTL_BUSYHANDLER]]
  4148  // ^The [SQLITE_FCNTL_BUSYHANDLER]
  4149  // file-control may be invoked by SQLite on the database file handle
  4150  // shortly after it is opened in order to provide a custom VFS with access
  4151  // to the connection's busy-handler callback. The argument is of type (void**)
  4152  // - an array of two (void *) values. The first (void *) actually points
  4153  // to a function of type (int (*)(void *)). In order to invoke the connection's
  4154  // busy-handler, this function should be invoked with the second (void *) in
  4155  // the array as the only argument. If it returns non-zero, then the operation
  4156  // should be retried. If it returns zero, the custom VFS should abandon the
  4157  // current operation.
  4158  //
  4159  // <li>[[SQLITE_FCNTL_TEMPFILENAME]]
  4160  // ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
  4161  // to have SQLite generate a
  4162  // temporary filename using the same algorithm that is followed to generate
  4163  // temporary filenames for TEMP tables and other internal uses.  The
  4164  // argument should be a char** which will be filled with the filename
  4165  // written into memory obtained from [sqlite3_malloc()].  The caller should
  4166  // invoke [sqlite3_free()] on the result to avoid a memory leak.
  4167  //
  4168  // <li>[[SQLITE_FCNTL_MMAP_SIZE]]
  4169  // The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
  4170  // maximum number of bytes that will be used for memory-mapped I/O.
  4171  // The argument is a pointer to a value of type sqlite3_int64 that
  4172  // is an advisory maximum number of bytes in the file to memory map.  The
  4173  // pointer is overwritten with the old value.  The limit is not changed if
  4174  // the value originally pointed to is negative, and so the current limit
  4175  // can be queried by passing in a pointer to a negative number.  This
  4176  // file-control is used internally to implement [PRAGMA mmap_size].
  4177  //
  4178  // <li>[[SQLITE_FCNTL_TRACE]]
  4179  // The [SQLITE_FCNTL_TRACE] file control provides advisory information
  4180  // to the VFS about what the higher layers of the SQLite stack are doing.
  4181  // This file control is used by some VFS activity tracing [shims].
  4182  // The argument is a zero-terminated string.  Higher layers in the
  4183  // SQLite stack may generate instances of this file control if
  4184  // the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
  4185  //
  4186  // <li>[[SQLITE_FCNTL_HAS_MOVED]]
  4187  // The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
  4188  // pointer to an integer and it writes a boolean into that integer depending
  4189  // on whether or not the file has been renamed, moved, or deleted since it
  4190  // was first opened.
  4191  //
  4192  // <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
  4193  // The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
  4194  // underlying native file handle associated with a file handle.  This file
  4195  // control interprets its argument as a pointer to a native file handle and
  4196  // writes the resulting value there.
  4197  //
  4198  // <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
  4199  // The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
  4200  // opcode causes the xFileControl method to swap the file handle with the one
  4201  // pointed to by the pArg argument.  This capability is used during testing
  4202  // and only needs to be supported when SQLITE_TEST is defined.
  4203  //
  4204  // <li>[[SQLITE_FCNTL_WAL_BLOCK]]
  4205  // The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
  4206  // be advantageous to block on the next WAL lock if the lock is not immediately
  4207  // available.  The WAL subsystem issues this signal during rare
  4208  // circumstances in order to fix a problem with priority inversion.
  4209  // Applications should <em>not</em> use this file-control.
  4210  //
  4211  // <li>[[SQLITE_FCNTL_ZIPVFS]]
  4212  // The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
  4213  // VFS should return SQLITE_NOTFOUND for this opcode.
  4214  //
  4215  // <li>[[SQLITE_FCNTL_RBU]]
  4216  // The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
  4217  // the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for
  4218  // this opcode.
  4219  //
  4220  // <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
  4221  // If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
  4222  // the file descriptor is placed in "batch write mode", which
  4223  // means all subsequent write operations will be deferred and done
  4224  // atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].  Systems
  4225  // that do not support batch atomic writes will return SQLITE_NOTFOUND.
  4226  // ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
  4227  // the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
  4228  // [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
  4229  // no VFS interface calls on the same [sqlite3_file] file descriptor
  4230  // except for calls to the xWrite method and the xFileControl method
  4231  // with [SQLITE_FCNTL_SIZE_HINT].
  4232  //
  4233  // <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
  4234  // The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
  4235  // operations since the previous successful call to
  4236  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
  4237  // This file control returns [SQLITE_OK] if and only if the writes were
  4238  // all performed successfully and have been committed to persistent storage.
  4239  // ^Regardless of whether or not it is successful, this file control takes
  4240  // the file descriptor out of batch write mode so that all subsequent
  4241  // write operations are independent.
  4242  // ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
  4243  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
  4244  //
  4245  // <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
  4246  // The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
  4247  // operations since the previous successful call to
  4248  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
  4249  // ^This file control takes the file descriptor out of batch write mode
  4250  // so that all subsequent write operations are independent.
  4251  // ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
  4252  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
  4253  //
  4254  // <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
  4255  // The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
  4256  // to block for up to M milliseconds before failing when attempting to
  4257  // obtain a file lock using the xLock or xShmLock methods of the VFS.
  4258  // The parameter is a pointer to a 32-bit signed integer that contains
  4259  // the value that M is to be set to. Before returning, the 32-bit signed
  4260  // integer is overwritten with the previous value of M.
  4261  //
  4262  // <li>[[SQLITE_FCNTL_DATA_VERSION]]
  4263  // The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
  4264  // a database file.  The argument is a pointer to a 32-bit unsigned integer.
  4265  // The "data version" for the pager is written into the pointer.  The
  4266  // "data version" changes whenever any change occurs to the corresponding
  4267  // database file, either through SQL statements on the same database
  4268  // connection or through transactions committed by separate database
  4269  // connections possibly in other processes. The [sqlite3_total_changes()]
  4270  // interface can be used to find if any database on the connection has changed,
  4271  // but that interface responds to changes on TEMP as well as MAIN and does
  4272  // not provide a mechanism to detect changes to MAIN only.  Also, the
  4273  // [sqlite3_total_changes()] interface responds to internal changes only and
  4274  // omits changes made by other database connections.  The
  4275  // [PRAGMA data_version] command provides a mechanism to detect changes to
  4276  // a single attached database that occur due to other database connections,
  4277  // but omits changes implemented by the database connection on which it is
  4278  // called.  This file control is the only mechanism to detect changes that
  4279  // happen either internally or externally and that are associated with
  4280  // a particular attached database.
  4281  //
  4282  // <li>[[SQLITE_FCNTL_CKPT_START]]
  4283  // The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
  4284  // in wal mode before the client starts to copy pages from the wal
  4285  // file to the database file.
  4286  //
  4287  // <li>[[SQLITE_FCNTL_CKPT_DONE]]
  4288  // The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
  4289  // in wal mode after the client has finished copying pages from the wal
  4290  // file to the database file, but before the *-shm file is updated to
  4291  // record the fact that the pages have been checkpointed.
  4292  // </ul>
  4293  //
  4294  // <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
  4295  // The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
  4296  // whether or not there is a database client in another process with a wal-mode
  4297  // transaction open on the database or not. It is only available on unix.The
  4298  // (void*) argument passed with this file-control should be a pointer to a
  4299  // value of type (int). The integer value is set to 1 if the database is a wal
  4300  // mode database and there exists at least one client in another process that
  4301  // currently has an SQL transaction open on the database. It is set to 0 if
  4302  // the database is not a wal-mode db, or if there is no such connection in any
  4303  // other process. This opcode cannot be used to detect transactions opened
  4304  // by clients within the current process, only within other processes.
  4305  // </ul>
  4306  //
  4307  // <li>[[SQLITE_FCNTL_CKSM_FILE]]
  4308  // Used by the cksmvfs VFS module only.
  4309  // </ul>
  4310  
  4311  // deprecated names
  4312  
  4313  // CAPI3REF: Mutex Handle
  4314  //
  4315  // The mutex module within SQLite defines [sqlite3_mutex] to be an
  4316  // abstract type for a mutex object.  The SQLite core never looks
  4317  // at the internal representation of an [sqlite3_mutex].  It only
  4318  // deals with pointers to the [sqlite3_mutex] object.
  4319  //
  4320  // Mutexes are created using [sqlite3_mutex_alloc()].
  4321  type sqlite3_mutex1 = struct {
  4322  	FpReal uintptr
  4323  	FeType int32
  4324  	_      [4]byte
  4325  } /* sqlite3.h:1206:9 */
  4326  
  4327  // CAPI3REF: Loadable Extension Thunk
  4328  //
  4329  // A pointer to the opaque sqlite3_api_routines structure is passed as
  4330  // the third parameter to entry points of [loadable extensions].  This
  4331  // structure must be typedefed in order to work around compiler warnings
  4332  // on some platforms.
  4333  type sqlite3_api_routines1 = struct {
  4334  	Faggregate_context      uintptr
  4335  	Faggregate_count        uintptr
  4336  	Fbind_blob              uintptr
  4337  	Fbind_double            uintptr
  4338  	Fbind_int               uintptr
  4339  	Fbind_int64             uintptr
  4340  	Fbind_null              uintptr
  4341  	Fbind_parameter_count   uintptr
  4342  	Fbind_parameter_index   uintptr
  4343  	Fbind_parameter_name    uintptr
  4344  	Fbind_text              uintptr
  4345  	Fbind_text16            uintptr
  4346  	Fbind_value             uintptr
  4347  	Fbusy_handler           uintptr
  4348  	Fbusy_timeout           uintptr
  4349  	Fchanges                uintptr
  4350  	Fclose                  uintptr
  4351  	Fcollation_needed       uintptr
  4352  	Fcollation_needed16     uintptr
  4353  	Fcolumn_blob            uintptr
  4354  	Fcolumn_bytes           uintptr
  4355  	Fcolumn_bytes16         uintptr
  4356  	Fcolumn_count           uintptr
  4357  	Fcolumn_database_name   uintptr
  4358  	Fcolumn_database_name16 uintptr
  4359  	Fcolumn_decltype        uintptr
  4360  	Fcolumn_decltype16      uintptr
  4361  	Fcolumn_double          uintptr
  4362  	Fcolumn_int             uintptr
  4363  	Fcolumn_int64           uintptr
  4364  	Fcolumn_name            uintptr
  4365  	Fcolumn_name16          uintptr
  4366  	Fcolumn_origin_name     uintptr
  4367  	Fcolumn_origin_name16   uintptr
  4368  	Fcolumn_table_name      uintptr
  4369  	Fcolumn_table_name16    uintptr
  4370  	Fcolumn_text            uintptr
  4371  	Fcolumn_text16          uintptr
  4372  	Fcolumn_type            uintptr
  4373  	Fcolumn_value           uintptr
  4374  	Fcommit_hook            uintptr
  4375  	Fcomplete               uintptr
  4376  	Fcomplete16             uintptr
  4377  	Fcreate_collation       uintptr
  4378  	Fcreate_collation16     uintptr
  4379  	Fcreate_function        uintptr
  4380  	Fcreate_function16      uintptr
  4381  	Fcreate_module          uintptr
  4382  	Fdata_count             uintptr
  4383  	Fdb_handle              uintptr
  4384  	Fdeclare_vtab           uintptr
  4385  	Fenable_shared_cache    uintptr
  4386  	Ferrcode                uintptr
  4387  	Ferrmsg                 uintptr
  4388  	Ferrmsg16               uintptr
  4389  	Fexec                   uintptr
  4390  	Fexpired                uintptr
  4391  	Ffinalize               uintptr
  4392  	Ffree                   uintptr
  4393  	Ffree_table             uintptr
  4394  	Fget_autocommit         uintptr
  4395  	Fget_auxdata            uintptr
  4396  	Fget_table              uintptr
  4397  	Fglobal_recover         uintptr
  4398  	Finterruptx             uintptr
  4399  	Flast_insert_rowid      uintptr
  4400  	Flibversion             uintptr
  4401  	Flibversion_number      uintptr
  4402  	Fmalloc                 uintptr
  4403  	Fmprintf                uintptr
  4404  	Fopen                   uintptr
  4405  	Fopen16                 uintptr
  4406  	Fprepare                uintptr
  4407  	Fprepare16              uintptr
  4408  	Fprofile                uintptr
  4409  	Fprogress_handler       uintptr
  4410  	Frealloc                uintptr
  4411  	Freset                  uintptr
  4412  	Fresult_blob            uintptr
  4413  	Fresult_double          uintptr
  4414  	Fresult_error           uintptr
  4415  	Fresult_error16         uintptr
  4416  	Fresult_int             uintptr
  4417  	Fresult_int64           uintptr
  4418  	Fresult_null            uintptr
  4419  	Fresult_text            uintptr
  4420  	Fresult_text16          uintptr
  4421  	Fresult_text16be        uintptr
  4422  	Fresult_text16le        uintptr
  4423  	Fresult_value           uintptr
  4424  	Frollback_hook          uintptr
  4425  	Fset_authorizer         uintptr
  4426  	Fset_auxdata            uintptr
  4427  	Fxsnprintf              uintptr
  4428  	Fstep                   uintptr
  4429  	Ftable_column_metadata  uintptr
  4430  	Fthread_cleanup         uintptr
  4431  	Ftotal_changes          uintptr
  4432  	Ftrace                  uintptr
  4433  	Ftransfer_bindings      uintptr
  4434  	Fupdate_hook            uintptr
  4435  	Fuser_data              uintptr
  4436  	Fvalue_blob             uintptr
  4437  	Fvalue_bytes            uintptr
  4438  	Fvalue_bytes16          uintptr
  4439  	Fvalue_double           uintptr
  4440  	Fvalue_int              uintptr
  4441  	Fvalue_int64            uintptr
  4442  	Fvalue_numeric_type     uintptr
  4443  	Fvalue_text             uintptr
  4444  	Fvalue_text16           uintptr
  4445  	Fvalue_text16be         uintptr
  4446  	Fvalue_text16le         uintptr
  4447  	Fvalue_type             uintptr
  4448  	Fvmprintf               uintptr
  4449  	Foverload_function      uintptr
  4450  	Fprepare_v2             uintptr
  4451  	Fprepare16_v2           uintptr
  4452  	Fclear_bindings         uintptr
  4453  	Fcreate_module_v2       uintptr
  4454  	Fbind_zeroblob          uintptr
  4455  	Fblob_bytes             uintptr
  4456  	Fblob_close             uintptr
  4457  	Fblob_open              uintptr
  4458  	Fblob_read              uintptr
  4459  	Fblob_write             uintptr
  4460  	Fcreate_collation_v2    uintptr
  4461  	Ffile_control           uintptr
  4462  	Fmemory_highwater       uintptr
  4463  	Fmemory_used            uintptr
  4464  	Fmutex_alloc            uintptr
  4465  	Fmutex_enter            uintptr
  4466  	Fmutex_free             uintptr
  4467  	Fmutex_leave            uintptr
  4468  	Fmutex_try              uintptr
  4469  	Fopen_v2                uintptr
  4470  	Frelease_memory         uintptr
  4471  	Fresult_error_nomem     uintptr
  4472  	Fresult_error_toobig    uintptr
  4473  	Fsleep                  uintptr
  4474  	Fsoft_heap_limit        uintptr
  4475  	Fvfs_find               uintptr
  4476  	Fvfs_register           uintptr
  4477  	Fvfs_unregister         uintptr
  4478  	Fxthreadsafe            uintptr
  4479  	Fresult_zeroblob        uintptr
  4480  	Fresult_error_code      uintptr
  4481  	Ftest_control           uintptr
  4482  	Frandomness             uintptr
  4483  	Fcontext_db_handle      uintptr
  4484  	Fextended_result_codes  uintptr
  4485  	Flimit                  uintptr
  4486  	Fnext_stmt              uintptr
  4487  	Fsql                    uintptr
  4488  	Fstatus                 uintptr
  4489  	Fbackup_finish          uintptr
  4490  	Fbackup_init            uintptr
  4491  	Fbackup_pagecount       uintptr
  4492  	Fbackup_remaining       uintptr
  4493  	Fbackup_step            uintptr
  4494  	Fcompileoption_get      uintptr
  4495  	Fcompileoption_used     uintptr
  4496  	Fcreate_function_v2     uintptr
  4497  	Fdb_config              uintptr
  4498  	Fdb_mutex               uintptr
  4499  	Fdb_status              uintptr
  4500  	Fextended_errcode       uintptr
  4501  	Flog                    uintptr
  4502  	Fsoft_heap_limit64      uintptr
  4503  	Fsourceid               uintptr
  4504  	Fstmt_status            uintptr
  4505  	Fstrnicmp               uintptr
  4506  	Funlock_notify          uintptr
  4507  	Fwal_autocheckpoint     uintptr
  4508  	Fwal_checkpoint         uintptr
  4509  	Fwal_hook               uintptr
  4510  	Fblob_reopen            uintptr
  4511  	Fvtab_config            uintptr
  4512  	Fvtab_on_conflict       uintptr
  4513  	Fclose_v2               uintptr
  4514  	Fdb_filename            uintptr
  4515  	Fdb_readonly            uintptr
  4516  	Fdb_release_memory      uintptr
  4517  	Ferrstr                 uintptr
  4518  	Fstmt_busy              uintptr
  4519  	Fstmt_readonly          uintptr
  4520  	Fstricmp                uintptr
  4521  	Furi_boolean            uintptr
  4522  	Furi_int64              uintptr
  4523  	Furi_parameter          uintptr
  4524  	Fxvsnprintf             uintptr
  4525  	Fwal_checkpoint_v2      uintptr
  4526  	Fauto_extension         uintptr
  4527  	Fbind_blob64            uintptr
  4528  	Fbind_text64            uintptr
  4529  	Fcancel_auto_extension  uintptr
  4530  	Fload_extension         uintptr
  4531  	Fmalloc64               uintptr
  4532  	Fmsize                  uintptr
  4533  	Frealloc64              uintptr
  4534  	Freset_auto_extension   uintptr
  4535  	Fresult_blob64          uintptr
  4536  	Fresult_text64          uintptr
  4537  	Fstrglob                uintptr
  4538  	Fvalue_dup              uintptr
  4539  	Fvalue_free             uintptr
  4540  	Fresult_zeroblob64      uintptr
  4541  	Fbind_zeroblob64        uintptr
  4542  	Fvalue_subtype          uintptr
  4543  	Fresult_subtype         uintptr
  4544  	Fstatus64               uintptr
  4545  	Fstrlike                uintptr
  4546  	Fdb_cacheflush          uintptr
  4547  	Fsystem_errno           uintptr
  4548  	Ftrace_v2               uintptr
  4549  	Fexpanded_sql           uintptr
  4550  	Fset_last_insert_rowid  uintptr
  4551  	Fprepare_v3             uintptr
  4552  	Fprepare16_v3           uintptr
  4553  	Fbind_pointer           uintptr
  4554  	Fresult_pointer         uintptr
  4555  	Fvalue_pointer          uintptr
  4556  	Fvtab_nochange          uintptr
  4557  	Fvalue_nochange         uintptr
  4558  	Fvtab_collation         uintptr
  4559  	Fkeyword_count          uintptr
  4560  	Fkeyword_name           uintptr
  4561  	Fkeyword_check          uintptr
  4562  	Fstr_new                uintptr
  4563  	Fstr_finish             uintptr
  4564  	Fstr_appendf            uintptr
  4565  	Fstr_vappendf           uintptr
  4566  	Fstr_append             uintptr
  4567  	Fstr_appendall          uintptr
  4568  	Fstr_appendchar         uintptr
  4569  	Fstr_reset              uintptr
  4570  	Fstr_errcode            uintptr
  4571  	Fstr_length             uintptr
  4572  	Fstr_value              uintptr
  4573  	Fcreate_window_function uintptr
  4574  	Fnormalized_sql         uintptr
  4575  	Fstmt_isexplain         uintptr
  4576  	Fvalue_frombind         uintptr
  4577  	Fdrop_modules           uintptr
  4578  	Fhard_heap_limit64      uintptr
  4579  	Furi_key                uintptr
  4580  	Ffilename_database      uintptr
  4581  	Ffilename_journal       uintptr
  4582  	Ffilename_wal           uintptr
  4583  	Fcreate_filename        uintptr
  4584  	Ffree_filename          uintptr
  4585  	Fdatabase_file_object   uintptr
  4586  	Ftxn_state              uintptr
  4587  } /* sqlite3.h:1216:9 */
  4588  
  4589  // CAPI3REF: OS Interface Object
  4590  //
  4591  // An instance of the sqlite3_vfs object defines the interface between
  4592  // the SQLite core and the underlying operating system.  The "vfs"
  4593  // in the name of the object stands for "virtual file system".  See
  4594  // the [VFS | VFS documentation] for further information.
  4595  //
  4596  // The VFS interface is sometimes extended by adding new methods onto
  4597  // the end.  Each time such an extension occurs, the iVersion field
  4598  // is incremented.  The iVersion value started out as 1 in
  4599  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  4600  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  4601  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  4602  // may be appended to the sqlite3_vfs object and the iVersion value
  4603  // may increase again in future versions of SQLite.
  4604  // Note that due to an oversight, the structure
  4605  // of the sqlite3_vfs object changed in the transition from
  4606  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  4607  // and yet the iVersion field was not increased.
  4608  //
  4609  // The szOsFile field is the size of the subclassed [sqlite3_file]
  4610  // structure used by this VFS.  mxPathname is the maximum length of
  4611  // a pathname in this VFS.
  4612  //
  4613  // Registered sqlite3_vfs objects are kept on a linked list formed by
  4614  // the pNext pointer.  The [sqlite3_vfs_register()]
  4615  // and [sqlite3_vfs_unregister()] interfaces manage this list
  4616  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  4617  // searches the list.  Neither the application code nor the VFS
  4618  // implementation should use the pNext pointer.
  4619  //
  4620  // The pNext field is the only field in the sqlite3_vfs
  4621  // structure that SQLite will ever modify.  SQLite will only access
  4622  // or modify this field while holding a particular static mutex.
  4623  // The application should never modify anything within the sqlite3_vfs
  4624  // object once the object has been registered.
  4625  //
  4626  // The zName field holds the name of the VFS module.  The name must
  4627  // be unique across all VFS modules.
  4628  //
  4629  // [[sqlite3_vfs.xOpen]]
  4630  // ^SQLite guarantees that the zFilename parameter to xOpen
  4631  // is either a NULL pointer or string obtained
  4632  // from xFullPathname() with an optional suffix added.
  4633  // ^If a suffix is added to the zFilename parameter, it will
  4634  // consist of a single "-" character followed by no more than
  4635  // 11 alphanumeric and/or "-" characters.
  4636  // ^SQLite further guarantees that
  4637  // the string will be valid and unchanged until xClose() is
  4638  // called. Because of the previous sentence,
  4639  // the [sqlite3_file] can safely store a pointer to the
  4640  // filename if it needs to remember the filename for some reason.
  4641  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  4642  // must invent its own temporary name for the file.  ^Whenever the
  4643  // xFilename parameter is NULL it will also be the case that the
  4644  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  4645  //
  4646  // The flags argument to xOpen() includes all bits set in
  4647  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  4648  // or [sqlite3_open16()] is used, then flags includes at least
  4649  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  4650  // If xOpen() opens a file read-only then it sets *pOutFlags to
  4651  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  4652  //
  4653  // ^(SQLite will also add one of the following flags to the xOpen()
  4654  // call, depending on the object being opened:
  4655  //
  4656  // <ul>
  4657  // <li>  [SQLITE_OPEN_MAIN_DB]
  4658  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  4659  // <li>  [SQLITE_OPEN_TEMP_DB]
  4660  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  4661  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  4662  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  4663  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  4664  // <li>  [SQLITE_OPEN_WAL]
  4665  // </ul>)^
  4666  //
  4667  // The file I/O implementation can use the object type flags to
  4668  // change the way it deals with files.  For example, an application
  4669  // that does not care about crash recovery or rollback might make
  4670  // the open of a journal file a no-op.  Writes to this journal would
  4671  // also be no-ops, and any attempt to read the journal would return
  4672  // SQLITE_IOERR.  Or the implementation might recognize that a database
  4673  // file will be doing page-aligned sector reads and writes in a random
  4674  // order and set up its I/O subsystem accordingly.
  4675  //
  4676  // SQLite might also add one of the following flags to the xOpen method:
  4677  //
  4678  // <ul>
  4679  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  4680  // <li> [SQLITE_OPEN_EXCLUSIVE]
  4681  // </ul>
  4682  //
  4683  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  4684  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  4685  // will be set for TEMP databases and their journals, transient
  4686  // databases, and subjournals.
  4687  //
  4688  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  4689  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  4690  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  4691  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  4692  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  4693  // be created, and that it is an error if it already exists.
  4694  // It is <i>not</i> used to indicate the file should be opened
  4695  // for exclusive access.
  4696  //
  4697  // ^At least szOsFile bytes of memory are allocated by SQLite
  4698  // to hold the [sqlite3_file] structure passed as the third
  4699  // argument to xOpen.  The xOpen method does not have to
  4700  // allocate the structure; it should just fill it in.  Note that
  4701  // the xOpen method must set the sqlite3_file.pMethods to either
  4702  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  4703  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  4704  // element will be valid after xOpen returns regardless of the success
  4705  // or failure of the xOpen call.
  4706  //
  4707  // [[sqlite3_vfs.xAccess]]
  4708  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  4709  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  4710  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  4711  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  4712  // flag is never actually used and is not implemented in the built-in
  4713  // VFSes of SQLite.  The file is named by the second argument and can be a
  4714  // directory. The xAccess method returns [SQLITE_OK] on success or some
  4715  // non-zero error code if there is an I/O error or if the name of
  4716  // the file given in the second argument is illegal.  If SQLITE_OK
  4717  // is returned, then non-zero or zero is written into *pResOut to indicate
  4718  // whether or not the file is accessible.
  4719  //
  4720  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  4721  // output buffer xFullPathname.  The exact size of the output buffer
  4722  // is also passed as a parameter to both  methods. If the output buffer
  4723  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  4724  // handled as a fatal error by SQLite, vfs implementations should endeavor
  4725  // to prevent this by setting mxPathname to a sufficiently large value.
  4726  //
  4727  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  4728  // interfaces are not strictly a part of the filesystem, but they are
  4729  // included in the VFS structure for completeness.
  4730  // The xRandomness() function attempts to return nBytes bytes
  4731  // of good-quality randomness into zOut.  The return value is
  4732  // the actual number of bytes of randomness obtained.
  4733  // The xSleep() method causes the calling thread to sleep for at
  4734  // least the number of microseconds given.  ^The xCurrentTime()
  4735  // method returns a Julian Day Number for the current date and time as
  4736  // a floating point value.
  4737  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  4738  // Day Number multiplied by 86400000 (the number of milliseconds in
  4739  // a 24-hour day).
  4740  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  4741  // date and time if that method is available (if iVersion is 2 or
  4742  // greater and the function pointer is not NULL) and will fall back
  4743  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  4744  //
  4745  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  4746  // are not used by the SQLite core.  These optional interfaces are provided
  4747  // by some VFSes to facilitate testing of the VFS code. By overriding
  4748  // system calls with functions under its control, a test program can
  4749  // simulate faults and error conditions that would otherwise be difficult
  4750  // or impossible to induce.  The set of system calls that can be overridden
  4751  // varies from one VFS to another, and from one version of the same VFS to the
  4752  // next.  Applications that use these interfaces must be prepared for any
  4753  // or all of these interfaces to be NULL or for their behavior to change
  4754  // from one release to the next.  Applications must not attempt to access
  4755  // any of these methods if the iVersion of the VFS is less than 3.
  4756  type sqlite3_vfs1 = struct {
  4757  	FiVersion          int32
  4758  	FszOsFile          int32
  4759  	FmxPathname        int32
  4760  	_                  [4]byte
  4761  	FpNext             uintptr
  4762  	FzName             uintptr
  4763  	FpAppData          uintptr
  4764  	FxOpen             uintptr
  4765  	FxDelete           uintptr
  4766  	FxAccess           uintptr
  4767  	FxFullPathname     uintptr
  4768  	FxDlOpen           uintptr
  4769  	FxDlError          uintptr
  4770  	FxDlSym            uintptr
  4771  	FxDlClose          uintptr
  4772  	FxRandomness       uintptr
  4773  	FxSleep            uintptr
  4774  	FxCurrentTime      uintptr
  4775  	FxGetLastError     uintptr
  4776  	FxCurrentTimeInt64 uintptr
  4777  	FxSetSystemCall    uintptr
  4778  	FxGetSystemCall    uintptr
  4779  	FxNextSystemCall   uintptr
  4780  } /* sqlite3.h:1387:9 */
  4781  
  4782  // CAPI3REF: OS Interface Object
  4783  //
  4784  // An instance of the sqlite3_vfs object defines the interface between
  4785  // the SQLite core and the underlying operating system.  The "vfs"
  4786  // in the name of the object stands for "virtual file system".  See
  4787  // the [VFS | VFS documentation] for further information.
  4788  //
  4789  // The VFS interface is sometimes extended by adding new methods onto
  4790  // the end.  Each time such an extension occurs, the iVersion field
  4791  // is incremented.  The iVersion value started out as 1 in
  4792  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  4793  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  4794  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  4795  // may be appended to the sqlite3_vfs object and the iVersion value
  4796  // may increase again in future versions of SQLite.
  4797  // Note that due to an oversight, the structure
  4798  // of the sqlite3_vfs object changed in the transition from
  4799  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  4800  // and yet the iVersion field was not increased.
  4801  //
  4802  // The szOsFile field is the size of the subclassed [sqlite3_file]
  4803  // structure used by this VFS.  mxPathname is the maximum length of
  4804  // a pathname in this VFS.
  4805  //
  4806  // Registered sqlite3_vfs objects are kept on a linked list formed by
  4807  // the pNext pointer.  The [sqlite3_vfs_register()]
  4808  // and [sqlite3_vfs_unregister()] interfaces manage this list
  4809  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  4810  // searches the list.  Neither the application code nor the VFS
  4811  // implementation should use the pNext pointer.
  4812  //
  4813  // The pNext field is the only field in the sqlite3_vfs
  4814  // structure that SQLite will ever modify.  SQLite will only access
  4815  // or modify this field while holding a particular static mutex.
  4816  // The application should never modify anything within the sqlite3_vfs
  4817  // object once the object has been registered.
  4818  //
  4819  // The zName field holds the name of the VFS module.  The name must
  4820  // be unique across all VFS modules.
  4821  //
  4822  // [[sqlite3_vfs.xOpen]]
  4823  // ^SQLite guarantees that the zFilename parameter to xOpen
  4824  // is either a NULL pointer or string obtained
  4825  // from xFullPathname() with an optional suffix added.
  4826  // ^If a suffix is added to the zFilename parameter, it will
  4827  // consist of a single "-" character followed by no more than
  4828  // 11 alphanumeric and/or "-" characters.
  4829  // ^SQLite further guarantees that
  4830  // the string will be valid and unchanged until xClose() is
  4831  // called. Because of the previous sentence,
  4832  // the [sqlite3_file] can safely store a pointer to the
  4833  // filename if it needs to remember the filename for some reason.
  4834  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  4835  // must invent its own temporary name for the file.  ^Whenever the
  4836  // xFilename parameter is NULL it will also be the case that the
  4837  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  4838  //
  4839  // The flags argument to xOpen() includes all bits set in
  4840  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  4841  // or [sqlite3_open16()] is used, then flags includes at least
  4842  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  4843  // If xOpen() opens a file read-only then it sets *pOutFlags to
  4844  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  4845  //
  4846  // ^(SQLite will also add one of the following flags to the xOpen()
  4847  // call, depending on the object being opened:
  4848  //
  4849  // <ul>
  4850  // <li>  [SQLITE_OPEN_MAIN_DB]
  4851  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  4852  // <li>  [SQLITE_OPEN_TEMP_DB]
  4853  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  4854  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  4855  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  4856  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  4857  // <li>  [SQLITE_OPEN_WAL]
  4858  // </ul>)^
  4859  //
  4860  // The file I/O implementation can use the object type flags to
  4861  // change the way it deals with files.  For example, an application
  4862  // that does not care about crash recovery or rollback might make
  4863  // the open of a journal file a no-op.  Writes to this journal would
  4864  // also be no-ops, and any attempt to read the journal would return
  4865  // SQLITE_IOERR.  Or the implementation might recognize that a database
  4866  // file will be doing page-aligned sector reads and writes in a random
  4867  // order and set up its I/O subsystem accordingly.
  4868  //
  4869  // SQLite might also add one of the following flags to the xOpen method:
  4870  //
  4871  // <ul>
  4872  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  4873  // <li> [SQLITE_OPEN_EXCLUSIVE]
  4874  // </ul>
  4875  //
  4876  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  4877  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  4878  // will be set for TEMP databases and their journals, transient
  4879  // databases, and subjournals.
  4880  //
  4881  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  4882  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  4883  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  4884  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  4885  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  4886  // be created, and that it is an error if it already exists.
  4887  // It is <i>not</i> used to indicate the file should be opened
  4888  // for exclusive access.
  4889  //
  4890  // ^At least szOsFile bytes of memory are allocated by SQLite
  4891  // to hold the [sqlite3_file] structure passed as the third
  4892  // argument to xOpen.  The xOpen method does not have to
  4893  // allocate the structure; it should just fill it in.  Note that
  4894  // the xOpen method must set the sqlite3_file.pMethods to either
  4895  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  4896  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  4897  // element will be valid after xOpen returns regardless of the success
  4898  // or failure of the xOpen call.
  4899  //
  4900  // [[sqlite3_vfs.xAccess]]
  4901  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  4902  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  4903  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  4904  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  4905  // flag is never actually used and is not implemented in the built-in
  4906  // VFSes of SQLite.  The file is named by the second argument and can be a
  4907  // directory. The xAccess method returns [SQLITE_OK] on success or some
  4908  // non-zero error code if there is an I/O error or if the name of
  4909  // the file given in the second argument is illegal.  If SQLITE_OK
  4910  // is returned, then non-zero or zero is written into *pResOut to indicate
  4911  // whether or not the file is accessible.
  4912  //
  4913  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  4914  // output buffer xFullPathname.  The exact size of the output buffer
  4915  // is also passed as a parameter to both  methods. If the output buffer
  4916  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  4917  // handled as a fatal error by SQLite, vfs implementations should endeavor
  4918  // to prevent this by setting mxPathname to a sufficiently large value.
  4919  //
  4920  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  4921  // interfaces are not strictly a part of the filesystem, but they are
  4922  // included in the VFS structure for completeness.
  4923  // The xRandomness() function attempts to return nBytes bytes
  4924  // of good-quality randomness into zOut.  The return value is
  4925  // the actual number of bytes of randomness obtained.
  4926  // The xSleep() method causes the calling thread to sleep for at
  4927  // least the number of microseconds given.  ^The xCurrentTime()
  4928  // method returns a Julian Day Number for the current date and time as
  4929  // a floating point value.
  4930  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  4931  // Day Number multiplied by 86400000 (the number of milliseconds in
  4932  // a 24-hour day).
  4933  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  4934  // date and time if that method is available (if iVersion is 2 or
  4935  // greater and the function pointer is not NULL) and will fall back
  4936  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  4937  //
  4938  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  4939  // are not used by the SQLite core.  These optional interfaces are provided
  4940  // by some VFSes to facilitate testing of the VFS code. By overriding
  4941  // system calls with functions under its control, a test program can
  4942  // simulate faults and error conditions that would otherwise be difficult
  4943  // or impossible to induce.  The set of system calls that can be overridden
  4944  // varies from one VFS to another, and from one version of the same VFS to the
  4945  // next.  Applications that use these interfaces must be prepared for any
  4946  // or all of these interfaces to be NULL or for their behavior to change
  4947  // from one release to the next.  Applications must not attempt to access
  4948  // any of these methods if the iVersion of the VFS is less than 3.
  4949  type sqlite3_vfs = sqlite3_vfs1    /* sqlite3.h:1387:28 */
  4950  type sqlite3_syscall_ptr = uintptr /* sqlite3.h:1388:14 */
  4951  
  4952  // CAPI3REF: Memory Allocation Routines
  4953  //
  4954  // An instance of this object defines the interface between SQLite
  4955  // and low-level memory allocation routines.
  4956  //
  4957  // This object is used in only one place in the SQLite interface.
  4958  // A pointer to an instance of this object is the argument to
  4959  // [sqlite3_config()] when the configuration option is
  4960  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  4961  // By creating an instance of this object
  4962  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  4963  // during configuration, an application can specify an alternative
  4964  // memory allocation subsystem for SQLite to use for all of its
  4965  // dynamic memory needs.
  4966  //
  4967  // Note that SQLite comes with several [built-in memory allocators]
  4968  // that are perfectly adequate for the overwhelming majority of applications
  4969  // and that this object is only useful to a tiny minority of applications
  4970  // with specialized memory allocation requirements.  This object is
  4971  // also used during testing of SQLite in order to specify an alternative
  4972  // memory allocator that simulates memory out-of-memory conditions in
  4973  // order to verify that SQLite recovers gracefully from such
  4974  // conditions.
  4975  //
  4976  // The xMalloc, xRealloc, and xFree methods must work like the
  4977  // malloc(), realloc() and free() functions from the standard C library.
  4978  // ^SQLite guarantees that the second argument to
  4979  // xRealloc is always a value returned by a prior call to xRoundup.
  4980  //
  4981  // xSize should return the allocated size of a memory allocation
  4982  // previously obtained from xMalloc or xRealloc.  The allocated size
  4983  // is always at least as big as the requested size but may be larger.
  4984  //
  4985  // The xRoundup method returns what would be the allocated size of
  4986  // a memory allocation given a particular requested size.  Most memory
  4987  // allocators round up memory allocations at least to the next multiple
  4988  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  4989  // Every memory allocation request coming in through [sqlite3_malloc()]
  4990  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  4991  // that causes the corresponding memory allocation to fail.
  4992  //
  4993  // The xInit method initializes the memory allocator.  For example,
  4994  // it might allocate any required mutexes or initialize internal data
  4995  // structures.  The xShutdown method is invoked (indirectly) by
  4996  // [sqlite3_shutdown()] and should deallocate any resources acquired
  4997  // by xInit.  The pAppData pointer is used as the only parameter to
  4998  // xInit and xShutdown.
  4999  //
  5000  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  5001  // the xInit method, so the xInit method need not be threadsafe.  The
  5002  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5003  // not need to be threadsafe either.  For all other methods, SQLite
  5004  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  5005  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  5006  // it is by default) and so the methods are automatically serialized.
  5007  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  5008  // methods must be threadsafe or else make their own arrangements for
  5009  // serialization.
  5010  //
  5011  // SQLite will never invoke xInit() more than once without an intervening
  5012  // call to xShutdown().
  5013  type sqlite3_mem_methods1 = struct {
  5014  	FxMalloc   uintptr
  5015  	FxFree     uintptr
  5016  	FxRealloc  uintptr
  5017  	FxSize     uintptr
  5018  	FxRoundup  uintptr
  5019  	FxInit     uintptr
  5020  	FxShutdown uintptr
  5021  	FpAppData  uintptr
  5022  } /* sqlite3.h:1685:9 */
  5023  
  5024  // CAPI3REF: Memory Allocation Routines
  5025  //
  5026  // An instance of this object defines the interface between SQLite
  5027  // and low-level memory allocation routines.
  5028  //
  5029  // This object is used in only one place in the SQLite interface.
  5030  // A pointer to an instance of this object is the argument to
  5031  // [sqlite3_config()] when the configuration option is
  5032  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  5033  // By creating an instance of this object
  5034  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  5035  // during configuration, an application can specify an alternative
  5036  // memory allocation subsystem for SQLite to use for all of its
  5037  // dynamic memory needs.
  5038  //
  5039  // Note that SQLite comes with several [built-in memory allocators]
  5040  // that are perfectly adequate for the overwhelming majority of applications
  5041  // and that this object is only useful to a tiny minority of applications
  5042  // with specialized memory allocation requirements.  This object is
  5043  // also used during testing of SQLite in order to specify an alternative
  5044  // memory allocator that simulates memory out-of-memory conditions in
  5045  // order to verify that SQLite recovers gracefully from such
  5046  // conditions.
  5047  //
  5048  // The xMalloc, xRealloc, and xFree methods must work like the
  5049  // malloc(), realloc() and free() functions from the standard C library.
  5050  // ^SQLite guarantees that the second argument to
  5051  // xRealloc is always a value returned by a prior call to xRoundup.
  5052  //
  5053  // xSize should return the allocated size of a memory allocation
  5054  // previously obtained from xMalloc or xRealloc.  The allocated size
  5055  // is always at least as big as the requested size but may be larger.
  5056  //
  5057  // The xRoundup method returns what would be the allocated size of
  5058  // a memory allocation given a particular requested size.  Most memory
  5059  // allocators round up memory allocations at least to the next multiple
  5060  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  5061  // Every memory allocation request coming in through [sqlite3_malloc()]
  5062  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  5063  // that causes the corresponding memory allocation to fail.
  5064  //
  5065  // The xInit method initializes the memory allocator.  For example,
  5066  // it might allocate any required mutexes or initialize internal data
  5067  // structures.  The xShutdown method is invoked (indirectly) by
  5068  // [sqlite3_shutdown()] and should deallocate any resources acquired
  5069  // by xInit.  The pAppData pointer is used as the only parameter to
  5070  // xInit and xShutdown.
  5071  //
  5072  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  5073  // the xInit method, so the xInit method need not be threadsafe.  The
  5074  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5075  // not need to be threadsafe either.  For all other methods, SQLite
  5076  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  5077  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  5078  // it is by default) and so the methods are automatically serialized.
  5079  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  5080  // methods must be threadsafe or else make their own arrangements for
  5081  // serialization.
  5082  //
  5083  // SQLite will never invoke xInit() more than once without an intervening
  5084  // call to xShutdown().
  5085  type sqlite3_mem_methods = sqlite3_mem_methods1 /* sqlite3.h:1685:36 */
  5086  
  5087  // CAPI3REF: Dynamically Typed Value Object
  5088  // KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
  5089  //
  5090  // SQLite uses the sqlite3_value object to represent all values
  5091  // that can be stored in a database table. SQLite uses dynamic typing
  5092  // for the values it stores.  ^Values stored in sqlite3_value objects
  5093  // can be integers, floating point values, strings, BLOBs, or NULL.
  5094  //
  5095  // An sqlite3_value object may be either "protected" or "unprotected".
  5096  // Some interfaces require a protected sqlite3_value.  Other interfaces
  5097  // will accept either a protected or an unprotected sqlite3_value.
  5098  // Every interface that accepts sqlite3_value arguments specifies
  5099  // whether or not it requires a protected sqlite3_value.  The
  5100  // [sqlite3_value_dup()] interface can be used to construct a new
  5101  // protected sqlite3_value from an unprotected sqlite3_value.
  5102  //
  5103  // The terms "protected" and "unprotected" refer to whether or not
  5104  // a mutex is held.  An internal mutex is held for a protected
  5105  // sqlite3_value object but no mutex is held for an unprotected
  5106  // sqlite3_value object.  If SQLite is compiled to be single-threaded
  5107  // (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
  5108  // or if SQLite is run in one of reduced mutex modes
  5109  // [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
  5110  // then there is no distinction between protected and unprotected
  5111  // sqlite3_value objects and they can be used interchangeably.  However,
  5112  // for maximum code portability it is recommended that applications
  5113  // still make the distinction between protected and unprotected
  5114  // sqlite3_value objects even when not strictly required.
  5115  //
  5116  // ^The sqlite3_value objects that are passed as parameters into the
  5117  // implementation of [application-defined SQL functions] are protected.
  5118  // ^The sqlite3_value object returned by
  5119  // [sqlite3_column_value()] is unprotected.
  5120  // Unprotected sqlite3_value objects may only be used as arguments
  5121  // to [sqlite3_result_value()], [sqlite3_bind_value()], and
  5122  // [sqlite3_value_dup()].
  5123  // The [sqlite3_value_blob | sqlite3_value_type()] family of
  5124  // interfaces require protected sqlite3_value objects.
  5125  type sqlite3_value1 = struct {
  5126  	Fu        struct{ Fr float64 }
  5127  	Fflags    u16
  5128  	Fenc      u8
  5129  	FeSubtype u8
  5130  	Fn        int32
  5131  	Fz        uintptr
  5132  	FzMalloc  uintptr
  5133  	FszMalloc int32
  5134  	FuTemp    u32
  5135  	Fdb       uintptr
  5136  	FxDel     uintptr
  5137  } /* sqlite3.h:249:9 */
  5138  
  5139  // CAPI3REF: SQL Function Context Object
  5140  //
  5141  // The context in which an SQL function executes is stored in an
  5142  // sqlite3_context object.  ^A pointer to an sqlite3_context object
  5143  // is always first parameter to [application-defined SQL functions].
  5144  // The application-defined SQL function implementation will pass this
  5145  // pointer through into calls to [sqlite3_result_int | sqlite3_result()],
  5146  // [sqlite3_aggregate_context()], [sqlite3_user_data()],
  5147  // [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
  5148  // and/or [sqlite3_set_auxdata()].
  5149  type sqlite3_context1 = struct {
  5150  	FpOut     uintptr
  5151  	FpFunc    uintptr
  5152  	FpMem     uintptr
  5153  	FpVdbe    uintptr
  5154  	FiOp      int32
  5155  	FisError  int32
  5156  	FskipFlag u8
  5157  	Fargc     u8
  5158  	_         [6]byte
  5159  	Fargv     [1]uintptr
  5160  } /* sqlite3.h:249:9 */
  5161  
  5162  // CAPI3REF: Constants Defining Special Destructor Behavior
  5163  //
  5164  // These are special values for the destructor that is passed in as the
  5165  // final argument to routines like [sqlite3_result_blob()].  ^If the destructor
  5166  // argument is SQLITE_STATIC, it means that the content pointer is constant
  5167  // and will never change.  It does not need to be destroyed.  ^The
  5168  // SQLITE_TRANSIENT value means that the content will likely change in
  5169  // the near future and that SQLite should make its own private copy of
  5170  // the content before returning.
  5171  //
  5172  // The typedef is necessary to work around problems in certain
  5173  // C++ compilers.
  5174  type sqlite3_destructor_type = uintptr /* sqlite3.h:5665:14 */
  5175  
  5176  // The interface to the virtual-table mechanism is currently considered
  5177  // to be experimental.  The interface might change in incompatible ways.
  5178  // If this is a problem for you, do not use the interface at this time.
  5179  //
  5180  // When the virtual-table mechanism stabilizes, we will declare the
  5181  // interface fixed, support it indefinitely, and remove this comment.
  5182  
  5183  // Structures used by the virtual table interface
  5184  type sqlite3_vtab1 = struct {
  5185  	FpModule uintptr
  5186  	FnRef    int32
  5187  	_        [4]byte
  5188  	FzErrMsg uintptr
  5189  } /* sqlite3.h:6784:9 */
  5190  
  5191  // The interface to the virtual-table mechanism is currently considered
  5192  // to be experimental.  The interface might change in incompatible ways.
  5193  // If this is a problem for you, do not use the interface at this time.
  5194  //
  5195  // When the virtual-table mechanism stabilizes, we will declare the
  5196  // interface fixed, support it indefinitely, and remove this comment.
  5197  
  5198  // Structures used by the virtual table interface
  5199  type sqlite3_vtab = sqlite3_vtab1 /* sqlite3.h:6784:29 */
  5200  type sqlite3_index_info1 = struct {
  5201  	FnConstraint      int32
  5202  	_                 [4]byte
  5203  	FaConstraint      uintptr
  5204  	FnOrderBy         int32
  5205  	_                 [4]byte
  5206  	FaOrderBy         uintptr
  5207  	FaConstraintUsage uintptr
  5208  	FidxNum           int32
  5209  	_                 [4]byte
  5210  	FidxStr           uintptr
  5211  	FneedToFreeIdxStr int32
  5212  	ForderByConsumed  int32
  5213  	FestimatedCost    float64
  5214  	FestimatedRows    sqlite3_int64
  5215  	FidxFlags         int32
  5216  	_                 [4]byte
  5217  	FcolUsed          sqlite3_uint64
  5218  } /* sqlite3.h:6785:9 */
  5219  
  5220  type sqlite3_index_info = sqlite3_index_info1        /* sqlite3.h:6785:35 */
  5221  type sqlite3_vtab_cursor1 = struct{ FpVtab uintptr } /* sqlite3.h:6786:9 */
  5222  
  5223  type sqlite3_vtab_cursor = sqlite3_vtab_cursor1 /* sqlite3.h:6786:36 */
  5224  type sqlite3_module1 = struct {
  5225  	FiVersion      int32
  5226  	_              [4]byte
  5227  	FxCreate       uintptr
  5228  	FxConnect      uintptr
  5229  	FxBestIndex    uintptr
  5230  	FxDisconnect   uintptr
  5231  	FxDestroy      uintptr
  5232  	FxOpen         uintptr
  5233  	FxClose        uintptr
  5234  	FxFilter       uintptr
  5235  	FxNext         uintptr
  5236  	FxEof          uintptr
  5237  	FxColumn       uintptr
  5238  	FxRowid        uintptr
  5239  	FxUpdate       uintptr
  5240  	FxBegin        uintptr
  5241  	FxSync         uintptr
  5242  	FxCommit       uintptr
  5243  	FxRollback     uintptr
  5244  	FxFindFunction uintptr
  5245  	FxRename       uintptr
  5246  	FxSavepoint    uintptr
  5247  	FxRelease      uintptr
  5248  	FxRollbackTo   uintptr
  5249  	FxShadowName   uintptr
  5250  } /* sqlite3.h:6784:9 */
  5251  
  5252  type sqlite3_module = sqlite3_module1 /* sqlite3.h:6787:31 */
  5253  
  5254  // CAPI3REF: Virtual Table Indexing Information
  5255  // KEYWORDS: sqlite3_index_info
  5256  //
  5257  // The sqlite3_index_info structure and its substructures is used as part
  5258  // of the [virtual table] interface to
  5259  // pass information into and receive the reply from the [xBestIndex]
  5260  // method of a [virtual table module].  The fields under **Inputs** are the
  5261  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  5262  // results into the **Outputs** fields.
  5263  //
  5264  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  5265  //
  5266  // <blockquote>column OP expr</blockquote>
  5267  //
  5268  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  5269  // stored in aConstraint[].op using one of the
  5270  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  5271  // ^(The index of the column is stored in
  5272  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  5273  // expr on the right-hand side can be evaluated (and thus the constraint
  5274  // is usable) and false if it cannot.)^
  5275  //
  5276  // ^The optimizer automatically inverts terms of the form "expr OP column"
  5277  // and makes other simplifications to the WHERE clause in an attempt to
  5278  // get as many WHERE clause terms into the form shown above as possible.
  5279  // ^The aConstraint[] array only reports WHERE clause terms that are
  5280  // relevant to the particular virtual table being queried.
  5281  //
  5282  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  5283  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  5284  //
  5285  // The colUsed field indicates which columns of the virtual table may be
  5286  // required by the current scan. Virtual table columns are numbered from
  5287  // zero in the order in which they appear within the CREATE TABLE statement
  5288  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  5289  // the corresponding bit is set within the colUsed mask if the column may be
  5290  // required by SQLite. If the table has at least 64 columns and any column
  5291  // to the right of the first 63 is required, then bit 63 of colUsed is also
  5292  // set. In other words, column iCol may be required if the expression
  5293  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  5294  // non-zero.
  5295  //
  5296  // The [xBestIndex] method must fill aConstraintUsage[] with information
  5297  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  5298  // the right-hand side of the corresponding aConstraint[] is evaluated
  5299  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  5300  // is true, then the constraint is assumed to be fully handled by the
  5301  // virtual table and might not be checked again by the byte code.)^ ^(The
  5302  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  5303  // is left in its default setting of false, the constraint will always be
  5304  // checked separately in byte code.  If the omit flag is change to true, then
  5305  // the constraint may or may not be checked in byte code.  In other words,
  5306  // when the omit flag is true there is no guarantee that the constraint will
  5307  // not be checked again using byte code.)^
  5308  //
  5309  // ^The idxNum and idxPtr values are recorded and passed into the
  5310  // [xFilter] method.
  5311  // ^[sqlite3_free()] is used to free idxPtr if and only if
  5312  // needToFreeIdxPtr is true.
  5313  //
  5314  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  5315  // the correct order to satisfy the ORDER BY clause so that no separate
  5316  // sorting step is required.
  5317  //
  5318  // ^The estimatedCost value is an estimate of the cost of a particular
  5319  // strategy. A cost of N indicates that the cost of the strategy is similar
  5320  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  5321  // indicates that the expense of the operation is similar to that of a
  5322  // binary search on a unique indexed field of an SQLite table with N rows.
  5323  //
  5324  // ^The estimatedRows value is an estimate of the number of rows that
  5325  // will be returned by the strategy.
  5326  //
  5327  // The xBestIndex method may optionally populate the idxFlags field with a
  5328  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  5329  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  5330  // assumes that the strategy may visit at most one row.
  5331  //
  5332  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  5333  // SQLite also assumes that if a call to the xUpdate() method is made as
  5334  // part of the same statement to delete or update a virtual table row and the
  5335  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  5336  // any database changes. In other words, if the xUpdate() returns
  5337  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  5338  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  5339  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  5340  // the xUpdate method are automatically rolled back by SQLite.
  5341  //
  5342  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  5343  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  5344  // If a virtual table extension is
  5345  // used with an SQLite version earlier than 3.8.2, the results of attempting
  5346  // to read or write the estimatedRows field are undefined (but are likely
  5347  // to include crashing the application). The estimatedRows field should
  5348  // therefore only be used if [sqlite3_libversion_number()] returns a
  5349  // value greater than or equal to 3008002. Similarly, the idxFlags field
  5350  // was added for [version 3.9.0] ([dateof:3.9.0]).
  5351  // It may therefore only be used if
  5352  // sqlite3_libversion_number() returns a value greater than or equal to
  5353  // 3009000.
  5354  type sqlite3_index_constraint = struct {
  5355  	FiColumn     int32
  5356  	Fop          uint8
  5357  	Fusable      uint8
  5358  	_            [2]byte
  5359  	FiTermOffset int32
  5360  } /* sqlite3.h:6785:9 */
  5361  
  5362  // CAPI3REF: Virtual Table Indexing Information
  5363  // KEYWORDS: sqlite3_index_info
  5364  //
  5365  // The sqlite3_index_info structure and its substructures is used as part
  5366  // of the [virtual table] interface to
  5367  // pass information into and receive the reply from the [xBestIndex]
  5368  // method of a [virtual table module].  The fields under **Inputs** are the
  5369  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  5370  // results into the **Outputs** fields.
  5371  //
  5372  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  5373  //
  5374  // <blockquote>column OP expr</blockquote>
  5375  //
  5376  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  5377  // stored in aConstraint[].op using one of the
  5378  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  5379  // ^(The index of the column is stored in
  5380  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  5381  // expr on the right-hand side can be evaluated (and thus the constraint
  5382  // is usable) and false if it cannot.)^
  5383  //
  5384  // ^The optimizer automatically inverts terms of the form "expr OP column"
  5385  // and makes other simplifications to the WHERE clause in an attempt to
  5386  // get as many WHERE clause terms into the form shown above as possible.
  5387  // ^The aConstraint[] array only reports WHERE clause terms that are
  5388  // relevant to the particular virtual table being queried.
  5389  //
  5390  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  5391  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  5392  //
  5393  // The colUsed field indicates which columns of the virtual table may be
  5394  // required by the current scan. Virtual table columns are numbered from
  5395  // zero in the order in which they appear within the CREATE TABLE statement
  5396  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  5397  // the corresponding bit is set within the colUsed mask if the column may be
  5398  // required by SQLite. If the table has at least 64 columns and any column
  5399  // to the right of the first 63 is required, then bit 63 of colUsed is also
  5400  // set. In other words, column iCol may be required if the expression
  5401  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  5402  // non-zero.
  5403  //
  5404  // The [xBestIndex] method must fill aConstraintUsage[] with information
  5405  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  5406  // the right-hand side of the corresponding aConstraint[] is evaluated
  5407  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  5408  // is true, then the constraint is assumed to be fully handled by the
  5409  // virtual table and might not be checked again by the byte code.)^ ^(The
  5410  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  5411  // is left in its default setting of false, the constraint will always be
  5412  // checked separately in byte code.  If the omit flag is change to true, then
  5413  // the constraint may or may not be checked in byte code.  In other words,
  5414  // when the omit flag is true there is no guarantee that the constraint will
  5415  // not be checked again using byte code.)^
  5416  //
  5417  // ^The idxNum and idxPtr values are recorded and passed into the
  5418  // [xFilter] method.
  5419  // ^[sqlite3_free()] is used to free idxPtr if and only if
  5420  // needToFreeIdxPtr is true.
  5421  //
  5422  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  5423  // the correct order to satisfy the ORDER BY clause so that no separate
  5424  // sorting step is required.
  5425  //
  5426  // ^The estimatedCost value is an estimate of the cost of a particular
  5427  // strategy. A cost of N indicates that the cost of the strategy is similar
  5428  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  5429  // indicates that the expense of the operation is similar to that of a
  5430  // binary search on a unique indexed field of an SQLite table with N rows.
  5431  //
  5432  // ^The estimatedRows value is an estimate of the number of rows that
  5433  // will be returned by the strategy.
  5434  //
  5435  // The xBestIndex method may optionally populate the idxFlags field with a
  5436  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  5437  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  5438  // assumes that the strategy may visit at most one row.
  5439  //
  5440  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  5441  // SQLite also assumes that if a call to the xUpdate() method is made as
  5442  // part of the same statement to delete or update a virtual table row and the
  5443  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  5444  // any database changes. In other words, if the xUpdate() returns
  5445  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  5446  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  5447  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  5448  // the xUpdate method are automatically rolled back by SQLite.
  5449  //
  5450  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  5451  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  5452  // If a virtual table extension is
  5453  // used with an SQLite version earlier than 3.8.2, the results of attempting
  5454  // to read or write the estimatedRows field are undefined (but are likely
  5455  // to include crashing the application). The estimatedRows field should
  5456  // therefore only be used if [sqlite3_libversion_number()] returns a
  5457  // value greater than or equal to 3008002. Similarly, the idxFlags field
  5458  // was added for [version 3.9.0] ([dateof:3.9.0]).
  5459  // It may therefore only be used if
  5460  // sqlite3_libversion_number() returns a value greater than or equal to
  5461  // 3009000.
  5462  type sqlite3_index_orderby = struct {
  5463  	FiColumn int32
  5464  	Fdesc    uint8
  5465  	_        [3]byte
  5466  } /* sqlite3.h:6785:9 */
  5467  
  5468  // CAPI3REF: Virtual Table Indexing Information
  5469  // KEYWORDS: sqlite3_index_info
  5470  //
  5471  // The sqlite3_index_info structure and its substructures is used as part
  5472  // of the [virtual table] interface to
  5473  // pass information into and receive the reply from the [xBestIndex]
  5474  // method of a [virtual table module].  The fields under **Inputs** are the
  5475  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  5476  // results into the **Outputs** fields.
  5477  //
  5478  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  5479  //
  5480  // <blockquote>column OP expr</blockquote>
  5481  //
  5482  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  5483  // stored in aConstraint[].op using one of the
  5484  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  5485  // ^(The index of the column is stored in
  5486  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  5487  // expr on the right-hand side can be evaluated (and thus the constraint
  5488  // is usable) and false if it cannot.)^
  5489  //
  5490  // ^The optimizer automatically inverts terms of the form "expr OP column"
  5491  // and makes other simplifications to the WHERE clause in an attempt to
  5492  // get as many WHERE clause terms into the form shown above as possible.
  5493  // ^The aConstraint[] array only reports WHERE clause terms that are
  5494  // relevant to the particular virtual table being queried.
  5495  //
  5496  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  5497  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  5498  //
  5499  // The colUsed field indicates which columns of the virtual table may be
  5500  // required by the current scan. Virtual table columns are numbered from
  5501  // zero in the order in which they appear within the CREATE TABLE statement
  5502  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  5503  // the corresponding bit is set within the colUsed mask if the column may be
  5504  // required by SQLite. If the table has at least 64 columns and any column
  5505  // to the right of the first 63 is required, then bit 63 of colUsed is also
  5506  // set. In other words, column iCol may be required if the expression
  5507  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  5508  // non-zero.
  5509  //
  5510  // The [xBestIndex] method must fill aConstraintUsage[] with information
  5511  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  5512  // the right-hand side of the corresponding aConstraint[] is evaluated
  5513  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  5514  // is true, then the constraint is assumed to be fully handled by the
  5515  // virtual table and might not be checked again by the byte code.)^ ^(The
  5516  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  5517  // is left in its default setting of false, the constraint will always be
  5518  // checked separately in byte code.  If the omit flag is change to true, then
  5519  // the constraint may or may not be checked in byte code.  In other words,
  5520  // when the omit flag is true there is no guarantee that the constraint will
  5521  // not be checked again using byte code.)^
  5522  //
  5523  // ^The idxNum and idxPtr values are recorded and passed into the
  5524  // [xFilter] method.
  5525  // ^[sqlite3_free()] is used to free idxPtr if and only if
  5526  // needToFreeIdxPtr is true.
  5527  //
  5528  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  5529  // the correct order to satisfy the ORDER BY clause so that no separate
  5530  // sorting step is required.
  5531  //
  5532  // ^The estimatedCost value is an estimate of the cost of a particular
  5533  // strategy. A cost of N indicates that the cost of the strategy is similar
  5534  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  5535  // indicates that the expense of the operation is similar to that of a
  5536  // binary search on a unique indexed field of an SQLite table with N rows.
  5537  //
  5538  // ^The estimatedRows value is an estimate of the number of rows that
  5539  // will be returned by the strategy.
  5540  //
  5541  // The xBestIndex method may optionally populate the idxFlags field with a
  5542  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  5543  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  5544  // assumes that the strategy may visit at most one row.
  5545  //
  5546  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  5547  // SQLite also assumes that if a call to the xUpdate() method is made as
  5548  // part of the same statement to delete or update a virtual table row and the
  5549  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  5550  // any database changes. In other words, if the xUpdate() returns
  5551  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  5552  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  5553  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  5554  // the xUpdate method are automatically rolled back by SQLite.
  5555  //
  5556  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  5557  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  5558  // If a virtual table extension is
  5559  // used with an SQLite version earlier than 3.8.2, the results of attempting
  5560  // to read or write the estimatedRows field are undefined (but are likely
  5561  // to include crashing the application). The estimatedRows field should
  5562  // therefore only be used if [sqlite3_libversion_number()] returns a
  5563  // value greater than or equal to 3008002. Similarly, the idxFlags field
  5564  // was added for [version 3.9.0] ([dateof:3.9.0]).
  5565  // It may therefore only be used if
  5566  // sqlite3_libversion_number() returns a value greater than or equal to
  5567  // 3009000.
  5568  type sqlite3_index_constraint_usage = struct {
  5569  	FargvIndex int32
  5570  	Fomit      uint8
  5571  	_          [3]byte
  5572  } /* sqlite3.h:6785:9 */
  5573  
  5574  // CAPI3REF: Mutex Methods Object
  5575  //
  5576  // An instance of this structure defines the low-level routines
  5577  // used to allocate and use mutexes.
  5578  //
  5579  // Usually, the default mutex implementations provided by SQLite are
  5580  // sufficient, however the application has the option of substituting a custom
  5581  // implementation for specialized deployments or systems for which SQLite
  5582  // does not provide a suitable implementation. In this case, the application
  5583  // creates and populates an instance of this structure to pass
  5584  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  5585  // Additionally, an instance of this structure can be used as an
  5586  // output variable when querying the system for the current mutex
  5587  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  5588  //
  5589  // ^The xMutexInit method defined by this structure is invoked as
  5590  // part of system initialization by the sqlite3_initialize() function.
  5591  // ^The xMutexInit routine is called by SQLite exactly once for each
  5592  // effective call to [sqlite3_initialize()].
  5593  //
  5594  // ^The xMutexEnd method defined by this structure is invoked as
  5595  // part of system shutdown by the sqlite3_shutdown() function. The
  5596  // implementation of this method is expected to release all outstanding
  5597  // resources obtained by the mutex methods implementation, especially
  5598  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  5599  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  5600  //
  5601  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  5602  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  5603  // xMutexNotheld) implement the following interfaces (respectively):
  5604  //
  5605  // <ul>
  5606  //   <li>  [sqlite3_mutex_alloc()] </li>
  5607  //   <li>  [sqlite3_mutex_free()] </li>
  5608  //   <li>  [sqlite3_mutex_enter()] </li>
  5609  //   <li>  [sqlite3_mutex_try()] </li>
  5610  //   <li>  [sqlite3_mutex_leave()] </li>
  5611  //   <li>  [sqlite3_mutex_held()] </li>
  5612  //   <li>  [sqlite3_mutex_notheld()] </li>
  5613  // </ul>)^
  5614  //
  5615  // The only difference is that the public sqlite3_XXX functions enumerated
  5616  // above silently ignore any invocations that pass a NULL pointer instead
  5617  // of a valid mutex handle. The implementations of the methods defined
  5618  // by this structure are not required to handle this case. The results
  5619  // of passing a NULL pointer instead of a valid mutex handle are undefined
  5620  // (i.e. it is acceptable to provide an implementation that segfaults if
  5621  // it is passed a NULL pointer).
  5622  //
  5623  // The xMutexInit() method must be threadsafe.  It must be harmless to
  5624  // invoke xMutexInit() multiple times within the same process and without
  5625  // intervening calls to xMutexEnd().  Second and subsequent calls to
  5626  // xMutexInit() must be no-ops.
  5627  //
  5628  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  5629  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  5630  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  5631  // memory allocation for a fast or recursive mutex.
  5632  //
  5633  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  5634  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  5635  // If xMutexInit fails in any way, it is expected to clean up after itself
  5636  // prior to returning.
  5637  type sqlite3_mutex_methods1 = struct {
  5638  	FxMutexInit    uintptr
  5639  	FxMutexEnd     uintptr
  5640  	FxMutexAlloc   uintptr
  5641  	FxMutexFree    uintptr
  5642  	FxMutexEnter   uintptr
  5643  	FxMutexTry     uintptr
  5644  	FxMutexLeave   uintptr
  5645  	FxMutexHeld    uintptr
  5646  	FxMutexNotheld uintptr
  5647  } /* sqlite3.h:7619:9 */
  5648  
  5649  // CAPI3REF: Mutex Methods Object
  5650  //
  5651  // An instance of this structure defines the low-level routines
  5652  // used to allocate and use mutexes.
  5653  //
  5654  // Usually, the default mutex implementations provided by SQLite are
  5655  // sufficient, however the application has the option of substituting a custom
  5656  // implementation for specialized deployments or systems for which SQLite
  5657  // does not provide a suitable implementation. In this case, the application
  5658  // creates and populates an instance of this structure to pass
  5659  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  5660  // Additionally, an instance of this structure can be used as an
  5661  // output variable when querying the system for the current mutex
  5662  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  5663  //
  5664  // ^The xMutexInit method defined by this structure is invoked as
  5665  // part of system initialization by the sqlite3_initialize() function.
  5666  // ^The xMutexInit routine is called by SQLite exactly once for each
  5667  // effective call to [sqlite3_initialize()].
  5668  //
  5669  // ^The xMutexEnd method defined by this structure is invoked as
  5670  // part of system shutdown by the sqlite3_shutdown() function. The
  5671  // implementation of this method is expected to release all outstanding
  5672  // resources obtained by the mutex methods implementation, especially
  5673  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  5674  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  5675  //
  5676  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  5677  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  5678  // xMutexNotheld) implement the following interfaces (respectively):
  5679  //
  5680  // <ul>
  5681  //   <li>  [sqlite3_mutex_alloc()] </li>
  5682  //   <li>  [sqlite3_mutex_free()] </li>
  5683  //   <li>  [sqlite3_mutex_enter()] </li>
  5684  //   <li>  [sqlite3_mutex_try()] </li>
  5685  //   <li>  [sqlite3_mutex_leave()] </li>
  5686  //   <li>  [sqlite3_mutex_held()] </li>
  5687  //   <li>  [sqlite3_mutex_notheld()] </li>
  5688  // </ul>)^
  5689  //
  5690  // The only difference is that the public sqlite3_XXX functions enumerated
  5691  // above silently ignore any invocations that pass a NULL pointer instead
  5692  // of a valid mutex handle. The implementations of the methods defined
  5693  // by this structure are not required to handle this case. The results
  5694  // of passing a NULL pointer instead of a valid mutex handle are undefined
  5695  // (i.e. it is acceptable to provide an implementation that segfaults if
  5696  // it is passed a NULL pointer).
  5697  //
  5698  // The xMutexInit() method must be threadsafe.  It must be harmless to
  5699  // invoke xMutexInit() multiple times within the same process and without
  5700  // intervening calls to xMutexEnd().  Second and subsequent calls to
  5701  // xMutexInit() must be no-ops.
  5702  //
  5703  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  5704  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  5705  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  5706  // memory allocation for a fast or recursive mutex.
  5707  //
  5708  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  5709  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  5710  // If xMutexInit fails in any way, it is expected to clean up after itself
  5711  // prior to returning.
  5712  type sqlite3_mutex_methods = sqlite3_mutex_methods1 /* sqlite3.h:7619:38 */
  5713  
  5714  // CAPI3REF: Dynamic String Object
  5715  // KEYWORDS: {dynamic string}
  5716  //
  5717  // An instance of the sqlite3_str object contains a dynamically-sized
  5718  // string under construction.
  5719  //
  5720  // The lifecycle of an sqlite3_str object is as follows:
  5721  // <ol>
  5722  // <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
  5723  // <li> ^Text is appended to the sqlite3_str object using various
  5724  // methods, such as [sqlite3_str_appendf()].
  5725  // <li> ^The sqlite3_str object is destroyed and the string it created
  5726  // is returned using the [sqlite3_str_finish()] interface.
  5727  // </ol>
  5728  type sqlite3_str1 = struct {
  5729  	Fdb          uintptr
  5730  	FzText       uintptr
  5731  	FnAlloc      u32
  5732  	FmxAlloc     u32
  5733  	FnChar       u32
  5734  	FaccError    u8
  5735  	FprintfFlags u8
  5736  	_            [2]byte
  5737  } /* sqlite3.h:7882:9 */
  5738  
  5739  // CAPI3REF: Custom Page Cache Object
  5740  //
  5741  // The sqlite3_pcache_page object represents a single page in the
  5742  // page cache.  The page cache will allocate instances of this
  5743  // object.  Various methods of the page cache use pointers to instances
  5744  // of this object as parameters or as their return value.
  5745  //
  5746  // See [sqlite3_pcache_methods2] for additional information.
  5747  type sqlite3_pcache_page1 = struct {
  5748  	FpBuf   uintptr
  5749  	FpExtra uintptr
  5750  } /* sqlite3.h:8375:9 */
  5751  
  5752  // CAPI3REF: Custom Page Cache Object
  5753  //
  5754  // The sqlite3_pcache_page object represents a single page in the
  5755  // page cache.  The page cache will allocate instances of this
  5756  // object.  Various methods of the page cache use pointers to instances
  5757  // of this object as parameters or as their return value.
  5758  //
  5759  // See [sqlite3_pcache_methods2] for additional information.
  5760  type sqlite3_pcache_page = sqlite3_pcache_page1 /* sqlite3.h:8375:36 */
  5761  
  5762  // CAPI3REF: Application Defined Page Cache.
  5763  // KEYWORDS: {page cache}
  5764  //
  5765  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  5766  // register an alternative page cache implementation by passing in an
  5767  // instance of the sqlite3_pcache_methods2 structure.)^
  5768  // In many applications, most of the heap memory allocated by
  5769  // SQLite is used for the page cache.
  5770  // By implementing a
  5771  // custom page cache using this API, an application can better control
  5772  // the amount of memory consumed by SQLite, the way in which
  5773  // that memory is allocated and released, and the policies used to
  5774  // determine exactly which parts of a database file are cached and for
  5775  // how long.
  5776  //
  5777  // The alternative page cache mechanism is an
  5778  // extreme measure that is only needed by the most demanding applications.
  5779  // The built-in page cache is recommended for most uses.
  5780  //
  5781  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  5782  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  5783  // the application may discard the parameter after the call to
  5784  // [sqlite3_config()] returns.)^
  5785  //
  5786  // [[the xInit() page cache method]]
  5787  // ^(The xInit() method is called once for each effective
  5788  // call to [sqlite3_initialize()])^
  5789  // (usually only once during the lifetime of the process). ^(The xInit()
  5790  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  5791  // The intent of the xInit() method is to set up global data structures
  5792  // required by the custom page cache implementation.
  5793  // ^(If the xInit() method is NULL, then the
  5794  // built-in default page cache is used instead of the application defined
  5795  // page cache.)^
  5796  //
  5797  // [[the xShutdown() page cache method]]
  5798  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  5799  // It can be used to clean up
  5800  // any outstanding resources before process shutdown, if required.
  5801  // ^The xShutdown() method may be NULL.
  5802  //
  5803  // ^SQLite automatically serializes calls to the xInit method,
  5804  // so the xInit method need not be threadsafe.  ^The
  5805  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5806  // not need to be threadsafe either.  All other methods must be threadsafe
  5807  // in multithreaded applications.
  5808  //
  5809  // ^SQLite will never invoke xInit() more than once without an intervening
  5810  // call to xShutdown().
  5811  //
  5812  // [[the xCreate() page cache methods]]
  5813  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  5814  // SQLite will typically create one cache instance for each open database file,
  5815  // though this is not guaranteed. ^The
  5816  // first parameter, szPage, is the size in bytes of the pages that must
  5817  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  5818  // second parameter szExtra is a number of bytes of extra storage
  5819  // associated with each page cache entry.  ^The szExtra parameter will
  5820  // a number less than 250.  SQLite will use the
  5821  // extra szExtra bytes on each page to store metadata about the underlying
  5822  // database page on disk.  The value passed into szExtra depends
  5823  // on the SQLite version, the target platform, and how SQLite was compiled.
  5824  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  5825  // created will be used to cache database pages of a file stored on disk, or
  5826  // false if it is used for an in-memory database. The cache implementation
  5827  // does not have to do anything special based with the value of bPurgeable;
  5828  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  5829  // never invoke xUnpin() except to deliberately delete a page.
  5830  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  5831  // false will always have the "discard" flag set to true.
  5832  // ^Hence, a cache created with bPurgeable false will
  5833  // never contain any unpinned pages.
  5834  //
  5835  // [[the xCachesize() page cache method]]
  5836  // ^(The xCachesize() method may be called at any time by SQLite to set the
  5837  // suggested maximum cache-size (number of pages stored by) the cache
  5838  // instance passed as the first argument. This is the value configured using
  5839  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  5840  // parameter, the implementation is not required to do anything with this
  5841  // value; it is advisory only.
  5842  //
  5843  // [[the xPagecount() page cache methods]]
  5844  // The xPagecount() method must return the number of pages currently
  5845  // stored in the cache, both pinned and unpinned.
  5846  //
  5847  // [[the xFetch() page cache methods]]
  5848  // The xFetch() method locates a page in the cache and returns a pointer to
  5849  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  5850  // The pBuf element of the returned sqlite3_pcache_page object will be a
  5851  // pointer to a buffer of szPage bytes used to store the content of a
  5852  // single database page.  The pExtra element of sqlite3_pcache_page will be
  5853  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  5854  // for each entry in the page cache.
  5855  //
  5856  // The page to be fetched is determined by the key. ^The minimum key value
  5857  // is 1.  After it has been retrieved using xFetch, the page is considered
  5858  // to be "pinned".
  5859  //
  5860  // If the requested page is already in the page cache, then the page cache
  5861  // implementation must return a pointer to the page buffer with its content
  5862  // intact.  If the requested page is not already in the cache, then the
  5863  // cache implementation should use the value of the createFlag
  5864  // parameter to help it determined what action to take:
  5865  //
  5866  // <table border=1 width=85% align=center>
  5867  // <tr><th> createFlag <th> Behavior when page is not already in cache
  5868  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  5869  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  5870  //                 Otherwise return NULL.
  5871  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  5872  //                 NULL if allocating a new page is effectively impossible.
  5873  // </table>
  5874  //
  5875  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  5876  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  5877  // failed.)^  In between the xFetch() calls, SQLite may
  5878  // attempt to unpin one or more cache pages by spilling the content of
  5879  // pinned pages to disk and synching the operating system disk cache.
  5880  //
  5881  // [[the xUnpin() page cache method]]
  5882  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  5883  // as its second argument.  If the third parameter, discard, is non-zero,
  5884  // then the page must be evicted from the cache.
  5885  // ^If the discard parameter is
  5886  // zero, then the page may be discarded or retained at the discretion of
  5887  // page cache implementation. ^The page cache implementation
  5888  // may choose to evict unpinned pages at any time.
  5889  //
  5890  // The cache must not perform any reference counting. A single
  5891  // call to xUnpin() unpins the page regardless of the number of prior calls
  5892  // to xFetch().
  5893  //
  5894  // [[the xRekey() page cache methods]]
  5895  // The xRekey() method is used to change the key value associated with the
  5896  // page passed as the second argument. If the cache
  5897  // previously contains an entry associated with newKey, it must be
  5898  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  5899  // to be pinned.
  5900  //
  5901  // When SQLite calls the xTruncate() method, the cache must discard all
  5902  // existing cache entries with page numbers (keys) greater than or equal
  5903  // to the value of the iLimit parameter passed to xTruncate(). If any
  5904  // of these pages are pinned, they are implicitly unpinned, meaning that
  5905  // they can be safely discarded.
  5906  //
  5907  // [[the xDestroy() page cache method]]
  5908  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  5909  // All resources associated with the specified cache should be freed. ^After
  5910  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  5911  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  5912  // functions.
  5913  //
  5914  // [[the xShrink() page cache method]]
  5915  // ^SQLite invokes the xShrink() method when it wants the page cache to
  5916  // free up as much of heap memory as possible.  The page cache implementation
  5917  // is not obligated to free any memory, but well-behaved implementations should
  5918  // do their best.
  5919  type sqlite3_pcache_methods21 = struct {
  5920  	FiVersion   int32
  5921  	_           [4]byte
  5922  	FpArg       uintptr
  5923  	FxInit      uintptr
  5924  	FxShutdown  uintptr
  5925  	FxCreate    uintptr
  5926  	FxCachesize uintptr
  5927  	FxPagecount uintptr
  5928  	FxFetch     uintptr
  5929  	FxUnpin     uintptr
  5930  	FxRekey     uintptr
  5931  	FxTruncate  uintptr
  5932  	FxDestroy   uintptr
  5933  	FxShrink    uintptr
  5934  } /* sqlite3.h:8540:9 */
  5935  
  5936  // CAPI3REF: Application Defined Page Cache.
  5937  // KEYWORDS: {page cache}
  5938  //
  5939  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  5940  // register an alternative page cache implementation by passing in an
  5941  // instance of the sqlite3_pcache_methods2 structure.)^
  5942  // In many applications, most of the heap memory allocated by
  5943  // SQLite is used for the page cache.
  5944  // By implementing a
  5945  // custom page cache using this API, an application can better control
  5946  // the amount of memory consumed by SQLite, the way in which
  5947  // that memory is allocated and released, and the policies used to
  5948  // determine exactly which parts of a database file are cached and for
  5949  // how long.
  5950  //
  5951  // The alternative page cache mechanism is an
  5952  // extreme measure that is only needed by the most demanding applications.
  5953  // The built-in page cache is recommended for most uses.
  5954  //
  5955  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  5956  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  5957  // the application may discard the parameter after the call to
  5958  // [sqlite3_config()] returns.)^
  5959  //
  5960  // [[the xInit() page cache method]]
  5961  // ^(The xInit() method is called once for each effective
  5962  // call to [sqlite3_initialize()])^
  5963  // (usually only once during the lifetime of the process). ^(The xInit()
  5964  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  5965  // The intent of the xInit() method is to set up global data structures
  5966  // required by the custom page cache implementation.
  5967  // ^(If the xInit() method is NULL, then the
  5968  // built-in default page cache is used instead of the application defined
  5969  // page cache.)^
  5970  //
  5971  // [[the xShutdown() page cache method]]
  5972  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  5973  // It can be used to clean up
  5974  // any outstanding resources before process shutdown, if required.
  5975  // ^The xShutdown() method may be NULL.
  5976  //
  5977  // ^SQLite automatically serializes calls to the xInit method,
  5978  // so the xInit method need not be threadsafe.  ^The
  5979  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5980  // not need to be threadsafe either.  All other methods must be threadsafe
  5981  // in multithreaded applications.
  5982  //
  5983  // ^SQLite will never invoke xInit() more than once without an intervening
  5984  // call to xShutdown().
  5985  //
  5986  // [[the xCreate() page cache methods]]
  5987  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  5988  // SQLite will typically create one cache instance for each open database file,
  5989  // though this is not guaranteed. ^The
  5990  // first parameter, szPage, is the size in bytes of the pages that must
  5991  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  5992  // second parameter szExtra is a number of bytes of extra storage
  5993  // associated with each page cache entry.  ^The szExtra parameter will
  5994  // a number less than 250.  SQLite will use the
  5995  // extra szExtra bytes on each page to store metadata about the underlying
  5996  // database page on disk.  The value passed into szExtra depends
  5997  // on the SQLite version, the target platform, and how SQLite was compiled.
  5998  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  5999  // created will be used to cache database pages of a file stored on disk, or
  6000  // false if it is used for an in-memory database. The cache implementation
  6001  // does not have to do anything special based with the value of bPurgeable;
  6002  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  6003  // never invoke xUnpin() except to deliberately delete a page.
  6004  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  6005  // false will always have the "discard" flag set to true.
  6006  // ^Hence, a cache created with bPurgeable false will
  6007  // never contain any unpinned pages.
  6008  //
  6009  // [[the xCachesize() page cache method]]
  6010  // ^(The xCachesize() method may be called at any time by SQLite to set the
  6011  // suggested maximum cache-size (number of pages stored by) the cache
  6012  // instance passed as the first argument. This is the value configured using
  6013  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  6014  // parameter, the implementation is not required to do anything with this
  6015  // value; it is advisory only.
  6016  //
  6017  // [[the xPagecount() page cache methods]]
  6018  // The xPagecount() method must return the number of pages currently
  6019  // stored in the cache, both pinned and unpinned.
  6020  //
  6021  // [[the xFetch() page cache methods]]
  6022  // The xFetch() method locates a page in the cache and returns a pointer to
  6023  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  6024  // The pBuf element of the returned sqlite3_pcache_page object will be a
  6025  // pointer to a buffer of szPage bytes used to store the content of a
  6026  // single database page.  The pExtra element of sqlite3_pcache_page will be
  6027  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  6028  // for each entry in the page cache.
  6029  //
  6030  // The page to be fetched is determined by the key. ^The minimum key value
  6031  // is 1.  After it has been retrieved using xFetch, the page is considered
  6032  // to be "pinned".
  6033  //
  6034  // If the requested page is already in the page cache, then the page cache
  6035  // implementation must return a pointer to the page buffer with its content
  6036  // intact.  If the requested page is not already in the cache, then the
  6037  // cache implementation should use the value of the createFlag
  6038  // parameter to help it determined what action to take:
  6039  //
  6040  // <table border=1 width=85% align=center>
  6041  // <tr><th> createFlag <th> Behavior when page is not already in cache
  6042  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  6043  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  6044  //                 Otherwise return NULL.
  6045  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  6046  //                 NULL if allocating a new page is effectively impossible.
  6047  // </table>
  6048  //
  6049  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  6050  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  6051  // failed.)^  In between the xFetch() calls, SQLite may
  6052  // attempt to unpin one or more cache pages by spilling the content of
  6053  // pinned pages to disk and synching the operating system disk cache.
  6054  //
  6055  // [[the xUnpin() page cache method]]
  6056  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  6057  // as its second argument.  If the third parameter, discard, is non-zero,
  6058  // then the page must be evicted from the cache.
  6059  // ^If the discard parameter is
  6060  // zero, then the page may be discarded or retained at the discretion of
  6061  // page cache implementation. ^The page cache implementation
  6062  // may choose to evict unpinned pages at any time.
  6063  //
  6064  // The cache must not perform any reference counting. A single
  6065  // call to xUnpin() unpins the page regardless of the number of prior calls
  6066  // to xFetch().
  6067  //
  6068  // [[the xRekey() page cache methods]]
  6069  // The xRekey() method is used to change the key value associated with the
  6070  // page passed as the second argument. If the cache
  6071  // previously contains an entry associated with newKey, it must be
  6072  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  6073  // to be pinned.
  6074  //
  6075  // When SQLite calls the xTruncate() method, the cache must discard all
  6076  // existing cache entries with page numbers (keys) greater than or equal
  6077  // to the value of the iLimit parameter passed to xTruncate(). If any
  6078  // of these pages are pinned, they are implicitly unpinned, meaning that
  6079  // they can be safely discarded.
  6080  //
  6081  // [[the xDestroy() page cache method]]
  6082  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  6083  // All resources associated with the specified cache should be freed. ^After
  6084  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  6085  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  6086  // functions.
  6087  //
  6088  // [[the xShrink() page cache method]]
  6089  // ^SQLite invokes the xShrink() method when it wants the page cache to
  6090  // free up as much of heap memory as possible.  The page cache implementation
  6091  // is not obligated to free any memory, but well-behaved implementations should
  6092  // do their best.
  6093  type sqlite3_pcache_methods2 = sqlite3_pcache_methods21 /* sqlite3.h:8540:40 */
  6094  
  6095  // This is the obsolete pcache_methods object that has now been replaced
  6096  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  6097  // retained in the header file for backwards compatibility only.
  6098  type sqlite3_pcache_methods1 = struct {
  6099  	FpArg       uintptr
  6100  	FxInit      uintptr
  6101  	FxShutdown  uintptr
  6102  	FxCreate    uintptr
  6103  	FxCachesize uintptr
  6104  	FxPagecount uintptr
  6105  	FxFetch     uintptr
  6106  	FxUnpin     uintptr
  6107  	FxRekey     uintptr
  6108  	FxTruncate  uintptr
  6109  	FxDestroy   uintptr
  6110  } /* sqlite3.h:8563:9 */
  6111  
  6112  // This is the obsolete pcache_methods object that has now been replaced
  6113  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  6114  // retained in the header file for backwards compatibility only.
  6115  type sqlite3_pcache_methods = sqlite3_pcache_methods1 /* sqlite3.h:8563:39 */
  6116  
  6117  // CAPI3REF: Database Snapshot
  6118  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  6119  //
  6120  // An instance of the snapshot object records the state of a [WAL mode]
  6121  // database for some specific point in history.
  6122  //
  6123  // In [WAL mode], multiple [database connections] that are open on the
  6124  // same database file can each be reading a different historical version
  6125  // of the database file.  When a [database connection] begins a read
  6126  // transaction, that connection sees an unchanging copy of the database
  6127  // as it existed for the point in time when the transaction first started.
  6128  // Subsequent changes to the database from other connections are not seen
  6129  // by the reader until a new read transaction is started.
  6130  //
  6131  // The sqlite3_snapshot object records state information about an historical
  6132  // version of the database file so that it is possible to later open a new read
  6133  // transaction that sees that historical version of the database rather than
  6134  // the most recent version.
  6135  type sqlite3_snapshot1 = struct{ Fhidden [48]uint8 } /* sqlite3.h:9630:9 */
  6136  
  6137  // CAPI3REF: Database Snapshot
  6138  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  6139  //
  6140  // An instance of the snapshot object records the state of a [WAL mode]
  6141  // database for some specific point in history.
  6142  //
  6143  // In [WAL mode], multiple [database connections] that are open on the
  6144  // same database file can each be reading a different historical version
  6145  // of the database file.  When a [database connection] begins a read
  6146  // transaction, that connection sees an unchanging copy of the database
  6147  // as it existed for the point in time when the transaction first started.
  6148  // Subsequent changes to the database from other connections are not seen
  6149  // by the reader until a new read transaction is started.
  6150  //
  6151  // The sqlite3_snapshot object records state information about an historical
  6152  // version of the database file so that it is possible to later open a new read
  6153  // transaction that sees that historical version of the database rather than
  6154  // the most recent version.
  6155  type sqlite3_snapshot = sqlite3_snapshot1 /* sqlite3.h:9632:3 */
  6156  
  6157  // CAPI3REF: Flags for sqlite3_deserialize()
  6158  //
  6159  // The following are allowed values for 6th argument (the F argument) to
  6160  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  6161  //
  6162  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  6163  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  6164  // and that SQLite should take ownership of this memory and automatically
  6165  // free it when it has finished using it.  Without this flag, the caller
  6166  // is responsible for freeing any dynamically allocated memory.
  6167  //
  6168  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  6169  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  6170  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  6171  // Without this flag, the deserialized database cannot increase in size beyond
  6172  // the number of bytes specified by the M parameter.
  6173  //
  6174  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  6175  // should be treated as read-only.
  6176  
  6177  // Undo the hack that converts floating point types to integer for
  6178  // builds on processors without floating point support.
  6179  
  6180  //******* Begin file sqlite3rtree.h ********
  6181  // 2010 August 30
  6182  //
  6183  // The author disclaims copyright to this source code.  In place of
  6184  // a legal notice, here is a blessing:
  6185  //
  6186  //    May you do good and not evil.
  6187  //    May you find forgiveness for yourself and forgive others.
  6188  //    May you share freely, never taking more than you give.
  6189  //
  6190  //
  6191  
  6192  type sqlite3_rtree_geometry1 = struct {
  6193  	FpContext uintptr
  6194  	FnParam   int32
  6195  	_         [4]byte
  6196  	FaParam   uintptr
  6197  	FpUser    uintptr
  6198  	FxDelUser uintptr
  6199  } /* sqlite3.h:9957:9 */
  6200  
  6201  // CAPI3REF: Flags for sqlite3_deserialize()
  6202  //
  6203  // The following are allowed values for 6th argument (the F argument) to
  6204  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  6205  //
  6206  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  6207  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  6208  // and that SQLite should take ownership of this memory and automatically
  6209  // free it when it has finished using it.  Without this flag, the caller
  6210  // is responsible for freeing any dynamically allocated memory.
  6211  //
  6212  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  6213  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  6214  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  6215  // Without this flag, the deserialized database cannot increase in size beyond
  6216  // the number of bytes specified by the M parameter.
  6217  //
  6218  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  6219  // should be treated as read-only.
  6220  
  6221  // Undo the hack that converts floating point types to integer for
  6222  // builds on processors without floating point support.
  6223  
  6224  //******* Begin file sqlite3rtree.h ********
  6225  // 2010 August 30
  6226  //
  6227  // The author disclaims copyright to this source code.  In place of
  6228  // a legal notice, here is a blessing:
  6229  //
  6230  //    May you do good and not evil.
  6231  //    May you find forgiveness for yourself and forgive others.
  6232  //    May you share freely, never taking more than you give.
  6233  //
  6234  //
  6235  
  6236  type sqlite3_rtree_geometry = sqlite3_rtree_geometry1 /* sqlite3.h:9957:39 */
  6237  type sqlite3_rtree_query_info1 = struct {
  6238  	FpContext      uintptr
  6239  	FnParam        int32
  6240  	_              [4]byte
  6241  	FaParam        uintptr
  6242  	FpUser         uintptr
  6243  	FxDelUser      uintptr
  6244  	FaCoord        uintptr
  6245  	FanQueue       uintptr
  6246  	FnCoord        int32
  6247  	FiLevel        int32
  6248  	FmxLevel       int32
  6249  	_              [4]byte
  6250  	FiRowid        sqlite3_int64
  6251  	FrParentScore  sqlite3_rtree_dbl
  6252  	FeParentWithin int32
  6253  	FeWithin       int32
  6254  	FrScore        sqlite3_rtree_dbl
  6255  	FapSqlParam    uintptr
  6256  } /* sqlite3.h:9958:9 */
  6257  
  6258  type sqlite3_rtree_query_info = sqlite3_rtree_query_info1 /* sqlite3.h:9958:41 */
  6259  
  6260  // The double-precision datatype used by RTree depends on the
  6261  // SQLITE_RTREE_INT_ONLY compile-time option.
  6262  type sqlite3_rtree_dbl = float64 /* sqlite3.h:9966:18 */
  6263  
  6264  // CAPI3REF: Values for sqlite3session_config().
  6265  
  6266  // Make sure we can call this stuff from C++.
  6267  
  6268  //******* End of sqlite3session.h ********
  6269  //******* Begin file fts5.h ********
  6270  // 2014 May 31
  6271  //
  6272  // The author disclaims copyright to this source code.  In place of
  6273  // a legal notice, here is a blessing:
  6274  //
  6275  //    May you do good and not evil.
  6276  //    May you find forgiveness for yourself and forgive others.
  6277  //    May you share freely, never taking more than you give.
  6278  //
  6279  //
  6280  //
  6281  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  6282  // FTS5 may be extended with:
  6283  //
  6284  //     * custom tokenizers, and
  6285  //     * custom auxiliary functions.
  6286  
  6287  // ************************************************************************
  6288  //
  6289  // CUSTOM AUXILIARY FUNCTIONS
  6290  //
  6291  // Virtual table implementations may overload SQL functions by implementing
  6292  // the sqlite3_module.xFindFunction() method.
  6293  
  6294  type Fts5ExtensionApi1 = struct {
  6295  	FiVersion           int32
  6296  	_                   [4]byte
  6297  	FxUserData          uintptr
  6298  	FxColumnCount       uintptr
  6299  	FxRowCount          uintptr
  6300  	FxColumnTotalSize   uintptr
  6301  	FxTokenize          uintptr
  6302  	FxPhraseCount       uintptr
  6303  	FxPhraseSize        uintptr
  6304  	FxInstCount         uintptr
  6305  	FxInst              uintptr
  6306  	FxRowid             uintptr
  6307  	FxColumnText        uintptr
  6308  	FxColumnSize        uintptr
  6309  	FxQueryPhrase       uintptr
  6310  	FxSetAuxdata        uintptr
  6311  	FxGetAuxdata        uintptr
  6312  	FxPhraseFirst       uintptr
  6313  	FxPhraseNext        uintptr
  6314  	FxPhraseFirstColumn uintptr
  6315  	FxPhraseNextColumn  uintptr
  6316  } /* sqlite3.h:11813:9 */
  6317  
  6318  // CAPI3REF: Values for sqlite3session_config().
  6319  
  6320  // Make sure we can call this stuff from C++.
  6321  
  6322  //******* End of sqlite3session.h ********
  6323  //******* Begin file fts5.h ********
  6324  // 2014 May 31
  6325  //
  6326  // The author disclaims copyright to this source code.  In place of
  6327  // a legal notice, here is a blessing:
  6328  //
  6329  //    May you do good and not evil.
  6330  //    May you find forgiveness for yourself and forgive others.
  6331  //    May you share freely, never taking more than you give.
  6332  //
  6333  //
  6334  //
  6335  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  6336  // FTS5 may be extended with:
  6337  //
  6338  //     * custom tokenizers, and
  6339  //     * custom auxiliary functions.
  6340  
  6341  // ************************************************************************
  6342  //
  6343  // CUSTOM AUXILIARY FUNCTIONS
  6344  //
  6345  // Virtual table implementations may overload SQL functions by implementing
  6346  // the sqlite3_module.xFindFunction() method.
  6347  
  6348  type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.h:11813:33 */
  6349  type Fts5PhraseIter1 = struct {
  6350  	Fa uintptr
  6351  	Fb uintptr
  6352  } /* sqlite3.h:11815:9 */
  6353  
  6354  type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.h:11815:31 */
  6355  
  6356  type fts5_extension_function = uintptr /* sqlite3.h:11817:14 */
  6357  type fts5_tokenizer1 = struct {
  6358  	FxCreate   uintptr
  6359  	FxDelete   uintptr
  6360  	FxTokenize uintptr
  6361  } /* sqlite3.h:12276:9 */
  6362  
  6363  type fts5_tokenizer = fts5_tokenizer1 /* sqlite3.h:12276:31 */
  6364  
  6365  // Flags that may be passed as the third argument to xTokenize()
  6366  
  6367  // Flags that may be passed by the tokenizer implementation back to FTS5
  6368  // as the third argument to the supplied xToken callback.
  6369  
  6370  //
  6371  // END OF CUSTOM TOKENIZERS
  6372  //
  6373  
  6374  // ************************************************************************
  6375  //
  6376  // FTS5 EXTENSION REGISTRATION API
  6377  type fts5_api1 = struct {
  6378  	FiVersion         int32
  6379  	_                 [4]byte
  6380  	FxCreateTokenizer uintptr
  6381  	FxFindTokenizer   uintptr
  6382  	FxCreateFunction  uintptr
  6383  } /* sqlite3.h:12312:9 */
  6384  
  6385  // Flags that may be passed as the third argument to xTokenize()
  6386  
  6387  // Flags that may be passed by the tokenizer implementation back to FTS5
  6388  // as the third argument to the supplied xToken callback.
  6389  
  6390  //
  6391  // END OF CUSTOM TOKENIZERS
  6392  //
  6393  
  6394  // ************************************************************************
  6395  //
  6396  // FTS5 EXTENSION REGISTRATION API
  6397  type fts5_api = fts5_api1 /* sqlite3.h:12312:25 */
  6398  
  6399  //
  6400  // END OF REGISTRATION API
  6401  //
  6402  
  6403  //******* End of fts5.h ********
  6404  
  6405  type sqlite3expert1 = struct {
  6406  	FiSample     int32
  6407  	_            [4]byte
  6408  	Fdb          uintptr
  6409  	Fdbm         uintptr
  6410  	Fdbv         uintptr
  6411  	FpTable      uintptr
  6412  	FpScan       uintptr
  6413  	FpWrite      uintptr
  6414  	FpStatement  uintptr
  6415  	FbRun        int32
  6416  	_            [4]byte
  6417  	FpzErrmsg    uintptr
  6418  	Frc          int32
  6419  	_            [4]byte
  6420  	FhIdx        IdxHash
  6421  	FzCandidates uintptr
  6422  } /* sqlite3expert.h:17:9 */
  6423  
  6424  //
  6425  // END OF REGISTRATION API
  6426  //
  6427  
  6428  //******* End of fts5.h ********
  6429  
  6430  type sqlite3expert = sqlite3expert1 /* sqlite3expert.h:17:30 */
  6431  
  6432  // -
  6433  // Copyright (c) 2011, 2012 The FreeBSD Foundation
  6434  // All rights reserved.
  6435  //
  6436  // Redistribution and use in source and binary forms, with or without
  6437  // modification, are permitted provided that the following conditions
  6438  // are met:
  6439  // 1. Redistributions of source code must retain the above copyright
  6440  //    notice, this list of conditions and the following disclaimer.
  6441  // 2. Redistributions in binary form must reproduce the above copyright
  6442  //    notice, this list of conditions and the following disclaimer in the
  6443  //    documentation and/or other materials provided with the distribution.
  6444  //
  6445  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  6446  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  6447  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  6448  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  6449  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  6450  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  6451  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  6452  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  6453  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  6454  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  6455  // SUCH DAMAGE.
  6456  //
  6457  // $FreeBSD$
  6458  
  6459  type locale_t = uintptr /* _strings.h:31:25 */
  6460  
  6461  type ssize_t = int64 /* string.h:132:19 */
  6462  
  6463  // xlocale extensions
  6464  
  6465  type rsize_t = size_t /* string.h:151:16 */
  6466  
  6467  type errno_t = int32 /* string.h:156:13 */
  6468  
  6469  // -
  6470  // SPDX-License-Identifier: BSD-3-Clause
  6471  //
  6472  // Copyright (c) 1990, 1993
  6473  //	The Regents of the University of California.  All rights reserved.
  6474  //
  6475  // This code is derived from software contributed to Berkeley by
  6476  // Chris Torek.
  6477  //
  6478  // Redistribution and use in source and binary forms, with or without
  6479  // modification, are permitted provided that the following conditions
  6480  // are met:
  6481  // 1. Redistributions of source code must retain the above copyright
  6482  //    notice, this list of conditions and the following disclaimer.
  6483  // 2. Redistributions in binary form must reproduce the above copyright
  6484  //    notice, this list of conditions and the following disclaimer in the
  6485  //    documentation and/or other materials provided with the distribution.
  6486  // 3. Neither the name of the University nor the names of its contributors
  6487  //    may be used to endorse or promote products derived from this software
  6488  //    without specific prior written permission.
  6489  //
  6490  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  6491  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  6492  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  6493  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  6494  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  6495  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  6496  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  6497  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  6498  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  6499  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  6500  // SUCH DAMAGE.
  6501  //
  6502  //	@(#)stdio.h	8.5 (Berkeley) 4/29/95
  6503  // $FreeBSD$
  6504  
  6505  // -
  6506  // SPDX-License-Identifier: BSD-3-Clause
  6507  //
  6508  // Copyright (c) 1991, 1993
  6509  //	The Regents of the University of California.  All rights reserved.
  6510  //
  6511  // This code is derived from software contributed to Berkeley by
  6512  // Berkeley Software Design, Inc.
  6513  //
  6514  // Redistribution and use in source and binary forms, with or without
  6515  // modification, are permitted provided that the following conditions
  6516  // are met:
  6517  // 1. Redistributions of source code must retain the above copyright
  6518  //    notice, this list of conditions and the following disclaimer.
  6519  // 2. Redistributions in binary form must reproduce the above copyright
  6520  //    notice, this list of conditions and the following disclaimer in the
  6521  //    documentation and/or other materials provided with the distribution.
  6522  // 3. Neither the name of the University nor the names of its contributors
  6523  //    may be used to endorse or promote products derived from this software
  6524  //    without specific prior written permission.
  6525  //
  6526  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  6527  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  6528  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  6529  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  6530  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  6531  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  6532  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  6533  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  6534  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  6535  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  6536  // SUCH DAMAGE.
  6537  //
  6538  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
  6539  // $FreeBSD$
  6540  
  6541  // -
  6542  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  6543  //
  6544  // Copyright (c) 2003 Marcel Moolenaar
  6545  // All rights reserved.
  6546  //
  6547  // Redistribution and use in source and binary forms, with or without
  6548  // modification, are permitted provided that the following conditions
  6549  // are met:
  6550  //
  6551  // 1. Redistributions of source code must retain the above copyright
  6552  //    notice, this list of conditions and the following disclaimer.
  6553  // 2. Redistributions in binary form must reproduce the above copyright
  6554  //    notice, this list of conditions and the following disclaimer in the
  6555  //    documentation and/or other materials provided with the distribution.
  6556  //
  6557  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  6558  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  6559  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  6560  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  6561  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  6562  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  6563  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  6564  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  6565  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  6566  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  6567  //
  6568  // $FreeBSD$
  6569  
  6570  // -
  6571  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
  6572  //
  6573  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
  6574  // All rights reserved.
  6575  //
  6576  // Redistribution and use in source and binary forms, with or without
  6577  // modification, are permitted provided that the following conditions
  6578  // are met:
  6579  // 1. Redistributions of source code must retain the above copyright
  6580  //    notice, this list of conditions and the following disclaimer.
  6581  // 2. Redistributions in binary form must reproduce the above copyright
  6582  //    notice, this list of conditions and the following disclaimer in the
  6583  //    documentation and/or other materials provided with the distribution.
  6584  //
  6585  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  6586  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  6587  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  6588  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  6589  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  6590  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  6591  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  6592  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  6593  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  6594  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  6595  // SUCH DAMAGE.
  6596  //
  6597  // $FreeBSD$
  6598  
  6599  type fpos_t = int64 /* stdio.h:47:18 */
  6600  
  6601  type off_t = int64 /* stdio.h:62:18 */
  6602  
  6603  type off64_t = int64 /* stdio.h:72:19 */
  6604  
  6605  // NB: to fit things in six character monocase externals, the stdio
  6606  // code uses the prefix `__s' for stdio objects, typically followed
  6607  // by a three-character attempt at a mnemonic.
  6608  
  6609  // stdio buffers
  6610  type __sbuf = struct {
  6611  	F_base uintptr
  6612  	F_size int32
  6613  	_      [4]byte
  6614  } /* stdio.h:91:1 */
  6615  
  6616  // stdio state variables.
  6617  //
  6618  // The following always hold:
  6619  //
  6620  //	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
  6621  //		_lbfsize is -_bf._size, else _lbfsize is 0
  6622  //	if _flags&__SRD, _w is 0
  6623  //	if _flags&__SWR, _r is 0
  6624  //
  6625  // This ensures that the getc and putc macros (or inline functions) never
  6626  // try to write or read from a file that is in `read' or `write' mode.
  6627  // (Moreover, they can, and do, automatically switch from read mode to
  6628  // write mode, and back, on "r+" and "w+" files.)
  6629  //
  6630  // _lbfsize is used only to make the inline line-buffered output stream
  6631  // code as compact as possible.
  6632  //
  6633  // _ub, _up, and _ur are used when ungetc() pushes back more characters
  6634  // than fit in the current _bf, or when ungetc() pushes back a character
  6635  // that does not match the previous one in _bf.  When this happens,
  6636  // _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
  6637  // _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
  6638  //
  6639  // Certain members of __sFILE are accessed directly via macros or
  6640  // inline functions.  To preserve ABI compat, these members must not
  6641  // be disturbed.  These members are marked below with (*).
  6642  type __sFILE = struct {
  6643  	F_p     uintptr
  6644  	F_r     int32
  6645  	F_w     int32
  6646  	F_flags int16
  6647  	F_file  int16
  6648  	_       [4]byte
  6649  	F_bf    struct {
  6650  		F_base uintptr
  6651  		F_size int32
  6652  		_      [4]byte
  6653  	}
  6654  	F_lbfsize int32
  6655  	_         [4]byte
  6656  	F_cookie  uintptr
  6657  	F_close   uintptr
  6658  	F_read    uintptr
  6659  	F_seek    uintptr
  6660  	F_write   uintptr
  6661  	F_ub      struct {
  6662  		F_base uintptr
  6663  		F_size int32
  6664  		_      [4]byte
  6665  	}
  6666  	F_up   uintptr
  6667  	F_ur   int32
  6668  	F_ubuf [3]uint8
  6669  	F_nbuf [1]uint8
  6670  	F_lb   struct {
  6671  		F_base uintptr
  6672  		F_size int32
  6673  		_      [4]byte
  6674  	}
  6675  	F_blksize     int32
  6676  	_             [4]byte
  6677  	F_offset      fpos_t
  6678  	F_fl_mutex    uintptr
  6679  	F_fl_owner    uintptr
  6680  	F_fl_count    int32
  6681  	F_orientation int32
  6682  	F_mbstate     struct {
  6683  		_           [0]uint64
  6684  		F__mbstate8 [128]int8
  6685  	}
  6686  	F_flags2 int32
  6687  	_        [4]byte
  6688  } /* stdio.h:124:1 */
  6689  
  6690  type FILE = __sFILE /* stdio.h:165:24 */
  6691  type cookie_io_functions_t = struct {
  6692  	Fread  uintptr
  6693  	Fwrite uintptr
  6694  	Fseek  uintptr
  6695  	Fclose uintptr
  6696  } /* stdio.h:428:3 */
  6697  
  6698  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
  6699  // B.8.2.7 for the rationale behind the *_unlocked() macros.
  6700  
  6701  type i64 = sqlite3_int64  /* sqlite3expert.c:20:23 */
  6702  type u64 = sqlite3_uint64 /* sqlite3expert.c:21:24 */
  6703  
  6704  type IdxColumn1 = struct {
  6705  	FzName uintptr
  6706  	FzColl uintptr
  6707  	FiPk   int32
  6708  	_      [4]byte
  6709  } /* sqlite3expert.h:17:9 */
  6710  
  6711  type IdxColumn = IdxColumn1 /* sqlite3expert.c:23:26 */
  6712  type IdxConstraint1 = struct {
  6713  	FzColl  uintptr
  6714  	FbRange int32
  6715  	FiCol   int32
  6716  	FbFlag  int32
  6717  	FbDesc  int32
  6718  	FpNext  uintptr
  6719  	FpLink  uintptr
  6720  } /* sqlite3expert.h:17:9 */
  6721  
  6722  type IdxConstraint = IdxConstraint1 /* sqlite3expert.c:24:30 */
  6723  type IdxScan1 = struct {
  6724  	FpTab      uintptr
  6725  	FiDb       int32
  6726  	_          [4]byte
  6727  	Fcovering  i64
  6728  	FpOrder    uintptr
  6729  	FpEq       uintptr
  6730  	FpRange    uintptr
  6731  	FpNextScan uintptr
  6732  } /* sqlite3expert.h:17:9 */
  6733  
  6734  type IdxScan = IdxScan1 /* sqlite3expert.c:25:24 */
  6735  type IdxStatement1 = struct {
  6736  	FiId   int32
  6737  	_      [4]byte
  6738  	FzSql  uintptr
  6739  	FzIdx  uintptr
  6740  	FzEQP  uintptr
  6741  	FpNext uintptr
  6742  } /* sqlite3expert.h:17:9 */
  6743  
  6744  type IdxStatement = IdxStatement1 /* sqlite3expert.c:26:29 */
  6745  type IdxTable1 = struct {
  6746  	FnCol  int32
  6747  	_      [4]byte
  6748  	FzName uintptr
  6749  	FaCol  uintptr
  6750  	FpNext uintptr
  6751  } /* sqlite3expert.h:17:9 */
  6752  
  6753  type IdxTable = IdxTable1 /* sqlite3expert.c:27:25 */
  6754  type IdxWrite1 = struct {
  6755  	FpTab  uintptr
  6756  	FeOp   int32
  6757  	_      [4]byte
  6758  	FpNext uintptr
  6759  } /* sqlite3expert.h:17:9 */
  6760  
  6761  type IdxWrite = IdxWrite1 /* sqlite3expert.c:28:25 */
  6762  
  6763  // A hash table for storing strings. With space for a payload string
  6764  // with each entry. Methods are:
  6765  //
  6766  //   idxHashInit()
  6767  //   idxHashClear()
  6768  //   idxHashAdd()
  6769  //   idxHashSearch()
  6770  type IdxHashEntry1 = struct {
  6771  	FzKey      uintptr
  6772  	FzVal      uintptr
  6773  	FzVal2     uintptr
  6774  	FpHashNext uintptr
  6775  	FpNext     uintptr
  6776  } /* sqlite3expert.h:17:9 */
  6777  
  6778  // A hash table for storing strings. With space for a payload string
  6779  // with each entry. Methods are:
  6780  //
  6781  //   idxHashInit()
  6782  //   idxHashClear()
  6783  //   idxHashAdd()
  6784  //   idxHashSearch()
  6785  type IdxHashEntry = IdxHashEntry1 /* sqlite3expert.c:120:29 */
  6786  type IdxHash1 = struct {
  6787  	FpFirst uintptr
  6788  	FaHash  [1023]uintptr
  6789  } /* sqlite3expert.h:17:9 */
  6790  
  6791  type IdxHash = IdxHash1 /* sqlite3expert.c:121:24 */
  6792  
  6793  // Allocate and return nByte bytes of zeroed memory using sqlite3_malloc().
  6794  // If the allocation fails, set *pRc to SQLITE_NOMEM and return NULL.
  6795  func idxMalloc(tls *libc.TLS, pRc uintptr, nByte int32) uintptr { /* sqlite3expert.c:158:13: */
  6796  	var pRet uintptr
  6797  
  6798  	pRet = sqlite3.Xsqlite3_malloc(tls, nByte)
  6799  	if pRet != 0 {
  6800  		libc.Xmemset(tls, pRet, 0, uint64(nByte))
  6801  	} else {
  6802  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
  6803  	}
  6804  	return pRet
  6805  }
  6806  
  6807  // Initialize an IdxHash hash table.
  6808  func idxHashInit(tls *libc.TLS, pHash uintptr) { /* sqlite3expert.c:174:13: */
  6809  	libc.Xmemset(tls, pHash, 0, uint64(unsafe.Sizeof(IdxHash{})))
  6810  }
  6811  
  6812  // Reset an IdxHash hash table.
  6813  func idxHashClear(tls *libc.TLS, pHash uintptr) { /* sqlite3expert.c:181:13: */
  6814  	var i int32
  6815  	for i = 0; i < IDX_HASH_SIZE; i++ {
  6816  		var pEntry uintptr
  6817  		var pNext uintptr
  6818  		for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 8 /* &.aHash */) + uintptr(i)*8)); pEntry != 0; pEntry = pNext {
  6819  			pNext = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext
  6820  			sqlite3.Xsqlite3_free(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2)
  6821  			sqlite3.Xsqlite3_free(tls, pEntry)
  6822  		}
  6823  	}
  6824  	libc.Xmemset(tls, pHash, 0, uint64(unsafe.Sizeof(IdxHash{})))
  6825  }
  6826  
  6827  // Return the index of the hash bucket that the string specified by the
  6828  // arguments to this function belongs.
  6829  func idxHashString(tls *libc.TLS, z uintptr, n int32) int32 { /* sqlite3expert.c:199:12: */
  6830  	var ret uint32 = uint32(0)
  6831  	var i int32
  6832  	for i = 0; i < n; i++ {
  6833  		ret = ret + ((ret << 3) + uint32((uint8(*(*int8)(unsafe.Pointer(z + uintptr(i)))))))
  6834  	}
  6835  	return (int32(ret % uint32(IDX_HASH_SIZE)))
  6836  }
  6837  
  6838  // If zKey is already present in the hash table, return non-zero and do
  6839  // nothing. Otherwise, add an entry with key zKey and payload string zVal to
  6840  // the hash table passed as the second argument.
  6841  func idxHashAdd(tls *libc.TLS, pRc uintptr, pHash uintptr, zKey uintptr, zVal uintptr) int32 { /* sqlite3expert.c:213:12: */
  6842  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
  6843  	var iHash int32 = idxHashString(tls, zKey, nKey)
  6844  	var nVal int32 = func() int32 {
  6845  		if zVal != 0 {
  6846  			return int32(libc.Xstrlen(tls, zVal))
  6847  		}
  6848  		return 0
  6849  	}()
  6850  	var pEntry uintptr
  6851  
  6852  	for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 8 /* &.aHash */) + uintptr(iHash)*8)); pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext {
  6853  		if (int32(libc.Xstrlen(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey)) == nKey) && (0 == libc.Xmemcmp(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint64(nKey))) {
  6854  			return 1
  6855  		}
  6856  	}
  6857  	pEntry = idxMalloc(tls, pRc, (int32((((uint64(unsafe.Sizeof(IdxHashEntry{})) + uint64(nKey)) + uint64(1)) + uint64(nVal)) + uint64(1))))
  6858  	if pEntry != 0 {
  6859  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey = (pEntry + 1*40)
  6860  		libc.Xmemcpy(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint64(nKey))
  6861  		if zVal != 0 {
  6862  			(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal = ((*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey + uintptr((nKey + 1)))
  6863  			libc.Xmemcpy(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal, zVal, uint64(nVal))
  6864  		}
  6865  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext = *(*uintptr)(unsafe.Pointer((pHash + 8 /* &.aHash */) + uintptr(iHash)*8))
  6866  		*(*uintptr)(unsafe.Pointer((pHash + 8 /* &.aHash */) + uintptr(iHash)*8)) = pEntry
  6867  
  6868  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext = (*IdxHash)(unsafe.Pointer(pHash)).FpFirst
  6869  		(*IdxHash)(unsafe.Pointer(pHash)).FpFirst = pEntry
  6870  	}
  6871  	return 0
  6872  }
  6873  
  6874  // If zKey/nKey is present in the hash table, return a pointer to the
  6875  // hash-entry object.
  6876  func idxHashFind(tls *libc.TLS, pHash uintptr, zKey uintptr, nKey int32) uintptr { /* sqlite3expert.c:250:21: */
  6877  	var iHash int32
  6878  	var pEntry uintptr
  6879  	if nKey < 0 {
  6880  		nKey = int32(libc.Xstrlen(tls, zKey))
  6881  	}
  6882  	iHash = idxHashString(tls, zKey, nKey)
  6883  
  6884  	for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 8 /* &.aHash */) + uintptr(iHash)*8)); pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext {
  6885  		if (int32(libc.Xstrlen(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey)) == nKey) && (0 == libc.Xmemcmp(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint64(nKey))) {
  6886  			return pEntry
  6887  		}
  6888  	}
  6889  	return uintptr(0)
  6890  }
  6891  
  6892  // If the hash table contains an entry with a key equal to the string
  6893  // passed as the final two arguments to this function, return a pointer
  6894  // to the payload string. Otherwise, if zKey/nKey is not present in the
  6895  // hash table, return NULL.
  6896  func idxHashSearch(tls *libc.TLS, pHash uintptr, zKey uintptr, nKey int32) uintptr { /* sqlite3expert.c:270:19: */
  6897  	var pEntry uintptr = idxHashFind(tls, pHash, zKey, nKey)
  6898  	if pEntry != 0 {
  6899  		return (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal
  6900  	}
  6901  	return uintptr(0)
  6902  }
  6903  
  6904  // Allocate and return a new IdxConstraint object. Set the IdxConstraint.zColl
  6905  // variable to point to a copy of nul-terminated string zColl.
  6906  func idxNewConstraint(tls *libc.TLS, pRc uintptr, zColl uintptr) uintptr { /* sqlite3expert.c:280:22: */
  6907  	var pNew uintptr
  6908  	var nColl int32 = int32(libc.Xstrlen(tls, zColl))
  6909  
  6910  	pNew = idxMalloc(tls, pRc, (int32((uint64(unsafe.Sizeof(IdxConstraint{})) * uint64(nColl)) + uint64(1))))
  6911  	if pNew != 0 {
  6912  		(*IdxConstraint)(unsafe.Pointer(pNew)).FzColl = (pNew + 1*40)
  6913  		libc.Xmemcpy(tls, (*IdxConstraint)(unsafe.Pointer(pNew)).FzColl, zColl, (uint64(nColl + 1)))
  6914  	}
  6915  	return pNew
  6916  }
  6917  
  6918  // An error associated with database handle db has just occurred. Pass
  6919  // the error message to callback function xOut.
  6920  func idxDatabaseError(tls *libc.TLS, db uintptr, pzErrmsg uintptr) { /* sqlite3expert.c:297:13: */
  6921  	bp := tls.Alloc(8)
  6922  	defer tls.Free(8)
  6923  
  6924  	*(*uintptr)(unsafe.Pointer(pzErrmsg)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
  6925  }
  6926  
  6927  // Prepare an SQL statement.
  6928  func idxPrepareStmt(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) int32 { /* sqlite3expert.c:307:12: */
  6929  	var rc int32 = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0))
  6930  	if rc != SQLITE_OK {
  6931  		*(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0)
  6932  		idxDatabaseError(tls, db, pzErrmsg)
  6933  	}
  6934  	return rc
  6935  }
  6936  
  6937  // Prepare an SQL statement using the results of a printf() formatting.
  6938  func idxPrintfPrepareStmt(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3expert.c:324:12: */
  6939  	var ap va_list
  6940  	_ = ap
  6941  	var rc int32
  6942  	var zSql uintptr
  6943  	ap = va
  6944  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
  6945  	if zSql == uintptr(0) {
  6946  		rc = SQLITE_NOMEM
  6947  	} else {
  6948  		rc = idxPrepareStmt(tls, db, ppStmt, pzErrmsg, zSql)
  6949  		sqlite3.Xsqlite3_free(tls, zSql)
  6950  	}
  6951  	_ = ap
  6952  	return rc
  6953  }
  6954  
  6955  // ************************************************************************
  6956  //
  6957  // Beginning of virtual table implementation.
  6958  type ExpertVtab1 = struct {
  6959  	Fbase    sqlite3_vtab
  6960  	FpTab    uintptr
  6961  	FpExpert uintptr
  6962  } /* sqlite3expert.c:350:9 */
  6963  
  6964  // ************************************************************************
  6965  //
  6966  // Beginning of virtual table implementation.
  6967  type ExpertVtab = ExpertVtab1 /* sqlite3expert.c:350:27 */
  6968  
  6969  type ExpertCsr1 = struct {
  6970  	Fbase  sqlite3_vtab_cursor
  6971  	FpData uintptr
  6972  } /* sqlite3expert.c:357:9 */
  6973  
  6974  type ExpertCsr = ExpertCsr1 /* sqlite3expert.c:357:26 */
  6975  
  6976  func expertDequote(tls *libc.TLS, zIn uintptr) uintptr { /* sqlite3expert.c:363:13: */
  6977  	var n int32 = int32(libc.Xstrlen(tls, zIn))
  6978  	var zRet uintptr = sqlite3.Xsqlite3_malloc(tls, n)
  6979  
  6980  	if zRet != 0 {
  6981  		var iOut int32 = 0
  6982  		var iIn int32 = 0
  6983  		for iIn = 1; iIn < (n - 1); iIn++ {
  6984  			if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == '\'' {
  6985  
  6986  				iIn++
  6987  			}
  6988  			*(*int8)(unsafe.Pointer(zRet + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
  6989  		}
  6990  		*(*int8)(unsafe.Pointer(zRet + uintptr(iOut))) = int8(0)
  6991  	}
  6992  
  6993  	return zRet
  6994  }
  6995  
  6996  // This function is the implementation of both the xConnect and xCreate
  6997  // methods of the r-tree virtual table.
  6998  //
  6999  //   argv[0]   -> module name
  7000  //   argv[1]   -> database name
  7001  //   argv[2]   -> table name
  7002  //   argv[...] -> column names...
  7003  func expertConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:395:12: */
  7004  	bp := tls.Alloc(4)
  7005  	defer tls.Free(4)
  7006  
  7007  	var pExpert uintptr = pAux
  7008  	var p uintptr = uintptr(0)
  7009  	// var rc int32 at bp, 4
  7010  
  7011  	if argc != 4 {
  7012  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3 /* "internal error!" */, 0)
  7013  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
  7014  	} else {
  7015  		var zCreateTable uintptr = expertDequote(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
  7016  		if zCreateTable != 0 {
  7017  			*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db, zCreateTable)
  7018  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  7019  				p = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(ExpertVtab{})))
  7020  			}
  7021  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  7022  				(*ExpertVtab)(unsafe.Pointer(p)).FpExpert = pExpert
  7023  				(*ExpertVtab)(unsafe.Pointer(p)).FpTab = (*sqlite3expert)(unsafe.Pointer(pExpert)).FpTable
  7024  
  7025  			}
  7026  			sqlite3.Xsqlite3_free(tls, zCreateTable)
  7027  		} else {
  7028  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM
  7029  		}
  7030  	}
  7031  
  7032  	*(*uintptr)(unsafe.Pointer(ppVtab)) = p
  7033  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7034  }
  7035  
  7036  func expertDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3expert.c:431:12: */
  7037  	var p uintptr = pVtab
  7038  	sqlite3.Xsqlite3_free(tls, p)
  7039  	return SQLITE_OK
  7040  }
  7041  
  7042  func expertBestIndex(tls *libc.TLS, pVtab uintptr, pIdxInfo uintptr) int32 { /* sqlite3expert.c:437:12: */
  7043  	bp := tls.Alloc(4)
  7044  	defer tls.Free(4)
  7045  
  7046  	var p uintptr = pVtab
  7047  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  7048  	var n int32 = 0
  7049  	var pScan uintptr
  7050  	var opmask int32 = ((((SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_GT) | SQLITE_INDEX_CONSTRAINT_LT) | SQLITE_INDEX_CONSTRAINT_GE) | SQLITE_INDEX_CONSTRAINT_LE)
  7051  
  7052  	pScan = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(IdxScan{})))
  7053  	if pScan != 0 {
  7054  		var i int32
  7055  
  7056  		// Link the new scan object into the list
  7057  		(*IdxScan)(unsafe.Pointer(pScan)).FpTab = (*ExpertVtab)(unsafe.Pointer(p)).FpTab
  7058  		(*IdxScan)(unsafe.Pointer(pScan)).FpNextScan = (*sqlite3expert)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpExpert)).FpScan
  7059  		(*sqlite3expert)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpExpert)).FpScan = pScan
  7060  
  7061  		// Add the constraints to the IdxScan object
  7062  		for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
  7063  			var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
  7064  			if ((((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0) &&
  7065  				((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn >= 0)) &&
  7066  				((*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpTab)).FaCol+uintptr((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn)*24)).FiPk == 0)) &&
  7067  				((int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) & opmask) != 0) {
  7068  				var pNew uintptr
  7069  				var zColl uintptr = sqlite3.Xsqlite3_vtab_collation(tls, pIdxInfo, i)
  7070  				pNew = idxNewConstraint(tls, bp /* &rc */, zColl)
  7071  				if pNew != 0 {
  7072  					(*IdxConstraint)(unsafe.Pointer(pNew)).FiCol = (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn
  7073  					if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
  7074  						(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpEq
  7075  						(*IdxScan)(unsafe.Pointer(pScan)).FpEq = pNew
  7076  					} else {
  7077  						(*IdxConstraint)(unsafe.Pointer(pNew)).FbRange = 1
  7078  						(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpRange
  7079  						(*IdxScan)(unsafe.Pointer(pScan)).FpRange = pNew
  7080  					}
  7081  				}
  7082  				n++
  7083  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = n
  7084  			}
  7085  		}
  7086  
  7087  		// Add the ORDER BY to the IdxScan object
  7088  		for i = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy - 1); i >= 0; i-- {
  7089  			var iCol int32 = (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(i)*8)).FiColumn
  7090  			if iCol >= 0 {
  7091  				var pNew uintptr = idxNewConstraint(tls, bp /* &rc */, (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpTab)).FaCol+uintptr(iCol)*24)).FzColl)
  7092  				if pNew != 0 {
  7093  					(*IdxConstraint)(unsafe.Pointer(pNew)).FiCol = iCol
  7094  					(*IdxConstraint)(unsafe.Pointer(pNew)).FbDesc = int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(i)*8)).Fdesc)
  7095  					(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpOrder
  7096  					(*IdxConstraint)(unsafe.Pointer(pNew)).FpLink = (*IdxScan)(unsafe.Pointer(pScan)).FpOrder
  7097  					(*IdxScan)(unsafe.Pointer(pScan)).FpOrder = pNew
  7098  					n++
  7099  				}
  7100  			}
  7101  		}
  7102  	}
  7103  
  7104  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (1000000.0 / (float64(n + 1)))
  7105  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7106  }
  7107  
  7108  func expertUpdate(tls *libc.TLS, pVtab uintptr, nData int32, azData uintptr, pRowid uintptr) int32 { /* sqlite3expert.c:504:12: */
  7109  	_ = pVtab
  7110  	_ = nData
  7111  	_ = azData
  7112  	_ = pRowid
  7113  	return SQLITE_OK
  7114  }
  7115  
  7116  // Virtual table module xOpen method.
  7117  func expertOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* sqlite3expert.c:520:12: */
  7118  	bp := tls.Alloc(4)
  7119  	defer tls.Free(4)
  7120  
  7121  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  7122  	var pCsr uintptr
  7123  	_ = pVTab
  7124  	pCsr = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(ExpertCsr{})))
  7125  	*(*uintptr)(unsafe.Pointer(ppCursor)) = pCsr
  7126  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7127  }
  7128  
  7129  // Virtual table module xClose method.
  7130  func expertClose(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:532:12: */
  7131  	var pCsr uintptr = cur
  7132  	sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7133  	sqlite3.Xsqlite3_free(tls, pCsr)
  7134  	return SQLITE_OK
  7135  }
  7136  
  7137  // Virtual table module xEof method.
  7138  //
  7139  // Return non-zero if the cursor does not currently point to a valid
  7140  // record (i.e if the scan has finished), or zero otherwise.
  7141  func expertEof(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:545:12: */
  7142  	var pCsr uintptr = cur
  7143  	return (libc.Bool32((*ExpertCsr)(unsafe.Pointer(pCsr)).FpData == uintptr(0)))
  7144  }
  7145  
  7146  // Virtual table module xNext method.
  7147  func expertNext(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:553:12: */
  7148  	var pCsr uintptr = cur
  7149  	var rc int32 = SQLITE_OK
  7150  
  7151  	rc = sqlite3.Xsqlite3_step(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7152  	if rc != SQLITE_ROW {
  7153  		rc = sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7154  		(*ExpertCsr)(unsafe.Pointer(pCsr)).FpData = uintptr(0)
  7155  	} else {
  7156  		rc = SQLITE_OK
  7157  	}
  7158  
  7159  	return rc
  7160  }
  7161  
  7162  // Virtual table module xRowid method.
  7163  func expertRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* sqlite3expert.c:572:12: */
  7164  	_ = cur
  7165  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
  7166  	return SQLITE_OK
  7167  }
  7168  
  7169  // Virtual table module xColumn method.
  7170  func expertColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3expert.c:581:12: */
  7171  	var pCsr uintptr = cur
  7172  	var pVal uintptr
  7173  	pVal = sqlite3.Xsqlite3_column_value(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData, i)
  7174  	if pVal != 0 {
  7175  		sqlite3.Xsqlite3_result_value(tls, ctx, pVal)
  7176  	}
  7177  	return SQLITE_OK
  7178  }
  7179  
  7180  // Virtual table module xFilter method.
  7181  func expertFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3expert.c:594:12: */
  7182  	bp := tls.Alloc(8)
  7183  	defer tls.Free(8)
  7184  
  7185  	var pCsr uintptr = cur
  7186  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
  7187  	var pExpert uintptr = (*ExpertVtab)(unsafe.Pointer(pVtab)).FpExpert
  7188  	var rc int32
  7189  
  7190  	_ = idxNum
  7191  	_ = idxStr
  7192  	_ = argc
  7193  	_ = argv
  7194  	rc = sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7195  	(*ExpertCsr)(unsafe.Pointer(pCsr)).FpData = uintptr(0)
  7196  	if rc == SQLITE_OK {
  7197  		rc = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(pExpert)).Fdb, (pCsr + 8 /* &.pData */), (pVtab /* &.base */ + 16 /* &.zErrMsg */),
  7198  			ts+19 /* "SELECT * FROM ma..." */, libc.VaList(bp, (*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(pVtab)).FpTab)).FzName))
  7199  	}
  7200  
  7201  	if rc == SQLITE_OK {
  7202  		rc = expertNext(tls, cur)
  7203  	}
  7204  	return rc
  7205  }
  7206  
  7207  func idxRegisterVtab(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:622:12: */
  7208  
  7209  	return sqlite3.Xsqlite3_create_module(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, ts+56 /* "expert" */, uintptr(unsafe.Pointer(&expertModule)), p)
  7210  }
  7211  
  7212  var expertModule = sqlite3_module{
  7213  	FiVersion:    2, // iVersion
  7214  	FxCreate:     0, // xCreate - create a table
  7215  	FxConnect:    0, // xConnect - connect to an existing table
  7216  	FxBestIndex:  0, // xBestIndex - Determine search strategy
  7217  	FxDisconnect: 0, // xDisconnect - Disconnect from a table
  7218  	FxDestroy:    0, // xDestroy - Drop a table
  7219  	FxOpen:       0, // xOpen - open a cursor
  7220  	FxClose:      0, // xClose - close a cursor
  7221  	FxFilter:     0, // xFilter - configure scan constraints
  7222  	FxNext:       0, // xNext - advance a cursor
  7223  	FxEof:        0, // xEof
  7224  	FxColumn:     0, // xColumn - read data
  7225  	FxRowid:      0, // xRowid - read data
  7226  	FxUpdate:     0, // xShadowName
  7227  } /* sqlite3expert.c:623:25 */
  7228  
  7229  //
  7230  // End of virtual table implementation.
  7231  //
  7232  // Finalize SQL statement pStmt. If (*pRc) is SQLITE_OK when this function
  7233  // is called, set it to the return value of sqlite3_finalize() before
  7234  // returning. Otherwise, discard the sqlite3_finalize() return value.
  7235  func idxFinalize(tls *libc.TLS, pRc uintptr, pStmt uintptr) { /* sqlite3expert.c:660:13: */
  7236  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, pStmt)
  7237  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
  7238  		*(*int32)(unsafe.Pointer(pRc)) = rc
  7239  	}
  7240  }
  7241  
  7242  // Attempt to allocate an IdxTable structure corresponding to table zTab
  7243  // in the main database of connection db. If successful, set (*ppOut) to
  7244  // point to the new object and return SQLITE_OK. Otherwise, return an
  7245  // SQLite error code and set (*ppOut) to NULL. In this case *pzErrmsg may be
  7246  // set to point to an error string.
  7247  //
  7248  // It is the responsibility of the caller to eventually free either the
  7249  // IdxTable object or error message using sqlite3_free().
  7250  func idxGetTableInfo(tls *libc.TLS, db uintptr, zTab uintptr, ppOut uintptr, pzErrmsg uintptr) int32 { /* sqlite3expert.c:675:12: */
  7251  	bp := tls.Alloc(40)
  7252  	defer tls.Free(40)
  7253  
  7254  	*(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)) = uintptr(0)
  7255  	var nCol int32 = 0
  7256  	var nTab int32 = int32(libc.Xstrlen(tls, zTab))
  7257  	var nByte int32 = (int32((uint64(unsafe.Sizeof(IdxTable{})) + uint64(nTab)) + uint64(1)))
  7258  	var pNew uintptr = uintptr(0)
  7259  	// var rc int32 at bp+24, 4
  7260  
  7261  	var rc2 int32
  7262  	var pCsr uintptr = uintptr(0)
  7263  	var nPk int32 = 0
  7264  
  7265  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxPrintfPrepareStmt(tls, db, bp+8 /* &p1 */, pzErrmsg, ts+63 /* "PRAGMA table_xin..." */, libc.VaList(bp, zTab))
  7266  	for (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))) {
  7267  		*(*uintptr)(unsafe.Pointer(bp + 16 /* zCol */)) = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 1)
  7268  		nByte = nByte + (1 + int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zCol */)))))
  7269  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3.Xsqlite3_table_column_metadata(tls,
  7270  			db, ts+85 /* "main" */, zTab, *(*uintptr)(unsafe.Pointer(bp + 16 /* zCol */)), uintptr(0), bp+16 /* &zCol */, uintptr(0), uintptr(0), uintptr(0))
  7271  		nByte = nByte + (1 + int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* zCol */)))))
  7272  		nCol++
  7273  		nPk = nPk + (libc.Bool32(sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 5) > 0))
  7274  	}
  7275  	rc2 = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))
  7276  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  7277  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = rc2
  7278  	}
  7279  
  7280  	nByte = int32(uint64(nByte) + (uint64(unsafe.Sizeof(IdxColumn{})) * uint64(nCol)))
  7281  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  7282  		pNew = idxMalloc(tls, bp+24 /* &rc */, nByte)
  7283  	}
  7284  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  7285  		(*IdxTable)(unsafe.Pointer(pNew)).FaCol = (pNew + 1*32)
  7286  		(*IdxTable)(unsafe.Pointer(pNew)).FnCol = nCol
  7287  		pCsr = ((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*24)
  7288  	}
  7289  
  7290  	nCol = 0
  7291  	for (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))) {
  7292  		*(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)) = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 1)
  7293  		var nCopy int32 = (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)))) + 1)
  7294  		(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*24)).FzName = pCsr
  7295  		(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*24)).FiPk = (libc.Bool32((sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 5) == 1) && (nPk == 1)))
  7296  		libc.Xmemcpy(tls, pCsr, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)), uint64(nCopy))
  7297  		pCsr += uintptr(nCopy)
  7298  
  7299  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = sqlite3.Xsqlite3_table_column_metadata(tls,
  7300  			db, ts+85 /* "main" */, zTab, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)), uintptr(0), bp+32 /* &zCol */, uintptr(0), uintptr(0), uintptr(0))
  7301  		if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  7302  			nCopy = (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)))) + 1)
  7303  			(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*24)).FzColl = pCsr
  7304  			libc.Xmemcpy(tls, pCsr, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCol */)), uint64(nCopy))
  7305  			pCsr += uintptr(nCopy)
  7306  		}
  7307  
  7308  		nCol++
  7309  	}
  7310  	idxFinalize(tls, bp+24 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))
  7311  
  7312  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) != SQLITE_OK {
  7313  		sqlite3.Xsqlite3_free(tls, pNew)
  7314  		pNew = uintptr(0)
  7315  	} else {
  7316  		(*IdxTable)(unsafe.Pointer(pNew)).FzName = pCsr
  7317  		libc.Xmemcpy(tls, (*IdxTable)(unsafe.Pointer(pNew)).FzName, zTab, (uint64(nTab + 1)))
  7318  	}
  7319  
  7320  	*(*uintptr)(unsafe.Pointer(ppOut)) = pNew
  7321  	return *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
  7322  }
  7323  
  7324  // This function is a no-op if *pRc is set to anything other than
  7325  // SQLITE_OK when it is called.
  7326  //
  7327  // If *pRc is initially set to SQLITE_OK, then the text specified by
  7328  // the printf() style arguments is appended to zIn and the result returned
  7329  // in a buffer allocated by sqlite3_malloc(). sqlite3_free() is called on
  7330  // zIn before returning.
  7331  func idxAppendText(tls *libc.TLS, pRc uintptr, zIn uintptr, zFmt uintptr, va uintptr) uintptr { /* sqlite3expert.c:758:13: */
  7332  	var ap va_list
  7333  	_ = ap
  7334  	var zAppend uintptr = uintptr(0)
  7335  	var zRet uintptr = uintptr(0)
  7336  	var nIn int32
  7337  	if zIn != 0 {
  7338  		nIn = int32(libc.Xstrlen(tls, zIn))
  7339  	} else {
  7340  		nIn = 0
  7341  	}
  7342  	var nAppend int32 = 0
  7343  	ap = va
  7344  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
  7345  		zAppend = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
  7346  		if zAppend != 0 {
  7347  			nAppend = int32(libc.Xstrlen(tls, zAppend))
  7348  			zRet = sqlite3.Xsqlite3_malloc(tls, ((nIn + nAppend) + 1))
  7349  		}
  7350  		if (zAppend != 0) && (zRet != 0) {
  7351  			if nIn != 0 {
  7352  				libc.Xmemcpy(tls, zRet, zIn, uint64(nIn))
  7353  			}
  7354  			libc.Xmemcpy(tls, (zRet + uintptr(nIn)), zAppend, (uint64(nAppend + 1)))
  7355  		} else {
  7356  			sqlite3.Xsqlite3_free(tls, zRet)
  7357  			zRet = uintptr(0)
  7358  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
  7359  		}
  7360  		sqlite3.Xsqlite3_free(tls, zAppend)
  7361  		sqlite3.Xsqlite3_free(tls, zIn)
  7362  	}
  7363  	_ = ap
  7364  	return zRet
  7365  }
  7366  
  7367  // Return true if zId must be quoted in order to use it as an SQL
  7368  // identifier, or false otherwise.
  7369  func idxIdentifierRequiresQuotes(tls *libc.TLS, zId uintptr) int32 { /* sqlite3expert.c:790:12: */
  7370  	var i int32
  7371  	for i = 0; *(*int8)(unsafe.Pointer(zId + uintptr(i))) != 0; i++ {
  7372  		if ((!(int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) == '_') &&
  7373  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= '9'))) &&
  7374  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= 'a') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= 'z'))) &&
  7375  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= 'A') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= 'Z')) {
  7376  			return 1
  7377  		}
  7378  	}
  7379  	return 0
  7380  }
  7381  
  7382  // This function appends an index column definition suitable for constraint
  7383  // pCons to the string passed as zIn and returns the result.
  7384  func idxAppendColDefn(tls *libc.TLS, pRc uintptr, zIn uintptr, pTab uintptr, pCons uintptr) uintptr { /* sqlite3expert.c:808:13: */
  7385  	bp := tls.Alloc(32)
  7386  	defer tls.Free(32)
  7387  
  7388  	var zRet uintptr = zIn
  7389  	var p uintptr = ((*IdxTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*IdxConstraint)(unsafe.Pointer(pCons)).FiCol)*24)
  7390  	if zRet != 0 {
  7391  		zRet = idxAppendText(tls, pRc, zRet, ts+90 /* ", " */, 0)
  7392  	}
  7393  
  7394  	if idxIdentifierRequiresQuotes(tls, (*IdxColumn)(unsafe.Pointer(p)).FzName) != 0 {
  7395  		zRet = idxAppendText(tls, pRc, zRet, ts+93 /* "%Q" */, libc.VaList(bp, (*IdxColumn)(unsafe.Pointer(p)).FzName))
  7396  	} else {
  7397  		zRet = idxAppendText(tls, pRc, zRet, ts /* "%s" */, libc.VaList(bp+8, (*IdxColumn)(unsafe.Pointer(p)).FzName))
  7398  	}
  7399  
  7400  	if sqlite3.Xsqlite3_stricmp(tls, (*IdxColumn)(unsafe.Pointer(p)).FzColl, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl) != 0 {
  7401  		if idxIdentifierRequiresQuotes(tls, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl) != 0 {
  7402  			zRet = idxAppendText(tls, pRc, zRet, ts+96 /* " COLLATE %Q" */, libc.VaList(bp+16, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl))
  7403  		} else {
  7404  			zRet = idxAppendText(tls, pRc, zRet, ts+108 /* " COLLATE %s" */, libc.VaList(bp+24, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl))
  7405  		}
  7406  	}
  7407  
  7408  	if (*IdxConstraint)(unsafe.Pointer(pCons)).FbDesc != 0 {
  7409  		zRet = idxAppendText(tls, pRc, zRet, ts+120 /* " DESC" */, 0)
  7410  	}
  7411  	return zRet
  7412  }
  7413  
  7414  // Search database dbm for an index compatible with the one idxCreateFromCons()
  7415  // would create from arguments pScan, pEq and pTail. If no error occurs and
  7416  // such an index is found, return non-zero. Or, if no such index is found,
  7417  // return zero.
  7418  //
  7419  // If an error occurs, set *pRc to an SQLite error code and return zero.
  7420  func idxFindCompatible(tls *libc.TLS, pRc uintptr, dbm uintptr, pScan uintptr, pEq uintptr, pTail uintptr) int32 { /* sqlite3expert.c:846:12: */
  7421  	bp := tls.Alloc(36)
  7422  	defer tls.Free(36)
  7423  
  7424  	var zTbl uintptr = (*IdxTable)(unsafe.Pointer((*IdxScan)(unsafe.Pointer(pScan)).FpTab)).FzName
  7425  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)) = uintptr(0)
  7426  	var pIter uintptr
  7427  	var nEq int32 = 0 // Number of elements in pEq
  7428  	// var rc int32 at bp+32, 4
  7429  
  7430  	// Count the elements in list pEq
  7431  	for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  7432  		nEq++
  7433  	}
  7434  
  7435  	*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+16 /* &pIdxList */, uintptr(0), ts+126 /* "PRAGMA index_lis..." */, libc.VaList(bp, zTbl))
  7436  	for (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */))) == SQLITE_ROW) {
  7437  		var bMatch int32 = 1
  7438  		var pT uintptr = pTail
  7439  		*(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */)) = uintptr(0)
  7440  		var zIdx uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)), 1)
  7441  
  7442  		// Zero the IdxConstraint.bFlag values in the pEq list
  7443  		for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  7444  			(*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag = 0
  7445  		}
  7446  
  7447  		*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+24 /* &pInfo */, uintptr(0), ts+147 /* "PRAGMA index_xIn..." */, libc.VaList(bp+8, zIdx))
  7448  		for (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */))) == SQLITE_ROW) {
  7449  			var iIdx int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */)), 0)
  7450  			var iCol int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */)), 1)
  7451  			var zColl uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */)), 4)
  7452  
  7453  			if iIdx < nEq {
  7454  				for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  7455  					if (*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag != 0 {
  7456  						continue
  7457  					}
  7458  					if (*IdxConstraint)(unsafe.Pointer(pIter)).FiCol != iCol {
  7459  						continue
  7460  					}
  7461  					if sqlite3.Xsqlite3_stricmp(tls, (*IdxConstraint)(unsafe.Pointer(pIter)).FzColl, zColl) != 0 {
  7462  						continue
  7463  					}
  7464  					(*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag = 1
  7465  					break
  7466  				}
  7467  				if pIter == uintptr(0) {
  7468  					bMatch = 0
  7469  					break
  7470  				}
  7471  			} else {
  7472  				if pT != 0 {
  7473  					if ((*IdxConstraint)(unsafe.Pointer(pT)).FiCol != iCol) || (sqlite3.Xsqlite3_stricmp(tls, (*IdxConstraint)(unsafe.Pointer(pT)).FzColl, zColl) != 0) {
  7474  						bMatch = 0
  7475  						break
  7476  					}
  7477  					pT = (*IdxConstraint)(unsafe.Pointer(pT)).FpLink
  7478  				}
  7479  			}
  7480  		}
  7481  		idxFinalize(tls, bp+32 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 24 /* pInfo */)))
  7482  
  7483  		if (*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK) && (bMatch != 0) {
  7484  			sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)))
  7485  			return 1
  7486  		}
  7487  	}
  7488  	idxFinalize(tls, bp+32 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)))
  7489  
  7490  	*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 32 /* rc */))
  7491  	return 0
  7492  }
  7493  
  7494  func idxCreateFromCons(tls *libc.TLS, p uintptr, pScan uintptr, pEq uintptr, pTail uintptr) int32 { /* sqlite3expert.c:913:12: */
  7495  	bp := tls.Alloc(44)
  7496  	defer tls.Free(44)
  7497  
  7498  	var dbm uintptr = (*sqlite3expert)(unsafe.Pointer(p)).Fdbm
  7499  	*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK
  7500  	if ((pEq != 0) || (pTail != 0)) && (0 == idxFindCompatible(tls, bp+40 /* &rc */, dbm, pScan, pEq, pTail)) {
  7501  		var pTab uintptr = (*IdxScan)(unsafe.Pointer(pScan)).FpTab
  7502  		var zCols uintptr = uintptr(0)
  7503  		var zIdx uintptr = uintptr(0)
  7504  		var pCons uintptr
  7505  		var h uint32 = uint32(0)
  7506  		var zFmt uintptr
  7507  
  7508  		for pCons = pEq; pCons != 0; pCons = (*IdxConstraint)(unsafe.Pointer(pCons)).FpLink {
  7509  			zCols = idxAppendColDefn(tls, bp+40 /* &rc */, zCols, pTab, pCons)
  7510  		}
  7511  		for pCons = pTail; pCons != 0; pCons = (*IdxConstraint)(unsafe.Pointer(pCons)).FpLink {
  7512  			zCols = idxAppendColDefn(tls, bp+40 /* &rc */, zCols, pTab, pCons)
  7513  		}
  7514  
  7515  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
  7516  			// Hash the list of columns to come up with a name for the index
  7517  			var zTable uintptr = (*IdxTable)(unsafe.Pointer((*IdxScan)(unsafe.Pointer(pScan)).FpTab)).FzName
  7518  			var zName uintptr // Index name
  7519  			var i int32
  7520  			for i = 0; *(*int8)(unsafe.Pointer(zCols + uintptr(i))) != 0; i++ {
  7521  				h = h + ((h << 3) + uint32(*(*int8)(unsafe.Pointer(zCols + uintptr(i)))))
  7522  			}
  7523  			zName = sqlite3.Xsqlite3_mprintf(tls, ts+169 /* "%s_idx_%08x" */, libc.VaList(bp, zTable, h))
  7524  			if zName == uintptr(0) {
  7525  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
  7526  			} else {
  7527  				if idxIdentifierRequiresQuotes(tls, zTable) != 0 {
  7528  					zFmt = ts + 181 /* "CREATE INDEX '%q..." */
  7529  				} else {
  7530  					zFmt = ts + 209 /* "CREATE INDEX %s ..." */
  7531  				}
  7532  				zIdx = sqlite3.Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp+16, zName, zTable, zCols))
  7533  				if !(zIdx != 0) {
  7534  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
  7535  				} else {
  7536  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3.Xsqlite3_exec(tls, dbm, zIdx, uintptr(0), uintptr(0), (*sqlite3expert)(unsafe.Pointer(p)).FpzErrmsg)
  7537  					idxHashAdd(tls, bp+40 /* &rc */, (p + 88 /* &.hIdx */), zName, zIdx)
  7538  				}
  7539  				sqlite3.Xsqlite3_free(tls, zName)
  7540  				sqlite3.Xsqlite3_free(tls, zIdx)
  7541  			}
  7542  		}
  7543  
  7544  		sqlite3.Xsqlite3_free(tls, zCols)
  7545  	}
  7546  	return *(*int32)(unsafe.Pointer(bp + 40 /* rc */))
  7547  }
  7548  
  7549  // Return true if list pList (linked by IdxConstraint.pLink) contains
  7550  // a constraint compatible with *p. Otherwise return false.
  7551  func idxFindConstraint(tls *libc.TLS, pList uintptr, p uintptr) int32 { /* sqlite3expert.c:974:12: */
  7552  	var pCmp uintptr
  7553  	for pCmp = pList; pCmp != 0; pCmp = (*IdxConstraint)(unsafe.Pointer(pCmp)).FpLink {
  7554  		if (*IdxConstraint)(unsafe.Pointer(p)).FiCol == (*IdxConstraint)(unsafe.Pointer(pCmp)).FiCol {
  7555  			return 1
  7556  		}
  7557  	}
  7558  	return 0
  7559  }
  7560  
  7561  func idxCreateFromWhere(tls *libc.TLS, p uintptr, pScan uintptr, pTail uintptr) int32 { /* sqlite3expert.c:982:12: */
  7562  	var p1 uintptr = uintptr(0)
  7563  	var pCon uintptr
  7564  	var rc int32
  7565  
  7566  	// Gather up all the == constraints.
  7567  	for pCon = (*IdxScan)(unsafe.Pointer(pScan)).FpEq; pCon != 0; pCon = (*IdxConstraint)(unsafe.Pointer(pCon)).FpNext {
  7568  		if !(idxFindConstraint(tls, p1, pCon) != 0) && !(idxFindConstraint(tls, pTail, pCon) != 0) {
  7569  			(*IdxConstraint)(unsafe.Pointer(pCon)).FpLink = p1
  7570  			p1 = pCon
  7571  		}
  7572  	}
  7573  
  7574  	// Create an index using the == constraints collected above. And the
  7575  	// range constraint/ORDER BY terms passed in by the caller, if any.
  7576  	rc = idxCreateFromCons(tls, p, pScan, p1, pTail)
  7577  
  7578  	// If no range/ORDER BY passed by the caller, create a version of the
  7579  	// index for each range constraint.
  7580  	if pTail == uintptr(0) {
  7581  		for pCon = (*IdxScan)(unsafe.Pointer(pScan)).FpRange; (rc == SQLITE_OK) && (pCon != 0); pCon = (*IdxConstraint)(unsafe.Pointer(pCon)).FpNext {
  7582  
  7583  			if !(idxFindConstraint(tls, p1, pCon) != 0) && !(idxFindConstraint(tls, pTail, pCon) != 0) {
  7584  				rc = idxCreateFromCons(tls, p, pScan, p1, pCon)
  7585  			}
  7586  		}
  7587  	}
  7588  
  7589  	return rc
  7590  }
  7591  
  7592  // Create candidate indexes in database [dbm] based on the data in
  7593  // linked-list pScan.
  7594  func idxCreateCandidates(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:1021:12: */
  7595  	var rc int32 = SQLITE_OK
  7596  	var pIter uintptr
  7597  
  7598  	for pIter = (*sqlite3expert)(unsafe.Pointer(p)).FpScan; (pIter != 0) && (rc == SQLITE_OK); pIter = (*IdxScan)(unsafe.Pointer(pIter)).FpNextScan {
  7599  		rc = idxCreateFromWhere(tls, p, pIter, uintptr(0))
  7600  		if (rc == SQLITE_OK) && ((*IdxScan)(unsafe.Pointer(pIter)).FpOrder != 0) {
  7601  			rc = idxCreateFromWhere(tls, p, pIter, (*IdxScan)(unsafe.Pointer(pIter)).FpOrder)
  7602  		}
  7603  	}
  7604  
  7605  	return rc
  7606  }
  7607  
  7608  // Free all elements of the linked list starting at pConstraint.
  7609  func idxConstraintFree(tls *libc.TLS, pConstraint uintptr) { /* sqlite3expert.c:1038:13: */
  7610  	var pNext uintptr
  7611  	var p uintptr
  7612  
  7613  	for p = pConstraint; p != 0; p = pNext {
  7614  		pNext = (*IdxConstraint)(unsafe.Pointer(p)).FpNext
  7615  		sqlite3.Xsqlite3_free(tls, p)
  7616  	}
  7617  }
  7618  
  7619  // Free all elements of the linked list starting from pScan up until pLast
  7620  // (pLast is not freed).
  7621  func idxScanFree(tls *libc.TLS, pScan uintptr, pLast uintptr) { /* sqlite3expert.c:1052:13: */
  7622  	var p uintptr
  7623  	var pNext uintptr
  7624  	for p = pScan; p != pLast; p = pNext {
  7625  		pNext = (*IdxScan)(unsafe.Pointer(p)).FpNextScan
  7626  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpOrder)
  7627  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpEq)
  7628  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpRange)
  7629  		sqlite3.Xsqlite3_free(tls, p)
  7630  	}
  7631  }
  7632  
  7633  // Free all elements of the linked list starting from pStatement up
  7634  // until pLast (pLast is not freed).
  7635  func idxStatementFree(tls *libc.TLS, pStatement uintptr, pLast uintptr) { /* sqlite3expert.c:1068:13: */
  7636  	var p uintptr
  7637  	var pNext uintptr
  7638  	for p = pStatement; p != pLast; p = pNext {
  7639  		pNext = (*IdxStatement)(unsafe.Pointer(p)).FpNext
  7640  		sqlite3.Xsqlite3_free(tls, (*IdxStatement)(unsafe.Pointer(p)).FzEQP)
  7641  		sqlite3.Xsqlite3_free(tls, (*IdxStatement)(unsafe.Pointer(p)).FzIdx)
  7642  		sqlite3.Xsqlite3_free(tls, p)
  7643  	}
  7644  }
  7645  
  7646  // Free the linked list of IdxTable objects starting at pTab.
  7647  func idxTableFree(tls *libc.TLS, pTab uintptr) { /* sqlite3expert.c:1082:13: */
  7648  	var pIter uintptr
  7649  	var pNext uintptr
  7650  	for pIter = pTab; pIter != 0; pIter = pNext {
  7651  		pNext = (*IdxTable)(unsafe.Pointer(pIter)).FpNext
  7652  		sqlite3.Xsqlite3_free(tls, pIter)
  7653  	}
  7654  }
  7655  
  7656  // Free the linked list of IdxWrite objects starting at pTab.
  7657  func idxWriteFree(tls *libc.TLS, pTab uintptr) { /* sqlite3expert.c:1094:13: */
  7658  	var pIter uintptr
  7659  	var pNext uintptr
  7660  	for pIter = pTab; pIter != 0; pIter = pNext {
  7661  		pNext = (*IdxWrite)(unsafe.Pointer(pIter)).FpNext
  7662  		sqlite3.Xsqlite3_free(tls, pIter)
  7663  	}
  7664  }
  7665  
  7666  // This function is called after candidate indexes have been created. It
  7667  // runs all the queries to see which indexes they prefer, and populates
  7668  // IdxStatement.zIdx and IdxStatement.zEQP with the results.
  7669  func idxFindIndexes(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1110:5: */
  7670  	bp := tls.Alloc(8228)
  7671  	defer tls.Free(8228)
  7672  
  7673  	var pStmt uintptr
  7674  	var dbm uintptr
  7675  	// var rc int32 at bp+8224, 4
  7676  
  7677  	// var hIdx IdxHash at bp+24, 8192
  7678  
  7679  	var zSql uintptr
  7680  	var nIdx int32
  7681  	var zIdx uintptr
  7682  	// int iId = sqlite3_column_int(pExplain, 0);
  7683  	// int iParent = sqlite3_column_int(pExplain, 1);
  7684  	// int iNotUsed = sqlite3_column_int(pExplain, 2);
  7685  	var zDetail uintptr
  7686  	var nDetail int32
  7687  	var i int32
  7688  	var pEntry uintptr
  7689  	// var pExplain uintptr at bp+8216, 8
  7690  	dbm = (*sqlite3expert)(unsafe.Pointer(p)).Fdbm
  7691  	*(*int32)(unsafe.Pointer(bp + 8224 /* rc */)) = SQLITE_OK
  7692  	idxHashInit(tls, bp+24 /* &hIdx */)
  7693  
  7694  	pStmt = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  7695  __1:
  7696  	if !((*(*int32)(unsafe.Pointer(bp + 8224 /* rc */)) == SQLITE_OK) && (pStmt != 0)) {
  7697  		goto __3
  7698  	}
  7699  	*(*uintptr)(unsafe.Pointer(bp + 8216 /* pExplain */)) = uintptr(0)
  7700  	idxHashClear(tls, bp+24 /* &hIdx */)
  7701  	*(*int32)(unsafe.Pointer(bp + 8224 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+8216 /* &pExplain */, pzErr,
  7702  		ts+235 /* "EXPLAIN QUERY PL..." */, libc.VaList(bp, (*IdxStatement)(unsafe.Pointer(pStmt)).FzSql))
  7703  __4:
  7704  	if !((*(*int32)(unsafe.Pointer(bp + 8224 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8216 /* pExplain */))) == SQLITE_ROW)) {
  7705  		goto __5
  7706  	}
  7707  	// int iId = sqlite3_column_int(pExplain, 0);
  7708  	// int iParent = sqlite3_column_int(pExplain, 1);
  7709  	// int iNotUsed = sqlite3_column_int(pExplain, 2);
  7710  	zDetail = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8216 /* pExplain */)), 3)
  7711  
  7712  	if !(!(zDetail != 0)) {
  7713  		goto __6
  7714  	}
  7715  	goto __4
  7716  __6:
  7717  	;
  7718  	nDetail = int32(libc.Xstrlen(tls, zDetail))
  7719  
  7720  	i = 0
  7721  __7:
  7722  	if !(i < nDetail) {
  7723  		goto __9
  7724  	}
  7725  	zIdx = uintptr(0)
  7726  	if !(((i + 13) < nDetail) && (libc.Xmemcmp(tls, (zDetail+uintptr(i)), ts+257 /* " USING INDEX " */, uint64(13)) == 0)) {
  7727  		goto __10
  7728  	}
  7729  	zIdx = (zDetail + uintptr((i + 13)))
  7730  	goto __11
  7731  __10:
  7732  	if !(((i + 22) < nDetail) &&
  7733  		(libc.Xmemcmp(tls, (zDetail+uintptr(i)), ts+271 /* " USING COVERING ..." */, uint64(22)) == 0)) {
  7734  		goto __12
  7735  	}
  7736  	zIdx = (zDetail + uintptr((i + 22)))
  7737  __12:
  7738  	;
  7739  __11:
  7740  	;
  7741  	if !(zIdx != 0) {
  7742  		goto __13
  7743  	}
  7744  	nIdx = 0
  7745  __14:
  7746  	if !((int32(*(*int8)(unsafe.Pointer(zIdx + uintptr(nIdx)))) != 0) && ((int32(*(*int8)(unsafe.Pointer(zIdx + uintptr(nIdx)))) != ' ') || (int32(*(*int8)(unsafe.Pointer(zIdx + uintptr((nIdx + 1))))) != '('))) {
  7747  		goto __15
  7748  	}
  7749  	nIdx++
  7750  	goto __14
  7751  __15:
  7752  	;
  7753  	zSql = idxHashSearch(tls, (p + 88 /* &.hIdx */), zIdx, nIdx)
  7754  	if !(zSql != 0) {
  7755  		goto __16
  7756  	}
  7757  	idxHashAdd(tls, bp+8224 /* &rc */, bp+24 /* &hIdx */, zSql, uintptr(0))
  7758  	if !(*(*int32)(unsafe.Pointer(bp + 8224 /* rc */)) != 0) {
  7759  		goto __17
  7760  	}
  7761  	goto find_indexes_out
  7762  __17:
  7763  	;
  7764  __16:
  7765  	;
  7766  	goto __9
  7767  __13:
  7768  	;
  7769  	goto __8
  7770  __8:
  7771  	i++
  7772  	goto __7
  7773  	goto __9
  7774  __9:
  7775  	;
  7776  
  7777  	if !(int32(*(*int8)(unsafe.Pointer(zDetail))) != '-') {
  7778  		goto __18
  7779  	}
  7780  	(*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP = idxAppendText(tls, bp+8224 /* &rc */, (*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP, ts+294 /* "%s\n" */, libc.VaList(bp+8, zDetail))
  7781  __18:
  7782  	;
  7783  	goto __4
  7784  __5:
  7785  	;
  7786  
  7787  	pEntry = (*IdxHash)(unsafe.Pointer(bp + 24 /* &hIdx */)).FpFirst
  7788  __19:
  7789  	if !(pEntry != 0) {
  7790  		goto __21
  7791  	}
  7792  	(*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx = idxAppendText(tls, bp+8224 /* &rc */, (*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx, ts+298 /* "%s;\n" */, libc.VaList(bp+16, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey))
  7793  	goto __20
  7794  __20:
  7795  	pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext
  7796  	goto __19
  7797  	goto __21
  7798  __21:
  7799  	;
  7800  
  7801  	idxFinalize(tls, bp+8224 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 8216 /* pExplain */)))
  7802  	goto __2
  7803  __2:
  7804  	pStmt = (*IdxStatement)(unsafe.Pointer(pStmt)).FpNext
  7805  	goto __1
  7806  	goto __3
  7807  __3:
  7808  	;
  7809  
  7810  find_indexes_out:
  7811  	idxHashClear(tls, bp+24 /* &hIdx */)
  7812  	return *(*int32)(unsafe.Pointer(bp + 8224 /* rc */))
  7813  }
  7814  
  7815  func idxAuthCallback(tls *libc.TLS, pCtx uintptr, eOp int32, z3 uintptr, z4 uintptr, zDb uintptr, zTrigger uintptr) int32 { /* sqlite3expert.c:1180:12: */
  7816  	bp := tls.Alloc(4)
  7817  	defer tls.Free(4)
  7818  
  7819  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  7820  	_ = z4
  7821  	_ = zTrigger
  7822  	if ((eOp == SQLITE_INSERT) || (eOp == SQLITE_UPDATE)) || (eOp == SQLITE_DELETE) {
  7823  		if sqlite3.Xsqlite3_stricmp(tls, zDb, ts+85 /* "main" */) == 0 {
  7824  			var p uintptr = pCtx
  7825  			var pTab uintptr
  7826  			for pTab = (*sqlite3expert)(unsafe.Pointer(p)).FpTable; pTab != 0; pTab = (*IdxTable)(unsafe.Pointer(pTab)).FpNext {
  7827  				if 0 == sqlite3.Xsqlite3_stricmp(tls, z3, (*IdxTable)(unsafe.Pointer(pTab)).FzName) {
  7828  					break
  7829  				}
  7830  			}
  7831  			if pTab != 0 {
  7832  				var pWrite uintptr
  7833  				for pWrite = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite; pWrite != 0; pWrite = (*IdxWrite)(unsafe.Pointer(pWrite)).FpNext {
  7834  					if ((*IdxWrite)(unsafe.Pointer(pWrite)).FpTab == pTab) && ((*IdxWrite)(unsafe.Pointer(pWrite)).FeOp == eOp) {
  7835  						break
  7836  					}
  7837  				}
  7838  				if pWrite == uintptr(0) {
  7839  					pWrite = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(IdxWrite{})))
  7840  					if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  7841  						(*IdxWrite)(unsafe.Pointer(pWrite)).FpTab = pTab
  7842  						(*IdxWrite)(unsafe.Pointer(pWrite)).FeOp = eOp
  7843  						(*IdxWrite)(unsafe.Pointer(pWrite)).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  7844  						(*sqlite3expert)(unsafe.Pointer(p)).FpWrite = pWrite
  7845  					}
  7846  				}
  7847  			}
  7848  		}
  7849  	}
  7850  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7851  }
  7852  
  7853  func idxProcessOneTrigger(tls *libc.TLS, p uintptr, pWrite uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1218:12: */
  7854  	bp := tls.Alloc(104)
  7855  	defer tls.Free(104)
  7856  
  7857  	var pTab uintptr = (*IdxWrite)(unsafe.Pointer(pWrite)).FpTab
  7858  	var zTab uintptr = (*IdxTable)(unsafe.Pointer(pTab)).FzName
  7859  	var zSql uintptr = ts + 303 /* "SELECT 'CREATE T..." */
  7860  	*(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)) = uintptr(0)
  7861  	*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_OK
  7862  	var zWrite uintptr = uintptr(0)
  7863  
  7864  	// Create the table and its triggers in the temp schema
  7865  	*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, bp+80 /* &pSelect */, pzErr, zSql, libc.VaList(bp, zTab, zTab))
  7866  	for (*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)))) {
  7867  		var zCreate uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)), 0)
  7868  		*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zCreate, uintptr(0), uintptr(0), pzErr)
  7869  	}
  7870  	idxFinalize(tls, bp+88 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)))
  7871  
  7872  	// Rename the table in the temp schema to zInt
  7873  	if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK {
  7874  		var z uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+429 /* "ALTER TABLE temp..." */, libc.VaList(bp+16, zTab, zInt))
  7875  		if z == uintptr(0) {
  7876  			*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_NOMEM
  7877  		} else {
  7878  			*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, z, uintptr(0), uintptr(0), pzErr)
  7879  			sqlite3.Xsqlite3_free(tls, z)
  7880  		}
  7881  	}
  7882  
  7883  	switch (*IdxWrite)(unsafe.Pointer(pWrite)).FeOp {
  7884  	case SQLITE_INSERT:
  7885  		{
  7886  			var i int32
  7887  			zWrite = idxAppendText(tls, bp+88 /* &rc */, zWrite, ts+462 /* "INSERT INTO %Q V..." */, libc.VaList(bp+32, zInt))
  7888  			for i = 0; i < (*IdxTable)(unsafe.Pointer(pTab)).FnCol; i++ {
  7889  				zWrite = idxAppendText(tls, bp+88 /* &rc */, zWrite, ts+485 /* "%s?" */, libc.VaList(bp+40, func() uintptr {
  7890  					if i == 0 {
  7891  						return ts + 489 /* "" */
  7892  					}
  7893  					return ts + 90 /* ", " */
  7894  				}()))
  7895  			}
  7896  			zWrite = idxAppendText(tls, bp+88 /* &rc */, zWrite, ts+490 /* ")" */, 0)
  7897  			break
  7898  
  7899  		}
  7900  	case SQLITE_UPDATE:
  7901  		{
  7902  			var i int32
  7903  			zWrite = idxAppendText(tls, bp+88 /* &rc */, zWrite, ts+492 /* "UPDATE %Q SET " */, libc.VaList(bp+48, zInt))
  7904  			for i = 0; i < (*IdxTable)(unsafe.Pointer(pTab)).FnCol; i++ {
  7905  				zWrite = idxAppendText(tls, bp+88 /* &rc */, zWrite, ts+507 /* "%s%Q=?" */, libc.VaList(bp+56, func() uintptr {
  7906  					if i == 0 {
  7907  						return ts + 489 /* "" */
  7908  					}
  7909  					return ts + 90 /* ", " */
  7910  				}(),
  7911  					(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*24)).FzName))
  7912  			}
  7913  			break
  7914  
  7915  		}
  7916  	default:
  7917  		{
  7918  
  7919  			if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK {
  7920  				zWrite = sqlite3.Xsqlite3_mprintf(tls, ts+514 /* "DELETE FROM %Q" */, libc.VaList(bp+72, zInt))
  7921  				if zWrite == uintptr(0) {
  7922  					*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_NOMEM
  7923  				}
  7924  			}
  7925  
  7926  		}
  7927  	}
  7928  
  7929  	if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK {
  7930  		*(*uintptr)(unsafe.Pointer(bp + 96 /* pX */)) = uintptr(0)
  7931  		*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_prepare_v2(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zWrite, -1, bp+96 /* &pX */, uintptr(0))
  7932  		idxFinalize(tls, bp+88 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 96 /* pX */)))
  7933  		if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) != SQLITE_OK {
  7934  			idxDatabaseError(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, pzErr)
  7935  		}
  7936  	}
  7937  	sqlite3.Xsqlite3_free(tls, zWrite)
  7938  
  7939  	if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) == SQLITE_OK {
  7940  		*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zDrop, uintptr(0), uintptr(0), pzErr)
  7941  	}
  7942  
  7943  	return *(*int32)(unsafe.Pointer(bp + 88 /* rc */))
  7944  }
  7945  
  7946  var zInt uintptr = ts + 529  /* "t592690916721053..." */ /* sqlite3expert.c:1223:21 */
  7947  var zDrop uintptr = ts + 567 /* "DROP TABLE t5926..." */ /* sqlite3expert.c:1224:21 */
  7948  
  7949  func idxProcessTriggers(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1300:12: */
  7950  	var rc int32 = SQLITE_OK
  7951  	var pEnd uintptr = uintptr(0)
  7952  	var pFirst uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  7953  
  7954  	for (rc == SQLITE_OK) && (pFirst != pEnd) {
  7955  		var pIter uintptr
  7956  		for pIter = pFirst; (rc == SQLITE_OK) && (pIter != pEnd); pIter = (*IdxWrite)(unsafe.Pointer(pIter)).FpNext {
  7957  			rc = idxProcessOneTrigger(tls, p, pIter, pzErr)
  7958  		}
  7959  		pEnd = pFirst
  7960  		pFirst = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  7961  	}
  7962  
  7963  	return rc
  7964  }
  7965  
  7966  func idxCreateVtabSchema(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sqlite3expert.c:1318:12: */
  7967  	bp := tls.Alloc(60)
  7968  	defer tls.Free(60)
  7969  
  7970  	*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = idxRegisterVtab(tls, p)
  7971  	*(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)) = uintptr(0)
  7972  
  7973  	// For each table in the main db schema:
  7974  	//
  7975  	//   1) Add an entry to the p->pTable list, and
  7976  	//   2) Create the equivalent virtual table in dbv.
  7977  	*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, bp+40 /* &pSchema */, pzErrmsg,
  7978  
  7979  		ts+616 /* "SELECT type, nam..." */)
  7980  	for (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)))) {
  7981  		var zType uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 0)
  7982  		var zName uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 1)
  7983  		var zSql uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 2)
  7984  
  7985  		if (int32(*(*int8)(unsafe.Pointer(zType))) == 'v') || (int32(*(*int8)(unsafe.Pointer(zType + 1))) == 'r') {
  7986  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zSql, uintptr(0), uintptr(0), pzErrmsg)
  7987  		} else {
  7988  			// var pTab uintptr at bp+48, 8
  7989  
  7990  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = idxGetTableInfo(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, zName, bp+48 /* &pTab */, pzErrmsg)
  7991  			if *(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK {
  7992  				var i int32
  7993  				var zInner uintptr = uintptr(0)
  7994  				var zOuter uintptr = uintptr(0)
  7995  				(*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pTab */)))).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpTable
  7996  				(*sqlite3expert)(unsafe.Pointer(p)).FpTable = *(*uintptr)(unsafe.Pointer(bp + 48 /* pTab */))
  7997  
  7998  				// The statement the vtab will pass to sqlite3_declare_vtab()
  7999  				zInner = idxAppendText(tls, bp+56 /* &rc */, uintptr(0), ts+884 /* "CREATE TABLE x(" */, 0)
  8000  				for i = 0; i < (*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pTab */)))).FnCol; i++ {
  8001  					zInner = idxAppendText(tls, bp+56 /* &rc */, zInner, ts+900, /* "%s%Q COLLATE %s" */
  8002  						libc.VaList(bp, func() uintptr {
  8003  							if i == 0 {
  8004  								return ts + 489 /* "" */
  8005  							}
  8006  							return ts + 90 /* ", " */
  8007  						}(), (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pTab */)))).FaCol+uintptr(i)*24)).FzName, (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* pTab */)))).FaCol+uintptr(i)*24)).FzColl))
  8008  				}
  8009  				zInner = idxAppendText(tls, bp+56 /* &rc */, zInner, ts+490 /* ")" */, 0)
  8010  
  8011  				// The CVT statement to create the vtab
  8012  				zOuter = idxAppendText(tls, bp+56 /* &rc */, uintptr(0),
  8013  					ts+916 /* "CREATE VIRTUAL T..." */, libc.VaList(bp+24, zName, zInner))
  8014  				if *(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK {
  8015  					*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zOuter, uintptr(0), uintptr(0), pzErrmsg)
  8016  				}
  8017  				sqlite3.Xsqlite3_free(tls, zInner)
  8018  				sqlite3.Xsqlite3_free(tls, zOuter)
  8019  			}
  8020  		}
  8021  	}
  8022  	idxFinalize(tls, bp+56 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)))
  8023  	return *(*int32)(unsafe.Pointer(bp + 56 /* rc */))
  8024  }
  8025  
  8026  type IdxSampleCtx = struct {
  8027  	FiTarget int32
  8028  	_        [4]byte
  8029  	Ftarget  float64
  8030  	FnRow    float64
  8031  	FnRet    float64
  8032  } /* sqlite3expert.c:1378:1 */
  8033  
  8034  func idxSampleFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* sqlite3expert.c:1385:13: */
  8035  	bp := tls.Alloc(2)
  8036  	defer tls.Free(2)
  8037  
  8038  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
  8039  	var bRet int32
  8040  
  8041  	_ = argv
  8042  
  8043  	if (*IdxSampleCtx)(unsafe.Pointer(p)).FnRow == 0.0 {
  8044  		bRet = 1
  8045  	} else {
  8046  		bRet = (libc.Bool32(((*IdxSampleCtx)(unsafe.Pointer(p)).FnRet / (*IdxSampleCtx)(unsafe.Pointer(p)).FnRow) <= (*IdxSampleCtx)(unsafe.Pointer(p)).Ftarget))
  8047  		if bRet == 0 {
  8048  			// var rnd uint16 at bp, 2
  8049  
  8050  			sqlite3.Xsqlite3_randomness(tls, 2, bp /* &rnd */)
  8051  			bRet = (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(bp /* rnd */))) % 100) <= (*IdxSampleCtx)(unsafe.Pointer(p)).FiTarget))
  8052  		}
  8053  	}
  8054  
  8055  	sqlite3.Xsqlite3_result_int(tls, pCtx, bRet)
  8056  	*(*float64)(unsafe.Pointer(p + 16 /* &.nRow */)) += (1.0)
  8057  	*(*float64)(unsafe.Pointer(p + 24 /* &.nRet */)) += (float64(bRet))
  8058  }
  8059  
  8060  type IdxRemCtx = struct {
  8061  	FnSlot int32
  8062  	_      [4]byte
  8063  	FaSlot [1]struct {
  8064  		FeType int32
  8065  		_      [4]byte
  8066  		FiVal  i64
  8067  		FrVal  float64
  8068  		FnByte int32
  8069  		Fn     int32
  8070  		Fz     uintptr
  8071  	}
  8072  } /* sqlite3expert.c:1411:1 */
  8073  
  8074  type IdxRemSlot = struct {
  8075  	FeType int32
  8076  	_      [4]byte
  8077  	FiVal  i64
  8078  	FrVal  float64
  8079  	FnByte int32
  8080  	Fn     int32
  8081  	Fz     uintptr
  8082  } /* sqlite3expert.c:1411:1 */
  8083  
  8084  // Implementation of scalar function rem().
  8085  func idxRemFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* sqlite3expert.c:1426:13: */
  8086  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
  8087  	var pSlot uintptr
  8088  	var iSlot int32
  8089  
  8090  	iSlot = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
  8091  
  8092  	pSlot = ((p + 8 /* &.aSlot */) + uintptr(iSlot)*40)
  8093  
  8094  	switch (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType {
  8095  	case SQLITE_NULL:
  8096  		// no-op
  8097  		break
  8098  
  8099  	case SQLITE_INTEGER:
  8100  		sqlite3.Xsqlite3_result_int64(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).FiVal)
  8101  		break
  8102  
  8103  	case SQLITE_FLOAT:
  8104  		sqlite3.Xsqlite3_result_double(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).FrVal)
  8105  		break
  8106  
  8107  	case SQLITE_BLOB:
  8108  		sqlite3.Xsqlite3_result_blob(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn, libc.UintptrFromInt32(-1))
  8109  		break
  8110  
  8111  	case SQLITE_TEXT:
  8112  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn, libc.UintptrFromInt32(-1))
  8113  		break
  8114  	}
  8115  
  8116  	(*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType = sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
  8117  	switch (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType {
  8118  	case SQLITE_NULL:
  8119  		// no-op
  8120  		break
  8121  
  8122  	case SQLITE_INTEGER:
  8123  		(*IdxRemSlot)(unsafe.Pointer(pSlot)).FiVal = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
  8124  		break
  8125  
  8126  	case SQLITE_FLOAT:
  8127  		(*IdxRemSlot)(unsafe.Pointer(pSlot)).FrVal = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
  8128  		break
  8129  
  8130  	case SQLITE_BLOB:
  8131  		fallthrough
  8132  	case SQLITE_TEXT:
  8133  		{
  8134  			var nByte int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
  8135  			if nByte > (*IdxRemSlot)(unsafe.Pointer(pSlot)).FnByte {
  8136  				var zNew uintptr = sqlite3.Xsqlite3_realloc(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (nByte * 2))
  8137  				if zNew == uintptr(0) {
  8138  					sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
  8139  					return
  8140  				}
  8141  				(*IdxRemSlot)(unsafe.Pointer(pSlot)).FnByte = (nByte * 2)
  8142  				(*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz = zNew
  8143  			}
  8144  			(*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn = nByte
  8145  			if (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType == SQLITE_BLOB {
  8146  				libc.Xmemcpy(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))), uint64(nByte))
  8147  			} else {
  8148  				libc.Xmemcpy(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))), uint64(nByte))
  8149  			}
  8150  			break
  8151  
  8152  		}
  8153  	}
  8154  }
  8155  
  8156  func idxLargestIndex(tls *libc.TLS, db uintptr, pnMax uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1499:12: */
  8157  	bp := tls.Alloc(12)
  8158  	defer tls.Free(12)
  8159  
  8160  	*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
  8161  	var zMax uintptr = ts + 957 /* "SELECT max(i.seq..." */
  8162  	*(*uintptr)(unsafe.Pointer(bp /* pMax */)) = uintptr(0)
  8163  
  8164  	*(*int32)(unsafe.Pointer(pnMax)) = 0
  8165  	*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = idxPrepareStmt(tls, db, bp /* &pMax */, pzErr, zMax)
  8166  	if (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pMax */)))) {
  8167  		*(*int32)(unsafe.Pointer(pnMax)) = (sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pMax */)), 0) + 1)
  8168  	}
  8169  	idxFinalize(tls, bp+8 /* &rc */, *(*uintptr)(unsafe.Pointer(bp /* pMax */)))
  8170  
  8171  	return *(*int32)(unsafe.Pointer(bp + 8 /* rc */))
  8172  }
  8173  
  8174  func idxPopulateOneStat1(tls *libc.TLS, p uintptr, pIndexXInfo uintptr, pWriteStat uintptr, zTab uintptr, zIdx uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1519:12: */
  8175  	bp := tls.Alloc(128)
  8176  	defer tls.Free(128)
  8177  
  8178  	var zCols uintptr = uintptr(0)
  8179  	var zOrder uintptr = uintptr(0)
  8180  	var zQuery uintptr = uintptr(0)
  8181  	var nCol int32 = 0
  8182  	var i int32
  8183  	*(*uintptr)(unsafe.Pointer(bp + 120 /* pQuery */)) = uintptr(0)
  8184  	var aStat uintptr = uintptr(0)
  8185  	*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = SQLITE_OK
  8186  
  8187  	// Formulate the query text
  8188  	sqlite3.Xsqlite3_bind_text(tls, pIndexXInfo, 1, zIdx, -1, uintptr(0))
  8189  	for (SQLITE_OK == *(*int32)(unsafe.Pointer(bp + 112 /* rc */))) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pIndexXInfo)) {
  8190  		var zComma uintptr
  8191  		if zCols == uintptr(0) {
  8192  			zComma = ts + 489 /* "" */
  8193  		} else {
  8194  			zComma = ts + 90 /* ", " */
  8195  		}
  8196  		var zName uintptr = sqlite3.Xsqlite3_column_text(tls, pIndexXInfo, 0)
  8197  		var zColl uintptr = sqlite3.Xsqlite3_column_text(tls, pIndexXInfo, 1)
  8198  		zCols = idxAppendText(tls, bp+112 /* &rc */, zCols,
  8199  			ts+1094 /* "%sx.%Q IS rem(%d..." */, libc.VaList(bp, zComma, zName, nCol, zName, zColl))
  8200  		zOrder = idxAppendText(tls, bp+112 /* &rc */, zOrder, ts+1129 /* "%s%d" */, libc.VaList(bp+40, zComma, libc.PreIncInt32(&nCol, 1)))
  8201  	}
  8202  	sqlite3.Xsqlite3_reset(tls, pIndexXInfo)
  8203  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8204  		if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8205  			zQuery = sqlite3.Xsqlite3_mprintf(tls,
  8206  				ts+1134 /* "SELECT %s FROM %..." */, libc.VaList(bp+56, zCols, zTab, zOrder))
  8207  		} else {
  8208  			zQuery = sqlite3.Xsqlite3_mprintf(tls,
  8209  				ts+1166 /* "SELECT %s FROM t..." */, libc.VaList(bp+80, zCols, zOrder))
  8210  		}
  8211  	}
  8212  	sqlite3.Xsqlite3_free(tls, zCols)
  8213  	sqlite3.Xsqlite3_free(tls, zOrder)
  8214  
  8215  	// Formulate the query text
  8216  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8217  		var dbrem uintptr = func() uintptr {
  8218  			if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8219  				return (*sqlite3expert)(unsafe.Pointer(p)).Fdb
  8220  			}
  8221  			return (*sqlite3expert)(unsafe.Pointer(p)).Fdbv
  8222  		}()
  8223  		*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = idxPrepareStmt(tls, dbrem, bp+120 /* &pQuery */, pzErr, zQuery)
  8224  	}
  8225  	sqlite3.Xsqlite3_free(tls, zQuery)
  8226  
  8227  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8228  		aStat = idxMalloc(tls, bp+112 /* &rc */, (int32(uint64(unsafe.Sizeof(int32(0))) * (uint64(nCol + 1)))))
  8229  	}
  8230  	if (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* pQuery */)))) {
  8231  		var pEntry uintptr
  8232  		var zStat uintptr = uintptr(0)
  8233  		for i = 0; i <= nCol; i++ {
  8234  			*(*int32)(unsafe.Pointer(aStat + uintptr(i)*4)) = 1
  8235  		}
  8236  		for (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* pQuery */)))) {
  8237  			*(*int32)(unsafe.Pointer(aStat))++
  8238  			for i = 0; i < nCol; i++ {
  8239  				if sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* pQuery */)), i) == 0 {
  8240  					break
  8241  				}
  8242  			}
  8243  			for ; i < nCol; i++ {
  8244  				*(*int32)(unsafe.Pointer(aStat + uintptr((i+1))*4))++
  8245  			}
  8246  		}
  8247  
  8248  		if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8249  			var s0 int32 = *(*int32)(unsafe.Pointer(aStat))
  8250  			zStat = sqlite3.Xsqlite3_mprintf(tls, ts+1238 /* "%d" */, libc.VaList(bp+96, s0))
  8251  			if zStat == uintptr(0) {
  8252  				*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = SQLITE_NOMEM
  8253  			}
  8254  			for i = 1; (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (i <= nCol); i++ {
  8255  				zStat = idxAppendText(tls, bp+112 /* &rc */, zStat, ts+1241 /* " %d" */, libc.VaList(bp+104, ((s0+(*(*int32)(unsafe.Pointer(aStat + uintptr(i)*4))/2)) / *(*int32)(unsafe.Pointer(aStat + uintptr(i)*4)))))
  8256  			}
  8257  		}
  8258  
  8259  		if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8260  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 1, zTab, -1, uintptr(0))
  8261  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 2, zIdx, -1, uintptr(0))
  8262  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 3, zStat, -1, uintptr(0))
  8263  			sqlite3.Xsqlite3_step(tls, pWriteStat)
  8264  			*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = sqlite3.Xsqlite3_reset(tls, pWriteStat)
  8265  		}
  8266  
  8267  		pEntry = idxHashFind(tls, (p + 88 /* &.hIdx */), zIdx, int32(libc.Xstrlen(tls, zIdx)))
  8268  		if pEntry != 0 {
  8269  
  8270  			(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2 = zStat
  8271  		} else {
  8272  			sqlite3.Xsqlite3_free(tls, zStat)
  8273  		}
  8274  	}
  8275  	sqlite3.Xsqlite3_free(tls, aStat)
  8276  	idxFinalize(tls, bp+112 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 120 /* pQuery */)))
  8277  
  8278  	return *(*int32)(unsafe.Pointer(bp + 112 /* rc */))
  8279  }
  8280  
  8281  func idxBuildSampleTable(tls *libc.TLS, p uintptr, zTab uintptr) int32 { /* sqlite3expert.c:1619:12: */
  8282  	bp := tls.Alloc(8)
  8283  	defer tls.Free(8)
  8284  
  8285  	var rc int32
  8286  	var zSql uintptr
  8287  
  8288  	rc = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  8289  	if rc != SQLITE_OK {
  8290  		return rc
  8291  	}
  8292  
  8293  	zSql = sqlite3.Xsqlite3_mprintf(tls,
  8294  		ts+1309 /* "CREATE TABLE tem..." */, libc.VaList(bp, zTab))
  8295  	if zSql == uintptr(0) {
  8296  		return SQLITE_NOMEM
  8297  	}
  8298  	rc = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zSql, uintptr(0), uintptr(0), uintptr(0))
  8299  	sqlite3.Xsqlite3_free(tls, zSql)
  8300  
  8301  	return rc
  8302  }
  8303  
  8304  // This function is called as part of sqlite3_expert_analyze(). Candidate
  8305  // indexes have already been created in database sqlite3expert.dbm, this
  8306  // function populates sqlite_stat1 table in the same database.
  8307  //
  8308  // The stat1 data is generated by querying the
  8309  func idxPopulateStat1(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1643:12: */
  8310  	bp := tls.Alloc(64)
  8311  	defer tls.Free(64)
  8312  
  8313  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK
  8314  	*(*int32)(unsafe.Pointer(bp /* nMax */)) = 0
  8315  	var pCtx uintptr = uintptr(0)
  8316  	// var samplectx IdxSampleCtx at bp+8, 32
  8317  
  8318  	var i int32
  8319  	var iPrev i64 = int64(-100000)
  8320  	*(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)) = uintptr(0)
  8321  	*(*uintptr)(unsafe.Pointer(bp + 48 /* pIndexXInfo */)) = uintptr(0)
  8322  	*(*uintptr)(unsafe.Pointer(bp + 56 /* pWrite */)) = uintptr(0)
  8323  
  8324  	var zAllIndex uintptr = ts + 1385   /* "SELECT s.rowid, ..." */
  8325  	var zIndexXInfo uintptr = ts + 1499 /* "SELECT name, col..." */
  8326  	var zWrite uintptr = ts + 1554      /* "INSERT INTO sqli..." */
  8327  
  8328  	// If iSample==0, no sqlite_stat1 data is required.
  8329  	if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 0 {
  8330  		return SQLITE_OK
  8331  	}
  8332  
  8333  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxLargestIndex(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp /* &nMax */, pzErr)
  8334  	if (*(*int32)(unsafe.Pointer(bp /* nMax */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK) {
  8335  		return *(*int32)(unsafe.Pointer(bp + 4 /* rc */))
  8336  	}
  8337  
  8338  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, ts+1595 /* "ANALYZE; PRAGMA ..." */, uintptr(0), uintptr(0), uintptr(0))
  8339  
  8340  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8341  		var nByte int32 = (int32(uint64(unsafe.Sizeof(IdxRemCtx{})) + (uint64(unsafe.Sizeof(IdxRemSlot{})) * uint64(*(*int32)(unsafe.Pointer(bp /* nMax */))))))
  8342  		pCtx = idxMalloc(tls, bp+4 /* &rc */, nByte)
  8343  	}
  8344  
  8345  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8346  		var dbrem uintptr = func() uintptr {
  8347  			if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8348  				return (*sqlite3expert)(unsafe.Pointer(p)).Fdb
  8349  			}
  8350  			return (*sqlite3expert)(unsafe.Pointer(p)).Fdbv
  8351  		}()
  8352  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_create_function(tls,
  8353  			dbrem, ts+1629 /* "rem" */, 2, SQLITE_UTF8, pCtx, *(*uintptr)(unsafe.Pointer(&struct {
  8354  				f func(*libc.TLS, uintptr, int32, uintptr)
  8355  			}{idxRemFunc})), uintptr(0), uintptr(0))
  8356  	}
  8357  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8358  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_create_function(tls,
  8359  			(*sqlite3expert)(unsafe.Pointer(p)).Fdb, ts+1633 /* "sample" */, 0, SQLITE_UTF8, bp+8 /* &samplectx */, *(*uintptr)(unsafe.Pointer(&struct {
  8360  				f func(*libc.TLS, uintptr, int32, uintptr)
  8361  			}{idxSampleFunc})), uintptr(0), uintptr(0))
  8362  	}
  8363  
  8364  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8365  		(*IdxRemCtx)(unsafe.Pointer(pCtx)).FnSlot = (*(*int32)(unsafe.Pointer(bp /* nMax */)) + 1)
  8366  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+40 /* &pAllIndex */, pzErr, zAllIndex)
  8367  	}
  8368  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8369  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+48 /* &pIndexXInfo */, pzErr, zIndexXInfo)
  8370  	}
  8371  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8372  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+56 /* &pWrite */, pzErr, zWrite)
  8373  	}
  8374  
  8375  	for (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)))) {
  8376  		var iRowid i64 = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 0)
  8377  		var zTab uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 1)
  8378  		var zIdx uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 2)
  8379  		if ((*sqlite3expert)(unsafe.Pointer(p)).FiSample < 100) && (iPrev != iRowid) {
  8380  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).Ftarget = (float64((*sqlite3expert)(unsafe.Pointer(p)).FiSample) / 100.0)
  8381  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FiTarget = (*sqlite3expert)(unsafe.Pointer(p)).FiSample
  8382  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FnRow = 0.0
  8383  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FnRet = 0.0
  8384  			*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxBuildSampleTable(tls, p, zTab)
  8385  			if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK {
  8386  				break
  8387  			}
  8388  		}
  8389  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPopulateOneStat1(tls, p, *(*uintptr)(unsafe.Pointer(bp + 48 /* pIndexXInfo */)), *(*uintptr)(unsafe.Pointer(bp + 56 /* pWrite */)), zTab, zIdx, pzErr)
  8390  		iPrev = iRowid
  8391  	}
  8392  	if (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && ((*sqlite3expert)(unsafe.Pointer(p)).FiSample < 100) {
  8393  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv,
  8394  			ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  8395  	}
  8396  
  8397  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)))
  8398  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pIndexXInfo */)))
  8399  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 56 /* pWrite */)))
  8400  
  8401  	if pCtx != 0 {
  8402  		for i = 0; i < (*IdxRemCtx)(unsafe.Pointer(pCtx)).FnSlot; i++ {
  8403  			sqlite3.Xsqlite3_free(tls, (*IdxRemSlot)(unsafe.Pointer((pCtx+8 /* &.aSlot */)+uintptr(i)*40)).Fz)
  8404  		}
  8405  		sqlite3.Xsqlite3_free(tls, pCtx)
  8406  	}
  8407  
  8408  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8409  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, ts+1640 /* "ANALYZE sqlite_s..." */, uintptr(0), uintptr(0), uintptr(0))
  8410  	}
  8411  
  8412  	sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  8413  	return *(*int32)(unsafe.Pointer(bp + 4 /* rc */))
  8414  }
  8415  
  8416  // Allocate a new sqlite3expert object.
  8417  func sqlite3_expert_new(tls *libc.TLS, db uintptr, pzErrmsg uintptr) uintptr { /* sqlite3expert.c:1742:15: */
  8418  	bp := tls.Alloc(32)
  8419  	defer tls.Free(32)
  8420  
  8421  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK
  8422  	var pNew uintptr
  8423  
  8424  	pNew = idxMalloc(tls, bp+16 /* &rc */, int32(unsafe.Sizeof(sqlite3expert{})))
  8425  
  8426  	// Open two in-memory databases to work with. The "vtab database" (dbv)
  8427  	// will contain a virtual table corresponding to each real table in
  8428  	// the user database schema, and a copy of each view. It is used to
  8429  	// collect information regarding the WHERE, ORDER BY and other clauses
  8430  	// of the user's query.
  8431  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8432  		(*sqlite3expert)(unsafe.Pointer(pNew)).Fdb = db
  8433  		(*sqlite3expert)(unsafe.Pointer(pNew)).FiSample = 100
  8434  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, (pNew + 24 /* &.dbv */))
  8435  	}
  8436  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8437  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, (pNew + 16 /* &.dbm */))
  8438  		if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8439  			sqlite3.Xsqlite3_db_config(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbm, SQLITE_DBCONFIG_TRIGGER_EQP, libc.VaList(bp, 1, uintptr(0)))
  8440  		}
  8441  	}
  8442  
  8443  	// Copy the entire schema of database [db] into [dbm].
  8444  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8445  		// var pSql uintptr at bp+24, 8
  8446  
  8447  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdb, bp+24 /* &pSql */, pzErrmsg,
  8448  
  8449  			ts+1671 /* "SELECT sql FROM ..." */, 0)
  8450  		for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSql */)))) {
  8451  			var zSql uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSql */)), 0)
  8452  			*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbm, zSql, uintptr(0), uintptr(0), pzErrmsg)
  8453  		}
  8454  		idxFinalize(tls, bp+16 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSql */)))
  8455  	}
  8456  
  8457  	// Create the vtab schema
  8458  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8459  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = idxCreateVtabSchema(tls, pNew, pzErrmsg)
  8460  	}
  8461  
  8462  	// Register the auth callback with dbv
  8463  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8464  		sqlite3.Xsqlite3_set_authorizer(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbv, *(*uintptr)(unsafe.Pointer(&struct {
  8465  			f func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32
  8466  		}{idxAuthCallback})), pNew)
  8467  	}
  8468  
  8469  	// If an error has occurred, free the new object and reutrn NULL. Otherwise,
  8470  	// return the new sqlite3expert handle.
  8471  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK {
  8472  		sqlite3_expert_destroy(tls, pNew)
  8473  		pNew = uintptr(0)
  8474  	}
  8475  	return pNew
  8476  }
  8477  
  8478  // Configure an sqlite3expert object.
  8479  func sqlite3_expert_config(tls *libc.TLS, p uintptr, op int32, va uintptr) int32 { /* sqlite3expert.c:1803:5: */
  8480  	var rc int32 = SQLITE_OK
  8481  	var ap va_list
  8482  	_ = ap
  8483  	ap = va
  8484  	switch op {
  8485  	case EXPERT_CONFIG_SAMPLE:
  8486  		{
  8487  			var iVal int32 = int32(libc.VaInt32(&ap))
  8488  			if iVal < 0 {
  8489  				iVal = 0
  8490  			}
  8491  			if iVal > 100 {
  8492  				iVal = 100
  8493  			}
  8494  			(*sqlite3expert)(unsafe.Pointer(p)).FiSample = iVal
  8495  			break
  8496  
  8497  		}
  8498  	default:
  8499  		rc = SQLITE_NOTFOUND
  8500  		break
  8501  	}
  8502  
  8503  	_ = ap
  8504  	return rc
  8505  }
  8506  
  8507  // Add an SQL statement to the analysis.
  8508  func sqlite3_expert_sql(tls *libc.TLS, p uintptr, zSql uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1827:5: */
  8509  	bp := tls.Alloc(20)
  8510  	defer tls.Free(20)
  8511  
  8512  	var pScanOrig uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpScan
  8513  	var pStmtOrig uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  8514  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK
  8515  	*(*uintptr)(unsafe.Pointer(bp + 8 /* zStmt */)) = zSql
  8516  
  8517  	if (*sqlite3expert)(unsafe.Pointer(p)).FbRun != 0 {
  8518  		return SQLITE_MISUSE
  8519  	}
  8520  
  8521  	for ((*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 8 /* zStmt */)) != 0)) && (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* zStmt */)))) != 0) {
  8522  		*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
  8523  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_prepare_v2(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, *(*uintptr)(unsafe.Pointer(bp + 8 /* zStmt */)), -1, bp /* &pStmt */, bp+8 /* &zStmt */)
  8524  		if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8525  			if *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) != 0 {
  8526  				var pNew uintptr
  8527  				var z uintptr = sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
  8528  				var n int32 = int32(libc.Xstrlen(tls, z))
  8529  				pNew = idxMalloc(tls, bp+16 /* &rc */, (int32((uint64(unsafe.Sizeof(IdxStatement{})) + uint64(n)) + uint64(1))))
  8530  				if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  8531  					(*IdxStatement)(unsafe.Pointer(pNew)).FzSql = (pNew + 1*40)
  8532  					libc.Xmemcpy(tls, (*IdxStatement)(unsafe.Pointer(pNew)).FzSql, z, (uint64(n + 1)))
  8533  					(*IdxStatement)(unsafe.Pointer(pNew)).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  8534  					if (*sqlite3expert)(unsafe.Pointer(p)).FpStatement != 0 {
  8535  						(*IdxStatement)(unsafe.Pointer(pNew)).FiId = ((*IdxStatement)(unsafe.Pointer((*sqlite3expert)(unsafe.Pointer(p)).FpStatement)).FiId + 1)
  8536  					}
  8537  					(*sqlite3expert)(unsafe.Pointer(p)).FpStatement = pNew
  8538  				}
  8539  				sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
  8540  			}
  8541  		} else {
  8542  			idxDatabaseError(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, pzErr)
  8543  		}
  8544  	}
  8545  
  8546  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK {
  8547  		idxScanFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpScan, pScanOrig)
  8548  		idxStatementFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpStatement, pStmtOrig)
  8549  		(*sqlite3expert)(unsafe.Pointer(p)).FpScan = pScanOrig
  8550  		(*sqlite3expert)(unsafe.Pointer(p)).FpStatement = pStmtOrig
  8551  	}
  8552  
  8553  	return *(*int32)(unsafe.Pointer(bp + 16 /* rc */))
  8554  }
  8555  
  8556  func sqlite3_expert_analyze(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1872:5: */
  8557  	bp := tls.Alloc(28)
  8558  	defer tls.Free(28)
  8559  
  8560  	// var rc int32 at bp+24, 4
  8561  
  8562  	var pEntry uintptr
  8563  
  8564  	// Do trigger processing to collect any extra IdxScan structures
  8565  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxProcessTriggers(tls, p, pzErr)
  8566  
  8567  	// Create candidate indexes within the in-memory database file
  8568  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  8569  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxCreateCandidates(tls, p)
  8570  	}
  8571  
  8572  	// Generate the stat1 data
  8573  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  8574  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxPopulateStat1(tls, p, pzErr)
  8575  	}
  8576  
  8577  	// Formulate the EXPERT_REPORT_CANDIDATES text
  8578  	for pEntry = (*sqlite3expert)(unsafe.Pointer(p)).FhIdx.FpFirst; pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext {
  8579  		(*sqlite3expert)(unsafe.Pointer(p)).FzCandidates = idxAppendText(tls, bp+24 /* &rc */, (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates,
  8580  			ts+1770 /* "%s;%s%s\n" */, libc.VaList(bp, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal,
  8581  				func() uintptr {
  8582  					if (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2 != 0 {
  8583  						return ts + 1779 /* " -- stat1: " */
  8584  					}
  8585  					return ts + 489 /* "" */
  8586  				}(), (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2))
  8587  	}
  8588  
  8589  	// Figure out which of the candidate indexes are preferred by the query
  8590  	// planner and report the results to the user.
  8591  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  8592  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxFindIndexes(tls, p, pzErr)
  8593  	}
  8594  
  8595  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  8596  		(*sqlite3expert)(unsafe.Pointer(p)).FbRun = 1
  8597  	}
  8598  	return *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
  8599  }
  8600  
  8601  // Return the total number of statements that have been added to this
  8602  // sqlite3expert using sqlite3_expert_sql().
  8603  func sqlite3_expert_count(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:1913:5: */
  8604  	var nRet int32 = 0
  8605  	if (*sqlite3expert)(unsafe.Pointer(p)).FpStatement != 0 {
  8606  		nRet = ((*IdxStatement)(unsafe.Pointer((*sqlite3expert)(unsafe.Pointer(p)).FpStatement)).FiId + 1)
  8607  	}
  8608  	return nRet
  8609  }
  8610  
  8611  // Return a component of the report.
  8612  func sqlite3_expert_report(tls *libc.TLS, p uintptr, iStmt int32, eReport int32) uintptr { /* sqlite3expert.c:1922:12: */
  8613  	var zRet uintptr = uintptr(0)
  8614  	var pStmt uintptr
  8615  
  8616  	if (*sqlite3expert)(unsafe.Pointer(p)).FbRun == 0 {
  8617  		return uintptr(0)
  8618  	}
  8619  	for pStmt = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement; (pStmt != 0) && ((*IdxStatement)(unsafe.Pointer(pStmt)).FiId != iStmt); pStmt = (*IdxStatement)(unsafe.Pointer(pStmt)).FpNext {
  8620  	}
  8621  	switch eReport {
  8622  	case EXPERT_REPORT_SQL:
  8623  		if pStmt != 0 {
  8624  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzSql
  8625  		}
  8626  		break
  8627  	case EXPERT_REPORT_INDEXES:
  8628  		if pStmt != 0 {
  8629  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx
  8630  		}
  8631  		break
  8632  	case EXPERT_REPORT_PLAN:
  8633  		if pStmt != 0 {
  8634  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP
  8635  		}
  8636  		break
  8637  	case EXPERT_REPORT_CANDIDATES:
  8638  		zRet = (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates
  8639  		break
  8640  	}
  8641  	return zRet
  8642  }
  8643  
  8644  // Free an sqlite3expert object.
  8645  func sqlite3_expert_destroy(tls *libc.TLS, p uintptr) { /* sqlite3expert.c:1948:6: */
  8646  	if p != 0 {
  8647  		sqlite3.Xsqlite3_close(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm)
  8648  		sqlite3.Xsqlite3_close(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv)
  8649  		idxScanFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpScan, uintptr(0))
  8650  		idxStatementFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpStatement, uintptr(0))
  8651  		idxTableFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpTable)
  8652  		idxWriteFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpWrite)
  8653  		idxHashClear(tls, (p + 88 /* &.hIdx */))
  8654  		sqlite3.Xsqlite3_free(tls, (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates)
  8655  		sqlite3.Xsqlite3_free(tls, p)
  8656  	}
  8657  }
  8658  
  8659  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
  8660  // B.8.2.7 for the rationale behind the *_unlocked() macros.
  8661  
  8662  //----------------------------------------------------------------------------
  8663  // Support for functions with a variable number of arguments.
  8664  //
  8665  // The following TCL_VARARGS* macros are to support old extensions
  8666  // written for older versions of Tcl where the macros permitted
  8667  // support for the varargs.h system as well as stdarg.h .
  8668  //
  8669  // New code should just directly be written to use stdarg.h conventions.
  8670  
  8671  // Copyright (C) 1989-2020 Free Software Foundation, Inc.
  8672  //
  8673  // This file is part of GCC.
  8674  //
  8675  // GCC is free software; you can redistribute it and/or modify
  8676  // it under the terms of the GNU General Public License as published by
  8677  // the Free Software Foundation; either version 3, or (at your option)
  8678  // any later version.
  8679  //
  8680  // GCC is distributed in the hope that it will be useful,
  8681  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  8682  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  8683  // GNU General Public License for more details.
  8684  //
  8685  // Under Section 7 of GPL version 3, you are granted additional
  8686  // permissions described in the GCC Runtime Library Exception, version
  8687  // 3.1, as published by the Free Software Foundation.
  8688  //
  8689  // You should have received a copy of the GNU General Public License and
  8690  // a copy of the GCC Runtime Library Exception along with this program;
  8691  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
  8692  // <http://www.gnu.org/licenses/>.
  8693  
  8694  // ISO C Standard:  7.15  Variable arguments  <stdarg.h>
  8695  
  8696  // Allow a part of Tcl's API to be explicitly marked as deprecated.
  8697  //
  8698  // Used to make TIP 330/336 generate moans even if people use the
  8699  // compatibility macros. Change your code, guys! We won't support you forever.
  8700  
  8701  //----------------------------------------------------------------------------
  8702  // Macros used to declare a function to be exported by a DLL. Used by Windows,
  8703  // maps to no-op declarations on non-Windows systems. The default build on
  8704  // windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be
  8705  // nonempty. To build a static library, the macro STATIC_BUILD should be
  8706  // defined.
  8707  //
  8708  // Note: when building static but linking dynamically to MSVCRT we must still
  8709  //       correctly decorate the C library imported function.  Use CRTIMPORT
  8710  //       for this purpose.  _DLL is defined by the compiler when linking to
  8711  //       MSVCRT.
  8712  
  8713  // These macros are used to control whether functions are being declared for
  8714  // import or export. If a function is being declared while it is being built
  8715  // to be included in a shared library, then it should have the DLLEXPORT
  8716  // storage class. If is being declared for use by a module that is going to
  8717  // link against the shared library, then it should have the DLLIMPORT storage
  8718  // class. If the symbol is beind declared for a static build or for use from a
  8719  // stub library, then the storage class should be empty.
  8720  //
  8721  // The convention is that a macro called BUILD_xxxx, where xxxx is the name of
  8722  // a library we are building, is set on the compile line for sources that are
  8723  // to be placed in the library. When this macro is set, the storage class will
  8724  // be set to DLLEXPORT. At the end of the header file, the storage class will
  8725  // be reset to DLLIMPORT.
  8726  
  8727  // The following _ANSI_ARGS_ macro is to support old extensions
  8728  // written for older versions of Tcl where it permitted support
  8729  // for compilers written in the pre-prototype era of C.
  8730  //
  8731  // New code should use prototypes.
  8732  
  8733  // Definitions that allow this header file to be used either with or without
  8734  // ANSI C features.
  8735  
  8736  // Make sure EXTERN isn't defined elsewhere.
  8737  
  8738  //----------------------------------------------------------------------------
  8739  // The following code is copied from winnt.h. If we don't replicate it here,
  8740  // then <windows.h> can't be included after tcl.h, since tcl.h also defines
  8741  // VOID. This block is skipped under Cygwin and Mingw.
  8742  
  8743  // Macro to use instead of "void" for arguments that must have type "void *"
  8744  // in ANSI C; maps them to type "char *" in non-ANSI systems.
  8745  
  8746  // Miscellaneous declarations.
  8747  
  8748  type ClientData = uintptr /* tcl.h:340:15 */
  8749  
  8750  // Darwin specific configure overrides (to support fat compiles, where
  8751  // configure runs only once for multiple architectures):
  8752  
  8753  // Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define
  8754  // Tcl_WideUInt to be the unsigned variant of that type (assuming that where
  8755  // we have one, we can have the other.)
  8756  //
  8757  // Also defines the following macros:
  8758  // TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a
  8759  //	LP64 system such as modern Solaris or Linux ... not including Win64)
  8760  // Tcl_WideAsLong - forgetful converter from wideInt to long.
  8761  // Tcl_LongAsWide - sign-extending converter from long to wideInt.
  8762  // Tcl_WideAsDouble - converter from wideInt to double.
  8763  // Tcl_DoubleAsWide - converter from double to wideInt.
  8764  //
  8765  // The following invariant should hold for any long value 'longVal':
  8766  //	longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal))
  8767  //
  8768  // Note on converting between Tcl_WideInt and strings. This implementation (in
  8769  // tclObj.c) depends on the function
  8770  // sprintf(...,"%" TCL_LL_MODIFIER "d",...).
  8771  
  8772  type Tcl_WideInt = int64   /* tcl.h:415:28 */
  8773  type Tcl_WideUInt = uint64 /* tcl.h:416:36 */
  8774  
  8775  // The next short section of defines are only done when not running on Windows
  8776  // or some other strange platform.
  8777  
  8778  type stat = struct {
  8779  	Fst_dev      dev_t
  8780  	Fst_ino      ino_t
  8781  	Fst_nlink    nlink_t
  8782  	Fst_mode     mode_t
  8783  	Fst_padding0 int16
  8784  	Fst_uid      uid_t
  8785  	Fst_gid      gid_t
  8786  	Fst_padding1 int32
  8787  	Fst_rdev     dev_t
  8788  	Fst_atim     struct {
  8789  		Ftv_sec  time_t
  8790  		Ftv_nsec int64
  8791  	}
  8792  	Fst_mtim struct {
  8793  		Ftv_sec  time_t
  8794  		Ftv_nsec int64
  8795  	}
  8796  	Fst_ctim struct {
  8797  		Ftv_sec  time_t
  8798  		Ftv_nsec int64
  8799  	}
  8800  	Fst_birthtim struct {
  8801  		Ftv_sec  time_t
  8802  		Ftv_nsec int64
  8803  	}
  8804  	Fst_size    off_t
  8805  	Fst_blocks  blkcnt_t
  8806  	Fst_blksize blksize_t
  8807  	Fst_flags   fflags_t
  8808  	Fst_gen     uint64
  8809  	Fst_spare   [10]uint64
  8810  } /* stat.h:160:1 */
  8811  
  8812  //----------------------------------------------------------------------------
  8813  // Data structures defined opaquely in this module. The definitions below just
  8814  // provide dummy types. A few fields are made visible in Tcl_Interp
  8815  // structures, namely those used for returning a string result from commands.
  8816  // Direct access to the result field is discouraged in Tcl 8.0. The
  8817  // interpreter result is either an object or a string, and the two values are
  8818  // kept consistent unless some C code sets interp->result directly.
  8819  // Programmers should use either the function Tcl_GetObjResult() or
  8820  // Tcl_GetStringResult() to read the interpreter's result. See the SetResult
  8821  // man page for details.
  8822  //
  8823  // Note: any change to the Tcl_Interp definition below must be mirrored in the
  8824  // "real" definition in tclInt.h.
  8825  //
  8826  // Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
  8827  // Instead, they set a Tcl_Obj member in the "real" structure that can be
  8828  // accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
  8829  
  8830  type Tcl_Interp1 = struct {
  8831  	FresultDontUse    uintptr
  8832  	FfreeProcDontUse  uintptr
  8833  	FerrorLineDontUse int32
  8834  	_                 [4]byte
  8835  } /* tcl.h:493:9 */
  8836  
  8837  //----------------------------------------------------------------------------
  8838  // Data structures defined opaquely in this module. The definitions below just
  8839  // provide dummy types. A few fields are made visible in Tcl_Interp
  8840  // structures, namely those used for returning a string result from commands.
  8841  // Direct access to the result field is discouraged in Tcl 8.0. The
  8842  // interpreter result is either an object or a string, and the two values are
  8843  // kept consistent unless some C code sets interp->result directly.
  8844  // Programmers should use either the function Tcl_GetObjResult() or
  8845  // Tcl_GetStringResult() to read the interpreter's result. See the SetResult
  8846  // man page for details.
  8847  //
  8848  // Note: any change to the Tcl_Interp definition below must be mirrored in the
  8849  // "real" definition in tclInt.h.
  8850  //
  8851  // Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
  8852  // Instead, they set a Tcl_Obj member in the "real" structure that can be
  8853  // accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
  8854  
  8855  type Tcl_Interp = Tcl_Interp1 /* tcl.h:525:1 */
  8856  
  8857  type Tcl_AsyncHandler = uintptr       /* tcl.h:527:34 */
  8858  type Tcl_Channel = uintptr            /* tcl.h:528:29 */
  8859  type Tcl_ChannelTypeVersion = uintptr /* tcl.h:529:40 */
  8860  type Tcl_Command = uintptr            /* tcl.h:530:29 */
  8861  type Tcl_Condition = uintptr          /* tcl.h:531:31 */
  8862  type Tcl_Dict = uintptr               /* tcl.h:532:26 */
  8863  type Tcl_EncodingState = uintptr      /* tcl.h:533:35 */
  8864  type Tcl_Encoding = uintptr           /* tcl.h:534:30 */
  8865  type Tcl_Event1 = struct {
  8866  	Fproc    uintptr
  8867  	FnextPtr uintptr
  8868  } /* tcl.h:535:9 */
  8869  
  8870  type Tcl_Event = Tcl_Event1      /* tcl.h:535:26 */
  8871  type Tcl_InterpState = uintptr   /* tcl.h:536:33 */
  8872  type Tcl_LoadHandle = uintptr    /* tcl.h:537:32 */
  8873  type Tcl_Mutex = uintptr         /* tcl.h:538:27 */
  8874  type Tcl_Pid = uintptr           /* tcl.h:539:25 */
  8875  type Tcl_RegExp = uintptr        /* tcl.h:540:28 */
  8876  type Tcl_ThreadDataKey = uintptr /* tcl.h:541:35 */
  8877  type Tcl_ThreadId = uintptr      /* tcl.h:542:30 */
  8878  type Tcl_TimerToken = uintptr    /* tcl.h:543:32 */
  8879  type Tcl_Trace = uintptr         /* tcl.h:544:27 */
  8880  type Tcl_Var = uintptr           /* tcl.h:545:25 */
  8881  type Tcl_ZlibStream = uintptr    /* tcl.h:546:32 */
  8882  
  8883  // Threading function return types used for abstracting away platform
  8884  // differences when writing a Tcl_ThreadCreateProc. See the NewThread function
  8885  // in generic/tclThreadTest.c for it's usage.
  8886  
  8887  // Definition of values for default stacksize and the possible flags to be
  8888  // given to Tcl_CreateThread.
  8889  
  8890  // Flag values passed to Tcl_StringCaseMatch.
  8891  
  8892  // Flag values passed to Tcl_GetRegExpFromObj.
  8893  
  8894  // Flags values passed to Tcl_RegExpExecObj.
  8895  
  8896  // Structures filled in by Tcl_RegExpInfo. Note that all offset values are
  8897  // relative to the start of the match string, not the beginning of the entire
  8898  // string.
  8899  
  8900  type Tcl_RegExpIndices1 = struct {
  8901  	Fstart int64
  8902  	Fend   int64
  8903  } /* tcl.h:623:9 */
  8904  
  8905  // Threading function return types used for abstracting away platform
  8906  // differences when writing a Tcl_ThreadCreateProc. See the NewThread function
  8907  // in generic/tclThreadTest.c for it's usage.
  8908  
  8909  // Definition of values for default stacksize and the possible flags to be
  8910  // given to Tcl_CreateThread.
  8911  
  8912  // Flag values passed to Tcl_StringCaseMatch.
  8913  
  8914  // Flag values passed to Tcl_GetRegExpFromObj.
  8915  
  8916  // Flags values passed to Tcl_RegExpExecObj.
  8917  
  8918  // Structures filled in by Tcl_RegExpInfo. Note that all offset values are
  8919  // relative to the start of the match string, not the beginning of the entire
  8920  // string.
  8921  
  8922  type Tcl_RegExpIndices = Tcl_RegExpIndices1 /* tcl.h:628:3 */
  8923  
  8924  type Tcl_RegExpInfo1 = struct {
  8925  	Fnsubs       int32
  8926  	_            [4]byte
  8927  	Fmatches     uintptr
  8928  	FextendStart int64
  8929  	Freserved    int64
  8930  } /* tcl.h:630:9 */
  8931  
  8932  type Tcl_RegExpInfo = Tcl_RegExpInfo1 /* tcl.h:637:3 */
  8933  
  8934  // Picky compilers complain if this typdef doesn't appear before the struct's
  8935  // reference in tclDecls.h.
  8936  
  8937  type Tcl_Stat_ = uintptr    /* tcl.h:644:21 */
  8938  type Tcl_OldStat_ = uintptr /* tcl.h:645:21 */
  8939  
  8940  //----------------------------------------------------------------------------
  8941  // When a TCL command returns, the interpreter contains a result from the
  8942  // command. Programmers are strongly encouraged to use one of the functions
  8943  // Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's
  8944  // result. See the SetResult man page for details. Besides this result, the
  8945  // command function returns an integer code, which is one of the following:
  8946  //
  8947  // TCL_OK		Command completed normally; the interpreter's result
  8948  //			contains the command's result.
  8949  // TCL_ERROR		The command couldn't be completed successfully; the
  8950  //			interpreter's result describes what went wrong.
  8951  // TCL_RETURN		The command requests that the current function return;
  8952  //			the interpreter's result contains the function's
  8953  //			return value.
  8954  // TCL_BREAK		The command requests that the innermost loop be
  8955  //			exited; the interpreter's result is meaningless.
  8956  // TCL_CONTINUE		Go on to the next iteration of the current loop; the
  8957  //			interpreter's result is meaningless.
  8958  
  8959  //----------------------------------------------------------------------------
  8960  // Flags to control what substitutions are performed by Tcl_SubstObj():
  8961  
  8962  // Argument descriptors for math function callbacks in expressions:
  8963  
  8964  type Tcl_ValueType = uint32 /* tcl.h:692:3 */
  8965  
  8966  type Tcl_Value1 = struct {
  8967  	Ftype        Tcl_ValueType
  8968  	_            [4]byte
  8969  	FintValue    int64
  8970  	FdoubleValue float64
  8971  	FwideValue   Tcl_WideInt
  8972  } /* tcl.h:694:9 */
  8973  
  8974  type Tcl_Value = Tcl_Value1 /* tcl.h:700:3 */
  8975  
  8976  // Forward declaration of Tcl_Obj to prevent an error when the forward
  8977  // reference to Tcl_Obj is encountered in the function types declared below.
  8978  
  8979  type Tcl_Obj1 = struct {
  8980  	FrefCount    int32
  8981  	_            [4]byte
  8982  	Fbytes       uintptr
  8983  	Flength      int32
  8984  	_            [4]byte
  8985  	FtypePtr     uintptr
  8986  	FinternalRep struct {
  8987  		FlongValue int64
  8988  		_          [8]byte
  8989  	}
  8990  } /* tcl.h:707:1 */
  8991  
  8992  //----------------------------------------------------------------------------
  8993  // The following structure represents a type of object, which is a particular
  8994  // internal representation for an object plus a set of functions that provide
  8995  // standard operations on objects of that type.
  8996  
  8997  type Tcl_ObjType1 = struct {
  8998  	Fname             uintptr
  8999  	FfreeIntRepProc   uintptr
  9000  	FdupIntRepProc    uintptr
  9001  	FupdateStringProc uintptr
  9002  	FsetFromAnyProc   uintptr
  9003  } /* tcl.h:707:1 */
  9004  
  9005  //----------------------------------------------------------------------------
  9006  // The following structure represents a type of object, which is a particular
  9007  // internal representation for an object plus a set of functions that provide
  9008  // standard operations on objects of that type.
  9009  
  9010  type Tcl_ObjType = Tcl_ObjType1 /* tcl.h:796:3 */
  9011  
  9012  // One of the following structures exists for each object in the Tcl system.
  9013  // An object stores a value as either a string, some internal representation,
  9014  // or both.
  9015  
  9016  type Tcl_Obj = Tcl_Obj1 /* tcl.h:843:3 */
  9017  
  9018  //----------------------------------------------------------------------------
  9019  // The following structure contains the state needed by Tcl_SaveResult. No-one
  9020  // outside of Tcl should access any of these fields. This structure is
  9021  // typically allocated on the stack.
  9022  
  9023  type Tcl_SavedResult1 = struct {
  9024  	Fresult       uintptr
  9025  	FfreeProc     uintptr
  9026  	FobjResultPtr uintptr
  9027  	FappendResult uintptr
  9028  	FappendAvl    int32
  9029  	FappendUsed   int32
  9030  	FresultSpace  [201]int8
  9031  	_             [7]byte
  9032  } /* tcl.h:864:9 */
  9033  
  9034  //----------------------------------------------------------------------------
  9035  // The following structure contains the state needed by Tcl_SaveResult. No-one
  9036  // outside of Tcl should access any of these fields. This structure is
  9037  // typically allocated on the stack.
  9038  
  9039  type Tcl_SavedResult = Tcl_SavedResult1 /* tcl.h:872:3 */
  9040  
  9041  //----------------------------------------------------------------------------
  9042  // The following definitions support Tcl's namespace facility. Note: the first
  9043  // five fields must match exactly the fields in a Namespace structure (see
  9044  // tclInt.h).
  9045  
  9046  type Tcl_Namespace1 = struct {
  9047  	Fname       uintptr
  9048  	FfullName   uintptr
  9049  	FclientData ClientData
  9050  	FdeleteProc uintptr
  9051  	FparentPtr  uintptr
  9052  } /* tcl.h:881:9 */
  9053  
  9054  //----------------------------------------------------------------------------
  9055  // The following definitions support Tcl's namespace facility. Note: the first
  9056  // five fields must match exactly the fields in a Namespace structure (see
  9057  // tclInt.h).
  9058  
  9059  type Tcl_Namespace = Tcl_Namespace1 /* tcl.h:897:3 */
  9060  
  9061  //----------------------------------------------------------------------------
  9062  // The following structure represents a call frame, or activation record. A
  9063  // call frame defines a naming context for a procedure call: its local scope
  9064  // (for local variables) and its namespace scope (used for non-local
  9065  // variables; often the global :: namespace). A call frame can also define the
  9066  // naming context for a namespace eval or namespace inscope command: the
  9067  // namespace in which the command's code should execute. The Tcl_CallFrame
  9068  // structures exist only while procedures or namespace eval/inscope's are
  9069  // being executed, and provide a Tcl call stack.
  9070  //
  9071  // A call frame is initialized and pushed using Tcl_PushCallFrame and popped
  9072  // using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the
  9073  // Tcl_PushCallFrame caller, and callers typically allocate them on the C call
  9074  // stack for efficiency. For this reason, Tcl_CallFrame is defined as a
  9075  // structure and not as an opaque token. However, most Tcl_CallFrame fields
  9076  // are hidden since applications should not access them directly; others are
  9077  // declared as "dummyX".
  9078  //
  9079  // WARNING!! The structure definition must be kept consistent with the
  9080  // CallFrame structure in tclInt.h. If you change one, change the other.
  9081  
  9082  type Tcl_CallFrame1 = struct {
  9083  	FnsPtr   uintptr
  9084  	Fdummy1  int32
  9085  	Fdummy2  int32
  9086  	Fdummy3  uintptr
  9087  	Fdummy4  uintptr
  9088  	Fdummy5  uintptr
  9089  	Fdummy6  int32
  9090  	_        [4]byte
  9091  	Fdummy7  uintptr
  9092  	Fdummy8  uintptr
  9093  	Fdummy9  int32
  9094  	_        [4]byte
  9095  	Fdummy10 uintptr
  9096  	Fdummy11 uintptr
  9097  	Fdummy12 uintptr
  9098  	Fdummy13 uintptr
  9099  } /* tcl.h:922:9 */
  9100  
  9101  //----------------------------------------------------------------------------
  9102  // The following structure represents a call frame, or activation record. A
  9103  // call frame defines a naming context for a procedure call: its local scope
  9104  // (for local variables) and its namespace scope (used for non-local
  9105  // variables; often the global :: namespace). A call frame can also define the
  9106  // naming context for a namespace eval or namespace inscope command: the
  9107  // namespace in which the command's code should execute. The Tcl_CallFrame
  9108  // structures exist only while procedures or namespace eval/inscope's are
  9109  // being executed, and provide a Tcl call stack.
  9110  //
  9111  // A call frame is initialized and pushed using Tcl_PushCallFrame and popped
  9112  // using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the
  9113  // Tcl_PushCallFrame caller, and callers typically allocate them on the C call
  9114  // stack for efficiency. For this reason, Tcl_CallFrame is defined as a
  9115  // structure and not as an opaque token. However, most Tcl_CallFrame fields
  9116  // are hidden since applications should not access them directly; others are
  9117  // declared as "dummyX".
  9118  //
  9119  // WARNING!! The structure definition must be kept consistent with the
  9120  // CallFrame structure in tclInt.h. If you change one, change the other.
  9121  
  9122  type Tcl_CallFrame = Tcl_CallFrame1 /* tcl.h:937:3 */
  9123  
  9124  //----------------------------------------------------------------------------
  9125  // Information about commands that is returned by Tcl_GetCommandInfo and
  9126  // passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command
  9127  // function while proc is a traditional Tcl argc/argv string-based function.
  9128  // Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and
  9129  // proc are non-NULL and can be called to execute the command. However, it may
  9130  // be faster to call one instead of the other. The member isNativeObjectProc
  9131  // is set to 1 if an object-based function was registered by
  9132  // Tcl_CreateObjCommand, and to 0 if a string-based function was registered by
  9133  // Tcl_CreateCommand. The other function is typically set to a compatibility
  9134  // wrapper that does string-to-object or object-to-string argument conversions
  9135  // then calls the other function.
  9136  
  9137  type Tcl_CmdInfo1 = struct {
  9138  	FisNativeObjectProc int32
  9139  	_                   [4]byte
  9140  	FobjProc            uintptr
  9141  	FobjClientData      ClientData
  9142  	Fproc               uintptr
  9143  	FclientData         ClientData
  9144  	FdeleteProc         uintptr
  9145  	FdeleteData         ClientData
  9146  	FnamespacePtr       uintptr
  9147  } /* tcl.h:954:9 */
  9148  
  9149  //----------------------------------------------------------------------------
  9150  // Information about commands that is returned by Tcl_GetCommandInfo and
  9151  // passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command
  9152  // function while proc is a traditional Tcl argc/argv string-based function.
  9153  // Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and
  9154  // proc are non-NULL and can be called to execute the command. However, it may
  9155  // be faster to call one instead of the other. The member isNativeObjectProc
  9156  // is set to 1 if an object-based function was registered by
  9157  // Tcl_CreateObjCommand, and to 0 if a string-based function was registered by
  9158  // Tcl_CreateCommand. The other function is typically set to a compatibility
  9159  // wrapper that does string-to-object or object-to-string argument conversions
  9160  // then calls the other function.
  9161  
  9162  type Tcl_CmdInfo = Tcl_CmdInfo1 /* tcl.h:973:3 */
  9163  
  9164  //----------------------------------------------------------------------------
  9165  // The structure defined below is used to hold dynamic strings. The only
  9166  // fields that clients should use are string and length, accessible via the
  9167  // macros Tcl_DStringValue and Tcl_DStringLength.
  9168  
  9169  type Tcl_DString1 = struct {
  9170  	Fstring      uintptr
  9171  	Flength      int32
  9172  	FspaceAvl    int32
  9173  	FstaticSpace [200]int8
  9174  } /* tcl.h:983:9 */
  9175  
  9176  //----------------------------------------------------------------------------
  9177  // The structure defined below is used to hold dynamic strings. The only
  9178  // fields that clients should use are string and length, accessible via the
  9179  // macros Tcl_DStringValue and Tcl_DStringLength.
  9180  
  9181  type Tcl_DString = Tcl_DString1 /* tcl.h:993:3 */
  9182  
  9183  // Definitions for the maximum number of digits of precision that may be
  9184  // specified in the "tcl_precision" variable, and the number of bytes of
  9185  // buffer space required by Tcl_PrintDouble.
  9186  
  9187  // Definition for a number of bytes of buffer space sufficient to hold the
  9188  // string representation of an integer in base 10 (assuming the existence of
  9189  // 64-bit integers).
  9190  
  9191  // Flag values passed to Tcl_ConvertElement.
  9192  // TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to
  9193  //	use backslash quoting instead.
  9194  // TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It
  9195  //	is safe to leave the hash unquoted when the element is not the first
  9196  //	element of a list, and this flag can be used by the caller to indicate
  9197  //	that condition.
  9198  
  9199  // Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  9200  // abbreviated strings.
  9201  
  9202  //----------------------------------------------------------------------------
  9203  // Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
  9204  // WARNING: these bit choices must not conflict with the bit choices for
  9205  // evalFlag bits in tclInt.h!
  9206  //
  9207  // Meanings:
  9208  //	TCL_NO_EVAL:		Just record this command
  9209  //	TCL_EVAL_GLOBAL:	Execute script in global namespace
  9210  //	TCL_EVAL_DIRECT:	Do not compile this script
  9211  //	TCL_EVAL_INVOKE:	Magical Tcl_EvalObjv mode for aliases/ensembles
  9212  //				o Run in iPtr->lookupNsPtr or global namespace
  9213  //				o Cut out of error traces
  9214  //				o Don't reset the flags controlling ensemble
  9215  //				  error message rewriting.
  9216  //	TCL_CANCEL_UNWIND:	Magical Tcl_CancelEval mode that causes the
  9217  //				stack for the script in progress to be
  9218  //				completely unwound.
  9219  //	TCL_EVAL_NOERR:	Do no exception reporting at all, just return
  9220  //				as the caller will report.
  9221  
  9222  // Special freeProc values that may be passed to Tcl_SetResult (see the man
  9223  // page for details):
  9224  
  9225  // Flag values passed to variable-related functions.
  9226  // WARNING: these bit choices must not conflict with the bit choice for
  9227  // TCL_CANCEL_UNWIND, above.
  9228  
  9229  // Required to support old variable/vdelete/vinfo traces.
  9230  // Indicate the semantics of the result of a trace.
  9231  
  9232  // Flag values for ensemble commands.
  9233  
  9234  // Flag values passed to command-related functions.
  9235  
  9236  // The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  9237  // always parsed whenever the part2 is NULL. (This is to avoid a common error
  9238  // when converting code to use the new object based APIs and forgetting to
  9239  // give the flag)
  9240  
  9241  // Types for linked variables:
  9242  
  9243  //----------------------------------------------------------------------------
  9244  // Forward declarations of Tcl_HashTable and related types.
  9245  
  9246  type Tcl_HashKeyType1 = struct {
  9247  	Fversion         int32
  9248  	Fflags           int32
  9249  	FhashKeyProc     uintptr
  9250  	FcompareKeysProc uintptr
  9251  	FallocEntryProc  uintptr
  9252  	FfreeEntryProc   uintptr
  9253  } /* tcl.h:1152:9 */
  9254  
  9255  // Definitions for the maximum number of digits of precision that may be
  9256  // specified in the "tcl_precision" variable, and the number of bytes of
  9257  // buffer space required by Tcl_PrintDouble.
  9258  
  9259  // Definition for a number of bytes of buffer space sufficient to hold the
  9260  // string representation of an integer in base 10 (assuming the existence of
  9261  // 64-bit integers).
  9262  
  9263  // Flag values passed to Tcl_ConvertElement.
  9264  // TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to
  9265  //	use backslash quoting instead.
  9266  // TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It
  9267  //	is safe to leave the hash unquoted when the element is not the first
  9268  //	element of a list, and this flag can be used by the caller to indicate
  9269  //	that condition.
  9270  
  9271  // Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  9272  // abbreviated strings.
  9273  
  9274  //----------------------------------------------------------------------------
  9275  // Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
  9276  // WARNING: these bit choices must not conflict with the bit choices for
  9277  // evalFlag bits in tclInt.h!
  9278  //
  9279  // Meanings:
  9280  //	TCL_NO_EVAL:		Just record this command
  9281  //	TCL_EVAL_GLOBAL:	Execute script in global namespace
  9282  //	TCL_EVAL_DIRECT:	Do not compile this script
  9283  //	TCL_EVAL_INVOKE:	Magical Tcl_EvalObjv mode for aliases/ensembles
  9284  //				o Run in iPtr->lookupNsPtr or global namespace
  9285  //				o Cut out of error traces
  9286  //				o Don't reset the flags controlling ensemble
  9287  //				  error message rewriting.
  9288  //	TCL_CANCEL_UNWIND:	Magical Tcl_CancelEval mode that causes the
  9289  //				stack for the script in progress to be
  9290  //				completely unwound.
  9291  //	TCL_EVAL_NOERR:	Do no exception reporting at all, just return
  9292  //				as the caller will report.
  9293  
  9294  // Special freeProc values that may be passed to Tcl_SetResult (see the man
  9295  // page for details):
  9296  
  9297  // Flag values passed to variable-related functions.
  9298  // WARNING: these bit choices must not conflict with the bit choice for
  9299  // TCL_CANCEL_UNWIND, above.
  9300  
  9301  // Required to support old variable/vdelete/vinfo traces.
  9302  // Indicate the semantics of the result of a trace.
  9303  
  9304  // Flag values for ensemble commands.
  9305  
  9306  // Flag values passed to command-related functions.
  9307  
  9308  // The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  9309  // always parsed whenever the part2 is NULL. (This is to avoid a common error
  9310  // when converting code to use the new object based APIs and forgetting to
  9311  // give the flag)
  9312  
  9313  // Types for linked variables:
  9314  
  9315  //----------------------------------------------------------------------------
  9316  // Forward declarations of Tcl_HashTable and related types.
  9317  
  9318  type Tcl_HashKeyType = Tcl_HashKeyType1 /* tcl.h:1152:32 */
  9319  type Tcl_HashTable1 = struct {
  9320  	Fbuckets       uintptr
  9321  	FstaticBuckets [4]uintptr
  9322  	FnumBuckets    int32
  9323  	FnumEntries    int32
  9324  	FrebuildSize   int32
  9325  	FdownShift     int32
  9326  	Fmask          int32
  9327  	FkeyType       int32
  9328  	FfindProc      uintptr
  9329  	FcreateProc    uintptr
  9330  	FtypePtr       uintptr
  9331  } /* tcl.h:1153:9 */
  9332  
  9333  type Tcl_HashTable = Tcl_HashTable1 /* tcl.h:1153:30 */
  9334  type Tcl_HashEntry1 = struct {
  9335  	FnextPtr    uintptr
  9336  	FtablePtr   uintptr
  9337  	Fhash       uintptr
  9338  	FclientData ClientData
  9339  	Fkey        struct{ FoneWordValue uintptr }
  9340  } /* tcl.h:1153:9 */
  9341  
  9342  type Tcl_HashEntry = Tcl_HashEntry1 /* tcl.h:1154:30 */
  9343  
  9344  // Structure definition for information used to keep track of searches through
  9345  // hash tables:
  9346  
  9347  type Tcl_HashSearch1 = struct {
  9348  	FtablePtr     uintptr
  9349  	FnextIndex    int32
  9350  	_             [4]byte
  9351  	FnextEntryPtr uintptr
  9352  } /* tcl.h:1308:9 */
  9353  
  9354  // Structure definition for information used to keep track of searches through
  9355  // hash tables:
  9356  
  9357  type Tcl_HashSearch = Tcl_HashSearch1 /* tcl.h:1314:3 */
  9358  
  9359  // Acceptable key types for hash tables:
  9360  //
  9361  // TCL_STRING_KEYS:		The keys are strings, they are copied into the
  9362  //				entry.
  9363  // TCL_ONE_WORD_KEYS:		The keys are pointers, the pointer is stored
  9364  //				in the entry.
  9365  // TCL_CUSTOM_TYPE_KEYS:	The keys are arbitrary types which are copied
  9366  //				into the entry.
  9367  // TCL_CUSTOM_PTR_KEYS:		The keys are pointers to arbitrary types, the
  9368  //				pointer is stored in the entry.
  9369  //
  9370  // While maintaining binary compatibility the above have to be distinct values
  9371  // as they are used to differentiate between old versions of the hash table
  9372  // which don't have a typePtr and new ones which do. Once binary compatibility
  9373  // is discarded in favour of making more wide spread changes TCL_STRING_KEYS
  9374  // can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the
  9375  // same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is
  9376  // accessed from the entry and not the behaviour.
  9377  
  9378  // Structure definition for information used to keep track of searches through
  9379  // dictionaries. These fields should not be accessed by code outside
  9380  // tclDictObj.c
  9381  
  9382  type Tcl_DictSearch = struct {
  9383  	Fnext          uintptr
  9384  	Fepoch         int32
  9385  	_              [4]byte
  9386  	FdictionaryPtr Tcl_Dict
  9387  } /* tcl.h:1354:3 */
  9388  
  9389  // Positions to pass to Tcl_QueueEvent:
  9390  
  9391  type Tcl_QueuePosition = uint32 /* tcl.h:1389:3 */
  9392  
  9393  // Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
  9394  // event routines.
  9395  
  9396  // The following structure keeps is used to hold a time value, either as an
  9397  // absolute time (the number of seconds from the epoch) or as an elapsed time.
  9398  // On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
  9399  
  9400  type Tcl_Time1 = struct {
  9401  	Fsec  int64
  9402  	Fusec int64
  9403  } /* tcl.h:1405:9 */
  9404  
  9405  // Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
  9406  // event routines.
  9407  
  9408  // The following structure keeps is used to hold a time value, either as an
  9409  // absolute time (the number of seconds from the epoch) or as an elapsed time.
  9410  // On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
  9411  
  9412  type Tcl_Time = Tcl_Time1 /* tcl.h:1408:3 */
  9413  
  9414  // struct Tcl_ChannelType:
  9415  //
  9416  // One such structure exists for each type (kind) of channel. It collects
  9417  // together in one place all the functions that are part of the specific
  9418  // channel type.
  9419  //
  9420  // It is recommend that the Tcl_Channel* functions are used to access elements
  9421  // of this structure, instead of direct accessing.
  9422  
  9423  type Tcl_ChannelType1 = struct {
  9424  	FtypeName         uintptr
  9425  	Fversion          Tcl_ChannelTypeVersion
  9426  	FcloseProc        uintptr
  9427  	FinputProc        uintptr
  9428  	FoutputProc       uintptr
  9429  	FseekProc         uintptr
  9430  	FsetOptionProc    uintptr
  9431  	FgetOptionProc    uintptr
  9432  	FwatchProc        uintptr
  9433  	FgetHandleProc    uintptr
  9434  	Fclose2Proc       uintptr
  9435  	FblockModeProc    uintptr
  9436  	FflushProc        uintptr
  9437  	FhandlerProc      uintptr
  9438  	FwideSeekProc     uintptr
  9439  	FthreadActionProc uintptr
  9440  	FtruncateProc     uintptr
  9441  } /* tcl.h:1524:9 */
  9442  
  9443  // struct Tcl_ChannelType:
  9444  //
  9445  // One such structure exists for each type (kind) of channel. It collects
  9446  // together in one place all the functions that are part of the specific
  9447  // channel type.
  9448  //
  9449  // It is recommend that the Tcl_Channel* functions are used to access elements
  9450  // of this structure, instead of direct accessing.
  9451  
  9452  type Tcl_ChannelType = Tcl_ChannelType1 /* tcl.h:1592:3 */
  9453  
  9454  // The following flags determine whether the blockModeProc above should set
  9455  // the channel into blocking or nonblocking mode. They are passed as arguments
  9456  // to the blockModeProc function in the above structure.
  9457  
  9458  //----------------------------------------------------------------------------
  9459  // Enum for different types of file paths.
  9460  
  9461  type Tcl_PathType = uint32 /* tcl.h:1613:3 */
  9462  
  9463  // The following structure is used to pass glob type data amongst the various
  9464  // glob routines and Tcl_FSMatchInDirectory.
  9465  
  9466  type Tcl_GlobTypeData1 = struct {
  9467  	Ftype       int32
  9468  	Fperm       int32
  9469  	FmacType    uintptr
  9470  	FmacCreator uintptr
  9471  } /* tcl.h:1620:9 */
  9472  
  9473  // The following structure is used to pass glob type data amongst the various
  9474  // glob routines and Tcl_FSMatchInDirectory.
  9475  
  9476  type Tcl_GlobTypeData = Tcl_GlobTypeData1 /* tcl.h:1625:3 */
  9477  // We have to declare the utime structure here.
  9478  type utimbuf = struct {
  9479  	Factime  time_t
  9480  	Fmodtime time_t
  9481  } /* utime.h:46:1 */
  9482  
  9483  type Tcl_FSVersion = uintptr /* tcl.h:1700:31 */
  9484  
  9485  //----------------------------------------------------------------------------
  9486  // Data structures related to hooking into the filesystem
  9487  
  9488  // Filesystem version tag.  This was introduced in 8.4.
  9489  
  9490  // struct Tcl_Filesystem:
  9491  //
  9492  // One such structure exists for each type (kind) of filesystem. It collects
  9493  // together in one place all the functions that are part of the specific
  9494  // filesystem. Tcl always accesses the filesystem through one of these
  9495  // structures.
  9496  //
  9497  // Not all entries need be non-NULL; any which are NULL are simply ignored.
  9498  // However, a complete filesystem should provide all of these functions. The
  9499  // explanations in the structure show the importance of each function.
  9500  
  9501  type Tcl_Filesystem1 = struct {
  9502  	FtypeName                 uintptr
  9503  	FstructureLength          int32
  9504  	_                         [4]byte
  9505  	Fversion                  Tcl_FSVersion
  9506  	FpathInFilesystemProc     uintptr
  9507  	FdupInternalRepProc       uintptr
  9508  	FfreeInternalRepProc      uintptr
  9509  	FinternalToNormalizedProc uintptr
  9510  	FcreateInternalRepProc    uintptr
  9511  	FnormalizePathProc        uintptr
  9512  	FfilesystemPathTypeProc   uintptr
  9513  	FfilesystemSeparatorProc  uintptr
  9514  	FstatProc                 uintptr
  9515  	FaccessProc               uintptr
  9516  	FopenFileChannelProc      uintptr
  9517  	FmatchInDirectoryProc     uintptr
  9518  	FutimeProc                uintptr
  9519  	FlinkProc                 uintptr
  9520  	FlistVolumesProc          uintptr
  9521  	FfileAttrStringsProc      uintptr
  9522  	FfileAttrsGetProc         uintptr
  9523  	FfileAttrsSetProc         uintptr
  9524  	FcreateDirectoryProc      uintptr
  9525  	FremoveDirectoryProc      uintptr
  9526  	FdeleteFileProc           uintptr
  9527  	FcopyFileProc             uintptr
  9528  	FrenameFileProc           uintptr
  9529  	FcopyDirectoryProc        uintptr
  9530  	FlstatProc                uintptr
  9531  	FloadFileProc             uintptr
  9532  	FgetCwdProc               uintptr
  9533  	FchdirProc                uintptr
  9534  } /* tcl.h:1726:9 */
  9535  
  9536  //----------------------------------------------------------------------------
  9537  // Data structures related to hooking into the filesystem
  9538  
  9539  // Filesystem version tag.  This was introduced in 8.4.
  9540  
  9541  // struct Tcl_Filesystem:
  9542  //
  9543  // One such structure exists for each type (kind) of filesystem. It collects
  9544  // together in one place all the functions that are part of the specific
  9545  // filesystem. Tcl always accesses the filesystem through one of these
  9546  // structures.
  9547  //
  9548  // Not all entries need be non-NULL; any which are NULL are simply ignored.
  9549  // However, a complete filesystem should provide all of these functions. The
  9550  // explanations in the structure show the importance of each function.
  9551  
  9552  type Tcl_Filesystem = Tcl_Filesystem1 /* tcl.h:1873:3 */
  9553  
  9554  // The following definitions are used as values for the 'linkAction' flag to
  9555  // Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can
  9556  // be given. For link creation, the linkProc should create a link which
  9557  // matches any of the types given.
  9558  //
  9559  // TCL_CREATE_SYMBOLIC_LINK -	Create a symbolic or soft link.
  9560  // TCL_CREATE_HARD_LINK -	Create a hard link.
  9561  
  9562  //----------------------------------------------------------------------------
  9563  // The following structure represents the Notifier functions that you can
  9564  // override with the Tcl_SetNotifier call.
  9565  
  9566  type Tcl_NotifierProcs1 = struct {
  9567  	FsetTimerProc          uintptr
  9568  	FwaitForEventProc      uintptr
  9569  	FcreateFileHandlerProc uintptr
  9570  	FdeleteFileHandlerProc uintptr
  9571  	FinitNotifierProc      uintptr
  9572  	FfinalizeNotifierProc  uintptr
  9573  	FalertNotifierProc     uintptr
  9574  	FserviceModeHookProc   uintptr
  9575  } /* tcl.h:1894:9 */
  9576  
  9577  // The following definitions are used as values for the 'linkAction' flag to
  9578  // Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can
  9579  // be given. For link creation, the linkProc should create a link which
  9580  // matches any of the types given.
  9581  //
  9582  // TCL_CREATE_SYMBOLIC_LINK -	Create a symbolic or soft link.
  9583  // TCL_CREATE_HARD_LINK -	Create a hard link.
  9584  
  9585  //----------------------------------------------------------------------------
  9586  // The following structure represents the Notifier functions that you can
  9587  // override with the Tcl_SetNotifier call.
  9588  
  9589  type Tcl_NotifierProcs = Tcl_NotifierProcs1 /* tcl.h:1903:3 */
  9590  
  9591  //----------------------------------------------------------------------------
  9592  // The following data structures and declarations are for the new Tcl parser.
  9593  //
  9594  // For each word of a command, and for each piece of a word such as a variable
  9595  // reference, one of the following structures is created to describe the
  9596  // token.
  9597  
  9598  type Tcl_Token1 = struct {
  9599  	Ftype          int32
  9600  	_              [4]byte
  9601  	Fstart         uintptr
  9602  	Fsize          int32
  9603  	FnumComponents int32
  9604  } /* tcl.h:1914:9 */
  9605  
  9606  //----------------------------------------------------------------------------
  9607  // The following data structures and declarations are for the new Tcl parser.
  9608  //
  9609  // For each word of a command, and for each piece of a word such as a variable
  9610  // reference, one of the following structures is created to describe the
  9611  // token.
  9612  
  9613  type Tcl_Token = Tcl_Token1 /* tcl.h:1924:3 */
  9614  
  9615  // Type values defined for Tcl_Token structures. These values are defined as
  9616  // mask bits so that it's easy to check for collections of types.
  9617  //
  9618  // TCL_TOKEN_WORD -		The token describes one word of a command,
  9619  //				from the first non-blank character of the word
  9620  //				(which may be " or {) up to but not including
  9621  //				the space, semicolon, or bracket that
  9622  //				terminates the word. NumComponents counts the
  9623  //				total number of sub-tokens that make up the
  9624  //				word. This includes, for example, sub-tokens
  9625  //				of TCL_TOKEN_VARIABLE tokens.
  9626  // TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD except
  9627  //				that the word is guaranteed to consist of a
  9628  //				single TCL_TOKEN_TEXT sub-token.
  9629  // TCL_TOKEN_TEXT -		The token describes a range of literal text
  9630  //				that is part of a word. NumComponents is
  9631  //				always 0.
  9632  // TCL_TOKEN_BS -		The token describes a backslash sequence that
  9633  //				must be collapsed. NumComponents is always 0.
  9634  // TCL_TOKEN_COMMAND -		The token describes a command whose result
  9635  //				must be substituted into the word. The token
  9636  //				includes the enclosing brackets. NumComponents
  9637  //				is always 0.
  9638  // TCL_TOKEN_VARIABLE -		The token describes a variable substitution,
  9639  //				including the dollar sign, variable name, and
  9640  //				array index (if there is one) up through the
  9641  //				right parentheses. NumComponents tells how
  9642  //				many additional tokens follow to represent the
  9643  //				variable name. The first token will be a
  9644  //				TCL_TOKEN_TEXT token that describes the
  9645  //				variable name. If the variable is an array
  9646  //				reference then there will be one or more
  9647  //				additional tokens, of type TCL_TOKEN_TEXT,
  9648  //				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
  9649  //				TCL_TOKEN_VARIABLE, that describe the array
  9650  //				index; numComponents counts the total number
  9651  //				of nested tokens that make up the variable
  9652  //				reference, including sub-tokens of
  9653  //				TCL_TOKEN_VARIABLE tokens.
  9654  // TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of an
  9655  //				expression, from the first non-blank character
  9656  //				of the subexpression up to but not including
  9657  //				the space, brace, or bracket that terminates
  9658  //				the subexpression. NumComponents counts the
  9659  //				total number of following subtokens that make
  9660  //				up the subexpression; this includes all
  9661  //				subtokens for any nested TCL_TOKEN_SUB_EXPR
  9662  //				tokens. For example, a numeric value used as a
  9663  //				primitive operand is described by a
  9664  //				TCL_TOKEN_SUB_EXPR token followed by a
  9665  //				TCL_TOKEN_TEXT token. A binary subexpression
  9666  //				is described by a TCL_TOKEN_SUB_EXPR token
  9667  //				followed by the TCL_TOKEN_OPERATOR token for
  9668  //				the operator, then TCL_TOKEN_SUB_EXPR tokens
  9669  //				for the left then the right operands.
  9670  // TCL_TOKEN_OPERATOR -		The token describes one expression operator.
  9671  //				An operator might be the name of a math
  9672  //				function such as "abs". A TCL_TOKEN_OPERATOR
  9673  //				token is always preceded by one
  9674  //				TCL_TOKEN_SUB_EXPR token for the operator's
  9675  //				subexpression, and is followed by zero or more
  9676  //				TCL_TOKEN_SUB_EXPR tokens for the operator's
  9677  //				operands. NumComponents is always 0.
  9678  // TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
  9679  //				that it marks a word that began with the
  9680  //				literal character prefix "{*}". This word is
  9681  //				marked to be expanded - that is, broken into
  9682  //				words after substitution is complete.
  9683  
  9684  // Parsing error types. On any parsing error, one of these values will be
  9685  // stored in the error field of the Tcl_Parse structure defined below.
  9686  
  9687  // A structure of the following type is filled in by Tcl_ParseCommand. It
  9688  // describes a single command parsed from an input string.
  9689  
  9690  type Tcl_Parse1 = struct {
  9691  	FcommentStart    uintptr
  9692  	FcommentSize     int32
  9693  	_                [4]byte
  9694  	FcommandStart    uintptr
  9695  	FcommandSize     int32
  9696  	FnumWords        int32
  9697  	FtokenPtr        uintptr
  9698  	FnumTokens       int32
  9699  	FtokensAvailable int32
  9700  	FerrorType       int32
  9701  	_                [4]byte
  9702  	Fstring          uintptr
  9703  	Fend             uintptr
  9704  	Finterp          uintptr
  9705  	Fterm            uintptr
  9706  	Fincomplete      int32
  9707  	_                [4]byte
  9708  	FstaticTokens    [20]Tcl_Token
  9709  } /* tcl.h:2030:9 */
  9710  
  9711  // Type values defined for Tcl_Token structures. These values are defined as
  9712  // mask bits so that it's easy to check for collections of types.
  9713  //
  9714  // TCL_TOKEN_WORD -		The token describes one word of a command,
  9715  //				from the first non-blank character of the word
  9716  //				(which may be " or {) up to but not including
  9717  //				the space, semicolon, or bracket that
  9718  //				terminates the word. NumComponents counts the
  9719  //				total number of sub-tokens that make up the
  9720  //				word. This includes, for example, sub-tokens
  9721  //				of TCL_TOKEN_VARIABLE tokens.
  9722  // TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD except
  9723  //				that the word is guaranteed to consist of a
  9724  //				single TCL_TOKEN_TEXT sub-token.
  9725  // TCL_TOKEN_TEXT -		The token describes a range of literal text
  9726  //				that is part of a word. NumComponents is
  9727  //				always 0.
  9728  // TCL_TOKEN_BS -		The token describes a backslash sequence that
  9729  //				must be collapsed. NumComponents is always 0.
  9730  // TCL_TOKEN_COMMAND -		The token describes a command whose result
  9731  //				must be substituted into the word. The token
  9732  //				includes the enclosing brackets. NumComponents
  9733  //				is always 0.
  9734  // TCL_TOKEN_VARIABLE -		The token describes a variable substitution,
  9735  //				including the dollar sign, variable name, and
  9736  //				array index (if there is one) up through the
  9737  //				right parentheses. NumComponents tells how
  9738  //				many additional tokens follow to represent the
  9739  //				variable name. The first token will be a
  9740  //				TCL_TOKEN_TEXT token that describes the
  9741  //				variable name. If the variable is an array
  9742  //				reference then there will be one or more
  9743  //				additional tokens, of type TCL_TOKEN_TEXT,
  9744  //				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
  9745  //				TCL_TOKEN_VARIABLE, that describe the array
  9746  //				index; numComponents counts the total number
  9747  //				of nested tokens that make up the variable
  9748  //				reference, including sub-tokens of
  9749  //				TCL_TOKEN_VARIABLE tokens.
  9750  // TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of an
  9751  //				expression, from the first non-blank character
  9752  //				of the subexpression up to but not including
  9753  //				the space, brace, or bracket that terminates
  9754  //				the subexpression. NumComponents counts the
  9755  //				total number of following subtokens that make
  9756  //				up the subexpression; this includes all
  9757  //				subtokens for any nested TCL_TOKEN_SUB_EXPR
  9758  //				tokens. For example, a numeric value used as a
  9759  //				primitive operand is described by a
  9760  //				TCL_TOKEN_SUB_EXPR token followed by a
  9761  //				TCL_TOKEN_TEXT token. A binary subexpression
  9762  //				is described by a TCL_TOKEN_SUB_EXPR token
  9763  //				followed by the TCL_TOKEN_OPERATOR token for
  9764  //				the operator, then TCL_TOKEN_SUB_EXPR tokens
  9765  //				for the left then the right operands.
  9766  // TCL_TOKEN_OPERATOR -		The token describes one expression operator.
  9767  //				An operator might be the name of a math
  9768  //				function such as "abs". A TCL_TOKEN_OPERATOR
  9769  //				token is always preceded by one
  9770  //				TCL_TOKEN_SUB_EXPR token for the operator's
  9771  //				subexpression, and is followed by zero or more
  9772  //				TCL_TOKEN_SUB_EXPR tokens for the operator's
  9773  //				operands. NumComponents is always 0.
  9774  // TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
  9775  //				that it marks a word that began with the
  9776  //				literal character prefix "{*}". This word is
  9777  //				marked to be expanded - that is, broken into
  9778  //				words after substitution is complete.
  9779  
  9780  // Parsing error types. On any parsing error, one of these values will be
  9781  // stored in the error field of the Tcl_Parse structure defined below.
  9782  
  9783  // A structure of the following type is filled in by Tcl_ParseCommand. It
  9784  // describes a single command parsed from an input string.
  9785  
  9786  type Tcl_Parse = Tcl_Parse1 /* tcl.h:2083:3 */
  9787  
  9788  //----------------------------------------------------------------------------
  9789  // The following structure represents a user-defined encoding. It collects
  9790  // together all the functions that are used by the specific encoding.
  9791  
  9792  type Tcl_EncodingType1 = struct {
  9793  	FencodingName uintptr
  9794  	FtoUtfProc    uintptr
  9795  	FfromUtfProc  uintptr
  9796  	FfreeProc     uintptr
  9797  	FclientData   ClientData
  9798  	FnullSize     int32
  9799  	_             [4]byte
  9800  } /* tcl.h:2091:9 */
  9801  
  9802  //----------------------------------------------------------------------------
  9803  // The following structure represents a user-defined encoding. It collects
  9804  // together all the functions that are used by the specific encoding.
  9805  
  9806  type Tcl_EncodingType = Tcl_EncodingType1 /* tcl.h:2111:3 */
  9807  
  9808  // The following definitions are used as values for the conversion control
  9809  // flags argument when converting text from one character set to another:
  9810  //
  9811  // TCL_ENCODING_START -		Signifies that the source buffer is the first
  9812  //				block in a (potentially multi-block) input
  9813  //				stream. Tells the conversion function to reset
  9814  //				to an initial state and perform any
  9815  //				initialization that needs to occur before the
  9816  //				first byte is converted. If the source buffer
  9817  //				contains the entire input stream to be
  9818  //				converted, this flag should be set.
  9819  // TCL_ENCODING_END -		Signifies that the source buffer is the last
  9820  //				block in a (potentially multi-block) input
  9821  //				stream. Tells the conversion routine to
  9822  //				perform any finalization that needs to occur
  9823  //				after the last byte is converted and then to
  9824  //				reset to an initial state. If the source
  9825  //				buffer contains the entire input stream to be
  9826  //				converted, this flag should be set.
  9827  // TCL_ENCODING_STOPONERROR -	If set, then the converter will return
  9828  //				immediately upon encountering an invalid byte
  9829  //				sequence or a source character that has no
  9830  //				mapping in the target encoding. If clear, then
  9831  //				the converter will skip the problem,
  9832  //				substituting one or more "close" characters in
  9833  //				the destination buffer and then continue to
  9834  //				convert the source.
  9835  // TCL_ENCODING_NO_TERMINATE - 	If set, Tcl_ExternalToUtf will not append a
  9836  //				terminating NUL byte.  Knowing that it will
  9837  //				not need space to do so, it will fill all
  9838  //				dstLen bytes with encoded UTF-8 content, as
  9839  //				other circumstances permit.  If clear, the
  9840  //				default behavior is to reserve a byte in
  9841  //				the dst space for NUL termination, and to
  9842  //				append the NUL byte.
  9843  // TCL_ENCODING_CHAR_LIMIT -	If set and dstCharsPtr is not NULL, then
  9844  //				Tcl_ExternalToUtf takes the initial value
  9845  //				of *dstCharsPtr is taken as a limit of the
  9846  //				maximum number of chars to produce in the
  9847  //				encoded UTF-8 content.  Otherwise, the
  9848  //				number of chars produced is controlled only
  9849  //				by other limiting factors.
  9850  
  9851  // The following definitions are the error codes returned by the conversion
  9852  // routines:
  9853  //
  9854  // TCL_OK -			All characters were converted.
  9855  // TCL_CONVERT_NOSPACE -	The output buffer would not have been large
  9856  //				enough for all of the converted data; as many
  9857  //				characters as could fit were converted though.
  9858  // TCL_CONVERT_MULTIBYTE -	The last few bytes in the source string were
  9859  //				the beginning of a multibyte sequence, but
  9860  //				more bytes were needed to complete this
  9861  //				sequence. A subsequent call to the conversion
  9862  //				routine should pass the beginning of this
  9863  //				unconverted sequence plus additional bytes
  9864  //				from the source stream to properly convert the
  9865  //				formerly split-up multibyte sequence.
  9866  // TCL_CONVERT_SYNTAX -		The source stream contained an invalid
  9867  //				character sequence. This may occur if the
  9868  //				input stream has been damaged or if the input
  9869  //				encoding method was misidentified. This error
  9870  //				is reported only if TCL_ENCODING_STOPONERROR
  9871  //				was specified.
  9872  // TCL_CONVERT_UNKNOWN -	The source string contained a character that
  9873  //				could not be represented in the target
  9874  //				encoding. This error is reported only if
  9875  //				TCL_ENCODING_STOPONERROR was specified.
  9876  
  9877  // The maximum number of bytes that are necessary to represent a single
  9878  // Unicode character in UTF-8. The valid values should be 3, 4 or 6
  9879  // (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or
  9880  // 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
  9881  // then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
  9882  // is the default and recommended mode. UCS-4 is experimental and not
  9883  // recommended. It works for the core, but most extensions expect UCS-2.
  9884  
  9885  // This represents a Unicode character. Any changes to this should also be
  9886  // reflected in regcustom.h.
  9887  
  9888  type Tcl_UniChar = uint16 /* tcl.h:2228:24 */
  9889  
  9890  //----------------------------------------------------------------------------
  9891  // TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to
  9892  // provide the system with the embedded configuration data.
  9893  
  9894  type Tcl_Config1 = struct {
  9895  	Fkey   uintptr
  9896  	Fvalue uintptr
  9897  } /* tcl.h:2237:9 */
  9898  
  9899  //----------------------------------------------------------------------------
  9900  // TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to
  9901  // provide the system with the embedded configuration data.
  9902  
  9903  type Tcl_Config = Tcl_Config1 /* tcl.h:2242:3 */
  9904  type mp_digit = uint32        /* tcl.h:2268:22 */
  9905  
  9906  //----------------------------------------------------------------------------
  9907  // Definitions needed for Tcl_ParseArgvObj routines.
  9908  // Based on tkArgv.c.
  9909  // Modifications from the original are copyright (c) Sam Bromley 2006
  9910  
  9911  type Tcl_ArgvInfo = struct {
  9912  	Ftype       int32
  9913  	_           [4]byte
  9914  	FkeyStr     uintptr
  9915  	FsrcPtr     uintptr
  9916  	FdstPtr     uintptr
  9917  	FhelpStr    uintptr
  9918  	FclientData ClientData
  9919  } /* tcl.h:2289:3 */
  9920  
  9921  type TclPlatStubs1 = struct {
  9922  	Fmagic int32
  9923  	_      [4]byte
  9924  	Fhooks uintptr
  9925  } /* tclDecls.h:1840:11 */
  9926  
  9927  type TclStubHooks = struct {
  9928  	FtclPlatStubs    uintptr
  9929  	FtclIntStubs     uintptr
  9930  	FtclIntPlatStubs uintptr
  9931  } /* tclDecls.h:1843:3 */
  9932  
  9933  type TclStubs1 = struct {
  9934  	Fmagic                                  int32
  9935  	_                                       [4]byte
  9936  	Fhooks                                  uintptr
  9937  	Ftcl_PkgProvideEx                       uintptr
  9938  	Ftcl_PkgRequireEx                       uintptr
  9939  	Ftcl_Panic                              uintptr
  9940  	Ftcl_Alloc                              uintptr
  9941  	Ftcl_Free                               uintptr
  9942  	Ftcl_Realloc                            uintptr
  9943  	Ftcl_DbCkalloc                          uintptr
  9944  	Ftcl_DbCkfree                           uintptr
  9945  	Ftcl_DbCkrealloc                        uintptr
  9946  	Ftcl_CreateFileHandler                  uintptr
  9947  	Ftcl_DeleteFileHandler                  uintptr
  9948  	Ftcl_SetTimer                           uintptr
  9949  	Ftcl_Sleep                              uintptr
  9950  	Ftcl_WaitForEvent                       uintptr
  9951  	Ftcl_AppendAllObjTypes                  uintptr
  9952  	Ftcl_AppendStringsToObj                 uintptr
  9953  	Ftcl_AppendToObj                        uintptr
  9954  	Ftcl_ConcatObj                          uintptr
  9955  	Ftcl_ConvertToType                      uintptr
  9956  	Ftcl_DbDecrRefCount                     uintptr
  9957  	Ftcl_DbIncrRefCount                     uintptr
  9958  	Ftcl_DbIsShared                         uintptr
  9959  	Ftcl_DbNewBooleanObj                    uintptr
  9960  	Ftcl_DbNewByteArrayObj                  uintptr
  9961  	Ftcl_DbNewDoubleObj                     uintptr
  9962  	Ftcl_DbNewListObj                       uintptr
  9963  	Ftcl_DbNewLongObj                       uintptr
  9964  	Ftcl_DbNewObj                           uintptr
  9965  	Ftcl_DbNewStringObj                     uintptr
  9966  	Ftcl_DuplicateObj                       uintptr
  9967  	FtclFreeObj                             uintptr
  9968  	Ftcl_GetBoolean                         uintptr
  9969  	Ftcl_GetBooleanFromObj                  uintptr
  9970  	Ftcl_GetByteArrayFromObj                uintptr
  9971  	Ftcl_GetDouble                          uintptr
  9972  	Ftcl_GetDoubleFromObj                   uintptr
  9973  	Ftcl_GetIndexFromObj                    uintptr
  9974  	Ftcl_GetInt                             uintptr
  9975  	Ftcl_GetIntFromObj                      uintptr
  9976  	Ftcl_GetLongFromObj                     uintptr
  9977  	Ftcl_GetObjType                         uintptr
  9978  	Ftcl_GetStringFromObj                   uintptr
  9979  	Ftcl_InvalidateStringRep                uintptr
  9980  	Ftcl_ListObjAppendList                  uintptr
  9981  	Ftcl_ListObjAppendElement               uintptr
  9982  	Ftcl_ListObjGetElements                 uintptr
  9983  	Ftcl_ListObjIndex                       uintptr
  9984  	Ftcl_ListObjLength                      uintptr
  9985  	Ftcl_ListObjReplace                     uintptr
  9986  	Ftcl_NewBooleanObj                      uintptr
  9987  	Ftcl_NewByteArrayObj                    uintptr
  9988  	Ftcl_NewDoubleObj                       uintptr
  9989  	Ftcl_NewIntObj                          uintptr
  9990  	Ftcl_NewListObj                         uintptr
  9991  	Ftcl_NewLongObj                         uintptr
  9992  	Ftcl_NewObj                             uintptr
  9993  	Ftcl_NewStringObj                       uintptr
  9994  	Ftcl_SetBooleanObj                      uintptr
  9995  	Ftcl_SetByteArrayLength                 uintptr
  9996  	Ftcl_SetByteArrayObj                    uintptr
  9997  	Ftcl_SetDoubleObj                       uintptr
  9998  	Ftcl_SetIntObj                          uintptr
  9999  	Ftcl_SetListObj                         uintptr
 10000  	Ftcl_SetLongObj                         uintptr
 10001  	Ftcl_SetObjLength                       uintptr
 10002  	Ftcl_SetStringObj                       uintptr
 10003  	Ftcl_AddErrorInfo                       uintptr
 10004  	Ftcl_AddObjErrorInfo                    uintptr
 10005  	Ftcl_AllowExceptions                    uintptr
 10006  	Ftcl_AppendElement                      uintptr
 10007  	Ftcl_AppendResult                       uintptr
 10008  	Ftcl_AsyncCreate                        uintptr
 10009  	Ftcl_AsyncDelete                        uintptr
 10010  	Ftcl_AsyncInvoke                        uintptr
 10011  	Ftcl_AsyncMark                          uintptr
 10012  	Ftcl_AsyncReady                         uintptr
 10013  	Ftcl_BackgroundError                    uintptr
 10014  	Ftcl_Backslash                          uintptr
 10015  	Ftcl_BadChannelOption                   uintptr
 10016  	Ftcl_CallWhenDeleted                    uintptr
 10017  	Ftcl_CancelIdleCall                     uintptr
 10018  	Ftcl_Close                              uintptr
 10019  	Ftcl_CommandComplete                    uintptr
 10020  	Ftcl_Concat                             uintptr
 10021  	Ftcl_ConvertElement                     uintptr
 10022  	Ftcl_ConvertCountedElement              uintptr
 10023  	Ftcl_CreateAlias                        uintptr
 10024  	Ftcl_CreateAliasObj                     uintptr
 10025  	Ftcl_CreateChannel                      uintptr
 10026  	Ftcl_CreateChannelHandler               uintptr
 10027  	Ftcl_CreateCloseHandler                 uintptr
 10028  	Ftcl_CreateCommand                      uintptr
 10029  	Ftcl_CreateEventSource                  uintptr
 10030  	Ftcl_CreateExitHandler                  uintptr
 10031  	Ftcl_CreateInterp                       uintptr
 10032  	Ftcl_CreateMathFunc                     uintptr
 10033  	Ftcl_CreateObjCommand                   uintptr
 10034  	Ftcl_CreateSlave                        uintptr
 10035  	Ftcl_CreateTimerHandler                 uintptr
 10036  	Ftcl_CreateTrace                        uintptr
 10037  	Ftcl_DeleteAssocData                    uintptr
 10038  	Ftcl_DeleteChannelHandler               uintptr
 10039  	Ftcl_DeleteCloseHandler                 uintptr
 10040  	Ftcl_DeleteCommand                      uintptr
 10041  	Ftcl_DeleteCommandFromToken             uintptr
 10042  	Ftcl_DeleteEvents                       uintptr
 10043  	Ftcl_DeleteEventSource                  uintptr
 10044  	Ftcl_DeleteExitHandler                  uintptr
 10045  	Ftcl_DeleteHashEntry                    uintptr
 10046  	Ftcl_DeleteHashTable                    uintptr
 10047  	Ftcl_DeleteInterp                       uintptr
 10048  	Ftcl_DetachPids                         uintptr
 10049  	Ftcl_DeleteTimerHandler                 uintptr
 10050  	Ftcl_DeleteTrace                        uintptr
 10051  	Ftcl_DontCallWhenDeleted                uintptr
 10052  	Ftcl_DoOneEvent                         uintptr
 10053  	Ftcl_DoWhenIdle                         uintptr
 10054  	Ftcl_DStringAppend                      uintptr
 10055  	Ftcl_DStringAppendElement               uintptr
 10056  	Ftcl_DStringEndSublist                  uintptr
 10057  	Ftcl_DStringFree                        uintptr
 10058  	Ftcl_DStringGetResult                   uintptr
 10059  	Ftcl_DStringInit                        uintptr
 10060  	Ftcl_DStringResult                      uintptr
 10061  	Ftcl_DStringSetLength                   uintptr
 10062  	Ftcl_DStringStartSublist                uintptr
 10063  	Ftcl_Eof                                uintptr
 10064  	Ftcl_ErrnoId                            uintptr
 10065  	Ftcl_ErrnoMsg                           uintptr
 10066  	Ftcl_Eval                               uintptr
 10067  	Ftcl_EvalFile                           uintptr
 10068  	Ftcl_EvalObj                            uintptr
 10069  	Ftcl_EventuallyFree                     uintptr
 10070  	Ftcl_Exit                               uintptr
 10071  	Ftcl_ExposeCommand                      uintptr
 10072  	Ftcl_ExprBoolean                        uintptr
 10073  	Ftcl_ExprBooleanObj                     uintptr
 10074  	Ftcl_ExprDouble                         uintptr
 10075  	Ftcl_ExprDoubleObj                      uintptr
 10076  	Ftcl_ExprLong                           uintptr
 10077  	Ftcl_ExprLongObj                        uintptr
 10078  	Ftcl_ExprObj                            uintptr
 10079  	Ftcl_ExprString                         uintptr
 10080  	Ftcl_Finalize                           uintptr
 10081  	Ftcl_FindExecutable                     uintptr
 10082  	Ftcl_FirstHashEntry                     uintptr
 10083  	Ftcl_Flush                              uintptr
 10084  	Ftcl_FreeResult                         uintptr
 10085  	Ftcl_GetAlias                           uintptr
 10086  	Ftcl_GetAliasObj                        uintptr
 10087  	Ftcl_GetAssocData                       uintptr
 10088  	Ftcl_GetChannel                         uintptr
 10089  	Ftcl_GetChannelBufferSize               uintptr
 10090  	Ftcl_GetChannelHandle                   uintptr
 10091  	Ftcl_GetChannelInstanceData             uintptr
 10092  	Ftcl_GetChannelMode                     uintptr
 10093  	Ftcl_GetChannelName                     uintptr
 10094  	Ftcl_GetChannelOption                   uintptr
 10095  	Ftcl_GetChannelType                     uintptr
 10096  	Ftcl_GetCommandInfo                     uintptr
 10097  	Ftcl_GetCommandName                     uintptr
 10098  	Ftcl_GetErrno                           uintptr
 10099  	Ftcl_GetHostName                        uintptr
 10100  	Ftcl_GetInterpPath                      uintptr
 10101  	Ftcl_GetMaster                          uintptr
 10102  	Ftcl_GetNameOfExecutable                uintptr
 10103  	Ftcl_GetObjResult                       uintptr
 10104  	Ftcl_GetOpenFile                        uintptr
 10105  	Ftcl_GetPathType                        uintptr
 10106  	Ftcl_Gets                               uintptr
 10107  	Ftcl_GetsObj                            uintptr
 10108  	Ftcl_GetServiceMode                     uintptr
 10109  	Ftcl_GetSlave                           uintptr
 10110  	Ftcl_GetStdChannel                      uintptr
 10111  	Ftcl_GetStringResult                    uintptr
 10112  	Ftcl_GetVar                             uintptr
 10113  	Ftcl_GetVar2                            uintptr
 10114  	Ftcl_GlobalEval                         uintptr
 10115  	Ftcl_GlobalEvalObj                      uintptr
 10116  	Ftcl_HideCommand                        uintptr
 10117  	Ftcl_Init                               uintptr
 10118  	Ftcl_InitHashTable                      uintptr
 10119  	Ftcl_InputBlocked                       uintptr
 10120  	Ftcl_InputBuffered                      uintptr
 10121  	Ftcl_InterpDeleted                      uintptr
 10122  	Ftcl_IsSafe                             uintptr
 10123  	Ftcl_JoinPath                           uintptr
 10124  	Ftcl_LinkVar                            uintptr
 10125  	Freserved188                            uintptr
 10126  	Ftcl_MakeFileChannel                    uintptr
 10127  	Ftcl_MakeSafe                           uintptr
 10128  	Ftcl_MakeTcpClientChannel               uintptr
 10129  	Ftcl_Merge                              uintptr
 10130  	Ftcl_NextHashEntry                      uintptr
 10131  	Ftcl_NotifyChannel                      uintptr
 10132  	Ftcl_ObjGetVar2                         uintptr
 10133  	Ftcl_ObjSetVar2                         uintptr
 10134  	Ftcl_OpenCommandChannel                 uintptr
 10135  	Ftcl_OpenFileChannel                    uintptr
 10136  	Ftcl_OpenTcpClient                      uintptr
 10137  	Ftcl_OpenTcpServer                      uintptr
 10138  	Ftcl_Preserve                           uintptr
 10139  	Ftcl_PrintDouble                        uintptr
 10140  	Ftcl_PutEnv                             uintptr
 10141  	Ftcl_PosixError                         uintptr
 10142  	Ftcl_QueueEvent                         uintptr
 10143  	Ftcl_Read                               uintptr
 10144  	Ftcl_ReapDetachedProcs                  uintptr
 10145  	Ftcl_RecordAndEval                      uintptr
 10146  	Ftcl_RecordAndEvalObj                   uintptr
 10147  	Ftcl_RegisterChannel                    uintptr
 10148  	Ftcl_RegisterObjType                    uintptr
 10149  	Ftcl_RegExpCompile                      uintptr
 10150  	Ftcl_RegExpExec                         uintptr
 10151  	Ftcl_RegExpMatch                        uintptr
 10152  	Ftcl_RegExpRange                        uintptr
 10153  	Ftcl_Release                            uintptr
 10154  	Ftcl_ResetResult                        uintptr
 10155  	Ftcl_ScanElement                        uintptr
 10156  	Ftcl_ScanCountedElement                 uintptr
 10157  	Ftcl_SeekOld                            uintptr
 10158  	Ftcl_ServiceAll                         uintptr
 10159  	Ftcl_ServiceEvent                       uintptr
 10160  	Ftcl_SetAssocData                       uintptr
 10161  	Ftcl_SetChannelBufferSize               uintptr
 10162  	Ftcl_SetChannelOption                   uintptr
 10163  	Ftcl_SetCommandInfo                     uintptr
 10164  	Ftcl_SetErrno                           uintptr
 10165  	Ftcl_SetErrorCode                       uintptr
 10166  	Ftcl_SetMaxBlockTime                    uintptr
 10167  	Ftcl_SetPanicProc                       uintptr
 10168  	Ftcl_SetRecursionLimit                  uintptr
 10169  	Ftcl_SetResult                          uintptr
 10170  	Ftcl_SetServiceMode                     uintptr
 10171  	Ftcl_SetObjErrorCode                    uintptr
 10172  	Ftcl_SetObjResult                       uintptr
 10173  	Ftcl_SetStdChannel                      uintptr
 10174  	Ftcl_SetVar                             uintptr
 10175  	Ftcl_SetVar2                            uintptr
 10176  	Ftcl_SignalId                           uintptr
 10177  	Ftcl_SignalMsg                          uintptr
 10178  	Ftcl_SourceRCFile                       uintptr
 10179  	Ftcl_SplitList                          uintptr
 10180  	Ftcl_SplitPath                          uintptr
 10181  	Ftcl_StaticPackage                      uintptr
 10182  	Ftcl_StringMatch                        uintptr
 10183  	Ftcl_TellOld                            uintptr
 10184  	Ftcl_TraceVar                           uintptr
 10185  	Ftcl_TraceVar2                          uintptr
 10186  	Ftcl_TranslateFileName                  uintptr
 10187  	Ftcl_Ungets                             uintptr
 10188  	Ftcl_UnlinkVar                          uintptr
 10189  	Ftcl_UnregisterChannel                  uintptr
 10190  	Ftcl_UnsetVar                           uintptr
 10191  	Ftcl_UnsetVar2                          uintptr
 10192  	Ftcl_UntraceVar                         uintptr
 10193  	Ftcl_UntraceVar2                        uintptr
 10194  	Ftcl_UpdateLinkedVar                    uintptr
 10195  	Ftcl_UpVar                              uintptr
 10196  	Ftcl_UpVar2                             uintptr
 10197  	Ftcl_VarEval                            uintptr
 10198  	Ftcl_VarTraceInfo                       uintptr
 10199  	Ftcl_VarTraceInfo2                      uintptr
 10200  	Ftcl_Write                              uintptr
 10201  	Ftcl_WrongNumArgs                       uintptr
 10202  	Ftcl_DumpActiveMemory                   uintptr
 10203  	Ftcl_ValidateAllMemory                  uintptr
 10204  	Ftcl_AppendResultVA                     uintptr
 10205  	Ftcl_AppendStringsToObjVA               uintptr
 10206  	Ftcl_HashStats                          uintptr
 10207  	Ftcl_ParseVar                           uintptr
 10208  	Ftcl_PkgPresent                         uintptr
 10209  	Ftcl_PkgPresentEx                       uintptr
 10210  	Ftcl_PkgProvide                         uintptr
 10211  	Ftcl_PkgRequire                         uintptr
 10212  	Ftcl_SetErrorCodeVA                     uintptr
 10213  	Ftcl_VarEvalVA                          uintptr
 10214  	Ftcl_WaitPid                            uintptr
 10215  	Ftcl_PanicVA                            uintptr
 10216  	Ftcl_GetVersion                         uintptr
 10217  	Ftcl_InitMemory                         uintptr
 10218  	Ftcl_StackChannel                       uintptr
 10219  	Ftcl_UnstackChannel                     uintptr
 10220  	Ftcl_GetStackedChannel                  uintptr
 10221  	Ftcl_SetMainLoop                        uintptr
 10222  	Freserved285                            uintptr
 10223  	Ftcl_AppendObjToObj                     uintptr
 10224  	Ftcl_CreateEncoding                     uintptr
 10225  	Ftcl_CreateThreadExitHandler            uintptr
 10226  	Ftcl_DeleteThreadExitHandler            uintptr
 10227  	Ftcl_DiscardResult                      uintptr
 10228  	Ftcl_EvalEx                             uintptr
 10229  	Ftcl_EvalObjv                           uintptr
 10230  	Ftcl_EvalObjEx                          uintptr
 10231  	Ftcl_ExitThread                         uintptr
 10232  	Ftcl_ExternalToUtf                      uintptr
 10233  	Ftcl_ExternalToUtfDString               uintptr
 10234  	Ftcl_FinalizeThread                     uintptr
 10235  	Ftcl_FinalizeNotifier                   uintptr
 10236  	Ftcl_FreeEncoding                       uintptr
 10237  	Ftcl_GetCurrentThread                   uintptr
 10238  	Ftcl_GetEncoding                        uintptr
 10239  	Ftcl_GetEncodingName                    uintptr
 10240  	Ftcl_GetEncodingNames                   uintptr
 10241  	Ftcl_GetIndexFromObjStruct              uintptr
 10242  	Ftcl_GetThreadData                      uintptr
 10243  	Ftcl_GetVar2Ex                          uintptr
 10244  	Ftcl_InitNotifier                       uintptr
 10245  	Ftcl_MutexLock                          uintptr
 10246  	Ftcl_MutexUnlock                        uintptr
 10247  	Ftcl_ConditionNotify                    uintptr
 10248  	Ftcl_ConditionWait                      uintptr
 10249  	Ftcl_NumUtfChars                        uintptr
 10250  	Ftcl_ReadChars                          uintptr
 10251  	Ftcl_RestoreResult                      uintptr
 10252  	Ftcl_SaveResult                         uintptr
 10253  	Ftcl_SetSystemEncoding                  uintptr
 10254  	Ftcl_SetVar2Ex                          uintptr
 10255  	Ftcl_ThreadAlert                        uintptr
 10256  	Ftcl_ThreadQueueEvent                   uintptr
 10257  	Ftcl_UniCharAtIndex                     uintptr
 10258  	Ftcl_UniCharToLower                     uintptr
 10259  	Ftcl_UniCharToTitle                     uintptr
 10260  	Ftcl_UniCharToUpper                     uintptr
 10261  	Ftcl_UniCharToUtf                       uintptr
 10262  	Ftcl_UtfAtIndex                         uintptr
 10263  	Ftcl_UtfCharComplete                    uintptr
 10264  	Ftcl_UtfBackslash                       uintptr
 10265  	Ftcl_UtfFindFirst                       uintptr
 10266  	Ftcl_UtfFindLast                        uintptr
 10267  	Ftcl_UtfNext                            uintptr
 10268  	Ftcl_UtfPrev                            uintptr
 10269  	Ftcl_UtfToExternal                      uintptr
 10270  	Ftcl_UtfToExternalDString               uintptr
 10271  	Ftcl_UtfToLower                         uintptr
 10272  	Ftcl_UtfToTitle                         uintptr
 10273  	Ftcl_UtfToUniChar                       uintptr
 10274  	Ftcl_UtfToUpper                         uintptr
 10275  	Ftcl_WriteChars                         uintptr
 10276  	Ftcl_WriteObj                           uintptr
 10277  	Ftcl_GetString                          uintptr
 10278  	Ftcl_GetDefaultEncodingDir              uintptr
 10279  	Ftcl_SetDefaultEncodingDir              uintptr
 10280  	Ftcl_AlertNotifier                      uintptr
 10281  	Ftcl_ServiceModeHook                    uintptr
 10282  	Ftcl_UniCharIsAlnum                     uintptr
 10283  	Ftcl_UniCharIsAlpha                     uintptr
 10284  	Ftcl_UniCharIsDigit                     uintptr
 10285  	Ftcl_UniCharIsLower                     uintptr
 10286  	Ftcl_UniCharIsSpace                     uintptr
 10287  	Ftcl_UniCharIsUpper                     uintptr
 10288  	Ftcl_UniCharIsWordChar                  uintptr
 10289  	Ftcl_UniCharLen                         uintptr
 10290  	Ftcl_UniCharNcmp                        uintptr
 10291  	Ftcl_UniCharToUtfDString                uintptr
 10292  	Ftcl_UtfToUniCharDString                uintptr
 10293  	Ftcl_GetRegExpFromObj                   uintptr
 10294  	Ftcl_EvalTokens                         uintptr
 10295  	Ftcl_FreeParse                          uintptr
 10296  	Ftcl_LogCommandInfo                     uintptr
 10297  	Ftcl_ParseBraces                        uintptr
 10298  	Ftcl_ParseCommand                       uintptr
 10299  	Ftcl_ParseExpr                          uintptr
 10300  	Ftcl_ParseQuotedString                  uintptr
 10301  	Ftcl_ParseVarName                       uintptr
 10302  	Ftcl_GetCwd                             uintptr
 10303  	Ftcl_Chdir                              uintptr
 10304  	Ftcl_Access                             uintptr
 10305  	Ftcl_Stat                               uintptr
 10306  	Ftcl_UtfNcmp                            uintptr
 10307  	Ftcl_UtfNcasecmp                        uintptr
 10308  	Ftcl_StringCaseMatch                    uintptr
 10309  	Ftcl_UniCharIsControl                   uintptr
 10310  	Ftcl_UniCharIsGraph                     uintptr
 10311  	Ftcl_UniCharIsPrint                     uintptr
 10312  	Ftcl_UniCharIsPunct                     uintptr
 10313  	Ftcl_RegExpExecObj                      uintptr
 10314  	Ftcl_RegExpGetInfo                      uintptr
 10315  	Ftcl_NewUnicodeObj                      uintptr
 10316  	Ftcl_SetUnicodeObj                      uintptr
 10317  	Ftcl_GetCharLength                      uintptr
 10318  	Ftcl_GetUniChar                         uintptr
 10319  	Ftcl_GetUnicode                         uintptr
 10320  	Ftcl_GetRange                           uintptr
 10321  	Ftcl_AppendUnicodeToObj                 uintptr
 10322  	Ftcl_RegExpMatchObj                     uintptr
 10323  	Ftcl_SetNotifier                        uintptr
 10324  	Ftcl_GetAllocMutex                      uintptr
 10325  	Ftcl_GetChannelNames                    uintptr
 10326  	Ftcl_GetChannelNamesEx                  uintptr
 10327  	Ftcl_ProcObjCmd                         uintptr
 10328  	Ftcl_ConditionFinalize                  uintptr
 10329  	Ftcl_MutexFinalize                      uintptr
 10330  	Ftcl_CreateThread                       uintptr
 10331  	Ftcl_ReadRaw                            uintptr
 10332  	Ftcl_WriteRaw                           uintptr
 10333  	Ftcl_GetTopChannel                      uintptr
 10334  	Ftcl_ChannelBuffered                    uintptr
 10335  	Ftcl_ChannelName                        uintptr
 10336  	Ftcl_ChannelVersion                     uintptr
 10337  	Ftcl_ChannelBlockModeProc               uintptr
 10338  	Ftcl_ChannelCloseProc                   uintptr
 10339  	Ftcl_ChannelClose2Proc                  uintptr
 10340  	Ftcl_ChannelInputProc                   uintptr
 10341  	Ftcl_ChannelOutputProc                  uintptr
 10342  	Ftcl_ChannelSeekProc                    uintptr
 10343  	Ftcl_ChannelSetOptionProc               uintptr
 10344  	Ftcl_ChannelGetOptionProc               uintptr
 10345  	Ftcl_ChannelWatchProc                   uintptr
 10346  	Ftcl_ChannelGetHandleProc               uintptr
 10347  	Ftcl_ChannelFlushProc                   uintptr
 10348  	Ftcl_ChannelHandlerProc                 uintptr
 10349  	Ftcl_JoinThread                         uintptr
 10350  	Ftcl_IsChannelShared                    uintptr
 10351  	Ftcl_IsChannelRegistered                uintptr
 10352  	Ftcl_CutChannel                         uintptr
 10353  	Ftcl_SpliceChannel                      uintptr
 10354  	Ftcl_ClearChannelHandlers               uintptr
 10355  	Ftcl_IsChannelExisting                  uintptr
 10356  	Ftcl_UniCharNcasecmp                    uintptr
 10357  	Ftcl_UniCharCaseMatch                   uintptr
 10358  	Ftcl_FindHashEntry                      uintptr
 10359  	Ftcl_CreateHashEntry                    uintptr
 10360  	Ftcl_InitCustomHashTable                uintptr
 10361  	Ftcl_InitObjHashTable                   uintptr
 10362  	Ftcl_CommandTraceInfo                   uintptr
 10363  	Ftcl_TraceCommand                       uintptr
 10364  	Ftcl_UntraceCommand                     uintptr
 10365  	Ftcl_AttemptAlloc                       uintptr
 10366  	Ftcl_AttemptDbCkalloc                   uintptr
 10367  	Ftcl_AttemptRealloc                     uintptr
 10368  	Ftcl_AttemptDbCkrealloc                 uintptr
 10369  	Ftcl_AttemptSetObjLength                uintptr
 10370  	Ftcl_GetChannelThread                   uintptr
 10371  	Ftcl_GetUnicodeFromObj                  uintptr
 10372  	Ftcl_GetMathFuncInfo                    uintptr
 10373  	Ftcl_ListMathFuncs                      uintptr
 10374  	Ftcl_SubstObj                           uintptr
 10375  	Ftcl_DetachChannel                      uintptr
 10376  	Ftcl_IsStandardChannel                  uintptr
 10377  	Ftcl_FSCopyFile                         uintptr
 10378  	Ftcl_FSCopyDirectory                    uintptr
 10379  	Ftcl_FSCreateDirectory                  uintptr
 10380  	Ftcl_FSDeleteFile                       uintptr
 10381  	Ftcl_FSLoadFile                         uintptr
 10382  	Ftcl_FSMatchInDirectory                 uintptr
 10383  	Ftcl_FSLink                             uintptr
 10384  	Ftcl_FSRemoveDirectory                  uintptr
 10385  	Ftcl_FSRenameFile                       uintptr
 10386  	Ftcl_FSLstat                            uintptr
 10387  	Ftcl_FSUtime                            uintptr
 10388  	Ftcl_FSFileAttrsGet                     uintptr
 10389  	Ftcl_FSFileAttrsSet                     uintptr
 10390  	Ftcl_FSFileAttrStrings                  uintptr
 10391  	Ftcl_FSStat                             uintptr
 10392  	Ftcl_FSAccess                           uintptr
 10393  	Ftcl_FSOpenFileChannel                  uintptr
 10394  	Ftcl_FSGetCwd                           uintptr
 10395  	Ftcl_FSChdir                            uintptr
 10396  	Ftcl_FSConvertToPathType                uintptr
 10397  	Ftcl_FSJoinPath                         uintptr
 10398  	Ftcl_FSSplitPath                        uintptr
 10399  	Ftcl_FSEqualPaths                       uintptr
 10400  	Ftcl_FSGetNormalizedPath                uintptr
 10401  	Ftcl_FSJoinToPath                       uintptr
 10402  	Ftcl_FSGetInternalRep                   uintptr
 10403  	Ftcl_FSGetTranslatedPath                uintptr
 10404  	Ftcl_FSEvalFile                         uintptr
 10405  	Ftcl_FSNewNativePath                    uintptr
 10406  	Ftcl_FSGetNativePath                    uintptr
 10407  	Ftcl_FSFileSystemInfo                   uintptr
 10408  	Ftcl_FSPathSeparator                    uintptr
 10409  	Ftcl_FSListVolumes                      uintptr
 10410  	Ftcl_FSRegister                         uintptr
 10411  	Ftcl_FSUnregister                       uintptr
 10412  	Ftcl_FSData                             uintptr
 10413  	Ftcl_FSGetTranslatedStringPath          uintptr
 10414  	Ftcl_FSGetFileSystemForPath             uintptr
 10415  	Ftcl_FSGetPathType                      uintptr
 10416  	Ftcl_OutputBuffered                     uintptr
 10417  	Ftcl_FSMountsChanged                    uintptr
 10418  	Ftcl_EvalTokensStandard                 uintptr
 10419  	Ftcl_GetTime                            uintptr
 10420  	Ftcl_CreateObjTrace                     uintptr
 10421  	Ftcl_GetCommandInfoFromToken            uintptr
 10422  	Ftcl_SetCommandInfoFromToken            uintptr
 10423  	Ftcl_DbNewWideIntObj                    uintptr
 10424  	Ftcl_GetWideIntFromObj                  uintptr
 10425  	Ftcl_NewWideIntObj                      uintptr
 10426  	Ftcl_SetWideIntObj                      uintptr
 10427  	Ftcl_AllocStatBuf                       uintptr
 10428  	Ftcl_Seek                               uintptr
 10429  	Ftcl_Tell                               uintptr
 10430  	Ftcl_ChannelWideSeekProc                uintptr
 10431  	Ftcl_DictObjPut                         uintptr
 10432  	Ftcl_DictObjGet                         uintptr
 10433  	Ftcl_DictObjRemove                      uintptr
 10434  	Ftcl_DictObjSize                        uintptr
 10435  	Ftcl_DictObjFirst                       uintptr
 10436  	Ftcl_DictObjNext                        uintptr
 10437  	Ftcl_DictObjDone                        uintptr
 10438  	Ftcl_DictObjPutKeyList                  uintptr
 10439  	Ftcl_DictObjRemoveKeyList               uintptr
 10440  	Ftcl_NewDictObj                         uintptr
 10441  	Ftcl_DbNewDictObj                       uintptr
 10442  	Ftcl_RegisterConfig                     uintptr
 10443  	Ftcl_CreateNamespace                    uintptr
 10444  	Ftcl_DeleteNamespace                    uintptr
 10445  	Ftcl_AppendExportList                   uintptr
 10446  	Ftcl_Export                             uintptr
 10447  	Ftcl_Import                             uintptr
 10448  	Ftcl_ForgetImport                       uintptr
 10449  	Ftcl_GetCurrentNamespace                uintptr
 10450  	Ftcl_GetGlobalNamespace                 uintptr
 10451  	Ftcl_FindNamespace                      uintptr
 10452  	Ftcl_FindCommand                        uintptr
 10453  	Ftcl_GetCommandFromObj                  uintptr
 10454  	Ftcl_GetCommandFullName                 uintptr
 10455  	Ftcl_FSEvalFileEx                       uintptr
 10456  	Ftcl_SetExitProc                        uintptr
 10457  	Ftcl_LimitAddHandler                    uintptr
 10458  	Ftcl_LimitRemoveHandler                 uintptr
 10459  	Ftcl_LimitReady                         uintptr
 10460  	Ftcl_LimitCheck                         uintptr
 10461  	Ftcl_LimitExceeded                      uintptr
 10462  	Ftcl_LimitSetCommands                   uintptr
 10463  	Ftcl_LimitSetTime                       uintptr
 10464  	Ftcl_LimitSetGranularity                uintptr
 10465  	Ftcl_LimitTypeEnabled                   uintptr
 10466  	Ftcl_LimitTypeExceeded                  uintptr
 10467  	Ftcl_LimitTypeSet                       uintptr
 10468  	Ftcl_LimitTypeReset                     uintptr
 10469  	Ftcl_LimitGetCommands                   uintptr
 10470  	Ftcl_LimitGetTime                       uintptr
 10471  	Ftcl_LimitGetGranularity                uintptr
 10472  	Ftcl_SaveInterpState                    uintptr
 10473  	Ftcl_RestoreInterpState                 uintptr
 10474  	Ftcl_DiscardInterpState                 uintptr
 10475  	Ftcl_SetReturnOptions                   uintptr
 10476  	Ftcl_GetReturnOptions                   uintptr
 10477  	Ftcl_IsEnsemble                         uintptr
 10478  	Ftcl_CreateEnsemble                     uintptr
 10479  	Ftcl_FindEnsemble                       uintptr
 10480  	Ftcl_SetEnsembleSubcommandList          uintptr
 10481  	Ftcl_SetEnsembleMappingDict             uintptr
 10482  	Ftcl_SetEnsembleUnknownHandler          uintptr
 10483  	Ftcl_SetEnsembleFlags                   uintptr
 10484  	Ftcl_GetEnsembleSubcommandList          uintptr
 10485  	Ftcl_GetEnsembleMappingDict             uintptr
 10486  	Ftcl_GetEnsembleUnknownHandler          uintptr
 10487  	Ftcl_GetEnsembleFlags                   uintptr
 10488  	Ftcl_GetEnsembleNamespace               uintptr
 10489  	Ftcl_SetTimeProc                        uintptr
 10490  	Ftcl_QueryTimeProc                      uintptr
 10491  	Ftcl_ChannelThreadActionProc            uintptr
 10492  	Ftcl_NewBignumObj                       uintptr
 10493  	Ftcl_DbNewBignumObj                     uintptr
 10494  	Ftcl_SetBignumObj                       uintptr
 10495  	Ftcl_GetBignumFromObj                   uintptr
 10496  	Ftcl_TakeBignumFromObj                  uintptr
 10497  	Ftcl_TruncateChannel                    uintptr
 10498  	Ftcl_ChannelTruncateProc                uintptr
 10499  	Ftcl_SetChannelErrorInterp              uintptr
 10500  	Ftcl_GetChannelErrorInterp              uintptr
 10501  	Ftcl_SetChannelError                    uintptr
 10502  	Ftcl_GetChannelError                    uintptr
 10503  	Ftcl_InitBignumFromDouble               uintptr
 10504  	Ftcl_GetNamespaceUnknownHandler         uintptr
 10505  	Ftcl_SetNamespaceUnknownHandler         uintptr
 10506  	Ftcl_GetEncodingFromObj                 uintptr
 10507  	Ftcl_GetEncodingSearchPath              uintptr
 10508  	Ftcl_SetEncodingSearchPath              uintptr
 10509  	Ftcl_GetEncodingNameFromEnvironment     uintptr
 10510  	Ftcl_PkgRequireProc                     uintptr
 10511  	Ftcl_AppendObjToErrorInfo               uintptr
 10512  	Ftcl_AppendLimitedToObj                 uintptr
 10513  	Ftcl_Format                             uintptr
 10514  	Ftcl_AppendFormatToObj                  uintptr
 10515  	Ftcl_ObjPrintf                          uintptr
 10516  	Ftcl_AppendPrintfToObj                  uintptr
 10517  	Ftcl_CancelEval                         uintptr
 10518  	Ftcl_Canceled                           uintptr
 10519  	Ftcl_CreatePipe                         uintptr
 10520  	Ftcl_NRCreateCommand                    uintptr
 10521  	Ftcl_NREvalObj                          uintptr
 10522  	Ftcl_NREvalObjv                         uintptr
 10523  	Ftcl_NRCmdSwap                          uintptr
 10524  	Ftcl_NRAddCallback                      uintptr
 10525  	Ftcl_NRCallObjProc                      uintptr
 10526  	Ftcl_GetFSDeviceFromStat                uintptr
 10527  	Ftcl_GetFSInodeFromStat                 uintptr
 10528  	Ftcl_GetModeFromStat                    uintptr
 10529  	Ftcl_GetLinkCountFromStat               uintptr
 10530  	Ftcl_GetUserIdFromStat                  uintptr
 10531  	Ftcl_GetGroupIdFromStat                 uintptr
 10532  	Ftcl_GetDeviceTypeFromStat              uintptr
 10533  	Ftcl_GetAccessTimeFromStat              uintptr
 10534  	Ftcl_GetModificationTimeFromStat        uintptr
 10535  	Ftcl_GetChangeTimeFromStat              uintptr
 10536  	Ftcl_GetSizeFromStat                    uintptr
 10537  	Ftcl_GetBlocksFromStat                  uintptr
 10538  	Ftcl_GetBlockSizeFromStat               uintptr
 10539  	Ftcl_SetEnsembleParameterList           uintptr
 10540  	Ftcl_GetEnsembleParameterList           uintptr
 10541  	Ftcl_ParseArgsObjv                      uintptr
 10542  	Ftcl_GetErrorLine                       uintptr
 10543  	Ftcl_SetErrorLine                       uintptr
 10544  	Ftcl_TransferResult                     uintptr
 10545  	Ftcl_InterpActive                       uintptr
 10546  	Ftcl_BackgroundException                uintptr
 10547  	Ftcl_ZlibDeflate                        uintptr
 10548  	Ftcl_ZlibInflate                        uintptr
 10549  	Ftcl_ZlibCRC32                          uintptr
 10550  	Ftcl_ZlibAdler32                        uintptr
 10551  	Ftcl_ZlibStreamInit                     uintptr
 10552  	Ftcl_ZlibStreamGetCommandName           uintptr
 10553  	Ftcl_ZlibStreamEof                      uintptr
 10554  	Ftcl_ZlibStreamChecksum                 uintptr
 10555  	Ftcl_ZlibStreamPut                      uintptr
 10556  	Ftcl_ZlibStreamGet                      uintptr
 10557  	Ftcl_ZlibStreamClose                    uintptr
 10558  	Ftcl_ZlibStreamReset                    uintptr
 10559  	Ftcl_SetStartupScript                   uintptr
 10560  	Ftcl_GetStartupScript                   uintptr
 10561  	Ftcl_CloseEx                            uintptr
 10562  	Ftcl_NRExprObj                          uintptr
 10563  	Ftcl_NRSubstObj                         uintptr
 10564  	Ftcl_LoadFile                           uintptr
 10565  	Ftcl_FindSymbol                         uintptr
 10566  	Ftcl_FSUnloadFile                       uintptr
 10567  	Ftcl_ZlibStreamSetCompressionDictionary uintptr
 10568  	Freserved631                            uintptr
 10569  	Freserved632                            uintptr
 10570  	Freserved633                            uintptr
 10571  	Freserved634                            uintptr
 10572  	Freserved635                            uintptr
 10573  	Freserved636                            uintptr
 10574  	Freserved637                            uintptr
 10575  	Freserved638                            uintptr
 10576  	Freserved639                            uintptr
 10577  	Freserved640                            uintptr
 10578  	Freserved641                            uintptr
 10579  	Freserved642                            uintptr
 10580  	Freserved643                            uintptr
 10581  	Freserved644                            uintptr
 10582  	Freserved645                            uintptr
 10583  	Freserved646                            uintptr
 10584  	Freserved647                            uintptr
 10585  	FtclUnusedStubEntry                     uintptr
 10586  } /* tclDecls.h:1845:9 */
 10587  
 10588  type TclStubs = TclStubs1 /* tclDecls.h:2522:3 */
 10589  
 10590  // !END!: Do not edit above this line.
 10591  
 10592  // Deprecated Tcl procedures:
 10593  
 10594  // Include platform specific public function declarations that are accessible
 10595  // via the stubs table. Make all TclOO symbols MODULE_SCOPE (which only
 10596  // has effect on building it as a shared library). See ticket [3010352].
 10597  
 10598  // tclPlatDecls.h --
 10599  //
 10600  //	Declarations of platform specific Tcl APIs.
 10601  //
 10602  // Copyright (c) 1998-1999 by Scriptics Corporation.
 10603  // All rights reserved.
 10604  
 10605  // WARNING: This file is automatically generated by the tools/genStubs.tcl
 10606  // script.  Any modifications to the function declarations below should be made
 10607  // in the generic/tcl.decls script.
 10608  
 10609  // TCHAR is needed here for win32, so if it is not defined yet do it here.
 10610  // This way, we don't need to include <tchar.h> just for one define.
 10611  
 10612  // !BEGIN!: Do not edit below this line.
 10613  
 10614  // Exported function declarations:
 10615  
 10616  type TclPlatStubs = TclPlatStubs1 /* tclPlatDecls.h:86:3 */
 10617  
 10618  // end block for C++
 10619  
 10620  // Local Variables:
 10621  // mode: c
 10622  // c-basic-offset: 4
 10623  // fill-column: 78
 10624  // End:
 10625  
 10626  // Extract an sqlite3* db handle from the object passed as the second
 10627  // argument. If successful, set *pDb to point to the db handle and return
 10628  // TCL_OK. Otherwise, return TCL_ERROR.
 10629  func dbHandleFromObj(tls *libc.TLS, interp uintptr, pObj uintptr, pDb uintptr) int32 { /* test_expert.c:36:12: */
 10630  	bp := tls.Alloc(88)
 10631  	defer tls.Free(88)
 10632  
 10633  	// var info Tcl_CmdInfo at bp+24, 64
 10634  
 10635  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, pObj), bp+24 /* &info */) {
 10636  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, pObj), 0))
 10637  		return TCL_ERROR
 10638  	}
 10639  
 10640  	*(*uintptr)(unsafe.Pointer(pDb)) = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 10641  	return TCL_OK
 10642  }
 10643  
 10644  // Tclcmd:  $expert sql SQL
 10645  //          $expert analyze
 10646  //          $expert count
 10647  //          $expert report STMT EREPORT
 10648  //          $expert destroy
 10649  func testExpertCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_expert.c:55:26: */
 10650  	bp := tls.Alloc(212)
 10651  	defer tls.Free(212)
 10652  
 10653  	var pExpert uintptr = clientData
 10654  	*(*[6]Subcmd)(unsafe.Pointer(bp /* aSub */)) = [6]Subcmd{
 10655  		{FzSub: ts + 1808 /* "sql" */, FnArg: 1, FzMsg: ts + 1812 /* "TABLE" */},           // 0
 10656  		{FzSub: ts + 1818 /* "analyze" */, FzMsg: ts + 489 /* "" */},                       // 1
 10657  		{FzSub: ts + 1826 /* "count" */, FzMsg: ts + 489 /* "" */},                         // 2
 10658  		{FzSub: ts + 1832 /* "report" */, FnArg: 2, FzMsg: ts + 1839 /* "STMT EREPORT" */}, // 3
 10659  		{FzSub: ts + 1852 /* "destroy" */, FzMsg: ts + 489 /* "" */},                       // 4
 10660  		{},
 10661  	}
 10662  	// var iSub int32 at bp+144, 4
 10663  
 10664  	var rc int32 = TCL_OK
 10665  	*(*uintptr)(unsafe.Pointer(bp + 152 /* zErr */)) = uintptr(0)
 10666  
 10667  	if objc < 2 {
 10668  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 10669  		return TCL_ERROR
 10670  	}
 10671  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 10672  		*(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &aSub[0] */, int32(unsafe.Sizeof(Subcmd{})), ts+1875 /* "sub-command" */, 0, bp+144 /* &iSub */)
 10673  	if rc != TCL_OK {
 10674  		return rc
 10675  	}
 10676  	if objc != (2 + (*Subcmd)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 144 /* iSub */)))*24)).FnArg) {
 10677  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*Subcmd)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 144 /* iSub */)))*24)).FzMsg)
 10678  		return TCL_ERROR
 10679  	}
 10680  
 10681  	switch *(*int32)(unsafe.Pointer(bp + 144 /* iSub */)) {
 10682  	case 0:
 10683  		{ // sql
 10684  			var zArg uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 10685  			rc = sqlite3_expert_sql(tls, pExpert, zArg, bp+152 /* &zErr */)
 10686  			break
 10687  
 10688  		}
 10689  
 10690  	case 1:
 10691  		{ // analyze
 10692  			rc = sqlite3_expert_analyze(tls, pExpert, bp+152 /* &zErr */)
 10693  			break
 10694  
 10695  		}
 10696  
 10697  	case 2:
 10698  		{ // count
 10699  			var n int32 = sqlite3_expert_count(tls, pExpert)
 10700  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, n))
 10701  			break
 10702  
 10703  		}
 10704  
 10705  	case 3:
 10706  		{ // report
 10707  			*(*[5]uintptr)(unsafe.Pointer(bp + 168 /* aEnum */)) = [5]uintptr{
 10708  				ts + 1808 /* "sql" */, ts + 1887 /* "indexes" */, ts + 1895 /* "plan" */, ts + 1900 /* "candidates" */, uintptr(0),
 10709  			}
 10710  			// var iEnum int32 at bp+208, 4
 10711  
 10712  			// var iStmt int32 at bp+160, 4
 10713  
 10714  			var zReport uintptr
 10715  
 10716  			if (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+160 /* &iStmt */) != 0) ||
 10717  				(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+168 /* &aEnum[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+1832 /* "report" */, 0, bp+208 /* &iEnum */) != 0) {
 10718  				return TCL_ERROR
 10719  			}
 10720  
 10721  			zReport = sqlite3_expert_report(tls, pExpert, *(*int32)(unsafe.Pointer(bp + 160 /* iStmt */)), (1 + *(*int32)(unsafe.Pointer(bp + 208 /* iEnum */))))
 10722  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zReport, -1))
 10723  			break
 10724  
 10725  		}
 10726  
 10727  	default: // destroy
 10728  
 10729  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 10730  		break
 10731  	}
 10732  
 10733  	if rc != TCL_OK {
 10734  		if *(*uintptr)(unsafe.Pointer(bp + 152 /* zErr */)) != 0 {
 10735  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* zErr */)), -1))
 10736  		} else {
 10737  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 10738  		}
 10739  	}
 10740  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 152 /* zErr */)))
 10741  	return rc
 10742  }
 10743  
 10744  type Subcmd = struct {
 10745  	FzSub uintptr
 10746  	FnArg int32
 10747  	_     [4]byte
 10748  	FzMsg uintptr
 10749  } /* test_expert.c:62:3 */
 10750  
 10751  func testExpertDel(tls *libc.TLS, clientData uintptr) { /* test_expert.c:150:27: */
 10752  	var pExpert uintptr = clientData
 10753  	sqlite3_expert_destroy(tls, pExpert)
 10754  }
 10755  
 10756  // sqlite3_expert_new DB
 10757  func test_sqlite3_expert_new(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_expert.c:158:26: */
 10758  	bp := tls.Alloc(56)
 10759  	defer tls.Free(56)
 10760  
 10761  	// var db uintptr at bp+40, 8
 10762  
 10763  	var zCmd uintptr = uintptr(0)
 10764  	*(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)) = uintptr(0)
 10765  	var pExpert uintptr
 10766  	var rc int32 = TCL_OK
 10767  
 10768  	if objc != 2 {
 10769  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 10770  		return TCL_ERROR
 10771  	}
 10772  	if dbHandleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+40 /* &db */) != 0 {
 10773  		return TCL_ERROR
 10774  	}
 10775  
 10776  	zCmd = sqlite3.Xsqlite3_mprintf(tls, ts+1914 /* "sqlite3expert%d" */, libc.VaList(bp, libc.PreIncInt32(&iCmd, 1)))
 10777  	if zCmd == uintptr(0) {
 10778  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, ts+1930 /* "out of memory" */, uintptr(0)))
 10779  		return TCL_ERROR
 10780  	}
 10781  
 10782  	pExpert = sqlite3_expert_new(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), bp+48 /* &zErr */)
 10783  	if pExpert == uintptr(0) {
 10784  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)), uintptr(0)))
 10785  		rc = TCL_ERROR
 10786  	} else {
 10787  		var p uintptr = pExpert
 10788  		tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 10789  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 10790  		}{testExpertCmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testExpertDel})))
 10791  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zCmd, -1))
 10792  	}
 10793  
 10794  	sqlite3.Xsqlite3_free(tls, zCmd)
 10795  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zErr */)))
 10796  	return rc
 10797  }
 10798  
 10799  var iCmd int32 = 0 /* test_expert.c:164:14 */
 10800  
 10801  func TestExpert_Init(tls *libc.TLS, interp uintptr) int32 { /* test_expert.c:202:5: */
 10802  	bp := tls.Alloc(16)
 10803  	defer tls.Free(16)
 10804  
 10805  	*(*[1]struct {
 10806  		FzCmd  uintptr
 10807  		FxProc uintptr
 10808  	})(unsafe.Pointer(bp /* aCmd */)) = [1]struct {
 10809  		FzCmd  uintptr
 10810  		FxProc uintptr
 10811  	}{
 10812  		{FzCmd: ts + 1944 /* "sqlite3_expert_n..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 10813  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 10814  		}{test_sqlite3_expert_new}))},
 10815  	}
 10816  	var i int32
 10817  
 10818  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof([1]struct {
 10819  		FzCmd  uintptr
 10820  		FxProc uintptr
 10821  	}{})) / uint64(unsafe.Sizeof(struct {
 10822  		FzCmd  uintptr
 10823  		FxProc uintptr
 10824  	}{}))); i++ {
 10825  		var p uintptr = (bp /* &aCmd */ + uintptr(i)*16)
 10826  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 10827  			FzCmd  uintptr
 10828  			FxProc uintptr
 10829  		})(unsafe.Pointer(p)).FzCmd, (*struct {
 10830  			FzCmd  uintptr
 10831  			FxProc uintptr
 10832  		})(unsafe.Pointer(p)).FxProc, uintptr(0), uintptr(0))
 10833  	}
 10834  	return TCL_OK
 10835  }
 10836  
 10837  // 2011 Jan 27
 10838  //
 10839  // The author disclaims copyright to this source code.  In place of
 10840  // a legal notice, here is a blessing:
 10841  //
 10842  //    May you do good and not evil.
 10843  //    May you find forgiveness for yourself and forgive others.
 10844  //    May you share freely, never taking more than you give.
 10845  //
 10846  //
 10847  //
 10848  // This file is not part of the production FTS code. It is only used for
 10849  // testing. It contains a virtual table implementation that provides direct
 10850  // access to the full-text index of an FTS table.
 10851  
 10852  // 2009 Nov 12
 10853  //
 10854  // The author disclaims copyright to this source code.  In place of
 10855  // a legal notice, here is a blessing:
 10856  //
 10857  //    May you do good and not evil.
 10858  //    May you find forgiveness for yourself and forgive others.
 10859  //    May you share freely, never taking more than you give.
 10860  //
 10861  //
 10862  //
 10863  
 10864  // FTS3/FTS4 require virtual tables
 10865  
 10866  // FTS4 is really an extension for FTS3.  It is enabled using the
 10867  // SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also all
 10868  // the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
 10869  
 10870  // Decode a pointer to an sqlite3 object.
 10871  func f5tDbPointer(tls *libc.TLS, interp uintptr, pObj uintptr, ppDb uintptr) int32 { /* fts5_tcl.c:54:12: */
 10872  	bp := tls.Alloc(64)
 10873  	defer tls.Free(64)
 10874  
 10875  	var p uintptr
 10876  	// var cmdInfo Tcl_CmdInfo at bp, 64
 10877  
 10878  	var z uintptr = tcl.XTcl_GetString(tls, pObj)
 10879  	if tcl.XTcl_GetCommandInfo(tls, interp, z, bp /* &cmdInfo */) != 0 {
 10880  		p = (*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData
 10881  		*(*uintptr)(unsafe.Pointer(ppDb)) = (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb
 10882  		return TCL_OK
 10883  	}
 10884  	return TCL_ERROR
 10885  }
 10886  
 10887  // End of code that accesses the SqliteDb struct.
 10888  //
 10889  
 10890  func f5tResultToErrorCode(tls *libc.TLS, zRes uintptr) int32 { /* fts5_tcl.c:69:12: */
 10891  	bp := tls.Alloc(64)
 10892  	defer tls.Free(64)
 10893  
 10894  	*(*[4]ErrorCode)(unsafe.Pointer(bp /* aErr */)) = [4]ErrorCode{
 10895  		{Frc: SQLITE_DONE, FzError: ts + 1963 /* "SQLITE_DONE" */},
 10896  		{Frc: SQLITE_ERROR, FzError: ts + 1975 /* "SQLITE_ERROR" */},
 10897  		{FzError: ts + 1988 /* "SQLITE_OK" */},
 10898  		{FzError: ts + 489 /* "" */},
 10899  	}
 10900  	var i int32
 10901  
 10902  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof([4]ErrorCode{})) / uint64(unsafe.Sizeof(ErrorCode{}))); i++ {
 10903  		if 0 == sqlite3.Xsqlite3_stricmp(tls, zRes, (*ErrorCode)(unsafe.Pointer(bp /* &aErr */ +uintptr(i)*16)).FzError) {
 10904  			return (*ErrorCode)(unsafe.Pointer(bp /* &aErr */ + uintptr(i)*16)).Frc
 10905  		}
 10906  	}
 10907  
 10908  	return SQLITE_ERROR
 10909  }
 10910  
 10911  type ErrorCode = struct {
 10912  	Frc     int32
 10913  	_       [4]byte
 10914  	FzError uintptr
 10915  } /* fts5_tcl.c:70:3 */
 10916  
 10917  func f5tDbAndApi(tls *libc.TLS, interp uintptr, pObj uintptr, ppDb uintptr, ppApi uintptr) int32 { /* fts5_tcl.c:90:26: */
 10918  	bp := tls.Alloc(72)
 10919  	defer tls.Free(72)
 10920  
 10921  	*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)) = uintptr(0)
 10922  	var rc int32 = f5tDbPointer(tls, interp, pObj, bp+48 /* &db */)
 10923  	if rc != TCL_OK {
 10924  		return TCL_ERROR
 10925  	} else {
 10926  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0)
 10927  		*(*uintptr)(unsafe.Pointer(bp + 64 /* pApi */)) = uintptr(0)
 10928  
 10929  		rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+1998 /* "SELECT fts5(?1)" */, -1, bp+56 /* &pStmt */, uintptr(0))
 10930  		if rc != SQLITE_OK {
 10931  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))), 0))
 10932  			return TCL_ERROR
 10933  		}
 10934  		sqlite3.Xsqlite3_bind_pointer(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), 1, bp+64 /* &pApi */, ts+2022 /* "fts5_api_ptr" */, uintptr(0))
 10935  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 10936  
 10937  		if sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != SQLITE_OK {
 10938  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))), 0))
 10939  			return TCL_ERROR
 10940  		}
 10941  
 10942  		*(*uintptr)(unsafe.Pointer(ppDb)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))
 10943  		*(*uintptr)(unsafe.Pointer(ppApi)) = *(*uintptr)(unsafe.Pointer(bp + 64 /* pApi */))
 10944  	}
 10945  
 10946  	return TCL_OK
 10947  }
 10948  
 10949  type F5tFunction1 = struct {
 10950  	Finterp  uintptr
 10951  	FpScript uintptr
 10952  } /* fts5_tcl.c:124:9 */
 10953  
 10954  type F5tFunction = F5tFunction1 /* fts5_tcl.c:124:28 */
 10955  
 10956  type F5tApi1 = struct {
 10957  	FpApi uintptr
 10958  	FpFts uintptr
 10959  } /* fts5_tcl.c:130:9 */
 10960  
 10961  type F5tApi = F5tApi1 /* fts5_tcl.c:130:23 */
 10962  
 10963  // An object of this type is used with the xSetAuxdata() and xGetAuxdata()
 10964  // API test wrappers. The tcl interface allows a single tcl value to be
 10965  // saved using xSetAuxdata(). Instead of simply storing a pointer to the
 10966  // tcl object, the code in this file wraps it in an sqlite3_malloc'd
 10967  // instance of the following struct so that if the destructor is not
 10968  // correctly invoked it will be reported as an SQLite memory leak.
 10969  type F5tAuxData1 = struct{ FpObj uintptr } /* fts5_tcl.c:144:9 */
 10970  
 10971  // An object of this type is used with the xSetAuxdata() and xGetAuxdata()
 10972  // API test wrappers. The tcl interface allows a single tcl value to be
 10973  // saved using xSetAuxdata(). Instead of simply storing a pointer to the
 10974  // tcl object, the code in this file wraps it in an sqlite3_malloc'd
 10975  // instance of the following struct so that if the destructor is not
 10976  // correctly invoked it will be reported as an SQLite memory leak.
 10977  type F5tAuxData = F5tAuxData1 /* fts5_tcl.c:144:27 */
 10978  
 10979  func xTokenizeCb(tls *libc.TLS, pCtx uintptr, tflags int32, zToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_tcl.c:149:12: */
 10980  	var p uintptr = pCtx
 10981  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 10982  	var rc int32
 10983  
 10984  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 10985  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 10986  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, iStart))
 10987  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, iEnd))
 10988  
 10989  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, 0)
 10990  	for ok := true; ok; ok = 0 != 0 {
 10991  		var _objPtr uintptr = pEval
 10992  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 10993  			tcl.XTclFreeObj(tls, _objPtr)
 10994  		}
 10995  	}
 10996  	if rc == TCL_OK {
 10997  		rc = f5tResultToErrorCode(tls, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp))
 10998  	}
 10999  
 11000  	return rc
 11001  }
 11002  
 11003  func xQueryPhraseCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr) int32 { /* fts5_tcl.c:175:12: */
 11004  	bp := tls.Alloc(88)
 11005  	defer tls.Free(88)
 11006  
 11007  	var p uintptr = pCtx
 11008  	var pEval uintptr
 11009  	var rc int32
 11010  	// var zCmd [64]int8 at bp+8, 64
 11011  
 11012  	// var sApi F5tApi at bp+72, 16
 11013  
 11014  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpApi = pApi
 11015  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpFts = pFts
 11016  	libc.Xsprintf(tls, bp+8 /* &zCmd[0] */, ts+2035 /* "f5t_2_%lld" */, libc.VaList(bp, libc.PostIncInt64(&iCmd1, 1)))
 11017  	tcl.XTcl_CreateObjCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 11018  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11019  	}{xF5tApi})), bp+72 /* &sApi */, uintptr(0))
 11020  
 11021  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 11022  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11023  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, bp+8 /* &zCmd[0] */, -1))
 11024  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, 0)
 11025  	for ok := true; ok; ok = 0 != 0 {
 11026  		var _objPtr uintptr = pEval
 11027  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11028  			tcl.XTclFreeObj(tls, _objPtr)
 11029  		}
 11030  	}
 11031  	tcl.XTcl_DeleteCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */)
 11032  
 11033  	if rc == TCL_OK {
 11034  		rc = f5tResultToErrorCode(tls, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp))
 11035  	}
 11036  
 11037  	return rc
 11038  }
 11039  
 11040  var iCmd1 sqlite3_int64 = int64(0) /* fts5_tcl.c:181:24 */
 11041  
 11042  func xSetAuxdataDestructor(tls *libc.TLS, p uintptr) { /* fts5_tcl.c:207:13: */
 11043  	var pData uintptr = p
 11044  	for ok := true; ok; ok = 0 != 0 {
 11045  		var _objPtr uintptr = (*F5tAuxData)(unsafe.Pointer(pData)).FpObj
 11046  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11047  			tcl.XTclFreeObj(tls, _objPtr)
 11048  		}
 11049  	}
 11050  	sqlite3.Xsqlite3_free(tls, pData)
 11051  }
 11052  
 11053  //      api sub-command...
 11054  //
 11055  // Description...
 11056  func xF5tApi(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:218:26: */
 11057  	bp := tls.Alloc(684)
 11058  	defer tls.Free(684)
 11059  
 11060  	*(*[19]Sub)(unsafe.Pointer(bp + 32 /* aSub */)) = [19]Sub{
 11061  		{FzName: ts + 2046 /* "xColumnCount" */, FzMsg: ts + 489 /* "" */},                                      //  0
 11062  		{FzName: ts + 2059 /* "xRowCount" */, FzMsg: ts + 489 /* "" */},                                         //  1
 11063  		{FzName: ts + 2069 /* "xColumnTotalSize" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                    //  2
 11064  		{FzName: ts + 2090 /* "xTokenize" */, FnArg: 2, FzMsg: ts + 2100 /* "TEXT SCRIPT" */},                   //  3
 11065  		{FzName: ts + 2112 /* "xPhraseCount" */, FzMsg: ts + 489 /* "" */},                                      //  4
 11066  		{FzName: ts + 2125 /* "xPhraseSize" */, FnArg: 1, FzMsg: ts + 2137 /* "PHRASE" */},                      //  5
 11067  		{FzName: ts + 2144 /* "xInstCount" */, FzMsg: ts + 489 /* "" */},                                        //  6
 11068  		{FzName: ts + 2155 /* "xInst" */, FnArg: 1, FzMsg: ts + 2161 /* "IDX" */},                               //  7
 11069  		{FzName: ts + 2165 /* "xRowid" */, FzMsg: ts + 489 /* "" */},                                            //  8
 11070  		{FzName: ts + 2172 /* "xColumnText" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                         //  9
 11071  		{FzName: ts + 2184 /* "xColumnSize" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                         // 10
 11072  		{FzName: ts + 2196 /* "xQueryPhrase" */, FnArg: 2, FzMsg: ts + 2209 /* "PHRASE SCRIPT" */},              // 11
 11073  		{FzName: ts + 2223 /* "xSetAuxdata" */, FnArg: 1, FzMsg: ts + 2235 /* "VALUE" */},                       // 12
 11074  		{FzName: ts + 2241 /* "xGetAuxdata" */, FnArg: 1, FzMsg: ts + 2253 /* "CLEAR" */},                       // 13
 11075  		{FzName: ts + 2259 /* "xSetAuxdataInt" */, FnArg: 1, FzMsg: ts + 2274 /* "INTEGER" */},                  // 14
 11076  		{FzName: ts + 2282 /* "xGetAuxdataInt" */, FnArg: 1, FzMsg: ts + 2253 /* "CLEAR" */},                    // 15
 11077  		{FzName: ts + 2297 /* "xPhraseForeach" */, FnArg: 4, FzMsg: ts + 2312 /* "IPHRASE COLVAR O..." */},      // 16
 11078  		{FzName: ts + 2341 /* "xPhraseColumnFor..." */, FnArg: 3, FzMsg: ts + 2362 /* "IPHRASE COLVAR S..." */}, // 17
 11079  		{},
 11080  	}
 11081  	var rc int32
 11082  	*(*int32)(unsafe.Pointer(bp + 488 /* iSub */)) = 0
 11083  	var p uintptr = clientData
 11084  
 11085  	if objc < 2 {
 11086  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2384 /* "SUB-COMMAND" */)
 11087  		return TCL_ERROR
 11088  	}
 11089  
 11090  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 11091  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+32 /* &aSub[0] */, int32(unsafe.Sizeof(Sub{})), ts+2384 /* "SUB-COMMAND" */, 0, bp+488 /* &iSub */)
 11092  	if rc != TCL_OK {
 11093  		return rc
 11094  	}
 11095  	if (*Sub)(unsafe.Pointer(bp+32 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 488 /* iSub */)))*24)).FnArg != (objc - 2) {
 11096  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, (*Sub)(unsafe.Pointer(bp+32 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 488 /* iSub */)))*24)).FzMsg)
 11097  		return TCL_ERROR
 11098  	}
 11099  
 11100  	switch *(*int32)(unsafe.Pointer(bp + 488 /* iSub */)) {
 11101  	case 0:
 11102  		{
 11103  			var nCol int32
 11104  			nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 16 /* &.xColumnCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11105  			if rc == SQLITE_OK {
 11106  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nCol))
 11107  			}
 11108  			break
 11109  
 11110  		}
 11111  	case 1:
 11112  		{
 11113  			// var nRow sqlite3_int64 at bp+496, 8
 11114  
 11115  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 24 /* &.xRowCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+496 /* &nRow */)
 11116  			if rc == SQLITE_OK {
 11117  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 496 /* nRow */))))
 11118  			}
 11119  			break
 11120  
 11121  		}
 11122  	case 2:
 11123  		{
 11124  			// var iCol int32 at bp+504, 4
 11125  
 11126  			// var nSize sqlite3_int64 at bp+512, 8
 11127  
 11128  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+504 /* &iCol */) != 0 {
 11129  				return TCL_ERROR
 11130  			}
 11131  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 32 /* &.xColumnTotalSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 504 /* iCol */)), bp+512 /* &nSize */)
 11132  			if rc == SQLITE_OK {
 11133  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 512 /* nSize */))))
 11134  			}
 11135  			break
 11136  
 11137  		}
 11138  	case 3:
 11139  		{
 11140  			// var nText int32 at bp+520, 4
 11141  
 11142  			var zText uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+520 /* &nText */)
 11143  			// var ctx F5tFunction at bp+528, 16
 11144  
 11145  			(*F5tFunction)(unsafe.Pointer(bp + 528 /* &ctx */)).Finterp = interp
 11146  			(*F5tFunction)(unsafe.Pointer(bp + 528 /* &ctx */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 11147  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 40 /* &.xTokenize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, zText, *(*int32)(unsafe.Pointer(bp + 520 /* nText */)), bp+528 /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct {
 11148  				f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 11149  			}{xTokenizeCb})))
 11150  			if rc == SQLITE_OK {
 11151  				tcl.XTcl_ResetResult(tls, interp)
 11152  			}
 11153  			return rc
 11154  
 11155  		}
 11156  	case 4:
 11157  		{
 11158  			var nPhrase int32
 11159  			nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 48 /* &.xPhraseCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11160  			if rc == SQLITE_OK {
 11161  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nPhrase))
 11162  			}
 11163  			break
 11164  
 11165  		}
 11166  	case 5:
 11167  		{
 11168  			// var iPhrase int32 at bp+544, 4
 11169  
 11170  			var sz int32
 11171  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+544 /* &iPhrase */) != 0 {
 11172  				return TCL_ERROR
 11173  			}
 11174  			sz = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 56 /* &.xPhraseSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 544 /* iPhrase */)))
 11175  			if rc == SQLITE_OK {
 11176  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sz))
 11177  			}
 11178  			break
 11179  
 11180  		}
 11181  	case 6:
 11182  		{
 11183  			// var nInst int32 at bp+548, 4
 11184  
 11185  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 64 /* &.xInstCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+548 /* &nInst */)
 11186  			if rc == SQLITE_OK {
 11187  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 548 /* nInst */))))
 11188  			}
 11189  			break
 11190  
 11191  		}
 11192  	case 7:
 11193  		{
 11194  			// var iIdx int32 at bp+552, 4
 11195  
 11196  			// var ip int32 at bp+556, 4
 11197  
 11198  			// var ic int32 at bp+560, 4
 11199  
 11200  			// var io int32 at bp+564, 4
 11201  
 11202  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+552 /* &iIdx */) != 0 {
 11203  				return TCL_ERROR
 11204  			}
 11205  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 72 /* &.xInst */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 552 /* iIdx */)), bp+556 /* &ip */, bp+560 /* &ic */, bp+564 /* &io */)
 11206  			if rc == SQLITE_OK {
 11207  				var pList uintptr = tcl.XTcl_NewObj(tls)
 11208  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 556 /* ip */))))
 11209  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 560 /* ic */))))
 11210  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 564 /* io */))))
 11211  				tcl.XTcl_SetObjResult(tls, interp, pList)
 11212  			}
 11213  			break
 11214  
 11215  		}
 11216  	case 8:
 11217  		{
 11218  			var iRowid sqlite3_int64 = (*(*func(*libc.TLS, uintptr) sqlite3_int64)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 80 /* &.xRowid */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11219  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, iRowid))
 11220  			break
 11221  
 11222  		}
 11223  	case 9:
 11224  		{
 11225  			*(*uintptr)(unsafe.Pointer(bp + 576 /* z */)) = uintptr(0)
 11226  			*(*int32)(unsafe.Pointer(bp + 584 /* n */)) = 0
 11227  			// var iCol int32 at bp+568, 4
 11228  
 11229  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+568 /* &iCol */) != 0 {
 11230  				return TCL_ERROR
 11231  			}
 11232  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 88 /* &.xColumnText */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 568 /* iCol */)), bp+576 /* &z */, bp+584 /* &n */)
 11233  			if rc == SQLITE_OK {
 11234  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 576 /* z */)), *(*int32)(unsafe.Pointer(bp + 584 /* n */))))
 11235  			}
 11236  			break
 11237  
 11238  		}
 11239  	case 10:
 11240  		{
 11241  			*(*int32)(unsafe.Pointer(bp + 592 /* n */)) = 0
 11242  			// var iCol int32 at bp+588, 4
 11243  
 11244  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+588 /* &iCol */) != 0 {
 11245  				return TCL_ERROR
 11246  			}
 11247  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 96 /* &.xColumnSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 588 /* iCol */)), bp+592 /* &n */)
 11248  			if rc == SQLITE_OK {
 11249  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 592 /* n */))))
 11250  			}
 11251  			break
 11252  
 11253  		}
 11254  	case 11:
 11255  		{
 11256  			// var iPhrase int32 at bp+596, 4
 11257  
 11258  			// var ctx F5tFunction at bp+600, 16
 11259  
 11260  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+596 /* &iPhrase */) != 0 {
 11261  				return TCL_ERROR
 11262  			}
 11263  			(*F5tFunction)(unsafe.Pointer(bp + 600 /* &ctx */)).Finterp = interp
 11264  			(*F5tFunction)(unsafe.Pointer(bp + 600 /* &ctx */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 11265  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 104 /* &.xQueryPhrase */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 596 /* iPhrase */)), bp+600 /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct {
 11266  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 11267  			}{xQueryPhraseCb})))
 11268  			if rc == SQLITE_OK {
 11269  				tcl.XTcl_ResetResult(tls, interp)
 11270  			}
 11271  			break
 11272  
 11273  		}
 11274  	case 12:
 11275  		{
 11276  			var pData uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(F5tAuxData{})))
 11277  			if pData == uintptr(0) {
 11278  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1930 /* "out of memory" */, 0))
 11279  				return TCL_ERROR
 11280  			}
 11281  			(*F5tAuxData)(unsafe.Pointer(pData)).FpObj = *(*uintptr)(unsafe.Pointer(objv + 2*8))
 11282  			(*Tcl_Obj)(unsafe.Pointer((*F5tAuxData)(unsafe.Pointer(pData)).FpObj)).FrefCount++
 11283  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 112 /* &.xSetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, pData, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{xSetAuxdataDestructor})))
 11284  			break
 11285  
 11286  		}
 11287  	case 13:
 11288  		{
 11289  			var pData uintptr
 11290  			// var bClear int32 at bp+616, 4
 11291  
 11292  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+616 /* &bClear */) != 0 {
 11293  				return TCL_ERROR
 11294  			}
 11295  			pData = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 120 /* &.xGetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 616 /* bClear */)))
 11296  			if pData == uintptr(0) {
 11297  				tcl.XTcl_ResetResult(tls, interp)
 11298  			} else {
 11299  				tcl.XTcl_SetObjResult(tls, interp, (*F5tAuxData)(unsafe.Pointer(pData)).FpObj)
 11300  				if *(*int32)(unsafe.Pointer(bp + 616 /* bClear */)) != 0 {
 11301  					xSetAuxdataDestructor(tls, pData)
 11302  				}
 11303  			}
 11304  			break
 11305  
 11306  		}
 11307  
 11308  	// These two - xSetAuxdataInt and xGetAuxdataInt - are similar to the
 11309  	// xSetAuxdata and xGetAuxdata methods implemented above. The difference
 11310  	// is that they may only save an integer value as auxiliary data, and
 11311  	// do not specify a destructor function.
 11312  	case 14:
 11313  		{
 11314  			// var iVal int32 at bp+620, 4
 11315  
 11316  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+620 /* &iVal */) != 0 {
 11317  				return TCL_ERROR
 11318  			}
 11319  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 112 /* &.xSetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, (uintptr(0) + uintptr(*(*int32)(unsafe.Pointer(bp + 620 /* iVal */)))), uintptr(0))
 11320  			break
 11321  
 11322  		}
 11323  	case 15:
 11324  		{
 11325  			var iVal int32
 11326  			// var bClear int32 at bp+624, 4
 11327  
 11328  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+624 /* &bClear */) != 0 {
 11329  				return TCL_ERROR
 11330  			}
 11331  			iVal = (int32((int64((*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 120 /* &.xGetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 624 /* bClear */)))) - int64(uintptr(0))) / 1))
 11332  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iVal))
 11333  			break
 11334  
 11335  		}
 11336  
 11337  	case 16:
 11338  		{
 11339  			// var iPhrase int32 at bp+628, 4
 11340  
 11341  			// var iCol int32 at bp+648, 4
 11342  
 11343  			// var iOff int32 at bp+652, 4
 11344  
 11345  			var zColvar uintptr
 11346  			var zOffvar uintptr
 11347  			var pScript uintptr = *(*uintptr)(unsafe.Pointer(objv + 5*8))
 11348  			// var iter Fts5PhraseIter at bp+632, 16
 11349  
 11350  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+628 /* &iPhrase */) != 0 {
 11351  				return TCL_ERROR
 11352  			}
 11353  			zColvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 11354  			zOffvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 11355  
 11356  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 128 /* &.xPhraseFirst */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 628 /* iPhrase */)), bp+632 /* &iter */, bp+648 /* &iCol */, bp+652 /* &iOff */)
 11357  			if rc != SQLITE_OK {
 11358  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 11359  				return TCL_ERROR
 11360  			}
 11361  			for ; *(*int32)(unsafe.Pointer(bp + 648 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 136 /* &.xPhraseNext */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+632 /* &iter */, bp+648 /* &iCol */, bp+652 /* &iOff */) {
 11362  				tcl.XTcl_SetVar2Ex(tls, interp, zColvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 648 /* iCol */))), 0)
 11363  				tcl.XTcl_SetVar2Ex(tls, interp, zOffvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 652 /* iOff */))), 0)
 11364  				rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 11365  				if rc == TCL_CONTINUE {
 11366  					rc = TCL_OK
 11367  				}
 11368  				if rc != TCL_OK {
 11369  					if rc == TCL_BREAK {
 11370  						rc = TCL_OK
 11371  					}
 11372  					break
 11373  				}
 11374  			}
 11375  
 11376  			break
 11377  
 11378  		}
 11379  
 11380  	case 17:
 11381  		{
 11382  			// var iPhrase int32 at bp+656, 4
 11383  
 11384  			// var iCol int32 at bp+680, 4
 11385  
 11386  			var zColvar uintptr
 11387  			var pScript uintptr = *(*uintptr)(unsafe.Pointer(objv + 4*8))
 11388  			// var iter Fts5PhraseIter at bp+664, 16
 11389  
 11390  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+656 /* &iPhrase */) != 0 {
 11391  				return TCL_ERROR
 11392  			}
 11393  			zColvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 11394  
 11395  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 144 /* &.xPhraseFirstColumn */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 656 /* iPhrase */)), bp+664 /* &iter */, bp+680 /* &iCol */)
 11396  			if rc != SQLITE_OK {
 11397  				tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 11398  				return TCL_ERROR
 11399  			}
 11400  			for ; *(*int32)(unsafe.Pointer(bp + 680 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 152 /* &.xPhraseNextColumn */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+664 /* &iter */, bp+680 /* &iCol */) {
 11401  				tcl.XTcl_SetVar2Ex(tls, interp, zColvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 680 /* iCol */))), 0)
 11402  				rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 11403  				if rc == TCL_CONTINUE {
 11404  					rc = TCL_OK
 11405  				}
 11406  				if rc != TCL_OK {
 11407  					if rc == TCL_BREAK {
 11408  						rc = TCL_OK
 11409  					}
 11410  					break
 11411  				}
 11412  			}
 11413  
 11414  			break
 11415  
 11416  		}
 11417  
 11418  	default:
 11419  
 11420  		break
 11421  	}
 11422  
 11423  	if rc != SQLITE_OK {
 11424  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 11425  		return TCL_ERROR
 11426  	}
 11427  
 11428  	return TCL_OK
 11429  }
 11430  
 11431  type Sub = struct {
 11432  	FzName uintptr
 11433  	FnArg  int32
 11434  	_      [4]byte
 11435  	FzMsg  uintptr
 11436  } /* fts5_tcl.c:224:3 */
 11437  
 11438  func xF5tFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* fts5_tcl.c:517:13: */
 11439  	bp := tls.Alloc(112)
 11440  	defer tls.Free(112)
 11441  
 11442  	var p uintptr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer((pApi + 8 /* &.xUserData */))))(tls, pFts)
 11443  	var pEval uintptr // Script to evaluate
 11444  	var i int32
 11445  	var rc int32
 11446  	// var zCmd [64]int8 at bp+8, 64
 11447  
 11448  	// var sApi F5tApi at bp+72, 16
 11449  
 11450  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpApi = pApi
 11451  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpFts = pFts
 11452  
 11453  	libc.Xsprintf(tls, bp+8 /* &zCmd[0] */, ts+2396 /* "f5t_%lld" */, libc.VaList(bp, libc.PostIncInt64(&iCmd2, 1)))
 11454  	tcl.XTcl_CreateObjCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 11455  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11456  	}{xF5tApi})), bp+72 /* &sApi */, uintptr(0))
 11457  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 11458  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11459  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, bp+8 /* &zCmd[0] */, -1))
 11460  
 11461  	for i = 0; i < nVal; i++ {
 11462  		var pObj uintptr = uintptr(0)
 11463  		switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))) {
 11464  		case SQLITE_TEXT:
 11465  			pObj = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))), -1)
 11466  			break
 11467  		case SQLITE_BLOB:
 11468  			pObj = tcl.XTcl_NewByteArrayObj(tls,
 11469  				sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))), sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))))
 11470  			break
 11471  		case SQLITE_INTEGER:
 11472  			pObj = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))))
 11473  			break
 11474  		case SQLITE_FLOAT:
 11475  			pObj = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))))
 11476  			break
 11477  		default:
 11478  			pObj = tcl.XTcl_NewObj(tls)
 11479  			break
 11480  		}
 11481  		tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, pObj)
 11482  	}
 11483  
 11484  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, TCL_GLOBAL_ONLY)
 11485  	for ok := true; ok; ok = 0 != 0 {
 11486  		var _objPtr uintptr = pEval
 11487  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11488  			tcl.XTclFreeObj(tls, _objPtr)
 11489  		}
 11490  	}
 11491  	tcl.XTcl_DeleteCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */)
 11492  
 11493  	if rc != TCL_OK {
 11494  		sqlite3.Xsqlite3_result_error(tls, pCtx, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp), -1)
 11495  	} else {
 11496  		var pVar uintptr = tcl.XTcl_GetObjResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp)
 11497  		// var n int32 at bp+88, 4
 11498  
 11499  		var zType uintptr = func() uintptr {
 11500  			if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 11501  				return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 11502  			}
 11503  			return ts + 489 /* "" */
 11504  		}()
 11505  		var c int8 = *(*int8)(unsafe.Pointer(zType))
 11506  		if ((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2405 /* "bytearray" */) == 0)) && ((*Tcl_Obj)(unsafe.Pointer(pVar)).Fbytes == uintptr(0)) {
 11507  			// Only return a BLOB type if the Tcl variable is a bytearray and
 11508  			// has no string representation.
 11509  			var data uintptr = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+88 /* &n */)
 11510  			sqlite3.Xsqlite3_result_blob(tls, pCtx, data, *(*int32)(unsafe.Pointer(bp + 88 /* n */)), libc.UintptrFromInt32(-1))
 11511  		} else if (int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0) {
 11512  			tcl.XTcl_GetIntFromObj(tls, uintptr(0), pVar, bp+88 /* &n */)
 11513  			sqlite3.Xsqlite3_result_int(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 88 /* n */)))
 11514  		} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 11515  			// var r float64 at bp+96, 8
 11516  
 11517  			tcl.XTcl_GetDoubleFromObj(tls, uintptr(0), pVar, bp+96 /* &r */)
 11518  			sqlite3.Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 96 /* r */)))
 11519  		} else if ((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0)) || ((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 11520  			// var v Tcl_WideInt at bp+104, 8
 11521  
 11522  			tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), pVar, bp+104 /* &v */)
 11523  			sqlite3.Xsqlite3_result_int64(tls, pCtx, *(*Tcl_WideInt)(unsafe.Pointer(bp + 104 /* v */)))
 11524  		} else {
 11525  			var data uintptr = tcl.XTcl_GetStringFromObj(tls, pVar, bp+88 /* &n */)
 11526  			sqlite3.Xsqlite3_result_text(tls, pCtx, data, *(*int32)(unsafe.Pointer(bp + 88 /* n */)), libc.UintptrFromInt32(-1))
 11527  		}
 11528  	}
 11529  }
 11530  
 11531  var iCmd2 sqlite3_int64 = int64(0) /* fts5_tcl.c:529:24 */
 11532  
 11533  func xF5tDestroy(tls *libc.TLS, pCtx uintptr) { /* fts5_tcl.c:600:13: */
 11534  	var p uintptr = pCtx
 11535  	for ok := true; ok; ok = 0 != 0 {
 11536  		var _objPtr uintptr = (*F5tFunction)(unsafe.Pointer(p)).FpScript
 11537  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11538  			tcl.XTclFreeObj(tls, _objPtr)
 11539  		}
 11540  	}
 11541  	tcl.XTcl_Free(tls, p)
 11542  }
 11543  
 11544  //      sqlite3_fts5_create_function DB NAME SCRIPT
 11545  //
 11546  // Description...
 11547  func f5tCreateFunction(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:611:26: */
 11548  	bp := tls.Alloc(40)
 11549  	defer tls.Free(40)
 11550  
 11551  	var zName uintptr
 11552  	var pScript uintptr
 11553  	*(*uintptr)(unsafe.Pointer(bp + 24 /* db */)) = uintptr(0)
 11554  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pApi */)) = uintptr(0)
 11555  	var pCtx uintptr = uintptr(0)
 11556  	var rc int32
 11557  
 11558  	if objc != 4 {
 11559  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2442 /* "DB NAME SCRIPT" */)
 11560  		return TCL_ERROR
 11561  	}
 11562  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+24 /* &db */, bp+32 /* &pApi */) != 0 {
 11563  		return TCL_ERROR
 11564  	}
 11565  
 11566  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 11567  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 11568  	pCtx = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tFunction{})))
 11569  	(*F5tFunction)(unsafe.Pointer(pCtx)).Finterp = interp
 11570  	(*F5tFunction)(unsafe.Pointer(pCtx)).FpScript = pScript
 11571  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 11572  
 11573  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, fts5_extension_function, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 32 /* pApi */)) + 24 /* &.xCreateFunction */))))(tls,
 11574  		*(*uintptr)(unsafe.Pointer(bp + 32 /* pApi */)), zName, pCtx, *(*uintptr)(unsafe.Pointer(&struct {
 11575  			f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr)
 11576  		}{xF5tFunction})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{xF5tDestroy})))
 11577  	if rc != SQLITE_OK {
 11578  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */))), 0))
 11579  		return TCL_ERROR
 11580  	}
 11581  
 11582  	return TCL_OK
 11583  }
 11584  
 11585  type F5tTokenizeCtx1 = struct {
 11586  	FpRet   uintptr
 11587  	FbSubst int32
 11588  	_       [4]byte
 11589  	FzInput uintptr
 11590  } /* fts5_tcl.c:648:9 */
 11591  
 11592  type F5tTokenizeCtx = F5tTokenizeCtx1 /* fts5_tcl.c:648:31 */
 11593  
 11594  func xTokenizeCb2(tls *libc.TLS, pCtx uintptr, tflags int32, zToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_tcl.c:655:12: */
 11595  	var p uintptr = pCtx
 11596  	if (*F5tTokenizeCtx)(unsafe.Pointer(p)).FbSubst != 0 {
 11597  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 11598  		tcl.XTcl_ListObjAppendElement(tls,
 11599  			uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, ((*F5tTokenizeCtx)(unsafe.Pointer(p)).FzInput+uintptr(iStart)), (iEnd-iStart)))
 11600  	} else {
 11601  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 11602  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewIntObj(tls, iStart))
 11603  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewIntObj(tls, iEnd))
 11604  	}
 11605  	return SQLITE_OK
 11606  }
 11607  
 11608  //      sqlite3_fts5_tokenize DB TOKENIZER TEXT
 11609  //
 11610  // Description...
 11611  func f5tTokenize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:681:26: */
 11612  	bp := tls.Alloc(200)
 11613  	defer tls.Free(200)
 11614  
 11615  	var zText uintptr
 11616  	// var nText int32 at bp+128, 4
 11617  
 11618  	*(*uintptr)(unsafe.Pointer(bp + 96 /* db */)) = uintptr(0)
 11619  	*(*uintptr)(unsafe.Pointer(bp + 104 /* pApi */)) = uintptr(0)
 11620  	*(*uintptr)(unsafe.Pointer(bp + 168 /* pTok */)) = uintptr(0)
 11621  	// var tokenizer fts5_tokenizer at bp+144, 24
 11622  
 11623  	var pRet uintptr = uintptr(0)
 11624  	// var pUserdata uintptr at bp+136, 8
 11625  
 11626  	var rc int32
 11627  	// var nArg int32 at bp+112, 4
 11628  
 11629  	// var azArg uintptr at bp+120, 8
 11630  
 11631  	// var ctx F5tTokenizeCtx at bp+176, 24
 11632  
 11633  	if (objc != 4) && (objc != 5) {
 11634  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2457 /* "?-subst? DB NAME..." */)
 11635  		return TCL_ERROR
 11636  	}
 11637  	if objc == 5 {
 11638  		var zOpt uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 11639  		if libc.Xstrcmp(tls, ts+2479 /* "-subst" */, zOpt) != 0 {
 11640  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2486 /* "unrecognized opt..." */, zOpt, 0))
 11641  			return TCL_ERROR
 11642  		}
 11643  	}
 11644  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*8)), bp+96 /* &db */, bp+104 /* &pApi */) != 0 {
 11645  		return TCL_ERROR
 11646  	}
 11647  	if tcl.XTcl_SplitList(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8))), bp+112 /* &nArg */, bp+120 /* &azArg */) != 0 {
 11648  		return TCL_ERROR
 11649  	}
 11650  	if *(*int32)(unsafe.Pointer(bp + 112 /* nArg */)) == 0 {
 11651  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+2508 /* "no such tokenize..." */, 0))
 11652  		tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* azArg */)))
 11653  		return TCL_ERROR
 11654  	}
 11655  	zText = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8)), bp+128 /* &nText */)
 11656  
 11657  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 104 /* pApi */)) + 16 /* &.xFindTokenizer */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* pApi */)), *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 120 /* azArg */)))), bp+136 /* &pUserdata */, bp+144 /* &tokenizer */)
 11658  	if rc != SQLITE_OK {
 11659  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+2508 /* "no such tokenize..." */, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 120 /* azArg */)))), 0))
 11660  		return TCL_ERROR
 11661  	}
 11662  
 11663  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 144 /* &tokenizer */ /* &.xCreate */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 136 /* pUserdata */)), (*(*uintptr)(unsafe.Pointer(bp + 120 /* azArg */)) + 1*8), (*(*int32)(unsafe.Pointer(bp + 112 /* nArg */)) - 1), bp+168 /* &pTok */)
 11664  	if rc != SQLITE_OK {
 11665  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, ts+2528 /* "error in tokeniz..." */, 0))
 11666  		return TCL_ERROR
 11667  	}
 11668  
 11669  	pRet = tcl.XTcl_NewObj(tls)
 11670  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 11671  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 176 /* &ctx */)).FbSubst = (libc.Bool32(objc == 5))
 11672  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 176 /* &ctx */)).FpRet = pRet
 11673  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 176 /* &ctx */)).FzInput = zText
 11674  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 144 /* &tokenizer */ + 16 /* &.xTokenize */))))(tls,
 11675  		*(*uintptr)(unsafe.Pointer(bp + 168 /* pTok */)), bp+176 /* &ctx */, FTS5_TOKENIZE_DOCUMENT, zText, *(*int32)(unsafe.Pointer(bp + 128 /* nText */)), *(*uintptr)(unsafe.Pointer(&struct {
 11676  			f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 11677  		}{xTokenizeCb2})))
 11678  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((bp + 144 /* &tokenizer */ + 8 /* &.xDelete */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pTok */)))
 11679  	if rc != SQLITE_OK {
 11680  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+80, ts+2557 /* "error in tokeniz..." */, 0))
 11681  		for ok := true; ok; ok = 0 != 0 {
 11682  			var _objPtr uintptr = pRet
 11683  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11684  				tcl.XTclFreeObj(tls, _objPtr)
 11685  			}
 11686  		}
 11687  		return TCL_ERROR
 11688  	}
 11689  
 11690  	tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer(bp + 120 /* azArg */)))
 11691  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 11692  	for ok1 := true; ok1; ok1 = 0 != 0 {
 11693  		var _objPtr uintptr = pRet
 11694  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11695  			tcl.XTclFreeObj(tls, _objPtr)
 11696  		}
 11697  	}
 11698  	return TCL_OK
 11699  }
 11700  
 11701  // ************************************************************************
 11702  //
 11703  // Start of tokenizer wrapper.
 11704  
 11705  type F5tTokenizerContext1 = struct {
 11706  	FpCtx   uintptr
 11707  	FxToken uintptr
 11708  } /* fts5_tcl.c:761:9 */
 11709  
 11710  // ************************************************************************
 11711  //
 11712  // Start of tokenizer wrapper.
 11713  
 11714  type F5tTokenizerContext = F5tTokenizerContext1 /* fts5_tcl.c:761:36 */
 11715  type F5tTokenizerModule1 = struct {
 11716  	Finterp   uintptr
 11717  	FpScript  uintptr
 11718  	FpContext uintptr
 11719  } /* fts5_tcl.c:763:9 */
 11720  
 11721  type F5tTokenizerModule = F5tTokenizerModule1 /* fts5_tcl.c:763:35 */
 11722  type F5tTokenizerInstance1 = struct {
 11723  	Finterp   uintptr
 11724  	FpScript  uintptr
 11725  	FpContext uintptr
 11726  } /* fts5_tcl.c:764:9 */
 11727  
 11728  type F5tTokenizerInstance = F5tTokenizerInstance1 /* fts5_tcl.c:764:37 */
 11729  
 11730  func f5tTokenizerCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* fts5_tcl.c:783:12: */
 11731  	var pMod uintptr = pCtx
 11732  	var pEval uintptr
 11733  	var rc int32 = TCL_OK
 11734  	var i int32
 11735  
 11736  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript)
 11737  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11738  	for i = 0; (rc == TCL_OK) && (i < nArg); i++ {
 11739  		var pObj uintptr = tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)), -1)
 11740  		rc = tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp, pEval, pObj)
 11741  	}
 11742  
 11743  	if rc == TCL_OK {
 11744  		rc = tcl.XTcl_EvalObjEx(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp, pEval, TCL_GLOBAL_ONLY)
 11745  	}
 11746  	for ok := true; ok; ok = 0 != 0 {
 11747  		var _objPtr uintptr = pEval
 11748  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11749  			tcl.XTclFreeObj(tls, _objPtr)
 11750  		}
 11751  	}
 11752  
 11753  	if rc == TCL_OK {
 11754  		var pInst uintptr
 11755  		pInst = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerInstance{})))
 11756  		libc.Xmemset(tls, pInst, 0, uint64(unsafe.Sizeof(F5tTokenizerInstance{})))
 11757  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp
 11758  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript = tcl.XTcl_GetObjResult(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp)
 11759  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpContext
 11760  		(*Tcl_Obj)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript)).FrefCount++
 11761  		*(*uintptr)(unsafe.Pointer(ppOut)) = pInst
 11762  	}
 11763  
 11764  	return rc
 11765  }
 11766  
 11767  func f5tTokenizerDelete(tls *libc.TLS, p uintptr) { /* fts5_tcl.c:821:13: */
 11768  	var pInst uintptr = p
 11769  	for ok := true; ok; ok = 0 != 0 {
 11770  		var _objPtr uintptr = (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript
 11771  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11772  			tcl.XTclFreeObj(tls, _objPtr)
 11773  		}
 11774  	}
 11775  	tcl.XTcl_Free(tls, pInst)
 11776  }
 11777  
 11778  func f5tTokenizerTokenize(tls *libc.TLS, p uintptr, pCtx uintptr, flags int32, pText uintptr, nText int32, xToken uintptr) int32 { /* fts5_tcl.c:827:12: */
 11779  	var pInst uintptr = p
 11780  	var pOldCtx uintptr
 11781  	var xOldToken uintptr
 11782  	var pEval uintptr
 11783  	var rc int32
 11784  	var zFlags uintptr
 11785  
 11786  	pOldCtx = (*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx
 11787  	xOldToken = (*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken
 11788  
 11789  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx = pCtx
 11790  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken = xToken
 11791  
 11792  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript)
 11793  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11794  	switch flags {
 11795  	case FTS5_TOKENIZE_DOCUMENT:
 11796  		zFlags = ts + 2588 /* "document" */
 11797  		break
 11798  	case FTS5_TOKENIZE_AUX:
 11799  		zFlags = ts + 2597 /* "aux" */
 11800  		break
 11801  	case FTS5_TOKENIZE_QUERY:
 11802  		zFlags = ts + 2601 /* "query" */
 11803  		break
 11804  	case (FTS5_TOKENIZE_PREFIX | FTS5_TOKENIZE_QUERY):
 11805  		zFlags = ts + 2607 /* "prefixquery" */
 11806  		break
 11807  	default:
 11808  
 11809  		zFlags = ts + 2619 /* "invalid" */
 11810  		break
 11811  	}
 11812  
 11813  	tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zFlags, -1))
 11814  	tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, pText, nText))
 11815  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, TCL_GLOBAL_ONLY)
 11816  	for ok := true; ok; ok = 0 != 0 {
 11817  		var _objPtr uintptr = pEval
 11818  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11819  			tcl.XTclFreeObj(tls, _objPtr)
 11820  		}
 11821  	}
 11822  
 11823  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx = pOldCtx
 11824  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken = xOldToken
 11825  	return rc
 11826  }
 11827  
 11828  // sqlite3_fts5_token ?-colocated? TEXT START END
 11829  func f5tTokenizerReturn(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:887:26: */
 11830  	bp := tls.Alloc(32)
 11831  	defer tls.Free(32)
 11832  
 11833  	var p uintptr
 11834  	// var iStart int32 at bp+24, 4
 11835  
 11836  	// var iEnd int32 at bp+28, 4
 11837  
 11838  	// var nToken int32 at bp+20, 4
 11839  
 11840  	var tflags int32
 11841  	var zToken uintptr
 11842  	var rc int32
 11843  	// var nArg int32 at bp+16, 4
 11844  
 11845  	var zArg uintptr
 11846  	p = clientData
 11847  	tflags = 0
 11848  
 11849  	if !(objc == 5) {
 11850  		goto __1
 11851  	}
 11852  	zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &nArg */)
 11853  	if !(((*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)) <= 10) && (*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)) >= 2)) && (libc.Xmemcmp(tls, ts+2627 /* "-colocated" */, zArg, uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)))) == 0)) {
 11854  		goto __3
 11855  	}
 11856  	tflags = tflags | (FTS5_TOKEN_COLOCATED)
 11857  	goto __4
 11858  __3:
 11859  	goto usage
 11860  __4:
 11861  	;
 11862  	goto __2
 11863  __1:
 11864  	if !(objc != 4) {
 11865  		goto __5
 11866  	}
 11867  	goto usage
 11868  __5:
 11869  	;
 11870  __2:
 11871  	;
 11872  
 11873  	zToken = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*8)), bp+20 /* &nToken */)
 11874  	if !((tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8)), bp+24 /* &iStart */) != 0) ||
 11875  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8)), bp+28 /* &iEnd */) != 0)) {
 11876  		goto __6
 11877  	}
 11878  	return TCL_ERROR
 11879  __6:
 11880  	;
 11881  
 11882  	if !((*F5tTokenizerContext)(unsafe.Pointer(p)).FxToken == uintptr(0)) {
 11883  		goto __7
 11884  	}
 11885  	tcl.XTcl_AppendResult(tls, interp,
 11886  		libc.VaList(bp, ts+2638 /* "sqlite3_fts5_tok..." */, 0))
 11887  	return TCL_ERROR
 11888  __7:
 11889  	;
 11890  
 11891  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer((p + 8 /* &.xToken */))))(tls, (*F5tTokenizerContext)(unsafe.Pointer(p)).FpCtx, tflags, zToken, *(*int32)(unsafe.Pointer(bp + 20 /* nToken */)), *(*int32)(unsafe.Pointer(bp + 24 /* iStart */)), *(*int32)(unsafe.Pointer(bp + 28 /* iEnd */)))
 11892  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 11893  	if rc == SQLITE_OK {
 11894  		return TCL_OK
 11895  	}
 11896  	return TCL_ERROR
 11897  
 11898  usage:
 11899  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2696 /* "?-colocated? TEX..." */)
 11900  	return TCL_ERROR
 11901  }
 11902  
 11903  func f5tDelTokenizer(tls *libc.TLS, pCtx uintptr) { /* fts5_tcl.c:936:13: */
 11904  	var pMod uintptr = pCtx
 11905  	for ok := true; ok; ok = 0 != 0 {
 11906  		var _objPtr uintptr = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript
 11907  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11908  			tcl.XTclFreeObj(tls, _objPtr)
 11909  		}
 11910  	}
 11911  	tcl.XTcl_Free(tls, pMod)
 11912  }
 11913  
 11914  //      sqlite3_fts5_create_tokenizer DB NAME SCRIPT
 11915  //
 11916  // Register a tokenizer named NAME implemented by script SCRIPT. When
 11917  // a tokenizer instance is created (fts5_tokenizer.xCreate), any tokenizer
 11918  // arguments are appended to SCRIPT and the result executed.
 11919  //
 11920  // The value returned by (SCRIPT + args) is itself a tcl script. This
 11921  // script - call it SCRIPT2 - is executed to tokenize text using the
 11922  // tokenizer instance "returned" by SCRIPT. Specifically, to tokenize
 11923  // text SCRIPT2 is invoked with a single argument appended to it - the
 11924  // text to tokenize.
 11925  //
 11926  // SCRIPT2 should invoke the [sqlite3_fts5_token] command once for each
 11927  // token within the tokenized text.
 11928  func f5tCreateTokenizer(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:958:26: */
 11929  	bp := tls.Alloc(56)
 11930  	defer tls.Free(56)
 11931  
 11932  	var pContext uintptr = clientData
 11933  	// var db uintptr at bp+16, 8
 11934  
 11935  	// var pApi uintptr at bp+24, 8
 11936  
 11937  	var zName uintptr
 11938  	var pScript uintptr
 11939  	// var t fts5_tokenizer at bp+32, 24
 11940  
 11941  	var pMod uintptr
 11942  	var rc int32
 11943  
 11944  	if objc != 4 {
 11945  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2442 /* "DB NAME SCRIPT" */)
 11946  		return TCL_ERROR
 11947  	}
 11948  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &db */, bp+24 /* &pApi */) != 0 {
 11949  		return TCL_ERROR
 11950  	}
 11951  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 11952  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 11953  
 11954  	(*fts5_tokenizer)(unsafe.Pointer(bp + 32 /* &t */)).FxCreate = *(*uintptr)(unsafe.Pointer(&struct {
 11955  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11956  	}{f5tTokenizerCreate}))
 11957  	(*fts5_tokenizer)(unsafe.Pointer(bp + 32 /* &t */)).FxTokenize = *(*uintptr)(unsafe.Pointer(&struct {
 11958  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32
 11959  	}{f5tTokenizerTokenize}))
 11960  	(*fts5_tokenizer)(unsafe.Pointer(bp + 32 /* &t */)).FxDelete = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{f5tTokenizerDelete}))
 11961  
 11962  	pMod = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerModule{})))
 11963  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp = interp
 11964  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript = pScript
 11965  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpContext = pContext
 11966  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 11967  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 24 /* pApi */)) + 8 /* &.xCreateTokenizer */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pApi */)), zName, pMod, bp+32 /* &t */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{f5tDelTokenizer})))
 11968  	if rc != SQLITE_OK {
 11969  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2724 /* "error in fts5_ap..." */, 0))
 11970  		return TCL_ERROR
 11971  	}
 11972  
 11973  	return TCL_OK
 11974  }
 11975  
 11976  func xF5tFree(tls *libc.TLS, clientData ClientData) { /* fts5_tcl.c:1001:27: */
 11977  	tcl.XTcl_Free(tls, clientData)
 11978  }
 11979  
 11980  //      sqlite3_fts5_may_be_corrupt BOOLEAN
 11981  //
 11982  // Set or clear the global "may-be-corrupt" flag. Return the old value.
 11983  func f5tMayBeCorrupt(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1010:26: */
 11984  	return TCL_OK
 11985  }
 11986  
 11987  func f5t_fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) uint32 { /* fts5_tcl.c:1035:21: */
 11988  	var i int32
 11989  	var h uint32 = uint32(13)
 11990  	for i = (n - 1); i >= 0; i-- {
 11991  		h = (((h << 3) ^ h) ^ uint32(*(*int8)(unsafe.Pointer(p + uintptr(i)))))
 11992  	}
 11993  	return (h % uint32(nSlot))
 11994  }
 11995  
 11996  func f5tTokenHash(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1044:26: */
 11997  	bp := tls.Alloc(8)
 11998  	defer tls.Free(8)
 11999  
 12000  	var z uintptr
 12001  	// var n int32 at bp+4, 4
 12002  
 12003  	var iVal uint32
 12004  	// var nSlot int32 at bp, 4
 12005  
 12006  	if objc != 3 {
 12007  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2761 /* "NSLOT TOKEN" */)
 12008  		return TCL_ERROR
 12009  	}
 12010  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &nSlot */) != 0 {
 12011  		return TCL_ERROR
 12012  	}
 12013  	z = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+4 /* &n */)
 12014  
 12015  	iVal = f5t_fts5HashKey(tls, *(*int32)(unsafe.Pointer(bp /* nSlot */)), z, *(*int32)(unsafe.Pointer(bp + 4 /* n */)))
 12016  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(iVal)))
 12017  	return TCL_OK
 12018  }
 12019  
 12020  func f5tRegisterMatchinfo(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1069:26: */
 12021  	bp := tls.Alloc(8)
 12022  	defer tls.Free(8)
 12023  
 12024  	var rc int32
 12025  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 12026  
 12027  	if objc != 2 {
 12028  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 12029  		return TCL_ERROR
 12030  	}
 12031  	if f5tDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &db */) != 0 {
 12032  		return TCL_ERROR
 12033  	}
 12034  
 12035  	rc = sqlite3Fts5TestRegisterMatchinfo(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 12036  	if rc != SQLITE_OK {
 12037  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12038  		return TCL_ERROR
 12039  	}
 12040  	return TCL_OK
 12041  }
 12042  
 12043  func f5tRegisterTok(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1094:26: */
 12044  	bp := tls.Alloc(16)
 12045  	defer tls.Free(16)
 12046  
 12047  	var rc int32
 12048  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 12049  	*(*uintptr)(unsafe.Pointer(bp + 8 /* pApi */)) = uintptr(0)
 12050  
 12051  	if objc != 2 {
 12052  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 12053  		return TCL_ERROR
 12054  	}
 12055  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &db */, bp+8 /* &pApi */) != 0 {
 12056  		return TCL_ERROR
 12057  	}
 12058  
 12059  	rc = sqlite3Fts5TestRegisterTok(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* pApi */)))
 12060  	if rc != SQLITE_OK {
 12061  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12062  		return TCL_ERROR
 12063  	}
 12064  	return TCL_OK
 12065  }
 12066  
 12067  // Entry point.
 12068  func Fts5tcl_Init(tls *libc.TLS, interp uintptr) int32 { /* fts5_tcl.c:1123:5: */
 12069  	var i int32
 12070  	var pContext uintptr
 12071  
 12072  	pContext = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerContext{})))
 12073  	libc.Xmemset(tls, pContext, 0, uint64(unsafe.Sizeof(F5tTokenizerContext{})))
 12074  
 12075  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd)) / uint64(unsafe.Sizeof(struct {
 12076  		FzName        uintptr
 12077  		FxProc        uintptr
 12078  		FbTokenizeCtx int32
 12079  		_             [4]byte
 12080  	}{}))); i++ {
 12081  		var p uintptr = (uintptr(unsafe.Pointer(&aCmd)) + uintptr(i)*24)
 12082  		var pCtx uintptr = uintptr(0)
 12083  		if (*struct {
 12084  			FzName        uintptr
 12085  			FxProc        uintptr
 12086  			FbTokenizeCtx int32
 12087  			_             [4]byte
 12088  		})(unsafe.Pointer(p)).FbTokenizeCtx != 0 {
 12089  			pCtx = pContext
 12090  		}
 12091  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 12092  			FzName        uintptr
 12093  			FxProc        uintptr
 12094  			FbTokenizeCtx int32
 12095  			_             [4]byte
 12096  		})(unsafe.Pointer(p)).FzName, (*struct {
 12097  			FzName        uintptr
 12098  			FxProc        uintptr
 12099  			FbTokenizeCtx int32
 12100  			_             [4]byte
 12101  		})(unsafe.Pointer(p)).FxProc, pCtx, func() uintptr {
 12102  			if i != 0 {
 12103  				return uintptr(0)
 12104  			}
 12105  			return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{xF5tFree}))
 12106  		}())
 12107  	}
 12108  
 12109  	return TCL_OK
 12110  }
 12111  
 12112  var aCmd = [8]struct {
 12113  	FzName        uintptr
 12114  	FxProc        uintptr
 12115  	FbTokenizeCtx int32
 12116  	_             [4]byte
 12117  }{
 12118  	{FzName: ts + 2773 /* "sqlite3_fts5_cre..." */, FxProc: 0, FbTokenizeCtx: 1},
 12119  	{FzName: ts + 2803 /* "sqlite3_fts5_tok..." */, FxProc: 0, FbTokenizeCtx: 1},
 12120  	{FzName: ts + 2822 /* "sqlite3_fts5_tok..." */, FxProc: 0},
 12121  	{FzName: ts + 2844 /* "sqlite3_fts5_cre..." */, FxProc: 0},
 12122  	{FzName: ts + 2873 /* "sqlite3_fts5_may..." */, FxProc: 0},
 12123  	{FzName: ts + 2901 /* "sqlite3_fts5_tok..." */, FxProc: 0},
 12124  	{FzName: ts + 2925 /* "sqlite3_fts5_reg..." */, FxProc: 0},
 12125  	{FzName: ts + 2957 /* "sqlite3_fts5_reg..." */, FxProc: 0},
 12126  } /* fts5_tcl.c:1128:5 */
 12127  
 12128  type Fts5MatchinfoCtx1 = struct {
 12129  	FnCol    int32
 12130  	FnPhrase int32
 12131  	FzArg    uintptr
 12132  	FnRet    int32
 12133  	_        [4]byte
 12134  	FaRet    uintptr
 12135  } /* fts5_test_mi.c:50:9 */
 12136  
 12137  type Fts5MatchinfoCtx = Fts5MatchinfoCtx1 /* fts5_test_mi.c:50:33 */
 12138  
 12139  type u32 = uint32 /* fts5_test_mi.c:53:22 */
 12140  
 12141  // Return a pointer to the fts5_api pointer for database connection db.
 12142  // If an error occurs, return NULL and leave an error in the database
 12143  // handle (accessible using sqlite3_errcode()/errmsg()).
 12144  func fts5_api_from_db(tls *libc.TLS, db uintptr, ppApi uintptr) int32 { /* fts5_test_mi.c:71:12: */
 12145  	bp := tls.Alloc(8)
 12146  	defer tls.Free(8)
 12147  
 12148  	*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
 12149  	var rc int32
 12150  
 12151  	*(*uintptr)(unsafe.Pointer(ppApi)) = uintptr(0)
 12152  	rc = sqlite3.Xsqlite3_prepare(tls, db, ts+1998 /* "SELECT fts5(?1)" */, -1, bp /* &pStmt */, uintptr(0))
 12153  	if rc == SQLITE_OK {
 12154  		sqlite3.Xsqlite3_bind_pointer(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 1, ppApi, ts+2022 /* "fts5_api_ptr" */, uintptr(0))
 12155  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 12156  		rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 12157  	}
 12158  
 12159  	return rc
 12160  }
 12161  
 12162  // Argument f should be a flag accepted by matchinfo() (a valid character
 12163  // in the string passed as the second argument). If it is not, -1 is
 12164  // returned. Otherwise, if f is a valid matchinfo flag, the value returned
 12165  // is the number of 32-bit integers added to the output array if the
 12166  // table has nCol columns and the query nPhrase phrases.
 12167  func fts5MatchinfoFlagsize(tls *libc.TLS, nCol int32, nPhrase int32, f int8) int32 { /* fts5_test_mi.c:94:12: */
 12168  	var ret int32 = -1
 12169  	switch int32(f) {
 12170  	case 'p':
 12171  		ret = 1
 12172  		break
 12173  	case 'c':
 12174  		ret = 1
 12175  		break
 12176  	case 'x':
 12177  		ret = ((3 * nCol) * nPhrase)
 12178  		break
 12179  	case 'y':
 12180  		ret = (nCol * nPhrase)
 12181  		break
 12182  	case 'b':
 12183  		ret = (((nCol + 31) / 32) * nPhrase)
 12184  		break
 12185  	case 'n':
 12186  		ret = 1
 12187  		break
 12188  	case 'a':
 12189  		ret = nCol
 12190  		break
 12191  	case 'l':
 12192  		ret = nCol
 12193  		break
 12194  	case 's':
 12195  		ret = nCol
 12196  		break
 12197  	}
 12198  	return ret
 12199  }
 12200  
 12201  func fts5MatchinfoIter(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, x uintptr) int32 { /* fts5_test_mi.c:110:12: */
 12202  	var i int32
 12203  	var n int32 = 0
 12204  	var rc int32 = SQLITE_OK
 12205  	var f int8
 12206  	for i = 0; libc.AssignInt8(&f, *(*int8)(unsafe.Pointer((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg + uintptr(i)))) != 0; i++ {
 12207  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int8, uintptr) int32)(unsafe.Pointer(&x)))(tls, pApi, pFts, p, f, ((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet + uintptr(n)*4))
 12208  		if rc != SQLITE_OK {
 12209  			break
 12210  		}
 12211  		n = n + (fts5MatchinfoFlagsize(tls, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase, f))
 12212  	}
 12213  	return rc
 12214  }
 12215  
 12216  func fts5MatchinfoXCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pUserData uintptr) int32 { /* fts5_test_mi.c:128:12: */
 12217  	bp := tls.Alloc(24)
 12218  	defer tls.Free(24)
 12219  
 12220  	// var iter Fts5PhraseIter at bp, 16
 12221  
 12222  	// var iCol int32 at bp+16, 4
 12223  
 12224  	// var iOff int32 at bp+20, 4
 12225  
 12226  	var aOut uintptr = pUserData
 12227  	var iPrev int32 = -1
 12228  
 12229  	for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 128 /* &.xPhraseFirst */))))(tls, pFts, 0, bp /* &iter */, bp+16 /* &iCol */, bp+20 /* &iOff */); *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 136 /* &.xPhraseNext */))))(tls, pFts, bp /* &iter */, bp+16 /* &iCol */, bp+20 /* &iOff */) {
 12230  		*(*u32)(unsafe.Pointer(aOut + uintptr(((*(*int32)(unsafe.Pointer(bp + 16 /* iCol */))*3)+1))*4))++
 12231  		if *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) != iPrev {
 12232  			*(*u32)(unsafe.Pointer(aOut + uintptr(((*(*int32)(unsafe.Pointer(bp + 16 /* iCol */))*3)+2))*4))++
 12233  		}
 12234  		iPrev = *(*int32)(unsafe.Pointer(bp + 16 /* iCol */))
 12235  	}
 12236  
 12237  	return SQLITE_OK
 12238  }
 12239  
 12240  func fts5MatchinfoGlobalCb(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, f int8, aOut uintptr) int32 { /* fts5_test_mi.c:150:12: */
 12241  	bp := tls.Alloc(24)
 12242  	defer tls.Free(24)
 12243  
 12244  	var rc int32 = SQLITE_OK
 12245  	switch int32(f) {
 12246  	case 'p':
 12247  		*(*u32)(unsafe.Pointer(aOut)) = u32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase)
 12248  		break
 12249  
 12250  	case 'c':
 12251  		*(*u32)(unsafe.Pointer(aOut)) = u32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)
 12252  		break
 12253  
 12254  	case 'x':
 12255  		{
 12256  			var i int32
 12257  			for i = 0; (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase) && (rc == SQLITE_OK); i++ {
 12258  				var pPtr uintptr = (aOut + uintptr(((i*(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)*3))*4)
 12259  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 104 /* &.xQueryPhrase */))))(tls, pFts, i, pPtr, *(*uintptr)(unsafe.Pointer(&struct {
 12260  					f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 12261  				}{fts5MatchinfoXCb})))
 12262  			}
 12263  			break
 12264  
 12265  		}
 12266  
 12267  	case 'n':
 12268  		{
 12269  			// var nRow sqlite3_int64 at bp, 8
 12270  
 12271  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 24 /* &.xRowCount */))))(tls, pFts, bp /* &nRow */)
 12272  			*(*u32)(unsafe.Pointer(aOut)) = u32(*(*sqlite3_int64)(unsafe.Pointer(bp /* nRow */)))
 12273  			break
 12274  
 12275  		}
 12276  
 12277  	case 'a':
 12278  		{
 12279  			*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */)) = int64(0)
 12280  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 24 /* &.xRowCount */))))(tls, pFts, bp+8 /* &nRow */)
 12281  			if *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */)) == int64(0) {
 12282  				libc.Xmemset(tls, aOut, 0, (uint64(unsafe.Sizeof(u32(0))) * uint64((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)))
 12283  			} else {
 12284  				var i int32
 12285  				for i = 0; (rc == SQLITE_OK) && (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol); i++ {
 12286  					// var nToken sqlite3_int64 at bp+16, 8
 12287  
 12288  					rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 32 /* &.xColumnTotalSize */))))(tls, pFts, i, bp+16 /* &nToken */)
 12289  					if rc == SQLITE_OK {
 12290  						*(*u32)(unsafe.Pointer(aOut + uintptr(i)*4)) = (u32(((int64(2) * *(*sqlite3_int64)(unsafe.Pointer(bp + 16 /* nToken */))) + *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */))) / (int64(2) * *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */)))))
 12291  					}
 12292  				}
 12293  			}
 12294  			break
 12295  
 12296  		}
 12297  
 12298  	}
 12299  	return rc
 12300  }
 12301  
 12302  func fts5MatchinfoLocalCb(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, f int8, aOut uintptr) int32 { /* fts5_test_mi.c:205:12: */
 12303  	bp := tls.Alloc(80)
 12304  	defer tls.Free(80)
 12305  
 12306  	var i int32
 12307  	var rc int32 = SQLITE_OK
 12308  
 12309  	switch int32(f) {
 12310  	case 'b':
 12311  		{
 12312  			var iPhrase int32
 12313  			var nInt int32 = ((((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol + 31) / 32) * (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase)
 12314  			for i = 0; i < nInt; i++ {
 12315  				*(*u32)(unsafe.Pointer(aOut + uintptr(i)*4)) = u32(0)
 12316  			}
 12317  
 12318  			for iPhrase = 0; iPhrase < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase; iPhrase++ {
 12319  				// var iter Fts5PhraseIter at bp, 16
 12320  
 12321  				// var iCol int32 at bp+16, 4
 12322  
 12323  				for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 144 /* &.xPhraseFirstColumn */))))(tls, pFts, iPhrase, bp /* &iter */, bp+16 /* &iCol */); *(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 152 /* &.xPhraseNextColumn */))))(tls, pFts, bp /* &iter */, bp+16 /* &iCol */) {
 12324  					*(*u32)(unsafe.Pointer(aOut + uintptr(((iPhrase*(((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol+31)/32))+(*(*int32)(unsafe.Pointer(bp + 16 /* iCol */))/32)))*4)) |= (u32(u32(1)) << (*(*int32)(unsafe.Pointer(bp + 16 /* iCol */)) % 32))
 12325  				}
 12326  			}
 12327  
 12328  			break
 12329  
 12330  		}
 12331  
 12332  	case 'x':
 12333  		fallthrough
 12334  	case 'y':
 12335  		{
 12336  			var nMul int32 = func() int32 {
 12337  				if int32(f) == 'x' {
 12338  					return 3
 12339  				}
 12340  				return 1
 12341  			}()
 12342  			var iPhrase int32
 12343  
 12344  			for i = 0; i < ((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol * (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase); i++ {
 12345  				*(*u32)(unsafe.Pointer(aOut + uintptr((i*nMul))*4)) = u32(0)
 12346  			}
 12347  
 12348  			for iPhrase = 0; iPhrase < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase; iPhrase++ {
 12349  				// var iter Fts5PhraseIter at bp+24, 16
 12350  
 12351  				// var iOff int32 at bp+44, 4
 12352  
 12353  				// var iCol int32 at bp+40, 4
 12354  
 12355  				for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 128 /* &.xPhraseFirst */))))(tls, pFts, iPhrase, bp+24 /* &iter */, bp+40 /* &iCol */, bp+44 /* &iOff */); *(*int32)(unsafe.Pointer(bp + 44 /* iOff */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 136 /* &.xPhraseNext */))))(tls, pFts, bp+24 /* &iter */, bp+40 /* &iCol */, bp+44 /* &iOff */) {
 12356  					*(*u32)(unsafe.Pointer(aOut + uintptr((nMul*(*(*int32)(unsafe.Pointer(bp + 40 /* iCol */))+(iPhrase*(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol))))*4))++
 12357  				}
 12358  			}
 12359  
 12360  			break
 12361  
 12362  		}
 12363  
 12364  	case 'l':
 12365  		{
 12366  			for i = 0; (rc == SQLITE_OK) && (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol); i++ {
 12367  				// var nToken int32 at bp+48, 4
 12368  
 12369  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 96 /* &.xColumnSize */))))(tls, pFts, i, bp+48 /* &nToken */)
 12370  				*(*u32)(unsafe.Pointer(aOut + uintptr(i)*4)) = u32(*(*int32)(unsafe.Pointer(bp + 48 /* nToken */)))
 12371  			}
 12372  			break
 12373  
 12374  		}
 12375  
 12376  	case 's':
 12377  		{
 12378  			// var nInst int32 at bp+52, 4
 12379  
 12380  			libc.Xmemset(tls, aOut, 0, (uint64(unsafe.Sizeof(u32(0))) * uint64((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)))
 12381  
 12382  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xInstCount */))))(tls, pFts, bp+52 /* &nInst */)
 12383  			for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 52 /* nInst */))); i++ {
 12384  				// var iPhrase int32 at bp+56, 4
 12385  
 12386  				// var iOff int32 at bp+64, 4
 12387  
 12388  				*(*int32)(unsafe.Pointer(bp + 60 /* iCol */)) = 0
 12389  				var iNextPhrase int32
 12390  				var iNextOff int32
 12391  				var nSeq u32 = u32(1)
 12392  				var j int32
 12393  
 12394  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xInst */))))(tls, pFts, i, bp+56 /* &iPhrase */, bp+60 /* &iCol */, bp+64 /* &iOff */)
 12395  				iNextPhrase = (*(*int32)(unsafe.Pointer(bp + 56 /* iPhrase */)) + 1)
 12396  				iNextOff = (*(*int32)(unsafe.Pointer(bp + 64 /* iOff */)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pApi + 56 /* &.xPhraseSize */))))(tls, pFts, 0))
 12397  				for j = (i + 1); (rc == SQLITE_OK) && (j < *(*int32)(unsafe.Pointer(bp + 52 /* nInst */))); j++ {
 12398  					// var ip int32 at bp+68, 4
 12399  
 12400  					// var ic int32 at bp+72, 4
 12401  
 12402  					// var io int32 at bp+76, 4
 12403  
 12404  					rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xInst */))))(tls, pFts, j, bp+68 /* &ip */, bp+72 /* &ic */, bp+76 /* &io */)
 12405  					if (*(*int32)(unsafe.Pointer(bp + 72 /* ic */)) != *(*int32)(unsafe.Pointer(bp + 60 /* iCol */))) || (*(*int32)(unsafe.Pointer(bp + 76 /* io */)) > iNextOff) {
 12406  						break
 12407  					}
 12408  					if (*(*int32)(unsafe.Pointer(bp + 68 /* ip */)) == iNextPhrase) && (*(*int32)(unsafe.Pointer(bp + 76 /* io */)) == iNextOff) {
 12409  						nSeq++
 12410  						iNextPhrase = (*(*int32)(unsafe.Pointer(bp + 68 /* ip */)) + 1)
 12411  						iNextOff = (*(*int32)(unsafe.Pointer(bp + 76 /* io */)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pApi + 56 /* &.xPhraseSize */))))(tls, pFts, *(*int32)(unsafe.Pointer(bp + 68 /* ip */))))
 12412  					}
 12413  				}
 12414  
 12415  				if nSeq > *(*u32)(unsafe.Pointer(aOut + uintptr(*(*int32)(unsafe.Pointer(bp + 60 /* iCol */)))*4)) {
 12416  					*(*u32)(unsafe.Pointer(aOut + uintptr(*(*int32)(unsafe.Pointer(bp + 60 /* iCol */)))*4)) = nSeq
 12417  				}
 12418  			}
 12419  
 12420  			break
 12421  
 12422  		}
 12423  	}
 12424  	return rc
 12425  }
 12426  
 12427  func fts5MatchinfoNew(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, zArg uintptr) uintptr { /* fts5_test_mi.c:301:25: */
 12428  	bp := tls.Alloc(8)
 12429  	defer tls.Free(8)
 12430  
 12431  	var p uintptr
 12432  	var nCol int32
 12433  	var nPhrase int32
 12434  	var i int32
 12435  	var nInt int32
 12436  	var nByte sqlite3_int64
 12437  	var rc int32
 12438  
 12439  	nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 16 /* &.xColumnCount */))))(tls, pFts)
 12440  	nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 48 /* &.xPhraseCount */))))(tls, pFts)
 12441  
 12442  	nInt = 0
 12443  	for i = 0; *(*int8)(unsafe.Pointer(zArg + uintptr(i))) != 0; i++ {
 12444  		var n int32 = fts5MatchinfoFlagsize(tls, nCol, nPhrase, *(*int8)(unsafe.Pointer(zArg + uintptr(i))))
 12445  		if n < 0 {
 12446  			var zErr uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+2992 /* "unrecognized mat..." */, libc.VaList(bp, int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i))))))
 12447  			sqlite3.Xsqlite3_result_error(tls, pCtx, zErr, -1)
 12448  			sqlite3.Xsqlite3_free(tls, zErr)
 12449  			return uintptr(0)
 12450  		}
 12451  		nInt = nInt + (n)
 12452  	}
 12453  
 12454  	nByte = (sqlite3_int64((uint64(unsafe.Sizeof(Fts5MatchinfoCtx{})) + // The struct itself
 12455  		(uint64(unsafe.Sizeof(u32(0))) * uint64(nInt))) + // The p->aRet[] array
 12456  		(uint64(i + 1)))) // The p->zArg string
 12457  	p = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 12458  	if p == uintptr(0) {
 12459  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 12460  		return uintptr(0)
 12461  	}
 12462  	libc.Xmemset(tls, p, 0, uint64(nByte))
 12463  
 12464  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol = nCol
 12465  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase = nPhrase
 12466  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet = (p + 1*32)
 12467  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnRet = nInt
 12468  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg = ((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet + uintptr(nInt)*4)
 12469  	libc.Xmemcpy(tls, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg, zArg, uint64(i))
 12470  
 12471  	rc = fts5MatchinfoIter(tls, pApi, pFts, p, *(*uintptr)(unsafe.Pointer(&struct {
 12472  		f func(*libc.TLS, uintptr, uintptr, uintptr, int8, uintptr) int32
 12473  	}{fts5MatchinfoGlobalCb})))
 12474  	if rc != SQLITE_OK {
 12475  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 12476  		sqlite3.Xsqlite3_free(tls, p)
 12477  		p = uintptr(0)
 12478  	}
 12479  
 12480  	return p
 12481  }
 12482  
 12483  func fts5MatchinfoFunc(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* fts5_test_mi.c:357:13: */
 12484  	var zArg uintptr
 12485  	var p uintptr
 12486  	var rc int32 = SQLITE_OK
 12487  
 12488  	if nVal > 0 {
 12489  		zArg = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 12490  	} else {
 12491  		zArg = ts + 3024 /* "pcx" */
 12492  	}
 12493  
 12494  	p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((pApi + 120 /* &.xGetAuxdata */))))(tls, pFts, 0)
 12495  	if (p == uintptr(0)) || (sqlite3.Xsqlite3_stricmp(tls, zArg, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg) != 0) {
 12496  		p = fts5MatchinfoNew(tls, pApi, pFts, pCtx, zArg)
 12497  		if p == uintptr(0) {
 12498  			rc = SQLITE_NOMEM
 12499  		} else {
 12500  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 112 /* &.xSetAuxdata */))))(tls, pFts, p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 12501  		}
 12502  	}
 12503  
 12504  	if rc == SQLITE_OK {
 12505  		rc = fts5MatchinfoIter(tls, pApi, pFts, p, *(*uintptr)(unsafe.Pointer(&struct {
 12506  			f func(*libc.TLS, uintptr, uintptr, uintptr, int8, uintptr) int32
 12507  		}{fts5MatchinfoLocalCb})))
 12508  	}
 12509  	if rc != SQLITE_OK {
 12510  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 12511  	} else {
 12512  		// No errors has occured, so return a copy of the array of integers.
 12513  		var nByte int32 = (int32(uint64((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnRet) * uint64(unsafe.Sizeof(u32(0)))))
 12514  		sqlite3.Xsqlite3_result_blob(tls, pCtx, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet, nByte, libc.UintptrFromInt32(-1))
 12515  	}
 12516  }
 12517  
 12518  func sqlite3Fts5TestRegisterMatchinfo(tls *libc.TLS, db uintptr) int32 { /* fts5_test_mi.c:396:5: */
 12519  	bp := tls.Alloc(8)
 12520  	defer tls.Free(8)
 12521  
 12522  	var rc int32 // Return code
 12523  	// var pApi uintptr at bp, 8
 12524  	// FTS5 API functions
 12525  
 12526  	// Extract the FTS5 API pointer from the database handle. The
 12527  	// fts5_api_from_db() function above is copied verbatim from the
 12528  	// FTS5 documentation. Refer there for details.
 12529  	rc = fts5_api_from_db(tls, db, bp /* &pApi */)
 12530  	if rc != SQLITE_OK {
 12531  		return rc
 12532  	}
 12533  
 12534  	/* If fts5_api_from_db() returns NULL, then either FTS5 is not registered
 12535  	 ** with this database handle, or an error (OOM perhaps?) has occurred.
 12536  	 **
 12537  	 ** Also check that the fts5_api object is version 2 or newer.
 12538  	 */
 12539  	if (*(*uintptr)(unsafe.Pointer(bp /* pApi */)) == uintptr(0)) || ((*fts5_api)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pApi */)))).FiVersion < 2) {
 12540  		return SQLITE_ERROR
 12541  	}
 12542  
 12543  	// Register the implementation of matchinfo()
 12544  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, fts5_extension_function, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pApi */)) + 24 /* &.xCreateFunction */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pApi */)), ts+3028 /* "matchinfo" */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 12545  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr)
 12546  	}{fts5MatchinfoFunc})), uintptr(0))
 12547  
 12548  	return rc
 12549  }
 12550  
 12551  type Fts5tokTable1 = struct {
 12552  	Fbase sqlite3_vtab
 12553  	Ftok  fts5_tokenizer
 12554  	FpTok uintptr
 12555  } /* fts5_test_tok.c:47:9 */
 12556  
 12557  type Fts5tokTable = Fts5tokTable1 /* fts5_test_tok.c:47:29 */
 12558  type Fts5tokCursor1 = struct {
 12559  	Fbase   sqlite3_vtab_cursor
 12560  	FiRowid int32
 12561  	_       [4]byte
 12562  	FzInput uintptr
 12563  	FnRow   int32
 12564  	_       [4]byte
 12565  	FaRow   uintptr
 12566  } /* fts5_test_tok.c:48:9 */
 12567  
 12568  type Fts5tokCursor = Fts5tokCursor1 /* fts5_test_tok.c:48:30 */
 12569  type Fts5tokRow1 = struct {
 12570  	FzToken uintptr
 12571  	FiStart int32
 12572  	FiEnd   int32
 12573  	FiPos   int32
 12574  	_       [4]byte
 12575  } /* fts5_test_tok.c:48:9 */
 12576  
 12577  type Fts5tokRow = Fts5tokRow1 /* fts5_test_tok.c:49:27 */
 12578  
 12579  func fts5tokDequote(tls *libc.TLS, z uintptr) { /* fts5_test_tok.c:81:13: */
 12580  	var q int8 = *(*int8)(unsafe.Pointer(z))
 12581  
 12582  	if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 12583  		var iIn int32 = 1
 12584  		var iOut int32 = 0
 12585  		if int32(q) == '[' {
 12586  			q = int8(']')
 12587  		}
 12588  
 12589  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 12590  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 12591  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 12592  					// Character iIn was the close quote.
 12593  					iIn++
 12594  					break
 12595  				} else {
 12596  					// Character iIn and iIn+1 form an escaped quote character. Skip
 12597  					// the input cursor past both and copy a single quote character
 12598  					// to the output buffer.
 12599  					iIn = iIn + (2)
 12600  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 12601  				}
 12602  			} else {
 12603  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 12604  			}
 12605  		}
 12606  
 12607  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 12608  	}
 12609  }
 12610  
 12611  // The second argument, argv[], is an array of pointers to nul-terminated
 12612  // strings. This function makes a copy of the array and strings into a
 12613  // single block of memory. It then dequotes any of the strings that appear
 12614  // to be quoted.
 12615  //
 12616  // If successful, output parameter *pazDequote is set to point at the
 12617  // array of dequoted strings and SQLITE_OK is returned. The caller is
 12618  // responsible for eventually calling sqlite3_free() to free the array
 12619  // in this case. Or, if an error occurs, an SQLite error code is returned.
 12620  // The final value of *pazDequote is undefined in this case.
 12621  func fts5tokDequoteArray(tls *libc.TLS, argc int32, argv uintptr, pazDequote uintptr) int32 { /* fts5_test_tok.c:123:12: */
 12622  	var rc int32 = SQLITE_OK // Return code
 12623  	if argc == 0 {
 12624  		*(*uintptr)(unsafe.Pointer(pazDequote)) = uintptr(0)
 12625  	} else {
 12626  		var i int32
 12627  		var nByte int32 = 0
 12628  		var azDequote uintptr
 12629  
 12630  		for i = 0; i < argc; i++ {
 12631  			nByte = nByte + (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) + uint64(1)))
 12632  		}
 12633  
 12634  		*(*uintptr)(unsafe.Pointer(pazDequote)) = libc.AssignUintptr(&azDequote, sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(uintptr(0)))*uint64(argc))+uint64(nByte)))))
 12635  		if azDequote == uintptr(0) {
 12636  			rc = SQLITE_NOMEM
 12637  		} else {
 12638  			var pSpace uintptr = (azDequote + uintptr(argc)*8)
 12639  			for i = 0; i < argc; i++ {
 12640  				var n int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 12641  				*(*uintptr)(unsafe.Pointer(azDequote + uintptr(i)*8)) = pSpace
 12642  				libc.Xmemcpy(tls, pSpace, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (uint64(n + 1)))
 12643  				fts5tokDequote(tls, pSpace)
 12644  				pSpace += (uintptr(n + 1))
 12645  			}
 12646  		}
 12647  	}
 12648  
 12649  	return rc
 12650  }
 12651  
 12652  // Schema of the tokenizer table.
 12653  
 12654  // This function does all the work for both the xConnect and xCreate methods.
 12655  // These tables have no persistent representation of their own, so xConnect
 12656  // and xCreate are identical operations.
 12657  //
 12658  //   argv[0]: module name
 12659  //   argv[1]: database name
 12660  //   argv[2]: table name
 12661  //   argv[3]: first argument (tokenizer name)
 12662  func fts5tokConnectMethod(tls *libc.TLS, db uintptr, pCtx uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fts5_test_tok.c:173:12: */
 12663  	bp := tls.Alloc(16)
 12664  	defer tls.Free(16)
 12665  
 12666  	var pApi uintptr = pCtx
 12667  	var pTab uintptr = uintptr(0)
 12668  	var rc int32
 12669  	*(*uintptr)(unsafe.Pointer(bp /* azDequote */)) = uintptr(0)
 12670  	var nDequote int32 = 0
 12671  
 12672  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 12673  		ts+3038 /* "CREATE TABLE x(i..." */)
 12674  
 12675  	if rc == SQLITE_OK {
 12676  		nDequote = (argc - 3)
 12677  		rc = fts5tokDequoteArray(tls, nDequote, (argv + 3*8), bp /* &azDequote */)
 12678  	}
 12679  
 12680  	if rc == SQLITE_OK {
 12681  		pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5tokTable{})))
 12682  		if pTab == uintptr(0) {
 12683  			rc = SQLITE_NOMEM
 12684  		} else {
 12685  			libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(Fts5tokTable{})))
 12686  		}
 12687  	}
 12688  
 12689  	if rc == SQLITE_OK {
 12690  		*(*uintptr)(unsafe.Pointer(bp + 8 /* pTokCtx */)) = uintptr(0)
 12691  		var zModule uintptr = uintptr(0)
 12692  		if nDequote > 0 {
 12693  			zModule = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* azDequote */))))
 12694  		}
 12695  
 12696  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 16 /* &.xFindTokenizer */))))(tls, pApi, zModule, bp+8 /* &pTokCtx */, (pTab + 24 /* &.tok */))
 12697  		if rc == SQLITE_OK {
 12698  			var azArg uintptr = func() uintptr {
 12699  				if nDequote > 1 {
 12700  					return (*(*uintptr)(unsafe.Pointer(bp /* azDequote */)) + 1*8)
 12701  				}
 12702  				return uintptr(0)
 12703  			}()
 12704  			var nArg int32
 12705  			if nDequote > 0 {
 12706  				nArg = (nDequote - 1)
 12707  			} else {
 12708  				nArg = 0
 12709  			}
 12710  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pTab + 24 /* &.tok */ /* &.xCreate */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pTokCtx */)), azArg, nArg, (pTab + 48 /* &.pTok */))
 12711  		}
 12712  	}
 12713  
 12714  	if rc != SQLITE_OK {
 12715  		sqlite3.Xsqlite3_free(tls, pTab)
 12716  		pTab = uintptr(0)
 12717  	}
 12718  
 12719  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pTab
 12720  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* azDequote */)))
 12721  	return rc
 12722  }
 12723  
 12724  // This function does the work for both the xDisconnect and xDestroy methods.
 12725  // These tables have no persistent representation of their own, so xDisconnect
 12726  // and xDestroy are identical operations.
 12727  func fts5tokDisconnectMethod(tls *libc.TLS, pVtab uintptr) int32 { /* fts5_test_tok.c:235:12: */
 12728  	var pTab uintptr = pVtab
 12729  	if (*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok != 0 {
 12730  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pTab + 24 /* &.tok */ + 8 /* &.xDelete */))))(tls, (*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok)
 12731  	}
 12732  	sqlite3.Xsqlite3_free(tls, pTab)
 12733  	return SQLITE_OK
 12734  }
 12735  
 12736  // xBestIndex - Analyze a WHERE and ORDER BY clause.
 12737  func fts5tokBestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* fts5_test_tok.c:247:12: */
 12738  	var i int32
 12739  
 12740  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint; i++ {
 12741  		if (((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).Fusable != 0) &&
 12742  			((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).FiColumn == 0)) &&
 12743  			(int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 12744  			(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = 1
 12745  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 12746  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 12747  			(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(1)
 12748  			return SQLITE_OK
 12749  		}
 12750  	}
 12751  
 12752  	(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = 0
 12753  
 12754  	return SQLITE_OK
 12755  }
 12756  
 12757  // xOpen - Open a cursor.
 12758  func fts5tokOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* fts5_test_tok.c:275:12: */
 12759  	var pCsr uintptr
 12760  
 12761  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5tokCursor{})))
 12762  	if pCsr == uintptr(0) {
 12763  		return SQLITE_NOMEM
 12764  	}
 12765  	libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(Fts5tokCursor{})))
 12766  
 12767  	*(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr
 12768  	return SQLITE_OK
 12769  }
 12770  
 12771  // Reset the tokenizer cursor passed as the only argument. As if it had
 12772  // just been returned by fts5tokOpenMethod().
 12773  func fts5tokResetCursor(tls *libc.TLS, pCsr uintptr) { /* fts5_test_tok.c:292:13: */
 12774  	var i int32
 12775  	for i = 0; i < (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow; i++ {
 12776  		sqlite3.Xsqlite3_free(tls, (*Fts5tokRow)(unsafe.Pointer((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow+uintptr(i)*24)).FzToken)
 12777  	}
 12778  	sqlite3.Xsqlite3_free(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput)
 12779  	sqlite3.Xsqlite3_free(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow)
 12780  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput = uintptr(0)
 12781  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow = uintptr(0)
 12782  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow = 0
 12783  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid = 0
 12784  }
 12785  
 12786  // xClose - Close a cursor.
 12787  func fts5tokCloseMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:308:12: */
 12788  	var pCsr uintptr = pCursor
 12789  	fts5tokResetCursor(tls, pCsr)
 12790  	sqlite3.Xsqlite3_free(tls, pCsr)
 12791  	return SQLITE_OK
 12792  }
 12793  
 12794  // xNext - Advance the cursor to the next row, if any.
 12795  func fts5tokNextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:318:12: */
 12796  	var pCsr uintptr = pCursor
 12797  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid++
 12798  	return SQLITE_OK
 12799  }
 12800  
 12801  func fts5tokCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_test_tok.c:324:12: */
 12802  	var pCsr uintptr = pCtx
 12803  	var pRow uintptr
 12804  
 12805  	if ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow & ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow - 1)) == 0 {
 12806  		var nNew int32
 12807  		if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow != 0 {
 12808  			nNew = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow * 2)
 12809  		} else {
 12810  			nNew = 32
 12811  		}
 12812  		var aNew uintptr
 12813  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(Fts5tokRow{})))))
 12814  		if aNew == uintptr(0) {
 12815  			return SQLITE_NOMEM
 12816  		}
 12817  		libc.Xmemset(tls, (aNew + uintptr((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow)*24), 0, (uint64(unsafe.Sizeof(Fts5tokRow{})) * (uint64(nNew - (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow))))
 12818  		(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow = aNew
 12819  	}
 12820  
 12821  	pRow = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow + uintptr((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow)*24)
 12822  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FiStart = iStart
 12823  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FiEnd = iEnd
 12824  	if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow != 0 {
 12825  		(*Fts5tokRow)(unsafe.Pointer(pRow)).FiPos = ((*Fts5tokRow)(unsafe.Pointer(pRow+libc.UintptrFromInt32(-1)*24)).FiPos + (func() int32 {
 12826  			if (tflags & FTS5_TOKEN_COLOCATED) != 0 {
 12827  				return 0
 12828  			}
 12829  			return 1
 12830  		}()))
 12831  	}
 12832  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken = sqlite3.Xsqlite3_malloc(tls, (nToken + 1))
 12833  	if (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken == uintptr(0) {
 12834  		return SQLITE_NOMEM
 12835  	}
 12836  	libc.Xmemcpy(tls, (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken, pToken, uint64(nToken))
 12837  	*(*int8)(unsafe.Pointer((*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken + uintptr(nToken))) = int8(0)
 12838  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow++
 12839  
 12840  	return SQLITE_OK
 12841  }
 12842  
 12843  // xFilter - Initialize a cursor to point at the start of its data.
 12844  func fts5tokFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, nVal int32, apVal uintptr) int32 { /* fts5_test_tok.c:362:12: */
 12845  	var rc int32 = SQLITE_ERROR
 12846  	var pCsr uintptr = pCursor
 12847  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 12848  
 12849  	fts5tokResetCursor(tls, pCsr)
 12850  	if idxNum == 1 {
 12851  		var zByte uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 12852  		var nByte int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 12853  		(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput = sqlite3.Xsqlite3_malloc(tls, (nByte + 1))
 12854  		if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput == uintptr(0) {
 12855  			rc = SQLITE_NOMEM
 12856  		} else {
 12857  			if nByte > 0 {
 12858  				libc.Xmemcpy(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput, zByte, uint64(nByte))
 12859  			}
 12860  			*(*int8)(unsafe.Pointer((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput + uintptr(nByte))) = int8(0)
 12861  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((pTab + 24 /* &.tok */ + 16 /* &.xTokenize */))))(tls,
 12862  				(*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok, pCsr, 0, zByte, nByte, *(*uintptr)(unsafe.Pointer(&struct {
 12863  					f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 12864  				}{fts5tokCb})))
 12865  		}
 12866  	}
 12867  
 12868  	if rc != SQLITE_OK {
 12869  		return rc
 12870  	}
 12871  	return fts5tokNextMethod(tls, pCursor)
 12872  }
 12873  
 12874  // xEof - Return true if the cursor is at EOF, or false otherwise.
 12875  func fts5tokEofMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:396:12: */
 12876  	var pCsr uintptr = pCursor
 12877  	return (libc.Bool32((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid > (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow))
 12878  }
 12879  
 12880  // xColumn - Return a column value.
 12881  func fts5tokColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) int32 { /* fts5_test_tok.c:404:12: */
 12882  	var pCsr uintptr = pCursor
 12883  	var pRow uintptr = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow + uintptr(((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid-1))*24)
 12884  
 12885  	// CREATE TABLE x(input, token, start, end, position)
 12886  	switch iCol {
 12887  	case 0:
 12888  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput, -1, libc.UintptrFromInt32(-1))
 12889  		break
 12890  	case 1:
 12891  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken, -1, libc.UintptrFromInt32(-1))
 12892  		break
 12893  	case 2:
 12894  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiStart)
 12895  		break
 12896  	case 3:
 12897  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiEnd)
 12898  		break
 12899  	default:
 12900  
 12901  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiPos)
 12902  		break
 12903  	}
 12904  	return SQLITE_OK
 12905  }
 12906  
 12907  // xRowid - Return the current rowid for the cursor.
 12908  func fts5tokRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* fts5_test_tok.c:437:12: */
 12909  	var pCsr uintptr = pCursor
 12910  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3_int64((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid)
 12911  	return SQLITE_OK
 12912  }
 12913  
 12914  // Register the fts5tok module with database connection db. Return SQLITE_OK
 12915  // if successful or an error code if sqlite3_create_module() fails.
 12916  func sqlite3Fts5TestRegisterTok(tls *libc.TLS, db uintptr, pApi uintptr) int32 { /* fts5_test_tok.c:450:5: */
 12917  	var rc int32 // Return code
 12918  
 12919  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3096 /* "fts5tokenize" */, uintptr(unsafe.Pointer(&fts5tok_module)), pApi)
 12920  	return rc
 12921  }
 12922  
 12923  var fts5tok_module = sqlite3_module{ // iVersion
 12924  	FxCreate:     0, // xCreate
 12925  	FxConnect:    0, // xConnect
 12926  	FxBestIndex:  0, // xBestIndex
 12927  	FxDisconnect: 0, // xDisconnect
 12928  	FxDestroy:    0, // xDestroy
 12929  	FxOpen:       0, // xOpen
 12930  	FxClose:      0, // xClose
 12931  	FxFilter:     0, // xFilter
 12932  	FxNext:       0, // xNext
 12933  	FxEof:        0, // xEof
 12934  	FxColumn:     0, // xColumn
 12935  	FxRowid:      0, // xShadowName
 12936  } /* fts5_test_tok.c:451:31 */
 12937  
 12938  // CAPI3REF: Loadable Extension Thunk
 12939  //
 12940  // A pointer to the opaque sqlite3_api_routines structure is passed as
 12941  // the third parameter to entry points of [loadable extensions].  This
 12942  // structure must be typedefed in order to work around compiler warnings
 12943  // on some platforms.
 12944  type sqlite3_api_routines = sqlite3_api_routines1 /* sqlite3.h:1216:37 */
 12945  
 12946  // This is the function signature used for all extension entry points.  It
 12947  // is also defined in the file "loadext.c".
 12948  type sqlite3_loadext_entry = uintptr /* sqlite3ext.h:346:13 */
 12949  
 12950  // The append mark at the end of the database is:
 12951  //
 12952  //     Start-Of-SQLite3-NNNNNNNN
 12953  //     123456789 123456789 12345
 12954  //
 12955  // The NNNNNNNN represents a 64-bit big-endian unsigned integer which is
 12956  // the offset to page 1, and also the length of the prefix content.
 12957  
 12958  // Maximum size of the combined prefix + database + append-mark.  This
 12959  // must be less than 0x40000000 to avoid locking issues on Windows.
 12960  
 12961  // Try to align the database to an even multiple of APND_ROUNDUP bytes.
 12962  
 12963  // Forward declaration of objects used by this utility
 12964  type ApndVfs = sqlite3_vfs1 /* appendvfs.c:85:28 */
 12965  type ApndFile1 = struct {
 12966  	Fbase   sqlite3_file
 12967  	FiPgOne sqlite3_int64
 12968  	FiMark  sqlite3_int64
 12969  } /* appendvfs.c:86:9 */
 12970  
 12971  type ApndFile = ApndFile1 /* appendvfs.c:86:25 */
 12972  
 12973  var apnd_vfs = sqlite3_vfs{
 12974  	FiVersion:          3,         // szOsFile (set when registered)
 12975  	FmxPathname:        1024,      // pNext
 12976  	FzName:             ts + 3109, /* "apndvfs" */ /* pAppData (set when registered) */
 12977  	FxOpen:             0,         // xOpen
 12978  	FxDelete:           0,         // xDelete
 12979  	FxAccess:           0,         // xAccess
 12980  	FxFullPathname:     0,         // xFullPathname
 12981  	FxDlOpen:           0,         // xDlOpen
 12982  	FxDlError:          0,         // xDlError
 12983  	FxDlSym:            0,         // xDlSym
 12984  	FxDlClose:          0,         // xDlClose
 12985  	FxRandomness:       0,         // xRandomness
 12986  	FxSleep:            0,         // xSleep
 12987  	FxCurrentTime:      0,         // xCurrentTime
 12988  	FxGetLastError:     0,         // xGetLastError
 12989  	FxCurrentTimeInt64: 0,         // xCurrentTimeInt64
 12990  	FxSetSystemCall:    0,         // xSetSystemCall
 12991  	FxGetSystemCall:    0,         // xGetSystemCall
 12992  	FxNextSystemCall:   0,         // xNextSystemCall
 12993  } /* appendvfs.c:177:20 */
 12994  
 12995  var apnd_io_methods = sqlite3_io_methods{
 12996  	FiVersion:               3, // iVersion
 12997  	FxClose:                 0, // xClose
 12998  	FxRead:                  0, // xRead
 12999  	FxWrite:                 0, // xWrite
 13000  	FxTruncate:              0, // xTruncate
 13001  	FxSync:                  0, // xSync
 13002  	FxFileSize:              0, // xFileSize
 13003  	FxLock:                  0, // xLock
 13004  	FxUnlock:                0, // xUnlock
 13005  	FxCheckReservedLock:     0, // xCheckReservedLock
 13006  	FxFileControl:           0, // xFileControl
 13007  	FxSectorSize:            0, // xSectorSize
 13008  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 13009  	FxShmMap:                0, // xShmMap
 13010  	FxShmLock:               0, // xShmLock
 13011  	FxShmBarrier:            0, // xShmBarrier
 13012  	FxShmUnmap:              0, // xShmUnmap
 13013  	FxFetch:                 0, // xFetch
 13014  	FxUnfetch:               0, // xUnfetch
 13015  } /* appendvfs.c:202:33 */
 13016  
 13017  // Close an apnd-file.
 13018  func apndClose(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:227:12: */
 13019  	pFile = ((pFile) + uintptr(1)*24)
 13020  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xClose */))))(tls, pFile)
 13021  }
 13022  
 13023  // Read data from an apnd-file.
 13024  func apndRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* appendvfs.c:235:12: */
 13025  	var paf uintptr = pFile
 13026  	pFile = ((pFile) + uintptr(1)*24)
 13027  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xRead */))))(tls, pFile, zBuf, iAmt, ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iOfst))
 13028  }
 13029  
 13030  // Add the append-mark onto what should become the end of the file.
 13031  //  If and only if this succeeds, internal ApndFile.iMark is updated.
 13032  //  Parameter iWriteEnd is the appendvfs-relative offset of the new mark.
 13033  func apndWriteMark(tls *libc.TLS, paf uintptr, pFile uintptr, iWriteEnd sqlite_int64) int32 { /* appendvfs.c:251:12: */
 13034  	bp := tls.Alloc(25)
 13035  	defer tls.Free(25)
 13036  
 13037  	var iPgOne sqlite_int64 = (*ApndFile)(unsafe.Pointer(paf)).FiPgOne
 13038  	// var a [25]uint8 at bp, 25
 13039  
 13040  	var i int32 = APND_MARK_FOS_SZ
 13041  	var rc int32
 13042  
 13043  	libc.Xmemcpy(tls, bp /* &a[0] */, ts+3117 /* "Start-Of-SQLite3..." */, uint64(APND_MARK_PREFIX_SZ))
 13044  	for libc.PreDecInt32(&i, 1) >= 0 {
 13045  		*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + uintptr((APND_MARK_PREFIX_SZ + i)))) = (uint8(iPgOne & int64(0xff)))
 13046  		iPgOne >>= 8
 13047  	}
 13048  	iWriteEnd = iWriteEnd + ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13049  	if SQLITE_OK == (libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 24 /* &.xWrite */))))(tls, pFile, bp /* &a[0] */, (APND_MARK_PREFIX_SZ+APND_MARK_FOS_SZ), iWriteEnd))) {
 13050  		(*ApndFile)(unsafe.Pointer(paf)).FiMark = iWriteEnd
 13051  	}
 13052  	return rc
 13053  }
 13054  
 13055  // Write data to an apnd-file.
 13056  func apndWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* appendvfs.c:277:12: */
 13057  	var paf uintptr = pFile
 13058  	var iWriteEnd sqlite_int64 = (iOfst + sqlite_int64(iAmt))
 13059  	if iWriteEnd >= (int64(0x40000000)) {
 13060  		return SQLITE_FULL
 13061  	}
 13062  	pFile = ((pFile) + uintptr(1)*24)
 13063  	// If append-mark is absent or will be overwritten, write it.
 13064  	if ((*ApndFile)(unsafe.Pointer(paf)).FiMark < int64(0)) || (((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iWriteEnd) > (*ApndFile)(unsafe.Pointer(paf)).FiMark) {
 13065  		var rc int32 = apndWriteMark(tls, paf, pFile, iWriteEnd)
 13066  		if SQLITE_OK != rc {
 13067  			return rc
 13068  		}
 13069  	}
 13070  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 24 /* &.xWrite */))))(tls, pFile, zBuf, iAmt, ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iOfst))
 13071  }
 13072  
 13073  // Truncate an apnd-file.
 13074  func apndTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* appendvfs.c:298:12: */
 13075  	var paf uintptr = pFile
 13076  	pFile = ((pFile) + uintptr(1)*24)
 13077  	// The append mark goes out first so truncate failure does not lose it.
 13078  	if SQLITE_OK != apndWriteMark(tls, paf, pFile, size) {
 13079  		return SQLITE_IOERR
 13080  	}
 13081  	// Truncate underlying file just past append mark
 13082  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 32 /* &.xTruncate */))))(tls, pFile, ((*ApndFile)(unsafe.Pointer(paf)).FiMark + (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))))
 13083  }
 13084  
 13085  // Sync an apnd-file.
 13086  func apndSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* appendvfs.c:310:12: */
 13087  	pFile = ((pFile) + uintptr(1)*24)
 13088  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 40 /* &.xSync */))))(tls, pFile, flags)
 13089  }
 13090  
 13091  // Return the current file-size of an apnd-file.
 13092  // If the append mark is not yet there, the file-size is 0.
 13093  func apndFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* appendvfs.c:319:12: */
 13094  	var paf uintptr = pFile
 13095  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = func() int64 {
 13096  		if (*ApndFile)(unsafe.Pointer(paf)).FiMark >= int64(0) {
 13097  			return ((*ApndFile)(unsafe.Pointer(paf)).FiMark - (*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13098  		}
 13099  		return int64(0)
 13100  	}()
 13101  	return SQLITE_OK
 13102  }
 13103  
 13104  // Lock an apnd-file.
 13105  func apndLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* appendvfs.c:328:12: */
 13106  	pFile = ((pFile) + uintptr(1)*24)
 13107  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 56 /* &.xLock */))))(tls, pFile, eLock)
 13108  }
 13109  
 13110  // Unlock an apnd-file.
 13111  func apndUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* appendvfs.c:336:12: */
 13112  	pFile = ((pFile) + uintptr(1)*24)
 13113  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 64 /* &.xUnlock */))))(tls, pFile, eLock)
 13114  }
 13115  
 13116  // Check if another file-handle holds a RESERVED lock on an apnd-file.
 13117  func apndCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* appendvfs.c:344:12: */
 13118  	pFile = ((pFile) + uintptr(1)*24)
 13119  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, pFile, pResOut)
 13120  }
 13121  
 13122  // File control method. For custom operations on an apnd-file.
 13123  func apndFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* appendvfs.c:352:12: */
 13124  	bp := tls.Alloc(16)
 13125  	defer tls.Free(16)
 13126  
 13127  	var paf uintptr = pFile
 13128  	var rc int32
 13129  	pFile = ((pFile) + uintptr(1)*24)
 13130  	if op == SQLITE_FCNTL_SIZE_HINT {
 13131  		*(*sqlite3_int64)(unsafe.Pointer(pArg)) += ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13132  	}
 13133  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 80 /* &.xFileControl */))))(tls, pFile, op, pArg)
 13134  	if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) {
 13135  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+3135 /* "apnd(%lld)/%z" */, libc.VaList(bp, (*ApndFile)(unsafe.Pointer(paf)).FiPgOne, *(*uintptr)(unsafe.Pointer(pArg))))
 13136  	}
 13137  	return rc
 13138  }
 13139  
 13140  // Return the sector-size in bytes for an apnd-file.
 13141  func apndSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:367:12: */
 13142  	pFile = ((pFile) + uintptr(1)*24)
 13143  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 88 /* &.xSectorSize */))))(tls, pFile)
 13144  }
 13145  
 13146  // Return the device characteristic flags supported by an apnd-file.
 13147  func apndDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:375:12: */
 13148  	pFile = ((pFile) + uintptr(1)*24)
 13149  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, pFile)
 13150  }
 13151  
 13152  // Create a shared memory file mapping
 13153  func apndShmMap(tls *libc.TLS, pFile uintptr, iPg int32, pgsz int32, bExtend int32, pp uintptr) int32 { /* appendvfs.c:381:12: */
 13154  	pFile = ((pFile) + uintptr(1)*24)
 13155  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 104 /* &.xShmMap */))))(tls, pFile, iPg, pgsz, bExtend, libc.AtomicLoadUintptr(&pp))
 13156  }
 13157  
 13158  // Perform locking on a shared-memory segment
 13159  func apndShmLock(tls *libc.TLS, pFile uintptr, offset int32, n int32, flags int32) int32 { /* appendvfs.c:393:12: */
 13160  	pFile = ((pFile) + uintptr(1)*24)
 13161  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 112 /* &.xShmLock */))))(tls, pFile, offset, n, flags)
 13162  }
 13163  
 13164  // Memory barrier operation on shared memory
 13165  func apndShmBarrier(tls *libc.TLS, pFile uintptr) { /* appendvfs.c:399:13: */
 13166  	pFile = ((pFile) + uintptr(1)*24)
 13167  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pFile)
 13168  }
 13169  
 13170  // Unmap a shared memory segment
 13171  func apndShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* appendvfs.c:405:12: */
 13172  	pFile = ((pFile) + uintptr(1)*24)
 13173  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pFile, deleteFlag)
 13174  }
 13175  
 13176  // Fetch a page of a memory-mapped file
 13177  func apndFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* appendvfs.c:411:12: */
 13178  	var p uintptr = pFile
 13179  	if ((*ApndFile)(unsafe.Pointer(p)).FiMark < int64(0)) || ((iOfst + sqlite3_int64(iAmt)) > (*ApndFile)(unsafe.Pointer(p)).FiMark) {
 13180  		return SQLITE_IOERR // Cannot read what is not yet there.
 13181  	}
 13182  	pFile = ((pFile) + uintptr(1)*24)
 13183  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 136 /* &.xFetch */))))(tls, pFile, (iOfst + (*ApndFile)(unsafe.Pointer(p)).FiPgOne), iAmt, pp)
 13184  }
 13185  
 13186  // Release a memory-mapped page
 13187  func apndUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, pPage uintptr) int32 { /* appendvfs.c:426:12: */
 13188  	var p uintptr = pFile
 13189  	pFile = ((pFile) + uintptr(1)*24)
 13190  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 144 /* &.xUnfetch */))))(tls, pFile, (iOfst + (*ApndFile)(unsafe.Pointer(p)).FiPgOne), pPage)
 13191  }
 13192  
 13193  // Try to read the append-mark off the end of a file.  Return the
 13194  // start of the appended database if the append-mark is present.
 13195  // If there is no valid append-mark, return -1;
 13196  //
 13197  // An append-mark is only valid if the NNNNNNNN start-of-database offset
 13198  // indicates that the appended database contains at least one page.  The
 13199  // start-of-database value must be a multiple of 512.
 13200  func apndReadMark(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) sqlite3_int64 { /* appendvfs.c:441:22: */
 13201  	bp := tls.Alloc(25)
 13202  	defer tls.Free(25)
 13203  
 13204  	var rc int32
 13205  	var i int32
 13206  	var iMark sqlite3_int64
 13207  	var msbs int32 = (8 * (APND_MARK_FOS_SZ - 1))
 13208  	// var a [25]uint8 at bp, 25
 13209  
 13210  	if (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)) != (sz & int64(0x1ff)) {
 13211  		return int64(-1)
 13212  	}
 13213  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xRead */))))(tls, pFile, bp /* &a[0] */, (APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ), (sz - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))))
 13214  	if rc != 0 {
 13215  		return int64(-1)
 13216  	}
 13217  	if libc.Xmemcmp(tls, bp /* &a[0] */, ts+3117 /* "Start-Of-SQLite3..." */, uint64(APND_MARK_PREFIX_SZ)) != 0 {
 13218  		return int64(-1)
 13219  	}
 13220  	iMark = ((sqlite3_int64(int32(*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + 17))) & 0x7f)) << msbs)
 13221  	for i = 1; i < 8; i++ {
 13222  		msbs = msbs - (8)
 13223  		iMark = iMark | (sqlite3_int64(*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + uintptr((APND_MARK_PREFIX_SZ + i))))) << msbs)
 13224  	}
 13225  	if iMark > ((sz - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))) - int64(512)) {
 13226  		return int64(-1)
 13227  	}
 13228  	if (iMark & int64(0x1ff)) != 0 {
 13229  		return int64(-1)
 13230  	}
 13231  	return iMark
 13232  }
 13233  
 13234  var apvfsSqliteHdr = *(*[16]int8)(unsafe.Pointer(ts + 3149 /* "SQLite format 3" */)) /* appendvfs.c:461:19 */
 13235  
 13236  // Check to see if the file is an appendvfs SQLite database file.
 13237  // Return true iff it is such. Parameter sz is the file's size.
 13238  func apndIsAppendvfsDatabase(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) int32 { /* appendvfs.c:466:12: */
 13239  	bp := tls.Alloc(16)
 13240  	defer tls.Free(16)
 13241  
 13242  	var rc int32
 13243  	// var zHdr [16]int8 at bp, 16
 13244  
 13245  	var iMark sqlite3_int64 = apndReadMark(tls, sz, pFile)
 13246  	if iMark >= int64(0) {
 13247  		// If file has the correct end-marker, the expected odd size, and the
 13248  		// SQLite DB type marker where the end-marker puts it, then it
 13249  		// is an appendvfs database.
 13250  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xRead */))))(tls, pFile, bp /* &zHdr[0] */, int32(unsafe.Sizeof([16]int8{})), iMark)
 13251  		if (((SQLITE_OK == rc) &&
 13252  			(libc.Xmemcmp(tls, bp /* &zHdr[0] */, uintptr(unsafe.Pointer(&apvfsSqliteHdr)), uint64(unsafe.Sizeof([16]int8{}))) == 0)) &&
 13253  			((sz & int64(0x1ff)) == (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)))) &&
 13254  			(sz >= (int64(512 + (APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)))) {
 13255  			return 1 // It's an appendvfs database
 13256  		}
 13257  	}
 13258  	return 0
 13259  }
 13260  
 13261  // Check to see if the file is an ordinary SQLite database file.
 13262  // Return true iff so. Parameter sz is the file's size.
 13263  func apndIsOrdinaryDatabaseFile(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) int32 { /* appendvfs.c:491:12: */
 13264  	bp := tls.Alloc(16)
 13265  	defer tls.Free(16)
 13266  
 13267  	// var zHdr [16]int8 at bp, 16
 13268  
 13269  	if (((apndIsAppendvfsDatabase(tls, sz, pFile) != 0) || // rule 2
 13270  		((sz & int64(0x1ff)) != int64(0))) ||
 13271  		(SQLITE_OK != (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xRead */))))(tls, pFile, bp /* &zHdr[0] */, int32(unsafe.Sizeof([16]int8{})), int64(0)))) ||
 13272  		(libc.Xmemcmp(tls, bp /* &zHdr[0] */, uintptr(unsafe.Pointer(&apvfsSqliteHdr)), uint64(unsafe.Sizeof([16]int8{}))) != 0) {
 13273  		return 0
 13274  	} else {
 13275  		return 1
 13276  	}
 13277  	return int32(0)
 13278  }
 13279  
 13280  // Open an apnd file handle.
 13281  func apndOpen(tls *libc.TLS, pApndVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* appendvfs.c:507:12: */
 13282  	bp := tls.Alloc(8)
 13283  	defer tls.Free(8)
 13284  
 13285  	var pApndFile uintptr = pFile
 13286  	var pBaseFile uintptr = ((pFile) + uintptr(1)*24)
 13287  	var pBaseVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pApndVfs)).FpAppData
 13288  	var rc int32
 13289  	*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = int64(0)
 13290  	if (flags & SQLITE_OPEN_MAIN_DB) == 0 {
 13291  		// The appendvfs is not to be used for transient or temporary databases.
 13292  		// Just use the base VFS open to initialize the given file object and
 13293  		// open the underlying file. (Appendvfs is then unused for this file.)
 13294  		return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pBaseVfs + 40 /* &.xOpen */))))(tls, pBaseVfs, zName, pFile, flags, pOutFlags)
 13295  	}
 13296  	libc.Xmemset(tls, pApndFile, 0, uint64(unsafe.Sizeof(ApndFile{})))
 13297  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&apnd_io_methods))
 13298  	(*ApndFile)(unsafe.Pointer(pApndFile)).FiMark = int64(-1) // Append mark not yet written
 13299  
 13300  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pBaseVfs + 40 /* &.xOpen */))))(tls, pBaseVfs, zName, pBaseFile, flags, pOutFlags)
 13301  	if rc == SQLITE_OK {
 13302  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 48 /* &.xFileSize */))))(tls, pBaseFile, bp /* &sz */)
 13303  		if rc != 0 {
 13304  			(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 8 /* &.xClose */))))(tls, pBaseFile)
 13305  		}
 13306  	}
 13307  	if rc != 0 {
 13308  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 13309  		return rc
 13310  	}
 13311  	if apndIsOrdinaryDatabaseFile(tls, *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)), pBaseFile) != 0 {
 13312  		// The file being opened appears to be just an ordinary DB. Copy
 13313  		// the base dispatch-table so this instance mimics the base VFS.
 13314  		libc.Xmemmove(tls, pApndFile, pBaseFile, uint64((*sqlite3_vfs)(unsafe.Pointer(pBaseVfs)).FszOsFile))
 13315  		return SQLITE_OK
 13316  	}
 13317  	(*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne = apndReadMark(tls, *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)), pFile)
 13318  	if (*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne >= int64(0) {
 13319  		(*ApndFile)(unsafe.Pointer(pApndFile)).FiMark = (*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))) // Append mark found
 13320  		return SQLITE_OK
 13321  	}
 13322  	if (flags & SQLITE_OPEN_CREATE) == 0 {
 13323  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 8 /* &.xClose */))))(tls, pBaseFile)
 13324  		rc = SQLITE_CANTOPEN
 13325  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 13326  	} else {
 13327  		// Round newly added appendvfs location to #define'd page boundary.
 13328  		// Note that nothing has yet been written to the underlying file.
 13329  		// The append mark will be written along with first content write.
 13330  		// Until then, paf->iMark value indicates it is not yet written.
 13331  		(*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne = (((*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))) + (int64(APND_ROUNDUP - 1))) & libc.CplInt64((int64(APND_ROUNDUP - 1))))
 13332  	}
 13333  	return rc
 13334  }
 13335  
 13336  // Delete an apnd file.
 13337  // For an appendvfs, this could mean delete the appendvfs portion,
 13338  // leaving the appendee as it was before it gained an appendvfs.
 13339  // For now, this code deletes the underlying file too.
 13340  func apndDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* appendvfs.c:574:12: */
 13341  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 48 /* &.xDelete */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, dirSync)
 13342  }
 13343  
 13344  // All other VFS methods are pass-thrus.
 13345  func apndAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* appendvfs.c:581:12: */
 13346  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 56 /* &.xAccess */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, flags, pResOut)
 13347  }
 13348  
 13349  func apndFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* appendvfs.c:589:12: */
 13350  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 64 /* &.xFullPathname */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, nOut, zOut)
 13351  }
 13352  
 13353  func apndDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* appendvfs.c:597:13: */
 13354  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 72 /* &.xDlOpen */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath)
 13355  }
 13356  
 13357  func apndDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* appendvfs.c:600:13: */
 13358  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 80 /* &.xDlError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg)
 13359  }
 13360  
 13361  func apndDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* appendvfs.c:603:13: */
 13362  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 88 /* &.xDlSym */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym)
 13363  }
 13364  
 13365  func apndDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* appendvfs.c:606:13: */
 13366  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 96 /* &.xDlClose */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle)
 13367  }
 13368  
 13369  func apndRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* appendvfs.c:609:12: */
 13370  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 104 /* &.xRandomness */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut)
 13371  }
 13372  
 13373  func apndSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* appendvfs.c:612:12: */
 13374  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 112 /* &.xSleep */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro)
 13375  }
 13376  
 13377  func apndCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* appendvfs.c:615:12: */
 13378  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 120 /* &.xCurrentTime */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pTimeOut)
 13379  }
 13380  
 13381  func apndGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* appendvfs.c:618:12: */
 13382  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 128 /* &.xGetLastError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b)
 13383  }
 13384  
 13385  func apndCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* appendvfs.c:621:12: */
 13386  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 136 /* &.xCurrentTimeInt64 */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p)
 13387  }
 13388  
 13389  func apndSetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr, pCall sqlite3_syscall_ptr) int32 { /* appendvfs.c:624:12: */
 13390  	return (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 144 /* &.xSetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName, pCall)
 13391  }
 13392  
 13393  func apndGetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) sqlite3_syscall_ptr { /* appendvfs.c:631:28: */
 13394  	return (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 152 /* &.xGetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 13395  }
 13396  
 13397  func apndNextSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) uintptr { /* appendvfs.c:637:19: */
 13398  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 160 /* &.xNextSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 13399  }
 13400  
 13401  // This routine is called when the extension is loaded.
 13402  // Register the new VFS.
 13403  func sqlite3_appendvfs_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* appendvfs.c:649:5: */
 13404  	var rc int32 = SQLITE_OK
 13405  	var pOrig uintptr
 13406  	_ = pApi
 13407  
 13408  	_ = pzErrMsg
 13409  	_ = db
 13410  	pOrig = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 13411  	if pOrig == uintptr(0) {
 13412  		return SQLITE_ERROR
 13413  	}
 13414  	apnd_vfs.FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FiVersion
 13415  	apnd_vfs.FpAppData = pOrig
 13416  	apnd_vfs.FszOsFile = (int32(uint64((*sqlite3_vfs)(unsafe.Pointer(pOrig)).FszOsFile) + uint64(unsafe.Sizeof(ApndFile{}))))
 13417  	rc = sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&apnd_vfs)), 0)
 13418  	if rc == SQLITE_OK {
 13419  		rc = (SQLITE_OK | (int32(1) << 8))
 13420  	}
 13421  	return rc
 13422  }
 13423  
 13424  // internally known to gcc
 13425  
 13426  // When the following macro is defined, the system uses 64-bit inode numbers.
 13427  // Programs can use this to avoid including <sys/param.h>, with its associated
 13428  // namespace pollution.
 13429  
 13430  type rune_t = int32 /* stdlib.h:46:18 */
 13431  
 13432  type div_t = struct {
 13433  	Fquot int32
 13434  	Frem  int32
 13435  } /* stdlib.h:66:3 */
 13436  
 13437  type ldiv_t = struct {
 13438  	Fquot int64
 13439  	Frem  int64
 13440  } /* stdlib.h:71:3 */
 13441  
 13442  // Functions added in C99 which we make conditionally available in the
 13443  // BSD^C89 namespace if the compiler supports `long long'.
 13444  // The #if test is more complicated than it ought to be because
 13445  // __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
 13446  // is not supported in the compilation environment (which therefore means
 13447  // that it can't really be ISO C99).
 13448  //
 13449  // (The only other extension made by C99 in thie header is _Exit().)
 13450  // LONGLONG
 13451  type lldiv_t = struct {
 13452  	Fquot int64
 13453  	Frem  int64
 13454  } /* stdlib.h:142:3 */
 13455  
 13456  // K.3.6
 13457  type constraint_handler_t = uintptr /* stdlib.h:349:14 */
 13458  
 13459  // Use inline functions if we are allowed to and the compiler supports them.
 13460  
 13461  // -
 13462  // SPDX-License-Identifier: BSD-3-Clause
 13463  //
 13464  // Copyright (c) 1993
 13465  //	The Regents of the University of California.  All rights reserved.
 13466  //
 13467  // This code is derived from software contributed to Berkeley by
 13468  // Paul Borman at Krystal Technologies.
 13469  //
 13470  // Redistribution and use in source and binary forms, with or without
 13471  // modification, are permitted provided that the following conditions
 13472  // are met:
 13473  // 1. Redistributions of source code must retain the above copyright
 13474  //    notice, this list of conditions and the following disclaimer.
 13475  // 2. Redistributions in binary form must reproduce the above copyright
 13476  //    notice, this list of conditions and the following disclaimer in the
 13477  //    documentation and/or other materials provided with the distribution.
 13478  // 3. Neither the name of the University nor the names of its contributors
 13479  //    may be used to endorse or promote products derived from this software
 13480  //    without specific prior written permission.
 13481  //
 13482  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 13483  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 13484  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 13485  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 13486  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 13487  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 13488  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 13489  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 13490  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 13491  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 13492  // SUCH DAMAGE.
 13493  //
 13494  //	@(#)runetype.h	8.1 (Berkeley) 6/2/93
 13495  // $FreeBSD$
 13496  
 13497  // -
 13498  // SPDX-License-Identifier: BSD-3-Clause
 13499  //
 13500  // Copyright (c) 1991, 1993
 13501  //	The Regents of the University of California.  All rights reserved.
 13502  //
 13503  // This code is derived from software contributed to Berkeley by
 13504  // Berkeley Software Design, Inc.
 13505  //
 13506  // Redistribution and use in source and binary forms, with or without
 13507  // modification, are permitted provided that the following conditions
 13508  // are met:
 13509  // 1. Redistributions of source code must retain the above copyright
 13510  //    notice, this list of conditions and the following disclaimer.
 13511  // 2. Redistributions in binary form must reproduce the above copyright
 13512  //    notice, this list of conditions and the following disclaimer in the
 13513  //    documentation and/or other materials provided with the distribution.
 13514  // 3. Neither the name of the University nor the names of its contributors
 13515  //    may be used to endorse or promote products derived from this software
 13516  //    without specific prior written permission.
 13517  //
 13518  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 13519  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 13520  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 13521  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 13522  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 13523  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 13524  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 13525  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 13526  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 13527  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 13528  // SUCH DAMAGE.
 13529  //
 13530  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 13531  // $FreeBSD$
 13532  
 13533  // -
 13534  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 13535  //
 13536  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 13537  // All rights reserved.
 13538  //
 13539  // Redistribution and use in source and binary forms, with or without
 13540  // modification, are permitted provided that the following conditions
 13541  // are met:
 13542  // 1. Redistributions of source code must retain the above copyright
 13543  //    notice, this list of conditions and the following disclaimer.
 13544  // 2. Redistributions in binary form must reproduce the above copyright
 13545  //    notice, this list of conditions and the following disclaimer in the
 13546  //    documentation and/or other materials provided with the distribution.
 13547  //
 13548  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 13549  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 13550  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 13551  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 13552  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 13553  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 13554  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 13555  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 13556  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 13557  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 13558  // SUCH DAMAGE.
 13559  //
 13560  // $FreeBSD$
 13561  
 13562  // The lower 8 bits of runetype[] contain the digit value of the rune.
 13563  type _RuneEntry = struct {
 13564  	F__min   int32
 13565  	F__max   int32
 13566  	F__map   int32
 13567  	_        [4]byte
 13568  	F__types uintptr
 13569  } /* runetype.h:55:3 */
 13570  
 13571  type _RuneRange = struct {
 13572  	F__nranges int32
 13573  	_          [4]byte
 13574  	F__ranges  uintptr
 13575  } /* runetype.h:60:3 */
 13576  
 13577  type _RuneLocale = struct {
 13578  	F__magic        [8]int8
 13579  	F__encoding     [32]int8
 13580  	F__sgetrune     uintptr
 13581  	F__sputrune     uintptr
 13582  	F__invalid_rune int32
 13583  	_               [4]byte
 13584  	F__runetype     [256]uint64
 13585  	F__maplower     [256]int32
 13586  	F__mapupper     [256]int32
 13587  	F__runetype_ext _RuneRange
 13588  	F__maplower_ext _RuneRange
 13589  	F__mapupper_ext _RuneRange
 13590  	F__variable     uintptr
 13591  	F__variable_len int32
 13592  	_               [4]byte
 13593  } /* runetype.h:85:3 */
 13594  
 13595  func __getCurrentRuneLocale(tls *libc.TLS) uintptr { /* runetype.h:95:35: */
 13596  
 13597  	if libc.X_ThreadRuneLocale != 0 {
 13598  		return libc.X_ThreadRuneLocale
 13599  	}
 13600  	return libc.X_CurrentRuneLocale
 13601  }
 13602  
 13603  func __maskrune(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:100:1: */
 13604  	return (int32((func() uint64 {
 13605  		if (_c < 0) || (_c >= (int32(1) << 8)) {
 13606  			return libc.X___runetype(tls, _c)
 13607  		}
 13608  		return *(*uint64)(unsafe.Pointer((__getCurrentRuneLocale(tls) + 64 /* &.__runetype */) + uintptr(_c)*8))
 13609  	}()) & _f))
 13610  }
 13611  
 13612  func __sbmaskrune(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:107:1: */
 13613  	if (_c < 0) || (_c >= libc.X__mb_sb_limit) {
 13614  		return 0
 13615  	}
 13616  	return (int32(*(*uint64)(unsafe.Pointer((__getCurrentRuneLocale(tls) + 64 /* &.__runetype */) + uintptr(_c)*8)) & _f))
 13617  }
 13618  
 13619  func __sbistype(tls *libc.TLS, _c int32, _f uint64) int32 { /* _ctype.h:120:1: */
 13620  	return libc.BoolInt32(!(!(__sbmaskrune(tls, _c, _f) != 0)))
 13621  }
 13622  
 13623  func __sbmaskrune_l(tls *libc.TLS, __c int32, __f uint64, __loc locale_t) int32 { /* _ctype.h:104:1: */
 13624  	bp := tls.Alloc(4)
 13625  	defer tls.Free(4)
 13626  
 13627  	// var __limit int32 at bp, 4
 13628  
 13629  	var runes uintptr = libc.X__runes_for_locale(tls, __loc, bp /* &__limit */)
 13630  	if (__c < 0) || (__c >= *(*int32)(unsafe.Pointer(bp /* __limit */))) {
 13631  		return 0
 13632  	}
 13633  	return (int32(*(*uint64)(unsafe.Pointer((runes + 64 /* &.__runetype */) + uintptr(__c)*8)) & __f))
 13634  }
 13635  
 13636  func __sbistype_l(tls *libc.TLS, __c int32, __f uint64, __loc locale_t) int32 { /* _ctype.h:113:1: */
 13637  	return libc.BoolInt32(!(!(tcl.X__sbmaskrune_l(tls, __c, __f, __loc) != 0)))
 13638  }
 13639  
 13640  func isalnum_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:124:1: */
 13641  	return tcl.X__sbistype_l(tls, __c, (uint64((X_CTYPE_A | X_CTYPE_D) | X_CTYPE_N)), __l)
 13642  }
 13643  
 13644  func isalpha_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:125:1: */
 13645  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_A), __l)
 13646  }
 13647  
 13648  func isblank_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:126:1: */
 13649  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_B), __l)
 13650  }
 13651  
 13652  func iscntrl_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:127:1: */
 13653  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_C), __l)
 13654  }
 13655  
 13656  func isdigit_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:128:1: */
 13657  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_D), __l)
 13658  }
 13659  
 13660  func isgraph_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:129:1: */
 13661  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_G), __l)
 13662  }
 13663  
 13664  func ishexnumber_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:130:1: */
 13665  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_X), __l)
 13666  }
 13667  
 13668  func isideogram_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:131:1: */
 13669  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_I), __l)
 13670  }
 13671  
 13672  func islower_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:132:1: */
 13673  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_L), __l)
 13674  }
 13675  
 13676  func isnumber_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:133:1: */
 13677  	return tcl.X__sbistype_l(tls, __c, (uint64(X_CTYPE_D | X_CTYPE_N)), __l)
 13678  }
 13679  
 13680  func isphonogram_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:134:1: */
 13681  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_Q), __l)
 13682  }
 13683  
 13684  func isprint_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:135:1: */
 13685  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_R), __l)
 13686  }
 13687  
 13688  func ispunct_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:136:1: */
 13689  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_P), __l)
 13690  }
 13691  
 13692  func isrune_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:137:1: */
 13693  	return tcl.X__sbistype_l(tls, __c, uint64(0xFFFFFF00), __l)
 13694  }
 13695  
 13696  func isspace_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:138:1: */
 13697  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_S), __l)
 13698  }
 13699  
 13700  func isspecial_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:139:1: */
 13701  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_T), __l)
 13702  }
 13703  
 13704  func isupper_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:140:1: */
 13705  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_U), __l)
 13706  }
 13707  
 13708  func isxdigit_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:141:1: */
 13709  	return tcl.X__sbistype_l(tls, __c, uint64(X_CTYPE_X), __l)
 13710  }
 13711  
 13712  func digittoint_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:186:21: */
 13713  	return tcl.X__sbmaskrune_l(tls, __c, uint64(0xFF), __l)
 13714  }
 13715  
 13716  func tolower_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:189:21: */
 13717  	bp := tls.Alloc(4)
 13718  	defer tls.Free(4)
 13719  
 13720  	// var __limit int32 at bp, 4
 13721  
 13722  	var __runes uintptr = libc.X__runes_for_locale(tls, __l, bp /* &__limit */)
 13723  	if (__c < 0) || (__c >= *(*int32)(unsafe.Pointer(bp /* __limit */))) {
 13724  		return __c
 13725  	}
 13726  	return *(*int32)(unsafe.Pointer((__runes + 2112 /* &.__maplower */) + uintptr(__c)*4))
 13727  }
 13728  
 13729  func toupper_l(tls *libc.TLS, __c int32, __l locale_t) int32 { /* _ctype.h:196:21: */
 13730  	bp := tls.Alloc(4)
 13731  	defer tls.Free(4)
 13732  
 13733  	// var __limit int32 at bp, 4
 13734  
 13735  	var __runes uintptr = libc.X__runes_for_locale(tls, __l, bp /* &__limit */)
 13736  	if (__c < 0) || (__c >= *(*int32)(unsafe.Pointer(bp /* __limit */))) {
 13737  		return __c
 13738  	}
 13739  	return *(*int32)(unsafe.Pointer((__runes + 3136 /* &.__mapupper */) + uintptr(__c)*4))
 13740  }
 13741  
 13742  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
 13743  // tolower() and toupper() respectively, minus extra checking to ensure that
 13744  // the argument is a lower or uppercase letter respectively.  We've chosen to
 13745  // implement these macros with the same error checking as tolower() and
 13746  // toupper() since this doesn't violate the specification itself, only its
 13747  // intent.  We purposely leave _tolower() and _toupper() undocumented to
 13748  // discourage their use.
 13749  //
 13750  // XXX isascii() and toascii() should similarly be undocumented.
 13751  
 13752  // Forward declaration of objects used by this implementation
 13753  type amatch_vtab1 = struct {
 13754  	Fbase       sqlite3_vtab
 13755  	FzClassName uintptr
 13756  	FzDb        uintptr
 13757  	FzSelf      uintptr
 13758  	FzCostTab   uintptr
 13759  	FzVocabTab  uintptr
 13760  	FzVocabWord uintptr
 13761  	FzVocabLang uintptr
 13762  	FpRule      uintptr
 13763  	FrIns       amatch_cost
 13764  	FrDel       amatch_cost
 13765  	FrSub       amatch_cost
 13766  	_           [4]byte
 13767  	Fdb         uintptr
 13768  	FpVCheck    uintptr
 13769  	FnCursor    int32
 13770  	_           [4]byte
 13771  } /* amatch.c:172:9 */
 13772  
 13773  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
 13774  // tolower() and toupper() respectively, minus extra checking to ensure that
 13775  // the argument is a lower or uppercase letter respectively.  We've chosen to
 13776  // implement these macros with the same error checking as tolower() and
 13777  // toupper() since this doesn't violate the specification itself, only its
 13778  // intent.  We purposely leave _tolower() and _toupper() undocumented to
 13779  // discourage their use.
 13780  //
 13781  // XXX isascii() and toascii() should similarly be undocumented.
 13782  
 13783  // Forward declaration of objects used by this implementation
 13784  type amatch_vtab = amatch_vtab1 /* amatch.c:172:28 */
 13785  type amatch_cursor1 = struct {
 13786  	Fbase      sqlite3_vtab_cursor
 13787  	FiRowid    sqlite3_int64
 13788  	FiLang     amatch_langid
 13789  	FrLimit    amatch_cost
 13790  	FnBuf      int32
 13791  	FoomErr    int32
 13792  	FnWord     int32
 13793  	_          [4]byte
 13794  	FzBuf      uintptr
 13795  	FzInput    uintptr
 13796  	FpVtab     uintptr
 13797  	FpAllWords uintptr
 13798  	FpCurrent  uintptr
 13799  	FpCost     uintptr
 13800  	FpWord     uintptr
 13801  } /* amatch.c:173:9 */
 13802  
 13803  type amatch_cursor = amatch_cursor1 /* amatch.c:173:30 */
 13804  type amatch_rule1 = struct {
 13805  	FpNext uintptr
 13806  	FzFrom uintptr
 13807  	FrCost amatch_cost
 13808  	FiLang amatch_langid
 13809  	FnFrom amatch_len
 13810  	FnTo   amatch_len
 13811  	FzTo   [4]int8
 13812  	_      [2]byte
 13813  } /* amatch.c:172:9 */
 13814  
 13815  type amatch_rule = amatch_rule1 /* amatch.c:174:28 */
 13816  type amatch_word1 = struct {
 13817  	FpNext  uintptr
 13818  	FsCost  amatch_avl
 13819  	FsWord  amatch_avl
 13820  	FrCost  amatch_cost
 13821  	FiSeq   int32
 13822  	FzCost  [10]int8
 13823  	FnMatch int16
 13824  	FzWord  [4]int8
 13825  } /* amatch.c:173:9 */
 13826  
 13827  type amatch_word = amatch_word1 /* amatch.c:175:28 */
 13828  type amatch_avl1 = struct {
 13829  	FpWord     uintptr
 13830  	FzKey      uintptr
 13831  	FpBefore   uintptr
 13832  	FpAfter    uintptr
 13833  	FpUp       uintptr
 13834  	Fheight    int16
 13835  	Fimbalance int16
 13836  	_          [4]byte
 13837  } /* amatch.c:173:9 */
 13838  
 13839  type amatch_avl = amatch_avl1 /* amatch.c:176:27 */
 13840  
 13841  // Recompute the amatch_avl.height and amatch_avl.imbalance fields for p.
 13842  // Assume that the children of p have correct heights.
 13843  func amatchAvlRecomputeHeight(tls *libc.TLS, p uintptr) { /* amatch.c:199:13: */
 13844  	var hBefore int16
 13845  	if (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 13846  		hBefore = (*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(p)).FpBefore)).Fheight
 13847  	} else {
 13848  		hBefore = int16(0)
 13849  	}
 13850  	var hAfter int16
 13851  	if (*amatch_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 13852  		hAfter = (*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(p)).FpAfter)).Fheight
 13853  	} else {
 13854  		hAfter = int16(0)
 13855  	}
 13856  	(*amatch_avl)(unsafe.Pointer(p)).Fimbalance = (int16(int32(hBefore) - int32(hAfter))) // -: pAfter higher.  +: pBefore higher
 13857  	(*amatch_avl)(unsafe.Pointer(p)).Fheight = (int16((func() int32 {
 13858  		if int32(hBefore) > int32(hAfter) {
 13859  			return int32(hBefore)
 13860  		}
 13861  		return int32(hAfter)
 13862  	}()) + 1))
 13863  }
 13864  
 13865  //     P                B
 13866  //    / \              / **   B   Z    ==>     X   P
 13867  //  / \                  / ** X   Y                Y   Z
 13868  //
 13869  func amatchAvlRotateBefore(tls *libc.TLS, pP uintptr) uintptr { /* amatch.c:214:19: */
 13870  	var pB uintptr = (*amatch_avl)(unsafe.Pointer(pP)).FpBefore
 13871  	var pY uintptr = (*amatch_avl)(unsafe.Pointer(pB)).FpAfter
 13872  	(*amatch_avl)(unsafe.Pointer(pB)).FpUp = (*amatch_avl)(unsafe.Pointer(pP)).FpUp
 13873  	(*amatch_avl)(unsafe.Pointer(pB)).FpAfter = pP
 13874  	(*amatch_avl)(unsafe.Pointer(pP)).FpUp = pB
 13875  	(*amatch_avl)(unsafe.Pointer(pP)).FpBefore = pY
 13876  	if pY != 0 {
 13877  		(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pP
 13878  	}
 13879  	amatchAvlRecomputeHeight(tls, pP)
 13880  	amatchAvlRecomputeHeight(tls, pB)
 13881  	return pB
 13882  }
 13883  
 13884  //     P                A
 13885  //    / \              / **   X   A    ==>     P   Z
 13886  //      / \          / **     Y   Z        X   Y
 13887  //
 13888  func amatchAvlRotateAfter(tls *libc.TLS, pP uintptr) uintptr { /* amatch.c:235:19: */
 13889  	var pA uintptr = (*amatch_avl)(unsafe.Pointer(pP)).FpAfter
 13890  	var pY uintptr = (*amatch_avl)(unsafe.Pointer(pA)).FpBefore
 13891  	(*amatch_avl)(unsafe.Pointer(pA)).FpUp = (*amatch_avl)(unsafe.Pointer(pP)).FpUp
 13892  	(*amatch_avl)(unsafe.Pointer(pA)).FpBefore = pP
 13893  	(*amatch_avl)(unsafe.Pointer(pP)).FpUp = pA
 13894  	(*amatch_avl)(unsafe.Pointer(pP)).FpAfter = pY
 13895  	if pY != 0 {
 13896  		(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pP
 13897  	}
 13898  	amatchAvlRecomputeHeight(tls, pP)
 13899  	amatchAvlRecomputeHeight(tls, pA)
 13900  	return pA
 13901  }
 13902  
 13903  // Return a pointer to the pBefore or pAfter pointer in the parent
 13904  // of p that points to p.  Or if p is the root node, return pp.
 13905  func amatchAvlFromPtr(tls *libc.TLS, p uintptr, pp uintptr) uintptr { /* amatch.c:252:19: */
 13906  	var pUp uintptr = (*amatch_avl)(unsafe.Pointer(p)).FpUp
 13907  	if pUp == uintptr(0) {
 13908  		return pp
 13909  	}
 13910  	if (*amatch_avl)(unsafe.Pointer(pUp)).FpAfter == p {
 13911  		return (pUp + 24 /* &.pAfter */)
 13912  	}
 13913  	return (pUp + 16 /* &.pBefore */)
 13914  }
 13915  
 13916  // Rebalance all nodes starting with p and working up to the root.
 13917  // Return the new root.
 13918  func amatchAvlBalance(tls *libc.TLS, p uintptr) uintptr { /* amatch.c:263:19: */
 13919  	bp := tls.Alloc(8)
 13920  	defer tls.Free(8)
 13921  	*(*uintptr)(unsafe.Pointer(bp)) = p
 13922  
 13923  	var pTop uintptr = *(*uintptr)(unsafe.Pointer(bp /* p */))
 13924  	var pp uintptr
 13925  	for *(*uintptr)(unsafe.Pointer(bp /* p */)) != 0 {
 13926  		amatchAvlRecomputeHeight(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)))
 13927  		if int32((*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) >= 2 {
 13928  			var pB uintptr = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore
 13929  			if int32((*amatch_avl)(unsafe.Pointer(pB)).Fimbalance) < 0 {
 13930  				(*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore = amatchAvlRotateAfter(tls, pB)
 13931  			}
 13932  			pp = amatchAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 13933  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, amatchAvlRotateBefore(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 13934  		} else if int32((*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) <= (-2) {
 13935  			var pA uintptr = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter
 13936  			if int32((*amatch_avl)(unsafe.Pointer(pA)).Fimbalance) > 0 {
 13937  				(*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter = amatchAvlRotateBefore(tls, pA)
 13938  			}
 13939  			pp = amatchAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 13940  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, amatchAvlRotateAfter(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 13941  		}
 13942  		pTop = *(*uintptr)(unsafe.Pointer(bp /* p */))
 13943  		*(*uintptr)(unsafe.Pointer(bp /* p */)) = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpUp
 13944  	}
 13945  	return pTop
 13946  }
 13947  
 13948  // Search the tree rooted at p for an entry with zKey.  Return a pointer
 13949  // to the entry or return NULL.
 13950  func amatchAvlSearch(tls *libc.TLS, p uintptr, zKey uintptr) uintptr { /* amatch.c:288:19: */
 13951  	var c int32
 13952  	for (p != 0) && ((libc.AssignInt32(&c, libc.Xstrcmp(tls, zKey, (*amatch_avl)(unsafe.Pointer(p)).FzKey))) != 0) {
 13953  		if c < 0 {
 13954  			p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 13955  		} else {
 13956  			p = (*amatch_avl)(unsafe.Pointer(p)).FpAfter
 13957  		}
 13958  	}
 13959  	return p
 13960  }
 13961  
 13962  // Find the first node (the one with the smallest key).
 13963  func amatchAvlFirst(tls *libc.TLS, p uintptr) uintptr { /* amatch.c:298:19: */
 13964  	if p != 0 {
 13965  		for (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 13966  			p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 13967  		}
 13968  	}
 13969  	return p
 13970  }
 13971  
 13972  // Insert a new node pNew.  Return NULL on success.  If the key is not
 13973  // unique, then do not perform the insert but instead leave pNew unchanged
 13974  // and return a pointer to an existing node with the same key.
 13975  func amatchAvlInsert(tls *libc.TLS, ppHead uintptr, pNew uintptr) uintptr { /* amatch.c:356:19: */
 13976  	var c int32
 13977  	var p uintptr = *(*uintptr)(unsafe.Pointer(ppHead))
 13978  	if p == uintptr(0) {
 13979  		p = pNew
 13980  		(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = uintptr(0)
 13981  	} else {
 13982  		for p != 0 {
 13983  			c = libc.Xstrcmp(tls, (*amatch_avl)(unsafe.Pointer(pNew)).FzKey, (*amatch_avl)(unsafe.Pointer(p)).FzKey)
 13984  			if c < 0 {
 13985  				if (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 13986  					p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 13987  				} else {
 13988  					(*amatch_avl)(unsafe.Pointer(p)).FpBefore = pNew
 13989  					(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = p
 13990  					break
 13991  				}
 13992  			} else if c > 0 {
 13993  				if (*amatch_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 13994  					p = (*amatch_avl)(unsafe.Pointer(p)).FpAfter
 13995  				} else {
 13996  					(*amatch_avl)(unsafe.Pointer(p)).FpAfter = pNew
 13997  					(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = p
 13998  					break
 13999  				}
 14000  			} else {
 14001  				return p
 14002  			}
 14003  		}
 14004  	}
 14005  	(*amatch_avl)(unsafe.Pointer(pNew)).FpBefore = uintptr(0)
 14006  	(*amatch_avl)(unsafe.Pointer(pNew)).FpAfter = uintptr(0)
 14007  	(*amatch_avl)(unsafe.Pointer(pNew)).Fheight = int16(1)
 14008  	(*amatch_avl)(unsafe.Pointer(pNew)).Fimbalance = int16(0)
 14009  	*(*uintptr)(unsafe.Pointer(ppHead)) = amatchAvlBalance(tls, p)
 14010  	// assert( amatchAvlIntegrity(*ppHead) );
 14011  	// assert( amatchAvlIntegrity2(*ppHead) );
 14012  	return uintptr(0)
 14013  }
 14014  
 14015  // Remove node pOld from the tree.  pOld must be an element of the tree or
 14016  // the AVL tree will become corrupt.
 14017  func amatchAvlRemove(tls *libc.TLS, ppHead uintptr, pOld uintptr) { /* amatch.c:399:13: */
 14018  	var ppParent uintptr
 14019  	var pBalance uintptr = uintptr(0)
 14020  	// assert( amatchAvlSearch(*ppHead, pOld->zKey)==pOld );
 14021  	ppParent = amatchAvlFromPtr(tls, pOld, ppHead)
 14022  	if ((*amatch_avl)(unsafe.Pointer(pOld)).FpBefore == uintptr(0)) && ((*amatch_avl)(unsafe.Pointer(pOld)).FpAfter == uintptr(0)) {
 14023  		*(*uintptr)(unsafe.Pointer(ppParent)) = uintptr(0)
 14024  		pBalance = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 14025  	} else if ((*amatch_avl)(unsafe.Pointer(pOld)).FpBefore != 0) && ((*amatch_avl)(unsafe.Pointer(pOld)).FpAfter != 0) {
 14026  		var pX uintptr
 14027  		var pY uintptr
 14028  		pX = amatchAvlFirst(tls, (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter)
 14029  		*(*uintptr)(unsafe.Pointer(amatchAvlFromPtr(tls, pX, uintptr(0)))) = (*amatch_avl)(unsafe.Pointer(pX)).FpAfter
 14030  		if (*amatch_avl)(unsafe.Pointer(pX)).FpAfter != 0 {
 14031  			(*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(pX)).FpAfter)).FpUp = (*amatch_avl)(unsafe.Pointer(pX)).FpUp
 14032  		}
 14033  		pBalance = (*amatch_avl)(unsafe.Pointer(pX)).FpUp
 14034  		(*amatch_avl)(unsafe.Pointer(pX)).FpAfter = (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter
 14035  		if (*amatch_avl)(unsafe.Pointer(pX)).FpAfter != 0 {
 14036  			(*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(pX)).FpAfter)).FpUp = pX
 14037  		} else {
 14038  
 14039  			pBalance = pX
 14040  		}
 14041  		(*amatch_avl)(unsafe.Pointer(pX)).FpBefore = libc.AssignUintptr(&pY, (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore)
 14042  		if pY != 0 {
 14043  			(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pX
 14044  		}
 14045  		(*amatch_avl)(unsafe.Pointer(pX)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 14046  		*(*uintptr)(unsafe.Pointer(ppParent)) = pX
 14047  	} else if (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore == uintptr(0) {
 14048  		*(*uintptr)(unsafe.Pointer(ppParent)) = libc.AssignUintptr(&pBalance, (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter)
 14049  		(*amatch_avl)(unsafe.Pointer(pBalance)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 14050  	} else if (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter == uintptr(0) {
 14051  		*(*uintptr)(unsafe.Pointer(ppParent)) = libc.AssignUintptr(&pBalance, (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore)
 14052  		(*amatch_avl)(unsafe.Pointer(pBalance)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 14053  	}
 14054  	*(*uintptr)(unsafe.Pointer(ppHead)) = amatchAvlBalance(tls, pBalance)
 14055  	(*amatch_avl)(unsafe.Pointer(pOld)).FpUp = uintptr(0)
 14056  	(*amatch_avl)(unsafe.Pointer(pOld)).FpBefore = uintptr(0)
 14057  	(*amatch_avl)(unsafe.Pointer(pOld)).FpAfter = uintptr(0)
 14058  	// assert( amatchAvlIntegrity(*ppHead) );
 14059  	// assert( amatchAvlIntegrity2(*ppHead) );
 14060  }
 14061  
 14062  //
 14063  // End of the AVL Tree implementation
 14064  //
 14065  
 14066  // Various types.
 14067  //
 14068  // amatch_cost is the "cost" of an edit operation.
 14069  //
 14070  // amatch_len is the length of a matching string.
 14071  //
 14072  // amatch_langid is an ruleset identifier.
 14073  type amatch_cost = int32   /* amatch.c:452:13 */
 14074  type amatch_len = int8     /* amatch.c:453:21 */
 14075  type amatch_langid = int32 /* amatch.c:454:13 */
 14076  
 14077  // The two input rule lists are both sorted in order of increasing
 14078  // cost.  Merge them together into a single list, sorted by cost, and
 14079  // return a pointer to the head of that list.
 14080  func amatchMergeRules(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* amatch.c:534:20: */
 14081  	bp := tls.Alloc(32)
 14082  	defer tls.Free(32)
 14083  
 14084  	// var head amatch_rule at bp, 32
 14085  
 14086  	var pTail uintptr
 14087  
 14088  	pTail = bp /* &head */
 14089  	for (pA != 0) && (pB != 0) {
 14090  		if (*amatch_rule)(unsafe.Pointer(pA)).FrCost <= (*amatch_rule)(unsafe.Pointer(pB)).FrCost {
 14091  			(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pA
 14092  			pTail = pA
 14093  			pA = (*amatch_rule)(unsafe.Pointer(pA)).FpNext
 14094  		} else {
 14095  			(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pB
 14096  			pTail = pB
 14097  			pB = (*amatch_rule)(unsafe.Pointer(pB)).FpNext
 14098  		}
 14099  	}
 14100  	if pA == uintptr(0) {
 14101  		(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pB
 14102  	} else {
 14103  		(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pA
 14104  	}
 14105  	return (*amatch_rule)(unsafe.Pointer(bp /* &head */)).FpNext
 14106  }
 14107  
 14108  // Statement pStmt currently points to a row in the amatch data table. This
 14109  // function allocates and populates a amatch_rule structure according to
 14110  // the content of the row.
 14111  //
 14112  // If successful, *ppRule is set to point to the new object and SQLITE_OK
 14113  // is returned. Otherwise, *ppRule is zeroed, *pzErr may be set to point
 14114  // to an error message and an SQLite error code returned.
 14115  func amatchLoadOneRule(tls *libc.TLS, p uintptr, pStmt uintptr, ppRule uintptr, pzErr uintptr) int32 { /* amatch.c:567:12: */
 14116  	bp := tls.Alloc(48)
 14117  	defer tls.Free(48)
 14118  
 14119  	var iLang sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 14120  	var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 14121  	var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 2)
 14122  	var rCost amatch_cost = sqlite3.Xsqlite3_column_int(tls, pStmt, 3)
 14123  
 14124  	var rc int32 = SQLITE_OK       // Return code
 14125  	var nFrom int32                // Size of string zFrom, in bytes
 14126  	var nTo int32                  // Size of string zTo, in bytes
 14127  	var pRule uintptr = uintptr(0) // New rule object to return
 14128  
 14129  	if zFrom == uintptr(0) {
 14130  		zFrom = ts + 489 /* "" */
 14131  	}
 14132  	if zTo == uintptr(0) {
 14133  		zTo = ts + 489 /* "" */
 14134  	}
 14135  	nFrom = int32(libc.Xstrlen(tls, zFrom))
 14136  	nTo = int32(libc.Xstrlen(tls, zTo))
 14137  
 14138  	// Silently ignore null transformations
 14139  	if libc.Xstrcmp(tls, zFrom, zTo) == 0 {
 14140  		if (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?') && (int32(*(*int8)(unsafe.Pointer(zFrom + 1))) == 0) {
 14141  			if ((*amatch_vtab)(unsafe.Pointer(p)).FrSub == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrSub > rCost) {
 14142  				(*amatch_vtab)(unsafe.Pointer(p)).FrSub = rCost
 14143  			}
 14144  		}
 14145  		*(*uintptr)(unsafe.Pointer(ppRule)) = uintptr(0)
 14146  		return SQLITE_OK
 14147  	}
 14148  
 14149  	if (rCost <= 0) || (rCost > AMATCH_MX_COST) {
 14150  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3165, /* "%s: cost must be..." */
 14151  			libc.VaList(bp, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_COST))
 14152  		rc = SQLITE_ERROR
 14153  	} else if (nFrom > AMATCH_MX_LENGTH) || (nTo > AMATCH_MX_LENGTH) {
 14154  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3199, /* "%s: maximum stri..." */
 14155  			libc.VaList(bp+16, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_LENGTH))
 14156  		rc = SQLITE_ERROR
 14157  	} else if (iLang < int64(0)) || (iLang > int64(AMATCH_MX_LANGID)) {
 14158  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3231, /* "%s: iLang must b..." */
 14159  			libc.VaList(bp+32, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_LANGID))
 14160  		rc = SQLITE_ERROR
 14161  	} else if (libc.Xstrcmp(tls, zFrom, ts+489 /* "" */) == 0) && (libc.Xstrcmp(tls, zTo, ts+3266 /* "?" */) == 0) {
 14162  		if ((*amatch_vtab)(unsafe.Pointer(p)).FrIns == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrIns > rCost) {
 14163  			(*amatch_vtab)(unsafe.Pointer(p)).FrIns = rCost
 14164  		}
 14165  	} else if (libc.Xstrcmp(tls, zFrom, ts+3266 /* "?" */) == 0) && (libc.Xstrcmp(tls, zTo, ts+489 /* "" */) == 0) {
 14166  		if ((*amatch_vtab)(unsafe.Pointer(p)).FrDel == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrDel > rCost) {
 14167  			(*amatch_vtab)(unsafe.Pointer(p)).FrDel = rCost
 14168  		}
 14169  	} else {
 14170  		pRule = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(amatch_rule{})) + uint64(nFrom)) + uint64(nTo))))
 14171  		if pRule == uintptr(0) {
 14172  			rc = SQLITE_NOMEM
 14173  		} else {
 14174  			libc.Xmemset(tls, pRule, 0, uint64(unsafe.Sizeof(amatch_rule{})))
 14175  			(*amatch_rule)(unsafe.Pointer(pRule)).FzFrom = ((pRule + 26 /* &.zTo */) + uintptr((nTo + 1)))
 14176  			(*amatch_rule)(unsafe.Pointer(pRule)).FnFrom = amatch_len(nFrom)
 14177  			libc.Xmemcpy(tls, (*amatch_rule)(unsafe.Pointer(pRule)).FzFrom, zFrom, (uint64(nFrom + 1)))
 14178  			libc.Xmemcpy(tls, pRule+26 /* &.zTo */, zTo, (uint64(nTo + 1)))
 14179  			(*amatch_rule)(unsafe.Pointer(pRule)).FnTo = amatch_len(nTo)
 14180  			(*amatch_rule)(unsafe.Pointer(pRule)).FrCost = rCost
 14181  			(*amatch_rule)(unsafe.Pointer(pRule)).FiLang = int32(iLang)
 14182  		}
 14183  	}
 14184  
 14185  	*(*uintptr)(unsafe.Pointer(ppRule)) = pRule
 14186  	return rc
 14187  }
 14188  
 14189  // Free all the content in the edit-cost-table
 14190  func amatchFreeRules(tls *libc.TLS, p uintptr) { /* amatch.c:644:13: */
 14191  	for (*amatch_vtab)(unsafe.Pointer(p)).FpRule != 0 {
 14192  		var pRule uintptr = (*amatch_vtab)(unsafe.Pointer(p)).FpRule
 14193  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = (*amatch_rule)(unsafe.Pointer(pRule)).FpNext
 14194  		sqlite3.Xsqlite3_free(tls, pRule)
 14195  	}
 14196  	(*amatch_vtab)(unsafe.Pointer(p)).FpRule = uintptr(0)
 14197  }
 14198  
 14199  // Load the content of the amatch data table into memory.
 14200  func amatchLoadRules(tls *libc.TLS, db uintptr, p uintptr, pzErr uintptr) int32 { /* amatch.c:656:12: */
 14201  	bp := tls.Alloc(192)
 14202  	defer tls.Free(192)
 14203  
 14204  	var rc int32 = SQLITE_OK // Return code
 14205  	var zSql uintptr         // SELECT used to read from rules table
 14206  	var pHead uintptr = uintptr(0)
 14207  
 14208  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+3268 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*amatch_vtab)(unsafe.Pointer(p)).FzDb, (*amatch_vtab)(unsafe.Pointer(p)).FzCostTab))
 14209  	if zSql == uintptr(0) {
 14210  		rc = SQLITE_NOMEM
 14211  	} else {
 14212  		var rc2 int32 // finalize() return code
 14213  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0)
 14214  		rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+56 /* &pStmt */, uintptr(0))
 14215  		if rc != SQLITE_OK {
 14216  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3288 /* "%s: %s" */, libc.VaList(bp+16, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, sqlite3.Xsqlite3_errmsg(tls, db)))
 14217  		} else if sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != 4 {
 14218  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3295, /* "%s: %s has %d co..." */
 14219  				libc.VaList(bp+32, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, (*amatch_vtab)(unsafe.Pointer(p)).FzCostTab, sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))))
 14220  			rc = SQLITE_ERROR
 14221  		} else {
 14222  			for (rc == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))) {
 14223  				*(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)) = uintptr(0)
 14224  				rc = amatchLoadOneRule(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), bp+64 /* &pRule */, pzErr)
 14225  				if *(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)) != 0 {
 14226  					(*amatch_rule)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)))).FpNext = pHead
 14227  					pHead = *(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */))
 14228  				}
 14229  			}
 14230  		}
 14231  		rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 14232  		if rc == SQLITE_OK {
 14233  			rc = rc2
 14234  		}
 14235  	}
 14236  	sqlite3.Xsqlite3_free(tls, zSql)
 14237  
 14238  	// All rules are now in a singly linked list starting at pHead. This
 14239  	// block sorts them by cost and then sets amatch_vtab.pRule to point to
 14240  	// point to the head of the sorted list.
 14241  	if rc == SQLITE_OK {
 14242  		var i uint32
 14243  		var pX uintptr
 14244  		// var a [15]uintptr at bp+72, 120
 14245  
 14246  		for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 14247  			*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = uintptr(0)
 14248  		}
 14249  		for (libc.AssignUintptr(&pX, pHead)) != uintptr(0) {
 14250  			pHead = (*amatch_rule)(unsafe.Pointer(pX)).FpNext
 14251  			(*amatch_rule)(unsafe.Pointer(pX)).FpNext = uintptr(0)
 14252  			for i = uint32(0); (*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) != 0) && (uint64(i) < ((uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))) - uint64(1))); i++ {
 14253  				pX = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 14254  				*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = uintptr(0)
 14255  			}
 14256  			*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 14257  		}
 14258  		pX = *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */))
 14259  		i = uint32(1)
 14260  		for ; uint64(i) < (uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 14261  			pX = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 14262  		}
 14263  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = amatchMergeRules(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpRule, pX)
 14264  	} else {
 14265  		// An error has occurred. Setting p->pRule to point to the head of the
 14266  		// allocated list ensures that the list will be cleaned up in this case.
 14267  
 14268  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = pHead
 14269  	}
 14270  
 14271  	return rc
 14272  }
 14273  
 14274  // This function converts an SQL quoted string into an unquoted string
 14275  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 14276  // containing the result. The caller should eventually free this buffer
 14277  // using sqlite3_free.
 14278  //
 14279  // Examples:
 14280  //
 14281  //     "abc"   becomes   abc
 14282  //     'xyz'   becomes   xyz
 14283  //     [pqr]   becomes   pqr
 14284  //     `mno`   becomes   mno
 14285  func amatchDequote(tls *libc.TLS, zIn uintptr) uintptr { /* amatch.c:740:13: */
 14286  	var nIn sqlite3_int64 // Size of input string, in bytes
 14287  	var zOut uintptr      // Output (dequoted) string
 14288  
 14289  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 14290  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 14291  	if zOut != 0 {
 14292  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 14293  
 14294  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 14295  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 14296  		} else {
 14297  			var iOut int32 = 0 // Index of next byte to write to output
 14298  			var iIn int32      // Index of next byte to read from input
 14299  
 14300  			if int32(q) == '[' {
 14301  				q = int8(']')
 14302  			}
 14303  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 14304  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 14305  					iIn++
 14306  				}
 14307  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 14308  			}
 14309  		}
 14310  
 14311  	}
 14312  	return zOut
 14313  }
 14314  
 14315  // Deallocate the pVCheck prepared statement.
 14316  func amatchVCheckClear(tls *libc.TLS, p uintptr) { /* amatch.c:769:13: */
 14317  	if (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck != 0 {
 14318  		sqlite3.Xsqlite3_finalize(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14319  		(*amatch_vtab)(unsafe.Pointer(p)).FpVCheck = uintptr(0)
 14320  	}
 14321  }
 14322  
 14323  // Deallocate an amatch_vtab object
 14324  func amatchFree(tls *libc.TLS, p uintptr) { /* amatch.c:779:13: */
 14325  	if p != 0 {
 14326  		amatchFreeRules(tls, p)
 14327  		amatchVCheckClear(tls, p)
 14328  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName)
 14329  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzDb)
 14330  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzCostTab)
 14331  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab)
 14332  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord)
 14333  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang)
 14334  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf)
 14335  		libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(amatch_vtab{})))
 14336  		sqlite3.Xsqlite3_free(tls, p)
 14337  	}
 14338  }
 14339  
 14340  // xDisconnect/xDestroy method for the amatch module.
 14341  func amatchDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* amatch.c:798:12: */
 14342  	var p uintptr = pVtab
 14343  
 14344  	amatchFree(tls, p)
 14345  	return SQLITE_OK
 14346  }
 14347  
 14348  // Check to see if the argument is of the form:
 14349  //
 14350  //       KEY = VALUE
 14351  //
 14352  // If it is, return a pointer to the first character of VALUE.
 14353  // If not, return NULL.  Spaces around the = are ignored.
 14354  func amatchValueOfKey(tls *libc.TLS, zKey uintptr, zStr uintptr) uintptr { /* amatch.c:813:19: */
 14355  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
 14356  	var nStr int32 = int32(libc.Xstrlen(tls, zStr))
 14357  	var i int32
 14358  	if nStr < (nKey + 1) {
 14359  		return uintptr(0)
 14360  	}
 14361  	if libc.Xmemcmp(tls, zStr, zKey, uint64(nKey)) != 0 {
 14362  		return uintptr(0)
 14363  	}
 14364  	for i = nKey; __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0; i++ {
 14365  	}
 14366  	if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) != '=' {
 14367  		return uintptr(0)
 14368  	}
 14369  	i++
 14370  	for __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0 {
 14371  		i++
 14372  	}
 14373  	return (zStr + uintptr(i))
 14374  }
 14375  
 14376  // xConnect/xCreate method for the amatch module. Arguments are:
 14377  //
 14378  //   argv[0]    -> module name  ("approximate_match")
 14379  //   argv[1]    -> database name
 14380  //   argv[2]    -> table name
 14381  //   argv[3...] -> arguments
 14382  func amatchConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* amatch.c:834:12: */
 14383  	bp := tls.Alloc(32)
 14384  	defer tls.Free(32)
 14385  
 14386  	var rc int32     // Return code
 14387  	var pNew uintptr // New virtual table
 14388  	var zModule uintptr
 14389  	var zDb uintptr
 14390  	var zVal uintptr
 14391  	var i int32
 14392  	rc = SQLITE_OK
 14393  	pNew = uintptr(0)
 14394  	zModule = *(*uintptr)(unsafe.Pointer(argv))
 14395  	zDb = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 14396  
 14397  	_ = pAux
 14398  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 14399  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(amatch_vtab{})))
 14400  	if !(pNew == uintptr(0)) {
 14401  		goto __1
 14402  	}
 14403  	return SQLITE_NOMEM
 14404  __1:
 14405  	;
 14406  	rc = SQLITE_NOMEM
 14407  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(amatch_vtab{})))
 14408  	(*amatch_vtab)(unsafe.Pointer(pNew)).Fdb = db
 14409  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzClassName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zModule))
 14410  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzClassName == uintptr(0)) {
 14411  		goto __2
 14412  	}
 14413  	goto amatchConnectError
 14414  __2:
 14415  	;
 14416  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzDb = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zDb))
 14417  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzDb == uintptr(0)) {
 14418  		goto __3
 14419  	}
 14420  	goto amatchConnectError
 14421  __3:
 14422  	;
 14423  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzSelf = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 14424  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzSelf == uintptr(0)) {
 14425  		goto __4
 14426  	}
 14427  	goto amatchConnectError
 14428  __4:
 14429  	;
 14430  	i = 3
 14431  __5:
 14432  	if !(i < argc) {
 14433  		goto __7
 14434  	}
 14435  	zVal = amatchValueOfKey(tls, ts+3329 /* "vocabulary_table" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 14436  	if !(zVal != 0) {
 14437  		goto __8
 14438  	}
 14439  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab)
 14440  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab = amatchDequote(tls, zVal)
 14441  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab == uintptr(0)) {
 14442  		goto __9
 14443  	}
 14444  	goto amatchConnectError
 14445  __9:
 14446  	;
 14447  	goto __6
 14448  __8:
 14449  	;
 14450  	zVal = amatchValueOfKey(tls, ts+3346 /* "vocabulary_word" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 14451  	if !(zVal != 0) {
 14452  		goto __10
 14453  	}
 14454  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord)
 14455  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord = amatchDequote(tls, zVal)
 14456  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord == uintptr(0)) {
 14457  		goto __11
 14458  	}
 14459  	goto amatchConnectError
 14460  __11:
 14461  	;
 14462  	goto __6
 14463  __10:
 14464  	;
 14465  	zVal = amatchValueOfKey(tls, ts+3362 /* "vocabulary_langu..." */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 14466  	if !(zVal != 0) {
 14467  		goto __12
 14468  	}
 14469  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang)
 14470  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang = amatchDequote(tls, zVal)
 14471  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang == uintptr(0)) {
 14472  		goto __13
 14473  	}
 14474  	goto amatchConnectError
 14475  __13:
 14476  	;
 14477  	goto __6
 14478  __12:
 14479  	;
 14480  	zVal = amatchValueOfKey(tls, ts+3382 /* "edit_distances" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 14481  	if !(zVal != 0) {
 14482  		goto __14
 14483  	}
 14484  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab)
 14485  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab = amatchDequote(tls, zVal)
 14486  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab == uintptr(0)) {
 14487  		goto __15
 14488  	}
 14489  	goto amatchConnectError
 14490  __15:
 14491  	;
 14492  	goto __6
 14493  __14:
 14494  	;
 14495  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3397 /* "unrecognized arg..." */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 14496  	amatchFree(tls, pNew)
 14497  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 14498  	return SQLITE_ERROR
 14499  	goto __6
 14500  __6:
 14501  	i++
 14502  	goto __5
 14503  	goto __7
 14504  __7:
 14505  	;
 14506  	rc = SQLITE_OK
 14507  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab == uintptr(0)) {
 14508  		goto __16
 14509  	}
 14510  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3426 /* "no edit_distance..." */, 0)
 14511  	rc = SQLITE_ERROR
 14512  	goto __17
 14513  __16:
 14514  	rc = amatchLoadRules(tls, db, pNew, pzErr)
 14515  __17:
 14516  	;
 14517  	if !(rc == SQLITE_OK) {
 14518  		goto __18
 14519  	}
 14520  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 14521  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 14522  
 14523  		ts+3460 /* "CREATE TABLE x(w..." */)
 14524  __18:
 14525  	;
 14526  	if !(rc != SQLITE_OK) {
 14527  		goto __19
 14528  	}
 14529  	amatchFree(tls, pNew)
 14530  __19:
 14531  	;
 14532  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pNew /* &.base */)
 14533  	return rc
 14534  
 14535  amatchConnectError:
 14536  	amatchFree(tls, pNew)
 14537  	return rc
 14538  }
 14539  
 14540  // Open a new amatch cursor.
 14541  func amatchOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* amatch.c:928:12: */
 14542  	var p uintptr = pVTab
 14543  	var pCur uintptr
 14544  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(amatch_cursor{})))
 14545  	if pCur == uintptr(0) {
 14546  		return SQLITE_NOMEM
 14547  	}
 14548  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(amatch_cursor{})))
 14549  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 14550  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 14551  	(*amatch_vtab)(unsafe.Pointer(p)).FnCursor++
 14552  	return SQLITE_OK
 14553  }
 14554  
 14555  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 14556  // to indicate that it is at EOF.
 14557  func amatchClearCursor(tls *libc.TLS, pCur uintptr) { /* amatch.c:944:13: */
 14558  	var pWord uintptr
 14559  	var pNextWord uintptr
 14560  	for pWord = (*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords; pWord != 0; pWord = pNextWord {
 14561  		pNextWord = (*amatch_word)(unsafe.Pointer(pWord)).FpNext
 14562  		sqlite3.Xsqlite3_free(tls, pWord)
 14563  	}
 14564  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords = uintptr(0)
 14565  	sqlite3.Xsqlite3_free(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzInput)
 14566  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzInput = uintptr(0)
 14567  	sqlite3.Xsqlite3_free(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 14568  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf = uintptr(0)
 14569  	(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = 0
 14570  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCost = uintptr(0)
 14571  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpWord = uintptr(0)
 14572  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent = uintptr(0)
 14573  	(*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit = 1000000
 14574  	(*amatch_cursor)(unsafe.Pointer(pCur)).FiLang = 0
 14575  	(*amatch_cursor)(unsafe.Pointer(pCur)).FnWord = 0
 14576  }
 14577  
 14578  // Close a amatch cursor.
 14579  func amatchClose(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:967:12: */
 14580  	var pCur uintptr = cur
 14581  	amatchClearCursor(tls, pCur)
 14582  	(*amatch_vtab)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 14583  	sqlite3.Xsqlite3_free(tls, pCur)
 14584  	return SQLITE_OK
 14585  }
 14586  
 14587  // Render a 24-bit unsigned integer as a 4-byte base-64 number.
 14588  func amatchEncodeInt(tls *libc.TLS, x int32, z uintptr) { /* amatch.c:978:13: */
 14589  	*(*int8)(unsafe.Pointer(z)) = a[((x >> 18) & 0x3f)]
 14590  	*(*int8)(unsafe.Pointer(z + 1)) = a[((x >> 12) & 0x3f)]
 14591  	*(*int8)(unsafe.Pointer(z + 2)) = a[((x >> 6) & 0x3f)]
 14592  	*(*int8)(unsafe.Pointer(z + 3)) = a[(x & 0x3f)]
 14593  }
 14594  
 14595  var a = *(*[65]int8)(unsafe.Pointer(ts + 3527 /* "0123456789ABCDEF..." */)) /* amatch.c:979:21 */
 14596  
 14597  // Write the zCost[] field for a amatch_word object
 14598  func amatchWriteCost(tls *libc.TLS, pWord uintptr) { /* amatch.c:996:13: */
 14599  	amatchEncodeInt(tls, (*amatch_word)(unsafe.Pointer(pWord)).FrCost, pWord+112 /* &.zCost */)
 14600  	amatchEncodeInt(tls, (*amatch_word)(unsafe.Pointer(pWord)).FiSeq, ((pWord + 112 /* &.zCost */) + uintptr(4)))
 14601  	*(*int8)(unsafe.Pointer((pWord + 112 /* &.zCost */) + 8)) = int8(0)
 14602  }
 14603  
 14604  // Circumvent compiler warnings about the use of strcpy() by supplying
 14605  // our own implementation.
 14606  func amatchStrcpy(tls *libc.TLS, dest uintptr, src uintptr) { /* amatch.c:1005:13: */
 14607  	for (int32(libc.AssignPtrInt8(libc.PostIncUintptr(&dest, 1), *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&src, 1)))))) != 0 {
 14608  	}
 14609  }
 14610  
 14611  func amatchStrcat(tls *libc.TLS, dest uintptr, src uintptr) { /* amatch.c:1008:13: */
 14612  	for *(*int8)(unsafe.Pointer(dest)) != 0 {
 14613  		dest++
 14614  	}
 14615  	amatchStrcpy(tls, dest, src)
 14616  }
 14617  
 14618  // Add a new amatch_word object to the queue.
 14619  //
 14620  // If a prior amatch_word object with the same zWord, and nMatch
 14621  // already exists, update its rCost (if the new rCost is less) but
 14622  // otherwise leave it unchanged.  Do not add a duplicate.
 14623  //
 14624  // Do nothing if the cost exceeds threshold.
 14625  func amatchAddWord(tls *libc.TLS, pCur uintptr, rCost amatch_cost, nMatch int32, zWordBase uintptr, zWordTail uintptr) { /* amatch.c:1022:13: */
 14626  	bp := tls.Alloc(4)
 14627  	defer tls.Free(4)
 14628  
 14629  	var pWord uintptr
 14630  	var pNode uintptr
 14631  	var pOther uintptr
 14632  	_ = pOther
 14633  	var nBase int32
 14634  	var nTail int32
 14635  	// var zBuf [4]int8 at bp, 4
 14636  
 14637  	if rCost > (*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit {
 14638  		return
 14639  	}
 14640  	nBase = int32(libc.Xstrlen(tls, zWordBase))
 14641  	nTail = int32(libc.Xstrlen(tls, zWordTail))
 14642  	if ((nBase + nTail) + 3) > (*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf {
 14643  		(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = ((nBase + nTail) + 100)
 14644  		(*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf = sqlite3.Xsqlite3_realloc(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf, (*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf)
 14645  		if (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf == uintptr(0) {
 14646  			(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = 0
 14647  			return
 14648  		}
 14649  	}
 14650  	amatchEncodeInt(tls, nMatch, bp /* &zBuf[0] */)
 14651  	libc.Xmemcpy(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf, (bp /* &zBuf[0] */ + uintptr(2)), uint64(2))
 14652  	libc.Xmemcpy(tls, ((*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr(2)), zWordBase, uint64(nBase))
 14653  	libc.Xmemcpy(tls, (((*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr(2)) + uintptr(nBase)), zWordTail, (uint64(nTail + 1)))
 14654  	pNode = amatchAvlSearch(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FpWord, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 14655  	if pNode != 0 {
 14656  		pWord = (*amatch_avl)(unsafe.Pointer(pNode)).FpWord
 14657  		if (*amatch_word)(unsafe.Pointer(pWord)).FrCost > rCost {
 14658  			amatchAvlRemove(tls, (pCur + 80 /* &.pCost */), (pWord + 8 /* &.sCost */))
 14659  			(*amatch_word)(unsafe.Pointer(pWord)).FrCost = rCost
 14660  			amatchWriteCost(tls, pWord)
 14661  			pOther = amatchAvlInsert(tls, (pCur + 80 /* &.pCost */), (pWord + 8 /* &.sCost */))
 14662  			_ = pOther
 14663  		}
 14664  		return
 14665  	}
 14666  	pWord = sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(amatch_word{})) + uint64(nBase)) + uint64(nTail)) - uint64(1))))
 14667  	if pWord == uintptr(0) {
 14668  		return
 14669  	}
 14670  	libc.Xmemset(tls, pWord, 0, uint64(unsafe.Sizeof(amatch_word{})))
 14671  	(*amatch_word)(unsafe.Pointer(pWord)).FrCost = rCost
 14672  	(*amatch_word)(unsafe.Pointer(pWord)).FiSeq = libc.PostIncInt32(&(*amatch_cursor)(unsafe.Pointer(pCur)).FnWord, 1)
 14673  	amatchWriteCost(tls, pWord)
 14674  	(*amatch_word)(unsafe.Pointer(pWord)).FnMatch = int16(nMatch)
 14675  	(*amatch_word)(unsafe.Pointer(pWord)).FpNext = (*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords
 14676  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords = pWord
 14677  	(*amatch_word)(unsafe.Pointer(pWord)).FsCost.FzKey = pWord + 112 /* &.zCost */
 14678  	(*amatch_word)(unsafe.Pointer(pWord)).FsCost.FpWord = pWord
 14679  	pOther = amatchAvlInsert(tls, (pCur + 80 /* &.pCost */), (pWord + 8 /* &.sCost */))
 14680  	_ = pOther
 14681  	(*amatch_word)(unsafe.Pointer(pWord)).FsWord.FzKey = pWord + 124 /* &.zWord */
 14682  	(*amatch_word)(unsafe.Pointer(pWord)).FsWord.FpWord = pWord
 14683  	amatchStrcpy(tls, pWord+124 /* &.zWord */, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 14684  	pOther = amatchAvlInsert(tls, (pCur + 88 /* &.pWord */), (pWord + 56 /* &.sWord */))
 14685  	_ = pOther
 14686  }
 14687  
 14688  // Advance a cursor to its next row of output
 14689  func amatchNext(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:1102:12: */
 14690  	bp := tls.Alloc(80)
 14691  	defer tls.Free(80)
 14692  
 14693  	var pCur uintptr = cur
 14694  	var pWord uintptr = uintptr(0)
 14695  	var pNode uintptr
 14696  	var isMatch int32 = 0
 14697  	var p uintptr = (*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab
 14698  	var nWord int32
 14699  	var rc int32
 14700  	var i int32
 14701  	var zW uintptr
 14702  	var pRule uintptr
 14703  	var zBuf uintptr = uintptr(0)
 14704  	var nBuf int8 = int8(0)
 14705  	// var zNext [8]int8 at bp+64, 8
 14706  
 14707  	// var zNextIn [8]int8 at bp+72, 8
 14708  
 14709  	var nNextIn int32
 14710  
 14711  	if (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck == uintptr(0) {
 14712  		var zSql uintptr
 14713  		if ((*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang != 0) && (*(*int8)(unsafe.Pointer((*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang)) != 0) {
 14714  			zSql = sqlite3.Xsqlite3_mprintf(tls,
 14715  				ts+3592, /* "SELECT \"%w\" FROM..." */
 14716  
 14717  				libc.VaList(bp, ts+3614, /* " WHERE \"%w\">=?1 ..." */
 14718  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab,
 14719  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang))
 14720  		} else {
 14721  			zSql = sqlite3.Xsqlite3_mprintf(tls,
 14722  
 14723  				ts+3653, /* "SELECT \"%w\" FROM..." */
 14724  				libc.VaList(bp+40, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab,
 14725  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord))
 14726  		}
 14727  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*amatch_vtab)(unsafe.Pointer(p)).Fdb, zSql, -1, (p + 112 /* &.pVCheck */), uintptr(0))
 14728  		sqlite3.Xsqlite3_free(tls, zSql)
 14729  		if rc != 0 {
 14730  			return rc
 14731  		}
 14732  	}
 14733  	sqlite3.Xsqlite3_bind_int(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 2, (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang)
 14734  
 14735  	for ok := true; ok; ok = !(isMatch != 0) {
 14736  		pNode = amatchAvlFirst(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FpCost)
 14737  		if pNode == uintptr(0) {
 14738  			pWord = uintptr(0)
 14739  			break
 14740  		}
 14741  		pWord = (*amatch_avl)(unsafe.Pointer(pNode)).FpWord
 14742  		amatchAvlRemove(tls, (pCur + 80 /* &.pCost */), (pWord + 8 /* &.sCost */))
 14743  
 14744  		nWord = int32(libc.Xstrlen(tls, ((pWord + 124 /* &.zWord */) + uintptr(2))))
 14745  		if (nWord + 20) > int32(nBuf) {
 14746  			nBuf = (int8(nWord + 100))
 14747  			zBuf = sqlite3.Xsqlite3_realloc(tls, zBuf, int32(nBuf))
 14748  			if zBuf == uintptr(0) {
 14749  				return SQLITE_NOMEM
 14750  			}
 14751  		}
 14752  		amatchStrcpy(tls, zBuf, ((pWord + 124 /* &.zWord */) + uintptr(2)))
 14753  		*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */)) = int8(0)
 14754  		*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) = *(*int8)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput + uintptr((*amatch_word)(unsafe.Pointer(pWord)).FnMatch)))
 14755  		if *(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) != 0 {
 14756  			for i = 1; (i <= 4) && ((int32(*(*int8)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput + uintptr((int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + i))))) & 0xc0) == 0x80); i++ {
 14757  				*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */ + uintptr(i))) = *(*int8)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput + uintptr((int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + i))))
 14758  			}
 14759  			*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */ + uintptr(i))) = int8(0)
 14760  			nNextIn = i
 14761  		} else {
 14762  			nNextIn = 0
 14763  		}
 14764  
 14765  		if (*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) != '*') {
 14766  			sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14767  			amatchStrcat(tls, zBuf, bp+72 /* &zNextIn[0] */)
 14768  			sqlite3.Xsqlite3_bind_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 1, zBuf, (nWord + nNextIn), uintptr(0))
 14769  			rc = sqlite3.Xsqlite3_step(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14770  			if rc == SQLITE_ROW {
 14771  				zW = sqlite3.Xsqlite3_column_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 0)
 14772  				if libc.Xstrncmp(tls, zBuf, zW, (uint64(nWord+nNextIn))) == 0 {
 14773  					amatchAddWord(tls, pCur, (*amatch_word)(unsafe.Pointer(pWord)).FrCost, (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn), zBuf, ts+489 /* "" */)
 14774  				}
 14775  			}
 14776  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 14777  		}
 14778  
 14779  		for 1 != 0 {
 14780  			amatchStrcpy(tls, (zBuf + uintptr(nWord)), bp+64 /* &zNext[0] */)
 14781  			sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14782  			sqlite3.Xsqlite3_bind_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 1, zBuf, -1, libc.UintptrFromInt32(-1))
 14783  			rc = sqlite3.Xsqlite3_step(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14784  			if rc != SQLITE_ROW {
 14785  				break
 14786  			}
 14787  			zW = sqlite3.Xsqlite3_column_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 0)
 14788  			amatchStrcpy(tls, (zBuf + uintptr(nWord)), bp+64 /* &zNext[0] */)
 14789  			if libc.Xstrncmp(tls, zW, zBuf, uint64(nWord)) != 0 {
 14790  				break
 14791  			}
 14792  			if ((int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) == '*') && (int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */ + 1))) == 0)) ||
 14793  				((int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) == 0) && (int32(*(*int8)(unsafe.Pointer(zW + uintptr(nWord)))) == 0)) {
 14794  				isMatch = 1
 14795  				*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) = int8(0)
 14796  				nNextIn = 0
 14797  				break
 14798  			}
 14799  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */)) = *(*int8)(unsafe.Pointer(zW + uintptr(nWord)))
 14800  			for i = 1; (i <= 4) && ((int32(*(*int8)(unsafe.Pointer(zW + uintptr((nWord + i))))) & 0xc0) == 0x80); i++ {
 14801  				*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr(i))) = *(*int8)(unsafe.Pointer(zW + uintptr((nWord + i))))
 14802  			}
 14803  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr(i))) = int8(0)
 14804  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 14805  			if (*amatch_vtab)(unsafe.Pointer(p)).FrIns > 0 {
 14806  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrIns), int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch),
 14807  					zBuf, bp+64 /* &zNext[0] */)
 14808  			}
 14809  			if (*amatch_vtab)(unsafe.Pointer(p)).FrSub > 0 {
 14810  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrSub), (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn),
 14811  					zBuf, bp+64 /* &zNext[0] */)
 14812  			}
 14813  			if ((*amatch_vtab)(unsafe.Pointer(p)).FrIns < 0) && ((*amatch_vtab)(unsafe.Pointer(p)).FrSub < 0) {
 14814  				break
 14815  			}
 14816  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr((i - 1))))++ // FIX ME
 14817  		}
 14818  		sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 14819  
 14820  		if (*amatch_vtab)(unsafe.Pointer(p)).FrDel > 0 {
 14821  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 14822  			amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrDel), (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn),
 14823  				zBuf, ts+489 /* "" */)
 14824  		}
 14825  
 14826  		for pRule = (*amatch_vtab)(unsafe.Pointer(p)).FpRule; pRule != 0; pRule = (*amatch_rule)(unsafe.Pointer(pRule)).FpNext {
 14827  			if (*amatch_rule)(unsafe.Pointer(pRule)).FiLang != (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang {
 14828  				continue
 14829  			}
 14830  			if libc.Xstrncmp(tls, (*amatch_rule)(unsafe.Pointer(pRule)).FzFrom, ((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput+uintptr((*amatch_word)(unsafe.Pointer(pWord)).FnMatch)), uint64((*amatch_rule)(unsafe.Pointer(pRule)).FnFrom)) == 0 {
 14831  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_rule)(unsafe.Pointer(pRule)).FrCost),
 14832  					(int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + int32((*amatch_rule)(unsafe.Pointer(pRule)).FnFrom)), ((pWord + 124 /* &.zWord */) + uintptr(2)), pRule+26 /* &.zTo */)
 14833  			}
 14834  		}
 14835  	}
 14836  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent = pWord
 14837  	sqlite3.Xsqlite3_free(tls, zBuf)
 14838  	return SQLITE_OK
 14839  }
 14840  
 14841  // Called to "rewind" a cursor back to the beginning so that
 14842  // it starts its output over again.  Always called at least once
 14843  // prior to any amatchColumn, amatchRowid, or amatchEof call.
 14844  func amatchFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* amatch.c:1251:12: */
 14845  	bp := tls.Alloc(8)
 14846  	defer tls.Free(8)
 14847  
 14848  	var pCur uintptr = pVtabCursor
 14849  	var zWord uintptr = ts + 3701 /* "*" */
 14850  	var idx int32
 14851  
 14852  	amatchClearCursor(tls, pCur)
 14853  	idx = 0
 14854  	if (idxNum & 1) != 0 {
 14855  		zWord = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 14856  		idx++
 14857  	}
 14858  	if (idxNum & 2) != 0 {
 14859  		(*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*8)))
 14860  		idx++
 14861  	}
 14862  	if (idxNum & 4) != 0 {
 14863  		(*amatch_cursor)(unsafe.Pointer(pCur)).FiLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*8)))
 14864  		idx++
 14865  	}
 14866  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzInput = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zWord))
 14867  	if (*amatch_cursor)(unsafe.Pointer(pCur)).FzInput == uintptr(0) {
 14868  		return SQLITE_NOMEM
 14869  	}
 14870  	amatchAddWord(tls, pCur, 0, 0, ts+489 /* "" */, ts+489 /* "" */)
 14871  	amatchNext(tls, pVtabCursor)
 14872  
 14873  	return SQLITE_OK
 14874  }
 14875  
 14876  // Only the word and distance columns have values.  All other columns
 14877  // return NULL
 14878  func amatchColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* amatch.c:1286:12: */
 14879  	var pCur uintptr = cur
 14880  	switch i {
 14881  	case AMATCH_COL_WORD:
 14882  		{
 14883  			sqlite3.Xsqlite3_result_text(tls, ctx, (((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent + 124 /* &.zWord */) + uintptr(2)), -1, uintptr(0))
 14884  			break
 14885  
 14886  		}
 14887  	case AMATCH_COL_DISTANCE:
 14888  		{
 14889  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_word)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent)).FrCost)
 14890  			break
 14891  
 14892  		}
 14893  	case AMATCH_COL_LANGUAGE:
 14894  		{
 14895  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang)
 14896  			break
 14897  
 14898  		}
 14899  	case AMATCH_COL_NWORD:
 14900  		{
 14901  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_cursor)(unsafe.Pointer(pCur)).FnWord)
 14902  			break
 14903  
 14904  		}
 14905  	default:
 14906  		{
 14907  			sqlite3.Xsqlite3_result_null(tls, ctx)
 14908  			break
 14909  
 14910  		}
 14911  	}
 14912  	return SQLITE_OK
 14913  }
 14914  
 14915  // The rowid.
 14916  func amatchRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* amatch.c:1316:12: */
 14917  	var pCur uintptr = cur
 14918  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*amatch_cursor)(unsafe.Pointer(pCur)).FiRowid
 14919  	return SQLITE_OK
 14920  }
 14921  
 14922  // EOF indicator
 14923  func amatchEof(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:1325:12: */
 14924  	var pCur uintptr = cur
 14925  	return (libc.Bool32((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent == uintptr(0)))
 14926  }
 14927  
 14928  // Search for terms of these forms:
 14929  //
 14930  //   (A)    word MATCH $str
 14931  //   (B1)   distance < $value
 14932  //   (B2)   distance <= $value
 14933  //   (C)    language == $language
 14934  //
 14935  // The distance< and distance<= are both treated as distance<=.
 14936  // The query plan number is a bit vector:
 14937  //
 14938  //   bit 1:   Term of the form (A) found
 14939  //   bit 2:   Term like (B1) or (B2) found
 14940  //   bit 3:   Term like (C) found
 14941  //
 14942  // If bit-1 is set, $str is always in filter.argv[0].  If bit-2 is set
 14943  // then $value is in filter.argv[0] if bit-1 is clear and is in
 14944  // filter.argv[1] if bit-1 is set.  If bit-3 is set, then $ruleid is
 14945  // in filter.argv[0] if bit-1 and bit-2 are both zero, is in
 14946  // filter.argv[1] if exactly one of bit-1 and bit-2 are set, and is in
 14947  // filter.argv[2] if both bit-1 and bit-2 are set.
 14948  func amatchBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* amatch.c:1352:12: */
 14949  	var iPlan int32 = 0
 14950  	var iDistTerm int32 = -1
 14951  	var iLangTerm int32 = -1
 14952  	var i int32
 14953  	var pConstraint uintptr
 14954  
 14955  	_ = tab
 14956  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 14957  	i = 0
 14958  __1:
 14959  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 14960  		goto __3
 14961  	}
 14962  	{
 14963  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 14964  			goto __2
 14965  		}
 14966  		if (((iPlan & 1) == 0) &&
 14967  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0)) &&
 14968  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 14969  			iPlan = iPlan | (1)
 14970  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 14971  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 14972  		}
 14973  		if (((iPlan & 2) == 0) &&
 14974  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 1)) &&
 14975  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 14976  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 14977  			iPlan = iPlan | (2)
 14978  			iDistTerm = i
 14979  		}
 14980  		if (((iPlan & 4) == 0) &&
 14981  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 2)) &&
 14982  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 14983  			iPlan = iPlan | (4)
 14984  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 14985  			iLangTerm = i
 14986  		}
 14987  
 14988  	}
 14989  	goto __2
 14990  __2:
 14991  	i++
 14992  	pConstraint += 12
 14993  	goto __1
 14994  	goto __3
 14995  __3:
 14996  	;
 14997  	if (iPlan & 2) != 0 {
 14998  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = (1 + (libc.Bool32((iPlan & 1) != 0)))
 14999  	}
 15000  	if (iPlan & 4) != 0 {
 15001  		var idx int32 = 1
 15002  		if (iPlan & 1) != 0 {
 15003  			idx++
 15004  		}
 15005  		if (iPlan & 2) != 0 {
 15006  			idx++
 15007  		}
 15008  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).FargvIndex = idx
 15009  	}
 15010  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 15011  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 15012  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == 1)) &&
 15013  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 15014  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 15015  	}
 15016  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10000)
 15017  
 15018  	return SQLITE_OK
 15019  }
 15020  
 15021  // The xUpdate() method.
 15022  //
 15023  // This implementation disallows DELETE and UPDATE.  The only thing
 15024  // allowed is INSERT into the "command" column.
 15025  func amatchUpdate(tls *libc.TLS, pVTab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* amatch.c:1418:12: */
 15026  	bp := tls.Alloc(24)
 15027  	defer tls.Free(24)
 15028  
 15029  	var p uintptr = pVTab
 15030  	var zCmd uintptr
 15031  	_ = pRowid
 15032  	if argc == 1 {
 15033  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+3703, /* "DELETE from %s i..." */
 15034  			libc.VaList(bp, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 15035  		return SQLITE_ERROR
 15036  	}
 15037  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_NULL {
 15038  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+3733, /* "UPDATE of %s is ..." */
 15039  			libc.VaList(bp+8, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 15040  		return SQLITE_ERROR
 15041  	}
 15042  	if ((sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))) != SQLITE_NULL) ||
 15043  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) != SQLITE_NULL)) ||
 15044  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))) != SQLITE_NULL) {
 15045  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 15046  			ts+3761 /* "INSERT INTO %s a..." */, libc.VaList(bp+16, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 15047  		return SQLITE_ERROR
 15048  	}
 15049  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8)))
 15050  	if zCmd == uintptr(0) {
 15051  		return SQLITE_OK
 15052  	}
 15053  
 15054  	return SQLITE_OK
 15055  }
 15056  
 15057  // A virtual table module that implements the "approximate_match".
 15058  var amatchModule = sqlite3_module{ // iVersion
 15059  	FxCreate:     0, // xCreate
 15060  	FxConnect:    0, // xConnect
 15061  	FxBestIndex:  0, // xBestIndex
 15062  	FxDisconnect: 0, // xDisconnect
 15063  	FxDestroy:    0, // xDestroy
 15064  	FxOpen:       0, // xOpen - open a cursor
 15065  	FxClose:      0, // xClose - close a cursor
 15066  	FxFilter:     0, // xFilter - configure scan constraints
 15067  	FxNext:       0, // xNext - advance a cursor
 15068  	FxEof:        0, // xEof - check for end of scan
 15069  	FxColumn:     0, // xColumn - read data
 15070  	FxRowid:      0, // xRowid - read data
 15071  	FxUpdate:     0, // xShadowName
 15072  } /* amatch.c:1454:23 */
 15073  
 15074  // Register the amatch virtual table
 15075  func sqlite3_amatch_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* amatch.c:1489:5: */
 15076  	var rc int32 = SQLITE_OK
 15077  	_ = pApi
 15078  
 15079  	_ = pzErrMsg // Not used
 15080  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3810 /* "approximate_matc..." */, uintptr(unsafe.Pointer(&amatchModule)), uintptr(0))
 15081  	return rc
 15082  }
 15083  
 15084  // Allowed values for the mFlags parameter to sqlite3_carray_bind().
 15085  // Must exactly match the definitions in carray.h.
 15086  
 15087  // Names of allowed datatypes
 15088  var azType = [4]uintptr{ts + 3828 /* "int32" */, ts + 3834 /* "int64" */, ts + 2423 /* "double" */, ts + 3840 /* "char*" */} /* carray.c:73:19 */
 15089  
 15090  // Structure used to hold the sqlite3_carray_bind() information
 15091  type carray_bind1 = struct {
 15092  	FaData  uintptr
 15093  	FnData  int32
 15094  	FmFlags int32
 15095  	FxDel   uintptr
 15096  } /* carray.c:78:9 */
 15097  
 15098  // Structure used to hold the sqlite3_carray_bind() information
 15099  type carray_bind = carray_bind1 /* carray.c:78:28 */
 15100  
 15101  // carray_cursor is a subclass of sqlite3_vtab_cursor which will
 15102  // serve as the underlying representation of a cursor that scans
 15103  // over rows of the result
 15104  type carray_cursor1 = struct {
 15105  	Fbase   sqlite3_vtab_cursor
 15106  	FiRowid sqlite3_int64
 15107  	FpPtr   uintptr
 15108  	FiCnt   sqlite3_int64
 15109  	FeType  uint8
 15110  	_       [7]byte
 15111  } /* carray.c:91:9 */
 15112  
 15113  // carray_cursor is a subclass of sqlite3_vtab_cursor which will
 15114  // serve as the underlying representation of a cursor that scans
 15115  // over rows of the result
 15116  type carray_cursor = carray_cursor1 /* carray.c:91:30 */
 15117  
 15118  // The carrayConnect() method is invoked to create a new
 15119  // carray_vtab that describes the carray virtual table.
 15120  //
 15121  // Think of this routine as the constructor for carray_vtab objects.
 15122  //
 15123  // All this routine needs to do is:
 15124  //
 15125  //    (1) Allocate the carray_vtab object and initialize all fields.
 15126  //
 15127  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 15128  //        result set of queries against carray will look like.
 15129  func carrayConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* carray.c:113:12: */
 15130  	var pNew uintptr
 15131  	var rc int32
 15132  
 15133  	// Column numbers
 15134  
 15135  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 15136  		ts+3846 /* "CREATE TABLE x(v..." */)
 15137  	if rc == SQLITE_OK {
 15138  		pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 15139  		if pNew == uintptr(0) {
 15140  			return SQLITE_NOMEM
 15141  		}
 15142  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(sqlite3_vtab{})))
 15143  	}
 15144  	return rc
 15145  }
 15146  
 15147  // This method is the destructor for carray_cursor objects.
 15148  func carrayDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* carray.c:142:12: */
 15149  	sqlite3.Xsqlite3_free(tls, pVtab)
 15150  	return SQLITE_OK
 15151  }
 15152  
 15153  // Constructor for a new carray_cursor object.
 15154  func carrayOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* carray.c:150:12: */
 15155  	var pCur uintptr
 15156  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(carray_cursor{})))
 15157  	if pCur == uintptr(0) {
 15158  		return SQLITE_NOMEM
 15159  	}
 15160  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(carray_cursor{})))
 15161  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 15162  	return SQLITE_OK
 15163  }
 15164  
 15165  // Destructor for a carray_cursor.
 15166  func carrayClose(tls *libc.TLS, cur uintptr) int32 { /* carray.c:162:12: */
 15167  	sqlite3.Xsqlite3_free(tls, cur)
 15168  	return SQLITE_OK
 15169  }
 15170  
 15171  // Advance a carray_cursor to its next row of output.
 15172  func carrayNext(tls *libc.TLS, cur uintptr) int32 { /* carray.c:171:12: */
 15173  	var pCur uintptr = cur
 15174  	(*carray_cursor)(unsafe.Pointer(pCur)).FiRowid++
 15175  	return SQLITE_OK
 15176  }
 15177  
 15178  // Return values of columns for the row at which the carray_cursor
 15179  // is currently pointing.
 15180  func carrayColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* carray.c:181:12: */
 15181  	var pCur uintptr = cur
 15182  	var x sqlite3_int64 = int64(0)
 15183  	switch i {
 15184  	case CARRAY_COLUMN_POINTER:
 15185  		return SQLITE_OK
 15186  	case CARRAY_COLUMN_COUNT:
 15187  		x = (*carray_cursor)(unsafe.Pointer(pCur)).FiCnt
 15188  		break
 15189  	case CARRAY_COLUMN_CTYPE:
 15190  		{
 15191  			sqlite3.Xsqlite3_result_text(tls, ctx, azType[(*carray_cursor)(unsafe.Pointer(pCur)).FeType], -1, uintptr(0))
 15192  			return SQLITE_OK
 15193  
 15194  		}
 15195  	default:
 15196  		{
 15197  			switch int32((*carray_cursor)(unsafe.Pointer(pCur)).FeType) {
 15198  			case CARRAY_INT32:
 15199  				{
 15200  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 15201  					sqlite3.Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*4)))
 15202  					return SQLITE_OK
 15203  
 15204  				}
 15205  			case CARRAY_INT64:
 15206  				{
 15207  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 15208  					sqlite3.Xsqlite3_result_int64(tls, ctx, *(*sqlite3_int64)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*8)))
 15209  					return SQLITE_OK
 15210  
 15211  				}
 15212  			case CARRAY_DOUBLE:
 15213  				{
 15214  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 15215  					sqlite3.Xsqlite3_result_double(tls, ctx, *(*float64)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*8)))
 15216  					return SQLITE_OK
 15217  
 15218  				}
 15219  			case CARRAY_TEXT:
 15220  				{
 15221  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 15222  					sqlite3.Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*8)), -1, libc.UintptrFromInt32(-1))
 15223  					return SQLITE_OK
 15224  
 15225  				}
 15226  			}
 15227  
 15228  		}
 15229  	}
 15230  	sqlite3.Xsqlite3_result_int64(tls, ctx, x)
 15231  	return SQLITE_OK
 15232  }
 15233  
 15234  // Return the rowid for the current row.  In this implementation, the
 15235  // rowid is the same as the output value.
 15236  func carrayRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* carray.c:228:12: */
 15237  	var pCur uintptr = cur
 15238  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*carray_cursor)(unsafe.Pointer(pCur)).FiRowid
 15239  	return SQLITE_OK
 15240  }
 15241  
 15242  // Return TRUE if the cursor has been moved off of the last
 15243  // row of output.
 15244  func carrayEof(tls *libc.TLS, cur uintptr) int32 { /* carray.c:238:12: */
 15245  	var pCur uintptr = cur
 15246  	return (libc.Bool32((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid > (*carray_cursor)(unsafe.Pointer(pCur)).FiCnt))
 15247  }
 15248  
 15249  // This method is called to "rewind" the carray_cursor object back
 15250  // to the first row of output.
 15251  func carrayFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* carray.c:247:12: */
 15252  	bp := tls.Alloc(8)
 15253  	defer tls.Free(8)
 15254  
 15255  	var pCur uintptr = pVtabCursor
 15256  	(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = uintptr(0)
 15257  	(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = int64(0)
 15258  	switch idxNum {
 15259  	case 1:
 15260  		{
 15261  			var pBind uintptr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+3909 /* "carray-bind" */)
 15262  			if pBind == uintptr(0) {
 15263  				break
 15264  			}
 15265  			(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = (*carray_bind)(unsafe.Pointer(pBind)).FaData
 15266  			(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = sqlite3_int64((*carray_bind)(unsafe.Pointer(pBind)).FnData)
 15267  			(*carray_cursor)(unsafe.Pointer(pCur)).FeType = (uint8((*carray_bind)(unsafe.Pointer(pBind)).FmFlags & 0x03))
 15268  			break
 15269  
 15270  		}
 15271  	case 2:
 15272  		fallthrough
 15273  	case 3:
 15274  		{
 15275  			(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+3921 /* "carray" */)
 15276  			(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = func() int64 {
 15277  				if (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr != 0 {
 15278  					return sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 15279  				}
 15280  				return int64(0)
 15281  			}()
 15282  			if idxNum < 3 {
 15283  				(*carray_cursor)(unsafe.Pointer(pCur)).FeType = uint8(CARRAY_INT32)
 15284  			} else {
 15285  				var i uint8
 15286  				var zType uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 15287  				for i = uint8(0); uint64(i) < (uint64(unsafe.Sizeof(azType)) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 15288  					if sqlite3.Xsqlite3_stricmp(tls, zType, azType[i]) == 0 {
 15289  						break
 15290  					}
 15291  				}
 15292  				if uint64(i) >= (uint64(unsafe.Sizeof(azType)) / uint64(unsafe.Sizeof(uintptr(0)))) {
 15293  					(*sqlite3_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 15294  						ts+3928 /* "unknown datatype..." */, libc.VaList(bp, zType))
 15295  					return SQLITE_ERROR
 15296  				} else {
 15297  					(*carray_cursor)(unsafe.Pointer(pCur)).FeType = i
 15298  				}
 15299  			}
 15300  			break
 15301  
 15302  		}
 15303  	}
 15304  	(*carray_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 15305  	return SQLITE_OK
 15306  }
 15307  
 15308  // SQLite will invoke this method one or more times while planning a query
 15309  // that uses the carray virtual table.  This routine needs to create
 15310  // a query plan for each invocation and compute an estimated cost for that
 15311  // plan.
 15312  //
 15313  // In this implementation idxNum is used to represent the
 15314  // query plan.  idxStr is unused.
 15315  //
 15316  // idxNum is:
 15317  //
 15318  //    1    If only the pointer= constraint exists.  In this case, the
 15319  //         parameter must be bound using sqlite3_carray_bind().
 15320  //
 15321  //    2    if the pointer= and count= constraints exist.
 15322  //
 15323  //    3    if the ctype= constraint also exists.
 15324  //
 15325  // idxNum is 0 otherwise and carray becomes an empty table.
 15326  func carrayBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* carray.c:311:12: */
 15327  	var i int32             // Loop over constraints
 15328  	var ptrIdx int32 = -1   // Index of the pointer= constraint, or -1 if none
 15329  	var cntIdx int32 = -1   // Index of the count= constraint, or -1 if none
 15330  	var ctypeIdx int32 = -1 // Index of the ctype= constraint, or -1 if none
 15331  
 15332  	var pConstraint uintptr
 15333  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 15334  	i = 0
 15335  __1:
 15336  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 15337  		goto __3
 15338  	}
 15339  	{
 15340  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 15341  			goto __2
 15342  		}
 15343  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 15344  			goto __2
 15345  		}
 15346  		switch (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn {
 15347  		case CARRAY_COLUMN_POINTER:
 15348  			ptrIdx = i
 15349  			break
 15350  		case CARRAY_COLUMN_COUNT:
 15351  			cntIdx = i
 15352  			break
 15353  		case CARRAY_COLUMN_CTYPE:
 15354  			ctypeIdx = i
 15355  			break
 15356  		}
 15357  
 15358  	}
 15359  	goto __2
 15360  __2:
 15361  	i++
 15362  	pConstraint += 12
 15363  	goto __1
 15364  	goto __3
 15365  __3:
 15366  	;
 15367  	if ptrIdx >= 0 {
 15368  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ptrIdx)*8)).FargvIndex = 1
 15369  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ptrIdx)*8)).Fomit = uint8(1)
 15370  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1)
 15371  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100)
 15372  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 15373  		if cntIdx >= 0 {
 15374  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(cntIdx)*8)).FargvIndex = 2
 15375  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(cntIdx)*8)).Fomit = uint8(1)
 15376  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2
 15377  			if ctypeIdx >= 0 {
 15378  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ctypeIdx)*8)).FargvIndex = 3
 15379  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ctypeIdx)*8)).Fomit = uint8(1)
 15380  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 3
 15381  			}
 15382  		}
 15383  	} else {
 15384  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(2147483647)
 15385  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647)
 15386  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 15387  	}
 15388  	return SQLITE_OK
 15389  }
 15390  
 15391  // This following structure defines all the methods for the
 15392  // carray virtual table.
 15393  var carrayModule = sqlite3_module{ // xCreate
 15394  	FxConnect:    0, // xConnect
 15395  	FxBestIndex:  0, // xBestIndex
 15396  	FxDisconnect: 0, // xDestroy
 15397  	FxOpen:       0, // xOpen - open a cursor
 15398  	FxClose:      0, // xClose - close a cursor
 15399  	FxFilter:     0, // xFilter - configure scan constraints
 15400  	FxNext:       0, // xNext - advance a cursor
 15401  	FxEof:        0, // xEof - check for end of scan
 15402  	FxColumn:     0, // xColumn - read data
 15403  	FxRowid:      0, // xRename
 15404  } /* carray.c:365:23 */
 15405  
 15406  // Destructor for the carray_bind object
 15407  func carrayBindDel(tls *libc.TLS, pPtr uintptr) { /* carray.c:391:13: */
 15408  	var p uintptr = pPtr
 15409  	if (*carray_bind)(unsafe.Pointer(p)).FxDel != (uintptr(0)) {
 15410  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 16 /* &.xDel */))))(tls, (*carray_bind)(unsafe.Pointer(p)).FaData)
 15411  	}
 15412  	sqlite3.Xsqlite3_free(tls, p)
 15413  }
 15414  
 15415  // Invoke this interface in order to bind to the single-argument
 15416  // version of CARRAY().
 15417  func sqlite3_carray_bind(tls *libc.TLS, pStmt uintptr, idx int32, aData uintptr, nData int32, mFlags int32, xDestroy uintptr) int32 { /* carray.c:406:5: */
 15418  	var pNew uintptr
 15419  	var i int32
 15420  	pNew = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(carray_bind{})))
 15421  	if pNew == uintptr(0) {
 15422  		if (xDestroy != (uintptr(0))) && (xDestroy != (libc.UintptrFromInt32(-1))) {
 15423  			(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, aData)
 15424  		}
 15425  		return SQLITE_NOMEM
 15426  	}
 15427  	(*carray_bind)(unsafe.Pointer(pNew)).FnData = nData
 15428  	(*carray_bind)(unsafe.Pointer(pNew)).FmFlags = mFlags
 15429  	if xDestroy == (libc.UintptrFromInt32(-1)) {
 15430  		var sz sqlite3_int64 = sqlite3_int64(nData)
 15431  		switch mFlags & 0x03 {
 15432  		case CARRAY_INT32:
 15433  			sz = sz * (int64(4))
 15434  			break
 15435  			fallthrough
 15436  		case CARRAY_INT64:
 15437  			sz = sz * (int64(8))
 15438  			break
 15439  			fallthrough
 15440  		case CARRAY_DOUBLE:
 15441  			sz = sz * (int64(8))
 15442  			break
 15443  			fallthrough
 15444  		case CARRAY_TEXT:
 15445  			sz = int64(uint64(sz) * (uint64(unsafe.Sizeof(uintptr(0)))))
 15446  			break
 15447  		}
 15448  		if (mFlags & 0x03) == CARRAY_TEXT {
 15449  			for i = 0; i < nData; i++ {
 15450  				var z uintptr = *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*8))
 15451  				if z != 0 {
 15452  					sz = sqlite3_int64(uint64(sz) + (uint64(libc.Xstrlen(tls, z) + uint64(1))))
 15453  				}
 15454  			}
 15455  		}
 15456  		(*carray_bind)(unsafe.Pointer(pNew)).FaData = sqlite3.Xsqlite3_malloc64(tls, uint64(sz))
 15457  		if (*carray_bind)(unsafe.Pointer(pNew)).FaData == uintptr(0) {
 15458  			sqlite3.Xsqlite3_free(tls, pNew)
 15459  			return SQLITE_NOMEM
 15460  		}
 15461  		if (mFlags & 0x03) == CARRAY_TEXT {
 15462  			var az uintptr = (*carray_bind)(unsafe.Pointer(pNew)).FaData
 15463  			var z uintptr = (az + uintptr(nData)*8)
 15464  			for i = 0; i < nData; i++ {
 15465  				var zData uintptr = *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*8))
 15466  				var n sqlite3_int64
 15467  				if zData == uintptr(0) {
 15468  					*(*uintptr)(unsafe.Pointer(az + uintptr(i)*8)) = uintptr(0)
 15469  					continue
 15470  				}
 15471  				*(*uintptr)(unsafe.Pointer(az + uintptr(i)*8)) = z
 15472  				n = sqlite3_int64(libc.Xstrlen(tls, zData))
 15473  				libc.Xmemcpy(tls, z, zData, (uint64(n + int64(1))))
 15474  				z += (uintptr(n + int64(1)))
 15475  			}
 15476  		} else {
 15477  			libc.Xmemcpy(tls, (*carray_bind)(unsafe.Pointer(pNew)).FaData, aData, (uint64(sz * sqlite3_int64(nData))))
 15478  		}
 15479  		(*carray_bind)(unsafe.Pointer(pNew)).FxDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 15480  	} else {
 15481  		(*carray_bind)(unsafe.Pointer(pNew)).FaData = aData
 15482  		(*carray_bind)(unsafe.Pointer(pNew)).FxDel = xDestroy
 15483  	}
 15484  	return sqlite3.Xsqlite3_bind_pointer(tls, pStmt, idx, pNew, ts+3909 /* "carray-bind" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{carrayBindDel})))
 15485  }
 15486  
 15487  // For testing purpose in the TCL test harness, we need a method for
 15488  // setting the pointer value.  The inttoptr(X) SQL function accomplishes
 15489  // this.  Tcl script will bind an integer to X and the inttoptr() SQL
 15490  // function will use sqlite3_result_pointer() to convert that integer into
 15491  // a pointer.
 15492  //
 15493  // This is for testing on TCL only.
 15494  func inttoptrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* carray.c:481:13: */
 15495  	bp := tls.Alloc(20)
 15496  	defer tls.Free(20)
 15497  
 15498  	// var p uintptr at bp, 8
 15499  
 15500  	// var i64 sqlite3_int64 at bp+8, 8
 15501  
 15502  	*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* i64 */)) = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 15503  	if uint64(unsafe.Sizeof(sqlite3_int64(0))) == uint64(unsafe.Sizeof(uintptr(0))) {
 15504  		libc.Xmemcpy(tls, bp /* &p */, bp+8 /* &i64 */, uint64(unsafe.Sizeof(uintptr(0))))
 15505  	} else {
 15506  		*(*int32)(unsafe.Pointer(bp + 16 /* i32 */)) = (int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* i64 */)) & int64(0xffffffff)))
 15507  		libc.Xmemcpy(tls, bp /* &p */, bp+16 /* &i32 */, uint64(unsafe.Sizeof(uintptr(0))))
 15508  	}
 15509  	sqlite3.Xsqlite3_result_pointer(tls, context, *(*uintptr)(unsafe.Pointer(bp /* p */)), ts+3921 /* "carray" */, uintptr(0))
 15510  }
 15511  
 15512  func sqlite3_carray_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* carray.c:504:5: */
 15513  	var rc int32 = SQLITE_OK
 15514  	_ = pApi
 15515  
 15516  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3921 /* "carray" */, uintptr(unsafe.Pointer(&carrayModule)), uintptr(0))
 15517  	if rc == SQLITE_OK {
 15518  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+3949 /* "inttoptr" */, 1, SQLITE_UTF8, uintptr(0),
 15519  			*(*uintptr)(unsafe.Pointer(&struct {
 15520  				f func(*libc.TLS, uintptr, int32, uintptr)
 15521  			}{inttoptrFunc})), uintptr(0), uintptr(0))
 15522  	}
 15523  	return rc
 15524  }
 15525  
 15526  // Forward declaration of objects used by this utility
 15527  type CksmVfs = sqlite3_vfs1 /* cksumvfs.c:176:28 */
 15528  type CksmFile1 = struct {
 15529  	Fbase        sqlite3_file
 15530  	FzFName      uintptr
 15531  	FcomputeCksm int8
 15532  	FverifyCksm  int8
 15533  	FisWal       int8
 15534  	FinCkpt      int8
 15535  	_            [4]byte
 15536  	FpPartner    uintptr
 15537  } /* cksumvfs.c:177:9 */
 15538  
 15539  type CksmFile = CksmFile1 /* cksumvfs.c:177:25 */
 15540  
 15541  // Useful datatype abbreviations
 15542  type u8 = uint8 /* cksumvfs.c:183:25 */
 15543  
 15544  var cksm_vfs = sqlite3_vfs{
 15545  	FiVersion:          3,         // szOsFile (set when registered)
 15546  	FmxPathname:        1024,      // pNext
 15547  	FzName:             ts + 3958, /* "cksmvfs" */ /* pAppData (set when registered) */
 15548  	FxOpen:             0,         // xOpen
 15549  	FxDelete:           0,         // xDelete
 15550  	FxAccess:           0,         // xAccess
 15551  	FxFullPathname:     0,         // xFullPathname
 15552  	FxDlOpen:           0,         // xDlOpen
 15553  	FxDlError:          0,         // xDlError
 15554  	FxDlSym:            0,         // xDlSym
 15555  	FxDlClose:          0,         // xDlClose
 15556  	FxRandomness:       0,         // xRandomness
 15557  	FxSleep:            0,         // xSleep
 15558  	FxCurrentTime:      0,         // xCurrentTime
 15559  	FxGetLastError:     0,         // xGetLastError
 15560  	FxCurrentTimeInt64: 0,         // xCurrentTimeInt64
 15561  	FxSetSystemCall:    0,         // xSetSystemCall
 15562  	FxGetSystemCall:    0,         // xGetSystemCall
 15563  	FxNextSystemCall:   0,         // xNextSystemCall
 15564  } /* cksumvfs.c:247:20 */
 15565  
 15566  var cksm_io_methods = sqlite3_io_methods{
 15567  	FiVersion:               3, // iVersion
 15568  	FxClose:                 0, // xClose
 15569  	FxRead:                  0, // xRead
 15570  	FxWrite:                 0, // xWrite
 15571  	FxTruncate:              0, // xTruncate
 15572  	FxSync:                  0, // xSync
 15573  	FxFileSize:              0, // xFileSize
 15574  	FxLock:                  0, // xLock
 15575  	FxUnlock:                0, // xUnlock
 15576  	FxCheckReservedLock:     0, // xCheckReservedLock
 15577  	FxFileControl:           0, // xFileControl
 15578  	FxSectorSize:            0, // xSectorSize
 15579  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 15580  	FxShmMap:                0, // xShmMap
 15581  	FxShmLock:               0, // xShmLock
 15582  	FxShmBarrier:            0, // xShmBarrier
 15583  	FxShmUnmap:              0, // xShmUnmap
 15584  	FxFetch:                 0, // xFetch
 15585  	FxUnfetch:               0, // xUnfetch
 15586  } /* cksumvfs.c:272:33 */
 15587  
 15588  // Do byte swapping on a unsigned 32-bit integer
 15589  
 15590  // Compute a checksum on a buffer
 15591  func cksmCompute(tls *libc.TLS, a uintptr, nByte int32, aOut uintptr) { /* cksumvfs.c:301:13: */
 15592  	bp := tls.Alloc(12)
 15593  	defer tls.Free(12)
 15594  
 15595  	*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) = u32(0)
 15596  	*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) = u32(0)
 15597  	var aData uintptr = a
 15598  	var aEnd uintptr = (a + uintptr(nByte))
 15599  	*(*u32)(unsafe.Pointer(bp /* x */)) = u32(1)
 15600  
 15601  	if 1 == int32(*(*u8)(unsafe.Pointer(bp /* &x */))) {
 15602  		// Little-endian
 15603  		for ok := true; ok; ok = (aData < aEnd) {
 15604  			*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) += (*(*u32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + *(*u32)(unsafe.Pointer(bp + 8 /* s2 */)))
 15605  			*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) += (*(*u32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + *(*u32)(unsafe.Pointer(bp + 4 /* s1 */)))
 15606  		}
 15607  	} else {
 15608  		// Big-endian
 15609  		for ok1 := true; ok1; ok1 = (aData < aEnd) {
 15610  			*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) += (((((((*(*u32)(unsafe.Pointer(aData))) & u32(0x000000FF)) << 24) + (((*(*u32)(unsafe.Pointer(aData))) & u32(0x0000FF00)) << 8)) + (((*(*u32)(unsafe.Pointer(aData))) & u32(0x00FF0000)) >> 8)) + (((*(*u32)(unsafe.Pointer(aData))) & 0xFF000000) >> 24)) + *(*u32)(unsafe.Pointer(bp + 8 /* s2 */)))
 15611  			*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) += (((((((*(*u32)(unsafe.Pointer(aData + 1*4))) & u32(0x000000FF)) << 24) + (((*(*u32)(unsafe.Pointer(aData + 1*4))) & u32(0x0000FF00)) << 8)) + (((*(*u32)(unsafe.Pointer(aData + 1*4))) & u32(0x00FF0000)) >> 8)) + (((*(*u32)(unsafe.Pointer(aData + 1*4))) & 0xFF000000) >> 24)) + *(*u32)(unsafe.Pointer(bp + 4 /* s1 */)))
 15612  			aData += 4 * (uintptr(2))
 15613  		}
 15614  		*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) = ((((((*(*u32)(unsafe.Pointer(bp + 4 /* s1 */))) & u32(0x000000FF)) << 24) + (((*(*u32)(unsafe.Pointer(bp + 4 /* s1 */))) & u32(0x0000FF00)) << 8)) + (((*(*u32)(unsafe.Pointer(bp + 4 /* s1 */))) & u32(0x00FF0000)) >> 8)) + (((*(*u32)(unsafe.Pointer(bp + 4 /* s1 */))) & 0xFF000000) >> 24))
 15615  		*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) = ((((((*(*u32)(unsafe.Pointer(bp + 8 /* s2 */))) & u32(0x000000FF)) << 24) + (((*(*u32)(unsafe.Pointer(bp + 8 /* s2 */))) & u32(0x0000FF00)) << 8)) + (((*(*u32)(unsafe.Pointer(bp + 8 /* s2 */))) & u32(0x00FF0000)) >> 8)) + (((*(*u32)(unsafe.Pointer(bp + 8 /* s2 */))) & 0xFF000000) >> 24))
 15616  	}
 15617  	libc.Xmemcpy(tls, aOut, bp+4 /* &s1 */, uint64(4))
 15618  	libc.Xmemcpy(tls, (aOut + uintptr(4)), bp+8 /* &s2 */, uint64(4))
 15619  }
 15620  
 15621  // SQL function:    verify_checksum(BLOB)
 15622  //
 15623  // Return 0 or 1 if the checksum is invalid or valid.  Or return
 15624  // NULL if the input is not a BLOB that is the right size for a
 15625  // database page.
 15626  func cksmVerifyFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* cksumvfs.c:342:13: */
 15627  	bp := tls.Alloc(8)
 15628  	defer tls.Free(8)
 15629  
 15630  	var nByte int32
 15631  	var data uintptr
 15632  	// var cksum [8]u8 at bp, 8
 15633  
 15634  	data = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 15635  	if data == uintptr(0) {
 15636  		return
 15637  	}
 15638  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_BLOB {
 15639  		return
 15640  	}
 15641  	nByte = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 15642  	if ((nByte < 512) || (nByte > 65536)) || ((nByte & (nByte - 1)) != 0) {
 15643  		return
 15644  	}
 15645  	cksmCompute(tls, data, (nByte - 8), bp /* &cksum[0] */)
 15646  	sqlite3.Xsqlite3_result_int(tls, context, (libc.Bool32(libc.Xmemcmp(tls, ((data+uintptr(nByte))-uintptr(8)), bp /* &cksum[0] */, uint64(8)) == 0)))
 15647  }
 15648  
 15649  // Close a cksm-file.
 15650  func cksmClose(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:397:12: */
 15651  	var p uintptr = pFile
 15652  	if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 15653  
 15654  		(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FpPartner = uintptr(0)
 15655  		(*CksmFile)(unsafe.Pointer(p)).FpPartner = uintptr(0)
 15656  	}
 15657  	pFile = ((pFile) + uintptr(1)*32)
 15658  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xClose */))))(tls, pFile)
 15659  }
 15660  
 15661  // Set the computeCkSm and verifyCksm flags, if they need to be
 15662  // changed.
 15663  func cksmSetFlags(tls *libc.TLS, p uintptr, hasCorrectReserveSize int32) { /* cksumvfs.c:412:13: */
 15664  	if hasCorrectReserveSize != int32((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm) {
 15665  		(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = libc.AssignPtrInt8(p+17 /* &.verifyCksm */, int8(hasCorrectReserveSize))
 15666  		if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 15667  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FverifyCksm = int8(hasCorrectReserveSize)
 15668  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FcomputeCksm = int8(hasCorrectReserveSize)
 15669  		}
 15670  	}
 15671  }
 15672  
 15673  // Read data from a cksm-file.
 15674  func cksmRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* cksumvfs.c:425:12: */
 15675  	bp := tls.Alloc(24)
 15676  	defer tls.Free(24)
 15677  
 15678  	var rc int32
 15679  	var p uintptr = pFile
 15680  	pFile = ((pFile) + uintptr(1)*32)
 15681  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xRead */))))(tls, pFile, zBuf, iAmt, iOfst)
 15682  	if rc == SQLITE_OK {
 15683  		if ((iOfst == int64(0)) && (iAmt >= 100)) && ((libc.Xmemcmp(tls, zBuf, ts+3149 /* "SQLite format 3" */, uint64(16)) == 0) || (libc.Xmemcmp(tls, zBuf, ts+3966 /* "ZV-" */, uint64(3)) == 0)) {
 15684  			var d uintptr = zBuf
 15685  			var hasCorrectReserveSize int8 = (int8(libc.Bool32(int32(*(*u8)(unsafe.Pointer(d + 20))) == 8)))
 15686  			cksmSetFlags(tls, p, int32(hasCorrectReserveSize))
 15687  		}
 15688  		// Verify the checksum if
 15689  		//    (1) the size indicates that we are dealing with a complete
 15690  		//        database page
 15691  		//    (2) checksum verification is enabled
 15692  		//    (3) we are not in the middle of checkpoint
 15693  		if ((iAmt >= 512) && // (1)
 15694  			((*CksmFile)(unsafe.Pointer(p)).FverifyCksm != 0)) && // (2)
 15695  			!(int32((*CksmFile)(unsafe.Pointer(p)).FinCkpt) != 0) {
 15696  			// var cksum [8]u8 at bp+16, 8
 15697  
 15698  			cksmCompute(tls, zBuf, (iAmt - 8), bp+16 /* &cksum[0] */)
 15699  			if libc.Xmemcmp(tls, ((zBuf+uintptr(iAmt))-uintptr(8)), bp+16 /* &cksum[0] */, uint64(8)) != 0 {
 15700  				sqlite3.Xsqlite3_log(tls, (SQLITE_IOERR | (int32(32) << 8)),
 15701  					ts+3970, /* "checksum fault o..." */
 15702  					libc.VaList(bp, iOfst, (*CksmFile)(unsafe.Pointer(p)).FzFName))
 15703  				rc = (SQLITE_IOERR | (int32(32) << 8))
 15704  			}
 15705  		}
 15706  	}
 15707  	return rc
 15708  }
 15709  
 15710  // Write data to a cksm-file.
 15711  func cksmWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* cksumvfs.c:469:12: */
 15712  	var p uintptr = pFile
 15713  	pFile = ((pFile) + uintptr(1)*32)
 15714  	if ((iOfst == int64(0)) && (iAmt >= 100)) && ((libc.Xmemcmp(tls, zBuf, ts+3149 /* "SQLite format 3" */, uint64(16)) == 0) || (libc.Xmemcmp(tls, zBuf, ts+3966 /* "ZV-" */, uint64(3)) == 0)) {
 15715  		var d uintptr = zBuf
 15716  		var hasCorrectReserveSize int8 = (int8(libc.Bool32(int32(*(*u8)(unsafe.Pointer(d + 20))) == 8)))
 15717  		cksmSetFlags(tls, p, int32(hasCorrectReserveSize))
 15718  	}
 15719  	// If the write size is appropriate for a database page and if
 15720  	// checksums where ever enabled, then it will be safe to compute
 15721  	// the checksums.  The reserve byte size might have increased, but
 15722  	// it will never decrease.  And because it cannot decrease, the
 15723  	// checksum will not overwrite anything.
 15724  	if ((iAmt >= 512) &&
 15725  		((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0)) &&
 15726  		!(int32((*CksmFile)(unsafe.Pointer(p)).FinCkpt) != 0) {
 15727  		cksmCompute(tls, zBuf, (iAmt - 8), (((zBuf) + uintptr(iAmt)) - uintptr(8)))
 15728  	}
 15729  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 24 /* &.xWrite */))))(tls, pFile, zBuf, iAmt, iOfst)
 15730  }
 15731  
 15732  // Truncate a cksm-file.
 15733  func cksmTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* cksumvfs.c:502:12: */
 15734  	pFile = ((pFile) + uintptr(1)*32)
 15735  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 32 /* &.xTruncate */))))(tls, pFile, size)
 15736  }
 15737  
 15738  // Sync a cksm-file.
 15739  func cksmSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* cksumvfs.c:510:12: */
 15740  	pFile = ((pFile) + uintptr(1)*32)
 15741  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 40 /* &.xSync */))))(tls, pFile, flags)
 15742  }
 15743  
 15744  // Return the current file-size of a cksm-file.
 15745  func cksmFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* cksumvfs.c:518:12: */
 15746  	var p uintptr = pFile
 15747  	pFile = ((p) + uintptr(1)*32)
 15748  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 48 /* &.xFileSize */))))(tls, pFile, pSize)
 15749  }
 15750  
 15751  // Lock a cksm-file.
 15752  func cksmLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* cksumvfs.c:527:12: */
 15753  	pFile = ((pFile) + uintptr(1)*32)
 15754  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 56 /* &.xLock */))))(tls, pFile, eLock)
 15755  }
 15756  
 15757  // Unlock a cksm-file.
 15758  func cksmUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* cksumvfs.c:535:12: */
 15759  	pFile = ((pFile) + uintptr(1)*32)
 15760  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 64 /* &.xUnlock */))))(tls, pFile, eLock)
 15761  }
 15762  
 15763  // Check if another file-handle holds a RESERVED lock on a cksm-file.
 15764  func cksmCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* cksumvfs.c:543:12: */
 15765  	pFile = ((pFile) + uintptr(1)*32)
 15766  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, pFile, pResOut)
 15767  }
 15768  
 15769  // File control method. For custom operations on a cksm-file.
 15770  func cksmFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* cksumvfs.c:551:12: */
 15771  	bp := tls.Alloc(16)
 15772  	defer tls.Free(16)
 15773  
 15774  	var rc int32
 15775  	var p uintptr = pFile
 15776  	pFile = ((pFile) + uintptr(1)*32)
 15777  	if op == SQLITE_FCNTL_PRAGMA {
 15778  		var azArg uintptr = pArg
 15779  
 15780  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), ts+4005 /* "checksum_verific..." */) == 0 {
 15781  			var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + 2*8))
 15782  			if zArg != uintptr(0) {
 15783  				if ((((int32(*(*int8)(unsafe.Pointer(zArg))) >= '1') && (int32(*(*int8)(unsafe.Pointer(zArg))) <= '9')) ||
 15784  					(sqlite3.Xsqlite3_strlike(tls, ts+4027 /* "enable%" */, zArg, uint32(0)) == 0)) ||
 15785  					(sqlite3.Xsqlite3_stricmp(tls, ts+4035 /* "yes" */, zArg) == 0)) ||
 15786  					(sqlite3.Xsqlite3_stricmp(tls, ts+4039 /* "on" */, zArg) == 0) {
 15787  					(*CksmFile)(unsafe.Pointer(p)).FverifyCksm = (*CksmFile)(unsafe.Pointer(p)).FcomputeCksm
 15788  				} else {
 15789  					(*CksmFile)(unsafe.Pointer(p)).FverifyCksm = int8(0)
 15790  				}
 15791  				if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 15792  					(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FverifyCksm = (*CksmFile)(unsafe.Pointer(p)).FverifyCksm
 15793  				}
 15794  			}
 15795  			*(*uintptr)(unsafe.Pointer(azArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+1238 /* "%d" */, libc.VaList(bp, int32((*CksmFile)(unsafe.Pointer(p)).FverifyCksm)))
 15796  			return SQLITE_OK
 15797  		} else if (((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0) && (*(*uintptr)(unsafe.Pointer(azArg + 2*8)) != uintptr(0))) &&
 15798  			(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + 1*8)), ts+4042 /* "page_size" */) == 0) {
 15799  			// Do not allow page size changes on a checksum database
 15800  			return SQLITE_OK
 15801  		}
 15802  	} else if (op == SQLITE_FCNTL_CKPT_START) || (op == SQLITE_FCNTL_CKPT_DONE) {
 15803  		(*CksmFile)(unsafe.Pointer(p)).FinCkpt = (int8(libc.Bool32(op == SQLITE_FCNTL_CKPT_START)))
 15804  		if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 15805  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FinCkpt = (*CksmFile)(unsafe.Pointer(p)).FinCkpt
 15806  		}
 15807  	} else if op == SQLITE_FCNTL_CKSM_FILE {
 15808  		// This VFS needs to obtain a pointer to the corresponding database
 15809  		// file handle from within xOpen() calls to open wal files. To do this,
 15810  		// it uses the sqlite3_database_file_object() API to obtain a pointer
 15811  		// to the file-handle used by SQLite to access the db file. This is
 15812  		// fine if cksmvfs happens to be the top-level VFS, but not if there
 15813  		// are one or more wrapper VFS. To handle this case, this file-control
 15814  		// is used to extract the cksmvfs file-handle from any wrapper file
 15815  		// handle.
 15816  		var ppFile uintptr = pArg
 15817  		*(*uintptr)(unsafe.Pointer(ppFile)) = p
 15818  		return SQLITE_OK
 15819  	}
 15820  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 80 /* &.xFileControl */))))(tls, pFile, op, pArg)
 15821  	if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) {
 15822  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+4052 /* "cksm/%z" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pArg))))
 15823  	}
 15824  	return rc
 15825  }
 15826  
 15827  // Return the sector-size in bytes for a cksm-file.
 15828  func cksmSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:605:12: */
 15829  	pFile = ((pFile) + uintptr(1)*32)
 15830  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 88 /* &.xSectorSize */))))(tls, pFile)
 15831  }
 15832  
 15833  // Return the device characteristic flags supported by a cksm-file.
 15834  func cksmDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:613:12: */
 15835  	pFile = ((pFile) + uintptr(1)*32)
 15836  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, pFile)
 15837  }
 15838  
 15839  // Create a shared memory file mapping
 15840  func cksmShmMap(tls *libc.TLS, pFile uintptr, iPg int32, pgsz int32, bExtend int32, pp uintptr) int32 { /* cksumvfs.c:619:12: */
 15841  	pFile = ((pFile) + uintptr(1)*32)
 15842  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 104 /* &.xShmMap */))))(tls, pFile, iPg, pgsz, bExtend, libc.AtomicLoadUintptr(&pp))
 15843  }
 15844  
 15845  // Perform locking on a shared-memory segment
 15846  func cksmShmLock(tls *libc.TLS, pFile uintptr, offset int32, n int32, flags int32) int32 { /* cksumvfs.c:631:12: */
 15847  	pFile = ((pFile) + uintptr(1)*32)
 15848  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 112 /* &.xShmLock */))))(tls, pFile, offset, n, flags)
 15849  }
 15850  
 15851  // Memory barrier operation on shared memory
 15852  func cksmShmBarrier(tls *libc.TLS, pFile uintptr) { /* cksumvfs.c:637:13: */
 15853  	pFile = ((pFile) + uintptr(1)*32)
 15854  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pFile)
 15855  }
 15856  
 15857  // Unmap a shared memory segment
 15858  func cksmShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* cksumvfs.c:643:12: */
 15859  	pFile = ((pFile) + uintptr(1)*32)
 15860  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pFile, deleteFlag)
 15861  }
 15862  
 15863  // Fetch a page of a memory-mapped file
 15864  func cksmFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* cksumvfs.c:649:12: */
 15865  	var p uintptr = pFile
 15866  	if (*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0 {
 15867  		*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 15868  		return SQLITE_OK
 15869  	}
 15870  	pFile = ((pFile) + uintptr(1)*32)
 15871  	if ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)).FiVersion > 2) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)).FxFetch != 0) {
 15872  		return (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 136 /* &.xFetch */))))(tls, pFile, iOfst, iAmt, pp)
 15873  	}
 15874  	*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 15875  	return SQLITE_OK
 15876  }
 15877  
 15878  // Release a memory-mapped page
 15879  func cksmUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, pPage uintptr) int32 { /* cksumvfs.c:669:12: */
 15880  	pFile = ((pFile) + uintptr(1)*32)
 15881  	if ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)).FiVersion > 2) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)).FxUnfetch != 0) {
 15882  		return (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 144 /* &.xUnfetch */))))(tls, pFile, iOfst, pPage)
 15883  	}
 15884  	return SQLITE_OK
 15885  }
 15886  
 15887  // Open a cksm file handle.
 15888  func cksmOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* cksumvfs.c:680:12: */
 15889  	bp := tls.Alloc(8)
 15890  	defer tls.Free(8)
 15891  
 15892  	var p uintptr
 15893  	var pSubFile uintptr
 15894  	var pSubVfs uintptr
 15895  	var rc int32
 15896  	// var pDb uintptr at bp, 8
 15897  
 15898  	pSubVfs = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 15899  	if !((flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_WAL)) == 0) {
 15900  		goto __1
 15901  	}
 15902  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSubVfs + 40 /* &.xOpen */))))(tls, pSubVfs, zName, pFile, flags, pOutFlags)
 15903  __1:
 15904  	;
 15905  	p = pFile
 15906  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(CksmFile{})))
 15907  	pSubFile = ((pFile) + uintptr(1)*32)
 15908  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&cksm_io_methods))
 15909  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSubVfs + 40 /* &.xOpen */))))(tls, pSubVfs, zName, pSubFile, flags, pOutFlags)
 15910  	if !(rc != 0) {
 15911  		goto __2
 15912  	}
 15913  	goto cksm_open_done
 15914  __2:
 15915  	;
 15916  	if !((flags & SQLITE_OPEN_WAL) != 0) {
 15917  		goto __3
 15918  	}
 15919  	*(*uintptr)(unsafe.Pointer(bp /* pDb */)) = sqlite3.Xsqlite3_database_file_object(tls, zName)
 15920  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pDb */)))).FpMethods + 80 /* &.xFileControl */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pDb */)), SQLITE_FCNTL_CKSM_FILE, bp /* &pDb */)
 15921  
 15922  	(*CksmFile)(unsafe.Pointer(p)).FpPartner = *(*uintptr)(unsafe.Pointer(bp /* pDb */))
 15923  
 15924  	(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FpPartner = p
 15925  	(*CksmFile)(unsafe.Pointer(p)).FisWal = int8(1)
 15926  	(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = (*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FcomputeCksm
 15927  	goto __4
 15928  __3:
 15929  	(*CksmFile)(unsafe.Pointer(p)).FisWal = int8(0)
 15930  	(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = int8(0)
 15931  __4:
 15932  	;
 15933  	(*CksmFile)(unsafe.Pointer(p)).FzFName = zName
 15934  cksm_open_done:
 15935  	if !(rc != 0) {
 15936  		goto __5
 15937  	}
 15938  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 15939  __5:
 15940  	;
 15941  	return rc
 15942  }
 15943  
 15944  // All other VFS methods are pass-thrus.
 15945  func cksmDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* cksumvfs.c:723:12: */
 15946  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 48 /* &.xDelete */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, dirSync)
 15947  }
 15948  
 15949  func cksmAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* cksumvfs.c:726:12: */
 15950  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 56 /* &.xAccess */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, flags, pResOut)
 15951  }
 15952  
 15953  func cksmFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* cksumvfs.c:734:12: */
 15954  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 64 /* &.xFullPathname */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, nOut, zOut)
 15955  }
 15956  
 15957  func cksmDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* cksumvfs.c:742:13: */
 15958  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 72 /* &.xDlOpen */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath)
 15959  }
 15960  
 15961  func cksmDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* cksumvfs.c:745:13: */
 15962  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 80 /* &.xDlError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg)
 15963  }
 15964  
 15965  func cksmDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* cksumvfs.c:748:13: */
 15966  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 88 /* &.xDlSym */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym)
 15967  }
 15968  
 15969  func cksmDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* cksumvfs.c:751:13: */
 15970  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 96 /* &.xDlClose */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle)
 15971  }
 15972  
 15973  func cksmRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* cksumvfs.c:754:12: */
 15974  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 104 /* &.xRandomness */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut)
 15975  }
 15976  
 15977  func cksmSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* cksumvfs.c:757:12: */
 15978  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 112 /* &.xSleep */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro)
 15979  }
 15980  
 15981  func cksmCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* cksumvfs.c:760:12: */
 15982  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 120 /* &.xCurrentTime */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pTimeOut)
 15983  }
 15984  
 15985  func cksmGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* cksumvfs.c:763:12: */
 15986  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 128 /* &.xGetLastError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b)
 15987  }
 15988  
 15989  func cksmCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* cksumvfs.c:766:12: */
 15990  	bp := tls.Alloc(8)
 15991  	defer tls.Free(8)
 15992  
 15993  	var pOrig uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 15994  	var rc int32
 15995  
 15996  	if (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FxCurrentTimeInt64 != 0 {
 15997  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pOrig + 136 /* &.xCurrentTimeInt64 */))))(tls, pOrig, p)
 15998  	} else {
 15999  		// var r float64 at bp, 8
 16000  
 16001  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pOrig + 120 /* &.xCurrentTime */))))(tls, pOrig, bp /* &r */)
 16002  		*(*sqlite3_int64)(unsafe.Pointer(p)) = (sqlite3_int64(*(*float64)(unsafe.Pointer(bp /* r */)) * 86400000.0))
 16003  	}
 16004  	return rc
 16005  }
 16006  
 16007  func cksmSetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr, pCall sqlite3_syscall_ptr) int32 { /* cksumvfs.c:779:12: */
 16008  	return (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 144 /* &.xSetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName, pCall)
 16009  }
 16010  
 16011  func cksmGetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) sqlite3_syscall_ptr { /* cksumvfs.c:786:28: */
 16012  	return (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 152 /* &.xGetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 16013  }
 16014  
 16015  func cksmNextSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) uintptr { /* cksumvfs.c:792:19: */
 16016  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 160 /* &.xNextSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 16017  }
 16018  
 16019  // Register the verify_checksum() SQL function.
 16020  func cksmRegisterFunc(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* cksumvfs.c:798:12: */
 16021  	var rc int32
 16022  	if db == uintptr(0) {
 16023  		return SQLITE_OK
 16024  	}
 16025  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4060 /* "verify_checksum" */, 1,
 16026  		((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC),
 16027  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 16028  			f func(*libc.TLS, uintptr, int32, uintptr)
 16029  		}{cksmVerifyFunc})), uintptr(0), uintptr(0))
 16030  	return rc
 16031  }
 16032  
 16033  // Register the cksum VFS as the default VFS for the system.
 16034  // Also make arrangements to automatically register the "verify_checksum()"
 16035  // SQL function on each new database connection.
 16036  func cksmRegisterVfs(tls *libc.TLS) int32 { /* cksumvfs.c:821:12: */
 16037  	var rc int32 = SQLITE_OK
 16038  	var pOrig uintptr
 16039  	if sqlite3.Xsqlite3_vfs_find(tls, ts+3958 /* "cksmvfs" */) != uintptr(0) {
 16040  		return SQLITE_OK
 16041  	}
 16042  	pOrig = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 16043  	if pOrig == uintptr(0) {
 16044  		return SQLITE_ERROR
 16045  	}
 16046  	cksm_vfs.FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FiVersion
 16047  	cksm_vfs.FpAppData = pOrig
 16048  	cksm_vfs.FszOsFile = (int32(uint64((*sqlite3_vfs)(unsafe.Pointer(pOrig)).FszOsFile) + uint64(unsafe.Sizeof(CksmFile{}))))
 16049  	rc = sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&cksm_vfs)), 1)
 16050  	if rc == SQLITE_OK {
 16051  		rc = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 16052  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 16053  		}{cksmRegisterFunc})))
 16054  	}
 16055  	return rc
 16056  }
 16057  
 16058  // This variant of the initializer runs when the extension is
 16059  // statically linked.
 16060  func sqlite3_register_cksumvfs(tls *libc.TLS, NotUsed uintptr) int32 { /* cksumvfs.c:841:5: */
 16061  	_ = NotUsed
 16062  	return cksmRegisterVfs(tls)
 16063  }
 16064  
 16065  func sqlite3_unregister_cksumvfs(tls *libc.TLS) int32 { /* cksumvfs.c:845:5: */
 16066  	if sqlite3.Xsqlite3_vfs_find(tls, ts+3958 /* "cksmvfs" */) != 0 {
 16067  		sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&cksm_vfs)))
 16068  		sqlite3.Xsqlite3_cancel_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 16069  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 16070  		}{cksmRegisterFunc})))
 16071  	}
 16072  	return SQLITE_OK
 16073  }
 16074  
 16075  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
 16076  // tolower() and toupper() respectively, minus extra checking to ensure that
 16077  // the argument is a lower or uppercase letter respectively.  We've chosen to
 16078  // implement these macros with the same error checking as tolower() and
 16079  // toupper() since this doesn't violate the specification itself, only its
 16080  // intent.  We purposely leave _tolower() and _toupper() undocumented to
 16081  // discourage their use.
 16082  //
 16083  // XXX isascii() and toascii() should similarly be undocumented.
 16084  
 16085  // Forward declaration of objects used by this implementation
 16086  type closure_vtab1 = struct {
 16087  	Fbase          sqlite3_vtab
 16088  	FzDb           uintptr
 16089  	FzSelf         uintptr
 16090  	FzTableName    uintptr
 16091  	FzIdColumn     uintptr
 16092  	FzParentColumn uintptr
 16093  	Fdb            uintptr
 16094  	FnCursor       int32
 16095  	_              [4]byte
 16096  } /* closure.c:156:9 */
 16097  
 16098  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
 16099  // tolower() and toupper() respectively, minus extra checking to ensure that
 16100  // the argument is a lower or uppercase letter respectively.  We've chosen to
 16101  // implement these macros with the same error checking as tolower() and
 16102  // toupper() since this doesn't violate the specification itself, only its
 16103  // intent.  We purposely leave _tolower() and _toupper() undocumented to
 16104  // discourage their use.
 16105  //
 16106  // XXX isascii() and toascii() should similarly be undocumented.
 16107  
 16108  // Forward declaration of objects used by this implementation
 16109  type closure_vtab = closure_vtab1 /* closure.c:156:29 */
 16110  type closure_cursor1 = struct {
 16111  	Fbase          sqlite3_vtab_cursor
 16112  	FpVtab         uintptr
 16113  	FzTableName    uintptr
 16114  	FzIdColumn     uintptr
 16115  	FzParentColumn uintptr
 16116  	FpCurrent      uintptr
 16117  	FpClosure      uintptr
 16118  } /* closure.c:157:9 */
 16119  
 16120  type closure_cursor = closure_cursor1 /* closure.c:157:31 */
 16121  type closure_queue1 = struct {
 16122  	FpFirst uintptr
 16123  	FpLast  uintptr
 16124  } /* closure.c:158:9 */
 16125  
 16126  type closure_queue = closure_queue1 /* closure.c:158:30 */
 16127  type closure_avl1 = struct {
 16128  	Fid          sqlite3_int64
 16129  	FiGeneration int32
 16130  	_            [4]byte
 16131  	FpList       uintptr
 16132  	FpBefore     uintptr
 16133  	FpAfter      uintptr
 16134  	FpUp         uintptr
 16135  	Fheight      int16
 16136  	Fimbalance   int16
 16137  	_            [4]byte
 16138  } /* closure.c:157:9 */
 16139  
 16140  type closure_avl = closure_avl1 /* closure.c:159:28 */
 16141  
 16142  // Recompute the closure_avl.height and closure_avl.imbalance fields for p.
 16143  // Assume that the children of p have correct heights.
 16144  func closureAvlRecomputeHeight(tls *libc.TLS, p uintptr) { /* closure.c:182:13: */
 16145  	var hBefore int16
 16146  	if (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 16147  		hBefore = (*closure_avl)(unsafe.Pointer((*closure_avl)(unsafe.Pointer(p)).FpBefore)).Fheight
 16148  	} else {
 16149  		hBefore = int16(0)
 16150  	}
 16151  	var hAfter int16
 16152  	if (*closure_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 16153  		hAfter = (*closure_avl)(unsafe.Pointer((*closure_avl)(unsafe.Pointer(p)).FpAfter)).Fheight
 16154  	} else {
 16155  		hAfter = int16(0)
 16156  	}
 16157  	(*closure_avl)(unsafe.Pointer(p)).Fimbalance = (int16(int32(hBefore) - int32(hAfter))) // -: pAfter higher.  +: pBefore higher
 16158  	(*closure_avl)(unsafe.Pointer(p)).Fheight = (int16((func() int32 {
 16159  		if int32(hBefore) > int32(hAfter) {
 16160  			return int32(hBefore)
 16161  		}
 16162  		return int32(hAfter)
 16163  	}()) + 1))
 16164  }
 16165  
 16166  //     P                B
 16167  //    / \              / **   B   Z    ==>     X   P
 16168  //  / \                  / ** X   Y                Y   Z
 16169  //
 16170  func closureAvlRotateBefore(tls *libc.TLS, pP uintptr) uintptr { /* closure.c:197:20: */
 16171  	var pB uintptr = (*closure_avl)(unsafe.Pointer(pP)).FpBefore
 16172  	var pY uintptr = (*closure_avl)(unsafe.Pointer(pB)).FpAfter
 16173  	(*closure_avl)(unsafe.Pointer(pB)).FpUp = (*closure_avl)(unsafe.Pointer(pP)).FpUp
 16174  	(*closure_avl)(unsafe.Pointer(pB)).FpAfter = pP
 16175  	(*closure_avl)(unsafe.Pointer(pP)).FpUp = pB
 16176  	(*closure_avl)(unsafe.Pointer(pP)).FpBefore = pY
 16177  	if pY != 0 {
 16178  		(*closure_avl)(unsafe.Pointer(pY)).FpUp = pP
 16179  	}
 16180  	closureAvlRecomputeHeight(tls, pP)
 16181  	closureAvlRecomputeHeight(tls, pB)
 16182  	return pB
 16183  }
 16184  
 16185  //     P                A
 16186  //    / \              / **   X   A    ==>     P   Z
 16187  //      / \          / **     Y   Z        X   Y
 16188  //
 16189  func closureAvlRotateAfter(tls *libc.TLS, pP uintptr) uintptr { /* closure.c:218:20: */
 16190  	var pA uintptr = (*closure_avl)(unsafe.Pointer(pP)).FpAfter
 16191  	var pY uintptr = (*closure_avl)(unsafe.Pointer(pA)).FpBefore
 16192  	(*closure_avl)(unsafe.Pointer(pA)).FpUp = (*closure_avl)(unsafe.Pointer(pP)).FpUp
 16193  	(*closure_avl)(unsafe.Pointer(pA)).FpBefore = pP
 16194  	(*closure_avl)(unsafe.Pointer(pP)).FpUp = pA
 16195  	(*closure_avl)(unsafe.Pointer(pP)).FpAfter = pY
 16196  	if pY != 0 {
 16197  		(*closure_avl)(unsafe.Pointer(pY)).FpUp = pP
 16198  	}
 16199  	closureAvlRecomputeHeight(tls, pP)
 16200  	closureAvlRecomputeHeight(tls, pA)
 16201  	return pA
 16202  }
 16203  
 16204  // Return a pointer to the pBefore or pAfter pointer in the parent
 16205  // of p that points to p.  Or if p is the root node, return pp.
 16206  func closureAvlFromPtr(tls *libc.TLS, p uintptr, pp uintptr) uintptr { /* closure.c:235:20: */
 16207  	var pUp uintptr = (*closure_avl)(unsafe.Pointer(p)).FpUp
 16208  	if pUp == uintptr(0) {
 16209  		return pp
 16210  	}
 16211  	if (*closure_avl)(unsafe.Pointer(pUp)).FpAfter == p {
 16212  		return (pUp + 32 /* &.pAfter */)
 16213  	}
 16214  	return (pUp + 24 /* &.pBefore */)
 16215  }
 16216  
 16217  // Rebalance all nodes starting with p and working up to the root.
 16218  // Return the new root.
 16219  func closureAvlBalance(tls *libc.TLS, p uintptr) uintptr { /* closure.c:246:20: */
 16220  	bp := tls.Alloc(8)
 16221  	defer tls.Free(8)
 16222  	*(*uintptr)(unsafe.Pointer(bp)) = p
 16223  
 16224  	var pTop uintptr = *(*uintptr)(unsafe.Pointer(bp /* p */))
 16225  	var pp uintptr
 16226  	for *(*uintptr)(unsafe.Pointer(bp /* p */)) != 0 {
 16227  		closureAvlRecomputeHeight(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)))
 16228  		if int32((*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) >= 2 {
 16229  			var pB uintptr = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore
 16230  			if int32((*closure_avl)(unsafe.Pointer(pB)).Fimbalance) < 0 {
 16231  				(*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore = closureAvlRotateAfter(tls, pB)
 16232  			}
 16233  			pp = closureAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 16234  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, closureAvlRotateBefore(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 16235  		} else if int32((*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) <= (-2) {
 16236  			var pA uintptr = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter
 16237  			if int32((*closure_avl)(unsafe.Pointer(pA)).Fimbalance) > 0 {
 16238  				(*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter = closureAvlRotateBefore(tls, pA)
 16239  			}
 16240  			pp = closureAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 16241  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, closureAvlRotateAfter(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 16242  		}
 16243  		pTop = *(*uintptr)(unsafe.Pointer(bp /* p */))
 16244  		*(*uintptr)(unsafe.Pointer(bp /* p */)) = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpUp
 16245  	}
 16246  	return pTop
 16247  }
 16248  
 16249  // Search the tree rooted at p for an entry with id.  Return a pointer
 16250  // to the entry or return NULL.
 16251  func closureAvlSearch(tls *libc.TLS, p uintptr, id sqlite3_int64) uintptr { /* closure.c:271:20: */
 16252  	for (p != 0) && (id != (*closure_avl)(unsafe.Pointer(p)).Fid) {
 16253  		if id < (*closure_avl)(unsafe.Pointer(p)).Fid {
 16254  			p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 16255  		} else {
 16256  			p = (*closure_avl)(unsafe.Pointer(p)).FpAfter
 16257  		}
 16258  	}
 16259  	return p
 16260  }
 16261  
 16262  // Find the first node (the one with the smallest key).
 16263  func closureAvlFirst(tls *libc.TLS, p uintptr) uintptr { /* closure.c:280:20: */
 16264  	if p != 0 {
 16265  		for (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 16266  			p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 16267  		}
 16268  	}
 16269  	return p
 16270  }
 16271  
 16272  // Return the node with the next larger key after p.
 16273  func closureAvlNext(tls *libc.TLS, p uintptr) uintptr { /* closure.c:287:13: */
 16274  	var pPrev uintptr = uintptr(0)
 16275  	for (p != 0) && ((*closure_avl)(unsafe.Pointer(p)).FpAfter == pPrev) {
 16276  		pPrev = p
 16277  		p = (*closure_avl)(unsafe.Pointer(p)).FpUp
 16278  	}
 16279  	if (p != 0) && (pPrev == uintptr(0)) {
 16280  		p = closureAvlFirst(tls, (*closure_avl)(unsafe.Pointer(p)).FpAfter)
 16281  	}
 16282  	return p
 16283  }
 16284  
 16285  // Insert a new node pNew.  Return NULL on success.  If the key is not
 16286  // unique, then do not perform the insert but instead leave pNew unchanged
 16287  // and return a pointer to an existing node with the same key.
 16288  func closureAvlInsert(tls *libc.TLS, ppHead uintptr, pNew uintptr) uintptr { /* closure.c:303:20: */
 16289  	var p uintptr = *(*uintptr)(unsafe.Pointer(ppHead))
 16290  	if p == uintptr(0) {
 16291  		p = pNew
 16292  		(*closure_avl)(unsafe.Pointer(pNew)).FpUp = uintptr(0)
 16293  	} else {
 16294  		for p != 0 {
 16295  			if (*closure_avl)(unsafe.Pointer(pNew)).Fid < (*closure_avl)(unsafe.Pointer(p)).Fid {
 16296  				if (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 16297  					p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 16298  				} else {
 16299  					(*closure_avl)(unsafe.Pointer(p)).FpBefore = pNew
 16300  					(*closure_avl)(unsafe.Pointer(pNew)).FpUp = p
 16301  					break
 16302  				}
 16303  			} else if (*closure_avl)(unsafe.Pointer(pNew)).Fid > (*closure_avl)(unsafe.Pointer(p)).Fid {
 16304  				if (*closure_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 16305  					p = (*closure_avl)(unsafe.Pointer(p)).FpAfter
 16306  				} else {
 16307  					(*closure_avl)(unsafe.Pointer(p)).FpAfter = pNew
 16308  					(*closure_avl)(unsafe.Pointer(pNew)).FpUp = p
 16309  					break
 16310  				}
 16311  			} else {
 16312  				return p
 16313  			}
 16314  		}
 16315  	}
 16316  	(*closure_avl)(unsafe.Pointer(pNew)).FpBefore = uintptr(0)
 16317  	(*closure_avl)(unsafe.Pointer(pNew)).FpAfter = uintptr(0)
 16318  	(*closure_avl)(unsafe.Pointer(pNew)).Fheight = int16(1)
 16319  	(*closure_avl)(unsafe.Pointer(pNew)).Fimbalance = int16(0)
 16320  	*(*uintptr)(unsafe.Pointer(ppHead)) = closureAvlBalance(tls, p)
 16321  	return uintptr(0)
 16322  }
 16323  
 16324  // Walk the tree can call xDestroy on each node
 16325  func closureAvlDestroy(tls *libc.TLS, p uintptr, xDestroy uintptr) { /* closure.c:344:13: */
 16326  	if p != 0 {
 16327  		closureAvlDestroy(tls, (*closure_avl)(unsafe.Pointer(p)).FpBefore, xDestroy)
 16328  		closureAvlDestroy(tls, (*closure_avl)(unsafe.Pointer(p)).FpAfter, xDestroy)
 16329  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, p)
 16330  	}
 16331  }
 16332  
 16333  // Add a node to the end of the queue
 16334  func queuePush(tls *libc.TLS, pQueue uintptr, pNode uintptr) { /* closure.c:389:13: */
 16335  	(*closure_avl)(unsafe.Pointer(pNode)).FpList = uintptr(0)
 16336  	if (*closure_queue)(unsafe.Pointer(pQueue)).FpLast != 0 {
 16337  		(*closure_avl)(unsafe.Pointer((*closure_queue)(unsafe.Pointer(pQueue)).FpLast)).FpList = pNode
 16338  	} else {
 16339  		(*closure_queue)(unsafe.Pointer(pQueue)).FpFirst = pNode
 16340  	}
 16341  	(*closure_queue)(unsafe.Pointer(pQueue)).FpLast = pNode
 16342  }
 16343  
 16344  // Extract the oldest element (the front element) from the queue.
 16345  func queuePull(tls *libc.TLS, pQueue uintptr) uintptr { /* closure.c:402:20: */
 16346  	var p uintptr = (*closure_queue)(unsafe.Pointer(pQueue)).FpFirst
 16347  	if p != 0 {
 16348  		(*closure_queue)(unsafe.Pointer(pQueue)).FpFirst = (*closure_avl)(unsafe.Pointer(p)).FpList
 16349  		if (*closure_queue)(unsafe.Pointer(pQueue)).FpFirst == uintptr(0) {
 16350  			(*closure_queue)(unsafe.Pointer(pQueue)).FpLast = uintptr(0)
 16351  		}
 16352  	}
 16353  	return p
 16354  }
 16355  
 16356  // This function converts an SQL quoted string into an unquoted string
 16357  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 16358  // containing the result. The caller should eventually free this buffer
 16359  // using sqlite3_free.
 16360  //
 16361  // Examples:
 16362  //
 16363  //     "abc"   becomes   abc
 16364  //     'xyz'   becomes   xyz
 16365  //     [pqr]   becomes   pqr
 16366  //     `mno`   becomes   mno
 16367  func closureDequote(tls *libc.TLS, zIn uintptr) uintptr { /* closure.c:424:13: */
 16368  	var nIn sqlite3_int64 // Size of input string, in bytes
 16369  	var zOut uintptr      // Output (dequoted) string
 16370  
 16371  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 16372  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 16373  	if zOut != 0 {
 16374  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 16375  
 16376  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 16377  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 16378  		} else {
 16379  			var iOut int32 = 0 // Index of next byte to write to output
 16380  			var iIn int32      // Index of next byte to read from input
 16381  
 16382  			if int32(q) == '[' {
 16383  				q = int8(']')
 16384  			}
 16385  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 16386  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 16387  					iIn++
 16388  				}
 16389  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 16390  			}
 16391  		}
 16392  
 16393  	}
 16394  	return zOut
 16395  }
 16396  
 16397  // Deallocate an closure_vtab object
 16398  func closureFree(tls *libc.TLS, p uintptr) { /* closure.c:453:13: */
 16399  	if p != 0 {
 16400  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzDb)
 16401  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzSelf)
 16402  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzTableName)
 16403  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzIdColumn)
 16404  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzParentColumn)
 16405  		libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(closure_vtab{})))
 16406  		sqlite3.Xsqlite3_free(tls, p)
 16407  	}
 16408  }
 16409  
 16410  // xDisconnect/xDestroy method for the closure module.
 16411  func closureDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* closure.c:468:12: */
 16412  	var p uintptr = pVtab
 16413  
 16414  	closureFree(tls, p)
 16415  	return SQLITE_OK
 16416  }
 16417  
 16418  // Check to see if the argument is of the form:
 16419  //
 16420  //       KEY = VALUE
 16421  //
 16422  // If it is, return a pointer to the first character of VALUE.
 16423  // If not, return NULL.  Spaces around the = are ignored.
 16424  func closureValueOfKey(tls *libc.TLS, zKey uintptr, zStr uintptr) uintptr { /* closure.c:483:19: */
 16425  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
 16426  	var nStr int32 = int32(libc.Xstrlen(tls, zStr))
 16427  	var i int32
 16428  	if nStr < (nKey + 1) {
 16429  		return uintptr(0)
 16430  	}
 16431  	if libc.Xmemcmp(tls, zStr, zKey, uint64(nKey)) != 0 {
 16432  		return uintptr(0)
 16433  	}
 16434  	for i = nKey; __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0; i++ {
 16435  	}
 16436  	if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) != '=' {
 16437  		return uintptr(0)
 16438  	}
 16439  	i++
 16440  	for __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))), uint64(X_CTYPE_S)) != 0 {
 16441  		i++
 16442  	}
 16443  	return (zStr + uintptr(i))
 16444  }
 16445  
 16446  // xConnect/xCreate method for the closure module. Arguments are:
 16447  //
 16448  //   argv[0]    -> module name  ("transitive_closure")
 16449  //   argv[1]    -> database name
 16450  //   argv[2]    -> table name
 16451  //   argv[3...] -> arguments
 16452  func closureConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* closure.c:504:12: */
 16453  	bp := tls.Alloc(24)
 16454  	defer tls.Free(24)
 16455  
 16456  	var rc int32     // Return code
 16457  	var pNew uintptr // New virtual table
 16458  	var zDb uintptr
 16459  	var zVal uintptr
 16460  	var i int32
 16461  	rc = SQLITE_OK
 16462  	pNew = uintptr(0)
 16463  	zDb = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 16464  
 16465  	_ = pAux
 16466  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 16467  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_vtab{})))
 16468  	if !(pNew == uintptr(0)) {
 16469  		goto __1
 16470  	}
 16471  	return SQLITE_NOMEM
 16472  __1:
 16473  	;
 16474  	rc = SQLITE_NOMEM
 16475  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(closure_vtab{})))
 16476  	(*closure_vtab)(unsafe.Pointer(pNew)).Fdb = db
 16477  	(*closure_vtab)(unsafe.Pointer(pNew)).FzDb = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zDb))
 16478  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzDb == uintptr(0)) {
 16479  		goto __2
 16480  	}
 16481  	goto closureConnectError
 16482  __2:
 16483  	;
 16484  	(*closure_vtab)(unsafe.Pointer(pNew)).FzSelf = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 16485  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzSelf == uintptr(0)) {
 16486  		goto __3
 16487  	}
 16488  	goto closureConnectError
 16489  __3:
 16490  	;
 16491  	i = 3
 16492  __4:
 16493  	if !(i < argc) {
 16494  		goto __6
 16495  	}
 16496  	zVal = closureValueOfKey(tls, ts+4076 /* "tablename" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 16497  	if !(zVal != 0) {
 16498  		goto __7
 16499  	}
 16500  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzTableName)
 16501  	(*closure_vtab)(unsafe.Pointer(pNew)).FzTableName = closureDequote(tls, zVal)
 16502  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzTableName == uintptr(0)) {
 16503  		goto __8
 16504  	}
 16505  	goto closureConnectError
 16506  __8:
 16507  	;
 16508  	goto __5
 16509  __7:
 16510  	;
 16511  	zVal = closureValueOfKey(tls, ts+4086 /* "idcolumn" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 16512  	if !(zVal != 0) {
 16513  		goto __9
 16514  	}
 16515  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn)
 16516  	(*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn = closureDequote(tls, zVal)
 16517  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn == uintptr(0)) {
 16518  		goto __10
 16519  	}
 16520  	goto closureConnectError
 16521  __10:
 16522  	;
 16523  	goto __5
 16524  __9:
 16525  	;
 16526  	zVal = closureValueOfKey(tls, ts+4095 /* "parentcolumn" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 16527  	if !(zVal != 0) {
 16528  		goto __11
 16529  	}
 16530  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn)
 16531  	(*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn = closureDequote(tls, zVal)
 16532  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn == uintptr(0)) {
 16533  		goto __12
 16534  	}
 16535  	goto closureConnectError
 16536  __12:
 16537  	;
 16538  	goto __5
 16539  __11:
 16540  	;
 16541  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3397 /* "unrecognized arg..." */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 16542  	closureFree(tls, pNew)
 16543  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 16544  	return SQLITE_ERROR
 16545  	goto __5
 16546  __5:
 16547  	i++
 16548  	goto __4
 16549  	goto __6
 16550  __6:
 16551  	;
 16552  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 16553  
 16554  		ts+4108 /* "CREATE TABLE x(i..." */)
 16555  	if !(rc != SQLITE_OK) {
 16556  		goto __13
 16557  	}
 16558  	closureFree(tls, pNew)
 16559  __13:
 16560  	;
 16561  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pNew /* &.base */)
 16562  	return rc
 16563  
 16564  closureConnectError:
 16565  	closureFree(tls, pNew)
 16566  	return rc
 16567  }
 16568  
 16569  // Open a new closure cursor.
 16570  func closureOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* closure.c:579:12: */
 16571  	var p uintptr = pVTab
 16572  	var pCur uintptr
 16573  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_cursor{})))
 16574  	if pCur == uintptr(0) {
 16575  		return SQLITE_NOMEM
 16576  	}
 16577  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(closure_cursor{})))
 16578  	(*closure_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 16579  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 16580  	(*closure_vtab)(unsafe.Pointer(p)).FnCursor++
 16581  	return SQLITE_OK
 16582  }
 16583  
 16584  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 16585  // to indicate that it is at EOF.
 16586  func closureClearCursor(tls *libc.TLS, pCur uintptr) { /* closure.c:595:13: */
 16587  	closureAvlDestroy(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 16588  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName)
 16589  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn)
 16590  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn)
 16591  	(*closure_cursor)(unsafe.Pointer(pCur)).FzTableName = uintptr(0)
 16592  	(*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn = uintptr(0)
 16593  	(*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn = uintptr(0)
 16594  	(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = uintptr(0)
 16595  	(*closure_cursor)(unsafe.Pointer(pCur)).FpClosure = uintptr(0)
 16596  }
 16597  
 16598  // Close a closure cursor.
 16599  func closureClose(tls *libc.TLS, cur uintptr) int32 { /* closure.c:610:12: */
 16600  	var pCur uintptr = cur
 16601  	closureClearCursor(tls, pCur)
 16602  	(*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 16603  	sqlite3.Xsqlite3_free(tls, pCur)
 16604  	return SQLITE_OK
 16605  }
 16606  
 16607  // Advance a cursor to its next row of output
 16608  func closureNext(tls *libc.TLS, cur uintptr) int32 { /* closure.c:621:12: */
 16609  	var pCur uintptr = cur
 16610  	(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = closureAvlNext(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)
 16611  	return SQLITE_OK
 16612  }
 16613  
 16614  // Allocate and insert a node
 16615  func closureInsertNode(tls *libc.TLS, pQueue uintptr, pCur uintptr, id sqlite3_int64, iGeneration int32) int32 { /* closure.c:630:12: */
 16616  	var pNew uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_avl{})))
 16617  	if pNew == uintptr(0) {
 16618  		return SQLITE_NOMEM
 16619  	}
 16620  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(closure_avl{})))
 16621  	(*closure_avl)(unsafe.Pointer(pNew)).Fid = id
 16622  	(*closure_avl)(unsafe.Pointer(pNew)).FiGeneration = iGeneration
 16623  	closureAvlInsert(tls, (pCur + 48 /* &.pClosure */), pNew)
 16624  	queuePush(tls, pQueue, pNew)
 16625  	return SQLITE_OK
 16626  }
 16627  
 16628  // Called to "rewind" a cursor back to the beginning so that
 16629  // it starts its output over again.  Always called at least once
 16630  // prior to any closureColumn, closureRowid, or closureEof call.
 16631  //
 16632  // This routine actually computes the closure.
 16633  //
 16634  // See the comment at the beginning of closureBestIndex() for a
 16635  // description of the meaning of idxNum.  The idxStr parameter is
 16636  // not used.
 16637  func closureFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* closure.c:657:12: */
 16638  	bp := tls.Alloc(96)
 16639  	defer tls.Free(96)
 16640  
 16641  	var pCur uintptr = pVtabCursor
 16642  	var pVtab uintptr = (*closure_cursor)(unsafe.Pointer(pCur)).FpVtab
 16643  	var iRoot sqlite3_int64
 16644  	var mxGen int32 = 999999999
 16645  	var zSql uintptr
 16646  	// var pStmt uintptr at bp+88, 8
 16647  
 16648  	var pAvl uintptr
 16649  	var rc int32 = SQLITE_OK
 16650  	var zTableName uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzTableName
 16651  	var zIdColumn uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzIdColumn
 16652  	var zParentColumn uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzParentColumn
 16653  	// var sQueue closure_queue at bp+72, 16
 16654  
 16655  	_ = idxStr // Unused parameter
 16656  	_ = argc   // Unused parameter
 16657  	closureClearCursor(tls, pCur)
 16658  	libc.Xmemset(tls, bp+72 /* &sQueue */, 0, uint64(unsafe.Sizeof(closure_queue{})))
 16659  	if (idxNum & 1) == 0 {
 16660  		// No root=$root in the WHERE clause.  Return an empty set
 16661  		return SQLITE_OK
 16662  	}
 16663  	iRoot = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 16664  	if (idxNum & 0x000f0) != 0 {
 16665  		mxGen = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>4)&0x0f))*8)))
 16666  		if (idxNum & 0x00002) != 0 {
 16667  			mxGen--
 16668  		}
 16669  	}
 16670  	if (idxNum & 0x00f00) != 0 {
 16671  		zTableName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>8)&0x0f))*8)))
 16672  		(*closure_cursor)(unsafe.Pointer(pCur)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zTableName))
 16673  	}
 16674  	if (idxNum & 0x0f000) != 0 {
 16675  		zIdColumn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>12)&0x0f))*8)))
 16676  		(*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zIdColumn))
 16677  	}
 16678  	if (idxNum & 0x0f0000) != 0 {
 16679  		zParentColumn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>16)&0x0f))*8)))
 16680  		(*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zParentColumn))
 16681  	}
 16682  
 16683  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 16684  		ts+4198, /* "SELECT \"%w\".\"%w\"..." */
 16685  		libc.VaList(bp+24, zTableName, zIdColumn, zTableName, zTableName, zParentColumn))
 16686  	if zSql == uintptr(0) {
 16687  		return SQLITE_NOMEM
 16688  	} else {
 16689  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*closure_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, bp+88 /* &pStmt */, uintptr(0))
 16690  		sqlite3.Xsqlite3_free(tls, zSql)
 16691  		if rc != 0 {
 16692  			sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pVtab)).Fbase.FzErrMsg)
 16693  			(*closure_vtab)(unsafe.Pointer(pVtab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+64, sqlite3.Xsqlite3_errmsg(tls, (*closure_vtab)(unsafe.Pointer(pVtab)).Fdb)))
 16694  			return rc
 16695  		}
 16696  	}
 16697  	if rc == SQLITE_OK {
 16698  		rc = closureInsertNode(tls, bp+72 /* &sQueue */, pCur, iRoot, 0)
 16699  	}
 16700  	for (libc.AssignUintptr(&pAvl, queuePull(tls, bp+72 /* &sQueue */))) != uintptr(0) {
 16701  		if (*closure_avl)(unsafe.Pointer(pAvl)).FiGeneration >= mxGen {
 16702  			continue
 16703  		}
 16704  		sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)), 1, (*closure_avl)(unsafe.Pointer(pAvl)).Fid)
 16705  		for (rc == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */))) == SQLITE_ROW) {
 16706  			if sqlite3.Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)), 0) == SQLITE_INTEGER {
 16707  				var iNew sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)), 0)
 16708  				if closureAvlSearch(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure, iNew) == uintptr(0) {
 16709  					rc = closureInsertNode(tls, bp+72 /* &sQueue */, pCur, iNew, ((*closure_avl)(unsafe.Pointer(pAvl)).FiGeneration + 1))
 16710  				}
 16711  			}
 16712  		}
 16713  		sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)))
 16714  	}
 16715  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)))
 16716  	if rc == SQLITE_OK {
 16717  		(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = closureAvlFirst(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure)
 16718  	}
 16719  
 16720  	return rc
 16721  }
 16722  
 16723  // Only the word and distance columns have values.  All other columns
 16724  // return NULL
 16725  func closureColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* closure.c:743:12: */
 16726  	var pCur uintptr = cur
 16727  	switch i {
 16728  	case CLOSURE_COL_ID:
 16729  		{
 16730  			sqlite3.Xsqlite3_result_int64(tls, ctx, (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).Fid)
 16731  			break
 16732  
 16733  		}
 16734  	case CLOSURE_COL_DEPTH:
 16735  		{
 16736  			sqlite3.Xsqlite3_result_int(tls, ctx, (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).FiGeneration)
 16737  			break
 16738  
 16739  		}
 16740  	case CLOSURE_COL_ROOT:
 16741  		{
 16742  			sqlite3.Xsqlite3_result_null(tls, ctx)
 16743  			break
 16744  
 16745  		}
 16746  	case CLOSURE_COL_TABLENAME:
 16747  		{
 16748  			sqlite3.Xsqlite3_result_text(tls, ctx,
 16749  				func() uintptr {
 16750  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName != 0 {
 16751  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName
 16752  					}
 16753  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzTableName
 16754  				}(),
 16755  				-1, libc.UintptrFromInt32(-1))
 16756  			break
 16757  
 16758  		}
 16759  	case CLOSURE_COL_IDCOLUMN:
 16760  		{
 16761  			sqlite3.Xsqlite3_result_text(tls, ctx,
 16762  				func() uintptr {
 16763  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn != 0 {
 16764  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn
 16765  					}
 16766  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzIdColumn
 16767  				}(),
 16768  				-1, libc.UintptrFromInt32(-1))
 16769  			break
 16770  
 16771  		}
 16772  	case CLOSURE_COL_PARENTCOLUMN:
 16773  		{
 16774  			sqlite3.Xsqlite3_result_text(tls, ctx,
 16775  				func() uintptr {
 16776  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn != 0 {
 16777  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn
 16778  					}
 16779  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzParentColumn
 16780  				}(),
 16781  				-1, libc.UintptrFromInt32(-1))
 16782  			break
 16783  
 16784  		}
 16785  	}
 16786  	return SQLITE_OK
 16787  }
 16788  
 16789  // The rowid.  For the closure table, this is the same as the "id" column.
 16790  func closureRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* closure.c:783:12: */
 16791  	var pCur uintptr = cur
 16792  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).Fid
 16793  	return SQLITE_OK
 16794  }
 16795  
 16796  // EOF indicator
 16797  func closureEof(tls *libc.TLS, cur uintptr) int32 { /* closure.c:792:12: */
 16798  	var pCur uintptr = cur
 16799  	return (libc.Bool32((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent == uintptr(0)))
 16800  }
 16801  
 16802  // Search for terms of these forms:
 16803  //
 16804  //   (A)    root = $root
 16805  //   (B1)   depth < $depth
 16806  //   (B2)   depth <= $depth
 16807  //   (B3)   depth = $depth
 16808  //   (C)    tablename = $tablename
 16809  //   (D)    idcolumn = $idcolumn
 16810  //   (E)    parentcolumn = $parentcolumn
 16811  //
 16812  //
 16813  //
 16814  //   idxNum       meaning
 16815  //   ----------   ------------------------------------------------------
 16816  //   0x00000001   Term of the form (A) found
 16817  //   0x00000002   The term of bit-2 is like (B1)
 16818  //   0x000000f0   Index in filter.argv[] of $depth.  0 if not used.
 16819  //   0x00000f00   Index in filter.argv[] of $tablename.  0 if not used.
 16820  //   0x0000f000   Index in filter.argv[] of $idcolumn.  0 if not used
 16821  //   0x000f0000   Index in filter.argv[] of $parentcolumn.  0 if not used.
 16822  //
 16823  // There must be a term of type (A).  If there is not, then the index type
 16824  // is 0 and the query will return an empty set.
 16825  func closureBestIndex(tls *libc.TLS, pTab uintptr, pIdxInfo uintptr) int32 { /* closure.c:822:12: */
 16826  	var iPlan int32 = 0
 16827  	var i int32
 16828  	var idx int32 = 1
 16829  	var pConstraint uintptr
 16830  	var pVtab uintptr = pTab
 16831  	var rCost float64 = 10000000.0
 16832  
 16833  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 16834  	i = 0
 16835  __1:
 16836  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 16837  		goto __3
 16838  	}
 16839  	{
 16840  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 16841  			goto __2
 16842  		}
 16843  		if (((iPlan & 1) == 0) &&
 16844  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_ROOT)) &&
 16845  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 16846  			iPlan = iPlan | (1)
 16847  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 16848  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16849  			rCost = rCost / (100.0)
 16850  		}
 16851  		if (((iPlan & 0x0000f0) == 0) &&
 16852  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_DEPTH)) &&
 16853  			(((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 16854  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) ||
 16855  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ)) {
 16856  			iPlan = iPlan | (idx << 4)
 16857  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 16858  			if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT {
 16859  				iPlan = iPlan | (0x000002)
 16860  			}
 16861  			rCost = rCost / (5.0)
 16862  		}
 16863  		if (((iPlan & 0x000f00) == 0) &&
 16864  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_TABLENAME)) &&
 16865  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 16866  			iPlan = iPlan | (idx << 8)
 16867  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 16868  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16869  			rCost = rCost / (5.0)
 16870  		}
 16871  		if (((iPlan & 0x00f000) == 0) &&
 16872  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_IDCOLUMN)) &&
 16873  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 16874  			iPlan = iPlan | (idx << 12)
 16875  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 16876  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16877  		}
 16878  		if (((iPlan & 0x0f0000) == 0) &&
 16879  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_PARENTCOLUMN)) &&
 16880  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 16881  			iPlan = iPlan | (idx << 16)
 16882  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 16883  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16884  		}
 16885  
 16886  	}
 16887  	goto __2
 16888  __2:
 16889  	i++
 16890  	pConstraint += 12
 16891  	goto __1
 16892  	goto __3
 16893  __3:
 16894  	;
 16895  	if ((((*closure_vtab)(unsafe.Pointer(pVtab)).FzTableName == uintptr(0)) && ((iPlan & 0x000f00) == 0)) ||
 16896  		(((*closure_vtab)(unsafe.Pointer(pVtab)).FzIdColumn == uintptr(0)) && ((iPlan & 0x00f000) == 0))) ||
 16897  		(((*closure_vtab)(unsafe.Pointer(pVtab)).FzParentColumn == uintptr(0)) && ((iPlan & 0x0f0000) == 0)) {
 16898  		// All of tablename, idcolumn, and parentcolumn must be specified
 16899  		// in either the CREATE VIRTUAL TABLE or in the WHERE clause constraints
 16900  		// or else the result is an empty set.
 16901  		iPlan = 0
 16902  	}
 16903  	if (iPlan & 1) == 0 {
 16904  		// If there is no usable "root=?" term, then set the index-type to 0.
 16905  		// Also clear any argvIndex variables already set. This is necessary
 16906  		// to prevent the core from throwing an "xBestIndex malfunction error"
 16907  		// error (because the argvIndex values are not contiguously assigned
 16908  		// starting from 1).
 16909  		rCost = rCost * (1e30)
 16910  		i = 0
 16911  	__4:
 16912  		if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 16913  			goto __6
 16914  		}
 16915  		{
 16916  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 0
 16917  
 16918  		}
 16919  		goto __5
 16920  	__5:
 16921  		i++
 16922  		pConstraint += 12
 16923  		goto __4
 16924  		goto __6
 16925  	__6:
 16926  		;
 16927  		iPlan = 0
 16928  	}
 16929  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 16930  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 16931  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == CLOSURE_COL_ID)) &&
 16932  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 16933  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 16934  	}
 16935  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = rCost
 16936  
 16937  	return SQLITE_OK
 16938  }
 16939  
 16940  // A virtual table module that implements the "transitive_closure".
 16941  var closureModule = sqlite3_module{ // iVersion
 16942  	FxCreate:     0, // xCreate
 16943  	FxConnect:    0, // xConnect
 16944  	FxBestIndex:  0, // xBestIndex
 16945  	FxDisconnect: 0, // xDisconnect
 16946  	FxDestroy:    0, // xDestroy
 16947  	FxOpen:       0, // xOpen - open a cursor
 16948  	FxClose:      0, // xClose - close a cursor
 16949  	FxFilter:     0, // xFilter - configure scan constraints
 16950  	FxNext:       0, // xNext - advance a cursor
 16951  	FxEof:        0, // xEof - check for end of scan
 16952  	FxColumn:     0, // xColumn - read data
 16953  	FxRowid:      0, // xShadowName
 16954  } /* closure.c:918:23 */
 16955  
 16956  // Register the closure virtual table
 16957  func sqlite3_closure_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* closure.c:953:5: */
 16958  	var rc int32 = SQLITE_OK
 16959  	_ = pApi
 16960  
 16961  	_ = pzErrMsg
 16962  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4244 /* "transitive_closu..." */, uintptr(unsafe.Pointer(&closureModule)), uintptr(0))
 16963  	return rc
 16964  }
 16965  
 16966  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
 16967  // B.8.2.7 for the rationale behind the *_unlocked() macros.
 16968  
 16969  // A macro to hint to the compiler that a function should not be
 16970  // inlined.
 16971  
 16972  // Max size of the error message in a CsvReader
 16973  
 16974  // Size of the CsvReader input buffer
 16975  
 16976  // A context object used when read a CSV file.
 16977  type CsvReader1 = struct {
 16978  	Fin        uintptr
 16979  	Fz         uintptr
 16980  	Fn         int32
 16981  	FnAlloc    int32
 16982  	FnLine     int32
 16983  	FbNotFirst int32
 16984  	FcTerm     int32
 16985  	_          [4]byte
 16986  	FiIn       size_t
 16987  	FnIn       size_t
 16988  	FzIn       uintptr
 16989  	FzErr      [200]int8
 16990  } /* csv.c:73:9 */
 16991  
 16992  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
 16993  // B.8.2.7 for the rationale behind the *_unlocked() macros.
 16994  
 16995  // A macro to hint to the compiler that a function should not be
 16996  // inlined.
 16997  
 16998  // Max size of the error message in a CsvReader
 16999  
 17000  // Size of the CsvReader input buffer
 17001  
 17002  // A context object used when read a CSV file.
 17003  type CsvReader = CsvReader1 /* csv.c:73:26 */
 17004  
 17005  // Initialize a CsvReader object
 17006  func csv_reader_init(tls *libc.TLS, p uintptr) { /* csv.c:89:13: */
 17007  	(*CsvReader)(unsafe.Pointer(p)).Fin = uintptr(0)
 17008  	(*CsvReader)(unsafe.Pointer(p)).Fz = uintptr(0)
 17009  	(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 17010  	(*CsvReader)(unsafe.Pointer(p)).FnAlloc = 0
 17011  	(*CsvReader)(unsafe.Pointer(p)).FnLine = 0
 17012  	(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 0
 17013  	(*CsvReader)(unsafe.Pointer(p)).FnIn = uint64(0)
 17014  	(*CsvReader)(unsafe.Pointer(p)).FzIn = uintptr(0)
 17015  	*(*int8)(unsafe.Pointer((p + 64 /* &.zErr */))) = int8(0)
 17016  }
 17017  
 17018  // Close and reset a CsvReader object
 17019  func csv_reader_reset(tls *libc.TLS, p uintptr) { /* csv.c:102:13: */
 17020  	if (*CsvReader)(unsafe.Pointer(p)).Fin != 0 {
 17021  		libc.Xfclose(tls, (*CsvReader)(unsafe.Pointer(p)).Fin)
 17022  		sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)
 17023  	}
 17024  	sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).Fz)
 17025  	csv_reader_init(tls, p)
 17026  }
 17027  
 17028  // Report an error on a CsvReader
 17029  func csv_errmsg(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { /* csv.c:112:13: */
 17030  	var ap va_list
 17031  	_ = ap
 17032  	ap = va
 17033  	sqlite3.Xsqlite3_vsnprintf(tls, CSV_MXERR, p+64 /* &.zErr */, zFormat, ap)
 17034  	_ = ap
 17035  }
 17036  
 17037  // Open the file associated with a CsvReader
 17038  // Return the number of errors.
 17039  func csv_reader_open(tls *libc.TLS, p uintptr, zFilename uintptr, zData uintptr) int32 { /* csv.c:122:12: */
 17040  	bp := tls.Alloc(8)
 17041  	defer tls.Free(8)
 17042  
 17043  	if zFilename != 0 {
 17044  		(*CsvReader)(unsafe.Pointer(p)).FzIn = sqlite3.Xsqlite3_malloc(tls, CSV_INBUFSZ)
 17045  		if (*CsvReader)(unsafe.Pointer(p)).FzIn == uintptr(0) {
 17046  			csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 17047  			return 1
 17048  		}
 17049  		(*CsvReader)(unsafe.Pointer(p)).Fin = libc.Xfopen(tls, zFilename, ts+4263 /* "rb" */)
 17050  		if (*CsvReader)(unsafe.Pointer(p)).Fin == uintptr(0) {
 17051  			sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)
 17052  			csv_reader_reset(tls, p)
 17053  			csv_errmsg(tls, p, ts+4266 /* "cannot open '%s'..." */, libc.VaList(bp, zFilename))
 17054  			return 1
 17055  		}
 17056  	} else {
 17057  
 17058  		(*CsvReader)(unsafe.Pointer(p)).FzIn = zData
 17059  		(*CsvReader)(unsafe.Pointer(p)).FnIn = libc.Xstrlen(tls, zData)
 17060  	}
 17061  	return 0
 17062  }
 17063  
 17064  // The input buffer has overflowed.  Refill the input buffer, then
 17065  // return the next character
 17066  func csv_getc_refill(tls *libc.TLS, p uintptr) int32 { /* csv.c:151:25: */
 17067  	var got size_t
 17068  
 17069  	// Only called on an empty input buffer
 17070  	// Only called if reading froma file
 17071  
 17072  	got = libc.Xfread(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn, uint64(1), uint64(CSV_INBUFSZ), (*CsvReader)(unsafe.Pointer(p)).Fin)
 17073  	if got == uint64(0) {
 17074  		return -1
 17075  	}
 17076  	(*CsvReader)(unsafe.Pointer(p)).FnIn = got
 17077  	(*CsvReader)(unsafe.Pointer(p)).FiIn = uint64(1)
 17078  	return int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).FzIn)))
 17079  }
 17080  
 17081  // Return the next character of input.  Return EOF at end of input.
 17082  func csv_getc(tls *libc.TLS, p uintptr) int32 { /* csv.c:165:12: */
 17083  	if (*CsvReader)(unsafe.Pointer(p)).FiIn >= (*CsvReader)(unsafe.Pointer(p)).FnIn {
 17084  		if (*CsvReader)(unsafe.Pointer(p)).Fin != uintptr(0) {
 17085  			return csv_getc_refill(tls, p)
 17086  		}
 17087  		return -1
 17088  	}
 17089  	return int32(*(*uint8)(unsafe.Pointer(((*CsvReader)(unsafe.Pointer(p)).FzIn) + uintptr(libc.PostIncUint64(&(*CsvReader)(unsafe.Pointer(p)).FiIn, 1)))))
 17090  }
 17091  
 17092  // Increase the size of p->z and append character c to the end.
 17093  // Return 0 on success and non-zero if there is an OOM error
 17094  func csv_resize_and_append(tls *libc.TLS, p uintptr, c int8) int32 { /* csv.c:175:25: */
 17095  	var zNew uintptr
 17096  	var nNew int32 = (((*CsvReader)(unsafe.Pointer(p)).FnAlloc * 2) + 100)
 17097  	zNew = sqlite3.Xsqlite3_realloc64(tls, (*CsvReader)(unsafe.Pointer(p)).Fz, uint64(nNew))
 17098  	if zNew != 0 {
 17099  		(*CsvReader)(unsafe.Pointer(p)).Fz = zNew
 17100  		(*CsvReader)(unsafe.Pointer(p)).FnAlloc = nNew
 17101  		*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*CsvReader)(unsafe.Pointer(p)).Fn, 1)))) = c
 17102  		return 0
 17103  	} else {
 17104  		csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 17105  		return 1
 17106  	}
 17107  	return int32(0)
 17108  }
 17109  
 17110  // Append a single character to the CsvReader.z[] array.
 17111  // Return 0 on success and non-zero if there is an OOM error
 17112  func csv_append(tls *libc.TLS, p uintptr, c int8) int32 { /* csv.c:192:12: */
 17113  	if (*CsvReader)(unsafe.Pointer(p)).Fn >= ((*CsvReader)(unsafe.Pointer(p)).FnAlloc - 1) {
 17114  		return csv_resize_and_append(tls, p, c)
 17115  	}
 17116  	*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*CsvReader)(unsafe.Pointer(p)).Fn, 1)))) = c
 17117  	return 0
 17118  }
 17119  
 17120  // Read a single field of CSV text.  Compatible with rfc4180 and extended
 17121  // with the option of having a separator other than ",".
 17122  //
 17123  //   +  Input comes from p->in.
 17124  //   +  Store results in p->z of length p->n.  Space to hold p->z comes
 17125  //      from sqlite3_malloc64().
 17126  //   +  Keep track of the line number in p->nLine.
 17127  //   +  Store the character that terminates the field in p->cTerm.  Store
 17128  //      EOF on end-of-file.
 17129  //
 17130  // Return 0 at EOF or on OOM.  On EOF, the p->cTerm character will have
 17131  // been set to EOF.
 17132  func csv_read_one_field(tls *libc.TLS, p uintptr) uintptr { /* csv.c:211:13: */
 17133  	bp := tls.Alloc(32)
 17134  	defer tls.Free(32)
 17135  
 17136  	var c int32
 17137  	(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 17138  	c = csv_getc(tls, p)
 17139  	if c == (-1) {
 17140  		(*CsvReader)(unsafe.Pointer(p)).FcTerm = -1
 17141  		return uintptr(0)
 17142  	}
 17143  	if c == '"' {
 17144  		var pc int32
 17145  		var ppc int32
 17146  		var startLine int32 = (*CsvReader)(unsafe.Pointer(p)).FnLine
 17147  		pc = libc.AssignInt32(&ppc, 0)
 17148  		for 1 != 0 {
 17149  			c = csv_getc(tls, p)
 17150  			if (c <= '"') || (pc == '"') {
 17151  				if c == '\n' {
 17152  					(*CsvReader)(unsafe.Pointer(p)).FnLine++
 17153  				}
 17154  				if c == '"' {
 17155  					if pc == '"' {
 17156  						pc = 0
 17157  						continue
 17158  					}
 17159  				}
 17160  				if ((((c == ',') && (pc == '"')) ||
 17161  					((c == '\n') && (pc == '"'))) ||
 17162  					(((c == '\n') && (pc == '\r')) && (ppc == '"'))) ||
 17163  					((c == (-1)) && (pc == '"')) {
 17164  					for ok := true; ok; ok = (int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr((*CsvReader)(unsafe.Pointer(p)).Fn)))) != '"') {
 17165  						(*CsvReader)(unsafe.Pointer(p)).Fn--
 17166  					}
 17167  					(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 17168  					break
 17169  				}
 17170  				if (pc == '"') && (c != '\r') {
 17171  					csv_errmsg(tls, p, ts+4295 /* "line %d: unescap..." */, libc.VaList(bp, (*CsvReader)(unsafe.Pointer(p)).FnLine, '"'))
 17172  					break
 17173  				}
 17174  				if c == (-1) {
 17175  					csv_errmsg(tls, p, ts+4327, /* "line %d: untermi..." */
 17176  						libc.VaList(bp+16, startLine, '"'))
 17177  					(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 17178  					break
 17179  				}
 17180  			}
 17181  			if csv_append(tls, p, int8(c)) != 0 {
 17182  				return uintptr(0)
 17183  			}
 17184  			ppc = pc
 17185  			pc = c
 17186  		}
 17187  	} else {
 17188  		// If this is the first field being parsed and it begins with the
 17189  		// UTF-8 BOM  (0xEF BB BF) then skip the BOM
 17190  		if ((c & 0xff) == 0xef) && ((*CsvReader)(unsafe.Pointer(p)).FbNotFirst == 0) {
 17191  			csv_append(tls, p, int8(c))
 17192  			c = csv_getc(tls, p)
 17193  			if (c & 0xff) == 0xbb {
 17194  				csv_append(tls, p, int8(c))
 17195  				c = csv_getc(tls, p)
 17196  				if (c & 0xff) == 0xbf {
 17197  					(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 1
 17198  					(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 17199  					return csv_read_one_field(tls, p)
 17200  				}
 17201  			}
 17202  		}
 17203  		for (c > ',') || (((c != (-1)) && (c != ',')) && (c != '\n')) {
 17204  			if csv_append(tls, p, int8(c)) != 0 {
 17205  				return uintptr(0)
 17206  			}
 17207  			c = csv_getc(tls, p)
 17208  		}
 17209  		if c == '\n' {
 17210  			(*CsvReader)(unsafe.Pointer(p)).FnLine++
 17211  			if ((*CsvReader)(unsafe.Pointer(p)).Fn > 0) && (int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(((*CsvReader)(unsafe.Pointer(p)).Fn - 1))))) == '\r') {
 17212  				(*CsvReader)(unsafe.Pointer(p)).Fn--
 17213  			}
 17214  		}
 17215  		(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 17216  	}
 17217  	if (*CsvReader)(unsafe.Pointer(p)).Fz != 0 {
 17218  		*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr((*CsvReader)(unsafe.Pointer(p)).Fn))) = int8(0)
 17219  	}
 17220  	(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 1
 17221  	return (*CsvReader)(unsafe.Pointer(p)).Fz
 17222  }
 17223  
 17224  // An instance of the CSV virtual table
 17225  type CsvTable1 = struct {
 17226  	Fbase      sqlite3_vtab
 17227  	FzFilename uintptr
 17228  	FzData     uintptr
 17229  	FiStart    int64
 17230  	FnCol      int32
 17231  	FtstFlags  uint32
 17232  } /* csv.c:307:9 */
 17233  
 17234  // An instance of the CSV virtual table
 17235  type CsvTable = CsvTable1 /* csv.c:314:3 */
 17236  
 17237  // Allowed values for tstFlags
 17238  
 17239  // A cursor for the CSV virtual table
 17240  type CsvCursor1 = struct {
 17241  	Fbase   sqlite3_vtab_cursor
 17242  	Frdr    CsvReader
 17243  	FazVal  uintptr
 17244  	FaLen   uintptr
 17245  	FiRowid sqlite3_int64
 17246  } /* csv.c:320:9 */
 17247  
 17248  // Allowed values for tstFlags
 17249  
 17250  // A cursor for the CSV virtual table
 17251  type CsvCursor = CsvCursor1 /* csv.c:326:3 */
 17252  
 17253  // Transfer error message text from a reader into a CsvTable
 17254  func csv_xfer_error(tls *libc.TLS, pTab uintptr, pRdr uintptr) { /* csv.c:329:13: */
 17255  	bp := tls.Alloc(8)
 17256  	defer tls.Free(8)
 17257  
 17258  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(pTab)).Fbase.FzErrMsg)
 17259  	(*CsvTable)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, pRdr+64 /* &.zErr */))
 17260  }
 17261  
 17262  // This method is the destructor fo a CsvTable object.
 17263  func csvtabDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* csv.c:337:12: */
 17264  	var p uintptr = pVtab
 17265  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(p)).FzFilename)
 17266  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(p)).FzData)
 17267  	sqlite3.Xsqlite3_free(tls, p)
 17268  	return SQLITE_OK
 17269  }
 17270  
 17271  // Skip leading whitespace.  Return a pointer to the first non-whitespace
 17272  // character, or to the zero terminator if the string has only whitespace
 17273  func csv_skip_whitespace(tls *libc.TLS, z uintptr) uintptr { /* csv.c:347:19: */
 17274  	for __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z)))), uint64(X_CTYPE_S)) != 0 {
 17275  		z++
 17276  	}
 17277  	return z
 17278  }
 17279  
 17280  // Remove trailing whitespace from the end of string z[]
 17281  func csv_trim_whitespace(tls *libc.TLS, z uintptr) { /* csv.c:353:13: */
 17282  	var n size_t = libc.Xstrlen(tls, z)
 17283  	for (n > uint64(0)) && (__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(n))))), uint64(X_CTYPE_S)) != 0) {
 17284  		n--
 17285  	}
 17286  	*(*int8)(unsafe.Pointer(z + uintptr(n))) = int8(0)
 17287  }
 17288  
 17289  // Dequote the string
 17290  func csv_dequote(tls *libc.TLS, z uintptr) { /* csv.c:360:13: */
 17291  	var j int32
 17292  	var cQuote int8 = *(*int8)(unsafe.Pointer(z))
 17293  	var i size_t
 17294  	var n size_t
 17295  
 17296  	if (int32(cQuote) != '\'') && (int32(cQuote) != '"') {
 17297  		return
 17298  	}
 17299  	n = libc.Xstrlen(tls, z)
 17300  	if (n < uint64(2)) || (int32(*(*int8)(unsafe.Pointer(z + uintptr((n - uint64(1)))))) != int32(*(*int8)(unsafe.Pointer(z)))) {
 17301  		return
 17302  	}
 17303  	i = uint64(1)
 17304  	j = 0
 17305  	for ; i < (n - uint64(1)); i++ {
 17306  		if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(cQuote)) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((i + uint64(1)))))) == int32(cQuote)) {
 17307  			i++
 17308  		}
 17309  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(i)))
 17310  	}
 17311  	*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 17312  }
 17313  
 17314  // Check to see if the string is of the form:  "TAG = VALUE" with optional
 17315  // whitespace before and around tokens.  If it is, return a pointer to the
 17316  // first character of VALUE.  If it is not, return NULL.
 17317  func csv_parameter(tls *libc.TLS, zTag uintptr, nTag int32, z uintptr) uintptr { /* csv.c:379:19: */
 17318  	z = csv_skip_whitespace(tls, z)
 17319  	if libc.Xstrncmp(tls, zTag, z, uint64(nTag)) != 0 {
 17320  		return uintptr(0)
 17321  	}
 17322  	z = csv_skip_whitespace(tls, (z + uintptr(nTag)))
 17323  	if int32(*(*int8)(unsafe.Pointer(z))) != '=' {
 17324  		return uintptr(0)
 17325  	}
 17326  	return csv_skip_whitespace(tls, (z + uintptr(1)))
 17327  }
 17328  
 17329  // Decode a parameter that requires a dequoted string.
 17330  //
 17331  // Return 1 if the parameter is seen, or 0 if not.  1 is returned
 17332  // even if there is an error.  If an error occurs, then an error message
 17333  // is left in p->zErr.  If there are no errors, p->zErr[0]==0.
 17334  func csv_string_parameter(tls *libc.TLS, p uintptr, zParam uintptr, zArg uintptr, pzVal uintptr) int32 { /* csv.c:393:12: */
 17335  	bp := tls.Alloc(16)
 17336  	defer tls.Free(16)
 17337  
 17338  	var zValue uintptr
 17339  	zValue = csv_parameter(tls, zParam, int32(libc.Xstrlen(tls, zParam)), zArg)
 17340  	if zValue == uintptr(0) {
 17341  		return 0
 17342  	}
 17343  	*(*int8)(unsafe.Pointer((p + 64 /* &.zErr */))) = int8(0)
 17344  	if *(*uintptr)(unsafe.Pointer(pzVal)) != 0 {
 17345  		csv_errmsg(tls, p, ts+4366 /* "more than one '%..." */, libc.VaList(bp, zParam))
 17346  		return 1
 17347  	}
 17348  	*(*uintptr)(unsafe.Pointer(pzVal)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zValue))
 17349  	if *(*uintptr)(unsafe.Pointer(pzVal)) == uintptr(0) {
 17350  		csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 17351  		return 1
 17352  	}
 17353  	csv_trim_whitespace(tls, *(*uintptr)(unsafe.Pointer(pzVal)))
 17354  	csv_dequote(tls, *(*uintptr)(unsafe.Pointer(pzVal)))
 17355  	return 1
 17356  }
 17357  
 17358  // Return 0 if the argument is false and 1 if it is true.  Return -1 if
 17359  // we cannot really tell.
 17360  func csv_boolean(tls *libc.TLS, z uintptr) int32 { /* csv.c:421:12: */
 17361  	if (((sqlite3.Xsqlite3_stricmp(tls, ts+4035 /* "yes" */, z) == 0) ||
 17362  		(sqlite3.Xsqlite3_stricmp(tls, ts+4039 /* "on" */, z) == 0)) ||
 17363  		(sqlite3.Xsqlite3_stricmp(tls, ts+4395 /* "true" */, z) == 0)) ||
 17364  		((int32(*(*int8)(unsafe.Pointer(z))) == '1') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 0)) {
 17365  		return 1
 17366  	}
 17367  	if (((sqlite3.Xsqlite3_stricmp(tls, ts+4400 /* "no" */, z) == 0) ||
 17368  		(sqlite3.Xsqlite3_stricmp(tls, ts+4403 /* "off" */, z) == 0)) ||
 17369  		(sqlite3.Xsqlite3_stricmp(tls, ts+4407 /* "false" */, z) == 0)) ||
 17370  		((int32(*(*int8)(unsafe.Pointer(z))) == '0') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 0)) {
 17371  		return 0
 17372  	}
 17373  	return -1
 17374  }
 17375  
 17376  // Check to see if the string is of the form:  "TAG = BOOLEAN" or just "TAG".
 17377  // If it is, set *pValue to be the value of the boolean ("true" if there is
 17378  // not "= BOOLEAN" component) and return non-zero.  If the input string
 17379  // does not begin with TAG, return zero.
 17380  func csv_boolean_parameter(tls *libc.TLS, zTag uintptr, nTag int32, z uintptr, pValue uintptr) int32 { /* csv.c:444:12: */
 17381  	var b int32
 17382  	z = csv_skip_whitespace(tls, z)
 17383  	if libc.Xstrncmp(tls, zTag, z, uint64(nTag)) != 0 {
 17384  		return 0
 17385  	}
 17386  	z = csv_skip_whitespace(tls, (z + uintptr(nTag)))
 17387  	if int32(*(*int8)(unsafe.Pointer(z))) == 0 {
 17388  		*(*int32)(unsafe.Pointer(pValue)) = 1
 17389  		return 1
 17390  	}
 17391  	if int32(*(*int8)(unsafe.Pointer(z))) != '=' {
 17392  		return 0
 17393  	}
 17394  	z = csv_skip_whitespace(tls, (z + uintptr(1)))
 17395  	b = csv_boolean(tls, z)
 17396  	if b >= 0 {
 17397  		*(*int32)(unsafe.Pointer(pValue)) = b
 17398  		return 1
 17399  	}
 17400  	return 0
 17401  }
 17402  
 17403  // Parameters:
 17404  //    filename=FILENAME          Name of file containing CSV content
 17405  //    data=TEXT                  Direct CSV content.
 17406  //    schema=SCHEMA              Alternative CSV schema.
 17407  //    header=YES|NO              First row of CSV defines the names of
 17408  //                               columns if "yes".  Default "no".
 17409  //    columns=N                  Assume the CSV file contains N columns.
 17410  //
 17411  // Only available if compiled with SQLITE_TEST:
 17412  //
 17413  //    testflags=N                Bitmask of test flags.  Optional
 17414  //
 17415  // If schema= is omitted, then the columns are named "c0", "c1", "c2",
 17416  // and so forth.  If columns=N is omitted, then the file is opened and
 17417  // the number of columns in the first row is counted to determine the
 17418  // column count.  If header=YES, then the first row is skipped.
 17419  func csvtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* csv.c:486:12: */
 17420  	bp := tls.Alloc(372)
 17421  	defer tls.Free(372)
 17422  
 17423  	var pNew uintptr  // The CsvTable object to construct
 17424  	var bHeader int32 // header= flags.  -1 means not seen yet
 17425  	var rc int32      // Result code from this routine
 17426  	var i int32
 17427  	var j int32        // Loop counters
 17428  	var tstFlags int32 // Value for testflags=N parameter
 17429  	// var b int32 at bp+368, 4
 17430  	// Value of a boolean parameter
 17431  	var nCol int32 // Value of the columns= parameter
 17432  	// var sRdr CsvReader at bp+80, 264
 17433  
 17434  	// var azPValue [3]uintptr at bp+344, 24
 17435  
 17436  	var z uintptr
 17437  	var zValue uintptr
 17438  	var z1 uintptr
 17439  	var pStr uintptr
 17440  	var zSep uintptr
 17441  	var iCol int32
 17442  	pNew = uintptr(0)
 17443  	bHeader = -1
 17444  	rc = SQLITE_OK
 17445  	tstFlags = 0
 17446  	nCol = -99 // Parameter values
 17447  
 17448  	libc.Xmemset(tls, bp+80 /* &sRdr */, 0, uint64(unsafe.Sizeof(CsvReader{})))
 17449  	libc.Xmemset(tls, bp+344 /* &azPValue[0] */, 0, uint64(unsafe.Sizeof([3]uintptr{})))
 17450  	i = 3
 17451  __1:
 17452  	if !(i < argc) {
 17453  		goto __3
 17454  	}
 17455  	z = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))
 17456  	j = 0
 17457  __4:
 17458  	if !(uint64(j) < (uint64(unsafe.Sizeof(azParam)) / uint64(unsafe.Sizeof(uintptr(0))))) {
 17459  		goto __6
 17460  	}
 17461  	if !(csv_string_parameter(tls, bp+80 /* &sRdr */, azParam[j], z, (bp+344 /* &azPValue */ +uintptr(j)*8)) != 0) {
 17462  		goto __7
 17463  	}
 17464  	goto __6
 17465  __7:
 17466  	;
 17467  	goto __5
 17468  __5:
 17469  	j++
 17470  	goto __4
 17471  	goto __6
 17472  __6:
 17473  	;
 17474  	if !(uint64(j) < (uint64(unsafe.Sizeof(azParam)) / uint64(unsafe.Sizeof(uintptr(0))))) {
 17475  		goto __8
 17476  	}
 17477  	if !(*(*int8)(unsafe.Pointer((bp + 80 /* &sRdr */ + 64 /* &.zErr */))) != 0) {
 17478  		goto __10
 17479  	}
 17480  	goto csvtab_connect_error
 17481  __10:
 17482  	;
 17483  	goto __9
 17484  __8:
 17485  	if !(csv_boolean_parameter(tls, ts+4413 /* "header" */, 6, z, bp+368 /* &b */) != 0) {
 17486  		goto __11
 17487  	}
 17488  	if !(bHeader >= 0) {
 17489  		goto __13
 17490  	}
 17491  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4420 /* "more than one 'h..." */, 0)
 17492  	goto csvtab_connect_error
 17493  __13:
 17494  	;
 17495  	bHeader = *(*int32)(unsafe.Pointer(bp + 368 /* b */))
 17496  	goto __12
 17497  __11:
 17498  	if !((libc.AssignUintptr(&zValue, csv_parameter(tls, ts+4453 /* "testflags" */, 9, z))) != uintptr(0)) {
 17499  		goto __14
 17500  	}
 17501  	tstFlags = int32(uint32(libc.Xatoi(tls, zValue)))
 17502  	goto __15
 17503  __14:
 17504  	if !((libc.AssignUintptr(&zValue, csv_parameter(tls, ts+4463 /* "columns" */, 7, z))) != uintptr(0)) {
 17505  		goto __16
 17506  	}
 17507  	if !(nCol > 0) {
 17508  		goto __18
 17509  	}
 17510  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4471 /* "more than one 'c..." */, 0)
 17511  	goto csvtab_connect_error
 17512  __18:
 17513  	;
 17514  	nCol = libc.Xatoi(tls, zValue)
 17515  	if !(nCol <= 0) {
 17516  		goto __19
 17517  	}
 17518  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4505 /* "column= value mu..." */, 0)
 17519  	goto csvtab_connect_error
 17520  __19:
 17521  	;
 17522  	goto __17
 17523  __16:
 17524  
 17525  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4536 /* "bad parameter: '..." */, libc.VaList(bp, z))
 17526  	goto csvtab_connect_error
 17527  __17:
 17528  	;
 17529  __15:
 17530  	;
 17531  __12:
 17532  	;
 17533  __9:
 17534  	;
 17535  	goto __2
 17536  __2:
 17537  	i++
 17538  	goto __1
 17539  	goto __3
 17540  __3:
 17541  	;
 17542  	if !((libc.Bool32((*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */))) == uintptr(0))) == (libc.Bool32((*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 1*8))) == uintptr(0)))) {
 17543  		goto __20
 17544  	}
 17545  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4556 /* "must specify eit..." */, 0)
 17546  	goto csvtab_connect_error
 17547  __20:
 17548  	;
 17549  
 17550  	if !(((nCol <= 0) || (bHeader == 1)) &&
 17551  		(csv_reader_open(tls, bp+80 /* &sRdr */, *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */)), *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 1*8))) != 0)) {
 17552  		goto __21
 17553  	}
 17554  	goto csvtab_connect_error
 17555  __21:
 17556  	;
 17557  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(CsvTable{})))
 17558  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 17559  	if !(pNew == uintptr(0)) {
 17560  		goto __22
 17561  	}
 17562  	goto csvtab_connect_oom
 17563  __22:
 17564  	;
 17565  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(CsvTable{})))
 17566  	if !((*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 2*8))) == uintptr(0)) {
 17567  		goto __23
 17568  	}
 17569  	pStr = sqlite3.Xsqlite3_str_new(tls, uintptr(0))
 17570  	zSep = ts + 489 /* "" */
 17571  	iCol = 0
 17572  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+884 /* "CREATE TABLE x(" */, 0)
 17573  	if !((nCol < 0) && (bHeader < 1)) {
 17574  		goto __25
 17575  	}
 17576  	nCol = 0
 17577  __26:
 17578  	csv_read_one_field(tls, bp+80 /* &sRdr */)
 17579  	nCol++
 17580  	goto __27
 17581  __27:
 17582  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 17583  		goto __26
 17584  	}
 17585  	goto __28
 17586  __28:
 17587  	;
 17588  __25:
 17589  	;
 17590  	if !((nCol > 0) && (bHeader < 1)) {
 17591  		goto __29
 17592  	}
 17593  	iCol = 0
 17594  __31:
 17595  	if !(iCol < nCol) {
 17596  		goto __33
 17597  	}
 17598  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4608 /* "%sc%d TEXT" */, libc.VaList(bp+8, zSep, iCol))
 17599  	zSep = ts + 4619 /* "," */
 17600  	goto __32
 17601  __32:
 17602  	iCol++
 17603  	goto __31
 17604  	goto __33
 17605  __33:
 17606  	;
 17607  	goto __30
 17608  __29:
 17609  __34:
 17610  	z1 = csv_read_one_field(tls, bp+80 /* &sRdr */)
 17611  	if !(((nCol > 0) && (iCol < nCol)) || ((nCol < 0) && (bHeader != 0))) {
 17612  		goto __37
 17613  	}
 17614  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4621 /* "%s\"%w\" TEXT" */, libc.VaList(bp+24, zSep, z1))
 17615  	zSep = ts + 4619 /* "," */
 17616  	iCol++
 17617  __37:
 17618  	;
 17619  	goto __35
 17620  __35:
 17621  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 17622  		goto __34
 17623  	}
 17624  	goto __36
 17625  __36:
 17626  	;
 17627  	if !(nCol < 0) {
 17628  		goto __38
 17629  	}
 17630  	nCol = iCol
 17631  	goto __39
 17632  __38:
 17633  __40:
 17634  	if !(iCol < nCol) {
 17635  		goto __41
 17636  	}
 17637  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4608 /* "%sc%d TEXT" */, libc.VaList(bp+40, zSep, libc.PreIncInt32(&iCol, 1)))
 17638  	zSep = ts + 4619 /* "," */
 17639  	goto __40
 17640  __41:
 17641  	;
 17642  __39:
 17643  	;
 17644  __30:
 17645  	;
 17646  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol = nCol
 17647  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+490 /* ")" */, 0)
 17648  	(*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 2*8))) = sqlite3.Xsqlite3_str_finish(tls, pStr)
 17649  	if !((*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 2*8))) == uintptr(0)) {
 17650  		goto __42
 17651  	}
 17652  	goto csvtab_connect_oom
 17653  __42:
 17654  	;
 17655  	goto __24
 17656  __23:
 17657  	if !(nCol < 0) {
 17658  		goto __43
 17659  	}
 17660  __45:
 17661  	csv_read_one_field(tls, bp+80 /* &sRdr */)
 17662  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol++
 17663  	goto __46
 17664  __46:
 17665  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 17666  		goto __45
 17667  	}
 17668  	goto __47
 17669  __47:
 17670  	;
 17671  	goto __44
 17672  __43:
 17673  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol = nCol
 17674  __44:
 17675  	;
 17676  __24:
 17677  	;
 17678  	(*CsvTable)(unsafe.Pointer(pNew)).FzFilename = *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */))
 17679  	(*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */))) = uintptr(0)
 17680  	(*CsvTable)(unsafe.Pointer(pNew)).FzData = *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 1*8))
 17681  	(*(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 1*8))) = uintptr(0)
 17682  	(*CsvTable)(unsafe.Pointer(pNew)).FtstFlags = uint32(tstFlags)
 17683  	if !(bHeader != 1) {
 17684  		goto __48
 17685  	}
 17686  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = int64(0)
 17687  	goto __49
 17688  __48:
 17689  	if !((*CsvTable)(unsafe.Pointer(pNew)).FzData != 0) {
 17690  		goto __50
 17691  	}
 17692  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = int64(int32((*CsvReader)(unsafe.Pointer(bp + 80 /* &sRdr */)).FiIn))
 17693  	goto __51
 17694  __50:
 17695  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = int64((int32((size_t(libc.Xftell(tls, (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).Fin)) - (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FnIn) + (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FiIn)))
 17696  __51:
 17697  	;
 17698  __49:
 17699  	;
 17700  	csv_reader_reset(tls, bp+80 /* &sRdr */)
 17701  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 2*8)))
 17702  	if !(rc != 0) {
 17703  		goto __52
 17704  	}
 17705  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4633 /* "bad schema: '%s'..." */, libc.VaList(bp+56, *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + 2*8)), sqlite3.Xsqlite3_errmsg(tls, db)))
 17706  	goto csvtab_connect_error
 17707  __52:
 17708  	;
 17709  	i = 0
 17710  __53:
 17711  	if !(uint64(i) < (uint64(unsafe.Sizeof([3]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))) {
 17712  		goto __55
 17713  	}
 17714  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + uintptr(i)*8)))
 17715  	goto __54
 17716  __54:
 17717  	i++
 17718  	goto __53
 17719  	goto __55
 17720  __55:
 17721  	;
 17722  	// Rationale for DIRECTONLY:
 17723  	// An attacker who controls a database schema could use this vtab
 17724  	// to exfiltrate sensitive data from other files in the filesystem.
 17725  	// And, recommended practice is to put all CSV virtual tables in the
 17726  	// TEMP namespace, so they should still be usable from within TEMP
 17727  	// views, so there shouldn't be a serious loss of functionality by
 17728  	// prohibiting the use of this vtab from persistent triggers and views.
 17729  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 17730  	return SQLITE_OK
 17731  
 17732  csvtab_connect_oom:
 17733  	rc = SQLITE_NOMEM
 17734  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+1930 /* "out of memory" */, 0)
 17735  
 17736  csvtab_connect_error:
 17737  	if !(pNew != 0) {
 17738  		goto __56
 17739  	}
 17740  	csvtabDisconnect(tls, (pNew /* &.base */))
 17741  __56:
 17742  	;
 17743  	i = 0
 17744  __57:
 17745  	if !(uint64(i) < (uint64(unsafe.Sizeof([3]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))) {
 17746  		goto __59
 17747  	}
 17748  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 344 /* &azPValue[0] */ + uintptr(i)*8)))
 17749  	goto __58
 17750  __58:
 17751  	i++
 17752  	goto __57
 17753  	goto __59
 17754  __59:
 17755  	;
 17756  	if !(*(*int8)(unsafe.Pointer((bp + 80 /* &sRdr */ + 64 /* &.zErr */))) != 0) {
 17757  		goto __60
 17758  	}
 17759  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErr)))
 17760  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+72, bp+80 /* &sRdr */ +64 /* &.zErr */))
 17761  __60:
 17762  	;
 17763  	csv_reader_reset(tls, bp+80 /* &sRdr */)
 17764  	if !(rc == SQLITE_OK) {
 17765  		goto __61
 17766  	}
 17767  	rc = SQLITE_ERROR
 17768  __61:
 17769  	;
 17770  	return rc
 17771  }
 17772  
 17773  var azParam = [3]uintptr{
 17774  	ts + 4655 /* "filename" */, ts + 4664 /* "data" */, ts + 4669, /* "schema" */
 17775  } /* csv.c:504:21 */
 17776  
 17777  // Reset the current row content held by a CsvCursor.
 17778  func csvtabCursorRowReset(tls *libc.TLS, pCur uintptr) { /* csv.c:667:13: */
 17779  	var pTab uintptr = (*CsvCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab
 17780  	var i int32
 17781  	for i = 0; i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol; i++ {
 17782  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)))
 17783  		*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)) = uintptr(0)
 17784  		*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = 0
 17785  	}
 17786  }
 17787  
 17788  // The xConnect and xCreate methods do the same thing, but they must be
 17789  // different so that the virtual table is not an eponymous virtual table.
 17790  func csvtabCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* csv.c:681:12: */
 17791  	return csvtabConnect(tls, db, pAux, argc, argv, ppVtab, pzErr)
 17792  }
 17793  
 17794  // Destructor for a CsvCursor.
 17795  func csvtabClose(tls *libc.TLS, cur uintptr) int32 { /* csv.c:694:12: */
 17796  	var pCur uintptr = cur
 17797  	csvtabCursorRowReset(tls, pCur)
 17798  	csv_reader_reset(tls, (pCur + 8 /* &.rdr */))
 17799  	sqlite3.Xsqlite3_free(tls, cur)
 17800  	return SQLITE_OK
 17801  }
 17802  
 17803  // Constructor for a new CsvTable cursor object.
 17804  func csvtabOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* csv.c:705:12: */
 17805  	var pTab uintptr = p
 17806  	var pCur uintptr
 17807  	var nByte size_t
 17808  	nByte = (uint64(unsafe.Sizeof(CsvCursor{})) + ((uint64(unsafe.Sizeof(uintptr(0))) + uint64(unsafe.Sizeof(int32(0)))) * uint64((*CsvTable)(unsafe.Pointer(pTab)).FnCol)))
 17809  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 17810  	if pCur == uintptr(0) {
 17811  		return SQLITE_NOMEM
 17812  	}
 17813  	libc.Xmemset(tls, pCur, 0, nByte)
 17814  	(*CsvCursor)(unsafe.Pointer(pCur)).FazVal = (pCur + 1*296)
 17815  	(*CsvCursor)(unsafe.Pointer(pCur)).FaLen = ((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr((*CsvTable)(unsafe.Pointer(pTab)).FnCol)*8)
 17816  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 17817  	if csv_reader_open(tls, (pCur+8 /* &.rdr */), (*CsvTable)(unsafe.Pointer(pTab)).FzFilename, (*CsvTable)(unsafe.Pointer(pTab)).FzData) != 0 {
 17818  		csv_xfer_error(tls, pTab, (pCur + 8 /* &.rdr */))
 17819  		return SQLITE_ERROR
 17820  	}
 17821  	return SQLITE_OK
 17822  }
 17823  
 17824  // Advance a CsvCursor to its next row of input.
 17825  // Set the EOF marker if we reach the end of input.
 17826  func csvtabNext(tls *libc.TLS, cur uintptr) int32 { /* csv.c:728:12: */
 17827  	var pCur uintptr = cur
 17828  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 17829  	var i int32 = 0
 17830  	var z uintptr
 17831  	for ok := true; ok; ok = ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FcTerm == ',') {
 17832  		z = csv_read_one_field(tls, (pCur + 8 /* &.rdr */))
 17833  		if z == uintptr(0) {
 17834  			break
 17835  		}
 17836  		if i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol {
 17837  			if *(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) < ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1) {
 17838  				var zNew uintptr = sqlite3.Xsqlite3_realloc64(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)), (uint64((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)))
 17839  				if zNew == uintptr(0) {
 17840  					csv_errmsg(tls, (pCur + 8 /* &.rdr */), ts+1930 /* "out of memory" */, 0)
 17841  					csv_xfer_error(tls, pTab, (pCur + 8 /* &.rdr */))
 17842  					break
 17843  				}
 17844  				*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)) = zNew
 17845  				*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)
 17846  			}
 17847  			libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)), z, (uint64((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)))
 17848  			i++
 17849  		}
 17850  	}
 17851  	if (z == uintptr(0)) || (((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FcTerm == (-1)) && (i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol)) {
 17852  		(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid = int64(-1)
 17853  	} else {
 17854  		(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid++
 17855  		for i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol {
 17856  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)))
 17857  			*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)) = uintptr(0)
 17858  			*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = 0
 17859  			i++
 17860  		}
 17861  	}
 17862  	return SQLITE_OK
 17863  }
 17864  
 17865  // Return values of columns for the row at which the CsvCursor
 17866  // is currently pointing.
 17867  func csvtabColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* csv.c:771:12: */
 17868  	var pCur uintptr = cur
 17869  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 17870  	if ((i >= 0) && (i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol)) && (*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)) != uintptr(0)) {
 17871  		sqlite3.Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*8)), -1, libc.UintptrFromInt32(-1))
 17872  	}
 17873  	return SQLITE_OK
 17874  }
 17875  
 17876  // Return the rowid for the current row.
 17877  func csvtabRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* csv.c:787:12: */
 17878  	var pCur uintptr = cur
 17879  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*CsvCursor)(unsafe.Pointer(pCur)).FiRowid
 17880  	return SQLITE_OK
 17881  }
 17882  
 17883  // Return TRUE if the cursor has been moved off of the last
 17884  // row of output.
 17885  func csvtabEof(tls *libc.TLS, cur uintptr) int32 { /* csv.c:797:12: */
 17886  	var pCur uintptr = cur
 17887  	return (libc.Bool32((*CsvCursor)(unsafe.Pointer(pCur)).FiRowid < int64(0)))
 17888  }
 17889  
 17890  // Only a full table scan is supported.  So xFilter simply rewinds to
 17891  // the beginning.
 17892  func csvtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* csv.c:806:12: */
 17893  	var pCur uintptr = pVtabCursor
 17894  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 17895  	(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid = int64(0)
 17896  	if (*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fin == uintptr(0) {
 17897  
 17898  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FiIn = size_t((*CsvTable)(unsafe.Pointer(pTab)).FiStart)
 17899  	} else {
 17900  		libc.Xfseek(tls, (*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fin, (*CsvTable)(unsafe.Pointer(pTab)).FiStart, SEEK_SET)
 17901  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FiIn = uint64(0)
 17902  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FnIn = uint64(0)
 17903  	}
 17904  	return csvtabNext(tls, pVtabCursor)
 17905  }
 17906  
 17907  // Only a forward full table scan is supported.  xBestIndex is mostly
 17908  // a no-op.  If CSVTEST_FIDX is set, then the presence of equality
 17909  // constraints lowers the estimated cost, which is fiction, but is useful
 17910  // for testing certain kinds of virtual table behavior.
 17911  func csvtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* csv.c:833:12: */
 17912  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1000000)
 17913  	if ((*CsvTable)(unsafe.Pointer((tab))).FtstFlags & uint32(CSVTEST_FIDX)) != uint32(0) {
 17914  		// The usual (and sensible) case is to always do a full table scan.
 17915  		// The code in this branch only runs when testflags=1.  This code
 17916  		// generates an artifical and unrealistic plan which is useful
 17917  		// for testing virtual table logic but is not helpful to real applications.
 17918  		//
 17919  		// Any ==, LIKE, or GLOB constraint is marked as usable by the virtual
 17920  		// table (even though it is not) and the cost of running the virtual table
 17921  		// is reduced from 1 million to just 10.  The constraints are *not* marked
 17922  		// as omittable, however, so the query planner should still generate a
 17923  		// plan that gives a correct answer, even if they plan is not optimal.
 17924  		var i int32
 17925  		var nConst int32 = 0
 17926  		for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 17927  			var op uint8
 17928  			if int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint+uintptr(i)*12)).Fusable) == 0 {
 17929  				continue
 17930  			}
 17931  			op = (*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)).Fop
 17932  			if ((int32(op) == SQLITE_INDEX_CONSTRAINT_EQ) ||
 17933  				(int32(op) == SQLITE_INDEX_CONSTRAINT_LIKE)) ||
 17934  				(int32(op) == SQLITE_INDEX_CONSTRAINT_GLOB) {
 17935  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10)
 17936  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(nConst)*8)).FargvIndex = (nConst + 1)
 17937  				nConst++
 17938  			}
 17939  		}
 17940  	}
 17941  	return SQLITE_OK
 17942  }
 17943  
 17944  var CsvModule = sqlite3_module{ // iVersion
 17945  	FxCreate:     0, // xCreate
 17946  	FxConnect:    0, // xConnect
 17947  	FxBestIndex:  0, // xBestIndex
 17948  	FxDisconnect: 0, // xDisconnect
 17949  	FxDestroy:    0, // xDestroy
 17950  	FxOpen:       0, // xOpen - open a cursor
 17951  	FxClose:      0, // xClose - close a cursor
 17952  	FxFilter:     0, // xFilter - configure scan constraints
 17953  	FxNext:       0, // xNext - advance a cursor
 17954  	FxEof:        0, // xEof - check for end of scan
 17955  	FxColumn:     0, // xColumn - read data
 17956  	FxRowid:      0, // xRename
 17957  } /* csv.c:872:23 */
 17958  
 17959  // For virtual table testing, make a version of the CSV virtual table
 17960  // available that has an xUpdate function.  But the xUpdate always returns
 17961  // SQLITE_READONLY since the CSV file is not really writable.
 17962  func csvtabUpdate(tls *libc.TLS, p uintptr, n int32, v uintptr, x uintptr) int32 { /* csv.c:901:12: */
 17963  	return SQLITE_READONLY
 17964  }
 17965  
 17966  var CsvModuleFauxWrite = sqlite3_module{ // iVersion
 17967  	FxCreate:     0, // xCreate
 17968  	FxConnect:    0, // xConnect
 17969  	FxBestIndex:  0, // xBestIndex
 17970  	FxDisconnect: 0, // xDisconnect
 17971  	FxDestroy:    0, // xDestroy
 17972  	FxOpen:       0, // xOpen - open a cursor
 17973  	FxClose:      0, // xClose - close a cursor
 17974  	FxFilter:     0, // xFilter - configure scan constraints
 17975  	FxNext:       0, // xNext - advance a cursor
 17976  	FxEof:        0, // xEof - check for end of scan
 17977  	FxColumn:     0, // xColumn - read data
 17978  	FxRowid:      0, // xRowid - read data
 17979  	FxUpdate:     0, // xRename
 17980  } /* csv.c:904:23 */
 17981  
 17982  // This routine is called when the extension is loaded.  The new
 17983  // CSV virtual table module is registered with the calling database
 17984  // connection.
 17985  func sqlite3_csv_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* csv.c:939:5: */
 17986  	var rc int32
 17987  	_ = pApi
 17988  
 17989  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4676 /* "csv" */, uintptr(unsafe.Pointer(&CsvModule)), uintptr(0))
 17990  	if rc == SQLITE_OK {
 17991  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4680 /* "csv_wr" */, uintptr(unsafe.Pointer(&CsvModuleFauxWrite)), uintptr(0))
 17992  	}
 17993  	return rc
 17994  }
 17995  
 17996  // Mark a function parameter as unused, to suppress nuisance compiler
 17997  // warnings.
 17998  
 17999  // A decimal object
 18000  type Decimal1 = struct {
 18001  	Fsign   int8
 18002  	Foom    int8
 18003  	FisNull int8
 18004  	FisInit int8
 18005  	FnDigit int32
 18006  	FnFrac  int32
 18007  	_       [4]byte
 18008  	Fa      uintptr
 18009  } /* decimal.c:32:9 */
 18010  
 18011  // Mark a function parameter as unused, to suppress nuisance compiler
 18012  // warnings.
 18013  
 18014  // A decimal object
 18015  type Decimal = Decimal1 /* decimal.c:32:24 */
 18016  
 18017  // Release memory held by a Decimal, but do not free the object itself.
 18018  func decimal_clear(tls *libc.TLS, p uintptr) { /* decimal.c:46:13: */
 18019  	sqlite3.Xsqlite3_free(tls, (*Decimal)(unsafe.Pointer(p)).Fa)
 18020  }
 18021  
 18022  // Destroy a Decimal object
 18023  func decimal_free(tls *libc.TLS, p uintptr) { /* decimal.c:53:13: */
 18024  	if p != 0 {
 18025  		decimal_clear(tls, p)
 18026  		sqlite3.Xsqlite3_free(tls, p)
 18027  	}
 18028  }
 18029  
 18030  // Allocate a new Decimal object.  Initialize it to the number given
 18031  // by the input string.
 18032  func decimal_new(tls *libc.TLS, pCtx uintptr, pIn uintptr, nAlt int32, zAlt uintptr) uintptr { /* decimal.c:64:16: */
 18033  	var p uintptr
 18034  	var n int32
 18035  	var i int32
 18036  	var zIn uintptr
 18037  	var iExp int32
 18038  	var j int32
 18039  	var neg int32
 18040  	var c int8
 18041  	var nExtra int32
 18042  	iExp = 0
 18043  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Decimal{})))
 18044  	if !(p == uintptr(0)) {
 18045  		goto __1
 18046  	}
 18047  	goto new_no_mem
 18048  __1:
 18049  	;
 18050  	(*Decimal)(unsafe.Pointer(p)).Fsign = int8(0)
 18051  	(*Decimal)(unsafe.Pointer(p)).Foom = int8(0)
 18052  	(*Decimal)(unsafe.Pointer(p)).FisInit = int8(1)
 18053  	(*Decimal)(unsafe.Pointer(p)).FisNull = int8(0)
 18054  	(*Decimal)(unsafe.Pointer(p)).FnDigit = 0
 18055  	(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 18056  	if !(zAlt != 0) {
 18057  		goto __2
 18058  	}
 18059  	n = nAlt
 18060  	zIn = zAlt
 18061  	goto __3
 18062  __2:
 18063  	if !(sqlite3.Xsqlite3_value_type(tls, pIn) == SQLITE_NULL) {
 18064  		goto __4
 18065  	}
 18066  	(*Decimal)(unsafe.Pointer(p)).Fa = uintptr(0)
 18067  	(*Decimal)(unsafe.Pointer(p)).FisNull = int8(1)
 18068  	return p
 18069  __4:
 18070  	;
 18071  	n = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 18072  	zIn = sqlite3.Xsqlite3_value_text(tls, pIn)
 18073  __3:
 18074  	;
 18075  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_malloc64(tls, (uint64(n + 1)))
 18076  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 18077  		goto __5
 18078  	}
 18079  	goto new_no_mem
 18080  __5:
 18081  	;
 18082  	i = 0
 18083  __6:
 18084  	if !(__sbistype(tls, int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))), uint64(X_CTYPE_S)) != 0) {
 18085  		goto __8
 18086  	}
 18087  	goto __7
 18088  __7:
 18089  	i++
 18090  	goto __6
 18091  	goto __8
 18092  __8:
 18093  	;
 18094  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '-') {
 18095  		goto __9
 18096  	}
 18097  	(*Decimal)(unsafe.Pointer(p)).Fsign = int8(1)
 18098  	i++
 18099  	goto __10
 18100  __9:
 18101  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '+') {
 18102  		goto __11
 18103  	}
 18104  	i++
 18105  __11:
 18106  	;
 18107  __10:
 18108  	;
 18109  __12:
 18110  	if !((i < n) && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '0')) {
 18111  		goto __13
 18112  	}
 18113  	i++
 18114  	goto __12
 18115  __13:
 18116  	;
 18117  __14:
 18118  	if !(i < n) {
 18119  		goto __15
 18120  	}
 18121  	c = int8(*(*uint8)(unsafe.Pointer(zIn + uintptr(i))))
 18122  	if !((int32(c) >= '0') && (int32(c) <= '9')) {
 18123  		goto __16
 18124  	}
 18125  	*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(libc.PostIncInt32(&(*Decimal)(unsafe.Pointer(p)).FnDigit, 1)))) = (int8(int32(c) - '0'))
 18126  	goto __17
 18127  __16:
 18128  	if !(int32(c) == '.') {
 18129  		goto __18
 18130  	}
 18131  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit + 1)
 18132  	goto __19
 18133  __18:
 18134  	if !((int32(c) == 'e') || (int32(c) == 'E')) {
 18135  		goto __20
 18136  	}
 18137  	j = (i + 1)
 18138  	neg = 0
 18139  	if !(j >= n) {
 18140  		goto __21
 18141  	}
 18142  	goto __15
 18143  __21:
 18144  	;
 18145  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) == '-') {
 18146  		goto __22
 18147  	}
 18148  	neg = 1
 18149  	j++
 18150  	goto __23
 18151  __22:
 18152  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) == '+') {
 18153  		goto __24
 18154  	}
 18155  	j++
 18156  __24:
 18157  	;
 18158  __23:
 18159  	;
 18160  __25:
 18161  	if !((j < n) && (iExp < 1000000)) {
 18162  		goto __26
 18163  	}
 18164  	if !((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) >= '0') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) <= '9')) {
 18165  		goto __27
 18166  	}
 18167  	iExp = (((iExp * 10) + int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j))))) - '0')
 18168  __27:
 18169  	;
 18170  	j++
 18171  	goto __25
 18172  __26:
 18173  	;
 18174  	if !(neg != 0) {
 18175  		goto __28
 18176  	}
 18177  	iExp = -iExp
 18178  __28:
 18179  	;
 18180  	goto __15
 18181  __20:
 18182  	;
 18183  __19:
 18184  	;
 18185  __17:
 18186  	;
 18187  	i++
 18188  	goto __14
 18189  __15:
 18190  	;
 18191  	if !((*Decimal)(unsafe.Pointer(p)).FnFrac != 0) {
 18192  		goto __29
 18193  	}
 18194  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit - ((*Decimal)(unsafe.Pointer(p)).FnFrac - 1))
 18195  __29:
 18196  	;
 18197  	if !(iExp > 0) {
 18198  		goto __30
 18199  	}
 18200  	if !((*Decimal)(unsafe.Pointer(p)).FnFrac > 0) {
 18201  		goto __32
 18202  	}
 18203  	if !(iExp <= (*Decimal)(unsafe.Pointer(p)).FnFrac) {
 18204  		goto __33
 18205  	}
 18206  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) -= (iExp)
 18207  	iExp = 0
 18208  	goto __34
 18209  __33:
 18210  	iExp = iExp - ((*Decimal)(unsafe.Pointer(p)).FnFrac)
 18211  	(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 18212  __34:
 18213  	;
 18214  __32:
 18215  	;
 18216  	if !(iExp > 0) {
 18217  		goto __35
 18218  	}
 18219  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(((*Decimal)(unsafe.Pointer(p)).FnDigit + iExp) + 1)))
 18220  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 18221  		goto __36
 18222  	}
 18223  	goto new_no_mem
 18224  __36:
 18225  	;
 18226  	libc.Xmemset(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr((*Decimal)(unsafe.Pointer(p)).FnDigit)), 0, uint64(iExp))
 18227  	*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (iExp)
 18228  __35:
 18229  	;
 18230  	goto __31
 18231  __30:
 18232  	if !(iExp < 0) {
 18233  		goto __37
 18234  	}
 18235  	iExp = -iExp
 18236  	nExtra = (((*Decimal)(unsafe.Pointer(p)).FnDigit - (*Decimal)(unsafe.Pointer(p)).FnFrac) - 1)
 18237  	if !(nExtra != 0) {
 18238  		goto __38
 18239  	}
 18240  	if !(nExtra >= iExp) {
 18241  		goto __39
 18242  	}
 18243  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (iExp)
 18244  	iExp = 0
 18245  	goto __40
 18246  __39:
 18247  	iExp = iExp - (nExtra)
 18248  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit - 1)
 18249  __40:
 18250  	;
 18251  __38:
 18252  	;
 18253  	if !(iExp > 0) {
 18254  		goto __41
 18255  	}
 18256  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(((*Decimal)(unsafe.Pointer(p)).FnDigit + iExp) + 1)))
 18257  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 18258  		goto __42
 18259  	}
 18260  	goto new_no_mem
 18261  __42:
 18262  	;
 18263  	libc.Xmemmove(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(iExp)), (*Decimal)(unsafe.Pointer(p)).Fa, uint64((*Decimal)(unsafe.Pointer(p)).FnDigit))
 18264  	libc.Xmemset(tls, (*Decimal)(unsafe.Pointer(p)).Fa, 0, uint64(iExp))
 18265  	*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (iExp)
 18266  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (iExp)
 18267  __41:
 18268  	;
 18269  __37:
 18270  	;
 18271  __31:
 18272  	;
 18273  	return p
 18274  
 18275  new_no_mem:
 18276  	if !(pCtx != 0) {
 18277  		goto __43
 18278  	}
 18279  	sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 18280  __43:
 18281  	;
 18282  	sqlite3.Xsqlite3_free(tls, p)
 18283  	return uintptr(0)
 18284  }
 18285  
 18286  // Make the given Decimal the result.
 18287  func decimal_result(tls *libc.TLS, pCtx uintptr, p uintptr) { /* decimal.c:183:13: */
 18288  	var z uintptr
 18289  	var i int32
 18290  	var j int32
 18291  	var n int32
 18292  	if (p == uintptr(0)) || ((*Decimal)(unsafe.Pointer(p)).Foom != 0) {
 18293  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 18294  		return
 18295  	}
 18296  	if (*Decimal)(unsafe.Pointer(p)).FisNull != 0 {
 18297  		sqlite3.Xsqlite3_result_null(tls, pCtx)
 18298  		return
 18299  	}
 18300  	z = sqlite3.Xsqlite3_malloc(tls, ((*Decimal)(unsafe.Pointer(p)).FnDigit + 4))
 18301  	if z == uintptr(0) {
 18302  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 18303  		return
 18304  	}
 18305  	i = 0
 18306  	if ((*Decimal)(unsafe.Pointer(p)).FnDigit == 0) || (((*Decimal)(unsafe.Pointer(p)).FnDigit == 1) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa))) == 0)) {
 18307  		(*Decimal)(unsafe.Pointer(p)).Fsign = int8(0)
 18308  	}
 18309  	if (*Decimal)(unsafe.Pointer(p)).Fsign != 0 {
 18310  		*(*int8)(unsafe.Pointer(z)) = int8('-')
 18311  		i = 1
 18312  	}
 18313  	n = ((*Decimal)(unsafe.Pointer(p)).FnDigit - (*Decimal)(unsafe.Pointer(p)).FnFrac)
 18314  	if n <= 0 {
 18315  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('0')
 18316  	}
 18317  	j = 0
 18318  	for (n > 1) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) == 0) {
 18319  		j++
 18320  		n--
 18321  	}
 18322  	for n > 0 {
 18323  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = (int8(int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) + '0'))
 18324  		j++
 18325  		n--
 18326  	}
 18327  	if (*Decimal)(unsafe.Pointer(p)).FnFrac != 0 {
 18328  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('.')
 18329  		for ok := true; ok; ok = (j < (*Decimal)(unsafe.Pointer(p)).FnDigit) {
 18330  			*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = (int8(int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) + '0'))
 18331  			j++
 18332  		}
 18333  	}
 18334  	*(*int8)(unsafe.Pointer(z + uintptr(i))) = int8(0)
 18335  	sqlite3.Xsqlite3_result_text(tls, pCtx, z, i, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 18336  }
 18337  
 18338  // SQL Function:   decimal(X)
 18339  //
 18340  // Convert input X into decimal and then back into text
 18341  func decimalFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:238:13: */
 18342  	var p uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18343  	_ = argc
 18344  	decimal_result(tls, context, p)
 18345  	decimal_free(tls, p)
 18346  }
 18347  
 18348  // Compare to Decimal objects.  Return negative, 0, or positive if the
 18349  // first object is less than, equal to, or greater than the second.
 18350  //
 18351  // Preconditions for this routine:
 18352  //
 18353  //    pA!=0
 18354  //    pA->isNull==0
 18355  //    pB!=0
 18356  //    pB->isNull==0
 18357  func decimal_cmp(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* decimal.c:260:12: */
 18358  	var nASig int32
 18359  	var nBSig int32
 18360  	var rc int32
 18361  	var n int32
 18362  	if int32((*Decimal)(unsafe.Pointer(pA)).Fsign) != int32((*Decimal)(unsafe.Pointer(pB)).Fsign) {
 18363  		if (*Decimal)(unsafe.Pointer(pA)).Fsign != 0 {
 18364  			return -1
 18365  		}
 18366  		return +1
 18367  	}
 18368  	if (*Decimal)(unsafe.Pointer(pA)).Fsign != 0 {
 18369  		var pTemp uintptr = pA
 18370  		pA = pB
 18371  		pB = pTemp
 18372  	}
 18373  	nASig = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pA)).FnFrac)
 18374  	nBSig = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac)
 18375  	if nASig != nBSig {
 18376  		return (nASig - nBSig)
 18377  	}
 18378  	n = (*Decimal)(unsafe.Pointer(pA)).FnDigit
 18379  	if n > (*Decimal)(unsafe.Pointer(pB)).FnDigit {
 18380  		n = (*Decimal)(unsafe.Pointer(pB)).FnDigit
 18381  	}
 18382  	rc = libc.Xmemcmp(tls, (*Decimal)(unsafe.Pointer(pA)).Fa, (*Decimal)(unsafe.Pointer(pB)).Fa, uint64(n))
 18383  	if rc == 0 {
 18384  		rc = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnDigit)
 18385  	}
 18386  	return rc
 18387  }
 18388  
 18389  // SQL Function:   decimal_cmp(X, Y)
 18390  //
 18391  // Return negative, zero, or positive if X is less then, equal to, or
 18392  // greater than Y.
 18393  func decimalCmpFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:290:13: */
 18394  	var pA uintptr
 18395  	var pB uintptr
 18396  	var rc int32
 18397  	pA = uintptr(0)
 18398  	pB = uintptr(0)
 18399  
 18400  	_ = argc
 18401  	pA = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18402  	if !((pA == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0)) {
 18403  		goto __1
 18404  	}
 18405  	goto cmp_done
 18406  __1:
 18407  	;
 18408  	pB = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), 0, uintptr(0))
 18409  	if !((pB == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0)) {
 18410  		goto __2
 18411  	}
 18412  	goto cmp_done
 18413  __2:
 18414  	;
 18415  	rc = decimal_cmp(tls, pA, pB)
 18416  	if !(rc < 0) {
 18417  		goto __3
 18418  	}
 18419  	rc = -1
 18420  	goto __4
 18421  __3:
 18422  	if !(rc > 0) {
 18423  		goto __5
 18424  	}
 18425  	rc = +1
 18426  __5:
 18427  	;
 18428  __4:
 18429  	;
 18430  	sqlite3.Xsqlite3_result_int(tls, context, rc)
 18431  cmp_done:
 18432  	decimal_free(tls, pA)
 18433  	decimal_free(tls, pB)
 18434  }
 18435  
 18436  // Expand the Decimal so that it has a least nDigit digits and nFrac
 18437  // digits to the right of the decimal point.
 18438  func decimal_expand(tls *libc.TLS, p uintptr, nDigit int32, nFrac int32) { /* decimal.c:316:13: */
 18439  	var nAddSig int32
 18440  	var nAddFrac int32
 18441  	if p == uintptr(0) {
 18442  		return
 18443  	}
 18444  	nAddFrac = (nFrac - (*Decimal)(unsafe.Pointer(p)).FnFrac)
 18445  	nAddSig = ((nDigit - (*Decimal)(unsafe.Pointer(p)).FnDigit) - nAddFrac)
 18446  	if (nAddFrac == 0) && (nAddSig == 0) {
 18447  		return
 18448  	}
 18449  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(nDigit + 1)))
 18450  	if (*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0) {
 18451  		(*Decimal)(unsafe.Pointer(p)).Foom = int8(1)
 18452  		return
 18453  	}
 18454  	if nAddSig != 0 {
 18455  		libc.Xmemmove(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(nAddSig)), (*Decimal)(unsafe.Pointer(p)).Fa, uint64((*Decimal)(unsafe.Pointer(p)).FnDigit))
 18456  		libc.Xmemset(tls, (*Decimal)(unsafe.Pointer(p)).Fa, 0, uint64(nAddSig))
 18457  		*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (nAddSig)
 18458  	}
 18459  	if nAddFrac != 0 {
 18460  		libc.Xmemset(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr((*Decimal)(unsafe.Pointer(p)).FnDigit)), 0, uint64(nAddFrac))
 18461  		*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (nAddFrac)
 18462  		*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (nAddFrac)
 18463  	}
 18464  }
 18465  
 18466  // Add the value pB into pA.
 18467  //
 18468  // Both pA and pB might become denormalized by this routine.
 18469  func decimal_add(tls *libc.TLS, pA uintptr, pB uintptr) { /* decimal.c:345:13: */
 18470  	var nSig int32
 18471  	var nFrac int32
 18472  	var nDigit int32
 18473  	var i int32
 18474  	var rc int32
 18475  	if pA == uintptr(0) {
 18476  		return
 18477  	}
 18478  	if (((*Decimal)(unsafe.Pointer(pA)).Foom != 0) || (pB == uintptr(0))) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0) {
 18479  		(*Decimal)(unsafe.Pointer(pA)).Foom = int8(1)
 18480  		return
 18481  	}
 18482  	if ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0) {
 18483  		(*Decimal)(unsafe.Pointer(pA)).FisNull = int8(1)
 18484  		return
 18485  	}
 18486  	nSig = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pA)).FnFrac)
 18487  	if (nSig != 0) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa))) == 0) {
 18488  		nSig--
 18489  	}
 18490  	if nSig < ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac) {
 18491  		nSig = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac)
 18492  	}
 18493  	nFrac = (*Decimal)(unsafe.Pointer(pA)).FnFrac
 18494  	if nFrac < (*Decimal)(unsafe.Pointer(pB)).FnFrac {
 18495  		nFrac = (*Decimal)(unsafe.Pointer(pB)).FnFrac
 18496  	}
 18497  	nDigit = ((nSig + nFrac) + 1)
 18498  	decimal_expand(tls, pA, nDigit, nFrac)
 18499  	decimal_expand(tls, pB, nDigit, nFrac)
 18500  	if ((*Decimal)(unsafe.Pointer(pA)).Foom != 0) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0) {
 18501  		(*Decimal)(unsafe.Pointer(pA)).Foom = int8(1)
 18502  	} else {
 18503  		if int32((*Decimal)(unsafe.Pointer(pA)).Fsign) == int32((*Decimal)(unsafe.Pointer(pB)).Fsign) {
 18504  			var carry int32 = 0
 18505  			for i = (nDigit - 1); i >= 0; i-- {
 18506  				var x int32 = ((int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i)))) + int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pB)).Fa + uintptr(i))))) + carry)
 18507  				if x >= 10 {
 18508  					carry = 1
 18509  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = (int8(x - 10))
 18510  				} else {
 18511  					carry = 0
 18512  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = int8(x)
 18513  				}
 18514  			}
 18515  		} else {
 18516  			var aA uintptr
 18517  			var aB uintptr
 18518  			var borrow int32 = 0
 18519  			rc = libc.Xmemcmp(tls, (*Decimal)(unsafe.Pointer(pA)).Fa, (*Decimal)(unsafe.Pointer(pB)).Fa, uint64(nDigit))
 18520  			if rc < 0 {
 18521  				aA = (*Decimal)(unsafe.Pointer(pB)).Fa
 18522  				aB = (*Decimal)(unsafe.Pointer(pA)).Fa
 18523  				(*Decimal)(unsafe.Pointer(pA)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pA)).Fsign != 0))
 18524  			} else {
 18525  				aA = (*Decimal)(unsafe.Pointer(pA)).Fa
 18526  				aB = (*Decimal)(unsafe.Pointer(pB)).Fa
 18527  			}
 18528  			for i = (nDigit - 1); i >= 0; i-- {
 18529  				var x int32 = ((int32(*(*int8)(unsafe.Pointer(aA + uintptr(i)))) - int32(*(*int8)(unsafe.Pointer(aB + uintptr(i))))) - borrow)
 18530  				if x < 0 {
 18531  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = (int8(x + 10))
 18532  					borrow = 1
 18533  				} else {
 18534  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = int8(x)
 18535  					borrow = 0
 18536  				}
 18537  			}
 18538  		}
 18539  	}
 18540  }
 18541  
 18542  // Compare text in decimal order.
 18543  func decimalCollFunc(tls *libc.TLS, notUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* decimal.c:413:12: */
 18544  	var zA uintptr = pKey1
 18545  	var zB uintptr = pKey2
 18546  	var pA uintptr = decimal_new(tls, uintptr(0), uintptr(0), nKey1, zA)
 18547  	var pB uintptr = decimal_new(tls, uintptr(0), uintptr(0), nKey2, zB)
 18548  	var rc int32
 18549  	_ = notUsed
 18550  	if (pA == uintptr(0)) || (pB == uintptr(0)) {
 18551  		rc = 0
 18552  	} else {
 18553  		rc = decimal_cmp(tls, pA, pB)
 18554  	}
 18555  	decimal_free(tls, pA)
 18556  	decimal_free(tls, pB)
 18557  	return rc
 18558  }
 18559  
 18560  // SQL Function:   decimal_add(X, Y)
 18561  //                 decimal_sub(X, Y)
 18562  //
 18563  // Return the sum or difference of X and Y.
 18564  func decimalAddFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:441:13: */
 18565  	var pA uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18566  	var pB uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), 0, uintptr(0))
 18567  	_ = argc
 18568  	decimal_add(tls, pA, pB)
 18569  	decimal_result(tls, context, pA)
 18570  	decimal_free(tls, pA)
 18571  	decimal_free(tls, pB)
 18572  }
 18573  
 18574  func decimalSubFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:454:13: */
 18575  	var pA uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18576  	var pB uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), 0, uintptr(0))
 18577  	_ = argc
 18578  	if pB != 0 {
 18579  		(*Decimal)(unsafe.Pointer(pB)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pB)).Fsign != 0))
 18580  		decimal_add(tls, pA, pB)
 18581  		decimal_result(tls, context, pA)
 18582  	}
 18583  	decimal_free(tls, pA)
 18584  	decimal_free(tls, pB)
 18585  }
 18586  
 18587  // Aggregate funcion:   decimal_sum(X)
 18588  //
 18589  // Works like sum() except that it uses decimal arithmetic for unlimited
 18590  // precision.
 18591  func decimalSumStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:476:13: */
 18592  	var p uintptr
 18593  	var pArg uintptr
 18594  	_ = argc
 18595  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(Decimal{})))
 18596  	if p == uintptr(0) {
 18597  		return
 18598  	}
 18599  	if !(int32((*Decimal)(unsafe.Pointer(p)).FisInit) != 0) {
 18600  		(*Decimal)(unsafe.Pointer(p)).FisInit = int8(1)
 18601  		(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_malloc(tls, 2)
 18602  		if (*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0) {
 18603  			(*Decimal)(unsafe.Pointer(p)).Foom = int8(1)
 18604  		} else {
 18605  			*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa)) = int8(0)
 18606  		}
 18607  		(*Decimal)(unsafe.Pointer(p)).FnDigit = 1
 18608  		(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 18609  	}
 18610  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 18611  		return
 18612  	}
 18613  	pArg = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18614  	decimal_add(tls, p, pArg)
 18615  	decimal_free(tls, pArg)
 18616  }
 18617  
 18618  func decimalSumInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:502:13: */
 18619  	var p uintptr
 18620  	var pArg uintptr
 18621  	_ = argc
 18622  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(Decimal{})))
 18623  	if p == uintptr(0) {
 18624  		return
 18625  	}
 18626  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 18627  		return
 18628  	}
 18629  	pArg = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18630  	if pArg != 0 {
 18631  		(*Decimal)(unsafe.Pointer(pArg)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pArg)).Fsign != 0))
 18632  	}
 18633  	decimal_add(tls, p, pArg)
 18634  	decimal_free(tls, pArg)
 18635  }
 18636  
 18637  func decimalSumValue(tls *libc.TLS, context uintptr) { /* decimal.c:518:13: */
 18638  	var p uintptr = sqlite3.Xsqlite3_aggregate_context(tls, context, 0)
 18639  	if p == uintptr(0) {
 18640  		return
 18641  	}
 18642  	decimal_result(tls, context, p)
 18643  }
 18644  
 18645  func decimalSumFinalize(tls *libc.TLS, context uintptr) { /* decimal.c:523:13: */
 18646  	var p uintptr = sqlite3.Xsqlite3_aggregate_context(tls, context, 0)
 18647  	if p == uintptr(0) {
 18648  		return
 18649  	}
 18650  	decimal_result(tls, context, p)
 18651  	decimal_clear(tls, p)
 18652  }
 18653  
 18654  // SQL Function:   decimal_mul(X, Y)
 18655  //
 18656  // Return the product of X and Y.
 18657  //
 18658  // All significant digits after the decimal point are retained.
 18659  // Trailing zeros after the decimal point are omitted as long as
 18660  // the number of digits after the decimal point is no less than
 18661  // either the number of digits in either input.
 18662  func decimalMulFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:540:13: */
 18663  	var pA uintptr
 18664  	var pB uintptr
 18665  	var acc uintptr
 18666  	var i int32
 18667  	var j int32
 18668  	var k int32
 18669  	var minFrac int32
 18670  	var f int8
 18671  	var carry int32
 18672  	var x int32
 18673  	pA = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 18674  	pB = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*8)), 0, uintptr(0))
 18675  	acc = uintptr(0)
 18676  	_ = argc
 18677  	if !((((((pA == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pA)).Foom != 0)) || ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0)) ||
 18678  		(pB == uintptr(0))) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0)) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0)) {
 18679  		goto __1
 18680  	}
 18681  	goto mul_end
 18682  __1:
 18683  	;
 18684  	acc = sqlite3.Xsqlite3_malloc64(tls, (uint64(((*Decimal)(unsafe.Pointer(pA)).FnDigit + (*Decimal)(unsafe.Pointer(pB)).FnDigit) + 2)))
 18685  	if !(acc == uintptr(0)) {
 18686  		goto __2
 18687  	}
 18688  	sqlite3.Xsqlite3_result_error_nomem(tls, context)
 18689  	goto mul_end
 18690  __2:
 18691  	;
 18692  	libc.Xmemset(tls, acc, 0, (uint64(((*Decimal)(unsafe.Pointer(pA)).FnDigit + (*Decimal)(unsafe.Pointer(pB)).FnDigit) + 2)))
 18693  	minFrac = (*Decimal)(unsafe.Pointer(pA)).FnFrac
 18694  	if !((*Decimal)(unsafe.Pointer(pB)).FnFrac < minFrac) {
 18695  		goto __3
 18696  	}
 18697  	minFrac = (*Decimal)(unsafe.Pointer(pB)).FnFrac
 18698  __3:
 18699  	;
 18700  	i = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - 1)
 18701  __4:
 18702  	if !(i >= 0) {
 18703  		goto __6
 18704  	}
 18705  	f = *(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i)))
 18706  	carry = 0
 18707  	j = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - 1)
 18708  	k = ((i + j) + 3)
 18709  __7:
 18710  	if !(j >= 0) {
 18711  		goto __9
 18712  	}
 18713  	x = ((int32(*(*int8)(unsafe.Pointer(acc + uintptr(k)))) + (int32(f) * int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pB)).Fa + uintptr(j)))))) + carry)
 18714  	*(*int8)(unsafe.Pointer(acc + uintptr(k))) = (int8(x % 10))
 18715  	carry = (x / 10)
 18716  	goto __8
 18717  __8:
 18718  	j--
 18719  	k--
 18720  	goto __7
 18721  	goto __9
 18722  __9:
 18723  	;
 18724  	x = (int32(*(*int8)(unsafe.Pointer(acc + uintptr(k)))) + carry)
 18725  	*(*int8)(unsafe.Pointer(acc + uintptr(k))) = (int8(x % 10))
 18726  	*(*int8)(unsafe.Pointer(acc + uintptr((k - 1)))) += int8((x / 10))
 18727  	goto __5
 18728  __5:
 18729  	i--
 18730  	goto __4
 18731  	goto __6
 18732  __6:
 18733  	;
 18734  	sqlite3.Xsqlite3_free(tls, (*Decimal)(unsafe.Pointer(pA)).Fa)
 18735  	(*Decimal)(unsafe.Pointer(pA)).Fa = acc
 18736  	acc = uintptr(0)
 18737  	*(*int32)(unsafe.Pointer(pA + 4 /* &.nDigit */)) += ((*Decimal)(unsafe.Pointer(pB)).FnDigit + 2)
 18738  	*(*int32)(unsafe.Pointer(pA + 8 /* &.nFrac */)) += ((*Decimal)(unsafe.Pointer(pB)).FnFrac)
 18739  	*(*int8)(unsafe.Pointer(pA /* &.sign */)) ^= int8((int32((*Decimal)(unsafe.Pointer(pB)).Fsign)))
 18740  __10:
 18741  	if !(((*Decimal)(unsafe.Pointer(pA)).FnFrac > minFrac) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(((*Decimal)(unsafe.Pointer(pA)).FnDigit - 1))))) == 0)) {
 18742  		goto __11
 18743  	}
 18744  	(*Decimal)(unsafe.Pointer(pA)).FnFrac--
 18745  	(*Decimal)(unsafe.Pointer(pA)).FnDigit--
 18746  	goto __10
 18747  __11:
 18748  	;
 18749  	decimal_result(tls, context, pA)
 18750  
 18751  mul_end:
 18752  	sqlite3.Xsqlite3_free(tls, acc)
 18753  	decimal_free(tls, pA)
 18754  	decimal_free(tls, pB)
 18755  }
 18756  
 18757  func sqlite3_decimal_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* decimal.c:597:5: */
 18758  	var rc int32 = SQLITE_OK
 18759  	var i uint32
 18760  	_ = pzErrMsg // Unused parameter
 18761  
 18762  	_ = pApi
 18763  
 18764  	for i = uint32(0); (uint64(i) < (uint64(unsafe.Sizeof(aFunc)) / uint64(unsafe.Sizeof(struct {
 18765  		FzFuncName uintptr
 18766  		FnArg      int32
 18767  		_          [4]byte
 18768  		FxFunc     uintptr
 18769  	}{})))) && (rc == SQLITE_OK); i++ {
 18770  		rc = sqlite3.Xsqlite3_create_function(tls, db, aFunc[i].FzFuncName, aFunc[i].FnArg,
 18771  			((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC),
 18772  			uintptr(0), aFunc[i].FxFunc, uintptr(0), uintptr(0))
 18773  	}
 18774  	if rc == SQLITE_OK {
 18775  		rc = sqlite3.Xsqlite3_create_window_function(tls, db, ts+4687 /* "decimal_sum" */, 1,
 18776  			((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC), uintptr(0),
 18777  			*(*uintptr)(unsafe.Pointer(&struct {
 18778  				f func(*libc.TLS, uintptr, int32, uintptr)
 18779  			}{decimalSumStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{decimalSumFinalize})),
 18780  			*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{decimalSumValue})), *(*uintptr)(unsafe.Pointer(&struct {
 18781  				f func(*libc.TLS, uintptr, int32, uintptr)
 18782  			}{decimalSumInverse})), uintptr(0))
 18783  	}
 18784  	if rc == SQLITE_OK {
 18785  		rc = sqlite3.Xsqlite3_create_collation(tls, db, ts+4699 /* "decimal" */, SQLITE_UTF8,
 18786  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 18787  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 18788  			}{decimalCollFunc})))
 18789  	}
 18790  	return rc
 18791  }
 18792  
 18793  var aFunc = [5]struct {
 18794  	FzFuncName uintptr
 18795  	FnArg      int32
 18796  	_          [4]byte
 18797  	FxFunc     uintptr
 18798  }{
 18799  	{FzFuncName: ts + 4699 /* "decimal" */, FnArg: 1, FxFunc: 0},
 18800  	{FzFuncName: ts + 4707 /* "decimal_cmp" */, FnArg: 2, FxFunc: 0},
 18801  	{FzFuncName: ts + 4719 /* "decimal_add" */, FnArg: 2, FxFunc: 0},
 18802  	{FzFuncName: ts + 4731 /* "decimal_sub" */, FnArg: 2, FxFunc: 0},
 18803  	{FzFuncName: ts + 4743 /* "decimal_mul" */, FnArg: 2, FxFunc: 0},
 18804  } /* decimal.c:607:5 */
 18805  
 18806  // Structure used to accumulate the output
 18807  type EvalResult = struct {
 18808  	Fz      uintptr
 18809  	FzSep   uintptr
 18810  	FszSep  int32
 18811  	_       [4]byte
 18812  	FnAlloc sqlite3_int64
 18813  	FnUsed  sqlite3_int64
 18814  } /* eval.c:23:1 */
 18815  
 18816  // Callback from sqlite_exec() for the eval() function.
 18817  func callback(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr, colnames uintptr) int32 { /* eval.c:34:12: */
 18818  	var p uintptr = pCtx
 18819  	var i int32
 18820  	if argv == uintptr(0) {
 18821  		return 0
 18822  	}
 18823  	for i = 0; i < argc; i++ {
 18824  		var z uintptr
 18825  		if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0 {
 18826  			z = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))
 18827  		} else {
 18828  			z = ts + 489 /* "" */
 18829  		}
 18830  		var sz size_t = libc.Xstrlen(tls, z)
 18831  		if (((sqlite3_int64(sz) + (*EvalResult)(unsafe.Pointer(p)).FnUsed) + sqlite3_int64((*EvalResult)(unsafe.Pointer(p)).FszSep)) + int64(1)) > (*EvalResult)(unsafe.Pointer(p)).FnAlloc {
 18832  			var zNew uintptr
 18833  			(*EvalResult)(unsafe.Pointer(p)).FnAlloc = (sqlite3_int64((((uint64((*EvalResult)(unsafe.Pointer(p)).FnAlloc * int64(2))) + uint64(sz)) + uint64((*EvalResult)(unsafe.Pointer(p)).FszSep)) + uint64(1)))
 18834  			// Using sqlite3_realloc64() would be better, but it is a recent
 18835  			// addition and will cause a segfault if loaded by an older version
 18836  			// of SQLite.
 18837  			if (*EvalResult)(unsafe.Pointer(p)).FnAlloc <= int64(0x7fffffff) {
 18838  				zNew = sqlite3.Xsqlite3_realloc64(tls, (*EvalResult)(unsafe.Pointer(p)).Fz, uint64((*EvalResult)(unsafe.Pointer(p)).FnAlloc))
 18839  			} else {
 18840  				zNew = uintptr(0)
 18841  			}
 18842  			if zNew == uintptr(0) {
 18843  				sqlite3.Xsqlite3_free(tls, (*EvalResult)(unsafe.Pointer(p)).Fz)
 18844  				libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(EvalResult{})))
 18845  				return 1
 18846  			}
 18847  			(*EvalResult)(unsafe.Pointer(p)).Fz = zNew
 18848  		}
 18849  		if (*EvalResult)(unsafe.Pointer(p)).FnUsed > int64(0) {
 18850  			libc.Xmemcpy(tls, ((*EvalResult)(unsafe.Pointer(p)).Fz + uintptr((*EvalResult)(unsafe.Pointer(p)).FnUsed)), (*EvalResult)(unsafe.Pointer(p)).FzSep, uint64((*EvalResult)(unsafe.Pointer(p)).FszSep))
 18851  			*(*sqlite3_int64)(unsafe.Pointer(p + 32 /* &.nUsed */)) += (sqlite3_int64((*EvalResult)(unsafe.Pointer(p)).FszSep))
 18852  		}
 18853  		libc.Xmemcpy(tls, ((*EvalResult)(unsafe.Pointer(p)).Fz + uintptr((*EvalResult)(unsafe.Pointer(p)).FnUsed)), z, sz)
 18854  		*(*sqlite3_int64)(unsafe.Pointer(p + 32 /* &.nUsed */)) += sqlite3_int64((uint64(sz)))
 18855  	}
 18856  	return 0
 18857  }
 18858  
 18859  // Implementation of the eval(X) and eval(X,Y) SQL functions.
 18860  //
 18861  // Evaluate the SQL text in X.  Return the results, using string
 18862  // Y as the separator.  If Y is omitted, use a single space character.
 18863  func sqlEvalFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* eval.c:71:13: */
 18864  	bp := tls.Alloc(48)
 18865  	defer tls.Free(48)
 18866  
 18867  	var zSql uintptr
 18868  	var db uintptr
 18869  	*(*uintptr)(unsafe.Pointer(bp + 40 /* zErr */)) = uintptr(0)
 18870  	var rc int32
 18871  	// var x EvalResult at bp, 40
 18872  
 18873  	libc.Xmemset(tls, bp /* &x */, 0, uint64(unsafe.Sizeof(EvalResult{})))
 18874  	(*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep = ts + 4755 /* " " */
 18875  	zSql = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 18876  	if zSql == uintptr(0) {
 18877  		return
 18878  	}
 18879  	if argc > 1 {
 18880  		(*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 18881  		if (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep == uintptr(0) {
 18882  			return
 18883  		}
 18884  	}
 18885  	(*EvalResult)(unsafe.Pointer(bp /* &x */)).FszSep = int32(libc.Xstrlen(tls, (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep))
 18886  	db = sqlite3.Xsqlite3_context_db_handle(tls, context)
 18887  	rc = sqlite3.Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct {
 18888  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 18889  	}{callback})), bp /* &x */, bp+40 /* &zErr */)
 18890  	if rc != SQLITE_OK {
 18891  		sqlite3.Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErr */)), -1)
 18892  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* zErr */)))
 18893  	} else if (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep == uintptr(0) {
 18894  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 18895  		sqlite3.Xsqlite3_free(tls, (*EvalResult)(unsafe.Pointer(bp /* &x */)).Fz)
 18896  	} else {
 18897  		sqlite3.Xsqlite3_result_text(tls, context, (*EvalResult)(unsafe.Pointer(bp /* &x */)).Fz, int32((*EvalResult)(unsafe.Pointer(bp /* &x */)).FnUsed), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 18898  	}
 18899  }
 18900  
 18901  func sqlite3_eval_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* eval.c:108:5: */
 18902  	var rc int32 = SQLITE_OK
 18903  	_ = pApi
 18904  
 18905  	_ = pzErrMsg // Unused parameter
 18906  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4757 /* "eval" */, 1,
 18907  		(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 18908  		*(*uintptr)(unsafe.Pointer(&struct {
 18909  			f func(*libc.TLS, uintptr, int32, uintptr)
 18910  		}{sqlEvalFunc})), uintptr(0), uintptr(0))
 18911  	if rc == SQLITE_OK {
 18912  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4757 /* "eval" */, 2,
 18913  			(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 18914  			*(*uintptr)(unsafe.Pointer(&struct {
 18915  				f func(*libc.TLS, uintptr, int32, uintptr)
 18916  			}{sqlEvalFunc})), uintptr(0), uintptr(0))
 18917  	}
 18918  	return rc
 18919  }
 18920  
 18921  // explain_vtab is a subclass of sqlite3_vtab which will
 18922  // serve as the underlying representation of a explain virtual table
 18923  type explain_vtab1 = struct {
 18924  	Fbase sqlite3_vtab
 18925  	Fdb   uintptr
 18926  } /* explain.c:38:9 */
 18927  
 18928  // explain_vtab is a subclass of sqlite3_vtab which will
 18929  // serve as the underlying representation of a explain virtual table
 18930  type explain_vtab = explain_vtab1 /* explain.c:38:29 */
 18931  
 18932  // explain_cursor is a subclass of sqlite3_vtab_cursor which will
 18933  // serve as the underlying representation of a cursor that scans
 18934  // over rows of the result from an EXPLAIN operation.
 18935  type explain_cursor1 = struct {
 18936  	Fbase     sqlite3_vtab_cursor
 18937  	Fdb       uintptr
 18938  	FzSql     uintptr
 18939  	FpExplain uintptr
 18940  	Frc       int32
 18941  	_         [4]byte
 18942  } /* explain.c:48:9 */
 18943  
 18944  // explain_cursor is a subclass of sqlite3_vtab_cursor which will
 18945  // serve as the underlying representation of a cursor that scans
 18946  // over rows of the result from an EXPLAIN operation.
 18947  type explain_cursor = explain_cursor1 /* explain.c:48:31 */
 18948  
 18949  // The explainConnect() method is invoked to create a new
 18950  // explain_vtab that describes the explain virtual table.
 18951  //
 18952  // Think of this routine as the constructor for explain_vtab objects.
 18953  //
 18954  // All this routine needs to do is:
 18955  //
 18956  //    (1) Allocate the explain_vtab object and initialize all fields.
 18957  //
 18958  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 18959  //        result set of queries against explain will look like.
 18960  func explainConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* explain.c:70:12: */
 18961  	var pNew uintptr
 18962  	var rc int32
 18963  
 18964  	// Column numbers
 18965  
 18966  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 18967  		ts+4762 /* "CREATE TABLE x(a..." */)
 18968  	if rc == SQLITE_OK {
 18969  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(explain_vtab{})))
 18970  		*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 18971  		if pNew == uintptr(0) {
 18972  			return SQLITE_NOMEM
 18973  		}
 18974  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(explain_vtab{})))
 18975  		(*explain_vtab)(unsafe.Pointer(pNew)).Fdb = db
 18976  	}
 18977  	return rc
 18978  }
 18979  
 18980  // This method is the destructor for explain_cursor objects.
 18981  func explainDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* explain.c:107:12: */
 18982  	sqlite3.Xsqlite3_free(tls, pVtab)
 18983  	return SQLITE_OK
 18984  }
 18985  
 18986  // Constructor for a new explain_cursor object.
 18987  func explainOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* explain.c:115:12: */
 18988  	var pCur uintptr
 18989  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(explain_cursor{})))
 18990  	if pCur == uintptr(0) {
 18991  		return SQLITE_NOMEM
 18992  	}
 18993  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(explain_cursor{})))
 18994  	(*explain_cursor)(unsafe.Pointer(pCur)).Fdb = (*explain_vtab)(unsafe.Pointer(p)).Fdb
 18995  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 18996  	return SQLITE_OK
 18997  }
 18998  
 18999  // Destructor for a explain_cursor.
 19000  func explainClose(tls *libc.TLS, cur uintptr) int32 { /* explain.c:128:12: */
 19001  	var pCur uintptr = cur
 19002  	sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 19003  	sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 19004  	sqlite3.Xsqlite3_free(tls, pCur)
 19005  	return SQLITE_OK
 19006  }
 19007  
 19008  // Advance a explain_cursor to its next row of output.
 19009  func explainNext(tls *libc.TLS, cur uintptr) int32 { /* explain.c:140:12: */
 19010  	var pCur uintptr = cur
 19011  	(*explain_cursor)(unsafe.Pointer(pCur)).Frc = sqlite3.Xsqlite3_step(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 19012  	if ((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_DONE) && ((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_ROW) {
 19013  		return (*explain_cursor)(unsafe.Pointer(pCur)).Frc
 19014  	}
 19015  	return SQLITE_OK
 19016  }
 19017  
 19018  // Return values of columns for the row at which the explain_cursor
 19019  // is currently pointing.
 19020  func explainColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* explain.c:151:12: */
 19021  	var pCur uintptr = cur
 19022  	if i == EXPLN_COLUMN_SQL {
 19023  		sqlite3.Xsqlite3_result_text(tls, ctx, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql, -1, libc.UintptrFromInt32(-1))
 19024  	} else {
 19025  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain, i))
 19026  	}
 19027  	return SQLITE_OK
 19028  }
 19029  
 19030  // Return the rowid for the current row.  In this implementation, the
 19031  // rowid is the same as the output value.
 19032  func explainRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* explain.c:169:12: */
 19033  	var pCur uintptr = cur
 19034  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain, 0)
 19035  	return SQLITE_OK
 19036  }
 19037  
 19038  // Return TRUE if the cursor has been moved off of the last
 19039  // row of output.
 19040  func explainEof(tls *libc.TLS, cur uintptr) int32 { /* explain.c:179:12: */
 19041  	var pCur uintptr = cur
 19042  	return (libc.Bool32((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_ROW))
 19043  }
 19044  
 19045  // This method is called to "rewind" the explain_cursor object back
 19046  // to the first row of output.  This method is always called at least
 19047  // once prior to any call to explainColumn() or explainRowid() or
 19048  // explainEof().
 19049  //
 19050  // The argv[0] is the SQL statement that is to be explained.
 19051  func explainFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* explain.c:192:12: */
 19052  	bp := tls.Alloc(16)
 19053  	defer tls.Free(16)
 19054  
 19055  	var pCur uintptr = pVtabCursor
 19056  	var zSql uintptr = uintptr(0)
 19057  	var rc int32
 19058  	sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 19059  	(*explain_cursor)(unsafe.Pointer(pCur)).FpExplain = uintptr(0)
 19060  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_TEXT {
 19061  		(*explain_cursor)(unsafe.Pointer(pCur)).Frc = SQLITE_DONE
 19062  		return SQLITE_OK
 19063  	}
 19064  	sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 19065  	(*explain_cursor)(unsafe.Pointer(pCur)).FzSql = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 19066  	if (*explain_cursor)(unsafe.Pointer(pCur)).FzSql != 0 {
 19067  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+4824 /* "EXPLAIN %s" */, libc.VaList(bp+8, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql))
 19068  	}
 19069  	if zSql == uintptr(0) {
 19070  		rc = SQLITE_NOMEM
 19071  	} else {
 19072  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*explain_cursor)(unsafe.Pointer(pCur)).Fdb, zSql, -1, (pCur + 24 /* &.pExplain */), uintptr(0))
 19073  		sqlite3.Xsqlite3_free(tls, zSql)
 19074  	}
 19075  	if rc != 0 {
 19076  		sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 19077  		(*explain_cursor)(unsafe.Pointer(pCur)).FpExplain = uintptr(0)
 19078  		sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 19079  		(*explain_cursor)(unsafe.Pointer(pCur)).FzSql = uintptr(0)
 19080  	} else {
 19081  		(*explain_cursor)(unsafe.Pointer(pCur)).Frc = sqlite3.Xsqlite3_step(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 19082  		if ((*explain_cursor)(unsafe.Pointer(pCur)).Frc == SQLITE_DONE) || ((*explain_cursor)(unsafe.Pointer(pCur)).Frc == SQLITE_ROW) {
 19083  			rc = SQLITE_OK
 19084  		} else {
 19085  			rc = (*explain_cursor)(unsafe.Pointer(pCur)).Frc
 19086  		}
 19087  	}
 19088  	return rc
 19089  }
 19090  
 19091  // SQLite will invoke this method one or more times while planning a query
 19092  // that uses the explain virtual table.  This routine needs to create
 19093  // a query plan for each invocation and compute an estimated cost for that
 19094  // plan.
 19095  func explainBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* explain.c:235:12: */
 19096  	var i int32            // Loop counter
 19097  	var idx int32 = -1     // Index of a usable == constraint against SQL
 19098  	var unusable int32 = 0 // True if there are unusable constraints on SQL
 19099  
 19100  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(500)
 19101  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 19102  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 19103  		if (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn != EXPLN_COLUMN_SQL {
 19104  			continue
 19105  		}
 19106  		if !(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) != 0) {
 19107  			unusable = 1
 19108  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 19109  			idx = i
 19110  		}
 19111  	}
 19112  	if idx >= 0 {
 19113  		// There exists a usable == constraint against the SQL column
 19114  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 19115  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 19116  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).FargvIndex = 1
 19117  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).Fomit = uint8(1)
 19118  	} else if unusable != 0 {
 19119  		// There are unusable constraints against the SQL column.  Do not allow
 19120  		// this plan to continue forward.
 19121  		return SQLITE_CONSTRAINT
 19122  	}
 19123  	return SQLITE_OK
 19124  }
 19125  
 19126  // This following structure defines all the methods for the
 19127  // explain virtual table.
 19128  var explainModule = sqlite3_module{ // xCreate
 19129  	FxConnect:    0, // xConnect
 19130  	FxBestIndex:  0, // xBestIndex
 19131  	FxDisconnect: 0, // xDestroy
 19132  	FxOpen:       0, // xOpen - open a cursor
 19133  	FxClose:      0, // xClose - close a cursor
 19134  	FxFilter:     0, // xFilter - configure scan constraints
 19135  	FxNext:       0, // xNext - advance a cursor
 19136  	FxEof:        0, // xEof - check for end of scan
 19137  	FxColumn:     0, // xColumn - read data
 19138  	FxRowid:      0, // xShadowName
 19139  } /* explain.c:271:23 */
 19140  
 19141  func sqlite3ExplainVtabInit(tls *libc.TLS, db uintptr) int32 { /* explain.c:300:5: */
 19142  	var rc int32 = SQLITE_OK
 19143  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4835 /* "explain" */, uintptr(unsafe.Pointer(&explainModule)), uintptr(0))
 19144  	return rc
 19145  }
 19146  
 19147  func sqlite3_explain_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* explain.c:311:5: */
 19148  	var rc int32 = SQLITE_OK
 19149  	_ = pApi
 19150  
 19151  	rc = sqlite3ExplainVtabInit(tls, db)
 19152  	return rc
 19153  }
 19154  
 19155  type pthread_once = struct {
 19156  	Fstate int32
 19157  	_      [4]byte
 19158  	Fmutex pthread_mutex_t
 19159  } /* _pthreadtypes.h:52:1 */
 19160  
 19161  // Primitive system data type definitions required by P1003.1c.
 19162  //
 19163  // Note that P1003.1c specifies that there are no defined comparison
 19164  // or assignment operators for the types pthread_attr_t, pthread_cond_t,
 19165  // pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
 19166  type pthread_t = uintptr             /* _pthreadtypes.h:67:26 */
 19167  type pthread_attr_t = uintptr        /* _pthreadtypes.h:70:30 */
 19168  type pthread_mutex_t = uintptr       /* _pthreadtypes.h:71:31 */
 19169  type pthread_mutexattr_t = uintptr   /* _pthreadtypes.h:72:35 */
 19170  type pthread_cond_t = uintptr        /* _pthreadtypes.h:73:30 */
 19171  type pthread_condattr_t = uintptr    /* _pthreadtypes.h:74:34 */
 19172  type pthread_key_t = int32           /* _pthreadtypes.h:75:20 */
 19173  type pthread_once_t = pthread_once   /* _pthreadtypes.h:76:30 */
 19174  type pthread_rwlock_t = uintptr      /* _pthreadtypes.h:77:32 */
 19175  type pthread_rwlockattr_t = uintptr  /* _pthreadtypes.h:78:35 */
 19176  type pthread_barrier_t = uintptr     /* _pthreadtypes.h:79:33 */
 19177  type pthread_barrierattr_t = uintptr /* _pthreadtypes.h:80:36 */
 19178  type pthread_spinlock_t = uintptr    /* _pthreadtypes.h:81:33 */
 19179  
 19180  // Additional type definitions:
 19181  //
 19182  // Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
 19183  // use in header symbols.
 19184  type pthread_addr_t = uintptr         /* _pthreadtypes.h:89:14 */
 19185  type pthread_startroutine_t = uintptr /* _pthreadtypes.h:90:14 */
 19186  
 19187  type u_char = uint8   /* types.h:52:23 */
 19188  type u_short = uint16 /* types.h:53:24 */
 19189  type u_int = uint32   /* types.h:54:22 */
 19190  type u_long = uint64  /* types.h:55:23 */
 19191  type ushort = uint16  /* types.h:57:24 */ // Sys V compatibility
 19192  type uint = uint32    /* types.h:58:22 */ // Sys V compatibility
 19193  
 19194  // XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
 19195  // -
 19196  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19197  //
 19198  // Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
 19199  // Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
 19200  // All rights reserved.
 19201  //
 19202  // Redistribution and use in source and binary forms, with or without
 19203  // modification, are permitted provided that the following conditions
 19204  // are met:
 19205  // 1. Redistributions of source code must retain the above copyright
 19206  //    notice, this list of conditions and the following disclaimer.
 19207  // 2. Redistributions in binary form must reproduce the above copyright
 19208  //    notice, this list of conditions and the following disclaimer in the
 19209  //    documentation and/or other materials provided with the distribution.
 19210  //
 19211  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19212  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19213  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19214  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19215  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19216  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19217  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19218  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19219  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19220  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19221  // SUCH DAMAGE.
 19222  //
 19223  // $FreeBSD$
 19224  
 19225  type int8_t = int8 /* _stdint.h:36:19 */
 19226  
 19227  type int16_t = int16 /* _stdint.h:41:20 */
 19228  
 19229  type int32_t = int32 /* _stdint.h:46:20 */
 19230  
 19231  type int64_t = int64 /* _stdint.h:51:20 */
 19232  
 19233  type uint8_t = uint8 /* _stdint.h:56:20 */
 19234  
 19235  type uint16_t = uint16 /* _stdint.h:61:21 */
 19236  
 19237  type uint32_t = uint32 /* _stdint.h:66:21 */
 19238  
 19239  type uint64_t = uint64 /* _stdint.h:71:21 */
 19240  
 19241  type intptr_t = int64   /* _stdint.h:76:21 */
 19242  type uintptr_t = uint64 /* _stdint.h:80:22 */
 19243  type intmax_t = int64   /* _stdint.h:84:21 */
 19244  type uintmax_t = uint64 /* _stdint.h:88:22 */
 19245  
 19246  type u_int8_t = uint8   /* types.h:67:19 */ // unsigned integrals (deprecated)
 19247  type u_int16_t = uint16 /* types.h:68:20 */
 19248  type u_int32_t = uint32 /* types.h:69:20 */
 19249  type u_int64_t = uint64 /* types.h:70:20 */
 19250  
 19251  type u_quad_t = uint64 /* types.h:72:20 */ // quads (deprecated)
 19252  type quad_t = int64    /* types.h:73:19 */
 19253  type qaddr_t = uintptr /* types.h:74:16 */
 19254  
 19255  type caddr_t = uintptr   /* types.h:76:14 */ // core address
 19256  type c_caddr_t = uintptr /* types.h:77:20 */ // core address, pointer to const
 19257  
 19258  type blksize_t = int32 /* types.h:80:21 */
 19259  
 19260  type cpuwhich_t = int32 /* types.h:84:22 */
 19261  type cpulevel_t = int32 /* types.h:85:22 */
 19262  type cpusetid_t = int32 /* types.h:86:22 */
 19263  
 19264  type blkcnt_t = int64 /* types.h:89:20 */
 19265  
 19266  type clock_t = int32 /* types.h:94:19 */
 19267  
 19268  type clockid_t = int32 /* types.h:99:21 */
 19269  
 19270  type critical_t = int64 /* types.h:103:22 */ // Critical section value
 19271  type daddr_t = int64    /* types.h:104:19 */ // disk address
 19272  
 19273  type dev_t = uint64 /* types.h:107:18 */ // device number or struct cdev
 19274  
 19275  type fflags_t = uint32 /* types.h:112:20 */ // file flags
 19276  
 19277  type fixpt_t = uint32 /* types.h:116:19 */ // fixed point number
 19278  
 19279  type fsblkcnt_t = uint64 /* types.h:119:22 */
 19280  type fsfilcnt_t = uint64 /* types.h:120:22 */
 19281  
 19282  type gid_t = uint32 /* types.h:125:18 */ // group id
 19283  
 19284  type in_addr_t = uint32 /* types.h:130:20 */ // base type for internet address
 19285  
 19286  type in_port_t = uint16 /* types.h:135:20 */
 19287  
 19288  type id_t = int64 /* types.h:140:17 */ // can hold a uid_t or pid_t
 19289  
 19290  type ino_t = uint64 /* types.h:145:18 */ // inode number
 19291  
 19292  type key_t = int64 /* types.h:150:18 */ // IPC key (for Sys V IPC)
 19293  
 19294  type lwpid_t = int32 /* types.h:155:19 */ // Thread ID (a.k.a. LWP)
 19295  
 19296  type mode_t = uint16 /* types.h:160:18 */ // permissions
 19297  
 19298  type accmode_t = int32 /* types.h:165:21 */ // access permissions
 19299  
 19300  type nlink_t = uint64 /* types.h:170:19 */ // link count
 19301  
 19302  type pid_t = int32 /* types.h:185:18 */ // process id
 19303  
 19304  type register_t = int64 /* types.h:189:22 */
 19305  
 19306  type rlim_t = int64 /* types.h:192:18 */ // resource limit
 19307  
 19308  type sbintime_t = int64 /* types.h:196:19 */
 19309  
 19310  type segsz_t = int64 /* types.h:198:19 */ // segment size (in pages)
 19311  
 19312  type suseconds_t = int64 /* types.h:211:23 */ // microseconds (signed)
 19313  
 19314  type time_t = int64 /* types.h:216:18 */
 19315  
 19316  type timer_t = uintptr /* types.h:221:19 */
 19317  
 19318  type mqd_t = uintptr /* types.h:226:17 */
 19319  
 19320  type u_register_t = uint64 /* types.h:230:24 */
 19321  
 19322  type uid_t = uint32 /* types.h:233:18 */ // user id
 19323  
 19324  type useconds_t = uint32 /* types.h:238:22 */ // microseconds (unsigned)
 19325  
 19326  type cap_ioctl_t = uint64 /* types.h:244:23 */
 19327  
 19328  // Types suitable for exporting physical addresses, virtual addresses
 19329  // (pointers), and memory object sizes from the kernel independent of native
 19330  // word size.  These should be used in place of vm_paddr_t, (u)intptr_t, and
 19331  // size_t in structs which contain such types that are shared with userspace.
 19332  type kpaddr_t = uint64 /* types.h:260:20 */
 19333  type kvaddr_t = uint64 /* types.h:261:20 */
 19334  type ksize_t = uint64  /* types.h:262:20 */
 19335  type kssize_t = int64  /* types.h:263:19 */
 19336  
 19337  type vm_offset_t = uint64  /* types.h:265:23 */
 19338  type vm_ooffset_t = uint64 /* types.h:266:20 */
 19339  type vm_paddr_t = uint64   /* types.h:267:22 */
 19340  type vm_pindex_t = uint64  /* types.h:268:20 */
 19341  type vm_size_t = uint64    /* types.h:269:21 */
 19342  
 19343  type rman_res_t = uint64 /* types.h:271:25 */
 19344  
 19345  // -
 19346  // SPDX-License-Identifier: BSD-3-Clause
 19347  //
 19348  // Copyright (c) 1992, 1993
 19349  //	The Regents of the University of California.  All rights reserved.
 19350  //
 19351  // Redistribution and use in source and binary forms, with or without
 19352  // modification, are permitted provided that the following conditions
 19353  // are met:
 19354  // 1. Redistributions of source code must retain the above copyright
 19355  //    notice, this list of conditions and the following disclaimer.
 19356  // 2. Redistributions in binary form must reproduce the above copyright
 19357  //    notice, this list of conditions and the following disclaimer in the
 19358  //    documentation and/or other materials provided with the distribution.
 19359  // 3. Neither the name of the University nor the names of its contributors
 19360  //    may be used to endorse or promote products derived from this software
 19361  //    without specific prior written permission.
 19362  //
 19363  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19364  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19365  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19366  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19367  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19368  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19369  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19370  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19371  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19372  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19373  // SUCH DAMAGE.
 19374  //
 19375  // $FreeBSD$
 19376  
 19377  // -
 19378  // SPDX-License-Identifier: BSD-3-Clause
 19379  //
 19380  // Copyright (c) 1991, 1993
 19381  //	The Regents of the University of California.  All rights reserved.
 19382  //
 19383  // This code is derived from software contributed to Berkeley by
 19384  // Berkeley Software Design, Inc.
 19385  //
 19386  // Redistribution and use in source and binary forms, with or without
 19387  // modification, are permitted provided that the following conditions
 19388  // are met:
 19389  // 1. Redistributions of source code must retain the above copyright
 19390  //    notice, this list of conditions and the following disclaimer.
 19391  // 2. Redistributions in binary form must reproduce the above copyright
 19392  //    notice, this list of conditions and the following disclaimer in the
 19393  //    documentation and/or other materials provided with the distribution.
 19394  // 3. Neither the name of the University nor the names of its contributors
 19395  //    may be used to endorse or promote products derived from this software
 19396  //    without specific prior written permission.
 19397  //
 19398  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19399  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19400  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19401  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19402  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19403  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19404  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19405  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19406  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19407  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19408  // SUCH DAMAGE.
 19409  //
 19410  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 19411  // $FreeBSD$
 19412  
 19413  // -
 19414  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19415  //
 19416  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19417  // All rights reserved.
 19418  //
 19419  // Redistribution and use in source and binary forms, with or without
 19420  // modification, are permitted provided that the following conditions
 19421  // are met:
 19422  // 1. Redistributions of source code must retain the above copyright
 19423  //    notice, this list of conditions and the following disclaimer.
 19424  // 2. Redistributions in binary form must reproduce the above copyright
 19425  //    notice, this list of conditions and the following disclaimer in the
 19426  //    documentation and/or other materials provided with the distribution.
 19427  //
 19428  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19429  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19430  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19431  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19432  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19433  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19434  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19435  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19436  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19437  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19438  // SUCH DAMAGE.
 19439  //
 19440  // $FreeBSD$
 19441  
 19442  // -
 19443  // SPDX-License-Identifier: BSD-3-Clause
 19444  //
 19445  // Copyright (c) 1982, 1986, 1989, 1991, 1993
 19446  //	The Regents of the University of California.  All rights reserved.
 19447  // (c) UNIX System Laboratories, Inc.
 19448  // All or some portions of this file are derived from material licensed
 19449  // to the University of California by American Telephone and Telegraph
 19450  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 19451  // the permission of UNIX System Laboratories, Inc.
 19452  //
 19453  // Redistribution and use in source and binary forms, with or without
 19454  // modification, are permitted provided that the following conditions
 19455  // are met:
 19456  // 1. Redistributions of source code must retain the above copyright
 19457  //    notice, this list of conditions and the following disclaimer.
 19458  // 2. Redistributions in binary form must reproduce the above copyright
 19459  //    notice, this list of conditions and the following disclaimer in the
 19460  //    documentation and/or other materials provided with the distribution.
 19461  // 3. Neither the name of the University nor the names of its contributors
 19462  //    may be used to endorse or promote products derived from this software
 19463  //    without specific prior written permission.
 19464  //
 19465  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19466  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19467  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19468  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19469  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19470  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19471  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19472  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19473  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19474  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19475  // SUCH DAMAGE.
 19476  //
 19477  //	@(#)signal.h	8.4 (Berkeley) 5/4/95
 19478  // $FreeBSD$
 19479  
 19480  // sigset_t macros.
 19481  
 19482  type __sigset = struct{ F__bits [4]uint32 } /* _sigset.h:53:9 */
 19483  
 19484  // -
 19485  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19486  //
 19487  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19488  // All rights reserved.
 19489  //
 19490  // Redistribution and use in source and binary forms, with or without
 19491  // modification, are permitted provided that the following conditions
 19492  // are met:
 19493  // 1. Redistributions of source code must retain the above copyright
 19494  //    notice, this list of conditions and the following disclaimer.
 19495  // 2. Redistributions in binary form must reproduce the above copyright
 19496  //    notice, this list of conditions and the following disclaimer in the
 19497  //    documentation and/or other materials provided with the distribution.
 19498  //
 19499  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19500  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19501  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19502  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19503  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19504  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19505  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19506  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19507  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19508  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19509  // SUCH DAMAGE.
 19510  //
 19511  // $FreeBSD$
 19512  
 19513  // -
 19514  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19515  //
 19516  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19517  // All rights reserved.
 19518  //
 19519  // Redistribution and use in source and binary forms, with or without
 19520  // modification, are permitted provided that the following conditions
 19521  // are met:
 19522  // 1. Redistributions of source code must retain the above copyright
 19523  //    notice, this list of conditions and the following disclaimer.
 19524  // 2. Redistributions in binary form must reproduce the above copyright
 19525  //    notice, this list of conditions and the following disclaimer in the
 19526  //    documentation and/or other materials provided with the distribution.
 19527  //
 19528  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19529  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19530  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19531  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19532  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19533  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19534  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19535  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19536  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19537  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19538  // SUCH DAMAGE.
 19539  //
 19540  // $FreeBSD$
 19541  
 19542  // Structure returned by gettimeofday(2) system call, and used in other calls.
 19543  type timeval = struct {
 19544  	Ftv_sec  time_t
 19545  	Ftv_usec suseconds_t
 19546  } /* _timeval.h:49:1 */
 19547  
 19548  // -
 19549  // SPDX-License-Identifier: BSD-3-Clause
 19550  //
 19551  // Copyright (c) 1982, 1986, 1993
 19552  //	The Regents of the University of California.  All rights reserved.
 19553  //
 19554  // Redistribution and use in source and binary forms, with or without
 19555  // modification, are permitted provided that the following conditions
 19556  // are met:
 19557  // 1. Redistributions of source code must retain the above copyright
 19558  //    notice, this list of conditions and the following disclaimer.
 19559  // 2. Redistributions in binary form must reproduce the above copyright
 19560  //    notice, this list of conditions and the following disclaimer in the
 19561  //    documentation and/or other materials provided with the distribution.
 19562  // 3. Neither the name of the University nor the names of its contributors
 19563  //    may be used to endorse or promote products derived from this software
 19564  //    without specific prior written permission.
 19565  //
 19566  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19567  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19568  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19569  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19570  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19571  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19572  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19573  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19574  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19575  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19576  // SUCH DAMAGE.
 19577  //
 19578  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 19579  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 19580  //	$FreeBSD$
 19581  
 19582  // -
 19583  // SPDX-License-Identifier: BSD-3-Clause
 19584  //
 19585  // Copyright (c) 1991, 1993
 19586  //	The Regents of the University of California.  All rights reserved.
 19587  //
 19588  // This code is derived from software contributed to Berkeley by
 19589  // Berkeley Software Design, Inc.
 19590  //
 19591  // Redistribution and use in source and binary forms, with or without
 19592  // modification, are permitted provided that the following conditions
 19593  // are met:
 19594  // 1. Redistributions of source code must retain the above copyright
 19595  //    notice, this list of conditions and the following disclaimer.
 19596  // 2. Redistributions in binary form must reproduce the above copyright
 19597  //    notice, this list of conditions and the following disclaimer in the
 19598  //    documentation and/or other materials provided with the distribution.
 19599  // 3. Neither the name of the University nor the names of its contributors
 19600  //    may be used to endorse or promote products derived from this software
 19601  //    without specific prior written permission.
 19602  //
 19603  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19604  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19605  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19606  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19607  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19608  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19609  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19610  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19611  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19612  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19613  // SUCH DAMAGE.
 19614  //
 19615  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 19616  // $FreeBSD$
 19617  
 19618  // -
 19619  // SPDX-License-Identifier: BSD-3-Clause
 19620  //
 19621  // Copyright (c) 1982, 1986, 1993
 19622  //	The Regents of the University of California.  All rights reserved.
 19623  //
 19624  // Redistribution and use in source and binary forms, with or without
 19625  // modification, are permitted provided that the following conditions
 19626  // are met:
 19627  // 1. Redistributions of source code must retain the above copyright
 19628  //    notice, this list of conditions and the following disclaimer.
 19629  // 2. Redistributions in binary form must reproduce the above copyright
 19630  //    notice, this list of conditions and the following disclaimer in the
 19631  //    documentation and/or other materials provided with the distribution.
 19632  // 3. Neither the name of the University nor the names of its contributors
 19633  //    may be used to endorse or promote products derived from this software
 19634  //    without specific prior written permission.
 19635  //
 19636  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19637  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19638  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19639  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19640  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19641  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19642  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19643  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19644  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19645  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19646  // SUCH DAMAGE.
 19647  //
 19648  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 19649  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 19650  //	$FreeBSD$
 19651  
 19652  // -
 19653  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19654  //
 19655  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19656  // All rights reserved.
 19657  //
 19658  // Redistribution and use in source and binary forms, with or without
 19659  // modification, are permitted provided that the following conditions
 19660  // are met:
 19661  // 1. Redistributions of source code must retain the above copyright
 19662  //    notice, this list of conditions and the following disclaimer.
 19663  // 2. Redistributions in binary form must reproduce the above copyright
 19664  //    notice, this list of conditions and the following disclaimer in the
 19665  //    documentation and/or other materials provided with the distribution.
 19666  //
 19667  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19668  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19669  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19670  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19671  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19672  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19673  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19674  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19675  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19676  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19677  // SUCH DAMAGE.
 19678  //
 19679  // $FreeBSD$
 19680  
 19681  type timespec = struct {
 19682  	Ftv_sec  time_t
 19683  	Ftv_nsec int64
 19684  } /* _timespec.h:46:1 */
 19685  
 19686  // Structure defined by POSIX.1b to be like a itimerval, but with
 19687  // timespecs. Used in the timer_*() system calls.
 19688  type itimerspec = struct {
 19689  	Fit_interval struct {
 19690  		Ftv_sec  time_t
 19691  		Ftv_nsec int64
 19692  	}
 19693  	Fit_value struct {
 19694  		Ftv_sec  time_t
 19695  		Ftv_nsec int64
 19696  	}
 19697  } /* timespec.h:60:1 */
 19698  
 19699  type fd_mask = uint64 /* select.h:46:19 */
 19700  
 19701  type sigset_t = __sigset /* select.h:51:20 */
 19702  
 19703  // Select uses bit masks of file descriptors in longs.  These macros
 19704  // manipulate such bit fields (the filesystem macros use chars).
 19705  // FD_SETSIZE may be defined by the user, but the default here should
 19706  // be enough for most uses.
 19707  
 19708  type fd_set1 = struct{ F__fds_bits [16]uint64 } /* select.h:73:9 */
 19709  
 19710  // Select uses bit masks of file descriptors in longs.  These macros
 19711  // manipulate such bit fields (the filesystem macros use chars).
 19712  // FD_SETSIZE may be defined by the user, but the default here should
 19713  // be enough for most uses.
 19714  
 19715  type fd_set = fd_set1 /* select.h:75:3 */
 19716  
 19717  // These declarations belong elsewhere, but are repeated here and in
 19718  // <stdio.h> to give broken programs a better chance of working with
 19719  // 64-bit off_t's.
 19720  
 19721  // -
 19722  // SPDX-License-Identifier: BSD-3-Clause
 19723  //
 19724  // Copyright (c) 1982, 1986, 1989, 1993
 19725  //	The Regents of the University of California.  All rights reserved.
 19726  // (c) UNIX System Laboratories, Inc.
 19727  // All or some portions of this file are derived from material licensed
 19728  // to the University of California by American Telephone and Telegraph
 19729  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 19730  // the permission of UNIX System Laboratories, Inc.
 19731  //
 19732  // Redistribution and use in source and binary forms, with or without
 19733  // modification, are permitted provided that the following conditions
 19734  // are met:
 19735  // 1. Redistributions of source code must retain the above copyright
 19736  //    notice, this list of conditions and the following disclaimer.
 19737  // 2. Redistributions in binary form must reproduce the above copyright
 19738  //    notice, this list of conditions and the following disclaimer in the
 19739  //    documentation and/or other materials provided with the distribution.
 19740  // 3. Neither the name of the University nor the names of its contributors
 19741  //    may be used to endorse or promote products derived from this software
 19742  //    without specific prior written permission.
 19743  //
 19744  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19745  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19746  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19747  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19748  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19749  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19750  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19751  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19752  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19753  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19754  // SUCH DAMAGE.
 19755  //
 19756  //	@(#)stat.h	8.12 (Berkeley) 6/16/95
 19757  // $FreeBSD$
 19758  
 19759  // -
 19760  // SPDX-License-Identifier: BSD-3-Clause
 19761  //
 19762  // Copyright (c) 1991, 1993
 19763  //	The Regents of the University of California.  All rights reserved.
 19764  //
 19765  // This code is derived from software contributed to Berkeley by
 19766  // Berkeley Software Design, Inc.
 19767  //
 19768  // Redistribution and use in source and binary forms, with or without
 19769  // modification, are permitted provided that the following conditions
 19770  // are met:
 19771  // 1. Redistributions of source code must retain the above copyright
 19772  //    notice, this list of conditions and the following disclaimer.
 19773  // 2. Redistributions in binary form must reproduce the above copyright
 19774  //    notice, this list of conditions and the following disclaimer in the
 19775  //    documentation and/or other materials provided with the distribution.
 19776  // 3. Neither the name of the University nor the names of its contributors
 19777  //    may be used to endorse or promote products derived from this software
 19778  //    without specific prior written permission.
 19779  //
 19780  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19781  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19782  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19783  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19784  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19785  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19786  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19787  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19788  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19789  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19790  // SUCH DAMAGE.
 19791  //
 19792  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 19793  // $FreeBSD$
 19794  
 19795  // -
 19796  // SPDX-License-Identifier: BSD-3-Clause
 19797  //
 19798  // Copyright (c) 1982, 1986, 1993
 19799  //	The Regents of the University of California.  All rights reserved.
 19800  //
 19801  // Redistribution and use in source and binary forms, with or without
 19802  // modification, are permitted provided that the following conditions
 19803  // are met:
 19804  // 1. Redistributions of source code must retain the above copyright
 19805  //    notice, this list of conditions and the following disclaimer.
 19806  // 2. Redistributions in binary form must reproduce the above copyright
 19807  //    notice, this list of conditions and the following disclaimer in the
 19808  //    documentation and/or other materials provided with the distribution.
 19809  // 3. Neither the name of the University nor the names of its contributors
 19810  //    may be used to endorse or promote products derived from this software
 19811  //    without specific prior written permission.
 19812  //
 19813  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19814  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19815  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19816  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19817  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19818  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19819  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19820  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19821  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19822  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19823  // SUCH DAMAGE.
 19824  //
 19825  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 19826  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 19827  //	$FreeBSD$
 19828  
 19829  // -
 19830  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19831  //
 19832  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19833  // All rights reserved.
 19834  //
 19835  // Redistribution and use in source and binary forms, with or without
 19836  // modification, are permitted provided that the following conditions
 19837  // are met:
 19838  // 1. Redistributions of source code must retain the above copyright
 19839  //    notice, this list of conditions and the following disclaimer.
 19840  // 2. Redistributions in binary form must reproduce the above copyright
 19841  //    notice, this list of conditions and the following disclaimer in the
 19842  //    documentation and/or other materials provided with the distribution.
 19843  //
 19844  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19845  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19846  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19847  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19848  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19849  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19850  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19851  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19852  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19853  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19854  // SUCH DAMAGE.
 19855  //
 19856  // $FreeBSD$
 19857  
 19858  // XXX We get miscellaneous namespace pollution with this.
 19859  // -
 19860  // SPDX-License-Identifier: BSD-3-Clause
 19861  //
 19862  // Copyright (c) 1982, 1986, 1993
 19863  //	The Regents of the University of California.  All rights reserved.
 19864  //
 19865  // Redistribution and use in source and binary forms, with or without
 19866  // modification, are permitted provided that the following conditions
 19867  // are met:
 19868  // 1. Redistributions of source code must retain the above copyright
 19869  //    notice, this list of conditions and the following disclaimer.
 19870  // 2. Redistributions in binary form must reproduce the above copyright
 19871  //    notice, this list of conditions and the following disclaimer in the
 19872  //    documentation and/or other materials provided with the distribution.
 19873  // 3. Neither the name of the University nor the names of its contributors
 19874  //    may be used to endorse or promote products derived from this software
 19875  //    without specific prior written permission.
 19876  //
 19877  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19878  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19879  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19880  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19881  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19882  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19883  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19884  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19885  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19886  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19887  // SUCH DAMAGE.
 19888  //
 19889  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 19890  // $FreeBSD$
 19891  
 19892  // -
 19893  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 19894  //
 19895  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 19896  // All rights reserved.
 19897  //
 19898  // Redistribution and use in source and binary forms, with or without
 19899  // modification, are permitted provided that the following conditions
 19900  // are met:
 19901  // 1. Redistributions of source code must retain the above copyright
 19902  //    notice, this list of conditions and the following disclaimer.
 19903  // 2. Redistributions in binary form must reproduce the above copyright
 19904  //    notice, this list of conditions and the following disclaimer in the
 19905  //    documentation and/or other materials provided with the distribution.
 19906  //
 19907  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 19908  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19909  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19910  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 19911  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19912  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19913  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19914  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19915  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19916  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19917  // SUCH DAMAGE.
 19918  //
 19919  // $FreeBSD$
 19920  
 19921  // -
 19922  // SPDX-License-Identifier: BSD-3-Clause
 19923  //
 19924  // Copyright (c) 1982, 1986, 1991, 1993, 1994
 19925  //	The Regents of the University of California.  All rights reserved.
 19926  // (c) UNIX System Laboratories, Inc.
 19927  // All or some portions of this file are derived from material licensed
 19928  // to the University of California by American Telephone and Telegraph
 19929  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 19930  // the permission of UNIX System Laboratories, Inc.
 19931  //
 19932  // Redistribution and use in source and binary forms, with or without
 19933  // modification, are permitted provided that the following conditions
 19934  // are met:
 19935  // 1. Redistributions of source code must retain the above copyright
 19936  //    notice, this list of conditions and the following disclaimer.
 19937  // 2. Redistributions in binary form must reproduce the above copyright
 19938  //    notice, this list of conditions and the following disclaimer in the
 19939  //    documentation and/or other materials provided with the distribution.
 19940  // 3. Neither the name of the University nor the names of its contributors
 19941  //    may be used to endorse or promote products derived from this software
 19942  //    without specific prior written permission.
 19943  //
 19944  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19945  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19946  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19947  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19948  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19949  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19950  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19951  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19952  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19953  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19954  // SUCH DAMAGE.
 19955  //
 19956  //	@(#)types.h	8.6 (Berkeley) 2/19/95
 19957  // $FreeBSD$
 19958  
 19959  // -
 19960  // SPDX-License-Identifier: BSD-3-Clause
 19961  //
 19962  // Copyright (c) 1982, 1986, 1993
 19963  //	The Regents of the University of California.  All rights reserved.
 19964  //
 19965  // Redistribution and use in source and binary forms, with or without
 19966  // modification, are permitted provided that the following conditions
 19967  // are met:
 19968  // 1. Redistributions of source code must retain the above copyright
 19969  //    notice, this list of conditions and the following disclaimer.
 19970  // 2. Redistributions in binary form must reproduce the above copyright
 19971  //    notice, this list of conditions and the following disclaimer in the
 19972  //    documentation and/or other materials provided with the distribution.
 19973  // 3. Neither the name of the University nor the names of its contributors
 19974  //    may be used to endorse or promote products derived from this software
 19975  //    without specific prior written permission.
 19976  //
 19977  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 19978  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 19979  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 19980  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 19981  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 19982  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 19983  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 19984  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 19985  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 19986  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 19987  // SUCH DAMAGE.
 19988  //
 19989  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 19990  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 19991  //	$FreeBSD$
 19992  
 19993  type timezone = struct {
 19994  	Ftz_minuteswest int32
 19995  	Ftz_dsttime     int32
 19996  } /* time.h:42:1 */
 19997  
 19998  type bintime = struct {
 19999  	Fsec  time_t
 20000  	Ffrac uint64_t
 20001  } /* time.h:55:1 */
 20002  
 20003  // Decimal<->sbt conversions.  Multiplying or dividing by SBT_1NS results in
 20004  // large roundoff errors which sbttons() and nstosbt() avoid.  Millisecond and
 20005  // microsecond functions are also provided for completeness.
 20006  //
 20007  // These functions return the smallest sbt larger or equal to the
 20008  // number of seconds requested so that sbttoX(Xtosbt(y)) == y.  Unlike
 20009  // top of second computations below, which require that we tick at the
 20010  // top of second, these need to be rounded up so we do whatever for at
 20011  // least as long as requested.
 20012  //
 20013  // The naive computation we'd do is this
 20014  //	((unit * 2^64 / SIFACTOR) + 2^32-1) >> 32
 20015  // However, that overflows. Instead, we compute
 20016  //	((unit * 2^63 / SIFACTOR) + 2^31-1) >> 32
 20017  // and use pre-computed constants that are the ceil of the 2^63 / SIFACTOR
 20018  // term to ensure we are using exactly the right constant. We use the lesser
 20019  // evil of ull rather than a uint64_t cast to ensure we have well defined
 20020  // right shift semantics. With these changes, we get all the ns, us and ms
 20021  // conversions back and forth right.
 20022  // Note: This file is used for both kernel and userland includes, so we can't
 20023  // rely on KASSERT being defined, nor can we pollute the namespace by including
 20024  // assert.h.
 20025  func sbttons(tls *libc.TLS, _sbt sbintime_t) int64_t { /* time.h:185:1: */
 20026  	var ns uint64_t
 20027  
 20028  	ns = uint64_t(_sbt)
 20029  	if ns >= (uint64(sbintime_t(int64(1)) << 32)) {
 20030  		ns = ((ns >> 32) * uint64(1000000000))
 20031  	} else {
 20032  		ns = uint64(0)
 20033  	}
 20034  
 20035  	return (int64_t(ns + (uint64_t((int64(1000000000) * (_sbt & int64(0xffffffff))) >> 32))))
 20036  }
 20037  
 20038  func nstosbt(tls *libc.TLS, _ns int64_t) sbintime_t { /* time.h:202:1: */
 20039  	var sb sbintime_t = int64(0)
 20040  
 20041  	if _ns >= (sbintime_t(int64(1)) << 32) {
 20042  		sb = ((_ns / int64(1000000000)) * (sbintime_t(int64(1)) << 32))
 20043  		_ns = (_ns % int64(1000000000))
 20044  	}
 20045  	// 9223372037 = ceil(2^63 / 1000000000)
 20046  	sb = sbintime_t(uint64(sb) + (((uint64(_ns) * 9223372037) + uint64(0x7fffffff)) >> 31))
 20047  	return sb
 20048  }
 20049  
 20050  func sbttous(tls *libc.TLS, _sbt sbintime_t) int64_t { /* time.h:219:1: */
 20051  
 20052  	return ((int64(1000000) * _sbt) >> 32)
 20053  }
 20054  
 20055  func ustosbt(tls *libc.TLS, _us int64_t) sbintime_t { /* time.h:226:1: */
 20056  	var sb sbintime_t = int64(0)
 20057  
 20058  	if _us >= (sbintime_t(int64(1)) << 32) {
 20059  		sb = ((_us / int64(1000000)) * (sbintime_t(int64(1)) << 32))
 20060  		_us = (_us % int64(1000000))
 20061  	}
 20062  	// 9223372036855 = ceil(2^63 / 1000000)
 20063  	sb = sbintime_t(uint64(sb) + (((uint64(_us) * 9223372036855) + uint64(0x7fffffff)) >> 31))
 20064  	return sb
 20065  }
 20066  
 20067  // Operations on timespecs
 20068  
 20069  // Names of the interval timers, and structure
 20070  // defining a timer setting.
 20071  
 20072  type itimerval = struct {
 20073  	Fit_interval struct {
 20074  		Ftv_sec  time_t
 20075  		Ftv_usec suseconds_t
 20076  	}
 20077  	Fit_value struct {
 20078  		Ftv_sec  time_t
 20079  		Ftv_usec suseconds_t
 20080  	}
 20081  } /* time.h:447:1 */
 20082  
 20083  // Getkerninfo clock information structure
 20084  type clockinfo = struct {
 20085  	Fhz     int32
 20086  	Ftick   int32
 20087  	Fspare  int32
 20088  	Fstathz int32
 20089  	Fprofhz int32
 20090  } /* time.h:455:1 */
 20091  
 20092  // These macros are also in time.h.
 20093  
 20094  // -
 20095  // SPDX-License-Identifier: BSD-3-Clause
 20096  //
 20097  // Copyright (c) 1989, 1993
 20098  //	The Regents of the University of California.  All rights reserved.
 20099  // (c) UNIX System Laboratories, Inc.
 20100  // All or some portions of this file are derived from material licensed
 20101  // to the University of California by American Telephone and Telegraph
 20102  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 20103  // the permission of UNIX System Laboratories, Inc.
 20104  //
 20105  // Redistribution and use in source and binary forms, with or without
 20106  // modification, are permitted provided that the following conditions
 20107  // are met:
 20108  // 1. Redistributions of source code must retain the above copyright
 20109  //    notice, this list of conditions and the following disclaimer.
 20110  // 2. Redistributions in binary form must reproduce the above copyright
 20111  //    notice, this list of conditions and the following disclaimer in the
 20112  //    documentation and/or other materials provided with the distribution.
 20113  // 3. Neither the name of the University nor the names of its contributors
 20114  //    may be used to endorse or promote products derived from this software
 20115  //    without specific prior written permission.
 20116  //
 20117  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20118  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20119  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20120  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20121  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20122  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20123  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20124  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20125  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20126  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20127  // SUCH DAMAGE.
 20128  //
 20129  //	@(#)time.h	8.3 (Berkeley) 1/21/94
 20130  
 20131  // $FreeBSD$
 20132  
 20133  // -
 20134  // SPDX-License-Identifier: BSD-3-Clause
 20135  //
 20136  // Copyright (c) 1991, 1993
 20137  //	The Regents of the University of California.  All rights reserved.
 20138  //
 20139  // This code is derived from software contributed to Berkeley by
 20140  // Berkeley Software Design, Inc.
 20141  //
 20142  // Redistribution and use in source and binary forms, with or without
 20143  // modification, are permitted provided that the following conditions
 20144  // are met:
 20145  // 1. Redistributions of source code must retain the above copyright
 20146  //    notice, this list of conditions and the following disclaimer.
 20147  // 2. Redistributions in binary form must reproduce the above copyright
 20148  //    notice, this list of conditions and the following disclaimer in the
 20149  //    documentation and/or other materials provided with the distribution.
 20150  // 3. Neither the name of the University nor the names of its contributors
 20151  //    may be used to endorse or promote products derived from this software
 20152  //    without specific prior written permission.
 20153  //
 20154  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20155  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20156  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20157  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20158  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20159  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20160  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20161  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20162  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20163  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20164  // SUCH DAMAGE.
 20165  //
 20166  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 20167  // $FreeBSD$
 20168  
 20169  // -
 20170  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 20171  //
 20172  // Copyright (c) 2003 Marcel Moolenaar
 20173  // All rights reserved.
 20174  //
 20175  // Redistribution and use in source and binary forms, with or without
 20176  // modification, are permitted provided that the following conditions
 20177  // are met:
 20178  //
 20179  // 1. Redistributions of source code must retain the above copyright
 20180  //    notice, this list of conditions and the following disclaimer.
 20181  // 2. Redistributions in binary form must reproduce the above copyright
 20182  //    notice, this list of conditions and the following disclaimer in the
 20183  //    documentation and/or other materials provided with the distribution.
 20184  //
 20185  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 20186  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 20187  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 20188  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 20189  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 20190  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 20191  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 20192  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 20193  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 20194  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 20195  //
 20196  // $FreeBSD$
 20197  
 20198  // -
 20199  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 20200  //
 20201  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 20202  // All rights reserved.
 20203  //
 20204  // Redistribution and use in source and binary forms, with or without
 20205  // modification, are permitted provided that the following conditions
 20206  // are met:
 20207  // 1. Redistributions of source code must retain the above copyright
 20208  //    notice, this list of conditions and the following disclaimer.
 20209  // 2. Redistributions in binary form must reproduce the above copyright
 20210  //    notice, this list of conditions and the following disclaimer in the
 20211  //    documentation and/or other materials provided with the distribution.
 20212  //
 20213  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 20214  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20215  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20216  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 20217  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20218  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20219  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20220  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20221  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20222  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20223  // SUCH DAMAGE.
 20224  //
 20225  // $FreeBSD$
 20226  
 20227  // Frequency of the clock ticks reported by times().  Deprecated - use
 20228  // sysconf(_SC_CLK_TCK) instead.  (Removed in 1003.1-2001.)
 20229  
 20230  // Frequency of the clock ticks reported by clock().
 20231  
 20232  // New in POSIX 1003.1b-1993.
 20233  
 20234  // -
 20235  // SPDX-License-Identifier: BSD-3-Clause
 20236  //
 20237  // Copyright (c) 1982, 1986, 1993
 20238  //	The Regents of the University of California.  All rights reserved.
 20239  //
 20240  // Redistribution and use in source and binary forms, with or without
 20241  // modification, are permitted provided that the following conditions
 20242  // are met:
 20243  // 1. Redistributions of source code must retain the above copyright
 20244  //    notice, this list of conditions and the following disclaimer.
 20245  // 2. Redistributions in binary form must reproduce the above copyright
 20246  //    notice, this list of conditions and the following disclaimer in the
 20247  //    documentation and/or other materials provided with the distribution.
 20248  // 3. Neither the name of the University nor the names of its contributors
 20249  //    may be used to endorse or promote products derived from this software
 20250  //    without specific prior written permission.
 20251  //
 20252  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20253  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20254  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20255  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20256  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20257  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20258  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20259  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20260  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20261  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20262  // SUCH DAMAGE.
 20263  //
 20264  //	@(#)time.h	8.5 (Berkeley) 5/4/95
 20265  // from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
 20266  //	$FreeBSD$
 20267  
 20268  // These macros are also in sys/time.h.
 20269  
 20270  type tm = struct {
 20271  	Ftm_sec    int32
 20272  	Ftm_min    int32
 20273  	Ftm_hour   int32
 20274  	Ftm_mday   int32
 20275  	Ftm_mon    int32
 20276  	Ftm_year   int32
 20277  	Ftm_wday   int32
 20278  	Ftm_yday   int32
 20279  	Ftm_isdst  int32
 20280  	_          [4]byte
 20281  	Ftm_gmtoff int64
 20282  	Ftm_zone   uintptr
 20283  } /* time.h:129:1 */
 20284  
 20285  type sigevent = struct {
 20286  	Fsigev_notify int32
 20287  	Fsigev_signo  int32
 20288  	Fsigev_value  struct {
 20289  		_          [0]uint64
 20290  		Fsival_int int32
 20291  		_          [4]byte
 20292  	}
 20293  	F_sigev_un struct {
 20294  		_          [0]uint64
 20295  		F_threadid int32
 20296  		_          [60]byte
 20297  	}
 20298  } /* signal.h:195:1 */
 20299  
 20300  // -
 20301  // SPDX-License-Identifier: BSD-3-Clause
 20302  //
 20303  // Copyright (c) 1983, 1990, 1993
 20304  //	The Regents of the University of California.  All rights reserved.
 20305  // (c) UNIX System Laboratories, Inc.
 20306  // All or some portions of this file are derived from material licensed
 20307  // to the University of California by American Telephone and Telegraph
 20308  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 20309  // the permission of UNIX System Laboratories, Inc.
 20310  //
 20311  // Redistribution and use in source and binary forms, with or without
 20312  // modification, are permitted provided that the following conditions
 20313  // are met:
 20314  // 1. Redistributions of source code must retain the above copyright
 20315  //    notice, this list of conditions and the following disclaimer.
 20316  // 2. Redistributions in binary form must reproduce the above copyright
 20317  //    notice, this list of conditions and the following disclaimer in the
 20318  //    documentation and/or other materials provided with the distribution.
 20319  // 3. Neither the name of the University nor the names of its contributors
 20320  //    may be used to endorse or promote products derived from this software
 20321  //    without specific prior written permission.
 20322  //
 20323  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20324  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20325  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20326  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20327  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20328  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20329  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20330  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20331  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20332  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20333  // SUCH DAMAGE.
 20334  //
 20335  //	@(#)fcntl.h	8.3 (Berkeley) 1/21/94
 20336  // $FreeBSD$
 20337  
 20338  // This file includes the definitions for open and fcntl
 20339  // described by POSIX for <fcntl.h>; it also includes
 20340  // related kernel definitions.
 20341  
 20342  // -
 20343  // SPDX-License-Identifier: BSD-3-Clause
 20344  //
 20345  // Copyright (c) 1991, 1993
 20346  //	The Regents of the University of California.  All rights reserved.
 20347  //
 20348  // This code is derived from software contributed to Berkeley by
 20349  // Berkeley Software Design, Inc.
 20350  //
 20351  // Redistribution and use in source and binary forms, with or without
 20352  // modification, are permitted provided that the following conditions
 20353  // are met:
 20354  // 1. Redistributions of source code must retain the above copyright
 20355  //    notice, this list of conditions and the following disclaimer.
 20356  // 2. Redistributions in binary form must reproduce the above copyright
 20357  //    notice, this list of conditions and the following disclaimer in the
 20358  //    documentation and/or other materials provided with the distribution.
 20359  // 3. Neither the name of the University nor the names of its contributors
 20360  //    may be used to endorse or promote products derived from this software
 20361  //    without specific prior written permission.
 20362  //
 20363  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20364  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20365  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20366  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20367  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20368  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20369  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20370  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20371  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20372  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20373  // SUCH DAMAGE.
 20374  //
 20375  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 20376  // $FreeBSD$
 20377  
 20378  // -
 20379  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 20380  //
 20381  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 20382  // All rights reserved.
 20383  //
 20384  // Redistribution and use in source and binary forms, with or without
 20385  // modification, are permitted provided that the following conditions
 20386  // are met:
 20387  // 1. Redistributions of source code must retain the above copyright
 20388  //    notice, this list of conditions and the following disclaimer.
 20389  // 2. Redistributions in binary form must reproduce the above copyright
 20390  //    notice, this list of conditions and the following disclaimer in the
 20391  //    documentation and/or other materials provided with the distribution.
 20392  //
 20393  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 20394  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20395  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20396  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 20397  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20398  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20399  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20400  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20401  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20402  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20403  // SUCH DAMAGE.
 20404  //
 20405  // $FreeBSD$
 20406  
 20407  // File status flags: these are used by open(2), fcntl(2).
 20408  // They are also used (indirectly) in the kernel file structure f_flags,
 20409  // which is a superset of the open/fcntl flags.  Open flags and f_flags
 20410  // are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
 20411  // Open/fcntl flags begin with O_; kernel-internal flags begin with F.
 20412  // open-only flags
 20413  
 20414  // Kernel encoding of open mode; separate read and write bits that are
 20415  // independently testable: 1 greater than the above.
 20416  //
 20417  // XXX
 20418  // FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
 20419  // which was documented to use FREAD/FWRITE, continues to work.
 20420  
 20421  // Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY.
 20422  
 20423  // Attempt to bypass buffer cache
 20424  
 20425  // Defined by POSIX 1003.1-2008; BSD default, but reserve for future use.
 20426  
 20427  /* #define O_UNUSED1	0x00400000   */ // Was O_BENEATH
 20428  
 20429  // XXX missing O_RSYNC.
 20430  
 20431  // The O_* flags used to have only F* names, which were used in the kernel
 20432  // and by fcntl.  We retain the F* names for the kernel f_flag field
 20433  // and for backward compatibility for fcntl.  These flags are deprecated.
 20434  
 20435  // Historically, we ran out of bits in f_flag (which was once a short).
 20436  // However, the flag bits not set in FMASK are only meaningful in the
 20437  // initial open syscall.  Those bits were thus given a
 20438  // different meaning for fcntl(2).
 20439  // Read ahead
 20440  
 20441  // Magic value that specify the use of the current working directory
 20442  // to determine the target of relative file paths in the openat() and
 20443  // similar syscalls.
 20444  
 20445  // Miscellaneous flags for the *at() syscalls.
 20446  /* #define AT_UNUSED1		0x1000 */ // Was AT_BENEATH
 20447  
 20448  // Constants used for fcntl(2)
 20449  
 20450  // command values
 20451  
 20452  // Seals (F_ADD_SEALS, F_GET_SEALS).
 20453  
 20454  // file descriptor flags (F_GETFD, F_SETFD)
 20455  
 20456  // record locking flags (F_GETLK, F_SETLK, F_SETLKW)
 20457  
 20458  // Advisory file segment locking data type -
 20459  // information passed to system by user
 20460  type flock = struct {
 20461  	Fl_start  off_t
 20462  	Fl_len    off_t
 20463  	Fl_pid    pid_t
 20464  	Fl_type   int16
 20465  	Fl_whence int16
 20466  	Fl_sysid  int32
 20467  	_         [4]byte
 20468  } /* fcntl.h:294:1 */
 20469  
 20470  // Old advisory file segment locking data type,
 20471  // before adding l_sysid.
 20472  type __oflock = struct {
 20473  	Fl_start  off_t
 20474  	Fl_len    off_t
 20475  	Fl_pid    pid_t
 20476  	Fl_type   int16
 20477  	Fl_whence int16
 20478  } /* fcntl.h:308:1 */
 20479  
 20480  // select(2)
 20481  
 20482  type crypt_data = struct {
 20483  	Finitialized int32
 20484  	F__buf       [256]int8
 20485  } /* unistd.h:489:1 */
 20486  
 20487  // getopt(3) external variable
 20488  
 20489  // -
 20490  // SPDX-License-Identifier: BSD-3-Clause
 20491  //
 20492  // Copyright (c) 1989, 1993
 20493  //	The Regents of the University of California.  All rights reserved.
 20494  //
 20495  // Redistribution and use in source and binary forms, with or without
 20496  // modification, are permitted provided that the following conditions
 20497  // are met:
 20498  // 1. Redistributions of source code must retain the above copyright
 20499  //    notice, this list of conditions and the following disclaimer.
 20500  // 2. Redistributions in binary form must reproduce the above copyright
 20501  //    notice, this list of conditions and the following disclaimer in the
 20502  //    documentation and/or other materials provided with the distribution.
 20503  // 3. Neither the name of the University nor the names of its contributors
 20504  //    may be used to endorse or promote products derived from this software
 20505  //    without specific prior written permission.
 20506  //
 20507  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20508  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20509  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20510  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20511  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20512  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20513  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20514  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20515  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20516  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20517  // SUCH DAMAGE.
 20518  //
 20519  //	@(#)dirent.h	8.2 (Berkeley) 7/28/94
 20520  // $FreeBSD$
 20521  
 20522  // The kernel defines the format of directory entries returned by
 20523  // the getdirentries(2) system call.
 20524  // -
 20525  // SPDX-License-Identifier: BSD-3-Clause
 20526  //
 20527  // Copyright (c) 1991, 1993
 20528  //	The Regents of the University of California.  All rights reserved.
 20529  //
 20530  // This code is derived from software contributed to Berkeley by
 20531  // Berkeley Software Design, Inc.
 20532  //
 20533  // Redistribution and use in source and binary forms, with or without
 20534  // modification, are permitted provided that the following conditions
 20535  // are met:
 20536  // 1. Redistributions of source code must retain the above copyright
 20537  //    notice, this list of conditions and the following disclaimer.
 20538  // 2. Redistributions in binary form must reproduce the above copyright
 20539  //    notice, this list of conditions and the following disclaimer in the
 20540  //    documentation and/or other materials provided with the distribution.
 20541  // 3. Neither the name of the University nor the names of its contributors
 20542  //    may be used to endorse or promote products derived from this software
 20543  //    without specific prior written permission.
 20544  //
 20545  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20546  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20547  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20548  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20549  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20550  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20551  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20552  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20553  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20554  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20555  // SUCH DAMAGE.
 20556  //
 20557  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 20558  // $FreeBSD$
 20559  
 20560  // -
 20561  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 20562  //
 20563  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 20564  // All rights reserved.
 20565  //
 20566  // Redistribution and use in source and binary forms, with or without
 20567  // modification, are permitted provided that the following conditions
 20568  // are met:
 20569  // 1. Redistributions of source code must retain the above copyright
 20570  //    notice, this list of conditions and the following disclaimer.
 20571  // 2. Redistributions in binary form must reproduce the above copyright
 20572  //    notice, this list of conditions and the following disclaimer in the
 20573  //    documentation and/or other materials provided with the distribution.
 20574  //
 20575  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 20576  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20577  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20578  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 20579  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20580  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20581  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20582  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20583  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20584  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20585  // SUCH DAMAGE.
 20586  //
 20587  // $FreeBSD$
 20588  
 20589  // -
 20590  // SPDX-License-Identifier: BSD-3-Clause
 20591  //
 20592  // Copyright (c) 1989, 1993
 20593  //	The Regents of the University of California.  All rights reserved.
 20594  //
 20595  // Redistribution and use in source and binary forms, with or without
 20596  // modification, are permitted provided that the following conditions
 20597  // are met:
 20598  // 1. Redistributions of source code must retain the above copyright
 20599  //    notice, this list of conditions and the following disclaimer.
 20600  // 2. Redistributions in binary form must reproduce the above copyright
 20601  //    notice, this list of conditions and the following disclaimer in the
 20602  //    documentation and/or other materials provided with the distribution.
 20603  // 3. Neither the name of the University nor the names of its contributors
 20604  //    may be used to endorse or promote products derived from this software
 20605  //    without specific prior written permission.
 20606  //
 20607  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20608  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20609  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20610  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20611  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20612  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20613  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20614  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20615  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20616  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20617  // SUCH DAMAGE.
 20618  //
 20619  //	@(#)dirent.h	8.3 (Berkeley) 8/10/94
 20620  // $FreeBSD$
 20621  
 20622  // -
 20623  // SPDX-License-Identifier: BSD-3-Clause
 20624  //
 20625  // Copyright (c) 1991, 1993
 20626  //	The Regents of the University of California.  All rights reserved.
 20627  //
 20628  // This code is derived from software contributed to Berkeley by
 20629  // Berkeley Software Design, Inc.
 20630  //
 20631  // Redistribution and use in source and binary forms, with or without
 20632  // modification, are permitted provided that the following conditions
 20633  // are met:
 20634  // 1. Redistributions of source code must retain the above copyright
 20635  //    notice, this list of conditions and the following disclaimer.
 20636  // 2. Redistributions in binary form must reproduce the above copyright
 20637  //    notice, this list of conditions and the following disclaimer in the
 20638  //    documentation and/or other materials provided with the distribution.
 20639  // 3. Neither the name of the University nor the names of its contributors
 20640  //    may be used to endorse or promote products derived from this software
 20641  //    without specific prior written permission.
 20642  //
 20643  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 20644  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20645  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20646  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 20647  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20648  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20649  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20650  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20651  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20652  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20653  // SUCH DAMAGE.
 20654  //
 20655  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 20656  // $FreeBSD$
 20657  
 20658  // -
 20659  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 20660  //
 20661  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 20662  // All rights reserved.
 20663  //
 20664  // Redistribution and use in source and binary forms, with or without
 20665  // modification, are permitted provided that the following conditions
 20666  // are met:
 20667  // 1. Redistributions of source code must retain the above copyright
 20668  //    notice, this list of conditions and the following disclaimer.
 20669  // 2. Redistributions in binary form must reproduce the above copyright
 20670  //    notice, this list of conditions and the following disclaimer in the
 20671  //    documentation and/or other materials provided with the distribution.
 20672  //
 20673  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 20674  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 20675  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 20676  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 20677  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 20678  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 20679  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 20680  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 20681  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 20682  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 20683  // SUCH DAMAGE.
 20684  //
 20685  // $FreeBSD$
 20686  
 20687  // The dirent structure defines the format of directory entries returned by
 20688  // the getdirentries(2) system call.
 20689  //
 20690  // A directory entry has a struct dirent at the front of it, containing its
 20691  // inode number, the length of the entry, and the length of the name
 20692  // contained in the entry.  These are followed by the name padded to an 8
 20693  // byte boundary with null bytes.  All names are guaranteed null terminated.
 20694  // The maximum length of a name in a directory is MAXNAMLEN.
 20695  //
 20696  // Explicit padding between the last member of the header (d_namlen) and
 20697  // d_name avoids ABI padding at the end of dirent on LP64 architectures.
 20698  // There is code depending on d_name being last.
 20699  
 20700  type dirent = struct {
 20701  	Fd_fileno ino_t
 20702  	Fd_off    off_t
 20703  	Fd_reclen uint16
 20704  	Fd_type   uint8
 20705  	Fd_pad0   uint8
 20706  	Fd_namlen uint16
 20707  	Fd_pad1   uint16
 20708  	Fd_name   [256]int8
 20709  } /* dirent.h:66:1 */
 20710  
 20711  // 11 was EAGAIN
 20712  
 20713  // math software
 20714  
 20715  // non-blocking and interrupt i/o
 20716  
 20717  // ipc/network software -- argument errors
 20718  
 20719  // ipc/network software -- operational errors
 20720  
 20721  // should be rearranged
 20722  
 20723  // quotas & mush
 20724  
 20725  // Network File System
 20726  
 20727  // ISO/IEC 9899:2011 K.3.2.2
 20728  
 20729  // Structure of the fsdir() table-valued function
 20730  //    0    1    2     3    4           5
 20731  
 20732  // Set the result stored by context ctx to a blob containing the
 20733  // contents of file zName.  Or, leave the result unchanged (NULL)
 20734  // if the file does not exist or is unreadable.
 20735  //
 20736  // If the file exceeds the SQLite blob size limit, through an
 20737  // SQLITE_TOOBIG error.
 20738  //
 20739  // Throw an SQLITE_IOERR if there are difficulties pulling the file
 20740  // off of disk.
 20741  func readFileContents(tls *libc.TLS, ctx uintptr, zName uintptr) { /* fileio.c:133:13: */
 20742  	var in uintptr
 20743  	var nIn sqlite3_int64
 20744  	var pBuf uintptr
 20745  	var db uintptr
 20746  	var mxBlob int32
 20747  
 20748  	in = libc.Xfopen(tls, zName, ts+4263 /* "rb" */)
 20749  	if in == uintptr(0) {
 20750  		// File does not exist or is unreadable. Leave the result set to NULL.
 20751  		return
 20752  	}
 20753  	libc.Xfseek(tls, in, int64(0), SEEK_END)
 20754  	nIn = sqlite3_int64(libc.Xftell(tls, in))
 20755  	libc.Xrewind(tls, in)
 20756  	db = sqlite3.Xsqlite3_context_db_handle(tls, ctx)
 20757  	mxBlob = sqlite3.Xsqlite3_limit(tls, db, SQLITE_LIMIT_LENGTH, -1)
 20758  	if nIn > sqlite3_int64(mxBlob) {
 20759  		sqlite3.Xsqlite3_result_error_code(tls, ctx, SQLITE_TOOBIG)
 20760  		libc.Xfclose(tls, in)
 20761  		return
 20762  	}
 20763  	pBuf = sqlite3.Xsqlite3_malloc64(tls, func() uint64 {
 20764  		if nIn != 0 {
 20765  			return uint64(nIn)
 20766  		}
 20767  		return uint64(1)
 20768  	}())
 20769  	if pBuf == uintptr(0) {
 20770  		sqlite3.Xsqlite3_result_error_nomem(tls, ctx)
 20771  		libc.Xfclose(tls, in)
 20772  		return
 20773  	}
 20774  	if nIn == sqlite3_int64(libc.Xfread(tls, pBuf, uint64(1), size_t(nIn), in)) {
 20775  		sqlite3.Xsqlite3_result_blob64(tls, ctx, pBuf, uint64(nIn), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 20776  	} else {
 20777  		sqlite3.Xsqlite3_result_error_code(tls, ctx, SQLITE_IOERR)
 20778  		sqlite3.Xsqlite3_free(tls, pBuf)
 20779  	}
 20780  	libc.Xfclose(tls, in)
 20781  }
 20782  
 20783  // Implementation of the "readfile(X)" SQL function.  The entire content
 20784  // of the file named X is read and returned as a BLOB.  NULL is returned
 20785  // if the file does not exist or is unreadable.
 20786  func readfileFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:175:13: */
 20787  	var zName uintptr
 20788  	_ = argc // Unused parameter
 20789  	zName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 20790  	if zName == uintptr(0) {
 20791  		return
 20792  	}
 20793  	readFileContents(tls, context, zName)
 20794  }
 20795  
 20796  // Set the error message contained in context ctx to the results of
 20797  // vprintf(zFmt, ...).
 20798  func ctxErrorMsg(tls *libc.TLS, ctx uintptr, zFmt uintptr, va uintptr) { /* fileio.c:191:13: */
 20799  	var zMsg uintptr = uintptr(0)
 20800  	var ap va_list
 20801  	_ = ap
 20802  	ap = va
 20803  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 20804  	sqlite3.Xsqlite3_result_error(tls, ctx, zMsg, -1)
 20805  	sqlite3.Xsqlite3_free(tls, zMsg)
 20806  	_ = ap
 20807  }
 20808  
 20809  // This function is used in place of stat().  On Windows, special handling
 20810  // is required in order for the included time to be returned as UTC.  On all
 20811  // other systems, this function simply calls stat().
 20812  func fileStat(tls *libc.TLS, zPath uintptr, pStatBuf uintptr) int32 { /* fileio.c:261:12: */
 20813  	return libc.Xstat(tls, zPath, pStatBuf)
 20814  }
 20815  
 20816  // This function is used in place of lstat().  On Windows, special handling
 20817  // is required in order for the included time to be returned as UTC.  On all
 20818  // other systems, this function simply calls lstat().
 20819  func fileLinkStat(tls *libc.TLS, zPath uintptr, pStatBuf uintptr) int32 { /* fileio.c:279:12: */
 20820  	return libc.Xlstat(tls, zPath, pStatBuf)
 20821  }
 20822  
 20823  // Argument zFile is the name of a file that will be created and/or written
 20824  // by SQL function writefile(). This function ensures that the directory
 20825  // zFile will be written to exists, creating it if required. The permissions
 20826  // for any path components created by this function are set in accordance
 20827  // with the current umask.
 20828  //
 20829  // If an OOM condition is encountered, SQLITE_NOMEM is returned. Otherwise,
 20830  // SQLITE_OK is returned if the directory is successfully created, or
 20831  // SQLITE_ERROR otherwise.
 20832  func makeDirectory(tls *libc.TLS, zFile uintptr) int32 { /* fileio.c:303:12: */
 20833  	bp := tls.Alloc(232)
 20834  	defer tls.Free(232)
 20835  
 20836  	var zCopy uintptr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zFile))
 20837  	var rc int32 = SQLITE_OK
 20838  
 20839  	if zCopy == uintptr(0) {
 20840  		rc = SQLITE_NOMEM
 20841  	} else {
 20842  		var nCopy int32 = int32(libc.Xstrlen(tls, zCopy))
 20843  		var i int32 = 1
 20844  
 20845  		for rc == SQLITE_OK {
 20846  			// var sStat stat at bp+8, 224
 20847  
 20848  			var rc2 int32
 20849  
 20850  			for ; (int32(*(*int8)(unsafe.Pointer(zCopy + uintptr(i)))) != '/') && (i < nCopy); i++ {
 20851  			}
 20852  			if i == nCopy {
 20853  				break
 20854  			}
 20855  			*(*int8)(unsafe.Pointer(zCopy + uintptr(i))) = int8(0)
 20856  
 20857  			rc2 = fileStat(tls, zCopy, bp+8 /* &sStat */)
 20858  			if rc2 != 0 {
 20859  				if libc.Xmkdir(tls, zCopy, uint16(0777)) != 0 {
 20860  					rc = SQLITE_ERROR
 20861  				}
 20862  			} else {
 20863  				if !(((int32((*stat)(unsafe.Pointer(bp + 8 /* &sStat */)).Fst_mode)) & 0170000) == 0040000) {
 20864  					rc = SQLITE_ERROR
 20865  				}
 20866  			}
 20867  			*(*int8)(unsafe.Pointer(zCopy + uintptr(i))) = int8('/')
 20868  			i++
 20869  		}
 20870  
 20871  		sqlite3.Xsqlite3_free(tls, zCopy)
 20872  	}
 20873  
 20874  	return rc
 20875  }
 20876  
 20877  // This function does the work for the writefile() UDF. Refer to
 20878  // header comments at the top of this file for details.
 20879  func writeFile(tls *libc.TLS, pCtx uintptr, zFile uintptr, pData uintptr, mode mode_t, mtime sqlite3_int64) int32 { /* fileio.c:343:12: */
 20880  	bp := tls.Alloc(256)
 20881  	defer tls.Free(256)
 20882  
 20883  	if ((int32(mode)) & 0170000) == 0120000 {
 20884  		var zTo uintptr = sqlite3.Xsqlite3_value_text(tls, pData)
 20885  		if libc.Xsymlink(tls, zTo, zFile) < 0 {
 20886  			return 1
 20887  		}
 20888  	} else {
 20889  		if ((int32(mode)) & 0170000) == 0040000 {
 20890  			if libc.Xmkdir(tls, zFile, mode) != 0 {
 20891  				// The mkdir() call to create the directory failed. This might not
 20892  				// be an error though - if there is already a directory at the same
 20893  				// path and either the permissions already match or can be changed
 20894  				// to do so using chmod(), it is not an error.
 20895  				// var sStat stat at bp, 224
 20896  
 20897  				if ((((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) != EEXIST) ||
 20898  					(0 != fileStat(tls, zFile, bp /* &sStat */))) ||
 20899  					!(((int32((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_mode)) & 0170000) == 0040000)) ||
 20900  					(((int32((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_mode) & 0777) != (int32(mode) & 0777)) && (0 != libc.Xchmod(tls, zFile, (uint16(int32(mode)&0777))))) {
 20901  					return 1
 20902  				}
 20903  			}
 20904  		} else {
 20905  			var nWrite sqlite3_int64 = int64(0)
 20906  			var z uintptr
 20907  			var rc int32 = 0
 20908  			var out uintptr = libc.Xfopen(tls, zFile, ts+4843 /* "wb" */)
 20909  			if out == uintptr(0) {
 20910  				return 1
 20911  			}
 20912  			z = sqlite3.Xsqlite3_value_blob(tls, pData)
 20913  			if z != 0 {
 20914  				var n sqlite3_int64 = sqlite3_int64(libc.Xfwrite(tls, z, uint64(1), uint64(sqlite3.Xsqlite3_value_bytes(tls, pData)), out))
 20915  				nWrite = sqlite3_int64(sqlite3.Xsqlite3_value_bytes(tls, pData))
 20916  				if nWrite != n {
 20917  					rc = 1
 20918  				}
 20919  			}
 20920  			libc.Xfclose(tls, out)
 20921  			if ((rc == 0) && (mode != 0)) && (libc.Xchmod(tls, zFile, (uint16(int32(mode)&0777))) != 0) {
 20922  				rc = 1
 20923  			}
 20924  			if rc != 0 {
 20925  				return 2
 20926  			}
 20927  			sqlite3.Xsqlite3_result_int64(tls, pCtx, nWrite)
 20928  		}
 20929  	}
 20930  
 20931  	if mtime >= int64(0) {
 20932  		// Legacy unix
 20933  		// var times [2]timeval at bp+224, 32
 20934  
 20935  		(*timeval)(unsafe.Pointer(bp + 224 /* &times */)).Ftv_usec = libc.AssignPtrInt64(bp+224 /* &times */ +1*16+8 /* &.tv_usec */, int64(0))
 20936  		(*timeval)(unsafe.Pointer(bp + 224 /* &times */)).Ftv_sec = libc.Xtime(tls, uintptr(0))
 20937  		(*timeval)(unsafe.Pointer(bp + 224 /* &times */ + 1*16)).Ftv_sec = time_t(mtime)
 20938  		if libc.Xutimes(tls, zFile, bp+224 /* &times[0] */) != 0 {
 20939  			return 1
 20940  		}
 20941  	}
 20942  
 20943  	return 0
 20944  }
 20945  
 20946  // Implementation of the "writefile(W,X[,Y[,Z]]])" SQL function.
 20947  // Refer to header comments at the top of this file for details.
 20948  func writefileFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:457:13: */
 20949  	bp := tls.Alloc(24)
 20950  	defer tls.Free(24)
 20951  
 20952  	var zFile uintptr
 20953  	var mode mode_t = mode_t(0)
 20954  	var res int32
 20955  	var mtime sqlite3_int64 = int64(-1)
 20956  
 20957  	if (argc < 2) || (argc > 4) {
 20958  		sqlite3.Xsqlite3_result_error(tls, context,
 20959  			ts+4846 /* "wrong number of ..." */, -1)
 20960  		return
 20961  	}
 20962  
 20963  	zFile = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 20964  	if zFile == uintptr(0) {
 20965  		return
 20966  	}
 20967  	if argc >= 3 {
 20968  		mode = mode_t(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 20969  	}
 20970  	if argc == 4 {
 20971  		mtime = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 20972  	}
 20973  
 20974  	res = writeFile(tls, context, zFile, *(*uintptr)(unsafe.Pointer(argv + 1*8)), mode, mtime)
 20975  	if (res == 1) && ((*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT) {
 20976  		if makeDirectory(tls, zFile) == SQLITE_OK {
 20977  			res = writeFile(tls, context, zFile, *(*uintptr)(unsafe.Pointer(argv + 1*8)), mode, mtime)
 20978  		}
 20979  	}
 20980  
 20981  	if (argc > 2) && (res != 0) {
 20982  		if ((int32(mode)) & 0170000) == 0120000 {
 20983  			ctxErrorMsg(tls, context, ts+4896 /* "failed to create..." */, libc.VaList(bp, zFile))
 20984  		} else if ((int32(mode)) & 0170000) == 0040000 {
 20985  			ctxErrorMsg(tls, context, ts+4925 /* "failed to create..." */, libc.VaList(bp+8, zFile))
 20986  		} else {
 20987  			ctxErrorMsg(tls, context, ts+4956 /* "failed to write ..." */, libc.VaList(bp+16, zFile))
 20988  		}
 20989  	}
 20990  }
 20991  
 20992  // SQL function:   lsmode(MODE)
 20993  //
 20994  // Given a numberic st_mode from stat(), convert it into a human-readable
 20995  // text string in the style of "ls -l".
 20996  func lsModeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:507:13: */
 20997  	bp := tls.Alloc(16)
 20998  	defer tls.Free(16)
 20999  
 21000  	var i int32
 21001  	var iMode int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 21002  	// var z [16]int8 at bp, 16
 21003  
 21004  	_ = argc
 21005  	if ((iMode) & 0170000) == 0120000 {
 21006  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('l')
 21007  	} else if ((iMode) & 0170000) == 0100000 {
 21008  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('-')
 21009  	} else if ((iMode) & 0170000) == 0040000 {
 21010  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('d')
 21011  	} else {
 21012  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('?')
 21013  	}
 21014  	for i = 0; i < 3; i++ {
 21015  		var m int32 = (iMode >> ((2 - i) * 3))
 21016  		var a uintptr = (bp /* &z */ + uintptr((1 + (i * 3))))
 21017  		*(*int8)(unsafe.Pointer(a)) = func() int8 {
 21018  			if (m & 0x4) != 0 {
 21019  				return int8('r')
 21020  			}
 21021  			return int8('-')
 21022  		}()
 21023  		*(*int8)(unsafe.Pointer(a + 1)) = func() int8 {
 21024  			if (m & 0x2) != 0 {
 21025  				return int8('w')
 21026  			}
 21027  			return int8('-')
 21028  		}()
 21029  		*(*int8)(unsafe.Pointer(a + 2)) = func() int8 {
 21030  			if (m & 0x1) != 0 {
 21031  				return int8('x')
 21032  			}
 21033  			return int8('-')
 21034  		}()
 21035  	}
 21036  	*(*int8)(unsafe.Pointer(bp /* &z[0] */ + 10)) = int8(0)
 21037  	sqlite3.Xsqlite3_result_text(tls, context, bp /* &z[0] */, -1, libc.UintptrFromInt32(-1))
 21038  }
 21039  
 21040  // Cursor type for recursively iterating through a directory structure.
 21041  type fsdir_cursor1 = struct {
 21042  	Fbase  sqlite3_vtab_cursor
 21043  	FnLvl  int32
 21044  	FiLvl  int32
 21045  	FaLvl  uintptr
 21046  	FzBase uintptr
 21047  	FnBase int32
 21048  	_      [4]byte
 21049  	FsStat struct {
 21050  		Fst_dev      dev_t
 21051  		Fst_ino      ino_t
 21052  		Fst_nlink    nlink_t
 21053  		Fst_mode     mode_t
 21054  		Fst_padding0 int16
 21055  		Fst_uid      uid_t
 21056  		Fst_gid      gid_t
 21057  		Fst_padding1 int32
 21058  		Fst_rdev     dev_t
 21059  		Fst_atim     struct {
 21060  			Ftv_sec  time_t
 21061  			Ftv_nsec int64
 21062  		}
 21063  		Fst_mtim struct {
 21064  			Ftv_sec  time_t
 21065  			Ftv_nsec int64
 21066  		}
 21067  		Fst_ctim struct {
 21068  			Ftv_sec  time_t
 21069  			Ftv_nsec int64
 21070  		}
 21071  		Fst_birthtim struct {
 21072  			Ftv_sec  time_t
 21073  			Ftv_nsec int64
 21074  		}
 21075  		Fst_size    off_t
 21076  		Fst_blocks  blkcnt_t
 21077  		Fst_blksize blksize_t
 21078  		Fst_flags   fflags_t
 21079  		Fst_gen     uint64
 21080  		Fst_spare   [10]uint64
 21081  	}
 21082  	FzPath  uintptr
 21083  	FiRowid sqlite3_int64
 21084  } /* fileio.c:541:9 */
 21085  
 21086  // Cursor type for recursively iterating through a directory structure.
 21087  type fsdir_cursor = fsdir_cursor1 /* fileio.c:541:29 */
 21088  type FsdirLevel1 = struct {
 21089  	FpDir uintptr
 21090  	FzDir uintptr
 21091  } /* fileio.c:541:9 */
 21092  
 21093  type FsdirLevel = FsdirLevel1 /* fileio.c:542:27 */
 21094  
 21095  type fsdir_tab1 = struct{ Fbase sqlite3_vtab } /* fileio.c:564:9 */
 21096  
 21097  type fsdir_tab = fsdir_tab1 /* fileio.c:564:26 */
 21098  
 21099  // Construct a new fsdir virtual table object.
 21100  func fsdirConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fileio.c:572:12: */
 21101  	var pNew uintptr = uintptr(0)
 21102  	var rc int32
 21103  	_ = pAux
 21104  	_ = argc
 21105  	_ = argv
 21106  	_ = pzErr
 21107  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+4981 /* "CREATE TABLE x(n..." */)
 21108  	if rc == SQLITE_OK {
 21109  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fsdir_tab{})))
 21110  		if pNew == uintptr(0) {
 21111  			return SQLITE_NOMEM
 21112  		}
 21113  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(fsdir_tab{})))
 21114  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 21115  	}
 21116  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 21117  	return rc
 21118  }
 21119  
 21120  // This method is the destructor for fsdir vtab objects.
 21121  func fsdirDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* fileio.c:599:12: */
 21122  	sqlite3.Xsqlite3_free(tls, pVtab)
 21123  	return SQLITE_OK
 21124  }
 21125  
 21126  // Constructor for a new fsdir_cursor object.
 21127  func fsdirOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* fileio.c:607:12: */
 21128  	var pCur uintptr
 21129  	_ = p
 21130  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fsdir_cursor{})))
 21131  	if pCur == uintptr(0) {
 21132  		return SQLITE_NOMEM
 21133  	}
 21134  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(fsdir_cursor{})))
 21135  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = -1
 21136  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 21137  	return SQLITE_OK
 21138  }
 21139  
 21140  // Reset a cursor back to the state it was in when first returned
 21141  // by fsdirOpen().
 21142  func fsdirResetCursor(tls *libc.TLS, pCur uintptr) { /* fileio.c:622:13: */
 21143  	var i int32
 21144  	for i = 0; i <= (*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl; i++ {
 21145  		var pLvl uintptr = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr(i)*16)
 21146  		if (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir != 0 {
 21147  			libc.Xclosedir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 21148  		}
 21149  		sqlite3.Xsqlite3_free(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 21150  	}
 21151  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 21152  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl)
 21153  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl = uintptr(0)
 21154  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 21155  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase = uintptr(0)
 21156  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase = 0
 21157  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl = 0
 21158  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = -1
 21159  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 21160  }
 21161  
 21162  // Destructor for an fsdir_cursor.
 21163  func fsdirClose(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:643:12: */
 21164  	var pCur uintptr = cur
 21165  
 21166  	fsdirResetCursor(tls, pCur)
 21167  	sqlite3.Xsqlite3_free(tls, pCur)
 21168  	return SQLITE_OK
 21169  }
 21170  
 21171  // Set the error message for the virtual table associated with cursor
 21172  // pCur to the results of vprintf(zFmt, ...).
 21173  func fsdirSetErrmsg(tls *libc.TLS, pCur uintptr, zFmt uintptr, va uintptr) { /* fileio.c:655:13: */
 21174  	var ap va_list
 21175  	_ = ap
 21176  	ap = va
 21177  	(*sqlite3_vtab)(unsafe.Pointer((*fsdir_cursor)(unsafe.Pointer(pCur)).Fbase.FpVtab)).FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 21178  	_ = ap
 21179  }
 21180  
 21181  // Advance an fsdir_cursor to its next row of output.
 21182  func fsdirNext(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:666:12: */
 21183  	bp := tls.Alloc(32)
 21184  	defer tls.Free(32)
 21185  
 21186  	var pCur uintptr = cur
 21187  	var m mode_t = (*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode
 21188  
 21189  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid++
 21190  	if ((int32(m)) & 0170000) == 0040000 {
 21191  		// Descend into this directory
 21192  		var iNew int32 = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl + 1)
 21193  		var pLvl uintptr
 21194  		if iNew >= (*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl {
 21195  			var nNew int32 = (iNew + 1)
 21196  			var nByte sqlite3_int64 = (sqlite3_int64(uint64(nNew) * uint64(unsafe.Sizeof(FsdirLevel{}))))
 21197  			var aNew uintptr = sqlite3.Xsqlite3_realloc64(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl, uint64(nByte))
 21198  			if aNew == uintptr(0) {
 21199  				return SQLITE_NOMEM
 21200  			}
 21201  			libc.Xmemset(tls, (aNew + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl)*16), 0, (uint64(unsafe.Sizeof(FsdirLevel{})) * (uint64(nNew - (*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl))))
 21202  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl = aNew
 21203  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl = nNew
 21204  		}
 21205  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = iNew
 21206  		pLvl = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr(iNew)*16)
 21207  
 21208  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir = (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath
 21209  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 21210  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir = libc.Xopendir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 21211  		if (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir == uintptr(0) {
 21212  			fsdirSetErrmsg(tls, pCur, ts+5041 /* "cannot read dire..." */, libc.VaList(bp, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 21213  			return SQLITE_ERROR
 21214  		}
 21215  	}
 21216  
 21217  	for (*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl >= 0 {
 21218  		var pLvl uintptr = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl)*16)
 21219  		var pEntry uintptr = libc.Xreaddir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 21220  		if pEntry != 0 {
 21221  			if int32(*(*int8)(unsafe.Pointer((pEntry + 24 /* &.d_name */)))) == '.' {
 21222  				if (int32(*(*int8)(unsafe.Pointer((pEntry + 24 /* &.d_name */) + 1))) == '.') && (int32(*(*int8)(unsafe.Pointer((pEntry + 24 /* &.d_name */) + 2))) == 0) {
 21223  					continue
 21224  				}
 21225  				if int32(*(*int8)(unsafe.Pointer((pEntry + 24 /* &.d_name */) + 1))) == 0 {
 21226  					continue
 21227  				}
 21228  			}
 21229  			sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 21230  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts+5067 /* "%s/%s" */, libc.VaList(bp+8, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir, pEntry+24 /* &.d_name */))
 21231  			if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0) {
 21232  				return SQLITE_NOMEM
 21233  			}
 21234  			if fileLinkStat(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, (pCur+40 /* &.sStat */)) != 0 {
 21235  				fsdirSetErrmsg(tls, pCur, ts+5073 /* "cannot stat file..." */, libc.VaList(bp+24, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 21236  				return SQLITE_ERROR
 21237  			}
 21238  			return SQLITE_OK
 21239  		}
 21240  		libc.Xclosedir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 21241  		sqlite3.Xsqlite3_free(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 21242  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir = uintptr(0)
 21243  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir = uintptr(0)
 21244  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl--
 21245  	}
 21246  
 21247  	// EOF
 21248  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 21249  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 21250  	return SQLITE_OK
 21251  }
 21252  
 21253  // Return values of columns for the row at which the series_cursor
 21254  // is currently pointing.
 21255  func fsdirColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* fileio.c:730:12: */
 21256  	bp := tls.Alloc(64)
 21257  	defer tls.Free(64)
 21258  
 21259  	var pCur uintptr = cur
 21260  	switch i {
 21261  	case FSDIR_COLUMN_NAME:
 21262  		{
 21263  			sqlite3.Xsqlite3_result_text(tls, ctx, ((*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase)), -1, libc.UintptrFromInt32(-1))
 21264  			break
 21265  
 21266  		}
 21267  
 21268  	case FSDIR_COLUMN_MODE:
 21269  		sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode))
 21270  		break
 21271  
 21272  	case FSDIR_COLUMN_MTIME:
 21273  		sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mtim.Ftv_sec))
 21274  		break
 21275  
 21276  	case FSDIR_COLUMN_DATA:
 21277  		{
 21278  			var m mode_t = (*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode
 21279  			if ((int32(m)) & 0170000) == 0040000 {
 21280  				sqlite3.Xsqlite3_result_null(tls, ctx)
 21281  			} else if ((int32(m)) & 0170000) == 0120000 {
 21282  				// var aStatic [64]int8 at bp, 64
 21283  
 21284  				var aBuf uintptr = bp /* aStatic */
 21285  				var nBuf sqlite3_int64 = int64(64)
 21286  				var n int32
 21287  
 21288  				for 1 != 0 {
 21289  					n = int32(libc.Xreadlink(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, aBuf, uint64(nBuf)))
 21290  					if sqlite3_int64(n) < nBuf {
 21291  						break
 21292  					}
 21293  					if aBuf != bp /* aStatic */ {
 21294  						sqlite3.Xsqlite3_free(tls, aBuf)
 21295  					}
 21296  					nBuf = (nBuf * int64(2))
 21297  					aBuf = sqlite3.Xsqlite3_malloc64(tls, uint64(nBuf))
 21298  					if aBuf == uintptr(0) {
 21299  						sqlite3.Xsqlite3_result_error_nomem(tls, ctx)
 21300  						return SQLITE_NOMEM
 21301  					}
 21302  				}
 21303  
 21304  				sqlite3.Xsqlite3_result_text(tls, ctx, aBuf, n, libc.UintptrFromInt32(-1))
 21305  				if aBuf != bp /* aStatic */ {
 21306  					sqlite3.Xsqlite3_free(tls, aBuf)
 21307  				}
 21308  			} else {
 21309  				readFileContents(tls, ctx, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 21310  			}
 21311  
 21312  		}
 21313  		fallthrough
 21314  	case FSDIR_COLUMN_PATH:
 21315  		fallthrough
 21316  	default:
 21317  		{
 21318  			// The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters.
 21319  			// always return their values as NULL
 21320  			break
 21321  
 21322  		}
 21323  	}
 21324  	return SQLITE_OK
 21325  }
 21326  
 21327  // Return the rowid for the current row. In this implementation, the
 21328  // first row returned is assigned rowid value 1, and each subsequent
 21329  // row a value 1 more than that of the previous.
 21330  func fsdirRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* fileio.c:795:12: */
 21331  	var pCur uintptr = cur
 21332  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid
 21333  	return SQLITE_OK
 21334  }
 21335  
 21336  // Return TRUE if the cursor has been moved off of the last
 21337  // row of output.
 21338  func fsdirEof(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:805:12: */
 21339  	var pCur uintptr = cur
 21340  	return (libc.Bool32((*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0)))
 21341  }
 21342  
 21343  // xFilter callback.
 21344  //
 21345  // idxNum==1   PATH parameter only
 21346  // idxNum==2   Both PATH and DIR supplied
 21347  func fsdirFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* fileio.c:816:12: */
 21348  	bp := tls.Alloc(32)
 21349  	defer tls.Free(32)
 21350  
 21351  	var zDir uintptr = uintptr(0)
 21352  	var pCur uintptr = cur
 21353  	_ = idxStr
 21354  	fsdirResetCursor(tls, pCur)
 21355  
 21356  	if idxNum == 0 {
 21357  		fsdirSetErrmsg(tls, pCur, ts+5094 /* "table function f..." */, 0)
 21358  		return SQLITE_ERROR
 21359  	}
 21360  
 21361  	zDir = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 21362  	if zDir == uintptr(0) {
 21363  		fsdirSetErrmsg(tls, pCur, ts+5136 /* "table function f..." */, 0)
 21364  		return SQLITE_ERROR
 21365  	}
 21366  	if argc == 2 {
 21367  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 21368  	}
 21369  	if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase != 0 {
 21370  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase = (int32(libc.Xstrlen(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase)) + 1)
 21371  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts+5067 /* "%s/%s" */, libc.VaList(bp, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase, zDir))
 21372  	} else {
 21373  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zDir))
 21374  	}
 21375  
 21376  	if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0) {
 21377  		return SQLITE_NOMEM
 21378  	}
 21379  	if fileLinkStat(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, (pCur+40 /* &.sStat */)) != 0 {
 21380  		fsdirSetErrmsg(tls, pCur, ts+5073 /* "cannot stat file..." */, libc.VaList(bp+24, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 21381  		return SQLITE_ERROR
 21382  	}
 21383  
 21384  	return SQLITE_OK
 21385  }
 21386  
 21387  // SQLite will invoke this method one or more times while planning a query
 21388  // that uses the generate_series virtual table.  This routine needs to create
 21389  // a query plan for each invocation and compute an estimated cost for that
 21390  // plan.
 21391  //
 21392  // In this implementation idxNum is used to represent the
 21393  // query plan.  idxStr is unused.
 21394  //
 21395  // The query plan is represented by values of idxNum:
 21396  //
 21397  //  (1)  The path value is supplied by argv[0]
 21398  //  (2)  Path is in argv[0] and dir is in argv[1]
 21399  func fsdirBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* fileio.c:872:12: */
 21400  	var i int32            // Loop over constraints
 21401  	var idxPath int32 = -1 // Index in pIdxInfo->aConstraint of PATH=
 21402  	var idxDir int32 = -1  // Index in pIdxInfo->aConstraint of DIR=
 21403  	var seenPath int32 = 0 // True if an unusable PATH= constraint is seen
 21404  	var seenDir int32 = 0  // True if an unusable DIR= constraint is seen
 21405  	var pConstraint uintptr
 21406  
 21407  	_ = tab
 21408  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 21409  	i = 0
 21410  __1:
 21411  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 21412  		goto __3
 21413  	}
 21414  	{
 21415  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 21416  			goto __2
 21417  		}
 21418  		switch (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn {
 21419  		case FSDIR_COLUMN_PATH:
 21420  			{
 21421  				if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable != 0 {
 21422  					idxPath = i
 21423  					seenPath = 0
 21424  				} else if idxPath < 0 {
 21425  					seenPath = 1
 21426  				}
 21427  				break
 21428  
 21429  			}
 21430  		case FSDIR_COLUMN_DIR:
 21431  			{
 21432  				if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable != 0 {
 21433  					idxDir = i
 21434  					seenDir = 0
 21435  				} else if idxDir < 0 {
 21436  					seenDir = 1
 21437  				}
 21438  				break
 21439  
 21440  			}
 21441  		}
 21442  
 21443  	}
 21444  	goto __2
 21445  __2:
 21446  	i++
 21447  	pConstraint += 12
 21448  	goto __1
 21449  	goto __3
 21450  __3:
 21451  	;
 21452  	if (seenPath != 0) || (seenDir != 0) {
 21453  		// If input parameters are unusable, disallow this plan
 21454  		return SQLITE_CONSTRAINT
 21455  	}
 21456  
 21457  	if idxPath < 0 {
 21458  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 21459  		// The pIdxInfo->estimatedCost should have been initialized to a huge
 21460  		// number.  Leave it unchanged.
 21461  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(0x7fffffff)
 21462  	} else {
 21463  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxPath)*8)).Fomit = uint8(1)
 21464  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxPath)*8)).FargvIndex = 1
 21465  		if idxDir >= 0 {
 21466  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxDir)*8)).Fomit = uint8(1)
 21467  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxDir)*8)).FargvIndex = 2
 21468  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2
 21469  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 21470  		} else {
 21471  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 21472  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 100.0
 21473  		}
 21474  	}
 21475  
 21476  	return SQLITE_OK
 21477  }
 21478  
 21479  // Register the "fsdir" virtual table.
 21480  func fsdirRegister(tls *libc.TLS, db uintptr) int32 { /* fileio.c:938:12: */
 21481  
 21482  	var rc int32 = sqlite3.Xsqlite3_create_module(tls, db, ts+5186 /* "fsdir" */, uintptr(unsafe.Pointer(&fsdirModule1)), uintptr(0))
 21483  	return rc
 21484  }
 21485  
 21486  var fsdirModule1 = sqlite3_module{ // xCreate
 21487  	FxConnect:    0, // xConnect
 21488  	FxBestIndex:  0, // xBestIndex
 21489  	FxDisconnect: 0, // xDestroy
 21490  	FxOpen:       0, // xOpen - open a cursor
 21491  	FxClose:      0, // xClose - close a cursor
 21492  	FxFilter:     0, // xFilter - configure scan constraints
 21493  	FxNext:       0, // xNext - advance a cursor
 21494  	FxEof:        0, // xEof - check for end of scan
 21495  	FxColumn:     0, // xColumn - read data
 21496  	FxRowid:      0, // xShadowName
 21497  } /* fileio.c:939:25 */
 21498  
 21499  func sqlite3_fileio_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* fileio.c:976:5: */
 21500  	var rc int32 = SQLITE_OK
 21501  	_ = pApi
 21502  
 21503  	_ = pzErrMsg // Unused parameter
 21504  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5192 /* "readfile" */, 1,
 21505  		(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 21506  		*(*uintptr)(unsafe.Pointer(&struct {
 21507  			f func(*libc.TLS, uintptr, int32, uintptr)
 21508  		}{readfileFunc})), uintptr(0), uintptr(0))
 21509  	if rc == SQLITE_OK {
 21510  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5201 /* "writefile" */, -1,
 21511  			(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 21512  			*(*uintptr)(unsafe.Pointer(&struct {
 21513  				f func(*libc.TLS, uintptr, int32, uintptr)
 21514  			}{writefileFunc})), uintptr(0), uintptr(0))
 21515  	}
 21516  	if rc == SQLITE_OK {
 21517  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5211 /* "lsmode" */, 1, SQLITE_UTF8, uintptr(0),
 21518  			*(*uintptr)(unsafe.Pointer(&struct {
 21519  				f func(*libc.TLS, uintptr, int32, uintptr)
 21520  			}{lsModeFunc})), uintptr(0), uintptr(0))
 21521  	}
 21522  	if rc == SQLITE_OK {
 21523  		rc = fsdirRegister(tls, db)
 21524  	}
 21525  	return rc
 21526  }
 21527  
 21528  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
 21529  // B.8.2.7 for the rationale behind the *_unlocked() macros.
 21530  
 21531  // Forward declaration of objects used by this implementation
 21532  type fuzzer_vtab1 = struct {
 21533  	Fbase       sqlite3_vtab
 21534  	FzClassName uintptr
 21535  	FpRule      uintptr
 21536  	FnCursor    int32
 21537  	_           [4]byte
 21538  } /* fuzzer.c:162:9 */
 21539  
 21540  // See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
 21541  // B.8.2.7 for the rationale behind the *_unlocked() macros.
 21542  
 21543  // Forward declaration of objects used by this implementation
 21544  type fuzzer_vtab = fuzzer_vtab1 /* fuzzer.c:162:28 */
 21545  type fuzzer_cursor1 = struct {
 21546  	Fbase     sqlite3_vtab_cursor
 21547  	FiRowid   sqlite3_int64
 21548  	FpVtab    uintptr
 21549  	FrLimit   fuzzer_cost
 21550  	_         [4]byte
 21551  	FpStem    uintptr
 21552  	FpDone    uintptr
 21553  	FaQueue   [20]uintptr
 21554  	FmxQueue  int32
 21555  	_         [4]byte
 21556  	FzBuf     uintptr
 21557  	FnBuf     int32
 21558  	FnStem    int32
 21559  	FiRuleset int32
 21560  	_         [4]byte
 21561  	FnullRule fuzzer_rule
 21562  	FapHash   [4001]uintptr
 21563  } /* fuzzer.c:163:9 */
 21564  
 21565  type fuzzer_cursor = fuzzer_cursor1 /* fuzzer.c:163:30 */
 21566  type fuzzer_rule1 = struct {
 21567  	FpNext    uintptr
 21568  	FzFrom    uintptr
 21569  	FrCost    fuzzer_cost
 21570  	FnFrom    fuzzer_len
 21571  	FnTo      fuzzer_len
 21572  	_         [2]byte
 21573  	FiRuleset fuzzer_ruleid
 21574  	FzTo      [4]int8
 21575  } /* fuzzer.c:162:9 */
 21576  
 21577  type fuzzer_rule = fuzzer_rule1 /* fuzzer.c:164:28 */
 21578  type fuzzer_stem1 = struct {
 21579  	FzBasis    uintptr
 21580  	FpRule     uintptr
 21581  	FpNext     uintptr
 21582  	FpHash     uintptr
 21583  	FrBaseCost fuzzer_cost
 21584  	FrCostX    fuzzer_cost
 21585  	FnBasis    fuzzer_len
 21586  	Fn         fuzzer_len
 21587  	_          [6]byte
 21588  } /* fuzzer.c:163:9 */
 21589  
 21590  type fuzzer_stem = fuzzer_stem1 /* fuzzer.c:166:28 */
 21591  
 21592  // Various types.
 21593  //
 21594  // fuzzer_cost is the "cost" of an edit operation.
 21595  //
 21596  // fuzzer_len is the length of a matching string.
 21597  //
 21598  // fuzzer_ruleid is an ruleset identifier.
 21599  type fuzzer_cost = int32   /* fuzzer.c:177:13 */
 21600  type fuzzer_len = int8     /* fuzzer.c:178:21 */
 21601  type fuzzer_ruleid = int32 /* fuzzer.c:179:13 */
 21602  
 21603  // The two input rule lists are both sorted in order of increasing
 21604  // cost.  Merge them together into a single list, sorted by cost, and
 21605  // return a pointer to the head of that list.
 21606  func fuzzerMergeRules(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* fuzzer.c:261:20: */
 21607  	bp := tls.Alloc(32)
 21608  	defer tls.Free(32)
 21609  
 21610  	// var head fuzzer_rule at bp, 32
 21611  
 21612  	var pTail uintptr
 21613  
 21614  	pTail = bp /* &head */
 21615  	for (pA != 0) && (pB != 0) {
 21616  		if (*fuzzer_rule)(unsafe.Pointer(pA)).FrCost <= (*fuzzer_rule)(unsafe.Pointer(pB)).FrCost {
 21617  			(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pA
 21618  			pTail = pA
 21619  			pA = (*fuzzer_rule)(unsafe.Pointer(pA)).FpNext
 21620  		} else {
 21621  			(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pB
 21622  			pTail = pB
 21623  			pB = (*fuzzer_rule)(unsafe.Pointer(pB)).FpNext
 21624  		}
 21625  	}
 21626  	if pA == uintptr(0) {
 21627  		(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pB
 21628  	} else {
 21629  		(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pA
 21630  	}
 21631  	return (*fuzzer_rule)(unsafe.Pointer(bp /* &head */)).FpNext
 21632  }
 21633  
 21634  // Statement pStmt currently points to a row in the fuzzer data table. This
 21635  // function allocates and populates a fuzzer_rule structure according to
 21636  // the content of the row.
 21637  //
 21638  // If successful, *ppRule is set to point to the new object and SQLITE_OK
 21639  // is returned. Otherwise, *ppRule is zeroed, *pzErr may be set to point
 21640  // to an error message and an SQLite error code returned.
 21641  func fuzzerLoadOneRule(tls *libc.TLS, p uintptr, pStmt uintptr, ppRule uintptr, pzErr uintptr) int32 { /* fuzzer.c:294:12: */
 21642  	bp := tls.Alloc(48)
 21643  	defer tls.Free(48)
 21644  
 21645  	var iRuleset sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 21646  	var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 21647  	var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 2)
 21648  	var nCost int32 = sqlite3.Xsqlite3_column_int(tls, pStmt, 3)
 21649  
 21650  	var rc int32 = SQLITE_OK       // Return code
 21651  	var nFrom int32                // Size of string zFrom, in bytes
 21652  	var nTo int32                  // Size of string zTo, in bytes
 21653  	var pRule uintptr = uintptr(0) // New rule object to return
 21654  
 21655  	if zFrom == uintptr(0) {
 21656  		zFrom = ts + 489 /* "" */
 21657  	}
 21658  	if zTo == uintptr(0) {
 21659  		zTo = ts + 489 /* "" */
 21660  	}
 21661  	nFrom = int32(libc.Xstrlen(tls, zFrom))
 21662  	nTo = int32(libc.Xstrlen(tls, zTo))
 21663  
 21664  	// Silently ignore null transformations
 21665  	if libc.Xstrcmp(tls, zFrom, zTo) == 0 {
 21666  		*(*uintptr)(unsafe.Pointer(ppRule)) = uintptr(0)
 21667  		return SQLITE_OK
 21668  	}
 21669  
 21670  	if (nCost <= 0) || (nCost > FUZZER_MX_COST) {
 21671  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3165, /* "%s: cost must be..." */
 21672  			libc.VaList(bp, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_COST))
 21673  		rc = SQLITE_ERROR
 21674  	} else if (nFrom > FUZZER_MX_LENGTH) || (nTo > FUZZER_MX_LENGTH) {
 21675  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3199, /* "%s: maximum stri..." */
 21676  			libc.VaList(bp+16, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_LENGTH))
 21677  		rc = SQLITE_ERROR
 21678  	} else if (iRuleset < int64(0)) || (iRuleset > int64(FUZZER_MX_RULEID)) {
 21679  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+5218, /* "%s: ruleset must..." */
 21680  			libc.VaList(bp+32, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_RULEID))
 21681  		rc = SQLITE_ERROR
 21682  	} else {
 21683  
 21684  		pRule = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(fuzzer_rule{})) + uint64(nFrom)) + uint64(nTo))))
 21685  		if pRule == uintptr(0) {
 21686  			rc = SQLITE_NOMEM
 21687  		} else {
 21688  			libc.Xmemset(tls, pRule, 0, uint64(unsafe.Sizeof(fuzzer_rule{})))
 21689  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom = pRule + 28 /* &.zTo */
 21690  			*(*uintptr)(unsafe.Pointer(pRule + 8 /* &.zFrom */)) += (uintptr(nTo + 1))
 21691  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom = fuzzer_len(nFrom)
 21692  			libc.Xmemcpy(tls, (*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom, zFrom, (uint64(nFrom + 1)))
 21693  			libc.Xmemcpy(tls, pRule+28 /* &.zTo */, zTo, (uint64(nTo + 1)))
 21694  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo = fuzzer_len(nTo)
 21695  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FrCost = nCost
 21696  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FiRuleset = int32(iRuleset)
 21697  		}
 21698  	}
 21699  
 21700  	*(*uintptr)(unsafe.Pointer(ppRule)) = pRule
 21701  	return rc
 21702  }
 21703  
 21704  // Load the content of the fuzzer data table into memory.
 21705  func fuzzerLoadRules(tls *libc.TLS, db uintptr, p uintptr, zDb uintptr, zData uintptr, pzErr uintptr) int32 { /* fuzzer.c:363:12: */
 21706  	bp := tls.Alloc(192)
 21707  	defer tls.Free(192)
 21708  
 21709  	var rc int32 = SQLITE_OK // Return code
 21710  	var zSql uintptr         // SELECT used to read from rules table
 21711  	var pHead uintptr = uintptr(0)
 21712  
 21713  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+3268 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zData))
 21714  	if zSql == uintptr(0) {
 21715  		rc = SQLITE_NOMEM
 21716  	} else {
 21717  		var rc2 int32 // finalize() return code
 21718  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0)
 21719  		rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+56 /* &pStmt */, uintptr(0))
 21720  		if rc != SQLITE_OK {
 21721  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3288 /* "%s: %s" */, libc.VaList(bp+16, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, sqlite3.Xsqlite3_errmsg(tls, db)))
 21722  		} else if sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != 4 {
 21723  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3295, /* "%s: %s has %d co..." */
 21724  				libc.VaList(bp+32, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, zData, sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))))
 21725  			rc = SQLITE_ERROR
 21726  		} else {
 21727  			for (rc == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))) {
 21728  				*(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)) = uintptr(0)
 21729  				rc = fuzzerLoadOneRule(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), bp+64 /* &pRule */, pzErr)
 21730  				if *(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)) != 0 {
 21731  					(*fuzzer_rule)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */)))).FpNext = pHead
 21732  					pHead = *(*uintptr)(unsafe.Pointer(bp + 64 /* pRule */))
 21733  				}
 21734  			}
 21735  		}
 21736  		rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 21737  		if rc == SQLITE_OK {
 21738  			rc = rc2
 21739  		}
 21740  	}
 21741  	sqlite3.Xsqlite3_free(tls, zSql)
 21742  
 21743  	// All rules are now in a singly linked list starting at pHead. This
 21744  	// block sorts them by cost and then sets fuzzer_vtab.pRule to point to
 21745  	// point to the head of the sorted list.
 21746  	if rc == SQLITE_OK {
 21747  		var i uint32
 21748  		var pX uintptr
 21749  		// var a [15]uintptr at bp+72, 120
 21750  
 21751  		for i = uint32(0); uint64(i) < (uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 21752  			*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = uintptr(0)
 21753  		}
 21754  		for (libc.AssignUintptr(&pX, pHead)) != uintptr(0) {
 21755  			pHead = (*fuzzer_rule)(unsafe.Pointer(pX)).FpNext
 21756  			(*fuzzer_rule)(unsafe.Pointer(pX)).FpNext = uintptr(0)
 21757  			for i = uint32(0); (*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) != 0) && (uint64(i) < ((uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))) - uint64(1))); i++ {
 21758  				pX = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 21759  				*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = uintptr(0)
 21760  			}
 21761  			*(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)) = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 21762  		}
 21763  		pX = *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */))
 21764  		i = uint32(1)
 21765  		for ; uint64(i) < (uint64(unsafe.Sizeof([15]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 21766  			pX = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* &a[0] */ + uintptr(i)*8)), pX)
 21767  		}
 21768  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = fuzzerMergeRules(tls, (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule, pX)
 21769  	} else {
 21770  		// An error has occurred. Setting p->pRule to point to the head of the
 21771  		// allocated list ensures that the list will be cleaned up in this case.
 21772  
 21773  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = pHead
 21774  	}
 21775  
 21776  	return rc
 21777  }
 21778  
 21779  // This function converts an SQL quoted string into an unquoted string
 21780  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 21781  // containing the result. The caller should eventually free this buffer
 21782  // using sqlite3_free.
 21783  //
 21784  // Examples:
 21785  //
 21786  //     "abc"   becomes   abc
 21787  //     'xyz'   becomes   xyz
 21788  //     [pqr]   becomes   pqr
 21789  //     `mno`   becomes   mno
 21790  func fuzzerDequote(tls *libc.TLS, zIn uintptr) uintptr { /* fuzzer.c:449:13: */
 21791  	var nIn sqlite3_int64 // Size of input string, in bytes
 21792  	var zOut uintptr      // Output (dequoted) string
 21793  
 21794  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 21795  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 21796  	if zOut != 0 {
 21797  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 21798  
 21799  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 21800  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 21801  		} else {
 21802  			var iOut int32 = 0 // Index of next byte to write to output
 21803  			var iIn int32      // Index of next byte to read from input
 21804  
 21805  			if int32(q) == '[' {
 21806  				q = int8(']')
 21807  			}
 21808  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 21809  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 21810  					iIn++
 21811  				}
 21812  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 21813  			}
 21814  		}
 21815  
 21816  	}
 21817  	return zOut
 21818  }
 21819  
 21820  // xDisconnect/xDestroy method for the fuzzer module.
 21821  func fuzzerDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* fuzzer.c:478:12: */
 21822  	var p uintptr = pVtab
 21823  
 21824  	for (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule != 0 {
 21825  		var pRule uintptr = (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule
 21826  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 21827  		sqlite3.Xsqlite3_free(tls, pRule)
 21828  	}
 21829  	sqlite3.Xsqlite3_free(tls, p)
 21830  	return SQLITE_OK
 21831  }
 21832  
 21833  // xConnect/xCreate method for the fuzzer module. Arguments are:
 21834  //
 21835  //   argv[0]   -> module name  ("fuzzer")
 21836  //   argv[1]   -> database name
 21837  //   argv[2]   -> table name
 21838  //   argv[3]   -> fuzzer rule table name
 21839  func fuzzerConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fuzzer.c:498:12: */
 21840  	bp := tls.Alloc(8)
 21841  	defer tls.Free(8)
 21842  
 21843  	var rc int32 = SQLITE_OK      // Return code
 21844  	var pNew uintptr = uintptr(0) // New virtual table
 21845  	var zModule uintptr = *(*uintptr)(unsafe.Pointer(argv))
 21846  	var zDb uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 21847  
 21848  	if argc != 4 {
 21849  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 21850  			ts+5255 /* "%s: wrong number..." */, libc.VaList(bp, zModule))
 21851  		rc = SQLITE_ERROR
 21852  	} else {
 21853  		var nModule sqlite3_int64 // Length of zModule, in bytes
 21854  
 21855  		nModule = sqlite3_int64(libc.Xstrlen(tls, zModule))
 21856  		pNew = sqlite3.Xsqlite3_malloc64(tls, ((uint64(unsafe.Sizeof(fuzzer_vtab{})) + uint64(nModule)) + uint64(1)))
 21857  		if pNew == uintptr(0) {
 21858  			rc = SQLITE_NOMEM
 21859  		} else {
 21860  			var zTab uintptr // Dequoted name of fuzzer data table
 21861  
 21862  			libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(fuzzer_vtab{})))
 21863  			(*fuzzer_vtab)(unsafe.Pointer(pNew)).FzClassName = (pNew + 1*48)
 21864  			libc.Xmemcpy(tls, (*fuzzer_vtab)(unsafe.Pointer(pNew)).FzClassName, zModule, (size_t(nModule + int64(1))))
 21865  
 21866  			zTab = fuzzerDequote(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 21867  			if zTab == uintptr(0) {
 21868  				rc = SQLITE_NOMEM
 21869  			} else {
 21870  				rc = fuzzerLoadRules(tls, db, pNew, zDb, zTab, pzErr)
 21871  				sqlite3.Xsqlite3_free(tls, zTab)
 21872  			}
 21873  
 21874  			if rc == SQLITE_OK {
 21875  				rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+5306 /* "CREATE TABLE x(w..." */)
 21876  			}
 21877  			if rc != SQLITE_OK {
 21878  				fuzzerDisconnect(tls, pNew)
 21879  				pNew = uintptr(0)
 21880  			} else {
 21881  				sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 21882  			}
 21883  		}
 21884  	}
 21885  
 21886  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 21887  	return rc
 21888  }
 21889  
 21890  // Open a new fuzzer cursor.
 21891  func fuzzerOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* fuzzer.c:556:12: */
 21892  	var p uintptr = pVTab
 21893  	var pCur uintptr
 21894  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fuzzer_cursor{})))
 21895  	if pCur == uintptr(0) {
 21896  		return SQLITE_NOMEM
 21897  	}
 21898  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(fuzzer_cursor{})))
 21899  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 21900  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 21901  	(*fuzzer_vtab)(unsafe.Pointer(p)).FnCursor++
 21902  	return SQLITE_OK
 21903  }
 21904  
 21905  // Free all stems in a list.
 21906  func fuzzerClearStemList(tls *libc.TLS, pStem uintptr) { /* fuzzer.c:571:13: */
 21907  	for pStem != 0 {
 21908  		var pNext uintptr = (*fuzzer_stem)(unsafe.Pointer(pStem)).FpNext
 21909  		sqlite3.Xsqlite3_free(tls, pStem)
 21910  		pStem = pNext
 21911  	}
 21912  }
 21913  
 21914  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 21915  // to indicate that it is at EOF.
 21916  func fuzzerClearCursor(tls *libc.TLS, pCur uintptr, clearHash int32) { /* fuzzer.c:583:13: */
 21917  	var i int32
 21918  	fuzzerClearStemList(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)
 21919  	fuzzerClearStemList(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone)
 21920  	for i = 0; i < FUZZER_NQUEUE; i++ {
 21921  		fuzzerClearStemList(tls, *(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)))
 21922  	}
 21923  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 21924  	if (clearHash != 0) && ((*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem != 0) {
 21925  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue = 0
 21926  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 21927  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = uintptr(0)
 21928  		libc.Xmemset(tls, pCur+48 /* &.aQueue */, 0, uint64(unsafe.Sizeof([20]uintptr{})))
 21929  		libc.Xmemset(tls, pCur+272 /* &.apHash */, 0, uint64(unsafe.Sizeof([4001]uintptr{})))
 21930  	}
 21931  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem = 0
 21932  }
 21933  
 21934  // Close a fuzzer cursor.
 21935  func fuzzerClose(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:602:12: */
 21936  	var pCur uintptr = cur
 21937  	fuzzerClearCursor(tls, pCur, 0)
 21938  	sqlite3.Xsqlite3_free(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf)
 21939  	(*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 21940  	sqlite3.Xsqlite3_free(tls, pCur)
 21941  	return SQLITE_OK
 21942  }
 21943  
 21944  // Compute the current output term for a fuzzer_stem.
 21945  func fuzzerRender(tls *libc.TLS, pStem uintptr, pzBuf uintptr, pnBuf uintptr) int32 { /* fuzzer.c:614:12: */
 21946  	var pRule uintptr = (*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule
 21947  	var n int32   // Size of output term without nul-term
 21948  	var z uintptr // Buffer to assemble output term in
 21949  
 21950  	n = ((int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) + int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo)) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom))
 21951  	if (*(*int32)(unsafe.Pointer(pnBuf))) < (n + 1) {
 21952  		(*(*uintptr)(unsafe.Pointer(pzBuf))) = sqlite3.Xsqlite3_realloc(tls, *(*uintptr)(unsafe.Pointer(pzBuf)), (n + 100))
 21953  		if (*(*uintptr)(unsafe.Pointer(pzBuf))) == uintptr(0) {
 21954  			return SQLITE_NOMEM
 21955  		}
 21956  		(*(*int32)(unsafe.Pointer(pnBuf))) = (n + 100)
 21957  	}
 21958  	n = int32((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn)
 21959  	z = *(*uintptr)(unsafe.Pointer(pzBuf))
 21960  	if n < 0 {
 21961  		libc.Xmemcpy(tls, z, (*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis, (uint64(int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) + 1)))
 21962  	} else {
 21963  		libc.Xmemcpy(tls, z, (*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis, uint64(n))
 21964  		libc.Xmemcpy(tls, (z + uintptr(n)), pRule+28 /* &.zTo */, uint64((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo))
 21965  		libc.Xmemcpy(tls, (z + uintptr((n + int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo)))), ((*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis + uintptr((n + int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)))),
 21966  			(uint64(((int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) - n) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) + 1)))
 21967  	}
 21968  
 21969  	return SQLITE_OK
 21970  }
 21971  
 21972  // Compute a hash on zBasis.
 21973  func fuzzerHash(tls *libc.TLS, z uintptr) uint32 { /* fuzzer.c:647:21: */
 21974  	var h uint32 = uint32(0)
 21975  	for *(*int8)(unsafe.Pointer(z)) != 0 {
 21976  		h = (((h << 3) ^ (h >> 29)) ^ uint32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))
 21977  	}
 21978  	return (h % uint32(FUZZER_HASH))
 21979  }
 21980  
 21981  // Current cost of a stem
 21982  func fuzzerCost(tls *libc.TLS, pStem uintptr) fuzzer_cost { /* fuzzer.c:656:20: */
 21983  	return libc.AssignPtrInt32(pStem+36 /* &.rCostX */, ((*fuzzer_stem)(unsafe.Pointer(pStem)).FrBaseCost + (*fuzzer_rule)(unsafe.Pointer((*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule)).FrCost))
 21984  }
 21985  
 21986  // Return 1 if the string to which the cursor is point has already
 21987  // been emitted.  Return 0 if not.  Return -1 on a memory allocation
 21988  // failures.
 21989  func fuzzerSeen(tls *libc.TLS, pCur uintptr, pStem uintptr) int32 { /* fuzzer.c:694:12: */
 21990  	var h uint32
 21991  	var pLookup uintptr
 21992  
 21993  	if fuzzerRender(tls, pStem, (pCur+216 /* &.zBuf */), (pCur+224 /* &.nBuf */)) == SQLITE_NOMEM {
 21994  		return -1
 21995  	}
 21996  	h = fuzzerHash(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf)
 21997  	pLookup = *(*uintptr)(unsafe.Pointer((pCur + 272 /* &.apHash */) + uintptr(h)*8))
 21998  	for (pLookup != 0) && (libc.Xstrcmp(tls, (*fuzzer_stem)(unsafe.Pointer(pLookup)).FzBasis, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf) != 0) {
 21999  		pLookup = (*fuzzer_stem)(unsafe.Pointer(pLookup)).FpHash
 22000  	}
 22001  	return (libc.Bool32(pLookup != uintptr(0)))
 22002  }
 22003  
 22004  // If argument pRule is NULL, this function returns false.
 22005  //
 22006  // Otherwise, it returns true if rule pRule should be skipped. A rule
 22007  // should be skipped if it does not belong to rule-set iRuleset, or if
 22008  // applying it to stem pStem would create a string longer than
 22009  // FUZZER_MX_OUTPUT_LENGTH bytes.
 22010  func fuzzerSkipRule(tls *libc.TLS, pRule uintptr, pStem uintptr, iRuleset int32) int32 { /* fuzzer.c:717:12: */
 22011  	return (libc.Bool32((pRule != 0) && (((*fuzzer_rule)(unsafe.Pointer(pRule)).FiRuleset != iRuleset) ||
 22012  		(((int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) + int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo)) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) > FUZZER_MX_OUTPUT_LENGTH))))
 22013  }
 22014  
 22015  // Advance a fuzzer_stem to its next value.   Return 0 if there are
 22016  // no more values that can be generated by this fuzzer_stem.  Return
 22017  // -1 on a memory allocation failure.
 22018  func fuzzerAdvance(tls *libc.TLS, pCur uintptr, pStem uintptr) int32 { /* fuzzer.c:733:12: */
 22019  	var pRule uintptr
 22020  	for (libc.AssignUintptr(&pRule, (*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule)) != uintptr(0) {
 22021  
 22022  		for int32((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn) < (int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) {
 22023  			(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn++
 22024  			if (int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom) == 0) ||
 22025  				(libc.Xmemcmp(tls, ((*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis+uintptr((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn)), (*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom, uint64((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) == 0) {
 22026  				// Found a rewrite case.  Make sure it is not a duplicate
 22027  				var rc int32 = fuzzerSeen(tls, pCur, pStem)
 22028  				if rc < 0 {
 22029  					return -1
 22030  				}
 22031  				if rc == 0 {
 22032  					fuzzerCost(tls, pStem)
 22033  					return 1
 22034  				}
 22035  			}
 22036  		}
 22037  		(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn = int8(-1)
 22038  		for ok := true; ok; ok = fuzzerSkipRule(tls, pRule, pStem, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset) != 0 {
 22039  			pRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 22040  		}
 22041  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = pRule
 22042  		if (pRule != 0) && (fuzzerCost(tls, pStem) > (*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit) {
 22043  			(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = uintptr(0)
 22044  		}
 22045  	}
 22046  	return 0
 22047  }
 22048  
 22049  // The two input stem lists are both sorted in order of increasing
 22050  // rCostX.  Merge them together into a single list, sorted by rCostX, and
 22051  // return a pointer to the head of that new list.
 22052  func fuzzerMergeStems(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* fuzzer.c:766:20: */
 22053  	bp := tls.Alloc(48)
 22054  	defer tls.Free(48)
 22055  
 22056  	// var head fuzzer_stem at bp, 48
 22057  
 22058  	var pTail uintptr
 22059  
 22060  	pTail = bp /* &head */
 22061  	for (pA != 0) && (pB != 0) {
 22062  		if (*fuzzer_stem)(unsafe.Pointer(pA)).FrCostX <= (*fuzzer_stem)(unsafe.Pointer(pB)).FrCostX {
 22063  			(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pA
 22064  			pTail = pA
 22065  			pA = (*fuzzer_stem)(unsafe.Pointer(pA)).FpNext
 22066  		} else {
 22067  			(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pB
 22068  			pTail = pB
 22069  			pB = (*fuzzer_stem)(unsafe.Pointer(pB)).FpNext
 22070  		}
 22071  	}
 22072  	if pA == uintptr(0) {
 22073  		(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pB
 22074  	} else {
 22075  		(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pA
 22076  	}
 22077  	return (*fuzzer_stem)(unsafe.Pointer(bp /* &head */)).FpNext
 22078  }
 22079  
 22080  // Load pCur->pStem with the lowest-cost stem.  Return a pointer
 22081  // to the lowest-cost stem.
 22082  func fuzzerLowestCostStem(tls *libc.TLS, pCur uintptr) uintptr { /* fuzzer.c:794:20: */
 22083  	var pBest uintptr
 22084  	var pX uintptr
 22085  	var iBest int32
 22086  	var i int32
 22087  
 22088  	if (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem == uintptr(0) {
 22089  		iBest = -1
 22090  		pBest = uintptr(0)
 22091  		for i = 0; i <= (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue; i++ {
 22092  			pX = *(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8))
 22093  			if pX == uintptr(0) {
 22094  				continue
 22095  			}
 22096  			if (pBest == uintptr(0)) || ((*fuzzer_stem)(unsafe.Pointer(pBest)).FrCostX > (*fuzzer_stem)(unsafe.Pointer(pX)).FrCostX) {
 22097  				pBest = pX
 22098  				iBest = i
 22099  			}
 22100  		}
 22101  		if pBest != 0 {
 22102  			*(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(iBest)*8)) = (*fuzzer_stem)(unsafe.Pointer(pBest)).FpNext
 22103  			(*fuzzer_stem)(unsafe.Pointer(pBest)).FpNext = uintptr(0)
 22104  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = pBest
 22105  		}
 22106  	}
 22107  	return (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem
 22108  }
 22109  
 22110  // Insert pNew into queue of pending stems.  Then find the stem
 22111  // with the lowest rCostX and move it into pCur->pStem.
 22112  // list.  The insert is done such the pNew is in the correct order
 22113  // according to fuzzer_stem.zBaseCost+fuzzer_stem.pRule->rCost.
 22114  func fuzzerInsert(tls *libc.TLS, pCur uintptr, pNew uintptr) uintptr { /* fuzzer.c:825:20: */
 22115  	var pX uintptr
 22116  	var i int32
 22117  
 22118  	// If pCur->pStem exists and is greater than pNew, then make pNew
 22119  	// the new pCur->pStem and insert the old pCur->pStem instead.
 22120  	if ((libc.AssignUintptr(&pX, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)) != uintptr(0)) && ((*fuzzer_stem)(unsafe.Pointer(pX)).FrCostX > (*fuzzer_stem)(unsafe.Pointer(pNew)).FrCostX) {
 22121  		(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = uintptr(0)
 22122  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = pNew
 22123  		pNew = pX
 22124  	}
 22125  
 22126  	// Insert the new value
 22127  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = uintptr(0)
 22128  	pX = pNew
 22129  	for i = 0; i <= (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue; i++ {
 22130  		if *(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)) != 0 {
 22131  			pX = fuzzerMergeStems(tls, pX, *(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)))
 22132  			*(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)) = uintptr(0)
 22133  		} else {
 22134  			*(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)) = pX
 22135  			break
 22136  		}
 22137  	}
 22138  	if i > (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue {
 22139  		if i < FUZZER_NQUEUE {
 22140  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue = i
 22141  			*(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + uintptr(i)*8)) = pX
 22142  		} else {
 22143  
 22144  			pX = fuzzerMergeStems(tls, pX, *(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + 19*8)))
 22145  			*(*uintptr)(unsafe.Pointer((pCur + 48 /* &.aQueue */) + 19*8)) = pX
 22146  		}
 22147  	}
 22148  
 22149  	return fuzzerLowestCostStem(tls, pCur)
 22150  }
 22151  
 22152  // Allocate a new fuzzer_stem.  Add it to the hash table but do not
 22153  // link it into either the pCur->pStem or pCur->pDone lists.
 22154  func fuzzerNewStem(tls *libc.TLS, pCur uintptr, zWord uintptr, rBaseCost fuzzer_cost) uintptr { /* fuzzer.c:868:20: */
 22155  	var pNew uintptr
 22156  	var pRule uintptr
 22157  	var h uint32
 22158  
 22159  	pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(fuzzer_stem{})) + libc.Xstrlen(tls, zWord)) + uint64(1))))
 22160  	if pNew == uintptr(0) {
 22161  		return uintptr(0)
 22162  	}
 22163  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(fuzzer_stem{})))
 22164  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis = (pNew + 1*48)
 22165  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FnBasis = fuzzer_len(libc.Xstrlen(tls, zWord))
 22166  	libc.Xmemcpy(tls, (*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis, zWord, (uint64(int32((*fuzzer_stem)(unsafe.Pointer(pNew)).FnBasis) + 1)))
 22167  	pRule = (*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FpRule
 22168  	for fuzzerSkipRule(tls, pRule, pNew, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset) != 0 {
 22169  		pRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 22170  	}
 22171  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpRule = pRule
 22172  	(*fuzzer_stem)(unsafe.Pointer(pNew)).Fn = int8(-1)
 22173  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FrBaseCost = libc.AssignPtrInt32(pNew+36 /* &.rCostX */, rBaseCost)
 22174  	h = fuzzerHash(tls, (*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis)
 22175  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpHash = *(*uintptr)(unsafe.Pointer((pCur + 272 /* &.apHash */) + uintptr(h)*8))
 22176  	*(*uintptr)(unsafe.Pointer((pCur + 272 /* &.apHash */) + uintptr(h)*8)) = pNew
 22177  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem++
 22178  	return pNew
 22179  }
 22180  
 22181  // Advance a cursor to its next row of output
 22182  func fuzzerNext(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:901:12: */
 22183  	var pCur uintptr = cur
 22184  	var rc int32
 22185  	var pStem uintptr
 22186  	var pNew uintptr
 22187  
 22188  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid++
 22189  
 22190  	// Use the element the cursor is currently point to to create
 22191  	// a new stem and insert the new stem into the priority queue.
 22192  	pStem = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem
 22193  	if (*fuzzer_stem)(unsafe.Pointer(pStem)).FrCostX > 0 {
 22194  		rc = fuzzerRender(tls, pStem, (pCur + 216 /* &.zBuf */), (pCur + 224 /* &.nBuf */))
 22195  		if rc == SQLITE_NOMEM {
 22196  			return SQLITE_NOMEM
 22197  		}
 22198  		pNew = fuzzerNewStem(tls, pCur, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf, (*fuzzer_stem)(unsafe.Pointer(pStem)).FrCostX)
 22199  		if pNew != 0 {
 22200  			if fuzzerAdvance(tls, pCur, pNew) == 0 {
 22201  				(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone
 22202  				(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = pNew
 22203  			} else {
 22204  				if fuzzerInsert(tls, pCur, pNew) == pNew {
 22205  					return SQLITE_OK
 22206  				}
 22207  			}
 22208  		} else {
 22209  			return SQLITE_NOMEM
 22210  		}
 22211  	}
 22212  
 22213  	// Adjust the priority queue so that the first element of the
 22214  	// stem list is the next lowest cost word.
 22215  	for (libc.AssignUintptr(&pStem, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)) != uintptr(0) {
 22216  		var res int32 = fuzzerAdvance(tls, pCur, pStem)
 22217  		if res < 0 {
 22218  			return SQLITE_NOMEM
 22219  		} else if res > 0 {
 22220  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 22221  			pStem = fuzzerInsert(tls, pCur, pStem)
 22222  			if (libc.AssignInt32(&rc, fuzzerSeen(tls, pCur, pStem))) != 0 {
 22223  				if rc < 0 {
 22224  					return SQLITE_NOMEM
 22225  				}
 22226  				continue
 22227  			}
 22228  			return SQLITE_OK // New word found
 22229  		}
 22230  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 22231  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpNext = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone
 22232  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = pStem
 22233  		if fuzzerLowestCostStem(tls, pCur) != 0 {
 22234  			rc = fuzzerSeen(tls, pCur, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)
 22235  			if rc < 0 {
 22236  				return SQLITE_NOMEM
 22237  			}
 22238  			if rc == 0 {
 22239  				return SQLITE_OK
 22240  			}
 22241  		}
 22242  	}
 22243  
 22244  	// Reach this point only if queue has been exhausted and there is
 22245  	// nothing left to be output.
 22246  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 22247  	return SQLITE_OK
 22248  }
 22249  
 22250  // Called to "rewind" a cursor back to the beginning so that
 22251  // it starts its output over again.  Always called at least once
 22252  // prior to any fuzzerColumn, fuzzerRowid, or fuzzerEof call.
 22253  func fuzzerFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* fuzzer.c:969:12: */
 22254  	var pCur uintptr = pVtabCursor
 22255  	var zWord uintptr = ts + 489 /* "" */
 22256  	var pStem uintptr
 22257  	var idx int32
 22258  
 22259  	fuzzerClearCursor(tls, pCur, 1)
 22260  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 2147483647
 22261  	idx = 0
 22262  	if (idxNum & 1) != 0 {
 22263  		zWord = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22264  		idx++
 22265  	}
 22266  	if (idxNum & 2) != 0 {
 22267  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*8)))
 22268  		idx++
 22269  	}
 22270  	if (idxNum & 4) != 0 {
 22271  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*8)))
 22272  		idx++
 22273  	}
 22274  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FpNext = (*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FpRule
 22275  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FrCost = 0
 22276  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FnFrom = int8(0)
 22277  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FnTo = int8(0)
 22278  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FzFrom = ts + 489 /* "" */
 22279  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 22280  
 22281  	// If the query term is longer than FUZZER_MX_OUTPUT_LENGTH bytes, this
 22282  	// query will return zero rows.
 22283  	if int32(libc.Xstrlen(tls, zWord)) < FUZZER_MX_OUTPUT_LENGTH {
 22284  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = libc.AssignUintptr(&pStem, fuzzerNewStem(tls, pCur, zWord, 0))
 22285  		if pStem == uintptr(0) {
 22286  			return SQLITE_NOMEM
 22287  		}
 22288  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = (pCur + 240 /* &.nullRule */)
 22289  		(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn = (*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis
 22290  	} else {
 22291  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 22292  	}
 22293  
 22294  	return SQLITE_OK
 22295  }
 22296  
 22297  // Only the word and distance columns have values.  All other columns
 22298  // return NULL
 22299  func fuzzerColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* fuzzer.c:1020:12: */
 22300  	var pCur uintptr = cur
 22301  	if i == 0 {
 22302  		// the "word" column
 22303  		if fuzzerRender(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem, (pCur+216 /* &.zBuf */), (pCur+224 /* &.nBuf */)) == SQLITE_NOMEM {
 22304  			return SQLITE_NOMEM
 22305  		}
 22306  		sqlite3.Xsqlite3_result_text(tls, ctx, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf, -1, libc.UintptrFromInt32(-1))
 22307  	} else if i == 1 {
 22308  		// the "distance" column
 22309  		sqlite3.Xsqlite3_result_int(tls, ctx, (*fuzzer_stem)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)).FrCostX)
 22310  	} else {
 22311  		// All other columns are NULL
 22312  		sqlite3.Xsqlite3_result_null(tls, ctx)
 22313  	}
 22314  	return SQLITE_OK
 22315  }
 22316  
 22317  // The rowid.
 22318  func fuzzerRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* fuzzer.c:1041:12: */
 22319  	var pCur uintptr = cur
 22320  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid
 22321  	return SQLITE_OK
 22322  }
 22323  
 22324  // When the fuzzer_cursor.rLimit value is 0 or less, that is a signal
 22325  // that the cursor has nothing more to output.
 22326  func fuzzerEof(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:1051:12: */
 22327  	var pCur uintptr = cur
 22328  	return (libc.Bool32((*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit <= 0))
 22329  }
 22330  
 22331  // Search for terms of these forms:
 22332  //
 22333  //   (A)    word MATCH $str
 22334  //   (B1)   distance < $value
 22335  //   (B2)   distance <= $value
 22336  //   (C)    ruleid == $ruleid
 22337  //
 22338  // The distance< and distance<= are both treated as distance<=.
 22339  // The query plan number is a bit vector:
 22340  //
 22341  //   bit 1:   Term of the form (A) found
 22342  //   bit 2:   Term like (B1) or (B2) found
 22343  //   bit 3:   Term like (C) found
 22344  //
 22345  // If bit-1 is set, $str is always in filter.argv[0].  If bit-2 is set
 22346  // then $value is in filter.argv[0] if bit-1 is clear and is in
 22347  // filter.argv[1] if bit-1 is set.  If bit-3 is set, then $ruleid is
 22348  // in filter.argv[0] if bit-1 and bit-2 are both zero, is in
 22349  // filter.argv[1] if exactly one of bit-1 and bit-2 are set, and is in
 22350  // filter.argv[2] if both bit-1 and bit-2 are set.
 22351  func fuzzerBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* fuzzer.c:1078:12: */
 22352  	var iPlan int32 = 0
 22353  	var iDistTerm int32 = -1
 22354  	var iRulesetTerm int32 = -1
 22355  	var i int32
 22356  	var seenMatch int32 = 0
 22357  	var pConstraint uintptr
 22358  	var rCost float64 = 1e12
 22359  
 22360  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 22361  	i = 0
 22362  __1:
 22363  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 22364  		goto __3
 22365  	}
 22366  	{
 22367  		if ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0) &&
 22368  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 22369  			seenMatch = 1
 22370  		}
 22371  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 22372  			goto __2
 22373  		}
 22374  		if (((iPlan & 1) == 0) &&
 22375  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0)) &&
 22376  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 22377  			iPlan = iPlan | (1)
 22378  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 22379  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 22380  			rCost = rCost / (1e6)
 22381  		}
 22382  		if (((iPlan & 2) == 0) &&
 22383  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 1)) &&
 22384  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 22385  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 22386  			iPlan = iPlan | (2)
 22387  			iDistTerm = i
 22388  			rCost = rCost / (10.0)
 22389  		}
 22390  		if (((iPlan & 4) == 0) &&
 22391  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 2)) &&
 22392  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 22393  			iPlan = iPlan | (4)
 22394  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 22395  			iRulesetTerm = i
 22396  			rCost = rCost / (10.0)
 22397  		}
 22398  
 22399  	}
 22400  	goto __2
 22401  __2:
 22402  	i++
 22403  	pConstraint += 12
 22404  	goto __1
 22405  	goto __3
 22406  __3:
 22407  	;
 22408  	if (iPlan & 2) != 0 {
 22409  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = (1 + (libc.Bool32((iPlan & 1) != 0)))
 22410  	}
 22411  	if (iPlan & 4) != 0 {
 22412  		var idx int32 = 1
 22413  		if (iPlan & 1) != 0 {
 22414  			idx++
 22415  		}
 22416  		if (iPlan & 2) != 0 {
 22417  			idx++
 22418  		}
 22419  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRulesetTerm)*8)).FargvIndex = idx
 22420  	}
 22421  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 22422  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 22423  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == 1)) &&
 22424  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 22425  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 22426  	}
 22427  	if (seenMatch != 0) && ((iPlan & 1) == 0) {
 22428  		rCost = 1e99
 22429  	}
 22430  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = rCost
 22431  
 22432  	return SQLITE_OK
 22433  }
 22434  
 22435  // A virtual table module that implements the "fuzzer".
 22436  var fuzzerModule = sqlite3_module{ // iVersion
 22437  	FxCreate:     0,
 22438  	FxConnect:    0,
 22439  	FxBestIndex:  0,
 22440  	FxDisconnect: 0,
 22441  	FxDestroy:    0,
 22442  	FxOpen:       0, // xOpen - open a cursor
 22443  	FxClose:      0, // xClose - close a cursor
 22444  	FxFilter:     0, // xFilter - configure scan constraints
 22445  	FxNext:       0, // xNext - advance a cursor
 22446  	FxEof:        0, // xEof - check for end of scan
 22447  	FxColumn:     0, // xColumn - read data
 22448  	FxRowid:      0, // xRename
 22449  } /* fuzzer.c:1147:23 */
 22450  
 22451  func sqlite3_fuzzer_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* fuzzer.c:1176:5: */
 22452  	var rc int32 = SQLITE_OK
 22453  	_ = pApi
 22454  
 22455  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+5344 /* "fuzzer" */, uintptr(unsafe.Pointer(&fuzzerModule)), uintptr(0))
 22456  	return rc
 22457  }
 22458  
 22459  // Mark a function parameter as unused, to suppress nuisance compiler
 22460  // warnings.
 22461  
 22462  // Implementation of the ieee754() function
 22463  func ieee754func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:102:13: */
 22464  	bp := tls.Alloc(160)
 22465  	defer tls.Free(160)
 22466  
 22467  	if argc == 1 {
 22468  		var m sqlite3_int64
 22469  		// var a sqlite3_int64 at bp+32, 8
 22470  
 22471  		// var r float64 at bp+16, 8
 22472  
 22473  		var e int32
 22474  		var isNeg int32
 22475  		// var zResult [100]int8 at bp+40, 100
 22476  
 22477  		if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB) &&
 22478  			(uint64(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) == uint64(unsafe.Sizeof(float64(0)))) {
 22479  			var x uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22480  			var i uint32
 22481  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) = uint64(0)
 22482  			for i = uint32(0); uint64(i) < uint64(unsafe.Sizeof(float64(0))); i++ {
 22483  				*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) << 8) | sqlite3_uint64(*(*uint8)(unsafe.Pointer(x + uintptr(i)))))
 22484  			}
 22485  			libc.Xmemcpy(tls, bp+16 /* &r */, bp+24 /* &v */, uint64(unsafe.Sizeof(float64(0))))
 22486  		} else {
 22487  			*(*float64)(unsafe.Pointer(bp + 16 /* r */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22488  		}
 22489  		if *(*float64)(unsafe.Pointer(bp + 16 /* r */)) < 0.0 {
 22490  			isNeg = 1
 22491  			*(*float64)(unsafe.Pointer(bp + 16 /* r */)) = -*(*float64)(unsafe.Pointer(bp + 16 /* r */))
 22492  		} else {
 22493  			isNeg = 0
 22494  		}
 22495  		libc.Xmemcpy(tls, bp+32 /* &a */, bp+16 /* &r */, uint64(unsafe.Sizeof(sqlite3_int64(0))))
 22496  		if *(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) == int64(0) {
 22497  			e = 0
 22498  			m = int64(0)
 22499  		} else {
 22500  			e = (int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) >> 52))
 22501  			m = (*(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) & ((sqlite3_int64((int64(1))) << 52) - int64(1)))
 22502  			if e == 0 {
 22503  				m <<= 1
 22504  			} else {
 22505  				m = m | (sqlite3_int64((int64(1))) << 52)
 22506  			}
 22507  			for ((e < 1075) && (m > int64(0))) && ((m & int64(1)) == int64(0)) {
 22508  				m >>= 1
 22509  				e++
 22510  			}
 22511  			if isNeg != 0 {
 22512  				m = -m
 22513  			}
 22514  		}
 22515  		switch *(*int32)(unsafe.Pointer(sqlite3.Xsqlite3_user_data(tls, context))) {
 22516  		case 0:
 22517  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+40 /* &zResult[0] */, ts+5351, /* "ieee754(%lld,%d)" */
 22518  				libc.VaList(bp, m, (e-1075)))
 22519  			sqlite3.Xsqlite3_result_text(tls, context, bp+40 /* &zResult[0] */, -1, libc.UintptrFromInt32(-1))
 22520  			break
 22521  			fallthrough
 22522  		case 1:
 22523  			sqlite3.Xsqlite3_result_int64(tls, context, m)
 22524  			break
 22525  			fallthrough
 22526  		case 2:
 22527  			sqlite3.Xsqlite3_result_int(tls, context, (e - 1075))
 22528  			break
 22529  		}
 22530  	} else {
 22531  		var m sqlite3_int64
 22532  		var e sqlite3_int64
 22533  		// var a sqlite3_int64 at bp+152, 8
 22534  
 22535  		// var r float64 at bp+144, 8
 22536  
 22537  		var isNeg int32 = 0
 22538  		m = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22539  		e = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 22540  
 22541  		// Limit the range of e.  Ticket 22dea1cfdb9151e4 2021-03-02
 22542  		if e > int64(10000) {
 22543  			e = int64(10000)
 22544  		} else if e < int64(-10000) {
 22545  			e = int64(-10000)
 22546  		}
 22547  
 22548  		if m < int64(0) {
 22549  			isNeg = 1
 22550  			m = -m
 22551  			if m < int64(0) {
 22552  				return
 22553  			}
 22554  		} else if ((m == int64(0)) && (e > int64(-1000))) && (e < int64(1000)) {
 22555  			sqlite3.Xsqlite3_result_double(tls, context, 0.0)
 22556  			return
 22557  		}
 22558  		for ((m >> 32) & int64(0xffe00000)) != 0 {
 22559  			m >>= 1
 22560  			e++
 22561  		}
 22562  		for (m != int64(0)) && (((m >> 32) & int64(0xfff00000)) == int64(0)) {
 22563  			m <<= 1
 22564  			e--
 22565  		}
 22566  		e = e + (int64(1075))
 22567  		if e <= int64(0) {
 22568  			// Subnormal
 22569  			m >>= (int64(1) - e)
 22570  			e = int64(0)
 22571  		} else if e > int64(0x7ff) {
 22572  			e = int64(0x7ff)
 22573  		}
 22574  		*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) = (m & ((sqlite3_int64((int64(1))) << 52) - int64(1)))
 22575  		*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) |= (e << 52)
 22576  		if isNeg != 0 {
 22577  			*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) |= libc.Int64FromUint64((sqlite3_uint64((uint64(1))) << 63))
 22578  		}
 22579  		libc.Xmemcpy(tls, bp+144 /* &r */, bp+152 /* &a */, uint64(unsafe.Sizeof(float64(0))))
 22580  		sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 144 /* r */)))
 22581  	}
 22582  }
 22583  
 22584  // Functions to convert between blobs and floats.
 22585  func ieee754func_from_blob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:213:13: */
 22586  	bp := tls.Alloc(16)
 22587  	defer tls.Free(16)
 22588  
 22589  	_ = argc
 22590  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB) &&
 22591  		(uint64(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) == uint64(unsafe.Sizeof(float64(0)))) {
 22592  		// var r float64 at bp, 8
 22593  
 22594  		var x uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22595  		var i uint32
 22596  		*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) = uint64(0)
 22597  		for i = uint32(0); uint64(i) < uint64(unsafe.Sizeof(float64(0))); i++ {
 22598  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) << 8) | sqlite3_uint64(*(*uint8)(unsafe.Pointer(x + uintptr(i)))))
 22599  		}
 22600  		libc.Xmemcpy(tls, bp /* &r */, bp+8 /* &v */, uint64(unsafe.Sizeof(float64(0))))
 22601  		sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp /* r */)))
 22602  	}
 22603  }
 22604  
 22605  func ieee754func_to_blob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:233:13: */
 22606  	bp := tls.Alloc(24)
 22607  	defer tls.Free(24)
 22608  
 22609  	_ = argc
 22610  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_FLOAT) ||
 22611  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_INTEGER) {
 22612  		*(*float64)(unsafe.Pointer(bp + 8 /* r */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22613  		// var v sqlite3_uint64 at bp, 8
 22614  
 22615  		// var a [8]uint8 at bp+16, 8
 22616  
 22617  		var i uint32
 22618  		libc.Xmemcpy(tls, bp /* &v */, bp+8 /* &r */, uint64(unsafe.Sizeof(float64(0))))
 22619  		for i = uint32(1); uint64(i) <= uint64(unsafe.Sizeof(float64(0))); i++ {
 22620  			*(*uint8)(unsafe.Pointer(bp + 16 /* &a[0] */ + uintptr((uint64(unsafe.Sizeof(float64(0))) - uint64(i))))) = (uint8(*(*sqlite3_uint64)(unsafe.Pointer(bp /* v */)) & uint64(0xff)))
 22621  			*(*sqlite3_uint64)(unsafe.Pointer(bp /* v */)) >>= 8
 22622  		}
 22623  		sqlite3.Xsqlite3_result_blob(tls, context, bp+16 /* &a[0] */, int32(unsafe.Sizeof(float64(0))), libc.UintptrFromInt32(-1))
 22624  	}
 22625  }
 22626  
 22627  func sqlite3_ieee_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* ieee754.c:259:5: */
 22628  	var i uint32
 22629  	var rc int32 = SQLITE_OK
 22630  	_ = pApi
 22631  
 22632  	_ = pzErrMsg // Unused parameter
 22633  	for i = uint32(0); (uint64(i) < (uint64(unsafe.Sizeof(aFunc1)) / uint64(unsafe.Sizeof(struct {
 22634  		FzFName uintptr
 22635  		FnArg   int32
 22636  		FiAux   int32
 22637  		FxFunc  uintptr
 22638  	}{})))) && (rc == SQLITE_OK); i++ {
 22639  		rc = sqlite3.Xsqlite3_create_function(tls, db, aFunc1[i].FzFName, aFunc1[i].FnArg,
 22640  			(SQLITE_UTF8 | SQLITE_INNOCUOUS),
 22641  			(uintptr(unsafe.Pointer(&aFunc1)) + uintptr(i)*24 + 12 /* &.iAux */),
 22642  			aFunc1[i].FxFunc, uintptr(0), uintptr(0))
 22643  	}
 22644  	return rc
 22645  }
 22646  
 22647  var aFunc1 = [6]struct {
 22648  	FzFName uintptr
 22649  	FnArg   int32
 22650  	FiAux   int32
 22651  	FxFunc  uintptr
 22652  }{
 22653  	{FzFName: ts + 5368 /* "ieee754" */, FnArg: 1, FxFunc: 0},
 22654  	{FzFName: ts + 5368 /* "ieee754" */, FnArg: 2, FxFunc: 0},
 22655  	{FzFName: ts + 5376 /* "ieee754_mantissa" */, FnArg: 1, FiAux: 1, FxFunc: 0},
 22656  	{FzFName: ts + 5393 /* "ieee754_exponent" */, FnArg: 1, FiAux: 2, FxFunc: 0},
 22657  	{FzFName: ts + 5410 /* "ieee754_to_blob" */, FnArg: 1, FxFunc: 0},
 22658  	{FzFName: ts + 5426 /* "ieee754_from_blo..." */, FnArg: 1, FxFunc: 0},
 22659  } /* ieee754.c:269:5 */
 22660  
 22661  //
 22662  // END OF REGISTRATION API
 22663  //
 22664  
 22665  //******* End of fts5.h ********
 22666  
 22667  // This function is used to touch each page of a mapping of a memory
 22668  // mapped SQLite database. Assuming that the system has sufficient free
 22669  // memory and supports sufficiently large mappings, this causes the OS
 22670  // to cache the entire database in main memory, making subsequent
 22671  // database accesses faster.
 22672  //
 22673  // If the second parameter to this function is not NULL, it is the name of
 22674  // the specific database to operate on (i.e. "main" or the name of an
 22675  // attached database).
 22676  //
 22677  // SQLITE_OK is returned if successful, or an SQLite error code otherwise.
 22678  // It is not considered an error if the file is not memory-mapped, or if
 22679  // the mapping does not span the entire file. If an error does occur, a
 22680  // transaction may be left open on the database file.
 22681  //
 22682  // It is illegal to call this function when the database handle has an
 22683  // open transaction. SQLITE_MISUSE is returned in this case.
 22684  func sqlite3_mmap_warm(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* mmapwarm.c:37:5: */
 22685  	bp := tls.Alloc(88)
 22686  	defer tls.Free(88)
 22687  
 22688  	var rc int32 = SQLITE_OK
 22689  	var zSql uintptr = uintptr(0)
 22690  	var pgsz int32 = 0
 22691  	var nTotal int32 = 0
 22692  
 22693  	if 0 == sqlite3.Xsqlite3_get_autocommit(tls, db) {
 22694  		return SQLITE_MISUSE
 22695  	}
 22696  
 22697  	// Open a read-only transaction on the file in question
 22698  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+5444, /* "BEGIN; SELECT * ..." */
 22699  		libc.VaList(bp, func() uintptr {
 22700  			if zDb != 0 {
 22701  				return ts + 5485 /* "'" */
 22702  			}
 22703  			return ts + 489 /* "" */
 22704  		}(), func() uintptr {
 22705  			if zDb != 0 {
 22706  				return zDb
 22707  			}
 22708  			return ts + 489 /* "" */
 22709  		}(), func() uintptr {
 22710  			if zDb != 0 {
 22711  				return ts + 5487 /* "'." */
 22712  			}
 22713  			return ts + 489 /* "" */
 22714  		}()))
 22715  	if zSql == uintptr(0) {
 22716  		return SQLITE_NOMEM
 22717  	}
 22718  	rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 22719  	sqlite3.Xsqlite3_free(tls, zSql)
 22720  
 22721  	// Find the SQLite page size of the file
 22722  	if rc == SQLITE_OK {
 22723  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+5490, /* "PRAGMA %s%q%spag..." */
 22724  			libc.VaList(bp+24, func() uintptr {
 22725  				if zDb != 0 {
 22726  					return ts + 5485 /* "'" */
 22727  				}
 22728  				return ts + 489 /* "" */
 22729  			}(), func() uintptr {
 22730  				if zDb != 0 {
 22731  					return zDb
 22732  				}
 22733  				return ts + 489 /* "" */
 22734  			}(), func() uintptr {
 22735  				if zDb != 0 {
 22736  					return ts + 5487 /* "'." */
 22737  				}
 22738  				return ts + 489 /* "" */
 22739  			}()))
 22740  		if zSql == uintptr(0) {
 22741  			rc = SQLITE_NOMEM
 22742  		} else {
 22743  			*(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)) = uintptr(0)
 22744  			rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+64 /* &pPgsz */, uintptr(0))
 22745  			sqlite3.Xsqlite3_free(tls, zSql)
 22746  			if rc == SQLITE_OK {
 22747  				if sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */))) == SQLITE_ROW {
 22748  					pgsz = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)), 0)
 22749  				}
 22750  				rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)))
 22751  			}
 22752  			if (rc == SQLITE_OK) && (pgsz == 0) {
 22753  				rc = SQLITE_ERROR
 22754  			}
 22755  		}
 22756  	}
 22757  
 22758  	// Touch each mmap'd page of the file
 22759  	if rc == SQLITE_OK {
 22760  		var rc2 int32
 22761  		*(*uintptr)(unsafe.Pointer(bp + 72 /* pFd */)) = uintptr(0)
 22762  		rc = sqlite3.Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_FILE_POINTER, bp+72 /* &pFd */)
 22763  		if (rc == SQLITE_OK) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 72 /* pFd */)))).FpMethods)).FiVersion >= 3) {
 22764  			var iPg sqlite3_int64 = int64(1)
 22765  			var p uintptr = (*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 72 /* pFd */)))).FpMethods
 22766  			for 1 != 0 {
 22767  				// var pMap uintptr at bp+80, 8
 22768  
 22769  				rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer((p + 136 /* &.xFetch */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pFd */)), (sqlite3_int64(pgsz) * iPg), pgsz, bp+80 /* &pMap */)
 22770  				if (rc != SQLITE_OK) || (*(*uintptr)(unsafe.Pointer(bp + 80 /* pMap */)) == uintptr(0)) {
 22771  					break
 22772  				}
 22773  
 22774  				nTotal = nTotal + (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* pMap */))))))
 22775  				nTotal = nTotal + (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* pMap */)) + uintptr((pgsz - 1))))))
 22776  
 22777  				rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer((p + 144 /* &.xUnfetch */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pFd */)), (sqlite3_int64(pgsz) * iPg), *(*uintptr)(unsafe.Pointer(bp + 80 /* pMap */)))
 22778  				if rc != SQLITE_OK {
 22779  					break
 22780  				}
 22781  				iPg++
 22782  			}
 22783  			sqlite3.Xsqlite3_log(tls, SQLITE_OK,
 22784  				ts+5513 /* "sqlite3_mmap_war..." */, libc.VaList(bp+48, func() int64 {
 22785  					if iPg == int64(1) {
 22786  						return int64(0)
 22787  					}
 22788  					return iPg
 22789  				}(),
 22790  					sqlite3.Xsqlite3_db_filename(tls, db, zDb)))
 22791  		}
 22792  
 22793  		rc2 = sqlite3.Xsqlite3_exec(tls, db, ts+5563 /* "END" */, uintptr(0), uintptr(0), uintptr(0))
 22794  		if rc == SQLITE_OK {
 22795  			rc = rc2
 22796  		}
 22797  	}
 22798  
 22799  	return rc
 22800  }
 22801  
 22802  // A structure to hold context of the next_char() computation across
 22803  // nested function calls.
 22804  type nextCharContext1 = struct {
 22805  	Fdb           uintptr
 22806  	FpStmt        uintptr
 22807  	FzPrefix      uintptr
 22808  	FnPrefix      int32
 22809  	FnAlloc       int32
 22810  	FnUsed        int32
 22811  	_             [4]byte
 22812  	FaResult      uintptr
 22813  	FmallocFailed int32
 22814  	FotherError   int32
 22815  } /* nextchar.c:63:9 */
 22816  
 22817  // A structure to hold context of the next_char() computation across
 22818  // nested function calls.
 22819  type nextCharContext = nextCharContext1 /* nextchar.c:63:32 */
 22820  
 22821  // Append a result character if the character is not already in the
 22822  // result.
 22823  func nextCharAppend(tls *libc.TLS, p uintptr, c uint32) { /* nextchar.c:80:13: */
 22824  	var i int32
 22825  	for i = 0; i < (*nextCharContext)(unsafe.Pointer(p)).FnUsed; i++ {
 22826  		if *(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(p)).FaResult + uintptr(i)*4)) == c {
 22827  			return
 22828  		}
 22829  	}
 22830  	if ((*nextCharContext)(unsafe.Pointer(p)).FnUsed + 1) > (*nextCharContext)(unsafe.Pointer(p)).FnAlloc {
 22831  		var aNew uintptr
 22832  		var n int32 = (((*nextCharContext)(unsafe.Pointer(p)).FnAlloc * 2) + 30)
 22833  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*nextCharContext)(unsafe.Pointer(p)).FaResult, (uint64(uint64(n) * uint64(unsafe.Sizeof(uint32(0))))))
 22834  		if aNew == uintptr(0) {
 22835  			(*nextCharContext)(unsafe.Pointer(p)).FmallocFailed = 1
 22836  			return
 22837  		} else {
 22838  			(*nextCharContext)(unsafe.Pointer(p)).FaResult = aNew
 22839  			(*nextCharContext)(unsafe.Pointer(p)).FnAlloc = n
 22840  		}
 22841  	}
 22842  	*(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(p)).FaResult + uintptr(libc.PostIncInt32(&(*nextCharContext)(unsafe.Pointer(p)).FnUsed, 1))*4)) = c
 22843  }
 22844  
 22845  // Write a character into z[] as UTF8.  Return the number of bytes needed
 22846  // to hold the character
 22847  func writeUtf8(tls *libc.TLS, z uintptr, c uint32) int32 { /* nextchar.c:104:12: */
 22848  	if c < uint32(0x00080) {
 22849  		*(*uint8)(unsafe.Pointer(z)) = (uint8(c & uint32(0xff)))
 22850  		return 1
 22851  	}
 22852  	if c < uint32(0x00800) {
 22853  		*(*uint8)(unsafe.Pointer(z)) = (uint8(0xC0 + int32((uint8((c >> 6) & uint32(0x1F))))))
 22854  		*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 22855  		return 2
 22856  	}
 22857  	if c < uint32(0x10000) {
 22858  		*(*uint8)(unsafe.Pointer(z)) = (uint8(0xE0 + int32((uint8((c >> 12) & uint32(0x0F))))))
 22859  		*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8((c >> 6) & uint32(0x3F))))))
 22860  		*(*uint8)(unsafe.Pointer(z + 2)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 22861  		return 3
 22862  	}
 22863  	*(*uint8)(unsafe.Pointer(z)) = (uint8(0xF0 + int32((uint8((c >> 18) & uint32(0x07))))))
 22864  	*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8((c >> 12) & uint32(0x3F))))))
 22865  	*(*uint8)(unsafe.Pointer(z + 2)) = (uint8(0x80 + int32((uint8((c >> 6) & uint32(0x3F))))))
 22866  	*(*uint8)(unsafe.Pointer(z + 3)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 22867  	return 4
 22868  }
 22869  
 22870  // Read a UTF8 character out of z[] and write it into *pOut.  Return
 22871  // the number of bytes in z[] that were used to construct the character.
 22872  func readUtf8(tls *libc.TLS, z uintptr, pOut uintptr) int32 { /* nextchar.c:131:12: */
 22873  	var c uint32 = uint32(*(*uint8)(unsafe.Pointer(z)))
 22874  	if c < uint32(0xc0) {
 22875  		*(*uint32)(unsafe.Pointer(pOut)) = c
 22876  		return 1
 22877  	} else {
 22878  		var n int32 = 1
 22879  		c = uint32(validBits[(c - uint32(0xc0))])
 22880  		for (int32(*(*uint8)(unsafe.Pointer(z + uintptr(n)))) & 0xc0) == 0x80 {
 22881  			c = ((c << 6) + (uint32(0x3f & int32(*(*uint8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&n, 1))))))))
 22882  		}
 22883  		if ((c < uint32(0x80)) || ((c & 0xFFFFF800) == uint32(0xD800))) || ((c & 0xFFFFFFFE) == uint32(0xFFFE)) {
 22884  			c = uint32(0xFFFD)
 22885  		}
 22886  		*(*uint32)(unsafe.Pointer(pOut)) = c
 22887  		return n
 22888  	}
 22889  	return int32(0)
 22890  }
 22891  
 22892  var validBits = [64]uint8{
 22893  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 22894  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 22895  	uint8(0x10), uint8(0x11), uint8(0x12), uint8(0x13), uint8(0x14), uint8(0x15), uint8(0x16), uint8(0x17),
 22896  	uint8(0x18), uint8(0x19), uint8(0x1a), uint8(0x1b), uint8(0x1c), uint8(0x1d), uint8(0x1e), uint8(0x1f),
 22897  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 22898  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 22899  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 22900  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x00),
 22901  } /* nextchar.c:132:30 */
 22902  
 22903  // The nextCharContext structure has been set up.  Add all "next" characters
 22904  // to the result set.
 22905  func findNextChars(tls *libc.TLS, p uintptr) { /* nextchar.c:164:13: */
 22906  	bp := tls.Alloc(12)
 22907  	defer tls.Free(12)
 22908  
 22909  	var cPrev uint32 = uint32(0)
 22910  	// var zPrev [8]uint8 at bp, 8
 22911  
 22912  	var n int32
 22913  	var rc int32
 22914  
 22915  	for {
 22916  		sqlite3.Xsqlite3_bind_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 1, (*nextCharContext)(unsafe.Pointer(p)).FzPrefix, (*nextCharContext)(unsafe.Pointer(p)).FnPrefix,
 22917  			uintptr(0))
 22918  		n = writeUtf8(tls, bp /* &zPrev[0] */, (cPrev + uint32(1)))
 22919  		sqlite3.Xsqlite3_bind_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 2, bp /* zPrev */, n, uintptr(0))
 22920  		rc = sqlite3.Xsqlite3_step(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 22921  		if rc == SQLITE_DONE {
 22922  			sqlite3.Xsqlite3_reset(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 22923  			return
 22924  		} else if rc != SQLITE_ROW {
 22925  			(*nextCharContext)(unsafe.Pointer(p)).FotherError = rc
 22926  			return
 22927  		} else {
 22928  			var zOut uintptr = sqlite3.Xsqlite3_column_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 0)
 22929  			// var cNext uint32 at bp+8, 4
 22930  
 22931  			n = readUtf8(tls, (zOut + uintptr((*nextCharContext)(unsafe.Pointer(p)).FnPrefix)), bp+8 /* &cNext */)
 22932  			sqlite3.Xsqlite3_reset(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 22933  			nextCharAppend(tls, p, *(*uint32)(unsafe.Pointer(bp + 8 /* cNext */)))
 22934  			cPrev = *(*uint32)(unsafe.Pointer(bp + 8 /* cNext */))
 22935  			if (*nextCharContext)(unsafe.Pointer(p)).FmallocFailed != 0 {
 22936  				return
 22937  			}
 22938  		}
 22939  	}
 22940  }
 22941  
 22942  // next_character(A,T,F,W)
 22943  //
 22944  // Return a string composted of all next possible characters after
 22945  // A for elements of T.F.  If W is supplied, then it is an SQL expression
 22946  // that limits the elements in T.F that are considered.
 22947  func nextCharFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* nextchar.c:201:13: */
 22948  	bp := tls.Alloc(136)
 22949  	defer tls.Free(136)
 22950  
 22951  	// var c nextCharContext at bp+80, 56
 22952  
 22953  	var zTable uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 22954  	var zField uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 22955  	var zWhere uintptr
 22956  	var zCollName uintptr
 22957  	var zWhereClause uintptr = uintptr(0)
 22958  	var zColl uintptr = uintptr(0)
 22959  	var zSql uintptr
 22960  	var rc int32
 22961  
 22962  	libc.Xmemset(tls, bp+80 /* &c */, 0, uint64(unsafe.Sizeof(nextCharContext{})))
 22963  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).Fdb = sqlite3.Xsqlite3_context_db_handle(tls, context)
 22964  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).FzPrefix = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22965  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).FnPrefix = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22966  	if ((zTable == uintptr(0)) || (zField == uintptr(0))) || ((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FzPrefix == uintptr(0)) {
 22967  		return
 22968  	}
 22969  	if ((argc >= 4) &&
 22970  		((libc.AssignUintptr(&zWhere, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))))) != uintptr(0))) &&
 22971  		(int32(*(*uint8)(unsafe.Pointer(zWhere))) != 0) {
 22972  		zWhereClause = sqlite3.Xsqlite3_mprintf(tls, ts+5567 /* "AND (%s)" */, libc.VaList(bp, zWhere))
 22973  		if zWhereClause == uintptr(0) {
 22974  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 22975  			return
 22976  		}
 22977  	} else {
 22978  		zWhereClause = ts + 489 /* "" */
 22979  	}
 22980  	if ((argc >= 5) &&
 22981  		((libc.AssignUintptr(&zCollName, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8))))) != uintptr(0))) &&
 22982  		(int32(*(*uint8)(unsafe.Pointer(zCollName))) != 0) {
 22983  		zColl = sqlite3.Xsqlite3_mprintf(tls, ts+5576 /* "collate \"%w\"" */, libc.VaList(bp+8, zCollName))
 22984  		if zColl == uintptr(0) {
 22985  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 22986  			if *(*int8)(unsafe.Pointer(zWhereClause)) != 0 {
 22987  				sqlite3.Xsqlite3_free(tls, zWhereClause)
 22988  			}
 22989  			return
 22990  		}
 22991  	} else {
 22992  		zColl = ts + 489 /* "" */
 22993  	}
 22994  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 22995  
 22996  		// 1114111 == 0x10ffff
 22997  
 22998  		ts+5589, /* "SELECT %s FROM %..." */
 22999  		libc.VaList(bp+16, zField, zTable, zField, zColl, zField, zColl, zWhereClause, zColl))
 23000  	if *(*int8)(unsafe.Pointer(zWhereClause)) != 0 {
 23001  		sqlite3.Xsqlite3_free(tls, zWhereClause)
 23002  	}
 23003  	if *(*int8)(unsafe.Pointer(zColl)) != 0 {
 23004  		sqlite3.Xsqlite3_free(tls, zColl)
 23005  	}
 23006  	if zSql == uintptr(0) {
 23007  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23008  		return
 23009  	}
 23010  
 23011  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).Fdb, zSql, -1, (bp + 80 /* &c */ + 8 /* &.pStmt */), uintptr(0))
 23012  	sqlite3.Xsqlite3_free(tls, zSql)
 23013  	if rc != 0 {
 23014  		sqlite3.Xsqlite3_result_error(tls, context, sqlite3.Xsqlite3_errmsg(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).Fdb), -1)
 23015  		return
 23016  	}
 23017  	findNextChars(tls, bp+80 /* &c */)
 23018  	if (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FmallocFailed != 0 {
 23019  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23020  	} else {
 23021  		var pRes uintptr
 23022  		pRes = sqlite3.Xsqlite3_malloc64(tls, (uint64(((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FnUsed * 4) + 1)))
 23023  		if pRes == uintptr(0) {
 23024  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23025  		} else {
 23026  			var i int32
 23027  			var n int32 = 0
 23028  			for i = 0; i < (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FnUsed; i++ {
 23029  				n = n + (writeUtf8(tls, (pRes + uintptr(n)), *(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FaResult + uintptr(i)*4))))
 23030  			}
 23031  			*(*uint8)(unsafe.Pointer(pRes + uintptr(n))) = uint8(0)
 23032  			sqlite3.Xsqlite3_result_text(tls, context, pRes, n, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 23033  		}
 23034  	}
 23035  	sqlite3.Xsqlite3_finalize(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FpStmt)
 23036  	sqlite3.Xsqlite3_free(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FaResult)
 23037  }
 23038  
 23039  func sqlite3_nextchar_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* nextchar.c:292:5: */
 23040  	var rc int32 = SQLITE_OK
 23041  	_ = pApi
 23042  
 23043  	_ = pzErrMsg // Unused parameter
 23044  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 3,
 23045  		(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23046  		*(*uintptr)(unsafe.Pointer(&struct {
 23047  			f func(*libc.TLS, uintptr, int32, uintptr)
 23048  		}{nextCharFunc})), uintptr(0), uintptr(0))
 23049  	if rc == SQLITE_OK {
 23050  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 4,
 23051  			(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23052  			*(*uintptr)(unsafe.Pointer(&struct {
 23053  				f func(*libc.TLS, uintptr, int32, uintptr)
 23054  			}{nextCharFunc})), uintptr(0), uintptr(0))
 23055  	}
 23056  	if rc == SQLITE_OK {
 23057  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 5,
 23058  			(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23059  			*(*uintptr)(unsafe.Pointer(&struct {
 23060  				f func(*libc.TLS, uintptr, int32, uintptr)
 23061  			}{nextCharFunc})), uintptr(0), uintptr(0))
 23062  	}
 23063  	return rc
 23064  }
 23065  
 23066  // Implementation note:
 23067  //
 23068  // Much of the tokenizer logic is copied out of the tokenize.c source file
 23069  // of SQLite.  That logic could be simplified for this particular application,
 23070  // but that would impose a risk of introducing subtle errors.  It is best to
 23071  // keep the code as close to the original as possible.
 23072  //
 23073  // The tokenize code is in sync with the SQLite core as of 2018-01-08.
 23074  // Any future changes to the core tokenizer might require corresponding
 23075  // adjustments to the tokenizer logic in this module.
 23076  
 23077  // Character classes for tokenizing
 23078  //
 23079  // In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented
 23080  // using a lookup table, whereas a switch() directly on c uses a binary search.
 23081  // The lookup table is much faster.  To maximize speed, and to ensure that
 23082  // a lookup table is used, all of the classes need to be small integers and
 23083  // all of them need to be used within the switch.
 23084  
 23085  var aiClass = [256]uint8{
 23086  	//         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf
 23087  	/* 0x */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(7), uint8(7), uint8(27), uint8(7), uint8(7), uint8(27), uint8(27),
 23088  	/* 1x */ uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27), uint8(27),
 23089  	/* 2x */ uint8(7), uint8(15), uint8(8), uint8(5), uint8(4), uint8(22), uint8(24), uint8(8), uint8(17), uint8(18), uint8(21), uint8(20), uint8(23), uint8(11), uint8(26), uint8(16),
 23090  	/* 3x */ uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(3), uint8(5), uint8(19), uint8(12), uint8(14), uint8(13), uint8(6),
 23091  	/* 4x */ uint8(5), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1),
 23092  	/* 5x */ uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(1), uint8(1), uint8(9), uint8(27), uint8(27), uint8(27), uint8(1),
 23093  	/* 6x */ uint8(8), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1),
 23094  	/* 7x */ uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(0), uint8(1), uint8(1), uint8(27), uint8(10), uint8(27), uint8(25), uint8(27),
 23095  	/* 8x */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23096  	/* 9x */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23097  	/* Ax */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23098  	/* Bx */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23099  	/* Cx */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23100  	/* Dx */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23101  	/* Ex */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23102  	/* Fx */ uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2), uint8(2),
 23103  } /* normalize.c:106:28 */
 23104  
 23105  // An array to map all upper-case characters into their corresponding
 23106  // lower-case character.
 23107  //
 23108  // SQLite only considers US-ASCII (or EBCDIC) characters.  We do not
 23109  // handle case conversions for the UTF character set since the tables
 23110  // involved are nearly as big or bigger than SQLite itself.
 23111  var sqlite3UpperToLower = [256]uint8{
 23112  	uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17),
 23113  	uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35),
 23114  	uint8(36), uint8(37), uint8(38), uint8(39), uint8(40), uint8(41), uint8(42), uint8(43), uint8(44), uint8(45), uint8(46), uint8(47), uint8(48), uint8(49), uint8(50), uint8(51), uint8(52), uint8(53),
 23115  	uint8(54), uint8(55), uint8(56), uint8(57), uint8(58), uint8(59), uint8(60), uint8(61), uint8(62), uint8(63), uint8(64), uint8(97), uint8(98), uint8(99), uint8(100), uint8(101), uint8(102), uint8(103),
 23116  	uint8(104), uint8(105), uint8(106), uint8(107), uint8(108), uint8(109), uint8(110), uint8(111), uint8(112), uint8(113), uint8(114), uint8(115), uint8(116), uint8(117), uint8(118), uint8(119), uint8(120), uint8(121),
 23117  	uint8(122), uint8(91), uint8(92), uint8(93), uint8(94), uint8(95), uint8(96), uint8(97), uint8(98), uint8(99), uint8(100), uint8(101), uint8(102), uint8(103), uint8(104), uint8(105), uint8(106), uint8(107),
 23118  	uint8(108), uint8(109), uint8(110), uint8(111), uint8(112), uint8(113), uint8(114), uint8(115), uint8(116), uint8(117), uint8(118), uint8(119), uint8(120), uint8(121), uint8(122), uint8(123), uint8(124), uint8(125),
 23119  	uint8(126), uint8(127), uint8(128), uint8(129), uint8(130), uint8(131), uint8(132), uint8(133), uint8(134), uint8(135), uint8(136), uint8(137), uint8(138), uint8(139), uint8(140), uint8(141), uint8(142), uint8(143),
 23120  	uint8(144), uint8(145), uint8(146), uint8(147), uint8(148), uint8(149), uint8(150), uint8(151), uint8(152), uint8(153), uint8(154), uint8(155), uint8(156), uint8(157), uint8(158), uint8(159), uint8(160), uint8(161),
 23121  	uint8(162), uint8(163), uint8(164), uint8(165), uint8(166), uint8(167), uint8(168), uint8(169), uint8(170), uint8(171), uint8(172), uint8(173), uint8(174), uint8(175), uint8(176), uint8(177), uint8(178), uint8(179),
 23122  	uint8(180), uint8(181), uint8(182), uint8(183), uint8(184), uint8(185), uint8(186), uint8(187), uint8(188), uint8(189), uint8(190), uint8(191), uint8(192), uint8(193), uint8(194), uint8(195), uint8(196), uint8(197),
 23123  	uint8(198), uint8(199), uint8(200), uint8(201), uint8(202), uint8(203), uint8(204), uint8(205), uint8(206), uint8(207), uint8(208), uint8(209), uint8(210), uint8(211), uint8(212), uint8(213), uint8(214), uint8(215),
 23124  	uint8(216), uint8(217), uint8(218), uint8(219), uint8(220), uint8(221), uint8(222), uint8(223), uint8(224), uint8(225), uint8(226), uint8(227), uint8(228), uint8(229), uint8(230), uint8(231), uint8(232), uint8(233),
 23125  	uint8(234), uint8(235), uint8(236), uint8(237), uint8(238), uint8(239), uint8(240), uint8(241), uint8(242), uint8(243), uint8(244), uint8(245), uint8(246), uint8(247), uint8(248), uint8(249), uint8(250), uint8(251),
 23126  	uint8(252), uint8(253), uint8(254), uint8(255),
 23127  } /* normalize.c:133:28 */
 23128  
 23129  // The following 256 byte lookup table is used to support SQLites built-in
 23130  // equivalents to the following standard library functions:
 23131  //
 23132  //   isspace()                        0x01
 23133  //   isalpha()                        0x02
 23134  //   isdigit()                        0x04
 23135  //   isalnum()                        0x06
 23136  //   isxdigit()                       0x08
 23137  //   toupper()                        0x20
 23138  //   SQLite identifier character      0x40
 23139  //   Quote character                  0x80
 23140  //
 23141  // Bit 0x20 is set if the mapped character requires translation to upper
 23142  // case. i.e. if the character is a lower-case ASCII character.
 23143  // If x is a lower-case ASCII character, then its upper-case equivalent
 23144  // is (x - 0x20). Therefore toupper() can be implemented as:
 23145  //
 23146  //   (x & ~(map[x]&0x20))
 23147  //
 23148  // The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
 23149  // array. tolower() is used more often than toupper() by SQLite.
 23150  //
 23151  // Bit 0x40 is set if the character is non-alphanumeric and can be used in an
 23152  // SQLite identifier.  Identifiers are alphanumerics, "_", "$", and any
 23153  // non-ASCII UTF character. Hence the test for whether or not a character is
 23154  // part of an identifier is 0x46.
 23155  var sqlite3CtypeMap = [256]uint8{
 23156  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 00..07    ........
 23157  	uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x00), // 08..0f    ........
 23158  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 10..17    ........
 23159  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 18..1f    ........
 23160  	uint8(0x01), uint8(0x00), uint8(0x80), uint8(0x00), uint8(0x40), uint8(0x00), uint8(0x00), uint8(0x80), // 20..27     !"#$%&'
 23161  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 28..2f    ()*+,-./
 23162  	uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), // 30..37    01234567
 23163  	uint8(0x0c), uint8(0x0c), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 38..3f    89:;<=>?
 23164  
 23165  	uint8(0x00), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x02), // 40..47    @ABCDEFG
 23166  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 48..4f    HIJKLMNO
 23167  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 50..57    PQRSTUVW
 23168  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x80), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x40), // 58..5f    XYZ[\]^_
 23169  	uint8(0x80), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x22), // 60..67    `abcdefg
 23170  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 68..6f    hijklmno
 23171  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 70..77    pqrstuvw
 23172  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 78..7f    xyz{|}~.
 23173  
 23174  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 80..87    ........
 23175  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 88..8f    ........
 23176  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 90..97    ........
 23177  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 98..9f    ........
 23178  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a0..a7    ........
 23179  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a8..af    ........
 23180  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b0..b7    ........
 23181  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b8..bf    ........
 23182  
 23183  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c0..c7    ........
 23184  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c8..cf    ........
 23185  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d0..d7    ........
 23186  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d8..df    ........
 23187  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e0..e7    ........
 23188  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e8..ef    ........
 23189  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f0..f7    ........
 23190  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f8..ff    ........
 23191  } /* normalize.c:179:28 */
 23192  
 23193  // If X is a character that can be used in an identifier then
 23194  // IdChar(X) will be true.  Otherwise it is false.
 23195  //
 23196  // For ASCII, any character with the high-order bit set is
 23197  // allowed in an identifier.  For 7-bit characters,
 23198  // sqlite3IsIdChar[X] must be 1.
 23199  //
 23200  // For EBCDIC, the rules are more complex but have the same
 23201  // end result.
 23202  //
 23203  // Ticket #1066.  the SQL standard does not allow '$' in the
 23204  // middle of identifiers.  But many SQL implementations do.
 23205  // SQLite will allow '$' in identifiers for compatibility.
 23206  // But the feature is undocumented.
 23207  
 23208  // Ignore testcase() macros
 23209  
 23210  // Token values
 23211  
 23212  // Disable nuisence warnings about case fall-through
 23213  
 23214  // Return the length (in bytes) of the token that begins at z[0].
 23215  // Store the token type in *tokenType before returning.
 23216  func sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) int32 { /* normalize.c:300:12: */
 23217  	var i int32
 23218  	var c int32
 23219  	switch int32(aiClass[*(*uint8)(unsafe.Pointer(z))]) { // Switch on the character-class of the first byte
 23220  	// of the token. See the comment on the CC_ defines
 23221  	// above.
 23222  	case CC_SPACE:
 23223  		{
 23224  			for i = 1; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x01) != 0; i++ {
 23225  			}
 23226  			*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 23227  			return i
 23228  
 23229  		}
 23230  	case CC_MINUS:
 23231  		{
 23232  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '-' {
 23233  				for i = 2; ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && (c != '\n'); i++ {
 23234  				}
 23235  				*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 23236  				return i
 23237  			}
 23238  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23239  			return 1
 23240  
 23241  		}
 23242  	case CC_LP:
 23243  		{
 23244  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23245  			return 1
 23246  
 23247  		}
 23248  	case CC_RP:
 23249  		{
 23250  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23251  			return 1
 23252  
 23253  		}
 23254  	case CC_SEMI:
 23255  		{
 23256  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23257  			return 1
 23258  
 23259  		}
 23260  	case CC_PLUS:
 23261  		{
 23262  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23263  			return 1
 23264  
 23265  		}
 23266  	case CC_STAR:
 23267  		{
 23268  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23269  			return 1
 23270  
 23271  		}
 23272  	case CC_SLASH:
 23273  		{
 23274  			if (int32(*(*uint8)(unsafe.Pointer(z + 1))) != '*') || (int32(*(*uint8)(unsafe.Pointer(z + 2))) == 0) {
 23275  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23276  				return 1
 23277  			}
 23278  			i = 3
 23279  			c = int32(*(*uint8)(unsafe.Pointer(z + 2)))
 23280  			for ; ((c != '*') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '/')) && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ {
 23281  			}
 23282  			if c != 0 {
 23283  				i++
 23284  			}
 23285  			*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 23286  			return i
 23287  
 23288  		}
 23289  	case CC_PERCENT:
 23290  		{
 23291  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23292  			return 1
 23293  
 23294  		}
 23295  	case CC_EQ:
 23296  		{
 23297  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23298  			return (1 + (libc.Bool32(int32(*(*uint8)(unsafe.Pointer(z + 1))) == '=')))
 23299  
 23300  		}
 23301  	case CC_LT:
 23302  		{
 23303  			if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' {
 23304  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23305  				return 2
 23306  			} else if c == '>' {
 23307  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23308  				return 2
 23309  			} else if c == '<' {
 23310  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23311  				return 2
 23312  			} else {
 23313  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23314  				return 1
 23315  			}
 23316  
 23317  		}
 23318  		fallthrough
 23319  	case CC_GT:
 23320  		{
 23321  			if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' {
 23322  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23323  				return 2
 23324  			} else if c == '>' {
 23325  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23326  				return 2
 23327  			} else {
 23328  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23329  				return 1
 23330  			}
 23331  
 23332  		}
 23333  		fallthrough
 23334  	case CC_BANG:
 23335  		{
 23336  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '=' {
 23337  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23338  				return 1
 23339  			} else {
 23340  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23341  				return 2
 23342  			}
 23343  
 23344  		}
 23345  		fallthrough
 23346  	case CC_PIPE:
 23347  		{
 23348  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '|' {
 23349  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23350  				return 1
 23351  			} else {
 23352  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23353  				return 2
 23354  			}
 23355  
 23356  		}
 23357  		fallthrough
 23358  	case CC_COMMA:
 23359  		{
 23360  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23361  			return 1
 23362  
 23363  		}
 23364  	case CC_AND:
 23365  		{
 23366  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23367  			return 1
 23368  
 23369  		}
 23370  	case CC_TILDA:
 23371  		{
 23372  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23373  			return 1
 23374  
 23375  		}
 23376  	case CC_QUOTE:
 23377  		{
 23378  			var delim int32 = int32(*(*uint8)(unsafe.Pointer(z)))
 23379  
 23380  			for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ {
 23381  				if c == delim {
 23382  					if int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == delim {
 23383  						i++
 23384  					} else {
 23385  						break
 23386  					}
 23387  				}
 23388  			}
 23389  			if c == '\'' {
 23390  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23391  				return (i + 1)
 23392  			} else if c != 0 {
 23393  				*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 23394  				return (i + 1)
 23395  			} else {
 23396  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23397  				return i
 23398  			}
 23399  
 23400  		}
 23401  		fallthrough
 23402  	case CC_DOT:
 23403  		{
 23404  			if !((int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 1))]) & 0x04) != 0) {
 23405  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 23406  				return 1
 23407  			}
 23408  			// If the next character is a digit, this is a floating point
 23409  			// number that begins with ".".  Fall thru into the next case
 23410  			/* no break */
 23411  
 23412  		}
 23413  		fallthrough
 23414  	case CC_DIGIT:
 23415  		{
 23416  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23417  			if ((int32(*(*uint8)(unsafe.Pointer(z))) == '0') && ((int32(*(*uint8)(unsafe.Pointer(z + 1))) == 'x') || (int32(*(*uint8)(unsafe.Pointer(z + 1))) == 'X'))) && ((int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 2))]) & 0x08) != 0) {
 23418  				for i = 3; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ {
 23419  				}
 23420  				return i
 23421  			}
 23422  			for i = 0; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ {
 23423  			}
 23424  			if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == '.' {
 23425  				i++
 23426  				for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 {
 23427  					i++
 23428  				}
 23429  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23430  			}
 23431  			if ((int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == 'e') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == 'E')) && (((int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))]) & 0x04) != 0) ||
 23432  				(((int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == '+') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == '-')) && ((int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr((i + 2))))]) & 0x04) != 0))) {
 23433  				i = i + (2)
 23434  				for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 {
 23435  					i++
 23436  				}
 23437  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23438  			}
 23439  			for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 23440  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23441  				i++
 23442  			}
 23443  			return i
 23444  
 23445  		}
 23446  	case CC_QUOTE2:
 23447  		{
 23448  			i = 1
 23449  			c = int32(*(*uint8)(unsafe.Pointer(z)))
 23450  			for ; (c != ']') && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ {
 23451  			}
 23452  			*(*int32)(unsafe.Pointer(tokenType)) = func() int32 {
 23453  				if c == ']' {
 23454  					return TK_NAME
 23455  				}
 23456  				return TK_ERROR
 23457  			}()
 23458  			return i
 23459  
 23460  		}
 23461  	case CC_VARNUM:
 23462  		{
 23463  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23464  			for i = 1; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ {
 23465  			}
 23466  			return i
 23467  
 23468  		}
 23469  	case CC_DOLLAR:
 23470  		fallthrough
 23471  	case CC_VARALPHA:
 23472  		{
 23473  			var n int32 = 0
 23474  
 23475  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23476  			for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ {
 23477  				if (int32(sqlite3CtypeMap[uint8(c)]) & 0x46) != 0 {
 23478  					n++
 23479  				} else if (c == '(') && (n > 0) {
 23480  					for ok := true; ok; ok = ((((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && !((int32(sqlite3CtypeMap[uint8(c)]) & 0x01) != 0)) && (c != ')')) {
 23481  						i++
 23482  					}
 23483  					if c == ')' {
 23484  						i++
 23485  					} else {
 23486  						*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23487  					}
 23488  					break
 23489  				} else if (c == ':') && (int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == ':') {
 23490  					i++
 23491  				} else {
 23492  					break
 23493  				}
 23494  			}
 23495  			if n == 0 {
 23496  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23497  			}
 23498  			return i
 23499  
 23500  		}
 23501  	case CC_KYWD:
 23502  		{
 23503  			for i = 1; int32(aiClass[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) <= CC_KYWD; i++ {
 23504  			}
 23505  			if (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 23506  				// This token started out using characters that can appear in keywords,
 23507  				// but z[i] is a character not allowed within keywords, so this must
 23508  				// be an identifier instead
 23509  				i++
 23510  				break
 23511  			}
 23512  			*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 23513  			return i
 23514  
 23515  		}
 23516  	case CC_X:
 23517  		{
 23518  
 23519  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '\'' {
 23520  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 23521  				for i = 2; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ {
 23522  				}
 23523  				if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') || ((i % 2) != 0) {
 23524  					*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23525  					for (*(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0) && (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') {
 23526  						i++
 23527  					}
 23528  				}
 23529  				if *(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0 {
 23530  					i++
 23531  				}
 23532  				return i
 23533  			}
 23534  			// If it is not a BLOB literal, then it must be an ID, since no
 23535  			// SQL keywords start with the letter 'x'.  Fall through
 23536  			/* no break */
 23537  
 23538  		}
 23539  		fallthrough
 23540  	case CC_ID:
 23541  		{
 23542  			i = 1
 23543  			break
 23544  
 23545  		}
 23546  	default:
 23547  		{
 23548  			*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 23549  			return 1
 23550  
 23551  		}
 23552  	}
 23553  	for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 23554  		i++
 23555  	}
 23556  	*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 23557  	return i
 23558  }
 23559  
 23560  func sqlite3_normalize(tls *libc.TLS, zSql uintptr) uintptr { /* normalize.c:555:6: */
 23561  	bp := tls.Alloc(4)
 23562  	defer tls.Free(4)
 23563  
 23564  	var z uintptr          // The output string
 23565  	var nZ sqlite3_int64   // Size of the output string in bytes
 23566  	var nSql sqlite3_int64 // Size of the input string in bytes
 23567  	var i int32            // Next character to read from zSql[]
 23568  	var j int32            // Next slot to fill in on z[]
 23569  	// var tokenType int32 at bp, 4
 23570  	// Type of the next token
 23571  	var n int32 // Size of the next token
 23572  	var k int32 // Loop counter
 23573  
 23574  	nSql = sqlite3_int64(libc.Xstrlen(tls, zSql))
 23575  	nZ = nSql
 23576  	z = sqlite3.Xsqlite3_malloc64(tls, (uint64(nZ + int64(2))))
 23577  	if z == uintptr(0) {
 23578  		return uintptr(0)
 23579  	}
 23580  	for i = libc.AssignInt32(&j, 0); *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0; i = i + (n) {
 23581  		n = sqlite3GetToken(tls, (zSql + uintptr(i)), bp /* &tokenType */)
 23582  		switch *(*int32)(unsafe.Pointer(bp /* tokenType */)) {
 23583  		case TK_SPACE:
 23584  			{
 23585  				break
 23586  
 23587  			}
 23588  		case TK_ERROR:
 23589  			{
 23590  				sqlite3.Xsqlite3_free(tls, z)
 23591  				return uintptr(0)
 23592  
 23593  			}
 23594  		case TK_LITERAL:
 23595  			{
 23596  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 23597  				break
 23598  
 23599  			}
 23600  		case TK_PUNCT:
 23601  			fallthrough
 23602  		case TK_NAME:
 23603  			{
 23604  				if (n == 4) && (sqlite3.Xsqlite3_strnicmp(tls, (zSql+uintptr(i)), ts+5707 /* "NULL" */, 4) == 0) {
 23605  					if (((j >= 3) && (libc.Xstrncmp(tls, ((z+uintptr(j))-uintptr(2)), ts+5712 /* "is" */, uint64(2)) == 0)) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((j - 3)))))]) & 0x46) != 0)) ||
 23606  						(((j >= 4) && (libc.Xstrncmp(tls, ((z+uintptr(j))-uintptr(3)), ts+5715 /* "not" */, uint64(3)) == 0)) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((j - 4)))))]) & 0x46) != 0)) {
 23607  						// NULL is a keyword in this case, not a literal value
 23608  					} else {
 23609  						// Here the NULL is a literal value
 23610  						*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 23611  						break
 23612  					}
 23613  				}
 23614  				if ((j > 0) && ((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((j - 1)))))]) & 0x46) != 0)) && ((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zSql + uintptr(i))))]) & 0x46) != 0) {
 23615  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(' ')
 23616  				}
 23617  				for k = 0; k < n; k++ {
 23618  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zSql + uintptr((i + k)))))])
 23619  				}
 23620  				break
 23621  
 23622  			}
 23623  		}
 23624  	}
 23625  	for (j > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j - 1))))) == ' ') {
 23626  		j--
 23627  	}
 23628  	if (j > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j - 1))))) != ';') {
 23629  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(';')
 23630  	}
 23631  	*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 23632  
 23633  	// Make a second pass converting "in(...)" where the "..." is not a
 23634  	// SELECT statement into "in(?,?,?)"
 23635  	for i = 0; i < j; i = n {
 23636  		var zIn uintptr = libc.Xstrstr(tls, (z + uintptr(i)), ts+5719 /* "in(" */)
 23637  		var nParen int32
 23638  		if zIn == uintptr(0) {
 23639  			break
 23640  		}
 23641  		n = ((int32((int64(zIn) - int64(z)) / 1)) + 3) // Index of first char past "in("
 23642  		if (n != 0) && ((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + libc.UintptrFromInt32(-1))))]) & 0x46) != 0) {
 23643  			continue
 23644  		}
 23645  		if (libc.Xstrncmp(tls, zIn, ts+5723 /* "in(select" */, uint64(9)) == 0) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + 9)))]) & 0x46) != 0) {
 23646  			continue
 23647  		}
 23648  		if (libc.Xstrncmp(tls, zIn, ts+5733 /* "in(with" */, uint64(7)) == 0) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + 7)))]) & 0x46) != 0) {
 23649  			continue
 23650  		}
 23651  		nParen = 1
 23652  		k = 0
 23653  		for ; *(*int8)(unsafe.Pointer(z + uintptr((n + k)))) != 0; k++ {
 23654  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((n + k))))) == '(' {
 23655  				nParen++
 23656  			}
 23657  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((n + k))))) == ')' {
 23658  				nParen--
 23659  				if nParen == 0 {
 23660  					break
 23661  				}
 23662  			}
 23663  		}
 23664  		// k is the number of bytes in the "..." within "in(...)"
 23665  		if k < 5 {
 23666  			z = sqlite3.Xsqlite3_realloc64(tls, z, (uint64((j + (5 - k)) + 1)))
 23667  			if z == uintptr(0) {
 23668  				return uintptr(0)
 23669  			}
 23670  			libc.Xmemmove(tls, ((z + uintptr(n)) + uintptr(5)), ((z + uintptr(n)) + uintptr(k)), (uint64(j - (n + k))))
 23671  		} else if k > 5 {
 23672  			libc.Xmemmove(tls, ((z + uintptr(n)) + uintptr(5)), ((z + uintptr(n)) + uintptr(k)), (uint64(j - (n + k))))
 23673  		}
 23674  		j = ((j - k) + 5)
 23675  		*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 23676  		libc.Xmemcpy(tls, (z + uintptr(n)), ts+5741 /* "?,?,?" */, uint64(5))
 23677  	}
 23678  	return z
 23679  }
 23680  
 23681  // For testing purposes, or to build a stand-alone SQL normalizer program,
 23682  // compile this one source file with the -DSQLITE_NORMALIZE_CLI and link
 23683  // it against any SQLite library.  The resulting command-line program will
 23684  // run sqlite3_normalize() over the text of all files named on the command-
 23685  // line and show the result on standard output.
 23686  
 23687  // The following object is the session context for a single percentile()
 23688  // function.  We have to remember all input Y values until the very end.
 23689  // Those values are accumulated in the Percentile.a[] array.
 23690  type Percentile1 = struct {
 23691  	FnAlloc uint32
 23692  	FnUsed  uint32
 23693  	FrPct   float64
 23694  	Fa      uintptr
 23695  } /* percentile.c:71:9 */
 23696  
 23697  // The following object is the session context for a single percentile()
 23698  // function.  We have to remember all input Y values until the very end.
 23699  // Those values are accumulated in the Percentile.a[] array.
 23700  type Percentile = Percentile1 /* percentile.c:71:27 */
 23701  
 23702  // Return TRUE if the input floating-point number is an infinity.
 23703  func isInfinity(tls *libc.TLS, r float64) int32 { /* percentile.c:82:12: */
 23704  	bp := tls.Alloc(16)
 23705  	defer tls.Free(16)
 23706  	*(*float64)(unsafe.Pointer(bp + 8)) = r
 23707  
 23708  	// var u sqlite3_uint64 at bp, 8
 23709  
 23710  	libc.Xmemcpy(tls, bp /* &u */, bp+8 /* &r */, uint64(unsafe.Sizeof(sqlite3_uint64(0))))
 23711  	return (libc.Bool32(((*(*sqlite3_uint64)(unsafe.Pointer(bp /* u */)) >> 52) & uint64(0x7ff)) == uint64(0x7ff)))
 23712  }
 23713  
 23714  // Return TRUE if two doubles differ by 0.001 or less
 23715  func sameValue(tls *libc.TLS, a float64, b float64) int32 { /* percentile.c:92:12: */
 23716  	a = a - (b)
 23717  	return (libc.Bool32((a >= -0.001) && (a <= 0.001)))
 23718  }
 23719  
 23720  // The "step" function for percentile(Y,P) is called once for each
 23721  // input row.
 23722  func percentStep(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* percentile.c:101:13: */
 23723  	var p uintptr
 23724  	var rPct float64
 23725  	var eType int32
 23726  	var y float64
 23727  
 23728  	// Requirement 3:  P must be a number between 0 and 100
 23729  	eType = sqlite3.Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 23730  	rPct = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 23731  	if (((eType != SQLITE_INTEGER) && (eType != SQLITE_FLOAT)) ||
 23732  		(rPct < 0.0)) || (rPct > 100.0) {
 23733  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 23734  			ts+5747 /* "2nd argument to ..." */, -1)
 23735  		return
 23736  	}
 23737  
 23738  	// Allocate the session context.
 23739  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(Percentile{})))
 23740  	if p == uintptr(0) {
 23741  		return
 23742  	}
 23743  
 23744  	// Remember the P value.  Throw an error if the P value is different
 23745  	// from any prior row, per Requirement (2).
 23746  	if (*Percentile)(unsafe.Pointer(p)).FrPct == 0.0 {
 23747  		(*Percentile)(unsafe.Pointer(p)).FrPct = (rPct + 1.0)
 23748  	} else if !(sameValue(tls, (*Percentile)(unsafe.Pointer(p)).FrPct, (rPct+1.0)) != 0) {
 23749  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 23750  			ts+5814 /* "2nd argument to ..." */, -1)
 23751  		return
 23752  	}
 23753  
 23754  	// Ignore rows for which Y is NULL
 23755  	eType = sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23756  	if eType == SQLITE_NULL {
 23757  		return
 23758  	}
 23759  
 23760  	// If not NULL, then Y must be numeric.  Otherwise throw an error.
 23761  	// Requirement 4
 23762  	if (eType != SQLITE_INTEGER) && (eType != SQLITE_FLOAT) {
 23763  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 23764  			ts+5878 /* "1st argument to ..." */, -1)
 23765  		return
 23766  	}
 23767  
 23768  	// Throw an error if the Y value is infinity or NaN
 23769  	y = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23770  	if isInfinity(tls, y) != 0 {
 23771  		sqlite3.Xsqlite3_result_error(tls, pCtx, ts+5922 /* "Inf input to per..." */, -1)
 23772  		return
 23773  	}
 23774  
 23775  	// Allocate and store the Y
 23776  	if (*Percentile)(unsafe.Pointer(p)).FnUsed >= (*Percentile)(unsafe.Pointer(p)).FnAlloc {
 23777  		var n uint32 = (((*Percentile)(unsafe.Pointer(p)).FnAlloc * uint32(2)) + uint32(250))
 23778  		var a uintptr = sqlite3.Xsqlite3_realloc64(tls, (*Percentile)(unsafe.Pointer(p)).Fa, (uint64(uint64(unsafe.Sizeof(float64(0))) * uint64(n))))
 23779  		if a == uintptr(0) {
 23780  			sqlite3.Xsqlite3_free(tls, (*Percentile)(unsafe.Pointer(p)).Fa)
 23781  			libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Percentile{})))
 23782  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 23783  			return
 23784  		}
 23785  		(*Percentile)(unsafe.Pointer(p)).FnAlloc = n
 23786  		(*Percentile)(unsafe.Pointer(p)).Fa = a
 23787  	}
 23788  	*(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(libc.PostIncUint32(&(*Percentile)(unsafe.Pointer(p)).FnUsed, 1))*8)) = y
 23789  }
 23790  
 23791  // Compare to doubles for sorting using qsort()
 23792  func doubleCmp(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* percentile.c:170:25: */
 23793  	var a float64 = *(*float64)(unsafe.Pointer(pA))
 23794  	var b float64 = *(*float64)(unsafe.Pointer(pB))
 23795  	if a == b {
 23796  		return 0
 23797  	}
 23798  	if a < b {
 23799  		return -1
 23800  	}
 23801  	return +1
 23802  }
 23803  
 23804  // Called to compute the final output of percentile() and to clean
 23805  // up all allocated memory.
 23806  func percentFinal(tls *libc.TLS, pCtx uintptr) { /* percentile.c:182:13: */
 23807  	var p uintptr
 23808  	var i1 uint32
 23809  	var i2 uint32
 23810  	var v1 float64
 23811  	var v2 float64
 23812  	var ix float64
 23813  	var vx float64
 23814  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, 0)
 23815  	if p == uintptr(0) {
 23816  		return
 23817  	}
 23818  	if (*Percentile)(unsafe.Pointer(p)).Fa == uintptr(0) {
 23819  		return
 23820  	}
 23821  	if (*Percentile)(unsafe.Pointer(p)).FnUsed != 0 {
 23822  		libc.Xqsort(tls, (*Percentile)(unsafe.Pointer(p)).Fa, uint64((*Percentile)(unsafe.Pointer(p)).FnUsed), uint64(unsafe.Sizeof(float64(0))), *(*uintptr)(unsafe.Pointer(&struct {
 23823  			f func(*libc.TLS, uintptr, uintptr) int32
 23824  		}{doubleCmp})))
 23825  		ix = ((((*Percentile)(unsafe.Pointer(p)).FrPct - 1.0) * (float64((*Percentile)(unsafe.Pointer(p)).FnUsed - uint32(1)))) * 0.01)
 23826  		i1 = uint32(ix)
 23827  		if (ix == float64(i1)) || (i1 == ((*Percentile)(unsafe.Pointer(p)).FnUsed - uint32(1))) {
 23828  			i2 = i1
 23829  		} else {
 23830  			i2 = (i1 + uint32(1))
 23831  		}
 23832  		v1 = *(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(i1)*8))
 23833  		v2 = *(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(i2)*8))
 23834  		vx = (v1 + ((v2 - v1) * (ix - float64(i1))))
 23835  		sqlite3.Xsqlite3_result_double(tls, pCtx, vx)
 23836  	}
 23837  	sqlite3.Xsqlite3_free(tls, (*Percentile)(unsafe.Pointer(p)).Fa)
 23838  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Percentile{})))
 23839  }
 23840  
 23841  func sqlite3_percentile_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* percentile.c:208:5: */
 23842  	var rc int32 = SQLITE_OK
 23843  	_ = pApi
 23844  
 23845  	_ = pzErrMsg // Unused parameter
 23846  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5948 /* "percentile" */, 2,
 23847  		(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23848  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 23849  			f func(*libc.TLS, uintptr, int32, uintptr)
 23850  		}{percentStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{percentFinal})))
 23851  	return rc
 23852  }
 23853  
 23854  // prefixes_vtab is a subclass of sqlite3_vtab which is
 23855  // underlying representation of the virtual table
 23856  type prefixes_vtab1 = struct{ Fbase sqlite3_vtab } /* prefixes.c:33:9 */
 23857  
 23858  // prefixes_vtab is a subclass of sqlite3_vtab which is
 23859  // underlying representation of the virtual table
 23860  type prefixes_vtab = prefixes_vtab1 /* prefixes.c:33:30 */
 23861  
 23862  // prefixes_cursor is a subclass of sqlite3_vtab_cursor which will
 23863  // serve as the underlying representation of a cursor that scans
 23864  // over rows of the result
 23865  type prefixes_cursor1 = struct {
 23866  	Fbase   sqlite3_vtab_cursor
 23867  	FiRowid sqlite3_int64
 23868  	FzStr   uintptr
 23869  	FnStr   int32
 23870  	_       [4]byte
 23871  } /* prefixes.c:43:9 */
 23872  
 23873  // prefixes_cursor is a subclass of sqlite3_vtab_cursor which will
 23874  // serve as the underlying representation of a cursor that scans
 23875  // over rows of the result
 23876  type prefixes_cursor = prefixes_cursor1 /* prefixes.c:43:32 */
 23877  
 23878  // The prefixesConnect() method is invoked to create a new
 23879  // template virtual table.
 23880  //
 23881  // Think of this routine as the constructor for prefixes_vtab objects.
 23882  //
 23883  // All this routine needs to do is:
 23884  //
 23885  //    (1) Allocate the prefixes_vtab object and initialize all fields.
 23886  //
 23887  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 23888  //        result set of queries against the virtual table will look like.
 23889  func prefixesConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* prefixes.c:64:12: */
 23890  	var pNew uintptr
 23891  	var rc int32
 23892  
 23893  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 23894  		ts+5959 /* "CREATE TABLE pre..." */)
 23895  	if rc == SQLITE_OK {
 23896  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(prefixes_vtab{})))
 23897  		*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 23898  		if pNew == uintptr(0) {
 23899  			return SQLITE_NOMEM
 23900  		}
 23901  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(prefixes_vtab{})))
 23902  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 23903  	}
 23904  	return rc
 23905  }
 23906  
 23907  // This method is the destructor for prefixes_vtab objects.
 23908  func prefixesDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* prefixes.c:90:12: */
 23909  	var p uintptr = pVtab
 23910  	sqlite3.Xsqlite3_free(tls, p)
 23911  	return SQLITE_OK
 23912  }
 23913  
 23914  // Constructor for a new prefixes_cursor object.
 23915  func prefixesOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* prefixes.c:99:12: */
 23916  	var pCur uintptr
 23917  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(prefixes_cursor{})))
 23918  	if pCur == uintptr(0) {
 23919  		return SQLITE_NOMEM
 23920  	}
 23921  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(prefixes_cursor{})))
 23922  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 23923  	return SQLITE_OK
 23924  }
 23925  
 23926  // Destructor for a prefixes_cursor.
 23927  func prefixesClose(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:111:12: */
 23928  	var pCur uintptr = cur
 23929  	sqlite3.Xsqlite3_free(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr)
 23930  	sqlite3.Xsqlite3_free(tls, pCur)
 23931  	return SQLITE_OK
 23932  }
 23933  
 23934  // Advance a prefixes_cursor to its next row of output.
 23935  func prefixesNext(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:122:12: */
 23936  	var pCur uintptr = cur
 23937  	(*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid++
 23938  	return SQLITE_OK
 23939  }
 23940  
 23941  // Return values of columns for the row at which the prefixes_cursor
 23942  // is currently pointing.
 23943  func prefixesColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* prefixes.c:132:12: */
 23944  	var pCur uintptr = cur
 23945  	switch i {
 23946  	case 0:
 23947  		sqlite3.Xsqlite3_result_text(tls, ctx, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr, ((*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr - int32((*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid)),
 23948  			uintptr(0))
 23949  		break
 23950  	default:
 23951  		sqlite3.Xsqlite3_result_text(tls, ctx, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr, (*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr, uintptr(0))
 23952  		break
 23953  	}
 23954  	return SQLITE_OK
 23955  }
 23956  
 23957  // Return the rowid for the current row.  In this implementation, the
 23958  // rowid is the same as the output value.
 23959  func prefixesRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* prefixes.c:154:12: */
 23960  	var pCur uintptr = cur
 23961  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid
 23962  	return SQLITE_OK
 23963  }
 23964  
 23965  // Return TRUE if the cursor has been moved off of the last
 23966  // row of output.
 23967  func prefixesEof(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:164:12: */
 23968  	var pCur uintptr = cur
 23969  	return (libc.Bool32((*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid > sqlite3_int64((*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr)))
 23970  }
 23971  
 23972  // This method is called to "rewind" the prefixes_cursor object back
 23973  // to the first row of output.  This method is always called at least
 23974  // once prior to any call to prefixesColumn() or prefixesRowid() or
 23975  // prefixesEof().
 23976  func prefixesFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* prefixes.c:175:12: */
 23977  	bp := tls.Alloc(8)
 23978  	defer tls.Free(8)
 23979  
 23980  	var pCur uintptr = pVtabCursor
 23981  	sqlite3.Xsqlite3_free(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr)
 23982  	if argc > 0 {
 23983  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 23984  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr = func() int32 {
 23985  			if (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr != 0 {
 23986  				return int32(libc.Xstrlen(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr))
 23987  			}
 23988  			return 0
 23989  		}()
 23990  	} else {
 23991  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr = uintptr(0)
 23992  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr = 0
 23993  	}
 23994  	(*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(0)
 23995  	return SQLITE_OK
 23996  }
 23997  
 23998  // SQLite will invoke this method one or more times while planning a query
 23999  // that uses the virtual table.  This routine needs to create
 24000  // a query plan for each invocation and compute an estimated cost for that
 24001  // plan.
 24002  func prefixesBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* prefixes.c:199:12: */
 24003  	// Search for a usable equality constraint against column 1
 24004  	// (original_string) and use it if at all possible
 24005  	var i int32
 24006  	var p uintptr
 24007  
 24008  	i = 0
 24009  	p = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 24010  __1:
 24011  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 24012  		goto __3
 24013  	}
 24014  	{
 24015  		if (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn != 1 {
 24016  			goto __2
 24017  		}
 24018  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 24019  			goto __2
 24020  		}
 24021  		if !(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) != 0) {
 24022  			goto __2
 24023  		}
 24024  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 24025  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 24026  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10)
 24027  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10)
 24028  		return SQLITE_OK
 24029  
 24030  	}
 24031  	goto __2
 24032  __2:
 24033  	i++
 24034  	p += 12
 24035  	goto __1
 24036  	goto __3
 24037  __3:
 24038  	;
 24039  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1000000000)
 24040  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000000000)
 24041  	return SQLITE_OK
 24042  }
 24043  
 24044  // This following structure defines all the methods for the
 24045  // virtual table.
 24046  var prefixesModule = sqlite3_module{
 24047  	/* xConnect    */ FxConnect: 0,
 24048  	/* xBestIndex  */ FxBestIndex: 0,
 24049  	/* xDisconnect */ FxDisconnect: 0,
 24050  	/* xOpen       */ FxOpen: 0,
 24051  	/* xClose      */ FxClose: 0,
 24052  	/* xFilter     */ FxFilter: 0,
 24053  	/* xNext       */ FxNext: 0,
 24054  	/* xEof        */ FxEof: 0,
 24055  	/* xColumn     */ FxColumn: 0,
 24056  	/* xRowid      */ FxRowid: 0,
 24057  } /* prefixes.c:227:23 */
 24058  
 24059  // This is a copy of the SQLITE_SKIP_UTF8(zIn) macro in sqliteInt.h.
 24060  //
 24061  // Assuming zIn points to the first byte of a UTF-8 character,
 24062  // advance zIn to point to the first byte of the next UTF-8 character.
 24063  
 24064  // Implementation of function prefix_length(). This function accepts two
 24065  // strings as arguments and returns the length in characters (not bytes),
 24066  // of the longest prefix shared by the two strings. For example:
 24067  //
 24068  //   prefix_length('abcdxxx', 'abcyy') == 3
 24069  //   prefix_length('abcdxxx', 'bcyyy') == 0
 24070  //   prefix_length('abcdxxx', 'ab')    == 2
 24071  //   prefix_length('ab',      'abcd')  == 2
 24072  //
 24073  // This function assumes the input is well-formed utf-8. If it is not,
 24074  // it is possible for this function to return -1.
 24075  func prefixLengthFunc(tls *libc.TLS, ctx uintptr, nVal int32, apVal uintptr) { /* prefixes.c:279:13: */
 24076  	var nByte int32    // Number of bytes to compare
 24077  	var nRet int32 = 0 // Return value
 24078  	var zL uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 24079  	var zR uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8)))
 24080  	var nL int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 24081  	var nR int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8)))
 24082  	var i int32
 24083  
 24084  	nByte = func() int32 {
 24085  		if nL > nR {
 24086  			return nL
 24087  		}
 24088  		return nR
 24089  	}()
 24090  	for i = 0; i < nByte; i++ {
 24091  		if int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) != int32(*(*uint8)(unsafe.Pointer(zR + uintptr(i)))) {
 24092  			break
 24093  		}
 24094  		if (int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) & 0xC0) != 0x80 {
 24095  			nRet++
 24096  		}
 24097  	}
 24098  
 24099  	if (int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) & 0xC0) == 0x80 {
 24100  		nRet--
 24101  	}
 24102  	sqlite3.Xsqlite3_result_int(tls, ctx, nRet)
 24103  }
 24104  
 24105  func sqlite3_prefixes_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* prefixes.c:305:5: */
 24106  	var rc int32 = SQLITE_OK
 24107  	_ = pApi
 24108  
 24109  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+6023 /* "prefixes" */, uintptr(unsafe.Pointer(&prefixesModule)), uintptr(0))
 24110  	if rc == SQLITE_OK {
 24111  		rc = sqlite3.Xsqlite3_create_function(tls,
 24112  			db, ts+6032 /* "prefix_length" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 24113  				f func(*libc.TLS, uintptr, int32, uintptr)
 24114  			}{prefixLengthFunc})), uintptr(0), uintptr(0))
 24115  	}
 24116  	return rc
 24117  }
 24118  
 24119  // The following macros redefine the API routines so that they are
 24120  // redirected through the global sqlite3_api structure.
 24121  //
 24122  // This header file is also used by the loadext.c source file
 24123  // (part of the main SQLite library - not an extension) so that
 24124  // it can get access to the sqlite3_api_routines structure
 24125  // definition.  But the main library does not want to redefine
 24126  // the API.  So the redefinition macros are only valid if the
 24127  // SQLITE_CORE macros is undefined.
 24128  
 24129  // This case when the file is being statically linked into the
 24130  // application
 24131  
 24132  // The following #defines change the names of some functions implemented in
 24133  // this file to prevent name collisions with C-library functions of the
 24134  // same name.
 24135  
 24136  // The end-of-input character
 24137  
 24138  // The NFA is implemented as sequence of opcodes taken from the following
 24139  // set.  Each opcode has a single integer argument.
 24140  
 24141  // Each opcode is a "state" in the NFA
 24142  type ReStateNumber = uint16 /* regexp.c:98:24 */
 24143  
 24144  // Because this is an NFA and not a DFA, multiple states can be active at
 24145  // once.  An instance of the following object records all active states in
 24146  // the NFA.  The implementation is optimized for the common case where the
 24147  // number of actives states is small.
 24148  type ReStateSet1 = struct {
 24149  	FnState uint32
 24150  	_       [4]byte
 24151  	FaState uintptr
 24152  } /* regexp.c:105:9 */
 24153  
 24154  // Because this is an NFA and not a DFA, multiple states can be active at
 24155  // once.  An instance of the following object records all active states in
 24156  // the NFA.  The implementation is optimized for the common case where the
 24157  // number of actives states is small.
 24158  type ReStateSet = ReStateSet1 /* regexp.c:108:3 */
 24159  
 24160  // An input string read one character at a time.
 24161  type ReInput1 = struct {
 24162  	Fz  uintptr
 24163  	Fi  int32
 24164  	Fmx int32
 24165  } /* regexp.c:112:9 */
 24166  
 24167  // An input string read one character at a time.
 24168  type ReInput = ReInput1 /* regexp.c:112:24 */
 24169  
 24170  // A compiled NFA (or an NFA that is in the process of being compiled) is
 24171  // an instance of the following object.
 24172  type ReCompiled1 = struct {
 24173  	FsIn       ReInput
 24174  	FzErr      uintptr
 24175  	FaOp       uintptr
 24176  	FaArg      uintptr
 24177  	FxNextChar uintptr
 24178  	FzInit     [12]uint8
 24179  	FnInit     int32
 24180  	FnState    uint32
 24181  	FnAlloc    uint32
 24182  } /* regexp.c:122:9 */
 24183  
 24184  // A compiled NFA (or an NFA that is in the process of being compiled) is
 24185  // an instance of the following object.
 24186  type ReCompiled = ReCompiled1 /* regexp.c:122:27 */
 24187  
 24188  // Add a state to the given state set if it is not already there
 24189  func re_add_state(tls *libc.TLS, pSet uintptr, newState int32) { /* regexp.c:136:13: */
 24190  	var i uint32
 24191  	for i = uint32(0); i < (*ReStateSet)(unsafe.Pointer(pSet)).FnState; i++ {
 24192  		if int32(*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pSet)).FaState + uintptr(i)*2))) == newState {
 24193  			return
 24194  		}
 24195  	}
 24196  	*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pSet)).FaState + uintptr(libc.PostIncUint32(&(*ReStateSet)(unsafe.Pointer(pSet)).FnState, 1))*2)) = ReStateNumber(newState)
 24197  }
 24198  
 24199  // Extract the next unicode character from *pzIn and return it.  Advance
 24200  // *pzIn to the first byte past the end of the character returned.  To
 24201  // be clear:  this routine converts utf8 to unicode.  This routine is
 24202  // optimized for the common case where the next character is a single byte.
 24203  func re_next_char(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:147:17: */
 24204  	var c uint32
 24205  	if (*ReInput)(unsafe.Pointer(p)).Fi >= (*ReInput)(unsafe.Pointer(p)).Fmx {
 24206  		return uint32(0)
 24207  	}
 24208  	c = uint32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*ReInput)(unsafe.Pointer(p)).Fi, 1)))))
 24209  	if c >= uint32(0x80) {
 24210  		if (((c & uint32(0xe0)) == uint32(0xc0)) && ((*ReInput)(unsafe.Pointer(p)).Fi < (*ReInput)(unsafe.Pointer(p)).Fmx)) && ((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr((*ReInput)(unsafe.Pointer(p)).Fi)))) & 0xc0) == 0x80) {
 24211  			c = (((c & uint32(0x1f)) << 6) | (uint32(int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*ReInput)(unsafe.Pointer(p)).Fi, 1))))) & 0x3f)))
 24212  			if c < uint32(0x80) {
 24213  				c = uint32(0xfffd)
 24214  			}
 24215  		} else if ((((c & uint32(0xf0)) == uint32(0xe0)) && (((*ReInput)(unsafe.Pointer(p)).Fi + 1) < (*ReInput)(unsafe.Pointer(p)).Fmx)) && ((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr((*ReInput)(unsafe.Pointer(p)).Fi)))) & 0xc0) == 0x80)) &&
 24216  			((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 1))))) & 0xc0) == 0x80) {
 24217  			c = ((((c & uint32(0x0f)) << 12) | (uint32((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr((*ReInput)(unsafe.Pointer(p)).Fi)))) & 0x3f) << 6))) | (uint32(int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 1))))) & 0x3f)))
 24218  			*(*int32)(unsafe.Pointer(p + 8 /* &.i */)) += (2)
 24219  			if (c <= uint32(0x7ff)) || ((c >= uint32(0xd800)) && (c <= uint32(0xdfff))) {
 24220  				c = uint32(0xfffd)
 24221  			}
 24222  		} else if (((((c & uint32(0xf8)) == uint32(0xf0)) && (((*ReInput)(unsafe.Pointer(p)).Fi + 3) < (*ReInput)(unsafe.Pointer(p)).Fmx)) && ((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr((*ReInput)(unsafe.Pointer(p)).Fi)))) & 0xc0) == 0x80)) &&
 24223  			((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 1))))) & 0xc0) == 0x80)) && ((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 2))))) & 0xc0) == 0x80) {
 24224  			c = (((((c & uint32(0x07)) << 18) | (uint32((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr((*ReInput)(unsafe.Pointer(p)).Fi)))) & 0x3f) << 12))) | (uint32((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 1))))) & 0x3f) << 6))) |
 24225  				(uint32(int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 2))))) & 0x3f)))
 24226  			*(*int32)(unsafe.Pointer(p + 8 /* &.i */)) += (3)
 24227  			if (c <= uint32(0xffff)) || (c > uint32(0x10ffff)) {
 24228  				c = uint32(0xfffd)
 24229  			}
 24230  		} else {
 24231  			c = uint32(0xfffd)
 24232  		}
 24233  	}
 24234  	return c
 24235  }
 24236  
 24237  func re_next_char_nocase(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:172:17: */
 24238  	var c uint32 = re_next_char(tls, p)
 24239  	if (c >= uint32('A')) && (c <= uint32('Z')) {
 24240  		c = c + (uint32('a' - 'A'))
 24241  	}
 24242  	return c
 24243  }
 24244  
 24245  // Return true if c is a perl "word" character:  [A-Za-z0-9_]
 24246  func re_word_char(tls *libc.TLS, c int32) int32 { /* regexp.c:179:12: */
 24247  	return (libc.Bool32(((((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'z'))) ||
 24248  		((c >= 'A') && (c <= 'Z'))) || (c == '_')))
 24249  }
 24250  
 24251  // Return true if c is a "digit" character:  [0-9]
 24252  func re_digit_char(tls *libc.TLS, c int32) int32 { /* regexp.c:185:12: */
 24253  	return (libc.Bool32((c >= '0') && (c <= '9')))
 24254  }
 24255  
 24256  // Return true if c is a perl "space" character:  [ \t\r\n\v\f]
 24257  func re_space_char(tls *libc.TLS, c int32) int32 { /* regexp.c:190:12: */
 24258  	return (libc.Bool32((((((c == ' ') || (c == '\t')) || (c == '\n')) || (c == '\r')) || (c == '\v')) || (c == '\f')))
 24259  }
 24260  
 24261  // Run a compiled regular expression on the zero-terminated input
 24262  // string zIn[].  Return true on a match and false if there is no match.
 24263  func sqlite3re_match(tls *libc.TLS, pRe uintptr, zIn uintptr, nIn int32) int32 { /* regexp.c:197:12: */
 24264  	bp := tls.Alloc(248)
 24265  	defer tls.Free(248)
 24266  
 24267  	// var aStateSet [2]ReStateSet at bp, 32
 24268  
 24269  	var pThis uintptr
 24270  	var pNext uintptr
 24271  	// var aSpace [100]ReStateNumber at bp+32, 200
 24272  
 24273  	var pToFree uintptr
 24274  	var i uint32
 24275  	var iSwap uint32
 24276  	var c int32
 24277  	var cPrev int32
 24278  	var rc int32
 24279  	// var in ReInput at bp+232, 16
 24280  
 24281  	var x uint8
 24282  	var j int32
 24283  	var n int32
 24284  	var hit int32
 24285  	var x1 int32
 24286  	i = uint32(0)
 24287  	iSwap = uint32(0)
 24288  	c = (RE_EOF + 1)
 24289  	cPrev = 0
 24290  	rc = 0
 24291  
 24292  	(*ReInput)(unsafe.Pointer(bp + 232 /* &in */)).Fz = zIn
 24293  	(*ReInput)(unsafe.Pointer(bp + 232 /* &in */)).Fi = 0
 24294  	(*ReInput)(unsafe.Pointer(bp + 232 /* &in */)).Fmx = func() int32 {
 24295  		if nIn >= 0 {
 24296  			return nIn
 24297  		}
 24298  		return int32(libc.Xstrlen(tls, zIn))
 24299  	}()
 24300  
 24301  	// Look for the initial prefix match, if there is one.
 24302  	if !((*ReCompiled)(unsafe.Pointer(pRe)).FnInit != 0) {
 24303  		goto __1
 24304  	}
 24305  	x = *(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */)))
 24306  __2:
 24307  	if !((((*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fi + (*ReCompiled)(unsafe.Pointer(pRe)).FnInit) <= (*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fmx) &&
 24308  		((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fi)))) != int32(x)) || (libc.Xstrncmp(tls, (zIn+uintptr((*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fi)), pRe+48 /* &.zInit */, uint64((*ReCompiled)(unsafe.Pointer(pRe)).FnInit)) != 0))) {
 24309  		goto __3
 24310  	}
 24311  	(*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fi++
 24312  	goto __2
 24313  __3:
 24314  	;
 24315  	if !(((*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fi + (*ReCompiled)(unsafe.Pointer(pRe)).FnInit) > (*ReInput)(unsafe.Pointer(bp+232 /* &in */)).Fmx) {
 24316  		goto __4
 24317  	}
 24318  	return 0
 24319  __4:
 24320  	;
 24321  __1:
 24322  	;
 24323  
 24324  	if !(uint64((*ReCompiled)(unsafe.Pointer(pRe)).FnState) <= (uint64(unsafe.Sizeof([100]ReStateNumber{})) / (uint64(unsafe.Sizeof(ReStateNumber(0))) * uint64(2)))) {
 24325  		goto __5
 24326  	}
 24327  	pToFree = uintptr(0)
 24328  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState = bp + 32 /* &aSpace[0] */
 24329  	goto __6
 24330  __5:
 24331  	pToFree = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(ReStateNumber(0))) * uint64(2)) * uint64((*ReCompiled)(unsafe.Pointer(pRe)).FnState))))
 24332  	if !(pToFree == uintptr(0)) {
 24333  		goto __7
 24334  	}
 24335  	return -1
 24336  __7:
 24337  	;
 24338  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState = pToFree
 24339  __6:
 24340  	;
 24341  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */ + 1*16)).FaState = ((*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState + uintptr((*ReCompiled)(unsafe.Pointer(pRe)).FnState)*2)
 24342  	pNext = (bp /* &aStateSet */ + 1*16)
 24343  	(*ReStateSet)(unsafe.Pointer(pNext)).FnState = uint32(0)
 24344  	re_add_state(tls, pNext, 0)
 24345  __8:
 24346  	if !((c != RE_EOF) && ((*ReStateSet)(unsafe.Pointer(pNext)).FnState > uint32(0))) {
 24347  		goto __9
 24348  	}
 24349  	cPrev = c
 24350  	c = int32((*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((pRe + 40 /* &.xNextChar */))))(tls, bp+232 /* &in */))
 24351  	pThis = pNext
 24352  	pNext = (bp /* &aStateSet */ + uintptr(iSwap)*16)
 24353  	iSwap = (uint32(1) - iSwap)
 24354  	(*ReStateSet)(unsafe.Pointer(pNext)).FnState = uint32(0)
 24355  	i = uint32(0)
 24356  __10:
 24357  	if !(i < (*ReStateSet)(unsafe.Pointer(pThis)).FnState) {
 24358  		goto __12
 24359  	}
 24360  	x1 = int32(*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pThis)).FaState + uintptr(i)*2)))
 24361  	switch int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(x1)))) {
 24362  	case RE_OP_MATCH:
 24363  		goto __14
 24364  	case RE_OP_ANY:
 24365  		goto __15
 24366  	case RE_OP_WORD:
 24367  		goto __16
 24368  	case RE_OP_NOTWORD:
 24369  		goto __17
 24370  	case RE_OP_DIGIT:
 24371  		goto __18
 24372  	case RE_OP_NOTDIGIT:
 24373  		goto __19
 24374  	case RE_OP_SPACE:
 24375  		goto __20
 24376  	case RE_OP_NOTSPACE:
 24377  		goto __21
 24378  	case RE_OP_BOUNDARY:
 24379  		goto __22
 24380  	case RE_OP_ANYSTAR:
 24381  		goto __23
 24382  	case RE_OP_FORK:
 24383  		goto __24
 24384  	case RE_OP_GOTO:
 24385  		goto __25
 24386  	case RE_OP_ACCEPT:
 24387  		goto __26
 24388  	case RE_OP_CC_EXC:
 24389  		goto __27
 24390  	case RE_OP_CC_INC:
 24391  		goto __28
 24392  	}
 24393  	goto __13
 24394  __14:
 24395  	if !(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4)) == c) {
 24396  		goto __29
 24397  	}
 24398  	re_add_state(tls, pNext, (x1 + 1))
 24399  __29:
 24400  	;
 24401  	goto __13
 24402  
 24403  __15:
 24404  	if !(c != 0) {
 24405  		goto __30
 24406  	}
 24407  	re_add_state(tls, pNext, (x1 + 1))
 24408  __30:
 24409  	;
 24410  	goto __13
 24411  
 24412  __16:
 24413  	if !(re_word_char(tls, c) != 0) {
 24414  		goto __31
 24415  	}
 24416  	re_add_state(tls, pNext, (x1 + 1))
 24417  __31:
 24418  	;
 24419  	goto __13
 24420  
 24421  __17:
 24422  	if !(!(re_word_char(tls, c) != 0) && (c != 0)) {
 24423  		goto __32
 24424  	}
 24425  	re_add_state(tls, pNext, (x1 + 1))
 24426  __32:
 24427  	;
 24428  	goto __13
 24429  
 24430  __18:
 24431  	if !(re_digit_char(tls, c) != 0) {
 24432  		goto __33
 24433  	}
 24434  	re_add_state(tls, pNext, (x1 + 1))
 24435  __33:
 24436  	;
 24437  	goto __13
 24438  
 24439  __19:
 24440  	if !(!(re_digit_char(tls, c) != 0) && (c != 0)) {
 24441  		goto __34
 24442  	}
 24443  	re_add_state(tls, pNext, (x1 + 1))
 24444  __34:
 24445  	;
 24446  	goto __13
 24447  
 24448  __20:
 24449  	if !(re_space_char(tls, c) != 0) {
 24450  		goto __35
 24451  	}
 24452  	re_add_state(tls, pNext, (x1 + 1))
 24453  __35:
 24454  	;
 24455  	goto __13
 24456  
 24457  __21:
 24458  	if !(!(re_space_char(tls, c) != 0) && (c != 0)) {
 24459  		goto __36
 24460  	}
 24461  	re_add_state(tls, pNext, (x1 + 1))
 24462  __36:
 24463  	;
 24464  	goto __13
 24465  
 24466  __22:
 24467  	if !(re_word_char(tls, c) != re_word_char(tls, cPrev)) {
 24468  		goto __37
 24469  	}
 24470  	re_add_state(tls, pThis, (x1 + 1))
 24471  __37:
 24472  	;
 24473  	goto __13
 24474  
 24475  __23:
 24476  	re_add_state(tls, pNext, x1)
 24477  	re_add_state(tls, pThis, (x1 + 1))
 24478  	goto __13
 24479  
 24480  __24:
 24481  	re_add_state(tls, pThis, (x1 + *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))))
 24482  	re_add_state(tls, pThis, (x1 + 1))
 24483  	goto __13
 24484  
 24485  __25:
 24486  	re_add_state(tls, pThis, (x1 + *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))))
 24487  	goto __13
 24488  
 24489  __26:
 24490  	rc = 1
 24491  	goto re_match_end
 24492  
 24493  __27:
 24494  	if !(c == 0) {
 24495  		goto __38
 24496  	}
 24497  	goto __13
 24498  __38:
 24499  	;
 24500  	// fall-through
 24501  
 24502  __28:
 24503  	j = 1
 24504  	n = *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))
 24505  	hit = 0
 24506  	j = 1
 24507  __39:
 24508  	if !((j > 0) && (j < n)) {
 24509  		goto __41
 24510  	}
 24511  	if !(int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr((x1 + j))))) == RE_OP_CC_VALUE) {
 24512  		goto __42
 24513  	}
 24514  	if !(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr((x1+j))*4)) == c) {
 24515  		goto __44
 24516  	}
 24517  	hit = 1
 24518  	j = -1
 24519  __44:
 24520  	;
 24521  	goto __43
 24522  __42:
 24523  	if !((*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr((x1+j))*4)) <= c) && (*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(((x1+j)+1))*4)) >= c)) {
 24524  		goto __45
 24525  	}
 24526  	hit = 1
 24527  	j = -1
 24528  	goto __46
 24529  __45:
 24530  	j++
 24531  __46:
 24532  	;
 24533  __43:
 24534  	;
 24535  	goto __40
 24536  __40:
 24537  	j++
 24538  	goto __39
 24539  	goto __41
 24540  __41:
 24541  	;
 24542  	if !(int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(x1)))) == RE_OP_CC_EXC) {
 24543  		goto __47
 24544  	}
 24545  	hit = libc.BoolInt32(!(hit != 0))
 24546  __47:
 24547  	;
 24548  	if !(hit != 0) {
 24549  		goto __48
 24550  	}
 24551  	re_add_state(tls, pNext, (x1 + n))
 24552  __48:
 24553  	;
 24554  	goto __13
 24555  
 24556  __13:
 24557  	;
 24558  	goto __11
 24559  __11:
 24560  	i++
 24561  	goto __10
 24562  	goto __12
 24563  __12:
 24564  	;
 24565  	goto __8
 24566  __9:
 24567  	;
 24568  	i = uint32(0)
 24569  __49:
 24570  	if !(i < (*ReStateSet)(unsafe.Pointer(pNext)).FnState) {
 24571  		goto __51
 24572  	}
 24573  	if !(int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pNext)).FaState + uintptr(i)*2)))))) == RE_OP_ACCEPT) {
 24574  		goto __52
 24575  	}
 24576  	rc = 1
 24577  	goto __51
 24578  __52:
 24579  	;
 24580  	goto __50
 24581  __50:
 24582  	i++
 24583  	goto __49
 24584  	goto __51
 24585  __51:
 24586  	;
 24587  re_match_end:
 24588  	sqlite3.Xsqlite3_free(tls, pToFree)
 24589  	return rc
 24590  }
 24591  
 24592  // Resize the opcode and argument arrays for an RE under construction.
 24593  func re_resize(tls *libc.TLS, p uintptr, N int32) int32 { /* regexp.c:340:12: */
 24594  	var aOp uintptr
 24595  	var aArg uintptr
 24596  	aOp = sqlite3.Xsqlite3_realloc64(tls, (*ReCompiled)(unsafe.Pointer(p)).FaOp, (uint64(uint64(N) * uint64(unsafe.Sizeof(int8(0))))))
 24597  	if aOp == uintptr(0) {
 24598  		return 1
 24599  	}
 24600  	(*ReCompiled)(unsafe.Pointer(p)).FaOp = aOp
 24601  	aArg = sqlite3.Xsqlite3_realloc64(tls, (*ReCompiled)(unsafe.Pointer(p)).FaArg, (uint64(uint64(N) * uint64(unsafe.Sizeof(int32(0))))))
 24602  	if aArg == uintptr(0) {
 24603  		return 1
 24604  	}
 24605  	(*ReCompiled)(unsafe.Pointer(p)).FaArg = aArg
 24606  	(*ReCompiled)(unsafe.Pointer(p)).FnAlloc = uint32(N)
 24607  	return 0
 24608  }
 24609  
 24610  // Insert a new opcode and argument into an RE under construction.  The
 24611  // insertion point is just prior to existing opcode iBefore.
 24612  func re_insert(tls *libc.TLS, p uintptr, iBefore int32, op int32, arg int32) int32 { /* regexp.c:356:12: */
 24613  	var i int32
 24614  	if ((*ReCompiled)(unsafe.Pointer(p)).FnAlloc <= (*ReCompiled)(unsafe.Pointer(p)).FnState) && (re_resize(tls, p, (int32((*ReCompiled)(unsafe.Pointer(p)).FnAlloc*uint32(2)))) != 0) {
 24615  		return 0
 24616  	}
 24617  	for i = int32((*ReCompiled)(unsafe.Pointer(p)).FnState); i > iBefore; i-- {
 24618  		*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(i))) = *(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr((i - 1))))
 24619  		*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(i)*4)) = *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr((i-1))*4))
 24620  	}
 24621  	(*ReCompiled)(unsafe.Pointer(p)).FnState++
 24622  	*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(iBefore))) = int8(op)
 24623  	*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iBefore)*4)) = arg
 24624  	return iBefore
 24625  }
 24626  
 24627  // Append a new opcode and argument to the end of the RE under construction.
 24628  func re_append(tls *libc.TLS, p uintptr, op int32, arg int32) int32 { /* regexp.c:371:12: */
 24629  	return re_insert(tls, p, int32((*ReCompiled)(unsafe.Pointer(p)).FnState), op, arg)
 24630  }
 24631  
 24632  // Make a copy of N opcodes starting at iStart onto the end of the RE
 24633  // under construction.
 24634  func re_copy(tls *libc.TLS, p uintptr, iStart int32, N int32) { /* regexp.c:378:13: */
 24635  	if (((*ReCompiled)(unsafe.Pointer(p)).FnState + uint32(N)) >= (*ReCompiled)(unsafe.Pointer(p)).FnAlloc) && (re_resize(tls, p, (int32(((*ReCompiled)(unsafe.Pointer(p)).FnAlloc*uint32(2))+uint32(N)))) != 0) {
 24636  		return
 24637  	}
 24638  	libc.Xmemcpy(tls, ((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr((*ReCompiled)(unsafe.Pointer(p)).FnState)), ((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(iStart)), (uint64(N) * uint64(unsafe.Sizeof(int8(0)))))
 24639  	libc.Xmemcpy(tls, ((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr((*ReCompiled)(unsafe.Pointer(p)).FnState)*4), ((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iStart)*4), (uint64(N) * uint64(unsafe.Sizeof(int32(0)))))
 24640  	*(*uint32)(unsafe.Pointer(p + 64 /* &.nState */)) += (uint32(N))
 24641  }
 24642  
 24643  // Return true if c is a hexadecimal digit character:  [0-9a-fA-F]
 24644  // If c is a hex digit, also set *pV = (*pV)*16 + valueof(c).  If
 24645  // c is not a hex digit *pV is unchanged.
 24646  func re_hex(tls *libc.TLS, c int32, pV uintptr) int32 { /* regexp.c:389:12: */
 24647  	if (c >= '0') && (c <= '9') {
 24648  		c = c - ('0')
 24649  	} else if (c >= 'a') && (c <= 'f') {
 24650  		c = c - ('a' - 10)
 24651  	} else if (c >= 'A') && (c <= 'F') {
 24652  		c = c - ('A' - 10)
 24653  	} else {
 24654  		return 0
 24655  	}
 24656  	*(*int32)(unsafe.Pointer(pV)) = (((*(*int32)(unsafe.Pointer(pV))) * 16) + (c & 0xff))
 24657  	return 1
 24658  }
 24659  
 24660  // A backslash character has been seen, read the next character and
 24661  // return its interpretation.
 24662  func re_esc_char(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:406:17: */
 24663  	bp := tls.Alloc(4)
 24664  	defer tls.Free(4)
 24665  
 24666  	var i int32
 24667  	*(*int32)(unsafe.Pointer(bp /* v */)) = 0
 24668  	var c int8
 24669  	if (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi >= (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx {
 24670  		return uint32(0)
 24671  	}
 24672  	c = int8(*(*uint8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))))
 24673  	if (int32(c) == 'u') && (((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi + 4) < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx) {
 24674  		var zIn uintptr = ((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))
 24675  		if (((re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 1))), bp /* &v */) != 0) &&
 24676  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 2))), bp /* &v */) != 0)) &&
 24677  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 3))), bp /* &v */) != 0)) &&
 24678  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 4))), bp /* &v */) != 0) {
 24679  			*(*int32)(unsafe.Pointer(p /* &.sIn */ + 8 /* &.i */)) += (5)
 24680  			return uint32(*(*int32)(unsafe.Pointer(bp /* v */)))
 24681  		}
 24682  	}
 24683  	if (int32(c) == 'x') && (((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi + 2) < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx) {
 24684  		var zIn uintptr = ((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))
 24685  		if (re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 1))), bp /* &v */) != 0) &&
 24686  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 2))), bp /* &v */) != 0) {
 24687  			*(*int32)(unsafe.Pointer(p /* &.sIn */ + 8 /* &.i */)) += (3)
 24688  			return uint32(*(*int32)(unsafe.Pointer(bp /* v */)))
 24689  		}
 24690  	}
 24691  	for i = 0; (zEsc[i] != 0) && (int32(zEsc[i]) != int32(c)); i++ {
 24692  	}
 24693  	if zEsc[i] != 0 {
 24694  		if i < 6 {
 24695  			c = zTrans[i]
 24696  		}
 24697  		(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24698  	} else {
 24699  		(*ReCompiled)(unsafe.Pointer(p)).FzErr = ts + 6046 /* "unknown \\ escape" */
 24700  	}
 24701  	return uint32(c)
 24702  }
 24703  
 24704  var zEsc = *(*[21]int8)(unsafe.Pointer(ts + 6063 /* "afnrtv\\()*.+?[$^..." */)) /* regexp.c:407:21 */
 24705  var zTrans = *(*[7]int8)(unsafe.Pointer(ts + 6084 /* "\a\f\n\r\t\v" */))        /* regexp.c:408:21 */
 24706  
 24707  // Peek at the next byte of input
 24708  func rePeek(tls *libc.TLS, p uintptr) uint8 { /* regexp.c:447:22: */
 24709  	if (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx {
 24710  		return *(*uint8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi)))
 24711  	}
 24712  	return uint8(0)
 24713  }
 24714  
 24715  // Compile RE text into a sequence of opcodes.  Continue up to the
 24716  // first unmatched ")" character, then return.  If an error is found,
 24717  // return a pointer to the error message string.
 24718  func re_subcompile_re(tls *libc.TLS, p uintptr) uintptr { /* regexp.c:455:19: */
 24719  	var zErr uintptr
 24720  	var iStart int32
 24721  	var iEnd int32
 24722  	var iGoto int32
 24723  	iStart = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 24724  	zErr = re_subcompile_string(tls, p)
 24725  	if zErr != 0 {
 24726  		return zErr
 24727  	}
 24728  	for int32(rePeek(tls, p)) == '|' {
 24729  		iEnd = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 24730  		re_insert(tls, p, iStart, RE_OP_FORK, ((iEnd + 2) - iStart))
 24731  		iGoto = re_append(tls, p, RE_OP_GOTO, 0)
 24732  		(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24733  		zErr = re_subcompile_string(tls, p)
 24734  		if zErr != 0 {
 24735  			return zErr
 24736  		}
 24737  		*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iGoto)*4)) = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iGoto)))
 24738  	}
 24739  	return uintptr(0)
 24740  }
 24741  
 24742  // Compile an element of regular expression text (anything that can be
 24743  // an operand to the "|" operator).  Return NULL on success or a pointer
 24744  // to the error message if there is a problem.
 24745  func re_subcompile_string(tls *libc.TLS, p uintptr) uintptr { /* regexp.c:477:19: */
 24746  	var iPrev int32 = -1
 24747  	var iStart int32
 24748  	var c uint32
 24749  	var zErr uintptr
 24750  	for (libc.AssignUint32(&c, (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 40 /* &.xNextChar */))))(tls, (p /* &.sIn */)))) != uint32(0) {
 24751  		iStart = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 24752  		switch c {
 24753  		case uint32('|'):
 24754  			fallthrough
 24755  		case uint32('$'):
 24756  			fallthrough
 24757  		case uint32(')'):
 24758  			{
 24759  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi--
 24760  				return uintptr(0)
 24761  
 24762  			}
 24763  		case uint32('('):
 24764  			{
 24765  				zErr = re_subcompile_re(tls, p)
 24766  				if zErr != 0 {
 24767  					return zErr
 24768  				}
 24769  				if int32(rePeek(tls, p)) != ')' {
 24770  					return ts + 6091 /* "unmatched '('" */
 24771  				}
 24772  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24773  				break
 24774  
 24775  			}
 24776  		case uint32('.'):
 24777  			{
 24778  				if int32(rePeek(tls, p)) == '*' {
 24779  					re_append(tls, p, RE_OP_ANYSTAR, 0)
 24780  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24781  				} else {
 24782  					re_append(tls, p, RE_OP_ANY, 0)
 24783  				}
 24784  				break
 24785  
 24786  			}
 24787  		case uint32('*'):
 24788  			{
 24789  				if iPrev < 0 {
 24790  					return ts + 6105 /* "'*' without oper..." */
 24791  				}
 24792  				re_insert(tls, p, iPrev, RE_OP_GOTO, (int32(((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)) + uint32(1))))
 24793  				re_append(tls, p, RE_OP_FORK, (int32((uint32(iPrev) - (*ReCompiled)(unsafe.Pointer(p)).FnState) + uint32(1))))
 24794  				break
 24795  
 24796  			}
 24797  		case uint32('+'):
 24798  			{
 24799  				if iPrev < 0 {
 24800  					return ts + 6125 /* "'+' without oper..." */
 24801  				}
 24802  				re_append(tls, p, RE_OP_FORK, (int32(uint32(iPrev) - (*ReCompiled)(unsafe.Pointer(p)).FnState)))
 24803  				break
 24804  
 24805  			}
 24806  		case uint32('?'):
 24807  			{
 24808  				if iPrev < 0 {
 24809  					return ts + 6145 /* "'?' without oper..." */
 24810  				}
 24811  				re_insert(tls, p, iPrev, RE_OP_FORK, (int32(((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)) + uint32(1))))
 24812  				break
 24813  
 24814  			}
 24815  		case uint32('{'):
 24816  			{
 24817  				var m int32 = 0
 24818  				var n int32 = 0
 24819  				var sz int32
 24820  				var j int32
 24821  				if iPrev < 0 {
 24822  					return ts + 6165 /* "'{m,n}' without ..." */
 24823  				}
 24824  				for ((libc.AssignUint32(&c, uint32(rePeek(tls, p)))) >= uint32('0')) && (c <= uint32('9')) {
 24825  					m = (int32(((uint32(m * 10)) + c) - uint32('0')))
 24826  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24827  				}
 24828  				n = m
 24829  				if c == uint32(',') {
 24830  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24831  					n = 0
 24832  					for ((libc.AssignUint32(&c, uint32(rePeek(tls, p)))) >= uint32('0')) && (c <= uint32('9')) {
 24833  						n = (int32(((uint32(n * 10)) + c) - uint32('0')))
 24834  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24835  					}
 24836  				}
 24837  				if c != uint32('}') {
 24838  					return ts + 6189 /* "unmatched '{'" */
 24839  				}
 24840  				if (n > 0) && (n < m) {
 24841  					return ts + 6203 /* "n less than m in..." */
 24842  				}
 24843  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24844  				sz = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)))
 24845  				if m == 0 {
 24846  					if n == 0 {
 24847  						return ts + 6228 /* "both m and n are..." */
 24848  					}
 24849  					re_insert(tls, p, iPrev, RE_OP_FORK, (sz + 1))
 24850  					n--
 24851  				} else {
 24852  					for j = 1; j < m; j++ {
 24853  						re_copy(tls, p, iPrev, sz)
 24854  					}
 24855  				}
 24856  				for j = m; j < n; j++ {
 24857  					re_append(tls, p, RE_OP_FORK, (sz + 1))
 24858  					re_copy(tls, p, iPrev, sz)
 24859  				}
 24860  				if (n == 0) && (m > 0) {
 24861  					re_append(tls, p, RE_OP_FORK, -sz)
 24862  				}
 24863  				break
 24864  
 24865  			}
 24866  		case uint32('['):
 24867  			{
 24868  				var iFirst int32 = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 24869  				if int32(rePeek(tls, p)) == '^' {
 24870  					re_append(tls, p, RE_OP_CC_EXC, 0)
 24871  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24872  				} else {
 24873  					re_append(tls, p, RE_OP_CC_INC, 0)
 24874  				}
 24875  				for (libc.AssignUint32(&c, (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 40 /* &.xNextChar */))))(tls, (p /* &.sIn */)))) != uint32(0) {
 24876  					if (c == uint32('[')) && (int32(rePeek(tls, p)) == ':') {
 24877  						return ts + 6261 /* "POSIX character ..." */
 24878  					}
 24879  					if c == uint32('\\') {
 24880  						c = re_esc_char(tls, p)
 24881  					}
 24882  					if int32(rePeek(tls, p)) == '-' {
 24883  						re_append(tls, p, RE_OP_CC_RANGE, int32(c))
 24884  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24885  						c = (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 40 /* &.xNextChar */))))(tls, (p /* &.sIn */))
 24886  						if c == uint32('\\') {
 24887  							c = re_esc_char(tls, p)
 24888  						}
 24889  						re_append(tls, p, RE_OP_CC_RANGE, int32(c))
 24890  					} else {
 24891  						re_append(tls, p, RE_OP_CC_VALUE, int32(c))
 24892  					}
 24893  					if int32(rePeek(tls, p)) == ']' {
 24894  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24895  						break
 24896  					}
 24897  				}
 24898  				if c == uint32(0) {
 24899  					return ts + 6299 /* "unclosed '['" */
 24900  				}
 24901  				*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iFirst)*4)) = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iFirst)))
 24902  				break
 24903  
 24904  			}
 24905  		case uint32('\\'):
 24906  			{
 24907  				var specialOp int32 = 0
 24908  				switch int32(rePeek(tls, p)) {
 24909  				case 'b':
 24910  					specialOp = RE_OP_BOUNDARY
 24911  					break
 24912  				case 'd':
 24913  					specialOp = RE_OP_DIGIT
 24914  					break
 24915  				case 'D':
 24916  					specialOp = RE_OP_NOTDIGIT
 24917  					break
 24918  				case 's':
 24919  					specialOp = RE_OP_SPACE
 24920  					break
 24921  				case 'S':
 24922  					specialOp = RE_OP_NOTSPACE
 24923  					break
 24924  				case 'w':
 24925  					specialOp = RE_OP_WORD
 24926  					break
 24927  				case 'W':
 24928  					specialOp = RE_OP_NOTWORD
 24929  					break
 24930  				}
 24931  				if specialOp != 0 {
 24932  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 24933  					re_append(tls, p, specialOp, 0)
 24934  				} else {
 24935  					c = re_esc_char(tls, p)
 24936  					re_append(tls, p, RE_OP_MATCH, int32(c))
 24937  				}
 24938  				break
 24939  
 24940  			}
 24941  		default:
 24942  			{
 24943  				re_append(tls, p, RE_OP_MATCH, int32(c))
 24944  				break
 24945  
 24946  			}
 24947  		}
 24948  		iPrev = iStart
 24949  	}
 24950  	return uintptr(0)
 24951  }
 24952  
 24953  // Free and reclaim all the memory used by a previously compiled
 24954  // regular expression.  Applications should invoke this routine once
 24955  // for every call to re_compile() to avoid memory leaks.
 24956  func sqlite3re_free(tls *libc.TLS, pRe uintptr) { /* regexp.c:616:13: */
 24957  	if pRe != 0 {
 24958  		sqlite3.Xsqlite3_free(tls, (*ReCompiled)(unsafe.Pointer(pRe)).FaOp)
 24959  		sqlite3.Xsqlite3_free(tls, (*ReCompiled)(unsafe.Pointer(pRe)).FaArg)
 24960  		sqlite3.Xsqlite3_free(tls, pRe)
 24961  	}
 24962  }
 24963  
 24964  // Compile a textual regular expression in zIn[] into a compiled regular
 24965  // expression suitable for us by re_match() and return a pointer to the
 24966  // compiled regular expression in *ppRe.  Return NULL on success or an
 24967  // error message if something goes wrong.
 24968  func sqlite3re_compile(tls *libc.TLS, ppRe uintptr, zIn uintptr, noCase int32) uintptr { /* regexp.c:630:19: */
 24969  	var pRe uintptr
 24970  	var zErr uintptr
 24971  	var i int32
 24972  	var j int32
 24973  
 24974  	*(*uintptr)(unsafe.Pointer(ppRe)) = uintptr(0)
 24975  	pRe = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ReCompiled{})))
 24976  	if pRe == uintptr(0) {
 24977  		return ts + 1930 /* "out of memory" */
 24978  	}
 24979  	libc.Xmemset(tls, pRe, 0, uint64(unsafe.Sizeof(ReCompiled{})))
 24980  	(*ReCompiled)(unsafe.Pointer(pRe)).FxNextChar = func() uintptr {
 24981  		if noCase != 0 {
 24982  			return *(*uintptr)(unsafe.Pointer(&struct {
 24983  				f func(*libc.TLS, uintptr) uint32
 24984  			}{re_next_char_nocase}))
 24985  		}
 24986  		return *(*uintptr)(unsafe.Pointer(&struct {
 24987  			f func(*libc.TLS, uintptr) uint32
 24988  		}{re_next_char}))
 24989  	}()
 24990  	if re_resize(tls, pRe, 30) != 0 {
 24991  		sqlite3re_free(tls, pRe)
 24992  		return ts + 1930 /* "out of memory" */
 24993  	}
 24994  	if int32(*(*int8)(unsafe.Pointer(zIn))) == '^' {
 24995  		zIn++
 24996  	} else {
 24997  		re_append(tls, pRe, RE_OP_ANYSTAR, 0)
 24998  	}
 24999  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fz = zIn
 25000  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi = 0
 25001  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx = int32(libc.Xstrlen(tls, zIn))
 25002  	zErr = re_subcompile_re(tls, pRe)
 25003  	if zErr != 0 {
 25004  		sqlite3re_free(tls, pRe)
 25005  		return zErr
 25006  	}
 25007  	if (int32(rePeek(tls, pRe)) == '$') && (((*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi + 1) >= (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx) {
 25008  		re_append(tls, pRe, RE_OP_MATCH, RE_EOF)
 25009  		re_append(tls, pRe, RE_OP_ACCEPT, 0)
 25010  		*(*uintptr)(unsafe.Pointer(ppRe)) = pRe
 25011  	} else if (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi >= (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx {
 25012  		re_append(tls, pRe, RE_OP_ACCEPT, 0)
 25013  		*(*uintptr)(unsafe.Pointer(ppRe)) = pRe
 25014  	} else {
 25015  		sqlite3re_free(tls, pRe)
 25016  		return ts + 6312 /* "unrecognized cha..." */
 25017  	}
 25018  
 25019  	// The following is a performance optimization.  If the regex begins with
 25020  	// ".*" (if the input regex lacks an initial "^") and afterwards there are
 25021  	// one or more matching characters, enter those matching characters into
 25022  	// zInit[].  The re_match() routine can then search ahead in the input
 25023  	// string looking for the initial match without having to run the whole
 25024  	// regex engine over the string.  Do not worry able trying to match
 25025  	// unicode characters beyond plane 0 - those are very rare and this is
 25026  	// just an optimization.
 25027  	if (int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp))) == RE_OP_ANYSTAR) && !(noCase != 0) {
 25028  		j = 0
 25029  		i = 1
 25030  		for ; (j < (int32(unsafe.Sizeof([12]uint8{})) - 2)) && (int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(i)))) == RE_OP_MATCH); i++ {
 25031  			var x uint32 = uint32(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(i)*4)))
 25032  			if x <= uint32(127) {
 25033  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = uint8(x)
 25034  			} else if x <= uint32(0xfff) {
 25035  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0xc0) | (x >> 6)))
 25036  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | (x & uint32(0x3f))))
 25037  			} else if x <= uint32(0xffff) {
 25038  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0xd0) | (x >> 12)))
 25039  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | ((x >> 6) & uint32(0x3f))))
 25040  				*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | (x & uint32(0x3f))))
 25041  			} else {
 25042  				break
 25043  			}
 25044  		}
 25045  		if (j > 0) && (int32(*(*uint8)(unsafe.Pointer((pRe + 48 /* &.zInit */) + uintptr((j - 1))))) == 0) {
 25046  			j--
 25047  		}
 25048  		(*ReCompiled)(unsafe.Pointer(pRe)).FnInit = j
 25049  	}
 25050  	return (*ReCompiled)(unsafe.Pointer(pRe)).FzErr
 25051  }
 25052  
 25053  // Implementation of the regexp() SQL function.  This function implements
 25054  // the build-in REGEXP operator.  The first argument to the function is the
 25055  // pattern and the second argument is the string.  So, the SQL statements:
 25056  //
 25057  //       A REGEXP B
 25058  //
 25059  // is implemented as regexp(B,A).
 25060  func re_sql_func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* regexp.c:710:13: */
 25061  	bp := tls.Alloc(8)
 25062  	defer tls.Free(8)
 25063  
 25064  	// var pRe uintptr at bp, 8
 25065  	// Compiled regular expression
 25066  	var zPattern uintptr // The regular expression
 25067  	var zStr uintptr     // String being searched
 25068  	var zErr uintptr     // Compile error message
 25069  	var setAux int32 = 0 // True to invoke sqlite3_set_auxdata()
 25070  
 25071  	_ = argc // Unused
 25072  	*(*uintptr)(unsafe.Pointer(bp /* pRe */)) = sqlite3.Xsqlite3_get_auxdata(tls, context, 0)
 25073  	if *(*uintptr)(unsafe.Pointer(bp /* pRe */)) == uintptr(0) {
 25074  		zPattern = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 25075  		if zPattern == uintptr(0) {
 25076  			return
 25077  		}
 25078  		zErr = sqlite3re_compile(tls, bp /* &pRe */, zPattern, (libc.Bool32(sqlite3.Xsqlite3_user_data(tls, context) != uintptr(0))))
 25079  		if zErr != 0 {
 25080  			sqlite3re_free(tls, *(*uintptr)(unsafe.Pointer(bp /* pRe */)))
 25081  			sqlite3.Xsqlite3_result_error(tls, context, zErr, -1)
 25082  			return
 25083  		}
 25084  		if *(*uintptr)(unsafe.Pointer(bp /* pRe */)) == uintptr(0) {
 25085  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 25086  			return
 25087  		}
 25088  		setAux = 1
 25089  	}
 25090  	zStr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 25091  	if zStr != uintptr(0) {
 25092  		sqlite3.Xsqlite3_result_int(tls, context, sqlite3re_match(tls, *(*uintptr)(unsafe.Pointer(bp /* pRe */)), zStr, -1))
 25093  	}
 25094  	if setAux != 0 {
 25095  		sqlite3.Xsqlite3_set_auxdata(tls, context, 0, *(*uintptr)(unsafe.Pointer(bp /* pRe */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3re_free})))
 25096  	}
 25097  }
 25098  
 25099  // Invoke this routine to register the regexp() function with the
 25100  // SQLite database connection.
 25101  func sqlite3_regexp_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* regexp.c:754:5: */
 25102  	var rc int32 = SQLITE_OK
 25103  	_ = pApi
 25104  
 25105  	_ = pzErrMsg // Unused
 25106  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6335 /* "regexp" */, 2, (SQLITE_UTF8 | SQLITE_INNOCUOUS),
 25107  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 25108  			f func(*libc.TLS, uintptr, int32, uintptr)
 25109  		}{re_sql_func})), uintptr(0), uintptr(0))
 25110  	if rc == SQLITE_OK {
 25111  		// The regexpi(PATTERN,STRING) function is a case-insensitive version
 25112  		// of regexp(PATTERN,STRING).
 25113  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6342 /* "regexpi" */, 2, (SQLITE_UTF8 | SQLITE_INNOCUOUS),
 25114  			db, *(*uintptr)(unsafe.Pointer(&struct {
 25115  				f func(*libc.TLS, uintptr, int32, uintptr)
 25116  			}{re_sql_func})), uintptr(0), uintptr(0))
 25117  	}
 25118  	return rc
 25119  }
 25120  
 25121  //      remember(V,PTR)
 25122  //
 25123  // Return the integer value V.  Also save the value of V in a
 25124  // C-language variable whose address is PTR.
 25125  func rememberFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* remember.c:45:13: */
 25126  	var v sqlite3_int64
 25127  	var ptr uintptr
 25128  
 25129  	v = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 25130  	ptr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+3921 /* "carray" */)
 25131  	if ptr != 0 {
 25132  		*(*sqlite3_int64)(unsafe.Pointer(ptr)) = v
 25133  	}
 25134  	sqlite3.Xsqlite3_result_int64(tls, pCtx, v)
 25135  }
 25136  
 25137  func sqlite3_remember_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* remember.c:62:5: */
 25138  	var rc int32 = SQLITE_OK
 25139  	_ = pApi
 25140  
 25141  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6350 /* "remember" */, 2, SQLITE_UTF8, uintptr(0),
 25142  		*(*uintptr)(unsafe.Pointer(&struct {
 25143  			f func(*libc.TLS, uintptr, int32, uintptr)
 25144  		}{rememberFunc})), uintptr(0), uintptr(0))
 25145  	return rc
 25146  }
 25147  
 25148  // series_cursor is a subclass of sqlite3_vtab_cursor which will
 25149  // serve as the underlying representation of a cursor that scans
 25150  // over rows of the result
 25151  type series_cursor1 = struct {
 25152  	Fbase    sqlite3_vtab_cursor
 25153  	FisDesc  int32
 25154  	_        [4]byte
 25155  	FiRowid  sqlite3_int64
 25156  	FiValue  sqlite3_int64
 25157  	FmnValue sqlite3_int64
 25158  	FmxValue sqlite3_int64
 25159  	FiStep   sqlite3_int64
 25160  } /* series.c:83:9 */
 25161  
 25162  // series_cursor is a subclass of sqlite3_vtab_cursor which will
 25163  // serve as the underlying representation of a cursor that scans
 25164  // over rows of the result
 25165  type series_cursor = series_cursor1 /* series.c:83:30 */
 25166  
 25167  // The seriesConnect() method is invoked to create a new
 25168  // series_vtab that describes the generate_series virtual table.
 25169  //
 25170  // Think of this routine as the constructor for series_vtab objects.
 25171  //
 25172  // All this routine needs to do is:
 25173  //
 25174  //    (1) Allocate the series_vtab object and initialize all fields.
 25175  //
 25176  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 25177  //        result set of queries against generate_series will look like.
 25178  func seriesConnect(tls *libc.TLS, db uintptr, pUnused uintptr, argcUnused int32, argvUnused uintptr, ppVtab uintptr, pzErrUnused uintptr) int32 { /* series.c:107:12: */
 25179  	var pNew uintptr
 25180  	var rc int32
 25181  
 25182  	// Column numbers
 25183  
 25184  	_ = pUnused
 25185  	_ = argcUnused
 25186  	_ = argvUnused
 25187  	_ = pzErrUnused
 25188  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 25189  		ts+6359 /* "CREATE TABLE x(v..." */)
 25190  	if rc == SQLITE_OK {
 25191  		pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 25192  		if pNew == uintptr(0) {
 25193  			return SQLITE_NOMEM
 25194  		}
 25195  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(sqlite3_vtab{})))
 25196  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 25197  	}
 25198  	return rc
 25199  }
 25200  
 25201  // This method is the destructor for series_cursor objects.
 25202  func seriesDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* series.c:141:12: */
 25203  	sqlite3.Xsqlite3_free(tls, pVtab)
 25204  	return SQLITE_OK
 25205  }
 25206  
 25207  // Constructor for a new series_cursor object.
 25208  func seriesOpen(tls *libc.TLS, pUnused uintptr, ppCursor uintptr) int32 { /* series.c:149:12: */
 25209  	var pCur uintptr
 25210  	_ = pUnused
 25211  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(series_cursor{})))
 25212  	if pCur == uintptr(0) {
 25213  		return SQLITE_NOMEM
 25214  	}
 25215  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(series_cursor{})))
 25216  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 25217  	return SQLITE_OK
 25218  }
 25219  
 25220  // Destructor for a series_cursor.
 25221  func seriesClose(tls *libc.TLS, cur uintptr) int32 { /* series.c:162:12: */
 25222  	sqlite3.Xsqlite3_free(tls, cur)
 25223  	return SQLITE_OK
 25224  }
 25225  
 25226  // Advance a series_cursor to its next row of output.
 25227  func seriesNext(tls *libc.TLS, cur uintptr) int32 { /* series.c:171:12: */
 25228  	var pCur uintptr = cur
 25229  	if (*series_cursor)(unsafe.Pointer(pCur)).FisDesc != 0 {
 25230  		*(*sqlite3_int64)(unsafe.Pointer(pCur + 24 /* &.iValue */)) -= ((*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 25231  	} else {
 25232  		*(*sqlite3_int64)(unsafe.Pointer(pCur + 24 /* &.iValue */)) += ((*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 25233  	}
 25234  	(*series_cursor)(unsafe.Pointer(pCur)).FiRowid++
 25235  	return SQLITE_OK
 25236  }
 25237  
 25238  // Return values of columns for the row at which the series_cursor
 25239  // is currently pointing.
 25240  func seriesColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* series.c:186:12: */
 25241  	var pCur uintptr = cur
 25242  	var x sqlite3_int64 = int64(0)
 25243  	switch i {
 25244  	case SERIES_COLUMN_START:
 25245  		x = (*series_cursor)(unsafe.Pointer(pCur)).FmnValue
 25246  		break
 25247  	case SERIES_COLUMN_STOP:
 25248  		x = (*series_cursor)(unsafe.Pointer(pCur)).FmxValue
 25249  		break
 25250  	case SERIES_COLUMN_STEP:
 25251  		x = (*series_cursor)(unsafe.Pointer(pCur)).FiStep
 25252  		break
 25253  	default:
 25254  		x = (*series_cursor)(unsafe.Pointer(pCur)).FiValue
 25255  		break
 25256  	}
 25257  	sqlite3.Xsqlite3_result_int64(tls, ctx, x)
 25258  	return SQLITE_OK
 25259  }
 25260  
 25261  // Return the rowid for the current row. In this implementation, the
 25262  // first row returned is assigned rowid value 1, and each subsequent
 25263  // row a value 1 more than that of the previous.
 25264  func seriesRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* series.c:208:12: */
 25265  	var pCur uintptr = cur
 25266  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*series_cursor)(unsafe.Pointer(pCur)).FiRowid
 25267  	return SQLITE_OK
 25268  }
 25269  
 25270  // Return TRUE if the cursor has been moved off of the last
 25271  // row of output.
 25272  func seriesEof(tls *libc.TLS, cur uintptr) int32 { /* series.c:218:12: */
 25273  	var pCur uintptr = cur
 25274  	if (*series_cursor)(unsafe.Pointer(pCur)).FisDesc != 0 {
 25275  		return (libc.Bool32((*series_cursor)(unsafe.Pointer(pCur)).FiValue < (*series_cursor)(unsafe.Pointer(pCur)).FmnValue))
 25276  	} else {
 25277  		return (libc.Bool32((*series_cursor)(unsafe.Pointer(pCur)).FiValue > (*series_cursor)(unsafe.Pointer(pCur)).FmxValue))
 25278  	}
 25279  	return int32(0)
 25280  }
 25281  
 25282  // True to cause run-time checking of the start=, stop=, and/or step=
 25283  // parameters.  The only reason to do this is for testing the
 25284  // constraint checking logic for virtual tables in the SQLite core.
 25285  
 25286  // This method is called to "rewind" the series_cursor object back
 25287  // to the first row of output.  This method is always called at least
 25288  // once prior to any call to seriesColumn() or seriesRowid() or
 25289  // seriesEof().
 25290  //
 25291  // The query plan selected by seriesBestIndex is passed in the idxNum
 25292  // parameter.  (idxStr is not used in this implementation.)  idxNum
 25293  // is a bitmask showing which constraints are available:
 25294  //
 25295  //    1:    start=VALUE
 25296  //    2:    stop=VALUE
 25297  //    4:    step=VALUE
 25298  //
 25299  // Also, if bit 8 is set, that means that the series should be output
 25300  // in descending order rather than in ascending order.  If bit 16 is
 25301  // set, then output must appear in ascending order.
 25302  //
 25303  // This routine should initialize the cursor and position it so that it
 25304  // is pointing at the first row, or pointing off the end of the table
 25305  // (so that seriesEof() will return true) if the table is empty.
 25306  func seriesFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStrUnused uintptr, argc int32, argv uintptr) int32 { /* series.c:257:12: */
 25307  	var pCur uintptr = pVtabCursor
 25308  	var i int32 = 0
 25309  	_ = idxStrUnused
 25310  	if (idxNum & 1) != 0 {
 25311  		(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*8)))
 25312  	} else {
 25313  		(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = int64(0)
 25314  	}
 25315  	if (idxNum & 2) != 0 {
 25316  		(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*8)))
 25317  	} else {
 25318  		(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0xffffffff)
 25319  	}
 25320  	if (idxNum & 4) != 0 {
 25321  		(*series_cursor)(unsafe.Pointer(pCur)).FiStep = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*8)))
 25322  		if (*series_cursor)(unsafe.Pointer(pCur)).FiStep == int64(0) {
 25323  			(*series_cursor)(unsafe.Pointer(pCur)).FiStep = int64(1)
 25324  		} else if (*series_cursor)(unsafe.Pointer(pCur)).FiStep < int64(0) {
 25325  			(*series_cursor)(unsafe.Pointer(pCur)).FiStep = -(*series_cursor)(unsafe.Pointer(pCur)).FiStep
 25326  			if (idxNum & 16) == 0 {
 25327  				idxNum = idxNum | (8)
 25328  			}
 25329  		}
 25330  	} else {
 25331  		(*series_cursor)(unsafe.Pointer(pCur)).FiStep = int64(1)
 25332  	}
 25333  	for i = 0; i < argc; i++ {
 25334  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) == SQLITE_NULL {
 25335  			// If any of the constraints have a NULL value, then return no rows.
 25336  			// See ticket https://www.sqlite.org/src/info/fac496b61722daf2
 25337  			(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = int64(1)
 25338  			(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0)
 25339  			break
 25340  		}
 25341  	}
 25342  	if (idxNum & 8) != 0 {
 25343  		(*series_cursor)(unsafe.Pointer(pCur)).FisDesc = 1
 25344  		(*series_cursor)(unsafe.Pointer(pCur)).FiValue = (*series_cursor)(unsafe.Pointer(pCur)).FmxValue
 25345  		if (*series_cursor)(unsafe.Pointer(pCur)).FiStep > int64(0) {
 25346  			*(*sqlite3_int64)(unsafe.Pointer(pCur + 24 /* &.iValue */)) -= (((*series_cursor)(unsafe.Pointer(pCur)).FmxValue - (*series_cursor)(unsafe.Pointer(pCur)).FmnValue) % (*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 25347  		}
 25348  	} else {
 25349  		(*series_cursor)(unsafe.Pointer(pCur)).FisDesc = 0
 25350  		(*series_cursor)(unsafe.Pointer(pCur)).FiValue = (*series_cursor)(unsafe.Pointer(pCur)).FmnValue
 25351  	}
 25352  	(*series_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 25353  	return SQLITE_OK
 25354  }
 25355  
 25356  // SQLite will invoke this method one or more times while planning a query
 25357  // that uses the generate_series virtual table.  This routine needs to create
 25358  // a query plan for each invocation and compute an estimated cost for that
 25359  // plan.
 25360  //
 25361  // In this implementation idxNum is used to represent the
 25362  // query plan.  idxStr is unused.
 25363  //
 25364  // The query plan is represented by bits in idxNum:
 25365  //
 25366  //  (1)  start = $value  -- constraint exists
 25367  //  (2)  stop = $value   -- constraint exists
 25368  //  (4)  step = $value   -- constraint exists
 25369  //  (8)  output in descending order
 25370  func seriesBestIndex(tls *libc.TLS, tabUnused uintptr, pIdxInfo uintptr) int32 { /* series.c:325:12: */
 25371  	bp := tls.Alloc(12)
 25372  	defer tls.Free(12)
 25373  
 25374  	var i int32
 25375  	var j int32                // Loop over constraints
 25376  	var idxNum int32 = 0       // The query plan bitmask
 25377  	var unusableMask int32 = 0 // Mask of unusable constraints
 25378  	var nArg int32 = 0         // Number of arguments that seriesFilter() expects
 25379  	// var aIdx [3]int32 at bp, 12
 25380  	// Constraints on start, stop, and step
 25381  	var pConstraint uintptr
 25382  
 25383  	// This implementation assumes that the start, stop, and step columns
 25384  	// are the last three columns in the virtual table.
 25385  
 25386  	_ = tabUnused
 25387  	*(*int32)(unsafe.Pointer(bp /* &aIdx[0] */)) = libc.AssignPtrInt32(bp /* &aIdx */ +1*4, libc.AssignPtrInt32(bp /* &aIdx */ +2*4, -1))
 25388  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 25389  	i = 0
 25390  __1:
 25391  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 25392  		goto __3
 25393  	}
 25394  	{
 25395  		var iCol int32  // 0 for start, 1 for stop, 2 for step
 25396  		var iMask int32 // bitmask for those column
 25397  		if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < SERIES_COLUMN_START {
 25398  			goto __2
 25399  		}
 25400  		iCol = ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - SERIES_COLUMN_START)
 25401  
 25402  		iMask = (int32(1) << iCol)
 25403  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 25404  			unusableMask = unusableMask | (iMask)
 25405  			goto __2
 25406  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 25407  			idxNum = idxNum | (iMask)
 25408  			*(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + uintptr(iCol)*4)) = i
 25409  		}
 25410  
 25411  	}
 25412  	goto __2
 25413  __2:
 25414  	i++
 25415  	pConstraint += 12
 25416  	goto __1
 25417  	goto __3
 25418  __3:
 25419  	;
 25420  	for i = 0; i < 3; i++ {
 25421  		if (libc.AssignInt32(&j, *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + uintptr(i)*4)))) >= 0 {
 25422  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).FargvIndex = libc.PreIncInt32(&nArg, 1)
 25423  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).Fomit = libc.BoolUint8(!(1 != 0))
 25424  		}
 25425  	}
 25426  	if (unusableMask & ^idxNum) != 0 {
 25427  		// The start, stop, and step columns are inputs.  Therefore if there
 25428  		// are unusable constraints on any of start, stop, or step then
 25429  		// this plan is unusable
 25430  		return SQLITE_CONSTRAINT
 25431  	}
 25432  	if (idxNum & 3) == 3 {
 25433  		// Both start= and stop= boundaries are available.  This is the
 25434  		// the preferred case
 25435  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (float64(2 - (libc.Bool32((idxNum & 4) != 0))))
 25436  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000)
 25437  		if (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1 {
 25438  			if (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc != 0 {
 25439  				idxNum = idxNum | (8)
 25440  			} else {
 25441  				idxNum = idxNum | (16)
 25442  			}
 25443  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 25444  		}
 25445  	} else {
 25446  		// If either boundary is missing, we have to generate a huge span
 25447  		// of numbers.  Make this case very expensive so that the query
 25448  		// planner will work hard to avoid it.
 25449  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647)
 25450  	}
 25451  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 25452  	return SQLITE_OK
 25453  }
 25454  
 25455  // This following structure defines all the methods for the
 25456  // generate_series virtual table.
 25457  var seriesModule = sqlite3_module{ // xCreate
 25458  	FxConnect:    0, // xConnect
 25459  	FxBestIndex:  0, // xBestIndex
 25460  	FxDisconnect: 0, // xDestroy
 25461  	FxOpen:       0, // xOpen - open a cursor
 25462  	FxClose:      0, // xClose - close a cursor
 25463  	FxFilter:     0, // xFilter - configure scan constraints
 25464  	FxNext:       0, // xNext - advance a cursor
 25465  	FxEof:        0, // xEof - check for end of scan
 25466  	FxColumn:     0, // xColumn - read data
 25467  	FxRowid:      0, // xShadowName
 25468  } /* series.c:397:23 */
 25469  
 25470  func sqlite3_series_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* series.c:429:5: */
 25471  	var rc int32 = SQLITE_OK
 25472  	_ = pApi
 25473  
 25474  	if sqlite3.Xsqlite3_libversion_number(tls) < 3008012 {
 25475  		*(*uintptr)(unsafe.Pointer(pzErrMsg)) = sqlite3.Xsqlite3_mprintf(tls,
 25476  			ts+6418 /* "generate_series(..." */, 0)
 25477  		return SQLITE_ERROR
 25478  	}
 25479  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+6468 /* "generate_series" */, uintptr(unsafe.Pointer(&seriesModule)), uintptr(0))
 25480  	return rc
 25481  }
 25482  
 25483  type u16 = uint16 /* spellfix.c:34:26 */
 25484  
 25485  // POSIX.1-2001 specifies _tolower() and _toupper() to be macros equivalent to
 25486  // tolower() and toupper() respectively, minus extra checking to ensure that
 25487  // the argument is a lower or uppercase letter respectively.  We've chosen to
 25488  // implement these macros with the same error checking as tolower() and
 25489  // toupper() since this doesn't violate the specification itself, only its
 25490  // intent.  We purposely leave _tolower() and _toupper() undocumented to
 25491  // discourage their use.
 25492  //
 25493  // XXX isascii() and toascii() should similarly be undocumented.
 25494  
 25495  // Character classes for ASCII characters:
 25496  //
 25497  //   0   ''        Silent letters:   H W
 25498  //   1   'A'       Any vowel:   A E I O U (Y)
 25499  //   2   'B'       A bilabeal stop or fricative:  B F P V W
 25500  //   3   'C'       Other fricatives or back stops:  C G J K Q S X Z
 25501  //   4   'D'       Alveolar stops:  D T
 25502  //   5   'H'       Letter H at the beginning of a word
 25503  //   6   'L'       Glide:  L
 25504  //   7   'R'       Semivowel:  R
 25505  //   8   'M'       Nasals:  M N
 25506  //   9   'Y'       Letter Y at the beginning of a word.
 25507  //   10  '9'       Digits: 0 1 2 3 4 5 6 7 8 9
 25508  //   11  ' '       White space
 25509  //   12  '?'       Other.
 25510  
 25511  // The following table gives the character class for non-initial ASCII
 25512  // characters.
 25513  var midClass = [128]uint8{
 25514  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25515  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25516  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25517  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25518  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER),
 25519  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25520  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25521  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25522  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25523  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25524  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_SPACE),
 25525  	/* ! */ uint8(CCLASS_OTHER) /* " */, uint8(CCLASS_OTHER) /* # */, uint8(CCLASS_OTHER),
 25526  	/* $ */ uint8(CCLASS_OTHER) /* % */, uint8(CCLASS_OTHER) /* & */, uint8(CCLASS_OTHER),
 25527  	/* ' */ uint8(CCLASS_SILENT) /* ( */, uint8(CCLASS_OTHER) /* ) */, uint8(CCLASS_OTHER),
 25528  	/* * */ uint8(CCLASS_OTHER) /* + */, uint8(CCLASS_OTHER) /* , */, uint8(CCLASS_OTHER),
 25529  	/* - */ uint8(CCLASS_OTHER) /* . */, uint8(CCLASS_OTHER) /* / */, uint8(CCLASS_OTHER),
 25530  	/* 0 */ uint8(CCLASS_DIGIT) /* 1 */, uint8(CCLASS_DIGIT) /* 2 */, uint8(CCLASS_DIGIT),
 25531  	/* 3 */ uint8(CCLASS_DIGIT) /* 4 */, uint8(CCLASS_DIGIT) /* 5 */, uint8(CCLASS_DIGIT),
 25532  	/* 6 */ uint8(CCLASS_DIGIT) /* 7 */, uint8(CCLASS_DIGIT) /* 8 */, uint8(CCLASS_DIGIT),
 25533  	/* 9 */ uint8(CCLASS_DIGIT) /* : */, uint8(CCLASS_OTHER) /* ; */, uint8(CCLASS_OTHER),
 25534  	/* < */ uint8(CCLASS_OTHER) /* = */, uint8(CCLASS_OTHER) /* > */, uint8(CCLASS_OTHER),
 25535  	/* ? */ uint8(CCLASS_OTHER) /* @ */, uint8(CCLASS_OTHER) /* A */, uint8(CCLASS_VOWEL),
 25536  	/* B */ uint8(CCLASS_B) /* C */, uint8(CCLASS_C) /* D */, uint8(CCLASS_D),
 25537  	/* E */ uint8(CCLASS_VOWEL) /* F */, uint8(CCLASS_B) /* G */, uint8(CCLASS_C),
 25538  	/* H */ uint8(CCLASS_SILENT) /* I */, uint8(CCLASS_VOWEL) /* J */, uint8(CCLASS_C),
 25539  	/* K */ uint8(CCLASS_C) /* L */, uint8(CCLASS_L) /* M */, uint8(CCLASS_M),
 25540  	/* N */ uint8(CCLASS_M) /* O */, uint8(CCLASS_VOWEL) /* P */, uint8(CCLASS_B),
 25541  	/* Q */ uint8(CCLASS_C) /* R */, uint8(CCLASS_R) /* S */, uint8(CCLASS_C),
 25542  	/* T */ uint8(CCLASS_D) /* U */, uint8(CCLASS_VOWEL) /* V */, uint8(CCLASS_B),
 25543  	/* W */ uint8(CCLASS_B) /* X */, uint8(CCLASS_C) /* Y */, uint8(CCLASS_VOWEL),
 25544  	/* Z */ uint8(CCLASS_C) /* [ */, uint8(CCLASS_OTHER) /* \ */, uint8(CCLASS_OTHER),
 25545  	/* ] */ uint8(CCLASS_OTHER) /* ^ */, uint8(CCLASS_OTHER) /* _ */, uint8(CCLASS_OTHER),
 25546  	/* ` */ uint8(CCLASS_OTHER) /* a */, uint8(CCLASS_VOWEL) /* b */, uint8(CCLASS_B),
 25547  	/* c */ uint8(CCLASS_C) /* d */, uint8(CCLASS_D) /* e */, uint8(CCLASS_VOWEL),
 25548  	/* f */ uint8(CCLASS_B) /* g */, uint8(CCLASS_C) /* h */, uint8(CCLASS_SILENT),
 25549  	/* i */ uint8(CCLASS_VOWEL) /* j */, uint8(CCLASS_C) /* k */, uint8(CCLASS_C),
 25550  	/* l */ uint8(CCLASS_L) /* m */, uint8(CCLASS_M) /* n */, uint8(CCLASS_M),
 25551  	/* o */ uint8(CCLASS_VOWEL) /* p */, uint8(CCLASS_B) /* q */, uint8(CCLASS_C),
 25552  	/* r */ uint8(CCLASS_R) /* s */, uint8(CCLASS_C) /* t */, uint8(CCLASS_D),
 25553  	/* u */ uint8(CCLASS_VOWEL) /* v */, uint8(CCLASS_B) /* w */, uint8(CCLASS_B),
 25554  	/* x */ uint8(CCLASS_C) /* y */, uint8(CCLASS_VOWEL) /* z */, uint8(CCLASS_C),
 25555  	/* { */ uint8(CCLASS_OTHER) /* | */, uint8(CCLASS_OTHER) /* } */, uint8(CCLASS_OTHER),
 25556  	/* ~ */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25557  } /* spellfix.c:75:28 */
 25558  // This tables gives the character class for ASCII characters that form the
 25559  // initial character of a word.  The only difference from midClass is with
 25560  // the letters H, W, and Y.
 25561  var initClass = [128]uint8{
 25562  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25563  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25564  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25565  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25566  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER),
 25567  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25568  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25569  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25570  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25571  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25572  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_SPACE),
 25573  	/* ! */ uint8(CCLASS_OTHER) /* " */, uint8(CCLASS_OTHER) /* # */, uint8(CCLASS_OTHER),
 25574  	/* $ */ uint8(CCLASS_OTHER) /* % */, uint8(CCLASS_OTHER) /* & */, uint8(CCLASS_OTHER),
 25575  	/* ' */ uint8(CCLASS_OTHER) /* ( */, uint8(CCLASS_OTHER) /* ) */, uint8(CCLASS_OTHER),
 25576  	/* * */ uint8(CCLASS_OTHER) /* + */, uint8(CCLASS_OTHER) /* , */, uint8(CCLASS_OTHER),
 25577  	/* - */ uint8(CCLASS_OTHER) /* . */, uint8(CCLASS_OTHER) /* / */, uint8(CCLASS_OTHER),
 25578  	/* 0 */ uint8(CCLASS_DIGIT) /* 1 */, uint8(CCLASS_DIGIT) /* 2 */, uint8(CCLASS_DIGIT),
 25579  	/* 3 */ uint8(CCLASS_DIGIT) /* 4 */, uint8(CCLASS_DIGIT) /* 5 */, uint8(CCLASS_DIGIT),
 25580  	/* 6 */ uint8(CCLASS_DIGIT) /* 7 */, uint8(CCLASS_DIGIT) /* 8 */, uint8(CCLASS_DIGIT),
 25581  	/* 9 */ uint8(CCLASS_DIGIT) /* : */, uint8(CCLASS_OTHER) /* ; */, uint8(CCLASS_OTHER),
 25582  	/* < */ uint8(CCLASS_OTHER) /* = */, uint8(CCLASS_OTHER) /* > */, uint8(CCLASS_OTHER),
 25583  	/* ? */ uint8(CCLASS_OTHER) /* @ */, uint8(CCLASS_OTHER) /* A */, uint8(CCLASS_VOWEL),
 25584  	/* B */ uint8(CCLASS_B) /* C */, uint8(CCLASS_C) /* D */, uint8(CCLASS_D),
 25585  	/* E */ uint8(CCLASS_VOWEL) /* F */, uint8(CCLASS_B) /* G */, uint8(CCLASS_C),
 25586  	/* H */ uint8(CCLASS_SILENT) /* I */, uint8(CCLASS_VOWEL) /* J */, uint8(CCLASS_C),
 25587  	/* K */ uint8(CCLASS_C) /* L */, uint8(CCLASS_L) /* M */, uint8(CCLASS_M),
 25588  	/* N */ uint8(CCLASS_M) /* O */, uint8(CCLASS_VOWEL) /* P */, uint8(CCLASS_B),
 25589  	/* Q */ uint8(CCLASS_C) /* R */, uint8(CCLASS_R) /* S */, uint8(CCLASS_C),
 25590  	/* T */ uint8(CCLASS_D) /* U */, uint8(CCLASS_VOWEL) /* V */, uint8(CCLASS_B),
 25591  	/* W */ uint8(CCLASS_B) /* X */, uint8(CCLASS_C) /* Y */, uint8(CCLASS_Y),
 25592  	/* Z */ uint8(CCLASS_C) /* [ */, uint8(CCLASS_OTHER) /* \ */, uint8(CCLASS_OTHER),
 25593  	/* ] */ uint8(CCLASS_OTHER) /* ^ */, uint8(CCLASS_OTHER) /* _ */, uint8(CCLASS_OTHER),
 25594  	/* ` */ uint8(CCLASS_OTHER) /* a */, uint8(CCLASS_VOWEL) /* b */, uint8(CCLASS_B),
 25595  	/* c */ uint8(CCLASS_C) /* d */, uint8(CCLASS_D) /* e */, uint8(CCLASS_VOWEL),
 25596  	/* f */ uint8(CCLASS_B) /* g */, uint8(CCLASS_C) /* h */, uint8(CCLASS_SILENT),
 25597  	/* i */ uint8(CCLASS_VOWEL) /* j */, uint8(CCLASS_C) /* k */, uint8(CCLASS_C),
 25598  	/* l */ uint8(CCLASS_L) /* m */, uint8(CCLASS_M) /* n */, uint8(CCLASS_M),
 25599  	/* o */ uint8(CCLASS_VOWEL) /* p */, uint8(CCLASS_B) /* q */, uint8(CCLASS_C),
 25600  	/* r */ uint8(CCLASS_R) /* s */, uint8(CCLASS_C) /* t */, uint8(CCLASS_D),
 25601  	/* u */ uint8(CCLASS_VOWEL) /* v */, uint8(CCLASS_B) /* w */, uint8(CCLASS_B),
 25602  	/* x */ uint8(CCLASS_C) /* y */, uint8(CCLASS_Y) /* z */, uint8(CCLASS_C),
 25603  	/* { */ uint8(CCLASS_OTHER) /* | */, uint8(CCLASS_OTHER) /* } */, uint8(CCLASS_OTHER),
 25604  	/* ~ */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 25605  } /* spellfix.c:125:28 */
 25606  
 25607  // Mapping from the character class number (0-13) to a symbol for each
 25608  // character class.  Note that initClass[] can be used to map the class
 25609  // symbol back into the class number.
 25610  var className = *(*[14]uint8)(unsafe.Pointer(ts + 6484 /* ".ABCDHLRMY9 ?" */)) /* spellfix.c:176:28 */
 25611  
 25612  // Generate a "phonetic hash" from a string of ASCII characters
 25613  // in zIn[0..nIn-1].
 25614  //
 25615  //   * Map characters by character class as defined above.
 25616  //   * Omit double-letters
 25617  //   * Omit vowels beside R and L
 25618  //   * Omit T when followed by CH
 25619  //   * Omit W when followed by R
 25620  //   * Omit D when followed by J or G
 25621  //   * Omit K in KN or G in GN at the beginning of a word
 25622  //
 25623  // Space to hold the result is obtained from sqlite3_malloc()
 25624  //
 25625  // Return NULL if memory allocation fails.
 25626  func phoneticHash(tls *libc.TLS, zIn uintptr, nIn int32) uintptr { /* spellfix.c:194:22: */
 25627  	var zOut uintptr = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + 1)))
 25628  	var i int32
 25629  	var nOut int32 = 0
 25630  	var cPrev int8 = int8(0x77)
 25631  	var cPrevX int8 = int8(0x77)
 25632  	var aClass uintptr = uintptr(unsafe.Pointer(&initClass))
 25633  
 25634  	if zOut == uintptr(0) {
 25635  		return uintptr(0)
 25636  	}
 25637  	if nIn > 2 {
 25638  		switch int32(*(*uint8)(unsafe.Pointer(zIn))) {
 25639  		case 'g':
 25640  			fallthrough
 25641  		case 'k':
 25642  			{
 25643  				if int32(*(*uint8)(unsafe.Pointer(zIn + 1))) == 'n' {
 25644  					zIn++
 25645  					nIn--
 25646  				}
 25647  				break
 25648  
 25649  			}
 25650  		}
 25651  	}
 25652  	for i = 0; i < nIn; i++ {
 25653  		var c uint8 = *(*uint8)(unsafe.Pointer(zIn + uintptr(i)))
 25654  		if (i + 1) < nIn {
 25655  			if (int32(c) == 'w') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'r') {
 25656  				continue
 25657  			}
 25658  			if (int32(c) == 'd') && ((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'j') || (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'g')) {
 25659  				continue
 25660  			}
 25661  			if (i + 2) < nIn {
 25662  				if ((int32(c) == 't') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'c')) && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 2))))) == 'h') {
 25663  					continue
 25664  				}
 25665  			}
 25666  		}
 25667  		c = *(*uint8)(unsafe.Pointer(aClass + uintptr((int32(c) & 0x7f))))
 25668  		if int32(c) == CCLASS_SPACE {
 25669  			continue
 25670  		}
 25671  		if (int32(c) == CCLASS_OTHER) && (int32(cPrev) != CCLASS_DIGIT) {
 25672  			continue
 25673  		}
 25674  		aClass = uintptr(unsafe.Pointer(&midClass))
 25675  		if (int32(c) == CCLASS_VOWEL) && ((int32(cPrevX) == CCLASS_R) || (int32(cPrevX) == CCLASS_L)) {
 25676  			continue /* No vowels beside L or R */
 25677  		}
 25678  		if ((int32(c) == CCLASS_R) || (int32(c) == CCLASS_L)) && (int32(cPrevX) == CCLASS_VOWEL) {
 25679  			nOut-- // No vowels beside L or R
 25680  		}
 25681  		cPrev = int8(c)
 25682  		if int32(c) == CCLASS_SILENT {
 25683  			continue
 25684  		}
 25685  		cPrevX = int8(c)
 25686  		c = className[c]
 25687  
 25688  		if (nOut == 0) || (int32(c) != int32(*(*uint8)(unsafe.Pointer(zOut + uintptr((nOut - 1)))))) {
 25689  			*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = c
 25690  		}
 25691  	}
 25692  	*(*uint8)(unsafe.Pointer(zOut + uintptr(nOut))) = uint8(0)
 25693  	return zOut
 25694  }
 25695  
 25696  // This is an SQL function wrapper around phoneticHash().  See
 25697  // the description of phoneticHash() for additional information.
 25698  func phoneticHashSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:246:13: */
 25699  	var zIn uintptr
 25700  	var zOut uintptr
 25701  
 25702  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 25703  	if zIn == uintptr(0) {
 25704  		return
 25705  	}
 25706  	zOut = phoneticHash(tls, zIn, sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))))
 25707  	if zOut == uintptr(0) {
 25708  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 25709  	} else {
 25710  		sqlite3.Xsqlite3_result_text(tls, context, zOut, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 25711  	}
 25712  }
 25713  
 25714  // Return the character class number for a character given its
 25715  // context.
 25716  func characterClass(tls *libc.TLS, cPrev int8, c int8) int8 { /* spellfix.c:268:13: */
 25717  	if int32(cPrev) == 0 {
 25718  		return int8(initClass[(int32(c) & 0x7f)])
 25719  	}
 25720  	return int8(midClass[(int32(c) & 0x7f)])
 25721  }
 25722  
 25723  // Return the cost of inserting or deleting character c immediately
 25724  // following character cPrev.  If cPrev==0, that means c is the first
 25725  // character of the word.
 25726  func insertOrDeleteCost(tls *libc.TLS, cPrev int8, c int8, cNext int8) int32 { /* spellfix.c:277:12: */
 25727  	var classC int8 = characterClass(tls, cPrev, c)
 25728  	var classCprev int8
 25729  
 25730  	if int32(classC) == CCLASS_SILENT {
 25731  		// Insert or delete "silent" characters such as H or W
 25732  		return 1
 25733  	}
 25734  	if int32(cPrev) == int32(c) {
 25735  		// Repeated characters, or miss a repeat
 25736  		return 10
 25737  	}
 25738  	if (int32(classC) == CCLASS_VOWEL) && ((int32(cPrev) == 'r') || (int32(cNext) == 'r')) {
 25739  		return 20 // Insert a vowel before or after 'r'
 25740  	}
 25741  	classCprev = characterClass(tls, cPrev, cPrev)
 25742  	if int32(classC) == int32(classCprev) {
 25743  		if int32(classC) == CCLASS_VOWEL {
 25744  			// Remove or add a new vowel to a vowel cluster
 25745  			return 15
 25746  		} else {
 25747  			// Remove or add a consonant not in the same class
 25748  			return 50
 25749  		}
 25750  	}
 25751  
 25752  	// any other character insertion or deletion
 25753  	return 100
 25754  }
 25755  
 25756  // Divide the insertion cost by this factor when appending to the
 25757  // end of the word.
 25758  
 25759  // Return the cost of substituting cTo in place of cFrom assuming
 25760  // the previous character is cPrev.  If cPrev==0 then cTo is the first
 25761  // character of the word.
 25762  func substituteCost(tls *libc.TLS, cPrev int8, cFrom int8, cTo int8) int32 { /* spellfix.c:318:12: */
 25763  	var classFrom int8
 25764  	var classTo int8
 25765  	if int32(cFrom) == int32(cTo) {
 25766  		// Exact match
 25767  		return 0
 25768  	}
 25769  	if (int32(cFrom) == (int32(cTo) ^ 0x20)) && (((int32(cTo) >= 'A') && (int32(cTo) <= 'Z')) || ((int32(cTo) >= 'a') && (int32(cTo) <= 'z'))) {
 25770  		// differ only in case
 25771  		return 0
 25772  	}
 25773  	classFrom = characterClass(tls, cPrev, cFrom)
 25774  	classTo = characterClass(tls, cPrev, cTo)
 25775  	if int32(classFrom) == int32(classTo) {
 25776  		// Same character class
 25777  		return 40
 25778  	}
 25779  	if (((int32(classFrom) >= CCLASS_B) && (int32(classFrom) <= CCLASS_Y)) &&
 25780  		(int32(classTo) >= CCLASS_B)) && (int32(classTo) <= CCLASS_Y) {
 25781  		// Convert from one consonant to another, but in a different class
 25782  		return 75
 25783  	}
 25784  	// Any other subsitution
 25785  	return 100
 25786  }
 25787  
 25788  // Given two strings zA and zB which are pure ASCII, return the cost
 25789  // of transforming zA into zB.  If zA ends with '*' assume that it is
 25790  // a prefix of zB and give only minimal penalty for extra characters
 25791  // on the end of zB.
 25792  //
 25793  // Smaller numbers mean a closer match.
 25794  //
 25795  // Negative values indicate an error:
 25796  //    -1  One of the inputs is NULL
 25797  //    -2  Non-ASCII characters on input
 25798  //    -3  Unable to allocate memory
 25799  //
 25800  // If pnMatch is not NULL, then *pnMatch is set to the number of bytes
 25801  // of zB that matched the pattern in zA. If zA does not end with a '*',
 25802  // then this value is always the number of bytes in zB (i.e. strlen(zB)).
 25803  // If zA does end in a '*', then it is the number of bytes in the prefix
 25804  // of zB that was deemed to match zA.
 25805  func editdist1(tls *libc.TLS, zA uintptr, zB uintptr, pnMatch uintptr) int32 { /* spellfix.c:362:12: */
 25806  	bp := tls.Alloc(300)
 25807  	defer tls.Free(300)
 25808  
 25809  	var nA int32
 25810  	var nB int32 // Number of characters in zA[] and zB[]
 25811  	var xA int32
 25812  	var xB int32 // Loop counters for zA[] and zB[]
 25813  	var cA int8 = int8(0)
 25814  	var cB int8 // Current character of zA and zB
 25815  	var cAprev int8
 25816  	var cBprev int8 // Previous character of zA and zB
 25817  	var cAnext int8
 25818  	var cBnext int8                 // Next character in zA and zB
 25819  	var d int32                     // North-west cost value
 25820  	var dc int32 = 0                // North-west character value
 25821  	var res int32                   // Final result
 25822  	var m uintptr                   // The cost matrix
 25823  	var cx uintptr                  // Corresponding character values
 25824  	var toFree uintptr = uintptr(0) // Malloced space
 25825  	var nMatch int32 = 0
 25826  	// var mStack [75]int32 at bp, 300
 25827  	// Stack space to use if not too much is needed
 25828  
 25829  	// Early out if either input is NULL
 25830  	if (zA == uintptr(0)) || (zB == uintptr(0)) {
 25831  		return -1
 25832  	}
 25833  
 25834  	// Skip any common prefix
 25835  	for (*(*int8)(unsafe.Pointer(zA)) != 0) && (int32(*(*int8)(unsafe.Pointer(zA))) == int32(*(*int8)(unsafe.Pointer(zB)))) {
 25836  		dc = int32(*(*int8)(unsafe.Pointer(zA)))
 25837  		zA++
 25838  		zB++
 25839  		nMatch++
 25840  	}
 25841  	if pnMatch != 0 {
 25842  		*(*int32)(unsafe.Pointer(pnMatch)) = nMatch
 25843  	}
 25844  	if (int32(*(*int8)(unsafe.Pointer(zA))) == 0) && (int32(*(*int8)(unsafe.Pointer(zB))) == 0) {
 25845  		return 0
 25846  	}
 25847  
 25848  	// Verify input strings and measure their lengths
 25849  	for nA = 0; *(*int8)(unsafe.Pointer(zA + uintptr(nA))) != 0; nA++ {
 25850  		if (int32(*(*int8)(unsafe.Pointer(zA + uintptr(nA)))) & 0x80) != 0 {
 25851  			return -2
 25852  		}
 25853  	}
 25854  	for nB = 0; *(*int8)(unsafe.Pointer(zB + uintptr(nB))) != 0; nB++ {
 25855  		if (int32(*(*int8)(unsafe.Pointer(zB + uintptr(nB)))) & 0x80) != 0 {
 25856  			return -2
 25857  		}
 25858  	}
 25859  
 25860  	// Special processing if either string is empty
 25861  	if nA == 0 {
 25862  		cBprev = int8(dc)
 25863  		for xB = libc.AssignInt32(&res, 0); (int32(libc.AssignInt8(&cB, *(*int8)(unsafe.Pointer(zB + uintptr(xB)))))) != 0; xB++ {
 25864  			res = res + (insertOrDeleteCost(tls, cBprev, cB, *(*int8)(unsafe.Pointer(zB + uintptr((xB + 1))))) / FINAL_INS_COST_DIV)
 25865  			cBprev = cB
 25866  		}
 25867  		return res
 25868  	}
 25869  	if nB == 0 {
 25870  		cAprev = int8(dc)
 25871  		for xA = libc.AssignInt32(&res, 0); (int32(libc.AssignInt8(&cA, *(*int8)(unsafe.Pointer(zA + uintptr(xA)))))) != 0; xA++ {
 25872  			res = res + (insertOrDeleteCost(tls, cAprev, cA, *(*int8)(unsafe.Pointer(zA + uintptr((xA + 1))))))
 25873  			cAprev = cA
 25874  		}
 25875  		return res
 25876  	}
 25877  
 25878  	// A is a prefix of B
 25879  	if (int32(*(*int8)(unsafe.Pointer(zA))) == '*') && (int32(*(*int8)(unsafe.Pointer(zA + 1))) == 0) {
 25880  		return 0
 25881  	}
 25882  
 25883  	// Allocate and initialize the Wagner matrix
 25884  	if uint64(nB) < ((uint64(unsafe.Sizeof([75]int32{})) * uint64(4)) / (uint64(unsafe.Sizeof(int32(0))) * uint64(5))) {
 25885  		m = bp /* &mStack[0] */
 25886  	} else {
 25887  		m = libc.AssignUintptr(&toFree, sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint64((nB+1)*5))*uint64(unsafe.Sizeof(int32(0))))/uint64(4)))))
 25888  		if m == uintptr(0) {
 25889  			return -3
 25890  		}
 25891  	}
 25892  	cx = (m + uintptr((nB+1))*4)
 25893  
 25894  	// Compute the Wagner edit distance
 25895  	*(*int32)(unsafe.Pointer(m)) = 0
 25896  	*(*int8)(unsafe.Pointer(cx)) = int8(dc)
 25897  	cBprev = int8(dc)
 25898  	for xB = 1; xB <= nB; xB++ {
 25899  		cBnext = *(*int8)(unsafe.Pointer(zB + uintptr(xB)))
 25900  		cB = *(*int8)(unsafe.Pointer(zB + uintptr((xB - 1))))
 25901  		*(*int8)(unsafe.Pointer(cx + uintptr(xB))) = cB
 25902  		*(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) = (*(*int32)(unsafe.Pointer(m + uintptr((xB-1))*4)) + insertOrDeleteCost(tls, cBprev, cB, cBnext))
 25903  		cBprev = cB
 25904  	}
 25905  	cAprev = int8(dc)
 25906  	for xA = 1; xA <= nA; xA++ {
 25907  		var lastA int32 = (libc.Bool32(xA == nA))
 25908  		cA = *(*int8)(unsafe.Pointer(zA + uintptr((xA - 1))))
 25909  		cAnext = *(*int8)(unsafe.Pointer(zA + uintptr(xA)))
 25910  		if (int32(cA) == '*') && (lastA != 0) {
 25911  			break
 25912  		}
 25913  		d = *(*int32)(unsafe.Pointer(m))
 25914  		dc = int32(*(*int8)(unsafe.Pointer(cx)))
 25915  		*(*int32)(unsafe.Pointer(m)) = (d + insertOrDeleteCost(tls, cAprev, cA, cAnext))
 25916  		cBprev = int8(0)
 25917  		for xB = 1; xB <= nB; xB++ {
 25918  			var totalCost int32
 25919  			var insCost int32
 25920  			var delCost int32
 25921  			var subCost int32
 25922  			var ncx int32
 25923  			cB = *(*int8)(unsafe.Pointer(zB + uintptr((xB - 1))))
 25924  			cBnext = *(*int8)(unsafe.Pointer(zB + uintptr(xB)))
 25925  
 25926  			// Cost to insert cB
 25927  			insCost = insertOrDeleteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr((xB - 1)))), cB, cBnext)
 25928  			if lastA != 0 {
 25929  				insCost = insCost / (FINAL_INS_COST_DIV)
 25930  			}
 25931  
 25932  			// Cost to delete cA
 25933  			delCost = insertOrDeleteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr(xB))), cA, cBnext)
 25934  
 25935  			// Cost to substitute cA->cB
 25936  			subCost = substituteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr((xB - 1)))), cA, cB)
 25937  
 25938  			// Best cost
 25939  			totalCost = (insCost + *(*int32)(unsafe.Pointer(m + uintptr((xB-1))*4)))
 25940  			ncx = int32(cB)
 25941  			if (delCost + *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))) < totalCost {
 25942  				totalCost = (delCost + *(*int32)(unsafe.Pointer(m + uintptr(xB)*4)))
 25943  				ncx = int32(cA)
 25944  			}
 25945  			if (subCost + d) < totalCost {
 25946  				totalCost = (subCost + d)
 25947  			}
 25948  
 25949  			// Update the matrix
 25950  			d = *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))
 25951  			dc = int32(*(*int8)(unsafe.Pointer(cx + uintptr(xB))))
 25952  			*(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) = totalCost
 25953  			*(*int8)(unsafe.Pointer(cx + uintptr(xB))) = int8(ncx)
 25954  			cBprev = cB
 25955  		}
 25956  		cAprev = cA
 25957  	}
 25958  
 25959  	// Free the wagner matrix and return the result
 25960  	if int32(cA) == '*' {
 25961  		res = *(*int32)(unsafe.Pointer(m + 1*4))
 25962  		for xB = 1; xB <= nB; xB++ {
 25963  			if *(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) < res {
 25964  				res = *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))
 25965  				if pnMatch != 0 {
 25966  					*(*int32)(unsafe.Pointer(pnMatch)) = (xB + nMatch)
 25967  				}
 25968  			}
 25969  		}
 25970  	} else {
 25971  		res = *(*int32)(unsafe.Pointer(m + uintptr(nB)*4))
 25972  		// In the current implementation, pnMatch is always NULL if zA does
 25973  		// not end in "*"
 25974  
 25975  	}
 25976  	sqlite3.Xsqlite3_free(tls, toFree)
 25977  	return res
 25978  }
 25979  
 25980  // Function:    editdist(A,B)
 25981  //
 25982  // Return the cost of transforming string A into string B.  Both strings
 25983  // must be pure ASCII text.  If A ends with '*' then it is assumed to be
 25984  // a prefix of B and extra characters on the end of B have minimal additional
 25985  // cost.
 25986  func editdistSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:518:13: */
 25987  	var res int32 = editdist1(tls,
 25988  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))),
 25989  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))),
 25990  		uintptr(0))
 25991  	if res < 0 {
 25992  		if res == (-3) {
 25993  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 25994  		} else if res == (-2) {
 25995  			sqlite3.Xsqlite3_result_error(tls, context, ts+6498 /* "non-ASCII input ..." */, -1)
 25996  		} else {
 25997  			sqlite3.Xsqlite3_result_error(tls, context, ts+6528 /* "NULL input to ed..." */, -1)
 25998  		}
 25999  	} else {
 26000  		sqlite3.Xsqlite3_result_int(tls, context, res)
 26001  	}
 26002  }
 26003  
 26004  // End of the fixed-cost edit distance implementation
 26005  //
 26006  //
 26007  // Begin: Configurable cost unicode edit distance routines
 26008  // Forward declaration of structures
 26009  type EditDist3Cost1 = struct {
 26010  	FpNext uintptr
 26011  	FnFrom u8
 26012  	FnTo   u8
 26013  	FiCost u16
 26014  	Fa     [4]int8
 26015  } /* spellfix.c:546:9 */
 26016  
 26017  // End of the fixed-cost edit distance implementation
 26018  //
 26019  //
 26020  // Begin: Configurable cost unicode edit distance routines
 26021  // Forward declaration of structures
 26022  type EditDist3Cost = EditDist3Cost1 /* spellfix.c:546:30 */
 26023  type EditDist3Config1 = struct {
 26024  	FnLang int32
 26025  	_      [4]byte
 26026  	Fa     uintptr
 26027  } /* spellfix.c:547:9 */
 26028  
 26029  type EditDist3Config = EditDist3Config1 /* spellfix.c:547:32 */
 26030  type EditDist3From1 = struct {
 26031  	FnSubst  int32
 26032  	FnDel    int32
 26033  	FnByte   int32
 26034  	_        [4]byte
 26035  	FapSubst uintptr
 26036  	FapDel   uintptr
 26037  } /* spellfix.c:549:9 */
 26038  
 26039  type EditDist3From = EditDist3From1 /* spellfix.c:549:30 */
 26040  type EditDist3FromString1 = struct {
 26041  	Fz        uintptr
 26042  	Fn        int32
 26043  	FisPrefix int32
 26044  	Fa        uintptr
 26045  } /* spellfix.c:550:9 */
 26046  
 26047  type EditDist3FromString = EditDist3FromString1 /* spellfix.c:550:36 */
 26048  type EditDist3To1 = struct {
 26049  	FnIns  int32
 26050  	FnByte int32
 26051  	FapIns uintptr
 26052  } /* spellfix.c:551:9 */
 26053  
 26054  type EditDist3To = EditDist3To1 /* spellfix.c:551:28 */
 26055  type EditDist3ToString1 = struct {
 26056  	Fz uintptr
 26057  	Fn int32
 26058  	_  [4]byte
 26059  	Fa uintptr
 26060  } /* spellfix.c:552:9 */
 26061  
 26062  type EditDist3ToString = EditDist3ToString1 /* spellfix.c:552:34 */
 26063  type EditDist3Lang1 = struct {
 26064  	FiLang    int32
 26065  	FiInsCost int32
 26066  	FiDelCost int32
 26067  	FiSubCost int32
 26068  	FpCost    uintptr
 26069  } /* spellfix.c:547:9 */
 26070  
 26071  type EditDist3Lang = EditDist3Lang1 /* spellfix.c:553:30 */
 26072  
 26073  // The default EditDist3Lang object, with default costs.
 26074  var editDist3Lang = EditDist3Lang{FiInsCost: 100, FiDelCost: 100, FiSubCost: 150} /* spellfix.c:583:28 */
 26075  
 26076  // Clear or delete an instance of the object that records all edit-distance
 26077  // weights.
 26078  func editDist3ConfigClear(tls *libc.TLS, p uintptr) { /* spellfix.c:640:13: */
 26079  	var i int32
 26080  	if p == uintptr(0) {
 26081  		return
 26082  	}
 26083  	for i = 0; i < (*EditDist3Config)(unsafe.Pointer(p)).FnLang; i++ {
 26084  		var pCost uintptr
 26085  		var pNext uintptr
 26086  		pCost = (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr(i)*24)).FpCost
 26087  		for pCost != 0 {
 26088  			pNext = (*EditDist3Cost)(unsafe.Pointer(pCost)).FpNext
 26089  			sqlite3.Xsqlite3_free(tls, pCost)
 26090  			pCost = pNext
 26091  		}
 26092  	}
 26093  	sqlite3.Xsqlite3_free(tls, (*EditDist3Config)(unsafe.Pointer(p)).Fa)
 26094  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(EditDist3Config{})))
 26095  }
 26096  
 26097  func editDist3ConfigDelete(tls *libc.TLS, pIn uintptr) { /* spellfix.c:655:13: */
 26098  	var p uintptr = pIn
 26099  	editDist3ConfigClear(tls, p)
 26100  	sqlite3.Xsqlite3_free(tls, p)
 26101  }
 26102  
 26103  // Compare the FROM values of two EditDist3Cost objects, for sorting.
 26104  // Return negative, zero, or positive if the A is less than, equal to,
 26105  // or greater than B.
 26106  func editDist3CostCompare(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* spellfix.c:665:12: */
 26107  	var n int32 = int32((*EditDist3Cost)(unsafe.Pointer(pA)).FnFrom)
 26108  	var rc int32
 26109  	if n > int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom) {
 26110  		n = int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom)
 26111  	}
 26112  	rc = libc.Xstrncmp(tls, pA+12 /* &.a */, pB+12 /* &.a */, uint64(n))
 26113  	if rc == 0 {
 26114  		rc = (int32((*EditDist3Cost)(unsafe.Pointer(pA)).FnFrom) - int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom))
 26115  	}
 26116  	return rc
 26117  }
 26118  
 26119  // Merge together two sorted lists of EditDist3Cost objects, in order
 26120  // of increasing FROM.
 26121  func editDist3CostMerge(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* spellfix.c:678:22: */
 26122  	bp := tls.Alloc(8)
 26123  	defer tls.Free(8)
 26124  
 26125  	*(*uintptr)(unsafe.Pointer(bp /* pHead */)) = uintptr(0)
 26126  	var ppTail uintptr = bp /* &pHead */
 26127  	var p uintptr
 26128  	for (pA != 0) && (pB != 0) {
 26129  		if editDist3CostCompare(tls, pA, pB) <= 0 {
 26130  			p = pA
 26131  			pA = (*EditDist3Cost)(unsafe.Pointer(pA)).FpNext
 26132  		} else {
 26133  			p = pB
 26134  			pB = (*EditDist3Cost)(unsafe.Pointer(pB)).FpNext
 26135  		}
 26136  		*(*uintptr)(unsafe.Pointer(ppTail)) = p
 26137  		ppTail = (p /* &.pNext */)
 26138  	}
 26139  	if pA != 0 {
 26140  		*(*uintptr)(unsafe.Pointer(ppTail)) = pA
 26141  	} else {
 26142  		*(*uintptr)(unsafe.Pointer(ppTail)) = pB
 26143  	}
 26144  	return *(*uintptr)(unsafe.Pointer(bp /* pHead */))
 26145  }
 26146  
 26147  // Sort a list of EditDist3Cost objects into order of increasing FROM
 26148  func editDist3CostSort(tls *libc.TLS, pList uintptr) uintptr { /* spellfix.c:707:22: */
 26149  	bp := tls.Alloc(480)
 26150  	defer tls.Free(480)
 26151  
 26152  	// var ap [60]uintptr at bp, 480
 26153  
 26154  	var p uintptr
 26155  	var i int32
 26156  	var mx int32 = 0
 26157  	*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */)) = uintptr(0)
 26158  	*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + 1*8)) = uintptr(0)
 26159  	for pList != 0 {
 26160  		p = pList
 26161  		pList = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext
 26162  		(*EditDist3Cost)(unsafe.Pointer(p)).FpNext = uintptr(0)
 26163  		for i = 0; *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)) != 0; i++ {
 26164  			p = editDist3CostMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)), p)
 26165  			*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)) = uintptr(0)
 26166  		}
 26167  		*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)) = p
 26168  		if i > mx {
 26169  			mx = i
 26170  			*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr((i+1))*8)) = uintptr(0)
 26171  		}
 26172  	}
 26173  	p = uintptr(0)
 26174  	for i = 0; i <= mx; i++ {
 26175  		if *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)) != 0 {
 26176  			p = editDist3CostMerge(tls, p, *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*8)))
 26177  		}
 26178  	}
 26179  	return p
 26180  }
 26181  
 26182  // Load all edit-distance weights from a table.
 26183  func editDist3ConfigLoad(tls *libc.TLS, p uintptr, db uintptr, zTable uintptr) int32 { /* spellfix.c:737:12: */
 26184  	bp := tls.Alloc(16)
 26185  	defer tls.Free(16)
 26186  
 26187  	// var pStmt uintptr at bp+8, 8
 26188  
 26189  	var rc int32
 26190  	var rc2 int32
 26191  	var zSql uintptr
 26192  	var iLangPrev int32 = -9999
 26193  	var pLang uintptr = uintptr(0)
 26194  
 26195  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 26196  		ts+6553 /* "SELECT iLang, cF..." */, libc.VaList(bp, zTable))
 26197  	if zSql == uintptr(0) {
 26198  		return SQLITE_NOMEM
 26199  	}
 26200  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0))
 26201  	sqlite3.Xsqlite3_free(tls, zSql)
 26202  	if rc != 0 {
 26203  		return rc
 26204  	}
 26205  	editDist3ConfigClear(tls, p)
 26206  	for sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) == SQLITE_ROW {
 26207  		var iLang int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0)
 26208  		var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)
 26209  		var nFrom int32
 26210  		if zFrom != 0 {
 26211  			nFrom = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)
 26212  		} else {
 26213  			nFrom = 0
 26214  		}
 26215  		var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 2)
 26216  		var nTo int32
 26217  		if zTo != 0 {
 26218  			nTo = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 2)
 26219  		} else {
 26220  			nTo = 0
 26221  		}
 26222  		var iCost int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 3)
 26223  
 26224  		if (nFrom > 100) || (nTo > 100) {
 26225  			continue
 26226  		}
 26227  		if iCost < 0 {
 26228  			continue
 26229  		}
 26230  		if iCost >= 10000 {
 26231  			continue
 26232  		} // Costs above 10K are considered infinite
 26233  		if (pLang == uintptr(0)) || (iLang != iLangPrev) {
 26234  			var pNew uintptr
 26235  			pNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3Config)(unsafe.Pointer(p)).Fa, (uint64((uint64((*EditDist3Config)(unsafe.Pointer(p)).FnLang + 1)) * uint64(unsafe.Sizeof(EditDist3Lang{})))))
 26236  			if pNew == uintptr(0) {
 26237  				rc = SQLITE_NOMEM
 26238  				break
 26239  			}
 26240  			(*EditDist3Config)(unsafe.Pointer(p)).Fa = pNew
 26241  			pLang = ((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr((*EditDist3Config)(unsafe.Pointer(p)).FnLang)*24)
 26242  			(*EditDist3Config)(unsafe.Pointer(p)).FnLang++
 26243  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiLang = iLang
 26244  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost = 100
 26245  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost = 100
 26246  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost = 150
 26247  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost = uintptr(0)
 26248  			iLangPrev = iLang
 26249  		}
 26250  		if ((nFrom == 1) && (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?')) && (nTo == 0) {
 26251  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost = iCost
 26252  		} else if ((nFrom == 0) && (nTo == 1)) && (int32(*(*int8)(unsafe.Pointer(zTo))) == '?') {
 26253  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost = iCost
 26254  		} else if (((nFrom == 1) && (nTo == 1)) && (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?')) && (int32(*(*int8)(unsafe.Pointer(zTo))) == '?') {
 26255  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost = iCost
 26256  		} else {
 26257  			var pCost uintptr
 26258  			var nExtra int32 = ((nFrom + nTo) - 4)
 26259  			if nExtra < 0 {
 26260  				nExtra = 0
 26261  			}
 26262  			pCost = sqlite3.Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(EditDist3Cost{})) + uint64(nExtra))))
 26263  			if pCost == uintptr(0) {
 26264  				rc = SQLITE_NOMEM
 26265  				break
 26266  			}
 26267  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FnFrom = u8(nFrom)
 26268  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FnTo = u8(nTo)
 26269  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FiCost = u16(iCost)
 26270  			libc.Xmemcpy(tls, pCost+12 /* &.a */, zFrom, uint64(nFrom))
 26271  			libc.Xmemcpy(tls, ((pCost + 12 /* &.a */) + uintptr(nFrom)), zTo, uint64(nTo))
 26272  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FpNext = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost
 26273  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost = pCost
 26274  		}
 26275  	}
 26276  	rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 26277  	if rc == SQLITE_OK {
 26278  		rc = rc2
 26279  	}
 26280  	if rc == SQLITE_OK {
 26281  		var iLang int32
 26282  		for iLang = 0; iLang < (*EditDist3Config)(unsafe.Pointer(p)).FnLang; iLang++ {
 26283  			(*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr(iLang)*24)).FpCost = editDist3CostSort(tls, (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa+uintptr(iLang)*24)).FpCost)
 26284  		}
 26285  	}
 26286  	return rc
 26287  }
 26288  
 26289  // Return the length (in bytes) of a utf-8 character.  Or return a maximum
 26290  // of N.
 26291  func utf8Len(tls *libc.TLS, c uint8, N int32) int32 { /* spellfix.c:818:12: */
 26292  	var len int32 = 1
 26293  	if int32(c) > 0x7f {
 26294  		if (int32(c) & 0xe0) == 0xc0 {
 26295  			len = 2
 26296  		} else if (int32(c) & 0xf0) == 0xe0 {
 26297  			len = 3
 26298  		} else {
 26299  			len = 4
 26300  		}
 26301  	}
 26302  	if len > N {
 26303  		len = N
 26304  	}
 26305  	return len
 26306  }
 26307  
 26308  // Return TRUE (non-zero) if the To side of the given cost matches
 26309  // the given string.
 26310  func matchTo(tls *libc.TLS, p uintptr, z uintptr, n int32) int32 { /* spellfix.c:837:12: */
 26311  
 26312  	if int32(*(*int8)(unsafe.Pointer((p + 12 /* &.a */) + uintptr((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)))) != int32(*(*int8)(unsafe.Pointer(z))) {
 26313  		return 0
 26314  	}
 26315  	if int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo) > n {
 26316  		return 0
 26317  	}
 26318  	if libc.Xstrncmp(tls, ((p+12 /* &.a */)+uintptr((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), z, uint64((*EditDist3Cost)(unsafe.Pointer(p)).FnTo)) != 0 {
 26319  		return 0
 26320  	}
 26321  	return 1
 26322  }
 26323  
 26324  // Return TRUE (non-zero) if the From side of the given cost matches
 26325  // the given string.
 26326  func matchFrom(tls *libc.TLS, p uintptr, z uintptr, n int32) int32 { /* spellfix.c:849:12: */
 26327  
 26328  	if (*EditDist3Cost)(unsafe.Pointer(p)).FnFrom != 0 {
 26329  		if int32(*(*int8)(unsafe.Pointer((p + 12 /* &.a */)))) != int32(*(*int8)(unsafe.Pointer(z))) {
 26330  			return 0
 26331  		}
 26332  		if libc.Xstrncmp(tls, p+12 /* &.a */, z, uint64((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) != 0 {
 26333  			return 0
 26334  		}
 26335  	}
 26336  	return 1
 26337  }
 26338  
 26339  // Return TRUE (non-zero) of the next FROM character and the next TO
 26340  // character are the same.
 26341  func matchFromTo(tls *libc.TLS, pStr uintptr, n1 int32, z2 uintptr, n2 int32) int32 { /* spellfix.c:862:12: */
 26342  	var b1 int32 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(n1)*32)).FnByte
 26343  	if b1 > n2 {
 26344  		return 0
 26345  	}
 26346  
 26347  	if int32(*(*int8)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz + uintptr(n1)))) != int32(*(*int8)(unsafe.Pointer(z2))) {
 26348  		return 0
 26349  	}
 26350  	if libc.Xstrncmp(tls, ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz+uintptr(n1)), z2, uint64(b1)) != 0 {
 26351  		return 0
 26352  	}
 26353  	return 1
 26354  }
 26355  
 26356  // Delete an EditDist3FromString objecct
 26357  func editDist3FromStringDelete(tls *libc.TLS, p uintptr) { /* spellfix.c:879:13: */
 26358  	var i int32
 26359  	if p != 0 {
 26360  		for i = 0; i < (*EditDist3FromString)(unsafe.Pointer(p)).Fn; i++ {
 26361  			sqlite3.Xsqlite3_free(tls, (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(p)).Fa+uintptr(i)*32)).FapDel)
 26362  			sqlite3.Xsqlite3_free(tls, (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(p)).Fa+uintptr(i)*32)).FapSubst)
 26363  		}
 26364  		sqlite3.Xsqlite3_free(tls, p)
 26365  	}
 26366  }
 26367  
 26368  // Create a EditDist3FromString object.
 26369  func editDist3FromStringNew(tls *libc.TLS, pLang uintptr, z uintptr, n int32) uintptr { /* spellfix.c:893:28: */
 26370  	var pStr uintptr
 26371  	var p uintptr
 26372  	var i int32
 26373  
 26374  	if z == uintptr(0) {
 26375  		return uintptr(0)
 26376  	}
 26377  	if n < 0 {
 26378  		n = int32(libc.Xstrlen(tls, z))
 26379  	}
 26380  	pStr = sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint64(unsafe.Sizeof(EditDist3FromString{})) + (uint64(unsafe.Sizeof(EditDist3From{})) * uint64(n))) + uint64(n)) + uint64(1))))
 26381  	if pStr == uintptr(0) {
 26382  		return uintptr(0)
 26383  	}
 26384  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fa = (pStr + 1*24)
 26385  	libc.Xmemset(tls, (*EditDist3FromString)(unsafe.Pointer(pStr)).Fa, 0, (uint64(unsafe.Sizeof(EditDist3From{})) * uint64(n)))
 26386  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fn = n
 26387  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fz = ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(n)*32)
 26388  	libc.Xmemcpy(tls, (*EditDist3FromString)(unsafe.Pointer(pStr)).Fz, z, (uint64(n + 1)))
 26389  	if (n != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((n - 1))))) == '*') {
 26390  		(*EditDist3FromString)(unsafe.Pointer(pStr)).FisPrefix = 1
 26391  		n--
 26392  		(*EditDist3FromString)(unsafe.Pointer(pStr)).Fn--
 26393  		*(*int8)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz + uintptr(n))) = int8(0)
 26394  	} else {
 26395  		(*EditDist3FromString)(unsafe.Pointer(pStr)).FisPrefix = 0
 26396  	}
 26397  
 26398  	for i = 0; i < n; i++ {
 26399  		var pFrom uintptr = ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(i)*32)
 26400  		libc.Xmemset(tls, pFrom, 0, uint64(unsafe.Sizeof(EditDist3From{})))
 26401  		(*EditDist3From)(unsafe.Pointer(pFrom)).FnByte = utf8Len(tls, uint8(*(*int8)(unsafe.Pointer(z + uintptr(i)))), (n - i))
 26402  		for p = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost; p != 0; p = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext {
 26403  			var apNew uintptr
 26404  			if (i + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) > n {
 26405  				continue
 26406  			}
 26407  			if matchFrom(tls, p, (z+uintptr(i)), (n-i)) == 0 {
 26408  				continue
 26409  			}
 26410  			if int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo) == 0 {
 26411  				apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3From)(unsafe.Pointer(pFrom)).FapDel,
 26412  					(uint64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64((*EditDist3From)(unsafe.Pointer(pFrom)).FnDel + 1)))))
 26413  				if apNew == uintptr(0) {
 26414  					break
 26415  				}
 26416  				(*EditDist3From)(unsafe.Pointer(pFrom)).FapDel = apNew
 26417  				*(*uintptr)(unsafe.Pointer(apNew + uintptr(libc.PostIncInt32(&(*EditDist3From)(unsafe.Pointer(pFrom)).FnDel, 1))*8)) = p
 26418  			} else {
 26419  				apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3From)(unsafe.Pointer(pFrom)).FapSubst,
 26420  					(uint64(uint64(unsafe.Sizeof(uintptr(0))) * (uint64((*EditDist3From)(unsafe.Pointer(pFrom)).FnSubst + 1)))))
 26421  				if apNew == uintptr(0) {
 26422  					break
 26423  				}
 26424  				(*EditDist3From)(unsafe.Pointer(pFrom)).FapSubst = apNew
 26425  				*(*uintptr)(unsafe.Pointer(apNew + uintptr(libc.PostIncInt32(&(*EditDist3From)(unsafe.Pointer(pFrom)).FnSubst, 1))*8)) = p
 26426  			}
 26427  		}
 26428  		if p != 0 {
 26429  			editDist3FromStringDelete(tls, pStr)
 26430  			pStr = uintptr(0)
 26431  			break
 26432  		}
 26433  	}
 26434  	return pStr
 26435  }
 26436  
 26437  // Update entry m[i] such that it is the minimum of its current value
 26438  // and m[j]+iCost.
 26439  func updateCost(tls *libc.TLS, m uintptr, i int32, j int32, iCost int32) { /* spellfix.c:955:13: */
 26440  	var b uint32
 26441  
 26442  	b = (*(*uint32)(unsafe.Pointer(m + uintptr(j)*4)) + uint32(iCost))
 26443  	if b < *(*uint32)(unsafe.Pointer(m + uintptr(i)*4)) {
 26444  		*(*uint32)(unsafe.Pointer(m + uintptr(i)*4)) = b
 26445  	}
 26446  }
 26447  
 26448  // How much stack space (int bytes) to use for Wagner matrix in
 26449  // editDist3Core().  If more space than this is required, the entire
 26450  // matrix is taken from the heap.  To reduce the load on the memory
 26451  // allocator, make this value as large as practical for the
 26452  // architecture in use.
 26453  
 26454  // Compute the edit distance between two strings.
 26455  //
 26456  // If an error occurs, return a negative number which is the error code.
 26457  //
 26458  // If pnMatch is not NULL, then *pnMatch is set to the number of characters
 26459  // (not bytes) in z2 that matched the search pattern in *pFrom. If pFrom does
 26460  // not contain the pattern for a prefix-search, then this is always the number
 26461  // of characters in z2. If pFrom does contain a prefix search pattern, then
 26462  // it is the number of characters in the prefix of z2 that was deemed to
 26463  // match pFrom.
 26464  func editDist3Core(tls *libc.TLS, pFrom uintptr, z2 uintptr, n2 int32, pLang uintptr, pnMatch uintptr) int32 { /* spellfix.c:990:12: */
 26465  	bp := tls.Alloc(1048)
 26466  	defer tls.Free(1048)
 26467  
 26468  	var k int32
 26469  	var n int32
 26470  	var i1 int32
 26471  	var b1 int32
 26472  	var i2 int32
 26473  	var b2 int32
 26474  	// var f EditDist3FromString at bp+1024, 24
 26475  
 26476  	var a2 uintptr
 26477  	var m uintptr
 26478  	var pToFree uintptr
 26479  	var szRow int32
 26480  	var p uintptr
 26481  	var res int32
 26482  	var nByte sqlite3_uint64
 26483  	// var stackSpace [256]uint32 at bp, 1024
 26484  
 26485  	var apNew uintptr
 26486  	var cx int32  // Index of current cell
 26487  	var cxp int32 // Index of cell immediately to the left
 26488  	var cxd int32 // Index of cell to the left and one row above
 26489  	var cxu int32
 26490  	var rx int32 // Starting index for current row
 26491  	var rxp int32
 26492  	var b int32
 26493  	var nExtra int32
 26494  	*(*EditDist3FromString)(unsafe.Pointer(bp + 1024 /* f */)) = *(*EditDist3FromString)(unsafe.Pointer(pFrom))
 26495  
 26496  	// allocate the Wagner matrix and the aTo[] array for the TO string
 26497  	n = (((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn + 1) * (n2 + 1))
 26498  	n = ((n + 1) & libc.CplInt32(1))
 26499  	nByte = (sqlite3_uint64((uint64(n) * uint64(unsafe.Sizeof(uint32(0)))) + (uint64(unsafe.Sizeof(EditDist3To{})) * uint64(n2))))
 26500  	if !(nByte <= sqlite3_uint64(unsafe.Sizeof([256]uint32{}))) {
 26501  		goto __1
 26502  	}
 26503  	m = bp /* &stackSpace[0] */
 26504  	pToFree = uintptr(0)
 26505  	goto __2
 26506  __1:
 26507  	m = libc.AssignUintptr(&pToFree, sqlite3.Xsqlite3_malloc64(tls, nByte))
 26508  	if !(m == uintptr(0)) {
 26509  		goto __3
 26510  	}
 26511  	return -1
 26512  __3:
 26513  	; // Out of memory
 26514  __2:
 26515  	;
 26516  	a2 = (m + uintptr(n)*4)
 26517  	libc.Xmemset(tls, a2, 0, (uint64(unsafe.Sizeof(EditDist3To{})) * uint64(n2)))
 26518  
 26519  	// Fill in the a1[] matrix for all characters of the TO string
 26520  	i2 = 0
 26521  __4:
 26522  	if !(i2 < n2) {
 26523  		goto __6
 26524  	}
 26525  	(*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*16)).FnByte = utf8Len(tls, uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i2)))), (n2 - i2))
 26526  	p = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost
 26527  __7:
 26528  	if !(p != 0) {
 26529  		goto __9
 26530  	}
 26531  	if !(int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom) > 0) {
 26532  		goto __10
 26533  	}
 26534  	goto __9
 26535  __10:
 26536  	;
 26537  	if !((i2 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo)) > n2) {
 26538  		goto __11
 26539  	}
 26540  	goto __8
 26541  __11:
 26542  	;
 26543  	if !(int32(*(*int8)(unsafe.Pointer((p + 12 /* &.a */)))) > int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i2))))) {
 26544  		goto __12
 26545  	}
 26546  	goto __9
 26547  __12:
 26548  	;
 26549  	if !(matchTo(tls, p, (z2+uintptr(i2)), (n2-i2)) == 0) {
 26550  		goto __13
 26551  	}
 26552  	goto __8
 26553  __13:
 26554  	;
 26555  	(*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FnIns++
 26556  	apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FapIns, (uint64(uint64(unsafe.Sizeof(uintptr(0))) * uint64((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FnIns))))
 26557  	if !(apNew == uintptr(0)) {
 26558  		goto __14
 26559  	}
 26560  	res = -1 // Out of memory
 26561  	goto editDist3Abort
 26562  __14:
 26563  	;
 26564  	(*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*16)).FapIns = apNew
 26565  	*(*uintptr)(unsafe.Pointer((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FapIns + uintptr(((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FnIns-1))*8)) = p
 26566  	goto __8
 26567  __8:
 26568  	p = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext
 26569  	goto __7
 26570  	goto __9
 26571  __9:
 26572  	;
 26573  	goto __5
 26574  __5:
 26575  	i2++
 26576  	goto __4
 26577  	goto __6
 26578  __6:
 26579  	;
 26580  
 26581  	// Prepare to compute the minimum edit distance
 26582  	szRow = ((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn + 1)
 26583  	libc.Xmemset(tls, m, 0x01, ((uint64((n2 + 1) * szRow)) * uint64(unsafe.Sizeof(uint32(0)))))
 26584  	*(*uint32)(unsafe.Pointer(m)) = uint32(0)
 26585  
 26586  	// First fill in the top-row of the matrix with FROM deletion costs
 26587  	i1 = 0
 26588  __15:
 26589  	if !(i1 < (*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn) {
 26590  		goto __17
 26591  	}
 26592  	b1 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa + uintptr(i1)*32)).FnByte
 26593  	updateCost(tls, m, (i1 + b1), i1, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost)
 26594  	k = 0
 26595  __18:
 26596  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FnDel) {
 26597  		goto __20
 26598  	}
 26599  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FapDel + uintptr(k)*8))
 26600  	updateCost(tls, m, (i1 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), i1, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 26601  	goto __19
 26602  __19:
 26603  	k++
 26604  	goto __18
 26605  	goto __20
 26606  __20:
 26607  	;
 26608  	goto __16
 26609  __16:
 26610  	i1 = i1 + (b1)
 26611  	goto __15
 26612  	goto __17
 26613  __17:
 26614  	;
 26615  
 26616  	// Fill in all subsequent rows, top-to-bottom, left-to-right
 26617  	i2 = 0
 26618  __21:
 26619  	if !(i2 < n2) {
 26620  		goto __23
 26621  	} // Starting index for previous row
 26622  	b2 = (*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*16)).FnByte
 26623  	rx = (szRow * (i2 + b2))
 26624  	rxp = (szRow * i2)
 26625  	updateCost(tls, m, rx, rxp, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost)
 26626  	k = 0
 26627  __24:
 26628  	if !(k < (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FnIns) {
 26629  		goto __26
 26630  	}
 26631  	p = *(*uintptr)(unsafe.Pointer((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FapIns + uintptr(k)*8))
 26632  	updateCost(tls, m, (szRow * (i2 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo))), rxp, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 26633  	goto __25
 26634  __25:
 26635  	k++
 26636  	goto __24
 26637  	goto __26
 26638  __26:
 26639  	;
 26640  	i1 = 0
 26641  __27:
 26642  	if !(i1 < (*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn) {
 26643  		goto __29
 26644  	} // Index of cell immediately above
 26645  	b1 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa + uintptr(i1)*32)).FnByte
 26646  	cxp = (rx + i1)
 26647  	cx = (cxp + b1)
 26648  	cxd = (rxp + i1)
 26649  	cxu = (cxd + b1)
 26650  	updateCost(tls, m, cx, cxp, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost)
 26651  	k = 0
 26652  __30:
 26653  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FnDel) {
 26654  		goto __32
 26655  	}
 26656  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FapDel + uintptr(k)*8))
 26657  	updateCost(tls, m, (cxp + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), cxp, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 26658  	goto __31
 26659  __31:
 26660  	k++
 26661  	goto __30
 26662  	goto __32
 26663  __32:
 26664  	;
 26665  	updateCost(tls, m, cx, cxu, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost)
 26666  	if !(matchFromTo(tls, bp+1024 /* &f */, i1, (z2+uintptr(i2)), (n2-i2)) != 0) {
 26667  		goto __33
 26668  	}
 26669  	updateCost(tls, m, cx, cxd, 0)
 26670  __33:
 26671  	;
 26672  	updateCost(tls, m, cx, cxd, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost)
 26673  	k = 0
 26674  __34:
 26675  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FnSubst) {
 26676  		goto __36
 26677  	}
 26678  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*32)).FapSubst + uintptr(k)*8))
 26679  	if !(matchTo(tls, p, (z2+uintptr(i2)), (n2-i2)) != 0) {
 26680  		goto __37
 26681  	}
 26682  	updateCost(tls, m, ((cxd + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) + (szRow * int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo))), cxd, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 26683  __37:
 26684  	;
 26685  	goto __35
 26686  __35:
 26687  	k++
 26688  	goto __34
 26689  	goto __36
 26690  __36:
 26691  	;
 26692  	goto __28
 26693  __28:
 26694  	i1 = i1 + (b1)
 26695  	goto __27
 26696  	goto __29
 26697  __29:
 26698  	;
 26699  	goto __22
 26700  __22:
 26701  	i2 = i2 + (b2)
 26702  	goto __21
 26703  	goto __23
 26704  __23:
 26705  	;
 26706  
 26707  	// Free memory allocations and return the result
 26708  	res = int32(*(*uint32)(unsafe.Pointer(m + uintptr(((szRow*(n2+1))-1))*4)))
 26709  	n = n2
 26710  	if !((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).FisPrefix != 0) {
 26711  		goto __38
 26712  	}
 26713  	i2 = 1
 26714  __39:
 26715  	if !(i2 <= n2) {
 26716  		goto __41
 26717  	}
 26718  	b = int32(*(*uint32)(unsafe.Pointer(m + uintptr(((szRow*i2)-1))*4)))
 26719  	if !(b <= res) {
 26720  		goto __42
 26721  	}
 26722  	res = b
 26723  	n = (i2 - 1)
 26724  __42:
 26725  	;
 26726  	goto __40
 26727  __40:
 26728  	i2++
 26729  	goto __39
 26730  	goto __41
 26731  __41:
 26732  	;
 26733  __38:
 26734  	;
 26735  	if !(pnMatch != 0) {
 26736  		goto __43
 26737  	}
 26738  	nExtra = 0
 26739  	k = 0
 26740  __44:
 26741  	if !(k < n) {
 26742  		goto __46
 26743  	}
 26744  	if !((int32(*(*int8)(unsafe.Pointer(z2 + uintptr(k)))) & 0xc0) == 0x80) {
 26745  		goto __47
 26746  	}
 26747  	nExtra++
 26748  __47:
 26749  	;
 26750  	goto __45
 26751  __45:
 26752  	k++
 26753  	goto __44
 26754  	goto __46
 26755  __46:
 26756  	;
 26757  	*(*int32)(unsafe.Pointer(pnMatch)) = (n - nExtra)
 26758  __43:
 26759  	;
 26760  
 26761  editDist3Abort:
 26762  	i2 = 0
 26763  __48:
 26764  	if !(i2 < n2) {
 26765  		goto __50
 26766  	}
 26767  	sqlite3.Xsqlite3_free(tls, (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*16)).FapIns)
 26768  	goto __49
 26769  __49:
 26770  	i2++
 26771  	goto __48
 26772  	goto __50
 26773  __50:
 26774  	;
 26775  	sqlite3.Xsqlite3_free(tls, pToFree)
 26776  	return res
 26777  }
 26778  
 26779  // Get an appropriate EditDist3Lang object.
 26780  func editDist3FindLang(tls *libc.TLS, pConfig uintptr, iLang int32) uintptr { /* spellfix.c:1150:28: */
 26781  	var i int32
 26782  	for i = 0; i < (*EditDist3Config)(unsafe.Pointer(pConfig)).FnLang; i++ {
 26783  		if (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(pConfig)).Fa+uintptr(i)*24)).FiLang == iLang {
 26784  			return ((*EditDist3Config)(unsafe.Pointer(pConfig)).Fa + uintptr(i)*24)
 26785  		}
 26786  	}
 26787  	return uintptr(unsafe.Pointer(&editDist3Lang))
 26788  }
 26789  
 26790  // Function:    editdist3(A,B,iLang)
 26791  //              editdist3(tablename)
 26792  //
 26793  // Return the cost of transforming string A into string B using edit
 26794  // weights for iLang.
 26795  //
 26796  // The second form loads edit weights into memory from a table.
 26797  func editDist3SqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1170:13: */
 26798  	var pConfig uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 26799  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 26800  	var rc int32
 26801  	if argc == 1 {
 26802  		var zTable uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 26803  		rc = editDist3ConfigLoad(tls, pConfig, db, zTable)
 26804  		if rc != 0 {
 26805  			sqlite3.Xsqlite3_result_error_code(tls, context, rc)
 26806  		}
 26807  	} else {
 26808  		var zA uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 26809  		var zB uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 26810  		var nA int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 26811  		var nB int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 26812  		var iLang int32
 26813  		if argc == 3 {
 26814  			iLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 26815  		} else {
 26816  			iLang = 0
 26817  		}
 26818  		var pLang uintptr = editDist3FindLang(tls, pConfig, iLang)
 26819  		var pFrom uintptr
 26820  		var dist int32
 26821  
 26822  		pFrom = editDist3FromStringNew(tls, pLang, zA, nA)
 26823  		if pFrom == uintptr(0) {
 26824  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 26825  			return
 26826  		}
 26827  		dist = editDist3Core(tls, pFrom, zB, nB, pLang, uintptr(0))
 26828  		editDist3FromStringDelete(tls, pFrom)
 26829  		if dist == (-1) {
 26830  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 26831  		} else {
 26832  			sqlite3.Xsqlite3_result_int(tls, context, dist)
 26833  		}
 26834  	}
 26835  }
 26836  
 26837  // Register the editDist3 function with SQLite
 26838  func editDist3Install(tls *libc.TLS, db uintptr) int32 { /* spellfix.c:1210:12: */
 26839  	var rc int32
 26840  	var pConfig uintptr = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(EditDist3Config{})))
 26841  	if pConfig == uintptr(0) {
 26842  		return SQLITE_NOMEM
 26843  	}
 26844  	libc.Xmemset(tls, pConfig, 0, uint64(unsafe.Sizeof(EditDist3Config{})))
 26845  	rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 26846  		2, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 26847  		*(*uintptr)(unsafe.Pointer(&struct {
 26848  			f func(*libc.TLS, uintptr, int32, uintptr)
 26849  		}{editDist3SqlFunc})), uintptr(0), uintptr(0), uintptr(0))
 26850  	if rc == SQLITE_OK {
 26851  		rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 26852  			3, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 26853  			*(*uintptr)(unsafe.Pointer(&struct {
 26854  				f func(*libc.TLS, uintptr, int32, uintptr)
 26855  			}{editDist3SqlFunc})), uintptr(0), uintptr(0), uintptr(0))
 26856  	}
 26857  	if rc == SQLITE_OK {
 26858  		rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 26859  			1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 26860  			*(*uintptr)(unsafe.Pointer(&struct {
 26861  				f func(*libc.TLS, uintptr, int32, uintptr)
 26862  			}{editDist3SqlFunc})), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{editDist3ConfigDelete})))
 26863  	} else {
 26864  		sqlite3.Xsqlite3_free(tls, pConfig)
 26865  	}
 26866  	return rc
 26867  }
 26868  
 26869  // End configurable cost unicode edit distance routines
 26870  //
 26871  //
 26872  // Begin transliterate unicode-to-ascii implementation
 26873  
 26874  // This lookup table is used to help decode the first byte of
 26875  // a multi-byte UTF8 character.
 26876  var sqlite3Utf8Trans1 = [64]uint8{
 26877  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 26878  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 26879  	uint8(0x10), uint8(0x11), uint8(0x12), uint8(0x13), uint8(0x14), uint8(0x15), uint8(0x16), uint8(0x17),
 26880  	uint8(0x18), uint8(0x19), uint8(0x1a), uint8(0x1b), uint8(0x1c), uint8(0x1d), uint8(0x1e), uint8(0x1f),
 26881  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 26882  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 26883  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 26884  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x00),
 26885  } /* spellfix.c:1243:28 */
 26886  
 26887  // Return the value of the first UTF-8 character in the string.
 26888  func utf8Read(tls *libc.TLS, z uintptr, n int32, pSize uintptr) int32 { /* spellfix.c:1258:12: */
 26889  	var c int32
 26890  	var i int32
 26891  
 26892  	// All callers to this routine (in the current implementation)
 26893  	// always have n>0.
 26894  	if 0 != 0 {
 26895  		c = libc.AssignInt32(&i, 0)
 26896  	} else {
 26897  		c = int32(*(*uint8)(unsafe.Pointer(z)))
 26898  		i = 1
 26899  		if c >= 0xc0 {
 26900  			c = int32(sqlite3Utf8Trans1[(c - 0xc0)])
 26901  			for (i < n) && ((int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) & 0xc0) == 0x80) {
 26902  				c = ((c << 6) + (0x3f & int32(*(*uint8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))))))
 26903  			}
 26904  		}
 26905  	}
 26906  	*(*int32)(unsafe.Pointer(pSize)) = i
 26907  	return c
 26908  }
 26909  
 26910  // Return the number of characters in the utf-8 string in the nIn byte
 26911  // buffer pointed to by zIn.
 26912  func utf8Charlen(tls *libc.TLS, zIn uintptr, nIn int32) int32 { /* spellfix.c:1283:12: */
 26913  	bp := tls.Alloc(4)
 26914  	defer tls.Free(4)
 26915  
 26916  	var i int32
 26917  	var nChar int32 = 0
 26918  	for i = 0; i < nIn; nChar++ {
 26919  		// var sz int32 at bp, 4
 26920  
 26921  		utf8Read(tls, (zIn + uintptr(i)), (nIn - i), bp /* &sz */)
 26922  		i = i + (*(*int32)(unsafe.Pointer(bp /* sz */)))
 26923  	}
 26924  	return nChar
 26925  }
 26926  
 26927  type Transliteration1 = struct {
 26928  	FcFrom uint16
 26929  	FcTo0  uint8
 26930  	FcTo1  uint8
 26931  	FcTo2  uint8
 26932  	FcTo3  uint8
 26933  } /* spellfix.c:1294:9 */
 26934  
 26935  type Transliteration = Transliteration1 /* spellfix.c:1294:32 */
 26936  
 26937  // Table of translations from unicode characters into ASCII.
 26938  var translit = [389]Transliteration{
 26939  	{FcFrom: uint16(0x00A0), FcTo0: uint8(0x20)},                                                             //   to
 26940  	{FcFrom: uint16(0x00B5), FcTo0: uint8(0x75)},                                                             // µ to u
 26941  	{FcFrom: uint16(0x00C0), FcTo0: uint8(0x41)},                                                             // À to A
 26942  	{FcFrom: uint16(0x00C1), FcTo0: uint8(0x41)},                                                             // Á to A
 26943  	{FcFrom: uint16(0x00C2), FcTo0: uint8(0x41)},                                                             // Â to A
 26944  	{FcFrom: uint16(0x00C3), FcTo0: uint8(0x41)},                                                             // Ã to A
 26945  	{FcFrom: uint16(0x00C4), FcTo0: uint8(0x41), FcTo1: uint8(0x65)},                                         // Ä to Ae
 26946  	{FcFrom: uint16(0x00C5), FcTo0: uint8(0x41), FcTo1: uint8(0x61)},                                         // Å to Aa
 26947  	{FcFrom: uint16(0x00C6), FcTo0: uint8(0x41), FcTo1: uint8(0x45)},                                         // Æ to AE
 26948  	{FcFrom: uint16(0x00C7), FcTo0: uint8(0x43)},                                                             // Ç to C
 26949  	{FcFrom: uint16(0x00C8), FcTo0: uint8(0x45)},                                                             // È to E
 26950  	{FcFrom: uint16(0x00C9), FcTo0: uint8(0x45)},                                                             // É to E
 26951  	{FcFrom: uint16(0x00CA), FcTo0: uint8(0x45)},                                                             // Ê to E
 26952  	{FcFrom: uint16(0x00CB), FcTo0: uint8(0x45)},                                                             // Ë to E
 26953  	{FcFrom: uint16(0x00CC), FcTo0: uint8(0x49)},                                                             // Ì to I
 26954  	{FcFrom: uint16(0x00CD), FcTo0: uint8(0x49)},                                                             // Í to I
 26955  	{FcFrom: uint16(0x00CE), FcTo0: uint8(0x49)},                                                             // Î to I
 26956  	{FcFrom: uint16(0x00CF), FcTo0: uint8(0x49)},                                                             // Ï to I
 26957  	{FcFrom: uint16(0x00D0), FcTo0: uint8(0x44)},                                                             // Ð to D
 26958  	{FcFrom: uint16(0x00D1), FcTo0: uint8(0x4E)},                                                             // Ñ to N
 26959  	{FcFrom: uint16(0x00D2), FcTo0: uint8(0x4F)},                                                             // Ò to O
 26960  	{FcFrom: uint16(0x00D3), FcTo0: uint8(0x4F)},                                                             // Ó to O
 26961  	{FcFrom: uint16(0x00D4), FcTo0: uint8(0x4F)},                                                             // Ô to O
 26962  	{FcFrom: uint16(0x00D5), FcTo0: uint8(0x4F)},                                                             // Õ to O
 26963  	{FcFrom: uint16(0x00D6), FcTo0: uint8(0x4F), FcTo1: uint8(0x65)},                                         // Ö to Oe
 26964  	{FcFrom: uint16(0x00D7), FcTo0: uint8(0x78)},                                                             // × to x
 26965  	{FcFrom: uint16(0x00D8), FcTo0: uint8(0x4F)},                                                             // Ø to O
 26966  	{FcFrom: uint16(0x00D9), FcTo0: uint8(0x55)},                                                             // Ù to U
 26967  	{FcFrom: uint16(0x00DA), FcTo0: uint8(0x55)},                                                             // Ú to U
 26968  	{FcFrom: uint16(0x00DB), FcTo0: uint8(0x55)},                                                             // Û to U
 26969  	{FcFrom: uint16(0x00DC), FcTo0: uint8(0x55), FcTo1: uint8(0x65)},                                         // Ü to Ue
 26970  	{FcFrom: uint16(0x00DD), FcTo0: uint8(0x59)},                                                             // Ý to Y
 26971  	{FcFrom: uint16(0x00DE), FcTo0: uint8(0x54), FcTo1: uint8(0x68)},                                         // Þ to Th
 26972  	{FcFrom: uint16(0x00DF), FcTo0: uint8(0x73), FcTo1: uint8(0x73)},                                         // ß to ss
 26973  	{FcFrom: uint16(0x00E0), FcTo0: uint8(0x61)},                                                             // à to a
 26974  	{FcFrom: uint16(0x00E1), FcTo0: uint8(0x61)},                                                             // á to a
 26975  	{FcFrom: uint16(0x00E2), FcTo0: uint8(0x61)},                                                             // â to a
 26976  	{FcFrom: uint16(0x00E3), FcTo0: uint8(0x61)},                                                             // ã to a
 26977  	{FcFrom: uint16(0x00E4), FcTo0: uint8(0x61), FcTo1: uint8(0x65)},                                         // ä to ae
 26978  	{FcFrom: uint16(0x00E5), FcTo0: uint8(0x61), FcTo1: uint8(0x61)},                                         // å to aa
 26979  	{FcFrom: uint16(0x00E6), FcTo0: uint8(0x61), FcTo1: uint8(0x65)},                                         // æ to ae
 26980  	{FcFrom: uint16(0x00E7), FcTo0: uint8(0x63)},                                                             // ç to c
 26981  	{FcFrom: uint16(0x00E8), FcTo0: uint8(0x65)},                                                             // è to e
 26982  	{FcFrom: uint16(0x00E9), FcTo0: uint8(0x65)},                                                             // é to e
 26983  	{FcFrom: uint16(0x00EA), FcTo0: uint8(0x65)},                                                             // ê to e
 26984  	{FcFrom: uint16(0x00EB), FcTo0: uint8(0x65)},                                                             // ë to e
 26985  	{FcFrom: uint16(0x00EC), FcTo0: uint8(0x69)},                                                             // ì to i
 26986  	{FcFrom: uint16(0x00ED), FcTo0: uint8(0x69)},                                                             // í to i
 26987  	{FcFrom: uint16(0x00EE), FcTo0: uint8(0x69)},                                                             // î to i
 26988  	{FcFrom: uint16(0x00EF), FcTo0: uint8(0x69)},                                                             // ï to i
 26989  	{FcFrom: uint16(0x00F0), FcTo0: uint8(0x64)},                                                             // ð to d
 26990  	{FcFrom: uint16(0x00F1), FcTo0: uint8(0x6E)},                                                             // ñ to n
 26991  	{FcFrom: uint16(0x00F2), FcTo0: uint8(0x6F)},                                                             // ò to o
 26992  	{FcFrom: uint16(0x00F3), FcTo0: uint8(0x6F)},                                                             // ó to o
 26993  	{FcFrom: uint16(0x00F4), FcTo0: uint8(0x6F)},                                                             // ô to o
 26994  	{FcFrom: uint16(0x00F5), FcTo0: uint8(0x6F)},                                                             // õ to o
 26995  	{FcFrom: uint16(0x00F6), FcTo0: uint8(0x6F), FcTo1: uint8(0x65)},                                         // ö to oe
 26996  	{FcFrom: uint16(0x00F7), FcTo0: uint8(0x3A)},                                                             // ÷ to :
 26997  	{FcFrom: uint16(0x00F8), FcTo0: uint8(0x6F)},                                                             // ø to o
 26998  	{FcFrom: uint16(0x00F9), FcTo0: uint8(0x75)},                                                             // ù to u
 26999  	{FcFrom: uint16(0x00FA), FcTo0: uint8(0x75)},                                                             // ú to u
 27000  	{FcFrom: uint16(0x00FB), FcTo0: uint8(0x75)},                                                             // û to u
 27001  	{FcFrom: uint16(0x00FC), FcTo0: uint8(0x75), FcTo1: uint8(0x65)},                                         // ü to ue
 27002  	{FcFrom: uint16(0x00FD), FcTo0: uint8(0x79)},                                                             // ý to y
 27003  	{FcFrom: uint16(0x00FE), FcTo0: uint8(0x74), FcTo1: uint8(0x68)},                                         // þ to th
 27004  	{FcFrom: uint16(0x00FF), FcTo0: uint8(0x79)},                                                             // ÿ to y
 27005  	{FcFrom: uint16(0x0100), FcTo0: uint8(0x41)},                                                             // Ā to A
 27006  	{FcFrom: uint16(0x0101), FcTo0: uint8(0x61)},                                                             // ā to a
 27007  	{FcFrom: uint16(0x0102), FcTo0: uint8(0x41)},                                                             // Ă to A
 27008  	{FcFrom: uint16(0x0103), FcTo0: uint8(0x61)},                                                             // ă to a
 27009  	{FcFrom: uint16(0x0104), FcTo0: uint8(0x41)},                                                             // Ą to A
 27010  	{FcFrom: uint16(0x0105), FcTo0: uint8(0x61)},                                                             // ą to a
 27011  	{FcFrom: uint16(0x0106), FcTo0: uint8(0x43)},                                                             // Ć to C
 27012  	{FcFrom: uint16(0x0107), FcTo0: uint8(0x63)},                                                             // ć to c
 27013  	{FcFrom: uint16(0x0108), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Ĉ to Ch
 27014  	{FcFrom: uint16(0x0109), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // ĉ to ch
 27015  	{FcFrom: uint16(0x010A), FcTo0: uint8(0x43)},                                                             // Ċ to C
 27016  	{FcFrom: uint16(0x010B), FcTo0: uint8(0x63)},                                                             // ċ to c
 27017  	{FcFrom: uint16(0x010C), FcTo0: uint8(0x43)},                                                             // Č to C
 27018  	{FcFrom: uint16(0x010D), FcTo0: uint8(0x63)},                                                             // č to c
 27019  	{FcFrom: uint16(0x010E), FcTo0: uint8(0x44)},                                                             // Ď to D
 27020  	{FcFrom: uint16(0x010F), FcTo0: uint8(0x64)},                                                             // ď to d
 27021  	{FcFrom: uint16(0x0110), FcTo0: uint8(0x44)},                                                             // Đ to D
 27022  	{FcFrom: uint16(0x0111), FcTo0: uint8(0x64)},                                                             // đ to d
 27023  	{FcFrom: uint16(0x0112), FcTo0: uint8(0x45)},                                                             // Ē to E
 27024  	{FcFrom: uint16(0x0113), FcTo0: uint8(0x65)},                                                             // ē to e
 27025  	{FcFrom: uint16(0x0114), FcTo0: uint8(0x45)},                                                             // Ĕ to E
 27026  	{FcFrom: uint16(0x0115), FcTo0: uint8(0x65)},                                                             // ĕ to e
 27027  	{FcFrom: uint16(0x0116), FcTo0: uint8(0x45)},                                                             // Ė to E
 27028  	{FcFrom: uint16(0x0117), FcTo0: uint8(0x65)},                                                             // ė to e
 27029  	{FcFrom: uint16(0x0118), FcTo0: uint8(0x45)},                                                             // Ę to E
 27030  	{FcFrom: uint16(0x0119), FcTo0: uint8(0x65)},                                                             // ę to e
 27031  	{FcFrom: uint16(0x011A), FcTo0: uint8(0x45)},                                                             // Ě to E
 27032  	{FcFrom: uint16(0x011B), FcTo0: uint8(0x65)},                                                             // ě to e
 27033  	{FcFrom: uint16(0x011C), FcTo0: uint8(0x47), FcTo1: uint8(0x68)},                                         // Ĝ to Gh
 27034  	{FcFrom: uint16(0x011D), FcTo0: uint8(0x67), FcTo1: uint8(0x68)},                                         // ĝ to gh
 27035  	{FcFrom: uint16(0x011E), FcTo0: uint8(0x47)},                                                             // Ğ to G
 27036  	{FcFrom: uint16(0x011F), FcTo0: uint8(0x67)},                                                             // ğ to g
 27037  	{FcFrom: uint16(0x0120), FcTo0: uint8(0x47)},                                                             // Ġ to G
 27038  	{FcFrom: uint16(0x0121), FcTo0: uint8(0x67)},                                                             // ġ to g
 27039  	{FcFrom: uint16(0x0122), FcTo0: uint8(0x47)},                                                             // Ģ to G
 27040  	{FcFrom: uint16(0x0123), FcTo0: uint8(0x67)},                                                             // ģ to g
 27041  	{FcFrom: uint16(0x0124), FcTo0: uint8(0x48), FcTo1: uint8(0x68)},                                         // Ĥ to Hh
 27042  	{FcFrom: uint16(0x0125), FcTo0: uint8(0x68), FcTo1: uint8(0x68)},                                         // ĥ to hh
 27043  	{FcFrom: uint16(0x0126), FcTo0: uint8(0x48)},                                                             // Ħ to H
 27044  	{FcFrom: uint16(0x0127), FcTo0: uint8(0x68)},                                                             // ħ to h
 27045  	{FcFrom: uint16(0x0128), FcTo0: uint8(0x49)},                                                             // Ĩ to I
 27046  	{FcFrom: uint16(0x0129), FcTo0: uint8(0x69)},                                                             // ĩ to i
 27047  	{FcFrom: uint16(0x012A), FcTo0: uint8(0x49)},                                                             // Ī to I
 27048  	{FcFrom: uint16(0x012B), FcTo0: uint8(0x69)},                                                             // ī to i
 27049  	{FcFrom: uint16(0x012C), FcTo0: uint8(0x49)},                                                             // Ĭ to I
 27050  	{FcFrom: uint16(0x012D), FcTo0: uint8(0x69)},                                                             // ĭ to i
 27051  	{FcFrom: uint16(0x012E), FcTo0: uint8(0x49)},                                                             // Į to I
 27052  	{FcFrom: uint16(0x012F), FcTo0: uint8(0x69)},                                                             // į to i
 27053  	{FcFrom: uint16(0x0130), FcTo0: uint8(0x49)},                                                             // İ to I
 27054  	{FcFrom: uint16(0x0131), FcTo0: uint8(0x69)},                                                             // ı to i
 27055  	{FcFrom: uint16(0x0132), FcTo0: uint8(0x49), FcTo1: uint8(0x4A)},                                         // IJ to IJ
 27056  	{FcFrom: uint16(0x0133), FcTo0: uint8(0x69), FcTo1: uint8(0x6A)},                                         // ij to ij
 27057  	{FcFrom: uint16(0x0134), FcTo0: uint8(0x4A), FcTo1: uint8(0x68)},                                         // Ĵ to Jh
 27058  	{FcFrom: uint16(0x0135), FcTo0: uint8(0x6A), FcTo1: uint8(0x68)},                                         // ĵ to jh
 27059  	{FcFrom: uint16(0x0136), FcTo0: uint8(0x4B)},                                                             // Ķ to K
 27060  	{FcFrom: uint16(0x0137), FcTo0: uint8(0x6B)},                                                             // ķ to k
 27061  	{FcFrom: uint16(0x0138), FcTo0: uint8(0x6B)},                                                             // ĸ to k
 27062  	{FcFrom: uint16(0x0139), FcTo0: uint8(0x4C)},                                                             // Ĺ to L
 27063  	{FcFrom: uint16(0x013A), FcTo0: uint8(0x6C)},                                                             // ĺ to l
 27064  	{FcFrom: uint16(0x013B), FcTo0: uint8(0x4C)},                                                             // Ļ to L
 27065  	{FcFrom: uint16(0x013C), FcTo0: uint8(0x6C)},                                                             // ļ to l
 27066  	{FcFrom: uint16(0x013D), FcTo0: uint8(0x4C)},                                                             // Ľ to L
 27067  	{FcFrom: uint16(0x013E), FcTo0: uint8(0x6C)},                                                             // ľ to l
 27068  	{FcFrom: uint16(0x013F), FcTo0: uint8(0x4C), FcTo1: uint8(0x2E)},                                         // Ŀ to L.
 27069  	{FcFrom: uint16(0x0140), FcTo0: uint8(0x6C), FcTo1: uint8(0x2E)},                                         // ŀ to l.
 27070  	{FcFrom: uint16(0x0141), FcTo0: uint8(0x4C)},                                                             // Ł to L
 27071  	{FcFrom: uint16(0x0142), FcTo0: uint8(0x6C)},                                                             // ł to l
 27072  	{FcFrom: uint16(0x0143), FcTo0: uint8(0x4E)},                                                             // Ń to N
 27073  	{FcFrom: uint16(0x0144), FcTo0: uint8(0x6E)},                                                             // ń to n
 27074  	{FcFrom: uint16(0x0145), FcTo0: uint8(0x4E)},                                                             // Ņ to N
 27075  	{FcFrom: uint16(0x0146), FcTo0: uint8(0x6E)},                                                             // ņ to n
 27076  	{FcFrom: uint16(0x0147), FcTo0: uint8(0x4E)},                                                             // Ň to N
 27077  	{FcFrom: uint16(0x0148), FcTo0: uint8(0x6E)},                                                             // ň to n
 27078  	{FcFrom: uint16(0x0149), FcTo0: uint8(0x27), FcTo1: uint8(0x6E)},                                         // ʼn to 'n
 27079  	{FcFrom: uint16(0x014A), FcTo0: uint8(0x4E), FcTo1: uint8(0x47)},                                         // Ŋ to NG
 27080  	{FcFrom: uint16(0x014B), FcTo0: uint8(0x6E), FcTo1: uint8(0x67)},                                         // ŋ to ng
 27081  	{FcFrom: uint16(0x014C), FcTo0: uint8(0x4F)},                                                             // Ō to O
 27082  	{FcFrom: uint16(0x014D), FcTo0: uint8(0x6F)},                                                             // ō to o
 27083  	{FcFrom: uint16(0x014E), FcTo0: uint8(0x4F)},                                                             // Ŏ to O
 27084  	{FcFrom: uint16(0x014F), FcTo0: uint8(0x6F)},                                                             // ŏ to o
 27085  	{FcFrom: uint16(0x0150), FcTo0: uint8(0x4F)},                                                             // Ő to O
 27086  	{FcFrom: uint16(0x0151), FcTo0: uint8(0x6F)},                                                             // ő to o
 27087  	{FcFrom: uint16(0x0152), FcTo0: uint8(0x4F), FcTo1: uint8(0x45)},                                         // Œ to OE
 27088  	{FcFrom: uint16(0x0153), FcTo0: uint8(0x6F), FcTo1: uint8(0x65)},                                         // œ to oe
 27089  	{FcFrom: uint16(0x0154), FcTo0: uint8(0x52)},                                                             // Ŕ to R
 27090  	{FcFrom: uint16(0x0155), FcTo0: uint8(0x72)},                                                             // ŕ to r
 27091  	{FcFrom: uint16(0x0156), FcTo0: uint8(0x52)},                                                             // Ŗ to R
 27092  	{FcFrom: uint16(0x0157), FcTo0: uint8(0x72)},                                                             // ŗ to r
 27093  	{FcFrom: uint16(0x0158), FcTo0: uint8(0x52)},                                                             // Ř to R
 27094  	{FcFrom: uint16(0x0159), FcTo0: uint8(0x72)},                                                             // ř to r
 27095  	{FcFrom: uint16(0x015A), FcTo0: uint8(0x53)},                                                             // Ś to S
 27096  	{FcFrom: uint16(0x015B), FcTo0: uint8(0x73)},                                                             // ś to s
 27097  	{FcFrom: uint16(0x015C), FcTo0: uint8(0x53), FcTo1: uint8(0x68)},                                         // Ŝ to Sh
 27098  	{FcFrom: uint16(0x015D), FcTo0: uint8(0x73), FcTo1: uint8(0x68)},                                         // ŝ to sh
 27099  	{FcFrom: uint16(0x015E), FcTo0: uint8(0x53)},                                                             // Ş to S
 27100  	{FcFrom: uint16(0x015F), FcTo0: uint8(0x73)},                                                             // ş to s
 27101  	{FcFrom: uint16(0x0160), FcTo0: uint8(0x53)},                                                             // Š to S
 27102  	{FcFrom: uint16(0x0161), FcTo0: uint8(0x73)},                                                             // š to s
 27103  	{FcFrom: uint16(0x0162), FcTo0: uint8(0x54)},                                                             // Ţ to T
 27104  	{FcFrom: uint16(0x0163), FcTo0: uint8(0x74)},                                                             // ţ to t
 27105  	{FcFrom: uint16(0x0164), FcTo0: uint8(0x54)},                                                             // Ť to T
 27106  	{FcFrom: uint16(0x0165), FcTo0: uint8(0x74)},                                                             // ť to t
 27107  	{FcFrom: uint16(0x0166), FcTo0: uint8(0x54)},                                                             // Ŧ to T
 27108  	{FcFrom: uint16(0x0167), FcTo0: uint8(0x74)},                                                             // ŧ to t
 27109  	{FcFrom: uint16(0x0168), FcTo0: uint8(0x55)},                                                             // Ũ to U
 27110  	{FcFrom: uint16(0x0169), FcTo0: uint8(0x75)},                                                             // ũ to u
 27111  	{FcFrom: uint16(0x016A), FcTo0: uint8(0x55)},                                                             // Ū to U
 27112  	{FcFrom: uint16(0x016B), FcTo0: uint8(0x75)},                                                             // ū to u
 27113  	{FcFrom: uint16(0x016C), FcTo0: uint8(0x55)},                                                             // Ŭ to U
 27114  	{FcFrom: uint16(0x016D), FcTo0: uint8(0x75)},                                                             // ŭ to u
 27115  	{FcFrom: uint16(0x016E), FcTo0: uint8(0x55)},                                                             // Ů to U
 27116  	{FcFrom: uint16(0x016F), FcTo0: uint8(0x75)},                                                             // ů to u
 27117  	{FcFrom: uint16(0x0170), FcTo0: uint8(0x55)},                                                             // Ű to U
 27118  	{FcFrom: uint16(0x0171), FcTo0: uint8(0x75)},                                                             // ű to u
 27119  	{FcFrom: uint16(0x0172), FcTo0: uint8(0x55)},                                                             // Ų to U
 27120  	{FcFrom: uint16(0x0173), FcTo0: uint8(0x75)},                                                             // ų to u
 27121  	{FcFrom: uint16(0x0174), FcTo0: uint8(0x57)},                                                             // Ŵ to W
 27122  	{FcFrom: uint16(0x0175), FcTo0: uint8(0x77)},                                                             // ŵ to w
 27123  	{FcFrom: uint16(0x0176), FcTo0: uint8(0x59)},                                                             // Ŷ to Y
 27124  	{FcFrom: uint16(0x0177), FcTo0: uint8(0x79)},                                                             // ŷ to y
 27125  	{FcFrom: uint16(0x0178), FcTo0: uint8(0x59)},                                                             // Ÿ to Y
 27126  	{FcFrom: uint16(0x0179), FcTo0: uint8(0x5A)},                                                             // Ź to Z
 27127  	{FcFrom: uint16(0x017A), FcTo0: uint8(0x7A)},                                                             // ź to z
 27128  	{FcFrom: uint16(0x017B), FcTo0: uint8(0x5A)},                                                             // Ż to Z
 27129  	{FcFrom: uint16(0x017C), FcTo0: uint8(0x7A)},                                                             // ż to z
 27130  	{FcFrom: uint16(0x017D), FcTo0: uint8(0x5A)},                                                             // Ž to Z
 27131  	{FcFrom: uint16(0x017E), FcTo0: uint8(0x7A)},                                                             // ž to z
 27132  	{FcFrom: uint16(0x017F), FcTo0: uint8(0x73)},                                                             // ſ to s
 27133  	{FcFrom: uint16(0x0192), FcTo0: uint8(0x66)},                                                             // ƒ to f
 27134  	{FcFrom: uint16(0x0218), FcTo0: uint8(0x53)},                                                             // Ș to S
 27135  	{FcFrom: uint16(0x0219), FcTo0: uint8(0x73)},                                                             // ș to s
 27136  	{FcFrom: uint16(0x021A), FcTo0: uint8(0x54)},                                                             // Ț to T
 27137  	{FcFrom: uint16(0x021B), FcTo0: uint8(0x74)},                                                             // ț to t
 27138  	{FcFrom: uint16(0x0386), FcTo0: uint8(0x41)},                                                             // Ά to A
 27139  	{FcFrom: uint16(0x0388), FcTo0: uint8(0x45)},                                                             // Έ to E
 27140  	{FcFrom: uint16(0x0389), FcTo0: uint8(0x49)},                                                             // Ή to I
 27141  	{FcFrom: uint16(0x038A), FcTo0: uint8(0x49)},                                                             // Ί to I
 27142  	{FcFrom: uint16(0x038C), FcTo0: uint8(0x4f)},                                                             // Ό to O
 27143  	{FcFrom: uint16(0x038E), FcTo0: uint8(0x59)},                                                             // Ύ to Y
 27144  	{FcFrom: uint16(0x038F), FcTo0: uint8(0x4f)},                                                             // Ώ to O
 27145  	{FcFrom: uint16(0x0390), FcTo0: uint8(0x69)},                                                             // ΐ to i
 27146  	{FcFrom: uint16(0x0391), FcTo0: uint8(0x41)},                                                             // Α to A
 27147  	{FcFrom: uint16(0x0392), FcTo0: uint8(0x42)},                                                             // Β to B
 27148  	{FcFrom: uint16(0x0393), FcTo0: uint8(0x47)},                                                             // Γ to G
 27149  	{FcFrom: uint16(0x0394), FcTo0: uint8(0x44)},                                                             // Δ to D
 27150  	{FcFrom: uint16(0x0395), FcTo0: uint8(0x45)},                                                             // Ε to E
 27151  	{FcFrom: uint16(0x0396), FcTo0: uint8(0x5a)},                                                             // Ζ to Z
 27152  	{FcFrom: uint16(0x0397), FcTo0: uint8(0x49)},                                                             // Η to I
 27153  	{FcFrom: uint16(0x0398), FcTo0: uint8(0x54), FcTo1: uint8(0x68)},                                         // Θ to Th
 27154  	{FcFrom: uint16(0x0399), FcTo0: uint8(0x49)},                                                             // Ι to I
 27155  	{FcFrom: uint16(0x039A), FcTo0: uint8(0x4b)},                                                             // Κ to K
 27156  	{FcFrom: uint16(0x039B), FcTo0: uint8(0x4c)},                                                             // Λ to L
 27157  	{FcFrom: uint16(0x039C), FcTo0: uint8(0x4d)},                                                             // Μ to M
 27158  	{FcFrom: uint16(0x039D), FcTo0: uint8(0x4e)},                                                             // Ν to N
 27159  	{FcFrom: uint16(0x039E), FcTo0: uint8(0x58)},                                                             // Ξ to X
 27160  	{FcFrom: uint16(0x039F), FcTo0: uint8(0x4f)},                                                             // Ο to O
 27161  	{FcFrom: uint16(0x03A0), FcTo0: uint8(0x50)},                                                             // Π to P
 27162  	{FcFrom: uint16(0x03A1), FcTo0: uint8(0x52)},                                                             // Ρ to R
 27163  	{FcFrom: uint16(0x03A3), FcTo0: uint8(0x53)},                                                             // Σ to S
 27164  	{FcFrom: uint16(0x03A4), FcTo0: uint8(0x54)},                                                             // Τ to T
 27165  	{FcFrom: uint16(0x03A5), FcTo0: uint8(0x59)},                                                             // Υ to Y
 27166  	{FcFrom: uint16(0x03A6), FcTo0: uint8(0x46)},                                                             // Φ to F
 27167  	{FcFrom: uint16(0x03A7), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Χ to Ch
 27168  	{FcFrom: uint16(0x03A8), FcTo0: uint8(0x50), FcTo1: uint8(0x73)},                                         // Ψ to Ps
 27169  	{FcFrom: uint16(0x03A9), FcTo0: uint8(0x4f)},                                                             // Ω to O
 27170  	{FcFrom: uint16(0x03AA), FcTo0: uint8(0x49)},                                                             // Ϊ to I
 27171  	{FcFrom: uint16(0x03AB), FcTo0: uint8(0x59)},                                                             // Ϋ to Y
 27172  	{FcFrom: uint16(0x03AC), FcTo0: uint8(0x61)},                                                             // ά to a
 27173  	{FcFrom: uint16(0x03AD), FcTo0: uint8(0x65)},                                                             // έ to e
 27174  	{FcFrom: uint16(0x03AE), FcTo0: uint8(0x69)},                                                             // ή to i
 27175  	{FcFrom: uint16(0x03AF), FcTo0: uint8(0x69)},                                                             // ί to i
 27176  	{FcFrom: uint16(0x03B1), FcTo0: uint8(0x61)},                                                             // α to a
 27177  	{FcFrom: uint16(0x03B2), FcTo0: uint8(0x62)},                                                             // β to b
 27178  	{FcFrom: uint16(0x03B3), FcTo0: uint8(0x67)},                                                             // γ to g
 27179  	{FcFrom: uint16(0x03B4), FcTo0: uint8(0x64)},                                                             // δ to d
 27180  	{FcFrom: uint16(0x03B5), FcTo0: uint8(0x65)},                                                             // ε to e
 27181  	{FcFrom: uint16(0x03B6), FcTo0: uint8(0x7a)},                                                             // ζ to z
 27182  	{FcFrom: uint16(0x03B7), FcTo0: uint8(0x69)},                                                             // η to i
 27183  	{FcFrom: uint16(0x03B8), FcTo0: uint8(0x74), FcTo1: uint8(0x68)},                                         // θ to th
 27184  	{FcFrom: uint16(0x03B9), FcTo0: uint8(0x69)},                                                             // ι to i
 27185  	{FcFrom: uint16(0x03BA), FcTo0: uint8(0x6b)},                                                             // κ to k
 27186  	{FcFrom: uint16(0x03BB), FcTo0: uint8(0x6c)},                                                             // λ to l
 27187  	{FcFrom: uint16(0x03BC), FcTo0: uint8(0x6d)},                                                             // μ to m
 27188  	{FcFrom: uint16(0x03BD), FcTo0: uint8(0x6e)},                                                             // ν to n
 27189  	{FcFrom: uint16(0x03BE), FcTo0: uint8(0x78)},                                                             // ξ to x
 27190  	{FcFrom: uint16(0x03BF), FcTo0: uint8(0x6f)},                                                             // ο to o
 27191  	{FcFrom: uint16(0x03C0), FcTo0: uint8(0x70)},                                                             // π to p
 27192  	{FcFrom: uint16(0x03C1), FcTo0: uint8(0x72)},                                                             // ρ to r
 27193  	{FcFrom: uint16(0x03C3), FcTo0: uint8(0x73)},                                                             // σ to s
 27194  	{FcFrom: uint16(0x03C4), FcTo0: uint8(0x74)},                                                             // τ to t
 27195  	{FcFrom: uint16(0x03C5), FcTo0: uint8(0x79)},                                                             // υ to y
 27196  	{FcFrom: uint16(0x03C6), FcTo0: uint8(0x66)},                                                             // φ to f
 27197  	{FcFrom: uint16(0x03C7), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // χ to ch
 27198  	{FcFrom: uint16(0x03C8), FcTo0: uint8(0x70), FcTo1: uint8(0x73)},                                         // ψ to ps
 27199  	{FcFrom: uint16(0x03C9), FcTo0: uint8(0x6f)},                                                             // ω to o
 27200  	{FcFrom: uint16(0x03CA), FcTo0: uint8(0x69)},                                                             // ϊ to i
 27201  	{FcFrom: uint16(0x03CB), FcTo0: uint8(0x79)},                                                             // ϋ to y
 27202  	{FcFrom: uint16(0x03CC), FcTo0: uint8(0x6f)},                                                             // ό to o
 27203  	{FcFrom: uint16(0x03CD), FcTo0: uint8(0x79)},                                                             // ύ to y
 27204  	{FcFrom: uint16(0x03CE), FcTo0: uint8(0x69)},                                                             // ώ to i
 27205  	{FcFrom: uint16(0x0400), FcTo0: uint8(0x45)},                                                             // Ѐ to E
 27206  	{FcFrom: uint16(0x0401), FcTo0: uint8(0x45)},                                                             // Ё to E
 27207  	{FcFrom: uint16(0x0402), FcTo0: uint8(0x44)},                                                             // Ђ to D
 27208  	{FcFrom: uint16(0x0403), FcTo0: uint8(0x47)},                                                             // Ѓ to G
 27209  	{FcFrom: uint16(0x0404), FcTo0: uint8(0x45)},                                                             // Є to E
 27210  	{FcFrom: uint16(0x0405), FcTo0: uint8(0x5a)},                                                             // Ѕ to Z
 27211  	{FcFrom: uint16(0x0406), FcTo0: uint8(0x49)},                                                             // І to I
 27212  	{FcFrom: uint16(0x0407), FcTo0: uint8(0x49)},                                                             // Ї to I
 27213  	{FcFrom: uint16(0x0408), FcTo0: uint8(0x4a)},                                                             // Ј to J
 27214  	{FcFrom: uint16(0x0409), FcTo0: uint8(0x49)},                                                             // Љ to I
 27215  	{FcFrom: uint16(0x040A), FcTo0: uint8(0x4e)},                                                             // Њ to N
 27216  	{FcFrom: uint16(0x040B), FcTo0: uint8(0x44)},                                                             // Ћ to D
 27217  	{FcFrom: uint16(0x040C), FcTo0: uint8(0x4b)},                                                             // Ќ to K
 27218  	{FcFrom: uint16(0x040D), FcTo0: uint8(0x49)},                                                             // Ѝ to I
 27219  	{FcFrom: uint16(0x040E), FcTo0: uint8(0x55)},                                                             // Ў to U
 27220  	{FcFrom: uint16(0x040F), FcTo0: uint8(0x44)},                                                             // Џ to D
 27221  	{FcFrom: uint16(0x0410), FcTo0: uint8(0x41)},                                                             // А to A
 27222  	{FcFrom: uint16(0x0411), FcTo0: uint8(0x42)},                                                             // Б to B
 27223  	{FcFrom: uint16(0x0412), FcTo0: uint8(0x56)},                                                             // В to V
 27224  	{FcFrom: uint16(0x0413), FcTo0: uint8(0x47)},                                                             // Г to G
 27225  	{FcFrom: uint16(0x0414), FcTo0: uint8(0x44)},                                                             // Д to D
 27226  	{FcFrom: uint16(0x0415), FcTo0: uint8(0x45)},                                                             // Е to E
 27227  	{FcFrom: uint16(0x0416), FcTo0: uint8(0x5a), FcTo1: uint8(0x68)},                                         // Ж to Zh
 27228  	{FcFrom: uint16(0x0417), FcTo0: uint8(0x5a)},                                                             // З to Z
 27229  	{FcFrom: uint16(0x0418), FcTo0: uint8(0x49)},                                                             // И to I
 27230  	{FcFrom: uint16(0x0419), FcTo0: uint8(0x49)},                                                             // Й to I
 27231  	{FcFrom: uint16(0x041A), FcTo0: uint8(0x4b)},                                                             // К to K
 27232  	{FcFrom: uint16(0x041B), FcTo0: uint8(0x4c)},                                                             // Л to L
 27233  	{FcFrom: uint16(0x041C), FcTo0: uint8(0x4d)},                                                             // М to M
 27234  	{FcFrom: uint16(0x041D), FcTo0: uint8(0x4e)},                                                             // Н to N
 27235  	{FcFrom: uint16(0x041E), FcTo0: uint8(0x4f)},                                                             // О to O
 27236  	{FcFrom: uint16(0x041F), FcTo0: uint8(0x50)},                                                             // П to P
 27237  	{FcFrom: uint16(0x0420), FcTo0: uint8(0x52)},                                                             // Р to R
 27238  	{FcFrom: uint16(0x0421), FcTo0: uint8(0x53)},                                                             // С to S
 27239  	{FcFrom: uint16(0x0422), FcTo0: uint8(0x54)},                                                             // Т to T
 27240  	{FcFrom: uint16(0x0423), FcTo0: uint8(0x55)},                                                             // У to U
 27241  	{FcFrom: uint16(0x0424), FcTo0: uint8(0x46)},                                                             // Ф to F
 27242  	{FcFrom: uint16(0x0425), FcTo0: uint8(0x4b), FcTo1: uint8(0x68)},                                         // Х to Kh
 27243  	{FcFrom: uint16(0x0426), FcTo0: uint8(0x54), FcTo1: uint8(0x63)},                                         // Ц to Tc
 27244  	{FcFrom: uint16(0x0427), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Ч to Ch
 27245  	{FcFrom: uint16(0x0428), FcTo0: uint8(0x53), FcTo1: uint8(0x68)},                                         // Ш to Sh
 27246  	{FcFrom: uint16(0x0429), FcTo0: uint8(0x53), FcTo1: uint8(0x68), FcTo2: uint8(0x63), FcTo3: uint8(0x68)}, // Щ to Shch
 27247  	{FcFrom: uint16(0x042A), FcTo0: uint8(0x61)},                                                             //  to A
 27248  	{FcFrom: uint16(0x042B), FcTo0: uint8(0x59)},                                                             // Ы to Y
 27249  	{FcFrom: uint16(0x042C), FcTo0: uint8(0x59)},                                                             //  to Y
 27250  	{FcFrom: uint16(0x042D), FcTo0: uint8(0x45)},                                                             // Э to E
 27251  	{FcFrom: uint16(0x042E), FcTo0: uint8(0x49), FcTo1: uint8(0x75)},                                         // Ю to Iu
 27252  	{FcFrom: uint16(0x042F), FcTo0: uint8(0x49), FcTo1: uint8(0x61)},                                         // Я to Ia
 27253  	{FcFrom: uint16(0x0430), FcTo0: uint8(0x61)},                                                             // а to a
 27254  	{FcFrom: uint16(0x0431), FcTo0: uint8(0x62)},                                                             // б to b
 27255  	{FcFrom: uint16(0x0432), FcTo0: uint8(0x76)},                                                             // в to v
 27256  	{FcFrom: uint16(0x0433), FcTo0: uint8(0x67)},                                                             // г to g
 27257  	{FcFrom: uint16(0x0434), FcTo0: uint8(0x64)},                                                             // д to d
 27258  	{FcFrom: uint16(0x0435), FcTo0: uint8(0x65)},                                                             // е to e
 27259  	{FcFrom: uint16(0x0436), FcTo0: uint8(0x7a), FcTo1: uint8(0x68)},                                         // ж to zh
 27260  	{FcFrom: uint16(0x0437), FcTo0: uint8(0x7a)},                                                             // з to z
 27261  	{FcFrom: uint16(0x0438), FcTo0: uint8(0x69)},                                                             // и to i
 27262  	{FcFrom: uint16(0x0439), FcTo0: uint8(0x69)},                                                             // й to i
 27263  	{FcFrom: uint16(0x043A), FcTo0: uint8(0x6b)},                                                             // к to k
 27264  	{FcFrom: uint16(0x043B), FcTo0: uint8(0x6c)},                                                             // л to l
 27265  	{FcFrom: uint16(0x043C), FcTo0: uint8(0x6d)},                                                             // м to m
 27266  	{FcFrom: uint16(0x043D), FcTo0: uint8(0x6e)},                                                             // н to n
 27267  	{FcFrom: uint16(0x043E), FcTo0: uint8(0x6f)},                                                             // о to o
 27268  	{FcFrom: uint16(0x043F), FcTo0: uint8(0x70)},                                                             // п to p
 27269  	{FcFrom: uint16(0x0440), FcTo0: uint8(0x72)},                                                             // р to r
 27270  	{FcFrom: uint16(0x0441), FcTo0: uint8(0x73)},                                                             // с to s
 27271  	{FcFrom: uint16(0x0442), FcTo0: uint8(0x74)},                                                             // т to t
 27272  	{FcFrom: uint16(0x0443), FcTo0: uint8(0x75)},                                                             // у to u
 27273  	{FcFrom: uint16(0x0444), FcTo0: uint8(0x66)},                                                             // ф to f
 27274  	{FcFrom: uint16(0x0445), FcTo0: uint8(0x6b), FcTo1: uint8(0x68)},                                         // х to kh
 27275  	{FcFrom: uint16(0x0446), FcTo0: uint8(0x74), FcTo1: uint8(0x63)},                                         // ц to tc
 27276  	{FcFrom: uint16(0x0447), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // ч to ch
 27277  	{FcFrom: uint16(0x0448), FcTo0: uint8(0x73), FcTo1: uint8(0x68)},                                         // ш to sh
 27278  	{FcFrom: uint16(0x0449), FcTo0: uint8(0x73), FcTo1: uint8(0x68), FcTo2: uint8(0x63), FcTo3: uint8(0x68)}, // щ to shch
 27279  	{FcFrom: uint16(0x044A), FcTo0: uint8(0x61)},                                                             //  to a
 27280  	{FcFrom: uint16(0x044B), FcTo0: uint8(0x79)},                                                             // ы to y
 27281  	{FcFrom: uint16(0x044C), FcTo0: uint8(0x79)},                                                             //  to y
 27282  	{FcFrom: uint16(0x044D), FcTo0: uint8(0x65)},                                                             // э to e
 27283  	{FcFrom: uint16(0x044E), FcTo0: uint8(0x69), FcTo1: uint8(0x75)},                                         // ю to iu
 27284  	{FcFrom: uint16(0x044F), FcTo0: uint8(0x69), FcTo1: uint8(0x61)},                                         // я to ia
 27285  	{FcFrom: uint16(0x0450), FcTo0: uint8(0x65)},                                                             // ѐ to e
 27286  	{FcFrom: uint16(0x0451), FcTo0: uint8(0x65)},                                                             // ё to e
 27287  	{FcFrom: uint16(0x0452), FcTo0: uint8(0x64)},                                                             // ђ to d
 27288  	{FcFrom: uint16(0x0453), FcTo0: uint8(0x67)},                                                             // ѓ to g
 27289  	{FcFrom: uint16(0x0454), FcTo0: uint8(0x65)},                                                             // є to e
 27290  	{FcFrom: uint16(0x0455), FcTo0: uint8(0x7a)},                                                             // ѕ to z
 27291  	{FcFrom: uint16(0x0456), FcTo0: uint8(0x69)},                                                             // і to i
 27292  	{FcFrom: uint16(0x0457), FcTo0: uint8(0x69)},                                                             // ї to i
 27293  	{FcFrom: uint16(0x0458), FcTo0: uint8(0x6a)},                                                             // ј to j
 27294  	{FcFrom: uint16(0x0459), FcTo0: uint8(0x69)},                                                             // љ to i
 27295  	{FcFrom: uint16(0x045A), FcTo0: uint8(0x6e)},                                                             // њ to n
 27296  	{FcFrom: uint16(0x045B), FcTo0: uint8(0x64)},                                                             // ћ to d
 27297  	{FcFrom: uint16(0x045C), FcTo0: uint8(0x6b)},                                                             // ќ to k
 27298  	{FcFrom: uint16(0x045D), FcTo0: uint8(0x69)},                                                             // ѝ to i
 27299  	{FcFrom: uint16(0x045E), FcTo0: uint8(0x75)},                                                             // ў to u
 27300  	{FcFrom: uint16(0x045F), FcTo0: uint8(0x64)},                                                             // џ to d
 27301  	{FcFrom: uint16(0x1E02), FcTo0: uint8(0x42)},                                                             // Ḃ to B
 27302  	{FcFrom: uint16(0x1E03), FcTo0: uint8(0x62)},                                                             // ḃ to b
 27303  	{FcFrom: uint16(0x1E0A), FcTo0: uint8(0x44)},                                                             // Ḋ to D
 27304  	{FcFrom: uint16(0x1E0B), FcTo0: uint8(0x64)},                                                             // ḋ to d
 27305  	{FcFrom: uint16(0x1E1E), FcTo0: uint8(0x46)},                                                             // Ḟ to F
 27306  	{FcFrom: uint16(0x1E1F), FcTo0: uint8(0x66)},                                                             // ḟ to f
 27307  	{FcFrom: uint16(0x1E40), FcTo0: uint8(0x4D)},                                                             // Ṁ to M
 27308  	{FcFrom: uint16(0x1E41), FcTo0: uint8(0x6D)},                                                             // ṁ to m
 27309  	{FcFrom: uint16(0x1E56), FcTo0: uint8(0x50)},                                                             // Ṗ to P
 27310  	{FcFrom: uint16(0x1E57), FcTo0: uint8(0x70)},                                                             // ṗ to p
 27311  	{FcFrom: uint16(0x1E60), FcTo0: uint8(0x53)},                                                             // Ṡ to S
 27312  	{FcFrom: uint16(0x1E61), FcTo0: uint8(0x73)},                                                             // ṡ to s
 27313  	{FcFrom: uint16(0x1E6A), FcTo0: uint8(0x54)},                                                             // Ṫ to T
 27314  	{FcFrom: uint16(0x1E6B), FcTo0: uint8(0x74)},                                                             // ṫ to t
 27315  	{FcFrom: uint16(0x1E80), FcTo0: uint8(0x57)},                                                             // Ẁ to W
 27316  	{FcFrom: uint16(0x1E81), FcTo0: uint8(0x77)},                                                             // ẁ to w
 27317  	{FcFrom: uint16(0x1E82), FcTo0: uint8(0x57)},                                                             // Ẃ to W
 27318  	{FcFrom: uint16(0x1E83), FcTo0: uint8(0x77)},                                                             // ẃ to w
 27319  	{FcFrom: uint16(0x1E84), FcTo0: uint8(0x57)},                                                             // Ẅ to W
 27320  	{FcFrom: uint16(0x1E85), FcTo0: uint8(0x77)},                                                             // ẅ to w
 27321  	{FcFrom: uint16(0x1EF2), FcTo0: uint8(0x59)},                                                             // Ỳ to Y
 27322  	{FcFrom: uint16(0x1EF3), FcTo0: uint8(0x79)},                                                             // ỳ to y
 27323  	{FcFrom: uint16(0xFB00), FcTo0: uint8(0x66), FcTo1: uint8(0x66)},                                         // ff to ff
 27324  	{FcFrom: uint16(0xFB01), FcTo0: uint8(0x66), FcTo1: uint8(0x69)},                                         // fi to fi
 27325  	{FcFrom: uint16(0xFB02), FcTo0: uint8(0x66), FcTo1: uint8(0x6C)},                                         // fl to fl
 27326  	{FcFrom: uint16(0xFB05), FcTo0: uint8(0x73), FcTo1: uint8(0x74)},                                         // ſt to st
 27327  	{FcFrom: uint16(0xFB06), FcTo0: uint8(0x73), FcTo1: uint8(0x74)},                                         // st to st
 27328  } /* spellfix.c:1306:30 */
 27329  
 27330  func spellfixFindTranslit(tls *libc.TLS, c int32, pxTop uintptr) uintptr { /* spellfix.c:1698:30: */
 27331  	*(*int32)(unsafe.Pointer(pxTop)) = (int32((uint64(unsafe.Sizeof(translit)) / uint64(unsafe.Sizeof(Transliteration{}))) - uint64(1)))
 27332  	return uintptr(unsafe.Pointer(&translit))
 27333  }
 27334  
 27335  // Convert the input string from UTF-8 into pure ASCII by converting
 27336  // all non-ASCII characters to some combination of characters in the
 27337  // ASCII subset.
 27338  //
 27339  // The returned string might contain more characters than the input.
 27340  //
 27341  // Space to hold the returned string comes from sqlite3_malloc() and
 27342  // should be freed by the caller.
 27343  func transliterate(tls *libc.TLS, zIn uintptr, nIn int32) uintptr { /* spellfix.c:1713:22: */
 27344  	bp := tls.Alloc(8)
 27345  	defer tls.Free(8)
 27346  
 27347  	var zOut uintptr = sqlite3.Xsqlite3_malloc64(tls, (uint64((nIn * 4) + 1)))
 27348  	var c int32
 27349  	// var sz int32 at bp, 4
 27350  
 27351  	var nOut int32
 27352  	if zOut == uintptr(0) {
 27353  		return uintptr(0)
 27354  	}
 27355  	nOut = 0
 27356  	for nIn > 0 {
 27357  		c = utf8Read(tls, zIn, nIn, bp /* &sz */)
 27358  		zIn += uintptr(*(*int32)(unsafe.Pointer(bp /* sz */)))
 27359  		nIn = nIn - (*(*int32)(unsafe.Pointer(bp /* sz */)))
 27360  		if c <= 127 {
 27361  			*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = uint8(c)
 27362  		} else {
 27363  			// var xTop int32 at bp+4, 4
 27364  
 27365  			var xBtm int32
 27366  			var x int32
 27367  			var tbl uintptr = spellfixFindTranslit(tls, c, bp+4 /* &xTop */)
 27368  			xBtm = 0
 27369  			for *(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) >= xBtm {
 27370  				x = ((*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) + xBtm) / 2)
 27371  				if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) == c {
 27372  					*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo0
 27373  					if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo1 != 0 {
 27374  						*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo1
 27375  						if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo2 != 0 {
 27376  							*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo2
 27377  							if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo3 != 0 {
 27378  								*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo3
 27379  							}
 27380  						}
 27381  					}
 27382  					c = 0
 27383  					break
 27384  				} else if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) > c {
 27385  					*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) = (x - 1)
 27386  				} else {
 27387  					xBtm = (x + 1)
 27388  				}
 27389  			}
 27390  			if c != 0 {
 27391  				*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = uint8('?')
 27392  			}
 27393  		}
 27394  	}
 27395  	*(*uint8)(unsafe.Pointer(zOut + uintptr(nOut))) = uint8(0)
 27396  	return zOut
 27397  }
 27398  
 27399  // Return the number of characters in the shortest prefix of the input
 27400  // string that transliterates to an ASCII string nTrans bytes or longer.
 27401  // Or, if the transliteration of the input string is less than nTrans
 27402  // bytes in size, return the number of characters in the input string.
 27403  func translen_to_charlen(tls *libc.TLS, zIn uintptr, nIn int32, nTrans int32) int32 { /* spellfix.c:1771:12: */
 27404  	bp := tls.Alloc(8)
 27405  	defer tls.Free(8)
 27406  
 27407  	var i int32
 27408  	var c int32
 27409  	// var sz int32 at bp, 4
 27410  
 27411  	var nOut int32
 27412  	var nChar int32
 27413  
 27414  	i = libc.AssignInt32(&nOut, 0)
 27415  	for nChar = 0; (i < nIn) && (nOut < nTrans); nChar++ {
 27416  		c = utf8Read(tls, (zIn + uintptr(i)), (nIn - i), bp /* &sz */)
 27417  		i = i + (*(*int32)(unsafe.Pointer(bp /* sz */)))
 27418  
 27419  		nOut++
 27420  		if c >= 128 {
 27421  			// var xTop int32 at bp+4, 4
 27422  
 27423  			var xBtm int32
 27424  			var x int32
 27425  			var tbl uintptr = spellfixFindTranslit(tls, c, bp+4 /* &xTop */)
 27426  			xBtm = 0
 27427  			for *(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) >= xBtm {
 27428  				x = ((*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) + xBtm) / 2)
 27429  				if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) == c {
 27430  					if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo1 != 0 {
 27431  						nOut++
 27432  						if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo2 != 0 {
 27433  							nOut++
 27434  							if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo3 != 0 {
 27435  								nOut++
 27436  							}
 27437  						}
 27438  					}
 27439  					break
 27440  				} else if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) > c {
 27441  					*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) = (x - 1)
 27442  				} else {
 27443  					xBtm = (x + 1)
 27444  				}
 27445  			}
 27446  		}
 27447  	}
 27448  
 27449  	return nChar
 27450  }
 27451  
 27452  //    spellfix1_translit(X)
 27453  //
 27454  // Convert a string that contains non-ASCII Roman characters into
 27455  // pure ASCII.
 27456  func transliterateSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1817:13: */
 27457  	var zIn uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 27458  	var nIn int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 27459  	var zOut uintptr = transliterate(tls, zIn, nIn)
 27460  	if zOut == uintptr(0) {
 27461  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 27462  	} else {
 27463  		sqlite3.Xsqlite3_result_text(tls, context, zOut, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 27464  	}
 27465  }
 27466  
 27467  //    spellfix1_scriptcode(X)
 27468  //
 27469  // Try to determine the dominant script used by the word X and return
 27470  // its ISO 15924 numeric code.
 27471  //
 27472  // The current implementation only understands the following scripts:
 27473  //
 27474  //    215  (Latin)
 27475  //    220  (Cyrillic)
 27476  //    200  (Greek)
 27477  //
 27478  // This routine will return 998 if the input X contains characters from
 27479  // two or more of the above scripts or 999 if X contains no characters
 27480  // from any of the above scripts.
 27481  func scriptCodeSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1848:13: */
 27482  	bp := tls.Alloc(4)
 27483  	defer tls.Free(4)
 27484  
 27485  	var zIn uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 27486  	var nIn int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 27487  	var c int32
 27488  	// var sz int32 at bp, 4
 27489  
 27490  	var scriptMask int32 = 0
 27491  	var res int32
 27492  	var seenDigit int32 = 0
 27493  
 27494  	for nIn > 0 {
 27495  		c = utf8Read(tls, zIn, nIn, bp /* &sz */)
 27496  		zIn += uintptr(*(*int32)(unsafe.Pointer(bp /* sz */)))
 27497  		nIn = nIn - (*(*int32)(unsafe.Pointer(bp /* sz */)))
 27498  		if c < 0x02af {
 27499  			if (c >= 0x80) || (int32(midClass[(c&0x7f)]) < CCLASS_DIGIT) {
 27500  				scriptMask = scriptMask | (SCRIPT_LATIN)
 27501  			} else if (c >= '0') && (c <= '9') {
 27502  				seenDigit = 1
 27503  			}
 27504  		} else if (c >= 0x0400) && (c <= 0x04ff) {
 27505  			scriptMask = scriptMask | (SCRIPT_CYRILLIC)
 27506  		} else if (c >= 0x0386) && (c <= 0x03ce) {
 27507  			scriptMask = scriptMask | (SCRIPT_GREEK)
 27508  		} else if (c >= 0x0590) && (c <= 0x05ff) {
 27509  			scriptMask = scriptMask | (SCRIPT_HEBREW)
 27510  		} else if (c >= 0x0600) && (c <= 0x06ff) {
 27511  			scriptMask = scriptMask | (SCRIPT_ARABIC)
 27512  		}
 27513  	}
 27514  	if (scriptMask == 0) && (seenDigit != 0) {
 27515  		scriptMask = SCRIPT_LATIN
 27516  	}
 27517  	switch scriptMask {
 27518  	case 0:
 27519  		res = 999
 27520  		break
 27521  	case SCRIPT_LATIN:
 27522  		res = 215
 27523  		break
 27524  	case SCRIPT_CYRILLIC:
 27525  		res = 220
 27526  		break
 27527  	case SCRIPT_GREEK:
 27528  		res = 200
 27529  		break
 27530  	case SCRIPT_HEBREW:
 27531  		res = 125
 27532  		break
 27533  	case SCRIPT_ARABIC:
 27534  		res = 160
 27535  		break
 27536  	default:
 27537  		res = 998
 27538  		break
 27539  	}
 27540  	sqlite3.Xsqlite3_result_int(tls, context, res)
 27541  }
 27542  
 27543  // End transliterate
 27544  //
 27545  //
 27546  // Begin spellfix1 virtual table.
 27547  
 27548  // Maximum length of a phonehash used for querying the shadow table
 27549  
 27550  // Maximum number of hash strings to examine per query
 27551  
 27552  type spellfix1_vtab1 = struct {
 27553  	Fbase       sqlite3_vtab
 27554  	Fdb         uintptr
 27555  	FzDbName    uintptr
 27556  	FzTableName uintptr
 27557  	FzCostTable uintptr
 27558  	FpConfig3   uintptr
 27559  } /* spellfix.c:1910:9 */
 27560  
 27561  // End transliterate
 27562  //
 27563  //
 27564  // Begin spellfix1 virtual table.
 27565  
 27566  // Maximum length of a phonehash used for querying the shadow table
 27567  
 27568  // Maximum number of hash strings to examine per query
 27569  
 27570  type spellfix1_vtab = spellfix1_vtab1 /* spellfix.c:1910:31 */
 27571  type spellfix1_cursor1 = struct {
 27572  	Fbase      sqlite3_vtab_cursor
 27573  	FpVTab     uintptr
 27574  	FzPattern  uintptr
 27575  	FidxNum    int32
 27576  	FnRow      int32
 27577  	FnAlloc    int32
 27578  	FiRow      int32
 27579  	FiLang     int32
 27580  	FiTop      int32
 27581  	FiScope    int32
 27582  	FnSearch   int32
 27583  	FpFullScan uintptr
 27584  	Fa         uintptr
 27585  } /* spellfix.c:1911:9 */
 27586  
 27587  type spellfix1_cursor = spellfix1_cursor1 /* spellfix.c:1911:33 */
 27588  
 27589  // Fuzzy-search cursor object
 27590  type spellfix1_row = struct {
 27591  	FiRowid    sqlite3_int64
 27592  	FzWord     uintptr
 27593  	FiRank     int32
 27594  	FiDistance int32
 27595  	FiScore    int32
 27596  	FiMatchlen int32
 27597  	FzHash     [32]int8
 27598  } /* spellfix.c:1911:9 */
 27599  
 27600  // Construct one or more SQL statements from the format string given
 27601  // and then evaluate those statements. The success code is written
 27602  // into *pRc.
 27603  //
 27604  // If *pRc is initially non-zero then this routine is a no-op.
 27605  func spellfix1DbExec(tls *libc.TLS, pRc uintptr, db uintptr, zFormat uintptr, va uintptr) { /* spellfix.c:1955:13: */
 27606  	var ap va_list
 27607  	_ = ap
 27608  	var zSql uintptr
 27609  	if *(*int32)(unsafe.Pointer(pRc)) != 0 {
 27610  		return
 27611  	}
 27612  	ap = va
 27613  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
 27614  	_ = ap
 27615  	if zSql == uintptr(0) {
 27616  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 27617  	} else {
 27618  		*(*int32)(unsafe.Pointer(pRc)) = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 27619  		sqlite3.Xsqlite3_free(tls, zSql)
 27620  	}
 27621  }
 27622  
 27623  // xDisconnect/xDestroy method for the fuzzy-search module.
 27624  func spellfix1Uninit(tls *libc.TLS, isDestroy int32, pVTab uintptr) int32 { /* spellfix.c:1978:12: */
 27625  	bp := tls.Alloc(20)
 27626  	defer tls.Free(20)
 27627  
 27628  	var p uintptr = pVTab
 27629  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK
 27630  	if isDestroy != 0 {
 27631  		var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 27632  		spellfix1DbExec(tls, bp+16 /* &rc */, db, ts+6635, /* "DROP TABLE IF EX..." */
 27633  			libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName))
 27634  	}
 27635  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
 27636  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName)
 27637  		editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 27638  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 27639  		sqlite3.Xsqlite3_free(tls, p)
 27640  	}
 27641  	return *(*int32)(unsafe.Pointer(bp + 16 /* rc */))
 27642  }
 27643  
 27644  func spellfix1Disconnect(tls *libc.TLS, pVTab uintptr) int32 { /* spellfix.c:1994:12: */
 27645  	return spellfix1Uninit(tls, 0, pVTab)
 27646  }
 27647  
 27648  func spellfix1Destroy(tls *libc.TLS, pVTab uintptr) int32 { /* spellfix.c:1997:12: */
 27649  	return spellfix1Uninit(tls, 1, pVTab)
 27650  }
 27651  
 27652  // Make a copy of a string.  Remove leading and trailing whitespace
 27653  // and dequote it.
 27654  func spellfix1Dequote(tls *libc.TLS, zIn uintptr) uintptr { /* spellfix.c:2005:13: */
 27655  	bp := tls.Alloc(8)
 27656  	defer tls.Free(8)
 27657  
 27658  	var zOut uintptr
 27659  	var i int32
 27660  	var j int32
 27661  	var c int8
 27662  	for __sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zIn)))), uint64(X_CTYPE_S)) != 0 {
 27663  		zIn++
 27664  	}
 27665  	zOut = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zIn))
 27666  	if zOut == uintptr(0) {
 27667  		return uintptr(0)
 27668  	}
 27669  	i = int32(libc.Xstrlen(tls, zOut))
 27670  	*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = int8(0)
 27671  	c = *(*int8)(unsafe.Pointer(zOut))
 27672  	if (int32(c) == '\'') || (int32(c) == '"') {
 27673  		i = 1
 27674  		j = 0
 27675  		for ; 1 != 0; i++ {
 27676  			*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(zOut + uintptr(i)))
 27677  			if int32(*(*int8)(unsafe.Pointer(zOut + uintptr(i)))) == int32(c) {
 27678  				if int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 1))))) == int32(c) {
 27679  					i++
 27680  				} else {
 27681  					*(*int8)(unsafe.Pointer(zOut + uintptr((j - 1)))) = int8(0)
 27682  					break
 27683  				}
 27684  			}
 27685  		}
 27686  	}
 27687  	return zOut
 27688  }
 27689  
 27690  // xConnect/xCreate method for the spellfix1 module. Arguments are:
 27691  //
 27692  //   argv[0]   -> module name  ("spellfix1")
 27693  //   argv[1]   -> database name
 27694  //   argv[2]   -> table name
 27695  //   argv[3].. -> optional arguments (i.e. "edit_cost_table" parameter)
 27696  func spellfix1Init(tls *libc.TLS, isCreate int32, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2043:12: */
 27697  	bp := tls.Alloc(60)
 27698  	defer tls.Free(60)
 27699  
 27700  	var pNew uintptr = uintptr(0)
 27701  	// const char *zModule = argv[0]; // not used
 27702  	var zDbName uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 27703  	var zTableName uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*8))
 27704  	var nDbName int32
 27705  	*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_OK
 27706  	var i int32
 27707  
 27708  	nDbName = int32(libc.Xstrlen(tls, zDbName))
 27709  	pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint64(unsafe.Sizeof(spellfix1_vtab{})) + uint64(nDbName)) + uint64(1))))
 27710  	if pNew == uintptr(0) {
 27711  		*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 27712  	} else {
 27713  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(spellfix1_vtab{})))
 27714  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzDbName = (pNew + 1*64)
 27715  		libc.Xmemcpy(tls, (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzDbName, zDbName, (uint64(nDbName + 1)))
 27716  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zTableName))
 27717  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).Fdb = db
 27718  		if (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzTableName == uintptr(0) {
 27719  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 27720  		} else {
 27721  			sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 27722  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db,
 27723  
 27724  				ts+6672 /* "CREATE TABLE x(w..." */)
 27725  		}
 27726  		if (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK) && (isCreate != 0) {
 27727  			spellfix1DbExec(tls, bp+56 /* &rc */, db,
 27728  
 27729  				ts+6826, /* "CREATE TABLE IF ..." */
 27730  				libc.VaList(bp+8, zDbName, zTableName))
 27731  			spellfix1DbExec(tls, bp+56 /* &rc */, db,
 27732  
 27733  				ts+6960, /* "CREATE INDEX IF ..." */
 27734  				libc.VaList(bp+24, zDbName, zTableName, zTableName))
 27735  		}
 27736  		for i = 3; (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK) && (i < argc); i++ {
 27737  			if (libc.Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ts+7045 /* "edit_cost_table=" */, uint64(16)) == 0) && ((*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable == uintptr(0)) {
 27738  				(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable = spellfix1Dequote(tls, (*(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) + 16))
 27739  				if (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable == uintptr(0) {
 27740  					*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 27741  				}
 27742  				continue
 27743  			}
 27744  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7062 /* "bad argument to ..." */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 27745  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_ERROR
 27746  		}
 27747  	}
 27748  
 27749  	if (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) != 0) && (pNew != 0) {
 27750  		*(*uintptr)(unsafe.Pointer(ppVTab)) = uintptr(0)
 27751  		spellfix1Uninit(tls, 0, (pNew /* &.base */))
 27752  	} else {
 27753  		*(*uintptr)(unsafe.Pointer(ppVTab)) = pNew
 27754  	}
 27755  	return *(*int32)(unsafe.Pointer(bp + 56 /* rc */))
 27756  }
 27757  
 27758  // The xConnect and xCreate methods
 27759  func spellfix1Connect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2133:12: */
 27760  	return spellfix1Init(tls, 0, db, pAux, argc, argv, ppVTab, pzErr)
 27761  }
 27762  
 27763  func spellfix1Create(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2142:12: */
 27764  	return spellfix1Init(tls, 1, db, pAux, argc, argv, ppVTab, pzErr)
 27765  }
 27766  
 27767  // Clear all of the content from a cursor.
 27768  func spellfix1ResetCursor(tls *libc.TLS, pCur uintptr) { /* spellfix.c:2155:13: */
 27769  	var i int32
 27770  	for i = 0; i < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow; i++ {
 27771  		sqlite3.Xsqlite3_free(tls, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(i)*64)).FzWord)
 27772  	}
 27773  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow = 0
 27774  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = 0
 27775  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch = 0
 27776  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 27777  		sqlite3.Xsqlite3_finalize(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 27778  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan = uintptr(0)
 27779  	}
 27780  }
 27781  
 27782  // Resize the cursor to hold up to N rows of content
 27783  func spellfix1ResizeCursor(tls *libc.TLS, pCur uintptr, N int32) { /* spellfix.c:2172:13: */
 27784  	var aNew uintptr
 27785  
 27786  	aNew = sqlite3.Xsqlite3_realloc64(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa, (uint64(uint64(unsafe.Sizeof(spellfix1_row{})) * uint64(N))))
 27787  	if (aNew == uintptr(0)) && (N > 0) {
 27788  		spellfix1ResetCursor(tls, pCur)
 27789  		sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa)
 27790  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc = 0
 27791  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa = uintptr(0)
 27792  	} else {
 27793  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc = N
 27794  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa = aNew
 27795  	}
 27796  }
 27797  
 27798  // Close a fuzzy-search cursor.
 27799  func spellfix1Close(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2191:12: */
 27800  	var pCur uintptr = cur
 27801  	spellfix1ResetCursor(tls, pCur)
 27802  	spellfix1ResizeCursor(tls, pCur, 0)
 27803  	sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern)
 27804  	sqlite3.Xsqlite3_free(tls, pCur)
 27805  	return SQLITE_OK
 27806  }
 27807  
 27808  //
 27809  // The plan number is a bitmask of the SPELLFIX_IDXNUM_* values defined
 27810  // above.
 27811  //
 27812  // filter.argv[*] values contains $str, $langid, $top, $scope and $rowid
 27813  // if specified and in that order.
 27814  func spellfix1BestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* spellfix.c:2217:12: */
 27815  	var iPlan int32 = 0
 27816  	var iLangTerm int32 = -1
 27817  	var iTopTerm int32 = -1
 27818  	var iScopeTerm int32 = -1
 27819  	var iDistTerm int32 = -1
 27820  	var iRowidTerm int32 = -1
 27821  	var i int32
 27822  	var pConstraint uintptr
 27823  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 27824  	i = 0
 27825  __1:
 27826  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 27827  		goto __3
 27828  	}
 27829  	{
 27830  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 27831  			goto __2
 27832  		}
 27833  
 27834  		// Terms of the form:  word MATCH $str
 27835  		if (((iPlan & SPELLFIX_IDXNUM_MATCH) == 0) &&
 27836  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_WORD)) &&
 27837  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 27838  			iPlan = iPlan | (SPELLFIX_IDXNUM_MATCH)
 27839  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 27840  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 27841  		}
 27842  
 27843  		// Terms of the form:  langid = $langid
 27844  		if (((iPlan & SPELLFIX_IDXNUM_LANGID) == 0) &&
 27845  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_LANGID)) &&
 27846  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 27847  			iPlan = iPlan | (SPELLFIX_IDXNUM_LANGID)
 27848  			iLangTerm = i
 27849  		}
 27850  
 27851  		// Terms of the form:  top = $top
 27852  		if (((iPlan & SPELLFIX_IDXNUM_TOP) == 0) &&
 27853  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_TOP)) &&
 27854  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 27855  			iPlan = iPlan | (SPELLFIX_IDXNUM_TOP)
 27856  			iTopTerm = i
 27857  		}
 27858  
 27859  		// Terms of the form:  scope = $scope
 27860  		if (((iPlan & SPELLFIX_IDXNUM_SCOPE) == 0) &&
 27861  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_SCOPE)) &&
 27862  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 27863  			iPlan = iPlan | (SPELLFIX_IDXNUM_SCOPE)
 27864  			iScopeTerm = i
 27865  		}
 27866  
 27867  		// Terms of the form:  distance < $dist or distance <= $dist
 27868  		if (((iPlan & (0x10 | 0x20)) == 0) &&
 27869  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_DISTANCE)) &&
 27870  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 27871  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 27872  			if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT {
 27873  				iPlan = iPlan | (SPELLFIX_IDXNUM_DISTLT)
 27874  			} else {
 27875  				iPlan = iPlan | (SPELLFIX_IDXNUM_DISTLE)
 27876  			}
 27877  			iDistTerm = i
 27878  		}
 27879  
 27880  		// Terms of the form:  distance < $dist or distance <= $dist
 27881  		if (((iPlan & SPELLFIX_IDXNUM_ROWID) == 0) &&
 27882  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < 0)) &&
 27883  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 27884  			iPlan = iPlan | (SPELLFIX_IDXNUM_ROWID)
 27885  			iRowidTerm = i
 27886  		}
 27887  
 27888  	}
 27889  	goto __2
 27890  __2:
 27891  	i++
 27892  	pConstraint += 12
 27893  	goto __1
 27894  	goto __3
 27895  __3:
 27896  	;
 27897  	if (iPlan & SPELLFIX_IDXNUM_MATCH) != 0 {
 27898  		var idx int32 = 2
 27899  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 27900  		if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 27901  			((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == SPELLFIX_COL_SCORE)) &&
 27902  			(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 27903  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1 // Default order by iScore
 27904  		}
 27905  		if (iPlan & SPELLFIX_IDXNUM_LANGID) != 0 {
 27906  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 27907  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).Fomit = uint8(1)
 27908  		}
 27909  		if (iPlan & SPELLFIX_IDXNUM_TOP) != 0 {
 27910  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iTopTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 27911  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iTopTerm)*8)).Fomit = uint8(1)
 27912  		}
 27913  		if (iPlan & SPELLFIX_IDXNUM_SCOPE) != 0 {
 27914  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iScopeTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 27915  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iScopeTerm)*8)).Fomit = uint8(1)
 27916  		}
 27917  		if (iPlan & (0x10 | 0x20)) != 0 {
 27918  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 27919  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).Fomit = uint8(1)
 27920  		}
 27921  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e5
 27922  	} else if (iPlan & SPELLFIX_IDXNUM_ROWID) != 0 {
 27923  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = SPELLFIX_IDXNUM_ROWID
 27924  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1
 27925  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1)
 27926  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(5)
 27927  	} else {
 27928  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 27929  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e50
 27930  	}
 27931  	return SQLITE_OK
 27932  }
 27933  
 27934  // Open a new fuzzy-search cursor.
 27935  func spellfix1Open(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* spellfix.c:2331:12: */
 27936  	var p uintptr = pVTab
 27937  	var pCur uintptr
 27938  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(spellfix1_cursor{})))
 27939  	if pCur == uintptr(0) {
 27940  		return SQLITE_NOMEM
 27941  	}
 27942  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(spellfix1_cursor{})))
 27943  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab = p
 27944  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 27945  	return SQLITE_OK
 27946  }
 27947  
 27948  // Adjust a distance measurement by the words rank in order to show
 27949  // preference to common words.
 27950  func spellfix1Score(tls *libc.TLS, iDistance int32, iRank int32) int32 { /* spellfix.c:2346:12: */
 27951  	var iLog2 int32
 27952  	iLog2 = 0
 27953  __1:
 27954  	if !(iRank > 0) {
 27955  		goto __3
 27956  	}
 27957  	{
 27958  	}
 27959  	goto __2
 27960  __2:
 27961  	iLog2++
 27962  	iRank >>= 1
 27963  	goto __1
 27964  	goto __3
 27965  __3:
 27966  	;
 27967  	return ((iDistance + 32) - iLog2)
 27968  }
 27969  
 27970  // Compare two spellfix1_row objects for sorting purposes in qsort() such
 27971  // that they sort in order of increasing distance.
 27972  func spellfix1RowCompare(tls *libc.TLS, A uintptr, B uintptr) int32 { /* spellfix.c:2356:25: */
 27973  	var a uintptr = A
 27974  	var b uintptr = B
 27975  	return ((*spellfix1_row)(unsafe.Pointer(a)).FiScore - (*spellfix1_row)(unsafe.Pointer(b)).FiScore)
 27976  }
 27977  
 27978  // A structure used to pass information from spellfix1FilterForMatch()
 27979  // into spellfix1RunQuery().
 27980  type MatchQuery1 = struct {
 27981  	FpCur       uintptr
 27982  	FpStmt      uintptr
 27983  	FzHash      [32]int8
 27984  	FzPattern   uintptr
 27985  	FnPattern   int32
 27986  	_           [4]byte
 27987  	FpMatchStr3 uintptr
 27988  	FpConfig3   uintptr
 27989  	FpLang      uintptr
 27990  	FiLang      int32
 27991  	FiScope     int32
 27992  	FiMaxDist   int32
 27993  	Frc         int32
 27994  	FnRun       int32
 27995  	FazPrior    [1][32]int8
 27996  	_           [4]byte
 27997  } /* spellfix.c:2366:9 */
 27998  
 27999  // A structure used to pass information from spellfix1FilterForMatch()
 28000  // into spellfix1RunQuery().
 28001  type MatchQuery = MatchQuery1 /* spellfix.c:2381:3 */
 28002  
 28003  // Run a query looking for the best matches against zPattern using
 28004  // zHash as the character class seed hash.
 28005  func spellfix1RunQuery(tls *libc.TLS, p uintptr, zQuery uintptr, nQuery int32) { /* spellfix.c:2387:13: */
 28006  	bp := tls.Alloc(76)
 28007  	defer tls.Free(76)
 28008  
 28009  	var zK1 uintptr
 28010  	var zWord uintptr
 28011  	var iDist int32
 28012  	var iRank int32
 28013  	var iScore int32
 28014  	var iWorst int32 = 0
 28015  	var idx int32
 28016  	var idxWorst int32 = -1
 28017  	var i int32
 28018  	var iScope int32 = (*MatchQuery)(unsafe.Pointer(p)).FiScope
 28019  	var pCur uintptr = (*MatchQuery)(unsafe.Pointer(p)).FpCur
 28020  	var pStmt uintptr = (*MatchQuery)(unsafe.Pointer(p)).FpStmt
 28021  	// var zHash1 [32]int8 at bp+8, 32
 28022  
 28023  	// var zHash2 [32]int8 at bp+40, 32
 28024  
 28025  	var zClass uintptr
 28026  	var nClass int32
 28027  	var rc int32
 28028  
 28029  	if ((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa == uintptr(0)) || ((*MatchQuery)(unsafe.Pointer(p)).Frc != 0) {
 28030  		return
 28031  	} // Prior memory allocation failure
 28032  	zClass = phoneticHash(tls, zQuery, nQuery)
 28033  	if zClass == uintptr(0) {
 28034  		(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 28035  		return
 28036  	}
 28037  	nClass = int32(libc.Xstrlen(tls, zClass))
 28038  	if nClass > (SPELLFIX_MX_HASH - 2) {
 28039  		nClass = (SPELLFIX_MX_HASH - 2)
 28040  		*(*int8)(unsafe.Pointer(zClass + uintptr(nClass))) = int8(0)
 28041  	}
 28042  	if nClass <= iScope {
 28043  		if nClass > 2 {
 28044  			iScope = (nClass - 1)
 28045  		} else {
 28046  			iScope = nClass
 28047  		}
 28048  	}
 28049  	libc.Xmemcpy(tls, bp+8 /* &zHash1[0] */, zClass, uint64(iScope))
 28050  	sqlite3.Xsqlite3_free(tls, zClass)
 28051  	*(*int8)(unsafe.Pointer(bp + 8 /* &zHash1[0] */ + uintptr(iScope))) = int8(0)
 28052  	libc.Xmemcpy(tls, bp+40 /* &zHash2[0] */, bp+8 /* &zHash1[0] */, uint64(iScope))
 28053  	*(*int8)(unsafe.Pointer(bp + 40 /* &zHash2[0] */ + uintptr(iScope))) = int8('Z')
 28054  	*(*int8)(unsafe.Pointer(bp + 40 /* &zHash2[0] */ + uintptr((iScope + 1)))) = int8(0)
 28055  
 28056  	libc.Xmemcpy(tls, ((p + 108 /* &.azPrior */) + uintptr(libc.PostIncInt32(&(*MatchQuery)(unsafe.Pointer(p)).FnRun, 1))*32), bp+8 /* &zHash1[0] */, (uint64(iScope + 1)))
 28057  	if (sqlite3.Xsqlite3_bind_text(tls, pStmt, 1, bp+8 /* &zHash1[0] */, -1, uintptr(0)) == SQLITE_NOMEM) ||
 28058  		(sqlite3.Xsqlite3_bind_text(tls, pStmt, 2, bp+40 /* &zHash2[0] */, -1, uintptr(0)) == SQLITE_NOMEM) {
 28059  		(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 28060  		return
 28061  	}
 28062  	for sqlite3.Xsqlite3_step(tls, pStmt) == SQLITE_ROW {
 28063  		*(*int32)(unsafe.Pointer(bp + 72 /* iMatchlen */)) = -1
 28064  		iRank = sqlite3.Xsqlite3_column_int(tls, pStmt, 2)
 28065  		if (*MatchQuery)(unsafe.Pointer(p)).FpMatchStr3 != 0 {
 28066  			var nWord int32 = sqlite3.Xsqlite3_column_bytes(tls, pStmt, 1)
 28067  			zWord = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 28068  			iDist = editDist3Core(tls, (*MatchQuery)(unsafe.Pointer(p)).FpMatchStr3, zWord, nWord, (*MatchQuery)(unsafe.Pointer(p)).FpLang, bp+72 /* &iMatchlen */)
 28069  		} else {
 28070  			zK1 = sqlite3.Xsqlite3_column_text(tls, pStmt, 3)
 28071  			if zK1 == uintptr(0) {
 28072  				continue
 28073  			}
 28074  			iDist = editdist1(tls, (*MatchQuery)(unsafe.Pointer(p)).FzPattern, zK1, uintptr(0))
 28075  		}
 28076  		if iDist < 0 {
 28077  			(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 28078  			break
 28079  		}
 28080  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch++
 28081  
 28082  		// If there is a "distance < $dist" or "distance <= $dist" constraint,
 28083  		// check if this row meets it. If not, jump back up to the top of the
 28084  		// loop to process the next row. Otherwise, if the row does match the
 28085  		// distance constraint, check if the pCur->a[] array is already full.
 28086  		// If it is and no explicit "top = ?" constraint was present in the
 28087  		// query, grow the array to ensure there is room for the new entry.
 28088  
 28089  		if (*MatchQuery)(unsafe.Pointer(p)).FiMaxDist >= 0 {
 28090  			if iDist > (*MatchQuery)(unsafe.Pointer(p)).FiMaxDist {
 28091  				continue
 28092  			}
 28093  			if ((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow >= (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc) && (((*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum & SPELLFIX_IDXNUM_TOP) == 0) {
 28094  				spellfix1ResizeCursor(tls, pCur, (((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc * 2) + 10))
 28095  				if (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa == uintptr(0) {
 28096  					break
 28097  				}
 28098  			}
 28099  		}
 28100  
 28101  		iScore = spellfix1Score(tls, iDist, iRank)
 28102  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 28103  			idx = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow
 28104  		} else if iScore < iWorst {
 28105  			idx = idxWorst
 28106  			sqlite3.Xsqlite3_free(tls, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64)).FzWord)
 28107  		} else {
 28108  			continue
 28109  		}
 28110  
 28111  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FzWord = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_column_text(tls, pStmt, 1)))
 28112  		if (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64)).FzWord == uintptr(0) {
 28113  			(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 28114  			break
 28115  		}
 28116  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiRowid = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 28117  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiRank = iRank
 28118  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiDistance = iDist
 28119  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiScore = iScore
 28120  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiMatchlen = *(*int32)(unsafe.Pointer(bp + 72 /* iMatchlen */))
 28121  		libc.Xmemcpy(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64+32 /* &.zHash */, bp+8 /* &zHash1[0] */, (uint64(iScope + 1)))
 28122  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 28123  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow++
 28124  		}
 28125  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow == (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 28126  			iWorst = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa)).FiScore
 28127  			idxWorst = 0
 28128  			for i = 1; i < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow; i++ {
 28129  				iScore = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(i)*64)).FiScore
 28130  				if iWorst < iScore {
 28131  					iWorst = iScore
 28132  					idxWorst = i
 28133  				}
 28134  			}
 28135  		}
 28136  	}
 28137  	rc = sqlite3.Xsqlite3_reset(tls, pStmt)
 28138  	if rc != 0 {
 28139  		(*MatchQuery)(unsafe.Pointer(p)).Frc = rc
 28140  	}
 28141  }
 28142  
 28143  // This version of the xFilter method work if the MATCH term is present
 28144  // and we are doing a scan.
 28145  func spellfix1FilterForMatch(tls *libc.TLS, pCur uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2526:12: */
 28146  	bp := tls.Alloc(176)
 28147  	defer tls.Free(176)
 28148  
 28149  	var idxNum int32
 28150  	var zMatchThis uintptr // RHS of the MATCH operator
 28151  	var pMatchStr3 uintptr // zMatchThis as an editdist string
 28152  	var zPattern uintptr   // Transliteration of zMatchThis
 28153  	var nPattern int32     // Length of zPattern
 28154  	var iLimit int32       // Max number of rows of output
 28155  	var iScope int32       // Use this many characters of zClass
 28156  	var iLang int32        // Language code
 28157  	var zSql uintptr       // SQL of shadow table query
 28158  	// var pStmt uintptr at bp+168, 8
 28159  	// Shadow table query
 28160  	var rc int32  // Result code
 28161  	var idx int32 // Next available filter parameter
 28162  	var p uintptr // The virtual table that owns pCur
 28163  	// var x MatchQuery at bp+24, 144
 28164  	idxNum = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum
 28165  	pMatchStr3 = uintptr(0)
 28166  	iLimit = 20
 28167  	iScope = 3
 28168  	iLang = 0
 28169  	*(*uintptr)(unsafe.Pointer(bp + 168 /* pStmt */)) = uintptr(0)
 28170  	idx = 1
 28171  	p = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab // For passing info to RunQuery()
 28172  
 28173  	// Load the cost table if we have not already done so
 28174  	if !(((*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable != uintptr(0)) && ((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 == uintptr(0))) {
 28175  		goto __1
 28176  	}
 28177  	(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(EditDist3Config{})))
 28178  	if !((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 == uintptr(0)) {
 28179  		goto __2
 28180  	}
 28181  	return SQLITE_NOMEM
 28182  __2:
 28183  	;
 28184  	libc.Xmemset(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, 0, uint64(unsafe.Sizeof(EditDist3Config{})))
 28185  	rc = editDist3ConfigLoad(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 28186  	if !(rc != 0) {
 28187  		goto __3
 28188  	}
 28189  	return rc
 28190  __3:
 28191  	;
 28192  __1:
 28193  	;
 28194  	libc.Xmemset(tls, bp+24 /* &x */, 0, uint64(unsafe.Sizeof(MatchQuery{})))
 28195  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = 3    // Default scope if none specified by "WHERE scope=N"
 28196  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = -1 // Maximum allowed edit distance
 28197  
 28198  	if !((idxNum & 2) != 0) {
 28199  		goto __4
 28200  	}
 28201  	iLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*8)))
 28202  __4:
 28203  	;
 28204  	if !((idxNum & 4) != 0) {
 28205  		goto __5
 28206  	}
 28207  	iLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*8)))
 28208  	if !(iLimit < 1) {
 28209  		goto __6
 28210  	}
 28211  	iLimit = 1
 28212  __6:
 28213  	;
 28214  __5:
 28215  	;
 28216  	if !((idxNum & 8) != 0) {
 28217  		goto __7
 28218  	}
 28219  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*8)))
 28220  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiScope < 1) {
 28221  		goto __8
 28222  	}
 28223  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = 1
 28224  __8:
 28225  	;
 28226  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiScope > (SPELLFIX_MX_HASH - 2)) {
 28227  		goto __9
 28228  	}
 28229  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = (SPELLFIX_MX_HASH - 2)
 28230  __9:
 28231  	;
 28232  __7:
 28233  	;
 28234  	if !((idxNum & (16 | 32)) != 0) {
 28235  		goto __10
 28236  	}
 28237  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*8)))
 28238  	if !((idxNum & 16) != 0) {
 28239  		goto __11
 28240  	}
 28241  	(*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiMaxDist--
 28242  __11:
 28243  	;
 28244  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiMaxDist < 0) {
 28245  		goto __12
 28246  	}
 28247  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = 0
 28248  __12:
 28249  	;
 28250  __10:
 28251  	;
 28252  	spellfix1ResetCursor(tls, pCur)
 28253  	spellfix1ResizeCursor(tls, pCur, iLimit)
 28254  	zMatchThis = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28255  	if !(zMatchThis == uintptr(0)) {
 28256  		goto __13
 28257  	}
 28258  	return SQLITE_OK
 28259  __13:
 28260  	;
 28261  	if !((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 != 0) {
 28262  		goto __14
 28263  	}
 28264  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpLang = editDist3FindLang(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, iLang)
 28265  	pMatchStr3 = editDist3FromStringNew(tls, (*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FpLang, zMatchThis, -1)
 28266  	if !(pMatchStr3 == uintptr(0)) {
 28267  		goto __16
 28268  	}
 28269  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 28270  	goto filter_exit
 28271  __16:
 28272  	;
 28273  	goto __15
 28274  __14:
 28275  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpLang = uintptr(0)
 28276  __15:
 28277  	;
 28278  	zPattern = transliterate(tls, zMatchThis, sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))))
 28279  	sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern)
 28280  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern = zPattern
 28281  	if !(zPattern == uintptr(0)) {
 28282  		goto __17
 28283  	}
 28284  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 28285  	goto filter_exit
 28286  __17:
 28287  	;
 28288  	nPattern = int32(libc.Xstrlen(tls, zPattern))
 28289  	if !(int32(*(*int8)(unsafe.Pointer(zPattern + uintptr((nPattern - 1))))) == '*') {
 28290  		goto __18
 28291  	}
 28292  	nPattern--
 28293  __18:
 28294  	;
 28295  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 28296  
 28297  		ts+7096, /* "SELECT id, word,..." */
 28298  		libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, iLang))
 28299  	if !(zSql == uintptr(0)) {
 28300  		goto __19
 28301  	}
 28302  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 28303  	*(*uintptr)(unsafe.Pointer(bp + 168 /* pStmt */)) = uintptr(0)
 28304  	goto filter_exit
 28305  __19:
 28306  	;
 28307  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb, zSql, -1, bp+168 /* &pStmt */, uintptr(0))
 28308  	sqlite3.Xsqlite3_free(tls, zSql)
 28309  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiLang = iLang
 28310  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpCur = pCur
 28311  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 168 /* pStmt */))
 28312  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FzPattern = zPattern
 28313  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FnPattern = nPattern
 28314  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpMatchStr3 = pMatchStr3
 28315  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiLang = iLang
 28316  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = rc
 28317  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpConfig3 = (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3
 28318  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).Frc == SQLITE_OK) {
 28319  		goto __20
 28320  	}
 28321  	spellfix1RunQuery(tls, bp+24 /* &x */, zPattern, nPattern)
 28322  __20:
 28323  	;
 28324  
 28325  	if !((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa != 0) {
 28326  		goto __21
 28327  	}
 28328  	libc.Xqsort(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa, uint64((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow), uint64(unsafe.Sizeof(spellfix1_row{})), *(*uintptr)(unsafe.Pointer(&struct {
 28329  		f func(*libc.TLS, uintptr, uintptr) int32
 28330  	}{spellfix1RowCompare})))
 28331  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiTop = iLimit
 28332  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiScope = iScope
 28333  	goto __22
 28334  __21:
 28335  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 28336  __22:
 28337  	;
 28338  
 28339  filter_exit:
 28340  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 168 /* pStmt */)))
 28341  	editDist3FromStringDelete(tls, pMatchStr3)
 28342  	return (*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc
 28343  }
 28344  
 28345  // This version of xFilter handles a full-table scan case
 28346  func spellfix1FilterForFullScan(tls *libc.TLS, pCur uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2641:12: */
 28347  	bp := tls.Alloc(24)
 28348  	defer tls.Free(24)
 28349  
 28350  	var rc int32 = SQLITE_OK
 28351  	var idxNum int32 = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum
 28352  	var zSql uintptr
 28353  	var pVTab uintptr = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab
 28354  	spellfix1ResetCursor(tls, pCur)
 28355  
 28356  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 28357  		ts+7196, /* "SELECT word, ran..." */
 28358  		libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).FzTableName,
 28359  			func() uintptr {
 28360  				if (idxNum & 64) != 0 {
 28361  					return ts + 7255 /* " WHERE rowid=?" */
 28362  				}
 28363  				return ts + 489 /* "" */
 28364  			}()))
 28365  	if zSql == uintptr(0) {
 28366  		return SQLITE_NOMEM
 28367  	}
 28368  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).Fdb, zSql, -1, (pCur + 56 /* &.pFullScan */), uintptr(0))
 28369  	sqlite3.Xsqlite3_free(tls, zSql)
 28370  	if (rc == SQLITE_OK) && ((idxNum & 64) != 0) {
 28371  
 28372  		rc = sqlite3.Xsqlite3_bind_value(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, 1, *(*uintptr)(unsafe.Pointer(argv)))
 28373  	}
 28374  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow = libc.AssignPtrInt32(pCur+36 /* &.iRow */, 0)
 28375  	if rc == SQLITE_OK {
 28376  		rc = sqlite3.Xsqlite3_step(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 28377  		if rc == SQLITE_ROW {
 28378  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = -1
 28379  			rc = SQLITE_OK
 28380  		}
 28381  		if rc == SQLITE_DONE {
 28382  			rc = SQLITE_OK
 28383  		}
 28384  	} else {
 28385  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = 0
 28386  	}
 28387  	return rc
 28388  }
 28389  
 28390  // Called to "rewind" a cursor back to the beginning so that
 28391  // it starts its output over again.  Always called at least once
 28392  // prior to any spellfix1Column, spellfix1Rowid, or spellfix1Eof call.
 28393  func spellfix1Filter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2681:12: */
 28394  	var pCur uintptr = cur
 28395  	var rc int32
 28396  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum = idxNum
 28397  	if (idxNum & 1) != 0 {
 28398  		rc = spellfix1FilterForMatch(tls, pCur, argc, argv)
 28399  	} else {
 28400  		rc = spellfix1FilterForFullScan(tls, pCur, argc, argv)
 28401  	}
 28402  	return rc
 28403  }
 28404  
 28405  // Advance a cursor to its next row of output
 28406  func spellfix1Next(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2701:12: */
 28407  	var pCur uintptr = cur
 28408  	var rc int32 = SQLITE_OK
 28409  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow {
 28410  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 28411  			rc = sqlite3.Xsqlite3_step(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 28412  			if rc != SQLITE_ROW {
 28413  				(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow
 28414  			}
 28415  			if (rc == SQLITE_ROW) || (rc == SQLITE_DONE) {
 28416  				rc = SQLITE_OK
 28417  			}
 28418  		} else {
 28419  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow++
 28420  		}
 28421  	}
 28422  	return rc
 28423  }
 28424  
 28425  // Return TRUE if we are at the end-of-file
 28426  func spellfix1Eof(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2719:12: */
 28427  	var pCur uintptr = cur
 28428  	return (libc.Bool32((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow >= (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow))
 28429  }
 28430  
 28431  // Return columns from the current row.
 28432  func spellfix1Column(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* spellfix.c:2727:12: */
 28433  	bp := tls.Alloc(4)
 28434  	defer tls.Free(4)
 28435  
 28436  	var pCur uintptr = cur
 28437  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 28438  		if i <= SPELLFIX_COL_LANGID {
 28439  			sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, i))
 28440  		} else {
 28441  			sqlite3.Xsqlite3_result_null(tls, ctx)
 28442  		}
 28443  		return SQLITE_OK
 28444  	}
 28445  	switch i {
 28446  	case SPELLFIX_COL_WORD:
 28447  		{
 28448  			sqlite3.Xsqlite3_result_text(tls, ctx, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FzWord, -1, uintptr(0))
 28449  			break
 28450  
 28451  		}
 28452  	case SPELLFIX_COL_RANK:
 28453  		{
 28454  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiRank)
 28455  			break
 28456  
 28457  		}
 28458  	case SPELLFIX_COL_DISTANCE:
 28459  		{
 28460  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiDistance)
 28461  			break
 28462  
 28463  		}
 28464  	case SPELLFIX_COL_LANGID:
 28465  		{
 28466  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiLang)
 28467  			break
 28468  
 28469  		}
 28470  	case SPELLFIX_COL_SCORE:
 28471  		{
 28472  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiScore)
 28473  			break
 28474  
 28475  		}
 28476  	case SPELLFIX_COL_MATCHLEN:
 28477  		{
 28478  			*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiMatchlen
 28479  			if *(*int32)(unsafe.Pointer(bp /* iMatchlen */)) < 0 {
 28480  				var nPattern int32 = int32(libc.Xstrlen(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern))
 28481  				var zWord uintptr = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FzWord
 28482  				var nWord int32 = int32(libc.Xstrlen(tls, zWord))
 28483  
 28484  				if (nPattern > 0) && (int32(*(*int8)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern + uintptr((nPattern - 1))))) == '*') {
 28485  					var zTranslit uintptr
 28486  					var res int32
 28487  					zTranslit = transliterate(tls, zWord, nWord)
 28488  					if !(zTranslit != 0) {
 28489  						return SQLITE_NOMEM
 28490  					}
 28491  					res = editdist1(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern, zTranslit, bp /* &iMatchlen */)
 28492  					sqlite3.Xsqlite3_free(tls, zTranslit)
 28493  					if res < 0 {
 28494  						return SQLITE_NOMEM
 28495  					}
 28496  					*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = translen_to_charlen(tls, zWord, nWord, *(*int32)(unsafe.Pointer(bp /* iMatchlen */)))
 28497  				} else {
 28498  					*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = utf8Charlen(tls, zWord, nWord)
 28499  				}
 28500  			}
 28501  
 28502  			sqlite3.Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(bp /* iMatchlen */)))
 28503  			break
 28504  
 28505  		}
 28506  	case SPELLFIX_COL_PHONEHASH:
 28507  		{
 28508  			sqlite3.Xsqlite3_result_text(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64+32 /* &.zHash */, -1, uintptr(0))
 28509  			break
 28510  
 28511  		}
 28512  	case SPELLFIX_COL_TOP:
 28513  		{
 28514  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiTop)
 28515  			break
 28516  
 28517  		}
 28518  	case SPELLFIX_COL_SCOPE:
 28519  		{
 28520  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiScope)
 28521  			break
 28522  
 28523  		}
 28524  	case SPELLFIX_COL_SRCHCNT:
 28525  		{
 28526  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch)
 28527  			break
 28528  
 28529  		}
 28530  	default:
 28531  		{
 28532  			sqlite3.Xsqlite3_result_null(tls, ctx)
 28533  			break
 28534  
 28535  		}
 28536  	}
 28537  	return SQLITE_OK
 28538  }
 28539  
 28540  // The rowid.
 28541  func spellfix1Rowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* spellfix.c:2813:12: */
 28542  	var pCur uintptr = cur
 28543  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 28544  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, 4)
 28545  	} else {
 28546  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiRowid
 28547  	}
 28548  	return SQLITE_OK
 28549  }
 28550  
 28551  // This function is called by the xUpdate() method. It returns a string
 28552  // containing the conflict mode that xUpdate() should use for the current
 28553  // operation. One of: "ROLLBACK", "IGNORE", "ABORT" or "REPLACE".
 28554  func spellfix1GetConflict(tls *libc.TLS, db uintptr) uintptr { /* spellfix.c:2828:19: */
 28555  	var eConflict int32 = sqlite3.Xsqlite3_vtab_on_conflict(tls, db)
 28556  
 28557  	return azConflict[(eConflict - 1)]
 28558  }
 28559  
 28560  var azConflict = [5]uintptr{
 28561  	// Note: Instead of "FAIL" - "ABORT".
 28562  	ts + 7270 /* "ROLLBACK" */, ts + 7279 /* "IGNORE" */, ts + 7286 /* "ABORT" */, ts + 7286 /* "ABORT" */, ts + 7292, /* "REPLACE" */
 28563  } /* spellfix.c:2829:21 */
 28564  
 28565  // The xUpdate() method.
 28566  func spellfix1Update(tls *libc.TLS, pVTab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* spellfix.c:2851:12: */
 28567  	bp := tls.Alloc(284)
 28568  	defer tls.Free(284)
 28569  
 28570  	*(*int32)(unsafe.Pointer(bp + 280 /* rc */)) = SQLITE_OK
 28571  	var rowid sqlite3_int64
 28572  	var newRowid sqlite3_int64
 28573  	var p uintptr = pVTab
 28574  	var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 28575  
 28576  	if argc == 1 {
 28577  		// A delete operation on the rowid given by argv[0]
 28578  		rowid = libc.AssignPtrInt64(pRowid, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 28579  		spellfix1DbExec(tls, bp+280 /* &rc */, db,
 28580  			ts+7300, /* "DELETE FROM \"%w\"..." */
 28581  			libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, rowid))
 28582  	} else {
 28583  		var zWord uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 28584  		var nWord int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 28585  		var iLang int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8)))
 28586  		var iRank int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 28587  		var zSoundslike uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 12*8)))
 28588  		var nSoundslike int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 12*8)))
 28589  		var zK1 uintptr
 28590  		var zK2 uintptr
 28591  		var i int32
 28592  		var c int8
 28593  		var zConflict uintptr = spellfix1GetConflict(tls, db)
 28594  
 28595  		if zWord == uintptr(0) {
 28596  			// Inserts of the form:  INSERT INTO table(command) VALUES('xyzzy');
 28597  			// cause zWord to be NULL, so we look at the "command" column to see
 28598  			// what special actions to take
 28599  			var zCmd uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 13*8)))
 28600  			if zCmd == uintptr(0) {
 28601  				(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+7343, /* "NOT NULL constra..." */
 28602  					libc.VaList(bp+24, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName))
 28603  				return (SQLITE_CONSTRAINT | (int32(5) << 8))
 28604  			}
 28605  			if libc.Xstrcmp(tls, zCmd, ts+7379 /* "reset" */) == 0 {
 28606  				// Reset the  edit cost table (if there is one).
 28607  				editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 28608  				(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = uintptr(0)
 28609  				return SQLITE_OK
 28610  			}
 28611  			if libc.Xstrncmp(tls, zCmd, ts+7045 /* "edit_cost_table=" */, uint64(16)) == 0 {
 28612  				editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 28613  				(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = uintptr(0)
 28614  				sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 28615  				(*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable = spellfix1Dequote(tls, (zCmd + uintptr(16)))
 28616  				if (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable == uintptr(0) {
 28617  					return SQLITE_NOMEM
 28618  				}
 28619  				if (int32(*(*int8)(unsafe.Pointer((*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable))) == 0) || (sqlite3.Xsqlite3_stricmp(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable, ts+7385 /* "null" */) == 0) {
 28620  					sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 28621  					(*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable = uintptr(0)
 28622  				}
 28623  				return SQLITE_OK
 28624  			}
 28625  			(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+7390, /* "unknown value fo..." */
 28626  				libc.VaList(bp+32, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, zCmd))
 28627  			return SQLITE_ERROR
 28628  		}
 28629  		if iRank < 1 {
 28630  			iRank = 1
 28631  		}
 28632  		if zSoundslike != 0 {
 28633  			zK1 = transliterate(tls, zSoundslike, nSoundslike)
 28634  		} else {
 28635  			zK1 = transliterate(tls, zWord, nWord)
 28636  		}
 28637  		if zK1 == uintptr(0) {
 28638  			return SQLITE_NOMEM
 28639  		}
 28640  		for i = 0; (int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zK1 + uintptr(i)))))) != 0; i++ {
 28641  			if (int32(c) >= 'A') && (int32(c) <= 'Z') {
 28642  				*(*int8)(unsafe.Pointer(zK1 + uintptr(i))) += int8(('a' - 'A'))
 28643  			}
 28644  		}
 28645  		zK2 = phoneticHash(tls, zK1, i)
 28646  		if zK2 == uintptr(0) {
 28647  			sqlite3.Xsqlite3_free(tls, zK1)
 28648  			return SQLITE_NOMEM
 28649  		}
 28650  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 28651  			if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == SQLITE_NULL {
 28652  				spellfix1DbExec(tls, bp+280 /* &rc */, db,
 28653  
 28654  					ts+7425, /* "INSERT INTO \"%w\"..." */
 28655  					libc.VaList(bp+48, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName,
 28656  						iRank, iLang, zWord, zK1, zWord, zK2))
 28657  			} else {
 28658  				newRowid = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 28659  				spellfix1DbExec(tls, bp+280 /* &rc */, db,
 28660  
 28661  					ts+7511, /* "INSERT OR %s INT..." */
 28662  					libc.VaList(bp+112, zConflict, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName,
 28663  						newRowid, iRank, iLang, zWord, zK1, zWord, zK2))
 28664  			}
 28665  			*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_last_insert_rowid(tls, db)
 28666  		} else {
 28667  			rowid = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28668  			newRowid = libc.AssignPtrInt64(pRowid, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 28669  			spellfix1DbExec(tls, bp+280 /* &rc */, db,
 28670  
 28671  				ts+7611, /* "UPDATE OR %s \"%w..." */
 28672  				libc.VaList(bp+192, zConflict, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, newRowid, iRank, iLang,
 28673  					zWord, zK1, zWord, zK2, rowid))
 28674  		}
 28675  		sqlite3.Xsqlite3_free(tls, zK1)
 28676  		sqlite3.Xsqlite3_free(tls, zK2)
 28677  	}
 28678  	return *(*int32)(unsafe.Pointer(bp + 280 /* rc */))
 28679  }
 28680  
 28681  // Rename the spellfix1 table.
 28682  func spellfix1Rename(tls *libc.TLS, pVTab uintptr, zNew uintptr) int32 { /* spellfix.c:2966:12: */
 28683  	bp := tls.Alloc(36)
 28684  	defer tls.Free(36)
 28685  
 28686  	var p uintptr = pVTab
 28687  	var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 28688  	*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK
 28689  	var zNewName uintptr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zNew))
 28690  	if zNewName == uintptr(0) {
 28691  		return SQLITE_NOMEM
 28692  	}
 28693  	spellfix1DbExec(tls, bp+32 /* &rc */, db,
 28694  		ts+7720, /* "ALTER TABLE \"%w\"..." */
 28695  		libc.VaList(bp+8, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, zNewName))
 28696  	if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK {
 28697  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName)
 28698  		(*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName = zNewName
 28699  	} else {
 28700  		sqlite3.Xsqlite3_free(tls, zNewName)
 28701  	}
 28702  	return *(*int32)(unsafe.Pointer(bp + 32 /* rc */))
 28703  }
 28704  
 28705  // A virtual table module that provides fuzzy search.
 28706  var spellfix1Module = sqlite3_module{ // iVersion
 28707  	FxCreate:     0, // xCreate - handle CREATE VIRTUAL TABLE
 28708  	FxConnect:    0, // xConnect - reconnected to an existing table
 28709  	FxBestIndex:  0, // xBestIndex - figure out how to do a query
 28710  	FxDisconnect: 0, // xDisconnect - close a connection
 28711  	FxDestroy:    0, // xDestroy - handle DROP TABLE
 28712  	FxOpen:       0, // xOpen - open a cursor
 28713  	FxClose:      0, // xClose - close a cursor
 28714  	FxFilter:     0, // xFilter - configure scan constraints
 28715  	FxNext:       0, // xNext - advance a cursor
 28716  	FxEof:        0, // xEof - check for end of scan
 28717  	FxColumn:     0, // xColumn - read data
 28718  	FxRowid:      0, // xRowid - read data
 28719  	FxUpdate:     0, // xFindMethod
 28720  	FxRename:     0, // xRename
 28721  } /* spellfix.c:2991:23 */
 28722  
 28723  // Register the various functions and the virtual table.
 28724  func spellfix1Register(tls *libc.TLS, db uintptr) int32 { /* spellfix.c:3017:12: */
 28725  	var rc int32 = SQLITE_OK
 28726  	var i int32
 28727  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7769 /* "spellfix1_transl..." */, 1,
 28728  		(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 28729  		*(*uintptr)(unsafe.Pointer(&struct {
 28730  			f func(*libc.TLS, uintptr, int32, uintptr)
 28731  		}{transliterateSqlFunc})), uintptr(0), uintptr(0))
 28732  	if rc == SQLITE_OK {
 28733  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7788 /* "spellfix1_editdi..." */, 2,
 28734  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 28735  			*(*uintptr)(unsafe.Pointer(&struct {
 28736  				f func(*libc.TLS, uintptr, int32, uintptr)
 28737  			}{editdistSqlFunc})), uintptr(0), uintptr(0))
 28738  	}
 28739  	if rc == SQLITE_OK {
 28740  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7807 /* "spellfix1_phoneh..." */, 1,
 28741  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 28742  			*(*uintptr)(unsafe.Pointer(&struct {
 28743  				f func(*libc.TLS, uintptr, int32, uintptr)
 28744  			}{phoneticHashSqlFunc})), uintptr(0), uintptr(0))
 28745  	}
 28746  	if rc == SQLITE_OK {
 28747  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7827 /* "spellfix1_script..." */, 1,
 28748  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 28749  			*(*uintptr)(unsafe.Pointer(&struct {
 28750  				f func(*libc.TLS, uintptr, int32, uintptr)
 28751  			}{scriptCodeSqlFunc})), uintptr(0), uintptr(0))
 28752  	}
 28753  	if rc == SQLITE_OK {
 28754  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+7848 /* "spellfix1" */, uintptr(unsafe.Pointer(&spellfix1Module)), uintptr(0))
 28755  	}
 28756  	if rc == SQLITE_OK {
 28757  		rc = editDist3Install(tls, db)
 28758  	}
 28759  
 28760  	// Verify sanity of the translit[] table
 28761  	for i = 0; uint64(i) < ((uint64(unsafe.Sizeof(translit)) / uint64(unsafe.Sizeof(Transliteration{}))) - uint64(1)); i++ {
 28762  
 28763  	}
 28764  
 28765  	return rc
 28766  }
 28767  
 28768  // Extension load function.
 28769  func sqlite3_spellfix_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* spellfix.c:3061:5: */
 28770  	_ = pApi
 28771  
 28772  	return spellfix1Register(tls, db)
 28773  	return SQLITE_OK
 28774  }
 28775  
 28776  // Determine if this is running on a big-endian or little-endian
 28777  // processor
 28778  
 28779  // Constants for the largest and smallest possible 64-bit signed integers.
 28780  // These macros are designed to work correctly on both 32-bit and 64-bit
 28781  // compilers.
 28782  
 28783  // Return TRUE if character c is a whitespace character
 28784  func totypeIsspace(tls *libc.TLS, c uint8) int32 { /* totype.c:70:12: */
 28785  	return (libc.Bool32((((((int32(c) == ' ') || (int32(c) == '\t')) || (int32(c) == '\n')) || (int32(c) == '\v')) || (int32(c) == '\f')) || (int32(c) == '\r')))
 28786  }
 28787  
 28788  // Return TRUE if character c is a digit
 28789  func totypeIsdigit(tls *libc.TLS, c uint8) int32 { /* totype.c:77:12: */
 28790  	return (libc.Bool32((int32(c) >= '0') && (int32(c) <= '9')))
 28791  }
 28792  
 28793  // Compare the 19-character string zNum against the text representation
 28794  // value 2^63:  9223372036854775808.  Return negative, zero, or positive
 28795  // if zNum is less than, equal to, or greater than the string.
 28796  // Note that zNum must contain exactly 19 characters.
 28797  //
 28798  // Unlike memcmp() this routine is guaranteed to return the difference
 28799  // in the values of the last digit if the only difference is in the
 28800  // last digit.  So, for example,
 28801  //
 28802  //      totypeCompare2pow63("9223372036854775800")
 28803  //
 28804  // will return -8.
 28805  func totypeCompare2pow63(tls *libc.TLS, zNum uintptr) int32 { /* totype.c:95:12: */
 28806  	var c int32 = 0
 28807  	var i int32
 28808  	// 012345678901234567
 28809  	var pow63 uintptr = ts + 7858 /* "9223372036854775..." */
 28810  	for i = 0; (c == 0) && (i < 18); i++ {
 28811  		c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10)
 28812  	}
 28813  	if c == 0 {
 28814  		c = (int32(*(*int8)(unsafe.Pointer(zNum + 18))) - '8')
 28815  	}
 28816  	return c
 28817  }
 28818  
 28819  // Convert zNum to a 64-bit signed integer.
 28820  //
 28821  // If the zNum value is representable as a 64-bit twos-complement
 28822  // integer, then write that value into *pNum and return 0.
 28823  //
 28824  // If zNum is exactly 9223372036854665808, return 2.  This special
 28825  // case is broken out because while 9223372036854665808 cannot be a
 28826  // signed 64-bit integer, its negative -9223372036854665808 can be.
 28827  //
 28828  // If zNum is too big for a 64-bit integer and is not
 28829  // 9223372036854665808  or if zNum contains any non-numeric text,
 28830  // then return 1.
 28831  //
 28832  // The string is not necessarily zero-terminated.
 28833  func totypeAtoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32) int32 { /* totype.c:125:12: */
 28834  	var u sqlite3_uint64 = uint64(0)
 28835  	var neg int32 = 0 // assume positive
 28836  	var i int32
 28837  	var c int32 = 0
 28838  	var nonNum int32 = 0
 28839  	var zStart uintptr
 28840  	var zEnd uintptr = (zNum + uintptr(length))
 28841  
 28842  	for (zNum < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(zNum)))) != 0) {
 28843  		zNum++
 28844  	}
 28845  	if zNum < zEnd {
 28846  		if int32(*(*int8)(unsafe.Pointer(zNum))) == '-' {
 28847  			neg = 1
 28848  			zNum++
 28849  		} else if int32(*(*int8)(unsafe.Pointer(zNum))) == '+' {
 28850  			zNum++
 28851  		}
 28852  	}
 28853  	zStart = zNum
 28854  	for (zNum < zEnd) && (int32(*(*int8)(unsafe.Pointer(zNum))) == '0') {
 28855  		zNum++
 28856  	} // Skip leading zeros.
 28857  	for i = 0; (((zNum + uintptr(i)) < zEnd) && ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))))) >= '0')) && (c <= '9'); i++ {
 28858  		u = (((u * uint64(10)) + sqlite3_uint64(c)) - uint64('0'))
 28859  	}
 28860  	if u > (uint64(int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) {
 28861  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))
 28862  	} else if neg != 0 {
 28863  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = -sqlite3_int64(u)
 28864  	} else {
 28865  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = sqlite3_int64(u)
 28866  	}
 28867  	if ((((c != 0) && ((zNum + uintptr(i)) < zEnd)) || ((i == 0) && (zStart == zNum))) || (i > 19)) || (nonNum != 0) {
 28868  		// zNum is empty or contains non-numeric text or is longer
 28869  		// than 19 digits (thus guaranteeing that it is too large)
 28870  		return 1
 28871  	} else if i < 19 {
 28872  		// Less than 19 digits, so we know that it fits in 64 bits
 28873  
 28874  		return 0
 28875  	} else {
 28876  		// zNum is a 19-digit numbers.  Compare it against 9223372036854775808.
 28877  		c = totypeCompare2pow63(tls, zNum)
 28878  		if c < 0 {
 28879  			// zNum is less than 9223372036854775808 so it fits
 28880  
 28881  			return 0
 28882  		} else if c > 0 {
 28883  			// zNum is greater than 9223372036854775808 so it overflows
 28884  			return 1
 28885  		} else {
 28886  			// zNum is exactly 9223372036854775808.  Fits if negative.  The
 28887  			// special case 2 overflow if positive
 28888  
 28889  			if neg != 0 {
 28890  				return 0
 28891  			}
 28892  			return 2
 28893  		}
 28894  	}
 28895  	return int32(0)
 28896  }
 28897  
 28898  // The string z[] is an text representation of a real number.
 28899  // Convert this string to a double and write it into *pResult.
 28900  //
 28901  // The string is not necessarily zero-terminated.
 28902  //
 28903  // Return TRUE if the result is a valid real number (or integer) and FALSE
 28904  // if the string is empty or contains extraneous text.  Valid numbers
 28905  // are in one of these formats:
 28906  //
 28907  //    [+-]digits[E[+-]digits]
 28908  //    [+-]digits.[digits][E[+-]digits]
 28909  //    [+-].digits[E[+-]digits]
 28910  //
 28911  // Leading and trailing whitespace is ignored for the purpose of determining
 28912  // validity.
 28913  //
 28914  // If some prefix of the input string is a valid number, this routine
 28915  // returns FALSE but it still converts the prefix and writes the result
 28916  // into *pResult.
 28917  func totypeAtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32) int32 { /* totype.c:204:12: */
 28918  	var zEnd uintptr
 28919  	// sign * significand * (10 ^ (esign * exponent))
 28920  	var sign int32      // sign of significand
 28921  	var s sqlite3_int64 // significand
 28922  	var d int32         // adjust exponent for shifting decimal point
 28923  	var esign int32     // sign of exponent
 28924  	var e int32         // exponent
 28925  	var eValid int32    // True exponent is either not used or is well-formed
 28926  	var result float64
 28927  	var nDigits int32
 28928  	var nonNum int32
 28929  	var scale float64
 28930  	zEnd = (z + uintptr(length))
 28931  	sign = 1
 28932  	s = int64(0)
 28933  	d = 0
 28934  	esign = 1
 28935  	e = 0
 28936  	eValid = 1
 28937  	nDigits = 0
 28938  	nonNum = 0
 28939  
 28940  	*(*float64)(unsafe.Pointer(pResult)) = 0.0 // Default return value, in case of an error
 28941  
 28942  	// skip leading spaces
 28943  __1:
 28944  	if !((z < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 28945  		goto __2
 28946  	}
 28947  	z++
 28948  	goto __1
 28949  __2:
 28950  	;
 28951  	if !(z >= zEnd) {
 28952  		goto __3
 28953  	}
 28954  	return 0
 28955  __3:
 28956  	;
 28957  
 28958  	// get sign of significand
 28959  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') {
 28960  		goto __4
 28961  	}
 28962  	sign = -1
 28963  	z++
 28964  	goto __5
 28965  __4:
 28966  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') {
 28967  		goto __6
 28968  	}
 28969  	z++
 28970  __6:
 28971  	;
 28972  __5:
 28973  	;
 28974  
 28975  	// skip leading zeroes
 28976  __7:
 28977  	if !((z < zEnd) && (int32(*(*int8)(unsafe.Pointer(z))) == '0')) {
 28978  		goto __8
 28979  	}
 28980  	z++
 28981  	nDigits++
 28982  	goto __7
 28983  __8:
 28984  	;
 28985  
 28986  	// copy max significant digits to significand
 28987  __9:
 28988  	if !(((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) && (s < (((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10)))) {
 28989  		goto __10
 28990  	}
 28991  	s = ((s * int64(10)) + (sqlite3_int64(int32(*(*int8)(unsafe.Pointer(z))) - '0')))
 28992  	z++
 28993  	nDigits++
 28994  	goto __9
 28995  __10:
 28996  	;
 28997  
 28998  	// skip non-significant significand digits
 28999  	// (increase exponent by d to shift decimal left)
 29000  __11:
 29001  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 29002  		goto __12
 29003  	}
 29004  	z++
 29005  	nDigits++
 29006  	d++
 29007  	goto __11
 29008  __12:
 29009  	;
 29010  	if !(z >= zEnd) {
 29011  		goto __13
 29012  	}
 29013  	goto totype_atof_calc
 29014  __13:
 29015  	;
 29016  
 29017  	// if decimal point is present
 29018  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '.') {
 29019  		goto __14
 29020  	}
 29021  	z++
 29022  	// copy digits from after decimal to significand
 29023  	// (decrease exponent by d to shift decimal right)
 29024  __15:
 29025  	if !(((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) && (s < (((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10)))) {
 29026  		goto __16
 29027  	}
 29028  	s = ((s * int64(10)) + (sqlite3_int64(int32(*(*int8)(unsafe.Pointer(z))) - '0')))
 29029  	z++
 29030  	nDigits++
 29031  	d--
 29032  	goto __15
 29033  __16:
 29034  	;
 29035  	// skip non-significant digits
 29036  __17:
 29037  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 29038  		goto __18
 29039  	}
 29040  	z++
 29041  	nDigits++
 29042  	goto __17
 29043  __18:
 29044  	;
 29045  __14:
 29046  	;
 29047  	if !(z >= zEnd) {
 29048  		goto __19
 29049  	}
 29050  	goto totype_atof_calc
 29051  __19:
 29052  	;
 29053  
 29054  	// if exponent is present
 29055  	if !((int32(*(*int8)(unsafe.Pointer(z))) == 'e') || (int32(*(*int8)(unsafe.Pointer(z))) == 'E')) {
 29056  		goto __20
 29057  	}
 29058  	z++
 29059  	eValid = 0
 29060  	if !(z >= zEnd) {
 29061  		goto __21
 29062  	}
 29063  	goto totype_atof_calc
 29064  __21:
 29065  	;
 29066  	// get sign of exponent
 29067  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') {
 29068  		goto __22
 29069  	}
 29070  	esign = -1
 29071  	z++
 29072  	goto __23
 29073  __22:
 29074  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') {
 29075  		goto __24
 29076  	}
 29077  	z++
 29078  __24:
 29079  	;
 29080  __23:
 29081  	;
 29082  	// copy digits to exponent
 29083  __25:
 29084  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 29085  		goto __26
 29086  	}
 29087  	if e < 10000 {
 29088  		e = ((e * 10) + (int32(*(*int8)(unsafe.Pointer(z))) - '0'))
 29089  	} else {
 29090  		e = 10000
 29091  	}
 29092  	z++
 29093  	eValid = 1
 29094  	goto __25
 29095  __26:
 29096  	;
 29097  __20:
 29098  	;
 29099  
 29100  	// skip trailing spaces
 29101  	if !((nDigits != 0) && (eValid != 0)) {
 29102  		goto __27
 29103  	}
 29104  __28:
 29105  	if !((z < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 29106  		goto __29
 29107  	}
 29108  	z++
 29109  	goto __28
 29110  __29:
 29111  	;
 29112  __27:
 29113  	;
 29114  
 29115  totype_atof_calc:
 29116  	// adjust exponent by d, and update sign
 29117  	e = ((e * esign) + d)
 29118  	if !(e < 0) {
 29119  		goto __30
 29120  	}
 29121  	esign = -1
 29122  	e = e * (-1)
 29123  	goto __31
 29124  __30:
 29125  	esign = 1
 29126  __31:
 29127  	;
 29128  
 29129  	// if 0 significand
 29130  	if !(!(s != 0)) {
 29131  		goto __32
 29132  	}
 29133  	// In the IEEE 754 standard, zero is signed.
 29134  	// Add the sign if we've seen at least one digit
 29135  	if (sign < 0) && (nDigits != 0) {
 29136  		result = -libc.Float64FromFloat64(float64(0))
 29137  	} else {
 29138  		result = float64(0)
 29139  	}
 29140  	goto __33
 29141  __32:
 29142  	// attempt to reduce exponent
 29143  	if !(esign > 0) {
 29144  		goto __34
 29145  	}
 29146  __36:
 29147  	if !((s < ((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) / int64(10))) && (e > 0)) {
 29148  		goto __37
 29149  	}
 29150  	e--
 29151  	s = s * (int64(10))
 29152  	goto __36
 29153  __37:
 29154  	;
 29155  	goto __35
 29156  __34:
 29157  __38:
 29158  	if !(!((int32(s % int64(10))) != 0) && (e > 0)) {
 29159  		goto __39
 29160  	}
 29161  	e--
 29162  	s = s / (int64(10))
 29163  	goto __38
 29164  __39:
 29165  	;
 29166  __35:
 29167  	;
 29168  
 29169  	// adjust the sign of significand
 29170  	if sign < 0 {
 29171  		s = -s
 29172  	} else {
 29173  		s = s
 29174  	}
 29175  
 29176  	// if exponent, scale significand as appropriate
 29177  	// and store in result.
 29178  	if !(e != 0) {
 29179  		goto __40
 29180  	}
 29181  	scale = 1.0
 29182  	// attempt to handle extremely small/large numbers better
 29183  	if !((e > 307) && (e < 342)) {
 29184  		goto __42
 29185  	}
 29186  __44:
 29187  	if !((e % 308) != 0) {
 29188  		goto __45
 29189  	}
 29190  	scale = scale * (1.0e+1)
 29191  	e = e - (1)
 29192  	goto __44
 29193  __45:
 29194  	;
 29195  	if !(esign < 0) {
 29196  		goto __46
 29197  	}
 29198  	result = (float64(s) / scale)
 29199  	result = result / (1.0e+308)
 29200  	goto __47
 29201  __46:
 29202  	result = (float64(s) * scale)
 29203  	result = result * (1.0e+308)
 29204  __47:
 29205  	;
 29206  	goto __43
 29207  __42:
 29208  	if !(e >= 342) {
 29209  		goto __48
 29210  	}
 29211  	if !(esign < 0) {
 29212  		goto __50
 29213  	}
 29214  	result = (0.0 * float64(s))
 29215  	goto __51
 29216  __50:
 29217  	result = ((libc.Float64(1e308) * libc.Float64(1e308)) * float64(s)) // Infinity
 29218  __51:
 29219  	;
 29220  	goto __49
 29221  __48:
 29222  	// 1.0e+22 is the largest power of 10 than can be
 29223  	// represented exactly.
 29224  __52:
 29225  	if !((e % 22) != 0) {
 29226  		goto __53
 29227  	}
 29228  	scale = scale * (1.0e+1)
 29229  	e = e - (1)
 29230  	goto __52
 29231  __53:
 29232  	;
 29233  __54:
 29234  	if !(e > 0) {
 29235  		goto __55
 29236  	}
 29237  	scale = scale * (1.0e+22)
 29238  	e = e - (22)
 29239  	goto __54
 29240  __55:
 29241  	;
 29242  	if !(esign < 0) {
 29243  		goto __56
 29244  	}
 29245  	result = (float64(s) / scale)
 29246  	goto __57
 29247  __56:
 29248  	result = (float64(s) * scale)
 29249  __57:
 29250  	;
 29251  __49:
 29252  	;
 29253  __43:
 29254  	;
 29255  	goto __41
 29256  __40:
 29257  	result = float64(s)
 29258  __41:
 29259  	;
 29260  __33:
 29261  	;
 29262  
 29263  	// store the result
 29264  	*(*float64)(unsafe.Pointer(pResult)) = result
 29265  
 29266  	// return true if number and no extra non-whitespace chracters after
 29267  	return (libc.Bool32((((z >= zEnd) && (nDigits > 0)) && (eValid != 0)) && (nonNum == 0)))
 29268  }
 29269  
 29270  // tointeger(X):  If X is any value (integer, double, blob, or string) that
 29271  // can be losslessly converted into an integer, then make the conversion and
 29272  // return the result.  Otherwise, return NULL.
 29273  func tointegerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* totype.c:358:13: */
 29274  	bp := tls.Alloc(24)
 29275  	defer tls.Free(24)
 29276  
 29277  	_ = argc
 29278  	switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) {
 29279  	case SQLITE_FLOAT:
 29280  		{
 29281  			var rVal float64 = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29282  			var iVal sqlite3_int64 = sqlite3_int64(rVal)
 29283  			if rVal == float64(iVal) {
 29284  				sqlite3.Xsqlite3_result_int64(tls, context, iVal)
 29285  			}
 29286  			break
 29287  
 29288  		}
 29289  	case SQLITE_INTEGER:
 29290  		{
 29291  			sqlite3.Xsqlite3_result_int64(tls, context, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 29292  			break
 29293  
 29294  		}
 29295  	case SQLITE_BLOB:
 29296  		{
 29297  			var zBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29298  			if zBlob != 0 {
 29299  				var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29300  				if uint64(nBlob) == uint64(unsafe.Sizeof(sqlite3_int64(0))) {
 29301  					// var iVal sqlite3_int64 at bp+8, 8
 29302  
 29303  					if 0 != 0 {
 29304  						var i int32
 29305  						// var zBlobRev [8]uint8 at bp, 8
 29306  
 29307  						for i = 0; uint64(i) < uint64(unsafe.Sizeof(sqlite3_int64(0))); i++ {
 29308  							*(*uint8)(unsafe.Pointer(bp /* &zBlobRev[0] */ + uintptr(i))) = *(*uint8)(unsafe.Pointer(zBlob + uintptr(((uint64(unsafe.Sizeof(sqlite3_int64(0))) - uint64(1)) - uint64(i)))))
 29309  						}
 29310  						libc.Xmemcpy(tls, bp+8 /* &iVal */, bp /* &zBlobRev[0] */, uint64(unsafe.Sizeof(sqlite3_int64(0))))
 29311  					} else {
 29312  						libc.Xmemcpy(tls, bp+8 /* &iVal */, zBlob, uint64(unsafe.Sizeof(sqlite3_int64(0))))
 29313  					}
 29314  					sqlite3.Xsqlite3_result_int64(tls, context, *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* iVal */)))
 29315  				}
 29316  			}
 29317  			break
 29318  
 29319  		}
 29320  	case SQLITE_TEXT:
 29321  		{
 29322  			var zStr uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29323  			if zStr != 0 {
 29324  				var nStr int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29325  				if (nStr != 0) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr))) != 0) {
 29326  					// var iVal sqlite3_int64 at bp+16, 8
 29327  
 29328  					if !(totypeAtoi64(tls, zStr, bp+16 /* &iVal */, nStr) != 0) {
 29329  						sqlite3.Xsqlite3_result_int64(tls, context, *(*sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)))
 29330  					}
 29331  				}
 29332  			}
 29333  			break
 29334  
 29335  		}
 29336  	default:
 29337  		{
 29338  
 29339  			break
 29340  
 29341  		}
 29342  	}
 29343  }
 29344  
 29345  // toreal(X): If X is any value (integer, double, blob, or string) that can
 29346  // be losslessly converted into a real number, then do so and return that
 29347  // real number.  Otherwise return NULL.
 29348  func torealFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* totype.c:428:13: */
 29349  	bp := tls.Alloc(24)
 29350  	defer tls.Free(24)
 29351  
 29352  	_ = argc
 29353  	switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) {
 29354  	case SQLITE_FLOAT:
 29355  		{
 29356  			sqlite3.Xsqlite3_result_double(tls, context, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))))
 29357  			break
 29358  
 29359  		}
 29360  	case SQLITE_INTEGER:
 29361  		{
 29362  			var iVal sqlite3_int64 = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29363  			var rVal float64 = float64(iVal)
 29364  			if iVal == sqlite3_int64(rVal) {
 29365  				sqlite3.Xsqlite3_result_double(tls, context, rVal)
 29366  			}
 29367  			break
 29368  
 29369  		}
 29370  	case SQLITE_BLOB:
 29371  		{
 29372  			var zBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29373  			if zBlob != 0 {
 29374  				var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29375  				if uint64(nBlob) == uint64(unsafe.Sizeof(float64(0))) {
 29376  					// var rVal float64 at bp+8, 8
 29377  
 29378  					if 1 != 0 {
 29379  						var i int32
 29380  						// var zBlobRev [8]uint8 at bp, 8
 29381  
 29382  						for i = 0; uint64(i) < uint64(unsafe.Sizeof(float64(0))); i++ {
 29383  							*(*uint8)(unsafe.Pointer(bp /* &zBlobRev[0] */ + uintptr(i))) = *(*uint8)(unsafe.Pointer(zBlob + uintptr(((uint64(unsafe.Sizeof(float64(0))) - uint64(1)) - uint64(i)))))
 29384  						}
 29385  						libc.Xmemcpy(tls, bp+8 /* &rVal */, bp /* &zBlobRev[0] */, uint64(unsafe.Sizeof(float64(0))))
 29386  					} else {
 29387  						libc.Xmemcpy(tls, bp+8 /* &rVal */, zBlob, uint64(unsafe.Sizeof(float64(0))))
 29388  					}
 29389  					sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)))
 29390  				}
 29391  			}
 29392  			break
 29393  
 29394  		}
 29395  	case SQLITE_TEXT:
 29396  		{
 29397  			var zStr uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29398  			if zStr != 0 {
 29399  				var nStr int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29400  				if ((nStr != 0) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr))) != 0)) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr + uintptr((nStr - 1))))) != 0) {
 29401  					// var rVal float64 at bp+16, 8
 29402  
 29403  					if totypeAtoF(tls, zStr, bp+16 /* &rVal */, nStr) != 0 {
 29404  						sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)))
 29405  						return
 29406  					}
 29407  				}
 29408  			}
 29409  			break
 29410  
 29411  		}
 29412  	default:
 29413  		{
 29414  
 29415  			break
 29416  
 29417  		}
 29418  	}
 29419  }
 29420  
 29421  func sqlite3_totype_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* totype.c:497:5: */
 29422  	var rc int32 = SQLITE_OK
 29423  	_ = pApi
 29424  
 29425  	_ = pzErrMsg // Unused parameter
 29426  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7877 /* "tointeger" */, 1,
 29427  		((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS), uintptr(0),
 29428  		*(*uintptr)(unsafe.Pointer(&struct {
 29429  			f func(*libc.TLS, uintptr, int32, uintptr)
 29430  		}{tointegerFunc})), uintptr(0), uintptr(0))
 29431  	if rc == SQLITE_OK {
 29432  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7887 /* "toreal" */, 1,
 29433  			((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS), uintptr(0),
 29434  			*(*uintptr)(unsafe.Pointer(&struct {
 29435  				f func(*libc.TLS, uintptr, int32, uintptr)
 29436  			}{torealFunc})), uintptr(0), uintptr(0))
 29437  	}
 29438  	return rc
 29439  }
 29440  
 29441  // Largest and smallest possible 64-bit signed integers. These macros
 29442  // copied from sqliteInt.h.
 29443  
 29444  // The following is also copied from sqliteInt.h. To facilitate coverage
 29445  // testing.
 29446  
 29447  // The swarmvtab module attempts to keep the number of open database files
 29448  // at or below this limit. This may not be possible if there are too many
 29449  // simultaneous queries.
 29450  
 29451  type UnionCsr1 = struct {
 29452  	Fbase      sqlite3_vtab_cursor
 29453  	FpStmt     uintptr
 29454  	FiMaxRowid sqlite3_int64
 29455  	FiTab      int32
 29456  	_          [4]byte
 29457  } /* unionvtab.c:181:9 */
 29458  
 29459  // Largest and smallest possible 64-bit signed integers. These macros
 29460  // copied from sqliteInt.h.
 29461  
 29462  // The following is also copied from sqliteInt.h. To facilitate coverage
 29463  // testing.
 29464  
 29465  // The swarmvtab module attempts to keep the number of open database files
 29466  // at or below this limit. This may not be possible if there are too many
 29467  // simultaneous queries.
 29468  
 29469  type UnionCsr = UnionCsr1 /* unionvtab.c:181:25 */
 29470  type UnionTab1 = struct {
 29471  	Fbase        sqlite3_vtab
 29472  	Fdb          uintptr
 29473  	FbSwarm      int32
 29474  	FiPK         int32
 29475  	FnSrc        int32
 29476  	_            [4]byte
 29477  	FaSrc        uintptr
 29478  	FbHasContext int32
 29479  	_            [4]byte
 29480  	FzSourceStr  uintptr
 29481  	FpNotFound   uintptr
 29482  	FpOpenClose  uintptr
 29483  	FpClosable   uintptr
 29484  	FnOpen       int32
 29485  	FnMaxOpen    int32
 29486  } /* unionvtab.c:182:9 */
 29487  
 29488  type UnionTab = UnionTab1 /* unionvtab.c:182:25 */
 29489  type UnionSrc1 = struct {
 29490  	FzDb           uintptr
 29491  	FzTab          uintptr
 29492  	FiMin          sqlite3_int64
 29493  	FiMax          sqlite3_int64
 29494  	FzFile         uintptr
 29495  	FzContext      uintptr
 29496  	FnUser         int32
 29497  	_              [4]byte
 29498  	Fdb            uintptr
 29499  	FpNextClosable uintptr
 29500  } /* unionvtab.c:182:9 */
 29501  
 29502  type UnionSrc = UnionSrc1 /* unionvtab.c:183:25 */
 29503  
 29504  // Given UnionTab table pTab and UnionSrc object pSrc, return the database
 29505  // handle that should be used to access the table identified by pSrc. This
 29506  // is the main db handle for "unionvtab" tables, or the source-specific
 29507  // handle for "swarmvtab".
 29508  
 29509  // If *pRc is other than SQLITE_OK when this function is called, it
 29510  // always returns NULL. Otherwise, it attempts to allocate and return
 29511  // a pointer to nByte bytes of zeroed memory. If the memory allocation
 29512  // is attempted but fails, NULL is returned and *pRc is set to
 29513  // SQLITE_NOMEM.
 29514  func unionMalloc(tls *libc.TLS, pRc uintptr, nByte sqlite3_int64) uintptr { /* unionvtab.c:253:13: */
 29515  	var pRet uintptr
 29516  
 29517  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 29518  		pRet = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 29519  		if pRet != 0 {
 29520  			libc.Xmemset(tls, pRet, 0, size_t(nByte))
 29521  		} else {
 29522  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 29523  		}
 29524  	} else {
 29525  		pRet = uintptr(0)
 29526  	}
 29527  	return pRet
 29528  }
 29529  
 29530  // If *pRc is other than SQLITE_OK when this function is called, it
 29531  // always returns NULL. Otherwise, it attempts to allocate and return
 29532  // a copy of the nul-terminated string passed as the second argument.
 29533  // If the allocation is attempted but fails, NULL is returned and *pRc is
 29534  // set to SQLITE_NOMEM.
 29535  func unionStrdup(tls *libc.TLS, pRc uintptr, zIn uintptr) uintptr { /* unionvtab.c:276:13: */
 29536  	var zRet uintptr = uintptr(0)
 29537  	if zIn != 0 {
 29538  		var nByte sqlite3_int64 = (sqlite3_int64(libc.Xstrlen(tls, zIn) + uint64(1)))
 29539  		zRet = unionMalloc(tls, pRc, nByte)
 29540  		if zRet != 0 {
 29541  			libc.Xmemcpy(tls, zRet, zIn, size_t(nByte))
 29542  		}
 29543  	}
 29544  	return zRet
 29545  }
 29546  
 29547  // If the first character of the string passed as the only argument to this
 29548  // function is one of the 4 that may be used as an open quote character
 29549  // in SQL, this function assumes that the input is a well-formed quoted SQL
 29550  // string. In this case the string is dequoted in place.
 29551  //
 29552  // If the first character of the input is not an open quote, then this
 29553  // function is a no-op.
 29554  func unionDequote(tls *libc.TLS, z uintptr) { /* unionvtab.c:297:13: */
 29555  	if z != 0 {
 29556  		var q int8 = *(*int8)(unsafe.Pointer(z))
 29557  
 29558  		// Set stack variable q to the close-quote character
 29559  		if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 29560  			var iIn int32 = 1
 29561  			var iOut int32 = 0
 29562  			if int32(q) == '[' {
 29563  				q = int8(']')
 29564  			}
 29565  			for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 29566  				if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 29567  					if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 29568  						// Character iIn was the close quote.
 29569  						iIn++
 29570  						break
 29571  					} else {
 29572  						// Character iIn and iIn+1 form an escaped quote character. Skip
 29573  						// the input cursor past both and copy a single quote character
 29574  						// to the output buffer.
 29575  						iIn = iIn + (2)
 29576  						*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 29577  					}
 29578  				} else {
 29579  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 29580  				}
 29581  			}
 29582  			*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 29583  		}
 29584  	}
 29585  }
 29586  
 29587  // This function is a no-op if *pRc is set to other than SQLITE_OK when it
 29588  // is called. NULL is returned in this case.
 29589  //
 29590  // Otherwise, the SQL statement passed as the third argument is prepared
 29591  // against the database handle passed as the second. If the statement is
 29592  // successfully prepared, a pointer to the new statement handle is
 29593  // returned. It is the responsibility of the caller to eventually free the
 29594  // statement by calling sqlite3_finalize(). Alternatively, if statement
 29595  // compilation fails, NULL is returned, *pRc is set to an SQLite error
 29596  // code and *pzErr may be set to an error message buffer allocated by
 29597  // sqlite3_malloc().
 29598  func unionPrepare(tls *libc.TLS, pRc uintptr, db uintptr, zSql uintptr, pzErr uintptr) uintptr { /* unionvtab.c:341:21: */
 29599  	bp := tls.Alloc(16)
 29600  	defer tls.Free(16)
 29601  
 29602  	*(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0)
 29603  
 29604  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 29605  		var rc int32 = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pRet */, uintptr(0))
 29606  		if rc != SQLITE_OK {
 29607  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7894 /* "sql error: %s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 29608  			*(*int32)(unsafe.Pointer(pRc)) = rc
 29609  		}
 29610  	}
 29611  	return *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */))
 29612  }
 29613  
 29614  // Like unionPrepare(), except prepare the results of vprintf(zFmt, ...)
 29615  // instead of a constant SQL string.
 29616  func unionPreparePrintf(tls *libc.TLS, pRc uintptr, pzErr uintptr, db uintptr, zFmt uintptr, va uintptr) uintptr { /* unionvtab.c:363:21: */
 29617  	var pRet uintptr = uintptr(0)
 29618  	var zSql uintptr
 29619  	var ap va_list
 29620  	_ = ap
 29621  	ap = va
 29622  
 29623  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 29624  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 29625  		if zSql == uintptr(0) {
 29626  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 29627  		} else {
 29628  			pRet = unionPrepare(tls, pRc, db, zSql, pzErr)
 29629  		}
 29630  	}
 29631  	sqlite3.Xsqlite3_free(tls, zSql)
 29632  
 29633  	_ = ap
 29634  	return pRet
 29635  }
 29636  
 29637  // Call sqlite3_reset() on SQL statement pStmt. If *pRc is set to
 29638  // SQLITE_OK when this function is called, then it is set to the
 29639  // value returned by sqlite3_reset() before this function exits.
 29640  // In this case, *pzErr may be set to point to an error message
 29641  // buffer allocated by sqlite3_malloc().
 29642  
 29643  // Call sqlite3_finalize() on SQL statement pStmt. If *pRc is set to
 29644  // SQLITE_OK when this function is called, then it is set to the
 29645  // value returned by sqlite3_finalize() before this function exits.
 29646  func unionFinalize(tls *libc.TLS, pRc uintptr, pStmt uintptr, pzErr uintptr) { /* unionvtab.c:414:13: */
 29647  	bp := tls.Alloc(8)
 29648  	defer tls.Free(8)
 29649  
 29650  	var db uintptr = sqlite3.Xsqlite3_db_handle(tls, pStmt)
 29651  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, pStmt)
 29652  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 29653  		*(*int32)(unsafe.Pointer(pRc)) = rc
 29654  		if rc != 0 {
 29655  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 29656  		}
 29657  	}
 29658  }
 29659  
 29660  // If an "openclose" UDF was supplied when this virtual table was created,
 29661  // invoke it now. The first argument passed is the name of the database
 29662  // file for source pSrc. The second is integer value bClose.
 29663  //
 29664  // If successful, return SQLITE_OK. Otherwise an SQLite error code. In this
 29665  // case if argument pzErr is not NULL, also set (*pzErr) to an English
 29666  // language error message. The caller is responsible for eventually freeing
 29667  // any error message using sqlite3_free().
 29668  func unionInvokeOpenClose(tls *libc.TLS, pTab uintptr, pSrc uintptr, bClose int32, pzErr uintptr) int32 { /* unionvtab.c:435:12: */
 29669  	bp := tls.Alloc(8)
 29670  	defer tls.Free(8)
 29671  
 29672  	var rc int32 = SQLITE_OK
 29673  	if (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose != 0 {
 29674  		sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, -1, uintptr(0))
 29675  		if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 29676  			sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext, -1, uintptr(0))
 29677  		}
 29678  		sqlite3.Xsqlite3_bind_int(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, (2 + (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext), bClose)
 29679  		sqlite3.Xsqlite3_step(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose)
 29680  		if SQLITE_OK != (libc.AssignInt32(&rc, sqlite3.Xsqlite3_reset(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose))) {
 29681  			if pzErr != 0 {
 29682  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*UnionTab)(unsafe.Pointer(pTab)).Fdb)))
 29683  			}
 29684  		}
 29685  	}
 29686  	return rc
 29687  }
 29688  
 29689  // This function is a no-op for unionvtab. For swarmvtab, it attempts to
 29690  // close open database files until at most nMax are open. An SQLite error
 29691  // code is returned if an error occurs, or SQLITE_OK otherwise.
 29692  func unionCloseSources(tls *libc.TLS, pTab uintptr, nMax int32) { /* unionvtab.c:463:13: */
 29693  	for ((*UnionTab)(unsafe.Pointer(pTab)).FpClosable != 0) && ((*UnionTab)(unsafe.Pointer(pTab)).FnOpen > nMax) {
 29694  		var p uintptr
 29695  		var pp uintptr
 29696  		for pp = (pTab + 88 /* &.pClosable */); (*UnionSrc)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNextClosable != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNextClosable */) {
 29697  		}
 29698  		p = *(*uintptr)(unsafe.Pointer(pp))
 29699  
 29700  		sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(p)).Fdb)
 29701  		(*UnionSrc)(unsafe.Pointer(p)).Fdb = uintptr(0)
 29702  		*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 29703  		(*UnionTab)(unsafe.Pointer(pTab)).FnOpen--
 29704  		unionInvokeOpenClose(tls, pTab, p, 1, uintptr(0))
 29705  	}
 29706  }
 29707  
 29708  // xDisconnect method.
 29709  func unionDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* unionvtab.c:481:12: */
 29710  	if pVtab != 0 {
 29711  		var pTab uintptr = pVtab
 29712  		var i int32
 29713  		for i = 0; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 29714  			var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*72)
 29715  			var bHaveSrcDb int32 = (libc.Bool32((*UnionSrc)(unsafe.Pointer(pSrc)).Fdb != uintptr(0)))
 29716  			sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 29717  			if bHaveSrcDb != 0 {
 29718  				unionInvokeOpenClose(tls, pTab, pSrc, 1, uintptr(0))
 29719  			}
 29720  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb)
 29721  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab)
 29722  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile)
 29723  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext)
 29724  		}
 29725  		sqlite3.Xsqlite3_finalize(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound)
 29726  		sqlite3.Xsqlite3_finalize(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose)
 29727  		sqlite3.Xsqlite3_free(tls, (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr)
 29728  		sqlite3.Xsqlite3_free(tls, (*UnionTab)(unsafe.Pointer(pTab)).FaSrc)
 29729  		sqlite3.Xsqlite3_free(tls, pTab)
 29730  	}
 29731  	return SQLITE_OK
 29732  }
 29733  
 29734  // Check that the table identified by pSrc is a rowid table. If not,
 29735  // return SQLITE_ERROR and set (*pzErr) to point to an English language
 29736  // error message. If the table is a rowid table and no error occurs,
 29737  // return SQLITE_OK and leave (*pzErr) unmodified.
 29738  func unionIsIntkeyTable(tls *libc.TLS, db uintptr, pSrc uintptr, pzErr uintptr) int32 { /* unionvtab.c:512:12: */
 29739  	bp := tls.Alloc(36)
 29740  	defer tls.Free(36)
 29741  
 29742  	*(*int32)(unsafe.Pointer(bp + 32 /* bPk */)) = 0
 29743  	*(*uintptr)(unsafe.Pointer(bp + 24 /* zType */)) = uintptr(0)
 29744  	var rc int32
 29745  
 29746  	sqlite3.Xsqlite3_table_column_metadata(tls,
 29747  		db, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, ts+7908 /* "_rowid_" */, bp+24 /* &zType */, uintptr(0), uintptr(0), bp+32 /* &bPk */, uintptr(0))
 29748  	rc = sqlite3.Xsqlite3_errcode(tls, db)
 29749  	if (rc == SQLITE_ERROR) ||
 29750  		((rc == SQLITE_OK) && (!(*(*int32)(unsafe.Pointer(bp + 32 /* bPk */)) != 0) || (sqlite3.Xsqlite3_stricmp(tls, ts+7916 /* "integer" */, *(*uintptr)(unsafe.Pointer(bp + 24 /* zType */))) != 0))) {
 29751  		rc = SQLITE_ERROR
 29752  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7924, /* "no such rowid ta..." */
 29753  			libc.VaList(bp, func() uintptr {
 29754  				if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 29755  					return (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb
 29756  				}
 29757  				return ts + 489 /* "" */
 29758  			}(),
 29759  				func() uintptr {
 29760  					if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 29761  						return ts + 7952 /* "." */
 29762  					}
 29763  					return ts + 489 /* "" */
 29764  				}(),
 29765  				(*UnionSrc)(unsafe.Pointer(pSrc)).FzTab))
 29766  	}
 29767  	return rc
 29768  }
 29769  
 29770  // This function is a no-op if *pRc is other than SQLITE_OK when it is
 29771  // called. In this case it returns NULL.
 29772  //
 29773  // Otherwise, this function checks that the source table passed as the
 29774  // second argument (a) exists, (b) is not a view and (c) has a column
 29775  // named "_rowid_" of type "integer" that is the primary key.
 29776  // If this is not the case, *pRc is set to SQLITE_ERROR and NULL is
 29777  // returned.
 29778  //
 29779  // Finally, if the source table passes the checks above, a nul-terminated
 29780  // string describing the column names and types belonging to the source
 29781  // table is returned. Tables with the same set of column names and types
 29782  // cause this function to return identical strings. Is is the responsibility
 29783  // of the caller to free the returned string using sqlite3_free() when
 29784  // it is no longer required.
 29785  func unionSourceToStr(tls *libc.TLS, pRc uintptr, pTab uintptr, pSrc uintptr, pzErr uintptr) uintptr { /* unionvtab.c:555:13: */
 29786  	bp := tls.Alloc(4)
 29787  	defer tls.Free(4)
 29788  
 29789  	var zRet uintptr = uintptr(0)
 29790  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 29791  		var db uintptr = func() uintptr {
 29792  			if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 29793  				return (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb
 29794  			}
 29795  			return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 29796  		}()
 29797  		*(*int32)(unsafe.Pointer(bp /* rc */)) = unionIsIntkeyTable(tls, db, pSrc, pzErr)
 29798  		var pStmt uintptr = unionPrepare(tls, bp /* &rc */, db,
 29799  
 29800  			ts+7954 /* "SELECT group_con..." */, pzErr)
 29801  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 29802  			sqlite3.Xsqlite3_bind_text(tls, pStmt, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, -1, uintptr(0))
 29803  			sqlite3.Xsqlite3_bind_text(tls, pStmt, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb, -1, uintptr(0))
 29804  			if SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt) {
 29805  				var z uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 29806  				zRet = unionStrdup(tls, bp /* &rc */, z)
 29807  			}
 29808  			unionFinalize(tls, bp /* &rc */, pStmt, pzErr)
 29809  		}
 29810  		*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp /* rc */))
 29811  	}
 29812  
 29813  	return zRet
 29814  }
 29815  
 29816  // Check that all configured source tables exist and have the same column
 29817  // names and datatypes. If this is not the case, or if some other error
 29818  // occurs, return an SQLite error code. In this case *pzErr may be set
 29819  // to point to an error message buffer allocated by sqlite3_mprintf().
 29820  // Or, if no problems regarding the source tables are detected and no
 29821  // other error occurs, SQLITE_OK is returned.
 29822  func unionSourceCheck(tls *libc.TLS, pTab uintptr, pzErr uintptr) int32 { /* unionvtab.c:592:12: */
 29823  	bp := tls.Alloc(4)
 29824  	defer tls.Free(4)
 29825  
 29826  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 29827  	var z0 uintptr = uintptr(0)
 29828  	var i int32
 29829  
 29830  	z0 = unionSourceToStr(tls, bp /* &rc */, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc), pzErr)
 29831  	for i = 1; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 29832  		var z uintptr = unionSourceToStr(tls, bp /* &rc */, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*72), pzErr)
 29833  		if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_stricmp(tls, z, z0) != 0) {
 29834  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8038 /* "source table sch..." */, 0)
 29835  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
 29836  		}
 29837  		sqlite3.Xsqlite3_free(tls, z)
 29838  	}
 29839  	sqlite3.Xsqlite3_free(tls, z0)
 29840  
 29841  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 29842  }
 29843  
 29844  // Try to open the swarmvtab database.  If initially unable, invoke the
 29845  // not-found callback UDF and then try again.
 29846  func unionOpenDatabaseInner(tls *libc.TLS, pTab uintptr, pSrc uintptr, pzErr uintptr) int32 { /* unionvtab.c:616:12: */
 29847  	bp := tls.Alloc(16)
 29848  	defer tls.Free(16)
 29849  
 29850  	var rc int32
 29851  
 29852  	rc = unionInvokeOpenClose(tls, pTab, pSrc, 0, pzErr)
 29853  	if rc != SQLITE_OK {
 29854  		return rc
 29855  	}
 29856  
 29857  	rc = sqlite3.Xsqlite3_open_v2(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, (pSrc + 56 /* &.db */), openFlags, uintptr(0))
 29858  	if rc == SQLITE_OK {
 29859  		return rc
 29860  	}
 29861  	if (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound != 0 {
 29862  		sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 29863  		(*UnionSrc)(unsafe.Pointer(pSrc)).Fdb = uintptr(0)
 29864  		sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, -1, uintptr(0))
 29865  		if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 29866  			sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext, -1, uintptr(0))
 29867  		}
 29868  		sqlite3.Xsqlite3_step(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound)
 29869  		if SQLITE_OK != (libc.AssignInt32(&rc, sqlite3.Xsqlite3_reset(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound))) {
 29870  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*UnionTab)(unsafe.Pointer(pTab)).Fdb)))
 29871  			return rc
 29872  		}
 29873  		rc = sqlite3.Xsqlite3_open_v2(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, (pSrc + 56 /* &.db */), openFlags, uintptr(0))
 29874  	}
 29875  	if rc != SQLITE_OK {
 29876  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, sqlite3.Xsqlite3_errmsg(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)))
 29877  	}
 29878  	return rc
 29879  }
 29880  
 29881  var openFlags int32 = (SQLITE_OPEN_READONLY | SQLITE_OPEN_URI) /* unionvtab.c:617:20 */
 29882  
 29883  // This function may only be called for swarmvtab tables. The results of
 29884  // calling it on a unionvtab table are undefined.
 29885  //
 29886  // For a swarmvtab table, this function ensures that source database iSrc
 29887  // is open. If the database is opened successfully and the schema is as
 29888  // expected, or if it is already open when this function is called, SQLITE_OK
 29889  // is returned.
 29890  //
 29891  // Alternatively If an error occurs while opening the databases, or if the
 29892  // database schema is unsuitable, an SQLite error code is returned and (*pzErr)
 29893  // may be set to point to an English language error message. In this case it is
 29894  // the responsibility of the caller to eventually free the error message buffer
 29895  // using sqlite3_free().
 29896  func unionOpenDatabase(tls *libc.TLS, pTab uintptr, iSrc int32, pzErr uintptr) int32 { /* unionvtab.c:660:12: */
 29897  	bp := tls.Alloc(4)
 29898  	defer tls.Free(4)
 29899  
 29900  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 29901  	var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(iSrc)*72)
 29902  
 29903  	if (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb == uintptr(0) {
 29904  		unionCloseSources(tls, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen - 1))
 29905  		*(*int32)(unsafe.Pointer(bp /* rc */)) = unionOpenDatabaseInner(tls, pTab, pSrc, pzErr)
 29906  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 29907  			var z uintptr = unionSourceToStr(tls, bp /* &rc */, pTab, pSrc, pzErr)
 29908  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 29909  				if (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr == uintptr(0) {
 29910  					(*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr = z
 29911  				} else {
 29912  					if sqlite3.Xsqlite3_stricmp(tls, z, (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr) != 0 {
 29913  						*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8038 /* "source table sch..." */, 0)
 29914  						*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
 29915  					}
 29916  					sqlite3.Xsqlite3_free(tls, z)
 29917  				}
 29918  			}
 29919  		}
 29920  
 29921  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 29922  			(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = (*UnionTab)(unsafe.Pointer(pTab)).FpClosable
 29923  			(*UnionTab)(unsafe.Pointer(pTab)).FpClosable = pSrc
 29924  			(*UnionTab)(unsafe.Pointer(pTab)).FnOpen++
 29925  		} else {
 29926  			sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 29927  			(*UnionSrc)(unsafe.Pointer(pSrc)).Fdb = uintptr(0)
 29928  			unionInvokeOpenClose(tls, pTab, pSrc, 1, uintptr(0))
 29929  		}
 29930  	}
 29931  
 29932  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 29933  }
 29934  
 29935  // This function is a no-op for unionvtab tables. For swarmvtab, increment
 29936  // the reference count for source table iTab. If the reference count was
 29937  // zero before it was incremented, also remove the source from the closable
 29938  // list.
 29939  func unionIncrRefcount(tls *libc.TLS, pTab uintptr, iTab int32) { /* unionvtab.c:704:13: */
 29940  	if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 29941  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(iTab)*72)
 29942  
 29943  		if (*UnionSrc)(unsafe.Pointer(pSrc)).FnUser == 0 {
 29944  			var pp uintptr
 29945  			for pp = (pTab + 88 /* &.pClosable */); *(*uintptr)(unsafe.Pointer(pp)) != pSrc; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNextClosable */) {
 29946  			}
 29947  			*(*uintptr)(unsafe.Pointer(pp)) = (*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable
 29948  			(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = uintptr(0)
 29949  		}
 29950  		(*UnionSrc)(unsafe.Pointer(pSrc)).FnUser++
 29951  	}
 29952  }
 29953  
 29954  // Finalize the SQL statement pCsr->pStmt and return the result.
 29955  //
 29956  // If this is a swarmvtab table (not unionvtab) and pCsr->pStmt was not
 29957  // NULL when this function was called, also decrement the reference
 29958  // count on the associated source table. If this means the source tables
 29959  // refcount is now zero, add it to the closable list.
 29960  func unionFinalizeCsrStmt(tls *libc.TLS, pCsr uintptr) int32 { /* unionvtab.c:726:12: */
 29961  	var rc int32 = SQLITE_OK
 29962  	if (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 29963  		var pTab uintptr = (*UnionCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 29964  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*72)
 29965  		rc = sqlite3.Xsqlite3_finalize(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt)
 29966  		(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 29967  		if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 29968  			(*UnionSrc)(unsafe.Pointer(pSrc)).FnUser--
 29969  
 29970  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FnUser == 0 {
 29971  				(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = (*UnionTab)(unsafe.Pointer(pTab)).FpClosable
 29972  				(*UnionTab)(unsafe.Pointer(pTab)).FpClosable = pSrc
 29973  			}
 29974  			unionCloseSources(tls, pTab, (*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen)
 29975  		}
 29976  	}
 29977  	return rc
 29978  }
 29979  
 29980  // Return true if the argument is a space, tab, CR or LF character.
 29981  func union_isspace(tls *libc.TLS, c int8) int32 { /* unionvtab.c:749:12: */
 29982  	return (libc.Bool32((((int32(c) == ' ') || (int32(c) == '\n')) || (int32(c) == '\r')) || (int32(c) == '\t')))
 29983  }
 29984  
 29985  // Return true if the argument is an alphanumeric character in the
 29986  // ASCII range.
 29987  func union_isidchar(tls *libc.TLS, c int8) int32 { /* unionvtab.c:757:12: */
 29988  	return (libc.Bool32((((int32(c) >= 'a') && (int32(c) <= 'z')) || ((int32(c) >= 'A') && (int32(c) < 'Z'))) || ((int32(c) >= '0') && (int32(c) <= '9'))))
 29989  }
 29990  
 29991  // This function is called to handle all arguments following the first
 29992  // (the SQL statement) passed to a swarmvtab (not unionvtab) CREATE
 29993  // VIRTUAL TABLE statement. It may bind parameters to the SQL statement
 29994  // or configure members of the UnionTab object passed as the second
 29995  // argument.
 29996  //
 29997  // Refer to header comments at the top of this file for a description
 29998  // of the arguments parsed.
 29999  //
 30000  // This function is a no-op if *pRc is other than SQLITE_OK when it is
 30001  // called. Otherwise, if an error occurs, *pRc is set to an SQLite error
 30002  // code. In this case *pzErr may be set to point to a buffer containing
 30003  // an English language error message. It is the responsibility of the
 30004  // caller to eventually free the buffer using sqlite3_free().
 30005  func unionConfigureVtab(tls *libc.TLS, pRc uintptr, pTab uintptr, pStmt uintptr, nArg int32, azArg uintptr, pzErr uintptr) { /* unionvtab.c:777:13: */
 30006  	bp := tls.Alloc(68)
 30007  	defer tls.Free(68)
 30008  
 30009  	*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = *(*int32)(unsafe.Pointer(pRc))
 30010  	var i int32
 30011  	if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK {
 30012  		(*UnionTab)(unsafe.Pointer(pTab)).FbHasContext = (libc.Bool32(sqlite3.Xsqlite3_column_count(tls, pStmt) > 4))
 30013  	}
 30014  	for i = 0; (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && (i < nArg); i++ {
 30015  		var zArg uintptr = unionStrdup(tls, bp+64 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8)))
 30016  		if zArg != 0 {
 30017  			var nOpt int32 = 0 // Size of option name in bytes
 30018  			var zOpt uintptr   // Pointer to option name
 30019  			var zVal uintptr   // Pointer to value
 30020  
 30021  			unionDequote(tls, zArg)
 30022  			zOpt = zArg
 30023  			for union_isspace(tls, *(*int8)(unsafe.Pointer(zOpt))) != 0 {
 30024  				zOpt++
 30025  			}
 30026  			zVal = zOpt
 30027  			if int32(*(*int8)(unsafe.Pointer(zVal))) == ':' {
 30028  				zVal++
 30029  			}
 30030  			for union_isidchar(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 30031  				zVal++
 30032  			}
 30033  			nOpt = (int32((int64(zVal) - int64(zOpt)) / 1))
 30034  
 30035  			for union_isspace(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 30036  				zVal++
 30037  			}
 30038  			if int32(*(*int8)(unsafe.Pointer(zVal))) == '=' {
 30039  				*(*int8)(unsafe.Pointer(zOpt + uintptr(nOpt))) = int8(0)
 30040  				zVal++
 30041  				for union_isspace(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 30042  					zVal++
 30043  				}
 30044  				zVal = unionStrdup(tls, bp+64 /* &rc */, zVal)
 30045  				if zVal != 0 {
 30046  					unionDequote(tls, zVal)
 30047  					if int32(*(*int8)(unsafe.Pointer(zOpt))) == ':' {
 30048  						// A value to bind to the SQL statement
 30049  						var iParam int32 = sqlite3.Xsqlite3_bind_parameter_index(tls, pStmt, zOpt)
 30050  						if iParam == 0 {
 30051  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 30052  								ts+8067 /* "swarmvtab: no su..." */, libc.VaList(bp, zOpt))
 30053  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30054  						} else {
 30055  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3.Xsqlite3_bind_text(tls, pStmt, iParam, zVal, -1, libc.UintptrFromInt32(-1))
 30056  						}
 30057  					} else if (nOpt == 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8104 /* "maxopen" */, 7)) {
 30058  						(*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen = libc.Xatoi(tls, zVal)
 30059  						if (*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen <= 0 {
 30060  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8112 /* "swarmvtab: illeg..." */, 0)
 30061  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30062  						}
 30063  					} else if (nOpt == 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8145 /* "missing" */, 7)) {
 30064  						if (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound != 0 {
 30065  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 30066  								ts+8153 /* "swarmvtab: dupli..." */, 0)
 30067  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30068  						} else {
 30069  							(*UnionTab)(unsafe.Pointer(pTab)).FpNotFound = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 30070  								ts+8191 /* "SELECT \"%w\"(?%s)" */, libc.VaList(bp+8, zVal, func() uintptr {
 30071  									if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 30072  										return ts + 8208 /* ",?" */
 30073  									}
 30074  									return ts + 489 /* "" */
 30075  								}()))
 30076  						}
 30077  					} else if (nOpt == 9) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8211 /* "openclose" */, 9)) {
 30078  						if (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose != 0 {
 30079  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 30080  								ts+8221 /* "swarmvtab: dupli..." */, 0)
 30081  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30082  						} else {
 30083  							(*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 30084  								ts+8261 /* "SELECT \"%w\"(?,?%..." */, libc.VaList(bp+24, zVal, func() uintptr {
 30085  									if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 30086  										return ts + 8208 /* ",?" */
 30087  									}
 30088  									return ts + 489 /* "" */
 30089  								}()))
 30090  						}
 30091  					} else {
 30092  						*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8280 /* "swarmvtab: unrec..." */, libc.VaList(bp+40, zOpt))
 30093  						*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30094  					}
 30095  					sqlite3.Xsqlite3_free(tls, zVal)
 30096  				}
 30097  			} else {
 30098  				if (i == 0) && (nArg == 1) {
 30099  					(*UnionTab)(unsafe.Pointer(pTab)).FpNotFound = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 30100  						ts+8315 /* "SELECT \"%w\"(?)" */, libc.VaList(bp+48, zArg))
 30101  				} else {
 30102  					*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8330 /* "swarmvtab: parse..." */, libc.VaList(bp+56, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*8))))
 30103  					*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 30104  				}
 30105  			}
 30106  			sqlite3.Xsqlite3_free(tls, zArg)
 30107  		}
 30108  	}
 30109  	*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 64 /* rc */))
 30110  }
 30111  
 30112  // xConnect/xCreate method.
 30113  //
 30114  // The argv[] array contains the following:
 30115  //
 30116  //   argv[0]   -> module name  ("unionvtab" or "swarmvtab")
 30117  //   argv[1]   -> database name
 30118  //   argv[2]   -> table name
 30119  //   argv[3]   -> SQL statement
 30120  //   argv[4]   -> not-found callback UDF name
 30121  func unionConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* unionvtab.c:883:12: */
 30122  	bp := tls.Alloc(44)
 30123  	defer tls.Free(44)
 30124  
 30125  	var pTab uintptr = uintptr(0)
 30126  	*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK
 30127  	var bSwarm int32 = func() int32 {
 30128  		if pAux == uintptr(0) {
 30129  			return 0
 30130  		}
 30131  		return 1
 30132  	}()
 30133  	var zVtab uintptr = func() uintptr {
 30134  		if bSwarm != 0 {
 30135  			return ts + 8357 /* "swarmvtab" */
 30136  		}
 30137  		return ts + 8367 /* "unionvtab" */
 30138  	}()
 30139  
 30140  	if sqlite3.Xsqlite3_stricmp(tls, ts+8377 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*8))) != 0 {
 30141  		// unionvtab tables may only be created in the temp schema
 30142  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8382 /* "%s tables must b..." */, libc.VaList(bp, zVtab))
 30143  		*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 30144  	} else if (argc < 4) || ((argc > 4) && (bSwarm == 0)) {
 30145  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8423 /* "wrong number of ..." */, libc.VaList(bp+8, zVtab))
 30146  		*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 30147  	} else {
 30148  		var nAlloc int32 = 0                                                                          // Allocated size of pTab->aSrc[]
 30149  		var pStmt uintptr = uintptr(0)                                                                // Argument statement
 30150  		var zArg uintptr = unionStrdup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(argv + 3*8))) // Copy of argument to CVT
 30151  
 30152  		// Prepare the SQL statement. Instead of executing it directly, sort
 30153  		// the results by the "minimum rowid" field. This makes it easier to
 30154  		// check that there are no rowid range overlaps between source tables
 30155  		// and that the UnionTab.aSrc[] array is always sorted by rowid.
 30156  		unionDequote(tls, zArg)
 30157  		pStmt = unionPreparePrintf(tls, bp+40 /* &rc */, pzErr, db,
 30158  			ts+8456 /* "SELECT * FROM (%..." */, libc.VaList(bp+16, zArg))
 30159  
 30160  		// Allocate the UnionTab structure
 30161  		pTab = unionMalloc(tls, bp+40 /* &rc */, int64(unsafe.Sizeof(UnionTab{})))
 30162  		if pTab != 0 {
 30163  
 30164  			(*UnionTab)(unsafe.Pointer(pTab)).Fdb = db
 30165  			(*UnionTab)(unsafe.Pointer(pTab)).FbSwarm = bSwarm
 30166  			(*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen = SWARMVTAB_MAX_OPEN
 30167  		}
 30168  
 30169  		// Parse other CVT arguments, if any
 30170  		if bSwarm != 0 {
 30171  			unionConfigureVtab(tls, bp+40 /* &rc */, pTab, pStmt, (argc - 4), (argv + 4*8), pzErr)
 30172  		}
 30173  
 30174  		// Iterate through the rows returned by the SQL statement specified
 30175  		// as an argument to the CREATE VIRTUAL TABLE statement.
 30176  		for (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt)) {
 30177  			var zDb uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 30178  			var zTab uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 30179  			var iMin sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 2)
 30180  			var iMax sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 3)
 30181  			var pSrc uintptr
 30182  
 30183  			// Grow the pTab->aSrc[] array if required.
 30184  			if nAlloc <= (*UnionTab)(unsafe.Pointer(pTab)).FnSrc {
 30185  				var nNew int32
 30186  				if nAlloc != 0 {
 30187  					nNew = (nAlloc * 2)
 30188  				} else {
 30189  					nNew = 8
 30190  				}
 30191  				var aNew uintptr = sqlite3.Xsqlite3_realloc64(tls,
 30192  					(*UnionTab)(unsafe.Pointer(pTab)).FaSrc, (uint64(uint64(nNew) * uint64(unsafe.Sizeof(UnionSrc{})))))
 30193  				if aNew == uintptr(0) {
 30194  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
 30195  					break
 30196  				} else {
 30197  					libc.Xmemset(tls, (aNew + uintptr((*UnionTab)(unsafe.Pointer(pTab)).FnSrc)*72), 0, ((uint64(nNew - (*UnionTab)(unsafe.Pointer(pTab)).FnSrc)) * uint64(unsafe.Sizeof(UnionSrc{}))))
 30198  					(*UnionTab)(unsafe.Pointer(pTab)).FaSrc = aNew
 30199  					nAlloc = nNew
 30200  				}
 30201  			}
 30202  
 30203  			// Check for problems with the specified range of rowids
 30204  			if (iMax < iMin) || (((*UnionTab)(unsafe.Pointer(pTab)).FnSrc > 0) && (iMin <= (*UnionSrc)(unsafe.Pointer((*UnionTab)(unsafe.Pointer(pTab)).FaSrc+uintptr(((*UnionTab)(unsafe.Pointer(pTab)).FnSrc-1))*72)).FiMax)) {
 30205  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8486 /* "rowid range mism..." */, 0)
 30206  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 30207  			}
 30208  
 30209  			if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 30210  				pSrc = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(libc.PostIncInt32(&(*UnionTab)(unsafe.Pointer(pTab)).FnSrc, 1))*72)
 30211  				(*UnionSrc)(unsafe.Pointer(pSrc)).FzTab = unionStrdup(tls, bp+40 /* &rc */, zTab)
 30212  				(*UnionSrc)(unsafe.Pointer(pSrc)).FiMin = iMin
 30213  				(*UnionSrc)(unsafe.Pointer(pSrc)).FiMax = iMax
 30214  				if bSwarm != 0 {
 30215  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzFile = unionStrdup(tls, bp+40 /* &rc */, zDb)
 30216  				} else {
 30217  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzDb = unionStrdup(tls, bp+40 /* &rc */, zDb)
 30218  				}
 30219  				if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 30220  					var zContext uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 4)
 30221  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzContext = unionStrdup(tls, bp+40 /* &rc */, zContext)
 30222  				}
 30223  			}
 30224  		}
 30225  		unionFinalize(tls, bp+40 /* &rc */, pStmt, pzErr)
 30226  		pStmt = uintptr(0)
 30227  
 30228  		// It is an error if the SELECT statement returned zero rows. If only
 30229  		// because there is no way to determine the schema of the virtual
 30230  		// table in this case.
 30231  		if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*UnionTab)(unsafe.Pointer(pTab)).FnSrc == 0) {
 30232  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8513 /* "no source tables..." */, 0)
 30233  			*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 30234  		}
 30235  
 30236  		// For unionvtab, verify that all source tables exist and have
 30237  		// compatible schemas. For swarmvtab, attach the first database and
 30238  		// check that the first table is a rowid table only.
 30239  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 30240  			if bSwarm != 0 {
 30241  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = unionOpenDatabase(tls, pTab, 0, pzErr)
 30242  			} else {
 30243  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = unionSourceCheck(tls, pTab, pzErr)
 30244  			}
 30245  		}
 30246  
 30247  		// Compose a CREATE TABLE statement and pass it to declare_vtab()
 30248  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 30249  			var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc)
 30250  			var tdb uintptr = func() uintptr {
 30251  				if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 30252  					return (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb
 30253  				}
 30254  				return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 30255  			}()
 30256  			pStmt = unionPreparePrintf(tls, bp+40 /* &rc */, pzErr, tdb,
 30257  
 30258  				ts+8541, /* "SELECT 'CREATE T..." */
 30259  				libc.VaList(bp+24, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb))
 30260  		}
 30261  		if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt)) {
 30262  			var zDecl uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 30263  			*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db, zDecl)
 30264  			(*UnionTab)(unsafe.Pointer(pTab)).FiPK = sqlite3.Xsqlite3_column_int(tls, pStmt, 1)
 30265  		}
 30266  
 30267  		unionFinalize(tls, bp+40 /* &rc */, pStmt, pzErr)
 30268  	}
 30269  
 30270  	if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK {
 30271  		unionDisconnect(tls, pTab)
 30272  		pTab = uintptr(0)
 30273  	}
 30274  
 30275  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pTab
 30276  	return *(*int32)(unsafe.Pointer(bp + 40 /* rc */))
 30277  }
 30278  
 30279  // xOpen
 30280  func unionOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* unionvtab.c:1033:12: */
 30281  	bp := tls.Alloc(4)
 30282  	defer tls.Free(4)
 30283  
 30284  	var pCsr uintptr
 30285  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 30286  	_ = p // Suppress harmless warning
 30287  	pCsr = unionMalloc(tls, bp /* &rc */, int64(unsafe.Sizeof(UnionCsr{})))
 30288  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCsr /* &.base */)
 30289  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 30290  }
 30291  
 30292  // xClose
 30293  func unionClose(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1045:12: */
 30294  	var pCsr uintptr = cur
 30295  	unionFinalizeCsrStmt(tls, pCsr)
 30296  	sqlite3.Xsqlite3_free(tls, pCsr)
 30297  	return SQLITE_OK
 30298  }
 30299  
 30300  // This function does the work of the xNext() method. Except that, if it
 30301  // returns SQLITE_ROW, it should be called again within the same xNext()
 30302  // method call. See unionNext() for details.
 30303  func doUnionNext(tls *libc.TLS, pCsr uintptr) int32 { /* unionvtab.c:1057:12: */
 30304  	bp := tls.Alloc(28)
 30305  	defer tls.Free(28)
 30306  
 30307  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK
 30308  
 30309  	if sqlite3.Xsqlite3_step(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt) != SQLITE_ROW {
 30310  		var pTab uintptr = (*UnionCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 30311  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = unionFinalizeCsrStmt(tls, pCsr)
 30312  		if (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && ((*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0) {
 30313  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiTab++
 30314  			if (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc {
 30315  				var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*72)
 30316  				if (*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid >= (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin {
 30317  					// It is necessary to scan the next table.
 30318  					*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = unionOpenDatabase(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 30319  					(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = unionPreparePrintf(tls, bp+24 /* &rc */, (pTab /* &.base */ + 16 /* &.zErrMsg */), (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb,
 30320  						ts+8719, /* "SELECT rowid, * ..." */
 30321  						libc.VaList(bp, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab,
 30322  							func() uintptr {
 30323  								if (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax > (*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid {
 30324  									return ts + 8751 /* "WHERE _rowid_ <=" */
 30325  								}
 30326  								return ts + 8768 /* "-- " */
 30327  							}(),
 30328  							(*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid))
 30329  					if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
 30330  
 30331  						unionIncrRefcount(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)
 30332  						*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_ROW
 30333  					}
 30334  				}
 30335  			}
 30336  		}
 30337  	}
 30338  
 30339  	return *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
 30340  }
 30341  
 30342  // xNext
 30343  func unionNext(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1092:12: */
 30344  	var rc int32
 30345  	for ok := true; ok; ok = (rc == SQLITE_ROW) {
 30346  		rc = doUnionNext(tls, cur)
 30347  	}
 30348  	return rc
 30349  }
 30350  
 30351  // xColumn
 30352  func unionColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* unionvtab.c:1103:12: */
 30353  	var pCsr uintptr = cur
 30354  	sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt, (i+1)))
 30355  	return SQLITE_OK
 30356  }
 30357  
 30358  // xRowid
 30359  func unionRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* unionvtab.c:1116:12: */
 30360  	var pCsr uintptr = cur
 30361  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt, 0)
 30362  	return SQLITE_OK
 30363  }
 30364  
 30365  // xEof
 30366  func unionEof(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1125:12: */
 30367  	var pCsr uintptr = cur
 30368  	return (libc.Bool32((*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 30369  }
 30370  
 30371  // xFilter
 30372  func unionFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* unionvtab.c:1133:12: */
 30373  	bp := tls.Alloc(108)
 30374  	defer tls.Free(108)
 30375  
 30376  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 30377  	var pCsr uintptr = pVtabCursor
 30378  	*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_OK
 30379  	var i int32
 30380  	var zSql uintptr = uintptr(0)
 30381  	var bZero int32 = 0
 30382  
 30383  	var iMin sqlite3_int64 = ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))
 30384  	var iMax sqlite3_int64 = (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))
 30385  
 30386  	_ = idxStr // Suppress harmless warning
 30387  
 30388  	if idxNum == SQLITE_INDEX_CONSTRAINT_EQ {
 30389  
 30390  		iMin = libc.AssignInt64(&iMax, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 30391  	} else {
 30392  
 30393  		if (idxNum & (SQLITE_INDEX_CONSTRAINT_LE | SQLITE_INDEX_CONSTRAINT_LT)) != 0 {
 30394  
 30395  			iMax = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30396  			if (idxNum & SQLITE_INDEX_CONSTRAINT_LT) != 0 {
 30397  				if iMax == ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) {
 30398  					bZero = 1
 30399  				} else {
 30400  					iMax--
 30401  				}
 30402  			}
 30403  		}
 30404  
 30405  		if (idxNum & (SQLITE_INDEX_CONSTRAINT_GE | SQLITE_INDEX_CONSTRAINT_GT)) != 0 {
 30406  
 30407  			iMin = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr((argc-1))*8)))
 30408  			if (idxNum & SQLITE_INDEX_CONSTRAINT_GT) != 0 {
 30409  				if iMin == (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) {
 30410  					bZero = 1
 30411  				} else {
 30412  					iMin++
 30413  				}
 30414  			}
 30415  		}
 30416  	}
 30417  
 30418  	unionFinalizeCsrStmt(tls, pCsr)
 30419  	if bZero != 0 {
 30420  		return SQLITE_OK
 30421  	}
 30422  
 30423  	for i = 0; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 30424  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*72)
 30425  		if (iMin > (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax) || (iMax < (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin) {
 30426  			continue
 30427  		}
 30428  
 30429  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8772 /* "%z%sSELECT rowid..." */, libc.VaList(bp, zSql, func() uintptr {
 30430  			if zSql != 0 {
 30431  				return ts + 8806 /* " UNION ALL " */
 30432  			}
 30433  			return ts + 489 /* "" */
 30434  		}(), func() uintptr {
 30435  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 30436  				return ts + 5485 /* "'" */
 30437  			}
 30438  			return ts + 489 /* "" */
 30439  		}(), func() uintptr {
 30440  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 30441  				return (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb
 30442  			}
 30443  			return ts + 489 /* "" */
 30444  		}(), func() uintptr {
 30445  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 30446  				return ts + 5487 /* "'." */
 30447  			}
 30448  			return ts + 489 /* "" */
 30449  		}(), (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab))
 30450  		if zSql == uintptr(0) {
 30451  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM
 30452  			break
 30453  		}
 30454  
 30455  		if iMin == iMax {
 30456  			zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8818 /* "%z WHERE rowid=%..." */, libc.VaList(bp+48, zSql, iMin))
 30457  		} else {
 30458  			var zWhere uintptr = ts + 8838 /* "WHERE" */
 30459  			if (iMin != ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))) && (iMin > (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin) {
 30460  				zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8844 /* "%z WHERE rowid>=..." */, libc.VaList(bp+64, zSql, iMin))
 30461  				zWhere = ts + 8865 /* "AND" */
 30462  			}
 30463  			if (iMax != (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) && (iMax < (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax) {
 30464  				zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8869 /* "%z %s rowid<=%ll..." */, libc.VaList(bp+80, zSql, zWhere, iMax))
 30465  			}
 30466  		}
 30467  
 30468  		if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 30469  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiTab = i
 30470  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid = iMax
 30471  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = unionOpenDatabase(tls, pTab, i, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 30472  			break
 30473  		}
 30474  	}
 30475  
 30476  	if zSql == uintptr(0) {
 30477  		return *(*int32)(unsafe.Pointer(bp + 104 /* rc */))
 30478  	} else {
 30479  		var db uintptr = func() uintptr {
 30480  			if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 30481  				return (*UnionSrc)(unsafe.Pointer(((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*72))).Fdb
 30482  			}
 30483  			return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 30484  		}()
 30485  		(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = unionPrepare(tls, bp+104 /* &rc */, db, zSql, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 30486  		if (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 30487  			unionIncrRefcount(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)
 30488  		}
 30489  		sqlite3.Xsqlite3_free(tls, zSql)
 30490  	}
 30491  	if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != SQLITE_OK {
 30492  		return *(*int32)(unsafe.Pointer(bp + 104 /* rc */))
 30493  	}
 30494  	return unionNext(tls, pVtabCursor)
 30495  }
 30496  
 30497  // xBestIndex.
 30498  //
 30499  // This implementation searches for constraints on the rowid field. EQ,
 30500  // LE, LT, GE and GT are handled.
 30501  //
 30502  // If there is an EQ comparison, then idxNum is set to INDEX_CONSTRAINT_EQ.
 30503  // In this case the only argument passed to xFilter is the rhs of the ==
 30504  // operator.
 30505  //
 30506  // Otherwise, if an LE or LT constraint is found, then the INDEX_CONSTRAINT_LE
 30507  // or INDEX_CONSTRAINT_LT (but not both) bit is set in idxNum. The first
 30508  // argument to xFilter is the rhs of the <= or < operator.  Similarly, if
 30509  // an GE or GT constraint is found, then the INDEX_CONSTRAINT_GE or
 30510  // INDEX_CONSTRAINT_GT bit is set in idxNum. The rhs of the >= or > operator
 30511  // is passed as either the first or second argument to xFilter, depending
 30512  // on whether or not there is also a LT|LE constraint.
 30513  func unionBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* unionvtab.c:1266:12: */
 30514  	var pTab uintptr = tab
 30515  	var iEq int32 = -1
 30516  	var iLt int32 = -1
 30517  	var iGt int32 = -1
 30518  	var i int32
 30519  
 30520  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 30521  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 30522  		if ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0) && (((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn < 0) || ((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == (*UnionTab)(unsafe.Pointer(pTab)).FiPK)) {
 30523  			switch int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) {
 30524  			case SQLITE_INDEX_CONSTRAINT_EQ:
 30525  				iEq = i
 30526  				break
 30527  				fallthrough
 30528  			case SQLITE_INDEX_CONSTRAINT_LE:
 30529  				fallthrough
 30530  			case SQLITE_INDEX_CONSTRAINT_LT:
 30531  				iLt = i
 30532  				break
 30533  				fallthrough
 30534  			case SQLITE_INDEX_CONSTRAINT_GE:
 30535  				fallthrough
 30536  			case SQLITE_INDEX_CONSTRAINT_GT:
 30537  				iGt = i
 30538  				break
 30539  			}
 30540  		}
 30541  	}
 30542  
 30543  	if iEq >= 0 {
 30544  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1)
 30545  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = SQLITE_INDEX_SCAN_UNIQUE
 30546  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3.0
 30547  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = SQLITE_INDEX_CONSTRAINT_EQ
 30548  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iEq)*8)).FargvIndex = 1
 30549  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iEq)*8)).Fomit = uint8(1)
 30550  	} else {
 30551  		var iCons int32 = 1
 30552  		var idxNum int32 = 0
 30553  		var nRow sqlite3_int64 = int64(1000000)
 30554  		if iLt >= 0 {
 30555  			nRow = (nRow / int64(2))
 30556  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLt)*8)).FargvIndex = libc.PostIncInt32(&iCons, 1)
 30557  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLt)*8)).Fomit = uint8(1)
 30558  			idxNum = idxNum | (int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iLt)*12)).Fop))
 30559  		}
 30560  		if iGt >= 0 {
 30561  			nRow = (nRow / int64(2))
 30562  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iGt)*8)).FargvIndex = libc.PostIncInt32(&iCons, 1)
 30563  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iGt)*8)).Fomit = uint8(1)
 30564  			idxNum = idxNum | (int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iGt)*12)).Fop))
 30565  		}
 30566  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = nRow
 30567  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (3.0 * float64(nRow))
 30568  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 30569  	}
 30570  
 30571  	return SQLITE_OK
 30572  }
 30573  
 30574  // Register the unionvtab virtual table module with database handle db.
 30575  func createUnionVtab(tls *libc.TLS, db uintptr) int32 { /* unionvtab.c:1329:12: */
 30576  	var rc int32
 30577  
 30578  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8367 /* "unionvtab" */, uintptr(unsafe.Pointer(&unionModule)), uintptr(0))
 30579  	if rc == SQLITE_OK {
 30580  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8357 /* "swarmvtab" */, uintptr(unsafe.Pointer(&unionModule)), db)
 30581  	}
 30582  	return rc
 30583  }
 30584  
 30585  var unionModule = sqlite3_module{ // iVersion
 30586  	FxCreate:     0,
 30587  	FxConnect:    0,
 30588  	FxBestIndex:  0, // xBestIndex - query planner
 30589  	FxDisconnect: 0,
 30590  	FxDestroy:    0,
 30591  	FxOpen:       0, // xOpen - open a cursor
 30592  	FxClose:      0, // xClose - close a cursor
 30593  	FxFilter:     0, // xFilter - configure scan constraints
 30594  	FxNext:       0, // xNext - advance a cursor
 30595  	FxEof:        0, // xEof - check for end of scan
 30596  	FxColumn:     0, // xColumn - read data
 30597  	FxRowid:      0, // xShadowName
 30598  } /* unionvtab.c:1330:25 */
 30599  
 30600  func sqlite3_unionvtab_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* unionvtab.c:1370:5: */
 30601  	var rc int32 = SQLITE_OK
 30602  	_ = pApi
 30603  
 30604  	_ = pzErrMsg // Suppress harmless warning
 30605  	rc = createUnionVtab(tls, db)
 30606  	return rc
 30607  }
 30608  
 30609  // A wholenumber cursor object
 30610  type wholenumber_cursor1 = struct {
 30611  	Fbase    sqlite3_vtab_cursor
 30612  	FiValue  sqlite3_int64
 30613  	FmxValue sqlite3_int64
 30614  } /* wholenumber.c:34:9 */
 30615  
 30616  // A wholenumber cursor object
 30617  type wholenumber_cursor = wholenumber_cursor1 /* wholenumber.c:34:35 */
 30618  
 30619  // Methods for the wholenumber module
 30620  func wholenumberConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* wholenumber.c:42:12: */
 30621  	var pNew uintptr
 30622  	pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 30623  	if pNew == uintptr(0) {
 30624  		return SQLITE_NOMEM
 30625  	}
 30626  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+8887 /* "CREATE TABLE x(v..." */)
 30627  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 30628  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(sqlite3_vtab{})))
 30629  	return SQLITE_OK
 30630  }
 30631  
 30632  // Note that for this virtual table, the xCreate and xConnect
 30633  // methods are identical.
 30634  
 30635  func wholenumberDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* wholenumber.c:60:12: */
 30636  	sqlite3.Xsqlite3_free(tls, pVtab)
 30637  	return SQLITE_OK
 30638  }
 30639  
 30640  // The xDisconnect and xDestroy methods are also the same
 30641  
 30642  // Open a new wholenumber cursor.
 30643  func wholenumberOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* wholenumber.c:70:12: */
 30644  	var pCur uintptr
 30645  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(wholenumber_cursor{})))
 30646  	if pCur == uintptr(0) {
 30647  		return SQLITE_NOMEM
 30648  	}
 30649  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(wholenumber_cursor{})))
 30650  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 30651  	return SQLITE_OK
 30652  }
 30653  
 30654  // Close a wholenumber cursor.
 30655  func wholenumberClose(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:82:12: */
 30656  	sqlite3.Xsqlite3_free(tls, cur)
 30657  	return SQLITE_OK
 30658  }
 30659  
 30660  // Advance a cursor to its next row of output
 30661  func wholenumberNext(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:91:12: */
 30662  	var pCur uintptr = cur
 30663  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue++
 30664  	return SQLITE_OK
 30665  }
 30666  
 30667  // Return the value associated with a wholenumber.
 30668  func wholenumberColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* wholenumber.c:100:12: */
 30669  	var pCur uintptr = cur
 30670  	sqlite3.Xsqlite3_result_int64(tls, ctx, (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue)
 30671  	return SQLITE_OK
 30672  }
 30673  
 30674  // The rowid.
 30675  func wholenumberRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* wholenumber.c:113:12: */
 30676  	var pCur uintptr = cur
 30677  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue
 30678  	return SQLITE_OK
 30679  }
 30680  
 30681  // When the wholenumber_cursor.rLimit value is 0 or less, that is a signal
 30682  // that the cursor has nothing more to output.
 30683  func wholenumberEof(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:123:12: */
 30684  	var pCur uintptr = cur
 30685  	return (libc.Bool32(((*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue > (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) || ((*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue == int64(0))))
 30686  }
 30687  
 30688  // Called to "rewind" a cursor back to the beginning so that
 30689  // it starts its output over again.  Always called at least once
 30690  // prior to any wholenumberColumn, wholenumberRowid, or wholenumberEof call.
 30691  //
 30692  //    idxNum   Constraints
 30693  //    ------   ---------------------
 30694  //      0      (none)
 30695  //      1      value > $argv0
 30696  //      2      value >= $argv0
 30697  //      4      value < $argv0
 30698  //      8      value <= $argv0
 30699  //
 30700  //      5      value > $argv0 AND value < $argv1
 30701  //      6      value >= $argv0 AND value < $argv1
 30702  //      9      value > $argv0 AND value <= $argv1
 30703  //     10      value >= $argv0 AND value <= $argv1
 30704  func wholenumberFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* wholenumber.c:146:12: */
 30705  	var pCur uintptr = pVtabCursor
 30706  	var v sqlite3_int64
 30707  	var i int32 = 0
 30708  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue = int64(1)
 30709  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0xffffffff) // 4294967295
 30710  	if (idxNum & 3) != 0 {
 30711  		v = (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + (sqlite3_int64(idxNum & 1)))
 30712  		if (v > (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue) && (v <= (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) {
 30713  			(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue = v
 30714  		}
 30715  		i++
 30716  	}
 30717  	if (idxNum & 12) != 0 {
 30718  		v = (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) - (sqlite3_int64((idxNum >> 2) & 1)))
 30719  		if (v >= (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue) && (v < (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) {
 30720  			(*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue = v
 30721  		}
 30722  	}
 30723  	return SQLITE_OK
 30724  }
 30725  
 30726  // Search for terms of these forms:
 30727  //
 30728  //  (1)  value > $value
 30729  //  (2)  value >= $value
 30730  //  (4)  value < $value
 30731  //  (8)  value <= $value
 30732  //
 30733  // idxNum is an ORed combination of 1 or 2 with 4 or 8.
 30734  func wholenumberBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* wholenumber.c:178:12: */
 30735  	var i int32
 30736  	var idxNum int32 = 0
 30737  	var argvIdx int32 = 1
 30738  	var ltIdx int32 = -1
 30739  	var gtIdx int32 = -1
 30740  	var pConstraint uintptr
 30741  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 30742  	i = 0
 30743  __1:
 30744  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 30745  		goto __3
 30746  	}
 30747  	{
 30748  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 30749  			goto __2
 30750  		}
 30751  		if ((idxNum & 3) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_GT) {
 30752  			idxNum = idxNum | (1)
 30753  			ltIdx = i
 30754  		}
 30755  		if ((idxNum & 3) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_GE) {
 30756  			idxNum = idxNum | (2)
 30757  			ltIdx = i
 30758  		}
 30759  		if ((idxNum & 12) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) {
 30760  			idxNum = idxNum | (4)
 30761  			gtIdx = i
 30762  		}
 30763  		if ((idxNum & 12) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE) {
 30764  			idxNum = idxNum | (8)
 30765  			gtIdx = i
 30766  		}
 30767  
 30768  	}
 30769  	goto __2
 30770  __2:
 30771  	i++
 30772  	pConstraint += 12
 30773  	goto __1
 30774  	goto __3
 30775  __3:
 30776  	;
 30777  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 30778  	if ltIdx >= 0 {
 30779  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ltIdx)*8)).FargvIndex = libc.PostIncInt32(&argvIdx, 1)
 30780  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ltIdx)*8)).Fomit = uint8(1)
 30781  	}
 30782  	if gtIdx >= 0 {
 30783  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(gtIdx)*8)).FargvIndex = argvIdx
 30784  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(gtIdx)*8)).Fomit = uint8(1)
 30785  	}
 30786  	if ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 30787  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 30788  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 30789  	}
 30790  	if (idxNum & 12) == 0 {
 30791  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e99
 30792  	} else if (idxNum & 3) == 0 {
 30793  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(5)
 30794  	} else {
 30795  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1)
 30796  	}
 30797  	return SQLITE_OK
 30798  }
 30799  
 30800  // A virtual table module that provides read-only access to a
 30801  // Tcl global variable namespace.
 30802  var wholenumberModule = sqlite3_module{ // iVersion
 30803  	FxCreate:     0,
 30804  	FxConnect:    0,
 30805  	FxBestIndex:  0,
 30806  	FxDisconnect: 0,
 30807  	FxDestroy:    0,
 30808  	FxOpen:       0, // xOpen - open a cursor
 30809  	FxClose:      0, // xClose - close a cursor
 30810  	FxFilter:     0, // xFilter - configure scan constraints
 30811  	FxNext:       0, // xNext - advance a cursor
 30812  	FxEof:        0, // xEof - check for end of scan
 30813  	FxColumn:     0, // xColumn - read data
 30814  	FxRowid:      0, // xRename
 30815  } /* wholenumber.c:236:23 */
 30816  
 30817  func sqlite3_wholenumber_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* wholenumber.c:264:5: */
 30818  	var rc int32 = SQLITE_OK
 30819  	_ = pApi
 30820  
 30821  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8909 /* "wholenumber" */, uintptr(unsafe.Pointer(&wholenumberModule)), uintptr(0))
 30822  	return rc
 30823  }
 30824  
 30825  // A null pointer constant.
 30826  
 30827  // Offset of member MEMBER in a struct of type TYPE.
 30828  
 30829  // Type whose alignment is supported in every context and is at least
 30830  //    as great as that of any standard type not using alignment
 30831  //    specifiers.
 30832  type max_align_t = struct {
 30833  	F__max_align_ll int64
 30834  	F__max_align_ld float64
 30835  } /* stddef.h:426:3 */
 30836  
 30837  type z_size_t = size_t /* zconf.h:254:21 */
 30838  
 30839  // Maximum value for memLevel in deflateInit2
 30840  
 30841  // Maximum value for windowBits in deflateInit2 and inflateInit2.
 30842  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 30843  // created by gzip. (Files created by minigzip can still be extracted by
 30844  // gzip.)
 30845  
 30846  // The memory requirements for deflate are (in bytes):
 30847  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
 30848  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 30849  //  plus a few kilobytes for small objects. For example, if you want to reduce
 30850  //  the default memory requirements from 256K to 128K, compile with
 30851  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 30852  //  Of course this will generally degrade compression (there's no free lunch).
 30853  //
 30854  //    The memory requirements for inflate are (in bytes) 1 << windowBits
 30855  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
 30856  //  for small objects.
 30857  
 30858  // Type declarations
 30859  
 30860  // The following definitions for FAR are needed only for MSDOS mixed
 30861  // model programming (small or medium model with some far allocations).
 30862  // This was tested only with MSC; for other MSDOS compilers you may have
 30863  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 30864  // just define FAR to be empty.
 30865  
 30866  type Byte = uint8   /* zconf.h:397:24 */ // 8 bits
 30867  type uInt = uint32  /* zconf.h:399:24 */ // 16 bits or more
 30868  type uLong = uint64 /* zconf.h:400:24 */ // 32 bits or more
 30869  
 30870  type Bytef = Byte   /* zconf.h:406:22 */
 30871  type charf = int8   /* zconf.h:408:19 */
 30872  type intf = int32   /* zconf.h:409:19 */
 30873  type uIntf = uInt   /* zconf.h:410:19 */
 30874  type uLongf = uLong /* zconf.h:411:19 */
 30875  
 30876  type voidpc = uintptr /* zconf.h:414:23 */
 30877  type voidpf = uintptr /* zconf.h:415:23 */
 30878  type voidp = uintptr  /* zconf.h:416:23 */
 30879  
 30880  // -
 30881  // SPDX-License-Identifier: BSD-3-Clause
 30882  //
 30883  // Copyright (c) 1988, 1993
 30884  //	The Regents of the University of California.  All rights reserved.
 30885  //
 30886  // Redistribution and use in source and binary forms, with or without
 30887  // modification, are permitted provided that the following conditions
 30888  // are met:
 30889  // 1. Redistributions of source code must retain the above copyright
 30890  //    notice, this list of conditions and the following disclaimer.
 30891  // 2. Redistributions in binary form must reproduce the above copyright
 30892  //    notice, this list of conditions and the following disclaimer in the
 30893  //    documentation and/or other materials provided with the distribution.
 30894  // 3. Neither the name of the University nor the names of its contributors
 30895  //    may be used to endorse or promote products derived from this software
 30896  //    without specific prior written permission.
 30897  //
 30898  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 30899  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 30900  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 30901  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 30902  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 30903  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 30904  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 30905  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30906  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 30907  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 30908  // SUCH DAMAGE.
 30909  //
 30910  //	@(#)limits.h	8.2 (Berkeley) 1/4/94
 30911  // $FreeBSD$
 30912  
 30913  // -
 30914  // SPDX-License-Identifier: BSD-3-Clause
 30915  //
 30916  // Copyright (c) 1991, 1993
 30917  //	The Regents of the University of California.  All rights reserved.
 30918  //
 30919  // This code is derived from software contributed to Berkeley by
 30920  // Berkeley Software Design, Inc.
 30921  //
 30922  // Redistribution and use in source and binary forms, with or without
 30923  // modification, are permitted provided that the following conditions
 30924  // are met:
 30925  // 1. Redistributions of source code must retain the above copyright
 30926  //    notice, this list of conditions and the following disclaimer.
 30927  // 2. Redistributions in binary form must reproduce the above copyright
 30928  //    notice, this list of conditions and the following disclaimer in the
 30929  //    documentation and/or other materials provided with the distribution.
 30930  // 3. Neither the name of the University nor the names of its contributors
 30931  //    may be used to endorse or promote products derived from this software
 30932  //    without specific prior written permission.
 30933  //
 30934  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 30935  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 30936  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 30937  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 30938  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 30939  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 30940  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 30941  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30942  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 30943  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 30944  // SUCH DAMAGE.
 30945  //
 30946  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 30947  // $FreeBSD$
 30948  
 30949  // -
 30950  // SPDX-License-Identifier: BSD-3-Clause
 30951  //
 30952  // Copyright (c) 1988, 1993
 30953  //	The Regents of the University of California.  All rights reserved.
 30954  //
 30955  // Redistribution and use in source and binary forms, with or without
 30956  // modification, are permitted provided that the following conditions
 30957  // are met:
 30958  // 1. Redistributions of source code must retain the above copyright
 30959  //    notice, this list of conditions and the following disclaimer.
 30960  // 2. Redistributions in binary form must reproduce the above copyright
 30961  //    notice, this list of conditions and the following disclaimer in the
 30962  //    documentation and/or other materials provided with the distribution.
 30963  // 3. Neither the name of the University nor the names of its contributors
 30964  //    may be used to endorse or promote products derived from this software
 30965  //    without specific prior written permission.
 30966  //
 30967  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 30968  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 30969  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 30970  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 30971  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 30972  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 30973  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 30974  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 30975  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 30976  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 30977  // SUCH DAMAGE.
 30978  //
 30979  // $FreeBSD$
 30980  
 30981  // -
 30982  // SPDX-License-Identifier: BSD-3-Clause
 30983  //
 30984  // Copyright (c) 1991, 1993
 30985  //	The Regents of the University of California.  All rights reserved.
 30986  //
 30987  // This code is derived from software contributed to Berkeley by
 30988  // Berkeley Software Design, Inc.
 30989  //
 30990  // Redistribution and use in source and binary forms, with or without
 30991  // modification, are permitted provided that the following conditions
 30992  // are met:
 30993  // 1. Redistributions of source code must retain the above copyright
 30994  //    notice, this list of conditions and the following disclaimer.
 30995  // 2. Redistributions in binary form must reproduce the above copyright
 30996  //    notice, this list of conditions and the following disclaimer in the
 30997  //    documentation and/or other materials provided with the distribution.
 30998  // 3. Neither the name of the University nor the names of its contributors
 30999  //    may be used to endorse or promote products derived from this software
 31000  //    without specific prior written permission.
 31001  //
 31002  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 31003  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 31004  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 31005  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 31006  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 31007  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 31008  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 31009  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 31010  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 31011  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 31012  // SUCH DAMAGE.
 31013  //
 31014  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 31015  // $FreeBSD$
 31016  
 31017  // -
 31018  // This file is in the public domain.
 31019  // $FreeBSD$
 31020  
 31021  // -
 31022  // SPDX-License-Identifier: BSD-3-Clause
 31023  //
 31024  // Copyright (c) 1988, 1993
 31025  //	The Regents of the University of California.  All rights reserved.
 31026  //
 31027  // Redistribution and use in source and binary forms, with or without
 31028  // modification, are permitted provided that the following conditions
 31029  // are met:
 31030  // 1. Redistributions of source code must retain the above copyright
 31031  //    notice, this list of conditions and the following disclaimer.
 31032  // 2. Redistributions in binary form must reproduce the above copyright
 31033  //    notice, this list of conditions and the following disclaimer in the
 31034  //    documentation and/or other materials provided with the distribution.
 31035  // 3. Neither the name of the University nor the names of its contributors
 31036  //    may be used to endorse or promote products derived from this software
 31037  //    without specific prior written permission.
 31038  //
 31039  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 31040  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 31041  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 31042  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 31043  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 31044  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 31045  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 31046  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 31047  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 31048  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 31049  // SUCH DAMAGE.
 31050  //
 31051  //	@(#)limits.h	8.3 (Berkeley) 1/4/94
 31052  // $FreeBSD$
 31053  
 31054  // -
 31055  // SPDX-License-Identifier: BSD-3-Clause
 31056  //
 31057  // Copyright (c) 1988, 1993
 31058  //	The Regents of the University of California.  All rights reserved.
 31059  //
 31060  // Redistribution and use in source and binary forms, with or without
 31061  // modification, are permitted provided that the following conditions
 31062  // are met:
 31063  // 1. Redistributions of source code must retain the above copyright
 31064  //    notice, this list of conditions and the following disclaimer.
 31065  // 2. Redistributions in binary form must reproduce the above copyright
 31066  //    notice, this list of conditions and the following disclaimer in the
 31067  //    documentation and/or other materials provided with the distribution.
 31068  // 3. Neither the name of the University nor the names of its contributors
 31069  //    may be used to endorse or promote products derived from this software
 31070  //    without specific prior written permission.
 31071  //
 31072  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 31073  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 31074  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 31075  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 31076  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 31077  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 31078  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 31079  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 31080  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 31081  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 31082  // SUCH DAMAGE.
 31083  //
 31084  //	@(#)syslimits.h	8.1 (Berkeley) 6/2/93
 31085  // $FreeBSD$
 31086  
 31087  // Do not add any new variables here.  (See the comment at the end of
 31088  // the file for why.)
 31089  
 31090  // We leave the following values undefined to force applications to either
 31091  // assume conservative values or call sysconf() to get the current value.
 31092  //
 31093  // HOST_NAME_MAX
 31094  //
 31095  // (We should do this for most of the values currently defined here,
 31096  // but many programs are not prepared to deal with this yet.)
 31097  
 31098  type z_crc_t = uint32 /* zconf.h:435:17 */
 31099  
 31100  // These declarations belong elsewhere, but are repeated here and in
 31101  // <stdio.h> to give broken programs a better chance of working with
 31102  // 64-bit off_t's.
 31103  
 31104  // Copyright (C) 1989-2020 Free Software Foundation, Inc.
 31105  //
 31106  // This file is part of GCC.
 31107  //
 31108  // GCC is free software; you can redistribute it and/or modify
 31109  // it under the terms of the GNU General Public License as published by
 31110  // the Free Software Foundation; either version 3, or (at your option)
 31111  // any later version.
 31112  //
 31113  // GCC is distributed in the hope that it will be useful,
 31114  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 31115  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 31116  // GNU General Public License for more details.
 31117  //
 31118  // Under Section 7 of GPL version 3, you are granted additional
 31119  // permissions described in the GCC Runtime Library Exception, version
 31120  // 3.1, as published by the Free Software Foundation.
 31121  //
 31122  // You should have received a copy of the GNU General Public License and
 31123  // a copy of the GCC Runtime Library Exception along with this program;
 31124  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 31125  // <http://www.gnu.org/licenses/>.
 31126  
 31127  // ISO C Standard:  7.15  Variable arguments  <stdarg.h>
 31128  
 31129  // a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
 31130  // "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
 31131  // though the former does not conform to the LFS document), but considering
 31132  // both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
 31133  // equivalently requesting no 64-bit operations
 31134  
 31135  // This is hard-configured for FreeBSD.
 31136  
 31137  // MVS linker does not support external names larger than 8 bytes
 31138  
 31139  //
 31140  //     The 'zlib' compression library provides in-memory compression and
 31141  //   decompression functions, including integrity checks of the uncompressed data.
 31142  //   This version of the library supports only one compression method (deflation)
 31143  //   but other algorithms will be added later and will have the same stream
 31144  //   interface.
 31145  //
 31146  //     Compression can be done in a single step if the buffers are large enough,
 31147  //   or can be done by repeated calls of the compression function.  In the latter
 31148  //   case, the application must provide more input and/or consume the output
 31149  //   (providing more output space) before each call.
 31150  //
 31151  //     The compressed data format used by default by the in-memory functions is
 31152  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
 31153  //   around a deflate stream, which is itself documented in RFC 1951.
 31154  //
 31155  //     The library also supports reading and writing files in gzip (.gz) format
 31156  //   with an interface similar to that of stdio using the functions that start
 31157  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
 31158  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
 31159  //
 31160  //     This library can optionally read and write gzip and raw deflate streams in
 31161  //   memory as well.
 31162  //
 31163  //     The zlib format was designed to be compact and fast for use in memory
 31164  //   and on communications channels.  The gzip format was designed for single-
 31165  //   file compression on file systems, has a larger header than zlib to maintain
 31166  //   directory information, and uses a different, slower check method than zlib.
 31167  //
 31168  //     The library does not install any signal handler.  The decoder checks
 31169  //   the consistency of the compressed data, so the library should never crash
 31170  //   even in the case of corrupted input.
 31171  
 31172  type alloc_func = uintptr /* zlib.h:81:16 */
 31173  type free_func = uintptr  /* zlib.h:82:16 */
 31174  
 31175  type z_stream_s = struct {
 31176  	Fnext_in   uintptr
 31177  	Favail_in  uInt
 31178  	_          [4]byte
 31179  	Ftotal_in  uLong
 31180  	Fnext_out  uintptr
 31181  	Favail_out uInt
 31182  	_          [4]byte
 31183  	Ftotal_out uLong
 31184  	Fmsg       uintptr
 31185  	Fstate     uintptr
 31186  	Fzalloc    alloc_func
 31187  	Fzfree     free_func
 31188  	Fopaque    voidpf
 31189  	Fdata_type int32
 31190  	_          [4]byte
 31191  	Fadler     uLong
 31192  	Freserved  uLong
 31193  } /* zlib.h:86:9 */
 31194  
 31195  type z_stream = z_stream_s /* zlib.h:106:3 */
 31196  
 31197  type z_streamp = uintptr /* zlib.h:108:22 */
 31198  
 31199  //
 31200  //      gzip header information passed to and from zlib routines.  See RFC 1952
 31201  //   for more details on the meanings of these fields.
 31202  type gz_header_s = struct {
 31203  	Ftext      int32
 31204  	_          [4]byte
 31205  	Ftime      uLong
 31206  	Fxflags    int32
 31207  	Fos        int32
 31208  	Fextra     uintptr
 31209  	Fextra_len uInt
 31210  	Fextra_max uInt
 31211  	Fname      uintptr
 31212  	Fname_max  uInt
 31213  	_          [4]byte
 31214  	Fcomment   uintptr
 31215  	Fcomm_max  uInt
 31216  	Fhcrc      int32
 31217  	Fdone      int32
 31218  	_          [4]byte
 31219  } /* zlib.h:114:9 */
 31220  
 31221  //
 31222  //      gzip header information passed to and from zlib routines.  See RFC 1952
 31223  //   for more details on the meanings of these fields.
 31224  type gz_header = gz_header_s /* zlib.h:129:3 */
 31225  
 31226  type gz_headerp = uintptr /* zlib.h:131:23 */
 31227  //
 31228  //      inflateGetHeader() requests that gzip header information be stored in the
 31229  //    provided gz_header structure.  inflateGetHeader() may be called after
 31230  //    inflateInit2() or inflateReset(), and before the first call of inflate().
 31231  //    As inflate() processes the gzip stream, head->done is zero until the header
 31232  //    is completed, at which time head->done is set to one.  If a zlib stream is
 31233  //    being decoded, then head->done is set to -1 to indicate that there will be
 31234  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
 31235  //    used to force inflate() to return immediately after header processing is
 31236  //    complete and before any actual data is decompressed.
 31237  //
 31238  //      The text, time, xflags, and os fields are filled in with the gzip header
 31239  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
 31240  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
 31241  //    contains the maximum number of bytes to write to extra.  Once done is true,
 31242  //    extra_len contains the actual extra field length, and extra contains the
 31243  //    extra field, or that field truncated if extra_max is less than extra_len.
 31244  //    If name is not Z_NULL, then up to name_max characters are written there,
 31245  //    terminated with a zero unless the length is greater than name_max.  If
 31246  //    comment is not Z_NULL, then up to comm_max characters are written there,
 31247  //    terminated with a zero unless the length is greater than comm_max.  When any
 31248  //    of extra, name, or comment are not Z_NULL and the respective field is not
 31249  //    present in the header, then that field is set to Z_NULL to signal its
 31250  //    absence.  This allows the use of deflateSetHeader() with the returned
 31251  //    structure to duplicate the header.  However if those fields are set to
 31252  //    allocated memory, then the application will need to save those pointers
 31253  //    elsewhere so that they can be eventually freed.
 31254  //
 31255  //      If inflateGetHeader is not used, then the header information is simply
 31256  //    discarded.  The header is always checked for validity, including the header
 31257  //    CRC if present.  inflateReset() will reset the process to discard the header
 31258  //    information.  The application would need to call inflateGetHeader() again to
 31259  //    retrieve the header from the next gzip stream.
 31260  //
 31261  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 31262  //    stream state was inconsistent.
 31263  
 31264  //
 31265  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
 31266  //                                         unsigned char FAR *window));
 31267  //
 31268  //      Initialize the internal stream state for decompression using inflateBack()
 31269  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
 31270  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
 31271  //    derived memory allocation routines are used.  windowBits is the base two
 31272  //    logarithm of the window size, in the range 8..15.  window is a caller
 31273  //    supplied buffer of that size.  Except for special applications where it is
 31274  //    assured that deflate was used with small window sizes, windowBits must be 15
 31275  //    and a 32K byte window must be supplied to be able to decompress general
 31276  //    deflate streams.
 31277  //
 31278  //      See inflateBack() for the usage of these routines.
 31279  //
 31280  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
 31281  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
 31282  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
 31283  //    the version of the header file.
 31284  
 31285  type in_func = uintptr  /* zlib.h:1093:18 */
 31286  type out_func = uintptr /* zlib.h:1095:13 */
 31287  //
 31288  //      Same as uncompress, except that sourceLen is a pointer, where the
 31289  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
 31290  //    source bytes consumed.
 31291  
 31292  // gzip file access functions
 31293  
 31294  //
 31295  //      This library supports reading and writing files in gzip (.gz) format with
 31296  //    an interface similar to that of stdio, using the functions that start with
 31297  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
 31298  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
 31299  
 31300  type gzFile_s = struct {
 31301  	Fhave uint32
 31302  	_     [4]byte
 31303  	Fnext uintptr
 31304  	Fpos  off_t
 31305  } /* zlib.h:1304:9 */
 31306  
 31307  //
 31308  //      Same as uncompress, except that sourceLen is a pointer, where the
 31309  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
 31310  //    source bytes consumed.
 31311  
 31312  // gzip file access functions
 31313  
 31314  //
 31315  //      This library supports reading and writing files in gzip (.gz) format with
 31316  //    an interface similar to that of stdio, using the functions that start with
 31317  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
 31318  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
 31319  
 31320  type gzFile = uintptr /* zlib.h:1304:25 */ // 2-byte unsigned integer
 31321  
 31322  // Definitions for mode bitmasks S_IFDIR, S_IFREG and S_IFLNK.
 31323  //
 31324  // In some ways it would be better to obtain these values from system
 31325  // header files. But, the dependency is undesirable and (a) these
 31326  // have been stable for decades, (b) the values are part of POSIX and
 31327  // are also made explicit in [man stat], and (c) are part of the
 31328  // file format for zip archives.
 31329  
 31330  var ZIPFILE_SCHEMA =
 31331  
 31332  // 0: Name of file in zip archive
 31333  // 1: POSIX mode for file
 31334  // 2: Last modification time (secs since 1970)
 31335  // 3: Size of object
 31336  // 4: Raw data
 31337  // 5: Uncompressed data
 31338  // 6: Compression method (integer)
 31339  // 7: Name of zip file
 31340  *(*[91]int8)(unsafe.Pointer(ts + 8921 /* "CREATE TABLE y(n..." */)) /* zipfile.c:91:19 */
 31341  
 31342  // Magic numbers used to read and write zip files.
 31343  //
 31344  // ZIPFILE_NEWENTRY_MADEBY:
 31345  //   Use this value for the "version-made-by" field in new zip file
 31346  //   entries. The upper byte indicates "unix", and the lower byte
 31347  //   indicates that the zip file matches pkzip specification 3.0.
 31348  //   This is what info-zip seems to do.
 31349  //
 31350  // ZIPFILE_NEWENTRY_REQUIRED:
 31351  //   Value for "version-required-to-extract" field of new entries.
 31352  //   Version 2.0 is required to support folders and deflate compression.
 31353  //
 31354  // ZIPFILE_NEWENTRY_FLAGS:
 31355  //   Value for "general-purpose-bit-flags" field of new entries. Bit
 31356  //   11 means "utf-8 filename and comment".
 31357  //
 31358  // ZIPFILE_SIGNATURE_CDS:
 31359  //   First 4 bytes of a valid CDS record.
 31360  //
 31361  // ZIPFILE_SIGNATURE_LFH:
 31362  //   First 4 bytes of a valid LFH record.
 31363  //
 31364  // ZIPFILE_SIGNATURE_EOCD
 31365  //   First 4 bytes of a valid EOCD record.
 31366  
 31367  // The sizes of the fixed-size part of each of the three main data
 31368  // structures in a zip archive.
 31369  
 31370  // 4.3.16  End of central directory record:
 31371  //
 31372  //   end of central dir signature    4 bytes  (0x06054b50)
 31373  //   number of this disk             2 bytes
 31374  //   number of the disk with the
 31375  //   start of the central directory  2 bytes
 31376  //   total number of entries in the
 31377  //   central directory on this disk  2 bytes
 31378  //   total number of entries in
 31379  //   the central directory           2 bytes
 31380  //   size of the central directory   4 bytes
 31381  //   offset of start of central
 31382  //   directory with respect to
 31383  //   the starting disk number        4 bytes
 31384  //   .ZIP file comment length        2 bytes
 31385  //   .ZIP file comment       (variable size)
 31386  type ZipfileEOCD1 = struct {
 31387  	FiDisk       u16
 31388  	FiFirstDisk  u16
 31389  	FnEntry      u16
 31390  	FnEntryTotal u16
 31391  	FnSize       u32
 31392  	FiOffset     u32
 31393  } /* zipfile.c:167:9 */
 31394  
 31395  // Magic numbers used to read and write zip files.
 31396  //
 31397  // ZIPFILE_NEWENTRY_MADEBY:
 31398  //   Use this value for the "version-made-by" field in new zip file
 31399  //   entries. The upper byte indicates "unix", and the lower byte
 31400  //   indicates that the zip file matches pkzip specification 3.0.
 31401  //   This is what info-zip seems to do.
 31402  //
 31403  // ZIPFILE_NEWENTRY_REQUIRED:
 31404  //   Value for "version-required-to-extract" field of new entries.
 31405  //   Version 2.0 is required to support folders and deflate compression.
 31406  //
 31407  // ZIPFILE_NEWENTRY_FLAGS:
 31408  //   Value for "general-purpose-bit-flags" field of new entries. Bit
 31409  //   11 means "utf-8 filename and comment".
 31410  //
 31411  // ZIPFILE_SIGNATURE_CDS:
 31412  //   First 4 bytes of a valid CDS record.
 31413  //
 31414  // ZIPFILE_SIGNATURE_LFH:
 31415  //   First 4 bytes of a valid LFH record.
 31416  //
 31417  // ZIPFILE_SIGNATURE_EOCD
 31418  //   First 4 bytes of a valid EOCD record.
 31419  
 31420  // The sizes of the fixed-size part of each of the three main data
 31421  // structures in a zip archive.
 31422  
 31423  // 4.3.16  End of central directory record:
 31424  //
 31425  //   end of central dir signature    4 bytes  (0x06054b50)
 31426  //   number of this disk             2 bytes
 31427  //   number of the disk with the
 31428  //   start of the central directory  2 bytes
 31429  //   total number of entries in the
 31430  //   central directory on this disk  2 bytes
 31431  //   total number of entries in
 31432  //   the central directory           2 bytes
 31433  //   size of the central directory   4 bytes
 31434  //   offset of start of central
 31435  //   directory with respect to
 31436  //   the starting disk number        4 bytes
 31437  //   .ZIP file comment length        2 bytes
 31438  //   .ZIP file comment       (variable size)
 31439  type ZipfileEOCD = ZipfileEOCD1 /* zipfile.c:167:28 */
 31440  
 31441  // 4.3.12  Central directory structure:
 31442  //
 31443  // ...
 31444  //
 31445  //   central file header signature   4 bytes  (0x02014b50)
 31446  //   version made by                 2 bytes
 31447  //   version needed to extract       2 bytes
 31448  //   general purpose bit flag        2 bytes
 31449  //   compression method              2 bytes
 31450  //   last mod file time              2 bytes
 31451  //   last mod file date              2 bytes
 31452  //   crc-32                          4 bytes
 31453  //   compressed size                 4 bytes
 31454  //   uncompressed size               4 bytes
 31455  //   file name length                2 bytes
 31456  //   extra field length              2 bytes
 31457  //   file comment length             2 bytes
 31458  //   disk number start               2 bytes
 31459  //   internal file attributes        2 bytes
 31460  //   external file attributes        4 bytes
 31461  //   relative offset of local header 4 bytes
 31462  type ZipfileCDS1 = struct {
 31463  	FiVersionMadeBy  u16
 31464  	FiVersionExtract u16
 31465  	Fflags           u16
 31466  	FiCompression    u16
 31467  	FmTime           u16
 31468  	FmDate           u16
 31469  	Fcrc32           u32
 31470  	FszCompressed    u32
 31471  	FszUncompressed  u32
 31472  	FnFile           u16
 31473  	FnExtra          u16
 31474  	FnComment        u16
 31475  	FiDiskStart      u16
 31476  	FiInternalAttr   u16
 31477  	_                [2]byte
 31478  	FiExternalAttr   u32
 31479  	FiOffset         u32
 31480  	_                [4]byte
 31481  	FzFile           uintptr
 31482  } /* zipfile.c:200:9 */
 31483  
 31484  // 4.3.12  Central directory structure:
 31485  //
 31486  // ...
 31487  //
 31488  //   central file header signature   4 bytes  (0x02014b50)
 31489  //   version made by                 2 bytes
 31490  //   version needed to extract       2 bytes
 31491  //   general purpose bit flag        2 bytes
 31492  //   compression method              2 bytes
 31493  //   last mod file time              2 bytes
 31494  //   last mod file date              2 bytes
 31495  //   crc-32                          4 bytes
 31496  //   compressed size                 4 bytes
 31497  //   uncompressed size               4 bytes
 31498  //   file name length                2 bytes
 31499  //   extra field length              2 bytes
 31500  //   file comment length             2 bytes
 31501  //   disk number start               2 bytes
 31502  //   internal file attributes        2 bytes
 31503  //   external file attributes        4 bytes
 31504  //   relative offset of local header 4 bytes
 31505  type ZipfileCDS = ZipfileCDS1 /* zipfile.c:200:27 */
 31506  
 31507  // 4.3.7  Local file header:
 31508  //
 31509  //   local file header signature     4 bytes  (0x04034b50)
 31510  //   version needed to extract       2 bytes
 31511  //   general purpose bit flag        2 bytes
 31512  //   compression method              2 bytes
 31513  //   last mod file time              2 bytes
 31514  //   last mod file date              2 bytes
 31515  //   crc-32                          4 bytes
 31516  //   compressed size                 4 bytes
 31517  //   uncompressed size               4 bytes
 31518  //   file name length                2 bytes
 31519  //   extra field length              2 bytes
 31520  //
 31521  type ZipfileLFH1 = struct {
 31522  	FiVersionExtract u16
 31523  	Fflags           u16
 31524  	FiCompression    u16
 31525  	FmTime           u16
 31526  	FmDate           u16
 31527  	_                [2]byte
 31528  	Fcrc32           u32
 31529  	FszCompressed    u32
 31530  	FszUncompressed  u32
 31531  	FnFile           u16
 31532  	FnExtra          u16
 31533  } /* zipfile.c:237:9 */
 31534  
 31535  // 4.3.7  Local file header:
 31536  //
 31537  //   local file header signature     4 bytes  (0x04034b50)
 31538  //   version needed to extract       2 bytes
 31539  //   general purpose bit flag        2 bytes
 31540  //   compression method              2 bytes
 31541  //   last mod file time              2 bytes
 31542  //   last mod file date              2 bytes
 31543  //   crc-32                          4 bytes
 31544  //   compressed size                 4 bytes
 31545  //   uncompressed size               4 bytes
 31546  //   file name length                2 bytes
 31547  //   extra field length              2 bytes
 31548  //
 31549  type ZipfileLFH = ZipfileLFH1 /* zipfile.c:237:27 */
 31550  
 31551  type ZipfileEntry1 = struct {
 31552  	Fcds       ZipfileCDS
 31553  	FmUnixTime u32
 31554  	_          [4]byte
 31555  	FaExtra    uintptr
 31556  	FiDataOff  i64
 31557  	FaData     uintptr
 31558  	FpNext     uintptr
 31559  } /* zipfile.c:251:9 */
 31560  
 31561  type ZipfileEntry = ZipfileEntry1 /* zipfile.c:251:29 */
 31562  
 31563  // Cursor type for zipfile tables.
 31564  type ZipfileCsr1 = struct {
 31565  	Fbase       sqlite3_vtab_cursor
 31566  	FiId        i64
 31567  	FbEof       u8
 31568  	FbNoop      u8
 31569  	_           [6]byte
 31570  	FpFile      uintptr
 31571  	FiNextOff   i64
 31572  	Feocd       ZipfileEOCD
 31573  	FpFreeEntry uintptr
 31574  	FpCurrent   uintptr
 31575  	FpCsrNext   uintptr
 31576  } /* zipfile.c:264:9 */
 31577  
 31578  // Cursor type for zipfile tables.
 31579  type ZipfileCsr = ZipfileCsr1 /* zipfile.c:264:27 */
 31580  
 31581  type ZipfileTab1 = struct {
 31582  	Fbase        sqlite3_vtab
 31583  	FzFile       uintptr
 31584  	Fdb          uintptr
 31585  	FaBuffer     uintptr
 31586  	FpCsrList    uintptr
 31587  	FiNextCsrid  i64
 31588  	FpFirstEntry uintptr
 31589  	FpLastEntry  uintptr
 31590  	FpWriteFd    uintptr
 31591  	FszCurrent   i64
 31592  	FszOrig      i64
 31593  } /* zipfile.c:281:9 */
 31594  
 31595  type ZipfileTab = ZipfileTab1 /* zipfile.c:281:27 */
 31596  
 31597  // Set the error message contained in context ctx to the results of
 31598  // vprintf(zFmt, ...).
 31599  func zipfileCtxErrorMsg(tls *libc.TLS, ctx uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:303:13: */
 31600  	var zMsg uintptr = uintptr(0)
 31601  	var ap va_list
 31602  	_ = ap
 31603  	ap = va
 31604  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 31605  	sqlite3.Xsqlite3_result_error(tls, ctx, zMsg, -1)
 31606  	sqlite3.Xsqlite3_free(tls, zMsg)
 31607  	_ = ap
 31608  }
 31609  
 31610  // If string zIn is quoted, dequote it in place. Otherwise, if the string
 31611  // is not quoted, do nothing.
 31612  func zipfileDequote(tls *libc.TLS, zIn uintptr) { /* zipfile.c:317:13: */
 31613  	var q int8 = *(*int8)(unsafe.Pointer(zIn))
 31614  	if (((int32(q) == '"') || (int32(q) == '\'')) || (int32(q) == '`')) || (int32(q) == '[') {
 31615  		var iIn int32 = 1
 31616  		var iOut int32 = 0
 31617  		if int32(q) == '[' {
 31618  			q = int8(']')
 31619  		}
 31620  		for *(*int8)(unsafe.Pointer(zIn + uintptr(iIn))) != 0 {
 31621  			var c int8 = *(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iIn, 1))))
 31622  			if (int32(c) == int32(q)) && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iIn, 1))))) != int32(q)) {
 31623  				break
 31624  			}
 31625  			*(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iOut, 1)))) = c
 31626  		}
 31627  		*(*int8)(unsafe.Pointer(zIn + uintptr(iOut))) = int8(0)
 31628  	}
 31629  }
 31630  
 31631  // Construct a new ZipfileTab virtual table object.
 31632  //
 31633  //   argv[0]   -> module name  ("zipfile")
 31634  //   argv[1]   -> database name
 31635  //   argv[2]   -> table name
 31636  //   argv[...] -> "column name" and other module argument fields.
 31637  func zipfileConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* zipfile.c:340:12: */
 31638  	var nByte int32 = (int32(uint64(unsafe.Sizeof(ZipfileTab{})) + (uint64(64 * 1024))))
 31639  	var nFile int32 = 0
 31640  	var zFile uintptr = uintptr(0)
 31641  	var pNew uintptr = uintptr(0)
 31642  	var rc int32
 31643  
 31644  	// If the table name is not "zipfile", require that the argument be
 31645  	// specified. This stops zipfile tables from being created as:
 31646  	//
 31647  	//   CREATE VIRTUAL TABLE zzz USING zipfile();
 31648  	//
 31649  	// It does not prevent:
 31650  	//
 31651  	//   CREATE VIRTUAL TABLE zipfile USING zipfile();
 31652  
 31653  	if ((0 != sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+9012 /* "zipfile" */)) && (argc < 4)) || (argc > 4) {
 31654  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9020 /* "zipfile construc..." */, 0)
 31655  		return SQLITE_ERROR
 31656  	}
 31657  
 31658  	if argc > 3 {
 31659  		zFile = *(*uintptr)(unsafe.Pointer(argv + 3*8))
 31660  		nFile = (int32(libc.Xstrlen(tls, zFile)) + 1)
 31661  	}
 31662  
 31663  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, uintptr(unsafe.Pointer(&ZIPFILE_SCHEMA)))
 31664  	if rc == SQLITE_OK {
 31665  		pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64(sqlite3_int64(nByte) + sqlite3_int64(nFile))))
 31666  		if pNew == uintptr(0) {
 31667  			return SQLITE_NOMEM
 31668  		}
 31669  		libc.Xmemset(tls, pNew, 0, (uint64(nByte + nFile)))
 31670  		(*ZipfileTab)(unsafe.Pointer(pNew)).Fdb = db
 31671  		(*ZipfileTab)(unsafe.Pointer(pNew)).FaBuffer = (pNew + 1*104)
 31672  		if zFile != 0 {
 31673  			(*ZipfileTab)(unsafe.Pointer(pNew)).FzFile = ((*ZipfileTab)(unsafe.Pointer(pNew)).FaBuffer + 65536)
 31674  			libc.Xmemcpy(tls, (*ZipfileTab)(unsafe.Pointer(pNew)).FzFile, zFile, uint64(nFile))
 31675  			zipfileDequote(tls, (*ZipfileTab)(unsafe.Pointer(pNew)).FzFile)
 31676  		}
 31677  	}
 31678  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 31679  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 31680  	return rc
 31681  }
 31682  
 31683  // Free the ZipfileEntry structure indicated by the only argument.
 31684  func zipfileEntryFree(tls *libc.TLS, p uintptr) { /* zipfile.c:394:13: */
 31685  	if p != 0 {
 31686  		sqlite3.Xsqlite3_free(tls, (*ZipfileEntry)(unsafe.Pointer(p)).Fcds.FzFile)
 31687  		sqlite3.Xsqlite3_free(tls, p)
 31688  	}
 31689  }
 31690  
 31691  // Release resources that should be freed at the end of a write
 31692  // transaction.
 31693  func zipfileCleanupTransaction(tls *libc.TLS, pTab uintptr) { /* zipfile.c:405:13: */
 31694  	var pEntry uintptr
 31695  	var pNext uintptr
 31696  
 31697  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd != 0 {
 31698  		libc.Xfclose(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)
 31699  		(*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd = uintptr(0)
 31700  	}
 31701  	for pEntry = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry; pEntry != 0; pEntry = pNext {
 31702  		pNext = (*ZipfileEntry)(unsafe.Pointer(pEntry)).FpNext
 31703  		zipfileEntryFree(tls, pEntry)
 31704  	}
 31705  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = uintptr(0)
 31706  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry = uintptr(0)
 31707  	(*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent = int64(0)
 31708  	(*ZipfileTab)(unsafe.Pointer(pTab)).FszOrig = int64(0)
 31709  }
 31710  
 31711  // This method is the destructor for zipfile vtab objects.
 31712  func zipfileDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:426:12: */
 31713  	zipfileCleanupTransaction(tls, pVtab)
 31714  	sqlite3.Xsqlite3_free(tls, pVtab)
 31715  	return SQLITE_OK
 31716  }
 31717  
 31718  // Constructor for a new ZipfileCsr object.
 31719  func zipfileOpen(tls *libc.TLS, p uintptr, ppCsr uintptr) int32 { /* zipfile.c:435:12: */
 31720  	var pTab uintptr = p
 31721  	var pCsr uintptr
 31722  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ZipfileCsr{})))
 31723  	*(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr
 31724  	if pCsr == uintptr(0) {
 31725  		return SQLITE_NOMEM
 31726  	}
 31727  	libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(ZipfileCsr{})))
 31728  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId = libc.PreIncInt64(&(*ZipfileTab)(unsafe.Pointer(pTab)).FiNextCsrid, 1)
 31729  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList
 31730  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList = pCsr
 31731  	return SQLITE_OK
 31732  }
 31733  
 31734  // Reset a cursor back to the state it was in when first returned
 31735  // by zipfileOpen().
 31736  func zipfileResetCursor(tls *libc.TLS, pCsr uintptr) { /* zipfile.c:454:13: */
 31737  	var p uintptr
 31738  	var pNext uintptr
 31739  
 31740  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(0)
 31741  	if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile != 0 {
 31742  		libc.Xfclose(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile)
 31743  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile = uintptr(0)
 31744  		zipfileEntryFree(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)
 31745  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = uintptr(0)
 31746  	}
 31747  
 31748  	for p = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry; p != 0; p = pNext {
 31749  		pNext = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext
 31750  		zipfileEntryFree(tls, p)
 31751  	}
 31752  }
 31753  
 31754  // Destructor for an ZipfileCsr.
 31755  func zipfileClose(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:475:12: */
 31756  	var pCsr uintptr = cur
 31757  	var pTab uintptr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 31758  	var pp uintptr
 31759  	zipfileResetCursor(tls, pCsr)
 31760  
 31761  	// Remove this cursor from the ZipfileTab.pCsrList list.
 31762  	for pp = (pTab + 48 /* &.pCsrList */); *(*uintptr)(unsafe.Pointer(pp)) != pCsr; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 72 /* &.pCsrNext */) {
 31763  	}
 31764  	*(*uintptr)(unsafe.Pointer(pp)) = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext
 31765  
 31766  	sqlite3.Xsqlite3_free(tls, pCsr)
 31767  	return SQLITE_OK
 31768  }
 31769  
 31770  // Set the error message for the virtual table associated with cursor
 31771  // pCsr to the results of vprintf(zFmt, ...).
 31772  func zipfileTableErr(tls *libc.TLS, pTab uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:493:13: */
 31773  	var ap va_list
 31774  	_ = ap
 31775  	ap = va
 31776  	sqlite3.Xsqlite3_free(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg)
 31777  	(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 31778  	_ = ap
 31779  }
 31780  
 31781  func zipfileCursorErr(tls *libc.TLS, pCsr uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:500:13: */
 31782  	var ap va_list
 31783  	_ = ap
 31784  	ap = va
 31785  	sqlite3.Xsqlite3_free(tls, (*sqlite3_vtab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg)
 31786  	(*sqlite3_vtab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 31787  	_ = ap
 31788  }
 31789  
 31790  // Read nRead bytes of data from offset iOff of file pFile into buffer
 31791  // aRead[]. Return SQLITE_OK if successful, or an SQLite error code
 31792  // otherwise.
 31793  //
 31794  // If an error does occur, output variable (*pzErrmsg) may be set to point
 31795  // to an English language error message. It is the responsibility of the
 31796  // caller to eventually free this buffer using
 31797  // sqlite3_free().
 31798  func zipfileReadData(tls *libc.TLS, pFile uintptr, aRead uintptr, nRead int32, iOff i64, pzErrmsg uintptr) int32 { /* zipfile.c:518:12: */
 31799  	var n size_t
 31800  	libc.Xfseek(tls, pFile, int64(iOff), SEEK_SET)
 31801  	n = libc.Xfread(tls, aRead, uint64(1), uint64(nRead), pFile)
 31802  	if int32(n) != nRead {
 31803  		*(*uintptr)(unsafe.Pointer(pzErrmsg)) = sqlite3.Xsqlite3_mprintf(tls, ts+9062 /* "error in fread()" */, 0)
 31804  		return SQLITE_ERROR
 31805  	}
 31806  	return SQLITE_OK
 31807  }
 31808  
 31809  func zipfileAppendData(tls *libc.TLS, pTab uintptr, aWrite uintptr, nWrite int32) int32 { /* zipfile.c:535:12: */
 31810  	if nWrite > 0 {
 31811  		var n size_t = size_t(nWrite)
 31812  		libc.Xfseek(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, int64((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent), SEEK_SET)
 31813  		n = libc.Xfwrite(tls, aWrite, uint64(1), uint64(nWrite), (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)
 31814  		if int32(n) != nWrite {
 31815  			(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+9079 /* "error in fwrite(..." */, 0)
 31816  			return SQLITE_ERROR
 31817  		}
 31818  		*(*i64)(unsafe.Pointer(pTab + 88 /* &.szCurrent */)) += (i64(nWrite))
 31819  	}
 31820  	return SQLITE_OK
 31821  }
 31822  
 31823  // Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
 31824  func zipfileGetU16(tls *libc.TLS, aBuf uintptr) u16 { /* zipfile.c:556:12: */
 31825  	return (u16((int32(*(*u8)(unsafe.Pointer(aBuf + 1))) << 8) + int32(*(*u8)(unsafe.Pointer(aBuf)))))
 31826  }
 31827  
 31828  // Read and return a 32-bit little-endian unsigned integer from buffer aBuf.
 31829  func zipfileGetU32(tls *libc.TLS, aBuf uintptr) u32 { /* zipfile.c:563:12: */
 31830  	return (((((u32(*(*u8)(unsafe.Pointer(aBuf + 3)))) << 24) +
 31831  		((u32(*(*u8)(unsafe.Pointer(aBuf + 2)))) << 16)) +
 31832  		((u32(*(*u8)(unsafe.Pointer(aBuf + 1)))) << 8)) +
 31833  		((u32(*(*u8)(unsafe.Pointer(aBuf)))) << 0))
 31834  }
 31835  
 31836  // Write a 16-bit little endiate integer into buffer aBuf.
 31837  func zipfilePutU16(tls *libc.TLS, aBuf uintptr, val u16) { /* zipfile.c:573:13: */
 31838  	*(*u8)(unsafe.Pointer(aBuf)) = (u8(int32(val) & 0xFF))
 31839  	*(*u8)(unsafe.Pointer(aBuf + 1)) = (u8((int32(val) >> 8) & 0xFF))
 31840  }
 31841  
 31842  // Write a 32-bit little endiate integer into buffer aBuf.
 31843  func zipfilePutU32(tls *libc.TLS, aBuf uintptr, val u32) { /* zipfile.c:581:13: */
 31844  	*(*u8)(unsafe.Pointer(aBuf)) = (u8(val & u32(0xFF)))
 31845  	*(*u8)(unsafe.Pointer(aBuf + 1)) = (u8((val >> 8) & u32(0xFF)))
 31846  	*(*u8)(unsafe.Pointer(aBuf + 2)) = (u8((val >> 16) & u32(0xFF)))
 31847  	*(*u8)(unsafe.Pointer(aBuf + 3)) = (u8((val >> 24) & u32(0xFF)))
 31848  }
 31849  
 31850  // Magic numbers used to read CDS records.
 31851  
 31852  // Decode the CDS record in buffer aBuf into (*pCDS). Return SQLITE_ERROR
 31853  // if the record is not well-formed, or SQLITE_OK otherwise.
 31854  func zipfileReadCDS(tls *libc.TLS, aBuf uintptr, pCDS uintptr) int32 { /* zipfile.c:604:12: */
 31855  	var aRead uintptr = aBuf
 31856  	var sig u32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31857  	var rc int32 = SQLITE_OK
 31858  	if sig != u32(ZIPFILE_SIGNATURE_CDS) {
 31859  		rc = SQLITE_ERROR
 31860  	} else {
 31861  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionMadeBy = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31862  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionExtract = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31863  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).Fflags = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31864  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31865  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31866  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31867  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).Fcrc32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31868  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31869  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31870  
 31871  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31872  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31873  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31874  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiDiskStart = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31875  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiInternalAttr = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31876  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31877  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiOffset = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31878  
 31879  	}
 31880  
 31881  	return rc
 31882  }
 31883  
 31884  // Decode the LFH record in buffer aBuf into (*pLFH). Return SQLITE_ERROR
 31885  // if the record is not well-formed, or SQLITE_OK otherwise.
 31886  func zipfileReadLFH(tls *libc.TLS, aBuffer uintptr, pLFH uintptr) int32 { /* zipfile.c:638:12: */
 31887  	var aRead uintptr = aBuffer
 31888  	var rc int32 = SQLITE_OK
 31889  
 31890  	var sig u32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31891  	if sig != u32(ZIPFILE_SIGNATURE_LFH) {
 31892  		rc = SQLITE_ERROR
 31893  	} else {
 31894  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FiVersionExtract = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31895  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).Fflags = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31896  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FiCompression = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31897  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FmTime = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31898  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FmDate = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31899  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).Fcrc32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31900  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FszCompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31901  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FszUncompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 31902  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FnFile = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31903  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FnExtra = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 31904  	}
 31905  	return rc
 31906  }
 31907  
 31908  // Buffer aExtra (size nExtra bytes) contains zip archive "extra" fields.
 31909  // Scan through this buffer to find an "extra-timestamp" field. If one
 31910  // exists, extract the 32-bit modification-timestamp from it and store
 31911  // the value in output parameter *pmTime.
 31912  //
 31913  // Zero is returned if no extra-timestamp record could be found (and so
 31914  // *pmTime is left unchanged), or non-zero otherwise.
 31915  //
 31916  // The general format of an extra field is:
 31917  //
 31918  //   Header ID    2 bytes
 31919  //   Data Size    2 bytes
 31920  //   Data         N bytes
 31921  func zipfileScanExtra(tls *libc.TLS, aExtra uintptr, nExtra int32, pmTime uintptr) int32 { /* zipfile.c:679:12: */
 31922  	var ret int32 = 0
 31923  	var p uintptr = aExtra
 31924  	var pEnd uintptr = (aExtra + uintptr(nExtra))
 31925  
 31926  	for p < pEnd {
 31927  		var id u16 = func() u16 { p += uintptr(2); return zipfileGetU16(tls, (p - uintptr(2))) }()
 31928  		var nByte u16 = func() u16 { p += uintptr(2); return zipfileGetU16(tls, (p - uintptr(2))) }()
 31929  
 31930  		switch int32(id) {
 31931  		case ZIPFILE_EXTRA_TIMESTAMP:
 31932  			{
 31933  				var b u8 = *(*u8)(unsafe.Pointer(p))
 31934  				if (int32(b) & 0x01) != 0 { // 0x01 -> modtime is present
 31935  					*(*u32)(unsafe.Pointer(pmTime)) = zipfileGetU32(tls, (p + 1))
 31936  					ret = 1
 31937  				}
 31938  				break
 31939  
 31940  			}
 31941  		}
 31942  
 31943  		p += uintptr(nByte)
 31944  	}
 31945  	return ret
 31946  }
 31947  
 31948  // Convert the standard MS-DOS timestamp stored in the mTime and mDate
 31949  // fields of the CDS structure passed as the only argument to a 32-bit
 31950  // UNIX seconds-since-the-epoch timestamp. Return the result.
 31951  //
 31952  // "Standard" MS-DOS time format:
 31953  //
 31954  //   File modification time:
 31955  //     Bits 00-04: seconds divided by 2
 31956  //     Bits 05-10: minute
 31957  //     Bits 11-15: hour
 31958  //   File modification date:
 31959  //     Bits 00-04: day
 31960  //     Bits 05-08: month (1-12)
 31961  //     Bits 09-15: years from 1980
 31962  //
 31963  // https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx
 31964  func zipfileMtime(tls *libc.TLS, pCDS uintptr) u32 { /* zipfile.c:722:12: */
 31965  	var Y int32
 31966  	var M int32
 31967  	var D int32
 31968  	var X1 int32
 31969  	var X2 int32
 31970  	var A int32
 31971  	var B int32
 31972  	var sec int32
 31973  	var min int32
 31974  	var hr int32
 31975  	var JDsec i64
 31976  	Y = (1980 + ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) >> 9) & 0x7F))
 31977  	M = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) >> 5) & 0x0F)
 31978  	D = (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) & 0x1F)
 31979  	sec = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) & 0x1F) * 2)
 31980  	min = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) >> 5) & 0x3F)
 31981  	hr = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) >> 11) & 0x1F)
 31982  	if M <= 2 {
 31983  		Y--
 31984  		M = M + (12)
 31985  	}
 31986  	X1 = ((36525 * (Y + 4716)) / 100)
 31987  	X2 = ((306001 * (M + 1)) / 10000)
 31988  	A = (Y / 100)
 31989  	B = ((2 - A) + (A / 4))
 31990  	JDsec = ((((i64(((float64(((X1 + X2) + D) + B)) - 1524.5) * float64(86400))) + (i64(hr * 3600))) + (i64(min * 60))) + i64(sec))
 31991  	return (u32(JDsec - (int64(24405875) * int64(8640))))
 31992  }
 31993  
 31994  // The opposite of zipfileMtime(). This function populates the mTime and
 31995  // mDate fields of the CDS structure passed as the first argument according
 31996  // to the UNIX timestamp value passed as the second.
 31997  func zipfileMtimeToDos(tls *libc.TLS, pCds uintptr, mUnixTime u32) { /* zipfile.c:748:13: */
 31998  	// Convert unix timestamp to JD (2440588 is noon on 1/1/1970)
 31999  	var JD i64 = (int64(2440588) + (i64(mUnixTime / (u32((24 * 60) * 60)))))
 32000  	var A int32
 32001  	var B int32
 32002  	var C int32
 32003  	var D int32
 32004  	var E int32
 32005  	var yr int32
 32006  	var mon int32
 32007  	var day int32
 32008  	var hr int32
 32009  	var min int32
 32010  	var sec int32
 32011  
 32012  	A = (int32((float64(JD) - 1867216.25) / 36524.25))
 32013  	A = (int32(((JD + int64(1)) + i64(A)) - (i64(A / 4))))
 32014  	B = (A + 1524)
 32015  	C = (int32((float64(B) - 122.1) / 365.25))
 32016  	D = ((36525 * (C & 32767)) / 100)
 32017  	E = (int32((float64(B - D)) / 30.6001))
 32018  
 32019  	day = ((B - D) - (int32(30.6001 * float64(E))))
 32020  	mon = func() int32 {
 32021  		if E < 14 {
 32022  			return (E - 1)
 32023  		}
 32024  		return (E - 13)
 32025  	}()
 32026  	if mon > 2 {
 32027  		yr = (C - 4716)
 32028  	} else {
 32029  		yr = (C - 4715)
 32030  	}
 32031  
 32032  	hr = (int32((mUnixTime % (u32((24 * 60) * 60))) / (u32(60 * 60))))
 32033  	min = (int32((mUnixTime % (u32(60 * 60))) / u32(60)))
 32034  	sec = (int32(mUnixTime % u32(60)))
 32035  
 32036  	if yr >= 1980 {
 32037  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate = (u16((day + (mon << 5)) + ((yr - 1980) << 9)))
 32038  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmTime = (u16(((sec / 2) + (min << 5)) + (hr << 11)))
 32039  	} else {
 32040  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate = libc.AssignPtrUint16(pCds+8 /* &.mTime */, u16(0))
 32041  	}
 32042  
 32043  }
 32044  
 32045  // If aBlob is not NULL, then it is a pointer to a buffer (nBlob bytes in
 32046  // size) containing an entire zip archive image. Or, if aBlob is NULL,
 32047  // then pFile is a file-handle open on a zip file. In either case, this
 32048  // function creates a ZipfileEntry object based on the zip archive entry
 32049  // for which the CDS record is at offset iOff.
 32050  //
 32051  // If successful, SQLITE_OK is returned and (*ppEntry) set to point to
 32052  // the new object. Otherwise, an SQLite error code is returned and the
 32053  // final value of (*ppEntry) undefined.
 32054  func zipfileGetEntry(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32, pFile uintptr, iOff i64, ppEntry uintptr) int32 { /* zipfile.c:796:12: */
 32055  	bp := tls.Alloc(60)
 32056  	defer tls.Free(60)
 32057  
 32058  	var aRead uintptr
 32059  	var pzErr uintptr = (pTab /* &.base */ + 16 /* &.zErrMsg */)
 32060  	var rc int32 = SQLITE_OK
 32061  
 32062  	if aBlob == uintptr(0) {
 32063  		aRead = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer
 32064  		rc = zipfileReadData(tls, pFile, aRead, ZIPFILE_CDS_FIXED_SZ, iOff, pzErr)
 32065  	} else {
 32066  		aRead = (aBlob + uintptr(iOff))
 32067  	}
 32068  
 32069  	if rc == SQLITE_OK {
 32070  		var nAlloc sqlite3_int64
 32071  		var pNew uintptr
 32072  
 32073  		var nFile int32 = int32(zipfileGetU16(tls, (aRead + 28)))
 32074  		var nExtra int32 = int32(zipfileGetU16(tls, (aRead + 30)))
 32075  		nExtra = nExtra + (int32(zipfileGetU16(tls, (aRead + 32))))
 32076  
 32077  		nAlloc = (sqlite3_int64(uint64(unsafe.Sizeof(ZipfileEntry{})) + uint64(nExtra)))
 32078  		if aBlob != 0 {
 32079  			nAlloc = nAlloc + (sqlite3_int64(zipfileGetU32(tls, (aRead + 20))))
 32080  		}
 32081  
 32082  		pNew = sqlite3.Xsqlite3_malloc64(tls, uint64(nAlloc))
 32083  		if pNew == uintptr(0) {
 32084  			rc = SQLITE_NOMEM
 32085  		} else {
 32086  			libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(ZipfileEntry{})))
 32087  			rc = zipfileReadCDS(tls, aRead, (pNew /* &.cds */))
 32088  			if rc != SQLITE_OK {
 32089  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9097 /* "failed to read C..." */, libc.VaList(bp, iOff))
 32090  			} else if aBlob == uintptr(0) {
 32091  				rc = zipfileReadData(tls,
 32092  					pFile, aRead, (nExtra + nFile), (iOff + int64(ZIPFILE_CDS_FIXED_SZ)), pzErr)
 32093  			} else {
 32094  				aRead = (aBlob + uintptr((iOff + int64(ZIPFILE_CDS_FIXED_SZ))))
 32095  			}
 32096  		}
 32097  
 32098  		if rc == SQLITE_OK {
 32099  			var pt uintptr = (pNew + 56 /* &.mUnixTime */)
 32100  			(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile = sqlite3.Xsqlite3_mprintf(tls, ts+9131 /* "%.*s" */, libc.VaList(bp+8, nFile, aRead))
 32101  			(*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra = (pNew + 1*96)
 32102  			libc.Xmemcpy(tls, (*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra, (aRead + uintptr(nFile)), uint64(nExtra))
 32103  			if (*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile == uintptr(0) {
 32104  				rc = SQLITE_NOMEM
 32105  			} else if 0 == zipfileScanExtra(tls, (aRead+uintptr(nFile)), int32((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FnExtra), pt) {
 32106  				(*ZipfileEntry)(unsafe.Pointer(pNew)).FmUnixTime = zipfileMtime(tls, (pNew /* &.cds */))
 32107  			}
 32108  		}
 32109  
 32110  		if rc == SQLITE_OK {
 32111  			// var lfh ZipfileLFH at bp+32, 28
 32112  
 32113  			if pFile != 0 {
 32114  				rc = zipfileReadData(tls, pFile, aRead, szFix, int64((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset), pzErr)
 32115  			} else {
 32116  				aRead = (aBlob + uintptr((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset))
 32117  			}
 32118  
 32119  			rc = zipfileReadLFH(tls, aRead, bp+32 /* &lfh */)
 32120  			if rc == SQLITE_OK {
 32121  				(*ZipfileEntry)(unsafe.Pointer(pNew)).FiDataOff = (i64((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset + u32(ZIPFILE_LFH_FIXED_SZ)))
 32122  				*(*i64)(unsafe.Pointer(pNew + 72 /* &.iDataOff */)) += (i64(int32((*ZipfileLFH)(unsafe.Pointer(bp+32 /* &lfh */)).FnFile) + int32((*ZipfileLFH)(unsafe.Pointer(bp+32 /* &lfh */)).FnExtra)))
 32123  				if (aBlob != 0) && ((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed != 0) {
 32124  					(*ZipfileEntry)(unsafe.Pointer(pNew)).FaData = ((*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra + uintptr(nExtra))
 32125  					libc.Xmemcpy(tls, (*ZipfileEntry)(unsafe.Pointer(pNew)).FaData, (aBlob + uintptr((*ZipfileEntry)(unsafe.Pointer(pNew)).FiDataOff)), uint64((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed))
 32126  				}
 32127  			} else {
 32128  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9136, /* "failed to read L..." */
 32129  					libc.VaList(bp+24, int32((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset)))
 32130  			}
 32131  		}
 32132  
 32133  		if rc != SQLITE_OK {
 32134  			zipfileEntryFree(tls, pNew)
 32135  		} else {
 32136  			*(*uintptr)(unsafe.Pointer(ppEntry)) = pNew
 32137  		}
 32138  	}
 32139  
 32140  	return rc
 32141  }
 32142  
 32143  var szFix int32 = ZIPFILE_LFH_FIXED_SZ /* zipfile.c:858:24 */
 32144  
 32145  // Advance an ZipfileCsr to its next row of output.
 32146  func zipfileNext(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:894:12: */
 32147  	bp := tls.Alloc(8)
 32148  	defer tls.Free(8)
 32149  
 32150  	var pCsr uintptr = cur
 32151  	var rc int32 = SQLITE_OK
 32152  
 32153  	if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile != 0 {
 32154  		var iEof i64 = (i64((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FiOffset + (*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FnSize))
 32155  		zipfileEntryFree(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)
 32156  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = uintptr(0)
 32157  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff >= iEof {
 32158  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 32159  		} else {
 32160  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0)
 32161  			var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 32162  			rc = zipfileGetEntry(tls, pTab, uintptr(0), 0, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff, bp /* &p */)
 32163  			if rc == SQLITE_OK {
 32164  				*(*i64)(unsafe.Pointer(pCsr + 32 /* &.iNextOff */)) += (int64(ZIPFILE_CDS_FIXED_SZ))
 32165  				*(*i64)(unsafe.Pointer(pCsr + 32 /* &.iNextOff */)) += (i64((int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fcds.FnExtra) + int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fcds.FnFile)) + int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fcds.FnComment)))
 32166  			}
 32167  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = *(*uintptr)(unsafe.Pointer(bp /* p */))
 32168  		}
 32169  	} else {
 32170  		if !(int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop) != 0) {
 32171  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FpNext
 32172  		}
 32173  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == uintptr(0) {
 32174  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 32175  		}
 32176  	}
 32177  
 32178  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(0)
 32179  	return rc
 32180  }
 32181  
 32182  func zipfileFree(tls *libc.TLS, p uintptr) { /* zipfile.c:927:13: */
 32183  	sqlite3.Xsqlite3_free(tls, p)
 32184  }
 32185  
 32186  // Buffer aIn (size nIn bytes) contains compressed data. Uncompressed, the
 32187  // size is nOut bytes. This function uncompresses the data and sets the
 32188  // return value in context pCtx to the result (a blob).
 32189  //
 32190  // If an error occurs, an error code is left in pCtx instead.
 32191  func zipfileInflate(tls *libc.TLS, pCtx uintptr, aIn uintptr, nIn int32, nOut int32) { /* zipfile.c:938:13: */
 32192  	bp := tls.Alloc(128)
 32193  	defer tls.Free(128)
 32194  
 32195  	var aRes uintptr = sqlite3.Xsqlite3_malloc(tls, nOut)
 32196  	if aRes == uintptr(0) {
 32197  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 32198  	} else {
 32199  		var err int32
 32200  		// var str z_stream at bp+16, 112
 32201  
 32202  		libc.Xmemset(tls, bp+16 /* &str */, 0, uint64(unsafe.Sizeof(z_stream{})))
 32203  
 32204  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Fnext_in = aIn
 32205  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Favail_in = uInt(nIn)
 32206  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Fnext_out = aRes
 32207  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Favail_out = uInt(nOut)
 32208  
 32209  		err = z.XinflateInit2_(tls, bp+16 /* &str */, -15, ts+9168 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{})))
 32210  		if err != Z_OK {
 32211  			zipfileCtxErrorMsg(tls, pCtx, ts+9175 /* "inflateInit2() f..." */, libc.VaList(bp, err))
 32212  		} else {
 32213  			err = z.Xinflate(tls, bp+16 /* &str */, Z_NO_FLUSH)
 32214  			if err != Z_STREAM_END {
 32215  				zipfileCtxErrorMsg(tls, pCtx, ts+9202 /* "inflate() failed..." */, libc.VaList(bp+8, err))
 32216  			} else {
 32217  				sqlite3.Xsqlite3_result_blob(tls, pCtx, aRes, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFree})))
 32218  				aRes = uintptr(0)
 32219  			}
 32220  		}
 32221  		sqlite3.Xsqlite3_free(tls, aRes)
 32222  		z.XinflateEnd(tls, bp+16 /* &str */)
 32223  	}
 32224  }
 32225  
 32226  // Buffer aIn (size nIn bytes) contains uncompressed data. This function
 32227  // compresses it and sets (*ppOut) to point to a buffer containing the
 32228  // compressed data. The caller is responsible for eventually calling
 32229  // sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut)
 32230  // is set to the size of buffer (*ppOut) in bytes.
 32231  //
 32232  // If no error occurs, SQLITE_OK is returned. Otherwise, an SQLite error
 32233  // code is returned and an error message left in virtual-table handle
 32234  // pTab. The values of (*ppOut) and (*pnOut) are left unchanged in this
 32235  // case.
 32236  func zipfileDeflate(tls *libc.TLS, aIn uintptr, nIn int32, ppOut uintptr, pnOut uintptr, pzErr uintptr) int32 { /* zipfile.c:986:12: */
 32237  	bp := tls.Alloc(112)
 32238  	defer tls.Free(112)
 32239  
 32240  	var rc int32 = SQLITE_OK
 32241  	var nAlloc sqlite3_int64
 32242  	// var str z_stream at bp, 112
 32243  
 32244  	var aOut uintptr
 32245  
 32246  	libc.Xmemset(tls, bp /* &str */, 0, uint64(unsafe.Sizeof(z_stream{})))
 32247  	(*z_stream)(unsafe.Pointer(bp /* &str */)).Fnext_in = aIn
 32248  	(*z_stream)(unsafe.Pointer(bp /* &str */)).Favail_in = uInt(nIn)
 32249  	z.XdeflateInit2_(tls, bp /* &str */, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY, ts+9168 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{})))
 32250  
 32251  	nAlloc = sqlite3_int64(z.XdeflateBound(tls, bp /* &str */, uint64(nIn)))
 32252  	aOut = sqlite3.Xsqlite3_malloc64(tls, uint64(nAlloc))
 32253  	if aOut == uintptr(0) {
 32254  		rc = SQLITE_NOMEM
 32255  	} else {
 32256  		var res int32
 32257  		(*z_stream)(unsafe.Pointer(bp /* &str */)).Fnext_out = aOut
 32258  		(*z_stream)(unsafe.Pointer(bp /* &str */)).Favail_out = uInt(nAlloc)
 32259  		res = z.Xdeflate(tls, bp /* &str */, Z_FINISH)
 32260  		if res == Z_STREAM_END {
 32261  			*(*uintptr)(unsafe.Pointer(ppOut)) = aOut
 32262  			*(*int32)(unsafe.Pointer(pnOut)) = int32((*z_stream)(unsafe.Pointer(bp /* &str */)).Ftotal_out)
 32263  		} else {
 32264  			sqlite3.Xsqlite3_free(tls, aOut)
 32265  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9224 /* "zipfile: deflate..." */, 0)
 32266  			rc = SQLITE_ERROR
 32267  		}
 32268  		z.XdeflateEnd(tls, bp /* &str */)
 32269  	}
 32270  
 32271  	return rc
 32272  }
 32273  
 32274  // Return values of columns for the row at which the series_cursor
 32275  // is currently pointing.
 32276  func zipfileColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* zipfile.c:1029:12: */
 32277  	var pCsr uintptr = cur
 32278  	var pCDS uintptr = ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent /* &.cds */)
 32279  	var rc int32 = SQLITE_OK
 32280  	switch i {
 32281  	case 0: // name
 32282  		sqlite3.Xsqlite3_result_text(tls, ctx, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile, -1, libc.UintptrFromInt32(-1))
 32283  		break
 32284  	case 1: // mode
 32285  		// TODO: Whether or not the following is correct surely depends on
 32286  		// the platform on which the archive was created.
 32287  		sqlite3.Xsqlite3_result_int(tls, ctx, (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr >> 16)))
 32288  		break
 32289  	case 2:
 32290  		{ // mtime
 32291  			sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FmUnixTime))
 32292  			break
 32293  
 32294  		}
 32295  	case 3:
 32296  		{ // sz
 32297  			if sqlite3.Xsqlite3_vtab_nochange(tls, ctx) == 0 {
 32298  				sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed))
 32299  			}
 32300  			break
 32301  
 32302  		}
 32303  	case 4: // rawdata
 32304  		if sqlite3.Xsqlite3_vtab_nochange(tls, ctx) != 0 {
 32305  			break
 32306  		}
 32307  		fallthrough
 32308  	case 5:
 32309  		{ // data
 32310  			if ((i == 4) || (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression) == 0)) || (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression) == 8) {
 32311  				var sz int32 = int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed)
 32312  				var szFinal int32 = int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed)
 32313  				if szFinal > 0 {
 32314  					var aBuf uintptr
 32315  					var aFree uintptr = uintptr(0)
 32316  					if (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FaData != 0 {
 32317  						aBuf = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FaData
 32318  					} else {
 32319  						aBuf = libc.AssignUintptr(&aFree, sqlite3.Xsqlite3_malloc64(tls, uint64(sz)))
 32320  						if aBuf == uintptr(0) {
 32321  							rc = SQLITE_NOMEM
 32322  						} else {
 32323  							var pFile uintptr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile
 32324  							if pFile == uintptr(0) {
 32325  								pFile = (*ZipfileTab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpWriteFd
 32326  							}
 32327  							rc = zipfileReadData(tls, pFile, aBuf, sz, (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FiDataOff,
 32328  								((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab + 16 /* &.zErrMsg */))
 32329  						}
 32330  					}
 32331  					if rc == SQLITE_OK {
 32332  						if (i == 5) && ((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression != 0) {
 32333  							zipfileInflate(tls, ctx, aBuf, sz, szFinal)
 32334  						} else {
 32335  							sqlite3.Xsqlite3_result_blob(tls, ctx, aBuf, sz, libc.UintptrFromInt32(-1))
 32336  						}
 32337  					}
 32338  					sqlite3.Xsqlite3_free(tls, aFree)
 32339  				} else {
 32340  					// Figure out if this is a directory or a zero-sized file. Consider
 32341  					// it to be a directory either if the mode suggests so, or if
 32342  					// the final character in the name is '/'.
 32343  					var mode u32 = ((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr >> 16)
 32344  					if !((mode & u32(S_IFDIR)) != 0) && (int32(*(*int8)(unsafe.Pointer((*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile + uintptr((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile) - 1))))) != '/') {
 32345  						sqlite3.Xsqlite3_result_blob(tls, ctx, ts+489 /* "" */, 0, uintptr(0))
 32346  					}
 32347  				}
 32348  			}
 32349  			break
 32350  
 32351  		}
 32352  	case 6: // method
 32353  		sqlite3.Xsqlite3_result_int(tls, ctx, int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression))
 32354  		break
 32355  	default: // z
 32356  
 32357  		sqlite3.Xsqlite3_result_int64(tls, ctx, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId)
 32358  		break
 32359  	}
 32360  
 32361  	return rc
 32362  }
 32363  
 32364  // Return TRUE if the cursor is at EOF.
 32365  func zipfileEof(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:1116:12: */
 32366  	var pCsr uintptr = cur
 32367  	return int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof)
 32368  }
 32369  
 32370  // If aBlob is not NULL, then it points to a buffer nBlob bytes in size
 32371  // containing an entire zip archive image. Or, if aBlob is NULL, then pFile
 32372  // is guaranteed to be a file-handle open on a zip file.
 32373  //
 32374  // This function attempts to locate the EOCD record within the zip archive
 32375  // and populate *pEOCD with the results of decoding it. SQLITE_OK is
 32376  // returned if successful. Otherwise, an SQLite error code is returned and
 32377  // an English language error message may be left in virtual-table pTab.
 32378  func zipfileReadEOCD(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32, pFile uintptr, pEOCD uintptr) int32 { /* zipfile.c:1131:12: */
 32379  	var aRead uintptr = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer // Temporary buffer
 32380  	var nRead int32                                                  // Bytes to read from file
 32381  	var rc int32 = SQLITE_OK
 32382  
 32383  	if aBlob == uintptr(0) {
 32384  		var iOff i64   // Offset to read from
 32385  		var szFile i64 // Total size of file in bytes
 32386  		libc.Xfseek(tls, pFile, int64(0), SEEK_END)
 32387  		szFile = i64(libc.Xftell(tls, pFile))
 32388  		if szFile == int64(0) {
 32389  			libc.Xmemset(tls, pEOCD, 0, uint64(unsafe.Sizeof(ZipfileEOCD{})))
 32390  			return SQLITE_OK
 32391  		}
 32392  		nRead = func() int32 {
 32393  			if (szFile) < (int64(64 * 1024)) {
 32394  				return int32(szFile)
 32395  			}
 32396  			return (64 * 1024)
 32397  		}()
 32398  		iOff = (szFile - i64(nRead))
 32399  		rc = zipfileReadData(tls, pFile, aRead, nRead, iOff, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 32400  	} else {
 32401  		nRead = func() int32 {
 32402  			if (nBlob) < (64 * 1024) {
 32403  				return nBlob
 32404  			}
 32405  			return (64 * 1024)
 32406  		}()
 32407  		aRead = (aBlob + uintptr((nBlob - nRead)))
 32408  	}
 32409  
 32410  	if rc == SQLITE_OK {
 32411  		var i int32
 32412  
 32413  		// Scan backwards looking for the signature bytes
 32414  		for i = (nRead - 20); i >= 0; i-- {
 32415  			if (((int32(*(*u8)(unsafe.Pointer(aRead + uintptr(i)))) == 0x50) && (int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 1))))) == 0x4b)) &&
 32416  				(int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 2))))) == 0x05)) && (int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 3))))) == 0x06) {
 32417  				break
 32418  			}
 32419  		}
 32420  		if i < 0 {
 32421  			(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 32422  				ts+9249 /* "cannot find end ..." */, 0)
 32423  			return SQLITE_ERROR
 32424  		}
 32425  
 32426  		aRead += (uintptr(i + 4))
 32427  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiDisk = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 32428  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiFirstDisk = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 32429  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnEntry = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 32430  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnEntryTotal = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 32431  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnSize = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 32432  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiOffset = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 32433  	}
 32434  
 32435  	return rc
 32436  }
 32437  
 32438  // Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry
 32439  // and ends with pLastEntry. If argument pBefore is NULL, then pNew is added
 32440  // to the end of the list. Otherwise, it is added to the list immediately
 32441  // before pBefore (which is guaranteed to be a part of said list).
 32442  func zipfileAddEntry(tls *libc.TLS, pTab uintptr, pBefore uintptr, pNew uintptr) { /* zipfile.c:1195:13: */
 32443  
 32444  	if pBefore == uintptr(0) {
 32445  		if (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry == uintptr(0) {
 32446  			(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = libc.AssignPtrUintptr(pTab+72 /* &.pLastEntry */, pNew)
 32447  		} else {
 32448  
 32449  			(*ZipfileEntry)(unsafe.Pointer((*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry)).FpNext = pNew
 32450  			(*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry = pNew
 32451  		}
 32452  	} else {
 32453  		var pp uintptr
 32454  		for pp = (pTab + 64 /* &.pFirstEntry */); *(*uintptr)(unsafe.Pointer(pp)) != pBefore; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 88 /* &.pNext */) {
 32455  		}
 32456  		(*ZipfileEntry)(unsafe.Pointer(pNew)).FpNext = pBefore
 32457  		*(*uintptr)(unsafe.Pointer(pp)) = pNew
 32458  	}
 32459  }
 32460  
 32461  func zipfileLoadDirectory(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32) int32 { /* zipfile.c:1218:12: */
 32462  	bp := tls.Alloc(24)
 32463  	defer tls.Free(24)
 32464  
 32465  	// var eocd ZipfileEOCD at bp, 16
 32466  
 32467  	var rc int32
 32468  	var i int32
 32469  	var iOff i64
 32470  
 32471  	rc = zipfileReadEOCD(tls, pTab, aBlob, nBlob, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, bp /* &eocd */)
 32472  	iOff = i64((*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset)
 32473  	for i = 0; (rc == SQLITE_OK) && (i < int32((*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry)); i++ {
 32474  		*(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)) = uintptr(0)
 32475  		rc = zipfileGetEntry(tls, pTab, aBlob, nBlob, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, iOff, bp+16 /* &pNew */)
 32476  
 32477  		if rc == SQLITE_OK {
 32478  			zipfileAddEntry(tls, pTab, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)))
 32479  			iOff = iOff + (int64(ZIPFILE_CDS_FIXED_SZ))
 32480  			iOff = iOff + (i64((int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)))).Fcds.FnExtra) + int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)))).Fcds.FnFile)) + int32((*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)))).Fcds.FnComment)))
 32481  		}
 32482  	}
 32483  	return rc
 32484  }
 32485  
 32486  // xFilter callback.
 32487  func zipfileFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* zipfile.c:1242:12: */
 32488  	bp := tls.Alloc(8)
 32489  	defer tls.Free(8)
 32490  
 32491  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 32492  	var pCsr uintptr = cur
 32493  	var zFile uintptr = uintptr(0) // Zip file to scan
 32494  	var rc int32 = SQLITE_OK       // Return Code
 32495  	var bInMemory int32 = 0        // True for an in-memory zipfile
 32496  
 32497  	zipfileResetCursor(tls, pCsr)
 32498  
 32499  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile != 0 {
 32500  		zFile = (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile
 32501  	} else if idxNum == 0 {
 32502  		zipfileCursorErr(tls, pCsr, ts+9293 /* "zipfile() functi..." */, 0)
 32503  		return SQLITE_ERROR
 32504  	} else if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB {
 32505  		var aBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 32506  		var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 32507  
 32508  		rc = zipfileLoadDirectory(tls, pTab, aBlob, nBlob)
 32509  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 32510  		(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = libc.AssignPtrUintptr(pTab+72 /* &.pLastEntry */, uintptr(0))
 32511  		if rc != SQLITE_OK {
 32512  			return rc
 32513  		}
 32514  		bInMemory = 1
 32515  	} else {
 32516  		zFile = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 32517  	}
 32518  
 32519  	if (uintptr(0) == (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd) && (0 == bInMemory) {
 32520  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 32521  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile == uintptr(0) {
 32522  			zipfileCursorErr(tls, pCsr, ts+9333 /* "cannot open file..." */, libc.VaList(bp, zFile))
 32523  			rc = SQLITE_ERROR
 32524  		} else {
 32525  			rc = zipfileReadEOCD(tls, pTab, uintptr(0), 0, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile, (pCsr + 40 /* &.eocd */))
 32526  			if rc == SQLITE_OK {
 32527  				if int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FnEntry) == 0 {
 32528  					(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 32529  				} else {
 32530  					(*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff = i64((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FiOffset)
 32531  					rc = zipfileNext(tls, cur)
 32532  				}
 32533  			}
 32534  		}
 32535  	} else {
 32536  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(1)
 32537  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = func() uintptr {
 32538  			if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry != 0 {
 32539  				return (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry
 32540  			}
 32541  			return (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 32542  		}()
 32543  		rc = zipfileNext(tls, cur)
 32544  	}
 32545  
 32546  	return rc
 32547  }
 32548  
 32549  // xBestIndex callback.
 32550  func zipfileBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* zipfile.c:1301:12: */
 32551  	var i int32
 32552  	var idx int32 = -1
 32553  	var unusable int32 = 0
 32554  
 32555  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 32556  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 32557  		if (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn != ZIPFILE_F_COLUMN_IDX {
 32558  			continue
 32559  		}
 32560  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable) == 0 {
 32561  			unusable = 1
 32562  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 32563  			idx = i
 32564  		}
 32565  	}
 32566  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000.0
 32567  	if idx >= 0 {
 32568  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).FargvIndex = 1
 32569  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).Fomit = uint8(1)
 32570  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 32571  	} else if unusable != 0 {
 32572  		return SQLITE_CONSTRAINT
 32573  	}
 32574  	return SQLITE_OK
 32575  }
 32576  
 32577  func zipfileNewEntry(tls *libc.TLS, zPath uintptr) uintptr { /* zipfile.c:1329:21: */
 32578  	bp := tls.Alloc(8)
 32579  	defer tls.Free(8)
 32580  
 32581  	var pNew uintptr
 32582  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ZipfileEntry{})))
 32583  	if pNew != 0 {
 32584  		libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(ZipfileEntry{})))
 32585  		(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zPath))
 32586  		if (*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile == uintptr(0) {
 32587  			sqlite3.Xsqlite3_free(tls, pNew)
 32588  			pNew = uintptr(0)
 32589  		}
 32590  	}
 32591  	return pNew
 32592  }
 32593  
 32594  func zipfileSerializeLFH(tls *libc.TLS, pEntry uintptr, aBuf uintptr) int32 { /* zipfile.c:1343:12: */
 32595  	var pCds uintptr = (pEntry /* &.cds */)
 32596  	var a uintptr = aBuf
 32597  
 32598  	(*ZipfileCDS)(unsafe.Pointer(pCds)).FnExtra = u16(9)
 32599  
 32600  	/* Write the LFH itself */
 32601  	{
 32602  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_LFH))
 32603  		a += uintptr(4)
 32604  	}
 32605  
 32606  	{
 32607  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FiVersionExtract)
 32608  		a += uintptr(2)
 32609  	}
 32610  
 32611  	{
 32612  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).Fflags)
 32613  		a += uintptr(2)
 32614  	}
 32615  
 32616  	{
 32617  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FiCompression)
 32618  		a += uintptr(2)
 32619  	}
 32620  
 32621  	{
 32622  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FmTime)
 32623  		a += uintptr(2)
 32624  	}
 32625  
 32626  	{
 32627  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate)
 32628  		a += uintptr(2)
 32629  	}
 32630  
 32631  	{
 32632  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).Fcrc32)
 32633  		a += uintptr(4)
 32634  	}
 32635  
 32636  	{
 32637  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FszCompressed)
 32638  		a += uintptr(4)
 32639  	}
 32640  
 32641  	{
 32642  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FszUncompressed)
 32643  		a += uintptr(4)
 32644  	}
 32645  
 32646  	{
 32647  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile)
 32648  		a += uintptr(2)
 32649  	}
 32650  
 32651  	{
 32652  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FnExtra)
 32653  		a += uintptr(2)
 32654  	}
 32655  
 32656  	// Add the file name
 32657  	libc.Xmemcpy(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FzFile, uint64(int32((*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile)))
 32658  	a += uintptr(int32((*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile))
 32659  
 32660  	/* The "extra" data */
 32661  	{
 32662  		zipfilePutU16(tls, a, uint16(ZIPFILE_EXTRA_TIMESTAMP))
 32663  		a += uintptr(2)
 32664  	}
 32665  
 32666  	{
 32667  		zipfilePutU16(tls, a, uint16(5))
 32668  		a += uintptr(2)
 32669  	}
 32670  
 32671  	*(*u8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1))) = u8(0x01)
 32672  	{
 32673  		zipfilePutU32(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FmUnixTime)
 32674  		a += uintptr(4)
 32675  	}
 32676  
 32677  	return (int32((int64(a) - int64(aBuf)) / 1))
 32678  }
 32679  
 32680  func zipfileAppendEntry(tls *libc.TLS, pTab uintptr, pEntry uintptr, pData uintptr, nData int32) int32 { /* zipfile.c:1376:12: */
 32681  	var aBuf uintptr = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer
 32682  	var nBuf int32
 32683  	var rc int32
 32684  
 32685  	nBuf = zipfileSerializeLFH(tls, pEntry, aBuf)
 32686  	rc = zipfileAppendData(tls, pTab, aBuf, nBuf)
 32687  	if rc == SQLITE_OK {
 32688  		(*ZipfileEntry)(unsafe.Pointer(pEntry)).FiDataOff = (*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent
 32689  		rc = zipfileAppendData(tls, pTab, pData, nData)
 32690  	}
 32691  
 32692  	return rc
 32693  }
 32694  
 32695  func zipfileGetMode(tls *libc.TLS, pVal uintptr, bIsDir int32, pMode uintptr, pzErr uintptr) int32 { /* zipfile.c:1396:12: */
 32696  	bp := tls.Alloc(19)
 32697  	defer tls.Free(19)
 32698  
 32699  	var z uintptr
 32700  	var mode u32
 32701  	// var zTemplate [11]int8 at bp+8, 11
 32702  
 32703  	var i int32
 32704  	z = sqlite3.Xsqlite3_value_text(tls, pVal)
 32705  	mode = u32(0)
 32706  	if !(z == uintptr(0)) {
 32707  		goto __1
 32708  	}
 32709  	mode = func() uint32 {
 32710  		if bIsDir != 0 {
 32711  			return (uint32(S_IFDIR + 0755))
 32712  		}
 32713  		return (uint32(S_IFREG + 0644))
 32714  	}()
 32715  	goto __2
 32716  __1:
 32717  	if !((int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '9')) {
 32718  		goto __3
 32719  	}
 32720  	mode = uint32(sqlite3.Xsqlite3_value_int(tls, pVal))
 32721  	goto __4
 32722  __3:
 32723  	*(*[11]int8)(unsafe.Pointer(bp + 8 /* zTemplate */)) = *(*[11]int8)(unsafe.Pointer(ts + 9354 /* "-rwxrwxrwx" */))
 32724  	if !(libc.Xstrlen(tls, z) != uint64(10)) {
 32725  		goto __5
 32726  	}
 32727  	goto parse_error
 32728  __5:
 32729  	;
 32730  	switch int32(*(*int8)(unsafe.Pointer(z))) {
 32731  	case '-':
 32732  		goto __7
 32733  	case 'd':
 32734  		goto __8
 32735  	case 'l':
 32736  		goto __9
 32737  	default:
 32738  		goto __10
 32739  	}
 32740  	goto __6
 32741  __7:
 32742  	mode = mode | (u32(S_IFREG))
 32743  	goto __6
 32744  __8:
 32745  	mode = mode | (u32(S_IFDIR))
 32746  	goto __6
 32747  __9:
 32748  	mode = mode | (u32(S_IFLNK))
 32749  	goto __6
 32750  __10:
 32751  	goto parse_error
 32752  __6:
 32753  	;
 32754  	i = 1
 32755  __11:
 32756  	if !(i < 10) {
 32757  		goto __13
 32758  	}
 32759  	if !(int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zTemplate[0] */ + uintptr(i))))) {
 32760  		goto __14
 32761  	}
 32762  	mode = mode | (u32(int32(1) << (9 - i)))
 32763  	goto __15
 32764  __14:
 32765  	if !(int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '-') {
 32766  		goto __16
 32767  	}
 32768  	goto parse_error
 32769  __16:
 32770  	;
 32771  __15:
 32772  	;
 32773  	goto __12
 32774  __12:
 32775  	i++
 32776  	goto __11
 32777  	goto __13
 32778  __13:
 32779  	;
 32780  __4:
 32781  	;
 32782  __2:
 32783  	;
 32784  	if !((libc.Bool32((mode & u32(S_IFDIR)) == u32(0))) == bIsDir) {
 32785  		goto __17
 32786  	}
 32787  	// The "mode" attribute is a directory, but data has been specified.
 32788  	// Or vice-versa - no data but "mode" is a file or symlink.
 32789  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9365 /* "zipfile: mode do..." */, 0)
 32790  	return SQLITE_CONSTRAINT
 32791  __17:
 32792  	;
 32793  	*(*u32)(unsafe.Pointer(pMode)) = mode
 32794  	return SQLITE_OK
 32795  
 32796  parse_error:
 32797  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9399 /* "zipfile: parse e..." */, libc.VaList(bp, z))
 32798  	return SQLITE_ERROR
 32799  }
 32800  
 32801  //
 32802  // Both (const char*) arguments point to nul-terminated strings. Argument
 32803  // nB is the value of strlen(zB). This function returns 0 if the strings are
 32804  // identical, ignoring any trailing '/' character in either path.
 32805  func zipfileComparePath(tls *libc.TLS, zA uintptr, zB uintptr, nB int32) int32 { /* zipfile.c:1441:12: */
 32806  	var nA int32 = int32(libc.Xstrlen(tls, zA))
 32807  	if (nA > 0) && (int32(*(*int8)(unsafe.Pointer(zA + uintptr((nA - 1))))) == '/') {
 32808  		nA--
 32809  	}
 32810  	if (nB > 0) && (int32(*(*int8)(unsafe.Pointer(zB + uintptr((nB - 1))))) == '/') {
 32811  		nB--
 32812  	}
 32813  	if (nA == nB) && (libc.Xmemcmp(tls, zA, zB, uint64(nA)) == 0) {
 32814  		return 0
 32815  	}
 32816  	return 1
 32817  }
 32818  
 32819  func zipfileBegin(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1449:12: */
 32820  	bp := tls.Alloc(8)
 32821  	defer tls.Free(8)
 32822  
 32823  	var pTab uintptr = pVtab
 32824  	var rc int32 = SQLITE_OK
 32825  
 32826  	if ((*ZipfileTab)(unsafe.Pointer(pTab)).FzFile == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer((*ZipfileTab)(unsafe.Pointer(pTab)).FzFile))) == 0) {
 32827  		(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+9432 /* "zipfile: missing..." */, 0)
 32828  		return SQLITE_ERROR
 32829  	}
 32830  
 32831  	// Open a write fd on the file. Also load the entire central directory
 32832  	// structure into memory. During the transaction any new file data is
 32833  	// appended to the archive file, but the central directory is accumulated
 32834  	// in main-memory until the transaction is committed.
 32835  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd = libc.Xfopen(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile, ts+9458 /* "ab+" */)
 32836  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd == uintptr(0) {
 32837  		(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 32838  			ts+9462 /* "zipfile: failed ..." */, libc.VaList(bp, (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile))
 32839  		rc = SQLITE_ERROR
 32840  	} else {
 32841  		libc.Xfseek(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, int64(0), SEEK_END)
 32842  		(*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent = libc.AssignPtrInt64(pTab+96 /* &.szOrig */, i64(libc.Xftell(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)))
 32843  		rc = zipfileLoadDirectory(tls, pTab, uintptr(0), 0)
 32844  	}
 32845  
 32846  	if rc != SQLITE_OK {
 32847  		zipfileCleanupTransaction(tls, pTab)
 32848  	}
 32849  
 32850  	return rc
 32851  }
 32852  
 32853  // Return the current time as a 32-bit timestamp in UNIX epoch format (like
 32854  // time(2)).
 32855  func zipfileTime(tls *libc.TLS) u32 { /* zipfile.c:1486:12: */
 32856  	bp := tls.Alloc(16)
 32857  	defer tls.Free(16)
 32858  
 32859  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 32860  	var ret u32
 32861  	if pVfs == uintptr(0) {
 32862  		return u32(0)
 32863  	}
 32864  	if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion >= 2) && ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTimeInt64 != 0) {
 32865  		// var ms i64 at bp, 8
 32866  
 32867  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, pVfs, bp /* &ms */)
 32868  		ret = (u32((*(*i64)(unsafe.Pointer(bp /* ms */)) / int64(1000)) - (int64(24405875) * int64(8640))))
 32869  	} else {
 32870  		// var day float64 at bp+8, 8
 32871  
 32872  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 120 /* &.xCurrentTime */))))(tls, pVfs, bp+8 /* &day */)
 32873  		ret = (u32((*(*float64)(unsafe.Pointer(bp + 8 /* day */)) - 2440587.5) * float64(86400)))
 32874  	}
 32875  	return ret
 32876  }
 32877  
 32878  // Return a 32-bit timestamp in UNIX epoch format.
 32879  //
 32880  // If the value passed as the only argument is either NULL or an SQL NULL,
 32881  // return the current time. Otherwise, return the value stored in (*pVal)
 32882  // cast to a 32-bit unsigned integer.
 32883  func zipfileGetTime(tls *libc.TLS, pVal uintptr) u32 { /* zipfile.c:1509:12: */
 32884  	if (pVal == uintptr(0)) || (sqlite3.Xsqlite3_value_type(tls, pVal) == SQLITE_NULL) {
 32885  		return zipfileTime(tls)
 32886  	}
 32887  	return u32(sqlite3.Xsqlite3_value_int64(tls, pVal))
 32888  }
 32889  
 32890  // Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
 32891  // linked list.  Remove it from the list and free the object.
 32892  func zipfileRemoveEntryFromList(tls *libc.TLS, pTab uintptr, pOld uintptr) { /* zipfile.c:1520:13: */
 32893  	if pOld != 0 {
 32894  		var pp uintptr
 32895  		for pp = (pTab + 64 /* &.pFirstEntry */); (*(*uintptr)(unsafe.Pointer(pp))) != pOld; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 88 /* &.pNext */) {
 32896  		}
 32897  		*(*uintptr)(unsafe.Pointer(pp)) = (*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext
 32898  		zipfileEntryFree(tls, pOld)
 32899  	}
 32900  }
 32901  
 32902  // xUpdate method.
 32903  func zipfileUpdate(tls *libc.TLS, pVtab uintptr, nVal int32, apVal uintptr, pRowid uintptr) int32 { /* zipfile.c:1532:12: */
 32904  	bp := tls.Alloc(40)
 32905  	defer tls.Free(40)
 32906  
 32907  	var pTab uintptr
 32908  	var rc int32     // Return Code
 32909  	var pNew uintptr // New in-memory CDS entry
 32910  
 32911  	// var mode u32 at bp+36, 4
 32912  	// Mode for new entry
 32913  	var mTime u32     // Modification time for new entry
 32914  	var sz i64        // Uncompressed size
 32915  	var zPath uintptr // Path for new entry
 32916  	var nPath int32   // strlen(zPath)
 32917  	var pData uintptr // Pointer to buffer containing content
 32918  	var nData int32   // Size of pData buffer in bytes
 32919  	var iMethod int32 // Compression method for new entry
 32920  	// var pFree uintptr at bp+24, 8
 32921  	// Free this
 32922  	var zFree uintptr // Also free this
 32923  	var pOld uintptr
 32924  	var pOld2 uintptr
 32925  	var bUpdate int32 // True for an update that modifies "name"
 32926  	var bIsDir int32
 32927  	var iCrc32 u32
 32928  	var zUpdate uintptr
 32929  	var zDelete uintptr
 32930  	var nDelete int32
 32931  	// var nCmp int32 at bp+32, 4
 32932  
 32933  	// Value specified for "data", and possibly "method". This must be
 32934  	// a regular file or a symlink.
 32935  	var aIn uintptr
 32936  	var nIn int32
 32937  	var bAuto int32
 32938  	var p uintptr
 32939  	var pCsr uintptr
 32940  	pTab = pVtab
 32941  	rc = SQLITE_OK
 32942  	pNew = uintptr(0)
 32943  	*(*u32)(unsafe.Pointer(bp + 36 /* mode */)) = u32(0)
 32944  	mTime = u32(0)
 32945  	sz = int64(0)
 32946  	zPath = uintptr(0)
 32947  	nPath = 0
 32948  	pData = uintptr(0)
 32949  	nData = 0
 32950  	iMethod = 0
 32951  	*(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */)) = uintptr(0)
 32952  	zFree = uintptr(0)
 32953  	pOld = uintptr(0)
 32954  	pOld2 = uintptr(0)
 32955  	bUpdate = 0
 32956  	bIsDir = 0
 32957  	iCrc32 = u32(0)
 32958  
 32959  	if !((*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd == uintptr(0)) {
 32960  		goto __1
 32961  	}
 32962  	rc = zipfileBegin(tls, pVtab)
 32963  	if !(rc != SQLITE_OK) {
 32964  		goto __2
 32965  	}
 32966  	return rc
 32967  __2:
 32968  	;
 32969  __1:
 32970  	;
 32971  
 32972  	// If this is a DELETE or UPDATE, find the archive entry to delete.
 32973  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal))) != SQLITE_NULL) {
 32974  		goto __3
 32975  	}
 32976  	zDelete = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 32977  	nDelete = int32(libc.Xstrlen(tls, zDelete))
 32978  	if !(nVal > 1) {
 32979  		goto __4
 32980  	}
 32981  	zUpdate = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*8)))
 32982  	if !((zUpdate != 0) && (zipfileComparePath(tls, zUpdate, zDelete, nDelete) != 0)) {
 32983  		goto __5
 32984  	}
 32985  	bUpdate = 1
 32986  __5:
 32987  	;
 32988  __4:
 32989  	;
 32990  	pOld = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 32991  __6:
 32992  	if !(1 != 0) {
 32993  		goto __8
 32994  	}
 32995  	if !(zipfileComparePath(tls, (*ZipfileEntry)(unsafe.Pointer(pOld)).Fcds.FzFile, zDelete, nDelete) == 0) {
 32996  		goto __9
 32997  	}
 32998  	goto __8
 32999  __9:
 33000  	;
 33001  
 33002  	goto __7
 33003  __7:
 33004  	pOld = (*ZipfileEntry)(unsafe.Pointer(pOld)).FpNext
 33005  	goto __6
 33006  	goto __8
 33007  __8:
 33008  	;
 33009  __3:
 33010  	;
 33011  
 33012  	if !(nVal > 1) {
 33013  		goto __10
 33014  	}
 33015  	// Check that "sz" and "rawdata" are both NULL:
 33016  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 5*8))) != SQLITE_NULL) {
 33017  		goto __11
 33018  	}
 33019  	zipfileTableErr(tls, pTab, ts+9506 /* "sz must be NULL" */, 0)
 33020  	rc = SQLITE_CONSTRAINT
 33021  __11:
 33022  	;
 33023  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 6*8))) != SQLITE_NULL) {
 33024  		goto __12
 33025  	}
 33026  	zipfileTableErr(tls, pTab, ts+9522 /* "rawdata must be ..." */, 0)
 33027  	rc = SQLITE_CONSTRAINT
 33028  __12:
 33029  	;
 33030  
 33031  	if !(rc == SQLITE_OK) {
 33032  		goto __13
 33033  	}
 33034  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*8))) == SQLITE_NULL) {
 33035  		goto __14
 33036  	}
 33037  	// data=NULL. A directory
 33038  	bIsDir = 1
 33039  	goto __15
 33040  __14:
 33041  	// Value specified for "data", and possibly "method". This must be
 33042  	// a regular file or a symlink.
 33043  	aIn = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*8)))
 33044  	nIn = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*8)))
 33045  	bAuto = (libc.Bool32(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 8*8))) == SQLITE_NULL))
 33046  
 33047  	iMethod = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal + 8*8)))
 33048  	sz = i64(nIn)
 33049  	pData = aIn
 33050  	nData = nIn
 33051  	if !((iMethod != 0) && (iMethod != 8)) {
 33052  		goto __16
 33053  	}
 33054  	zipfileTableErr(tls, pTab, ts+9543 /* "unknown compress..." */, libc.VaList(bp, iMethod))
 33055  	rc = SQLITE_CONSTRAINT
 33056  	goto __17
 33057  __16:
 33058  	if !((bAuto != 0) || (iMethod != 0)) {
 33059  		goto __18
 33060  	}
 33061  	rc = zipfileDeflate(tls, aIn, nIn, bp+24 /* &pFree */, bp+32 /* &nCmp */, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 33062  	if !(rc == SQLITE_OK) {
 33063  		goto __19
 33064  	}
 33065  	if !((iMethod != 0) || (*(*int32)(unsafe.Pointer(bp + 32 /* nCmp */)) < nIn)) {
 33066  		goto __20
 33067  	}
 33068  	iMethod = 8
 33069  	pData = *(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */))
 33070  	nData = *(*int32)(unsafe.Pointer(bp + 32 /* nCmp */))
 33071  __20:
 33072  	;
 33073  __19:
 33074  	;
 33075  __18:
 33076  	;
 33077  	iCrc32 = u32(z.Xcrc32(tls, uint64(0), aIn, uint32(nIn)))
 33078  __17:
 33079  	;
 33080  __15:
 33081  	;
 33082  __13:
 33083  	;
 33084  
 33085  	if !(rc == SQLITE_OK) {
 33086  		goto __21
 33087  	}
 33088  	rc = zipfileGetMode(tls, *(*uintptr)(unsafe.Pointer(apVal + 3*8)), bIsDir, bp+36 /* &mode */, (pTab /* &.base */ + 16 /* &.zErrMsg */))
 33089  __21:
 33090  	;
 33091  
 33092  	if !(rc == SQLITE_OK) {
 33093  		goto __22
 33094  	}
 33095  	zPath = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*8)))
 33096  	if !(zPath == uintptr(0)) {
 33097  		goto __23
 33098  	}
 33099  	zPath = ts + 489 /* "" */
 33100  __23:
 33101  	;
 33102  	nPath = int32(libc.Xstrlen(tls, zPath))
 33103  	mTime = zipfileGetTime(tls, *(*uintptr)(unsafe.Pointer(apVal + 4*8)))
 33104  __22:
 33105  	;
 33106  
 33107  	if !((rc == SQLITE_OK) && (bIsDir != 0)) {
 33108  		goto __24
 33109  	}
 33110  	// For a directory, check that the last character in the path is a
 33111  	// '/'. This appears to be required for compatibility with info-zip
 33112  	// (the unzip command on unix). It does not create directories
 33113  	// otherwise.
 33114  	if !((nPath <= 0) || (int32(*(*int8)(unsafe.Pointer(zPath + uintptr((nPath - 1))))) != '/')) {
 33115  		goto __25
 33116  	}
 33117  	zFree = sqlite3.Xsqlite3_mprintf(tls, ts+9574 /* "%s/" */, libc.VaList(bp+8, zPath))
 33118  	zPath = zFree
 33119  	if !(zFree == uintptr(0)) {
 33120  		goto __26
 33121  	}
 33122  	rc = SQLITE_NOMEM
 33123  	nPath = 0
 33124  	goto __27
 33125  __26:
 33126  	nPath = int32(libc.Xstrlen(tls, zPath))
 33127  __27:
 33128  	;
 33129  __25:
 33130  	;
 33131  __24:
 33132  	;
 33133  
 33134  	// Check that we're not inserting a duplicate entry -OR- updating an
 33135  	// entry with a path, thereby making it into a duplicate.
 33136  	if !(((pOld == uintptr(0)) || (bUpdate != 0)) && (rc == SQLITE_OK)) {
 33137  		goto __28
 33138  	}
 33139  	p = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 33140  __29:
 33141  	if !(p != 0) {
 33142  		goto __31
 33143  	}
 33144  	if !(zipfileComparePath(tls, (*ZipfileEntry)(unsafe.Pointer(p)).Fcds.FzFile, zPath, nPath) == 0) {
 33145  		goto __32
 33146  	}
 33147  	switch sqlite3.Xsqlite3_vtab_on_conflict(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).Fdb) {
 33148  	case SQLITE_IGNORE:
 33149  		goto __34
 33150  	case SQLITE_REPLACE:
 33151  		goto __35
 33152  	default:
 33153  		goto __36
 33154  	}
 33155  	goto __33
 33156  __34:
 33157  	goto zipfile_update_done
 33158  
 33159  __35:
 33160  	pOld2 = p
 33161  	goto __33
 33162  
 33163  __36:
 33164  	zipfileTableErr(tls, pTab, ts+9578 /* "duplicate name: ..." */, libc.VaList(bp+16, zPath))
 33165  	rc = SQLITE_CONSTRAINT
 33166  	goto __33
 33167  
 33168  __33:
 33169  	;
 33170  	goto __31
 33171  __32:
 33172  	;
 33173  	goto __30
 33174  __30:
 33175  	p = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext
 33176  	goto __29
 33177  	goto __31
 33178  __31:
 33179  	;
 33180  __28:
 33181  	;
 33182  
 33183  	if !(rc == SQLITE_OK) {
 33184  		goto __37
 33185  	}
 33186  	// Create the new CDS record.
 33187  	pNew = zipfileNewEntry(tls, zPath)
 33188  	if !(pNew == uintptr(0)) {
 33189  		goto __38
 33190  	}
 33191  	rc = SQLITE_NOMEM
 33192  	goto __39
 33193  __38:
 33194  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiVersionMadeBy = (u16((int32(3) << 8) + 30))
 33195  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiVersionExtract = u16(ZIPFILE_NEWENTRY_REQUIRED)
 33196  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.Fflags = u16(ZIPFILE_NEWENTRY_FLAGS)
 33197  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiCompression = u16(iMethod)
 33198  	zipfileMtimeToDos(tls, (pNew /* &.cds */), mTime)
 33199  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.Fcrc32 = iCrc32
 33200  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed = u32(nData)
 33201  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszUncompressed = u32(sz)
 33202  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiExternalAttr = (*(*u32)(unsafe.Pointer(bp + 36 /* mode */)) << 16)
 33203  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset = u32((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent)
 33204  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FnFile = u16(nPath)
 33205  	(*ZipfileEntry)(unsafe.Pointer(pNew)).FmUnixTime = mTime
 33206  	rc = zipfileAppendEntry(tls, pTab, pNew, pData, nData)
 33207  	zipfileAddEntry(tls, pTab, pOld, pNew)
 33208  __39:
 33209  	;
 33210  __37:
 33211  	;
 33212  __10:
 33213  	;
 33214  
 33215  	if !((rc == SQLITE_OK) && ((pOld != 0) || (pOld2 != 0))) {
 33216  		goto __40
 33217  	}
 33218  	pCsr = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList
 33219  __41:
 33220  	if !(pCsr != 0) {
 33221  		goto __43
 33222  	}
 33223  	if !(((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent != 0) && (((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == pOld) || ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == pOld2))) {
 33224  		goto __44
 33225  	}
 33226  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FpNext
 33227  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(1)
 33228  __44:
 33229  	;
 33230  	goto __42
 33231  __42:
 33232  	pCsr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext
 33233  	goto __41
 33234  	goto __43
 33235  __43:
 33236  	;
 33237  
 33238  	zipfileRemoveEntryFromList(tls, pTab, pOld)
 33239  	zipfileRemoveEntryFromList(tls, pTab, pOld2)
 33240  __40:
 33241  	;
 33242  
 33243  zipfile_update_done:
 33244  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */)))
 33245  	sqlite3.Xsqlite3_free(tls, zFree)
 33246  	return rc
 33247  }
 33248  
 33249  func zipfileSerializeEOCD(tls *libc.TLS, p uintptr, aBuf uintptr) int32 { /* zipfile.c:1723:12: */
 33250  	var a uintptr = aBuf
 33251  	{
 33252  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_EOCD))
 33253  		a += uintptr(4)
 33254  	}
 33255  
 33256  	{
 33257  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiDisk)
 33258  		a += uintptr(2)
 33259  	}
 33260  
 33261  	{
 33262  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiFirstDisk)
 33263  		a += uintptr(2)
 33264  	}
 33265  
 33266  	{
 33267  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnEntry)
 33268  		a += uintptr(2)
 33269  	}
 33270  
 33271  	{
 33272  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnEntryTotal)
 33273  		a += uintptr(2)
 33274  	}
 33275  
 33276  	{
 33277  		zipfilePutU32(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnSize)
 33278  		a += uintptr(4)
 33279  	}
 33280  
 33281  	{
 33282  		zipfilePutU32(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiOffset)
 33283  		a += uintptr(4)
 33284  	}
 33285  
 33286  	{
 33287  		zipfilePutU16(tls, a, uint16(0))
 33288  		a += uintptr(2)
 33289  	}
 33290  	// Size of trailing comment in bytes
 33291  
 33292  	return (int32((int64(a) - int64(aBuf)) / 1))
 33293  }
 33294  
 33295  func zipfileAppendEOCD(tls *libc.TLS, pTab uintptr, p uintptr) int32 { /* zipfile.c:1737:12: */
 33296  	var nBuf int32 = zipfileSerializeEOCD(tls, p, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer)
 33297  
 33298  	return zipfileAppendData(tls, pTab, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer, nBuf)
 33299  }
 33300  
 33301  // Serialize the CDS structure into buffer aBuf[]. Return the number
 33302  // of bytes written.
 33303  func zipfileSerializeCDS(tls *libc.TLS, pEntry uintptr, aBuf uintptr) int32 { /* zipfile.c:1747:12: */
 33304  	var a uintptr = aBuf
 33305  	var pCDS uintptr = (pEntry /* &.cds */)
 33306  
 33307  	if (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra == uintptr(0) {
 33308  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra = u16(9)
 33309  	}
 33310  
 33311  	{
 33312  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_CDS))
 33313  		a += uintptr(4)
 33314  	}
 33315  
 33316  	{
 33317  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionMadeBy)
 33318  		a += uintptr(2)
 33319  	}
 33320  
 33321  	{
 33322  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionExtract)
 33323  		a += uintptr(2)
 33324  	}
 33325  
 33326  	{
 33327  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).Fflags)
 33328  		a += uintptr(2)
 33329  	}
 33330  
 33331  	{
 33332  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression)
 33333  		a += uintptr(2)
 33334  	}
 33335  
 33336  	{
 33337  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime)
 33338  		a += uintptr(2)
 33339  	}
 33340  
 33341  	{
 33342  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate)
 33343  		a += uintptr(2)
 33344  	}
 33345  
 33346  	{
 33347  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).Fcrc32)
 33348  		a += uintptr(4)
 33349  	}
 33350  
 33351  	{
 33352  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed)
 33353  		a += uintptr(4)
 33354  	}
 33355  
 33356  	{
 33357  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed)
 33358  		a += uintptr(4)
 33359  	}
 33360  
 33361  	{
 33362  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile)
 33363  		a += uintptr(2)
 33364  	}
 33365  
 33366  	{
 33367  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra)
 33368  		a += uintptr(2)
 33369  	}
 33370  
 33371  	{
 33372  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment)
 33373  		a += uintptr(2)
 33374  	}
 33375  
 33376  	{
 33377  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiDiskStart)
 33378  		a += uintptr(2)
 33379  	}
 33380  
 33381  	{
 33382  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiInternalAttr)
 33383  		a += uintptr(2)
 33384  	}
 33385  
 33386  	{
 33387  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr)
 33388  		a += uintptr(4)
 33389  	}
 33390  
 33391  	{
 33392  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiOffset)
 33393  		a += uintptr(4)
 33394  	}
 33395  
 33396  	libc.Xmemcpy(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile, uint64((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile))
 33397  	a += uintptr((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile)
 33398  
 33399  	if (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra != 0 {
 33400  		var n int32 = (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra) + int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment))
 33401  		libc.Xmemcpy(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra, uint64(n))
 33402  		a += uintptr(n)
 33403  	} else {
 33404  
 33405  		{
 33406  			zipfilePutU16(tls, a, uint16(ZIPFILE_EXTRA_TIMESTAMP))
 33407  			a += uintptr(2)
 33408  		}
 33409  
 33410  		{
 33411  			zipfilePutU16(tls, a, uint16(5))
 33412  			a += uintptr(2)
 33413  		}
 33414  
 33415  		*(*u8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1))) = u8(0x01)
 33416  		{
 33417  			zipfilePutU32(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FmUnixTime)
 33418  			a += uintptr(4)
 33419  		}
 33420  
 33421  	}
 33422  
 33423  	return (int32((int64(a) - int64(aBuf)) / 1))
 33424  }
 33425  
 33426  func zipfileCommit(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1792:12: */
 33427  	bp := tls.Alloc(16)
 33428  	defer tls.Free(16)
 33429  
 33430  	var pTab uintptr = pVtab
 33431  	var rc int32 = SQLITE_OK
 33432  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd != 0 {
 33433  		var iOffset i64 = (*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent
 33434  		var p uintptr
 33435  		// var eocd ZipfileEOCD at bp, 16
 33436  
 33437  		var nEntry int32 = 0
 33438  
 33439  		// Write out all entries
 33440  		for p = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry; (rc == SQLITE_OK) && (p != 0); p = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext {
 33441  			var n int32 = zipfileSerializeCDS(tls, p, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer)
 33442  			rc = zipfileAppendData(tls, pTab, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer, n)
 33443  			nEntry++
 33444  		}
 33445  
 33446  		// Write out the EOCD record
 33447  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiDisk = u16(0)
 33448  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiFirstDisk = u16(0)
 33449  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry = u16(nEntry)
 33450  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntryTotal = u16(nEntry)
 33451  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnSize = (u32((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent - iOffset))
 33452  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset = u32(iOffset)
 33453  		rc = zipfileAppendEOCD(tls, pTab, bp /* &eocd */)
 33454  
 33455  		zipfileCleanupTransaction(tls, pTab)
 33456  	}
 33457  	return rc
 33458  }
 33459  
 33460  func zipfileRollback(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1822:12: */
 33461  	return zipfileCommit(tls, pVtab)
 33462  }
 33463  
 33464  func zipfileFindCursor(tls *libc.TLS, pTab uintptr, iId i64) uintptr { /* zipfile.c:1826:19: */
 33465  	var pCsr uintptr
 33466  	for pCsr = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList; pCsr != 0; pCsr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext {
 33467  		if iId == (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId {
 33468  			break
 33469  		}
 33470  	}
 33471  	return pCsr
 33472  }
 33473  
 33474  func zipfileFunctionCds(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zipfile.c:1834:13: */
 33475  	bp := tls.Alloc(128)
 33476  	defer tls.Free(128)
 33477  
 33478  	var pCsr uintptr
 33479  	var pTab uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 33480  
 33481  	pCsr = zipfileFindCursor(tls, pTab, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 33482  	if pCsr != 0 {
 33483  		var p uintptr = ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent /* &.cds */)
 33484  		var zRes uintptr = sqlite3.Xsqlite3_mprintf(tls,
 33485  
 33486  			ts+9599, /* "{\"version-made-b..." */
 33487  			libc.VaList(bp, u32((*ZipfileCDS)(unsafe.Pointer(p)).FiVersionMadeBy), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiVersionExtract),
 33488  				u32((*ZipfileCDS)(unsafe.Pointer(p)).Fflags), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiCompression),
 33489  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FmTime), u32((*ZipfileCDS)(unsafe.Pointer(p)).FmDate),
 33490  				(*ZipfileCDS)(unsafe.Pointer(p)).Fcrc32, (*ZipfileCDS)(unsafe.Pointer(p)).FszCompressed,
 33491  				(*ZipfileCDS)(unsafe.Pointer(p)).FszUncompressed, u32((*ZipfileCDS)(unsafe.Pointer(p)).FnFile),
 33492  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FnExtra), u32((*ZipfileCDS)(unsafe.Pointer(p)).FnComment),
 33493  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FiDiskStart), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiInternalAttr),
 33494  				(*ZipfileCDS)(unsafe.Pointer(p)).FiExternalAttr, (*ZipfileCDS)(unsafe.Pointer(p)).FiOffset))
 33495  
 33496  		if zRes == uintptr(0) {
 33497  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 33498  		} else {
 33499  			sqlite3.Xsqlite3_result_text(tls, context, zRes, -1, libc.UintptrFromInt32(-1))
 33500  			sqlite3.Xsqlite3_free(tls, zRes)
 33501  		}
 33502  	}
 33503  }
 33504  
 33505  // xFindFunction method.
 33506  func zipfileFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* zipfile.c:1885:12: */
 33507  	if sqlite3.Xsqlite3_stricmp(tls, ts+9941 /* "zipfile_cds" */, zName) == 0 {
 33508  		*(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct {
 33509  			f func(*libc.TLS, uintptr, int32, uintptr)
 33510  		}{zipfileFunctionCds}))
 33511  		*(*uintptr)(unsafe.Pointer(ppArg)) = pVtab
 33512  		return 1
 33513  	}
 33514  	return 0
 33515  }
 33516  
 33517  type ZipfileBuffer1 = struct {
 33518  	Fa      uintptr
 33519  	Fn      int32
 33520  	FnAlloc int32
 33521  } /* zipfile.c:1900:9 */
 33522  
 33523  type ZipfileBuffer = ZipfileBuffer1 /* zipfile.c:1900:30 */
 33524  
 33525  type ZipfileCtx1 = struct {
 33526  	FnEntry int32
 33527  	_       [4]byte
 33528  	Fbody   ZipfileBuffer
 33529  	Fcds    ZipfileBuffer
 33530  } /* zipfile.c:1907:9 */
 33531  
 33532  type ZipfileCtx = ZipfileCtx1 /* zipfile.c:1907:27 */
 33533  
 33534  func zipfileBufferGrow(tls *libc.TLS, pBuf uintptr, nByte int32) int32 { /* zipfile.c:1914:12: */
 33535  	if ((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn + nByte) > (*ZipfileBuffer)(unsafe.Pointer(pBuf)).FnAlloc {
 33536  		var aNew uintptr
 33537  		var nNew sqlite3_int64
 33538  		if (*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn != 0 {
 33539  			nNew = (int64((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn * 2))
 33540  		} else {
 33541  			nNew = int64(512)
 33542  		}
 33543  		var nReq int32 = ((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn + nByte)
 33544  
 33545  		for nNew < sqlite3_int64(nReq) {
 33546  			nNew = (nNew * int64(2))
 33547  		}
 33548  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fa, uint64(nNew))
 33549  		if aNew == uintptr(0) {
 33550  			return SQLITE_NOMEM
 33551  		}
 33552  		(*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fa = aNew
 33553  		(*ZipfileBuffer)(unsafe.Pointer(pBuf)).FnAlloc = int32(nNew)
 33554  	}
 33555  	return SQLITE_OK
 33556  }
 33557  
 33558  // xStep() callback for the zipfile() aggregate. This can be called in
 33559  // any of the following ways:
 33560  //
 33561  //   SELECT zipfile(name,data) ...
 33562  //   SELECT zipfile(name,mode,mtime,data) ...
 33563  //   SELECT zipfile(name,mode,mtime,data,method) ...
 33564  func zipfileStep(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* zipfile.c:1937:6: */
 33565  	bp := tls.Alloc(140)
 33566  	defer tls.Free(140)
 33567  
 33568  	var p uintptr // Aggregate function context
 33569  	// var e ZipfileEntry at bp+16, 96
 33570  	// New entry to add to zip archive
 33571  
 33572  	var pName uintptr
 33573  	var pMode uintptr
 33574  	var pMtime uintptr
 33575  	var pData uintptr
 33576  	var pMethod uintptr
 33577  	var bIsDir int32
 33578  	// var mode u32 at bp+136, 4
 33579  
 33580  	var rc int32
 33581  	// var zErr uintptr at bp+128, 8
 33582  
 33583  	var iMethod int32 // Compression method to use (0 or 8)
 33584  
 33585  	var aData uintptr        // Possibly compressed data for new entry
 33586  	var nData int32          // Size of aData[] in bytes
 33587  	var szUncompressed int32 // Size of data before compression
 33588  	// var aFree uintptr at bp+112, 8
 33589  	// Free this before returning
 33590  	var iCrc32 u32 // crc32 of uncompressed data
 33591  
 33592  	var zName uintptr // Path (name) of new entry
 33593  	var nName int32   // Size of zName in bytes
 33594  	var zFree uintptr // Free this before returning
 33595  	var nByte int32
 33596  	// var nOut int32 at bp+120, 4
 33597  	pName = uintptr(0)
 33598  	pMode = uintptr(0)
 33599  	pMtime = uintptr(0)
 33600  	pData = uintptr(0)
 33601  	pMethod = uintptr(0)
 33602  	bIsDir = 0
 33603  	rc = SQLITE_OK
 33604  	*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) = uintptr(0)
 33605  	iMethod = -1
 33606  	aData = uintptr(0)
 33607  	nData = 0
 33608  	szUncompressed = 0
 33609  	*(*uintptr)(unsafe.Pointer(bp + 112 /* aFree */)) = uintptr(0)
 33610  	iCrc32 = u32(0)
 33611  	zName = uintptr(0)
 33612  	nName = 0
 33613  	zFree = uintptr(0)
 33614  
 33615  	libc.Xmemset(tls, bp+16 /* &e */, 0, uint64(unsafe.Sizeof(ZipfileEntry{})))
 33616  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(ZipfileCtx{})))
 33617  	if !(p == uintptr(0)) {
 33618  		goto __1
 33619  	}
 33620  	return
 33621  __1:
 33622  	;
 33623  
 33624  	// Martial the arguments into stack variables
 33625  	if !(((nVal != 2) && (nVal != 4)) && (nVal != 5)) {
 33626  		goto __2
 33627  	}
 33628  	*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+9953 /* "wrong number of ..." */, 0)
 33629  	rc = SQLITE_ERROR
 33630  	goto zipfile_step_out
 33631  __2:
 33632  	;
 33633  	pName = *(*uintptr)(unsafe.Pointer(apVal))
 33634  	if !(nVal == 2) {
 33635  		goto __3
 33636  	}
 33637  	pData = *(*uintptr)(unsafe.Pointer(apVal + 1*8))
 33638  	goto __4
 33639  __3:
 33640  	pMode = *(*uintptr)(unsafe.Pointer(apVal + 1*8))
 33641  	pMtime = *(*uintptr)(unsafe.Pointer(apVal + 2*8))
 33642  	pData = *(*uintptr)(unsafe.Pointer(apVal + 3*8))
 33643  	if !(nVal == 5) {
 33644  		goto __5
 33645  	}
 33646  	pMethod = *(*uintptr)(unsafe.Pointer(apVal + 4*8))
 33647  __5:
 33648  	;
 33649  __4:
 33650  	;
 33651  
 33652  	// Check that the 'name' parameter looks ok.
 33653  	zName = sqlite3.Xsqlite3_value_text(tls, pName)
 33654  	nName = sqlite3.Xsqlite3_value_bytes(tls, pName)
 33655  	if !(zName == uintptr(0)) {
 33656  		goto __6
 33657  	}
 33658  	*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10001 /* "first argument t..." */, 0)
 33659  	rc = SQLITE_ERROR
 33660  	goto zipfile_step_out
 33661  __6:
 33662  	;
 33663  
 33664  	// Inspect the 'method' parameter. This must be either 0 (store), 8 (use
 33665  	// deflate compression) or NULL (choose automatically).
 33666  	if !((pMethod != 0) && (SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, pMethod))) {
 33667  		goto __7
 33668  	}
 33669  	iMethod = int32(sqlite3.Xsqlite3_value_int64(tls, pMethod))
 33670  	if !((iMethod != 0) && (iMethod != 8)) {
 33671  		goto __8
 33672  	}
 33673  	*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10046 /* "illegal method v..." */, libc.VaList(bp, iMethod))
 33674  	rc = SQLITE_ERROR
 33675  	goto zipfile_step_out
 33676  __8:
 33677  	;
 33678  __7:
 33679  	;
 33680  
 33681  	// Now inspect the data. If this is NULL, then the new entry must be a
 33682  	// directory.  Otherwise, figure out whether or not the data should
 33683  	// be deflated or simply stored in the zip archive.
 33684  	if !(sqlite3.Xsqlite3_value_type(tls, pData) == SQLITE_NULL) {
 33685  		goto __9
 33686  	}
 33687  	bIsDir = 1
 33688  	iMethod = 0
 33689  	goto __10
 33690  __9:
 33691  	aData = sqlite3.Xsqlite3_value_blob(tls, pData)
 33692  	szUncompressed = libc.AssignInt32(&nData, sqlite3.Xsqlite3_value_bytes(tls, pData))
 33693  	iCrc32 = u32(z.Xcrc32(tls, uint64(0), aData, uint32(nData)))
 33694  	if !((iMethod < 0) || (iMethod == 8)) {
 33695  		goto __11
 33696  	}
 33697  	*(*int32)(unsafe.Pointer(bp + 120 /* nOut */)) = 0
 33698  	rc = zipfileDeflate(tls, aData, nData, bp+112 /* &aFree */, bp+120 /* &nOut */, bp+128 /* &zErr */)
 33699  	if !(rc != SQLITE_OK) {
 33700  		goto __12
 33701  	}
 33702  	goto zipfile_step_out
 33703  __12:
 33704  	;
 33705  	if !((iMethod == 8) || (*(*int32)(unsafe.Pointer(bp + 120 /* nOut */)) < nData)) {
 33706  		goto __13
 33707  	}
 33708  	aData = *(*uintptr)(unsafe.Pointer(bp + 112 /* aFree */))
 33709  	nData = *(*int32)(unsafe.Pointer(bp + 120 /* nOut */))
 33710  	iMethod = 8
 33711  	goto __14
 33712  __13:
 33713  	iMethod = 0
 33714  __14:
 33715  	;
 33716  __11:
 33717  	;
 33718  __10:
 33719  	;
 33720  
 33721  	// Decode the "mode" argument.
 33722  	rc = zipfileGetMode(tls, pMode, bIsDir, bp+136 /* &mode */, bp+128 /* &zErr */)
 33723  	if !(rc != 0) {
 33724  		goto __15
 33725  	}
 33726  	goto zipfile_step_out
 33727  __15:
 33728  	;
 33729  
 33730  	// Decode the "mtime" argument.
 33731  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).FmUnixTime = zipfileGetTime(tls, pMtime)
 33732  
 33733  	// If this is a directory entry, ensure that there is exactly one '/'
 33734  	// at the end of the path. Or, if this is not a directory and the path
 33735  	// ends in '/' it is an error.
 33736  	if !(bIsDir == 0) {
 33737  		goto __16
 33738  	}
 33739  	if !((nName > 0) && (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 1))))) == '/')) {
 33740  		goto __18
 33741  	}
 33742  	*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10071 /* "non-directory na..." */, 0)
 33743  	rc = SQLITE_ERROR
 33744  	goto zipfile_step_out
 33745  __18:
 33746  	;
 33747  	goto __17
 33748  __16:
 33749  	if !((nName == 0) || (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 1))))) != '/')) {
 33750  		goto __19
 33751  	}
 33752  	zName = libc.AssignUintptr(&zFree, sqlite3.Xsqlite3_mprintf(tls, ts+9574 /* "%s/" */, libc.VaList(bp+8, zName)))
 33753  	if !(zName == uintptr(0)) {
 33754  		goto __21
 33755  	}
 33756  	rc = SQLITE_NOMEM
 33757  	goto zipfile_step_out
 33758  __21:
 33759  	;
 33760  	nName = int32(libc.Xstrlen(tls, zName))
 33761  	goto __20
 33762  __19:
 33763  __22:
 33764  	if !((nName > 1) && (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 2))))) == '/')) {
 33765  		goto __23
 33766  	}
 33767  	nName--
 33768  	goto __22
 33769  __23:
 33770  	;
 33771  __20:
 33772  	;
 33773  __17:
 33774  	;
 33775  
 33776  	// Assemble the ZipfileEntry object for the new zip archive entry
 33777  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiVersionMadeBy = (u16((int32(3) << 8) + 30))
 33778  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiVersionExtract = u16(ZIPFILE_NEWENTRY_REQUIRED)
 33779  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.Fflags = u16(ZIPFILE_NEWENTRY_FLAGS)
 33780  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiCompression = u16(iMethod)
 33781  	zipfileMtimeToDos(tls, (bp + 16 /* &e */ /* &.cds */), (*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).FmUnixTime)
 33782  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.Fcrc32 = iCrc32
 33783  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FszCompressed = u32(nData)
 33784  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FszUncompressed = u32(szUncompressed)
 33785  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiExternalAttr = (*(*u32)(unsafe.Pointer(bp + 136 /* mode */)) << 16)
 33786  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiOffset = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)
 33787  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FnFile = u16(nName)
 33788  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FzFile = zName
 33789  
 33790  	// Append the LFH to the body of the new archive
 33791  	nByte = ((ZIPFILE_LFH_FIXED_SZ + int32((*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).Fcds.FnFile)) + 9)
 33792  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+8 /* &.body */), nByte)) != 0) {
 33793  		goto __24
 33794  	}
 33795  	goto zipfile_step_out
 33796  __24:
 33797  	;
 33798  	*(*int32)(unsafe.Pointer(p + 8 /* &.body */ + 8 /* &.n */)) += (zipfileSerializeLFH(tls, bp+16 /* &e */, ((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn))))
 33799  
 33800  	// Append the data to the body of the new archive
 33801  	if !(nData > 0) {
 33802  		goto __25
 33803  	}
 33804  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+8 /* &.body */), nData)) != 0) {
 33805  		goto __26
 33806  	}
 33807  	goto zipfile_step_out
 33808  __26:
 33809  	;
 33810  	libc.Xmemcpy(tls, ((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)), aData, uint64(nData))
 33811  	*(*int32)(unsafe.Pointer(p + 8 /* &.body */ + 8 /* &.n */)) += (nData)
 33812  __25:
 33813  	;
 33814  
 33815  	// Append the CDS record to the directory of the new archive
 33816  	nByte = ((ZIPFILE_CDS_FIXED_SZ + int32((*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).Fcds.FnFile)) + 9)
 33817  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+24 /* &.cds */), nByte)) != 0) {
 33818  		goto __27
 33819  	}
 33820  	goto zipfile_step_out
 33821  __27:
 33822  	;
 33823  	*(*int32)(unsafe.Pointer(p + 24 /* &.cds */ + 8 /* &.n */)) += (zipfileSerializeCDS(tls, bp+16 /* &e */, ((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))))
 33824  
 33825  	// Increment the count of entries in the archive
 33826  	(*ZipfileCtx)(unsafe.Pointer(p)).FnEntry++
 33827  
 33828  zipfile_step_out:
 33829  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* aFree */)))
 33830  	sqlite3.Xsqlite3_free(tls, zFree)
 33831  	if !(rc != 0) {
 33832  		goto __28
 33833  	}
 33834  	if !(*(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)) != 0) {
 33835  		goto __29
 33836  	}
 33837  	sqlite3.Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)), -1)
 33838  	goto __30
 33839  __29:
 33840  	sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 33841  __30:
 33842  	;
 33843  __28:
 33844  	;
 33845  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* zErr */)))
 33846  }
 33847  
 33848  // xFinalize() callback for zipfile aggregate function.
 33849  func zipfileFinal(tls *libc.TLS, pCtx uintptr) { /* zipfile.c:2112:6: */
 33850  	bp := tls.Alloc(16)
 33851  	defer tls.Free(16)
 33852  
 33853  	var p uintptr
 33854  	// var eocd ZipfileEOCD at bp, 16
 33855  
 33856  	var nZip sqlite3_int64
 33857  	var aZip uintptr
 33858  
 33859  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(ZipfileCtx{})))
 33860  	if p == uintptr(0) {
 33861  		return
 33862  	}
 33863  	if (*ZipfileCtx)(unsafe.Pointer(p)).FnEntry > 0 {
 33864  		libc.Xmemset(tls, bp /* &eocd */, 0, uint64(unsafe.Sizeof(ZipfileEOCD{})))
 33865  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry = u16((*ZipfileCtx)(unsafe.Pointer(p)).FnEntry)
 33866  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntryTotal = u16((*ZipfileCtx)(unsafe.Pointer(p)).FnEntry)
 33867  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnSize = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn)
 33868  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)
 33869  
 33870  		nZip = (sqlite3_int64(((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn + (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn) + ZIPFILE_EOCD_FIXED_SZ))
 33871  		aZip = sqlite3.Xsqlite3_malloc64(tls, uint64(nZip))
 33872  		if aZip == uintptr(0) {
 33873  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 33874  		} else {
 33875  			libc.Xmemcpy(tls, aZip, (*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa, uint64((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn))
 33876  			libc.Xmemcpy(tls, (aZip + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)), (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa, uint64((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))
 33877  			zipfileSerializeEOCD(tls, bp /* &eocd */, (aZip + uintptr(((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn + (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))))
 33878  			sqlite3.Xsqlite3_result_blob(tls, pCtx, aZip, int32(nZip), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFree})))
 33879  		}
 33880  	}
 33881  
 33882  	sqlite3.Xsqlite3_free(tls, (*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa)
 33883  	sqlite3.Xsqlite3_free(tls, (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa)
 33884  }
 33885  
 33886  // Register the "zipfile" virtual table.
 33887  func zipfileRegister(tls *libc.TLS, db uintptr) int32 { /* zipfile.c:2147:12: */
 33888  
 33889  	var rc int32 = sqlite3.Xsqlite3_create_module(tls, db, ts+9012 /* "zipfile" */, uintptr(unsafe.Pointer(&zipfileModule)), uintptr(0))
 33890  	if rc == SQLITE_OK {
 33891  		rc = sqlite3.Xsqlite3_overload_function(tls, db, ts+9941 /* "zipfile_cds" */, -1)
 33892  	}
 33893  	if rc == SQLITE_OK {
 33894  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+9012 /* "zipfile" */, -1, SQLITE_UTF8, uintptr(0), uintptr(0),
 33895  			*(*uintptr)(unsafe.Pointer(&struct {
 33896  				f func(*libc.TLS, uintptr, int32, uintptr)
 33897  			}{zipfileStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFinal})))
 33898  	}
 33899  
 33900  	return rc
 33901  }
 33902  
 33903  var zipfileModule = sqlite3_module{
 33904  	FiVersion:      1, // iVersion
 33905  	FxCreate:       0, // xCreate
 33906  	FxConnect:      0, // xConnect
 33907  	FxBestIndex:    0, // xBestIndex
 33908  	FxDisconnect:   0, // xDisconnect
 33909  	FxDestroy:      0, // xDestroy
 33910  	FxOpen:         0, // xOpen - open a cursor
 33911  	FxClose:        0, // xClose - close a cursor
 33912  	FxFilter:       0, // xFilter - configure scan constraints
 33913  	FxNext:         0, // xNext - advance a cursor
 33914  	FxEof:          0, // xEof - check for end of scan
 33915  	FxColumn:       0, // xRowid - read data
 33916  	FxUpdate:       0, // xUpdate
 33917  	FxBegin:        0, // xSync
 33918  	FxCommit:       0, // xCommit
 33919  	FxRollback:     0, // xRollback
 33920  	FxFindFunction: 0, // xRename
 33921  } /* zipfile.c:2148:25 */
 33922  
 33923  func sqlite3_zipfile_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* zipfile.c:2191:5: */
 33924  	_ = pApi
 33925  
 33926  	_ = pzErrMsg // Unused parameter
 33927  	return zipfileRegister(tls, db)
 33928  }
 33929  
 33930  func test_rbu_delta(tls *libc.TLS, pCtx uintptr, nArg int32, apVal uintptr) { /* test_rbu.c:34:6: */
 33931  	var interp uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
 33932  	var pScript uintptr
 33933  	var i int32
 33934  
 33935  	pScript = tcl.XTcl_NewObj(tls)
 33936  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 33937  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, ts+10110 /* "rbu_delta" */, -1))
 33938  	for i = 0; i < nArg; i++ {
 33939  		var pIn uintptr = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*8))
 33940  		var z uintptr = sqlite3.Xsqlite3_value_text(tls, pIn)
 33941  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, z, -1))
 33942  	}
 33943  
 33944  	if TCL_OK == tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_GLOBAL_ONLY) {
 33945  		var z uintptr = tcl.XTcl_GetStringResult(tls, interp)
 33946  		sqlite3.Xsqlite3_result_text(tls, pCtx, z, -1, libc.UintptrFromInt32(-1))
 33947  	} else {
 33948  		tcl.XTcl_BackgroundError(tls, interp)
 33949  	}
 33950  
 33951  	for ok := true; ok; ok = 0 != 0 {
 33952  		var _objPtr uintptr = pScript
 33953  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 33954  			tcl.XTclFreeObj(tls, _objPtr)
 33955  		}
 33956  	}
 33957  }
 33958  
 33959  func test_sqlite3rbu_cmd(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:59:26: */
 33960  	bp := tls.Alloc(496)
 33961  	defer tls.Free(496)
 33962  
 33963  	var ret int32 = TCL_OK
 33964  	var pRbu uintptr = clientData
 33965  	*(*[14]RbuCmd)(unsafe.Pointer(bp + 24 /* aCmd */)) = [14]RbuCmd{
 33966  		{FzName: ts + 10120 /* "step" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                   // 0
 33967  		{FzName: ts + 10125 /* "close" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                  // 1
 33968  		{FzName: ts + 10131 /* "create_rbu_delta" */, FnArg: 2, FzUsage: ts + 489 /* "" */},       // 2
 33969  		{FzName: ts + 10148 /* "savestate" */, FnArg: 2, FzUsage: ts + 489 /* "" */},              // 3
 33970  		{FzName: ts + 10158 /* "dbMain_eval" */, FnArg: 3, FzUsage: ts + 10170 /* "SQL" */},       // 4
 33971  		{FzName: ts + 10174 /* "bp_progress" */, FnArg: 2, FzUsage: ts + 489 /* "" */},            // 5
 33972  		{FzName: ts + 10186 /* "db" */, FnArg: 3, FzUsage: ts + 10189 /* "RBU" */},                // 6
 33973  		{FzName: ts + 10193 /* "state" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                  // 7
 33974  		{FzName: ts + 10199 /* "progress" */, FnArg: 2, FzUsage: ts + 489 /* "" */},               // 8
 33975  		{FzName: ts + 10208 /* "close_no_error" */, FnArg: 2, FzUsage: ts + 489 /* "" */},         // 9
 33976  		{FzName: ts + 10223 /* "temp_size_limit" */, FnArg: 3, FzUsage: ts + 10239 /* "LIMIT" */}, // 10
 33977  		{FzName: ts + 10245 /* "temp_size" */, FnArg: 2, FzUsage: ts + 489 /* "" */},              // 11
 33978  		{FzName: ts + 10255 /* "dbRbu_eval" */, FnArg: 3, FzUsage: ts + 10170 /* "SQL" */},        // 12
 33979  		{},
 33980  	}
 33981  	// var iCmd int32 at bp+360, 4
 33982  
 33983  	if objc < 2 {
 33984  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10266 /* "METHOD" */)
 33985  		return TCL_ERROR
 33986  	}
 33987  	ret = tcl.XTcl_GetIndexFromObjStruct(tls,
 33988  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+24 /* &aCmd[0] */, int32(unsafe.Sizeof(RbuCmd{})), ts+10273 /* "method" */, 0, bp+360 /* &iCmd */)
 33989  	if ret != 0 {
 33990  		return TCL_ERROR
 33991  	}
 33992  	if objc != (*RbuCmd)(unsafe.Pointer(bp+24 /* &aCmd */ +uintptr(*(*int32)(unsafe.Pointer(bp + 360 /* iCmd */)))*24)).FnArg {
 33993  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, (*RbuCmd)(unsafe.Pointer(bp+24 /* &aCmd */ +uintptr(*(*int32)(unsafe.Pointer(bp + 360 /* iCmd */)))*24)).FzUsage)
 33994  		return TCL_ERROR
 33995  	}
 33996  
 33997  	switch *(*int32)(unsafe.Pointer(bp + 360 /* iCmd */)) {
 33998  	case 0: /* step */
 33999  		{
 34000  			var rc int32 = sqlite3.Xsqlite3rbu_step(tls, pRbu)
 34001  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34002  			break
 34003  
 34004  		}
 34005  
 34006  	case 9:
 34007  		fallthrough /* close_no_error */
 34008  	case 1: /* close */
 34009  		{
 34010  			*(*uintptr)(unsafe.Pointer(bp + 368 /* zErrmsg */)) = uintptr(0)
 34011  			var rc int32
 34012  			tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 34013  			if *(*int32)(unsafe.Pointer(bp + 360 /* iCmd */)) == 1 {
 34014  				rc = sqlite3.Xsqlite3rbu_close(tls, pRbu, bp+368 /* &zErrmsg */)
 34015  			} else {
 34016  				rc = sqlite3.Xsqlite3rbu_close(tls, pRbu, uintptr(0))
 34017  			}
 34018  			if (rc == SQLITE_OK) || (rc == SQLITE_DONE) {
 34019  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34020  
 34021  			} else {
 34022  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34023  				if *(*uintptr)(unsafe.Pointer(bp + 368 /* zErrmsg */)) != 0 {
 34024  					tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10280 /* " - " */, *(*uintptr)(unsafe.Pointer(bp + 368 /* zErrmsg */)), 0))
 34025  					sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 368 /* zErrmsg */)))
 34026  				}
 34027  				ret = TCL_ERROR
 34028  			}
 34029  			break
 34030  
 34031  		}
 34032  
 34033  	case 2: /* create_rbu_delta */
 34034  		{
 34035  			var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, 0)
 34036  			var rc int32 = sqlite3.Xsqlite3_create_function(tls,
 34037  				db, ts+10110 /* "rbu_delta" */, -1, SQLITE_UTF8, interp, *(*uintptr)(unsafe.Pointer(&struct {
 34038  					f func(*libc.TLS, uintptr, int32, uintptr)
 34039  				}{test_rbu_delta})), uintptr(0), uintptr(0))
 34040  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34041  			ret = func() int32 {
 34042  				if rc == SQLITE_OK {
 34043  					return TCL_OK
 34044  				}
 34045  				return TCL_ERROR
 34046  			}()
 34047  			break
 34048  
 34049  		}
 34050  
 34051  	case 3: /* savestate */
 34052  		{
 34053  			var rc int32 = sqlite3.Xsqlite3rbu_savestate(tls, pRbu)
 34054  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34055  			ret = func() int32 {
 34056  				if rc == SQLITE_OK {
 34057  					return TCL_OK
 34058  				}
 34059  				return TCL_ERROR
 34060  			}()
 34061  			break
 34062  
 34063  		}
 34064  
 34065  	case 12:
 34066  		fallthrough /* dbRbu_eval */
 34067  	case 4: /* dbMain_eval */
 34068  		{
 34069  			var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 360 /* iCmd */)) == 12)))
 34070  			var rc int32 = sqlite3.Xsqlite3_exec(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), uintptr(0), uintptr(0), uintptr(0))
 34071  			if rc != SQLITE_OK {
 34072  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, db), -1))
 34073  				ret = TCL_ERROR
 34074  			}
 34075  			break
 34076  
 34077  		}
 34078  
 34079  	case 5: /* bp_progress */
 34080  		{
 34081  			// var one int32 at bp+376, 4
 34082  
 34083  			// var two int32 at bp+380, 4
 34084  
 34085  			var pObj uintptr
 34086  			sqlite3.Xsqlite3rbu_bp_progress(tls, pRbu, bp+376 /* &one */, bp+380 /* &two */)
 34087  
 34088  			pObj = tcl.XTcl_NewObj(tls)
 34089  			tcl.XTcl_ListObjAppendElement(tls, interp, pObj, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 376 /* one */))))
 34090  			tcl.XTcl_ListObjAppendElement(tls, interp, pObj, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 380 /* two */))))
 34091  			tcl.XTcl_SetObjResult(tls, interp, pObj)
 34092  			break
 34093  
 34094  		}
 34095  
 34096  	case 6: /* db */
 34097  		{
 34098  			// var bArg int32 at bp+384, 4
 34099  
 34100  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+384 /* &bArg */) != 0 {
 34101  				ret = TCL_ERROR
 34102  			} else {
 34103  				// var zBuf [50]int8 at bp+388, 50
 34104  
 34105  				var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, *(*int32)(unsafe.Pointer(bp + 384 /* bArg */)))
 34106  				if sqlite3TestMakePointerStr(tls, interp, bp+388 /* &zBuf[0] */, db) != 0 {
 34107  					ret = TCL_ERROR
 34108  				} else {
 34109  					tcl.XTcl_SetResult(tls, interp, bp+388 /* &zBuf[0] */, uintptr(1))
 34110  				}
 34111  			}
 34112  			break
 34113  
 34114  		}
 34115  	case 7: /* state */
 34116  		{
 34117  			*(*[6]uintptr)(unsafe.Pointer(bp + 440 /* aRes */)) = [6]uintptr{uintptr(0), ts + 10284 /* "oal" */, ts + 10288 /* "move" */, ts + 10293 /* "checkpoint" */, ts + 10304 /* "done" */, ts + 10309 /* "error" */}
 34118  			var eState int32 = sqlite3.Xsqlite3rbu_state(tls, pRbu)
 34119  
 34120  			tcl.XTcl_SetResult(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 440 /* &aRes[0] */ + uintptr(eState)*8)), uintptr(0))
 34121  			break
 34122  
 34123  		}
 34124  	case 8: /* progress */
 34125  		{
 34126  			var nStep sqlite3_int64 = sqlite3.Xsqlite3rbu_progress(tls, pRbu)
 34127  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nStep))
 34128  			break
 34129  
 34130  		}
 34131  
 34132  	case 10: /* temp_size_limit */
 34133  		{
 34134  			// var nLimit sqlite3_int64 at bp+488, 8
 34135  
 34136  			if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+488 /* &nLimit */) != 0 {
 34137  				ret = TCL_ERROR
 34138  			} else {
 34139  				*(*sqlite3_int64)(unsafe.Pointer(bp + 488 /* nLimit */)) = sqlite3.Xsqlite3rbu_temp_size_limit(tls, pRbu, *(*sqlite3_int64)(unsafe.Pointer(bp + 488 /* nLimit */)))
 34140  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 488 /* nLimit */))))
 34141  			}
 34142  			break
 34143  
 34144  		}
 34145  	case 11: /* temp_size */
 34146  		{
 34147  			var sz sqlite3_int64 = sqlite3.Xsqlite3rbu_temp_size(tls, pRbu)
 34148  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, sz))
 34149  			break
 34150  
 34151  		}
 34152  
 34153  	default: // seems unlikely
 34154  
 34155  		break
 34156  	}
 34157  
 34158  	return ret
 34159  }
 34160  
 34161  type RbuCmd = struct {
 34162  	FzName  uintptr
 34163  	FnArg   int32
 34164  	_       [4]byte
 34165  	FzUsage uintptr
 34166  } /* test_rbu.c:67:3 */
 34167  
 34168  // Tclcmd: sqlite3rbu CMD <target-db> <rbu-db> ?<state-db>?
 34169  func test_sqlite3rbu(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:228:26: */
 34170  	var pRbu uintptr = uintptr(0)
 34171  	var zCmd uintptr
 34172  	var zTarget uintptr
 34173  	var zRbu uintptr
 34174  	var zStateDb uintptr = uintptr(0)
 34175  
 34176  	if (objc != 4) && (objc != 5) {
 34177  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10315 /* "NAME TARGET-DB R..." */)
 34178  		return TCL_ERROR
 34179  	}
 34180  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34181  	zTarget = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 34182  	zRbu = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 34183  	if objc == 5 {
 34184  		zStateDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 34185  	}
 34186  
 34187  	pRbu = sqlite3.Xsqlite3rbu_open(tls, zTarget, zRbu, zStateDb)
 34188  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 34189  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 34190  	}{test_sqlite3rbu_cmd})), pRbu, uintptr(0))
 34191  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34192  	return TCL_OK
 34193  }
 34194  
 34195  // Tclcmd: sqlite3rbu_vacuum CMD <target-db> <state-db>
 34196  func test_sqlite3rbu_vacuum(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:258:26: */
 34197  	var pRbu uintptr = uintptr(0)
 34198  	var zCmd uintptr
 34199  	var zTarget uintptr
 34200  	var zStateDb uintptr = uintptr(0)
 34201  
 34202  	if (objc != 3) && (objc != 4) {
 34203  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10348 /* "NAME TARGET-DB ?..." */)
 34204  		return TCL_ERROR
 34205  	}
 34206  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34207  	zTarget = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 34208  	if objc == 4 {
 34209  		zStateDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 34210  	}
 34211  	if (zStateDb != 0) && (int32(*(*int8)(unsafe.Pointer(zStateDb))) == 0) {
 34212  		zStateDb = uintptr(0)
 34213  	}
 34214  
 34215  	pRbu = sqlite3.Xsqlite3rbu_vacuum(tls, zTarget, zStateDb)
 34216  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 34217  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 34218  	}{test_sqlite3rbu_cmd})), pRbu, uintptr(0))
 34219  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34220  	return TCL_OK
 34221  }
 34222  
 34223  // Tclcmd: sqlite3rbu_create_vfs ?-default? NAME PARENT
 34224  func test_sqlite3rbu_create_vfs(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:287:26: */
 34225  	var zName uintptr
 34226  	var zParent uintptr
 34227  	var rc int32
 34228  
 34229  	if (objc != 3) && (objc != 4) {
 34230  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10374 /* "?-default? NAME ..." */)
 34231  		return TCL_ERROR
 34232  	}
 34233  
 34234  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8)))
 34235  	zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8)))
 34236  	if int32(*(*int8)(unsafe.Pointer(zParent))) == 0 {
 34237  		zParent = uintptr(0)
 34238  	}
 34239  
 34240  	rc = sqlite3.Xsqlite3rbu_create_vfs(tls, zName, zParent)
 34241  	if rc != SQLITE_OK {
 34242  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34243  		return TCL_ERROR
 34244  	} else if objc == 4 {
 34245  		var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, zName)
 34246  		sqlite3.Xsqlite3_vfs_register(tls, pVfs, 1)
 34247  	}
 34248  
 34249  	tcl.XTcl_ResetResult(tls, interp)
 34250  	return TCL_OK
 34251  }
 34252  
 34253  // Tclcmd: sqlite3rbu_destroy_vfs NAME
 34254  func test_sqlite3rbu_destroy_vfs(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:322:26: */
 34255  	var zName uintptr
 34256  
 34257  	if objc != 2 {
 34258  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 34259  		return TCL_ERROR
 34260  	}
 34261  
 34262  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34263  	sqlite3.Xsqlite3rbu_destroy_vfs(tls, zName)
 34264  	return TCL_OK
 34265  }
 34266  
 34267  // Tclcmd: sqlite3rbu_internal_test
 34268  func test_sqlite3rbu_internal_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:343:26: */
 34269  	bp := tls.Alloc(16)
 34270  	defer tls.Free(16)
 34271  
 34272  	var db uintptr
 34273  
 34274  	if objc != 1 {
 34275  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 34276  		return TCL_ERROR
 34277  	}
 34278  
 34279  	db = sqlite3.Xsqlite3rbu_db(tls, uintptr(0), 0)
 34280  	if db != uintptr(0) {
 34281  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10402 /* "sqlite3rbu_db(0,..." */, 0))
 34282  		return TCL_ERROR
 34283  	}
 34284  
 34285  	return TCL_OK
 34286  }
 34287  
 34288  func SqliteRbu_Init(tls *libc.TLS, interp uintptr) int32 { /* test_rbu.c:365:5: */
 34289  	var i int32
 34290  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd)) / uint64(unsafe.Sizeof(struct {
 34291  		FzName uintptr
 34292  		FxProc uintptr
 34293  	}{}))); i++ {
 34294  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd[i].FzName, aObjCmd[i].FxProc, uintptr(0), uintptr(0))
 34295  	}
 34296  	return TCL_OK
 34297  }
 34298  
 34299  var aObjCmd = [5]struct {
 34300  	FzName uintptr
 34301  	FxProc uintptr
 34302  }{
 34303  	{FzName: ts + 10425 /* "sqlite3rbu" */, FxProc: 0},
 34304  	{FzName: ts + 10436 /* "sqlite3rbu_vacuu..." */, FxProc: 0},
 34305  	{FzName: ts + 10454 /* "sqlite3rbu_creat..." */, FxProc: 0},
 34306  	{FzName: ts + 10476 /* "sqlite3rbu_destr..." */, FxProc: 0},
 34307  	{FzName: ts + 10499 /* "sqlite3rbu_inter..." */, FxProc: 0},
 34308  } /* test_rbu.c:369:5 */
 34309  
 34310  type TestSession1 = struct {
 34311  	FpSession      uintptr
 34312  	Finterp        uintptr
 34313  	FpFilterScript uintptr
 34314  } /* test_session.c:21:9 */
 34315  
 34316  type TestSession = TestSession1 /* test_session.c:21:28 */
 34317  
 34318  type TestStreamInput1 = struct {
 34319  	FnStream int32
 34320  	_        [4]byte
 34321  	FaData   uintptr
 34322  	FnData   int32
 34323  	FiData   int32
 34324  } /* test_session.c:28:9 */
 34325  
 34326  type TestStreamInput = TestStreamInput1 /* test_session.c:28:32 */
 34327  
 34328  // Extract an sqlite3* db handle from the object passed as the second
 34329  // argument. If successful, set *pDb to point to the db handle and return
 34330  // TCL_OK. Otherwise, return TCL_ERROR.
 34331  func dbHandleFromObj1(tls *libc.TLS, interp uintptr, pObj uintptr, pDb uintptr) int32 { /* test_session.c:41:12: */
 34332  	bp := tls.Alloc(88)
 34333  	defer tls.Free(88)
 34334  
 34335  	// var info Tcl_CmdInfo at bp+24, 64
 34336  
 34337  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, pObj), bp+24 /* &info */) {
 34338  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, pObj), 0))
 34339  		return TCL_ERROR
 34340  	}
 34341  
 34342  	*(*uintptr)(unsafe.Pointer(pDb)) = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 34343  	return TCL_OK
 34344  }
 34345  
 34346  /*************************************************************************
 34347  ** The following code is copied byte-for-byte from the sessions module
 34348  ** documentation.  It is used by some of the sessions modules tests to
 34349  ** ensure that the example in the documentation does actually work.
 34350   */
 34351  // Argument zSql points to a buffer containing an SQL script to execute
 34352  // against the database handle passed as the first argument. As well as
 34353  // executing the SQL script, this function collects a changeset recording
 34354  // all changes made to the "main" database file. Assuming no error occurs,
 34355  // output variables (*ppChangeset) and (*pnChangeset) are set to point
 34356  // to a buffer containing the changeset and the size of the changeset in
 34357  // bytes before returning SQLITE_OK. In this case it is the responsibility
 34358  // of the caller to eventually free the changeset blob by passing it to
 34359  // the sqlite3_free function.
 34360  //
 34361  // Or, if an error does occur, return an SQLite error code. The final
 34362  // value of (*pChangeset) and (*pnChangeset) are undefined in this case.
 34363  func sql_exec_changeset(tls *libc.TLS, db uintptr, zSql uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* test_session.c:71:5: */
 34364  	bp := tls.Alloc(8)
 34365  	defer tls.Free(8)
 34366  
 34367  	*(*uintptr)(unsafe.Pointer(bp /* pSession */)) = uintptr(0)
 34368  	var rc int32
 34369  
 34370  	// Create a new session object
 34371  	rc = sqlite3.Xsqlite3session_create(tls, db, ts+85 /* "main" */, bp /* &pSession */)
 34372  
 34373  	// Configure the session object to record changes to all tables
 34374  	if rc == SQLITE_OK {
 34375  		rc = sqlite3.Xsqlite3session_attach(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)), uintptr(0))
 34376  	}
 34377  
 34378  	// Execute the SQL script
 34379  	if rc == SQLITE_OK {
 34380  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 34381  	}
 34382  
 34383  	// Collect the changeset
 34384  	if rc == SQLITE_OK {
 34385  		rc = sqlite3.Xsqlite3session_changeset(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)), pnChangeset, ppChangeset)
 34386  	}
 34387  
 34388  	// Delete the session object
 34389  	sqlite3.Xsqlite3session_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)))
 34390  
 34391  	return rc
 34392  }
 34393  
 34394  //**********************************************************************
 34395  
 34396  // Tclcmd: sql_exec_changeset DB SQL
 34397  func test_sql_exec_changeset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:104:26: */
 34398  	bp := tls.Alloc(40)
 34399  	defer tls.Free(40)
 34400  
 34401  	var zSql uintptr
 34402  	// var db uintptr at bp+16, 8
 34403  
 34404  	// var pChangeset uintptr at bp+32, 8
 34405  
 34406  	// var nChangeset int32 at bp+24, 4
 34407  
 34408  	var rc int32
 34409  
 34410  	if objc != 3 {
 34411  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10524 /* "DB SQL" */)
 34412  		return TCL_ERROR
 34413  	}
 34414  	if dbHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &db */) != 0 {
 34415  		return TCL_ERROR
 34416  	}
 34417  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 34418  
 34419  	rc = sql_exec_changeset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zSql, bp+24 /* &nChangeset */, bp+32 /* &pChangeset */)
 34420  	if rc != SQLITE_OK {
 34421  		tcl.XTcl_ResetResult(tls, interp)
 34422  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10531 /* "error in sql_exe..." */, 0))
 34423  		return TCL_ERROR
 34424  	}
 34425  
 34426  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pChangeset */)), *(*int32)(unsafe.Pointer(bp + 24 /* nChangeset */))))
 34427  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pChangeset */)))
 34428  	return TCL_OK
 34429  }
 34430  
 34431  // Attempt to find the global variable zVar within interpreter interp
 34432  // and extract an integer value from it. Return this value.
 34433  //
 34434  // If the named variable cannot be found, or if it cannot be interpreted
 34435  // as a integer, return 0.
 34436  func test_tcl_integer(tls *libc.TLS, interp uintptr, zVar uintptr) int32 { /* test_session.c:146:12: */
 34437  	bp := tls.Alloc(4)
 34438  	defer tls.Free(4)
 34439  
 34440  	var pObj uintptr
 34441  	*(*int32)(unsafe.Pointer(bp /* iVal */)) = 0
 34442  	var pName uintptr = tcl.XTcl_NewStringObj(tls, zVar, -1)
 34443  	(*Tcl_Obj)(unsafe.Pointer(pName)).FrefCount++
 34444  	pObj = tcl.XTcl_ObjGetVar2(tls, interp, pName, uintptr(0), TCL_GLOBAL_ONLY)
 34445  	for ok := true; ok; ok = 0 != 0 {
 34446  		var _objPtr uintptr = pName
 34447  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 34448  			tcl.XTclFreeObj(tls, _objPtr)
 34449  		}
 34450  	}
 34451  	if pObj != 0 {
 34452  		tcl.XTcl_GetIntFromObj(tls, uintptr(0), pObj, bp /* &iVal */)
 34453  	}
 34454  	return *(*int32)(unsafe.Pointer(bp /* iVal */))
 34455  }
 34456  
 34457  func test_session_error(tls *libc.TLS, interp uintptr, rc int32, zErr uintptr) int32 { /* test_session.c:157:12: */
 34458  	bp := tls.Alloc(24)
 34459  	defer tls.Free(24)
 34460  
 34461  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34462  	if zErr != 0 {
 34463  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10280 /* " - " */, zErr, 0))
 34464  		sqlite3.Xsqlite3_free(tls, zErr)
 34465  	}
 34466  	return TCL_ERROR
 34467  }
 34468  
 34469  func test_table_filter(tls *libc.TLS, pCtx uintptr, zTbl uintptr) int32 { /* test_session.c:167:12: */
 34470  	bp := tls.Alloc(4)
 34471  	defer tls.Free(4)
 34472  
 34473  	var p uintptr = pCtx
 34474  	var pEval uintptr
 34475  	var rc int32
 34476  	*(*int32)(unsafe.Pointer(bp /* bRes */)) = 0
 34477  
 34478  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestSession)(unsafe.Pointer(p)).FpFilterScript)
 34479  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 34480  	rc = tcl.XTcl_ListObjAppendElement(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 34481  	if rc == TCL_OK {
 34482  		rc = tcl.XTcl_EvalObjEx(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 34483  	}
 34484  	if rc == TCL_OK {
 34485  		rc = tcl.XTcl_GetBooleanFromObj(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*TestSession)(unsafe.Pointer(p)).Finterp), bp /* &bRes */)
 34486  	}
 34487  	if rc != TCL_OK {
 34488  		// printf("error: %s\n", Tcl_GetStringResult(p->interp));
 34489  		tcl.XTcl_BackgroundError(tls, (*TestSession)(unsafe.Pointer(p)).Finterp)
 34490  	}
 34491  	for ok := true; ok; ok = 0 != 0 {
 34492  		var _objPtr uintptr = pEval
 34493  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 34494  			tcl.XTclFreeObj(tls, _objPtr)
 34495  		}
 34496  	}
 34497  
 34498  	return *(*int32)(unsafe.Pointer(bp /* bRes */))
 34499  }
 34500  
 34501  type TestSessionsBlob1 = struct {
 34502  	Fp uintptr
 34503  	Fn int32
 34504  	_  [4]byte
 34505  } /* test_session.c:191:1 */
 34506  
 34507  type TestSessionsBlob = TestSessionsBlob1 /* test_session.c:195:33 */
 34508  
 34509  func testStreamOutput(tls *libc.TLS, pCtx uintptr, pData uintptr, nData int32) int32 { /* test_session.c:197:12: */
 34510  	var pBlob uintptr = pCtx
 34511  	var pNew uintptr
 34512  
 34513  	pNew = sqlite3.Xsqlite3_realloc(tls, (*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fp, ((*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fn + nData))
 34514  	if pNew == uintptr(0) {
 34515  		return SQLITE_NOMEM
 34516  	}
 34517  	(*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fp = pNew
 34518  	libc.Xmemcpy(tls, (pNew + uintptr((*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fn)), pData, uint64(nData))
 34519  	*(*int32)(unsafe.Pointer(pBlob + 8 /* &.n */)) += (nData)
 34520  	return SQLITE_OK
 34521  }
 34522  
 34523  // Tclcmd:  $session attach TABLE
 34524  //          $session changeset
 34525  //          $session delete
 34526  //          $session enable BOOL
 34527  //          $session indirect INTEGER
 34528  //          $session patchset
 34529  //          $session table_filter SCRIPT
 34530  func test_session_cmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:225:26: */
 34531  	bp := tls.Alloc(44)
 34532  	defer tls.Free(44)
 34533  
 34534  	var p uintptr = clientData
 34535  	var pSession uintptr = (*TestSession)(unsafe.Pointer(p)).FpSession
 34536  	// var iSub int32 at bp, 4
 34537  
 34538  	var rc int32
 34539  
 34540  	if objc < 2 {
 34541  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 34542  		return TCL_ERROR
 34543  	}
 34544  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 34545  		*(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&aSub)), int32(unsafe.Sizeof(SessionSubcmd{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 34546  	if rc != TCL_OK {
 34547  		return rc
 34548  	}
 34549  	if objc != (2 + aSub[*(*int32)(unsafe.Pointer(bp /* iSub */))].FnArg) {
 34550  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, aSub[*(*int32)(unsafe.Pointer(bp /* iSub */))].FzMsg)
 34551  		return TCL_ERROR
 34552  	}
 34553  
 34554  	switch *(*int32)(unsafe.Pointer(bp /* iSub */)) {
 34555  	case 0:
 34556  		{ // attach
 34557  			var zArg uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 34558  			if (int32(*(*int8)(unsafe.Pointer(zArg))) == '*') && (int32(*(*int8)(unsafe.Pointer(zArg + 1))) == 0) {
 34559  				zArg = uintptr(0)
 34560  			}
 34561  			rc = sqlite3.Xsqlite3session_attach(tls, pSession, zArg)
 34562  			if rc != SQLITE_OK {
 34563  				return test_session_error(tls, interp, rc, uintptr(0))
 34564  			}
 34565  			break
 34566  
 34567  		}
 34568  
 34569  	case 7:
 34570  		fallthrough // patchset
 34571  	case 1:
 34572  		{ // changeset
 34573  			*(*TestSessionsBlob)(unsafe.Pointer(bp + 8 /* o */)) = TestSessionsBlob{}
 34574  			if test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */) != 0 {
 34575  				var pCtx uintptr = bp + 8 /* &o */
 34576  				if *(*int32)(unsafe.Pointer(bp /* iSub */)) == 7 {
 34577  					rc = sqlite3.Xsqlite3session_patchset_strm(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 34578  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 34579  					}{testStreamOutput})), pCtx)
 34580  				} else {
 34581  					rc = sqlite3.Xsqlite3session_changeset_strm(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 34582  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 34583  					}{testStreamOutput})), pCtx)
 34584  				}
 34585  			} else {
 34586  				if *(*int32)(unsafe.Pointer(bp /* iSub */)) == 7 {
 34587  					rc = sqlite3.Xsqlite3session_patchset(tls, pSession, (bp + 8 /* &o */ + 8 /* &.n */), (bp + 8 /* &o */ /* &.p */))
 34588  				} else {
 34589  					rc = sqlite3.Xsqlite3session_changeset(tls, pSession, (bp + 8 /* &o */ + 8 /* &.n */), (bp + 8 /* &o */ /* &.p */))
 34590  				}
 34591  			}
 34592  			if rc == SQLITE_OK {
 34593  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+8 /* &o */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+8 /* &o */)).Fn))
 34594  			}
 34595  			sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+8 /* &o */)).Fp)
 34596  			if rc != SQLITE_OK {
 34597  				return test_session_error(tls, interp, rc, uintptr(0))
 34598  			}
 34599  			break
 34600  
 34601  		}
 34602  
 34603  	case 2: // delete
 34604  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 34605  		break
 34606  
 34607  	case 3:
 34608  		{ // enable
 34609  			// var val int32 at bp+24, 4
 34610  
 34611  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+24 /* &val */) != 0 {
 34612  				return TCL_ERROR
 34613  			}
 34614  			*(*int32)(unsafe.Pointer(bp + 24 /* val */)) = sqlite3.Xsqlite3session_enable(tls, pSession, *(*int32)(unsafe.Pointer(bp + 24 /* val */)))
 34615  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 24 /* val */))) != 0))))
 34616  			break
 34617  
 34618  		}
 34619  
 34620  	case 4:
 34621  		{ // indirect
 34622  			// var val int32 at bp+28, 4
 34623  
 34624  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+28 /* &val */) != 0 {
 34625  				return TCL_ERROR
 34626  			}
 34627  			*(*int32)(unsafe.Pointer(bp + 28 /* val */)) = sqlite3.Xsqlite3session_indirect(tls, pSession, *(*int32)(unsafe.Pointer(bp + 28 /* val */)))
 34628  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 28 /* val */))) != 0))))
 34629  			break
 34630  
 34631  		}
 34632  
 34633  	case 5:
 34634  		{ // isempty
 34635  			var val int32
 34636  			val = sqlite3.Xsqlite3session_isempty(tls, pSession)
 34637  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((val) != 0))))
 34638  			break
 34639  
 34640  		}
 34641  
 34642  	case 6:
 34643  		{ // table_filter
 34644  			if (*TestSession)(unsafe.Pointer(p)).FpFilterScript != 0 {
 34645  				for ok := true; ok; ok = 0 != 0 {
 34646  					var _objPtr uintptr = (*TestSession)(unsafe.Pointer(p)).FpFilterScript
 34647  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 34648  						tcl.XTclFreeObj(tls, _objPtr)
 34649  					}
 34650  				}
 34651  			}
 34652  			(*TestSession)(unsafe.Pointer(p)).Finterp = interp
 34653  			(*TestSession)(unsafe.Pointer(p)).FpFilterScript = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 34654  			(*Tcl_Obj)(unsafe.Pointer((*TestSession)(unsafe.Pointer(p)).FpFilterScript)).FrefCount++
 34655  			sqlite3.Xsqlite3session_table_filter(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 34656  				f func(*libc.TLS, uintptr, uintptr) int32
 34657  			}{test_table_filter})), clientData)
 34658  			break
 34659  
 34660  		}
 34661  
 34662  	case 8:
 34663  		{ // diff
 34664  			*(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)) = uintptr(0)
 34665  			rc = sqlite3.Xsqlite3session_diff(tls, pSession,
 34666  				tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))),
 34667  				tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8))),
 34668  				bp+32 /* &zErr */)
 34669  
 34670  			if rc != 0 {
 34671  				return test_session_error(tls, interp, rc, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)))
 34672  			}
 34673  			break
 34674  
 34675  		}
 34676  
 34677  	case 9:
 34678  		{ // memory_used
 34679  			var nMalloc sqlite3_int64 = sqlite3.Xsqlite3session_memory_used(tls, pSession)
 34680  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nMalloc))
 34681  			break
 34682  
 34683  		}
 34684  
 34685  	case 10:
 34686  		{
 34687  			var nSize sqlite3_int64 = sqlite3.Xsqlite3session_changeset_size(tls, pSession)
 34688  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nSize))
 34689  			break
 34690  
 34691  		}
 34692  	case 11:
 34693  		{
 34694  			var rc int32
 34695  			// var iArg int32 at bp+40, 4
 34696  
 34697  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &iArg */) != 0 {
 34698  				return TCL_ERROR
 34699  			}
 34700  			rc = sqlite3.Xsqlite3session_object_config(tls,
 34701  				pSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+40 /* &iArg */)
 34702  			if rc != SQLITE_OK {
 34703  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 34704  			} else {
 34705  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 40 /* iArg */))))
 34706  			}
 34707  			break
 34708  
 34709  		}
 34710  	}
 34711  
 34712  	return TCL_OK
 34713  }
 34714  
 34715  type SessionSubcmd = struct {
 34716  	FzSub uintptr
 34717  	FnArg int32
 34718  	_     [4]byte
 34719  	FzMsg uintptr
 34720  	FiSub int32
 34721  	_     [4]byte
 34722  } /* test_session.c:233:10 */
 34723  
 34724  var aSub = [13]SessionSubcmd{
 34725  	{FzSub: ts + 10584 /* "attach" */, FnArg: 1, FzMsg: ts + 1812 /* "TABLE" */},                // 0
 34726  	{FzSub: ts + 10591 /* "changeset" */, FzMsg: ts + 489 /* "" */},                             // 1
 34727  	{FzSub: ts + 10601 /* "delete" */, FzMsg: ts + 489 /* "" */},                                // 2
 34728  	{FzSub: ts + 10608 /* "enable" */, FnArg: 1, FzMsg: ts + 10615 /* "BOOL" */},                // 3
 34729  	{FzSub: ts + 10620 /* "indirect" */, FnArg: 1, FzMsg: ts + 10615 /* "BOOL" */},              // 4
 34730  	{FzSub: ts + 10629 /* "isempty" */, FzMsg: ts + 489 /* "" */},                               // 5
 34731  	{FzSub: ts + 10637 /* "table_filter" */, FnArg: 1, FzMsg: ts + 10650 /* "SCRIPT" */},        // 6
 34732  	{FzSub: ts + 10657 /* "patchset" */, FzMsg: ts + 489 /* "" */},                              // 7
 34733  	{FzSub: ts + 10666 /* "diff" */, FnArg: 2, FzMsg: ts + 10671 /* "FROMDB TBL" */},            // 8
 34734  	{FzSub: ts + 10682 /* "memory_used" */, FzMsg: ts + 489 /* "" */},                           // 9
 34735  	{FzSub: ts + 10694 /* "changeset_size" */, FzMsg: ts + 489 /* "" */},                        // 10
 34736  	{FzSub: ts + 10709 /* "object_config_si..." */, FnArg: 1, FzMsg: ts + 2274 /* "INTEGER" */}, // 11
 34737  	{},
 34738  } /* test_session.c:238:5 */
 34739  
 34740  func test_session_del(tls *libc.TLS, clientData uintptr) { /* test_session.c:390:27: */
 34741  	var p uintptr = clientData
 34742  	if (*TestSession)(unsafe.Pointer(p)).FpFilterScript != 0 {
 34743  		for ok := true; ok; ok = 0 != 0 {
 34744  			var _objPtr uintptr = (*TestSession)(unsafe.Pointer(p)).FpFilterScript
 34745  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 34746  				tcl.XTclFreeObj(tls, _objPtr)
 34747  			}
 34748  		}
 34749  	}
 34750  	sqlite3.Xsqlite3session_delete(tls, (*TestSession)(unsafe.Pointer(p)).FpSession)
 34751  	tcl.XTcl_Free(tls, p)
 34752  }
 34753  
 34754  // Tclcmd:  sqlite3session CMD DB-HANDLE DB-NAME
 34755  func test_sqlite3session(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:400:26: */
 34756  	bp := tls.Alloc(92)
 34757  	defer tls.Free(92)
 34758  
 34759  	var db uintptr
 34760  	// var info Tcl_CmdInfo at bp+24, 64
 34761  
 34762  	var rc int32  // sqlite3session_create() return code
 34763  	var p uintptr // New wrapper object
 34764  	*(*int32)(unsafe.Pointer(bp + 88 /* iArg */)) = -1
 34765  
 34766  	if objc != 4 {
 34767  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10728 /* "CMD DB-HANDLE DB..." */)
 34768  		return TCL_ERROR
 34769  	}
 34770  
 34771  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+24 /* &info */) {
 34772  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 0))
 34773  		return TCL_ERROR
 34774  	}
 34775  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 34776  
 34777  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(TestSession{})))
 34778  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(TestSession{})))
 34779  	rc = sqlite3.Xsqlite3session_create(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8))), (p /* &.pSession */))
 34780  	if rc != SQLITE_OK {
 34781  		tcl.XTcl_Free(tls, p)
 34782  		return test_session_error(tls, interp, rc, uintptr(0))
 34783  	}
 34784  
 34785  	// Query the SQLITE_SESSION_OBJCONFIG_SIZE option to ensure that it
 34786  	// is clear by default. Then set it.
 34787  	sqlite3.Xsqlite3session_object_config(tls, (*TestSession)(unsafe.Pointer(p)).FpSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+88 /* &iArg */)
 34788  
 34789  	*(*int32)(unsafe.Pointer(bp + 88 /* iArg */)) = 1
 34790  	sqlite3.Xsqlite3session_object_config(tls, (*TestSession)(unsafe.Pointer(p)).FpSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+88 /* &iArg */)
 34791  
 34792  	tcl.XTcl_CreateObjCommand(tls,
 34793  		interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), *(*uintptr)(unsafe.Pointer(&struct {
 34794  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 34795  		}{test_session_cmd})), p,
 34796  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_session_del})))
 34797  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 34798  	return TCL_OK
 34799  }
 34800  
 34801  func test_append_value(tls *libc.TLS, pList uintptr, pVal uintptr) { /* test_session.c:446:13: */
 34802  	if pVal == uintptr(0) {
 34803  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewObj(tls))
 34804  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewObj(tls))
 34805  	} else {
 34806  		var pObj uintptr
 34807  		switch sqlite3.Xsqlite3_value_type(tls, pVal) {
 34808  		case SQLITE_NULL:
 34809  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10750 /* "n" */, 1))
 34810  			pObj = tcl.XTcl_NewObj(tls)
 34811  			break
 34812  			fallthrough
 34813  		case SQLITE_INTEGER:
 34814  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10752 /* "i" */, 1))
 34815  			pObj = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, pVal))
 34816  			break
 34817  			fallthrough
 34818  		case SQLITE_FLOAT:
 34819  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10754 /* "f" */, 1))
 34820  			pObj = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, pVal))
 34821  			break
 34822  			fallthrough
 34823  		case SQLITE_TEXT:
 34824  			{
 34825  				var z uintptr = sqlite3.Xsqlite3_value_blob(tls, pVal)
 34826  				var n int32 = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 34827  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10756 /* "t" */, 1))
 34828  				pObj = tcl.XTcl_NewStringObj(tls, z, n)
 34829  				break
 34830  
 34831  			}
 34832  			fallthrough
 34833  		default:
 34834  
 34835  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10758 /* "b" */, 1))
 34836  			pObj = tcl.XTcl_NewByteArrayObj(tls,
 34837  				sqlite3.Xsqlite3_value_blob(tls, pVal),
 34838  				sqlite3.Xsqlite3_value_bytes(tls, pVal))
 34839  			break
 34840  		}
 34841  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, pObj)
 34842  	}
 34843  }
 34844  
 34845  type TestConflictHandler1 = struct {
 34846  	Finterp          uintptr
 34847  	FpConflictScript uintptr
 34848  	FpFilterScript   uintptr
 34849  } /* test_session.c:485:9 */
 34850  
 34851  type TestConflictHandler = TestConflictHandler1 /* test_session.c:485:36 */
 34852  
 34853  func test_obj_eq_string(tls *libc.TLS, p uintptr, z uintptr) int32 { /* test_session.c:492:12: */
 34854  	bp := tls.Alloc(4)
 34855  	defer tls.Free(4)
 34856  
 34857  	var n int32
 34858  	// var nObj int32 at bp, 4
 34859  
 34860  	var zObj uintptr
 34861  
 34862  	n = int32(libc.Xstrlen(tls, z))
 34863  	zObj = tcl.XTcl_GetStringFromObj(tls, p, bp /* &nObj */)
 34864  
 34865  	return (libc.Bool32((*(*int32)(unsafe.Pointer(bp /* nObj */)) == n) && ((n == 0) || (0 == libc.Xmemcmp(tls, zObj, z, uint64(n))))))
 34866  }
 34867  
 34868  func test_filter_handler(tls *libc.TLS, pCtx uintptr, zTab uintptr) int32 { /* test_session.c:503:12: */
 34869  	bp := tls.Alloc(4)
 34870  	defer tls.Free(4)
 34871  
 34872  	var p uintptr = pCtx
 34873  	*(*int32)(unsafe.Pointer(bp /* res */)) = 1
 34874  	var pEval uintptr
 34875  	var interp uintptr = (*TestConflictHandler)(unsafe.Pointer(p)).Finterp
 34876  
 34877  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestConflictHandler)(unsafe.Pointer(p)).FpFilterScript)
 34878  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 34879  
 34880  	if ((TCL_OK != tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, zTab, -1))) ||
 34881  		(TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, pEval, TCL_EVAL_GLOBAL))) ||
 34882  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, tcl.XTcl_GetObjResult(tls, interp), bp /* &res */)) {
 34883  		tcl.XTcl_BackgroundError(tls, interp)
 34884  	}
 34885  
 34886  	for ok := true; ok; ok = 0 != 0 {
 34887  		var _objPtr uintptr = pEval
 34888  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 34889  			tcl.XTclFreeObj(tls, _objPtr)
 34890  		}
 34891  	}
 34892  	return *(*int32)(unsafe.Pointer(bp /* res */))
 34893  }
 34894  
 34895  func test_conflict_handler(tls *libc.TLS, pCtx uintptr, eConf int32, pIter uintptr) int32 { /* test_session.c:526:12: */
 34896  	bp := tls.Alloc(104)
 34897  	defer tls.Free(104)
 34898  
 34899  	var p uintptr = pCtx
 34900  	var pEval uintptr
 34901  	var interp uintptr = (*TestConflictHandler)(unsafe.Pointer(p)).Finterp
 34902  	*(*int32)(unsafe.Pointer(bp + 100 /* ret */)) = 0 // Return value
 34903  
 34904  	// var op int32 at bp+12, 4
 34905  	// SQLITE_UPDATE, DELETE or INSERT
 34906  	// var zTab uintptr at bp, 8
 34907  	// Name of table conflict is on
 34908  	// var nCol int32 at bp+8, 4
 34909  	// Number of columns in table zTab
 34910  
 34911  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestConflictHandler)(unsafe.Pointer(p)).FpConflictScript)
 34912  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 34913  
 34914  	sqlite3.Xsqlite3changeset_op(tls, pIter, bp /* &zTab */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0))
 34915  
 34916  	if eConf == SQLITE_CHANGESET_FOREIGN_KEY {
 34917  		// var nFk int32 at bp+16, 4
 34918  
 34919  		sqlite3.Xsqlite3changeset_fk_conflicts(tls, pIter, bp+16 /* &nFk */)
 34920  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, ts+10760 /* "FOREIGN_KEY" */, -1))
 34921  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 16 /* nFk */))))
 34922  	} else {
 34923  
 34924  		// Append the operation type.
 34925  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls,
 34926  			func() uintptr {
 34927  				if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT {
 34928  					return ts + 10772 /* "INSERT" */
 34929  				}
 34930  				return func() uintptr {
 34931  					if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_UPDATE {
 34932  						return ts + 10779 /* "UPDATE" */
 34933  					}
 34934  					return ts + 10786 /* "DELETE" */
 34935  				}()
 34936  			}(), -1))
 34937  
 34938  		// Append the table name.
 34939  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp /* zTab */)), -1))
 34940  
 34941  		// Append the conflict type.
 34942  		switch eConf {
 34943  		case SQLITE_CHANGESET_DATA:
 34944  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10793 /* "DATA" */, -1))
 34945  			break
 34946  			fallthrough
 34947  		case SQLITE_CHANGESET_NOTFOUND:
 34948  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10798 /* "NOTFOUND" */, -1))
 34949  			break
 34950  			fallthrough
 34951  		case SQLITE_CHANGESET_CONFLICT:
 34952  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10807 /* "CONFLICT" */, -1))
 34953  			break
 34954  			fallthrough
 34955  		case SQLITE_CHANGESET_CONSTRAINT:
 34956  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10816 /* "CONSTRAINT" */, -1))
 34957  			break
 34958  		}
 34959  
 34960  		// If this is not an INSERT, append the old row
 34961  		if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) != SQLITE_INSERT {
 34962  			var i int32
 34963  			var pOld uintptr = tcl.XTcl_NewObj(tls)
 34964  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)); i++ {
 34965  				// var pVal uintptr at bp+24, 8
 34966  
 34967  				sqlite3.Xsqlite3changeset_old(tls, pIter, i, bp+24 /* &pVal */)
 34968  				test_append_value(tls, pOld, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))
 34969  			}
 34970  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pOld)
 34971  		}
 34972  
 34973  		// If this is not a DELETE, append the new row
 34974  		if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) != SQLITE_DELETE {
 34975  			var i int32
 34976  			var pNew uintptr = tcl.XTcl_NewObj(tls)
 34977  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)); i++ {
 34978  				// var pVal uintptr at bp+32, 8
 34979  
 34980  				sqlite3.Xsqlite3changeset_new(tls, pIter, i, bp+32 /* &pVal */)
 34981  				test_append_value(tls, pNew, *(*uintptr)(unsafe.Pointer(bp + 32 /* pVal */)))
 34982  			}
 34983  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pNew)
 34984  		}
 34985  
 34986  		// If this is a CHANGESET_DATA or CHANGESET_CONFLICT conflict, append
 34987  		// the conflicting row.
 34988  		if (eConf == SQLITE_CHANGESET_DATA) || (eConf == SQLITE_CHANGESET_CONFLICT) {
 34989  			var i int32
 34990  			var pConflict uintptr = tcl.XTcl_NewObj(tls)
 34991  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)); i++ {
 34992  				var rc int32
 34993  				_ = rc
 34994  				// var pVal uintptr at bp+40, 8
 34995  
 34996  				rc = sqlite3.Xsqlite3changeset_conflict(tls, pIter, i, bp+40 /* &pVal */)
 34997  
 34998  				test_append_value(tls, pConflict, *(*uintptr)(unsafe.Pointer(bp + 40 /* pVal */)))
 34999  			}
 35000  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pConflict)
 35001  		}
 35002  
 35003  		// **********************************************************************
 35004  		//
 35005  		// This block is purely for testing some error conditions.
 35006  		if (eConf == SQLITE_CHANGESET_CONSTRAINT) ||
 35007  			(eConf == SQLITE_CHANGESET_NOTFOUND) {
 35008  			// var pVal uintptr at bp+48, 8
 35009  
 35010  			var rc int32 = sqlite3.Xsqlite3changeset_conflict(tls, pIter, 0, bp+48 /* &pVal */)
 35011  			_ = rc
 35012  
 35013  		} else {
 35014  			// var pVal uintptr at bp+56, 8
 35015  
 35016  			var rc int32 = sqlite3.Xsqlite3changeset_conflict(tls, pIter, -1, bp+56 /* &pVal */)
 35017  			_ = rc
 35018  
 35019  			rc = sqlite3.Xsqlite3changeset_conflict(tls, pIter, *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), bp+56 /* &pVal */)
 35020  
 35021  		}
 35022  		if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_DELETE {
 35023  			// var pVal uintptr at bp+64, 8
 35024  
 35025  			var rc int32 = sqlite3.Xsqlite3changeset_new(tls, pIter, 0, bp+64 /* &pVal */)
 35026  			_ = rc
 35027  
 35028  		} else {
 35029  			// var pVal uintptr at bp+72, 8
 35030  
 35031  			var rc int32 = sqlite3.Xsqlite3changeset_new(tls, pIter, -1, bp+72 /* &pVal */)
 35032  			_ = rc
 35033  
 35034  			rc = sqlite3.Xsqlite3changeset_new(tls, pIter, *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), bp+72 /* &pVal */)
 35035  
 35036  		}
 35037  		if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) == SQLITE_INSERT {
 35038  			// var pVal uintptr at bp+80, 8
 35039  
 35040  			var rc int32 = sqlite3.Xsqlite3changeset_old(tls, pIter, 0, bp+80 /* &pVal */)
 35041  			_ = rc
 35042  
 35043  		} else {
 35044  			// var pVal uintptr at bp+88, 8
 35045  
 35046  			var rc int32 = sqlite3.Xsqlite3changeset_old(tls, pIter, -1, bp+88 /* &pVal */)
 35047  			_ = rc
 35048  
 35049  			rc = sqlite3.Xsqlite3changeset_old(tls, pIter, *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)), bp+88 /* &pVal */)
 35050  
 35051  		}
 35052  		if eConf != SQLITE_CHANGESET_FOREIGN_KEY {
 35053  			// eConf!=FOREIGN_KEY is always true at this point. The condition is
 35054  			// just there to make it clearer what is being tested.
 35055  			// var nDummy int32 at bp+96, 4
 35056  
 35057  			var rc int32 = sqlite3.Xsqlite3changeset_fk_conflicts(tls, pIter, bp+96 /* &nDummy */)
 35058  			_ = rc
 35059  
 35060  		}
 35061  		// End of testing block
 35062  		//
 35063  	}
 35064  
 35065  	if TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, pEval, TCL_EVAL_GLOBAL) {
 35066  		tcl.XTcl_BackgroundError(tls, interp)
 35067  	} else {
 35068  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 35069  		if (test_obj_eq_string(tls, pRes, ts+10827 /* "OMIT" */) != 0) || (test_obj_eq_string(tls, pRes, ts+489 /* "" */) != 0) {
 35070  			*(*int32)(unsafe.Pointer(bp + 100 /* ret */)) = SQLITE_CHANGESET_OMIT
 35071  		} else if test_obj_eq_string(tls, pRes, ts+7292 /* "REPLACE" */) != 0 {
 35072  			*(*int32)(unsafe.Pointer(bp + 100 /* ret */)) = SQLITE_CHANGESET_REPLACE
 35073  		} else if test_obj_eq_string(tls, pRes, ts+7286 /* "ABORT" */) != 0 {
 35074  			*(*int32)(unsafe.Pointer(bp + 100 /* ret */)) = SQLITE_CHANGESET_ABORT
 35075  		} else {
 35076  			tcl.XTcl_GetIntFromObj(tls, uintptr(0), pRes, bp+100 /* &ret */)
 35077  		}
 35078  	}
 35079  
 35080  	for ok := true; ok; ok = 0 != 0 {
 35081  		var _objPtr uintptr = pEval
 35082  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 35083  			tcl.XTclFreeObj(tls, _objPtr)
 35084  		}
 35085  	}
 35086  	return *(*int32)(unsafe.Pointer(bp + 100 /* ret */))
 35087  }
 35088  
 35089  // The conflict handler used by sqlite3changeset_apply_replace_all().
 35090  // This conflict handler calls sqlite3_value_text16() on all available
 35091  // sqlite3_value objects and then returns CHANGESET_REPLACE, or
 35092  // CHANGESET_OMIT if REPLACE is not applicable. This is used to test the
 35093  // effect of a malloc failure within an sqlite3_value_xxx() function
 35094  // invoked by a conflict-handler callback.
 35095  func replace_handler(tls *libc.TLS, pCtx uintptr, eConf int32, pIter uintptr) int32 { /* test_session.c:693:12: */
 35096  	bp := tls.Alloc(32)
 35097  	defer tls.Free(32)
 35098  
 35099  	// var op int32 at bp+12, 4
 35100  	// SQLITE_UPDATE, DELETE or INSERT
 35101  	// var zTab uintptr at bp, 8
 35102  	// Name of table conflict is on
 35103  	// var nCol int32 at bp+8, 4
 35104  	// Number of columns in table zTab
 35105  	var i int32
 35106  	var x int32 = 0
 35107  
 35108  	sqlite3.Xsqlite3changeset_op(tls, pIter, bp /* &zTab */, bp+8 /* &nCol */, bp+12 /* &op */, uintptr(0))
 35109  
 35110  	if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) != SQLITE_INSERT {
 35111  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)); i++ {
 35112  			// var pVal uintptr at bp+16, 8
 35113  
 35114  			sqlite3.Xsqlite3changeset_old(tls, pIter, i, bp+16 /* &pVal */)
 35115  			sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))
 35116  			x++
 35117  		}
 35118  	}
 35119  
 35120  	if *(*int32)(unsafe.Pointer(bp + 12 /* op */)) != SQLITE_DELETE {
 35121  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 8 /* nCol */)); i++ {
 35122  			// var pVal uintptr at bp+24, 8
 35123  
 35124  			sqlite3.Xsqlite3changeset_new(tls, pIter, i, bp+24 /* &pVal */)
 35125  			sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))
 35126  			x++
 35127  		}
 35128  	}
 35129  
 35130  	if eConf == SQLITE_CHANGESET_DATA {
 35131  		return SQLITE_CHANGESET_REPLACE
 35132  	}
 35133  	return SQLITE_CHANGESET_OMIT
 35134  }
 35135  
 35136  func testStreamInput(tls *libc.TLS, pCtx uintptr, pData uintptr, pnData uintptr) int32 { /* test_session.c:730:12: */
 35137  	var p uintptr = pCtx
 35138  	var nReq int32 = *(*int32)(unsafe.Pointer(pnData))                                                             // Bytes of data requested
 35139  	var nRem int32 = ((*TestStreamInput)(unsafe.Pointer(p)).FnData - (*TestStreamInput)(unsafe.Pointer(p)).FiData) // Bytes of data available
 35140  	var nRet int32 = (*TestStreamInput)(unsafe.Pointer(p)).FnStream                                                // Bytes actually returned
 35141  
 35142  	// Allocate and free some space. There is no point to this, other than
 35143  	// that it allows the regular OOM fault-injection tests to cause an error
 35144  	// in this function.
 35145  	var pAlloc uintptr = sqlite3.Xsqlite3_malloc(tls, 10)
 35146  	if pAlloc == uintptr(0) {
 35147  		return SQLITE_NOMEM
 35148  	}
 35149  	sqlite3.Xsqlite3_free(tls, pAlloc)
 35150  
 35151  	if nRet > nReq {
 35152  		nRet = nReq
 35153  	}
 35154  	if nRet > nRem {
 35155  		nRet = nRem
 35156  	}
 35157  
 35158  	if nRet > 0 {
 35159  		libc.Xmemcpy(tls, pData, ((*TestStreamInput)(unsafe.Pointer(p)).FaData + uintptr((*TestStreamInput)(unsafe.Pointer(p)).FiData)), uint64(nRet))
 35160  		*(*int32)(unsafe.Pointer(p + 20 /* &.iData */)) += (nRet)
 35161  	}
 35162  
 35163  	*(*int32)(unsafe.Pointer(pnData)) = nRet
 35164  	return SQLITE_OK
 35165  }
 35166  
 35167  func testSqlite3changesetApply(tls *libc.TLS, bV2 int32, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:761:26: */
 35168  	bp := tls.Alloc(156)
 35169  	defer tls.Free(156)
 35170  
 35171  	var db uintptr // Database handle
 35172  	// var info Tcl_CmdInfo at bp+48, 64
 35173  	// Database Tcl command (objv[1]) info
 35174  	var rc int32           // Return code from changeset_invert()
 35175  	var pChangeset uintptr // Buffer containing changeset
 35176  	// var nChangeset int32 at bp+112, 4
 35177  	// Size of buffer aChangeset in bytes
 35178  	// var ctx TestConflictHandler at bp+120, 24
 35179  
 35180  	// var sStr TestStreamInput at bp+24, 24
 35181  
 35182  	*(*uintptr)(unsafe.Pointer(bp + 144 /* pRebase */)) = uintptr(0)
 35183  	*(*int32)(unsafe.Pointer(bp + 152 /* nRebase */)) = 0
 35184  	var flags int32 = 0 // Flags for apply_v2()
 35185  
 35186  	libc.Xmemset(tls, bp+24 /* &sStr */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35187  	(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 35188  
 35189  	// Check for the -nosavepoint flag
 35190  	if bV2 != 0 {
 35191  		if objc > 1 {
 35192  			var z1 uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 35193  			var n int32 = int32(libc.Xstrlen(tls, z1))
 35194  			if ((n > 1) && (n <= 12)) && (0 == sqlite3.Xsqlite3_strnicmp(tls, ts+10832 /* "-nosavepoint" */, z1, n)) {
 35195  				flags = flags | (SQLITE_CHANGESETAPPLY_NOSAVEPOINT)
 35196  				objc--
 35197  				objv += 8
 35198  			}
 35199  		}
 35200  		if objc > 1 {
 35201  			var z1 uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 35202  			var n int32 = int32(libc.Xstrlen(tls, z1))
 35203  			if ((n > 1) && (n <= 7)) && (0 == sqlite3.Xsqlite3_strnicmp(tls, ts+10845 /* "-invert" */, z1, n)) {
 35204  				flags = flags | (SQLITE_CHANGESETAPPLY_INVERT)
 35205  				objc--
 35206  				objv += 8
 35207  			}
 35208  		}
 35209  	}
 35210  
 35211  	if (objc != 4) && (objc != 5) {
 35212  		var zMsg uintptr
 35213  		if bV2 != 0 {
 35214  			zMsg = ts + 10853 /* "?-nosavepoint? ?..." */
 35215  		} else {
 35216  			zMsg = ts + 10924 /* "DB CHANGESET CON..." */
 35217  		}
 35218  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, zMsg)
 35219  		return TCL_ERROR
 35220  	}
 35221  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &info */) {
 35222  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), 0))
 35223  		return TCL_ERROR
 35224  	}
 35225  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 48 /* &info */)).FobjClientData))
 35226  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+112 /* &nChangeset */)
 35227  	(*TestConflictHandler)(unsafe.Pointer(bp + 120 /* &ctx */)).FpConflictScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 35228  	(*TestConflictHandler)(unsafe.Pointer(bp + 120 /* &ctx */)).FpFilterScript = func() uintptr {
 35229  		if objc == 5 {
 35230  			return *(*uintptr)(unsafe.Pointer(objv + 4*8))
 35231  		}
 35232  		return uintptr(0)
 35233  	}()
 35234  	(*TestConflictHandler)(unsafe.Pointer(bp + 120 /* &ctx */)).Finterp = interp
 35235  
 35236  	if (*TestStreamInput)(unsafe.Pointer(bp+24 /* &sStr */)).FnStream == 0 {
 35237  		if bV2 == 0 {
 35238  			rc = sqlite3.Xsqlite3changeset_apply(tls, db, *(*int32)(unsafe.Pointer(bp + 112 /* nChangeset */)), pChangeset,
 35239  				func() uintptr {
 35240  					if objc == 5 {
 35241  						return *(*uintptr)(unsafe.Pointer(&struct {
 35242  							f func(*libc.TLS, uintptr, uintptr) int32
 35243  						}{test_filter_handler}))
 35244  					}
 35245  					return uintptr(0)
 35246  				}(), *(*uintptr)(unsafe.Pointer(&struct {
 35247  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 35248  				}{test_conflict_handler})), bp+120 /* &ctx */)
 35249  		} else {
 35250  			rc = sqlite3.Xsqlite3changeset_apply_v2(tls, db, *(*int32)(unsafe.Pointer(bp + 112 /* nChangeset */)), pChangeset,
 35251  				func() uintptr {
 35252  					if objc == 5 {
 35253  						return *(*uintptr)(unsafe.Pointer(&struct {
 35254  							f func(*libc.TLS, uintptr, uintptr) int32
 35255  						}{test_filter_handler}))
 35256  					}
 35257  					return uintptr(0)
 35258  				}(), *(*uintptr)(unsafe.Pointer(&struct {
 35259  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 35260  				}{test_conflict_handler})), bp+120, /* &ctx */
 35261  				bp+144 /* &pRebase */, bp+152 /* &nRebase */, flags)
 35262  		}
 35263  	} else {
 35264  		(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FaData = pChangeset
 35265  		(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 112 /* nChangeset */))
 35266  		if bV2 == 0 {
 35267  			rc = sqlite3.Xsqlite3changeset_apply_strm(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 35268  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35269  			}{testStreamInput})), bp+24, /* &sStr */
 35270  				func() uintptr {
 35271  					if objc == 5 {
 35272  						return *(*uintptr)(unsafe.Pointer(&struct {
 35273  							f func(*libc.TLS, uintptr, uintptr) int32
 35274  						}{test_filter_handler}))
 35275  					}
 35276  					return uintptr(0)
 35277  				}(),
 35278  				*(*uintptr)(unsafe.Pointer(&struct {
 35279  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 35280  				}{test_conflict_handler})), bp+120 /* &ctx */)
 35281  		} else {
 35282  			rc = sqlite3.Xsqlite3changeset_apply_v2_strm(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 35283  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35284  			}{testStreamInput})), bp+24, /* &sStr */
 35285  				func() uintptr {
 35286  					if objc == 5 {
 35287  						return *(*uintptr)(unsafe.Pointer(&struct {
 35288  							f func(*libc.TLS, uintptr, uintptr) int32
 35289  						}{test_filter_handler}))
 35290  					}
 35291  					return uintptr(0)
 35292  				}(),
 35293  				*(*uintptr)(unsafe.Pointer(&struct {
 35294  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 35295  				}{test_conflict_handler})), bp+120, /* &ctx */
 35296  				bp+144 /* &pRebase */, bp+152 /* &nRebase */, flags)
 35297  		}
 35298  	}
 35299  
 35300  	if rc != SQLITE_OK {
 35301  		return test_session_error(tls, interp, rc, uintptr(0))
 35302  	} else {
 35303  		tcl.XTcl_ResetResult(tls, interp)
 35304  		if (bV2 != 0) && (*(*uintptr)(unsafe.Pointer(bp + 144 /* pRebase */)) != 0) {
 35305  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 144 /* pRebase */)), *(*int32)(unsafe.Pointer(bp + 152 /* nRebase */))))
 35306  		}
 35307  	}
 35308  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 144 /* pRebase */)))
 35309  	return TCL_OK
 35310  }
 35311  
 35312  // sqlite3changeset_apply DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?
 35313  func test_sqlite3changeset_apply(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:868:26: */
 35314  	return testSqlite3changesetApply(tls, 0, clientData, interp, objc, objv)
 35315  }
 35316  
 35317  // sqlite3changeset_apply_v2 DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?
 35318  func test_sqlite3changeset_apply_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:879:26: */
 35319  	return testSqlite3changesetApply(tls, 1, clientData, interp, objc, objv)
 35320  }
 35321  
 35322  // sqlite3changeset_apply_replace_all DB CHANGESET
 35323  func test_sqlite3changeset_apply_replace_all(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:891:26: */
 35324  	bp := tls.Alloc(92)
 35325  	defer tls.Free(92)
 35326  
 35327  	var db uintptr // Database handle
 35328  	// var info Tcl_CmdInfo at bp+24, 64
 35329  	// Database Tcl command (objv[1]) info
 35330  	var rc int32           // Return code from changeset_invert()
 35331  	var pChangeset uintptr // Buffer containing changeset
 35332  	// var nChangeset int32 at bp+88, 4
 35333  	// Size of buffer aChangeset in bytes
 35334  
 35335  	if objc != 3 {
 35336  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10969 /* "DB CHANGESET" */)
 35337  		return TCL_ERROR
 35338  	}
 35339  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+24 /* &info */) {
 35340  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 0))
 35341  		return TCL_ERROR
 35342  	}
 35343  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 35344  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+88 /* &nChangeset */)
 35345  
 35346  	rc = sqlite3.Xsqlite3changeset_apply(tls, db, *(*int32)(unsafe.Pointer(bp + 88 /* nChangeset */)), pChangeset, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 35347  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 35348  	}{replace_handler})), uintptr(0))
 35349  	if rc != SQLITE_OK {
 35350  		return test_session_error(tls, interp, rc, uintptr(0))
 35351  	}
 35352  	tcl.XTcl_ResetResult(tls, interp)
 35353  	return TCL_OK
 35354  }
 35355  
 35356  // sqlite3changeset_invert CHANGESET
 35357  func test_sqlite3changeset_invert(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:926:26: */
 35358  	bp := tls.Alloc(40)
 35359  	defer tls.Free(40)
 35360  
 35361  	var rc int32 // Return code from changeset_invert()
 35362  	// var sIn TestStreamInput at bp, 24
 35363  	// Input stream
 35364  	// var sOut TestSessionsBlob at bp+24, 16
 35365  	// Output blob
 35366  
 35367  	if objc != 2 {
 35368  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10982 /* "CHANGESET" */)
 35369  		return TCL_ERROR
 35370  	}
 35371  
 35372  	libc.Xmemset(tls, bp /* &sIn */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35373  	libc.Xmemset(tls, bp+24 /* &sOut */, 0, uint64(unsafe.Sizeof(TestSessionsBlob{})))
 35374  	(*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 35375  	(*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), (bp /* &sIn */ + 16 /* &.nData */))
 35376  
 35377  	if (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnStream != 0 {
 35378  		rc = sqlite3.Xsqlite3changeset_invert_strm(tls,
 35379  			*(*uintptr)(unsafe.Pointer(&struct {
 35380  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35381  			}{testStreamInput})), bp /* &sIn */, *(*uintptr)(unsafe.Pointer(&struct {
 35382  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 35383  			}{testStreamOutput})), bp+24 /* &sOut */)
 35384  	} else {
 35385  		rc = sqlite3.Xsqlite3changeset_invert(tls, (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FaData, (bp + 24 /* &sOut */ + 8 /* &.n */), (bp + 24 /* &sOut */ /* &.p */))
 35386  	}
 35387  	if rc != SQLITE_OK {
 35388  		rc = test_session_error(tls, interp, rc, uintptr(0))
 35389  	} else {
 35390  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fn))
 35391  	}
 35392  	sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fp)
 35393  	return rc
 35394  }
 35395  
 35396  // sqlite3changeset_concat LEFT RIGHT
 35397  func test_sqlite3changeset_concat(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:965:26: */
 35398  	bp := tls.Alloc(64)
 35399  	defer tls.Free(64)
 35400  
 35401  	var rc int32 // Return code from changeset_invert()
 35402  
 35403  	// var sLeft TestStreamInput at bp, 24
 35404  	// Input stream
 35405  	// var sRight TestStreamInput at bp+24, 24
 35406  	// Input stream
 35407  	*(*TestSessionsBlob)(unsafe.Pointer(bp + 48 /* sOut */)) = TestSessionsBlob{} // Output blob
 35408  
 35409  	if objc != 3 {
 35410  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10992 /* "LEFT RIGHT" */)
 35411  		return TCL_ERROR
 35412  	}
 35413  
 35414  	libc.Xmemset(tls, bp /* &sLeft */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35415  	libc.Xmemset(tls, bp+24 /* &sRight */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35416  	(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), (bp /* &sLeft */ + 16 /* &.nData */))
 35417  	(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sRight */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), (bp + 24 /* &sRight */ + 16 /* &.nData */))
 35418  	(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 35419  	(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sRight */)).FnStream = (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream
 35420  
 35421  	if (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream > 0 {
 35422  		rc = sqlite3.Xsqlite3changeset_concat_strm(tls,
 35423  			*(*uintptr)(unsafe.Pointer(&struct {
 35424  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35425  			}{testStreamInput})), bp, /* &sLeft */
 35426  			*(*uintptr)(unsafe.Pointer(&struct {
 35427  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35428  			}{testStreamInput})), bp+24, /* &sRight */
 35429  			*(*uintptr)(unsafe.Pointer(&struct {
 35430  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 35431  			}{testStreamOutput})), bp+48 /* &sOut */)
 35432  	} else {
 35433  		rc = sqlite3.Xsqlite3changeset_concat(tls,
 35434  			(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FaData, (*TestStreamInput)(unsafe.Pointer(bp+24 /* &sRight */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp+24 /* &sRight */)).FaData, (bp + 48 /* &sOut */ + 8 /* &.n */), (bp + 48 /* &sOut */ /* &.p */))
 35435  	}
 35436  
 35437  	if rc != SQLITE_OK {
 35438  		rc = test_session_error(tls, interp, rc, uintptr(0))
 35439  	} else {
 35440  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+48 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+48 /* &sOut */)).Fn))
 35441  	}
 35442  	sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+48 /* &sOut */)).Fp)
 35443  	return rc
 35444  }
 35445  
 35446  // sqlite3session_foreach VARNAME CHANGESET SCRIPT
 35447  func test_sqlite3session_foreach(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1013:26: */
 35448  	bp := tls.Alloc(104)
 35449  	defer tls.Free(104)
 35450  
 35451  	var pChangeset uintptr
 35452  	// var nChangeset int32 at bp+24, 4
 35453  
 35454  	// var pIter uintptr at bp+32, 8
 35455  
 35456  	var rc int32
 35457  	var pVarname uintptr
 35458  	var pCS uintptr
 35459  	var pScript uintptr
 35460  	var isCheckNext int32 = 0
 35461  	var isInvert int32 = 0
 35462  	// var sStr TestStreamInput at bp, 24
 35463  
 35464  	libc.Xmemset(tls, bp /* &sStr */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35465  
 35466  	for objc > 1 {
 35467  		var zOpt uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 35468  		var nOpt int32 = int32(libc.Xstrlen(tls, zOpt))
 35469  		if int32(*(*int8)(unsafe.Pointer(zOpt))) != '-' {
 35470  			break
 35471  		}
 35472  		if (nOpt <= 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+10845 /* "-invert" */, nOpt)) {
 35473  			isInvert = 1
 35474  		} else if (nOpt <= 5) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+11003 /* "-next" */, nOpt)) {
 35475  			isCheckNext = 1
 35476  		} else {
 35477  			break
 35478  		}
 35479  		objv += 8
 35480  		objc--
 35481  	}
 35482  	if objc != 4 {
 35483  		tcl.XTcl_WrongNumArgs(tls,
 35484  			interp, 1, objv, ts+11009 /* "?-next? ?-invert..." */)
 35485  		return TCL_ERROR
 35486  	}
 35487  
 35488  	pVarname = *(*uintptr)(unsafe.Pointer(objv + 1*8))
 35489  	pCS = *(*uintptr)(unsafe.Pointer(objv + 2*8))
 35490  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 35491  
 35492  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, pCS, bp+24 /* &nChangeset */)
 35493  	(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 35494  	if isInvert != 0 {
 35495  		var f int32 = SQLITE_CHANGESETSTART_INVERT
 35496  		if (*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream == 0 {
 35497  			rc = sqlite3.Xsqlite3changeset_start_v2(tls, bp+32 /* &pIter */, *(*int32)(unsafe.Pointer(bp + 24 /* nChangeset */)), pChangeset, f)
 35498  		} else {
 35499  			var pCtx uintptr = bp /* &sStr */
 35500  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FaData = pChangeset
 35501  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 24 /* nChangeset */))
 35502  			rc = sqlite3.Xsqlite3changeset_start_v2_strm(tls, bp+32 /* &pIter */, *(*uintptr)(unsafe.Pointer(&struct {
 35503  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35504  			}{testStreamInput})), pCtx, f)
 35505  		}
 35506  	} else {
 35507  		if (*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream == 0 {
 35508  			rc = sqlite3.Xsqlite3changeset_start(tls, bp+32 /* &pIter */, *(*int32)(unsafe.Pointer(bp + 24 /* nChangeset */)), pChangeset)
 35509  		} else {
 35510  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FaData = pChangeset
 35511  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 24 /* nChangeset */))
 35512  			rc = sqlite3.Xsqlite3changeset_start_strm(tls, bp+32 /* &pIter */, *(*uintptr)(unsafe.Pointer(&struct {
 35513  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35514  			}{testStreamInput})), bp /* &sStr */)
 35515  		}
 35516  	}
 35517  	if rc != SQLITE_OK {
 35518  		return test_session_error(tls, interp, rc, uintptr(0))
 35519  	}
 35520  
 35521  	for SQLITE_ROW == sqlite3.Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */))) {
 35522  		// var nCol int32 at bp+56, 4
 35523  		// Number of columns in table
 35524  		// var nCol2 int32 at bp+80, 4
 35525  		// Number of columns in table
 35526  		// var op int32 at bp+60, 4
 35527  		// SQLITE_INSERT, UPDATE or DELETE
 35528  		// var zTab uintptr at bp+48, 8
 35529  		// Name of table change applies to
 35530  		var pVar uintptr // Tcl value to set $VARNAME to
 35531  		var pOld uintptr // Vector of old.* values
 35532  		var pNew uintptr // Vector of new.* values
 35533  		// var bIndirect int32 at bp+64, 4
 35534  
 35535  		var zPK uintptr
 35536  		// var abPK uintptr at bp+72, 8
 35537  
 35538  		var i int32
 35539  
 35540  		// Test that _fk_conflicts() returns SQLITE_MISUSE if called on this
 35541  		// iterator.
 35542  		// var nDummy int32 at bp+40, 4
 35543  
 35544  		if SQLITE_MISUSE != sqlite3.Xsqlite3changeset_fk_conflicts(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)), bp+40 /* &nDummy */) {
 35545  			sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)))
 35546  			return TCL_ERROR
 35547  		}
 35548  
 35549  		sqlite3.Xsqlite3changeset_op(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)), bp+48 /* &zTab */, bp+56 /* &nCol */, bp+60 /* &op */, bp+64 /* &bIndirect */)
 35550  		pVar = tcl.XTcl_NewObj(tls)
 35551  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls,
 35552  			func() uintptr {
 35553  				if *(*int32)(unsafe.Pointer(bp + 60 /* op */)) == SQLITE_INSERT {
 35554  					return ts + 10772 /* "INSERT" */
 35555  				}
 35556  				return func() uintptr {
 35557  					if *(*int32)(unsafe.Pointer(bp + 60 /* op */)) == SQLITE_UPDATE {
 35558  						return ts + 10779 /* "UPDATE" */
 35559  					}
 35560  					return ts + 10786 /* "DELETE" */
 35561  				}()
 35562  			}(), -1))
 35563  
 35564  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* zTab */)), -1))
 35565  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 64 /* bIndirect */))) != 0))))
 35566  
 35567  		zPK = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 56 /* nCol */)) + 1)))
 35568  		libc.Xmemset(tls, zPK, 0, (uint64(*(*int32)(unsafe.Pointer(bp + 56 /* nCol */)) + 1)))
 35569  		sqlite3.Xsqlite3changeset_pk(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)), bp+72 /* &abPK */, bp+80 /* &nCol2 */)
 35570  
 35571  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 56 /* nCol */)); i++ {
 35572  			*(*int8)(unsafe.Pointer(zPK + uintptr(i))) = func() int8 {
 35573  				if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 72 /* abPK */)) + uintptr(i))) != 0 {
 35574  					return int8('X')
 35575  				}
 35576  				return int8('.')
 35577  			}()
 35578  		}
 35579  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls, zPK, -1))
 35580  		tcl.XTcl_Free(tls, zPK)
 35581  
 35582  		pOld = tcl.XTcl_NewObj(tls)
 35583  		if *(*int32)(unsafe.Pointer(bp + 60 /* op */)) != SQLITE_INSERT {
 35584  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 56 /* nCol */)); i++ {
 35585  				// var pVal uintptr at bp+88, 8
 35586  
 35587  				sqlite3.Xsqlite3changeset_old(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)), i, bp+88 /* &pVal */)
 35588  				test_append_value(tls, pOld, *(*uintptr)(unsafe.Pointer(bp + 88 /* pVal */)))
 35589  			}
 35590  		}
 35591  		pNew = tcl.XTcl_NewObj(tls)
 35592  		if *(*int32)(unsafe.Pointer(bp + 60 /* op */)) != SQLITE_DELETE {
 35593  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 56 /* nCol */)); i++ {
 35594  				// var pVal uintptr at bp+96, 8
 35595  
 35596  				sqlite3.Xsqlite3changeset_new(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)), i, bp+96 /* &pVal */)
 35597  				test_append_value(tls, pNew, *(*uintptr)(unsafe.Pointer(bp + 96 /* pVal */)))
 35598  			}
 35599  		}
 35600  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, pOld)
 35601  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, pNew)
 35602  
 35603  		tcl.XTcl_ObjSetVar2(tls, interp, pVarname, uintptr(0), pVar, 0)
 35604  		rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 35605  		if (rc != TCL_OK) && (rc != TCL_CONTINUE) {
 35606  			sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)))
 35607  			if rc == TCL_BREAK {
 35608  				return TCL_OK
 35609  			}
 35610  			return rc
 35611  		}
 35612  	}
 35613  
 35614  	if isCheckNext != 0 {
 35615  		var rc2 int32 = sqlite3.Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)))
 35616  		_ = rc2
 35617  		rc = sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)))
 35618  
 35619  	} else {
 35620  		rc = sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pIter */)))
 35621  	}
 35622  	if rc != SQLITE_OK {
 35623  		return test_session_error(tls, interp, rc, uintptr(0))
 35624  	}
 35625  
 35626  	return TCL_OK
 35627  }
 35628  
 35629  // tclcmd: CMD configure REBASE-BLOB
 35630  // tclcmd: CMD rebase CHANGESET
 35631  // tclcmd: CMD delete
 35632  func test_rebaser_cmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1171:26: */
 35633  	bp := tls.Alloc(48)
 35634  	defer tls.Free(48)
 35635  
 35636  	var p uintptr = clientData
 35637  	// var iSub int32 at bp, 4
 35638  
 35639  	var rc int32
 35640  
 35641  	if objc < 2 {
 35642  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 35643  		return TCL_ERROR
 35644  	}
 35645  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 35646  		*(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&aSub1)), int32(unsafe.Sizeof(RebaseSubcmd{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 35647  	if rc != TCL_OK {
 35648  		return rc
 35649  	}
 35650  	if objc != (2 + aSub1[*(*int32)(unsafe.Pointer(bp /* iSub */))].FnArg) {
 35651  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, aSub1[*(*int32)(unsafe.Pointer(bp /* iSub */))].FzMsg)
 35652  		return TCL_ERROR
 35653  	}
 35654  
 35655  	switch *(*int32)(unsafe.Pointer(bp /* iSub */)) {
 35656  	case 0:
 35657  		{ // configure
 35658  			*(*int32)(unsafe.Pointer(bp + 4 /* nRebase */)) = 0
 35659  			var pRebase uintptr = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+4 /* &nRebase */)
 35660  			rc = sqlite3.Xsqlite3rebaser_configure(tls, p, *(*int32)(unsafe.Pointer(bp + 4 /* nRebase */)), pRebase)
 35661  			break
 35662  
 35663  		}
 35664  
 35665  	case 1: // delete
 35666  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 35667  		break
 35668  
 35669  	default:
 35670  		{ // rebase
 35671  			// var sStr TestStreamInput at bp+8, 24
 35672  			// Input stream
 35673  			// var sOut TestSessionsBlob at bp+32, 16
 35674  			// Output blob
 35675  
 35676  			libc.Xmemset(tls, bp+8 /* &sStr */, 0, uint64(unsafe.Sizeof(TestStreamInput{})))
 35677  			libc.Xmemset(tls, bp+32 /* &sOut */, 0, uint64(unsafe.Sizeof(TestSessionsBlob{})))
 35678  			(*TestStreamInput)(unsafe.Pointer(bp + 8 /* &sStr */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), (bp + 8 /* &sStr */ + 16 /* &.nData */))
 35679  			(*TestStreamInput)(unsafe.Pointer(bp + 8 /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 35680  
 35681  			if (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FnStream != 0 {
 35682  				rc = sqlite3.Xsqlite3rebaser_rebase_strm(tls, p,
 35683  					*(*uintptr)(unsafe.Pointer(&struct {
 35684  						f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 35685  					}{testStreamInput})), bp+8, /* &sStr */
 35686  					*(*uintptr)(unsafe.Pointer(&struct {
 35687  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 35688  					}{testStreamOutput})), bp+32 /* &sOut */)
 35689  			} else {
 35690  				rc = sqlite3.Xsqlite3rebaser_rebase(tls, p, (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FaData, (bp + 32 /* &sOut */ + 8 /* &.n */), (bp + 32 /* &sOut */ /* &.p */))
 35691  			}
 35692  
 35693  			if rc == SQLITE_OK {
 35694  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fn))
 35695  			}
 35696  			sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fp)
 35697  			break
 35698  
 35699  		}
 35700  	}
 35701  
 35702  	if rc != SQLITE_OK {
 35703  		return test_session_error(tls, interp, rc, uintptr(0))
 35704  	}
 35705  	return TCL_OK
 35706  }
 35707  
 35708  type RebaseSubcmd = struct {
 35709  	FzSub uintptr
 35710  	FnArg int32
 35711  	_     [4]byte
 35712  	FzMsg uintptr
 35713  	FiSub int32
 35714  	_     [4]byte
 35715  } /* test_session.c:1177:10 */
 35716  
 35717  var aSub1 = [4]RebaseSubcmd{
 35718  	{FzSub: ts + 11052 /* "configure" */, FnArg: 1, FzMsg: ts + 11062 /* "REBASE-BLOB" */}, // 0
 35719  	{FzSub: ts + 10601 /* "delete" */, FzMsg: ts + 489 /* "" */},                           // 1
 35720  	{FzSub: ts + 11074 /* "rebase" */, FnArg: 1, FzMsg: ts + 10982 /* "CHANGESET" */},      // 2
 35721  	{},
 35722  } /* test_session.c:1182:5 */
 35723  
 35724  func test_rebaser_del(tls *libc.TLS, clientData uintptr) { /* test_session.c:1252:27: */
 35725  	var p uintptr = clientData
 35726  	sqlite3.Xsqlite3rebaser_delete(tls, p)
 35727  }
 35728  
 35729  // tclcmd: sqlite3rebaser_create NAME
 35730  func test_sqlite3rebaser_create(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1260:26: */
 35731  	bp := tls.Alloc(8)
 35732  	defer tls.Free(8)
 35733  
 35734  	var rc int32
 35735  	*(*uintptr)(unsafe.Pointer(bp /* pNew */)) = uintptr(0)
 35736  	if objc != 2 {
 35737  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 35738  		return SQLITE_ERROR
 35739  	}
 35740  
 35741  	rc = sqlite3.Xsqlite3rebaser_create(tls, bp /* &pNew */)
 35742  	if rc != SQLITE_OK {
 35743  		return test_session_error(tls, interp, rc, uintptr(0))
 35744  	}
 35745  
 35746  	tcl.XTcl_CreateObjCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), *(*uintptr)(unsafe.Pointer(&struct {
 35747  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35748  	}{test_rebaser_cmd})),
 35749  		*(*uintptr)(unsafe.Pointer(bp /* pNew */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_rebaser_del})))
 35750  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 35751  	return TCL_OK
 35752  }
 35753  
 35754  // tclcmd: sqlite3rebaser_configure OP VALUE
 35755  func test_sqlite3session_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1288:26: */
 35756  	bp := tls.Alloc(8)
 35757  	defer tls.Free(8)
 35758  
 35759  	var rc int32
 35760  	// var iSub int32 at bp, 4
 35761  
 35762  	// var iVal int32 at bp+4, 4
 35763  
 35764  	if objc != 3 {
 35765  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+11081 /* "OP VALUE" */)
 35766  		return SQLITE_ERROR
 35767  	}
 35768  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 35769  		*(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&aSub2)), int32(unsafe.Sizeof(ConfigOpt{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 35770  	if rc != TCL_OK {
 35771  		return rc
 35772  	}
 35773  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+4 /* &iVal */) != 0 {
 35774  		return TCL_ERROR
 35775  	}
 35776  
 35777  	rc = sqlite3.Xsqlite3session_config(tls, aSub2[*(*int32)(unsafe.Pointer(bp /* iSub */))].Fop, bp+4 /* &iVal */)
 35778  	if rc != SQLITE_OK {
 35779  		return test_session_error(tls, interp, rc, uintptr(0))
 35780  	}
 35781  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* iVal */))))
 35782  	return TCL_OK
 35783  }
 35784  
 35785  type ConfigOpt = struct {
 35786  	FzSub uintptr
 35787  	Fop   int32
 35788  	_     [4]byte
 35789  } /* test_session.c:1294:10 */
 35790  
 35791  var aSub2 = [3]ConfigOpt{
 35792  	{FzSub: ts + 11090 /* "strm_size" */, Fop: SQLITE_SESSION_CONFIG_STRMSIZE},
 35793  	{FzSub: ts + 2619 /* "invalid" */},
 35794  	{},
 35795  } /* test_session.c:1297:5 */
 35796  
 35797  func TestSession_Init(tls *libc.TLS, interp uintptr) int32 { /* test_session.c:1324:5: */
 35798  	bp := tls.Alloc(160)
 35799  	defer tls.Free(160)
 35800  
 35801  	*(*[10]struct {
 35802  		FzCmd  uintptr
 35803  		FxProc uintptr
 35804  	})(unsafe.Pointer(bp /* aCmd */)) = [10]struct {
 35805  		FzCmd  uintptr
 35806  		FxProc uintptr
 35807  	}{
 35808  		{FzCmd: ts + 11100 /* "sqlite3session" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35809  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35810  		}{test_sqlite3session}))},
 35811  		{FzCmd: ts + 11115 /* "sqlite3session_f..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35812  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35813  		}{test_sqlite3session_foreach}))},
 35814  		{FzCmd: ts + 11138 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35815  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35816  		}{test_sqlite3changeset_invert}))},
 35817  		{FzCmd: ts + 11162 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35818  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35819  		}{test_sqlite3changeset_concat}))},
 35820  		{FzCmd: ts + 11186 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35821  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35822  		}{test_sqlite3changeset_apply}))},
 35823  		{FzCmd: ts + 11209 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35824  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35825  		}{test_sqlite3changeset_apply_v2}))},
 35826  		{FzCmd: ts + 11235, /* "sqlite3changeset..." */
 35827  			FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35828  				f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35829  			}{test_sqlite3changeset_apply_replace_all}))},
 35830  		{FzCmd: ts + 11270 /* "sql_exec_changes..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35831  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35832  		}{test_sql_exec_changeset}))},
 35833  		{FzCmd: ts + 11289 /* "sqlite3rebaser_c..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35834  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35835  		}{test_sqlite3rebaser_create}))},
 35836  		{FzCmd: ts + 11311 /* "sqlite3session_c..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 35837  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 35838  		}{test_sqlite3session_config}))},
 35839  	}
 35840  	var i int32
 35841  
 35842  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof([10]struct {
 35843  		FzCmd  uintptr
 35844  		FxProc uintptr
 35845  	}{})) / uint64(unsafe.Sizeof(struct {
 35846  		FzCmd  uintptr
 35847  		FxProc uintptr
 35848  	}{}))); i++ {
 35849  		var p uintptr = (bp /* &aCmd */ + uintptr(i)*16)
 35850  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 35851  			FzCmd  uintptr
 35852  			FxProc uintptr
 35853  		})(unsafe.Pointer(p)).FzCmd, (*struct {
 35854  			FzCmd  uintptr
 35855  			FxProc uintptr
 35856  		})(unsafe.Pointer(p)).FxProc, uintptr(0), uintptr(0))
 35857  	}
 35858  
 35859  	return TCL_OK
 35860  }
 35861  
 35862  // 2014-09-08
 35863  //
 35864  // The author disclaims copyright to this source code.  In place of
 35865  // a legal notice, here is a blessing:
 35866  //
 35867  //    May you do good and not evil.
 35868  //    May you find forgiveness for yourself and forgive others.
 35869  //    May you share freely, never taking more than you give.
 35870  //
 35871  //
 35872  //
 35873  // This file contains the bulk of the implementation of the
 35874  // user-authentication extension feature.  Some parts of the user-
 35875  // authentication code are contained within the SQLite core (in the
 35876  // src/ subdirectory of the main source code tree) but those parts
 35877  // that could reasonable be separated out are moved into this file.
 35878  //
 35879  // To compile with the user-authentication feature, append this file to
 35880  // end of an SQLite amalgamation, then add the SQLITE_USER_AUTHENTICATION
 35881  // compile-time option.  See the user-auth.txt file in the same source
 35882  // directory as this file for additional information.
 35883  
 35884  // -
 35885  // This file is in the public domain.
 35886  // $FreeBSD$
 35887  
 35888  // -
 35889  // SPDX-License-Identifier: BSD-3-Clause
 35890  //
 35891  // Copyright (c) 1988, 1993
 35892  //	The Regents of the University of California.  All rights reserved.
 35893  //
 35894  // Redistribution and use in source and binary forms, with or without
 35895  // modification, are permitted provided that the following conditions
 35896  // are met:
 35897  // 1. Redistributions of source code must retain the above copyright
 35898  //    notice, this list of conditions and the following disclaimer.
 35899  // 2. Redistributions in binary form must reproduce the above copyright
 35900  //    notice, this list of conditions and the following disclaimer in the
 35901  //    documentation and/or other materials provided with the distribution.
 35902  // 3. Neither the name of the University nor the names of its contributors
 35903  //    may be used to endorse or promote products derived from this software
 35904  //    without specific prior written permission.
 35905  //
 35906  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 35907  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 35908  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 35909  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 35910  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 35911  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 35912  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 35913  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 35914  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 35915  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 35916  // SUCH DAMAGE.
 35917  //
 35918  //	@(#)limits.h	8.3 (Berkeley) 1/4/94
 35919  // $FreeBSD$
 35920  
 35921  // -
 35922  // This file is in the public domain.
 35923  // $FreeBSD$
 35924  
 35925  // -
 35926  // SPDX-License-Identifier: BSD-3-Clause
 35927  //
 35928  // Copyright (c) 1986, 1989, 1991, 1993
 35929  //	The Regents of the University of California.  All rights reserved.
 35930  // Copyright (c) 2003 Peter Wemm.
 35931  //
 35932  // Redistribution and use in source and binary forms, with or without
 35933  // modification, are permitted provided that the following conditions
 35934  // are met:
 35935  // 1. Redistributions of source code must retain the above copyright
 35936  //    notice, this list of conditions and the following disclaimer.
 35937  // 2. Redistributions in binary form must reproduce the above copyright
 35938  //    notice, this list of conditions and the following disclaimer in the
 35939  //    documentation and/or other materials provided with the distribution.
 35940  // 3. Neither the name of the University nor the names of its contributors
 35941  //    may be used to endorse or promote products derived from this software
 35942  //    without specific prior written permission.
 35943  //
 35944  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 35945  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 35946  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 35947  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 35948  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 35949  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 35950  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 35951  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 35952  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 35953  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 35954  // SUCH DAMAGE.
 35955  //
 35956  //	@(#)signal.h	8.1 (Berkeley) 6/11/93
 35957  // $FreeBSD$
 35958  
 35959  // Machine-dependent signal definitions
 35960  
 35961  // -
 35962  // SPDX-License-Identifier: BSD-3-Clause
 35963  //
 35964  // Copyright (c) 1991, 1993
 35965  //	The Regents of the University of California.  All rights reserved.
 35966  //
 35967  // This code is derived from software contributed to Berkeley by
 35968  // Berkeley Software Design, Inc.
 35969  //
 35970  // Redistribution and use in source and binary forms, with or without
 35971  // modification, are permitted provided that the following conditions
 35972  // are met:
 35973  // 1. Redistributions of source code must retain the above copyright
 35974  //    notice, this list of conditions and the following disclaimer.
 35975  // 2. Redistributions in binary form must reproduce the above copyright
 35976  //    notice, this list of conditions and the following disclaimer in the
 35977  //    documentation and/or other materials provided with the distribution.
 35978  // 3. Neither the name of the University nor the names of its contributors
 35979  //    may be used to endorse or promote products derived from this software
 35980  //    without specific prior written permission.
 35981  //
 35982  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 35983  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 35984  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 35985  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 35986  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 35987  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 35988  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 35989  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 35990  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 35991  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 35992  // SUCH DAMAGE.
 35993  //
 35994  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 35995  // $FreeBSD$
 35996  
 35997  // -
 35998  // SPDX-License-Identifier: BSD-3-Clause
 35999  //
 36000  // Copyright (c) 1982, 1986, 1989, 1991, 1993
 36001  //	The Regents of the University of California.  All rights reserved.
 36002  // (c) UNIX System Laboratories, Inc.
 36003  // All or some portions of this file are derived from material licensed
 36004  // to the University of California by American Telephone and Telegraph
 36005  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 36006  // the permission of UNIX System Laboratories, Inc.
 36007  //
 36008  // Redistribution and use in source and binary forms, with or without
 36009  // modification, are permitted provided that the following conditions
 36010  // are met:
 36011  // 1. Redistributions of source code must retain the above copyright
 36012  //    notice, this list of conditions and the following disclaimer.
 36013  // 2. Redistributions in binary form must reproduce the above copyright
 36014  //    notice, this list of conditions and the following disclaimer in the
 36015  //    documentation and/or other materials provided with the distribution.
 36016  // 3. Neither the name of the University nor the names of its contributors
 36017  //    may be used to endorse or promote products derived from this software
 36018  //    without specific prior written permission.
 36019  //
 36020  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 36021  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 36022  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 36023  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 36024  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 36025  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 36026  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 36027  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 36028  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 36029  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 36030  // SUCH DAMAGE.
 36031  //
 36032  //	@(#)signal.h	8.4 (Berkeley) 5/4/95
 36033  // $FreeBSD$
 36034  
 36035  type sig_atomic_t = int64 /* signal.h:101:14 */
 36036  
 36037  // Information pushed on stack when a signal is delivered.
 36038  // This is used by the kernel to restore state following
 36039  // execution of the signal handler.  It is also made available
 36040  // to the handler to allow it to restore state properly if
 36041  // a non-standard exit is performed.
 36042  //
 36043  // The sequence of the fields/registers after sc_mask in struct
 36044  // sigcontext must match those in mcontext_t and struct trapframe.
 36045  type sigcontext = struct {
 36046  	Fsc_mask          struct{ F__bits [4]uint32 }
 36047  	Fsc_onstack       int64
 36048  	Fsc_rdi           int64
 36049  	Fsc_rsi           int64
 36050  	Fsc_rdx           int64
 36051  	Fsc_rcx           int64
 36052  	Fsc_r8            int64
 36053  	Fsc_r9            int64
 36054  	Fsc_rax           int64
 36055  	Fsc_rbx           int64
 36056  	Fsc_rbp           int64
 36057  	Fsc_r10           int64
 36058  	Fsc_r11           int64
 36059  	Fsc_r12           int64
 36060  	Fsc_r13           int64
 36061  	Fsc_r14           int64
 36062  	Fsc_r15           int64
 36063  	Fsc_trapno        int32
 36064  	Fsc_fs            int16
 36065  	Fsc_gs            int16
 36066  	Fsc_addr          int64
 36067  	Fsc_flags         int32
 36068  	Fsc_es            int16
 36069  	Fsc_ds            int16
 36070  	Fsc_err           int64
 36071  	Fsc_rip           int64
 36072  	Fsc_cs            int64
 36073  	Fsc_rflags        int64
 36074  	Fsc_rsp           int64
 36075  	Fsc_ss            int64
 36076  	Fsc_len           int64
 36077  	Fsc_fpformat      int64
 36078  	Fsc_ownedfp       int64
 36079  	Fsc_fpstate       [64]int64
 36080  	Fsc_fsbase        int64
 36081  	Fsc_gsbase        int64
 36082  	Fsc_xfpustate     int64
 36083  	Fsc_xfpustate_len int64
 36084  	Fsc_spare         [4]int64
 36085  } /* signal.h:114:1 */
 36086  
 36087  type sigval = struct {
 36088  	_          [0]uint64
 36089  	Fsival_int int32
 36090  	_          [4]byte
 36091  } /* signal.h:171:1 */
 36092  
 36093  type __siginfo = struct {
 36094  	Fsi_signo  int32
 36095  	Fsi_errno  int32
 36096  	Fsi_code   int32
 36097  	Fsi_pid    int32
 36098  	Fsi_uid    uint32
 36099  	Fsi_status int32
 36100  	Fsi_addr   uintptr
 36101  	Fsi_value  struct {
 36102  		_          [0]uint64
 36103  		Fsival_int int32
 36104  		_          [4]byte
 36105  	}
 36106  	F_reason struct {
 36107  		_       [0]uint64
 36108  		F_fault struct{ F_trapno int32 }
 36109  		_       [36]byte
 36110  	}
 36111  } /* signal.h:229:9 */
 36112  
 36113  type siginfo_t = __siginfo /* signal.h:263:3 */
 36114  
 36115  // Signal vector "template" used in sigaction call.
 36116  type sigaction = struct {
 36117  	F__sigaction_u struct{ F__sa_handler uintptr }
 36118  	Fsa_flags      int32
 36119  	Fsa_mask       sigset_t
 36120  	_              [4]byte
 36121  } /* signal.h:368:1 */
 36122  
 36123  // If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler.
 36124  
 36125  // a timer set by timer_settime().
 36126  // an asynchronous I/O request.
 36127  // message on an empty message queue.
 36128  
 36129  type sig_t = uintptr /* signal.h:420:24 */
 36130  
 36131  type sigaltstack = struct {
 36132  	Fss_sp    uintptr
 36133  	Fss_size  uint64
 36134  	Fss_flags int32
 36135  	_         [4]byte
 36136  } /* signal.h:428:9 */
 36137  
 36138  type stack_t = sigaltstack /* signal.h:428:26 */
 36139  
 36140  // 4.3 compatibility:
 36141  // Signal vector "template" used in sigvec call.
 36142  type sigvec = struct {
 36143  	Fsv_handler uintptr
 36144  	Fsv_mask    int32
 36145  	Fsv_flags   int32
 36146  } /* signal.h:452:1 */
 36147  
 36148  // Keep this in one place only
 36149  
 36150  // Structure used in sigstack call.
 36151  type sigstack = struct {
 36152  	Fss_sp      uintptr
 36153  	Fss_onstack int32
 36154  	_           [4]byte
 36155  } /* signal.h:479:1 */
 36156  
 36157  // -
 36158  // This file is in the public domain.
 36159  // $FreeBSD$
 36160  
 36161  // -
 36162  // SPDX-License-Identifier: BSD-3-Clause
 36163  //
 36164  // Copyright (c) 2003 Peter Wemm
 36165  // Copyright (c) 1999 Marcel Moolenaar
 36166  // All rights reserved.
 36167  //
 36168  // Redistribution and use in source and binary forms, with or without
 36169  // modification, are permitted provided that the following conditions
 36170  // are met:
 36171  // 1. Redistributions of source code must retain the above copyright
 36172  //    notice, this list of conditions and the following disclaimer
 36173  //    in this position and unchanged.
 36174  // 2. Redistributions in binary form must reproduce the above copyright
 36175  //    notice, this list of conditions and the following disclaimer in the
 36176  //    documentation and/or other materials provided with the distribution.
 36177  // 3. The name of the author may not be used to endorse or promote products
 36178  //    derived from this software without specific prior written permission.
 36179  //
 36180  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 36181  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 36182  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 36183  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 36184  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 36185  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 36186  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 36187  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 36188  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 36189  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 36190  //
 36191  // $FreeBSD$
 36192  
 36193  // mc_flags bits. Shall be in sync with TF_XXX.
 36194  
 36195  type __mcontext = struct {
 36196  	Fmc_onstack       int64
 36197  	Fmc_rdi           int64
 36198  	Fmc_rsi           int64
 36199  	Fmc_rdx           int64
 36200  	Fmc_rcx           int64
 36201  	Fmc_r8            int64
 36202  	Fmc_r9            int64
 36203  	Fmc_rax           int64
 36204  	Fmc_rbx           int64
 36205  	Fmc_rbp           int64
 36206  	Fmc_r10           int64
 36207  	Fmc_r11           int64
 36208  	Fmc_r12           int64
 36209  	Fmc_r13           int64
 36210  	Fmc_r14           int64
 36211  	Fmc_r15           int64
 36212  	Fmc_trapno        uint32
 36213  	Fmc_fs            uint16
 36214  	Fmc_gs            uint16
 36215  	Fmc_addr          int64
 36216  	Fmc_flags         uint32
 36217  	Fmc_es            uint16
 36218  	Fmc_ds            uint16
 36219  	Fmc_err           int64
 36220  	Fmc_rip           int64
 36221  	Fmc_cs            int64
 36222  	Fmc_rflags        int64
 36223  	Fmc_rsp           int64
 36224  	Fmc_ss            int64
 36225  	Fmc_len           int64
 36226  	Fmc_fpformat      int64
 36227  	Fmc_ownedfp       int64
 36228  	Fmc_fpstate       [64]int64
 36229  	Fmc_fsbase        int64
 36230  	Fmc_gsbase        int64
 36231  	Fmc_xfpustate     int64
 36232  	Fmc_xfpustate_len int64
 36233  	Fmc_spare         [4]int64
 36234  } /* ucontext.h:106:9 */
 36235  
 36236  // -
 36237  // This file is in the public domain.
 36238  // $FreeBSD$
 36239  
 36240  // -
 36241  // SPDX-License-Identifier: BSD-3-Clause
 36242  //
 36243  // Copyright (c) 2003 Peter Wemm
 36244  // Copyright (c) 1999 Marcel Moolenaar
 36245  // All rights reserved.
 36246  //
 36247  // Redistribution and use in source and binary forms, with or without
 36248  // modification, are permitted provided that the following conditions
 36249  // are met:
 36250  // 1. Redistributions of source code must retain the above copyright
 36251  //    notice, this list of conditions and the following disclaimer
 36252  //    in this position and unchanged.
 36253  // 2. Redistributions in binary form must reproduce the above copyright
 36254  //    notice, this list of conditions and the following disclaimer in the
 36255  //    documentation and/or other materials provided with the distribution.
 36256  // 3. The name of the author may not be used to endorse or promote products
 36257  //    derived from this software without specific prior written permission.
 36258  //
 36259  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 36260  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 36261  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 36262  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 36263  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 36264  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 36265  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 36266  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 36267  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 36268  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 36269  //
 36270  // $FreeBSD$
 36271  
 36272  // mc_flags bits. Shall be in sync with TF_XXX.
 36273  
 36274  type mcontext_t = __mcontext /* ucontext.h:164:3 */
 36275  
 36276  // -
 36277  // SPDX-License-Identifier: BSD-3-Clause
 36278  //
 36279  // Copyright (c) 1999 Marcel Moolenaar
 36280  // All rights reserved.
 36281  //
 36282  // Redistribution and use in source and binary forms, with or without
 36283  // modification, are permitted provided that the following conditions
 36284  // are met:
 36285  // 1. Redistributions of source code must retain the above copyright
 36286  //    notice, this list of conditions and the following disclaimer
 36287  //    in this position and unchanged.
 36288  // 2. Redistributions in binary form must reproduce the above copyright
 36289  //    notice, this list of conditions and the following disclaimer in the
 36290  //    documentation and/or other materials provided with the distribution.
 36291  // 3. The name of the author may not be used to endorse or promote products
 36292  //    derived from this software without specific prior written permission.
 36293  //
 36294  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 36295  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 36296  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 36297  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 36298  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 36299  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 36300  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 36301  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 36302  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 36303  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 36304  //
 36305  // $FreeBSD$
 36306  
 36307  type __ucontext = struct {
 36308  	Fuc_sigmask  struct{ F__bits [4]uint32 }
 36309  	Fuc_mcontext mcontext_t
 36310  	Fuc_link     uintptr
 36311  	Fuc_stack    struct {
 36312  		Fss_sp    uintptr
 36313  		Fss_size  uint64
 36314  		Fss_flags int32
 36315  		_         [4]byte
 36316  	}
 36317  	Fuc_flags  int32
 36318  	F__spare__ [4]int32
 36319  	_          [4]byte
 36320  } /* _ucontext.h:36:9 */
 36321  
 36322  // -
 36323  // SPDX-License-Identifier: BSD-3-Clause
 36324  //
 36325  // Copyright (c) 1999 Marcel Moolenaar
 36326  // All rights reserved.
 36327  //
 36328  // Redistribution and use in source and binary forms, with or without
 36329  // modification, are permitted provided that the following conditions
 36330  // are met:
 36331  // 1. Redistributions of source code must retain the above copyright
 36332  //    notice, this list of conditions and the following disclaimer
 36333  //    in this position and unchanged.
 36334  // 2. Redistributions in binary form must reproduce the above copyright
 36335  //    notice, this list of conditions and the following disclaimer in the
 36336  //    documentation and/or other materials provided with the distribution.
 36337  // 3. The name of the author may not be used to endorse or promote products
 36338  //    derived from this software without specific prior written permission.
 36339  //
 36340  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 36341  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 36342  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 36343  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 36344  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 36345  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 36346  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 36347  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 36348  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 36349  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 36350  //
 36351  // $FreeBSD$
 36352  
 36353  type ucontext_t = __ucontext /* _ucontext.h:52:3 */ // getopt(3) external variable
 36354  
 36355  // Windows needs to know which symbols to export.  Unix does not.
 36356  // BUILD_sqlite should be undefined for Unix.
 36357  
 36358  // Forward declaration
 36359  type SqliteDb = struct {
 36360  	Fdb             uintptr
 36361  	Finterp         uintptr
 36362  	FzBusy          uintptr
 36363  	FzCommit        uintptr
 36364  	FzTrace         uintptr
 36365  	FzTraceV2       uintptr
 36366  	FzProfile       uintptr
 36367  	FzProgress      uintptr
 36368  	FzBindFallback  uintptr
 36369  	FzAuth          uintptr
 36370  	FdisableAuth    int32
 36371  	_               [4]byte
 36372  	FzNull          uintptr
 36373  	FpFunc          uintptr
 36374  	FpUpdateHook    uintptr
 36375  	FpPreUpdateHook uintptr
 36376  	FpRollbackHook  uintptr
 36377  	FpWalHook       uintptr
 36378  	FpUnlockNotify  uintptr
 36379  	FpCollate       uintptr
 36380  	Frc             int32
 36381  	_               [4]byte
 36382  	FpCollateNeeded uintptr
 36383  	FstmtList       uintptr
 36384  	FstmtLast       uintptr
 36385  	FmaxStmt        int32
 36386  	FnStmt          int32
 36387  	FpIncrblob      uintptr
 36388  	FnStep          int32
 36389  	FnSort          int32
 36390  	FnIndex         int32
 36391  	FnVMStep        int32
 36392  	FnTransaction   int32
 36393  	FopenFlags      int32
 36394  	FbLegacyPrepare int32
 36395  	_               [4]byte
 36396  } /* tclsqlite.c:91:25 */
 36397  
 36398  // New SQL functions can be created as TCL scripts.  Each such function
 36399  // is described by an instance of the following structure.
 36400  //
 36401  // Variable eType may be set to SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT,
 36402  // SQLITE_BLOB or SQLITE_NULL. If it is SQLITE_NULL, then the implementation
 36403  // attempts to determine the type of the result based on the Tcl object.
 36404  // If it is SQLITE_TEXT or SQLITE_BLOB, then a text (sqlite3_result_text())
 36405  // or blob (sqlite3_result_blob()) is returned. If it is SQLITE_INTEGER
 36406  // or SQLITE_FLOAT, then an attempt is made to return an integer or float
 36407  // value, falling back to float and then text if this is not possible.
 36408  type SqlFunc1 = struct {
 36409  	Finterp      uintptr
 36410  	FpScript     uintptr
 36411  	FpDb         uintptr
 36412  	FuseEvalObjv int32
 36413  	FeType       int32
 36414  	FzName       uintptr
 36415  	FpNext       uintptr
 36416  } /* tclsqlite.c:105:9 */
 36417  
 36418  // New SQL functions can be created as TCL scripts.  Each such function
 36419  // is described by an instance of the following structure.
 36420  //
 36421  // Variable eType may be set to SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT,
 36422  // SQLITE_BLOB or SQLITE_NULL. If it is SQLITE_NULL, then the implementation
 36423  // attempts to determine the type of the result based on the Tcl object.
 36424  // If it is SQLITE_TEXT or SQLITE_BLOB, then a text (sqlite3_result_text())
 36425  // or blob (sqlite3_result_blob()) is returned. If it is SQLITE_INTEGER
 36426  // or SQLITE_FLOAT, then an attempt is made to return an integer or float
 36427  // value, falling back to float and then text if this is not possible.
 36428  type SqlFunc = SqlFunc1 /* tclsqlite.c:105:24 */
 36429  
 36430  // New collation sequences function can be created as TCL scripts.  Each such
 36431  // function is described by an instance of the following structure.
 36432  type SqlCollate1 = struct {
 36433  	Finterp  uintptr
 36434  	FzScript uintptr
 36435  	FpNext   uintptr
 36436  } /* tclsqlite.c:120:9 */
 36437  
 36438  // New collation sequences function can be created as TCL scripts.  Each such
 36439  // function is described by an instance of the following structure.
 36440  type SqlCollate = SqlCollate1 /* tclsqlite.c:120:27 */
 36441  
 36442  // Prepared statements are cached for faster execution.  Each prepared
 36443  // statement is described by an instance of the following structure.
 36444  type SqlPreparedStmt1 = struct {
 36445  	FpNext  uintptr
 36446  	FpPrev  uintptr
 36447  	FpStmt  uintptr
 36448  	FnSql   int32
 36449  	_       [4]byte
 36450  	FzSql   uintptr
 36451  	FnParm  int32
 36452  	_       [4]byte
 36453  	FapParm uintptr
 36454  } /* tclsqlite.c:131:9 */
 36455  
 36456  // Prepared statements are cached for faster execution.  Each prepared
 36457  // statement is described by an instance of the following structure.
 36458  type SqlPreparedStmt = SqlPreparedStmt1 /* tclsqlite.c:131:32 */
 36459  
 36460  type IncrblobChannel1 = struct {
 36461  	FpBlob   uintptr
 36462  	FpDb     uintptr
 36463  	FiSeek   int32
 36464  	_        [4]byte
 36465  	Fchannel Tcl_Channel
 36466  	FpNext   uintptr
 36467  	FpPrev   uintptr
 36468  } /* tclsqlite.c:142:9 */
 36469  
 36470  type IncrblobChannel = IncrblobChannel1 /* tclsqlite.c:142:32 */
 36471  
 36472  // Compute a string length that is limited to what can be stored in
 36473  // lower 30 bits of a 32-bit signed integer.
 36474  func strlen30(tls *libc.TLS, z uintptr) int32 { /* tclsqlite.c:202:12: */
 36475  	var z2 uintptr = z
 36476  	for *(*int8)(unsafe.Pointer(z2)) != 0 {
 36477  		z2++
 36478  	}
 36479  	return (0x3fffffff & (int32((int64(z2) - int64(z)) / 1)))
 36480  }
 36481  
 36482  // Close all incrblob channels opened using database connection pDb.
 36483  // This is called when shutting down the database connection.
 36484  func closeIncrblobChannels(tls *libc.TLS, pDb uintptr) { /* tclsqlite.c:214:13: */
 36485  	var p uintptr
 36486  	var pNext uintptr
 36487  
 36488  	for p = (*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob; p != 0; p = pNext {
 36489  		pNext = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 36490  
 36491  		// Note: Calling unregister here call Tcl_Close on the incrblob channel,
 36492  		// which deletes the IncrblobChannel structure at *p. So do not
 36493  		// call Tcl_Free() here.
 36494  		tcl.XTcl_UnregisterChannel(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel)
 36495  	}
 36496  }
 36497  
 36498  // Close an incremental blob channel.
 36499  func incrblobClose(tls *libc.TLS, instanceData ClientData, interp uintptr) int32 { /* tclsqlite.c:232:26: */
 36500  	var p uintptr = instanceData
 36501  	var rc int32 = sqlite3.Xsqlite3_blob_close(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 36502  	var db uintptr = (*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).Fdb
 36503  
 36504  	// Remove the channel from the SqliteDb.pIncrblob list.
 36505  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpNext != 0 {
 36506  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpNext)).FpPrev = (*IncrblobChannel)(unsafe.Pointer(p)).FpPrev
 36507  	}
 36508  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpPrev != 0 {
 36509  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpPrev)).FpNext = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 36510  	}
 36511  	if (*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).FpIncrblob == p {
 36512  		(*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).FpIncrblob = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 36513  	}
 36514  
 36515  	// Free the IncrblobChannel structure
 36516  	tcl.XTcl_Free(tls, p)
 36517  
 36518  	if rc != SQLITE_OK {
 36519  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, db), uintptr(1))
 36520  		return TCL_ERROR
 36521  	}
 36522  	return TCL_OK
 36523  }
 36524  
 36525  // Read data from an incremental blob channel.
 36526  func incrblobInput(tls *libc.TLS, instanceData ClientData, buf uintptr, bufSize int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:264:26: */
 36527  	var p uintptr = instanceData
 36528  	var nRead int32 = bufSize // Number of bytes to read
 36529  	var nBlob int32           // Total size of the blob
 36530  	var rc int32              // sqlite error code
 36531  
 36532  	nBlob = sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 36533  	if ((*IncrblobChannel)(unsafe.Pointer(p)).FiSeek + nRead) > nBlob {
 36534  		nRead = (nBlob - (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 36535  	}
 36536  	if nRead <= 0 {
 36537  		return 0
 36538  	}
 36539  
 36540  	rc = sqlite3.Xsqlite3_blob_read(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob, buf, nRead, (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 36541  	if rc != SQLITE_OK {
 36542  		*(*int32)(unsafe.Pointer(errorCodePtr)) = rc
 36543  		return -1
 36544  	}
 36545  
 36546  	*(*int32)(unsafe.Pointer(p + 16 /* &.iSeek */)) += (nRead)
 36547  	return nRead
 36548  }
 36549  
 36550  // Write data to an incremental blob channel.
 36551  func incrblobOutput(tls *libc.TLS, instanceData ClientData, buf uintptr, toWrite int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:296:26: */
 36552  	var p uintptr = instanceData
 36553  	var nWrite int32 = toWrite // Number of bytes to write
 36554  	var nBlob int32            // Total size of the blob
 36555  	var rc int32               // sqlite error code
 36556  
 36557  	nBlob = sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 36558  	if ((*IncrblobChannel)(unsafe.Pointer(p)).FiSeek + nWrite) > nBlob {
 36559  		*(*int32)(unsafe.Pointer(errorCodePtr)) = EINVAL
 36560  		return -1
 36561  	}
 36562  	if nWrite <= 0 {
 36563  		return 0
 36564  	}
 36565  
 36566  	rc = sqlite3.Xsqlite3_blob_write(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob, buf, nWrite, (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 36567  	if rc != SQLITE_OK {
 36568  		*(*int32)(unsafe.Pointer(errorCodePtr)) = EIO
 36569  		return -1
 36570  	}
 36571  
 36572  	*(*int32)(unsafe.Pointer(p + 16 /* &.iSeek */)) += (nWrite)
 36573  	return nWrite
 36574  }
 36575  
 36576  // Seek an incremental blob channel.
 36577  func incrblobSeek(tls *libc.TLS, instanceData ClientData, offset int64, seekMode int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:329:26: */
 36578  	var p uintptr = instanceData
 36579  
 36580  	switch seekMode {
 36581  	case SEEK_SET:
 36582  		(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = int32(offset)
 36583  		break
 36584  	case SEEK_CUR:
 36585  		*(*int32)(unsafe.Pointer(p + 16 /* &.iSeek */)) += int32((offset))
 36586  		break
 36587  	case SEEK_END:
 36588  		(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = (int32(int64(sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)) + offset))
 36589  		break
 36590  
 36591  	default:
 36592  	}
 36593  
 36594  	return (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek
 36595  }
 36596  
 36597  func incrblobWatch(tls *libc.TLS, instanceData ClientData, mode int32) { /* tclsqlite.c:355:27: */
 36598  	// NO-OP
 36599  }
 36600  
 36601  func incrblobHandle(tls *libc.TLS, instanceData ClientData, dir int32, hPtr uintptr) int32 { /* tclsqlite.c:361:26: */
 36602  	return TCL_ERROR
 36603  }
 36604  
 36605  var IncrblobChannelType = Tcl_ChannelType{
 36606  	FtypeName:      ts + 11333,   /* "incrblob" */ // typeName
 36607  	Fversion:       uintptr(0x2), // version
 36608  	FcloseProc:     0,            // closeProc
 36609  	FinputProc:     0,            // inputProc
 36610  	FoutputProc:    0,            // outputProc
 36611  	FseekProc:      0,            // getOptionProc
 36612  	FwatchProc:     0,            // watchProc (this is a no-op)
 36613  	FgetHandleProc: 0,            // wideSeekProc
 36614  } /* tclsqlite.c:369:24 */
 36615  
 36616  // Create a new incrblob channel.
 36617  func createIncrblobChannel(tls *libc.TLS, interp uintptr, pDb uintptr, zDb uintptr, zTable uintptr, zColumn uintptr, iRow sqlite_int64, isReadonly int32) int32 { /* tclsqlite.c:390:12: */
 36618  	bp := tls.Alloc(80)
 36619  	defer tls.Free(80)
 36620  
 36621  	var p uintptr
 36622  	var db uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Fdb
 36623  	// var pBlob uintptr at bp+8, 8
 36624  
 36625  	var rc int32
 36626  	var flags int32 = ((int32(1) << 1) | (func() int32 {
 36627  		if isReadonly != 0 {
 36628  			return 0
 36629  		}
 36630  		return (int32(1) << 2)
 36631  	}()))
 36632  	// var zChannel [64]int8 at bp+16, 64
 36633  
 36634  	rc = sqlite3.Xsqlite3_blob_open(tls, db, zDb, zTable, zColumn, iRow, libc.BoolInt32(!(isReadonly != 0)), bp+8 /* &pBlob */)
 36635  	if rc != SQLITE_OK {
 36636  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 36637  		return TCL_ERROR
 36638  	}
 36639  
 36640  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(IncrblobChannel{})))
 36641  	(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = 0
 36642  	(*IncrblobChannel)(unsafe.Pointer(p)).FpBlob = *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))
 36643  
 36644  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+16 /* &zChannel[0] */, ts+11342 /* "incrblob_%d" */, libc.VaList(bp, libc.PreIncInt32(&count, 1)))
 36645  	(*IncrblobChannel)(unsafe.Pointer(p)).Fchannel = tcl.XTcl_CreateChannel(tls, uintptr(unsafe.Pointer(&IncrblobChannelType)), bp+16 /* &zChannel[0] */, p, flags)
 36646  	tcl.XTcl_RegisterChannel(tls, interp, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel)
 36647  
 36648  	// Link the new channel into the SqliteDb.pIncrblob list.
 36649  	(*IncrblobChannel)(unsafe.Pointer(p)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob
 36650  	(*IncrblobChannel)(unsafe.Pointer(p)).FpPrev = uintptr(0)
 36651  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpNext != 0 {
 36652  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpNext)).FpPrev = p
 36653  	}
 36654  	(*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob = p
 36655  	(*IncrblobChannel)(unsafe.Pointer(p)).FpDb = pDb
 36656  
 36657  	tcl.XTcl_SetResult(tls, interp, tcl.XTcl_GetChannelName(tls, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel), uintptr(1))
 36658  	return TCL_OK
 36659  }
 36660  
 36661  var count int32 = 0 /* tclsqlite.c:406:14 */
 36662  
 36663  // Look at the script prefix in pCmd.  We will be executing this script
 36664  // after first appending one or more arguments.  This routine analyzes
 36665  // the script to see if it is safe to use Tcl_EvalObjv() on the script
 36666  // rather than the more general Tcl_EvalEx().  Tcl_EvalObjv() is much
 36667  // faster.
 36668  //
 36669  // Scripts that are safe to use with Tcl_EvalObjv() consists of a
 36670  // command name followed by zero or more arguments with no [...] or $
 36671  // or {...} or ; to be seen anywhere.  Most callback scripts consist
 36672  // of just a single procedure name and they meet this requirement.
 36673  func safeToUseEvalObjv(tls *libc.TLS, interp uintptr, pCmd uintptr) int32 { /* tclsqlite.c:451:12: */
 36674  	bp := tls.Alloc(4)
 36675  	defer tls.Free(4)
 36676  
 36677  	// We could try to do something with Tcl_Parse().  But we will instead
 36678  	// just do a search for forbidden characters.  If any of the forbidden
 36679  	// characters appear in pCmd, we will report the string as unsafe.
 36680  	var z uintptr
 36681  	// var n int32 at bp, 4
 36682  
 36683  	z = tcl.XTcl_GetStringFromObj(tls, pCmd, bp /* &n */)
 36684  	for libc.PostDecInt32(&*(*int32)(unsafe.Pointer(bp /* n */)), 1) > 0 {
 36685  		var c int32 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 36686  		if ((c == '$') || (c == '[')) || (c == ';') {
 36687  			return 0
 36688  		}
 36689  	}
 36690  	return 1
 36691  }
 36692  
 36693  // Find an SqlFunc structure with the given name.  Or create a new
 36694  // one if an existing one cannot be found.  Return a pointer to the
 36695  // structure.
 36696  func findSqlFunc(tls *libc.TLS, pDb uintptr, zName uintptr) uintptr { /* tclsqlite.c:471:16: */
 36697  	var p uintptr
 36698  	var pNew uintptr
 36699  	var nName int32 = strlen30(tls, zName)
 36700  	pNew = tcl.XTcl_Alloc(tls, (uint32((uint64(unsafe.Sizeof(SqlFunc{})) + uint64(nName)) + uint64(1))))
 36701  	(*SqlFunc)(unsafe.Pointer(pNew)).FzName = (pNew + 1*48)
 36702  	libc.Xmemcpy(tls, (*SqlFunc)(unsafe.Pointer(pNew)).FzName, zName, (uint64(nName + 1)))
 36703  	for p = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc; p != 0; p = (*SqlFunc)(unsafe.Pointer(p)).FpNext {
 36704  		if sqlite3.Xsqlite3_stricmp(tls, (*SqlFunc)(unsafe.Pointer(p)).FzName, (*SqlFunc)(unsafe.Pointer(pNew)).FzName) == 0 {
 36705  			tcl.XTcl_Free(tls, pNew)
 36706  			return p
 36707  		}
 36708  	}
 36709  	(*SqlFunc)(unsafe.Pointer(pNew)).Finterp = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 36710  	(*SqlFunc)(unsafe.Pointer(pNew)).FpDb = pDb
 36711  	(*SqlFunc)(unsafe.Pointer(pNew)).FpScript = uintptr(0)
 36712  	(*SqlFunc)(unsafe.Pointer(pNew)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc
 36713  	(*SqliteDb)(unsafe.Pointer(pDb)).FpFunc = pNew
 36714  	return pNew
 36715  }
 36716  
 36717  // Free a single SqlPreparedStmt object.
 36718  func dbFreeStmt(tls *libc.TLS, pStmt uintptr) { /* tclsqlite.c:494:13: */
 36719  	if sqlite3.Xsqlite3_sql(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FpStmt) == uintptr(0) {
 36720  		tcl.XTcl_Free(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FzSql)
 36721  	}
 36722  	sqlite3.Xsqlite3_finalize(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FpStmt)
 36723  	tcl.XTcl_Free(tls, pStmt)
 36724  }
 36725  
 36726  // Finalize and free a list of prepared statements
 36727  func flushStmtCache(tls *libc.TLS, pDb uintptr) { /* tclsqlite.c:507:13: */
 36728  	var pPreStmt uintptr
 36729  	var pNext uintptr
 36730  
 36731  	for pPreStmt = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList; pPreStmt != 0; pPreStmt = pNext {
 36732  		pNext = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 36733  		dbFreeStmt(tls, pPreStmt)
 36734  	}
 36735  	(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt = 0
 36736  	(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = uintptr(0)
 36737  	(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = uintptr(0)
 36738  }
 36739  
 36740  // TCL calls this procedure when an sqlite3 database command is
 36741  // deleted.
 36742  func DbDeleteCmd(tls *libc.TLS, db uintptr) { /* tclsqlite.c:524:27: */
 36743  	var pDb uintptr = db
 36744  	flushStmtCache(tls, pDb)
 36745  	closeIncrblobChannels(tls, pDb)
 36746  	sqlite3.Xsqlite3_close(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 36747  	for (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc != 0 {
 36748  		var pFunc uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc
 36749  		(*SqliteDb)(unsafe.Pointer(pDb)).FpFunc = (*SqlFunc)(unsafe.Pointer(pFunc)).FpNext
 36750  
 36751  		for ok := true; ok; ok = 0 != 0 {
 36752  			var _objPtr uintptr = (*SqlFunc)(unsafe.Pointer(pFunc)).FpScript
 36753  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36754  				tcl.XTclFreeObj(tls, _objPtr)
 36755  			}
 36756  		}
 36757  		tcl.XTcl_Free(tls, pFunc)
 36758  	}
 36759  	for (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate != 0 {
 36760  		var pCollate uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate
 36761  		(*SqliteDb)(unsafe.Pointer(pDb)).FpCollate = (*SqlCollate)(unsafe.Pointer(pCollate)).FpNext
 36762  		tcl.XTcl_Free(tls, pCollate)
 36763  	}
 36764  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0 {
 36765  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy)
 36766  	}
 36767  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0 {
 36768  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace)
 36769  	}
 36770  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0 {
 36771  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2)
 36772  	}
 36773  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0 {
 36774  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile)
 36775  	}
 36776  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0 {
 36777  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback)
 36778  	}
 36779  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0 {
 36780  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth)
 36781  	}
 36782  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzNull != 0 {
 36783  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull)
 36784  	}
 36785  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook != 0 {
 36786  		for ok1 := true; ok1; ok1 = 0 != 0 {
 36787  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook
 36788  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36789  				tcl.XTclFreeObj(tls, _objPtr)
 36790  			}
 36791  		}
 36792  	}
 36793  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook != 0 {
 36794  		for ok2 := true; ok2; ok2 = 0 != 0 {
 36795  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook
 36796  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36797  				tcl.XTclFreeObj(tls, _objPtr)
 36798  			}
 36799  		}
 36800  	}
 36801  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook != 0 {
 36802  		for ok3 := true; ok3; ok3 = 0 != 0 {
 36803  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook
 36804  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36805  				tcl.XTclFreeObj(tls, _objPtr)
 36806  			}
 36807  		}
 36808  	}
 36809  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook != 0 {
 36810  		for ok4 := true; ok4; ok4 = 0 != 0 {
 36811  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook
 36812  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36813  				tcl.XTclFreeObj(tls, _objPtr)
 36814  			}
 36815  		}
 36816  	}
 36817  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded != 0 {
 36818  		for ok5 := true; ok5; ok5 = 0 != 0 {
 36819  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded
 36820  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36821  				tcl.XTclFreeObj(tls, _objPtr)
 36822  			}
 36823  		}
 36824  	}
 36825  	tcl.XTcl_Free(tls, pDb)
 36826  }
 36827  
 36828  // This routine is called when a database file is locked while trying
 36829  // to execute SQL.
 36830  func DbBusyHandler(tls *libc.TLS, cd uintptr, nTries int32) int32 { /* tclsqlite.c:584:12: */
 36831  	bp := tls.Alloc(70)
 36832  	defer tls.Free(70)
 36833  
 36834  	var pDb uintptr = cd
 36835  	var rc int32
 36836  	// var zVal [30]int8 at bp+40, 30
 36837  
 36838  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+40 /* &zVal[0] */, ts+1238 /* "%d" */, libc.VaList(bp, nTries))
 36839  	rc = tcl.XTcl_VarEval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, libc.VaList(bp+8, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy, ts+4755 /* " " */, bp+40 /* &zVal[0] */, uintptr(0)))
 36840  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 36841  		return 0
 36842  	}
 36843  	return 1
 36844  }
 36845  
 36846  // This routine is invoked as the 'progress callback' for the database.
 36847  func DbProgressHandler(tls *libc.TLS, cd uintptr) int32 { /* tclsqlite.c:601:12: */
 36848  	var pDb uintptr = cd
 36849  	var rc int32
 36850  
 36851  	rc = tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress)
 36852  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 36853  		return 1
 36854  	}
 36855  	return 0
 36856  }
 36857  
 36858  // This routine is called by the SQLite trace handler whenever a new
 36859  // block of SQL is executed.  The TCL script in pDb->zTrace is executed.
 36860  func DbTraceHandler(tls *libc.TLS, cd uintptr, zSql uintptr) { /* tclsqlite.c:620:13: */
 36861  	bp := tls.Alloc(216)
 36862  	defer tls.Free(216)
 36863  
 36864  	var pDb uintptr = cd
 36865  	// var str Tcl_DString at bp, 216
 36866  
 36867  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 36868  	tcl.XTcl_DStringAppend(tls, bp /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, -1)
 36869  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, zSql)
 36870  	tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 36871  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 36872  	tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36873  }
 36874  
 36875  // This routine is called by the SQLite trace_v2 handler whenever a new
 36876  // supported event is generated.  Unsupported event types are ignored.
 36877  // The TCL script in pDb->zTraceV2 is executed, with the arguments for
 36878  // the event appended to it (as list elements).
 36879  func DbTraceV2Handler(tls *libc.TLS, type1 uint32, cd uintptr, pd uintptr, xd uintptr) int32 { /* tclsqlite.c:640:12: */
 36880  	var pDb uintptr = cd
 36881  	var pCmd uintptr
 36882  
 36883  	switch type1 {
 36884  	case uint32(SQLITE_TRACE_STMT):
 36885  		{
 36886  			var pStmt uintptr = pd
 36887  			var zSql uintptr = xd
 36888  
 36889  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 36890  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 36891  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36892  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 36893  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36894  				tcl.XTcl_NewStringObj(tls, zSql, -1))
 36895  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 36896  			for ok := true; ok; ok = 0 != 0 {
 36897  				var _objPtr uintptr = pCmd
 36898  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36899  					tcl.XTclFreeObj(tls, _objPtr)
 36900  				}
 36901  			}
 36902  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36903  			break
 36904  
 36905  		}
 36906  	case uint32(SQLITE_TRACE_PROFILE):
 36907  		{
 36908  			var pStmt uintptr = pd
 36909  			var ns sqlite3_int64 = *(*sqlite3_int64)(unsafe.Pointer(xd))
 36910  
 36911  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 36912  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 36913  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36914  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 36915  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36916  				tcl.XTcl_NewWideIntObj(tls, ns))
 36917  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 36918  			for ok1 := true; ok1; ok1 = 0 != 0 {
 36919  				var _objPtr uintptr = pCmd
 36920  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36921  					tcl.XTclFreeObj(tls, _objPtr)
 36922  				}
 36923  			}
 36924  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36925  			break
 36926  
 36927  		}
 36928  	case uint32(SQLITE_TRACE_ROW):
 36929  		{
 36930  			var pStmt uintptr = pd
 36931  
 36932  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 36933  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 36934  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36935  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 36936  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 36937  			for ok2 := true; ok2; ok2 = 0 != 0 {
 36938  				var _objPtr uintptr = pCmd
 36939  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36940  					tcl.XTclFreeObj(tls, _objPtr)
 36941  				}
 36942  			}
 36943  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36944  			break
 36945  
 36946  		}
 36947  	case uint32(SQLITE_TRACE_CLOSE):
 36948  		{
 36949  			var db uintptr = pd
 36950  
 36951  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 36952  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 36953  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 36954  				tcl.XTcl_NewWideIntObj(tls, int64(db)))
 36955  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 36956  			for ok3 := true; ok3; ok3 = 0 != 0 {
 36957  				var _objPtr uintptr = pCmd
 36958  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36959  					tcl.XTclFreeObj(tls, _objPtr)
 36960  				}
 36961  			}
 36962  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36963  			break
 36964  
 36965  		}
 36966  	}
 36967  	return SQLITE_OK
 36968  }
 36969  
 36970  // This routine is called by the SQLite profile handler after a statement
 36971  // SQL has executed.  The TCL script in pDb->zProfile is evaluated.
 36972  func DbProfileHandler(tls *libc.TLS, cd uintptr, zSql uintptr, tm1 sqlite_uint64) { /* tclsqlite.c:715:13: */
 36973  	bp := tls.Alloc(328)
 36974  	defer tls.Free(328)
 36975  
 36976  	var pDb uintptr = cd
 36977  	// var str Tcl_DString at bp+112, 216
 36978  
 36979  	// var zTm [100]int8 at bp+8, 100
 36980  
 36981  	sqlite3.Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([100]int8{})) - uint64(1))), bp+8 /* &zTm[0] */, ts+11354 /* "%lld" */, libc.VaList(bp, tm1))
 36982  	tcl.XTcl_DStringInit(tls, bp+112 /* &str */)
 36983  	tcl.XTcl_DStringAppend(tls, bp+112 /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, -1)
 36984  	tcl.XTcl_DStringAppendElement(tls, bp+112 /* &str */, zSql)
 36985  	tcl.XTcl_DStringAppendElement(tls, bp+112 /* &str */, bp+8 /* &zTm[0] */)
 36986  	tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp+112 /* &str */)).Fstring)
 36987  	tcl.XTcl_DStringFree(tls, bp+112 /* &str */)
 36988  	tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 36989  }
 36990  
 36991  // This routine is called when a transaction is committed.  The
 36992  // TCL script in pDb->zCommit is executed.  If it returns non-zero or
 36993  // if it throws an exception, the transaction is rolled back instead
 36994  // of being committed.
 36995  func DbCommitHandler(tls *libc.TLS, cd uintptr) int32 { /* tclsqlite.c:737:12: */
 36996  	var pDb uintptr = cd
 36997  	var rc int32
 36998  
 36999  	rc = tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit)
 37000  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 37001  		return 1
 37002  	}
 37003  	return 0
 37004  }
 37005  
 37006  func DbRollbackHandler(tls *libc.TLS, clientData uintptr) { /* tclsqlite.c:748:13: */
 37007  	var pDb uintptr = clientData
 37008  
 37009  	if TCL_OK != tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook, 0) {
 37010  		tcl.XTcl_BackgroundError(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 37011  	}
 37012  }
 37013  
 37014  // This procedure handles wal_hook callbacks.
 37015  func DbWalHandler(tls *libc.TLS, clientData uintptr, db uintptr, zDb uintptr, nEntry int32) int32 { /* tclsqlite.c:759:12: */
 37016  	bp := tls.Alloc(4)
 37017  	defer tls.Free(4)
 37018  
 37019  	*(*int32)(unsafe.Pointer(bp /* ret */)) = SQLITE_OK
 37020  	var p uintptr
 37021  	var pDb uintptr = clientData
 37022  	var interp uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 37023  
 37024  	p = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook)
 37025  	(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 37026  	tcl.XTcl_ListObjAppendElement(tls, interp, p, tcl.XTcl_NewStringObj(tls, zDb, -1))
 37027  	tcl.XTcl_ListObjAppendElement(tls, interp, p, tcl.XTcl_NewIntObj(tls, nEntry))
 37028  	if (TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, p, 0)) ||
 37029  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, tcl.XTcl_GetObjResult(tls, interp), bp /* &ret */)) {
 37030  		tcl.XTcl_BackgroundError(tls, interp)
 37031  	}
 37032  	for ok := true; ok; ok = 0 != 0 {
 37033  		var _objPtr uintptr = p
 37034  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37035  			tcl.XTclFreeObj(tls, _objPtr)
 37036  		}
 37037  	}
 37038  
 37039  	return *(*int32)(unsafe.Pointer(bp /* ret */))
 37040  }
 37041  
 37042  func setTestUnlockNotifyVars(tls *libc.TLS, interp uintptr, iArg int32, nArg int32) { /* tclsqlite.c:787:13: */
 37043  	bp := tls.Alloc(80)
 37044  	defer tls.Free(80)
 37045  
 37046  	// var zBuf [64]int8 at bp+16, 64
 37047  
 37048  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+16 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp, iArg))
 37049  	tcl.XTcl_SetVar2(tls, interp, ts+11359 /* "sqlite_unlock_no..." */, uintptr(0), bp+16 /* &zBuf[0] */, TCL_GLOBAL_ONLY)
 37050  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+16 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+8, nArg))
 37051  	tcl.XTcl_SetVar2(tls, interp, ts+11384 /* "sqlite_unlock_no..." */, uintptr(0), bp+16 /* &zBuf[0] */, TCL_GLOBAL_ONLY)
 37052  }
 37053  
 37054  func DbUnlockNotify(tls *libc.TLS, apArg uintptr, nArg int32) { /* tclsqlite.c:799:13: */
 37055  	var i int32
 37056  	for i = 0; i < nArg; i++ {
 37057  		var flags int32 = (TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT)
 37058  		var pDb uintptr = *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*8))
 37059  		setTestUnlockNotifyVars(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, i, nArg)
 37060  
 37061  		tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify, flags)
 37062  		for ok := true; ok; ok = 0 != 0 {
 37063  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify
 37064  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37065  				tcl.XTclFreeObj(tls, _objPtr)
 37066  			}
 37067  		}
 37068  		(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = uintptr(0)
 37069  	}
 37070  }
 37071  
 37072  // Pre-update hook callback.
 37073  func DbPreUpdateHandler(tls *libc.TLS, p uintptr, db uintptr, op int32, zDb uintptr, zTbl uintptr, iKey1 sqlite_int64, iKey2 sqlite_int64) { /* tclsqlite.c:817:13: */
 37074  	var pDb uintptr = p
 37075  	var pCmd uintptr
 37076  
 37077  	pCmd = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook)
 37078  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37079  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, azStr[((op-1)/9)], -1))
 37080  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zDb, -1))
 37081  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 37082  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, iKey1))
 37083  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, iKey2))
 37084  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 37085  	for ok := true; ok; ok = 0 != 0 {
 37086  		var _objPtr uintptr = pCmd
 37087  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37088  			tcl.XTclFreeObj(tls, _objPtr)
 37089  		}
 37090  	}
 37091  }
 37092  
 37093  var azStr = [3]uintptr{ts + 10786 /* "DELETE" */, ts + 10772 /* "INSERT" */, ts + 10779 /* "UPDATE" */} /* tclsqlite.c:828:21 */
 37094  
 37095  func DbUpdateHandler(tls *libc.TLS, p uintptr, op int32, zDb uintptr, zTbl uintptr, rowid sqlite_int64) { /* tclsqlite.c:849:13: */
 37096  	var pDb uintptr = p
 37097  	var pCmd uintptr
 37098  
 37099  	pCmd = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook)
 37100  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37101  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, azStr1[((op-1)/9)], -1))
 37102  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zDb, -1))
 37103  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 37104  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, rowid))
 37105  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 37106  	for ok := true; ok; ok = 0 != 0 {
 37107  		var _objPtr uintptr = pCmd
 37108  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37109  			tcl.XTclFreeObj(tls, _objPtr)
 37110  		}
 37111  	}
 37112  }
 37113  
 37114  var azStr1 = [3]uintptr{ts + 10786 /* "DELETE" */, ts + 10772 /* "INSERT" */, ts + 10779 /* "UPDATE" */} /* tclsqlite.c:858:21 */
 37115  
 37116  func tclCollateNeeded(tls *libc.TLS, pCtx uintptr, db uintptr, enc int32, zName uintptr) { /* tclsqlite.c:877:13: */
 37117  	var pDb uintptr = pCtx
 37118  	var pScript uintptr = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded)
 37119  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 37120  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zName, -1))
 37121  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pScript, 0)
 37122  	for ok := true; ok; ok = 0 != 0 {
 37123  		var _objPtr uintptr = pScript
 37124  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37125  			tcl.XTclFreeObj(tls, _objPtr)
 37126  		}
 37127  	}
 37128  }
 37129  
 37130  // This routine is called to evaluate an SQL collation function implemented
 37131  // using TCL script.
 37132  func tclSqlCollate(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* tclsqlite.c:895:12: */
 37133  	var p uintptr = pCtx
 37134  	var pCmd uintptr
 37135  
 37136  	pCmd = tcl.XTcl_NewStringObj(tls, (*SqlCollate)(unsafe.Pointer(p)).FzScript, -1)
 37137  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37138  	tcl.XTcl_ListObjAppendElement(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, tcl.XTcl_NewStringObj(tls, zA, nA))
 37139  	tcl.XTcl_ListObjAppendElement(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, tcl.XTcl_NewStringObj(tls, zB, nB))
 37140  	tcl.XTcl_EvalObjEx(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, TCL_EVAL_DIRECT)
 37141  	for ok := true; ok; ok = 0 != 0 {
 37142  		var _objPtr uintptr = pCmd
 37143  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37144  			tcl.XTclFreeObj(tls, _objPtr)
 37145  		}
 37146  	}
 37147  	return libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp))
 37148  }
 37149  
 37150  // This routine is called to evaluate an SQL function implemented
 37151  // using TCL script.
 37152  func tclSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* tclsqlite.c:918:13: */
 37153  	bp := tls.Alloc(40)
 37154  	defer tls.Free(40)
 37155  
 37156  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 37157  	var pCmd uintptr
 37158  	var i int32
 37159  	var rc int32
 37160  
 37161  	if argc == 0 {
 37162  		// If there are no arguments to the function, call Tcl_EvalObjEx on the
 37163  		// script object directly.  This allows the TCL compiler to generate
 37164  		// bytecode for the command on the first invocation and thus make
 37165  		// subsequent invocations much faster.
 37166  		pCmd = (*SqlFunc)(unsafe.Pointer(p)).FpScript
 37167  		(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37168  		rc = tcl.XTcl_EvalObjEx(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, 0)
 37169  		for ok := true; ok; ok = 0 != 0 {
 37170  			var _objPtr uintptr = pCmd
 37171  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37172  				tcl.XTclFreeObj(tls, _objPtr)
 37173  			}
 37174  		}
 37175  	} else {
 37176  		// If there are arguments to the function, make a shallow copy of the
 37177  		// script object, lappend the arguments, then evaluate the copy.
 37178  		//
 37179  		// By "shallow" copy, we mean only the outer list Tcl_Obj is duplicated.
 37180  		// The new Tcl_Obj contains pointers to the original list elements.
 37181  		// That way, when Tcl_EvalObjv() is run and shimmers the first element
 37182  		// of the list to tclCmdNameType, that alternate representation will
 37183  		// be preserved and reused on the next invocation.
 37184  		// var aArg uintptr at bp+8, 8
 37185  
 37186  		// var nArg int32 at bp, 4
 37187  
 37188  		if tcl.XTcl_ListObjGetElements(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, (*SqlFunc)(unsafe.Pointer(p)).FpScript, bp /* &nArg */, bp+8 /* &aArg */) != 0 {
 37189  			sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 37190  			return
 37191  		}
 37192  		pCmd = tcl.XTcl_NewListObj(tls, *(*int32)(unsafe.Pointer(bp /* nArg */)), *(*uintptr)(unsafe.Pointer(bp + 8 /* aArg */)))
 37193  		(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37194  		for i = 0; i < argc; i++ {
 37195  			var pIn uintptr = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))
 37196  			var pVal uintptr
 37197  
 37198  			// Set pVal to contain the i'th column of this row.
 37199  			switch sqlite3.Xsqlite3_value_type(tls, pIn) {
 37200  			case SQLITE_BLOB:
 37201  				{
 37202  					var bytes int32 = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 37203  					pVal = tcl.XTcl_NewByteArrayObj(tls, sqlite3.Xsqlite3_value_blob(tls, pIn), bytes)
 37204  					break
 37205  
 37206  				}
 37207  				fallthrough
 37208  			case SQLITE_INTEGER:
 37209  				{
 37210  					var v sqlite_int64 = sqlite3.Xsqlite3_value_int64(tls, pIn)
 37211  					if (v >= int64(-2147483647)) && (v <= int64(2147483647)) {
 37212  						pVal = tcl.XTcl_NewIntObj(tls, int32(v))
 37213  					} else {
 37214  						pVal = tcl.XTcl_NewWideIntObj(tls, v)
 37215  					}
 37216  					break
 37217  
 37218  				}
 37219  				fallthrough
 37220  			case SQLITE_FLOAT:
 37221  				{
 37222  					var r float64 = sqlite3.Xsqlite3_value_double(tls, pIn)
 37223  					pVal = tcl.XTcl_NewDoubleObj(tls, r)
 37224  					break
 37225  
 37226  				}
 37227  				fallthrough
 37228  			case SQLITE_NULL:
 37229  				{
 37230  					pVal = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer((*SqlFunc)(unsafe.Pointer(p)).FpDb)).FzNull, -1)
 37231  					break
 37232  
 37233  				}
 37234  				fallthrough
 37235  			default:
 37236  				{
 37237  					var bytes int32 = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 37238  					pVal = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pIn), bytes)
 37239  					break
 37240  
 37241  				}
 37242  			}
 37243  			rc = tcl.XTcl_ListObjAppendElement(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, pVal)
 37244  			if rc != 0 {
 37245  				for ok1 := true; ok1; ok1 = 0 != 0 {
 37246  					var _objPtr uintptr = pCmd
 37247  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37248  						tcl.XTclFreeObj(tls, _objPtr)
 37249  					}
 37250  				}
 37251  				sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 37252  				return
 37253  			}
 37254  		}
 37255  		if !((*SqlFunc)(unsafe.Pointer(p)).FuseEvalObjv != 0) {
 37256  			// Tcl_EvalObjEx() will automatically call Tcl_EvalObjv() if pCmd
 37257  			// is a list without a string representation.  To prevent this from
 37258  			// happening, make sure pCmd has a valid string representation
 37259  			tcl.XTcl_GetString(tls, pCmd)
 37260  		}
 37261  		rc = tcl.XTcl_EvalObjEx(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, TCL_EVAL_DIRECT)
 37262  		for ok2 := true; ok2; ok2 = 0 != 0 {
 37263  			var _objPtr uintptr = pCmd
 37264  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37265  				tcl.XTclFreeObj(tls, _objPtr)
 37266  			}
 37267  		}
 37268  	}
 37269  
 37270  	if (rc != 0) && (rc != TCL_RETURN) {
 37271  		sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 37272  	} else {
 37273  		var pVar uintptr = tcl.XTcl_GetObjResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp)
 37274  		// var n int32 at bp+16, 4
 37275  
 37276  		var data uintptr
 37277  		var zType uintptr = func() uintptr {
 37278  			if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 37279  				return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 37280  			}
 37281  			return ts + 489 /* "" */
 37282  		}()
 37283  		var c int8 = *(*int8)(unsafe.Pointer(zType))
 37284  		var eType int32 = (*SqlFunc)(unsafe.Pointer(p)).FeType
 37285  
 37286  		if eType == SQLITE_NULL {
 37287  			if ((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2405 /* "bytearray" */) == 0)) && ((*Tcl_Obj)(unsafe.Pointer(pVar)).Fbytes == uintptr(0)) {
 37288  				// Only return a BLOB type if the Tcl variable is a bytearray and
 37289  				// has no string representation.
 37290  				eType = SQLITE_BLOB
 37291  			} else if (((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0)) ||
 37292  				((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0))) ||
 37293  				((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 37294  				eType = SQLITE_INTEGER
 37295  			} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 37296  				eType = SQLITE_FLOAT
 37297  			} else {
 37298  				eType = SQLITE_TEXT
 37299  			}
 37300  		}
 37301  
 37302  		switch eType {
 37303  		case SQLITE_BLOB:
 37304  			{
 37305  				data = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+16 /* &n */)
 37306  				sqlite3.Xsqlite3_result_blob(tls, context, data, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1))
 37307  				break
 37308  
 37309  			}
 37310  			fallthrough
 37311  		case SQLITE_INTEGER:
 37312  			{
 37313  				// var v Tcl_WideInt at bp+24, 8
 37314  
 37315  				if TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), pVar, bp+24 /* &v */) {
 37316  					sqlite3.Xsqlite3_result_int64(tls, context, *(*Tcl_WideInt)(unsafe.Pointer(bp + 24 /* v */)))
 37317  					break
 37318  				}
 37319  				// fall-through
 37320  
 37321  			}
 37322  			fallthrough
 37323  		case SQLITE_FLOAT:
 37324  			{
 37325  				// var r float64 at bp+32, 8
 37326  
 37327  				if TCL_OK == tcl.XTcl_GetDoubleFromObj(tls, uintptr(0), pVar, bp+32 /* &r */) {
 37328  					sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 32 /* r */)))
 37329  					break
 37330  				}
 37331  				// fall-through
 37332  
 37333  			}
 37334  			fallthrough
 37335  		default:
 37336  			{
 37337  				data = tcl.XTcl_GetStringFromObj(tls, pVar, bp+16 /* &n */)
 37338  				sqlite3.Xsqlite3_result_text(tls, context, data, *(*int32)(unsafe.Pointer(bp + 16 /* n */)), libc.UintptrFromInt32(-1))
 37339  				break
 37340  
 37341  			}
 37342  		}
 37343  
 37344  	}
 37345  }
 37346  
 37347  // This is the authentication function.  It appends the authentication
 37348  // type code and the two arguments to zCmd[] then invokes the result
 37349  // on the interpreter.  The reply is examined to determine if the
 37350  // authentication fails or succeeds.
 37351  func auth_callback(tls *libc.TLS, pArg uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr, zArg4 uintptr) int32 { /* tclsqlite.c:1069:12: */
 37352  	bp := tls.Alloc(216)
 37353  	defer tls.Free(216)
 37354  
 37355  	var zCode uintptr
 37356  	// var str Tcl_DString at bp, 216
 37357  
 37358  	var rc int32
 37359  	var zReply uintptr
 37360  	// EVIDENCE-OF: R-38590-62769 The first parameter to the authorizer
 37361  	// callback is a copy of the third parameter to the
 37362  	// sqlite3_set_authorizer() interface.
 37363  	var pDb uintptr = pArg
 37364  	if (*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth != 0 {
 37365  		return SQLITE_OK
 37366  	}
 37367  
 37368  	// EVIDENCE-OF: R-56518-44310 The second parameter to the callback is an
 37369  	// integer action code that specifies the particular action to be
 37370  	// authorized.
 37371  	switch code {
 37372  	case SQLITE_COPY:
 37373  		zCode = ts + 11414 /* "SQLITE_COPY" */
 37374  		break
 37375  	case SQLITE_CREATE_INDEX:
 37376  		zCode = ts + 11426 /* "SQLITE_CREATE_IN..." */
 37377  		break
 37378  	case SQLITE_CREATE_TABLE:
 37379  		zCode = ts + 11446 /* "SQLITE_CREATE_TA..." */
 37380  		break
 37381  	case SQLITE_CREATE_TEMP_INDEX:
 37382  		zCode = ts + 11466 /* "SQLITE_CREATE_TE..." */
 37383  		break
 37384  	case SQLITE_CREATE_TEMP_TABLE:
 37385  		zCode = ts + 11491 /* "SQLITE_CREATE_TE..." */
 37386  		break
 37387  	case SQLITE_CREATE_TEMP_TRIGGER:
 37388  		zCode = ts + 11516 /* "SQLITE_CREATE_TE..." */
 37389  		break
 37390  	case SQLITE_CREATE_TEMP_VIEW:
 37391  		zCode = ts + 11543 /* "SQLITE_CREATE_TE..." */
 37392  		break
 37393  	case SQLITE_CREATE_TRIGGER:
 37394  		zCode = ts + 11567 /* "SQLITE_CREATE_TR..." */
 37395  		break
 37396  	case SQLITE_CREATE_VIEW:
 37397  		zCode = ts + 11589 /* "SQLITE_CREATE_VI..." */
 37398  		break
 37399  	case SQLITE_DELETE:
 37400  		zCode = ts + 11608 /* "SQLITE_DELETE" */
 37401  		break
 37402  	case SQLITE_DROP_INDEX:
 37403  		zCode = ts + 11622 /* "SQLITE_DROP_INDE..." */
 37404  		break
 37405  	case SQLITE_DROP_TABLE:
 37406  		zCode = ts + 11640 /* "SQLITE_DROP_TABL..." */
 37407  		break
 37408  	case SQLITE_DROP_TEMP_INDEX:
 37409  		zCode = ts + 11658 /* "SQLITE_DROP_TEMP..." */
 37410  		break
 37411  	case SQLITE_DROP_TEMP_TABLE:
 37412  		zCode = ts + 11681 /* "SQLITE_DROP_TEMP..." */
 37413  		break
 37414  	case SQLITE_DROP_TEMP_TRIGGER:
 37415  		zCode = ts + 11704 /* "SQLITE_DROP_TEMP..." */
 37416  		break
 37417  	case SQLITE_DROP_TEMP_VIEW:
 37418  		zCode = ts + 11729 /* "SQLITE_DROP_TEMP..." */
 37419  		break
 37420  	case SQLITE_DROP_TRIGGER:
 37421  		zCode = ts + 11751 /* "SQLITE_DROP_TRIG..." */
 37422  		break
 37423  	case SQLITE_DROP_VIEW:
 37424  		zCode = ts + 11771 /* "SQLITE_DROP_VIEW" */
 37425  		break
 37426  	case SQLITE_INSERT:
 37427  		zCode = ts + 11788 /* "SQLITE_INSERT" */
 37428  		break
 37429  	case SQLITE_PRAGMA:
 37430  		zCode = ts + 11802 /* "SQLITE_PRAGMA" */
 37431  		break
 37432  	case SQLITE_READ:
 37433  		zCode = ts + 11816 /* "SQLITE_READ" */
 37434  		break
 37435  	case SQLITE_SELECT:
 37436  		zCode = ts + 11828 /* "SQLITE_SELECT" */
 37437  		break
 37438  	case SQLITE_TRANSACTION:
 37439  		zCode = ts + 11842 /* "SQLITE_TRANSACTI..." */
 37440  		break
 37441  	case SQLITE_UPDATE:
 37442  		zCode = ts + 11861 /* "SQLITE_UPDATE" */
 37443  		break
 37444  	case SQLITE_ATTACH:
 37445  		zCode = ts + 11875 /* "SQLITE_ATTACH" */
 37446  		break
 37447  	case SQLITE_DETACH:
 37448  		zCode = ts + 11889 /* "SQLITE_DETACH" */
 37449  		break
 37450  	case SQLITE_ALTER_TABLE:
 37451  		zCode = ts + 11903 /* "SQLITE_ALTER_TAB..." */
 37452  		break
 37453  	case SQLITE_REINDEX:
 37454  		zCode = ts + 11922 /* "SQLITE_REINDEX" */
 37455  		break
 37456  	case SQLITE_ANALYZE:
 37457  		zCode = ts + 11937 /* "SQLITE_ANALYZE" */
 37458  		break
 37459  	case SQLITE_CREATE_VTABLE:
 37460  		zCode = ts + 11952 /* "SQLITE_CREATE_VT..." */
 37461  		break
 37462  	case SQLITE_DROP_VTABLE:
 37463  		zCode = ts + 11973 /* "SQLITE_DROP_VTAB..." */
 37464  		break
 37465  	case SQLITE_FUNCTION:
 37466  		zCode = ts + 11992 /* "SQLITE_FUNCTION" */
 37467  		break
 37468  	case SQLITE_SAVEPOINT:
 37469  		zCode = ts + 12008 /* "SQLITE_SAVEPOINT" */
 37470  		break
 37471  	case SQLITE_RECURSIVE:
 37472  		zCode = ts + 12025 /* "SQLITE_RECURSIVE" */
 37473  		break
 37474  	default:
 37475  		zCode = ts + 12042 /* "????" */
 37476  		break
 37477  	}
 37478  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 37479  	tcl.XTcl_DStringAppend(tls, bp /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, -1)
 37480  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, zCode)
 37481  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 37482  		if zArg1 != 0 {
 37483  			return zArg1
 37484  		}
 37485  		return ts + 489 /* "" */
 37486  	}())
 37487  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 37488  		if zArg2 != 0 {
 37489  			return zArg2
 37490  		}
 37491  		return ts + 489 /* "" */
 37492  	}())
 37493  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 37494  		if zArg3 != 0 {
 37495  			return zArg3
 37496  		}
 37497  		return ts + 489 /* "" */
 37498  	}())
 37499  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 37500  		if zArg4 != 0 {
 37501  			return zArg4
 37502  		}
 37503  		return ts + 489 /* "" */
 37504  	}())
 37505  	rc = tcl.XTcl_GlobalEval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 37506  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 37507  	if rc == TCL_OK {
 37508  		zReply = tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 37509  	} else {
 37510  		zReply = ts + 12047 /* "SQLITE_DENY" */
 37511  	}
 37512  	if libc.Xstrcmp(tls, zReply, ts+1988 /* "SQLITE_OK" */) == 0 {
 37513  		rc = SQLITE_OK
 37514  	} else if libc.Xstrcmp(tls, zReply, ts+12047 /* "SQLITE_DENY" */) == 0 {
 37515  		rc = SQLITE_DENY
 37516  	} else if libc.Xstrcmp(tls, zReply, ts+12059 /* "SQLITE_IGNORE" */) == 0 {
 37517  		rc = SQLITE_IGNORE
 37518  	} else {
 37519  		rc = 999
 37520  	}
 37521  	return rc
 37522  }
 37523  
 37524  // This routine reads a line of text from FILE in, stores
 37525  // the text in memory obtained from malloc() and returns a pointer
 37526  // to the text.  NULL is returned at end of file, or if malloc()
 37527  // fails.
 37528  //
 37529  // The interface is like "readline" but no command-line editing
 37530  // is done.
 37531  //
 37532  // copied from shell.c from '.import' command
 37533  func local_getline(tls *libc.TLS, zPrompt uintptr, in uintptr) uintptr { /* tclsqlite.c:1168:13: */
 37534  	var zLine uintptr
 37535  	var nLine int32
 37536  	var n int32
 37537  
 37538  	nLine = 100
 37539  	zLine = libc.Xmalloc(tls, uint64(nLine))
 37540  	if zLine == uintptr(0) {
 37541  		return uintptr(0)
 37542  	}
 37543  	n = 0
 37544  	for 1 != 0 {
 37545  		if (n + 100) > nLine {
 37546  			nLine = ((nLine * 2) + 100)
 37547  			zLine = libc.Xrealloc(tls, zLine, uint64(nLine))
 37548  			if zLine == uintptr(0) {
 37549  				return uintptr(0)
 37550  			}
 37551  		}
 37552  		if libc.Xfgets(tls, (zLine+uintptr(n)), (nLine-n), in) == uintptr(0) {
 37553  			if n == 0 {
 37554  				libc.Xfree(tls, zLine)
 37555  				return uintptr(0)
 37556  			}
 37557  			*(*int8)(unsafe.Pointer(zLine + uintptr(n))) = int8(0)
 37558  			break
 37559  		}
 37560  		for *(*int8)(unsafe.Pointer(zLine + uintptr(n))) != 0 {
 37561  			n++
 37562  		}
 37563  		if (n > 0) && (int32(*(*int8)(unsafe.Pointer(zLine + uintptr((n - 1))))) == '\n') {
 37564  			n--
 37565  			*(*int8)(unsafe.Pointer(zLine + uintptr(n))) = int8(0)
 37566  			break
 37567  		}
 37568  	}
 37569  	zLine = libc.Xrealloc(tls, zLine, (uint64(n + 1)))
 37570  	return zLine
 37571  }
 37572  
 37573  // This function is part of the implementation of the command:
 37574  //
 37575  //   $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 37576  //
 37577  // It is invoked after evaluating the script SCRIPT to commit or rollback
 37578  // the transaction or savepoint opened by the [transaction] command.
 37579  func DbTransPostCmd(tls *libc.TLS, data uintptr, interp uintptr, result int32) int32 { /* tclsqlite.c:1211:26: */
 37580  	bp := tls.Alloc(16)
 37581  	defer tls.Free(16)
 37582  
 37583  	var pDb uintptr = *(*ClientData)(unsafe.Pointer(data))
 37584  	var rc int32 = result
 37585  	var zEnd uintptr
 37586  
 37587  	(*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction--
 37588  	zEnd = azEnd[(((libc.Bool32(rc == TCL_ERROR)) * 2) + (libc.Bool32((*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction == 0)))]
 37589  
 37590  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth++
 37591  	if sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zEnd, uintptr(0), uintptr(0), uintptr(0)) != 0 {
 37592  		// This is a tricky scenario to handle. The most likely cause of an
 37593  		// error is that the exec() above was an attempt to commit the
 37594  		// top-level transaction that returned SQLITE_BUSY. Or, less likely,
 37595  		// that an IO-error has occurred. In either case, throw a Tcl exception
 37596  		// and try to rollback the transaction.
 37597  		//
 37598  		// But it could also be that the user executed one or more BEGIN,
 37599  		// COMMIT, SAVEPOINT, RELEASE or ROLLBACK commands that are confusing
 37600  		// this method's logic. Not clear how this would be best handled.
 37601  		if rc != TCL_ERROR {
 37602  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 37603  			rc = TCL_ERROR
 37604  		}
 37605  		sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, ts+7270 /* "ROLLBACK" */, uintptr(0), uintptr(0), uintptr(0))
 37606  	}
 37607  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth--
 37608  
 37609  	return rc
 37610  }
 37611  
 37612  var azEnd = [4]uintptr{
 37613  	ts + 12073, /* "RELEASE _tcl_tra..." */ // rc==TCL_ERROR, nTransaction!=0
 37614  	ts + 12098, /* "COMMIT" */              // rc!=TCL_ERROR, nTransaction==0
 37615  	ts + 12105, /* "ROLLBACK TO _tcl..." */
 37616  	ts + 7270,  /* "ROLLBACK" */ // rc==TCL_ERROR, nTransaction==0
 37617  } /* tclsqlite.c:1216:21 */
 37618  
 37619  // Unless SQLITE_TEST is defined, this function is a simple wrapper around
 37620  // sqlite3_prepare_v2(). If SQLITE_TEST is defined, then it uses either
 37621  // sqlite3_prepare_v2() or legacy interface sqlite3_prepare(), depending
 37622  // on whether or not the [db_use_legacy_prepare] command has been used to
 37623  // configure the connection.
 37624  func dbPrepare(tls *libc.TLS, pDb uintptr, zSql uintptr, ppStmt uintptr, pzOut uintptr) int32 { /* tclsqlite.c:1259:12: */
 37625  	var prepFlags uint32 = uint32(0)
 37626  	if (*SqliteDb)(unsafe.Pointer(pDb)).FbLegacyPrepare != 0 {
 37627  		return sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, ppStmt, pzOut)
 37628  	}
 37629  	// If the statement cache is large, use the SQLITE_PREPARE_PERSISTENT
 37630  	// flags, which uses less lookaside memory.  But if the cache is small,
 37631  	// omit that flag to make full use of lookaside
 37632  	if (*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt > 5 {
 37633  		prepFlags = uint32(SQLITE_PREPARE_PERSISTENT)
 37634  	}
 37635  
 37636  	return sqlite3.Xsqlite3_prepare_v3(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, prepFlags, ppStmt, pzOut)
 37637  }
 37638  
 37639  // Search the cache for a prepared-statement object that implements the
 37640  // first SQL statement in the buffer pointed to by parameter zIn. If
 37641  // no such prepared-statement can be found, allocate and prepare a new
 37642  // one. In either case, bind the current values of the relevant Tcl
 37643  // variables to any $var, :var or @var variables in the statement. Before
 37644  // returning, set *ppPreStmt to point to the prepared-statement object.
 37645  //
 37646  // Output parameter *pzOut is set to point to the next SQL statement in
 37647  // buffer zIn, or to the '\0' byte at the end of zIn if there is no
 37648  // next statement.
 37649  //
 37650  // If successful, TCL_OK is returned. Otherwise, TCL_ERROR is returned
 37651  // and an error message loaded into interpreter pDb->interp.
 37652  func dbPrepareAndBind(tls *libc.TLS, pDb uintptr, zIn uintptr, pzOut uintptr, ppPreStmt uintptr) int32 { /* tclsqlite.c:1294:12: */
 37653  	bp := tls.Alloc(32)
 37654  	defer tls.Free(32)
 37655  
 37656  	var zSql uintptr = zIn                                   // Pointer to first SQL statement in zIn
 37657  	*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) // Prepared statement object
 37658  	var pPreStmt uintptr                                     // Pointer to cached statement
 37659  	var nSql int32                                           // Length of zSql in bytes
 37660  	var nVar int32 = 0                                       // Number of variables in statement
 37661  	var iParm int32 = 0                                      // Next free entry in apParm
 37662  	var c int8
 37663  	var i int32
 37664  	var needResultReset int32 = 0 // Need to invoke Tcl_ResetResult()
 37665  	var rc int32 = SQLITE_OK      // Value to return
 37666  	var interp uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 37667  
 37668  	*(*uintptr)(unsafe.Pointer(ppPreStmt)) = uintptr(0)
 37669  
 37670  	// Trim spaces from the start of zSql and calculate the remaining length.
 37671  	for ((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zSql))))) == ' ') || (int32(c) == '\t')) || (int32(c) == '\r')) || (int32(c) == '\n') {
 37672  		zSql++
 37673  	}
 37674  	nSql = strlen30(tls, zSql)
 37675  
 37676  	for pPreStmt = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList; pPreStmt != 0; pPreStmt = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext {
 37677  		var n int32 = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql
 37678  		if ((nSql >= n) &&
 37679  			(libc.Xmemcmp(tls, (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql, zSql, uint64(n)) == 0)) &&
 37680  			((int32(*(*int8)(unsafe.Pointer(zSql + uintptr(n)))) == 0) || (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((n - 1))))) == ';')) {
 37681  			*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt
 37682  			*(*uintptr)(unsafe.Pointer(pzOut)) = (zSql + uintptr((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))
 37683  
 37684  			// When a prepared statement is found, unlink it from the
 37685  			// cache list.  It will later be added back to the beginning
 37686  			// of the cache list in order to implement LRU replacement.
 37687  			if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev != 0 {
 37688  				(*SqlPreparedStmt)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev)).FpNext = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 37689  			} else {
 37690  				(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 37691  			}
 37692  			if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext != 0 {
 37693  				(*SqlPreparedStmt)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext)).FpPrev = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev
 37694  			} else {
 37695  				(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev
 37696  			}
 37697  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt--
 37698  			nVar = sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 37699  			break
 37700  		}
 37701  	}
 37702  
 37703  	// If no prepared statement was found. Compile the SQL text. Also allocate
 37704  	// a new SqlPreparedStmt structure.
 37705  	if pPreStmt == uintptr(0) {
 37706  		var nByte int32
 37707  
 37708  		if SQLITE_OK != dbPrepare(tls, pDb, zSql, bp /* &pStmt */, pzOut) {
 37709  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 37710  			return TCL_ERROR
 37711  		}
 37712  		if *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) == uintptr(0) {
 37713  			if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb) {
 37714  				// A compile-time error in the statement.
 37715  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 37716  				return TCL_ERROR
 37717  			} else {
 37718  				// The statement was a no-op.  Continue to the next statement
 37719  				// in the SQL string.
 37720  				return TCL_OK
 37721  			}
 37722  		}
 37723  
 37724  		nVar = sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 37725  		nByte = (int32(uint64(unsafe.Sizeof(SqlPreparedStmt{})) + (uint64(nVar) * uint64(unsafe.Sizeof(uintptr(0))))))
 37726  		pPreStmt = tcl.XTcl_Alloc(tls, uint32(nByte))
 37727  		libc.Xmemset(tls, pPreStmt, 0, uint64(nByte))
 37728  
 37729  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */))
 37730  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql = (int32((int64(*(*uintptr)(unsafe.Pointer(pzOut))) - int64(zSql)) / 1))
 37731  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql = sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 37732  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm = (pPreStmt + 1*56)
 37733  		if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql == uintptr(0) {
 37734  			var zCopy uintptr = tcl.XTcl_Alloc(tls, (uint32((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql + 1)))
 37735  			libc.Xmemcpy(tls, zCopy, zSql, uint64((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))
 37736  			*(*int8)(unsafe.Pointer(zCopy + uintptr((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))) = int8(0)
 37737  			(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql = zCopy
 37738  		}
 37739  	}
 37740  
 37741  	// Bind values to parameters that begin with $ or :
 37742  	for i = 1; i <= nVar; i++ {
 37743  		var zVar uintptr = sqlite3.Xsqlite3_bind_parameter_name(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i)
 37744  		if (zVar != uintptr(0)) && (((int32(*(*int8)(unsafe.Pointer(zVar))) == '$') || (int32(*(*int8)(unsafe.Pointer(zVar))) == ':')) || (int32(*(*int8)(unsafe.Pointer(zVar))) == '@')) {
 37745  			var pVar uintptr = tcl.XTcl_GetVar2Ex(tls, interp, (zVar + 1), uintptr(0), 0)
 37746  			if (pVar == uintptr(0)) && ((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != uintptr(0)) {
 37747  				var pCmd uintptr
 37748  				var rx int32
 37749  				pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, -1)
 37750  				(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 37751  				tcl.XTcl_ListObjAppendElement(tls, interp, pCmd, tcl.XTcl_NewStringObj(tls, zVar, -1))
 37752  				if needResultReset != 0 {
 37753  					tcl.XTcl_ResetResult(tls, interp)
 37754  				}
 37755  				needResultReset = 1
 37756  				rx = tcl.XTcl_EvalObjEx(tls, interp, pCmd, TCL_EVAL_DIRECT)
 37757  				for ok := true; ok; ok = 0 != 0 {
 37758  					var _objPtr uintptr = pCmd
 37759  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37760  						tcl.XTclFreeObj(tls, _objPtr)
 37761  					}
 37762  				}
 37763  				if rx == TCL_OK {
 37764  					pVar = tcl.XTcl_GetObjResult(tls, interp)
 37765  				} else if rx == TCL_ERROR {
 37766  					rc = TCL_ERROR
 37767  					break
 37768  				} else {
 37769  					pVar = uintptr(0)
 37770  				}
 37771  			}
 37772  			if pVar != 0 {
 37773  				// var n int32 at bp+8, 4
 37774  
 37775  				var data uintptr
 37776  				var zType uintptr = func() uintptr {
 37777  					if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 37778  						return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 37779  					}
 37780  					return ts + 489 /* "" */
 37781  				}()
 37782  				c = *(*int8)(unsafe.Pointer(zType))
 37783  				if (int32(*(*int8)(unsafe.Pointer(zVar))) == '@') || (((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2405 /* "bytearray" */) == 0)) && ((*Tcl_Obj)(unsafe.Pointer(pVar)).Fbytes == uintptr(0))) {
 37784  					// Load a BLOB type if the Tcl variable is a bytearray and
 37785  					// it has no string representation or the host
 37786  					// parameter name begins with "@".
 37787  					data = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+8 /* &n */)
 37788  					sqlite3.Xsqlite3_bind_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, data, *(*int32)(unsafe.Pointer(bp + 8 /* n */)), uintptr(0))
 37789  					(*Tcl_Obj)(unsafe.Pointer(pVar)).FrefCount++
 37790  					*(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(libc.PostIncInt32(&iParm, 1))*8)) = pVar
 37791  				} else if (int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0) {
 37792  					tcl.XTcl_GetIntFromObj(tls, interp, pVar, bp+8 /* &n */)
 37793  					sqlite3.Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*int32)(unsafe.Pointer(bp + 8 /* n */)))
 37794  				} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 37795  					// var r float64 at bp+16, 8
 37796  
 37797  					tcl.XTcl_GetDoubleFromObj(tls, interp, pVar, bp+16 /* &r */)
 37798  					sqlite3.Xsqlite3_bind_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*float64)(unsafe.Pointer(bp + 16 /* r */)))
 37799  				} else if ((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0)) || ((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 37800  					// var v Tcl_WideInt at bp+24, 8
 37801  
 37802  					tcl.XTcl_GetWideIntFromObj(tls, interp, pVar, bp+24 /* &v */)
 37803  					sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*Tcl_WideInt)(unsafe.Pointer(bp + 24 /* v */)))
 37804  				} else {
 37805  					data = tcl.XTcl_GetStringFromObj(tls, pVar, bp+8 /* &n */)
 37806  					sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, data, *(*int32)(unsafe.Pointer(bp + 8 /* n */)), uintptr(0))
 37807  					(*Tcl_Obj)(unsafe.Pointer(pVar)).FrefCount++
 37808  					*(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(libc.PostIncInt32(&iParm, 1))*8)) = pVar
 37809  				}
 37810  			} else {
 37811  				sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i)
 37812  			}
 37813  			if needResultReset != 0 {
 37814  				tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 37815  			}
 37816  		}
 37817  	}
 37818  	(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm = iParm
 37819  	*(*uintptr)(unsafe.Pointer(ppPreStmt)) = pPreStmt
 37820  	if (needResultReset != 0) && (rc == TCL_OK) {
 37821  		tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 37822  	}
 37823  
 37824  	return rc
 37825  }
 37826  
 37827  // Release a statement reference obtained by calling dbPrepareAndBind().
 37828  // There should be exactly one call to this function for each call to
 37829  // dbPrepareAndBind().
 37830  //
 37831  // If the discard parameter is non-zero, then the statement is deleted
 37832  // immediately. Otherwise it is added to the LRU list and may be returned
 37833  // by a subsequent call to dbPrepareAndBind().
 37834  func dbReleaseStmt(tls *libc.TLS, pDb uintptr, pPreStmt uintptr, discard int32) { /* tclsqlite.c:1470:13: */
 37835  	var i int32
 37836  
 37837  	// Free the bound string and blob parameters
 37838  	for i = 0; i < (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm; i++ {
 37839  		for ok := true; ok; ok = 0 != 0 {
 37840  			var _objPtr uintptr = *(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(i)*8))
 37841  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37842  				tcl.XTclFreeObj(tls, _objPtr)
 37843  			}
 37844  		}
 37845  	}
 37846  	(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm = 0
 37847  
 37848  	if ((*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt <= 0) || (discard != 0) {
 37849  		// If the cache is turned off, deallocated the statement
 37850  		dbFreeStmt(tls, pPreStmt)
 37851  	} else {
 37852  		// Add the prepared statement to the beginning of the cache list.
 37853  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList
 37854  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev = uintptr(0)
 37855  		if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList != 0 {
 37856  			(*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtList)).FpPrev = pPreStmt
 37857  		}
 37858  		(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = pPreStmt
 37859  		if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast == uintptr(0) {
 37860  
 37861  			(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = pPreStmt
 37862  		} else {
 37863  
 37864  		}
 37865  		(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt++
 37866  
 37867  		// If we have too many statement in cache, remove the surplus from
 37868  		// the end of the cache list.
 37869  		for (*SqliteDb)(unsafe.Pointer(pDb)).FnStmt > (*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt {
 37870  			var pLast uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast
 37871  			(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = (*SqlPreparedStmt)(unsafe.Pointer(pLast)).FpPrev
 37872  			(*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast)).FpNext = uintptr(0)
 37873  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt--
 37874  			dbFreeStmt(tls, pLast)
 37875  		}
 37876  	}
 37877  }
 37878  
 37879  // Structure used with dbEvalXXX() functions:
 37880  //
 37881  //   dbEvalInit()
 37882  //   dbEvalStep()
 37883  //   dbEvalFinalize()
 37884  //   dbEvalRowInfo()
 37885  //   dbEvalColumnValue()
 37886  type DbEvalContext1 = struct {
 37887  	FpDb       uintptr
 37888  	FpSql      uintptr
 37889  	FzSql      uintptr
 37890  	FpPreStmt  uintptr
 37891  	FnCol      int32
 37892  	FevalFlags int32
 37893  	FpArray    uintptr
 37894  	FapColName uintptr
 37895  } /* tclsqlite.c:1523:9 */
 37896  
 37897  // Structure used with dbEvalXXX() functions:
 37898  //
 37899  //   dbEvalInit()
 37900  //   dbEvalStep()
 37901  //   dbEvalFinalize()
 37902  //   dbEvalRowInfo()
 37903  //   dbEvalColumnValue()
 37904  type DbEvalContext = DbEvalContext1 /* tclsqlite.c:1523:30 */
 37905  
 37906  // Release any cache of column names currently held as part of
 37907  // the DbEvalContext structure passed as the first argument.
 37908  func dbReleaseColumnNames(tls *libc.TLS, p uintptr) { /* tclsqlite.c:1541:13: */
 37909  	if (*DbEvalContext)(unsafe.Pointer(p)).FapColName != 0 {
 37910  		var i int32
 37911  		for i = 0; i < (*DbEvalContext)(unsafe.Pointer(p)).FnCol; i++ {
 37912  			for ok := true; ok; ok = 0 != 0 {
 37913  				var _objPtr uintptr = *(*uintptr)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FapColName + uintptr(i)*8))
 37914  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37915  					tcl.XTclFreeObj(tls, _objPtr)
 37916  				}
 37917  			}
 37918  		}
 37919  		tcl.XTcl_Free(tls, (*DbEvalContext)(unsafe.Pointer(p)).FapColName)
 37920  		(*DbEvalContext)(unsafe.Pointer(p)).FapColName = uintptr(0)
 37921  	}
 37922  	(*DbEvalContext)(unsafe.Pointer(p)).FnCol = 0
 37923  }
 37924  
 37925  // Initialize a DbEvalContext structure.
 37926  //
 37927  // If pArray is not NULL, then it contains the name of a Tcl array
 37928  // variable. The "*" member of this array is set to a list containing
 37929  // the names of the columns returned by the statement as part of each
 37930  // call to dbEvalStep(), in order from left to right. e.g. if the names
 37931  // of the returned columns are a, b and c, it does the equivalent of the
 37932  // tcl command:
 37933  //
 37934  //     set ${pArray}(*) {a b c}
 37935  func dbEvalInit(tls *libc.TLS, p uintptr, pDb uintptr, pSql uintptr, pArray uintptr, evalFlags int32) { /* tclsqlite.c:1565:13: */
 37936  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(DbEvalContext{})))
 37937  	(*DbEvalContext)(unsafe.Pointer(p)).FpDb = pDb
 37938  	(*DbEvalContext)(unsafe.Pointer(p)).FzSql = tcl.XTcl_GetString(tls, pSql)
 37939  	(*DbEvalContext)(unsafe.Pointer(p)).FpSql = pSql
 37940  	(*Tcl_Obj)(unsafe.Pointer(pSql)).FrefCount++
 37941  	if pArray != 0 {
 37942  		(*DbEvalContext)(unsafe.Pointer(p)).FpArray = pArray
 37943  		(*Tcl_Obj)(unsafe.Pointer(pArray)).FrefCount++
 37944  	}
 37945  	(*DbEvalContext)(unsafe.Pointer(p)).FevalFlags = evalFlags
 37946  }
 37947  
 37948  // Obtain information about the row that the DbEvalContext passed as the
 37949  // first argument currently points to.
 37950  func dbEvalRowInfo(tls *libc.TLS, p uintptr, pnCol uintptr, papColName uintptr) { /* tclsqlite.c:1588:13: */
 37951  	// Compute column names
 37952  	if uintptr(0) == (*DbEvalContext)(unsafe.Pointer(p)).FapColName {
 37953  		var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt
 37954  		var i int32                        // Iterator variable
 37955  		var nCol int32                     // Number of columns returned by pStmt
 37956  		var apColName uintptr = uintptr(0) // Array of column names
 37957  
 37958  		(*DbEvalContext)(unsafe.Pointer(p)).FnCol = libc.AssignInt32(&nCol, sqlite3.Xsqlite3_column_count(tls, pStmt))
 37959  		if (nCol > 0) && ((papColName != 0) || ((*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0)) {
 37960  			apColName = tcl.XTcl_Alloc(tls, (uint32(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nCol))))
 37961  			for i = 0; i < nCol; i++ {
 37962  				*(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*8)) = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_column_name(tls, pStmt, i), -1)
 37963  				(*Tcl_Obj)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*8)))).FrefCount++
 37964  			}
 37965  			(*DbEvalContext)(unsafe.Pointer(p)).FapColName = apColName
 37966  		}
 37967  
 37968  		// If results are being stored in an array variable, then create
 37969  		// the array(*) entry for that array
 37970  		if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 37971  			var interp uintptr = (*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).Finterp
 37972  			var pColList uintptr = tcl.XTcl_NewObj(tls)
 37973  			var pStar uintptr = tcl.XTcl_NewStringObj(tls, ts+3701 /* "*" */, -1)
 37974  
 37975  			for i = 0; i < nCol; i++ {
 37976  				tcl.XTcl_ListObjAppendElement(tls, interp, pColList, *(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*8)))
 37977  			}
 37978  			(*Tcl_Obj)(unsafe.Pointer(pStar)).FrefCount++
 37979  			tcl.XTcl_ObjSetVar2(tls, interp, (*DbEvalContext)(unsafe.Pointer(p)).FpArray, pStar, pColList, 0)
 37980  			for ok := true; ok; ok = 0 != 0 {
 37981  				var _objPtr uintptr = pStar
 37982  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 37983  					tcl.XTclFreeObj(tls, _objPtr)
 37984  				}
 37985  			}
 37986  		}
 37987  	}
 37988  
 37989  	if papColName != 0 {
 37990  		*(*uintptr)(unsafe.Pointer(papColName)) = (*DbEvalContext)(unsafe.Pointer(p)).FapColName
 37991  	}
 37992  	if pnCol != 0 {
 37993  		*(*int32)(unsafe.Pointer(pnCol)) = (*DbEvalContext)(unsafe.Pointer(p)).FnCol
 37994  	}
 37995  }
 37996  
 37997  // Return one of TCL_OK, TCL_BREAK or TCL_ERROR. If TCL_ERROR is
 37998  // returned, then an error message is stored in the interpreter before
 37999  // returning.
 38000  //
 38001  // A return value of TCL_OK means there is a row of data available. The
 38002  // data may be accessed using dbEvalRowInfo() and dbEvalColumnValue(). This
 38003  // is analogous to a return of SQLITE_ROW from sqlite3_step(). If TCL_BREAK
 38004  // is returned, then the SQL script has finished executing and there are
 38005  // no further rows available. This is similar to SQLITE_DONE.
 38006  func dbEvalStep(tls *libc.TLS, p uintptr) int32 { /* tclsqlite.c:1646:12: */
 38007  	var zPrevSql uintptr = uintptr(0) // Previous value of p->zSql
 38008  
 38009  	for (*(*int8)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FzSql)) != 0) || ((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt != 0) {
 38010  		var rc int32
 38011  		if (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt == uintptr(0) {
 38012  			zPrevSql = func() uintptr {
 38013  				if (*DbEvalContext)(unsafe.Pointer(p)).FzSql == zPrevSql {
 38014  					return uintptr(0)
 38015  				}
 38016  				return (*DbEvalContext)(unsafe.Pointer(p)).FzSql
 38017  			}()
 38018  			rc = dbPrepareAndBind(tls, (*DbEvalContext)(unsafe.Pointer(p)).FpDb, (*DbEvalContext)(unsafe.Pointer(p)).FzSql, (p + 16 /* &.zSql */), (p + 24 /* &.pPreStmt */))
 38019  			if rc != TCL_OK {
 38020  				return rc
 38021  			}
 38022  		} else {
 38023  			var rcs int32
 38024  			var pDb uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpDb
 38025  			var pPreStmt uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt
 38026  			var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt
 38027  
 38028  			rcs = sqlite3.Xsqlite3_step(tls, pStmt)
 38029  			if rcs == SQLITE_ROW {
 38030  				return TCL_OK
 38031  			}
 38032  			if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 38033  				dbEvalRowInfo(tls, p, uintptr(0), uintptr(0))
 38034  			}
 38035  			rcs = sqlite3.Xsqlite3_reset(tls, pStmt)
 38036  
 38037  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStep = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, 1)
 38038  			(*SqliteDb)(unsafe.Pointer(pDb)).FnSort = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_SORT, 1)
 38039  			(*SqliteDb)(unsafe.Pointer(pDb)).FnIndex = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_AUTOINDEX, 1)
 38040  			(*SqliteDb)(unsafe.Pointer(pDb)).FnVMStep = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_VM_STEP, 1)
 38041  			dbReleaseColumnNames(tls, p)
 38042  			(*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt = uintptr(0)
 38043  
 38044  			if rcs != SQLITE_OK {
 38045  				// If a run-time error occurs, report the error and stop reading
 38046  				// the SQL.
 38047  				dbReleaseStmt(tls, pDb, pPreStmt, 1)
 38048  				if (((*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).FbLegacyPrepare != 0) && (rcs == SQLITE_SCHEMA)) && (zPrevSql != 0) {
 38049  					// If the runtime error was an SQLITE_SCHEMA, and the database
 38050  					// handle is configured to use the legacy sqlite3_prepare()
 38051  					// interface, retry prepare()/step() on the same SQL statement.
 38052  					// This only happens once. If there is a second SQLITE_SCHEMA
 38053  					// error, the error will be returned to the caller.
 38054  					(*DbEvalContext)(unsafe.Pointer(p)).FzSql = zPrevSql
 38055  					continue
 38056  				}
 38057  				tcl.XTcl_SetObjResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp,
 38058  					tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 38059  				return TCL_ERROR
 38060  			} else {
 38061  				dbReleaseStmt(tls, pDb, pPreStmt, 0)
 38062  			}
 38063  		}
 38064  	}
 38065  
 38066  	// Finished
 38067  	return TCL_BREAK
 38068  }
 38069  
 38070  // Free all resources currently held by the DbEvalContext structure passed
 38071  // as the first argument. There should be exactly one call to this function
 38072  // for each call to dbEvalInit().
 38073  func dbEvalFinalize(tls *libc.TLS, p uintptr) { /* tclsqlite.c:1710:13: */
 38074  	if (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt != 0 {
 38075  		sqlite3.Xsqlite3_reset(tls, (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt)
 38076  		dbReleaseStmt(tls, (*DbEvalContext)(unsafe.Pointer(p)).FpDb, (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt, 0)
 38077  		(*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt = uintptr(0)
 38078  	}
 38079  	if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 38080  		for ok := true; ok; ok = 0 != 0 {
 38081  			var _objPtr uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpArray
 38082  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38083  				tcl.XTclFreeObj(tls, _objPtr)
 38084  			}
 38085  		}
 38086  		(*DbEvalContext)(unsafe.Pointer(p)).FpArray = uintptr(0)
 38087  	}
 38088  	for ok1 := true; ok1; ok1 = 0 != 0 {
 38089  		var _objPtr uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpSql
 38090  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38091  			tcl.XTclFreeObj(tls, _objPtr)
 38092  		}
 38093  	}
 38094  	dbReleaseColumnNames(tls, p)
 38095  }
 38096  
 38097  // Return a pointer to a Tcl_Obj structure with ref-count 0 that contains
 38098  // the value for the iCol'th column of the row currently pointed to by
 38099  // the DbEvalContext structure passed as the first argument.
 38100  func dbEvalColumnValue(tls *libc.TLS, p uintptr, iCol int32) uintptr { /* tclsqlite.c:1729:16: */
 38101  	var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt
 38102  	switch sqlite3.Xsqlite3_column_type(tls, pStmt, iCol) {
 38103  	case SQLITE_BLOB:
 38104  		{
 38105  			var bytes int32 = sqlite3.Xsqlite3_column_bytes(tls, pStmt, iCol)
 38106  			var zBlob uintptr = sqlite3.Xsqlite3_column_blob(tls, pStmt, iCol)
 38107  			if !(zBlob != 0) {
 38108  				bytes = 0
 38109  			}
 38110  			return tcl.XTcl_NewByteArrayObj(tls, zBlob, bytes)
 38111  
 38112  		}
 38113  	case SQLITE_INTEGER:
 38114  		{
 38115  			var v sqlite_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, iCol)
 38116  			if (v >= int64(-2147483647)) && (v <= int64(2147483647)) {
 38117  				return tcl.XTcl_NewIntObj(tls, int32(v))
 38118  			} else {
 38119  				return tcl.XTcl_NewWideIntObj(tls, v)
 38120  			}
 38121  
 38122  		}
 38123  		fallthrough
 38124  	case SQLITE_FLOAT:
 38125  		{
 38126  			return tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_column_double(tls, pStmt, iCol))
 38127  
 38128  		}
 38129  	case SQLITE_NULL:
 38130  		{
 38131  			return tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).FzNull, -1)
 38132  
 38133  		}
 38134  	}
 38135  
 38136  	return tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_column_text(tls, pStmt, iCol), -1)
 38137  }
 38138  
 38139  // If using Tcl version 8.6 or greater, use the NR functions to avoid
 38140  // recursive evalution of scripts by the [db eval] and [db trans]
 38141  // commands. Even if the headers used while compiling the extension
 38142  // are 8.6 or newer, the code still tests the Tcl version at runtime.
 38143  // This allows stubs-enabled builds to be used with older Tcl libraries.
 38144  func DbUseNre(tls *libc.TLS) int32 { /* tclsqlite.c:1766:12: */
 38145  	bp := tls.Alloc(8)
 38146  	defer tls.Free(8)
 38147  
 38148  	// var major int32 at bp, 4
 38149  
 38150  	// var minor int32 at bp+4, 4
 38151  
 38152  	tcl.XTcl_GetVersion(tls, bp /* &major */, bp+4 /* &minor */, uintptr(0), uintptr(0))
 38153  	return (libc.Bool32(((*(*int32)(unsafe.Pointer(bp /* major */)) == 8) && (*(*int32)(unsafe.Pointer(bp + 4 /* minor */)) >= 6)) || (*(*int32)(unsafe.Pointer(bp /* major */)) > 8)))
 38154  }
 38155  
 38156  // This function is part of the implementation of the command:
 38157  //
 38158  //   $db eval SQL ?ARRAYNAME? SCRIPT
 38159  func DbEvalNextCmd(tls *libc.TLS, data uintptr, interp uintptr, result int32) int32 { /* tclsqlite.c:1793:26: */
 38160  	bp := tls.Alloc(16)
 38161  	defer tls.Free(16)
 38162  
 38163  	var rc int32 = result // Return code
 38164  
 38165  	// The first element of the data[] array is a pointer to a DbEvalContext
 38166  	// structure allocated using Tcl_Alloc(). The second element of data[]
 38167  	// is a pointer to a Tcl_Obj containing the script to run for each row
 38168  	// returned by the queries encapsulated in data[0].
 38169  	var p uintptr = *(*ClientData)(unsafe.Pointer(data))
 38170  	var pScript uintptr = *(*ClientData)(unsafe.Pointer(data + 1*8))
 38171  	var pArray uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpArray
 38172  
 38173  	for ((rc == TCL_OK) || (rc == TCL_CONTINUE)) && (TCL_OK == (libc.AssignInt32(&rc, dbEvalStep(tls, p)))) {
 38174  		var i int32
 38175  		// var nCol int32 at bp, 4
 38176  
 38177  		// var apColName uintptr at bp+8, 8
 38178  
 38179  		dbEvalRowInfo(tls, p, bp /* &nCol */, bp+8 /* &apColName */)
 38180  		for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nCol */)); i++ {
 38181  			if pArray == uintptr(0) {
 38182  				tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* apColName */)) + uintptr(i)*8)), uintptr(0), dbEvalColumnValue(tls, p, i), 0)
 38183  			} else if (((*DbEvalContext)(unsafe.Pointer(p)).FevalFlags & SQLITE_EVAL_WITHOUTNULLS) != 0) &&
 38184  				(sqlite3.Xsqlite3_column_type(tls, (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt, i) == SQLITE_NULL) {
 38185  				tcl.XTcl_UnsetVar2(tls, interp, tcl.XTcl_GetString(tls, pArray),
 38186  					tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* apColName */)) + uintptr(i)*8))), 0)
 38187  			} else {
 38188  				tcl.XTcl_ObjSetVar2(tls, interp, pArray, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* apColName */)) + uintptr(i)*8)), dbEvalColumnValue(tls, p, i), 0)
 38189  			}
 38190  		}
 38191  
 38192  		// The required interpreter variables are now populated with the data
 38193  		// from the current row. If using NRE, schedule callbacks to evaluate
 38194  		// script pScript, then to invoke this function again to fetch the next
 38195  		// row (or clean up if there is no next row or the script throws an
 38196  		// exception). After scheduling the callbacks, return control to the
 38197  		// caller.
 38198  		//
 38199  		// If not using NRE, evaluate pScript directly and continue with the
 38200  		// next iteration of this while(...) loop.
 38201  		if DbUseNre(tls) != 0 {
 38202  			tcl.XTcl_NRAddCallback(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 38203  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 38204  			}{DbEvalNextCmd})), p, pScript, uintptr(0), uintptr(0))
 38205  			return tcl.XTcl_NREvalObj(tls, interp, pScript, 0)
 38206  		} else {
 38207  			rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 38208  		}
 38209  	}
 38210  
 38211  	for ok := true; ok; ok = 0 != 0 {
 38212  		var _objPtr uintptr = pScript
 38213  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38214  			tcl.XTclFreeObj(tls, _objPtr)
 38215  		}
 38216  	}
 38217  	dbEvalFinalize(tls, p)
 38218  	tcl.XTcl_Free(tls, p)
 38219  
 38220  	if (rc == TCL_OK) || (rc == TCL_BREAK) {
 38221  		tcl.XTcl_ResetResult(tls, interp)
 38222  		rc = TCL_OK
 38223  	}
 38224  	return rc
 38225  }
 38226  
 38227  // This function is used by the implementations of the following database
 38228  // handle sub-commands:
 38229  //
 38230  //   $db update_hook ?SCRIPT?
 38231  //   $db wal_hook ?SCRIPT?
 38232  //   $db commit_hook ?SCRIPT?
 38233  //   $db preupdate hook ?SCRIPT?
 38234  func DbHookCmd(tls *libc.TLS, interp uintptr, pDb uintptr, pArg uintptr, ppHook uintptr) { /* tclsqlite.c:1863:13: */
 38235  	var db uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Fdb
 38236  
 38237  	if *(*uintptr)(unsafe.Pointer(ppHook)) != 0 {
 38238  		tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(ppHook)))
 38239  		if pArg != 0 {
 38240  			for ok := true; ok; ok = 0 != 0 {
 38241  				var _objPtr uintptr = *(*uintptr)(unsafe.Pointer(ppHook))
 38242  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38243  					tcl.XTclFreeObj(tls, _objPtr)
 38244  				}
 38245  			}
 38246  			*(*uintptr)(unsafe.Pointer(ppHook)) = uintptr(0)
 38247  		}
 38248  	}
 38249  	if pArg != 0 {
 38250  
 38251  		if tcl.XTcl_GetCharLength(tls, pArg) > 0 {
 38252  			*(*uintptr)(unsafe.Pointer(ppHook)) = pArg
 38253  			(*Tcl_Obj)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppHook)))).FrefCount++
 38254  		}
 38255  	}
 38256  
 38257  	sqlite3.Xsqlite3_preupdate_hook(tls, db, func() uintptr {
 38258  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook != 0 {
 38259  			return *(*uintptr)(unsafe.Pointer(&struct {
 38260  				f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, sqlite_int64, sqlite_int64)
 38261  			}{DbPreUpdateHandler}))
 38262  		}
 38263  		return uintptr(0)
 38264  	}(), pDb)
 38265  	sqlite3.Xsqlite3_update_hook(tls, db, func() uintptr {
 38266  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook != 0 {
 38267  			return *(*uintptr)(unsafe.Pointer(&struct {
 38268  				f func(*libc.TLS, uintptr, int32, uintptr, uintptr, sqlite_int64)
 38269  			}{DbUpdateHandler}))
 38270  		}
 38271  		return uintptr(0)
 38272  	}(), pDb)
 38273  	sqlite3.Xsqlite3_rollback_hook(tls, db, func() uintptr {
 38274  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook != 0 {
 38275  			return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbRollbackHandler}))
 38276  		}
 38277  		return uintptr(0)
 38278  	}(), pDb)
 38279  	sqlite3.Xsqlite3_wal_hook(tls, db, func() uintptr {
 38280  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook != 0 {
 38281  			return *(*uintptr)(unsafe.Pointer(&struct {
 38282  				f func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32
 38283  			}{DbWalHandler}))
 38284  		}
 38285  		return uintptr(0)
 38286  	}(), pDb)
 38287  }
 38288  
 38289  // The "sqlite" command below creates a new Tcl command for each
 38290  // connection it opens to an SQLite database.  This routine is invoked
 38291  // whenever one of those connection-specific commands is executed
 38292  // in Tcl.  For example, if you run Tcl code like this:
 38293  //
 38294  //       sqlite3 db1  "my_database"
 38295  //       db1 close
 38296  //
 38297  // The first command opens a connection to the "my_database" database
 38298  // and calls that connection "db1".  The second command causes this
 38299  // subroutine to be invoked.
 38300  func DbObjCmd(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:1907:26: */
 38301  	bp := tls.Alloc(1580)
 38302  	defer tls.Free(1580)
 38303  	*(*uintptr)(unsafe.Pointer(bp + 1456)) = cd
 38304  
 38305  	var pDb uintptr
 38306  	// var choice int32 at bp+1016, 4
 38307  
 38308  	var rc int32
 38309  	var zAuth uintptr
 38310  	// var len int32 at bp+1020, 4
 38311  
 38312  	var zDestFile uintptr
 38313  	var zSrcDb uintptr
 38314  	// var pDest uintptr at bp+1024, 8
 38315  
 38316  	var pBackup uintptr
 38317  	var zCallback uintptr
 38318  	// var len1 int32 at bp+1032, 4
 38319  
 38320  	var zBusy uintptr
 38321  	// var len2 int32 at bp+1036, 4
 38322  
 38323  	var subCmd uintptr
 38324  	// var n int32 at bp+1040, 4
 38325  
 38326  	var pResult uintptr
 38327  	var pCollate uintptr
 38328  	var zName uintptr
 38329  	var zScript uintptr
 38330  	// var nScript int32 at bp+1044, 4
 38331  
 38332  	var _objPtr uintptr
 38333  	var zCommit uintptr
 38334  	// var len3 int32 at bp+1048, 4
 38335  
 38336  	var pResult1 uintptr
 38337  	var isComplete int32
 38338  	// var v int32 at bp+1052, 4
 38339  
 38340  	var zOpt uintptr
 38341  	// var onoff int32 at bp+1056, 4
 38342  
 38343  	// var v1 int32 at bp+1060, 4
 38344  
 38345  	var pResult2 uintptr
 38346  	var ii int32
 38347  	var zErr uintptr
 38348  	var nErr int32
 38349  	var z uintptr
 38350  	var zTable uintptr    // Insert data into this table
 38351  	var zFile uintptr     // The file from which to extract data
 38352  	var zConflict uintptr // The conflict algorithm to use
 38353  	// var pStmt uintptr at bp+1064, 8
 38354  	// A statement
 38355  	var nCol int32  // Number of columns in the table
 38356  	var nByte int32 // Number of bytes in an SQL string
 38357  	var i int32
 38358  	var j int32          // Loop counters
 38359  	var nSep int32       // Number of bytes in zSep[]
 38360  	var nNull int32      // Number of bytes in zNull[]
 38361  	var zSql uintptr     // An SQL statement
 38362  	var zLine uintptr    // A single line of input from the file
 38363  	var azCol uintptr    // zLine[] broken up into columns
 38364  	var zCommit1 uintptr // How to commit changes
 38365  	var in uintptr       // The input file
 38366  	var lineno int32     // Line number of input file
 38367  	// var zLineNum [80]int8 at bp+1072, 80
 38368  	// Line number print buffer
 38369  	var pResult3 uintptr // interp result
 38370  
 38371  	var zSep uintptr
 38372  	var zNull uintptr
 38373  	var z1 uintptr
 38374  	var flags int32
 38375  	var zSchema uintptr
 38376  	var pValue uintptr
 38377  	var pBA uintptr
 38378  	var pData uintptr
 38379  	// var len4 int32 at bp+1164, 4
 38380  
 38381  	var xrc int32
 38382  	// var mxSize sqlite3_int64 at bp+1152, 8
 38383  
 38384  	var i1 int32
 38385  	// var isReadonly int32 at bp+1160, 4
 38386  
 38387  	var pResult4 uintptr
 38388  	// var sEval DbEvalContext at bp+1168, 56
 38389  
 38390  	var i2 int32
 38391  	// var nCol1 int32 at bp+1280, 4
 38392  
 38393  	var _objPtr1 uintptr
 38394  	// var sEval1 DbEvalContext at bp+1224, 56
 38395  
 38396  	var pRet uintptr
 38397  	// var cd2 [2]ClientData at bp+1288, 16
 38398  
 38399  	var p uintptr
 38400  	var pArray uintptr
 38401  	var pScript uintptr
 38402  	var evalFlags int32
 38403  	var zOpt1 uintptr
 38404  	// var azType [6]uintptr at bp+1312, 48
 38405  
 38406  	var z2 uintptr
 38407  	var n1 int32
 38408  	var _objPtr2 uintptr
 38409  	var flags1 int32
 38410  	var pFunc uintptr
 38411  	var pScript1 uintptr
 38412  	var zName1 uintptr
 38413  	// var nArg int32 at bp+1304, 4
 38414  
 38415  	var i3 int32
 38416  	// var eType int32 at bp+1360, 4
 38417  
 38418  	var isReadonly1 int32
 38419  	var zDb uintptr
 38420  	var zTable1 uintptr
 38421  	var zColumn uintptr
 38422  	// var iRow Tcl_WideInt at bp+1368, 8
 38423  
 38424  	// var len5 int32 at bp+1376, 4
 38425  
 38426  	var zNull1 uintptr
 38427  	var pResult5 uintptr
 38428  	var rowid Tcl_WideInt
 38429  	var zProgress uintptr
 38430  	// var len6 int32 at bp+1384, 4
 38431  
 38432  	// var N int32 at bp+1380, 4
 38433  
 38434  	var zProfile uintptr
 38435  	// var len7 int32 at bp+1388, 4
 38436  
 38437  	var zSrcFile uintptr
 38438  	var zDestDb uintptr
 38439  	// var pSrc uintptr at bp+1392, 8
 38440  
 38441  	var pBackup1 uintptr
 38442  	var nTimeout int32
 38443  	var needFree int32
 38444  	var zSchema1 uintptr
 38445  	// var sz sqlite3_int64 at bp+1400, 8
 38446  
 38447  	var pData1 uintptr
 38448  	var v2 int32
 38449  	var zOp uintptr
 38450  	// var ms int32 at bp+1408, 4
 38451  
 38452  	var pResult6 uintptr
 38453  	var zTrace uintptr
 38454  	// var len8 int32 at bp+1412, 4
 38455  
 38456  	var _objPtr3 uintptr
 38457  	var _objPtr4 uintptr
 38458  	// var wType Tcl_WideInt at bp+1440, 8
 38459  
 38460  	var pError uintptr
 38461  	// var pObj uintptr at bp+1424, 8
 38462  
 38463  	// var ttype int32 at bp+1432, 4
 38464  
 38465  	var i4 int32
 38466  	var zTraceV2 uintptr
 38467  	// var len9 int32 at bp+1416, 4
 38468  
 38469  	var wMask Tcl_WideInt
 38470  	// var ttype1 int32 at bp+1448, 4
 38471  
 38472  	var pScript2 uintptr
 38473  	var zBegin uintptr
 38474  	var _objPtr5 uintptr
 38475  	var xNotify uintptr
 38476  	var pNotifyArg uintptr
 38477  	var nCol2 int32
 38478  	var pRet1 uintptr
 38479  	var pObj1 uintptr
 38480  	// var iIdx int32 at bp+1468, 4
 38481  
 38482  	// var pValue1 uintptr at bp+1472, 8
 38483  
 38484  	// var iSub int32 at bp+1464, 4
 38485  
 38486  	// set ppHook to point at pUpdateHook or pRollbackHook, depending on
 38487  	// whether [$db update_hook] or [$db rollback_hook] was invoked.
 38488  	var ppHook uintptr
 38489  	// var zBuf [100]int8 at bp+1480, 100
 38490  
 38491  	var zArg uintptr
 38492  	var i5 int32
 38493  	pDb = *(*uintptr)(unsafe.Pointer(bp + 1456 /* cd */))
 38494  	rc = TCL_OK
 38495  	// don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler
 38496  
 38497  	if !(objc < 2) {
 38498  		goto __1
 38499  	}
 38500  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 38501  	return TCL_ERROR
 38502  __1:
 38503  	;
 38504  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&DB_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+12161 /* "option" */, 0, bp+1016 /* &choice */) != 0) {
 38505  		goto __2
 38506  	}
 38507  	return TCL_ERROR
 38508  __2:
 38509  	;
 38510  
 38511  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */))) {
 38512  
 38513  	// $db authorizer ?CALLBACK?
 38514  	//
 38515  	// Invoke the given callback to authorize each SQL operation as it is
 38516  	// compiled.  5 arguments are appended to the callback before it is
 38517  	// invoked:
 38518  	//
 38519  	//   (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...)
 38520  	//   (2) First descriptive name (depends on authorization type)
 38521  	//   (3) Second descriptive name
 38522  	//   (4) Name of the database (ex: "main", "temp")
 38523  	//   (5) Name of trigger that is doing the access
 38524  	//
 38525  	// The callback should return on of the following strings: SQLITE_OK,
 38526  	// SQLITE_IGNORE, or SQLITE_DENY.  Any other return value is an error.
 38527  	//
 38528  	// If this method is invoked with no arguments, the current authorization
 38529  	// callback string is returned.
 38530  	case uint32(0) /* DB_AUTHORIZER */ :
 38531  		goto __4
 38532  
 38533  	// $db backup ?DATABASE? FILENAME
 38534  	//
 38535  	// Open or create a database file named FILENAME.  Transfer the
 38536  	// content of local database DATABASE (default: "main") into the
 38537  	// FILENAME database.
 38538  	case uint32(1) /* DB_BACKUP */ :
 38539  		goto __5
 38540  
 38541  	// $db bind_fallback ?CALLBACK?
 38542  	//
 38543  	// When resolving bind parameters in an SQL statement, if the parameter
 38544  	// cannot be associated with a TCL variable then invoke CALLBACK with a
 38545  	// single argument that is the name of the parameter and use the return
 38546  	// value of the CALLBACK as the binding.  If CALLBACK returns something
 38547  	// other than TCL_OK or TCL_ERROR then bind a NULL.
 38548  	//
 38549  	// If CALLBACK is an empty string, then revert to the default behavior
 38550  	// which is to set the binding to NULL.
 38551  	//
 38552  	// If CALLBACK returns an error, that causes the statement execution to
 38553  	// abort.  Hence, to configure a connection so that it throws an error
 38554  	// on an attempt to bind an unknown variable, do something like this:
 38555  	//
 38556  	//     proc bind_error {name} {error "no such variable: $name"}
 38557  	//     db bind_fallback bind_error
 38558  	case uint32(2) /* DB_BIND_FALLBACK */ :
 38559  		goto __6
 38560  
 38561  	// $db busy ?CALLBACK?
 38562  	//
 38563  	// Invoke the given callback if an SQL statement attempts to open
 38564  	// a locked database file.
 38565  	case uint32(3) /* DB_BUSY */ :
 38566  		goto __7
 38567  
 38568  	// $db cache flush
 38569  	//     $db cache size n
 38570  	//
 38571  	// Flush the prepared statement cache, or set the maximum number of
 38572  	// cached statements.
 38573  	case uint32(4) /* DB_CACHE */ :
 38574  		goto __8
 38575  
 38576  	// $db changes
 38577  	//
 38578  	// Return the number of rows that were modified, inserted, or deleted by
 38579  	// the most recent INSERT, UPDATE or DELETE statement, not including
 38580  	// any changes made by trigger programs.
 38581  	case uint32(5) /* DB_CHANGES */ :
 38582  		goto __9
 38583  
 38584  	// $db close
 38585  	//
 38586  	// Shutdown the database
 38587  	case uint32(6) /* DB_CLOSE */ :
 38588  		goto __10
 38589  
 38590  	//     $db collate NAME SCRIPT
 38591  	//
 38592  	// Create a new SQL collation function called NAME.  Whenever
 38593  	// that function is called, invoke SCRIPT to evaluate the function.
 38594  	case uint32(7) /* DB_COLLATE */ :
 38595  		goto __11
 38596  
 38597  	//     $db collation_needed SCRIPT
 38598  	//
 38599  	// Create a new SQL collation function called NAME.  Whenever
 38600  	// that function is called, invoke SCRIPT to evaluate the function.
 38601  	case uint32(8) /* DB_COLLATION_NEEDED */ :
 38602  		goto __12
 38603  
 38604  	// $db commit_hook ?CALLBACK?
 38605  	//
 38606  	// Invoke the given callback just before committing every SQL transaction.
 38607  	// If the callback throws an exception or returns non-zero, then the
 38608  	// transaction is aborted.  If CALLBACK is an empty string, the callback
 38609  	// is disabled.
 38610  	case uint32(9) /* DB_COMMIT_HOOK */ :
 38611  		goto __13
 38612  
 38613  	// $db complete SQL
 38614  	//
 38615  	// Return TRUE if SQL is a complete SQL statement.  Return FALSE if
 38616  	// additional lines of input are needed.  This is similar to the
 38617  	// built-in "info complete" command of Tcl.
 38618  	case uint32(10) /* DB_COMPLETE */ :
 38619  		goto __14
 38620  
 38621  	// $db config ?OPTION? ?BOOLEAN?
 38622  	//
 38623  	// Configure the database connection using the sqlite3_db_config()
 38624  	// interface.
 38625  	case uint32(11) /* DB_CONFIG */ :
 38626  		goto __15
 38627  
 38628  	// $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
 38629  	//
 38630  	// Copy data into table from filename, optionally using SEPARATOR
 38631  	// as column separators.  If a column contains a null string, or the
 38632  	// value of NULLINDICATOR, a NULL is inserted for the column.
 38633  	// conflict-algorithm is one of the sqlite conflict algorithms:
 38634  	//    rollback, abort, fail, ignore, replace
 38635  	// On success, return the number of lines processed, not necessarily same
 38636  	// as 'db changes' due to conflict-algorithm selected.
 38637  	//
 38638  	// This code is basically an implementation/enhancement of
 38639  	// the sqlite3 shell.c ".import" command.
 38640  	//
 38641  	// This command usage is equivalent to the sqlite2.x COPY statement,
 38642  	// which imports file data into a table using the PostgreSQL COPY file format:
 38643  	//   $db copy $conflit_algo $table_name $filename \t \\N
 38644  	case uint32(12) /* DB_COPY */ :
 38645  		goto __16
 38646  
 38647  	//     $db deserialize ?-maxsize N? ?-readonly BOOL? ?DATABASE? VALUE
 38648  	//
 38649  	// Reopen DATABASE (default "main") using the content in $VALUE
 38650  	case uint32(13) /* DB_DESERIALIZE */ :
 38651  		goto __17
 38652  
 38653  	//    $db enable_load_extension BOOLEAN
 38654  	//
 38655  	// Turn the extension loading feature on or off.  It if off by
 38656  	// default.
 38657  	case uint32(14) /* DB_ENABLE_LOAD_EXTENSION */ :
 38658  		goto __18
 38659  
 38660  	//    $db errorcode
 38661  	//
 38662  	// Return the numeric error code that was returned by the most recent
 38663  	// call to sqlite3_exec().
 38664  	case uint32(15) /* DB_ERRORCODE */ :
 38665  		goto __19
 38666  
 38667  	//    $db exists $sql
 38668  	//    $db onecolumn $sql
 38669  	//
 38670  	// The onecolumn method is the equivalent of:
 38671  	//     lindex [$db eval $sql] 0
 38672  	case uint32(17) /* DB_EXISTS */ :
 38673  		goto __20
 38674  	case uint32(23) /* DB_ONECOLUMN */ :
 38675  		goto __21
 38676  
 38677  	//    $db eval ?options? $sql ?array? ?{  ...code... }?
 38678  	//
 38679  	// The SQL statement in $sql is evaluated.  For each row, the values are
 38680  	// placed in elements of the array named "array" and ...code... is executed.
 38681  	// If "array" and "code" are omitted, then no callback is every invoked.
 38682  	// If "array" is an empty string, then the values are placed in variables
 38683  	// that have the same name as the fields extracted by the query.
 38684  	case uint32(16) /* DB_EVAL */ :
 38685  		goto __22
 38686  
 38687  	//     $db function NAME [OPTIONS] SCRIPT
 38688  	//
 38689  	// Create a new SQL function called NAME.  Whenever that function is
 38690  	// called, invoke SCRIPT to evaluate the function.
 38691  	//
 38692  	// Options:
 38693  	//         --argcount N           Function has exactly N arguments
 38694  	//         --deterministic        The function is pure
 38695  	//         --directonly           Prohibit use inside triggers and views
 38696  	//         --innocuous            Has no side effects or information leaks
 38697  	//         --returntype TYPE      Specify the return type of the function
 38698  	case uint32(18) /* DB_FUNCTION */ :
 38699  		goto __23
 38700  
 38701  	//     $db incrblob ?-readonly? ?DB? TABLE COLUMN ROWID
 38702  	case uint32(19) /* DB_INCRBLOB */ :
 38703  		goto __24
 38704  
 38705  	//     $db interrupt
 38706  	//
 38707  	// Interrupt the execution of the inner-most SQL interpreter.  This
 38708  	// causes the SQL statement to return an error of SQLITE_INTERRUPT.
 38709  	case uint32(20) /* DB_INTERRUPT */ :
 38710  		goto __25
 38711  
 38712  	//     $db nullvalue ?STRING?
 38713  	//
 38714  	// Change text used when a NULL comes back from the database. If ?STRING?
 38715  	// is not present, then the current string used for NULL is returned.
 38716  	// If STRING is present, then STRING is returned.
 38717  	//
 38718  	case uint32(22) /* DB_NULLVALUE */ :
 38719  		goto __26
 38720  
 38721  	//     $db last_insert_rowid
 38722  	//
 38723  	// Return an integer which is the ROWID for the most recent insert.
 38724  	case uint32(21) /* DB_LAST_INSERT_ROWID */ :
 38725  		goto __27
 38726  
 38727  	// The DB_ONECOLUMN method is implemented together with DB_EXISTS.
 38728  
 38729  	// $db progress ?N CALLBACK?
 38730  	//
 38731  	// Invoke the given callback every N virtual machine opcodes while executing
 38732  	// queries.
 38733  	case uint32(26) /* DB_PROGRESS */ :
 38734  		goto __28
 38735  
 38736  	// $db profile ?CALLBACK?
 38737  	//
 38738  	// Make arrangements to invoke the CALLBACK routine after each SQL statement
 38739  	// that has run.  The text of the SQL and the amount of elapse time are
 38740  	// appended to CALLBACK before the script is run.
 38741  	case uint32(25) /* DB_PROFILE */ :
 38742  		goto __29
 38743  
 38744  	//     $db rekey KEY
 38745  	//
 38746  	// Change the encryption key on the currently open database.
 38747  	case uint32(27) /* DB_REKEY */ :
 38748  		goto __30
 38749  
 38750  	// $db restore ?DATABASE? FILENAME
 38751  	//
 38752  	// Open a database file named FILENAME.  Transfer the content
 38753  	// of FILENAME into the local database DATABASE (default: "main").
 38754  	case uint32(28) /* DB_RESTORE */ :
 38755  		goto __31
 38756  
 38757  	//     $db serialize ?DATABASE?
 38758  	//
 38759  	// Return a serialization of a database.
 38760  	case uint32(30) /* DB_SERIALIZE */ :
 38761  		goto __32
 38762  
 38763  	//     $db status (step|sort|autoindex|vmstep)
 38764  	//
 38765  	// Display SQLITE_STMTSTATUS_FULLSCAN_STEP or
 38766  	// SQLITE_STMTSTATUS_SORT for the most recent eval.
 38767  	case uint32(31) /* DB_STATUS */ :
 38768  		goto __33
 38769  
 38770  	//     $db timeout MILLESECONDS
 38771  	//
 38772  	// Delay for the number of milliseconds specified when a file is locked.
 38773  	case uint32(32) /* DB_TIMEOUT */ :
 38774  		goto __34
 38775  
 38776  	//     $db total_changes
 38777  	//
 38778  	// Return the number of rows that were modified, inserted, or deleted
 38779  	// since the database handle was created.
 38780  	case uint32(33) /* DB_TOTAL_CHANGES */ :
 38781  		goto __35
 38782  
 38783  	// $db trace ?CALLBACK?
 38784  	//
 38785  	// Make arrangements to invoke the CALLBACK routine for each SQL statement
 38786  	// that is executed.  The text of the SQL is appended to CALLBACK before
 38787  	// it is executed.
 38788  	case uint32(34) /* DB_TRACE */ :
 38789  		goto __36
 38790  
 38791  	// $db trace_v2 ?CALLBACK? ?MASK?
 38792  	//
 38793  	// Make arrangements to invoke the CALLBACK routine for each trace event
 38794  	// matching the mask that is generated.  The parameters are appended to
 38795  	// CALLBACK before it is executed.
 38796  	case uint32(35) /* DB_TRACE_V2 */ :
 38797  		goto __37
 38798  
 38799  	// $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 38800  	//
 38801  	// Start a new transaction (if we are not already in the midst of a
 38802  	// transaction) and execute the TCL script SCRIPT.  After SCRIPT
 38803  	// completes, either commit the transaction or roll it back if SCRIPT
 38804  	// throws an exception.  Or if no new transation was started, do nothing.
 38805  	// pass the exception on up the stack.
 38806  	//
 38807  	// This command was inspired by Dave Thomas's talk on Ruby at the
 38808  	// 2005 O'Reilly Open Source Convention (OSCON).
 38809  	case uint32(36) /* DB_TRANSACTION */ :
 38810  		goto __38
 38811  
 38812  	//    $db unlock_notify ?script?
 38813  	case uint32(37) /* DB_UNLOCK_NOTIFY */ :
 38814  		goto __39
 38815  
 38816  	//    $db preupdate_hook count
 38817  	//    $db preupdate_hook hook ?SCRIPT?
 38818  	//    $db preupdate_hook new INDEX
 38819  	//    $db preupdate_hook old INDEX
 38820  	case uint32(24) /* DB_PREUPDATE */ :
 38821  		goto __40
 38822  
 38823  	//    $db wal_hook ?script?
 38824  	//    $db update_hook ?script?
 38825  	//    $db rollback_hook ?script?
 38826  	case uint32(40) /* DB_WAL_HOOK */ :
 38827  		goto __41
 38828  	case uint32(38) /* DB_UPDATE_HOOK */ :
 38829  		goto __42
 38830  	case uint32(29) /* DB_ROLLBACK_HOOK */ :
 38831  		goto __43
 38832  
 38833  	// $db version
 38834  	//
 38835  	// Return the version string for this database.
 38836  	case uint32(39) /* DB_VERSION */ :
 38837  		goto __44
 38838  	}
 38839  	goto __3
 38840  
 38841  	// $db authorizer ?CALLBACK?
 38842  	//
 38843  	// Invoke the given callback to authorize each SQL operation as it is
 38844  	// compiled.  5 arguments are appended to the callback before it is
 38845  	// invoked:
 38846  	//
 38847  	//   (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...)
 38848  	//   (2) First descriptive name (depends on authorization type)
 38849  	//   (3) Second descriptive name
 38850  	//   (4) Name of the database (ex: "main", "temp")
 38851  	//   (5) Name of trigger that is doing the access
 38852  	//
 38853  	// The callback should return on of the following strings: SQLITE_OK,
 38854  	// SQLITE_IGNORE, or SQLITE_DENY.  Any other return value is an error.
 38855  	//
 38856  	// If this method is invoked with no arguments, the current authorization
 38857  	// callback string is returned.
 38858  __4:
 38859  	if !(objc > 3) {
 38860  		goto __45
 38861  	}
 38862  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 38863  	return TCL_ERROR
 38864  	goto __46
 38865  __45:
 38866  	if !(objc == 2) {
 38867  		goto __47
 38868  	}
 38869  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 38870  		goto __49
 38871  	}
 38872  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, uintptr(0)))
 38873  __49:
 38874  	;
 38875  	goto __48
 38876  __47:
 38877  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 38878  		goto __50
 38879  	}
 38880  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth)
 38881  __50:
 38882  	;
 38883  	zAuth = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1020 /* &len */)
 38884  	if !((zAuth != 0) && (*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) > 0)) {
 38885  		goto __51
 38886  	}
 38887  	(*SqliteDb)(unsafe.Pointer(pDb)).FzAuth = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) + 1)))
 38888  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, zAuth, (uint64(*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) + 1)))
 38889  	goto __52
 38890  __51:
 38891  	(*SqliteDb)(unsafe.Pointer(pDb)).FzAuth = uintptr(0)
 38892  __52:
 38893  	;
 38894  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 38895  		goto __53
 38896  	}
 38897  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 38898  	sqlite3.Xsqlite3_set_authorizer(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 38899  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32
 38900  	}{auth_callback})), pDb)
 38901  	goto __54
 38902  __53:
 38903  	sqlite3.Xsqlite3_set_authorizer(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 38904  __54:
 38905  	;
 38906  __48:
 38907  	;
 38908  __46:
 38909  	;
 38910  	goto __3
 38911  
 38912  	// $db backup ?DATABASE? FILENAME
 38913  	//
 38914  	// Open or create a database file named FILENAME.  Transfer the
 38915  	// content of local database DATABASE (default: "main") into the
 38916  	// FILENAME database.
 38917  __5:
 38918  
 38919  	if !(objc == 3) {
 38920  		goto __55
 38921  	}
 38922  	zSrcDb = ts + 85 /* "main" */
 38923  	zDestFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 38924  	goto __56
 38925  __55:
 38926  	if !(objc == 4) {
 38927  		goto __57
 38928  	}
 38929  	zSrcDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 38930  	zDestFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 38931  	goto __58
 38932  __57:
 38933  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12179 /* "?DATABASE? FILEN..." */)
 38934  	return TCL_ERROR
 38935  __58:
 38936  	;
 38937  __56:
 38938  	;
 38939  	rc = sqlite3.Xsqlite3_open_v2(tls, zDestFile, bp+1024, /* &pDest */
 38940  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | (*SqliteDb)(unsafe.Pointer(pDb)).FopenFlags), uintptr(0))
 38941  	if !(rc != SQLITE_OK) {
 38942  		goto __59
 38943  	}
 38944  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+12199, /* "cannot open targ..." */
 38945  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 38946  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 38947  	return TCL_ERROR
 38948  __59:
 38949  	;
 38950  	pBackup = sqlite3.Xsqlite3_backup_init(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)), ts+85 /* "main" */, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSrcDb)
 38951  	if !(pBackup == uintptr(0)) {
 38952  		goto __60
 38953  	}
 38954  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+12229, /* "backup failed: " */
 38955  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 38956  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 38957  	return TCL_ERROR
 38958  __60:
 38959  	;
 38960  __61:
 38961  	if !((libc.AssignInt32(&rc, sqlite3.Xsqlite3_backup_step(tls, pBackup, 100))) == SQLITE_OK) {
 38962  		goto __62
 38963  	}
 38964  	goto __61
 38965  __62:
 38966  	;
 38967  	sqlite3.Xsqlite3_backup_finish(tls, pBackup)
 38968  	if !(rc == SQLITE_DONE) {
 38969  		goto __63
 38970  	}
 38971  	rc = TCL_OK
 38972  	goto __64
 38973  __63:
 38974  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, ts+12229, /* "backup failed: " */
 38975  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 38976  	rc = TCL_ERROR
 38977  __64:
 38978  	;
 38979  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 38980  	goto __3
 38981  
 38982  	// $db bind_fallback ?CALLBACK?
 38983  	//
 38984  	// When resolving bind parameters in an SQL statement, if the parameter
 38985  	// cannot be associated with a TCL variable then invoke CALLBACK with a
 38986  	// single argument that is the name of the parameter and use the return
 38987  	// value of the CALLBACK as the binding.  If CALLBACK returns something
 38988  	// other than TCL_OK or TCL_ERROR then bind a NULL.
 38989  	//
 38990  	// If CALLBACK is an empty string, then revert to the default behavior
 38991  	// which is to set the binding to NULL.
 38992  	//
 38993  	// If CALLBACK returns an error, that causes the statement execution to
 38994  	// abort.  Hence, to configure a connection so that it throws an error
 38995  	// on an attempt to bind an unknown variable, do something like this:
 38996  	//
 38997  	//     proc bind_error {name} {error "no such variable: $name"}
 38998  	//     db bind_fallback bind_error
 38999  __6:
 39000  	if !(objc > 3) {
 39001  		goto __65
 39002  	}
 39003  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 39004  	return TCL_ERROR
 39005  	goto __66
 39006  __65:
 39007  	if !(objc == 2) {
 39008  		goto __67
 39009  	}
 39010  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0) {
 39011  		goto __69
 39012  	}
 39013  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+88, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, uintptr(0)))
 39014  __69:
 39015  	;
 39016  	goto __68
 39017  __67:
 39018  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0) {
 39019  		goto __70
 39020  	}
 39021  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback)
 39022  __70:
 39023  	;
 39024  	zCallback = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1032 /* &len1 */)
 39025  	if !((zCallback != 0) && (*(*int32)(unsafe.Pointer(bp + 1032 /* len1 */)) > 0)) {
 39026  		goto __71
 39027  	}
 39028  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1032 /* len1 */)) + 1)))
 39029  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, zCallback, (uint64(*(*int32)(unsafe.Pointer(bp + 1032 /* len1 */)) + 1)))
 39030  	goto __72
 39031  __71:
 39032  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback = uintptr(0)
 39033  __72:
 39034  	;
 39035  __68:
 39036  	;
 39037  __66:
 39038  	;
 39039  	goto __3
 39040  
 39041  	// $db busy ?CALLBACK?
 39042  	//
 39043  	// Invoke the given callback if an SQL statement attempts to open
 39044  	// a locked database file.
 39045  __7:
 39046  	if !(objc > 3) {
 39047  		goto __73
 39048  	}
 39049  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12245 /* "CALLBACK" */)
 39050  	return TCL_ERROR
 39051  	goto __74
 39052  __73:
 39053  	if !(objc == 2) {
 39054  		goto __75
 39055  	}
 39056  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 39057  		goto __77
 39058  	}
 39059  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+104, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy, uintptr(0)))
 39060  __77:
 39061  	;
 39062  	goto __76
 39063  __75:
 39064  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 39065  		goto __78
 39066  	}
 39067  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy)
 39068  __78:
 39069  	;
 39070  	zBusy = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1036 /* &len2 */)
 39071  	if !((zBusy != 0) && (*(*int32)(unsafe.Pointer(bp + 1036 /* len2 */)) > 0)) {
 39072  		goto __79
 39073  	}
 39074  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBusy = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1036 /* len2 */)) + 1)))
 39075  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy, zBusy, (uint64(*(*int32)(unsafe.Pointer(bp + 1036 /* len2 */)) + 1)))
 39076  	goto __80
 39077  __79:
 39078  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBusy = uintptr(0)
 39079  __80:
 39080  	;
 39081  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 39082  		goto __81
 39083  	}
 39084  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 39085  	sqlite3.Xsqlite3_busy_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 39086  		f func(*libc.TLS, uintptr, int32) int32
 39087  	}{DbBusyHandler})), pDb)
 39088  	goto __82
 39089  __81:
 39090  	sqlite3.Xsqlite3_busy_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 39091  __82:
 39092  	;
 39093  __76:
 39094  	;
 39095  __74:
 39096  	;
 39097  	goto __3
 39098  
 39099  	// $db cache flush
 39100  	//     $db cache size n
 39101  	//
 39102  	// Flush the prepared statement cache, or set the maximum number of
 39103  	// cached statements.
 39104  __8:
 39105  
 39106  	if !(objc <= 2) {
 39107  		goto __83
 39108  	}
 39109  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+12254 /* "cache option ?ar..." */)
 39110  	return TCL_ERROR
 39111  __83:
 39112  	;
 39113  	subCmd = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0))
 39114  	if !((int32(*(*int8)(unsafe.Pointer(subCmd))) == 'f') && (libc.Xstrcmp(tls, subCmd, ts+12273 /* "flush" */) == 0)) {
 39115  		goto __84
 39116  	}
 39117  	if !(objc != 3) {
 39118  		goto __86
 39119  	}
 39120  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12273 /* "flush" */)
 39121  	return TCL_ERROR
 39122  	goto __87
 39123  __86:
 39124  	flushStmtCache(tls, pDb)
 39125  __87:
 39126  	;
 39127  	goto __85
 39128  __84:
 39129  	if !((int32(*(*int8)(unsafe.Pointer(subCmd))) == 's') && (libc.Xstrcmp(tls, subCmd, ts+12279 /* "size" */) == 0)) {
 39130  		goto __88
 39131  	}
 39132  	if !(objc != 4) {
 39133  		goto __90
 39134  	}
 39135  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12284 /* "size n" */)
 39136  	return TCL_ERROR
 39137  	goto __91
 39138  __90:
 39139  	if !(TCL_ERROR == tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1040 /* &n */)) {
 39140  		goto __92
 39141  	}
 39142  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+120, ts+12291, /* "cannot convert \"" */
 39143  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), uintptr(0)), ts+12308 /* "\" to integer" */, uintptr(0)))
 39144  	return TCL_ERROR
 39145  	goto __93
 39146  __92:
 39147  	if !(*(*int32)(unsafe.Pointer(bp + 1040 /* n */)) < 0) {
 39148  		goto __94
 39149  	}
 39150  	flushStmtCache(tls, pDb)
 39151  	*(*int32)(unsafe.Pointer(bp + 1040 /* n */)) = 0
 39152  	goto __95
 39153  __94:
 39154  	if !(*(*int32)(unsafe.Pointer(bp + 1040 /* n */)) > MAX_PREPARED_STMTS) {
 39155  		goto __96
 39156  	}
 39157  	*(*int32)(unsafe.Pointer(bp + 1040 /* n */)) = MAX_PREPARED_STMTS
 39158  __96:
 39159  	;
 39160  __95:
 39161  	;
 39162  	(*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt = *(*int32)(unsafe.Pointer(bp + 1040 /* n */))
 39163  __93:
 39164  	;
 39165  __91:
 39166  	;
 39167  	goto __89
 39168  __88:
 39169  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+152, ts+12321, /* "bad option \"" */
 39170  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0)), ts+12334, /* "\": must be flush..." */
 39171  		uintptr(0)))
 39172  	return TCL_ERROR
 39173  __89:
 39174  	;
 39175  __85:
 39176  	;
 39177  	goto __3
 39178  
 39179  	// $db changes
 39180  	//
 39181  	// Return the number of rows that were modified, inserted, or deleted by
 39182  	// the most recent INSERT, UPDATE or DELETE statement, not including
 39183  	// any changes made by trigger programs.
 39184  __9:
 39185  	if !(objc != 2) {
 39186  		goto __97
 39187  	}
 39188  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 39189  	return TCL_ERROR
 39190  __97:
 39191  	;
 39192  	pResult = tcl.XTcl_GetObjResult(tls, interp)
 39193  	tcl.XTcl_SetIntObj(tls, pResult, sqlite3.Xsqlite3_changes(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 39194  	goto __3
 39195  
 39196  	// $db close
 39197  	//
 39198  	// Shutdown the database
 39199  __10:
 39200  	tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)))
 39201  	goto __3
 39202  
 39203  	//     $db collate NAME SCRIPT
 39204  	//
 39205  	// Create a new SQL collation function called NAME.  Whenever
 39206  	// that function is called, invoke SCRIPT to evaluate the function.
 39207  __11:
 39208  	if !(objc != 4) {
 39209  		goto __98
 39210  	}
 39211  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12359 /* "NAME SCRIPT" */)
 39212  	return TCL_ERROR
 39213  __98:
 39214  	;
 39215  	zName = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0))
 39216  	zScript = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1044 /* &nScript */)
 39217  	pCollate = tcl.XTcl_Alloc(tls, (uint32((uint64(unsafe.Sizeof(SqlCollate{})) + uint64(*(*int32)(unsafe.Pointer(bp + 1044 /* nScript */)))) + uint64(1))))
 39218  	if !(pCollate == uintptr(0)) {
 39219  		goto __99
 39220  	}
 39221  	return TCL_ERROR
 39222  __99:
 39223  	;
 39224  	(*SqlCollate)(unsafe.Pointer(pCollate)).Finterp = interp
 39225  	(*SqlCollate)(unsafe.Pointer(pCollate)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate
 39226  	(*SqlCollate)(unsafe.Pointer(pCollate)).FzScript = (pCollate + 1*24)
 39227  	(*SqliteDb)(unsafe.Pointer(pDb)).FpCollate = pCollate
 39228  	libc.Xmemcpy(tls, (*SqlCollate)(unsafe.Pointer(pCollate)).FzScript, zScript, (uint64(*(*int32)(unsafe.Pointer(bp + 1044 /* nScript */)) + 1)))
 39229  	if !(sqlite3.Xsqlite3_create_collation(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zName, SQLITE_UTF8,
 39230  		pCollate, *(*uintptr)(unsafe.Pointer(&struct {
 39231  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 39232  		}{tclSqlCollate}))) != 0) {
 39233  		goto __100
 39234  	}
 39235  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 39236  	return TCL_ERROR
 39237  __100:
 39238  	;
 39239  	goto __3
 39240  
 39241  	//     $db collation_needed SCRIPT
 39242  	//
 39243  	// Create a new SQL collation function called NAME.  Whenever
 39244  	// that function is called, invoke SCRIPT to evaluate the function.
 39245  __12:
 39246  	if !(objc != 3) {
 39247  		goto __101
 39248  	}
 39249  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10650 /* "SCRIPT" */)
 39250  	return TCL_ERROR
 39251  __101:
 39252  	;
 39253  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded != 0) {
 39254  		goto __102
 39255  	}
 39256  __103:
 39257  	_objPtr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded
 39258  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1) {
 39259  		goto __106
 39260  	}
 39261  	tcl.XTclFreeObj(tls, _objPtr)
 39262  __106:
 39263  	;
 39264  	goto __104
 39265  __104:
 39266  	if 0 != 0 {
 39267  		goto __103
 39268  	}
 39269  	goto __105
 39270  __105:
 39271  	;
 39272  __102:
 39273  	;
 39274  	(*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 39275  	(*Tcl_Obj)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded)).FrefCount++
 39276  	sqlite3.Xsqlite3_collation_needed(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, pDb, *(*uintptr)(unsafe.Pointer(&struct {
 39277  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr)
 39278  	}{tclCollateNeeded})))
 39279  	goto __3
 39280  
 39281  	// $db commit_hook ?CALLBACK?
 39282  	//
 39283  	// Invoke the given callback just before committing every SQL transaction.
 39284  	// If the callback throws an exception or returns non-zero, then the
 39285  	// transaction is aborted.  If CALLBACK is an empty string, the callback
 39286  	// is disabled.
 39287  __13:
 39288  	if !(objc > 3) {
 39289  		goto __107
 39290  	}
 39291  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 39292  	return TCL_ERROR
 39293  	goto __108
 39294  __107:
 39295  	if !(objc == 2) {
 39296  		goto __109
 39297  	}
 39298  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 39299  		goto __111
 39300  	}
 39301  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+184, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit, uintptr(0)))
 39302  __111:
 39303  	;
 39304  	goto __110
 39305  __109:
 39306  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 39307  		goto __112
 39308  	}
 39309  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit)
 39310  __112:
 39311  	;
 39312  	zCommit = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1048 /* &len3 */)
 39313  	if !((zCommit != 0) && (*(*int32)(unsafe.Pointer(bp + 1048 /* len3 */)) > 0)) {
 39314  		goto __113
 39315  	}
 39316  	(*SqliteDb)(unsafe.Pointer(pDb)).FzCommit = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1048 /* len3 */)) + 1)))
 39317  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit, zCommit, (uint64(*(*int32)(unsafe.Pointer(bp + 1048 /* len3 */)) + 1)))
 39318  	goto __114
 39319  __113:
 39320  	(*SqliteDb)(unsafe.Pointer(pDb)).FzCommit = uintptr(0)
 39321  __114:
 39322  	;
 39323  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 39324  		goto __115
 39325  	}
 39326  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 39327  	sqlite3.Xsqlite3_commit_hook(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 39328  		f func(*libc.TLS, uintptr) int32
 39329  	}{DbCommitHandler})), pDb)
 39330  	goto __116
 39331  __115:
 39332  	sqlite3.Xsqlite3_commit_hook(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 39333  __116:
 39334  	;
 39335  __110:
 39336  	;
 39337  __108:
 39338  	;
 39339  	goto __3
 39340  
 39341  	// $db complete SQL
 39342  	//
 39343  	// Return TRUE if SQL is a complete SQL statement.  Return FALSE if
 39344  	// additional lines of input are needed.  This is similar to the
 39345  	// built-in "info complete" command of Tcl.
 39346  __14:
 39347  	if !(objc != 3) {
 39348  		goto __117
 39349  	}
 39350  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10170 /* "SQL" */)
 39351  	return TCL_ERROR
 39352  __117:
 39353  	;
 39354  	isComplete = sqlite3.Xsqlite3_complete(tls, tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0)))
 39355  	pResult1 = tcl.XTcl_GetObjResult(tls, interp)
 39356  	tcl.XTcl_SetIntObj(tls, pResult1, (libc.Bool32((isComplete) != 0)))
 39357  	goto __3
 39358  
 39359  	// $db config ?OPTION? ?BOOLEAN?
 39360  	//
 39361  	// Configure the database connection using the sqlite3_db_config()
 39362  	// interface.
 39363  __15:
 39364  	if !(objc > 4) {
 39365  		goto __118
 39366  	}
 39367  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12371 /* "?OPTION? ?BOOLEA..." */)
 39368  	return TCL_ERROR
 39369  __118:
 39370  	;
 39371  	if !(objc == 2) {
 39372  		goto __119
 39373  	}
 39374  	// With no arguments, list all configuration options and with the
 39375  	// current value
 39376  	pResult2 = tcl.XTcl_NewListObj(tls, 0, uintptr(0))
 39377  	ii = 0
 39378  __121:
 39379  	if !(uint64(ii) < (uint64(unsafe.Sizeof(aDbConfig)) / uint64(unsafe.Sizeof(DbConfigChoices{})))) {
 39380  		goto __123
 39381  	}
 39382  	*(*int32)(unsafe.Pointer(bp + 1052 /* v */)) = 0
 39383  	sqlite3.Xsqlite3_db_config(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, aDbConfig[ii].Fop, libc.VaList(bp+200, -1, bp+1052 /* &v */))
 39384  	tcl.XTcl_ListObjAppendElement(tls, interp, pResult2,
 39385  		tcl.XTcl_NewStringObj(tls, aDbConfig[ii].FzName, -1))
 39386  	tcl.XTcl_ListObjAppendElement(tls, interp, pResult2,
 39387  		tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 1052 /* v */))))
 39388  	goto __122
 39389  __122:
 39390  	ii++
 39391  	goto __121
 39392  	goto __123
 39393  __123:
 39394  	;
 39395  	goto __120
 39396  __119:
 39397  	zOpt = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 39398  	*(*int32)(unsafe.Pointer(bp + 1056 /* onoff */)) = -1
 39399  	*(*int32)(unsafe.Pointer(bp + 1060 /* v1 */)) = 0
 39400  	if !(int32(*(*int8)(unsafe.Pointer(zOpt))) == '-') {
 39401  		goto __124
 39402  	}
 39403  	zOpt++
 39404  __124:
 39405  	;
 39406  	ii = 0
 39407  __125:
 39408  	if !(uint64(ii) < (uint64(unsafe.Sizeof(aDbConfig)) / uint64(unsafe.Sizeof(DbConfigChoices{})))) {
 39409  		goto __127
 39410  	}
 39411  	if !(libc.Xstrcmp(tls, aDbConfig[ii].FzName, zOpt) == 0) {
 39412  		goto __128
 39413  	}
 39414  	goto __127
 39415  __128:
 39416  	;
 39417  	goto __126
 39418  __126:
 39419  	ii++
 39420  	goto __125
 39421  	goto __127
 39422  __127:
 39423  	;
 39424  	if !(uint64(ii) >= (uint64(unsafe.Sizeof(aDbConfig)) / uint64(unsafe.Sizeof(DbConfigChoices{})))) {
 39425  		goto __129
 39426  	}
 39427  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+216, ts+12390 /* "unknown config o..." */, zOpt,
 39428  		ts+12415 /* "\"" */, uintptr(0)))
 39429  	return TCL_ERROR
 39430  __129:
 39431  	;
 39432  	if !(objc == 4) {
 39433  		goto __130
 39434  	}
 39435  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1056 /* &onoff */) != 0) {
 39436  		goto __131
 39437  	}
 39438  	return TCL_ERROR
 39439  __131:
 39440  	;
 39441  __130:
 39442  	;
 39443  	sqlite3.Xsqlite3_db_config(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, aDbConfig[ii].Fop, libc.VaList(bp+248, *(*int32)(unsafe.Pointer(bp + 1056 /* onoff */)), bp+1060 /* &v1 */))
 39444  	pResult2 = tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 1060 /* v1 */)))
 39445  __120:
 39446  	;
 39447  	tcl.XTcl_SetObjResult(tls, interp, pResult2)
 39448  	goto __3
 39449  
 39450  	// $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
 39451  	//
 39452  	// Copy data into table from filename, optionally using SEPARATOR
 39453  	// as column separators.  If a column contains a null string, or the
 39454  	// value of NULLINDICATOR, a NULL is inserted for the column.
 39455  	// conflict-algorithm is one of the sqlite conflict algorithms:
 39456  	//    rollback, abort, fail, ignore, replace
 39457  	// On success, return the number of lines processed, not necessarily same
 39458  	// as 'db changes' due to conflict-algorithm selected.
 39459  	//
 39460  	// This code is basically an implementation/enhancement of
 39461  	// the sqlite3 shell.c ".import" command.
 39462  	//
 39463  	// This command usage is equivalent to the sqlite2.x COPY statement,
 39464  	// which imports file data into a table using the PostgreSQL COPY file format:
 39465  	//   $db copy $conflit_algo $table_name $filename \t \\N
 39466  __16: // The input file
 39467  	lineno = 0
 39468  	if !((objc < 5) || (objc > 7)) {
 39469  		goto __132
 39470  	}
 39471  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv,
 39472  		ts+12417 /* "CONFLICT-ALGORIT..." */)
 39473  	return TCL_ERROR
 39474  __132:
 39475  	;
 39476  	if !(objc >= 6) {
 39477  		goto __133
 39478  	}
 39479  	zSep = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 5*8)), uintptr(0))
 39480  	goto __134
 39481  __133:
 39482  	zSep = ts + 12479 /* "\t" */
 39483  __134:
 39484  	;
 39485  	if !(objc >= 7) {
 39486  		goto __135
 39487  	}
 39488  	zNull = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 6*8)), uintptr(0))
 39489  	goto __136
 39490  __135:
 39491  	zNull = ts + 489 /* "" */
 39492  __136:
 39493  	;
 39494  	zConflict = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0))
 39495  	zTable = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), uintptr(0))
 39496  	zFile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0))
 39497  	nSep = strlen30(tls, zSep)
 39498  	nNull = strlen30(tls, zNull)
 39499  	if !(nSep == 0) {
 39500  		goto __137
 39501  	}
 39502  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+264, ts+12481, /* "Error: non-null ..." */
 39503  		uintptr(0)))
 39504  	return TCL_ERROR
 39505  __137:
 39506  	;
 39507  	if !(((((libc.Xstrcmp(tls, zConflict, ts+12525 /* "rollback" */) != 0) && (libc.Xstrcmp(tls, zConflict, ts+12534 /* "abort" */) != 0)) && (libc.Xstrcmp(tls, zConflict, ts+12540 /* "fail" */) != 0)) && (libc.Xstrcmp(tls, zConflict, ts+12545 /* "ignore" */) != 0)) && (libc.Xstrcmp(tls, zConflict, ts+12552 /* "replace" */) != 0)) {
 39508  		goto __138
 39509  	}
 39510  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+280, ts+12560 /* "Error: \"" */, zConflict,
 39511  
 39512  		ts+12569 /* "\", conflict-algo..." */, uintptr(0)))
 39513  	return TCL_ERROR
 39514  __138:
 39515  	;
 39516  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+12649 /* "SELECT * FROM '%..." */, libc.VaList(bp+312, zTable))
 39517  	if !(zSql == uintptr(0)) {
 39518  		goto __139
 39519  	}
 39520  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+320, ts+12668 /* "Error: no such t..." */, zTable, uintptr(0)))
 39521  	return TCL_ERROR
 39522  __139:
 39523  	;
 39524  	nByte = strlen30(tls, zSql)
 39525  	rc = sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, bp+1064 /* &pStmt */, uintptr(0))
 39526  	sqlite3.Xsqlite3_free(tls, zSql)
 39527  	if !(rc != 0) {
 39528  		goto __140
 39529  	}
 39530  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+344, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 39531  	nCol = 0
 39532  	goto __141
 39533  __140:
 39534  	nCol = sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39535  __141:
 39536  	;
 39537  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39538  	if !(nCol == 0) {
 39539  		goto __142
 39540  	}
 39541  	return TCL_ERROR
 39542  __142:
 39543  	;
 39544  	zSql = libc.Xmalloc(tls, (uint64((nByte + 50) + (nCol * 2))))
 39545  	if !(zSql == uintptr(0)) {
 39546  		goto __143
 39547  	}
 39548  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+368, ts+12699 /* "Error: can't mal..." */, uintptr(0)))
 39549  	return TCL_ERROR
 39550  __143:
 39551  	;
 39552  	sqlite3.Xsqlite3_snprintf(tls, (nByte + 50), zSql, ts+12721, /* "INSERT OR %q INT..." */
 39553  		libc.VaList(bp+384, zConflict, zTable))
 39554  	j = strlen30(tls, zSql)
 39555  	i = 1
 39556  __144:
 39557  	if !(i < nCol) {
 39558  		goto __146
 39559  	}
 39560  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8(',')
 39561  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 39562  	goto __145
 39563  __145:
 39564  	i++
 39565  	goto __144
 39566  	goto __146
 39567  __146:
 39568  	;
 39569  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8(')')
 39570  	*(*int8)(unsafe.Pointer(zSql + uintptr(j))) = int8(0)
 39571  	rc = sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, bp+1064 /* &pStmt */, uintptr(0))
 39572  	libc.Xfree(tls, zSql)
 39573  	if !(rc != 0) {
 39574  		goto __147
 39575  	}
 39576  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+400, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 39577  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39578  	return TCL_ERROR
 39579  __147:
 39580  	;
 39581  	in = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 39582  	if !(in == uintptr(0)) {
 39583  		goto __148
 39584  	}
 39585  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+424, ts+12753 /* "Error: cannot op..." */, zFile, uintptr(0)))
 39586  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39587  	return TCL_ERROR
 39588  __148:
 39589  	;
 39590  	azCol = libc.Xmalloc(tls, (uint64(unsafe.Sizeof(uintptr(0))) * (uint64(nCol + 1))))
 39591  	if !(azCol == uintptr(0)) {
 39592  		goto __149
 39593  	}
 39594  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+448, ts+12699 /* "Error: can't mal..." */, uintptr(0)))
 39595  	libc.Xfclose(tls, in)
 39596  	return TCL_ERROR
 39597  __149:
 39598  	;
 39599  	sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, ts+12779 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0))
 39600  	zCommit1 = ts + 12098 /* "COMMIT" */
 39601  __150:
 39602  	if !((libc.AssignUintptr(&zLine, local_getline(tls, uintptr(0), in))) != uintptr(0)) {
 39603  		goto __151
 39604  	}
 39605  	lineno++
 39606  	*(*uintptr)(unsafe.Pointer(azCol)) = zLine
 39607  	i = 0
 39608  	z = zLine
 39609  __152:
 39610  	if !(*(*int8)(unsafe.Pointer(z)) != 0) {
 39611  		goto __154
 39612  	}
 39613  	if !((int32(*(*int8)(unsafe.Pointer(z))) == int32(*(*int8)(unsafe.Pointer(zSep)))) && (libc.Xstrncmp(tls, z, zSep, uint64(nSep)) == 0)) {
 39614  		goto __155
 39615  	}
 39616  	*(*int8)(unsafe.Pointer(z)) = int8(0)
 39617  	i++
 39618  	if !(i < nCol) {
 39619  		goto __156
 39620  	}
 39621  	*(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)) = (z + uintptr(nSep))
 39622  	z += (uintptr(nSep - 1))
 39623  __156:
 39624  	;
 39625  __155:
 39626  	;
 39627  	goto __153
 39628  __153:
 39629  	z++
 39630  	goto __152
 39631  	goto __154
 39632  __154:
 39633  	;
 39634  	if !((i + 1) != nCol) {
 39635  		goto __157
 39636  	}
 39637  	nErr = (strlen30(tls, zFile) + 200)
 39638  	zErr = libc.Xmalloc(tls, uint64(nErr))
 39639  	if !(zErr != 0) {
 39640  		goto __158
 39641  	}
 39642  	sqlite3.Xsqlite3_snprintf(tls, nErr, zErr,
 39643  		ts+12785, /* "Error: %s line %..." */
 39644  		libc.VaList(bp+464, zFile, lineno, nCol, (i+1)))
 39645  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+496, zErr, uintptr(0)))
 39646  	libc.Xfree(tls, zErr)
 39647  __158:
 39648  	;
 39649  	zCommit1 = ts + 7270 /* "ROLLBACK" */
 39650  	goto __151
 39651  __157:
 39652  	;
 39653  	i = 0
 39654  __159:
 39655  	if !(i < nCol) {
 39656  		goto __161
 39657  	}
 39658  	// check for null data, if so, bind as null
 39659  	if !(((nNull > 0) && (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), zNull) == 0)) ||
 39660  		(strlen30(tls, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8))) == 0)) {
 39661  		goto __162
 39662  	}
 39663  	sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)), (i + 1))
 39664  	goto __163
 39665  __162:
 39666  	sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)), (i + 1), *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*8)), -1, uintptr(0))
 39667  __163:
 39668  	;
 39669  	goto __160
 39670  __160:
 39671  	i++
 39672  	goto __159
 39673  	goto __161
 39674  __161:
 39675  	;
 39676  	sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39677  	rc = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39678  	libc.Xfree(tls, zLine)
 39679  	if !(rc != SQLITE_OK) {
 39680  		goto __164
 39681  	}
 39682  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+512, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 39683  	zCommit1 = ts + 7270 /* "ROLLBACK" */
 39684  	goto __151
 39685  __164:
 39686  	;
 39687  	goto __150
 39688  __151:
 39689  	;
 39690  	libc.Xfree(tls, azCol)
 39691  	libc.Xfclose(tls, in)
 39692  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1064 /* pStmt */)))
 39693  	sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zCommit1, uintptr(0), uintptr(0), uintptr(0))
 39694  
 39695  	if !(int32(*(*int8)(unsafe.Pointer(zCommit1))) == 'C') {
 39696  		goto __165
 39697  	}
 39698  	// success, set result as number of lines processed
 39699  	pResult3 = tcl.XTcl_GetObjResult(tls, interp)
 39700  	tcl.XTcl_SetIntObj(tls, pResult3, lineno)
 39701  	rc = TCL_OK
 39702  	goto __166
 39703  __165:
 39704  	// failure, append lineno where failed
 39705  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([80]int8{})), bp+1072 /* &zLineNum[0] */, ts+1238 /* "%d" */, libc.VaList(bp+536, lineno))
 39706  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+544, ts+12845 /* ", failed while p..." */, bp+1072, /* &zLineNum[0] */
 39707  		uintptr(0)))
 39708  	rc = TCL_ERROR
 39709  __166:
 39710  	;
 39711  	goto __3
 39712  
 39713  	//     $db deserialize ?-maxsize N? ?-readonly BOOL? ?DATABASE? VALUE
 39714  	//
 39715  	// Reopen DATABASE (default "main") using the content in $VALUE
 39716  __17:
 39717  	zSchema = uintptr(0)
 39718  	pValue = uintptr(0)
 39719  	*(*sqlite3_int64)(unsafe.Pointer(bp + 1152 /* mxSize */)) = int64(0)
 39720  	*(*int32)(unsafe.Pointer(bp + 1160 /* isReadonly */)) = 0
 39721  
 39722  	if !(objc < 3) {
 39723  		goto __167
 39724  	}
 39725  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12878 /* "?DATABASE? VALUE" */)
 39726  	rc = TCL_ERROR
 39727  	goto __3
 39728  __167:
 39729  	;
 39730  	i1 = 2
 39731  __168:
 39732  	if !(i1 < (objc - 1)) {
 39733  		goto __170
 39734  	}
 39735  	z1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i1)*8)))
 39736  	if !((libc.Xstrcmp(tls, z1, ts+12895 /* "-maxsize" */) == 0) && (i1 < (objc - 2))) {
 39737  		goto __171
 39738  	}
 39739  	rc = tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(libc.PreIncInt32(&i1, 1))*8)), bp+1152 /* &mxSize */)
 39740  	if !(rc != 0) {
 39741  		goto __172
 39742  	}
 39743  	goto deserialize_error
 39744  __172:
 39745  	;
 39746  	goto __169
 39747  __171:
 39748  	;
 39749  	if !((libc.Xstrcmp(tls, z1, ts+12904 /* "-readonly" */) == 0) && (i1 < (objc - 2))) {
 39750  		goto __173
 39751  	}
 39752  	rc = tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(libc.PreIncInt32(&i1, 1))*8)), bp+1160 /* &isReadonly */)
 39753  	if !(rc != 0) {
 39754  		goto __174
 39755  	}
 39756  	goto deserialize_error
 39757  __174:
 39758  	;
 39759  	goto __169
 39760  __173:
 39761  	;
 39762  	if !(((zSchema == uintptr(0)) && (i1 == (objc - 2))) && (int32(*(*int8)(unsafe.Pointer(z1))) != '-')) {
 39763  		goto __175
 39764  	}
 39765  	zSchema = z1
 39766  	goto __169
 39767  __175:
 39768  	;
 39769  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+568, ts+12914 /* "unknown option: " */, z1, uintptr(0)))
 39770  	rc = TCL_ERROR
 39771  	goto deserialize_error
 39772  	goto __169
 39773  __169:
 39774  	i1++
 39775  	goto __168
 39776  	goto __170
 39777  __170:
 39778  	;
 39779  	pValue = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8))
 39780  	pBA = tcl.XTcl_GetByteArrayFromObj(tls, pValue, bp+1164 /* &len4 */)
 39781  	pData = sqlite3.Xsqlite3_malloc64(tls, uint64(*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */))))
 39782  	if !((pData == uintptr(0)) && (*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */)) > 0)) {
 39783  		goto __176
 39784  	}
 39785  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+592, ts+1930 /* "out of memory" */, uintptr(0)))
 39786  	rc = TCL_ERROR
 39787  	goto __177
 39788  __176:
 39789  	if !(*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */)) > 0) {
 39790  		goto __178
 39791  	}
 39792  	libc.Xmemcpy(tls, pData, pBA, uint64(*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */))))
 39793  __178:
 39794  	;
 39795  	if !(*(*int32)(unsafe.Pointer(bp + 1160 /* isReadonly */)) != 0) {
 39796  		goto __179
 39797  	}
 39798  	flags = (SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_READONLY)
 39799  	goto __180
 39800  __179:
 39801  	flags = (SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_RESIZEABLE)
 39802  __180:
 39803  	;
 39804  	xrc = sqlite3.Xsqlite3_deserialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema, pData, int64(*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */))), int64(*(*int32)(unsafe.Pointer(bp + 1164 /* len4 */))), uint32(flags))
 39805  	if !(xrc != 0) {
 39806  		goto __181
 39807  	}
 39808  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+608, ts+12931 /* "unable to set ME..." */, uintptr(0)))
 39809  	rc = TCL_ERROR
 39810  __181:
 39811  	;
 39812  	if !(*(*sqlite3_int64)(unsafe.Pointer(bp + 1152 /* mxSize */)) > int64(0)) {
 39813  		goto __182
 39814  	}
 39815  	sqlite3.Xsqlite3_file_control(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema, SQLITE_FCNTL_SIZE_LIMIT, bp+1152 /* &mxSize */)
 39816  __182:
 39817  	;
 39818  __177:
 39819  	;
 39820  deserialize_error:
 39821  	goto __3
 39822  
 39823  	//    $db enable_load_extension BOOLEAN
 39824  	//
 39825  	// Turn the extension loading feature on or off.  It if off by
 39826  	// default.
 39827  __18:
 39828  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+624, ts+12959, /* "extension loadin..." */
 39829  		uintptr(0)))
 39830  	return TCL_ERROR
 39831  
 39832  	//    $db errorcode
 39833  	//
 39834  	// Return the numeric error code that was returned by the most recent
 39835  	// call to sqlite3_exec().
 39836  __19:
 39837  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)))
 39838  	goto __3
 39839  
 39840  	//    $db exists $sql
 39841  	//    $db onecolumn $sql
 39842  	//
 39843  	// The onecolumn method is the equivalent of:
 39844  	//     lindex [$db eval $sql] 0
 39845  __20:
 39846  __21:
 39847  	pResult4 = uintptr(0)
 39848  	if !(objc != 3) {
 39849  		goto __183
 39850  	}
 39851  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10170 /* "SQL" */)
 39852  	return TCL_ERROR
 39853  __183:
 39854  	;
 39855  
 39856  	dbEvalInit(tls, bp+1168 /* &sEval */, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0), 0)
 39857  	rc = dbEvalStep(tls, bp+1168 /* &sEval */)
 39858  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 23 /* DB_ONECOLUMN */) {
 39859  		goto __184
 39860  	}
 39861  	if !(rc == TCL_OK) {
 39862  		goto __186
 39863  	}
 39864  	pResult4 = dbEvalColumnValue(tls, bp+1168 /* &sEval */, 0)
 39865  	goto __187
 39866  __186:
 39867  	if !(rc == TCL_BREAK) {
 39868  		goto __188
 39869  	}
 39870  	tcl.XTcl_ResetResult(tls, interp)
 39871  __188:
 39872  	;
 39873  __187:
 39874  	;
 39875  	goto __185
 39876  __184:
 39877  	if !((rc == TCL_BREAK) || (rc == TCL_OK)) {
 39878  		goto __189
 39879  	}
 39880  	pResult4 = tcl.XTcl_NewIntObj(tls, (libc.Bool32((libc.Bool32(rc == TCL_OK)) != 0)))
 39881  __189:
 39882  	;
 39883  __185:
 39884  	;
 39885  	dbEvalFinalize(tls, bp+1168 /* &sEval */)
 39886  	if !(pResult4 != 0) {
 39887  		goto __190
 39888  	}
 39889  	tcl.XTcl_SetObjResult(tls, interp, pResult4)
 39890  __190:
 39891  	;
 39892  
 39893  	if !(rc == TCL_BREAK) {
 39894  		goto __191
 39895  	}
 39896  	rc = TCL_OK
 39897  __191:
 39898  	;
 39899  	goto __3
 39900  
 39901  	//    $db eval ?options? $sql ?array? ?{  ...code... }?
 39902  	//
 39903  	// The SQL statement in $sql is evaluated.  For each row, the values are
 39904  	// placed in elements of the array named "array" and ...code... is executed.
 39905  	// If "array" and "code" are omitted, then no callback is every invoked.
 39906  	// If "array" is an empty string, then the values are placed in variables
 39907  	// that have the same name as the fields extracted by the query.
 39908  __22:
 39909  	evalFlags = 0
 39910  __192:
 39911  	if !(((objc > 3) && ((libc.AssignUintptr(&zOpt1, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))))) != uintptr(0))) && (int32(*(*int8)(unsafe.Pointer(zOpt1))) == '-')) {
 39912  		goto __193
 39913  	}
 39914  	if !(libc.Xstrcmp(tls, zOpt1, ts+13007 /* "-withoutnulls" */) == 0) {
 39915  		goto __194
 39916  	}
 39917  	evalFlags = evalFlags | (SQLITE_EVAL_WITHOUTNULLS)
 39918  	goto __195
 39919  __194:
 39920  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+640, ts+13021 /* "unknown option: ..." */, zOpt1, ts+12415 /* "\"" */, uintptr(0)))
 39921  	return TCL_ERROR
 39922  __195:
 39923  	;
 39924  	objc--
 39925  	objv += 8
 39926  	goto __192
 39927  __193:
 39928  	;
 39929  	if !((objc < 3) || (objc > 5)) {
 39930  		goto __196
 39931  	}
 39932  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv,
 39933  		ts+13039 /* "?OPTIONS? SQL ?A..." */)
 39934  	return TCL_ERROR
 39935  __196:
 39936  	;
 39937  
 39938  	if !(objc == 3) {
 39939  		goto __197
 39940  	}
 39941  	pRet = tcl.XTcl_NewObj(tls)
 39942  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 39943  	dbEvalInit(tls, bp+1224 /* &sEval1 */, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0), 0)
 39944  __199:
 39945  	if !(TCL_OK == (libc.AssignInt32(&rc, dbEvalStep(tls, bp+1224 /* &sEval1 */)))) {
 39946  		goto __200
 39947  	}
 39948  	dbEvalRowInfo(tls, bp+1224 /* &sEval1 */, bp+1280 /* &nCol1 */, uintptr(0))
 39949  	i2 = 0
 39950  __201:
 39951  	if !(i2 < *(*int32)(unsafe.Pointer(bp + 1280 /* nCol1 */))) {
 39952  		goto __203
 39953  	}
 39954  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, dbEvalColumnValue(tls, bp+1224 /* &sEval1 */, i2))
 39955  	goto __202
 39956  __202:
 39957  	i2++
 39958  	goto __201
 39959  	goto __203
 39960  __203:
 39961  	;
 39962  	goto __199
 39963  __200:
 39964  	;
 39965  	dbEvalFinalize(tls, bp+1224 /* &sEval1 */)
 39966  	if !(rc == TCL_BREAK) {
 39967  		goto __204
 39968  	}
 39969  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 39970  	rc = TCL_OK
 39971  __204:
 39972  	;
 39973  __205:
 39974  	_objPtr1 = pRet
 39975  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr1))).FrefCount, 1) <= 1) {
 39976  		goto __208
 39977  	}
 39978  	tcl.XTclFreeObj(tls, _objPtr1)
 39979  __208:
 39980  	;
 39981  	goto __206
 39982  __206:
 39983  	if 0 != 0 {
 39984  		goto __205
 39985  	}
 39986  	goto __207
 39987  __207:
 39988  	;
 39989  	goto __198
 39990  __197:
 39991  	pArray = uintptr(0)
 39992  
 39993  	if !((objc >= 5) && (*(*int8)(unsafe.Pointer(tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8))))) != 0)) {
 39994  		goto __209
 39995  	}
 39996  	pArray = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 39997  __209:
 39998  	;
 39999  	pScript = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8))
 40000  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 40001  
 40002  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(DbEvalContext{})))
 40003  	dbEvalInit(tls, p, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*8)), pArray, evalFlags)
 40004  
 40005  	*(*ClientData)(unsafe.Pointer(bp + 1288 /* &cd2[0] */)) = p
 40006  	*(*ClientData)(unsafe.Pointer(bp + 1288 /* &cd2[0] */ + 1*8)) = pScript
 40007  	rc = DbEvalNextCmd(tls, bp+1288 /* &cd2[0] */, interp, TCL_OK)
 40008  __198:
 40009  	;
 40010  	goto __3
 40011  
 40012  	//     $db function NAME [OPTIONS] SCRIPT
 40013  	//
 40014  	// Create a new SQL function called NAME.  Whenever that function is
 40015  	// called, invoke SCRIPT to evaluate the function.
 40016  	//
 40017  	// Options:
 40018  	//         --argcount N           Function has exactly N arguments
 40019  	//         --deterministic        The function is pure
 40020  	//         --directonly           Prohibit use inside triggers and views
 40021  	//         --innocuous            Has no side effects or information leaks
 40022  	//         --returntype TYPE      Specify the return type of the function
 40023  __23:
 40024  	flags1 = SQLITE_UTF8
 40025  	*(*int32)(unsafe.Pointer(bp + 1304 /* nArg */)) = -1
 40026  	*(*int32)(unsafe.Pointer(bp + 1360 /* eType */)) = SQLITE_NULL
 40027  	if !(objc < 4) {
 40028  		goto __210
 40029  	}
 40030  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13075 /* "NAME ?SWITCHES? ..." */)
 40031  	return TCL_ERROR
 40032  __210:
 40033  	;
 40034  	i3 = 3
 40035  __211:
 40036  	if !(i3 < (objc - 1)) {
 40037  		goto __213
 40038  	}
 40039  	z2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i3)*8)))
 40040  	n1 = strlen30(tls, z2)
 40041  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13098 /* "-argcount" */, uint64(n1)) == 0)) {
 40042  		goto __214
 40043  	}
 40044  	if !(i3 == (objc - 2)) {
 40045  		goto __216
 40046  	}
 40047  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+672, ts+13108 /* "option requires ..." */, z2, uintptr(0)))
 40048  	return TCL_ERROR
 40049  __216:
 40050  	;
 40051  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i3+1))*8)), bp+1304 /* &nArg */) != 0) {
 40052  		goto __217
 40053  	}
 40054  	return TCL_ERROR
 40055  __217:
 40056  	;
 40057  	if !(*(*int32)(unsafe.Pointer(bp + 1304 /* nArg */)) < 0) {
 40058  		goto __218
 40059  	}
 40060  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+696, ts+13138, /* "number of argume..." */
 40061  		uintptr(0)))
 40062  	return TCL_ERROR
 40063  __218:
 40064  	;
 40065  	i3++
 40066  	goto __215
 40067  __214:
 40068  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13179 /* "-deterministic" */, uint64(n1)) == 0)) {
 40069  		goto __219
 40070  	}
 40071  	flags1 = flags1 | (SQLITE_DETERMINISTIC)
 40072  	goto __220
 40073  __219:
 40074  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13194 /* "-directonly" */, uint64(n1)) == 0)) {
 40075  		goto __221
 40076  	}
 40077  	flags1 = flags1 | (SQLITE_DIRECTONLY)
 40078  	goto __222
 40079  __221:
 40080  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13206 /* "-innocuous" */, uint64(n1)) == 0)) {
 40081  		goto __223
 40082  	}
 40083  	flags1 = flags1 | (SQLITE_INNOCUOUS)
 40084  	goto __224
 40085  __223:
 40086  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13217 /* "-returntype" */, uint64(n1)) == 0)) {
 40087  		goto __225
 40088  	}
 40089  	*(*[6]uintptr)(unsafe.Pointer(bp + 1312 /* azType */)) = [6]uintptr{ts + 7916 /* "integer" */, ts + 13229 /* "real" */, ts + 13234 /* "text" */, ts + 13239 /* "blob" */, ts + 13244 /* "any" */, uintptr(0)}
 40090  
 40091  	if !(i3 == (objc - 2)) {
 40092  		goto __227
 40093  	}
 40094  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+712, ts+13108 /* "option requires ..." */, z2, uintptr(0)))
 40095  	return TCL_ERROR
 40096  __227:
 40097  	;
 40098  	i3++
 40099  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i3)*8)), bp+1312 /* &azType[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+13248 /* "type" */, 0, bp+1360 /* &eType */) != 0) {
 40100  		goto __228
 40101  	}
 40102  	return TCL_ERROR
 40103  __228:
 40104  	;
 40105  	*(*int32)(unsafe.Pointer(bp + 1360 /* eType */))++
 40106  	goto __226
 40107  __225:
 40108  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+736, ts+12321 /* "bad option \"" */, z2,
 40109  
 40110  		ts+13253 /* "\": must be -argc..." */, uintptr(0)))
 40111  	return TCL_ERROR
 40112  __226:
 40113  	;
 40114  __224:
 40115  	;
 40116  __222:
 40117  	;
 40118  __220:
 40119  	;
 40120  __215:
 40121  	;
 40122  	goto __212
 40123  __212:
 40124  	i3++
 40125  	goto __211
 40126  	goto __213
 40127  __213:
 40128  	;
 40129  
 40130  	pScript1 = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8))
 40131  	zName1 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0))
 40132  	pFunc = findSqlFunc(tls, pDb, zName1)
 40133  	if !(pFunc == uintptr(0)) {
 40134  		goto __229
 40135  	}
 40136  	return TCL_ERROR
 40137  __229:
 40138  	;
 40139  	if !((*SqlFunc)(unsafe.Pointer(pFunc)).FpScript != 0) {
 40140  		goto __230
 40141  	}
 40142  __231:
 40143  	_objPtr2 = (*SqlFunc)(unsafe.Pointer(pFunc)).FpScript
 40144  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr2))).FrefCount, 1) <= 1) {
 40145  		goto __234
 40146  	}
 40147  	tcl.XTclFreeObj(tls, _objPtr2)
 40148  __234:
 40149  	;
 40150  	goto __232
 40151  __232:
 40152  	if 0 != 0 {
 40153  		goto __231
 40154  	}
 40155  	goto __233
 40156  __233:
 40157  	;
 40158  __230:
 40159  	;
 40160  	(*SqlFunc)(unsafe.Pointer(pFunc)).FpScript = pScript1
 40161  	(*Tcl_Obj)(unsafe.Pointer(pScript1)).FrefCount++
 40162  	(*SqlFunc)(unsafe.Pointer(pFunc)).FuseEvalObjv = safeToUseEvalObjv(tls, interp, pScript1)
 40163  	(*SqlFunc)(unsafe.Pointer(pFunc)).FeType = *(*int32)(unsafe.Pointer(bp + 1360 /* eType */))
 40164  	rc = sqlite3.Xsqlite3_create_function(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zName1, *(*int32)(unsafe.Pointer(bp + 1304 /* nArg */)), flags1,
 40165  		pFunc, *(*uintptr)(unsafe.Pointer(&struct {
 40166  			f func(*libc.TLS, uintptr, int32, uintptr)
 40167  		}{tclSqlFunc})), uintptr(0), uintptr(0))
 40168  	if !(rc != SQLITE_OK) {
 40169  		goto __235
 40170  	}
 40171  	rc = TCL_ERROR
 40172  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 40173  __235:
 40174  	;
 40175  	goto __3
 40176  
 40177  	//     $db incrblob ?-readonly? ?DB? TABLE COLUMN ROWID
 40178  __24:
 40179  	isReadonly1 = 0
 40180  	zDb = ts + 85 /* "main" */
 40181  
 40182  	// Check for the -readonly option
 40183  	if !((objc > 3) && (libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), ts+12904 /* "-readonly" */) == 0)) {
 40184  		goto __236
 40185  	}
 40186  	isReadonly1 = 1
 40187  __236:
 40188  	;
 40189  
 40190  	if !((objc != (5 + isReadonly1)) && (objc != (6 + isReadonly1))) {
 40191  		goto __237
 40192  	}
 40193  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13331 /* "?-readonly? ?DB?..." */)
 40194  	return TCL_ERROR
 40195  __237:
 40196  	;
 40197  
 40198  	if !(objc == (6 + isReadonly1)) {
 40199  		goto __238
 40200  	}
 40201  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 40202  __238:
 40203  	;
 40204  	zTable1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*8)))
 40205  	zColumn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8)))
 40206  	rc = tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8)), bp+1368 /* &iRow */)
 40207  
 40208  	if !(rc == TCL_OK) {
 40209  		goto __239
 40210  	}
 40211  	rc = createIncrblobChannel(tls,
 40212  		interp, pDb, zDb, zTable1, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 1368 /* iRow */)), isReadonly1)
 40213  __239:
 40214  	;
 40215  	goto __3
 40216  
 40217  	//     $db interrupt
 40218  	//
 40219  	// Interrupt the execution of the inner-most SQL interpreter.  This
 40220  	// causes the SQL statement to return an error of SQLITE_INTERRUPT.
 40221  __25:
 40222  	sqlite3.Xsqlite3_interrupt(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 40223  	goto __3
 40224  
 40225  	//     $db nullvalue ?STRING?
 40226  	//
 40227  	// Change text used when a NULL comes back from the database. If ?STRING?
 40228  	// is not present, then the current string used for NULL is returned.
 40229  	// If STRING is present, then STRING is returned.
 40230  	//
 40231  __26:
 40232  	if !((objc != 2) && (objc != 3)) {
 40233  		goto __240
 40234  	}
 40235  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13367 /* "NULLVALUE" */)
 40236  	return TCL_ERROR
 40237  __240:
 40238  	;
 40239  	if !(objc == 3) {
 40240  		goto __241
 40241  	}
 40242  	zNull1 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1376 /* &len5 */)
 40243  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzNull != 0) {
 40244  		goto __242
 40245  	}
 40246  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull)
 40247  __242:
 40248  	;
 40249  	if !((zNull1 != 0) && (*(*int32)(unsafe.Pointer(bp + 1376 /* len5 */)) > 0)) {
 40250  		goto __243
 40251  	}
 40252  	(*SqliteDb)(unsafe.Pointer(pDb)).FzNull = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1376 /* len5 */)) + 1)))
 40253  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull, zNull1, uint64(*(*int32)(unsafe.Pointer(bp + 1376 /* len5 */))))
 40254  	*(*int8)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FzNull + uintptr(*(*int32)(unsafe.Pointer(bp + 1376 /* len5 */))))) = int8(0)
 40255  	goto __244
 40256  __243:
 40257  	(*SqliteDb)(unsafe.Pointer(pDb)).FzNull = uintptr(0)
 40258  __244:
 40259  	;
 40260  __241:
 40261  	;
 40262  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull, -1))
 40263  	goto __3
 40264  
 40265  	//     $db last_insert_rowid
 40266  	//
 40267  	// Return an integer which is the ROWID for the most recent insert.
 40268  __27:
 40269  	if !(objc != 2) {
 40270  		goto __245
 40271  	}
 40272  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 40273  	return TCL_ERROR
 40274  __245:
 40275  	;
 40276  	rowid = sqlite3.Xsqlite3_last_insert_rowid(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 40277  	pResult5 = tcl.XTcl_GetObjResult(tls, interp)
 40278  	tcl.XTcl_SetWideIntObj(tls, pResult5, rowid)
 40279  	goto __3
 40280  
 40281  	// The DB_ONECOLUMN method is implemented together with DB_EXISTS.
 40282  
 40283  	// $db progress ?N CALLBACK?
 40284  	//
 40285  	// Invoke the given callback every N virtual machine opcodes while executing
 40286  	// queries.
 40287  __28:
 40288  	if !(objc == 2) {
 40289  		goto __246
 40290  	}
 40291  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 40292  		goto __248
 40293  	}
 40294  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+768, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress, uintptr(0)))
 40295  __248:
 40296  	;
 40297  	goto __247
 40298  __246:
 40299  	if !(objc == 4) {
 40300  		goto __249
 40301  	}
 40302  	if !(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1380 /* &N */)) {
 40303  		goto __251
 40304  	}
 40305  	return TCL_ERROR
 40306  __251:
 40307  	;
 40308  
 40309  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 40310  		goto __252
 40311  	}
 40312  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress)
 40313  __252:
 40314  	;
 40315  	zProgress = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1384 /* &len6 */)
 40316  	if !((zProgress != 0) && (*(*int32)(unsafe.Pointer(bp + 1384 /* len6 */)) > 0)) {
 40317  		goto __253
 40318  	}
 40319  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProgress = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1384 /* len6 */)) + 1)))
 40320  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress, zProgress, (uint64(*(*int32)(unsafe.Pointer(bp + 1384 /* len6 */)) + 1)))
 40321  	goto __254
 40322  __253:
 40323  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProgress = uintptr(0)
 40324  __254:
 40325  	;
 40326  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 40327  		goto __255
 40328  	}
 40329  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40330  	sqlite3.Xsqlite3_progress_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1380 /* N */)), *(*uintptr)(unsafe.Pointer(&struct {
 40331  		f func(*libc.TLS, uintptr) int32
 40332  	}{DbProgressHandler})), pDb)
 40333  	goto __256
 40334  __255:
 40335  	sqlite3.Xsqlite3_progress_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, 0, uintptr(0), uintptr(0))
 40336  __256:
 40337  	;
 40338  	goto __250
 40339  __249:
 40340  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13377 /* "N CALLBACK" */)
 40341  	return TCL_ERROR
 40342  __250:
 40343  	;
 40344  __247:
 40345  	;
 40346  	goto __3
 40347  
 40348  	// $db profile ?CALLBACK?
 40349  	//
 40350  	// Make arrangements to invoke the CALLBACK routine after each SQL statement
 40351  	// that has run.  The text of the SQL and the amount of elapse time are
 40352  	// appended to CALLBACK before the script is run.
 40353  __29:
 40354  	if !(objc > 3) {
 40355  		goto __257
 40356  	}
 40357  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 40358  	return TCL_ERROR
 40359  	goto __258
 40360  __257:
 40361  	if !(objc == 2) {
 40362  		goto __259
 40363  	}
 40364  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 40365  		goto __261
 40366  	}
 40367  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+784, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, uintptr(0)))
 40368  __261:
 40369  	;
 40370  	goto __260
 40371  __259:
 40372  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 40373  		goto __262
 40374  	}
 40375  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile)
 40376  __262:
 40377  	;
 40378  	zProfile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1388 /* &len7 */)
 40379  	if !((zProfile != 0) && (*(*int32)(unsafe.Pointer(bp + 1388 /* len7 */)) > 0)) {
 40380  		goto __263
 40381  	}
 40382  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProfile = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1388 /* len7 */)) + 1)))
 40383  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, zProfile, (uint64(*(*int32)(unsafe.Pointer(bp + 1388 /* len7 */)) + 1)))
 40384  	goto __264
 40385  __263:
 40386  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProfile = uintptr(0)
 40387  __264:
 40388  	;
 40389  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 40390  		goto __265
 40391  	}
 40392  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40393  	sqlite3.Xsqlite3_profile(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 40394  		f func(*libc.TLS, uintptr, uintptr, sqlite_uint64)
 40395  	}{DbProfileHandler})), pDb)
 40396  	goto __266
 40397  __265:
 40398  	sqlite3.Xsqlite3_profile(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 40399  __266:
 40400  	;
 40401  __260:
 40402  	;
 40403  __258:
 40404  	;
 40405  	goto __3
 40406  
 40407  	//     $db rekey KEY
 40408  	//
 40409  	// Change the encryption key on the currently open database.
 40410  __30:
 40411  	if !(objc != 3) {
 40412  		goto __267
 40413  	}
 40414  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13388 /* "KEY" */)
 40415  	return TCL_ERROR
 40416  __267:
 40417  	;
 40418  	goto __3
 40419  
 40420  	// $db restore ?DATABASE? FILENAME
 40421  	//
 40422  	// Open a database file named FILENAME.  Transfer the content
 40423  	// of FILENAME into the local database DATABASE (default: "main").
 40424  __31:
 40425  	nTimeout = 0
 40426  
 40427  	if !(objc == 3) {
 40428  		goto __268
 40429  	}
 40430  	zDestDb = ts + 85 /* "main" */
 40431  	zSrcFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 40432  	goto __269
 40433  __268:
 40434  	if !(objc == 4) {
 40435  		goto __270
 40436  	}
 40437  	zDestDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 40438  	zSrcFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 40439  	goto __271
 40440  __270:
 40441  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12179 /* "?DATABASE? FILEN..." */)
 40442  	return TCL_ERROR
 40443  __271:
 40444  	;
 40445  __269:
 40446  	;
 40447  	rc = sqlite3.Xsqlite3_open_v2(tls, zSrcFile, bp+1392, /* &pSrc */
 40448  		(SQLITE_OPEN_READONLY | (*SqliteDb)(unsafe.Pointer(pDb)).FopenFlags), uintptr(0))
 40449  	if !(rc != SQLITE_OK) {
 40450  		goto __272
 40451  	}
 40452  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+800, ts+13392, /* "cannot open sour..." */
 40453  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1392 /* pSrc */))), uintptr(0)))
 40454  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1392 /* pSrc */)))
 40455  	return TCL_ERROR
 40456  __272:
 40457  	;
 40458  	pBackup1 = sqlite3.Xsqlite3_backup_init(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zDestDb, *(*uintptr)(unsafe.Pointer(bp + 1392 /* pSrc */)), ts+85 /* "main" */)
 40459  	if !(pBackup1 == uintptr(0)) {
 40460  		goto __273
 40461  	}
 40462  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+824, ts+13422, /* "restore failed: " */
 40463  		sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 40464  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1392 /* pSrc */)))
 40465  	return TCL_ERROR
 40466  __273:
 40467  	;
 40468  __274:
 40469  	if !(((libc.AssignInt32(&rc, sqlite3.Xsqlite3_backup_step(tls, pBackup1, 100))) == SQLITE_OK) ||
 40470  		(rc == SQLITE_BUSY)) {
 40471  		goto __275
 40472  	}
 40473  	if !(rc == SQLITE_BUSY) {
 40474  		goto __276
 40475  	}
 40476  	if !(libc.PostIncInt32(&nTimeout, 1) >= 3) {
 40477  		goto __277
 40478  	}
 40479  	goto __275
 40480  __277:
 40481  	;
 40482  	sqlite3.Xsqlite3_sleep(tls, 100)
 40483  __276:
 40484  	;
 40485  	goto __274
 40486  __275:
 40487  	;
 40488  	sqlite3.Xsqlite3_backup_finish(tls, pBackup1)
 40489  	if !(rc == SQLITE_DONE) {
 40490  		goto __278
 40491  	}
 40492  	rc = TCL_OK
 40493  	goto __279
 40494  __278:
 40495  	if !((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)) {
 40496  		goto __280
 40497  	}
 40498  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+848, ts+13439, /* "restore failed: ..." */
 40499  		uintptr(0)))
 40500  	rc = TCL_ERROR
 40501  	goto __281
 40502  __280:
 40503  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+864, ts+13422, /* "restore failed: " */
 40504  		sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 40505  	rc = TCL_ERROR
 40506  __281:
 40507  	;
 40508  __279:
 40509  	;
 40510  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1392 /* pSrc */)))
 40511  	goto __3
 40512  
 40513  	//     $db serialize ?DATABASE?
 40514  	//
 40515  	// Return a serialization of a database.
 40516  __32:
 40517  	if objc >= 3 {
 40518  		zSchema1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 40519  	} else {
 40520  		zSchema1 = ts + 85 /* "main" */
 40521  	}
 40522  	*(*sqlite3_int64)(unsafe.Pointer(bp + 1400 /* sz */)) = int64(0)
 40523  	if !((objc != 2) && (objc != 3)) {
 40524  		goto __282
 40525  	}
 40526  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13476 /* "?DATABASE?" */)
 40527  	rc = TCL_ERROR
 40528  	goto __283
 40529  __282:
 40530  	pData1 = sqlite3.Xsqlite3_serialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema1, bp+1400 /* &sz */, uint32(SQLITE_SERIALIZE_NOCOPY))
 40531  	if !(pData1 != 0) {
 40532  		goto __284
 40533  	}
 40534  	needFree = 0
 40535  	goto __285
 40536  __284:
 40537  	pData1 = sqlite3.Xsqlite3_serialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema1, bp+1400 /* &sz */, uint32(0))
 40538  	needFree = 1
 40539  __285:
 40540  	;
 40541  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, pData1, int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 1400 /* sz */)))))
 40542  	if !(needFree != 0) {
 40543  		goto __286
 40544  	}
 40545  	sqlite3.Xsqlite3_free(tls, pData1)
 40546  __286:
 40547  	;
 40548  __283:
 40549  	;
 40550  	goto __3
 40551  
 40552  	//     $db status (step|sort|autoindex|vmstep)
 40553  	//
 40554  	// Display SQLITE_STMTSTATUS_FULLSCAN_STEP or
 40555  	// SQLITE_STMTSTATUS_SORT for the most recent eval.
 40556  __33:
 40557  	if !(objc != 3) {
 40558  		goto __287
 40559  	}
 40560  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13487 /* "(step|sort|autoi..." */)
 40561  	return TCL_ERROR
 40562  __287:
 40563  	;
 40564  	zOp = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 40565  	if !(libc.Xstrcmp(tls, zOp, ts+10120 /* "step" */) == 0) {
 40566  		goto __288
 40567  	}
 40568  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnStep
 40569  	goto __289
 40570  __288:
 40571  	if !(libc.Xstrcmp(tls, zOp, ts+13509 /* "sort" */) == 0) {
 40572  		goto __290
 40573  	}
 40574  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnSort
 40575  	goto __291
 40576  __290:
 40577  	if !(libc.Xstrcmp(tls, zOp, ts+13514 /* "autoindex" */) == 0) {
 40578  		goto __292
 40579  	}
 40580  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnIndex
 40581  	goto __293
 40582  __292:
 40583  	if !(libc.Xstrcmp(tls, zOp, ts+13524 /* "vmstep" */) == 0) {
 40584  		goto __294
 40585  	}
 40586  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnVMStep
 40587  	goto __295
 40588  __294:
 40589  	tcl.XTcl_AppendResult(tls, interp,
 40590  		libc.VaList(bp+888, ts+13531, /* "bad argument: sh..." */
 40591  			uintptr(0)))
 40592  	return TCL_ERROR
 40593  __295:
 40594  	;
 40595  __293:
 40596  	;
 40597  __291:
 40598  	;
 40599  __289:
 40600  	;
 40601  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, v2))
 40602  	goto __3
 40603  
 40604  	//     $db timeout MILLESECONDS
 40605  	//
 40606  	// Delay for the number of milliseconds specified when a file is locked.
 40607  __34:
 40608  	if !(objc != 3) {
 40609  		goto __296
 40610  	}
 40611  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13587 /* "MILLISECONDS" */)
 40612  	return TCL_ERROR
 40613  __296:
 40614  	;
 40615  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1408 /* &ms */) != 0) {
 40616  		goto __297
 40617  	}
 40618  	return TCL_ERROR
 40619  __297:
 40620  	;
 40621  	sqlite3.Xsqlite3_busy_timeout(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1408 /* ms */)))
 40622  	goto __3
 40623  
 40624  	//     $db total_changes
 40625  	//
 40626  	// Return the number of rows that were modified, inserted, or deleted
 40627  	// since the database handle was created.
 40628  __35:
 40629  	if !(objc != 2) {
 40630  		goto __298
 40631  	}
 40632  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 40633  	return TCL_ERROR
 40634  __298:
 40635  	;
 40636  	pResult6 = tcl.XTcl_GetObjResult(tls, interp)
 40637  	tcl.XTcl_SetIntObj(tls, pResult6, sqlite3.Xsqlite3_total_changes(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 40638  	goto __3
 40639  
 40640  	// $db trace ?CALLBACK?
 40641  	//
 40642  	// Make arrangements to invoke the CALLBACK routine for each SQL statement
 40643  	// that is executed.  The text of the SQL is appended to CALLBACK before
 40644  	// it is executed.
 40645  __36:
 40646  	if !(objc > 3) {
 40647  		goto __299
 40648  	}
 40649  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 40650  	return TCL_ERROR
 40651  	goto __300
 40652  __299:
 40653  	if !(objc == 2) {
 40654  		goto __301
 40655  	}
 40656  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 40657  		goto __303
 40658  	}
 40659  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+904, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, uintptr(0)))
 40660  __303:
 40661  	;
 40662  	goto __302
 40663  __301:
 40664  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 40665  		goto __304
 40666  	}
 40667  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace)
 40668  __304:
 40669  	;
 40670  	zTrace = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1412 /* &len8 */)
 40671  	if !((zTrace != 0) && (*(*int32)(unsafe.Pointer(bp + 1412 /* len8 */)) > 0)) {
 40672  		goto __305
 40673  	}
 40674  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTrace = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1412 /* len8 */)) + 1)))
 40675  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, zTrace, (uint64(*(*int32)(unsafe.Pointer(bp + 1412 /* len8 */)) + 1)))
 40676  	goto __306
 40677  __305:
 40678  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTrace = uintptr(0)
 40679  __306:
 40680  	;
 40681  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 40682  		goto __307
 40683  	}
 40684  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40685  	sqlite3.Xsqlite3_trace(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 40686  		f func(*libc.TLS, uintptr, uintptr)
 40687  	}{DbTraceHandler})), pDb)
 40688  	goto __308
 40689  __307:
 40690  	sqlite3.Xsqlite3_trace(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 40691  __308:
 40692  	;
 40693  __302:
 40694  	;
 40695  __300:
 40696  	;
 40697  	goto __3
 40698  
 40699  	// $db trace_v2 ?CALLBACK? ?MASK?
 40700  	//
 40701  	// Make arrangements to invoke the CALLBACK routine for each trace event
 40702  	// matching the mask that is generated.  The parameters are appended to
 40703  	// CALLBACK before it is executed.
 40704  __37:
 40705  	if !(objc > 4) {
 40706  		goto __309
 40707  	}
 40708  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13600 /* "?CALLBACK? ?MASK..." */)
 40709  	return TCL_ERROR
 40710  	goto __310
 40711  __309:
 40712  	if !(objc == 2) {
 40713  		goto __311
 40714  	}
 40715  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 40716  		goto __313
 40717  	}
 40718  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+920, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, uintptr(0)))
 40719  __313:
 40720  	;
 40721  	goto __312
 40722  __311:
 40723  	wMask = int64(0)
 40724  	if !(objc == 4) {
 40725  		goto __314
 40726  	}
 40727  	if !(TCL_OK != tcl.XTcl_ListObjLength(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1416 /* &len9 */)) {
 40728  		goto __316
 40729  	}
 40730  	return TCL_ERROR
 40731  __316:
 40732  	;
 40733  	i4 = 0
 40734  __317:
 40735  	if !(i4 < *(*int32)(unsafe.Pointer(bp + 1416 /* len9 */))) {
 40736  		goto __319
 40737  	}
 40738  	if !(TCL_OK != tcl.XTcl_ListObjIndex(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), i4, bp+1424 /* &pObj */)) {
 40739  		goto __320
 40740  	}
 40741  	return TCL_ERROR
 40742  __320:
 40743  	;
 40744  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 1424 /* pObj */)), uintptr(unsafe.Pointer(&TTYPE_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+13618 /* "trace type" */, 0, bp+1432 /* &ttype */) != TCL_OK) {
 40745  		goto __321
 40746  	}
 40747  	pError = tcl.XTcl_DuplicateObj(tls, tcl.XTcl_GetObjResult(tls, interp))
 40748  	(*Tcl_Obj)(unsafe.Pointer(pError)).FrefCount++
 40749  	if !(TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 1424 /* pObj */)), bp+1440 /* &wType */)) {
 40750  		goto __323
 40751  	}
 40752  __325:
 40753  	_objPtr3 = pError
 40754  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr3))).FrefCount, 1) <= 1) {
 40755  		goto __328
 40756  	}
 40757  	tcl.XTclFreeObj(tls, _objPtr3)
 40758  __328:
 40759  	;
 40760  	goto __326
 40761  __326:
 40762  	if 0 != 0 {
 40763  		goto __325
 40764  	}
 40765  	goto __327
 40766  __327:
 40767  	;
 40768  	wMask = wMask | (*(*Tcl_WideInt)(unsafe.Pointer(bp + 1440 /* wType */)))
 40769  	goto __324
 40770  __323:
 40771  	tcl.XTcl_SetObjResult(tls, interp, pError)
 40772  __329:
 40773  	_objPtr4 = pError
 40774  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr4))).FrefCount, 1) <= 1) {
 40775  		goto __332
 40776  	}
 40777  	tcl.XTclFreeObj(tls, _objPtr4)
 40778  __332:
 40779  	;
 40780  	goto __330
 40781  __330:
 40782  	if 0 != 0 {
 40783  		goto __329
 40784  	}
 40785  	goto __331
 40786  __331:
 40787  	;
 40788  	return TCL_ERROR
 40789  __324:
 40790  	;
 40791  	goto __322
 40792  __321:
 40793  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1432 /* ttype */))) {
 40794  	case uint32(0) /* TTYPE_STMT */ :
 40795  		goto __334
 40796  	case uint32(1) /* TTYPE_PROFILE */ :
 40797  		goto __335
 40798  	case uint32(2) /* TTYPE_ROW */ :
 40799  		goto __336
 40800  	case uint32(3) /* TTYPE_CLOSE */ :
 40801  		goto __337
 40802  	}
 40803  	goto __333
 40804  __334:
 40805  	wMask = wMask | (int64(SQLITE_TRACE_STMT))
 40806  	goto __333
 40807  __335:
 40808  	wMask = wMask | (int64(SQLITE_TRACE_PROFILE))
 40809  	goto __333
 40810  __336:
 40811  	wMask = wMask | (int64(SQLITE_TRACE_ROW))
 40812  	goto __333
 40813  __337:
 40814  	wMask = wMask | (int64(SQLITE_TRACE_CLOSE))
 40815  	goto __333
 40816  __333:
 40817  	;
 40818  __322:
 40819  	;
 40820  	goto __318
 40821  __318:
 40822  	i4++
 40823  	goto __317
 40824  	goto __319
 40825  __319:
 40826  	;
 40827  	goto __315
 40828  __314:
 40829  	wMask = int64(SQLITE_TRACE_STMT) // use the "legacy" default
 40830  __315:
 40831  	;
 40832  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 40833  		goto __338
 40834  	}
 40835  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2)
 40836  __338:
 40837  	;
 40838  	zTraceV2 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+1416 /* &len9 */)
 40839  	if !((zTraceV2 != 0) && (*(*int32)(unsafe.Pointer(bp + 1416 /* len9 */)) > 0)) {
 40840  		goto __339
 40841  	}
 40842  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1416 /* len9 */)) + 1)))
 40843  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, zTraceV2, (uint64(*(*int32)(unsafe.Pointer(bp + 1416 /* len9 */)) + 1)))
 40844  	goto __340
 40845  __339:
 40846  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 = uintptr(0)
 40847  __340:
 40848  	;
 40849  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 40850  		goto __341
 40851  	}
 40852  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40853  	sqlite3.Xsqlite3_trace_v2(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uint32(wMask), *(*uintptr)(unsafe.Pointer(&struct {
 40854  		f func(*libc.TLS, uint32, uintptr, uintptr, uintptr) int32
 40855  	}{DbTraceV2Handler})), pDb)
 40856  	goto __342
 40857  __341:
 40858  	sqlite3.Xsqlite3_trace_v2(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uint32(0), uintptr(0), uintptr(0))
 40859  __342:
 40860  	;
 40861  __312:
 40862  	;
 40863  __310:
 40864  	;
 40865  	goto __3
 40866  
 40867  	// $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 40868  	//
 40869  	// Start a new transaction (if we are not already in the midst of a
 40870  	// transaction) and execute the TCL script SCRIPT.  After SCRIPT
 40871  	// completes, either commit the transaction or roll it back if SCRIPT
 40872  	// throws an exception.  Or if no new transation was started, do nothing.
 40873  	// pass the exception on up the stack.
 40874  	//
 40875  	// This command was inspired by Dave Thomas's talk on Ruby at the
 40876  	// 2005 O'Reilly Open Source Convention (OSCON).
 40877  __38:
 40878  	zBegin = ts + 13629 /* "SAVEPOINT _tcl_t..." */
 40879  	if !((objc != 3) && (objc != 4)) {
 40880  		goto __343
 40881  	}
 40882  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13656 /* "[TYPE] SCRIPT" */)
 40883  	return TCL_ERROR
 40884  __343:
 40885  	;
 40886  
 40887  	if !(((*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction == 0) && (objc == 4)) {
 40888  		goto __344
 40889  	}
 40890  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(unsafe.Pointer(&TTYPE_strs1)), int32(unsafe.Sizeof(uintptr(0))), ts+13670 /* "transaction type" */, 0, bp+1448 /* &ttype1 */) != 0) {
 40891  		goto __345
 40892  	}
 40893  	return TCL_ERROR
 40894  __345:
 40895  	;
 40896  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1448 /* ttype1 */))) {
 40897  	case uint32(0) /* TTYPE_DEFERRED */ :
 40898  		goto __347
 40899  	case uint32(1) /* TTYPE_EXCLUSIVE */ :
 40900  		goto __348
 40901  	case uint32(2) /* TTYPE_IMMEDIATE */ :
 40902  		goto __349
 40903  	}
 40904  	goto __346
 40905  __347: /* no-op */
 40906  	;
 40907  	goto __346
 40908  __348:
 40909  	zBegin = ts + 13687 /* "BEGIN EXCLUSIVE" */
 40910  	goto __346
 40911  __349:
 40912  	zBegin = ts + 13703 /* "BEGIN IMMEDIATE" */
 40913  	goto __346
 40914  __346:
 40915  	;
 40916  __344:
 40917  	;
 40918  	pScript2 = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8))
 40919  
 40920  	// Run the SQLite BEGIN command to open a transaction or savepoint.
 40921  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth++
 40922  	rc = sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zBegin, uintptr(0), uintptr(0), uintptr(0))
 40923  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth--
 40924  	if !(rc != SQLITE_OK) {
 40925  		goto __350
 40926  	}
 40927  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+936, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 40928  	return TCL_ERROR
 40929  __350:
 40930  	;
 40931  	(*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction++
 40932  
 40933  	// If using NRE, schedule a callback to invoke the script pScript, then
 40934  	// a second callback to commit (or rollback) the transaction or savepoint
 40935  	// opened above. If not using NRE, evaluate the script directly, then
 40936  	// call function DbTransPostCmd() to commit (or rollback) the transaction
 40937  	// or savepoint.
 40938  	if !(DbUseNre(tls) != 0) {
 40939  		goto __351
 40940  	}
 40941  	tcl.XTcl_NRAddCallback(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 40942  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 40943  	}{DbTransPostCmd})), *(*uintptr)(unsafe.Pointer(bp + 1456 /* cd */)), uintptr(0), uintptr(0), uintptr(0))
 40944  	tcl.XTcl_NREvalObj(tls, interp, pScript2, 0)
 40945  	goto __352
 40946  __351:
 40947  	rc = DbTransPostCmd(tls, bp+1456 /* &cd */, interp, tcl.XTcl_EvalObjEx(tls, interp, pScript2, 0))
 40948  __352:
 40949  	;
 40950  	goto __3
 40951  
 40952  	//    $db unlock_notify ?script?
 40953  __39:
 40954  	if !((objc != 2) && (objc != 3)) {
 40955  		goto __353
 40956  	}
 40957  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 40958  	rc = TCL_ERROR
 40959  	goto __354
 40960  __353:
 40961  	xNotify = uintptr(0)
 40962  	pNotifyArg = uintptr(0)
 40963  
 40964  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify != 0) {
 40965  		goto __355
 40966  	}
 40967  __356:
 40968  	_objPtr5 = (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify
 40969  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr5))).FrefCount, 1) <= 1) {
 40970  		goto __359
 40971  	}
 40972  	tcl.XTclFreeObj(tls, _objPtr5)
 40973  __359:
 40974  	;
 40975  	goto __357
 40976  __357:
 40977  	if 0 != 0 {
 40978  		goto __356
 40979  	}
 40980  	goto __358
 40981  __358:
 40982  	;
 40983  	(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = uintptr(0)
 40984  __355:
 40985  	;
 40986  
 40987  	if !(objc == 3) {
 40988  		goto __360
 40989  	}
 40990  	xNotify = *(*uintptr)(unsafe.Pointer(&struct {
 40991  		f func(*libc.TLS, uintptr, int32)
 40992  	}{DbUnlockNotify}))
 40993  	pNotifyArg = pDb
 40994  	(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = *(*uintptr)(unsafe.Pointer(objv + 2*8))
 40995  	(*Tcl_Obj)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify)).FrefCount++
 40996  __360:
 40997  	;
 40998  
 40999  	if !(sqlite3.Xsqlite3_unlock_notify(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, xNotify, pNotifyArg) != 0) {
 41000  		goto __361
 41001  	}
 41002  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+952, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 41003  	rc = TCL_ERROR
 41004  __361:
 41005  	;
 41006  __354:
 41007  	;
 41008  	goto __3
 41009  
 41010  	//    $db preupdate_hook count
 41011  	//    $db preupdate_hook hook ?SCRIPT?
 41012  	//    $db preupdate_hook new INDEX
 41013  	//    $db preupdate_hook old INDEX
 41014  __40:
 41015  
 41016  	if !(objc < 3) {
 41017  		goto __362
 41018  	}
 41019  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13728 /* "SUB-COMMAND ?ARG..." */)
 41020  __362:
 41021  	;
 41022  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(unsafe.Pointer(&azSub)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp+1464 /* &iSub */) != 0) {
 41023  		goto __363
 41024  	}
 41025  	return TCL_ERROR
 41026  __363:
 41027  	;
 41028  
 41029  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1464 /* iSub */))) {
 41030  	case uint32(0) /* PRE_COUNT */ :
 41031  		goto __365
 41032  
 41033  	case uint32(2) /* PRE_HOOK */ :
 41034  		goto __366
 41035  
 41036  	case uint32(1) /* PRE_DEPTH */ :
 41037  		goto __367
 41038  
 41039  	case uint32(3) /* PRE_NEW */ :
 41040  		goto __368
 41041  	case uint32(4) /* PRE_OLD */ :
 41042  		goto __369
 41043  	}
 41044  	goto __364
 41045  __365:
 41046  	nCol2 = sqlite3.Xsqlite3_preupdate_count(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 41047  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nCol2))
 41048  	goto __364
 41049  
 41050  __366:
 41051  	if !(objc > 4) {
 41052  		goto __370
 41053  	}
 41054  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13747 /* "hook ?SCRIPT?" */)
 41055  	return TCL_ERROR
 41056  __370:
 41057  	;
 41058  	DbHookCmd(tls, interp, pDb, func() uintptr {
 41059  		if objc == 4 {
 41060  			return *(*uintptr)(unsafe.Pointer(objv + 3*8))
 41061  		}
 41062  		return uintptr(0)
 41063  	}(), (pDb + 112 /* &.pPreUpdateHook */))
 41064  	goto __364
 41065  
 41066  __367:
 41067  	if !(objc != 3) {
 41068  		goto __371
 41069  	}
 41070  	tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+489 /* "" */)
 41071  	return TCL_ERROR
 41072  __371:
 41073  	;
 41074  	pRet1 = tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_preupdate_depth(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 41075  	tcl.XTcl_SetObjResult(tls, interp, pRet1)
 41076  	goto __364
 41077  
 41078  __368:
 41079  __369:
 41080  	if !(objc != 4) {
 41081  		goto __372
 41082  	}
 41083  	tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+13761 /* "INDEX" */)
 41084  	return TCL_ERROR
 41085  __372:
 41086  	;
 41087  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+1468 /* &iIdx */) != 0) {
 41088  		goto __373
 41089  	}
 41090  	return TCL_ERROR
 41091  __373:
 41092  	;
 41093  
 41094  	if !(*(*int32)(unsafe.Pointer(bp + 1464 /* iSub */)) == 4 /* PRE_OLD */) {
 41095  		goto __374
 41096  	}
 41097  	rc = sqlite3.Xsqlite3_preupdate_old(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1468 /* iIdx */)), bp+1472 /* &pValue1 */)
 41098  	goto __375
 41099  __374:
 41100  	;
 41101  	rc = sqlite3.Xsqlite3_preupdate_new(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1468 /* iIdx */)), bp+1472 /* &pValue1 */)
 41102  __375:
 41103  	;
 41104  
 41105  	if !(rc == SQLITE_OK) {
 41106  		goto __376
 41107  	}
 41108  	pObj1 = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp + 1472 /* pValue1 */))), -1)
 41109  	tcl.XTcl_SetObjResult(tls, interp, pObj1)
 41110  	goto __377
 41111  __376:
 41112  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+968, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 41113  	return TCL_ERROR
 41114  __377:
 41115  	;
 41116  
 41117  __364:
 41118  	;
 41119  	goto __3
 41120  
 41121  	//    $db wal_hook ?script?
 41122  	//    $db update_hook ?script?
 41123  	//    $db rollback_hook ?script?
 41124  __41:
 41125  __42:
 41126  __43:
 41127  	// set ppHook to point at pUpdateHook or pRollbackHook, depending on
 41128  	// whether [$db update_hook] or [$db rollback_hook] was invoked.
 41129  	ppHook = uintptr(0)
 41130  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 40 /* DB_WAL_HOOK */) {
 41131  		goto __378
 41132  	}
 41133  	ppHook = (pDb + 128 /* &.pWalHook */)
 41134  __378:
 41135  	;
 41136  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 38 /* DB_UPDATE_HOOK */) {
 41137  		goto __379
 41138  	}
 41139  	ppHook = (pDb + 104 /* &.pUpdateHook */)
 41140  __379:
 41141  	;
 41142  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 29 /* DB_ROLLBACK_HOOK */) {
 41143  		goto __380
 41144  	}
 41145  	ppHook = (pDb + 120 /* &.pRollbackHook */)
 41146  __380:
 41147  	;
 41148  	if !(objc > 3) {
 41149  		goto __381
 41150  	}
 41151  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 41152  	return TCL_ERROR
 41153  __381:
 41154  	;
 41155  
 41156  	DbHookCmd(tls, interp, pDb, func() uintptr {
 41157  		if objc == 3 {
 41158  			return *(*uintptr)(unsafe.Pointer(objv + 2*8))
 41159  		}
 41160  		return uintptr(0)
 41161  	}(), ppHook)
 41162  	goto __3
 41163  
 41164  	// $db version
 41165  	//
 41166  	// Return the version string for this database.
 41167  __44:
 41168  	i5 = 2
 41169  __382:
 41170  	if !(i5 < objc) {
 41171  		goto __384
 41172  	}
 41173  	zArg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i5)*8)))
 41174  	// Optional arguments to $db version are used for testing purpose
 41175  	// $db version -use-legacy-prepare BOOLEAN
 41176  	//
 41177  	// Turn the use of legacy sqlite3_prepare() on or off.
 41178  	if !((libc.Xstrcmp(tls, zArg, ts+13767 /* "-use-legacy-prep..." */) == 0) && ((i5 + 1) < objc)) {
 41179  		goto __385
 41180  	}
 41181  	i5++
 41182  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i5)*8)), (pDb+224 /* &.bLegacyPrepare */)) != 0) {
 41183  		goto __387
 41184  	}
 41185  	return TCL_ERROR
 41186  __387:
 41187  	;
 41188  	goto __386
 41189  __385:
 41190  
 41191  	// $db version -last-stmt-ptr
 41192  	//
 41193  	// Return a string which is a hex encoding of the pointer to the
 41194  	// most recent sqlite3_stmt in the statement cache.
 41195  	if !(libc.Xstrcmp(tls, zArg, ts+13787 /* "-last-stmt-ptr" */) == 0) {
 41196  		goto __388
 41197  	}
 41198  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+1480 /* &zBuf[0] */, ts+13802, /* "%p" */
 41199  		libc.VaList(bp+984, func() uintptr {
 41200  			if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList != 0 {
 41201  				return (*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtList)).FpStmt
 41202  			}
 41203  			return uintptr(0)
 41204  		}()))
 41205  	tcl.XTcl_SetResult(tls, interp, bp+1480 /* &zBuf[0] */, uintptr(1))
 41206  	goto __389
 41207  __388:
 41208  
 41209  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+992, ts+13805 /* "unknown argument..." */, zArg, uintptr(0)))
 41210  	return TCL_ERROR
 41211  __389:
 41212  	;
 41213  __386:
 41214  	;
 41215  	goto __383
 41216  __383:
 41217  	i5++
 41218  	goto __382
 41219  	goto __384
 41220  __384:
 41221  	;
 41222  	if !(i5 == 2) {
 41223  		goto __390
 41224  	}
 41225  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_libversion(tls), uintptr(0))
 41226  __390:
 41227  	;
 41228  	goto __3
 41229  
 41230  __3:
 41231  	; // End of the SWITCH statement
 41232  	return rc
 41233  }
 41234  
 41235  type DbConfigChoices = struct {
 41236  	FzName uintptr
 41237  	Fop    int32
 41238  	_      [4]byte
 41239  } /* tclsqlite.c:2340:18 */
 41240  
 41241  var DB_strs = [42]uintptr{
 41242  	ts + 13824 /* "authorizer" */, ts + 13835 /* "backup" */, ts + 13842, /* "bind_fallback" */
 41243  	ts + 13856 /* "busy" */, ts + 13861 /* "cache" */, ts + 13867, /* "changes" */
 41244  	ts + 10125 /* "close" */, ts + 13875 /* "collate" */, ts + 13883, /* "collation_needed" */
 41245  	ts + 13900 /* "commit_hook" */, ts + 13912 /* "complete" */, ts + 13921, /* "config" */
 41246  	ts + 13928 /* "copy" */, ts + 13933 /* "deserialize" */, ts + 13945, /* "enable_load_exte..." */
 41247  	ts + 13967 /* "errorcode" */, ts + 4757 /* "eval" */, ts + 13977, /* "exists" */
 41248  	ts + 13984 /* "function" */, ts + 11333 /* "incrblob" */, ts + 13993, /* "interrupt" */
 41249  	ts + 14003 /* "last_insert_rowi..." */, ts + 14021 /* "nullvalue" */, ts + 14031, /* "onecolumn" */
 41250  	ts + 14041 /* "preupdate" */, ts + 14051 /* "profile" */, ts + 10199, /* "progress" */
 41251  	ts + 14059 /* "rekey" */, ts + 14065 /* "restore" */, ts + 14073, /* "rollback_hook" */
 41252  	ts + 14087 /* "serialize" */, ts + 14097 /* "status" */, ts + 14104, /* "timeout" */
 41253  	ts + 14112 /* "total_changes" */, ts + 14126 /* "trace" */, ts + 14132, /* "trace_v2" */
 41254  	ts + 14141 /* "transaction" */, ts + 14153 /* "unlock_notify" */, ts + 14167, /* "update_hook" */
 41255  	ts + 14179 /* "version" */, ts + 14187 /* "wal_hook" */, uintptr(0),
 41256  } /* tclsqlite.c:1916:21 */
 41257  var aDbConfig = [16]DbConfigChoices{
 41258  	{FzName: ts + 14196 /* "defensive" */, Fop: SQLITE_DBCONFIG_DEFENSIVE},
 41259  	{FzName: ts + 14206 /* "dqs_ddl" */, Fop: SQLITE_DBCONFIG_DQS_DDL},
 41260  	{FzName: ts + 14214 /* "dqs_dml" */, Fop: SQLITE_DBCONFIG_DQS_DML},
 41261  	{FzName: ts + 14222 /* "enable_fkey" */, Fop: SQLITE_DBCONFIG_ENABLE_FKEY},
 41262  	{FzName: ts + 14234 /* "enable_qpsg" */, Fop: SQLITE_DBCONFIG_ENABLE_QPSG},
 41263  	{FzName: ts + 14246 /* "enable_trigger" */, Fop: SQLITE_DBCONFIG_ENABLE_TRIGGER},
 41264  	{FzName: ts + 14261 /* "enable_view" */, Fop: SQLITE_DBCONFIG_ENABLE_VIEW},
 41265  	{FzName: ts + 14273 /* "fts3_tokenizer" */, Fop: SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER},
 41266  	{FzName: ts + 14288 /* "legacy_alter_tab..." */, Fop: SQLITE_DBCONFIG_LEGACY_ALTER_TABLE},
 41267  	{FzName: ts + 14307 /* "legacy_file_form..." */, Fop: SQLITE_DBCONFIG_LEGACY_FILE_FORMAT},
 41268  	{FzName: ts + 14326 /* "load_extension" */, Fop: SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION},
 41269  	{FzName: ts + 14341 /* "no_ckpt_on_close" */, Fop: SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE},
 41270  	{FzName: ts + 14358 /* "reset_database" */, Fop: SQLITE_DBCONFIG_RESET_DATABASE},
 41271  	{FzName: ts + 14373 /* "trigger_eqp" */, Fop: SQLITE_DBCONFIG_TRIGGER_EQP},
 41272  	{FzName: ts + 14385 /* "trusted_schema" */, Fop: SQLITE_DBCONFIG_TRUSTED_SCHEMA},
 41273  	{FzName: ts + 14400 /* "writable_schema" */, Fop: SQLITE_DBCONFIG_WRITABLE_SCHEMA},
 41274  } /* tclsqlite.c:2343:7 */
 41275  var TTYPE_strs = [5]uintptr{
 41276  	ts + 14416 /* "statement" */, ts + 14051 /* "profile" */, ts + 14426 /* "row" */, ts + 10125 /* "close" */, uintptr(0),
 41277  } /* tclsqlite.c:3321:27 */
 41278  var TTYPE_strs1 = [4]uintptr{
 41279  	ts + 14430 /* "deferred" */, ts + 14439 /* "exclusive" */, ts + 14449 /* "immediate" */, uintptr(0),
 41280  }                                                                                                                                                              /* tclsqlite.c:3404:25 */
 41281  var azSub = [6]uintptr{ts + 1826 /* "count" */, ts + 14459 /* "depth" */, ts + 14465 /* "hook" */, ts + 14470 /* "new" */, ts + 14474 /* "old" */, uintptr(0)} /* tclsqlite.c:3496:23 */
 41282  
 41283  // Adaptor that provides an objCmd interface to the NRE-enabled
 41284  // interface implementation.
 41285  func DbObjCmdAdaptor(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:3647:26: */
 41286  	return tcl.XTcl_NRCallObjProc(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 41287  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41288  	}{DbObjCmd})), cd, objc, objv)
 41289  }
 41290  
 41291  // Issue the usage message when the "sqlite3" command arguments are
 41292  // incorrect.
 41293  func sqliteCmdUsage(tls *libc.TLS, interp uintptr, objv uintptr) int32 { /* tclsqlite.c:3661:12: */
 41294  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 41295  
 41296  		ts+14478 /* "HANDLE ?FILENAME..." */)
 41297  	return TCL_ERROR
 41298  }
 41299  
 41300  //   sqlite3 DBNAME FILENAME ?-vfs VFSNAME? ?-key KEY? ?-readonly BOOLEAN?
 41301  //                           ?-create BOOLEAN? ?-nomutex BOOLEAN?
 41302  //                           ?-nofollow BOOLEAN?
 41303  //
 41304  // This is the main Tcl command.  When the "sqlite" Tcl command is
 41305  // invoked, this routine runs to process that command.
 41306  //
 41307  // The first argument, DBNAME, is an arbitrary name for a new
 41308  // database connection.  This command creates a new command named
 41309  // DBNAME that is used to control that connection.  The database
 41310  // connection is deleted when the DBNAME command is deleted.
 41311  //
 41312  // The second argument is the name of the database file.
 41313  //
 41314  func DbMain(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:3689:26: */
 41315  	bp := tls.Alloc(336)
 41316  	defer tls.Free(336)
 41317  
 41318  	var p uintptr
 41319  	var zArg uintptr
 41320  	var zErrMsg uintptr
 41321  	var i int32
 41322  	var zFile uintptr = uintptr(0)
 41323  	var zVfs uintptr = uintptr(0)
 41324  	var flags int32
 41325  	*(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) = 1
 41326  	// var translatedFilename Tcl_DString at bp+120, 216
 41327  
 41328  	var rc int32
 41329  
 41330  	// In normal use, each TCL interpreter runs in a single thread.  So
 41331  	// by default, we can turn off mutexing on SQLite database connections.
 41332  	// However, for testing purposes it is useful to have mutexes turned
 41333  	// on.  So, by default, mutexes default off.  But if compiled with
 41334  	// SQLITE_TCL_DEFAULT_FULLMUTEX then mutexes default on.
 41335  	flags = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_NOMUTEX)
 41336  
 41337  	if objc == 1 {
 41338  		return sqliteCmdUsage(tls, interp, objv)
 41339  	}
 41340  	if objc == 2 {
 41341  		zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(0))
 41342  		if libc.Xstrcmp(tls, zArg, ts+14624 /* "-version" */) == 0 {
 41343  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_libversion(tls), uintptr(0)))
 41344  			return TCL_OK
 41345  		}
 41346  		if libc.Xstrcmp(tls, zArg, ts+14633 /* "-sourceid" */) == 0 {
 41347  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3_sourceid(tls), uintptr(0)))
 41348  			return TCL_OK
 41349  		}
 41350  		if libc.Xstrcmp(tls, zArg, ts+14643 /* "-has-codec" */) == 0 {
 41351  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+14654 /* "0" */, uintptr(0)))
 41352  			return TCL_OK
 41353  		}
 41354  		if int32(*(*int8)(unsafe.Pointer(zArg))) == '-' {
 41355  			return sqliteCmdUsage(tls, interp, objv)
 41356  		}
 41357  	}
 41358  	for i = 2; i < objc; i++ {
 41359  		zArg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)))
 41360  		if int32(*(*int8)(unsafe.Pointer(zArg))) != '-' {
 41361  			if zFile != uintptr(0) {
 41362  				return sqliteCmdUsage(tls, interp, objv)
 41363  			}
 41364  			zFile = zArg
 41365  			continue
 41366  		}
 41367  		if i == (objc - 1) {
 41368  			return sqliteCmdUsage(tls, interp, objv)
 41369  		}
 41370  		i++
 41371  		if libc.Xstrcmp(tls, zArg, ts+14656 /* "-key" */) == 0 {
 41372  			// no-op
 41373  		} else if libc.Xstrcmp(tls, zArg, ts+14661 /* "-vfs" */) == 0 {
 41374  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)))
 41375  		} else if libc.Xstrcmp(tls, zArg, ts+12904 /* "-readonly" */) == 0 {
 41376  			// var b int32 at bp+88, 4
 41377  
 41378  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+88 /* &b */) != 0 {
 41379  				return TCL_ERROR
 41380  			}
 41381  			if *(*int32)(unsafe.Pointer(bp + 88 /* b */)) != 0 {
 41382  				flags = flags & (libc.CplInt32((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)))
 41383  				flags = flags | (SQLITE_OPEN_READONLY)
 41384  			} else {
 41385  				flags = flags & (libc.CplInt32(SQLITE_OPEN_READONLY))
 41386  				flags = flags | (SQLITE_OPEN_READWRITE)
 41387  			}
 41388  		} else if libc.Xstrcmp(tls, zArg, ts+14666 /* "-create" */) == 0 {
 41389  			// var b int32 at bp+92, 4
 41390  
 41391  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+92 /* &b */) != 0 {
 41392  				return TCL_ERROR
 41393  			}
 41394  			if (*(*int32)(unsafe.Pointer(bp + 92 /* b */)) != 0) && ((flags & SQLITE_OPEN_READONLY) == 0) {
 41395  				flags = flags | (SQLITE_OPEN_CREATE)
 41396  			} else {
 41397  				flags = flags & (libc.CplInt32(SQLITE_OPEN_CREATE))
 41398  			}
 41399  		} else if libc.Xstrcmp(tls, zArg, ts+14674 /* "-nofollow" */) == 0 {
 41400  			// var b int32 at bp+96, 4
 41401  
 41402  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+96 /* &b */) != 0 {
 41403  				return TCL_ERROR
 41404  			}
 41405  			if *(*int32)(unsafe.Pointer(bp + 96 /* b */)) != 0 {
 41406  				flags = flags | (SQLITE_OPEN_NOFOLLOW)
 41407  			} else {
 41408  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOFOLLOW))
 41409  			}
 41410  		} else if libc.Xstrcmp(tls, zArg, ts+14684 /* "-nomutex" */) == 0 {
 41411  			// var b int32 at bp+100, 4
 41412  
 41413  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+100 /* &b */) != 0 {
 41414  				return TCL_ERROR
 41415  			}
 41416  			if *(*int32)(unsafe.Pointer(bp + 100 /* b */)) != 0 {
 41417  				flags = flags | (SQLITE_OPEN_NOMUTEX)
 41418  				flags = flags & (libc.CplInt32(SQLITE_OPEN_FULLMUTEX))
 41419  			} else {
 41420  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOMUTEX))
 41421  			}
 41422  		} else if libc.Xstrcmp(tls, zArg, ts+14693 /* "-fullmutex" */) == 0 {
 41423  			// var b int32 at bp+104, 4
 41424  
 41425  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+104 /* &b */) != 0 {
 41426  				return TCL_ERROR
 41427  			}
 41428  			if *(*int32)(unsafe.Pointer(bp + 104 /* b */)) != 0 {
 41429  				flags = flags | (SQLITE_OPEN_FULLMUTEX)
 41430  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOMUTEX))
 41431  			} else {
 41432  				flags = flags & (libc.CplInt32(SQLITE_OPEN_FULLMUTEX))
 41433  			}
 41434  		} else if libc.Xstrcmp(tls, zArg, ts+14704 /* "-uri" */) == 0 {
 41435  			// var b int32 at bp+108, 4
 41436  
 41437  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+108 /* &b */) != 0 {
 41438  				return TCL_ERROR
 41439  			}
 41440  			if *(*int32)(unsafe.Pointer(bp + 108 /* b */)) != 0 {
 41441  				flags = flags | (SQLITE_OPEN_URI)
 41442  			} else {
 41443  				flags = flags & (libc.CplInt32(SQLITE_OPEN_URI))
 41444  			}
 41445  		} else if libc.Xstrcmp(tls, zArg, ts+14709 /* "-translatefilena..." */) == 0 {
 41446  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+112 /* &bTranslateFileName */) != 0 {
 41447  				return TCL_ERROR
 41448  			}
 41449  		} else {
 41450  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+12914 /* "unknown option: " */, zArg, uintptr(0)))
 41451  			return TCL_ERROR
 41452  		}
 41453  	}
 41454  	zErrMsg = uintptr(0)
 41455  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(SqliteDb{})))
 41456  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(SqliteDb{})))
 41457  	if zFile == uintptr(0) {
 41458  		zFile = ts + 489 /* "" */
 41459  	}
 41460  	if *(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) != 0 {
 41461  		zFile = tcl.XTcl_TranslateFileName(tls, interp, zFile, bp+120 /* &translatedFilename */)
 41462  	}
 41463  	rc = sqlite3.Xsqlite3_open_v2(tls, zFile, (p /* &.db */), flags, zVfs)
 41464  	if *(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) != 0 {
 41465  		tcl.XTcl_DStringFree(tls, bp+120 /* &translatedFilename */)
 41466  	}
 41467  	if (*SqliteDb)(unsafe.Pointer(p)).Fdb != 0 {
 41468  		if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb) {
 41469  			zErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+72, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb)))
 41470  			sqlite3.Xsqlite3_close(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb)
 41471  			(*SqliteDb)(unsafe.Pointer(p)).Fdb = uintptr(0)
 41472  		}
 41473  	} else {
 41474  		zErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+80, sqlite3.Xsqlite3_errstr(tls, rc)))
 41475  	}
 41476  	if (*SqliteDb)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 41477  		tcl.XTcl_SetResult(tls, interp, zErrMsg, uintptr(1))
 41478  		tcl.XTcl_Free(tls, p)
 41479  		sqlite3.Xsqlite3_free(tls, zErrMsg)
 41480  		return TCL_ERROR
 41481  	}
 41482  	(*SqliteDb)(unsafe.Pointer(p)).FmaxStmt = NUM_PREPARED_STMTS
 41483  	(*SqliteDb)(unsafe.Pointer(p)).FopenFlags = (flags & SQLITE_OPEN_URI)
 41484  	(*SqliteDb)(unsafe.Pointer(p)).Finterp = interp
 41485  	zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(0))
 41486  	if DbUseNre(tls) != 0 {
 41487  		tcl.XTcl_NRCreateCommand(tls, interp, zArg, *(*uintptr)(unsafe.Pointer(&struct {
 41488  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41489  		}{DbObjCmdAdaptor})), *(*uintptr)(unsafe.Pointer(&struct {
 41490  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41491  		}{DbObjCmd})),
 41492  			p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbDeleteCmd})))
 41493  	} else {
 41494  		tcl.XTcl_CreateObjCommand(tls, interp, zArg, *(*uintptr)(unsafe.Pointer(&struct {
 41495  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41496  		}{DbObjCmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbDeleteCmd})))
 41497  	}
 41498  	return TCL_OK
 41499  }
 41500  
 41501  // Provide a dummy Tcl_InitStubs if we are using this as a static
 41502  // library.
 41503  
 41504  // Make sure we have a PACKAGE_VERSION macro defined.  This will be
 41505  // defined automatically by the TEA makefile.  But other makefiles
 41506  // do not define it.
 41507  
 41508  // Initialize this module.
 41509  //
 41510  // This Tcl module contains only a single new Tcl command named "sqlite".
 41511  // (Hence there is no namespace.  There is no point in using a namespace
 41512  // if the extension only supplies one new name!)  The "sqlite" command is
 41513  // used to open a new SQLite database.  See the DbMain() routine above
 41514  // for additional information.
 41515  //
 41516  // The EXTERN macros are required by TCL in order to work on windows.
 41517  func Sqlite3_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3877:12: */
 41518  	var rc int32
 41519  	if 1 != 0 {
 41520  		rc = TCL_OK
 41521  	} else {
 41522  		rc = TCL_ERROR
 41523  	}
 41524  	if rc == TCL_OK {
 41525  		tcl.XTcl_CreateObjCommand(tls, interp, ts+14728 /* "sqlite3" */, *(*uintptr)(unsafe.Pointer(&struct {
 41526  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41527  		}{DbMain})), uintptr(0), uintptr(0))
 41528  		// The "sqlite" alias is undocumented.  It is here only to support
 41529  		// legacy scripts.  All new scripts should use only the "sqlite3"
 41530  		// command.
 41531  		tcl.XTcl_CreateObjCommand(tls, interp, ts+14736 /* "sqlite" */, *(*uintptr)(unsafe.Pointer(&struct {
 41532  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 41533  		}{DbMain})), uintptr(0), uintptr(0))
 41534  		rc = tcl.XTcl_PkgProvideEx(tls, interp, ts+14728 /* "sqlite3" */, ts+14743 /* "3.36.0" */, uintptr(0))
 41535  	}
 41536  	return rc
 41537  }
 41538  
 41539  func Tclsqlite3_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3891:12: */
 41540  	return Sqlite3_Init(tls, interp)
 41541  }
 41542  
 41543  func Sqlite3_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3892:12: */
 41544  	return TCL_OK
 41545  }
 41546  
 41547  func Tclsqlite3_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3893:12: */
 41548  	return TCL_OK
 41549  }
 41550  
 41551  // Because it accesses the file-system and uses persistent state, SQLite
 41552  // is not considered appropriate for safe interpreters.  Hence, we cause
 41553  // the _SafeInit() interfaces return TCL_ERROR.
 41554  func Sqlite3_SafeInit(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3899:12: */
 41555  	return TCL_ERROR
 41556  }
 41557  
 41558  func Sqlite3_SafeUnload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3900:12: */
 41559  	return TCL_ERROR
 41560  }
 41561  
 41562  func Sqlite_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3905:5: */
 41563  	return Sqlite3_Init(tls, interp)
 41564  }
 41565  
 41566  func Tclsqlite_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3906:5: */
 41567  	return Sqlite3_Init(tls, interp)
 41568  }
 41569  
 41570  func Sqlite_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3907:5: */
 41571  	return TCL_OK
 41572  }
 41573  
 41574  func Tclsqlite_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3908:5: */
 41575  	return TCL_OK
 41576  }
 41577  
 41578  // If the TCLSH macro is defined, add code to make a stand-alone program.
 41579  
 41580  // This is the main routine for an ordinary TCL shell.  If there are
 41581  // are arguments, run the first argument as a script.  Otherwise,
 41582  // read TCL commands from standard input
 41583  func tclsh_main_loop(tls *libc.TLS) uintptr { /* tclsqlite.c:3920:19: */
 41584  	return uintptr(unsafe.Pointer(&zMainloop))
 41585  }
 41586  
 41587  var zMainloop = *(*[431]int8)(unsafe.Pointer(ts + 14750 /* "if {[llength $ar..." */)) /* tclsqlite.c:3921:21 */
 41588  
 41589  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* tclsqlite.c:3953:18: */
 41590  	bp := tls.Alloc(64)
 41591  	defer tls.Free(64)
 41592  
 41593  	var interp uintptr
 41594  	var i int32
 41595  	var zScript uintptr = uintptr(0)
 41596  	// var zArgc [32]int8 at bp+32, 32
 41597  
 41598  	if libc.Xgetenv(tls, ts+15181 /* "SQLITE_DEBUG_BRE..." */) != 0 {
 41599  		if (libc.Xisatty(tls, 0) != 0) && (libc.Xisatty(tls, 2) != 0) {
 41600  			libc.Xfprintf(tls, libc.X__stderrp,
 41601  				ts+15200, /* "attach debugger ..." */
 41602  				libc.VaList(bp, libc.Xgetpid(tls)))
 41603  			libc.Xfgetc(tls, libc.X__stdinp)
 41604  		} else {
 41605  			libc.Xraise(tls, SIGTRAP)
 41606  		}
 41607  	}
 41608  
 41609  	// Call sqlite3_shutdown() once before doing anything else. This is to
 41610  	// test that sqlite3_shutdown() can be safely called by a process before
 41611  	// sqlite3_initialize() is.
 41612  	sqlite3.Xsqlite3_shutdown(tls)
 41613  
 41614  	tcl.XTcl_FindExecutable(tls, *(*uintptr)(unsafe.Pointer(argv)))
 41615  	tcl.XTcl_SetSystemEncoding(tls, uintptr(0), ts+15262 /* "utf-8" */)
 41616  	interp = tcl.XTcl_CreateInterp(tls)
 41617  	Sqlite3_Init(tls, interp)
 41618  
 41619  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([32]int8{})), bp+32 /* &zArgc[0] */, ts+1238 /* "%d" */, libc.VaList(bp+8, (argc-1)))
 41620  	tcl.XTcl_SetVar2(tls, interp, ts+15268 /* "argc" */, uintptr(0), bp+32 /* &zArgc[0] */, TCL_GLOBAL_ONLY)
 41621  	tcl.XTcl_SetVar2(tls, interp, ts+15273 /* "argv0" */, uintptr(0), *(*uintptr)(unsafe.Pointer(argv)), TCL_GLOBAL_ONLY)
 41622  	tcl.XTcl_SetVar2(tls, interp, ts+15279 /* "argv" */, uintptr(0), ts+489 /* "" */, TCL_GLOBAL_ONLY)
 41623  	for i = 1; i < argc; i++ {
 41624  		tcl.XTcl_SetVar2(tls, interp, ts+15279 /* "argv" */, uintptr(0), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ((TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT) | TCL_APPEND_VALUE))
 41625  	}
 41626  	zScript = sqlite3TestInit(tls, interp)
 41627  	if zScript == uintptr(0) {
 41628  		zScript = tclsh_main_loop(tls)
 41629  	}
 41630  	if tcl.XTcl_GlobalEval(tls, interp, zScript) != TCL_OK {
 41631  		var zInfo uintptr = tcl.XTcl_GetVar2(tls, interp, ts+15284 /* "errorInfo" */, uintptr(0), TCL_GLOBAL_ONLY)
 41632  		if zInfo == uintptr(0) {
 41633  			zInfo = tcl.XTcl_GetStringResult(tls, interp)
 41634  		}
 41635  		libc.Xfprintf(tls, libc.X__stderrp, ts+15294 /* "%s: %s\n" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv)), zInfo))
 41636  		return 1
 41637  	}
 41638  	return 0
 41639  }
 41640  
 41641  // CAPI3REF: Database Connection Handle
 41642  // KEYWORDS: {database connection} {database connections}
 41643  //
 41644  // Each open SQLite database is represented by a pointer to an instance of
 41645  // the opaque structure named "sqlite3".  It is useful to think of an sqlite3
 41646  // pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
 41647  // [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
 41648  // and [sqlite3_close_v2()] are its destructors.  There are many other
 41649  // interfaces (such as
 41650  // [sqlite3_prepare_v2()], [sqlite3_create_function()], and
 41651  // [sqlite3_busy_timeout()] to name but three) that are methods on an
 41652  // sqlite3 object.
 41653  type sqlite31 = sqlite32 /* sqlite3.h:249:24 */
 41654  
 41655  // CAPI3REF: Dynamically Typed Value Object
 41656  // KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
 41657  //
 41658  // SQLite uses the sqlite3_value object to represent all values
 41659  // that can be stored in a database table. SQLite uses dynamic typing
 41660  // for the values it stores.  ^Values stored in sqlite3_value objects
 41661  // can be integers, floating point values, strings, BLOBs, or NULL.
 41662  //
 41663  // An sqlite3_value object may be either "protected" or "unprotected".
 41664  // Some interfaces require a protected sqlite3_value.  Other interfaces
 41665  // will accept either a protected or an unprotected sqlite3_value.
 41666  // Every interface that accepts sqlite3_value arguments specifies
 41667  // whether or not it requires a protected sqlite3_value.  The
 41668  // [sqlite3_value_dup()] interface can be used to construct a new
 41669  // protected sqlite3_value from an unprotected sqlite3_value.
 41670  //
 41671  // The terms "protected" and "unprotected" refer to whether or not
 41672  // a mutex is held.  An internal mutex is held for a protected
 41673  // sqlite3_value object but no mutex is held for an unprotected
 41674  // sqlite3_value object.  If SQLite is compiled to be single-threaded
 41675  // (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
 41676  // or if SQLite is run in one of reduced mutex modes
 41677  // [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
 41678  // then there is no distinction between protected and unprotected
 41679  // sqlite3_value objects and they can be used interchangeably.  However,
 41680  // for maximum code portability it is recommended that applications
 41681  // still make the distinction between protected and unprotected
 41682  // sqlite3_value objects even when not strictly required.
 41683  //
 41684  // ^The sqlite3_value objects that are passed as parameters into the
 41685  // implementation of [application-defined SQL functions] are protected.
 41686  // ^The sqlite3_value object returned by
 41687  // [sqlite3_column_value()] is unprotected.
 41688  // Unprotected sqlite3_value objects may only be used as arguments
 41689  // to [sqlite3_result_value()], [sqlite3_bind_value()], and
 41690  // [sqlite3_value_dup()].
 41691  // The [sqlite3_value_blob | sqlite3_value_type()] family of
 41692  // interfaces require protected sqlite3_value objects.
 41693  type sqlite3_value = sqlite3_value1 /* sqlite3.h:4286:30 */
 41694  
 41695  // CAPI3REF: SQL Function Context Object
 41696  //
 41697  // The context in which an SQL function executes is stored in an
 41698  // sqlite3_context object.  ^A pointer to an sqlite3_context object
 41699  // is always first parameter to [application-defined SQL functions].
 41700  // The application-defined SQL function implementation will pass this
 41701  // pointer through into calls to [sqlite3_result_int | sqlite3_result()],
 41702  // [sqlite3_aggregate_context()], [sqlite3_user_data()],
 41703  // [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
 41704  // and/or [sqlite3_set_auxdata()].
 41705  type sqlite3_context = sqlite3_context1 /* sqlite3.h:4300:32 */
 41706  
 41707  // CAPI3REF: Dynamic String Object
 41708  // KEYWORDS: {dynamic string}
 41709  //
 41710  // An instance of the sqlite3_str object contains a dynamically-sized
 41711  // string under construction.
 41712  //
 41713  // The lifecycle of an sqlite3_str object is as follows:
 41714  // <ol>
 41715  // <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
 41716  // <li> ^Text is appended to the sqlite3_str object using various
 41717  // methods, such as [sqlite3_str_appendf()].
 41718  // <li> ^The sqlite3_str object is destroyed and the string it created
 41719  // is returned using the [sqlite3_str_finish()] interface.
 41720  // </ol>
 41721  type sqlite3_str = sqlite3_str1 /* sqlite3.h:7882:28 */
 41722  
 41723  type int_least8_t = int8   /* stdint.h:40:25 */
 41724  type int_least16_t = int16 /* stdint.h:41:26 */
 41725  type int_least32_t = int32 /* stdint.h:42:26 */
 41726  type int_least64_t = int64 /* stdint.h:43:26 */
 41727  
 41728  type uint_least8_t = uint8   /* stdint.h:45:26 */
 41729  type uint_least16_t = uint16 /* stdint.h:46:26 */
 41730  type uint_least32_t = uint32 /* stdint.h:47:26 */
 41731  type uint_least64_t = uint64 /* stdint.h:48:26 */
 41732  
 41733  type int_fast8_t = int32  /* stdint.h:50:24 */
 41734  type int_fast16_t = int32 /* stdint.h:51:25 */
 41735  type int_fast32_t = int32 /* stdint.h:52:25 */
 41736  type int_fast64_t = int64 /* stdint.h:53:25 */
 41737  
 41738  type uint_fast8_t = uint32  /* stdint.h:55:25 */
 41739  type uint_fast16_t = uint32 /* stdint.h:56:26 */
 41740  type uint_fast32_t = uint32 /* stdint.h:57:26 */
 41741  type uint_fast64_t = uint64 /* stdint.h:58:26 */
 41742  
 41743  type imaxdiv_t = struct {
 41744  	Fquot intmax_t
 41745  	Frem  intmax_t
 41746  } /* inttypes.h:47:3 */
 41747  
 41748  // Is the sqlite3ErrName() function needed in the build?  Currently,
 41749  // it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
 41750  // OSTRACE is enabled), and by several "test*.c" files (which are
 41751  // compiled using SQLITE_TEST).
 41752  
 41753  // SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
 41754  
 41755  // Return true (non-zero) if the input is an integer that is too large
 41756  // to fit in 32-bits.  This macro is used inside of various testcase()
 41757  // macros to verify that we have tested SQLite for large-file support.
 41758  
 41759  // The macro unlikely() is a hint that surrounds a boolean
 41760  // expression that is usually false.  Macro likely() surrounds
 41761  // a boolean expression that is usually true.  These hints could,
 41762  // in theory, be used by the compiler to generate better code, but
 41763  // currently they are just comments for human readers.
 41764  
 41765  // 2001 September 22
 41766  //
 41767  // The author disclaims copyright to this source code.  In place of
 41768  // a legal notice, here is a blessing:
 41769  //
 41770  //    May you do good and not evil.
 41771  //    May you find forgiveness for yourself and forgive others.
 41772  //    May you share freely, never taking more than you give.
 41773  //
 41774  //
 41775  // This is the header file for the generic hash-table implementation
 41776  // used in SQLite.
 41777  
 41778  // Forward declarations of structures.
 41779  type Hash1 = struct {
 41780  	Fhtsize uint32
 41781  	Fcount  uint32
 41782  	Ffirst  uintptr
 41783  	Fht     uintptr
 41784  } /* sqlite3.h:249:9 */
 41785  
 41786  // Is the sqlite3ErrName() function needed in the build?  Currently,
 41787  // it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
 41788  // OSTRACE is enabled), and by several "test*.c" files (which are
 41789  // compiled using SQLITE_TEST).
 41790  
 41791  // SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
 41792  
 41793  // Return true (non-zero) if the input is an integer that is too large
 41794  // to fit in 32-bits.  This macro is used inside of various testcase()
 41795  // macros to verify that we have tested SQLite for large-file support.
 41796  
 41797  // The macro unlikely() is a hint that surrounds a boolean
 41798  // expression that is usually false.  Macro likely() surrounds
 41799  // a boolean expression that is usually true.  These hints could,
 41800  // in theory, be used by the compiler to generate better code, but
 41801  // currently they are just comments for human readers.
 41802  
 41803  // 2001 September 22
 41804  //
 41805  // The author disclaims copyright to this source code.  In place of
 41806  // a legal notice, here is a blessing:
 41807  //
 41808  //    May you do good and not evil.
 41809  //    May you find forgiveness for yourself and forgive others.
 41810  //    May you share freely, never taking more than you give.
 41811  //
 41812  //
 41813  // This is the header file for the generic hash-table implementation
 41814  // used in SQLite.
 41815  
 41816  // Forward declarations of structures.
 41817  type Hash = Hash1 /* hash.h:19:21 */
 41818  type HashElem1 = struct {
 41819  	Fnext uintptr
 41820  	Fprev uintptr
 41821  	Fdata uintptr
 41822  	FpKey uintptr
 41823  } /* sqlite3.h:249:9 */
 41824  
 41825  type HashElem = HashElem1 /* hash.h:20:25 */
 41826  
 41827  // A complete hash table is an instance of the following structure.
 41828  // The internals of this structure are intended to be opaque -- client
 41829  // code should not attempt to access or modify the fields of this structure
 41830  // directly.  Change this structure only by using the routines below.
 41831  // However, some of the "procedures" and "functions" for modifying and
 41832  // accessing this structure are really macros, so we can't really make
 41833  // this structure opaque.
 41834  //
 41835  // All elements of the hash table are on a single doubly-linked list.
 41836  // Hash.first points to the head of this list.
 41837  //
 41838  // There are Hash.htsize buckets.  Each bucket points to a spot in
 41839  // the global doubly-linked list.  The contents of the bucket are the
 41840  // element pointed to plus the next _ht.count-1 elements in the list.
 41841  //
 41842  // Hash.htsize and Hash.ht may be zero.  In that case lookup is done
 41843  // by a linear search of the global list.  For small tables, the
 41844  // Hash.ht table is never allocated because if there are few elements
 41845  // in the table, it is faster to do a linear search than to manage
 41846  // the hash table.
 41847  type _ht = struct {
 41848  	Fcount uint32
 41849  	_      [4]byte
 41850  	Fchain uintptr
 41851  } /* sqlite3.h:249:9 */
 41852  
 41853  // 2-byte unsigned integer
 41854  type i16 = int16_t /* sqliteInt.h:795:20 */ // 1-byte unsigned integer
 41855  type i8 = int8_t   /* sqliteInt.h:797:19 */ // 1-byte signed integer
 41856  
 41857  // SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
 41858  // that can be stored in a u32 without loss of data.  The value
 41859  // is 0x00000000ffffffff.  But because of quirks of some compilers, we
 41860  // have to specify the value in the less intuitive manner shown:
 41861  
 41862  // The datatype used to store estimates of the number of rows in a
 41863  // table or index.  This is an unsigned integer type.  For 99.9% of
 41864  // the world, a 32-bit integer is sufficient.  But a 64-bit integer
 41865  // can be used at compile-time if desired.
 41866  type tRowcnt = u32 /* sqliteInt.h:816:14 */ // 32-bit is the default
 41867  
 41868  // Estimated quantities used for query planning are stored as 16-bit
 41869  // logarithms.  For quantity X, the value stored is 10*log2(X).  This
 41870  // gives a possible range of values of approximately 1.0e986 to 1e-986.
 41871  // But the allowed values are "grainy".  Not every value is representable.
 41872  // For example, quantities 16 and 17 are both represented by a LogEst
 41873  // of 40.  However, since LogEst quantities are suppose to be estimates,
 41874  // not exact values, this imprecision is not a problem.
 41875  //
 41876  // "LogEst" is short for "Logarithmic Estimate".
 41877  //
 41878  // Examples:
 41879  //      1 -> 0              20 -> 43          10000 -> 132
 41880  //      2 -> 10             25 -> 46          25000 -> 146
 41881  //      3 -> 16            100 -> 66        1000000 -> 199
 41882  //      4 -> 20           1000 -> 99        1048576 -> 200
 41883  //     10 -> 33           1024 -> 100    4294967296 -> 320
 41884  //
 41885  // The LogEst can be negative to indicate fractional values.
 41886  // Examples:
 41887  //
 41888  //    0.5 -> -10           0.1 -> -33        0.0625 -> -40
 41889  type LogEst = int16_t /* sqliteInt.h:842:20 */
 41890  
 41891  // Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer
 41892  
 41893  // The uptr type is an unsigned integer large enough to hold a pointer
 41894  type uptr = uintptr_t /* sqliteInt.h:862:21 */
 41895  
 41896  // An instance of the following structure is used to store the busy-handler
 41897  // callback for a given sqlite handle.
 41898  //
 41899  // The sqlite.busyHandler member of the sqlite struct contains the busy
 41900  // callback for the database handle. Each pager opened via the sqlite
 41901  // handle is passed a pointer to sqlite.busyHandler. The busy-handler
 41902  // callback is currently invoked only from within pager.c.
 41903  type BusyHandler1 = struct {
 41904  	FxBusyHandler uintptr
 41905  	FpBusyArg     uintptr
 41906  	FnBusy        int32
 41907  	_             [4]byte
 41908  } /* sqlite3.h:249:9 */
 41909  
 41910  // An instance of the following structure is used to store the busy-handler
 41911  // callback for a given sqlite handle.
 41912  //
 41913  // The sqlite.busyHandler member of the sqlite struct contains the busy
 41914  // callback for the database handle. Each pager opened via the sqlite
 41915  // handle is passed a pointer to sqlite.busyHandler. The busy-handler
 41916  // callback is currently invoked only from within pager.c.
 41917  type BusyHandler = BusyHandler1 /* sqliteInt.h:1037:28 */
 41918  
 41919  // Name of table that holds the database schema.
 41920  
 41921  // The root-page of the schema table.
 41922  
 41923  // The name of the schema table.  The name is different for TEMP.
 41924  
 41925  // A convenience macro that returns the number of elements in
 41926  // an array.
 41927  
 41928  // Determine if the argument is a power of two
 41929  
 41930  // The following value as a destructor means to use sqlite3DbFree().
 41931  // The sqlite3DbFree() routine requires two parameters instead of the
 41932  // one parameter that destructors normally want.  So we have to introduce
 41933  // this magic value that the code knows to handle differently.  Any
 41934  // pointer will work here as long as it is distinct from SQLITE_STATIC
 41935  // and SQLITE_TRANSIENT.
 41936  
 41937  // When SQLITE_OMIT_WSD is defined, it means that the target platform does
 41938  // not support Writable Static Data (WSD) such as global and static variables.
 41939  // All variables must either be on the stack or dynamically allocated from
 41940  // the heap.  When WSD is unsupported, the variable declarations scattered
 41941  // throughout the SQLite code must become constants instead.  The SQLITE_WSD
 41942  // macro is used for this purpose.  And instead of referencing the variable
 41943  // directly, we use its constant as a key to lookup the run-time allocated
 41944  // buffer that holds real variable.  The constant is also the initializer
 41945  // for the run-time allocated buffer.
 41946  //
 41947  // In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
 41948  // macros become no-ops and have zero performance impact.
 41949  
 41950  // The following macros are used to suppress compiler warnings and to
 41951  // make it clear to human readers when a function parameter is deliberately
 41952  // left unused within the body of a function. This usually happens when
 41953  // a function is called via a function pointer. For example the
 41954  // implementation of an SQL aggregate step callback may not use the
 41955  // parameter indicating the number of arguments passed to the aggregate,
 41956  // if it knows that this is enforced elsewhere.
 41957  //
 41958  // When a function parameter is not used at all within the body of a function,
 41959  // it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
 41960  // However, these macros may also be used to suppress warnings related to
 41961  // parameters that may or may not be used depending on compilation options.
 41962  // For example those parameters only used in assert() statements. In these
 41963  // cases the parameters are named as per the usual conventions.
 41964  
 41965  // Forward references to structures
 41966  type AggInfo1 = struct {
 41967  	FdirectMode     u8
 41968  	FuseSortingIdx  u8
 41969  	_               [2]byte
 41970  	FsortingIdx     int32
 41971  	FsortingIdxPTab int32
 41972  	FnSortingColumn int32
 41973  	FmnReg          int32
 41974  	FmxReg          int32
 41975  	FpGroupBy       uintptr
 41976  	FaCol           uintptr
 41977  	FnColumn        int32
 41978  	FnAccumulator   int32
 41979  	FaFunc          uintptr
 41980  	FnFunc          int32
 41981  	FselId          u32
 41982  } /* sqlite3.h:249:9 */
 41983  
 41984  // Name of table that holds the database schema.
 41985  
 41986  // The root-page of the schema table.
 41987  
 41988  // The name of the schema table.  The name is different for TEMP.
 41989  
 41990  // A convenience macro that returns the number of elements in
 41991  // an array.
 41992  
 41993  // Determine if the argument is a power of two
 41994  
 41995  // The following value as a destructor means to use sqlite3DbFree().
 41996  // The sqlite3DbFree() routine requires two parameters instead of the
 41997  // one parameter that destructors normally want.  So we have to introduce
 41998  // this magic value that the code knows to handle differently.  Any
 41999  // pointer will work here as long as it is distinct from SQLITE_STATIC
 42000  // and SQLITE_TRANSIENT.
 42001  
 42002  // When SQLITE_OMIT_WSD is defined, it means that the target platform does
 42003  // not support Writable Static Data (WSD) such as global and static variables.
 42004  // All variables must either be on the stack or dynamically allocated from
 42005  // the heap.  When WSD is unsupported, the variable declarations scattered
 42006  // throughout the SQLite code must become constants instead.  The SQLITE_WSD
 42007  // macro is used for this purpose.  And instead of referencing the variable
 42008  // directly, we use its constant as a key to lookup the run-time allocated
 42009  // buffer that holds real variable.  The constant is also the initializer
 42010  // for the run-time allocated buffer.
 42011  //
 42012  // In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
 42013  // macros become no-ops and have zero performance impact.
 42014  
 42015  // The following macros are used to suppress compiler warnings and to
 42016  // make it clear to human readers when a function parameter is deliberately
 42017  // left unused within the body of a function. This usually happens when
 42018  // a function is called via a function pointer. For example the
 42019  // implementation of an SQL aggregate step callback may not use the
 42020  // parameter indicating the number of arguments passed to the aggregate,
 42021  // if it knows that this is enforced elsewhere.
 42022  //
 42023  // When a function parameter is not used at all within the body of a function,
 42024  // it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
 42025  // However, these macros may also be used to suppress warnings related to
 42026  // parameters that may or may not be used depending on compilation options.
 42027  // For example those parameters only used in assert() statements. In these
 42028  // cases the parameters are named as per the usual conventions.
 42029  
 42030  // Forward references to structures
 42031  type AggInfo = AggInfo1 /* sqliteInt.h:1133:24 */
 42032  type AuthContext1 = struct {
 42033  	FzAuthContext uintptr
 42034  	FpParse       uintptr
 42035  } /* sqliteInt.h:1134:9 */
 42036  
 42037  type AuthContext = AuthContext1 /* sqliteInt.h:1134:28 */
 42038  type AutoincInfo1 = struct {
 42039  	FpNext  uintptr
 42040  	FpTab   uintptr
 42041  	FiDb    int32
 42042  	FregCtr int32
 42043  } /* sqlite3.h:249:9 */
 42044  
 42045  type AutoincInfo = AutoincInfo1 /* sqliteInt.h:1135:28 */
 42046  type CollSeq1 = struct {
 42047  	FzName uintptr
 42048  	Fenc   u8
 42049  	_      [7]byte
 42050  	FpUser uintptr
 42051  	FxCmp  uintptr
 42052  	FxDel  uintptr
 42053  } /* sqlite3.h:249:9 */
 42054  
 42055  type CollSeq = CollSeq1 /* sqliteInt.h:1137:24 */
 42056  type Column1 = struct {
 42057  	FzName    uintptr
 42058  	FpDflt    uintptr
 42059  	FzColl    uintptr
 42060  	FnotNull  u8
 42061  	Faffinity int8
 42062  	FszEst    u8
 42063  	FhName    u8
 42064  	FcolFlags u16
 42065  	_         [2]byte
 42066  } /* sqlite3.h:249:9 */
 42067  
 42068  type Column = Column1 /* sqliteInt.h:1138:23 */
 42069  type Cte1 = struct {
 42070  	FzName   uintptr
 42071  	FpCols   uintptr
 42072  	FpSelect uintptr
 42073  	FzCteErr uintptr
 42074  	FpUse    uintptr
 42075  	FeM10d   u8
 42076  	_        [7]byte
 42077  } /* sqlite3.h:249:9 */
 42078  
 42079  type Cte = Cte1 /* sqliteInt.h:1139:20 */
 42080  type CteUse1 = struct {
 42081  	FnUse    int32
 42082  	FaddrM9e int32
 42083  	FregRtn  int32
 42084  	FiCur    int32
 42085  	FnRowEst LogEst
 42086  	FeM10d   u8
 42087  	_        [1]byte
 42088  } /* sqlite3.h:249:9 */
 42089  
 42090  type CteUse = CteUse1 /* sqliteInt.h:1140:23 */
 42091  type Db1 = struct {
 42092  	FzDbSName     uintptr
 42093  	FpBt          uintptr
 42094  	Fsafety_level u8
 42095  	FbSyncSet     u8
 42096  	_             [6]byte
 42097  	FpSchema      uintptr
 42098  } /* sqlite3.h:249:9 */
 42099  
 42100  type Db = Db1 /* sqliteInt.h:1141:19 */
 42101  type DbFixer1 = struct {
 42102  	FpParse  uintptr
 42103  	Fw       Walker
 42104  	FpSchema uintptr
 42105  	FbTemp   u8
 42106  	_        [7]byte
 42107  	FzDb     uintptr
 42108  	FzType   uintptr
 42109  	FpName   uintptr
 42110  } /* sqliteInt.h:1142:9 */
 42111  
 42112  type DbFixer = DbFixer1 /* sqliteInt.h:1142:24 */
 42113  type Schema1 = struct {
 42114  	Fschema_cookie int32
 42115  	FiGeneration   int32
 42116  	FtblHash       Hash
 42117  	FidxHash       Hash
 42118  	FtrigHash      Hash
 42119  	FfkeyHash      Hash
 42120  	FpSeqTab       uintptr
 42121  	Ffile_format   u8
 42122  	Fenc           u8
 42123  	FschemaFlags   u16
 42124  	Fcache_size    int32
 42125  } /* sqlite3.h:249:9 */
 42126  
 42127  type Schema = Schema1 /* sqliteInt.h:1143:23 */
 42128  type Expr1 = struct {
 42129  	Fop              u8
 42130  	FaffExpr         int8
 42131  	Fop2             u8
 42132  	_                [1]byte
 42133  	Fflags           u32
 42134  	Fu               struct{ FzToken uintptr }
 42135  	FpLeft           uintptr
 42136  	FpRight          uintptr
 42137  	Fx               struct{ FpList uintptr }
 42138  	FnHeight         int32
 42139  	FiTable          int32
 42140  	FiColumn         ynVar
 42141  	FiAgg            i16
 42142  	FiRightJoinTable int32
 42143  	FpAggInfo        uintptr
 42144  	Fy               struct{ FpTab uintptr }
 42145  } /* sqlite3.h:249:9 */
 42146  
 42147  type Expr = Expr1 /* sqliteInt.h:1144:21 */
 42148  type ExprList1 = struct {
 42149  	FnExpr  int32
 42150  	FnAlloc int32
 42151  	Fa      [1]struct {
 42152  		FpExpr     uintptr
 42153  		FzEName    uintptr
 42154  		FsortFlags u8
 42155  		_          [3]byte
 42156  		FeEName    uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */
 42157  		_          [3]byte
 42158  		Fu         struct {
 42159  			_  [0]uint32
 42160  			Fx struct {
 42161  				FiOrderByCol u16
 42162  				FiAlias      u16
 42163  			}
 42164  		}
 42165  		_ [4]byte
 42166  	}
 42167  } /* sqlite3.h:249:9 */
 42168  
 42169  type ExprList = ExprList1 /* sqliteInt.h:1145:25 */
 42170  type FKey1 = struct {
 42171  	FpFrom      uintptr
 42172  	FpNextFrom  uintptr
 42173  	FzTo        uintptr
 42174  	FpNextTo    uintptr
 42175  	FpPrevTo    uintptr
 42176  	FnCol       int32
 42177  	FisDeferred u8
 42178  	FaAction    [2]u8
 42179  	_           [1]byte
 42180  	FapTrigger  [2]uintptr
 42181  	FaCol       [1]struct {
 42182  		FiFrom int32
 42183  		_      [4]byte
 42184  		FzCol  uintptr
 42185  	}
 42186  } /* sqlite3.h:249:9 */
 42187  
 42188  type FKey = FKey1 /* sqliteInt.h:1146:21 */
 42189  type FuncDestructor1 = struct {
 42190  	FnRef      int32
 42191  	_          [4]byte
 42192  	FxDestroy  uintptr
 42193  	FpUserData uintptr
 42194  } /* sqliteInt.h:1147:9 */
 42195  
 42196  type FuncDestructor = FuncDestructor1 /* sqliteInt.h:1147:31 */
 42197  type FuncDef1 = struct {
 42198  	FnArg      i8
 42199  	_          [3]byte
 42200  	FfuncFlags u32
 42201  	FpUserData uintptr
 42202  	FpNext     uintptr
 42203  	FxSFunc    uintptr
 42204  	FxFinalize uintptr
 42205  	FxValue    uintptr
 42206  	FxInverse  uintptr
 42207  	FzName     uintptr
 42208  	Fu         struct{ FpHash uintptr }
 42209  } /* sqlite3.h:249:9 */
 42210  
 42211  type FuncDef = FuncDef1                      /* sqliteInt.h:1148:24 */
 42212  type FuncDefHash1 = struct{ Fa [23]uintptr } /* sqliteInt.h:1149:9 */
 42213  
 42214  type FuncDefHash = FuncDefHash1 /* sqliteInt.h:1149:28 */
 42215  type IdList1 = struct {
 42216  	Fa   uintptr
 42217  	FnId int32
 42218  	_    [4]byte
 42219  } /* sqlite3.h:249:9 */
 42220  
 42221  type IdList = IdList1 /* sqliteInt.h:1150:23 */
 42222  type Index1 = struct {
 42223  	FzName         uintptr
 42224  	FaiColumn      uintptr
 42225  	FaiRowLogEst   uintptr
 42226  	FpTable        uintptr
 42227  	FzColAff       uintptr
 42228  	FpNext         uintptr
 42229  	FpSchema       uintptr
 42230  	FaSortOrder    uintptr
 42231  	FazColl        uintptr
 42232  	FpPartIdxWhere uintptr
 42233  	FaColExpr      uintptr
 42234  	Ftnum          Pgno
 42235  	FszIdxRow      LogEst
 42236  	FnKeyCol       u16
 42237  	FnColumn       u16
 42238  	FonError       u8
 42239  	_              [1]byte
 42240  	FidxType       uint16 /* unsigned idxType: 2, unsigned bUnordered: 1, unsigned uniqNotNull: 1, unsigned isResized: 1, unsigned isCovering: 1, unsigned noSkipScan: 1, unsigned hasStat1: 1, unsigned bNoQuery: 1, unsigned bAscKeyBug: 1, unsigned bHasVCol: 1 */
 42241  	_              [2]byte
 42242  	FnSample       int32
 42243  	FnSampleCol    int32
 42244  	FaAvgEq        uintptr
 42245  	FaSample       uintptr
 42246  	FaiRowEst      uintptr
 42247  	FnRowEst0      tRowcnt
 42248  	_              [4]byte
 42249  	FcolNotIdxed   Bitmask
 42250  } /* sqlite3.h:249:9 */
 42251  
 42252  type Index = Index1 /* sqliteInt.h:1151:22 */
 42253  type IndexSample1 = struct {
 42254  	Fp     uintptr
 42255  	Fn     int32
 42256  	_      [4]byte
 42257  	FanEq  uintptr
 42258  	FanLt  uintptr
 42259  	FanDLt uintptr
 42260  } /* sqlite3.h:249:9 */
 42261  
 42262  type IndexSample = IndexSample1 /* sqliteInt.h:1152:28 */
 42263  type KeyInfo1 = struct {
 42264  	FnRef       u32
 42265  	Fenc        u8
 42266  	_           [1]byte
 42267  	FnKeyField  u16
 42268  	FnAllField  u16
 42269  	_           [6]byte
 42270  	Fdb         uintptr
 42271  	FaSortFlags uintptr
 42272  	FaColl      [1]uintptr
 42273  } /* sqlite3.h:249:9 */
 42274  
 42275  type KeyInfo = KeyInfo1 /* sqliteInt.h:1154:24 */
 42276  type Lookaside1 = struct {
 42277  	FbDisable   u32
 42278  	Fsz         u16
 42279  	FszTrue     u16
 42280  	FbMalloced  u8
 42281  	_           [3]byte
 42282  	FnSlot      u32
 42283  	FanStat     [3]u32
 42284  	_           [4]byte
 42285  	FpInit      uintptr
 42286  	FpFree      uintptr
 42287  	FpSmallInit uintptr
 42288  	FpSmallFree uintptr
 42289  	FpMiddle    uintptr
 42290  	FpStart     uintptr
 42291  	FpEnd       uintptr
 42292  } /* sqlite3.h:249:9 */
 42293  
 42294  type Lookaside = Lookaside1                    /* sqliteInt.h:1155:26 */
 42295  type LookasideSlot1 = struct{ FpNext uintptr } /* sqlite3.h:249:9 */
 42296  
 42297  type LookasideSlot = LookasideSlot1 /* sqliteInt.h:1156:30 */
 42298  type Module1 = struct {
 42299  	FpModule    uintptr
 42300  	FzName      uintptr
 42301  	FnRefModule int32
 42302  	_           [4]byte
 42303  	FpAux       uintptr
 42304  	FxDestroy   uintptr
 42305  	FpEpoTab    uintptr
 42306  } /* sqlite3.h:249:9 */
 42307  
 42308  type Module = Module1 /* sqliteInt.h:1157:23 */
 42309  type NameContext1 = struct {
 42310  	FpParse     uintptr
 42311  	FpSrcList   uintptr
 42312  	FuNC        struct{ FpEList uintptr }
 42313  	FpNext      uintptr
 42314  	FnRef       int32
 42315  	FnNcErr     int32
 42316  	FncFlags    int32
 42317  	_           [4]byte
 42318  	FpWinSelect uintptr
 42319  } /* sqliteInt.h:1158:9 */
 42320  
 42321  type NameContext = NameContext1 /* sqliteInt.h:1158:28 */
 42322  type Parse1 = struct {
 42323  	Fdb               uintptr
 42324  	FzErrMsg          uintptr
 42325  	FpVdbe            uintptr
 42326  	Frc               int32
 42327  	FcolNamesSet      u8
 42328  	FcheckSchema      u8
 42329  	Fnested           u8
 42330  	FnTempReg         u8
 42331  	FisMultiWrite     u8
 42332  	FmayAbort         u8
 42333  	FhasCompound      u8
 42334  	FokConstFactor    u8
 42335  	FdisableLookaside u8
 42336  	FdisableVtab      u8
 42337  	_                 [2]byte
 42338  	FnRangeReg        int32
 42339  	FiRangeReg        int32
 42340  	FnErr             int32
 42341  	FnTab             int32
 42342  	FnMem             int32
 42343  	FszOpAlloc        int32
 42344  	FiSelfTab         int32
 42345  	FnLabel           int32
 42346  	FnLabelAlloc      int32
 42347  	_                 [4]byte
 42348  	FaLabel           uintptr
 42349  	FpConstExpr       uintptr
 42350  	FconstraintName   Token
 42351  	FwriteMask        yDbMask
 42352  	FcookieMask       yDbMask
 42353  	FregRowid         int32
 42354  	FregRoot          int32
 42355  	FnMaxArg          int32
 42356  	FnSelect          int32
 42357  	FnTableLock       int32
 42358  	_                 [4]byte
 42359  	FaTableLock       uintptr
 42360  	FpAinc            uintptr
 42361  	FpToplevel        uintptr
 42362  	FpTriggerTab      uintptr
 42363  	FpParentParse     uintptr
 42364  	Fu1               struct {
 42365  		_          [0]uint64
 42366  		FaddrCrTab int32
 42367  		_          [4]byte
 42368  	}
 42369  	FnQueryLoop      u32
 42370  	Foldmask         u32
 42371  	Fnewmask         u32
 42372  	FeTriggerOp      u8
 42373  	FbReturning      u8
 42374  	FeOrconf         u8
 42375  	FdisableTriggers u8
 42376  	FaTempReg        [8]int32
 42377  	FsNameToken      Token
 42378  	FsLastToken      Token
 42379  	FnVar            ynVar
 42380  	FiPkSortOrder    u8
 42381  	Fexplain         u8
 42382  	FeParseMode      u8
 42383  	_                [3]byte
 42384  	FnVtabLock       int32
 42385  	FnHeight         int32
 42386  	FaddrExplain     int32
 42387  	_                [4]byte
 42388  	FpVList          uintptr
 42389  	FpReprepare      uintptr
 42390  	FzTail           uintptr
 42391  	FpNewTable       uintptr
 42392  	FpNewIndex       uintptr
 42393  	FpNewTrigger     uintptr
 42394  	FzAuthContext    uintptr
 42395  	FsArg            Token
 42396  	FapVtabLock      uintptr
 42397  	FpTriggerPrg     uintptr
 42398  	FpWith           uintptr
 42399  	FpCleanup        uintptr
 42400  	FpRename         uintptr
 42401  } /* sqlite3.h:249:9 */
 42402  
 42403  type Parse = Parse1 /* sqliteInt.h:1159:22 */
 42404  type ParseCleanup1 = struct {
 42405  	FpNext    uintptr
 42406  	FpPtr     uintptr
 42407  	FxCleanup uintptr
 42408  } /* sqlite3.h:249:9 */
 42409  
 42410  type ParseCleanup = ParseCleanup1 /* sqliteInt.h:1160:29 */
 42411  type PreUpdate1 = struct {
 42412  	Fv            uintptr
 42413  	FpCsr         uintptr
 42414  	Fop           int32
 42415  	_             [4]byte
 42416  	FaRecord      uintptr
 42417  	Fkeyinfo      KeyInfo
 42418  	FpUnpacked    uintptr
 42419  	FpNewUnpacked uintptr
 42420  	FiNewReg      int32
 42421  	FiBlobWrite   int32
 42422  	FiKey1        i64
 42423  	FiKey2        i64
 42424  	FaNew         uintptr
 42425  	FpTab         uintptr
 42426  	FpPk          uintptr
 42427  } /* sqlite3.h:249:9 */
 42428  
 42429  type PreUpdate = PreUpdate1 /* sqliteInt.h:1161:26 */
 42430  type PrintfArguments1 = struct {
 42431  	FnArg  int32
 42432  	FnUsed int32
 42433  	FapArg uintptr
 42434  } /* sqliteInt.h:1162:9 */
 42435  
 42436  type PrintfArguments = PrintfArguments1 /* sqliteInt.h:1162:32 */
 42437  type Returning1 = struct {
 42438  	FpParse    uintptr
 42439  	FpReturnEL uintptr
 42440  	FretTrig   Trigger
 42441  	FretTStep  TriggerStep
 42442  	FiRetCur   int32
 42443  	FnRetCol   int32
 42444  	FiRetReg   int32
 42445  	_          [4]byte
 42446  } /* sqliteInt.h:1164:9 */
 42447  
 42448  type Returning = Returning1 /* sqliteInt.h:1164:26 */
 42449  type Savepoint1 = struct {
 42450  	FzName            uintptr
 42451  	FnDeferredCons    i64
 42452  	FnDeferredImmCons i64
 42453  	FpNext            uintptr
 42454  } /* sqlite3.h:249:9 */
 42455  
 42456  type Savepoint = Savepoint1 /* sqliteInt.h:1166:26 */
 42457  type Select1 = struct {
 42458  	Fop           u8
 42459  	_             [1]byte
 42460  	FnSelectRow   LogEst
 42461  	FselFlags     u32
 42462  	FiLimit       int32
 42463  	FiOffset      int32
 42464  	FselId        u32
 42465  	FaddrOpenEphm [2]int32
 42466  	_             [4]byte
 42467  	FpEList       uintptr
 42468  	FpSrc         uintptr
 42469  	FpWhere       uintptr
 42470  	FpGroupBy     uintptr
 42471  	FpHaving      uintptr
 42472  	FpOrderBy     uintptr
 42473  	FpPrior       uintptr
 42474  	FpNext        uintptr
 42475  	FpLimit       uintptr
 42476  	FpWith        uintptr
 42477  	FpWin         uintptr
 42478  	FpWinDefn     uintptr
 42479  } /* sqlite3.h:249:9 */
 42480  
 42481  type Select = Select1 /* sqliteInt.h:1167:23 */
 42482  type SelectDest1 = struct {
 42483  	FeDest    u8
 42484  	_         [3]byte
 42485  	FiSDParm  int32
 42486  	FiSDParm2 int32
 42487  	FiSdst    int32
 42488  	FnSdst    int32
 42489  	_         [4]byte
 42490  	FzAffSdst uintptr
 42491  	FpOrderBy uintptr
 42492  } /* sqliteInt.h:1169:9 */
 42493  
 42494  type SelectDest = SelectDest1 /* sqliteInt.h:1169:27 */
 42495  type SrcItem1 = struct {
 42496  	FpSchema     uintptr
 42497  	FzDatabase   uintptr
 42498  	FzName       uintptr
 42499  	FzAlias      uintptr
 42500  	FpTab        uintptr
 42501  	FpSelect     uintptr
 42502  	FaddrFillSub int32
 42503  	FregReturn   int32
 42504  	FregResult   int32
 42505  	Ffg          struct {
 42506  		_           [0]uint32
 42507  		Fjointype   u8
 42508  		_           [3]byte
 42509  		FnotIndexed uint16 /* unsigned notIndexed: 1, unsigned isIndexedBy: 1, unsigned isTabFunc: 1, unsigned isCorrelated: 1, unsigned viaCoroutine: 1, unsigned isRecursive: 1, unsigned fromDDL: 1, unsigned isCte: 1, unsigned notCte: 1 */
 42510  		_           [2]byte
 42511  	}
 42512  	FiCursor int32
 42513  	FpOn     uintptr
 42514  	FpUsing  uintptr
 42515  	FcolUsed Bitmask
 42516  	Fu1      struct{ FzIndexedBy uintptr }
 42517  	Fu2      struct{ FpIBIndex uintptr }
 42518  } /* sqlite3.h:249:9 */
 42519  
 42520  type SrcItem = SrcItem1 /* sqliteInt.h:1170:24 */
 42521  type SrcList1 = struct {
 42522  	FnSrc   int32
 42523  	FnAlloc u32
 42524  	Fa      [1]SrcItem
 42525  } /* sqlite3.h:249:9 */
 42526  
 42527  type SrcList = SrcList1      /* sqliteInt.h:1171:24 */
 42528  type StrAccum = sqlite3_str1 /* sqliteInt.h:1172:28 */ // Internal alias for sqlite3_str
 42529  type Table1 = struct {
 42530  	FzName        uintptr
 42531  	FaCol         uintptr
 42532  	FpIndex       uintptr
 42533  	FpSelect      uintptr
 42534  	FpFKey        uintptr
 42535  	FzColAff      uintptr
 42536  	FpCheck       uintptr
 42537  	Ftnum         Pgno
 42538  	FnTabRef      u32
 42539  	FtabFlags     u32
 42540  	FiPKey        i16
 42541  	FnCol         i16
 42542  	FnNVCol       i16
 42543  	FnRowLogEst   LogEst
 42544  	FszTabRow     LogEst
 42545  	FkeyConf      u8
 42546  	_             [1]byte
 42547  	FaddColOffset int32
 42548  	FnModuleArg   int32
 42549  	FazModuleArg  uintptr
 42550  	FpVTable      uintptr
 42551  	FpTrigger     uintptr
 42552  	FpSchema      uintptr
 42553  } /* sqlite3.h:249:9 */
 42554  
 42555  // Internal alias for sqlite3_str
 42556  type Table = Table1 /* sqliteInt.h:1173:22 */
 42557  type Token1 = struct {
 42558  	Fz uintptr
 42559  	Fn uint32
 42560  	_  [4]byte
 42561  } /* sqlite3.h:249:9 */
 42562  
 42563  type Token = Token1 /* sqliteInt.h:1175:22 */
 42564  type Trigger1 = struct {
 42565  	FzName      uintptr
 42566  	Ftable      uintptr
 42567  	Fop         u8
 42568  	Ftr_tm      u8
 42569  	FbReturning u8
 42570  	_           [5]byte
 42571  	FpWhen      uintptr
 42572  	FpColumns   uintptr
 42573  	FpSchema    uintptr
 42574  	FpTabSchema uintptr
 42575  	Fstep_list  uintptr
 42576  	FpNext      uintptr
 42577  } /* sqlite3.h:249:9 */
 42578  
 42579  type Trigger = Trigger1 /* sqliteInt.h:1177:24 */
 42580  type TriggerPrg1 = struct {
 42581  	FpTrigger uintptr
 42582  	FpNext    uintptr
 42583  	FpProgram uintptr
 42584  	Forconf   int32
 42585  	FaColmask [2]u32
 42586  	_         [4]byte
 42587  } /* sqlite3.h:249:9 */
 42588  
 42589  type TriggerPrg = TriggerPrg1 /* sqliteInt.h:1178:27 */
 42590  type TriggerStep1 = struct {
 42591  	Fop        u8
 42592  	Forconf    u8
 42593  	_          [6]byte
 42594  	FpTrig     uintptr
 42595  	FpSelect   uintptr
 42596  	FzTarget   uintptr
 42597  	FpFrom     uintptr
 42598  	FpWhere    uintptr
 42599  	FpExprList uintptr
 42600  	FpIdList   uintptr
 42601  	FpUpsert   uintptr
 42602  	FzSpan     uintptr
 42603  	FpNext     uintptr
 42604  	FpLast     uintptr
 42605  } /* sqlite3.h:249:9 */
 42606  
 42607  type TriggerStep = TriggerStep1 /* sqliteInt.h:1179:28 */
 42608  type UnpackedRecord1 = struct {
 42609  	FpKeyInfo   uintptr
 42610  	FaMem       uintptr
 42611  	FnField     u16
 42612  	Fdefault_rc i8
 42613  	FerrCode    u8
 42614  	Fr1         i8
 42615  	Fr2         i8
 42616  	FeqSeen     u8
 42617  	_           [1]byte
 42618  } /* sqlite3.h:249:9 */
 42619  
 42620  type UnpackedRecord = UnpackedRecord1 /* sqliteInt.h:1180:31 */
 42621  type Upsert1 = struct {
 42622  	FpUpsertTarget      uintptr
 42623  	FpUpsertTargetWhere uintptr
 42624  	FpUpsertSet         uintptr
 42625  	FpUpsertWhere       uintptr
 42626  	FpNextUpsert        uintptr
 42627  	FisDoUpdate         u8
 42628  	_                   [7]byte
 42629  	FpToFree            uintptr
 42630  	FpUpsertIdx         uintptr
 42631  	FpUpsertSrc         uintptr
 42632  	FregData            int32
 42633  	FiDataCur           int32
 42634  	FiIdxCur            int32
 42635  	_                   [4]byte
 42636  } /* sqlite3.h:249:9 */
 42637  
 42638  type Upsert = Upsert1 /* sqliteInt.h:1181:23 */
 42639  type VTable1 = struct {
 42640  	Fdb          uintptr
 42641  	FpMod        uintptr
 42642  	FpVtab       uintptr
 42643  	FnRef        int32
 42644  	FbConstraint u8
 42645  	FeVtabRisk   u8
 42646  	_            [2]byte
 42647  	FiSavepoint  int32
 42648  	_            [4]byte
 42649  	FpNext       uintptr
 42650  } /* sqlite3.h:249:9 */
 42651  
 42652  type VTable = VTable1 /* sqliteInt.h:1182:23 */
 42653  type Walker1 = struct {
 42654  	FpParse           uintptr
 42655  	FxExprCallback    uintptr
 42656  	FxSelectCallback  uintptr
 42657  	FxSelectCallback2 uintptr
 42658  	FwalkerDepth      int32
 42659  	FeCode            u16
 42660  	_                 [2]byte
 42661  	Fu                struct{ FpNC uintptr }
 42662  } /* sqliteInt.h:1142:9 */
 42663  
 42664  type Walker = Walker1 /* sqliteInt.h:1184:23 */
 42665  type Window1 = struct {
 42666  	FzName          uintptr
 42667  	FzBase          uintptr
 42668  	FpPartition     uintptr
 42669  	FpOrderBy       uintptr
 42670  	FeFrmType       u8
 42671  	FeStart         u8
 42672  	FeEnd           u8
 42673  	FbImplicitFrame u8
 42674  	FeExclude       u8
 42675  	_               [3]byte
 42676  	FpStart         uintptr
 42677  	FpEnd           uintptr
 42678  	FppThis         uintptr
 42679  	FpNextWin       uintptr
 42680  	FpFilter        uintptr
 42681  	FpFunc          uintptr
 42682  	FiEphCsr        int32
 42683  	FregAccum       int32
 42684  	FregResult      int32
 42685  	FcsrApp         int32
 42686  	FregApp         int32
 42687  	FregPart        int32
 42688  	FpOwner         uintptr
 42689  	FnBufferCol     int32
 42690  	FiArgCol        int32
 42691  	FregOne         int32
 42692  	FregStartRowid  int32
 42693  	FregEndRowid    int32
 42694  	FbExprArgs      u8
 42695  	_               [3]byte
 42696  } /* sqlite3.h:249:9 */
 42697  
 42698  type Window = Window1 /* sqliteInt.h:1186:23 */
 42699  type With1 = struct {
 42700  	FnCte   int32
 42701  	FbView  int32
 42702  	FpOuter uintptr
 42703  	Fa      [1]Cte
 42704  } /* sqlite3.h:249:9 */
 42705  
 42706  type With = With1 /* sqliteInt.h:1187:21 */
 42707  
 42708  // The bitmask datatype defined below is used for various optimizations.
 42709  //
 42710  // Changing this from a 64-bit to a 32-bit type limits the number of
 42711  // tables in a join to 32 instead of 64.  But it also reduces the size
 42712  // of the library by 738 bytes on ix86.
 42713  type Bitmask = u64 /* sqliteInt.h:1200:15 */
 42714  
 42715  // The number of bits in a Bitmask.  "BMS" means "BitMask Size".
 42716  
 42717  // A bit in a Bitmask
 42718  
 42719  // A VList object records a mapping between parameters/variables/wildcards
 42720  // in the SQL statement (such as $abc, @pqr, or :xyz) and the integer
 42721  // variable number associated with that parameter.  See the format description
 42722  // on the sqlite3VListAdd() routine for more information.  A VList is really
 42723  // just an array of integers.
 42724  type VList = int32 /* sqliteInt.h:1222:13 */
 42725  
 42726  // Defer sourcing vdbe.h and btree.h until after the "u8" and
 42727  // "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
 42728  // pointer types (i.e. FuncDef) defined above.
 42729  // 2001 September 15
 42730  //
 42731  // The author disclaims copyright to this source code.  In place of
 42732  // a legal notice, here is a blessing:
 42733  //
 42734  //    May you do good and not evil.
 42735  //    May you find forgiveness for yourself and forgive others.
 42736  //    May you share freely, never taking more than you give.
 42737  //
 42738  //
 42739  // This header file defines the interface that the sqlite page cache
 42740  // subsystem.  The page cache subsystem reads and writes a file a page
 42741  // at a time and provides a journal for rollback.
 42742  
 42743  // Default maximum size for persistent journal files. A negative
 42744  // value means no limit. This value may be overridden using the
 42745  // sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit".
 42746  
 42747  // The type used to represent a page number.  The first page in a file
 42748  // is called page 1.  0 is used to represent "not a page".
 42749  type Pgno = u32 /* pager.h:33:13 */
 42750  
 42751  // Handle type for pages.
 42752  type PgHdr1 = struct {
 42753  	FpPage      uintptr
 42754  	FpData      uintptr
 42755  	FpExtra     uintptr
 42756  	FpCache     uintptr
 42757  	FpDirty     uintptr
 42758  	FpPager     uintptr
 42759  	Fpgno       Pgno
 42760  	Fflags      u16
 42761  	FnRef       i16
 42762  	FpDirtyNext uintptr
 42763  	FpDirtyPrev uintptr
 42764  } /* pager.h:43:9 */
 42765  
 42766  // Handle type for pages.
 42767  type DbPage = PgHdr1 /* pager.h:43:22 */
 42768  
 42769  // 2001 September 15
 42770  //
 42771  // The author disclaims copyright to this source code.  In place of
 42772  // a legal notice, here is a blessing:
 42773  //
 42774  //    May you do good and not evil.
 42775  //    May you find forgiveness for yourself and forgive others.
 42776  //    May you share freely, never taking more than you give.
 42777  //
 42778  //
 42779  // This header file defines the interface that the sqlite B-Tree file
 42780  // subsystem.  See comments in the source code for a detailed description
 42781  // of what each interface routine does.
 42782  
 42783  // TODO: This definition is just included so other modules compile. It
 42784  // needs to be revisited.
 42785  
 42786  // If defined as non-zero, auto-vacuum is enabled by default. Otherwise
 42787  // it must be turned on for each database using "PRAGMA auto_vacuum = 1".
 42788  
 42789  // Forward declarations of structure
 42790  type Btree1 = struct {
 42791  	Fdb             uintptr
 42792  	FpBt            uintptr
 42793  	FinTrans        u8
 42794  	Fsharable       u8
 42795  	Flocked         u8
 42796  	FhasIncrblobCur u8
 42797  	FwantToLock     int32
 42798  	FnBackup        int32
 42799  	FiBDataVersion  u32
 42800  	FpNext          uintptr
 42801  	FpPrev          uintptr
 42802  	Flock           BtLock
 42803  } /* btree.h:39:9 */
 42804  
 42805  type BtCursor1 = struct {
 42806  	FeState        u8
 42807  	FcurFlags      u8
 42808  	FcurPagerFlags u8
 42809  	Fhints         u8
 42810  	FskipNext      int32
 42811  	FpBtree        uintptr
 42812  	FaOverflow     uintptr
 42813  	FpKey          uintptr
 42814  	FpBt           uintptr
 42815  	FpNext         uintptr
 42816  	Finfo          CellInfo
 42817  	FnKey          i64
 42818  	FpgnoRoot      Pgno
 42819  	FiPage         i8
 42820  	FcurIntKey     u8
 42821  	Fix            u16
 42822  	FaiIdx         [19]u16
 42823  	_              [2]byte
 42824  	FpKeyInfo      uintptr
 42825  	FpPage         uintptr
 42826  	FapPage        [19]uintptr
 42827  } /* btree.h:39:9 */
 42828  
 42829  type BtShared1 = struct {
 42830  	FpPager          uintptr
 42831  	Fdb              uintptr
 42832  	FpCursor         uintptr
 42833  	FpPage1          uintptr
 42834  	FopenFlags       u8
 42835  	FautoVacuum      u8
 42836  	FincrVacuum      u8
 42837  	FbDoTruncate     u8
 42838  	FinTransaction   u8
 42839  	Fmax1bytePayload u8
 42840  	FnReserveWanted  u8
 42841  	_                [1]byte
 42842  	FbtsFlags        u16
 42843  	FmaxLocal        u16
 42844  	FminLocal        u16
 42845  	FmaxLeaf         u16
 42846  	FminLeaf         u16
 42847  	_                [2]byte
 42848  	FpageSize        u32
 42849  	FusableSize      u32
 42850  	FnTransaction    int32
 42851  	FnPage           u32
 42852  	_                [4]byte
 42853  	FpSchema         uintptr
 42854  	FxFreeSchema     uintptr
 42855  	Fmutex           uintptr
 42856  	FpHasContent     uintptr
 42857  	FnRef            int32
 42858  	_                [4]byte
 42859  	FpNext           uintptr
 42860  	FpLock           uintptr
 42861  	FpWriter         uintptr
 42862  	FpTmpSpace       uintptr
 42863  	FnPreformatSize  int32
 42864  	_                [4]byte
 42865  } /* btree.h:39:9 */
 42866  
 42867  type BtreePayload1 = struct {
 42868  	FpKey  uintptr
 42869  	FnKey  sqlite3_int64
 42870  	FpData uintptr
 42871  	FaMem  uintptr
 42872  	FnMem  u16
 42873  	_      [2]byte
 42874  	FnData int32
 42875  	FnZero int32
 42876  	_      [4]byte
 42877  } /* btree.h:42:9 */
 42878  
 42879  type BtreePayload = BtreePayload1 /* btree.h:42:29 */
 42880  
 42881  // 2001 September 15
 42882  //
 42883  // The author disclaims copyright to this source code.  In place of
 42884  // a legal notice, here is a blessing:
 42885  //
 42886  //    May you do good and not evil.
 42887  //    May you find forgiveness for yourself and forgive others.
 42888  //    May you share freely, never taking more than you give.
 42889  //
 42890  //
 42891  // Header file for the Virtual DataBase Engine (VDBE)
 42892  //
 42893  // This header defines the interface to the virtual database engine
 42894  // or VDBE.  The VDBE implements an abstract machine that runs a
 42895  // simple program to access and modify the underlying database.
 42896  // -
 42897  // SPDX-License-Identifier: BSD-3-Clause
 42898  //
 42899  // Copyright (c) 1990, 1993
 42900  //	The Regents of the University of California.  All rights reserved.
 42901  //
 42902  // This code is derived from software contributed to Berkeley by
 42903  // Chris Torek.
 42904  //
 42905  // Redistribution and use in source and binary forms, with or without
 42906  // modification, are permitted provided that the following conditions
 42907  // are met:
 42908  // 1. Redistributions of source code must retain the above copyright
 42909  //    notice, this list of conditions and the following disclaimer.
 42910  // 2. Redistributions in binary form must reproduce the above copyright
 42911  //    notice, this list of conditions and the following disclaimer in the
 42912  //    documentation and/or other materials provided with the distribution.
 42913  // 3. Neither the name of the University nor the names of its contributors
 42914  //    may be used to endorse or promote products derived from this software
 42915  //    without specific prior written permission.
 42916  //
 42917  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 42918  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 42919  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 42920  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 42921  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 42922  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 42923  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 42924  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 42925  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 42926  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 42927  // SUCH DAMAGE.
 42928  //
 42929  //	@(#)stdio.h	8.5 (Berkeley) 4/29/95
 42930  // $FreeBSD$
 42931  
 42932  // A single VDBE is an opaque structure named "Vdbe".  Only routines
 42933  // in the source file sqliteVdbe.c are allowed to see the insides
 42934  // of this structure.
 42935  type Vdbe1 = struct {
 42936  	Fdb                 uintptr
 42937  	FpPrev              uintptr
 42938  	FpNext              uintptr
 42939  	FpParse             uintptr
 42940  	FnVar               ynVar
 42941  	_                   [2]byte
 42942  	FiVdbeMagic         u32
 42943  	FnMem               int32
 42944  	FnCursor            int32
 42945  	FcacheCtr           u32
 42946  	Fpc                 int32
 42947  	Frc                 int32
 42948  	FnChange            int32
 42949  	FiStatement         int32
 42950  	_                   [4]byte
 42951  	FiCurrentTime       i64
 42952  	FnFkConstraint      i64
 42953  	FnStmtDefCons       i64
 42954  	FnStmtDefImmCons    i64
 42955  	FaMem               uintptr
 42956  	FapArg              uintptr
 42957  	FapCsr              uintptr
 42958  	FaVar               uintptr
 42959  	FaOp                uintptr
 42960  	FnOp                int32
 42961  	FnOpAlloc           int32
 42962  	FaColName           uintptr
 42963  	FpResultSet         uintptr
 42964  	FzErrMsg            uintptr
 42965  	FpVList             uintptr
 42966  	FstartTime          i64
 42967  	FnResColumn         u16
 42968  	FerrorAction        u8
 42969  	FminWriteFileFormat u8
 42970  	FprepFlags          u8
 42971  	FdoingRerun         u8
 42972  	_                   [2]byte
 42973  	Fexpired            uint16 /* bft expired: 2, bft explain: 2, bft changeCntOn: 1, bft runOnlyOnce: 1, bft usesStmtJournal: 1, bft readOnly: 1, bft bIsReader: 1 */
 42974  	_                   [2]byte
 42975  	FbtreeMask          yDbMask
 42976  	FlockMask           yDbMask
 42977  	FaCounter           [7]u32
 42978  	FzSql               uintptr
 42979  	FpFree              uintptr
 42980  	FpFrame             uintptr
 42981  	FpDelFrame          uintptr
 42982  	FnFrame             int32
 42983  	Fexpmask            u32
 42984  	FpProgram           uintptr
 42985  	FpAuxData           uintptr
 42986  } /* sqlite3.h:249:9 */
 42987  
 42988  // 2001 September 15
 42989  //
 42990  // The author disclaims copyright to this source code.  In place of
 42991  // a legal notice, here is a blessing:
 42992  //
 42993  //    May you do good and not evil.
 42994  //    May you find forgiveness for yourself and forgive others.
 42995  //    May you share freely, never taking more than you give.
 42996  //
 42997  //
 42998  // Header file for the Virtual DataBase Engine (VDBE)
 42999  //
 43000  // This header defines the interface to the virtual database engine
 43001  // or VDBE.  The VDBE implements an abstract machine that runs a
 43002  // simple program to access and modify the underlying database.
 43003  // -
 43004  // SPDX-License-Identifier: BSD-3-Clause
 43005  //
 43006  // Copyright (c) 1990, 1993
 43007  //	The Regents of the University of California.  All rights reserved.
 43008  //
 43009  // This code is derived from software contributed to Berkeley by
 43010  // Chris Torek.
 43011  //
 43012  // Redistribution and use in source and binary forms, with or without
 43013  // modification, are permitted provided that the following conditions
 43014  // are met:
 43015  // 1. Redistributions of source code must retain the above copyright
 43016  //    notice, this list of conditions and the following disclaimer.
 43017  // 2. Redistributions in binary form must reproduce the above copyright
 43018  //    notice, this list of conditions and the following disclaimer in the
 43019  //    documentation and/or other materials provided with the distribution.
 43020  // 3. Neither the name of the University nor the names of its contributors
 43021  //    may be used to endorse or promote products derived from this software
 43022  //    without specific prior written permission.
 43023  //
 43024  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 43025  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 43026  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 43027  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 43028  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 43029  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 43030  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 43031  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 43032  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 43033  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 43034  // SUCH DAMAGE.
 43035  //
 43036  //	@(#)stdio.h	8.5 (Berkeley) 4/29/95
 43037  // $FreeBSD$
 43038  
 43039  // A single VDBE is an opaque structure named "Vdbe".  Only routines
 43040  // in the source file sqliteVdbe.c are allowed to see the insides
 43041  // of this structure.
 43042  type Vdbe = Vdbe1 /* vdbe.h:27:21 */
 43043  
 43044  // The names of the following types declared in vdbeInt.h are required
 43045  // for the VdbeOp definition.
 43046  type Mem = sqlite3_value1 /* vdbe.h:33:30 */
 43047  type SubProgram1 = struct {
 43048  	FaOp   uintptr
 43049  	FnOp   int32
 43050  	FnMem  int32
 43051  	FnCsr  int32
 43052  	_      [4]byte
 43053  	FaOnce uintptr
 43054  	Ftoken uintptr
 43055  	FpNext uintptr
 43056  } /* sqlite3.h:249:9 */
 43057  
 43058  type SubProgram = SubProgram1 /* vdbe.h:34:27 */
 43059  
 43060  // A single instruction of the virtual machine has an opcode
 43061  // and as many as three operands.  The instruction is recorded
 43062  // as an instance of the following structure:
 43063  type VdbeOp1 = struct {
 43064  	Fopcode u8
 43065  	Fp4type int8
 43066  	Fp5     u16
 43067  	Fp1     int32
 43068  	Fp2     int32
 43069  	Fp3     int32
 43070  	Fp4     struct {
 43071  		_  [0]uint64
 43072  		Fi int32
 43073  		_  [4]byte
 43074  	}
 43075  	FzComment uintptr
 43076  } /* sqlite3.h:249:9 */
 43077  
 43078  // A single instruction of the virtual machine has an opcode
 43079  // and as many as three operands.  The instruction is recorded
 43080  // as an instance of the following structure:
 43081  type p4union = struct {
 43082  	_  [0]uint64
 43083  	Fi int32
 43084  	_  [4]byte
 43085  } /* sqlite3.h:249:9 */
 43086  
 43087  type VdbeOp = VdbeOp1 /* vdbe.h:80:23 */
 43088  
 43089  // A smaller version of VdbeOp used for the VdbeAddOpList() function because
 43090  // it takes up less space.
 43091  type VdbeOpList1 = struct {
 43092  	Fopcode u8
 43093  	Fp1     int8
 43094  	Fp2     int8
 43095  	Fp3     int8
 43096  } /* vdbe.h:100:1 */
 43097  
 43098  type VdbeOpList = VdbeOpList1 /* vdbe.h:106:27 */
 43099  
 43100  type RecordCompare = uintptr /* vdbe.h:286:13 */
 43101  
 43102  // The VdbeCoverage macros are used to set a coverage testing point
 43103  // for VDBE branch instructions.  The coverage testing points are line
 43104  // numbers in the sqlite3.c source file.  VDBE branch coverage testing
 43105  // only works with an amalagmation build.  That's ok since a VDBE branch
 43106  // coverage build designed for testing the test suite only.  No application
 43107  // should ever ship with VDBE branch coverage measuring turned on.
 43108  //
 43109  //    VdbeCoverage(v)                  // Mark the previously coded instruction
 43110  //                                     // as a branch
 43111  //
 43112  //    VdbeCoverageIf(v, conditional)   // Mark previous if conditional true
 43113  //
 43114  //    VdbeCoverageAlwaysTaken(v)       // Previous branch is always taken
 43115  //
 43116  //    VdbeCoverageNeverTaken(v)        // Previous branch is never taken
 43117  //
 43118  //    VdbeCoverageNeverNull(v)         // Previous three-way branch is only
 43119  //                                     // taken on the first two ways.  The
 43120  //                                     // NULL option is not possible
 43121  //
 43122  //    VdbeCoverageEqNe(v)              // Previous OP_Jump is only interested
 43123  //                                     // in distingishing equal and not-equal.
 43124  //
 43125  // Every VDBE branch operation must be tagged with one of the macros above.
 43126  // If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and
 43127  // -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch()
 43128  // routine in vdbe.c, alerting the developer to the missed tag.
 43129  //
 43130  // During testing, the test application will invoke
 43131  // sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback
 43132  // routine that is invoked as each bytecode branch is taken.  The callback
 43133  // contains the sqlite3.c source line number ov the VdbeCoverage macro and
 43134  // flags to indicate whether or not the branch was taken.  The test application
 43135  // is responsible for keeping track of this and reporting byte-code branches
 43136  // that are never taken.
 43137  //
 43138  // See the VdbeBranchTaken() macro and vdbeTakeBranch() function in the
 43139  // vdbe.c source file for additional information.
 43140  
 43141  // 2008 August 05
 43142  //
 43143  // The author disclaims copyright to this source code.  In place of
 43144  // a legal notice, here is a blessing:
 43145  //
 43146  //    May you do good and not evil.
 43147  //    May you find forgiveness for yourself and forgive others.
 43148  //    May you share freely, never taking more than you give.
 43149  //
 43150  //
 43151  // This header file defines the interface that the sqlite page cache
 43152  // subsystem.
 43153  
 43154  type PgHdr = PgHdr1 /* pcache.h:18:22 */
 43155  
 43156  // typedef for the authorization callback function.
 43157  type sqlite3_xauth = uintptr /* sqliteInt.h:1468:15 */
 43158  
 43159  // This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
 43160  // in the style of sqlite3_trace()
 43161  
 43162  // Maximum number of sqlite3.aDb[] entries.  This is the number of attached
 43163  // databases plus 2 for "main" and "temp".
 43164  
 43165  // Each database connection is an instance of the following structure.
 43166  type sqlite3InitInfo = struct {
 43167  	FnewTnum       Pgno
 43168  	FiDb           u8
 43169  	Fbusy          u8
 43170  	_              [2]byte
 43171  	ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */
 43172  	_              [7]byte
 43173  	FazInit        uintptr
 43174  } /* sqlite3.h:249:9 */
 43175  
 43176  // Allowed values for Table.tabFlags.
 43177  //
 43178  // TF_OOOHidden applies to tables or view that have hidden columns that are
 43179  // followed by non-hidden columns.  Example:  "CREATE VIRTUAL TABLE x USING
 43180  // vtab1(a HIDDEN, b);".  Since "b" is a non-hidden column but "a" is hidden,
 43181  // the TF_OOOHidden attribute would apply in this case.  Such tables require
 43182  // special handling during INSERT processing. The "OOO" means "Out Of Order".
 43183  //
 43184  // Constraints:
 43185  //
 43186  //         TF_HasVirtual == COLFLAG_VIRTUAL
 43187  //         TF_HasStored  == COLFLAG_STORED
 43188  //         TF_HasHidden  == COLFLAG_HIDDEN
 43189  
 43190  // Test to see whether or not a table is a virtual table.  This is
 43191  // done as a macro so that it will be optimized out when virtual
 43192  // table support is omitted from the build.
 43193  
 43194  // Macros to determine if a column is hidden.  IsOrdinaryHiddenColumn()
 43195  // only works for non-virtual tables (ordinary tables and views) and is
 43196  // always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined.  The
 43197  // IsHiddenColumn() macro is general purpose.
 43198  
 43199  // Does the table have a rowid
 43200  
 43201  // Each foreign key constraint is an instance of the following structure.
 43202  //
 43203  // A foreign key is associated with two tables.  The "from" table is
 43204  // the table that contains the REFERENCES clause that creates the foreign
 43205  // key.  The "to" table is the table that is named in the REFERENCES clause.
 43206  // Consider this example:
 43207  //
 43208  //     CREATE TABLE ex1(
 43209  //       a INTEGER PRIMARY KEY,
 43210  //       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
 43211  //     );
 43212  //
 43213  // For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
 43214  // Equivalent names:
 43215  //
 43216  //     from-table == child-table
 43217  //       to-table == parent-table
 43218  //
 43219  // Each REFERENCES clause generates an instance of the following structure
 43220  // which is attached to the from-table.  The to-table need not exist when
 43221  // the from-table is created.  The existence of the to-table is not checked.
 43222  //
 43223  // The list of all parents for child Table X is held at X.pFKey.
 43224  //
 43225  // A list of all children for a table named Z (which might not even exist)
 43226  // is held in Schema.fkeyHash with a hash key of Z.
 43227  type sColMap = struct {
 43228  	FiFrom int32
 43229  	_      [4]byte
 43230  	FzCol  uintptr
 43231  } /* sqlite3.h:249:9 */
 43232  
 43233  // An instance of this structure contains information needed to generate
 43234  // code for a SELECT that contains aggregate functions.
 43235  //
 43236  // If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
 43237  // pointer to this structure.  The Expr.iAgg field is the index in
 43238  // AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
 43239  // code for that node.
 43240  //
 43241  // AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
 43242  // original Select structure that describes the SELECT statement.  These
 43243  // fields do not need to be freed when deallocating the AggInfo structure.
 43244  type AggInfo_col = struct {
 43245  	FpTab          uintptr
 43246  	FpCExpr        uintptr
 43247  	FiTable        int32
 43248  	FiMem          int32
 43249  	FiColumn       i16
 43250  	FiSorterColumn i16
 43251  	_              [4]byte
 43252  } /* sqlite3.h:249:9 */
 43253  
 43254  // An instance of this structure contains information needed to generate
 43255  // code for a SELECT that contains aggregate functions.
 43256  //
 43257  // If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
 43258  // pointer to this structure.  The Expr.iAgg field is the index in
 43259  // AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
 43260  // code for that node.
 43261  //
 43262  // AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
 43263  // original Select structure that describes the SELECT statement.  These
 43264  // fields do not need to be freed when deallocating the AggInfo structure.
 43265  type AggInfo_func = struct {
 43266  	FpFExpr    uintptr
 43267  	FpFunc     uintptr
 43268  	FiMem      int32
 43269  	FiDistinct int32
 43270  	FiDistAddr int32
 43271  	_          [4]byte
 43272  } /* sqlite3.h:249:9 */
 43273  
 43274  // The datatype ynVar is a signed integer, either 16-bit or 32-bit.
 43275  // Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater
 43276  // than 32767 we have to make it 32-bit.  16-bit is preferred because
 43277  // it uses less memory in the Expr object, which is a big memory user
 43278  // in systems with lots of prepared statements.  And few applications
 43279  // need more than about 10 or 20 variables.  But some extreme users want
 43280  // to have prepared statements with over 32766 variables, and for them
 43281  // the option is available (at compile-time).
 43282  type ynVar = i16 /* sqliteInt.h:2622:13 */
 43283  
 43284  // The following are the meanings of bits in the Expr.flags field.
 43285  // Value restrictions:
 43286  //
 43287  //          EP_Agg == NC_HasAgg == SF_HasAgg
 43288  //          EP_Win == NC_HasWin
 43289  //   0x400000 // Available
 43290  //   0x80000000 // Available
 43291  
 43292  // The EP_Propagate mask is a set of properties that automatically propagate
 43293  // upwards into parent nodes.
 43294  
 43295  // These macros can be used to test, set, or clear bits in the
 43296  // Expr.flags field.
 43297  
 43298  // Flags for use with Expr.vvaFlags
 43299  
 43300  // The ExprSetVVAProperty() macro is used for Verification, Validation,
 43301  // and Accreditation only.  It works like ExprSetProperty() during VVA
 43302  // processes but is a no-op for delivery.
 43303  
 43304  // Macros to determine the number of bytes required by a normal Expr
 43305  // struct, an Expr struct with the EP_Reduced flag set in Expr.flags
 43306  // and an Expr struct with the EP_TokenOnly flag set.
 43307  
 43308  // Flags passed to the sqlite3ExprDup() function. See the header comment
 43309  // above sqlite3ExprDup() for details.
 43310  
 43311  // True if the expression passed as an argument was a function with
 43312  // an OVER() clause (a window function).
 43313  
 43314  // A list of expressions.  Each expression may optionally have a
 43315  // name.  An expr/name combination can be used in several ways, such
 43316  // as the list of "expr AS ID" fields following a "SELECT" or in the
 43317  // list of "ID = expr" items in an UPDATE.  A list of expressions can
 43318  // also be used as the argument to a function, in which case the a.zName
 43319  // field is not used.
 43320  //
 43321  // In order to try to keep memory usage down, the Expr.a.zEName field
 43322  // is used for multiple purposes:
 43323  //
 43324  //     eEName          Usage
 43325  //    ----------       -------------------------
 43326  //    ENAME_NAME       (1) the AS of result set column
 43327  //                     (2) COLUMN= of an UPDATE
 43328  //
 43329  //    ENAME_TAB        DB.TABLE.NAME used to resolve names
 43330  //                     of subqueries
 43331  //
 43332  //    ENAME_SPAN       Text of the original result set
 43333  //                     expression.
 43334  type ExprList_item = struct {
 43335  	FpExpr     uintptr
 43336  	FzEName    uintptr
 43337  	FsortFlags u8
 43338  	_          [3]byte
 43339  	FeEName    uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */
 43340  	_          [3]byte
 43341  	Fu         struct {
 43342  		_  [0]uint32
 43343  		Fx struct {
 43344  			FiOrderByCol u16
 43345  			FiAlias      u16
 43346  		}
 43347  	}
 43348  	_ [4]byte
 43349  } /* sqlite3.h:249:9 */
 43350  
 43351  // Allowed values for Expr.a.eEName
 43352  
 43353  // An instance of this structure can hold a simple list of identifiers,
 43354  // such as the list "a,b,c" in the following statements:
 43355  //
 43356  //      INSERT INTO t(a,b,c) VALUES ...;
 43357  //      CREATE INDEX idx ON t(a,b,c);
 43358  //      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
 43359  //
 43360  // The IdList.a.idx field is used when the IdList represents the list of
 43361  // column names after a table name in an INSERT statement.  In the statement
 43362  //
 43363  //     INSERT INTO t(a,b,c) ...
 43364  //
 43365  // If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
 43366  type IdList_item = struct {
 43367  	FzName uintptr
 43368  	Fidx   int32
 43369  	_      [4]byte
 43370  } /* sqlite3.h:249:9 */
 43371  
 43372  // The yDbMask datatype for the bitmask of all attached databases.
 43373  type yDbMask = uint32 /* sqliteInt.h:3379:24 */
 43374  
 43375  // A pointer to this structure is used to communicate information
 43376  // from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
 43377  type InitData = struct {
 43378  	Fdb         uintptr
 43379  	FpzErrMsg   uintptr
 43380  	FiDb        int32
 43381  	Frc         int32
 43382  	FmInitFlags u32
 43383  	FnInitRow   u32
 43384  	FmxPage     Pgno
 43385  	_           [4]byte
 43386  } /* sqliteInt.h:3737:3 */
 43387  
 43388  // Allowed values for mInitFlags
 43389  
 43390  // Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled
 43391  // on debug-builds of the CLI using ".testctrl tune ID VALUE".  Tuning
 43392  // parameters are for temporary use during development, to help find
 43393  // optimial values for parameters in the query planner.  The should not
 43394  // be used on trunk check-ins.  They are a temporary mechanism available
 43395  // for transient development builds only.
 43396  //
 43397  // Tuning parameters are numbered starting with 1.
 43398  
 43399  // Structure containing global configuration data for the SQLite library.
 43400  //
 43401  // This structure also contains some state information.
 43402  type Sqlite3Config = struct {
 43403  	FbMemstat            int32
 43404  	FbCoreMutex          u8
 43405  	FbFullMutex          u8
 43406  	FbOpenUri            u8
 43407  	FbUseCis             u8
 43408  	FbSmallMalloc        u8
 43409  	FbExtraSchemaChecks  u8
 43410  	_                    [2]byte
 43411  	FmxStrlen            int32
 43412  	FneverCorrupt        int32
 43413  	FszLookaside         int32
 43414  	FnLookaside          int32
 43415  	FnStmtSpill          int32
 43416  	Fm                   sqlite3_mem_methods
 43417  	Fmutex               sqlite3_mutex_methods
 43418  	Fpcache2             sqlite3_pcache_methods2
 43419  	FpHeap               uintptr
 43420  	FnHeap               int32
 43421  	FmnReq               int32
 43422  	FmxReq               int32
 43423  	_                    [4]byte
 43424  	FszMmap              sqlite3_int64
 43425  	FmxMmap              sqlite3_int64
 43426  	FpPage               uintptr
 43427  	FszPage              int32
 43428  	FnPage               int32
 43429  	FmxParserStack       int32
 43430  	FsharedCacheEnabled  int32
 43431  	FszPma               u32
 43432  	FisInit              int32
 43433  	FinProgress          int32
 43434  	FisMutexInit         int32
 43435  	FisMallocInit        int32
 43436  	FisPCacheInit        int32
 43437  	FnRefInitMutex       int32
 43438  	_                    [4]byte
 43439  	FpInitMutex          uintptr
 43440  	FxLog                uintptr
 43441  	FpLogArg             uintptr
 43442  	FmxMemdbSize         sqlite3_int64
 43443  	FxTestCallback       uintptr
 43444  	FbLocaltimeFault     int32
 43445  	FiOnceResetThreshold int32
 43446  	FszSorterRef         u32
 43447  	FiPrngSeed           uint32
 43448  } /* sqliteInt.h:3766:1 */
 43449  
 43450  // 2003 September 6
 43451  //
 43452  // The author disclaims copyright to this source code.  In place of
 43453  // a legal notice, here is a blessing:
 43454  //
 43455  //    May you do good and not evil.
 43456  //    May you find forgiveness for yourself and forgive others.
 43457  //    May you share freely, never taking more than you give.
 43458  //
 43459  //
 43460  // This is the header file for information that is private to the
 43461  // VDBE.  This information used to all be at the top of the single
 43462  // source code file "vdbe.c".  When that file became too big (over
 43463  // 6000 lines long) it was split up into several smaller files and
 43464  // this header information was factored out.
 43465  
 43466  // The maximum number of times that a statement will try to reparse
 43467  // itself before giving up and returning SQLITE_SCHEMA.
 43468  
 43469  // VDBE_DISPLAY_P4 is true or false depending on whether or not the
 43470  // "explain" P4 display logic is enabled.
 43471  
 43472  // SQL is translated into a sequence of instructions to be
 43473  // executed by a virtual machine.  Each instruction is an instance
 43474  // of the following structure.
 43475  type Op = VdbeOp1 /* vdbeInt.h:46:23 */
 43476  
 43477  // Boolean values
 43478  type Bool = uint32 /* vdbeInt.h:51:18 */
 43479  
 43480  // Elements of the linked list at Vdbe.pAuxData
 43481  type AuxData1 = struct {
 43482  	FiAuxOp     int32
 43483  	FiAuxArg    int32
 43484  	FpAux       uintptr
 43485  	FxDeleteAux uintptr
 43486  	FpNextAux   uintptr
 43487  } /* sqlite3.h:249:9 */
 43488  
 43489  // Elements of the linked list at Vdbe.pAuxData
 43490  type AuxData = AuxData1 /* vdbeInt.h:57:24 */
 43491  
 43492  // Types of VDBE cursors
 43493  
 43494  // A VdbeCursor is an superclass (a wrapper) for various cursor objects:
 43495  //
 43496  //      * A b-tree cursor
 43497  //          -  In the main database or in an ephemeral database
 43498  //          -  On either an index or a table
 43499  //      * A sorter
 43500  //      * A virtual table
 43501  //      * A one-row "pseudotable" stored in a single register
 43502  type VdbeCursor1 = struct {
 43503  	FeCurType       u8
 43504  	FiDb            i8
 43505  	FnullRow        u8
 43506  	FdeferredMoveto u8
 43507  	FisTable        u8
 43508  	_               [3]byte
 43509  	FisEphemeral    uint8 /* Bool isEphemeral: 1, Bool useRandomRowid: 1, Bool isOrdered: 1, Bool hasBeenDuped: 1 */
 43510  	_               [1]byte
 43511  	FseekHit        u16
 43512  	_               [4]byte
 43513  	FpBtx           uintptr
 43514  	FseqCount       i64
 43515  	FaAltMap        uintptr
 43516  	FcacheStatus    u32
 43517  	FseekResult     int32
 43518  	FpAltCursor     uintptr
 43519  	Fuc             struct{ FpCursor uintptr }
 43520  	FpKeyInfo       uintptr
 43521  	FiHdrOffset     u32
 43522  	FpgnoRoot       Pgno
 43523  	FnField         i16
 43524  	FnHdrParsed     u16
 43525  	_               [4]byte
 43526  	FmovetoTarget   i64
 43527  	FaOffset        uintptr
 43528  	FaRow           uintptr
 43529  	FpayloadSize    u32
 43530  	FszRow          u32
 43531  	FaType          [1]u32
 43532  	_               [4]byte
 43533  } /* sqlite3.h:249:9 */
 43534  
 43535  // Types of VDBE cursors
 43536  
 43537  // A VdbeCursor is an superclass (a wrapper) for various cursor objects:
 43538  //
 43539  //      * A b-tree cursor
 43540  //          -  In the main database or in an ephemeral database
 43541  //          -  On either an index or a table
 43542  //      * A sorter
 43543  //      * A virtual table
 43544  //      * A one-row "pseudotable" stored in a single register
 43545  type VdbeCursor = VdbeCursor1 /* vdbeInt.h:75:27 */
 43546  
 43547  // A value for VdbeCursor.cacheStatus that means the cache is always invalid.
 43548  
 43549  // When a sub-program is executed (OP_Program), a structure of this type
 43550  // is allocated to store the current value of the program counter, as
 43551  // well as the current memory cell array and various other frame specific
 43552  // values stored in the Vdbe struct. When the sub-program is finished,
 43553  // these values are copied back to the Vdbe from the VdbeFrame structure,
 43554  // restoring the state of the VM to as it was before the sub-program
 43555  // began executing.
 43556  //
 43557  // The memory for a VdbeFrame object is allocated and managed by a memory
 43558  // cell in the parent (calling) frame. When the memory cell is deleted or
 43559  // overwritten, the VdbeFrame object is not freed immediately. Instead, it
 43560  // is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
 43561  // list is deleted when the VM is reset in VdbeHalt(). The reason for doing
 43562  // this instead of deleting the VdbeFrame immediately is to avoid recursive
 43563  // calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
 43564  // child frame are released.
 43565  //
 43566  // The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
 43567  // set to NULL if the currently executing frame is the main program.
 43568  type VdbeFrame1 = struct {
 43569  	Fv         uintptr
 43570  	FpParent   uintptr
 43571  	FaOp       uintptr
 43572  	FanExec    uintptr
 43573  	FaMem      uintptr
 43574  	FapCsr     uintptr
 43575  	FaOnce     uintptr
 43576  	Ftoken     uintptr
 43577  	FlastRowid i64
 43578  	FpAuxData  uintptr
 43579  	FnCursor   int32
 43580  	Fpc        int32
 43581  	FnOp       int32
 43582  	FnMem      int32
 43583  	FnChildMem int32
 43584  	FnChildCsr int32
 43585  	FnChange   int32
 43586  	FnDbChange int32
 43587  } /* sqlite3.h:249:9 */
 43588  
 43589  // A value for VdbeCursor.cacheStatus that means the cache is always invalid.
 43590  
 43591  // When a sub-program is executed (OP_Program), a structure of this type
 43592  // is allocated to store the current value of the program counter, as
 43593  // well as the current memory cell array and various other frame specific
 43594  // values stored in the Vdbe struct. When the sub-program is finished,
 43595  // these values are copied back to the Vdbe from the VdbeFrame structure,
 43596  // restoring the state of the VM to as it was before the sub-program
 43597  // began executing.
 43598  //
 43599  // The memory for a VdbeFrame object is allocated and managed by a memory
 43600  // cell in the parent (calling) frame. When the memory cell is deleted or
 43601  // overwritten, the VdbeFrame object is not freed immediately. Instead, it
 43602  // is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
 43603  // list is deleted when the VM is reset in VdbeHalt(). The reason for doing
 43604  // this instead of deleting the VdbeFrame immediately is to avoid recursive
 43605  // calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
 43606  // child frame are released.
 43607  //
 43608  // The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
 43609  // set to NULL if the currently executing frame is the main program.
 43610  type VdbeFrame = VdbeFrame1 /* vdbeInt.h:162:26 */
 43611  
 43612  // Magic number for sanity checking on VdbeFrame objects
 43613  
 43614  // Return a pointer to the array of registers allocated for use
 43615  // by a VdbeFrame.
 43616  
 43617  // Internally, the vdbe manipulates nearly all SQL values as Mem
 43618  // structures. Each Mem struct may cache multiple representations (string,
 43619  // integer etc.) of the same value.
 43620  type MemValue = struct{ Fr float64 } /* sqlite3.h:249:9 */
 43621  
 43622  // A bitfield type for use inside of structures.  Always follow with :N where
 43623  // N is the number of bits.
 43624  type bft = uint32 /* vdbeInt.h:345:18 */ // Bit Field Type
 43625  
 43626  // The ScanStatus object holds a single value for the
 43627  // sqlite3_stmt_scanstatus() interface.
 43628  type ScanStatus1 = struct {
 43629  	FaddrExplain int32
 43630  	FaddrLoop    int32
 43631  	FaddrVisit   int32
 43632  	FiSelectID   int32
 43633  	FnEst        LogEst
 43634  	_            [6]byte
 43635  	FzName       uintptr
 43636  } /* vdbeInt.h:350:9 */
 43637  
 43638  // Bit Field Type
 43639  
 43640  // The ScanStatus object holds a single value for the
 43641  // sqlite3_stmt_scanstatus() interface.
 43642  type ScanStatus = ScanStatus1 /* vdbeInt.h:350:27 */
 43643  
 43644  // The DblquoteStr object holds the text of a double-quoted
 43645  // string for a prepared statement.  A linked list of these objects
 43646  // is constructed during statement parsing and is held on Vdbe.pDblStr.
 43647  // When computing a normalized SQL statement for an SQL statement, that
 43648  // list is consulted for each double-quoted identifier to see if the
 43649  // identifier should really be a string literal.
 43650  type DblquoteStr1 = struct {
 43651  	FpNextStr uintptr
 43652  	Fz        [8]int8
 43653  } /* vdbeInt.h:367:9 */
 43654  
 43655  // The DblquoteStr object holds the text of a double-quoted
 43656  // string for a prepared statement.  A linked list of these objects
 43657  // is constructed during statement parsing and is held on Vdbe.pDblStr.
 43658  // When computing a normalized SQL statement for an SQL statement, that
 43659  // list is consulted for each double-quoted identifier to see if the
 43660  // identifier should really be a string literal.
 43661  type DblquoteStr = DblquoteStr1 /* vdbeInt.h:367:28 */
 43662  
 43663  // Convert text generated by the "%p" conversion format back into
 43664  // a pointer.
 43665  func testHexToInt(tls *libc.TLS, h int32) int32 { /* test1.c:44:12: */
 43666  	if (h >= '0') && (h <= '9') {
 43667  		return (h - '0')
 43668  	} else if (h >= 'a') && (h <= 'f') {
 43669  		return ((h - 'a') + 10)
 43670  	} else {
 43671  
 43672  		return ((h - 'A') + 10)
 43673  	}
 43674  	return int32(0)
 43675  }
 43676  
 43677  func sqlite3TestTextToPtr(tls *libc.TLS, z uintptr) uintptr { /* test1.c:54:6: */
 43678  	bp := tls.Alloc(20)
 43679  	defer tls.Free(20)
 43680  
 43681  	// var p uintptr at bp, 8
 43682  
 43683  	// var v u64 at bp+8, 8
 43684  
 43685  	// var v2 u32 at bp+16, 4
 43686  
 43687  	if (int32(*(*int8)(unsafe.Pointer(z))) == '0') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 'x') {
 43688  		z += uintptr(2)
 43689  	}
 43690  	*(*u64)(unsafe.Pointer(bp + 8 /* v */)) = uint64(0)
 43691  	for *(*int8)(unsafe.Pointer(z)) != 0 {
 43692  		*(*u64)(unsafe.Pointer(bp + 8 /* v */)) = ((*(*u64)(unsafe.Pointer(bp + 8 /* v */)) << 4) + u64(testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z))))))
 43693  		z++
 43694  	}
 43695  	if uint64(unsafe.Sizeof(uintptr(0))) == uint64(unsafe.Sizeof(u64(0))) {
 43696  		libc.Xmemcpy(tls, bp /* &p */, bp+8 /* &v */, uint64(unsafe.Sizeof(uintptr(0))))
 43697  	} else {
 43698  
 43699  		*(*u32)(unsafe.Pointer(bp + 16 /* v2 */)) = u32(*(*u64)(unsafe.Pointer(bp + 8 /* v */)))
 43700  		libc.Xmemcpy(tls, bp /* &p */, bp+16 /* &v2 */, uint64(unsafe.Sizeof(uintptr(0))))
 43701  	}
 43702  	return *(*uintptr)(unsafe.Pointer(bp /* p */))
 43703  }
 43704  
 43705  // A TCL command that returns the address of the sqlite* pointer
 43706  // for an sqlite connection instance.  Bad things happen if the
 43707  // input is not an sqlite connection.
 43708  func get_sqlite_pointer(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:82:26: */
 43709  	bp := tls.Alloc(212)
 43710  	defer tls.Free(212)
 43711  
 43712  	var p uintptr
 43713  	// var cmdInfo Tcl_CmdInfo at bp+48, 64
 43714  
 43715  	// var zBuf [100]int8 at bp+112, 100
 43716  
 43717  	if objc != 2 {
 43718  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+15302 /* "SQLITE-CONNECTIO..." */)
 43719  		return TCL_ERROR
 43720  	}
 43721  	if !(tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &cmdInfo */) != 0) {
 43722  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320, /* "command not foun..." */
 43723  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 43724  		return TCL_ERROR
 43725  	}
 43726  	p = (*Tcl_CmdInfo)(unsafe.Pointer(bp + 48 /* &cmdInfo */)).FobjClientData
 43727  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+112 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+24, (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb))
 43728  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+112 /* &zBuf[0] */, 0))
 43729  	return TCL_OK
 43730  }
 43731  
 43732  // Decode a pointer to an sqlite3 object.
 43733  func getDbPointer(tls *libc.TLS, interp uintptr, zA uintptr, ppDb uintptr) int32 { /* test1.c:109:5: */
 43734  	bp := tls.Alloc(64)
 43735  	defer tls.Free(64)
 43736  
 43737  	var p uintptr
 43738  	// var cmdInfo Tcl_CmdInfo at bp, 64
 43739  
 43740  	if tcl.XTcl_GetCommandInfo(tls, interp, zA, bp /* &cmdInfo */) != 0 {
 43741  		p = (*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData
 43742  		*(*uintptr)(unsafe.Pointer(ppDb)) = (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb
 43743  	} else {
 43744  		*(*uintptr)(unsafe.Pointer(ppDb)) = sqlite3TestTextToPtr(tls, zA)
 43745  	}
 43746  	return TCL_OK
 43747  }
 43748  
 43749  // Convert an sqlite3_stmt* into an sqlite3*.  This depends on the
 43750  // fact that the sqlite3* is the first field in the Vdbe structure.
 43751  
 43752  // Check a return value to make sure it agrees with the results
 43753  // from sqlite3_errcode.
 43754  func sqlite3TestErrCode(tls *libc.TLS, interp uintptr, db uintptr, rc int32) int32 { /* test1.c:144:5: */
 43755  	bp := tls.Alloc(248)
 43756  	defer tls.Free(248)
 43757  
 43758  	if (((sqlite3.Xsqlite3_threadsafe(tls) == 0) && (rc != SQLITE_MISUSE)) && (rc != SQLITE_OK)) &&
 43759  		(sqlite3.Xsqlite3_errcode(tls, db) != rc) {
 43760  		// var zBuf [200]int8 at bp+48, 200
 43761  
 43762  		var r2 int32 = sqlite3.Xsqlite3_errcode(tls, db)
 43763  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+48, /* &zBuf[0] */
 43764  			ts+15340, /* "error code %s (%..." */
 43765  			libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), rc, sqlite3.Xsqlite3ErrName(tls, r2), r2))
 43766  		tcl.XTcl_ResetResult(tls, interp)
 43767  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+48 /* &zBuf[0] */, 0))
 43768  		return 1
 43769  	}
 43770  	return 0
 43771  }
 43772  
 43773  // Decode a pointer to an sqlite3_stmt object.
 43774  func getStmtPointer(tls *libc.TLS, interp uintptr, zArg uintptr, ppStmt uintptr) int32 { /* test1.c:162:12: */
 43775  	*(*uintptr)(unsafe.Pointer(ppStmt)) = sqlite3TestTextToPtr(tls, zArg)
 43776  	return TCL_OK
 43777  }
 43778  
 43779  // Generate a text representation of a pointer that can be understood
 43780  // by the getDbPointer and getVmPointer routines above.
 43781  //
 43782  // The problem is, on some machines (Solaris) if you do a printf with
 43783  // "%p" you cannot turn around and do a scanf with the same "%p" and
 43784  // get your pointer back.  You have to prepend a "0x" before it will
 43785  // work.  Or at least that is what is reported to me (drh).  But this
 43786  // behavior varies from machine to machine.  The solution used her is
 43787  // to test the string right after it is generated to see if it can be
 43788  // understood by scanf, and if not, try prepending an "0x" to see if
 43789  // that helps.  If nothing works, a fatal error is generated.
 43790  func sqlite3TestMakePointerStr(tls *libc.TLS, interp uintptr, zPtr uintptr, p uintptr) int32 { /* test1.c:184:5: */
 43791  	bp := tls.Alloc(8)
 43792  	defer tls.Free(8)
 43793  
 43794  	sqlite3.Xsqlite3_snprintf(tls, 100, zPtr, ts+13802 /* "%p" */, libc.VaList(bp, p))
 43795  	return TCL_OK
 43796  }
 43797  
 43798  // The callback routine for sqlite3_exec_printf().
 43799  func exec_printf_cb(tls *libc.TLS, pArg uintptr, argc int32, argv uintptr, name uintptr) int32 { /* test1.c:192:12: */
 43800  	var str uintptr = pArg
 43801  	var i int32
 43802  
 43803  	if ((*Tcl_DString)(unsafe.Pointer(str)).Flength) == 0 {
 43804  		for i = 0; i < argc; i++ {
 43805  			tcl.XTcl_DStringAppendElement(tls, str, func() uintptr {
 43806  				if *(*uintptr)(unsafe.Pointer(name + uintptr(i)*8)) != 0 {
 43807  					return *(*uintptr)(unsafe.Pointer(name + uintptr(i)*8))
 43808  				}
 43809  				return ts + 5707 /* "NULL" */
 43810  			}())
 43811  		}
 43812  	}
 43813  	for i = 0; i < argc; i++ {
 43814  		tcl.XTcl_DStringAppendElement(tls, str, func() uintptr {
 43815  			if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) != 0 {
 43816  				return *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))
 43817  			}
 43818  			return ts + 5707 /* "NULL" */
 43819  		}())
 43820  	}
 43821  	return 0
 43822  }
 43823  
 43824  // The I/O tracing callback.
 43825  
 43826  // Usage:  io_trace FILENAME
 43827  //
 43828  // Turn I/O tracing on or off.  If FILENAME is not an empty string,
 43829  // I/O tracing begins going into FILENAME. If FILENAME is an empty
 43830  // string, I/O tracing is turned off.
 43831  func test_io_trace(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:228:26: */
 43832  	return TCL_OK
 43833  }
 43834  
 43835  // Usage:  clang_sanitize_address
 43836  //
 43837  // Returns true if the program was compiled using clang with the
 43838  // -fsanitize=address switch on the command line. False otherwise.
 43839  //
 43840  // Also return true if the OMIT_MISUSE environment variable exists.
 43841  func clang_sanitize_address(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:269:26: */
 43842  	var res int32 = 0
 43843  	if (res == 0) && (libc.Xgetenv(tls, ts+15398 /* "OMIT_MISUSE" */) != uintptr(0)) {
 43844  		res = 1
 43845  	}
 43846  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 43847  	return TCL_OK
 43848  }
 43849  
 43850  // Usage:  sqlite3_exec_printf  DB  FORMAT  STRING
 43851  //
 43852  // Invoke the sqlite3_exec_printf() interface using the open database
 43853  // DB.  The SQL is the string FORMAT.  The format string should contain
 43854  // one %s or %q.  STRING is the value inserted into %s or %q.
 43855  func test_exec_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:296:26: */
 43856  	bp := tls.Alloc(310)
 43857  	defer tls.Free(310)
 43858  
 43859  	// var db uintptr at bp+48, 8
 43860  
 43861  	// var str Tcl_DString at bp+56, 216
 43862  
 43863  	var rc int32
 43864  	*(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)) = uintptr(0)
 43865  	var zSql uintptr
 43866  	// var zBuf [30]int8 at bp+280, 30
 43867  
 43868  	if argc != 4 {
 43869  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 43870  			ts+15436 /* " DB FORMAT STRIN..." */, 0))
 43871  		return TCL_ERROR
 43872  	}
 43873  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+48 /* &db */) != 0 {
 43874  		return TCL_ERROR
 43875  	}
 43876  	tcl.XTcl_DStringInit(tls, bp+56 /* &str */)
 43877  	zSql = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 3*8))))
 43878  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*uintptr)(unsafe.Pointer(&struct {
 43879  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 43880  	}{exec_printf_cb})), bp+56 /* &str */, bp+272 /* &zErr */)
 43881  	sqlite3.Xsqlite3_free(tls, zSql)
 43882  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+280 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 43883  	tcl.XTcl_AppendElement(tls, interp, bp+280 /* &zBuf[0] */)
 43884  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 43885  		if rc == SQLITE_OK {
 43886  			return (*Tcl_DString)(unsafe.Pointer(bp + 56 /* &str */)).Fstring
 43887  		}
 43888  		return *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */))
 43889  	}())
 43890  	tcl.XTcl_DStringFree(tls, bp+56 /* &str */)
 43891  	if *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)) != 0 {
 43892  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)))
 43893  	}
 43894  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 43895  		return TCL_ERROR
 43896  	}
 43897  	return TCL_OK
 43898  }
 43899  
 43900  // Usage:  sqlite3_exec_hex  DB  HEX
 43901  //
 43902  // Invoke the sqlite3_exec() on a string that is obtained by translating
 43903  // HEX into ASCII.  Most characters are translated as is.  %HH becomes
 43904  // a hex character.
 43905  func test_exec_hex(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:334:26: */
 43906  	bp := tls.Alloc(806)
 43907  	defer tls.Free(806)
 43908  
 43909  	// var db uintptr at bp+40, 8
 43910  
 43911  	// var str Tcl_DString at bp+552, 216
 43912  
 43913  	var rc int32
 43914  	var i int32
 43915  	var j int32
 43916  	*(*uintptr)(unsafe.Pointer(bp + 768 /* zErr */)) = uintptr(0)
 43917  	var zHex uintptr
 43918  	// var zSql [501]int8 at bp+48, 501
 43919  
 43920  	// var zBuf [30]int8 at bp+776, 30
 43921  
 43922  	if argc != 3 {
 43923  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 43924  			ts+15454 /* " DB HEX" */, 0))
 43925  		return TCL_ERROR
 43926  	}
 43927  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+40 /* &db */) != 0 {
 43928  		return TCL_ERROR
 43929  	}
 43930  	zHex = *(*uintptr)(unsafe.Pointer(argv + 2*8))
 43931  	i = libc.AssignInt32(&j, 0)
 43932  __1:
 43933  	if !((uint64(i) < (uint64(unsafe.Sizeof([501]int8{})) - uint64(1))) && (*(*int8)(unsafe.Pointer(zHex + uintptr(j))) != 0)) {
 43934  		goto __3
 43935  	}
 43936  	{
 43937  		if ((int32(*(*int8)(unsafe.Pointer(zHex + uintptr(j)))) == '%') && (*(*int8)(unsafe.Pointer(zHex + uintptr((j + 2)))) != 0)) && (*(*int8)(unsafe.Pointer(zHex + uintptr((j + 2)))) != 0) {
 43938  			*(*int8)(unsafe.Pointer(bp + 48 /* &zSql[0] */ + uintptr(i))) = (int8((testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(zHex + uintptr((j + 1)))))) << 4) + testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(zHex + uintptr((j + 2))))))))
 43939  			j = j + (2)
 43940  		} else {
 43941  			*(*int8)(unsafe.Pointer(bp + 48 /* &zSql[0] */ + uintptr(i))) = *(*int8)(unsafe.Pointer(zHex + uintptr(j)))
 43942  		}
 43943  
 43944  	}
 43945  	goto __2
 43946  __2:
 43947  	i++
 43948  	j++
 43949  	goto __1
 43950  	goto __3
 43951  __3:
 43952  	;
 43953  	*(*int8)(unsafe.Pointer(bp + 48 /* &zSql[0] */ + uintptr(i))) = int8(0)
 43954  	tcl.XTcl_DStringInit(tls, bp+552 /* &str */)
 43955  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), bp+48 /* &zSql[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 43956  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 43957  	}{exec_printf_cb})), bp+552 /* &str */, bp+768 /* &zErr */)
 43958  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+776 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, rc))
 43959  	tcl.XTcl_AppendElement(tls, interp, bp+776 /* &zBuf[0] */)
 43960  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 43961  		if rc == SQLITE_OK {
 43962  			return (*Tcl_DString)(unsafe.Pointer(bp + 552 /* &str */)).Fstring
 43963  		}
 43964  		return *(*uintptr)(unsafe.Pointer(bp + 768 /* zErr */))
 43965  	}())
 43966  	tcl.XTcl_DStringFree(tls, bp+552 /* &str */)
 43967  	if *(*uintptr)(unsafe.Pointer(bp + 768 /* zErr */)) != 0 {
 43968  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 768 /* zErr */)))
 43969  	}
 43970  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), rc) != 0 {
 43971  		return TCL_ERROR
 43972  	}
 43973  	return TCL_OK
 43974  }
 43975  
 43976  // Usage:  db_enter DB
 43977  //         db_leave DB
 43978  //
 43979  // Enter or leave the mutex on a database connection.
 43980  func db_enter(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:380:26: */
 43981  	bp := tls.Alloc(40)
 43982  	defer tls.Free(40)
 43983  
 43984  	// var db uintptr at bp+32, 8
 43985  
 43986  	if argc != 2 {
 43987  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 43988  			ts+15462 /* " DB" */, 0))
 43989  		return TCL_ERROR
 43990  	}
 43991  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 43992  		return TCL_ERROR
 43993  	}
 43994  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 43995  	return TCL_OK
 43996  }
 43997  
 43998  func db_leave(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:396:26: */
 43999  	bp := tls.Alloc(40)
 44000  	defer tls.Free(40)
 44001  
 44002  	// var db uintptr at bp+32, 8
 44003  
 44004  	if argc != 2 {
 44005  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44006  			ts+15462 /* " DB" */, 0))
 44007  		return TCL_ERROR
 44008  	}
 44009  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44010  		return TCL_ERROR
 44011  	}
 44012  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 44013  	return TCL_OK
 44014  }
 44015  
 44016  // Usage:  sqlite3_exec  DB  SQL
 44017  //
 44018  // Invoke the sqlite3_exec interface using the open database DB
 44019  func test_exec(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:418:26: */
 44020  	bp := tls.Alloc(310)
 44021  	defer tls.Free(310)
 44022  
 44023  	// var db uintptr at bp+48, 8
 44024  
 44025  	// var str Tcl_DString at bp+56, 216
 44026  
 44027  	var rc int32
 44028  	*(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)) = uintptr(0)
 44029  	var zSql uintptr
 44030  	var i int32
 44031  	var j int32
 44032  	// var zBuf [30]int8 at bp+280, 30
 44033  
 44034  	if argc != 3 {
 44035  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44036  			ts+15466 /* " DB SQL" */, 0))
 44037  		return TCL_ERROR
 44038  	}
 44039  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+48 /* &db */) != 0 {
 44040  		return TCL_ERROR
 44041  	}
 44042  	tcl.XTcl_DStringInit(tls, bp+56 /* &str */)
 44043  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 44044  	for i = libc.AssignInt32(&j, 0); *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0; {
 44045  		if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == '%' {
 44046  			*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = (int8((testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 1)))))) << 4) + testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(zSql + uintptr((i + 2))))))))
 44047  			i = i + (3)
 44048  		} else {
 44049  			*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&i, 1))))
 44050  		}
 44051  	}
 44052  	*(*int8)(unsafe.Pointer(zSql + uintptr(j))) = int8(0)
 44053  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*uintptr)(unsafe.Pointer(&struct {
 44054  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 44055  	}{exec_printf_cb})), bp+56 /* &str */, bp+272 /* &zErr */)
 44056  	sqlite3.Xsqlite3_free(tls, zSql)
 44057  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+280 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 44058  	tcl.XTcl_AppendElement(tls, interp, bp+280 /* &zBuf[0] */)
 44059  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 44060  		if rc == SQLITE_OK {
 44061  			return (*Tcl_DString)(unsafe.Pointer(bp + 56 /* &str */)).Fstring
 44062  		}
 44063  		return *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */))
 44064  	}())
 44065  	tcl.XTcl_DStringFree(tls, bp+56 /* &str */)
 44066  	if *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)) != 0 {
 44067  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 272 /* zErr */)))
 44068  	}
 44069  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 44070  		return TCL_ERROR
 44071  	}
 44072  	return TCL_OK
 44073  }
 44074  
 44075  // Usage:  sqlite3_exec_nr  DB  SQL
 44076  //
 44077  // Invoke the sqlite3_exec interface using the open database DB.  Discard
 44078  // all results
 44079  func test_exec_nr(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:465:26: */
 44080  	bp := tls.Alloc(48)
 44081  	defer tls.Free(48)
 44082  
 44083  	// var db uintptr at bp+32, 8
 44084  
 44085  	var rc int32
 44086  	*(*uintptr)(unsafe.Pointer(bp + 40 /* zErr */)) = uintptr(0)
 44087  	if argc != 3 {
 44088  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44089  			ts+15466 /* " DB SQL" */, 0))
 44090  		return TCL_ERROR
 44091  	}
 44092  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44093  		return TCL_ERROR
 44094  	}
 44095  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), uintptr(0), uintptr(0), bp+40 /* &zErr */)
 44096  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 44097  		return TCL_ERROR
 44098  	}
 44099  	return TCL_OK
 44100  }
 44101  
 44102  // Usage:  sqlite3_mprintf_z_test  SEPARATOR  ARG0  ARG1 ...
 44103  //
 44104  // Test the %z format of sqlite_mprintf().  Use multiple mprintf() calls to
 44105  // concatenate arg0 through argn using separator as the separator.
 44106  // Return the result.
 44107  func test_mprintf_z(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:492:26: */
 44108  	bp := tls.Alloc(40)
 44109  	defer tls.Free(40)
 44110  
 44111  	var zResult uintptr = uintptr(0)
 44112  	var i int32
 44113  
 44114  	for i = 2; (i < argc) && ((i == 2) || (zResult != 0)); i++ {
 44115  		zResult = sqlite3.Xsqlite3_mprintf(tls, ts+15474 /* "%z%s%s" */, libc.VaList(bp, zResult, *(*uintptr)(unsafe.Pointer(argv + 1*8)), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 44116  	}
 44117  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, zResult, 0))
 44118  	sqlite3.Xsqlite3_free(tls, zResult)
 44119  	return TCL_OK
 44120  }
 44121  
 44122  // Usage:  sqlite3_mprintf_n_test  STRING
 44123  //
 44124  // Test the %n format of sqlite_mprintf().  Return the length of the
 44125  // input string.
 44126  func test_mprintf_n(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:515:26: */
 44127  	bp := tls.Alloc(20)
 44128  	defer tls.Free(20)
 44129  
 44130  	var zStr uintptr
 44131  	*(*int32)(unsafe.Pointer(bp + 16 /* n */)) = 0
 44132  	zStr = sqlite3.Xsqlite3_mprintf(tls, ts+15481 /* "%s%n" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+16 /* &n */))
 44133  	sqlite3.Xsqlite3_free(tls, zStr)
 44134  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 16 /* n */))))
 44135  	return TCL_OK
 44136  }
 44137  
 44138  // Usage:  sqlite3_snprintf_int  SIZE FORMAT  INT
 44139  //
 44140  // Test the of sqlite3_snprintf() routine.  SIZE is the size of the
 44141  // output buffer in bytes.  The maximum size is 100.  FORMAT is the
 44142  // format string.  INT is a single integer argument.  The FORMAT
 44143  // string must require no more than this one integer argument.  If
 44144  // You pass in a format string that requires more than one argument,
 44145  // bad things will happen.
 44146  func test_snprintf_int(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:539:26: */
 44147  	bp := tls.Alloc(124)
 44148  	defer tls.Free(124)
 44149  
 44150  	// var zStr [100]int8 at bp+24, 100
 44151  
 44152  	var n int32 = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 44153  	var zFormat uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*8))
 44154  	var a1 int32 = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 44155  	if uint64(n) > uint64(unsafe.Sizeof([100]int8{})) {
 44156  		n = int32(unsafe.Sizeof([100]int8{}))
 44157  	}
 44158  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+24 /* &zStr[0] */, ts+15486 /* "abcdefghijklmnop..." */, 0)
 44159  	sqlite3.Xsqlite3_snprintf(tls, n, bp+24 /* &zStr[0] */, zFormat, libc.VaList(bp, a1))
 44160  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, bp+24 /* &zStr[0] */, 0))
 44161  	return TCL_OK
 44162  }
 44163  
 44164  // Usage:  sqlite3_get_table_printf  DB  FORMAT  STRING  ?--no-counts?
 44165  //
 44166  // Invoke the sqlite3_get_table_printf() interface using the open database
 44167  // DB.  The SQL is the string FORMAT.  The format string should contain
 44168  // one %s or %q.  STRING is the value inserted into %s or %q.
 44169  func test_get_table_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:565:26: */
 44170  	bp := tls.Alloc(350)
 44171  	defer tls.Free(350)
 44172  
 44173  	// var db uintptr at bp+72, 8
 44174  
 44175  	// var str Tcl_DString at bp+80, 216
 44176  
 44177  	var rc int32
 44178  	*(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)) = uintptr(0)
 44179  	*(*int32)(unsafe.Pointer(bp + 312 /* nRow */)) = 0
 44180  	*(*int32)(unsafe.Pointer(bp + 316 /* nCol */)) = 0
 44181  	// var aResult uintptr at bp+296, 8
 44182  
 44183  	var i int32
 44184  	// var zBuf [30]int8 at bp+320, 30
 44185  
 44186  	var zSql uintptr
 44187  	*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = -1
 44188  	if argc == 5 {
 44189  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*8)), bp+64 /* &resCount */) != 0 {
 44190  			return TCL_ERROR
 44191  		}
 44192  	}
 44193  	if (argc != 4) && (argc != 5) {
 44194  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44195  			ts+15513 /* " DB FORMAT STRIN..." */, 0))
 44196  		return TCL_ERROR
 44197  	}
 44198  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+72 /* &db */) != 0 {
 44199  		return TCL_ERROR
 44200  	}
 44201  	tcl.XTcl_DStringInit(tls, bp+80 /* &str */)
 44202  	zSql = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 3*8))))
 44203  	if argc == 5 {
 44204  		rc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), zSql, bp+296 /* &aResult */, uintptr(0), uintptr(0), bp+304 /* &zErr */)
 44205  	} else {
 44206  		rc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), zSql, bp+296 /* &aResult */, bp+312 /* &nRow */, bp+316 /* &nCol */, bp+304 /* &zErr */)
 44207  		*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = ((*(*int32)(unsafe.Pointer(bp + 312 /* nRow */)) + 1) * *(*int32)(unsafe.Pointer(bp + 316 /* nCol */)))
 44208  	}
 44209  	sqlite3.Xsqlite3_free(tls, zSql)
 44210  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 44211  	tcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)
 44212  	if rc == SQLITE_OK {
 44213  		if argc == 4 {
 44214  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 312 /* nRow */))))
 44215  			tcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)
 44216  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+320 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(bp + 316 /* nCol */))))
 44217  			tcl.XTcl_AppendElement(tls, interp, bp+320 /* &zBuf[0] */)
 44218  		}
 44219  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 64 /* resCount */)); i++ {
 44220  			tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 44221  				if *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)) + uintptr(i)*8)) != 0 {
 44222  					return *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)) + uintptr(i)*8))
 44223  				}
 44224  				return ts + 5707 /* "NULL" */
 44225  			}())
 44226  		}
 44227  	} else {
 44228  		tcl.XTcl_AppendElement(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)))
 44229  	}
 44230  	sqlite3.Xsqlite3_free_table(tls, *(*uintptr)(unsafe.Pointer(bp + 296 /* aResult */)))
 44231  	if *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)) != 0 {
 44232  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 304 /* zErr */)))
 44233  	}
 44234  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 72 /* db */)), rc) != 0 {
 44235  		return TCL_ERROR
 44236  	}
 44237  	return TCL_OK
 44238  }
 44239  
 44240  // Usage:  sqlite3_last_insert_rowid DB
 44241  //
 44242  // Returns the integer ROWID of the most recent insert.
 44243  func test_last_rowid(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:628:26: */
 44244  	bp := tls.Alloc(94)
 44245  	defer tls.Free(94)
 44246  
 44247  	// var db uintptr at bp+56, 8
 44248  
 44249  	// var zBuf [30]int8 at bp+64, 30
 44250  
 44251  	if argc != 2 {
 44252  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+15539 /* " DB\"" */, 0))
 44253  		return TCL_ERROR
 44254  	}
 44255  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+56 /* &db */) != 0 {
 44256  		return TCL_ERROR
 44257  	}
 44258  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+64 /* &zBuf[0] */, ts+11354 /* "%lld" */, libc.VaList(bp+32, sqlite3.Xsqlite3_last_insert_rowid(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)))))
 44259  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+64 /* &zBuf[0] */, 0))
 44260  	return SQLITE_OK
 44261  }
 44262  
 44263  // Usage:  sqlite3_key DB KEY
 44264  //
 44265  // Set the codec key.
 44266  func test_key(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:652:26: */
 44267  	return TCL_OK
 44268  }
 44269  
 44270  // Usage:  sqlite3_rekey DB KEY
 44271  //
 44272  // Change the codec key.
 44273  func test_rekey(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:666:26: */
 44274  	return TCL_OK
 44275  }
 44276  
 44277  // Usage:  sqlite3_close DB
 44278  //
 44279  // Closes the database opened by sqlite3_open.
 44280  func sqlite_test_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:680:26: */
 44281  	bp := tls.Alloc(40)
 44282  	defer tls.Free(40)
 44283  
 44284  	// var db uintptr at bp+32, 8
 44285  
 44286  	var rc int32
 44287  	if argc != 2 {
 44288  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44289  			ts+15544 /* " FILENAME\"" */, 0))
 44290  		return TCL_ERROR
 44291  	}
 44292  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44293  		return TCL_ERROR
 44294  	}
 44295  	rc = sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 44296  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 44297  	return TCL_OK
 44298  }
 44299  
 44300  // Usage:  sqlite3_close_v2 DB
 44301  //
 44302  // Closes the database opened by sqlite3_open.
 44303  func sqlite_test_close_v2(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:704:26: */
 44304  	bp := tls.Alloc(40)
 44305  	defer tls.Free(40)
 44306  
 44307  	// var db uintptr at bp+32, 8
 44308  
 44309  	var rc int32
 44310  	if argc != 2 {
 44311  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44312  			ts+15544 /* " FILENAME\"" */, 0))
 44313  		return TCL_ERROR
 44314  	}
 44315  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44316  		return TCL_ERROR
 44317  	}
 44318  	rc = sqlite3.Xsqlite3_close_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 44319  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 44320  	return TCL_OK
 44321  }
 44322  
 44323  // Implementation of the x_coalesce() function.
 44324  // Return the first argument non-NULL argument.
 44325  func t1_ifnullFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:727:13: */
 44326  	var i int32
 44327  	for i = 0; i < argc; i++ {
 44328  		if SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) {
 44329  			var n int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 44330  			sqlite3.Xsqlite3_result_text(tls, context, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))),
 44331  				n, libc.UintptrFromInt32(-1))
 44332  			break
 44333  		}
 44334  	}
 44335  }
 44336  
 44337  // These are test functions.    hex8() interprets its argument as
 44338  // UTF8 and returns a hex encoding.  hex16le() interprets its argument
 44339  // as UTF16le and returns a hex encoding.
 44340  func hex8Func(tls *libc.TLS, p uintptr, argc int32, argv uintptr) { /* test1.c:748:13: */
 44341  	bp := tls.Alloc(208)
 44342  	defer tls.Free(208)
 44343  
 44344  	var z uintptr
 44345  	var i int32
 44346  	// var zBuf [200]int8 at bp+8, 200
 44347  
 44348  	z = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44349  	for i = 0; (uint64(i) < ((uint64(unsafe.Sizeof([200]int8{})) / uint64(2)) - uint64(2))) && (*(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0); i++ {
 44350  		sqlite3.Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([200]int8{})) - (uint64(i * 2)))), (bp + 8 /* &zBuf */ + uintptr((i * 2))), ts+15555 /* "%02x" */, libc.VaList(bp, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))))
 44351  	}
 44352  	*(*int8)(unsafe.Pointer(bp + 8 /* &zBuf[0] */ + uintptr((i * 2)))) = int8(0)
 44353  	sqlite3.Xsqlite3_result_text(tls, p, bp+8 /* zBuf */, -1, libc.UintptrFromInt32(-1))
 44354  }
 44355  
 44356  func hex16Func(tls *libc.TLS, p uintptr, argc int32, argv uintptr) { /* test1.c:760:13: */
 44357  	bp := tls.Alloc(408)
 44358  	defer tls.Free(408)
 44359  
 44360  	var z uintptr
 44361  	var i int32
 44362  	// var zBuf [400]int8 at bp+8, 400
 44363  
 44364  	z = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44365  	for i = 0; (uint64(i) < ((uint64(unsafe.Sizeof([400]int8{})) / uint64(4)) - uint64(4))) && (*(*uint16)(unsafe.Pointer(z + uintptr(i)*2)) != 0); i++ {
 44366  		sqlite3.Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof([400]int8{})) - (uint64(i * 4)))), (bp + 8 /* &zBuf */ + uintptr((i * 4))), ts+15560 /* "%04x" */, libc.VaList(bp, (int32(*(*uint16)(unsafe.Pointer(z + uintptr(i)*2)))&0xff)))
 44367  	}
 44368  	*(*int8)(unsafe.Pointer(bp + 8 /* &zBuf[0] */ + uintptr((i * 4)))) = int8(0)
 44369  	sqlite3.Xsqlite3_result_text(tls, p, bp+8 /* zBuf */, -1, libc.UintptrFromInt32(-1))
 44370  }
 44371  
 44372  // A structure into which to accumulate text.
 44373  type dstr = struct {
 44374  	FnAlloc int32
 44375  	FnUsed  int32
 44376  	Fz      uintptr
 44377  } /* test1.c:776:1 */
 44378  
 44379  // Append text to a dstr
 44380  func dstrAppend(tls *libc.TLS, p uintptr, z uintptr, divider int32) { /* test1.c:785:13: */
 44381  	var n int32 = int32(libc.Xstrlen(tls, z))
 44382  	if (((*dstr)(unsafe.Pointer(p)).FnUsed + n) + 2) > (*dstr)(unsafe.Pointer(p)).FnAlloc {
 44383  		var zNew uintptr
 44384  		(*dstr)(unsafe.Pointer(p)).FnAlloc = ((((*dstr)(unsafe.Pointer(p)).FnAlloc * 2) + n) + 200)
 44385  		zNew = sqlite3.Xsqlite3_realloc(tls, (*dstr)(unsafe.Pointer(p)).Fz, (*dstr)(unsafe.Pointer(p)).FnAlloc)
 44386  		if zNew == uintptr(0) {
 44387  			sqlite3.Xsqlite3_free(tls, (*dstr)(unsafe.Pointer(p)).Fz)
 44388  			libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(dstr{})))
 44389  			return
 44390  		}
 44391  		(*dstr)(unsafe.Pointer(p)).Fz = zNew
 44392  	}
 44393  	if (divider != 0) && ((*dstr)(unsafe.Pointer(p)).FnUsed > 0) {
 44394  		*(*int8)(unsafe.Pointer((*dstr)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*dstr)(unsafe.Pointer(p)).FnUsed, 1)))) = int8(divider)
 44395  	}
 44396  	libc.Xmemcpy(tls, ((*dstr)(unsafe.Pointer(p)).Fz + uintptr((*dstr)(unsafe.Pointer(p)).FnUsed)), z, (uint64(n + 1)))
 44397  	*(*int32)(unsafe.Pointer(p + 4 /* &.nUsed */)) += (n)
 44398  }
 44399  
 44400  // Invoked for each callback from sqlite3ExecFunc
 44401  func execFuncCallback(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, NotUsed uintptr) int32 { /* test1.c:808:12: */
 44402  	var p uintptr = pData
 44403  	var i int32
 44404  	for i = 0; i < argc; i++ {
 44405  		if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)) == uintptr(0) {
 44406  			dstrAppend(tls, p, ts+5707 /* "NULL" */, ' ')
 44407  		} else {
 44408  			dstrAppend(tls, p, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), ' ')
 44409  		}
 44410  	}
 44411  	return 0
 44412  }
 44413  
 44414  // Implementation of the x_sqlite_exec() function.  This function takes
 44415  // a single argument and attempts to execute that argument as SQL code.
 44416  // This is illegal and should set the SQLITE_MISUSE flag on the database.
 44417  //
 44418  // 2004-Jan-07:  We have changed this to make it legal to call sqlite3_exec()
 44419  // from within a function call.
 44420  //
 44421  // This routine simulates the effect of having two threads attempt to
 44422  // use the same database at the same time.
 44423  func sqlite3ExecFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:832:13: */
 44424  	bp := tls.Alloc(16)
 44425  	defer tls.Free(16)
 44426  
 44427  	// var x dstr at bp, 16
 44428  
 44429  	libc.Xmemset(tls, bp /* &x */, 0, uint64(unsafe.Sizeof(dstr{})))
 44430  	sqlite3.Xsqlite3_exec(tls, sqlite3.Xsqlite3_user_data(tls, context),
 44431  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))),
 44432  		*(*uintptr)(unsafe.Pointer(&struct {
 44433  			f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 44434  		}{execFuncCallback})), bp /* &x */, uintptr(0))
 44435  	sqlite3.Xsqlite3_result_text(tls, context, (*dstr)(unsafe.Pointer(bp /* &x */)).Fz, (*dstr)(unsafe.Pointer(bp /* &x */)).FnUsed, libc.UintptrFromInt32(-1))
 44436  	sqlite3.Xsqlite3_free(tls, (*dstr)(unsafe.Pointer(bp /* &x */)).Fz)
 44437  }
 44438  
 44439  // Implementation of tkt2213func(), a scalar function that takes exactly
 44440  // one argument. It has two interesting features:
 44441  //
 44442  // * It calls sqlite3_value_text() 3 times on the argument sqlite3_value*.
 44443  //   If the three pointers returned are not the same an SQL error is raised.
 44444  //
 44445  // * Otherwise it returns a copy of the text representation of its
 44446  //   argument in such a way as the VDBE representation is a Mem* cell
 44447  //   with the MEM_Term flag clear.
 44448  //
 44449  // Ticket #2213 can therefore be tested by evaluating the following
 44450  // SQL expression:
 44451  //
 44452  //   tkt2213func(tkt2213func('a string'));
 44453  func tkt2213Function(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:862:13: */
 44454  	var nText int32
 44455  	var zText1 uintptr
 44456  	var zText2 uintptr
 44457  	var zText3 uintptr
 44458  
 44459  	nText = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44460  	zText1 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44461  	zText2 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44462  	zText3 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44463  
 44464  	if (zText1 != zText2) || (zText2 != zText3) {
 44465  		sqlite3.Xsqlite3_result_error(tls, context, ts+15565 /* "tkt2213 is not f..." */, -1)
 44466  	} else {
 44467  		var zCopy uintptr = sqlite3.Xsqlite3_malloc(tls, nText)
 44468  		libc.Xmemcpy(tls, zCopy, zText1, uint64(nText))
 44469  		sqlite3.Xsqlite3_result_text(tls, context, zCopy, nText, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 44470  	}
 44471  }
 44472  
 44473  // The following SQL function takes 4 arguments.  The 2nd and
 44474  // 4th argument must be one of these strings:  'text', 'text16',
 44475  // or 'blob' corresponding to API functions
 44476  //
 44477  //      sqlite3_value_text()
 44478  //      sqlite3_value_text16()
 44479  //      sqlite3_value_blob()
 44480  //
 44481  // The third argument is a string, either 'bytes' or 'bytes16' or 'noop',
 44482  // corresponding to APIs:
 44483  //
 44484  //      sqlite3_value_bytes()
 44485  //      sqlite3_value_bytes16()
 44486  //      noop
 44487  //
 44488  // The APIs designated by the 2nd through 4th arguments are applied
 44489  // to the first argument in order.  If the pointers returned by the
 44490  // second and fourth are different, this routine returns 1.  Otherwise,
 44491  // this routine returns 0.
 44492  //
 44493  // This function is used to test to see when returned pointers from
 44494  // the _text(), _text16() and _blob() APIs become invalidated.
 44495  func ptrChngFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:910:13: */
 44496  	var p1 uintptr
 44497  	var p2 uintptr
 44498  	var zCmd uintptr
 44499  	if argc != 4 {
 44500  		return
 44501  	}
 44502  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 44503  	if zCmd == uintptr(0) {
 44504  		return
 44505  	}
 44506  	if libc.Xstrcmp(tls, zCmd, ts+13234 /* "text" */) == 0 {
 44507  		p1 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44508  	} else if libc.Xstrcmp(tls, zCmd, ts+15586 /* "text16" */) == 0 {
 44509  		p1 = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44510  	} else if libc.Xstrcmp(tls, zCmd, ts+13239 /* "blob" */) == 0 {
 44511  		p1 = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44512  	} else {
 44513  		return
 44514  	}
 44515  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 44516  	if zCmd == uintptr(0) {
 44517  		return
 44518  	}
 44519  	if libc.Xstrcmp(tls, zCmd, ts+15593 /* "bytes" */) == 0 {
 44520  		sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44521  	} else if libc.Xstrcmp(tls, zCmd, ts+15599 /* "bytes16" */) == 0 {
 44522  		sqlite3.Xsqlite3_value_bytes16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44523  	} else if libc.Xstrcmp(tls, zCmd, ts+15607 /* "noop" */) == 0 {
 44524  		// do nothing
 44525  	} else {
 44526  		return
 44527  	}
 44528  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 44529  	if zCmd == uintptr(0) {
 44530  		return
 44531  	}
 44532  	if libc.Xstrcmp(tls, zCmd, ts+13234 /* "text" */) == 0 {
 44533  		p2 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44534  	} else if libc.Xstrcmp(tls, zCmd, ts+15586 /* "text16" */) == 0 {
 44535  		p2 = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44536  	} else if libc.Xstrcmp(tls, zCmd, ts+13239 /* "blob" */) == 0 {
 44537  		p2 = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44538  	} else {
 44539  		return
 44540  	}
 44541  	sqlite3.Xsqlite3_result_int(tls, context, (libc.Bool32(p1 != p2)))
 44542  }
 44543  
 44544  // This SQL function returns a different answer each time it is called, even if
 44545  // the arguments are the same.
 44546  func nondeterministicFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:964:13: */
 44547  	sqlite3.Xsqlite3_result_int(tls, context, libc.PostIncInt32(&cnt, 1))
 44548  }
 44549  
 44550  var cnt int32 = 0 /* test1.c:969:14 */
 44551  
 44552  // This SQL function returns the integer value of its argument as a MEM_IntReal
 44553  // value.
 44554  func intrealFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:977:13: */
 44555  	bp := tls.Alloc(8)
 44556  	defer tls.Free(8)
 44557  
 44558  	var v sqlite3_int64 = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44559  	sqlite3.Xsqlite3_result_int64(tls, context, v)
 44560  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_RESULT_INTREAL, libc.VaList(bp, context))
 44561  }
 44562  
 44563  // Usage:  sqlite3_create_function DB
 44564  //
 44565  // Call the sqlite3_create_function API on the given database in order
 44566  // to create a function named "x_coalesce".  This function does the same thing
 44567  // as the "coalesce" function.  This function also registers an SQL function
 44568  // named "x_sqlite_exec" that invokes sqlite3_exec().  Invoking sqlite3_exec()
 44569  // in this way is illegal recursion and should raise an SQLITE_MISUSE error.
 44570  // The effect is similar to trying to use the same database connection from
 44571  // two threads at the same time.
 44572  //
 44573  // The original motivation for this routine was to be able to call the
 44574  // sqlite3_create_function function while a query is in progress in order
 44575  // to test the SQLITE_MISUSE detection logic.
 44576  func test_create_function(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1002:26: */
 44577  	bp := tls.Alloc(40)
 44578  	defer tls.Free(40)
 44579  
 44580  	var rc int32
 44581  	// var db uintptr at bp+32, 8
 44582  
 44583  	if argc != 2 {
 44584  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44585  			ts+15539 /* " DB\"" */, 0))
 44586  		return TCL_ERROR
 44587  	}
 44588  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44589  		return TCL_ERROR
 44590  	}
 44591  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15612 /* "x_coalesce" */, -1, SQLITE_UTF8, uintptr(0),
 44592  		*(*uintptr)(unsafe.Pointer(&struct {
 44593  			f func(*libc.TLS, uintptr, int32, uintptr)
 44594  		}{t1_ifnullFunc})), uintptr(0), uintptr(0))
 44595  	if rc == SQLITE_OK {
 44596  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15623 /* "hex8" */, 1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC),
 44597  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 44598  				f func(*libc.TLS, uintptr, int32, uintptr)
 44599  			}{hex8Func})), uintptr(0), uintptr(0))
 44600  	}
 44601  	if rc == SQLITE_OK {
 44602  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15628 /* "hex16" */, 1, (SQLITE_UTF16 | SQLITE_DETERMINISTIC),
 44603  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 44604  				f func(*libc.TLS, uintptr, int32, uintptr)
 44605  			}{hex16Func})), uintptr(0), uintptr(0))
 44606  	}
 44607  	if rc == SQLITE_OK {
 44608  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15634 /* "tkt2213func" */, 1, SQLITE_ANY, uintptr(0),
 44609  			*(*uintptr)(unsafe.Pointer(&struct {
 44610  				f func(*libc.TLS, uintptr, int32, uintptr)
 44611  			}{tkt2213Function})), uintptr(0), uintptr(0))
 44612  	}
 44613  	if rc == SQLITE_OK {
 44614  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15646 /* "pointer_change" */, 4, SQLITE_ANY, uintptr(0),
 44615  			*(*uintptr)(unsafe.Pointer(&struct {
 44616  				f func(*libc.TLS, uintptr, int32, uintptr)
 44617  			}{ptrChngFunction})), uintptr(0), uintptr(0))
 44618  	}
 44619  
 44620  	// Functions counter1() and counter2() have the same implementation - they
 44621  	// both return an ascending integer with each call.  But counter1() is marked
 44622  	// as non-deterministic and counter2() is marked as deterministic.
 44623  	if rc == SQLITE_OK {
 44624  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15661 /* "counter1" */, -1, SQLITE_UTF8,
 44625  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 44626  				f func(*libc.TLS, uintptr, int32, uintptr)
 44627  			}{nondeterministicFunction})), uintptr(0), uintptr(0))
 44628  	}
 44629  	if rc == SQLITE_OK {
 44630  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15670 /* "counter2" */, -1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC),
 44631  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 44632  				f func(*libc.TLS, uintptr, int32, uintptr)
 44633  			}{nondeterministicFunction})), uintptr(0), uintptr(0))
 44634  	}
 44635  
 44636  	// The intreal() function converts its argument to an integer and returns
 44637  	// it as a MEM_IntReal.
 44638  	if rc == SQLITE_OK {
 44639  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15679 /* "intreal" */, 1, SQLITE_UTF8,
 44640  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 44641  				f func(*libc.TLS, uintptr, int32, uintptr)
 44642  			}{intrealFunction})), uintptr(0), uintptr(0))
 44643  	}
 44644  
 44645  	// Use the sqlite3_create_function16() API here. Mainly for fun, but also
 44646  	// because it is not tested anywhere else.
 44647  	if rc == SQLITE_OK {
 44648  		var zUtf16 uintptr
 44649  		var pVal uintptr
 44650  		sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 44651  		pVal = sqlite3.Xsqlite3ValueNew(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 44652  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, ts+15687 /* "x_sqlite_exec" */, uint8(SQLITE_UTF8), uintptr(0))
 44653  		zUtf16 = sqlite3.Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE))
 44654  		if (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FmallocFailed != 0 {
 44655  			rc = SQLITE_NOMEM
 44656  		} else {
 44657  			rc = sqlite3.Xsqlite3_create_function16(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zUtf16,
 44658  				1, SQLITE_UTF16, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 44659  					f func(*libc.TLS, uintptr, int32, uintptr)
 44660  				}{sqlite3ExecFunc})), uintptr(0), uintptr(0))
 44661  		}
 44662  		sqlite3.Xsqlite3ValueFree(tls, pVal)
 44663  		sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 44664  	}
 44665  
 44666  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 44667  		return TCL_ERROR
 44668  	}
 44669  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 44670  	return TCL_OK
 44671  }
 44672  
 44673  // Usage:  sqlite3_drop_modules DB ?NAME ...?
 44674  //
 44675  // Invoke the sqlite3_drop_modules(D,L) interface on database
 44676  // connection DB, in order to drop all modules except those named in
 44677  // the argument.
 44678  func test_drop_modules(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1092:26: */
 44679  	bp := tls.Alloc(40)
 44680  	defer tls.Free(40)
 44681  
 44682  	// var db uintptr at bp+32, 8
 44683  
 44684  	if argc != 2 {
 44685  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44686  			ts+15539 /* " DB\"" */, 0))
 44687  		return TCL_ERROR
 44688  	}
 44689  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44690  		return TCL_ERROR
 44691  	}
 44692  	sqlite3.Xsqlite3_drop_modules(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), func() uintptr {
 44693  		if argc > 2 {
 44694  			return (argv + uintptr(2)*8)
 44695  		}
 44696  		return uintptr(0)
 44697  	}())
 44698  	return TCL_OK
 44699  }
 44700  
 44701  // Routines to implement the x_count() aggregate function.
 44702  //
 44703  // x_count() counts the number of non-null arguments.  But there are
 44704  // some twists for testing purposes.
 44705  //
 44706  // If the argument to x_count() is 40 then a UTF-8 error is reported
 44707  // on the step function.  If x_count(41) is seen, then a UTF-16 error
 44708  // is reported on the step function.  If the total count is 42, then
 44709  // a UTF-8 error is reported on the finalize function.
 44710  type t1CountCtx1 = struct{ Fn int32 } /* test1.c:1123:9 */
 44711  
 44712  // Routines to implement the x_count() aggregate function.
 44713  //
 44714  // x_count() counts the number of non-null arguments.  But there are
 44715  // some twists for testing purposes.
 44716  //
 44717  // If the argument to x_count() is 40 then a UTF-8 error is reported
 44718  // on the step function.  If x_count(41) is seen, then a UTF-16 error
 44719  // is reported on the step function.  If the total count is 42, then
 44720  // a UTF-8 error is reported on the finalize function.
 44721  type t1CountCtx = t1CountCtx1 /* test1.c:1123:27 */
 44722  
 44723  func t1CountStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:1127:13: */
 44724  	bp := tls.Alloc(9)
 44725  	defer tls.Free(9)
 44726  
 44727  	var p uintptr
 44728  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(t1CountCtx{})))
 44729  	if ((argc == 0) || (SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))))) && (p != 0) {
 44730  		(*t1CountCtx)(unsafe.Pointer(p)).Fn++
 44731  	}
 44732  	if argc > 0 {
 44733  		var v int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 44734  		if v == 40 {
 44735  			sqlite3.Xsqlite3_result_error(tls, context, ts+15701 /* "value of 40 hand..." */, -1)
 44736  		} else if v == 41 {
 44737  			*(*[9]int8)(unsafe.Pointer(bp /* zUtf16ErrMsg */)) = [9]int8{int8(0), int8(0x61), int8(0), int8(0x62), int8(0), int8(0x63), int8(0), int8(0), int8(0)}
 44738  			sqlite3.Xsqlite3_result_error16(tls, context, (bp /* &zUtf16ErrMsg */ + 1), -1)
 44739  		}
 44740  	}
 44741  }
 44742  
 44743  func t1CountFinalize(tls *libc.TLS, context uintptr) { /* test1.c:1149:13: */
 44744  	var p uintptr
 44745  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(t1CountCtx{})))
 44746  	if p != 0 {
 44747  		if (*t1CountCtx)(unsafe.Pointer(p)).Fn == 42 {
 44748  			sqlite3.Xsqlite3_result_error(tls, context, ts+15731 /* "x_count totals t..." */, -1)
 44749  		} else {
 44750  			sqlite3.Xsqlite3_result_int(tls, context, func() int32 {
 44751  				if p != 0 {
 44752  					return (*t1CountCtx)(unsafe.Pointer(p)).Fn
 44753  				}
 44754  				return 0
 44755  			}())
 44756  		}
 44757  	}
 44758  }
 44759  
 44760  func legacyCountStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:1162:13: */
 44761  	// no-op
 44762  }
 44763  
 44764  func legacyCountFinalize(tls *libc.TLS, context uintptr) { /* test1.c:1170:13: */
 44765  	sqlite3.Xsqlite3_result_int(tls, context, sqlite3.Xsqlite3_aggregate_count(tls, context))
 44766  }
 44767  
 44768  // Usage:  sqlite3_create_aggregate DB
 44769  //
 44770  // Call the sqlite3_create_function API on the given database in order
 44771  // to create a function named "x_count".  This function is similar
 44772  // to the built-in count() function, with a few special quirks
 44773  // for testing the sqlite3_result_error() APIs.
 44774  //
 44775  // The original motivation for this routine was to be able to call the
 44776  // sqlite3_create_aggregate function while a query is in progress in order
 44777  // to test the SQLITE_MISUSE detection logic.  See misuse.test.
 44778  //
 44779  // This routine was later extended to test the use of sqlite3_result_error()
 44780  // within aggregate functions.
 44781  //
 44782  // Later: It is now also extended to register the aggregate function
 44783  // "legacy_count()" with the supplied database handle. This is used
 44784  // to test the deprecated sqlite3_aggregate_count() API.
 44785  func test_create_aggregate(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1194:26: */
 44786  	bp := tls.Alloc(40)
 44787  	defer tls.Free(40)
 44788  
 44789  	// var db uintptr at bp+32, 8
 44790  
 44791  	var rc int32
 44792  	if argc != 2 {
 44793  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44794  			ts+15544 /* " FILENAME\"" */, 0))
 44795  		return TCL_ERROR
 44796  	}
 44797  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 44798  		return TCL_ERROR
 44799  	}
 44800  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15752 /* "x_count" */, 0, SQLITE_UTF8, uintptr(0), uintptr(0),
 44801  		*(*uintptr)(unsafe.Pointer(&struct {
 44802  			f func(*libc.TLS, uintptr, int32, uintptr)
 44803  		}{t1CountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{t1CountFinalize})))
 44804  	if rc == SQLITE_OK {
 44805  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15752 /* "x_count" */, 1, SQLITE_UTF8, uintptr(0), uintptr(0),
 44806  			*(*uintptr)(unsafe.Pointer(&struct {
 44807  				f func(*libc.TLS, uintptr, int32, uintptr)
 44808  			}{t1CountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{t1CountFinalize})))
 44809  	}
 44810  	if rc == SQLITE_OK {
 44811  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15760 /* "legacy_count" */, 0, SQLITE_ANY, uintptr(0), uintptr(0),
 44812  			*(*uintptr)(unsafe.Pointer(&struct {
 44813  				f func(*libc.TLS, uintptr, int32, uintptr)
 44814  			}{legacyCountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{legacyCountFinalize})))
 44815  	}
 44816  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 44817  		return TCL_ERROR
 44818  	}
 44819  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 44820  	return TCL_OK
 44821  }
 44822  
 44823  // Usage:  printf TEXT
 44824  //
 44825  // Send output to printf.  Use this rather than puts to merge the output
 44826  // in the correct sequence with debugging printfs inserted into C code.
 44827  // Puts uses a separate buffer and debugging statements will be out of
 44828  // sequence if it is used.
 44829  func test_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1235:26: */
 44830  	bp := tls.Alloc(40)
 44831  	defer tls.Free(40)
 44832  
 44833  	if argc != 2 {
 44834  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44835  			ts+15773 /* " TEXT\"" */, 0))
 44836  		return TCL_ERROR
 44837  	}
 44838  	libc.Xprintf(tls, ts+294 /* "%s\n" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 44839  	return TCL_OK
 44840  }
 44841  
 44842  // Usage:  sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER
 44843  //
 44844  // Call mprintf with three integer arguments
 44845  func sqlite3_mprintf_int(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1257:26: */
 44846  	bp := tls.Alloc(84)
 44847  	defer tls.Free(84)
 44848  
 44849  	// var a [3]int32 at bp+72, 12
 44850  
 44851  	var i int32
 44852  	var z uintptr
 44853  	if argc != 5 {
 44854  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44855  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 44856  		return TCL_ERROR
 44857  	}
 44858  	for i = 2; i < 5; i++ {
 44859  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 44860  			return TCL_ERROR
 44861  		}
 44862  	}
 44863  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */ + 1*4)), *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */ + 2*4))))
 44864  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 44865  	sqlite3.Xsqlite3_free(tls, z)
 44866  	return TCL_OK
 44867  }
 44868  
 44869  // Usage:  sqlite3_mprintf_int64 FORMAT INTEGER INTEGER INTEGER
 44870  //
 44871  // Call mprintf with three 64-bit integer arguments
 44872  func sqlite3_mprintf_int64(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1284:26: */
 44873  	bp := tls.Alloc(112)
 44874  	defer tls.Free(112)
 44875  
 44876  	var i int32
 44877  	// var a [3]sqlite_int64 at bp+88, 24
 44878  
 44879  	var z uintptr
 44880  	if argc != 5 {
 44881  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44882  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 44883  		return TCL_ERROR
 44884  	}
 44885  	for i = 2; i < 5; i++ {
 44886  		if sqlite3.Xsqlite3Atoi64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+88 /* &a */ +uintptr((i-2))*8), sqlite3.Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))), uint8(SQLITE_UTF8)) != 0 {
 44887  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+15801 /* "argument is not ..." */, 0))
 44888  			return TCL_ERROR
 44889  		}
 44890  	}
 44891  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+48, *(*sqlite_int64)(unsafe.Pointer(bp + 88 /* &a[0] */)), *(*sqlite_int64)(unsafe.Pointer(bp + 88 /* &a[0] */ + 1*8)), *(*sqlite_int64)(unsafe.Pointer(bp + 88 /* &a[0] */ + 2*8))))
 44892  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 44893  	sqlite3.Xsqlite3_free(tls, z)
 44894  	return TCL_OK
 44895  }
 44896  
 44897  // Usage:  sqlite3_mprintf_long FORMAT INTEGER INTEGER INTEGER
 44898  //
 44899  // Call mprintf with three long integer arguments.   This might be the
 44900  // same as sqlite3_mprintf_int or sqlite3_mprintf_int64, depending on
 44901  // platform.
 44902  func sqlite3_mprintf_long(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1317:26: */
 44903  	bp := tls.Alloc(112)
 44904  	defer tls.Free(112)
 44905  
 44906  	var i int32
 44907  	// var a [3]int64 at bp+88, 24
 44908  
 44909  	// var b [3]int32 at bp+72, 12
 44910  
 44911  	var z uintptr
 44912  	if argc != 5 {
 44913  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44914  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 44915  		return TCL_ERROR
 44916  	}
 44917  	for i = 2; i < 5; i++ {
 44918  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+72 /* &b */ +uintptr((i-2))*4)) != 0 {
 44919  			return TCL_ERROR
 44920  		}
 44921  		*(*int64)(unsafe.Pointer(bp + 88 /* &a[0] */ + uintptr((i-2))*8)) = int64(*(*int32)(unsafe.Pointer(bp + 72 /* &b[0] */ + uintptr((i-2))*4)))
 44922  		*(*int64)(unsafe.Pointer(bp + 88 /* &a */ + uintptr((i-2))*8)) &= int64(((u64((uint64(1))) << (uint64(unsafe.Sizeof(int32(0))) * uint64(8))) - uint64(1)))
 44923  	}
 44924  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, *(*int64)(unsafe.Pointer(bp + 88 /* &a[0] */)), *(*int64)(unsafe.Pointer(bp + 88 /* &a[0] */ + 1*8)), *(*int64)(unsafe.Pointer(bp + 88 /* &a[0] */ + 2*8))))
 44925  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 44926  	sqlite3.Xsqlite3_free(tls, z)
 44927  	return TCL_OK
 44928  }
 44929  
 44930  // Usage:  sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING
 44931  //
 44932  // Call mprintf with two integer arguments and one string argument
 44933  func sqlite3_mprintf_str(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1348:26: */
 44934  	bp := tls.Alloc(84)
 44935  	defer tls.Free(84)
 44936  
 44937  	// var a [3]int32 at bp+72, 12
 44938  
 44939  	var i int32
 44940  	var z uintptr
 44941  	if (argc < 4) || (argc > 5) {
 44942  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44943  			ts+15840 /* " FORMAT INT INT ..." */, 0))
 44944  		return TCL_ERROR
 44945  	}
 44946  	for i = 2; i < 4; i++ {
 44947  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 44948  			return TCL_ERROR
 44949  		}
 44950  	}
 44951  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */ + 1*4)), func() uintptr {
 44952  		if argc > 4 {
 44953  			return *(*uintptr)(unsafe.Pointer(argv + 4*8))
 44954  		}
 44955  		return uintptr(0)
 44956  	}()))
 44957  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 44958  	sqlite3.Xsqlite3_free(tls, z)
 44959  	return TCL_OK
 44960  }
 44961  
 44962  // Usage:  sqlite3_snprintf_str INTEGER FORMAT INTEGER INTEGER STRING
 44963  //
 44964  // Call mprintf with two integer arguments and one string argument
 44965  func sqlite3_snprintf_str(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1375:26: */
 44966  	bp := tls.Alloc(104)
 44967  	defer tls.Free(104)
 44968  
 44969  	// var a [3]int32 at bp+92, 12
 44970  
 44971  	var i int32
 44972  	// var n int32 at bp+88, 4
 44973  
 44974  	var z uintptr
 44975  	if (argc < 5) || (argc > 6) {
 44976  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 44977  			ts+15866 /* " INT FORMAT INT ..." */, 0))
 44978  		return TCL_ERROR
 44979  	}
 44980  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+88 /* &n */) != 0 {
 44981  		return TCL_ERROR
 44982  	}
 44983  	if *(*int32)(unsafe.Pointer(bp + 88 /* n */)) < 0 {
 44984  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+15896 /* "N must be non-ne..." */, 0))
 44985  		return TCL_ERROR
 44986  	}
 44987  	for i = 3; i < 5; i++ {
 44988  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+92 /* &a */ +uintptr((i-3))*4)) != 0 {
 44989  			return TCL_ERROR
 44990  		}
 44991  	}
 44992  	z = sqlite3.Xsqlite3_malloc(tls, (*(*int32)(unsafe.Pointer(bp + 88 /* n */)) + 1))
 44993  	sqlite3.Xsqlite3_snprintf(tls, *(*int32)(unsafe.Pointer(bp + 88 /* n */)), z, *(*uintptr)(unsafe.Pointer(argv + 2*8)), libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 92 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 92 /* &a[0] */ + 1*4)), func() uintptr {
 44994  		if argc > 4 {
 44995  			return *(*uintptr)(unsafe.Pointer(argv + 5*8))
 44996  		}
 44997  		return uintptr(0)
 44998  	}()))
 44999  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 45000  	sqlite3.Xsqlite3_free(tls, z)
 45001  	return TCL_OK
 45002  }
 45003  
 45004  // Usage:  sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE
 45005  //
 45006  // Call mprintf with two integer arguments and one double argument
 45007  func sqlite3_mprintf_double(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1409:26: */
 45008  	bp := tls.Alloc(96)
 45009  	defer tls.Free(96)
 45010  
 45011  	// var a [3]int32 at bp+72, 12
 45012  
 45013  	var i int32
 45014  	// var r float64 at bp+88, 8
 45015  
 45016  	var z uintptr
 45017  	if argc != 5 {
 45018  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45019  			ts+15919 /* " FORMAT INT INT ..." */, 0))
 45020  		return TCL_ERROR
 45021  	}
 45022  	for i = 2; i < 4; i++ {
 45023  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 45024  			return TCL_ERROR
 45025  		}
 45026  	}
 45027  	if tcl.XTcl_GetDouble(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*8)), bp+88 /* &r */) != 0 {
 45028  		return TCL_ERROR
 45029  	}
 45030  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */ + 1*4)), *(*float64)(unsafe.Pointer(bp + 88 /* r */))))
 45031  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 45032  	sqlite3.Xsqlite3_free(tls, z)
 45033  	return TCL_OK
 45034  }
 45035  
 45036  // Usage:  sqlite3_mprintf_scaled FORMAT DOUBLE DOUBLE
 45037  //
 45038  // Call mprintf with a single double argument which is the product of the
 45039  // two arguments given above.  This is used to generate overflow and underflow
 45040  // doubles to test that they are converted properly.
 45041  func sqlite3_mprintf_scaled(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1440:26: */
 45042  	bp := tls.Alloc(72)
 45043  	defer tls.Free(72)
 45044  
 45045  	var i int32
 45046  	// var r [2]float64 at bp+56, 16
 45047  
 45048  	var z uintptr
 45049  	if argc != 4 {
 45050  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45051  			ts+15943 /* " FORMAT DOUBLE D..." */, 0))
 45052  		return TCL_ERROR
 45053  	}
 45054  	for i = 2; i < 4; i++ {
 45055  		if tcl.XTcl_GetDouble(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)), (bp+56 /* &r */ +uintptr((i-2))*8)) != 0 {
 45056  			return TCL_ERROR
 45057  		}
 45058  	}
 45059  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, (*(*float64)(unsafe.Pointer(bp + 56 /* &r[0] */))**(*float64)(unsafe.Pointer(bp + 56 /* &r[0] */ + 1*8)))))
 45060  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, z, 0))
 45061  	sqlite3.Xsqlite3_free(tls, z)
 45062  	return TCL_OK
 45063  }
 45064  
 45065  // Usage:  sqlite3_mprintf_stronly FORMAT STRING
 45066  //
 45067  // Call mprintf with a single double argument which is the product of the
 45068  // two arguments given above.  This is used to generate overflow and underflow
 45069  // doubles to test that they are converted properly.
 45070  func sqlite3_mprintf_stronly(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1470:26: */
 45071  	bp := tls.Alloc(56)
 45072  	defer tls.Free(56)
 45073  
 45074  	var z uintptr
 45075  	if argc != 3 {
 45076  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45077  			ts+15966 /* " FORMAT STRING\"" */, 0))
 45078  		return TCL_ERROR
 45079  	}
 45080  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 45081  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, z, 0))
 45082  	sqlite3.Xsqlite3_free(tls, z)
 45083  	return TCL_OK
 45084  }
 45085  
 45086  // Usage:  sqlite3_mprintf_hexdouble FORMAT HEX
 45087  //
 45088  // Call mprintf with a single double argument which is derived from the
 45089  // hexadecimal encoding of an IEEE double.
 45090  func sqlite3_mprintf_hexdouble(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1494:26: */
 45091  	bp := tls.Alloc(112)
 45092  	defer tls.Free(112)
 45093  
 45094  	var z uintptr
 45095  	// var r float64 at bp+96, 8
 45096  
 45097  	// var x1 uint32 at bp+92, 4
 45098  
 45099  	// var x2 uint32 at bp+88, 4
 45100  
 45101  	// var d sqlite_uint64 at bp+104, 8
 45102  
 45103  	if argc != 3 {
 45104  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45105  			ts+15966 /* " FORMAT STRING\"" */, 0))
 45106  		return TCL_ERROR
 45107  	}
 45108  	if libc.Xsscanf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+15982 /* "%08x%08x" */, libc.VaList(bp+32, bp+88 /* &x2 */, bp+92 /* &x1 */)) != 2 {
 45109  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+15991 /* "2nd argument sho..." */, 0))
 45110  		return TCL_ERROR
 45111  	}
 45112  	*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) = sqlite_uint64(*(*uint32)(unsafe.Pointer(bp + 88 /* x2 */)))
 45113  	*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) = ((*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) << 32) + sqlite_uint64(*(*uint32)(unsafe.Pointer(bp + 92 /* x1 */))))
 45114  	libc.Xmemcpy(tls, bp+96 /* &r */, bp+104 /* &d */, uint64(unsafe.Sizeof(float64(0))))
 45115  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), libc.VaList(bp+64, *(*float64)(unsafe.Pointer(bp + 96 /* r */))))
 45116  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 45117  	sqlite3.Xsqlite3_free(tls, z)
 45118  	return TCL_OK
 45119  }
 45120  
 45121  // Usage: sqlite3_enable_shared_cache ?BOOLEAN?
 45122  //
 45123  func test_enable_shared(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1527:26: */
 45124  	bp := tls.Alloc(4)
 45125  	defer tls.Free(4)
 45126  
 45127  	var rc int32
 45128  	// var enable int32 at bp, 4
 45129  
 45130  	var ret int32 = 0
 45131  
 45132  	if (objc != 2) && (objc != 1) {
 45133  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16035 /* "?BOOLEAN?" */)
 45134  		return TCL_ERROR
 45135  	}
 45136  	ret = sqlite3.Xsqlite3Config.FsharedCacheEnabled
 45137  
 45138  	if objc == 2 {
 45139  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &enable */) != 0 {
 45140  			return TCL_ERROR
 45141  		}
 45142  		rc = sqlite3.Xsqlite3_enable_shared_cache(tls, *(*int32)(unsafe.Pointer(bp /* enable */)))
 45143  		if rc != SQLITE_OK {
 45144  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, rc), uintptr(0))
 45145  			return TCL_ERROR
 45146  		}
 45147  	}
 45148  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((ret) != 0))))
 45149  	return TCL_OK
 45150  }
 45151  
 45152  // Usage: sqlite3_extended_result_codes   DB    BOOLEAN
 45153  //
 45154  func test_extended_result_codes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1564:26: */
 45155  	bp := tls.Alloc(12)
 45156  	defer tls.Free(12)
 45157  
 45158  	// var enable int32 at bp+8, 4
 45159  
 45160  	// var db uintptr at bp, 8
 45161  
 45162  	if objc != 3 {
 45163  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16045 /* "DB BOOLEAN" */)
 45164  		return TCL_ERROR
 45165  	}
 45166  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 45167  		return TCL_ERROR
 45168  	}
 45169  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &enable */) != 0 {
 45170  		return TCL_ERROR
 45171  	}
 45172  	sqlite3.Xsqlite3_extended_result_codes(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 8 /* enable */)))
 45173  	return TCL_OK
 45174  }
 45175  
 45176  // Usage: sqlite3_libversion_number
 45177  //
 45178  func test_libversion_number(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1587:26: */
 45179  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_libversion_number(tls)))
 45180  	return TCL_OK
 45181  }
 45182  
 45183  // Usage: sqlite3_table_column_metadata DB dbname tblname colname
 45184  //
 45185  func test_table_column_metadata(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1601:26: */
 45186  	bp := tls.Alloc(52)
 45187  	defer tls.Free(52)
 45188  
 45189  	// var db uintptr at bp+16, 8
 45190  
 45191  	var zDb uintptr
 45192  	var zTbl uintptr
 45193  	var zCol uintptr
 45194  	var rc int32
 45195  	var pRet uintptr
 45196  	// var zDatatype uintptr at bp+24, 8
 45197  
 45198  	// var zCollseq uintptr at bp+32, 8
 45199  
 45200  	// var notnull int32 at bp+40, 4
 45201  
 45202  	// var primarykey int32 at bp+44, 4
 45203  
 45204  	// var autoincrement int32 at bp+48, 4
 45205  
 45206  	if (objc != 5) && (objc != 4) {
 45207  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16056 /* "DB dbname tblnam..." */)
 45208  		return TCL_ERROR
 45209  	}
 45210  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 45211  		return TCL_ERROR
 45212  	}
 45213  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 45214  	zTbl = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 45215  	if objc == 5 {
 45216  		zCol = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 45217  	} else {
 45218  		zCol = uintptr(0)
 45219  	}
 45220  
 45221  	if libc.Xstrlen(tls, zDb) == uint64(0) {
 45222  		zDb = uintptr(0)
 45223  	}
 45224  
 45225  	rc = sqlite3.Xsqlite3_table_column_metadata(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDb, zTbl, zCol,
 45226  		bp+24 /* &zDatatype */, bp+32 /* &zCollseq */, bp+40 /* &notnull */, bp+44 /* &primarykey */, bp+48 /* &autoincrement */)
 45227  
 45228  	if rc != SQLITE_OK {
 45229  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))), 0))
 45230  		return TCL_ERROR
 45231  	}
 45232  
 45233  	pRet = tcl.XTcl_NewObj(tls)
 45234  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zDatatype */)), -1))
 45235  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zCollseq */)), -1))
 45236  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 40 /* notnull */))))
 45237  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 44 /* primarykey */))))
 45238  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 48 /* autoincrement */))))
 45239  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 45240  
 45241  	return TCL_OK
 45242  }
 45243  
 45244  func blobHandleFromObj(tls *libc.TLS, interp uintptr, pObj uintptr, ppBlob uintptr) int32 { /* test1.c:1652:26: */
 45245  	bp := tls.Alloc(8)
 45246  	defer tls.Free(8)
 45247  
 45248  	var z uintptr
 45249  	// var n int32 at bp, 4
 45250  
 45251  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 45252  	if *(*int32)(unsafe.Pointer(bp /* n */)) == 0 {
 45253  		*(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0)
 45254  	} else {
 45255  		// var notUsed int32 at bp+4, 4
 45256  
 45257  		var channel Tcl_Channel
 45258  		var instanceData ClientData
 45259  
 45260  		channel = tcl.XTcl_GetChannel(tls, interp, z, bp+4 /* &notUsed */)
 45261  		if !(channel != 0) {
 45262  			return TCL_ERROR
 45263  		}
 45264  
 45265  		tcl.XTcl_Flush(tls, channel)
 45266  		tcl.XTcl_Seek(tls, channel, int64(0), SEEK_SET)
 45267  
 45268  		instanceData = tcl.XTcl_GetChannelInstanceData(tls, channel)
 45269  		*(*uintptr)(unsafe.Pointer(ppBlob)) = *(*uintptr)(unsafe.Pointer(instanceData))
 45270  	}
 45271  
 45272  	return TCL_OK
 45273  }
 45274  
 45275  func test_blob_reopen(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1681:26: */
 45276  	bp := tls.Alloc(16)
 45277  	defer tls.Free(16)
 45278  
 45279  	// var iRowid Tcl_WideInt at bp+8, 8
 45280  
 45281  	// var pBlob uintptr at bp, 8
 45282  
 45283  	var rc int32
 45284  
 45285  	if objc != 3 {
 45286  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16082 /* "CHANNEL ROWID" */)
 45287  		return TCL_ERROR
 45288  	}
 45289  
 45290  	if blobHandleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &pBlob */) != 0 {
 45291  		return TCL_ERROR
 45292  	}
 45293  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &iRowid */) != 0 {
 45294  		return TCL_ERROR
 45295  	}
 45296  
 45297  	rc = sqlite3.Xsqlite3_blob_reopen(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iRowid */)))
 45298  	if rc != SQLITE_OK {
 45299  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 45300  	}
 45301  
 45302  	return func() int32 {
 45303  		if rc == SQLITE_OK {
 45304  			return TCL_OK
 45305  		}
 45306  		return TCL_ERROR
 45307  	}()
 45308  }
 45309  
 45310  // Usage: sqlite3_create_collation_v2 DB-HANDLE NAME CMP-PROC DEL-PROC
 45311  //
 45312  //   This Tcl proc is used for testing the experimental
 45313  //   sqlite3_create_collation_v2() interface.
 45314  type TestCollationX1 = struct {
 45315  	Finterp uintptr
 45316  	FpCmp   uintptr
 45317  	FpDel   uintptr
 45318  } /* test1.c:1715:1 */
 45319  
 45320  type TestCollationX = TestCollationX1 /* test1.c:1720:31 */
 45321  
 45322  func testCreateCollationDel(tls *libc.TLS, pCtx uintptr) { /* test1.c:1721:13: */
 45323  	var p uintptr = pCtx
 45324  
 45325  	var rc int32 = tcl.XTcl_EvalObjEx(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, (*TestCollationX)(unsafe.Pointer(p)).FpDel, (TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL))
 45326  	if rc != TCL_OK {
 45327  		tcl.XTcl_BackgroundError(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp)
 45328  	}
 45329  
 45330  	for ok := true; ok; ok = 0 != 0 {
 45331  		var _objPtr uintptr = (*TestCollationX)(unsafe.Pointer(p)).FpCmp
 45332  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45333  			tcl.XTclFreeObj(tls, _objPtr)
 45334  		}
 45335  	}
 45336  	for ok1 := true; ok1; ok1 = 0 != 0 {
 45337  		var _objPtr uintptr = (*TestCollationX)(unsafe.Pointer(p)).FpDel
 45338  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45339  			tcl.XTclFreeObj(tls, _objPtr)
 45340  		}
 45341  	}
 45342  	sqlite3.Xsqlite3_free(tls, p)
 45343  }
 45344  
 45345  func testCreateCollationCmp(tls *libc.TLS, pCtx uintptr, nLeft int32, zLeft uintptr, nRight int32, zRight uintptr) int32 { /* test1.c:1733:12: */
 45346  	bp := tls.Alloc(4)
 45347  	defer tls.Free(4)
 45348  
 45349  	var p uintptr = pCtx
 45350  	var pScript uintptr = tcl.XTcl_DuplicateObj(tls, (*TestCollationX)(unsafe.Pointer(p)).FpCmp)
 45351  	*(*int32)(unsafe.Pointer(bp /* iRes */)) = 0
 45352  
 45353  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 45354  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zLeft, nLeft))
 45355  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zRight, nRight))
 45356  
 45357  	if (TCL_OK != tcl.XTcl_EvalObjEx(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, pScript, (TCL_EVAL_DIRECT|TCL_EVAL_GLOBAL))) ||
 45358  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp), bp /* &iRes */)) {
 45359  		tcl.XTcl_BackgroundError(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp)
 45360  	}
 45361  	for ok := true; ok; ok = 0 != 0 {
 45362  		var _objPtr uintptr = pScript
 45363  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45364  			tcl.XTclFreeObj(tls, _objPtr)
 45365  		}
 45366  	}
 45367  
 45368  	return *(*int32)(unsafe.Pointer(bp /* iRes */))
 45369  }
 45370  
 45371  func test_create_collation_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1757:26: */
 45372  	bp := tls.Alloc(24)
 45373  	defer tls.Free(24)
 45374  
 45375  	var p uintptr
 45376  	// var db uintptr at bp+16, 8
 45377  
 45378  	var rc int32
 45379  
 45380  	if objc != 5 {
 45381  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16096 /* "DB-HANDLE NAME C..." */)
 45382  		return TCL_ERROR
 45383  	}
 45384  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 45385  		return TCL_ERROR
 45386  	}
 45387  
 45388  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(TestCollationX{})))
 45389  	(*TestCollationX)(unsafe.Pointer(p)).FpCmp = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 45390  	(*TestCollationX)(unsafe.Pointer(p)).FpDel = *(*uintptr)(unsafe.Pointer(objv + 4*8))
 45391  	(*TestCollationX)(unsafe.Pointer(p)).Finterp = interp
 45392  	(*Tcl_Obj)(unsafe.Pointer((*TestCollationX)(unsafe.Pointer(p)).FpCmp)).FrefCount++
 45393  	(*Tcl_Obj)(unsafe.Pointer((*TestCollationX)(unsafe.Pointer(p)).FpDel)).FrefCount++
 45394  
 45395  	rc = sqlite3.Xsqlite3_create_collation_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 16,
 45396  		p, *(*uintptr)(unsafe.Pointer(&struct {
 45397  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 45398  		}{testCreateCollationCmp})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testCreateCollationDel})))
 45399  	if rc != SQLITE_MISUSE {
 45400  		tcl.XTcl_AppendResult(tls, interp,
 45401  			libc.VaList(bp, ts+16129 /* "sqlite3_create_c..." */, uintptr(0)))
 45402  		return TCL_ERROR
 45403  	}
 45404  	rc = sqlite3.Xsqlite3_create_collation_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), SQLITE_UTF8,
 45405  		p, *(*uintptr)(unsafe.Pointer(&struct {
 45406  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 45407  		}{testCreateCollationCmp})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testCreateCollationDel})))
 45408  	return TCL_OK
 45409  }
 45410  
 45411  // USAGE: sqlite3_create_function_v2 DB NAME NARG ENC ?SWITCHES?
 45412  //
 45413  // Available switches are:
 45414  //
 45415  //   -func    SCRIPT
 45416  //   -step    SCRIPT
 45417  //   -final   SCRIPT
 45418  //   -destroy SCRIPT
 45419  type CreateFunctionV21 = struct {
 45420  	Finterp   uintptr
 45421  	FpFunc    uintptr
 45422  	FpStep    uintptr
 45423  	FpFinal   uintptr
 45424  	FpDestroy uintptr
 45425  } /* test1.c:1804:9 */
 45426  
 45427  // USAGE: sqlite3_create_function_v2 DB NAME NARG ENC ?SWITCHES?
 45428  //
 45429  // Available switches are:
 45430  //
 45431  //   -func    SCRIPT
 45432  //   -step    SCRIPT
 45433  //   -final   SCRIPT
 45434  //   -destroy SCRIPT
 45435  type CreateFunctionV2 = CreateFunctionV21 /* test1.c:1804:33 */
 45436  
 45437  func cf2Func(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* test1.c:1812:13: */
 45438  }
 45439  
 45440  func cf2Step(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* test1.c:1814:13: */
 45441  }
 45442  
 45443  func cf2Final(tls *libc.TLS, ctx uintptr) { /* test1.c:1816:13: */
 45444  }
 45445  
 45446  func cf2Destroy(tls *libc.TLS, pUser uintptr) { /* test1.c:1818:13: */
 45447  	var p uintptr = pUser
 45448  
 45449  	if ((*CreateFunctionV2)(unsafe.Pointer(p)).Finterp != 0) && ((*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0) {
 45450  		var rc int32 = tcl.XTcl_EvalObjEx(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).Finterp, (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy, 0)
 45451  		if rc != TCL_OK {
 45452  			tcl.XTcl_BackgroundError(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).Finterp)
 45453  		}
 45454  	}
 45455  
 45456  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 45457  		for ok := true; ok; ok = 0 != 0 {
 45458  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc
 45459  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45460  				tcl.XTclFreeObj(tls, _objPtr)
 45461  			}
 45462  		}
 45463  	}
 45464  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 45465  		for ok1 := true; ok1; ok1 = 0 != 0 {
 45466  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep
 45467  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45468  				tcl.XTclFreeObj(tls, _objPtr)
 45469  			}
 45470  		}
 45471  	}
 45472  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 45473  		for ok2 := true; ok2; ok2 = 0 != 0 {
 45474  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal
 45475  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45476  				tcl.XTclFreeObj(tls, _objPtr)
 45477  			}
 45478  		}
 45479  	}
 45480  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 45481  		for ok3 := true; ok3; ok3 = 0 != 0 {
 45482  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy
 45483  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 45484  				tcl.XTclFreeObj(tls, _objPtr)
 45485  			}
 45486  		}
 45487  	}
 45488  	sqlite3.Xsqlite3_free(tls, p)
 45489  }
 45490  
 45491  func test_create_function_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1832:26: */
 45492  	bp := tls.Alloc(180)
 45493  	defer tls.Free(180)
 45494  
 45495  	// var db uintptr at bp+16, 8
 45496  
 45497  	var zFunc uintptr
 45498  	// var nArg int32 at bp+24, 4
 45499  
 45500  	// var enc int32 at bp+128, 4
 45501  
 45502  	var p uintptr
 45503  	var i int32
 45504  	var rc int32
 45505  
 45506  	*(*[6]EncTable)(unsafe.Pointer(bp + 32 /* aEnc */)) = [6]EncTable{
 45507  		{FzEnc: ts + 16194 /* "utf8" */, Fenc: SQLITE_UTF8},
 45508  		{FzEnc: ts + 16199 /* "utf16" */, Fenc: SQLITE_UTF16},
 45509  		{FzEnc: ts + 16205 /* "utf16le" */, Fenc: SQLITE_UTF16LE},
 45510  		{FzEnc: ts + 16213 /* "utf16be" */, Fenc: SQLITE_UTF16BE},
 45511  		{FzEnc: ts + 13244 /* "any" */, Fenc: SQLITE_ANY},
 45512  		{FzEnc: ts + 14654 /* "0" */},
 45513  	}
 45514  
 45515  	if (objc < 5) || ((objc % 2) == 0) {
 45516  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16221 /* "DB NAME NARG ENC..." */)
 45517  		return TCL_ERROR
 45518  	}
 45519  
 45520  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 45521  		return TCL_ERROR
 45522  	}
 45523  	zFunc = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 45524  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+24 /* &nArg */) != 0 {
 45525  		return TCL_ERROR
 45526  	}
 45527  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+32 /* &aEnc[0] */, int32(unsafe.Sizeof(EncTable{})),
 45528  		ts+16250 /* "encoding" */, 0, bp+128 /* &enc */) != 0 {
 45529  		return TCL_ERROR
 45530  	}
 45531  	*(*int32)(unsafe.Pointer(bp + 128 /* enc */)) = (*EncTable)(unsafe.Pointer(bp + 32 /* &aEnc */ + uintptr(*(*int32)(unsafe.Pointer(bp + 128 /* enc */)))*16)).Fenc
 45532  
 45533  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(CreateFunctionV2{})))
 45534  
 45535  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(CreateFunctionV2{})))
 45536  	(*CreateFunctionV2)(unsafe.Pointer(p)).Finterp = interp
 45537  
 45538  	for i = 5; i < objc; i = i + (2) {
 45539  		// var iSwitch int32 at bp+176, 4
 45540  
 45541  		*(*[5]uintptr)(unsafe.Pointer(bp + 136 /* azSwitch */)) = [5]uintptr{ts + 16259 /* "-func" */, ts + 16265 /* "-step" */, ts + 16271 /* "-final" */, ts + 16278 /* "-destroy" */, uintptr(0)}
 45542  		if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+136 /* &azSwitch[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+16287 /* "switch" */, 0, bp+176 /* &iSwitch */) != 0 {
 45543  			sqlite3.Xsqlite3_free(tls, p)
 45544  			return TCL_ERROR
 45545  		}
 45546  
 45547  		switch *(*int32)(unsafe.Pointer(bp + 176 /* iSwitch */)) {
 45548  		case 0:
 45549  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8))
 45550  			break
 45551  		case 1:
 45552  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpStep = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8))
 45553  			break
 45554  		case 2:
 45555  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8))
 45556  			break
 45557  		case 3:
 45558  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8))
 45559  			break
 45560  		}
 45561  	}
 45562  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 45563  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc)
 45564  	}
 45565  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 45566  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpStep = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep)
 45567  	}
 45568  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 45569  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal)
 45570  	}
 45571  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 45572  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy)
 45573  	}
 45574  
 45575  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 45576  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc)).FrefCount++
 45577  	}
 45578  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 45579  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpStep)).FrefCount++
 45580  	}
 45581  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 45582  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal)).FrefCount++
 45583  	}
 45584  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 45585  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy)).FrefCount++
 45586  	}
 45587  
 45588  	rc = sqlite3.Xsqlite3_create_function_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zFunc, *(*int32)(unsafe.Pointer(bp + 24 /* nArg */)), *(*int32)(unsafe.Pointer(bp + 128 /* enc */)), p,
 45589  		func() uintptr {
 45590  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 45591  				return *(*uintptr)(unsafe.Pointer(&struct {
 45592  					f func(*libc.TLS, uintptr, int32, uintptr)
 45593  				}{cf2Func}))
 45594  			}
 45595  			return uintptr(0)
 45596  		}(),
 45597  		func() uintptr {
 45598  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 45599  				return *(*uintptr)(unsafe.Pointer(&struct {
 45600  					f func(*libc.TLS, uintptr, int32, uintptr)
 45601  				}{cf2Step}))
 45602  			}
 45603  			return uintptr(0)
 45604  		}(),
 45605  		func() uintptr {
 45606  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 45607  				return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cf2Final}))
 45608  			}
 45609  			return uintptr(0)
 45610  		}(),
 45611  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cf2Destroy})))
 45612  	if rc != SQLITE_OK {
 45613  		tcl.XTcl_ResetResult(tls, interp)
 45614  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 45615  		return TCL_ERROR
 45616  	}
 45617  	return TCL_OK
 45618  }
 45619  
 45620  type EncTable = struct {
 45621  	FzEnc uintptr
 45622  	Fenc  int32
 45623  	_     [4]byte
 45624  } /* test1.c:1846:3 */
 45625  
 45626  // Usage: sqlite3_load_extension DB-HANDLE FILE ?PROC?
 45627  func test_load_extension(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1920:26: */
 45628  	bp := tls.Alloc(88)
 45629  	defer tls.Free(88)
 45630  
 45631  	// var cmdInfo Tcl_CmdInfo at bp+24, 64
 45632  
 45633  	var db uintptr
 45634  	_ = db
 45635  	var rc int32
 45636  	var zDb uintptr
 45637  	var zFile uintptr
 45638  	_ = zFile
 45639  	var zProc uintptr = uintptr(0)
 45640  	_ = zProc
 45641  	var zErr uintptr = uintptr(0)
 45642  
 45643  	if (objc != 4) && (objc != 3) {
 45644  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16294 /* "DB-HANDLE FILE ?..." */)
 45645  		return TCL_ERROR
 45646  	}
 45647  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 45648  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 45649  	if objc == 4 {
 45650  		zProc = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 45651  	}
 45652  
 45653  	// Extract the C database handle from the Tcl command name
 45654  	if !(tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+24 /* &cmdInfo */) != 0) {
 45655  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320 /* "command not foun..." */, zDb, uintptr(0)))
 45656  		return TCL_ERROR
 45657  	}
 45658  	db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &cmdInfo */)).FobjClientData)).Fdb
 45659  
 45660  	// Call the underlying C function. If an error occurs, set rc to
 45661  	// TCL_ERROR and load any error string into the interpreter. If no
 45662  	// error occurs, set rc to TCL_OK.
 45663  	rc = SQLITE_ERROR
 45664  	zErr = sqlite3.Xsqlite3_mprintf(tls, ts+16316 /* "this build omits..." */, 0)
 45665  	_ = zProc
 45666  	_ = zFile
 45667  	if rc != SQLITE_OK {
 45668  		tcl.XTcl_SetResult(tls, interp, func() uintptr {
 45669  			if zErr != 0 {
 45670  				return zErr
 45671  			}
 45672  			return ts + 489 /* "" */
 45673  		}(), uintptr(1))
 45674  		rc = TCL_ERROR
 45675  	} else {
 45676  		rc = TCL_OK
 45677  	}
 45678  	sqlite3.Xsqlite3_free(tls, zErr)
 45679  
 45680  	return rc
 45681  }
 45682  
 45683  // Usage: sqlite3_enable_load_extension DB-HANDLE ONOFF
 45684  func test_enable_load(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1978:26: */
 45685  	bp := tls.Alloc(100)
 45686  	defer tls.Free(100)
 45687  
 45688  	// var cmdInfo Tcl_CmdInfo at bp+32, 64
 45689  
 45690  	var db uintptr
 45691  	_ = db
 45692  	var zDb uintptr
 45693  	// var onoff int32 at bp+96, 4
 45694  
 45695  	if objc != 3 {
 45696  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16358 /* "DB-HANDLE ONOFF" */)
 45697  		return TCL_ERROR
 45698  	}
 45699  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 45700  
 45701  	// Extract the C database handle from the Tcl command name
 45702  	if !(tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+32 /* &cmdInfo */) != 0) {
 45703  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320 /* "command not foun..." */, zDb, uintptr(0)))
 45704  		return TCL_ERROR
 45705  	}
 45706  	db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 32 /* &cmdInfo */)).FobjClientData)).Fdb
 45707  
 45708  	// Get the onoff parameter
 45709  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+96 /* &onoff */) != 0 {
 45710  		return TCL_ERROR
 45711  	}
 45712  
 45713  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+16316 /* "this build omits..." */))
 45714  	return TCL_ERROR
 45715  }
 45716  
 45717  // Usage:  sqlite_abort
 45718  //
 45719  // Shutdown the process immediately.  This is not a clean shutdown.
 45720  // This command is used to test the recoverability of a database in
 45721  // the event of a program crash.
 45722  func sqlite_abort(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2024:26: */
 45723  	libc.Xexit(tls, 255)
 45724  	// This will always fail
 45725  	return TCL_OK
 45726  }
 45727  
 45728  // The following routine is a user-defined SQL function whose purpose
 45729  // is to test the sqlite_set_result() API.
 45730  func testFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:2045:13: */
 45731  	var zArg0 uintptr
 45732  __1:
 45733  	if !(argc >= 2) {
 45734  		goto __2
 45735  	}
 45736  	zArg0 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 45737  	if !(zArg0 != 0) {
 45738  		goto __3
 45739  	}
 45740  	if !(0 == sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+2438 /* "int" */)) {
 45741  		goto __5
 45742  	}
 45743  	sqlite3.Xsqlite3_result_int(tls, context, sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 45744  	goto __6
 45745  __5:
 45746  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+3834 /* "int64" */) == 0) {
 45747  		goto __7
 45748  	}
 45749  	sqlite3.Xsqlite3_result_int64(tls, context, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 45750  	goto __8
 45751  __7:
 45752  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+16374 /* "string" */) == 0) {
 45753  		goto __9
 45754  	}
 45755  	sqlite3.Xsqlite3_result_text(tls, context, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))), -1,
 45756  		libc.UintptrFromInt32(-1))
 45757  	goto __10
 45758  __9:
 45759  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+2423 /* "double" */) == 0) {
 45760  		goto __11
 45761  	}
 45762  	sqlite3.Xsqlite3_result_double(tls, context, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 45763  	goto __12
 45764  __11:
 45765  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+7385 /* "null" */) == 0) {
 45766  		goto __13
 45767  	}
 45768  	sqlite3.Xsqlite3_result_null(tls, context)
 45769  	goto __14
 45770  __13:
 45771  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+16381 /* "value" */) == 0) {
 45772  		goto __15
 45773  	}
 45774  	sqlite3.Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))*8)))
 45775  	goto __16
 45776  __15:
 45777  	goto error_out
 45778  __16:
 45779  	;
 45780  __14:
 45781  	;
 45782  __12:
 45783  	;
 45784  __10:
 45785  	;
 45786  __8:
 45787  	;
 45788  __6:
 45789  	;
 45790  	goto __4
 45791  __3:
 45792  	goto error_out
 45793  __4:
 45794  	;
 45795  	argc = argc - (2)
 45796  	argv += 8 * (uintptr(2))
 45797  	goto __1
 45798  __2:
 45799  	;
 45800  	return
 45801  
 45802  error_out:
 45803  	sqlite3.Xsqlite3_result_error(tls, context,
 45804  		ts+16387 /* "first argument s..." */, -1)
 45805  }
 45806  
 45807  // Usage:   sqlite_register_test_function  DB  NAME
 45808  //
 45809  // Register the test SQL function on the database DB under the name NAME.
 45810  func test_register_func(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2083:26: */
 45811  	bp := tls.Alloc(56)
 45812  	defer tls.Free(56)
 45813  
 45814  	// var db uintptr at bp+48, 8
 45815  
 45816  	var rc int32
 45817  	if argc != 3 {
 45818  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45819  			ts+16455 /* " DB FUNCTION-NAM..." */, 0))
 45820  		return TCL_ERROR
 45821  	}
 45822  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+48 /* &db */) != 0 {
 45823  		return TCL_ERROR
 45824  	}
 45825  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), -1, SQLITE_UTF8, uintptr(0),
 45826  		*(*uintptr)(unsafe.Pointer(&struct {
 45827  			f func(*libc.TLS, uintptr, int32, uintptr)
 45828  		}{testFunc})), uintptr(0), uintptr(0))
 45829  	if rc != 0 {
 45830  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 45831  		return TCL_ERROR
 45832  	}
 45833  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 45834  		return TCL_ERROR
 45835  	}
 45836  	return TCL_OK
 45837  }
 45838  
 45839  // Usage:  sqlite3_finalize  STMT
 45840  //
 45841  // Finalize a statement handle.
 45842  func test_finalize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2112:26: */
 45843  	bp := tls.Alloc(40)
 45844  	defer tls.Free(40)
 45845  
 45846  	// var pStmt uintptr at bp+32, 8
 45847  
 45848  	var rc int32
 45849  	var db uintptr = uintptr(0)
 45850  
 45851  	if objc != 2 {
 45852  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 45853  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 45854  		return TCL_ERROR
 45855  	}
 45856  
 45857  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 45858  		return TCL_ERROR
 45859  	}
 45860  
 45861  	if *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) != 0 {
 45862  		db = sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 45863  	}
 45864  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 45865  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 45866  	if (db != 0) && (sqlite3TestErrCode(tls, interp, db, rc) != 0) {
 45867  		return TCL_ERROR
 45868  	}
 45869  	return TCL_OK
 45870  }
 45871  
 45872  // Usage:  sqlite3_stmt_status  STMT  CODE  RESETFLAG
 45873  //
 45874  // Get the value of a status counter from a statement.
 45875  func test_stmt_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2144:26: */
 45876  	bp := tls.Alloc(16)
 45877  	defer tls.Free(16)
 45878  
 45879  	var iValue int32
 45880  	var i int32
 45881  	*(*int32)(unsafe.Pointer(bp + 8 /* op */)) = 0
 45882  	// var resetFlag int32 at bp+12, 4
 45883  
 45884  	var zOpName uintptr
 45885  	// var pStmt uintptr at bp, 8
 45886  
 45887  	if objc != 4 {
 45888  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16481 /* "STMT PARAMETER R..." */)
 45889  		return TCL_ERROR
 45890  	}
 45891  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 45892  		return TCL_ERROR
 45893  	}
 45894  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 45895  	for i = 0; i < (int32(uint64(unsafe.Sizeof(aOp)) / uint64(unsafe.Sizeof(struct {
 45896  		FzName uintptr
 45897  		Fop    int32
 45898  		_      [4]byte
 45899  	}{})))); i++ {
 45900  		if libc.Xstrcmp(tls, aOp[i].FzName, zOpName) == 0 {
 45901  			*(*int32)(unsafe.Pointer(bp + 8 /* op */)) = aOp[i].Fop
 45902  			break
 45903  		}
 45904  	}
 45905  	if i >= (int32(uint64(unsafe.Sizeof(aOp)) / uint64(unsafe.Sizeof(struct {
 45906  		FzName uintptr
 45907  		Fop    int32
 45908  		_      [4]byte
 45909  	}{})))) {
 45910  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &op */) != 0 {
 45911  			return TCL_ERROR
 45912  		}
 45913  	}
 45914  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+12 /* &resetFlag */) != 0 {
 45915  		return TCL_ERROR
 45916  	}
 45917  	iValue = sqlite3.Xsqlite3_stmt_status(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 8 /* op */)), *(*int32)(unsafe.Pointer(bp + 12 /* resetFlag */)))
 45918  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iValue))
 45919  	return TCL_OK
 45920  }
 45921  
 45922  var aOp = [7]struct {
 45923  	FzName uintptr
 45924  	Fop    int32
 45925  	_      [4]byte
 45926  }{
 45927  	{FzName: ts + 16506 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_FULLSCAN_STEP},
 45928  	{FzName: ts + 16538 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_SORT},
 45929  	{FzName: ts + 16561 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_AUTOINDEX},
 45930  	{FzName: ts + 16589 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_VM_STEP},
 45931  	{FzName: ts + 16615 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_REPREPARE},
 45932  	{FzName: ts + 16643 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_RUN},
 45933  	{FzName: ts + 16665 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_MEMUSED},
 45934  } /* test1.c:2158:5 */
 45935  
 45936  // Usage:  sqlite3_config_sorterref
 45937  //
 45938  // Set the SQLITE_CONFIG_SORTERREF_SIZE configuration option
 45939  func test_config_sorterref(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2285:26: */
 45940  	bp := tls.Alloc(12)
 45941  	defer tls.Free(12)
 45942  
 45943  	// var iVal int32 at bp+8, 4
 45944  
 45945  	if objc != 2 {
 45946  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16691 /* "NBYTE" */)
 45947  		return TCL_ERROR
 45948  	}
 45949  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &iVal */) != 0 {
 45950  		return TCL_ERROR
 45951  	}
 45952  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_SORTERREF_SIZE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* iVal */))))
 45953  	return TCL_OK
 45954  }
 45955  
 45956  // Usage: vfs_current_time_int64
 45957  //
 45958  // Return the value returned by the default VFS's xCurrentTimeInt64 method.
 45959  func vfsCurrentTimeInt64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2306:26: */
 45960  	bp := tls.Alloc(8)
 45961  	defer tls.Free(8)
 45962  
 45963  	// var t i64 at bp, 8
 45964  
 45965  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 45966  	if objc != 1 {
 45967  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 45968  		return TCL_ERROR
 45969  	}
 45970  	(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, pVfs, bp /* &t */)
 45971  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*i64)(unsafe.Pointer(bp /* t */))))
 45972  	return TCL_OK
 45973  }
 45974  
 45975  // Usage: sqlite3_snapshot_get DB DBNAME
 45976  func test_snapshot_get(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2327:26: */
 45977  	bp := tls.Alloc(116)
 45978  	defer tls.Free(116)
 45979  
 45980  	var rc int32
 45981  	// var db uintptr at bp, 8
 45982  
 45983  	var zName uintptr
 45984  	*(*uintptr)(unsafe.Pointer(bp + 8 /* pSnapshot */)) = uintptr(0)
 45985  
 45986  	if objc != 3 {
 45987  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 45988  		return TCL_ERROR
 45989  	}
 45990  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 45991  		return TCL_ERROR
 45992  	}
 45993  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 45994  
 45995  	rc = sqlite3.Xsqlite3_snapshot_get(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, bp+8 /* &pSnapshot */)
 45996  	if rc != SQLITE_OK {
 45997  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 45998  		return TCL_ERROR
 45999  	} else {
 46000  		// var zBuf [100]int8 at bp+16, 100
 46001  
 46002  		if sqlite3TestMakePointerStr(tls, interp, bp+16 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSnapshot */))) != 0 {
 46003  			return TCL_ERROR
 46004  		}
 46005  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+16 /* &zBuf[0] */, -1))
 46006  	}
 46007  	return TCL_OK
 46008  }
 46009  
 46010  // Usage: sqlite3_snapshot_recover DB DBNAME
 46011  func test_snapshot_recover(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2362:26: */
 46012  	bp := tls.Alloc(8)
 46013  	defer tls.Free(8)
 46014  
 46015  	var rc int32
 46016  	// var db uintptr at bp, 8
 46017  
 46018  	var zName uintptr
 46019  
 46020  	if objc != 3 {
 46021  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 46022  		return TCL_ERROR
 46023  	}
 46024  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 46025  		return TCL_ERROR
 46026  	}
 46027  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 46028  
 46029  	rc = sqlite3.Xsqlite3_snapshot_recover(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName)
 46030  	if rc != SQLITE_OK {
 46031  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 46032  		return TCL_ERROR
 46033  	} else {
 46034  		tcl.XTcl_ResetResult(tls, interp)
 46035  	}
 46036  	return TCL_OK
 46037  }
 46038  
 46039  // Usage: sqlite3_snapshot_open DB DBNAME SNAPSHOT
 46040  func test_snapshot_open(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2394:26: */
 46041  	bp := tls.Alloc(8)
 46042  	defer tls.Free(8)
 46043  
 46044  	var rc int32
 46045  	// var db uintptr at bp, 8
 46046  
 46047  	var zName uintptr
 46048  	var pSnapshot uintptr
 46049  
 46050  	if objc != 4 {
 46051  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16707 /* "DB DBNAME SNAPSH..." */)
 46052  		return TCL_ERROR
 46053  	}
 46054  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 46055  		return TCL_ERROR
 46056  	}
 46057  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 46058  	pSnapshot = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8))))
 46059  
 46060  	rc = sqlite3.Xsqlite3_snapshot_open(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, pSnapshot)
 46061  	if rc != SQLITE_OK {
 46062  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 46063  		return TCL_ERROR
 46064  	} else {
 46065  		tcl.XTcl_ResetResult(tls, interp)
 46066  	}
 46067  	return TCL_OK
 46068  }
 46069  
 46070  // Usage: sqlite3_snapshot_free SNAPSHOT
 46071  func test_snapshot_free(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2428:26: */
 46072  	var pSnapshot uintptr
 46073  	if objc != 2 {
 46074  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16726 /* "SNAPSHOT" */)
 46075  		return TCL_ERROR
 46076  	}
 46077  	pSnapshot = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 46078  	sqlite3.Xsqlite3_snapshot_free(tls, pSnapshot)
 46079  	return TCL_OK
 46080  }
 46081  
 46082  // Usage: sqlite3_snapshot_cmp SNAPSHOT1 SNAPSHOT2
 46083  func test_snapshot_cmp(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2449:26: */
 46084  	var res int32
 46085  	var p1 uintptr
 46086  	var p2 uintptr
 46087  	if objc != 3 {
 46088  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16735 /* "SNAPSHOT1 SNAPSH..." */)
 46089  		return TCL_ERROR
 46090  	}
 46091  	p1 = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 46092  	p2 = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))))
 46093  	res = sqlite3.Xsqlite3_snapshot_cmp(tls, p1, p2)
 46094  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 46095  	return TCL_OK
 46096  }
 46097  
 46098  // Usage: sqlite3_snapshot_get_blob DB DBNAME
 46099  func test_snapshot_get_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2474:26: */
 46100  	bp := tls.Alloc(16)
 46101  	defer tls.Free(16)
 46102  
 46103  	var rc int32
 46104  	// var db uintptr at bp, 8
 46105  
 46106  	var zName uintptr
 46107  	*(*uintptr)(unsafe.Pointer(bp + 8 /* pSnapshot */)) = uintptr(0)
 46108  
 46109  	if objc != 3 {
 46110  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 46111  		return TCL_ERROR
 46112  	}
 46113  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 46114  		return TCL_ERROR
 46115  	}
 46116  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 46117  
 46118  	rc = sqlite3.Xsqlite3_snapshot_get(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, bp+8 /* &pSnapshot */)
 46119  	if rc != SQLITE_OK {
 46120  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 46121  		return TCL_ERROR
 46122  	} else {
 46123  		tcl.XTcl_SetObjResult(tls, interp,
 46124  			tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSnapshot */)), int32(unsafe.Sizeof(sqlite3_snapshot{}))))
 46125  		sqlite3.Xsqlite3_snapshot_free(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pSnapshot */)))
 46126  	}
 46127  	return TCL_OK
 46128  }
 46129  
 46130  // Usage: sqlite3_snapshot_open_blob DB DBNAME SNAPSHOT
 46131  func test_snapshot_open_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2510:26: */
 46132  	bp := tls.Alloc(28)
 46133  	defer tls.Free(28)
 46134  
 46135  	var rc int32
 46136  	// var db uintptr at bp+16, 8
 46137  
 46138  	var zName uintptr
 46139  	var pBlob uintptr
 46140  	// var nBlob int32 at bp+24, 4
 46141  
 46142  	if objc != 4 {
 46143  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16707 /* "DB DBNAME SNAPSH..." */)
 46144  		return TCL_ERROR
 46145  	}
 46146  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 46147  		return TCL_ERROR
 46148  	}
 46149  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 46150  	pBlob = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+24 /* &nBlob */)
 46151  	if (uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nBlob */))) != uint64(unsafe.Sizeof(sqlite3_snapshot{}))) {
 46152  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+16755 /* "bad SNAPSHOT" */, 0))
 46153  		return TCL_ERROR
 46154  	}
 46155  	rc = sqlite3.Xsqlite3_snapshot_open(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zName, pBlob)
 46156  	if rc != SQLITE_OK {
 46157  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 46158  		return TCL_ERROR
 46159  	}
 46160  	return TCL_OK
 46161  }
 46162  
 46163  // Usage: sqlite3_snapshot_cmp_blob SNAPSHOT1 SNAPSHOT2
 46164  func test_snapshot_cmp_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2546:26: */
 46165  	bp := tls.Alloc(24)
 46166  	defer tls.Free(24)
 46167  
 46168  	var res int32
 46169  	var p1 uintptr
 46170  	var p2 uintptr
 46171  	// var n1 int32 at bp+16, 4
 46172  
 46173  	// var n2 int32 at bp+20, 4
 46174  
 46175  	if objc != 3 {
 46176  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16735 /* "SNAPSHOT1 SNAPSH..." */)
 46177  		return TCL_ERROR
 46178  	}
 46179  
 46180  	p1 = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &n1 */)
 46181  	p2 = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+20 /* &n2 */)
 46182  
 46183  	if (uint64(*(*int32)(unsafe.Pointer(bp + 16 /* n1 */))) != uint64(unsafe.Sizeof(sqlite3_snapshot{}))) || (*(*int32)(unsafe.Pointer(bp + 16 /* n1 */)) != *(*int32)(unsafe.Pointer(bp + 20 /* n2 */))) {
 46184  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+16755 /* "bad SNAPSHOT" */, 0))
 46185  		return TCL_ERROR
 46186  	}
 46187  
 46188  	res = sqlite3.Xsqlite3_snapshot_cmp(tls, p1, p2)
 46189  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 46190  	return TCL_OK
 46191  }
 46192  
 46193  // in test_delete.c
 46194  func test_delete_database(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2581:26: */
 46195  	var rc int32
 46196  	var zFile uintptr
 46197  	if objc != 2 {
 46198  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16768 /* "FILE" */)
 46199  		return TCL_ERROR
 46200  	}
 46201  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 46202  	rc = sqlite3_delete_database(tls, zFile)
 46203  
 46204  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 46205  	return TCL_OK
 46206  }
 46207  
 46208  // Usage: atomic_batch_write PATH
 46209  func test_atomic_batch_write(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2603:26: */
 46210  	bp := tls.Alloc(32)
 46211  	defer tls.Free(32)
 46212  
 46213  	var zFile uintptr = uintptr(0)                              // Path to file to test
 46214  	*(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0)  // Database handle
 46215  	*(*uintptr)(unsafe.Pointer(bp + 24 /* pFd */)) = uintptr(0) // SQLite fd open on zFile
 46216  	var bRes int32 = 0                                          // Integer result of this command
 46217  	var dc int32 = 0                                            // Device-characteristics mask
 46218  	var rc int32                                                // sqlite3_open() return code
 46219  
 46220  	if objc != 2 {
 46221  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16773 /* "PATH" */)
 46222  		return TCL_ERROR
 46223  	}
 46224  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 46225  
 46226  	rc = sqlite3.Xsqlite3_open(tls, zFile, bp+16 /* &db */)
 46227  	if rc != SQLITE_OK {
 46228  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))), 0))
 46229  		sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)))
 46230  		return TCL_ERROR
 46231  	}
 46232  
 46233  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp+24 /* &pFd */)
 46234  	dc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pFd */)))).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pFd */)))
 46235  	if (dc & SQLITE_IOCAP_BATCH_ATOMIC) != 0 {
 46236  		bRes = 1
 46237  	}
 46238  
 46239  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, bRes))
 46240  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)))
 46241  	return TCL_OK
 46242  }
 46243  
 46244  // Usage:  sqlite3_next_stmt  DB  STMT
 46245  //
 46246  // Return the next statment in sequence after STMT.
 46247  func test_next_stmt(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2645:26: */
 46248  	bp := tls.Alloc(114)
 46249  	defer tls.Free(114)
 46250  
 46251  	// var pStmt uintptr at bp+56, 8
 46252  
 46253  	*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)) = uintptr(0)
 46254  	// var zBuf [50]int8 at bp+64, 50
 46255  
 46256  	if objc != 3 {
 46257  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46258  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16778 /* " DB STMT" */, 0))
 46259  		return TCL_ERROR
 46260  	}
 46261  
 46262  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 46263  		return TCL_ERROR
 46264  	}
 46265  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+56 /* &pStmt */) != 0 {
 46266  		return TCL_ERROR
 46267  	}
 46268  	*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = sqlite3.Xsqlite3_next_stmt(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 46269  	if *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) != 0 {
 46270  		if sqlite3TestMakePointerStr(tls, interp, bp+64 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != 0 {
 46271  			return TCL_ERROR
 46272  		}
 46273  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+64 /* &zBuf[0] */, 0))
 46274  	}
 46275  	return TCL_OK
 46276  }
 46277  
 46278  // Usage:  sqlite3_stmt_readonly  STMT
 46279  //
 46280  // Return true if STMT is a NULL pointer or a pointer to a statement
 46281  // that is guaranteed to leave the database unmodified.
 46282  func test_stmt_readonly(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2677:26: */
 46283  	bp := tls.Alloc(40)
 46284  	defer tls.Free(40)
 46285  
 46286  	// var pStmt uintptr at bp+32, 8
 46287  
 46288  	var rc int32
 46289  
 46290  	if objc != 2 {
 46291  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46292  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 46293  		return TCL_ERROR
 46294  	}
 46295  
 46296  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46297  		return TCL_ERROR
 46298  	}
 46299  	rc = sqlite3.Xsqlite3_stmt_readonly(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 46300  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((rc) != 0))))
 46301  	return TCL_OK
 46302  }
 46303  
 46304  // Usage:  sqlite3_stmt_isexplain  STMT
 46305  //
 46306  // Return 1, 2, or 0 respectively if STMT is an EXPLAIN statement, an
 46307  // EXPLAIN QUERY PLAN statement or an ordinary statement or NULL pointer.
 46308  func test_stmt_isexplain(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2704:26: */
 46309  	bp := tls.Alloc(40)
 46310  	defer tls.Free(40)
 46311  
 46312  	// var pStmt uintptr at bp+32, 8
 46313  
 46314  	var rc int32
 46315  
 46316  	if objc != 2 {
 46317  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46318  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 46319  		return TCL_ERROR
 46320  	}
 46321  
 46322  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46323  		return TCL_ERROR
 46324  	}
 46325  	rc = sqlite3.Xsqlite3_stmt_isexplain(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 46326  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 46327  	return TCL_OK
 46328  }
 46329  
 46330  // Usage:  sqlite3_stmt_busy  STMT
 46331  //
 46332  // Return true if STMT is a non-NULL pointer to a statement
 46333  // that has been stepped but not to completion.
 46334  func test_stmt_busy(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2731:26: */
 46335  	bp := tls.Alloc(40)
 46336  	defer tls.Free(40)
 46337  
 46338  	// var pStmt uintptr at bp+32, 8
 46339  
 46340  	var rc int32
 46341  
 46342  	if objc != 2 {
 46343  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46344  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 46345  		return TCL_ERROR
 46346  	}
 46347  
 46348  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46349  		return TCL_ERROR
 46350  	}
 46351  	rc = sqlite3.Xsqlite3_stmt_busy(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 46352  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((rc) != 0))))
 46353  	return TCL_OK
 46354  }
 46355  
 46356  // Usage:  uses_stmt_journal  STMT
 46357  //
 46358  // Return true if STMT uses a statement journal.
 46359  func uses_stmt_journal(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2757:26: */
 46360  	bp := tls.Alloc(40)
 46361  	defer tls.Free(40)
 46362  
 46363  	// var pStmt uintptr at bp+32, 8
 46364  
 46365  	if objc != 2 {
 46366  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46367  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 46368  		return TCL_ERROR
 46369  	}
 46370  
 46371  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46372  		return TCL_ERROR
 46373  	}
 46374  	sqlite3.Xsqlite3_stmt_readonly(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 46375  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) + 200 /* &.usesStmtJournal */))&0x40>>6)) != 0))))
 46376  	return TCL_OK
 46377  }
 46378  
 46379  // Usage:  sqlite3_reset  STMT
 46380  //
 46381  // Reset a statement handle.
 46382  func test_reset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2783:26: */
 46383  	bp := tls.Alloc(40)
 46384  	defer tls.Free(40)
 46385  
 46386  	// var pStmt uintptr at bp+32, 8
 46387  
 46388  	var rc int32
 46389  
 46390  	if objc != 2 {
 46391  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46392  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 46393  		return TCL_ERROR
 46394  	}
 46395  
 46396  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46397  		return TCL_ERROR
 46398  	}
 46399  
 46400  	rc = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 46401  	if (*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) != 0) && (sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0) {
 46402  		return TCL_ERROR
 46403  	}
 46404  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 46405  	//
 46406  	//   if( rc ){
 46407  	//     return TCL_ERROR;
 46408  	//   }
 46409  	return TCL_OK
 46410  }
 46411  
 46412  // Usage:  sqlite3_expired STMT
 46413  //
 46414  // Return TRUE if a recompilation of the statement is recommended.
 46415  func test_expired(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2818:26: */
 46416  	bp := tls.Alloc(40)
 46417  	defer tls.Free(40)
 46418  
 46419  	// var pStmt uintptr at bp+32, 8
 46420  
 46421  	if objc != 2 {
 46422  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46423  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 46424  		return TCL_ERROR
 46425  	}
 46426  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 46427  		return TCL_ERROR
 46428  	}
 46429  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((sqlite3.Xsqlite3_expired(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))) != 0))))
 46430  	return TCL_OK
 46431  }
 46432  
 46433  // Usage:  sqlite3_transfer_bindings FROMSTMT TOSTMT
 46434  //
 46435  // Transfer all bindings from FROMSTMT over to TOSTMT
 46436  func test_transfer_bind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2842:26: */
 46437  	bp := tls.Alloc(48)
 46438  	defer tls.Free(48)
 46439  
 46440  	// var pStmt1 uintptr at bp+32, 8
 46441  
 46442  	// var pStmt2 uintptr at bp+40, 8
 46443  
 46444  	if objc != 3 {
 46445  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46446  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16793 /* " FROM-STMT TO-ST..." */, 0))
 46447  		return TCL_ERROR
 46448  	}
 46449  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt1 */) != 0 {
 46450  		return TCL_ERROR
 46451  	}
 46452  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+40 /* &pStmt2 */) != 0 {
 46453  		return TCL_ERROR
 46454  	}
 46455  	tcl.XTcl_SetObjResult(tls, interp,
 46456  		tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_transfer_bindings(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt1 */)), *(*uintptr)(unsafe.Pointer(bp + 40 /* pStmt2 */)))))
 46457  	return TCL_OK
 46458  }
 46459  
 46460  // Usage:  sqlite3_changes DB
 46461  //
 46462  // Return the number of changes made to the database by the last SQL
 46463  // execution.
 46464  func test_changes(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2869:26: */
 46465  	bp := tls.Alloc(40)
 46466  	defer tls.Free(40)
 46467  
 46468  	// var db uintptr at bp+32, 8
 46469  
 46470  	if objc != 2 {
 46471  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 46472  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 46473  		return TCL_ERROR
 46474  	}
 46475  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 46476  		return TCL_ERROR
 46477  	}
 46478  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_changes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))))
 46479  	return TCL_OK
 46480  }
 46481  
 46482  // This is the "static_bind_value" that variables are bound to when
 46483  // the FLAG option of sqlite3_bind is "static"
 46484  var sqlite_static_bind_value uintptr = uintptr(0) /* test1.c:2890:13 */
 46485  var sqlite_static_bind_nbyte int32 = 0            /* test1.c:2891:12 */
 46486  
 46487  // Usage:  sqlite3_bind  VM  IDX  VALUE  FLAGS
 46488  //
 46489  // Sets the value of the IDX-th occurrence of "?" in the original SQL
 46490  // string.  VALUE is the new value.  If FLAGS=="null" then VALUE is
 46491  // ignored and the value is set to NULL.  If FLAGS=="static" then
 46492  // the value is set to the value of a static variable named
 46493  // "sqlite_static_bind_value".  If FLAGS=="normal" then a copy
 46494  // of the VALUE is made.  If FLAGS=="blob10" then a VALUE is ignored
 46495  // an a 10-byte blob "abc\000xyz\000pq" is inserted.
 46496  func test_bind(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2904:26: */
 46497  	bp := tls.Alloc(142)
 46498  	defer tls.Free(142)
 46499  
 46500  	// var pStmt uintptr at bp+80, 8
 46501  
 46502  	var rc int32
 46503  	// var idx int32 at bp+88, 4
 46504  
 46505  	if argc != 5 {
 46506  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46507  			ts+16812 /* " VM IDX VALUE (n..." */, 0))
 46508  		return TCL_ERROR
 46509  	}
 46510  	if getStmtPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+80 /* &pStmt */) != 0 {
 46511  		return TCL_ERROR
 46512  	}
 46513  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+88 /* &idx */) != 0 {
 46514  		return TCL_ERROR
 46515  	}
 46516  	if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)), ts+7385 /* "null" */) == 0 {
 46517  		rc = sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)))
 46518  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)), ts+16848 /* "static" */) == 0 {
 46519  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)), sqlite_static_bind_value, -1, uintptr(0))
 46520  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)), ts+16855 /* "static-nbytes" */) == 0 {
 46521  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)), sqlite_static_bind_value,
 46522  			sqlite_static_bind_nbyte, uintptr(0))
 46523  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)), ts+16869 /* "normal" */) == 0 {
 46524  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)), *(*uintptr)(unsafe.Pointer(argv + 3*8)), -1, libc.UintptrFromInt32(-1))
 46525  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)), ts+16876 /* "blob10" */) == 0 {
 46526  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)), ts+16883 /* "abc\x00xyz\x00pq" */, 10, uintptr(0))
 46527  	} else {
 46528  		tcl.XTcl_AppendResult(tls, interp,
 46529  			libc.VaList(bp+32, ts+16894 /* "4th argument sho..." */, 0))
 46530  		return TCL_ERROR
 46531  	}
 46532  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */))), rc) != 0 {
 46533  		return TCL_ERROR
 46534  	}
 46535  	if rc != 0 {
 46536  		// var zBuf [50]int8 at bp+92, 50
 46537  
 46538  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+92 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+48, rc))
 46539  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+92 /* &zBuf[0] */, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 46540  		return TCL_ERROR
 46541  	}
 46542  	return TCL_OK
 46543  }
 46544  
 46545  // Usage: add_test_collate <db ptr> <utf8> <utf16le> <utf16be>
 46546  //
 46547  // This function is used to test that SQLite selects the correct collation
 46548  // sequence callback when multiple versions (for different text encodings)
 46549  // are available.
 46550  //
 46551  // Calling this routine registers the collation sequence "test_collate"
 46552  // with database handle <db>. The second argument must be a list of three
 46553  // boolean values. If the first is true, then a version of test_collate is
 46554  // registered for UTF-8, if the second is true, a version is registered for
 46555  // UTF-16le, if the third is true, a UTF-16be version is available.
 46556  // Previous versions of test_collate are deleted.
 46557  //
 46558  // The collation sequence test_collate is implemented by calling the
 46559  // following TCL script:
 46560  //
 46561  //   "test_collate <enc> <lhs> <rhs>"
 46562  //
 46563  // The <lhs> and <rhs> are the two values being compared, encoded in UTF-8.
 46564  // The <enc> parameter is the encoding of the collation function that
 46565  // SQLite selected to call. The TCL test script implements the
 46566  // "test_collate" proc.
 46567  //
 46568  // Note that this will only work with one interpreter at a time, as the
 46569  // interp pointer to use when evaluating the TCL script is stored in
 46570  // pTestCollateInterp.
 46571  var pTestCollateInterp uintptr /* test1.c:2975:18: */
 46572  
 46573  func test_collate_func(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* test1.c:2976:12: */
 46574  	bp := tls.Alloc(4)
 46575  	defer tls.Free(4)
 46576  
 46577  	var i uintptr = pTestCollateInterp
 46578  	var encin int32 = int32(pCtx)
 46579  	// var res int32 at bp, 4
 46580  
 46581  	var n int32
 46582  	var pVal uintptr
 46583  	var pX uintptr
 46584  
 46585  	pX = tcl.XTcl_NewStringObj(tls, ts+16954 /* "test_collate" */, -1)
 46586  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 46587  
 46588  	switch encin {
 46589  	case SQLITE_UTF8:
 46590  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16967 /* "UTF-8" */, -1))
 46591  		break
 46592  	case SQLITE_UTF16LE:
 46593  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16973 /* "UTF-16LE" */, -1))
 46594  		break
 46595  	case SQLITE_UTF16BE:
 46596  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16982 /* "UTF-16BE" */, -1))
 46597  		break
 46598  	default:
 46599  
 46600  	}
 46601  
 46602  	sqlite3.Xsqlite3BeginBenignMalloc(tls)
 46603  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 46604  	if pVal != 0 {
 46605  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, nA, zA, uint8(encin), uintptr(0))
 46606  		n = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 46607  		tcl.XTcl_ListObjAppendElement(tls, i, pX,
 46608  			tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pVal), n))
 46609  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, nB, zB, uint8(encin), uintptr(0))
 46610  		n = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 46611  		tcl.XTcl_ListObjAppendElement(tls, i, pX,
 46612  			tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pVal), n))
 46613  		sqlite3.Xsqlite3ValueFree(tls, pVal)
 46614  	}
 46615  	sqlite3.Xsqlite3EndBenignMalloc(tls)
 46616  
 46617  	tcl.XTcl_EvalObjEx(tls, i, pX, 0)
 46618  	for ok := true; ok; ok = 0 != 0 {
 46619  		var _objPtr uintptr = pX
 46620  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 46621  			tcl.XTclFreeObj(tls, _objPtr)
 46622  		}
 46623  	}
 46624  	tcl.XTcl_GetIntFromObj(tls, i, tcl.XTcl_GetObjResult(tls, i), bp /* &res */)
 46625  	return *(*int32)(unsafe.Pointer(bp /* res */))
 46626  }
 46627  
 46628  func test_collate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3026:26: */
 46629  	bp := tls.Alloc(60)
 46630  	defer tls.Free(60)
 46631  
 46632  	// var db uintptr at bp+48, 8
 46633  
 46634  	// var val int32 at bp+56, 4
 46635  
 46636  	var pVal uintptr
 46637  	var rc int32
 46638  	var zUtf16 uintptr
 46639  
 46640  	if !(objc != 5) {
 46641  		goto __1
 46642  	}
 46643  	goto bad_args
 46644  __1:
 46645  	;
 46646  	pTestCollateInterp = interp
 46647  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0) {
 46648  		goto __2
 46649  	}
 46650  	return TCL_ERROR
 46651  __2:
 46652  	;
 46653  
 46654  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+56 /* &val */)) {
 46655  		goto __3
 46656  	}
 46657  	return TCL_ERROR
 46658  __3:
 46659  	;
 46660  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+16954 /* "test_collate" */, SQLITE_UTF8,
 46661  		uintptr(SQLITE_UTF8), func() uintptr {
 46662  			if *(*int32)(unsafe.Pointer(bp + 56 /* val */)) != 0 {
 46663  				return *(*uintptr)(unsafe.Pointer(&struct {
 46664  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46665  				}{test_collate_func}))
 46666  			}
 46667  			return uintptr(0)
 46668  		}())
 46669  	if !(rc == SQLITE_OK) {
 46670  		goto __4
 46671  	}
 46672  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+56 /* &val */)) {
 46673  		goto __5
 46674  	}
 46675  	return TCL_ERROR
 46676  __5:
 46677  	;
 46678  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+16954 /* "test_collate" */, SQLITE_UTF16LE,
 46679  		uintptr(SQLITE_UTF16LE), func() uintptr {
 46680  			if *(*int32)(unsafe.Pointer(bp + 56 /* val */)) != 0 {
 46681  				return *(*uintptr)(unsafe.Pointer(&struct {
 46682  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46683  				}{test_collate_func}))
 46684  			}
 46685  			return uintptr(0)
 46686  		}())
 46687  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+56 /* &val */)) {
 46688  		goto __6
 46689  	}
 46690  	return TCL_ERROR
 46691  __6:
 46692  	;
 46693  
 46694  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).Fmutex)
 46695  	pVal = sqlite3.Xsqlite3ValueNew(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 46696  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, ts+16954 /* "test_collate" */, uint8(SQLITE_UTF8), uintptr(0))
 46697  	zUtf16 = sqlite3.Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE))
 46698  	if !((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).FmallocFailed != 0) {
 46699  		goto __7
 46700  	}
 46701  	rc = SQLITE_NOMEM
 46702  	goto __8
 46703  __7:
 46704  	rc = sqlite3.Xsqlite3_create_collation16(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zUtf16, SQLITE_UTF16BE,
 46705  		uintptr(SQLITE_UTF16BE), func() uintptr {
 46706  			if *(*int32)(unsafe.Pointer(bp + 56 /* val */)) != 0 {
 46707  				return *(*uintptr)(unsafe.Pointer(&struct {
 46708  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46709  				}{test_collate_func}))
 46710  			}
 46711  			return uintptr(0)
 46712  		}())
 46713  __8:
 46714  	;
 46715  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 46716  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).Fmutex)
 46717  __4:
 46718  	;
 46719  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0) {
 46720  		goto __9
 46721  	}
 46722  	return TCL_ERROR
 46723  __9:
 46724  	;
 46725  
 46726  	if !(rc != SQLITE_OK) {
 46727  		goto __10
 46728  	}
 46729  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 46730  	return TCL_ERROR
 46731  __10:
 46732  	;
 46733  	return TCL_OK
 46734  
 46735  bad_args:
 46736  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+15410, /* "wrong # args: sh..." */
 46737  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16991 /* " <DB> <utf8> <ut..." */, 0))
 46738  	return TCL_ERROR
 46739  }
 46740  
 46741  // Usage: add_test_utf16bin_collate <db ptr>
 46742  //
 46743  // Add a utf-16 collation sequence named "utf16bin" to the database
 46744  // handle. This collation sequence compares arguments in the same way as the
 46745  // built-in collation "binary".
 46746  func test_utf16bin_collate_func(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* test1.c:3090:12: */
 46747  	var nCmp int32 = func() int32 {
 46748  		if nA > nB {
 46749  			return nB
 46750  		}
 46751  		return nA
 46752  	}()
 46753  	var res int32 = libc.Xmemcmp(tls, zA, zB, uint64(nCmp))
 46754  	if res == 0 {
 46755  		res = (nA - nB)
 46756  	}
 46757  	return res
 46758  }
 46759  
 46760  func test_utf16bin_collate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3100:26: */
 46761  	bp := tls.Alloc(8)
 46762  	defer tls.Free(8)
 46763  
 46764  	// var db uintptr at bp, 8
 46765  
 46766  	var rc int32
 46767  
 46768  	if !(objc != 2) {
 46769  		goto __1
 46770  	}
 46771  	goto bad_args
 46772  __1:
 46773  	;
 46774  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) {
 46775  		goto __2
 46776  	}
 46777  	return TCL_ERROR
 46778  __2:
 46779  	;
 46780  
 46781  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17024 /* "utf16bin" */, SQLITE_UTF16, uintptr(0),
 46782  		*(*uintptr)(unsafe.Pointer(&struct {
 46783  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46784  		}{test_utf16bin_collate_func})))
 46785  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp /* db */)), rc) != 0) {
 46786  		goto __3
 46787  	}
 46788  	return TCL_ERROR
 46789  __3:
 46790  	;
 46791  	return TCL_OK
 46792  
 46793  bad_args:
 46794  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 46795  	return TCL_ERROR
 46796  }
 46797  
 46798  // When the collation needed callback is invoked, record the name of
 46799  // the requested collating function here.  The recorded name is linked
 46800  // to a TCL variable and used to make sure that the requested collation
 46801  // name is correct.
 46802  var zNeededCollation [200]int8    /* test1.c:3129:13: */
 46803  var pzNeededCollation uintptr = 0 /* test1.c:3130:13 */
 46804  
 46805  // Called when a collating sequence is needed.  Registered using
 46806  // sqlite3_collation_needed16().
 46807  func test_collate_needed_cb(tls *libc.TLS, pCtx uintptr, db uintptr, eTextRep int32, pName uintptr) { /* test1.c:3137:13: */
 46808  	var enc int32 = int32((*sqlite31)(unsafe.Pointer(db)).Fenc)
 46809  	var i int32
 46810  	var z uintptr
 46811  	z = pName
 46812  	i = 0
 46813  	for ; (*(*int8)(unsafe.Pointer(z)) != 0) || (*(*int8)(unsafe.Pointer(z + 1)) != 0); z++ {
 46814  		if *(*int8)(unsafe.Pointer(z)) != 0 {
 46815  			zNeededCollation[libc.PostIncInt32(&i, 1)] = *(*int8)(unsafe.Pointer(z))
 46816  		}
 46817  	}
 46818  	zNeededCollation[i] = int8(0)
 46819  	sqlite3.Xsqlite3_create_collation(tls,
 46820  		db, ts+16954 /* "test_collate" */, int32((*sqlite31)(unsafe.Pointer(db)).Fenc), uintptr(intptr_t(enc)), *(*uintptr)(unsafe.Pointer(&struct {
 46821  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46822  		}{test_collate_func})))
 46823  }
 46824  
 46825  // Usage: add_test_collate_needed DB
 46826  func test_collate_needed(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3157:26: */
 46827  	bp := tls.Alloc(8)
 46828  	defer tls.Free(8)
 46829  
 46830  	// var db uintptr at bp, 8
 46831  
 46832  	var rc int32
 46833  
 46834  	if !(objc != 2) {
 46835  		goto __1
 46836  	}
 46837  	goto bad_args
 46838  __1:
 46839  	;
 46840  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) {
 46841  		goto __2
 46842  	}
 46843  	return TCL_ERROR
 46844  __2:
 46845  	;
 46846  	rc = sqlite3.Xsqlite3_collation_needed16(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46847  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr)
 46848  	}{test_collate_needed_cb})))
 46849  	zNeededCollation[0] = int8(0)
 46850  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp /* db */)), rc) != 0) {
 46851  		goto __3
 46852  	}
 46853  	return TCL_ERROR
 46854  __3:
 46855  	;
 46856  	return TCL_OK
 46857  
 46858  bad_args:
 46859  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 46860  	return TCL_ERROR
 46861  }
 46862  
 46863  // tclcmd:   add_alignment_test_collations  DB
 46864  //
 46865  // Add two new collating sequences to the database DB
 46866  //
 46867  //     utf16_aligned
 46868  //     utf16_unaligned
 46869  //
 46870  // Both collating sequences use the same sort order as BINARY.
 46871  // The only difference is that the utf16_aligned collating
 46872  // sequence is declared with the SQLITE_UTF16_ALIGNED flag.
 46873  // Both collating functions increment the unaligned utf16 counter
 46874  // whenever they see a string that begins on an odd byte boundary.
 46875  var unaligned_string_counter int32 = 0 /* test1.c:3192:12 */
 46876  
 46877  func alignmentCollFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* test1.c:3193:12: */
 46878  	var rc int32
 46879  	var n int32
 46880  	if nKey1 < nKey2 {
 46881  		n = nKey1
 46882  	} else {
 46883  		n = nKey2
 46884  	}
 46885  	if (nKey1 > 0) && (1 == (1 & (int32(pKey1)))) {
 46886  		unaligned_string_counter++
 46887  	}
 46888  	if (nKey2 > 0) && (1 == (1 & (int32(pKey2)))) {
 46889  		unaligned_string_counter++
 46890  	}
 46891  	rc = libc.Xmemcmp(tls, pKey1, pKey2, uint64(n))
 46892  	if rc == 0 {
 46893  		rc = (nKey1 - nKey2)
 46894  	}
 46895  	return rc
 46896  }
 46897  
 46898  func add_alignment_test_collations(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3208:26: */
 46899  	bp := tls.Alloc(8)
 46900  	defer tls.Free(8)
 46901  
 46902  	// var db uintptr at bp, 8
 46903  
 46904  	if objc >= 2 {
 46905  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 46906  			return TCL_ERROR
 46907  		}
 46908  		sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17033 /* "utf16_unaligned" */, SQLITE_UTF16,
 46909  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46910  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46911  			}{alignmentCollFunc})))
 46912  		sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17049 /* "utf16_aligned" */, SQLITE_UTF16_ALIGNED,
 46913  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46914  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 46915  			}{alignmentCollFunc})))
 46916  	}
 46917  	return SQLITE_OK
 46918  }
 46919  
 46920  // Usage: add_test_function <db ptr> <utf8> <utf16le> <utf16be>
 46921  //
 46922  // This function is used to test that SQLite selects the correct user
 46923  // function callback when multiple versions (for different text encodings)
 46924  // are available.
 46925  //
 46926  // Calling this routine registers up to three versions of the user function
 46927  // "test_function" with database handle <db>.  If the second argument is
 46928  // true, then a version of test_function is registered for UTF-8, if the
 46929  // third is true, a version is registered for UTF-16le, if the fourth is
 46930  // true, a UTF-16be version is available.  Previous versions of
 46931  // test_function are deleted.
 46932  //
 46933  // The user function is implemented by calling the following TCL script:
 46934  //
 46935  //   "test_function <enc> <arg>"
 46936  //
 46937  // Where <enc> is one of UTF-8, UTF-16LE or UTF16BE, and <arg> is the
 46938  // single argument passed to the SQL function. The value returned by
 46939  // the TCL script is used as the return value of the SQL function. It
 46940  // is passed to SQLite using UTF-16BE for a UTF-8 test_function(), UTF-8
 46941  // for a UTF-16LE test_function(), and UTF-16LE for an implementation that
 46942  // prefers UTF-16BE.
 46943  func test_function_utf8(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3252:13: */
 46944  	var interp uintptr
 46945  	var pX uintptr
 46946  	var pVal uintptr
 46947  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 46948  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 46949  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 46950  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16967 /* "UTF-8" */, -1))
 46951  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 46952  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 46953  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 46954  	for ok := true; ok; ok = 0 != 0 {
 46955  		var _objPtr uintptr = pX
 46956  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 46957  			tcl.XTclFreeObj(tls, _objPtr)
 46958  		}
 46959  	}
 46960  	sqlite3.Xsqlite3_result_text(tls, pCtx, tcl.XTcl_GetStringResult(tls, interp), -1, libc.UintptrFromInt32(-1))
 46961  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 46962  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 46963  		uint8(SQLITE_UTF8), uintptr(0))
 46964  	sqlite3.Xsqlite3_result_text16be(tls, pCtx, sqlite3.Xsqlite3_value_text16be(tls, pVal),
 46965  		-1, libc.UintptrFromInt32(-1))
 46966  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 46967  }
 46968  
 46969  func test_function_utf16le(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3276:13: */
 46970  	var interp uintptr
 46971  	var pX uintptr
 46972  	var pVal uintptr
 46973  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 46974  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 46975  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 46976  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16973 /* "UTF-16LE" */, -1))
 46977  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 46978  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 46979  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 46980  	for ok := true; ok; ok = 0 != 0 {
 46981  		var _objPtr uintptr = pX
 46982  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 46983  			tcl.XTclFreeObj(tls, _objPtr)
 46984  		}
 46985  	}
 46986  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 46987  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 46988  		uint8(SQLITE_UTF8), uintptr(0))
 46989  	sqlite3.Xsqlite3_result_text(tls, pCtx, sqlite3.Xsqlite3_value_text(tls, pVal), -1, libc.UintptrFromInt32(-1))
 46990  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 46991  }
 46992  
 46993  func test_function_utf16be(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3298:13: */
 46994  	var interp uintptr
 46995  	var pX uintptr
 46996  	var pVal uintptr
 46997  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 46998  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 46999  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 47000  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16982 /* "UTF-16BE" */, -1))
 47001  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 47002  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 47003  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 47004  	for ok := true; ok; ok = 0 != 0 {
 47005  		var _objPtr uintptr = pX
 47006  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47007  			tcl.XTclFreeObj(tls, _objPtr)
 47008  		}
 47009  	}
 47010  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 47011  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 47012  		uint8(SQLITE_UTF8), uintptr(0))
 47013  	sqlite3.Xsqlite3_result_text16(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 47014  		-1, libc.UintptrFromInt32(-1))
 47015  	sqlite3.Xsqlite3_result_text16be(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 47016  		-1, libc.UintptrFromInt32(-1))
 47017  	sqlite3.Xsqlite3_result_text16le(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 47018  		-1, libc.UintptrFromInt32(-1))
 47019  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 47020  }
 47021  
 47022  func test_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3326:26: */
 47023  	bp := tls.Alloc(44)
 47024  	defer tls.Free(44)
 47025  
 47026  	// var db uintptr at bp+32, 8
 47027  
 47028  	// var val int32 at bp+40, 4
 47029  
 47030  	if !(objc != 5) {
 47031  		goto __1
 47032  	}
 47033  	goto bad_args
 47034  __1:
 47035  	;
 47036  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0) {
 47037  		goto __2
 47038  	}
 47039  	return TCL_ERROR
 47040  __2:
 47041  	;
 47042  
 47043  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &val */)) {
 47044  		goto __3
 47045  	}
 47046  	return TCL_ERROR
 47047  __3:
 47048  	;
 47049  	if !(*(*int32)(unsafe.Pointer(bp + 40 /* val */)) != 0) {
 47050  		goto __4
 47051  	}
 47052  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF8,
 47053  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 47054  			f func(*libc.TLS, uintptr, int32, uintptr)
 47055  		}{test_function_utf8})), uintptr(0), uintptr(0))
 47056  __4:
 47057  	;
 47058  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+40 /* &val */)) {
 47059  		goto __5
 47060  	}
 47061  	return TCL_ERROR
 47062  __5:
 47063  	;
 47064  	if !(*(*int32)(unsafe.Pointer(bp + 40 /* val */)) != 0) {
 47065  		goto __6
 47066  	}
 47067  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF16LE,
 47068  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 47069  			f func(*libc.TLS, uintptr, int32, uintptr)
 47070  		}{test_function_utf16le})), uintptr(0), uintptr(0))
 47071  __6:
 47072  	;
 47073  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+40 /* &val */)) {
 47074  		goto __7
 47075  	}
 47076  	return TCL_ERROR
 47077  __7:
 47078  	;
 47079  	if !(*(*int32)(unsafe.Pointer(bp + 40 /* val */)) != 0) {
 47080  		goto __8
 47081  	}
 47082  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF16BE,
 47083  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 47084  			f func(*libc.TLS, uintptr, int32, uintptr)
 47085  		}{test_function_utf16be})), uintptr(0), uintptr(0))
 47086  __8:
 47087  	;
 47088  
 47089  	return TCL_OK
 47090  bad_args:
 47091  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47092  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16991 /* " <DB> <utf8> <ut..." */, 0))
 47093  	return TCL_ERROR
 47094  }
 47095  
 47096  // Usage:         sqlite3_test_errstr <err code>
 47097  //
 47098  // Test that the english language string equivalents for sqlite error codes
 47099  // are sane. The parameter is an integer representing an sqlite error code.
 47100  // The result is a list of two elements, the string representation of the
 47101  // error code and the english language explanation.
 47102  func test_errstr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3371:26: */
 47103  	var zCode uintptr
 47104  	var i int32
 47105  	if objc != 1 {
 47106  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17077 /* "<error code>" */)
 47107  	}
 47108  
 47109  	zCode = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 47110  	for i = 0; i < 200; i++ {
 47111  		if 0 == libc.Xstrcmp(tls, sqlite3.Xsqlite3ErrName(tls, i), zCode) {
 47112  			break
 47113  		}
 47114  	}
 47115  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, i), uintptr(0))
 47116  	return TCL_OK
 47117  }
 47118  
 47119  // Usage:    breakpoint
 47120  //
 47121  // This routine exists for one purpose - to provide a place to put a
 47122  // breakpoint with GDB that can be triggered using TCL code.  The use
 47123  // for this is when a particular test fails on (say) the 1485th iteration.
 47124  // In the TCL test script, we can add code like this:
 47125  //
 47126  //     if {$i==1485} breakpoint
 47127  //
 47128  // Then run testfixture in the debugger and wait for the breakpoint to
 47129  // fire.  Then additional breakpoints can be set to trace down the bug.
 47130  func test_breakpoint(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:3404:26: */
 47131  	return TCL_OK // Do nothing
 47132  }
 47133  
 47134  // Usage:   sqlite3_bind_zeroblob  STMT IDX N
 47135  //
 47136  // Test the sqlite3_bind_zeroblob interface.  STMT is a prepared statement.
 47137  // IDX is the index of a wildcard in the prepared statement.  This command
 47138  // binds a N-byte zero-filled BLOB to the wildcard.
 47139  func test_bind_zeroblob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3420:26: */
 47140  	bp := tls.Alloc(16)
 47141  	defer tls.Free(16)
 47142  
 47143  	// var pStmt uintptr at bp, 8
 47144  
 47145  	// var idx int32 at bp+8, 4
 47146  
 47147  	// var n int32 at bp+12, 4
 47148  
 47149  	var rc int32
 47150  
 47151  	if objc != 4 {
 47152  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17090 /* "STMT IDX N" */)
 47153  		return TCL_ERROR
 47154  	}
 47155  
 47156  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 47157  		return TCL_ERROR
 47158  	}
 47159  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &idx */) != 0 {
 47160  		return TCL_ERROR
 47161  	}
 47162  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+12 /* &n */) != 0 {
 47163  		return TCL_ERROR
 47164  	}
 47165  
 47166  	rc = sqlite3.Xsqlite3_bind_zeroblob(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 8 /* idx */)), *(*int32)(unsafe.Pointer(bp + 12 /* n */)))
 47167  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))), rc) != 0 {
 47168  		return TCL_ERROR
 47169  	}
 47170  	if rc != SQLITE_OK {
 47171  		return TCL_ERROR
 47172  	}
 47173  
 47174  	return TCL_OK
 47175  }
 47176  
 47177  // Usage:   sqlite3_bind_zeroblob64  STMT IDX N
 47178  //
 47179  // Test the sqlite3_bind_zeroblob64 interface.  STMT is a prepared statement.
 47180  // IDX is the index of a wildcard in the prepared statement.  This command
 47181  // binds a N-byte zero-filled BLOB to the wildcard.
 47182  func test_bind_zeroblob64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3456:26: */
 47183  	bp := tls.Alloc(40)
 47184  	defer tls.Free(40)
 47185  
 47186  	// var pStmt uintptr at bp+16, 8
 47187  
 47188  	// var idx int32 at bp+24, 4
 47189  
 47190  	// var n Tcl_WideInt at bp+32, 8
 47191  
 47192  	var rc int32
 47193  
 47194  	if objc != 4 {
 47195  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17090 /* "STMT IDX N" */)
 47196  		return TCL_ERROR
 47197  	}
 47198  
 47199  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &pStmt */) != 0 {
 47200  		return TCL_ERROR
 47201  	}
 47202  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+24 /* &idx */) != 0 {
 47203  		return TCL_ERROR
 47204  	}
 47205  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+32 /* &n */) != 0 {
 47206  		return TCL_ERROR
 47207  	}
 47208  
 47209  	rc = sqlite3.Xsqlite3_bind_zeroblob64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 24 /* idx */)), uint64(*(*Tcl_WideInt)(unsafe.Pointer(bp + 32 /* n */))))
 47210  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))), rc) != 0 {
 47211  		return TCL_ERROR
 47212  	}
 47213  	if rc != SQLITE_OK {
 47214  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 47215  		return TCL_ERROR
 47216  	}
 47217  
 47218  	return TCL_OK
 47219  }
 47220  
 47221  // Usage:   sqlite3_bind_int  STMT N VALUE
 47222  //
 47223  // Test the sqlite3_bind_int interface.  STMT is a prepared statement.
 47224  // N is the index of a wildcard in the prepared statement.  This command
 47225  // binds a 32-bit integer VALUE to that wildcard.
 47226  func test_bind_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3493:26: */
 47227  	bp := tls.Alloc(48)
 47228  	defer tls.Free(48)
 47229  
 47230  	// var pStmt uintptr at bp+32, 8
 47231  
 47232  	// var idx int32 at bp+40, 4
 47233  
 47234  	// var value int32 at bp+44, 4
 47235  
 47236  	var rc int32
 47237  
 47238  	if objc != 4 {
 47239  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47240  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 47241  		return TCL_ERROR
 47242  	}
 47243  
 47244  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 47245  		return TCL_ERROR
 47246  	}
 47247  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &idx */) != 0 {
 47248  		return TCL_ERROR
 47249  	}
 47250  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+44 /* &value */) != 0 {
 47251  		return TCL_ERROR
 47252  	}
 47253  
 47254  	rc = sqlite3.Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* idx */)), *(*int32)(unsafe.Pointer(bp + 44 /* value */)))
 47255  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 47256  		return TCL_ERROR
 47257  	}
 47258  	if rc != SQLITE_OK {
 47259  		return TCL_ERROR
 47260  	}
 47261  
 47262  	return TCL_OK
 47263  }
 47264  
 47265  // Usage:   intarray_addr  INT  ...
 47266  //
 47267  // Return the address of a C-language array of 32-bit integers.
 47268  //
 47269  // Space to hold the array is obtained from malloc().  Call this procedure once
 47270  // with no arguments in order to release memory.  Each call to this procedure
 47271  // overwrites the previous array.
 47272  func test_intarray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3533:26: */
 47273  	var i int32
 47274  
 47275  	sqlite3.Xsqlite3_free(tls, p)
 47276  	p = uintptr(0)
 47277  	if objc > 1 {
 47278  		p = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(int32(0))) * (uint64(objc - 1)))))
 47279  		if p == uintptr(0) {
 47280  			return TCL_ERROR
 47281  		}
 47282  		for i = 0; i < (objc - 1); i++ {
 47283  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*8)), (p+uintptr(i)*4)) != 0 {
 47284  				sqlite3.Xsqlite3_free(tls, p)
 47285  				p = uintptr(0)
 47286  				return TCL_ERROR
 47287  			}
 47288  		}
 47289  	}
 47290  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p)))
 47291  	return TCL_OK
 47292  }
 47293  
 47294  var p uintptr = uintptr(0) /* test1.c:3540:14 */
 47295  
 47296  // Usage:   intarray_addr  INT  ...
 47297  //
 47298  // Return the address of a C-language array of 32-bit integers.
 47299  //
 47300  // Space to hold the array is obtained from malloc().  Call this procedure once
 47301  // with no arguments in order to release memory.  Each call to this procedure
 47302  // overwrites the previous array.
 47303  func test_int64array_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3567:26: */
 47304  	bp := tls.Alloc(8)
 47305  	defer tls.Free(8)
 47306  
 47307  	var i int32
 47308  
 47309  	sqlite3.Xsqlite3_free(tls, p1)
 47310  	p1 = uintptr(0)
 47311  	if objc > 1 {
 47312  		p1 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(sqlite3_int64(0))) * (uint64(objc - 1)))))
 47313  		if p1 == uintptr(0) {
 47314  			return TCL_ERROR
 47315  		}
 47316  		for i = 0; i < (objc - 1); i++ {
 47317  			// var v Tcl_WideInt at bp, 8
 47318  
 47319  			if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*8)), bp /* &v */) != 0 {
 47320  				sqlite3.Xsqlite3_free(tls, p1)
 47321  				p1 = uintptr(0)
 47322  				return TCL_ERROR
 47323  			}
 47324  			*(*sqlite3_int64)(unsafe.Pointer(p1 + uintptr(i)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp /* v */))
 47325  		}
 47326  	}
 47327  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p1)))
 47328  	return TCL_OK
 47329  }
 47330  
 47331  var p1 uintptr = uintptr(0) /* test1.c:3574:24 */
 47332  
 47333  // Usage:   doublearray_addr  INT  ...
 47334  //
 47335  // Return the address of a C-language array of doubles.
 47336  //
 47337  // Space to hold the array is obtained from malloc().  Call this procedure once
 47338  // with no arguments in order to release memory.  Each call to this procedure
 47339  // overwrites the previous array.
 47340  func test_doublearray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3603:26: */
 47341  	var i int32
 47342  
 47343  	sqlite3.Xsqlite3_free(tls, p2)
 47344  	p2 = uintptr(0)
 47345  	if objc > 1 {
 47346  		p2 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(float64(0))) * (uint64(objc - 1)))))
 47347  		if p2 == uintptr(0) {
 47348  			return TCL_ERROR
 47349  		}
 47350  		for i = 0; i < (objc - 1); i++ {
 47351  			if tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*8)), (p2+uintptr(i)*8)) != 0 {
 47352  				sqlite3.Xsqlite3_free(tls, p2)
 47353  				p2 = uintptr(0)
 47354  				return TCL_ERROR
 47355  			}
 47356  		}
 47357  	}
 47358  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p2)))
 47359  	return TCL_OK
 47360  }
 47361  
 47362  var p2 uintptr = uintptr(0) /* test1.c:3610:17 */
 47363  
 47364  // Usage:   textarray_addr  TEXT ...
 47365  //
 47366  // Return the address of a C-language array of strings.
 47367  //
 47368  // Space to hold the array is obtained from malloc().  Call this procedure once
 47369  // with no arguments in order to release memory.  Each call to this procedure
 47370  // overwrites the previous array.
 47371  func test_textarray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3637:26: */
 47372  	bp := tls.Alloc(8)
 47373  	defer tls.Free(8)
 47374  
 47375  	var i int32
 47376  
 47377  	for i = 0; i < n; i++ {
 47378  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(p3 + uintptr(i)*8)))
 47379  	}
 47380  	sqlite3.Xsqlite3_free(tls, p3)
 47381  	p3 = uintptr(0)
 47382  	if objc > 1 {
 47383  		p3 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(objc - 1)))))
 47384  		if p3 == uintptr(0) {
 47385  			return TCL_ERROR
 47386  		}
 47387  		for i = 0; i < (objc - 1); i++ {
 47388  			*(*uintptr)(unsafe.Pointer(p3 + uintptr(i)*8)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*8)))))
 47389  		}
 47390  	}
 47391  	n = (objc - 1)
 47392  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p3)))
 47393  	return TCL_OK
 47394  }
 47395  
 47396  var n int32 = 0             /* test1.c:3644:14 */
 47397  var p3 uintptr = uintptr(0) /* test1.c:3645:15 */
 47398  
 47399  // Usage:   sqlite3_bind_int64  STMT N VALUE
 47400  //
 47401  // Test the sqlite3_bind_int64 interface.  STMT is a prepared statement.
 47402  // N is the index of a wildcard in the prepared statement.  This command
 47403  // binds a 64-bit integer VALUE to that wildcard.
 47404  func test_bind_int64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3670:26: */
 47405  	bp := tls.Alloc(56)
 47406  	defer tls.Free(56)
 47407  
 47408  	// var pStmt uintptr at bp+32, 8
 47409  
 47410  	// var idx int32 at bp+40, 4
 47411  
 47412  	// var value Tcl_WideInt at bp+48, 8
 47413  
 47414  	var rc int32
 47415  
 47416  	if objc != 4 {
 47417  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47418  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 47419  		return TCL_ERROR
 47420  	}
 47421  
 47422  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 47423  		return TCL_ERROR
 47424  	}
 47425  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &idx */) != 0 {
 47426  		return TCL_ERROR
 47427  	}
 47428  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+48 /* &value */) != 0 {
 47429  		return TCL_ERROR
 47430  	}
 47431  
 47432  	rc = sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* idx */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 48 /* value */)))
 47433  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 47434  		return TCL_ERROR
 47435  	}
 47436  	if rc != SQLITE_OK {
 47437  		return TCL_ERROR
 47438  	}
 47439  
 47440  	return TCL_OK
 47441  }
 47442  
 47443  // Usage:   sqlite3_bind_double  STMT N VALUE
 47444  //
 47445  // Test the sqlite3_bind_double interface.  STMT is a prepared statement.
 47446  // N is the index of a wildcard in the prepared statement.  This command
 47447  // binds a 64-bit integer VALUE to that wildcard.
 47448  func test_bind_double(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3708:26: */
 47449  	bp := tls.Alloc(64)
 47450  	defer tls.Free(64)
 47451  
 47452  	// var pStmt uintptr at bp+32, 8
 47453  
 47454  	// var idx int32 at bp+40, 4
 47455  
 47456  	*(*float64)(unsafe.Pointer(bp + 48 /* value */)) = float64(0)
 47457  	var rc int32
 47458  	var zVal uintptr
 47459  	var i int32
 47460  
 47461  	if objc != 4 {
 47462  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47463  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 47464  		return TCL_ERROR
 47465  	}
 47466  
 47467  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 47468  		return TCL_ERROR
 47469  	}
 47470  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &idx */) != 0 {
 47471  		return TCL_ERROR
 47472  	}
 47473  
 47474  	// Intercept the string "NaN" and generate a NaN value for it.
 47475  	// All other strings are passed through to Tcl_GetDoubleFromObj().
 47476  	// Tcl_GetDoubleFromObj() should understand "NaN" but some versions
 47477  	// contain a bug.
 47478  	zVal = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 47479  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aSpecialFp)) / uint64(unsafe.Sizeof(struct {
 47480  		FzName  uintptr
 47481  		FiUpper uint32
 47482  		FiLower uint32
 47483  	}{}))); i++ {
 47484  		if libc.Xstrcmp(tls, aSpecialFp[i].FzName, zVal) == 0 {
 47485  			// var x sqlite3_uint64 at bp+56, 8
 47486  
 47487  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 56 /* x */)) = sqlite3_uint64(aSpecialFp[i].FiUpper)
 47488  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 56 /* x */)) <<= 32
 47489  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 56 /* x */)) |= sqlite3_uint64(aSpecialFp[i].FiLower)
 47490  
 47491  			libc.Xmemcpy(tls, bp+48 /* &value */, bp+56 /* &x */, uint64(8))
 47492  			break
 47493  		}
 47494  	}
 47495  	if (uint64(i) >= (uint64(unsafe.Sizeof(aSpecialFp)) / uint64(unsafe.Sizeof(struct {
 47496  		FzName  uintptr
 47497  		FiUpper uint32
 47498  		FiLower uint32
 47499  	}{})))) && (tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+48 /* &value */) != 0) {
 47500  		return TCL_ERROR
 47501  	}
 47502  	rc = sqlite3.Xsqlite3_bind_double(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* idx */)), *(*float64)(unsafe.Pointer(bp + 48 /* value */)))
 47503  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 47504  		return TCL_ERROR
 47505  	}
 47506  	if rc != SQLITE_OK {
 47507  		return TCL_ERROR
 47508  	}
 47509  
 47510  	return TCL_OK
 47511  }
 47512  
 47513  var aSpecialFp = [10]struct {
 47514  	FzName  uintptr
 47515  	FiUpper uint32
 47516  	FiLower uint32
 47517  }{
 47518  	{FzName: ts + 17115 /* "NaN" */, FiUpper: uint32(0x7fffffff), FiLower: 0xffffffff},
 47519  	{FzName: ts + 17119 /* "SNaN" */, FiUpper: uint32(0x7ff7ffff), FiLower: 0xffffffff},
 47520  	{FzName: ts + 17124 /* "-NaN" */, FiUpper: 0xffffffff, FiLower: 0xffffffff},
 47521  	{FzName: ts + 17129 /* "-SNaN" */, FiUpper: 0xfff7ffff, FiLower: 0xffffffff},
 47522  	{FzName: ts + 17135 /* "+Inf" */, FiUpper: uint32(0x7ff00000)},
 47523  	{FzName: ts + 17140 /* "-Inf" */, FiUpper: 0xfff00000},
 47524  	{FzName: ts + 17145 /* "Epsilon" */, FiLower: uint32(0x00000001)},
 47525  	{FzName: ts + 17153 /* "-Epsilon" */, FiUpper: 0x80000000, FiLower: uint32(0x00000001)},
 47526  	{FzName: ts + 17162 /* "NaN0" */, FiUpper: uint32(0x7ff80000)},
 47527  	{FzName: ts + 17167 /* "-NaN0" */, FiUpper: 0xfff80000},
 47528  } /* test1.c:3724:5 */
 47529  
 47530  // Usage:   sqlite3_bind_null  STMT N
 47531  //
 47532  // Test the sqlite3_bind_null interface.  STMT is a prepared statement.
 47533  // N is the index of a wildcard in the prepared statement.  This command
 47534  // binds a NULL to the wildcard.
 47535  func test_bind_null(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3784:26: */
 47536  	bp := tls.Alloc(44)
 47537  	defer tls.Free(44)
 47538  
 47539  	// var pStmt uintptr at bp+32, 8
 47540  
 47541  	// var idx int32 at bp+40, 4
 47542  
 47543  	var rc int32
 47544  
 47545  	if objc != 3 {
 47546  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47547  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17173 /* " STMT N" */, 0))
 47548  		return TCL_ERROR
 47549  	}
 47550  
 47551  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 47552  		return TCL_ERROR
 47553  	}
 47554  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &idx */) != 0 {
 47555  		return TCL_ERROR
 47556  	}
 47557  
 47558  	rc = sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* idx */)))
 47559  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 47560  		return TCL_ERROR
 47561  	}
 47562  	if rc != SQLITE_OK {
 47563  		return TCL_ERROR
 47564  	}
 47565  
 47566  	return TCL_OK
 47567  }
 47568  
 47569  // Usage:   sqlite3_bind_text  STMT N STRING BYTES
 47570  //
 47571  // Test the sqlite3_bind_text interface.  STMT is a prepared statement.
 47572  // N is the index of a wildcard in the prepared statement.  This command
 47573  // binds a UTF-8 string STRING to the wildcard.  The string is BYTES bytes
 47574  // long.
 47575  func test_bind_text(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3820:26: */
 47576  	bp := tls.Alloc(84)
 47577  	defer tls.Free(84)
 47578  
 47579  	// var pStmt uintptr at bp+64, 8
 47580  
 47581  	// var idx int32 at bp+72, 4
 47582  
 47583  	*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */)) = 0
 47584  	// var bytes int32 at bp+80, 4
 47585  
 47586  	var value uintptr
 47587  	var rc int32
 47588  	var toFree uintptr = uintptr(0)
 47589  
 47590  	if objc != 5 {
 47591  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47592  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17181 /* " STMT N VALUE BY..." */, 0))
 47593  		return TCL_ERROR
 47594  	}
 47595  
 47596  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &pStmt */) != 0 {
 47597  		return TCL_ERROR
 47598  	}
 47599  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+72 /* &idx */) != 0 {
 47600  		return TCL_ERROR
 47601  	}
 47602  	value = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+76 /* &trueLength */)
 47603  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+80 /* &bytes */) != 0 {
 47604  		return TCL_ERROR
 47605  	}
 47606  	if *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)) < 0 {
 47607  		toFree = libc.Xmalloc(tls, (uint64(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */)) + 1)))
 47608  		if toFree == uintptr(0) {
 47609  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+1930 /* "out of memory" */, uintptr(0)))
 47610  			return TCL_ERROR
 47611  		}
 47612  		libc.Xmemcpy(tls, toFree, value, uint64(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */))))
 47613  		*(*int8)(unsafe.Pointer(toFree + uintptr(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */))))) = int8(0)
 47614  		value = toFree
 47615  	}
 47616  	rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 72 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)), libc.UintptrFromInt32(-1))
 47617  	libc.Xfree(tls, toFree)
 47618  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 47619  		return TCL_ERROR
 47620  	}
 47621  	if rc != SQLITE_OK {
 47622  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 47623  		return TCL_ERROR
 47624  	}
 47625  
 47626  	return TCL_OK
 47627  }
 47628  
 47629  // Usage:   sqlite3_bind_text16 ?-static? STMT N STRING BYTES
 47630  //
 47631  // Test the sqlite3_bind_text16 interface.  STMT is a prepared statement.
 47632  // N is the index of a wildcard in the prepared statement.  This command
 47633  // binds a UTF-16 string STRING to the wildcard.  The string is BYTES bytes
 47634  // long.
 47635  func test_bind_text16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3873:26: */
 47636  	bp := tls.Alloc(84)
 47637  	defer tls.Free(84)
 47638  
 47639  	// var pStmt uintptr at bp+64, 8
 47640  
 47641  	// var idx int32 at bp+72, 4
 47642  
 47643  	// var bytes int32 at bp+80, 4
 47644  
 47645  	var value uintptr
 47646  	var toFree uintptr = uintptr(0)
 47647  	var rc int32
 47648  	*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */)) = 0
 47649  
 47650  	var xDel uintptr = func() uintptr {
 47651  		if objc == 6 {
 47652  			return uintptr(0)
 47653  		}
 47654  		return libc.UintptrFromInt32(-1)
 47655  	}()
 47656  	var oStmt uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-4))*8))
 47657  	var oN uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*8))
 47658  	var oString uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8))
 47659  	var oBytes uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8))
 47660  
 47661  	if (objc != 5) && (objc != 6) {
 47662  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47663  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17181 /* " STMT N VALUE BY..." */, 0))
 47664  		return TCL_ERROR
 47665  	}
 47666  
 47667  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, oStmt), bp+64 /* &pStmt */) != 0 {
 47668  		return TCL_ERROR
 47669  	}
 47670  	if tcl.XTcl_GetIntFromObj(tls, interp, oN, bp+72 /* &idx */) != 0 {
 47671  		return TCL_ERROR
 47672  	}
 47673  	value = tcl.XTcl_GetByteArrayFromObj(tls, oString, bp+76 /* &trueLength */)
 47674  	if tcl.XTcl_GetIntFromObj(tls, interp, oBytes, bp+80 /* &bytes */) != 0 {
 47675  		return TCL_ERROR
 47676  	}
 47677  	if (*(*int32)(unsafe.Pointer(bp + 80 /* bytes */)) < 0) && (xDel == (libc.UintptrFromInt32(-1))) {
 47678  		toFree = libc.Xmalloc(tls, (uint64(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */)) + 3)))
 47679  		if toFree == uintptr(0) {
 47680  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+1930 /* "out of memory" */, uintptr(0)))
 47681  			return TCL_ERROR
 47682  		}
 47683  		libc.Xmemcpy(tls, toFree, value, uint64(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */))))
 47684  		libc.Xmemset(tls, (toFree + uintptr(*(*int32)(unsafe.Pointer(bp + 76 /* trueLength */)))), 0, uint64(3))
 47685  		value = toFree
 47686  	}
 47687  	rc = sqlite3.Xsqlite3_bind_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 72 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)), xDel)
 47688  	libc.Xfree(tls, toFree)
 47689  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 47690  		return TCL_ERROR
 47691  	}
 47692  	if rc != SQLITE_OK {
 47693  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 47694  		return TCL_ERROR
 47695  	}
 47696  
 47697  	return TCL_OK
 47698  }
 47699  
 47700  // Usage:   sqlite3_bind_blob ?-static? STMT N DATA BYTES
 47701  //
 47702  // Test the sqlite3_bind_blob interface.  STMT is a prepared statement.
 47703  // N is the index of a wildcard in the prepared statement.  This command
 47704  // binds a BLOB to the wildcard.  The BLOB is BYTES bytes in size.
 47705  func test_bind_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3933:26: */
 47706  	bp := tls.Alloc(284)
 47707  	defer tls.Free(284)
 47708  
 47709  	// var pStmt uintptr at bp+64, 8
 47710  
 47711  	// var len int32 at bp+76, 4
 47712  
 47713  	// var idx int32 at bp+72, 4
 47714  
 47715  	// var bytes int32 at bp+80, 4
 47716  
 47717  	var value uintptr
 47718  	var rc int32
 47719  	var xDestructor sqlite3_destructor_type = libc.UintptrFromInt32(-1)
 47720  
 47721  	if (objc != 5) && (objc != 6) {
 47722  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47723  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17201 /* " STMT N DATA BYT..." */, 0))
 47724  		return TCL_ERROR
 47725  	}
 47726  
 47727  	if objc == 6 {
 47728  		xDestructor = uintptr(0)
 47729  		objv += 8
 47730  	}
 47731  
 47732  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &pStmt */) != 0 {
 47733  		return TCL_ERROR
 47734  	}
 47735  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+72 /* &idx */) != 0 {
 47736  		return TCL_ERROR
 47737  	}
 47738  
 47739  	value = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+76 /* &len */)
 47740  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+80 /* &bytes */) != 0 {
 47741  		return TCL_ERROR
 47742  	}
 47743  
 47744  	if *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)) > *(*int32)(unsafe.Pointer(bp + 76 /* len */)) {
 47745  		// var zBuf [200]int8 at bp+84, 200
 47746  
 47747  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+84, /* &zBuf[0] */
 47748  			ts+17220 /* "cannot use %d bl..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)), *(*int32)(unsafe.Pointer(bp + 76 /* len */))))
 47749  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+84 /* &zBuf[0] */, uintptr(0)))
 47750  		return TCL_ERROR
 47751  	}
 47752  
 47753  	rc = sqlite3.Xsqlite3_bind_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 72 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 80 /* bytes */)), xDestructor)
 47754  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 47755  		return TCL_ERROR
 47756  	}
 47757  	if rc != SQLITE_OK {
 47758  		return TCL_ERROR
 47759  	}
 47760  
 47761  	return TCL_OK
 47762  }
 47763  
 47764  // sqlite3_carray_bind [options...] STMT NAME VALUE ...
 47765  //
 47766  // Options:
 47767  //    -transient
 47768  //    -static
 47769  //    -int32
 47770  //    -int64
 47771  //    -double
 47772  //    -text
 47773  //
 47774  // Each call clears static data.  Called with no options does nothing
 47775  // but clear static data.
 47776  func test_carray_bind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3996:26: */
 47777  	bp := tls.Alloc(112)
 47778  	defer tls.Free(112)
 47779  
 47780  	// var pStmt uintptr at bp+80, 8
 47781  
 47782  	var eType int32 // CARRAY_INT32
 47783  	var nData int32
 47784  	var aData uintptr
 47785  	var isTransient int32
 47786  	var isStatic int32
 47787  	// var idx int32 at bp+88, 4
 47788  
 47789  	var i int32
 47790  	var j int32
 47791  	var rc int32
 47792  	var xDel uintptr
 47793  	var z uintptr
 47794  	// var v int32 at bp+92, 4
 47795  	// INT32
 47796  	var a uintptr
 47797  	// var v1 Tcl_WideInt at bp+96, 8
 47798  	// INT64
 47799  	var a1 uintptr
 47800  	// var v2 float64 at bp+104, 8
 47801  	// DOUBLE
 47802  	var a2 uintptr
 47803  	var v3 uintptr // TEXT
 47804  	var a3 uintptr
 47805  	eType = 0
 47806  	nData = 0
 47807  	aData = uintptr(0)
 47808  	isTransient = 0
 47809  	isStatic = 0
 47810  	xDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 47811  
 47812  	if !(aStaticData != 0) {
 47813  		goto __1
 47814  	}
 47815  	// Always clear preexisting static data on every call
 47816  	if !(eStaticType == 3) {
 47817  		goto __2
 47818  	}
 47819  	i = 0
 47820  __3:
 47821  	if !(i < nStaticData) {
 47822  		goto __5
 47823  	}
 47824  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((aStaticData) + uintptr(i)*8)))
 47825  	goto __4
 47826  __4:
 47827  	i++
 47828  	goto __3
 47829  	goto __5
 47830  __5:
 47831  	;
 47832  __2:
 47833  	;
 47834  	sqlite3.Xsqlite3_free(tls, aStaticData)
 47835  	aStaticData = uintptr(0)
 47836  	nStaticData = 0
 47837  	eStaticType = 0
 47838  __1:
 47839  	;
 47840  	if !(objc == 1) {
 47841  		goto __6
 47842  	}
 47843  	return TCL_OK
 47844  __6:
 47845  	;
 47846  
 47847  	i = 1
 47848  __7:
 47849  	if !((i < objc) && (int32(*(*int8)(unsafe.Pointer(tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)))))) == '-')) {
 47850  		goto __9
 47851  	}
 47852  	z = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)))
 47853  	if !(libc.Xstrcmp(tls, z, ts+17254 /* "-transient" */) == 0) {
 47854  		goto __10
 47855  	}
 47856  	isTransient = 1
 47857  	xDel = libc.UintptrFromInt32(-1)
 47858  	goto __11
 47859  __10:
 47860  	if !(libc.Xstrcmp(tls, z, ts+17265 /* "-static" */) == 0) {
 47861  		goto __12
 47862  	}
 47863  	isStatic = 1
 47864  	xDel = uintptr(0)
 47865  	goto __13
 47866  __12:
 47867  	if !(libc.Xstrcmp(tls, z, ts+17273 /* "-int32" */) == 0) {
 47868  		goto __14
 47869  	}
 47870  	eType = 0 // CARRAY_INT32
 47871  	goto __15
 47872  __14:
 47873  	if !(libc.Xstrcmp(tls, z, ts+17280 /* "-int64" */) == 0) {
 47874  		goto __16
 47875  	}
 47876  	eType = 1 // CARRAY_INT64
 47877  	goto __17
 47878  __16:
 47879  	if !(libc.Xstrcmp(tls, z, ts+17287 /* "-double" */) == 0) {
 47880  		goto __18
 47881  	}
 47882  	eType = 2 // CARRAY_DOUBLE
 47883  	goto __19
 47884  __18:
 47885  	if !(libc.Xstrcmp(tls, z, ts+17295 /* "-text" */) == 0) {
 47886  		goto __20
 47887  	}
 47888  	eType = 3 // CARRAY_TEXT
 47889  	goto __21
 47890  __20:
 47891  	if !(libc.Xstrcmp(tls, z, ts+17301 /* "--" */) == 0) {
 47892  		goto __22
 47893  	}
 47894  	goto __9
 47895  	goto __23
 47896  __22:
 47897  
 47898  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+12914 /* "unknown option: " */, z, uintptr(0)))
 47899  	return TCL_ERROR
 47900  __23:
 47901  	;
 47902  __21:
 47903  	;
 47904  __19:
 47905  	;
 47906  __17:
 47907  	;
 47908  __15:
 47909  	;
 47910  __13:
 47911  	;
 47912  __11:
 47913  	;
 47914  	goto __8
 47915  __8:
 47916  	i++
 47917  	goto __7
 47918  	goto __9
 47919  __9:
 47920  	;
 47921  	if !(((eType == 3) && !(isStatic != 0)) && !(isTransient != 0)) {
 47922  		goto __24
 47923  	}
 47924  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+17304, /* "text data must b..." */
 47925  		uintptr(0)))
 47926  	return TCL_ERROR
 47927  __24:
 47928  	;
 47929  	if !((isStatic != 0) && (isTransient != 0)) {
 47930  		goto __25
 47931  	}
 47932  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+17351, /* "cannot be both -..." */
 47933  		uintptr(0)))
 47934  	return TCL_ERROR
 47935  __25:
 47936  	;
 47937  	if !((objc - i) < 2) {
 47938  		goto __26
 47939  	}
 47940  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17389 /* "[OPTIONS] STMT I..." */)
 47941  	return TCL_ERROR
 47942  __26:
 47943  	;
 47944  	if !(getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8))), bp+80 /* &pStmt */) != 0) {
 47945  		goto __27
 47946  	}
 47947  	return TCL_ERROR
 47948  __27:
 47949  	;
 47950  	i++
 47951  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+88 /* &idx */) != 0) {
 47952  		goto __28
 47953  	}
 47954  	return TCL_ERROR
 47955  __28:
 47956  	;
 47957  	i++
 47958  	nData = (objc - i)
 47959  	switch eType + (4 * (libc.Bool32(nData <= 0))) {
 47960  	case 0:
 47961  		goto __30
 47962  	case 1:
 47963  		goto __31
 47964  	case 2:
 47965  		goto __32
 47966  	case 3:
 47967  		goto __33
 47968  	case 4:
 47969  		goto __34
 47970  	}
 47971  	goto __29
 47972  __30: // INT32
 47973  	a = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(int32(0))) * uint64(nData))))
 47974  	if !(a == uintptr(0)) {
 47975  		goto __35
 47976  	}
 47977  	rc = SQLITE_NOMEM
 47978  	goto carray_bind_done
 47979  __35:
 47980  	;
 47981  	j = 0
 47982  __36:
 47983  	if !(j < nData) {
 47984  		goto __38
 47985  	}
 47986  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*8)), bp+92 /* &v */) != 0) {
 47987  		goto __39
 47988  	}
 47989  	sqlite3.Xsqlite3_free(tls, a)
 47990  	return TCL_ERROR
 47991  __39:
 47992  	;
 47993  	*(*int32)(unsafe.Pointer(a + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(bp + 92 /* v */))
 47994  	goto __37
 47995  __37:
 47996  	j++
 47997  	goto __36
 47998  	goto __38
 47999  __38:
 48000  	;
 48001  	aData = a
 48002  	goto __29
 48003  
 48004  __31: // INT64
 48005  	a1 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(sqlite3_int64(0))) * uint64(nData))))
 48006  	if !(a1 == uintptr(0)) {
 48007  		goto __40
 48008  	}
 48009  	rc = SQLITE_NOMEM
 48010  	goto carray_bind_done
 48011  __40:
 48012  	;
 48013  	j = 0
 48014  __41:
 48015  	if !(j < nData) {
 48016  		goto __43
 48017  	}
 48018  	if !(tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*8)), bp+96 /* &v1 */) != 0) {
 48019  		goto __44
 48020  	}
 48021  	sqlite3.Xsqlite3_free(tls, a1)
 48022  	return TCL_ERROR
 48023  __44:
 48024  	;
 48025  	*(*sqlite3_int64)(unsafe.Pointer(a1 + uintptr(j)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 96 /* v1 */))
 48026  	goto __42
 48027  __42:
 48028  	j++
 48029  	goto __41
 48030  	goto __43
 48031  __43:
 48032  	;
 48033  	aData = a1
 48034  	goto __29
 48035  
 48036  __32: // DOUBLE
 48037  	a2 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(float64(0))) * uint64(nData))))
 48038  	if !(a2 == uintptr(0)) {
 48039  		goto __45
 48040  	}
 48041  	rc = SQLITE_NOMEM
 48042  	goto carray_bind_done
 48043  __45:
 48044  	;
 48045  	j = 0
 48046  __46:
 48047  	if !(j < nData) {
 48048  		goto __48
 48049  	}
 48050  	if !(tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*8)), bp+104 /* &v2 */) != 0) {
 48051  		goto __49
 48052  	}
 48053  	sqlite3.Xsqlite3_free(tls, a2)
 48054  	return TCL_ERROR
 48055  __49:
 48056  	;
 48057  	*(*float64)(unsafe.Pointer(a2 + uintptr(j)*8)) = *(*float64)(unsafe.Pointer(bp + 104 /* v2 */))
 48058  	goto __47
 48059  __47:
 48060  	j++
 48061  	goto __46
 48062  	goto __48
 48063  __48:
 48064  	;
 48065  	aData = a2
 48066  	goto __29
 48067  
 48068  __33: // TEXT
 48069  	a3 = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nData))))
 48070  	if !(a3 == uintptr(0)) {
 48071  		goto __50
 48072  	}
 48073  	rc = SQLITE_NOMEM
 48074  	goto carray_bind_done
 48075  __50:
 48076  	;
 48077  	j = 0
 48078  __51:
 48079  	if !(j < nData) {
 48080  		goto __53
 48081  	}
 48082  	v3 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*8)))
 48083  	*(*uintptr)(unsafe.Pointer(a3 + uintptr(j)*8)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+56, v3))
 48084  	goto __52
 48085  __52:
 48086  	j++
 48087  	goto __51
 48088  	goto __53
 48089  __53:
 48090  	;
 48091  	aData = a3
 48092  	goto __29
 48093  
 48094  __34: // nData==0
 48095  	aData = ts + 489 /* "" */
 48096  	xDel = uintptr(0)
 48097  	isTransient = 0
 48098  	isStatic = 0
 48099  	goto __29
 48100  
 48101  __29:
 48102  	;
 48103  	if !(isStatic != 0) {
 48104  		goto __54
 48105  	}
 48106  	aStaticData = aData
 48107  	nStaticData = nData
 48108  	eStaticType = eType
 48109  __54:
 48110  	;
 48111  	rc = sqlite3_carray_bind(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 88 /* idx */)), aData, nData, eType, xDel)
 48112  	if !(isTransient != 0) {
 48113  		goto __55
 48114  	}
 48115  	if !(eType == 3) {
 48116  		goto __56
 48117  	}
 48118  	i = 0
 48119  __57:
 48120  	if !(i < nData) {
 48121  		goto __59
 48122  	}
 48123  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*8)))
 48124  	goto __58
 48125  __58:
 48126  	i++
 48127  	goto __57
 48128  	goto __59
 48129  __59:
 48130  	;
 48131  __56:
 48132  	;
 48133  	sqlite3.Xsqlite3_free(tls, aData)
 48134  __55:
 48135  	;
 48136  carray_bind_done:
 48137  	if !(rc != 0) {
 48138  		goto __60
 48139  	}
 48140  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, sqlite3.Xsqlite3_errstr(tls, rc), uintptr(0)))
 48141  	return TCL_ERROR
 48142  __60:
 48143  	;
 48144  	return TCL_OK
 48145  }
 48146  
 48147  var aStaticData uintptr = uintptr(0) /* test1.c:4012:15 */
 48148  var nStaticData int32 = 0            /* test1.c:4013:14 */
 48149  var eStaticType int32 = 0            /* test1.c:4014:14 */
 48150  
 48151  // Usage:   sqlite3_bind_parameter_count  STMT
 48152  //
 48153  // Return the number of wildcards in the given statement.
 48154  func test_bind_parameter_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4174:26: */
 48155  	bp := tls.Alloc(8)
 48156  	defer tls.Free(8)
 48157  
 48158  	// var pStmt uintptr at bp, 8
 48159  
 48160  	if objc != 2 {
 48161  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 48162  		return TCL_ERROR
 48163  	}
 48164  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 48165  		return TCL_ERROR
 48166  	}
 48167  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))))
 48168  	return TCL_OK
 48169  }
 48170  
 48171  // Usage:   sqlite3_bind_parameter_name  STMT  N
 48172  //
 48173  // Return the name of the Nth wildcard.  The first wildcard is 1.
 48174  // An empty string is returned if N is out of range or if the wildcard
 48175  // is nameless.
 48176  func test_bind_parameter_name(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4198:26: */
 48177  	bp := tls.Alloc(12)
 48178  	defer tls.Free(12)
 48179  
 48180  	// var pStmt uintptr at bp, 8
 48181  
 48182  	// var i int32 at bp+8, 4
 48183  
 48184  	if objc != 3 {
 48185  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17423 /* "STMT N" */)
 48186  		return TCL_ERROR
 48187  	}
 48188  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 48189  		return TCL_ERROR
 48190  	}
 48191  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &i */) != 0 {
 48192  		return TCL_ERROR
 48193  	}
 48194  	tcl.XTcl_SetObjResult(tls, interp,
 48195  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_bind_parameter_name(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 8 /* i */))), -1))
 48196  	return TCL_OK
 48197  }
 48198  
 48199  // Usage:   sqlite3_bind_parameter_index  STMT  NAME
 48200  //
 48201  // Return the index of the wildcard called NAME.  Return 0 if there is
 48202  // no such wildcard.
 48203  func test_bind_parameter_index(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4225:26: */
 48204  	bp := tls.Alloc(8)
 48205  	defer tls.Free(8)
 48206  
 48207  	// var pStmt uintptr at bp, 8
 48208  
 48209  	if objc != 3 {
 48210  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17430 /* "STMT NAME" */)
 48211  		return TCL_ERROR
 48212  	}
 48213  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 48214  		return TCL_ERROR
 48215  	}
 48216  	tcl.XTcl_SetObjResult(tls, interp,
 48217  		tcl.XTcl_NewIntObj(tls,
 48218  			sqlite3.Xsqlite3_bind_parameter_index(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))))))
 48219  	return TCL_OK
 48220  }
 48221  
 48222  // Usage:   sqlite3_clear_bindings STMT
 48223  //
 48224  func test_clear_bindings(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4250:26: */
 48225  	bp := tls.Alloc(8)
 48226  	defer tls.Free(8)
 48227  
 48228  	// var pStmt uintptr at bp, 8
 48229  
 48230  	if objc != 2 {
 48231  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 48232  		return TCL_ERROR
 48233  	}
 48234  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 48235  		return TCL_ERROR
 48236  	}
 48237  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_clear_bindings(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))))
 48238  	return TCL_OK
 48239  }
 48240  
 48241  // Usage:   sqlite3_sleep MILLISECONDS
 48242  func test_sleep(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4270:26: */
 48243  	bp := tls.Alloc(4)
 48244  	defer tls.Free(4)
 48245  
 48246  	// var ms int32 at bp, 4
 48247  
 48248  	if objc != 2 {
 48249  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+13587 /* "MILLISECONDS" */)
 48250  		return TCL_ERROR
 48251  	}
 48252  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &ms */) != 0 {
 48253  		return TCL_ERROR
 48254  	}
 48255  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_sleep(tls, *(*int32)(unsafe.Pointer(bp /* ms */)))))
 48256  	return TCL_OK
 48257  }
 48258  
 48259  // Usage: sqlite3_extended_errcode DB
 48260  //
 48261  // Return the string representation of the most recent sqlite3_* API
 48262  // error code. e.g. "SQLITE_ERROR".
 48263  func test_ex_errcode(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4295:26: */
 48264  	bp := tls.Alloc(56)
 48265  	defer tls.Free(56)
 48266  
 48267  	// var db uintptr at bp+48, 8
 48268  
 48269  	var rc int32
 48270  
 48271  	if objc != 2 {
 48272  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48273  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 48274  		return TCL_ERROR
 48275  	}
 48276  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 48277  		return TCL_ERROR
 48278  	}
 48279  	rc = sqlite3.Xsqlite3_extended_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 48280  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 48281  	return TCL_OK
 48282  }
 48283  
 48284  // Usage: sqlite3_errcode DB
 48285  //
 48286  // Return the string representation of the most recent sqlite3_* API
 48287  // error code. e.g. "SQLITE_ERROR".
 48288  func test_errcode(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4322:26: */
 48289  	bp := tls.Alloc(56)
 48290  	defer tls.Free(56)
 48291  
 48292  	// var db uintptr at bp+48, 8
 48293  
 48294  	var rc int32
 48295  
 48296  	if objc != 2 {
 48297  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48298  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 48299  		return TCL_ERROR
 48300  	}
 48301  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 48302  		return TCL_ERROR
 48303  	}
 48304  	rc = sqlite3.Xsqlite3_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 48305  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 48306  	return TCL_OK
 48307  }
 48308  
 48309  // Usage:   sqlite3_errmsg DB
 48310  //
 48311  // Returns the UTF-8 representation of the error message string for the
 48312  // most recent sqlite3_* API call.
 48313  func test_errmsg(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4348:26: */
 48314  	bp := tls.Alloc(40)
 48315  	defer tls.Free(40)
 48316  
 48317  	// var db uintptr at bp+32, 8
 48318  
 48319  	var zErr uintptr
 48320  
 48321  	if objc != 2 {
 48322  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48323  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 48324  		return TCL_ERROR
 48325  	}
 48326  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 48327  		return TCL_ERROR
 48328  	}
 48329  
 48330  	zErr = sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 48331  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zErr, -1))
 48332  	return TCL_OK
 48333  }
 48334  
 48335  // Usage:   test_errmsg16 DB
 48336  //
 48337  // Returns the UTF-16 representation of the error message string for the
 48338  // most recent sqlite3_* API call. This is a byte array object at the TCL
 48339  // level, and it includes the 0x00 0x00 terminator bytes at the end of the
 48340  // UTF-16 string.
 48341  func test_errmsg16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4377:26: */
 48342  	bp := tls.Alloc(40)
 48343  	defer tls.Free(40)
 48344  
 48345  	// var db uintptr at bp+32, 8
 48346  
 48347  	var zErr uintptr
 48348  	var z uintptr
 48349  	var bytes int32 = 0
 48350  
 48351  	if objc != 2 {
 48352  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48353  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 48354  		return TCL_ERROR
 48355  	}
 48356  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 48357  		return TCL_ERROR
 48358  	}
 48359  
 48360  	zErr = sqlite3.Xsqlite3_errmsg16(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 48361  	if zErr != 0 {
 48362  		z = zErr
 48363  		for bytes = 0; (*(*int8)(unsafe.Pointer(z + uintptr(bytes))) != 0) || (*(*int8)(unsafe.Pointer(z + uintptr((bytes + 1)))) != 0); bytes = bytes + (2) {
 48364  		}
 48365  	}
 48366  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, zErr, bytes))
 48367  	return TCL_OK
 48368  }
 48369  
 48370  // Usage: sqlite3_prepare DB sql bytes ?tailvar?
 48371  //
 48372  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 48373  // database handle <DB>. The parameter <tailval> is the name of a global
 48374  // variable that is set to the unused portion of <sql> (if any). A
 48375  // STMT handle is returned.
 48376  func test_prepare(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4414:26: */
 48377  	bp := tls.Alloc(162)
 48378  	defer tls.Free(162)
 48379  
 48380  	// var db uintptr at bp+80, 8
 48381  
 48382  	var zSql uintptr
 48383  	// var bytes int32 at bp+88, 4
 48384  
 48385  	*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)) = uintptr(0)
 48386  	*(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) = uintptr(0)
 48387  	// var zBuf [50]int8 at bp+112, 50
 48388  
 48389  	var rc int32
 48390  
 48391  	if (objc != 5) && (objc != 4) {
 48392  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48393  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 48394  		return TCL_ERROR
 48395  	}
 48396  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+80 /* &db */) != 0 {
 48397  		return TCL_ERROR
 48398  	}
 48399  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 48400  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+88 /* &bytes */) != 0 {
 48401  		return TCL_ERROR
 48402  	}
 48403  
 48404  	rc = sqlite3.Xsqlite3_prepare(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)), bp+96 /* &pStmt */, func() uintptr {
 48405  		if objc >= 5 {
 48406  			return bp + 104 /* &zTail */
 48407  		}
 48408  		return uintptr(0)
 48409  	}())
 48410  	tcl.XTcl_ResetResult(tls, interp)
 48411  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 48412  		return TCL_ERROR
 48413  	}
 48414  	if (*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)) != 0) && (objc >= 5) {
 48415  		if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 48416  			*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) - (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */))) - int64(zSql)) / 1)))
 48417  		}
 48418  		if int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)))) < *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) {
 48419  			*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */))))
 48420  		}
 48421  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 88 /* bytes */))), 0)
 48422  	}
 48423  	if rc != SQLITE_OK {
 48424  
 48425  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+112 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 48426  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+112 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 48427  		return TCL_ERROR
 48428  	}
 48429  
 48430  	if *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) != 0 {
 48431  		if sqlite3TestMakePointerStr(tls, interp, bp+112 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) != 0 {
 48432  			return TCL_ERROR
 48433  		}
 48434  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+112 /* &zBuf[0] */, 0))
 48435  	}
 48436  	return TCL_OK
 48437  }
 48438  
 48439  // Usage: sqlite3_prepare_v2 DB sql bytes ?tailvar?
 48440  //
 48441  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 48442  // database handle <DB>. The parameter <tailval> is the name of a global
 48443  // variable that is set to the unused portion of <sql> (if any). A
 48444  // STMT handle is returned.
 48445  func test_prepare_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4471:26: */
 48446  	bp := tls.Alloc(162)
 48447  	defer tls.Free(162)
 48448  
 48449  	// var db uintptr at bp+80, 8
 48450  
 48451  	var zSql uintptr
 48452  	var zCopy uintptr = uintptr(0) // malloc() copy of zSql
 48453  	// var bytes int32 at bp+88, 4
 48454  
 48455  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) = uintptr(0)
 48456  	var pzTail uintptr
 48457  	*(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) = uintptr(0)
 48458  	// var zBuf [50]int8 at bp+112, 50
 48459  
 48460  	var rc int32
 48461  
 48462  	if (objc != 5) && (objc != 4) {
 48463  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48464  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 48465  		return TCL_ERROR
 48466  	}
 48467  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+80 /* &db */) != 0 {
 48468  		return TCL_ERROR
 48469  	}
 48470  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 48471  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+88 /* &bytes */) != 0 {
 48472  		return TCL_ERROR
 48473  	}
 48474  
 48475  	// Instead of using zSql directly, make a copy into a buffer obtained
 48476  	// directly from malloc(). The idea is to make it easier for valgrind
 48477  	// to spot buffer overreads.
 48478  	if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 48479  		zCopy = libc.Xmalloc(tls, uint64(*(*int32)(unsafe.Pointer(bp + 88 /* bytes */))))
 48480  		libc.Xmemcpy(tls, zCopy, zSql, uint64(*(*int32)(unsafe.Pointer(bp + 88 /* bytes */))))
 48481  	} else {
 48482  		var n int32 = (int32(libc.Xstrlen(tls, zSql)) + 1)
 48483  		zCopy = libc.Xmalloc(tls, uint64(n))
 48484  		libc.Xmemcpy(tls, zCopy, zSql, uint64(n))
 48485  	}
 48486  	if objc >= 5 {
 48487  		pzTail = bp + 96 /* &zTail */
 48488  	} else {
 48489  		pzTail = uintptr(0)
 48490  	}
 48491  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zCopy, *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)), bp+104 /* &pStmt */, pzTail)
 48492  	if objc >= 5 {
 48493  		*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) = (zSql + uintptr(((int64(*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */))) - int64(zCopy)) / 1)))
 48494  	}
 48495  	libc.Xfree(tls, zCopy)
 48496  
 48497  	tcl.XTcl_ResetResult(tls, interp)
 48498  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 48499  		return TCL_ERROR
 48500  	}
 48501  	if ((rc == SQLITE_OK) && (objc >= 5)) && (*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) != 0) {
 48502  		if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 48503  			*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) - (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */))) - int64(zSql)) / 1)))
 48504  		}
 48505  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 88 /* bytes */))), 0)
 48506  	}
 48507  	if rc != SQLITE_OK {
 48508  
 48509  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+112 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 48510  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+112 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 48511  		return TCL_ERROR
 48512  	}
 48513  
 48514  	if *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) != 0 {
 48515  		if sqlite3TestMakePointerStr(tls, interp, bp+112 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */))) != 0 {
 48516  			return TCL_ERROR
 48517  		}
 48518  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+112 /* &zBuf[0] */, 0))
 48519  	}
 48520  	return TCL_OK
 48521  }
 48522  
 48523  // Usage: sqlite3_prepare_v3 DB sql bytes flags ?tailvar?
 48524  //
 48525  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 48526  // database handle <DB> and flags <flags>. The parameter <tailval> is
 48527  // the name of a global variable that is set to the unused portion of
 48528  // <sql> (if any). A STMT handle is returned.
 48529  func test_prepare_v3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4545:26: */
 48530  	bp := tls.Alloc(162)
 48531  	defer tls.Free(162)
 48532  
 48533  	// var db uintptr at bp+80, 8
 48534  
 48535  	var zSql uintptr
 48536  	var zCopy uintptr = uintptr(0) // malloc() copy of zSql
 48537  	// var bytes int32 at bp+88, 4
 48538  
 48539  	// var flags int32 at bp+92, 4
 48540  
 48541  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) = uintptr(0)
 48542  	var pzTail uintptr
 48543  	*(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) = uintptr(0)
 48544  	// var zBuf [50]int8 at bp+112, 50
 48545  
 48546  	var rc int32
 48547  
 48548  	if (objc != 6) && (objc != 5) {
 48549  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48550  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17486 /* " DB sql bytes fl..." */, 0))
 48551  		return TCL_ERROR
 48552  	}
 48553  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+80 /* &db */) != 0 {
 48554  		return TCL_ERROR
 48555  	}
 48556  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 48557  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+88 /* &bytes */) != 0 {
 48558  		return TCL_ERROR
 48559  	}
 48560  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+92 /* &flags */) != 0 {
 48561  		return TCL_ERROR
 48562  	}
 48563  
 48564  	// Instead of using zSql directly, make a copy into a buffer obtained
 48565  	// directly from malloc(). The idea is to make it easier for valgrind
 48566  	// to spot buffer overreads.
 48567  	if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 48568  		zCopy = libc.Xmalloc(tls, uint64(*(*int32)(unsafe.Pointer(bp + 88 /* bytes */))))
 48569  		libc.Xmemcpy(tls, zCopy, zSql, uint64(*(*int32)(unsafe.Pointer(bp + 88 /* bytes */))))
 48570  	} else {
 48571  		var n int32 = (int32(libc.Xstrlen(tls, zSql)) + 1)
 48572  		zCopy = libc.Xmalloc(tls, uint64(n))
 48573  		libc.Xmemcpy(tls, zCopy, zSql, uint64(n))
 48574  	}
 48575  	if objc >= 6 {
 48576  		pzTail = bp + 96 /* &zTail */
 48577  	} else {
 48578  		pzTail = uintptr(0)
 48579  	}
 48580  	rc = sqlite3.Xsqlite3_prepare_v3(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zCopy, *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)), uint32(*(*int32)(unsafe.Pointer(bp + 92 /* flags */))), bp+104 /* &pStmt */, pzTail)
 48581  	libc.Xfree(tls, zCopy)
 48582  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) = (zSql + uintptr(((int64(*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */))) - int64(zCopy)) / 1)))
 48583  
 48584  	tcl.XTcl_ResetResult(tls, interp)
 48585  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 48586  		return TCL_ERROR
 48587  	}
 48588  	if ((rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)) != 0)) && (objc >= 6) {
 48589  		if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 48590  			*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) - (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */))) - int64(zSql)) / 1)))
 48591  		}
 48592  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*8)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 88 /* bytes */))), 0)
 48593  	}
 48594  	if rc != SQLITE_OK {
 48595  
 48596  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+112 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 48597  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+112 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 48598  		return TCL_ERROR
 48599  	}
 48600  
 48601  	if *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */)) != 0 {
 48602  		if sqlite3TestMakePointerStr(tls, interp, bp+112 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 104 /* pStmt */))) != 0 {
 48603  			return TCL_ERROR
 48604  		}
 48605  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+112 /* &zBuf[0] */, 0))
 48606  	}
 48607  	return TCL_OK
 48608  }
 48609  
 48610  // Usage: sqlite3_prepare_tkt3134 DB
 48611  //
 48612  // Generate a prepared statement for a zero-byte string as a test
 48613  // for ticket #3134.  The string should be preceded by a zero byte.
 48614  func test_prepare_tkt3134(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4616:26: */
 48615  	bp := tls.Alloc(146)
 48616  	defer tls.Free(146)
 48617  
 48618  	// var db uintptr at bp+80, 8
 48619  
 48620  	*(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) = uintptr(0)
 48621  	// var zBuf [50]int8 at bp+96, 50
 48622  
 48623  	var rc int32
 48624  
 48625  	if objc != 2 {
 48626  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48627  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 48628  		return TCL_ERROR
 48629  	}
 48630  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+80 /* &db */) != 0 {
 48631  		return TCL_ERROR
 48632  	}
 48633  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), (uintptr(unsafe.Pointer(&zSql)) + 1), 0, bp+88 /* &pStmt */, uintptr(0))
 48634  
 48635  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 48636  		return TCL_ERROR
 48637  	}
 48638  	if rc != SQLITE_OK {
 48639  
 48640  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+96 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 48641  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+96 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 48642  		return TCL_ERROR
 48643  	}
 48644  
 48645  	if *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) != 0 {
 48646  		if sqlite3TestMakePointerStr(tls, interp, bp+96 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */))) != 0 {
 48647  			return TCL_ERROR
 48648  		}
 48649  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+96 /* &zBuf[0] */, 0))
 48650  	}
 48651  	return TCL_OK
 48652  }
 48653  
 48654  var zSql = *(*[10]int8)(unsafe.Pointer(ts + 17514 /* "\x00SELECT 1" */)) /* test1.c:4623:21 */
 48655  
 48656  // Usage: sqlite3_prepare16 DB sql bytes tailvar
 48657  //
 48658  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 48659  // database handle <DB>. The parameter <tailval> is the name of a global
 48660  // variable that is set to the unused portion of <sql> (if any). A
 48661  // STMT handle is returned.
 48662  func test_prepare16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4659:26: */
 48663  	bp := tls.Alloc(130)
 48664  	defer tls.Free(130)
 48665  
 48666  	// var db uintptr at bp+48, 8
 48667  
 48668  	var zSql uintptr
 48669  	*(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)) = uintptr(0)
 48670  	var pTail uintptr = uintptr(0)
 48671  	*(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0)
 48672  	// var zBuf [50]int8 at bp+80, 50
 48673  
 48674  	var rc int32
 48675  	// var bytes int32 at bp+60, 4
 48676  	// The integer specified as arg 3
 48677  	// var objlen int32 at bp+56, 4
 48678  	// The byte-array length of arg 2
 48679  
 48680  	if (objc != 5) && (objc != 4) {
 48681  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48682  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 48683  		return TCL_ERROR
 48684  	}
 48685  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 48686  		return TCL_ERROR
 48687  	}
 48688  	zSql = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+56 /* &objlen */)
 48689  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+60 /* &bytes */) != 0 {
 48690  		return TCL_ERROR
 48691  	}
 48692  
 48693  	rc = sqlite3.Xsqlite3_prepare16(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 60 /* bytes */)), bp+64 /* &pStmt */, func() uintptr {
 48694  		if objc >= 5 {
 48695  			return bp + 72 /* &zTail */
 48696  		}
 48697  		return uintptr(0)
 48698  	}())
 48699  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 48700  		return TCL_ERROR
 48701  	}
 48702  	if rc != 0 {
 48703  		return TCL_ERROR
 48704  	}
 48705  
 48706  	if objc >= 5 {
 48707  		if *(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)) != 0 {
 48708  			*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) = (*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) - (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */))) - int64(zSql)) / 1)))
 48709  		} else {
 48710  			*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) = 0
 48711  		}
 48712  		pTail = tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 56 /* objlen */)))
 48713  		(*Tcl_Obj)(unsafe.Pointer(pTail)).FrefCount++
 48714  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0), pTail, 0)
 48715  		for ok := true; ok; ok = 0 != 0 {
 48716  			var _objPtr uintptr = pTail
 48717  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48718  				tcl.XTclFreeObj(tls, _objPtr)
 48719  			}
 48720  		}
 48721  	}
 48722  
 48723  	if *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) != 0 {
 48724  		if sqlite3TestMakePointerStr(tls, interp, bp+80 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) != 0 {
 48725  			return TCL_ERROR
 48726  		}
 48727  	}
 48728  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+80 /* &zBuf[0] */, 0))
 48729  	return TCL_OK
 48730  }
 48731  
 48732  // Usage: sqlite3_prepare16_v2 DB sql bytes ?tailvar?
 48733  //
 48734  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 48735  // database handle <DB>. The parameter <tailval> is the name of a global
 48736  // variable that is set to the unused portion of <sql> (if any). A
 48737  // STMT handle is returned.
 48738  func test_prepare16_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4719:26: */
 48739  	bp := tls.Alloc(130)
 48740  	defer tls.Free(130)
 48741  
 48742  	// var db uintptr at bp+48, 8
 48743  
 48744  	var zSql uintptr
 48745  	*(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)) = uintptr(0)
 48746  	var pTail uintptr = uintptr(0)
 48747  	*(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) = uintptr(0)
 48748  	// var zBuf [50]int8 at bp+80, 50
 48749  
 48750  	var rc int32
 48751  	// var bytes int32 at bp+60, 4
 48752  	// The integer specified as arg 3
 48753  	// var objlen int32 at bp+56, 4
 48754  	// The byte-array length of arg 2
 48755  
 48756  	if (objc != 5) && (objc != 4) {
 48757  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48758  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 48759  		return TCL_ERROR
 48760  	}
 48761  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 48762  		return TCL_ERROR
 48763  	}
 48764  	zSql = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+56 /* &objlen */)
 48765  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+60 /* &bytes */) != 0 {
 48766  		return TCL_ERROR
 48767  	}
 48768  
 48769  	rc = sqlite3.Xsqlite3_prepare16_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 60 /* bytes */)), bp+64 /* &pStmt */, func() uintptr {
 48770  		if objc >= 5 {
 48771  			return bp + 72 /* &zTail */
 48772  		}
 48773  		return uintptr(0)
 48774  	}())
 48775  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 48776  		return TCL_ERROR
 48777  	}
 48778  	if rc != 0 {
 48779  		return TCL_ERROR
 48780  	}
 48781  
 48782  	if objc >= 5 {
 48783  		if *(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)) != 0 {
 48784  			*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) = (*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) - (int32((int64(*(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */))) - int64(zSql)) / 1)))
 48785  		} else {
 48786  			*(*int32)(unsafe.Pointer(bp + 56 /* objlen */)) = 0
 48787  		}
 48788  		pTail = tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 56 /* objlen */)))
 48789  		(*Tcl_Obj)(unsafe.Pointer(pTail)).FrefCount++
 48790  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0), pTail, 0)
 48791  		for ok := true; ok; ok = 0 != 0 {
 48792  			var _objPtr uintptr = pTail
 48793  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48794  				tcl.XTclFreeObj(tls, _objPtr)
 48795  			}
 48796  		}
 48797  	}
 48798  
 48799  	if *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)) != 0 {
 48800  		if sqlite3TestMakePointerStr(tls, interp, bp+80 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) != 0 {
 48801  			return TCL_ERROR
 48802  		}
 48803  	}
 48804  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+80 /* &zBuf[0] */, 0))
 48805  	return TCL_OK
 48806  }
 48807  
 48808  // Usage: sqlite3_open filename ?options-list?
 48809  func test_open(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4774:26: */
 48810  	bp := tls.Alloc(156)
 48811  	defer tls.Free(156)
 48812  
 48813  	var zFilename uintptr
 48814  	// var db uintptr at bp+48, 8
 48815  
 48816  	// var zBuf [100]int8 at bp+56, 100
 48817  
 48818  	if ((objc != 3) && (objc != 2)) && (objc != 1) {
 48819  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48820  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17524 /* " filename option..." */, 0))
 48821  		return TCL_ERROR
 48822  	}
 48823  
 48824  	if objc > 1 {
 48825  		zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 48826  	} else {
 48827  		zFilename = uintptr(0)
 48828  	}
 48829  	sqlite3.Xsqlite3_open(tls, zFilename, bp+48 /* &db */)
 48830  
 48831  	if sqlite3TestMakePointerStr(tls, interp, bp+56 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))) != 0 {
 48832  		return TCL_ERROR
 48833  	}
 48834  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+56 /* &zBuf[0] */, 0))
 48835  	return TCL_OK
 48836  }
 48837  
 48838  // Usage: sqlite3_open_v2 FILENAME FLAGS VFS
 48839  func test_open_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4801:26: */
 48840  	bp := tls.Alloc(468)
 48841  	defer tls.Free(468)
 48842  
 48843  	var zFilename uintptr
 48844  	var zVfs uintptr
 48845  	var flags int32 = 0
 48846  	// var db uintptr at bp+360, 8
 48847  
 48848  	var rc int32
 48849  	// var zBuf [100]int8 at bp+368, 100
 48850  
 48851  	// var nFlag int32 at bp+16, 4
 48852  
 48853  	// var apFlag uintptr at bp+24, 8
 48854  
 48855  	var i int32
 48856  
 48857  	if objc != 4 {
 48858  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17547 /* "FILENAME FLAGS V..." */)
 48859  		return TCL_ERROR
 48860  	}
 48861  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 48862  	zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 48863  	if int32(*(*int8)(unsafe.Pointer(zVfs))) == 0x00 {
 48864  		zVfs = uintptr(0)
 48865  	}
 48866  
 48867  	rc = tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+16 /* &nFlag */, bp+24 /* &apFlag */)
 48868  	if rc != TCL_OK {
 48869  		return rc
 48870  	}
 48871  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 16 /* nFlag */)); i++ {
 48872  		// var iFlag int32 at bp+352, 4
 48873  
 48874  		*(*[20]OpenFlag)(unsafe.Pointer(bp + 32 /* aFlag */)) = [20]OpenFlag{
 48875  			{FzFlag: ts + 17566 /* "SQLITE_OPEN_READ..." */, Fflag: SQLITE_OPEN_READONLY},
 48876  			{FzFlag: ts + 17587 /* "SQLITE_OPEN_READ..." */, Fflag: SQLITE_OPEN_READWRITE},
 48877  			{FzFlag: ts + 17609 /* "SQLITE_OPEN_CREA..." */, Fflag: SQLITE_OPEN_CREATE},
 48878  			{FzFlag: ts + 17628 /* "SQLITE_OPEN_DELE..." */, Fflag: SQLITE_OPEN_DELETEONCLOSE},
 48879  			{FzFlag: ts + 17654 /* "SQLITE_OPEN_EXCL..." */, Fflag: SQLITE_OPEN_EXCLUSIVE},
 48880  			{FzFlag: ts + 17676 /* "SQLITE_OPEN_AUTO..." */, Fflag: SQLITE_OPEN_AUTOPROXY},
 48881  			{FzFlag: ts + 17698 /* "SQLITE_OPEN_MAIN..." */, Fflag: SQLITE_OPEN_MAIN_DB},
 48882  			{FzFlag: ts + 17718 /* "SQLITE_OPEN_TEMP..." */, Fflag: SQLITE_OPEN_TEMP_DB},
 48883  			{FzFlag: ts + 17738 /* "SQLITE_OPEN_TRAN..." */, Fflag: SQLITE_OPEN_TRANSIENT_DB},
 48884  			{FzFlag: ts + 17763 /* "SQLITE_OPEN_MAIN..." */, Fflag: SQLITE_OPEN_MAIN_JOURNAL},
 48885  			{FzFlag: ts + 17788 /* "SQLITE_OPEN_TEMP..." */, Fflag: SQLITE_OPEN_TEMP_JOURNAL},
 48886  			{FzFlag: ts + 17813 /* "SQLITE_OPEN_SUBJ..." */, Fflag: SQLITE_OPEN_SUBJOURNAL},
 48887  			{FzFlag: ts + 17836 /* "SQLITE_OPEN_SUPE..." */, Fflag: SQLITE_OPEN_SUPER_JOURNAL},
 48888  			{FzFlag: ts + 17862 /* "SQLITE_OPEN_NOMU..." */, Fflag: SQLITE_OPEN_NOMUTEX},
 48889  			{FzFlag: ts + 17882 /* "SQLITE_OPEN_FULL..." */, Fflag: SQLITE_OPEN_FULLMUTEX},
 48890  			{FzFlag: ts + 17904 /* "SQLITE_OPEN_SHAR..." */, Fflag: SQLITE_OPEN_SHAREDCACHE},
 48891  			{FzFlag: ts + 17928 /* "SQLITE_OPEN_PRIV..." */, Fflag: SQLITE_OPEN_PRIVATECACHE},
 48892  			{FzFlag: ts + 17953 /* "SQLITE_OPEN_WAL" */, Fflag: SQLITE_OPEN_WAL},
 48893  			{FzFlag: ts + 17969 /* "SQLITE_OPEN_URI" */, Fflag: SQLITE_OPEN_URI},
 48894  			{},
 48895  		}
 48896  		rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* apFlag */)) + uintptr(i)*8)), bp+32 /* &aFlag[0] */, int32(unsafe.Sizeof(OpenFlag{})),
 48897  			ts+17985 /* "flag" */, 0, bp+352 /* &iFlag */)
 48898  		if rc != TCL_OK {
 48899  			return rc
 48900  		}
 48901  		flags = flags | ((*OpenFlag)(unsafe.Pointer(bp + 32 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 352 /* iFlag */)))*16)).Fflag)
 48902  	}
 48903  
 48904  	rc = sqlite3.Xsqlite3_open_v2(tls, zFilename, bp+360 /* &db */, flags, zVfs)
 48905  	if sqlite3TestMakePointerStr(tls, interp, bp+368 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 360 /* db */))) != 0 {
 48906  		return TCL_ERROR
 48907  	}
 48908  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+368 /* &zBuf[0] */, 0))
 48909  	return TCL_OK
 48910  }
 48911  
 48912  type OpenFlag = struct {
 48913  	FzFlag uintptr
 48914  	Fflag  int32
 48915  	_      [4]byte
 48916  } /* test1.c:4830:5 */
 48917  
 48918  // Usage: sqlite3_open16 filename options
 48919  func test_open16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4871:26: */
 48920  	bp := tls.Alloc(156)
 48921  	defer tls.Free(156)
 48922  
 48923  	var zFilename uintptr
 48924  	// var db uintptr at bp+48, 8
 48925  
 48926  	// var zBuf [100]int8 at bp+56, 100
 48927  
 48928  	if objc != 3 {
 48929  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48930  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17524 /* " filename option..." */, 0))
 48931  		return TCL_ERROR
 48932  	}
 48933  
 48934  	zFilename = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(0))
 48935  	sqlite3.Xsqlite3_open16(tls, zFilename, bp+48 /* &db */)
 48936  
 48937  	if sqlite3TestMakePointerStr(tls, interp, bp+56 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))) != 0 {
 48938  		return TCL_ERROR
 48939  	}
 48940  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+56 /* &zBuf[0] */, 0))
 48941  	return TCL_OK
 48942  }
 48943  
 48944  // Usage: sqlite3_complete16 <UTF-16 string>
 48945  //
 48946  // Return 1 if the supplied argument is a complete SQL statement, or zero
 48947  // otherwise.
 48948  func test_complete16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4903:26: */
 48949  	var zBuf uintptr
 48950  
 48951  	if objc != 2 {
 48952  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17990 /* "<utf-16 sql>" */)
 48953  		return TCL_ERROR
 48954  	}
 48955  
 48956  	zBuf = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(0))
 48957  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_complete16(tls, zBuf)))
 48958  	return TCL_OK
 48959  }
 48960  
 48961  // Usage: sqlite3_normalize SQL
 48962  //
 48963  // Return the normalized value for an SQL statement.
 48964  func test_normalize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4928:26: */
 48965  	var zSql uintptr
 48966  	var zNorm uintptr
 48967  
 48968  	if objc != 2 {
 48969  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10170 /* "SQL" */)
 48970  		return TCL_ERROR
 48971  	}
 48972  
 48973  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 48974  	zNorm = sqlite3_normalize(tls, zSql)
 48975  	if zNorm != 0 {
 48976  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zNorm, -1))
 48977  		sqlite3.Xsqlite3_free(tls, zNorm)
 48978  	}
 48979  	return TCL_OK
 48980  }
 48981  
 48982  // Usage: sqlite3_step STMT
 48983  //
 48984  // Advance the statement to the next row.
 48985  func test_step(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4957:26: */
 48986  	bp := tls.Alloc(40)
 48987  	defer tls.Free(40)
 48988  
 48989  	// var pStmt uintptr at bp+32, 8
 48990  
 48991  	var rc int32
 48992  
 48993  	if objc != 2 {
 48994  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48995  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+16787 /* " STMT" */, 0))
 48996  		return TCL_ERROR
 48997  	}
 48998  
 48999  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49000  		return TCL_ERROR
 49001  	}
 49002  	rc = sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 49003  
 49004  	// if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR;
 49005  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 49006  	return TCL_OK
 49007  }
 49008  
 49009  func test_sql(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4980:26: */
 49010  	bp := tls.Alloc(8)
 49011  	defer tls.Free(8)
 49012  
 49013  	// var pStmt uintptr at bp, 8
 49014  
 49015  	if objc != 2 {
 49016  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 49017  		return TCL_ERROR
 49018  	}
 49019  
 49020  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 49021  		return TCL_ERROR
 49022  	}
 49023  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))), uintptr(1))
 49024  	return TCL_OK
 49025  }
 49026  
 49027  func test_ex_sql(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4997:26: */
 49028  	bp := tls.Alloc(8)
 49029  	defer tls.Free(8)
 49030  
 49031  	// var pStmt uintptr at bp, 8
 49032  
 49033  	var z uintptr
 49034  
 49035  	if objc != 2 {
 49036  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 49037  		return TCL_ERROR
 49038  	}
 49039  
 49040  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 49041  		return TCL_ERROR
 49042  	}
 49043  	z = sqlite3.Xsqlite3_expanded_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 49044  	tcl.XTcl_SetResult(tls, interp, z, uintptr(1))
 49045  	sqlite3.Xsqlite3_free(tls, z)
 49046  	return TCL_OK
 49047  }
 49048  
 49049  // Usage: sqlite3_column_count STMT
 49050  //
 49051  // Return the number of columns returned by the sql statement STMT.
 49052  func test_column_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5042:26: */
 49053  	bp := tls.Alloc(40)
 49054  	defer tls.Free(40)
 49055  
 49056  	// var pStmt uintptr at bp+32, 8
 49057  
 49058  	if objc != 2 {
 49059  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49060  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49061  		return TCL_ERROR
 49062  	}
 49063  
 49064  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49065  		return TCL_ERROR
 49066  	}
 49067  
 49068  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))))
 49069  	return TCL_OK
 49070  }
 49071  
 49072  // Usage: sqlite3_column_type STMT column
 49073  //
 49074  // Return the type of the data in column 'column' of the current row.
 49075  func test_column_type(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5067:26: */
 49076  	bp := tls.Alloc(44)
 49077  	defer tls.Free(44)
 49078  
 49079  	// var pStmt uintptr at bp+32, 8
 49080  
 49081  	// var col int32 at bp+40, 4
 49082  
 49083  	var tp int32
 49084  
 49085  	if objc != 3 {
 49086  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49087  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49088  		return TCL_ERROR
 49089  	}
 49090  
 49091  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49092  		return TCL_ERROR
 49093  	}
 49094  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49095  		return TCL_ERROR
 49096  	}
 49097  
 49098  	tp = sqlite3.Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49099  	switch tp {
 49100  	case SQLITE_INTEGER:
 49101  		tcl.XTcl_SetResult(tls, interp, ts+2274 /* "INTEGER" */, uintptr(0))
 49102  		break
 49103  	case SQLITE_NULL:
 49104  		tcl.XTcl_SetResult(tls, interp, ts+5707 /* "NULL" */, uintptr(0))
 49105  		break
 49106  	case SQLITE_FLOAT:
 49107  		tcl.XTcl_SetResult(tls, interp, ts+18016 /* "FLOAT" */, uintptr(0))
 49108  		break
 49109  	case SQLITE_TEXT:
 49110  		tcl.XTcl_SetResult(tls, interp, ts+18022 /* "TEXT" */, uintptr(0))
 49111  		break
 49112  	case SQLITE_BLOB:
 49113  		tcl.XTcl_SetResult(tls, interp, ts+18027 /* "BLOB" */, uintptr(0))
 49114  		break
 49115  	default:
 49116  
 49117  	}
 49118  
 49119  	return TCL_OK
 49120  }
 49121  
 49122  // Usage: sqlite3_column_int64 STMT column
 49123  //
 49124  // Return the data in column 'column' of the current row cast as an
 49125  // wide (64-bit) integer.
 49126  func test_column_int64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5116:26: */
 49127  	bp := tls.Alloc(44)
 49128  	defer tls.Free(44)
 49129  
 49130  	// var pStmt uintptr at bp+32, 8
 49131  
 49132  	// var col int32 at bp+40, 4
 49133  
 49134  	var iVal i64
 49135  
 49136  	if objc != 3 {
 49137  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49138  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49139  		return TCL_ERROR
 49140  	}
 49141  
 49142  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49143  		return TCL_ERROR
 49144  	}
 49145  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49146  		return TCL_ERROR
 49147  	}
 49148  
 49149  	iVal = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49150  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, iVal))
 49151  	return TCL_OK
 49152  }
 49153  
 49154  // Usage: sqlite3_column_blob STMT column
 49155  func test_column_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5143:26: */
 49156  	bp := tls.Alloc(44)
 49157  	defer tls.Free(44)
 49158  
 49159  	// var pStmt uintptr at bp+32, 8
 49160  
 49161  	// var col int32 at bp+40, 4
 49162  
 49163  	var len int32
 49164  	var pBlob uintptr
 49165  
 49166  	if objc != 3 {
 49167  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49168  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49169  		return TCL_ERROR
 49170  	}
 49171  
 49172  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49173  		return TCL_ERROR
 49174  	}
 49175  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49176  		return TCL_ERROR
 49177  	}
 49178  
 49179  	len = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49180  	pBlob = sqlite3.Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49181  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, pBlob, len))
 49182  	return TCL_OK
 49183  }
 49184  
 49185  // Usage: sqlite3_column_double STMT column
 49186  //
 49187  // Return the data in column 'column' of the current row cast as a double.
 49188  func test_column_double(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5175:26: */
 49189  	bp := tls.Alloc(44)
 49190  	defer tls.Free(44)
 49191  
 49192  	// var pStmt uintptr at bp+32, 8
 49193  
 49194  	// var col int32 at bp+40, 4
 49195  
 49196  	var rVal float64
 49197  
 49198  	if objc != 3 {
 49199  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49200  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49201  		return TCL_ERROR
 49202  	}
 49203  
 49204  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49205  		return TCL_ERROR
 49206  	}
 49207  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49208  		return TCL_ERROR
 49209  	}
 49210  
 49211  	rVal = sqlite3.Xsqlite3_column_double(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49212  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewDoubleObj(tls, rVal))
 49213  	return TCL_OK
 49214  }
 49215  
 49216  // Usage: sqlite3_data_count STMT
 49217  //
 49218  // Return the number of columns returned by the sql statement STMT.
 49219  func test_data_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5204:26: */
 49220  	bp := tls.Alloc(40)
 49221  	defer tls.Free(40)
 49222  
 49223  	// var pStmt uintptr at bp+32, 8
 49224  
 49225  	if objc != 2 {
 49226  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49227  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49228  		return TCL_ERROR
 49229  	}
 49230  
 49231  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49232  		return TCL_ERROR
 49233  	}
 49234  
 49235  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_data_count(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))))
 49236  	return TCL_OK
 49237  }
 49238  
 49239  // Usage: sqlite3_column_text STMT column
 49240  //
 49241  // Usage: sqlite3_column_decltype STMT column
 49242  //
 49243  // Usage: sqlite3_column_name STMT column
 49244  func test_stmt_utf8(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5231:26: */
 49245  	bp := tls.Alloc(44)
 49246  	defer tls.Free(44)
 49247  
 49248  	// var pStmt uintptr at bp+32, 8
 49249  
 49250  	// var col int32 at bp+40, 4
 49251  
 49252  	var xFunc uintptr
 49253  	var zRet uintptr
 49254  
 49255  	xFunc = clientData
 49256  	if objc != 3 {
 49257  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49258  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49259  		return TCL_ERROR
 49260  	}
 49261  
 49262  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49263  		return TCL_ERROR
 49264  	}
 49265  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49266  		return TCL_ERROR
 49267  	}
 49268  	zRet = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&xFunc)))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49269  	if zRet != 0 {
 49270  		tcl.XTcl_SetResult(tls, interp, zRet, uintptr(0))
 49271  	}
 49272  	return TCL_OK
 49273  }
 49274  
 49275  func test_global_recover(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5258:26: */
 49276  	var rc int32
 49277  	if objc != 1 {
 49278  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 49279  		return TCL_ERROR
 49280  	}
 49281  	rc = sqlite3.Xsqlite3_global_recover(tls)
 49282  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 49283  	return TCL_OK
 49284  }
 49285  
 49286  // Usage: sqlite3_column_text STMT column
 49287  //
 49288  // Usage: sqlite3_column_decltype STMT column
 49289  //
 49290  // Usage: sqlite3_column_name STMT column
 49291  func test_stmt_utf16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5283:26: */
 49292  	bp := tls.Alloc(44)
 49293  	defer tls.Free(44)
 49294  
 49295  	// var pStmt uintptr at bp+32, 8
 49296  
 49297  	// var col int32 at bp+40, 4
 49298  
 49299  	var pRet uintptr
 49300  	var zName16 uintptr
 49301  	var xFunc uintptr
 49302  
 49303  	xFunc = clientData
 49304  	if objc != 3 {
 49305  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49306  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49307  		return TCL_ERROR
 49308  	}
 49309  
 49310  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49311  		return TCL_ERROR
 49312  	}
 49313  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49314  		return TCL_ERROR
 49315  	}
 49316  
 49317  	zName16 = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&xFunc)))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))
 49318  	if zName16 != 0 {
 49319  		var n int32
 49320  		var z uintptr = zName16
 49321  		for n = 0; (*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) || (*(*int8)(unsafe.Pointer(z + uintptr((n + 1)))) != 0); n = n + (2) {
 49322  		}
 49323  		pRet = tcl.XTcl_NewByteArrayObj(tls, zName16, (n + 2))
 49324  		tcl.XTcl_SetObjResult(tls, interp, pRet)
 49325  	}
 49326  
 49327  	return TCL_OK
 49328  }
 49329  
 49330  // Usage: sqlite3_column_int STMT column
 49331  //
 49332  // Usage: sqlite3_column_bytes STMT column
 49333  //
 49334  // Usage: sqlite3_column_bytes16 STMT column
 49335  //
 49336  func test_stmt_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5327:26: */
 49337  	bp := tls.Alloc(44)
 49338  	defer tls.Free(44)
 49339  
 49340  	// var pStmt uintptr at bp+32, 8
 49341  
 49342  	// var col int32 at bp+40, 4
 49343  
 49344  	var xFunc uintptr
 49345  
 49346  	xFunc = clientData
 49347  	if objc != 3 {
 49348  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49349  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 49350  		return TCL_ERROR
 49351  	}
 49352  
 49353  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &pStmt */) != 0 {
 49354  		return TCL_ERROR
 49355  	}
 49356  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &col */) != 0 {
 49357  		return TCL_ERROR
 49358  	}
 49359  
 49360  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(&xFunc)))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 40 /* col */)))))
 49361  	return TCL_OK
 49362  }
 49363  
 49364  // Usage:  sqlite_set_magic  DB  MAGIC-NUMBER
 49365  //
 49366  // Set the db->magic value.  This is used to test error recovery logic.
 49367  func sqlite_set_magic(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5356:26: */
 49368  	bp := tls.Alloc(40)
 49369  	defer tls.Free(40)
 49370  
 49371  	// var db uintptr at bp+32, 8
 49372  
 49373  	if argc != 3 {
 49374  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 49375  			ts+18032 /* " DB MAGIC" */, 0))
 49376  		return TCL_ERROR
 49377  	}
 49378  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 49379  		return TCL_ERROR
 49380  	}
 49381  	if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+18042 /* "SQLITE_MAGIC_OPE..." */) == 0 {
 49382  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_OPEN
 49383  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+18060 /* "SQLITE_MAGIC_CLO..." */) == 0 {
 49384  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_CLOSED
 49385  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+18080 /* "SQLITE_MAGIC_BUS..." */) == 0 {
 49386  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_BUSY
 49387  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ts+18098 /* "SQLITE_MAGIC_ERR..." */) == 0 {
 49388  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_ERROR
 49389  	} else if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), (*(*uintptr)(unsafe.Pointer(bp + 32 /* db */))+116 /* &.magic */)) != 0 {
 49390  		return TCL_ERROR
 49391  	}
 49392  	return TCL_OK
 49393  }
 49394  
 49395  // Usage:  sqlite3_interrupt  DB
 49396  //
 49397  // Trigger an interrupt on DB
 49398  func test_interrupt(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5388:26: */
 49399  	bp := tls.Alloc(40)
 49400  	defer tls.Free(40)
 49401  
 49402  	// var db uintptr at bp+32, 8
 49403  
 49404  	if argc != 2 {
 49405  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+15462 /* " DB" */, 0))
 49406  		return TCL_ERROR
 49407  	}
 49408  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 49409  		return TCL_ERROR
 49410  	}
 49411  	sqlite3.Xsqlite3_interrupt(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 49412  	return TCL_OK
 49413  }
 49414  
 49415  // Usage: sqlite_delete_function DB function-name
 49416  //
 49417  // Delete the user function 'function-name' from database handle DB. It
 49418  // is assumed that the user function was created as UTF8, any number of
 49419  // arguments (the way the TCL interface does it).
 49420  func delete_function(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5411:26: */
 49421  	bp := tls.Alloc(40)
 49422  	defer tls.Free(40)
 49423  
 49424  	var rc int32
 49425  	// var db uintptr at bp+32, 8
 49426  
 49427  	if argc != 3 {
 49428  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 49429  			ts+18117 /* " DB function-nam..." */, 0))
 49430  		return TCL_ERROR
 49431  	}
 49432  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 49433  		return TCL_ERROR
 49434  	}
 49435  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), -1, SQLITE_UTF8, uintptr(0), uintptr(0), uintptr(0), uintptr(0))
 49436  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 49437  	return TCL_OK
 49438  }
 49439  
 49440  // Usage: sqlite_delete_collation DB collation-name
 49441  //
 49442  // Delete the collation sequence 'collation-name' from database handle
 49443  // DB. It is assumed that the collation sequence was created as UTF8 (the
 49444  // way the TCL interface does it).
 49445  func delete_collation(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5437:26: */
 49446  	bp := tls.Alloc(40)
 49447  	defer tls.Free(40)
 49448  
 49449  	var rc int32
 49450  	// var db uintptr at bp+32, 8
 49451  
 49452  	if argc != 3 {
 49453  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 49454  			ts+18117 /* " DB function-nam..." */, 0))
 49455  		return TCL_ERROR
 49456  	}
 49457  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+32 /* &db */) != 0 {
 49458  		return TCL_ERROR
 49459  	}
 49460  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*8)), SQLITE_UTF8, uintptr(0), uintptr(0))
 49461  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 49462  	return TCL_OK
 49463  }
 49464  
 49465  // Usage: sqlite3_get_autocommit DB
 49466  //
 49467  // Return true if the database DB is currently in auto-commit mode.
 49468  // Return false if not.
 49469  func get_autocommit(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5462:26: */
 49470  	bp := tls.Alloc(94)
 49471  	defer tls.Free(94)
 49472  
 49473  	// var zBuf [30]int8 at bp+64, 30
 49474  
 49475  	// var db uintptr at bp+56, 8
 49476  
 49477  	if argc != 2 {
 49478  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 49479  			ts+15462 /* " DB" */, 0))
 49480  		return TCL_ERROR
 49481  	}
 49482  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+56 /* &db */) != 0 {
 49483  		return TCL_ERROR
 49484  	}
 49485  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+64 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, sqlite3.Xsqlite3_get_autocommit(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)))))
 49486  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+64 /* &zBuf[0] */, 0))
 49487  	return TCL_OK
 49488  }
 49489  
 49490  // Usage: sqlite3_busy_timeout DB MS
 49491  //
 49492  // Set the busy timeout.  This is more easily done using the timeout
 49493  // method of the TCL interface.  But we need a way to test the case
 49494  // where it returns SQLITE_MISUSE.
 49495  func test_busy_timeout(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5488:26: */
 49496  	bp := tls.Alloc(60)
 49497  	defer tls.Free(60)
 49498  
 49499  	var rc int32
 49500  	// var ms int32 at bp+56, 4
 49501  
 49502  	// var db uintptr at bp+48, 8
 49503  
 49504  	if argc != 3 {
 49505  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 49506  			ts+15462 /* " DB" */, 0))
 49507  		return TCL_ERROR
 49508  	}
 49509  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+48 /* &db */) != 0 {
 49510  		return TCL_ERROR
 49511  	}
 49512  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+56 /* &ms */) != 0 {
 49513  		return TCL_ERROR
 49514  	}
 49515  	rc = sqlite3.Xsqlite3_busy_timeout(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*int32)(unsafe.Pointer(bp + 56 /* ms */)))
 49516  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 49517  	return TCL_OK
 49518  }
 49519  
 49520  // Usage:  tcl_variable_type VARIABLENAME
 49521  //
 49522  // Return the name of the internal representation for the
 49523  // value of the given variable.
 49524  func tcl_variable_type(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5514:26: */
 49525  	var pVar uintptr
 49526  	if objc != 2 {
 49527  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18135 /* "VARIABLE" */)
 49528  		return TCL_ERROR
 49529  	}
 49530  	pVar = tcl.XTcl_GetVar2Ex(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0), TCL_LEAVE_ERR_MSG)
 49531  	if pVar == uintptr(0) {
 49532  		return TCL_ERROR
 49533  	}
 49534  	if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 49535  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname, -1))
 49536  	}
 49537  	return TCL_OK
 49538  }
 49539  
 49540  // Usage:  sqlite3_release_memory ?N?
 49541  //
 49542  // Attempt to release memory currently held but not actually required.
 49543  // The integer N is the number of bytes we are trying to release.  The
 49544  // return value is the amount of memory actually released.
 49545  func test_release_memory(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5540:26: */
 49546  	bp := tls.Alloc(4)
 49547  	defer tls.Free(4)
 49548  
 49549  	// var N int32 at bp, 4
 49550  
 49551  	var amt int32
 49552  	if (objc != 1) && (objc != 2) {
 49553  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 49554  		return TCL_ERROR
 49555  	}
 49556  	if objc == 2 {
 49557  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &N */) != 0 {
 49558  			return TCL_ERROR
 49559  		}
 49560  	} else {
 49561  		*(*int32)(unsafe.Pointer(bp /* N */)) = -1
 49562  	}
 49563  	amt = sqlite3.Xsqlite3_release_memory(tls, *(*int32)(unsafe.Pointer(bp /* N */)))
 49564  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, amt))
 49565  	return TCL_OK
 49566  }
 49567  
 49568  // Usage:  sqlite3_db_release_memory DB
 49569  //
 49570  // Attempt to release memory currently held by database DB.  Return the
 49571  // result code (which in the current implementation is always zero).
 49572  func test_db_release_memory(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5571:26: */
 49573  	bp := tls.Alloc(8)
 49574  	defer tls.Free(8)
 49575  
 49576  	// var db uintptr at bp, 8
 49577  
 49578  	var rc int32
 49579  	if objc != 2 {
 49580  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 49581  		return TCL_ERROR
 49582  	}
 49583  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 49584  		return TCL_ERROR
 49585  	}
 49586  	rc = sqlite3.Xsqlite3_db_release_memory(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 49587  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 49588  	return TCL_OK
 49589  }
 49590  
 49591  // Usage:  sqlite3_db_cacheflush DB
 49592  //
 49593  // Attempt to flush any dirty pages to disk.
 49594  func test_db_cacheflush(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5594:26: */
 49595  	bp := tls.Alloc(8)
 49596  	defer tls.Free(8)
 49597  
 49598  	// var db uintptr at bp, 8
 49599  
 49600  	var rc int32
 49601  	if objc != 2 {
 49602  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 49603  		return TCL_ERROR
 49604  	}
 49605  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 49606  		return TCL_ERROR
 49607  	}
 49608  	rc = sqlite3.Xsqlite3_db_cacheflush(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 49609  	if rc != 0 {
 49610  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, rc), uintptr(0))
 49611  		return TCL_ERROR
 49612  	}
 49613  
 49614  	tcl.XTcl_ResetResult(tls, interp)
 49615  	return TCL_OK
 49616  }
 49617  
 49618  // Usage:  sqlite3_system_errno DB
 49619  //
 49620  // Return the low-level system errno value.
 49621  func test_system_errno(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5622:26: */
 49622  	bp := tls.Alloc(8)
 49623  	defer tls.Free(8)
 49624  
 49625  	// var db uintptr at bp, 8
 49626  
 49627  	var iErrno int32
 49628  	if objc != 2 {
 49629  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 49630  		return TCL_ERROR
 49631  	}
 49632  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 49633  		return TCL_ERROR
 49634  	}
 49635  	iErrno = sqlite3.Xsqlite3_system_errno(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 49636  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iErrno))
 49637  	return TCL_OK
 49638  }
 49639  
 49640  // Usage:  sqlite3_db_filename DB DBNAME
 49641  //
 49642  // Return the name of a file associated with a database.
 49643  func test_db_filename(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5645:26: */
 49644  	bp := tls.Alloc(24)
 49645  	defer tls.Free(24)
 49646  
 49647  	// var db uintptr at bp+16, 8
 49648  
 49649  	var zDbName uintptr
 49650  	if objc != 3 {
 49651  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 49652  		return TCL_ERROR
 49653  	}
 49654  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 49655  		return TCL_ERROR
 49656  	}
 49657  	zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 49658  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_db_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDbName), uintptr(0)))
 49659  	return TCL_OK
 49660  }
 49661  
 49662  // Usage:  sqlite3_db_readonly DB DBNAME
 49663  //
 49664  // Return 1 or 0 if DBNAME is readonly or not.  Return -1 if DBNAME does
 49665  // not exist.
 49666  func test_db_readonly(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5669:26: */
 49667  	bp := tls.Alloc(8)
 49668  	defer tls.Free(8)
 49669  
 49670  	// var db uintptr at bp, 8
 49671  
 49672  	var zDbName uintptr
 49673  	if objc != 3 {
 49674  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 49675  		return TCL_ERROR
 49676  	}
 49677  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 49678  		return TCL_ERROR
 49679  	}
 49680  	zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 49681  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_db_readonly(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbName)))
 49682  	return TCL_OK
 49683  }
 49684  
 49685  // Usage:  sqlite3_soft_heap_limit ?N?
 49686  //
 49687  // Query or set the soft heap limit for the current thread.  The
 49688  // limit is only changed if the N is present.  The previous limit
 49689  // is returned.
 49690  func test_soft_heap_limit(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5694:26: */
 49691  	bp := tls.Alloc(8)
 49692  	defer tls.Free(8)
 49693  
 49694  	var amt sqlite3_int64
 49695  	*(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)) = int64(-1)
 49696  	if (objc != 1) && (objc != 2) {
 49697  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 49698  		return TCL_ERROR
 49699  	}
 49700  	if objc == 2 {
 49701  		if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &N */) != 0 {
 49702  			return TCL_ERROR
 49703  		}
 49704  	}
 49705  	amt = sqlite3.Xsqlite3_soft_heap_limit64(tls, *(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)))
 49706  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, amt))
 49707  	return TCL_OK
 49708  }
 49709  
 49710  // Usage:  sqlite3_hard_heap_limit ?N?
 49711  //
 49712  // Query or set the hard heap limit for the current thread.  The
 49713  // limit is only changed if the N is present.  The previous limit
 49714  // is returned.
 49715  func test_hard_heap_limit(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5721:26: */
 49716  	bp := tls.Alloc(8)
 49717  	defer tls.Free(8)
 49718  
 49719  	var amt sqlite3_int64
 49720  	*(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)) = int64(-1)
 49721  	if (objc != 1) && (objc != 2) {
 49722  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 49723  		return TCL_ERROR
 49724  	}
 49725  	if objc == 2 {
 49726  		if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &N */) != 0 {
 49727  			return TCL_ERROR
 49728  		}
 49729  	}
 49730  	amt = sqlite3.Xsqlite3_hard_heap_limit64(tls, *(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)))
 49731  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, amt))
 49732  	return TCL_OK
 49733  }
 49734  
 49735  // Usage:   sqlite3_thread_cleanup
 49736  //
 49737  // Call the sqlite3_thread_cleanup API.
 49738  func test_thread_cleanup(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5746:26: */
 49739  	sqlite3.Xsqlite3_thread_cleanup(tls)
 49740  	return TCL_OK
 49741  }
 49742  
 49743  // Usage:   sqlite3_pager_refcounts  DB
 49744  //
 49745  // Return a list of numbers which are the PagerRefcount for all
 49746  // pagers on each database connection.
 49747  func test_pager_refcounts(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5764:26: */
 49748  	bp := tls.Alloc(40)
 49749  	defer tls.Free(40)
 49750  
 49751  	// var db uintptr at bp+32, 8
 49752  
 49753  	var i int32
 49754  	var v int32
 49755  	var a uintptr
 49756  	var pResult uintptr
 49757  
 49758  	if objc != 2 {
 49759  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49760  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 49761  		return TCL_ERROR
 49762  	}
 49763  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 49764  		return TCL_ERROR
 49765  	}
 49766  	pResult = tcl.XTcl_NewObj(tls)
 49767  	for i = 0; i < (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FnDb; i++ {
 49768  		if (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FaDb+uintptr(i)*32)).FpBt == uintptr(0) {
 49769  			v = -1
 49770  		} else {
 49771  			sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 49772  			a = sqlite3.Xsqlite3PagerStats(tls, sqlite3.Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FaDb+uintptr(i)*32)).FpBt))
 49773  			v = *(*int32)(unsafe.Pointer(a))
 49774  			sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 49775  		}
 49776  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, v))
 49777  	}
 49778  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 49779  	return TCL_OK
 49780  }
 49781  
 49782  // tclcmd:   working_64bit_int
 49783  //
 49784  // Some TCL builds (ex: cygwin) do not support 64-bit integers.  This
 49785  // leads to a number of test failures.  The present command checks the
 49786  // TCL build to see whether or not it supports 64-bit integers.  It
 49787  // returns TRUE if it does and FALSE if not.
 49788  //
 49789  // This command is used to warn users that their TCL build is defective
 49790  // and that the errors they are seeing in the test scripts might be
 49791  // a result of their defective TCL rather than problems in SQLite.
 49792  func working_64bit_int(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5810:26: */
 49793  	var pTestObj uintptr
 49794  	var working int32 = 0
 49795  
 49796  	pTestObj = tcl.XTcl_NewWideIntObj(tls, (int64(1000000) * int64(1234567890)))
 49797  	working = (libc.Bool32(libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, pTestObj), ts+18148 /* "1234567890000000" */) == 0))
 49798  	for ok := true; ok; ok = 0 != 0 {
 49799  		var _objPtr uintptr = pTestObj
 49800  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 49801  			tcl.XTclFreeObj(tls, _objPtr)
 49802  		}
 49803  	}
 49804  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((working) != 0))))
 49805  	return TCL_OK
 49806  }
 49807  
 49808  // tclcmd:   vfs_unlink_test
 49809  //
 49810  // This TCL command unregisters the primary VFS and then registers
 49811  // it back again.  This is used to test the ability to register a
 49812  // VFS when none are previously registered, and the ability to
 49813  // unregister the only available VFS.  Ticket #2738
 49814  func vfs_unlink_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5835:26: */
 49815  	bp := tls.Alloc(496)
 49816  	defer tls.Free(496)
 49817  
 49818  	var i int32
 49819  	var pMain uintptr
 49820  	// var apVfs [20]uintptr at bp+336, 160
 49821  
 49822  	// var one sqlite3_vfs at bp, 168
 49823  
 49824  	// var two sqlite3_vfs at bp+168, 168
 49825  
 49826  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(0))                        // Unregister of NULL is harmless
 49827  	(*sqlite3_vfs)(unsafe.Pointer(bp /* &one */)).FzName = ts + 18165       /* "__one" */
 49828  	(*sqlite3_vfs)(unsafe.Pointer(bp + 168 /* &two */)).FzName = ts + 18171 /* "__two" */
 49829  
 49830  	// Calling sqlite3_vfs_register with 2nd argument of 0 does not
 49831  	// change the default VFS
 49832  	pMain = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 49833  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 0)
 49834  
 49835  	sqlite3.Xsqlite3_vfs_register(tls, bp+168 /* &two */, 0)
 49836  
 49837  	// We can find a VFS by its name
 49838  
 49839  	// Calling sqlite_vfs_register with non-zero second parameter changes the
 49840  	// default VFS, even if the 1st parameter is an existig VFS that is
 49841  	// previously registered as the non-default.
 49842  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 1)
 49843  
 49844  	sqlite3.Xsqlite3_vfs_register(tls, bp+168 /* &two */, 1)
 49845  
 49846  	if pMain != 0 {
 49847  		sqlite3.Xsqlite3_vfs_register(tls, pMain, 1)
 49848  
 49849  	}
 49850  
 49851  	// Unlink the default VFS.  Repeat until there are no more VFSes
 49852  	// registered.
 49853  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof([20]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))); i++ {
 49854  		*(*uintptr)(unsafe.Pointer(bp + 336 /* &apVfs[0] */ + uintptr(i)*8)) = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 49855  		if *(*uintptr)(unsafe.Pointer(bp + 336 /* &apVfs[0] */ + uintptr(i)*8)) != 0 {
 49856  
 49857  			sqlite3.Xsqlite3_vfs_unregister(tls, *(*uintptr)(unsafe.Pointer(bp + 336 /* &apVfs[0] */ + uintptr(i)*8)))
 49858  
 49859  		}
 49860  	}
 49861  
 49862  	// Register the main VFS as non-default (will be made default, since
 49863  	// it'll be the only one in existence).
 49864  	sqlite3.Xsqlite3_vfs_register(tls, pMain, 0)
 49865  
 49866  	// Un-register the main VFS again to restore an empty VFS list
 49867  	sqlite3.Xsqlite3_vfs_unregister(tls, pMain)
 49868  
 49869  	/* Relink all VFSes in reverse order. */
 49870  	for i = (int32((uint64(unsafe.Sizeof([20]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0)))) - uint64(1))); i >= 0; i-- {
 49871  		if *(*uintptr)(unsafe.Pointer(bp + 336 /* &apVfs[0] */ + uintptr(i)*8)) != 0 {
 49872  			sqlite3.Xsqlite3_vfs_register(tls, *(*uintptr)(unsafe.Pointer(bp + 336 /* &apVfs[0] */ + uintptr(i)*8)), 1)
 49873  
 49874  		}
 49875  	}
 49876  
 49877  	// Unregister out sample VFSes.
 49878  	sqlite3.Xsqlite3_vfs_unregister(tls, bp /* &one */)
 49879  	sqlite3.Xsqlite3_vfs_unregister(tls, bp+168 /* &two */)
 49880  
 49881  	// Unregistering a VFS that is not currently registered is harmless
 49882  	sqlite3.Xsqlite3_vfs_unregister(tls, bp /* &one */)
 49883  	sqlite3.Xsqlite3_vfs_unregister(tls, bp+168 /* &two */)
 49884  
 49885  	// We should be left with the original default VFS back as the
 49886  	// original
 49887  
 49888  	return TCL_OK
 49889  }
 49890  
 49891  // tclcmd:   vfs_initfail_test
 49892  //
 49893  // This TCL command attempts to vfs_find and vfs_register when the
 49894  // sqlite3_initialize() interface is failing.  All calls should fail.
 49895  func vfs_initfail_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5937:26: */
 49896  	bp := tls.Alloc(168)
 49897  	defer tls.Free(168)
 49898  
 49899  	// var one sqlite3_vfs at bp, 168
 49900  
 49901  	(*sqlite3_vfs)(unsafe.Pointer(bp /* &one */)).FzName = ts + 18165 /* "__one" */
 49902  
 49903  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 49904  		return TCL_ERROR
 49905  	}
 49906  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 0)
 49907  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 49908  		return TCL_ERROR
 49909  	}
 49910  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 1)
 49911  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 49912  		return TCL_ERROR
 49913  	}
 49914  	return TCL_OK
 49915  }
 49916  
 49917  // Saved VFSes
 49918  var apVfs [20]uintptr /* test1.c:5957:20: */
 49919  var nVfs int32 = 0    /* test1.c:5958:12 */
 49920  
 49921  // tclcmd:   vfs_unregister_all
 49922  //
 49923  // Unregister all VFSes.
 49924  func vfs_unregister_all(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5965:26: */
 49925  	var i int32
 49926  	for i = 0; i < (int32(uint64(unsafe.Sizeof(apVfs)) / uint64(unsafe.Sizeof(uintptr(0))))); i++ {
 49927  		apVfs[i] = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 49928  		if apVfs[i] == uintptr(0) {
 49929  			break
 49930  		}
 49931  		sqlite3.Xsqlite3_vfs_unregister(tls, apVfs[i])
 49932  	}
 49933  	nVfs = i
 49934  	return TCL_OK
 49935  }
 49936  
 49937  // tclcmd:   vfs_reregister_all
 49938  //
 49939  // Restore all VFSes that were removed using vfs_unregister_all. Taking
 49940  // care to put the linked list back together in the same order as it was
 49941  // in before vfs_unregister_all was invoked.
 49942  func vfs_reregister_all(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5987:26: */
 49943  	var i int32
 49944  	for i = (nVfs - 1); i >= 0; i-- {
 49945  		sqlite3.Xsqlite3_vfs_register(tls, apVfs[i], 1)
 49946  	}
 49947  	return TCL_OK
 49948  }
 49949  
 49950  // tclcmd:   file_control_test DB
 49951  //
 49952  // This TCL command runs the sqlite3_file_control interface and
 49953  // verifies correct operation of the same.
 49954  func file_control_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6007:26: */
 49955  	bp := tls.Alloc(44)
 49956  	defer tls.Free(44)
 49957  
 49958  	*(*int32)(unsafe.Pointer(bp + 40 /* iArg */)) = 0
 49959  	// var db uintptr at bp+32, 8
 49960  
 49961  	var rc int32
 49962  	_ = rc
 49963  
 49964  	if objc != 2 {
 49965  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49966  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 49967  		return TCL_ERROR
 49968  	}
 49969  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 49970  		return TCL_ERROR
 49971  	}
 49972  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), uintptr(0), 0, bp+40 /* &iArg */)
 49973  
 49974  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+18177 /* "notadatabase" */, SQLITE_FCNTL_LOCKSTATE, bp+40 /* &iArg */)
 49975  
 49976  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+85 /* "main" */, -1, bp+40 /* &iArg */)
 49977  
 49978  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+8377 /* "temp" */, -1, bp+40 /* &iArg */)
 49979  
 49980  	return TCL_OK
 49981  }
 49982  
 49983  // tclcmd:   file_control_lasterrno_test DB
 49984  //
 49985  // This TCL command runs the sqlite3_file_control interface and
 49986  // verifies correct operation of the SQLITE_LAST_ERRNO verb.
 49987  func file_control_lasterrno_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6042:26: */
 49988  	bp := tls.Alloc(76)
 49989  	defer tls.Free(76)
 49990  
 49991  	*(*int32)(unsafe.Pointer(bp + 72 /* iArg */)) = 0
 49992  	// var db uintptr at bp+64, 8
 49993  
 49994  	var rc int32
 49995  
 49996  	if objc != 2 {
 49997  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49998  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 49999  		return TCL_ERROR
 50000  	}
 50001  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &db */) != 0 {
 50002  		return TCL_ERROR
 50003  	}
 50004  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_LAST_ERRNO, bp+72 /* &iArg */)
 50005  	if rc != 0 {
 50006  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 50007  		return TCL_ERROR
 50008  	}
 50009  	if *(*int32)(unsafe.Pointer(bp + 72 /* iArg */)) != 0 {
 50010  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+18190, /* "Unexpected non-z..." */
 50011  			tcl.XTcl_GetStringFromObj(tls, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 72 /* iArg */))), uintptr(0)), ts+4755 /* " " */, 0))
 50012  		return TCL_ERROR
 50013  	}
 50014  	return TCL_OK
 50015  }
 50016  
 50017  // tclcmd:   file_control_data_version DB DBNAME
 50018  //
 50019  // This TCL command runs the sqlite3_file_control with the
 50020  // SQLITE_FCNTL_DATA_VERSION opcode, returning the result.
 50021  func file_control_data_version(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6079:26: */
 50022  	bp := tls.Alloc(120)
 50023  	defer tls.Free(120)
 50024  
 50025  	// var iVers uint32 at bp+16, 4
 50026  	// data version
 50027  	var zDb uintptr // Db name ("main", "temp" etc.)
 50028  	// var db uintptr at bp+8, 8
 50029  	// Database handle
 50030  	var rc int32 // file_control() return code
 50031  	// var zBuf [100]int8 at bp+20, 100
 50032  
 50033  	if (objc != 3) && (objc != 2) {
 50034  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18218 /* "DB [DBNAME]" */)
 50035  		return TCL_ERROR
 50036  	}
 50037  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+8 /* &db */) != 0 {
 50038  		return TCL_ERROR
 50039  	}
 50040  	if objc == 3 {
 50041  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50042  	} else {
 50043  		zDb = uintptr(0)
 50044  	}
 50045  
 50046  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), zDb, SQLITE_FCNTL_DATA_VERSION, bp+16 /* &iVers */)
 50047  	if rc != 0 {
 50048  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50049  		return TCL_ERROR
 50050  	} else {
 50051  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+20 /* &zBuf[0] */, ts+18230 /* "%u" */, libc.VaList(bp, *(*uint32)(unsafe.Pointer(bp + 16 /* iVers */))))
 50052  		tcl.XTcl_SetResult(tls, interp, bp+20 /* zBuf */, uintptr(1))
 50053  		return TCL_OK
 50054  	}
 50055  	return int32(0)
 50056  }
 50057  
 50058  // tclcmd:   file_control_chunksize_test DB DBNAME SIZE
 50059  //
 50060  // This TCL command runs the sqlite3_file_control interface and
 50061  // verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and
 50062  // SQLITE_SET_LOCKPROXYFILE verbs.
 50063  func file_control_chunksize_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6118:26: */
 50064  	bp := tls.Alloc(12)
 50065  	defer tls.Free(12)
 50066  
 50067  	// var nSize int32 at bp+8, 4
 50068  	// New chunk size
 50069  	var zDb uintptr // Db name ("main", "temp" etc.)
 50070  	// var db uintptr at bp, 8
 50071  	// Database handle
 50072  	var rc int32 // file_control() return code
 50073  
 50074  	if objc != 4 {
 50075  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18233 /* "DB DBNAME SIZE" */)
 50076  		return TCL_ERROR
 50077  	}
 50078  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) ||
 50079  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+8 /* &nSize */) != 0) {
 50080  		return TCL_ERROR
 50081  	}
 50082  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50083  	if int32(*(*int8)(unsafe.Pointer(zDb))) == 0 {
 50084  		zDb = uintptr(0)
 50085  	}
 50086  
 50087  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb, SQLITE_FCNTL_CHUNK_SIZE, bp+8 /* &nSize */)
 50088  	if rc != 0 {
 50089  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50090  		return TCL_ERROR
 50091  	}
 50092  	return TCL_OK
 50093  }
 50094  
 50095  // tclcmd:   file_control_sizehint_test DB DBNAME SIZE
 50096  //
 50097  // This TCL command runs the sqlite3_file_control interface
 50098  // with SQLITE_FCNTL_SIZE_HINT
 50099  func file_control_sizehint_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6155:26: */
 50100  	bp := tls.Alloc(16)
 50101  	defer tls.Free(16)
 50102  
 50103  	// var nSize Tcl_WideInt at bp+8, 8
 50104  	// Hinted size
 50105  	var zDb uintptr // Db name ("main", "temp" etc.)
 50106  	// var db uintptr at bp, 8
 50107  	// Database handle
 50108  	var rc int32 // file_control() return code
 50109  
 50110  	if objc != 4 {
 50111  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18233 /* "DB DBNAME SIZE" */)
 50112  		return TCL_ERROR
 50113  	}
 50114  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) ||
 50115  		(tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+8 /* &nSize */) != 0) {
 50116  		return TCL_ERROR
 50117  	}
 50118  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50119  	if int32(*(*int8)(unsafe.Pointer(zDb))) == 0 {
 50120  		zDb = uintptr(0)
 50121  	}
 50122  
 50123  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb, SQLITE_FCNTL_SIZE_HINT, bp+8 /* &nSize */)
 50124  	if rc != 0 {
 50125  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50126  		return TCL_ERROR
 50127  	}
 50128  	return TCL_OK
 50129  }
 50130  
 50131  // tclcmd:   file_control_lockproxy_test DB PWD
 50132  //
 50133  // This TCL command runs the sqlite3_file_control interface and
 50134  // verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and
 50135  // SQLITE_SET_LOCKPROXYFILE verbs.
 50136  func file_control_lockproxy_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6193:26: */
 50137  	bp := tls.Alloc(40)
 50138  	defer tls.Free(40)
 50139  
 50140  	// var db uintptr at bp+32, 8
 50141  
 50142  	if objc != 3 {
 50143  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50144  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18248 /* " DB PWD" */, 0))
 50145  		return TCL_ERROR
 50146  	}
 50147  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 50148  		return TCL_ERROR
 50149  	}
 50150  
 50151  	return TCL_OK
 50152  }
 50153  
 50154  // tclcmd:   file_control_persist_wal DB PERSIST-FLAG
 50155  //
 50156  // This TCL command runs the sqlite3_file_control interface with
 50157  // the SQLITE_FCNTL_PERSIST_WAL opcode.
 50158  func file_control_persist_wal(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6364:26: */
 50159  	bp := tls.Alloc(176)
 50160  	defer tls.Free(176)
 50161  
 50162  	// var db uintptr at bp+64, 8
 50163  
 50164  	var rc int32
 50165  	// var bPersist int32 at bp+72, 4
 50166  
 50167  	// var z [100]int8 at bp+76, 100
 50168  
 50169  	if objc != 3 {
 50170  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50171  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18256 /* " DB FLAG" */, 0))
 50172  		return TCL_ERROR
 50173  	}
 50174  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &db */) != 0 {
 50175  		return TCL_ERROR
 50176  	}
 50177  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+72 /* &bPersist */) != 0 {
 50178  		return TCL_ERROR
 50179  	}
 50180  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_PERSIST_WAL, bp+72 /* &bPersist */)
 50181  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+76 /* &z[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp+32, rc, *(*int32)(unsafe.Pointer(bp + 72 /* bPersist */))))
 50182  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+76 /* &z[0] */, uintptr(0)))
 50183  	return TCL_OK
 50184  }
 50185  
 50186  // tclcmd:   file_control_powersafe_overwrite DB PSOW-FLAG
 50187  //
 50188  // This TCL command runs the sqlite3_file_control interface with
 50189  // the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode.
 50190  func file_control_powersafe_overwrite(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6396:26: */
 50191  	bp := tls.Alloc(176)
 50192  	defer tls.Free(176)
 50193  
 50194  	// var db uintptr at bp+64, 8
 50195  
 50196  	var rc int32
 50197  	// var b int32 at bp+72, 4
 50198  
 50199  	// var z [100]int8 at bp+76, 100
 50200  
 50201  	if objc != 3 {
 50202  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50203  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18256 /* " DB FLAG" */, 0))
 50204  		return TCL_ERROR
 50205  	}
 50206  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &db */) != 0 {
 50207  		return TCL_ERROR
 50208  	}
 50209  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+72 /* &b */) != 0 {
 50210  		return TCL_ERROR
 50211  	}
 50212  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_POWERSAFE_OVERWRITE, bp+72 /* &b */)
 50213  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+76 /* &z[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp+32, rc, *(*int32)(unsafe.Pointer(bp + 72 /* b */))))
 50214  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+76 /* &z[0] */, uintptr(0)))
 50215  	return TCL_OK
 50216  }
 50217  
 50218  // tclcmd:   file_control_vfsname DB ?AUXDB?
 50219  //
 50220  // Return a string that describes the stack of VFSes.
 50221  func file_control_vfsname(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6428:26: */
 50222  	bp := tls.Alloc(64)
 50223  	defer tls.Free(64)
 50224  
 50225  	// var db uintptr at bp+48, 8
 50226  
 50227  	var zDbName uintptr = ts + 85 /* "main" */
 50228  	*(*uintptr)(unsafe.Pointer(bp + 56 /* zVfsName */)) = uintptr(0)
 50229  
 50230  	if (objc != 2) && (objc != 3) {
 50231  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50232  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 50233  		return TCL_ERROR
 50234  	}
 50235  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 50236  		return TCL_ERROR
 50237  	}
 50238  	if objc == 3 {
 50239  		zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50240  	}
 50241  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zDbName, SQLITE_FCNTL_VFSNAME, bp+56 /* &zVfsName */)
 50242  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zVfsName */)), uintptr(0)))
 50243  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zVfsName */)))
 50244  	return TCL_OK
 50245  }
 50246  
 50247  // tclcmd:   file_control_reservebytes DB N
 50248  func file_control_reservebytes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6458:26: */
 50249  	bp := tls.Alloc(12)
 50250  	defer tls.Free(12)
 50251  
 50252  	// var db uintptr at bp, 8
 50253  
 50254  	var zDbName uintptr = ts + 85 /* "main" */
 50255  	*(*int32)(unsafe.Pointer(bp + 8 /* n */)) = 0
 50256  	var rc int32
 50257  
 50258  	if objc != 3 {
 50259  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18283 /* "DB N" */)
 50260  		return TCL_ERROR
 50261  	}
 50262  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) ||
 50263  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &n */) != 0) {
 50264  		return TCL_ERROR
 50265  	}
 50266  
 50267  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbName, SQLITE_FCNTL_RESERVE_BYTES, bp+8 /* &n */)
 50268  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 50269  	return TCL_OK
 50270  }
 50271  
 50272  // tclcmd:   file_control_tempfilename DB ?AUXDB?
 50273  //
 50274  // Return a string that is a temporary filename
 50275  func file_control_tempfilename(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6490:26: */
 50276  	bp := tls.Alloc(64)
 50277  	defer tls.Free(64)
 50278  
 50279  	// var db uintptr at bp+48, 8
 50280  
 50281  	var zDbName uintptr = ts + 85 /* "main" */
 50282  	*(*uintptr)(unsafe.Pointer(bp + 56 /* zTName */)) = uintptr(0)
 50283  
 50284  	if (objc != 2) && (objc != 3) {
 50285  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50286  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 50287  		return TCL_ERROR
 50288  	}
 50289  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &db */) != 0 {
 50290  		return TCL_ERROR
 50291  	}
 50292  	if objc == 3 {
 50293  		zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50294  	}
 50295  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zDbName, SQLITE_FCNTL_TEMPFILENAME, bp+56 /* &zTName */)
 50296  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 56 /* zTName */)), uintptr(0)))
 50297  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* zTName */)))
 50298  	return TCL_OK
 50299  }
 50300  
 50301  // tclcmd:   file_control_external_reader DB ?AUXDB?
 50302  //
 50303  // Return a string that is a temporary filename
 50304  func file_control_external_reader(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6522:26: */
 50305  	bp := tls.Alloc(44)
 50306  	defer tls.Free(44)
 50307  
 50308  	// var db uintptr at bp+32, 8
 50309  
 50310  	var zName uintptr = ts + 85 /* "main" */
 50311  	*(*int32)(unsafe.Pointer(bp + 40 /* iRes */)) = 0
 50312  	var rc int32 = SQLITE_OK
 50313  
 50314  	if (objc != 2) && (objc != 3) {
 50315  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50316  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 50317  		return TCL_ERROR
 50318  	}
 50319  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 50320  		return TCL_ERROR
 50321  	}
 50322  	if objc == 3 {
 50323  		zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50324  	}
 50325  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zName, SQLITE_FCNTL_EXTERNAL_READER, bp+40 /* &iRes */)
 50326  	if rc != SQLITE_OK {
 50327  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50328  		return TCL_ERROR
 50329  	}
 50330  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 40 /* iRes */))))
 50331  	return TCL_OK
 50332  }
 50333  
 50334  // tclcmd:   sqlite3_vfs_list
 50335  //
 50336  //   Return a tcl list containing the names of all registered vfs's.
 50337  func vfs_list(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6559:26: */
 50338  	var pVfs uintptr
 50339  	var pRet uintptr = tcl.XTcl_NewObj(tls)
 50340  	if objc != 1 {
 50341  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 50342  		return TCL_ERROR
 50343  	}
 50344  	for pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)); pVfs != 0; pVfs = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext {
 50345  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, -1))
 50346  	}
 50347  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 50348  	return TCL_OK
 50349  }
 50350  
 50351  // tclcmd:   sqlite3_limit DB ID VALUE
 50352  //
 50353  // This TCL command runs the sqlite3_limit interface and
 50354  // verifies correct operation of the same.
 50355  func test_limit(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6584:26: */
 50356  	bp := tls.Alloc(68)
 50357  	defer tls.Free(68)
 50358  
 50359  	// var db uintptr at bp+56, 8
 50360  
 50361  	var rc int32
 50362  	var i int32
 50363  	var id int32 = 0
 50364  	// var val int32 at bp+64, 4
 50365  
 50366  	var zId uintptr
 50367  
 50368  	if objc != 4 {
 50369  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50370  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18288 /* " DB ID VALUE" */, 0))
 50371  		return TCL_ERROR
 50372  	}
 50373  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+56 /* &db */) != 0 {
 50374  		return TCL_ERROR
 50375  	}
 50376  	zId = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50377  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aId)) / uint64(unsafe.Sizeof(struct {
 50378  		FzName uintptr
 50379  		Fid    int32
 50380  		_      [4]byte
 50381  	}{}))); i++ {
 50382  		if libc.Xstrcmp(tls, zId, aId[i].FzName) == 0 {
 50383  			id = aId[i].Fid
 50384  			break
 50385  		}
 50386  	}
 50387  	if uint64(i) >= (uint64(unsafe.Sizeof(aId)) / uint64(unsafe.Sizeof(struct {
 50388  		FzName uintptr
 50389  		Fid    int32
 50390  		_      [4]byte
 50391  	}{}))) {
 50392  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+18301 /* "unknown limit ty..." */, zId, uintptr(0)))
 50393  		return TCL_ERROR
 50394  	}
 50395  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+64 /* &val */) != 0 {
 50396  		return TCL_ERROR
 50397  	}
 50398  	rc = sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), id, *(*int32)(unsafe.Pointer(bp + 64 /* val */)))
 50399  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 50400  	return TCL_OK
 50401  }
 50402  
 50403  var aId = [14]struct {
 50404  	FzName uintptr
 50405  	Fid    int32
 50406  	_      [4]byte
 50407  }{
 50408  	{FzName: ts + 18322 /* "SQLITE_LIMIT_LEN..." */},
 50409  	{FzName: ts + 18342 /* "SQLITE_LIMIT_SQL..." */, Fid: SQLITE_LIMIT_SQL_LENGTH},
 50410  	{FzName: ts + 18366 /* "SQLITE_LIMIT_COL..." */, Fid: SQLITE_LIMIT_COLUMN},
 50411  	{FzName: ts + 18386 /* "SQLITE_LIMIT_EXP..." */, Fid: SQLITE_LIMIT_EXPR_DEPTH},
 50412  	{FzName: ts + 18410 /* "SQLITE_LIMIT_COM..." */, Fid: SQLITE_LIMIT_COMPOUND_SELECT},
 50413  	{FzName: ts + 18439 /* "SQLITE_LIMIT_VDB..." */, Fid: SQLITE_LIMIT_VDBE_OP},
 50414  	{FzName: ts + 18460 /* "SQLITE_LIMIT_FUN..." */, Fid: SQLITE_LIMIT_FUNCTION_ARG},
 50415  	{FzName: ts + 18486 /* "SQLITE_LIMIT_ATT..." */, Fid: SQLITE_LIMIT_ATTACHED},
 50416  	{FzName: ts + 18508 /* "SQLITE_LIMIT_LIK..." */, Fid: SQLITE_LIMIT_LIKE_PATTERN_LENGTH},
 50417  	{FzName: ts + 18541 /* "SQLITE_LIMIT_VAR..." */, Fid: SQLITE_LIMIT_VARIABLE_NUMBER},
 50418  	{FzName: ts + 18570 /* "SQLITE_LIMIT_TRI..." */, Fid: SQLITE_LIMIT_TRIGGER_DEPTH},
 50419  	{FzName: ts + 18597 /* "SQLITE_LIMIT_WOR..." */, Fid: SQLITE_LIMIT_WORKER_THREADS},
 50420  
 50421  	// Out of range test cases
 50422  	{FzName: ts + 18625 /* "SQLITE_LIMIT_TOO..." */, Fid: -1},
 50423  	{FzName: ts + 18647 /* "SQLITE_LIMIT_TOO..." */, Fid: (SQLITE_LIMIT_WORKER_THREADS + 1)},
 50424  } /* test1.c:6595:5 */
 50425  
 50426  // tclcmd:  save_prng_state
 50427  //
 50428  // Save the state of the pseudo-random number generator.
 50429  // At the same time, verify that sqlite3_test_control works even when
 50430  // called with an out-of-range opcode.
 50431  func save_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6647:26: */
 50432  	var rc int32 = sqlite3.Xsqlite3_test_control(tls, 9999, 0)
 50433  	_ = rc
 50434  
 50435  	rc = sqlite3.Xsqlite3_test_control(tls, -1, 0)
 50436  
 50437  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_SAVE, 0)
 50438  	return TCL_OK
 50439  }
 50440  
 50441  // tclcmd:  restore_prng_state
 50442  func restore_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6663:26: */
 50443  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_RESTORE, 0)
 50444  	return TCL_OK
 50445  }
 50446  
 50447  // tclcmd:  reset_prng_state
 50448  func reset_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6675:26: */
 50449  	sqlite3.Xsqlite3_randomness(tls, 0, uintptr(0))
 50450  	return TCL_OK
 50451  }
 50452  
 50453  // tclcmd:  prng_seed INT ?DB?
 50454  //
 50455  // Set up the SQLITE_TESTCTRL_PRNG_SEED pragma with parameter INT and DB.
 50456  // INT is an integer.  DB is a database connection, or a NULL pointer if
 50457  // omitted.
 50458  //
 50459  // When INT!=0 and DB!=0, set the PRNG seed to the value of the schema
 50460  // cookie for DB, or to INT if the schema cookie happens to be zero.
 50461  //
 50462  // When INT!=0 and DB==0, set the PRNG seed to just INT.
 50463  //
 50464  // If INT==0 and DB==0 then use the default procedure of calling the
 50465  // xRandomness method on the default VFS to get the PRNG seed.
 50466  func prng_seed(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6699:26: */
 50467  	bp := tls.Alloc(32)
 50468  	defer tls.Free(32)
 50469  
 50470  	*(*int32)(unsafe.Pointer(bp + 16 /* i */)) = 0
 50471  	*(*uintptr)(unsafe.Pointer(bp + 24 /* db */)) = uintptr(0)
 50472  	if (objc != 2) && (objc != 3) {
 50473  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18667 /* "SEED ?DB?" */)
 50474  		return TCL_ERROR
 50475  	}
 50476  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &i */) != 0 {
 50477  		return TCL_ERROR
 50478  	}
 50479  	if (objc == 3) && (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+24 /* &db */) != 0) {
 50480  		return TCL_ERROR
 50481  	}
 50482  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_SEED, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 16 /* i */)), *(*uintptr)(unsafe.Pointer(bp + 24 /* db */))))
 50483  	return TCL_OK
 50484  }
 50485  
 50486  // tclcmd:  extra_schema_checks BOOLEAN
 50487  //
 50488  // Enable or disable schema checks when parsing the sqlite_schema file.
 50489  // This is always enabled in production, but it is sometimes useful to
 50490  // disable the checks in order to make some internal error states reachable
 50491  // for testing.
 50492  func extra_schema_checks(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6727:26: */
 50493  	bp := tls.Alloc(12)
 50494  	defer tls.Free(12)
 50495  
 50496  	*(*int32)(unsafe.Pointer(bp + 8 /* i */)) = 0
 50497  	if objc != 2 {
 50498  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 50499  		return TCL_ERROR
 50500  	}
 50501  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &i */) != 0 {
 50502  		return TCL_ERROR
 50503  	}
 50504  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* i */))))
 50505  	return TCL_OK
 50506  }
 50507  
 50508  // tclcmd:  database_may_be_corrupt
 50509  //
 50510  // Indicate that database files might be corrupt. In other words, set the normal
 50511  // state of operation.
 50512  func database_may_be_corrupt(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6749:26: */
 50513  	bp := tls.Alloc(8)
 50514  	defer tls.Free(8)
 50515  
 50516  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_NEVER_CORRUPT, libc.VaList(bp, 0))
 50517  	return TCL_OK
 50518  }
 50519  
 50520  // tclcmd:  database_never_corrupt
 50521  //
 50522  // Indicate that database files are always well-formed. This enables
 50523  // extra assert() statements that test conditions that are always true
 50524  // for well-formed databases.
 50525  func database_never_corrupt(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6765:26: */
 50526  	bp := tls.Alloc(8)
 50527  	defer tls.Free(8)
 50528  
 50529  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_NEVER_CORRUPT, libc.VaList(bp, 1))
 50530  	return TCL_OK
 50531  }
 50532  
 50533  // tclcmd:  pcache_stats
 50534  func test_pcache_stats(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6778:26: */
 50535  	bp := tls.Alloc(16)
 50536  	defer tls.Free(16)
 50537  
 50538  	// var nMin int32 at bp+8, 4
 50539  
 50540  	// var nMax int32 at bp+4, 4
 50541  
 50542  	// var nCurrent int32 at bp, 4
 50543  
 50544  	// var nRecyclable int32 at bp+12, 4
 50545  
 50546  	var pRet uintptr
 50547  
 50548  	sqlite3.Xsqlite3PcacheStats(tls, bp /* &nCurrent */, bp+4 /* &nMax */, bp+8 /* &nMin */, bp+12 /* &nRecyclable */)
 50549  
 50550  	pRet = tcl.XTcl_NewObj(tls)
 50551  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18685 /* "current" */, -1))
 50552  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp /* nCurrent */))))
 50553  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18693 /* "max" */, -1))
 50554  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* nMax */))))
 50555  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18697 /* "min" */, -1))
 50556  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 8 /* nMin */))))
 50557  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18701 /* "recyclable" */, -1))
 50558  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* nRecyclable */))))
 50559  
 50560  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 50561  
 50562  	return TCL_OK
 50563  }
 50564  
 50565  func test_unlock_notify_cb(tls *libc.TLS, aArg uintptr, nArg int32) { /* test1.c:6808:13: */
 50566  	var ii int32
 50567  	for ii = 0; ii < nArg; ii++ {
 50568  		tcl.XTcl_EvalEx(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(ii)*8)), ts+14153 /* "unlock_notify" */, -1, TCL_EVAL_GLOBAL)
 50569  	}
 50570  }
 50571  
 50572  // tclcmd:  sqlite3_unlock_notify db
 50573  func test_unlock_notify(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6820:26: */
 50574  	bp := tls.Alloc(8)
 50575  	defer tls.Free(8)
 50576  
 50577  	// var db uintptr at bp, 8
 50578  
 50579  	var rc int32
 50580  
 50581  	if objc != 2 {
 50582  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 50583  		return TCL_ERROR
 50584  	}
 50585  
 50586  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 50587  		return TCL_ERROR
 50588  	}
 50589  	rc = sqlite3.Xsqlite3_unlock_notify(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 50590  		f func(*libc.TLS, uintptr, int32)
 50591  	}{test_unlock_notify_cb})), interp)
 50592  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50593  	return TCL_OK
 50594  }
 50595  
 50596  // tclcmd:  sqlite3_wal_checkpoint db ?NAME?
 50597  func test_wal_checkpoint(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6846:26: */
 50598  	bp := tls.Alloc(8)
 50599  	defer tls.Free(8)
 50600  
 50601  	var zDb uintptr = uintptr(0)
 50602  	// var db uintptr at bp, 8
 50603  
 50604  	var rc int32
 50605  
 50606  	if (objc != 3) && (objc != 2) {
 50607  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18712 /* "DB ?NAME?" */)
 50608  		return TCL_ERROR
 50609  	}
 50610  
 50611  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 50612  		return TCL_ERROR
 50613  	}
 50614  	if objc == 3 {
 50615  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 50616  	}
 50617  	rc = sqlite3.Xsqlite3_wal_checkpoint(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb)
 50618  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50619  	return TCL_OK
 50620  }
 50621  
 50622  // tclcmd:  sqlite3_wal_checkpoint_v2 db MODE ?NAME?
 50623  //
 50624  // This command calls the wal_checkpoint_v2() function with the specified
 50625  // mode argument (passive, full or restart). If present, the database name
 50626  // NAME is passed as the second argument to wal_checkpoint_v2(). If it the
 50627  // NAME argument is not present, a NULL pointer is passed instead.
 50628  //
 50629  // If wal_checkpoint_v2() returns any value other than SQLITE_BUSY or
 50630  // SQLITE_OK, then this command returns TCL_ERROR. The Tcl result is set
 50631  // to the error message obtained from sqlite3_errmsg().
 50632  //
 50633  // Otherwise, this command returns a list of three integers. The first integer
 50634  // is 1 if SQLITE_BUSY was returned, or 0 otherwise. The following two integers
 50635  // are the values returned via the output parameters by wal_checkpoint_v2() -
 50636  // the number of frames in the log and the number of frames in the log
 50637  // that have been checkpointed.
 50638  func test_wal_checkpoint_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6890:26: */
 50639  	bp := tls.Alloc(96)
 50640  	defer tls.Free(96)
 50641  
 50642  	var zDb uintptr = uintptr(0)
 50643  	// var db uintptr at bp+32, 8
 50644  
 50645  	var rc int32
 50646  	// var eMode int32 at bp+40, 4
 50647  
 50648  	*(*int32)(unsafe.Pointer(bp + 88 /* nLog */)) = -555
 50649  	*(*int32)(unsafe.Pointer(bp + 92 /* nCkpt */)) = -555
 50650  	var pRet uintptr
 50651  
 50652  	*(*[5]uintptr)(unsafe.Pointer(bp + 48 /* aMode */)) = [5]uintptr{ts + 18722 /* "passive" */, ts + 18730 /* "full" */, ts + 18735 /* "restart" */, ts + 18743 /* "truncate" */, uintptr(0)}
 50653  
 50654  	if (objc != 3) && (objc != 4) {
 50655  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18752 /* "DB MODE ?NAME?" */)
 50656  		return TCL_ERROR
 50657  	}
 50658  
 50659  	if objc == 4 {
 50660  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 50661  	}
 50662  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0) || ((TCL_OK != tcl.XTcl_GetIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &eMode */)) &&
 50663  		(TCL_OK != tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+48 /* &aMode[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+18767 /* "mode" */, 0, bp+40 /* &eMode */))) {
 50664  		return TCL_ERROR
 50665  	}
 50666  
 50667  	rc = sqlite3.Xsqlite3_wal_checkpoint_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zDb, *(*int32)(unsafe.Pointer(bp + 40 /* eMode */)), bp+88 /* &nLog */, bp+92 /* &nCkpt */)
 50668  	if (rc != SQLITE_OK) && (rc != SQLITE_BUSY) {
 50669  		var zErrCode uintptr = sqlite3.Xsqlite3ErrName(tls, rc)
 50670  		tcl.XTcl_ResetResult(tls, interp)
 50671  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, zErrCode, ts+10280 /* " - " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */))), 0))
 50672  		return TCL_ERROR
 50673  	}
 50674  
 50675  	pRet = tcl.XTcl_NewObj(tls)
 50676  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, func() int32 {
 50677  		if rc == SQLITE_BUSY {
 50678  			return 1
 50679  		}
 50680  		return 0
 50681  	}()))
 50682  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 88 /* nLog */))))
 50683  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 92 /* nCkpt */))))
 50684  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 50685  
 50686  	return TCL_OK
 50687  }
 50688  
 50689  // tclcmd:  sqlite3_wal_autocheckpoint db VALUE
 50690  func test_wal_autocheckpoint(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6946:26: */
 50691  	bp := tls.Alloc(12)
 50692  	defer tls.Free(12)
 50693  
 50694  	// var db uintptr at bp, 8
 50695  
 50696  	var rc int32
 50697  	// var iVal int32 at bp+8, 4
 50698  
 50699  	if objc != 3 {
 50700  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18772 /* "DB VALUE" */)
 50701  		return TCL_ERROR
 50702  	}
 50703  
 50704  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) ||
 50705  		(tcl.XTcl_GetIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &iVal */) != 0) {
 50706  		return TCL_ERROR
 50707  	}
 50708  
 50709  	rc = sqlite3.Xsqlite3_wal_autocheckpoint(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 8 /* iVal */)))
 50710  	tcl.XTcl_ResetResult(tls, interp)
 50711  	if rc != SQLITE_OK {
 50712  		var zErrCode uintptr = sqlite3.Xsqlite3ErrName(tls, rc)
 50713  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zErrCode, -1))
 50714  		return TCL_ERROR
 50715  	}
 50716  
 50717  	return TCL_OK
 50718  }
 50719  
 50720  // tclcmd:  test_sqlite3_log ?SCRIPT?
 50721  type LogCallback = struct {
 50722  	FpInterp uintptr
 50723  	FpObj    uintptr
 50724  } /* test1.c:6983:8 */
 50725  
 50726  // tclcmd:  test_sqlite3_log ?SCRIPT?
 50727  var logcallback = LogCallback{} /* test1.c:6986:3 */
 50728  
 50729  func xLogcallback(tls *libc.TLS, unused uintptr, err int32, zMsg uintptr) { /* test1.c:6987:13: */
 50730  	var pNew uintptr = tcl.XTcl_DuplicateObj(tls, logcallback.FpObj)
 50731  	(*Tcl_Obj)(unsafe.Pointer(pNew)).FrefCount++
 50732  	tcl.XTcl_ListObjAppendElement(tls,
 50733  		uintptr(0), pNew, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, err), -1))
 50734  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pNew, tcl.XTcl_NewStringObj(tls, zMsg, -1))
 50735  	tcl.XTcl_EvalObjEx(tls, logcallback.FpInterp, pNew, (TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT))
 50736  	for ok := true; ok; ok = 0 != 0 {
 50737  		var _objPtr uintptr = pNew
 50738  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 50739  			tcl.XTclFreeObj(tls, _objPtr)
 50740  		}
 50741  	}
 50742  }
 50743  
 50744  func test_sqlite3_log(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6997:26: */
 50745  	bp := tls.Alloc(32)
 50746  	defer tls.Free(32)
 50747  
 50748  	if objc > 2 {
 50749  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10650 /* "SCRIPT" */)
 50750  		return TCL_ERROR
 50751  	}
 50752  	if logcallback.FpObj != 0 {
 50753  		for ok := true; ok; ok = 0 != 0 {
 50754  			var _objPtr uintptr = logcallback.FpObj
 50755  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 50756  				tcl.XTclFreeObj(tls, _objPtr)
 50757  			}
 50758  		}
 50759  		logcallback.FpObj = uintptr(0)
 50760  		logcallback.FpInterp = uintptr(0)
 50761  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOG, libc.VaList(bp, uintptr(0), uintptr(0)))
 50762  	}
 50763  	if objc > 1 {
 50764  		logcallback.FpObj = *(*uintptr)(unsafe.Pointer(objv + 1*8))
 50765  		(*Tcl_Obj)(unsafe.Pointer(logcallback.FpObj)).FrefCount++
 50766  		logcallback.FpInterp = interp
 50767  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOG, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(&struct {
 50768  			f func(*libc.TLS, uintptr, int32, uintptr)
 50769  		}{xLogcallback})), uintptr(0)))
 50770  	}
 50771  	return TCL_OK
 50772  }
 50773  
 50774  //     tcl_objproc COMMANDNAME ARGS...
 50775  //
 50776  // Run a TCL command using its objProc interface.  Throw an error if
 50777  // the command has no objProc interface.
 50778  func runAsObjProc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7028:26: */
 50779  	bp := tls.Alloc(112)
 50780  	defer tls.Free(112)
 50781  
 50782  	// var cmdInfo Tcl_CmdInfo at bp+48, 64
 50783  
 50784  	if objc < 2 {
 50785  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18781 /* "COMMAND ..." */)
 50786  		return TCL_ERROR
 50787  	}
 50788  	if !(tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &cmdInfo */) != 0) {
 50789  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320, /* "command not foun..." */
 50790  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 50791  		return TCL_ERROR
 50792  	}
 50793  	if (*Tcl_CmdInfo)(unsafe.Pointer(bp+48 /* &cmdInfo */)).FobjProc == uintptr(0) {
 50794  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+18793, /* "command has no o..." */
 50795  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 50796  		return TCL_ERROR
 50797  	}
 50798  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 48 /* &cmdInfo */ + 8 /* &.objProc */))))(tls, (*Tcl_CmdInfo)(unsafe.Pointer(bp+48 /* &cmdInfo */)).FobjClientData, interp, (objc - 1), (objv + uintptr(1)*8))
 50799  }
 50800  
 50801  // WARNING: The following function, printExplainQueryPlan() is an exact
 50802  // copy of example code from eqp.in (eqp.html). If this code is modified,
 50803  // then the documentation copy needs to be modified as well.
 50804  // Argument pStmt is a prepared SQL statement. This function compiles
 50805  // an EXPLAIN QUERY PLAN command to report on the prepared statement,
 50806  // and prints the report to stdout using printf().
 50807  func printExplainQueryPlan(tls *libc.TLS, pStmt uintptr) int32 { /* test1.c:7063:5: */
 50808  	bp := tls.Alloc(48)
 50809  	defer tls.Free(48)
 50810  
 50811  	var zSql uintptr     // Input SQL
 50812  	var zExplain uintptr // SQL with EXPLAIN QUERY PLAN prepended
 50813  	// var pExplain uintptr at bp+40, 8
 50814  	// Compiled EXPLAIN QUERY PLAN command
 50815  	var rc int32 // Return code from sqlite3_prepare_v2()
 50816  
 50817  	zSql = sqlite3.Xsqlite3_sql(tls, pStmt)
 50818  	if zSql == uintptr(0) {
 50819  		return SQLITE_ERROR
 50820  	}
 50821  
 50822  	zExplain = sqlite3.Xsqlite3_mprintf(tls, ts+235 /* "EXPLAIN QUERY PL..." */, libc.VaList(bp, zSql))
 50823  	if zExplain == uintptr(0) {
 50824  		return SQLITE_NOMEM
 50825  	}
 50826  
 50827  	rc = sqlite3.Xsqlite3_prepare_v2(tls, sqlite3.Xsqlite3_db_handle(tls, pStmt), zExplain, -1, bp+40 /* &pExplain */, uintptr(0))
 50828  	sqlite3.Xsqlite3_free(tls, zExplain)
 50829  	if rc != SQLITE_OK {
 50830  		return rc
 50831  	}
 50832  
 50833  	for SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */))) {
 50834  		var iSelectid int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 0)
 50835  		var iOrder int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 1)
 50836  		var iFrom int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 2)
 50837  		var zDetail uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 3)
 50838  
 50839  		libc.Xprintf(tls, ts+18818 /* "%d %d %d %s\n" */, libc.VaList(bp+8, iSelectid, iOrder, iFrom, zDetail))
 50840  	}
 50841  
 50842  	return sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)))
 50843  }
 50844  
 50845  func test_print_eqp(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7091:26: */
 50846  	bp := tls.Alloc(8)
 50847  	defer tls.Free(8)
 50848  
 50849  	var rc int32
 50850  	// var pStmt uintptr at bp, 8
 50851  
 50852  	if objc != 2 {
 50853  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 50854  		return TCL_ERROR
 50855  	}
 50856  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &pStmt */) != 0 {
 50857  		return TCL_ERROR
 50858  	}
 50859  	rc = printExplainQueryPlan(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 50860  	// This is needed on Windows so that a test case using this
 50861  	// function can open a read pipe and get the output of
 50862  	// printExplainQueryPlan() immediately.
 50863  	libc.Xfflush(tls, libc.X__stdoutp)
 50864  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50865  	return TCL_OK
 50866  }
 50867  
 50868  // sqlite3_test_control VERB ARGS...
 50869  func test_test_control(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7119:26: */
 50870  	bp := tls.Alloc(184)
 50871  	defer tls.Free(184)
 50872  
 50873  	*(*[4]Verb)(unsafe.Pointer(bp + 64 /* aVerb */)) = [4]Verb{
 50874  		{FzName: ts + 18831 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_LOCALTIME_FAULT},
 50875  		{FzName: ts + 18863 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_SORTER_MMAP},
 50876  		{FzName: ts + 18891 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_IMPOSTER},
 50877  		{FzName: ts + 18916 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_INTERNAL_FUNCTIONS},
 50878  	}
 50879  	// var iVerb int32 at bp+128, 4
 50880  
 50881  	var iFlag int32
 50882  	var rc int32
 50883  
 50884  	if objc < 2 {
 50885  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18951 /* "VERB ARGS..." */)
 50886  		return TCL_ERROR
 50887  	}
 50888  
 50889  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 50890  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+64 /* &aVerb[0] */, int32(unsafe.Sizeof(Verb{})), ts+18964 /* "VERB" */, 0, bp+128 /* &iVerb */)
 50891  	if rc != TCL_OK {
 50892  		return rc
 50893  	}
 50894  
 50895  	iFlag = (*Verb)(unsafe.Pointer(bp + 64 /* &aVerb */ + uintptr(*(*int32)(unsafe.Pointer(bp + 128 /* iVerb */)))*16)).Fi
 50896  	switch iFlag {
 50897  	case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS:
 50898  		{
 50899  			*(*uintptr)(unsafe.Pointer(bp + 136 /* db */)) = uintptr(0)
 50900  			if objc != 3 {
 50901  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+1911 /* "DB" */)
 50902  				return TCL_ERROR
 50903  			}
 50904  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+136 /* &db */) != 0 {
 50905  				return TCL_ERROR
 50906  			}
 50907  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 136 /* db */))))
 50908  			break
 50909  
 50910  		}
 50911  	case SQLITE_TESTCTRL_LOCALTIME_FAULT:
 50912  		{
 50913  			// var val int32 at bp+144, 4
 50914  
 50915  			if objc != 3 {
 50916  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18969 /* "ONOFF" */)
 50917  				return TCL_ERROR
 50918  			}
 50919  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+144 /* &val */) != 0 {
 50920  				return TCL_ERROR
 50921  			}
 50922  			sqlite3.Xsqlite3_test_control(tls, iFlag, libc.VaList(bp+8, *(*int32)(unsafe.Pointer(bp + 144 /* val */))))
 50923  			break
 50924  
 50925  		}
 50926  
 50927  	case SQLITE_TESTCTRL_SORTER_MMAP:
 50928  		{
 50929  			// var val int32 at bp+160, 4
 50930  
 50931  			// var db uintptr at bp+152, 8
 50932  
 50933  			if objc != 4 {
 50934  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18975 /* "DB LIMIT" */)
 50935  				return TCL_ERROR
 50936  			}
 50937  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+152 /* &db */) != 0 {
 50938  				return TCL_ERROR
 50939  			}
 50940  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+160 /* &val */) != 0 {
 50941  				return TCL_ERROR
 50942  			}
 50943  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_SORTER_MMAP, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 152 /* db */)), *(*int32)(unsafe.Pointer(bp + 160 /* val */))))
 50944  			break
 50945  
 50946  		}
 50947  
 50948  	case SQLITE_TESTCTRL_IMPOSTER:
 50949  		{
 50950  			// var onOff int32 at bp+176, 4
 50951  
 50952  			// var tnum int32 at bp+180, 4
 50953  
 50954  			var zDbName uintptr
 50955  			// var db uintptr at bp+168, 8
 50956  
 50957  			if objc != 6 {
 50958  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18984 /* "DB dbName onOff ..." */)
 50959  				return TCL_ERROR
 50960  			}
 50961  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+168 /* &db */) != 0 {
 50962  				return TCL_ERROR
 50963  			}
 50964  			zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 50965  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+176 /* &onOff */) != 0 {
 50966  				return TCL_ERROR
 50967  			}
 50968  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*8)), bp+180 /* &tnum */) != 0 {
 50969  				return TCL_ERROR
 50970  			}
 50971  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 168 /* db */)), zDbName, *(*int32)(unsafe.Pointer(bp + 176 /* onOff */)), *(*int32)(unsafe.Pointer(bp + 180 /* tnum */))))
 50972  			break
 50973  
 50974  		}
 50975  	}
 50976  
 50977  	tcl.XTcl_ResetResult(tls, interp)
 50978  	return TCL_OK
 50979  }
 50980  
 50981  type Verb = struct {
 50982  	FzName uintptr
 50983  	Fi     int32
 50984  	_      [4]byte
 50985  } /* test1.c:7125:3 */
 50986  
 50987  // -
 50988  // SPDX-License-Identifier: BSD-3-Clause
 50989  //
 50990  // Copyright (c) 1982, 1986, 1993
 50991  //	The Regents of the University of California.  All rights reserved.
 50992  //
 50993  // Redistribution and use in source and binary forms, with or without
 50994  // modification, are permitted provided that the following conditions
 50995  // are met:
 50996  // 1. Redistributions of source code must retain the above copyright
 50997  //    notice, this list of conditions and the following disclaimer.
 50998  // 2. Redistributions in binary form must reproduce the above copyright
 50999  //    notice, this list of conditions and the following disclaimer in the
 51000  //    documentation and/or other materials provided with the distribution.
 51001  // 3. Neither the name of the University nor the names of its contributors
 51002  //    may be used to endorse or promote products derived from this software
 51003  //    without specific prior written permission.
 51004  //
 51005  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 51006  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 51007  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 51008  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 51009  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 51010  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 51011  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 51012  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 51013  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 51014  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 51015  // SUCH DAMAGE.
 51016  //
 51017  //	@(#)resource.h	8.4 (Berkeley) 1/9/95
 51018  // $FreeBSD$
 51019  
 51020  // -
 51021  // SPDX-License-Identifier: BSD-3-Clause
 51022  //
 51023  // Copyright (c) 1991, 1993
 51024  //	The Regents of the University of California.  All rights reserved.
 51025  //
 51026  // This code is derived from software contributed to Berkeley by
 51027  // Berkeley Software Design, Inc.
 51028  //
 51029  // Redistribution and use in source and binary forms, with or without
 51030  // modification, are permitted provided that the following conditions
 51031  // are met:
 51032  // 1. Redistributions of source code must retain the above copyright
 51033  //    notice, this list of conditions and the following disclaimer.
 51034  // 2. Redistributions in binary form must reproduce the above copyright
 51035  //    notice, this list of conditions and the following disclaimer in the
 51036  //    documentation and/or other materials provided with the distribution.
 51037  // 3. Neither the name of the University nor the names of its contributors
 51038  //    may be used to endorse or promote products derived from this software
 51039  //    without specific prior written permission.
 51040  //
 51041  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 51042  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 51043  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 51044  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 51045  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 51046  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 51047  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 51048  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 51049  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 51050  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 51051  // SUCH DAMAGE.
 51052  //
 51053  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 51054  // $FreeBSD$
 51055  
 51056  // -
 51057  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 51058  //
 51059  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 51060  // All rights reserved.
 51061  //
 51062  // Redistribution and use in source and binary forms, with or without
 51063  // modification, are permitted provided that the following conditions
 51064  // are met:
 51065  // 1. Redistributions of source code must retain the above copyright
 51066  //    notice, this list of conditions and the following disclaimer.
 51067  // 2. Redistributions in binary form must reproduce the above copyright
 51068  //    notice, this list of conditions and the following disclaimer in the
 51069  //    documentation and/or other materials provided with the distribution.
 51070  //
 51071  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 51072  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 51073  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 51074  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 51075  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 51076  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 51077  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 51078  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 51079  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 51080  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 51081  // SUCH DAMAGE.
 51082  //
 51083  // $FreeBSD$
 51084  
 51085  // -
 51086  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 51087  //
 51088  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 51089  // All rights reserved.
 51090  //
 51091  // Redistribution and use in source and binary forms, with or without
 51092  // modification, are permitted provided that the following conditions
 51093  // are met:
 51094  // 1. Redistributions of source code must retain the above copyright
 51095  //    notice, this list of conditions and the following disclaimer.
 51096  // 2. Redistributions in binary form must reproduce the above copyright
 51097  //    notice, this list of conditions and the following disclaimer in the
 51098  //    documentation and/or other materials provided with the distribution.
 51099  //
 51100  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 51101  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 51102  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 51103  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 51104  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 51105  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 51106  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 51107  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 51108  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 51109  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 51110  // SUCH DAMAGE.
 51111  //
 51112  // $FreeBSD$
 51113  
 51114  // Process priority specifications to get/setpriority.
 51115  
 51116  // Resource utilization information.
 51117  //
 51118  // All fields are only modified by curthread and
 51119  // no locks are required to read.
 51120  
 51121  type rusage = struct {
 51122  	Fru_utime struct {
 51123  		Ftv_sec  time_t
 51124  		Ftv_usec suseconds_t
 51125  	}
 51126  	Fru_stime struct {
 51127  		Ftv_sec  time_t
 51128  		Ftv_usec suseconds_t
 51129  	}
 51130  	Fru_maxrss   int64
 51131  	Fru_ixrss    int64
 51132  	Fru_idrss    int64
 51133  	Fru_isrss    int64
 51134  	Fru_minflt   int64
 51135  	Fru_majflt   int64
 51136  	Fru_nswap    int64
 51137  	Fru_inblock  int64
 51138  	Fru_oublock  int64
 51139  	Fru_msgsnd   int64
 51140  	Fru_msgrcv   int64
 51141  	Fru_nsignals int64
 51142  	Fru_nvcsw    int64
 51143  	Fru_nivcsw   int64
 51144  } /* resource.h:73:1 */
 51145  
 51146  type __wrusage = struct {
 51147  	Fwru_self struct {
 51148  		Fru_utime struct {
 51149  			Ftv_sec  time_t
 51150  			Ftv_usec suseconds_t
 51151  		}
 51152  		Fru_stime struct {
 51153  			Ftv_sec  time_t
 51154  			Ftv_usec suseconds_t
 51155  		}
 51156  		Fru_maxrss   int64
 51157  		Fru_ixrss    int64
 51158  		Fru_idrss    int64
 51159  		Fru_isrss    int64
 51160  		Fru_minflt   int64
 51161  		Fru_majflt   int64
 51162  		Fru_nswap    int64
 51163  		Fru_inblock  int64
 51164  		Fru_oublock  int64
 51165  		Fru_msgsnd   int64
 51166  		Fru_msgrcv   int64
 51167  		Fru_nsignals int64
 51168  		Fru_nvcsw    int64
 51169  		Fru_nivcsw   int64
 51170  	}
 51171  	Fwru_children struct {
 51172  		Fru_utime struct {
 51173  			Ftv_sec  time_t
 51174  			Ftv_usec suseconds_t
 51175  		}
 51176  		Fru_stime struct {
 51177  			Ftv_sec  time_t
 51178  			Ftv_usec suseconds_t
 51179  		}
 51180  		Fru_maxrss   int64
 51181  		Fru_ixrss    int64
 51182  		Fru_idrss    int64
 51183  		Fru_isrss    int64
 51184  		Fru_minflt   int64
 51185  		Fru_majflt   int64
 51186  		Fru_nswap    int64
 51187  		Fru_inblock  int64
 51188  		Fru_oublock  int64
 51189  		Fru_msgsnd   int64
 51190  		Fru_msgrcv   int64
 51191  		Fru_nsignals int64
 51192  		Fru_nvcsw    int64
 51193  		Fru_nivcsw   int64
 51194  	}
 51195  } /* resource.h:95:1 */
 51196  
 51197  // Resource limits
 51198  
 51199  // Resource limit string identifiers
 51200  
 51201  type rlimit = struct {
 51202  	Frlim_cur rlim_t
 51203  	Frlim_max rlim_t
 51204  } /* resource.h:151:1 */
 51205  
 51206  type orlimit = struct {
 51207  	Frlim_cur int32
 51208  	Frlim_max int32
 51209  } /* resource.h:158:1 */
 51210  
 51211  type loadavg = struct {
 51212  	Fldavg  [3]uint32
 51213  	_       [4]byte
 51214  	Ffscale int64
 51215  } /* resource.h:163:1 */
 51216  
 51217  func test_getrusage(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7209:26: */
 51218  	bp := tls.Alloc(1216)
 51219  	defer tls.Free(1216)
 51220  
 51221  	// var buf [1024]int8 at bp+192, 1024
 51222  
 51223  	// var r rusage at bp+48, 144
 51224  
 51225  	libc.Xmemset(tls, bp+48 /* &r */, 0, uint64(unsafe.Sizeof(rusage{})))
 51226  	libc.Xgetrusage(tls, RUSAGE_SELF, bp+48 /* &r */)
 51227  
 51228  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([1024]int8{})), bp+192, /* &buf[0] */
 51229  		ts+19005, /* "ru_utime=%d.%06d..." */
 51230  		libc.VaList(bp, int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_utime.Ftv_sec), int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_utime.Ftv_usec),
 51231  			int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_stime.Ftv_sec), int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_stime.Ftv_usec),
 51232  			int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_minflt), int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_majflt)))
 51233  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+192 /* &buf[0] */, -1))
 51234  	return TCL_OK
 51235  }
 51236  
 51237  //      optimization_control DB OPT BOOLEAN
 51238  //
 51239  // Enable or disable query optimizations using the sqlite3_test_control()
 51240  // interface.  Disable if BOOLEAN is false and enable if BOOLEAN is true.
 51241  // OPT is the name of the optimization to be disabled.
 51242  func optimization_control(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7489:26: */
 51243  	bp := tls.Alloc(68)
 51244  	defer tls.Free(68)
 51245  
 51246  	var i int32
 51247  	// var db uintptr at bp+56, 8
 51248  
 51249  	var zOpt uintptr
 51250  	// var onoff int32 at bp+64, 4
 51251  
 51252  	var mask int32 = 0
 51253  
 51254  	if objc != 4 {
 51255  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19065 /* "DB OPT BOOLEAN" */)
 51256  		return TCL_ERROR
 51257  	}
 51258  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+56 /* &db */) != 0 {
 51259  		return TCL_ERROR
 51260  	}
 51261  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+64 /* &onoff */) != 0 {
 51262  		return TCL_ERROR
 51263  	}
 51264  	zOpt = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 51265  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aOpt)) / uint64(unsafe.Sizeof(struct {
 51266  		FzOptName uintptr
 51267  		Fmask     int32
 51268  		_         [4]byte
 51269  	}{}))); i++ {
 51270  		if libc.Xstrcmp(tls, zOpt, aOpt[i].FzOptName) == 0 {
 51271  			mask = aOpt[i].Fmask
 51272  			break
 51273  		}
 51274  	}
 51275  	if *(*int32)(unsafe.Pointer(bp + 64 /* onoff */)) != 0 {
 51276  		mask = ^mask
 51277  	}
 51278  	if uint64(i) >= (uint64(unsafe.Sizeof(aOpt)) / uint64(unsafe.Sizeof(struct {
 51279  		FzOptName uintptr
 51280  		Fmask     int32
 51281  		_         [4]byte
 51282  	}{}))) {
 51283  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19080, /* "unknown optimiza..." */
 51284  			uintptr(0)))
 51285  		for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aOpt)) / uint64(unsafe.Sizeof(struct {
 51286  			FzOptName uintptr
 51287  			Fmask     int32
 51288  			_         [4]byte
 51289  		}{}))); i++ {
 51290  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+4755 /* " " */, aOpt[i].FzOptName, uintptr(0)))
 51291  		}
 51292  		return TCL_ERROR
 51293  	}
 51294  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_OPTIMIZATIONS, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), mask))
 51295  	return TCL_OK
 51296  }
 51297  
 51298  var aOpt = [13]struct {
 51299  	FzOptName uintptr
 51300  	Fmask     int32
 51301  	_         [4]byte
 51302  }{
 51303  	{FzOptName: ts + 19121 /* "all" */, Fmask: libc.Int32FromUint32(SQLITE_AllOpts)},
 51304  	{FzOptName: ts + 19125 /* "none" */},
 51305  	{FzOptName: ts + 19130 /* "query-flattener" */, Fmask: SQLITE_QueryFlattener},
 51306  	{FzOptName: ts + 19146 /* "groupby-order" */, Fmask: SQLITE_GroupByOrder},
 51307  	{FzOptName: ts + 19160 /* "factor-constants" */, Fmask: SQLITE_FactorOutConst},
 51308  	{FzOptName: ts + 19177 /* "distinct-opt" */, Fmask: SQLITE_DistinctOpt},
 51309  	{FzOptName: ts + 19190 /* "cover-idx-scan" */, Fmask: SQLITE_CoverIdxScan},
 51310  	{FzOptName: ts + 19205 /* "order-by-idx-joi..." */, Fmask: SQLITE_OrderByIdxJoin},
 51311  	{FzOptName: ts + 19223 /* "transitive" */, Fmask: SQLITE_Transitive},
 51312  	{FzOptName: ts + 19234 /* "omit-noop-join" */, Fmask: SQLITE_OmitNoopJoin},
 51313  	{FzOptName: ts + 19249 /* "stat4" */, Fmask: SQLITE_Stat4},
 51314  	{FzOptName: ts + 19255 /* "skip-scan" */, Fmask: SQLITE_SkipScan},
 51315  	{FzOptName: ts + 19265 /* "push-down" */, Fmask: SQLITE_PushDown},
 51316  } /* test1.c:7503:5 */
 51317  
 51318  //     load_static_extension DB NAME ...
 51319  //
 51320  // Load one or more statically linked extensions.
 51321  func tclLoadStaticExtensionCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7550:26: */
 51322  	bp := tls.Alloc(80)
 51323  	defer tls.Free(80)
 51324  
 51325  	// var db uintptr at bp+64, 8
 51326  
 51327  	var zName uintptr
 51328  	var i int32
 51329  	var j int32
 51330  	var rc int32
 51331  	*(*uintptr)(unsafe.Pointer(bp + 72 /* zErrMsg */)) = uintptr(0)
 51332  	if objc < 3 {
 51333  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19275 /* "DB NAME ..." */)
 51334  		return TCL_ERROR
 51335  	}
 51336  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &db */) != 0 {
 51337  		return TCL_ERROR
 51338  	}
 51339  	for j = 2; j < objc; j++ {
 51340  		zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(j)*8)))
 51341  		for i = 0; i < (int32(uint64(unsafe.Sizeof(aExtension)) / uint64(unsafe.Sizeof(struct {
 51342  			FzExtName uintptr
 51343  			FpInit    uintptr
 51344  		}{})))); i++ {
 51345  			if libc.Xstrcmp(tls, zName, aExtension[i].FzExtName) == 0 {
 51346  				break
 51347  			}
 51348  		}
 51349  		if i >= (int32(uint64(unsafe.Sizeof(aExtension)) / uint64(unsafe.Sizeof(struct {
 51350  			FzExtName uintptr
 51351  			FpInit    uintptr
 51352  		}{})))) {
 51353  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19287 /* "no such extensio..." */, zName, uintptr(0)))
 51354  			return TCL_ERROR
 51355  		}
 51356  		if aExtension[i].FpInit != 0 {
 51357  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aExtension)) + uintptr(i)*16 + 8 /* &.pInit */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), bp+72 /* &zErrMsg */, uintptr(0))
 51358  		} else {
 51359  			rc = SQLITE_OK
 51360  		}
 51361  		if ((rc != SQLITE_OK) && (rc != (SQLITE_OK | (int32(1) << 8)))) || (*(*uintptr)(unsafe.Pointer(bp + 72 /* zErrMsg */)) != 0) {
 51362  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+19307 /* "initialization o..." */, zName, ts+19326 /* " failed: " */, *(*uintptr)(unsafe.Pointer(bp + 72 /* zErrMsg */)),
 51363  				uintptr(0)))
 51364  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* zErrMsg */)))
 51365  			return TCL_ERROR
 51366  		}
 51367  	}
 51368  	return TCL_OK
 51369  }
 51370  
 51371  var aExtension = [22]struct {
 51372  	FzExtName uintptr
 51373  	FpInit    uintptr
 51374  }{
 51375  	{FzExtName: ts + 19336 /* "amatch" */, FpInit: 0},
 51376  	{FzExtName: ts + 19343 /* "appendvfs" */, FpInit: 0},
 51377  	{FzExtName: ts + 3921 /* "carray" */, FpInit: 0},
 51378  	{FzExtName: ts + 19353 /* "closure" */, FpInit: 0},
 51379  	{FzExtName: ts + 4676 /* "csv" */, FpInit: 0},
 51380  	{FzExtName: ts + 4699 /* "decimal" */, FpInit: 0},
 51381  	{FzExtName: ts + 4757 /* "eval" */, FpInit: 0},
 51382  	{FzExtName: ts + 4835 /* "explain" */, FpInit: 0},
 51383  	{FzExtName: ts + 19361 /* "fileio" */, FpInit: 0},
 51384  	{FzExtName: ts + 5344 /* "fuzzer" */, FpInit: 0},
 51385  	{FzExtName: ts + 5368 /* "ieee754" */, FpInit: 0},
 51386  	{FzExtName: ts + 19368 /* "nextchar" */, FpInit: 0},
 51387  	{FzExtName: ts + 5948 /* "percentile" */, FpInit: 0},
 51388  	{FzExtName: ts + 6023 /* "prefixes" */, FpInit: 0},
 51389  	{FzExtName: ts + 6335 /* "regexp" */, FpInit: 0},
 51390  	{FzExtName: ts + 6350 /* "remember" */, FpInit: 0},
 51391  	{FzExtName: ts + 19377 /* "series" */, FpInit: 0},
 51392  	{FzExtName: ts + 19384 /* "spellfix" */, FpInit: 0},
 51393  	{FzExtName: ts + 19393 /* "totype" */, FpInit: 0},
 51394  	{FzExtName: ts + 8367 /* "unionvtab" */, FpInit: 0},
 51395  	{FzExtName: ts + 8909 /* "wholenumber" */, FpInit: 0},
 51396  	{FzExtName: ts + 9012 /* "zipfile" */, FpInit: 0},
 51397  } /* test1.c:7585:5 */
 51398  
 51399  //     sorter_test_fakeheap BOOL
 51400  //
 51401  func sorter_test_fakeheap(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7650:26: */
 51402  	bp := tls.Alloc(4)
 51403  	defer tls.Free(4)
 51404  
 51405  	// var bArg int32 at bp, 4
 51406  
 51407  	if objc != 2 {
 51408  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 51409  		return TCL_ERROR
 51410  	}
 51411  
 51412  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &bArg */) != 0 {
 51413  		return TCL_ERROR
 51414  	}
 51415  
 51416  	if *(*int32)(unsafe.Pointer(bp /* bArg */)) != 0 {
 51417  		if sqlite3.Xsqlite3Config.FpHeap == uintptr(0) {
 51418  			sqlite3.Xsqlite3Config.FpHeap = libc.UintptrFromInt64(int64(-1))
 51419  		}
 51420  	} else {
 51421  		if sqlite3.Xsqlite3Config.FpHeap == (libc.UintptrFromInt64(int64(-1))) {
 51422  			sqlite3.Xsqlite3Config.FpHeap = uintptr(0)
 51423  		}
 51424  	}
 51425  
 51426  	tcl.XTcl_ResetResult(tls, interp)
 51427  	return TCL_OK
 51428  }
 51429  
 51430  //     sorter_test_sort4_helper DB SQL1 NSTEP SQL2
 51431  //
 51432  // Compile SQL statement $SQL1 and step it $NSTEP times. For each row,
 51433  // check that the leftmost and rightmost columns returned are both integers,
 51434  // and that both contain the same value.
 51435  //
 51436  // Then execute statement $SQL2. Check that the statement returns the same
 51437  // set of integers in the same order as in the previous step (using $SQL1).
 51438  func sorter_test_sort4_helper(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7690:26: */
 51439  	bp := tls.Alloc(80)
 51440  	defer tls.Free(80)
 51441  
 51442  	var zSql1 uintptr
 51443  	var zSql2 uintptr
 51444  	// var nStep int32 at bp+64, 4
 51445  
 51446  	var iStep int32
 51447  	var iCksum1 uint32
 51448  	var iCksum2 uint32
 51449  	var rc int32
 51450  	var iB int32
 51451  	// var db uintptr at bp+56, 8
 51452  
 51453  	// var pStmt uintptr at bp+72, 8
 51454  
 51455  	var a int32
 51456  	var a1 int32
 51457  	iCksum1 = uint32(0)
 51458  	iCksum2 = uint32(0)
 51459  
 51460  	if !(objc != 5) {
 51461  		goto __1
 51462  	}
 51463  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19400 /* "DB SQL1 NSTEP SQ..." */)
 51464  	return TCL_ERROR
 51465  __1:
 51466  	;
 51467  
 51468  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+56 /* &db */) != 0) {
 51469  		goto __2
 51470  	}
 51471  	return TCL_ERROR
 51472  __2:
 51473  	;
 51474  	zSql1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 51475  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+64 /* &nStep */) != 0) {
 51476  		goto __3
 51477  	}
 51478  	return TCL_ERROR
 51479  __3:
 51480  	;
 51481  	zSql2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 51482  
 51483  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), zSql1, -1, bp+72 /* &pStmt */, uintptr(0))
 51484  	if !(rc != SQLITE_OK) {
 51485  		goto __4
 51486  	}
 51487  	goto sql_error
 51488  __4:
 51489  	;
 51490  
 51491  	iB = (sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))) - 1)
 51492  	iStep = 0
 51493  __5:
 51494  	if !((iStep < *(*int32)(unsafe.Pointer(bp + 64 /* nStep */))) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */))))) {
 51495  		goto __7
 51496  	}
 51497  	a = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)), 0)
 51498  	if !(a != sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)), iB)) {
 51499  		goto __8
 51500  	}
 51501  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19419 /* "data error: (a!=..." */, 0))
 51502  	return TCL_ERROR
 51503  __8:
 51504  	;
 51505  
 51506  	iCksum1 = iCksum1 + ((iCksum1 << 3) + uint32(a))
 51507  	goto __6
 51508  __6:
 51509  	iStep++
 51510  	goto __5
 51511  	goto __7
 51512  __7:
 51513  	;
 51514  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)))
 51515  	if !(rc != SQLITE_OK) {
 51516  		goto __9
 51517  	}
 51518  	goto sql_error
 51519  __9:
 51520  	;
 51521  
 51522  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), zSql2, -1, bp+72 /* &pStmt */, uintptr(0))
 51523  	if !(rc != SQLITE_OK) {
 51524  		goto __10
 51525  	}
 51526  	goto sql_error
 51527  __10:
 51528  	;
 51529  	iStep = 0
 51530  __11:
 51531  	if !(SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)))) {
 51532  		goto __13
 51533  	}
 51534  	a1 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)), 0)
 51535  	iCksum2 = iCksum2 + ((iCksum2 << 3) + uint32(a1))
 51536  	goto __12
 51537  __12:
 51538  	iStep++
 51539  	goto __11
 51540  	goto __13
 51541  __13:
 51542  	;
 51543  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 72 /* pStmt */)))
 51544  	if !(rc != SQLITE_OK) {
 51545  		goto __14
 51546  	}
 51547  	goto sql_error
 51548  __14:
 51549  	;
 51550  
 51551  	if !(iCksum1 != iCksum2) {
 51552  		goto __15
 51553  	}
 51554  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+19438 /* "checksum mismatc..." */, 0))
 51555  	return TCL_ERROR
 51556  __15:
 51557  	;
 51558  
 51559  	return TCL_OK
 51560  sql_error:
 51561  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+19456 /* "sql error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */))), 0))
 51562  	return TCL_ERROR
 51563  }
 51564  
 51565  // tclcmd: bad_behavior TYPE
 51566  //
 51567  // Do some things that should trigger a valgrind or -fsanitize=undefined
 51568  // warning.  This is used to verify that errors and warnings output by those
 51569  // tools are detected by the test scripts.
 51570  //
 51571  //       TYPE       BEHAVIOR
 51572  //       1          Overflow a signed integer
 51573  //       2          Jump based on an uninitialized variable
 51574  //       3          Read after free
 51575  //       4          Panic
 51576  func test_bad_behavior(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7893:26: */
 51577  	bp := tls.Alloc(44)
 51578  	defer tls.Free(44)
 51579  
 51580  	// var iType int32 at bp, 4
 51581  
 51582  	var xyz int32
 51583  	var i int32 = *(*int32)(unsafe.Pointer(clientData))
 51584  	var j int32
 51585  	// var w [10]int32 at bp+4, 40
 51586  
 51587  	var a uintptr
 51588  	if objc != 2 {
 51589  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19468 /* "TYPE" */)
 51590  		return TCL_ERROR
 51591  	}
 51592  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &iType */) != 0 {
 51593  		return TCL_ERROR
 51594  	}
 51595  	switch *(*int32)(unsafe.Pointer(bp /* iType */)) {
 51596  	case 1:
 51597  		{
 51598  			xyz = (0x7fffff00 - i)
 51599  			xyz = xyz + (0x100)
 51600  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, xyz))
 51601  			break
 51602  
 51603  		}
 51604  	case 2:
 51605  		{
 51606  			*(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4)) = 5
 51607  			if *(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + uintptr(i)*4)) > 0 {
 51608  				*(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4))++
 51609  			}
 51610  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4))))
 51611  			break
 51612  
 51613  		}
 51614  	case 3:
 51615  		{
 51616  			a = libc.Xmalloc(tls, (uint64(unsafe.Sizeof(int32(0))) * uint64(10)))
 51617  			for j = 0; j < 10; j++ {
 51618  				*(*int32)(unsafe.Pointer(a + uintptr(j)*4)) = j
 51619  			}
 51620  			libc.Xfree(tls, a)
 51621  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(a + uintptr(i)*4))))
 51622  			break
 51623  
 51624  		}
 51625  	case 4:
 51626  		{
 51627  			tcl.XTcl_Panic(tls, ts+19473 /* "Deliberate panic" */, 0)
 51628  			break
 51629  
 51630  		}
 51631  	}
 51632  	return TCL_OK
 51633  }
 51634  
 51635  // tclcmd:   register_dbstat_vtab DB
 51636  //
 51637  // Cause the dbstat virtual table to be available on the connection DB
 51638  func test_register_dbstat_vtab(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7943:26: */
 51639  	bp := tls.Alloc(64)
 51640  	defer tls.Free(64)
 51641  
 51642  	var zDb uintptr
 51643  	// var cmdInfo Tcl_CmdInfo at bp, 64
 51644  
 51645  	if objc != 2 {
 51646  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 51647  		return TCL_ERROR
 51648  	}
 51649  
 51650  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 51651  	if tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp /* &cmdInfo */) != 0 {
 51652  		var db uintptr = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData)).Fdb
 51653  		sqlite3.Xsqlite3DbstatRegister(tls, db)
 51654  	}
 51655  	return TCL_OK
 51656  }
 51657  
 51658  // tclcmd:   sqlite3_db_config DB SETTING VALUE
 51659  //
 51660  // Invoke sqlite3_db_config() for one of the setting values.
 51661  func test_sqlite3_db_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7977:26: */
 51662  	bp := tls.Alloc(28)
 51663  	defer tls.Free(28)
 51664  
 51665  	var i int32
 51666  	*(*int32)(unsafe.Pointer(bp + 24 /* v */)) = 0
 51667  	var zSetting uintptr
 51668  	// var db uintptr at bp+16, 8
 51669  
 51670  	if (objc != 4) && (objc != 3) {
 51671  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19490 /* "DB SETTING [VALU..." */)
 51672  		return TCL_ERROR
 51673  	}
 51674  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0 {
 51675  		return TCL_ERROR
 51676  	}
 51677  	zSetting = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 51678  	if sqlite3.Xsqlite3_strglob(tls, ts+19509 /* "SQLITE_*" */, zSetting) == 0 {
 51679  		zSetting += uintptr(7)
 51680  	}
 51681  	if sqlite3.Xsqlite3_strglob(tls, ts+19518 /* "DBCONFIG_*" */, zSetting) == 0 {
 51682  		zSetting += uintptr(9)
 51683  	}
 51684  	if sqlite3.Xsqlite3_strglob(tls, ts+19529 /* "ENABLE_*" */, zSetting) == 0 {
 51685  		zSetting += uintptr(7)
 51686  	}
 51687  	for i = 0; i < (int32(uint64(unsafe.Sizeof(aSetting)) / uint64(unsafe.Sizeof(struct {
 51688  		FzName uintptr
 51689  		FeVal  int32
 51690  		_      [4]byte
 51691  	}{})))); i++ {
 51692  		if libc.Xstrcmp(tls, zSetting, aSetting[i].FzName) == 0 {
 51693  			break
 51694  		}
 51695  	}
 51696  	if i >= (int32(uint64(unsafe.Sizeof(aSetting)) / uint64(unsafe.Sizeof(struct {
 51697  		FzName uintptr
 51698  		FeVal  int32
 51699  		_      [4]byte
 51700  	}{})))) {
 51701  		tcl.XTcl_SetObjResult(tls, interp,
 51702  			tcl.XTcl_NewStringObj(tls, ts+19538 /* "unknown sqlite3_..." */, -1))
 51703  		return TCL_ERROR
 51704  	}
 51705  	if objc == 4 {
 51706  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+24 /* &v */) != 0 {
 51707  			return TCL_ERROR
 51708  		}
 51709  	} else {
 51710  		*(*int32)(unsafe.Pointer(bp + 24 /* v */)) = -1
 51711  	}
 51712  	sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), aSetting[i].FeVal, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 24 /* v */)), bp+24 /* &v */))
 51713  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 24 /* v */))))
 51714  	return TCL_OK
 51715  }
 51716  
 51717  var aSetting = [14]struct {
 51718  	FzName uintptr
 51719  	FeVal  int32
 51720  	_      [4]byte
 51721  }{
 51722  	{FzName: ts + 19572 /* "FKEY" */, FeVal: SQLITE_DBCONFIG_ENABLE_FKEY},
 51723  	{FzName: ts + 19577 /* "TRIGGER" */, FeVal: SQLITE_DBCONFIG_ENABLE_TRIGGER},
 51724  	{FzName: ts + 19585 /* "FTS3_TOKENIZER" */, FeVal: SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER},
 51725  	{FzName: ts + 19600 /* "LOAD_EXTENSION" */, FeVal: SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION},
 51726  	{FzName: ts + 19615 /* "NO_CKPT_ON_CLOSE" */, FeVal: SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE},
 51727  	{FzName: ts + 19632 /* "QPSG" */, FeVal: SQLITE_DBCONFIG_ENABLE_QPSG},
 51728  	{FzName: ts + 19637 /* "TRIGGER_EQP" */, FeVal: SQLITE_DBCONFIG_TRIGGER_EQP},
 51729  	{FzName: ts + 19649 /* "RESET_DB" */, FeVal: SQLITE_DBCONFIG_RESET_DATABASE},
 51730  	{FzName: ts + 19658 /* "DEFENSIVE" */, FeVal: SQLITE_DBCONFIG_DEFENSIVE},
 51731  	{FzName: ts + 19668 /* "WRITABLE_SCHEMA" */, FeVal: SQLITE_DBCONFIG_WRITABLE_SCHEMA},
 51732  	{FzName: ts + 19684 /* "LEGACY_ALTER_TAB..." */, FeVal: SQLITE_DBCONFIG_LEGACY_ALTER_TABLE},
 51733  	{FzName: ts + 19703 /* "DQS_DML" */, FeVal: SQLITE_DBCONFIG_DQS_DML},
 51734  	{FzName: ts + 19711 /* "DQS_DDL" */, FeVal: SQLITE_DBCONFIG_DQS_DDL},
 51735  	{FzName: ts + 19719 /* "LEGACY_FILE_FORM..." */, FeVal: SQLITE_DBCONFIG_LEGACY_FILE_FORMAT},
 51736  } /* test1.c:7986:5 */
 51737  
 51738  // tclcmd:   sqlite3_txn_state DB ?SCHEMA?
 51739  //
 51740  // Invoke sqlite3_txn_state(DB,SCHEMA) and return the
 51741  // numeric value that results.  Use NULL for SCHEMA if the 3 argument
 51742  // is omitted.
 51743  func test_sqlite3_txn_state(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8040:26: */
 51744  	bp := tls.Alloc(8)
 51745  	defer tls.Free(8)
 51746  
 51747  	// var db uintptr at bp, 8
 51748  
 51749  	var zSchema uintptr
 51750  	var iTxn int32
 51751  
 51752  	if (objc != 2) && (objc != 3) {
 51753  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19738 /* "DB ?SCHEMA?" */)
 51754  		return TCL_ERROR
 51755  	}
 51756  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 51757  		return TCL_ERROR
 51758  	}
 51759  	if objc == 3 {
 51760  		zSchema = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 51761  	} else {
 51762  		zSchema = uintptr(0)
 51763  	}
 51764  	iTxn = sqlite3.Xsqlite3_txn_state(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zSchema)
 51765  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iTxn))
 51766  	return TCL_OK
 51767  }
 51768  
 51769  // Change the name of the main database schema from "main" to "icecube".
 51770  func test_dbconfig_maindbname_icecube(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8064:26: */
 51771  	bp := tls.Alloc(16)
 51772  	defer tls.Free(16)
 51773  
 51774  	var rc int32
 51775  	// var db uintptr at bp+8, 8
 51776  
 51777  	if objc != 2 {
 51778  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 51779  		return TCL_ERROR
 51780  	} else {
 51781  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+8 /* &db */) != 0 {
 51782  			return TCL_ERROR
 51783  		}
 51784  		rc = sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), SQLITE_DBCONFIG_MAINDBNAME, libc.VaList(bp, ts+19750 /* "icecube" */))
 51785  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 51786  		return TCL_OK
 51787  	}
 51788  	return int32(0)
 51789  }
 51790  
 51791  // Usage: sqlite3_mmap_warm DB DBNAME
 51792  func test_mmap_warm(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8087:26: */
 51793  	bp := tls.Alloc(8)
 51794  	defer tls.Free(8)
 51795  
 51796  	if (objc != 2) && (objc != 3) {
 51797  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19758 /* "DB ?DBNAME?" */)
 51798  		return TCL_ERROR
 51799  	} else {
 51800  		var rc int32
 51801  		// var db uintptr at bp, 8
 51802  
 51803  		var zDb uintptr = uintptr(0)
 51804  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 51805  			return TCL_ERROR
 51806  		}
 51807  		if objc == 3 {
 51808  			zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 51809  		}
 51810  		rc = sqlite3_mmap_warm(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb)
 51811  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 51812  		return TCL_OK
 51813  	}
 51814  	return int32(0)
 51815  }
 51816  
 51817  // Usage:  test_write_db DB OFFSET DATA
 51818  //
 51819  // Obtain the sqlite3_file* object for the database file for the "main" db
 51820  // of handle DB. Then invoke its xWrite method to write data DATA to offset
 51821  // OFFSET.
 51822  func test_write_db(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8120:26: */
 51823  	bp := tls.Alloc(32)
 51824  	defer tls.Free(32)
 51825  
 51826  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 51827  	*(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iOff */)) = int64(0)
 51828  	var aData uintptr = uintptr(0)
 51829  	*(*int32)(unsafe.Pointer(bp + 16 /* nData */)) = 0
 51830  	*(*uintptr)(unsafe.Pointer(bp + 24 /* pFile */)) = uintptr(0)
 51831  	var rc int32
 51832  
 51833  	if objc != 4 {
 51834  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19770 /* "DB OFFSET DATA" */)
 51835  		return TCL_ERROR
 51836  	}
 51837  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 51838  		return TCL_ERROR
 51839  	}
 51840  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &iOff */) != 0 {
 51841  		return TCL_ERROR
 51842  	}
 51843  	aData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+16 /* &nData */)
 51844  
 51845  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp+24 /* &pFile */)
 51846  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 24 /* pFile */)))).FpMethods + 24 /* &.xWrite */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pFile */)), aData, *(*int32)(unsafe.Pointer(bp + 16 /* nData */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iOff */)))
 51847  
 51848  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 51849  	return TCL_OK
 51850  }
 51851  
 51852  // Usage:  sqlite3_register_cksumvfs
 51853  //
 51854  func test_register_cksumvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8152:26: */
 51855  	if objc != 1 {
 51856  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 51857  		return TCL_ERROR
 51858  	} else {
 51859  		var rc int32 = sqlite3_register_cksumvfs(tls, uintptr(0))
 51860  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 51861  	}
 51862  	return TCL_OK
 51863  }
 51864  
 51865  // Usage:  sqlite3_unregister_cksumvfs
 51866  //
 51867  func test_unregister_cksumvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8173:26: */
 51868  	if objc != 1 {
 51869  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 51870  		return TCL_ERROR
 51871  	} else {
 51872  		var rc int32 = sqlite3_unregister_cksumvfs(tls)
 51873  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 51874  	}
 51875  	return TCL_OK
 51876  }
 51877  
 51878  // Usage:  decode_hexdb TEXT
 51879  //
 51880  // Example:   db deserialize [decode_hexdb $output_of_dbtotxt]
 51881  //
 51882  // This routine returns a byte-array for an SQLite database file that
 51883  // is constructed from a text input which is the output of the "dbtotxt"
 51884  // utility.
 51885  func test_decode_hexdb(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8199:26: */
 51886  	bp := tls.Alloc(296)
 51887  	defer tls.Free(296)
 51888  
 51889  	var zIn uintptr = uintptr(0)
 51890  	var a uintptr = uintptr(0)
 51891  	*(*int32)(unsafe.Pointer(bp + 216 /* n */)) = 0
 51892  	var lineno int32 = 0
 51893  	var i int32
 51894  	var iNext int32
 51895  	var iOffset int32 = 0
 51896  	// var j int32 at bp+224, 4
 51897  
 51898  	// var k int32 at bp+228, 4
 51899  
 51900  	var rc int32
 51901  	// var x [16]uint32 at bp+232, 64
 51902  
 51903  	if objc != 2 {
 51904  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19785 /* "HEXDB" */)
 51905  		return TCL_ERROR
 51906  	}
 51907  	zIn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 51908  	for i = 0; *(*int8)(unsafe.Pointer(zIn + uintptr(i))) != 0; i = iNext {
 51909  		lineno++
 51910  		for iNext = i; (*(*int8)(unsafe.Pointer(zIn + uintptr(iNext))) != 0) && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iNext)))) != '\n'); iNext++ {
 51911  		}
 51912  		if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iNext)))) == '\n' {
 51913  			iNext++
 51914  		}
 51915  		for (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == ' ') || (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == '\t') {
 51916  			i++
 51917  		}
 51918  		if a == uintptr(0) {
 51919  			// var pgsz int32 at bp+220, 4
 51920  
 51921  			rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19791 /* "| size %d pagesi..." */, libc.VaList(bp, bp+216 /* &n */, bp+220 /* &pgsz */))
 51922  			if rc != 2 {
 51923  				continue
 51924  			}
 51925  			if ((*(*int32)(unsafe.Pointer(bp + 220 /* pgsz */)) < 512) || (*(*int32)(unsafe.Pointer(bp + 220 /* pgsz */)) > 65536)) || ((*(*int32)(unsafe.Pointer(bp + 220 /* pgsz */)) & (*(*int32)(unsafe.Pointer(bp + 220 /* pgsz */)) - 1)) != 0) {
 51926  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+19813 /* "bad 'pagesize' f..." */, uintptr(0)))
 51927  				return TCL_ERROR
 51928  			}
 51929  			*(*int32)(unsafe.Pointer(bp + 216 /* n */)) = (((*(*int32)(unsafe.Pointer(bp + 216 /* n */)) + *(*int32)(unsafe.Pointer(bp + 220 /* pgsz */))) - 1) & ^(*(*int32)(unsafe.Pointer(bp + 220 /* pgsz */)) - 1)) // Round n up to the next multiple of pgsz
 51930  			if *(*int32)(unsafe.Pointer(bp + 216 /* n */)) < 512 {
 51931  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+19834 /* "bad 'size' field" */, uintptr(0)))
 51932  				return TCL_ERROR
 51933  			}
 51934  			a = libc.Xmalloc(tls, uint64(*(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 51935  			if a == uintptr(0) {
 51936  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+1930 /* "out of memory" */, uintptr(0)))
 51937  				return TCL_ERROR
 51938  			}
 51939  			libc.Xmemset(tls, a, 0, uint64(*(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 51940  			continue
 51941  		}
 51942  		rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19851 /* "| page %d offset..." */, libc.VaList(bp+64, bp+224 /* &j */, bp+228 /* &k */))
 51943  		if rc == 2 {
 51944  			iOffset = *(*int32)(unsafe.Pointer(bp + 228 /* k */))
 51945  			continue
 51946  		}
 51947  		rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19871, /* "| %d: %x %x %x %..." */
 51948  			libc.VaList(bp+80, bp+224 /* &j */, (bp+232 /* &x */), (bp+232 /* &x */ +1*4), (bp+232 /* &x */ +2*4), (bp+232 /* &x */ +3*4), (bp+232 /* &x */ +4*4), (bp+232 /* &x */ +5*4), (bp+232 /* &x */ +6*4), (bp+232 /* &x */ +7*4),
 51949  				(bp+232 /* &x */ +8*4), (bp+232 /* &x */ +9*4), (bp+232 /* &x */ +10*4), (bp+232 /* &x */ +11*4), (bp+232 /* &x */ +12*4), (bp+232 /* &x */ +13*4), (bp+232 /* &x */ +14*4), (bp+232 /* &x */ +15*4)))
 51950  		if rc == 17 {
 51951  			*(*int32)(unsafe.Pointer(bp + 228 /* k */)) = (iOffset + *(*int32)(unsafe.Pointer(bp + 224 /* j */)))
 51952  			if (*(*int32)(unsafe.Pointer(bp + 228 /* k */)) + 16) <= *(*int32)(unsafe.Pointer(bp + 216 /* n */)) {
 51953  				var ii int32
 51954  				for ii = 0; ii < 16; ii++ {
 51955  					*(*uint8)(unsafe.Pointer(a + uintptr((*(*int32)(unsafe.Pointer(bp + 228 /* k */)) + ii)))) = (uint8(*(*uint32)(unsafe.Pointer(bp + 232 /* &x[0] */ + uintptr(ii)*4)) & uint32(0xff)))
 51956  				}
 51957  			}
 51958  			continue
 51959  		}
 51960  	}
 51961  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, a, *(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 51962  	libc.Xfree(tls, a)
 51963  	return TCL_OK
 51964  }
 51965  
 51966  // Register commands with the TCL interpreter.
 51967  func Sqlitetest1_Init(tls *libc.TLS, interp uintptr) int32 { /* test1.c:8271:5: */
 51968  	var i int32
 51969  
 51970  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd1)) / uint64(unsafe.Sizeof(struct {
 51971  		FzName uintptr
 51972  		FxProc uintptr
 51973  	}{}))); i++ {
 51974  		tcl.XTcl_CreateCommand(tls, interp, aCmd1[i].FzName, aCmd1[i].FxProc, uintptr(0), uintptr(0))
 51975  	}
 51976  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd1)) / uint64(unsafe.Sizeof(struct {
 51977  		FzName      uintptr
 51978  		FxProc      uintptr
 51979  		FclientData uintptr
 51980  	}{}))); i++ {
 51981  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd1[i].FzName,
 51982  			aObjCmd1[i].FxProc, aObjCmd1[i].FclientData, uintptr(0))
 51983  	}
 51984  	tcl.XTcl_LinkVar(tls, interp, ts+19925, /* "sqlite_search_co..." */
 51985  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_search_count)), TCL_LINK_INT)
 51986  	tcl.XTcl_LinkVar(tls, interp, ts+19945, /* "sqlite_found_cou..." */
 51987  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_found_count)), TCL_LINK_INT)
 51988  	tcl.XTcl_LinkVar(tls, interp, ts+19964, /* "sqlite_sort_coun..." */
 51989  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_sort_count)), TCL_LINK_INT)
 51990  	tcl.XTcl_LinkVar(tls, interp, ts+19982, /* "sqlite3_max_blob..." */
 51991  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_max_blobsize)), TCL_LINK_INT)
 51992  	tcl.XTcl_LinkVar(tls, interp, ts+20003, /* "sqlite_like_coun..." */
 51993  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_like_count)), TCL_LINK_INT)
 51994  	tcl.XTcl_LinkVar(tls, interp, ts+20021, /* "sqlite_interrupt..." */
 51995  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_interrupt_count)), TCL_LINK_INT)
 51996  	tcl.XTcl_LinkVar(tls, interp, ts+20044, /* "sqlite_open_file..." */
 51997  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_open_file_count)), TCL_LINK_INT)
 51998  	tcl.XTcl_LinkVar(tls, interp, ts+20067, /* "sqlite_current_t..." */
 51999  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_current_time)), TCL_LINK_INT)
 52000  	tcl.XTcl_LinkVar(tls, interp, ts+20087, /* "sqlite3_xferopt_..." */
 52001  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_xferopt_count)), TCL_LINK_INT)
 52002  	tcl.XTcl_LinkVar(tls, interp, ts+20109, /* "sqlite3_pager_re..." */
 52003  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_readdb_count)), TCL_LINK_INT)
 52004  	tcl.XTcl_LinkVar(tls, interp, ts+20136, /* "sqlite3_pager_wr..." */
 52005  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_writedb_count)), TCL_LINK_INT)
 52006  	tcl.XTcl_LinkVar(tls, interp, ts+20164, /* "sqlite3_pager_wr..." */
 52007  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_writej_count)), TCL_LINK_INT)
 52008  	tcl.XTcl_LinkVar(tls, interp, ts+20191, /* "unaligned_string..." */
 52009  		uintptr(unsafe.Pointer(&unaligned_string_counter)), TCL_LINK_INT)
 52010  	tcl.XTcl_LinkVar(tls, interp, ts+20216, /* "sqlite_last_need..." */
 52011  		uintptr(unsafe.Pointer(&pzNeededCollation)), (TCL_LINK_STRING | TCL_LINK_READ_ONLY))
 52012  	{
 52013  		tcl.XTcl_LinkVar(tls, interp, ts+20245, /* "sqlite_query_pla..." */
 52014  			uintptr(unsafe.Pointer(&query_plan)), (TCL_LINK_STRING | TCL_LINK_READ_ONLY))
 52015  
 52016  	}
 52017  	tcl.XTcl_LinkVar(tls, interp, ts+20263, /* "sqlite_opentemp_..." */
 52018  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_opentemp_count)), TCL_LINK_INT)
 52019  	tcl.XTcl_LinkVar(tls, interp, ts+20285, /* "sqlite_static_bi..." */
 52020  		uintptr(unsafe.Pointer(&sqlite_static_bind_value)), TCL_LINK_STRING)
 52021  	tcl.XTcl_LinkVar(tls, interp, ts+20310, /* "sqlite_static_bi..." */
 52022  		uintptr(unsafe.Pointer(&sqlite_static_bind_nbyte)), TCL_LINK_INT)
 52023  	tcl.XTcl_LinkVar(tls, interp, ts+20335, /* "sqlite_temp_dire..." */
 52024  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_temp_directory)), TCL_LINK_STRING)
 52025  	tcl.XTcl_LinkVar(tls, interp, ts+20357, /* "sqlite_data_dire..." */
 52026  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_data_directory)), TCL_LINK_STRING)
 52027  	tcl.XTcl_LinkVar(tls, interp, ts+20379, /* "bitmask_size" */
 52028  		uintptr(unsafe.Pointer(&bitmask_size)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 52029  	tcl.XTcl_LinkVar(tls, interp, ts+20392, /* "longdouble_size" */
 52030  		uintptr(unsafe.Pointer(&longdouble_size)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 52031  	tcl.XTcl_LinkVar(tls, interp, ts+20408, /* "sqlite_sync_coun..." */
 52032  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_sync_count)), TCL_LINK_INT)
 52033  	tcl.XTcl_LinkVar(tls, interp, ts+20426, /* "sqlite_fullsync_..." */
 52034  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_fullsync_count)), TCL_LINK_INT)
 52035  	return TCL_OK
 52036  }
 52037  
 52038  var iZero int32 = 0 /* test1.c:8284:14 */
 52039  var aCmd1 = [40]struct {
 52040  	FzName uintptr
 52041  	FxProc uintptr
 52042  }{
 52043  	{FzName: ts + 20448 /* "db_enter" */, FxProc: 0},
 52044  	{FzName: ts + 20457 /* "db_leave" */, FxProc: 0},
 52045  	{FzName: ts + 20466 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52046  	{FzName: ts + 20486 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52047  	{FzName: ts + 20508 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52048  	{FzName: ts + 20529 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52049  	{FzName: ts + 20549 /* "sqlite3_snprintf..." */, FxProc: 0},
 52050  	{FzName: ts + 20570 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52051  	{FzName: ts + 20594 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52052  	{FzName: ts + 20617 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52053  	{FzName: ts + 20640 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52054  	{FzName: ts + 20666 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52055  	{FzName: ts + 20689 /* "sqlite3_mprintf_..." */, FxProc: 0},
 52056  	{FzName: ts + 20712 /* "sqlite3_snprintf..." */, FxProc: 0},
 52057  	{FzName: ts + 20733 /* "sqlite3_last_ins..." */, FxProc: 0},
 52058  	{FzName: ts + 20759 /* "sqlite3_exec_pri..." */, FxProc: 0},
 52059  	{FzName: ts + 20779 /* "sqlite3_exec_hex" */, FxProc: 0},
 52060  	{FzName: ts + 20796 /* "sqlite3_exec" */, FxProc: 0},
 52061  	{FzName: ts + 20809 /* "sqlite3_exec_nr" */, FxProc: 0},
 52062  	{FzName: ts + 20825 /* "sqlite3_get_tabl..." */, FxProc: 0},
 52063  	{FzName: ts + 20850 /* "sqlite3_close" */, FxProc: 0},
 52064  	{FzName: ts + 20864 /* "sqlite3_close_v2" */, FxProc: 0},
 52065  	{FzName: ts + 20881 /* "sqlite3_create_f..." */, FxProc: 0},
 52066  	{FzName: ts + 20905 /* "sqlite3_create_a..." */, FxProc: 0},
 52067  	{FzName: ts + 20930 /* "sqlite3_drop_mod..." */, FxProc: 0},
 52068  	{FzName: ts + 20951 /* "sqlite_register_..." */, FxProc: 0},
 52069  	{FzName: ts + 20981 /* "sqlite_abort" */, FxProc: 0},
 52070  	{FzName: ts + 20994 /* "sqlite_bind" */, FxProc: 0},
 52071  	{FzName: ts + 21006 /* "breakpoint" */, FxProc: 0},
 52072  	{FzName: ts + 21017 /* "sqlite3_key" */, FxProc: 0},
 52073  	{FzName: ts + 21029 /* "sqlite3_rekey" */, FxProc: 0},
 52074  	{FzName: ts + 21043 /* "sqlite_set_magic" */, FxProc: 0},
 52075  	{FzName: ts + 21060 /* "sqlite3_interrup..." */, FxProc: 0},
 52076  	{FzName: ts + 21078 /* "sqlite_delete_fu..." */, FxProc: 0},
 52077  	{FzName: ts + 21101 /* "sqlite_delete_co..." */, FxProc: 0},
 52078  	{FzName: ts + 21125 /* "sqlite3_get_auto..." */, FxProc: 0},
 52079  	{FzName: ts + 21148 /* "sqlite3_busy_tim..." */, FxProc: 0},
 52080  	{FzName: ts + 21169 /* "printf" */, FxProc: 0},
 52081  	{FzName: ts + 21176 /* "sqlite3IoTrace" */, FxProc: 0},
 52082  	{FzName: ts + 21191 /* "clang_sanitize_a..." */, FxProc: 0},
 52083  } /* test1.c:8288:5 */
 52084  var aObjCmd1 = [161]struct {
 52085  	FzName      uintptr
 52086  	FxProc      uintptr
 52087  	FclientData uintptr
 52088  }{
 52089  	{FzName: ts + 21214 /* "sqlite3_db_confi..." */, FxProc: 0},
 52090  	{FzName: ts + 21232 /* "sqlite3_txn_stat..." */, FxProc: 0},
 52091  	{FzName: ts + 21250 /* "bad_behavior" */, FxProc: 0, FclientData: 0},
 52092  	{FzName: ts + 21263 /* "register_dbstat_..." */, FxProc: 0},
 52093  	{FzName: ts + 21284 /* "sqlite3_connecti..." */, FxProc: 0},
 52094  	{FzName: ts + 21311 /* "intarray_addr" */, FxProc: 0},
 52095  	{FzName: ts + 21325 /* "int64array_addr" */, FxProc: 0},
 52096  	{FzName: ts + 21341 /* "doublearray_addr" */, FxProc: 0},
 52097  	{FzName: ts + 21358 /* "textarray_addr" */, FxProc: 0},
 52098  	{FzName: ts + 21373 /* "sqlite3_bind_int" */, FxProc: 0},
 52099  	{FzName: ts + 21390 /* "sqlite3_bind_zer..." */, FxProc: 0},
 52100  	{FzName: ts + 21412 /* "sqlite3_bind_zer..." */, FxProc: 0},
 52101  	{FzName: ts + 21436 /* "sqlite3_bind_int..." */, FxProc: 0},
 52102  	{FzName: ts + 21455 /* "sqlite3_bind_dou..." */, FxProc: 0},
 52103  	{FzName: ts + 21475 /* "sqlite3_bind_nul..." */, FxProc: 0},
 52104  	{FzName: ts + 21493 /* "sqlite3_bind_tex..." */, FxProc: 0},
 52105  	{FzName: ts + 21511 /* "sqlite3_bind_tex..." */, FxProc: 0},
 52106  	{FzName: ts + 21531 /* "sqlite3_bind_blo..." */, FxProc: 0},
 52107  	{FzName: ts + 21549 /* "sqlite3_carray_b..." */, FxProc: 0},
 52108  	{FzName: ts + 21569 /* "sqlite3_bind_par..." */, FxProc: 0},
 52109  	{FzName: ts + 21598 /* "sqlite3_bind_par..." */, FxProc: 0},
 52110  	{FzName: ts + 21626 /* "sqlite3_bind_par..." */, FxProc: 0},
 52111  	{FzName: ts + 21655 /* "sqlite3_clear_bi..." */, FxProc: 0},
 52112  	{FzName: ts + 21678 /* "sqlite3_sleep" */, FxProc: 0},
 52113  	{FzName: ts + 21692 /* "sqlite3_errcode" */, FxProc: 0},
 52114  	{FzName: ts + 21708 /* "sqlite3_extended..." */, FxProc: 0},
 52115  	{FzName: ts + 21733 /* "sqlite3_errmsg" */, FxProc: 0},
 52116  	{FzName: ts + 21748 /* "sqlite3_errmsg16" */, FxProc: 0},
 52117  	{FzName: ts + 21765 /* "sqlite3_open" */, FxProc: 0},
 52118  	{FzName: ts + 21778 /* "sqlite3_open16" */, FxProc: 0},
 52119  	{FzName: ts + 21793 /* "sqlite3_open_v2" */, FxProc: 0},
 52120  	{FzName: ts + 21809 /* "sqlite3_complete..." */, FxProc: 0},
 52121  	{FzName: ts + 21828 /* "sqlite3_normaliz..." */, FxProc: 0},
 52122  
 52123  	{FzName: ts + 21846 /* "sqlite3_prepare" */, FxProc: 0},
 52124  	{FzName: ts + 21862 /* "sqlite3_prepare1..." */, FxProc: 0},
 52125  	{FzName: ts + 21880 /* "sqlite3_prepare_..." */, FxProc: 0},
 52126  	{FzName: ts + 21899 /* "sqlite3_prepare_..." */, FxProc: 0},
 52127  	{FzName: ts + 21918 /* "sqlite3_prepare_..." */, FxProc: 0},
 52128  	{FzName: ts + 21942 /* "sqlite3_prepare1..." */, FxProc: 0},
 52129  	{FzName: ts + 21963 /* "sqlite3_finalize" */, FxProc: 0},
 52130  	{FzName: ts + 21980 /* "sqlite3_stmt_sta..." */, FxProc: 0},
 52131  	{FzName: ts + 22000 /* "sqlite3_reset" */, FxProc: 0},
 52132  	{FzName: ts + 22014 /* "sqlite3_expired" */, FxProc: 0},
 52133  	{FzName: ts + 22030 /* "sqlite3_transfer..." */, FxProc: 0},
 52134  	{FzName: ts + 22056 /* "sqlite3_changes" */, FxProc: 0},
 52135  	{FzName: ts + 22072 /* "sqlite3_step" */, FxProc: 0},
 52136  	{FzName: ts + 22085 /* "sqlite3_sql" */, FxProc: 0},
 52137  	{FzName: ts + 22097 /* "sqlite3_expanded..." */, FxProc: 0},
 52138  	{FzName: ts + 22118 /* "sqlite3_next_stm..." */, FxProc: 0},
 52139  	{FzName: ts + 22136 /* "sqlite3_stmt_rea..." */, FxProc: 0},
 52140  	{FzName: ts + 22158 /* "sqlite3_stmt_ise..." */, FxProc: 0},
 52141  	{FzName: ts + 22181 /* "sqlite3_stmt_bus..." */, FxProc: 0},
 52142  	{FzName: ts + 22199 /* "uses_stmt_journa..." */, FxProc: 0},
 52143  
 52144  	{FzName: ts + 22217 /* "sqlite3_release_..." */, FxProc: 0},
 52145  	{FzName: ts + 22240 /* "sqlite3_db_relea..." */, FxProc: 0},
 52146  	{FzName: ts + 22266 /* "sqlite3_db_cache..." */, FxProc: 0},
 52147  	{FzName: ts + 22288 /* "sqlite3_system_e..." */, FxProc: 0},
 52148  	{FzName: ts + 22309 /* "sqlite3_db_filen..." */, FxProc: 0},
 52149  	{FzName: ts + 22329 /* "sqlite3_db_reado..." */, FxProc: 0},
 52150  	{FzName: ts + 22349 /* "sqlite3_soft_hea..." */, FxProc: 0},
 52151  	{FzName: ts + 22373 /* "sqlite3_soft_hea..." */, FxProc: 0},
 52152  	{FzName: ts + 22399 /* "sqlite3_hard_hea..." */, FxProc: 0},
 52153  	{FzName: ts + 22425 /* "sqlite3_thread_c..." */, FxProc: 0},
 52154  	{FzName: ts + 22448 /* "sqlite3_pager_re..." */, FxProc: 0},
 52155  
 52156  	{FzName: ts + 22472 /* "sqlite3_load_ext..." */, FxProc: 0},
 52157  	{FzName: ts + 22495 /* "sqlite3_enable_l..." */, FxProc: 0},
 52158  	{FzName: ts + 22525 /* "sqlite3_extended..." */, FxProc: 0},
 52159  	{FzName: ts + 22555 /* "sqlite3_limit" */, FxProc: 0},
 52160  	{FzName: ts + 22569 /* "dbconfig_maindbn..." */, FxProc: 0},
 52161  
 52162  	{FzName: ts + 22597 /* "save_prng_state" */, FxProc: 0},
 52163  	{FzName: ts + 22613 /* "restore_prng_sta..." */, FxProc: 0},
 52164  	{FzName: ts + 22632 /* "reset_prng_state" */, FxProc: 0},
 52165  	{FzName: ts + 22649 /* "prng_seed" */, FxProc: 0},
 52166  	{FzName: ts + 22659 /* "extra_schema_che..." */, FxProc: 0},
 52167  	{FzName: ts + 22679 /* "database_never_c..." */, FxProc: 0},
 52168  	{FzName: ts + 22702 /* "database_may_be_..." */, FxProc: 0},
 52169  	{FzName: ts + 22726 /* "optimization_con..." */, FxProc: 0},
 52170  	{FzName: ts + 22747 /* "tcl_objproc" */, FxProc: 0},
 52171  
 52172  	// sqlite3_column_*() API
 52173  	{FzName: ts + 22759 /* "sqlite3_column_c..." */, FxProc: 0},
 52174  	{FzName: ts + 22780 /* "sqlite3_data_cou..." */, FxProc: 0},
 52175  	{FzName: ts + 22799 /* "sqlite3_column_t..." */, FxProc: 0},
 52176  	{FzName: ts + 22819 /* "sqlite3_column_b..." */, FxProc: 0},
 52177  	{FzName: ts + 22839 /* "sqlite3_column_d..." */, FxProc: 0},
 52178  	{FzName: ts + 22861 /* "sqlite3_column_i..." */, FxProc: 0},
 52179  	{FzName: ts + 22882 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 52180  	{FzName: ts + 22902 /* "sqlite3_column_n..." */, FxProc: 0, FclientData: 0},
 52181  	{FzName: ts + 22922 /* "sqlite3_column_i..." */, FxProc: 0, FclientData: 0},
 52182  	{FzName: ts + 22941 /* "sqlite3_column_b..." */, FxProc: 0, FclientData: 0},
 52183  	{FzName: ts + 22962 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 52184  	{FzName: ts + 22986 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 52185  	{FzName: ts + 23015 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 52186  	{FzName: ts + 23041 /* "sqlite3_column_o..." */, FxProc: 0, FclientData: 0},
 52187  
 52188  	{FzName: ts + 23068 /* "sqlite3_column_b..." */, FxProc: 0, FclientData: 0},
 52189  	{FzName: ts + 23091 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 52190  	{FzName: ts + 23113 /* "sqlite3_column_n..." */, FxProc: 0, FclientData: 0},
 52191  	{FzName: ts + 23135 /* "add_alignment_te..." */, FxProc: 0},
 52192  	{FzName: ts + 23165 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 52193  	{FzName: ts + 23191, /* "sqlite3_column_d..." */
 52194  		FxProc: 0, FclientData: 0},
 52195  	{FzName: ts + 23222 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 52196  	{FzName: ts + 23250 /* "sqlite3_column_o..." */, FxProc: 0, FclientData: 0},
 52197  	{FzName: ts + 23279 /* "sqlite3_create_c..." */, FxProc: 0},
 52198  	{FzName: ts + 23307 /* "sqlite3_global_r..." */, FxProc: 0},
 52199  	{FzName: ts + 23330 /* "working_64bit_in..." */, FxProc: 0},
 52200  	{FzName: ts + 23348 /* "vfs_unlink_test" */, FxProc: 0},
 52201  	{FzName: ts + 23364 /* "vfs_initfail_tes..." */, FxProc: 0},
 52202  	{FzName: ts + 23382 /* "vfs_unregister_a..." */, FxProc: 0},
 52203  	{FzName: ts + 23401 /* "vfs_reregister_a..." */, FxProc: 0},
 52204  	{FzName: ts + 23420 /* "file_control_tes..." */, FxProc: 0},
 52205  	{FzName: ts + 23438 /* "file_control_las..." */, FxProc: 0},
 52206  	{FzName: ts + 23466 /* "file_control_loc..." */, FxProc: 0},
 52207  	{FzName: ts + 23494 /* "file_control_chu..." */, FxProc: 0},
 52208  	{FzName: ts + 23522 /* "file_control_siz..." */, FxProc: 0},
 52209  	{FzName: ts + 23549 /* "file_control_dat..." */, FxProc: 0},
 52210  	{FzName: ts + 23575 /* "file_control_per..." */, FxProc: 0},
 52211  	{FzName: ts + 23600 /* "file_control_pow..." */, FxProc: 0},
 52212  	{FzName: ts + 23633 /* "file_control_vfs..." */, FxProc: 0},
 52213  	{FzName: ts + 23654 /* "file_control_res..." */, FxProc: 0},
 52214  	{FzName: ts + 23680 /* "file_control_tem..." */, FxProc: 0},
 52215  	{FzName: ts + 23706 /* "file_control_ext..." */, FxProc: 0},
 52216  	{FzName: ts + 23735 /* "sqlite3_vfs_list" */, FxProc: 0},
 52217  	{FzName: ts + 23752 /* "sqlite3_create_f..." */, FxProc: 0},
 52218  
 52219  	// Functions from os.h
 52220  	{FzName: ts + 23779 /* "add_test_collate" */, FxProc: 0},
 52221  	{FzName: ts + 23796 /* "add_test_collate..." */, FxProc: 0},
 52222  	{FzName: ts + 23820 /* "add_test_functio..." */, FxProc: 0},
 52223  	{FzName: ts + 23838 /* "add_test_utf16bi..." */, FxProc: 0},
 52224  	{FzName: ts + 23864 /* "sqlite3_test_err..." */, FxProc: 0},
 52225  	{FzName: ts + 23884 /* "tcl_variable_typ..." */, FxProc: 0},
 52226  	{FzName: ts + 23902 /* "sqlite3_enable_s..." */, FxProc: 0},
 52227  	{FzName: ts + 23930 /* "sqlite3_shared_c..." */, FxProc: 0},
 52228  	{FzName: ts + 23958 /* "sqlite3_libversi..." */, FxProc: 0},
 52229  	{FzName: ts + 23984 /* "sqlite3_table_co..." */, FxProc: 0},
 52230  	{FzName: ts + 24014 /* "sqlite3_blob_reo..." */, FxProc: 0},
 52231  	{FzName: ts + 24034 /* "pcache_stats" */, FxProc: 0},
 52232  	{FzName: ts + 24047 /* "sqlite3_unlock_n..." */, FxProc: 0},
 52233  	{FzName: ts + 24069 /* "sqlite3_wal_chec..." */, FxProc: 0},
 52234  	{FzName: ts + 24092 /* "sqlite3_wal_chec..." */, FxProc: 0},
 52235  	{FzName: ts + 24118 /* "sqlite3_wal_auto..." */, FxProc: 0},
 52236  	{FzName: ts + 24145 /* "test_sqlite3_log" */, FxProc: 0},
 52237  	{FzName: ts + 24162 /* "print_explain_qu..." */, FxProc: 0},
 52238  	{FzName: ts + 24187 /* "sqlite3_test_con..." */, FxProc: 0},
 52239  	{FzName: ts + 24208 /* "getrusage" */, FxProc: 0},
 52240  	{FzName: ts + 24218 /* "load_static_exte..." */, FxProc: 0},
 52241  	{FzName: ts + 24240 /* "sorter_test_fake..." */, FxProc: 0},
 52242  	{FzName: ts + 24261 /* "sorter_test_sort..." */, FxProc: 0},
 52243  	{FzName: ts + 24286 /* "vfs_current_time..." */, FxProc: 0},
 52244  	{FzName: ts + 24309 /* "sqlite3_snapshot..." */, FxProc: 0},
 52245  	{FzName: ts + 24330 /* "sqlite3_snapshot..." */, FxProc: 0},
 52246  	{FzName: ts + 24352 /* "sqlite3_snapshot..." */, FxProc: 0},
 52247  	{FzName: ts + 24374 /* "sqlite3_snapshot..." */, FxProc: 0},
 52248  	{FzName: ts + 24395 /* "sqlite3_snapshot..." */, FxProc: 0},
 52249  	{FzName: ts + 24420 /* "sqlite3_snapshot..." */, FxProc: 0},
 52250  	{FzName: ts + 24446 /* "sqlite3_snapshot..." */, FxProc: 0},
 52251  	{FzName: ts + 24473 /* "sqlite3_snapshot..." */, FxProc: 0},
 52252  	{FzName: ts + 24499 /* "sqlite3_delete_d..." */, FxProc: 0},
 52253  	{FzName: ts + 24523 /* "atomic_batch_wri..." */, FxProc: 0},
 52254  	{FzName: ts + 24542 /* "sqlite3_mmap_war..." */, FxProc: 0},
 52255  	{FzName: ts + 24560 /* "sqlite3_config_s..." */, FxProc: 0},
 52256  	{FzName: ts + 24585 /* "decode_hexdb" */, FxProc: 0},
 52257  	{FzName: ts + 24598 /* "test_write_db" */, FxProc: 0},
 52258  	{FzName: ts + 24612 /* "sqlite3_register..." */, FxProc: 0},
 52259  	{FzName: ts + 24638 /* "sqlite3_unregist..." */, FxProc: 0},
 52260  }                                                                               /* test1.c:8336:5 */
 52261  var bitmask_size int32 = (int32(uint64(unsafe.Sizeof(Bitmask(0))) * uint64(8))) /* test1.c:8564:14 */
 52262  var longdouble_size int32 = int32(unsafe.Sizeof(float64(0)))                    /* test1.c:8565:14 */
 52263  var query_plan uintptr = ts + 24666                                             /* "*** OBSOLETE VAR..." */ /* test1.c:8637:23 */
 52264  
 52265  // Page size and reserved size used for testing.
 52266  var test_pagesize int32 = 1024 /* test2.c:31:12 */
 52267  
 52268  // Dummy page reinitializer
 52269  func pager_test_reiniter(tls *libc.TLS, pNotUsed uintptr) { /* test2.c:36:13: */
 52270  	return
 52271  }
 52272  
 52273  // Usage:   pager_open FILENAME N-PAGE
 52274  //
 52275  // Open a new pager
 52276  func pager_open(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:45:26: */
 52277  	bp := tls.Alloc(192)
 52278  	defer tls.Free(192)
 52279  
 52280  	// var pageSize u32 at bp+88, 4
 52281  
 52282  	// var pPager uintptr at bp+80, 8
 52283  
 52284  	// var nPage int32 at bp+72, 4
 52285  
 52286  	var rc int32
 52287  	// var zBuf [100]int8 at bp+92, 100
 52288  
 52289  	if argc != 3 {
 52290  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52291  			ts+24692 /* " FILENAME N-PAGE..." */, 0))
 52292  		return TCL_ERROR
 52293  	}
 52294  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+72 /* &nPage */) != 0 {
 52295  		return TCL_ERROR
 52296  	}
 52297  	rc = sqlite3.Xsqlite3PagerOpen(tls, sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)), bp+80 /* &pPager */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), 0, 0,
 52298  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_MAIN_DB),
 52299  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{pager_test_reiniter})))
 52300  	if rc != SQLITE_OK {
 52301  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52302  		return TCL_ERROR
 52303  	}
 52304  	sqlite3.Xsqlite3PagerSetCachesize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pPager */)), *(*int32)(unsafe.Pointer(bp + 72 /* nPage */)))
 52305  	*(*u32)(unsafe.Pointer(bp + 88 /* pageSize */)) = u32(test_pagesize)
 52306  	sqlite3.Xsqlite3PagerSetPagesize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pPager */)), bp+88 /* &pageSize */, -1)
 52307  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+92 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 80 /* pPager */))))
 52308  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+92 /* &zBuf[0] */, 0))
 52309  	return TCL_OK
 52310  }
 52311  
 52312  // Usage:   pager_close ID
 52313  //
 52314  // Close the given pager.
 52315  func pager_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:82:26: */
 52316  	bp := tls.Alloc(48)
 52317  	defer tls.Free(48)
 52318  
 52319  	var pPager uintptr
 52320  	var rc int32
 52321  	if argc != 2 {
 52322  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52323  			ts+24710 /* " ID\"" */, 0))
 52324  		return TCL_ERROR
 52325  	}
 52326  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52327  	rc = sqlite3.Xsqlite3PagerClose(tls, pPager, uintptr(0))
 52328  	if rc != SQLITE_OK {
 52329  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52330  		return TCL_ERROR
 52331  	}
 52332  	return TCL_OK
 52333  }
 52334  
 52335  // Usage:   pager_rollback ID
 52336  //
 52337  // Rollback changes
 52338  func pager_rollback(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:109:26: */
 52339  	bp := tls.Alloc(48)
 52340  	defer tls.Free(48)
 52341  
 52342  	var pPager uintptr
 52343  	var rc int32
 52344  	if argc != 2 {
 52345  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52346  			ts+24710 /* " ID\"" */, 0))
 52347  		return TCL_ERROR
 52348  	}
 52349  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52350  	rc = sqlite3.Xsqlite3PagerRollback(tls, pPager)
 52351  	if rc != SQLITE_OK {
 52352  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52353  		return TCL_ERROR
 52354  	}
 52355  	return TCL_OK
 52356  }
 52357  
 52358  // Usage:   pager_commit ID
 52359  //
 52360  // Commit all changes
 52361  func pager_commit(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:136:26: */
 52362  	bp := tls.Alloc(64)
 52363  	defer tls.Free(64)
 52364  
 52365  	var pPager uintptr
 52366  	var rc int32
 52367  	if argc != 2 {
 52368  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52369  			ts+24710 /* " ID\"" */, 0))
 52370  		return TCL_ERROR
 52371  	}
 52372  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52373  	rc = sqlite3.Xsqlite3PagerCommitPhaseOne(tls, pPager, uintptr(0), 0)
 52374  	if rc != SQLITE_OK {
 52375  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52376  		return TCL_ERROR
 52377  	}
 52378  	rc = sqlite3.Xsqlite3PagerCommitPhaseTwo(tls, pPager)
 52379  	if rc != SQLITE_OK {
 52380  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52381  		return TCL_ERROR
 52382  	}
 52383  	return TCL_OK
 52384  }
 52385  
 52386  // Usage:   pager_stmt_begin ID
 52387  //
 52388  // Start a new checkpoint.
 52389  func pager_stmt_begin(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:168:26: */
 52390  	bp := tls.Alloc(48)
 52391  	defer tls.Free(48)
 52392  
 52393  	var pPager uintptr
 52394  	var rc int32
 52395  	if argc != 2 {
 52396  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52397  			ts+24710 /* " ID\"" */, 0))
 52398  		return TCL_ERROR
 52399  	}
 52400  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52401  	rc = sqlite3.Xsqlite3PagerOpenSavepoint(tls, pPager, 1)
 52402  	if rc != SQLITE_OK {
 52403  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52404  		return TCL_ERROR
 52405  	}
 52406  	return TCL_OK
 52407  }
 52408  
 52409  // Usage:   pager_stmt_rollback ID
 52410  //
 52411  // Rollback changes to a checkpoint
 52412  func pager_stmt_rollback(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:195:26: */
 52413  	bp := tls.Alloc(48)
 52414  	defer tls.Free(48)
 52415  
 52416  	var pPager uintptr
 52417  	var rc int32
 52418  	if argc != 2 {
 52419  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52420  			ts+24710 /* " ID\"" */, 0))
 52421  		return TCL_ERROR
 52422  	}
 52423  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52424  	rc = sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_ROLLBACK, 0)
 52425  	sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_RELEASE, 0)
 52426  	if rc != SQLITE_OK {
 52427  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52428  		return TCL_ERROR
 52429  	}
 52430  	return TCL_OK
 52431  }
 52432  
 52433  // Usage:   pager_stmt_commit ID
 52434  //
 52435  // Commit changes to a checkpoint
 52436  func pager_stmt_commit(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:223:26: */
 52437  	bp := tls.Alloc(48)
 52438  	defer tls.Free(48)
 52439  
 52440  	var pPager uintptr
 52441  	var rc int32
 52442  	if argc != 2 {
 52443  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52444  			ts+24710 /* " ID\"" */, 0))
 52445  		return TCL_ERROR
 52446  	}
 52447  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52448  	rc = sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_RELEASE, 0)
 52449  	if rc != SQLITE_OK {
 52450  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52451  		return TCL_ERROR
 52452  	}
 52453  	return TCL_OK
 52454  }
 52455  
 52456  // Usage:   pager_stats ID
 52457  //
 52458  // Return pager statistics.
 52459  func pager_stats(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:250:26: */
 52460  	bp := tls.Alloc(140)
 52461  	defer tls.Free(140)
 52462  
 52463  	var pPager uintptr
 52464  	var i int32
 52465  	var a uintptr
 52466  	if argc != 2 {
 52467  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52468  			ts+24710 /* " ID\"" */, 0))
 52469  		return TCL_ERROR
 52470  	}
 52471  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52472  	a = sqlite3.Xsqlite3PagerStats(tls, pPager)
 52473  	for i = 0; i < 9; i++ {
 52474  		// var zBuf [100]int8 at bp+40, 100
 52475  
 52476  		tcl.XTcl_AppendElement(tls, interp, zName[i])
 52477  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+40 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(a + uintptr(i)*4))))
 52478  		tcl.XTcl_AppendElement(tls, interp, bp+40 /* &zBuf[0] */)
 52479  	}
 52480  	return TCL_OK
 52481  }
 52482  
 52483  var zName = [9]uintptr{
 52484  	ts + 24715 /* "ref" */, ts + 24719 /* "page" */, ts + 18693 /* "max" */, ts + 12279 /* "size" */, ts + 10193 /* "state" */, ts + 24724, /* "err" */
 52485  	ts + 24728 /* "hit" */, ts + 24732 /* "miss" */, ts + 24737, /* "ovfl" */
 52486  } /* test2.c:266:17 */
 52487  
 52488  // Usage:   pager_pagecount ID
 52489  //
 52490  // Return the size of the database file.
 52491  func pager_pagecount(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:283:26: */
 52492  	bp := tls.Alloc(160)
 52493  	defer tls.Free(160)
 52494  
 52495  	var pPager uintptr
 52496  	// var zBuf [100]int8 at bp+60, 100
 52497  
 52498  	// var nPage int32 at bp+56, 4
 52499  
 52500  	if argc != 2 {
 52501  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52502  			ts+24710 /* " ID\"" */, 0))
 52503  		return TCL_ERROR
 52504  	}
 52505  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52506  	sqlite3.Xsqlite3PagerPagecount(tls, pPager, bp+56 /* &nPage */)
 52507  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+60 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 56 /* nPage */))))
 52508  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 52509  	return TCL_OK
 52510  }
 52511  
 52512  // Usage:   page_get ID PGNO
 52513  //
 52514  // Return a pointer to a page from the database.
 52515  func page_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:309:26: */
 52516  	bp := tls.Alloc(188)
 52517  	defer tls.Free(188)
 52518  
 52519  	var pPager uintptr
 52520  	// var zBuf [100]int8 at bp+88, 100
 52521  
 52522  	*(*uintptr)(unsafe.Pointer(bp + 80 /* pPage */)) = uintptr(0)
 52523  	// var pgno int32 at bp+72, 4
 52524  
 52525  	var rc int32
 52526  	if argc != 3 {
 52527  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52528  			ts+24742 /* " ID PGNO\"" */, 0))
 52529  		return TCL_ERROR
 52530  	}
 52531  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52532  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+72 /* &pgno */) != 0 {
 52533  		return TCL_ERROR
 52534  	}
 52535  	rc = sqlite3.Xsqlite3PagerSharedLock(tls, pPager)
 52536  	if rc == SQLITE_OK {
 52537  		rc = sqlite3.Xsqlite3PagerGet(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* pgno */))), bp+80 /* &pPage */, 0)
 52538  	}
 52539  	if rc != SQLITE_OK {
 52540  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52541  		return TCL_ERROR
 52542  	}
 52543  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+88 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 80 /* pPage */))))
 52544  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+88 /* &zBuf[0] */, 0))
 52545  	return TCL_OK
 52546  }
 52547  
 52548  // Usage:   page_lookup ID PGNO
 52549  //
 52550  // Return a pointer to a page if the page is already in cache.
 52551  // If not in cache, return an empty string.
 52552  func page_lookup(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:346:26: */
 52553  	bp := tls.Alloc(160)
 52554  	defer tls.Free(160)
 52555  
 52556  	var pPager uintptr
 52557  	// var zBuf [100]int8 at bp+60, 100
 52558  
 52559  	var pPage uintptr
 52560  	// var pgno int32 at bp+56, 4
 52561  
 52562  	if argc != 3 {
 52563  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52564  			ts+24742 /* " ID PGNO\"" */, 0))
 52565  		return TCL_ERROR
 52566  	}
 52567  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52568  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+56 /* &pgno */) != 0 {
 52569  		return TCL_ERROR
 52570  	}
 52571  	pPage = sqlite3.Xsqlite3PagerLookup(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 56 /* pgno */))))
 52572  	if pPage != 0 {
 52573  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+60 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+32, pPage))
 52574  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 52575  	}
 52576  	return TCL_OK
 52577  }
 52578  
 52579  // Usage:   pager_truncate ID PGNO
 52580  func pager_truncate(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:374:26: */
 52581  	bp := tls.Alloc(36)
 52582  	defer tls.Free(36)
 52583  
 52584  	var pPager uintptr
 52585  	// var pgno int32 at bp+32, 4
 52586  
 52587  	if argc != 3 {
 52588  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52589  			ts+24742 /* " ID PGNO\"" */, 0))
 52590  		return TCL_ERROR
 52591  	}
 52592  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52593  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &pgno */) != 0 {
 52594  		return TCL_ERROR
 52595  	}
 52596  	sqlite3.Xsqlite3PagerTruncateImage(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 32 /* pgno */))))
 52597  	return TCL_OK
 52598  }
 52599  
 52600  // Usage:   page_unref PAGE
 52601  //
 52602  // Drop a pointer to a page.
 52603  func page_unref(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:399:26: */
 52604  	bp := tls.Alloc(32)
 52605  	defer tls.Free(32)
 52606  
 52607  	var pPage uintptr
 52608  	if argc != 2 {
 52609  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52610  			ts+24752 /* " PAGE\"" */, 0))
 52611  		return TCL_ERROR
 52612  	}
 52613  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52614  	sqlite3.Xsqlite3PagerUnref(tls, pPage)
 52615  	return TCL_OK
 52616  }
 52617  
 52618  // Usage:   page_read PAGE
 52619  //
 52620  // Return the content of a page
 52621  func page_read(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:421:26: */
 52622  	bp := tls.Alloc(148)
 52623  	defer tls.Free(148)
 52624  
 52625  	// var zBuf [100]int8 at bp+48, 100
 52626  
 52627  	var pPage uintptr
 52628  	if argc != 2 {
 52629  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52630  			ts+24752 /* " PAGE\"" */, 0))
 52631  		return TCL_ERROR
 52632  	}
 52633  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52634  	libc.Xmemcpy(tls, bp+48 /* &zBuf[0] */, sqlite3.Xsqlite3PagerGetData(tls, pPage), uint64(unsafe.Sizeof([100]int8{})))
 52635  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+48 /* &zBuf[0] */, 0))
 52636  	return TCL_OK
 52637  }
 52638  
 52639  // Usage:   page_number PAGE
 52640  //
 52641  // Return the page number for a page.
 52642  func page_number(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:445:26: */
 52643  	bp := tls.Alloc(156)
 52644  	defer tls.Free(156)
 52645  
 52646  	// var zBuf [100]int8 at bp+56, 100
 52647  
 52648  	var pPage uintptr
 52649  	if argc != 2 {
 52650  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52651  			ts+24752 /* " PAGE\"" */, 0))
 52652  		return TCL_ERROR
 52653  	}
 52654  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52655  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+56 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, sqlite3.Xsqlite3PagerPagenumber(tls, pPage)))
 52656  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 52657  	return TCL_OK
 52658  }
 52659  
 52660  // Usage:   page_write PAGE DATA
 52661  //
 52662  // Write something into a page.
 52663  func page_write(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:469:26: */
 52664  	bp := tls.Alloc(48)
 52665  	defer tls.Free(48)
 52666  
 52667  	var pPage uintptr
 52668  	var pData uintptr
 52669  	var rc int32
 52670  	if argc != 3 {
 52671  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52672  			ts+24759 /* " PAGE DATA\"" */, 0))
 52673  		return TCL_ERROR
 52674  	}
 52675  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 52676  	rc = sqlite3.Xsqlite3PagerWrite(tls, pPage)
 52677  	if rc != SQLITE_OK {
 52678  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52679  		return TCL_ERROR
 52680  	}
 52681  	pData = sqlite3.Xsqlite3PagerGetData(tls, pPage)
 52682  	libc.Xstrncpy(tls, pData, *(*uintptr)(unsafe.Pointer(argv + 2*8)), (uint64(test_pagesize - 1)))
 52683  	*(*int8)(unsafe.Pointer(pData + uintptr((test_pagesize - 1)))) = int8(0)
 52684  	return TCL_OK
 52685  }
 52686  
 52687  // Usage:   fake_big_file  N  FILENAME
 52688  //
 52689  // Write a few bytes at the N megabyte point of FILENAME.  This will
 52690  // create a large file.  If the file was a valid SQLite database, then
 52691  // the next time the database is opened, SQLite will begin allocating
 52692  // new pages after N.  If N is 2096 or bigger, this will test the
 52693  // ability of SQLite to write to large files.
 52694  func fake_big_file(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:505:26: */
 52695  	bp := tls.Alloc(96)
 52696  	defer tls.Free(96)
 52697  
 52698  	var pVfs uintptr
 52699  	*(*uintptr)(unsafe.Pointer(bp + 88 /* fd */)) = uintptr(0)
 52700  	var rc int32
 52701  	// var n int32 at bp+80, 4
 52702  
 52703  	var offset i64
 52704  	var zFile uintptr
 52705  	var nFile int32
 52706  	if argc != 3 {
 52707  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52708  			ts+24771 /* " N-MEGABYTES FIL..." */, 0))
 52709  		return TCL_ERROR
 52710  	}
 52711  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+80 /* &n */) != 0 {
 52712  		return TCL_ERROR
 52713  	}
 52714  
 52715  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 52716  	nFile = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 52717  	zFile = sqlite3.Xsqlite3_malloc(tls, (nFile + 2))
 52718  	if zFile == uintptr(0) {
 52719  		return TCL_ERROR
 52720  	}
 52721  	libc.Xmemcpy(tls, zFile, *(*uintptr)(unsafe.Pointer(argv + 2*8)), (uint64(nFile + 1)))
 52722  	*(*int8)(unsafe.Pointer(zFile + uintptr((nFile + 1)))) = int8(0)
 52723  	rc = sqlite3.Xsqlite3OsOpenMalloc(tls, pVfs, zFile, bp+88, /* &fd */
 52724  		((SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_MAIN_DB), uintptr(0))
 52725  	if rc != 0 {
 52726  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+24790 /* "open failed: " */, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52727  		sqlite3.Xsqlite3_free(tls, zFile)
 52728  		return TCL_ERROR
 52729  	}
 52730  	offset = i64(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))
 52731  	offset = offset * (int64(1024 * 1024))
 52732  	rc = sqlite3.Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* fd */)), ts+24804 /* "Hello, World!" */, 14, offset)
 52733  	sqlite3.Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* fd */)))
 52734  	sqlite3.Xsqlite3_free(tls, zFile)
 52735  	if rc != 0 {
 52736  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, ts+24818 /* "write failed: " */, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 52737  		return TCL_ERROR
 52738  	}
 52739  	return TCL_OK
 52740  }
 52741  
 52742  // test_control_pending_byte  PENDING_BYTE
 52743  //
 52744  // Set the PENDING_BYTE using the sqlite3_test_control() interface.
 52745  func testPendingByte(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:558:26: */
 52746  	bp := tls.Alloc(44)
 52747  	defer tls.Free(44)
 52748  
 52749  	// var pbyte int32 at bp+40, 4
 52750  
 52751  	var rc int32
 52752  	if argc != 2 {
 52753  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52754  			ts+24833 /* " PENDING-BYTE\"" */, uintptr(0)))
 52755  		return TCL_ERROR
 52756  	}
 52757  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+40 /* &pbyte */) != 0 {
 52758  		return TCL_ERROR
 52759  	}
 52760  	rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PENDING_BYTE, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 40 /* pbyte */))))
 52761  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 52762  	return TCL_OK
 52763  }
 52764  
 52765  // The sqlite3FaultSim() callback:
 52766  var faultSimInterp uintptr = uintptr(0) /* test2.c:580:19 */
 52767  var faultSimScriptSize int32 = 0        /* test2.c:581:12 */
 52768  var faultSimScript uintptr              /* test2.c:582:13: */
 52769  
 52770  func faultSimCallback(tls *libc.TLS, x int32) int32 { /* test2.c:583:12: */
 52771  	bp := tls.Alloc(38)
 52772  	defer tls.Free(38)
 52773  
 52774  	// var zInt [30]int8 at bp+8, 30
 52775  
 52776  	var i int32
 52777  	var isNeg int32
 52778  	var rc int32
 52779  	if x == 0 {
 52780  		libc.Xmemcpy(tls, (faultSimScript + uintptr(faultSimScriptSize)), ts+14654 /* "0" */, uint64(2))
 52781  	} else {
 52782  		// Convert x to text without using any sqlite3 routines
 52783  		if x < 0 {
 52784  			isNeg = 1
 52785  			x = -x
 52786  		} else {
 52787  			isNeg = 0
 52788  		}
 52789  		*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + 29)) = int8(0)
 52790  		i = (int32(uint64(unsafe.Sizeof([30]int8{})) - uint64(2)))
 52791  	__1:
 52792  		if !((i > 0) && (x > 0)) {
 52793  			goto __3
 52794  		}
 52795  		{
 52796  			*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + uintptr(i))) = (int8((x % 10) + '0'))
 52797  
 52798  		}
 52799  		goto __2
 52800  	__2:
 52801  		i--
 52802  		x = x / (10)
 52803  		goto __1
 52804  		goto __3
 52805  	__3:
 52806  		;
 52807  		if isNeg != 0 {
 52808  			*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + uintptr(libc.PostDecInt32(&i, 1)))) = int8('-')
 52809  		}
 52810  		libc.Xmemcpy(tls, (faultSimScript + uintptr(faultSimScriptSize)), ((bp + 8 /* &zInt[0] */ + uintptr(i)) + uintptr(1)), (uint64(unsafe.Sizeof([30]int8{})) - uint64(i)))
 52811  	}
 52812  	rc = tcl.XTcl_Eval(tls, faultSimInterp, faultSimScript)
 52813  	if rc != 0 {
 52814  		libc.Xfprintf(tls, libc.X__stderrp, ts+24848 /* "fault simulator ..." */, libc.VaList(bp, faultSimScript))
 52815  		rc = SQLITE_ERROR
 52816  	} else {
 52817  		rc = libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, faultSimInterp))
 52818  	}
 52819  	tcl.XTcl_ResetResult(tls, faultSimInterp)
 52820  	return rc
 52821  }
 52822  
 52823  // sqlite3_test_control_fault_install SCRIPT
 52824  //
 52825  // Arrange to invoke SCRIPT with the integer argument to sqlite3FaultSim()
 52826  // appended, whenever sqlite3FaultSim() is called.  Or, if SCRIPT is the
 52827  // empty string, cancel the sqlite3FaultSim() callback.
 52828  func faultInstallCmd(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:623:26: */
 52829  	bp := tls.Alloc(64)
 52830  	defer tls.Free(64)
 52831  
 52832  	var zScript uintptr
 52833  	var nScript int32
 52834  	var rc int32
 52835  	if (argc != 1) && (argc != 2) {
 52836  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52837  			ts+24884 /* " SCRIPT\"" */, uintptr(0)))
 52838  	}
 52839  	if argc == 2 {
 52840  		zScript = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 52841  	} else {
 52842  		zScript = ts + 489 /* "" */
 52843  	}
 52844  	nScript = int32(libc.Xstrlen(tls, zScript))
 52845  	if faultSimScript != 0 {
 52846  		libc.Xfree(tls, faultSimScript)
 52847  		faultSimScript = uintptr(0)
 52848  	}
 52849  	if nScript == 0 {
 52850  		rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_FAULT_INSTALL, libc.VaList(bp+32, 0))
 52851  	} else {
 52852  		faultSimScript = libc.Xmalloc(tls, (uint64(nScript + 100)))
 52853  		if faultSimScript == uintptr(0) {
 52854  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+1930 /* "out of memory" */, uintptr(0)))
 52855  			return SQLITE_ERROR
 52856  		}
 52857  		libc.Xmemcpy(tls, faultSimScript, zScript, uint64(nScript))
 52858  		*(*int8)(unsafe.Pointer(faultSimScript + uintptr(nScript))) = int8(' ')
 52859  		faultSimScriptSize = (nScript + 1)
 52860  		faultSimInterp = interp
 52861  		rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_FAULT_INSTALL, libc.VaList(bp+56, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{faultSimCallback}))))
 52862  	}
 52863  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 52864  	return SQLITE_OK
 52865  }
 52866  
 52867  // sqlite3BitvecBuiltinTest SIZE PROGRAM
 52868  //
 52869  // Invoke the SQLITE_TESTCTRL_BITVEC_TEST operator on test_control.
 52870  // See comments on sqlite3BitvecBuiltinTest() for additional information.
 52871  func testBitvecBuiltinTest(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:666:26: */
 52872  	bp := tls.Alloc(452)
 52873  	defer tls.Free(452)
 52874  
 52875  	// var sz int32 at bp+48, 4
 52876  
 52877  	var rc int32
 52878  	var nProg int32 = 0
 52879  	// var aProg [100]int32 at bp+52, 400
 52880  
 52881  	var z uintptr
 52882  	if argc != 3 {
 52883  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 52884  			ts+24893 /* " SIZE PROGRAM\"" */, uintptr(0)))
 52885  	}
 52886  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+48 /* &sz */) != 0 {
 52887  		return TCL_ERROR
 52888  	}
 52889  	z = *(*uintptr)(unsafe.Pointer(argv + 2*8))
 52890  	for (nProg < 99) && (*(*int8)(unsafe.Pointer(z)) != 0) {
 52891  		for (*(*int8)(unsafe.Pointer(z)) != 0) && !((int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0) {
 52892  			z++
 52893  		}
 52894  		if int32(*(*int8)(unsafe.Pointer(z))) == 0 {
 52895  			break
 52896  		}
 52897  		*(*int32)(unsafe.Pointer(bp + 52 /* &aProg[0] */ + uintptr(libc.PostIncInt32(&nProg, 1))*4)) = libc.Xatoi(tls, z)
 52898  		for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0 {
 52899  			z++
 52900  		}
 52901  	}
 52902  	*(*int32)(unsafe.Pointer(bp + 52 /* &aProg[0] */ + uintptr(nProg)*4)) = 0
 52903  	rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BITVEC_TEST, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 48 /* sz */)), bp+52 /* &aProg[0] */))
 52904  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 52905  	return TCL_OK
 52906  }
 52907  
 52908  // Register commands with the TCL interpreter.
 52909  func Sqlitetest2_Init(tls *libc.TLS, interp uintptr) int32 { /* test2.c:697:5: */
 52910  	var i int32
 52911  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd2)) / uint64(unsafe.Sizeof(struct {
 52912  		FzName uintptr
 52913  		FxProc uintptr
 52914  	}{}))); i++ {
 52915  		tcl.XTcl_CreateCommand(tls, interp, aCmd2[i].FzName, aCmd2[i].FxProc, uintptr(0), uintptr(0))
 52916  	}
 52917  	tcl.XTcl_LinkVar(tls, interp, ts+24908, /* "sqlite_io_error_..." */
 52918  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_pending)), TCL_LINK_INT)
 52919  	tcl.XTcl_LinkVar(tls, interp, ts+24932, /* "sqlite_io_error_..." */
 52920  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_persist)), TCL_LINK_INT)
 52921  	tcl.XTcl_LinkVar(tls, interp, ts+24956, /* "sqlite_io_error_..." */
 52922  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_hit)), TCL_LINK_INT)
 52923  	tcl.XTcl_LinkVar(tls, interp, ts+24976, /* "sqlite_io_error_..." */
 52924  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_hardhit)), TCL_LINK_INT)
 52925  	tcl.XTcl_LinkVar(tls, interp, ts+25000, /* "sqlite_diskfull_..." */
 52926  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_diskfull_pending)), TCL_LINK_INT)
 52927  	tcl.XTcl_LinkVar(tls, interp, ts+25024, /* "sqlite_diskfull" */
 52928  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_diskfull)), TCL_LINK_INT)
 52929  	tcl.XTcl_LinkVar(tls, interp, ts+25040, /* "sqlite_pending_b..." */
 52930  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3PendingByte)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 52931  	return TCL_OK
 52932  }
 52933  
 52934  var aCmd2 = [20]struct {
 52935  	FzName uintptr
 52936  	FxProc uintptr
 52937  }{
 52938  	{FzName: ts + 25060 /* "pager_open" */, FxProc: 0},
 52939  	{FzName: ts + 25071 /* "pager_close" */, FxProc: 0},
 52940  	{FzName: ts + 25083 /* "pager_commit" */, FxProc: 0},
 52941  	{FzName: ts + 25096 /* "pager_rollback" */, FxProc: 0},
 52942  	{FzName: ts + 25111 /* "pager_stmt_begin" */, FxProc: 0},
 52943  	{FzName: ts + 25128 /* "pager_stmt_commi..." */, FxProc: 0},
 52944  	{FzName: ts + 25146 /* "pager_stmt_rollb..." */, FxProc: 0},
 52945  	{FzName: ts + 25166 /* "pager_stats" */, FxProc: 0},
 52946  	{FzName: ts + 25178 /* "pager_pagecount" */, FxProc: 0},
 52947  	{FzName: ts + 25194 /* "page_get" */, FxProc: 0},
 52948  	{FzName: ts + 25203 /* "page_lookup" */, FxProc: 0},
 52949  	{FzName: ts + 25215 /* "page_unref" */, FxProc: 0},
 52950  	{FzName: ts + 25226 /* "page_read" */, FxProc: 0},
 52951  	{FzName: ts + 25236 /* "page_write" */, FxProc: 0},
 52952  	{FzName: ts + 25247 /* "page_number" */, FxProc: 0},
 52953  	{FzName: ts + 25259 /* "pager_truncate" */, FxProc: 0},
 52954  	{FzName: ts + 25274 /* "fake_big_file" */, FxProc: 0},
 52955  	{FzName: ts + 25288 /* "sqlite3BitvecBui..." */, FxProc: 0},
 52956  	{FzName: ts + 25313 /* "sqlite3_test_con..." */, FxProc: 0},
 52957  	{FzName: ts + 25347 /* "sqlite3_test_con..." */, FxProc: 0},
 52958  } /* test2.c:707:5 */
 52959  
 52960  // 2001 September 15
 52961  //
 52962  // The author disclaims copyright to this source code.  In place of
 52963  // a legal notice, here is a blessing:
 52964  //
 52965  //    May you do good and not evil.
 52966  //    May you find forgiveness for yourself and forgive others.
 52967  //    May you share freely, never taking more than you give.
 52968  //
 52969  //
 52970  // This header file defines the interface that the sqlite B-Tree file
 52971  // subsystem.  See comments in the source code for a detailed description
 52972  // of what each interface routine does.
 52973  
 52974  // TODO: This definition is just included so other modules compile. It
 52975  // needs to be revisited.
 52976  
 52977  // If defined as non-zero, auto-vacuum is enabled by default. Otherwise
 52978  // it must be turned on for each database using "PRAGMA auto_vacuum = 1".
 52979  
 52980  // Forward declarations of structure
 52981  type Btree = Btree1       /* btree.h:39:22 */
 52982  type BtCursor = BtCursor1 /* btree.h:40:25 */
 52983  type BtShared = BtShared1 /* btree.h:41:25 */
 52984  
 52985  // 2004 April 6
 52986  //
 52987  // The author disclaims copyright to this source code.  In place of
 52988  // a legal notice, here is a blessing:
 52989  //
 52990  //    May you do good and not evil.
 52991  //    May you find forgiveness for yourself and forgive others.
 52992  //    May you share freely, never taking more than you give.
 52993  //
 52994  //
 52995  // This file implements an external (disk-based) database using BTrees.
 52996  // For a detailed discussion of BTrees, refer to
 52997  //
 52998  //     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
 52999  //     "Sorting And Searching", pages 473-480. Addison-Wesley
 53000  //     Publishing Company, Reading, Massachusetts.
 53001  //
 53002  // The basic idea is that each page of the file contains N database
 53003  // entries and N+1 pointers to subpages.
 53004  //
 53005  //   ----------------------------------------------------------------
 53006  //   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
 53007  //   ----------------------------------------------------------------
 53008  //
 53009  // All of the keys on the page that Ptr(0) points to have values less
 53010  // than Key(0).  All of the keys on page Ptr(1) and its subpages have
 53011  // values greater than Key(0) and less than Key(1).  All of the keys
 53012  // on Ptr(N) and its subpages have values greater than Key(N-1).  And
 53013  // so forth.
 53014  //
 53015  // Finding a particular key requires reading O(log(M)) pages from the
 53016  // disk where M is the number of entries in the tree.
 53017  //
 53018  // In this implementation, a single file can hold one or more separate
 53019  // BTrees.  Each BTree is identified by the index of its root page.  The
 53020  // key and data for any entry are combined to form the "payload".  A
 53021  // fixed amount of payload can be carried directly on the database
 53022  // page.  If the payload is larger than the preset amount then surplus
 53023  // bytes are stored on overflow pages.  The payload for an entry
 53024  // and the preceding pointer are combined to form a "Cell".  Each
 53025  // page has a small header which contains the Ptr(N) pointer and other
 53026  // information such as the size of key and data.
 53027  //
 53028  // FORMAT DETAILS
 53029  //
 53030  // The file is divided into pages.  The first page is called page 1,
 53031  // the second is page 2, and so forth.  A page number of zero indicates
 53032  // "no such page".  The page size can be any power of 2 between 512 and 65536.
 53033  // Each page can be either a btree page, a freelist page, an overflow
 53034  // page, or a pointer-map page.
 53035  //
 53036  // The first page is always a btree page.  The first 100 bytes of the first
 53037  // page contain a special header (the "file header") that describes the file.
 53038  // The format of the file header is as follows:
 53039  //
 53040  //   OFFSET   SIZE    DESCRIPTION
 53041  //      0      16     Header string: "SQLite format 3\000"
 53042  //     16       2     Page size in bytes.  (1 means 65536)
 53043  //     18       1     File format write version
 53044  //     19       1     File format read version
 53045  //     20       1     Bytes of unused space at the end of each page
 53046  //     21       1     Max embedded payload fraction (must be 64)
 53047  //     22       1     Min embedded payload fraction (must be 32)
 53048  //     23       1     Min leaf payload fraction (must be 32)
 53049  //     24       4     File change counter
 53050  //     28       4     Reserved for future use
 53051  //     32       4     First freelist page
 53052  //     36       4     Number of freelist pages in the file
 53053  //     40      60     15 4-byte meta values passed to higher layers
 53054  //
 53055  //     40       4     Schema cookie
 53056  //     44       4     File format of schema layer
 53057  //     48       4     Size of page cache
 53058  //     52       4     Largest root-page (auto/incr_vacuum)
 53059  //     56       4     1=UTF-8 2=UTF16le 3=UTF16be
 53060  //     60       4     User version
 53061  //     64       4     Incremental vacuum mode
 53062  //     68       4     Application-ID
 53063  //     72      20     unused
 53064  //     92       4     The version-valid-for number
 53065  //     96       4     SQLITE_VERSION_NUMBER
 53066  //
 53067  // All of the integer values are big-endian (most significant byte first).
 53068  //
 53069  // The file change counter is incremented when the database is changed
 53070  // This counter allows other processes to know when the file has changed
 53071  // and thus when they need to flush their cache.
 53072  //
 53073  // The max embedded payload fraction is the amount of the total usable
 53074  // space in a page that can be consumed by a single cell for standard
 53075  // B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default
 53076  // is to limit the maximum cell size so that at least 4 cells will fit
 53077  // on one page.  Thus the default max embedded payload fraction is 64.
 53078  //
 53079  // If the payload for a cell is larger than the max payload, then extra
 53080  // payload is spilled to overflow pages.  Once an overflow page is allocated,
 53081  // as many bytes as possible are moved into the overflow pages without letting
 53082  // the cell size drop below the min embedded payload fraction.
 53083  //
 53084  // The min leaf payload fraction is like the min embedded payload fraction
 53085  // except that it applies to leaf nodes in a LEAFDATA tree.  The maximum
 53086  // payload fraction for a LEAFDATA tree is always 100% (or 255) and it
 53087  // not specified in the header.
 53088  //
 53089  // Each btree pages is divided into three sections:  The header, the
 53090  // cell pointer array, and the cell content area.  Page 1 also has a 100-byte
 53091  // file header that occurs before the page header.
 53092  //
 53093  //      |----------------|
 53094  //      | file header    |   100 bytes.  Page 1 only.
 53095  //      |----------------|
 53096  //      | page header    |   8 bytes for leaves.  12 bytes for interior nodes
 53097  //      |----------------|
 53098  //      | cell pointer   |   |  2 bytes per cell.  Sorted order.
 53099  //      | array          |   |  Grows downward
 53100  //      |                |   v
 53101  //      |----------------|
 53102  //      | unallocated    |
 53103  //      | space          |
 53104  //      |----------------|   ^  Grows upwards
 53105  //      | cell content   |   |  Arbitrary order interspersed with freeblocks.
 53106  //      | area           |   |  and free space fragments.
 53107  //      |----------------|
 53108  //
 53109  // The page headers looks like this:
 53110  //
 53111  //   OFFSET   SIZE     DESCRIPTION
 53112  //      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
 53113  //      1       2      byte offset to the first freeblock
 53114  //      3       2      number of cells on this page
 53115  //      5       2      first byte of the cell content area
 53116  //      7       1      number of fragmented free bytes
 53117  //      8       4      Right child (the Ptr(N) value).  Omitted on leaves.
 53118  //
 53119  // The flags define the format of this btree page.  The leaf flag means that
 53120  // this page has no children.  The zerodata flag means that this page carries
 53121  // only keys and no data.  The intkey flag means that the key is an integer
 53122  // which is stored in the key size entry of the cell header rather than in
 53123  // the payload area.
 53124  //
 53125  // The cell pointer array begins on the first byte after the page header.
 53126  // The cell pointer array contains zero or more 2-byte numbers which are
 53127  // offsets from the beginning of the page to the cell content in the cell
 53128  // content area.  The cell pointers occur in sorted order.  The system strives
 53129  // to keep free space after the last cell pointer so that new cells can
 53130  // be easily added without having to defragment the page.
 53131  //
 53132  // Cell content is stored at the very end of the page and grows toward the
 53133  // beginning of the page.
 53134  //
 53135  // Unused space within the cell content area is collected into a linked list of
 53136  // freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset
 53137  // to the first freeblock is given in the header.  Freeblocks occur in
 53138  // increasing order.  Because a freeblock must be at least 4 bytes in size,
 53139  // any group of 3 or fewer unused bytes in the cell content area cannot
 53140  // exist on the freeblock chain.  A group of 3 or fewer free bytes is called
 53141  // a fragment.  The total number of bytes in all fragments is recorded.
 53142  // in the page header at offset 7.
 53143  //
 53144  //    SIZE    DESCRIPTION
 53145  //      2     Byte offset of the next freeblock
 53146  //      2     Bytes in this freeblock
 53147  //
 53148  // Cells are of variable length.  Cells are stored in the cell content area at
 53149  // the end of the page.  Pointers to the cells are in the cell pointer array
 53150  // that immediately follows the page header.  Cells is not necessarily
 53151  // contiguous or in order, but cell pointers are contiguous and in order.
 53152  //
 53153  // Cell content makes use of variable length integers.  A variable
 53154  // length integer is 1 to 9 bytes where the lower 7 bits of each
 53155  // byte are used.  The integer consists of all bytes that have bit 8 set and
 53156  // the first byte with bit 8 clear.  The most significant byte of the integer
 53157  // appears first.  A variable-length integer may not be more than 9 bytes long.
 53158  // As a special case, all 8 bytes of the 9th byte are used as data.  This
 53159  // allows a 64-bit integer to be encoded in 9 bytes.
 53160  //
 53161  //    0x00                      becomes  0x00000000
 53162  //    0x7f                      becomes  0x0000007f
 53163  //    0x81 0x00                 becomes  0x00000080
 53164  //    0x82 0x00                 becomes  0x00000100
 53165  //    0x80 0x7f                 becomes  0x0000007f
 53166  //    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678
 53167  //    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081
 53168  //
 53169  // Variable length integers are used for rowids and to hold the number of
 53170  // bytes of key and data in a btree cell.
 53171  //
 53172  // The content of a cell looks like this:
 53173  //
 53174  //    SIZE    DESCRIPTION
 53175  //      4     Page number of the left child. Omitted if leaf flag is set.
 53176  //     var    Number of bytes of data. Omitted if the zerodata flag is set.
 53177  //     var    Number of bytes of key. Or the key itself if intkey flag is set.
 53178  //      *     Payload
 53179  //      4     First page of the overflow chain.  Omitted if no overflow
 53180  //
 53181  // Overflow pages form a linked list.  Each page except the last is completely
 53182  // filled with data (pagesize - 4 bytes).  The last page can have as little
 53183  // as 1 byte of data.
 53184  //
 53185  //    SIZE    DESCRIPTION
 53186  //      4     Page number of next overflow page
 53187  //      *     Data
 53188  //
 53189  // Freelist pages come in two subtypes: trunk pages and leaf pages.  The
 53190  // file header points to the first in a linked list of trunk page.  Each trunk
 53191  // page points to multiple leaf pages.  The content of a leaf page is
 53192  // unspecified.  A trunk page looks like this:
 53193  //
 53194  //    SIZE    DESCRIPTION
 53195  //      4     Page number of next trunk page
 53196  //      4     Number of leaf pointers on this page
 53197  //      *     zero or more pages numbers of leaves
 53198  // 2001 September 15
 53199  //
 53200  // The author disclaims copyright to this source code.  In place of
 53201  // a legal notice, here is a blessing:
 53202  //
 53203  //    May you do good and not evil.
 53204  //    May you find forgiveness for yourself and forgive others.
 53205  //    May you share freely, never taking more than you give.
 53206  //
 53207  //
 53208  // Internal interface definitions for SQLite.
 53209  //
 53210  
 53211  // The following value is the maximum cell size assuming a maximum page
 53212  // size give above.
 53213  
 53214  // The maximum number of cells on a single page of the database.  This
 53215  // assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself
 53216  // plus 2 bytes for the index to the cell in the page header).  Such
 53217  // small cells will be rare, but they are possible.
 53218  
 53219  // Forward declarations
 53220  type MemPage1 = struct {
 53221  	FisInit          u8
 53222  	FbBusy           u8
 53223  	FintKey          u8
 53224  	FintKeyLeaf      u8
 53225  	Fpgno            Pgno
 53226  	Fleaf            u8
 53227  	FhdrOffset       u8
 53228  	FchildPtrSize    u8
 53229  	Fmax1bytePayload u8
 53230  	FnOverflow       u8
 53231  	_                [1]byte
 53232  	FmaxLocal        u16
 53233  	FminLocal        u16
 53234  	FcellOffset      u16
 53235  	FnFree           int32
 53236  	FnCell           u16
 53237  	FmaskPage        u16
 53238  	FaiOvfl          [4]u16
 53239  	_                [4]byte
 53240  	FapOvfl          [4]uintptr
 53241  	FpBt             uintptr
 53242  	FaData           uintptr
 53243  	FaDataEnd        uintptr
 53244  	FaCellIdx        uintptr
 53245  	FaDataOfst       uintptr
 53246  	FpDbPage         uintptr
 53247  	FxCellSize       uintptr
 53248  	FxParseCell      uintptr
 53249  } /* btree.h:39:9 */
 53250  
 53251  // 2004 April 6
 53252  //
 53253  // The author disclaims copyright to this source code.  In place of
 53254  // a legal notice, here is a blessing:
 53255  //
 53256  //    May you do good and not evil.
 53257  //    May you find forgiveness for yourself and forgive others.
 53258  //    May you share freely, never taking more than you give.
 53259  //
 53260  //
 53261  // This file implements an external (disk-based) database using BTrees.
 53262  // For a detailed discussion of BTrees, refer to
 53263  //
 53264  //     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
 53265  //     "Sorting And Searching", pages 473-480. Addison-Wesley
 53266  //     Publishing Company, Reading, Massachusetts.
 53267  //
 53268  // The basic idea is that each page of the file contains N database
 53269  // entries and N+1 pointers to subpages.
 53270  //
 53271  //   ----------------------------------------------------------------
 53272  //   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
 53273  //   ----------------------------------------------------------------
 53274  //
 53275  // All of the keys on the page that Ptr(0) points to have values less
 53276  // than Key(0).  All of the keys on page Ptr(1) and its subpages have
 53277  // values greater than Key(0) and less than Key(1).  All of the keys
 53278  // on Ptr(N) and its subpages have values greater than Key(N-1).  And
 53279  // so forth.
 53280  //
 53281  // Finding a particular key requires reading O(log(M)) pages from the
 53282  // disk where M is the number of entries in the tree.
 53283  //
 53284  // In this implementation, a single file can hold one or more separate
 53285  // BTrees.  Each BTree is identified by the index of its root page.  The
 53286  // key and data for any entry are combined to form the "payload".  A
 53287  // fixed amount of payload can be carried directly on the database
 53288  // page.  If the payload is larger than the preset amount then surplus
 53289  // bytes are stored on overflow pages.  The payload for an entry
 53290  // and the preceding pointer are combined to form a "Cell".  Each
 53291  // page has a small header which contains the Ptr(N) pointer and other
 53292  // information such as the size of key and data.
 53293  //
 53294  // FORMAT DETAILS
 53295  //
 53296  // The file is divided into pages.  The first page is called page 1,
 53297  // the second is page 2, and so forth.  A page number of zero indicates
 53298  // "no such page".  The page size can be any power of 2 between 512 and 65536.
 53299  // Each page can be either a btree page, a freelist page, an overflow
 53300  // page, or a pointer-map page.
 53301  //
 53302  // The first page is always a btree page.  The first 100 bytes of the first
 53303  // page contain a special header (the "file header") that describes the file.
 53304  // The format of the file header is as follows:
 53305  //
 53306  //   OFFSET   SIZE    DESCRIPTION
 53307  //      0      16     Header string: "SQLite format 3\000"
 53308  //     16       2     Page size in bytes.  (1 means 65536)
 53309  //     18       1     File format write version
 53310  //     19       1     File format read version
 53311  //     20       1     Bytes of unused space at the end of each page
 53312  //     21       1     Max embedded payload fraction (must be 64)
 53313  //     22       1     Min embedded payload fraction (must be 32)
 53314  //     23       1     Min leaf payload fraction (must be 32)
 53315  //     24       4     File change counter
 53316  //     28       4     Reserved for future use
 53317  //     32       4     First freelist page
 53318  //     36       4     Number of freelist pages in the file
 53319  //     40      60     15 4-byte meta values passed to higher layers
 53320  //
 53321  //     40       4     Schema cookie
 53322  //     44       4     File format of schema layer
 53323  //     48       4     Size of page cache
 53324  //     52       4     Largest root-page (auto/incr_vacuum)
 53325  //     56       4     1=UTF-8 2=UTF16le 3=UTF16be
 53326  //     60       4     User version
 53327  //     64       4     Incremental vacuum mode
 53328  //     68       4     Application-ID
 53329  //     72      20     unused
 53330  //     92       4     The version-valid-for number
 53331  //     96       4     SQLITE_VERSION_NUMBER
 53332  //
 53333  // All of the integer values are big-endian (most significant byte first).
 53334  //
 53335  // The file change counter is incremented when the database is changed
 53336  // This counter allows other processes to know when the file has changed
 53337  // and thus when they need to flush their cache.
 53338  //
 53339  // The max embedded payload fraction is the amount of the total usable
 53340  // space in a page that can be consumed by a single cell for standard
 53341  // B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default
 53342  // is to limit the maximum cell size so that at least 4 cells will fit
 53343  // on one page.  Thus the default max embedded payload fraction is 64.
 53344  //
 53345  // If the payload for a cell is larger than the max payload, then extra
 53346  // payload is spilled to overflow pages.  Once an overflow page is allocated,
 53347  // as many bytes as possible are moved into the overflow pages without letting
 53348  // the cell size drop below the min embedded payload fraction.
 53349  //
 53350  // The min leaf payload fraction is like the min embedded payload fraction
 53351  // except that it applies to leaf nodes in a LEAFDATA tree.  The maximum
 53352  // payload fraction for a LEAFDATA tree is always 100% (or 255) and it
 53353  // not specified in the header.
 53354  //
 53355  // Each btree pages is divided into three sections:  The header, the
 53356  // cell pointer array, and the cell content area.  Page 1 also has a 100-byte
 53357  // file header that occurs before the page header.
 53358  //
 53359  //      |----------------|
 53360  //      | file header    |   100 bytes.  Page 1 only.
 53361  //      |----------------|
 53362  //      | page header    |   8 bytes for leaves.  12 bytes for interior nodes
 53363  //      |----------------|
 53364  //      | cell pointer   |   |  2 bytes per cell.  Sorted order.
 53365  //      | array          |   |  Grows downward
 53366  //      |                |   v
 53367  //      |----------------|
 53368  //      | unallocated    |
 53369  //      | space          |
 53370  //      |----------------|   ^  Grows upwards
 53371  //      | cell content   |   |  Arbitrary order interspersed with freeblocks.
 53372  //      | area           |   |  and free space fragments.
 53373  //      |----------------|
 53374  //
 53375  // The page headers looks like this:
 53376  //
 53377  //   OFFSET   SIZE     DESCRIPTION
 53378  //      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
 53379  //      1       2      byte offset to the first freeblock
 53380  //      3       2      number of cells on this page
 53381  //      5       2      first byte of the cell content area
 53382  //      7       1      number of fragmented free bytes
 53383  //      8       4      Right child (the Ptr(N) value).  Omitted on leaves.
 53384  //
 53385  // The flags define the format of this btree page.  The leaf flag means that
 53386  // this page has no children.  The zerodata flag means that this page carries
 53387  // only keys and no data.  The intkey flag means that the key is an integer
 53388  // which is stored in the key size entry of the cell header rather than in
 53389  // the payload area.
 53390  //
 53391  // The cell pointer array begins on the first byte after the page header.
 53392  // The cell pointer array contains zero or more 2-byte numbers which are
 53393  // offsets from the beginning of the page to the cell content in the cell
 53394  // content area.  The cell pointers occur in sorted order.  The system strives
 53395  // to keep free space after the last cell pointer so that new cells can
 53396  // be easily added without having to defragment the page.
 53397  //
 53398  // Cell content is stored at the very end of the page and grows toward the
 53399  // beginning of the page.
 53400  //
 53401  // Unused space within the cell content area is collected into a linked list of
 53402  // freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset
 53403  // to the first freeblock is given in the header.  Freeblocks occur in
 53404  // increasing order.  Because a freeblock must be at least 4 bytes in size,
 53405  // any group of 3 or fewer unused bytes in the cell content area cannot
 53406  // exist on the freeblock chain.  A group of 3 or fewer free bytes is called
 53407  // a fragment.  The total number of bytes in all fragments is recorded.
 53408  // in the page header at offset 7.
 53409  //
 53410  //    SIZE    DESCRIPTION
 53411  //      2     Byte offset of the next freeblock
 53412  //      2     Bytes in this freeblock
 53413  //
 53414  // Cells are of variable length.  Cells are stored in the cell content area at
 53415  // the end of the page.  Pointers to the cells are in the cell pointer array
 53416  // that immediately follows the page header.  Cells is not necessarily
 53417  // contiguous or in order, but cell pointers are contiguous and in order.
 53418  //
 53419  // Cell content makes use of variable length integers.  A variable
 53420  // length integer is 1 to 9 bytes where the lower 7 bits of each
 53421  // byte are used.  The integer consists of all bytes that have bit 8 set and
 53422  // the first byte with bit 8 clear.  The most significant byte of the integer
 53423  // appears first.  A variable-length integer may not be more than 9 bytes long.
 53424  // As a special case, all 8 bytes of the 9th byte are used as data.  This
 53425  // allows a 64-bit integer to be encoded in 9 bytes.
 53426  //
 53427  //    0x00                      becomes  0x00000000
 53428  //    0x7f                      becomes  0x0000007f
 53429  //    0x81 0x00                 becomes  0x00000080
 53430  //    0x82 0x00                 becomes  0x00000100
 53431  //    0x80 0x7f                 becomes  0x0000007f
 53432  //    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678
 53433  //    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081
 53434  //
 53435  // Variable length integers are used for rowids and to hold the number of
 53436  // bytes of key and data in a btree cell.
 53437  //
 53438  // The content of a cell looks like this:
 53439  //
 53440  //    SIZE    DESCRIPTION
 53441  //      4     Page number of the left child. Omitted if leaf flag is set.
 53442  //     var    Number of bytes of data. Omitted if the zerodata flag is set.
 53443  //     var    Number of bytes of key. Or the key itself if intkey flag is set.
 53444  //      *     Payload
 53445  //      4     First page of the overflow chain.  Omitted if no overflow
 53446  //
 53447  // Overflow pages form a linked list.  Each page except the last is completely
 53448  // filled with data (pagesize - 4 bytes).  The last page can have as little
 53449  // as 1 byte of data.
 53450  //
 53451  //    SIZE    DESCRIPTION
 53452  //      4     Page number of next overflow page
 53453  //      *     Data
 53454  //
 53455  // Freelist pages come in two subtypes: trunk pages and leaf pages.  The
 53456  // file header points to the first in a linked list of trunk page.  Each trunk
 53457  // page points to multiple leaf pages.  The content of a leaf page is
 53458  // unspecified.  A trunk page looks like this:
 53459  //
 53460  //    SIZE    DESCRIPTION
 53461  //      4     Page number of next trunk page
 53462  //      4     Number of leaf pointers on this page
 53463  //      *     zero or more pages numbers of leaves
 53464  // 2001 September 15
 53465  //
 53466  // The author disclaims copyright to this source code.  In place of
 53467  // a legal notice, here is a blessing:
 53468  //
 53469  //    May you do good and not evil.
 53470  //    May you find forgiveness for yourself and forgive others.
 53471  //    May you share freely, never taking more than you give.
 53472  //
 53473  //
 53474  // Internal interface definitions for SQLite.
 53475  //
 53476  
 53477  // The following value is the maximum cell size assuming a maximum page
 53478  // size give above.
 53479  
 53480  // The maximum number of cells on a single page of the database.  This
 53481  // assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself
 53482  // plus 2 bytes for the index to the cell in the page header).  Such
 53483  // small cells will be rare, but they are possible.
 53484  
 53485  // Forward declarations
 53486  type MemPage = MemPage1 /* btreeInt.h:232:24 */
 53487  type BtLock1 = struct {
 53488  	FpBtree uintptr
 53489  	FiTable Pgno
 53490  	FeLock  u8
 53491  	_       [3]byte
 53492  	FpNext  uintptr
 53493  } /* btree.h:39:9 */
 53494  
 53495  type BtLock = BtLock1 /* btreeInt.h:233:23 */
 53496  type CellInfo1 = struct {
 53497  	FnKey     i64
 53498  	FpPayload uintptr
 53499  	FnPayload u32
 53500  	FnLocal   u16
 53501  	FnSize    u16
 53502  } /* btree.h:39:9 */
 53503  
 53504  type CellInfo = CellInfo1 /* btreeInt.h:234:25 */
 53505  
 53506  // Legal values for BtCursor.curFlags
 53507  
 53508  // Potential values for BtCursor.eState.
 53509  //
 53510  // CURSOR_INVALID:
 53511  //   Cursor does not point to a valid entry. This can happen (for example)
 53512  //   because the table is empty or because BtreeCursorFirst() has not been
 53513  //   called.
 53514  //
 53515  // CURSOR_VALID:
 53516  //   Cursor points to a valid entry. getPayload() etc. may be called.
 53517  //
 53518  // CURSOR_SKIPNEXT:
 53519  //   Cursor is valid except that the Cursor.skipNext field is non-zero
 53520  //   indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
 53521  //   operation should be a no-op.
 53522  //
 53523  // CURSOR_REQUIRESEEK:
 53524  //   The table that this cursor was opened on still exists, but has been
 53525  //   modified since the cursor was last used. The cursor position is saved
 53526  //   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
 53527  //   this state, restoreCursorPosition() can be called to attempt to
 53528  //   seek the cursor to the saved position.
 53529  //
 53530  // CURSOR_FAULT:
 53531  //   An unrecoverable error (an I/O error or a malloc failure) has occurred
 53532  //   on a different connection that shares the BtShared cache with this
 53533  //   cursor.  The error has left the cache in an inconsistent state.
 53534  //   Do nothing else with this cursor.  Any attempt to use the cursor
 53535  //   should return the error code stored in BtCursor.skipNext
 53536  
 53537  // The database page the PENDING_BYTE occupies. This page is never used.
 53538  
 53539  // These macros define the location of the pointer-map entry for a
 53540  // database page. The first argument to each is the number of usable
 53541  // bytes on each page of the database (often 1024). The second is the
 53542  // page number to look up in the pointer map.
 53543  //
 53544  // PTRMAP_PAGENO returns the database page number of the pointer-map
 53545  // page that stores the required pointer. PTRMAP_PTROFFSET returns
 53546  // the offset of the requested map entry.
 53547  //
 53548  // If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
 53549  // then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
 53550  // used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
 53551  // this test.
 53552  
 53553  // The pointer map is a lookup table that identifies the parent page for
 53554  // each child page in the database file.  The parent page is the page that
 53555  // contains a pointer to the child.  Every page in the database contains
 53556  // 0 or 1 parent pages.  (In this context 'database page' refers
 53557  // to any page that is not part of the pointer map itself.)  Each pointer map
 53558  // entry consists of a single byte 'type' and a 4 byte parent page number.
 53559  // The PTRMAP_XXX identifiers below are the valid types.
 53560  //
 53561  // The purpose of the pointer map is to facility moving pages from one
 53562  // position in the file to another as part of autovacuum.  When a page
 53563  // is moved, the pointer in its parent must be updated to point to the
 53564  // new location.  The pointer map is used to locate the parent page quickly.
 53565  //
 53566  // PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
 53567  //                  used in this case.
 53568  //
 53569  // PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
 53570  //                  is not used in this case.
 53571  //
 53572  // PTRMAP_OVERFLOW1: The database page is the first page in a list of
 53573  //                   overflow pages. The page number identifies the page that
 53574  //                   contains the cell with a pointer to this overflow page.
 53575  //
 53576  // PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
 53577  //                   overflow pages. The page-number identifies the previous
 53578  //                   page in the overflow page list.
 53579  //
 53580  // PTRMAP_BTREE: The database page is a non-root btree page. The page number
 53581  //               identifies the parent page in the btree.
 53582  
 53583  // A bunch of assert() statements to check the transaction state variables
 53584  // of handle p (type Btree*) are internally consistent.
 53585  
 53586  // The ISAUTOVACUUM macro is used within balance_nonroot() to determine
 53587  // if the database supports auto-vacuum or not. Because it is used
 53588  // within an expression that is an argument to another macro
 53589  // (sqliteMallocRaw), it is not possible to use conditional compilation.
 53590  // So, this macro is defined instead.
 53591  
 53592  // This structure is passed around through all the sanity checking routines
 53593  // in order to keep track of some global state information.
 53594  //
 53595  // The aRef[] array is allocated so that there is 1 bit for each page in
 53596  // the database. As the integrity-check proceeds, for each page used in
 53597  // the database the corresponding bit is set. This allows integrity-check to
 53598  // detect pages that are used twice and orphaned pages (both of which
 53599  // indicate corruption).
 53600  type IntegrityCk1 = struct {
 53601  	FpBt       uintptr
 53602  	FpPager    uintptr
 53603  	FaPgRef    uintptr
 53604  	FnPage     Pgno
 53605  	FmxErr     int32
 53606  	FnErr      int32
 53607  	FbOomFault int32
 53608  	FzPfx      uintptr
 53609  	Fv1        Pgno
 53610  	Fv2        int32
 53611  	FerrMsg    StrAccum
 53612  	Fheap      uintptr
 53613  	Fdb        uintptr
 53614  } /* btreeInt.h:692:9 */
 53615  
 53616  // Legal values for BtCursor.curFlags
 53617  
 53618  // Potential values for BtCursor.eState.
 53619  //
 53620  // CURSOR_INVALID:
 53621  //   Cursor does not point to a valid entry. This can happen (for example)
 53622  //   because the table is empty or because BtreeCursorFirst() has not been
 53623  //   called.
 53624  //
 53625  // CURSOR_VALID:
 53626  //   Cursor points to a valid entry. getPayload() etc. may be called.
 53627  //
 53628  // CURSOR_SKIPNEXT:
 53629  //   Cursor is valid except that the Cursor.skipNext field is non-zero
 53630  //   indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
 53631  //   operation should be a no-op.
 53632  //
 53633  // CURSOR_REQUIRESEEK:
 53634  //   The table that this cursor was opened on still exists, but has been
 53635  //   modified since the cursor was last used. The cursor position is saved
 53636  //   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
 53637  //   this state, restoreCursorPosition() can be called to attempt to
 53638  //   seek the cursor to the saved position.
 53639  //
 53640  // CURSOR_FAULT:
 53641  //   An unrecoverable error (an I/O error or a malloc failure) has occurred
 53642  //   on a different connection that shares the BtShared cache with this
 53643  //   cursor.  The error has left the cache in an inconsistent state.
 53644  //   Do nothing else with this cursor.  Any attempt to use the cursor
 53645  //   should return the error code stored in BtCursor.skipNext
 53646  
 53647  // The database page the PENDING_BYTE occupies. This page is never used.
 53648  
 53649  // These macros define the location of the pointer-map entry for a
 53650  // database page. The first argument to each is the number of usable
 53651  // bytes on each page of the database (often 1024). The second is the
 53652  // page number to look up in the pointer map.
 53653  //
 53654  // PTRMAP_PAGENO returns the database page number of the pointer-map
 53655  // page that stores the required pointer. PTRMAP_PTROFFSET returns
 53656  // the offset of the requested map entry.
 53657  //
 53658  // If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
 53659  // then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
 53660  // used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
 53661  // this test.
 53662  
 53663  // The pointer map is a lookup table that identifies the parent page for
 53664  // each child page in the database file.  The parent page is the page that
 53665  // contains a pointer to the child.  Every page in the database contains
 53666  // 0 or 1 parent pages.  (In this context 'database page' refers
 53667  // to any page that is not part of the pointer map itself.)  Each pointer map
 53668  // entry consists of a single byte 'type' and a 4 byte parent page number.
 53669  // The PTRMAP_XXX identifiers below are the valid types.
 53670  //
 53671  // The purpose of the pointer map is to facility moving pages from one
 53672  // position in the file to another as part of autovacuum.  When a page
 53673  // is moved, the pointer in its parent must be updated to point to the
 53674  // new location.  The pointer map is used to locate the parent page quickly.
 53675  //
 53676  // PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
 53677  //                  used in this case.
 53678  //
 53679  // PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
 53680  //                  is not used in this case.
 53681  //
 53682  // PTRMAP_OVERFLOW1: The database page is the first page in a list of
 53683  //                   overflow pages. The page number identifies the page that
 53684  //                   contains the cell with a pointer to this overflow page.
 53685  //
 53686  // PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
 53687  //                   overflow pages. The page-number identifies the previous
 53688  //                   page in the overflow page list.
 53689  //
 53690  // PTRMAP_BTREE: The database page is a non-root btree page. The page number
 53691  //               identifies the parent page in the btree.
 53692  
 53693  // A bunch of assert() statements to check the transaction state variables
 53694  // of handle p (type Btree*) are internally consistent.
 53695  
 53696  // The ISAUTOVACUUM macro is used within balance_nonroot() to determine
 53697  // if the database supports auto-vacuum or not. Because it is used
 53698  // within an expression that is an argument to another macro
 53699  // (sqliteMallocRaw), it is not possible to use conditional compilation.
 53700  // So, this macro is defined instead.
 53701  
 53702  // This structure is passed around through all the sanity checking routines
 53703  // in order to keep track of some global state information.
 53704  //
 53705  // The aRef[] array is allocated so that there is 1 bit for each page in
 53706  // the database. As the integrity-check proceeds, for each page used in
 53707  // the database the corresponding bit is set. This allows integrity-check to
 53708  // detect pages that are used twice and orphaned pages (both of which
 53709  // indicate corruption).
 53710  type IntegrityCk = IntegrityCk1 /* btreeInt.h:692:28 */
 53711  
 53712  // A bogus sqlite3 connection structure for use in the btree
 53713  // tests.
 53714  var sDb sqlite31          /* test3.c:32:16: */
 53715  var nRefSqlite3 int32 = 0 /* test3.c:33:12 */
 53716  
 53717  // Usage:   btree_open FILENAME NCACHE
 53718  //
 53719  // Open a new database
 53720  func btree_open(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:40:26: */
 53721  	bp := tls.Alloc(188)
 53722  	defer tls.Free(188)
 53723  
 53724  	// var pBt uintptr at bp+80, 8
 53725  
 53726  	var rc int32
 53727  	// var nCache int32 at bp+72, 4
 53728  
 53729  	// var zBuf [100]int8 at bp+88, 100
 53730  
 53731  	var n int32
 53732  	var zFilename uintptr
 53733  	if argc != 3 {
 53734  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53735  			ts+25382 /* " FILENAME NCACHE..." */, 0))
 53736  		return TCL_ERROR
 53737  	}
 53738  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+72 /* &nCache */) != 0 {
 53739  		return TCL_ERROR
 53740  	}
 53741  	nRefSqlite3++
 53742  	if nRefSqlite3 == 1 {
 53743  		sDb.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 53744  		sDb.Fmutex = sqlite3.Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_RECURSIVE)
 53745  		sqlite3.Xsqlite3_mutex_enter(tls, sDb.Fmutex)
 53746  	}
 53747  	n = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 53748  	zFilename = sqlite3.Xsqlite3_malloc(tls, (n + 2))
 53749  	if zFilename == uintptr(0) {
 53750  		return TCL_ERROR
 53751  	}
 53752  	libc.Xmemcpy(tls, zFilename, *(*uintptr)(unsafe.Pointer(argv + 1*8)), (uint64(n + 1)))
 53753  	*(*int8)(unsafe.Pointer(zFilename + uintptr((n + 1)))) = int8(0)
 53754  	rc = sqlite3.Xsqlite3BtreeOpen(tls, sDb.FpVfs, zFilename, uintptr(unsafe.Pointer(&sDb)), bp+80 /* &pBt */, 0,
 53755  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_MAIN_DB))
 53756  	sqlite3.Xsqlite3_free(tls, zFilename)
 53757  	if rc != SQLITE_OK {
 53758  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53759  		return TCL_ERROR
 53760  	}
 53761  	sqlite3.Xsqlite3BtreeSetCacheSize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pBt */)), *(*int32)(unsafe.Pointer(bp + 72 /* nCache */)))
 53762  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+88 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 80 /* pBt */))))
 53763  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+88 /* &zBuf[0] */, 0))
 53764  	return TCL_OK
 53765  }
 53766  
 53767  // Usage:   btree_close ID
 53768  //
 53769  // Close the given database.
 53770  func btree_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:86:26: */
 53771  	bp := tls.Alloc(48)
 53772  	defer tls.Free(48)
 53773  
 53774  	var pBt uintptr
 53775  	var rc int32
 53776  	if argc != 2 {
 53777  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53778  			ts+24710 /* " ID\"" */, 0))
 53779  		return TCL_ERROR
 53780  	}
 53781  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53782  	rc = sqlite3.Xsqlite3BtreeClose(tls, pBt)
 53783  	if rc != SQLITE_OK {
 53784  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53785  		return TCL_ERROR
 53786  	}
 53787  	nRefSqlite3--
 53788  	if nRefSqlite3 == 0 {
 53789  		sqlite3.Xsqlite3_mutex_leave(tls, sDb.Fmutex)
 53790  		sqlite3.Xsqlite3_mutex_free(tls, sDb.Fmutex)
 53791  		sDb.Fmutex = uintptr(0)
 53792  		sDb.FpVfs = uintptr(0)
 53793  	}
 53794  	return TCL_OK
 53795  }
 53796  
 53797  // Usage:   btree_begin_transaction ID
 53798  //
 53799  // Start a new transaction
 53800  func btree_begin_transaction(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:121:26: */
 53801  	bp := tls.Alloc(48)
 53802  	defer tls.Free(48)
 53803  
 53804  	var pBt uintptr
 53805  	var rc int32
 53806  	if argc != 2 {
 53807  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53808  			ts+24710 /* " ID\"" */, 0))
 53809  		return TCL_ERROR
 53810  	}
 53811  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53812  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 53813  	rc = sqlite3.Xsqlite3BtreeBeginTrans(tls, pBt, 1, uintptr(0))
 53814  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 53815  	if rc != SQLITE_OK {
 53816  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53817  		return TCL_ERROR
 53818  	}
 53819  	return TCL_OK
 53820  }
 53821  
 53822  // Usage:   btree_pager_stats ID
 53823  //
 53824  // Returns pager statistics
 53825  func btree_pager_stats(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:150:26: */
 53826  	bp := tls.Alloc(140)
 53827  	defer tls.Free(140)
 53828  
 53829  	var pBt uintptr
 53830  	var i int32
 53831  	var a uintptr
 53832  
 53833  	if argc != 2 {
 53834  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53835  			ts+24710 /* " ID\"" */, 0))
 53836  		return TCL_ERROR
 53837  	}
 53838  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53839  
 53840  	// Normally in this file, with a b-tree handle opened using the
 53841  	// [btree_open] command it is safe to call sqlite3BtreeEnter() directly.
 53842  	// But this function is sometimes called with a btree handle obtained
 53843  	// from an open SQLite connection (using [btree_from_db]). In this case
 53844  	// we need to obtain the mutex for the controlling SQLite handle before
 53845  	// it is safe to call sqlite3BtreeEnter().
 53846  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53847  
 53848  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 53849  	a = sqlite3.Xsqlite3PagerStats(tls, sqlite3.Xsqlite3BtreePager(tls, pBt))
 53850  	for i = 0; i < 11; i++ {
 53851  		// var zBuf [100]int8 at bp+40, 100
 53852  
 53853  		tcl.XTcl_AppendElement(tls, interp, zName1[i])
 53854  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+40 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(a + uintptr(i)*4))))
 53855  		tcl.XTcl_AppendElement(tls, interp, bp+40 /* &zBuf[0] */)
 53856  	}
 53857  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 53858  
 53859  	// Release the mutex on the SQLite handle that controls this b-tree
 53860  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53861  	return TCL_OK
 53862  }
 53863  
 53864  var zName1 = [11]uintptr{
 53865  	ts + 24715 /* "ref" */, ts + 24719 /* "page" */, ts + 18693 /* "max" */, ts + 12279 /* "size" */, ts + 10193 /* "state" */, ts + 24724, /* "err" */
 53866  	ts + 24728 /* "hit" */, ts + 24732 /* "miss" */, ts + 24737 /* "ovfl" */, ts + 25406 /* "read" */, ts + 25411, /* "write" */
 53867  } /* test3.c:179:17 */
 53868  
 53869  // Usage:   btree_cursor ID TABLENUM WRITEABLE
 53870  //
 53871  // Create a new cursor.  Return the ID for the cursor.
 53872  func btree_cursor(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:200:26: */
 53873  	bp := tls.Alloc(110)
 53874  	defer tls.Free(110)
 53875  
 53876  	var pBt uintptr
 53877  	// var iTable int32 at bp+72, 4
 53878  
 53879  	var pCur uintptr
 53880  	var rc int32 = SQLITE_OK
 53881  	// var wrFlag int32 at bp+76, 4
 53882  
 53883  	// var zBuf [30]int8 at bp+80, 30
 53884  
 53885  	if argc != 4 {
 53886  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53887  			ts+25417 /* " ID TABLENUM WRI..." */, 0))
 53888  		return TCL_ERROR
 53889  	}
 53890  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53891  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+72 /* &iTable */) != 0 {
 53892  		return TCL_ERROR
 53893  	}
 53894  	if tcl.XTcl_GetBoolean(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 3*8)), bp+76 /* &wrFlag */) != 0 {
 53895  		return TCL_ERROR
 53896  	}
 53897  	if *(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) != 0 {
 53898  		*(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) = BTREE_WRCSR
 53899  	}
 53900  	pCur = tcl.XTcl_Alloc(tls, uint32(sqlite3.Xsqlite3BtreeCursorSize(tls)))
 53901  	libc.Xmemset(tls, pCur, 0, uint64(sqlite3.Xsqlite3BtreeCursorSize(tls)))
 53902  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53903  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 53904  	rc = sqlite3.Xsqlite3BtreeLockTable(tls, pBt, *(*int32)(unsafe.Pointer(bp + 72 /* iTable */)), libc.BoolUint8(!(!(*(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) != 0))))
 53905  	if rc == SQLITE_OK {
 53906  		rc = sqlite3.Xsqlite3BtreeCursor(tls, pBt, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* iTable */))), *(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)), uintptr(0), pCur)
 53907  	}
 53908  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 53909  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53910  	if rc != 0 {
 53911  		tcl.XTcl_Free(tls, pCur)
 53912  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53913  		return TCL_ERROR
 53914  	}
 53915  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+80 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, pCur))
 53916  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+80 /* &zBuf[0] */, 0))
 53917  	return SQLITE_OK
 53918  }
 53919  
 53920  // Usage:   btree_close_cursor ID
 53921  //
 53922  // Close a cursor opened using btree_cursor.
 53923  func btree_close_cursor(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:249:26: */
 53924  	bp := tls.Alloc(48)
 53925  	defer tls.Free(48)
 53926  
 53927  	var pCur uintptr
 53928  	var rc int32
 53929  
 53930  	if argc != 2 {
 53931  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53932  			ts+24710 /* " ID\"" */, 0))
 53933  		return TCL_ERROR
 53934  	}
 53935  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53936  	{
 53937  		var pBt uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBtree
 53938  		sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53939  		sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 53940  		rc = sqlite3.Xsqlite3BtreeCloseCursor(tls, pCur)
 53941  		sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 53942  		sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 53943  
 53944  	}
 53945  	tcl.XTcl_Free(tls, pCur)
 53946  	if rc != 0 {
 53947  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53948  		return TCL_ERROR
 53949  	}
 53950  	return SQLITE_OK
 53951  }
 53952  
 53953  // Usage:   btree_next ID
 53954  //
 53955  // Move the cursor to the next entry in the table.  Return 0 on success
 53956  // or 1 if the cursor was already on the last entry in the table or if
 53957  // the table is empty.
 53958  func btree_next(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:291:26: */
 53959  	bp := tls.Alloc(172)
 53960  	defer tls.Free(172)
 53961  
 53962  	var pCur uintptr
 53963  	var rc int32
 53964  	var res int32 = 0
 53965  	// var zBuf [100]int8 at bp+72, 100
 53966  
 53967  	if argc != 2 {
 53968  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53969  			ts+24710 /* " ID\"" */, 0))
 53970  		return TCL_ERROR
 53971  	}
 53972  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 53973  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 53974  	rc = sqlite3.Xsqlite3BtreeNext(tls, pCur, 0)
 53975  	if rc == SQLITE_DONE {
 53976  		res = 1
 53977  		rc = SQLITE_OK
 53978  	}
 53979  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 53980  	if rc != 0 {
 53981  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 53982  		return TCL_ERROR
 53983  	}
 53984  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, res))
 53985  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 53986  	return SQLITE_OK
 53987  }
 53988  
 53989  // Usage:   btree_first ID
 53990  //
 53991  // Move the cursor to the first entry in the table.  Return 0 if the
 53992  // cursor was left point to something and 1 if the table is empty.
 53993  func btree_first(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:330:26: */
 53994  	bp := tls.Alloc(176)
 53995  	defer tls.Free(176)
 53996  
 53997  	var pCur uintptr
 53998  	var rc int32
 53999  	*(*int32)(unsafe.Pointer(bp + 72 /* res */)) = 0
 54000  	// var zBuf [100]int8 at bp+76, 100
 54001  
 54002  	if argc != 2 {
 54003  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54004  			ts+24710 /* " ID\"" */, 0))
 54005  		return TCL_ERROR
 54006  	}
 54007  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54008  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54009  	rc = sqlite3.Xsqlite3BtreeFirst(tls, pCur, bp+72 /* &res */)
 54010  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54011  	if rc != 0 {
 54012  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54013  		return TCL_ERROR
 54014  	}
 54015  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+76 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 72 /* res */))))
 54016  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+76 /* &zBuf[0] */, 0))
 54017  	return SQLITE_OK
 54018  }
 54019  
 54020  // Usage:   btree_eof ID
 54021  //
 54022  // Return TRUE if the given cursor is not pointing at a valid entry.
 54023  // Return FALSE if the cursor does point to a valid entry.
 54024  func btree_eof(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:365:26: */
 54025  	bp := tls.Alloc(106)
 54026  	defer tls.Free(106)
 54027  
 54028  	var pCur uintptr
 54029  	var rc int32
 54030  	// var zBuf [50]int8 at bp+56, 50
 54031  
 54032  	if argc != 2 {
 54033  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54034  			ts+24710 /* " ID\"" */, 0))
 54035  		return TCL_ERROR
 54036  	}
 54037  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54038  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54039  	rc = sqlite3.Xsqlite3BtreeEof(tls, pCur)
 54040  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54041  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+56 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, rc))
 54042  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 54043  	return SQLITE_OK
 54044  }
 54045  
 54046  // Usage:   btree_payload_size ID
 54047  //
 54048  // Return the number of bytes of payload
 54049  func btree_payload_size(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:394:26: */
 54050  	bp := tls.Alloc(106)
 54051  	defer tls.Free(106)
 54052  
 54053  	var pCur uintptr
 54054  	var n u32
 54055  	// var zBuf [50]int8 at bp+56, 50
 54056  
 54057  	if argc != 2 {
 54058  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54059  			ts+24710 /* " ID\"" */, 0))
 54060  		return TCL_ERROR
 54061  	}
 54062  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54063  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54064  	n = sqlite3.Xsqlite3BtreePayloadSize(tls, pCur)
 54065  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54066  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+56 /* &zBuf[0] */, ts+18230 /* "%u" */, libc.VaList(bp+32, n))
 54067  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 54068  	return SQLITE_OK
 54069  }
 54070  
 54071  // usage:   varint_test  START  MULTIPLIER  COUNT  INCREMENT
 54072  //
 54073  // This command tests the putVarint() and getVarint()
 54074  // routines, both for accuracy and for speed.
 54075  //
 54076  // An integer is written using putVarint() and read back with
 54077  // getVarint() and varified to be unchanged.  This repeats COUNT
 54078  // times.  The first integer is START*MULTIPLIER.  Each iteration
 54079  // increases the integer by INCREMENT.
 54080  //
 54081  // This command returns nothing if it works.  It returns an error message
 54082  // if something goes wrong.
 54083  func btree_varint_test(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:432:26: */
 54084  	bp := tls.Alloc(516)
 54085  	defer tls.Free(516)
 54086  
 54087  	// var start u32 at bp+184, 4
 54088  
 54089  	// var mult u32 at bp+188, 4
 54090  
 54091  	// var count u32 at bp+192, 4
 54092  
 54093  	// var incr u32 at bp+196, 4
 54094  
 54095  	var in u64
 54096  	// var out u64 at bp+504, 8
 54097  
 54098  	var n1 int32
 54099  	var n2 int32
 54100  	var i int32
 54101  	var j int32
 54102  	// var zBuf [100]uint8 at bp+200, 100
 54103  
 54104  	if argc != 5 {
 54105  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54106  			ts+25441 /* " START MULTIPLIE..." */, 0))
 54107  		return TCL_ERROR
 54108  	}
 54109  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+184 /* &start */) != 0 {
 54110  		return TCL_ERROR
 54111  	}
 54112  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+188 /* &mult */) != 0 {
 54113  		return TCL_ERROR
 54114  	}
 54115  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 3*8)), bp+192 /* &count */) != 0 {
 54116  		return TCL_ERROR
 54117  	}
 54118  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*8)), bp+196 /* &incr */) != 0 {
 54119  		return TCL_ERROR
 54120  	}
 54121  	in = u64(*(*u32)(unsafe.Pointer(bp + 184 /* start */)))
 54122  	in = in * (u64(*(*u32)(unsafe.Pointer(bp + 188 /* mult */))))
 54123  	for i = 0; i < int32(*(*u32)(unsafe.Pointer(bp + 192 /* count */))); i++ {
 54124  		// var zErr [200]int8 at bp+300, 200
 54125  
 54126  		n1 = sqlite3.Xsqlite3PutVarint(tls, bp+200 /* &zBuf[0] */, in)
 54127  		if (n1 > 9) || (n1 < 1) {
 54128  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 54129  				ts+25476 /* "putVarint return..." */, libc.VaList(bp+32, n1))
 54130  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+300 /* &zErr[0] */, 0))
 54131  			return TCL_ERROR
 54132  		}
 54133  		n2 = int32(sqlite3.Xsqlite3GetVarint(tls, bp+200 /* &zBuf[0] */, bp+504 /* &out */))
 54134  		if n1 != n2 {
 54135  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 54136  				ts+25526 /* "putVarint return..." */, libc.VaList(bp+56, n1, n2))
 54137  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, bp+300 /* &zErr[0] */, 0))
 54138  			return TCL_ERROR
 54139  		}
 54140  		if in != *(*u64)(unsafe.Pointer(bp + 504 /* out */)) {
 54141  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 54142  				ts+25574 /* "Wrote 0x%016llx ..." */, libc.VaList(bp+88, in, *(*u64)(unsafe.Pointer(bp + 504 /* out */))))
 54143  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+104, bp+300 /* &zErr[0] */, 0))
 54144  			return TCL_ERROR
 54145  		}
 54146  		if (in & uint64(0xffffffff)) == in {
 54147  			// var out32 u32 at bp+512, 4
 54148  
 54149  			n2 = int32(func() uint8 {
 54150  				if int32(*(*uint8)(unsafe.Pointer(bp + 200 /* zBuf */))) < int32(u8(0x80)) {
 54151  					return uint8(func() int32 {
 54152  						(*(*u32)(unsafe.Pointer(bp + 512 /* out32 */))) = u32(*(*uint8)(unsafe.Pointer(bp + 200 /* zBuf */)))
 54153  						return 1
 54154  					}())
 54155  				}
 54156  				return sqlite3.Xsqlite3GetVarint32(tls, bp+200 /* &zBuf[0] */, bp+512 /* &out32 */)
 54157  			}())
 54158  			*(*u64)(unsafe.Pointer(bp + 504 /* out */)) = u64(*(*u32)(unsafe.Pointer(bp + 512 /* out32 */)))
 54159  			if n1 != n2 {
 54160  				sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 54161  					ts+25613, /* "putVarint return..." */
 54162  					libc.VaList(bp+120, n1, n2))
 54163  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+136, bp+300 /* &zErr[0] */, 0))
 54164  				return TCL_ERROR
 54165  			}
 54166  			if in != *(*u64)(unsafe.Pointer(bp + 504 /* out */)) {
 54167  				sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 54168  					ts+25663, /* "Wrote 0x%016llx ..." */
 54169  					libc.VaList(bp+152, in, *(*u64)(unsafe.Pointer(bp + 504 /* out */))))
 54170  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+168, bp+300 /* &zErr[0] */, 0))
 54171  				return TCL_ERROR
 54172  			}
 54173  		}
 54174  
 54175  		// In order to get realistic timings, run getVarint 19 more times.
 54176  		// This is because getVarint is called about 20 times more often
 54177  		// than putVarint.
 54178  		for j = 0; j < 19; j++ {
 54179  			sqlite3.Xsqlite3GetVarint(tls, bp+200 /* &zBuf[0] */, bp+504 /* &out */)
 54180  		}
 54181  		in = in + (u64(*(*u32)(unsafe.Pointer(bp + 196 /* incr */))))
 54182  	}
 54183  	return TCL_OK
 54184  }
 54185  
 54186  // usage:   btree_from_db  DB-HANDLE
 54187  //
 54188  // This command returns the btree handle for the main database associated
 54189  // with the database-handle passed as the argument. Example usage:
 54190  //
 54191  // sqlite3 db test.db
 54192  // set bt [btree_from_db db]
 54193  func btree_from_db(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:516:26: */
 54194  	bp := tls.Alloc(236)
 54195  	defer tls.Free(236)
 54196  
 54197  	// var zBuf [100]int8 at bp+136, 100
 54198  
 54199  	// var info Tcl_CmdInfo at bp+72, 64
 54200  
 54201  	var db uintptr
 54202  	var pBt uintptr
 54203  	var iDb int32 = 0
 54204  
 54205  	if (argc != 2) && (argc != 3) {
 54206  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54207  			ts+25719 /* " DB-HANDLE ?N?\"" */, 0))
 54208  		return TCL_ERROR
 54209  	}
 54210  
 54211  	if 1 != tcl.XTcl_GetCommandInfo(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)), bp+72 /* &info */) {
 54212  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+25735 /* "No such db-handl..." */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+12415 /* "\"" */, 0))
 54213  		return TCL_ERROR
 54214  	}
 54215  	if argc == 3 {
 54216  		iDb = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 54217  	}
 54218  
 54219  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 72 /* &info */)).FobjClientData))
 54220  
 54221  	pBt = (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*32)).FpBt
 54222  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+136 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+64, pBt))
 54223  	tcl.XTcl_SetResult(tls, interp, bp+136 /* &zBuf[0] */, uintptr(1))
 54224  	return TCL_OK
 54225  }
 54226  
 54227  // Usage:   btree_ismemdb ID
 54228  //
 54229  // Return true if the B-Tree is currently stored entirely in memory.
 54230  func btree_ismemdb(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:556:26: */
 54231  	bp := tls.Alloc(32)
 54232  	defer tls.Free(32)
 54233  
 54234  	var pBt uintptr
 54235  	var res int32
 54236  	var pFile uintptr
 54237  
 54238  	if argc != 2 {
 54239  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54240  			ts+24710 /* " ID\"" */, 0))
 54241  		return TCL_ERROR
 54242  	}
 54243  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54244  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 54245  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 54246  	pFile = sqlite3.Xsqlite3PagerFile(tls, sqlite3.Xsqlite3BtreePager(tls, pBt))
 54247  	res = (libc.Bool32((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods == uintptr(0)))
 54248  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 54249  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 54250  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((res) != 0))))
 54251  	return SQLITE_OK
 54252  }
 54253  
 54254  // usage:   btree_set_cache_size ID NCACHE
 54255  //
 54256  // Set the size of the cache used by btree $ID.
 54257  func btree_set_cache_size(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:587:26: */
 54258  	bp := tls.Alloc(36)
 54259  	defer tls.Free(36)
 54260  
 54261  	// var nCache int32 at bp+32, 4
 54262  
 54263  	var pBt uintptr
 54264  
 54265  	if argc != 3 {
 54266  		tcl.XTcl_AppendResult(tls,
 54267  			interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+25756 /* " BT NCACHE\"" */, 0))
 54268  		return TCL_ERROR
 54269  	}
 54270  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54271  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+32 /* &nCache */) != 0 {
 54272  		return TCL_ERROR
 54273  	}
 54274  
 54275  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 54276  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 54277  	sqlite3.Xsqlite3BtreeSetCacheSize(tls, pBt, *(*int32)(unsafe.Pointer(bp + 32 /* nCache */)))
 54278  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 54279  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 54280  	return TCL_OK
 54281  }
 54282  
 54283  // usage:   btree_insert CSR ?KEY? VALUE
 54284  //
 54285  // Set the size of the cache used by btree $ID.
 54286  func btree_insert(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test3.c:617:26: */
 54287  	bp := tls.Alloc(68)
 54288  	defer tls.Free(68)
 54289  
 54290  	var pCur uintptr
 54291  	// var rc int32 at bp+64, 4
 54292  
 54293  	// var x BtreePayload at bp+16, 48
 54294  
 54295  	if (objc != 4) && (objc != 3) {
 54296  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+25768 /* "?-intkey? CSR KE..." */)
 54297  		return TCL_ERROR
 54298  	}
 54299  
 54300  	libc.Xmemset(tls, bp+16 /* &x */, 0, uint64(unsafe.Sizeof(BtreePayload{})))
 54301  	if objc == 4 {
 54302  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+64 /* &rc */) != 0 {
 54303  			return TCL_ERROR
 54304  		}
 54305  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FnKey = sqlite3_int64(*(*int32)(unsafe.Pointer(bp + 64 /* rc */)))
 54306  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FpData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), (bp + 16 /* &x */ + 36 /* &.nData */))
 54307  	} else {
 54308  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FpKey = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+64 /* &rc */)
 54309  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FnKey = sqlite3_int64(*(*int32)(unsafe.Pointer(bp + 64 /* rc */)))
 54310  	}
 54311  	pCur = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 54312  
 54313  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).Fdb)).Fmutex)
 54314  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54315  	*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3.Xsqlite3BtreeInsert(tls, pCur, bp+16 /* &x */, 0, 0)
 54316  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 54317  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).Fdb)).Fmutex)
 54318  
 54319  	tcl.XTcl_ResetResult(tls, interp)
 54320  	if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) != 0 {
 54321  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, *(*int32)(unsafe.Pointer(bp + 64 /* rc */))), 0))
 54322  		return TCL_ERROR
 54323  	}
 54324  	return TCL_OK
 54325  }
 54326  
 54327  // Register commands with the TCL interpreter.
 54328  func Sqlitetest3_Init(tls *libc.TLS, interp uintptr) int32 { /* test3.c:661:5: */
 54329  	var i int32
 54330  
 54331  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd3)) / uint64(unsafe.Sizeof(struct {
 54332  		FzName uintptr
 54333  		FxProc uintptr
 54334  	}{}))); i++ {
 54335  		tcl.XTcl_CreateCommand(tls, interp, aCmd3[i].FzName, aCmd3[i].FxProc, uintptr(0), uintptr(0))
 54336  	}
 54337  
 54338  	tcl.XTcl_CreateObjCommand(tls, interp, ts+25792 /* "btree_insert" */, *(*uintptr)(unsafe.Pointer(&struct {
 54339  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 54340  	}{btree_insert})), uintptr(0), uintptr(0))
 54341  
 54342  	return TCL_OK
 54343  }
 54344  
 54345  var aCmd3 = [14]struct {
 54346  	FzName uintptr
 54347  	FxProc uintptr
 54348  }{
 54349  	{FzName: ts + 25805 /* "btree_open" */, FxProc: 0},
 54350  	{FzName: ts + 25816 /* "btree_close" */, FxProc: 0},
 54351  	{FzName: ts + 25828 /* "btree_begin_tran..." */, FxProc: 0},
 54352  	{FzName: ts + 25852 /* "btree_pager_stat..." */, FxProc: 0},
 54353  	{FzName: ts + 25870 /* "btree_cursor" */, FxProc: 0},
 54354  	{FzName: ts + 25883 /* "btree_close_curs..." */, FxProc: 0},
 54355  	{FzName: ts + 25902 /* "btree_next" */, FxProc: 0},
 54356  	{FzName: ts + 25913 /* "btree_eof" */, FxProc: 0},
 54357  	{FzName: ts + 25923 /* "btree_payload_si..." */, FxProc: 0},
 54358  	{FzName: ts + 25942 /* "btree_first" */, FxProc: 0},
 54359  	{FzName: ts + 25954 /* "btree_varint_tes..." */, FxProc: 0},
 54360  	{FzName: ts + 25972 /* "btree_from_db" */, FxProc: 0},
 54361  	{FzName: ts + 25986 /* "btree_ismemdb" */, FxProc: 0},
 54362  	{FzName: ts + 26000 /* "btree_set_cache_..." */, FxProc: 0},
 54363  } /* test3.c:665:5 */
 54364  
 54365  // -
 54366  // SPDX-License-Identifier: (BSD-4-Clause AND BSD-2-Clause-FreeBSD)
 54367  //
 54368  // Copyright (c) 1996, 1997
 54369  //      HD Associates, Inc.  All rights reserved.
 54370  //
 54371  // Redistribution and use in source and binary forms, with or without
 54372  // modification, are permitted provided that the following conditions
 54373  // are met:
 54374  // 1. Redistributions of source code must retain the above copyright
 54375  //    notice, this list of conditions and the following disclaimer.
 54376  // 2. Redistributions in binary form must reproduce the above copyright
 54377  //    notice, this list of conditions and the following disclaimer in the
 54378  //    documentation and/or other materials provided with the distribution.
 54379  // 3. All advertising materials mentioning features or use of this software
 54380  //    must display the following acknowledgement:
 54381  //      This product includes software developed by HD Associates, Inc
 54382  //      and Jukka Antero Ukkonen.
 54383  // 4. Neither the name of the author nor the names of any co-contributors
 54384  //    may be used to endorse or promote products derived from this software
 54385  //    without specific prior written permission.
 54386  //
 54387  // THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
 54388  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 54389  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 54390  // ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
 54391  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 54392  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 54393  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 54394  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 54395  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 54396  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 54397  // SUCH DAMAGE.
 54398  
 54399  // -
 54400  // Copyright (c) 2002-2008, Jeffrey Roberson <jeff@freebsd.org>
 54401  // All rights reserved.
 54402  //
 54403  // Redistribution and use in source and binary forms, with or without
 54404  // modification, are permitted provided that the following conditions
 54405  // are met:
 54406  // 1. Redistributions of source code must retain the above copyright
 54407  //    notice unmodified, this list of conditions, and the following
 54408  //    disclaimer.
 54409  // 2. Redistributions in binary form must reproduce the above copyright
 54410  //    notice, this list of conditions and the following disclaimer in the
 54411  //    documentation and/or other materials provided with the distribution.
 54412  //
 54413  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 54414  // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 54415  // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 54416  // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 54417  // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 54418  // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 54419  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 54420  // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 54421  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 54422  // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 54423  //
 54424  // $FreeBSD$
 54425  
 54426  // POSIX 1003.1b Process Scheduling
 54427  
 54428  // POSIX scheduling policies
 54429  
 54430  type sched_param = struct{ Fsched_priority int32 } /* sched.h:240:1 */
 54431  
 54432  type _pthread_cleanup_info = struct{ Fpthread_cleanup_pad [8]uint64 } /* pthread.h:143:1 */
 54433  
 54434  // Each thread is controlled by an instance of the following
 54435  // structure.
 54436  type Thread = struct {
 54437  	FzFilename  uintptr
 54438  	FxOp        uintptr
 54439  	FzArg       uintptr
 54440  	Fopnum      int32
 54441  	Fbusy       int32
 54442  	Fcompleted  int32
 54443  	_           [4]byte
 54444  	Fdb         uintptr
 54445  	FpStmt      uintptr
 54446  	FzErr       uintptr
 54447  	FzStaticErr uintptr
 54448  	Frc         int32
 54449  	Fargc       int32
 54450  	Fargv       [100]uintptr
 54451  	Fcolv       [100]uintptr
 54452  } /* test4.c:33:23 */
 54453  
 54454  // There can be as many as 26 threads running at once.  Each is named
 54455  // by a capital letter: A, B, C, ..., Y, Z.
 54456  var threadset [26]Thread /* test4.c:61:15: */
 54457  
 54458  // The main loop for a thread.  Threads use busy waiting.
 54459  func test_thread_main(tls *libc.TLS, pArg uintptr) uintptr { /* test4.c:67:13: */
 54460  	var p uintptr = pArg
 54461  	if (*Thread)(unsafe.Pointer(p)).Fdb != 0 {
 54462  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 54463  	}
 54464  	sqlite3.Xsqlite3_open(tls, (*Thread)(unsafe.Pointer(p)).FzFilename, (p + 40 /* &.db */))
 54465  	if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*Thread)(unsafe.Pointer(p)).Fdb) {
 54466  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.Xstrdup(tls, sqlite3.Xsqlite3_errmsg(tls, (*Thread)(unsafe.Pointer(p)).Fdb))
 54467  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 54468  		(*Thread)(unsafe.Pointer(p)).Fdb = uintptr(0)
 54469  	}
 54470  	(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 54471  	(*Thread)(unsafe.Pointer(p)).Fcompleted = 1
 54472  	for (*Thread)(unsafe.Pointer(p)).Fopnum <= (*Thread)(unsafe.Pointer(p)).Fcompleted {
 54473  		libc2.Xsched_yield(tls)
 54474  	}
 54475  	for (*Thread)(unsafe.Pointer(p)).FxOp != 0 {
 54476  		if ((*Thread)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread)(unsafe.Pointer(p)).FzErr != (*Thread)(unsafe.Pointer(p)).FzStaticErr) {
 54477  			sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzErr)
 54478  			(*Thread)(unsafe.Pointer(p)).FzErr = uintptr(0)
 54479  		}
 54480  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 8 /* &.xOp */))))(tls, p)
 54481  		(*Thread)(unsafe.Pointer(p)).Fcompleted++
 54482  		for (*Thread)(unsafe.Pointer(p)).Fopnum <= (*Thread)(unsafe.Pointer(p)).Fcompleted {
 54483  			libc2.Xsched_yield(tls)
 54484  		}
 54485  	}
 54486  	if (*Thread)(unsafe.Pointer(p)).FpStmt != 0 {
 54487  		sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 54488  		(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 54489  	}
 54490  	if (*Thread)(unsafe.Pointer(p)).Fdb != 0 {
 54491  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 54492  		(*Thread)(unsafe.Pointer(p)).Fdb = uintptr(0)
 54493  	}
 54494  	if ((*Thread)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread)(unsafe.Pointer(p)).FzErr != (*Thread)(unsafe.Pointer(p)).FzStaticErr) {
 54495  		sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzErr)
 54496  		(*Thread)(unsafe.Pointer(p)).FzErr = uintptr(0)
 54497  	}
 54498  	(*Thread)(unsafe.Pointer(p)).Fcompleted++
 54499  	sqlite3.Xsqlite3_thread_cleanup(tls)
 54500  	return uintptr(0)
 54501  }
 54502  
 54503  // Get a thread ID which is an upper case letter.  Return the index.
 54504  // If the argument is not a valid thread ID put an error message in
 54505  // the interpreter and return -1.
 54506  func parse_thread_id(tls *libc.TLS, interp uintptr, zArg uintptr) int32 { /* test4.c:114:12: */
 54507  	bp := tls.Alloc(16)
 54508  	defer tls.Free(16)
 54509  
 54510  	if (((zArg == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zArg))) == 0)) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0)) || !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zArg)))), uint64(X_CTYPE_U)) != 0) {
 54511  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26021 /* "thread ID must b..." */, 0))
 54512  		return -1
 54513  	}
 54514  	return (int32(*(*int8)(unsafe.Pointer(zArg))) - 'A')
 54515  }
 54516  
 54517  // Usage:    thread_create NAME  FILENAME
 54518  //
 54519  // NAME should be an upper case letter.  Start the thread running with
 54520  // an open connection to the given database.
 54521  func tcl_thread_create(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:128:26: */
 54522  	bp := tls.Alloc(96)
 54523  	defer tls.Free(96)
 54524  
 54525  	var i int32
 54526  	// var x pthread_t at bp+88, 8
 54527  
 54528  	var rc int32
 54529  
 54530  	if argc != 3 {
 54531  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54532  			ts+26060 /* " ID FILENAME" */, 0))
 54533  		return TCL_ERROR
 54534  	}
 54535  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54536  	if i < 0 {
 54537  		return TCL_ERROR
 54538  	}
 54539  	if threadset[i].Fbusy != 0 {
 54540  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26073 /* "thread " */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+26081 /* " is already runn..." */, 0))
 54541  		return TCL_ERROR
 54542  	}
 54543  	threadset[i].Fbusy = 1
 54544  	sqlite3.Xsqlite3_free(tls, threadset[i].FzFilename)
 54545  	threadset[i].FzFilename = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 54546  	threadset[i].Fopnum = 1
 54547  	threadset[i].Fcompleted = 0
 54548  	rc = libc2.Xpthread_create(tls, bp+88 /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 54549  		f func(*libc.TLS, uintptr) uintptr
 54550  	}{test_thread_main})), (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54551  	if rc != 0 {
 54552  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+26101 /* "failed to create..." */, 0))
 54553  		sqlite3.Xsqlite3_free(tls, threadset[i].FzFilename)
 54554  		threadset[i].Fbusy = 0
 54555  		return TCL_ERROR
 54556  	}
 54557  	libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp + 88 /* x */)))
 54558  	return TCL_OK
 54559  }
 54560  
 54561  // Wait for a thread to reach its idle state.
 54562  func test_thread_wait(tls *libc.TLS, p uintptr) { /* test4.c:168:13: */
 54563  	for (*Thread)(unsafe.Pointer(p)).Fopnum > (*Thread)(unsafe.Pointer(p)).Fcompleted {
 54564  		libc2.Xsched_yield(tls)
 54565  	}
 54566  }
 54567  
 54568  // Usage:  thread_wait ID
 54569  //
 54570  // Wait on thread ID to reach its idle state.
 54571  func tcl_thread_wait(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:177:26: */
 54572  	bp := tls.Alloc(48)
 54573  	defer tls.Free(48)
 54574  
 54575  	var i int32
 54576  
 54577  	if argc != 2 {
 54578  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54579  			ts+26129 /* " ID" */, 0))
 54580  		return TCL_ERROR
 54581  	}
 54582  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54583  	if i < 0 {
 54584  		return TCL_ERROR
 54585  	}
 54586  	if !(threadset[i].Fbusy != 0) {
 54587  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54588  		return TCL_ERROR
 54589  	}
 54590  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54591  	return TCL_OK
 54592  }
 54593  
 54594  // Stop a thread.
 54595  func test_stop_thread(tls *libc.TLS, p uintptr) { /* test4.c:203:13: */
 54596  	test_thread_wait(tls, p)
 54597  	(*Thread)(unsafe.Pointer(p)).FxOp = uintptr(0)
 54598  	(*Thread)(unsafe.Pointer(p)).Fopnum++
 54599  	test_thread_wait(tls, p)
 54600  	sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzArg)
 54601  	(*Thread)(unsafe.Pointer(p)).FzArg = uintptr(0)
 54602  	sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzFilename)
 54603  	(*Thread)(unsafe.Pointer(p)).FzFilename = uintptr(0)
 54604  	(*Thread)(unsafe.Pointer(p)).Fbusy = 0
 54605  }
 54606  
 54607  // Usage:  thread_halt ID
 54608  //
 54609  // Cause a thread to shut itself down.  Wait for the shutdown to be
 54610  // completed.  If ID is "*" then stop all threads.
 54611  func tcl_thread_halt(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:221:26: */
 54612  	bp := tls.Alloc(48)
 54613  	defer tls.Free(48)
 54614  
 54615  	var i int32
 54616  
 54617  	if argc != 2 {
 54618  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54619  			ts+26129 /* " ID" */, 0))
 54620  		return TCL_ERROR
 54621  	}
 54622  	if (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*8))))) == '*') && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*8)) + 1))) == 0) {
 54623  		for i = 0; i < N_THREAD; i++ {
 54624  			if threadset[i].Fbusy != 0 {
 54625  				test_stop_thread(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54626  			}
 54627  		}
 54628  	} else {
 54629  		i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54630  		if i < 0 {
 54631  			return TCL_ERROR
 54632  		}
 54633  		if !(threadset[i].Fbusy != 0) {
 54634  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54635  			return TCL_ERROR
 54636  		}
 54637  		test_stop_thread(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54638  	}
 54639  	return TCL_OK
 54640  }
 54641  
 54642  // Usage: thread_argc  ID
 54643  //
 54644  // Wait on the most recent thread_step to complete, then return the
 54645  // number of columns in the result set.
 54646  func tcl_thread_argc(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:256:26: */
 54647  	bp := tls.Alloc(172)
 54648  	defer tls.Free(172)
 54649  
 54650  	var i int32
 54651  	// var zBuf [100]int8 at bp+72, 100
 54652  
 54653  	if argc != 2 {
 54654  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54655  			ts+26129 /* " ID" */, 0))
 54656  		return TCL_ERROR
 54657  	}
 54658  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54659  	if i < 0 {
 54660  		return TCL_ERROR
 54661  	}
 54662  	if !(threadset[i].Fbusy != 0) {
 54663  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54664  		return TCL_ERROR
 54665  	}
 54666  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54667  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, threadset[i].Fargc))
 54668  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 54669  	return TCL_OK
 54670  }
 54671  
 54672  // Usage: thread_argv  ID   N
 54673  //
 54674  // Wait on the most recent thread_step to complete, then return the
 54675  // value of the N-th columns in the result set.
 54676  func tcl_thread_argv(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:288:26: */
 54677  	bp := tls.Alloc(84)
 54678  	defer tls.Free(84)
 54679  
 54680  	var i int32
 54681  	// var n int32 at bp+80, 4
 54682  
 54683  	if argc != 3 {
 54684  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54685  			ts+26148 /* " ID N" */, 0))
 54686  		return TCL_ERROR
 54687  	}
 54688  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54689  	if i < 0 {
 54690  		return TCL_ERROR
 54691  	}
 54692  	if !(threadset[i].Fbusy != 0) {
 54693  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54694  		return TCL_ERROR
 54695  	}
 54696  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &n */) != 0 {
 54697  		return TCL_ERROR
 54698  	}
 54699  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54700  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset[i].Fargc) {
 54701  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 54702  		return TCL_ERROR
 54703  	}
 54704  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680 + 80 /* &.argv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*8)), 0))
 54705  	return TCL_OK
 54706  }
 54707  
 54708  // Usage: thread_colname  ID   N
 54709  //
 54710  // Wait on the most recent thread_step to complete, then return the
 54711  // name of the N-th columns in the result set.
 54712  func tcl_thread_colname(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:324:26: */
 54713  	bp := tls.Alloc(84)
 54714  	defer tls.Free(84)
 54715  
 54716  	var i int32
 54717  	// var n int32 at bp+80, 4
 54718  
 54719  	if argc != 3 {
 54720  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54721  			ts+26148 /* " ID N" */, 0))
 54722  		return TCL_ERROR
 54723  	}
 54724  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54725  	if i < 0 {
 54726  		return TCL_ERROR
 54727  	}
 54728  	if !(threadset[i].Fbusy != 0) {
 54729  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54730  		return TCL_ERROR
 54731  	}
 54732  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &n */) != 0 {
 54733  		return TCL_ERROR
 54734  	}
 54735  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54736  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset[i].Fargc) {
 54737  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 54738  		return TCL_ERROR
 54739  	}
 54740  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680 + 880 /* &.colv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*8)), 0))
 54741  	return TCL_OK
 54742  }
 54743  
 54744  // Usage: thread_result  ID
 54745  //
 54746  // Wait on the most recent operation to complete, then return the
 54747  // result code from that operation.
 54748  func tcl_thread_result(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:360:26: */
 54749  	bp := tls.Alloc(64)
 54750  	defer tls.Free(64)
 54751  
 54752  	var i int32
 54753  	var zName uintptr
 54754  
 54755  	if argc != 2 {
 54756  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54757  			ts+26129 /* " ID" */, 0))
 54758  		return TCL_ERROR
 54759  	}
 54760  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54761  	if i < 0 {
 54762  		return TCL_ERROR
 54763  	}
 54764  	if !(threadset[i].Fbusy != 0) {
 54765  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54766  		return TCL_ERROR
 54767  	}
 54768  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54769  	zName = sqlite3.Xsqlite3ErrName(tls, threadset[i].Frc)
 54770  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, zName, 0))
 54771  	return TCL_OK
 54772  }
 54773  
 54774  // Usage: thread_error  ID
 54775  //
 54776  // Wait on the most recent operation to complete, then return the
 54777  // error string.
 54778  func tcl_thread_error(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:392:26: */
 54779  	bp := tls.Alloc(64)
 54780  	defer tls.Free(64)
 54781  
 54782  	var i int32
 54783  
 54784  	if argc != 2 {
 54785  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54786  			ts+26129 /* " ID" */, 0))
 54787  		return TCL_ERROR
 54788  	}
 54789  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54790  	if i < 0 {
 54791  		return TCL_ERROR
 54792  	}
 54793  	if !(threadset[i].Fbusy != 0) {
 54794  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54795  		return TCL_ERROR
 54796  	}
 54797  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54798  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, threadset[i].FzErr, 0))
 54799  	return TCL_OK
 54800  }
 54801  
 54802  // This procedure runs in the thread to compile an SQL statement.
 54803  func do_compile(tls *libc.TLS, p uintptr) { /* test4.c:419:13: */
 54804  	if (*Thread)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 54805  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26181 /* "no database is o..." */)
 54806  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 54807  		return
 54808  	}
 54809  	if (*Thread)(unsafe.Pointer(p)).FpStmt != 0 {
 54810  		sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 54811  		(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 54812  	}
 54813  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_prepare(tls, (*Thread)(unsafe.Pointer(p)).Fdb, (*Thread)(unsafe.Pointer(p)).FzArg, -1, (p + 48 /* &.pStmt */), uintptr(0))
 54814  }
 54815  
 54816  // Usage: thread_compile ID SQL
 54817  //
 54818  // Compile a new virtual machine.
 54819  func tcl_thread_compile(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:437:26: */
 54820  	bp := tls.Alloc(56)
 54821  	defer tls.Free(56)
 54822  
 54823  	var i int32
 54824  	if argc != 3 {
 54825  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54826  			ts+26201 /* " ID SQL" */, 0))
 54827  		return TCL_ERROR
 54828  	}
 54829  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54830  	if i < 0 {
 54831  		return TCL_ERROR
 54832  	}
 54833  	if !(threadset[i].Fbusy != 0) {
 54834  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54835  		return TCL_ERROR
 54836  	}
 54837  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54838  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_compile}))
 54839  	sqlite3.Xsqlite3_free(tls, threadset[i].FzArg)
 54840  	threadset[i].FzArg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 54841  	threadset[i].Fopnum++
 54842  	return TCL_OK
 54843  }
 54844  
 54845  // This procedure runs in the thread to step the virtual machine.
 54846  func do_step(tls *libc.TLS, p uintptr) { /* test4.c:466:13: */
 54847  	var i int32
 54848  	if (*Thread)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 54849  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 54850  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 54851  		return
 54852  	}
 54853  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_step(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 54854  	if (*Thread)(unsafe.Pointer(p)).Frc == SQLITE_ROW {
 54855  		(*Thread)(unsafe.Pointer(p)).Fargc = sqlite3.Xsqlite3_column_count(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 54856  		for i = 0; i < sqlite3.Xsqlite3_data_count(tls, (*Thread)(unsafe.Pointer(p)).FpStmt); i++ {
 54857  			*(*uintptr)(unsafe.Pointer((p + 80 /* &.argv */) + uintptr(i)*8)) = sqlite3.Xsqlite3_column_text(tls, (*Thread)(unsafe.Pointer(p)).FpStmt, i)
 54858  		}
 54859  		for i = 0; i < (*Thread)(unsafe.Pointer(p)).Fargc; i++ {
 54860  			*(*uintptr)(unsafe.Pointer((p + 880 /* &.colv */) + uintptr(i)*8)) = sqlite3.Xsqlite3_column_name(tls, (*Thread)(unsafe.Pointer(p)).FpStmt, i)
 54861  		}
 54862  	}
 54863  }
 54864  
 54865  // Usage: thread_step ID
 54866  //
 54867  // Advance the virtual machine by one step
 54868  func tcl_thread_step(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:490:26: */
 54869  	bp := tls.Alloc(48)
 54870  	defer tls.Free(48)
 54871  
 54872  	var i int32
 54873  	if argc != 2 {
 54874  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54875  			ts+26238 /* " IDL" */, 0))
 54876  		return TCL_ERROR
 54877  	}
 54878  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54879  	if i < 0 {
 54880  		return TCL_ERROR
 54881  	}
 54882  	if !(threadset[i].Fbusy != 0) {
 54883  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54884  		return TCL_ERROR
 54885  	}
 54886  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54887  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_step}))
 54888  	threadset[i].Fopnum++
 54889  	return TCL_OK
 54890  }
 54891  
 54892  // This procedure runs in the thread to finalize a virtual machine.
 54893  func do_finalize(tls *libc.TLS, p uintptr) { /* test4.c:517:13: */
 54894  	if (*Thread)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 54895  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 54896  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 54897  		return
 54898  	}
 54899  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 54900  	(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 54901  }
 54902  
 54903  // Usage: thread_finalize ID
 54904  //
 54905  // Finalize the virtual machine.
 54906  func tcl_thread_finalize(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:532:26: */
 54907  	bp := tls.Alloc(48)
 54908  	defer tls.Free(48)
 54909  
 54910  	var i int32
 54911  	if argc != 2 {
 54912  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54913  			ts+26238 /* " IDL" */, 0))
 54914  		return TCL_ERROR
 54915  	}
 54916  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54917  	if i < 0 {
 54918  		return TCL_ERROR
 54919  	}
 54920  	if !(threadset[i].Fbusy != 0) {
 54921  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54922  		return TCL_ERROR
 54923  	}
 54924  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54925  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_finalize}))
 54926  	sqlite3.Xsqlite3_free(tls, threadset[i].FzArg)
 54927  	threadset[i].FzArg = uintptr(0)
 54928  	threadset[i].Fopnum++
 54929  	return TCL_OK
 54930  }
 54931  
 54932  // Usage: thread_swap ID ID
 54933  //
 54934  // Interchange the sqlite* pointer between two threads.
 54935  func tcl_thread_swap(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:563:26: */
 54936  	bp := tls.Alloc(64)
 54937  	defer tls.Free(64)
 54938  
 54939  	var i int32
 54940  	var j int32
 54941  	var temp uintptr
 54942  	if argc != 3 {
 54943  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54944  			ts+26243 /* " ID1 ID2" */, 0))
 54945  		return TCL_ERROR
 54946  	}
 54947  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54948  	if i < 0 {
 54949  		return TCL_ERROR
 54950  	}
 54951  	if !(threadset[i].Fbusy != 0) {
 54952  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54953  		return TCL_ERROR
 54954  	}
 54955  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54956  	j = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 54957  	if j < 0 {
 54958  		return TCL_ERROR
 54959  	}
 54960  	if !(threadset[j].Fbusy != 0) {
 54961  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26133 /* "no such thread" */, 0))
 54962  		return TCL_ERROR
 54963  	}
 54964  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(j)*1680))
 54965  	temp = threadset[i].Fdb
 54966  	threadset[i].Fdb = threadset[j].Fdb
 54967  	threadset[j].Fdb = temp
 54968  	return TCL_OK
 54969  }
 54970  
 54971  // Usage: thread_db_get ID
 54972  //
 54973  // Return the database connection pointer for the given thread.  Then
 54974  // remove the pointer from the thread itself.  Afterwards, the thread
 54975  // can be stopped and the connection can be used by the main thread.
 54976  func tcl_thread_db_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:603:26: */
 54977  	bp := tls.Alloc(164)
 54978  	defer tls.Free(164)
 54979  
 54980  	var i int32
 54981  	// var zBuf [100]int8 at bp+64, 100
 54982  
 54983  	if argc != 2 {
 54984  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54985  			ts+26129 /* " ID" */, 0))
 54986  		return TCL_ERROR
 54987  	}
 54988  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 54989  	if i < 0 {
 54990  		return TCL_ERROR
 54991  	}
 54992  	if !(threadset[i].Fbusy != 0) {
 54993  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 54994  		return TCL_ERROR
 54995  	}
 54996  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 54997  	sqlite3TestMakePointerStr(tls, interp, bp+64 /* &zBuf[0] */, threadset[i].Fdb)
 54998  	threadset[i].Fdb = uintptr(0)
 54999  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+64 /* &zBuf[0] */, uintptr(0)))
 55000  	return TCL_OK
 55001  }
 55002  
 55003  // Usage: thread_db_put ID DB
 55004  //
 55005  func tcl_thread_db_put(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:634:26: */
 55006  	bp := tls.Alloc(48)
 55007  	defer tls.Free(48)
 55008  
 55009  	var i int32
 55010  	if argc != 3 {
 55011  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55012  			ts+26252 /* " ID DB" */, 0))
 55013  		return TCL_ERROR
 55014  	}
 55015  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 55016  	if i < 0 {
 55017  		return TCL_ERROR
 55018  	}
 55019  	if !(threadset[i].Fbusy != 0) {
 55020  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 55021  		return TCL_ERROR
 55022  	}
 55023  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 55024  
 55025  	threadset[i].Fdb = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 55026  	return TCL_OK
 55027  }
 55028  
 55029  // Usage: thread_stmt_get ID
 55030  //
 55031  // Return the database stmt pointer for the given thread.  Then
 55032  // remove the pointer from the thread itself.
 55033  func tcl_thread_stmt_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:666:26: */
 55034  	bp := tls.Alloc(164)
 55035  	defer tls.Free(164)
 55036  
 55037  	var i int32
 55038  	// var zBuf [100]int8 at bp+64, 100
 55039  
 55040  	if argc != 2 {
 55041  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55042  			ts+26129 /* " ID" */, 0))
 55043  		return TCL_ERROR
 55044  	}
 55045  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 55046  	if i < 0 {
 55047  		return TCL_ERROR
 55048  	}
 55049  	if !(threadset[i].Fbusy != 0) {
 55050  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 55051  		return TCL_ERROR
 55052  	}
 55053  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*1680))
 55054  	sqlite3TestMakePointerStr(tls, interp, bp+64 /* &zBuf[0] */, threadset[i].FpStmt)
 55055  	threadset[i].FpStmt = uintptr(0)
 55056  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+64 /* &zBuf[0] */, uintptr(0)))
 55057  	return TCL_OK
 55058  }
 55059  
 55060  // Register commands with the TCL interpreter.
 55061  func Sqlitetest4_Init(tls *libc.TLS, interp uintptr) int32 { /* test4.c:696:5: */
 55062  	var i int32
 55063  
 55064  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd4)) / uint64(unsafe.Sizeof(struct {
 55065  		FzName uintptr
 55066  		FxProc uintptr
 55067  	}{}))); i++ {
 55068  		tcl.XTcl_CreateCommand(tls, interp, aCmd4[i].FzName, aCmd4[i].FxProc, uintptr(0), uintptr(0))
 55069  	}
 55070  	return TCL_OK
 55071  }
 55072  
 55073  var aCmd4 = [15]struct {
 55074  	FzName uintptr
 55075  	FxProc uintptr
 55076  }{
 55077  	{FzName: ts + 26259 /* "thread_create" */, FxProc: 0},
 55078  	{FzName: ts + 26273 /* "thread_wait" */, FxProc: 0},
 55079  	{FzName: ts + 26285 /* "thread_halt" */, FxProc: 0},
 55080  	{FzName: ts + 26297 /* "thread_argc" */, FxProc: 0},
 55081  	{FzName: ts + 26309 /* "thread_argv" */, FxProc: 0},
 55082  	{FzName: ts + 26321 /* "thread_colname" */, FxProc: 0},
 55083  	{FzName: ts + 26336 /* "thread_result" */, FxProc: 0},
 55084  	{FzName: ts + 26350 /* "thread_error" */, FxProc: 0},
 55085  	{FzName: ts + 26363 /* "thread_compile" */, FxProc: 0},
 55086  	{FzName: ts + 26378 /* "thread_step" */, FxProc: 0},
 55087  	{FzName: ts + 26390 /* "thread_finalize" */, FxProc: 0},
 55088  	{FzName: ts + 26406 /* "thread_swap" */, FxProc: 0},
 55089  	{FzName: ts + 26418 /* "thread_db_get" */, FxProc: 0},
 55090  	{FzName: ts + 26432 /* "thread_db_put" */, FxProc: 0},
 55091  	{FzName: ts + 26446 /* "thread_stmt_get" */, FxProc: 0},
 55092  } /* test4.c:700:5 */
 55093  
 55094  // end block for C++
 55095  
 55096  // Local Variables:
 55097  // mode: c
 55098  // c-basic-offset: 4
 55099  // fill-column: 78
 55100  // End:
 55101  // -
 55102  // SPDX-License-Identifier: BSD-3-Clause
 55103  //
 55104  // Copyright (c) 1990, 1993
 55105  //	The Regents of the University of California.  All rights reserved.
 55106  //
 55107  // Redistribution and use in source and binary forms, with or without
 55108  // modification, are permitted provided that the following conditions
 55109  // are met:
 55110  // 1. Redistributions of source code must retain the above copyright
 55111  //    notice, this list of conditions and the following disclaimer.
 55112  // 2. Redistributions in binary form must reproduce the above copyright
 55113  //    notice, this list of conditions and the following disclaimer in the
 55114  //    documentation and/or other materials provided with the distribution.
 55115  // 3. Neither the name of the University nor the names of its contributors
 55116  //    may be used to endorse or promote products derived from this software
 55117  //    without specific prior written permission.
 55118  //
 55119  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 55120  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 55121  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 55122  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 55123  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 55124  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 55125  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 55126  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 55127  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 55128  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 55129  // SUCH DAMAGE.
 55130  //
 55131  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 55132  // $FreeBSD$
 55133  
 55134  // -
 55135  // SPDX-License-Identifier: BSD-3-Clause
 55136  //
 55137  // Copyright (c) 1990, 1993
 55138  //	The Regents of the University of California.  All rights reserved.
 55139  //
 55140  // Redistribution and use in source and binary forms, with or without
 55141  // modification, are permitted provided that the following conditions
 55142  // are met:
 55143  // 1. Redistributions of source code must retain the above copyright
 55144  //    notice, this list of conditions and the following disclaimer.
 55145  // 2. Redistributions in binary form must reproduce the above copyright
 55146  //    notice, this list of conditions and the following disclaimer in the
 55147  //    documentation and/or other materials provided with the distribution.
 55148  // 3. Neither the name of the University nor the names of its contributors
 55149  //    may be used to endorse or promote products derived from this software
 55150  //    without specific prior written permission.
 55151  //
 55152  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 55153  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 55154  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 55155  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 55156  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 55157  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 55158  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 55159  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 55160  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 55161  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 55162  // SUCH DAMAGE.
 55163  //
 55164  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 55165  // $FreeBSD$
 55166  
 55167  // The first argument is a TCL UTF-8 string. Return the byte array
 55168  // object with the encoded representation of the string, including
 55169  // the NULL terminator.
 55170  func binarize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:33:26: */
 55171  	bp := tls.Alloc(4)
 55172  	defer tls.Free(4)
 55173  
 55174  	// var len int32 at bp, 4
 55175  
 55176  	var bytes uintptr
 55177  	var pRet uintptr
 55178  
 55179  	bytes = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &len */)
 55180  	pRet = tcl.XTcl_NewByteArrayObj(tls, bytes, (*(*int32)(unsafe.Pointer(bp /* len */)) + 1))
 55181  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 55182  	return TCL_OK
 55183  }
 55184  
 55185  // Usage: test_value_overhead <repeat-count> <do-calls>.
 55186  //
 55187  // This routine is used to test the overhead of calls to
 55188  // sqlite3_value_text(), on a value that contains a UTF-8 string. The idea
 55189  // is to figure out whether or not it is a problem to use sqlite3_value
 55190  // structures with collation sequence functions.
 55191  //
 55192  // If <do-calls> is 0, then the calls to sqlite3_value_text() are not
 55193  // actually made.
 55194  func test_value_overhead(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:61:26: */
 55195  	bp := tls.Alloc(96)
 55196  	defer tls.Free(96)
 55197  
 55198  	// var do_calls int32 at bp+36, 4
 55199  
 55200  	// var repeat_count int32 at bp+32, 4
 55201  
 55202  	var i int32
 55203  	// var val Mem at bp+40, 56
 55204  
 55205  	if objc != 3 {
 55206  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 55207  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+26462 /* " <repeat-count> ..." */, 0))
 55208  		return TCL_ERROR
 55209  	}
 55210  
 55211  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+32 /* &repeat_count */) != 0 {
 55212  		return TCL_ERROR
 55213  	}
 55214  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+36 /* &do_calls */) != 0 {
 55215  		return TCL_ERROR
 55216  	}
 55217  
 55218  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fflags = (u16((MEM_Str | MEM_Term) | MEM_Static))
 55219  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fz = ts + 26489 /* "hello world" */
 55220  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fenc = u8(SQLITE_UTF8)
 55221  
 55222  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 32 /* repeat_count */)); i++ {
 55223  		if *(*int32)(unsafe.Pointer(bp + 36 /* do_calls */)) != 0 {
 55224  			sqlite3.Xsqlite3_value_text(tls, bp+40 /* &val */)
 55225  		}
 55226  	}
 55227  
 55228  	return TCL_OK
 55229  }
 55230  
 55231  func name_to_enc(tls *libc.TLS, interp uintptr, pObj uintptr) u8 { /* test5.c:94:11: */
 55232  	bp := tls.Alloc(104)
 55233  	defer tls.Free(104)
 55234  
 55235  	*(*[5]EncName)(unsafe.Pointer(bp + 24 /* encnames */)) = [5]EncName{
 55236  		{FzName: ts + 26501 /* "UTF8" */, Fenc: u8(SQLITE_UTF8)},
 55237  		{FzName: ts + 26506 /* "UTF16LE" */, Fenc: u8(SQLITE_UTF16LE)},
 55238  		{FzName: ts + 26514 /* "UTF16BE" */, Fenc: u8(SQLITE_UTF16BE)},
 55239  		{FzName: ts + 26522 /* "UTF16" */, Fenc: u8(SQLITE_UTF16)},
 55240  		{},
 55241  	}
 55242  	var pEnc uintptr
 55243  	var z uintptr = tcl.XTcl_GetString(tls, pObj)
 55244  	for pEnc = (bp + 24 /* &encnames */); (*EncName)(unsafe.Pointer(pEnc)).FzName != 0; pEnc += 16 {
 55245  		if 0 == sqlite3.Xsqlite3StrICmp(tls, z, (*EncName)(unsafe.Pointer(pEnc)).FzName) {
 55246  			break
 55247  		}
 55248  	}
 55249  	if !(int32((*EncName)(unsafe.Pointer(pEnc)).Fenc) != 0) {
 55250  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26528 /* "No such encoding..." */, z, 0))
 55251  	}
 55252  	if int32((*EncName)(unsafe.Pointer(pEnc)).Fenc) == SQLITE_UTF16 {
 55253  		return u8(SQLITE_UTF16LE)
 55254  	}
 55255  	return (*EncName)(unsafe.Pointer(pEnc)).Fenc
 55256  }
 55257  
 55258  type EncName = struct {
 55259  	FzName uintptr
 55260  	Fenc   u8
 55261  	_      [7]byte
 55262  } /* test5.c:95:3 */
 55263  
 55264  // Usage:   test_translate <string/blob> <from enc> <to enc> ?<transient>?
 55265  //
 55266  func test_translate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:125:26: */
 55267  	bp := tls.Alloc(44)
 55268  	defer tls.Free(44)
 55269  
 55270  	var enc_from u8
 55271  	var enc_to u8
 55272  	var pVal uintptr
 55273  	var z uintptr
 55274  	// var len int32 at bp+40, 4
 55275  
 55276  	var xDel uintptr = uintptr(0)
 55277  
 55278  	if (objc != 4) && (objc != 5) {
 55279  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 55280  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)),
 55281  			ts+26547 /* " <string/blob> <..." */, 0))
 55282  		return TCL_ERROR
 55283  	}
 55284  	if objc == 5 {
 55285  		xDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 55286  	}
 55287  
 55288  	enc_from = name_to_enc(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 55289  	if !(enc_from != 0) {
 55290  		return TCL_ERROR
 55291  	}
 55292  	enc_to = name_to_enc(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 55293  	if !(enc_to != 0) {
 55294  		return TCL_ERROR
 55295  	}
 55296  
 55297  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 55298  
 55299  	if int32(enc_from) == SQLITE_UTF8 {
 55300  		z = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 55301  		if objc == 5 {
 55302  			z = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+32, z))
 55303  		}
 55304  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, z, enc_from, xDel)
 55305  	} else {
 55306  		z = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+40 /* &len */)
 55307  		if objc == 5 {
 55308  			var zTmp uintptr = z
 55309  			z = sqlite3.Xsqlite3_malloc(tls, *(*int32)(unsafe.Pointer(bp + 40 /* len */)))
 55310  			libc.Xmemcpy(tls, z, zTmp, uint64(*(*int32)(unsafe.Pointer(bp + 40 /* len */))))
 55311  		}
 55312  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, z, enc_from, xDel)
 55313  	}
 55314  
 55315  	z = sqlite3.Xsqlite3ValueText(tls, pVal, enc_to)
 55316  	*(*int32)(unsafe.Pointer(bp + 40 /* len */)) = (sqlite3.Xsqlite3ValueBytes(tls, pVal, enc_to) + (func() int32 {
 55317  		if int32(enc_to) == SQLITE_UTF8 {
 55318  			return 1
 55319  		}
 55320  		return 2
 55321  	}()))
 55322  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, z, *(*int32)(unsafe.Pointer(bp + 40 /* len */))))
 55323  
 55324  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 55325  
 55326  	return TCL_OK
 55327  }
 55328  
 55329  func test_translate_selftest(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:189:26: */
 55330  	sqlite3.Xsqlite3UtfSelfTest(tls)
 55331  	return SQLITE_OK
 55332  }
 55333  
 55334  // Register commands with the TCL interpreter.
 55335  func Sqlitetest5_Init(tls *libc.TLS, interp uintptr) int32 { /* test5.c:205:5: */
 55336  	var i int32
 55337  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd5)) / uint64(unsafe.Sizeof(struct {
 55338  		FzName uintptr
 55339  		FxProc uintptr
 55340  	}{}))); i++ {
 55341  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd5[i].FzName, aCmd5[i].FxProc, uintptr(0), uintptr(0))
 55342  	}
 55343  	return SQLITE_OK
 55344  }
 55345  
 55346  var aCmd5 = [4]struct {
 55347  	FzName uintptr
 55348  	FxProc uintptr
 55349  }{
 55350  	{FzName: ts + 26582 /* "binarize" */, FxProc: 0},
 55351  	{FzName: ts + 26591 /* "test_value_overh..." */, FxProc: 0},
 55352  	{FzName: ts + 26611 /* "test_translate" */, FxProc: 0},
 55353  	{FzName: ts + 26626 /* "translate_selfte..." */, FxProc: 0},
 55354  } /* test5.c:209:5 */
 55355  
 55356  // end block for C++
 55357  
 55358  // Local Variables:
 55359  // mode: c
 55360  // c-basic-offset: 4
 55361  // fill-column: 78
 55362  // End:
 55363  
 55364  // #define TRACE_CRASHTEST
 55365  
 55366  type CrashFile1 = struct {
 55367  	FpMethod   uintptr
 55368  	FpRealFile uintptr
 55369  	FzName     uintptr
 55370  	Fflags     int32
 55371  	_          [4]byte
 55372  	FzData     uintptr
 55373  	FnData     int32
 55374  	_          [4]byte
 55375  	FiSize     i64
 55376  } /* test6.c:29:9 */
 55377  
 55378  // end block for C++
 55379  
 55380  // Local Variables:
 55381  // mode: c
 55382  // c-basic-offset: 4
 55383  // fill-column: 78
 55384  // End:
 55385  
 55386  // #define TRACE_CRASHTEST
 55387  
 55388  type CrashFile = CrashFile1 /* test6.c:29:26 */
 55389  type CrashGlobal1 = struct {
 55390  	FpWriteList             uintptr
 55391  	FpWriteListEnd          uintptr
 55392  	FiSectorSize            int32
 55393  	FiDeviceCharacteristics int32
 55394  	FiCrash                 int32
 55395  	FzCrashFile             [500]int8
 55396  } /* test6.c:30:9 */
 55397  
 55398  type CrashGlobal = CrashGlobal1 /* test6.c:30:28 */
 55399  type WriteBuffer1 = struct {
 55400  	FiOffset i64
 55401  	FnBuf    int32
 55402  	_        [4]byte
 55403  	FzBuf    uintptr
 55404  	FpFile   uintptr
 55405  	FpNext   uintptr
 55406  } /* test6.c:30:9 */
 55407  
 55408  type WriteBuffer = WriteBuffer1 /* test6.c:31:28 */
 55409  
 55410  var g = CrashGlobal{FiSectorSize: SQLITE_DEFAULT_SECTOR_SIZE} /* test6.c:156:20 */
 55411  
 55412  // Set this global variable to 1 to enable crash testing.
 55413  var sqlite3CrashTestEnable int32 = 0 /* test6.c:161:12 */
 55414  
 55415  func crash_malloc(tls *libc.TLS, nByte int32) uintptr { /* test6.c:163:13: */
 55416  	return tcl.XTcl_AttemptAlloc(tls, uint32(size_t(nByte)))
 55417  }
 55418  
 55419  func crash_free(tls *libc.TLS, p uintptr) { /* test6.c:166:13: */
 55420  	tcl.XTcl_Free(tls, p)
 55421  }
 55422  
 55423  func crash_realloc(tls *libc.TLS, p uintptr, n int32) uintptr { /* test6.c:169:13: */
 55424  	return tcl.XTcl_AttemptRealloc(tls, p, uint32(size_t(n)))
 55425  }
 55426  
 55427  // Wrapper around the sqlite3OsWrite() function that avoids writing to the
 55428  // 512 byte block begining at offset PENDING_BYTE.
 55429  func writeDbFile(tls *libc.TLS, p uintptr, z uintptr, iAmt i64, iOff i64) int32 { /* test6.c:177:12: */
 55430  	var rc int32 = SQLITE_OK
 55431  	var iSkip int32 = 0
 55432  	if (iAmt - i64(iSkip)) > int64(0) {
 55433  		rc = sqlite3.Xsqlite3OsWrite(tls, (*CrashFile)(unsafe.Pointer(p)).FpRealFile, (z + uintptr(iSkip)), (int32(iAmt - i64(iSkip))), (iOff + i64(iSkip)))
 55434  	}
 55435  	return rc
 55436  }
 55437  
 55438  // Flush the write-list as if xSync() had been called on file handle
 55439  // pFile. If isCrash is true, simulate a crash.
 55440  func writeListSync(tls *libc.TLS, pFile uintptr, isCrash int32) int32 { /* test6.c:190:12: */
 55441  	bp := tls.Alloc(16)
 55442  	defer tls.Free(16)
 55443  
 55444  	var rc int32 = SQLITE_OK
 55445  	var iDc int32 = g.FiDeviceCharacteristics
 55446  	var pWrite uintptr
 55447  	var ppPtr uintptr
 55448  
 55449  	// If this is not a crash simulation, set pFinal to point to the
 55450  	// last element of the write-list that is associated with file handle
 55451  	// pFile.
 55452  	//
 55453  	// If this is a crash simulation, set pFinal to an arbitrarily selected
 55454  	// element of the write-list.
 55455  	var pFinal uintptr = uintptr(0)
 55456  	if !(isCrash != 0) {
 55457  		for pWrite = g.FpWriteList; pWrite != 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 55458  			if (*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile == pFile {
 55459  				pFinal = pWrite
 55460  			}
 55461  		}
 55462  	} else if (iDc & (SQLITE_IOCAP_SEQUENTIAL | SQLITE_IOCAP_SAFE_APPEND)) != 0 {
 55463  		var nWrite int32 = 0
 55464  		// var iFinal int32 at bp, 4
 55465  
 55466  		for pWrite = g.FpWriteList; pWrite != 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 55467  			nWrite++
 55468  		}
 55469  		sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp /* &iFinal */)
 55470  		*(*int32)(unsafe.Pointer(bp /* iFinal */)) = ((func() int32 {
 55471  			if *(*int32)(unsafe.Pointer(bp /* iFinal */)) < 0 {
 55472  				return (-1 * *(*int32)(unsafe.Pointer(bp /* iFinal */)))
 55473  			}
 55474  			return *(*int32)(unsafe.Pointer(bp /* iFinal */))
 55475  		}()) % nWrite)
 55476  		for pWrite = g.FpWriteList; *(*int32)(unsafe.Pointer(bp /* iFinal */)) > 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 55477  			*(*int32)(unsafe.Pointer(bp /* iFinal */))--
 55478  		}
 55479  		pFinal = pWrite
 55480  	}
 55481  
 55482  	ppPtr = (uintptr(unsafe.Pointer(&g)) /* &.pWriteList */)
 55483  	for pWrite = *(*uintptr)(unsafe.Pointer(ppPtr)); (rc == SQLITE_OK) && (pWrite != 0); pWrite = *(*uintptr)(unsafe.Pointer(ppPtr)) {
 55484  		var pRealFile uintptr = (*CrashFile)(unsafe.Pointer((*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile)).FpRealFile
 55485  
 55486  		// (eAction==1)      -> write block out normally,
 55487  		// (eAction==2)      -> do nothing,
 55488  		// (eAction==3)      -> trash sectors.
 55489  		var eAction int32 = 0
 55490  		if !(isCrash != 0) {
 55491  			eAction = 2
 55492  			if ((*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile == pFile) || ((iDc & SQLITE_IOCAP_SEQUENTIAL) != 0) {
 55493  				eAction = 1
 55494  			}
 55495  		} else {
 55496  			// var random int8 at bp+4, 1
 55497  
 55498  			sqlite3.Xsqlite3_randomness(tls, 1, bp+4 /* &random */)
 55499  
 55500  			// Do not select option 3 (sector trashing) if the IOCAP_ATOMIC flag
 55501  			// is set or this is an OsTruncate(), not an Oswrite().
 55502  			if ((iDc & SQLITE_IOCAP_ATOMIC) != 0) || ((*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf == uintptr(0)) {
 55503  				*(*int8)(unsafe.Pointer(bp + 4 /* random */)) &= int8(0x01)
 55504  			}
 55505  
 55506  			// If IOCAP_SEQUENTIAL is set and this is not the final entry
 55507  			// in the truncated write-list, always select option 1 (write
 55508  			// out correctly).
 55509  			if ((iDc & SQLITE_IOCAP_SEQUENTIAL) != 0) && (pWrite != pFinal) {
 55510  				*(*int8)(unsafe.Pointer(bp + 4 /* random */)) = int8(0)
 55511  			}
 55512  
 55513  			// If IOCAP_SAFE_APPEND is set and this OsWrite() operation is
 55514  			// an append (first byte of the written region is 1 byte past the
 55515  			// current EOF), always select option 1 (write out correctly).
 55516  			if ((iDc & SQLITE_IOCAP_SAFE_APPEND) != 0) && ((*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf != 0) {
 55517  				// var iSize i64 at bp+8, 8
 55518  
 55519  				sqlite3.Xsqlite3OsFileSize(tls, pRealFile, bp+8 /* &iSize */)
 55520  				if *(*i64)(unsafe.Pointer(bp + 8 /* iSize */)) == (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset {
 55521  					*(*int8)(unsafe.Pointer(bp + 4 /* random */)) = int8(0)
 55522  				}
 55523  			}
 55524  
 55525  			if (int32(*(*int8)(unsafe.Pointer(bp + 4 /* random */))) & 0x06) == 0x06 {
 55526  				eAction = 3
 55527  			} else {
 55528  				eAction = func() int32 {
 55529  					if (int32(*(*int8)(unsafe.Pointer(bp + 4 /* random */))) & 0x01) != 0 {
 55530  						return 2
 55531  					}
 55532  					return 1
 55533  				}()
 55534  			}
 55535  		}
 55536  
 55537  		switch eAction {
 55538  		case 1:
 55539  			{ // Write out correctly
 55540  				if (*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf != 0 {
 55541  					rc = writeDbFile(tls,
 55542  						(*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile, (*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf, int64((*WriteBuffer)(unsafe.Pointer(pWrite)).FnBuf), (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset)
 55543  				} else {
 55544  					rc = sqlite3.Xsqlite3OsTruncate(tls, pRealFile, (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset)
 55545  				}
 55546  				*(*uintptr)(unsafe.Pointer(ppPtr)) = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext
 55547  				crash_free(tls, pWrite)
 55548  				break
 55549  
 55550  			}
 55551  		case 2:
 55552  			{ // Do nothing
 55553  				ppPtr = (pWrite + 32 /* &.pNext */)
 55554  				break
 55555  
 55556  			}
 55557  		case 3:
 55558  			{ // Trash sectors
 55559  				var zGarbage uintptr
 55560  				var iFirst int32 = (int32((*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset / i64(g.FiSectorSize)))
 55561  				var iLast int32 = (int32((((*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset + i64((*WriteBuffer)(unsafe.Pointer(pWrite)).FnBuf)) - int64(1)) / i64(g.FiSectorSize)))
 55562  
 55563  				zGarbage = crash_malloc(tls, g.FiSectorSize)
 55564  				if zGarbage != 0 {
 55565  					var i sqlite3_int64
 55566  					for i = sqlite3_int64(iFirst); (rc == SQLITE_OK) && (i <= sqlite3_int64(iLast)); i++ {
 55567  						sqlite3.Xsqlite3_randomness(tls, g.FiSectorSize, zGarbage)
 55568  						rc = writeDbFile(tls,
 55569  							(*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile, zGarbage, int64(g.FiSectorSize), (i * sqlite3_int64(g.FiSectorSize)))
 55570  					}
 55571  					crash_free(tls, zGarbage)
 55572  				} else {
 55573  					rc = SQLITE_NOMEM
 55574  				}
 55575  
 55576  				ppPtr = (pWrite + 32 /* &.pNext */)
 55577  				break
 55578  
 55579  			}
 55580  
 55581  		default:
 55582  
 55583  		}
 55584  
 55585  		if pWrite == pFinal {
 55586  			break
 55587  		}
 55588  	}
 55589  
 55590  	if (rc == SQLITE_OK) && (isCrash != 0) {
 55591  		libc.Xexit(tls, -1)
 55592  	}
 55593  
 55594  	for pWrite = g.FpWriteList; (pWrite != 0) && ((*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext != 0); pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 55595  	}
 55596  	g.FpWriteListEnd = pWrite
 55597  
 55598  	return rc
 55599  }
 55600  
 55601  // Add an entry to the end of the write-list.
 55602  func writeListAppend(tls *libc.TLS, pFile uintptr, iOffset sqlite3_int64, zBuf uintptr, nBuf int32) int32 { /* test6.c:362:12: */
 55603  	var pNew uintptr
 55604  
 55605  	pNew = crash_malloc(tls, (int32(uint64(unsafe.Sizeof(WriteBuffer{})) + uint64(nBuf))))
 55606  	if pNew == uintptr(0) {
 55607  		libc.Xfprintf(tls, libc.X__stderrp, ts+26645 /* "out of memory in..." */, 0)
 55608  	}
 55609  	libc.Xmemset(tls, pNew, 0, (uint64(unsafe.Sizeof(WriteBuffer{})) + uint64(nBuf)))
 55610  	(*WriteBuffer)(unsafe.Pointer(pNew)).FiOffset = iOffset
 55611  	(*WriteBuffer)(unsafe.Pointer(pNew)).FnBuf = nBuf
 55612  	(*WriteBuffer)(unsafe.Pointer(pNew)).FpFile = pFile
 55613  	if zBuf != 0 {
 55614  		(*WriteBuffer)(unsafe.Pointer(pNew)).FzBuf = (pNew + 1*40)
 55615  		libc.Xmemcpy(tls, (*WriteBuffer)(unsafe.Pointer(pNew)).FzBuf, zBuf, uint64(nBuf))
 55616  	}
 55617  
 55618  	if g.FpWriteList != 0 {
 55619  
 55620  		(*WriteBuffer)(unsafe.Pointer(g.FpWriteListEnd)).FpNext = pNew
 55621  	} else {
 55622  		g.FpWriteList = pNew
 55623  	}
 55624  	g.FpWriteListEnd = pNew
 55625  
 55626  	return SQLITE_OK
 55627  }
 55628  
 55629  // Close a crash-file.
 55630  func cfClose(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:399:12: */
 55631  	var pCrash uintptr = pFile
 55632  	writeListSync(tls, pCrash, 0)
 55633  	sqlite3.Xsqlite3OsClose(tls, (*CrashFile)(unsafe.Pointer(pCrash)).FpRealFile)
 55634  	return SQLITE_OK
 55635  }
 55636  
 55637  // Read data from a crash-file.
 55638  func cfRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test6.c:409:12: */
 55639  	var pCrash uintptr = pFile
 55640  	var nCopy int32 = func() int32 {
 55641  		if (i64(iAmt)) < ((*CrashFile)(unsafe.Pointer(pCrash)).FiSize - iOfst) {
 55642  			return int32(i64(iAmt))
 55643  		}
 55644  		return (int32((*CrashFile)(unsafe.Pointer(pCrash)).FiSize - iOfst))
 55645  	}()
 55646  
 55647  	if nCopy > 0 {
 55648  		libc.Xmemcpy(tls, zBuf, ((*CrashFile)(unsafe.Pointer(pCrash)).FzData + uintptr(iOfst)), uint64(nCopy))
 55649  	}
 55650  
 55651  	// Check the file-size to see if this is a short-read
 55652  	if nCopy < iAmt {
 55653  		return (SQLITE_IOERR | (int32(2) << 8))
 55654  	}
 55655  
 55656  	return SQLITE_OK
 55657  }
 55658  
 55659  // Write data to a crash-file.
 55660  func cfWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test6.c:433:12: */
 55661  	var pCrash uintptr = pFile
 55662  	if (sqlite_int64(iAmt) + iOfst) > (*CrashFile)(unsafe.Pointer(pCrash)).FiSize {
 55663  		(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64((int32(sqlite_int64(iAmt) + iOfst)))
 55664  	}
 55665  	for (*CrashFile)(unsafe.Pointer(pCrash)).FiSize > i64((*CrashFile)(unsafe.Pointer(pCrash)).FnData) {
 55666  		var zNew uintptr
 55667  		var nNew int32 = (((*CrashFile)(unsafe.Pointer(pCrash)).FnData * 2) + 4096)
 55668  		zNew = crash_realloc(tls, (*CrashFile)(unsafe.Pointer(pCrash)).FzData, nNew)
 55669  		if !(zNew != 0) {
 55670  			return SQLITE_NOMEM
 55671  		}
 55672  		libc.Xmemset(tls, (zNew + uintptr((*CrashFile)(unsafe.Pointer(pCrash)).FnData)), 0, (uint64(nNew - (*CrashFile)(unsafe.Pointer(pCrash)).FnData)))
 55673  		(*CrashFile)(unsafe.Pointer(pCrash)).FnData = nNew
 55674  		(*CrashFile)(unsafe.Pointer(pCrash)).FzData = zNew
 55675  	}
 55676  	libc.Xmemcpy(tls, ((*CrashFile)(unsafe.Pointer(pCrash)).FzData + uintptr(iOfst)), zBuf, uint64(iAmt))
 55677  	return writeListAppend(tls, pFile, iOfst, zBuf, iAmt)
 55678  }
 55679  
 55680  // Truncate a crash-file.
 55681  func cfTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test6.c:461:12: */
 55682  	var pCrash uintptr = pFile
 55683  
 55684  	if (*CrashFile)(unsafe.Pointer(pCrash)).FiSize > size {
 55685  		(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64(int32(size))
 55686  	}
 55687  	return writeListAppend(tls, pFile, size, uintptr(0), 0)
 55688  }
 55689  
 55690  // Sync a crash-file.
 55691  func cfSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test6.c:473:12: */
 55692  	var pCrash uintptr = pFile
 55693  	var isCrash int32 = 0
 55694  
 55695  	var zName uintptr = (*CrashFile)(unsafe.Pointer(pCrash)).FzName
 55696  	var zCrashFile uintptr = uintptr(unsafe.Pointer(&g)) + 28 /* &.zCrashFile */
 55697  	var nName int32 = int32(libc.Xstrlen(tls, zName))
 55698  	var nCrashFile int32 = int32(libc.Xstrlen(tls, zCrashFile))
 55699  
 55700  	if (nCrashFile > 0) && (int32(*(*int8)(unsafe.Pointer(zCrashFile + uintptr((nCrashFile - 1))))) == '*') {
 55701  		nCrashFile--
 55702  		if nName > nCrashFile {
 55703  			nName = nCrashFile
 55704  		}
 55705  	}
 55706  
 55707  	if (nName == nCrashFile) && (0 == libc.Xmemcmp(tls, zName, zCrashFile, uint64(nName))) {
 55708  		if (libc.PreDecInt32(&g.FiCrash, 1)) == 0 {
 55709  			isCrash = 1
 55710  		}
 55711  	}
 55712  
 55713  	return writeListSync(tls, pCrash, isCrash)
 55714  }
 55715  
 55716  // Return the current file-size of the crash-file.
 55717  func cfFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test6.c:505:12: */
 55718  	var pCrash uintptr = pFile
 55719  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = (*CrashFile)(unsafe.Pointer(pCrash)).FiSize
 55720  	return SQLITE_OK
 55721  }
 55722  
 55723  // Calls related to file-locks are passed on to the real file handle.
 55724  func cfLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test6.c:514:12: */
 55725  	return sqlite3.Xsqlite3OsLock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, eLock)
 55726  }
 55727  
 55728  func cfUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test6.c:517:12: */
 55729  	return sqlite3.Xsqlite3OsUnlock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, eLock)
 55730  }
 55731  
 55732  func cfCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test6.c:520:12: */
 55733  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, pResOut)
 55734  }
 55735  
 55736  func cfFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test6.c:523:12: */
 55737  	if op == SQLITE_FCNTL_SIZE_HINT {
 55738  		var pCrash uintptr = pFile
 55739  		var nByte i64 = *(*i64)(unsafe.Pointer(pArg))
 55740  		if nByte > (*CrashFile)(unsafe.Pointer(pCrash)).FiSize {
 55741  			if SQLITE_OK == writeListAppend(tls, pFile, nByte, uintptr(0), 0) {
 55742  				(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64(int32(nByte))
 55743  			}
 55744  		}
 55745  		return SQLITE_OK
 55746  	}
 55747  	return sqlite3.Xsqlite3OsFileControl(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, op, pArg)
 55748  }
 55749  
 55750  // The xSectorSize() and xDeviceCharacteristics() functions return
 55751  // the global values configured by the [sqlite_crashparams] tcl
 55752  //  interface.
 55753  func cfSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:542:12: */
 55754  	return g.FiSectorSize
 55755  }
 55756  
 55757  func cfDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:545:12: */
 55758  	return g.FiDeviceCharacteristics
 55759  }
 55760  
 55761  // Pass-throughs for WAL support.
 55762  func cfShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test6.c:552:12: */
 55763  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 55764  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 112 /* &.xShmLock */))))(tls, pReal, ofst, n, flags)
 55765  }
 55766  
 55767  func cfShmBarrier(tls *libc.TLS, pFile uintptr) { /* test6.c:556:13: */
 55768  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 55769  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pReal)
 55770  }
 55771  
 55772  func cfShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) int32 { /* test6.c:560:12: */
 55773  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 55774  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pReal, delFlag)
 55775  }
 55776  
 55777  func cfShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, sz int32, w int32, pp uintptr) int32 { /* test6.c:564:12: */
 55778  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 55779  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 104 /* &.xShmMap */))))(tls, pReal, iRegion, sz, w, libc.AtomicLoadUintptr(&pp))
 55780  }
 55781  
 55782  var CrashFileVtab = sqlite3_io_methods{
 55783  	FiVersion:               2, // iVersion
 55784  	FxClose:                 0, // xClose
 55785  	FxRead:                  0, // xRead
 55786  	FxWrite:                 0, // xWrite
 55787  	FxTruncate:              0, // xTruncate
 55788  	FxSync:                  0, // xSync
 55789  	FxFileSize:              0, // xFileSize
 55790  	FxLock:                  0, // xLock
 55791  	FxUnlock:                0, // xUnlock
 55792  	FxCheckReservedLock:     0, // xCheckReservedLock
 55793  	FxFileControl:           0, // xFileControl
 55794  	FxSectorSize:            0, // xSectorSize
 55795  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 55796  	FxShmMap:                0, // xShmMap
 55797  	FxShmLock:               0, // xShmLock
 55798  	FxShmBarrier:            0, // xShmBarrier
 55799  	FxShmUnmap:              0, // xShmUnmap
 55800  } /* test6.c:575:33 */
 55801  
 55802  // Application data for the crash VFS
 55803  type crashAppData = struct{ FpOrig uintptr } /* test6.c:598:1 */
 55804  
 55805  // Open a crash-file file handle.
 55806  //
 55807  // The caller will have allocated pVfs->szOsFile bytes of space
 55808  // at pFile. This file uses this space for the CrashFile structure
 55809  // and allocates space for the "real" file structure using
 55810  // sqlite3_malloc(). The assumption here is (pVfs->szOsFile) is
 55811  // equal or greater than sizeof(CrashFile).
 55812  func cfOpen(tls *libc.TLS, pCfVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test6.c:611:12: */
 55813  	bp := tls.Alloc(8)
 55814  	defer tls.Free(8)
 55815  
 55816  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55817  	var rc int32
 55818  	var pWrapper uintptr = pFile
 55819  	var pReal uintptr = (pWrapper + 1*56)
 55820  
 55821  	libc.Xmemset(tls, pWrapper, 0, uint64(unsafe.Sizeof(CrashFile{})))
 55822  	rc = sqlite3.Xsqlite3OsOpen(tls, pVfs, zName, pReal, flags, pOutFlags)
 55823  
 55824  	if rc == SQLITE_OK {
 55825  		// var iSize i64 at bp, 8
 55826  
 55827  		(*CrashFile)(unsafe.Pointer(pWrapper)).FpMethod = uintptr(unsafe.Pointer(&CrashFileVtab))
 55828  		(*CrashFile)(unsafe.Pointer(pWrapper)).FzName = zName
 55829  		(*CrashFile)(unsafe.Pointer(pWrapper)).FpRealFile = pReal
 55830  		rc = sqlite3.Xsqlite3OsFileSize(tls, pReal, bp /* &iSize */)
 55831  		(*CrashFile)(unsafe.Pointer(pWrapper)).FiSize = i64(int32(*(*i64)(unsafe.Pointer(bp /* iSize */))))
 55832  		(*CrashFile)(unsafe.Pointer(pWrapper)).Fflags = flags
 55833  	}
 55834  	if rc == SQLITE_OK {
 55835  		(*CrashFile)(unsafe.Pointer(pWrapper)).FnData = (int32(int64(4096) + (*CrashFile)(unsafe.Pointer(pWrapper)).FiSize))
 55836  		(*CrashFile)(unsafe.Pointer(pWrapper)).FzData = crash_malloc(tls, (*CrashFile)(unsafe.Pointer(pWrapper)).FnData)
 55837  		if (*CrashFile)(unsafe.Pointer(pWrapper)).FzData != 0 {
 55838  			// os_unix.c contains an assert() that fails if the caller attempts
 55839  			// to read data from the 512-byte locking region of a file opened
 55840  			// with the SQLITE_OPEN_MAIN_DB flag. This region of a database file
 55841  			// never contains valid data anyhow. So avoid doing such a read here.
 55842  			//
 55843  			// UPDATE: It also contains an assert() verifying that each call
 55844  			// to the xRead() method reads less than 128KB of data.
 55845  			var iOff i64
 55846  
 55847  			libc.Xmemset(tls, (*CrashFile)(unsafe.Pointer(pWrapper)).FzData, 0, uint64((*CrashFile)(unsafe.Pointer(pWrapper)).FnData))
 55848  			for iOff = int64(0); iOff < (*CrashFile)(unsafe.Pointer(pWrapper)).FiSize; iOff = iOff + (int64(512)) {
 55849  				var nRead int32 = (int32((*CrashFile)(unsafe.Pointer(pWrapper)).FiSize - iOff))
 55850  				if nRead > 512 {
 55851  					nRead = 512
 55852  				}
 55853  				rc = sqlite3.Xsqlite3OsRead(tls, pReal, ((*CrashFile)(unsafe.Pointer(pWrapper)).FzData + uintptr(iOff)), nRead, iOff)
 55854  			}
 55855  		} else {
 55856  			rc = SQLITE_NOMEM
 55857  		}
 55858  	}
 55859  	if (rc != SQLITE_OK) && ((*CrashFile)(unsafe.Pointer(pWrapper)).FpMethod != 0) {
 55860  		sqlite3.Xsqlite3OsClose(tls, pFile)
 55861  	}
 55862  	return rc
 55863  }
 55864  
 55865  func cfDelete(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test6.c:665:12: */
 55866  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55867  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pVfs + 48 /* &.xDelete */))))(tls, pVfs, zPath, dirSync)
 55868  }
 55869  
 55870  func cfAccess(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test6.c:669:12: */
 55871  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55872  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 56 /* &.xAccess */))))(tls, pVfs, zPath, flags, pResOut)
 55873  }
 55874  
 55875  func cfFullPathname(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) int32 { /* test6.c:678:12: */
 55876  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55877  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 64 /* &.xFullPathname */))))(tls, pVfs, zPath, nPathOut, zPathOut)
 55878  }
 55879  
 55880  func cfDlOpen(tls *libc.TLS, pCfVfs uintptr, zPath uintptr) uintptr { /* test6.c:687:13: */
 55881  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55882  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 72 /* &.xDlOpen */))))(tls, pVfs, zPath)
 55883  }
 55884  
 55885  func cfDlError(tls *libc.TLS, pCfVfs uintptr, nByte int32, zErrMsg uintptr) { /* test6.c:691:13: */
 55886  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55887  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pVfs + 80 /* &.xDlError */))))(tls, pVfs, nByte, zErrMsg)
 55888  }
 55889  
 55890  func cfDlSym(tls *libc.TLS, pCfVfs uintptr, pH uintptr, zSym uintptr) uintptr { /* test6.c:695:13: */
 55891  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55892  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 88 /* &.xDlSym */))))(tls, pVfs, pH, zSym)
 55893  }
 55894  
 55895  func cfDlClose(tls *libc.TLS, pCfVfs uintptr, pHandle uintptr) { /* test6.c:699:13: */
 55896  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55897  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pVfs + 96 /* &.xDlClose */))))(tls, pVfs, pHandle)
 55898  }
 55899  
 55900  func cfRandomness(tls *libc.TLS, pCfVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test6.c:703:12: */
 55901  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55902  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 104 /* &.xRandomness */))))(tls, pVfs, nByte, zBufOut)
 55903  }
 55904  
 55905  func cfSleep(tls *libc.TLS, pCfVfs uintptr, nMicro int32) int32 { /* test6.c:707:12: */
 55906  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55907  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pVfs + 112 /* &.xSleep */))))(tls, pVfs, nMicro)
 55908  }
 55909  
 55910  func cfCurrentTime(tls *libc.TLS, pCfVfs uintptr, pTimeOut uintptr) int32 { /* test6.c:711:12: */
 55911  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55912  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 120 /* &.xCurrentTime */))))(tls, pVfs, pTimeOut)
 55913  }
 55914  
 55915  func cfGetLastError(tls *libc.TLS, pCfVfs uintptr, n int32, z uintptr) int32 { /* test6.c:715:12: */
 55916  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 55917  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 128 /* &.xGetLastError */))))(tls, pVfs, n, z)
 55918  }
 55919  
 55920  func processDevSymArgs(tls *libc.TLS, interp uintptr, objc int32, objv uintptr, piDeviceChar uintptr, piSectorSize uintptr) int32 { /* test6.c:720:12: */
 55921  	bp := tls.Alloc(316)
 55922  	defer tls.Free(316)
 55923  
 55924  	*(*[14]DeviceFlag)(unsafe.Pointer(bp + 88 /* aFlag */)) = [14]DeviceFlag{
 55925  		{FzName: ts + 26683 /* "atomic" */, FiValue: SQLITE_IOCAP_ATOMIC},
 55926  		{FzName: ts + 26690 /* "atomic512" */, FiValue: SQLITE_IOCAP_ATOMIC512},
 55927  		{FzName: ts + 26700 /* "atomic1k" */, FiValue: SQLITE_IOCAP_ATOMIC1K},
 55928  		{FzName: ts + 26709 /* "atomic2k" */, FiValue: SQLITE_IOCAP_ATOMIC2K},
 55929  		{FzName: ts + 26718 /* "atomic4k" */, FiValue: SQLITE_IOCAP_ATOMIC4K},
 55930  		{FzName: ts + 26727 /* "atomic8k" */, FiValue: SQLITE_IOCAP_ATOMIC8K},
 55931  		{FzName: ts + 26736 /* "atomic16k" */, FiValue: SQLITE_IOCAP_ATOMIC16K},
 55932  		{FzName: ts + 26746 /* "atomic32k" */, FiValue: SQLITE_IOCAP_ATOMIC32K},
 55933  		{FzName: ts + 26756 /* "atomic64k" */, FiValue: SQLITE_IOCAP_ATOMIC64K},
 55934  		{FzName: ts + 26766 /* "sequential" */, FiValue: SQLITE_IOCAP_SEQUENTIAL},
 55935  		{FzName: ts + 26777 /* "safe_append" */, FiValue: SQLITE_IOCAP_SAFE_APPEND},
 55936  		{FzName: ts + 26789 /* "powersafe_overwr..." */, FiValue: SQLITE_IOCAP_POWERSAFE_OVERWRITE},
 55937  		{FzName: ts + 26809 /* "batch-atomic" */, FiValue: SQLITE_IOCAP_BATCH_ATOMIC},
 55938  		{},
 55939  	}
 55940  	var i int32
 55941  	var iDc int32 = 0
 55942  	*(*int32)(unsafe.Pointer(bp + 68 /* iSectorSize */)) = 0
 55943  	var setSectorsize int32 = 0
 55944  	var setDeviceChar int32 = 0
 55945  
 55946  	for i = 0; i < objc; i = i + (2) {
 55947  		// var nOpt int32 at bp+64, 4
 55948  
 55949  		var zOpt uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp+64 /* &nOpt */)
 55950  
 55951  		if (((*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) > 11) || (*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) < 2)) || (libc.Xstrncmp(tls, ts+26822 /* "-sectorsize" */, zOpt, uint64(*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)))) != 0)) &&
 55952  			(((*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) > 16) || (*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) < 2)) || (libc.Xstrncmp(tls, ts+26834 /* "-characteristics" */, zOpt, uint64(*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)))) != 0)) {
 55953  			tcl.XTcl_AppendResult(tls, interp,
 55954  				libc.VaList(bp, ts+26851 /* "Bad option: \"" */, zOpt,
 55955  					ts+26865 /* "\" - must be \"-ch..." */, 0))
 55956  			return TCL_ERROR
 55957  		}
 55958  		if i == (objc - 1) {
 55959  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26913 /* "Option requires ..." */, zOpt, ts+12415 /* "\"" */, 0))
 55960  			return TCL_ERROR
 55961  		}
 55962  
 55963  		if int32(*(*int8)(unsafe.Pointer(zOpt + 1))) == 's' {
 55964  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+68 /* &iSectorSize */) != 0 {
 55965  				return TCL_ERROR
 55966  			}
 55967  			setSectorsize = 1
 55968  		} else {
 55969  			var j int32
 55970  			// var apObj uintptr at bp+80, 8
 55971  
 55972  			// var nObj int32 at bp+72, 4
 55973  
 55974  			if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+72 /* &nObj */, bp+80 /* &apObj */) != 0 {
 55975  				return TCL_ERROR
 55976  			}
 55977  			for j = 0; j < *(*int32)(unsafe.Pointer(bp + 72 /* nObj */)); j++ {
 55978  				var rc int32
 55979  				// var iChoice int32 at bp+312, 4
 55980  
 55981  				var pFlag uintptr = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* apObj */)) + uintptr(j)*8)))
 55982  				(*Tcl_Obj)(unsafe.Pointer(pFlag)).FrefCount++
 55983  				tcl.XTcl_UtfToLower(tls, tcl.XTcl_GetString(tls, pFlag))
 55984  
 55985  				rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 55986  					interp, pFlag, bp+88 /* &aFlag[0] */, int32(unsafe.Sizeof(DeviceFlag{})), ts+26944 /* "no such flag" */, 0, bp+312 /* &iChoice */)
 55987  				for ok := true; ok; ok = 0 != 0 {
 55988  					var _objPtr uintptr = pFlag
 55989  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 55990  						tcl.XTclFreeObj(tls, _objPtr)
 55991  					}
 55992  				}
 55993  				if rc != 0 {
 55994  					return TCL_ERROR
 55995  				}
 55996  
 55997  				iDc = iDc | ((*DeviceFlag)(unsafe.Pointer(bp + 88 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 312 /* iChoice */)))*16)).FiValue)
 55998  			}
 55999  			setDeviceChar = 1
 56000  		}
 56001  	}
 56002  
 56003  	if setDeviceChar != 0 {
 56004  		*(*int32)(unsafe.Pointer(piDeviceChar)) = iDc
 56005  	}
 56006  	if setSectorsize != 0 {
 56007  		*(*int32)(unsafe.Pointer(piSectorSize)) = *(*int32)(unsafe.Pointer(bp + 68 /* iSectorSize */))
 56008  	}
 56009  
 56010  	return TCL_OK
 56011  }
 56012  
 56013  type DeviceFlag = struct {
 56014  	FzName  uintptr
 56015  	FiValue int32
 56016  	_       [4]byte
 56017  } /* test6.c:727:3 */
 56018  
 56019  // tclcmd:   sqlite3_crash_now
 56020  //
 56021  // Simulate a crash immediately. This function does not return
 56022  // (writeListSync() calls exit(-1)).
 56023  func crashNowCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:820:26: */
 56024  	if objc != 1 {
 56025  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 56026  		return TCL_ERROR
 56027  	}
 56028  	writeListSync(tls, uintptr(0), 1)
 56029  
 56030  	return TCL_OK
 56031  }
 56032  
 56033  // tclcmd:   sqlite_crash_enable ENABLE ?DEFAULT?
 56034  //
 56035  // Parameter ENABLE must be a boolean value. If true, then the "crash"
 56036  // vfs is added to the system. If false, it is removed.
 56037  func crashEnableCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:841:26: */
 56038  	bp := tls.Alloc(8)
 56039  	defer tls.Free(8)
 56040  
 56041  	// var isEnable int32 at bp, 4
 56042  
 56043  	*(*int32)(unsafe.Pointer(bp + 4 /* isDefault */)) = 0
 56044  
 56045  	if (objc != 2) && (objc != 3) {
 56046  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+26957 /* "ENABLE ?DEFAULT?" */)
 56047  		return TCL_ERROR
 56048  	}
 56049  
 56050  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &isEnable */) != 0 {
 56051  		return TCL_ERROR
 56052  	}
 56053  	if (objc == 3) && (tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+4 /* &isDefault */) != 0) {
 56054  		return TCL_ERROR
 56055  	}
 56056  
 56057  	if ((*(*int32)(unsafe.Pointer(bp /* isEnable */)) != 0) && (crashVfs.FpAppData != 0)) || (!(*(*int32)(unsafe.Pointer(bp /* isEnable */)) != 0) && !(int32(crashVfs.FpAppData) != 0)) {
 56058  		return TCL_OK
 56059  	}
 56060  
 56061  	if crashVfs.FpAppData == uintptr(0) {
 56062  		var pOriginalVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 56063  		crashVfs.FmxPathname = (*sqlite3_vfs)(unsafe.Pointer(pOriginalVfs)).FmxPathname
 56064  		crashVfs.FpAppData = pOriginalVfs
 56065  		crashVfs.FszOsFile = (int32(uint64(unsafe.Sizeof(CrashFile{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(pOriginalVfs)).FszOsFile)))
 56066  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&crashVfs)), *(*int32)(unsafe.Pointer(bp + 4 /* isDefault */)))
 56067  	} else {
 56068  		crashVfs.FpAppData = uintptr(0)
 56069  		sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&crashVfs)))
 56070  	}
 56071  
 56072  	return TCL_OK
 56073  }
 56074  
 56075  var crashVfs = sqlite3_vfs{
 56076  	FiVersion: 2,          // pNext
 56077  	FzName:    ts + 26974, /* "crash" */ // pAppData
 56078  
 56079  	FxOpen:         0, // xOpen
 56080  	FxDelete:       0, // xDelete
 56081  	FxAccess:       0, // xAccess
 56082  	FxFullPathname: 0, // xFullPathname
 56083  	FxDlOpen:       0, // xDlOpen
 56084  	FxDlError:      0, // xDlError
 56085  	FxDlSym:        0, // xDlSym
 56086  	FxDlClose:      0, // xDlClose
 56087  	FxRandomness:   0, // xRandomness
 56088  	FxSleep:        0, // xSleep
 56089  	FxCurrentTime:  0, // xCurrentTime
 56090  	FxGetLastError: 0, // xCurrentTimeInt64
 56091  } /* test6.c:849:22 */
 56092  
 56093  // tclcmd:   sqlite_crashparams ?OPTIONS? DELAY CRASHFILE
 56094  //
 56095  // This procedure implements a TCL command that enables crash testing
 56096  // in testfixture.  Once enabled, crash testing cannot be disabled.
 56097  //
 56098  // Available options are "-characteristics" and "-sectorsize". Both require
 56099  // an argument. For -sectorsize, this is the simulated sector size in
 56100  // bytes. For -characteristics, the argument must be a list of io-capability
 56101  // flags to simulate. Valid flags are "atomic", "atomic512", "atomic1K",
 56102  // "atomic2K", "atomic4K", "atomic8K", "atomic16K", "atomic32K",
 56103  // "atomic64K", "sequential" and "safe_append".
 56104  //
 56105  // Example:
 56106  //
 56107  //   sqlite_crashparams -sect 1024 -char {atomic sequential} ./test.db 1
 56108  //
 56109  func crashParamsObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:920:26: */
 56110  	bp := tls.Alloc(48)
 56111  	defer tls.Free(48)
 56112  
 56113  	// var iDelay int32 at bp+36, 4
 56114  
 56115  	var zCrashFile uintptr
 56116  	// var nCrashFile int32 at bp+32, 4
 56117  
 56118  	// var iDc int32 at bp+40, 4
 56119  
 56120  	// var iSectorSize int32 at bp+44, 4
 56121  
 56122  	*(*int32)(unsafe.Pointer(bp + 40 /* iDc */)) = -1
 56123  	*(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */)) = -1
 56124  
 56125  	if !(objc < 3) {
 56126  		goto __1
 56127  	}
 56128  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+26980 /* "?OPTIONS? DELAY ..." */)
 56129  	goto error
 56130  __1:
 56131  	;
 56132  
 56133  	zCrashFile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*8)), bp+32 /* &nCrashFile */)
 56134  	if !(uint64(*(*int32)(unsafe.Pointer(bp + 32 /* nCrashFile */))) >= uint64(unsafe.Sizeof([500]int8{}))) {
 56135  		goto __2
 56136  	}
 56137  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+27006 /* "Filename is too ..." */, zCrashFile, ts+12415 /* "\"" */, 0))
 56138  	goto error
 56139  __2:
 56140  	;
 56141  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*8)), bp+36 /* &iDelay */) != 0) {
 56142  		goto __3
 56143  	}
 56144  	goto error
 56145  __3:
 56146  	;
 56147  
 56148  	if !(processDevSymArgs(tls, interp, (objc-3), (objv+1*8), bp+40 /* &iDc */, bp+44 /* &iSectorSize */) != 0) {
 56149  		goto __4
 56150  	}
 56151  	return TCL_ERROR
 56152  __4:
 56153  	;
 56154  
 56155  	if !(*(*int32)(unsafe.Pointer(bp + 40 /* iDc */)) >= 0) {
 56156  		goto __5
 56157  	}
 56158  	g.FiDeviceCharacteristics = *(*int32)(unsafe.Pointer(bp + 40 /* iDc */))
 56159  __5:
 56160  	;
 56161  	if !(*(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */)) >= 0) {
 56162  		goto __6
 56163  	}
 56164  	g.FiSectorSize = *(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */))
 56165  __6:
 56166  	;
 56167  
 56168  	g.FiCrash = *(*int32)(unsafe.Pointer(bp + 36 /* iDelay */))
 56169  	libc.Xmemcpy(tls, uintptr(unsafe.Pointer(&g))+28 /* &.zCrashFile */, zCrashFile, (uint64(*(*int32)(unsafe.Pointer(bp + 32 /* nCrashFile */)) + 1)))
 56170  	sqlite3CrashTestEnable = 1
 56171  	return TCL_OK
 56172  
 56173  error:
 56174  	return TCL_ERROR
 56175  }
 56176  
 56177  func devSymObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:967:26: */
 56178  	bp := tls.Alloc(8)
 56179  	defer tls.Free(8)
 56180  
 56181  	*(*int32)(unsafe.Pointer(bp /* iDc */)) = -1
 56182  	*(*int32)(unsafe.Pointer(bp + 4 /* iSectorSize */)) = -1
 56183  
 56184  	if processDevSymArgs(tls, interp, (objc-1), (objv+1*8), bp /* &iDc */, bp+4 /* &iSectorSize */) != 0 {
 56185  		return TCL_ERROR
 56186  	}
 56187  	devsym_register(tls, *(*int32)(unsafe.Pointer(bp /* iDc */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSectorSize */)))
 56188  
 56189  	return TCL_OK
 56190  }
 56191  
 56192  // tclcmd: sqlite3_crash_on_write N
 56193  func writeCrashObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:989:26: */
 56194  	bp := tls.Alloc(4)
 56195  	defer tls.Free(4)
 56196  
 56197  	*(*int32)(unsafe.Pointer(bp /* nWrite */)) = 0
 56198  
 56199  	if objc != 2 {
 56200  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+27030 /* "NWRITE" */)
 56201  		return TCL_ERROR
 56202  	}
 56203  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &nWrite */) != 0 {
 56204  		return TCL_ERROR
 56205  	}
 56206  
 56207  	devsym_crash_on_write(tls, *(*int32)(unsafe.Pointer(bp /* nWrite */)))
 56208  	return TCL_OK
 56209  }
 56210  
 56211  // tclcmd: unregister_devsim
 56212  func dsUnregisterObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1013:26: */
 56213  
 56214  	if objc != 1 {
 56215  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 56216  		return TCL_ERROR
 56217  	}
 56218  
 56219  	devsym_unregister(tls)
 56220  	return TCL_OK
 56221  }
 56222  
 56223  // tclcmd: register_jt_vfs ?-default? PARENT-VFS
 56224  func jtObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1033:26: */
 56225  	bp := tls.Alloc(48)
 56226  	defer tls.Free(48)
 56227  
 56228  	var zParent uintptr = uintptr(0)
 56229  
 56230  	if (objc != 2) && (objc != 3) {
 56231  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+27037 /* "?-default? PAREN..." */)
 56232  		return TCL_ERROR
 56233  	}
 56234  	zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 56235  	if objc == 3 {
 56236  		if libc.Xstrcmp(tls, zParent, ts+27059 /* "-default" */) != 0 {
 56237  			tcl.XTcl_AppendResult(tls, interp,
 56238  				libc.VaList(bp, ts+12321 /* "bad option \"" */, zParent, ts+27068 /* "\": must be -defa..." */, 0))
 56239  			return TCL_ERROR
 56240  		}
 56241  		zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 56242  	}
 56243  
 56244  	if !(int32(*(*int8)(unsafe.Pointer(zParent))) != 0) {
 56245  		zParent = uintptr(0)
 56246  	}
 56247  	if jt_register(tls, zParent, (libc.Bool32(objc == 3))) != 0 {
 56248  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+27088 /* "Error in jt_regi..." */, 0))
 56249  		return TCL_ERROR
 56250  	}
 56251  
 56252  	return TCL_OK
 56253  }
 56254  
 56255  // tclcmd: unregister_jt_vfs
 56256  func jtUnregisterObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1071:26: */
 56257  
 56258  	if objc != 1 {
 56259  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 56260  		return TCL_ERROR
 56261  	}
 56262  
 56263  	jt_unregister(tls)
 56264  	return TCL_OK
 56265  }
 56266  
 56267  // This procedure registers the TCL procedures defined in this file.
 56268  func Sqlitetest6_Init(tls *libc.TLS, interp uintptr) int32 { /* test6.c:1093:5: */
 56269  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27109 /* "sqlite3_crash_en..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56270  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56271  	}{crashEnableCmd})), uintptr(0), uintptr(0))
 56272  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27130 /* "sqlite3_crashpar..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56273  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56274  	}{crashParamsObjCmd})), uintptr(0), uintptr(0))
 56275  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27150 /* "sqlite3_crash_no..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56276  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56277  	}{crashNowCmd})), uintptr(0), uintptr(0))
 56278  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27168 /* "sqlite3_simulate..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56279  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56280  	}{devSymObjCmd})), uintptr(0), uintptr(0))
 56281  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27192 /* "sqlite3_crash_on..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56282  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56283  	}{writeCrashObjCmd})), uintptr(0), uintptr(0))
 56284  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27215 /* "unregister_devsi..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56285  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56286  	}{dsUnregisterObjCmd})), uintptr(0), uintptr(0))
 56287  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27233 /* "register_jt_vfs" */, *(*uintptr)(unsafe.Pointer(&struct {
 56288  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56289  	}{jtObjCmd})), uintptr(0), uintptr(0))
 56290  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27249 /* "unregister_jt_vf..." */, *(*uintptr)(unsafe.Pointer(&struct {
 56291  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 56292  	}{jtUnregisterObjCmd})), uintptr(0), uintptr(0))
 56293  	return TCL_OK
 56294  }
 56295  
 56296  // Each thread is controlled by an instance of the following
 56297  // structure.
 56298  type Thread1 = struct {
 56299  	FzFilename  uintptr
 56300  	FxOp        uintptr
 56301  	FzArg       uintptr
 56302  	Fopnum      int32
 56303  	Fbusy       int32
 56304  	Fcompleted  int32
 56305  	_           [4]byte
 56306  	Fdb         uintptr
 56307  	FpStmt      uintptr
 56308  	FzErr       uintptr
 56309  	FzStaticErr uintptr
 56310  	Frc         int32
 56311  	Fargc       int32
 56312  	Fargv       [100]uintptr
 56313  	Fcolv       [100]uintptr
 56314  	FnServer    int32
 56315  	_           [4]byte
 56316  } /* test7.c:53:23 */
 56317  
 56318  // There can be as many as 26 threads running at once.  Each is named
 56319  // by a capital letter: A, B, C, ..., Y, Z.
 56320  var threadset1 [26]Thread1 /* test7.c:90:15: */
 56321  
 56322  // The main loop for a thread.  Threads use busy waiting.
 56323  func client_main(tls *libc.TLS, pArg uintptr) uintptr { /* test7.c:95:13: */
 56324  	var p uintptr = pArg
 56325  	if (*Thread1)(unsafe.Pointer(p)).Fdb != 0 {
 56326  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 56327  	}
 56328  	sqlite3_client_open(tls, (*Thread1)(unsafe.Pointer(p)).FzFilename, (p + 40 /* &.db */))
 56329  	if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*Thread1)(unsafe.Pointer(p)).Fdb) {
 56330  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.Xstrdup(tls, sqlite3.Xsqlite3_errmsg(tls, (*Thread1)(unsafe.Pointer(p)).Fdb))
 56331  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 56332  		(*Thread1)(unsafe.Pointer(p)).Fdb = uintptr(0)
 56333  	}
 56334  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56335  	(*Thread1)(unsafe.Pointer(p)).Fcompleted = 1
 56336  	for (*Thread1)(unsafe.Pointer(p)).Fopnum <= (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 56337  		libc2.Xsched_yield(tls)
 56338  	}
 56339  	for (*Thread1)(unsafe.Pointer(p)).FxOp != 0 {
 56340  		if ((*Thread1)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread1)(unsafe.Pointer(p)).FzErr != (*Thread1)(unsafe.Pointer(p)).FzStaticErr) {
 56341  			sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzErr)
 56342  			(*Thread1)(unsafe.Pointer(p)).FzErr = uintptr(0)
 56343  		}
 56344  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 8 /* &.xOp */))))(tls, p)
 56345  		(*Thread1)(unsafe.Pointer(p)).Fcompleted++
 56346  		for (*Thread1)(unsafe.Pointer(p)).Fopnum <= (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 56347  			libc2.Xsched_yield(tls)
 56348  		}
 56349  	}
 56350  	if (*Thread1)(unsafe.Pointer(p)).FpStmt != 0 {
 56351  		sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56352  		(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56353  	}
 56354  	if (*Thread1)(unsafe.Pointer(p)).Fdb != 0 {
 56355  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 56356  		(*Thread1)(unsafe.Pointer(p)).Fdb = uintptr(0)
 56357  	}
 56358  	if ((*Thread1)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread1)(unsafe.Pointer(p)).FzErr != (*Thread1)(unsafe.Pointer(p)).FzStaticErr) {
 56359  		sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzErr)
 56360  		(*Thread1)(unsafe.Pointer(p)).FzErr = uintptr(0)
 56361  	}
 56362  	(*Thread1)(unsafe.Pointer(p)).Fcompleted++
 56363  	sqlite3.Xsqlite3_thread_cleanup(tls)
 56364  	return uintptr(0)
 56365  }
 56366  
 56367  // Get a thread ID which is an upper case letter.  Return the index.
 56368  // If the argument is not a valid thread ID put an error message in
 56369  // the interpreter and return -1.
 56370  func parse_client_id(tls *libc.TLS, interp uintptr, zArg uintptr) int32 { /* test7.c:142:12: */
 56371  	bp := tls.Alloc(16)
 56372  	defer tls.Free(16)
 56373  
 56374  	if (((zArg == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zArg))) == 0)) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0)) || !(__sbistype(tls, int32(uint8(*(*int8)(unsafe.Pointer(zArg)))), uint64(X_CTYPE_U)) != 0) {
 56375  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26021 /* "thread ID must b..." */, 0))
 56376  		return -1
 56377  	}
 56378  	return (int32(*(*int8)(unsafe.Pointer(zArg))) - 'A')
 56379  }
 56380  
 56381  // Usage:    client_create NAME  FILENAME
 56382  //
 56383  // NAME should be an upper case letter.  Start the thread running with
 56384  // an open connection to the given database.
 56385  func tcl_client_create(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:156:26: */
 56386  	bp := tls.Alloc(96)
 56387  	defer tls.Free(96)
 56388  
 56389  	var i int32
 56390  	// var x pthread_t at bp+88, 8
 56391  
 56392  	var rc int32
 56393  
 56394  	if argc != 3 {
 56395  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56396  			ts+26060 /* " ID FILENAME" */, 0))
 56397  		return TCL_ERROR
 56398  	}
 56399  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56400  	if i < 0 {
 56401  		return TCL_ERROR
 56402  	}
 56403  	if threadset1[i].Fbusy != 0 {
 56404  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26073 /* "thread " */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+26081 /* " is already runn..." */, 0))
 56405  		return TCL_ERROR
 56406  	}
 56407  	threadset1[i].Fbusy = 1
 56408  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzFilename)
 56409  	threadset1[i].FzFilename = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 56410  	threadset1[i].Fopnum = 1
 56411  	threadset1[i].Fcompleted = 0
 56412  	rc = libc2.Xpthread_create(tls, bp+88 /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 56413  		f func(*libc.TLS, uintptr) uintptr
 56414  	}{client_main})), (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56415  	if rc != 0 {
 56416  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+26101 /* "failed to create..." */, 0))
 56417  		sqlite3.Xsqlite3_free(tls, threadset1[i].FzFilename)
 56418  		threadset1[i].Fbusy = 0
 56419  		return TCL_ERROR
 56420  	}
 56421  	libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp + 88 /* x */)))
 56422  	if threadset1[i].FnServer == 0 {
 56423  		threadset1[i].FnServer = 1
 56424  		sqlite3_server_start2(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688 + 1680 /* &.nServer */))
 56425  	}
 56426  	return TCL_OK
 56427  }
 56428  
 56429  // Wait for a thread to reach its idle state.
 56430  func client_wait(tls *libc.TLS, p uintptr) { /* test7.c:200:13: */
 56431  	for (*Thread1)(unsafe.Pointer(p)).Fopnum > (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 56432  		libc2.Xsched_yield(tls)
 56433  	}
 56434  }
 56435  
 56436  // Usage:  client_wait ID
 56437  //
 56438  // Wait on thread ID to reach its idle state.
 56439  func tcl_client_wait(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:209:26: */
 56440  	bp := tls.Alloc(48)
 56441  	defer tls.Free(48)
 56442  
 56443  	var i int32
 56444  
 56445  	if argc != 2 {
 56446  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56447  			ts+26129 /* " ID" */, 0))
 56448  		return TCL_ERROR
 56449  	}
 56450  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56451  	if i < 0 {
 56452  		return TCL_ERROR
 56453  	}
 56454  	if !(threadset1[i].Fbusy != 0) {
 56455  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56456  		return TCL_ERROR
 56457  	}
 56458  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56459  	return TCL_OK
 56460  }
 56461  
 56462  // Stop a thread.
 56463  func stop_thread(tls *libc.TLS, p uintptr) { /* test7.c:235:13: */
 56464  	client_wait(tls, p)
 56465  	(*Thread1)(unsafe.Pointer(p)).FxOp = uintptr(0)
 56466  	(*Thread1)(unsafe.Pointer(p)).Fopnum++
 56467  	client_wait(tls, p)
 56468  	sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzArg)
 56469  	(*Thread1)(unsafe.Pointer(p)).FzArg = uintptr(0)
 56470  	sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzFilename)
 56471  	(*Thread1)(unsafe.Pointer(p)).FzFilename = uintptr(0)
 56472  	(*Thread1)(unsafe.Pointer(p)).Fbusy = 0
 56473  }
 56474  
 56475  // Usage:  client_halt ID
 56476  //
 56477  // Cause a client thread to shut itself down.  Wait for the shutdown to be
 56478  // completed.  If ID is "*" then stop all client threads.
 56479  func tcl_client_halt(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:253:26: */
 56480  	bp := tls.Alloc(48)
 56481  	defer tls.Free(48)
 56482  
 56483  	var i int32
 56484  
 56485  	if argc != 2 {
 56486  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56487  			ts+26129 /* " ID" */, 0))
 56488  		return TCL_ERROR
 56489  	}
 56490  	if (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*8))))) == '*') && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*8)) + 1))) == 0) {
 56491  		for i = 0; i < N_THREAD; i++ {
 56492  			if threadset1[i].Fbusy != 0 {
 56493  				stop_thread(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56494  			}
 56495  		}
 56496  	} else {
 56497  		i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56498  		if i < 0 {
 56499  			return TCL_ERROR
 56500  		}
 56501  		if !(threadset1[i].Fbusy != 0) {
 56502  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56503  			return TCL_ERROR
 56504  		}
 56505  		stop_thread(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56506  	}
 56507  
 56508  	// If no client threads are still running, also stop the server
 56509  	for i = 0; (i < N_THREAD) && (threadset1[i].Fbusy == 0); i++ {
 56510  	}
 56511  	if i >= N_THREAD {
 56512  		sqlite3_server_stop(tls)
 56513  		for 1 != 0 {
 56514  			for i = 0; (i < N_THREAD) && (threadset1[i].FnServer == 0); i++ {
 56515  			}
 56516  			if i == N_THREAD {
 56517  				break
 56518  			}
 56519  			libc2.Xsched_yield(tls)
 56520  		}
 56521  	}
 56522  	return TCL_OK
 56523  }
 56524  
 56525  // Usage: client_argc  ID
 56526  //
 56527  // Wait on the most recent client_step to complete, then return the
 56528  // number of columns in the result set.
 56529  func tcl_client_argc(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:301:26: */
 56530  	bp := tls.Alloc(172)
 56531  	defer tls.Free(172)
 56532  
 56533  	var i int32
 56534  	// var zBuf [100]int8 at bp+72, 100
 56535  
 56536  	if argc != 2 {
 56537  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56538  			ts+26129 /* " ID" */, 0))
 56539  		return TCL_ERROR
 56540  	}
 56541  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56542  	if i < 0 {
 56543  		return TCL_ERROR
 56544  	}
 56545  	if !(threadset1[i].Fbusy != 0) {
 56546  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56547  		return TCL_ERROR
 56548  	}
 56549  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56550  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, threadset1[i].Fargc))
 56551  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 56552  	return TCL_OK
 56553  }
 56554  
 56555  // Usage: client_argv  ID   N
 56556  //
 56557  // Wait on the most recent client_step to complete, then return the
 56558  // value of the N-th columns in the result set.
 56559  func tcl_client_argv(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:333:26: */
 56560  	bp := tls.Alloc(84)
 56561  	defer tls.Free(84)
 56562  
 56563  	var i int32
 56564  	// var n int32 at bp+80, 4
 56565  
 56566  	if argc != 3 {
 56567  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56568  			ts+26148 /* " ID N" */, 0))
 56569  		return TCL_ERROR
 56570  	}
 56571  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56572  	if i < 0 {
 56573  		return TCL_ERROR
 56574  	}
 56575  	if !(threadset1[i].Fbusy != 0) {
 56576  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56577  		return TCL_ERROR
 56578  	}
 56579  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &n */) != 0 {
 56580  		return TCL_ERROR
 56581  	}
 56582  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56583  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset1[i].Fargc) {
 56584  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 56585  		return TCL_ERROR
 56586  	}
 56587  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688 + 80 /* &.argv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*8)), 0))
 56588  	return TCL_OK
 56589  }
 56590  
 56591  // Usage: client_colname  ID   N
 56592  //
 56593  // Wait on the most recent client_step to complete, then return the
 56594  // name of the N-th columns in the result set.
 56595  func tcl_client_colname(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:369:26: */
 56596  	bp := tls.Alloc(84)
 56597  	defer tls.Free(84)
 56598  
 56599  	var i int32
 56600  	// var n int32 at bp+80, 4
 56601  
 56602  	if argc != 3 {
 56603  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56604  			ts+26148 /* " ID N" */, 0))
 56605  		return TCL_ERROR
 56606  	}
 56607  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56608  	if i < 0 {
 56609  		return TCL_ERROR
 56610  	}
 56611  	if !(threadset1[i].Fbusy != 0) {
 56612  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56613  		return TCL_ERROR
 56614  	}
 56615  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)), bp+80 /* &n */) != 0 {
 56616  		return TCL_ERROR
 56617  	}
 56618  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56619  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset1[i].Fargc) {
 56620  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 56621  		return TCL_ERROR
 56622  	}
 56623  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688 + 880 /* &.colv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*8)), 0))
 56624  	return TCL_OK
 56625  }
 56626  
 56627  // Usage: client_result  ID
 56628  //
 56629  // Wait on the most recent operation to complete, then return the
 56630  // result code from that operation.
 56631  func tcl_client_result(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:407:26: */
 56632  	bp := tls.Alloc(64)
 56633  	defer tls.Free(64)
 56634  
 56635  	var i int32
 56636  	var zName uintptr
 56637  
 56638  	if argc != 2 {
 56639  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56640  			ts+26129 /* " ID" */, 0))
 56641  		return TCL_ERROR
 56642  	}
 56643  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56644  	if i < 0 {
 56645  		return TCL_ERROR
 56646  	}
 56647  	if !(threadset1[i].Fbusy != 0) {
 56648  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56649  		return TCL_ERROR
 56650  	}
 56651  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56652  	zName = sqlite3.Xsqlite3ErrName(tls, threadset1[i].Frc)
 56653  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, zName, 0))
 56654  	return TCL_OK
 56655  }
 56656  
 56657  // Usage: client_error  ID
 56658  //
 56659  // Wait on the most recent operation to complete, then return the
 56660  // error string.
 56661  func tcl_client_error(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:439:26: */
 56662  	bp := tls.Alloc(64)
 56663  	defer tls.Free(64)
 56664  
 56665  	var i int32
 56666  
 56667  	if argc != 2 {
 56668  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56669  			ts+26129 /* " ID" */, 0))
 56670  		return TCL_ERROR
 56671  	}
 56672  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56673  	if i < 0 {
 56674  		return TCL_ERROR
 56675  	}
 56676  	if !(threadset1[i].Fbusy != 0) {
 56677  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56678  		return TCL_ERROR
 56679  	}
 56680  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56681  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, threadset1[i].FzErr, 0))
 56682  	return TCL_OK
 56683  }
 56684  
 56685  // This procedure runs in the thread to compile an SQL statement.
 56686  func do_compile1(tls *libc.TLS, p uintptr) { /* test7.c:466:13: */
 56687  	if (*Thread1)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 56688  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26181 /* "no database is o..." */)
 56689  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 56690  		return
 56691  	}
 56692  	if (*Thread1)(unsafe.Pointer(p)).FpStmt != 0 {
 56693  		sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56694  		(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56695  	}
 56696  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_prepare(tls, (*Thread1)(unsafe.Pointer(p)).Fdb, (*Thread1)(unsafe.Pointer(p)).FzArg, -1, (p + 48 /* &.pStmt */), uintptr(0))
 56697  }
 56698  
 56699  // Usage: client_compile ID SQL
 56700  //
 56701  // Compile a new virtual machine.
 56702  func tcl_client_compile(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:484:26: */
 56703  	bp := tls.Alloc(56)
 56704  	defer tls.Free(56)
 56705  
 56706  	var i int32
 56707  	if argc != 3 {
 56708  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56709  			ts+26201 /* " ID SQL" */, 0))
 56710  		return TCL_ERROR
 56711  	}
 56712  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56713  	if i < 0 {
 56714  		return TCL_ERROR
 56715  	}
 56716  	if !(threadset1[i].Fbusy != 0) {
 56717  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56718  		return TCL_ERROR
 56719  	}
 56720  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56721  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_compile1}))
 56722  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 56723  	threadset1[i].FzArg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 56724  	threadset1[i].Fopnum++
 56725  	return TCL_OK
 56726  }
 56727  
 56728  // This procedure runs in the thread to step the virtual machine.
 56729  func do_step1(tls *libc.TLS, p uintptr) { /* test7.c:513:13: */
 56730  	var i int32
 56731  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 56732  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 56733  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 56734  		return
 56735  	}
 56736  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_step(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56737  	if (*Thread1)(unsafe.Pointer(p)).Frc == SQLITE_ROW {
 56738  		(*Thread1)(unsafe.Pointer(p)).Fargc = sqlite3.Xsqlite3_column_count(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56739  		for i = 0; i < sqlite3.Xsqlite3_data_count(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt); i++ {
 56740  			*(*uintptr)(unsafe.Pointer((p + 80 /* &.argv */) + uintptr(i)*8)) = sqlite3.Xsqlite3_column_text(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt, i)
 56741  		}
 56742  		for i = 0; i < (*Thread1)(unsafe.Pointer(p)).Fargc; i++ {
 56743  			*(*uintptr)(unsafe.Pointer((p + 880 /* &.colv */) + uintptr(i)*8)) = sqlite3.Xsqlite3_column_name(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt, i)
 56744  		}
 56745  	}
 56746  }
 56747  
 56748  // Usage: client_step ID
 56749  //
 56750  // Advance the virtual machine by one step
 56751  func tcl_client_step(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:537:26: */
 56752  	bp := tls.Alloc(48)
 56753  	defer tls.Free(48)
 56754  
 56755  	var i int32
 56756  	if argc != 2 {
 56757  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56758  			ts+26238 /* " IDL" */, 0))
 56759  		return TCL_ERROR
 56760  	}
 56761  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56762  	if i < 0 {
 56763  		return TCL_ERROR
 56764  	}
 56765  	if !(threadset1[i].Fbusy != 0) {
 56766  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56767  		return TCL_ERROR
 56768  	}
 56769  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56770  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_step1}))
 56771  	threadset1[i].Fopnum++
 56772  	return TCL_OK
 56773  }
 56774  
 56775  // This procedure runs in the thread to finalize a virtual machine.
 56776  func do_finalize1(tls *libc.TLS, p uintptr) { /* test7.c:564:13: */
 56777  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 56778  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 56779  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 56780  		return
 56781  	}
 56782  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56783  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56784  }
 56785  
 56786  // Usage: client_finalize ID
 56787  //
 56788  // Finalize the virtual machine.
 56789  func tcl_client_finalize(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:579:26: */
 56790  	bp := tls.Alloc(48)
 56791  	defer tls.Free(48)
 56792  
 56793  	var i int32
 56794  	if argc != 2 {
 56795  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56796  			ts+26238 /* " IDL" */, 0))
 56797  		return TCL_ERROR
 56798  	}
 56799  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56800  	if i < 0 {
 56801  		return TCL_ERROR
 56802  	}
 56803  	if !(threadset1[i].Fbusy != 0) {
 56804  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56805  		return TCL_ERROR
 56806  	}
 56807  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56808  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_finalize1}))
 56809  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 56810  	threadset1[i].FzArg = uintptr(0)
 56811  	threadset1[i].Fopnum++
 56812  	return TCL_OK
 56813  }
 56814  
 56815  // This procedure runs in the thread to reset a virtual machine.
 56816  func do_reset(tls *libc.TLS, p uintptr) { /* test7.c:608:13: */
 56817  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 56818  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+64 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 56819  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 56820  		return
 56821  	}
 56822  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_reset(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 56823  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56824  }
 56825  
 56826  // Usage: client_reset ID
 56827  //
 56828  // Finalize the virtual machine.
 56829  func tcl_client_reset(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:623:26: */
 56830  	bp := tls.Alloc(48)
 56831  	defer tls.Free(48)
 56832  
 56833  	var i int32
 56834  	if argc != 2 {
 56835  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56836  			ts+26238 /* " IDL" */, 0))
 56837  		return TCL_ERROR
 56838  	}
 56839  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56840  	if i < 0 {
 56841  		return TCL_ERROR
 56842  	}
 56843  	if !(threadset1[i].Fbusy != 0) {
 56844  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56845  		return TCL_ERROR
 56846  	}
 56847  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56848  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_reset}))
 56849  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 56850  	threadset1[i].FzArg = uintptr(0)
 56851  	threadset1[i].Fopnum++
 56852  	return TCL_OK
 56853  }
 56854  
 56855  // Usage: client_swap ID ID
 56856  //
 56857  // Interchange the sqlite* pointer between two threads.
 56858  func tcl_client_swap(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:654:26: */
 56859  	bp := tls.Alloc(64)
 56860  	defer tls.Free(64)
 56861  
 56862  	var i int32
 56863  	var j int32
 56864  	var temp uintptr
 56865  	if argc != 3 {
 56866  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56867  			ts+26243 /* " ID1 ID2" */, 0))
 56868  		return TCL_ERROR
 56869  	}
 56870  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 56871  	if i < 0 {
 56872  		return TCL_ERROR
 56873  	}
 56874  	if !(threadset1[i].Fbusy != 0) {
 56875  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56876  		return TCL_ERROR
 56877  	}
 56878  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*1688))
 56879  	j = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 56880  	if j < 0 {
 56881  		return TCL_ERROR
 56882  	}
 56883  	if !(threadset1[j].Fbusy != 0) {
 56884  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26133 /* "no such thread" */, 0))
 56885  		return TCL_ERROR
 56886  	}
 56887  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(j)*1688))
 56888  	temp = threadset1[i].Fdb
 56889  	threadset1[i].Fdb = threadset1[j].Fdb
 56890  	threadset1[j].Fdb = temp
 56891  	return TCL_OK
 56892  }
 56893  
 56894  // Register commands with the TCL interpreter.
 56895  func Sqlitetest7_Init(tls *libc.TLS, interp uintptr) int32 { /* test7.c:690:5: */
 56896  	var i int32
 56897  
 56898  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd6)) / uint64(unsafe.Sizeof(struct {
 56899  		FzName uintptr
 56900  		FxProc uintptr
 56901  	}{}))); i++ {
 56902  		tcl.XTcl_CreateCommand(tls, interp, aCmd6[i].FzName, aCmd6[i].FxProc, uintptr(0), uintptr(0))
 56903  	}
 56904  	return TCL_OK
 56905  }
 56906  
 56907  var aCmd6 = [13]struct {
 56908  	FzName uintptr
 56909  	FxProc uintptr
 56910  }{
 56911  	{FzName: ts + 27267 /* "client_create" */, FxProc: 0},
 56912  	{FzName: ts + 27281 /* "client_wait" */, FxProc: 0},
 56913  	{FzName: ts + 27293 /* "client_halt" */, FxProc: 0},
 56914  	{FzName: ts + 27305 /* "client_argc" */, FxProc: 0},
 56915  	{FzName: ts + 27317 /* "client_argv" */, FxProc: 0},
 56916  	{FzName: ts + 27329 /* "client_colname" */, FxProc: 0},
 56917  	{FzName: ts + 27344 /* "client_result" */, FxProc: 0},
 56918  	{FzName: ts + 27358 /* "client_error" */, FxProc: 0},
 56919  	{FzName: ts + 27371 /* "client_compile" */, FxProc: 0},
 56920  	{FzName: ts + 27386 /* "client_step" */, FxProc: 0},
 56921  	{FzName: ts + 27398 /* "client_reset" */, FxProc: 0},
 56922  	{FzName: ts + 27411 /* "client_finalize" */, FxProc: 0},
 56923  	{FzName: ts + 27427 /* "client_swap" */, FxProc: 0},
 56924  } /* test7.c:694:5 */
 56925  
 56926  // end block for C++
 56927  
 56928  // Local Variables:
 56929  // mode: c
 56930  // c-basic-offset: 4
 56931  // fill-column: 78
 56932  // End:
 56933  // -
 56934  // SPDX-License-Identifier: BSD-3-Clause
 56935  //
 56936  // Copyright (c) 1990, 1993
 56937  //	The Regents of the University of California.  All rights reserved.
 56938  //
 56939  // Redistribution and use in source and binary forms, with or without
 56940  // modification, are permitted provided that the following conditions
 56941  // are met:
 56942  // 1. Redistributions of source code must retain the above copyright
 56943  //    notice, this list of conditions and the following disclaimer.
 56944  // 2. Redistributions in binary form must reproduce the above copyright
 56945  //    notice, this list of conditions and the following disclaimer in the
 56946  //    documentation and/or other materials provided with the distribution.
 56947  // 3. Neither the name of the University nor the names of its contributors
 56948  //    may be used to endorse or promote products derived from this software
 56949  //    without specific prior written permission.
 56950  //
 56951  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 56952  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 56953  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 56954  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 56955  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 56956  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 56957  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 56958  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 56959  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 56960  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 56961  // SUCH DAMAGE.
 56962  //
 56963  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 56964  // $FreeBSD$
 56965  
 56966  // -
 56967  // SPDX-License-Identifier: BSD-3-Clause
 56968  //
 56969  // Copyright (c) 1990, 1993
 56970  //	The Regents of the University of California.  All rights reserved.
 56971  //
 56972  // Redistribution and use in source and binary forms, with or without
 56973  // modification, are permitted provided that the following conditions
 56974  // are met:
 56975  // 1. Redistributions of source code must retain the above copyright
 56976  //    notice, this list of conditions and the following disclaimer.
 56977  // 2. Redistributions in binary form must reproduce the above copyright
 56978  //    notice, this list of conditions and the following disclaimer in the
 56979  //    documentation and/or other materials provided with the distribution.
 56980  // 3. Neither the name of the University nor the names of its contributors
 56981  //    may be used to endorse or promote products derived from this software
 56982  //    without specific prior written permission.
 56983  //
 56984  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 56985  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 56986  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 56987  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 56988  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 56989  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 56990  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 56991  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 56992  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 56993  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 56994  // SUCH DAMAGE.
 56995  //
 56996  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 56997  // $FreeBSD$
 56998  
 56999  type echo_vtab1 = struct {
 57000  	Fbase          sqlite3_vtab
 57001  	Finterp        uintptr
 57002  	Fdb            uintptr
 57003  	FisPattern     int32
 57004  	FinTransaction int32
 57005  	FzThis         uintptr
 57006  	FzTableName    uintptr
 57007  	FzLogName      uintptr
 57008  	FnCol          int32
 57009  	_              [4]byte
 57010  	FaIndex        uintptr
 57011  	FaCol          uintptr
 57012  } /* test8.c:27:9 */
 57013  
 57014  // end block for C++
 57015  
 57016  // Local Variables:
 57017  // mode: c
 57018  // c-basic-offset: 4
 57019  // fill-column: 78
 57020  // End:
 57021  // -
 57022  // SPDX-License-Identifier: BSD-3-Clause
 57023  //
 57024  // Copyright (c) 1990, 1993
 57025  //	The Regents of the University of California.  All rights reserved.
 57026  //
 57027  // Redistribution and use in source and binary forms, with or without
 57028  // modification, are permitted provided that the following conditions
 57029  // are met:
 57030  // 1. Redistributions of source code must retain the above copyright
 57031  //    notice, this list of conditions and the following disclaimer.
 57032  // 2. Redistributions in binary form must reproduce the above copyright
 57033  //    notice, this list of conditions and the following disclaimer in the
 57034  //    documentation and/or other materials provided with the distribution.
 57035  // 3. Neither the name of the University nor the names of its contributors
 57036  //    may be used to endorse or promote products derived from this software
 57037  //    without specific prior written permission.
 57038  //
 57039  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 57040  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 57041  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 57042  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 57043  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 57044  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 57045  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 57046  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 57047  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 57048  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 57049  // SUCH DAMAGE.
 57050  //
 57051  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 57052  // $FreeBSD$
 57053  
 57054  // -
 57055  // SPDX-License-Identifier: BSD-3-Clause
 57056  //
 57057  // Copyright (c) 1990, 1993
 57058  //	The Regents of the University of California.  All rights reserved.
 57059  //
 57060  // Redistribution and use in source and binary forms, with or without
 57061  // modification, are permitted provided that the following conditions
 57062  // are met:
 57063  // 1. Redistributions of source code must retain the above copyright
 57064  //    notice, this list of conditions and the following disclaimer.
 57065  // 2. Redistributions in binary form must reproduce the above copyright
 57066  //    notice, this list of conditions and the following disclaimer in the
 57067  //    documentation and/or other materials provided with the distribution.
 57068  // 3. Neither the name of the University nor the names of its contributors
 57069  //    may be used to endorse or promote products derived from this software
 57070  //    without specific prior written permission.
 57071  //
 57072  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 57073  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 57074  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 57075  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 57076  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 57077  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 57078  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 57079  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 57080  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 57081  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 57082  // SUCH DAMAGE.
 57083  //
 57084  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 57085  // $FreeBSD$
 57086  
 57087  type echo_vtab = echo_vtab1 /* test8.c:27:26 */
 57088  type echo_cursor1 = struct {
 57089  	Fbase  sqlite3_vtab_cursor
 57090  	FpStmt uintptr
 57091  } /* test8.c:28:9 */
 57092  
 57093  type echo_cursor = echo_cursor1 /* test8.c:28:28 */
 57094  
 57095  func simulateVtabError(tls *libc.TLS, p uintptr, zMethod uintptr) int32 { /* test8.c:97:12: */
 57096  	bp := tls.Alloc(152)
 57097  	defer tls.Free(152)
 57098  
 57099  	var zErr uintptr
 57100  	// var zVarname [128]int8 at bp+24, 128
 57101  
 57102  	*(*int8)(unsafe.Pointer(bp + 24 /* &zVarname[0] */ + 127)) = int8(0)
 57103  	sqlite3.Xsqlite3_snprintf(tls, 127, bp+24 /* &zVarname[0] */, ts+27439 /* "echo_module_fail..." */, libc.VaList(bp, zMethod, (*echo_vtab)(unsafe.Pointer(p)).FzTableName))
 57104  	zErr = tcl.XTcl_GetVar2(tls, (*echo_vtab)(unsafe.Pointer(p)).Finterp, bp+24 /* &zVarname[0] */, uintptr(0), TCL_GLOBAL_ONLY)
 57105  	if zErr != 0 {
 57106  		(*echo_vtab)(unsafe.Pointer(p)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+27463 /* "echo-vtab-error:..." */, libc.VaList(bp+16, zErr))
 57107  	}
 57108  	return (libc.Bool32(zErr != uintptr(0)))
 57109  }
 57110  
 57111  // Convert an SQL-style quoted string into a normal string by removing
 57112  // the quote characters.  The conversion is done in-place.  If the
 57113  // input does not begin with a quote character, then this routine
 57114  // is a no-op.
 57115  //
 57116  // Examples:
 57117  //
 57118  //     "abc"   becomes   abc
 57119  //     'xyz'   becomes   xyz
 57120  //     [pqr]   becomes   pqr
 57121  //     `mno`   becomes   mno
 57122  func dequoteString(tls *libc.TLS, z uintptr) { /* test8.c:122:13: */
 57123  	var quote int32
 57124  	var i int32
 57125  	var j int32
 57126  	if z == uintptr(0) {
 57127  		return
 57128  	}
 57129  	quote = int32(*(*int8)(unsafe.Pointer(z)))
 57130  	switch quote {
 57131  	case '\'':
 57132  		break
 57133  	case '"':
 57134  		break
 57135  	case '`':
 57136  		break // For MySQL compatibility
 57137  	case '[':
 57138  		quote = ']'
 57139  		break // For MS SqlServer compatibility
 57140  	default:
 57141  		return
 57142  	}
 57143  	i = 1
 57144  	j = 0
 57145  	for ; *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0; i++ {
 57146  		if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == quote {
 57147  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((i + 1))))) == quote {
 57148  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(quote)
 57149  				i++
 57150  			} else {
 57151  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(0)
 57152  				break
 57153  			}
 57154  		} else {
 57155  			*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(i)))
 57156  		}
 57157  	}
 57158  }
 57159  
 57160  // Retrieve the column names for the table named zTab via database
 57161  // connection db. SQLITE_OK is returned on success, or an sqlite error
 57162  // code otherwise.
 57163  //
 57164  // If successful, the number of columns is written to *pnCol. *paCol is
 57165  // set to point at sqlite3_malloc()'d space containing the array of
 57166  // nCol column names. The caller is responsible for calling sqlite3_free
 57167  // on *paCol.
 57168  func getColumnNames(tls *libc.TLS, db uintptr, zTab uintptr, paCol uintptr, pnCol uintptr) int32 { /* test8.c:159:12: */
 57169  	bp := tls.Alloc(24)
 57170  	defer tls.Free(24)
 57171  
 57172  	var aCol uintptr
 57173  	var zSql uintptr
 57174  	// var pStmt uintptr at bp+16, 8
 57175  
 57176  	var rc int32
 57177  	var nCol int32
 57178  	var zName uintptr
 57179  	var ii int32
 57180  	var nBytes int32
 57181  	var zSpace uintptr
 57182  	aCol = uintptr(0)
 57183  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0)
 57184  	rc = SQLITE_OK
 57185  	nCol = 0
 57186  
 57187  	// Prepare the statement "SELECT * FROM <tbl>". The column names
 57188  	// of the result set of the compiled SELECT will be the same as
 57189  	// the column names of table <tbl>.
 57190  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27483 /* "SELECT * FROM %Q" */, libc.VaList(bp, zTab))
 57191  	if !(!(zSql != 0)) {
 57192  		goto __1
 57193  	}
 57194  	rc = SQLITE_NOMEM
 57195  	goto out
 57196  __1:
 57197  	;
 57198  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0))
 57199  	sqlite3.Xsqlite3_free(tls, zSql)
 57200  
 57201  	if !(rc == SQLITE_OK) {
 57202  		goto __2
 57203  	}
 57204  	nCol = sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 57205  
 57206  	// Figure out how much space to allocate for the array of column names
 57207  	// (including space for the strings themselves). Then allocate it.
 57208  	nBytes = (int32(uint64(unsafe.Sizeof(uintptr(0))) * uint64(nCol)))
 57209  	ii = 0
 57210  __3:
 57211  	if !(ii < nCol) {
 57212  		goto __5
 57213  	}
 57214  	zName = sqlite3.Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), ii)
 57215  	if !(!(zName != 0)) {
 57216  		goto __6
 57217  	}
 57218  	rc = SQLITE_NOMEM
 57219  	goto out
 57220  __6:
 57221  	;
 57222  	nBytes = nBytes + (int32(libc.Xstrlen(tls, zName)) + 1)
 57223  	goto __4
 57224  __4:
 57225  	ii++
 57226  	goto __3
 57227  	goto __5
 57228  __5:
 57229  	;
 57230  	aCol = sqlite3.Xsqlite3MallocZero(tls, uint64(nBytes))
 57231  	if !(!(aCol != 0)) {
 57232  		goto __7
 57233  	}
 57234  	rc = SQLITE_NOMEM
 57235  	goto out
 57236  __7:
 57237  	;
 57238  
 57239  	// Copy the column names into the allocated space and set up the
 57240  	// pointers in the aCol[] array.
 57241  	zSpace = (aCol + uintptr(nCol)*8)
 57242  	ii = 0
 57243  __8:
 57244  	if !(ii < nCol) {
 57245  		goto __10
 57246  	}
 57247  	*(*uintptr)(unsafe.Pointer(aCol + uintptr(ii)*8)) = zSpace
 57248  	sqlite3.Xsqlite3_snprintf(tls, nBytes, zSpace, ts /* "%s" */, libc.VaList(bp+8, sqlite3.Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), ii)))
 57249  	zSpace += (uintptr(int32(libc.Xstrlen(tls, zSpace)) + 1))
 57250  	goto __9
 57251  __9:
 57252  	ii++
 57253  	goto __8
 57254  	goto __10
 57255  __10:
 57256  	;
 57257  
 57258  __2:
 57259  	;
 57260  
 57261  	*(*uintptr)(unsafe.Pointer(paCol)) = aCol
 57262  	*(*int32)(unsafe.Pointer(pnCol)) = nCol
 57263  
 57264  out:
 57265  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 57266  	return rc
 57267  }
 57268  
 57269  // Parameter zTab is the name of a table in database db with nCol
 57270  // columns. This function allocates an array of integers nCol in
 57271  // size and populates it according to any implicit or explicit
 57272  // indices on table zTab.
 57273  //
 57274  // If successful, SQLITE_OK is returned and *paIndex set to point
 57275  // at the allocated array. Otherwise, an error code is returned.
 57276  //
 57277  // See comments associated with the member variable aIndex above
 57278  // "struct echo_vtab" for details of the contents of the array.
 57279  func getIndexArray(tls *libc.TLS, db uintptr, zTab uintptr, nCol int32, paIndex uintptr) int32 { /* test8.c:239:12: */
 57280  	bp := tls.Alloc(32)
 57281  	defer tls.Free(32)
 57282  
 57283  	// var pStmt uintptr at bp+16, 8
 57284  
 57285  	var aIndex uintptr
 57286  	var rc int32
 57287  	var zSql uintptr
 57288  	var cid int32
 57289  	var zIdx uintptr
 57290  	// var pStmt2 uintptr at bp+24, 8
 57291  
 57292  	var rc2 int32
 57293  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0)
 57294  	aIndex = uintptr(0)
 57295  
 57296  	// Allocate space for the index array
 57297  	aIndex = sqlite3.Xsqlite3MallocZero(tls, (uint64(uint64(unsafe.Sizeof(int32(0))) * uint64(nCol))))
 57298  	if !(!(aIndex != 0)) {
 57299  		goto __1
 57300  	}
 57301  	rc = SQLITE_NOMEM
 57302  	goto get_index_array_out
 57303  __1:
 57304  	;
 57305  
 57306  	// Compile an sqlite pragma to loop through all indices on table zTab
 57307  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27500 /* "PRAGMA index_lis..." */, libc.VaList(bp, zTab))
 57308  	if !(!(zSql != 0)) {
 57309  		goto __2
 57310  	}
 57311  	rc = SQLITE_NOMEM
 57312  	goto get_index_array_out
 57313  __2:
 57314  	;
 57315  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0))
 57316  	sqlite3.Xsqlite3_free(tls, zSql)
 57317  
 57318  	// For each index, figure out the left-most column and set the
 57319  	// corresponding entry in aIndex[] to 1.
 57320  __3:
 57321  	if !((*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) != 0) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW)) {
 57322  		goto __4
 57323  	}
 57324  	zIdx = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1)
 57325  	*(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */)) = uintptr(0)
 57326  	if !(zIdx == uintptr(0)) {
 57327  		goto __5
 57328  	}
 57329  	goto __3
 57330  __5:
 57331  	;
 57332  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27522 /* "PRAGMA index_inf..." */, libc.VaList(bp+8, zIdx))
 57333  	if !(!(zSql != 0)) {
 57334  		goto __6
 57335  	}
 57336  	rc = SQLITE_NOMEM
 57337  	goto get_index_array_out
 57338  __6:
 57339  	;
 57340  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+24 /* &pStmt2 */, uintptr(0))
 57341  	sqlite3.Xsqlite3_free(tls, zSql)
 57342  	if !((*(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */)) != 0) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */))) == SQLITE_ROW)) {
 57343  		goto __7
 57344  	}
 57345  	cid = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */)), 1)
 57346  
 57347  	*(*int32)(unsafe.Pointer(aIndex + uintptr(cid)*4)) = 1
 57348  __7:
 57349  	;
 57350  	if !(*(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */)) != 0) {
 57351  		goto __8
 57352  	}
 57353  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pStmt2 */)))
 57354  __8:
 57355  	;
 57356  	if !(rc != SQLITE_OK) {
 57357  		goto __9
 57358  	}
 57359  	goto get_index_array_out
 57360  __9:
 57361  	;
 57362  	goto __3
 57363  __4:
 57364  	;
 57365  
 57366  get_index_array_out:
 57367  	if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) != 0) {
 57368  		goto __10
 57369  	}
 57370  	rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 57371  	if !(rc == SQLITE_OK) {
 57372  		goto __11
 57373  	}
 57374  	rc = rc2
 57375  __11:
 57376  	;
 57377  __10:
 57378  	;
 57379  	if !(rc != SQLITE_OK) {
 57380  		goto __12
 57381  	}
 57382  	sqlite3.Xsqlite3_free(tls, aIndex)
 57383  	aIndex = uintptr(0)
 57384  __12:
 57385  	;
 57386  	*(*uintptr)(unsafe.Pointer(paIndex)) = aIndex
 57387  	return rc
 57388  }
 57389  
 57390  // Global Tcl variable $echo_module is a list. This routine appends
 57391  // the string element zArg to that list in interpreter interp.
 57392  func appendToEchoModule(tls *libc.TLS, interp uintptr, zArg uintptr) { /* test8.c:313:13: */
 57393  	var flags int32 = ((TCL_APPEND_VALUE | TCL_LIST_ELEMENT) | TCL_GLOBAL_ONLY)
 57394  	tcl.XTcl_SetVar2(tls, interp, ts+27544 /* "echo_module" */, uintptr(0), func() uintptr {
 57395  		if zArg != 0 {
 57396  			return zArg
 57397  		}
 57398  		return ts + 489 /* "" */
 57399  	}(), flags)
 57400  }
 57401  
 57402  // This function is called from within the echo-modules xCreate and
 57403  // xConnect methods. The argc and argv arguments are copies of those
 57404  // passed to the calling method. This function is responsible for
 57405  // calling sqlite3_declare_vtab() to declare the schema of the virtual
 57406  // table being created or connected.
 57407  //
 57408  // If the constructor was passed just one argument, i.e.:
 57409  //
 57410  //   CREATE TABLE t1 AS echo(t2);
 57411  //
 57412  // Then t2 is assumed to be the name of a *real* database table. The
 57413  // schema of the virtual table is declared by passing a copy of the
 57414  // CREATE TABLE statement for the real table to sqlite3_declare_vtab().
 57415  // Hence, the virtual table should have exactly the same column names and
 57416  // types as the real table.
 57417  func echoDeclareVtab(tls *libc.TLS, pVtab uintptr, db uintptr) int32 { /* test8.c:335:12: */
 57418  	bp := tls.Alloc(8)
 57419  	defer tls.Free(8)
 57420  
 57421  	var rc int32 = SQLITE_OK
 57422  
 57423  	if (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName != 0 {
 57424  		*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
 57425  		rc = sqlite3.Xsqlite3_prepare(tls, db,
 57426  			ts+27556, /* "SELECT sql FROM ..." */
 57427  			-1, bp /* &pStmt */, uintptr(0))
 57428  		if rc == SQLITE_OK {
 57429  			sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 1, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, -1, uintptr(0))
 57430  			if sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) == SQLITE_ROW {
 57431  				var rc2 int32
 57432  				var zCreateTable uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0)
 57433  				rc = sqlite3.Xsqlite3_declare_vtab(tls, db, zCreateTable)
 57434  				rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 57435  				if rc == SQLITE_OK {
 57436  					rc = rc2
 57437  				}
 57438  			} else {
 57439  				rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 57440  				if rc == SQLITE_OK {
 57441  					rc = SQLITE_ERROR
 57442  				}
 57443  			}
 57444  			if rc == SQLITE_OK {
 57445  				rc = getColumnNames(tls, db, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, (pVtab + 88 /* &.aCol */), (pVtab + 72 /* &.nCol */))
 57446  			}
 57447  			if rc == SQLITE_OK {
 57448  				rc = getIndexArray(tls, db, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, (*echo_vtab)(unsafe.Pointer(pVtab)).FnCol, (pVtab + 80 /* &.aIndex */))
 57449  			}
 57450  		}
 57451  	}
 57452  
 57453  	return rc
 57454  }
 57455  
 57456  // This function frees all runtime structures associated with the virtual
 57457  // table pVtab.
 57458  func echoDestructor(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:378:12: */
 57459  	var p uintptr = pVtab
 57460  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FaIndex)
 57461  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FaCol)
 57462  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzThis)
 57463  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzTableName)
 57464  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzLogName)
 57465  	sqlite3.Xsqlite3_free(tls, p)
 57466  	return 0
 57467  }
 57468  
 57469  type EchoModule1 = struct {
 57470  	Finterp uintptr
 57471  	Fdb     uintptr
 57472  } /* test8.c:389:9 */
 57473  
 57474  type EchoModule = EchoModule1 /* test8.c:389:27 */
 57475  
 57476  // This function is called to do the work of the xConnect() method -
 57477  // to allocate the required in-memory structures for a newly connected
 57478  // virtual table.
 57479  func echoConstructor(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:400:12: */
 57480  	bp := tls.Alloc(32)
 57481  	defer tls.Free(32)
 57482  
 57483  	var rc int32
 57484  	var i int32
 57485  	var pVtab uintptr
 57486  
 57487  	// Allocate the sqlite3_vtab/echo_vtab structure itself
 57488  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(echo_vtab{})))
 57489  	if !(pVtab != 0) {
 57490  		return SQLITE_NOMEM
 57491  	}
 57492  	(*echo_vtab)(unsafe.Pointer(pVtab)).Finterp = (*EchoModule)(unsafe.Pointer(pAux)).Finterp
 57493  	(*echo_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 57494  
 57495  	// Allocate echo_vtab.zThis
 57496  	(*echo_vtab)(unsafe.Pointer(pVtab)).FzThis = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 2*8))))
 57497  	if !(int32((*echo_vtab)(unsafe.Pointer(pVtab)).FzThis) != 0) {
 57498  		echoDestructor(tls, pVtab)
 57499  		return SQLITE_NOMEM
 57500  	}
 57501  
 57502  	// Allocate echo_vtab.zTableName
 57503  	if argc > 3 {
 57504  		(*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + 3*8))))
 57505  		dequoteString(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)
 57506  		if ((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName != 0) && (int32(*(*int8)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))) == '*') {
 57507  			var z uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+27620 /* "%s%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 2*8)), ((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName+1)))
 57508  			sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)
 57509  			(*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName = z
 57510  			(*echo_vtab)(unsafe.Pointer(pVtab)).FisPattern = 1
 57511  		}
 57512  		if !(int32((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName) != 0) {
 57513  			echoDestructor(tls, pVtab)
 57514  			return SQLITE_NOMEM
 57515  		}
 57516  	}
 57517  
 57518  	// Log the arguments to this function to Tcl var ::echo_module
 57519  	for i = 0; i < argc; i++ {
 57520  		appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 57521  	}
 57522  
 57523  	// Invoke sqlite3_declare_vtab and set up other members of the echo_vtab
 57524  	// structure. If an error occurs, delete the sqlite3_vtab structure and
 57525  	// return an error code.
 57526  	rc = echoDeclareVtab(tls, pVtab, db)
 57527  	if rc != SQLITE_OK {
 57528  		echoDestructor(tls, pVtab)
 57529  		return rc
 57530  	}
 57531  
 57532  	// Success. Set *ppVtab and return
 57533  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 57534  	return SQLITE_OK
 57535  }
 57536  
 57537  // Echo virtual table module xCreate method.
 57538  func echoCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:465:12: */
 57539  	bp := tls.Alloc(24)
 57540  	defer tls.Free(24)
 57541  
 57542  	var rc int32 = SQLITE_OK
 57543  	appendToEchoModule(tls, (*EchoModule)(unsafe.Pointer(pAux)).Finterp, ts+27625 /* "xCreate" */)
 57544  	rc = echoConstructor(tls, db, pAux, argc, argv, ppVtab, pzErr)
 57545  
 57546  	// If there were two arguments passed to the module at the SQL level
 57547  	// (i.e. "CREATE VIRTUAL TABLE tbl USING echo(arg1, arg2)"), then
 57548  	// the second argument is used as a table name. Attempt to create
 57549  	// such a table with a single column, "logmsg". This table will
 57550  	// be used to log calls to the xUpdate method. It will be deleted
 57551  	// when the virtual table is DROPed.
 57552  	//
 57553  	// Note: The main point of this is to test that we can drop tables
 57554  	// from within an xDestroy method call.
 57555  	if (rc == SQLITE_OK) && (argc == 5) {
 57556  		var zSql uintptr
 57557  		var pVtab uintptr = *(*uintptr)(unsafe.Pointer(ppVtab))
 57558  		(*echo_vtab)(unsafe.Pointer(pVtab)).FzLogName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 4*8))))
 57559  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27633 /* "CREATE TABLE %Q(..." */, libc.VaList(bp+8, (*echo_vtab)(unsafe.Pointer(pVtab)).FzLogName))
 57560  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 57561  		sqlite3.Xsqlite3_free(tls, zSql)
 57562  		if rc != SQLITE_OK {
 57563  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, sqlite3.Xsqlite3_errmsg(tls, db)))
 57564  		}
 57565  	}
 57566  
 57567  	if (*(*uintptr)(unsafe.Pointer(ppVtab)) != 0) && (rc != SQLITE_OK) {
 57568  		echoDestructor(tls, *(*uintptr)(unsafe.Pointer(ppVtab)))
 57569  		*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 57570  	}
 57571  
 57572  	if rc == SQLITE_OK {
 57573  		(*echo_vtab)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppVtab)))).FinTransaction = 1
 57574  	}
 57575  
 57576  	return rc
 57577  }
 57578  
 57579  // Echo virtual table module xConnect method.
 57580  func echoConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:513:12: */
 57581  	appendToEchoModule(tls, (*EchoModule)(unsafe.Pointer(pAux)).Finterp, ts+27657 /* "xConnect" */)
 57582  	return echoConstructor(tls, db, pAux, argc, argv, ppVtab, pzErr)
 57583  }
 57584  
 57585  // Echo virtual table module xDisconnect method.
 57586  func echoDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:527:12: */
 57587  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27666 /* "xDisconnect" */)
 57588  	return echoDestructor(tls, pVtab)
 57589  }
 57590  
 57591  // Echo virtual table module xDestroy method.
 57592  func echoDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:535:12: */
 57593  	bp := tls.Alloc(8)
 57594  	defer tls.Free(8)
 57595  
 57596  	var rc int32 = SQLITE_OK
 57597  	var p uintptr = pVtab
 57598  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27678 /* "xDestroy" */)
 57599  
 57600  	// Drop the "log" table, if one exists (see echoCreate() for details)
 57601  	if (p != 0) && ((*echo_vtab)(unsafe.Pointer(p)).FzLogName != 0) {
 57602  		var zSql uintptr
 57603  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27687 /* "DROP TABLE %Q" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(p)).FzLogName))
 57604  		rc = sqlite3.Xsqlite3_exec(tls, (*echo_vtab)(unsafe.Pointer(p)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
 57605  		sqlite3.Xsqlite3_free(tls, zSql)
 57606  	}
 57607  
 57608  	if rc == SQLITE_OK {
 57609  		rc = echoDestructor(tls, pVtab)
 57610  	}
 57611  	return rc
 57612  }
 57613  
 57614  // Echo virtual table module xOpen method.
 57615  func echoOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test8.c:557:12: */
 57616  	var pCur uintptr
 57617  	if simulateVtabError(tls, pVTab, ts+27701 /* "xOpen" */) != 0 {
 57618  		return SQLITE_ERROR
 57619  	}
 57620  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(echo_cursor{})))
 57621  	*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 57622  	return func() int32 {
 57623  		if pCur != 0 {
 57624  			return SQLITE_OK
 57625  		}
 57626  		return SQLITE_NOMEM
 57627  	}()
 57628  }
 57629  
 57630  // Echo virtual table module xClose method.
 57631  func echoClose(tls *libc.TLS, cur uintptr) int32 { /* test8.c:570:12: */
 57632  	var rc int32
 57633  	var pCur uintptr = cur
 57634  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt
 57635  	(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 57636  	sqlite3.Xsqlite3_free(tls, pCur)
 57637  	rc = sqlite3.Xsqlite3_finalize(tls, pStmt)
 57638  	return rc
 57639  }
 57640  
 57641  // Return non-zero if the cursor does not currently point to a valid record
 57642  // (i.e if the scan has finished), or zero otherwise.
 57643  func echoEof(tls *libc.TLS, cur uintptr) int32 { /* test8.c:584:12: */
 57644  	return func() int32 {
 57645  		if (*echo_cursor)(unsafe.Pointer(cur)).FpStmt != 0 {
 57646  			return 0
 57647  		}
 57648  		return 1
 57649  	}()
 57650  }
 57651  
 57652  // Echo virtual table module xNext method.
 57653  func echoNext(tls *libc.TLS, cur uintptr) int32 { /* test8.c:591:12: */
 57654  	var rc int32 = SQLITE_OK
 57655  	var pCur uintptr = cur
 57656  
 57657  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+27707 /* "xNext" */) != 0 {
 57658  		return SQLITE_ERROR
 57659  	}
 57660  
 57661  	if (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt != 0 {
 57662  		rc = sqlite3.Xsqlite3_step(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 57663  		if rc == SQLITE_ROW {
 57664  			rc = SQLITE_OK
 57665  		} else {
 57666  			rc = sqlite3.Xsqlite3_finalize(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 57667  			(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 57668  		}
 57669  	}
 57670  
 57671  	return rc
 57672  }
 57673  
 57674  // Echo virtual table module xColumn method.
 57675  func echoColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test8.c:615:12: */
 57676  	var iCol int32 = (i + 1)
 57677  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(cur)).FpStmt
 57678  
 57679  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+27713 /* "xColumn" */) != 0 {
 57680  		return SQLITE_ERROR
 57681  	}
 57682  
 57683  	if !(pStmt != 0) {
 57684  		sqlite3.Xsqlite3_result_null(tls, ctx)
 57685  	} else {
 57686  
 57687  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, pStmt, iCol))
 57688  	}
 57689  	return SQLITE_OK
 57690  }
 57691  
 57692  // Echo virtual table module xRowid method.
 57693  func echoRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test8.c:635:12: */
 57694  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(cur)).FpStmt
 57695  
 57696  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+2165 /* "xRowid" */) != 0 {
 57697  		return SQLITE_ERROR
 57698  	}
 57699  
 57700  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 57701  	return SQLITE_OK
 57702  }
 57703  
 57704  // Compute a simple hash of the null terminated string zString.
 57705  //
 57706  // This module uses only sqlite3_index_info.idxStr, not
 57707  // sqlite3_index_info.idxNum. So to test idxNum, when idxStr is set
 57708  // in echoBestIndex(), idxNum is set to the corresponding hash value.
 57709  // In echoFilter(), code assert()s that the supplied idxNum value is
 57710  // indeed the hash of the supplied idxStr.
 57711  func hashString(tls *libc.TLS, zString uintptr) int32 { /* test8.c:655:12: */
 57712  	var val u32 = u32(0)
 57713  	var ii int32
 57714  	for ii = 0; *(*int8)(unsafe.Pointer(zString + uintptr(ii))) != 0; ii++ {
 57715  		val = ((val << 3) + u32(int32(*(*int8)(unsafe.Pointer(zString + uintptr(ii))))))
 57716  	}
 57717  	return (int32(val & u32(0x7fffffff)))
 57718  }
 57719  
 57720  // Echo virtual table module xFilter method.
 57721  func echoFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test8.c:667:12: */
 57722  	var rc int32
 57723  	var i int32
 57724  
 57725  	var pCur uintptr = pVtabCursor
 57726  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 57727  	var db uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb
 57728  
 57729  	if simulateVtabError(tls, pVtab, ts+27721 /* "xFilter" */) != 0 {
 57730  		return SQLITE_ERROR
 57731  	}
 57732  
 57733  	// Check that idxNum matches idxStr
 57734  
 57735  	// Log arguments to the ::echo_module Tcl variable
 57736  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27721 /* "xFilter" */)
 57737  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, idxStr)
 57738  	for i = 0; i < argc; i++ {
 57739  		appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))))
 57740  	}
 57741  
 57742  	sqlite3.Xsqlite3_finalize(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 57743  	(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 57744  
 57745  	// Prepare the SQL statement created by echoBestIndex and bind the
 57746  	// runtime parameters passed to this function to it.
 57747  	rc = sqlite3.Xsqlite3_prepare(tls, db, idxStr, -1, (pCur + 8 /* &.pStmt */), uintptr(0))
 57748  
 57749  	for i = 0; (rc == SQLITE_OK) && (i < argc); i++ {
 57750  		rc = sqlite3.Xsqlite3_bind_value(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt, (i + 1), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 57751  	}
 57752  
 57753  	// If everything was successful, advance to the first row of the scan
 57754  	if rc == SQLITE_OK {
 57755  		rc = echoNext(tls, pVtabCursor)
 57756  	}
 57757  
 57758  	return rc
 57759  }
 57760  
 57761  // A helper function used by echoUpdate() and echoBestIndex() for
 57762  // manipulating strings in concert with the sqlite3_mprintf() function.
 57763  //
 57764  // Parameter pzStr points to a pointer to a string allocated with
 57765  // sqlite3_mprintf. The second parameter, zAppend, points to another
 57766  // string. The two strings are concatenated together and *pzStr
 57767  // set to point at the result. The initial buffer pointed to by *pzStr
 57768  // is deallocated via sqlite3_free().
 57769  //
 57770  // If the third argument, doFree, is true, then sqlite3_free() is
 57771  // also called to free the buffer pointed to by zAppend.
 57772  func string_concat(tls *libc.TLS, pzStr uintptr, zAppend uintptr, doFree int32, pRc uintptr) { /* test8.c:727:13: */
 57773  	bp := tls.Alloc(24)
 57774  	defer tls.Free(24)
 57775  
 57776  	var zIn uintptr = *(*uintptr)(unsafe.Pointer(pzStr))
 57777  	if (!(zAppend != 0) && (doFree != 0)) && (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) {
 57778  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 57779  	}
 57780  	if *(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK {
 57781  		sqlite3.Xsqlite3_free(tls, zIn)
 57782  		zIn = uintptr(0)
 57783  	} else {
 57784  		if zIn != 0 {
 57785  			var zTemp uintptr = zIn
 57786  			zIn = sqlite3.Xsqlite3_mprintf(tls, ts+27620 /* "%s%s" */, libc.VaList(bp, zIn, zAppend))
 57787  			sqlite3.Xsqlite3_free(tls, zTemp)
 57788  		} else {
 57789  			zIn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zAppend))
 57790  		}
 57791  		if !(zIn != 0) {
 57792  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 57793  		}
 57794  	}
 57795  	*(*uintptr)(unsafe.Pointer(pzStr)) = zIn
 57796  	if doFree != 0 {
 57797  		sqlite3.Xsqlite3_free(tls, zAppend)
 57798  	}
 57799  }
 57800  
 57801  // This function returns a pointer to an sqlite3_malloc()ed buffer
 57802  // containing the select-list (the thing between keywords SELECT and FROM)
 57803  // to query the underlying real table with for the scan described by
 57804  // argument pIdxInfo.
 57805  //
 57806  // If the current SQLite version is earlier than 3.10.0, this is just "*"
 57807  // (select all columns). Or, for version 3.10.0 and greater, the list of
 57808  // columns identified by the pIdxInfo->colUsed mask.
 57809  func echoSelectList(tls *libc.TLS, pTab uintptr, pIdxInfo uintptr) uintptr { /* test8.c:763:13: */
 57810  	bp := tls.Alloc(24)
 57811  	defer tls.Free(24)
 57812  
 57813  	var zRet uintptr = uintptr(0)
 57814  	if sqlite3.Xsqlite3_libversion_number(tls) < 3010000 {
 57815  		zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27729 /* ", *" */, 0)
 57816  	} else {
 57817  		var i int32
 57818  		for i = 0; i < (*echo_vtab)(unsafe.Pointer(pTab)).FnCol; i++ {
 57819  			if ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed & (sqlite3_uint64(uint64(1)) << (func() int32 {
 57820  				if i >= 63 {
 57821  					return 63
 57822  				}
 57823  				return i
 57824  			}()))) != 0 {
 57825  				zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27733 /* "%z, %s" */, libc.VaList(bp, zRet, *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*8))))
 57826  			} else {
 57827  				zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27740 /* "%z, NULL" */, libc.VaList(bp+16, zRet))
 57828  			}
 57829  			if !(zRet != 0) {
 57830  				break
 57831  			}
 57832  		}
 57833  	}
 57834  	return zRet
 57835  }
 57836  
 57837  // The echo module implements the subset of query constraints and sort
 57838  // orders that may take advantage of SQLite indices on the underlying
 57839  // real table. For example, if the real table is declared as:
 57840  //
 57841  //     CREATE TABLE real(a, b, c);
 57842  //     CREATE INDEX real_index ON real(b);
 57843  //
 57844  // then the echo module handles WHERE or ORDER BY clauses that refer
 57845  // to the column "b", but not "a" or "c". If a multi-column index is
 57846  // present, only its left most column is considered.
 57847  //
 57848  // This xBestIndex method encodes the proposed search strategy as
 57849  // an SQL query on the real table underlying the virtual echo module
 57850  // table and stores the query in sqlite3_index_info.idxStr. The SQL
 57851  // statement is of the form:
 57852  //
 57853  //   SELECT rowid, * FROM <real-table> ?<where-clause>? ?<order-by-clause>?
 57854  //
 57855  // where the <where-clause> and <order-by-clause> are determined
 57856  // by the contents of the structure pointed to by the pIdxInfo argument.
 57857  func echoBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test8.c:803:12: */
 57858  	bp := tls.Alloc(100)
 57859  	defer tls.Free(100)
 57860  
 57861  	var ii int32
 57862  	*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) = uintptr(0)
 57863  	var zCol uintptr = uintptr(0)
 57864  	var zNew uintptr
 57865  	var nArg int32 = 0
 57866  	var zSep uintptr = ts + 8838 /* "WHERE" */
 57867  	var pVtab uintptr = tab
 57868  	*(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)) = uintptr(0)
 57869  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 57870  
 57871  	var nRow int32 = 0
 57872  	var useIdx int32 = 0
 57873  	*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_OK
 57874  	var useCost int32 = 0
 57875  	var cost float64 = float64(0)
 57876  	var isIgnoreUsable int32 = 0
 57877  	if tcl.XTcl_GetVar2(tls, interp, ts+27749 /* "echo_module_igno..." */, uintptr(0), TCL_GLOBAL_ONLY) != 0 {
 57878  		isIgnoreUsable = 1
 57879  	}
 57880  
 57881  	if simulateVtabError(tls, pVtab, ts+27775 /* "xBestIndex" */) != 0 {
 57882  		return SQLITE_ERROR
 57883  	}
 57884  
 57885  	// Determine the number of rows in the table and store this value in local
 57886  	// variable nRow. The 'estimated-cost' of the scan will be the number of
 57887  	// rows in the table for a linear scan, or the log (base 2) of the
 57888  	// number of rows if the proposed scan uses an index.
 57889  	if tcl.XTcl_GetVar2(tls, interp, ts+27786 /* "echo_module_cost" */, uintptr(0), TCL_GLOBAL_ONLY) != 0 {
 57890  		cost = libc.Xatof(tls, tcl.XTcl_GetVar2(tls, interp, ts+27786 /* "echo_module_cost" */, uintptr(0), TCL_GLOBAL_ONLY))
 57891  		useCost = 1
 57892  	} else {
 57893  		*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27803 /* "SELECT count(*) ..." */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 57894  		if !(*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) != 0) {
 57895  			return SQLITE_NOMEM
 57896  		}
 57897  		*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = sqlite3.Xsqlite3_prepare(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb, *(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)), -1, bp+80 /* &pStmt */, uintptr(0))
 57898  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)))
 57899  		if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) != SQLITE_OK {
 57900  			return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 57901  		}
 57902  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 57903  		nRow = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 0)
 57904  		*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 57905  		if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) != SQLITE_OK {
 57906  			return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 57907  		}
 57908  	}
 57909  
 57910  	zCol = echoSelectList(tls, pVtab, pIdxInfo)
 57911  	if !(zCol != 0) {
 57912  		return SQLITE_NOMEM
 57913  	}
 57914  	*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27827 /* "SELECT rowid%z F..." */, libc.VaList(bp+8, zCol, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 57915  	if !(*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) != 0) {
 57916  		return SQLITE_NOMEM
 57917  	}
 57918  
 57919  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 57920  		var pConstraint uintptr
 57921  		var pUsage uintptr
 57922  		var iCol int32
 57923  
 57924  		pConstraint = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 57925  		pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 57926  
 57927  		if !(isIgnoreUsable != 0) && !(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) != 0) {
 57928  			continue
 57929  		}
 57930  
 57931  		iCol = (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn
 57932  		if (iCol < 0) || (*(*int32)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaIndex + uintptr(iCol)*4)) != 0) {
 57933  			var zNewCol uintptr
 57934  			if iCol >= 0 {
 57935  				zNewCol = *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr(iCol)*8))
 57936  			} else {
 57937  				zNewCol = ts + 27850 /* "rowid" */
 57938  			}
 57939  			var zOp uintptr = uintptr(0)
 57940  			useIdx = 1
 57941  			switch int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) {
 57942  			case SQLITE_INDEX_CONSTRAINT_EQ:
 57943  				zOp = ts + 27856 /* "=" */
 57944  				break
 57945  				fallthrough
 57946  			case SQLITE_INDEX_CONSTRAINT_LT:
 57947  				zOp = ts + 27858 /* "<" */
 57948  				break
 57949  				fallthrough
 57950  			case SQLITE_INDEX_CONSTRAINT_GT:
 57951  				zOp = ts + 27860 /* ">" */
 57952  				break
 57953  				fallthrough
 57954  			case SQLITE_INDEX_CONSTRAINT_LE:
 57955  				zOp = ts + 27862 /* "<=" */
 57956  				break
 57957  				fallthrough
 57958  			case SQLITE_INDEX_CONSTRAINT_GE:
 57959  				zOp = ts + 27865 /* ">=" */
 57960  				break
 57961  				fallthrough
 57962  			case SQLITE_INDEX_CONSTRAINT_MATCH:
 57963  				// Purposely translate the MATCH operator into a LIKE, which
 57964  				// will be used by the next block of code to construct a new
 57965  				// query.  It should also be noted here that the next block
 57966  				// of code requires the first letter of this operator to be
 57967  				// in upper-case to trigger the special MATCH handling (i.e.
 57968  				// wrapping the bound parameter with literal '%'s).
 57969  				zOp = ts + 27868 /* "LIKE" */
 57970  				break
 57971  				fallthrough
 57972  			case SQLITE_INDEX_CONSTRAINT_LIKE:
 57973  				zOp = ts + 27873 /* "like" */
 57974  				break
 57975  				fallthrough
 57976  			case SQLITE_INDEX_CONSTRAINT_GLOB:
 57977  				zOp = ts + 27878 /* "glob" */
 57978  				break
 57979  				fallthrough
 57980  			case SQLITE_INDEX_CONSTRAINT_REGEXP:
 57981  				zOp = ts + 6335 /* "regexp" */
 57982  				break
 57983  			}
 57984  			if zOp != 0 {
 57985  				if int32(*(*int8)(unsafe.Pointer(zOp))) == 'L' {
 57986  					zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27883, /* " %s %s LIKE (SEL..." */
 57987  						libc.VaList(bp+24, zSep, zNewCol))
 57988  				} else {
 57989  					zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27918 /* " %s %s %s ?" */, libc.VaList(bp+40, zSep, zNewCol, zOp))
 57990  				}
 57991  				string_concat(tls, bp+88 /* &zQuery */, zNew, 1, bp+96 /* &rc */)
 57992  				zSep = ts + 8865 /* "AND" */
 57993  				(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&nArg, 1)
 57994  				(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 57995  			}
 57996  		}
 57997  	}
 57998  
 57999  	// If there is only one term in the ORDER BY clause, and it is
 58000  	// on a column that this virtual table has an index for, then consume
 58001  	// the ORDER BY clause.
 58002  	if ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) && (((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn < 0) || (*(*int32)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaIndex + uintptr((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn)*4)) != 0)) {
 58003  		var iCol int32 = (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn
 58004  		var zNewCol uintptr
 58005  		if iCol >= 0 {
 58006  			zNewCol = *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr(iCol)*8))
 58007  		} else {
 58008  			zNewCol = ts + 27850 /* "rowid" */
 58009  		}
 58010  		var zDir uintptr
 58011  		if (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc != 0 {
 58012  			zDir = ts + 27930 /* "DESC" */
 58013  		} else {
 58014  			zDir = ts + 27935 /* "ASC" */
 58015  		}
 58016  		zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27939 /* " ORDER BY %s %s" */, libc.VaList(bp+64, zNewCol, zDir))
 58017  		string_concat(tls, bp+88 /* &zQuery */, zNew, 1, bp+96 /* &rc */)
 58018  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 58019  	}
 58020  
 58021  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27775 /* "xBestIndex" */)
 58022  
 58023  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, *(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)))
 58024  
 58025  	if !(*(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)) != 0) {
 58026  		return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 58027  	}
 58028  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = hashString(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */)))
 58029  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = *(*uintptr)(unsafe.Pointer(bp + 88 /* zQuery */))
 58030  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 58031  	if useCost != 0 {
 58032  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = cost
 58033  	} else if useIdx != 0 {
 58034  		// Approximation of log2(nRow).
 58035  		for ii = 0; uint64(ii) < ((uint64(unsafe.Sizeof(int32(0))) * uint64(8)) - uint64(1)); ii++ {
 58036  			if (nRow & (int32(1) << ii)) != 0 {
 58037  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(ii)
 58038  			}
 58039  		}
 58040  	} else {
 58041  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(nRow)
 58042  	}
 58043  	return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 58044  }
 58045  
 58046  // The xUpdate method for echo module virtual tables.
 58047  //
 58048  //    apData[0]  apData[1]  apData[2..]
 58049  //
 58050  //    INTEGER                              DELETE
 58051  //
 58052  //    INTEGER    NULL       (nCol args)    UPDATE (do not set rowid)
 58053  //    INTEGER    INTEGER    (nCol args)    UPDATE (with SET rowid = <arg1>)
 58054  //
 58055  //    NULL       NULL       (nCol args)    INSERT INTO (automatic rowid value)
 58056  //    NULL       INTEGER    (nCol args)    INSERT (incl. rowid value)
 58057  //
 58058  func echoUpdate(tls *libc.TLS, tab uintptr, nData int32, apData uintptr, pRowid uintptr) int32 { /* test8.c:969:5: */
 58059  	bp := tls.Alloc(136)
 58060  	defer tls.Free(136)
 58061  
 58062  	var pVtab uintptr = tab
 58063  	var db uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb
 58064  	*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_OK
 58065  
 58066  	*(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)) = uintptr(0)
 58067  	*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) = uintptr(0) // SQL statement to execute
 58068  	var bindArgZero int32 = 0                                 // True to bind apData[0] to sql var no. nData
 58069  	var bindArgOne int32 = 0                                  // True to bind apData[1] to sql var no. 1
 58070  	var i int32                                               // Counter variable used by for loops
 58071  
 58072  	// Ticket #3083 - make sure we always start a transaction prior to
 58073  	// making any changes to a virtual table
 58074  
 58075  	if simulateVtabError(tls, pVtab, ts+27955 /* "xUpdate" */) != 0 {
 58076  		return SQLITE_ERROR
 58077  	}
 58078  
 58079  	// If apData[0] is an integer and nData>1 then do an UPDATE
 58080  	if (nData > 1) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_INTEGER) {
 58081  		var zSep uintptr = ts + 27963 /* " SET" */
 58082  		*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27968 /* "UPDATE %Q" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 58083  		if !(*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) != 0) {
 58084  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM
 58085  		}
 58086  
 58087  		bindArgOne = (libc.Bool32((*(*uintptr)(unsafe.Pointer(apData + 1*8)) != 0) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData + 1*8))) == SQLITE_INTEGER)))
 58088  		bindArgZero = 1
 58089  
 58090  		if bindArgOne != 0 {
 58091  			string_concat(tls, bp+96 /* &z */, ts+27978 /* " SET rowid=?1 " */, 0, bp+104 /* &rc */)
 58092  			zSep = ts + 4619 /* "," */
 58093  		}
 58094  		for i = 2; i < nData; i++ {
 58095  			if *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*8)) == uintptr(0) {
 58096  				continue
 58097  			}
 58098  			string_concat(tls, bp+96 /* &z */, sqlite3.Xsqlite3_mprintf(tls,
 58099  				ts+27993 /* "%s %Q=?%d" */, libc.VaList(bp+8, zSep, *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr((i-2))*8)), i)), 1, bp+104 /* &rc */)
 58100  			zSep = ts + 4619 /* "," */
 58101  		}
 58102  		string_concat(tls, bp+96 /* &z */, sqlite3.Xsqlite3_mprintf(tls, ts+28003 /* " WHERE rowid=?%d" */, libc.VaList(bp+32, nData)), 1, bp+104 /* &rc */)
 58103  	} else if (nData == 1) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_INTEGER) {
 58104  		*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) = sqlite3.Xsqlite3_mprintf(tls, ts+28020 /* "DELETE FROM %Q W..." */, libc.VaList(bp+40, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 58105  		if !(*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) != 0) {
 58106  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM
 58107  		}
 58108  		bindArgZero = 1
 58109  	} else if (nData > 2) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_NULL) {
 58110  		var ii int32
 58111  		*(*uintptr)(unsafe.Pointer(bp + 112 /* zInsert */)) = uintptr(0)
 58112  		*(*uintptr)(unsafe.Pointer(bp + 120 /* zValues */)) = uintptr(0)
 58113  
 58114  		*(*uintptr)(unsafe.Pointer(bp + 112 /* zInsert */)) = sqlite3.Xsqlite3_mprintf(tls, ts+28052 /* "INSERT INTO %Q (" */, libc.VaList(bp+48, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 58115  		if !(*(*uintptr)(unsafe.Pointer(bp + 112 /* zInsert */)) != 0) {
 58116  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM
 58117  		}
 58118  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData + 1*8))) == SQLITE_INTEGER {
 58119  			bindArgOne = 1
 58120  			*(*uintptr)(unsafe.Pointer(bp + 120 /* zValues */)) = sqlite3.Xsqlite3_mprintf(tls, ts+3266 /* "?" */, 0)
 58121  			string_concat(tls, bp+112 /* &zInsert */, ts+27850 /* "rowid" */, 0, bp+104 /* &rc */)
 58122  		}
 58123  
 58124  		for ii = 2; ii < nData; ii++ {
 58125  			string_concat(tls, bp+112, /* &zInsert */
 58126  				sqlite3.Xsqlite3_mprintf(tls, ts+28069 /* "%s%Q" */, libc.VaList(bp+56, func() uintptr {
 58127  					if *(*uintptr)(unsafe.Pointer(bp + 120 /* zValues */)) != 0 {
 58128  						return ts + 90 /* ", " */
 58129  					}
 58130  					return ts + 489 /* "" */
 58131  				}(), *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr((ii-2))*8)))), 1, bp+104 /* &rc */)
 58132  			string_concat(tls, bp+120, /* &zValues */
 58133  				sqlite3.Xsqlite3_mprintf(tls, ts+28074 /* "%s?%d" */, libc.VaList(bp+72, func() uintptr {
 58134  					if *(*uintptr)(unsafe.Pointer(bp + 120 /* zValues */)) != 0 {
 58135  						return ts + 90 /* ", " */
 58136  					}
 58137  					return ts + 489 /* "" */
 58138  				}(), ii)), 1, bp+104 /* &rc */)
 58139  		}
 58140  
 58141  		string_concat(tls, bp+96 /* &z */, *(*uintptr)(unsafe.Pointer(bp + 112 /* zInsert */)), 1, bp+104 /* &rc */)
 58142  		string_concat(tls, bp+96 /* &z */, ts+28080 /* ") VALUES(" */, 0, bp+104 /* &rc */)
 58143  		string_concat(tls, bp+96 /* &z */, *(*uintptr)(unsafe.Pointer(bp + 120 /* zValues */)), 1, bp+104 /* &rc */)
 58144  		string_concat(tls, bp+96 /* &z */, ts+490 /* ")" */, 0, bp+104 /* &rc */)
 58145  	} else {
 58146  
 58147  		return SQLITE_ERROR
 58148  	}
 58149  
 58150  	if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK {
 58151  		*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = sqlite3.Xsqlite3_prepare(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96 /* z */)), -1, bp+128 /* &pStmt */, uintptr(0))
 58152  	}
 58153  
 58154  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* z */)))
 58155  	if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK {
 58156  		if bindArgZero != 0 {
 58157  			sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)), nData, *(*uintptr)(unsafe.Pointer(apData)))
 58158  		}
 58159  		if bindArgOne != 0 {
 58160  			sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)), 1, *(*uintptr)(unsafe.Pointer(apData + 1*8)))
 58161  		}
 58162  		for i = 2; (i < nData) && (*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK); i++ {
 58163  			if *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*8)) != 0 {
 58164  				*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)), i, *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*8)))
 58165  			}
 58166  		}
 58167  		if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK {
 58168  			sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)))
 58169  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)))
 58170  		} else {
 58171  			sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 128 /* pStmt */)))
 58172  		}
 58173  	}
 58174  
 58175  	if (pRowid != 0) && (*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) == SQLITE_OK) {
 58176  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_last_insert_rowid(tls, db)
 58177  	}
 58178  	if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != SQLITE_OK {
 58179  		(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+27463 /* "echo-vtab-error:..." */, libc.VaList(bp+88, sqlite3.Xsqlite3_errmsg(tls, db)))
 58180  	}
 58181  
 58182  	return *(*int32)(unsafe.Pointer(bp + 104 /* rc */))
 58183  }
 58184  
 58185  // xBegin, xSync, xCommit and xRollback callbacks for echo module
 58186  // virtual tables. Do nothing other than add the name of the callback
 58187  // to the $::echo_module Tcl variable.
 58188  func echoTransactionCall(tls *libc.TLS, tab uintptr, zCall uintptr) int32 { /* test8.c:1102:12: */
 58189  	bp := tls.Alloc(8)
 58190  	defer tls.Free(8)
 58191  
 58192  	var z uintptr
 58193  	var pVtab uintptr = tab
 58194  	z = sqlite3.Xsqlite3_mprintf(tls, ts+28090 /* "echo(%s)" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 58195  	if z == uintptr(0) {
 58196  		return SQLITE_NOMEM
 58197  	}
 58198  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, zCall)
 58199  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, z)
 58200  	sqlite3.Xsqlite3_free(tls, z)
 58201  	return SQLITE_OK
 58202  }
 58203  
 58204  func echoBegin(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1112:12: */
 58205  	var rc int32
 58206  	var pVtab uintptr = tab
 58207  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 58208  	var zVal uintptr
 58209  
 58210  	// Ticket #3083 - do not start a transaction if we are already in
 58211  	// a transaction
 58212  
 58213  	if simulateVtabError(tls, pVtab, ts+28099 /* "xBegin" */) != 0 {
 58214  		return SQLITE_ERROR
 58215  	}
 58216  
 58217  	rc = echoTransactionCall(tls, tab, ts+28099 /* "xBegin" */)
 58218  
 58219  	if rc == SQLITE_OK {
 58220  		// Check if the $::echo_module_begin_fail variable is defined. If it is,
 58221  		// and it is set to the name of the real table underlying this virtual
 58222  		// echo module table, then cause this xSync operation to fail.
 58223  		zVal = tcl.XTcl_GetVar2(tls, interp, ts+28106 /* "echo_module_begi..." */, uintptr(0), TCL_GLOBAL_ONLY)
 58224  		if (zVal != 0) && (0 == libc.Xstrcmp(tls, zVal, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)) {
 58225  			rc = SQLITE_ERROR
 58226  		}
 58227  	}
 58228  	if rc == SQLITE_OK {
 58229  		(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 1
 58230  	}
 58231  	return rc
 58232  }
 58233  
 58234  func echoSync(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1143:12: */
 58235  	var rc int32
 58236  	var pVtab uintptr = tab
 58237  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 58238  	var zVal uintptr
 58239  
 58240  	// Ticket #3083 - Only call xSync if we have previously started a
 58241  	// transaction
 58242  
 58243  	if simulateVtabError(tls, pVtab, ts+28129 /* "xSync" */) != 0 {
 58244  		return SQLITE_ERROR
 58245  	}
 58246  
 58247  	rc = echoTransactionCall(tls, tab, ts+28129 /* "xSync" */)
 58248  
 58249  	if rc == SQLITE_OK {
 58250  		// Check if the $::echo_module_sync_fail variable is defined. If it is,
 58251  		// and it is set to the name of the real table underlying this virtual
 58252  		// echo module table, then cause this xSync operation to fail.
 58253  		zVal = tcl.XTcl_GetVar2(tls, interp, ts+28135 /* "echo_module_sync..." */, uintptr(0), TCL_GLOBAL_ONLY)
 58254  		if (zVal != 0) && (0 == libc.Xstrcmp(tls, zVal, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)) {
 58255  			rc = -1
 58256  		}
 58257  	}
 58258  	return rc
 58259  }
 58260  
 58261  func echoCommit(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1171:12: */
 58262  	var pVtab uintptr = tab
 58263  	var rc int32
 58264  
 58265  	// Ticket #3083 - Only call xCommit if we have previously started
 58266  	// a transaction
 58267  
 58268  	if simulateVtabError(tls, pVtab, ts+28157 /* "xCommit" */) != 0 {
 58269  		return SQLITE_ERROR
 58270  	}
 58271  
 58272  	sqlite3.Xsqlite3BeginBenignMalloc(tls)
 58273  	rc = echoTransactionCall(tls, tab, ts+28157 /* "xCommit" */)
 58274  	sqlite3.Xsqlite3EndBenignMalloc(tls)
 58275  	(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 0
 58276  	return rc
 58277  }
 58278  
 58279  func echoRollback(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1189:12: */
 58280  	var rc int32
 58281  	var pVtab uintptr = tab
 58282  
 58283  	// Ticket #3083 - Only call xRollback if we have previously started
 58284  	// a transaction
 58285  
 58286  	rc = echoTransactionCall(tls, tab, ts+28165 /* "xRollback" */)
 58287  	(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 0
 58288  	return rc
 58289  }
 58290  
 58291  // Implementation of "GLOB" function on the echo module.  Pass
 58292  // all arguments to the ::echo_glob_overload procedure of TCL
 58293  // and return the result of that procedure as a string.
 58294  func overloadedGlobFunction(tls *libc.TLS, pContext uintptr, nArg int32, apArg uintptr) { /* test8.c:1207:13: */
 58295  	bp := tls.Alloc(216)
 58296  	defer tls.Free(216)
 58297  
 58298  	var interp uintptr = sqlite3.Xsqlite3_user_data(tls, pContext)
 58299  	// var str Tcl_DString at bp, 216
 58300  
 58301  	var i int32
 58302  	var rc int32
 58303  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 58304  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, ts+28175 /* "::echo_glob_over..." */)
 58305  	for i = 0; i < nArg; i++ {
 58306  		tcl.XTcl_DStringAppendElement(tls, bp /* &str */, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*8))))
 58307  	}
 58308  	rc = tcl.XTcl_Eval(tls, interp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 58309  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 58310  	if rc != 0 {
 58311  		sqlite3.Xsqlite3_result_error(tls, pContext, tcl.XTcl_GetStringResult(tls, interp), -1)
 58312  	} else {
 58313  		sqlite3.Xsqlite3_result_text(tls, pContext, tcl.XTcl_GetStringResult(tls, interp),
 58314  			-1, libc.UintptrFromInt32(-1))
 58315  	}
 58316  	tcl.XTcl_ResetResult(tls, interp)
 58317  }
 58318  
 58319  // This is the xFindFunction implementation for the echo module.
 58320  // SQLite calls this routine when the first argument of a function
 58321  // is a column of an echo virtual table.  This routine can optionally
 58322  // override the implementation of that function.  It will choose to
 58323  // do so if the function is named "glob", and a TCL command named
 58324  // ::echo_glob_overload exists.
 58325  func echoFindFunction(tls *libc.TLS, vtab uintptr, nArg int32, zFuncName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* test8.c:1240:12: */
 58326  	bp := tls.Alloc(64)
 58327  	defer tls.Free(64)
 58328  
 58329  	var pVtab uintptr = vtab
 58330  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 58331  	// var info Tcl_CmdInfo at bp, 64
 58332  
 58333  	if libc.Xstrcmp(tls, zFuncName, ts+27878 /* "glob" */) != 0 {
 58334  		return 0
 58335  	}
 58336  	if tcl.XTcl_GetCommandInfo(tls, interp, ts+28175 /* "::echo_glob_over..." */, bp /* &info */) == 0 {
 58337  		return 0
 58338  	}
 58339  	*(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct {
 58340  		f func(*libc.TLS, uintptr, int32, uintptr)
 58341  	}{overloadedGlobFunction}))
 58342  	*(*uintptr)(unsafe.Pointer(ppArg)) = interp
 58343  	return 1
 58344  }
 58345  
 58346  func echoRename(tls *libc.TLS, vtab uintptr, zNewName uintptr) int32 { /* test8.c:1261:12: */
 58347  	bp := tls.Alloc(24)
 58348  	defer tls.Free(24)
 58349  
 58350  	var rc int32 = SQLITE_OK
 58351  	var p uintptr = vtab
 58352  
 58353  	if simulateVtabError(tls, p, ts+28196 /* "xRename" */) != 0 {
 58354  		return SQLITE_ERROR
 58355  	}
 58356  
 58357  	if (*echo_vtab)(unsafe.Pointer(p)).FisPattern != 0 {
 58358  		var nThis int32 = int32(libc.Xstrlen(tls, (*echo_vtab)(unsafe.Pointer(p)).FzThis))
 58359  		var zSql uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+28204, /* "ALTER TABLE %s R..." */
 58360  			libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(p)).FzTableName, zNewName, ((*echo_vtab)(unsafe.Pointer(p)).FzTableName+uintptr(nThis))))
 58361  		rc = sqlite3.Xsqlite3_exec(tls, (*echo_vtab)(unsafe.Pointer(p)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
 58362  		sqlite3.Xsqlite3_free(tls, zSql)
 58363  	}
 58364  
 58365  	return rc
 58366  }
 58367  
 58368  func echoSavepoint(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1281:12: */
 58369  
 58370  	return SQLITE_OK
 58371  }
 58372  
 58373  func echoRelease(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1286:12: */
 58374  
 58375  	return SQLITE_OK
 58376  }
 58377  
 58378  func echoRollbackTo(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1291:12: */
 58379  
 58380  	return SQLITE_OK
 58381  }
 58382  
 58383  // A virtual table module that merely "echos" the contents of another
 58384  // table (like an SQL VIEW).
 58385  var echoModule = sqlite3_module{
 58386  	FiVersion:      1, // iVersion
 58387  	FxCreate:       0,
 58388  	FxConnect:      0,
 58389  	FxBestIndex:    0,
 58390  	FxDisconnect:   0,
 58391  	FxDestroy:      0,
 58392  	FxOpen:         0, // xOpen - open a cursor
 58393  	FxClose:        0, // xClose - close a cursor
 58394  	FxFilter:       0, // xFilter - configure scan constraints
 58395  	FxNext:         0, // xNext - advance a cursor
 58396  	FxEof:          0, // xEof
 58397  	FxColumn:       0, // xColumn - read data
 58398  	FxRowid:        0, // xRowid - read data
 58399  	FxUpdate:       0, // xUpdate - write data
 58400  	FxBegin:        0, // xBegin - begin transaction
 58401  	FxSync:         0, // xSync - sync transaction
 58402  	FxCommit:       0, // xCommit - commit transaction
 58403  	FxRollback:     0, // xRollback - rollback transaction
 58404  	FxFindFunction: 0, // xFindFunction - function overloading
 58405  	FxRename:       0, // xRename - rename the table
 58406  } /* test8.c:1300:23 */
 58407  
 58408  var echoModuleV2 = sqlite3_module{
 58409  	FiVersion:      2, // iVersion
 58410  	FxCreate:       0,
 58411  	FxConnect:      0,
 58412  	FxBestIndex:    0,
 58413  	FxDisconnect:   0,
 58414  	FxDestroy:      0,
 58415  	FxOpen:         0, // xOpen - open a cursor
 58416  	FxClose:        0, // xClose - close a cursor
 58417  	FxFilter:       0, // xFilter - configure scan constraints
 58418  	FxNext:         0, // xNext - advance a cursor
 58419  	FxEof:          0, // xEof
 58420  	FxColumn:       0, // xColumn - read data
 58421  	FxRowid:        0, // xRowid - read data
 58422  	FxUpdate:       0, // xUpdate - write data
 58423  	FxBegin:        0, // xBegin - begin transaction
 58424  	FxSync:         0, // xSync - sync transaction
 58425  	FxCommit:       0, // xCommit - commit transaction
 58426  	FxRollback:     0, // xRollback - rollback transaction
 58427  	FxFindFunction: 0, // xFindFunction - function overloading
 58428  	FxRename:       0, // xRename - rename the table
 58429  	FxSavepoint:    0,
 58430  	FxRelease:      0,
 58431  	FxRollbackTo:   0,
 58432  } /* test8.c:1323:23 */
 58433  
 58434  func moduleDestroy(tls *libc.TLS, p uintptr) { /* test8.c:1355:13: */
 58435  	var pMod uintptr = p
 58436  	sqlite3.Xsqlite3_create_function(tls, (*EchoModule)(unsafe.Pointer(pMod)).Fdb, ts+28234, /* "function_that_do..." */
 58437  		SQLITE_ANY, 1, uintptr(0), uintptr(0), uintptr(0), uintptr(0))
 58438  	sqlite3.Xsqlite3_free(tls, p)
 58439  }
 58440  
 58441  // Register the echo virtual table module.
 58442  func register_echo_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test8.c:1365:26: */
 58443  	bp := tls.Alloc(8)
 58444  	defer tls.Free(8)
 58445  
 58446  	var rc int32
 58447  	// var db uintptr at bp, 8
 58448  
 58449  	var pMod uintptr
 58450  	if objc != 2 {
 58451  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 58452  		return TCL_ERROR
 58453  	}
 58454  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 58455  		return TCL_ERROR
 58456  	}
 58457  
 58458  	// Virtual table module "echo"
 58459  	pMod = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(EchoModule{})))
 58460  	(*EchoModule)(unsafe.Pointer(pMod)).Finterp = interp
 58461  	(*EchoModule)(unsafe.Pointer(pMod)).Fdb = *(*uintptr)(unsafe.Pointer(bp /* db */))
 58462  	rc = sqlite3.Xsqlite3_create_module_v2(tls,
 58463  		*(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28272 /* "echo" */, uintptr(unsafe.Pointer(&echoModule)), pMod, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{moduleDestroy})))
 58464  
 58465  	// Virtual table module "echo_v2"
 58466  	if rc == SQLITE_OK {
 58467  		pMod = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(EchoModule{})))
 58468  		(*EchoModule)(unsafe.Pointer(pMod)).Finterp = interp
 58469  		(*EchoModule)(unsafe.Pointer(pMod)).Fdb = *(*uintptr)(unsafe.Pointer(bp /* db */))
 58470  		rc = sqlite3.Xsqlite3_create_module_v2(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28277, /* "echo_v2" */
 58471  			uintptr(unsafe.Pointer(&echoModuleV2)), pMod, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{moduleDestroy})))
 58472  	}
 58473  
 58474  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 58475  	return TCL_OK
 58476  }
 58477  
 58478  // Tcl interface to sqlite3_declare_vtab, invoked as follows from Tcl:
 58479  //
 58480  // sqlite3_declare_vtab DB SQL
 58481  func declare_vtab(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test8.c:1407:26: */
 58482  	bp := tls.Alloc(8)
 58483  	defer tls.Free(8)
 58484  
 58485  	// var db uintptr at bp, 8
 58486  
 58487  	var rc int32
 58488  	if objc != 3 {
 58489  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10524 /* "DB SQL" */)
 58490  		return TCL_ERROR
 58491  	}
 58492  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 58493  		return TCL_ERROR
 58494  	}
 58495  	rc = sqlite3.Xsqlite3_declare_vtab(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))))
 58496  	if rc != SQLITE_OK {
 58497  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp /* db */))), uintptr(1))
 58498  		return TCL_ERROR
 58499  	}
 58500  	return TCL_OK
 58501  }
 58502  
 58503  // Register commands with the TCL interpreter.
 58504  func Sqlitetest8_Init(tls *libc.TLS, interp uintptr) int32 { /* test8.c:1433:5: */
 58505  	var i int32
 58506  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd2)) / uint64(unsafe.Sizeof(struct {
 58507  		FzName      uintptr
 58508  		FxProc      uintptr
 58509  		FclientData uintptr
 58510  	}{}))); i++ {
 58511  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd2[i].FzName,
 58512  			aObjCmd2[i].FxProc, aObjCmd2[i].FclientData, uintptr(0))
 58513  	}
 58514  	return TCL_OK
 58515  }
 58516  
 58517  var aObjCmd2 = [2]struct {
 58518  	FzName      uintptr
 58519  	FxProc      uintptr
 58520  	FclientData uintptr
 58521  }{
 58522  	{FzName: ts + 28285 /* "register_echo_mo..." */, FxProc: 0},
 58523  	{FzName: ts + 28306 /* "sqlite3_declare_..." */, FxProc: 0},
 58524  } /* test8.c:1439:5 */
 58525  
 58526  // end block for C++
 58527  
 58528  // Local Variables:
 58529  // mode: c
 58530  // c-basic-offset: 4
 58531  // fill-column: 78
 58532  // End:
 58533  // -
 58534  // SPDX-License-Identifier: BSD-3-Clause
 58535  //
 58536  // Copyright (c) 1990, 1993
 58537  //	The Regents of the University of California.  All rights reserved.
 58538  //
 58539  // Redistribution and use in source and binary forms, with or without
 58540  // modification, are permitted provided that the following conditions
 58541  // are met:
 58542  // 1. Redistributions of source code must retain the above copyright
 58543  //    notice, this list of conditions and the following disclaimer.
 58544  // 2. Redistributions in binary form must reproduce the above copyright
 58545  //    notice, this list of conditions and the following disclaimer in the
 58546  //    documentation and/or other materials provided with the distribution.
 58547  // 3. Neither the name of the University nor the names of its contributors
 58548  //    may be used to endorse or promote products derived from this software
 58549  //    without specific prior written permission.
 58550  //
 58551  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 58552  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 58553  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 58554  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 58555  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 58556  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 58557  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 58558  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 58559  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 58560  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 58561  // SUCH DAMAGE.
 58562  //
 58563  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 58564  // $FreeBSD$
 58565  
 58566  // -
 58567  // SPDX-License-Identifier: BSD-3-Clause
 58568  //
 58569  // Copyright (c) 1990, 1993
 58570  //	The Regents of the University of California.  All rights reserved.
 58571  //
 58572  // Redistribution and use in source and binary forms, with or without
 58573  // modification, are permitted provided that the following conditions
 58574  // are met:
 58575  // 1. Redistributions of source code must retain the above copyright
 58576  //    notice, this list of conditions and the following disclaimer.
 58577  // 2. Redistributions in binary form must reproduce the above copyright
 58578  //    notice, this list of conditions and the following disclaimer in the
 58579  //    documentation and/or other materials provided with the distribution.
 58580  // 3. Neither the name of the University nor the names of its contributors
 58581  //    may be used to endorse or promote products derived from this software
 58582  //    without specific prior written permission.
 58583  //
 58584  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 58585  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 58586  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 58587  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 58588  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 58589  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 58590  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 58591  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 58592  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 58593  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 58594  // SUCH DAMAGE.
 58595  //
 58596  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 58597  // $FreeBSD$
 58598  
 58599  // c_collation_test
 58600  func c_collation_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:29:26: */
 58601  	bp := tls.Alloc(32)
 58602  	defer tls.Free(32)
 58603  
 58604  	var zErrFunction uintptr
 58605  	// var db uintptr at bp+24, 8
 58606  
 58607  	var rc int32
 58608  	zErrFunction = ts + 28327 /* "N/A" */
 58609  	if !(objc != 1) {
 58610  		goto __1
 58611  	}
 58612  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58613  	return TCL_ERROR
 58614  __1:
 58615  	;
 58616  
 58617  	// Open a database.
 58618  	rc = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, bp+24 /* &db */)
 58619  	if !(rc != SQLITE_OK) {
 58620  		goto __2
 58621  	}
 58622  	zErrFunction = ts + 21765 /* "sqlite3_open" */
 58623  	goto error_out
 58624  __2:
 58625  	;
 58626  
 58627  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), ts+13875 /* "collate" */, 456, uintptr(0), uintptr(0))
 58628  	if !(rc != SQLITE_MISUSE) {
 58629  		goto __3
 58630  	}
 58631  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 58632  	zErrFunction = ts + 28331 /* "sqlite3_create_c..." */
 58633  	goto error_out
 58634  __3:
 58635  	;
 58636  
 58637  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 58638  	return TCL_OK
 58639  
 58640  error_out:
 58641  	tcl.XTcl_ResetResult(tls, interp)
 58642  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 58643  	return TCL_ERROR
 58644  }
 58645  
 58646  // c_realloc_test
 58647  func c_realloc_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:70:26: */
 58648  	bp := tls.Alloc(24)
 58649  	defer tls.Free(24)
 58650  
 58651  	var p uintptr
 58652  	var zErrFunction uintptr
 58653  	zErrFunction = ts + 28327 /* "N/A" */
 58654  
 58655  	if !(objc != 1) {
 58656  		goto __1
 58657  	}
 58658  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58659  	return TCL_ERROR
 58660  __1:
 58661  	;
 58662  
 58663  	p = sqlite3.Xsqlite3_malloc(tls, 5)
 58664  	if !(!(p != 0)) {
 58665  		goto __2
 58666  	}
 58667  	zErrFunction = ts + 28381 /* "sqlite3_malloc" */
 58668  	goto error_out
 58669  __2:
 58670  	;
 58671  
 58672  	// Test that realloc()ing a block of memory to a negative size is
 58673  	// the same as free()ing that memory.
 58674  	p = sqlite3.Xsqlite3_realloc(tls, p, -1)
 58675  	if !(p != 0) {
 58676  		goto __3
 58677  	}
 58678  	zErrFunction = ts + 28396 /* "sqlite3_realloc" */
 58679  	goto error_out
 58680  __3:
 58681  	;
 58682  
 58683  	return TCL_OK
 58684  
 58685  error_out:
 58686  	tcl.XTcl_ResetResult(tls, interp)
 58687  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 58688  	return TCL_ERROR
 58689  }
 58690  
 58691  // c_misuse_test
 58692  func c_misuse_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:111:26: */
 58693  	bp := tls.Alloc(40)
 58694  	defer tls.Free(40)
 58695  
 58696  	var zErrFunction uintptr
 58697  	// var db uintptr at bp+24, 8
 58698  
 58699  	// var pStmt uintptr at bp+32, 8
 58700  
 58701  	var rc int32
 58702  	zErrFunction = ts + 28327 /* "N/A" */
 58703  	*(*uintptr)(unsafe.Pointer(bp + 24 /* db */)) = uintptr(0)
 58704  
 58705  	if !(objc != 1) {
 58706  		goto __1
 58707  	}
 58708  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58709  	return TCL_ERROR
 58710  __1:
 58711  	;
 58712  
 58713  	// Open a database. Then close it again. We need to do this so that
 58714  	// we have a "closed database handle" to pass to various API functions.
 58715  	rc = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, bp+24 /* &db */)
 58716  	if !(rc != SQLITE_OK) {
 58717  		goto __2
 58718  	}
 58719  	zErrFunction = ts + 21765 /* "sqlite3_open" */
 58720  	goto error_out
 58721  __2:
 58722  	;
 58723  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 58724  
 58725  	rc = sqlite3.Xsqlite3_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 58726  	if !(rc != SQLITE_MISUSE) {
 58727  		goto __3
 58728  	}
 58729  	zErrFunction = ts + 21692 /* "sqlite3_errcode" */
 58730  	goto error_out
 58731  __3:
 58732  	;
 58733  
 58734  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(1234)
 58735  	rc = sqlite3.Xsqlite3_prepare(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+32 /* &pStmt */, uintptr(0))
 58736  	if !(rc != SQLITE_MISUSE) {
 58737  		goto __4
 58738  	}
 58739  	zErrFunction = ts + 21846 /* "sqlite3_prepare" */
 58740  	goto error_out
 58741  __4:
 58742  	;
 58743  	// Verify that pStmt is zeroed even on a MISUSE error
 58744  
 58745  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(1234)
 58746  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+32 /* &pStmt */, uintptr(0))
 58747  	if !(rc != SQLITE_MISUSE) {
 58748  		goto __5
 58749  	}
 58750  	zErrFunction = ts + 21880 /* "sqlite3_prepare_..." */
 58751  	goto error_out
 58752  __5:
 58753  	;
 58754  
 58755  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(1234)
 58756  	rc = sqlite3.Xsqlite3_prepare16(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+32 /* &pStmt */, uintptr(0))
 58757  	if !(rc != SQLITE_MISUSE) {
 58758  		goto __6
 58759  	}
 58760  	zErrFunction = ts + 21862 /* "sqlite3_prepare1..." */
 58761  	goto error_out
 58762  __6:
 58763  	;
 58764  
 58765  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) = uintptr(1234)
 58766  	rc = sqlite3.Xsqlite3_prepare16_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+32 /* &pStmt */, uintptr(0))
 58767  	if !(rc != SQLITE_MISUSE) {
 58768  		goto __7
 58769  	}
 58770  	zErrFunction = ts + 21942 /* "sqlite3_prepare1..." */
 58771  	goto error_out
 58772  __7:
 58773  	;
 58774  
 58775  	return TCL_OK
 58776  
 58777  error_out:
 58778  	tcl.XTcl_ResetResult(tls, interp)
 58779  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 58780  	return TCL_ERROR
 58781  }
 58782  
 58783  // Register commands with the TCL interpreter.
 58784  func Sqlitetest9_Init(tls *libc.TLS, interp uintptr) int32 { /* test9.c:188:5: */
 58785  	var i int32
 58786  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd3)) / uint64(unsafe.Sizeof(struct {
 58787  		FzName      uintptr
 58788  		FxProc      uintptr
 58789  		FclientData uintptr
 58790  	}{}))); i++ {
 58791  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd3[i].FzName,
 58792  			aObjCmd3[i].FxProc, aObjCmd3[i].FclientData, uintptr(0))
 58793  	}
 58794  	return TCL_OK
 58795  }
 58796  
 58797  var aObjCmd3 = [3]struct {
 58798  	FzName      uintptr
 58799  	FxProc      uintptr
 58800  	FclientData uintptr
 58801  }{
 58802  	{FzName: ts + 28412 /* "c_misuse_test" */, FxProc: 0},
 58803  	{FzName: ts + 28426 /* "c_realloc_test" */, FxProc: 0},
 58804  	{FzName: ts + 28441 /* "c_collation_test" */, FxProc: 0},
 58805  } /* test9.c:193:5 */
 58806  
 58807  // end block for C++
 58808  
 58809  // Local Variables:
 58810  // mode: c
 58811  // c-basic-offset: 4
 58812  // fill-column: 78
 58813  // End:
 58814  
 58815  // This routine registers the custom TCL commands defined in this
 58816  // module.  This should be the only procedure visible from outside
 58817  // of this module.
 58818  func Sqlitetestasync_Init(tls *libc.TLS, interp uintptr) int32 { /* test_async.c:238:5: */
 58819  	return TCL_OK
 58820  }
 58821  
 58822  // The following macros redefine the API routines so that they are
 58823  // redirected through the global sqlite3_api structure.
 58824  //
 58825  // This header file is also used by the loadext.c source file
 58826  // (part of the main SQLite library - not an extension) so that
 58827  // it can get access to the sqlite3_api_routines structure
 58828  // definition.  But the main library does not want to redefine
 58829  // the API.  So the redefinition macros are only valid if the
 58830  // SQLITE_CORE macros is undefined.
 58831  
 58832  // This case when the file is being statically linked into the
 58833  // application
 58834  
 58835  // tclcmd:   sqlite3_reset_auto_extension
 58836  //
 58837  // Reset all auto-extensions
 58838  func resetAutoExtObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_autoext.c:196:26: */
 58839  	sqlite3.Xsqlite3_reset_auto_extension(tls)
 58840  	return SQLITE_OK
 58841  }
 58842  
 58843  // This procedure registers the TCL procs defined in this file.
 58844  func Sqlitetest_autoext_Init(tls *libc.TLS, interp uintptr) int32 { /* test_autoext.c:210:5: */
 58845  	tcl.XTcl_CreateObjCommand(tls, interp, ts+28458, /* "sqlite3_reset_au..." */
 58846  		*(*uintptr)(unsafe.Pointer(&struct {
 58847  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58848  		}{resetAutoExtObjCmd})), uintptr(0), uintptr(0))
 58849  	return TCL_OK
 58850  }
 58851  
 58852  func backupTestCmd(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_backup.c:33:26: */
 58853  	bp := tls.Alloc(196)
 58854  	defer tls.Free(196)
 58855  
 58856  	*(*[5]BackupSubCommand)(unsafe.Pointer(bp /* aSub */)) = [5]BackupSubCommand{
 58857  		{FzCmd: ts + 10120 /* "step" */, FnArg: 1, FzArg: ts + 28487 /* "npage" */},
 58858  		{FzCmd: ts + 28493 /* "finish" */, FeCmd: uint32(1) /* BACKUP_FINISH */, FzArg: ts + 489 /* "" */},
 58859  		{FzCmd: ts + 28500 /* "remaining" */, FeCmd: uint32(2) /* BACKUP_REMAINING */, FzArg: ts + 489 /* "" */},
 58860  		{FzCmd: ts + 28510 /* "pagecount" */, FeCmd: uint32(3) /* BACKUP_PAGECOUNT */, FzArg: ts + 489 /* "" */},
 58861  		{},
 58862  	}
 58863  
 58864  	var p uintptr = clientData
 58865  	// var iCmd int32 at bp+120, 4
 58866  
 58867  	var rc int32
 58868  
 58869  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 58870  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &aSub[0] */, int32(unsafe.Sizeof(BackupSubCommand{})), ts+12161 /* "option" */, 0, bp+120 /* &iCmd */)
 58871  	if rc != TCL_OK {
 58872  		return rc
 58873  	}
 58874  	if objc != (2 + (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 120 /* iCmd */)))*24)).FnArg) {
 58875  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 120 /* iCmd */)))*24)).FzArg)
 58876  		return TCL_ERROR
 58877  	}
 58878  
 58879  	switch (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 120 /* iCmd */)))*24)).FeCmd {
 58880  
 58881  	case uint32(1) /* BACKUP_FINISH */ :
 58882  		{
 58883  			var zCmdName uintptr
 58884  			// var cmdInfo Tcl_CmdInfo at bp+128, 64
 58885  
 58886  			zCmdName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv)))
 58887  			tcl.XTcl_GetCommandInfo(tls, interp, zCmdName, bp+128 /* &cmdInfo */)
 58888  			(*Tcl_CmdInfo)(unsafe.Pointer(bp + 128 /* &cmdInfo */)).FdeleteProc = uintptr(0)
 58889  			tcl.XTcl_SetCommandInfo(tls, interp, zCmdName, bp+128 /* &cmdInfo */)
 58890  			tcl.XTcl_DeleteCommand(tls, interp, zCmdName)
 58891  
 58892  			rc = sqlite3.Xsqlite3_backup_finish(tls, p)
 58893  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 58894  			break
 58895  
 58896  		}
 58897  
 58898  	case uint32(0) /* BACKUP_STEP */ :
 58899  		{
 58900  			// var nPage int32 at bp+192, 4
 58901  
 58902  			if TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+192 /* &nPage */) {
 58903  				return TCL_ERROR
 58904  			}
 58905  			rc = sqlite3.Xsqlite3_backup_step(tls, p, *(*int32)(unsafe.Pointer(bp + 192 /* nPage */)))
 58906  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 58907  			break
 58908  
 58909  		}
 58910  
 58911  	case uint32(2) /* BACKUP_REMAINING */ :
 58912  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_backup_remaining(tls, p)))
 58913  		break
 58914  
 58915  	case uint32(3) /* BACKUP_PAGECOUNT */ :
 58916  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_backup_pagecount(tls, p)))
 58917  		break
 58918  	}
 58919  
 58920  	return TCL_OK
 58921  }
 58922  
 58923  type BackupSubCommand = struct {
 58924  	FzCmd uintptr
 58925  	FeCmd uint32
 58926  	FnArg int32
 58927  	FzArg uintptr
 58928  } /* test_backup.c:42:3 */
 58929  
 58930  func backupTestFinish(tls *libc.TLS, clientData ClientData) { /* test_backup.c:108:27: */
 58931  	var pBackup uintptr = clientData
 58932  	sqlite3.Xsqlite3_backup_finish(tls, pBackup)
 58933  }
 58934  
 58935  //     sqlite3_backup CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME
 58936  //
 58937  func backupTestInit(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_backup.c:117:26: */
 58938  	bp := tls.Alloc(32)
 58939  	defer tls.Free(32)
 58940  
 58941  	var pBackup uintptr
 58942  	// var pDestDb uintptr at bp+16, 8
 58943  
 58944  	// var pSrcDb uintptr at bp+24, 8
 58945  
 58946  	var zDestName uintptr
 58947  	var zSrcName uintptr
 58948  	var zCmd uintptr
 58949  
 58950  	if objc != 6 {
 58951  		tcl.XTcl_WrongNumArgs(tls,
 58952  			interp, 1, objv, ts+28520 /* "CMDNAME DESTHAND..." */)
 58953  		return TCL_ERROR
 58954  	}
 58955  
 58956  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 58957  	getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), bp+16 /* &pDestDb */)
 58958  	zDestName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 58959  	getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8))), bp+24 /* &pSrcDb */)
 58960  	zSrcName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 5*8)))
 58961  
 58962  	pBackup = sqlite3.Xsqlite3_backup_init(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pDestDb */)), zDestName, *(*uintptr)(unsafe.Pointer(bp + 24 /* pSrcDb */)), zSrcName)
 58963  	if !(pBackup != 0) {
 58964  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28566 /* "sqlite3_backup_i..." */, 0))
 58965  		return TCL_ERROR
 58966  	}
 58967  
 58968  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 58969  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 58970  	}{backupTestCmd})), pBackup, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{backupTestFinish})))
 58971  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 58972  	return TCL_OK
 58973  }
 58974  
 58975  func Sqlitetestbackup_Init(tls *libc.TLS, interp uintptr) int32 { /* test_backup.c:154:5: */
 58976  	tcl.XTcl_CreateObjCommand(tls, interp, ts+28595 /* "sqlite3_backup" */, *(*uintptr)(unsafe.Pointer(&struct {
 58977  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 58978  	}{backupTestInit})), uintptr(0), uintptr(0))
 58979  	return TCL_OK
 58980  }
 58981  
 58982  // end block for C++
 58983  
 58984  // Local Variables:
 58985  // mode: c
 58986  // c-basic-offset: 4
 58987  // fill-column: 78
 58988  // End:
 58989  
 58990  type tcl_vtab1 = struct {
 58991  	Fbase   sqlite3_vtab
 58992  	Finterp uintptr
 58993  	FpCmd   uintptr
 58994  	Fdb     uintptr
 58995  } /* test_bestindex.c:104:9 */
 58996  
 58997  // end block for C++
 58998  
 58999  // Local Variables:
 59000  // mode: c
 59001  // c-basic-offset: 4
 59002  // fill-column: 78
 59003  // End:
 59004  
 59005  type tcl_vtab = tcl_vtab1 /* test_bestindex.c:104:25 */
 59006  type tcl_cursor1 = struct {
 59007  	Fbase  sqlite3_vtab_cursor
 59008  	FpStmt uintptr
 59009  } /* test_bestindex.c:105:9 */
 59010  
 59011  type tcl_cursor = tcl_cursor1 /* test_bestindex.c:105:27 */
 59012  
 59013  // Dequote string z in place.
 59014  func tclDequote(tls *libc.TLS, z uintptr) { /* test_bestindex.c:126:13: */
 59015  	var q int8 = *(*int8)(unsafe.Pointer(z))
 59016  
 59017  	// Set stack variable q to the close-quote character
 59018  	if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 59019  		var iIn int32 = 1
 59020  		var iOut int32 = 0
 59021  		if int32(q) == '[' {
 59022  			q = int8(']')
 59023  		}
 59024  
 59025  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 59026  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 59027  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 59028  					// Character iIn was the close quote.
 59029  					iIn++
 59030  					break
 59031  				} else {
 59032  					// Character iIn and iIn+1 form an escaped quote character. Skip
 59033  					// the input cursor past both and copy a single quote character
 59034  					// to the output buffer.
 59035  					iIn = iIn + (2)
 59036  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 59037  				}
 59038  			} else {
 59039  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 59040  			}
 59041  		}
 59042  
 59043  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 59044  	}
 59045  }
 59046  
 59047  // This function is the implementation of both the xConnect and xCreate
 59048  // methods of the fs virtual table.
 59049  //
 59050  // The argv[] array contains the following:
 59051  //
 59052  //   argv[0]   -> module name  ("fs")
 59053  //   argv[1]   -> database name
 59054  //   argv[2]   -> table name
 59055  //   argv[...] -> other module argument fields.
 59056  func tclConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_bestindex.c:168:12: */
 59057  	bp := tls.Alloc(8)
 59058  	defer tls.Free(8)
 59059  
 59060  	var interp uintptr = pAux
 59061  	var pTab uintptr = uintptr(0)
 59062  	var zCmd uintptr = uintptr(0)
 59063  	var pScript uintptr = uintptr(0)
 59064  	var rc int32 = SQLITE_OK
 59065  
 59066  	if argc != 4 {
 59067  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 59068  		return SQLITE_ERROR
 59069  	}
 59070  
 59071  	zCmd = sqlite3.Xsqlite3_malloc64(tls, (uint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + uint64(1))))
 59072  	pTab = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(tcl_vtab{})))
 59073  	if (zCmd != 0) && (pTab != 0) {
 59074  		libc.Xmemcpy(tls, zCmd, *(*uintptr)(unsafe.Pointer(argv + 3*8)), (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8))) + uint64(1)))
 59075  		tclDequote(tls, zCmd)
 59076  		libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(tcl_vtab{})))
 59077  
 59078  		(*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd = tcl.XTcl_NewStringObj(tls, zCmd, -1)
 59079  		(*tcl_vtab)(unsafe.Pointer(pTab)).Finterp = interp
 59080  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fdb = db
 59081  		(*Tcl_Obj)(unsafe.Pointer((*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)).FrefCount++
 59082  
 59083  		pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 59084  		(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 59085  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27657 /* "xConnect" */, -1))
 59086  
 59087  		rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 59088  		if rc != TCL_OK {
 59089  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, tcl.XTcl_GetStringResult(tls, interp)))
 59090  			rc = SQLITE_ERROR
 59091  		} else {
 59092  			rc = sqlite3.Xsqlite3_declare_vtab(tls, db, tcl.XTcl_GetStringResult(tls, interp))
 59093  		}
 59094  
 59095  		if rc != SQLITE_OK {
 59096  			sqlite3.Xsqlite3_free(tls, pTab)
 59097  			pTab = uintptr(0)
 59098  		}
 59099  	} else {
 59100  		rc = SQLITE_NOMEM
 59101  	}
 59102  
 59103  	sqlite3.Xsqlite3_free(tls, zCmd)
 59104  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 59105  	return rc
 59106  }
 59107  
 59108  // The xDisconnect and xDestroy methods are also the same
 59109  func tclDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_bestindex.c:224:12: */
 59110  	var pTab uintptr = pVtab
 59111  	for ok := true; ok; ok = 0 != 0 {
 59112  		var _objPtr uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd
 59113  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59114  			tcl.XTclFreeObj(tls, _objPtr)
 59115  		}
 59116  	}
 59117  	sqlite3.Xsqlite3_free(tls, pTab)
 59118  	return SQLITE_OK
 59119  }
 59120  
 59121  // Open a new tcl cursor.
 59122  func tclOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_bestindex.c:234:12: */
 59123  	var pCur uintptr
 59124  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(tcl_cursor{})))
 59125  	if pCur == uintptr(0) {
 59126  		return SQLITE_NOMEM
 59127  	}
 59128  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(tcl_cursor{})))
 59129  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 59130  	return SQLITE_OK
 59131  }
 59132  
 59133  // Close a tcl cursor.
 59134  func tclClose(tls *libc.TLS, cur uintptr) int32 { /* test_bestindex.c:246:12: */
 59135  	var pCur uintptr = cur
 59136  	if pCur != 0 {
 59137  		sqlite3.Xsqlite3_finalize(tls, (*tcl_cursor)(unsafe.Pointer(pCur)).FpStmt)
 59138  		sqlite3.Xsqlite3_free(tls, pCur)
 59139  	}
 59140  	return SQLITE_OK
 59141  }
 59142  
 59143  func tclNext(tls *libc.TLS, pVtabCursor uintptr) int32 { /* test_bestindex.c:255:12: */
 59144  	bp := tls.Alloc(8)
 59145  	defer tls.Free(8)
 59146  
 59147  	var pCsr uintptr = pVtabCursor
 59148  	if (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 59149  		var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 59150  		var rc int32 = sqlite3.Xsqlite3_step(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt)
 59151  		if rc != SQLITE_ROW {
 59152  			var zErr uintptr
 59153  			rc = sqlite3.Xsqlite3_finalize(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt)
 59154  			(*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 59155  			if rc != SQLITE_OK {
 59156  				zErr = sqlite3.Xsqlite3_errmsg(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb)
 59157  				(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 59158  			}
 59159  		}
 59160  	}
 59161  	return SQLITE_OK
 59162  }
 59163  
 59164  func tclFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_bestindex.c:273:12: */
 59165  	bp := tls.Alloc(48)
 59166  	defer tls.Free(48)
 59167  
 59168  	var pCsr uintptr = pVtabCursor
 59169  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 59170  	var interp uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).Finterp
 59171  	var pScript uintptr
 59172  	var pArg uintptr
 59173  	var ii int32
 59174  	var rc int32
 59175  
 59176  	pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 59177  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 59178  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27721 /* "xFilter" */, -1))
 59179  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewIntObj(tls, idxNum))
 59180  	if idxStr != 0 {
 59181  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, idxStr, -1))
 59182  	} else {
 59183  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 59184  	}
 59185  
 59186  	pArg = tcl.XTcl_NewObj(tls)
 59187  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 59188  	for ii = 0; ii < argc; ii++ {
 59189  		var zVal uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*8)))
 59190  		var pVal uintptr
 59191  		if zVal == uintptr(0) {
 59192  			pVal = tcl.XTcl_NewObj(tls)
 59193  		} else {
 59194  			pVal = tcl.XTcl_NewStringObj(tls, zVal, -1)
 59195  		}
 59196  		tcl.XTcl_ListObjAppendElement(tls, interp, pArg, pVal)
 59197  	}
 59198  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, pArg)
 59199  	for ok := true; ok; ok = 0 != 0 {
 59200  		var _objPtr uintptr = pArg
 59201  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59202  			tcl.XTclFreeObj(tls, _objPtr)
 59203  		}
 59204  	}
 59205  
 59206  	rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 59207  	if rc != TCL_OK {
 59208  		var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 59209  		rc = SQLITE_ERROR
 59210  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 59211  	} else {
 59212  		// Analyze the scripts return value. The return value should be a tcl
 59213  		// list object with an even number of elements. The first element of each
 59214  		// pair must be one of:
 59215  		//
 59216  		//   "sql"          (SQL statement to return data)
 59217  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 59218  		*(*uintptr)(unsafe.Pointer(bp + 40 /* apElem */)) = uintptr(0)
 59219  		// var nElem int32 at bp+32, 4
 59220  
 59221  		rc = tcl.XTcl_ListObjGetElements(tls, interp, pRes, bp+32 /* &nElem */, bp+40 /* &apElem */)
 59222  		if rc != TCL_OK {
 59223  			var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 59224  			rc = SQLITE_ERROR
 59225  			(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zErr))
 59226  		} else {
 59227  			for ii = 0; (rc == SQLITE_OK) && (ii < *(*int32)(unsafe.Pointer(bp + 32 /* nElem */))); ii = ii + (2) {
 59228  				var zCmd uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* apElem */)) + uintptr(ii)*8)))
 59229  				var p uintptr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 40 /* apElem */)) + uintptr((ii+1))*8))
 59230  				if sqlite3.Xsqlite3_stricmp(tls, ts+1808 /* "sql" */, zCmd) == 0 {
 59231  					var zSql uintptr = tcl.XTcl_GetString(tls, p)
 59232  					rc = sqlite3.Xsqlite3_prepare_v2(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pStmt */), uintptr(0))
 59233  					if rc != SQLITE_OK {
 59234  						var zErr uintptr = sqlite3.Xsqlite3_errmsg(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb)
 59235  						(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+16, zErr))
 59236  					}
 59237  				} else {
 59238  					rc = SQLITE_ERROR
 59239  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+24, zCmd))
 59240  				}
 59241  			}
 59242  		}
 59243  	}
 59244  
 59245  	if rc == SQLITE_OK {
 59246  		rc = tclNext(tls, pVtabCursor)
 59247  	}
 59248  	return rc
 59249  }
 59250  
 59251  func tclColumn(tls *libc.TLS, pVtabCursor uintptr, ctx uintptr, i int32) int32 { /* test_bestindex.c:356:12: */
 59252  	var pCsr uintptr = pVtabCursor
 59253  	sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt, (i+1)))
 59254  	return SQLITE_OK
 59255  }
 59256  
 59257  func tclRowid(tls *libc.TLS, pVtabCursor uintptr, pRowid uintptr) int32 { /* test_bestindex.c:366:12: */
 59258  	var pCsr uintptr = pVtabCursor
 59259  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt, 0)
 59260  	return SQLITE_OK
 59261  }
 59262  
 59263  func tclEof(tls *libc.TLS, pVtabCursor uintptr) int32 { /* test_bestindex.c:372:12: */
 59264  	var pCsr uintptr = pVtabCursor
 59265  	return (libc.Bool32((*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 59266  }
 59267  
 59268  func tclBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_bestindex.c:377:12: */
 59269  	bp := tls.Alloc(76)
 59270  	defer tls.Free(76)
 59271  
 59272  	var pTab uintptr = tab
 59273  	var interp uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).Finterp
 59274  	var pArg uintptr
 59275  	var pScript uintptr
 59276  	var ii int32
 59277  	var rc int32 = SQLITE_OK
 59278  
 59279  	pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 59280  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 59281  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27775 /* "xBestIndex" */, -1))
 59282  
 59283  	pArg = tcl.XTcl_NewObj(tls)
 59284  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 59285  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 59286  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 59287  		var pElem uintptr = tcl.XTcl_NewObj(tls)
 59288  		var zOp uintptr = ts + 3266 /* "?" */
 59289  
 59290  		(*Tcl_Obj)(unsafe.Pointer(pElem)).FrefCount++
 59291  
 59292  		switch int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) {
 59293  		case SQLITE_INDEX_CONSTRAINT_EQ:
 59294  			zOp = ts + 28651 /* "eq" */
 59295  			break
 59296  		case SQLITE_INDEX_CONSTRAINT_GT:
 59297  			zOp = ts + 28654 /* "gt" */
 59298  			break
 59299  		case SQLITE_INDEX_CONSTRAINT_LE:
 59300  			zOp = ts + 28657 /* "le" */
 59301  			break
 59302  		case SQLITE_INDEX_CONSTRAINT_LT:
 59303  			zOp = ts + 28660 /* "lt" */
 59304  			break
 59305  		case SQLITE_INDEX_CONSTRAINT_GE:
 59306  			zOp = ts + 28663 /* "ge" */
 59307  			break
 59308  		case SQLITE_INDEX_CONSTRAINT_MATCH:
 59309  			zOp = ts + 28666 /* "match" */
 59310  			break
 59311  		case SQLITE_INDEX_CONSTRAINT_LIKE:
 59312  			zOp = ts + 27873 /* "like" */
 59313  			break
 59314  		case SQLITE_INDEX_CONSTRAINT_GLOB:
 59315  			zOp = ts + 27878 /* "glob" */
 59316  			break
 59317  		case SQLITE_INDEX_CONSTRAINT_REGEXP:
 59318  			zOp = ts + 6335 /* "regexp" */
 59319  			break
 59320  		case SQLITE_INDEX_CONSTRAINT_NE:
 59321  			zOp = ts + 28672 /* "ne" */
 59322  			break
 59323  		case SQLITE_INDEX_CONSTRAINT_ISNOT:
 59324  			zOp = ts + 28675 /* "isnot" */
 59325  			break
 59326  		case SQLITE_INDEX_CONSTRAINT_ISNOTNULL:
 59327  			zOp = ts + 28681 /* "isnotnull" */
 59328  			break
 59329  		case SQLITE_INDEX_CONSTRAINT_ISNULL:
 59330  			zOp = ts + 28691 /* "isnull" */
 59331  			break
 59332  		case SQLITE_INDEX_CONSTRAINT_IS:
 59333  			zOp = ts + 5712 /* "is" */
 59334  			break
 59335  		}
 59336  
 59337  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28698 /* "op" */, -1))
 59338  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, zOp, -1))
 59339  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28701 /* "column" */, -1))
 59340  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn))
 59341  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28708 /* "usable" */, -1))
 59342  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable)))
 59343  
 59344  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, pElem)
 59345  		for ok := true; ok; ok = 0 != 0 {
 59346  			var _objPtr uintptr = pElem
 59347  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59348  				tcl.XTclFreeObj(tls, _objPtr)
 59349  			}
 59350  		}
 59351  	}
 59352  
 59353  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, pArg)
 59354  	for ok1 := true; ok1; ok1 = 0 != 0 {
 59355  		var _objPtr uintptr = pArg
 59356  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59357  			tcl.XTclFreeObj(tls, _objPtr)
 59358  		}
 59359  	}
 59360  
 59361  	pArg = tcl.XTcl_NewObj(tls)
 59362  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 59363  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy; ii++ {
 59364  		var pOrder uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(ii)*8)
 59365  		var pElem uintptr = tcl.XTcl_NewObj(tls)
 59366  		(*Tcl_Obj)(unsafe.Pointer(pElem)).FrefCount++
 59367  
 59368  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28701 /* "column" */, -1))
 59369  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, (*sqlite3_index_orderby)(unsafe.Pointer(pOrder)).FiColumn))
 59370  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28715 /* "desc" */, -1))
 59371  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, int32((*sqlite3_index_orderby)(unsafe.Pointer(pOrder)).Fdesc)))
 59372  
 59373  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, pElem)
 59374  		for ok2 := true; ok2; ok2 = 0 != 0 {
 59375  			var _objPtr uintptr = pElem
 59376  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59377  				tcl.XTclFreeObj(tls, _objPtr)
 59378  			}
 59379  		}
 59380  	}
 59381  
 59382  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, pArg)
 59383  	for ok3 := true; ok3; ok3 = 0 != 0 {
 59384  		var _objPtr uintptr = pArg
 59385  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59386  			tcl.XTclFreeObj(tls, _objPtr)
 59387  		}
 59388  	}
 59389  
 59390  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewWideIntObj(tls, int64((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed)))
 59391  
 59392  	rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 59393  	for ok4 := true; ok4; ok4 = 0 != 0 {
 59394  		var _objPtr uintptr = pScript
 59395  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 59396  			tcl.XTclFreeObj(tls, _objPtr)
 59397  		}
 59398  	}
 59399  	if rc != TCL_OK {
 59400  		var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 59401  		rc = SQLITE_ERROR
 59402  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 59403  	} else {
 59404  		// Analyze the scripts return value. The return value should be a tcl
 59405  		// list object with an even number of elements. The first element of each
 59406  		// pair must be one of:
 59407  		//
 59408  		//   "orderby"          (value of orderByConsumed flag)
 59409  		//   "cost"             (value of estimatedCost field)
 59410  		//   "rows"             (value of estimatedRows field)
 59411  		//   "use"              (index of used constraint in aConstraint[])
 59412  		//   "idxnum"           (value of idxNum field)
 59413  		//   "idxstr"           (value of idxStr field)
 59414  		//   "omit"             (index of omitted constraint in aConstraint[])
 59415  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 59416  		*(*uintptr)(unsafe.Pointer(bp + 56 /* apElem */)) = uintptr(0)
 59417  		// var nElem int32 at bp+48, 4
 59418  
 59419  		rc = tcl.XTcl_ListObjGetElements(tls, interp, pRes, bp+48 /* &nElem */, bp+56 /* &apElem */)
 59420  		if rc != TCL_OK {
 59421  			var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 59422  			rc = SQLITE_ERROR
 59423  			(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zErr))
 59424  		} else {
 59425  			var iArgv int32 = 1
 59426  			for ii = 0; (rc == SQLITE_OK) && (ii < *(*int32)(unsafe.Pointer(bp + 48 /* nElem */))); ii = ii + (2) {
 59427  				var zCmd uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 56 /* apElem */)) + uintptr(ii)*8)))
 59428  				var p uintptr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 56 /* apElem */)) + uintptr((ii+1))*8))
 59429  				if sqlite3.Xsqlite3_stricmp(tls, ts+28720 /* "cost" */, zCmd) == 0 {
 59430  					rc = tcl.XTcl_GetDoubleFromObj(tls, interp, p, (pIdxInfo + 64 /* &.estimatedCost */))
 59431  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28725 /* "orderby" */, zCmd) == 0 {
 59432  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, (pIdxInfo + 60 /* &.orderByConsumed */))
 59433  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28733 /* "idxnum" */, zCmd) == 0 {
 59434  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, (pIdxInfo + 40 /* &.idxNum */))
 59435  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28740 /* "idxstr" */, zCmd) == 0 {
 59436  					sqlite3.Xsqlite3_free(tls, (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr)
 59437  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, tcl.XTcl_GetString(tls, p)))
 59438  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 59439  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28747 /* "rows" */, zCmd) == 0 {
 59440  					*(*Tcl_WideInt)(unsafe.Pointer(bp + 64 /* x */)) = int64(0)
 59441  					rc = tcl.XTcl_GetWideIntFromObj(tls, interp, p, bp+64 /* &x */)
 59442  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = sqlite3_int64(tRowcnt(*(*Tcl_WideInt)(unsafe.Pointer(bp + 64 /* x */))))
 59443  				} else if (sqlite3.Xsqlite3_stricmp(tls, ts+28752 /* "use" */, zCmd) == 0) ||
 59444  					(sqlite3.Xsqlite3_stricmp(tls, ts+28756 /* "omit" */, zCmd) == 0) {
 59445  					// var iCons int32 at bp+72, 4
 59446  
 59447  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, bp+72 /* &iCons */)
 59448  					if rc == SQLITE_OK {
 59449  						if (*(*int32)(unsafe.Pointer(bp + 72 /* iCons */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 72 /* iCons */)) >= (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 59450  							rc = SQLITE_ERROR
 59451  							(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28761 /* "unexpected: %d" */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(bp + 72 /* iCons */))))
 59452  						} else {
 59453  							var bOmit int32 = (libc.Bool32((int32(*(*int8)(unsafe.Pointer(zCmd))) == 'o') || (int32(*(*int8)(unsafe.Pointer(zCmd))) == 'O')))
 59454  							(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* iCons */)))*8)).FargvIndex = libc.PostIncInt32(&iArgv, 1)
 59455  							(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* iCons */)))*8)).Fomit = uint8(bOmit)
 59456  						}
 59457  					}
 59458  				} else {
 59459  					rc = SQLITE_ERROR
 59460  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+32, zCmd))
 59461  				}
 59462  				if (rc != SQLITE_OK) && ((*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg == uintptr(0)) {
 59463  					var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 59464  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+40, zErr))
 59465  				}
 59466  			}
 59467  		}
 59468  	}
 59469  
 59470  	return rc
 59471  }
 59472  
 59473  // A virtual table module that provides read-only access to a
 59474  // Tcl global variable namespace.
 59475  var tclModule = sqlite3_module{ // iVersion
 59476  	FxCreate:     0,
 59477  	FxConnect:    0,
 59478  	FxBestIndex:  0,
 59479  	FxDisconnect: 0,
 59480  	FxDestroy:    0,
 59481  	FxOpen:       0, // xOpen - open a cursor
 59482  	FxClose:      0, // xClose - close a cursor
 59483  	FxFilter:     0, // xFilter - configure scan constraints
 59484  	FxNext:       0, // xNext - advance a cursor
 59485  	FxEof:        0, // xEof - check for end of scan
 59486  	FxColumn:     0, // xColumn - read data
 59487  	FxRowid:      0, // xRename
 59488  } /* test_bestindex.c:549:23 */
 59489  
 59490  // Register the echo virtual table module.
 59491  func register_tcl_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_bestindex.c:580:26: */
 59492  	bp := tls.Alloc(8)
 59493  	defer tls.Free(8)
 59494  
 59495  	// var db uintptr at bp, 8
 59496  
 59497  	if objc != 2 {
 59498  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 59499  		return TCL_ERROR
 59500  	}
 59501  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 59502  		return TCL_ERROR
 59503  	}
 59504  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28776 /* "tcl" */, uintptr(unsafe.Pointer(&tclModule)), interp)
 59505  	return TCL_OK
 59506  }
 59507  
 59508  // Register commands with the TCL interpreter.
 59509  func Sqlitetesttcl_Init(tls *libc.TLS, interp uintptr) int32 { /* test_bestindex.c:604:5: */
 59510  	var i int32
 59511  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd4)) / uint64(unsafe.Sizeof(struct {
 59512  		FzName      uintptr
 59513  		FxProc      uintptr
 59514  		FclientData uintptr
 59515  	}{}))); i++ {
 59516  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd4[i].FzName,
 59517  			aObjCmd4[i].FxProc, aObjCmd4[i].FclientData, uintptr(0))
 59518  	}
 59519  	return TCL_OK
 59520  }
 59521  
 59522  var aObjCmd4 = [1]struct {
 59523  	FzName      uintptr
 59524  	FxProc      uintptr
 59525  	FclientData uintptr
 59526  }{
 59527  	{FzName: ts + 28780 /* "register_tcl_mod..." */, FxProc: 0},
 59528  } /* test_bestindex.c:610:5 */
 59529  
 59530  // Return a pointer to a buffer containing a text representation of the
 59531  // pointer passed as the only argument. The original pointer may be extracted
 59532  // from the text using sqlite3TestTextToPtr().
 59533  func ptrToText(tls *libc.TLS, p uintptr) uintptr { /* test_blob.c:37:13: */
 59534  	bp := tls.Alloc(8)
 59535  	defer tls.Free(8)
 59536  
 59537  	sqlite3.Xsqlite3_snprintf(tls, (int32(uint64(unsafe.Sizeof(buf)) - uint64(1))), uintptr(unsafe.Pointer(&buf)), ts+13802 /* "%p" */, libc.VaList(bp, p))
 59538  	return uintptr(unsafe.Pointer(&buf))
 59539  }
 59540  
 59541  var buf [100]int8 /* test_blob.c:38:15: */
 59542  
 59543  // Attempt to extract a blob handle (type sqlite3_blob*) from the Tcl
 59544  // object passed as the second argument. If successful, set *ppBlob to
 59545  // point to the blob handle and return TCL_OK. Otherwise, store an error
 59546  // message in the tcl interpreter and return TCL_ERROR. The final value
 59547  // of *ppBlob is undefined in this case.
 59548  //
 59549  // If the object contains a string that begins with "incrblob_", then it
 59550  // is assumed to be the name of a Tcl channel opened using the [db incrblob]
 59551  // command (see tclsqlite.c). Otherwise, it is assumed to be a pointer
 59552  // encoded using the ptrToText() routine or similar.
 59553  func blobHandleFromObj1(tls *libc.TLS, interp uintptr, pObj uintptr, ppBlob uintptr) int32 { /* test_blob.c:55:12: */
 59554  	bp := tls.Alloc(8)
 59555  	defer tls.Free(8)
 59556  
 59557  	var z uintptr
 59558  	// var n int32 at bp, 4
 59559  
 59560  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 59561  	if *(*int32)(unsafe.Pointer(bp /* n */)) == 0 {
 59562  		*(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0)
 59563  	} else if (*(*int32)(unsafe.Pointer(bp /* n */)) > 9) && (0 == libc.Xmemcmp(tls, ts+28800 /* "incrblob_" */, z, uint64(9))) {
 59564  		// var notUsed int32 at bp+4, 4
 59565  
 59566  		var channel Tcl_Channel
 59567  		var instanceData ClientData
 59568  
 59569  		channel = tcl.XTcl_GetChannel(tls, interp, z, bp+4 /* &notUsed */)
 59570  		if !(channel != 0) {
 59571  			return TCL_ERROR
 59572  		}
 59573  
 59574  		tcl.XTcl_Flush(tls, channel)
 59575  		tcl.XTcl_Seek(tls, channel, int64(0), SEEK_SET)
 59576  
 59577  		instanceData = tcl.XTcl_GetChannelInstanceData(tls, channel)
 59578  		*(*uintptr)(unsafe.Pointer(ppBlob)) = *(*uintptr)(unsafe.Pointer(instanceData))
 59579  	} else {
 59580  		*(*uintptr)(unsafe.Pointer(ppBlob)) = sqlite3TestTextToPtr(tls, z)
 59581  	}
 59582  
 59583  	return TCL_OK
 59584  }
 59585  
 59586  // Like Tcl_GetString(), except that if the string is 0 bytes in size, a
 59587  // NULL Pointer is returned.
 59588  func blobStringFromObj(tls *libc.TLS, pObj uintptr) uintptr { /* test_blob.c:90:13: */
 59589  	bp := tls.Alloc(4)
 59590  	defer tls.Free(4)
 59591  
 59592  	// var n int32 at bp, 4
 59593  
 59594  	var z uintptr
 59595  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 59596  	return func() uintptr {
 59597  		if *(*int32)(unsafe.Pointer(bp /* n */)) != 0 {
 59598  			return z
 59599  		}
 59600  		return uintptr(0)
 59601  	}()
 59602  }
 59603  
 59604  // sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME
 59605  //
 59606  // Tcl test harness for the sqlite3_blob_open() function.
 59607  func test_blob_open(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:102:26: */
 59608  	bp := tls.Alloc(40)
 59609  	defer tls.Free(40)
 59610  
 59611  	// var db uintptr at bp+8, 8
 59612  
 59613  	var zDb uintptr
 59614  	var zTable uintptr
 59615  	var zColumn uintptr
 59616  	// var iRowid Tcl_WideInt at bp+16, 8
 59617  
 59618  	// var flags int32 at bp, 4
 59619  
 59620  	var zVarname uintptr
 59621  	// var nVarname int32 at bp+24, 4
 59622  
 59623  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pBlob */)) = bp /* &flags */ // Non-zero initialization
 59624  	var rc int32
 59625  
 59626  	if objc != 8 {
 59627  		var zUsage uintptr = ts + 28810 /* "DB DATABASE TABL..." */
 59628  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, zUsage)
 59629  		return TCL_ERROR
 59630  	}
 59631  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+8 /* &db */) != 0 {
 59632  		return TCL_ERROR
 59633  	}
 59634  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 59635  	zTable = blobStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 59636  	zColumn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 59637  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*8)), bp+16 /* &iRowid */) != 0 {
 59638  		return TCL_ERROR
 59639  	}
 59640  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 6*8)), bp /* &flags */) != 0 {
 59641  		return TCL_ERROR
 59642  	}
 59643  	zVarname = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 7*8)), bp+24 /* &nVarname */)
 59644  
 59645  	if *(*int32)(unsafe.Pointer(bp + 24 /* nVarname */)) > 0 {
 59646  		rc = sqlite3.Xsqlite3_blob_open(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), zDb, zTable, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 16 /* iRowid */)), *(*int32)(unsafe.Pointer(bp /* flags */)), bp+32 /* &pBlob */)
 59647  		tcl.XTcl_SetVar2(tls, interp, zVarname, uintptr(0), ptrToText(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pBlob */))), 0)
 59648  	} else {
 59649  		rc = sqlite3.Xsqlite3_blob_open(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), zDb, zTable, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 16 /* iRowid */)), *(*int32)(unsafe.Pointer(bp /* flags */)), uintptr(0))
 59650  	}
 59651  
 59652  	if rc == SQLITE_OK {
 59653  		tcl.XTcl_ResetResult(tls, interp)
 59654  	} else {
 59655  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 59656  		return TCL_ERROR
 59657  	}
 59658  	return TCL_OK
 59659  }
 59660  
 59661  // sqlite3_blob_close  HANDLE
 59662  func test_blob_close(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:153:26: */
 59663  	bp := tls.Alloc(8)
 59664  	defer tls.Free(8)
 59665  
 59666  	// var pBlob uintptr at bp, 8
 59667  
 59668  	var rc int32
 59669  
 59670  	if objc != 2 {
 59671  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 59672  		return TCL_ERROR
 59673  	}
 59674  
 59675  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &pBlob */) != 0 {
 59676  		return TCL_ERROR
 59677  	}
 59678  	rc = sqlite3.Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)))
 59679  
 59680  	if rc != 0 {
 59681  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 59682  	} else {
 59683  		tcl.XTcl_ResetResult(tls, interp)
 59684  	}
 59685  	return TCL_OK
 59686  }
 59687  
 59688  // sqlite3_blob_bytes  HANDLE
 59689  func test_blob_bytes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:181:26: */
 59690  	bp := tls.Alloc(8)
 59691  	defer tls.Free(8)
 59692  
 59693  	// var pBlob uintptr at bp, 8
 59694  
 59695  	var nByte int32
 59696  
 59697  	if objc != 2 {
 59698  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 59699  		return TCL_ERROR
 59700  	}
 59701  
 59702  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &pBlob */) != 0 {
 59703  		return TCL_ERROR
 59704  	}
 59705  	nByte = sqlite3.Xsqlite3_blob_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)))
 59706  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nByte))
 59707  
 59708  	return TCL_OK
 59709  }
 59710  
 59711  // sqlite3_blob_read  CHANNEL OFFSET N
 59712  //
 59713  //   This command is used to test the sqlite3_blob_read() in ways that
 59714  //   the Tcl channel interface does not. The first argument should
 59715  //   be the name of a valid channel created by the [incrblob] method
 59716  //   of a database handle. This function calls sqlite3_blob_read()
 59717  //   to read N bytes from offset OFFSET from the underlying SQLite
 59718  //   blob handle.
 59719  //
 59720  //   On success, a byte-array object containing the read data is
 59721  //   returned. On failure, the interpreter result is set to the
 59722  //   text representation of the returned error code (i.e. "SQLITE_NOMEM")
 59723  //   and a Tcl exception is thrown.
 59724  func test_blob_read(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:217:26: */
 59725  	bp := tls.Alloc(32)
 59726  	defer tls.Free(32)
 59727  
 59728  	// var pBlob uintptr at bp+16, 8
 59729  
 59730  	// var nByte int32 at bp+28, 4
 59731  
 59732  	// var iOffset int32 at bp+24, 4
 59733  
 59734  	var zBuf uintptr = uintptr(0)
 59735  	var rc int32
 59736  
 59737  	if objc != 4 {
 59738  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28862 /* "CHANNEL OFFSET N" */)
 59739  		return TCL_ERROR
 59740  	}
 59741  
 59742  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &pBlob */) != 0 {
 59743  		return TCL_ERROR
 59744  	}
 59745  	if (TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+24 /* &iOffset */)) ||
 59746  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+28 /* &nByte */)) {
 59747  		return TCL_ERROR
 59748  	}
 59749  
 59750  	if *(*int32)(unsafe.Pointer(bp + 28 /* nByte */)) > 0 {
 59751  		zBuf = tcl.XTcl_AttemptAlloc(tls, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nByte */))))
 59752  		if zBuf == uintptr(0) {
 59753  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28879 /* "out of memory in..." */, 0))
 59754  			return TCL_ERROR
 59755  		}
 59756  	}
 59757  	rc = sqlite3.Xsqlite3_blob_read(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pBlob */)), zBuf, *(*int32)(unsafe.Pointer(bp + 28 /* nByte */)), *(*int32)(unsafe.Pointer(bp + 24 /* iOffset */)))
 59758  	if rc == SQLITE_OK {
 59759  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, zBuf, *(*int32)(unsafe.Pointer(bp + 28 /* nByte */))))
 59760  	} else {
 59761  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 59762  	}
 59763  	tcl.XTcl_Free(tls, zBuf)
 59764  
 59765  	return func() int32 {
 59766  		if rc == SQLITE_OK {
 59767  			return TCL_OK
 59768  		}
 59769  		return TCL_ERROR
 59770  	}()
 59771  }
 59772  
 59773  // sqlite3_blob_write HANDLE OFFSET DATA ?NDATA?
 59774  //
 59775  //   This command is used to test the sqlite3_blob_write() in ways that
 59776  //   the Tcl channel interface does not. The first argument should
 59777  //   be the name of a valid channel created by the [incrblob] method
 59778  //   of a database handle. This function calls sqlite3_blob_write()
 59779  //   to write the DATA byte-array to the underlying SQLite blob handle.
 59780  //   at offset OFFSET.
 59781  //
 59782  //   On success, an empty string is returned. On failure, the interpreter
 59783  //   result is set to the text representation of the returned error code
 59784  //   (i.e. "SQLITE_NOMEM") and a Tcl exception is thrown.
 59785  func test_blob_write(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:273:26: */
 59786  	bp := tls.Alloc(16)
 59787  	defer tls.Free(16)
 59788  
 59789  	// var pBlob uintptr at bp, 8
 59790  
 59791  	// var iOffset int32 at bp+8, 4
 59792  
 59793  	var rc int32
 59794  	var zBuf uintptr
 59795  	// var nBuf int32 at bp+12, 4
 59796  
 59797  	if (objc != 4) && (objc != 5) {
 59798  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28940 /* "HANDLE OFFSET DA..." */)
 59799  		return TCL_ERROR
 59800  	}
 59801  
 59802  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &pBlob */) != 0 {
 59803  		return TCL_ERROR
 59804  	}
 59805  	if TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &iOffset */) {
 59806  		return TCL_ERROR
 59807  	}
 59808  
 59809  	zBuf = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+12 /* &nBuf */)
 59810  	if (objc == 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+12 /* &nBuf */) != 0) {
 59811  		return TCL_ERROR
 59812  	}
 59813  	rc = sqlite3.Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)), zBuf, *(*int32)(unsafe.Pointer(bp + 12 /* nBuf */)), *(*int32)(unsafe.Pointer(bp + 8 /* iOffset */)))
 59814  	if rc != SQLITE_OK {
 59815  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 59816  	}
 59817  
 59818  	return func() int32 {
 59819  		if rc == SQLITE_OK {
 59820  			return TCL_OK
 59821  		}
 59822  		return TCL_ERROR
 59823  	}()
 59824  }
 59825  
 59826  // Register commands with the TCL interpreter.
 59827  func Sqlitetest_blob_Init(tls *libc.TLS, interp uintptr) int32 { /* test_blob.c:312:5: */
 59828  	var i int32
 59829  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd5)) / uint64(unsafe.Sizeof(struct {
 59830  		FzName uintptr
 59831  		FxProc uintptr
 59832  	}{}))); i++ {
 59833  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd5[i].FzName, aObjCmd5[i].FxProc, uintptr(0), uintptr(0))
 59834  	}
 59835  	return TCL_OK
 59836  }
 59837  
 59838  var aObjCmd5 = [5]struct {
 59839  	FzName uintptr
 59840  	FxProc uintptr
 59841  }{
 59842  	{FzName: ts + 28967 /* "sqlite3_blob_ope..." */, FxProc: 0},
 59843  	{FzName: ts + 28985 /* "sqlite3_blob_clo..." */, FxProc: 0},
 59844  	{FzName: ts + 29004 /* "sqlite3_blob_byt..." */, FxProc: 0},
 59845  	{FzName: ts + 29023 /* "sqlite3_blob_rea..." */, FxProc: 0},
 59846  	{FzName: ts + 29041 /* "sqlite3_blob_wri..." */, FxProc: 0},
 59847  } /* test_blob.c:317:5 */
 59848  
 59849  // end block for C++
 59850  
 59851  // Local Variables:
 59852  // mode: c
 59853  // c-basic-offset: 4
 59854  // fill-column: 78
 59855  // End:
 59856  
 59857  // Usage: sqlite3_shared_cache_report
 59858  //
 59859  // Return a list of file that are shared and the number of
 59860  // references to each file.
 59861  func sqlite3BtreeSharedCacheReport(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_btree.c:29:19: */
 59862  	var pBt uintptr
 59863  	var pRet uintptr = tcl.XTcl_NewObj(tls)
 59864  	for pBt = sqlite3.Xsqlite3SharedCacheList; pBt != 0; pBt = (*BtShared)(unsafe.Pointer(pBt)).FpNext {
 59865  		var zFile uintptr = sqlite3.Xsqlite3PagerFilename(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, 1)
 59866  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, zFile, -1))
 59867  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, (*BtShared)(unsafe.Pointer(pBt)).FnRef))
 59868  	}
 59869  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 59870  	return TCL_OK
 59871  }
 59872  
 59873  // Print debugging information about all cursors to standard output.
 59874  func sqlite3BtreeCursorList(tls *libc.TLS, p uintptr) { /* test_btree.c:52:6: */
 59875  }
 59876  
 59877  // end block for C++
 59878  
 59879  // Local Variables:
 59880  // mode: c
 59881  // c-basic-offset: 4
 59882  // fill-column: 78
 59883  // End:
 59884  // -
 59885  // SPDX-License-Identifier: BSD-3-Clause
 59886  //
 59887  // Copyright (c) 1990, 1993
 59888  //	The Regents of the University of California.  All rights reserved.
 59889  //
 59890  // Redistribution and use in source and binary forms, with or without
 59891  // modification, are permitted provided that the following conditions
 59892  // are met:
 59893  // 1. Redistributions of source code must retain the above copyright
 59894  //    notice, this list of conditions and the following disclaimer.
 59895  // 2. Redistributions in binary form must reproduce the above copyright
 59896  //    notice, this list of conditions and the following disclaimer in the
 59897  //    documentation and/or other materials provided with the distribution.
 59898  // 3. Neither the name of the University nor the names of its contributors
 59899  //    may be used to endorse or promote products derived from this software
 59900  //    without specific prior written permission.
 59901  //
 59902  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 59903  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 59904  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 59905  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 59906  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 59907  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 59908  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 59909  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 59910  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 59911  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 59912  // SUCH DAMAGE.
 59913  //
 59914  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 59915  // $FreeBSD$
 59916  
 59917  // -
 59918  // SPDX-License-Identifier: BSD-3-Clause
 59919  //
 59920  // Copyright (c) 1990, 1993
 59921  //	The Regents of the University of California.  All rights reserved.
 59922  //
 59923  // Redistribution and use in source and binary forms, with or without
 59924  // modification, are permitted provided that the following conditions
 59925  // are met:
 59926  // 1. Redistributions of source code must retain the above copyright
 59927  //    notice, this list of conditions and the following disclaimer.
 59928  // 2. Redistributions in binary form must reproduce the above copyright
 59929  //    notice, this list of conditions and the following disclaimer in the
 59930  //    documentation and/or other materials provided with the distribution.
 59931  // 3. Neither the name of the University nor the names of its contributors
 59932  //    may be used to endorse or promote products derived from this software
 59933  //    without specific prior written permission.
 59934  //
 59935  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 59936  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 59937  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 59938  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 59939  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 59940  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 59941  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 59942  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 59943  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 59944  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 59945  // SUCH DAMAGE.
 59946  //
 59947  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 59948  // $FreeBSD$
 59949  
 59950  // Macro to stringify the results of the evaluation a pre-processor
 59951  // macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7".
 59952  
 59953  // This routine sets entries in the global ::sqlite_options() array variable
 59954  // according to the compile-time configuration of the database.  Test
 59955  // procedures use this to determine when tests should be omitted.
 59956  func set_options(tls *libc.TLS, interp uintptr) { /* test_config.c:47:13: */
 59957  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29075 /* "malloc_usable_si..." */, ts+29094, /* "1" */
 59958  		TCL_GLOBAL_ONLY)
 59959  
 59960  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29096 /* "rowid32" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59961  
 59962  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29104 /* "casesensitivelik..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59963  
 59964  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29122 /* "configslower" */, ts+29135 /* "1.0" */, TCL_GLOBAL_ONLY)
 59965  
 59966  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29139 /* "curdir" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59967  
 59968  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29146 /* "win32malloc" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59969  
 59970  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29158 /* "debug" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59971  
 59972  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29164 /* "default_ckptfull..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59973  
 59974  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29186 /* "direct_read" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59975  
 59976  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29198 /* "dirsync" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59977  
 59978  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29206 /* "lfs" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59979  
 59980  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29210 /* "pagecache_overfl..." */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59981  
 59982  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29235 /* "mmap" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59983  
 59984  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29240, /* "worker_threads" */
 59985  		ts+29255 /* "8" */, TCL_GLOBAL_ONLY)
 59986  
 59987  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29257 /* "memdebug" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59988  
 59989  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29266 /* "8_3_names" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59990  
 59991  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29276 /* "cursorhints" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59992  
 59993  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29288 /* "hiddencolumns" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59994  
 59995  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13933 /* "deserialize" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 59996  
 59997  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29302 /* "mathlib" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 59998  
 59999  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29310 /* "mem3" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60000  
 60001  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29315 /* "mem5" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60002  
 60003  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29320 /* "offset_sql_func" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60004  
 60005  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14041 /* "preupdate" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60006  
 60007  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29336 /* "snapshot" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60008  
 60009  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29345 /* "mutex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60010  
 60011  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29351 /* "mutex_noop" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60012  
 60013  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29362 /* "altertable" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60014  
 60015  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+1818 /* "analyze" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60016  
 60017  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29373 /* "api_armor" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60018  
 60019  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29383 /* "atomicwrite" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60020  
 60021  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29395 /* "geopoly" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60022  
 60023  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29403 /* "json1" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60024  
 60025  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29409 /* "has_codec" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60026  
 60027  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29419 /* "like_match_blobs" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60028  
 60029  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+10584 /* "attach" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60030  
 60031  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29436 /* "auth" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60032  
 60033  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29441 /* "autoinc" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60034  
 60035  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13514 /* "autoindex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60036  
 60037  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29449 /* "autoreset" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60038  
 60039  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29459 /* "autovacuum" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60040  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29470, /* "default_autovacu..." */
 60041  		ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60042  
 60043  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29489 /* "between_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60044  
 60045  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29501 /* "builtin_test" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60046  
 60047  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29514 /* "bloblit" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60048  
 60049  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29522 /* "cast" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60050  
 60051  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29527 /* "check" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60052  
 60053  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29533 /* "cte" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60054  
 60055  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29537 /* "columnmetadata" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60056  
 60057  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29552 /* "oversize_cell_ch..." */, ts+14654, /* "0" */
 60058  		TCL_GLOBAL_ONLY)
 60059  
 60060  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29572 /* "compileoption_di..." */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60061  
 60062  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13912 /* "complete" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60063  
 60064  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29592 /* "compound" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60065  
 60066  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29601 /* "conflict" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60067  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29610 /* "crashtest" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60068  
 60069  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29620 /* "datetime" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60070  
 60071  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29629 /* "decltype" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60072  
 60073  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29638 /* "deprecated" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60074  
 60075  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29649 /* "diskio" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60076  
 60077  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+4835 /* "explain" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60078  
 60079  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29656 /* "floatingpoint" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60080  
 60081  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29670 /* "foreignkey" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60082  
 60083  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29681 /* "fts1" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60084  
 60085  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29686 /* "fts2" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60086  
 60087  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29691 /* "fts3" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60088  
 60089  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29696 /* "fts5" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60090  
 60091  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29701 /* "fts3_unicode" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60092  
 60093  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29714 /* "fts4_deferred" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60094  
 60095  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29728 /* "gettable" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60096  
 60097  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29737 /* "icu" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60098  
 60099  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29741 /* "icu_collations" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60100  
 60101  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+11333 /* "incrblob" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60102  
 60103  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29756 /* "integrityck" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60104  
 60105  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29768 /* "legacyformat" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60106  
 60107  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29781 /* "like_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60108  
 60109  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29790 /* "load_ext" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60110  
 60111  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29799 /* "localtime" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60112  
 60113  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29809 /* "lookaside" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60114  
 60115  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29819, /* "long_double" */
 60116  		func() uintptr {
 60117  			if uint64(unsafe.Sizeof(float64(0))) > uint64(unsafe.Sizeof(float64(0))) {
 60118  				return ts + 29094 /* "1" */
 60119  			}
 60120  			return ts + 14654 /* "0" */
 60121  		}(),
 60122  		TCL_GLOBAL_ONLY)
 60123  
 60124  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29831 /* "memorydb" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60125  
 60126  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29840 /* "memorymanage" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60127  
 60128  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29853 /* "mergesort" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60129  
 60130  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29863 /* "null_trim" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60131  
 60132  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29873 /* "or_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60133  
 60134  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29880 /* "rbu" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60135  
 60136  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29884 /* "pager_pragmas" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60137  
 60138  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29898 /* "pragma" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60139  
 60140  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+10199 /* "progress" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60141  
 60142  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29905 /* "reindex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60143  
 60144  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29913 /* "rtree" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60145  
 60146  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29919 /* "rtree_int_only" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60147  
 60148  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29934 /* "schema_pragmas" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60149  
 60150  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29949 /* "schema_version" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60151  
 60152  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29964 /* "session" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60153  
 60154  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+19249 /* "stat4" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60155  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29972 /* "stmtvtab" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60156  
 60157  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29981 /* "scanstatus" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60158  
 60159  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29992 /* "lock_proxy_pragm..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60160  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30011 /* "prefer_proxy_loc..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60161  
 60162  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30032 /* "shared_cache" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60163  
 60164  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30045 /* "subquery" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60165  
 60166  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30054 /* "tclvar" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60167  
 60168  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30061, /* "threadsafe" */
 60169  		func() uintptr {
 60170  			if 1 != 0 {
 60171  				return ts + 29094 /* "1" */
 60172  			}
 60173  			return ts + 14654 /* "0" */
 60174  		}(), TCL_GLOBAL_ONLY)
 60175  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30072, /* "threadsafe1" */
 60176  		func() uintptr {
 60177  			if SQLITE_THREADSAFE == 1 {
 60178  				return ts + 29094 /* "1" */
 60179  			}
 60180  			return ts + 14654 /* "0" */
 60181  		}(), TCL_GLOBAL_ONLY)
 60182  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30084, /* "threadsafe2" */
 60183  		func() uintptr {
 60184  			if SQLITE_THREADSAFE == 2 {
 60185  				return ts + 29094 /* "1" */
 60186  			}
 60187  			return ts + 14654 /* "0" */
 60188  		}(), TCL_GLOBAL_ONLY)
 60189  
 60190  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30096 /* "tempdb" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60191  
 60192  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14126 /* "trace" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60193  
 60194  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30103 /* "trigger" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60195  
 60196  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30111 /* "truncate_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60197  
 60198  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+16199 /* "utf16" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60199  
 60200  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30124 /* "vacuum" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60201  
 60202  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30131 /* "view" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60203  
 60204  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30136 /* "vtab" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60205  
 60206  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30141 /* "wal" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60207  
 60208  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30145 /* "wsd" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60209  
 60210  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30149 /* "update_delete_li..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60211  
 60212  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14153 /* "unlock_notify" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60213  
 60214  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30169 /* "fast_secure_dele..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60215  
 60216  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30188 /* "secure_delete" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60217  
 60218  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30202 /* "userauth" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60219  
 60220  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30211 /* "multiplex_ext_ov..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60221  
 60222  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30235 /* "yytrackmaxstackd..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60223  
 60224  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30256 /* "sqllog" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60225  
 60226  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30263 /* "uri_00_error" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60227  
 60228  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30276 /* "normalize" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 60229  
 60230  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30286 /* "windowfunc" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 60231  
 60232  	{
 60233  		tcl.XTcl_LinkVar(tls, interp, ts+30297 /* "SQLITE_MAX_LENGT..." */, uintptr(unsafe.Pointer(&cv_MAX_LENGTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60234  	}
 60235  
 60236  	{
 60237  		tcl.XTcl_LinkVar(tls, interp, ts+30315 /* "SQLITE_MAX_COLUM..." */, uintptr(unsafe.Pointer(&cv_MAX_COLUMN)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60238  	}
 60239  
 60240  	{
 60241  		tcl.XTcl_LinkVar(tls, interp, ts+30333 /* "SQLITE_MAX_SQL_L..." */, uintptr(unsafe.Pointer(&cv_MAX_SQL_LENGTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60242  	}
 60243  
 60244  	{
 60245  		tcl.XTcl_LinkVar(tls, interp, ts+30355 /* "SQLITE_MAX_EXPR_..." */, uintptr(unsafe.Pointer(&cv_MAX_EXPR_DEPTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60246  	}
 60247  
 60248  	{
 60249  		tcl.XTcl_LinkVar(tls, interp, ts+30377 /* "SQLITE_MAX_COMPO..." */, uintptr(unsafe.Pointer(&cv_MAX_COMPOUND_SELECT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60250  	}
 60251  
 60252  	{
 60253  		tcl.XTcl_LinkVar(tls, interp, ts+30404 /* "SQLITE_MAX_VDBE_..." */, uintptr(unsafe.Pointer(&cv_MAX_VDBE_OP)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60254  	}
 60255  
 60256  	{
 60257  		tcl.XTcl_LinkVar(tls, interp, ts+30423 /* "SQLITE_MAX_FUNCT..." */, uintptr(unsafe.Pointer(&cv_MAX_FUNCTION_ARG)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60258  	}
 60259  
 60260  	{
 60261  		tcl.XTcl_LinkVar(tls, interp, ts+30447 /* "SQLITE_MAX_VARIA..." */, uintptr(unsafe.Pointer(&cv_MAX_VARIABLE_NUMBER)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60262  	}
 60263  
 60264  	{
 60265  		tcl.XTcl_LinkVar(tls, interp, ts+30474 /* "SQLITE_MAX_PAGE_..." */, uintptr(unsafe.Pointer(&cv_MAX_PAGE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60266  	}
 60267  
 60268  	{
 60269  		tcl.XTcl_LinkVar(tls, interp, ts+30495 /* "SQLITE_MAX_PAGE_..." */, uintptr(unsafe.Pointer(&cv_MAX_PAGE_COUNT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60270  	}
 60271  
 60272  	{
 60273  		tcl.XTcl_LinkVar(tls, interp, ts+30517 /* "SQLITE_MAX_LIKE_..." */, uintptr(unsafe.Pointer(&cv_MAX_LIKE_PATTERN_LENGTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60274  	}
 60275  
 60276  	{
 60277  		tcl.XTcl_LinkVar(tls, interp, ts+30548 /* "SQLITE_MAX_TRIGG..." */, uintptr(unsafe.Pointer(&cv_MAX_TRIGGER_DEPTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60278  	}
 60279  
 60280  	{
 60281  		tcl.XTcl_LinkVar(tls, interp, ts+30573 /* "SQLITE_DEFAULT_C..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_CACHE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60282  	}
 60283  
 60284  	{
 60285  		tcl.XTcl_LinkVar(tls, interp, ts+30599 /* "SQLITE_DEFAULT_P..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_PAGE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60286  	}
 60287  
 60288  	{
 60289  		tcl.XTcl_LinkVar(tls, interp, ts+30624 /* "SQLITE_DEFAULT_F..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_FILE_FORMAT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60290  	}
 60291  
 60292  	{
 60293  		tcl.XTcl_LinkVar(tls, interp, ts+30651 /* "SQLITE_DEFAULT_S..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_SYNCHRONOUS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60294  	}
 60295  
 60296  	{
 60297  		tcl.XTcl_LinkVar(tls, interp, ts+30678 /* "SQLITE_DEFAULT_W..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_WAL_SYNCHRONOUS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60298  	}
 60299  
 60300  	{
 60301  		tcl.XTcl_LinkVar(tls, interp, ts+30709 /* "SQLITE_MAX_ATTAC..." */, uintptr(unsafe.Pointer(&cv_MAX_ATTACHED)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60302  	}
 60303  
 60304  	{
 60305  		tcl.XTcl_LinkVar(tls, interp, ts+30729 /* "SQLITE_MAX_DEFAU..." */, uintptr(unsafe.Pointer(&cv_MAX_DEFAULT_PAGE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60306  	}
 60307  
 60308  	{
 60309  		tcl.XTcl_LinkVar(tls, interp, ts+30758 /* "SQLITE_MAX_WORKE..." */, uintptr(unsafe.Pointer(&cv_MAX_WORKER_THREADS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60310  	}
 60311  
 60312  	{
 60313  		tcl.XTcl_LinkVar(tls, interp, ts+30784 /* "TEMP_STORE" */, uintptr(unsafe.Pointer(&cv_TEMP_STORE)),
 60314  			(TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60315  
 60316  	}
 60317  
 60318  	{
 60319  		tcl.XTcl_LinkVar(tls, interp, ts+30795 /* "__GNUC__" */, uintptr(unsafe.Pointer(&cv___GNUC__)),
 60320  			(TCL_LINK_INT | TCL_LINK_READ_ONLY))
 60321  
 60322  	}
 60323  }
 60324  
 60325  var cv_MAX_LENGTH int32 = SQLITE_MAX_LENGTH                           /* test_config.c:791:3 */
 60326  var cv_MAX_COLUMN int32 = SQLITE_MAX_COLUMN                           /* test_config.c:792:3 */
 60327  var cv_MAX_SQL_LENGTH int32 = SQLITE_MAX_SQL_LENGTH                   /* test_config.c:793:3 */
 60328  var cv_MAX_EXPR_DEPTH int32 = SQLITE_MAX_EXPR_DEPTH                   /* test_config.c:794:3 */
 60329  var cv_MAX_COMPOUND_SELECT int32 = SQLITE_MAX_COMPOUND_SELECT         /* test_config.c:795:3 */
 60330  var cv_MAX_VDBE_OP int32 = SQLITE_MAX_VDBE_OP                         /* test_config.c:796:3 */
 60331  var cv_MAX_FUNCTION_ARG int32 = SQLITE_MAX_FUNCTION_ARG               /* test_config.c:797:3 */
 60332  var cv_MAX_VARIABLE_NUMBER int32 = SQLITE_MAX_VARIABLE_NUMBER         /* test_config.c:798:3 */
 60333  var cv_MAX_PAGE_SIZE int32 = SQLITE_MAX_PAGE_SIZE                     /* test_config.c:799:3 */
 60334  var cv_MAX_PAGE_COUNT int32 = SQLITE_MAX_PAGE_COUNT                   /* test_config.c:800:3 */
 60335  var cv_MAX_LIKE_PATTERN_LENGTH int32 = SQLITE_MAX_LIKE_PATTERN_LENGTH /* test_config.c:801:3 */
 60336  var cv_MAX_TRIGGER_DEPTH int32 = SQLITE_MAX_TRIGGER_DEPTH             /* test_config.c:802:3 */
 60337  var cv_DEFAULT_CACHE_SIZE int32 = -2000                               /* test_config.c:803:3 */
 60338  var cv_DEFAULT_PAGE_SIZE int32 = SQLITE_DEFAULT_PAGE_SIZE             /* test_config.c:804:3 */
 60339  var cv_DEFAULT_FILE_FORMAT int32 = SQLITE_DEFAULT_FILE_FORMAT         /* test_config.c:805:3 */
 60340  var cv_DEFAULT_SYNCHRONOUS int32 = SQLITE_DEFAULT_SYNCHRONOUS         /* test_config.c:806:3 */
 60341  var cv_DEFAULT_WAL_SYNCHRONOUS int32 = SQLITE_DEFAULT_SYNCHRONOUS     /* test_config.c:807:3 */
 60342  var cv_MAX_ATTACHED int32 = SQLITE_MAX_ATTACHED                       /* test_config.c:808:3 */
 60343  var cv_MAX_DEFAULT_PAGE_SIZE int32 = SQLITE_MAX_DEFAULT_PAGE_SIZE     /* test_config.c:809:3 */
 60344  var cv_MAX_WORKER_THREADS int32 = SQLITE_MAX_WORKER_THREADS           /* test_config.c:810:3 */
 60345  var cv_TEMP_STORE int32 = SQLITE_TEMP_STORE                           /* test_config.c:813:22 */
 60346  var cv___GNUC__ int32 = 1                                             /* test_config.c:827:22 */
 60347  
 60348  // Register commands with the TCL interpreter.
 60349  func Sqliteconfig_Init(tls *libc.TLS, interp uintptr) int32 { /* test_config.c:838:5: */
 60350  	set_options(tls, interp)
 60351  	return TCL_OK
 60352  }
 60353  
 60354  //
 60355  // END OF REGISTRATION API
 60356  //
 60357  
 60358  //******* End of fts5.h ********
 60359  
 60360  // The following #defines are copied from test_multiplex.c
 60361  
 60362  // This routine is a copy of (most of) the code from SQLite function
 60363  // sqlite3FileSuffix3(). It modifies the filename in buffer z in the
 60364  // same way as SQLite does when in 8.3 filenames mode.
 60365  func sqlite3Delete83Name(tls *libc.TLS, z uintptr) { /* test_delete.c:46:13: */
 60366  	var i int32
 60367  	var sz int32
 60368  	sz = int32(libc.Xstrlen(tls, z))
 60369  	for i = (sz - 1); ((i > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '/')) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '.'); i-- {
 60370  	}
 60371  	if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == '.') && (sz > (i + 4)) {
 60372  		libc.Xmemmove(tls, (z + uintptr((i + 1))), (z + uintptr((sz - 3))), uint64(4))
 60373  	}
 60374  }
 60375  
 60376  // zFile is a filename. Assuming no error occurs, if this file exists,
 60377  // set *pbExists to true and unlink it. Or, if the file does not exist,
 60378  // set *pbExists to false before returning.
 60379  //
 60380  // If an error occurs, non-zero is returned. Or, if no error occurs, zero.
 60381  func sqlite3DeleteUnlinkIfExists(tls *libc.TLS, pVfs uintptr, zFile uintptr, pbExists uintptr) int32 { /* test_delete.c:60:12: */
 60382  	var rc int32 = SQLITE_ERROR
 60383  
 60384  	rc = libc.Xaccess(tls, zFile, F_OK)
 60385  	if rc != 0 {
 60386  		if (*(*int32)(unsafe.Pointer(libc.X__error(tls)))) == ENOENT {
 60387  			if pbExists != 0 {
 60388  				*(*int32)(unsafe.Pointer(pbExists)) = 0
 60389  			}
 60390  			rc = SQLITE_OK
 60391  		}
 60392  	} else {
 60393  		if pbExists != 0 {
 60394  			*(*int32)(unsafe.Pointer(pbExists)) = 1
 60395  		}
 60396  		rc = libc.Xunlink(tls, zFile)
 60397  	}
 60398  	return rc
 60399  }
 60400  
 60401  // Delete the database file identified by the string argument passed to this
 60402  // function. The string must contain a filename, not an SQLite URI.
 60403  func sqlite3_delete_database(tls *libc.TLS, zFile uintptr) int32 { /* test_delete.c:95:16: */
 60404  	bp := tls.Alloc(156)
 60405  	defer tls.Free(156)
 60406  
 60407  	var zBuf uintptr // Buffer to sprintf() filenames to
 60408  	var nBuf int32   // Size of buffer in bytes
 60409  	var rc int32 = 0 // System error code
 60410  	var i int32      // Iterate through azFmt[] and aMFile[]
 60411  
 60412  	*(*[4]uintptr)(unsafe.Pointer(bp + 24 /* azFmt */)) = [4]uintptr{ts /* "%s" */, ts + 30804 /* "%s-journal" */, ts + 30815 /* "%s-wal" */, ts + 30822 /* "%s-shm" */}
 60413  
 60414  	*(*[6]MFile)(unsafe.Pointer(bp + 56 /* aMFile */)) = [6]MFile{
 60415  		{FzFmt: ts + 30829 /* "%s%03d" */},
 60416  		{FzFmt: ts + 30836 /* "%s-journal%03d" */},
 60417  		{FzFmt: ts + 30851 /* "%s-wal%03d" */},
 60418  		{FzFmt: ts + 30829 /* "%s%03d" */, Fb83: 1},
 60419  		{FzFmt: ts + 30836 /* "%s-journal%03d" */, FiOffset: SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET, Fb83: 1},
 60420  		{FzFmt: ts + 30851 /* "%s-wal%03d" */, FiOffset: SQLITE_MULTIPLEX_WAL_8_3_OFFSET, Fb83: 1},
 60421  	}
 60422  
 60423  	var pVfs uintptr = uintptr(0)
 60424  
 60425  	// Allocate a buffer large enough for any of the files that need to be
 60426  	// deleted.
 60427  	nBuf = (int32(libc.Xstrlen(tls, zFile)) + 100)
 60428  	zBuf = sqlite3.Xsqlite3_malloc(tls, nBuf)
 60429  	if zBuf == uintptr(0) {
 60430  		return SQLITE_NOMEM
 60431  	}
 60432  
 60433  	// Delete both the regular and 8.3 filenames versions of the database,
 60434  	// journal, wal and shm files.
 60435  	for i = 0; (rc == 0) && (uint64(i) < (uint64(unsafe.Sizeof([4]uintptr{})) / uint64(unsafe.Sizeof(uintptr(0))))); i++ {
 60436  		sqlite3.Xsqlite3_snprintf(tls, nBuf, zBuf, *(*uintptr)(unsafe.Pointer(bp + 24 /* &azFmt[0] */ + uintptr(i)*8)), libc.VaList(bp, zFile))
 60437  		rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, uintptr(0))
 60438  		if (rc == 0) && (i != 0) {
 60439  			sqlite3Delete83Name(tls, zBuf)
 60440  			rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, uintptr(0))
 60441  		}
 60442  	}
 60443  
 60444  	// Delete any multiplexor files
 60445  	for i = 0; (rc == 0) && (uint64(i) < (uint64(unsafe.Sizeof([6]MFile{})) / uint64(unsafe.Sizeof(MFile{})))); i++ {
 60446  		var p uintptr = (bp + 56 /* &aMFile */ + uintptr(i)*16)
 60447  		var iChunk int32
 60448  		for iChunk = 1; iChunk <= MX_CHUNK_NUMBER; iChunk++ {
 60449  			// var bExists int32 at bp+152, 4
 60450  
 60451  			sqlite3.Xsqlite3_snprintf(tls, nBuf, zBuf, (*MFile)(unsafe.Pointer(p)).FzFmt, libc.VaList(bp+8, zFile, (iChunk+(*MFile)(unsafe.Pointer(p)).FiOffset)))
 60452  			if (*MFile)(unsafe.Pointer(p)).Fb83 != 0 {
 60453  				sqlite3Delete83Name(tls, zBuf)
 60454  			}
 60455  			rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, bp+152 /* &bExists */)
 60456  			if (*(*int32)(unsafe.Pointer(bp + 152 /* bExists */)) == 0) || (rc != 0) {
 60457  				break
 60458  			}
 60459  		}
 60460  	}
 60461  
 60462  	sqlite3.Xsqlite3_free(tls, zBuf)
 60463  	return func() int32 {
 60464  		if rc != 0 {
 60465  			return SQLITE_ERROR
 60466  		}
 60467  		return SQLITE_OK
 60468  	}()
 60469  }
 60470  
 60471  type MFile = struct {
 60472  	FzFmt    uintptr
 60473  	FiOffset int32
 60474  	Fb83     int32
 60475  } /* test_delete.c:105:3 */
 60476  
 60477  // end block for C++
 60478  
 60479  // Local Variables:
 60480  // mode: c
 60481  // c-basic-offset: 4
 60482  // fill-column: 78
 60483  // End:
 60484  
 60485  func Sqlitetest_demovfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_demovfs.c:686:5: */
 60486  	return TCL_OK
 60487  }
 60488  
 60489  // Maximum pathname length supported by the devsym backend.
 60490  
 60491  // Name used to identify this VFS.
 60492  
 60493  type devsym_file1 = struct {
 60494  	Fbase  sqlite3_file
 60495  	FpReal uintptr
 60496  } /* test_devsym.c:33:9 */
 60497  
 60498  // Maximum pathname length supported by the devsym backend.
 60499  
 60500  // Name used to identify this VFS.
 60501  
 60502  type devsym_file = devsym_file1 /* test_devsym.c:33:28 */
 60503  
 60504  type DevsymGlobal = struct {
 60505  	FpVfs        uintptr
 60506  	FiDeviceChar int32
 60507  	FiSectorSize int32
 60508  	FnWriteCrash int32
 60509  	_            [4]byte
 60510  } /* test_devsym.c:76:1 */
 60511  
 60512  var g1 = DevsymGlobal{FiSectorSize: 512} /* test_devsym.c:82:21 */
 60513  
 60514  // Close an devsym-file.
 60515  func devsymClose(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:87:12: */
 60516  	var p uintptr = pFile
 60517  	sqlite3.Xsqlite3OsClose(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 60518  	return SQLITE_OK
 60519  }
 60520  
 60521  // Read data from an devsym-file.
 60522  func devsymRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:96:12: */
 60523  	var p uintptr = pFile
 60524  	return sqlite3.Xsqlite3OsRead(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 60525  }
 60526  
 60527  // Write data to an devsym-file.
 60528  func devsymWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:109:12: */
 60529  	var p uintptr = pFile
 60530  	return sqlite3.Xsqlite3OsWrite(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 60531  }
 60532  
 60533  // Truncate an devsym-file.
 60534  func devsymTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_devsym.c:122:12: */
 60535  	var p uintptr = pFile
 60536  	return sqlite3.Xsqlite3OsTruncate(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, size)
 60537  }
 60538  
 60539  // Sync an devsym-file.
 60540  func devsymSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_devsym.c:130:12: */
 60541  	var p uintptr = pFile
 60542  	return sqlite3.Xsqlite3OsSync(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags)
 60543  }
 60544  
 60545  // Return the current file-size of an devsym-file.
 60546  func devsymFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_devsym.c:138:12: */
 60547  	var p uintptr = pFile
 60548  	return sqlite3.Xsqlite3OsFileSize(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, pSize)
 60549  }
 60550  
 60551  // Lock an devsym-file.
 60552  func devsymLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_devsym.c:146:12: */
 60553  	var p uintptr = pFile
 60554  	return sqlite3.Xsqlite3OsLock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, eLock)
 60555  }
 60556  
 60557  // Unlock an devsym-file.
 60558  func devsymUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_devsym.c:154:12: */
 60559  	var p uintptr = pFile
 60560  	return sqlite3.Xsqlite3OsUnlock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, eLock)
 60561  }
 60562  
 60563  // Check if another file-handle holds a RESERVED lock on an devsym-file.
 60564  func devsymCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_devsym.c:162:12: */
 60565  	var p uintptr = pFile
 60566  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, pResOut)
 60567  }
 60568  
 60569  // File control method. For custom operations on an devsym-file.
 60570  func devsymFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_devsym.c:170:12: */
 60571  	var p uintptr = pFile
 60572  	return sqlite3.Xsqlite3OsFileControl(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, op, pArg)
 60573  }
 60574  
 60575  // Return the sector-size in bytes for an devsym-file.
 60576  func devsymSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:178:12: */
 60577  	return g1.FiSectorSize
 60578  }
 60579  
 60580  // Return the device characteristic flags supported by an devsym-file.
 60581  func devsymDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:185:12: */
 60582  	return g1.FiDeviceChar
 60583  }
 60584  
 60585  // Shared-memory methods are all pass-thrus.
 60586  func devsymShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_devsym.c:192:12: */
 60587  	var p uintptr = pFile
 60588  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 112 /* &.xShmLock */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, ofst, n, flags)
 60589  }
 60590  
 60591  func devsymShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, isWrite int32, pp uintptr) int32 { /* test_devsym.c:196:12: */
 60592  	var p uintptr = pFile
 60593  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 104 /* &.xShmMap */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, libc.AtomicLoadUintptr(&pp))
 60594  }
 60595  
 60596  func devsymShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_devsym.c:206:13: */
 60597  	var p uintptr = pFile
 60598  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 120 /* &.xShmBarrier */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 60599  }
 60600  
 60601  func devsymShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) int32 { /* test_devsym.c:210:12: */
 60602  	var p uintptr = pFile
 60603  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, delFlag)
 60604  }
 60605  
 60606  // Open an devsym file handle.
 60607  func devsymOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_devsym.c:220:12: */
 60608  	var rc int32
 60609  	var p uintptr = pFile
 60610  	(*devsym_file)(unsafe.Pointer(p)).FpReal = (p + 1*16)
 60611  	rc = sqlite3.Xsqlite3OsOpen(tls, g1.FpVfs, zName, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 60612  	if (*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 60613  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&devsym_io_methods))
 60614  	}
 60615  	return rc
 60616  }
 60617  
 60618  var devsym_io_methods = sqlite3_io_methods{
 60619  	FiVersion:               2, // iVersion
 60620  	FxClose:                 0, // xClose
 60621  	FxRead:                  0, // xRead
 60622  	FxWrite:                 0, // xWrite
 60623  	FxTruncate:              0, // xTruncate
 60624  	FxSync:                  0, // xSync
 60625  	FxFileSize:              0, // xFileSize
 60626  	FxLock:                  0, // xLock
 60627  	FxUnlock:                0, // xUnlock
 60628  	FxCheckReservedLock:     0, // xCheckReservedLock
 60629  	FxFileControl:           0, // xFileControl
 60630  	FxSectorSize:            0, // xSectorSize
 60631  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 60632  	FxShmMap:                0, // xShmMap
 60633  	FxShmLock:               0, // xShmLock
 60634  	FxShmBarrier:            0, // xShmBarrier
 60635  	FxShmUnmap:              0, // xShmUnmap
 60636  } /* test_devsym.c:227:27 */
 60637  
 60638  // Delete the file located at zPath. If the dirSync argument is true,
 60639  // ensure the file-system modifications are synced to disk before
 60640  // returning.
 60641  func devsymDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_devsym.c:262:12: */
 60642  	return sqlite3.Xsqlite3OsDelete(tls, g1.FpVfs, zPath, dirSync)
 60643  }
 60644  
 60645  // Test for access permissions. Return true if the requested permission
 60646  // is available, or false otherwise.
 60647  func devsymAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_devsym.c:270:12: */
 60648  	return sqlite3.Xsqlite3OsAccess(tls, g1.FpVfs, zPath, flags, pResOut)
 60649  }
 60650  
 60651  // Populate buffer zOut with the full canonical pathname corresponding
 60652  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 60653  // of at least (DEVSYM_MAX_PATHNAME+1) bytes.
 60654  func devsymFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_devsym.c:284:12: */
 60655  	return sqlite3.Xsqlite3OsFullPathname(tls, g1.FpVfs, zPath, nOut, zOut)
 60656  }
 60657  
 60658  // Populate the buffer pointed to by zBufOut with nByte bytes of
 60659  // random data.
 60660  func devsymRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_devsym.c:329:12: */
 60661  	return sqlite3.Xsqlite3OsRandomness(tls, g1.FpVfs, nByte, zBufOut)
 60662  }
 60663  
 60664  // Sleep for nMicro microseconds. Return the number of microseconds
 60665  // actually slept.
 60666  func devsymSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_devsym.c:337:12: */
 60667  	return sqlite3.Xsqlite3OsSleep(tls, g1.FpVfs, nMicro)
 60668  }
 60669  
 60670  // Return the current time as a Julian Day number in *pTimeOut.
 60671  func devsymCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_devsym.c:344:12: */
 60672  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g1.FpVfs + 120 /* &.xCurrentTime */))))(tls, g1.FpVfs, pTimeOut)
 60673  }
 60674  
 60675  // Return the sector-size in bytes for an writecrash-file.
 60676  func writecrashSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:351:12: */
 60677  	var p uintptr = pFile
 60678  	return sqlite3.Xsqlite3OsSectorSize(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 60679  }
 60680  
 60681  // Return the device characteristic flags supported by an writecrash-file.
 60682  func writecrashDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:359:12: */
 60683  	var p uintptr = pFile
 60684  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 60685  }
 60686  
 60687  // Write data to an writecrash-file.
 60688  func writecrashWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:367:12: */
 60689  	var p uintptr = pFile
 60690  	if g1.FnWriteCrash > 0 {
 60691  		g1.FnWriteCrash--
 60692  		if g1.FnWriteCrash == 0 {
 60693  			libc.Xabort(tls)
 60694  		}
 60695  	}
 60696  	return sqlite3.Xsqlite3OsWrite(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 60697  }
 60698  
 60699  // Open an writecrash file handle.
 60700  func writecrashOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_devsym.c:384:12: */
 60701  	var rc int32
 60702  	var p uintptr = pFile
 60703  	(*devsym_file)(unsafe.Pointer(p)).FpReal = (p + 1*16)
 60704  	rc = sqlite3.Xsqlite3OsOpen(tls, g1.FpVfs, zName, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 60705  	if (*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 60706  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&writecrash_io_methods))
 60707  	}
 60708  	return rc
 60709  }
 60710  
 60711  var writecrash_io_methods = sqlite3_io_methods{
 60712  	FiVersion:               2, // iVersion
 60713  	FxClose:                 0, // xClose
 60714  	FxRead:                  0, // xRead
 60715  	FxWrite:                 0, // xWrite
 60716  	FxTruncate:              0, // xTruncate
 60717  	FxSync:                  0, // xSync
 60718  	FxFileSize:              0, // xFileSize
 60719  	FxLock:                  0, // xLock
 60720  	FxUnlock:                0, // xUnlock
 60721  	FxCheckReservedLock:     0, // xCheckReservedLock
 60722  	FxFileControl:           0, // xFileControl
 60723  	FxSectorSize:            0, // xSectorSize
 60724  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 60725  	FxShmMap:                0, // xShmMap
 60726  	FxShmLock:               0, // xShmLock
 60727  	FxShmBarrier:            0, // xShmBarrier
 60728  	FxShmUnmap:              0, // xShmUnmap
 60729  } /* test_devsym.c:391:27 */
 60730  
 60731  var devsym_vfs = sqlite3_vfs{
 60732  	FiVersion:      2,                                   // iVersion
 60733  	FszOsFile:      int32(unsafe.Sizeof(devsym_file{})), // szOsFile
 60734  	FmxPathname:    DEVSYM_MAX_PATHNAME,                 // pNext
 60735  	FzName:         ts + 30862,                          /* "devsym" */ // pAppData
 60736  	FxOpen:         0,                                   // xOpen
 60737  	FxDelete:       0,                                   // xDelete
 60738  	FxAccess:       0,                                   // xAccess
 60739  	FxFullPathname: 0,                                   // xDlClose
 60740  	FxRandomness:   0,                                   // xRandomness
 60741  	FxSleep:        0,                                   // xSleep
 60742  	FxCurrentTime:  0,                                   // xCurrentTimeInt64
 60743  } /* test_devsym.c:421:20 */
 60744  
 60745  var writecrash_vfs = sqlite3_vfs{
 60746  	FiVersion:      2,                                   // iVersion
 60747  	FszOsFile:      int32(unsafe.Sizeof(devsym_file{})), // szOsFile
 60748  	FmxPathname:    DEVSYM_MAX_PATHNAME,                 // pNext
 60749  	FzName:         ts + 30869,                          /* "writecrash" */ // pAppData
 60750  	FxOpen:         0,                                   // xOpen
 60751  	FxDelete:       0,                                   // xDelete
 60752  	FxAccess:       0,                                   // xAccess
 60753  	FxFullPathname: 0,                                   // xDlClose
 60754  	FxRandomness:   0,                                   // xRandomness
 60755  	FxSleep:        0,                                   // xSleep
 60756  	FxCurrentTime:  0,                                   // xCurrentTimeInt64
 60757  } /* test_devsym.c:450:20 */
 60758  
 60759  // This procedure registers the devsym vfs with SQLite. If the argument is
 60760  // true, the devsym vfs becomes the new default vfs. It is the only publicly
 60761  // available function in this file.
 60762  func devsym_register(tls *libc.TLS, iDeviceChar int32, iSectorSize int32) { /* test_devsym.c:485:6: */
 60763  
 60764  	if g1.FpVfs == uintptr(0) {
 60765  		g1.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 60766  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 60767  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 60768  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&devsym_vfs)), 0)
 60769  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&writecrash_vfs)), 0)
 60770  	}
 60771  	if iDeviceChar >= 0 {
 60772  		g1.FiDeviceChar = iDeviceChar
 60773  	} else {
 60774  		g1.FiDeviceChar = 0
 60775  	}
 60776  	if iSectorSize >= 0 {
 60777  		g1.FiSectorSize = iSectorSize
 60778  	} else {
 60779  		g1.FiSectorSize = 512
 60780  	}
 60781  }
 60782  
 60783  func devsym_unregister(tls *libc.TLS) { /* test_devsym.c:506:6: */
 60784  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&devsym_vfs)))
 60785  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&writecrash_vfs)))
 60786  	g1.FpVfs = uintptr(0)
 60787  	g1.FiDeviceChar = 0
 60788  	g1.FiSectorSize = 0
 60789  }
 60790  
 60791  func devsym_crash_on_write(tls *libc.TLS, nWrite int32) { /* test_devsym.c:514:6: */
 60792  	if g1.FpVfs == uintptr(0) {
 60793  		g1.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 60794  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 60795  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 60796  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&devsym_vfs)), 0)
 60797  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&writecrash_vfs)), 0)
 60798  	}
 60799  	g1.FnWriteCrash = nWrite
 60800  }
 60801  
 60802  // The next short section of defines are only done when not running on Windows
 60803  // or some other strange platform.
 60804  
 60805  type Tcl_StatBuf = stat /* tcl.h:470:25 */
 60806  
 60807  type fs_vtab1 = struct {
 60808  	Fbase sqlite3_vtab
 60809  	Fdb   uintptr
 60810  	FzDb  uintptr
 60811  	FzTbl uintptr
 60812  } /* test_fs.c:96:9 */
 60813  
 60814  type fs_vtab = fs_vtab1 /* test_fs.c:96:24 */
 60815  type fs_cursor1 = struct {
 60816  	Fbase   sqlite3_vtab_cursor
 60817  	FpStmt  uintptr
 60818  	FzBuf   uintptr
 60819  	FnBuf   int32
 60820  	FnAlloc int32
 60821  } /* test_fs.c:97:9 */
 60822  
 60823  type fs_cursor = fs_cursor1 /* test_fs.c:97:26 */
 60824  
 60825  // ************************************************************************
 60826  //
 60827  // Start of fsdir implementation.
 60828  type FsdirVtab1 = struct{ Fbase sqlite3_vtab } /* test_fs.c:121:9 */
 60829  
 60830  // ************************************************************************
 60831  //
 60832  // Start of fsdir implementation.
 60833  type FsdirVtab = FsdirVtab1 /* test_fs.c:121:26 */
 60834  type FsdirCsr1 = struct {
 60835  	Fbase   sqlite3_vtab_cursor
 60836  	FzDir   uintptr
 60837  	FpDir   uintptr
 60838  	FiRowid sqlite3_int64
 60839  	FpEntry uintptr
 60840  } /* test_fs.c:122:9 */
 60841  
 60842  type FsdirCsr = FsdirCsr1 /* test_fs.c:122:25 */
 60843  
 60844  // This function is the implementation of both the xConnect and xCreate
 60845  // methods of the fsdir virtual table.
 60846  //
 60847  // The argv[] array contains the following:
 60848  //
 60849  //   argv[0]   -> module name  ("fs")
 60850  //   argv[1]   -> database name
 60851  //   argv[2]   -> table name
 60852  //   argv[...] -> other module argument fields.
 60853  func fsdirConnect1(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:146:12: */
 60854  	var pTab uintptr
 60855  
 60856  	if argc != 3 {
 60857  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 60858  		return SQLITE_ERROR
 60859  	}
 60860  
 60861  	pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FsdirVtab{})))
 60862  	if !(pTab != 0) {
 60863  		return SQLITE_NOMEM
 60864  	}
 60865  	libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(FsdirVtab{})))
 60866  
 60867  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 60868  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+30880 /* "CREATE TABLE xyz..." */)
 60869  
 60870  	return SQLITE_OK
 60871  }
 60872  
 60873  // xDestroy/xDisconnect implementation.
 60874  func fsdirDisconnect1(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:173:12: */
 60875  	sqlite3.Xsqlite3_free(tls, pVtab)
 60876  	return SQLITE_OK
 60877  }
 60878  
 60879  // xBestIndex implementation. The only constraint supported is:
 60880  //
 60881  //   (dir = ?)
 60882  func fsdirBestIndex1(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:183:12: */
 60883  	var ii int32
 60884  
 60885  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000000000.0
 60886  
 60887  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 60888  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 60889  		if (((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0)) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 60890  			var pUsage uintptr
 60891  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 60892  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 60893  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 60894  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 60895  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1.0
 60896  			break
 60897  		}
 60898  	}
 60899  
 60900  	return SQLITE_OK
 60901  }
 60902  
 60903  // xOpen implementation.
 60904  //
 60905  // Open a new fsdir cursor.
 60906  func fsdirOpen1(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:209:12: */
 60907  	var pCur uintptr
 60908  	// Allocate an extra 256 bytes because it is undefined how big dirent.d_name
 60909  	// is and we need enough space.  Linux provides plenty already, but
 60910  	// Solaris only provides one byte.
 60911  	pCur = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(FsdirCsr{})) + uint64(256))))
 60912  	if pCur == uintptr(0) {
 60913  		return SQLITE_NOMEM
 60914  	}
 60915  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(FsdirCsr{})))
 60916  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 60917  	return SQLITE_OK
 60918  }
 60919  
 60920  // Close a fsdir cursor.
 60921  func fsdirClose1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:224:12: */
 60922  	var pCur uintptr = cur
 60923  	if (*FsdirCsr)(unsafe.Pointer(pCur)).FpDir != 0 {
 60924  		libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCur)).FpDir)
 60925  	}
 60926  	sqlite3.Xsqlite3_free(tls, (*FsdirCsr)(unsafe.Pointer(pCur)).FzDir)
 60927  	sqlite3.Xsqlite3_free(tls, pCur)
 60928  	return SQLITE_OK
 60929  }
 60930  
 60931  // Skip the cursor to the next entry.
 60932  func fsdirNext1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:235:12: */
 60933  	var pCsr uintptr = cur
 60934  
 60935  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir != 0 {
 60936  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry = libc.Xreaddir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 60937  		if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry == uintptr(0) {
 60938  			libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 60939  			(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = uintptr(0)
 60940  		}
 60941  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid++
 60942  	}
 60943  
 60944  	return SQLITE_OK
 60945  }
 60946  
 60947  // xFilter method implementation.
 60948  func fsdirFilter1(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:253:12: */
 60949  	var pCsr uintptr = pVtabCursor
 60950  	var zDir uintptr
 60951  	var nDir int32
 60952  
 60953  	if (idxNum != 1) || (argc != 1) {
 60954  		return SQLITE_ERROR
 60955  	}
 60956  
 60957  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid = int64(0)
 60958  	sqlite3.Xsqlite3_free(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir)
 60959  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir != 0 {
 60960  		libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 60961  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = uintptr(0)
 60962  	}
 60963  
 60964  	zDir = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 60965  	nDir = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 60966  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir = sqlite3.Xsqlite3_malloc(tls, (nDir + 1))
 60967  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir == uintptr(0) {
 60968  		return SQLITE_NOMEM
 60969  	}
 60970  	libc.Xmemcpy(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir, zDir, (uint64(nDir + 1)))
 60971  
 60972  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = libc.Xopendir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir)
 60973  	return fsdirNext1(tls, pVtabCursor)
 60974  }
 60975  
 60976  // xEof method implementation.
 60977  func fsdirEof1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:287:12: */
 60978  	var pCsr uintptr = cur
 60979  	return (libc.Bool32((*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir == uintptr(0)))
 60980  }
 60981  
 60982  // xColumn method implementation.
 60983  func fsdirColumn1(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:295:12: */
 60984  	var pCsr uintptr = cur
 60985  	switch i {
 60986  	case 0: // dir
 60987  		sqlite3.Xsqlite3_result_text(tls, ctx, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir, -1, uintptr(0))
 60988  		break
 60989  
 60990  	case 1: // name
 60991  		sqlite3.Xsqlite3_result_text(tls, ctx, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry+24 /* &.d_name */, -1, libc.UintptrFromInt32(-1))
 60992  		break
 60993  
 60994  	default:
 60995  
 60996  	}
 60997  
 60998  	return SQLITE_OK
 60999  }
 61000  
 61001  // xRowid method implementation.
 61002  func fsdirRowid1(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:316:12: */
 61003  	var pCsr uintptr = cur
 61004  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid
 61005  	return SQLITE_OK
 61006  }
 61007  
 61008  //
 61009  // End of fsdir implementation.
 61010  //
 61011  
 61012  // ************************************************************************
 61013  //
 61014  // Start of fstree implementation.
 61015  type FstreeVtab1 = struct {
 61016  	Fbase sqlite3_vtab
 61017  	Fdb   uintptr
 61018  } /* test_fs.c:328:9 */
 61019  
 61020  //
 61021  // End of fsdir implementation.
 61022  //
 61023  
 61024  // ************************************************************************
 61025  //
 61026  // Start of fstree implementation.
 61027  type FstreeVtab = FstreeVtab1 /* test_fs.c:328:27 */
 61028  type FstreeCsr1 = struct {
 61029  	Fbase  sqlite3_vtab_cursor
 61030  	FpStmt uintptr
 61031  	Ffd    int32
 61032  	_      [4]byte
 61033  } /* test_fs.c:329:9 */
 61034  
 61035  type FstreeCsr = FstreeCsr1 /* test_fs.c:329:26 */
 61036  
 61037  // This function is the implementation of both the xConnect and xCreate
 61038  // methods of the fstree virtual table.
 61039  //
 61040  // The argv[] array contains the following:
 61041  //
 61042  //   argv[0]   -> module name  ("fs")
 61043  //   argv[1]   -> database name
 61044  //   argv[2]   -> table name
 61045  //   argv[...] -> other module argument fields.
 61046  func fstreeConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:352:12: */
 61047  	var pTab uintptr
 61048  
 61049  	if argc != 3 {
 61050  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 61051  		return SQLITE_ERROR
 61052  	}
 61053  
 61054  	pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FstreeVtab{})))
 61055  	if !(pTab != 0) {
 61056  		return SQLITE_NOMEM
 61057  	}
 61058  	libc.Xmemset(tls, pTab, 0, uint64(unsafe.Sizeof(FstreeVtab{})))
 61059  	(*FstreeVtab)(unsafe.Pointer(pTab)).Fdb = db
 61060  
 61061  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 61062  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+30909 /* "CREATE TABLE xyz..." */)
 61063  
 61064  	return SQLITE_OK
 61065  }
 61066  
 61067  // xDestroy/xDisconnect implementation.
 61068  func fstreeDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:380:12: */
 61069  	sqlite3.Xsqlite3_free(tls, pVtab)
 61070  	return SQLITE_OK
 61071  }
 61072  
 61073  // xBestIndex implementation. The only constraint supported is:
 61074  //
 61075  //   (dir = ?)
 61076  func fstreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:390:12: */
 61077  	var ii int32
 61078  
 61079  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 61080  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 61081  		if (((*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn == 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable != 0)) && (((int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_GLOB) ||
 61082  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_LIKE)) ||
 61083  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ)) {
 61084  			var pUsage uintptr
 61085  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 61086  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop)
 61087  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 61088  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 100000.0
 61089  			return SQLITE_OK
 61090  		}
 61091  	}
 61092  
 61093  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000000000.0
 61094  	return SQLITE_OK
 61095  }
 61096  
 61097  // xOpen implementation.
 61098  //
 61099  // Open a new fstree cursor.
 61100  func fstreeOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:418:12: */
 61101  	var pCur uintptr
 61102  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FstreeCsr{})))
 61103  	if pCur == uintptr(0) {
 61104  		return SQLITE_NOMEM
 61105  	}
 61106  	libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(FstreeCsr{})))
 61107  	(*FstreeCsr)(unsafe.Pointer(pCur)).Ffd = -1
 61108  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 61109  	return SQLITE_OK
 61110  }
 61111  
 61112  func fstreeCloseFd(tls *libc.TLS, pCsr uintptr) { /* test_fs.c:428:13: */
 61113  	if (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd >= 0 {
 61114  		libc.Xclose(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd)
 61115  		(*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd = -1
 61116  	}
 61117  }
 61118  
 61119  // Close a fstree cursor.
 61120  func fstreeClose(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:438:12: */
 61121  	var pCsr uintptr = cur
 61122  	sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 61123  	fstreeCloseFd(tls, pCsr)
 61124  	sqlite3.Xsqlite3_free(tls, pCsr)
 61125  	return SQLITE_OK
 61126  }
 61127  
 61128  // Skip the cursor to the next entry.
 61129  func fstreeNext(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:449:12: */
 61130  	var pCsr uintptr = cur
 61131  	var rc int32
 61132  
 61133  	fstreeCloseFd(tls, pCsr)
 61134  	rc = sqlite3.Xsqlite3_step(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 61135  	if rc != SQLITE_ROW {
 61136  		rc = sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 61137  		(*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 61138  	} else {
 61139  		rc = SQLITE_OK
 61140  		(*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd = libc.Xopen(tls, sqlite3.Xsqlite3_column_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 0), O_RDONLY, 0)
 61141  	}
 61142  
 61143  	return rc
 61144  }
 61145  
 61146  // xFilter method implementation.
 61147  func fstreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:469:12: */
 61148  	bp := tls.Alloc(2)
 61149  	defer tls.Free(2)
 61150  
 61151  	var pCsr uintptr = pVtabCursor
 61152  	var pTab uintptr = (*FstreeCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 61153  	var rc int32
 61154  	var zSql uintptr = ts + 30945 /* "WITH r(d) AS (  ..." */
 61155  	var zRoot uintptr
 61156  	var nRoot int32
 61157  	var zPrefix uintptr
 61158  	var nPrefix int32
 61159  	var zDir uintptr
 61160  	var nDir int32
 61161  	*(*[2]int8)(unsafe.Pointer(bp /* aWild */)) = [2]int8{int8(0), int8(0)}
 61162  
 61163  	zRoot = ts + 31177 /* "/" */
 61164  	nRoot = 1
 61165  	zPrefix = ts + 489 /* "" */
 61166  	nPrefix = 0
 61167  
 61168  	zDir = zRoot
 61169  	nDir = nRoot
 61170  
 61171  	fstreeCloseFd(tls, pCsr)
 61172  	sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 61173  	(*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 61174  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*FstreeVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 8 /* &.pStmt */), uintptr(0))
 61175  	if rc != SQLITE_OK {
 61176  		return rc
 61177  	}
 61178  
 61179  	if idxNum != 0 {
 61180  		var zQuery uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61181  		switch idxNum {
 61182  		case SQLITE_INDEX_CONSTRAINT_GLOB:
 61183  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */)) = int8('*')
 61184  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */ + 1)) = int8('?')
 61185  			break
 61186  			fallthrough
 61187  		case SQLITE_INDEX_CONSTRAINT_LIKE:
 61188  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */)) = int8('_')
 61189  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */ + 1)) = int8('%')
 61190  			break
 61191  		}
 61192  
 61193  		if sqlite3.Xsqlite3_strnicmp(tls, zQuery, zPrefix, nPrefix) == 0 {
 61194  			var i int32
 61195  			for i = nPrefix; *(*int8)(unsafe.Pointer(zQuery + uintptr(i))) != 0; i++ {
 61196  				if (int32(*(*int8)(unsafe.Pointer(zQuery + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aWild[0] */)))) || (int32(*(*int8)(unsafe.Pointer(zQuery + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp /* &aWild[0] */ + 1)))) {
 61197  					break
 61198  				}
 61199  				if int32(*(*int8)(unsafe.Pointer(zQuery + uintptr(i)))) == '/' {
 61200  					nDir = i
 61201  				}
 61202  			}
 61203  			zDir = zQuery
 61204  		}
 61205  	}
 61206  	if nDir == 0 {
 61207  		nDir = 1
 61208  	}
 61209  
 61210  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 1, zDir, nDir, libc.UintptrFromInt32(-1))
 61211  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 2, zRoot, nRoot, libc.UintptrFromInt32(-1))
 61212  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 3, zPrefix, nPrefix, libc.UintptrFromInt32(-1))
 61213  
 61214  	return fstreeNext(tls, pVtabCursor)
 61215  }
 61216  
 61217  // xEof method implementation.
 61218  func fstreeEof(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:557:12: */
 61219  	var pCsr uintptr = cur
 61220  	return (libc.Bool32((*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 61221  }
 61222  
 61223  // xColumn method implementation.
 61224  func fstreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:565:12: */
 61225  	bp := tls.Alloc(224)
 61226  	defer tls.Free(224)
 61227  
 61228  	var pCsr uintptr = cur
 61229  	if i == 0 { // path
 61230  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 0))
 61231  	} else {
 61232  		// var sBuf stat at bp, 224
 61233  
 61234  		libc.Xfstat(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd, bp /* &sBuf */)
 61235  
 61236  		if ((int32((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode)) & 0170000) == 0100000 {
 61237  			if i == 1 {
 61238  				sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_size))
 61239  			} else {
 61240  				var nRead int32
 61241  				var aBuf uintptr = sqlite3.Xsqlite3_malloc(tls, (int32((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode) + 1))
 61242  				if !(aBuf != 0) {
 61243  					return SQLITE_NOMEM
 61244  				}
 61245  				nRead = int32(libc.Xread(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd, aBuf, uint64((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode)))
 61246  				if nRead != int32((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode) {
 61247  					return SQLITE_IOERR
 61248  				}
 61249  				sqlite3.Xsqlite3_result_blob(tls, ctx, aBuf, nRead, libc.UintptrFromInt32(-1))
 61250  				sqlite3.Xsqlite3_free(tls, aBuf)
 61251  			}
 61252  		}
 61253  	}
 61254  
 61255  	return SQLITE_OK
 61256  }
 61257  
 61258  // xRowid method implementation.
 61259  func fstreeRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:596:12: */
 61260  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
 61261  	return SQLITE_OK
 61262  }
 61263  
 61264  //
 61265  // End of fstree implementation.
 61266  //
 61267  
 61268  // This function is the implementation of both the xConnect and xCreate
 61269  // methods of the fs virtual table.
 61270  //
 61271  // The argv[] array contains the following:
 61272  //
 61273  //   argv[0]   -> module name  ("fs")
 61274  //   argv[1]   -> database name
 61275  //   argv[2]   -> table name
 61276  //   argv[...] -> other module argument fields.
 61277  func fsConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:618:12: */
 61278  	var pVtab uintptr
 61279  	var nByte int32
 61280  	var zTbl uintptr
 61281  	var zDb uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*8))
 61282  
 61283  	if argc != 4 {
 61284  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 61285  		return SQLITE_ERROR
 61286  	}
 61287  	zTbl = *(*uintptr)(unsafe.Pointer(argv + 3*8))
 61288  
 61289  	nByte = (int32((((uint64(unsafe.Sizeof(fs_vtab{})) + uint64(int32(libc.Xstrlen(tls, zTbl)))) + uint64(1)) + uint64(int32(libc.Xstrlen(tls, zDb)))) + uint64(1)))
 61290  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(nByte))
 61291  	if !(pVtab != 0) {
 61292  		return SQLITE_NOMEM
 61293  	}
 61294  
 61295  	(*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl = (pVtab + 1*48)
 61296  	(*fs_vtab)(unsafe.Pointer(pVtab)).FzDb = ((*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl + uintptr((libc.Xstrlen(tls, zTbl) + uint64(1))))
 61297  	(*fs_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 61298  	libc.Xmemcpy(tls, (*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl, zTbl, libc.Xstrlen(tls, zTbl))
 61299  	libc.Xmemcpy(tls, (*fs_vtab)(unsafe.Pointer(pVtab)).FzDb, zDb, libc.Xstrlen(tls, zDb))
 61300  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 61301  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+31179 /* "CREATE TABLE x(p..." */)
 61302  
 61303  	return SQLITE_OK
 61304  }
 61305  
 61306  // Note that for this virtual table, the xCreate and xConnect
 61307  // methods are identical.
 61308  
 61309  func fsDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:653:12: */
 61310  	sqlite3.Xsqlite3_free(tls, pVtab)
 61311  	return SQLITE_OK
 61312  }
 61313  
 61314  // The xDisconnect and xDestroy methods are also the same
 61315  
 61316  // Open a new fs cursor.
 61317  func fsOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:662:12: */
 61318  	var pCur uintptr
 61319  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(fs_cursor{})))
 61320  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 61321  	return SQLITE_OK
 61322  }
 61323  
 61324  // Close a fs cursor.
 61325  func fsClose(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:672:12: */
 61326  	var pCur uintptr = cur
 61327  	sqlite3.Xsqlite3_finalize(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt)
 61328  	sqlite3.Xsqlite3_free(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf)
 61329  	sqlite3.Xsqlite3_free(tls, pCur)
 61330  	return SQLITE_OK
 61331  }
 61332  
 61333  func fsNext(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:680:12: */
 61334  	var pCur uintptr = cur
 61335  	var rc int32
 61336  
 61337  	rc = sqlite3.Xsqlite3_step(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt)
 61338  	if (rc == SQLITE_ROW) || (rc == SQLITE_DONE) {
 61339  		rc = SQLITE_OK
 61340  	}
 61341  
 61342  	return rc
 61343  }
 61344  
 61345  func fsFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:690:12: */
 61346  	bp := tls.Alloc(32)
 61347  	defer tls.Free(32)
 61348  
 61349  	var rc int32
 61350  	var pCur uintptr = pVtabCursor
 61351  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 61352  
 61353  	if idxNum == 1 {
 61354  		var zStmt uintptr = sqlite3.Xsqlite3_mprintf(tls,
 61355  			ts+31216 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*fs_vtab)(unsafe.Pointer(p)).FzDb, (*fs_vtab)(unsafe.Pointer(p)).FzTbl))
 61356  		if !(zStmt != 0) {
 61357  			return SQLITE_NOMEM
 61358  		}
 61359  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*fs_vtab)(unsafe.Pointer(p)).Fdb, zStmt, -1, (pCur + 8 /* &.pStmt */), uintptr(0))
 61360  		sqlite3.Xsqlite3_free(tls, zStmt)
 61361  		if rc == SQLITE_OK {
 61362  			sqlite3.Xsqlite3_bind_value(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 1, *(*uintptr)(unsafe.Pointer(argv)))
 61363  		}
 61364  	} else {
 61365  		var zStmt uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+3268 /* "SELECT * FROM %Q..." */, libc.VaList(bp+16, (*fs_vtab)(unsafe.Pointer(p)).FzDb, (*fs_vtab)(unsafe.Pointer(p)).FzTbl))
 61366  		if !(zStmt != 0) {
 61367  			return SQLITE_NOMEM
 61368  		}
 61369  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*fs_vtab)(unsafe.Pointer(p)).Fdb, zStmt, -1, (pCur + 8 /* &.pStmt */), uintptr(0))
 61370  		sqlite3.Xsqlite3_free(tls, zStmt)
 61371  	}
 61372  
 61373  	if rc == SQLITE_OK {
 61374  		rc = fsNext(tls, pVtabCursor)
 61375  	}
 61376  	return rc
 61377  }
 61378  
 61379  func fsColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:722:12: */
 61380  	bp := tls.Alloc(224)
 61381  	defer tls.Free(224)
 61382  
 61383  	var pCur uintptr = cur
 61384  
 61385  	if i == 0 {
 61386  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 0))
 61387  	} else {
 61388  		var zFile uintptr = sqlite3.Xsqlite3_column_text(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 1)
 61389  		// var sbuf stat at bp, 224
 61390  
 61391  		var fd int32
 61392  		var n int32
 61393  		fd = libc.Xopen(tls, zFile, O_RDONLY, 0)
 61394  		if fd < 0 {
 61395  			return SQLITE_IOERR
 61396  		}
 61397  		libc.Xfstat(tls, fd, bp /* &sbuf */)
 61398  
 61399  		if (*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size >= off_t((*fs_cursor)(unsafe.Pointer(pCur)).FnAlloc) {
 61400  			var nNew sqlite3_int64 = (sqlite3_int64((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size * int64(2)))
 61401  			var zNew uintptr
 61402  			if nNew < int64(1024) {
 61403  				nNew = int64(1024)
 61404  			}
 61405  
 61406  			zNew = sqlite3.Xsqlite3Realloc(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, uint64(nNew))
 61407  			if zNew == uintptr(0) {
 61408  				libc.Xclose(tls, fd)
 61409  				return SQLITE_NOMEM
 61410  			}
 61411  			(*fs_cursor)(unsafe.Pointer(pCur)).FzBuf = zNew
 61412  			(*fs_cursor)(unsafe.Pointer(pCur)).FnAlloc = int32(nNew)
 61413  		}
 61414  
 61415  		n = int32(libc.Xread(tls, fd, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, uint64((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size)))
 61416  		libc.Xclose(tls, fd)
 61417  		if off_t(n) != (*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size {
 61418  			return SQLITE_ERROR
 61419  		}
 61420  		(*fs_cursor)(unsafe.Pointer(pCur)).FnBuf = int32((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size)
 61421  		*(*int8)(unsafe.Pointer((*fs_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr((*fs_cursor)(unsafe.Pointer(pCur)).FnBuf))) = int8(0)
 61422  
 61423  		sqlite3.Xsqlite3_result_text(tls, ctx, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, -1, libc.UintptrFromInt32(-1))
 61424  	}
 61425  	return SQLITE_OK
 61426  }
 61427  
 61428  func fsRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:763:12: */
 61429  	var pCur uintptr = cur
 61430  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 0)
 61431  	return SQLITE_OK
 61432  }
 61433  
 61434  func fsEof(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:769:12: */
 61435  	var pCur uintptr = cur
 61436  	return (libc.Bool32(sqlite3.Xsqlite3_data_count(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt) == 0))
 61437  }
 61438  
 61439  func fsBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:774:12: */
 61440  	var ii int32
 61441  
 61442  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 61443  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 61444  		if (((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn < 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0)) &&
 61445  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 61446  			var pUsage uintptr
 61447  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 61448  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(0)
 61449  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 61450  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 61451  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1.0
 61452  			break
 61453  		}
 61454  	}
 61455  
 61456  	return SQLITE_OK
 61457  }
 61458  
 61459  // A virtual table module that provides read-only access to a
 61460  // Tcl global variable namespace.
 61461  var fsModule = sqlite3_module{ // iVersion
 61462  	FxCreate:     0,
 61463  	FxConnect:    0,
 61464  	FxBestIndex:  0,
 61465  	FxDisconnect: 0,
 61466  	FxDestroy:    0,
 61467  	FxOpen:       0, // xOpen - open a cursor
 61468  	FxClose:      0, // xClose - close a cursor
 61469  	FxFilter:     0, // xFilter - configure scan constraints
 61470  	FxNext:       0, // xNext - advance a cursor
 61471  	FxEof:        0, // xEof - check for end of scan
 61472  	FxColumn:     0, // xColumn - read data
 61473  	FxRowid:      0, // xRename
 61474  } /* test_fs.c:798:23 */
 61475  
 61476  var fsdirModule = sqlite3_module{ // iVersion
 61477  	FxCreate:     0, // xCreate
 61478  	FxConnect:    0, // xConnect
 61479  	FxBestIndex:  0, // xBestIndex
 61480  	FxDisconnect: 0, // xDisconnect
 61481  	FxDestroy:    0, // xDestroy
 61482  	FxOpen:       0, // xOpen - open a cursor
 61483  	FxClose:      0, // xClose - close a cursor
 61484  	FxFilter:     0, // xFilter - configure scan constraints
 61485  	FxNext:       0, // xNext - advance a cursor
 61486  	FxEof:        0, // xEof - check for end of scan
 61487  	FxColumn:     0, // xColumn - read data
 61488  	FxRowid:      0, // xRename
 61489  } /* test_fs.c:821:23 */
 61490  
 61491  var fstreeModule = sqlite3_module{ // iVersion
 61492  	FxCreate:     0, // xCreate
 61493  	FxConnect:    0, // xConnect
 61494  	FxBestIndex:  0, // xBestIndex
 61495  	FxDisconnect: 0, // xDisconnect
 61496  	FxDestroy:    0, // xDestroy
 61497  	FxOpen:       0, // xOpen - open a cursor
 61498  	FxClose:      0, // xClose - close a cursor
 61499  	FxFilter:     0, // xFilter - configure scan constraints
 61500  	FxNext:       0, // xNext - advance a cursor
 61501  	FxEof:        0, // xEof - check for end of scan
 61502  	FxColumn:     0, // xColumn - read data
 61503  	FxRowid:      0, // xRename
 61504  } /* test_fs.c:844:23 */
 61505  
 61506  // Register the echo virtual table module.
 61507  func register_fs_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_fs.c:875:26: */
 61508  	bp := tls.Alloc(8)
 61509  	defer tls.Free(8)
 61510  
 61511  	// var db uintptr at bp, 8
 61512  
 61513  	if objc != 2 {
 61514  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 61515  		return TCL_ERROR
 61516  	}
 61517  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 61518  		return TCL_ERROR
 61519  	}
 61520  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+31250 /* "fs" */, uintptr(unsafe.Pointer(&fsModule)), interp)
 61521  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+5186 /* "fsdir" */, uintptr(unsafe.Pointer(&fsdirModule)), uintptr(0))
 61522  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+31253 /* "fstree" */, uintptr(unsafe.Pointer(&fstreeModule)), uintptr(0))
 61523  	return TCL_OK
 61524  }
 61525  
 61526  // Register commands with the TCL interpreter.
 61527  func Sqlitetestfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_fs.c:901:5: */
 61528  	var i int32
 61529  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd6)) / uint64(unsafe.Sizeof(struct {
 61530  		FzName      uintptr
 61531  		FxProc      uintptr
 61532  		FclientData uintptr
 61533  	}{}))); i++ {
 61534  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd6[i].FzName,
 61535  			aObjCmd6[i].FxProc, aObjCmd6[i].FclientData, uintptr(0))
 61536  	}
 61537  	return TCL_OK
 61538  }
 61539  
 61540  var aObjCmd6 = [1]struct {
 61541  	FzName      uintptr
 61542  	FxProc      uintptr
 61543  	FclientData uintptr
 61544  }{
 61545  	{FzName: ts + 31260 /* "register_fs_modu..." */, FxProc: 0},
 61546  } /* test_fs.c:907:5 */
 61547  
 61548  // Allocate nByte bytes of space using sqlite3_malloc(). If the
 61549  // allocation fails, call sqlite3_result_error_nomem() to notify
 61550  // the database handle that malloc() has failed.
 61551  func testContextMalloc(tls *libc.TLS, context uintptr, nByte int32) uintptr { /* test_func.c:33:13: */
 61552  	var z uintptr = sqlite3.Xsqlite3_malloc(tls, nByte)
 61553  	if !(z != 0) && (nByte > 0) {
 61554  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 61555  	}
 61556  	return z
 61557  }
 61558  
 61559  // This function generates a string of random characters.  Used for
 61560  // generating test data.
 61561  func randStr(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:45:13: */
 61562  	bp := tls.Alloc(1004)
 61563  	defer tls.Free(1004)
 61564  
 61565  	var iMin int32
 61566  	var iMax int32
 61567  	var n int32
 61568  	// var r int32 at bp, 4
 61569  
 61570  	var i int32
 61571  	// var zBuf [1000]uint8 at bp+4, 1000
 61572  
 61573  	// It used to be possible to call randstr() with any number of arguments,
 61574  	// but now it is registered with SQLite as requiring exactly 2.
 61575  
 61576  	iMin = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61577  	if iMin < 0 {
 61578  		iMin = 0
 61579  	}
 61580  	if uint64(iMin) >= uint64(unsafe.Sizeof([1000]uint8{})) {
 61581  		iMin = (int32(uint64(unsafe.Sizeof([1000]uint8{})) - uint64(1)))
 61582  	}
 61583  	iMax = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 61584  	if iMax < iMin {
 61585  		iMax = iMin
 61586  	}
 61587  	if uint64(iMax) >= uint64(unsafe.Sizeof([1000]uint8{})) {
 61588  		iMax = (int32(uint64(unsafe.Sizeof([1000]uint8{})) - uint64(1)))
 61589  	}
 61590  	n = iMin
 61591  	if iMax > iMin {
 61592  		sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp /* &r */)
 61593  		*(*int32)(unsafe.Pointer(bp /* r */)) &= 0x7fffffff
 61594  		n = n + (*(*int32)(unsafe.Pointer(bp /* r */)) % ((iMax + 1) - iMin))
 61595  	}
 61596  
 61597  	sqlite3.Xsqlite3_randomness(tls, n, bp+4 /* &zBuf[0] */)
 61598  	for i = 0; i < n; i++ {
 61599  		*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(i))) = zSrc[(uint64(*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(i)))) % (uint64(unsafe.Sizeof(zSrc)) - uint64(1)))]
 61600  	}
 61601  	*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(n))) = uint8(0)
 61602  	sqlite3.Xsqlite3_result_text(tls, context, bp+4 /* zBuf */, n, libc.UintptrFromInt32(-1))
 61603  }
 61604  
 61605  var zSrc = *(*[79]uint8)(unsafe.Pointer(ts + 31279 /* "abcdefghijklmnop..." */)) /* test_func.c:46:30 */
 61606  
 61607  // The following two SQL functions are used to test returning a text
 61608  // result with a destructor. Function 'test_destructor' takes one argument
 61609  // and returns the same argument interpreted as TEXT. A destructor is
 61610  // passed with the sqlite3_result_text() call.
 61611  //
 61612  // SQL function 'test_destructor_count' returns the number of outstanding
 61613  // allocations made by 'test_destructor';
 61614  //
 61615  // WARNING: Not threadsafe.
 61616  var test_destructor_count_var int32 = 0 /* test_func.c:91:12 */
 61617  
 61618  func destructor(tls *libc.TLS, p uintptr) { /* test_func.c:92:13: */
 61619  	var zVal uintptr = p
 61620  
 61621  	zVal--
 61622  	sqlite3.Xsqlite3_free(tls, zVal)
 61623  	test_destructor_count_var--
 61624  }
 61625  
 61626  func test_destructor(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:99:13: */
 61627  	var zVal uintptr
 61628  	var len int32
 61629  
 61630  	test_destructor_count_var++
 61631  
 61632  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 61633  		return
 61634  	}
 61635  	len = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61636  	zVal = testContextMalloc(tls, pCtx, (len + 3))
 61637  	if !(zVal != 0) {
 61638  		return
 61639  	}
 61640  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 1)))) = int8(0)
 61641  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 2)))) = int8(0)
 61642  	zVal++
 61643  	libc.Xmemcpy(tls, zVal, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), uint64(len))
 61644  	sqlite3.Xsqlite3_result_text(tls, pCtx, zVal, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{destructor})))
 61645  }
 61646  
 61647  func test_destructor16(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:122:13: */
 61648  	var zVal uintptr
 61649  	var len int32
 61650  
 61651  	test_destructor_count_var++
 61652  
 61653  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 61654  		return
 61655  	}
 61656  	len = sqlite3.Xsqlite3_value_bytes16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61657  	zVal = testContextMalloc(tls, pCtx, (len + 3))
 61658  	if !(zVal != 0) {
 61659  		return
 61660  	}
 61661  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 1)))) = int8(0)
 61662  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 2)))) = int8(0)
 61663  	zVal++
 61664  	libc.Xmemcpy(tls, zVal, sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv))), uint64(len))
 61665  	sqlite3.Xsqlite3_result_text16(tls, pCtx, zVal, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{destructor})))
 61666  }
 61667  
 61668  func test_destructor_count(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:145:13: */
 61669  	sqlite3.Xsqlite3_result_int(tls, pCtx, test_destructor_count_var)
 61670  }
 61671  
 61672  func test_agg_errmsg16_step(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_func.c:165:13: */
 61673  }
 61674  
 61675  func test_agg_errmsg16_final(tls *libc.TLS, ctx uintptr) { /* test_func.c:167:13: */
 61676  	var z uintptr
 61677  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, ctx)
 61678  	sqlite3.Xsqlite3_aggregate_context(tls, ctx, 2048)
 61679  	z = sqlite3.Xsqlite3_errmsg16(tls, db)
 61680  	sqlite3.Xsqlite3_result_text16(tls, ctx, z, -1, libc.UintptrFromInt32(-1))
 61681  }
 61682  
 61683  // Routines for testing the sqlite3_get_auxdata() and sqlite3_set_auxdata()
 61684  // interface.
 61685  //
 61686  // The test_auxdata() SQL function attempts to register each of its arguments
 61687  // as auxiliary data.  If there are no prior registrations of aux data for
 61688  // that argument (meaning the argument is not a constant or this is its first
 61689  // call) then the result for that argument is 0.  If there is a prior
 61690  // registration, the result for that argument is 1.  The overall result
 61691  // is the individual argument results separated by spaces.
 61692  func free_test_auxdata(tls *libc.TLS, p uintptr) { /* test_func.c:188:13: */
 61693  	sqlite3.Xsqlite3_free(tls, p)
 61694  }
 61695  
 61696  func test_auxdata(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:189:13: */
 61697  	var i int32
 61698  	var zRet uintptr = testContextMalloc(tls, pCtx, (nArg * 2))
 61699  	if !(zRet != 0) {
 61700  		return
 61701  	}
 61702  	libc.Xmemset(tls, zRet, 0, (uint64(nArg * 2)))
 61703  	for i = 0; i < nArg; i++ {
 61704  		var z uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 61705  		if z != 0 {
 61706  			var n int32
 61707  			var zAux uintptr = sqlite3.Xsqlite3_get_auxdata(tls, pCtx, i)
 61708  			if zAux != 0 {
 61709  				*(*int8)(unsafe.Pointer(zRet + uintptr((i * 2)))) = int8('1')
 61710  
 61711  			} else {
 61712  				*(*int8)(unsafe.Pointer(zRet + uintptr((i * 2)))) = int8('0')
 61713  			}
 61714  			n = (int32(libc.Xstrlen(tls, z)) + 1)
 61715  			zAux = testContextMalloc(tls, pCtx, n)
 61716  			if zAux != 0 {
 61717  				libc.Xmemcpy(tls, zAux, z, uint64(n))
 61718  				sqlite3.Xsqlite3_set_auxdata(tls, pCtx, i, zAux, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{free_test_auxdata})))
 61719  			}
 61720  			*(*int8)(unsafe.Pointer(zRet + uintptr(((i * 2) + 1)))) = int8(' ')
 61721  		}
 61722  	}
 61723  	sqlite3.Xsqlite3_result_text(tls, pCtx, zRet, ((2 * nArg) - 1), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{free_test_auxdata})))
 61724  }
 61725  
 61726  // A function to test error reporting from user functions. This function
 61727  // returns a copy of its first argument as the error message.  If the
 61728  // second argument exists, it becomes the error code.
 61729  func test_error(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:226:13: */
 61730  	sqlite3.Xsqlite3_result_error(tls, pCtx, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1)
 61731  	if nArg == 2 {
 61732  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))))
 61733  	}
 61734  }
 61735  
 61736  // Implementation of the counter(X) function.  If X is an integer
 61737  // constant, then the first invocation will return X.  The second X+1.
 61738  // and so forth.  Can be used (for example) to provide a sequence number
 61739  // in a result set.
 61740  func counterFunc(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:243:13: */
 61741  	var pCounter uintptr = sqlite3.Xsqlite3_get_auxdata(tls, pCtx, 0)
 61742  	if pCounter == uintptr(0) {
 61743  		pCounter = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(int32(0))))
 61744  		if pCounter == uintptr(0) {
 61745  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 61746  			return
 61747  		}
 61748  		*(*int32)(unsafe.Pointer(pCounter)) = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61749  		sqlite3.Xsqlite3_set_auxdata(tls, pCtx, 0, pCounter, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 61750  	} else {
 61751  		*(*int32)(unsafe.Pointer(pCounter))++
 61752  	}
 61753  	sqlite3.Xsqlite3_result_int(tls, pCtx, *(*int32)(unsafe.Pointer(pCounter)))
 61754  }
 61755  
 61756  // This function takes two arguments.  It performance UTF-8/16 type
 61757  // conversions on the first argument then returns a copy of the second
 61758  // argument.
 61759  //
 61760  // This function is used in cases such as the following:
 61761  //
 61762  //      SELECT test_isolation(x,x) FROM t1;
 61763  //
 61764  // We want to verify that the type conversions that occur on the
 61765  // first argument do not invalidate the second argument.
 61766  func test_isolation(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:276:13: */
 61767  	sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61768  	sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61769  	sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61770  	sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61771  	sqlite3.Xsqlite3_result_value(tls, pCtx, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 61772  }
 61773  
 61774  // Invoke an SQL statement recursively.  The function result is the
 61775  // first column of the first row of the result set.
 61776  func test_eval(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:294:13: */
 61777  	bp := tls.Alloc(16)
 61778  	defer tls.Free(16)
 61779  
 61780  	// var pStmt uintptr at bp+8, 8
 61781  
 61782  	var rc int32
 61783  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, pCtx)
 61784  	var zSql uintptr
 61785  
 61786  	zSql = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61787  	rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0))
 61788  	if rc == SQLITE_OK {
 61789  		rc = sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 61790  		if rc == SQLITE_ROW {
 61791  			sqlite3.Xsqlite3_result_value(tls, pCtx, sqlite3.Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0))
 61792  		}
 61793  		rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 61794  	}
 61795  	if rc != 0 {
 61796  		var zErr uintptr
 61797  
 61798  		zErr = sqlite3.Xsqlite3_mprintf(tls, ts+31358 /* "sqlite3_prepare_..." */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 61799  		sqlite3.Xsqlite3_result_text(tls, pCtx, zErr, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 61800  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 61801  	}
 61802  }
 61803  
 61804  // convert one character from hex to binary
 61805  func testHexChar(tls *libc.TLS, c int8) int32 { /* test_func.c:326:12: */
 61806  	if (int32(c) >= '0') && (int32(c) <= '9') {
 61807  		return (int32(c) - '0')
 61808  	} else if (int32(c) >= 'a') && (int32(c) <= 'f') {
 61809  		return ((int32(c) - 'a') + 10)
 61810  	} else if (int32(c) >= 'A') && (int32(c) <= 'F') {
 61811  		return ((int32(c) - 'A') + 10)
 61812  	}
 61813  	return 0
 61814  }
 61815  
 61816  // Convert hex to binary.
 61817  func testHexToBin(tls *libc.TLS, zIn uintptr, zOut uintptr) { /* test_func.c:340:13: */
 61818  	for (*(*int8)(unsafe.Pointer(zIn)) != 0) && (*(*int8)(unsafe.Pointer(zIn + 1)) != 0) {
 61819  		*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8((testHexChar(tls, *(*int8)(unsafe.Pointer(zIn))) << 4) + testHexChar(tls, *(*int8)(unsafe.Pointer(zIn + 1)))))
 61820  		zIn += uintptr(2)
 61821  	}
 61822  }
 61823  
 61824  //      hex_to_utf16be(HEX)
 61825  //
 61826  // Convert the input string from HEX into binary.  Then return the
 61827  // result using sqlite3_result_text16le().
 61828  func testHexToUtf16be(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:354:13: */
 61829  	var n int32
 61830  	var zIn uintptr
 61831  	var zOut uintptr
 61832  
 61833  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61834  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61835  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 61836  	if zOut == uintptr(0) {
 61837  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 61838  	} else {
 61839  		testHexToBin(tls, zIn, zOut)
 61840  		sqlite3.Xsqlite3_result_text16be(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 61841  	}
 61842  }
 61843  
 61844  //      hex_to_utf8(HEX)
 61845  //
 61846  // Convert the input string from HEX into binary.  Then return the
 61847  // result using sqlite3_result_text16le().
 61848  func testHexToUtf8(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:381:13: */
 61849  	var n int32
 61850  	var zIn uintptr
 61851  	var zOut uintptr
 61852  
 61853  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61854  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61855  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 61856  	if zOut == uintptr(0) {
 61857  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 61858  	} else {
 61859  		testHexToBin(tls, zIn, zOut)
 61860  		sqlite3.Xsqlite3_result_text(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 61861  	}
 61862  }
 61863  
 61864  //      hex_to_utf16le(HEX)
 61865  //
 61866  // Convert the input string from HEX into binary.  Then return the
 61867  // result using sqlite3_result_text16le().
 61868  func testHexToUtf16le(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:408:13: */
 61869  	var n int32
 61870  	var zIn uintptr
 61871  	var zOut uintptr
 61872  
 61873  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61874  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61875  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 61876  	if zOut == uintptr(0) {
 61877  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 61878  	} else {
 61879  		testHexToBin(tls, zIn, zOut)
 61880  		sqlite3.Xsqlite3_result_text16le(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 61881  	}
 61882  }
 61883  
 61884  // SQL function:   real2hex(X)
 61885  //
 61886  // If argument X is a real number, then convert it into a string which is
 61887  // the big-endian hexadecimal representation of the ieee754 encoding of
 61888  // that number.  If X is not a real number, return NULL.
 61889  func real2hex(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:436:13: */
 61890  	bp := tls.Alloc(28)
 61891  	defer tls.Free(28)
 61892  
 61893  	// var v struct {Fi sqlite3_uint64;} at bp, 8
 61894  
 61895  	// var zOut [20]int8 at bp+8, 20
 61896  
 61897  	var i int32
 61898  	var bigEndian int32
 61899  	*(*sqlite3_uint64)(unsafe.Pointer(bp /* &v */)) = uint64(1)
 61900  	bigEndian = (libc.Bool32(int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */)))) == 0))
 61901  	*(*float64)(unsafe.Pointer(bp /* &v */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61902  	for i = 0; i < 8; i++ {
 61903  		if bigEndian != 0 {
 61904  			*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + uintptr((i * 2)))) = *(*int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */ + uintptr((int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */) + uintptr(i)))) >> 4))))
 61905  			*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + uintptr(((i * 2) + 1)))) = *(*int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */ + uintptr((int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */) + uintptr(i)))) & 0xf))))
 61906  		} else {
 61907  			*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + uintptr((14 - (i * 2))))) = *(*int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */ + uintptr((int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */) + uintptr(i)))) >> 4))))
 61908  			*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + uintptr(((14 - (i * 2)) + 1)))) = *(*int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */ + uintptr((int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */) + uintptr(i)))) & 0xf))))
 61909  		}
 61910  	}
 61911  	*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + 16)) = int8(0)
 61912  	sqlite3.Xsqlite3_result_text(tls, context, bp+8 /* &zOut[0] */, -1, libc.UintptrFromInt32(-1))
 61913  }
 61914  
 61915  //     test_extract(record, field)
 61916  //
 61917  // This function implements an SQL user-function that accepts a blob
 61918  // containing a formatted database record as the first argument. The
 61919  // second argument is the index of the field within that record to
 61920  // extract and return.
 61921  func test_extract(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:473:13: */
 61922  	bp := tls.Alloc(72)
 61923  	defer tls.Free(72)
 61924  
 61925  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 61926  	var pRec uintptr
 61927  	var pEndHdr uintptr // Points to one byte past record header
 61928  	var pHdr uintptr    // Current point in record header
 61929  	var pBody uintptr   // Current point in record data
 61930  	// var nHdr u64 at bp, 8
 61931  	// Bytes in record header
 61932  	var iIdx int32         // Required field
 61933  	var iCurrent int32 = 0 // Current field
 61934  
 61935  	pRec = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61936  	iIdx = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 61937  
 61938  	pHdr = (pRec + uintptr(sqlite3.Xsqlite3GetVarint(tls, pRec, bp /* &nHdr */)))
 61939  	pBody = libc.AssignUintptr(&pEndHdr, (pRec + uintptr(*(*u64)(unsafe.Pointer(bp /* nHdr */)))))
 61940  
 61941  	for iCurrent = 0; (pHdr < pEndHdr) && (iCurrent <= iIdx); iCurrent++ {
 61942  		// var iSerialType u64 at bp+64, 8
 61943  
 61944  		// var mem Mem at bp+8, 56
 61945  
 61946  		libc.Xmemset(tls, bp+8 /* &mem */, 0, uint64(unsafe.Sizeof(Mem{})))
 61947  		(*Mem)(unsafe.Pointer(bp + 8 /* &mem */)).Fdb = db
 61948  		(*Mem)(unsafe.Pointer(bp + 8 /* &mem */)).Fenc = (*sqlite31)(unsafe.Pointer(db)).Fenc
 61949  		pHdr += uintptr(sqlite3.Xsqlite3GetVarint(tls, pHdr, bp+64 /* &iSerialType */))
 61950  		pBody += uintptr(sqlite3.Xsqlite3VdbeSerialGet(tls, pBody, u32(*(*u64)(unsafe.Pointer(bp + 64 /* iSerialType */))), bp+8 /* &mem */))
 61951  
 61952  		if iCurrent == iIdx {
 61953  			sqlite3.Xsqlite3_result_value(tls, context, bp+8 /* &mem */)
 61954  		}
 61955  
 61956  		if (*Mem)(unsafe.Pointer(bp+8 /* &mem */)).FszMalloc != 0 {
 61957  			sqlite3.Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(bp+8 /* &mem */)).FzMalloc)
 61958  		}
 61959  	}
 61960  }
 61961  
 61962  //      test_decode(record)
 61963  //
 61964  // This function implements an SQL user-function that accepts a blob
 61965  // containing a formatted database record as its only argument. It returns
 61966  // a tcl list (type SQLITE_TEXT) containing each of the values stored
 61967  // in the record.
 61968  func test_decode(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:520:13: */
 61969  	bp := tls.Alloc(123)
 61970  	defer tls.Free(123)
 61971  
 61972  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 61973  	var pRec uintptr
 61974  	var pEndHdr uintptr // Points to one byte past record header
 61975  	var pHdr uintptr    // Current point in record header
 61976  	var pBody uintptr   // Current point in record data
 61977  	// var nHdr u64 at bp+32, 8
 61978  	// Bytes in record header
 61979  	var pRet uintptr // Return value
 61980  
 61981  	pRet = tcl.XTcl_NewObj(tls)
 61982  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 61983  
 61984  	pRec = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 61985  
 61986  	pHdr = (pRec + uintptr(sqlite3.Xsqlite3GetVarint(tls, pRec, bp+32 /* &nHdr */)))
 61987  	pBody = libc.AssignUintptr(&pEndHdr, (pRec + uintptr(*(*u64)(unsafe.Pointer(bp + 32 /* nHdr */)))))
 61988  	for pHdr < pEndHdr {
 61989  		var pVal uintptr = uintptr(0)
 61990  		// var iSerialType u64 at bp+96, 8
 61991  
 61992  		// var mem Mem at bp+40, 56
 61993  
 61994  		libc.Xmemset(tls, bp+40 /* &mem */, 0, uint64(unsafe.Sizeof(Mem{})))
 61995  		(*Mem)(unsafe.Pointer(bp + 40 /* &mem */)).Fdb = db
 61996  		(*Mem)(unsafe.Pointer(bp + 40 /* &mem */)).Fenc = (*sqlite31)(unsafe.Pointer(db)).Fenc
 61997  		pHdr += uintptr(sqlite3.Xsqlite3GetVarint(tls, pHdr, bp+96 /* &iSerialType */))
 61998  		pBody += uintptr(sqlite3.Xsqlite3VdbeSerialGet(tls, pBody, u32(*(*u64)(unsafe.Pointer(bp + 96 /* iSerialType */))), bp+40 /* &mem */))
 61999  
 62000  		switch sqlite3.Xsqlite3_value_type(tls, bp+40 /* &mem */) {
 62001  		case SQLITE_TEXT:
 62002  			pVal = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, bp+40 /* &mem */), -1)
 62003  			break
 62004  
 62005  		case SQLITE_BLOB:
 62006  			{
 62007  				*(*[16]int8)(unsafe.Pointer(bp + 107 /* hexdigit */)) = [16]int8{
 62008  					int8('0'), int8('1'), int8('2'), int8('3'), int8('4'), int8('5'), int8('6'), int8('7'),
 62009  					int8('8'), int8('9'), int8('a'), int8('b'), int8('c'), int8('d'), int8('e'), int8('f'),
 62010  				}
 62011  				var n int32 = sqlite3.Xsqlite3_value_bytes(tls, bp+40 /* &mem */)
 62012  				var z uintptr = sqlite3.Xsqlite3_value_blob(tls, bp+40 /* &mem */)
 62013  				var i int32
 62014  				pVal = tcl.XTcl_NewStringObj(tls, ts+31406 /* "x'" */, -1)
 62015  				for i = 0; i < n; i++ {
 62016  					// var hex [3]int8 at bp+104, 3
 62017  
 62018  					*(*int8)(unsafe.Pointer(bp + 104 /* &hex[0] */)) = *(*int8)(unsafe.Pointer(bp + 107 /* &hexdigit[0] */ + uintptr(((int32(*(*u8)(unsafe.Pointer(z + uintptr(i)))) >> 4) & 0x0F))))
 62019  					*(*int8)(unsafe.Pointer(bp + 104 /* &hex[0] */ + 1)) = *(*int8)(unsafe.Pointer(bp + 107 /* &hexdigit[0] */ + uintptr((int32(*(*u8)(unsafe.Pointer(z + uintptr(i)))) & 0x0F))))
 62020  					*(*int8)(unsafe.Pointer(bp + 104 /* &hex[0] */ + 2)) = int8(0)
 62021  					tcl.XTcl_AppendStringsToObj(tls, pVal, libc.VaList(bp, bp+104 /* &hex[0] */, 0))
 62022  				}
 62023  				tcl.XTcl_AppendStringsToObj(tls, pVal, libc.VaList(bp+16, ts+5485 /* "'" */, 0))
 62024  				break
 62025  
 62026  			}
 62027  
 62028  		case SQLITE_FLOAT:
 62029  			pVal = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, bp+40 /* &mem */))
 62030  			break
 62031  
 62032  		case SQLITE_INTEGER:
 62033  			pVal = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, bp+40 /* &mem */))
 62034  			break
 62035  
 62036  		case SQLITE_NULL:
 62037  			pVal = tcl.XTcl_NewStringObj(tls, ts+5707 /* "NULL" */, -1)
 62038  			break
 62039  
 62040  		default:
 62041  
 62042  		}
 62043  
 62044  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, pVal)
 62045  
 62046  		if (*Mem)(unsafe.Pointer(bp+40 /* &mem */)).FszMalloc != 0 {
 62047  			sqlite3.Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(bp+40 /* &mem */)).FzMalloc)
 62048  		}
 62049  	}
 62050  
 62051  	sqlite3.Xsqlite3_result_text(tls, context, tcl.XTcl_GetString(tls, pRet), -1, libc.UintptrFromInt32(-1))
 62052  	for ok := true; ok; ok = 0 != 0 {
 62053  		var _objPtr uintptr = pRet
 62054  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 62055  			tcl.XTclFreeObj(tls, _objPtr)
 62056  		}
 62057  	}
 62058  }
 62059  
 62060  //       test_zeroblob(N)
 62061  //
 62062  // The implementation of scalar SQL function "test_zeroblob()". This is
 62063  // similar to the built-in zeroblob() function, except that it does not
 62064  // check that the integer parameter is within range before passing it
 62065  // to sqlite3_result_zeroblob().
 62066  func test_zeroblob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:612:13: */
 62067  	var nZero int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 62068  	sqlite3.Xsqlite3_result_zeroblob(tls, context, nZero)
 62069  }
 62070  
 62071  // test_getsubtype(V)
 62072  //
 62073  // Return the subtype for value V.
 62074  func test_getsubtype(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:625:13: */
 62075  	sqlite3.Xsqlite3_result_int(tls, context, int32(sqlite3.Xsqlite3_value_subtype(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 62076  }
 62077  
 62078  // test_frombind(A,B,C,...)
 62079  //
 62080  // Return an integer bitmask that has a bit set for every argument
 62081  // (up to the first 63 arguments) that originates from a bind a parameter.
 62082  func test_frombind(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:638:13: */
 62083  	var m sqlite3_uint64 = uint64(0)
 62084  	var i int32
 62085  	for i = 0; (i < argc) && (i < 63); i++ {
 62086  		if sqlite3.Xsqlite3_value_frombind(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8))) != 0 {
 62087  			m = m | (sqlite3_uint64((uint64(1))) << i)
 62088  		}
 62089  	}
 62090  	sqlite3.Xsqlite3_result_int64(tls, context, sqlite3_int64(m))
 62091  }
 62092  
 62093  // test_setsubtype(V, T)
 62094  //
 62095  // Return the value V with its subtype changed to T
 62096  func test_setsubtype(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:655:13: */
 62097  	sqlite3.Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv)))
 62098  	sqlite3.Xsqlite3_result_subtype(tls, context, uint32(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))))
 62099  }
 62100  
 62101  func registerTestFunctions(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pThunk uintptr) int32 { /* test_func.c:664:12: */
 62102  	var i int32
 62103  
 62104  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aFuncs)) / uint64(unsafe.Sizeof(struct {
 62105  		FzName    uintptr
 62106  		FnArg     int8
 62107  		_         [3]byte
 62108  		FeTextRep uint32
 62109  		FxFunc    uintptr
 62110  	}{}))); i++ {
 62111  		sqlite3.Xsqlite3_create_function(tls, db, aFuncs[i].FzName, int32(aFuncs[i].FnArg),
 62112  			int32(aFuncs[i].FeTextRep), uintptr(0), aFuncs[i].FxFunc, uintptr(0), uintptr(0))
 62113  	}
 62114  
 62115  	sqlite3.Xsqlite3_create_function(tls, db, ts+31409 /* "test_agg_errmsg1..." */, 0, SQLITE_ANY, uintptr(0), uintptr(0),
 62116  		*(*uintptr)(unsafe.Pointer(&struct {
 62117  			f func(*libc.TLS, uintptr, int32, uintptr)
 62118  		}{test_agg_errmsg16_step})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_agg_errmsg16_final})))
 62119  
 62120  	return SQLITE_OK
 62121  }
 62122  
 62123  var aFuncs = [20]struct {
 62124  	FzName    uintptr
 62125  	FnArg     int8
 62126  	_         [3]byte
 62127  	FeTextRep uint32
 62128  	FxFunc    uintptr
 62129  }{
 62130  	{FzName: ts + 31427 /* "randstr" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62131  	{FzName: ts + 31435 /* "test_destructor" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62132  	{FzName: ts + 31451 /* "test_destructor1..." */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62133  	{FzName: ts + 31469 /* "hex_to_utf16be" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62134  	{FzName: ts + 31484 /* "hex_to_utf16le" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62135  	{FzName: ts + 31499 /* "hex_to_utf8" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62136  	{FzName: ts + 31511 /* "test_destructor_..." */, FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62137  	{FzName: ts + 31533 /* "test_auxdata" */, FnArg: int8(-1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62138  	{FzName: ts + 31546 /* "test_error" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62139  	{FzName: ts + 31546 /* "test_error" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62140  	{FzName: ts + 31557 /* "test_eval" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62141  	{FzName: ts + 31567 /* "test_isolation" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62142  	{FzName: ts + 31582 /* "test_counter" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62143  	{FzName: ts + 31595 /* "real2hex" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62144  	{FzName: ts + 31604 /* "test_decode" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62145  	{FzName: ts + 31616 /* "test_extract" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62146  	{FzName: ts + 31629 /* "test_zeroblob" */, FnArg: int8(1), FeTextRep: (uint32(SQLITE_UTF8 | SQLITE_DETERMINISTIC)), FxFunc: 0},
 62147  	{FzName: ts + 31643 /* "test_getsubtype" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62148  	{FzName: ts + 31659 /* "test_setsubtype" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62149  	{FzName: ts + 31675 /* "test_frombind" */, FnArg: int8(-1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 62150  } /* test_func.c:674:5 */
 62151  
 62152  // TCLCMD:  autoinstall_test_functions
 62153  //
 62154  // Invoke this TCL command to use sqlite3_auto_extension() to cause
 62155  // the standard set of test functions to be loaded into each new
 62156  // database connection.
 62157  func autoinstall_test_funcs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:718:26: */
 62158  	var rc int32 = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 62159  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 62160  	}{registerTestFunctions})))
 62161  	if rc == SQLITE_OK {
 62162  		rc = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 62163  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 62164  		}{Md5_Register})))
 62165  	}
 62166  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 62167  	return TCL_OK
 62168  }
 62169  
 62170  // A bogus step function and finalizer function.
 62171  func tStep(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_func.c:736:13: */
 62172  }
 62173  
 62174  func tFinal(tls *libc.TLS, a uintptr) { /* test_func.c:737:13: */
 62175  }
 62176  
 62177  // tclcmd:  abuse_create_function
 62178  //
 62179  // Make various calls to sqlite3_create_function that do not have valid
 62180  // parameters.  Verify that the error condition is detected and reported.
 62181  func abuse_create_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:746:26: */
 62182  	bp := tls.Alloc(24)
 62183  	defer tls.Free(24)
 62184  
 62185  	// var db uintptr at bp+16, 8
 62186  
 62187  	var rc int32
 62188  	var mxArg int32
 62189  
 62190  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0) {
 62191  		goto __1
 62192  	}
 62193  	return TCL_ERROR
 62194  __1:
 62195  	;
 62196  
 62197  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62198  		f func(*libc.TLS, uintptr, int32, uintptr)
 62199  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct {
 62200  		f func(*libc.TLS, uintptr, int32, uintptr)
 62201  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tFinal})))
 62202  	if !(rc != SQLITE_MISUSE) {
 62203  		goto __2
 62204  	}
 62205  	goto abuse_err
 62206  __2:
 62207  	;
 62208  
 62209  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62210  		f func(*libc.TLS, uintptr, int32, uintptr)
 62211  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct {
 62212  		f func(*libc.TLS, uintptr, int32, uintptr)
 62213  	}{tStep})), uintptr(0))
 62214  	if !(rc != SQLITE_MISUSE) {
 62215  		goto __3
 62216  	}
 62217  	goto abuse_err
 62218  __3:
 62219  	;
 62220  
 62221  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62222  		f func(*libc.TLS, uintptr, int32, uintptr)
 62223  	}{tStep})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tFinal})))
 62224  	if !(rc != SQLITE_MISUSE) {
 62225  		goto __4
 62226  	}
 62227  	goto abuse_err
 62228  __4:
 62229  	;
 62230  
 62231  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tFinal})))
 62232  	if !(rc != SQLITE_MISUSE) {
 62233  		goto __5
 62234  	}
 62235  	goto abuse_err
 62236  __5:
 62237  	;
 62238  
 62239  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62240  		f func(*libc.TLS, uintptr, int32, uintptr)
 62241  	}{tStep})), uintptr(0))
 62242  	if !(rc != SQLITE_MISUSE) {
 62243  		goto __6
 62244  	}
 62245  	goto abuse_err
 62246  __6:
 62247  	;
 62248  
 62249  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, -2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62250  		f func(*libc.TLS, uintptr, int32, uintptr)
 62251  	}{tStep})), uintptr(0), uintptr(0))
 62252  	if !(rc != SQLITE_MISUSE) {
 62253  		goto __7
 62254  	}
 62255  	goto abuse_err
 62256  __7:
 62257  	;
 62258  
 62259  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 128, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62260  		f func(*libc.TLS, uintptr, int32, uintptr)
 62261  	}{tStep})), uintptr(0), uintptr(0))
 62262  	if !(rc != SQLITE_MISUSE) {
 62263  		goto __8
 62264  	}
 62265  	goto abuse_err
 62266  __8:
 62267  	;
 62268  
 62269  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)),
 62270  
 62271  		ts+31692, /* "funcxx_123456789..." */
 62272  		1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62273  			f func(*libc.TLS, uintptr, int32, uintptr)
 62274  		}{tStep})), uintptr(0), uintptr(0))
 62275  	if !(rc != SQLITE_MISUSE) {
 62276  		goto __9
 62277  	}
 62278  	goto abuse_err
 62279  __9:
 62280  	;
 62281  
 62282  	// This last function registration should actually work.  Generate
 62283  	// a no-op function (that always returns NULL) and which has the
 62284  	// maximum-length function name and the maximum number of parameters.
 62285  	sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), SQLITE_LIMIT_FUNCTION_ARG, 10000)
 62286  	mxArg = sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), SQLITE_LIMIT_FUNCTION_ARG, -1)
 62287  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)),
 62288  
 62289  		ts+31949, /* "nullx_123456789_..." */
 62290  		mxArg, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62291  			f func(*libc.TLS, uintptr, int32, uintptr)
 62292  		}{tStep})), uintptr(0), uintptr(0))
 62293  	if !(rc != SQLITE_OK) {
 62294  		goto __10
 62295  	}
 62296  	goto abuse_err
 62297  __10:
 62298  	;
 62299  
 62300  	return TCL_OK
 62301  
 62302  abuse_err:
 62303  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32205, /* "sqlite3_create_f..." */
 62304  		uintptr(0)))
 62305  	return TCL_ERROR
 62306  }
 62307  
 62308  // SQLite user defined function to use with matchinfo() to calculate the
 62309  // relevancy of an FTS match. The value returned is the relevancy score
 62310  // (a real value greater than or equal to zero). A larger value indicates
 62311  // a more relevant document.
 62312  //
 62313  // The overall relevancy returned is the sum of the relevancies of each
 62314  // column value in the FTS table. The relevancy of a column value is the
 62315  // sum of the following for each reportable phrase in the FTS query:
 62316  //
 62317  //   (<hit count> / <global hit count>) * <column weight>
 62318  //
 62319  // where <hit count> is the number of instances of the phrase in the
 62320  // column value of the current row and <global hit count> is the number
 62321  // of instances of the phrase in the same column of all rows in the FTS
 62322  // table. The <column weight> is a weighting factor assigned to each
 62323  // column by the caller (see below).
 62324  //
 62325  // The first argument to this function must be the return value of the FTS
 62326  // matchinfo() function. Following this must be one argument for each column
 62327  // of the FTS table containing a numeric weight factor for the corresponding
 62328  // column. Example:
 62329  //
 62330  //     CREATE VIRTUAL TABLE documents USING fts3(title, content)
 62331  //
 62332  // The following query returns the docids of documents that match the full-text
 62333  // query <query> sorted from most to least relevant. When calculating
 62334  // relevance, query term instances in the 'title' column are given twice the
 62335  // weighting of those in the 'content' column.
 62336  //
 62337  //     SELECT docid FROM documents
 62338  //     WHERE documents MATCH <query>
 62339  //     ORDER BY rank(matchinfo(documents), 1.0, 0.5) DESC
 62340  func rankfunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* test_func.c:847:13: */
 62341  	var aMatchinfo uintptr // Return value of matchinfo()
 62342  	var nMatchinfo int32   // Number of elements in aMatchinfo[]
 62343  	var nCol int32         // Number of columns in the table
 62344  	var nPhrase int32      // Number of phrases in the query
 62345  	var iPhrase int32      // Current phrase
 62346  	var score float64
 62347  	var nHitCount int32
 62348  	var nGlobalHitCount int32
 62349  	var weight float64
 62350  	var iCol int32 // Current column
 62351  
 62352  	// Now iterate through each column in the users query. For each column,
 62353  	// increment the relevancy score by:
 62354  	//
 62355  	//   (<hit count> / <global hit count>) * <column weight>
 62356  	//
 62357  	// aPhraseinfo[] points to the start of the data for phrase iPhrase. So
 62358  	// the hit count and global hit counts for each column are found in
 62359  	// aPhraseinfo[iCol*3] and aPhraseinfo[iCol*3+1], respectively.
 62360  	var aPhraseinfo uintptr
 62361  	nCol = 0
 62362  	nPhrase = 0
 62363  	score = 0.0 // Value to return
 62364  
 62365  	// Check that the number of arguments passed to this function is correct.
 62366  	// If not, jump to wrong_number_args. Set aMatchinfo to point to the array
 62367  	// of unsigned integer values returned by FTS function matchinfo. Set
 62368  	// nPhrase to contain the number of reportable phrases in the users full-text
 62369  	// query, and nCol to the number of columns in the table. Then check that the
 62370  	// size of the matchinfo blob is as expected. Return an error if it is not.
 62371  	if !(nVal < 1) {
 62372  		goto __1
 62373  	}
 62374  	goto wrong_number_args
 62375  __1:
 62376  	;
 62377  	aMatchinfo = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 62378  	nMatchinfo = (int32(uint64(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))) / uint64(unsafe.Sizeof(int32(0)))))
 62379  	if !(nMatchinfo >= 2) {
 62380  		goto __2
 62381  	}
 62382  	nPhrase = *(*int32)(unsafe.Pointer(aMatchinfo))
 62383  	nCol = *(*int32)(unsafe.Pointer(aMatchinfo + 1*4))
 62384  __2:
 62385  	;
 62386  	if !(nMatchinfo != (2 + ((3 * nCol) * nPhrase))) {
 62387  		goto __3
 62388  	}
 62389  	sqlite3.Xsqlite3_result_error(tls, pCtx,
 62390  		ts+32248 /* "invalid matchinf..." */, -1)
 62391  	return
 62392  __3:
 62393  	;
 62394  	if !(nVal != (1 + nCol)) {
 62395  		goto __4
 62396  	}
 62397  	goto wrong_number_args
 62398  __4:
 62399  	;
 62400  
 62401  	// Iterate through each phrase in the users query.
 62402  	iPhrase = 0
 62403  __5:
 62404  	if !(iPhrase < nPhrase) {
 62405  		goto __7
 62406  	} // Current column
 62407  
 62408  	// Now iterate through each column in the users query. For each column,
 62409  	// increment the relevancy score by:
 62410  	//
 62411  	//   (<hit count> / <global hit count>) * <column weight>
 62412  	//
 62413  	// aPhraseinfo[] points to the start of the data for phrase iPhrase. So
 62414  	// the hit count and global hit counts for each column are found in
 62415  	// aPhraseinfo[iCol*3] and aPhraseinfo[iCol*3+1], respectively.
 62416  	aPhraseinfo = (aMatchinfo + uintptr((2+((iPhrase*nCol)*3)))*4)
 62417  	iCol = 0
 62418  __8:
 62419  	if !(iCol < nCol) {
 62420  		goto __10
 62421  	}
 62422  	nHitCount = *(*int32)(unsafe.Pointer(aPhraseinfo + uintptr((3*iCol))*4))
 62423  	nGlobalHitCount = *(*int32)(unsafe.Pointer(aPhraseinfo + uintptr(((3*iCol)+1))*4))
 62424  	weight = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+1))*8)))
 62425  	if !(nHitCount > 0) {
 62426  		goto __11
 62427  	}
 62428  	score = score + ((float64(nHitCount) / float64(nGlobalHitCount)) * weight)
 62429  __11:
 62430  	;
 62431  	goto __9
 62432  __9:
 62433  	iCol++
 62434  	goto __8
 62435  	goto __10
 62436  __10:
 62437  	;
 62438  	goto __6
 62439  __6:
 62440  	iPhrase++
 62441  	goto __5
 62442  	goto __7
 62443  __7:
 62444  	;
 62445  
 62446  	sqlite3.Xsqlite3_result_double(tls, pCtx, score)
 62447  	return
 62448  
 62449  	// Jump here if the wrong number of arguments are passed to this function
 62450  wrong_number_args:
 62451  	sqlite3.Xsqlite3_result_error(tls, pCtx, ts+32297 /* "wrong number of ..." */, -1)
 62452  }
 62453  
 62454  func install_fts3_rank_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:910:26: */
 62455  	bp := tls.Alloc(8)
 62456  	defer tls.Free(8)
 62457  
 62458  	// var db uintptr at bp, 8
 62459  
 62460  	if objc != 2 {
 62461  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 62462  		return TCL_ERROR
 62463  	}
 62464  
 62465  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 62466  		return TCL_ERROR
 62467  	}
 62468  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+32342 /* "rank" */, -1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 62469  		f func(*libc.TLS, uintptr, int32, uintptr)
 62470  	}{rankfunc})), uintptr(0), uintptr(0))
 62471  	return TCL_OK
 62472  }
 62473  
 62474  // Register commands with the TCL interpreter.
 62475  func Sqlitetest_func_Init(tls *libc.TLS, interp uintptr) int32 { /* test_func.c:933:5: */
 62476  	var i int32
 62477  
 62478  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd7)) / uint64(unsafe.Sizeof(struct {
 62479  		FzName uintptr
 62480  		FxProc uintptr
 62481  	}{}))); i++ {
 62482  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd7[i].FzName, aObjCmd7[i].FxProc, uintptr(0), uintptr(0))
 62483  	}
 62484  	sqlite3.Xsqlite3_initialize(tls)
 62485  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 62486  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 62487  	}{registerTestFunctions})))
 62488  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 62489  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 62490  	}{Md5_Register})))
 62491  	return TCL_OK
 62492  }
 62493  
 62494  var aObjCmd7 = [3]struct {
 62495  	FzName uintptr
 62496  	FxProc uintptr
 62497  }{
 62498  	{FzName: ts + 32347 /* "autoinstall_test..." */, FxProc: 0},
 62499  	{FzName: ts + 32374 /* "abuse_create_fun..." */, FxProc: 0},
 62500  	{FzName: ts + 32396 /* "install_fts3_ran..." */, FxProc: 0},
 62501  } /* test_func.c:937:5 */
 62502  
 62503  // end block for C++
 62504  
 62505  // Local Variables:
 62506  // mode: c
 62507  // c-basic-offset: 4
 62508  // fill-column: 78
 62509  // End:
 62510  // -
 62511  // SPDX-License-Identifier: BSD-3-Clause
 62512  //
 62513  // Copyright (c) 1990, 1993
 62514  //	The Regents of the University of California.  All rights reserved.
 62515  //
 62516  // Redistribution and use in source and binary forms, with or without
 62517  // modification, are permitted provided that the following conditions
 62518  // are met:
 62519  // 1. Redistributions of source code must retain the above copyright
 62520  //    notice, this list of conditions and the following disclaimer.
 62521  // 2. Redistributions in binary form must reproduce the above copyright
 62522  //    notice, this list of conditions and the following disclaimer in the
 62523  //    documentation and/or other materials provided with the distribution.
 62524  // 3. Neither the name of the University nor the names of its contributors
 62525  //    may be used to endorse or promote products derived from this software
 62526  //    without specific prior written permission.
 62527  //
 62528  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 62529  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 62530  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 62531  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 62532  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 62533  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 62534  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 62535  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 62536  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 62537  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 62538  // SUCH DAMAGE.
 62539  //
 62540  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 62541  // $FreeBSD$
 62542  
 62543  // -
 62544  // SPDX-License-Identifier: BSD-3-Clause
 62545  //
 62546  // Copyright (c) 1990, 1993
 62547  //	The Regents of the University of California.  All rights reserved.
 62548  //
 62549  // Redistribution and use in source and binary forms, with or without
 62550  // modification, are permitted provided that the following conditions
 62551  // are met:
 62552  // 1. Redistributions of source code must retain the above copyright
 62553  //    notice, this list of conditions and the following disclaimer.
 62554  // 2. Redistributions in binary form must reproduce the above copyright
 62555  //    notice, this list of conditions and the following disclaimer in the
 62556  //    documentation and/or other materials provided with the distribution.
 62557  // 3. Neither the name of the University nor the names of its contributors
 62558  //    may be used to endorse or promote products derived from this software
 62559  //    without specific prior written permission.
 62560  //
 62561  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 62562  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 62563  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 62564  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 62565  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 62566  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 62567  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 62568  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 62569  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 62570  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 62571  // SUCH DAMAGE.
 62572  //
 62573  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 62574  // $FreeBSD$
 62575  
 62576  // -
 62577  // SPDX-License-Identifier: BSD-3-Clause
 62578  //
 62579  // Copyright (c) 1992, 1993
 62580  //	The Regents of the University of California.  All rights reserved.
 62581  // (c) UNIX System Laboratories, Inc.
 62582  // All or some portions of this file are derived from material licensed
 62583  // to the University of California by American Telephone and Telegraph
 62584  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 62585  // the permission of UNIX System Laboratories, Inc.
 62586  //
 62587  // Redistribution and use in source and binary forms, with or without
 62588  // modification, are permitted provided that the following conditions
 62589  // are met:
 62590  // 1. Redistributions of source code must retain the above copyright
 62591  //    notice, this list of conditions and the following disclaimer.
 62592  // 2. Redistributions in binary form must reproduce the above copyright
 62593  //    notice, this list of conditions and the following disclaimer in the
 62594  //    documentation and/or other materials provided with the distribution.
 62595  // 3. Neither the name of the University nor the names of its contributors
 62596  //    may be used to endorse or promote products derived from this software
 62597  //    without specific prior written permission.
 62598  //
 62599  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 62600  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 62601  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 62602  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 62603  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 62604  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 62605  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 62606  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 62607  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 62608  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 62609  // SUCH DAMAGE.
 62610  //
 62611  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 62612  // $FreeBSD$
 62613  
 62614  // -
 62615  // SPDX-License-Identifier: BSD-3-Clause
 62616  //
 62617  // Copyright (c) 1991, 1993
 62618  //	The Regents of the University of California.  All rights reserved.
 62619  //
 62620  // This code is derived from software contributed to Berkeley by
 62621  // Berkeley Software Design, Inc.
 62622  //
 62623  // Redistribution and use in source and binary forms, with or without
 62624  // modification, are permitted provided that the following conditions
 62625  // are met:
 62626  // 1. Redistributions of source code must retain the above copyright
 62627  //    notice, this list of conditions and the following disclaimer.
 62628  // 2. Redistributions in binary form must reproduce the above copyright
 62629  //    notice, this list of conditions and the following disclaimer in the
 62630  //    documentation and/or other materials provided with the distribution.
 62631  // 3. Neither the name of the University nor the names of its contributors
 62632  //    may be used to endorse or promote products derived from this software
 62633  //    without specific prior written permission.
 62634  //
 62635  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 62636  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 62637  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 62638  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 62639  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 62640  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 62641  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 62642  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 62643  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 62644  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 62645  // SUCH DAMAGE.
 62646  //
 62647  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 62648  // $FreeBSD$
 62649  
 62650  // Unlike other ANSI header files, <assert.h> may usefully be included
 62651  // multiple times, with and without NDEBUG defined.
 62652  
 62653  // Convert binary to hex.  The input zBuf[] contains N bytes of
 62654  // binary data.  zBuf[] is 2*n+1 bytes long.  Overwrite zBuf[]
 62655  // with a hexadecimal representation of its original binary input.
 62656  func sqlite3TestBinToHex(tls *libc.TLS, zBuf uintptr, N int32) { /* test_hexio.c:36:6: */
 62657  	bp := tls.Alloc(17)
 62658  	defer tls.Free(17)
 62659  
 62660  	*(*[17]uint8)(unsafe.Pointer(bp /* zHex */)) = *(*[17]uint8)(unsafe.Pointer(ts + 32423 /* "0123456789ABCDEF" */))
 62661  	var i int32
 62662  	var j int32
 62663  	var c uint8
 62664  	i = (N * 2)
 62665  	*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = uint8(0)
 62666  	for j = (N - 1); j >= 0; j-- {
 62667  		c = *(*uint8)(unsafe.Pointer(zBuf + uintptr(j)))
 62668  		*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = *(*uint8)(unsafe.Pointer(bp /* &zHex[0] */ + uintptr((int32(c) & 0xf))))
 62669  		*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = *(*uint8)(unsafe.Pointer(bp /* &zHex[0] */ + uintptr((int32(c) >> 4))))
 62670  	}
 62671  
 62672  }
 62673  
 62674  // Convert hex to binary.  The input zIn[] contains N bytes of
 62675  // hexadecimal.  Convert this into binary and write aOut[] with
 62676  // the binary data.  Spaces in the original input are ignored.
 62677  // Return the number of bytes of binary rendered.
 62678  func sqlite3TestHexToBin(tls *libc.TLS, zIn uintptr, N int32, aOut uintptr) int32 { /* test_hexio.c:56:5: */
 62679  	bp := tls.Alloc(256)
 62680  	defer tls.Free(256)
 62681  
 62682  	*(*[256]uint8)(unsafe.Pointer(bp /* aMap */)) = [256]uint8{
 62683  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62684  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62685  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62686  		uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), uint8(10), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62687  		uint8(0), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62688  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62689  		uint8(0), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62690  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62691  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62692  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62693  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62694  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62695  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62696  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62697  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62698  		uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0), uint8(0),
 62699  	}
 62700  	var i int32
 62701  	var j int32
 62702  	var hi int32 = 1
 62703  	var c uint8
 62704  
 62705  	for i = libc.AssignInt32(&j, 0); i < N; i++ {
 62706  		c = *(*uint8)(unsafe.Pointer(bp /* &aMap[0] */ + uintptr(*(*uint8)(unsafe.Pointer(zIn + uintptr(i))))))
 62707  		if int32(c) == 0 {
 62708  			continue
 62709  		}
 62710  		if hi != 0 {
 62711  			*(*uint8)(unsafe.Pointer(aOut + uintptr(j))) = (uint8((int32(c) - 1) << 4))
 62712  			hi = 0
 62713  		} else {
 62714  			*(*uint8)(unsafe.Pointer(aOut + uintptr(libc.PostIncInt32(&j, 1)))) |= uint8((int32(c) - 1))
 62715  			hi = 1
 62716  		}
 62717  	}
 62718  	return j
 62719  }
 62720  
 62721  // Usage:   hexio_read  FILENAME  OFFSET  AMT
 62722  //
 62723  // Read AMT bytes from file FILENAME beginning at OFFSET from the
 62724  // beginning of the file.  Convert that information to hexadecimal
 62725  // and return the resulting HEX string.
 62726  func hexio_read(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:101:26: */
 62727  	bp := tls.Alloc(48)
 62728  	defer tls.Free(48)
 62729  
 62730  	// var offset int32 at bp+40, 4
 62731  
 62732  	// var amt int32 at bp+44, 4
 62733  
 62734  	var got int32
 62735  	var zFile uintptr
 62736  	var zBuf uintptr
 62737  	var in uintptr
 62738  
 62739  	if objc != 4 {
 62740  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32440 /* "FILENAME OFFSET ..." */)
 62741  		return TCL_ERROR
 62742  	}
 62743  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &offset */) != 0 {
 62744  		return TCL_ERROR
 62745  	}
 62746  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+44 /* &amt */) != 0 {
 62747  		return TCL_ERROR
 62748  	}
 62749  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 62750  	zBuf = sqlite3.Xsqlite3_malloc(tls, ((*(*int32)(unsafe.Pointer(bp + 44 /* amt */)) * 2) + 1))
 62751  	if zBuf == uintptr(0) {
 62752  		return TCL_ERROR
 62753  	}
 62754  	in = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 62755  	if in == uintptr(0) {
 62756  		in = libc.Xfopen(tls, zFile, ts+32460 /* "r" */)
 62757  	}
 62758  	if in == uintptr(0) {
 62759  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32462 /* "cannot open inpu..." */, zFile, 0))
 62760  		return TCL_ERROR
 62761  	}
 62762  	libc.Xfseek(tls, in, int64(*(*int32)(unsafe.Pointer(bp + 40 /* offset */))), SEEK_SET)
 62763  	got = int32(libc.Xfread(tls, zBuf, uint64(1), uint64(*(*int32)(unsafe.Pointer(bp + 44 /* amt */))), in))
 62764  	libc.Xfclose(tls, in)
 62765  	if got < 0 {
 62766  		got = 0
 62767  	}
 62768  	sqlite3TestBinToHex(tls, zBuf, got)
 62769  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, zBuf, 0))
 62770  	sqlite3.Xsqlite3_free(tls, zBuf)
 62771  	return TCL_OK
 62772  }
 62773  
 62774  // Usage:   hexio_write  FILENAME  OFFSET  DATA
 62775  //
 62776  // Write DATA into file FILENAME beginning at OFFSET from the
 62777  // beginning of the file.  DATA is expressed in hexadecimal.
 62778  func hexio_write(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:151:26: */
 62779  	bp := tls.Alloc(32)
 62780  	defer tls.Free(32)
 62781  
 62782  	// var offset int32 at bp+24, 4
 62783  
 62784  	// var nIn int32 at bp+28, 4
 62785  
 62786  	var nOut int32
 62787  	var written int32
 62788  	var zFile uintptr
 62789  	var zIn uintptr
 62790  	var aOut uintptr
 62791  	var out uintptr
 62792  
 62793  	if objc != 4 {
 62794  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32486 /* "FILENAME OFFSET ..." */)
 62795  		return TCL_ERROR
 62796  	}
 62797  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+24 /* &offset */) != 0 {
 62798  		return TCL_ERROR
 62799  	}
 62800  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 62801  	zIn = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+28 /* &nIn */)
 62802  	aOut = sqlite3.Xsqlite3_malloc(tls, (1 + (*(*int32)(unsafe.Pointer(bp + 28 /* nIn */)) / 2)))
 62803  	if aOut == uintptr(0) {
 62804  		return TCL_ERROR
 62805  	}
 62806  	nOut = sqlite3TestHexToBin(tls, zIn, *(*int32)(unsafe.Pointer(bp + 28 /* nIn */)), aOut)
 62807  	out = libc.Xfopen(tls, zFile, ts+32510 /* "r+b" */)
 62808  	if out == uintptr(0) {
 62809  		out = libc.Xfopen(tls, zFile, ts+32514 /* "r+" */)
 62810  	}
 62811  	if out == uintptr(0) {
 62812  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32517 /* "cannot open outp..." */, zFile, 0))
 62813  		return TCL_ERROR
 62814  	}
 62815  	libc.Xfseek(tls, out, int64(*(*int32)(unsafe.Pointer(bp + 24 /* offset */))), SEEK_SET)
 62816  	written = int32(libc.Xfwrite(tls, aOut, uint64(1), uint64(nOut), out))
 62817  	sqlite3.Xsqlite3_free(tls, aOut)
 62818  	libc.Xfclose(tls, out)
 62819  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, written))
 62820  	return TCL_OK
 62821  }
 62822  
 62823  // USAGE:   hexio_get_int   HEXDATA
 62824  //
 62825  // Interpret the HEXDATA argument as a big-endian integer.  Return
 62826  // the value of that integer.  HEXDATA can contain between 2 and 8
 62827  // hexadecimal digits.
 62828  func hexio_get_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:199:26: */
 62829  	bp := tls.Alloc(8)
 62830  	defer tls.Free(8)
 62831  
 62832  	var val int32
 62833  	// var nIn int32 at bp, 4
 62834  
 62835  	var nOut int32
 62836  	var zIn uintptr
 62837  	var aOut uintptr
 62838  	// var aNum [4]uint8 at bp+4, 4
 62839  
 62840  	if objc != 2 {
 62841  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32542 /* "HEXDATA" */)
 62842  		return TCL_ERROR
 62843  	}
 62844  	zIn = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &nIn */)
 62845  	aOut = sqlite3.Xsqlite3_malloc(tls, (1 + (*(*int32)(unsafe.Pointer(bp /* nIn */)) / 2)))
 62846  	if aOut == uintptr(0) {
 62847  		return TCL_ERROR
 62848  	}
 62849  	nOut = sqlite3TestHexToBin(tls, zIn, *(*int32)(unsafe.Pointer(bp /* nIn */)), aOut)
 62850  	if nOut >= 4 {
 62851  		libc.Xmemcpy(tls, bp+4 /* &aNum[0] */, aOut, uint64(4))
 62852  	} else {
 62853  		libc.Xmemset(tls, bp+4 /* &aNum[0] */, 0, uint64(unsafe.Sizeof([4]uint8{})))
 62854  		libc.Xmemcpy(tls, (bp + 4 /* &aNum */ + uintptr((4 - nOut))), aOut, uint64(nOut))
 62855  	}
 62856  	sqlite3.Xsqlite3_free(tls, aOut)
 62857  	val = ((((int32(*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */))) << 24) | (int32(*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 1))) << 16)) | (int32(*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 2))) << 8)) | int32(*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 3))))
 62858  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, val))
 62859  	return TCL_OK
 62860  }
 62861  
 62862  // USAGE:   hexio_render_int16   INTEGER
 62863  //
 62864  // Render INTEGER has a 16-bit big-endian integer in hexadecimal.
 62865  func hexio_render_int16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:239:26: */
 62866  	bp := tls.Alloc(14)
 62867  	defer tls.Free(14)
 62868  
 62869  	// var val int32 at bp, 4
 62870  
 62871  	// var aNum [10]uint8 at bp+4, 10
 62872  
 62873  	if objc != 2 {
 62874  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2274 /* "INTEGER" */)
 62875  		return TCL_ERROR
 62876  	}
 62877  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &val */) != 0 {
 62878  		return TCL_ERROR
 62879  	}
 62880  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 8))
 62881  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 1)) = uint8(*(*int32)(unsafe.Pointer(bp /* val */)))
 62882  	sqlite3TestBinToHex(tls, bp+4 /* &aNum[0] */, 2)
 62883  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+4 /* aNum */, 4))
 62884  	return TCL_OK
 62885  }
 62886  
 62887  // USAGE:   hexio_render_int32   INTEGER
 62888  //
 62889  // Render INTEGER has a 32-bit big-endian integer in hexadecimal.
 62890  func hexio_render_int32(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:266:26: */
 62891  	bp := tls.Alloc(14)
 62892  	defer tls.Free(14)
 62893  
 62894  	// var val int32 at bp, 4
 62895  
 62896  	// var aNum [10]uint8 at bp+4, 10
 62897  
 62898  	if objc != 2 {
 62899  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2274 /* "INTEGER" */)
 62900  		return TCL_ERROR
 62901  	}
 62902  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &val */) != 0 {
 62903  		return TCL_ERROR
 62904  	}
 62905  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 24))
 62906  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 1)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 16))
 62907  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 2)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 8))
 62908  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 3)) = uint8(*(*int32)(unsafe.Pointer(bp /* val */)))
 62909  	sqlite3TestBinToHex(tls, bp+4 /* &aNum[0] */, 4)
 62910  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+4 /* aNum */, 8))
 62911  	return TCL_OK
 62912  }
 62913  
 62914  // USAGE:  utf8_to_utf8  HEX
 62915  //
 62916  // The argument is a UTF8 string represented in hexadecimal.
 62917  // The UTF8 might not be well-formed.  Run this string through
 62918  // sqlite3Utf8to8() convert it back to hex and return the result.
 62919  func utf8_to_utf8(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:296:26: */
 62920  	bp := tls.Alloc(16)
 62921  	defer tls.Free(16)
 62922  
 62923  	tcl.XTcl_AppendResult(tls, interp,
 62924  		libc.VaList(bp, ts+32550 /* "[utf8_to_utf8] u..." */, 0))
 62925  	return TCL_ERROR
 62926  }
 62927  
 62928  func getFts3Varint(tls *libc.TLS, p uintptr, v uintptr) int32 { /* test_hexio.c:328:12: */
 62929  	var q uintptr = p
 62930  	var x sqlite_uint64 = uint64(0)
 62931  	var y sqlite_uint64 = uint64(1)
 62932  	for (int32(*(*uint8)(unsafe.Pointer(q))) & 0x80) == 0x80 {
 62933  		x = x + (y * (sqlite_uint64(int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1)))) & 0x7f)))
 62934  		y <<= 7
 62935  	}
 62936  	x = x + (y * (sqlite_uint64(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1))))))
 62937  	*(*sqlite_int64)(unsafe.Pointer(v)) = sqlite_int64(x)
 62938  	return (int32((int64(q) - int64(p)) / 1))
 62939  }
 62940  
 62941  func putFts3Varint(tls *libc.TLS, p uintptr, v sqlite_int64) int32 { /* test_hexio.c:340:12: */
 62942  	var q uintptr = p
 62943  	var vu sqlite_uint64 = sqlite_uint64(v)
 62944  	for ok := true; ok; ok = (vu != uint64(0)) {
 62945  		*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1))) = (uint8((vu & uint64(0x7f)) | uint64(0x80)))
 62946  		vu >>= 7
 62947  	}
 62948  	*(*uint8)(unsafe.Pointer(q + libc.UintptrFromInt32(-1))) &= uint8((0x7f)) // turn off high bit in final byte
 62949  
 62950  	return (int32((int64(q) - int64(p)) / 1))
 62951  }
 62952  
 62953  // USAGE:  read_fts3varint BLOB VARNAME
 62954  //
 62955  // Read a varint from the start of BLOB. Set variable VARNAME to contain
 62956  // the interpreted value. Return the number of bytes of BLOB consumed.
 62957  func read_fts3varint(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:358:26: */
 62958  	bp := tls.Alloc(16)
 62959  	defer tls.Free(16)
 62960  
 62961  	// var nBlob int32 at bp, 4
 62962  
 62963  	var zBlob uintptr
 62964  	// var iVal sqlite3_int64 at bp+8, 8
 62965  
 62966  	var nVal int32
 62967  
 62968  	if objc != 3 {
 62969  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32604 /* "BLOB VARNAME" */)
 62970  		return TCL_ERROR
 62971  	}
 62972  	zBlob = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &nBlob */)
 62973  
 62974  	nVal = getFts3Varint(tls, zBlob, bp+8 /* &iVal */)
 62975  	tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(0), tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* iVal */))), 0)
 62976  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nVal))
 62977  	return TCL_OK
 62978  }
 62979  
 62980  // USAGE:  make_fts3record ARGLIST
 62981  func make_fts3record(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:384:26: */
 62982  	bp := tls.Alloc(28)
 62983  	defer tls.Free(28)
 62984  
 62985  	*(*uintptr)(unsafe.Pointer(bp + 8 /* aArg */)) = uintptr(0)
 62986  	*(*int32)(unsafe.Pointer(bp /* nArg */)) = 0
 62987  	var aOut uintptr = uintptr(0)
 62988  	var nOut int32 = 0
 62989  	var nAlloc int32 = 0
 62990  	var i int32
 62991  
 62992  	if objc != 2 {
 62993  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32617 /* "LIST" */)
 62994  		return TCL_ERROR
 62995  	}
 62996  	if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &nArg */, bp+8 /* &aArg */) != 0 {
 62997  		return TCL_ERROR
 62998  	}
 62999  
 63000  	for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nArg */)); i++ {
 63001  		// var iVal sqlite3_int64 at bp+16, 8
 63002  
 63003  		if TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* aArg */)) + uintptr(i)*8)), bp+16 /* &iVal */) {
 63004  			if (nOut + 10) > nAlloc {
 63005  				var nNew int32
 63006  				if nAlloc != 0 {
 63007  					nNew = (nAlloc * 2)
 63008  				} else {
 63009  					nNew = 128
 63010  				}
 63011  				var aNew uintptr = sqlite3.Xsqlite3_realloc(tls, aOut, nNew)
 63012  				if aNew == uintptr(0) {
 63013  					sqlite3.Xsqlite3_free(tls, aOut)
 63014  					return TCL_ERROR
 63015  				}
 63016  				aOut = aNew
 63017  				nAlloc = nNew
 63018  			}
 63019  			nOut = nOut + (putFts3Varint(tls, (aOut + uintptr(nOut)), *(*sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */))))
 63020  		} else {
 63021  			*(*int32)(unsafe.Pointer(bp + 24 /* nVal */)) = 0
 63022  			var zVal uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* aArg */)) + uintptr(i)*8)), bp+24 /* &nVal */)
 63023  			for (nOut + *(*int32)(unsafe.Pointer(bp + 24 /* nVal */))) > nAlloc {
 63024  				var nNew int32
 63025  				if nAlloc != 0 {
 63026  					nNew = (nAlloc * 2)
 63027  				} else {
 63028  					nNew = 128
 63029  				}
 63030  				var aNew uintptr = sqlite3.Xsqlite3_realloc(tls, aOut, nNew)
 63031  				if aNew == uintptr(0) {
 63032  					sqlite3.Xsqlite3_free(tls, aOut)
 63033  					return TCL_ERROR
 63034  				}
 63035  				aOut = aNew
 63036  				nAlloc = nNew
 63037  			}
 63038  			libc.Xmemcpy(tls, (aOut + uintptr(nOut)), zVal, uint64(*(*int32)(unsafe.Pointer(bp + 24 /* nVal */))))
 63039  			nOut = nOut + (*(*int32)(unsafe.Pointer(bp + 24 /* nVal */)))
 63040  		}
 63041  	}
 63042  
 63043  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, aOut, nOut))
 63044  	sqlite3.Xsqlite3_free(tls, aOut)
 63045  	return TCL_OK
 63046  }
 63047  
 63048  // Register commands with the TCL interpreter.
 63049  func Sqlitetest_hexio_Init(tls *libc.TLS, interp uintptr) int32 { /* test_hexio.c:446:5: */
 63050  	var i int32
 63051  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd8)) / uint64(unsafe.Sizeof(struct {
 63052  		FzName uintptr
 63053  		FxProc uintptr
 63054  	}{}))); i++ {
 63055  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd8[i].FzName, aObjCmd8[i].FxProc, uintptr(0), uintptr(0))
 63056  	}
 63057  	return TCL_OK
 63058  }
 63059  
 63060  var aObjCmd8 = [8]struct {
 63061  	FzName uintptr
 63062  	FxProc uintptr
 63063  }{
 63064  	{FzName: ts + 32622 /* "hexio_read" */, FxProc: 0},
 63065  	{FzName: ts + 32633 /* "hexio_write" */, FxProc: 0},
 63066  	{FzName: ts + 32645 /* "hexio_get_int" */, FxProc: 0},
 63067  	{FzName: ts + 32659 /* "hexio_render_int..." */, FxProc: 0},
 63068  	{FzName: ts + 32678 /* "hexio_render_int..." */, FxProc: 0},
 63069  	{FzName: ts + 32697 /* "utf8_to_utf8" */, FxProc: 0},
 63070  	{FzName: ts + 32710 /* "read_fts3varint" */, FxProc: 0},
 63071  	{FzName: ts + 32726 /* "make_fts3record" */, FxProc: 0},
 63072  } /* test_hexio.c:450:5 */
 63073  
 63074  // end block for C++
 63075  
 63076  // Local Variables:
 63077  // mode: c
 63078  // c-basic-offset: 4
 63079  // fill-column: 78
 63080  // End:
 63081  
 63082  type Wrapped = struct {
 63083  	Fpcache      sqlite3_pcache_methods2
 63084  	Fmem         sqlite3_mem_methods
 63085  	Fmutex       sqlite3_mutex_methods
 63086  	Fmem_init    int32
 63087  	Fmem_fail    int32
 63088  	Fmutex_init  int32
 63089  	Fmutex_fail  int32
 63090  	Fpcache_init int32
 63091  	Fpcache_fail int32
 63092  } /* test_init.c:36:8 */
 63093  
 63094  // end block for C++
 63095  
 63096  // Local Variables:
 63097  // mode: c
 63098  // c-basic-offset: 4
 63099  // fill-column: 78
 63100  // End:
 63101  
 63102  var wrapped Wrapped /* test_init.c:47:3: */
 63103  
 63104  func wrMemInit(tls *libc.TLS, pAppData uintptr) int32 { /* test_init.c:49:12: */
 63105  	var rc int32
 63106  	if wrapped.Fmem_fail != 0 {
 63107  		rc = SQLITE_ERROR
 63108  	} else {
 63109  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 40 /* &.xInit */))))(tls, wrapped.Fmem.FpAppData)
 63110  	}
 63111  	if rc == SQLITE_OK {
 63112  		wrapped.Fmem_init = 1
 63113  	}
 63114  	return rc
 63115  }
 63116  
 63117  func wrMemShutdown(tls *libc.TLS, pAppData uintptr) { /* test_init.c:61:13: */
 63118  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 48 /* &.xShutdown */))))(tls, wrapped.Fmem.FpAppData)
 63119  	wrapped.Fmem_init = 0
 63120  }
 63121  
 63122  func wrMemMalloc(tls *libc.TLS, n int32) uintptr { /* test_init.c:65:13: */
 63123  	return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ /* &.xMalloc */))))(tls, n)
 63124  }
 63125  
 63126  func wrMemFree(tls *libc.TLS, p uintptr) { /* test_init.c:66:13: */
 63127  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 8 /* &.xFree */))))(tls, p)
 63128  }
 63129  
 63130  func wrMemRealloc(tls *libc.TLS, p uintptr, n int32) uintptr { /* test_init.c:67:13: */
 63131  	return (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 16 /* &.xRealloc */))))(tls, p, n)
 63132  }
 63133  
 63134  func wrMemSize(tls *libc.TLS, p uintptr) int32 { /* test_init.c:68:12: */
 63135  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 24 /* &.xSize */))))(tls, p)
 63136  }
 63137  
 63138  func wrMemRoundup(tls *libc.TLS, n int32) int32 { /* test_init.c:69:12: */
 63139  	return (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 104 /* &.mem */ + 32 /* &.xRoundup */))))(tls, n)
 63140  }
 63141  
 63142  func wrMutexInit(tls *libc.TLS) int32 { /* test_init.c:72:12: */
 63143  	var rc int32
 63144  	if wrapped.Fmutex_fail != 0 {
 63145  		rc = SQLITE_ERROR
 63146  	} else {
 63147  		rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ /* &.xMutexInit */))))(tls)
 63148  	}
 63149  	if rc == SQLITE_OK {
 63150  		wrapped.Fmutex_init = 1
 63151  	}
 63152  	return rc
 63153  }
 63154  
 63155  func wrMutexEnd(tls *libc.TLS) int32 { /* test_init.c:84:12: */
 63156  	(*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 8 /* &.xMutexEnd */))))(tls)
 63157  	wrapped.Fmutex_init = 0
 63158  	return SQLITE_OK
 63159  }
 63160  
 63161  func wrMutexAlloc(tls *libc.TLS, e int32) uintptr { /* test_init.c:89:22: */
 63162  	return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 16 /* &.xMutexAlloc */))))(tls, e)
 63163  }
 63164  
 63165  func wrMutexFree(tls *libc.TLS, p uintptr) { /* test_init.c:92:13: */
 63166  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 24 /* &.xMutexFree */))))(tls, p)
 63167  }
 63168  
 63169  func wrMutexEnter(tls *libc.TLS, p uintptr) { /* test_init.c:95:13: */
 63170  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 32 /* &.xMutexEnter */))))(tls, p)
 63171  }
 63172  
 63173  func wrMutexTry(tls *libc.TLS, p uintptr) int32 { /* test_init.c:98:12: */
 63174  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 40 /* &.xMutexTry */))))(tls, p)
 63175  }
 63176  
 63177  func wrMutexLeave(tls *libc.TLS, p uintptr) { /* test_init.c:101:13: */
 63178  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 48 /* &.xMutexLeave */))))(tls, p)
 63179  }
 63180  
 63181  func wrMutexHeld(tls *libc.TLS, p uintptr) int32 { /* test_init.c:104:12: */
 63182  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 56 /* &.xMutexHeld */))))(tls, p)
 63183  }
 63184  
 63185  func wrMutexNotheld(tls *libc.TLS, p uintptr) int32 { /* test_init.c:107:12: */
 63186  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 168 /* &.mutex */ + 64 /* &.xMutexNotheld */))))(tls, p)
 63187  }
 63188  
 63189  func wrPCacheInit(tls *libc.TLS, pArg uintptr) int32 { /* test_init.c:113:12: */
 63190  	var rc int32
 63191  	if wrapped.Fpcache_fail != 0 {
 63192  		rc = SQLITE_ERROR
 63193  	} else {
 63194  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 16 /* &.xInit */))))(tls, wrapped.Fpcache.FpArg)
 63195  	}
 63196  	if rc == SQLITE_OK {
 63197  		wrapped.Fpcache_init = 1
 63198  	}
 63199  	return rc
 63200  }
 63201  
 63202  func wrPCacheShutdown(tls *libc.TLS, pArg uintptr) { /* test_init.c:125:13: */
 63203  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 24 /* &.xShutdown */))))(tls, wrapped.Fpcache.FpArg)
 63204  	wrapped.Fpcache_init = 0
 63205  }
 63206  
 63207  func wrPCacheCreate(tls *libc.TLS, a int32, b int32, c int32) uintptr { /* test_init.c:130:23: */
 63208  	return (*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 32 /* &.xCreate */))))(tls, a, b, c)
 63209  }
 63210  
 63211  func wrPCacheCachesize(tls *libc.TLS, p uintptr, n int32) { /* test_init.c:133:13: */
 63212  	(*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 40 /* &.xCachesize */))))(tls, p, n)
 63213  }
 63214  
 63215  func wrPCachePagecount(tls *libc.TLS, p uintptr) int32 { /* test_init.c:136:12: */
 63216  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 48 /* &.xPagecount */))))(tls, p)
 63217  }
 63218  
 63219  func wrPCacheFetch(tls *libc.TLS, p uintptr, a uint32, b int32) uintptr { /* test_init.c:139:28: */
 63220  	return (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 56 /* &.xFetch */))))(tls, p, a, b)
 63221  }
 63222  
 63223  func wrPCacheUnpin(tls *libc.TLS, p uintptr, a uintptr, b int32) { /* test_init.c:142:13: */
 63224  	(*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 64 /* &.xUnpin */))))(tls, p, a, b)
 63225  }
 63226  
 63227  func wrPCacheRekey(tls *libc.TLS, p uintptr, a uintptr, b uint32, c uint32) { /* test_init.c:145:13: */
 63228  	(*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 72 /* &.xRekey */))))(tls, p, a, b, c)
 63229  }
 63230  
 63231  func wrPCacheTruncate(tls *libc.TLS, p uintptr, a uint32) { /* test_init.c:153:13: */
 63232  	(*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 80 /* &.xTruncate */))))(tls, p, a)
 63233  }
 63234  
 63235  func wrPCacheDestroy(tls *libc.TLS, p uintptr) { /* test_init.c:156:13: */
 63236  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 88 /* &.xDestroy */))))(tls, p)
 63237  }
 63238  
 63239  func installInitWrappers(tls *libc.TLS) { /* test_init.c:160:13: */
 63240  	bp := tls.Alloc(288)
 63241  	defer tls.Free(288)
 63242  
 63243  	*(*sqlite3_mutex_methods)(unsafe.Pointer(bp + 48 /* mutexmethods */)) = sqlite3_mutex_methods{
 63244  		FxMutexInit: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{wrMutexInit})), FxMutexEnd: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{wrMutexEnd})), FxMutexAlloc: *(*uintptr)(unsafe.Pointer(&struct {
 63245  			f func(*libc.TLS, int32) uintptr
 63246  		}{wrMutexAlloc})),
 63247  		FxMutexFree: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMutexFree})), FxMutexEnter: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMutexEnter})), FxMutexTry: *(*uintptr)(unsafe.Pointer(&struct {
 63248  			f func(*libc.TLS, uintptr) int32
 63249  		}{wrMutexTry})),
 63250  		FxMutexLeave: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMutexLeave})), FxMutexHeld: *(*uintptr)(unsafe.Pointer(&struct {
 63251  			f func(*libc.TLS, uintptr) int32
 63252  		}{wrMutexHeld})), FxMutexNotheld: *(*uintptr)(unsafe.Pointer(&struct {
 63253  			f func(*libc.TLS, uintptr) int32
 63254  		}{wrMutexNotheld})),
 63255  	}
 63256  	*(*sqlite3_pcache_methods2)(unsafe.Pointer(bp + 184 /* pcachemethods */)) = sqlite3_pcache_methods2{
 63257  		FiVersion: 1,
 63258  		FxInit: *(*uintptr)(unsafe.Pointer(&struct {
 63259  			f func(*libc.TLS, uintptr) int32
 63260  		}{wrPCacheInit})), FxShutdown: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrPCacheShutdown})), FxCreate: *(*uintptr)(unsafe.Pointer(&struct {
 63261  			f func(*libc.TLS, int32, int32, int32) uintptr
 63262  		}{wrPCacheCreate})),
 63263  		FxCachesize: *(*uintptr)(unsafe.Pointer(&struct {
 63264  			f func(*libc.TLS, uintptr, int32)
 63265  		}{wrPCacheCachesize})), FxPagecount: *(*uintptr)(unsafe.Pointer(&struct {
 63266  			f func(*libc.TLS, uintptr) int32
 63267  		}{wrPCachePagecount})), FxFetch: *(*uintptr)(unsafe.Pointer(&struct {
 63268  			f func(*libc.TLS, uintptr, uint32, int32) uintptr
 63269  		}{wrPCacheFetch})),
 63270  		FxUnpin: *(*uintptr)(unsafe.Pointer(&struct {
 63271  			f func(*libc.TLS, uintptr, uintptr, int32)
 63272  		}{wrPCacheUnpin})), FxRekey: *(*uintptr)(unsafe.Pointer(&struct {
 63273  			f func(*libc.TLS, uintptr, uintptr, uint32, uint32)
 63274  		}{wrPCacheRekey})), FxTruncate: *(*uintptr)(unsafe.Pointer(&struct {
 63275  			f func(*libc.TLS, uintptr, uint32)
 63276  		}{wrPCacheTruncate})),
 63277  		FxDestroy: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrPCacheDestroy})),
 63278  	}
 63279  	*(*sqlite3_mem_methods)(unsafe.Pointer(bp + 120 /* memmethods */)) = sqlite3_mem_methods{
 63280  		FxMalloc: *(*uintptr)(unsafe.Pointer(&struct {
 63281  			f func(*libc.TLS, int32) uintptr
 63282  		}{wrMemMalloc})), FxFree: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMemFree})), FxRealloc: *(*uintptr)(unsafe.Pointer(&struct {
 63283  			f func(*libc.TLS, uintptr, int32) uintptr
 63284  		}{wrMemRealloc})),
 63285  		FxSize: *(*uintptr)(unsafe.Pointer(&struct {
 63286  			f func(*libc.TLS, uintptr) int32
 63287  		}{wrMemSize})), FxRoundup: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{wrMemRoundup})), FxInit: *(*uintptr)(unsafe.Pointer(&struct {
 63288  			f func(*libc.TLS, uintptr) int32
 63289  		}{wrMemInit})),
 63290  		FxShutdown: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMemShutdown})),
 63291  	}
 63292  
 63293  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&wrapped)), 0, uint64(unsafe.Sizeof(wrapped)))
 63294  
 63295  	sqlite3.Xsqlite3_shutdown(tls)
 63296  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMUTEX, libc.VaList(bp, (uintptr(unsafe.Pointer(&wrapped))+168 /* &.mutex */)))
 63297  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp+8, (uintptr(unsafe.Pointer(&wrapped))+104 /* &.mem */)))
 63298  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETPCACHE2, libc.VaList(bp+16, (uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */)))
 63299  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+24, bp+48 /* &mutexmethods */))
 63300  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+32, bp+120 /* &memmethods */))
 63301  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+40, bp+184 /* &pcachemethods */))
 63302  }
 63303  
 63304  func init_wrapper_install(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:191:26: */
 63305  	bp := tls.Alloc(24)
 63306  	defer tls.Free(24)
 63307  
 63308  	var i int32
 63309  	installInitWrappers(tls)
 63310  	for i = 1; i < objc; i++ {
 63311  		var z uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)))
 63312  		if libc.Xstrcmp(tls, z, ts+32742 /* "mem" */) == 0 {
 63313  			wrapped.Fmem_fail = 1
 63314  		} else if libc.Xstrcmp(tls, z, ts+29345 /* "mutex" */) == 0 {
 63315  			wrapped.Fmutex_fail = 1
 63316  		} else if libc.Xstrcmp(tls, z, ts+32746 /* "pcache" */) == 0 {
 63317  			wrapped.Fpcache_fail = 1
 63318  		} else {
 63319  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32753 /* "Unknown argument..." */, z, ts+12415 /* "\"" */))
 63320  			return TCL_ERROR
 63321  		}
 63322  	}
 63323  	return TCL_OK
 63324  }
 63325  
 63326  func init_wrapper_uninstall(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:215:26: */
 63327  	bp := tls.Alloc(24)
 63328  	defer tls.Free(24)
 63329  
 63330  	if objc != 1 {
 63331  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 63332  		return TCL_ERROR
 63333  	}
 63334  
 63335  	sqlite3.Xsqlite3_shutdown(tls)
 63336  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp, (uintptr(unsafe.Pointer(&wrapped))+168 /* &.mutex */)))
 63337  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+8, (uintptr(unsafe.Pointer(&wrapped))+104 /* &.mem */)))
 63338  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+16, (uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */)))
 63339  	return TCL_OK
 63340  }
 63341  
 63342  func init_wrapper_clear(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:233:26: */
 63343  	if objc != 1 {
 63344  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 63345  		return TCL_ERROR
 63346  	}
 63347  
 63348  	wrapped.Fmem_fail = 0
 63349  	wrapped.Fmutex_fail = 0
 63350  	wrapped.Fpcache_fail = 0
 63351  	return TCL_OK
 63352  }
 63353  
 63354  func init_wrapper_query(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:250:26: */
 63355  	var pRet uintptr
 63356  
 63357  	if objc != 1 {
 63358  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 63359  		return TCL_ERROR
 63360  	}
 63361  
 63362  	pRet = tcl.XTcl_NewObj(tls)
 63363  	if wrapped.Fmutex_init != 0 {
 63364  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+29345 /* "mutex" */, -1))
 63365  	}
 63366  	if wrapped.Fmem_init != 0 {
 63367  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+32742 /* "mem" */, -1))
 63368  	}
 63369  	if wrapped.Fpcache_init != 0 {
 63370  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+32746 /* "pcache" */, -1))
 63371  	}
 63372  
 63373  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 63374  	return TCL_OK
 63375  }
 63376  
 63377  func Sqlitetest_init_Init(tls *libc.TLS, interp uintptr) int32 { /* test_init.c:278:5: */
 63378  	var i int32
 63379  
 63380  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd9)) / uint64(unsafe.Sizeof(struct {
 63381  		FzName uintptr
 63382  		FxProc uintptr
 63383  	}{}))); i++ {
 63384  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd9[i].FzName, aObjCmd9[i].FxProc, uintptr(0), uintptr(0))
 63385  	}
 63386  
 63387  	return TCL_OK
 63388  }
 63389  
 63390  var aObjCmd9 = [4]struct {
 63391  	FzName uintptr
 63392  	FxProc uintptr
 63393  }{
 63394  	{FzName: ts + 32773 /* "init_wrapper_ins..." */, FxProc: 0},
 63395  	{FzName: ts + 32794 /* "init_wrapper_que..." */, FxProc: 0},
 63396  	{FzName: ts + 32813 /* "init_wrapper_uni..." */, FxProc: 0},
 63397  	{FzName: ts + 32836 /* "init_wrapper_cle..." */, FxProc: 0},
 63398  } /* test_init.c:282:5 */
 63399  
 63400  //
 63401  // END OF REGISTRATION API
 63402  //
 63403  
 63404  //******* End of fts5.h ********
 63405  
 63406  // Make sure we can call this stuff from C++.
 63407  
 63408  // An sqlite3_intarray is an abstract type to stores an instance of
 63409  // an integer array.
 63410  type sqlite3_intarray1 = struct {
 63411  	Fn     int32
 63412  	_      [4]byte
 63413  	Fa     uintptr
 63414  	FxFree uintptr
 63415  } /* test_intarray.h:99:9 */
 63416  
 63417  //
 63418  // END OF REGISTRATION API
 63419  //
 63420  
 63421  //******* End of fts5.h ********
 63422  
 63423  // Make sure we can call this stuff from C++.
 63424  
 63425  // An sqlite3_intarray is an abstract type to stores an instance of
 63426  // an integer array.
 63427  type sqlite3_intarray = sqlite3_intarray1 /* test_intarray.h:99:33 */
 63428  
 63429  // Objects used internally by the virtual table implementation
 63430  type intarray_vtab1 = struct {
 63431  	Fbase     sqlite3_vtab
 63432  	FpContent uintptr
 63433  } /* test_intarray.c:41:9 */
 63434  
 63435  // Objects used internally by the virtual table implementation
 63436  type intarray_vtab = intarray_vtab1 /* test_intarray.c:41:30 */
 63437  type intarray_cursor1 = struct {
 63438  	Fbase sqlite3_vtab_cursor
 63439  	Fi    int32
 63440  	_     [4]byte
 63441  } /* test_intarray.c:42:9 */
 63442  
 63443  type intarray_cursor = intarray_cursor1 /* test_intarray.c:42:32 */
 63444  
 63445  // None of this works unless we have virtual tables.
 63446  
 63447  // Free an sqlite3_intarray object.
 63448  func intarrayFree(tls *libc.TLS, p uintptr) { /* test_intarray.c:64:13: */
 63449  	if (*sqlite3_intarray)(unsafe.Pointer(p)).FxFree != 0 {
 63450  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 16 /* &.xFree */))))(tls, (*sqlite3_intarray)(unsafe.Pointer(p)).Fa)
 63451  	}
 63452  	sqlite3.Xsqlite3_free(tls, p)
 63453  }
 63454  
 63455  // Table destructor for the intarray module.
 63456  func intarrayDestroy(tls *libc.TLS, p uintptr) int32 { /* test_intarray.c:74:12: */
 63457  	var pVtab uintptr = p
 63458  	sqlite3.Xsqlite3_free(tls, pVtab)
 63459  	return 0
 63460  }
 63461  
 63462  // Table constructor for the intarray module.
 63463  func intarrayCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_intarray.c:83:12: */
 63464  	var rc int32 = SQLITE_NOMEM
 63465  	var pVtab uintptr = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(intarray_vtab{})))
 63466  
 63467  	if pVtab != 0 {
 63468  		libc.Xmemset(tls, pVtab, 0, uint64(unsafe.Sizeof(intarray_vtab{})))
 63469  		(*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent = pAux
 63470  		rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+32855 /* "CREATE TABLE x(v..." */)
 63471  	}
 63472  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pVtab
 63473  	return rc
 63474  }
 63475  
 63476  // Open a new cursor on the intarray table.
 63477  func intarrayOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_intarray.c:106:12: */
 63478  	var rc int32 = SQLITE_NOMEM
 63479  	var pCur uintptr
 63480  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(intarray_cursor{})))
 63481  	if pCur != 0 {
 63482  		libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(intarray_cursor{})))
 63483  		*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 63484  		rc = SQLITE_OK
 63485  	}
 63486  	return rc
 63487  }
 63488  
 63489  // Close a intarray table cursor.
 63490  func intarrayClose(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:121:12: */
 63491  	var pCur uintptr = cur
 63492  	sqlite3.Xsqlite3_free(tls, pCur)
 63493  	return SQLITE_OK
 63494  }
 63495  
 63496  // Retrieve a column of data.
 63497  func intarrayColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_intarray.c:130:12: */
 63498  	var pCur uintptr = cur
 63499  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 63500  	if ((*intarray_cursor)(unsafe.Pointer(pCur)).Fi >= 0) && ((*intarray_cursor)(unsafe.Pointer(pCur)).Fi < (*sqlite3_intarray)(unsafe.Pointer((*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent)).Fn) {
 63501  		sqlite3.Xsqlite3_result_int64(tls, ctx, *(*sqlite3_int64)(unsafe.Pointer((*sqlite3_intarray)(unsafe.Pointer((*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent)).Fa + uintptr((*intarray_cursor)(unsafe.Pointer(pCur)).Fi)*8)))
 63502  	}
 63503  	return SQLITE_OK
 63504  }
 63505  
 63506  // Retrieve the current rowid.
 63507  func intarrayRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_intarray.c:142:12: */
 63508  	var pCur uintptr = cur
 63509  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite_int64((*intarray_cursor)(unsafe.Pointer(pCur)).Fi)
 63510  	return SQLITE_OK
 63511  }
 63512  
 63513  func intarrayEof(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:148:12: */
 63514  	var pCur uintptr = cur
 63515  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 63516  	return (libc.Bool32((*intarray_cursor)(unsafe.Pointer(pCur)).Fi >= (*sqlite3_intarray)(unsafe.Pointer((*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent)).Fn))
 63517  }
 63518  
 63519  // Advance the cursor to the next row.
 63520  func intarrayNext(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:157:12: */
 63521  	var pCur uintptr = cur
 63522  	(*intarray_cursor)(unsafe.Pointer(pCur)).Fi++
 63523  	return SQLITE_OK
 63524  }
 63525  
 63526  // Reset a intarray table cursor.
 63527  func intarrayFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_intarray.c:166:12: */
 63528  	var pCur uintptr = pVtabCursor
 63529  	(*intarray_cursor)(unsafe.Pointer(pCur)).Fi = 0
 63530  	return SQLITE_OK
 63531  }
 63532  
 63533  // Analyse the WHERE condition.
 63534  func intarrayBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_intarray.c:179:12: */
 63535  	return SQLITE_OK
 63536  }
 63537  
 63538  // A virtual table module that merely echos method calls into TCL
 63539  // variables.
 63540  var intarrayModule = sqlite3_module{ // iVersion
 63541  	FxCreate:     0, // xCreate - create a new virtual table
 63542  	FxConnect:    0, // xConnect - connect to an existing vtab
 63543  	FxBestIndex:  0, // xBestIndex - find the best query index
 63544  	FxDisconnect: 0, // xDisconnect - disconnect a vtab
 63545  	FxDestroy:    0, // xDestroy - destroy a vtab
 63546  	FxOpen:       0, // xOpen - open a cursor
 63547  	FxClose:      0, // xClose - close a cursor
 63548  	FxFilter:     0, // xFilter - configure scan constraints
 63549  	FxNext:       0, // xNext - advance a cursor
 63550  	FxEof:        0, // xEof
 63551  	FxColumn:     0, // xColumn - read data
 63552  	FxRowid:      0, // xRename
 63553  } /* test_intarray.c:187:23 */
 63554  
 63555  // Invoke this routine to create a specific instance of an intarray object.
 63556  // The new intarray object is returned by the 3rd parameter.
 63557  //
 63558  // Each intarray object corresponds to a virtual table in the TEMP table
 63559  // with a name of zName.
 63560  //
 63561  // Destroy the intarray object by dropping the virtual table.  If not done
 63562  // explicitly by the application, the virtual table will be dropped implicitly
 63563  // by the system when the database connection is closed.
 63564  func sqlite3_intarray_create(tls *libc.TLS, db uintptr, zName uintptr, ppReturn uintptr) int32 { /* test_intarray.c:223:16: */
 63565  	bp := tls.Alloc(16)
 63566  	defer tls.Free(16)
 63567  
 63568  	var rc int32 = SQLITE_OK
 63569  	var p uintptr
 63570  
 63571  	*(*uintptr)(unsafe.Pointer(ppReturn)) = libc.AssignUintptr(&p, sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(sqlite3_intarray{}))))
 63572  	if p == uintptr(0) {
 63573  		return SQLITE_NOMEM
 63574  	}
 63575  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(sqlite3_intarray{})))
 63576  	rc = sqlite3.Xsqlite3_create_module_v2(tls, db, zName, uintptr(unsafe.Pointer(&intarrayModule)), p,
 63577  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{intarrayFree})))
 63578  	if rc == SQLITE_OK {
 63579  		var zSql uintptr
 63580  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+32897, /* "CREATE VIRTUAL T..." */
 63581  			libc.VaList(bp, zName, zName))
 63582  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 63583  		sqlite3.Xsqlite3_free(tls, zSql)
 63584  	}
 63585  	return rc
 63586  }
 63587  
 63588  // Bind a new array array of integers to a specific intarray object.
 63589  //
 63590  // The array of integers bound must be unchanged for the duration of
 63591  // any query against the corresponding virtual table.  If the integer
 63592  // array does change or is deallocated undefined behavior will result.
 63593  func sqlite3_intarray_bind(tls *libc.TLS, pIntArray uintptr, nElements int32, aElements uintptr, xFree uintptr) int32 { /* test_intarray.c:257:16: */
 63594  	if (*sqlite3_intarray)(unsafe.Pointer(pIntArray)).FxFree != 0 {
 63595  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pIntArray + 16 /* &.xFree */))))(tls, (*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fa)
 63596  	}
 63597  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fn = nElements
 63598  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fa = aElements
 63599  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).FxFree = xFree
 63600  	return SQLITE_OK
 63601  }
 63602  
 63603  //    sqlite3_intarray_create  DB  NAME
 63604  //
 63605  // Invoke the sqlite3_intarray_create interface.  A string that becomes
 63606  // the first parameter to sqlite3_intarray_bind.
 63607  func test_intarray_create(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_intarray.c:300:26: */
 63608  	bp := tls.Alloc(148)
 63609  	defer tls.Free(148)
 63610  
 63611  	// var db uintptr at bp+32, 8
 63612  
 63613  	var zName uintptr
 63614  	// var pArray uintptr at bp+40, 8
 63615  
 63616  	var rc int32 = SQLITE_OK
 63617  	// var zPtr [100]int8 at bp+48, 100
 63618  
 63619  	if objc != 3 {
 63620  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 63621  		return TCL_ERROR
 63622  	}
 63623  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 63624  		return TCL_ERROR
 63625  	}
 63626  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 63627  	rc = sqlite3_intarray_create(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zName, bp+40 /* &pArray */)
 63628  	if rc != SQLITE_OK {
 63629  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 63630  		return TCL_ERROR
 63631  	}
 63632  	sqlite3TestMakePointerStr(tls, interp, bp+48 /* &zPtr[0] */, *(*uintptr)(unsafe.Pointer(bp + 40 /* pArray */)))
 63633  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, bp+48 /* &zPtr[0] */, uintptr(0)))
 63634  	return TCL_OK
 63635  }
 63636  
 63637  //    sqlite3_intarray_bind  INTARRAY  ?VALUE ...?
 63638  //
 63639  // Invoke the sqlite3_intarray_bind interface on the given array of integers.
 63640  func test_intarray_bind(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_intarray.c:335:26: */
 63641  	bp := tls.Alloc(40)
 63642  	defer tls.Free(40)
 63643  
 63644  	var pArray uintptr
 63645  	var rc int32 = SQLITE_OK
 63646  	var i int32
 63647  	var n int32
 63648  	var a uintptr
 63649  
 63650  	if objc < 2 {
 63651  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32935 /* "INTARRAY" */)
 63652  		return TCL_ERROR
 63653  	}
 63654  	pArray = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 63655  	n = (objc - 2)
 63656  	a = sqlite3.Xsqlite3_malloc64(tls, (uint64(uint64(unsafe.Sizeof(sqlite3_int64(0))) * uint64(n))))
 63657  	if a == uintptr(0) {
 63658  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32944 /* "SQLITE_NOMEM" */, uintptr(0)))
 63659  		return TCL_ERROR
 63660  	}
 63661  	for i = 0; i < n; i++ {
 63662  		*(*Tcl_WideInt)(unsafe.Pointer(bp + 32 /* x */)) = int64(0)
 63663  		tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + uintptr((i+2))*8)), bp+32 /* &x */)
 63664  		*(*sqlite3_int64)(unsafe.Pointer(a + uintptr(i)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 32 /* x */))
 63665  	}
 63666  	rc = sqlite3_intarray_bind(tls, pArray, n, a, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 63667  	if rc != SQLITE_OK {
 63668  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 63669  		return TCL_ERROR
 63670  	}
 63671  	return TCL_OK
 63672  }
 63673  
 63674  // Register commands with the TCL interpreter.
 63675  func Sqlitetestintarray_Init(tls *libc.TLS, interp uintptr) int32 { /* test_intarray.c:375:5: */
 63676  	var i int32
 63677  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd10)) / uint64(unsafe.Sizeof(struct {
 63678  		FzName      uintptr
 63679  		FxProc      uintptr
 63680  		FclientData uintptr
 63681  	}{}))); i++ {
 63682  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd10[i].FzName,
 63683  			aObjCmd10[i].FxProc, aObjCmd10[i].FclientData, uintptr(0))
 63684  	}
 63685  	return TCL_OK
 63686  }
 63687  
 63688  var aObjCmd10 = [2]struct {
 63689  	FzName      uintptr
 63690  	FxProc      uintptr
 63691  	FclientData uintptr
 63692  }{
 63693  	{FzName: ts + 32957 /* "sqlite3_intarray..." */, FxProc: 0},
 63694  	{FzName: ts + 32981 /* "sqlite3_intarray..." */, FxProc: 0},
 63695  } /* test_intarray.c:380:5 */
 63696  
 63697  // Maximum pathname length supported by the jt backend.
 63698  
 63699  // Name used to identify this VFS.
 63700  
 63701  type jt_file1 = struct {
 63702  	Fbase      sqlite3_file
 63703  	FzName     uintptr
 63704  	Fflags     int32
 63705  	FeLock     int32
 63706  	FnPage     u32
 63707  	FnPagesize u32
 63708  	FpWritable uintptr
 63709  	FaCksum    uintptr
 63710  	FnSync     int32
 63711  	_          [4]byte
 63712  	FiMaxOff   sqlite3_int64
 63713  	FpNext     uintptr
 63714  	FpReal     uintptr
 63715  } /* test_journal.c:111:9 */
 63716  
 63717  // Maximum pathname length supported by the jt backend.
 63718  
 63719  // Name used to identify this VFS.
 63720  
 63721  type jt_file = jt_file1 /* test_journal.c:111:24 */
 63722  
 63723  var jt_vfs = sqlite3_vfs{
 63724  	FiVersion:          2,                               // iVersion
 63725  	FszOsFile:          int32(unsafe.Sizeof(jt_file{})), // szOsFile
 63726  	FmxPathname:        JT_MAX_PATHNAME,                 // pNext
 63727  	FzName:             ts + 33003,                      /* "jt" */ // pAppData
 63728  	FxOpen:             0,                               // xOpen
 63729  	FxDelete:           0,                               // xDelete
 63730  	FxAccess:           0,                               // xAccess
 63731  	FxFullPathname:     0,                               // xFullPathname
 63732  	FxDlOpen:           0,                               // xDlOpen
 63733  	FxDlError:          0,                               // xDlError
 63734  	FxDlSym:            0,                               // xDlSym
 63735  	FxDlClose:          0,                               // xDlClose
 63736  	FxRandomness:       0,                               // xRandomness
 63737  	FxSleep:            0,                               // xSleep
 63738  	FxCurrentTime:      0,                               // xCurrentTime
 63739  	FxGetLastError:     0,                               // xGetLastError
 63740  	FxCurrentTimeInt64: 0,                               // xCurrentTimeInt64
 63741  } /* test_journal.c:165:20 */
 63742  
 63743  var jt_io_methods = sqlite3_io_methods{
 63744  	FiVersion:               1, // iVersion
 63745  	FxClose:                 0, // xClose
 63746  	FxRead:                  0, // xRead
 63747  	FxWrite:                 0, // xWrite
 63748  	FxTruncate:              0, // xTruncate
 63749  	FxSync:                  0, // xSync
 63750  	FxFileSize:              0, // xFileSize
 63751  	FxLock:                  0, // xLock
 63752  	FxUnlock:                0, // xUnlock
 63753  	FxCheckReservedLock:     0, // xCheckReservedLock
 63754  	FxFileControl:           0, // xFileControl
 63755  	FxSectorSize:            0, // xSectorSize
 63756  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 63757  } /* test_journal.c:187:27 */
 63758  
 63759  type JtGlobal = struct {
 63760  	FpVfs  uintptr
 63761  	FpList uintptr
 63762  } /* test_journal.c:203:1 */
 63763  
 63764  var g2 = JtGlobal{} /* test_journal.c:207:24 */
 63765  
 63766  // Functions to obtain and relinquish a mutex to protect g.pList. The
 63767  // STATIC_PRNG mutex is reused, purely for the sake of convenience.
 63768  func enterJtMutex(tls *libc.TLS) { /* test_journal.c:213:13: */
 63769  	sqlite3.Xsqlite3_mutex_enter(tls, sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_STATIC_PRNG))
 63770  }
 63771  
 63772  func leaveJtMutex(tls *libc.TLS) { /* test_journal.c:216:13: */
 63773  	sqlite3.Xsqlite3_mutex_leave(tls, sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_STATIC_PRNG))
 63774  }
 63775  
 63776  func stop_ioerr_simulation(tls *libc.TLS, piSave uintptr, piSave2 uintptr) { /* test_journal.c:222:13: */
 63777  	*(*int32)(unsafe.Pointer(piSave)) = libc.AtomicLoadInt32(&sqlite3.Xsqlite3_io_error_pending)
 63778  	*(*int32)(unsafe.Pointer(piSave2)) = sqlite3.Xsqlite3_io_error_hit
 63779  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(-1))
 63780  	sqlite3.Xsqlite3_io_error_hit = 0
 63781  }
 63782  
 63783  func start_ioerr_simulation(tls *libc.TLS, iSave int32, iSave2 int32) { /* test_journal.c:228:13: */
 63784  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(iSave))
 63785  	sqlite3.Xsqlite3_io_error_hit = iSave2
 63786  }
 63787  
 63788  // The jt_file pointed to by the argument may or may not be a file-handle
 63789  // open on a main database file. If it is, and a transaction is currently
 63790  // opened on the file, then discard all transaction related data.
 63791  func closeTransaction(tls *libc.TLS, p uintptr) { /* test_journal.c:238:13: */
 63792  	sqlite3.Xsqlite3BitvecDestroy(tls, (*jt_file)(unsafe.Pointer(p)).FpWritable)
 63793  	sqlite3.Xsqlite3_free(tls, (*jt_file)(unsafe.Pointer(p)).FaCksum)
 63794  	(*jt_file)(unsafe.Pointer(p)).FpWritable = uintptr(0)
 63795  	(*jt_file)(unsafe.Pointer(p)).FaCksum = uintptr(0)
 63796  	(*jt_file)(unsafe.Pointer(p)).FnSync = 0
 63797  }
 63798  
 63799  // Close an jt-file.
 63800  func jtClose(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:249:12: */
 63801  	var pp uintptr
 63802  	var p uintptr = pFile
 63803  
 63804  	closeTransaction(tls, p)
 63805  	enterJtMutex(tls)
 63806  	if (*jt_file)(unsafe.Pointer(p)).FzName != 0 {
 63807  		for pp = (uintptr(unsafe.Pointer(&g2)) + 8 /* &.pList */); *(*uintptr)(unsafe.Pointer(pp)) != p; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 64 /* &.pNext */) {
 63808  		}
 63809  		*(*uintptr)(unsafe.Pointer(pp)) = (*jt_file)(unsafe.Pointer(p)).FpNext
 63810  	}
 63811  	leaveJtMutex(tls)
 63812  	sqlite3.Xsqlite3OsClose(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 63813  	return SQLITE_OK
 63814  }
 63815  
 63816  // Read data from an jt-file.
 63817  func jtRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_journal.c:267:12: */
 63818  	var p uintptr = pFile
 63819  	return sqlite3.Xsqlite3OsRead(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 63820  }
 63821  
 63822  //
 63823  // Parameter zJournal is the name of a journal file that is currently
 63824  // open. This function locates and returns the handle opened on the
 63825  // corresponding database file by the pager that currently has the
 63826  // journal file opened. This file-handle is identified by the
 63827  // following properties:
 63828  //
 63829  //   a) SQLITE_OPEN_MAIN_DB was specified when the file was opened.
 63830  //
 63831  //   b) The file-name specified when the file was opened matches
 63832  //      all but the final 8 characters of the journal file name.
 63833  //
 63834  //   c) There is currently a reserved lock on the file. This
 63835  //      condition is waived if the noLock argument is non-zero.
 63836  //
 63837  func locateDatabaseHandle(tls *libc.TLS, zJournal uintptr, noLock int32) uintptr { /* test_journal.c:292:16: */
 63838  	var pMain uintptr = uintptr(0)
 63839  	enterJtMutex(tls)
 63840  	for pMain = g2.FpList; pMain != 0; pMain = (*jt_file)(unsafe.Pointer(pMain)).FpNext {
 63841  		var nName int32 = (int32(libc.Xstrlen(tls, zJournal) - libc.Xstrlen(tls, ts+33006 /* "-journal" */)))
 63842  		if (((((*jt_file)(unsafe.Pointer(pMain)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) &&
 63843  			(int32(libc.Xstrlen(tls, (*jt_file)(unsafe.Pointer(pMain)).FzName)) == nName)) &&
 63844  			(0 == libc.Xmemcmp(tls, (*jt_file)(unsafe.Pointer(pMain)).FzName, zJournal, uint64(nName)))) &&
 63845  			(((*jt_file)(unsafe.Pointer(pMain)).FeLock >= SQLITE_LOCK_RESERVED) || (noLock != 0)) {
 63846  			break
 63847  		}
 63848  	}
 63849  	leaveJtMutex(tls)
 63850  	return pMain
 63851  }
 63852  
 63853  // Parameter z points to a buffer of 4 bytes in size containing a
 63854  // unsigned 32-bit integer stored in big-endian format. Decode the
 63855  // integer and return its value.
 63856  func decodeUint32(tls *libc.TLS, z uintptr) u32 { /* test_journal.c:314:12: */
 63857  	return (u32((((int32(*(*uint8)(unsafe.Pointer(z))) << 24) + (int32(*(*uint8)(unsafe.Pointer(z + 1))) << 16)) + (int32(*(*uint8)(unsafe.Pointer(z + 2))) << 8)) + int32(*(*uint8)(unsafe.Pointer(z + 3)))))
 63858  }
 63859  
 63860  // Calculate a checksum from the buffer of length n bytes pointed to
 63861  // by parameter z.
 63862  func genCksum(tls *libc.TLS, z uintptr, n int32) u32 { /* test_journal.c:322:12: */
 63863  	var i int32
 63864  	var cksum u32 = u32(0)
 63865  	for i = 0; i < n; i++ {
 63866  		cksum = ((cksum + u32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))) + (cksum << 3))
 63867  	}
 63868  	return cksum
 63869  }
 63870  
 63871  // The first argument, zBuf, points to a buffer containing a 28 byte
 63872  // serialized journal header. This function deserializes four of the
 63873  // integer fields contained in the journal header and writes their
 63874  // values to the output variables.
 63875  //
 63876  // SQLITE_OK is returned if the journal-header is successfully
 63877  // decoded. Otherwise, SQLITE_ERROR.
 63878  func decodeJournalHdr(tls *libc.TLS, zBuf uintptr, pnRec uintptr, pnPage uintptr, pnSector uintptr, pnPagesize uintptr) int32 { /* test_journal.c:340:12: */
 63879  	bp := tls.Alloc(8)
 63880  	defer tls.Free(8)
 63881  
 63882  	*(*[8]uint8)(unsafe.Pointer(bp /* aMagic */)) = [8]uint8{uint8(0xd9), uint8(0xd5), uint8(0x05), uint8(0xf9), uint8(0x20), uint8(0xa1), uint8(0x63), uint8(0xd7)}
 63883  	if libc.Xmemcmp(tls, bp /* &aMagic[0] */, zBuf, uint64(8)) != 0 {
 63884  		return SQLITE_ERROR
 63885  	}
 63886  	if pnRec != 0 {
 63887  		*(*u32)(unsafe.Pointer(pnRec)) = decodeUint32(tls, (zBuf + 8))
 63888  	}
 63889  	if pnPage != 0 {
 63890  		*(*u32)(unsafe.Pointer(pnPage)) = decodeUint32(tls, (zBuf + 16))
 63891  	}
 63892  	if pnSector != 0 {
 63893  		*(*u32)(unsafe.Pointer(pnSector)) = decodeUint32(tls, (zBuf + 20))
 63894  	}
 63895  	if pnPagesize != 0 {
 63896  		*(*u32)(unsafe.Pointer(pnPagesize)) = decodeUint32(tls, (zBuf + 24))
 63897  	}
 63898  	return SQLITE_OK
 63899  }
 63900  
 63901  // This function is called when a new transaction is opened, just after
 63902  // the first journal-header is written to the journal file.
 63903  func openTransaction(tls *libc.TLS, pMain uintptr, pJournal uintptr) int32 { /* test_journal.c:360:12: */
 63904  	bp := tls.Alloc(8)
 63905  	defer tls.Free(8)
 63906  
 63907  	var aData uintptr
 63908  	var p uintptr = (*jt_file)(unsafe.Pointer(pMain)).FpReal
 63909  	var rc int32 = SQLITE_OK
 63910  
 63911  	closeTransaction(tls, pMain)
 63912  	aData = sqlite3.Xsqlite3_malloc(tls, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 63913  	(*jt_file)(unsafe.Pointer(pMain)).FpWritable = sqlite3.Xsqlite3BitvecCreate(tls, (*jt_file)(unsafe.Pointer(pMain)).FnPage)
 63914  	(*jt_file)(unsafe.Pointer(pMain)).FaCksum = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(u32(0))) * (uint64((*jt_file)(unsafe.Pointer(pMain)).FnPage + u32(1))))))
 63915  	(*jt_file)(unsafe.Pointer(pJournal)).FiMaxOff = int64(0)
 63916  
 63917  	if (!(int32((*jt_file)(unsafe.Pointer(pMain)).FpWritable) != 0) || !(int32((*jt_file)(unsafe.Pointer(pMain)).FaCksum) != 0)) || !(aData != 0) {
 63918  		rc = (SQLITE_IOERR | (int32(12) << 8))
 63919  	} else if (*jt_file)(unsafe.Pointer(pMain)).FnPage > u32(0) {
 63920  		var iTrunk u32
 63921  		// var iSave int32 at bp, 4
 63922  
 63923  		// var iSave2 int32 at bp+4, 4
 63924  
 63925  		stop_ioerr_simulation(tls, bp /* &iSave */, bp+4 /* &iSave2 */)
 63926  
 63927  		// Read the database free-list. Add the page-number for each free-list
 63928  		// leaf to the jt_file.pWritable bitvec.
 63929  		rc = sqlite3.Xsqlite3OsRead(tls, p, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), int64(0))
 63930  		if rc == SQLITE_OK {
 63931  			var nDbsize u32 = decodeUint32(tls, (aData + 28))
 63932  			if (nDbsize > u32(0)) && (libc.Xmemcmp(tls, (aData+24), (aData+92), uint64(4)) == 0) {
 63933  				var iPg u32
 63934  				for iPg = (nDbsize + u32(1)); iPg <= (*jt_file)(unsafe.Pointer(pMain)).FnPage; iPg++ {
 63935  					sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, iPg)
 63936  				}
 63937  			}
 63938  		}
 63939  		iTrunk = decodeUint32(tls, (aData + 32))
 63940  		for (rc == SQLITE_OK) && (iTrunk > u32(0)) {
 63941  			var nLeaf u32
 63942  			var iLeaf u32
 63943  			var iOff sqlite3_int64 = ((i64(iTrunk - u32(1))) * i64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 63944  			rc = sqlite3.Xsqlite3OsRead(tls, p, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), iOff)
 63945  			nLeaf = decodeUint32(tls, (aData + 4))
 63946  			for iLeaf = u32(0); (rc == SQLITE_OK) && (iLeaf < nLeaf); iLeaf++ {
 63947  				var pgno u32 = decodeUint32(tls, (aData + uintptr((u32(8) + (u32(4) * iLeaf)))))
 63948  				sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)
 63949  			}
 63950  			iTrunk = decodeUint32(tls, aData)
 63951  		}
 63952  
 63953  		// Calculate and store a checksum for each page in the database file.
 63954  		if rc == SQLITE_OK {
 63955  			var ii int32
 63956  			for ii = 0; (rc == SQLITE_OK) && (ii < int32((*jt_file)(unsafe.Pointer(pMain)).FnPage)); ii++ {
 63957  				var iOff i64 = ((i64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize)) * i64(ii))
 63958  				if iOff == i64(sqlite3.Xsqlite3PendingByte) {
 63959  					continue
 63960  				}
 63961  				rc = sqlite3.Xsqlite3OsRead(tls, (*jt_file)(unsafe.Pointer(pMain)).FpReal, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), iOff)
 63962  				*(*u32)(unsafe.Pointer((*jt_file)(unsafe.Pointer(pMain)).FaCksum + uintptr(ii)*4)) = genCksum(tls, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 63963  				if ((ii + 1) == int32((*jt_file)(unsafe.Pointer(pMain)).FnPage)) && (rc == (SQLITE_IOERR | (int32(2) << 8))) {
 63964  					rc = SQLITE_OK
 63965  				}
 63966  			}
 63967  		}
 63968  
 63969  		start_ioerr_simulation(tls, *(*int32)(unsafe.Pointer(bp /* iSave */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSave2 */)))
 63970  	}
 63971  
 63972  	sqlite3.Xsqlite3_free(tls, aData)
 63973  	return rc
 63974  }
 63975  
 63976  // The first argument to this function is a handle open on a journal file.
 63977  // This function reads the journal file and adds the page number for each
 63978  // page in the journal to the Bitvec object passed as the second argument.
 63979  func readJournalFile(tls *libc.TLS, p uintptr, pMain uintptr) int32 { /* test_journal.c:433:12: */
 63980  	bp := tls.Alloc(52)
 63981  	defer tls.Free(52)
 63982  
 63983  	var rc int32
 63984  	// var zBuf [28]uint8 at bp+8, 28
 63985  
 63986  	var pReal uintptr
 63987  	var iOff sqlite3_int64
 63988  	var iSize sqlite3_int64
 63989  	var aPage uintptr
 63990  	// var iSave int32 at bp, 4
 63991  
 63992  	// var iSave2 int32 at bp+4, 4
 63993  
 63994  	var cksum u32
 63995  	_ = cksum
 63996  	var pgno u32
 63997  	// var nRec u32 at bp+36, 4
 63998  
 63999  	// var nPage u32 at bp+40, 4
 64000  
 64001  	// var nSector u32 at bp+44, 4
 64002  
 64003  	// var nPagesize u32 at bp+48, 4
 64004  
 64005  	var ii u32
 64006  	rc = SQLITE_OK
 64007  	pReal = (*jt_file)(unsafe.Pointer(p)).FpReal
 64008  	iOff = int64(0)
 64009  	iSize = (*jt_file)(unsafe.Pointer(p)).FiMaxOff
 64010  
 64011  	aPage = sqlite3.Xsqlite3_malloc(tls, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 64012  	if !(!(aPage != 0)) {
 64013  		goto __1
 64014  	}
 64015  	return (SQLITE_IOERR | (int32(12) << 8))
 64016  __1:
 64017  	;
 64018  
 64019  	stop_ioerr_simulation(tls, bp /* &iSave */, bp+4 /* &iSave2 */)
 64020  
 64021  __2:
 64022  	if !((rc == SQLITE_OK) && (iOff < iSize)) {
 64023  		goto __3
 64024  	}
 64025  
 64026  	// Read and decode the next journal-header from the journal file.
 64027  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 28, iOff)
 64028  	if !((rc != SQLITE_OK) ||
 64029  		(decodeJournalHdr(tls, bp+8 /* &zBuf[0] */, bp+36 /* &nRec */, bp+40 /* &nPage */, bp+44 /* &nSector */, bp+48 /* &nPagesize */) != 0)) {
 64030  		goto __4
 64031  	}
 64032  	goto finish_rjf
 64033  __4:
 64034  	;
 64035  	iOff = iOff + (sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */))))
 64036  
 64037  	if !(*(*u32)(unsafe.Pointer(bp + 36 /* nRec */)) == u32(0)) {
 64038  		goto __5
 64039  	}
 64040  	// A trick. There might be another journal-header immediately
 64041  	// following this one. In this case, 0 records means 0 records,
 64042  	// not "read until the end of the file". See also ticket #2565.
 64043  	if !(iSize >= (iOff + sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */))))) {
 64044  		goto __6
 64045  	}
 64046  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 28, iOff)
 64047  	if !((rc != SQLITE_OK) || (0 == decodeJournalHdr(tls, bp+8 /* &zBuf[0] */, uintptr(0), uintptr(0), uintptr(0), uintptr(0)))) {
 64048  		goto __7
 64049  	}
 64050  	goto __2
 64051  __7:
 64052  	;
 64053  __6:
 64054  	;
 64055  	*(*u32)(unsafe.Pointer(bp + 36 /* nRec */)) = (u32((iSize - iOff) / (sqlite3_int64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize + u32(8)))))
 64056  __5:
 64057  	;
 64058  
 64059  	// Read all the records that follow the journal-header just read.
 64060  	ii = u32(0)
 64061  __8:
 64062  	if !(((rc == SQLITE_OK) && (ii < *(*u32)(unsafe.Pointer(bp + 36 /* nRec */)))) && (iOff < iSize)) {
 64063  		goto __10
 64064  	}
 64065  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 4, iOff)
 64066  	if !(rc == SQLITE_OK) {
 64067  		goto __11
 64068  	}
 64069  	pgno = decodeUint32(tls, bp+8 /* &zBuf[0] */)
 64070  	if !((pgno > u32(0)) && (pgno <= (*jt_file)(unsafe.Pointer(pMain)).FnPage)) {
 64071  		goto __12
 64072  	}
 64073  	if !(0 == sqlite3.Xsqlite3BitvecTest(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)) {
 64074  		goto __13
 64075  	}
 64076  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, aPage, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), (iOff + int64(4)))
 64077  	if !(rc == SQLITE_OK) {
 64078  		goto __14
 64079  	}
 64080  	cksum = genCksum(tls, aPage, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 64081  
 64082  __14:
 64083  	;
 64084  __13:
 64085  	;
 64086  	sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)
 64087  __12:
 64088  	;
 64089  	iOff = iOff + (sqlite3_int64(u32(8) + (*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 64090  __11:
 64091  	;
 64092  	goto __9
 64093  __9:
 64094  	ii++
 64095  	goto __8
 64096  	goto __10
 64097  __10:
 64098  	;
 64099  
 64100  	iOff = (((iOff + (sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */)) - u32(1)))) / sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */)))) * sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */))))
 64101  	goto __2
 64102  __3:
 64103  	;
 64104  
 64105  finish_rjf:
 64106  	start_ioerr_simulation(tls, *(*int32)(unsafe.Pointer(bp /* iSave */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSave2 */)))
 64107  	sqlite3.Xsqlite3_free(tls, aPage)
 64108  	if !(rc == (SQLITE_IOERR | (int32(2) << 8))) {
 64109  		goto __15
 64110  	}
 64111  	rc = SQLITE_OK
 64112  __15:
 64113  	;
 64114  	return rc
 64115  }
 64116  
 64117  // Write data to an jt-file.
 64118  func jtWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_journal.c:512:12: */
 64119  	var rc int32
 64120  	var p uintptr = pFile
 64121  	if ((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 64122  		if iOfst == int64(0) {
 64123  			var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 64124  
 64125  			if iAmt == 28 {
 64126  				// Zeroing the first journal-file header. This is the end of a
 64127  				// transaction.
 64128  				closeTransaction(tls, pMain)
 64129  			} else if iAmt != 12 {
 64130  				// Writing the first journal header to a journal file. This happens
 64131  				// when a transaction is first started.
 64132  				var z uintptr = zBuf
 64133  				(*jt_file)(unsafe.Pointer(pMain)).FnPage = decodeUint32(tls, (z + 16))
 64134  				(*jt_file)(unsafe.Pointer(pMain)).FnPagesize = decodeUint32(tls, (z + 24))
 64135  				if SQLITE_OK != (libc.AssignInt32(&rc, openTransaction(tls, pMain, p))) {
 64136  					return rc
 64137  				}
 64138  			}
 64139  		}
 64140  		if (*jt_file)(unsafe.Pointer(p)).FiMaxOff < (iOfst + sqlite_int64(iAmt)) {
 64141  			(*jt_file)(unsafe.Pointer(p)).FiMaxOff = (iOfst + sqlite_int64(iAmt))
 64142  		}
 64143  	}
 64144  
 64145  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) && ((*jt_file)(unsafe.Pointer(p)).FpWritable != 0) {
 64146  		if (((iAmt < int32((*jt_file)(unsafe.Pointer(p)).FnPagesize)) &&
 64147  			(((*jt_file)(unsafe.Pointer(p)).FnPagesize % u32(iAmt)) == u32(0))) &&
 64148  			(iOfst >= (sqlite_int64(sqlite3.Xsqlite3PendingByte + 512)))) &&
 64149  			((iOfst + sqlite_int64(iAmt)) <= (sqlite_int64(u32(sqlite3.Xsqlite3PendingByte) + (*jt_file)(unsafe.Pointer(p)).FnPagesize))) {
 64150  			// No-op. This special case is hit when the backup code is copying a
 64151  			// to a database with a larger page-size than the source database and
 64152  			// it needs to fill in the non-locking-region part of the original
 64153  			// pending-byte page.
 64154  		} else {
 64155  			var pgno u32 = (u32((iOfst / sqlite_int64((*jt_file)(unsafe.Pointer(p)).FnPagesize)) + int64(1)))
 64156  			_ = pgno
 64157  
 64158  			// The following assert() statements may fail if this layer is used
 64159  			// with a connection in "PRAGMA synchronous=off" mode. If they
 64160  			// fail with sync=normal or sync=full, this may indicate problem.
 64161  
 64162  		}
 64163  	}
 64164  
 64165  	rc = sqlite3.Xsqlite3OsWrite(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 64166  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0) && (iAmt == 12) {
 64167  		var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 64168  		var rc2 int32 = readJournalFile(tls, p, pMain)
 64169  		if rc == SQLITE_OK {
 64170  			rc = rc2
 64171  		}
 64172  	}
 64173  	return rc
 64174  }
 64175  
 64176  // Truncate an jt-file.
 64177  func jtTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_journal.c:580:12: */
 64178  	var p uintptr = pFile
 64179  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0) && (size == int64(0)) {
 64180  		// Truncating a journal file. This is the end of a transaction.
 64181  		var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 64182  		closeTransaction(tls, pMain)
 64183  	}
 64184  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) && ((*jt_file)(unsafe.Pointer(p)).FpWritable != 0) {
 64185  		var pgno u32
 64186  		var locking_page u32 = ((u32(sqlite3.Xsqlite3PendingByte) / (*jt_file)(unsafe.Pointer(p)).FnPagesize) + u32(1))
 64187  		_ = locking_page
 64188  		for pgno = (u32((size / sqlite_int64((*jt_file)(unsafe.Pointer(p)).FnPagesize)) + int64(1))); pgno <= (*jt_file)(unsafe.Pointer(p)).FnPage; pgno++ {
 64189  
 64190  		}
 64191  	}
 64192  	return sqlite3.Xsqlite3OsTruncate(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, size)
 64193  }
 64194  
 64195  // Sync an jt-file.
 64196  func jtSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_journal.c:600:12: */
 64197  	var p uintptr = pFile
 64198  
 64199  	if ((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 64200  		var rc int32
 64201  		var pMain uintptr // The associated database file
 64202  
 64203  		// The journal file is being synced. At this point, we inspect the
 64204  		// contents of the file up to this point and set each bit in the
 64205  		// jt_file.pWritable bitvec of the main database file associated with
 64206  		// this journal file.
 64207  		pMain = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 64208  
 64209  		// Set the bitvec values
 64210  		if (pMain != 0) && ((*jt_file)(unsafe.Pointer(pMain)).FpWritable != 0) {
 64211  			(*jt_file)(unsafe.Pointer(pMain)).FnSync++
 64212  			rc = readJournalFile(tls, p, pMain)
 64213  			if rc != SQLITE_OK {
 64214  				return rc
 64215  			}
 64216  		}
 64217  	}
 64218  
 64219  	return sqlite3.Xsqlite3OsSync(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, flags)
 64220  }
 64221  
 64222  // Return the current file-size of an jt-file.
 64223  func jtFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_journal.c:630:12: */
 64224  	var p uintptr = pFile
 64225  	return sqlite3.Xsqlite3OsFileSize(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, pSize)
 64226  }
 64227  
 64228  // Lock an jt-file.
 64229  func jtLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_journal.c:638:12: */
 64230  	var rc int32
 64231  	var p uintptr = pFile
 64232  	rc = sqlite3.Xsqlite3OsLock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, eLock)
 64233  	if (rc == SQLITE_OK) && (eLock > (*jt_file)(unsafe.Pointer(p)).FeLock) {
 64234  		(*jt_file)(unsafe.Pointer(p)).FeLock = eLock
 64235  	}
 64236  	return rc
 64237  }
 64238  
 64239  // Unlock an jt-file.
 64240  func jtUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_journal.c:651:12: */
 64241  	var rc int32
 64242  	var p uintptr = pFile
 64243  	rc = sqlite3.Xsqlite3OsUnlock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, eLock)
 64244  	if (rc == SQLITE_OK) && (eLock < (*jt_file)(unsafe.Pointer(p)).FeLock) {
 64245  		(*jt_file)(unsafe.Pointer(p)).FeLock = eLock
 64246  	}
 64247  	return rc
 64248  }
 64249  
 64250  // Check if another file-handle holds a RESERVED lock on an jt-file.
 64251  func jtCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_journal.c:664:12: */
 64252  	var p uintptr = pFile
 64253  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, pResOut)
 64254  }
 64255  
 64256  // File control method. For custom operations on an jt-file.
 64257  func jtFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_journal.c:672:12: */
 64258  	var p uintptr = pFile
 64259  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*jt_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 80 /* &.xFileControl */))))(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, op, pArg)
 64260  }
 64261  
 64262  // Return the sector-size in bytes for an jt-file.
 64263  func jtSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:680:12: */
 64264  	var p uintptr = pFile
 64265  	return sqlite3.Xsqlite3OsSectorSize(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 64266  }
 64267  
 64268  // Return the device characteristic flags supported by an jt-file.
 64269  func jtDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:688:12: */
 64270  	var p uintptr = pFile
 64271  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 64272  }
 64273  
 64274  // Open an jt file handle.
 64275  func jtOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_journal.c:696:12: */
 64276  	var rc int32
 64277  	var p uintptr = pFile
 64278  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 64279  	(*jt_file)(unsafe.Pointer(p)).FpReal = (p + 1*80)
 64280  	(*sqlite3_file)(unsafe.Pointer((*jt_file)(unsafe.Pointer(p)).FpReal)).FpMethods = uintptr(0)
 64281  	rc = sqlite3.Xsqlite3OsOpen(tls, g2.FpVfs, zName, (*jt_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 64282  
 64283  	if rc == SQLITE_OK {
 64284  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&jt_io_methods))
 64285  		(*jt_file)(unsafe.Pointer(p)).FeLock = 0
 64286  		(*jt_file)(unsafe.Pointer(p)).FzName = zName
 64287  		(*jt_file)(unsafe.Pointer(p)).Fflags = flags
 64288  		(*jt_file)(unsafe.Pointer(p)).FpNext = uintptr(0)
 64289  		(*jt_file)(unsafe.Pointer(p)).FpWritable = uintptr(0)
 64290  		(*jt_file)(unsafe.Pointer(p)).FaCksum = uintptr(0)
 64291  		enterJtMutex(tls)
 64292  		if zName != 0 {
 64293  			(*jt_file)(unsafe.Pointer(p)).FpNext = g2.FpList
 64294  			g2.FpList = p
 64295  		}
 64296  		leaveJtMutex(tls)
 64297  	}
 64298  	return rc
 64299  }
 64300  
 64301  // Delete the file located at zPath. If the dirSync argument is true,
 64302  // ensure the file-system modifications are synced to disk before
 64303  // returning.
 64304  func jtDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_journal.c:733:12: */
 64305  	var nPath int32 = int32(libc.Xstrlen(tls, zPath))
 64306  	if (nPath > 8) && (0 == libc.Xstrcmp(tls, ts+33006 /* "-journal" */, (zPath+uintptr((nPath-8))))) {
 64307  		// Deleting a journal file. The end of a transaction.
 64308  		var pMain uintptr = locateDatabaseHandle(tls, zPath, 0)
 64309  		if pMain != 0 {
 64310  			closeTransaction(tls, pMain)
 64311  		}
 64312  	}
 64313  
 64314  	return sqlite3.Xsqlite3OsDelete(tls, g2.FpVfs, zPath, dirSync)
 64315  }
 64316  
 64317  // Test for access permissions. Return true if the requested permission
 64318  // is available, or false otherwise.
 64319  func jtAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_journal.c:750:12: */
 64320  	return sqlite3.Xsqlite3OsAccess(tls, g2.FpVfs, zPath, flags, pResOut)
 64321  }
 64322  
 64323  // Populate buffer zOut with the full canonical pathname corresponding
 64324  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 64325  // of at least (JT_MAX_PATHNAME+1) bytes.
 64326  func jtFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_journal.c:764:12: */
 64327  	return sqlite3.Xsqlite3OsFullPathname(tls, g2.FpVfs, zPath, nOut, zOut)
 64328  }
 64329  
 64330  // Open the dynamic library located at zPath and return a handle.
 64331  func jtDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_journal.c:776:13: */
 64332  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((g2.FpVfs + 72 /* &.xDlOpen */))))(tls, g2.FpVfs, zPath)
 64333  }
 64334  
 64335  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 64336  // utf-8 string describing the most recent error encountered associated
 64337  // with dynamic libraries.
 64338  func jtDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_journal.c:785:13: */
 64339  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((g2.FpVfs + 80 /* &.xDlError */))))(tls, g2.FpVfs, nByte, zErrMsg)
 64340  }
 64341  
 64342  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 64343  func jtDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* test_journal.c:792:13: */
 64344  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((g2.FpVfs + 88 /* &.xDlSym */))))(tls, g2.FpVfs, p, zSym)
 64345  }
 64346  
 64347  // Close the dynamic library handle pHandle.
 64348  func jtDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_journal.c:799:13: */
 64349  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((g2.FpVfs + 96 /* &.xDlClose */))))(tls, g2.FpVfs, pHandle)
 64350  }
 64351  
 64352  // Populate the buffer pointed to by zBufOut with nByte bytes of
 64353  // random data.
 64354  func jtRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_journal.c:807:12: */
 64355  	return sqlite3.Xsqlite3OsRandomness(tls, g2.FpVfs, nByte, zBufOut)
 64356  }
 64357  
 64358  // Sleep for nMicro microseconds. Return the number of microseconds
 64359  // actually slept.
 64360  func jtSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_journal.c:815:12: */
 64361  	return sqlite3.Xsqlite3OsSleep(tls, g2.FpVfs, nMicro)
 64362  }
 64363  
 64364  // Return the current time as a Julian Day number in *pTimeOut.
 64365  func jtCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_journal.c:822:12: */
 64366  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 120 /* &.xCurrentTime */))))(tls, g2.FpVfs, pTimeOut)
 64367  }
 64368  
 64369  // Return the current time as a Julian Day number in *pTimeOut.
 64370  func jtCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_journal.c:828:12: */
 64371  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, g2.FpVfs, pTimeOut)
 64372  }
 64373  
 64374  func jtGetLastError(tls *libc.TLS, pVfs uintptr, n int32, z uintptr) int32 { /* test_journal.c:832:12: */
 64375  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 128 /* &.xGetLastError */))))(tls, g2.FpVfs, n, z)
 64376  }
 64377  
 64378  // *************************************************************************
 64379  //
 64380  // Start of public API.
 64381  
 64382  // Configure the jt VFS as a wrapper around the VFS named by parameter
 64383  // zWrap. If the isDefault parameter is true, then the jt VFS is installed
 64384  // as the new default VFS for SQLite connections. If isDefault is not
 64385  // true, then the jt VFS is installed as non-default. In this case it
 64386  // is available via its name, "jt".
 64387  func jt_register(tls *libc.TLS, zWrap uintptr, isDefault int32) int32 { /* test_journal.c:847:5: */
 64388  	g2.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, zWrap)
 64389  	if g2.FpVfs == uintptr(0) {
 64390  		return SQLITE_ERROR
 64391  	}
 64392  	jt_vfs.FszOsFile = (int32(uint64(unsafe.Sizeof(jt_file{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FszOsFile)))
 64393  	if (*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FiVersion == 1 {
 64394  		jt_vfs.FiVersion = 1
 64395  	} else if (*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FxCurrentTimeInt64 == uintptr(0) {
 64396  		jt_vfs.FxCurrentTimeInt64 = uintptr(0)
 64397  	}
 64398  	sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&jt_vfs)), isDefault)
 64399  	return SQLITE_OK
 64400  }
 64401  
 64402  // Uninstall the jt VFS, if it is installed.
 64403  func jt_unregister(tls *libc.TLS) { /* test_journal.c:865:6: */
 64404  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&jt_vfs)))
 64405  }
 64406  
 64407  // end block for C++
 64408  
 64409  // Local Variables:
 64410  // mode: c
 64411  // c-basic-offset: 4
 64412  // fill-column: 78
 64413  // End:
 64414  // -
 64415  // SPDX-License-Identifier: BSD-3-Clause
 64416  //
 64417  // Copyright (c) 1990, 1993
 64418  //	The Regents of the University of California.  All rights reserved.
 64419  //
 64420  // Redistribution and use in source and binary forms, with or without
 64421  // modification, are permitted provided that the following conditions
 64422  // are met:
 64423  // 1. Redistributions of source code must retain the above copyright
 64424  //    notice, this list of conditions and the following disclaimer.
 64425  // 2. Redistributions in binary form must reproduce the above copyright
 64426  //    notice, this list of conditions and the following disclaimer in the
 64427  //    documentation and/or other materials provided with the distribution.
 64428  // 3. Neither the name of the University nor the names of its contributors
 64429  //    may be used to endorse or promote products derived from this software
 64430  //    without specific prior written permission.
 64431  //
 64432  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64433  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64434  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64435  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64436  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64437  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64438  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64439  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64440  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64441  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64442  // SUCH DAMAGE.
 64443  //
 64444  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 64445  // $FreeBSD$
 64446  
 64447  // -
 64448  // SPDX-License-Identifier: BSD-3-Clause
 64449  //
 64450  // Copyright (c) 1990, 1993
 64451  //	The Regents of the University of California.  All rights reserved.
 64452  //
 64453  // Redistribution and use in source and binary forms, with or without
 64454  // modification, are permitted provided that the following conditions
 64455  // are met:
 64456  // 1. Redistributions of source code must retain the above copyright
 64457  //    notice, this list of conditions and the following disclaimer.
 64458  // 2. Redistributions in binary form must reproduce the above copyright
 64459  //    notice, this list of conditions and the following disclaimer in the
 64460  //    documentation and/or other materials provided with the distribution.
 64461  // 3. Neither the name of the University nor the names of its contributors
 64462  //    may be used to endorse or promote products derived from this software
 64463  //    without specific prior written permission.
 64464  //
 64465  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64466  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64467  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64468  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64469  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64470  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64471  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64472  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64473  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64474  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64475  // SUCH DAMAGE.
 64476  //
 64477  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 64478  // $FreeBSD$
 64479  
 64480  // -
 64481  // SPDX-License-Identifier: BSD-3-Clause
 64482  //
 64483  // Copyright (c) 1992, 1993
 64484  //	The Regents of the University of California.  All rights reserved.
 64485  // (c) UNIX System Laboratories, Inc.
 64486  // All or some portions of this file are derived from material licensed
 64487  // to the University of California by American Telephone and Telegraph
 64488  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 64489  // the permission of UNIX System Laboratories, Inc.
 64490  //
 64491  // Redistribution and use in source and binary forms, with or without
 64492  // modification, are permitted provided that the following conditions
 64493  // are met:
 64494  // 1. Redistributions of source code must retain the above copyright
 64495  //    notice, this list of conditions and the following disclaimer.
 64496  // 2. Redistributions in binary form must reproduce the above copyright
 64497  //    notice, this list of conditions and the following disclaimer in the
 64498  //    documentation and/or other materials provided with the distribution.
 64499  // 3. Neither the name of the University nor the names of its contributors
 64500  //    may be used to endorse or promote products derived from this software
 64501  //    without specific prior written permission.
 64502  //
 64503  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64504  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64505  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64506  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64507  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64508  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64509  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64510  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64511  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64512  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64513  // SUCH DAMAGE.
 64514  //
 64515  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 64516  // $FreeBSD$
 64517  
 64518  // -
 64519  // SPDX-License-Identifier: BSD-3-Clause
 64520  //
 64521  // Copyright (c) 1991, 1993
 64522  //	The Regents of the University of California.  All rights reserved.
 64523  //
 64524  // This code is derived from software contributed to Berkeley by
 64525  // Berkeley Software Design, Inc.
 64526  //
 64527  // Redistribution and use in source and binary forms, with or without
 64528  // modification, are permitted provided that the following conditions
 64529  // are met:
 64530  // 1. Redistributions of source code must retain the above copyright
 64531  //    notice, this list of conditions and the following disclaimer.
 64532  // 2. Redistributions in binary form must reproduce the above copyright
 64533  //    notice, this list of conditions and the following disclaimer in the
 64534  //    documentation and/or other materials provided with the distribution.
 64535  // 3. Neither the name of the University nor the names of its contributors
 64536  //    may be used to endorse or promote products derived from this software
 64537  //    without specific prior written permission.
 64538  //
 64539  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64540  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64541  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64542  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64543  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64544  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64545  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64546  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64547  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64548  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64549  // SUCH DAMAGE.
 64550  //
 64551  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 64552  // $FreeBSD$
 64553  
 64554  // Unlike other ANSI header files, <assert.h> may usefully be included
 64555  // multiple times, with and without NDEBUG defined.
 64556  
 64557  // This structure is used to encapsulate the global state variables used
 64558  // by malloc() fault simulation.
 64559  type MemFault = struct {
 64560  	FiCountdown   int32
 64561  	FnRepeat      int32
 64562  	FnBenign      int32
 64563  	FnFail        int32
 64564  	FnOkBefore    int32
 64565  	FnOkAfter     int32
 64566  	Fenable       u8
 64567  	_             [3]byte
 64568  	FisInstalled  int32
 64569  	FisBenignMode int32
 64570  	_             [4]byte
 64571  	Fm            sqlite3_mem_methods
 64572  } /* test_malloc.c:30:8 */
 64573  
 64574  // end block for C++
 64575  
 64576  // Local Variables:
 64577  // mode: c
 64578  // c-basic-offset: 4
 64579  // fill-column: 78
 64580  // End:
 64581  // -
 64582  // SPDX-License-Identifier: BSD-3-Clause
 64583  //
 64584  // Copyright (c) 1990, 1993
 64585  //	The Regents of the University of California.  All rights reserved.
 64586  //
 64587  // Redistribution and use in source and binary forms, with or without
 64588  // modification, are permitted provided that the following conditions
 64589  // are met:
 64590  // 1. Redistributions of source code must retain the above copyright
 64591  //    notice, this list of conditions and the following disclaimer.
 64592  // 2. Redistributions in binary form must reproduce the above copyright
 64593  //    notice, this list of conditions and the following disclaimer in the
 64594  //    documentation and/or other materials provided with the distribution.
 64595  // 3. Neither the name of the University nor the names of its contributors
 64596  //    may be used to endorse or promote products derived from this software
 64597  //    without specific prior written permission.
 64598  //
 64599  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64600  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64601  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64602  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64603  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64604  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64605  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64606  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64607  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64608  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64609  // SUCH DAMAGE.
 64610  //
 64611  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 64612  // $FreeBSD$
 64613  
 64614  // -
 64615  // SPDX-License-Identifier: BSD-3-Clause
 64616  //
 64617  // Copyright (c) 1990, 1993
 64618  //	The Regents of the University of California.  All rights reserved.
 64619  //
 64620  // Redistribution and use in source and binary forms, with or without
 64621  // modification, are permitted provided that the following conditions
 64622  // are met:
 64623  // 1. Redistributions of source code must retain the above copyright
 64624  //    notice, this list of conditions and the following disclaimer.
 64625  // 2. Redistributions in binary form must reproduce the above copyright
 64626  //    notice, this list of conditions and the following disclaimer in the
 64627  //    documentation and/or other materials provided with the distribution.
 64628  // 3. Neither the name of the University nor the names of its contributors
 64629  //    may be used to endorse or promote products derived from this software
 64630  //    without specific prior written permission.
 64631  //
 64632  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64633  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64634  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64635  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64636  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64637  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64638  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64639  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64640  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64641  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64642  // SUCH DAMAGE.
 64643  //
 64644  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 64645  // $FreeBSD$
 64646  
 64647  // -
 64648  // SPDX-License-Identifier: BSD-3-Clause
 64649  //
 64650  // Copyright (c) 1992, 1993
 64651  //	The Regents of the University of California.  All rights reserved.
 64652  // (c) UNIX System Laboratories, Inc.
 64653  // All or some portions of this file are derived from material licensed
 64654  // to the University of California by American Telephone and Telegraph
 64655  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 64656  // the permission of UNIX System Laboratories, Inc.
 64657  //
 64658  // Redistribution and use in source and binary forms, with or without
 64659  // modification, are permitted provided that the following conditions
 64660  // are met:
 64661  // 1. Redistributions of source code must retain the above copyright
 64662  //    notice, this list of conditions and the following disclaimer.
 64663  // 2. Redistributions in binary form must reproduce the above copyright
 64664  //    notice, this list of conditions and the following disclaimer in the
 64665  //    documentation and/or other materials provided with the distribution.
 64666  // 3. Neither the name of the University nor the names of its contributors
 64667  //    may be used to endorse or promote products derived from this software
 64668  //    without specific prior written permission.
 64669  //
 64670  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64671  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64672  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64673  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64674  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64675  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64676  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64677  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64678  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64679  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64680  // SUCH DAMAGE.
 64681  //
 64682  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 64683  // $FreeBSD$
 64684  
 64685  // -
 64686  // SPDX-License-Identifier: BSD-3-Clause
 64687  //
 64688  // Copyright (c) 1991, 1993
 64689  //	The Regents of the University of California.  All rights reserved.
 64690  //
 64691  // This code is derived from software contributed to Berkeley by
 64692  // Berkeley Software Design, Inc.
 64693  //
 64694  // Redistribution and use in source and binary forms, with or without
 64695  // modification, are permitted provided that the following conditions
 64696  // are met:
 64697  // 1. Redistributions of source code must retain the above copyright
 64698  //    notice, this list of conditions and the following disclaimer.
 64699  // 2. Redistributions in binary form must reproduce the above copyright
 64700  //    notice, this list of conditions and the following disclaimer in the
 64701  //    documentation and/or other materials provided with the distribution.
 64702  // 3. Neither the name of the University nor the names of its contributors
 64703  //    may be used to endorse or promote products derived from this software
 64704  //    without specific prior written permission.
 64705  //
 64706  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 64707  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 64708  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 64709  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 64710  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 64711  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 64712  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 64713  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 64714  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 64715  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 64716  // SUCH DAMAGE.
 64717  //
 64718  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 64719  // $FreeBSD$
 64720  
 64721  // Unlike other ANSI header files, <assert.h> may usefully be included
 64722  // multiple times, with and without NDEBUG defined.
 64723  
 64724  // This structure is used to encapsulate the global state variables used
 64725  // by malloc() fault simulation.
 64726  var memfault MemFault /* test_malloc.c:41:3: */
 64727  
 64728  // This routine exists as a place to set a breakpoint that will
 64729  // fire on any simulated malloc() failure.
 64730  func sqlite3Fault(tls *libc.TLS) { /* test_malloc.c:47:13: */
 64731  	cnt1++
 64732  }
 64733  
 64734  var cnt1 int32 = 0 /* test_malloc.c:48:14 */
 64735  
 64736  // This routine exists as a place to set a breakpoint that will
 64737  // fire the first time any malloc() fails on a single test case.
 64738  // The sqlite3Fault() routine above runs on every malloc() failure.
 64739  // This routine only runs on the first such failure.
 64740  func sqlite3FirstFault(tls *libc.TLS) { /* test_malloc.c:58:13: */
 64741  	cnt2++
 64742  }
 64743  
 64744  var cnt2 int32 = 0 /* test_malloc.c:59:14 */
 64745  
 64746  // Check to see if a fault should be simulated.  Return true to simulate
 64747  // the fault.  Return false if the fault should not be simulated.
 64748  func faultsimStep(tls *libc.TLS) int32 { /* test_malloc.c:67:12: */
 64749  	if !(int32(memfault.Fenable) != 0) {
 64750  		memfault.FnOkAfter++
 64751  		return 0
 64752  	}
 64753  	if memfault.FiCountdown > 0 {
 64754  		memfault.FiCountdown--
 64755  		memfault.FnOkBefore++
 64756  		return 0
 64757  	}
 64758  	if memfault.FnFail == 0 {
 64759  		sqlite3FirstFault(tls)
 64760  	}
 64761  	sqlite3Fault(tls)
 64762  	memfault.FnFail++
 64763  	if memfault.FisBenignMode > 0 {
 64764  		memfault.FnBenign++
 64765  	}
 64766  	memfault.FnRepeat--
 64767  	if memfault.FnRepeat <= 0 {
 64768  		memfault.Fenable = u8(0)
 64769  	}
 64770  	return 1
 64771  }
 64772  
 64773  // A version of sqlite3_mem_methods.xMalloc() that includes fault simulation
 64774  // logic.
 64775  func faultsimMalloc(tls *libc.TLS, n int32) uintptr { /* test_malloc.c:94:13: */
 64776  	var p uintptr = uintptr(0)
 64777  	if !(faultsimStep(tls) != 0) {
 64778  		p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&memfault)) + 40 /* &.m */ /* &.xMalloc */))))(tls, n)
 64779  	}
 64780  	return p
 64781  }
 64782  
 64783  // A version of sqlite3_mem_methods.xRealloc() that includes fault simulation
 64784  // logic.
 64785  func faultsimRealloc(tls *libc.TLS, pOld uintptr, n int32) uintptr { /* test_malloc.c:107:13: */
 64786  	var p uintptr = uintptr(0)
 64787  	if !(faultsimStep(tls) != 0) {
 64788  		p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&memfault)) + 40 /* &.m */ + 16 /* &.xRealloc */))))(tls, pOld, n)
 64789  	}
 64790  	return p
 64791  }
 64792  
 64793  // This routine configures the malloc failure simulation.  After
 64794  // calling this routine, the next nDelay mallocs will succeed, followed
 64795  // by a block of nRepeat failures, after which malloc() calls will begin
 64796  // to succeed again.
 64797  func faultsimConfig(tls *libc.TLS, nDelay int32, nRepeat int32) { /* test_malloc.c:121:13: */
 64798  	memfault.FiCountdown = nDelay
 64799  	memfault.FnRepeat = nRepeat
 64800  	memfault.FnBenign = 0
 64801  	memfault.FnFail = 0
 64802  	memfault.FnOkBefore = 0
 64803  	memfault.FnOkAfter = 0
 64804  	memfault.Fenable = (u8(libc.Bool32(nDelay >= 0)))
 64805  
 64806  	// Sometimes, when running multi-threaded tests, the isBenignMode
 64807  	// variable is not properly incremented/decremented so that it is
 64808  	// 0 when not inside a benign malloc block. This doesn't affect
 64809  	// the multi-threaded tests, as they do not use this system. But
 64810  	// it does affect OOM tests run later in the same process. So
 64811  	// zero the variable here, just to be sure.
 64812  	memfault.FisBenignMode = 0
 64813  }
 64814  
 64815  // Return the number of faults (both hard and benign faults) that have
 64816  // occurred since the injector was last configured.
 64817  func faultsimFailures(tls *libc.TLS) int32 { /* test_malloc.c:144:12: */
 64818  	return memfault.FnFail
 64819  }
 64820  
 64821  // Return the number of benign faults that have occurred since the
 64822  // injector was last configured.
 64823  func faultsimBenignFailures(tls *libc.TLS) int32 { /* test_malloc.c:152:12: */
 64824  	return memfault.FnBenign
 64825  }
 64826  
 64827  // Return the number of successes that will occur before the next failure.
 64828  // If no failures are scheduled, return -1.
 64829  func faultsimPending(tls *libc.TLS) int32 { /* test_malloc.c:160:12: */
 64830  	if memfault.Fenable != 0 {
 64831  		return memfault.FiCountdown
 64832  	} else {
 64833  		return -1
 64834  	}
 64835  	return int32(0)
 64836  }
 64837  
 64838  func faultsimBeginBenign(tls *libc.TLS) { /* test_malloc.c:169:13: */
 64839  	memfault.FisBenignMode++
 64840  }
 64841  
 64842  func faultsimEndBenign(tls *libc.TLS) { /* test_malloc.c:172:13: */
 64843  	memfault.FisBenignMode--
 64844  }
 64845  
 64846  // Add or remove the fault-simulation layer using sqlite3_config(). If
 64847  // the argument is non-zero, the
 64848  func faultsimInstall(tls *libc.TLS, install int32) int32 { /* test_malloc.c:180:12: */
 64849  	bp := tls.Alloc(200)
 64850  	defer tls.Free(200)
 64851  
 64852  	var rc int32
 64853  
 64854  	install = func() int32 {
 64855  		if install != 0 {
 64856  			return 1
 64857  		}
 64858  		return 0
 64859  	}()
 64860  
 64861  	if install == memfault.FisInstalled {
 64862  		return SQLITE_ERROR
 64863  	}
 64864  
 64865  	if install != 0 {
 64866  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp, (uintptr(unsafe.Pointer(&memfault))+40 /* &.m */)))
 64867  
 64868  		if rc == SQLITE_OK {
 64869  			*(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* m */)) = memfault.Fm
 64870  			(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* &m */)).FxMalloc = *(*uintptr)(unsafe.Pointer(&struct {
 64871  				f func(*libc.TLS, int32) uintptr
 64872  			}{faultsimMalloc}))
 64873  			(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* &m */)).FxRealloc = *(*uintptr)(unsafe.Pointer(&struct {
 64874  				f func(*libc.TLS, uintptr, int32) uintptr
 64875  			}{faultsimRealloc}))
 64876  			rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+8, bp+72 /* &m */))
 64877  		}
 64878  		sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,
 64879  			libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) }{faultsimBeginBenign})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) }{faultsimEndBenign}))))
 64880  	} else {
 64881  		// var m2 sqlite3_mem_methods at bp+136, 64
 64882  
 64883  		// One should be able to reset the default memory allocator by storing
 64884  		// a zeroed allocator then calling GETMALLOC.
 64885  		libc.Xmemset(tls, bp+136 /* &m2 */, 0, uint64(unsafe.Sizeof(sqlite3_mem_methods{})))
 64886  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+32, bp+136 /* &m2 */))
 64887  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp+40, bp+136 /* &m2 */))
 64888  
 64889  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+48, (uintptr(unsafe.Pointer(&memfault))+40 /* &.m */)))
 64890  		sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,
 64891  			libc.VaList(bp+56, uintptr(0), uintptr(0)))
 64892  	}
 64893  
 64894  	if rc == SQLITE_OK {
 64895  		memfault.FisInstalled = 1
 64896  	}
 64897  	return rc
 64898  }
 64899  
 64900  // Transform pointers to text and back again
 64901  func pointerToText(tls *libc.TLS, p uintptr, z uintptr) { /* test_malloc.c:239:13: */
 64902  	bp := tls.Alloc(20)
 64903  	defer tls.Free(20)
 64904  	*(*uintptr)(unsafe.Pointer(bp + 8)) = p
 64905  
 64906  	var i int32
 64907  	var k int32
 64908  	// var u uint32 at bp+16, 4
 64909  
 64910  	// var n sqlite3_uint64 at bp, 8
 64911  
 64912  	if *(*uintptr)(unsafe.Pointer(bp + 8 /* p */)) == uintptr(0) {
 64913  		libc.Xstrcpy(tls, z, ts+14654 /* "0" */)
 64914  		return
 64915  	}
 64916  	if uint64(unsafe.Sizeof(sqlite3_uint64(0))) == uint64(unsafe.Sizeof(uintptr(0))) {
 64917  		libc.Xmemcpy(tls, bp /* &n */, bp+8 /* &p */, uint64(unsafe.Sizeof(uintptr(0))))
 64918  	} else if uint64(unsafe.Sizeof(uint32(0))) == uint64(unsafe.Sizeof(uintptr(0))) {
 64919  		libc.Xmemcpy(tls, bp+16 /* &u */, bp+8 /* &p */, uint64(unsafe.Sizeof(uint32(0))))
 64920  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = sqlite3_uint64(*(*uint32)(unsafe.Pointer(bp + 16 /* u */)))
 64921  	} else {
 64922  
 64923  	}
 64924  	i = 0
 64925  	k = (int32((uint64(unsafe.Sizeof(uintptr(0))) * uint64(2)) - uint64(1)))
 64926  __1:
 64927  	if !(uint64(i) < (uint64(unsafe.Sizeof(uintptr(0))) * uint64(2))) {
 64928  		goto __3
 64929  	}
 64930  	{
 64931  		*(*int8)(unsafe.Pointer(z + uintptr(k))) = zHex[(*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) & uint64(0xf))]
 64932  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) >>= 4
 64933  
 64934  	}
 64935  	goto __2
 64936  __2:
 64937  	i++
 64938  	k--
 64939  	goto __1
 64940  	goto __3
 64941  __3:
 64942  	;
 64943  	*(*int8)(unsafe.Pointer(z + 16)) = int8(0)
 64944  }
 64945  
 64946  var zHex = *(*[17]int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */)) /* test_malloc.c:240:21 */
 64947  
 64948  func hexToInt(tls *libc.TLS, h int32) int32 { /* test_malloc.c:262:12: */
 64949  	if (h >= '0') && (h <= '9') {
 64950  		return (h - '0')
 64951  	} else if (h >= 'a') && (h <= 'f') {
 64952  		return ((h - 'a') + 10)
 64953  	} else {
 64954  		return -1
 64955  	}
 64956  	return int32(0)
 64957  }
 64958  
 64959  func textToPointer(tls *libc.TLS, z uintptr, pp uintptr) int32 { /* test_malloc.c:271:12: */
 64960  	bp := tls.Alloc(12)
 64961  	defer tls.Free(12)
 64962  
 64963  	*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = uint64(0)
 64964  	var i int32
 64965  	// var u uint32 at bp+8, 4
 64966  
 64967  	for i = 0; (uint64(i) < (uint64(unsafe.Sizeof(uintptr(0))) * uint64(2))) && (*(*int8)(unsafe.Pointer(z)) != 0); i++ {
 64968  		var v int32
 64969  		v = hexToInt(tls, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))
 64970  		if v < 0 {
 64971  			return TCL_ERROR
 64972  		}
 64973  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) * uint64(16)) + sqlite3_uint64(v))
 64974  	}
 64975  	if int32(*(*int8)(unsafe.Pointer(z))) != 0 {
 64976  		return TCL_ERROR
 64977  	}
 64978  	if uint64(unsafe.Sizeof(sqlite3_uint64(0))) == uint64(unsafe.Sizeof(uintptr(0))) {
 64979  		libc.Xmemcpy(tls, pp, bp /* &n */, uint64(unsafe.Sizeof(sqlite3_uint64(0))))
 64980  	} else if uint64(unsafe.Sizeof(uint32(0))) == uint64(unsafe.Sizeof(uintptr(0))) {
 64981  		*(*uint32)(unsafe.Pointer(bp + 8 /* u */)) = uint32(*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)))
 64982  		libc.Xmemcpy(tls, pp, bp+8 /* &u */, uint64(unsafe.Sizeof(uint32(0))))
 64983  	} else {
 64984  
 64985  	}
 64986  	return TCL_OK
 64987  }
 64988  
 64989  // Usage:    sqlite3_malloc  NBYTES
 64990  //
 64991  // Raw test interface for sqlite3_malloc().
 64992  func test_malloc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:298:26: */
 64993  	bp := tls.Alloc(120)
 64994  	defer tls.Free(120)
 64995  
 64996  	// var nByte int32 at bp+16, 4
 64997  
 64998  	var p uintptr
 64999  	// var zOut [100]int8 at bp+20, 100
 65000  
 65001  	if objc != 2 {
 65002  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33015 /* "NBYTES" */)
 65003  		return TCL_ERROR
 65004  	}
 65005  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &nByte */) != 0 {
 65006  		return TCL_ERROR
 65007  	}
 65008  	p = sqlite3.Xsqlite3_malloc(tls, int32(uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nByte */)))))
 65009  	pointerToText(tls, p, bp+20 /* &zOut[0] */)
 65010  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+20 /* &zOut[0] */, uintptr(0)))
 65011  	return TCL_OK
 65012  }
 65013  
 65014  // Usage:    sqlite3_realloc  PRIOR  NBYTES
 65015  //
 65016  // Raw test interface for sqlite3_realloc().
 65017  func test_realloc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:323:26: */
 65018  	bp := tls.Alloc(156)
 65019  	defer tls.Free(156)
 65020  
 65021  	// var nByte int32 at bp+40, 4
 65022  
 65023  	// var pPrior uintptr at bp+48, 8
 65024  
 65025  	var p uintptr
 65026  	// var zOut [100]int8 at bp+56, 100
 65027  
 65028  	if objc != 3 {
 65029  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33022 /* "PRIOR NBYTES" */)
 65030  		return TCL_ERROR
 65031  	}
 65032  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+40 /* &nByte */) != 0 {
 65033  		return TCL_ERROR
 65034  	}
 65035  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+48 /* &pPrior */) != 0 {
 65036  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 65037  		return TCL_ERROR
 65038  	}
 65039  	p = sqlite3.Xsqlite3_realloc(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* pPrior */)), int32(uint32(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))
 65040  	pointerToText(tls, p, bp+56 /* &zOut[0] */)
 65041  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, bp+56 /* &zOut[0] */, uintptr(0)))
 65042  	return TCL_OK
 65043  }
 65044  
 65045  // Usage:    sqlite3_free  PRIOR
 65046  //
 65047  // Raw test interface for sqlite3_free().
 65048  func test_free(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:352:26: */
 65049  	bp := tls.Alloc(32)
 65050  	defer tls.Free(32)
 65051  
 65052  	// var pPrior uintptr at bp+24, 8
 65053  
 65054  	if objc != 2 {
 65055  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33049 /* "PRIOR" */)
 65056  		return TCL_ERROR
 65057  	}
 65058  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+24 /* &pPrior */) != 0 {
 65059  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 65060  		return TCL_ERROR
 65061  	}
 65062  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPrior */)))
 65063  	return TCL_OK
 65064  }
 65065  
 65066  // Usage:    memset  ADDRESS  SIZE  HEX
 65067  //
 65068  // Set a chunk of memory (obtained from malloc, probably) to a
 65069  // specified hex pattern.
 65070  func test_memset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:383:26: */
 65071  	bp := tls.Alloc(172)
 65072  	defer tls.Free(172)
 65073  
 65074  	// var p uintptr at bp+56, 8
 65075  
 65076  	// var size int32 at bp+64, 4
 65077  
 65078  	// var n int32 at bp+68, 4
 65079  
 65080  	var i int32
 65081  	var zHex uintptr
 65082  	var zOut uintptr
 65083  	// var zBin [100]int8 at bp+72, 100
 65084  
 65085  	if objc != 4 {
 65086  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33055 /* "ADDRESS SIZE HEX" */)
 65087  		return TCL_ERROR
 65088  	}
 65089  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+56 /* &p */) != 0 {
 65090  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 65091  		return TCL_ERROR
 65092  	}
 65093  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+64 /* &size */) != 0 {
 65094  		return TCL_ERROR
 65095  	}
 65096  	if *(*int32)(unsafe.Pointer(bp + 64 /* size */)) <= 0 {
 65097  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+33072 /* "size must be pos..." */, uintptr(0)))
 65098  		return TCL_ERROR
 65099  	}
 65100  	zHex = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+68 /* &n */)
 65101  	if uint64(*(*int32)(unsafe.Pointer(bp + 68 /* n */))) > (uint64(unsafe.Sizeof([100]int8{})) * uint64(2)) {
 65102  		*(*int32)(unsafe.Pointer(bp + 68 /* n */)) = (int32(uint64(unsafe.Sizeof([100]int8{})) * uint64(2)))
 65103  	}
 65104  	*(*int32)(unsafe.Pointer(bp + 68 /* n */)) = sqlite3TestHexToBin(tls, zHex, *(*int32)(unsafe.Pointer(bp + 68 /* n */)), bp+72 /* &zBin[0] */)
 65105  	if *(*int32)(unsafe.Pointer(bp + 68 /* n */)) == 0 {
 65106  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+33094 /* "no data" */, uintptr(0)))
 65107  		return TCL_ERROR
 65108  	}
 65109  	zOut = *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))
 65110  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 64 /* size */)); i++ {
 65111  		*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = *(*int8)(unsafe.Pointer(bp + 72 /* &zBin[0] */ + uintptr((i % *(*int32)(unsafe.Pointer(bp + 68 /* n */))))))
 65112  	}
 65113  	return TCL_OK
 65114  }
 65115  
 65116  // Usage:    memget  ADDRESS  SIZE
 65117  //
 65118  // Return memory as hexadecimal text.
 65119  func test_memget(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:429:26: */
 65120  	bp := tls.Alloc(168)
 65121  	defer tls.Free(168)
 65122  
 65123  	// var p uintptr at bp+56, 8
 65124  
 65125  	// var size int32 at bp+64, 4
 65126  
 65127  	var n int32
 65128  	var zBin uintptr
 65129  	// var zHex [100]int8 at bp+68, 100
 65130  
 65131  	if objc != 3 {
 65132  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33102 /* "ADDRESS SIZE" */)
 65133  		return TCL_ERROR
 65134  	}
 65135  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+56 /* &p */) != 0 {
 65136  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), uintptr(0)))
 65137  		return TCL_ERROR
 65138  	}
 65139  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+64 /* &size */) != 0 {
 65140  		return TCL_ERROR
 65141  	}
 65142  	if *(*int32)(unsafe.Pointer(bp + 64 /* size */)) <= 0 {
 65143  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+33072 /* "size must be pos..." */, uintptr(0)))
 65144  		return TCL_ERROR
 65145  	}
 65146  	zBin = *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))
 65147  	for *(*int32)(unsafe.Pointer(bp + 64 /* size */)) > 0 {
 65148  		if uint64(*(*int32)(unsafe.Pointer(bp + 64 /* size */))) > ((uint64(unsafe.Sizeof([100]int8{})) - uint64(1)) / uint64(2)) {
 65149  			n = (int32((uint64(unsafe.Sizeof([100]int8{})) - uint64(1)) / uint64(2)))
 65150  		} else {
 65151  			n = *(*int32)(unsafe.Pointer(bp + 64 /* size */))
 65152  		}
 65153  		libc.Xmemcpy(tls, bp+68 /* &zHex[0] */, zBin, uint64(n))
 65154  		zBin += uintptr(n)
 65155  		*(*int32)(unsafe.Pointer(bp + 64 /* size */)) -= n
 65156  		sqlite3TestBinToHex(tls, bp+68 /* &zHex[0] */, n)
 65157  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+68 /* &zHex[0] */, uintptr(0)))
 65158  	}
 65159  	return TCL_OK
 65160  }
 65161  
 65162  // Usage:    sqlite3_memory_used
 65163  //
 65164  // Raw test interface for sqlite3_memory_used().
 65165  func test_memory_used(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:476:26: */
 65166  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_memory_used(tls)))
 65167  	return TCL_OK
 65168  }
 65169  
 65170  // Usage:    sqlite3_memory_highwater ?RESETFLAG?
 65171  //
 65172  // Raw test interface for sqlite3_memory_highwater().
 65173  func test_memory_highwater(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:491:26: */
 65174  	bp := tls.Alloc(4)
 65175  	defer tls.Free(4)
 65176  
 65177  	*(*int32)(unsafe.Pointer(bp /* resetFlag */)) = 0
 65178  	if (objc != 1) && (objc != 2) {
 65179  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33115 /* "?RESET?" */)
 65180  		return TCL_ERROR
 65181  	}
 65182  	if objc == 2 {
 65183  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &resetFlag */) != 0 {
 65184  			return TCL_ERROR
 65185  		}
 65186  	}
 65187  	tcl.XTcl_SetObjResult(tls, interp,
 65188  		tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_memory_highwater(tls, *(*int32)(unsafe.Pointer(bp /* resetFlag */)))))
 65189  	return TCL_OK
 65190  }
 65191  
 65192  // Usage:    sqlite3_memdebug_backtrace DEPTH
 65193  //
 65194  // Set the depth of backtracing.  If SQLITE_MEMDEBUG is not defined
 65195  // then this routine is a no-op.
 65196  func test_memdebug_backtrace(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:516:26: */
 65197  	bp := tls.Alloc(4)
 65198  	defer tls.Free(4)
 65199  
 65200  	// var depth int32 at bp, 4
 65201  
 65202  	if objc != 2 {
 65203  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33123 /* "DEPT" */)
 65204  		return TCL_ERROR
 65205  	}
 65206  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &depth */) != 0 {
 65207  		return TCL_ERROR
 65208  	}
 65209  	return TCL_OK
 65210  }
 65211  
 65212  // Usage:    sqlite3_memdebug_dump  FILENAME
 65213  //
 65214  // Write a summary of unfreed memory to FILENAME.
 65215  func test_memdebug_dump(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:542:26: */
 65216  	if objc != 2 {
 65217  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 65218  		return TCL_ERROR
 65219  	}
 65220  	return TCL_OK
 65221  }
 65222  
 65223  // Usage:    sqlite3_memdebug_malloc_count
 65224  //
 65225  // Return the total number of times malloc() has been called.
 65226  func test_memdebug_malloc_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:567:26: */
 65227  	var nMalloc int32 = -1
 65228  	if objc != 1 {
 65229  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 65230  		return TCL_ERROR
 65231  	}
 65232  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nMalloc))
 65233  	return TCL_OK
 65234  }
 65235  
 65236  // Usage:    sqlite3_memdebug_fail  COUNTER  ?OPTIONS?
 65237  //
 65238  // where options are:
 65239  //
 65240  //     -repeat    <count>
 65241  //     -benigncnt <varname>
 65242  //
 65243  // Arrange for a simulated malloc() failure after COUNTER successes.
 65244  // If a repeat count is specified, the fault is repeated that many
 65245  // times.
 65246  //
 65247  // Each call to this routine overrides the prior counter value.
 65248  // This routine returns the number of simulated failures that have
 65249  // happened since the previous call to this routine.
 65250  //
 65251  // To disable simulated failures, use a COUNTER of -1.
 65252  func test_memdebug_fail(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:607:26: */
 65253  	bp := tls.Alloc(36)
 65254  	defer tls.Free(36)
 65255  
 65256  	var ii int32
 65257  	// var iFail int32 at bp+24, 4
 65258  
 65259  	*(*int32)(unsafe.Pointer(bp + 32 /* nRepeat */)) = 1
 65260  	var pBenignCnt uintptr = uintptr(0)
 65261  	var nBenign int32
 65262  	var nFail int32 = 0
 65263  
 65264  	if objc < 2 {
 65265  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33137 /* "COUNTER ?OPTIONS..." */)
 65266  		return TCL_ERROR
 65267  	}
 65268  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+24 /* &iFail */) != 0 {
 65269  		return TCL_ERROR
 65270  	}
 65271  
 65272  	for ii = 2; ii < objc; ii = ii + (2) {
 65273  		// var nOption int32 at bp+28, 4
 65274  
 65275  		var zOption uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(ii)*8)), bp+28 /* &nOption */)
 65276  		var zErr uintptr = uintptr(0)
 65277  
 65278  		if (*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)) > 1) && (libc.Xstrncmp(tls, zOption, ts+33155 /* "-repeat" */, uint64(*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)))) == 0) {
 65279  			if ii == (objc - 1) {
 65280  				zErr = ts + 13108 /* "option requires ..." */
 65281  			} else {
 65282  				if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((ii+1))*8)), bp+32 /* &nRepeat */) != 0 {
 65283  					return TCL_ERROR
 65284  				}
 65285  			}
 65286  		} else if (*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)) > 1) && (libc.Xstrncmp(tls, zOption, ts+33163 /* "-benigncnt" */, uint64(*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)))) == 0) {
 65287  			if ii == (objc - 1) {
 65288  				zErr = ts + 13108 /* "option requires ..." */
 65289  			} else {
 65290  				pBenignCnt = *(*uintptr)(unsafe.Pointer(objv + uintptr((ii+1))*8))
 65291  			}
 65292  		} else {
 65293  			zErr = ts + 12914 /* "unknown option: " */
 65294  		}
 65295  
 65296  		if zErr != 0 {
 65297  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, zErr, zOption, 0))
 65298  			return TCL_ERROR
 65299  		}
 65300  	}
 65301  
 65302  	nBenign = faultsimBenignFailures(tls)
 65303  	nFail = faultsimFailures(tls)
 65304  	faultsimConfig(tls, *(*int32)(unsafe.Pointer(bp + 24 /* iFail */)), *(*int32)(unsafe.Pointer(bp + 32 /* nRepeat */)))
 65305  
 65306  	if pBenignCnt != 0 {
 65307  		tcl.XTcl_ObjSetVar2(tls, interp, pBenignCnt, uintptr(0), tcl.XTcl_NewIntObj(tls, nBenign), 0)
 65308  	}
 65309  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nFail))
 65310  	return TCL_OK
 65311  }
 65312  
 65313  // Usage:    sqlite3_memdebug_pending
 65314  //
 65315  // Return the number of malloc() calls that will succeed before a
 65316  // simulated failure occurs. A negative return value indicates that
 65317  // no malloc() failure is scheduled.
 65318  func test_memdebug_pending(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:673:26: */
 65319  	var nPending int32
 65320  	if objc != 1 {
 65321  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 65322  		return TCL_ERROR
 65323  	}
 65324  	nPending = faultsimPending(tls)
 65325  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nPending))
 65326  	return TCL_OK
 65327  }
 65328  
 65329  // The following global variable keeps track of the number of tests
 65330  // that have run.  This variable is only useful when running in the
 65331  // debugger.
 65332  var sqlite3_memdebug_title_count int32 = 0 /* test_malloc.c:694:12 */
 65333  
 65334  // Usage:    sqlite3_memdebug_settitle TITLE
 65335  //
 65336  // Set a title string stored with each allocation.  The TITLE is
 65337  // typically the name of the test that was running when the
 65338  // allocation occurred.  The TITLE is stored with the allocation
 65339  // and can be used to figure out which tests are leaking memory.
 65340  //
 65341  // Each title overwrite the previous.
 65342  func test_memdebug_settitle(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:706:26: */
 65343  	sqlite3_memdebug_title_count++
 65344  	if objc != 2 {
 65345  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33174 /* "TITLE" */)
 65346  		return TCL_ERROR
 65347  	}
 65348  	return TCL_OK
 65349  }
 65350  
 65351  var aMallocLog Tcl_HashTable   /* test_malloc.c:732:22: */
 65352  var mallocLogEnabled int32 = 0 /* test_malloc.c:733:12 */
 65353  
 65354  type MallocLog1 = struct {
 65355  	FnCall int32
 65356  	FnByte int32
 65357  } /* test_malloc.c:735:9 */
 65358  
 65359  type MallocLog = MallocLog1 /* test_malloc.c:735:26 */
 65360  
 65361  func test_memdebug_log_clear(tls *libc.TLS) { /* test_malloc.c:772:13: */
 65362  	bp := tls.Alloc(24)
 65363  	defer tls.Free(24)
 65364  
 65365  	// var search Tcl_HashSearch at bp, 24
 65366  
 65367  	var pEntry uintptr
 65368  	for pEntry = tcl.XTcl_FirstHashEntry(tls, uintptr(unsafe.Pointer(&aMallocLog)), bp /* &search */); pEntry != 0; pEntry = tcl.XTcl_NextHashEntry(tls, bp /* &search */) {
 65369  		var pLog uintptr = (*Tcl_HashEntry)(unsafe.Pointer(pEntry)).FclientData
 65370  		tcl.XTcl_Free(tls, pLog)
 65371  	}
 65372  	tcl.XTcl_DeleteHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)))
 65373  	tcl.XTcl_InitHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)), (int32(uint64(10) * (func() uint64 {
 65374  		if uint64(unsafe.Sizeof(int32(0))) >= uint64(unsafe.Sizeof(uintptr(0))) {
 65375  			return uint64(1)
 65376  		}
 65377  		return (uint64(unsafe.Sizeof(uintptr(0))) / uint64(unsafe.Sizeof(int32(0))))
 65378  	}()))))
 65379  }
 65380  
 65381  func test_memdebug_log(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:787:26: */
 65382  	bp := tls.Alloc(128)
 65383  	defer tls.Free(128)
 65384  
 65385  	// var iSub int32 at bp, 4
 65386  
 65387  	if !(isInit != 0) {
 65388  		tcl.XTcl_InitHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)), (int32(uint64(10) * (func() uint64 {
 65389  			if uint64(unsafe.Sizeof(int32(0))) >= uint64(unsafe.Sizeof(uintptr(0))) {
 65390  				return uint64(1)
 65391  			}
 65392  			return (uint64(unsafe.Sizeof(uintptr(0))) / uint64(unsafe.Sizeof(int32(0))))
 65393  		}()))))
 65394  		isInit = 1
 65395  	}
 65396  
 65397  	if objc < 2 {
 65398  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 65399  	}
 65400  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&MB_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp /* &iSub */) != 0 {
 65401  		return TCL_ERROR
 65402  	}
 65403  
 65404  	switch uint32(*(*int32)(unsafe.Pointer(bp /* iSub */))) {
 65405  	case uint32(0) /* MB_LOG_START */ :
 65406  		mallocLogEnabled = 1
 65407  		break
 65408  	case uint32(1) /* MB_LOG_STOP */ :
 65409  		mallocLogEnabled = 0
 65410  		break
 65411  	case uint32(2) /* MB_LOG_DUMP */ :
 65412  		{
 65413  			// var search Tcl_HashSearch at bp+8, 24
 65414  
 65415  			var pEntry uintptr
 65416  			var pRet uintptr = tcl.XTcl_NewObj(tls)
 65417  
 65418  			for pEntry = tcl.XTcl_FirstHashEntry(tls, uintptr(unsafe.Pointer(&aMallocLog)), bp+8 /* &search */); pEntry != 0; pEntry = tcl.XTcl_NextHashEntry(tls, bp+8 /* &search */) {
 65419  				// var apElem [12]uintptr at bp+32, 96
 65420  
 65421  				var pLog uintptr = (*Tcl_HashEntry)(unsafe.Pointer(pEntry)).FclientData
 65422  				var aKey uintptr = func() uintptr {
 65423  					if ((*Tcl_HashTable)(unsafe.Pointer((uintptr(unsafe.Pointer(&aMallocLog))))).FkeyType == (1)) || ((*Tcl_HashTable)(unsafe.Pointer((uintptr(unsafe.Pointer(&aMallocLog))))).FkeyType == (-1)) {
 65424  						return *(*uintptr)(unsafe.Pointer(pEntry + 32 /* &.key */))
 65425  					}
 65426  					return pEntry + 32 /* &.key */
 65427  				}()
 65428  				var ii int32
 65429  
 65430  				*(*uintptr)(unsafe.Pointer(bp + 32 /* &apElem[0] */)) = tcl.XTcl_NewIntObj(tls, (*MallocLog)(unsafe.Pointer(pLog)).FnCall)
 65431  				*(*uintptr)(unsafe.Pointer(bp + 32 /* &apElem[0] */ + 1*8)) = tcl.XTcl_NewIntObj(tls, (*MallocLog)(unsafe.Pointer(pLog)).FnByte)
 65432  				for ii = 0; ii < MALLOC_LOG_FRAMES; ii++ {
 65433  					*(*uintptr)(unsafe.Pointer(bp + 32 /* &apElem[0] */ + uintptr((ii+2))*8)) = tcl.XTcl_NewWideIntObj(tls, *(*Tcl_WideInt)(unsafe.Pointer(aKey + uintptr(ii)*8)))
 65434  				}
 65435  
 65436  				tcl.XTcl_ListObjAppendElement(tls, interp, pRet,
 65437  					tcl.XTcl_NewListObj(tls, (MALLOC_LOG_FRAMES+2), bp+32 /* &apElem[0] */))
 65438  			}
 65439  
 65440  			tcl.XTcl_SetObjResult(tls, interp, pRet)
 65441  			break
 65442  
 65443  		}
 65444  	case uint32(3) /* MB_LOG_CLEAR */ :
 65445  		{
 65446  			test_memdebug_log_clear(tls)
 65447  			break
 65448  
 65449  		}
 65450  
 65451  	case uint32(4) /* MB_LOG_SYNC */ :
 65452  		{
 65453  			break
 65454  
 65455  		}
 65456  	}
 65457  
 65458  	return TCL_OK
 65459  }
 65460  
 65461  var isInit int32 = 0                                                                                                                                    /* test_malloc.c:793:14 */
 65462  var MB_strs = [5]uintptr{ts + 33196 /* "start" */, ts + 33202 /* "stop" */, ts + 33207 /* "dump" */, ts + 33212 /* "clear" */, ts + 33218 /* "sync" */} /* test_malloc.c:796:21 */
 65463  
 65464  // Usage:    sqlite3_config_pagecache SIZE N
 65465  //
 65466  // Set the page-cache memory buffer using SQLITE_CONFIG_PAGECACHE.
 65467  // The buffer is static and is of limited size.  N might be
 65468  // adjusted downward as needed to accommodate the requested size.
 65469  // The revised value of N is returned.
 65470  //
 65471  // A negative SIZE causes the buffer pointer to be NULL.
 65472  func test_config_pagecache(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:885:26: */
 65473  	bp := tls.Alloc(56)
 65474  	defer tls.Free(56)
 65475  
 65476  	// var sz int32 at bp+48, 4
 65477  
 65478  	// var N int32 at bp+52, 4
 65479  
 65480  	var pRes uintptr
 65481  	if objc != 3 {
 65482  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33223 /* "SIZE N" */)
 65483  		return TCL_ERROR
 65484  	}
 65485  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+48 /* &sz */) != 0 {
 65486  		return TCL_ERROR
 65487  	}
 65488  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+52 /* &N */) != 0 {
 65489  		return TCL_ERROR
 65490  	}
 65491  	libc.Xfree(tls, buf1)
 65492  	buf1 = uintptr(0)
 65493  
 65494  	// Set the return value
 65495  	pRes = tcl.XTcl_NewObj(tls)
 65496  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRes, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FszPage))
 65497  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRes, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FnPage))
 65498  	tcl.XTcl_SetObjResult(tls, interp, pRes)
 65499  
 65500  	if *(*int32)(unsafe.Pointer(bp + 48 /* sz */)) < 0 {
 65501  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PAGECACHE, libc.VaList(bp, uintptr(0), 0, 0))
 65502  	} else {
 65503  		buf1 = libc.Xmalloc(tls, (uint64(*(*int32)(unsafe.Pointer(bp + 48 /* sz */)) * *(*int32)(unsafe.Pointer(bp + 52 /* N */)))))
 65504  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PAGECACHE, libc.VaList(bp+24, buf1, *(*int32)(unsafe.Pointer(bp + 48 /* sz */)), *(*int32)(unsafe.Pointer(bp + 52 /* N */))))
 65505  	}
 65506  	return TCL_OK
 65507  }
 65508  
 65509  var buf1 uintptr = uintptr(0) /* test_malloc.c:893:15 */
 65510  
 65511  // Usage:    sqlite3_config_alt_pcache INSTALL_FLAG DISCARD_CHANCE PRNG_SEED
 65512  //
 65513  // Set up the alternative test page cache.  Install if INSTALL_FLAG is
 65514  // true and uninstall (reverting to the default page cache) if INSTALL_FLAG
 65515  // is false.  DISCARD_CHANGE is an integer between 0 and 100 inclusive
 65516  // which determines the chance of discarding a page when unpinned.  100
 65517  // is certainty.  0 is never.  PRNG_SEED is the pseudo-random number generator
 65518  // seed.
 65519  func test_alt_pcache(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:928:26: */
 65520  	bp := tls.Alloc(32)
 65521  	defer tls.Free(32)
 65522  
 65523  	// var installFlag int32 at bp+16, 4
 65524  
 65525  	*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) = 0
 65526  	*(*int32)(unsafe.Pointer(bp + 24 /* prngSeed */)) = 0
 65527  	*(*int32)(unsafe.Pointer(bp + 28 /* highStress */)) = 0
 65528  	if (objc < 2) || (objc > 5) {
 65529  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 65530  			ts+33230 /* "INSTALLFLAG DISC..." */)
 65531  		return TCL_ERROR
 65532  	}
 65533  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &installFlag */) != 0 {
 65534  		return TCL_ERROR
 65535  	}
 65536  	if (objc >= 3) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+20 /* &discardChance */) != 0) {
 65537  		return TCL_ERROR
 65538  	}
 65539  	if (objc >= 4) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+24 /* &prngSeed */) != 0) {
 65540  		return TCL_ERROR
 65541  	}
 65542  	if (objc >= 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+28 /* &highStress */) != 0) {
 65543  		return TCL_ERROR
 65544  	}
 65545  	if (*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) > 100) {
 65546  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33277, /* "discard-chance s..." */
 65547  			uintptr(0)))
 65548  		return TCL_ERROR
 65549  	}
 65550  	installTestPCache(tls, *(*int32)(unsafe.Pointer(bp + 16 /* installFlag */)), uint32(*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */))), uint32(*(*int32)(unsafe.Pointer(bp + 24 /* prngSeed */))),
 65551  		uint32(*(*int32)(unsafe.Pointer(bp + 28 /* highStress */))))
 65552  	return TCL_OK
 65553  }
 65554  
 65555  // Usage:    sqlite3_config_memstatus BOOLEAN
 65556  //
 65557  // Enable or disable memory status reporting using SQLITE_CONFIG_MEMSTATUS.
 65558  func test_config_memstatus(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:969:26: */
 65559  	bp := tls.Alloc(12)
 65560  	defer tls.Free(12)
 65561  
 65562  	// var enable int32 at bp+8, 4
 65563  
 65564  	var rc int32
 65565  	if objc != 2 {
 65566  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 65567  		return TCL_ERROR
 65568  	}
 65569  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &enable */) != 0 {
 65570  		return TCL_ERROR
 65571  	}
 65572  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MEMSTATUS, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* enable */))))
 65573  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 65574  	return TCL_OK
 65575  }
 65576  
 65577  // Usage:    sqlite3_config_lookaside  SIZE  COUNT
 65578  //
 65579  func test_config_lookaside(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:990:26: */
 65580  	bp := tls.Alloc(24)
 65581  	defer tls.Free(24)
 65582  
 65583  	// var sz int32 at bp+16, 4
 65584  
 65585  	// var cnt int32 at bp+20, 4
 65586  
 65587  	var pRet uintptr
 65588  	if objc != 3 {
 65589  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33320 /* "SIZE COUNT" */)
 65590  		return TCL_ERROR
 65591  	}
 65592  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &sz */) != 0 {
 65593  		return TCL_ERROR
 65594  	}
 65595  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+20 /* &cnt */) != 0 {
 65596  		return TCL_ERROR
 65597  	}
 65598  	pRet = tcl.XTcl_NewObj(tls)
 65599  	tcl.XTcl_ListObjAppendElement(tls,
 65600  		interp, pRet, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FszLookaside))
 65601  	tcl.XTcl_ListObjAppendElement(tls,
 65602  		interp, pRet, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FnLookaside))
 65603  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOOKASIDE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 16 /* sz */)), *(*int32)(unsafe.Pointer(bp + 20 /* cnt */))))
 65604  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 65605  	return TCL_OK
 65606  }
 65607  
 65608  // Usage:    sqlite3_db_config_lookaside  CONNECTION  BUFID  SIZE  COUNT
 65609  //
 65610  // There are two static buffers with BUFID 1 and 2.   Each static buffer
 65611  // is 10KB in size.  A BUFID of 0 indicates that the buffer should be NULL
 65612  // which will cause sqlite3_db_config() to allocate space on its own.
 65613  func test_db_config_lookaside(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1024:26: */
 65614  	bp := tls.Alloc(84)
 65615  	defer tls.Free(84)
 65616  
 65617  	var rc int32
 65618  	// var sz int32 at bp+76, 4
 65619  
 65620  	// var cnt int32 at bp+80, 4
 65621  
 65622  	// var db uintptr at bp+64, 8
 65623  
 65624  	// var bufid int32 at bp+72, 4
 65625  
 65626  	if objc != 5 {
 65627  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33331 /* "BUFID SIZE COUNT" */)
 65628  		return TCL_ERROR
 65629  	}
 65630  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+64 /* &db */) != 0 {
 65631  		return TCL_ERROR
 65632  	}
 65633  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+72 /* &bufid */) != 0 {
 65634  		return TCL_ERROR
 65635  	}
 65636  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+76 /* &sz */) != 0 {
 65637  		return TCL_ERROR
 65638  	}
 65639  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+80 /* &cnt */) != 0 {
 65640  		return TCL_ERROR
 65641  	}
 65642  	if *(*int32)(unsafe.Pointer(bp + 72 /* bufid */)) == 0 {
 65643  		rc = sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), SQLITE_DBCONFIG_LOOKASIDE, libc.VaList(bp, uintptr(0), *(*int32)(unsafe.Pointer(bp + 76 /* sz */)), *(*int32)(unsafe.Pointer(bp + 80 /* cnt */))))
 65644  	} else if ((*(*int32)(unsafe.Pointer(bp + 72 /* bufid */)) >= 1) && (*(*int32)(unsafe.Pointer(bp + 72 /* bufid */)) <= 2)) && ((uint64(*(*int32)(unsafe.Pointer(bp + 76 /* sz */)) * *(*int32)(unsafe.Pointer(bp + 80 /* cnt */)))) <= uint64(unsafe.Sizeof([10000]int8{}))) {
 65645  		rc = sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), SQLITE_DBCONFIG_LOOKASIDE, libc.VaList(bp+24, (uintptr(unsafe.Pointer(&azBuf))+uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* bufid */)))*10000), *(*int32)(unsafe.Pointer(bp + 76 /* sz */)), *(*int32)(unsafe.Pointer(bp + 80 /* cnt */))))
 65646  	} else {
 65647  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+33348 /* "illegal argument..." */, uintptr(0)))
 65648  		return TCL_ERROR
 65649  	}
 65650  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 65651  	return TCL_OK
 65652  }
 65653  
 65654  var azBuf [2][10000]int8 /* test_malloc.c:1034:15: */
 65655  
 65656  // Usage:    sqlite3_config_heap NBYTE NMINALLOC
 65657  func test_config_heap(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1059:26: */
 65658  	bp := tls.Alloc(56)
 65659  	defer tls.Free(56)
 65660  	// Use this memory
 65661  	// var nByte int32 at bp+48, 4
 65662  	// Size of buffer to pass to sqlite3_config()
 65663  	// var nMinAlloc int32 at bp+52, 4
 65664  	// Size of minimum allocation
 65665  	var rc int32 // Return code of sqlite3_config()
 65666  
 65667  	var aArg uintptr = (objv + 1*8)
 65668  	var nArg int32 = (objc - 1)
 65669  
 65670  	if nArg != 2 {
 65671  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33386 /* "NBYTE NMINALLOC" */)
 65672  		return TCL_ERROR
 65673  	}
 65674  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg)), bp+48 /* &nByte */) != 0 {
 65675  		return TCL_ERROR
 65676  	}
 65677  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg + 1*8)), bp+52 /* &nMinAlloc */) != 0 {
 65678  		return TCL_ERROR
 65679  	}
 65680  
 65681  	if *(*int32)(unsafe.Pointer(bp + 48 /* nByte */)) == 0 {
 65682  		libc.Xfree(tls, zBuf)
 65683  		zBuf = uintptr(0)
 65684  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_HEAP, libc.VaList(bp, uintptr(0), 0, 0))
 65685  	} else {
 65686  		zBuf = libc.Xrealloc(tls, zBuf, uint64(*(*int32)(unsafe.Pointer(bp + 48 /* nByte */))))
 65687  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_HEAP, libc.VaList(bp+24, zBuf, *(*int32)(unsafe.Pointer(bp + 48 /* nByte */)), *(*int32)(unsafe.Pointer(bp + 52 /* nMinAlloc */))))
 65688  	}
 65689  
 65690  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 65691  	return TCL_OK
 65692  }
 65693  
 65694  var zBuf uintptr /* test_malloc.c:1065:15: */
 65695  
 65696  // Usage:    sqlite3_config_heap_size NBYTE
 65697  func test_config_heap_size(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1096:26: */
 65698  	bp := tls.Alloc(12)
 65699  	defer tls.Free(12)
 65700  
 65701  	// var nByte int32 at bp+8, 4
 65702  	// Size to pass to sqlite3_config()
 65703  	var rc int32 // Return code of sqlite3_config()
 65704  
 65705  	var aArg uintptr = (objv + 1*8)
 65706  	var nArg int32 = (objc - 1)
 65707  
 65708  	if nArg != 1 {
 65709  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16691 /* "NBYTE" */)
 65710  		return TCL_ERROR
 65711  	}
 65712  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg)), bp+8 /* &nByte */) != 0 {
 65713  		return TCL_ERROR
 65714  	}
 65715  
 65716  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_WIN32_HEAPSIZE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* nByte */))))
 65717  
 65718  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 65719  	return TCL_OK
 65720  }
 65721  
 65722  // Usage:    sqlite3_config_error  [DB]
 65723  //
 65724  // Invoke sqlite3_config() or sqlite3_db_config() with invalid
 65725  // opcodes and verify that they return errors.
 65726  func test_config_error(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1126:26: */
 65727  	bp := tls.Alloc(40)
 65728  	defer tls.Free(40)
 65729  
 65730  	// var db uintptr at bp+32, 8
 65731  
 65732  	if (objc != 2) && (objc != 1) {
 65733  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33402 /* "[DB]" */)
 65734  		return TCL_ERROR
 65735  	}
 65736  	if objc == 2 {
 65737  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+32 /* &db */) != 0 {
 65738  			return TCL_ERROR
 65739  		}
 65740  		if sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), 99999, 0) != SQLITE_ERROR {
 65741  			tcl.XTcl_AppendResult(tls, interp,
 65742  				libc.VaList(bp, ts+33407, /* "sqlite3_db_confi..." */
 65743  					uintptr(0)))
 65744  			return TCL_ERROR
 65745  		}
 65746  	} else {
 65747  		if sqlite3.Xsqlite3_config(tls, 99999, 0) != SQLITE_ERROR {
 65748  			tcl.XTcl_AppendResult(tls, interp,
 65749  				libc.VaList(bp+16, ts+33465, /* "sqlite3_config(9..." */
 65750  					uintptr(0)))
 65751  			return TCL_ERROR
 65752  		}
 65753  	}
 65754  	return TCL_OK
 65755  }
 65756  
 65757  // Usage:    sqlite3_config_uri  BOOLEAN
 65758  //
 65759  // Enables or disables interpretation of URI parameters by default using
 65760  // SQLITE_CONFIG_URI.
 65761  func test_config_uri(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1164:26: */
 65762  	bp := tls.Alloc(12)
 65763  	defer tls.Free(12)
 65764  
 65765  	var rc int32
 65766  	// var bOpenUri int32 at bp+8, 4
 65767  
 65768  	if objc != 2 {
 65769  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 65770  		return TCL_ERROR
 65771  	}
 65772  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &bOpenUri */) != 0 {
 65773  		return TCL_ERROR
 65774  	}
 65775  
 65776  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_URI, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* bOpenUri */))))
 65777  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 65778  
 65779  	return TCL_OK
 65780  }
 65781  
 65782  // Usage:    sqlite3_config_cis  BOOLEAN
 65783  //
 65784  // Enables or disables the use of the covering-index scan optimization.
 65785  // SQLITE_CONFIG_COVERING_INDEX_SCAN.
 65786  func test_config_cis(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1193:26: */
 65787  	bp := tls.Alloc(12)
 65788  	defer tls.Free(12)
 65789  
 65790  	var rc int32
 65791  	// var bUseCis int32 at bp+8, 4
 65792  
 65793  	if objc != 2 {
 65794  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 65795  		return TCL_ERROR
 65796  	}
 65797  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &bUseCis */) != 0 {
 65798  		return TCL_ERROR
 65799  	}
 65800  
 65801  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_COVERING_INDEX_SCAN, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* bUseCis */))))
 65802  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 65803  
 65804  	return TCL_OK
 65805  }
 65806  
 65807  // Usage:    sqlite3_config_pmasz  INTEGER
 65808  //
 65809  // Set the minimum PMA size.
 65810  func test_config_pmasz(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1221:26: */
 65811  	bp := tls.Alloc(12)
 65812  	defer tls.Free(12)
 65813  
 65814  	var rc int32
 65815  	// var iPmaSz int32 at bp+8, 4
 65816  
 65817  	if objc != 2 {
 65818  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 65819  		return TCL_ERROR
 65820  	}
 65821  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+8 /* &iPmaSz */) != 0 {
 65822  		return TCL_ERROR
 65823  	}
 65824  
 65825  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PMASZ, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* iPmaSz */))))
 65826  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 65827  
 65828  	return TCL_OK
 65829  }
 65830  
 65831  // Usage:    sqlite3_dump_memsys3  FILENAME
 65832  //           sqlite3_dump_memsys5  FILENAME
 65833  //
 65834  // Write a summary of unfreed memsys3 allocations to FILENAME.
 65835  func test_dump_memsys3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1251:26: */
 65836  	if objc != 2 {
 65837  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 65838  		return TCL_ERROR
 65839  	}
 65840  
 65841  	switch int32(clientData) {
 65842  	case 3:
 65843  		{
 65844  
 65845  		}
 65846  		fallthrough
 65847  	case 5:
 65848  		{
 65849  
 65850  		}
 65851  	}
 65852  	return TCL_OK
 65853  }
 65854  
 65855  // Usage:    sqlite3_status  OPCODE  RESETFLAG
 65856  //
 65857  // Return a list of three elements which are the sqlite3_status() return
 65858  // code, the current value, and the high-water mark value.
 65859  func test_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1287:26: */
 65860  	bp := tls.Alloc(16)
 65861  	defer tls.Free(16)
 65862  
 65863  	var rc int32
 65864  	// var iValue int32 at bp+8, 4
 65865  
 65866  	// var mxValue int32 at bp+12, 4
 65867  
 65868  	var i int32
 65869  	*(*int32)(unsafe.Pointer(bp /* op */)) = 0
 65870  	// var resetFlag int32 at bp+4, 4
 65871  
 65872  	var zOpName uintptr
 65873  	var pResult uintptr
 65874  	if objc != 3 {
 65875  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33516 /* "PARAMETER RESETF..." */)
 65876  		return TCL_ERROR
 65877  	}
 65878  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 65879  	for i = 0; i < (int32(uint64(unsafe.Sizeof(aOp1)) / uint64(unsafe.Sizeof(struct {
 65880  		FzName uintptr
 65881  		Fop    int32
 65882  		_      [4]byte
 65883  	}{})))); i++ {
 65884  		if libc.Xstrcmp(tls, aOp1[i].FzName, zOpName) == 0 {
 65885  			*(*int32)(unsafe.Pointer(bp /* op */)) = aOp1[i].Fop
 65886  			break
 65887  		}
 65888  	}
 65889  	if i >= (int32(uint64(unsafe.Sizeof(aOp1)) / uint64(unsafe.Sizeof(struct {
 65890  		FzName uintptr
 65891  		Fop    int32
 65892  		_      [4]byte
 65893  	}{})))) {
 65894  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &op */) != 0 {
 65895  			return TCL_ERROR
 65896  		}
 65897  	}
 65898  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+4 /* &resetFlag */) != 0 {
 65899  		return TCL_ERROR
 65900  	}
 65901  	*(*int32)(unsafe.Pointer(bp + 8 /* iValue */)) = 0
 65902  	*(*int32)(unsafe.Pointer(bp + 12 /* mxValue */)) = 0
 65903  	rc = sqlite3.Xsqlite3_status(tls, *(*int32)(unsafe.Pointer(bp /* op */)), bp+8 /* &iValue */, bp+12 /* &mxValue */, *(*int32)(unsafe.Pointer(bp + 4 /* resetFlag */)))
 65904  	pResult = tcl.XTcl_NewObj(tls)
 65905  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, rc))
 65906  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 8 /* iValue */))))
 65907  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* mxValue */))))
 65908  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 65909  	return TCL_OK
 65910  }
 65911  
 65912  var aOp1 = [10]struct {
 65913  	FzName uintptr
 65914  	Fop    int32
 65915  	_      [4]byte
 65916  }{
 65917  	{FzName: ts + 33536 /* "SQLITE_STATUS_ME..." */},
 65918  	{FzName: ts + 33562 /* "SQLITE_STATUS_MA..." */, Fop: SQLITE_STATUS_MALLOC_SIZE},
 65919  	{FzName: ts + 33588 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_USED},
 65920  	{FzName: ts + 33617 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_OVERFLOW},
 65921  	{FzName: ts + 33650 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_SIZE},
 65922  	{FzName: ts + 33679 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_USED},
 65923  	{FzName: ts + 33706 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_OVERFLOW},
 65924  	{FzName: ts + 33737 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_SIZE},
 65925  	{FzName: ts + 33764 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PARSER_STACK},
 65926  	{FzName: ts + 33791 /* "SQLITE_STATUS_MA..." */, Fop: SQLITE_STATUS_MALLOC_COUNT},
 65927  } /* test_malloc.c:1299:5 */
 65928  
 65929  // Usage:    sqlite3_db_status  DATABASE  OPCODE  RESETFLAG
 65930  //
 65931  // Return a list of three elements which are the sqlite3_db_status() return
 65932  // code, the current value, and the high-water mark value.
 65933  func test_db_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1344:26: */
 65934  	bp := tls.Alloc(24)
 65935  	defer tls.Free(24)
 65936  
 65937  	var rc int32
 65938  	// var iValue int32 at bp+16, 4
 65939  
 65940  	// var mxValue int32 at bp+20, 4
 65941  
 65942  	var i int32
 65943  	*(*int32)(unsafe.Pointer(bp + 8 /* op */)) = 0
 65944  	// var resetFlag int32 at bp+12, 4
 65945  
 65946  	var zOpName uintptr
 65947  	// var db uintptr at bp, 8
 65948  
 65949  	var pResult uintptr
 65950  	if objc != 4 {
 65951  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33818 /* "DB PARAMETER RES..." */)
 65952  		return TCL_ERROR
 65953  	}
 65954  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 65955  		return TCL_ERROR
 65956  	}
 65957  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 65958  	if libc.Xmemcmp(tls, zOpName, ts+33841 /* "SQLITE_" */, uint64(7)) == 0 {
 65959  		zOpName += uintptr(7)
 65960  	}
 65961  	if libc.Xmemcmp(tls, zOpName, ts+33849 /* "DBSTATUS_" */, uint64(9)) == 0 {
 65962  		zOpName += uintptr(9)
 65963  	}
 65964  	for i = 0; i < (int32(uint64(unsafe.Sizeof(aOp2)) / uint64(unsafe.Sizeof(struct {
 65965  		FzName uintptr
 65966  		Fop    int32
 65967  		_      [4]byte
 65968  	}{})))); i++ {
 65969  		if libc.Xstrcmp(tls, aOp2[i].FzName, zOpName) == 0 {
 65970  			*(*int32)(unsafe.Pointer(bp + 8 /* op */)) = aOp2[i].Fop
 65971  			break
 65972  		}
 65973  	}
 65974  	if i >= (int32(uint64(unsafe.Sizeof(aOp2)) / uint64(unsafe.Sizeof(struct {
 65975  		FzName uintptr
 65976  		Fop    int32
 65977  		_      [4]byte
 65978  	}{})))) {
 65979  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+8 /* &op */) != 0 {
 65980  			return TCL_ERROR
 65981  		}
 65982  	}
 65983  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+12 /* &resetFlag */) != 0 {
 65984  		return TCL_ERROR
 65985  	}
 65986  	*(*int32)(unsafe.Pointer(bp + 16 /* iValue */)) = 0
 65987  	*(*int32)(unsafe.Pointer(bp + 20 /* mxValue */)) = 0
 65988  	rc = sqlite3.Xsqlite3_db_status(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 8 /* op */)), bp+16 /* &iValue */, bp+20 /* &mxValue */, *(*int32)(unsafe.Pointer(bp + 12 /* resetFlag */)))
 65989  	pResult = tcl.XTcl_NewObj(tls)
 65990  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, rc))
 65991  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 16 /* iValue */))))
 65992  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 20 /* mxValue */))))
 65993  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 65994  	return TCL_OK
 65995  }
 65996  
 65997  var aOp2 = [13]struct {
 65998  	FzName uintptr
 65999  	Fop    int32
 66000  	_      [4]byte
 66001  }{
 66002  	{FzName: ts + 33859 /* "LOOKASIDE_USED" */},
 66003  	{FzName: ts + 33874 /* "CACHE_USED" */, Fop: SQLITE_DBSTATUS_CACHE_USED},
 66004  	{FzName: ts + 33885 /* "SCHEMA_USED" */, Fop: SQLITE_DBSTATUS_SCHEMA_USED},
 66005  	{FzName: ts + 33897 /* "STMT_USED" */, Fop: SQLITE_DBSTATUS_STMT_USED},
 66006  	{FzName: ts + 33907 /* "LOOKASIDE_HIT" */, Fop: SQLITE_DBSTATUS_LOOKASIDE_HIT},
 66007  	{FzName: ts + 33921 /* "LOOKASIDE_MISS_S..." */, Fop: SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE},
 66008  	{FzName: ts + 33941 /* "LOOKASIDE_MISS_F..." */, Fop: SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL},
 66009  	{FzName: ts + 33961 /* "CACHE_HIT" */, Fop: SQLITE_DBSTATUS_CACHE_HIT},
 66010  	{FzName: ts + 33971 /* "CACHE_MISS" */, Fop: SQLITE_DBSTATUS_CACHE_MISS},
 66011  	{FzName: ts + 33982 /* "CACHE_WRITE" */, Fop: SQLITE_DBSTATUS_CACHE_WRITE},
 66012  	{FzName: ts + 33994 /* "DEFERRED_FKS" */, Fop: SQLITE_DBSTATUS_DEFERRED_FKS},
 66013  	{FzName: ts + 34007 /* "CACHE_USED_SHARE..." */, Fop: SQLITE_DBSTATUS_CACHE_USED_SHARED},
 66014  	{FzName: ts + 34025 /* "CACHE_SPILL" */, Fop: SQLITE_DBSTATUS_CACHE_SPILL},
 66015  } /* test_malloc.c:1358:5 */
 66016  
 66017  // install_malloc_faultsim BOOLEAN
 66018  func test_install_malloc_faultsim(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1406:26: */
 66019  	bp := tls.Alloc(4)
 66020  	defer tls.Free(4)
 66021  
 66022  	var rc int32
 66023  	// var isInstall int32 at bp, 4
 66024  
 66025  	if objc != 2 {
 66026  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 66027  		return TCL_ERROR
 66028  	}
 66029  	if TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &isInstall */) {
 66030  		return TCL_ERROR
 66031  	}
 66032  	rc = faultsimInstall(tls, *(*int32)(unsafe.Pointer(bp /* isInstall */)))
 66033  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 66034  	return TCL_OK
 66035  }
 66036  
 66037  // sqlite3_install_memsys3
 66038  func test_install_memsys3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1430:26: */
 66039  	var rc int32 = SQLITE_MISUSE
 66040  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 66041  	return TCL_OK
 66042  }
 66043  
 66044  func test_vfs_oom_test(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1445:26: */
 66045  	bp := tls.Alloc(4)
 66046  	defer tls.Free(4)
 66047  
 66048  	if objc > 2 {
 66049  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34037 /* "?INTEGER?" */)
 66050  		return TCL_ERROR
 66051  	} else if objc == 2 {
 66052  		// var iNew int32 at bp, 4
 66053  
 66054  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &iNew */) != 0 {
 66055  			return TCL_ERROR
 66056  		}
 66057  		sqlite3.Xsqlite3_memdebug_vfs_oom_test = *(*int32)(unsafe.Pointer(bp /* iNew */))
 66058  	}
 66059  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_memdebug_vfs_oom_test))
 66060  	return TCL_OK
 66061  }
 66062  
 66063  // Register commands with the TCL interpreter.
 66064  func Sqlitetest_malloc_Init(tls *libc.TLS, interp uintptr) int32 { /* test_malloc.c:1467:5: */
 66065  	var i int32
 66066  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd11)) / uint64(unsafe.Sizeof(struct {
 66067  		FzName      uintptr
 66068  		FxProc      uintptr
 66069  		FclientData int32
 66070  		_           [4]byte
 66071  	}{}))); i++ {
 66072  		var c ClientData = uintptr(intptr_t(aObjCmd11[i].FclientData))
 66073  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd11[i].FzName, aObjCmd11[i].FxProc, c, uintptr(0))
 66074  	}
 66075  	return TCL_OK
 66076  }
 66077  
 66078  var aObjCmd11 = [32]struct {
 66079  	FzName      uintptr
 66080  	FxProc      uintptr
 66081  	FclientData int32
 66082  	_           [4]byte
 66083  }{
 66084  	{FzName: ts + 28381 /* "sqlite3_malloc" */, FxProc: 0},
 66085  	{FzName: ts + 28396 /* "sqlite3_realloc" */, FxProc: 0},
 66086  	{FzName: ts + 34047 /* "sqlite3_free" */, FxProc: 0},
 66087  	{FzName: ts + 34060 /* "memset" */, FxProc: 0},
 66088  	{FzName: ts + 34067 /* "memget" */, FxProc: 0},
 66089  	{FzName: ts + 34074 /* "sqlite3_memory_u..." */, FxProc: 0},
 66090  	{FzName: ts + 34094 /* "sqlite3_memory_h..." */, FxProc: 0},
 66091  	{FzName: ts + 34119 /* "sqlite3_memdebug..." */, FxProc: 0},
 66092  	{FzName: ts + 34146 /* "sqlite3_memdebug..." */, FxProc: 0},
 66093  	{FzName: ts + 34168 /* "sqlite3_memdebug..." */, FxProc: 0},
 66094  	{FzName: ts + 34190 /* "sqlite3_memdebug..." */, FxProc: 0},
 66095  	{FzName: ts + 34215 /* "sqlite3_memdebug..." */, FxProc: 0},
 66096  	{FzName: ts + 34241 /* "sqlite3_memdebug..." */, FxProc: 0},
 66097  	{FzName: ts + 34271 /* "sqlite3_memdebug..." */, FxProc: 0},
 66098  	{FzName: ts + 34292 /* "sqlite3_config_p..." */, FxProc: 0},
 66099  	{FzName: ts + 34317 /* "sqlite3_config_a..." */, FxProc: 0},
 66100  	{FzName: ts + 34343 /* "sqlite3_status" */, FxProc: 0},
 66101  	{FzName: ts + 34358 /* "sqlite3_db_statu..." */, FxProc: 0},
 66102  	{FzName: ts + 34376 /* "install_malloc_f..." */, FxProc: 0},
 66103  	{FzName: ts + 34400 /* "sqlite3_config_h..." */, FxProc: 0},
 66104  	{FzName: ts + 34420 /* "sqlite3_config_h..." */, FxProc: 0},
 66105  	{FzName: ts + 34445 /* "sqlite3_config_m..." */, FxProc: 0},
 66106  	{FzName: ts + 34470 /* "sqlite3_config_l..." */, FxProc: 0},
 66107  	{FzName: ts + 34495 /* "sqlite3_config_e..." */, FxProc: 0},
 66108  	{FzName: ts + 34516 /* "sqlite3_config_u..." */, FxProc: 0},
 66109  	{FzName: ts + 34535 /* "sqlite3_config_c..." */, FxProc: 0},
 66110  	{FzName: ts + 34554 /* "sqlite3_config_p..." */, FxProc: 0},
 66111  	{FzName: ts + 34575 /* "sqlite3_db_confi..." */, FxProc: 0},
 66112  	{FzName: ts + 34603 /* "sqlite3_dump_mem..." */, FxProc: 0, FclientData: 3},
 66113  	{FzName: ts + 34624 /* "sqlite3_dump_mem..." */, FxProc: 0, FclientData: 5},
 66114  	{FzName: ts + 34645 /* "sqlite3_install_..." */, FxProc: 0},
 66115  	{FzName: ts + 34669 /* "sqlite3_memdebug..." */, FxProc: 0},
 66116  } /* test_malloc.c:1472:5 */
 66117  
 66118  // end block for C++
 66119  
 66120  // Local Variables:
 66121  // mode: c
 66122  // c-basic-offset: 4
 66123  // fill-column: 78
 66124  // End:
 66125  
 66126  // This code implements the MD5 message-digest algorithm.
 66127  // The algorithm is due to Ron Rivest.  This code was
 66128  // written by Colin Plumb in 1993, no copyright is claimed.
 66129  // This code is in the public domain; do with it what you wish.
 66130  //
 66131  // Equivalent code is available from RSA Data Security, Inc.
 66132  // This code has been tested against that, and is equivalent,
 66133  // except that you don't need to include two pages of legalese
 66134  // with every copy.
 66135  //
 66136  // To compute the message digest of a chunk of bytes, declare an
 66137  // MD5Context structure, pass it to MD5Init, call MD5Update as
 66138  // needed on buffers full of bytes, and then call MD5Final, which
 66139  // will fill a supplied 16-byte array with the digest.
 66140  
 66141  // If compiled on a machine that doesn't have a 32-bit integer,
 66142  // you just set "uint32" to the appropriate datatype for an
 66143  // unsigned 32-bit integer.  For example:
 66144  //
 66145  //       cc -Duint32='unsigned long' md5.c
 66146  //
 66147  
 66148  type MD5Context1 = struct {
 66149  	FisInit int32
 66150  	Fbuf    [4]uint32
 66151  	Fbits   [2]uint32
 66152  	Fin     [64]uint8
 66153  } /* test_md5.c:57:1 */
 66154  
 66155  type MD5Context = MD5Context1 /* test_md5.c:63:27 */
 66156  
 66157  // Note: this code is harmless on little-endian machines.
 66158  func byteReverse(tls *libc.TLS, buf uintptr, longs uint32) { /* test_md5.c:68:13: */
 66159  	var t uint32
 66160  	for ok := true; ok; ok = libc.PreDecUint32(&longs, 1) != 0 {
 66161  		t = ((((uint32(*(*uint8)(unsafe.Pointer(buf + 3))) << 8) | uint32(*(*uint8)(unsafe.Pointer(buf + 2)))) << 16) | ((uint32(*(*uint8)(unsafe.Pointer(buf + 1))) << 8) | uint32(*(*uint8)(unsafe.Pointer(buf)))))
 66162  		*(*uint32)(unsafe.Pointer(buf)) = t
 66163  		buf += uintptr(4)
 66164  	}
 66165  }
 66166  
 66167  // The four core functions - F1 is optimized somewhat
 66168  
 66169  // #define F1(x, y, z) (x & y | ~x & z)
 66170  
 66171  // This is the central step in the MD5 algorithm.
 66172  
 66173  // The core of the MD5 algorithm, this alters an existing MD5 hash to
 66174  // reflect the addition of 16 longwords of new data.  MD5Update blocks
 66175  // the data and converts bytes into longwords for this routine.
 66176  func MD5Transform(tls *libc.TLS, buf uintptr, in uintptr) { /* test_md5.c:94:13: */
 66177  	var a uint32
 66178  	var b uint32
 66179  	var c uint32
 66180  	var d uint32
 66181  
 66182  	a = *(*uint32)(unsafe.Pointer(buf))
 66183  	b = *(*uint32)(unsafe.Pointer(buf + 1*4))
 66184  	c = *(*uint32)(unsafe.Pointer(buf + 2*4))
 66185  	d = *(*uint32)(unsafe.Pointer(buf + 3*4))
 66186  
 66187  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in))) + 0xd76aa478)
 66188  	a = ((a << 7) | (a >> (32 - 7)))
 66189  	a = a + (b)
 66190  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xe8c7b756)
 66191  	d = ((d << 12) | (d >> (32 - 12)))
 66192  	d = d + (a)
 66193  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 2*4))) + uint32(0x242070db))
 66194  	c = ((c << 17) | (c >> (32 - 17)))
 66195  	c = c + (d)
 66196  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xc1bdceee)
 66197  	b = ((b << 22) | (b >> (32 - 22)))
 66198  	b = b + (c)
 66199  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xf57c0faf)
 66200  	a = ((a << 7) | (a >> (32 - 7)))
 66201  	a = a + (b)
 66202  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 5*4))) + uint32(0x4787c62a))
 66203  	d = ((d << 12) | (d >> (32 - 12)))
 66204  	d = d + (a)
 66205  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xa8304613)
 66206  	c = ((c << 17) | (c >> (32 - 17)))
 66207  	c = c + (d)
 66208  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 7*4))) + 0xfd469501)
 66209  	b = ((b << 22) | (b >> (32 - 22)))
 66210  	b = b + (c)
 66211  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x698098d8))
 66212  	a = ((a << 7) | (a >> (32 - 7)))
 66213  	a = a + (b)
 66214  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0x8b44f7af)
 66215  	d = ((d << 12) | (d >> (32 - 12)))
 66216  	d = d + (a)
 66217  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xffff5bb1)
 66218  	c = ((c << 17) | (c >> (32 - 17)))
 66219  	c = c + (d)
 66220  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 11*4))) + 0x895cd7be)
 66221  	b = ((b << 22) | (b >> (32 - 22)))
 66222  	b = b + (c)
 66223  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 12*4))) + uint32(0x6b901122))
 66224  	a = ((a << 7) | (a >> (32 - 7)))
 66225  	a = a + (b)
 66226  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 13*4))) + 0xfd987193)
 66227  	d = ((d << 12) | (d >> (32 - 12)))
 66228  	d = d + (a)
 66229  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xa679438e)
 66230  	c = ((c << 17) | (c >> (32 - 17)))
 66231  	c = c + (d)
 66232  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 15*4))) + uint32(0x49b40821))
 66233  	b = ((b << 22) | (b >> (32 - 22)))
 66234  	b = b + (c)
 66235  
 66236  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xf61e2562)
 66237  	a = ((a << 5) | (a >> (32 - 5)))
 66238  	a = a + (b)
 66239  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xc040b340)
 66240  	d = ((d << 9) | (d >> (32 - 9)))
 66241  	d = d + (a)
 66242  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 11*4))) + uint32(0x265e5a51))
 66243  	c = ((c << 14) | (c >> (32 - 14)))
 66244  	c = c + (d)
 66245  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in))) + 0xe9b6c7aa)
 66246  	b = ((b << 20) | (b >> (32 - 20)))
 66247  	b = b + (c)
 66248  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xd62f105d)
 66249  	a = ((a << 5) | (a >> (32 - 5)))
 66250  	a = a + (b)
 66251  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 10*4))) + uint32(0x02441453))
 66252  	d = ((d << 9) | (d >> (32 - 9)))
 66253  	d = d + (a)
 66254  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 15*4))) + 0xd8a1e681)
 66255  	c = ((c << 14) | (c >> (32 - 14)))
 66256  	c = c + (d)
 66257  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xe7d3fbc8)
 66258  	b = ((b << 20) | (b >> (32 - 20)))
 66259  	b = b + (c)
 66260  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 9*4))) + uint32(0x21e1cde6))
 66261  	a = ((a << 5) | (a >> (32 - 5)))
 66262  	a = a + (b)
 66263  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xc33707d6)
 66264  	d = ((d << 9) | (d >> (32 - 9)))
 66265  	d = d + (a)
 66266  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xf4d50d87)
 66267  	c = ((c << 14) | (c >> (32 - 14)))
 66268  	c = c + (d)
 66269  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x455a14ed))
 66270  	b = ((b << 20) | (b >> (32 - 20)))
 66271  	b = b + (c)
 66272  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 13*4))) + 0xa9e3e905)
 66273  	a = ((a << 5) | (a >> (32 - 5)))
 66274  	a = a + (b)
 66275  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 2*4))) + 0xfcefa3f8)
 66276  	d = ((d << 9) | (d >> (32 - 9)))
 66277  	d = d + (a)
 66278  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 7*4))) + uint32(0x676f02d9))
 66279  	c = ((c << 14) | (c >> (32 - 14)))
 66280  	c = c + (d)
 66281  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 12*4))) + 0x8d2a4c8a)
 66282  	b = ((b << 20) | (b >> (32 - 20)))
 66283  	b = b + (c)
 66284  
 66285  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xfffa3942)
 66286  	a = ((a << 4) | (a >> (32 - 4)))
 66287  	a = a + (b)
 66288  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 8*4))) + 0x8771f681)
 66289  	d = ((d << 11) | (d >> (32 - 11)))
 66290  	d = d + (a)
 66291  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 11*4))) + uint32(0x6d9d6122))
 66292  	c = ((c << 16) | (c >> (32 - 16)))
 66293  	c = c + (d)
 66294  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xfde5380c)
 66295  	b = ((b << 23) | (b >> (32 - 23)))
 66296  	b = b + (c)
 66297  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xa4beea44)
 66298  	a = ((a << 4) | (a >> (32 - 4)))
 66299  	a = a + (b)
 66300  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 4*4))) + uint32(0x4bdecfa9))
 66301  	d = ((d << 11) | (d >> (32 - 11)))
 66302  	d = d + (a)
 66303  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 7*4))) + 0xf6bb4b60)
 66304  	c = ((c << 16) | (c >> (32 - 16)))
 66305  	c = c + (d)
 66306  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xbebfbc70)
 66307  	b = ((b << 23) | (b >> (32 - 23)))
 66308  	b = b + (c)
 66309  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 13*4))) + uint32(0x289b7ec6))
 66310  	a = ((a << 4) | (a >> (32 - 4)))
 66311  	a = a + (b)
 66312  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in))) + 0xeaa127fa)
 66313  	d = ((d << 11) | (d >> (32 - 11)))
 66314  	d = d + (a)
 66315  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xd4ef3085)
 66316  	c = ((c << 16) | (c >> (32 - 16)))
 66317  	c = c + (d)
 66318  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 6*4))) + uint32(0x04881d05))
 66319  	b = ((b << 23) | (b >> (32 - 23)))
 66320  	b = b + (c)
 66321  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0xd9d4d039)
 66322  	a = ((a << 4) | (a >> (32 - 4)))
 66323  	a = a + (b)
 66324  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 12*4))) + 0xe6db99e5)
 66325  	d = ((d << 11) | (d >> (32 - 11)))
 66326  	d = d + (a)
 66327  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 15*4))) + uint32(0x1fa27cf8))
 66328  	c = ((c << 16) | (c >> (32 - 16)))
 66329  	c = c + (d)
 66330  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 2*4))) + 0xc4ac5665)
 66331  	b = ((b << 23) | (b >> (32 - 23)))
 66332  	b = b + (c)
 66333  
 66334  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in))) + 0xf4292244)
 66335  	a = ((a << 6) | (a >> (32 - 6)))
 66336  	a = a + (b)
 66337  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 7*4))) + uint32(0x432aff97))
 66338  	d = ((d << 10) | (d >> (32 - 10)))
 66339  	d = d + (a)
 66340  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xab9423a7)
 66341  	c = ((c << 15) | (c >> (32 - 15)))
 66342  	c = c + (d)
 66343  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xfc93a039)
 66344  	b = ((b << 21) | (b >> (32 - 21)))
 66345  	b = b + (c)
 66346  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 12*4))) + uint32(0x655b59c3))
 66347  	a = ((a << 6) | (a >> (32 - 6)))
 66348  	a = a + (b)
 66349  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0x8f0ccc92)
 66350  	d = ((d << 10) | (d >> (32 - 10)))
 66351  	d = d + (a)
 66352  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xffeff47d)
 66353  	c = ((c << 15) | (c >> (32 - 15)))
 66354  	c = c + (d)
 66355  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0x85845dd1)
 66356  	b = ((b << 21) | (b >> (32 - 21)))
 66357  	b = b + (c)
 66358  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x6fa87e4f))
 66359  	a = ((a << 6) | (a >> (32 - 6)))
 66360  	a = a + (b)
 66361  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 15*4))) + 0xfe2ce6e0)
 66362  	d = ((d << 10) | (d >> (32 - 10)))
 66363  	d = d + (a)
 66364  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xa3014314)
 66365  	c = ((c << 15) | (c >> (32 - 15)))
 66366  	c = c + (d)
 66367  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 13*4))) + uint32(0x4e0811a1))
 66368  	b = ((b << 21) | (b >> (32 - 21)))
 66369  	b = b + (c)
 66370  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xf7537e82)
 66371  	a = ((a << 6) | (a >> (32 - 6)))
 66372  	a = a + (b)
 66373  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 11*4))) + 0xbd3af235)
 66374  	d = ((d << 10) | (d >> (32 - 10)))
 66375  	d = d + (a)
 66376  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 2*4))) + uint32(0x2ad7d2bb))
 66377  	c = ((c << 15) | (c >> (32 - 15)))
 66378  	c = c + (d)
 66379  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0xeb86d391)
 66380  	b = ((b << 21) | (b >> (32 - 21)))
 66381  	b = b + (c)
 66382  
 66383  	*(*uint32)(unsafe.Pointer(buf)) += (a)
 66384  	*(*uint32)(unsafe.Pointer(buf + 1*4)) += (b)
 66385  	*(*uint32)(unsafe.Pointer(buf + 2*4)) += (c)
 66386  	*(*uint32)(unsafe.Pointer(buf + 3*4)) += (d)
 66387  }
 66388  
 66389  // Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
 66390  // initialization constants.
 66391  func MD5Init(tls *libc.TLS, ctx uintptr) { /* test_md5.c:180:13: */
 66392  	(*MD5Context)(unsafe.Pointer(ctx)).FisInit = 1
 66393  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */))) = uint32(0x67452301)
 66394  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 1*4)) = 0xefcdab89
 66395  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 2*4)) = 0x98badcfe
 66396  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 3*4)) = uint32(0x10325476)
 66397  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */))) = uint32(0)
 66398  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4)) = uint32(0)
 66399  }
 66400  
 66401  // Update context to reflect the concatenation of another buffer full
 66402  // of bytes.
 66403  func MD5Update(tls *libc.TLS, ctx uintptr, buf uintptr, len uint32) { /* test_md5.c:195:6: */
 66404  	var t uint32
 66405  
 66406  	// Update bitcount
 66407  
 66408  	t = *(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */)))
 66409  	if (libc.AssignPtrUint32((ctx + 20 /* &.bits */), (t + (len << 3)))) < t {
 66410  		*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4))++
 66411  	} // Carry from low to high
 66412  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4)) += (len >> 29)
 66413  
 66414  	t = ((t >> 3) & uint32(0x3f)) // Bytes already in shsInfo->data
 66415  
 66416  	// Handle any leading odd-sized chunks
 66417  
 66418  	if t != 0 {
 66419  		var p uintptr = (ctx + 28 /* &.in */ + uintptr(t))
 66420  
 66421  		t = (uint32(64) - t)
 66422  		if len < t {
 66423  			libc.Xmemcpy(tls, p, buf, uint64(len))
 66424  			return
 66425  		}
 66426  		libc.Xmemcpy(tls, p, buf, uint64(t))
 66427  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 66428  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 66429  		buf += uintptr(t)
 66430  		len = len - (t)
 66431  	}
 66432  
 66433  	// Process data in 64-byte chunks
 66434  
 66435  	for len >= uint32(64) {
 66436  		libc.Xmemcpy(tls, ctx+28 /* &.in */, buf, uint64(64))
 66437  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 66438  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 66439  		buf += uintptr(64)
 66440  		len = len - (uint32(64))
 66441  	}
 66442  
 66443  	// Handle any remaining bytes of data.
 66444  
 66445  	libc.Xmemcpy(tls, ctx+28 /* &.in */, buf, uint64(len))
 66446  }
 66447  
 66448  // Final wrapup - pad to 64-byte boundary with the bit pattern
 66449  // 1 0* (64-bit count of bits processed, MSB-first)
 66450  func MD5Final(tls *libc.TLS, digest uintptr, ctx uintptr) { /* test_md5.c:243:13: */
 66451  	var count uint32
 66452  	var p uintptr
 66453  
 66454  	// Compute number of bytes mod 64
 66455  	count = ((*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */))) >> 3) & uint32(0x3F))
 66456  
 66457  	// Set the first char of padding to 0x80.  This is safe since there is
 66458  	//            always at least one byte free
 66459  	p = ((ctx + 28 /* &.in */) + uintptr(count))
 66460  	*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1))) = uint8(0x80)
 66461  
 66462  	// Bytes of padding needed to make 64 bytes
 66463  	count = ((uint32(64 - 1)) - count)
 66464  
 66465  	// Pad out to 56 mod 64
 66466  	if count < uint32(8) {
 66467  		// Two lots of padding:  Pad the first block to 64 bytes
 66468  		libc.Xmemset(tls, p, 0, uint64(count))
 66469  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 66470  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 66471  
 66472  		// Now fill the next block with 56 bytes
 66473  		libc.Xmemset(tls, ctx+28 /* &.in */, 0, uint64(56))
 66474  	} else {
 66475  		// Pad block to 56 bytes
 66476  		libc.Xmemset(tls, p, 0, (uint64(count - uint32(8))))
 66477  	}
 66478  	byteReverse(tls, ctx+28 /* &.in */, uint32(14))
 66479  
 66480  	// Append length in bits and transform
 66481  	libc.Xmemcpy(tls, ((ctx + 28 /* &.in */) + uintptr((14 * 4))), ctx+20 /* &.bits */, uint64(8))
 66482  
 66483  	MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 66484  	byteReverse(tls, ctx+4 /* &.buf */, uint32(4))
 66485  	libc.Xmemcpy(tls, digest, ctx+4 /* &.buf */, uint64(16))
 66486  }
 66487  
 66488  // Convert a 128-bit MD5 digest into a 32-digit base-16 number.
 66489  func MD5DigestToBase16(tls *libc.TLS, digest uintptr, zBuf uintptr) { /* test_md5.c:284:13: */
 66490  	var i int32
 66491  	var j int32
 66492  
 66493  	for j = libc.AssignInt32(&i, 0); i < 16; i++ {
 66494  		var a int32 = int32(*(*uint8)(unsafe.Pointer(digest + uintptr(i))))
 66495  		*(*int8)(unsafe.Pointer(zBuf + uintptr(libc.PostIncInt32(&j, 1)))) = zEncode[((a >> 4) & 0xf)]
 66496  		*(*int8)(unsafe.Pointer(zBuf + uintptr(libc.PostIncInt32(&j, 1)))) = zEncode[(a & 0xf)]
 66497  	}
 66498  	*(*int8)(unsafe.Pointer(zBuf + uintptr(j))) = int8(0)
 66499  }
 66500  
 66501  var zEncode = *(*[17]int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */)) /* test_md5.c:285:21 */
 66502  
 66503  // Convert a 128-bit MD5 digest into sequency of eight 5-digit integers
 66504  // each representing 16 bits of the digest and separated from each
 66505  // other by a "-" character.
 66506  func MD5DigestToBase10x8(tls *libc.TLS, digest uintptr, zDigest uintptr) { /* test_md5.c:302:13: */
 66507  	bp := tls.Alloc(8)
 66508  	defer tls.Free(8)
 66509  
 66510  	var i int32
 66511  	var j int32
 66512  	var x uint32
 66513  	for i = libc.AssignInt32(&j, 0); i < 16; i = i + (2) {
 66514  		x = (uint32((int32(*(*uint8)(unsafe.Pointer(digest + uintptr(i)))) * 256) + int32(*(*uint8)(unsafe.Pointer(digest + uintptr((i + 1)))))))
 66515  		if i > 0 {
 66516  			*(*int8)(unsafe.Pointer(zDigest + uintptr(libc.PostIncInt32(&j, 1)))) = int8('-')
 66517  		}
 66518  		sqlite3.Xsqlite3_snprintf(tls, (50 - j), (zDigest + uintptr(j)), ts+34699 /* "%05u" */, libc.VaList(bp, x))
 66519  		j = j + (5)
 66520  	}
 66521  	*(*int8)(unsafe.Pointer(zDigest + uintptr(j))) = int8(0)
 66522  }
 66523  
 66524  // A TCL command for md5.  The argument is the text to be hashed.  The
 66525  // Result is the hash in base64.
 66526  func md5_cmd(tls *libc.TLS, cd uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test_md5.c:318:26: */
 66527  	bp := tls.Alloc(206)
 66528  	defer tls.Free(206)
 66529  
 66530  	// var ctx MD5Context at bp+48, 92
 66531  
 66532  	// var digest [16]uint8 at bp+140, 16
 66533  
 66534  	// var zBuf [50]int8 at bp+156, 50
 66535  
 66536  	var converter uintptr
 66537  
 66538  	if argc != 2 {
 66539  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 66540  			ts+15773 /* " TEXT\"" */, uintptr(0)))
 66541  		return TCL_ERROR
 66542  	}
 66543  	MD5Init(tls, bp+48 /* &ctx */)
 66544  	MD5Update(tls, bp+48 /* &ctx */, *(*uintptr)(unsafe.Pointer(argv + 1*8)), uint32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))))
 66545  	MD5Final(tls, bp+140 /* &digest[0] */, bp+48 /* &ctx */)
 66546  	converter = cd
 66547  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&converter)))(tls, bp+140 /* &digest[0] */, bp+156 /* &zBuf[0] */)
 66548  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+156 /* &zBuf[0] */, uintptr(0)))
 66549  	return TCL_OK
 66550  }
 66551  
 66552  // A TCL command to take the md5 hash of a file.  The argument is the
 66553  // name of the file.
 66554  func md5file_cmd(tls *libc.TLS, cd uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test_md5.c:347:26: */
 66555  	bp := tls.Alloc(10428)
 66556  	defer tls.Free(10428)
 66557  
 66558  	var in uintptr
 66559  	var ofst int32
 66560  	var amt int32
 66561  	// var ctx MD5Context at bp+80, 92
 66562  
 66563  	var converter uintptr
 66564  	// var digest [16]uint8 at bp+10412, 16
 66565  
 66566  	// var zBuf [10240]int8 at bp+172, 10240
 66567  
 66568  	if (argc != 2) && (argc != 4) {
 66569  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 66570  			ts+34704 /* " FILENAME [OFFSE..." */, uintptr(0)))
 66571  		return TCL_ERROR
 66572  	}
 66573  	if argc == 4 {
 66574  		ofst = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))
 66575  		amt = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 3*8)))
 66576  	} else {
 66577  		ofst = 0
 66578  		amt = 2147483647
 66579  	}
 66580  	in = libc.Xfopen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+4263 /* "rb" */)
 66581  	if in == uintptr(0) {
 66582  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+34728 /* "unable to open f..." */, *(*uintptr)(unsafe.Pointer(argv + 1*8)),
 66583  			ts+34750 /* "\" for reading" */, uintptr(0)))
 66584  		return TCL_ERROR
 66585  	}
 66586  	libc.Xfseek(tls, in, int64(ofst), SEEK_SET)
 66587  	MD5Init(tls, bp+80 /* &ctx */)
 66588  	for amt > 0 {
 66589  		var n int32
 66590  		n = int32(libc.Xfread(tls, bp+172 /* &zBuf[0] */, uint64(1), func() uint64 {
 66591  			if uint64(unsafe.Sizeof([10240]int8{})) <= uint64(amt) {
 66592  				return uint64(unsafe.Sizeof([10240]int8{}))
 66593  			}
 66594  			return uint64(amt)
 66595  		}(), in))
 66596  		if n <= 0 {
 66597  			break
 66598  		}
 66599  		MD5Update(tls, bp+80 /* &ctx */, bp+172 /* zBuf */, uint32(n))
 66600  		amt = amt - (n)
 66601  	}
 66602  	libc.Xfclose(tls, in)
 66603  	MD5Final(tls, bp+10412 /* &digest[0] */, bp+80 /* &ctx */)
 66604  	converter = cd
 66605  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&converter)))(tls, bp+10412 /* &digest[0] */, bp+172 /* &zBuf[0] */)
 66606  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+172 /* &zBuf[0] */, uintptr(0)))
 66607  	return TCL_OK
 66608  }
 66609  
 66610  // Register the four new TCL commands for generating MD5 checksums
 66611  // with the TCL interpreter.
 66612  func Md5_Init(tls *libc.TLS, interp uintptr) int32 { /* test_md5.c:400:5: */
 66613  	tcl.XTcl_CreateCommand(tls, interp, ts+34764 /* "md5" */, *(*uintptr)(unsafe.Pointer(&struct {
 66614  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 66615  	}{md5_cmd})),
 66616  		*(*uintptr)(unsafe.Pointer(&struct {
 66617  			f func(*libc.TLS, uintptr, uintptr)
 66618  		}{MD5DigestToBase16})), uintptr(0))
 66619  	tcl.XTcl_CreateCommand(tls, interp, ts+34768 /* "md5-10x8" */, *(*uintptr)(unsafe.Pointer(&struct {
 66620  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 66621  	}{md5_cmd})),
 66622  		*(*uintptr)(unsafe.Pointer(&struct {
 66623  			f func(*libc.TLS, uintptr, uintptr)
 66624  		}{MD5DigestToBase10x8})), uintptr(0))
 66625  	tcl.XTcl_CreateCommand(tls, interp, ts+34777 /* "md5file" */, *(*uintptr)(unsafe.Pointer(&struct {
 66626  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 66627  	}{md5file_cmd})),
 66628  		*(*uintptr)(unsafe.Pointer(&struct {
 66629  			f func(*libc.TLS, uintptr, uintptr)
 66630  		}{MD5DigestToBase16})), uintptr(0))
 66631  	tcl.XTcl_CreateCommand(tls, interp, ts+34785 /* "md5file-10x8" */, *(*uintptr)(unsafe.Pointer(&struct {
 66632  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 66633  	}{md5file_cmd})),
 66634  		*(*uintptr)(unsafe.Pointer(&struct {
 66635  			f func(*libc.TLS, uintptr, uintptr)
 66636  		}{MD5DigestToBase10x8})), uintptr(0))
 66637  	return TCL_OK
 66638  }
 66639  
 66640  // During testing, the special md5sum() aggregate function is available.
 66641  // inside SQLite.  The following routines implement that function.
 66642  func md5step(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_md5.c:416:13: */
 66643  	var p uintptr
 66644  	var i int32
 66645  	if argc < 1 {
 66646  		return
 66647  	}
 66648  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(MD5Context{})))
 66649  	if p == uintptr(0) {
 66650  		return
 66651  	}
 66652  	if !((*MD5Context)(unsafe.Pointer(p)).FisInit != 0) {
 66653  		MD5Init(tls, p)
 66654  	}
 66655  	for i = 0; i < argc; i++ {
 66656  		var zData uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 66657  		if zData != 0 {
 66658  			MD5Update(tls, p, zData, uint32(int32(libc.Xstrlen(tls, zData))))
 66659  		}
 66660  	}
 66661  }
 66662  
 66663  func md5finalize(tls *libc.TLS, context uintptr) { /* test_md5.c:432:13: */
 66664  	bp := tls.Alloc(49)
 66665  	defer tls.Free(49)
 66666  
 66667  	var p uintptr
 66668  	// var digest [16]uint8 at bp, 16
 66669  
 66670  	// var zBuf [33]int8 at bp+16, 33
 66671  
 66672  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(MD5Context{})))
 66673  	MD5Final(tls, bp /* &digest[0] */, p)
 66674  	MD5DigestToBase16(tls, bp /* &digest[0] */, bp+16 /* &zBuf[0] */)
 66675  	sqlite3.Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1))
 66676  }
 66677  
 66678  func Md5_Register(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pThunk uintptr) int32 { /* test_md5.c:441:5: */
 66679  	var rc int32 = sqlite3.Xsqlite3_create_function(tls, db, ts+34798 /* "md5sum" */, -1, SQLITE_UTF8, uintptr(0), uintptr(0),
 66680  		*(*uintptr)(unsafe.Pointer(&struct {
 66681  			f func(*libc.TLS, uintptr, int32, uintptr)
 66682  		}{md5step})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{md5finalize})))
 66683  	sqlite3.Xsqlite3_overload_function(tls, db, ts+34798 /* "md5sum" */, -1) // To exercise this API
 66684  	return rc
 66685  }
 66686  
 66687  // The following macros redefine the API routines so that they are
 66688  // redirected through the global sqlite3_api structure.
 66689  //
 66690  // This header file is also used by the loadext.c source file
 66691  // (part of the main SQLite library - not an extension) so that
 66692  // it can get access to the sqlite3_api_routines structure
 66693  // definition.  But the main library does not want to redefine
 66694  // the API.  So the redefinition macros are only valid if the
 66695  // SQLITE_CORE macros is undefined.
 66696  
 66697  // This case when the file is being statically linked into the
 66698  // application
 66699  
 66700  // These should be defined to be the same as the values in
 66701  // sqliteInt.h.  They are defined separately here so that
 66702  // the multiplex VFS shim can be built as a loadable
 66703  // module.
 66704  
 66705  // Maximum chunk number
 66706  
 66707  // First chunk for rollback journal files
 66708  
 66709  //*********************** Shim Definitions *****************************
 66710  
 66711  // This is the limit on the chunk size.  It may be changed by calling
 66712  // the xFileControl() interface.  It will be rounded up to a
 66713  // multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
 66714  
 66715  // This used to be the default limit on number of chunks, but
 66716  // it is no longer enforced. There is currently no limit to the
 66717  // number of chunks.
 66718  //
 66719  // May be changed by calling the xFileControl() interface.
 66720  
 66721  //*********************** Object Definitions *****************************
 66722  
 66723  // Forward declaration of all object types
 66724  type multiplexGroup1 = struct {
 66725  	FaReal     uintptr
 66726  	FnReal     int32
 66727  	_          [4]byte
 66728  	FzName     uintptr
 66729  	FnName     int32
 66730  	Fflags     int32
 66731  	FszChunk   uint32
 66732  	FbEnabled  uint8
 66733  	FbTruncate uint8
 66734  	_          [2]byte
 66735  } /* test_multiplex.c:106:9 */
 66736  
 66737  // The following macros redefine the API routines so that they are
 66738  // redirected through the global sqlite3_api structure.
 66739  //
 66740  // This header file is also used by the loadext.c source file
 66741  // (part of the main SQLite library - not an extension) so that
 66742  // it can get access to the sqlite3_api_routines structure
 66743  // definition.  But the main library does not want to redefine
 66744  // the API.  So the redefinition macros are only valid if the
 66745  // SQLITE_CORE macros is undefined.
 66746  
 66747  // This case when the file is being statically linked into the
 66748  // application
 66749  
 66750  // These should be defined to be the same as the values in
 66751  // sqliteInt.h.  They are defined separately here so that
 66752  // the multiplex VFS shim can be built as a loadable
 66753  // module.
 66754  
 66755  // Maximum chunk number
 66756  
 66757  // First chunk for rollback journal files
 66758  
 66759  //*********************** Shim Definitions *****************************
 66760  
 66761  // This is the limit on the chunk size.  It may be changed by calling
 66762  // the xFileControl() interface.  It will be rounded up to a
 66763  // multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
 66764  
 66765  // This used to be the default limit on number of chunks, but
 66766  // it is no longer enforced. There is currently no limit to the
 66767  // number of chunks.
 66768  //
 66769  // May be changed by calling the xFileControl() interface.
 66770  
 66771  //*********************** Object Definitions *****************************
 66772  
 66773  // Forward declaration of all object types
 66774  type multiplexGroup = multiplexGroup1 /* test_multiplex.c:106:31 */
 66775  type multiplexConn1 = struct {
 66776  	Fbase   sqlite3_file
 66777  	FpGroup uintptr
 66778  } /* test_multiplex.c:107:9 */
 66779  
 66780  type multiplexConn = multiplexConn1 /* test_multiplex.c:107:30 */
 66781  
 66782  // A "multiplex group" is a collection of files that collectively
 66783  // makeup a single SQLite DB file.  This allows the size of the DB
 66784  // to exceed the limits imposed by the file system.
 66785  //
 66786  // There is an instance of the following object for each defined multiplex
 66787  // group.
 66788  type multiplexReal = struct {
 66789  	Fp uintptr
 66790  	Fz uintptr
 66791  } /* test_multiplex.c:106:9 */
 66792  
 66793  //************************ Global Variables *********************************
 66794  // All global variables used by this file are containing within the following
 66795  // gMultiplex structure.
 66796  var gMultiplex struct {
 66797  	FpOrigVfs      uintptr
 66798  	FsThisVfs      sqlite3_vfs
 66799  	FsIoMethodsV1  sqlite3_io_methods
 66800  	FsIoMethodsV2  sqlite3_io_methods
 66801  	FisInitialized int32
 66802  	_              [4]byte
 66803  } /* test_multiplex.c:176:3: */
 66804  
 66805  //************************ Utility Routines ********************************
 66806  // Compute a string length that is limited to what can be stored in
 66807  // lower 30 bits of a 32-bit signed integer.
 66808  //
 66809  // The value returned will never be negative.  Nor will it ever be greater
 66810  // than the actual length of the string.  For very long strings (greater
 66811  // than 1GiB) the value returned might be less than the true string length.
 66812  func multiplexStrlen30(tls *libc.TLS, z uintptr) int32 { /* test_multiplex.c:187:12: */
 66813  	var z2 uintptr = z
 66814  	if z == uintptr(0) {
 66815  		return 0
 66816  	}
 66817  	for *(*int8)(unsafe.Pointer(z2)) != 0 {
 66818  		z2++
 66819  	}
 66820  	return (0x3fffffff & (int32((int64(z2) - int64(z)) / 1)))
 66821  }
 66822  
 66823  // Generate the file-name for chunk iChunk of the group with base name
 66824  // zBase. The file-name is written to buffer zOut before returning. Buffer
 66825  // zOut must be allocated by the caller so that it is at least (nBase+5)
 66826  // bytes in size, where nBase is the length of zBase, not including the
 66827  // nul-terminator.
 66828  //
 66829  // If iChunk is 0 (or 400 - the number for the first journal file chunk),
 66830  // the output is a copy of the input string. Otherwise, if
 66831  // SQLITE_ENABLE_8_3_NAMES is not defined or the input buffer does not contain
 66832  // a "." character, then the output is a copy of the input string with the
 66833  // three-digit zero-padded decimal representation if iChunk appended to it.
 66834  // For example:
 66835  //
 66836  //   zBase="test.db", iChunk=4  ->  zOut="test.db004"
 66837  //
 66838  // Or, if SQLITE_ENABLE_8_3_NAMES is defined and the input buffer contains
 66839  // a "." character, then everything after the "." is replaced by the
 66840  // three-digit representation of iChunk.
 66841  //
 66842  //   zBase="test.db", iChunk=4  ->  zOut="test.004"
 66843  //
 66844  // The output buffer string is terminated by 2 0x00 bytes. This makes it safe
 66845  // to pass to sqlite3_uri_parameter() and similar.
 66846  func multiplexFilename(tls *libc.TLS, zBase uintptr, nBase int32, flags int32, iChunk int32, zOut uintptr) { /* test_multiplex.c:219:13: */
 66847  	bp := tls.Alloc(8)
 66848  	defer tls.Free(8)
 66849  
 66850  	var n int32 = nBase
 66851  	libc.Xmemcpy(tls, zOut, zBase, (uint64(n + 1)))
 66852  	if (iChunk != 0) && (iChunk <= MX_CHUNK_NUMBER) {
 66853  		sqlite3.Xsqlite3_snprintf(tls, 4, (zOut + uintptr(n)), ts+34805 /* "%03d" */, libc.VaList(bp, iChunk))
 66854  		n = n + (3)
 66855  	}
 66856  
 66857  	*(*int8)(unsafe.Pointer(zOut + uintptr((n + 1)))) = int8(0)
 66858  }
 66859  
 66860  // Compute the filename for the iChunk-th chunk
 66861  func multiplexSubFilename(tls *libc.TLS, pGroup uintptr, iChunk int32) int32 { /* test_multiplex.c:256:12: */
 66862  	if iChunk >= (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal {
 66863  		var p uintptr
 66864  		p = sqlite3.Xsqlite3_realloc64(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal, (uint64((uint64(iChunk + 1)) * uint64(unsafe.Sizeof(multiplexReal{})))))
 66865  		if p == uintptr(0) {
 66866  			return SQLITE_NOMEM
 66867  		}
 66868  		libc.Xmemset(tls, (p + uintptr((*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal)*16), 0, (uint64(unsafe.Sizeof(multiplexReal{})) * (uint64((iChunk + 1) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal))))
 66869  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal = p
 66870  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal = (iChunk + 1)
 66871  	}
 66872  	if ((*multiplexGroup)(unsafe.Pointer(pGroup)).FzName != 0) && ((*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz == uintptr(0)) {
 66873  		var z uintptr
 66874  		var n int32 = (*multiplexGroup)(unsafe.Pointer(pGroup)).FnName
 66875  		z = sqlite3.Xsqlite3_malloc64(tls, (uint64(n + 5)))
 66876  		if z == uintptr(0) {
 66877  			return SQLITE_NOMEM
 66878  		}
 66879  		multiplexFilename(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FzName, (*multiplexGroup)(unsafe.Pointer(pGroup)).FnName, (*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags, iChunk, z)
 66880  		(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*16)).Fz = sqlite3.Xsqlite3_create_filename(tls, z, ts+489 /* "" */, ts+489 /* "" */, 0, uintptr(0))
 66881  		sqlite3.Xsqlite3_free(tls, z)
 66882  		if (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz == uintptr(0) {
 66883  			return SQLITE_NOMEM
 66884  		}
 66885  	}
 66886  	return SQLITE_OK
 66887  }
 66888  
 66889  // Translate an sqlite3_file* that is really a multiplexGroup* into
 66890  // the sqlite3_file* for the underlying original VFS.
 66891  //
 66892  // For chunk 0, the pGroup->flags determines whether or not a new file
 66893  // is created if it does not already exist.  For chunks 1 and higher, the
 66894  // file is created only if createFlag is 1.
 66895  func multiplexSubOpen(tls *libc.TLS, pGroup uintptr, iChunk int32, rc uintptr, pOutFlags uintptr, createFlag int32) uintptr { /* test_multiplex.c:289:21: */
 66896  	bp := tls.Alloc(20)
 66897  	defer tls.Free(20)
 66898  
 66899  	var pSubOpen uintptr = uintptr(0)
 66900  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 66901  
 66902  	*(*int32)(unsafe.Pointer(rc)) = multiplexSubFilename(tls, pGroup, iChunk)
 66903  	if ((*(*int32)(unsafe.Pointer(rc))) == SQLITE_OK) && ((libc.AssignUintptr(&pSubOpen, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fp)) == uintptr(0)) {
 66904  		var flags int32
 66905  		// var bExists int32 at bp+16, 4
 66906  
 66907  		flags = (*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags
 66908  		if createFlag != 0 {
 66909  			flags = flags | (SQLITE_OPEN_CREATE)
 66910  		} else if iChunk == 0 {
 66911  			// Fall through
 66912  		} else if (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz == uintptr(0) {
 66913  			return uintptr(0)
 66914  		} else {
 66915  			*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 56 /* &.xAccess */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz,
 66916  				SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 66917  			if (*(*int32)(unsafe.Pointer(rc)) != 0) || !(*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0) {
 66918  				if *(*int32)(unsafe.Pointer(rc)) != 0 {
 66919  					sqlite3.Xsqlite3_log(tls, *(*int32)(unsafe.Pointer(rc)), ts+34810, /* "multiplexor.xAcc..." */
 66920  						libc.VaList(bp, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz))
 66921  				}
 66922  				return uintptr(0)
 66923  			}
 66924  			flags = flags & (libc.CplInt32(SQLITE_OPEN_CREATE))
 66925  		}
 66926  		pSubOpen = sqlite3.Xsqlite3_malloc64(tls, uint64((*sqlite3_vfs)(unsafe.Pointer(pOrigVfs)).FszOsFile))
 66927  		if pSubOpen == uintptr(0) {
 66928  			*(*int32)(unsafe.Pointer(rc)) = (SQLITE_IOERR | (int32(12) << 8))
 66929  			return uintptr(0)
 66930  		}
 66931  		(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*16)).Fp = pSubOpen
 66932  		*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 40 /* &.xOpen */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz, pSubOpen,
 66933  			flags, pOutFlags)
 66934  		if (*(*int32)(unsafe.Pointer(rc))) != SQLITE_OK {
 66935  			sqlite3.Xsqlite3_log(tls, *(*int32)(unsafe.Pointer(rc)), ts+34844, /* "multiplexor.xOpe..." */
 66936  				libc.VaList(bp+8, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz))
 66937  			sqlite3.Xsqlite3_free(tls, pSubOpen)
 66938  			(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*16)).Fp = uintptr(0)
 66939  			return uintptr(0)
 66940  		}
 66941  	}
 66942  	return pSubOpen
 66943  }
 66944  
 66945  // Return the size, in bytes, of chunk number iChunk.  If that chunk
 66946  // does not exist, then return 0.  This function does not distingish between
 66947  // non-existant files and zero-length files.
 66948  func multiplexSubSize(tls *libc.TLS, pGroup uintptr, iChunk int32, rc uintptr) sqlite3_int64 { /* test_multiplex.c:357:22: */
 66949  	bp := tls.Alloc(8)
 66950  	defer tls.Free(8)
 66951  
 66952  	var pSub uintptr
 66953  	*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = int64(0)
 66954  
 66955  	if *(*int32)(unsafe.Pointer(rc)) != 0 {
 66956  		return int64(0)
 66957  	}
 66958  	pSub = multiplexSubOpen(tls, pGroup, iChunk, rc, uintptr(0), 0)
 66959  	if pSub == uintptr(0) {
 66960  		return int64(0)
 66961  	}
 66962  	*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSub)).FpMethods + 48 /* &.xFileSize */))))(tls, pSub, bp /* &sz */)
 66963  	return *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 66964  }
 66965  
 66966  // This is the implementation of the multiplex_control() SQL function.
 66967  func multiplexControlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_multiplex.c:375:13: */
 66968  	bp := tls.Alloc(4)
 66969  	defer tls.Free(4)
 66970  
 66971  	var rc int32 = SQLITE_OK
 66972  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 66973  	var op int32 = 0
 66974  	// var iVal int32 at bp, 4
 66975  
 66976  	if !(db != 0) || (argc != 2) {
 66977  		rc = SQLITE_ERROR
 66978  	} else {
 66979  		// extract params
 66980  		op = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 66981  		*(*int32)(unsafe.Pointer(bp /* iVal */)) = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 66982  		// map function op to file_control op
 66983  		switch op {
 66984  		case 1:
 66985  			op = MULTIPLEX_CTRL_ENABLE
 66986  			break
 66987  			fallthrough
 66988  		case 2:
 66989  			op = MULTIPLEX_CTRL_SET_CHUNK_SIZE
 66990  			break
 66991  			fallthrough
 66992  		case 3:
 66993  			op = MULTIPLEX_CTRL_SET_MAX_CHUNKS
 66994  			break
 66995  			fallthrough
 66996  		default:
 66997  			rc = SQLITE_NOTFOUND
 66998  			break
 66999  		}
 67000  	}
 67001  	if rc == SQLITE_OK {
 67002  		rc = sqlite3.Xsqlite3_file_control(tls, db, uintptr(0), op, bp /* &iVal */)
 67003  	}
 67004  	sqlite3.Xsqlite3_result_error_code(tls, context, rc)
 67005  }
 67006  
 67007  // This is the entry point to register the auto-extension for the
 67008  // multiplex_control() function.
 67009  func multiplexFuncInit(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* test_multiplex.c:417:12: */
 67010  	var rc int32
 67011  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+34876 /* "multiplex_contro..." */, 2, SQLITE_ANY,
 67012  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 67013  			f func(*libc.TLS, uintptr, int32, uintptr)
 67014  		}{multiplexControlFunc})), uintptr(0), uintptr(0))
 67015  	return rc
 67016  }
 67017  
 67018  // Close a single sub-file in the connection group.
 67019  func multiplexSubClose(tls *libc.TLS, pGroup uintptr, iChunk int32, pOrigVfs uintptr) { /* test_multiplex.c:431:13: */
 67020  	var pSubOpen uintptr = (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*16)).Fp
 67021  	if pSubOpen != 0 {
 67022  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xClose */))))(tls, pSubOpen)
 67023  		if (pOrigVfs != 0) && ((*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz != 0) {
 67024  			(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz, 0)
 67025  		}
 67026  		sqlite3.Xsqlite3_free(tls, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fp)
 67027  	}
 67028  	sqlite3.Xsqlite3_free_filename(tls, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz)
 67029  	libc.Xmemset(tls, ((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*16), 0, uint64(unsafe.Sizeof(multiplexReal{})))
 67030  }
 67031  
 67032  // Deallocate memory held by a multiplexGroup
 67033  func multiplexFreeComponents(tls *libc.TLS, pGroup uintptr) { /* test_multiplex.c:451:13: */
 67034  	var i int32
 67035  	for i = 0; i < (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal; i++ {
 67036  		multiplexSubClose(tls, pGroup, i, uintptr(0))
 67037  	}
 67038  	sqlite3.Xsqlite3_free(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal)
 67039  	(*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal = uintptr(0)
 67040  	(*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal = 0
 67041  }
 67042  
 67043  //************************ VFS Method Wrappers ****************************
 67044  
 67045  // This is the xOpen method used for the "multiplex" VFS.
 67046  //
 67047  // Most of the work is done by the underlying original VFS.  This method
 67048  // simply links the new file into the appropriate multiplex group if it is a
 67049  // file that needs to be tracked.
 67050  func multiplexOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pConn uintptr, flags int32, pOutFlags uintptr) int32 { /* test_multiplex.c:469:12: */
 67051  	bp := tls.Alloc(20)
 67052  	defer tls.Free(20)
 67053  
 67054  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Result code
 67055  	var pMultiplexOpen uintptr                         // The new multiplex file descriptor
 67056  	var pGroup uintptr = uintptr(0)                    // Corresponding multiplexGroup object
 67057  	var pSubOpen uintptr = uintptr(0)                  // Real file descriptor
 67058  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs        // Real VFS
 67059  	var nName int32 = 0
 67060  	var sz int32 = 0
 67061  	var zToFree uintptr = uintptr(0)
 67062  
 67063  	_ = pVfs
 67064  	libc.Xmemset(tls, pConn, 0, uint64((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile))
 67065  
 67066  	// We need to create a group structure and manage
 67067  	// access to this group of files.
 67068  	pMultiplexOpen = pConn
 67069  
 67070  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67071  		// allocate space for group
 67072  		if zName != 0 {
 67073  			nName = multiplexStrlen30(tls, zName)
 67074  		} else {
 67075  			nName = 0
 67076  		}
 67077  		sz = (int32((uint64(unsafe.Sizeof(multiplexGroup{})) + // multiplexGroup
 67078  			uint64(nName)) + uint64(1))) // zName
 67079  		pGroup = sqlite3.Xsqlite3_malloc64(tls, uint64(sz))
 67080  		if pGroup == uintptr(0) {
 67081  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM
 67082  		}
 67083  	}
 67084  
 67085  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67086  		var zUri uintptr
 67087  		if (flags & SQLITE_OPEN_URI) != 0 {
 67088  			zUri = zName
 67089  		} else {
 67090  			zUri = uintptr(0)
 67091  		}
 67092  		// assign pointers to extra space allocated
 67093  		libc.Xmemset(tls, pGroup, 0, uint64(sz))
 67094  		(*multiplexConn)(unsafe.Pointer(pMultiplexOpen)).FpGroup = pGroup
 67095  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = libc.Uint8(libc.Uint8FromInt32(-1))
 67096  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(sqlite3.Xsqlite3_uri_boolean(tls, zUri, ts+18743, /* "truncate" */
 67097  			(libc.Bool32((flags & SQLITE_OPEN_MAIN_DB) == 0))))
 67098  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = uint32(int32(sqlite3.Xsqlite3_uri_int64(tls, zUri, ts+34894, /* "chunksize" */
 67099  			int64(SQLITE_MULTIPLEX_CHUNK_SIZE))))
 67100  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = (((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk + uint32(0xffff)) & libc.Uint32FromInt32(libc.CplInt32(0xffff)))
 67101  		if zName != 0 {
 67102  			var p uintptr = (pGroup + 1*40)
 67103  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FzName = p
 67104  			libc.Xmemcpy(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FzName, zName, (uint64(nName + 1)))
 67105  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FnName = nName
 67106  		}
 67107  		if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled != 0 {
 67108  			for (uint32(sqlite3.Xsqlite3PendingByte) % (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk) >= ((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk - uint32(65536)) {
 67109  				*(*uint32)(unsafe.Pointer(pGroup + 32 /* &.szChunk */)) += (uint32(65536))
 67110  			}
 67111  		}
 67112  		(*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags = (flags & libc.CplInt32(SQLITE_OPEN_URI))
 67113  		*(*int32)(unsafe.Pointer(bp /* rc */)) = multiplexSubFilename(tls, pGroup, 1)
 67114  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67115  			pSubOpen = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, pOutFlags, 0)
 67116  			if (pSubOpen == uintptr(0)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) {
 67117  				*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_CANTOPEN
 67118  			}
 67119  		}
 67120  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67121  			// var sz64 sqlite3_int64 at bp+8, 8
 67122  
 67123  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 48 /* &.xFileSize */))))(tls, pSubOpen, bp+8 /* &sz64 */)
 67124  			if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (zName != 0) {
 67125  				// var bExists int32 at bp+16, 4
 67126  
 67127  				if (flags & SQLITE_OPEN_SUPER_JOURNAL) != 0 {
 67128  					(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(0)
 67129  				} else if *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) == int64(0) {
 67130  					if (flags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 67131  						// If opening a main journal file and the first chunk is zero
 67132  						// bytes in size, delete any subsequent chunks from the
 67133  						// file-system.
 67134  						var iChunk int32 = 1
 67135  						for ok := true; ok; ok = ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0)) {
 67136  							*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 56 /* &.xAccess */))))(tls, pOrigVfs,
 67137  								(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz, SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 67138  							if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0) {
 67139  								*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*16)).Fz, 0)
 67140  								if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67141  									*(*int32)(unsafe.Pointer(bp /* rc */)) = multiplexSubFilename(tls, pGroup, libc.PreIncInt32(&iChunk, 1))
 67142  								}
 67143  							}
 67144  						}
 67145  					}
 67146  				} else {
 67147  					// If the first overflow file exists and if the size of the main file
 67148  					// is different from the chunk size, that means the chunk size is set
 67149  					// set incorrectly.  So fix it.
 67150  					//
 67151  					// Or, if the first overflow file does not exist and the main file is
 67152  					// larger than the chunk size, that means the chunk size is too small.
 67153  					// But we have no way of determining the intended chunk size, so
 67154  					// just disable the multiplexor all togethre.
 67155  					*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 56 /* &.xAccess */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+1*16)).Fz,
 67156  						SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 67157  					*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) = (libc.Bool32(multiplexSubSize(tls, pGroup, 1, bp /* &rc */) > int64(0)))
 67158  					if ((((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0)) && (*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) == (*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) & int64(0xffff0000)))) && (*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) > int64(0))) &&
 67159  						(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) != sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)) {
 67160  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = uint32(int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */))))
 67161  					} else if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && !(*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0)) && (*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) > sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)) {
 67162  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(0)
 67163  					}
 67164  				}
 67165  			}
 67166  		}
 67167  
 67168  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67169  			if (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FiVersion == 1 {
 67170  				(*sqlite3_file)(unsafe.Pointer(pConn)).FpMethods = (uintptr(unsafe.Pointer(&gMultiplex)) + 176 /* &.sIoMethodsV1 */)
 67171  			} else {
 67172  				(*sqlite3_file)(unsafe.Pointer(pConn)).FpMethods = (uintptr(unsafe.Pointer(&gMultiplex)) + 328 /* &.sIoMethodsV2 */)
 67173  			}
 67174  		} else {
 67175  			multiplexFreeComponents(tls, pGroup)
 67176  			sqlite3.Xsqlite3_free(tls, pGroup)
 67177  		}
 67178  	}
 67179  	sqlite3.Xsqlite3_free(tls, zToFree)
 67180  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 67181  }
 67182  
 67183  // This is the xDelete method used for the "multiplex" VFS.
 67184  // It attempts to delete the filename specified.
 67185  func multiplexDelete(tls *libc.TLS, pVfs uintptr, zName uintptr, syncDir int32) int32 { /* test_multiplex.c:611:12: */
 67186  	bp := tls.Alloc(4)
 67187  	defer tls.Free(4)
 67188  
 67189  	var rc int32
 67190  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 67191  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, zName, syncDir)
 67192  	if rc == SQLITE_OK {
 67193  		// If the main chunk was deleted successfully, also delete any subsequent
 67194  		// chunks - starting with the last (highest numbered).
 67195  		var nName int32 = int32(libc.Xstrlen(tls, zName))
 67196  		var z uintptr
 67197  		z = sqlite3.Xsqlite3_malloc64(tls, (uint64(nName + 5)))
 67198  		if z == uintptr(0) {
 67199  			rc = (SQLITE_IOERR | (int32(12) << 8))
 67200  		} else {
 67201  			var iChunk int32 = 0
 67202  			// var bExists int32 at bp, 4
 67203  
 67204  			for ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bExists */)) != 0)) {
 67205  				multiplexFilename(tls, zName, nName, SQLITE_OPEN_MAIN_JOURNAL, libc.PreIncInt32(&iChunk, 1), z)
 67206  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 56 /* &.xAccess */))))(tls, pOrigVfs, z, SQLITE_ACCESS_EXISTS, bp /* &bExists */)
 67207  			}
 67208  			for (rc == SQLITE_OK) && (iChunk > 1) {
 67209  				multiplexFilename(tls, zName, nName, SQLITE_OPEN_MAIN_JOURNAL, libc.PreDecInt32(&iChunk, 1), z)
 67210  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, z, syncDir)
 67211  			}
 67212  			if rc == SQLITE_OK {
 67213  				iChunk = 0
 67214  				for ok1 := true; ok1; ok1 = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bExists */)) != 0)) {
 67215  					multiplexFilename(tls, zName, nName, SQLITE_OPEN_WAL, libc.PreIncInt32(&iChunk, 1), z)
 67216  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 56 /* &.xAccess */))))(tls, pOrigVfs, z, SQLITE_ACCESS_EXISTS, bp /* &bExists */)
 67217  				}
 67218  				for (rc == SQLITE_OK) && (iChunk > 1) {
 67219  					multiplexFilename(tls, zName, nName, SQLITE_OPEN_WAL, libc.PreDecInt32(&iChunk, 1), z)
 67220  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, z, syncDir)
 67221  				}
 67222  			}
 67223  		}
 67224  		sqlite3.Xsqlite3_free(tls, z)
 67225  	}
 67226  	return rc
 67227  }
 67228  
 67229  func multiplexAccess(tls *libc.TLS, a uintptr, b uintptr, c int32, d uintptr) int32 { /* test_multiplex.c:656:12: */
 67230  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 56 /* &.xAccess */))))(tls, gMultiplex.FpOrigVfs, b, c, d)
 67231  }
 67232  
 67233  func multiplexFullPathname(tls *libc.TLS, a uintptr, b uintptr, c int32, d uintptr) int32 { /* test_multiplex.c:659:12: */
 67234  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 64 /* &.xFullPathname */))))(tls, gMultiplex.FpOrigVfs, b, c, d)
 67235  }
 67236  
 67237  func multiplexDlOpen(tls *libc.TLS, a uintptr, b uintptr) uintptr { /* test_multiplex.c:662:13: */
 67238  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((gMultiplex.FpOrigVfs + 72 /* &.xDlOpen */))))(tls, gMultiplex.FpOrigVfs, b)
 67239  }
 67240  
 67241  func multiplexDlError(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_multiplex.c:665:13: */
 67242  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((gMultiplex.FpOrigVfs + 80 /* &.xDlError */))))(tls, gMultiplex.FpOrigVfs, b, c)
 67243  }
 67244  
 67245  func multiplexDlSym(tls *libc.TLS, a uintptr, b uintptr, c uintptr) uintptr { /* test_multiplex.c:668:13: */
 67246  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((gMultiplex.FpOrigVfs + 88 /* &.xDlSym */))))(tls, gMultiplex.FpOrigVfs, b, c)
 67247  }
 67248  
 67249  func multiplexDlClose(tls *libc.TLS, a uintptr, b uintptr) { /* test_multiplex.c:671:13: */
 67250  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((gMultiplex.FpOrigVfs + 96 /* &.xDlClose */))))(tls, gMultiplex.FpOrigVfs, b)
 67251  }
 67252  
 67253  func multiplexRandomness(tls *libc.TLS, a uintptr, b int32, c uintptr) int32 { /* test_multiplex.c:674:12: */
 67254  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 104 /* &.xRandomness */))))(tls, gMultiplex.FpOrigVfs, b, c)
 67255  }
 67256  
 67257  func multiplexSleep(tls *libc.TLS, a uintptr, b int32) int32 { /* test_multiplex.c:677:12: */
 67258  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 112 /* &.xSleep */))))(tls, gMultiplex.FpOrigVfs, b)
 67259  }
 67260  
 67261  func multiplexCurrentTime(tls *libc.TLS, a uintptr, b uintptr) int32 { /* test_multiplex.c:680:12: */
 67262  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 120 /* &.xCurrentTime */))))(tls, gMultiplex.FpOrigVfs, b)
 67263  }
 67264  
 67265  func multiplexGetLastError(tls *libc.TLS, a uintptr, b int32, c uintptr) int32 { /* test_multiplex.c:683:12: */
 67266  	if (*sqlite3_vfs)(unsafe.Pointer(gMultiplex.FpOrigVfs)).FxGetLastError != 0 {
 67267  		return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 128 /* &.xGetLastError */))))(tls, gMultiplex.FpOrigVfs, b, c)
 67268  	} else {
 67269  		return 0
 67270  	}
 67271  	return int32(0)
 67272  }
 67273  
 67274  func multiplexCurrentTimeInt64(tls *libc.TLS, a uintptr, b uintptr) int32 { /* test_multiplex.c:690:12: */
 67275  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, gMultiplex.FpOrigVfs, b)
 67276  }
 67277  
 67278  //*********************** I/O Method Wrappers ******************************
 67279  
 67280  // xClose requests get passed through to the original VFS.
 67281  // We loop over all open chunk handles and close them.
 67282  // The group structure for this file is unlinked from
 67283  // our list of groups and freed.
 67284  func multiplexClose(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:701:12: */
 67285  	var p uintptr = pConn
 67286  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67287  	var rc int32 = SQLITE_OK
 67288  	multiplexFreeComponents(tls, pGroup)
 67289  	sqlite3.Xsqlite3_free(tls, pGroup)
 67290  	return rc
 67291  }
 67292  
 67293  // Pass xRead requests thru to the original VFS after
 67294  // determining the correct chunk to operate on.
 67295  // Break up reads across chunk boundaries.
 67296  func multiplexRead(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_multiplex.c:714:12: */
 67297  	bp := tls.Alloc(4)
 67298  	defer tls.Free(4)
 67299  
 67300  	var p uintptr = pConn
 67301  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67302  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 67303  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 67304  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 67305  		if pSubOpen == uintptr(0) {
 67306  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(1) << 8))
 67307  		} else {
 67308  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 67309  		}
 67310  	} else {
 67311  		for iAmt > 0 {
 67312  			var i int32 = (int32(iOfst / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67313  			var pSubOpen uintptr
 67314  			pSubOpen = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 1)
 67315  			if pSubOpen != 0 {
 67316  				var extra int32 = (int32((uint32((int32(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))) + iAmt)) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))
 67317  				if extra < 0 {
 67318  					extra = 0
 67319  				}
 67320  				iAmt = iAmt - (extra)
 67321  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt,
 67322  					(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67323  				if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 67324  					break
 67325  				}
 67326  				pBuf = (pBuf + uintptr(iAmt))
 67327  				iOfst = iOfst + (sqlite3_int64(iAmt))
 67328  				iAmt = extra
 67329  			} else {
 67330  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(1) << 8))
 67331  				break
 67332  			}
 67333  		}
 67334  	}
 67335  
 67336  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 67337  }
 67338  
 67339  // Pass xWrite requests thru to the original VFS after
 67340  // determining the correct chunk to operate on.
 67341  // Break up writes across chunk boundaries.
 67342  func multiplexWrite(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_multiplex.c:759:12: */
 67343  	bp := tls.Alloc(4)
 67344  	defer tls.Free(4)
 67345  
 67346  	var p uintptr = pConn
 67347  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67348  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 67349  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 67350  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 67351  		if pSubOpen == uintptr(0) {
 67352  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(3) << 8))
 67353  		} else {
 67354  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 67355  		}
 67356  	} else {
 67357  		for (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (iAmt > 0) {
 67358  			var i int32 = (int32(iOfst / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67359  			var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 1)
 67360  			if pSubOpen != 0 {
 67361  				var extra int32 = (int32((uint32((int32(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))) + iAmt)) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))
 67362  				if extra < 0 {
 67363  					extra = 0
 67364  				}
 67365  				iAmt = iAmt - (extra)
 67366  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt,
 67367  					(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67368  				pBuf = (pBuf + uintptr(iAmt))
 67369  				iOfst = iOfst + (sqlite3_int64(iAmt))
 67370  				iAmt = extra
 67371  			}
 67372  		}
 67373  	}
 67374  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 67375  }
 67376  
 67377  // Pass xTruncate requests thru to the original VFS after
 67378  // determining the correct chunk to operate on.  Delete any
 67379  // chunks above the truncate mark.
 67380  func multiplexTruncate(tls *libc.TLS, pConn uintptr, size sqlite3_int64) int32 { /* test_multiplex.c:799:12: */
 67381  	bp := tls.Alloc(4)
 67382  	defer tls.Free(4)
 67383  
 67384  	var p uintptr = pConn
 67385  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67386  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 67387  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 67388  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 67389  		if pSubOpen == uintptr(0) {
 67390  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(6) << 8))
 67391  		} else {
 67392  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xTruncate */))))(tls, pSubOpen, size)
 67393  		}
 67394  	} else {
 67395  		var i int32
 67396  		var iBaseGroup int32 = (int32(size / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67397  		var pSubOpen uintptr
 67398  		var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 67399  		// delete the chunks above the truncate limit
 67400  		for i = ((*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal - 1); (i > iBaseGroup) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK); i-- {
 67401  			if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate != 0 {
 67402  				multiplexSubClose(tls, pGroup, i, pOrigVfs)
 67403  			} else {
 67404  				pSubOpen = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 0)
 67405  				if pSubOpen != 0 {
 67406  					*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xTruncate */))))(tls, pSubOpen, int64(0))
 67407  				}
 67408  			}
 67409  		}
 67410  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 67411  			pSubOpen = multiplexSubOpen(tls, pGroup, iBaseGroup, bp /* &rc */, uintptr(0), 0)
 67412  			if pSubOpen != 0 {
 67413  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xTruncate */))))(tls, pSubOpen, (size % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 67414  			}
 67415  		}
 67416  		if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 {
 67417  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(6) << 8))
 67418  		}
 67419  	}
 67420  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 67421  }
 67422  
 67423  // Pass xSync requests through to the original VFS without change
 67424  func multiplexSync(tls *libc.TLS, pConn uintptr, flags int32) int32 { /* test_multiplex.c:839:12: */
 67425  	var p uintptr = pConn
 67426  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67427  	var rc int32 = SQLITE_OK
 67428  	var i int32
 67429  	for i = 0; i < (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal; i++ {
 67430  		var pSubOpen uintptr = (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(i)*16)).Fp
 67431  		if pSubOpen != 0 {
 67432  			var rc2 int32 = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 40 /* &.xSync */))))(tls, pSubOpen, flags)
 67433  			if rc2 != SQLITE_OK {
 67434  				rc = rc2
 67435  			}
 67436  		}
 67437  	}
 67438  	return rc
 67439  }
 67440  
 67441  // Pass xFileSize requests through to the original VFS.
 67442  // Aggregate the size of all the chunks before returning.
 67443  func multiplexFileSize(tls *libc.TLS, pConn uintptr, pSize uintptr) int32 { /* test_multiplex.c:857:12: */
 67444  	bp := tls.Alloc(4)
 67445  	defer tls.Free(4)
 67446  
 67447  	var p uintptr = pConn
 67448  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67449  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 67450  	var i int32
 67451  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 67452  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 67453  		if pSubOpen == uintptr(0) {
 67454  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(7) << 8))
 67455  		} else {
 67456  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 48 /* &.xFileSize */))))(tls, pSubOpen, pSize)
 67457  		}
 67458  	} else {
 67459  		*(*sqlite3_int64)(unsafe.Pointer(pSize)) = int64(0)
 67460  		for i = 0; *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK; i++ {
 67461  			var sz sqlite3_int64 = multiplexSubSize(tls, pGroup, i, bp /* &rc */)
 67462  			if sz == int64(0) {
 67463  				break
 67464  			}
 67465  			*(*sqlite3_int64)(unsafe.Pointer(pSize)) = ((sqlite3_int64(i) * sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)) + sz)
 67466  		}
 67467  	}
 67468  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 67469  }
 67470  
 67471  // Pass xLock requests through to the original VFS unchanged.
 67472  func multiplexLock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_multiplex.c:882:12: */
 67473  	bp := tls.Alloc(4)
 67474  	defer tls.Free(4)
 67475  
 67476  	var p uintptr = pConn
 67477  	// var rc int32 at bp, 4
 67478  
 67479  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67480  	if pSubOpen != 0 {
 67481  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 56 /* &.xLock */))))(tls, pSubOpen, lock)
 67482  	}
 67483  	return SQLITE_BUSY
 67484  }
 67485  
 67486  // Pass xUnlock requests through to the original VFS unchanged.
 67487  func multiplexUnlock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_multiplex.c:894:12: */
 67488  	bp := tls.Alloc(4)
 67489  	defer tls.Free(4)
 67490  
 67491  	var p uintptr = pConn
 67492  	// var rc int32 at bp, 4
 67493  
 67494  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67495  	if pSubOpen != 0 {
 67496  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 64 /* &.xUnlock */))))(tls, pSubOpen, lock)
 67497  	}
 67498  	return (SQLITE_IOERR | (int32(8) << 8))
 67499  }
 67500  
 67501  // Pass xCheckReservedLock requests through to the original VFS unchanged.
 67502  func multiplexCheckReservedLock(tls *libc.TLS, pConn uintptr, pResOut uintptr) int32 { /* test_multiplex.c:906:12: */
 67503  	bp := tls.Alloc(4)
 67504  	defer tls.Free(4)
 67505  
 67506  	var p uintptr = pConn
 67507  	// var rc int32 at bp, 4
 67508  
 67509  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67510  	if pSubOpen != 0 {
 67511  		return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, pSubOpen, pResOut)
 67512  	}
 67513  	return (SQLITE_IOERR | (int32(14) << 8))
 67514  }
 67515  
 67516  // Pass xFileControl requests through to the original VFS unchanged,
 67517  // except for any MULTIPLEX_CTRL_* requests here.
 67518  func multiplexFileControl(tls *libc.TLS, pConn uintptr, op int32, pArg uintptr) int32 { /* test_multiplex.c:919:12: */
 67519  	bp := tls.Alloc(12)
 67520  	defer tls.Free(12)
 67521  
 67522  	var p uintptr = pConn
 67523  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 67524  	*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR
 67525  	var pSubOpen uintptr
 67526  
 67527  	if !(gMultiplex.FisInitialized != 0) {
 67528  		return SQLITE_MISUSE
 67529  	}
 67530  	switch op {
 67531  	case MULTIPLEX_CTRL_ENABLE:
 67532  		if pArg != 0 {
 67533  			var bEnabled int32 = *(*int32)(unsafe.Pointer(pArg))
 67534  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(bEnabled)
 67535  			*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 67536  		}
 67537  		break
 67538  	case MULTIPLEX_CTRL_SET_CHUNK_SIZE:
 67539  		if pArg != 0 {
 67540  			var szChunk uint32 = *(*uint32)(unsafe.Pointer(pArg))
 67541  			if szChunk < uint32(1) {
 67542  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_MISUSE
 67543  			} else {
 67544  				// Round up to nearest multiple of MAX_PAGE_SIZE.
 67545  				szChunk = (szChunk + (uint32(MAX_PAGE_SIZE - 1)))
 67546  				szChunk = szChunk & (libc.Uint32FromInt32(libc.CplInt32((MAX_PAGE_SIZE - 1))))
 67547  				(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = szChunk
 67548  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 67549  			}
 67550  		}
 67551  		break
 67552  	case MULTIPLEX_CTRL_SET_MAX_CHUNKS:
 67553  		*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 67554  		break
 67555  	case SQLITE_FCNTL_SIZE_HINT:
 67556  		fallthrough
 67557  	case SQLITE_FCNTL_CHUNK_SIZE:
 67558  		// no-op these
 67559  		*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 67560  		break
 67561  	case SQLITE_FCNTL_PRAGMA:
 67562  		{
 67563  			var aFcntl uintptr = pArg
 67564  			// EVIDENCE-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA
 67565  			// file control is an array of pointers to strings (char**) in which the
 67566  			// second element of the array is the name of the pragma and the third
 67567  			// element is the argument to the pragma or NULL if the pragma has no
 67568  			// argument.
 67569  			if (*(*uintptr)(unsafe.Pointer(aFcntl + 1*8)) != 0) && (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 1*8)), ts+34904 /* "multiplex_trunca..." */) == 0) {
 67570  				if (*(*uintptr)(unsafe.Pointer(aFcntl + 2*8)) != 0) && (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aFcntl + 2*8)))) != 0) {
 67571  					if (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*8)), ts+4039 /* "on" */) == 0) ||
 67572  						(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*8)), ts+29094 /* "1" */) == 0) {
 67573  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(1)
 67574  					} else if (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*8)), ts+4403 /* "off" */) == 0) ||
 67575  						(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*8)), ts+14654 /* "0" */) == 0) {
 67576  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(0)
 67577  					}
 67578  				}
 67579  				// EVIDENCE-OF: R-27806-26076 The handler for an SQLITE_FCNTL_PRAGMA
 67580  				// file control can optionally make the first element of the char**
 67581  				// argument point to a string obtained from sqlite3_mprintf() or the
 67582  				// equivalent and that string will become the result of the pragma
 67583  				// or the error message if the pragma fails.
 67584  				*(*uintptr)(unsafe.Pointer(aFcntl)) = sqlite3.Xsqlite3_mprintf(tls, func() uintptr {
 67585  					if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate != 0 {
 67586  						return ts + 4039 /* "on" */
 67587  					}
 67588  					return ts + 4403 /* "off" */
 67589  				}(), 0)
 67590  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 67591  				break
 67592  			}
 67593  			// If the multiplexor does not handle the pragma, pass it through
 67594  			// into the default case.
 67595  
 67596  		}
 67597  		fallthrough
 67598  	default:
 67599  		pSubOpen = multiplexSubOpen(tls, pGroup, 0, bp+8 /* &rc */, uintptr(0), 0)
 67600  		if pSubOpen != 0 {
 67601  			*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 80 /* &.xFileControl */))))(tls, pSubOpen, op, pArg)
 67602  			if (op == SQLITE_FCNTL_VFSNAME) && (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) {
 67603  				*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+34923 /* "multiplex/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 67604  			}
 67605  		}
 67606  		break
 67607  	}
 67608  	return *(*int32)(unsafe.Pointer(bp + 8 /* rc */))
 67609  }
 67610  
 67611  // Pass xSectorSize requests through to the original VFS unchanged.
 67612  func multiplexSectorSize(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:1004:12: */
 67613  	bp := tls.Alloc(4)
 67614  	defer tls.Free(4)
 67615  
 67616  	var p uintptr = pConn
 67617  	// var rc int32 at bp, 4
 67618  
 67619  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67620  	if (pSubOpen != 0) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FxSectorSize != 0) {
 67621  		return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 88 /* &.xSectorSize */))))(tls, pSubOpen)
 67622  	}
 67623  	return DEFAULT_SECTOR_SIZE
 67624  }
 67625  
 67626  // Pass xDeviceCharacteristics requests through to the original VFS unchanged.
 67627  func multiplexDeviceCharacteristics(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:1016:12: */
 67628  	bp := tls.Alloc(4)
 67629  	defer tls.Free(4)
 67630  
 67631  	var p uintptr = pConn
 67632  	// var rc int32 at bp, 4
 67633  
 67634  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67635  	if pSubOpen != 0 {
 67636  		return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, pSubOpen)
 67637  	}
 67638  	return 0
 67639  }
 67640  
 67641  // Pass xShmMap requests through to the original VFS unchanged.
 67642  func multiplexShmMap(tls *libc.TLS, pConn uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) int32 { /* test_multiplex.c:1028:12: */
 67643  	bp := tls.Alloc(4)
 67644  	defer tls.Free(4)
 67645  
 67646  	var p uintptr = pConn
 67647  	// var rc int32 at bp, 4
 67648  
 67649  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67650  	if pSubOpen != 0 {
 67651  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 104 /* &.xShmMap */))))(tls, pSubOpen, iRegion, szRegion, bExtend, libc.AtomicLoadUintptr(&pp))
 67652  	}
 67653  	return SQLITE_IOERR
 67654  }
 67655  
 67656  // Pass xShmLock requests through to the original VFS unchanged.
 67657  func multiplexShmLock(tls *libc.TLS, pConn uintptr, ofst int32, n int32, flags int32) int32 { /* test_multiplex.c:1046:12: */
 67658  	bp := tls.Alloc(4)
 67659  	defer tls.Free(4)
 67660  
 67661  	var p uintptr = pConn
 67662  	// var rc int32 at bp, 4
 67663  
 67664  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67665  	if pSubOpen != 0 {
 67666  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 112 /* &.xShmLock */))))(tls, pSubOpen, ofst, n, flags)
 67667  	}
 67668  	return SQLITE_BUSY
 67669  }
 67670  
 67671  // Pass xShmBarrier requests through to the original VFS unchanged.
 67672  func multiplexShmBarrier(tls *libc.TLS, pConn uintptr) { /* test_multiplex.c:1063:13: */
 67673  	bp := tls.Alloc(4)
 67674  	defer tls.Free(4)
 67675  
 67676  	var p uintptr = pConn
 67677  	// var rc int32 at bp, 4
 67678  
 67679  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67680  	if pSubOpen != 0 {
 67681  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pSubOpen)
 67682  	}
 67683  }
 67684  
 67685  // Pass xShmUnmap requests through to the original VFS unchanged.
 67686  func multiplexShmUnmap(tls *libc.TLS, pConn uintptr, deleteFlag int32) int32 { /* test_multiplex.c:1074:12: */
 67687  	bp := tls.Alloc(4)
 67688  	defer tls.Free(4)
 67689  
 67690  	var p uintptr = pConn
 67691  	// var rc int32 at bp, 4
 67692  
 67693  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 67694  	if pSubOpen != 0 {
 67695  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pSubOpen, deleteFlag)
 67696  	}
 67697  	return SQLITE_OK
 67698  }
 67699  
 67700  //************************* Public Interfaces ****************************
 67701  // CAPI: Initialize the multiplex VFS shim - sqlite3_multiplex_initialize()
 67702  //
 67703  // Use the VFS named zOrigVfsName as the VFS that does the actual work.
 67704  // Use the default if zOrigVfsName==NULL.
 67705  //
 67706  // The multiplex VFS shim is named "multiplex".  It will become the default
 67707  // VFS if makeDefault is non-zero.
 67708  //
 67709  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once
 67710  // during start-up.
 67711  func sqlite3_multiplex_initialize(tls *libc.TLS, zOrigVfsName uintptr, makeDefault int32) int32 { /* test_multiplex.c:1097:5: */
 67712  	var pOrigVfs uintptr
 67713  	if gMultiplex.FisInitialized != 0 {
 67714  		return SQLITE_MISUSE
 67715  	}
 67716  	pOrigVfs = sqlite3.Xsqlite3_vfs_find(tls, zOrigVfsName)
 67717  	if pOrigVfs == uintptr(0) {
 67718  		return SQLITE_ERROR
 67719  	}
 67720  
 67721  	gMultiplex.FisInitialized = 1
 67722  	gMultiplex.FpOrigVfs = pOrigVfs
 67723  	gMultiplex.FsThisVfs = *(*sqlite3_vfs)(unsafe.Pointer(pOrigVfs))
 67724  	*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&gMultiplex)) + 8 /* &.sThisVfs */ + 4 /* &.szOsFile */)) += int32((uint64(unsafe.Sizeof(multiplexConn{}))))
 67725  	gMultiplex.FsThisVfs.FzName = ts + 34936 /* "multiplex" */
 67726  	gMultiplex.FsThisVfs.FxOpen = *(*uintptr)(unsafe.Pointer(&struct {
 67727  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 67728  	}{multiplexOpen}))
 67729  	gMultiplex.FsThisVfs.FxDelete = *(*uintptr)(unsafe.Pointer(&struct {
 67730  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 67731  	}{multiplexDelete}))
 67732  	gMultiplex.FsThisVfs.FxAccess = *(*uintptr)(unsafe.Pointer(&struct {
 67733  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 67734  	}{multiplexAccess}))
 67735  	gMultiplex.FsThisVfs.FxFullPathname = *(*uintptr)(unsafe.Pointer(&struct {
 67736  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 67737  	}{multiplexFullPathname}))
 67738  	gMultiplex.FsThisVfs.FxDlOpen = *(*uintptr)(unsafe.Pointer(&struct {
 67739  		f func(*libc.TLS, uintptr, uintptr) uintptr
 67740  	}{multiplexDlOpen}))
 67741  	gMultiplex.FsThisVfs.FxDlError = *(*uintptr)(unsafe.Pointer(&struct {
 67742  		f func(*libc.TLS, uintptr, int32, uintptr)
 67743  	}{multiplexDlError}))
 67744  	gMultiplex.FsThisVfs.FxDlSym = *(*uintptr)(unsafe.Pointer(&struct {
 67745  		f func(*libc.TLS, uintptr, uintptr, uintptr) uintptr
 67746  	}{multiplexDlSym}))
 67747  	gMultiplex.FsThisVfs.FxDlClose = *(*uintptr)(unsafe.Pointer(&struct {
 67748  		f func(*libc.TLS, uintptr, uintptr)
 67749  	}{multiplexDlClose}))
 67750  	gMultiplex.FsThisVfs.FxRandomness = *(*uintptr)(unsafe.Pointer(&struct {
 67751  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 67752  	}{multiplexRandomness}))
 67753  	gMultiplex.FsThisVfs.FxSleep = *(*uintptr)(unsafe.Pointer(&struct {
 67754  		f func(*libc.TLS, uintptr, int32) int32
 67755  	}{multiplexSleep}))
 67756  	gMultiplex.FsThisVfs.FxCurrentTime = *(*uintptr)(unsafe.Pointer(&struct {
 67757  		f func(*libc.TLS, uintptr, uintptr) int32
 67758  	}{multiplexCurrentTime}))
 67759  	gMultiplex.FsThisVfs.FxGetLastError = *(*uintptr)(unsafe.Pointer(&struct {
 67760  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 67761  	}{multiplexGetLastError}))
 67762  	gMultiplex.FsThisVfs.FxCurrentTimeInt64 = *(*uintptr)(unsafe.Pointer(&struct {
 67763  		f func(*libc.TLS, uintptr, uintptr) int32
 67764  	}{multiplexCurrentTimeInt64}))
 67765  
 67766  	gMultiplex.FsIoMethodsV1.FiVersion = 1
 67767  	gMultiplex.FsIoMethodsV1.FxClose = *(*uintptr)(unsafe.Pointer(&struct {
 67768  		f func(*libc.TLS, uintptr) int32
 67769  	}{multiplexClose}))
 67770  	gMultiplex.FsIoMethodsV1.FxRead = *(*uintptr)(unsafe.Pointer(&struct {
 67771  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 67772  	}{multiplexRead}))
 67773  	gMultiplex.FsIoMethodsV1.FxWrite = *(*uintptr)(unsafe.Pointer(&struct {
 67774  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 67775  	}{multiplexWrite}))
 67776  	gMultiplex.FsIoMethodsV1.FxTruncate = *(*uintptr)(unsafe.Pointer(&struct {
 67777  		f func(*libc.TLS, uintptr, sqlite3_int64) int32
 67778  	}{multiplexTruncate}))
 67779  	gMultiplex.FsIoMethodsV1.FxSync = *(*uintptr)(unsafe.Pointer(&struct {
 67780  		f func(*libc.TLS, uintptr, int32) int32
 67781  	}{multiplexSync}))
 67782  	gMultiplex.FsIoMethodsV1.FxFileSize = *(*uintptr)(unsafe.Pointer(&struct {
 67783  		f func(*libc.TLS, uintptr, uintptr) int32
 67784  	}{multiplexFileSize}))
 67785  	gMultiplex.FsIoMethodsV1.FxLock = *(*uintptr)(unsafe.Pointer(&struct {
 67786  		f func(*libc.TLS, uintptr, int32) int32
 67787  	}{multiplexLock}))
 67788  	gMultiplex.FsIoMethodsV1.FxUnlock = *(*uintptr)(unsafe.Pointer(&struct {
 67789  		f func(*libc.TLS, uintptr, int32) int32
 67790  	}{multiplexUnlock}))
 67791  	gMultiplex.FsIoMethodsV1.FxCheckReservedLock = *(*uintptr)(unsafe.Pointer(&struct {
 67792  		f func(*libc.TLS, uintptr, uintptr) int32
 67793  	}{multiplexCheckReservedLock}))
 67794  	gMultiplex.FsIoMethodsV1.FxFileControl = *(*uintptr)(unsafe.Pointer(&struct {
 67795  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 67796  	}{multiplexFileControl}))
 67797  	gMultiplex.FsIoMethodsV1.FxSectorSize = *(*uintptr)(unsafe.Pointer(&struct {
 67798  		f func(*libc.TLS, uintptr) int32
 67799  	}{multiplexSectorSize}))
 67800  	gMultiplex.FsIoMethodsV1.FxDeviceCharacteristics = *(*uintptr)(unsafe.Pointer(&struct {
 67801  		f func(*libc.TLS, uintptr) int32
 67802  	}{multiplexDeviceCharacteristics}))
 67803  	gMultiplex.FsIoMethodsV2 = gMultiplex.FsIoMethodsV1
 67804  	gMultiplex.FsIoMethodsV2.FiVersion = 2
 67805  	gMultiplex.FsIoMethodsV2.FxShmMap = *(*uintptr)(unsafe.Pointer(&struct {
 67806  		f func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32
 67807  	}{multiplexShmMap}))
 67808  	gMultiplex.FsIoMethodsV2.FxShmLock = *(*uintptr)(unsafe.Pointer(&struct {
 67809  		f func(*libc.TLS, uintptr, int32, int32, int32) int32
 67810  	}{multiplexShmLock}))
 67811  	gMultiplex.FsIoMethodsV2.FxShmBarrier = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{multiplexShmBarrier}))
 67812  	gMultiplex.FsIoMethodsV2.FxShmUnmap = *(*uintptr)(unsafe.Pointer(&struct {
 67813  		f func(*libc.TLS, uintptr, int32) int32
 67814  	}{multiplexShmUnmap}))
 67815  	sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&gMultiplex)) + 8 /* &.sThisVfs */), makeDefault)
 67816  
 67817  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 67818  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 67819  	}{multiplexFuncInit})))
 67820  
 67821  	return SQLITE_OK
 67822  }
 67823  
 67824  // CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown()
 67825  //
 67826  // All SQLite database connections must be closed before calling this
 67827  // routine.
 67828  //
 67829  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once while
 67830  // shutting down in order to free all remaining multiplex groups.
 67831  func sqlite3_multiplex_shutdown(tls *libc.TLS, eForce int32) int32 { /* test_multiplex.c:1158:5: */
 67832  	var rc int32 = SQLITE_OK
 67833  	if gMultiplex.FisInitialized == 0 {
 67834  		return SQLITE_MISUSE
 67835  	}
 67836  	gMultiplex.FisInitialized = 0
 67837  	sqlite3.Xsqlite3_vfs_unregister(tls, (uintptr(unsafe.Pointer(&gMultiplex)) + 8 /* &.sThisVfs */))
 67838  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&gMultiplex)), 0, uint64(unsafe.Sizeof(gMultiplex)))
 67839  	return rc
 67840  }
 67841  
 67842  // tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT
 67843  func test_multiplex_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1183:26: */
 67844  	bp := tls.Alloc(4)
 67845  	defer tls.Free(4)
 67846  
 67847  	var zName uintptr // Name of new multiplex VFS
 67848  	// var makeDefault int32 at bp, 4
 67849  	// True to make the new VFS the default
 67850  	var rc int32 // Value returned by multiplex_initialize()
 67851  
 67852  	_ = clientData
 67853  
 67854  	// Process arguments
 67855  	if objc != 3 {
 67856  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34946 /* "NAME MAKEDEFAULT" */)
 67857  		return TCL_ERROR
 67858  	}
 67859  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 67860  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &makeDefault */) != 0 {
 67861  		return TCL_ERROR
 67862  	}
 67863  	if int32(*(*int8)(unsafe.Pointer(zName))) == 0 {
 67864  		zName = uintptr(0)
 67865  	}
 67866  
 67867  	// Call sqlite3_multiplex_initialize()
 67868  	rc = sqlite3_multiplex_initialize(tls, zName, *(*int32)(unsafe.Pointer(bp /* makeDefault */)))
 67869  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 67870  
 67871  	return TCL_OK
 67872  }
 67873  
 67874  // tclcmd: sqlite3_multiplex_shutdown
 67875  func test_multiplex_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1214:26: */
 67876  	var rc int32 // Value returned by multiplex_shutdown()
 67877  
 67878  	_ = clientData
 67879  
 67880  	if (objc == 2) && (libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), ts+34963 /* "-force" */) != 0) {
 67881  		objc = 3
 67882  	}
 67883  	if (objc != 1) && (objc != 2) {
 67884  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34970 /* "?-force?" */)
 67885  		return TCL_ERROR
 67886  	}
 67887  
 67888  	// Call sqlite3_multiplex_shutdown()
 67889  	rc = sqlite3_multiplex_shutdown(tls, (libc.Bool32(objc == 2)))
 67890  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 67891  
 67892  	return TCL_OK
 67893  }
 67894  
 67895  // Tclcmd: test_multiplex_control HANDLE DBNAME SUB-COMMAND ?INT-VALUE?
 67896  func test_multiplex_control(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1242:26: */
 67897  	bp := tls.Alloc(176)
 67898  	defer tls.Free(176)
 67899  
 67900  	var rc int32 // Return code from file_control()
 67901  	// var idx int32 at bp+168, 4
 67902  	// Index in aSub[]
 67903  	// var cmdInfo Tcl_CmdInfo at bp+40, 64
 67904  	// Command info structure for HANDLE
 67905  	var db uintptr // Underlying db handle for HANDLE
 67906  	*(*int32)(unsafe.Pointer(bp + 172 /* iValue */)) = 0
 67907  	var pArg uintptr = uintptr(0)
 67908  
 67909  	*(*[4]struct {
 67910  		FzName   uintptr
 67911  		Fop      int32
 67912  		Fargtype int32
 67913  	})(unsafe.Pointer(bp + 104 /* aSub */)) = [4]struct {
 67914  		FzName   uintptr
 67915  		Fop      int32
 67916  		Fargtype int32
 67917  	}{
 67918  		{FzName: ts + 10608 /* "enable" */, Fop: MULTIPLEX_CTRL_ENABLE, Fargtype: 1},
 67919  		{FzName: ts + 34979 /* "chunk_size" */, Fop: MULTIPLEX_CTRL_SET_CHUNK_SIZE, Fargtype: 1},
 67920  		{FzName: ts + 34990 /* "max_chunks" */, Fop: MULTIPLEX_CTRL_SET_MAX_CHUNKS, Fargtype: 1},
 67921  		{},
 67922  	}
 67923  
 67924  	if objc != 5 {
 67925  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+35001 /* "HANDLE DBNAME SU..." */)
 67926  		return TCL_ERROR
 67927  	}
 67928  
 67929  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+40 /* &cmdInfo */) {
 67930  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35037 /* "expected databas..." */, 0))
 67931  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), ts+12415 /* "\"" */, 0))
 67932  		return TCL_ERROR
 67933  	} else {
 67934  		db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 40 /* &cmdInfo */)).FobjClientData))
 67935  	}
 67936  
 67937  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 67938  		interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+104 /* &aSub[0] */, int32(unsafe.Sizeof(struct {
 67939  			FzName   uintptr
 67940  			Fop      int32
 67941  			Fargtype int32
 67942  		}{})), ts+1875 /* "sub-command" */, 0, bp+168 /* &idx */)
 67943  	if rc != TCL_OK {
 67944  		return rc
 67945  	}
 67946  
 67947  	switch (*struct {
 67948  		FzName   uintptr
 67949  		Fop      int32
 67950  		Fargtype int32
 67951  	})(unsafe.Pointer(bp + 104 /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 168 /* idx */)))*16)).Fargtype {
 67952  	case 1:
 67953  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+172 /* &iValue */) != 0 {
 67954  			return TCL_ERROR
 67955  		}
 67956  		pArg = bp + 172 /* &iValue */
 67957  		break
 67958  	default:
 67959  		tcl.XTcl_WrongNumArgs(tls, interp, 4, objv, ts+2384 /* "SUB-COMMAND" */)
 67960  		return TCL_ERROR
 67961  	}
 67962  
 67963  	rc = sqlite3.Xsqlite3_file_control(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), (*struct {
 67964  		FzName   uintptr
 67965  		Fop      int32
 67966  		Fargtype int32
 67967  	})(unsafe.Pointer(bp+104 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 168 /* idx */)))*16)).Fop, pArg)
 67968  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 67969  	if rc == SQLITE_OK {
 67970  		return TCL_OK
 67971  	}
 67972  	return TCL_ERROR
 67973  }
 67974  
 67975  // This routine registers the custom TCL commands defined in this
 67976  // module.  This should be the only procedure visible from outside
 67977  // of this module.
 67978  func Sqlitemultiplex_Init(tls *libc.TLS, interp uintptr) int32 { /* test_multiplex.c:1306:5: */
 67979  	var i int32
 67980  
 67981  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd7)) / uint64(unsafe.Sizeof(struct {
 67982  		FzName uintptr
 67983  		FxProc uintptr
 67984  	}{}))); i++ {
 67985  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd7[i].FzName, aCmd7[i].FxProc, uintptr(0), uintptr(0))
 67986  	}
 67987  
 67988  	return TCL_OK
 67989  }
 67990  
 67991  var aCmd7 = [3]struct {
 67992  	FzName uintptr
 67993  	FxProc uintptr
 67994  }{
 67995  	{FzName: ts + 35069 /* "sqlite3_multiple..." */, FxProc: 0},
 67996  	{FzName: ts + 35098 /* "sqlite3_multiple..." */, FxProc: 0},
 67997  	{FzName: ts + 35125 /* "sqlite3_multiple..." */, FxProc: 0},
 67998  } /* test_multiplex.c:1310:5 */
 67999  
 68000  // CAPI3REF: Standard File Control Opcodes
 68001  // KEYWORDS: {file control opcodes} {file control opcode}
 68002  //
 68003  // These integer constants are opcodes for the xFileControl method
 68004  // of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
 68005  // interface.
 68006  //
 68007  // <ul>
 68008  // <li>[[SQLITE_FCNTL_LOCKSTATE]]
 68009  // The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
 68010  // opcode causes the xFileControl method to write the current state of
 68011  // the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
 68012  // [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
 68013  // into an integer that the pArg argument points to. This capability
 68014  // is used during testing and is only available when the SQLITE_TEST
 68015  // compile-time option is used.
 68016  //
 68017  // <li>[[SQLITE_FCNTL_SIZE_HINT]]
 68018  // The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
 68019  // layer a hint of how large the database file will grow to be during the
 68020  // current transaction.  This hint is not guaranteed to be accurate but it
 68021  // is often close.  The underlying VFS might choose to preallocate database
 68022  // file space based on this hint in order to help writes to the database
 68023  // file run faster.
 68024  //
 68025  // <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
 68026  // The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
 68027  // implements [sqlite3_deserialize()] to set an upper bound on the size
 68028  // of the in-memory database.  The argument is a pointer to a [sqlite3_int64].
 68029  // If the integer pointed to is negative, then it is filled in with the
 68030  // current limit.  Otherwise the limit is set to the larger of the value
 68031  // of the integer pointed to and the current database size.  The integer
 68032  // pointed to is set to the new limit.
 68033  //
 68034  // <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
 68035  // The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
 68036  // extends and truncates the database file in chunks of a size specified
 68037  // by the user. The fourth argument to [sqlite3_file_control()] should
 68038  // point to an integer (type int) containing the new chunk-size to use
 68039  // for the nominated database. Allocating database file space in large
 68040  // chunks (say 1MB at a time), may reduce file-system fragmentation and
 68041  // improve performance on some systems.
 68042  //
 68043  // <li>[[SQLITE_FCNTL_FILE_POINTER]]
 68044  // The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
 68045  // to the [sqlite3_file] object associated with a particular database
 68046  // connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].
 68047  //
 68048  // <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
 68049  // The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
 68050  // to the [sqlite3_file] object associated with the journal file (either
 68051  // the [rollback journal] or the [write-ahead log]) for a particular database
 68052  // connection.  See also [SQLITE_FCNTL_FILE_POINTER].
 68053  //
 68054  // <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
 68055  // No longer in use.
 68056  //
 68057  // <li>[[SQLITE_FCNTL_SYNC]]
 68058  // The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
 68059  // sent to the VFS immediately before the xSync method is invoked on a
 68060  // database file descriptor. Or, if the xSync method is not invoked
 68061  // because the user has configured SQLite with
 68062  // [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
 68063  // of the xSync method. In most cases, the pointer argument passed with
 68064  // this file-control is NULL. However, if the database file is being synced
 68065  // as part of a multi-database commit, the argument points to a nul-terminated
 68066  // string containing the transactions super-journal file name. VFSes that
 68067  // do not need this signal should silently ignore this opcode. Applications
 68068  // should not call [sqlite3_file_control()] with this opcode as doing so may
 68069  // disrupt the operation of the specialized VFSes that do require it.
 68070  //
 68071  // <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
 68072  // The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
 68073  // and sent to the VFS after a transaction has been committed immediately
 68074  // but before the database is unlocked. VFSes that do not need this signal
 68075  // should silently ignore this opcode. Applications should not call
 68076  // [sqlite3_file_control()] with this opcode as doing so may disrupt the
 68077  // operation of the specialized VFSes that do require it.
 68078  //
 68079  // <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
 68080  // ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
 68081  // retry counts and intervals for certain disk I/O operations for the
 68082  // windows [VFS] in order to provide robustness in the presence of
 68083  // anti-virus programs.  By default, the windows VFS will retry file read,
 68084  // file write, and file delete operations up to 10 times, with a delay
 68085  // of 25 milliseconds before the first retry and with the delay increasing
 68086  // by an additional 25 milliseconds with each subsequent retry.  This
 68087  // opcode allows these two values (10 retries and 25 milliseconds of delay)
 68088  // to be adjusted.  The values are changed for all database connections
 68089  // within the same process.  The argument is a pointer to an array of two
 68090  // integers where the first integer is the new retry count and the second
 68091  // integer is the delay.  If either integer is negative, then the setting
 68092  // is not changed but instead the prior value of that setting is written
 68093  // into the array entry, allowing the current retry settings to be
 68094  // interrogated.  The zDbName parameter is ignored.
 68095  //
 68096  // <li>[[SQLITE_FCNTL_PERSIST_WAL]]
 68097  // ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
 68098  // persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
 68099  // write ahead log ([WAL file]) and shared memory
 68100  // files used for transaction control
 68101  // are automatically deleted when the latest connection to the database
 68102  // closes.  Setting persistent WAL mode causes those files to persist after
 68103  // close.  Persisting the files is useful when other processes that do not
 68104  // have write permission on the directory containing the database file want
 68105  // to read the database file, as the WAL and shared memory files must exist
 68106  // in order for the database to be readable.  The fourth parameter to
 68107  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
 68108  // That integer is 0 to disable persistent WAL mode or 1 to enable persistent
 68109  // WAL mode.  If the integer is -1, then it is overwritten with the current
 68110  // WAL persistence setting.
 68111  //
 68112  // <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
 68113  // ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
 68114  // persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting
 68115  // determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
 68116  // xDeviceCharacteristics methods. The fourth parameter to
 68117  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
 68118  // That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
 68119  // mode.  If the integer is -1, then it is overwritten with the current
 68120  // zero-damage mode setting.
 68121  //
 68122  // <li>[[SQLITE_FCNTL_OVERWRITE]]
 68123  // ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
 68124  // a write transaction to indicate that, unless it is rolled back for some
 68125  // reason, the entire database file will be overwritten by the current
 68126  // transaction. This is used by VACUUM operations.
 68127  //
 68128  // <li>[[SQLITE_FCNTL_VFSNAME]]
 68129  // ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
 68130  // all [VFSes] in the VFS stack.  The names are of all VFS shims and the
 68131  // final bottom-level VFS are written into memory obtained from
 68132  // [sqlite3_malloc()] and the result is stored in the char* variable
 68133  // that the fourth parameter of [sqlite3_file_control()] points to.
 68134  // The caller is responsible for freeing the memory when done.  As with
 68135  // all file-control actions, there is no guarantee that this will actually
 68136  // do anything.  Callers should initialize the char* variable to a NULL
 68137  // pointer in case this file-control is not implemented.  This file-control
 68138  // is intended for diagnostic use only.
 68139  //
 68140  // <li>[[SQLITE_FCNTL_VFS_POINTER]]
 68141  // ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
 68142  // [VFSes] currently in use.  ^(The argument X in
 68143  // sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
 68144  // of type "[sqlite3_vfs] **".  This opcodes will set *X
 68145  // to a pointer to the top-level VFS.)^
 68146  // ^When there are multiple VFS shims in the stack, this opcode finds the
 68147  // upper-most shim only.
 68148  //
 68149  // <li>[[SQLITE_FCNTL_PRAGMA]]
 68150  // ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
 68151  // file control is sent to the open [sqlite3_file] object corresponding
 68152  // to the database file to which the pragma statement refers. ^The argument
 68153  // to the [SQLITE_FCNTL_PRAGMA] file control is an array of
 68154  // pointers to strings (char**) in which the second element of the array
 68155  // is the name of the pragma and the third element is the argument to the
 68156  // pragma or NULL if the pragma has no argument.  ^The handler for an
 68157  // [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
 68158  // of the char** argument point to a string obtained from [sqlite3_mprintf()]
 68159  // or the equivalent and that string will become the result of the pragma or
 68160  // the error message if the pragma fails. ^If the
 68161  // [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
 68162  // [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]
 68163  // file control returns [SQLITE_OK], then the parser assumes that the
 68164  // VFS has handled the PRAGMA itself and the parser generates a no-op
 68165  // prepared statement if result string is NULL, or that returns a copy
 68166  // of the result string if the string is non-NULL.
 68167  // ^If the [SQLITE_FCNTL_PRAGMA] file control returns
 68168  // any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
 68169  // that the VFS encountered an error while handling the [PRAGMA] and the
 68170  // compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]
 68171  // file control occurs at the beginning of pragma statement analysis and so
 68172  // it is able to override built-in [PRAGMA] statements.
 68173  //
 68174  // <li>[[SQLITE_FCNTL_BUSYHANDLER]]
 68175  // ^The [SQLITE_FCNTL_BUSYHANDLER]
 68176  // file-control may be invoked by SQLite on the database file handle
 68177  // shortly after it is opened in order to provide a custom VFS with access
 68178  // to the connection's busy-handler callback. The argument is of type (void**)
 68179  // - an array of two (void *) values. The first (void *) actually points
 68180  // to a function of type (int (*)(void *)). In order to invoke the connection's
 68181  // busy-handler, this function should be invoked with the second (void *) in
 68182  // the array as the only argument. If it returns non-zero, then the operation
 68183  // should be retried. If it returns zero, the custom VFS should abandon the
 68184  // current operation.
 68185  //
 68186  // <li>[[SQLITE_FCNTL_TEMPFILENAME]]
 68187  // ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
 68188  // to have SQLite generate a
 68189  // temporary filename using the same algorithm that is followed to generate
 68190  // temporary filenames for TEMP tables and other internal uses.  The
 68191  // argument should be a char** which will be filled with the filename
 68192  // written into memory obtained from [sqlite3_malloc()].  The caller should
 68193  // invoke [sqlite3_free()] on the result to avoid a memory leak.
 68194  //
 68195  // <li>[[SQLITE_FCNTL_MMAP_SIZE]]
 68196  // The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
 68197  // maximum number of bytes that will be used for memory-mapped I/O.
 68198  // The argument is a pointer to a value of type sqlite3_int64 that
 68199  // is an advisory maximum number of bytes in the file to memory map.  The
 68200  // pointer is overwritten with the old value.  The limit is not changed if
 68201  // the value originally pointed to is negative, and so the current limit
 68202  // can be queried by passing in a pointer to a negative number.  This
 68203  // file-control is used internally to implement [PRAGMA mmap_size].
 68204  //
 68205  // <li>[[SQLITE_FCNTL_TRACE]]
 68206  // The [SQLITE_FCNTL_TRACE] file control provides advisory information
 68207  // to the VFS about what the higher layers of the SQLite stack are doing.
 68208  // This file control is used by some VFS activity tracing [shims].
 68209  // The argument is a zero-terminated string.  Higher layers in the
 68210  // SQLite stack may generate instances of this file control if
 68211  // the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
 68212  //
 68213  // <li>[[SQLITE_FCNTL_HAS_MOVED]]
 68214  // The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
 68215  // pointer to an integer and it writes a boolean into that integer depending
 68216  // on whether or not the file has been renamed, moved, or deleted since it
 68217  // was first opened.
 68218  //
 68219  // <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
 68220  // The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
 68221  // underlying native file handle associated with a file handle.  This file
 68222  // control interprets its argument as a pointer to a native file handle and
 68223  // writes the resulting value there.
 68224  //
 68225  // <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
 68226  // The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
 68227  // opcode causes the xFileControl method to swap the file handle with the one
 68228  // pointed to by the pArg argument.  This capability is used during testing
 68229  // and only needs to be supported when SQLITE_TEST is defined.
 68230  //
 68231  // <li>[[SQLITE_FCNTL_WAL_BLOCK]]
 68232  // The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
 68233  // be advantageous to block on the next WAL lock if the lock is not immediately
 68234  // available.  The WAL subsystem issues this signal during rare
 68235  // circumstances in order to fix a problem with priority inversion.
 68236  // Applications should <em>not</em> use this file-control.
 68237  //
 68238  // <li>[[SQLITE_FCNTL_ZIPVFS]]
 68239  // The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
 68240  // VFS should return SQLITE_NOTFOUND for this opcode.
 68241  //
 68242  // <li>[[SQLITE_FCNTL_RBU]]
 68243  // The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
 68244  // the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for
 68245  // this opcode.
 68246  //
 68247  // <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
 68248  // If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
 68249  // the file descriptor is placed in "batch write mode", which
 68250  // means all subsequent write operations will be deferred and done
 68251  // atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].  Systems
 68252  // that do not support batch atomic writes will return SQLITE_NOTFOUND.
 68253  // ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
 68254  // the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
 68255  // [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
 68256  // no VFS interface calls on the same [sqlite3_file] file descriptor
 68257  // except for calls to the xWrite method and the xFileControl method
 68258  // with [SQLITE_FCNTL_SIZE_HINT].
 68259  //
 68260  // <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
 68261  // The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
 68262  // operations since the previous successful call to
 68263  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
 68264  // This file control returns [SQLITE_OK] if and only if the writes were
 68265  // all performed successfully and have been committed to persistent storage.
 68266  // ^Regardless of whether or not it is successful, this file control takes
 68267  // the file descriptor out of batch write mode so that all subsequent
 68268  // write operations are independent.
 68269  // ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
 68270  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
 68271  //
 68272  // <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
 68273  // The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
 68274  // operations since the previous successful call to
 68275  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
 68276  // ^This file control takes the file descriptor out of batch write mode
 68277  // so that all subsequent write operations are independent.
 68278  // ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
 68279  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
 68280  //
 68281  // <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
 68282  // The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
 68283  // to block for up to M milliseconds before failing when attempting to
 68284  // obtain a file lock using the xLock or xShmLock methods of the VFS.
 68285  // The parameter is a pointer to a 32-bit signed integer that contains
 68286  // the value that M is to be set to. Before returning, the 32-bit signed
 68287  // integer is overwritten with the previous value of M.
 68288  //
 68289  // <li>[[SQLITE_FCNTL_DATA_VERSION]]
 68290  // The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
 68291  // a database file.  The argument is a pointer to a 32-bit unsigned integer.
 68292  // The "data version" for the pager is written into the pointer.  The
 68293  // "data version" changes whenever any change occurs to the corresponding
 68294  // database file, either through SQL statements on the same database
 68295  // connection or through transactions committed by separate database
 68296  // connections possibly in other processes. The [sqlite3_total_changes()]
 68297  // interface can be used to find if any database on the connection has changed,
 68298  // but that interface responds to changes on TEMP as well as MAIN and does
 68299  // not provide a mechanism to detect changes to MAIN only.  Also, the
 68300  // [sqlite3_total_changes()] interface responds to internal changes only and
 68301  // omits changes made by other database connections.  The
 68302  // [PRAGMA data_version] command provides a mechanism to detect changes to
 68303  // a single attached database that occur due to other database connections,
 68304  // but omits changes implemented by the database connection on which it is
 68305  // called.  This file control is the only mechanism to detect changes that
 68306  // happen either internally or externally and that are associated with
 68307  // a particular attached database.
 68308  //
 68309  // <li>[[SQLITE_FCNTL_CKPT_START]]
 68310  // The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
 68311  // in wal mode before the client starts to copy pages from the wal
 68312  // file to the database file.
 68313  //
 68314  // <li>[[SQLITE_FCNTL_CKPT_DONE]]
 68315  // The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
 68316  // in wal mode after the client has finished copying pages from the wal
 68317  // file to the database file, but before the *-shm file is updated to
 68318  // record the fact that the pages have been checkpointed.
 68319  // </ul>
 68320  //
 68321  // <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
 68322  // The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
 68323  // whether or not there is a database client in another process with a wal-mode
 68324  // transaction open on the database or not. It is only available on unix.The
 68325  // (void*) argument passed with this file-control should be a pointer to a
 68326  // value of type (int). The integer value is set to 1 if the database is a wal
 68327  // mode database and there exists at least one client in another process that
 68328  // currently has an SQL transaction open on the database. It is set to 0 if
 68329  // the database is not a wal-mode db, or if there is no such connection in any
 68330  // other process. This opcode cannot be used to detect transactions opened
 68331  // by clients within the current process, only within other processes.
 68332  // </ul>
 68333  //
 68334  // <li>[[SQLITE_FCNTL_CKSM_FILE]]
 68335  // Used by the cksmvfs VFS module only.
 68336  // </ul>
 68337  
 68338  // deprecated names
 68339  
 68340  // CAPI3REF: Mutex Handle
 68341  //
 68342  // The mutex module within SQLite defines [sqlite3_mutex] to be an
 68343  // abstract type for a mutex object.  The SQLite core never looks
 68344  // at the internal representation of an [sqlite3_mutex].  It only
 68345  // deals with pointers to the [sqlite3_mutex] object.
 68346  //
 68347  // Mutexes are created using [sqlite3_mutex_alloc()].
 68348  type sqlite3_mutex = sqlite3_mutex1 /* sqlite3.h:1206:30 */
 68349  
 68350  var aName = [15]uintptr{
 68351  	ts + 35151 /* "fast" */, ts + 35156 /* "recursive" */, ts + 35166 /* "static_main" */, ts + 35178, /* "static_mem" */
 68352  	ts + 35189 /* "static_open" */, ts + 35201 /* "static_prng" */, ts + 35213 /* "static_lru" */, ts + 35224, /* "static_pmem" */
 68353  	ts + 35236 /* "static_app1" */, ts + 35248 /* "static_app2" */, ts + 35260 /* "static_app3" */, ts + 35272, /* "static_vfs1" */
 68354  	ts + 35284 /* "static_vfs2" */, ts + 35296 /* "static_vfs3" */, uintptr(0),
 68355  } /* test_mutex.c:32:19 */
 68356  
 68357  // State variables
 68358  type test_mutex_globals = struct {
 68359  	FisInstalled int32
 68360  	FdisableInit int32
 68361  	FdisableTry  int32
 68362  	FisInit      int32
 68363  	Fm           sqlite3_mutex_methods
 68364  	FaCounter    [14]int32
 68365  	FaStatic     [12]sqlite3_mutex
 68366  } /* test_mutex.c:46:8 */
 68367  
 68368  // State variables
 68369  var g3 = test_mutex_globals{} /* test_mutex.c:54:3 */
 68370  
 68371  // Return true if the countable mutex is currently held
 68372  func counterMutexHeld(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:57:12: */
 68373  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 56 /* &.xMutexHeld */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68374  }
 68375  
 68376  // Return true if the countable mutex is not currently held
 68377  func counterMutexNotheld(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:62:12: */
 68378  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 64 /* &.xMutexNotheld */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68379  }
 68380  
 68381  // Initialize the countable mutex interface
 68382  // Or, if g.disableInit is non-zero, then do not initialize but instead
 68383  // return the value of g.disableInit as the result code.  This can be used
 68384  // to simulate an initialization failure.
 68385  func counterMutexInit(tls *libc.TLS) int32 { /* test_mutex.c:71:12: */
 68386  	var rc int32
 68387  	if g3.FdisableInit != 0 {
 68388  		return g3.FdisableInit
 68389  	}
 68390  	rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ /* &.xMutexInit */))))(tls)
 68391  	g3.FisInit = 1
 68392  	return rc
 68393  }
 68394  
 68395  // Uninitialize the mutex subsystem
 68396  func counterMutexEnd(tls *libc.TLS) int32 { /* test_mutex.c:82:12: */
 68397  	g3.FisInit = 0
 68398  	return (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 8 /* &.xMutexEnd */))))(tls)
 68399  }
 68400  
 68401  // Allocate a countable mutex
 68402  func counterMutexAlloc(tls *libc.TLS, eType int32) uintptr { /* test_mutex.c:90:22: */
 68403  	var pReal uintptr
 68404  	var pRet uintptr = uintptr(0)
 68405  
 68406  	pReal = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 16 /* &.xMutexAlloc */))))(tls, eType)
 68407  	if !(pReal != 0) {
 68408  		return uintptr(0)
 68409  	}
 68410  
 68411  	if (eType == SQLITE_MUTEX_FAST) || (eType == SQLITE_MUTEX_RECURSIVE) {
 68412  		pRet = libc.Xmalloc(tls, uint64(unsafe.Sizeof(sqlite3_mutex{})))
 68413  	} else {
 68414  		var eStaticType int32 = (eType - ((SQLITE_MUTEX_STATIC_VFS3 + 1) - ((SQLITE_MUTEX_STATIC_VFS3 + 1) - (SQLITE_MUTEX_RECURSIVE + 1))))
 68415  
 68416  		pRet = ((uintptr(unsafe.Pointer(&g3)) + 144 /* &.aStatic */) + uintptr(eStaticType)*16)
 68417  	}
 68418  
 68419  	(*sqlite3_mutex)(unsafe.Pointer(pRet)).FeType = eType
 68420  	(*sqlite3_mutex)(unsafe.Pointer(pRet)).FpReal = pReal
 68421  	return pRet
 68422  }
 68423  
 68424  // Free a countable mutex
 68425  func counterMutexFree(tls *libc.TLS, p uintptr) { /* test_mutex.c:118:13: */
 68426  
 68427  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 24 /* &.xMutexFree */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68428  	if ((*sqlite3_mutex)(unsafe.Pointer(p)).FeType == SQLITE_MUTEX_FAST) || ((*sqlite3_mutex)(unsafe.Pointer(p)).FeType == SQLITE_MUTEX_RECURSIVE) {
 68429  		libc.Xfree(tls, p)
 68430  	}
 68431  }
 68432  
 68433  // Enter a countable mutex.  Block until entry is safe.
 68434  func counterMutexEnter(tls *libc.TLS, p uintptr) { /* test_mutex.c:129:13: */
 68435  
 68436  	*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 88 /* &.aCounter */) + uintptr((*sqlite3_mutex)(unsafe.Pointer(p)).FeType)*4))++
 68437  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 32 /* &.xMutexEnter */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68438  }
 68439  
 68440  // Try to enter a mutex.  Return true on success.
 68441  func counterMutexTry(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:140:12: */
 68442  
 68443  	*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 88 /* &.aCounter */) + uintptr((*sqlite3_mutex)(unsafe.Pointer(p)).FeType)*4))++
 68444  	if g3.FdisableTry != 0 {
 68445  		return SQLITE_BUSY
 68446  	}
 68447  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 40 /* &.xMutexTry */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68448  }
 68449  
 68450  // Leave a mutex
 68451  func counterMutexLeave(tls *libc.TLS, p uintptr) { /* test_mutex.c:151:13: */
 68452  
 68453  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 48 /* &.xMutexLeave */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 68454  }
 68455  
 68456  // sqlite3_shutdown
 68457  func test_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:159:26: */
 68458  	var rc int32
 68459  
 68460  	if objc != 1 {
 68461  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 68462  		return TCL_ERROR
 68463  	}
 68464  
 68465  	rc = sqlite3.Xsqlite3_shutdown(tls)
 68466  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68467  	return TCL_OK
 68468  }
 68469  
 68470  // sqlite3_initialize
 68471  func test_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:180:26: */
 68472  	var rc int32
 68473  
 68474  	if objc != 1 {
 68475  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 68476  		return TCL_ERROR
 68477  	}
 68478  
 68479  	rc = sqlite3.Xsqlite3_initialize(tls)
 68480  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68481  	return TCL_OK
 68482  }
 68483  
 68484  // install_mutex_counters BOOLEAN
 68485  func test_install_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:201:26: */
 68486  	bp := tls.Alloc(136)
 68487  	defer tls.Free(136)
 68488  
 68489  	var rc int32 = SQLITE_OK
 68490  	// var isInstall int32 at bp+56, 4
 68491  
 68492  	*(*sqlite3_mutex_methods)(unsafe.Pointer(bp + 64 /* counter_methods */)) = sqlite3_mutex_methods{
 68493  		FxMutexInit: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{counterMutexInit})),
 68494  		FxMutexEnd:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{counterMutexEnd})),
 68495  		FxMutexAlloc: *(*uintptr)(unsafe.Pointer(&struct {
 68496  			f func(*libc.TLS, int32) uintptr
 68497  		}{counterMutexAlloc})),
 68498  		FxMutexFree:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexFree})),
 68499  		FxMutexEnter: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexEnter})),
 68500  		FxMutexTry: *(*uintptr)(unsafe.Pointer(&struct {
 68501  			f func(*libc.TLS, uintptr) int32
 68502  		}{counterMutexTry})),
 68503  		FxMutexLeave: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexLeave})),
 68504  		FxMutexHeld: *(*uintptr)(unsafe.Pointer(&struct {
 68505  			f func(*libc.TLS, uintptr) int32
 68506  		}{counterMutexHeld})),
 68507  		FxMutexNotheld: *(*uintptr)(unsafe.Pointer(&struct {
 68508  			f func(*libc.TLS, uintptr) int32
 68509  		}{counterMutexNotheld})),
 68510  	}
 68511  
 68512  	if objc != 2 {
 68513  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 68514  		return TCL_ERROR
 68515  	}
 68516  	if TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+56 /* &isInstall */) {
 68517  		return TCL_ERROR
 68518  	}
 68519  
 68520  	if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) == g3.FisInstalled {
 68521  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35308 /* "mutex counters a..." */, 0))
 68522  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, func() uintptr {
 68523  			if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) != 0 {
 68524  				return ts + 35328 /* "already installe..." */
 68525  			}
 68526  			return ts + 35346 /* "not installed" */
 68527  		}(), 0))
 68528  		return TCL_ERROR
 68529  	}
 68530  
 68531  	if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) != 0 {
 68532  
 68533  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMUTEX, libc.VaList(bp+32, (uintptr(unsafe.Pointer(&g3))+16 /* &.m */)))
 68534  		if rc == SQLITE_OK {
 68535  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+40, bp+64 /* &counter_methods */))
 68536  		}
 68537  		g3.FdisableTry = 0
 68538  	} else {
 68539  
 68540  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+48, (uintptr(unsafe.Pointer(&g3))+16 /* &.m */)))
 68541  		libc.Xmemset(tls, (uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */), 0, uint64(unsafe.Sizeof(sqlite3_mutex_methods{})))
 68542  	}
 68543  
 68544  	if rc == SQLITE_OK {
 68545  		g3.FisInstalled = *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */))
 68546  	}
 68547  
 68548  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68549  	return TCL_OK
 68550  }
 68551  
 68552  // read_mutex_counters
 68553  func test_read_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:262:26: */
 68554  	var pRet uintptr
 68555  	var ii int32
 68556  
 68557  	if objc != 1 {
 68558  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 68559  		return TCL_ERROR
 68560  	}
 68561  
 68562  	pRet = tcl.XTcl_NewObj(tls)
 68563  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 68564  	for ii = 0; ii < (SQLITE_MUTEX_STATIC_VFS3 + 1); ii++ {
 68565  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, aName[ii], -1))
 68566  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 88 /* &.aCounter */) + uintptr(ii)*4))))
 68567  	}
 68568  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 68569  	for ok := true; ok; ok = 0 != 0 {
 68570  		var _objPtr uintptr = pRet
 68571  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 68572  			tcl.XTclFreeObj(tls, _objPtr)
 68573  		}
 68574  	}
 68575  
 68576  	return TCL_OK
 68577  }
 68578  
 68579  // clear_mutex_counters
 68580  func test_clear_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:291:26: */
 68581  	var ii int32
 68582  
 68583  	if objc != 1 {
 68584  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 68585  		return TCL_ERROR
 68586  	}
 68587  
 68588  	for ii = 0; ii < (SQLITE_MUTEX_STATIC_VFS3 + 1); ii++ {
 68589  		*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 88 /* &.aCounter */) + uintptr(ii)*4)) = 0
 68590  	}
 68591  	return TCL_OK
 68592  }
 68593  
 68594  // Create and free a mutex.  Return the mutex pointer.  The pointer
 68595  // will be invalid since the mutex has already been freed.  The
 68596  // return pointer just checks to see if the mutex really was allocated.
 68597  func test_alloc_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:315:26: */
 68598  	bp := tls.Alloc(124)
 68599  	defer tls.Free(124)
 68600  
 68601  	var p uintptr = sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST)
 68602  	// var zBuf [100]int8 at bp+24, 100
 68603  
 68604  	sqlite3.Xsqlite3_mutex_free(tls, p)
 68605  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+24 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp, p))
 68606  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, bp+24 /* &zBuf[0] */, uintptr(0)))
 68607  	return TCL_OK
 68608  }
 68609  
 68610  // sqlite3_config OPTION
 68611  //
 68612  // OPTION can be either one of the keywords:
 68613  //
 68614  //            SQLITE_CONFIG_SINGLETHREAD
 68615  //            SQLITE_CONFIG_MULTITHREAD
 68616  //            SQLITE_CONFIG_SERIALIZED
 68617  //
 68618  // Or OPTION can be an raw integer.
 68619  func test_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:342:26: */
 68620  	bp := tls.Alloc(68)
 68621  	defer tls.Free(68)
 68622  
 68623  	*(*[4]ConfigOption)(unsafe.Pointer(bp /* aOpt */)) = [4]ConfigOption{
 68624  		{FzName: ts + 35360 /* "singlethread" */, FiValue: SQLITE_CONFIG_SINGLETHREAD},
 68625  		{FzName: ts + 35373 /* "multithread" */, FiValue: SQLITE_CONFIG_MULTITHREAD},
 68626  		{FzName: ts + 35385 /* "serialized" */, FiValue: SQLITE_CONFIG_SERIALIZED},
 68627  		{},
 68628  	}
 68629  	var s int32 = int32(unsafe.Sizeof(ConfigOption{}))
 68630  	// var i int32 at bp+64, 4
 68631  
 68632  	var rc int32
 68633  
 68634  	if objc != 2 {
 68635  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 68636  		return TCL_ERROR
 68637  	}
 68638  
 68639  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &aOpt[0] */, s, ts+17985 /* "flag" */, 0, bp+64 /* &i */) != 0 {
 68640  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+64 /* &i */) != 0 {
 68641  			return TCL_ERROR
 68642  		}
 68643  	} else {
 68644  		*(*int32)(unsafe.Pointer(bp + 64 /* i */)) = (*ConfigOption)(unsafe.Pointer(bp /* &aOpt */ + uintptr(*(*int32)(unsafe.Pointer(bp + 64 /* i */)))*16)).FiValue
 68645  	}
 68646  
 68647  	rc = sqlite3.Xsqlite3_config(tls, *(*int32)(unsafe.Pointer(bp + 64 /* i */)), 0)
 68648  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68649  	return TCL_OK
 68650  }
 68651  
 68652  type ConfigOption = struct {
 68653  	FzName  uintptr
 68654  	FiValue int32
 68655  	_       [4]byte
 68656  } /* test_mutex.c:348:3 */
 68657  
 68658  func getDbPointer1(tls *libc.TLS, pInterp uintptr, pObj uintptr) uintptr { /* test_mutex.c:379:16: */
 68659  	bp := tls.Alloc(64)
 68660  	defer tls.Free(64)
 68661  
 68662  	var db uintptr
 68663  	// var info Tcl_CmdInfo at bp, 64
 68664  
 68665  	var zCmd uintptr = tcl.XTcl_GetString(tls, pObj)
 68666  	if tcl.XTcl_GetCommandInfo(tls, pInterp, zCmd, bp /* &info */) != 0 {
 68667  		db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp /* &info */)).FobjClientData))
 68668  	} else {
 68669  		db = sqlite3TestTextToPtr(tls, zCmd)
 68670  	}
 68671  
 68672  	return db
 68673  }
 68674  
 68675  func getStaticMutexPointer(tls *libc.TLS, pInterp uintptr, pObj uintptr) uintptr { /* test_mutex.c:392:22: */
 68676  	bp := tls.Alloc(4)
 68677  	defer tls.Free(4)
 68678  
 68679  	// var iMutex int32 at bp, 4
 68680  
 68681  	if tcl.XTcl_GetIndexFromObjStruct(tls, pInterp, pObj, uintptr(unsafe.Pointer(&aName)), int32(unsafe.Sizeof(uintptr(0))), ts+35396 /* "mutex name" */, 0, bp /* &iMutex */) != 0 {
 68682  		return uintptr(0)
 68683  	}
 68684  
 68685  	return counterMutexAlloc(tls, *(*int32)(unsafe.Pointer(bp /* iMutex */)))
 68686  }
 68687  
 68688  func test_enter_static_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:404:26: */
 68689  	var pMutex uintptr
 68690  	if objc != 2 {
 68691  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 68692  		return TCL_ERROR
 68693  	}
 68694  	pMutex = getStaticMutexPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 68695  	if !(pMutex != 0) {
 68696  		return TCL_ERROR
 68697  	}
 68698  	sqlite3.Xsqlite3_mutex_enter(tls, pMutex)
 68699  	return TCL_OK
 68700  }
 68701  
 68702  func test_leave_static_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:423:26: */
 68703  	var pMutex uintptr
 68704  	if objc != 2 {
 68705  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 68706  		return TCL_ERROR
 68707  	}
 68708  	pMutex = getStaticMutexPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 68709  	if !(pMutex != 0) {
 68710  		return TCL_ERROR
 68711  	}
 68712  	sqlite3.Xsqlite3_mutex_leave(tls, pMutex)
 68713  	return TCL_OK
 68714  }
 68715  
 68716  func test_enter_db_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:442:26: */
 68717  	var db uintptr
 68718  	if objc != 2 {
 68719  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 68720  		return TCL_ERROR
 68721  	}
 68722  	db = getDbPointer1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 68723  	if !(db != 0) {
 68724  		return TCL_ERROR
 68725  	}
 68726  	sqlite3.Xsqlite3_mutex_enter(tls, sqlite3.Xsqlite3_db_mutex(tls, db))
 68727  	return TCL_OK
 68728  }
 68729  
 68730  func test_leave_db_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:461:26: */
 68731  	var db uintptr
 68732  	if objc != 2 {
 68733  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 68734  		return TCL_ERROR
 68735  	}
 68736  	db = getDbPointer1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 68737  	if !(db != 0) {
 68738  		return TCL_ERROR
 68739  	}
 68740  	sqlite3.Xsqlite3_mutex_leave(tls, sqlite3.Xsqlite3_db_mutex(tls, db))
 68741  	return TCL_OK
 68742  }
 68743  
 68744  func Sqlitetest_mutex_Init(tls *libc.TLS, interp uintptr) int32 { /* test_mutex.c:480:5: */
 68745  	var i int32
 68746  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd8)) / uint64(unsafe.Sizeof(struct {
 68747  		FzName uintptr
 68748  		FxProc uintptr
 68749  	}{}))); i++ {
 68750  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd8[i].FzName, aCmd8[i].FxProc, uintptr(0), uintptr(0))
 68751  	}
 68752  
 68753  	tcl.XTcl_LinkVar(tls, interp, ts+35407, /* "disable_mutex_in..." */
 68754  		(uintptr(unsafe.Pointer(&g3)) + 4 /* &.disableInit */), TCL_LINK_INT)
 68755  	tcl.XTcl_LinkVar(tls, interp, ts+35426, /* "disable_mutex_tr..." */
 68756  		(uintptr(unsafe.Pointer(&g3)) + 8 /* &.disableTry */), TCL_LINK_INT)
 68757  	return SQLITE_OK
 68758  }
 68759  
 68760  var aCmd8 = [11]struct {
 68761  	FzName uintptr
 68762  	FxProc uintptr
 68763  }{
 68764  	{FzName: ts + 35444 /* "sqlite3_shutdown" */, FxProc: 0},
 68765  	{FzName: ts + 35461 /* "sqlite3_initiali..." */, FxProc: 0},
 68766  	{FzName: ts + 35480 /* "sqlite3_config" */, FxProc: 0},
 68767  
 68768  	{FzName: ts + 35495 /* "enter_static_mut..." */, FxProc: 0},
 68769  	{FzName: ts + 35514 /* "leave_static_mut..." */, FxProc: 0},
 68770  
 68771  	{FzName: ts + 35533 /* "enter_db_mutex" */, FxProc: 0},
 68772  	{FzName: ts + 35548 /* "leave_db_mutex" */, FxProc: 0},
 68773  
 68774  	{FzName: ts + 35563 /* "alloc_dealloc_mu..." */, FxProc: 0},
 68775  	{FzName: ts + 35583 /* "install_mutex_co..." */, FxProc: 0},
 68776  	{FzName: ts + 35606 /* "read_mutex_count..." */, FxProc: 0},
 68777  	{FzName: ts + 35626 /* "clear_mutex_coun..." */, FxProc: 0},
 68778  } /* test_mutex.c:484:5 */
 68779  
 68780  // Maximum pathname length supported by the fs backend.
 68781  
 68782  // Name used to identify this VFS.
 68783  
 68784  type fs_real_file1 = struct {
 68785  	FpFile     uintptr
 68786  	FzName     uintptr
 68787  	FnDatabase int32
 68788  	FnJournal  int32
 68789  	FnBlob     int32
 68790  	FnRef      int32
 68791  	FpNext     uintptr
 68792  	FppThis    uintptr
 68793  } /* test_onefile.c:97:9 */
 68794  
 68795  // Maximum pathname length supported by the fs backend.
 68796  
 68797  // Name used to identify this VFS.
 68798  
 68799  type fs_real_file = fs_real_file1 /* test_onefile.c:97:29 */
 68800  
 68801  type fs_file1 = struct {
 68802  	Fbase  sqlite3_file
 68803  	FeType int32
 68804  	_      [4]byte
 68805  	FpReal uintptr
 68806  } /* test_onefile.c:109:9 */
 68807  
 68808  type fs_file = fs_file1 /* test_onefile.c:109:24 */
 68809  
 68810  type tmp_file1 = struct {
 68811  	Fbase   sqlite3_file
 68812  	FnSize  int32
 68813  	FnAlloc int32
 68814  	FzAlloc uintptr
 68815  } /* test_onefile.c:116:9 */
 68816  
 68817  type tmp_file = tmp_file1 /* test_onefile.c:116:25 */
 68818  
 68819  type fs_vfs_t1 = struct {
 68820  	Fbase      sqlite3_vfs
 68821  	FpFileList uintptr
 68822  	FpParent   uintptr
 68823  } /* test_onefile.c:176:9 */
 68824  
 68825  type fs_vfs_t = fs_vfs_t1 /* test_onefile.c:176:25 */
 68826  
 68827  var fs_vfs = fs_vfs_t{
 68828  	Fbase: sqlite3_vfs{
 68829  		FiVersion:      1,          // pNext
 68830  		FzName:         ts + 31250, /* "fs" */ // pAppData
 68831  		FxOpen:         0,          // xOpen
 68832  		FxDelete:       0,          // xDelete
 68833  		FxAccess:       0,          // xAccess
 68834  		FxFullPathname: 0,          // xFullPathname
 68835  		FxDlOpen:       0,          // xDlOpen
 68836  		FxDlError:      0,          // xDlError
 68837  		FxDlSym:        0,          // xDlSym
 68838  		FxDlClose:      0,          // xDlClose
 68839  		FxRandomness:   0,          // xRandomness
 68840  		FxSleep:        0,          // xSleep
 68841  		FxCurrentTime:  0,          // xCurrentTimeInt64
 68842  	}, // pParent
 68843  } /* test_onefile.c:183:17 */
 68844  
 68845  var fs_io_methods = sqlite3_io_methods{
 68846  	FiVersion:               1, // iVersion
 68847  	FxClose:                 0, // xClose
 68848  	FxRead:                  0, // xRead
 68849  	FxWrite:                 0, // xWrite
 68850  	FxTruncate:              0, // xTruncate
 68851  	FxSync:                  0, // xSync
 68852  	FxFileSize:              0, // xFileSize
 68853  	FxLock:                  0, // xLock
 68854  	FxUnlock:                0, // xUnlock
 68855  	FxCheckReservedLock:     0, // xCheckReservedLock
 68856  	FxFileControl:           0, // xFileControl
 68857  	FxSectorSize:            0, // xSectorSize
 68858  	FxDeviceCharacteristics: 0, // xShmUnmap
 68859  } /* test_onefile.c:208:27 */
 68860  
 68861  var tmp_io_methods = sqlite3_io_methods{
 68862  	FiVersion:               1, // iVersion
 68863  	FxClose:                 0, // xClose
 68864  	FxRead:                  0, // xRead
 68865  	FxWrite:                 0, // xWrite
 68866  	FxTruncate:              0, // xTruncate
 68867  	FxSync:                  0, // xSync
 68868  	FxFileSize:              0, // xFileSize
 68869  	FxLock:                  0, // xLock
 68870  	FxUnlock:                0, // xUnlock
 68871  	FxCheckReservedLock:     0, // xCheckReservedLock
 68872  	FxFileControl:           0, // xFileControl
 68873  	FxSectorSize:            0, // xSectorSize
 68874  	FxDeviceCharacteristics: 0, // xShmUnmap
 68875  } /* test_onefile.c:229:27 */
 68876  
 68877  // Useful macros used in several places
 68878  
 68879  // Close a tmp-file.
 68880  func tmpClose(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:257:12: */
 68881  	var pTmp uintptr = pFile
 68882  	sqlite3.Xsqlite3_free(tls, (*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc)
 68883  	return SQLITE_OK
 68884  }
 68885  
 68886  // Read data from a tmp-file.
 68887  func tmpRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:266:12: */
 68888  	var pTmp uintptr = pFile
 68889  	if (sqlite_int64(iAmt) + iOfst) > sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize) {
 68890  		return (SQLITE_IOERR | (int32(2) << 8))
 68891  	}
 68892  	libc.Xmemcpy(tls, zBuf, ((*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc + uintptr(iOfst)), uint64(iAmt))
 68893  	return SQLITE_OK
 68894  }
 68895  
 68896  // Write data to a tmp-file.
 68897  func tmpWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:283:12: */
 68898  	var pTmp uintptr = pFile
 68899  	if (sqlite_int64(iAmt) + iOfst) > sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc) {
 68900  		var nNew int32 = (int32(int64(2) * ((sqlite_int64(iAmt) + iOfst) + sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc))))
 68901  		var zNew uintptr = sqlite3.Xsqlite3_realloc(tls, (*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc, nNew)
 68902  		if !(zNew != 0) {
 68903  			return SQLITE_NOMEM
 68904  		}
 68905  		(*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc = zNew
 68906  		(*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc = nNew
 68907  	}
 68908  	libc.Xmemcpy(tls, ((*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc + uintptr(iOfst)), zBuf, uint64(iAmt))
 68909  	(*tmp_file)(unsafe.Pointer(pTmp)).FnSize = func() int32 {
 68910  		if (sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)) > (iOfst + sqlite_int64(iAmt)) {
 68911  			return (*tmp_file)(unsafe.Pointer(pTmp)).FnSize
 68912  		}
 68913  		return (int32(iOfst + sqlite_int64(iAmt)))
 68914  	}()
 68915  	return SQLITE_OK
 68916  }
 68917  
 68918  // Truncate a tmp-file.
 68919  func tmpTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_onefile.c:307:12: */
 68920  	var pTmp uintptr = pFile
 68921  	(*tmp_file)(unsafe.Pointer(pTmp)).FnSize = func() int32 {
 68922  		if (sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)) < (size) {
 68923  			return (*tmp_file)(unsafe.Pointer(pTmp)).FnSize
 68924  		}
 68925  		return int32(size)
 68926  	}()
 68927  	return SQLITE_OK
 68928  }
 68929  
 68930  // Sync a tmp-file.
 68931  func tmpSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_onefile.c:316:12: */
 68932  	return SQLITE_OK
 68933  }
 68934  
 68935  // Return the current file-size of a tmp-file.
 68936  func tmpFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_onefile.c:323:12: */
 68937  	var pTmp uintptr = pFile
 68938  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)
 68939  	return SQLITE_OK
 68940  }
 68941  
 68942  // Lock a tmp-file.
 68943  func tmpLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:332:12: */
 68944  	return SQLITE_OK
 68945  }
 68946  
 68947  // Unlock a tmp-file.
 68948  func tmpUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:339:12: */
 68949  	return SQLITE_OK
 68950  }
 68951  
 68952  // Check if another file-handle holds a RESERVED lock on a tmp-file.
 68953  func tmpCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_onefile.c:346:12: */
 68954  	*(*int32)(unsafe.Pointer(pResOut)) = 0
 68955  	return SQLITE_OK
 68956  }
 68957  
 68958  // File control method. For custom operations on a tmp-file.
 68959  func tmpFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_onefile.c:354:12: */
 68960  	return SQLITE_OK
 68961  }
 68962  
 68963  // Return the sector-size in bytes for a tmp-file.
 68964  func tmpSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:361:12: */
 68965  	return 0
 68966  }
 68967  
 68968  // Return the device characteristic flags supported by a tmp-file.
 68969  func tmpDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:368:12: */
 68970  	return 0
 68971  }
 68972  
 68973  // Close an fs-file.
 68974  func fsClose1(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:375:12: */
 68975  	var rc int32 = SQLITE_OK
 68976  	var p uintptr = pFile
 68977  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 68978  
 68979  	// Decrement the real_file ref-count.
 68980  	(*fs_real_file)(unsafe.Pointer(pReal)).FnRef--
 68981  
 68982  	// When the ref-count reaches 0, destroy the structure
 68983  	if (*fs_real_file)(unsafe.Pointer(pReal)).FnRef == 0 {
 68984  		*(*uintptr)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FppThis)) = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext
 68985  		if (*fs_real_file)(unsafe.Pointer(pReal)).FpNext != 0 {
 68986  			(*fs_real_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpNext)).FppThis = (*fs_real_file)(unsafe.Pointer(pReal)).FppThis
 68987  		}
 68988  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods + 8 /* &.xClose */))))(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile)
 68989  		sqlite3.Xsqlite3_free(tls, pReal)
 68990  	}
 68991  
 68992  	return rc
 68993  }
 68994  
 68995  // Read data from an fs-file.
 68996  func fsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:400:12: */
 68997  	var rc int32 = SQLITE_OK
 68998  	var p uintptr = pFile
 68999  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 69000  	var pF uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 69001  
 69002  	if (((*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE) && ((sqlite_int64(iAmt) + iOfst) > sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase))) ||
 69003  		(((*fs_file)(unsafe.Pointer(p)).FeType == JOURNAL_FILE) && ((sqlite_int64(iAmt) + iOfst) > sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal))) {
 69004  		rc = (SQLITE_IOERR | (int32(2) << 8))
 69005  	} else if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 69006  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 16 /* &.xRead */))))(tls, pF, zBuf, iAmt, (iOfst + int64(BLOCKSIZE)))
 69007  	} else {
 69008  		// Journal file.
 69009  		var iRem int32 = iAmt
 69010  		var iBuf int32 = 0
 69011  		var ii int32 = int32(iOfst)
 69012  		for (iRem > 0) && (rc == SQLITE_OK) {
 69013  			var iRealOff int32 = (((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (BLOCKSIZE * ((ii / BLOCKSIZE) + 1))) + (ii % BLOCKSIZE))
 69014  			var iRealAmt int32 = func() int32 {
 69015  				if (iRem) < (BLOCKSIZE - (iRealOff % BLOCKSIZE)) {
 69016  					return iRem
 69017  				}
 69018  				return (BLOCKSIZE - (iRealOff % BLOCKSIZE))
 69019  			}()
 69020  
 69021  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 16 /* &.xRead */))))(tls, pF, ((zBuf) + uintptr(iBuf)), iRealAmt, int64(iRealOff))
 69022  			ii = ii + (iRealAmt)
 69023  			iBuf = iBuf + (iRealAmt)
 69024  			iRem = iRem - (iRealAmt)
 69025  		}
 69026  	}
 69027  
 69028  	return rc
 69029  }
 69030  
 69031  // Write data to an fs-file.
 69032  func fsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:439:12: */
 69033  	var rc int32 = SQLITE_OK
 69034  	var p uintptr = pFile
 69035  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 69036  	var pF uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 69037  
 69038  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 69039  		if ((sqlite_int64(iAmt) + iOfst) + int64(BLOCKSIZE)) > (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) {
 69040  			rc = SQLITE_FULL
 69041  		} else {
 69042  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 24 /* &.xWrite */))))(tls, pF, zBuf, iAmt, (iOfst + int64(BLOCKSIZE)))
 69043  			if rc == SQLITE_OK {
 69044  				(*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase = func() int32 {
 69045  					if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)) > (sqlite_int64(iAmt) + iOfst) {
 69046  						return (*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase
 69047  					}
 69048  					return (int32(sqlite_int64(iAmt) + iOfst))
 69049  				}()
 69050  			}
 69051  		}
 69052  	} else {
 69053  		// Journal file.
 69054  		var iRem int32 = iAmt
 69055  		var iBuf int32 = 0
 69056  		var ii int32 = int32(iOfst)
 69057  		for (iRem > 0) && (rc == SQLITE_OK) {
 69058  			var iRealOff int32 = (((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (BLOCKSIZE * ((ii / BLOCKSIZE) + 1))) + (ii % BLOCKSIZE))
 69059  			var iRealAmt int32 = func() int32 {
 69060  				if (iRem) < (BLOCKSIZE - (iRealOff % BLOCKSIZE)) {
 69061  					return iRem
 69062  				}
 69063  				return (BLOCKSIZE - (iRealOff % BLOCKSIZE))
 69064  			}()
 69065  
 69066  			if iRealOff < ((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase + BLOCKSIZE) {
 69067  				rc = SQLITE_FULL
 69068  			} else {
 69069  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 24 /* &.xWrite */))))(tls, pF, ((zBuf) + uintptr(iBuf)), iRealAmt, int64(iRealOff))
 69070  				ii = ii + (iRealAmt)
 69071  				iBuf = iBuf + (iRealAmt)
 69072  				iRem = iRem - (iRealAmt)
 69073  			}
 69074  		}
 69075  		if rc == SQLITE_OK {
 69076  			(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = func() int32 {
 69077  				if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) > (sqlite_int64(iAmt) + iOfst) {
 69078  					return (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal
 69079  				}
 69080  				return (int32(sqlite_int64(iAmt) + iOfst))
 69081  			}()
 69082  		}
 69083  	}
 69084  
 69085  	return rc
 69086  }
 69087  
 69088  // Truncate an fs-file.
 69089  func fsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_onefile.c:488:12: */
 69090  	var p uintptr = pFile
 69091  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 69092  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 69093  		(*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase = func() int32 {
 69094  			if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)) < (size) {
 69095  				return (*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase
 69096  			}
 69097  			return int32(size)
 69098  		}()
 69099  	} else {
 69100  		(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = func() int32 {
 69101  			if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) < (size) {
 69102  				return (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal
 69103  			}
 69104  			return int32(size)
 69105  		}()
 69106  	}
 69107  	return SQLITE_OK
 69108  }
 69109  
 69110  // Sync an fs-file.
 69111  func fsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_onefile.c:502:12: */
 69112  	bp := tls.Alloc(4)
 69113  	defer tls.Free(4)
 69114  
 69115  	var p uintptr = pFile
 69116  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 69117  	var pRealFile uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 69118  	var rc int32 = SQLITE_OK
 69119  
 69120  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 69121  		// var zSize [4]uint8 at bp, 4
 69122  
 69123  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */)) = (uint8((uint32((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase) & 0xFF000000) >> 24))
 69124  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 1)) = (uint8(((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x00FF0000) >> 16))
 69125  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 2)) = (uint8(((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x0000FF00) >> 8))
 69126  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 3)) = (uint8((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x000000FF))
 69127  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 24 /* &.xWrite */))))(tls, pRealFile, bp /* &zSize[0] */, 4, int64(0))
 69128  	}
 69129  	if rc == SQLITE_OK {
 69130  		rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 40 /* &.xSync */))))(tls, pRealFile, (flags & (libc.CplInt32(SQLITE_SYNC_DATAONLY))))
 69131  	}
 69132  
 69133  	return rc
 69134  }
 69135  
 69136  // Return the current file-size of an fs-file.
 69137  func fsFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_onefile.c:526:12: */
 69138  	var p uintptr = pFile
 69139  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 69140  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 69141  		*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)
 69142  	} else {
 69143  		*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)
 69144  	}
 69145  	return SQLITE_OK
 69146  }
 69147  
 69148  // Lock an fs-file.
 69149  func fsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:540:12: */
 69150  	return SQLITE_OK
 69151  }
 69152  
 69153  // Unlock an fs-file.
 69154  func fsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:547:12: */
 69155  	return SQLITE_OK
 69156  }
 69157  
 69158  // Check if another file-handle holds a RESERVED lock on an fs-file.
 69159  func fsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_onefile.c:554:12: */
 69160  	*(*int32)(unsafe.Pointer(pResOut)) = 0
 69161  	return SQLITE_OK
 69162  }
 69163  
 69164  // File control method. For custom operations on an fs-file.
 69165  func fsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_onefile.c:562:12: */
 69166  	if op == SQLITE_FCNTL_PRAGMA {
 69167  		return SQLITE_NOTFOUND
 69168  	}
 69169  	return SQLITE_OK
 69170  }
 69171  
 69172  // Return the sector-size in bytes for an fs-file.
 69173  func fsSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:570:12: */
 69174  	return BLOCKSIZE
 69175  }
 69176  
 69177  // Return the device characteristic flags supported by an fs-file.
 69178  func fsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:577:12: */
 69179  	return 0
 69180  }
 69181  
 69182  // Open an fs file handle.
 69183  func fsOpen1(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_onefile.c:584:12: */
 69184  	bp := tls.Alloc(12)
 69185  	defer tls.Free(12)
 69186  
 69187  	var pFsVfs uintptr
 69188  	var p uintptr
 69189  	var pReal uintptr
 69190  	var eType int32
 69191  	var nName int32
 69192  	var rc int32
 69193  	var p2 uintptr
 69194  	// var zS [4]uint8 at bp+8, 4
 69195  
 69196  	var real_flags int32
 69197  	// var size sqlite3_int64 at bp, 8
 69198  
 69199  	var pRealFile uintptr
 69200  	var pParent uintptr
 69201  	pFsVfs = pVfs
 69202  	p = pFile
 69203  	pReal = uintptr(0)
 69204  	rc = SQLITE_OK
 69205  
 69206  	if !(0 == (flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_MAIN_JOURNAL))) {
 69207  		goto __1
 69208  	}
 69209  	p2 = pFile
 69210  	libc.Xmemset(tls, p2, 0, uint64(unsafe.Sizeof(tmp_file{})))
 69211  	(*tmp_file)(unsafe.Pointer(p2)).Fbase.FpMethods = uintptr(unsafe.Pointer(&tmp_io_methods))
 69212  	return SQLITE_OK
 69213  __1:
 69214  	;
 69215  
 69216  	eType = func() int32 {
 69217  		if (flags & (SQLITE_OPEN_MAIN_DB)) != 0 {
 69218  			return DATABASE_FILE
 69219  		}
 69220  		return JOURNAL_FILE
 69221  	}()
 69222  	(*fs_file)(unsafe.Pointer(p)).Fbase.FpMethods = uintptr(unsafe.Pointer(&fs_io_methods))
 69223  	(*fs_file)(unsafe.Pointer(p)).FeType = eType
 69224  
 69225  	nName = (int32(libc.Xstrlen(tls, zName)) - (func() int32 {
 69226  		if eType == JOURNAL_FILE {
 69227  			return 8
 69228  		}
 69229  		return 0
 69230  	}()))
 69231  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 69232  __2:
 69233  	if !((pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zName, uint64(nName)) != 0)) {
 69234  		goto __4
 69235  	}
 69236  	goto __3
 69237  __3:
 69238  	pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext
 69239  	goto __2
 69240  	goto __4
 69241  __4:
 69242  	;
 69243  
 69244  	if !(!(pReal != 0)) {
 69245  		goto __5
 69246  	}
 69247  	real_flags = ((flags & libc.CplInt32(SQLITE_OPEN_MAIN_DB)) | SQLITE_OPEN_TEMP_DB)
 69248  	pParent = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpParent
 69249  
 69250  	pReal = sqlite3.Xsqlite3_malloc(tls, (int32(uint64(unsafe.Sizeof(fs_real_file{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile))))
 69251  	if !(!(pReal != 0)) {
 69252  		goto __6
 69253  	}
 69254  	rc = SQLITE_NOMEM
 69255  	goto open_out
 69256  __6:
 69257  	;
 69258  	libc.Xmemset(tls, pReal, 0, (uint64(unsafe.Sizeof(fs_real_file{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)))
 69259  	(*fs_real_file)(unsafe.Pointer(pReal)).FzName = zName
 69260  	(*fs_real_file)(unsafe.Pointer(pReal)).FpFile = (pReal + 1*48)
 69261  
 69262  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 40 /* &.xOpen */))))(tls, pParent, zName, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile, real_flags, pOutFlags)
 69263  	if !(rc != SQLITE_OK) {
 69264  		goto __7
 69265  	}
 69266  	goto open_out
 69267  __7:
 69268  	;
 69269  	pRealFile = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 69270  
 69271  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 48 /* &.xFileSize */))))(tls, pRealFile, bp /* &size */)
 69272  	if !(rc != SQLITE_OK) {
 69273  		goto __8
 69274  	}
 69275  	goto open_out
 69276  __8:
 69277  	;
 69278  	if !(*(*sqlite3_int64)(unsafe.Pointer(bp /* size */)) == int64(0)) {
 69279  		goto __9
 69280  	}
 69281  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 24 /* &.xWrite */))))(tls, pRealFile, ts+35647 /* "\x00" */, 1, (int64(BLOBSIZE - 1)))
 69282  	(*fs_real_file)(unsafe.Pointer(pReal)).FnBlob = BLOBSIZE
 69283  	goto __10
 69284  __9:
 69285  	(*fs_real_file)(unsafe.Pointer(pReal)).FnBlob = int32(*(*sqlite3_int64)(unsafe.Pointer(bp /* size */)))
 69286  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 16 /* &.xRead */))))(tls, pRealFile, bp+8 /* &zS[0] */, 4, int64(0))
 69287  	(*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase = ((((int32(*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */))) << 24) + (int32(*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 1))) << 16)) + (int32(*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 2))) << 8)) + int32(*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 3))))
 69288  	if !(rc == SQLITE_OK) {
 69289  		goto __11
 69290  	}
 69291  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 16 /* &.xRead */))))(tls, pRealFile, bp+8 /* &zS[0] */, 4, (int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - 4)))
 69292  	if !((((*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */)) != 0) || (*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 1)) != 0)) || (*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 2)) != 0)) || (*(*uint8)(unsafe.Pointer(bp + 8 /* &zS[0] */ + 3)) != 0)) {
 69293  		goto __12
 69294  	}
 69295  	(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = (*fs_real_file)(unsafe.Pointer(pReal)).FnBlob
 69296  __12:
 69297  	;
 69298  __11:
 69299  	;
 69300  __10:
 69301  	;
 69302  
 69303  	if !(rc == SQLITE_OK) {
 69304  		goto __13
 69305  	}
 69306  	(*fs_real_file)(unsafe.Pointer(pReal)).FpNext = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 69307  	if !((*fs_real_file)(unsafe.Pointer(pReal)).FpNext != 0) {
 69308  		goto __14
 69309  	}
 69310  	(*fs_real_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpNext)).FppThis = (pReal + 32 /* &.pNext */)
 69311  __14:
 69312  	;
 69313  	(*fs_real_file)(unsafe.Pointer(pReal)).FppThis = (pFsVfs + 168 /* &.pFileList */)
 69314  	(*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList = pReal
 69315  __13:
 69316  	;
 69317  __5:
 69318  	;
 69319  
 69320  open_out:
 69321  	if !(pReal != 0) {
 69322  		goto __15
 69323  	}
 69324  	if !(rc == SQLITE_OK) {
 69325  		goto __16
 69326  	}
 69327  	(*fs_file)(unsafe.Pointer(p)).FpReal = pReal
 69328  	(*fs_real_file)(unsafe.Pointer(pReal)).FnRef++
 69329  	goto __17
 69330  __16:
 69331  	if !((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods != 0) {
 69332  		goto __18
 69333  	}
 69334  	(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods + 8 /* &.xClose */))))(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile)
 69335  __18:
 69336  	;
 69337  	sqlite3.Xsqlite3_free(tls, pReal)
 69338  __17:
 69339  	;
 69340  __15:
 69341  	;
 69342  	return rc
 69343  }
 69344  
 69345  // Delete the file located at zPath. If the dirSync argument is true,
 69346  // ensure the file-system modifications are synced to disk before
 69347  // returning.
 69348  func fsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_onefile.c:686:12: */
 69349  	var rc int32 = SQLITE_OK
 69350  	var pFsVfs uintptr = pVfs
 69351  	var pReal uintptr
 69352  	var pF uintptr
 69353  	var nName int32 = (int32(libc.Xstrlen(tls, zPath)) - 8)
 69354  
 69355  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 69356  	for ; (pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zPath, uint64(nName)) != 0); pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext {
 69357  	}
 69358  	if pReal != 0 {
 69359  		pF = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 69360  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 24 /* &.xWrite */))))(tls, pF, ts+35649 /* "\x00\x00\x00\x00" */, 4, (int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - BLOCKSIZE)))
 69361  		if rc == SQLITE_OK {
 69362  			(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = 0
 69363  		}
 69364  	}
 69365  	return rc
 69366  }
 69367  
 69368  // Test for access permissions. Return true if the requested permission
 69369  // is available, or false otherwise.
 69370  func fsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_onefile.c:712:12: */
 69371  	var pFsVfs uintptr = pVfs
 69372  	var pReal uintptr
 69373  	var isJournal int32 = 0
 69374  	var nName int32 = int32(libc.Xstrlen(tls, zPath))
 69375  
 69376  	if flags != SQLITE_ACCESS_EXISTS {
 69377  		var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69378  		return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 56 /* &.xAccess */))))(tls, pParent, zPath, flags, pResOut)
 69379  	}
 69380  
 69381  	if (nName > 8) && (libc.Xstrcmp(tls, ts+33006 /* "-journal" */, (zPath+uintptr((nName-8)))) == 0) {
 69382  		nName = nName - (8)
 69383  		isJournal = 1
 69384  	}
 69385  
 69386  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 69387  	for ; (pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zPath, uint64(nName)) != 0); pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext {
 69388  	}
 69389  
 69390  	*(*int32)(unsafe.Pointer(pResOut)) = (libc.Bool32((pReal != 0) && (!(isJournal != 0) || ((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal > 0))))
 69391  	return SQLITE_OK
 69392  }
 69393  
 69394  // Populate buffer zOut with the full canonical pathname corresponding
 69395  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 69396  // of at least (FS_MAX_PATHNAME+1) bytes.
 69397  func fsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_onefile.c:746:12: */
 69398  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69399  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 64 /* &.xFullPathname */))))(tls, pParent, zPath, nOut, zOut)
 69400  }
 69401  
 69402  // Open the dynamic library located at zPath and return a handle.
 69403  func fsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_onefile.c:759:13: */
 69404  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69405  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pParent + 72 /* &.xDlOpen */))))(tls, pParent, zPath)
 69406  }
 69407  
 69408  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 69409  // utf-8 string describing the most recent error encountered associated
 69410  // with dynamic libraries.
 69411  func fsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_onefile.c:769:13: */
 69412  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69413  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pParent + 80 /* &.xDlError */))))(tls, pParent, nByte, zErrMsg)
 69414  }
 69415  
 69416  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 69417  func fsDlSym(tls *libc.TLS, pVfs uintptr, pH uintptr, zSym uintptr) uintptr { /* test_onefile.c:777:13: */
 69418  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69419  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pParent + 88 /* &.xDlSym */))))(tls, pParent, pH, zSym)
 69420  }
 69421  
 69422  // Close the dynamic library handle pHandle.
 69423  func fsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_onefile.c:785:13: */
 69424  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69425  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pParent + 96 /* &.xDlClose */))))(tls, pParent, pHandle)
 69426  }
 69427  
 69428  // Populate the buffer pointed to by zBufOut with nByte bytes of
 69429  // random data.
 69430  func fsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_onefile.c:794:12: */
 69431  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69432  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 104 /* &.xRandomness */))))(tls, pParent, nByte, zBufOut)
 69433  }
 69434  
 69435  // Sleep for nMicro microseconds. Return the number of microseconds
 69436  // actually slept.
 69437  func fsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_onefile.c:803:12: */
 69438  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69439  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pParent + 112 /* &.xSleep */))))(tls, pParent, nMicro)
 69440  }
 69441  
 69442  // Return the current time as a Julian Day number in *pTimeOut.
 69443  func fsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_onefile.c:811:12: */
 69444  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 69445  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pParent + 120 /* &.xCurrentTime */))))(tls, pParent, pTimeOut)
 69446  }
 69447  
 69448  // This procedure registers the fs vfs with SQLite. If the argument is
 69449  // true, the fs vfs becomes the new default vfs. It is the only publicly
 69450  // available function in this file.
 69451  func fs_register(tls *libc.TLS) int32 { /* test_onefile.c:821:5: */
 69452  	if fs_vfs.FpParent != 0 {
 69453  		return SQLITE_OK
 69454  	}
 69455  	fs_vfs.FpParent = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 69456  	fs_vfs.Fbase.FmxPathname = (*sqlite3_vfs)(unsafe.Pointer(fs_vfs.FpParent)).FmxPathname
 69457  	fs_vfs.Fbase.FszOsFile = func() int32 {
 69458  		if (uint64(unsafe.Sizeof(tmp_file{}))) > (uint64(unsafe.Sizeof(fs_file{}))) {
 69459  			return int32(unsafe.Sizeof(tmp_file{}))
 69460  		}
 69461  		return int32(unsafe.Sizeof(fs_file{}))
 69462  	}()
 69463  	return sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&fs_vfs)) /* &.base */), 0)
 69464  }
 69465  
 69466  func SqlitetestOnefile_Init(tls *libc.TLS) int32 { /* test_onefile.c:830:7: */
 69467  	return fs_register(tls)
 69468  }
 69469  
 69470  // Maximum pathname length supported by the vfslog backend.
 69471  
 69472  type VfslogVfs1 = struct {
 69473  	Fbase        sqlite3_vfs
 69474  	FpVfs        uintptr
 69475  	FiNextFileId int32
 69476  	_            [4]byte
 69477  	FpLog        uintptr
 69478  	FiOffset     sqlite3_int64
 69479  	FnBuf        int32
 69480  	FaBuf        [8192]int8
 69481  	_            [4]byte
 69482  } /* test_osinst.c:117:9 */
 69483  
 69484  // Maximum pathname length supported by the vfslog backend.
 69485  
 69486  type VfslogVfs = VfslogVfs1 /* test_osinst.c:117:26 */
 69487  type VfslogFile1 = struct {
 69488  	Fbase    sqlite3_file
 69489  	FpReal   uintptr
 69490  	FpVfslog uintptr
 69491  	FiFileId int32
 69492  	_        [4]byte
 69493  } /* test_osinst.c:118:9 */
 69494  
 69495  type VfslogFile = VfslogFile1 /* test_osinst.c:118:27 */
 69496  
 69497  var vfslog_vfs = sqlite3_vfs{
 69498  	FiVersion:          1,                                  // iVersion
 69499  	FszOsFile:          int32(unsafe.Sizeof(VfslogFile{})), // szOsFile
 69500  	FmxPathname:        INST_MAX_PATHNAME,                  // pAppData
 69501  	FxOpen:             0,                                  // xOpen
 69502  	FxDelete:           0,                                  // xDelete
 69503  	FxAccess:           0,                                  // xAccess
 69504  	FxFullPathname:     0,                                  // xFullPathname
 69505  	FxDlOpen:           0,                                  // xDlOpen
 69506  	FxDlError:          0,                                  // xDlError
 69507  	FxDlSym:            0,                                  // xDlSym
 69508  	FxDlClose:          0,                                  // xDlClose
 69509  	FxRandomness:       0,                                  // xRandomness
 69510  	FxSleep:            0,                                  // xSleep
 69511  	FxCurrentTime:      0,                                  // xCurrentTime
 69512  	FxGetLastError:     0,                                  // xGetLastError
 69513  	FxCurrentTimeInt64: 0,                                  // xCurrentTime
 69514  } /* test_osinst.c:180:20 */
 69515  
 69516  var vfslog_io_methods = sqlite3_io_methods{
 69517  	FiVersion:               2, // iVersion
 69518  	FxClose:                 0, // xClose
 69519  	FxRead:                  0, // xRead
 69520  	FxWrite:                 0, // xWrite
 69521  	FxTruncate:              0, // xTruncate
 69522  	FxSync:                  0, // xSync
 69523  	FxFileSize:              0, // xFileSize
 69524  	FxLock:                  0, // xLock
 69525  	FxUnlock:                0, // xUnlock
 69526  	FxCheckReservedLock:     0, // xCheckReservedLock
 69527  	FxFileControl:           0, // xFileControl
 69528  	FxSectorSize:            0, // xSectorSize
 69529  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 69530  	FxShmMap:                0, // xShmMap
 69531  	FxShmLock:               0, // xShmLock
 69532  	FxShmBarrier:            0, // xShmBarrier
 69533  	FxShmUnmap:              0, // xShmUnmap
 69534  } /* test_osinst.c:202:27 */
 69535  
 69536  func vfslog_time(tls *libc.TLS) sqlite3_uint64 { /* test_osinst.c:224:23: */
 69537  	bp := tls.Alloc(16)
 69538  	defer tls.Free(16)
 69539  
 69540  	// var sTime timeval at bp, 16
 69541  
 69542  	libc.Xgettimeofday(tls, bp /* &sTime */, uintptr(0))
 69543  	return (sqlite3_uint64((*timeval)(unsafe.Pointer(bp /* &sTime */)).Ftv_usec) + (sqlite3_uint64((*timeval)(unsafe.Pointer(bp /* &sTime */)).Ftv_sec) * uint64(1000000)))
 69544  }
 69545  
 69546  // Close an vfslog-file.
 69547  func vfslogClose(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:256:12: */
 69548  	var t sqlite3_uint64
 69549  	var rc int32 = SQLITE_OK
 69550  	var p uintptr = pFile
 69551  
 69552  	t = vfslog_time(tls)
 69553  	if (*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 69554  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 8 /* &.xClose */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 69555  	}
 69556  	t = (vfslog_time(tls) - t)
 69557  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_CLOSE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69558  	return rc
 69559  }
 69560  
 69561  // Read data from an vfslog-file.
 69562  func vfslogRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_osinst.c:273:12: */
 69563  	var rc int32
 69564  	var t sqlite3_uint64
 69565  	var p uintptr = pFile
 69566  	t = vfslog_time(tls)
 69567  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 16 /* &.xRead */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 69568  	t = (vfslog_time(tls) - t)
 69569  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_READ, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, iAmt, int32(iOfst))
 69570  	return rc
 69571  }
 69572  
 69573  // Write data to an vfslog-file.
 69574  func vfslogWrite(tls *libc.TLS, pFile uintptr, z uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_osinst.c:292:12: */
 69575  	var rc int32
 69576  	var t sqlite3_uint64
 69577  	var p uintptr = pFile
 69578  	t = vfslog_time(tls)
 69579  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 24 /* &.xWrite */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, z, iAmt, iOfst)
 69580  	t = (vfslog_time(tls) - t)
 69581  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_WRITE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, iAmt, int32(iOfst))
 69582  	return rc
 69583  }
 69584  
 69585  // Truncate an vfslog-file.
 69586  func vfslogTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_osinst.c:311:12: */
 69587  	var rc int32
 69588  	var t sqlite3_uint64
 69589  	var p uintptr = pFile
 69590  	t = vfslog_time(tls)
 69591  	rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 32 /* &.xTruncate */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, size)
 69592  	t = (vfslog_time(tls) - t)
 69593  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_TRUNCATE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, int32(size))
 69594  	return rc
 69595  }
 69596  
 69597  // Sync an vfslog-file.
 69598  func vfslogSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_osinst.c:325:12: */
 69599  	var rc int32
 69600  	var t sqlite3_uint64
 69601  	var p uintptr = pFile
 69602  	t = vfslog_time(tls)
 69603  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 40 /* &.xSync */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, flags)
 69604  	t = (vfslog_time(tls) - t)
 69605  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SYNC, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, flags, 0)
 69606  	return rc
 69607  }
 69608  
 69609  // Return the current file-size of an vfslog-file.
 69610  func vfslogFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_osinst.c:339:12: */
 69611  	var rc int32
 69612  	var t sqlite3_uint64
 69613  	var p uintptr = pFile
 69614  	t = vfslog_time(tls)
 69615  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 48 /* &.xFileSize */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, pSize)
 69616  	t = (vfslog_time(tls) - t)
 69617  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_FILESIZE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, int32(*(*sqlite_int64)(unsafe.Pointer(pSize))))
 69618  	return rc
 69619  }
 69620  
 69621  // Lock an vfslog-file.
 69622  func vfslogLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_osinst.c:353:12: */
 69623  	var rc int32
 69624  	var t sqlite3_uint64
 69625  	var p uintptr = pFile
 69626  	t = vfslog_time(tls)
 69627  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 56 /* &.xLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, eLock)
 69628  	t = (vfslog_time(tls) - t)
 69629  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_LOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, eLock, 0)
 69630  	return rc
 69631  }
 69632  
 69633  // Unlock an vfslog-file.
 69634  func vfslogUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_osinst.c:367:12: */
 69635  	var rc int32
 69636  	var t sqlite3_uint64
 69637  	var p uintptr = pFile
 69638  	t = vfslog_time(tls)
 69639  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 64 /* &.xUnlock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, eLock)
 69640  	t = (vfslog_time(tls) - t)
 69641  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_UNLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, eLock, 0)
 69642  	return rc
 69643  }
 69644  
 69645  // Check if another file-handle holds a RESERVED lock on an vfslog-file.
 69646  func vfslogCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_osinst.c:381:12: */
 69647  	var rc int32
 69648  	var t sqlite3_uint64
 69649  	var p uintptr = pFile
 69650  	t = vfslog_time(tls)
 69651  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, pResOut)
 69652  	t = (vfslog_time(tls) - t)
 69653  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_CHECKRESERVEDLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, *(*int32)(unsafe.Pointer(pResOut)), 0)
 69654  	return rc
 69655  }
 69656  
 69657  // File control method. For custom operations on an vfslog-file.
 69658  func vfslogFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_osinst.c:395:12: */
 69659  	bp := tls.Alloc(8)
 69660  	defer tls.Free(8)
 69661  
 69662  	var p uintptr = pFile
 69663  	var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 80 /* &.xFileControl */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, op, pArg)
 69664  	if (op == SQLITE_FCNTL_VFSNAME) && (rc == SQLITE_OK) {
 69665  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+35654 /* "vfslog/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 69666  	}
 69667  	return rc
 69668  }
 69669  
 69670  // Return the sector-size in bytes for an vfslog-file.
 69671  func vfslogSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:407:12: */
 69672  	var rc int32
 69673  	var t sqlite3_uint64
 69674  	var p uintptr = pFile
 69675  	t = vfslog_time(tls)
 69676  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 88 /* &.xSectorSize */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 69677  	t = (vfslog_time(tls) - t)
 69678  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SECTORSIZE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69679  	return rc
 69680  }
 69681  
 69682  // Return the device characteristic flags supported by an vfslog-file.
 69683  func vfslogDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:421:12: */
 69684  	var rc int32
 69685  	var t sqlite3_uint64
 69686  	var p uintptr = pFile
 69687  	t = vfslog_time(tls)
 69688  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 69689  	t = (vfslog_time(tls) - t)
 69690  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_DEVCHAR, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69691  	return rc
 69692  }
 69693  
 69694  func vfslogShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_osinst.c:432:12: */
 69695  	var rc int32
 69696  	var t sqlite3_uint64
 69697  	var p uintptr = pFile
 69698  	t = vfslog_time(tls)
 69699  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 112 /* &.xShmLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, ofst, n, flags)
 69700  	t = (vfslog_time(tls) - t)
 69701  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69702  	return rc
 69703  }
 69704  
 69705  func vfslogShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, isWrite int32, pp uintptr) int32 { /* test_osinst.c:442:12: */
 69706  	var rc int32
 69707  	var t sqlite3_uint64
 69708  	var p uintptr = pFile
 69709  	t = vfslog_time(tls)
 69710  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 104 /* &.xShmMap */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, libc.AtomicLoadUintptr(&pp))
 69711  	t = (vfslog_time(tls) - t)
 69712  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMMAP, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69713  	return rc
 69714  }
 69715  
 69716  func vfslogShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_osinst.c:458:13: */
 69717  	var t sqlite3_uint64
 69718  	var p uintptr = pFile
 69719  	t = vfslog_time(tls)
 69720  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 120 /* &.xShmBarrier */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 69721  	t = (vfslog_time(tls) - t)
 69722  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMBARRIER, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), SQLITE_OK, 0, 0)
 69723  }
 69724  
 69725  func vfslogShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* test_osinst.c:466:12: */
 69726  	var rc int32
 69727  	var t sqlite3_uint64
 69728  	var p uintptr = pFile
 69729  	t = vfslog_time(tls)
 69730  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, deleteFlag)
 69731  	t = (vfslog_time(tls) - t)
 69732  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMUNMAP, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69733  	return rc
 69734  }
 69735  
 69736  // Open an vfslog file handle.
 69737  func vfslogOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_osinst.c:481:12: */
 69738  	var rc int32
 69739  	var t sqlite3_uint64
 69740  	var p uintptr = pFile
 69741  	var pLog uintptr = pVfs
 69742  
 69743  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&vfslog_io_methods))
 69744  	(*VfslogFile)(unsafe.Pointer(p)).FpReal = (p + 1*32)
 69745  	(*VfslogFile)(unsafe.Pointer(p)).FpVfslog = pVfs
 69746  	(*VfslogFile)(unsafe.Pointer(p)).FiFileId = libc.PreIncInt32(&(*VfslogVfs)(unsafe.Pointer(pLog)).FiNextFileId, 1)
 69747  
 69748  	t = vfslog_time(tls)
 69749  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 40 /* &.xOpen */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zName, (*VfslogFile)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 69750  	t = (vfslog_time(tls) - t)
 69751  
 69752  	vfslog_call(tls, pVfs, OS_OPEN, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 69753  	vfslog_string(tls, pVfs, zName)
 69754  	return rc
 69755  }
 69756  
 69757  // Delete the file located at zPath. If the dirSync argument is true,
 69758  // ensure the file-system modifications are synced to disk before
 69759  // returning.
 69760  func vfslogDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_osinst.c:512:12: */
 69761  	var rc int32
 69762  	var t sqlite3_uint64
 69763  	t = vfslog_time(tls)
 69764  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 48 /* &.xDelete */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, dirSync)
 69765  	t = (vfslog_time(tls) - t)
 69766  	vfslog_call(tls, pVfs, OS_DELETE, 0, int64(t), rc, dirSync, 0)
 69767  	vfslog_string(tls, pVfs, zPath)
 69768  	return rc
 69769  }
 69770  
 69771  // Test for access permissions. Return true if the requested permission
 69772  // is available, or false otherwise.
 69773  func vfslogAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_osinst.c:527:12: */
 69774  	var rc int32
 69775  	var t sqlite3_uint64
 69776  	t = vfslog_time(tls)
 69777  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 56 /* &.xAccess */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, flags, pResOut)
 69778  	t = (vfslog_time(tls) - t)
 69779  	vfslog_call(tls, pVfs, OS_ACCESS, 0, int64(t), rc, flags, *(*int32)(unsafe.Pointer(pResOut)))
 69780  	vfslog_string(tls, pVfs, zPath)
 69781  	return rc
 69782  }
 69783  
 69784  // Populate buffer zOut with the full canonical pathname corresponding
 69785  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 69786  // of at least (INST_MAX_PATHNAME+1) bytes.
 69787  func vfslogFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_osinst.c:548:12: */
 69788  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 64 /* &.xFullPathname */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, nOut, zOut)
 69789  }
 69790  
 69791  // Open the dynamic library located at zPath and return a handle.
 69792  func vfslogDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_osinst.c:560:13: */
 69793  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 72 /* &.xDlOpen */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath)
 69794  }
 69795  
 69796  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 69797  // utf-8 string describing the most recent error encountered associated
 69798  // with dynamic libraries.
 69799  func vfslogDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_osinst.c:569:13: */
 69800  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 80 /* &.xDlError */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nByte, zErrMsg)
 69801  }
 69802  
 69803  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 69804  func vfslogDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* test_osinst.c:576:13: */
 69805  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 88 /* &.xDlSym */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, p, zSym)
 69806  }
 69807  
 69808  // Close the dynamic library handle pHandle.
 69809  func vfslogDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_osinst.c:583:13: */
 69810  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 96 /* &.xDlClose */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, pHandle)
 69811  }
 69812  
 69813  // Populate the buffer pointed to by zBufOut with nByte bytes of
 69814  // random data.
 69815  func vfslogRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_osinst.c:591:12: */
 69816  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 104 /* &.xRandomness */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nByte, zBufOut)
 69817  }
 69818  
 69819  // Sleep for nMicro microseconds. Return the number of microseconds
 69820  // actually slept.
 69821  func vfslogSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_osinst.c:599:12: */
 69822  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 112 /* &.xSleep */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nMicro)
 69823  }
 69824  
 69825  // Return the current time as a Julian Day number in *pTimeOut.
 69826  func vfslogCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_osinst.c:606:12: */
 69827  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 120 /* &.xCurrentTime */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, pTimeOut)
 69828  }
 69829  
 69830  func vfslogGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* test_osinst.c:610:12: */
 69831  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 128 /* &.xGetLastError */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, a, b)
 69832  }
 69833  
 69834  func vfslogCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* test_osinst.c:613:12: */
 69835  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 136 /* &.xCurrentTimeInt64 */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, p)
 69836  }
 69837  
 69838  func vfslog_flush(tls *libc.TLS, p uintptr) { /* test_osinst.c:617:13: */
 69839  
 69840  	var pending int32 = libc.AtomicLoadInt32(&sqlite3.Xsqlite3_io_error_pending)
 69841  	var persist int32 = sqlite3.Xsqlite3_io_error_persist
 69842  	var diskfull int32 = sqlite3.Xsqlite3_diskfull_pending
 69843  
 69844  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(0))
 69845  	sqlite3.Xsqlite3_io_error_persist = 0
 69846  	sqlite3.Xsqlite3_diskfull_pending = 0
 69847  
 69848  	if (*VfslogVfs)(unsafe.Pointer(p)).FnBuf != 0 {
 69849  		(*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods + 24 /* &.xWrite */))))(tls, (*VfslogVfs)(unsafe.Pointer(p)).FpLog, p+204 /* &.aBuf */, (*VfslogVfs)(unsafe.Pointer(p)).FnBuf, (*VfslogVfs)(unsafe.Pointer(p)).FiOffset)
 69850  		*(*sqlite3_int64)(unsafe.Pointer(p + 192 /* &.iOffset */)) += (sqlite3_int64((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 69851  		(*VfslogVfs)(unsafe.Pointer(p)).FnBuf = 0
 69852  	}
 69853  
 69854  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(pending))
 69855  	sqlite3.Xsqlite3_io_error_persist = persist
 69856  	sqlite3.Xsqlite3_diskfull_pending = diskfull
 69857  }
 69858  
 69859  func put32bits(tls *libc.TLS, p uintptr, v uint32) { /* test_osinst.c:645:13: */
 69860  	*(*uint8)(unsafe.Pointer(p)) = (uint8(v >> 24))
 69861  	*(*uint8)(unsafe.Pointer(p + 1)) = (uint8(v >> 16))
 69862  	*(*uint8)(unsafe.Pointer(p + 2)) = (uint8(v >> 8))
 69863  	*(*uint8)(unsafe.Pointer(p + 3)) = uint8(v)
 69864  }
 69865  
 69866  func vfslog_call(tls *libc.TLS, pVfs uintptr, eEvent int32, iFileid int32, nClick sqlite3_int64, return_code int32, size int32, offset int32) { /* test_osinst.c:652:13: */
 69867  	var p uintptr = pVfs
 69868  	var zRec uintptr
 69869  	if (uint64(24 + (*VfslogVfs)(unsafe.Pointer(p)).FnBuf)) > uint64(unsafe.Sizeof([8192]int8{})) {
 69870  		vfslog_flush(tls, p)
 69871  	}
 69872  	zRec = ((p + 204 /* &.aBuf */) + uintptr((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 69873  	put32bits(tls, (zRec), uint32(eEvent))
 69874  	put32bits(tls, (zRec + 4), uint32(iFileid))
 69875  	put32bits(tls, (zRec + 8), (uint32(nClick & int64(0xffff))))
 69876  	put32bits(tls, (zRec + 12), uint32(return_code))
 69877  	put32bits(tls, (zRec + 16), uint32(size))
 69878  	put32bits(tls, (zRec + 20), uint32(offset))
 69879  	*(*int32)(unsafe.Pointer(p + 200 /* &.nBuf */)) += (24)
 69880  }
 69881  
 69882  func vfslog_string(tls *libc.TLS, pVfs uintptr, zStr uintptr) { /* test_osinst.c:676:13: */
 69883  	var p uintptr = pVfs
 69884  	var zRec uintptr
 69885  	var nStr int32
 69886  	if zStr != 0 {
 69887  		nStr = int32(libc.Xstrlen(tls, zStr))
 69888  	} else {
 69889  		nStr = 0
 69890  	}
 69891  	if (uint64((4 + nStr) + (*VfslogVfs)(unsafe.Pointer(p)).FnBuf)) > uint64(unsafe.Sizeof([8192]int8{})) {
 69892  		vfslog_flush(tls, p)
 69893  	}
 69894  	zRec = ((p + 204 /* &.aBuf */) + uintptr((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 69895  	put32bits(tls, (zRec), uint32(nStr))
 69896  	if zStr != 0 {
 69897  		libc.Xmemcpy(tls, (zRec + 4), zStr, uint64(nStr))
 69898  	}
 69899  	*(*int32)(unsafe.Pointer(p + 200 /* &.nBuf */)) += (4 + nStr)
 69900  }
 69901  
 69902  func vfslog_finalize(tls *libc.TLS, p uintptr) { /* test_osinst.c:691:13: */
 69903  	if (*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods != 0 {
 69904  		vfslog_flush(tls, p)
 69905  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods + 8 /* &.xClose */))))(tls, (*VfslogVfs)(unsafe.Pointer(p)).FpLog)
 69906  	}
 69907  	sqlite3.Xsqlite3_free(tls, p)
 69908  }
 69909  
 69910  func sqlite3_vfslog_finalize(tls *libc.TLS, zVfs uintptr) int32 { /* test_osinst.c:699:5: */
 69911  	var pVfs uintptr
 69912  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, zVfs)
 69913  	if !(pVfs != 0) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != *(*uintptr)(unsafe.Pointer(&struct {
 69914  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 69915  	}{vfslogOpen}))) {
 69916  		return SQLITE_ERROR
 69917  	}
 69918  	sqlite3.Xsqlite3_vfs_unregister(tls, pVfs)
 69919  	vfslog_finalize(tls, pVfs)
 69920  	return SQLITE_OK
 69921  }
 69922  
 69923  func sqlite3_vfslog_new(tls *libc.TLS, zVfs uintptr, zParentVfs uintptr, zLog uintptr) int32 { /* test_osinst.c:710:5: */
 69924  	bp := tls.Alloc(4)
 69925  	defer tls.Free(4)
 69926  
 69927  	var p uintptr
 69928  	var pParent uintptr
 69929  	var nByte int32
 69930  	// var flags int32 at bp, 4
 69931  
 69932  	var rc int32
 69933  	var zFile uintptr
 69934  	var nVfs int32
 69935  
 69936  	pParent = sqlite3.Xsqlite3_vfs_find(tls, zParentVfs)
 69937  	if !(pParent != 0) {
 69938  		return SQLITE_ERROR
 69939  	}
 69940  
 69941  	nVfs = int32(libc.Xstrlen(tls, zVfs))
 69942  	nByte = (int32(((((uint64(unsafe.Sizeof(VfslogVfs{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)) + uint64(nVfs)) + uint64(1)) + uint64((*sqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname)) + uint64(1)))
 69943  	p = sqlite3.Xsqlite3_malloc(tls, nByte)
 69944  	libc.Xmemset(tls, p, 0, uint64(nByte))
 69945  
 69946  	(*VfslogVfs)(unsafe.Pointer(p)).FpVfs = pParent
 69947  	(*VfslogVfs)(unsafe.Pointer(p)).FpLog = (p + 1*8400)
 69948  	libc.Xmemcpy(tls, (p /* &.base */), uintptr(unsafe.Pointer(&vfslog_vfs)), uint64(unsafe.Sizeof(sqlite3_vfs{})))
 69949  	(*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName = (((*VfslogVfs)(unsafe.Pointer(p)).FpLog) + uintptr((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile))
 69950  	*(*int32)(unsafe.Pointer(p /* &.base */ + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)
 69951  	libc.Xmemcpy(tls, (*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName, zVfs, uint64(nVfs))
 69952  
 69953  	zFile = ((*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName + uintptr((nVfs + 1)))
 69954  	(*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 64 /* &.xFullPathname */))))(tls, pParent, zLog, (*sqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname, zFile)
 69955  
 69956  	*(*int32)(unsafe.Pointer(bp /* flags */)) = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_SUPER_JOURNAL)
 69957  	(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pParent + 48 /* &.xDelete */))))(tls, pParent, zFile, 0)
 69958  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 40 /* &.xOpen */))))(tls, pParent, zFile, (*VfslogVfs)(unsafe.Pointer(p)).FpLog, *(*int32)(unsafe.Pointer(bp /* flags */)), bp /* &flags */)
 69959  	if rc == SQLITE_OK {
 69960  		libc.Xmemcpy(tls, p+204 /* &.aBuf */, ts+35664 /* "sqlite_ostrace1...." */, uint64(20))
 69961  		(*VfslogVfs)(unsafe.Pointer(p)).FiOffset = int64(0)
 69962  		(*VfslogVfs)(unsafe.Pointer(p)).FnBuf = 20
 69963  		rc = sqlite3.Xsqlite3_vfs_register(tls, p, 1)
 69964  	}
 69965  	if rc != 0 {
 69966  		vfslog_finalize(tls, p)
 69967  	}
 69968  	return rc
 69969  }
 69970  
 69971  func sqlite3_vfslog_annotate(tls *libc.TLS, zVfs uintptr, zMsg uintptr) int32 { /* test_osinst.c:758:5: */
 69972  	var pVfs uintptr
 69973  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, zVfs)
 69974  	if !(pVfs != 0) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != *(*uintptr)(unsafe.Pointer(&struct {
 69975  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 69976  	}{vfslogOpen}))) {
 69977  		return SQLITE_ERROR
 69978  	}
 69979  	vfslog_call(tls, pVfs, OS_ANNOTATE, 0, int64(0), 0, 0, 0)
 69980  	vfslog_string(tls, pVfs, zMsg)
 69981  	return SQLITE_OK
 69982  }
 69983  
 69984  func vfslog_eventname(tls *libc.TLS, eEvent int32) uintptr { /* test_osinst.c:769:19: */
 69985  	var zEvent uintptr = uintptr(0)
 69986  
 69987  	switch eEvent {
 69988  	case OS_CLOSE:
 69989  		zEvent = ts + 35685 /* "xClose" */
 69990  		break
 69991  	case OS_READ:
 69992  		zEvent = ts + 35692 /* "xRead" */
 69993  		break
 69994  	case OS_WRITE:
 69995  		zEvent = ts + 35698 /* "xWrite" */
 69996  		break
 69997  	case OS_TRUNCATE:
 69998  		zEvent = ts + 35705 /* "xTruncate" */
 69999  		break
 70000  	case OS_SYNC:
 70001  		zEvent = ts + 28129 /* "xSync" */
 70002  		break
 70003  	case OS_FILESIZE:
 70004  		zEvent = ts + 35715 /* "xFilesize" */
 70005  		break
 70006  	case OS_LOCK:
 70007  		zEvent = ts + 35725 /* "xLock" */
 70008  		break
 70009  	case OS_UNLOCK:
 70010  		zEvent = ts + 35731 /* "xUnlock" */
 70011  		break
 70012  	case OS_CHECKRESERVEDLOCK:
 70013  		zEvent = ts + 35739 /* "xCheckResLock" */
 70014  		break
 70015  	case OS_FILECONTROL:
 70016  		zEvent = ts + 35753 /* "xFileControl" */
 70017  		break
 70018  	case OS_SECTORSIZE:
 70019  		zEvent = ts + 35766 /* "xSectorSize" */
 70020  		break
 70021  	case OS_DEVCHAR:
 70022  		zEvent = ts + 35778 /* "xDeviceChar" */
 70023  		break
 70024  	case OS_OPEN:
 70025  		zEvent = ts + 27701 /* "xOpen" */
 70026  		break
 70027  	case OS_DELETE:
 70028  		zEvent = ts + 35790 /* "xDelete" */
 70029  		break
 70030  	case OS_ACCESS:
 70031  		zEvent = ts + 35798 /* "xAccess" */
 70032  		break
 70033  	case OS_FULLPATHNAME:
 70034  		zEvent = ts + 35806 /* "xFullPathname" */
 70035  		break
 70036  	case OS_RANDOMNESS:
 70037  		zEvent = ts + 35820 /* "xRandomness" */
 70038  		break
 70039  	case OS_SLEEP:
 70040  		zEvent = ts + 35832 /* "xSleep" */
 70041  		break
 70042  	case OS_CURRENTTIME:
 70043  		zEvent = ts + 35839 /* "xCurrentTime" */
 70044  		break
 70045  
 70046  	case OS_SHMUNMAP:
 70047  		zEvent = ts + 35852 /* "xShmUnmap" */
 70048  		break
 70049  	case OS_SHMLOCK:
 70050  		zEvent = ts + 35862 /* "xShmLock" */
 70051  		break
 70052  	case OS_SHMBARRIER:
 70053  		zEvent = ts + 35871 /* "xShmBarrier" */
 70054  		break
 70055  	case OS_SHMMAP:
 70056  		zEvent = ts + 35883 /* "xShmMap" */
 70057  		break
 70058  
 70059  	case OS_ANNOTATE:
 70060  		zEvent = ts + 35891 /* "annotation" */
 70061  		break
 70062  	}
 70063  
 70064  	return zEvent
 70065  }
 70066  
 70067  type VfslogVtab1 = struct {
 70068  	Fbase  sqlite3_vtab
 70069  	FpFd   uintptr
 70070  	FnByte sqlite3_int64
 70071  	FzFile uintptr
 70072  } /* test_osinst.c:804:9 */
 70073  
 70074  type VfslogVtab = VfslogVtab1 /* test_osinst.c:804:27 */
 70075  type VfslogCsr1 = struct {
 70076  	Fbase       sqlite3_vtab_cursor
 70077  	FiRowid     sqlite3_int64
 70078  	FiOffset    sqlite3_int64
 70079  	FzTransient uintptr
 70080  	FnFile      int32
 70081  	_           [4]byte
 70082  	FazFile     uintptr
 70083  	FaBuf       [1024]uint8
 70084  } /* test_osinst.c:805:9 */
 70085  
 70086  type VfslogCsr = VfslogCsr1 /* test_osinst.c:805:26 */
 70087  
 70088  func get32bits(tls *libc.TLS, p uintptr) uint32 { /* test_osinst.c:830:21: */
 70089  	return (uint32((((int32(*(*uint8)(unsafe.Pointer(p))) << 24) + (int32(*(*uint8)(unsafe.Pointer(p + 1))) << 16)) + (int32(*(*uint8)(unsafe.Pointer(p + 2))) << 8)) + int32(*(*uint8)(unsafe.Pointer(p + 3)))))
 70090  }
 70091  
 70092  // The argument must point to a buffer containing a nul-terminated string.
 70093  // If the string begins with an SQL quote character it is overwritten by
 70094  // the dequoted version. Otherwise the buffer is left unmodified.
 70095  func dequote(tls *libc.TLS, z uintptr) { /* test_osinst.c:839:13: */
 70096  	var quote int8 // Quote character (if any )
 70097  	quote = *(*int8)(unsafe.Pointer(z))
 70098  	if (((int32(quote) == '[') || (int32(quote) == '\'')) || (int32(quote) == '"')) || (int32(quote) == '`') {
 70099  		var iIn int32 = 1  // Index of next byte to read from input
 70100  		var iOut int32 = 0 // Index of next byte to write to output
 70101  		if int32(quote) == '[' {
 70102  			quote = int8(']')
 70103  		}
 70104  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 70105  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(quote) {
 70106  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(quote) {
 70107  					break
 70108  				}
 70109  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = quote
 70110  				iIn = iIn + (2)
 70111  			} else {
 70112  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 70113  			}
 70114  		}
 70115  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 70116  	}
 70117  }
 70118  
 70119  // Connect to or create a vfslog virtual table.
 70120  func vlogConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_osinst.c:863:12: */
 70121  	bp := tls.Alloc(12)
 70122  	defer tls.Free(12)
 70123  
 70124  	var pVfs uintptr // VFS used to read log file
 70125  	// var flags int32 at bp+8, 4
 70126  	// flags passed to pVfs->xOpen()
 70127  	var p uintptr
 70128  	var rc int32
 70129  	var nByte int32
 70130  	var zFile uintptr
 70131  
 70132  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 70133  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 70134  	nByte = (int32((uint64(unsafe.Sizeof(VfslogVtab{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)) + uint64((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname)))
 70135  	p = sqlite3.Xsqlite3_malloc(tls, nByte)
 70136  	if p == uintptr(0) {
 70137  		return SQLITE_NOMEM
 70138  	}
 70139  	libc.Xmemset(tls, p, 0, uint64(nByte))
 70140  
 70141  	(*VfslogVtab)(unsafe.Pointer(p)).FpFd = (p + 1*48)
 70142  	(*VfslogVtab)(unsafe.Pointer(p)).FzFile = (((*VfslogVtab)(unsafe.Pointer(p)).FpFd) + uintptr((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile))
 70143  
 70144  	zFile = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 3*8))))
 70145  	if !(zFile != 0) {
 70146  		sqlite3.Xsqlite3_free(tls, p)
 70147  		return SQLITE_NOMEM
 70148  	}
 70149  	dequote(tls, zFile)
 70150  	(*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 64 /* &.xFullPathname */))))(tls, pVfs, zFile, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname, (*VfslogVtab)(unsafe.Pointer(p)).FzFile)
 70151  	sqlite3.Xsqlite3_free(tls, zFile)
 70152  
 70153  	*(*int32)(unsafe.Pointer(bp + 8 /* flags */)) = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_SUPER_JOURNAL)
 70154  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 40 /* &.xOpen */))))(tls, pVfs, (*VfslogVtab)(unsafe.Pointer(p)).FzFile, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, *(*int32)(unsafe.Pointer(bp + 8 /* flags */)), bp+8 /* &flags */)
 70155  
 70156  	if rc == SQLITE_OK {
 70157  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 48 /* &.xFileSize */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, (p + 32 /* &.nByte */))
 70158  		sqlite3.Xsqlite3_declare_vtab(tls, db,
 70159  			ts+35902 /* "CREATE TABLE xxx..." */)
 70160  		*(*uintptr)(unsafe.Pointer(ppVtab)) = (p /* &.base */)
 70161  	} else {
 70162  		sqlite3.Xsqlite3_free(tls, p)
 70163  	}
 70164  
 70165  	return rc
 70166  }
 70167  
 70168  // There is no "best-index". This virtual table always does a linear
 70169  // scan of the binary VFS log file.
 70170  func vlogBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_osinst.c:916:12: */
 70171  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 70172  	return SQLITE_OK
 70173  }
 70174  
 70175  // Disconnect from or destroy a vfslog virtual table.
 70176  func vlogDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_osinst.c:924:12: */
 70177  	var p uintptr = pVtab
 70178  	if (*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods != 0 {
 70179  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 8 /* &.xClose */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd)
 70180  		(*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods = uintptr(0)
 70181  	}
 70182  	sqlite3.Xsqlite3_free(tls, p)
 70183  	return SQLITE_OK
 70184  }
 70185  
 70186  // Open a new vfslog cursor.
 70187  func vlogOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_osinst.c:937:12: */
 70188  	var pCsr uintptr // Newly allocated cursor object
 70189  
 70190  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(VfslogCsr{})))
 70191  	if !(pCsr != 0) {
 70192  		return SQLITE_NOMEM
 70193  	}
 70194  	libc.Xmemset(tls, pCsr, 0, uint64(unsafe.Sizeof(VfslogCsr{})))
 70195  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCsr /* &.base */)
 70196  	return SQLITE_OK
 70197  }
 70198  
 70199  // Close a vfslog cursor.
 70200  func vlogClose(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:950:12: */
 70201  	var p uintptr = pCursor
 70202  	var i int32
 70203  	for i = 0; i < (*VfslogCsr)(unsafe.Pointer(p)).FnFile; i++ {
 70204  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(p)).FazFile + uintptr(i)*8)))
 70205  	}
 70206  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(p)).FazFile)
 70207  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(p)).FzTransient)
 70208  	sqlite3.Xsqlite3_free(tls, p)
 70209  	return SQLITE_OK
 70210  }
 70211  
 70212  // Move a vfslog cursor to the next entry in the file.
 70213  func vlogNext(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:965:12: */
 70214  	bp := tls.Alloc(4)
 70215  	defer tls.Free(4)
 70216  
 70217  	var pCsr uintptr = pCursor
 70218  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 70219  	var rc int32 = SQLITE_OK
 70220  	var nRead int32
 70221  
 70222  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient)
 70223  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient = uintptr(0)
 70224  
 70225  	nRead = 24
 70226  	if ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)) <= (*VfslogVtab)(unsafe.Pointer(p)).FnByte {
 70227  		var eEvent int32
 70228  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 16 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, pCsr+48 /* &.aBuf */, nRead, (*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset)
 70229  
 70230  		eEvent = int32(get32bits(tls, pCsr+48 /* &.aBuf */))
 70231  		if (rc == SQLITE_OK) &&
 70232  			(((eEvent == OS_OPEN) || (eEvent == OS_DELETE)) || (eEvent == OS_ACCESS)) {
 70233  			// var buf [4]int8 at bp, 4
 70234  
 70235  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 16 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, bp /* &buf[0] */, 4, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)))
 70236  			nRead = nRead + (4)
 70237  			if rc == SQLITE_OK {
 70238  				var nStr int32 = int32(get32bits(tls, bp /* buf */))
 70239  				var zStr uintptr = sqlite3.Xsqlite3_malloc(tls, (nStr + 1))
 70240  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 16 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, zStr, nStr, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)))
 70241  				*(*int8)(unsafe.Pointer(zStr + uintptr(nStr))) = int8(0)
 70242  				nRead = nRead + (nStr)
 70243  
 70244  				if eEvent == OS_OPEN {
 70245  					var iFileid int32 = int32(get32bits(tls, ((pCsr + 48 /* &.aBuf */) + 4)))
 70246  					if iFileid >= (*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile {
 70247  						var nNew int32 = (int32(uint64(unsafe.Sizeof(uintptr(0))) * (uint64(iFileid + 1))))
 70248  						(*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile = sqlite3.Xsqlite3_realloc(tls, (*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile, nNew)
 70249  						nNew = int32(uint64(nNew) - (uint64(unsafe.Sizeof(uintptr(0))) * uint64((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)))
 70250  						libc.Xmemset(tls, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)*8), 0, uint64(nNew))
 70251  						(*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile = (iFileid + 1)
 70252  					}
 70253  					sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(iFileid)*8)))
 70254  					*(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(iFileid)*8)) = zStr
 70255  				} else {
 70256  					(*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient = zStr
 70257  				}
 70258  			}
 70259  		}
 70260  	}
 70261  
 70262  	*(*sqlite3_int64)(unsafe.Pointer(pCsr + 8 /* &.iRowid */)) += (int64(1))
 70263  	*(*sqlite3_int64)(unsafe.Pointer(pCsr + 16 /* &.iOffset */)) += (sqlite3_int64(nRead))
 70264  	return rc
 70265  }
 70266  
 70267  func vlogEof(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:1016:12: */
 70268  	var pCsr uintptr = pCursor
 70269  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 70270  	return (libc.Bool32((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset >= (*VfslogVtab)(unsafe.Pointer(p)).FnByte))
 70271  }
 70272  
 70273  func vlogFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_osinst.c:1022:12: */
 70274  	var pCsr uintptr = pCursor
 70275  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FiRowid = int64(0)
 70276  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset = int64(20)
 70277  	return vlogNext(tls, pCursor)
 70278  }
 70279  
 70280  func vlogColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) int32 { /* test_osinst.c:1033:12: */
 70281  	var val uint32
 70282  	var pCsr uintptr = pCursor
 70283  
 70284  	val = get32bits(tls, ((pCsr + 48 /* &.aBuf */) + uintptr((4 * i))))
 70285  
 70286  	switch i {
 70287  	case 0:
 70288  		{
 70289  			sqlite3.Xsqlite3_result_text(tls, ctx, vfslog_eventname(tls, int32(val)), -1, uintptr(0))
 70290  			break
 70291  
 70292  		}
 70293  	case 1:
 70294  		{
 70295  			var zStr uintptr = (*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient
 70296  			if (val != uint32(0)) && (val < uint32((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)) {
 70297  				zStr = *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(val)*8))
 70298  			}
 70299  			sqlite3.Xsqlite3_result_text(tls, ctx, zStr, -1, libc.UintptrFromInt32(-1))
 70300  			break
 70301  
 70302  		}
 70303  	default:
 70304  		sqlite3.Xsqlite3_result_int(tls, ctx, int32(val))
 70305  		break
 70306  	}
 70307  
 70308  	return SQLITE_OK
 70309  }
 70310  
 70311  func vlogRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* test_osinst.c:1065:12: */
 70312  	var pCsr uintptr = pCursor
 70313  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*VfslogCsr)(unsafe.Pointer(pCsr)).FiRowid
 70314  	return SQLITE_OK
 70315  }
 70316  
 70317  func sqlite3_vfslog_register(tls *libc.TLS, db uintptr) int32 { /* test_osinst.c:1071:5: */
 70318  
 70319  	sqlite3.Xsqlite3_create_module(tls, db, ts+35957 /* "vfslog" */, uintptr(unsafe.Pointer(&vfslog_module)), uintptr(0))
 70320  	return SQLITE_OK
 70321  }
 70322  
 70323  var vfslog_module = sqlite3_module{ // iVersion
 70324  	FxCreate:     0, // xCreate
 70325  	FxConnect:    0, // xConnect
 70326  	FxBestIndex:  0, // xBestIndex
 70327  	FxDisconnect: 0, // xDisconnect
 70328  	FxDestroy:    0, // xDestroy
 70329  	FxOpen:       0, // xOpen - open a cursor
 70330  	FxClose:      0, // xClose - close a cursor
 70331  	FxFilter:     0, // xFilter - configure scan constraints
 70332  	FxNext:       0, // xNext - advance a cursor
 70333  	FxEof:        0, // xEof - check for end of scan
 70334  	FxColumn:     0, // xColumn - read data
 70335  	FxRowid:      0, // xRename
 70336  } /* test_osinst.c:1072:25 */
 70337  
 70338  // end block for C++
 70339  
 70340  // Local Variables:
 70341  // mode: c
 70342  // c-basic-offset: 4
 70343  // fill-column: 78
 70344  // End:
 70345  
 70346  func test_vfslog(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_osinst.c:1116:26: */
 70347  	bp := tls.Alloc(144)
 70348  	defer tls.Free(144)
 70349  
 70350  	var db uintptr
 70351  	// var cmdInfo Tcl_CmdInfo at bp+80, 64
 70352  
 70353  	var rc int32 = SQLITE_ERROR
 70354  	// var iSub int32 at bp+72, 4
 70355  
 70356  	if objc < 2 {
 70357  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 70358  		return TCL_ERROR
 70359  	}
 70360  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), uintptr(unsafe.Pointer(&strs)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp+72 /* &iSub */) != 0 {
 70361  		return TCL_ERROR
 70362  	}
 70363  
 70364  	switch uint32(*(*int32)(unsafe.Pointer(bp + 72 /* iSub */))) {
 70365  	case uint32(0) /* VL_ANNOTATE */ :
 70366  		{
 70367  			var zVfs uintptr
 70368  			var zMsg uintptr
 70369  			if objc != 4 {
 70370  				tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+35964 /* "VFS" */)
 70371  				return TCL_ERROR
 70372  			}
 70373  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 70374  			zMsg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 70375  			rc = sqlite3_vfslog_annotate(tls, zVfs, zMsg)
 70376  			if rc != SQLITE_OK {
 70377  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35968 /* "failed" */, 0))
 70378  				return TCL_ERROR
 70379  			}
 70380  			break
 70381  
 70382  		}
 70383  	case uint32(1) /* VL_FINALIZE */ :
 70384  		{
 70385  			var zVfs uintptr
 70386  			if objc != 3 {
 70387  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+35964 /* "VFS" */)
 70388  				return TCL_ERROR
 70389  			}
 70390  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 70391  			rc = sqlite3_vfslog_finalize(tls, zVfs)
 70392  			if rc != SQLITE_OK {
 70393  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+35968 /* "failed" */, 0))
 70394  				return TCL_ERROR
 70395  			}
 70396  			break
 70397  
 70398  		}
 70399  
 70400  	case uint32(2) /* VL_NEW */ :
 70401  		{
 70402  			var zVfs uintptr
 70403  			var zParent uintptr
 70404  			var zLog uintptr
 70405  			if objc != 5 {
 70406  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+35975 /* "VFS PARENT LOGFI..." */)
 70407  				return TCL_ERROR
 70408  			}
 70409  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 70410  			zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 70411  			zLog = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 70412  			if int32(*(*int8)(unsafe.Pointer(zParent))) == 0 {
 70413  				zParent = uintptr(0)
 70414  			}
 70415  			rc = sqlite3_vfslog_new(tls, zVfs, zParent, zLog)
 70416  			if rc != SQLITE_OK {
 70417  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+35968 /* "failed" */, 0))
 70418  				return TCL_ERROR
 70419  			}
 70420  			break
 70421  
 70422  		}
 70423  
 70424  	case uint32(3) /* VL_REGISTER */ :
 70425  		{
 70426  			var zDb uintptr
 70427  			if objc != 3 {
 70428  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+1911 /* "DB" */)
 70429  				return TCL_ERROR
 70430  			}
 70431  			zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 70432  			if tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+80 /* &cmdInfo */) != 0 {
 70433  				db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 80 /* &cmdInfo */)).FobjClientData)).Fdb
 70434  				rc = sqlite3_vfslog_register(tls, db)
 70435  			}
 70436  			if rc != SQLITE_OK {
 70437  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+35994 /* "bad sqlite3 hand..." */, zDb, uintptr(0)))
 70438  				return TCL_ERROR
 70439  			}
 70440  			break
 70441  
 70442  		}
 70443  	}
 70444  
 70445  	return TCL_OK
 70446  }
 70447  
 70448  var strs = [5]uintptr{ts + 36015 /* "annotate" */, ts + 36024 /* "finalize" */, ts + 14470 /* "new" */, ts + 36033 /* "register" */, uintptr(0)} /* test_osinst.c:1127:21 */
 70449  
 70450  func SqlitetestOsinst_Init(tls *libc.TLS, interp uintptr) int32 { /* test_osinst.c:1219:5: */
 70451  	tcl.XTcl_CreateObjCommand(tls, interp, ts+35957 /* "vfslog" */, *(*uintptr)(unsafe.Pointer(&struct {
 70452  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 70453  	}{test_vfslog})), uintptr(0), uintptr(0))
 70454  	return TCL_OK
 70455  }
 70456  
 70457  // Global data used by this test implementation.  There is no
 70458  // mutexing, which means this page cache will not work in a
 70459  // multi-threaded test.
 70460  type testpcacheGlobalType1 = struct {
 70461  	FpDummy        uintptr
 70462  	FnInstance     int32
 70463  	FdiscardChance uint32
 70464  	FprngSeed      uint32
 70465  	FhighStress    uint32
 70466  } /* test_pcache.c:33:9 */
 70467  
 70468  // Global data used by this test implementation.  There is no
 70469  // mutexing, which means this page cache will not work in a
 70470  // multi-threaded test.
 70471  type testpcacheGlobalType = testpcacheGlobalType1 /* test_pcache.c:33:37 */
 70472  var testpcacheGlobal testpcacheGlobalType         /* test_pcache.c:41:29: */
 70473  
 70474  // Initializer.
 70475  //
 70476  // Verify that the initializer is only called when the system is
 70477  // uninitialized.  Allocate some memory and report SQLITE_NOMEM if
 70478  // the allocation fails.  This provides a means to test the recovery
 70479  // from a failed initialization attempt.  It also verifies that the
 70480  // the destructor always gets call - otherwise there would be a
 70481  // memory leak.
 70482  func testpcacheInit(tls *libc.TLS, pArg uintptr) int32 { /* test_pcache.c:53:12: */
 70483  
 70484  	testpcacheGlobal.FpDummy = sqlite3.Xsqlite3_malloc(tls, 10)
 70485  	if testpcacheGlobal.FpDummy == uintptr(0) {
 70486  		return SQLITE_NOMEM
 70487  	}
 70488  	return SQLITE_OK
 70489  }
 70490  
 70491  // Destructor
 70492  //
 70493  // Verify that this is only called after initialization.
 70494  // Free the memory allocated by the initializer.
 70495  func testpcacheShutdown(tls *libc.TLS, pArg uintptr) { /* test_pcache.c:67:13: */
 70496  
 70497  	sqlite3.Xsqlite3_free(tls, testpcacheGlobal.FpDummy)
 70498  	testpcacheGlobal.FpDummy = uintptr(0)
 70499  }
 70500  
 70501  // Number of pages in a cache.
 70502  //
 70503  // The number of pages is a hard upper bound in this test module.
 70504  // If more pages are requested, sqlite3PcacheFetch() returns NULL.
 70505  //
 70506  // If testing with in-memory temp tables, provide a larger pcache.
 70507  // Some of the test cases need this.
 70508  
 70509  // Magic numbers used to determine validity of the page cache.
 70510  
 70511  // Private implementation of a page cache.
 70512  type testpcache1 = struct {
 70513  	FszPage     int32
 70514  	FszExtra    int32
 70515  	FbPurgeable int32
 70516  	FnFree      int32
 70517  	FnPinned    int32
 70518  	FiRand      uint32
 70519  	FiMagic     uint32
 70520  	_           [4]byte
 70521  	Fa          [217]struct {
 70522  		Fpage     sqlite3_pcache_page
 70523  		Fkey      uint32
 70524  		FisPinned int32
 70525  	}
 70526  } /* test_pcache.c:100:9 */
 70527  
 70528  // Number of pages in a cache.
 70529  //
 70530  // The number of pages is a hard upper bound in this test module.
 70531  // If more pages are requested, sqlite3PcacheFetch() returns NULL.
 70532  //
 70533  // If testing with in-memory temp tables, provide a larger pcache.
 70534  // Some of the test cases need this.
 70535  
 70536  // Magic numbers used to determine validity of the page cache.
 70537  
 70538  // Private implementation of a page cache.
 70539  type testpcache = testpcache1 /* test_pcache.c:100:27 */
 70540  type testpcachePage = struct {
 70541  	Fpage     sqlite3_pcache_page
 70542  	Fkey      uint32
 70543  	FisPinned int32
 70544  } /* test_pcache.c:100:9 */
 70545  
 70546  // Get a random number using the PRNG in the given page cache.
 70547  func testpcacheRandom(tls *libc.TLS, p uintptr) uint32 { /* test_pcache.c:119:17: */
 70548  	var x uint32 = uint32(0)
 70549  	var i int32
 70550  	for i = 0; i < 4; i++ {
 70551  		(*testpcache)(unsafe.Pointer(p)).FiRand = (((*testpcache)(unsafe.Pointer(p)).FiRand * uint32(69069)) + uint32(5))
 70552  		x = ((x << 8) | (((*testpcache)(unsafe.Pointer(p)).FiRand >> 16) & uint32(0xff)))
 70553  	}
 70554  	return x
 70555  }
 70556  
 70557  // Allocate a new page cache instance.
 70558  func testpcacheCreate(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32) uintptr { /* test_pcache.c:133:23: */
 70559  	var nMem int32
 70560  	var x uintptr
 70561  	var p uintptr
 70562  	var i int32
 70563  
 70564  	szPage = ((szPage + 7) & libc.CplInt32(7))
 70565  	nMem = (int32(uint64(unsafe.Sizeof(testpcache{})) + (uint64(TESTPCACHE_NPAGE * (szPage + szExtra)))))
 70566  	p = sqlite3.Xsqlite3_malloc(tls, nMem)
 70567  	if p == uintptr(0) {
 70568  		return uintptr(0)
 70569  	}
 70570  	x = (p + 1*5240)
 70571  	(*testpcache)(unsafe.Pointer(p)).FszPage = szPage
 70572  	(*testpcache)(unsafe.Pointer(p)).FszExtra = szExtra
 70573  	(*testpcache)(unsafe.Pointer(p)).FnFree = TESTPCACHE_NPAGE
 70574  	(*testpcache)(unsafe.Pointer(p)).FnPinned = 0
 70575  	(*testpcache)(unsafe.Pointer(p)).FiRand = testpcacheGlobal.FprngSeed
 70576  	(*testpcache)(unsafe.Pointer(p)).FbPurgeable = bPurgeable
 70577  	(*testpcache)(unsafe.Pointer(p)).FiMagic = uint32(TESTPCACHE_VALID)
 70578  	i = 0
 70579  __1:
 70580  	if !(i < TESTPCACHE_NPAGE) {
 70581  		goto __3
 70582  	}
 70583  	{
 70584  		(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fkey = uint32(0)
 70585  		(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).FisPinned = 0
 70586  		(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fpage.FpBuf = x
 70587  		(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fpage.FpExtra = (x + uintptr(szPage))
 70588  
 70589  	}
 70590  	goto __2
 70591  __2:
 70592  	i++
 70593  	x += (uintptr(szPage + szExtra))
 70594  	goto __1
 70595  	goto __3
 70596  __3:
 70597  	;
 70598  	testpcacheGlobal.FnInstance++
 70599  	return p
 70600  }
 70601  
 70602  // Set the cache size
 70603  func testpcacheCachesize(tls *libc.TLS, pCache uintptr, newSize int32) { /* test_pcache.c:168:13: */
 70604  	var p uintptr = pCache
 70605  	_ = p
 70606  
 70607  }
 70608  
 70609  // Return the number of pages in the cache that are being used.
 70610  // This includes both pinned and unpinned pages.
 70611  func testpcachePagecount(tls *libc.TLS, pCache uintptr) int32 { /* test_pcache.c:179:12: */
 70612  	var p uintptr = pCache
 70613  
 70614  	return (TESTPCACHE_NPAGE - (*testpcache)(unsafe.Pointer(p)).FnFree)
 70615  }
 70616  
 70617  // Fetch a page.
 70618  func testpcacheFetch(tls *libc.TLS, pCache uintptr, key uint32, createFlag int32) uintptr { /* test_pcache.c:190:28: */
 70619  	var p uintptr = pCache
 70620  	var i int32
 70621  	var j int32
 70622  
 70623  	// See if the page is already in cache.  Return immediately if it is
 70624  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 70625  		if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).Fkey == key {
 70626  			if !((*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).FisPinned != 0) {
 70627  				(*testpcache)(unsafe.Pointer(p)).FnPinned++
 70628  
 70629  				(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).FisPinned = 1
 70630  			}
 70631  			return ((p + 32 /* &.a */) + uintptr(i)*24 /* &.page */)
 70632  		}
 70633  	}
 70634  
 70635  	// If createFlag is 0, never allocate a new page
 70636  	if createFlag == 0 {
 70637  		return uintptr(0)
 70638  	}
 70639  
 70640  	// If no pages are available, always fail
 70641  	if (*testpcache)(unsafe.Pointer(p)).FnPinned == TESTPCACHE_NPAGE {
 70642  		return uintptr(0)
 70643  	}
 70644  
 70645  	// Do not allocate the last TESTPCACHE_RESERVE pages unless createFlag is 2
 70646  	if ((*testpcache)(unsafe.Pointer(p)).FnPinned >= (TESTPCACHE_NPAGE - TESTPCACHE_RESERVE)) && (createFlag < 2) {
 70647  		return uintptr(0)
 70648  	}
 70649  
 70650  	// Do not allocate if highStress is enabled and createFlag is not 2.
 70651  	//
 70652  	// The highStress setting causes pagerStress() to be called much more
 70653  	// often, which exercises the pager logic more intensely.
 70654  	if (testpcacheGlobal.FhighStress != 0) && (createFlag < 2) {
 70655  		return uintptr(0)
 70656  	}
 70657  
 70658  	// Find a free page to allocate if there are any free pages.
 70659  	// Withhold TESTPCACHE_RESERVE free pages until createFlag is 2.
 70660  	if ((*testpcache)(unsafe.Pointer(p)).FnFree > TESTPCACHE_RESERVE) || ((createFlag == 2) && ((*testpcache)(unsafe.Pointer(p)).FnFree > 0)) {
 70661  		j = (int32(testpcacheRandom(tls, p) % uint32(TESTPCACHE_NPAGE)))
 70662  		i = 0
 70663  	__1:
 70664  		if !(i < TESTPCACHE_NPAGE) {
 70665  			goto __3
 70666  		}
 70667  		{
 70668  			if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fkey == uint32(0) {
 70669  				(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(j)*24)).Fkey = key
 70670  				(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(j)*24)).FisPinned = 1
 70671  				libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fpage.FpBuf, 0, uint64((*testpcache)(unsafe.Pointer(p)).FszPage))
 70672  				libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fpage.FpExtra, 0, uint64((*testpcache)(unsafe.Pointer(p)).FszExtra))
 70673  				(*testpcache)(unsafe.Pointer(p)).FnPinned++
 70674  				(*testpcache)(unsafe.Pointer(p)).FnFree--
 70675  
 70676  				return ((p + 32 /* &.a */) + uintptr(j)*24 /* &.page */)
 70677  			}
 70678  
 70679  		}
 70680  		goto __2
 70681  	__2:
 70682  		i++
 70683  		j = ((j + 1) % TESTPCACHE_NPAGE)
 70684  		goto __1
 70685  		goto __3
 70686  	__3:
 70687  
 70688  		// The prior loop always finds a freepage to allocate
 70689  
 70690  	}
 70691  
 70692  	// If this cache is not purgeable then we have to fail.
 70693  	if (*testpcache)(unsafe.Pointer(p)).FbPurgeable == 0 {
 70694  		return uintptr(0)
 70695  	}
 70696  
 70697  	// If there are no free pages, recycle a page.  The page to
 70698  	// recycle is selected at random from all unpinned pages.
 70699  	j = (int32(testpcacheRandom(tls, p) % uint32(TESTPCACHE_NPAGE)))
 70700  	i = 0
 70701  __4:
 70702  	if !(i < TESTPCACHE_NPAGE) {
 70703  		goto __6
 70704  	}
 70705  	{
 70706  		if ((*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fkey > uint32(0)) && ((*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).FisPinned == 0) {
 70707  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(j)*24)).Fkey = key
 70708  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(j)*24)).FisPinned = 1
 70709  			libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fpage.FpBuf, 0, uint64((*testpcache)(unsafe.Pointer(p)).FszPage))
 70710  			libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(j)*24)).Fpage.FpExtra, 0, uint64((*testpcache)(unsafe.Pointer(p)).FszExtra))
 70711  			(*testpcache)(unsafe.Pointer(p)).FnPinned++
 70712  
 70713  			return ((p + 32 /* &.a */) + uintptr(j)*24 /* &.page */)
 70714  		}
 70715  
 70716  	}
 70717  	goto __5
 70718  __5:
 70719  	i++
 70720  	j = ((j + 1) % TESTPCACHE_NPAGE)
 70721  	goto __4
 70722  	goto __6
 70723  __6:
 70724  	;
 70725  
 70726  	// The previous loop always finds a page to recycle.
 70727  
 70728  	return uintptr(0)
 70729  }
 70730  
 70731  // Unpin a page.
 70732  func testpcacheUnpin(tls *libc.TLS, pCache uintptr, pOldPage uintptr, discard int32) { /* test_pcache.c:289:13: */
 70733  	var p uintptr = pCache
 70734  	var i int32
 70735  
 70736  	// Randomly discard pages as they are unpinned according to the
 70737  	// discardChance setting.  If discardChance is 0, the random discard
 70738  	// never happens.  If discardChance is 100, it always happens.
 70739  	if ((*testpcache)(unsafe.Pointer(p)).FbPurgeable != 0) &&
 70740  		((uint32(100) - testpcacheGlobal.FdiscardChance) <= (testpcacheRandom(tls, p) % uint32(100))) {
 70741  		discard = 1
 70742  	}
 70743  
 70744  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 70745  		if ((p + 32 /* &.a */) + uintptr(i)*24 /* &.page */) == pOldPage {
 70746  			// The pOldPage pointer always points to a pinned page
 70747  
 70748  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).FisPinned = 0
 70749  			(*testpcache)(unsafe.Pointer(p)).FnPinned--
 70750  
 70751  			if discard != 0 {
 70752  				(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fkey = uint32(0)
 70753  				(*testpcache)(unsafe.Pointer(p)).FnFree++
 70754  
 70755  			}
 70756  			return
 70757  		}
 70758  	}
 70759  
 70760  	// The pOldPage pointer always points to a valid page
 70761  
 70762  }
 70763  
 70764  // Rekey a single page.
 70765  func testpcacheRekey(tls *libc.TLS, pCache uintptr, pOldPage uintptr, oldKey uint32, newKey uint32) { /* test_pcache.c:334:13: */
 70766  	var p uintptr = pCache
 70767  	var i int32
 70768  
 70769  	// If there already exists another page at newKey, verify that
 70770  	// the other page is unpinned and discard it.
 70771  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 70772  		if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).Fkey == newKey {
 70773  			// The new key is never a page that is already pinned
 70774  
 70775  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fkey = uint32(0)
 70776  			(*testpcache)(unsafe.Pointer(p)).FnFree++
 70777  
 70778  			break
 70779  		}
 70780  	}
 70781  
 70782  	// Find the page to be rekeyed and rekey it.
 70783  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 70784  		if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).Fkey == oldKey {
 70785  			// The oldKey and pOldPage parameters match
 70786  
 70787  			// Page to be rekeyed must be pinned
 70788  
 70789  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fkey = newKey
 70790  			return
 70791  		}
 70792  	}
 70793  
 70794  	// Rekey is always given a valid page to work with
 70795  
 70796  }
 70797  
 70798  // Truncate the page cache.  Every page with a key of iLimit or larger
 70799  // is discarded.
 70800  func testpcacheTruncate(tls *libc.TLS, pCache uintptr, iLimit uint32) { /* test_pcache.c:382:13: */
 70801  	var p uintptr = pCache
 70802  	var i uint32
 70803  
 70804  	for i = uint32(0); i < uint32(TESTPCACHE_NPAGE); i++ {
 70805  		if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).Fkey >= iLimit {
 70806  			(*testpcachePage)(unsafe.Pointer((p + 32 /* &.a */) + uintptr(i)*24)).Fkey = uint32(0)
 70807  			if (*testpcachePage)(unsafe.Pointer((p+32 /* &.a */)+uintptr(i)*24)).FisPinned != 0 {
 70808  				(*testpcache)(unsafe.Pointer(p)).FnPinned--
 70809  
 70810  			}
 70811  			(*testpcache)(unsafe.Pointer(p)).FnFree++
 70812  
 70813  		}
 70814  	}
 70815  }
 70816  
 70817  // Destroy a page cache.
 70818  func testpcacheDestroy(tls *libc.TLS, pCache uintptr) { /* test_pcache.c:404:13: */
 70819  	var p uintptr = pCache
 70820  
 70821  	(*testpcache)(unsafe.Pointer(p)).FiMagic = TESTPCACHE_CLEAR
 70822  	sqlite3.Xsqlite3_free(tls, p)
 70823  	testpcacheGlobal.FnInstance--
 70824  }
 70825  
 70826  // Invoke this routine to register or unregister the testing pager cache
 70827  // implemented by this file.
 70828  //
 70829  // Install the test pager cache if installFlag is 1 and uninstall it if
 70830  // installFlag is 0.
 70831  //
 70832  // When installing, discardChance is a number between 0 and 100 that
 70833  // indicates the probability of discarding a page when unpinning the
 70834  // page.  0 means never discard (unless the discard flag is set).
 70835  // 100 means always discard.
 70836  func installTestPCache(tls *libc.TLS, installFlag int32, discardChance uint32, prngSeed uint32, highStress uint32) { /* test_pcache.c:427:6: */
 70837  	bp := tls.Alloc(24)
 70838  	defer tls.Free(24)
 70839  
 70840  	testpcacheGlobal.FdiscardChance = discardChance
 70841  	testpcacheGlobal.FprngSeed = (prngSeed ^ (prngSeed << 16))
 70842  	testpcacheGlobal.FhighStress = highStress
 70843  	if installFlag != isInstalled {
 70844  		if installFlag != 0 {
 70845  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETPCACHE2, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultPcache))))
 70846  
 70847  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+8, uintptr(unsafe.Pointer(&testPcache))))
 70848  		} else {
 70849  
 70850  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+16, uintptr(unsafe.Pointer(&defaultPcache))))
 70851  		}
 70852  		isInstalled = installFlag
 70853  	}
 70854  }
 70855  
 70856  var testPcache = sqlite3_pcache_methods2{
 70857  	FiVersion:   1,
 70858  	FpArg:       0,
 70859  	FxInit:      0,
 70860  	FxShutdown:  0,
 70861  	FxCreate:    0,
 70862  	FxCachesize: 0,
 70863  	FxPagecount: 0,
 70864  	FxFetch:     0,
 70865  	FxUnpin:     0,
 70866  	FxRekey:     0,
 70867  	FxTruncate:  0,
 70868  	FxDestroy:   0,
 70869  }                                         /* test_pcache.c:433:40 */
 70870  var defaultPcache sqlite3_pcache_methods2 /* test_pcache.c:447:34: */
 70871  var isInstalled int32 = 0                 /* test_pcache.c:448:14 */
 70872  
 70873  // The following object serves the same role as FILE in the standard C
 70874  // library.  It represents an open connection to a file on disk for I/O.
 70875  //
 70876  // A single quota_FILE should not be used by two or more threads at the
 70877  // same time.  Multiple threads can be using different quota_FILE objects
 70878  // simultaneously, but not the same quota_FILE object.
 70879  type quota_FILE1 = struct {
 70880  	Ff     uintptr
 70881  	FiOfst sqlite3_int64
 70882  	FpFile uintptr
 70883  } /* test_quota.h:145:9 */
 70884  
 70885  // The following object serves the same role as FILE in the standard C
 70886  // library.  It represents an open connection to a file on disk for I/O.
 70887  //
 70888  // A single quota_FILE should not be used by two or more threads at the
 70889  // same time.  Multiple threads can be using different quota_FILE objects
 70890  // simultaneously, but not the same quota_FILE object.
 70891  type quota_FILE = quota_FILE1 /* test_quota.h:145:27 */ // getopt(3) external variable
 70892  
 70893  //*********************** Object Definitions *****************************
 70894  
 70895  // Forward declaration of all object types
 70896  type quotaGroup1 = struct {
 70897  	FzPattern  uintptr
 70898  	FiLimit    sqlite3_int64
 70899  	FiSize     sqlite3_int64
 70900  	FxCallback uintptr
 70901  	FpArg      uintptr
 70902  	FxDestroy  uintptr
 70903  	FpNext     uintptr
 70904  	FppPrev    uintptr
 70905  	FpFiles    uintptr
 70906  } /* test_quota.h:145:9 */
 70907  
 70908  // getopt(3) external variable
 70909  
 70910  //*********************** Object Definitions *****************************
 70911  
 70912  // Forward declaration of all object types
 70913  type quotaGroup = quotaGroup1 /* test_quota.c:61:27 */
 70914  type quotaConn1 = struct {
 70915  	Fbase  sqlite3_file
 70916  	FpFile uintptr
 70917  } /* test_quota.c:62:9 */
 70918  
 70919  type quotaConn = quotaConn1 /* test_quota.c:62:26 */
 70920  type quotaFile1 = struct {
 70921  	FzFilename     uintptr
 70922  	FpGroup        uintptr
 70923  	FiSize         sqlite3_int64
 70924  	FnRef          int32
 70925  	FdeleteOnClose int32
 70926  	FpNext         uintptr
 70927  	FppPrev        uintptr
 70928  } /* test_quota.h:145:9 */
 70929  
 70930  type quotaFile = quotaFile1 /* test_quota.c:63:26 */
 70931  
 70932  //************************ Global Variables *********************************
 70933  // All global variables used by this file are containing within the following
 70934  // gQuota structure.
 70935  var gQuota struct {
 70936  	FpOrigVfs      uintptr
 70937  	FsThisVfs      sqlite3_vfs
 70938  	FsIoMethodsV1  sqlite3_io_methods
 70939  	FsIoMethodsV2  sqlite3_io_methods
 70940  	FisInitialized int32
 70941  	_              [4]byte
 70942  	FpMutex        uintptr
 70943  	FpGroup        uintptr
 70944  } /* test_quota.c:183:3: */
 70945  
 70946  //************************ Utility Routines ********************************
 70947  // Acquire and release the mutex used to serialize access to the
 70948  // list of quotaGroups.
 70949  func quotaEnter(tls *libc.TLS) { /* test_quota.c:190:13: */
 70950  	sqlite3.Xsqlite3_mutex_enter(tls, gQuota.FpMutex)
 70951  }
 70952  
 70953  func quotaLeave(tls *libc.TLS) { /* test_quota.c:191:13: */
 70954  	sqlite3.Xsqlite3_mutex_leave(tls, gQuota.FpMutex)
 70955  }
 70956  
 70957  // Count the number of open files in a quotaGroup
 70958  func quotaGroupOpenFileCount(tls *libc.TLS, pGroup uintptr) int32 { /* test_quota.c:195:12: */
 70959  	var N int32 = 0
 70960  	var pFile uintptr = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 70961  	for pFile != 0 {
 70962  		if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 70963  			N++
 70964  		}
 70965  		pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 70966  	}
 70967  	return N
 70968  }
 70969  
 70970  // Remove a file from a quota group.
 70971  func quotaRemoveFile(tls *libc.TLS, pFile uintptr) { /* test_quota.c:207:13: */
 70972  	var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 70973  	*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 70974  	*(*uintptr)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FppPrev)) = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 70975  	if (*quotaFile)(unsafe.Pointer(pFile)).FpNext != 0 {
 70976  		(*quotaFile)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FpNext)).FppPrev = (*quotaFile)(unsafe.Pointer(pFile)).FppPrev
 70977  	}
 70978  	sqlite3.Xsqlite3_free(tls, pFile)
 70979  }
 70980  
 70981  // Remove all files from a quota group.  It is always the case that
 70982  // all files will be closed when this routine is called.
 70983  func quotaRemoveAllFiles(tls *libc.TLS, pGroup uintptr) { /* test_quota.c:218:13: */
 70984  	for (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles != 0 {
 70985  
 70986  		quotaRemoveFile(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles)
 70987  	}
 70988  }
 70989  
 70990  // If the reference count and threshold for a quotaGroup are both
 70991  // zero, then destroy the quotaGroup.
 70992  func quotaGroupDeref(tls *libc.TLS, pGroup uintptr) { /* test_quota.c:229:13: */
 70993  	if ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit == int64(0)) && (quotaGroupOpenFileCount(tls, pGroup) == 0) {
 70994  		quotaRemoveAllFiles(tls, pGroup)
 70995  		*(*uintptr)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev)) = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 70996  		if (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext != 0 {
 70997  			(*quotaGroup)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FpNext)).FppPrev = (*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev
 70998  		}
 70999  		if (*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy != 0 {
 71000  			(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pGroup + 40 /* &.xDestroy */))))(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 71001  		}
 71002  		sqlite3.Xsqlite3_free(tls, pGroup)
 71003  	}
 71004  }
 71005  
 71006  // Return TRUE if string z matches glob pattern zGlob.
 71007  //
 71008  // Globbing rules:
 71009  //
 71010  //      '*'       Matches any sequence of zero or more characters.
 71011  //
 71012  //      '?'       Matches exactly one character.
 71013  //
 71014  //     [...]      Matches one character from the enclosed list of
 71015  //                characters.
 71016  //
 71017  //     [^...]     Matches one character not in the enclosed list.
 71018  //
 71019  //     /          Matches "/" or "\\"
 71020  //
 71021  func quotaStrglob(tls *libc.TLS, zGlob uintptr, z uintptr) int32 { /* test_quota.c:256:12: */
 71022  	var c int32
 71023  	var c2 int32
 71024  	var cx int32
 71025  	var invert int32
 71026  	var seen int32
 71027  
 71028  	for (libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) != 0 {
 71029  		if c == '*' {
 71030  			for ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) == '*') || (c == '?') {
 71031  				if (c == '?') && ((int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0) {
 71032  					return 0
 71033  				}
 71034  			}
 71035  			if c == 0 {
 71036  				return 1
 71037  			} else if c == '[' {
 71038  				for (*(*int8)(unsafe.Pointer(z)) != 0) && (quotaStrglob(tls, (zGlob-uintptr(1)), z) == 0) {
 71039  					z++
 71040  				}
 71041  				return (libc.Bool32((int32(*(*int8)(unsafe.Pointer(z)))) != 0))
 71042  			}
 71043  			if c == '/' {
 71044  				cx = '\\'
 71045  			} else {
 71046  				cx = c
 71047  			}
 71048  			for (libc.AssignInt32(&c2, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))) != 0 {
 71049  				for (c2 != c) && (c2 != cx) {
 71050  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 71051  					if c2 == 0 {
 71052  						return 0
 71053  					}
 71054  				}
 71055  				if quotaStrglob(tls, zGlob, z) != 0 {
 71056  					return 1
 71057  				}
 71058  			}
 71059  			return 0
 71060  		} else if c == '?' {
 71061  			if (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0 {
 71062  				return 0
 71063  			}
 71064  		} else if c == '[' {
 71065  			var prior_c int32 = 0
 71066  			seen = 0
 71067  			invert = 0
 71068  			c = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 71069  			if c == 0 {
 71070  				return 0
 71071  			}
 71072  			c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 71073  			if c2 == '^' {
 71074  				invert = 1
 71075  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 71076  			}
 71077  			if c2 == ']' {
 71078  				if c == ']' {
 71079  					seen = 1
 71080  				}
 71081  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 71082  			}
 71083  			for (c2 != 0) && (c2 != ']') {
 71084  				if (((c2 == '-') && (int32(*(*int8)(unsafe.Pointer(zGlob))) != ']')) && (int32(*(*int8)(unsafe.Pointer(zGlob))) != 0)) && (prior_c > 0) {
 71085  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 71086  					if (c >= prior_c) && (c <= c2) {
 71087  						seen = 1
 71088  					}
 71089  					prior_c = 0
 71090  				} else {
 71091  					if c == c2 {
 71092  						seen = 1
 71093  					}
 71094  					prior_c = c2
 71095  				}
 71096  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 71097  			}
 71098  			if (c2 == 0) || ((seen ^ invert) == 0) {
 71099  				return 0
 71100  			}
 71101  		} else if c == '/' {
 71102  			if (int32(*(*int8)(unsafe.Pointer(z))) != '/') && (int32(*(*int8)(unsafe.Pointer(z))) != '\\') {
 71103  				return 0
 71104  			}
 71105  			z++
 71106  		} else {
 71107  			if c != (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) {
 71108  				return 0
 71109  			}
 71110  		}
 71111  	}
 71112  	return (libc.Bool32(int32(*(*int8)(unsafe.Pointer(z))) == 0))
 71113  }
 71114  
 71115  // Find a quotaGroup given the filename.
 71116  //
 71117  // Return a pointer to the quotaGroup object. Return NULL if not found.
 71118  func quotaGroupFind(tls *libc.TLS, zFilename uintptr) uintptr { /* test_quota.c:329:19: */
 71119  	var p uintptr
 71120  	for p = gQuota.FpGroup; (p != 0) && (quotaStrglob(tls, (*quotaGroup)(unsafe.Pointer(p)).FzPattern, zFilename) == 0); p = (*quotaGroup)(unsafe.Pointer(p)).FpNext {
 71121  	}
 71122  	return p
 71123  }
 71124  
 71125  // Translate an sqlite3_file* that is really a quotaConn* into
 71126  // the sqlite3_file* for the underlying original VFS.
 71127  func quotaSubOpen(tls *libc.TLS, pConn uintptr) uintptr { /* test_quota.c:339:21: */
 71128  	var p uintptr = pConn
 71129  	return (p + 1*16)
 71130  }
 71131  
 71132  // Find a file in a quota group and return a pointer to that file.
 71133  // Return NULL if the file is not in the group.
 71134  func quotaFindFile(tls *libc.TLS, pGroup uintptr, zName uintptr, createFlag int32) uintptr { /* test_quota.c:347:18: */
 71135  	var pFile uintptr = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 71136  	for (pFile != 0) && (libc.Xstrcmp(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, zName) != 0) {
 71137  		pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 71138  	}
 71139  	if (pFile == uintptr(0)) && (createFlag != 0) {
 71140  		var nName int32 = (int32(libc.Xstrlen(tls, zName) & uint64(0x3fffffff)))
 71141  		pFile = sqlite3.Xsqlite3_malloc(tls, (int32((uint64(unsafe.Sizeof(quotaFile{})) + uint64(nName)) + uint64(1))))
 71142  		if pFile != 0 {
 71143  			libc.Xmemset(tls, pFile, 0, uint64(unsafe.Sizeof(quotaFile{})))
 71144  			(*quotaFile)(unsafe.Pointer(pFile)).FzFilename = (pFile + 1*48)
 71145  			libc.Xmemcpy(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, zName, (uint64(nName + 1)))
 71146  			(*quotaFile)(unsafe.Pointer(pFile)).FpNext = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 71147  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles != 0 {
 71148  				(*quotaFile)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles)).FppPrev = (pFile + 32 /* &.pNext */)
 71149  			}
 71150  			(*quotaFile)(unsafe.Pointer(pFile)).FppPrev = (pGroup + 64 /* &.pFiles */)
 71151  			(*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles = pFile
 71152  			(*quotaFile)(unsafe.Pointer(pFile)).FpGroup = pGroup
 71153  		}
 71154  	}
 71155  	return pFile
 71156  }
 71157  
 71158  // Translate UTF8 to MBCS for use in fopen() calls.  Return a pointer to the
 71159  // translated text..  Call quota_mbcs_free() to deallocate any memory
 71160  // used to store the returned pointer when done.
 71161  func quota_utf8_to_mbcs(tls *libc.TLS, zUtf8 uintptr) uintptr { /* test_quota.c:377:13: */
 71162  	return zUtf8 // No-op on unix
 71163  }
 71164  
 71165  // Deallocate any memory allocated by quota_utf8_to_mbcs().
 71166  func quota_mbcs_free(tls *libc.TLS, zOld uintptr) { /* test_quota.c:408:13: */
 71167  	// No-op on unix
 71168  }
 71169  
 71170  //************************ VFS Method Wrappers ****************************
 71171  // This is the xOpen method used for the "quota" VFS.
 71172  //
 71173  // Most of the work is done by the underlying original VFS.  This method
 71174  // simply links the new file into the appropriate quota group if it is a
 71175  // file that needs to be tracked.
 71176  func quotaOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pConn uintptr, flags int32, pOutFlags uintptr) int32 { /* test_quota.c:424:12: */
 71177  	var rc int32                            // Result code
 71178  	var pQuotaOpen uintptr                  // The new quota file descriptor
 71179  	var pFile uintptr                       // Corresponding quotaFile obj
 71180  	var pGroup uintptr                      // The group file belongs to
 71181  	var pSubOpen uintptr                    // Real file descriptor
 71182  	var pOrigVfs uintptr = gQuota.FpOrigVfs // Real VFS
 71183  
 71184  	// If the file is not a main database file or a WAL, then use the
 71185  	// normal xOpen method.
 71186  	if (flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_WAL)) == 0 {
 71187  		return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 40 /* &.xOpen */))))(tls, pOrigVfs, zName, pConn, flags, pOutFlags)
 71188  	}
 71189  
 71190  	// If the name of the file does not match any quota group, then
 71191  	// use the normal xOpen method.
 71192  	quotaEnter(tls)
 71193  	pGroup = quotaGroupFind(tls, zName)
 71194  	if pGroup == uintptr(0) {
 71195  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 40 /* &.xOpen */))))(tls, pOrigVfs, zName, pConn, flags, pOutFlags)
 71196  	} else {
 71197  		// If we get to this point, it means the file needs to be quota tracked.
 71198  		pQuotaOpen = pConn
 71199  		pSubOpen = quotaSubOpen(tls, pConn)
 71200  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 40 /* &.xOpen */))))(tls, pOrigVfs, zName, pSubOpen, flags, pOutFlags)
 71201  		if rc == SQLITE_OK {
 71202  			pFile = quotaFindFile(tls, pGroup, zName, 1)
 71203  			if pFile == uintptr(0) {
 71204  				quotaLeave(tls)
 71205  				(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xClose */))))(tls, pSubOpen)
 71206  				return SQLITE_NOMEM
 71207  			}
 71208  			(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = (libc.Bool32((flags & SQLITE_OPEN_DELETEONCLOSE) != 0))
 71209  			(*quotaFile)(unsafe.Pointer(pFile)).FnRef++
 71210  			(*quotaConn)(unsafe.Pointer(pQuotaOpen)).FpFile = pFile
 71211  			if (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FiVersion == 1 {
 71212  				(*quotaConn)(unsafe.Pointer(pQuotaOpen)).Fbase.FpMethods = (uintptr(unsafe.Pointer(&gQuota)) + 176 /* &.sIoMethodsV1 */)
 71213  			} else {
 71214  				(*quotaConn)(unsafe.Pointer(pQuotaOpen)).Fbase.FpMethods = (uintptr(unsafe.Pointer(&gQuota)) + 328 /* &.sIoMethodsV2 */)
 71215  			}
 71216  		}
 71217  	}
 71218  	quotaLeave(tls)
 71219  	return rc
 71220  }
 71221  
 71222  // This is the xDelete method used for the "quota" VFS.
 71223  //
 71224  // If the file being deleted is part of the quota group, then reduce
 71225  // the size of the quota group accordingly.  And remove the file from
 71226  // the set of files in the quota group.
 71227  func quotaDelete(tls *libc.TLS, pVfs uintptr, zName uintptr, syncDir int32) int32 { /* test_quota.c:486:12: */
 71228  	var rc int32                            // Result code
 71229  	var pFile uintptr                       // Files in the quota
 71230  	var pGroup uintptr                      // The group file belongs to
 71231  	var pOrigVfs uintptr = gQuota.FpOrigVfs // Real VFS
 71232  
 71233  	// Do the actual file delete
 71234  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 48 /* &.xDelete */))))(tls, pOrigVfs, zName, syncDir)
 71235  
 71236  	// If the file just deleted is a member of a quota group, then remove
 71237  	// it from that quota group.
 71238  	if rc == SQLITE_OK {
 71239  		quotaEnter(tls)
 71240  		pGroup = quotaGroupFind(tls, zName)
 71241  		if pGroup != 0 {
 71242  			pFile = quotaFindFile(tls, pGroup, zName, 0)
 71243  			if pFile != 0 {
 71244  				if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 71245  					(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = 1
 71246  				} else {
 71247  					quotaRemoveFile(tls, pFile)
 71248  					quotaGroupDeref(tls, pGroup)
 71249  				}
 71250  			}
 71251  		}
 71252  		quotaLeave(tls)
 71253  	}
 71254  	return rc
 71255  }
 71256  
 71257  //*********************** I/O Method Wrappers ******************************
 71258  
 71259  // xClose requests get passed through to the original VFS.  But we
 71260  // also have to unlink the quotaConn from the quotaFile and quotaGroup.
 71261  // The quotaFile and/or quotaGroup are freed if they are no longer in use.
 71262  func quotaClose(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:528:12: */
 71263  	var p uintptr = pConn
 71264  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 71265  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71266  	var rc int32
 71267  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xClose */))))(tls, pSubOpen)
 71268  	quotaEnter(tls)
 71269  	(*quotaFile)(unsafe.Pointer(pFile)).FnRef--
 71270  	if (*quotaFile)(unsafe.Pointer(pFile)).FnRef == 0 {
 71271  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71272  		if (*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose != 0 {
 71273  			(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 48 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 71274  			quotaRemoveFile(tls, pFile)
 71275  		}
 71276  		quotaGroupDeref(tls, pGroup)
 71277  	}
 71278  	quotaLeave(tls)
 71279  	return rc
 71280  }
 71281  
 71282  // Pass xRead requests directory thru to the original VFS without
 71283  // further processing.
 71284  func quotaRead(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_quota.c:551:12: */
 71285  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71286  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 71287  }
 71288  
 71289  // Check xWrite requests to see if they expand the file.  If they do,
 71290  // the perform a quota check before passing them through to the
 71291  // original VFS.
 71292  func quotaWrite(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_quota.c:565:12: */
 71293  	var p uintptr = pConn
 71294  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71295  	var iEnd sqlite3_int64 = (iOfst + sqlite3_int64(iAmt))
 71296  	var pGroup uintptr
 71297  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 71298  	var szNew sqlite3_int64
 71299  
 71300  	if (*quotaFile)(unsafe.Pointer(pFile)).FiSize < iEnd {
 71301  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71302  		quotaEnter(tls)
 71303  		szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 71304  		if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 71305  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback != 0 {
 71306  				(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr))(unsafe.Pointer((pGroup + 24 /* &.xCallback */))))(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, (pGroup + 8 /* &.iLimit */), szNew,
 71307  					(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 71308  			}
 71309  			if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 71310  				quotaLeave(tls)
 71311  				return SQLITE_FULL
 71312  			}
 71313  		}
 71314  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiSize = szNew
 71315  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iEnd
 71316  		quotaLeave(tls)
 71317  	}
 71318  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 71319  }
 71320  
 71321  // Pass xTruncate requests thru to the original VFS.  If the
 71322  // success, update the file size.
 71323  func quotaTruncate(tls *libc.TLS, pConn uintptr, size sqlite3_int64) int32 { /* test_quota.c:602:12: */
 71324  	var p uintptr = pConn
 71325  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71326  	var rc int32 = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xTruncate */))))(tls, pSubOpen, size)
 71327  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 71328  	var pGroup uintptr
 71329  	if rc == SQLITE_OK {
 71330  		quotaEnter(tls)
 71331  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71332  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71333  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = size
 71334  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (size)
 71335  		quotaLeave(tls)
 71336  	}
 71337  	return rc
 71338  }
 71339  
 71340  // Pass xSync requests through to the original VFS without change
 71341  func quotaSync(tls *libc.TLS, pConn uintptr, flags int32) int32 { /* test_quota.c:621:12: */
 71342  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71343  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 40 /* &.xSync */))))(tls, pSubOpen, flags)
 71344  }
 71345  
 71346  // Pass xFileSize requests through to the original VFS but then
 71347  // update the quotaGroup with the new size before returning.
 71348  func quotaFileSize(tls *libc.TLS, pConn uintptr, pSize uintptr) int32 { /* test_quota.c:629:12: */
 71349  	bp := tls.Alloc(8)
 71350  	defer tls.Free(8)
 71351  
 71352  	var p uintptr = pConn
 71353  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71354  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 71355  	var pGroup uintptr
 71356  	// var sz sqlite3_int64 at bp, 8
 71357  
 71358  	var rc int32
 71359  
 71360  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 48 /* &.xFileSize */))))(tls, pSubOpen, bp /* &sz */)
 71361  	if rc == SQLITE_OK {
 71362  		quotaEnter(tls)
 71363  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71364  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71365  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 71366  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)))
 71367  		quotaLeave(tls)
 71368  		*(*sqlite3_int64)(unsafe.Pointer(pSize)) = *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 71369  	}
 71370  	return rc
 71371  }
 71372  
 71373  // Pass xLock requests through to the original VFS unchanged.
 71374  func quotaLock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_quota.c:652:12: */
 71375  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71376  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 56 /* &.xLock */))))(tls, pSubOpen, lock)
 71377  }
 71378  
 71379  // Pass xUnlock requests through to the original VFS unchanged.
 71380  func quotaUnlock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_quota.c:659:12: */
 71381  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71382  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 64 /* &.xUnlock */))))(tls, pSubOpen, lock)
 71383  }
 71384  
 71385  // Pass xCheckReservedLock requests through to the original VFS unchanged.
 71386  func quotaCheckReservedLock(tls *libc.TLS, pConn uintptr, pResOut uintptr) int32 { /* test_quota.c:666:12: */
 71387  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71388  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 72 /* &.xCheckReservedLock */))))(tls, pSubOpen, pResOut)
 71389  }
 71390  
 71391  // Pass xFileControl requests through to the original VFS unchanged.
 71392  func quotaFileControl(tls *libc.TLS, pConn uintptr, op int32, pArg uintptr) int32 { /* test_quota.c:673:12: */
 71393  	bp := tls.Alloc(8)
 71394  	defer tls.Free(8)
 71395  
 71396  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71397  	var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 80 /* &.xFileControl */))))(tls, pSubOpen, op, pArg)
 71398  	if (op == SQLITE_FCNTL_VFSNAME) && (rc == SQLITE_OK) {
 71399  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+36042 /* "quota/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 71400  	}
 71401  	return rc
 71402  }
 71403  
 71404  // Pass xSectorSize requests through to the original VFS unchanged.
 71405  func quotaSectorSize(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:686:12: */
 71406  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71407  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 88 /* &.xSectorSize */))))(tls, pSubOpen)
 71408  }
 71409  
 71410  // Pass xDeviceCharacteristics requests through to the original VFS unchanged.
 71411  func quotaDeviceCharacteristics(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:693:12: */
 71412  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71413  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 96 /* &.xDeviceCharacteristics */))))(tls, pSubOpen)
 71414  }
 71415  
 71416  // Pass xShmMap requests through to the original VFS unchanged.
 71417  func quotaShmMap(tls *libc.TLS, pConn uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) int32 { /* test_quota.c:700:12: */
 71418  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71419  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 104 /* &.xShmMap */))))(tls, pSubOpen, iRegion, szRegion, bExtend, libc.AtomicLoadUintptr(&pp))
 71420  }
 71421  
 71422  // Pass xShmLock requests through to the original VFS unchanged.
 71423  func quotaShmLock(tls *libc.TLS, pConn uintptr, ofst int32, n int32, flags int32) int32 { /* test_quota.c:713:12: */
 71424  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71425  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 112 /* &.xShmLock */))))(tls, pSubOpen, ofst, n, flags)
 71426  }
 71427  
 71428  // Pass xShmBarrier requests through to the original VFS unchanged.
 71429  func quotaShmBarrier(tls *libc.TLS, pConn uintptr) { /* test_quota.c:725:13: */
 71430  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71431  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pSubOpen)
 71432  }
 71433  
 71434  // Pass xShmUnmap requests through to the original VFS unchanged.
 71435  func quotaShmUnmap(tls *libc.TLS, pConn uintptr, deleteFlag int32) int32 { /* test_quota.c:732:12: */
 71436  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 71437  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pSubOpen, deleteFlag)
 71438  }
 71439  
 71440  //************************* Public Interfaces ****************************
 71441  // Initialize the quota VFS shim.  Use the VFS named zOrigVfsName
 71442  // as the VFS that does the actual work.  Use the default if
 71443  // zOrigVfsName==NULL.
 71444  //
 71445  // The quota VFS shim is named "quota".  It will become the default
 71446  // VFS if makeDefault is non-zero.
 71447  //
 71448  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once
 71449  // during start-up.
 71450  func sqlite3_quota_initialize(tls *libc.TLS, zOrigVfsName uintptr, makeDefault int32) int32 { /* test_quota.c:749:5: */
 71451  	var pOrigVfs uintptr
 71452  	if gQuota.FisInitialized != 0 {
 71453  		return SQLITE_MISUSE
 71454  	}
 71455  	pOrigVfs = sqlite3.Xsqlite3_vfs_find(tls, zOrigVfsName)
 71456  	if pOrigVfs == uintptr(0) {
 71457  		return SQLITE_ERROR
 71458  	}
 71459  
 71460  	gQuota.FpMutex = sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST)
 71461  	if !(int32(gQuota.FpMutex) != 0) {
 71462  		return SQLITE_NOMEM
 71463  	}
 71464  	gQuota.FisInitialized = 1
 71465  	gQuota.FpOrigVfs = pOrigVfs
 71466  	gQuota.FsThisVfs = *(*sqlite3_vfs)(unsafe.Pointer(pOrigVfs))
 71467  	gQuota.FsThisVfs.FxOpen = *(*uintptr)(unsafe.Pointer(&struct {
 71468  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 71469  	}{quotaOpen}))
 71470  	gQuota.FsThisVfs.FxDelete = *(*uintptr)(unsafe.Pointer(&struct {
 71471  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 71472  	}{quotaDelete}))
 71473  	*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&gQuota)) + 8 /* &.sThisVfs */ + 4 /* &.szOsFile */)) += int32((uint64(unsafe.Sizeof(quotaConn{}))))
 71474  	gQuota.FsThisVfs.FzName = ts + 36051 /* "quota" */
 71475  	gQuota.FsIoMethodsV1.FiVersion = 1
 71476  	gQuota.FsIoMethodsV1.FxClose = *(*uintptr)(unsafe.Pointer(&struct {
 71477  		f func(*libc.TLS, uintptr) int32
 71478  	}{quotaClose}))
 71479  	gQuota.FsIoMethodsV1.FxRead = *(*uintptr)(unsafe.Pointer(&struct {
 71480  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 71481  	}{quotaRead}))
 71482  	gQuota.FsIoMethodsV1.FxWrite = *(*uintptr)(unsafe.Pointer(&struct {
 71483  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 71484  	}{quotaWrite}))
 71485  	gQuota.FsIoMethodsV1.FxTruncate = *(*uintptr)(unsafe.Pointer(&struct {
 71486  		f func(*libc.TLS, uintptr, sqlite3_int64) int32
 71487  	}{quotaTruncate}))
 71488  	gQuota.FsIoMethodsV1.FxSync = *(*uintptr)(unsafe.Pointer(&struct {
 71489  		f func(*libc.TLS, uintptr, int32) int32
 71490  	}{quotaSync}))
 71491  	gQuota.FsIoMethodsV1.FxFileSize = *(*uintptr)(unsafe.Pointer(&struct {
 71492  		f func(*libc.TLS, uintptr, uintptr) int32
 71493  	}{quotaFileSize}))
 71494  	gQuota.FsIoMethodsV1.FxLock = *(*uintptr)(unsafe.Pointer(&struct {
 71495  		f func(*libc.TLS, uintptr, int32) int32
 71496  	}{quotaLock}))
 71497  	gQuota.FsIoMethodsV1.FxUnlock = *(*uintptr)(unsafe.Pointer(&struct {
 71498  		f func(*libc.TLS, uintptr, int32) int32
 71499  	}{quotaUnlock}))
 71500  	gQuota.FsIoMethodsV1.FxCheckReservedLock = *(*uintptr)(unsafe.Pointer(&struct {
 71501  		f func(*libc.TLS, uintptr, uintptr) int32
 71502  	}{quotaCheckReservedLock}))
 71503  	gQuota.FsIoMethodsV1.FxFileControl = *(*uintptr)(unsafe.Pointer(&struct {
 71504  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 71505  	}{quotaFileControl}))
 71506  	gQuota.FsIoMethodsV1.FxSectorSize = *(*uintptr)(unsafe.Pointer(&struct {
 71507  		f func(*libc.TLS, uintptr) int32
 71508  	}{quotaSectorSize}))
 71509  	gQuota.FsIoMethodsV1.FxDeviceCharacteristics = *(*uintptr)(unsafe.Pointer(&struct {
 71510  		f func(*libc.TLS, uintptr) int32
 71511  	}{quotaDeviceCharacteristics}))
 71512  	gQuota.FsIoMethodsV2 = gQuota.FsIoMethodsV1
 71513  	gQuota.FsIoMethodsV2.FiVersion = 2
 71514  	gQuota.FsIoMethodsV2.FxShmMap = *(*uintptr)(unsafe.Pointer(&struct {
 71515  		f func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32
 71516  	}{quotaShmMap}))
 71517  	gQuota.FsIoMethodsV2.FxShmLock = *(*uintptr)(unsafe.Pointer(&struct {
 71518  		f func(*libc.TLS, uintptr, int32, int32, int32) int32
 71519  	}{quotaShmLock}))
 71520  	gQuota.FsIoMethodsV2.FxShmBarrier = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{quotaShmBarrier}))
 71521  	gQuota.FsIoMethodsV2.FxShmUnmap = *(*uintptr)(unsafe.Pointer(&struct {
 71522  		f func(*libc.TLS, uintptr, int32) int32
 71523  	}{quotaShmUnmap}))
 71524  	sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&gQuota)) + 8 /* &.sThisVfs */), makeDefault)
 71525  	return SQLITE_OK
 71526  }
 71527  
 71528  // Shutdown the quota system.
 71529  //
 71530  // All SQLite database connections must be closed before calling this
 71531  // routine.
 71532  //
 71533  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once while
 71534  // shutting down in order to free all remaining quota groups.
 71535  func sqlite3_quota_shutdown(tls *libc.TLS) int32 { /* test_quota.c:798:5: */
 71536  	var pGroup uintptr
 71537  	if gQuota.FisInitialized == 0 {
 71538  		return SQLITE_MISUSE
 71539  	}
 71540  	for pGroup = gQuota.FpGroup; pGroup != 0; pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext {
 71541  		if quotaGroupOpenFileCount(tls, pGroup) > 0 {
 71542  			return SQLITE_MISUSE
 71543  		}
 71544  	}
 71545  	for gQuota.FpGroup != 0 {
 71546  		pGroup = gQuota.FpGroup
 71547  		gQuota.FpGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 71548  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit = int64(0)
 71549  
 71550  		quotaGroupDeref(tls, pGroup)
 71551  	}
 71552  	gQuota.FisInitialized = 0
 71553  	sqlite3.Xsqlite3_mutex_free(tls, gQuota.FpMutex)
 71554  	sqlite3.Xsqlite3_vfs_unregister(tls, (uintptr(unsafe.Pointer(&gQuota)) + 8 /* &.sThisVfs */))
 71555  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&gQuota)), 0, uint64(unsafe.Sizeof(gQuota)))
 71556  	return SQLITE_OK
 71557  }
 71558  
 71559  // Create or destroy a quota group.
 71560  //
 71561  // The quota group is defined by the zPattern.  When calling this routine
 71562  // with a zPattern for a quota group that already exists, this routine
 71563  // merely updates the iLimit, xCallback, and pArg values for that quota
 71564  // group.  If zPattern is new, then a new quota group is created.
 71565  //
 71566  // If the iLimit for a quota group is set to zero, then the quota group
 71567  // is disabled and will be deleted when the last database connection using
 71568  // the quota group is closed.
 71569  //
 71570  // Calling this routine on a zPattern that does not exist and with a
 71571  // zero iLimit is a no-op.
 71572  //
 71573  // A quota group must exist with a non-zero iLimit prior to opening
 71574  // database connections if those connections are to participate in the
 71575  // quota group.  Creating a quota group does not affect database connections
 71576  // that are already open.
 71577  func sqlite3_quota_set(tls *libc.TLS, zPattern uintptr, iLimit sqlite3_int64, xCallback uintptr, pArg uintptr, xDestroy uintptr) int32 { /* test_quota.c:838:5: */
 71578  	var pGroup uintptr
 71579  	quotaEnter(tls)
 71580  	pGroup = gQuota.FpGroup
 71581  	for (pGroup != 0) && (libc.Xstrcmp(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, zPattern) != 0) {
 71582  		pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 71583  	}
 71584  	if pGroup == uintptr(0) {
 71585  		var nPattern int32 = (int32(libc.Xstrlen(tls, zPattern) & uint64(0x3fffffff)))
 71586  		if iLimit <= int64(0) {
 71587  			quotaLeave(tls)
 71588  			return SQLITE_OK
 71589  		}
 71590  		pGroup = sqlite3.Xsqlite3_malloc(tls, (int32((uint64(unsafe.Sizeof(quotaGroup{})) + uint64(nPattern)) + uint64(1))))
 71591  		if pGroup == uintptr(0) {
 71592  			quotaLeave(tls)
 71593  			return SQLITE_NOMEM
 71594  		}
 71595  		libc.Xmemset(tls, pGroup, 0, uint64(unsafe.Sizeof(quotaGroup{})))
 71596  		(*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern = (pGroup + 1*72)
 71597  		libc.Xmemcpy(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, zPattern, (uint64(nPattern + 1)))
 71598  		if gQuota.FpGroup != 0 {
 71599  			(*quotaGroup)(unsafe.Pointer(gQuota.FpGroup)).FppPrev = (pGroup + 48 /* &.pNext */)
 71600  		}
 71601  		(*quotaGroup)(unsafe.Pointer(pGroup)).FpNext = gQuota.FpGroup
 71602  		(*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev = (uintptr(unsafe.Pointer(&gQuota)) + 496 /* &.pGroup */)
 71603  		gQuota.FpGroup = pGroup
 71604  	}
 71605  	(*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit = iLimit
 71606  	(*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback = xCallback
 71607  	if ((*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy != 0) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FpArg != pArg) {
 71608  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pGroup + 40 /* &.xDestroy */))))(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 71609  	}
 71610  	(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg = pArg
 71611  	(*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy = xDestroy
 71612  	quotaGroupDeref(tls, pGroup)
 71613  	quotaLeave(tls)
 71614  	return SQLITE_OK
 71615  }
 71616  
 71617  // Bring the named file under quota management.  Or if it is already under
 71618  // management, update its size.
 71619  func sqlite3_quota_file(tls *libc.TLS, zFilename uintptr) int32 { /* test_quota.c:891:5: */
 71620  	bp := tls.Alloc(16)
 71621  	defer tls.Free(16)
 71622  
 71623  	var zFull uintptr = uintptr(0)
 71624  	var fd uintptr
 71625  	var rc int32
 71626  	*(*int32)(unsafe.Pointer(bp /* outFlags */)) = 0
 71627  	// var iSize sqlite3_int64 at bp+8, 8
 71628  
 71629  	var nAlloc int32 = ((gQuota.FsThisVfs.FszOsFile + gQuota.FsThisVfs.FmxPathname) + 2)
 71630  
 71631  	// Allocate space for a file-handle and the full path for file zFilename
 71632  	fd = sqlite3.Xsqlite3_malloc(tls, nAlloc)
 71633  	if fd == uintptr(0) {
 71634  		rc = SQLITE_NOMEM
 71635  	} else {
 71636  		zFull = ((fd) + uintptr(gQuota.FsThisVfs.FszOsFile))
 71637  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 64 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 71638  			(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 71639  	}
 71640  
 71641  	if rc == SQLITE_OK {
 71642  		*(*int8)(unsafe.Pointer(zFull + uintptr((libc.Xstrlen(tls, zFull) + uint64(1))))) = int8(0)
 71643  		rc = quotaOpen(tls, (uintptr(unsafe.Pointer(&gQuota)) + 8 /* &.sThisVfs */), zFull, fd,
 71644  			(SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB), bp /* &outFlags */)
 71645  		if rc == SQLITE_OK {
 71646  			(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods + 48 /* &.xFileSize */))))(tls, fd, bp+8 /* &iSize */)
 71647  			(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods + 8 /* &.xClose */))))(tls, fd)
 71648  		} else if rc == SQLITE_CANTOPEN {
 71649  			var pGroup uintptr
 71650  			var pFile uintptr
 71651  			quotaEnter(tls)
 71652  			pGroup = quotaGroupFind(tls, zFull)
 71653  			if pGroup != 0 {
 71654  				pFile = quotaFindFile(tls, pGroup, zFull, 0)
 71655  				if pFile != 0 {
 71656  					quotaRemoveFile(tls, pFile)
 71657  				}
 71658  			}
 71659  			quotaLeave(tls)
 71660  		}
 71661  	}
 71662  
 71663  	sqlite3.Xsqlite3_free(tls, fd)
 71664  	return rc
 71665  }
 71666  
 71667  // Open a potentially quotaed file for I/O.
 71668  func sqlite3_quota_fopen(tls *libc.TLS, zFilename uintptr, zMode uintptr) uintptr { /* test_quota.c:936:12: */
 71669  	var p uintptr
 71670  	var zFull uintptr
 71671  	var zFullTranslated uintptr
 71672  	var rc int32
 71673  	var pGroup uintptr
 71674  	var pFile uintptr
 71675  	p = uintptr(0)
 71676  	zFull = uintptr(0)
 71677  	zFullTranslated = uintptr(0)
 71678  
 71679  	zFull = sqlite3.Xsqlite3_malloc(tls, (gQuota.FsThisVfs.FmxPathname + 1))
 71680  	if !(zFull == uintptr(0)) {
 71681  		goto __1
 71682  	}
 71683  	return uintptr(0)
 71684  __1:
 71685  	;
 71686  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 64 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 71687  		(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 71688  	if !(rc != 0) {
 71689  		goto __2
 71690  	}
 71691  	goto quota_fopen_error
 71692  __2:
 71693  	;
 71694  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(quota_FILE{})))
 71695  	if !(p == uintptr(0)) {
 71696  		goto __3
 71697  	}
 71698  	goto quota_fopen_error
 71699  __3:
 71700  	;
 71701  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(quota_FILE{})))
 71702  	zFullTranslated = quota_utf8_to_mbcs(tls, zFull)
 71703  	if !(zFullTranslated == uintptr(0)) {
 71704  		goto __4
 71705  	}
 71706  	goto quota_fopen_error
 71707  __4:
 71708  	;
 71709  	(*quota_FILE)(unsafe.Pointer(p)).Ff = libc.Xfopen(tls, zFullTranslated, zMode)
 71710  	if !((*quota_FILE)(unsafe.Pointer(p)).Ff == uintptr(0)) {
 71711  		goto __5
 71712  	}
 71713  	goto quota_fopen_error
 71714  __5:
 71715  	;
 71716  	quotaEnter(tls)
 71717  	pGroup = quotaGroupFind(tls, zFull)
 71718  	if !(pGroup != 0) {
 71719  		goto __6
 71720  	}
 71721  	pFile = quotaFindFile(tls, pGroup, zFull, 1)
 71722  	if !(pFile == uintptr(0)) {
 71723  		goto __7
 71724  	}
 71725  	quotaLeave(tls)
 71726  	goto quota_fopen_error
 71727  __7:
 71728  	;
 71729  	(*quotaFile)(unsafe.Pointer(pFile)).FnRef++
 71730  	(*quota_FILE)(unsafe.Pointer(p)).FpFile = pFile
 71731  __6:
 71732  	;
 71733  	quotaLeave(tls)
 71734  	sqlite3.Xsqlite3_free(tls, zFull)
 71735  	return p
 71736  
 71737  quota_fopen_error:
 71738  	quota_mbcs_free(tls, zFullTranslated)
 71739  	sqlite3.Xsqlite3_free(tls, zFull)
 71740  	if !((p != 0) && ((*quota_FILE)(unsafe.Pointer(p)).Ff != 0)) {
 71741  		goto __8
 71742  	}
 71743  	libc.Xfclose(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71744  __8:
 71745  	;
 71746  	sqlite3.Xsqlite3_free(tls, p)
 71747  	return uintptr(0)
 71748  }
 71749  
 71750  // Read content from a quota_FILE
 71751  func sqlite3_quota_fread(tls *libc.TLS, pBuf uintptr, size size_t, nmemb size_t, p uintptr) size_t { /* test_quota.c:985:8: */
 71752  	return libc.Xfread(tls, pBuf, size, nmemb, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71753  }
 71754  
 71755  // Write content into a quota_FILE.  Invoke the quota callback and block
 71756  // the write if we exceed quota.
 71757  func sqlite3_quota_fwrite(tls *libc.TLS, pBuf uintptr, size size_t, nmemb size_t, p uintptr) size_t { /* test_quota.c:998:8: */
 71758  	var iOfst sqlite3_int64
 71759  	var iEnd sqlite3_int64
 71760  	var szNew sqlite3_int64
 71761  	var pFile uintptr
 71762  	var rc size_t
 71763  
 71764  	iOfst = sqlite3_int64(libc.Xftell(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff))
 71765  	iEnd = (sqlite3_int64(uint64(iOfst) + (uint64(size * nmemb))))
 71766  	pFile = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 71767  	if (pFile != 0) && ((*quotaFile)(unsafe.Pointer(pFile)).FiSize < iEnd) {
 71768  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71769  		quotaEnter(tls)
 71770  		szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 71771  		if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 71772  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback != 0 {
 71773  				(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr))(unsafe.Pointer((pGroup + 24 /* &.xCallback */))))(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, (pGroup + 8 /* &.iLimit */), szNew,
 71774  					(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 71775  			}
 71776  			if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 71777  				iEnd = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit - (*quotaGroup)(unsafe.Pointer(pGroup)).FiSize) + (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71778  				nmemb = (size_t((uint64(iEnd - iOfst)) / uint64(size)))
 71779  				iEnd = (sqlite3_int64(uint64(iOfst) + (uint64(size * nmemb))))
 71780  				szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 71781  			}
 71782  		}
 71783  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiSize = szNew
 71784  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iEnd
 71785  		quotaLeave(tls)
 71786  	} else {
 71787  		pFile = uintptr(0)
 71788  	}
 71789  	rc = libc.Xfwrite(tls, pBuf, size, nmemb, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71790  
 71791  	// If the write was incomplete, adjust the file size and group size
 71792  	// downward
 71793  	if (rc < nmemb) && (pFile != 0) {
 71794  		var nWritten size_t = rc
 71795  		var iNewEnd sqlite3_int64 = (sqlite3_int64(uint64(iOfst) + (uint64(size * nWritten))))
 71796  		if iNewEnd < iEnd {
 71797  			iNewEnd = iEnd
 71798  		}
 71799  		quotaEnter(tls)
 71800  		*(*sqlite3_int64)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FpGroup + 16 /* &.iSize */)) += (iNewEnd - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71801  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iNewEnd
 71802  		quotaLeave(tls)
 71803  	}
 71804  	return rc
 71805  }
 71806  
 71807  // Close an open quota_FILE stream.
 71808  func sqlite3_quota_fclose(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1054:5: */
 71809  	var rc int32
 71810  	var pFile uintptr
 71811  	rc = libc.Xfclose(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71812  	pFile = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 71813  	if pFile != 0 {
 71814  		quotaEnter(tls)
 71815  		(*quotaFile)(unsafe.Pointer(pFile)).FnRef--
 71816  		if (*quotaFile)(unsafe.Pointer(pFile)).FnRef == 0 {
 71817  			var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71818  			if (*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose != 0 {
 71819  				(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 48 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 71820  				quotaRemoveFile(tls, pFile)
 71821  			}
 71822  			quotaGroupDeref(tls, pGroup)
 71823  		}
 71824  		quotaLeave(tls)
 71825  	}
 71826  	sqlite3.Xsqlite3_free(tls, p)
 71827  	return rc
 71828  }
 71829  
 71830  // Flush memory buffers for a quota_FILE to disk.
 71831  func sqlite3_quota_fflush(tls *libc.TLS, p uintptr, doFsync int32) int32 { /* test_quota.c:1082:5: */
 71832  	var rc int32
 71833  	rc = libc.Xfflush(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71834  	if (rc == 0) && (doFsync != 0) {
 71835  		rc = libc.Xfsync(tls, func() int32 {
 71836  			if !(libc.X__isthreaded != 0) {
 71837  				return int32((*FILE)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).Ff)).F_file)
 71838  			}
 71839  			return libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71840  		}())
 71841  	}
 71842  	return (libc.Bool32(rc != 0))
 71843  }
 71844  
 71845  // Seek on a quota_FILE stream.
 71846  func sqlite3_quota_fseek(tls *libc.TLS, p uintptr, offset int64, whence int32) int32 { /* test_quota.c:1099:5: */
 71847  	return libc.Xfseek(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff, offset, whence)
 71848  }
 71849  
 71850  // rewind a quota_FILE stream.
 71851  func sqlite3_quota_rewind(tls *libc.TLS, p uintptr) { /* test_quota.c:1106:6: */
 71852  	libc.Xrewind(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71853  }
 71854  
 71855  // Tell the current location of a quota_FILE stream.
 71856  func sqlite3_quota_ftell(tls *libc.TLS, p uintptr) int64 { /* test_quota.c:1113:6: */
 71857  	return libc.Xftell(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71858  }
 71859  
 71860  // Test the error indicator for the given file.
 71861  func sqlite3_quota_ferror(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1120:5: */
 71862  	return func() int32 {
 71863  		if !(libc.X__isthreaded != 0) {
 71864  			return (libc.Bool32((int32((*FILE)(unsafe.Pointer(((*quota_FILE)(unsafe.Pointer(p)).Ff))).F_flags) & 0x0040) != 0))
 71865  		}
 71866  		return libc.Xferror(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71867  	}()
 71868  }
 71869  
 71870  // Truncate a file to szNew bytes.
 71871  func sqlite3_quota_ftruncate(tls *libc.TLS, p uintptr, szNew sqlite3_int64) int32 { /* test_quota.c:1127:5: */
 71872  	var pFile uintptr = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 71873  	var rc int32
 71874  	if ((libc.AssignUintptr(&pFile, (*quota_FILE)(unsafe.Pointer(p)).FpFile)) != uintptr(0)) && ((*quotaFile)(unsafe.Pointer(pFile)).FiSize < szNew) {
 71875  		var pGroup uintptr
 71876  		if (*quotaFile)(unsafe.Pointer(pFile)).FiSize < szNew {
 71877  			// This routine cannot be used to extend a file that is under
 71878  			// quota management.  Only true truncation is allowed.
 71879  			return -1
 71880  		}
 71881  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71882  		quotaEnter(tls)
 71883  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (szNew - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71884  		quotaLeave(tls)
 71885  	}
 71886  	rc = libc.Xftruncate(tls, func() int32 {
 71887  		if !(libc.X__isthreaded != 0) {
 71888  			return int32((*FILE)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).Ff)).F_file)
 71889  		}
 71890  		return libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71891  	}(), int64(szNew))
 71892  	if (pFile != 0) && (rc == 0) {
 71893  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 71894  		quotaEnter(tls)
 71895  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (szNew - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 71896  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = szNew
 71897  		quotaLeave(tls)
 71898  	}
 71899  	return rc
 71900  }
 71901  
 71902  // Determine the time that the given file was last modified, in
 71903  // seconds size 1970.  Write the result into *pTime.  Return 0 on
 71904  // success and non-zero on any kind of error.
 71905  func sqlite3_quota_file_mtime(tls *libc.TLS, p uintptr, pTime uintptr) int32 { /* test_quota.c:1169:5: */
 71906  	bp := tls.Alloc(224)
 71907  	defer tls.Free(224)
 71908  
 71909  	var rc int32
 71910  	// var buf stat at bp, 224
 71911  
 71912  	rc = libc.Xfstat(tls, func() int32 {
 71913  		if !(libc.X__isthreaded != 0) {
 71914  			return int32((*FILE)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).Ff)).F_file)
 71915  		}
 71916  		return libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71917  	}(), bp /* &buf */)
 71918  	if rc == 0 {
 71919  		*(*time_t)(unsafe.Pointer(pTime)) = (*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mtim.Ftv_sec
 71920  	}
 71921  	return rc
 71922  }
 71923  
 71924  // Return the true size of the file, as reported by the operating
 71925  // system.
 71926  func sqlite3_quota_file_truesize(tls *libc.TLS, p uintptr) sqlite3_int64 { /* test_quota.c:1187:15: */
 71927  	bp := tls.Alloc(224)
 71928  	defer tls.Free(224)
 71929  
 71930  	var rc int32
 71931  	// var buf stat at bp, 224
 71932  
 71933  	rc = libc.Xfstat(tls, func() int32 {
 71934  		if !(libc.X__isthreaded != 0) {
 71935  			return int32((*FILE)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).Ff)).F_file)
 71936  		}
 71937  		return libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 71938  	}(), bp /* &buf */)
 71939  	if rc == 0 {
 71940  		return int64((*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size)
 71941  	}
 71942  	return int64(-1)
 71943  }
 71944  
 71945  // Return the size of the file, as it is known to the quota subsystem.
 71946  func sqlite3_quota_file_size(tls *libc.TLS, p uintptr) sqlite3_int64 { /* test_quota.c:1203:15: */
 71947  	if (*quota_FILE)(unsafe.Pointer(p)).FpFile != 0 {
 71948  		return (*quotaFile)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).FpFile)).FiSize
 71949  	}
 71950  	return int64(-1)
 71951  }
 71952  
 71953  // Determine the amount of data in bytes available for reading
 71954  // in the given file.
 71955  func sqlite3_quota_file_available(tls *libc.TLS, p uintptr) int64 { /* test_quota.c:1211:6: */
 71956  	var f uintptr = (*quota_FILE)(unsafe.Pointer(p)).Ff
 71957  	var pos1 int64
 71958  	var pos2 int64
 71959  	var rc int32
 71960  	pos1 = libc.Xftell(tls, f)
 71961  	if pos1 < int64(0) {
 71962  		return int64(-1)
 71963  	}
 71964  	rc = libc.Xfseek(tls, f, int64(0), SEEK_END)
 71965  	if rc != 0 {
 71966  		return int64(-1)
 71967  	}
 71968  	pos2 = libc.Xftell(tls, f)
 71969  	if pos2 < int64(0) {
 71970  		return int64(-1)
 71971  	}
 71972  	rc = libc.Xfseek(tls, f, pos1, SEEK_SET)
 71973  	if rc != 0 {
 71974  		return int64(-1)
 71975  	}
 71976  	return (pos2 - pos1)
 71977  }
 71978  
 71979  // Remove a managed file.  Update quotas accordingly.
 71980  func sqlite3_quota_remove(tls *libc.TLS, zFilename uintptr) int32 { /* test_quota.c:1229:5: */
 71981  	var zFull uintptr     // Full pathname for zFilename
 71982  	var nFull size_t      // Number of bytes in zFilename
 71983  	var rc int32          // Result code
 71984  	var pGroup uintptr    // Group containing zFilename
 71985  	var pFile uintptr     // A file in the group
 71986  	var pNextFile uintptr // next file in the group
 71987  	var diff int32        // Difference between filenames
 71988  	var c int8            // First character past end of pattern
 71989  
 71990  	zFull = sqlite3.Xsqlite3_malloc(tls, (gQuota.FsThisVfs.FmxPathname + 1))
 71991  	if zFull == uintptr(0) {
 71992  		return SQLITE_NOMEM
 71993  	}
 71994  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 64 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 71995  		(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 71996  	if rc != 0 {
 71997  		sqlite3.Xsqlite3_free(tls, zFull)
 71998  		return rc
 71999  	}
 72000  
 72001  	// Figure out the length of the full pathname.  If the name ends with
 72002  	// / (or \ on windows) then remove the trailing /.
 72003  	nFull = libc.Xstrlen(tls, zFull)
 72004  	if (nFull > uint64(0)) && ((int32(*(*int8)(unsafe.Pointer(zFull + uintptr((nFull - uint64(1)))))) == '/') || (int32(*(*int8)(unsafe.Pointer(zFull + uintptr((nFull - uint64(1)))))) == '\\')) {
 72005  		nFull--
 72006  		*(*int8)(unsafe.Pointer(zFull + uintptr(nFull))) = int8(0)
 72007  	}
 72008  
 72009  	quotaEnter(tls)
 72010  	pGroup = quotaGroupFind(tls, zFull)
 72011  	if pGroup != 0 {
 72012  		for pFile = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles; (pFile != 0) && (rc == SQLITE_OK); pFile = pNextFile {
 72013  			pNextFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 72014  			diff = libc.Xstrncmp(tls, zFull, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, nFull)
 72015  			if (diff == 0) && ((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FzFilename + uintptr(nFull)))))) == 0) || (int32(c) == '/')) || (int32(c) == '\\')) {
 72016  				if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 72017  					(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = 1
 72018  				} else {
 72019  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 48 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 72020  					quotaRemoveFile(tls, pFile)
 72021  					quotaGroupDeref(tls, pGroup)
 72022  				}
 72023  			}
 72024  		}
 72025  	}
 72026  	quotaLeave(tls)
 72027  	sqlite3.Xsqlite3_free(tls, zFull)
 72028  	return rc
 72029  }
 72030  
 72031  // end block for C++
 72032  
 72033  // Local Variables:
 72034  // mode: c
 72035  // c-basic-offset: 4
 72036  // fill-column: 78
 72037  // End:
 72038  
 72039  // Argument passed to a TCL quota-over-limit callback.
 72040  type TclQuotaCallback1 = struct {
 72041  	Finterp  uintptr
 72042  	FpScript uintptr
 72043  } /* test_quota.c:1293:9 */
 72044  
 72045  // end block for C++
 72046  
 72047  // Local Variables:
 72048  // mode: c
 72049  // c-basic-offset: 4
 72050  // fill-column: 78
 72051  // End:
 72052  
 72053  // Argument passed to a TCL quota-over-limit callback.
 72054  type TclQuotaCallback = TclQuotaCallback1 /* test_quota.c:1293:33 */
 72055  
 72056  // This is the callback from a quota-over-limit.
 72057  func tclQuotaCallback(tls *libc.TLS, zFilename uintptr, piLimit uintptr, iSize sqlite3_int64, pArg uintptr) { /* test_quota.c:1305:13: */
 72058  	bp := tls.Alloc(16)
 72059  	defer tls.Free(16)
 72060  
 72061  	var p uintptr        // Callback script object
 72062  	var pEval uintptr    // Script to evaluate
 72063  	var pVarname uintptr // Name of variable to pass as 2nd arg
 72064  	// var rnd uint32 at bp, 4
 72065  	// Random part of pVarname
 72066  	var rc int32 // Tcl error code
 72067  
 72068  	p = pArg
 72069  	if p == uintptr(0) {
 72070  		return
 72071  	}
 72072  
 72073  	pVarname = tcl.XTcl_NewStringObj(tls, ts+36057 /* "::piLimit_" */, -1)
 72074  	(*Tcl_Obj)(unsafe.Pointer(pVarname)).FrefCount++
 72075  	sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(uint32(0))), bp /* &rnd */)
 72076  	tcl.XTcl_AppendObjToObj(tls, pVarname, tcl.XTcl_NewIntObj(tls, (int32(*(*uint32)(unsafe.Pointer(bp /* rnd */))&uint32(0x7FFFFFFF)))))
 72077  	tcl.XTcl_ObjSetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pVarname, uintptr(0), tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(piLimit))), 0)
 72078  
 72079  	pEval = tcl.XTcl_DuplicateObj(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).FpScript)
 72080  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 72081  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, zFilename, -1))
 72082  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pVarname)
 72083  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewWideIntObj(tls, iSize))
 72084  	rc = tcl.XTcl_EvalObjEx(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 72085  
 72086  	if rc == TCL_OK {
 72087  		// var x Tcl_WideInt at bp+8, 8
 72088  
 72089  		var pLimit uintptr = tcl.XTcl_ObjGetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pVarname, uintptr(0), 0)
 72090  		rc = tcl.XTcl_GetWideIntFromObj(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pLimit, bp+8 /* &x */)
 72091  		*(*sqlite3_int64)(unsafe.Pointer(piLimit)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* x */))
 72092  		tcl.XTcl_UnsetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetString(tls, pVarname), uintptr(0), 0)
 72093  	}
 72094  
 72095  	for ok := true; ok; ok = 0 != 0 {
 72096  		var _objPtr uintptr = pEval
 72097  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 72098  			tcl.XTclFreeObj(tls, _objPtr)
 72099  		}
 72100  	}
 72101  	for ok1 := true; ok1; ok1 = 0 != 0 {
 72102  		var _objPtr uintptr = pVarname
 72103  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 72104  			tcl.XTclFreeObj(tls, _objPtr)
 72105  		}
 72106  	}
 72107  	if rc != TCL_OK {
 72108  		tcl.XTcl_BackgroundError(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp)
 72109  	}
 72110  }
 72111  
 72112  // Destructor for a TCL quota-over-limit callback.
 72113  func tclCallbackDestructor(tls *libc.TLS, pObj uintptr) { /* test_quota.c:1349:13: */
 72114  	var p uintptr = pObj
 72115  	if p != 0 {
 72116  		for ok := true; ok; ok = 0 != 0 {
 72117  			var _objPtr uintptr = (*TclQuotaCallback)(unsafe.Pointer(p)).FpScript
 72118  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 72119  				tcl.XTclFreeObj(tls, _objPtr)
 72120  			}
 72121  		}
 72122  		sqlite3.Xsqlite3_free(tls, p)
 72123  	}
 72124  }
 72125  
 72126  // tclcmd: sqlite3_quota_initialize NAME MAKEDEFAULT
 72127  func test_quota_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1360:26: */
 72128  	bp := tls.Alloc(4)
 72129  	defer tls.Free(4)
 72130  
 72131  	var zName uintptr // Name of new quota VFS
 72132  	// var makeDefault int32 at bp, 4
 72133  	// True to make the new VFS the default
 72134  	var rc int32 // Value returned by quota_initialize()
 72135  
 72136  	// Process arguments
 72137  	if objc != 3 {
 72138  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34946 /* "NAME MAKEDEFAULT" */)
 72139  		return TCL_ERROR
 72140  	}
 72141  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72142  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &makeDefault */) != 0 {
 72143  		return TCL_ERROR
 72144  	}
 72145  	if int32(*(*int8)(unsafe.Pointer(zName))) == 0 {
 72146  		zName = uintptr(0)
 72147  	}
 72148  
 72149  	// Call sqlite3_quota_initialize()
 72150  	rc = sqlite3_quota_initialize(tls, zName, *(*int32)(unsafe.Pointer(bp /* makeDefault */)))
 72151  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 72152  
 72153  	return TCL_OK
 72154  }
 72155  
 72156  // tclcmd: sqlite3_quota_shutdown
 72157  func test_quota_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1389:26: */
 72158  	var rc int32 // Value returned by quota_shutdown()
 72159  
 72160  	if objc != 1 {
 72161  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 72162  		return TCL_ERROR
 72163  	}
 72164  
 72165  	// Call sqlite3_quota_shutdown()
 72166  	rc = sqlite3_quota_shutdown(tls)
 72167  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 72168  
 72169  	return TCL_OK
 72170  }
 72171  
 72172  // tclcmd: sqlite3_quota_set PATTERN LIMIT SCRIPT
 72173  func test_quota_set(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1412:26: */
 72174  	bp := tls.Alloc(12)
 72175  	defer tls.Free(12)
 72176  
 72177  	var zPattern uintptr // File pattern to configure
 72178  	// var iLimit Tcl_WideInt at bp, 8
 72179  	// Initial quota in bytes
 72180  	var pScript uintptr // Tcl script to invoke to increase quota
 72181  	var rc int32        // Value returned by quota_set()
 72182  	var p uintptr       // Callback object
 72183  	// var nScript int32 at bp+8, 4
 72184  	// Length of callback script
 72185  	var xDestroy uintptr // Optional destructor for pArg
 72186  	var xCallback uintptr
 72187  
 72188  	// Process arguments
 72189  	if objc != 4 {
 72190  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36068 /* "PATTERN LIMIT SC..." */)
 72191  		return TCL_ERROR
 72192  	}
 72193  	zPattern = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72194  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &iLimit */) != 0 {
 72195  		return TCL_ERROR
 72196  	}
 72197  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*8))
 72198  	tcl.XTcl_GetStringFromObj(tls, pScript, bp+8 /* &nScript */)
 72199  
 72200  	if *(*int32)(unsafe.Pointer(bp + 8 /* nScript */)) > 0 {
 72201  		// Allocate a TclQuotaCallback object
 72202  		p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(TclQuotaCallback{})))
 72203  		if !(p != 0) {
 72204  			tcl.XTcl_SetResult(tls, interp, ts+32944 /* "SQLITE_NOMEM" */, uintptr(0))
 72205  			return TCL_OK
 72206  		}
 72207  		libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(TclQuotaCallback{})))
 72208  		(*TclQuotaCallback)(unsafe.Pointer(p)).Finterp = interp
 72209  		(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 72210  		(*TclQuotaCallback)(unsafe.Pointer(p)).FpScript = pScript
 72211  		xDestroy = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tclCallbackDestructor}))
 72212  		xCallback = *(*uintptr)(unsafe.Pointer(&struct {
 72213  			f func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr)
 72214  		}{tclQuotaCallback}))
 72215  	} else {
 72216  		p = uintptr(0)
 72217  		xDestroy = uintptr(0)
 72218  		xCallback = uintptr(0)
 72219  	}
 72220  
 72221  	// Invoke sqlite3_quota_set()
 72222  	rc = sqlite3_quota_set(tls, zPattern, *(*Tcl_WideInt)(unsafe.Pointer(bp /* iLimit */)), xCallback, p, xDestroy)
 72223  
 72224  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 72225  	return TCL_OK
 72226  }
 72227  
 72228  // tclcmd: sqlite3_quota_file FILENAME
 72229  func test_quota_file(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1466:26: */
 72230  	var zFilename uintptr // File pattern to configure
 72231  	var rc int32          // Value returned by quota_file()
 72232  
 72233  	// Process arguments
 72234  	if objc != 2 {
 72235  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 72236  		return TCL_ERROR
 72237  	}
 72238  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72239  
 72240  	// Invoke sqlite3_quota_file()
 72241  	rc = sqlite3_quota_file(tls, zFilename)
 72242  
 72243  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 72244  	return TCL_OK
 72245  }
 72246  
 72247  // tclcmd:  sqlite3_quota_dump
 72248  func test_quota_dump(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1492:26: */
 72249  	bp := tls.Alloc(1008)
 72250  	defer tls.Free(1008)
 72251  
 72252  	var pResult uintptr
 72253  	var pGroupTerm uintptr
 72254  	var pFileTerm uintptr
 72255  	var pGroup uintptr
 72256  	var pFile uintptr
 72257  
 72258  	pResult = tcl.XTcl_NewObj(tls)
 72259  	quotaEnter(tls)
 72260  	for pGroup = gQuota.FpGroup; pGroup != 0; pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext {
 72261  		pGroupTerm = tcl.XTcl_NewObj(tls)
 72262  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 72263  			tcl.XTcl_NewStringObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, -1))
 72264  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 72265  			tcl.XTcl_NewWideIntObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit))
 72266  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 72267  			tcl.XTcl_NewWideIntObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FiSize))
 72268  		for pFile = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles; pFile != 0; pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext {
 72269  			var i int32
 72270  			// var zTemp [1000]int8 at bp+8, 1000
 72271  
 72272  			pFileTerm = tcl.XTcl_NewObj(tls)
 72273  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([1000]int8{})), bp+8 /* &zTemp[0] */, ts /* "%s" */, libc.VaList(bp, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename))
 72274  			for i = 0; *(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i))) != 0; i++ {
 72275  				if int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i)))) == '\\' {
 72276  					*(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i))) = int8('/')
 72277  				}
 72278  			}
 72279  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 72280  				tcl.XTcl_NewStringObj(tls, bp+8 /* &zTemp[0] */, -1))
 72281  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 72282  				tcl.XTcl_NewWideIntObj(tls, (*quotaFile)(unsafe.Pointer(pFile)).FiSize))
 72283  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 72284  				tcl.XTcl_NewWideIntObj(tls, int64((*quotaFile)(unsafe.Pointer(pFile)).FnRef)))
 72285  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 72286  				tcl.XTcl_NewWideIntObj(tls, int64((*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose)))
 72287  			tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm, pFileTerm)
 72288  		}
 72289  		tcl.XTcl_ListObjAppendElement(tls, interp, pResult, pGroupTerm)
 72290  	}
 72291  	quotaLeave(tls)
 72292  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 72293  	return TCL_OK
 72294  }
 72295  
 72296  // tclcmd: sqlite3_quota_fopen FILENAME MODE
 72297  func test_quota_fopen(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1540:26: */
 72298  	bp := tls.Alloc(58)
 72299  	defer tls.Free(58)
 72300  
 72301  	var zFilename uintptr // File pattern to configure
 72302  	var zMode uintptr     // Mode string
 72303  	var p uintptr         // Open string object
 72304  	// var zReturn [50]int8 at bp+8, 50
 72305  	// Name of pointer to return
 72306  
 72307  	// Process arguments
 72308  	if objc != 3 {
 72309  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36089 /* "FILENAME MODE" */)
 72310  		return TCL_ERROR
 72311  	}
 72312  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72313  	zMode = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 72314  	p = sqlite3_quota_fopen(tls, zFilename, zMode)
 72315  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+8 /* &zReturn[0] */, ts+13802 /* "%p" */, libc.VaList(bp, p))
 72316  	tcl.XTcl_SetResult(tls, interp, bp+8 /* &zReturn[0] */, uintptr(1))
 72317  	return TCL_OK
 72318  }
 72319  
 72320  // tclcmd: sqlite3_quota_fread HANDLE SIZE NELEM
 72321  func test_quota_fread(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1570:26: */
 72322  	bp := tls.Alloc(8)
 72323  	defer tls.Free(8)
 72324  
 72325  	var p uintptr
 72326  	var zBuf uintptr
 72327  	// var sz int32 at bp, 4
 72328  
 72329  	// var nElem int32 at bp+4, 4
 72330  
 72331  	var got size_t
 72332  
 72333  	if objc != 4 {
 72334  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36103 /* "HANDLE SIZE NELE..." */)
 72335  		return TCL_ERROR
 72336  	}
 72337  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72338  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &sz */) != 0 {
 72339  		return TCL_ERROR
 72340  	}
 72341  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+4 /* &nElem */) != 0 {
 72342  		return TCL_ERROR
 72343  	}
 72344  	zBuf = sqlite3.Xsqlite3_malloc(tls, ((*(*int32)(unsafe.Pointer(bp /* sz */)) * *(*int32)(unsafe.Pointer(bp + 4 /* nElem */))) + 1))
 72345  	if zBuf == uintptr(0) {
 72346  		tcl.XTcl_SetResult(tls, interp, ts+1930 /* "out of memory" */, uintptr(0))
 72347  		return TCL_ERROR
 72348  	}
 72349  	got = sqlite3_quota_fread(tls, zBuf, uint64(*(*int32)(unsafe.Pointer(bp /* sz */))), uint64(*(*int32)(unsafe.Pointer(bp + 4 /* nElem */))), p)
 72350  	*(*int8)(unsafe.Pointer(zBuf + uintptr((got * size_t(*(*int32)(unsafe.Pointer(bp /* sz */))))))) = int8(0)
 72351  	tcl.XTcl_SetResult(tls, interp, zBuf, uintptr(1))
 72352  	sqlite3.Xsqlite3_free(tls, zBuf)
 72353  	return TCL_OK
 72354  }
 72355  
 72356  // tclcmd: sqlite3_quota_fwrite HANDLE SIZE NELEM CONTENT
 72357  func test_quota_fwrite(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1604:26: */
 72358  	bp := tls.Alloc(8)
 72359  	defer tls.Free(8)
 72360  
 72361  	var p uintptr
 72362  	var zBuf uintptr
 72363  	// var sz int32 at bp, 4
 72364  
 72365  	// var nElem int32 at bp+4, 4
 72366  
 72367  	var got size_t
 72368  
 72369  	if objc != 5 {
 72370  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36121 /* "HANDLE SIZE NELE..." */)
 72371  		return TCL_ERROR
 72372  	}
 72373  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72374  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &sz */) != 0 {
 72375  		return TCL_ERROR
 72376  	}
 72377  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+4 /* &nElem */) != 0 {
 72378  		return TCL_ERROR
 72379  	}
 72380  	zBuf = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 72381  	got = sqlite3_quota_fwrite(tls, zBuf, uint64(*(*int32)(unsafe.Pointer(bp /* sz */))), uint64(*(*int32)(unsafe.Pointer(bp + 4 /* nElem */))), p)
 72382  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(got)))
 72383  	return TCL_OK
 72384  }
 72385  
 72386  // tclcmd: sqlite3_quota_fclose HANDLE
 72387  func test_quota_fclose(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1632:26: */
 72388  	var p uintptr
 72389  	var rc int32
 72390  
 72391  	if objc != 2 {
 72392  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72393  		return TCL_ERROR
 72394  	}
 72395  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72396  	rc = sqlite3_quota_fclose(tls, p)
 72397  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72398  	return TCL_OK
 72399  }
 72400  
 72401  // tclcmd: sqlite3_quota_fflush HANDLE ?HARDSYNC?
 72402  func test_quota_fflush(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1654:26: */
 72403  	bp := tls.Alloc(4)
 72404  	defer tls.Free(4)
 72405  
 72406  	var p uintptr
 72407  	var rc int32
 72408  	*(*int32)(unsafe.Pointer(bp /* doSync */)) = 0
 72409  
 72410  	if (objc != 2) && (objc != 3) {
 72411  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36147 /* "HANDLE ?HARDSYNC..." */)
 72412  		return TCL_ERROR
 72413  	}
 72414  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72415  	if objc == 3 {
 72416  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &doSync */) != 0 {
 72417  			return TCL_ERROR
 72418  		}
 72419  	}
 72420  	rc = sqlite3_quota_fflush(tls, p, *(*int32)(unsafe.Pointer(bp /* doSync */)))
 72421  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72422  	return TCL_OK
 72423  }
 72424  
 72425  // tclcmd: sqlite3_quota_fseek HANDLE OFFSET WHENCE
 72426  func test_quota_fseek(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1680:26: */
 72427  	bp := tls.Alloc(20)
 72428  	defer tls.Free(20)
 72429  
 72430  	var p uintptr
 72431  	// var ofst int32 at bp+16, 4
 72432  
 72433  	var zWhence uintptr
 72434  	var whence int32
 72435  	var rc int32
 72436  
 72437  	if objc != 4 {
 72438  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36165 /* "HANDLE OFFSET WH..." */)
 72439  		return TCL_ERROR
 72440  	}
 72441  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72442  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+16 /* &ofst */) != 0 {
 72443  		return TCL_ERROR
 72444  	}
 72445  	zWhence = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 72446  	if libc.Xstrcmp(tls, zWhence, ts+36186 /* "SEEK_SET" */) == 0 {
 72447  		whence = SEEK_SET
 72448  	} else if libc.Xstrcmp(tls, zWhence, ts+36195 /* "SEEK_CUR" */) == 0 {
 72449  		whence = SEEK_CUR
 72450  	} else if libc.Xstrcmp(tls, zWhence, ts+36204 /* "SEEK_END" */) == 0 {
 72451  		whence = SEEK_END
 72452  	} else {
 72453  		tcl.XTcl_AppendResult(tls, interp,
 72454  			libc.VaList(bp, ts+36213 /* "WHENCE should be..." */, uintptr(0)))
 72455  		return TCL_ERROR
 72456  	}
 72457  	rc = sqlite3_quota_fseek(tls, p, int64(*(*int32)(unsafe.Pointer(bp + 16 /* ofst */))), whence)
 72458  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72459  	return TCL_OK
 72460  }
 72461  
 72462  // tclcmd: sqlite3_quota_rewind HANDLE
 72463  func test_quota_rewind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1718:26: */
 72464  	var p uintptr
 72465  	if objc != 2 {
 72466  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72467  		return TCL_ERROR
 72468  	}
 72469  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72470  	sqlite3_quota_rewind(tls, p)
 72471  	return TCL_OK
 72472  }
 72473  
 72474  // tclcmd: sqlite3_quota_ftell HANDLE
 72475  func test_quota_ftell(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1737:26: */
 72476  	var p uintptr
 72477  	var x sqlite3_int64
 72478  	if objc != 2 {
 72479  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72480  		return TCL_ERROR
 72481  	}
 72482  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72483  	x = sqlite3_int64(sqlite3_quota_ftell(tls, p))
 72484  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 72485  	return TCL_OK
 72486  }
 72487  
 72488  // tclcmd: sqlite3_quota_ftruncate HANDLE SIZE
 72489  func test_quota_ftruncate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1758:26: */
 72490  	bp := tls.Alloc(8)
 72491  	defer tls.Free(8)
 72492  
 72493  	var p uintptr
 72494  	var x sqlite3_int64
 72495  	// var w Tcl_WideInt at bp, 8
 72496  
 72497  	var rc int32
 72498  	if objc != 3 {
 72499  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36262 /* "HANDLE SIZE" */)
 72500  		return TCL_ERROR
 72501  	}
 72502  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72503  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &w */) != 0 {
 72504  		return TCL_ERROR
 72505  	}
 72506  	x = *(*Tcl_WideInt)(unsafe.Pointer(bp /* w */))
 72507  	rc = sqlite3_quota_ftruncate(tls, p, x)
 72508  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72509  	return TCL_OK
 72510  }
 72511  
 72512  // tclcmd: sqlite3_quota_file_size HANDLE
 72513  func test_quota_file_size(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1783:26: */
 72514  	var p uintptr
 72515  	var x sqlite3_int64
 72516  	if objc != 2 {
 72517  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72518  		return TCL_ERROR
 72519  	}
 72520  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72521  	x = sqlite3_quota_file_size(tls, p)
 72522  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 72523  	return TCL_OK
 72524  }
 72525  
 72526  // tclcmd: sqlite3_quota_file_truesize HANDLE
 72527  func test_quota_file_truesize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1804:26: */
 72528  	var p uintptr
 72529  	var x sqlite3_int64
 72530  	if objc != 2 {
 72531  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72532  		return TCL_ERROR
 72533  	}
 72534  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72535  	x = sqlite3_quota_file_truesize(tls, p)
 72536  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 72537  	return TCL_OK
 72538  }
 72539  
 72540  // tclcmd: sqlite3_quota_file_mtime HANDLE
 72541  func test_quota_file_mtime(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1825:26: */
 72542  	bp := tls.Alloc(8)
 72543  	defer tls.Free(8)
 72544  
 72545  	var p uintptr
 72546  	// var t time_t at bp, 8
 72547  
 72548  	if objc != 2 {
 72549  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72550  		return TCL_ERROR
 72551  	}
 72552  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72553  	*(*time_t)(unsafe.Pointer(bp /* t */)) = int64(0)
 72554  	sqlite3_quota_file_mtime(tls, p, bp /* &t */)
 72555  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(*(*time_t)(unsafe.Pointer(bp /* t */)))))
 72556  	return TCL_OK
 72557  }
 72558  
 72559  // tclcmd: sqlite3_quota_remove FILENAME
 72560  func test_quota_remove(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1848:26: */
 72561  	var zFilename uintptr // File pattern to configure
 72562  	var rc int32
 72563  	if objc != 2 {
 72564  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 72565  		return TCL_ERROR
 72566  	}
 72567  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72568  	rc = sqlite3_quota_remove(tls, zFilename)
 72569  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72570  	return TCL_OK
 72571  }
 72572  
 72573  // tclcmd: sqlite3_quota_glob PATTERN TEXT
 72574  //
 72575  // Test the glob pattern matching.  Return 1 if TEXT matches PATTERN
 72576  // and return 0 if it does not.
 72577  func test_quota_glob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1872:26: */
 72578  	var zPattern uintptr // The glob pattern
 72579  	var zText uintptr    // Text to compare agains the pattern
 72580  	var rc int32
 72581  	if objc != 3 {
 72582  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36274 /* "PATTERN TEXT" */)
 72583  		return TCL_ERROR
 72584  	}
 72585  	zPattern = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 72586  	zText = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 72587  	rc = quotaStrglob(tls, zPattern, zText)
 72588  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 72589  	return TCL_OK
 72590  }
 72591  
 72592  // tclcmd: sqlite3_quota_file_available HANDLE
 72593  //
 72594  // Return the number of bytes from the current file point to the end of
 72595  // the file.
 72596  func test_quota_file_available(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1898:26: */
 72597  	var p uintptr
 72598  	var x sqlite3_int64
 72599  	if objc != 2 {
 72600  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72601  		return TCL_ERROR
 72602  	}
 72603  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72604  	x = sqlite3_int64(sqlite3_quota_file_available(tls, p))
 72605  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 72606  	return TCL_OK
 72607  }
 72608  
 72609  // tclcmd: sqlite3_quota_ferror HANDLE
 72610  //
 72611  // Return true if the file handle is in the error state.
 72612  func test_quota_ferror(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1921:26: */
 72613  	var p uintptr
 72614  	var x int32
 72615  	if objc != 2 {
 72616  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 72617  		return TCL_ERROR
 72618  	}
 72619  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 72620  	x = sqlite3_quota_ferror(tls, p)
 72621  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, x))
 72622  	return TCL_OK
 72623  }
 72624  
 72625  // This routine registers the custom TCL commands defined in this
 72626  // module.  This should be the only procedure visible from outside
 72627  // of this module.
 72628  func Sqlitequota_Init(tls *libc.TLS, interp uintptr) int32 { /* test_quota.c:1944:5: */
 72629  	var i int32
 72630  
 72631  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aCmd9)) / uint64(unsafe.Sizeof(struct {
 72632  		FzName uintptr
 72633  		FxProc uintptr
 72634  	}{}))); i++ {
 72635  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd9[i].FzName, aCmd9[i].FxProc, uintptr(0), uintptr(0))
 72636  	}
 72637  
 72638  	return TCL_OK
 72639  }
 72640  
 72641  var aCmd9 = [21]struct {
 72642  	FzName uintptr
 72643  	FxProc uintptr
 72644  }{
 72645  	{FzName: ts + 36287 /* "sqlite3_quota_in..." */, FxProc: 0},
 72646  	{FzName: ts + 36312 /* "sqlite3_quota_sh..." */, FxProc: 0},
 72647  	{FzName: ts + 36335 /* "sqlite3_quota_se..." */, FxProc: 0},
 72648  	{FzName: ts + 36353 /* "sqlite3_quota_fi..." */, FxProc: 0},
 72649  	{FzName: ts + 36372 /* "sqlite3_quota_du..." */, FxProc: 0},
 72650  	{FzName: ts + 36391 /* "sqlite3_quota_fo..." */, FxProc: 0},
 72651  	{FzName: ts + 36411 /* "sqlite3_quota_fr..." */, FxProc: 0},
 72652  	{FzName: ts + 36431 /* "sqlite3_quota_fw..." */, FxProc: 0},
 72653  	{FzName: ts + 36452 /* "sqlite3_quota_fc..." */, FxProc: 0},
 72654  	{FzName: ts + 36473 /* "sqlite3_quota_ff..." */, FxProc: 0},
 72655  	{FzName: ts + 36494 /* "sqlite3_quota_fs..." */, FxProc: 0},
 72656  	{FzName: ts + 36514 /* "sqlite3_quota_re..." */, FxProc: 0},
 72657  	{FzName: ts + 36535 /* "sqlite3_quota_ft..." */, FxProc: 0},
 72658  	{FzName: ts + 36555 /* "sqlite3_quota_ft..." */, FxProc: 0},
 72659  	{FzName: ts + 36579 /* "sqlite3_quota_fi..." */, FxProc: 0},
 72660  	{FzName: ts + 36603 /* "sqlite3_quota_fi..." */, FxProc: 0},
 72661  	{FzName: ts + 36631 /* "sqlite3_quota_fi..." */, FxProc: 0},
 72662  	{FzName: ts + 36656 /* "sqlite3_quota_re..." */, FxProc: 0},
 72663  	{FzName: ts + 36677 /* "sqlite3_quota_gl..." */, FxProc: 0},
 72664  	{FzName: ts + 36696 /* "sqlite3_quota_fi..." */, FxProc: 0},
 72665  	{FzName: ts + 36725 /* "sqlite3_quota_fe..." */, FxProc: 0},
 72666  } /* test_quota.c:1948:5 */
 72667  
 72668  // Type used to cache parameter information for the "circle" r-tree geometry
 72669  // callback.
 72670  type Circle1 = struct {
 72671  	FaBox [2]struct {
 72672  		Fxmin float64
 72673  		Fxmax float64
 72674  		Fymin float64
 72675  		Fymax float64
 72676  	}
 72677  	Fcenterx    float64
 72678  	Fcentery    float64
 72679  	Fradius     float64
 72680  	FmxArea     float64
 72681  	FeScoreType int32
 72682  	_           [4]byte
 72683  } /* test_rtree.c:31:9 */
 72684  
 72685  // Type used to cache parameter information for the "circle" r-tree geometry
 72686  // callback.
 72687  type Circle = Circle1 /* test_rtree.c:31:23 */
 72688  type Box = struct {
 72689  	Fxmin float64
 72690  	Fxmax float64
 72691  	Fymin float64
 72692  	Fymax float64
 72693  } /* test_rtree.c:31:9 */
 72694  
 72695  // Destructor function for Circle objects allocated by circle_geom().
 72696  func circle_del(tls *libc.TLS, p uintptr) { /* test_rtree.c:49:13: */
 72697  	sqlite3.Xsqlite3_free(tls, p)
 72698  }
 72699  
 72700  // Implementation of "circle" r-tree geometry callback.
 72701  func circle_geom(tls *libc.TLS, p uintptr, nCoord int32, aCoord uintptr, pRes uintptr) int32 { /* test_rtree.c:56:12: */
 72702  	var i int32         // Iterator variable
 72703  	var pCircle uintptr // Structure defining circular region
 72704  	var xmin float64
 72705  	var xmax float64 // X dimensions of box being tested
 72706  	var ymin float64
 72707  	var ymax float64 // X dimensions of box being tested
 72708  
 72709  	xmin = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord))
 72710  	xmax = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 1*8))
 72711  	ymin = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 2*8))
 72712  	ymax = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 3*8))
 72713  	pCircle = (*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser
 72714  	if pCircle == uintptr(0) {
 72715  		// If pUser is still 0, then the parameter values have not been tested
 72716  		// for correctness or stored into a Circle structure yet. Do this now.
 72717  
 72718  		// This geometry callback is for use with a 2-dimensional r-tree table.
 72719  		// Return an error if the table does not have exactly 2 dimensions.
 72720  		if nCoord != 4 {
 72721  			return SQLITE_ERROR
 72722  		}
 72723  
 72724  		// Test that the correct number of parameters (3) have been supplied,
 72725  		// and that the parameters are in range (that the radius of the circle
 72726  		// radius is greater than zero).
 72727  		if ((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FnParam != 3) || (*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 2*8)) < 0.0) {
 72728  			return SQLITE_ERROR
 72729  		}
 72730  
 72731  		// Allocate a structure to cache parameter data in. Return SQLITE_NOMEM
 72732  		// if the allocation fails.
 72733  		pCircle = libc.AssignPtrUintptr(p+24 /* &.pUser */, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Circle{}))))
 72734  		if !(pCircle != 0) {
 72735  			return SQLITE_NOMEM
 72736  		}
 72737  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{circle_del}))
 72738  
 72739  		// Record the center and radius of the circular region. One way that
 72740  		// tested bounding boxes that intersect the circular region are detected
 72741  		// is by testing if each corner of the bounding box lies within radius
 72742  		// units of the center of the circle.
 72743  		(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam))
 72744  		(*Circle)(unsafe.Pointer(pCircle)).Fcentery = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 1*8))
 72745  		(*Circle)(unsafe.Pointer(pCircle)).Fradius = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 2*8))
 72746  
 72747  		// Define two bounding box regions. The first, aBox[0], extends to
 72748  		// infinity in the X dimension. It covers the same range of the Y dimension
 72749  		// as the circular region. The second, aBox[1], extends to infinity in
 72750  		// the Y dimension and is constrained to the range of the circle in the
 72751  		// X dimension.
 72752  		//
 72753  		// Then imagine each box is split in half along its short axis by a line
 72754  		// that intersects the center of the circular region. A bounding box
 72755  		// being tested can be said to intersect the circular region if it contains
 72756  		// points from each half of either of the two infinite bounding boxes.
 72757  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmin = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 72758  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmax = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 72759  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymin = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72760  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymax = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72761  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmin = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72762  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmax = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72763  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymin = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 72764  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymax = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 72765  		(*Circle)(unsafe.Pointer(pCircle)).FmxArea = (((xmax - xmin) * (ymax - ymin)) + 1.0)
 72766  	}
 72767  
 72768  	// Check if any of the 4 corners of the bounding-box being tested lie
 72769  	// inside the circular region. If they do, then the bounding-box does
 72770  	// intersect the region of interest. Set the output variable to true and
 72771  	// return SQLITE_OK in this case.
 72772  	for i = 0; i < 4; i++ {
 72773  		var x float64
 72774  		if (i & 0x01) != 0 {
 72775  			x = xmax
 72776  		} else {
 72777  			x = xmin
 72778  		}
 72779  		var y float64
 72780  		if (i & 0x02) != 0 {
 72781  			y = ymax
 72782  		} else {
 72783  			y = ymin
 72784  		}
 72785  		var d2 float64
 72786  
 72787  		d2 = ((x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx) * (x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx))
 72788  		d2 = d2 + ((y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery) * (y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery))
 72789  		if d2 < ((*Circle)(unsafe.Pointer(pCircle)).Fradius * (*Circle)(unsafe.Pointer(pCircle)).Fradius) {
 72790  			*(*int32)(unsafe.Pointer(pRes)) = 1
 72791  			return SQLITE_OK
 72792  		}
 72793  	}
 72794  
 72795  	// Check if the bounding box covers any other part of the circular region.
 72796  	// See comments above for a description of how this test works. If it does
 72797  	// cover part of the circular region, set the output variable to true
 72798  	// and return SQLITE_OK.
 72799  	for i = 0; i < 2; i++ {
 72800  		if (((xmin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmin) &&
 72801  			(xmax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmax)) &&
 72802  			(ymin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymin)) &&
 72803  			(ymax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymax) {
 72804  			*(*int32)(unsafe.Pointer(pRes)) = 1
 72805  			return SQLITE_OK
 72806  		}
 72807  	}
 72808  
 72809  	// The specified bounding box does not intersect the circular region. Set
 72810  	// the output variable to zero and return SQLITE_OK.
 72811  	*(*int32)(unsafe.Pointer(pRes)) = 0
 72812  	return SQLITE_OK
 72813  }
 72814  
 72815  // Implementation of "circle" r-tree geometry callback using the
 72816  // 2nd-generation interface that allows scoring.
 72817  //
 72818  // Two calling forms:
 72819  //
 72820  //          Qcircle(X,Y,Radius,eType)        -- All values are doubles
 72821  //          Qcircle('x:X y:Y r:R e:ETYPE')   -- Single string parameter
 72822  func circle_query_func(tls *libc.TLS, p uintptr) int32 { /* test_rtree.c:168:12: */
 72823  	var i int32         // Iterator variable
 72824  	var pCircle uintptr // Structure defining circular region
 72825  	var xmin float64
 72826  	var xmax float64 // X dimensions of box being tested
 72827  	var ymin float64
 72828  	var ymax float64      // X dimensions of box being tested
 72829  	var nWithin int32 = 0 // Number of corners inside the circle
 72830  
 72831  	xmin = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord))
 72832  	xmax = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 1*8))
 72833  	ymin = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 2*8))
 72834  	ymax = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 3*8))
 72835  	pCircle = (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FpUser
 72836  	if pCircle == uintptr(0) {
 72837  		// If pUser is still 0, then the parameter values have not been tested
 72838  		// for correctness or stored into a Circle structure yet. Do this now.
 72839  
 72840  		// This geometry callback is for use with a 2-dimensional r-tree table.
 72841  		// Return an error if the table does not have exactly 2 dimensions.
 72842  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnCoord != 4 {
 72843  			return SQLITE_ERROR
 72844  		}
 72845  
 72846  		// Test that the correct number of parameters (1 or 4) have been supplied.
 72847  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 4) && ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 1) {
 72848  			return SQLITE_ERROR
 72849  		}
 72850  
 72851  		// Allocate a structure to cache parameter data in. Return SQLITE_NOMEM
 72852  		// if the allocation fails.
 72853  		pCircle = libc.AssignPtrUintptr(p+24 /* &.pUser */, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Circle{}))))
 72854  		if !(pCircle != 0) {
 72855  			return SQLITE_NOMEM
 72856  		}
 72857  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{circle_del}))
 72858  
 72859  		// Record the center and radius of the circular region. One way that
 72860  		// tested bounding boxes that intersect the circular region are detected
 72861  		// is by testing if each corner of the bounding box lies within radius
 72862  		// units of the center of the circle.
 72863  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam == 4 {
 72864  			(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam))
 72865  			(*Circle)(unsafe.Pointer(pCircle)).Fcentery = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 1*8))
 72866  			(*Circle)(unsafe.Pointer(pCircle)).Fradius = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 2*8))
 72867  			(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = int32(*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 3*8)))
 72868  		} else {
 72869  			var z uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FapSqlParam)))
 72870  			(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = 0.0
 72871  			(*Circle)(unsafe.Pointer(pCircle)).Fcentery = 0.0
 72872  			(*Circle)(unsafe.Pointer(pCircle)).Fradius = 0.0
 72873  			(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = 0
 72874  			for (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) {
 72875  				if (int32(*(*int8)(unsafe.Pointer(z))) == 'r') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 72876  					(*Circle)(unsafe.Pointer(pCircle)).Fradius = libc.Xatof(tls, (z + 2))
 72877  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'x') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 72878  					(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = libc.Xatof(tls, (z + 2))
 72879  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'y') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 72880  					(*Circle)(unsafe.Pointer(pCircle)).Fcentery = libc.Xatof(tls, (z + 2))
 72881  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'e') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 72882  					(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = int32(libc.Xatof(tls, (z + 2)))
 72883  				} else if int32(*(*int8)(unsafe.Pointer(z))) == ' ' {
 72884  					z++
 72885  					continue
 72886  				}
 72887  				for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') {
 72888  					z++
 72889  				}
 72890  				for int32(*(*int8)(unsafe.Pointer(z))) == ' ' {
 72891  					z++
 72892  				}
 72893  			}
 72894  		}
 72895  		if (*Circle)(unsafe.Pointer(pCircle)).Fradius < 0.0 {
 72896  			sqlite3.Xsqlite3_free(tls, pCircle)
 72897  			return SQLITE_NOMEM
 72898  		}
 72899  
 72900  		// Define two bounding box regions. The first, aBox[0], extends to
 72901  		// infinity in the X dimension. It covers the same range of the Y dimension
 72902  		// as the circular region. The second, aBox[1], extends to infinity in
 72903  		// the Y dimension and is constrained to the range of the circle in the
 72904  		// X dimension.
 72905  		//
 72906  		// Then imagine each box is split in half along its short axis by a line
 72907  		// that intersects the center of the circular region. A bounding box
 72908  		// being tested can be said to intersect the circular region if it contains
 72909  		// points from each half of either of the two infinite bounding boxes.
 72910  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmin = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 72911  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmax = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 72912  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymin = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72913  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymax = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72914  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmin = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72915  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmax = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 72916  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymin = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 72917  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymax = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 72918  		(*Circle)(unsafe.Pointer(pCircle)).FmxArea = (float64(200.0) * 200.0)
 72919  	}
 72920  
 72921  	// Check if any of the 4 corners of the bounding-box being tested lie
 72922  	// inside the circular region. If they do, then the bounding-box does
 72923  	// intersect the region of interest. Set the output variable to true and
 72924  	// return SQLITE_OK in this case.
 72925  	for i = 0; i < 4; i++ {
 72926  		var x float64
 72927  		if (i & 0x01) != 0 {
 72928  			x = xmax
 72929  		} else {
 72930  			x = xmin
 72931  		}
 72932  		var y float64
 72933  		if (i & 0x02) != 0 {
 72934  			y = ymax
 72935  		} else {
 72936  			y = ymin
 72937  		}
 72938  		var d2 float64
 72939  
 72940  		d2 = ((x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx) * (x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx))
 72941  		d2 = d2 + ((y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery) * (y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery))
 72942  		if d2 < ((*Circle)(unsafe.Pointer(pCircle)).Fradius * (*Circle)(unsafe.Pointer(pCircle)).Fradius) {
 72943  			nWithin++
 72944  		}
 72945  	}
 72946  
 72947  	// Check if the bounding box covers any other part of the circular region.
 72948  	// See comments above for a description of how this test works. If it does
 72949  	// cover part of the circular region, set the output variable to true
 72950  	// and return SQLITE_OK.
 72951  	if nWithin == 0 {
 72952  		for i = 0; i < 2; i++ {
 72953  			if (((xmin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmin) &&
 72954  				(xmax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmax)) &&
 72955  				(ymin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymin)) &&
 72956  				(ymax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymax) {
 72957  				nWithin = 1
 72958  				break
 72959  			}
 72960  		}
 72961  	}
 72962  
 72963  	if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 1 {
 72964  		// Depth first search
 72965  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = sqlite3_rtree_dbl((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel)
 72966  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 2 {
 72967  		// Breadth first search
 72968  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 72969  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 3 {
 72970  		// Depth-first search, except sort the leaf nodes by area with
 72971  		// the largest area first
 72972  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel == 1 {
 72973  			(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (1.0 - (((xmax - xmin) * (ymax - ymin)) / (*Circle)(unsafe.Pointer(pCircle)).FmxArea))
 72974  			if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore < 0.01 {
 72975  				(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = 0.01
 72976  			}
 72977  		} else {
 72978  			(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = 0.0
 72979  		}
 72980  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 4 {
 72981  		// Depth-first search, except exclude odd rowids
 72982  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = sqlite3_rtree_dbl((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel)
 72983  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiRowid & int64(1)) != 0 {
 72984  			nWithin = 0
 72985  		}
 72986  	} else {
 72987  		// Breadth-first search, except exclude odd rowids
 72988  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 72989  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiRowid & int64(1)) != 0 {
 72990  			nWithin = 0
 72991  		}
 72992  	}
 72993  	if nWithin == 0 {
 72994  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = NOT_WITHIN
 72995  	} else if nWithin >= 4 {
 72996  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 72997  	} else {
 72998  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = PARTLY_WITHIN
 72999  	}
 73000  	return SQLITE_OK
 73001  }
 73002  
 73003  // Implementation of "breadthfirstsearch" r-tree geometry callback using the
 73004  // 2nd-generation interface that allows scoring.
 73005  //
 73006  //     ... WHERE id MATCH breadthfirstsearch($x0,$x1,$y0,$y1) ...
 73007  //
 73008  // It returns all entries whose bounding boxes overlap with $x0,$x1,$y0,$y1.
 73009  func bfs_query_func(tls *libc.TLS, p uintptr) int32 { /* test_rtree.c:329:12: */
 73010  	var x0 float64
 73011  	var x1 float64
 73012  	var y0 float64
 73013  	var y1 float64 // Dimensions of box being tested
 73014  	var bx0 float64
 73015  	var bx1 float64
 73016  	var by0 float64
 73017  	var by1 float64 // Boundary of the query function
 73018  
 73019  	if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 4 {
 73020  		return SQLITE_ERROR
 73021  	}
 73022  	x0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord))
 73023  	x1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 1*8))
 73024  	y0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 2*8))
 73025  	y1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 3*8))
 73026  	bx0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam))
 73027  	bx1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 1*8))
 73028  	by0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 2*8))
 73029  	by1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 3*8))
 73030  	(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 73031  	if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeParentWithin == FULLY_WITHIN {
 73032  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 73033  	} else if (((x0 >= bx0) && (x1 <= bx1)) && (y0 >= by0)) && (y1 <= by1) {
 73034  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 73035  	} else if (((x1 >= bx0) && (x0 <= bx1)) && (y1 >= by0)) && (y0 <= by1) {
 73036  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = PARTLY_WITHIN
 73037  	} else {
 73038  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = NOT_WITHIN
 73039  	}
 73040  	return SQLITE_OK
 73041  }
 73042  
 73043  // END of implementation of "circle" geometry callback.
 73044  //
 73045  //
 73046  
 73047  // -
 73048  // SPDX-License-Identifier: BSD-3-Clause
 73049  //
 73050  // Copyright (c) 1992, 1993
 73051  //	The Regents of the University of California.  All rights reserved.
 73052  // (c) UNIX System Laboratories, Inc.
 73053  // All or some portions of this file are derived from material licensed
 73054  // to the University of California by American Telephone and Telegraph
 73055  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 73056  // the permission of UNIX System Laboratories, Inc.
 73057  //
 73058  // Redistribution and use in source and binary forms, with or without
 73059  // modification, are permitted provided that the following conditions
 73060  // are met:
 73061  // 1. Redistributions of source code must retain the above copyright
 73062  //    notice, this list of conditions and the following disclaimer.
 73063  // 2. Redistributions in binary form must reproduce the above copyright
 73064  //    notice, this list of conditions and the following disclaimer in the
 73065  //    documentation and/or other materials provided with the distribution.
 73066  // 3. Neither the name of the University nor the names of its contributors
 73067  //    may be used to endorse or promote products derived from this software
 73068  //    without specific prior written permission.
 73069  //
 73070  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73071  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73072  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73073  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73074  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73075  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73076  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73077  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73078  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73079  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73080  // SUCH DAMAGE.
 73081  //
 73082  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 73083  // $FreeBSD$
 73084  
 73085  // -
 73086  // SPDX-License-Identifier: BSD-3-Clause
 73087  //
 73088  // Copyright (c) 1991, 1993
 73089  //	The Regents of the University of California.  All rights reserved.
 73090  //
 73091  // This code is derived from software contributed to Berkeley by
 73092  // Berkeley Software Design, Inc.
 73093  //
 73094  // Redistribution and use in source and binary forms, with or without
 73095  // modification, are permitted provided that the following conditions
 73096  // are met:
 73097  // 1. Redistributions of source code must retain the above copyright
 73098  //    notice, this list of conditions and the following disclaimer.
 73099  // 2. Redistributions in binary form must reproduce the above copyright
 73100  //    notice, this list of conditions and the following disclaimer in the
 73101  //    documentation and/or other materials provided with the distribution.
 73102  // 3. Neither the name of the University nor the names of its contributors
 73103  //    may be used to endorse or promote products derived from this software
 73104  //    without specific prior written permission.
 73105  //
 73106  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73107  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73108  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73109  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73110  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73111  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73112  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73113  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73114  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73115  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73116  // SUCH DAMAGE.
 73117  //
 73118  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 73119  // $FreeBSD$
 73120  
 73121  // Unlike other ANSI header files, <assert.h> may usefully be included
 73122  // multiple times, with and without NDEBUG defined.
 73123  
 73124  // tcl.h --
 73125  //
 73126  //	This header file describes the externally-visible facilities of the
 73127  //	Tcl interpreter.
 73128  //
 73129  // Copyright (c) 1987-1994 The Regents of the University of California.
 73130  // Copyright (c) 1993-1996 Lucent Technologies.
 73131  // Copyright (c) 1994-1998 Sun Microsystems, Inc.
 73132  // Copyright (c) 1998-2000 by Scriptics Corporation.
 73133  // Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
 73134  //
 73135  // See the file "license.terms" for information on usage and redistribution of
 73136  // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 73137  
 73138  // Local Variables:
 73139  // mode: c
 73140  // c-basic-offset: 4
 73141  // fill-column: 78
 73142  // End:
 73143  
 73144  type Cube1 = struct {
 73145  	Fx      float64
 73146  	Fy      float64
 73147  	Fz      float64
 73148  	Fwidth  float64
 73149  	Fheight float64
 73150  	Fdepth  float64
 73151  } /* test_rtree.c:366:9 */
 73152  
 73153  // END of implementation of "circle" geometry callback.
 73154  //
 73155  //
 73156  
 73157  // -
 73158  // SPDX-License-Identifier: BSD-3-Clause
 73159  //
 73160  // Copyright (c) 1992, 1993
 73161  //	The Regents of the University of California.  All rights reserved.
 73162  // (c) UNIX System Laboratories, Inc.
 73163  // All or some portions of this file are derived from material licensed
 73164  // to the University of California by American Telephone and Telegraph
 73165  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 73166  // the permission of UNIX System Laboratories, Inc.
 73167  //
 73168  // Redistribution and use in source and binary forms, with or without
 73169  // modification, are permitted provided that the following conditions
 73170  // are met:
 73171  // 1. Redistributions of source code must retain the above copyright
 73172  //    notice, this list of conditions and the following disclaimer.
 73173  // 2. Redistributions in binary form must reproduce the above copyright
 73174  //    notice, this list of conditions and the following disclaimer in the
 73175  //    documentation and/or other materials provided with the distribution.
 73176  // 3. Neither the name of the University nor the names of its contributors
 73177  //    may be used to endorse or promote products derived from this software
 73178  //    without specific prior written permission.
 73179  //
 73180  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73181  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73182  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73183  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73184  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73185  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73186  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73187  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73188  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73189  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73190  // SUCH DAMAGE.
 73191  //
 73192  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 73193  // $FreeBSD$
 73194  
 73195  // -
 73196  // SPDX-License-Identifier: BSD-3-Clause
 73197  //
 73198  // Copyright (c) 1991, 1993
 73199  //	The Regents of the University of California.  All rights reserved.
 73200  //
 73201  // This code is derived from software contributed to Berkeley by
 73202  // Berkeley Software Design, Inc.
 73203  //
 73204  // Redistribution and use in source and binary forms, with or without
 73205  // modification, are permitted provided that the following conditions
 73206  // are met:
 73207  // 1. Redistributions of source code must retain the above copyright
 73208  //    notice, this list of conditions and the following disclaimer.
 73209  // 2. Redistributions in binary form must reproduce the above copyright
 73210  //    notice, this list of conditions and the following disclaimer in the
 73211  //    documentation and/or other materials provided with the distribution.
 73212  // 3. Neither the name of the University nor the names of its contributors
 73213  //    may be used to endorse or promote products derived from this software
 73214  //    without specific prior written permission.
 73215  //
 73216  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73217  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73218  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73219  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73220  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73221  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73222  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73223  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73224  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73225  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73226  // SUCH DAMAGE.
 73227  //
 73228  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 73229  // $FreeBSD$
 73230  
 73231  // Unlike other ANSI header files, <assert.h> may usefully be included
 73232  // multiple times, with and without NDEBUG defined.
 73233  
 73234  // tcl.h --
 73235  //
 73236  //	This header file describes the externally-visible facilities of the
 73237  //	Tcl interpreter.
 73238  //
 73239  // Copyright (c) 1987-1994 The Regents of the University of California.
 73240  // Copyright (c) 1993-1996 Lucent Technologies.
 73241  // Copyright (c) 1994-1998 Sun Microsystems, Inc.
 73242  // Copyright (c) 1998-2000 by Scriptics Corporation.
 73243  // Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
 73244  //
 73245  // See the file "license.terms" for information on usage and redistribution of
 73246  // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 73247  
 73248  // Local Variables:
 73249  // mode: c
 73250  // c-basic-offset: 4
 73251  // fill-column: 78
 73252  // End:
 73253  
 73254  type Cube = Cube1 /* test_rtree.c:366:21 */
 73255  
 73256  func cube_context_free(tls *libc.TLS, p uintptr) { /* test_rtree.c:376:13: */
 73257  	sqlite3.Xsqlite3_free(tls, p)
 73258  }
 73259  
 73260  // The context pointer registered along with the 'cube' callback is
 73261  // always ((void *)&gHere). This is just to facilitate testing, it is not
 73262  // actually used for anything.
 73263  var gHere int32 = 42 /* test_rtree.c:385:12 */
 73264  
 73265  // Implementation of a simple r-tree geom callback to test for intersection
 73266  // of r-tree rows with a "cube" shape. Cubes are defined by six scalar
 73267  // coordinates as follows:
 73268  //
 73269  //   cube(x, y, z, width, height, depth)
 73270  //
 73271  // The width, height and depth parameters must all be greater than zero.
 73272  func cube_geom(tls *libc.TLS, p uintptr, nCoord int32, aCoord uintptr, piRes uintptr) int32 { /* test_rtree.c:396:12: */
 73273  	var pCube uintptr = (*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser
 73274  
 73275  	if pCube == uintptr(0) {
 73276  		if (((((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FnParam != 6) || (nCoord != 6)) ||
 73277  			(*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 3*8)) <= 0.0)) || (*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 4*8)) <= 0.0)) || (*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 5*8)) <= 0.0) {
 73278  			return SQLITE_ERROR
 73279  		}
 73280  		pCube = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Cube{})))
 73281  		if !(pCube != 0) {
 73282  			return SQLITE_NOMEM
 73283  		}
 73284  		(*Cube)(unsafe.Pointer(pCube)).Fx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam))
 73285  		(*Cube)(unsafe.Pointer(pCube)).Fy = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 1*8))
 73286  		(*Cube)(unsafe.Pointer(pCube)).Fz = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 2*8))
 73287  		(*Cube)(unsafe.Pointer(pCube)).Fwidth = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 3*8))
 73288  		(*Cube)(unsafe.Pointer(pCube)).Fheight = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 4*8))
 73289  		(*Cube)(unsafe.Pointer(pCube)).Fdepth = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 5*8))
 73290  
 73291  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser = pCube
 73292  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cube_context_free}))
 73293  	}
 73294  
 73295  	*(*int32)(unsafe.Pointer(piRes)) = 0
 73296  	if (((((*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord)) <= ((*Cube)(unsafe.Pointer(pCube)).Fx + (*Cube)(unsafe.Pointer(pCube)).Fwidth)) &&
 73297  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 1*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fx)) &&
 73298  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 2*8)) <= ((*Cube)(unsafe.Pointer(pCube)).Fy + (*Cube)(unsafe.Pointer(pCube)).Fheight))) &&
 73299  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 3*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fy)) &&
 73300  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 4*8)) <= ((*Cube)(unsafe.Pointer(pCube)).Fz + (*Cube)(unsafe.Pointer(pCube)).Fdepth))) &&
 73301  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 5*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fz) {
 73302  		*(*int32)(unsafe.Pointer(piRes)) = 1
 73303  	}
 73304  
 73305  	return SQLITE_OK
 73306  }
 73307  
 73308  func register_cube_geom(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_rtree.c:443:26: */
 73309  	bp := tls.Alloc(8)
 73310  	defer tls.Free(8)
 73311  
 73312  	// var db uintptr at bp, 8
 73313  
 73314  	var rc int32
 73315  
 73316  	if objc != 2 {
 73317  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 73318  		return TCL_ERROR
 73319  	}
 73320  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 73321  		return TCL_ERROR
 73322  	}
 73323  	rc = sqlite3.Xsqlite3_rtree_geometry_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36746 /* "cube" */, *(*uintptr)(unsafe.Pointer(&struct {
 73324  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 73325  	}{cube_geom})), uintptr(unsafe.Pointer(&gHere)))
 73326  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 73327  	return TCL_OK
 73328  }
 73329  
 73330  func register_circle_geom(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_rtree.c:471:26: */
 73331  	bp := tls.Alloc(8)
 73332  	defer tls.Free(8)
 73333  
 73334  	// var db uintptr at bp, 8
 73335  
 73336  	var rc int32
 73337  
 73338  	if objc != 2 {
 73339  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 73340  		return TCL_ERROR
 73341  	}
 73342  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 73343  		return TCL_ERROR
 73344  	}
 73345  	rc = sqlite3.Xsqlite3_rtree_geometry_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36751 /* "circle" */, *(*uintptr)(unsafe.Pointer(&struct {
 73346  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 73347  	}{circle_geom})), uintptr(0))
 73348  	if rc == SQLITE_OK {
 73349  		rc = sqlite3.Xsqlite3_rtree_query_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36758, /* "Qcircle" */
 73350  			*(*uintptr)(unsafe.Pointer(&struct {
 73351  				f func(*libc.TLS, uintptr) int32
 73352  			}{circle_query_func})), uintptr(0), uintptr(0))
 73353  	}
 73354  	if rc == SQLITE_OK {
 73355  		rc = sqlite3.Xsqlite3_rtree_query_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36766, /* "breadthfirstsear..." */
 73356  			*(*uintptr)(unsafe.Pointer(&struct {
 73357  				f func(*libc.TLS, uintptr) int32
 73358  			}{bfs_query_func})), uintptr(0), uintptr(0))
 73359  	}
 73360  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 73361  	return TCL_OK
 73362  }
 73363  
 73364  func Sqlitetestrtree_Init(tls *libc.TLS, interp uintptr) int32 { /* test_rtree.c:507:5: */
 73365  	tcl.XTcl_CreateObjCommand(tls, interp, ts+36785 /* "register_cube_ge..." */, *(*uintptr)(unsafe.Pointer(&struct {
 73366  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 73367  	}{register_cube_geom})), uintptr(0), uintptr(0))
 73368  	tcl.XTcl_CreateObjCommand(tls, interp, ts+36804 /* "register_circle_..." */, *(*uintptr)(unsafe.Pointer(&struct {
 73369  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 73370  	}{register_circle_geom})), uintptr(0), uintptr(0))
 73371  	return TCL_OK
 73372  }
 73373  
 73374  // end block for C++
 73375  
 73376  // Local Variables:
 73377  // mode: c
 73378  // c-basic-offset: 4
 73379  // fill-column: 78
 73380  // End:
 73381  
 73382  // -
 73383  // SPDX-License-Identifier: BSD-3-Clause
 73384  //
 73385  // Copyright (c) 1990, 1993
 73386  //	The Regents of the University of California.  All rights reserved.
 73387  //
 73388  // Redistribution and use in source and binary forms, with or without
 73389  // modification, are permitted provided that the following conditions
 73390  // are met:
 73391  // 1. Redistributions of source code must retain the above copyright
 73392  //    notice, this list of conditions and the following disclaimer.
 73393  // 2. Redistributions in binary form must reproduce the above copyright
 73394  //    notice, this list of conditions and the following disclaimer in the
 73395  //    documentation and/or other materials provided with the distribution.
 73396  // 3. Neither the name of the University nor the names of its contributors
 73397  //    may be used to endorse or promote products derived from this software
 73398  //    without specific prior written permission.
 73399  //
 73400  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73401  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73402  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73403  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73404  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73405  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73406  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73407  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73408  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73409  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73410  // SUCH DAMAGE.
 73411  //
 73412  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 73413  // $FreeBSD$
 73414  
 73415  // -
 73416  // SPDX-License-Identifier: BSD-3-Clause
 73417  //
 73418  // Copyright (c) 1990, 1993
 73419  //	The Regents of the University of California.  All rights reserved.
 73420  //
 73421  // Redistribution and use in source and binary forms, with or without
 73422  // modification, are permitted provided that the following conditions
 73423  // are met:
 73424  // 1. Redistributions of source code must retain the above copyright
 73425  //    notice, this list of conditions and the following disclaimer.
 73426  // 2. Redistributions in binary form must reproduce the above copyright
 73427  //    notice, this list of conditions and the following disclaimer in the
 73428  //    documentation and/or other materials provided with the distribution.
 73429  // 3. Neither the name of the University nor the names of its contributors
 73430  //    may be used to endorse or promote products derived from this software
 73431  //    without specific prior written permission.
 73432  //
 73433  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73434  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73435  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73436  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73437  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73438  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73439  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73440  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73441  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73442  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73443  // SUCH DAMAGE.
 73444  //
 73445  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 73446  // $FreeBSD$
 73447  
 73448  // -
 73449  // SPDX-License-Identifier: BSD-3-Clause
 73450  //
 73451  // Copyright (c) 1992, 1993
 73452  //	The Regents of the University of California.  All rights reserved.
 73453  // (c) UNIX System Laboratories, Inc.
 73454  // All or some portions of this file are derived from material licensed
 73455  // to the University of California by American Telephone and Telegraph
 73456  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 73457  // the permission of UNIX System Laboratories, Inc.
 73458  //
 73459  // Redistribution and use in source and binary forms, with or without
 73460  // modification, are permitted provided that the following conditions
 73461  // are met:
 73462  // 1. Redistributions of source code must retain the above copyright
 73463  //    notice, this list of conditions and the following disclaimer.
 73464  // 2. Redistributions in binary form must reproduce the above copyright
 73465  //    notice, this list of conditions and the following disclaimer in the
 73466  //    documentation and/or other materials provided with the distribution.
 73467  // 3. Neither the name of the University nor the names of its contributors
 73468  //    may be used to endorse or promote products derived from this software
 73469  //    without specific prior written permission.
 73470  //
 73471  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73472  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73473  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73474  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73475  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73476  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73477  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73478  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73479  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73480  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73481  // SUCH DAMAGE.
 73482  //
 73483  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 73484  // $FreeBSD$
 73485  
 73486  // -
 73487  // SPDX-License-Identifier: BSD-3-Clause
 73488  //
 73489  // Copyright (c) 1991, 1993
 73490  //	The Regents of the University of California.  All rights reserved.
 73491  //
 73492  // This code is derived from software contributed to Berkeley by
 73493  // Berkeley Software Design, Inc.
 73494  //
 73495  // Redistribution and use in source and binary forms, with or without
 73496  // modification, are permitted provided that the following conditions
 73497  // are met:
 73498  // 1. Redistributions of source code must retain the above copyright
 73499  //    notice, this list of conditions and the following disclaimer.
 73500  // 2. Redistributions in binary form must reproduce the above copyright
 73501  //    notice, this list of conditions and the following disclaimer in the
 73502  //    documentation and/or other materials provided with the distribution.
 73503  // 3. Neither the name of the University nor the names of its contributors
 73504  //    may be used to endorse or promote products derived from this software
 73505  //    without specific prior written permission.
 73506  //
 73507  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73508  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73509  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73510  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73511  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73512  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73513  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73514  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73515  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73516  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73517  // SUCH DAMAGE.
 73518  //
 73519  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 73520  // $FreeBSD$
 73521  
 73522  // Unlike other ANSI header files, <assert.h> may usefully be included
 73523  // multiple times, with and without NDEBUG defined.
 73524  
 73525  type schema_vtab1 = struct {
 73526  	Fbase sqlite3_vtab
 73527  	Fdb   uintptr
 73528  } /* test_schema.c:53:9 */
 73529  
 73530  // end block for C++
 73531  
 73532  // Local Variables:
 73533  // mode: c
 73534  // c-basic-offset: 4
 73535  // fill-column: 78
 73536  // End:
 73537  
 73538  // -
 73539  // SPDX-License-Identifier: BSD-3-Clause
 73540  //
 73541  // Copyright (c) 1990, 1993
 73542  //	The Regents of the University of California.  All rights reserved.
 73543  //
 73544  // Redistribution and use in source and binary forms, with or without
 73545  // modification, are permitted provided that the following conditions
 73546  // are met:
 73547  // 1. Redistributions of source code must retain the above copyright
 73548  //    notice, this list of conditions and the following disclaimer.
 73549  // 2. Redistributions in binary form must reproduce the above copyright
 73550  //    notice, this list of conditions and the following disclaimer in the
 73551  //    documentation and/or other materials provided with the distribution.
 73552  // 3. Neither the name of the University nor the names of its contributors
 73553  //    may be used to endorse or promote products derived from this software
 73554  //    without specific prior written permission.
 73555  //
 73556  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73557  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73558  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73559  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73560  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73561  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73562  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73563  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73564  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73565  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73566  // SUCH DAMAGE.
 73567  //
 73568  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 73569  // $FreeBSD$
 73570  
 73571  // -
 73572  // SPDX-License-Identifier: BSD-3-Clause
 73573  //
 73574  // Copyright (c) 1990, 1993
 73575  //	The Regents of the University of California.  All rights reserved.
 73576  //
 73577  // Redistribution and use in source and binary forms, with or without
 73578  // modification, are permitted provided that the following conditions
 73579  // are met:
 73580  // 1. Redistributions of source code must retain the above copyright
 73581  //    notice, this list of conditions and the following disclaimer.
 73582  // 2. Redistributions in binary form must reproduce the above copyright
 73583  //    notice, this list of conditions and the following disclaimer in the
 73584  //    documentation and/or other materials provided with the distribution.
 73585  // 3. Neither the name of the University nor the names of its contributors
 73586  //    may be used to endorse or promote products derived from this software
 73587  //    without specific prior written permission.
 73588  //
 73589  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73590  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73591  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73592  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73593  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73594  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73595  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73596  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73597  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73598  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73599  // SUCH DAMAGE.
 73600  //
 73601  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 73602  // $FreeBSD$
 73603  
 73604  // -
 73605  // SPDX-License-Identifier: BSD-3-Clause
 73606  //
 73607  // Copyright (c) 1992, 1993
 73608  //	The Regents of the University of California.  All rights reserved.
 73609  // (c) UNIX System Laboratories, Inc.
 73610  // All or some portions of this file are derived from material licensed
 73611  // to the University of California by American Telephone and Telegraph
 73612  // Co. or Unix System Laboratories, Inc. and are reproduced herein with
 73613  // the permission of UNIX System Laboratories, Inc.
 73614  //
 73615  // Redistribution and use in source and binary forms, with or without
 73616  // modification, are permitted provided that the following conditions
 73617  // are met:
 73618  // 1. Redistributions of source code must retain the above copyright
 73619  //    notice, this list of conditions and the following disclaimer.
 73620  // 2. Redistributions in binary form must reproduce the above copyright
 73621  //    notice, this list of conditions and the following disclaimer in the
 73622  //    documentation and/or other materials provided with the distribution.
 73623  // 3. Neither the name of the University nor the names of its contributors
 73624  //    may be used to endorse or promote products derived from this software
 73625  //    without specific prior written permission.
 73626  //
 73627  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73628  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73629  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73630  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73631  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73632  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73633  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73634  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73635  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73636  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73637  // SUCH DAMAGE.
 73638  //
 73639  //	@(#)assert.h	8.2 (Berkeley) 1/21/94
 73640  // $FreeBSD$
 73641  
 73642  // -
 73643  // SPDX-License-Identifier: BSD-3-Clause
 73644  //
 73645  // Copyright (c) 1991, 1993
 73646  //	The Regents of the University of California.  All rights reserved.
 73647  //
 73648  // This code is derived from software contributed to Berkeley by
 73649  // Berkeley Software Design, Inc.
 73650  //
 73651  // Redistribution and use in source and binary forms, with or without
 73652  // modification, are permitted provided that the following conditions
 73653  // are met:
 73654  // 1. Redistributions of source code must retain the above copyright
 73655  //    notice, this list of conditions and the following disclaimer.
 73656  // 2. Redistributions in binary form must reproduce the above copyright
 73657  //    notice, this list of conditions and the following disclaimer in the
 73658  //    documentation and/or other materials provided with the distribution.
 73659  // 3. Neither the name of the University nor the names of its contributors
 73660  //    may be used to endorse or promote products derived from this software
 73661  //    without specific prior written permission.
 73662  //
 73663  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 73664  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 73665  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 73666  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 73667  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 73668  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 73669  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 73670  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 73671  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 73672  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 73673  // SUCH DAMAGE.
 73674  //
 73675  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 73676  // $FreeBSD$
 73677  
 73678  // Unlike other ANSI header files, <assert.h> may usefully be included
 73679  // multiple times, with and without NDEBUG defined.
 73680  
 73681  type schema_vtab = schema_vtab1 /* test_schema.c:53:28 */
 73682  type schema_cursor1 = struct {
 73683  	Fbase        sqlite3_vtab_cursor
 73684  	FpDbList     uintptr
 73685  	FpTableList  uintptr
 73686  	FpColumnList uintptr
 73687  	Frowid       int32
 73688  	_            [4]byte
 73689  } /* test_schema.c:54:9 */
 73690  
 73691  type schema_cursor = schema_cursor1 /* test_schema.c:54:30 */
 73692  
 73693  // None of this works unless we have virtual tables.
 73694  
 73695  // Table destructor for the schema module.
 73696  func schemaDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* test_schema.c:79:12: */
 73697  	sqlite3.Xsqlite3_free(tls, pVtab)
 73698  	return 0
 73699  }
 73700  
 73701  // Table constructor for the schema module.
 73702  func schemaCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_schema.c:87:12: */
 73703  	var rc int32 = SQLITE_NOMEM
 73704  	var pVtab uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(schema_vtab{})))
 73705  	if pVtab != 0 {
 73706  		libc.Xmemset(tls, pVtab, 0, uint64(unsafe.Sizeof(schema_vtab{})))
 73707  		(*schema_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 73708  		rc = sqlite3.Xsqlite3_declare_vtab(tls, db /* Name of database (i.e. main, temp etc.) */ /* Name of table */ /* Column number (from left-to-right, 0 upward) */ /* Column name */ /* Specified type (i.e. VARCHAR(32)) */ /* Boolean. True if NOT NULL was specified */ /* Default value for this column */ /* True if this column is part of the primary key */, ts+36825 /* "CREATE TABLE x(d..." */)
 73709  	}
 73710  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pVtab
 73711  	return rc
 73712  }
 73713  
 73714  // Open a new cursor on the schema table.
 73715  func schemaOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_schema.c:110:12: */
 73716  	var rc int32 = SQLITE_NOMEM
 73717  	var pCur uintptr
 73718  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(schema_cursor{})))
 73719  	if pCur != 0 {
 73720  		libc.Xmemset(tls, pCur, 0, uint64(unsafe.Sizeof(schema_cursor{})))
 73721  		*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 73722  		rc = SQLITE_OK
 73723  	}
 73724  	return rc
 73725  }
 73726  
 73727  // Close a schema table cursor.
 73728  func schemaClose(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:125:12: */
 73729  	var pCur uintptr = cur
 73730  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList)
 73731  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList)
 73732  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList)
 73733  	sqlite3.Xsqlite3_free(tls, pCur)
 73734  	return SQLITE_OK
 73735  }
 73736  
 73737  // Retrieve a column of data.
 73738  func schemaColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_schema.c:137:12: */
 73739  	var pCur uintptr = cur
 73740  	switch i {
 73741  	case 0:
 73742  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 1))
 73743  		break
 73744  	case 1:
 73745  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList, 0))
 73746  		break
 73747  	default:
 73748  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList, (i-2)))
 73749  		break
 73750  	}
 73751  	return SQLITE_OK
 73752  }
 73753  
 73754  // Retrieve the current rowid.
 73755  func schemaRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_schema.c:156:12: */
 73756  	var pCur uintptr = cur
 73757  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite_int64((*schema_cursor)(unsafe.Pointer(pCur)).Frowid)
 73758  	return SQLITE_OK
 73759  }
 73760  
 73761  func finalize(tls *libc.TLS, ppStmt uintptr) int32 { /* test_schema.c:162:12: */
 73762  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(ppStmt)))
 73763  	*(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0)
 73764  	return rc
 73765  }
 73766  
 73767  func schemaEof(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:168:12: */
 73768  	var pCur uintptr = cur
 73769  	return func() int32 {
 73770  		if (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList != 0 {
 73771  			return 0
 73772  		}
 73773  		return 1
 73774  	}()
 73775  }
 73776  
 73777  // Advance the cursor to the next row.
 73778  func schemaNext(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:176:12: */
 73779  	bp := tls.Alloc(24)
 73780  	defer tls.Free(24)
 73781  
 73782  	var rc int32
 73783  	var pCur uintptr
 73784  	var pVtab uintptr
 73785  	var zSql uintptr
 73786  	var pDbList uintptr
 73787  	rc = SQLITE_OK
 73788  	pCur = cur
 73789  	pVtab = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 73790  	zSql = uintptr(0)
 73791  
 73792  __1:
 73793  	if !(!(int32((*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList) != 0) || (SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList))) {
 73794  		goto __2
 73795  	}
 73796  	if !(SQLITE_OK != (libc.AssignInt32(&rc, finalize(tls, (pCur+24 /* &.pColumnList */))))) {
 73797  		goto __3
 73798  	}
 73799  	goto next_exit
 73800  __3:
 73801  	;
 73802  
 73803  __4:
 73804  	if !(!(int32((*schema_cursor)(unsafe.Pointer(pCur)).FpTableList) != 0) || (SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList))) {
 73805  		goto __5
 73806  	}
 73807  	if !(SQLITE_OK != (libc.AssignInt32(&rc, finalize(tls, (pCur+16 /* &.pTableList */))))) {
 73808  		goto __6
 73809  	}
 73810  	goto next_exit
 73811  __6:
 73812  	;
 73813  
 73814  __7:
 73815  	if !(SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList)) {
 73816  		goto __8
 73817  	}
 73818  	rc = finalize(tls, (pCur + 8 /* &.pDbList */))
 73819  	goto next_exit
 73820  	goto __7
 73821  __8:
 73822  	;
 73823  
 73824  	// Set zSql to the SQL to pull the list of tables from the
 73825  	// sqlite_schema (or sqlite_temp_schema) table of the database
 73826  	// identified by the row pointed to by the SQL statement pCur->pDbList
 73827  	// (iterating through a "PRAGMA database_list;" statement).
 73828  	if !(sqlite3.Xsqlite3_column_int(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 0) == 1) {
 73829  		goto __9
 73830  	}
 73831  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 73832  		ts+36897 /* "SELECT name FROM..." */, 0)
 73833  	goto __10
 73834  __9:
 73835  	pDbList = (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList
 73836  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 73837  		ts+36952, /* "SELECT name FROM..." */
 73838  		libc.VaList(bp, sqlite3.Xsqlite3_column_text(tls, pDbList, 1)))
 73839  __10:
 73840  	;
 73841  	if !(!(zSql != 0)) {
 73842  		goto __11
 73843  	}
 73844  	rc = SQLITE_NOMEM
 73845  	goto next_exit
 73846  __11:
 73847  	;
 73848  
 73849  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, (pCur + 16 /* &.pTableList */), uintptr(0))
 73850  	sqlite3.Xsqlite3_free(tls, zSql)
 73851  	if !(rc != SQLITE_OK) {
 73852  		goto __12
 73853  	}
 73854  	goto next_exit
 73855  __12:
 73856  	;
 73857  	goto __4
 73858  __5:
 73859  	;
 73860  
 73861  	// Set zSql to the SQL to the table_info pragma for the table currently
 73862  	// identified by the rows pointed to by statements pCur->pDbList and
 73863  	// pCur->pTableList.
 73864  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+37005, /* "PRAGMA %Q.table_..." */
 73865  		libc.VaList(bp+8, sqlite3.Xsqlite3_column_text(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 1),
 73866  			sqlite3.Xsqlite3_column_text(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList, 0)))
 73867  
 73868  	if !(!(zSql != 0)) {
 73869  		goto __13
 73870  	}
 73871  	rc = SQLITE_NOMEM
 73872  	goto next_exit
 73873  __13:
 73874  	;
 73875  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, (pCur + 24 /* &.pColumnList */), uintptr(0))
 73876  	sqlite3.Xsqlite3_free(tls, zSql)
 73877  	if !(rc != SQLITE_OK) {
 73878  		goto __14
 73879  	}
 73880  	goto next_exit
 73881  __14:
 73882  	;
 73883  	goto __1
 73884  __2:
 73885  	;
 73886  	(*schema_cursor)(unsafe.Pointer(pCur)).Frowid++
 73887  
 73888  next_exit:
 73889  	// TODO: Handle rc
 73890  	return rc
 73891  }
 73892  
 73893  // Reset a schema table cursor.
 73894  func schemaFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_schema.c:247:12: */
 73895  	var rc int32
 73896  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 73897  	var pCur uintptr = pVtabCursor
 73898  	(*schema_cursor)(unsafe.Pointer(pCur)).Frowid = 0
 73899  	finalize(tls, (pCur + 16 /* &.pTableList */))
 73900  	finalize(tls, (pCur + 24 /* &.pColumnList */))
 73901  	finalize(tls, (pCur + 8 /* &.pDbList */))
 73902  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, ts+37030 /* "PRAGMA database_..." */, -1, (pCur + 8 /* &.pDbList */), uintptr(0))
 73903  	return func() int32 {
 73904  		if rc == SQLITE_OK {
 73905  			return schemaNext(tls, pVtabCursor)
 73906  		}
 73907  		return rc
 73908  	}()
 73909  }
 73910  
 73911  // Analyse the WHERE condition.
 73912  func schemaBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_schema.c:266:12: */
 73913  	return SQLITE_OK
 73914  }
 73915  
 73916  // A virtual table module that merely echos method calls into TCL
 73917  // variables.
 73918  var schemaModule = sqlite3_module{ // iVersion
 73919  	FxCreate:     0,
 73920  	FxConnect:    0,
 73921  	FxBestIndex:  0,
 73922  	FxDisconnect: 0,
 73923  	FxDestroy:    0,
 73924  	FxOpen:       0, // xOpen - open a cursor
 73925  	FxClose:      0, // xClose - close a cursor
 73926  	FxFilter:     0, // xFilter - configure scan constraints
 73927  	FxNext:       0, // xNext - advance a cursor
 73928  	FxEof:        0, // xEof
 73929  	FxColumn:     0, // xColumn - read data
 73930  	FxRowid:      0, // xRename
 73931  } /* test_schema.c:274:23 */
 73932  
 73933  // Register the schema virtual table module.
 73934  func register_schema_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_schema.c:309:26: */
 73935  	bp := tls.Alloc(8)
 73936  	defer tls.Free(8)
 73937  
 73938  	// var db uintptr at bp, 8
 73939  
 73940  	if objc != 2 {
 73941  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 73942  		return TCL_ERROR
 73943  	}
 73944  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 73945  		return TCL_ERROR
 73946  	}
 73947  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+4669 /* "schema" */, uintptr(unsafe.Pointer(&schemaModule)), uintptr(0))
 73948  	return TCL_OK
 73949  }
 73950  
 73951  // Register commands with the TCL interpreter.
 73952  func Sqlitetestschema_Init(tls *libc.TLS, interp uintptr) int32 { /* test_schema.c:330:5: */
 73953  	var i int32
 73954  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd12)) / uint64(unsafe.Sizeof(struct {
 73955  		FzName      uintptr
 73956  		FxProc      uintptr
 73957  		FclientData uintptr
 73958  	}{}))); i++ {
 73959  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd12[i].FzName,
 73960  			aObjCmd12[i].FxProc, aObjCmd12[i].FclientData, uintptr(0))
 73961  	}
 73962  	return TCL_OK
 73963  }
 73964  
 73965  var aObjCmd12 = [1]struct {
 73966  	FzName      uintptr
 73967  	FxProc      uintptr
 73968  	FclientData uintptr
 73969  }{
 73970  	{FzName: ts + 37051 /* "register_schema_..." */, FxProc: 0},
 73971  } /* test_schema.c:335:5 */
 73972  
 73973  // 2001-09-15
 73974  //
 73975  // The author disclaims copyright to this source code.  In place of
 73976  // a legal notice, here is a blessing:
 73977  //
 73978  //    May you do good and not evil.
 73979  //    May you find forgiveness for yourself and forgive others.
 73980  //    May you share freely, never taking more than you give.
 73981  //
 73982  //
 73983  // This header file defines the interface that the SQLite library
 73984  // presents to client programs.  If a C-function, structure, datatype,
 73985  // or constant definition does not appear in this file, then it is
 73986  // not a published API of SQLite, is subject to change without
 73987  // notice, and should not be referenced by programs that use SQLite.
 73988  //
 73989  // Some of the definitions that are in this file are marked as
 73990  // "experimental".  Experimental interfaces are normally new
 73991  // features recently added to SQLite.  We do not anticipate changes
 73992  // to experimental interfaces but reserve the right to make minor changes
 73993  // if experience from use "in the wild" suggest such changes are prudent.
 73994  //
 73995  // The official C-language API documentation for SQLite is derived
 73996  // from comments in this file.  This file is the authoritative source
 73997  // on how SQLite interfaces are supposed to operate.
 73998  //
 73999  // The name of this file under configuration management is "sqlite.h.in".
 74000  // The makefile makes some minor changes to this file (such as inserting
 74001  // the version number) and changes its name to "sqlite3.h" as
 74002  // part of the build process.
 74003  
 74004  //******* Begin file sqlite3rtree.h ********
 74005  // 2010 August 30
 74006  //
 74007  // The author disclaims copyright to this source code.  In place of
 74008  // a legal notice, here is a blessing:
 74009  //
 74010  //    May you do good and not evil.
 74011  //    May you find forgiveness for yourself and forgive others.
 74012  //    May you share freely, never taking more than you give.
 74013  //
 74014  //
 74015  
 74016  //******* End of sqlite3rtree.h ********
 74017  //******* Begin file sqlite3session.h ********
 74018  
 74019  //******* End of sqlite3session.h ********
 74020  //******* Begin file fts5.h ********
 74021  // 2014 May 31
 74022  //
 74023  // The author disclaims copyright to this source code.  In place of
 74024  // a legal notice, here is a blessing:
 74025  //
 74026  //    May you do good and not evil.
 74027  //    May you find forgiveness for yourself and forgive others.
 74028  //    May you share freely, never taking more than you give.
 74029  //
 74030  //
 74031  //
 74032  // Interfaces to extend FTS5. Using the interfaces defined in this file,
 74033  // FTS5 may be extended with:
 74034  //
 74035  //     * custom tokenizers, and
 74036  //     * custom auxiliary functions.
 74037  
 74038  //******* End of fts5.h ********
 74039  
 74040  // Messages are passed from client to server and back again as
 74041  // instances of the following structure.
 74042  type SqlMessage1 = struct {
 74043  	Fop           int32
 74044  	_             [4]byte
 74045  	FpDb          uintptr
 74046  	FpStmt        uintptr
 74047  	FerrCode      int32
 74048  	_             [4]byte
 74049  	FzIn          uintptr
 74050  	FnByte        int32
 74051  	_             [4]byte
 74052  	FzOut         uintptr
 74053  	FpNext        uintptr
 74054  	FpPrev        uintptr
 74055  	FclientMutex  pthread_mutex_t
 74056  	FclientWakeup pthread_cond_t
 74057  } /* test_server.c:221:9 */
 74058  
 74059  // 2001-09-15
 74060  //
 74061  // The author disclaims copyright to this source code.  In place of
 74062  // a legal notice, here is a blessing:
 74063  //
 74064  //    May you do good and not evil.
 74065  //    May you find forgiveness for yourself and forgive others.
 74066  //    May you share freely, never taking more than you give.
 74067  //
 74068  //
 74069  // This header file defines the interface that the SQLite library
 74070  // presents to client programs.  If a C-function, structure, datatype,
 74071  // or constant definition does not appear in this file, then it is
 74072  // not a published API of SQLite, is subject to change without
 74073  // notice, and should not be referenced by programs that use SQLite.
 74074  //
 74075  // Some of the definitions that are in this file are marked as
 74076  // "experimental".  Experimental interfaces are normally new
 74077  // features recently added to SQLite.  We do not anticipate changes
 74078  // to experimental interfaces but reserve the right to make minor changes
 74079  // if experience from use "in the wild" suggest such changes are prudent.
 74080  //
 74081  // The official C-language API documentation for SQLite is derived
 74082  // from comments in this file.  This file is the authoritative source
 74083  // on how SQLite interfaces are supposed to operate.
 74084  //
 74085  // The name of this file under configuration management is "sqlite.h.in".
 74086  // The makefile makes some minor changes to this file (such as inserting
 74087  // the version number) and changes its name to "sqlite3.h" as
 74088  // part of the build process.
 74089  
 74090  //******* Begin file sqlite3rtree.h ********
 74091  // 2010 August 30
 74092  //
 74093  // The author disclaims copyright to this source code.  In place of
 74094  // a legal notice, here is a blessing:
 74095  //
 74096  //    May you do good and not evil.
 74097  //    May you find forgiveness for yourself and forgive others.
 74098  //    May you share freely, never taking more than you give.
 74099  //
 74100  //
 74101  
 74102  //******* End of sqlite3rtree.h ********
 74103  //******* Begin file sqlite3session.h ********
 74104  
 74105  //******* End of sqlite3session.h ********
 74106  //******* Begin file fts5.h ********
 74107  // 2014 May 31
 74108  //
 74109  // The author disclaims copyright to this source code.  In place of
 74110  // a legal notice, here is a blessing:
 74111  //
 74112  //    May you do good and not evil.
 74113  //    May you find forgiveness for yourself and forgive others.
 74114  //    May you share freely, never taking more than you give.
 74115  //
 74116  //
 74117  //
 74118  // Interfaces to extend FTS5. Using the interfaces defined in this file,
 74119  // FTS5 may be extended with:
 74120  //
 74121  //     * custom tokenizers, and
 74122  //     * custom auxiliary functions.
 74123  
 74124  //******* End of fts5.h ********
 74125  
 74126  // Messages are passed from client to server and back again as
 74127  // instances of the following structure.
 74128  type SqlMessage = SqlMessage1 /* test_server.c:221:27 */
 74129  
 74130  // Legal values for SqlMessage.op
 74131  
 74132  // State information about the server is stored in a static variable
 74133  // named "g" as follows:
 74134  type ServerState = struct {
 74135  	FqueueMutex   pthread_mutex_t
 74136  	FserverMutex  pthread_mutex_t
 74137  	FserverWakeup pthread_cond_t
 74138  	FserverHalt   int32
 74139  	_             [4]byte
 74140  	FpQueueHead   uintptr
 74141  	FpQueueTail   uintptr
 74142  } /* test_server.c:252:8 */
 74143  
 74144  // Legal values for SqlMessage.op
 74145  
 74146  // State information about the server is stored in a static variable
 74147  // named "g" as follows:
 74148  var g4 = ServerState{} /* test_server.c:259:3 */
 74149  
 74150  // Send a message to the server.  Block until we get a reply.
 74151  //
 74152  // The mutex and condition variable in the message are uninitialized
 74153  // when this routine is called.  This routine takes care of
 74154  // initializing them and destroying them when it has finished.
 74155  func sendToServer(tls *libc.TLS, pMsg uintptr) { /* test_server.c:272:13: */
 74156  	// Initialize the mutex and condition variable on the message
 74157  	libc2.Xpthread_mutex_init(tls, (pMsg + 72 /* &.clientMutex */), uintptr(0))
 74158  	libc2.Xpthread_cond_init(tls, (pMsg + 80 /* &.clientWakeup */), uintptr(0))
 74159  
 74160  	// Add the message to the head of the server's message queue.
 74161  	libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 74162  	(*SqlMessage)(unsafe.Pointer(pMsg)).FpNext = g4.FpQueueHead
 74163  	if g4.FpQueueHead == uintptr(0) {
 74164  		g4.FpQueueTail = pMsg
 74165  	} else {
 74166  		(*SqlMessage)(unsafe.Pointer(g4.FpQueueHead)).FpPrev = pMsg
 74167  	}
 74168  	(*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev = uintptr(0)
 74169  	g4.FpQueueHead = pMsg
 74170  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 74171  
 74172  	// Signal the server that the new message has be queued, then
 74173  	// block waiting for the server to process the message.
 74174  	libc2.Xpthread_mutex_lock(tls, (pMsg + 72 /* &.clientMutex */))
 74175  	libc2.Xpthread_cond_signal(tls, (uintptr(unsafe.Pointer(&g4)) + 16 /* &.serverWakeup */))
 74176  	for (*SqlMessage)(unsafe.Pointer(pMsg)).Fop != MSG_Done {
 74177  		libc2.Xpthread_cond_wait(tls, (pMsg + 80 /* &.clientWakeup */), (pMsg + 72 /* &.clientMutex */))
 74178  	}
 74179  	libc2.Xpthread_mutex_unlock(tls, (pMsg + 72 /* &.clientMutex */))
 74180  
 74181  	// Destroy the mutex and condition variable of the message.
 74182  	libc2.Xpthread_mutex_destroy(tls, (pMsg + 72 /* &.clientMutex */))
 74183  	libc2.Xpthread_cond_destroy(tls, (pMsg + 80 /* &.clientWakeup */))
 74184  }
 74185  
 74186  // The following 6 routines are client-side implementations of the
 74187  // core SQLite interfaces:
 74188  //
 74189  //        sqlite3_open
 74190  //        sqlite3_prepare
 74191  //        sqlite3_step
 74192  //        sqlite3_reset
 74193  //        sqlite3_finalize
 74194  //        sqlite3_close
 74195  //
 74196  // Clients should use the following client-side routines instead of
 74197  // the core routines above.
 74198  //
 74199  //        sqlite3_client_open
 74200  //        sqlite3_client_prepare
 74201  //        sqlite3_client_step
 74202  //        sqlite3_client_reset
 74203  //        sqlite3_client_finalize
 74204  //        sqlite3_client_close
 74205  //
 74206  // Each of these routines creates a message for the desired operation,
 74207  // sends that message to the server, waits for the server to process
 74208  // then message and return a response.
 74209  func sqlite3_client_open(tls *libc.TLS, zDatabaseName uintptr, ppDb uintptr) int32 { /* test_server.c:332:5: */
 74210  	bp := tls.Alloc(88)
 74211  	defer tls.Free(88)
 74212  
 74213  	// var msg SqlMessage at bp, 88
 74214  
 74215  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Open
 74216  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzIn = zDatabaseName
 74217  	sendToServer(tls, bp /* &msg */)
 74218  	*(*uintptr)(unsafe.Pointer(ppDb)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb
 74219  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74220  }
 74221  
 74222  func sqlite3_client_prepare(tls *libc.TLS, pDb uintptr, zSql uintptr, nByte int32, ppStmt uintptr, pzTail uintptr) int32 { /* test_server.c:340:5: */
 74223  	bp := tls.Alloc(88)
 74224  	defer tls.Free(88)
 74225  
 74226  	// var msg SqlMessage at bp, 88
 74227  
 74228  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Prepare
 74229  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb = pDb
 74230  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzIn = zSql
 74231  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FnByte = nByte
 74232  	sendToServer(tls, bp /* &msg */)
 74233  	*(*uintptr)(unsafe.Pointer(ppStmt)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt
 74234  	if pzTail != 0 {
 74235  		*(*uintptr)(unsafe.Pointer(pzTail)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzOut
 74236  	}
 74237  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74238  }
 74239  
 74240  func sqlite3_client_step(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:357:5: */
 74241  	bp := tls.Alloc(88)
 74242  	defer tls.Free(88)
 74243  
 74244  	// var msg SqlMessage at bp, 88
 74245  
 74246  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Step
 74247  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 74248  	sendToServer(tls, bp /* &msg */)
 74249  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74250  }
 74251  
 74252  func sqlite3_client_reset(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:364:5: */
 74253  	bp := tls.Alloc(88)
 74254  	defer tls.Free(88)
 74255  
 74256  	// var msg SqlMessage at bp, 88
 74257  
 74258  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Reset
 74259  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 74260  	sendToServer(tls, bp /* &msg */)
 74261  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74262  }
 74263  
 74264  func sqlite3_client_finalize(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:371:5: */
 74265  	bp := tls.Alloc(88)
 74266  	defer tls.Free(88)
 74267  
 74268  	// var msg SqlMessage at bp, 88
 74269  
 74270  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Finalize
 74271  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 74272  	sendToServer(tls, bp /* &msg */)
 74273  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74274  }
 74275  
 74276  func sqlite3_client_close(tls *libc.TLS, pDb uintptr) int32 { /* test_server.c:378:5: */
 74277  	bp := tls.Alloc(88)
 74278  	defer tls.Free(88)
 74279  
 74280  	// var msg SqlMessage at bp, 88
 74281  
 74282  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Close
 74283  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb = pDb
 74284  	sendToServer(tls, bp /* &msg */)
 74285  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 74286  }
 74287  
 74288  // This routine implements the server.  To start the server, first
 74289  // make sure g.serverHalt is false, then create a new detached thread
 74290  // on this procedure.  See the sqlite3_server_start() routine below
 74291  // for an example.  This procedure loops until g.serverHalt becomes
 74292  // true.
 74293  func sqlite3_server(tls *libc.TLS, NotUsed uintptr) uintptr { /* test_server.c:393:6: */
 74294  	if libc2.Xpthread_mutex_trylock(tls, (uintptr(unsafe.Pointer(&g4))+8 /* &.serverMutex */)) != 0 {
 74295  		return uintptr(0) // Another server is already running
 74296  	}
 74297  	sqlite3.Xsqlite3_enable_shared_cache(tls, 1)
 74298  	for !(g4.FserverHalt != 0) {
 74299  		var pMsg uintptr
 74300  
 74301  		// Remove the last message from the message queue.
 74302  		libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 74303  		for (g4.FpQueueTail == uintptr(0)) && (g4.FserverHalt == 0) {
 74304  			libc2.Xpthread_cond_wait(tls, (uintptr(unsafe.Pointer(&g4)) + 16 /* &.serverWakeup */), (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 74305  		}
 74306  		pMsg = g4.FpQueueTail
 74307  		if pMsg != 0 {
 74308  			if (*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev != 0 {
 74309  				(*SqlMessage)(unsafe.Pointer((*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev)).FpNext = uintptr(0)
 74310  			} else {
 74311  				g4.FpQueueHead = uintptr(0)
 74312  			}
 74313  			g4.FpQueueTail = (*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev
 74314  		}
 74315  		libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 74316  		if pMsg == uintptr(0) {
 74317  			break
 74318  		}
 74319  
 74320  		// Process the message just removed
 74321  		libc2.Xpthread_mutex_lock(tls, (pMsg + 72 /* &.clientMutex */))
 74322  		switch (*SqlMessage)(unsafe.Pointer(pMsg)).Fop {
 74323  		case MSG_Open:
 74324  			{
 74325  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_open(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FzIn, (pMsg + 8 /* &.pDb */))
 74326  				break
 74327  
 74328  			}
 74329  		case MSG_Prepare:
 74330  			{
 74331  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_prepare(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpDb, (*SqlMessage)(unsafe.Pointer(pMsg)).FzIn, (*SqlMessage)(unsafe.Pointer(pMsg)).FnByte,
 74332  					(pMsg + 16 /* &.pStmt */), (pMsg + 48 /* &.zOut */))
 74333  				break
 74334  
 74335  			}
 74336  		case MSG_Step:
 74337  			{
 74338  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_step(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 74339  				break
 74340  
 74341  			}
 74342  		case MSG_Reset:
 74343  			{
 74344  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_reset(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 74345  				break
 74346  
 74347  			}
 74348  		case MSG_Finalize:
 74349  			{
 74350  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_finalize(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 74351  				break
 74352  
 74353  			}
 74354  		case MSG_Close:
 74355  			{
 74356  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_close(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpDb)
 74357  				break
 74358  
 74359  			}
 74360  		}
 74361  
 74362  		// Signal the client that the message has been processed.
 74363  		(*SqlMessage)(unsafe.Pointer(pMsg)).Fop = MSG_Done
 74364  		libc2.Xpthread_mutex_unlock(tls, (pMsg + 72 /* &.clientMutex */))
 74365  		libc2.Xpthread_cond_signal(tls, (pMsg + 80 /* &.clientWakeup */))
 74366  	}
 74367  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) + 8 /* &.serverMutex */))
 74368  	return uintptr(0)
 74369  }
 74370  
 74371  // Start a server thread if one is not already running.  If there
 74372  // is aleady a server thread running, the new thread will quickly
 74373  // die and this routine is effectively a no-op.
 74374  func sqlite3_server_start(tls *libc.TLS) { /* test_server.c:465:6: */
 74375  	bp := tls.Alloc(8)
 74376  	defer tls.Free(8)
 74377  
 74378  	// var x pthread_t at bp, 8
 74379  
 74380  	var rc int32
 74381  	g4.FserverHalt = 0
 74382  	rc = libc2.Xpthread_create(tls, bp /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 74383  		f func(*libc.TLS, uintptr) uintptr
 74384  	}{sqlite3_server})), uintptr(0))
 74385  	if rc == 0 {
 74386  		libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp /* x */)))
 74387  	}
 74388  }
 74389  
 74390  // A wrapper around sqlite3_server() that decrements the int variable
 74391  // pointed to by the first argument after the sqlite3_server() call
 74392  // returns.
 74393  func serverWrapper(tls *libc.TLS, pnDecr uintptr) uintptr { /* test_server.c:480:13: */
 74394  	var p uintptr = sqlite3_server(tls, uintptr(0))
 74395  	(*(*int32)(unsafe.Pointer(pnDecr)))--
 74396  	return p
 74397  }
 74398  
 74399  // This function is the similar to sqlite3_server_start(), except that
 74400  // the integer pointed to by the first argument is decremented when
 74401  // the server thread exits.
 74402  func sqlite3_server_start2(tls *libc.TLS, pnDecr uintptr) { /* test_server.c:491:6: */
 74403  	bp := tls.Alloc(8)
 74404  	defer tls.Free(8)
 74405  
 74406  	// var x pthread_t at bp, 8
 74407  
 74408  	var rc int32
 74409  	g4.FserverHalt = 0
 74410  	rc = libc2.Xpthread_create(tls, bp /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 74411  		f func(*libc.TLS, uintptr) uintptr
 74412  	}{serverWrapper})), pnDecr)
 74413  	if rc == 0 {
 74414  		libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp /* x */)))
 74415  	}
 74416  }
 74417  
 74418  // If a server thread is running, then stop it.  If no server is
 74419  // running, this routine is effectively a no-op.
 74420  //
 74421  // This routine waits until the server has actually stopped before
 74422  // returning.
 74423  func sqlite3_server_stop(tls *libc.TLS) { /* test_server.c:508:6: */
 74424  	g4.FserverHalt = 1
 74425  	libc2.Xpthread_cond_broadcast(tls, (uintptr(unsafe.Pointer(&g4)) + 16 /* &.serverWakeup */))
 74426  	libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) + 8 /* &.serverMutex */))
 74427  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) + 8 /* &.serverMutex */))
 74428  }
 74429  
 74430  // A structure to collect a busy-handler callback and argument and a count
 74431  // of the number of times it has been invoked.
 74432  type SuperlockBusy1 = struct {
 74433  	FxBusy    uintptr
 74434  	FpBusyArg uintptr
 74435  	FnBusy    int32
 74436  	_         [4]byte
 74437  } /* test_superlock.c:29:1 */
 74438  
 74439  type SuperlockBusy = SuperlockBusy1 /* test_superlock.c:34:30 */
 74440  
 74441  // An instance of the following structure is allocated for each active
 74442  // superlock. The opaque handle returned by sqlite3demo_superlock() is
 74443  // actually a pointer to an instance of this structure.
 74444  type Superlock1 = struct {
 74445  	Fdb   uintptr
 74446  	FbWal int32
 74447  	_     [4]byte
 74448  } /* test_superlock.c:41:1 */
 74449  
 74450  type Superlock = Superlock1 /* test_superlock.c:45:26 */
 74451  
 74452  // The pCtx pointer passed to this function is actually a pointer to a
 74453  // SuperlockBusy structure. Invoke the busy-handler function encapsulated
 74454  // by the structure and return the result.
 74455  func superlockBusyHandler(tls *libc.TLS, pCtx uintptr, UNUSED int32) int32 { /* test_superlock.c:52:12: */
 74456  	var pBusy uintptr = pCtx
 74457  	if (*SuperlockBusy)(unsafe.Pointer(pBusy)).FxBusy == uintptr(0) {
 74458  		return 0
 74459  	}
 74460  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pBusy /* &.xBusy */))))(tls, (*SuperlockBusy)(unsafe.Pointer(pBusy)).FpBusyArg, libc.PostIncInt32(&(*SuperlockBusy)(unsafe.Pointer(pBusy)).FnBusy, 1))
 74461  }
 74462  
 74463  // This function is used to determine if the main database file for
 74464  // connection db is open in WAL mode or not. If no error occurs and the
 74465  // database file is in WAL mode, set *pbWal to true and return SQLITE_OK.
 74466  // If it is not in WAL mode, set *pbWal to false.
 74467  //
 74468  // If an error occurs, return an SQLite error code. The value of *pbWal
 74469  // is undefined in this case.
 74470  func superlockIsWal(tls *libc.TLS, pLock uintptr) int32 { /* test_superlock.c:67:12: */
 74471  	bp := tls.Alloc(8)
 74472  	defer tls.Free(8)
 74473  
 74474  	var rc int32 // Return Code
 74475  	// var pStmt uintptr at bp, 8
 74476  	// Compiled PRAGMA journal_mode statement
 74477  
 74478  	rc = sqlite3.Xsqlite3_prepare(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+37074 /* "PRAGMA main.jour..." */, -1, bp /* &pStmt */, uintptr(0))
 74479  	if rc != SQLITE_OK {
 74480  		return rc
 74481  	}
 74482  
 74483  	(*Superlock)(unsafe.Pointer(pLock)).FbWal = 0
 74484  	if SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) {
 74485  		var zMode uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0)
 74486  		if ((zMode != 0) && (libc.Xstrlen(tls, zMode) == uint64(3))) && (sqlite3.Xsqlite3_strnicmp(tls, ts+30141 /* "wal" */, zMode, 3) == 0) {
 74487  			(*Superlock)(unsafe.Pointer(pLock)).FbWal = 1
 74488  		}
 74489  	}
 74490  
 74491  	return sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 74492  }
 74493  
 74494  // Obtain an exclusive shm-lock on nByte bytes starting at offset idx
 74495  // of the file fd. If the lock cannot be obtained immediately, invoke
 74496  // the busy-handler until either it is obtained or the busy-handler
 74497  // callback returns 0.
 74498  func superlockShmLock(tls *libc.TLS, fd uintptr, idx int32, nByte int32, pBusy uintptr) int32 { /* test_superlock.c:91:12: */
 74499  	var rc int32
 74500  	var xShmLock uintptr = (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods)).FxShmLock
 74501  	for ok := true; ok; ok = ((rc == SQLITE_BUSY) && (superlockBusyHandler(tls, pBusy, 0) != 0)) {
 74502  		rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xShmLock)))(tls, fd, idx, nByte, (SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE))
 74503  	}
 74504  	return rc
 74505  }
 74506  
 74507  // Obtain the extra locks on the database file required for WAL databases.
 74508  // Invoke the supplied busy-handler as required.
 74509  func superlockWalLock(tls *libc.TLS, db uintptr, pBusy uintptr) int32 { /* test_superlock.c:109:12: */
 74510  	bp := tls.Alloc(16)
 74511  	defer tls.Free(16)
 74512  
 74513  	var rc int32                                             // Return code
 74514  	*(*uintptr)(unsafe.Pointer(bp /* fd */)) = uintptr(0)    // Main database file handle
 74515  	*(*uintptr)(unsafe.Pointer(bp + 8 /* p */)) = uintptr(0) // Pointer to first page of shared memory
 74516  
 74517  	// Obtain a pointer to the sqlite3_file object open on the main db file.
 74518  	rc = sqlite3.Xsqlite3_file_control(tls, db, ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp /* &fd */)
 74519  	if rc != SQLITE_OK {
 74520  		return rc
 74521  	}
 74522  
 74523  	// Obtain the "recovery" lock. Normally, this lock is only obtained by
 74524  	// clients running database recovery.
 74525  	rc = superlockShmLock(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 2, 1, pBusy)
 74526  	if rc != SQLITE_OK {
 74527  		return rc
 74528  	}
 74529  
 74530  	// Zero the start of the first shared-memory page. This means that any
 74531  	// clients that open read or write transactions from this point on will
 74532  	// have to run recovery before proceeding. Since they need the "recovery"
 74533  	// lock that this process is holding to do that, no new read or write
 74534  	// transactions may now be opened. Nor can a checkpoint be run, for the
 74535  	// same reason.
 74536  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 104 /* &.xShmMap */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 0, (32 * 1024), 1, bp+8 /* &p */)
 74537  	if rc != SQLITE_OK {
 74538  		return rc
 74539  	}
 74540  	libc.Xmemset(tls, libc.AtomicLoadPUintptr(bp+8 /* p */), 0, uint64(32))
 74541  
 74542  	// Obtain exclusive locks on all the "read-lock" slots. Once these locks
 74543  	// are held, it is guaranteed that there are no active reader, writer or
 74544  	// checkpointer clients.
 74545  	rc = superlockShmLock(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 3, (SQLITE_SHM_NLOCK - 3), pBusy)
 74546  	return rc
 74547  }
 74548  
 74549  // Release a superlock held on a database file. The argument passed to
 74550  // this function must have been obtained from a successful call to
 74551  // sqlite3demo_superlock().
 74552  func sqlite3demo_superunlock(tls *libc.TLS, pLock uintptr) { /* test_superlock.c:151:6: */
 74553  	bp := tls.Alloc(8)
 74554  	defer tls.Free(8)
 74555  
 74556  	var p uintptr = pLock
 74557  	if (*Superlock)(unsafe.Pointer(p)).FbWal != 0 {
 74558  		var rc int32 // Return code
 74559  		var flags int32 = (SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE)
 74560  		*(*uintptr)(unsafe.Pointer(bp /* fd */)) = uintptr(0)
 74561  		rc = sqlite3.Xsqlite3_file_control(tls, (*Superlock)(unsafe.Pointer(p)).Fdb, ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp /* &fd */)
 74562  		if rc == SQLITE_OK {
 74563  			(*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 112 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 2, 1, flags)
 74564  			(*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 112 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 3, (SQLITE_SHM_NLOCK - 3), flags)
 74565  		}
 74566  	}
 74567  	sqlite3.Xsqlite3_close(tls, (*Superlock)(unsafe.Pointer(p)).Fdb)
 74568  	sqlite3.Xsqlite3_free(tls, p)
 74569  }
 74570  
 74571  // Obtain a superlock on the database file identified by zPath, using the
 74572  // locking primitives provided by VFS zVfs. If successful, SQLITE_OK is
 74573  // returned and output variable *ppLock is populated with an opaque handle
 74574  // that may be used with sqlite3demo_superunlock() to release the lock.
 74575  //
 74576  // If an error occurs, *ppLock is set to 0 and an SQLite error code
 74577  // (e.g. SQLITE_BUSY) is returned.
 74578  //
 74579  // If a required lock cannot be obtained immediately and the xBusy parameter
 74580  // to this function is not NULL, then xBusy is invoked in the same way
 74581  // as a busy-handler registered with SQLite (using sqlite3_busy_handler())
 74582  // until either the lock can be obtained or the busy-handler function returns
 74583  // 0 (indicating "give up").
 74584  func sqlite3demo_superlock(tls *libc.TLS, zPath uintptr, zVfs uintptr, xBusy uintptr, pBusyArg uintptr, ppLock uintptr) int32 { /* test_superlock.c:182:5: */
 74585  	bp := tls.Alloc(24)
 74586  	defer tls.Free(24)
 74587  
 74588  	*(*SuperlockBusy)(unsafe.Pointer(bp /* busy */)) = SuperlockBusy{} // Busy handler wrapper object
 74589  	var rc int32                                                       // Return code
 74590  	var pLock uintptr
 74591  
 74592  	pLock = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Superlock{})))
 74593  	if !(pLock != 0) {
 74594  		return SQLITE_NOMEM
 74595  	}
 74596  	libc.Xmemset(tls, pLock, 0, uint64(unsafe.Sizeof(Superlock{})))
 74597  
 74598  	// Open a database handle on the file to superlock.
 74599  	rc = sqlite3.Xsqlite3_open_v2(tls,
 74600  		zPath, (pLock /* &.db */), (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE), zVfs)
 74601  
 74602  	// Install a busy-handler and execute a BEGIN EXCLUSIVE. If this is not
 74603  	// a WAL database, this is all we need to do.
 74604  	//
 74605  	// A wrapper function is used to invoke the busy-handler instead of
 74606  	// registering the busy-handler function supplied by the user directly
 74607  	// with SQLite. This is because the same busy-handler function may be
 74608  	// invoked directly later on when attempting to obtain the extra locks
 74609  	// required in WAL mode. By using the wrapper, we are able to guarantee
 74610  	// that the "nBusy" integer parameter passed to the users busy-handler
 74611  	// represents the total number of busy-handler invocations made within
 74612  	// this call to sqlite3demo_superlock(), including any made during the
 74613  	// "BEGIN EXCLUSIVE".
 74614  	if rc == SQLITE_OK {
 74615  		(*SuperlockBusy)(unsafe.Pointer(bp /* &busy */)).FxBusy = xBusy
 74616  		(*SuperlockBusy)(unsafe.Pointer(bp /* &busy */)).FpBusyArg = pBusyArg
 74617  		sqlite3.Xsqlite3_busy_handler(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 74618  			f func(*libc.TLS, uintptr, int32) int32
 74619  		}{superlockBusyHandler})), bp /* &busy */)
 74620  		rc = sqlite3.Xsqlite3_exec(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+13687 /* "BEGIN EXCLUSIVE" */, uintptr(0), uintptr(0), uintptr(0))
 74621  	}
 74622  
 74623  	// If the BEGIN EXCLUSIVE was executed successfully and this is a WAL
 74624  	// database, call superlockWalLock() to obtain the extra locks required
 74625  	// to prevent readers, writers and/or checkpointers from accessing the
 74626  	// db while this process is holding the superlock.
 74627  	//
 74628  	// Before attempting any WAL locks, commit the transaction started above
 74629  	// to drop the WAL read and write locks currently held. Otherwise, the
 74630  	// new WAL locks may conflict with the old.
 74631  	if rc == SQLITE_OK {
 74632  		if (SQLITE_OK == (libc.AssignInt32(&rc, superlockIsWal(tls, pLock)))) && ((*Superlock)(unsafe.Pointer(pLock)).FbWal != 0) {
 74633  			rc = sqlite3.Xsqlite3_exec(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+12098 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0))
 74634  			if rc == SQLITE_OK {
 74635  				rc = superlockWalLock(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, bp /* &busy */)
 74636  			}
 74637  		}
 74638  	}
 74639  
 74640  	if rc != SQLITE_OK {
 74641  		sqlite3demo_superunlock(tls, pLock)
 74642  		*(*uintptr)(unsafe.Pointer(ppLock)) = uintptr(0)
 74643  	} else {
 74644  		*(*uintptr)(unsafe.Pointer(ppLock)) = pLock
 74645  	}
 74646  
 74647  	return rc
 74648  }
 74649  
 74650  // end block for C++
 74651  
 74652  // Local Variables:
 74653  // mode: c
 74654  // c-basic-offset: 4
 74655  // fill-column: 78
 74656  // End:
 74657  
 74658  type InterpAndScript1 = struct {
 74659  	Finterp  uintptr
 74660  	FpScript uintptr
 74661  } /* test_superlock.c:268:1 */
 74662  
 74663  type InterpAndScript = InterpAndScript1 /* test_superlock.c:272:32 */
 74664  
 74665  func superunlock_del(tls *libc.TLS, cd ClientData) { /* test_superlock.c:274:27: */
 74666  	sqlite3demo_superunlock(tls, cd)
 74667  }
 74668  
 74669  func superunlock_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_superlock.c:278:26: */
 74670  	if objc != 1 {
 74671  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 74672  		return TCL_ERROR
 74673  	}
 74674  	tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 74675  	return TCL_OK
 74676  }
 74677  
 74678  func superlock_busy(tls *libc.TLS, pCtx uintptr, nBusy int32) int32 { /* test_superlock.c:292:12: */
 74679  	bp := tls.Alloc(4)
 74680  	defer tls.Free(4)
 74681  
 74682  	var p uintptr = pCtx
 74683  	var pEval uintptr                            // Script to evaluate
 74684  	*(*int32)(unsafe.Pointer(bp /* iVal */)) = 0 // Value to return
 74685  
 74686  	pEval = tcl.XTcl_DuplicateObj(tls, (*InterpAndScript)(unsafe.Pointer(p)).FpScript)
 74687  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 74688  	tcl.XTcl_ListObjAppendElement(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, nBusy))
 74689  	tcl.XTcl_EvalObjEx(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 74690  	tcl.XTcl_GetIntFromObj(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp), bp /* &iVal */)
 74691  	for ok := true; ok; ok = 0 != 0 {
 74692  		var _objPtr uintptr = pEval
 74693  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 74694  			tcl.XTclFreeObj(tls, _objPtr)
 74695  		}
 74696  	}
 74697  
 74698  	return *(*int32)(unsafe.Pointer(bp /* iVal */))
 74699  }
 74700  
 74701  // Tclcmd: sqlite3demo_superlock CMDNAME PATH VFS BUSY-HANDLER-SCRIPT
 74702  func superlock_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_superlock.c:310:26: */
 74703  	bp := tls.Alloc(40)
 74704  	defer tls.Free(40)
 74705  
 74706  	// var pLock uintptr at bp+32, 8
 74707  	// Lock context
 74708  	var zPath uintptr
 74709  	var zVfs uintptr = uintptr(0)
 74710  	*(*InterpAndScript)(unsafe.Pointer(bp + 16 /* busy */)) = InterpAndScript{}
 74711  	var xBusy uintptr = uintptr(0) // Busy handler callback
 74712  	var rc int32                   // Return code from sqlite3demo_superlock()
 74713  
 74714  	if (objc < 3) || (objc > 5) {
 74715  		tcl.XTcl_WrongNumArgs(tls,
 74716  			interp, 1, objv, ts+37099 /* "CMDNAME PATH ?VF..." */)
 74717  		return TCL_ERROR
 74718  	}
 74719  
 74720  	zPath = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 74721  
 74722  	if objc > 3 {
 74723  		zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 74724  		if libc.Xstrlen(tls, zVfs) == uint64(0) {
 74725  			zVfs = uintptr(0)
 74726  		}
 74727  	}
 74728  	if objc > 4 {
 74729  		(*InterpAndScript)(unsafe.Pointer(bp + 16 /* &busy */)).Finterp = interp
 74730  		(*InterpAndScript)(unsafe.Pointer(bp + 16 /* &busy */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 4*8))
 74731  		xBusy = *(*uintptr)(unsafe.Pointer(&struct {
 74732  			f func(*libc.TLS, uintptr, int32) int32
 74733  		}{superlock_busy}))
 74734  	}
 74735  
 74736  	rc = sqlite3demo_superlock(tls, zPath, zVfs, xBusy, bp+16 /* &busy */, bp+32 /* &pLock */)
 74737  
 74738  	if rc != SQLITE_OK {
 74739  		tcl.XTcl_ResetResult(tls, interp)
 74740  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 74741  		return TCL_ERROR
 74742  	}
 74743  
 74744  	tcl.XTcl_CreateObjCommand(tls,
 74745  		interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), *(*uintptr)(unsafe.Pointer(&struct {
 74746  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 74747  		}{superunlock_cmd})), *(*uintptr)(unsafe.Pointer(bp + 32 /* pLock */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{superunlock_del})))
 74748  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 74749  	return TCL_OK
 74750  }
 74751  
 74752  func SqliteSuperlock_Init(tls *libc.TLS, interp uintptr) int32 { /* test_superlock.c:359:5: */
 74753  	tcl.XTcl_CreateObjCommand(tls, interp, ts+37140 /* "sqlite3demo_supe..." */, *(*uintptr)(unsafe.Pointer(&struct {
 74754  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 74755  	}{superlock_cmd})), uintptr(0), uintptr(0))
 74756  	return TCL_OK
 74757  }
 74758  
 74759  // -
 74760  // SPDX-License-Identifier: BSD-3-Clause
 74761  //
 74762  // Copyright (c) 1982, 1986, 1993
 74763  //	The Regents of the University of California.  All rights reserved.
 74764  //
 74765  // Redistribution and use in source and binary forms, with or without
 74766  // modification, are permitted provided that the following conditions
 74767  // are met:
 74768  // 1. Redistributions of source code must retain the above copyright
 74769  //    notice, this list of conditions and the following disclaimer.
 74770  // 2. Redistributions in binary form must reproduce the above copyright
 74771  //    notice, this list of conditions and the following disclaimer in the
 74772  //    documentation and/or other materials provided with the distribution.
 74773  // 3. Neither the name of the University nor the names of its contributors
 74774  //    may be used to endorse or promote products derived from this software
 74775  //    without specific prior written permission.
 74776  //
 74777  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 74778  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 74779  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 74780  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 74781  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 74782  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 74783  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 74784  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 74785  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 74786  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 74787  // SUCH DAMAGE.
 74788  //
 74789  //	@(#)mman.h	8.2 (Berkeley) 1/9/95
 74790  // $FreeBSD$
 74791  
 74792  // -
 74793  // SPDX-License-Identifier: BSD-3-Clause
 74794  //
 74795  // Copyright (c) 1991, 1993
 74796  //	The Regents of the University of California.  All rights reserved.
 74797  //
 74798  // This code is derived from software contributed to Berkeley by
 74799  // Berkeley Software Design, Inc.
 74800  //
 74801  // Redistribution and use in source and binary forms, with or without
 74802  // modification, are permitted provided that the following conditions
 74803  // are met:
 74804  // 1. Redistributions of source code must retain the above copyright
 74805  //    notice, this list of conditions and the following disclaimer.
 74806  // 2. Redistributions in binary form must reproduce the above copyright
 74807  //    notice, this list of conditions and the following disclaimer in the
 74808  //    documentation and/or other materials provided with the distribution.
 74809  // 3. Neither the name of the University nor the names of its contributors
 74810  //    may be used to endorse or promote products derived from this software
 74811  //    without specific prior written permission.
 74812  //
 74813  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 74814  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 74815  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 74816  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 74817  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 74818  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 74819  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 74820  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 74821  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 74822  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 74823  // SUCH DAMAGE.
 74824  //
 74825  //	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
 74826  // $FreeBSD$
 74827  
 74828  // -
 74829  // SPDX-License-Identifier: BSD-2-Clause-FreeBSD
 74830  //
 74831  // Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
 74832  // All rights reserved.
 74833  //
 74834  // Redistribution and use in source and binary forms, with or without
 74835  // modification, are permitted provided that the following conditions
 74836  // are met:
 74837  // 1. Redistributions of source code must retain the above copyright
 74838  //    notice, this list of conditions and the following disclaimer.
 74839  // 2. Redistributions in binary form must reproduce the above copyright
 74840  //    notice, this list of conditions and the following disclaimer in the
 74841  //    documentation and/or other materials provided with the distribution.
 74842  //
 74843  // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 74844  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 74845  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 74846  // ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 74847  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 74848  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 74849  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 74850  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 74851  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 74852  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 74853  // SUCH DAMAGE.
 74854  //
 74855  // $FreeBSD$
 74856  
 74857  // Inheritance for minherit()
 74858  
 74859  // Protections are chosen from these bits, or-ed together
 74860  
 74861  // Flags contain sharing type and options.
 74862  // Sharing types; choose one.
 74863  
 74864  // Other flags
 74865  
 74866  // Mapping type
 74867  
 74868  // Extended flags
 74869  
 74870  // Request specific alignment (n == log2 of the desired alignment).
 74871  //
 74872  // MAP_ALIGNED_SUPER requests optimal superpage alignment, but does
 74873  // not enforce a specific alignment.
 74874  
 74875  // Flags provided to shm_rename
 74876  // Don't overwrite dest, if it exists
 74877  // Atomically swap src and dest
 74878  
 74879  // Process memory locking
 74880  
 74881  // Error return from mmap()
 74882  
 74883  // msync() flags
 74884  
 74885  // Advice to madvise
 74886  
 74887  // Return bits from mincore
 74888  
 74889  // Anonymous object constant for shm_open().
 74890  
 74891  // shmflags for shm_open2()
 74892  
 74893  type shm_largepage_conf = struct {
 74894  	Fpsind        int32
 74895  	Falloc_policy int32
 74896  	Fpad          [10]int32
 74897  } /* mman.h:201:1 */
 74898  
 74899  // 11 was EAGAIN
 74900  
 74901  // math software
 74902  
 74903  // non-blocking and interrupt i/o
 74904  
 74905  // ipc/network software -- argument errors
 74906  
 74907  // ipc/network software -- operational errors
 74908  
 74909  // should be rearranged
 74910  
 74911  // quotas & mush
 74912  
 74913  // Network File System
 74914  
 74915  // ISO/IEC 9899:2011 K.3.2.2
 74916  
 74917  type TestSyscallGlobal = struct {
 74918  	FbPersist         int32
 74919  	FnCount           int32
 74920  	FnFail            int32
 74921  	Fpgsz             int32
 74922  	Forig_getpagesize sqlite3_syscall_ptr
 74923  } /* test_syscall.c:97:8 */
 74924  
 74925  // 11 was EAGAIN
 74926  
 74927  // math software
 74928  
 74929  // non-blocking and interrupt i/o
 74930  
 74931  // ipc/network software -- argument errors
 74932  
 74933  // ipc/network software -- operational errors
 74934  
 74935  // should be rearranged
 74936  
 74937  // quotas & mush
 74938  
 74939  // Network File System
 74940  
 74941  // ISO/IEC 9899:2011 K.3.2.2
 74942  
 74943  var gSyscall = TestSyscallGlobal{} /* test_syscall.c:103:3 */
 74944  
 74945  type TestSyscallArray = struct {
 74946  	FzName         uintptr
 74947  	FxTest         sqlite3_syscall_ptr
 74948  	FxOrig         sqlite3_syscall_ptr
 74949  	Fdefault_errno int32
 74950  	Fcustom_errno  int32
 74951  } /* test_syscall.c:127:1 */
 74952  
 74953  var aSyscall = [19]TestSyscallArray{
 74954  	/*  0 */ {FzName: ts + 37162 /* "open" */, FxTest: 0, Fdefault_errno: EACCES},
 74955  	/*  1 */ {FzName: ts + 10125 /* "close" */, FxTest: 0},
 74956  	/*  2 */ {FzName: ts + 37167 /* "access" */, FxTest: 0},
 74957  	/*  3 */ {FzName: ts + 37174 /* "getcwd" */, FxTest: 0},
 74958  	/*  4 */ {FzName: ts + 37181 /* "stat" */, FxTest: 0},
 74959  	/*  5 */ {FzName: ts + 37186 /* "fstat" */, FxTest: 0},
 74960  	/*  6 */ {FzName: ts + 37192 /* "ftruncate" */, FxTest: 0, Fdefault_errno: EIO},
 74961  	/*  7 */ {FzName: ts + 37202 /* "fcntl" */, FxTest: 0, Fdefault_errno: EACCES},
 74962  	/*  8 */ {FzName: ts + 25406 /* "read" */, FxTest: 0},
 74963  	/*  9 */ {FzName: ts + 37208 /* "pread" */, FxTest: 0},
 74964  	/* 10 */ {FzName: ts + 37214 /* "pread64" */, FxTest: 0},
 74965  	/* 11 */ {FzName: ts + 25411 /* "write" */, FxTest: 0},
 74966  	/* 12 */ {FzName: ts + 37222 /* "pwrite" */, FxTest: 0},
 74967  	/* 13 */ {FzName: ts + 37229 /* "pwrite64" */, FxTest: 0},
 74968  	/* 14 */ {FzName: ts + 37238 /* "fchmod" */, FxTest: 0},
 74969  	/* 15 */ {FzName: ts + 37245 /* "fallocate" */, FxTest: 0},
 74970  	/* 16 */ {FzName: ts + 29235 /* "mmap" */, FxTest: 0},
 74971  	/* 17 */ {FzName: ts + 37255 /* "mremap" */, FxTest: 0},
 74972  	{},
 74973  } /* test_syscall.c:133:3 */
 74974  
 74975  // This function is called exactly once from within each invocation of a
 74976  // system call wrapper in this file. It returns 1 if the function should
 74977  // fail, or 0 if it should succeed.
 74978  func tsIsFail(tls *libc.TLS) int32 { /* test_syscall.c:181:12: */
 74979  	gSyscall.FnCount--
 74980  	if (gSyscall.FnCount == 0) || ((gSyscall.FnFail != 0) && (gSyscall.FbPersist != 0)) {
 74981  		gSyscall.FnFail++
 74982  		return 1
 74983  	}
 74984  	return 0
 74985  }
 74986  
 74987  // Return the current error-number value for function zFunc. zFunc must be
 74988  // the name of a system call in the aSyscall[] table.
 74989  //
 74990  // Usually, the current error-number is the value that errno should be set
 74991  // to if the named system call fails. The exception is "fallocate". See
 74992  // comments above the implementation of ts_fallocate() for details.
 74993  func tsErrno(tls *libc.TLS, zFunc uintptr) int32 { /* test_syscall.c:198:12: */
 74994  	var i int32
 74995  	var nFunc int32 = int32(libc.Xstrlen(tls, zFunc))
 74996  	for i = 0; aSyscall[i].FzName != 0; i++ {
 74997  		if libc.Xstrlen(tls, aSyscall[i].FzName) != size_t(nFunc) {
 74998  			continue
 74999  		}
 75000  		if libc.Xmemcmp(tls, aSyscall[i].FzName, zFunc, uint64(nFunc)) != 0 {
 75001  			continue
 75002  		}
 75003  		return aSyscall[i].Fcustom_errno
 75004  	}
 75005  
 75006  	return 0
 75007  }
 75008  
 75009  /*
 75010  ** A wrapper around tsIsFail(). If tsIsFail() returns non-zero, set the
 75011  ** value of errno before returning.
 75012   */
 75013  func tsIsFailErrno(tls *libc.TLS, zFunc uintptr) int32 { /* test_syscall.c:215:12: */
 75014  	if tsIsFail(tls) != 0 {
 75015  		(*(*int32)(unsafe.Pointer(libc.X__error(tls)))) = tsErrno(tls, zFunc)
 75016  		return 1
 75017  	}
 75018  	return 0
 75019  }
 75020  
 75021  // A wrapper around open().
 75022  func ts_open(tls *libc.TLS, zFile uintptr, flags int32, mode int32) int32 { /* test_syscall.c:226:12: */
 75023  	if tsIsFailErrno(tls, ts+37162 /* "open" */) != 0 {
 75024  		return -1
 75025  	}
 75026  	return (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16 /* &.xOrig */))))(tls, zFile, flags, mode)
 75027  }
 75028  
 75029  // A wrapper around close().
 75030  func ts_close(tls *libc.TLS, fd int32) int32 { /* test_syscall.c:236:12: */
 75031  	if tsIsFail(tls) != 0 {
 75032  		// Even if simulating an error, close the original file-descriptor.
 75033  		// This is to stop the test process from running out of file-descriptors
 75034  		// when running a long test. If a call to close() appears to fail, SQLite
 75035  		// never attempts to use the file-descriptor afterwards (or even to close
 75036  		// it a second time).
 75037  		(*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*32 + 16 /* &.xOrig */))))(tls, fd)
 75038  		return -1
 75039  	}
 75040  	return (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*32 + 16 /* &.xOrig */))))(tls, fd)
 75041  }
 75042  
 75043  // A wrapper around access().
 75044  func ts_access(tls *libc.TLS, zPath uintptr, mode int32) int32 { /* test_syscall.c:252:12: */
 75045  	if tsIsFail(tls) != 0 {
 75046  		return -1
 75047  	}
 75048  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*32 + 16 /* &.xOrig */))))(tls, zPath, mode)
 75049  }
 75050  
 75051  // A wrapper around getcwd().
 75052  func ts_getcwd(tls *libc.TLS, zPath uintptr, nPath size_t) uintptr { /* test_syscall.c:262:13: */
 75053  	if tsIsFail(tls) != 0 {
 75054  		return uintptr(0)
 75055  	}
 75056  	return (*(*func(*libc.TLS, uintptr, size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*32 + 16 /* &.xOrig */))))(tls, zPath, nPath)
 75057  }
 75058  
 75059  // A wrapper around stat().
 75060  func ts_stat(tls *libc.TLS, zPath uintptr, p uintptr) int32 { /* test_syscall.c:272:12: */
 75061  	if tsIsFail(tls) != 0 {
 75062  		return -1
 75063  	}
 75064  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*32 + 16 /* &.xOrig */))))(tls, zPath, p)
 75065  }
 75066  
 75067  // A wrapper around fstat().
 75068  func ts_fstat(tls *libc.TLS, fd int32, p uintptr) int32 { /* test_syscall.c:282:12: */
 75069  	if tsIsFailErrno(tls, ts+37186 /* "fstat" */) != 0 {
 75070  		return -1
 75071  	}
 75072  	return (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*32 + 16 /* &.xOrig */))))(tls, fd, p)
 75073  }
 75074  
 75075  // A wrapper around ftruncate().
 75076  func ts_ftruncate(tls *libc.TLS, fd int32, n off_t) int32 { /* test_syscall.c:292:12: */
 75077  	if tsIsFailErrno(tls, ts+37192 /* "ftruncate" */) != 0 {
 75078  		return -1
 75079  	}
 75080  	return (*(*func(*libc.TLS, int32, off_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 6*32 + 16 /* &.xOrig */))))(tls, fd, n)
 75081  }
 75082  
 75083  // A wrapper around fcntl().
 75084  func ts_fcntl(tls *libc.TLS, fd int32, cmd int32, va uintptr) int32 { /* test_syscall.c:302:12: */
 75085  	bp := tls.Alloc(8)
 75086  	defer tls.Free(8)
 75087  
 75088  	var ap va_list
 75089  	_ = ap
 75090  	var pArg uintptr
 75091  	if tsIsFailErrno(tls, ts+37202 /* "fcntl" */) != 0 {
 75092  		return -1
 75093  	}
 75094  	ap = va
 75095  	pArg = libc.VaUintptr(&ap)
 75096  	return (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*32 + 16 /* &.xOrig */))))(tls, fd, cmd, libc.VaList(bp, pArg))
 75097  }
 75098  
 75099  // A wrapper around read().
 75100  func ts_read(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t) int32 { /* test_syscall.c:316:12: */
 75101  	if tsIsFailErrno(tls, ts+25406 /* "read" */) != 0 {
 75102  		return -1
 75103  	}
 75104  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf))
 75105  }
 75106  
 75107  // A wrapper around pread().
 75108  func ts_pread(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off off_t) int32 { /* test_syscall.c:326:12: */
 75109  	if tsIsFailErrno(tls, ts+37208 /* "pread" */) != 0 {
 75110  		return -1
 75111  	}
 75112  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t, off_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 9*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off))
 75113  }
 75114  
 75115  // A wrapper around pread64().
 75116  func ts_pread64(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off sqlite3_uint64) int32 { /* test_syscall.c:336:12: */
 75117  	if tsIsFailErrno(tls, ts+37214 /* "pread64" */) != 0 {
 75118  		return -1
 75119  	}
 75120  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 10*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off))
 75121  }
 75122  
 75123  // A wrapper around write().
 75124  func ts_write(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t) int32 { /* test_syscall.c:346:12: */
 75125  	if tsIsFailErrno(tls, ts+25411 /* "write" */) != 0 {
 75126  		if tsErrno(tls, ts+25411 /* "write" */) == EINTR {
 75127  			(*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, (nBuf / uint64(2)))
 75128  		}
 75129  		return -1
 75130  	}
 75131  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf))
 75132  }
 75133  
 75134  // A wrapper around pwrite().
 75135  func ts_pwrite(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off off_t) int32 { /* test_syscall.c:357:12: */
 75136  	if tsIsFailErrno(tls, ts+37222 /* "pwrite" */) != 0 {
 75137  		return -1
 75138  	}
 75139  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t, off_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 12*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off))
 75140  }
 75141  
 75142  // A wrapper around pwrite64().
 75143  func ts_pwrite64(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off sqlite3_uint64) int32 { /* test_syscall.c:367:12: */
 75144  	if tsIsFailErrno(tls, ts+37229 /* "pwrite64" */) != 0 {
 75145  		return -1
 75146  	}
 75147  	return int32((*(*func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 13*32 + 16 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off))
 75148  }
 75149  
 75150  // A wrapper around fchmod().
 75151  func ts_fchmod(tls *libc.TLS, fd int32, mode mode_t) int32 { /* test_syscall.c:377:12: */
 75152  	if tsIsFail(tls) != 0 {
 75153  		return -1
 75154  	}
 75155  	return (*(*func(*libc.TLS, int32, mode_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 14*32 + 16 /* &.xOrig */))))(tls, fd, mode)
 75156  }
 75157  
 75158  // A wrapper around fallocate().
 75159  //
 75160  // SQLite assumes that the fallocate() function is compatible with
 75161  // posix_fallocate(). According to the Linux man page (2009-09-30):
 75162  //
 75163  //   posix_fallocate() returns  zero on success, or an error number on
 75164  //   failure. Note that errno is not set.
 75165  func ts_fallocate(tls *libc.TLS, fd int32, off off_t, len off_t) int32 { /* test_syscall.c:393:12: */
 75166  	if tsIsFail(tls) != 0 {
 75167  		return tsErrno(tls, ts+37245 /* "fallocate" */)
 75168  	}
 75169  	return (*(*func(*libc.TLS, int32, off_t, off_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 15*32 + 16 /* &.xOrig */))))(tls, fd, off, len)
 75170  }
 75171  
 75172  func ts_mmap(tls *libc.TLS, pAddr uintptr, nByte size_t, prot int32, flags int32, fd int32, iOff off_t) uintptr { /* test_syscall.c:400:13: */
 75173  	if tsIsFailErrno(tls, ts+29235 /* "mmap" */) != 0 {
 75174  		return libc.UintptrFromInt32(-1)
 75175  	}
 75176  	return (*(*func(*libc.TLS, uintptr, size_t, int32, int32, int32, off_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16*32 + 16 /* &.xOrig */))))(tls, pAddr, nByte, prot, flags, fd, iOff)
 75177  }
 75178  
 75179  func ts_mremap(tls *libc.TLS, a uintptr, b size_t, c size_t, d int32, va uintptr) uintptr { /* test_syscall.c:414:13: */
 75180  	bp := tls.Alloc(8)
 75181  	defer tls.Free(8)
 75182  
 75183  	var ap va_list
 75184  	_ = ap
 75185  	var pArg uintptr
 75186  	if tsIsFailErrno(tls, ts+37255 /* "mremap" */) != 0 {
 75187  		return libc.UintptrFromInt32(-1)
 75188  	}
 75189  	ap = va
 75190  	pArg = libc.VaUintptr(&ap)
 75191  	return (*(*func(*libc.TLS, uintptr, size_t, size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*32 + 16 /* &.xOrig */))))(tls, a, b, c, d, libc.VaList(bp, pArg))
 75192  }
 75193  
 75194  func test_syscall_install(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:425:26: */
 75195  	bp := tls.Alloc(20)
 75196  	defer tls.Free(20)
 75197  
 75198  	var pVfs uintptr
 75199  	// var nElem int32 at bp, 4
 75200  
 75201  	var i int32
 75202  	// var apElem uintptr at bp+8, 8
 75203  
 75204  	if objc != 3 {
 75205  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37262 /* "SYSCALL-LIST" */)
 75206  		return TCL_ERROR
 75207  	}
 75208  	if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &nElem */, bp+8 /* &apElem */) != 0 {
 75209  		return TCL_ERROR
 75210  	}
 75211  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75212  
 75213  	for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nElem */)); i++ {
 75214  		// var iCall int32 at bp+16, 4
 75215  
 75216  		var rc int32 = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 75217  			*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 8 /* apElem */)) + uintptr(i)*8)), uintptr(unsafe.Pointer(&aSyscall)), int32(unsafe.Sizeof(TestSyscallArray{})), ts+37275 /* "system-call" */, 0, bp+16 /* &iCall */)
 75218  		if rc != 0 {
 75219  			return rc
 75220  		}
 75221  		if aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].FxOrig == uintptr(0) {
 75222  			aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].FxOrig = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 152 /* &.xGetSystemCall */))))(tls, pVfs, aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].FzName)
 75223  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls, pVfs, aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].FzName, aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].FxTest)
 75224  		}
 75225  		aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].Fcustom_errno = aSyscall[*(*int32)(unsafe.Pointer(bp + 16 /* iCall */))].Fdefault_errno
 75226  	}
 75227  
 75228  	return TCL_OK
 75229  }
 75230  
 75231  func test_syscall_uninstall(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:461:26: */
 75232  	var pVfs uintptr
 75233  	var i int32
 75234  
 75235  	if objc != 2 {
 75236  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 75237  		return TCL_ERROR
 75238  	}
 75239  
 75240  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75241  	for i = 0; aSyscall[i].FzName != 0; i++ {
 75242  		if aSyscall[i].FxOrig != 0 {
 75243  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls, pVfs, aSyscall[i].FzName, uintptr(0))
 75244  			aSyscall[i].FxOrig = uintptr(0)
 75245  		}
 75246  	}
 75247  	return TCL_OK
 75248  }
 75249  
 75250  func test_syscall_reset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:485:26: */
 75251  	bp := tls.Alloc(4)
 75252  	defer tls.Free(4)
 75253  
 75254  	var pVfs uintptr
 75255  	var i int32
 75256  	var rc int32
 75257  
 75258  	if (objc != 2) && (objc != 3) {
 75259  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 75260  		return TCL_ERROR
 75261  	}
 75262  
 75263  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75264  	if objc == 2 {
 75265  		rc = (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls, pVfs, uintptr(0), uintptr(0))
 75266  		for i = 0; aSyscall[i].FzName != 0; i++ {
 75267  			aSyscall[i].FxOrig = uintptr(0)
 75268  		}
 75269  	} else {
 75270  		// var nFunc int32 at bp, 4
 75271  
 75272  		var zFunc uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &nFunc */)
 75273  		rc = (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls, pVfs, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), uintptr(0))
 75274  		for i = 0; (rc == SQLITE_OK) && (aSyscall[i].FzName != 0); i++ {
 75275  			if libc.Xstrlen(tls, aSyscall[i].FzName) != size_t(*(*int32)(unsafe.Pointer(bp /* nFunc */))) {
 75276  				continue
 75277  			}
 75278  			if libc.Xmemcmp(tls, aSyscall[i].FzName, zFunc, uint64(*(*int32)(unsafe.Pointer(bp /* nFunc */)))) != 0 {
 75279  				continue
 75280  			}
 75281  			aSyscall[i].FxOrig = uintptr(0)
 75282  		}
 75283  	}
 75284  	if rc != SQLITE_OK {
 75285  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 75286  		return TCL_ERROR
 75287  	}
 75288  
 75289  	tcl.XTcl_ResetResult(tls, interp)
 75290  	return TCL_OK
 75291  }
 75292  
 75293  func test_syscall_exists(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:523:26: */
 75294  	var pVfs uintptr
 75295  	var x sqlite3_syscall_ptr
 75296  
 75297  	if objc != 3 {
 75298  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 75299  		return TCL_ERROR
 75300  	}
 75301  
 75302  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75303  	x = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 152 /* &.xGetSystemCall */))))(tls, pVfs, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))))
 75304  
 75305  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((libc.Bool32(x != uintptr(0))) != 0))))
 75306  	return TCL_OK
 75307  }
 75308  
 75309  func test_syscall_fault(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:544:26: */
 75310  	bp := tls.Alloc(8)
 75311  	defer tls.Free(8)
 75312  
 75313  	*(*int32)(unsafe.Pointer(bp /* nCount */)) = 0
 75314  	*(*int32)(unsafe.Pointer(bp + 4 /* bPersist */)) = 0
 75315  
 75316  	if (objc != 2) && (objc != 4) {
 75317  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37287 /* "?COUNT PERSIST?" */)
 75318  		return TCL_ERROR
 75319  	}
 75320  
 75321  	if objc == 4 {
 75322  		if (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp /* &nCount */) != 0) ||
 75323  			(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+4 /* &bPersist */) != 0) {
 75324  			return TCL_ERROR
 75325  		}
 75326  	}
 75327  
 75328  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, gSyscall.FnFail))
 75329  	gSyscall.FnCount = *(*int32)(unsafe.Pointer(bp /* nCount */))
 75330  	gSyscall.FbPersist = *(*int32)(unsafe.Pointer(bp + 4 /* bPersist */))
 75331  	gSyscall.FnFail = 0
 75332  	return TCL_OK
 75333  }
 75334  
 75335  func test_syscall_errno(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:573:26: */
 75336  	bp := tls.Alloc(204)
 75337  	defer tls.Free(204)
 75338  
 75339  	// var iCall int32 at bp, 4
 75340  
 75341  	// var iErrno int32 at bp+200, 4
 75342  
 75343  	var rc int32
 75344  
 75345  	*(*[12]Errno)(unsafe.Pointer(bp + 8 /* aErrno */)) = [12]Errno{
 75346  		{Fz: ts + 37303 /* "EACCES" */, Fi: EACCES},
 75347  		{Fz: ts + 37310 /* "EINTR" */, Fi: EINTR},
 75348  		{Fz: ts + 37316 /* "EIO" */, Fi: EIO},
 75349  		{Fz: ts + 37320 /* "EOVERFLOW" */, Fi: EOVERFLOW},
 75350  		{Fz: ts + 37330 /* "ENOMEM" */, Fi: ENOMEM},
 75351  		{Fz: ts + 37337 /* "EAGAIN" */, Fi: EAGAIN},
 75352  		{Fz: ts + 37344 /* "ETIMEDOUT" */, Fi: ETIMEDOUT},
 75353  		{Fz: ts + 37354 /* "EBUSY" */, Fi: EBUSY},
 75354  		{Fz: ts + 37360 /* "EPERM" */, Fi: EPERM},
 75355  		{Fz: ts + 37366 /* "EDEADLK" */, Fi: EDEADLK},
 75356  		{Fz: ts + 37374 /* "ENOLCK" */, Fi: ENOLCK},
 75357  		{},
 75358  	}
 75359  
 75360  	if objc != 4 {
 75361  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37381 /* "SYSCALL ERRNO" */)
 75362  		return TCL_ERROR
 75363  	}
 75364  
 75365  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 75366  		*(*uintptr)(unsafe.Pointer(objv + 2*8)), uintptr(unsafe.Pointer(&aSyscall)), int32(unsafe.Sizeof(TestSyscallArray{})), ts+37275 /* "system-call" */, 0, bp /* &iCall */)
 75367  	if rc != TCL_OK {
 75368  		return rc
 75369  	}
 75370  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 75371  		*(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+8 /* &aErrno[0] */, int32(unsafe.Sizeof(Errno{})), ts+37395 /* "errno" */, 0, bp+200 /* &iErrno */)
 75372  	if rc != TCL_OK {
 75373  		return rc
 75374  	}
 75375  
 75376  	aSyscall[*(*int32)(unsafe.Pointer(bp /* iCall */))].Fcustom_errno = (*Errno)(unsafe.Pointer(bp + 8 /* &aErrno */ + uintptr(*(*int32)(unsafe.Pointer(bp + 200 /* iErrno */)))*16)).Fi
 75377  	return TCL_OK
 75378  }
 75379  
 75380  type Errno = struct {
 75381  	Fz uintptr
 75382  	Fi int32
 75383  	_  [4]byte
 75384  } /* test_syscall.c:583:3 */
 75385  
 75386  func test_syscall_list(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:619:26: */
 75387  	var zSys uintptr
 75388  	var pVfs uintptr
 75389  	var pList uintptr
 75390  
 75391  	if objc != 2 {
 75392  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 75393  		return TCL_ERROR
 75394  	}
 75395  
 75396  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75397  	pList = tcl.XTcl_NewObj(tls)
 75398  	(*Tcl_Obj)(unsafe.Pointer(pList)).FrefCount++
 75399  	for zSys = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 160 /* &.xNextSystemCall */))))(tls, pVfs, uintptr(0)); zSys != uintptr(0); zSys = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 160 /* &.xNextSystemCall */))))(tls, pVfs, zSys) {
 75400  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, zSys, -1))
 75401  	}
 75402  
 75403  	tcl.XTcl_SetObjResult(tls, interp, pList)
 75404  	for ok := true; ok; ok = 0 != 0 {
 75405  		var _objPtr uintptr = pList
 75406  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75407  			tcl.XTclFreeObj(tls, _objPtr)
 75408  		}
 75409  	}
 75410  	return TCL_OK
 75411  }
 75412  
 75413  func test_syscall_defaultvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:649:26: */
 75414  	var pVfs uintptr
 75415  
 75416  	if objc != 2 {
 75417  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 75418  		return TCL_ERROR
 75419  	}
 75420  
 75421  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75422  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, -1))
 75423  	return TCL_OK
 75424  }
 75425  
 75426  func ts_getpagesize(tls *libc.TLS) int32 { /* test_syscall.c:667:12: */
 75427  	return gSyscall.Fpgsz
 75428  }
 75429  
 75430  func test_syscall_pagesize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:671:26: */
 75431  	bp := tls.Alloc(20)
 75432  	defer tls.Free(20)
 75433  
 75434  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75435  	// var pgsz int32 at bp+16, 4
 75436  
 75437  	if objc != 3 {
 75438  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37401 /* "PGSZ" */)
 75439  		return TCL_ERROR
 75440  	}
 75441  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+16 /* &pgsz */) != 0 {
 75442  		return TCL_ERROR
 75443  	}
 75444  
 75445  	if *(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) < 0 {
 75446  		if gSyscall.Forig_getpagesize != 0 {
 75447  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls, pVfs, ts+37406 /* "getpagesize" */, gSyscall.Forig_getpagesize)
 75448  		}
 75449  	} else {
 75450  		if (*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) < 512) || ((*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) & (*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) - 1)) != 0) {
 75451  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+37418 /* "pgsz out of rang..." */, 0))
 75452  			return TCL_ERROR
 75453  		}
 75454  		gSyscall.Forig_getpagesize = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 152 /* &.xGetSystemCall */))))(tls, pVfs, ts+37406 /* "getpagesize" */)
 75455  		gSyscall.Fpgsz = *(*int32)(unsafe.Pointer(bp + 16 /* pgsz */))
 75456  		(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 144 /* &.xSetSystemCall */))))(tls,
 75457  			pVfs, ts+37406 /* "getpagesize" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{ts_getpagesize})))
 75458  	}
 75459  
 75460  	return TCL_OK
 75461  }
 75462  
 75463  func test_syscall(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:706:26: */
 75464  	bp := tls.Alloc(180)
 75465  	defer tls.Free(180)
 75466  
 75467  	*(*[10]SyscallCmd)(unsafe.Pointer(bp + 16 /* aCmd */)) = [10]SyscallCmd{
 75468  		{FzName: ts + 37436 /* "fault" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75469  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75470  		}{test_syscall_fault}))},
 75471  		{FzName: ts + 37442 /* "install" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75472  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75473  		}{test_syscall_install}))},
 75474  		{FzName: ts + 37450 /* "uninstall" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75475  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75476  		}{test_syscall_uninstall}))},
 75477  		{FzName: ts + 7379 /* "reset" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75478  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75479  		}{test_syscall_reset}))},
 75480  		{FzName: ts + 37395 /* "errno" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75481  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75482  		}{test_syscall_errno}))},
 75483  		{FzName: ts + 13977 /* "exists" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75484  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75485  		}{test_syscall_exists}))},
 75486  		{FzName: ts + 37460 /* "list" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75487  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75488  		}{test_syscall_list}))},
 75489  		{FzName: ts + 37465 /* "defaultvfs" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75490  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75491  		}{test_syscall_defaultvfs}))},
 75492  		{FzName: ts + 37476 /* "pagesize" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75493  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75494  		}{test_syscall_pagesize}))},
 75495  		{},
 75496  	}
 75497  	// var iCmd int32 at bp+176, 4
 75498  
 75499  	var rc int32
 75500  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 75501  
 75502  	if objc < 2 {
 75503  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 75504  		return TCL_ERROR
 75505  	}
 75506  	if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion < 3) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxSetSystemCall == uintptr(0)) {
 75507  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+37485 /* "VFS does not sup..." */, 0))
 75508  		rc = TCL_ERROR
 75509  	} else {
 75510  		rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 75511  			*(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+16 /* &aCmd[0] */, int32(unsafe.Sizeof(SyscallCmd{})), ts+1875 /* "sub-command" */, 0, bp+176 /* &iCmd */)
 75512  	}
 75513  	if rc != TCL_OK {
 75514  		return rc
 75515  	}
 75516  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 16 /* &aCmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* iCmd */)))*16 + 8 /* &.xCmd */))))(tls, clientData, interp, objc, objv)
 75517  }
 75518  
 75519  type SyscallCmd = struct {
 75520  	FzName uintptr
 75521  	FxCmd  uintptr
 75522  } /* test_syscall.c:712:3 */
 75523  
 75524  func SqlitetestSyscall_Init(tls *libc.TLS, interp uintptr) int32 { /* test_syscall.c:747:5: */
 75525  	bp := tls.Alloc(16)
 75526  	defer tls.Free(16)
 75527  
 75528  	*(*[1]SyscallCmd)(unsafe.Pointer(bp /* aCmd */)) = [1]SyscallCmd{
 75529  		{FzName: ts + 37521 /* "test_syscall" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 75530  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75531  		}{test_syscall}))},
 75532  	}
 75533  	var i int32
 75534  
 75535  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof([1]SyscallCmd{})) / uint64(unsafe.Sizeof(SyscallCmd{}))); i++ {
 75536  		tcl.XTcl_CreateObjCommand(tls, interp, (*SyscallCmd)(unsafe.Pointer(bp /* &aCmd */ +uintptr(i)*16)).FzName, (*SyscallCmd)(unsafe.Pointer(bp /* &aCmd */ +uintptr(i)*16)).FxCmd, uintptr(0), uintptr(0))
 75537  	}
 75538  	return TCL_OK
 75539  }
 75540  
 75541  // This routine is the primary export of this file.
 75542  //
 75543  // Configure the interpreter passed as the first argument to have access
 75544  // to the commands and linked variables that make up:
 75545  //
 75546  //   * the [sqlite3] extension itself,
 75547  //
 75548  //   * If SQLITE_TCLMD5 or SQLITE_TEST is defined, the Md5 commands, and
 75549  //
 75550  //   * If SQLITE_TEST is set, the various test interfaces used by the Tcl
 75551  //     test suite.
 75552  func sqlite3TestInit(tls *libc.TLS, interp uintptr) uintptr { /* test_tclsh.c:58:12: */
 75553  	bp := tls.Alloc(80)
 75554  	defer tls.Free(80)
 75555  
 75556  	// var cmdInfo Tcl_CmdInfo at bp+16, 64
 75557  
 75558  	/* Since the primary use case for this binary is testing of SQLite,
 75559  	 ** be sure to generate core files if we crash */
 75560  	{
 75561  		// var x rlimit at bp, 16
 75562  
 75563  		libc.Xgetrlimit(tls, RLIMIT_CORE, bp /* &x */)
 75564  		(*rlimit)(unsafe.Pointer(bp /* &x */)).Frlim_cur = (*rlimit)(unsafe.Pointer(bp /* &x */)).Frlim_max
 75565  		libc.Xsetrlimit(tls, RLIMIT_CORE, bp /* &x */)
 75566  
 75567  	}
 75568  
 75569  	if tcl.XTcl_GetCommandInfo(tls, interp, ts+14728 /* "sqlite3" */, bp+16 /* &cmdInfo */) == 0 {
 75570  		Sqlite3_Init(tls, interp)
 75571  	}
 75572  	Md5_Init(tls, interp)
 75573  	Sqliteconfig_Init(tls, interp)
 75574  	Sqlitetest1_Init(tls, interp)
 75575  	Sqlitetest2_Init(tls, interp)
 75576  	Sqlitetest3_Init(tls, interp)
 75577  	Sqlitetest4_Init(tls, interp)
 75578  	Sqlitetest5_Init(tls, interp)
 75579  	Sqlitetest6_Init(tls, interp)
 75580  	Sqlitetest7_Init(tls, interp)
 75581  	Sqlitetest8_Init(tls, interp)
 75582  	Sqlitetest9_Init(tls, interp)
 75583  	Sqlitetestasync_Init(tls, interp)
 75584  	Sqlitetest_autoext_Init(tls, interp)
 75585  	Sqlitetest_blob_Init(tls, interp)
 75586  	Sqlitetest_demovfs_Init(tls, interp)
 75587  	Sqlitetest_func_Init(tls, interp)
 75588  	Sqlitetest_hexio_Init(tls, interp)
 75589  	Sqlitetest_init_Init(tls, interp)
 75590  	Sqlitetest_malloc_Init(tls, interp)
 75591  	Sqlitetest_mutex_Init(tls, interp)
 75592  	Sqlitetestschema_Init(tls, interp)
 75593  	Sqlitetesttclvar_Init(tls, interp)
 75594  	Sqlitetestfs_Init(tls, interp)
 75595  	SqlitetestThread_Init(tls, interp)
 75596  	SqlitetestOnefile_Init(tls)
 75597  	SqlitetestOsinst_Init(tls, interp)
 75598  	Sqlitetestbackup_Init(tls, interp)
 75599  	Sqlitetestintarray_Init(tls, interp)
 75600  	Sqlitetestvfs_Init(tls, interp)
 75601  	Sqlitetestrtree_Init(tls, interp)
 75602  	Sqlitequota_Init(tls, interp)
 75603  	Sqlitemultiplex_Init(tls, interp)
 75604  	SqliteSuperlock_Init(tls, interp)
 75605  	SqlitetestSyscall_Init(tls, interp)
 75606  	TestSession_Init(tls, interp)
 75607  	Fts5tcl_Init(tls, interp)
 75608  	SqliteRbu_Init(tls, interp)
 75609  	Sqlitetesttcl_Init(tls, interp)
 75610  
 75611  	TestExpert_Init(tls, interp)
 75612  	Sqlitetest_window_Init(tls, interp)
 75613  	Sqlitetestvdbecov_Init(tls, interp)
 75614  
 75615  	tcl.XTcl_CreateObjCommand(tls,
 75616  		interp, ts+37534 /* "load_testfixture..." */, *(*uintptr)(unsafe.Pointer(&struct {
 75617  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 75618  		}{load_testfixture_extensions})), uintptr(0), uintptr(0))
 75619  	return uintptr(0)
 75620  }
 75621  
 75622  // tclcmd:   load_testfixture_extensions
 75623  func load_testfixture_extensions(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_tclsh.c:185:26: */
 75624  	var slave uintptr
 75625  	if objc != 2 {
 75626  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+37562 /* "SLAVE" */)
 75627  		return TCL_ERROR
 75628  	}
 75629  
 75630  	slave = tcl.XTcl_GetSlave(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 75631  	if !(slave != 0) {
 75632  		return TCL_ERROR
 75633  	}
 75634  
 75635  	sqlite3TestInit(tls, slave)
 75636  	return TCL_OK
 75637  }
 75638  
 75639  // end block for C++
 75640  
 75641  // Local Variables:
 75642  // mode: c
 75643  // c-basic-offset: 4
 75644  // fill-column: 78
 75645  // End:
 75646  // -
 75647  // SPDX-License-Identifier: BSD-3-Clause
 75648  //
 75649  // Copyright (c) 1990, 1993
 75650  //	The Regents of the University of California.  All rights reserved.
 75651  //
 75652  // Redistribution and use in source and binary forms, with or without
 75653  // modification, are permitted provided that the following conditions
 75654  // are met:
 75655  // 1. Redistributions of source code must retain the above copyright
 75656  //    notice, this list of conditions and the following disclaimer.
 75657  // 2. Redistributions in binary form must reproduce the above copyright
 75658  //    notice, this list of conditions and the following disclaimer in the
 75659  //    documentation and/or other materials provided with the distribution.
 75660  // 3. Neither the name of the University nor the names of its contributors
 75661  //    may be used to endorse or promote products derived from this software
 75662  //    without specific prior written permission.
 75663  //
 75664  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 75665  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 75666  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 75667  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 75668  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 75669  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 75670  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 75671  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 75672  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 75673  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 75674  // SUCH DAMAGE.
 75675  //
 75676  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 75677  // $FreeBSD$
 75678  
 75679  // -
 75680  // SPDX-License-Identifier: BSD-3-Clause
 75681  //
 75682  // Copyright (c) 1990, 1993
 75683  //	The Regents of the University of California.  All rights reserved.
 75684  //
 75685  // Redistribution and use in source and binary forms, with or without
 75686  // modification, are permitted provided that the following conditions
 75687  // are met:
 75688  // 1. Redistributions of source code must retain the above copyright
 75689  //    notice, this list of conditions and the following disclaimer.
 75690  // 2. Redistributions in binary form must reproduce the above copyright
 75691  //    notice, this list of conditions and the following disclaimer in the
 75692  //    documentation and/or other materials provided with the distribution.
 75693  // 3. Neither the name of the University nor the names of its contributors
 75694  //    may be used to endorse or promote products derived from this software
 75695  //    without specific prior written permission.
 75696  //
 75697  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 75698  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 75699  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 75700  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 75701  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 75702  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 75703  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 75704  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 75705  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 75706  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 75707  // SUCH DAMAGE.
 75708  //
 75709  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 75710  // $FreeBSD$
 75711  
 75712  // Characters that make up the idxStr created by xBestIndex for xFilter.
 75713  
 75714  type tclvar_vtab1 = struct {
 75715  	Fbase   sqlite3_vtab
 75716  	Finterp uintptr
 75717  } /* test_tclvar.c:58:9 */
 75718  
 75719  // end block for C++
 75720  
 75721  // Local Variables:
 75722  // mode: c
 75723  // c-basic-offset: 4
 75724  // fill-column: 78
 75725  // End:
 75726  // -
 75727  // SPDX-License-Identifier: BSD-3-Clause
 75728  //
 75729  // Copyright (c) 1990, 1993
 75730  //	The Regents of the University of California.  All rights reserved.
 75731  //
 75732  // Redistribution and use in source and binary forms, with or without
 75733  // modification, are permitted provided that the following conditions
 75734  // are met:
 75735  // 1. Redistributions of source code must retain the above copyright
 75736  //    notice, this list of conditions and the following disclaimer.
 75737  // 2. Redistributions in binary form must reproduce the above copyright
 75738  //    notice, this list of conditions and the following disclaimer in the
 75739  //    documentation and/or other materials provided with the distribution.
 75740  // 3. Neither the name of the University nor the names of its contributors
 75741  //    may be used to endorse or promote products derived from this software
 75742  //    without specific prior written permission.
 75743  //
 75744  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 75745  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 75746  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 75747  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 75748  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 75749  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 75750  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 75751  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 75752  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 75753  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 75754  // SUCH DAMAGE.
 75755  //
 75756  //	@(#)stdlib.h	8.5 (Berkeley) 5/19/95
 75757  // $FreeBSD$
 75758  
 75759  // -
 75760  // SPDX-License-Identifier: BSD-3-Clause
 75761  //
 75762  // Copyright (c) 1990, 1993
 75763  //	The Regents of the University of California.  All rights reserved.
 75764  //
 75765  // Redistribution and use in source and binary forms, with or without
 75766  // modification, are permitted provided that the following conditions
 75767  // are met:
 75768  // 1. Redistributions of source code must retain the above copyright
 75769  //    notice, this list of conditions and the following disclaimer.
 75770  // 2. Redistributions in binary form must reproduce the above copyright
 75771  //    notice, this list of conditions and the following disclaimer in the
 75772  //    documentation and/or other materials provided with the distribution.
 75773  // 3. Neither the name of the University nor the names of its contributors
 75774  //    may be used to endorse or promote products derived from this software
 75775  //    without specific prior written permission.
 75776  //
 75777  // THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 75778  // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 75779  // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 75780  // ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 75781  // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 75782  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 75783  // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 75784  // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 75785  // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 75786  // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 75787  // SUCH DAMAGE.
 75788  //
 75789  //	@(#)string.h	8.1 (Berkeley) 6/2/93
 75790  // $FreeBSD$
 75791  
 75792  // Characters that make up the idxStr created by xBestIndex for xFilter.
 75793  
 75794  type tclvar_vtab = tclvar_vtab1 /* test_tclvar.c:58:28 */
 75795  type tclvar_cursor1 = struct {
 75796  	Fbase   sqlite3_vtab_cursor
 75797  	FpList1 uintptr
 75798  	FpList2 uintptr
 75799  	Fi1     int32
 75800  	Fi2     int32
 75801  } /* test_tclvar.c:59:9 */
 75802  
 75803  type tclvar_cursor = tclvar_cursor1 /* test_tclvar.c:59:30 */
 75804  
 75805  // Methods for the tclvar module
 75806  func tclvarConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_tclvar.c:80:12: */
 75807  	var pVtab uintptr
 75808  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(tclvar_vtab{})))
 75809  	if pVtab == uintptr(0) {
 75810  		return SQLITE_NOMEM
 75811  	}
 75812  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 75813  	(*tclvar_vtab)(unsafe.Pointer(pVtab)).Finterp = pAux
 75814  	sqlite3.Xsqlite3_declare_vtab(tls, db, uintptr(unsafe.Pointer(&zSchema)))
 75815  	return SQLITE_OK
 75816  }
 75817  
 75818  var zSchema =
 75819  
 75820  // Base name
 75821  // Array index
 75822  // Value
 75823  // base(index) name
 75824  *(*[100]int8)(unsafe.Pointer(ts + 37568 /* "CREATE TABLE x( ..." */)) /* test_tclvar.c:88:21 */
 75825  
 75826  // Note that for this virtual table, the xCreate and xConnect
 75827  // methods are identical.
 75828  
 75829  func tclvarDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_tclvar.c:105:12: */
 75830  	sqlite3.Xsqlite3_free(tls, pVtab)
 75831  	return SQLITE_OK
 75832  }
 75833  
 75834  // The xDisconnect and xDestroy methods are also the same
 75835  
 75836  // Open a new tclvar cursor.
 75837  func tclvarOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_tclvar.c:114:12: */
 75838  	var pCur uintptr
 75839  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(tclvar_cursor{})))
 75840  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 75841  	return SQLITE_OK
 75842  }
 75843  
 75844  // Close a tclvar cursor.
 75845  func tclvarClose(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:124:12: */
 75846  	var pCur uintptr = cur
 75847  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 != 0 {
 75848  		for ok := true; ok; ok = 0 != 0 {
 75849  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1
 75850  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75851  				tcl.XTclFreeObj(tls, _objPtr)
 75852  			}
 75853  		}
 75854  	}
 75855  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 75856  		for ok1 := true; ok1; ok1 = 0 != 0 {
 75857  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 75858  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75859  				tcl.XTclFreeObj(tls, _objPtr)
 75860  			}
 75861  		}
 75862  	}
 75863  	sqlite3.Xsqlite3_free(tls, pCur)
 75864  	return SQLITE_OK
 75865  }
 75866  
 75867  // Returns 1 if data is ready, or 0 if not.
 75868  func next2(tls *libc.TLS, interp uintptr, pCur uintptr, pObj uintptr) int32 { /* test_tclvar.c:139:12: */
 75869  	bp := tls.Alloc(4)
 75870  	defer tls.Free(4)
 75871  
 75872  	var p uintptr
 75873  
 75874  	if pObj != 0 {
 75875  		if !(int32((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2) != 0) {
 75876  			p = tcl.XTcl_NewStringObj(tls, ts+37668 /* "array names" */, -1)
 75877  			(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 75878  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, pObj)
 75879  			tcl.XTcl_EvalObjEx(tls, interp, p, TCL_EVAL_GLOBAL)
 75880  			for ok := true; ok; ok = 0 != 0 {
 75881  				var _objPtr uintptr = p
 75882  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75883  					tcl.XTclFreeObj(tls, _objPtr)
 75884  				}
 75885  			}
 75886  			(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = tcl.XTcl_GetObjResult(tls, interp)
 75887  			(*Tcl_Obj)(unsafe.Pointer((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2)).FrefCount++
 75888  
 75889  		} else {
 75890  			*(*int32)(unsafe.Pointer(bp /* n */)) = 0
 75891  			(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2++
 75892  			tcl.XTcl_ListObjLength(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2, bp /* &n */)
 75893  			if (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 >= *(*int32)(unsafe.Pointer(bp /* n */)) {
 75894  				for ok1 := true; ok1; ok1 = 0 != 0 {
 75895  					var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 75896  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75897  						tcl.XTclFreeObj(tls, _objPtr)
 75898  					}
 75899  				}
 75900  				(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = uintptr(0)
 75901  				(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 = 0
 75902  				return 0
 75903  			}
 75904  		}
 75905  	}
 75906  
 75907  	return 1
 75908  }
 75909  
 75910  func tclvarNext(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:168:12: */
 75911  	bp := tls.Alloc(16)
 75912  	defer tls.Free(16)
 75913  
 75914  	// var pObj uintptr at bp+8, 8
 75915  
 75916  	*(*int32)(unsafe.Pointer(bp /* n */)) = 0
 75917  	var ok int32 = 0
 75918  
 75919  	var pCur uintptr = cur
 75920  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).Finterp
 75921  
 75922  	tcl.XTcl_ListObjLength(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, bp /* &n */)
 75923  	for !(ok != 0) && ((*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1 < *(*int32)(unsafe.Pointer(bp /* n */))) {
 75924  		tcl.XTcl_ListObjIndex(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1, bp+8 /* &pObj */)
 75925  		ok = next2(tls, interp, pCur, *(*uintptr)(unsafe.Pointer(bp + 8 /* pObj */)))
 75926  		if !(ok != 0) {
 75927  			(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1++
 75928  		}
 75929  	}
 75930  
 75931  	return 0
 75932  }
 75933  
 75934  func tclvarFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_tclvar.c:188:12: */
 75935  	var pCur uintptr = pVtabCursor
 75936  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab)).Finterp
 75937  	var p uintptr = tcl.XTcl_NewStringObj(tls, ts+37680 /* "tclvar_filter_cm..." */, -1)
 75938  
 75939  	var zEq uintptr = ts + 489     /* "" */
 75940  	var zMatch uintptr = ts + 489  /* "" */
 75941  	var zGlob uintptr = ts + 489   /* "" */
 75942  	var zRegexp uintptr = ts + 489 /* "" */
 75943  	var zLike uintptr = ts + 489   /* "" */
 75944  	var i int32
 75945  
 75946  	for i = 0; *(*int8)(unsafe.Pointer(idxStr + uintptr(i))) != 0; i++ {
 75947  		switch int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(i)))) {
 75948  		case 'e':
 75949  			zEq = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 75950  			break
 75951  		case 'm':
 75952  			zMatch = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 75953  			break
 75954  		case 'g':
 75955  			zGlob = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 75956  			break
 75957  		case 'r':
 75958  			zRegexp = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 75959  			break
 75960  		case 'l':
 75961  			zLike = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*8)))
 75962  			break
 75963  		default:
 75964  
 75965  		}
 75966  	}
 75967  
 75968  	(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 75969  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zEq, -1))
 75970  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zMatch, -1))
 75971  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zGlob, -1))
 75972  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zRegexp, -1))
 75973  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zLike, -1))
 75974  
 75975  	tcl.XTcl_EvalObjEx(tls, interp, p, TCL_EVAL_GLOBAL)
 75976  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 != 0 {
 75977  		for ok := true; ok; ok = 0 != 0 {
 75978  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1
 75979  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75980  				tcl.XTclFreeObj(tls, _objPtr)
 75981  			}
 75982  		}
 75983  	}
 75984  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 75985  		for ok1 := true; ok1; ok1 = 0 != 0 {
 75986  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 75987  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 75988  				tcl.XTclFreeObj(tls, _objPtr)
 75989  			}
 75990  		}
 75991  		(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = uintptr(0)
 75992  	}
 75993  	(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1 = 0
 75994  	(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 = 0
 75995  	(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 = tcl.XTcl_GetObjResult(tls, interp)
 75996  	(*Tcl_Obj)(unsafe.Pointer((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1)).FrefCount++
 75997  
 75998  	for ok2 := true; ok2; ok2 = 0 != 0 {
 75999  		var _objPtr uintptr = p
 76000  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 76001  			tcl.XTclFreeObj(tls, _objPtr)
 76002  		}
 76003  	}
 76004  	return tclvarNext(tls, pVtabCursor)
 76005  }
 76006  
 76007  func tclvarColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_tclvar.c:250:12: */
 76008  	bp := tls.Alloc(32)
 76009  	defer tls.Free(32)
 76010  
 76011  	// var p1 uintptr at bp+16, 8
 76012  
 76013  	// var p2 uintptr at bp+24, 8
 76014  
 76015  	var z1 uintptr
 76016  	var z2 uintptr = ts + 489 /* "" */
 76017  	var pCur uintptr = cur
 76018  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).Finterp
 76019  
 76020  	tcl.XTcl_ListObjIndex(tls, interp, (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1, bp+16 /* &p1 */)
 76021  	tcl.XTcl_ListObjIndex(tls, interp, (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2, bp+24 /* &p2 */)
 76022  	z1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))
 76023  	if *(*uintptr)(unsafe.Pointer(bp + 24 /* p2 */)) != 0 {
 76024  		z2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* p2 */)))
 76025  	}
 76026  	switch i {
 76027  	case 0:
 76028  		{
 76029  			sqlite3.Xsqlite3_result_text(tls, ctx, z1, -1, libc.UintptrFromInt32(-1))
 76030  			break
 76031  
 76032  		}
 76033  	case 1:
 76034  		{
 76035  			sqlite3.Xsqlite3_result_text(tls, ctx, z2, -1, libc.UintptrFromInt32(-1))
 76036  			break
 76037  
 76038  		}
 76039  	case 2:
 76040  		{
 76041  			var pVal uintptr = tcl.XTcl_GetVar2Ex(tls, interp, z1, func() uintptr {
 76042  				if *(*int8)(unsafe.Pointer(z2)) != 0 {
 76043  					return z2
 76044  				}
 76045  				return uintptr(0)
 76046  			}(), TCL_GLOBAL_ONLY)
 76047  			sqlite3.Xsqlite3_result_text(tls, ctx, tcl.XTcl_GetString(tls, pVal), -1, libc.UintptrFromInt32(-1))
 76048  			break
 76049  
 76050  		}
 76051  	case 3:
 76052  		{
 76053  			var z3 uintptr
 76054  			if *(*uintptr)(unsafe.Pointer(bp + 24 /* p2 */)) != 0 {
 76055  				z3 = sqlite3.Xsqlite3_mprintf(tls, ts+37698 /* "%s(%s)" */, libc.VaList(bp, z1, z2))
 76056  				sqlite3.Xsqlite3_result_text(tls, ctx, z3, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 76057  			} else {
 76058  				sqlite3.Xsqlite3_result_text(tls, ctx, z1, -1, libc.UintptrFromInt32(-1))
 76059  			}
 76060  			break
 76061  
 76062  		}
 76063  	}
 76064  	return SQLITE_OK
 76065  }
 76066  
 76067  func tclvarRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_tclvar.c:292:12: */
 76068  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
 76069  	return SQLITE_OK
 76070  }
 76071  
 76072  func tclvarEof(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:297:12: */
 76073  	var pCur uintptr = cur
 76074  	return func() int32 {
 76075  		if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 76076  			return 0
 76077  		}
 76078  		return 1
 76079  	}()
 76080  }
 76081  
 76082  // If nul-terminated string zStr does not already contain the character
 76083  // passed as the second argument, append it and return 0. Or, if there is
 76084  // already an instance of x in zStr, do nothing return 1;
 76085  //
 76086  // There is guaranteed to be enough room in the buffer pointed to by zStr
 76087  // for the new character and nul-terminator.
 76088  func tclvarAddToIdxstr(tls *libc.TLS, zStr uintptr, x int8) int32 { /* test_tclvar.c:310:12: */
 76089  	var i int32
 76090  	for i = 0; *(*int8)(unsafe.Pointer(zStr + uintptr(i))) != 0; i++ {
 76091  		if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) == int32(x) {
 76092  			return 1
 76093  		}
 76094  	}
 76095  	*(*int8)(unsafe.Pointer(zStr + uintptr(i))) = x
 76096  	*(*int8)(unsafe.Pointer(zStr + uintptr((i + 1)))) = int8(0)
 76097  	return 0
 76098  }
 76099  
 76100  // Return true if variable $::tclvar_set_omit exists and is set to true.
 76101  // False otherwise.
 76102  func tclvarSetOmit(tls *libc.TLS, interp uintptr) int32 { /* test_tclvar.c:324:12: */
 76103  	bp := tls.Alloc(4)
 76104  	defer tls.Free(4)
 76105  
 76106  	var rc int32
 76107  	*(*int32)(unsafe.Pointer(bp /* res */)) = 0
 76108  	var pRes uintptr
 76109  	rc = tcl.XTcl_Eval(tls, interp,
 76110  		ts+37705 /* "expr {[info exis..." */)
 76111  	if rc == TCL_OK {
 76112  		pRes = tcl.XTcl_GetObjResult(tls, interp)
 76113  		rc = tcl.XTcl_GetBooleanFromObj(tls, uintptr(0), pRes, bp /* &res */)
 76114  	}
 76115  	return (libc.Bool32((rc == TCL_OK) && (*(*int32)(unsafe.Pointer(bp /* res */)) != 0)))
 76116  }
 76117  
 76118  // The xBestIndex() method. This virtual table supports the following
 76119  // operators:
 76120  //
 76121  //     name = ?                    (omit flag clear)
 76122  //     name MATCH ?                (omit flag set)
 76123  //     value GLOB ?                (omit flag set iff $::tclvar_set_omit)
 76124  //     value REGEXP ?              (omit flag set iff $::tclvar_set_omit)
 76125  //     value LIKE ?                (omit flag set iff $::tclvar_set_omit)
 76126  //
 76127  // For each constraint present, the corresponding TCLVAR_XXX character is
 76128  // appended to the idxStr value.
 76129  func tclvarBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_tclvar.c:351:12: */
 76130  	var pTab uintptr = tab
 76131  	var ii int32
 76132  	var zStr uintptr = sqlite3.Xsqlite3_malloc(tls, 32)
 76133  	var iStr int32 = 0
 76134  
 76135  	if zStr == uintptr(0) {
 76136  		return SQLITE_NOMEM
 76137  	}
 76138  	*(*int8)(unsafe.Pointer(zStr)) = int8(0)
 76139  
 76140  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 76141  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 76142  		var pUsage uintptr
 76143  
 76144  		pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 76145  		if (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0 {
 76146  			// name = ?
 76147  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 0) {
 76148  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('e')) {
 76149  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 76150  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(0)
 76151  				}
 76152  			}
 76153  
 76154  			// name MATCH ?
 76155  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 0) {
 76156  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('m')) {
 76157  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 76158  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 76159  				}
 76160  			}
 76161  
 76162  			// value GLOB ?
 76163  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_GLOB) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 76164  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('g')) {
 76165  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 76166  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 76167  				}
 76168  			}
 76169  
 76170  			// value REGEXP ?
 76171  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_REGEXP) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 76172  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('r')) {
 76173  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 76174  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 76175  				}
 76176  			}
 76177  
 76178  			// value LIKE ?
 76179  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_LIKE) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 76180  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('l')) {
 76181  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 76182  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 76183  				}
 76184  			}
 76185  		}
 76186  	}
 76187  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = zStr
 76188  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 76189  
 76190  	return SQLITE_OK
 76191  }
 76192  
 76193  // Invoked for any UPDATE, INSERT, or DELETE against a tclvar table
 76194  func tclvarUpdate(tls *libc.TLS, tab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* test_tclvar.c:416:12: */
 76195  	var pTab uintptr = tab
 76196  	if argc == 1 {
 76197  		// A DELETE operation.  The variable to be deleted is stored in argv[0]
 76198  		var zVar uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 76199  		tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zVar, uintptr(0), TCL_GLOBAL_ONLY)
 76200  		return SQLITE_OK
 76201  	}
 76202  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 76203  		// An INSERT operation
 76204  		var zValue uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)))
 76205  		var zName uintptr
 76206  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8))) != SQLITE_TEXT {
 76207  			(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+37766 /* "the 'fullname' c..." */, 0)
 76208  			return SQLITE_ERROR
 76209  		}
 76210  		zName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*8)))
 76211  		if zValue != 0 {
 76212  			tcl.XTcl_SetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zName, uintptr(0), zValue, TCL_GLOBAL_ONLY)
 76213  		} else {
 76214  			tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zName, uintptr(0), TCL_GLOBAL_ONLY)
 76215  		}
 76216  		return SQLITE_OK
 76217  	}
 76218  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_TEXT) &&
 76219  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8))) == SQLITE_TEXT) {
 76220  		// An UPDATE operation
 76221  		var zOldName uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 76222  		var zNewName uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))
 76223  		var zValue uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*8)))
 76224  
 76225  		if (libc.Xstrcmp(tls, zOldName, zNewName) != 0) || (zValue == uintptr(0)) {
 76226  			tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zOldName, uintptr(0), TCL_GLOBAL_ONLY)
 76227  		}
 76228  		if zValue != uintptr(0) {
 76229  			tcl.XTcl_SetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zNewName, uintptr(0), zValue, TCL_GLOBAL_ONLY)
 76230  		}
 76231  		return SQLITE_OK
 76232  	}
 76233  	(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+37801 /* "prohibited TCL v..." */, 0)
 76234  	return SQLITE_ERROR
 76235  }
 76236  
 76237  // A virtual table module that provides read-only access to a
 76238  // Tcl global variable namespace.
 76239  var tclvarModule = sqlite3_module{ // iVersion
 76240  	FxCreate:     0,
 76241  	FxConnect:    0,
 76242  	FxBestIndex:  0,
 76243  	FxDisconnect: 0,
 76244  	FxDestroy:    0,
 76245  	FxOpen:       0, // xOpen - open a cursor
 76246  	FxClose:      0, // xClose - close a cursor
 76247  	FxFilter:     0, // xFilter - configure scan constraints
 76248  	FxNext:       0, // xNext - advance a cursor
 76249  	FxEof:        0, // xEof - check for end of scan
 76250  	FxColumn:     0, // xColumn - read data
 76251  	FxRowid:      0, // xRowid - read data
 76252  	FxUpdate:     0, // xRename
 76253  } /* test_tclvar.c:469:23 */
 76254  
 76255  // Register the echo virtual table module.
 76256  func register_tclvar_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_tclvar.c:500:26: */
 76257  	bp := tls.Alloc(8)
 76258  	defer tls.Free(8)
 76259  
 76260  	var rc int32 = TCL_OK
 76261  	// var db uintptr at bp, 8
 76262  
 76263  	if objc != 2 {
 76264  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 76265  		return TCL_ERROR
 76266  	}
 76267  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 76268  		return TCL_ERROR
 76269  	}
 76270  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+30054 /* "tclvar" */, uintptr(unsafe.Pointer(&tclvarModule)), interp)
 76271  	rc = tcl.XTcl_Eval(tls, interp,
 76272  
 76273  		ts+37832 /* "proc like {patte..." */)
 76274  	return rc
 76275  }
 76276  
 76277  // Register commands with the TCL interpreter.
 76278  func Sqlitetesttclvar_Init(tls *libc.TLS, interp uintptr) int32 { /* test_tclvar.c:546:5: */
 76279  	var i int32
 76280  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd13)) / uint64(unsafe.Sizeof(struct {
 76281  		FzName      uintptr
 76282  		FxProc      uintptr
 76283  		FclientData uintptr
 76284  	}{}))); i++ {
 76285  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd13[i].FzName,
 76286  			aObjCmd13[i].FxProc, aObjCmd13[i].FclientData, uintptr(0))
 76287  	}
 76288  	return TCL_OK
 76289  }
 76290  
 76291  var aObjCmd13 = [1]struct {
 76292  	FzName      uintptr
 76293  	FxProc      uintptr
 76294  	FclientData uintptr
 76295  }{
 76296  	{FzName: ts + 38368 /* "register_tclvar_..." */, FxProc: 0},
 76297  } /* test_tclvar.c:552:5 */
 76298  // getopt(3) external variable
 76299  
 76300  // One of these is allocated for each thread created by [sqlthread spawn].
 76301  type SqlThread1 = struct {
 76302  	Fparent   Tcl_ThreadId
 76303  	Finterp   uintptr
 76304  	FzScript  uintptr
 76305  	FzVarname uintptr
 76306  } /* test_thread.c:36:9 */
 76307  
 76308  // getopt(3) external variable
 76309  
 76310  // One of these is allocated for each thread created by [sqlthread spawn].
 76311  type SqlThread = SqlThread1 /* test_thread.c:36:26 */
 76312  
 76313  // A custom Tcl_Event type used by this module. When the event is
 76314  // handled, script zScript is evaluated in interpreter interp. If
 76315  // the evaluation throws an exception (returns TCL_ERROR), then the
 76316  // error is handled by Tcl_BackgroundError(). If no error occurs,
 76317  // the result is simply discarded.
 76318  type EvalEvent1 = struct {
 76319  	Fbase    Tcl_Event
 76320  	FzScript uintptr
 76321  	Finterp  uintptr
 76322  } /* test_thread.c:51:9 */
 76323  
 76324  // A custom Tcl_Event type used by this module. When the event is
 76325  // handled, script zScript is evaluated in interpreter interp. If
 76326  // the evaluation throws an exception (returns TCL_ERROR), then the
 76327  // error is handled by Tcl_BackgroundError(). If no error occurs,
 76328  // the result is simply discarded.
 76329  type EvalEvent = EvalEvent1 /* test_thread.c:51:26 */
 76330  
 76331  // Handler for events of type EvalEvent.
 76332  func tclScriptEvent(tls *libc.TLS, evPtr uintptr, flags int32) int32 { /* test_thread.c:79:26: */
 76333  	var rc int32
 76334  	var p uintptr = evPtr
 76335  	rc = tcl.XTcl_Eval(tls, (*EvalEvent)(unsafe.Pointer(p)).Finterp, (*EvalEvent)(unsafe.Pointer(p)).FzScript)
 76336  	if rc != TCL_OK {
 76337  		tcl.XTcl_BackgroundError(tls, (*EvalEvent)(unsafe.Pointer(p)).Finterp)
 76338  	}
 76339  	_ = flags
 76340  	return 1
 76341  }
 76342  
 76343  // Register an EvalEvent to evaluate the script pScript in the
 76344  // parent interpreter/thread of SqlThread p.
 76345  func postToParent(tls *libc.TLS, p uintptr, pScript uintptr) { /* test_thread.c:94:13: */
 76346  	bp := tls.Alloc(4)
 76347  	defer tls.Free(4)
 76348  
 76349  	var pEvent uintptr
 76350  	var zMsg uintptr
 76351  	// var nMsg int32 at bp, 4
 76352  
 76353  	zMsg = tcl.XTcl_GetStringFromObj(tls, pScript, bp /* &nMsg */)
 76354  	pEvent = tcl.XTcl_Alloc(tls, (uint32((uint64(unsafe.Sizeof(EvalEvent{})) + uint64(*(*int32)(unsafe.Pointer(bp /* nMsg */)))) + uint64(1))))
 76355  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.FnextPtr = uintptr(0)
 76356  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.Fproc = *(*uintptr)(unsafe.Pointer(&struct {
 76357  		f func(*libc.TLS, uintptr, int32) int32
 76358  	}{tclScriptEvent}))
 76359  	(*EvalEvent)(unsafe.Pointer(pEvent)).FzScript = (pEvent + 1*32)
 76360  	libc.Xmemcpy(tls, (*EvalEvent)(unsafe.Pointer(pEvent)).FzScript, zMsg, (uint64(*(*int32)(unsafe.Pointer(bp /* nMsg */)) + 1)))
 76361  	(*EvalEvent)(unsafe.Pointer(pEvent)).Finterp = (*SqlThread)(unsafe.Pointer(p)).Finterp
 76362  
 76363  	tcl.XTcl_ThreadQueueEvent(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent, pEvent, TCL_QUEUE_TAIL)
 76364  	tcl.XTcl_ThreadAlert(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent)
 76365  }
 76366  
 76367  // The main function for threads created with [sqlthread spawn].
 76368  func tclScriptThread(tls *libc.TLS, pSqlThread ClientData) { /* test_thread.c:114:29: */
 76369  	var interp uintptr
 76370  	var pRes uintptr
 76371  	var pList uintptr
 76372  	var rc int32
 76373  	var p uintptr = pSqlThread
 76374  
 76375  	interp = tcl.XTcl_CreateInterp(tls)
 76376  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38391 /* "clock_seconds" */, *(*uintptr)(unsafe.Pointer(&struct {
 76377  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76378  	}{clock_seconds_proc})), uintptr(0), uintptr(0))
 76379  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38405 /* "sqlthread" */, *(*uintptr)(unsafe.Pointer(&struct {
 76380  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76381  	}{sqlthread_proc})), pSqlThread, uintptr(0))
 76382  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38415 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76383  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76384  	}{blocking_step_proc})), uintptr(0), uintptr(0))
 76385  	tcl.XTcl_CreateObjCommand(tls, interp,
 76386  		ts+38437 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76387  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76388  		}{blocking_prepare_v2_proc})), uintptr(1), uintptr(0))
 76389  	tcl.XTcl_CreateObjCommand(tls, interp,
 76390  		ts+38465 /* "sqlite3_nonblock..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76391  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76392  		}{blocking_prepare_v2_proc})), uintptr(0), uintptr(0))
 76393  	Sqlitetest1_Init(tls, interp)
 76394  	Sqlitetest_mutex_Init(tls, interp)
 76395  	Sqlite3_Init(tls, interp)
 76396  
 76397  	rc = tcl.XTcl_Eval(tls, interp, (*SqlThread)(unsafe.Pointer(p)).FzScript)
 76398  	pRes = tcl.XTcl_GetObjResult(tls, interp)
 76399  	pList = tcl.XTcl_NewObj(tls)
 76400  	(*Tcl_Obj)(unsafe.Pointer(pList)).FrefCount++
 76401  	(*Tcl_Obj)(unsafe.Pointer(pRes)).FrefCount++
 76402  
 76403  	if rc != TCL_OK {
 76404  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, ts+10309 /* "error" */, -1))
 76405  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, pRes)
 76406  		postToParent(tls, p, pList)
 76407  		for ok := true; ok; ok = 0 != 0 {
 76408  			var _objPtr uintptr = pList
 76409  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 76410  				tcl.XTclFreeObj(tls, _objPtr)
 76411  			}
 76412  		}
 76413  		pList = tcl.XTcl_NewObj(tls)
 76414  	}
 76415  
 76416  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, ts+38496 /* "set" */, -1))
 76417  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, (*SqlThread)(unsafe.Pointer(p)).FzVarname, -1))
 76418  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, pRes)
 76419  	postToParent(tls, p, pList)
 76420  
 76421  	tcl.XTcl_Free(tls, p)
 76422  	for ok1 := true; ok1; ok1 = 0 != 0 {
 76423  		var _objPtr uintptr = pList
 76424  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 76425  			tcl.XTclFreeObj(tls, _objPtr)
 76426  		}
 76427  	}
 76428  	for ok2 := true; ok2; ok2 = 0 != 0 {
 76429  		var _objPtr uintptr = pRes
 76430  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 76431  			tcl.XTclFreeObj(tls, _objPtr)
 76432  		}
 76433  	}
 76434  	tcl.XTcl_DeleteInterp(tls, interp)
 76435  	for tcl.XTcl_DoOneEvent(tls, ((libc.CplInt32((int32(1) << 1)))|(int32(1)<<1))) != 0 {
 76436  	}
 76437  	tcl.XTcl_ExitThread(tls, 0)
 76438  
 76439  }
 76440  
 76441  // sqlthread spawn VARNAME SCRIPT
 76442  //
 76443  //     Spawn a new thread with its own Tcl interpreter and run the
 76444  //     specified SCRIPT(s) in it. The thread terminates after running
 76445  //     the script. The result of the script is stored in the variable
 76446  //     VARNAME.
 76447  //
 76448  //     The caller can wait for the script to terminate using [vwait VARNAME].
 76449  func sqlthread_spawn(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:174:26: */
 76450  	bp := tls.Alloc(32)
 76451  	defer tls.Free(32)
 76452  
 76453  	// var x Tcl_ThreadId at bp+24, 8
 76454  
 76455  	var pNew uintptr
 76456  	var rc int32
 76457  	// var nVarname int32 at bp+16, 4
 76458  
 76459  	var zVarname uintptr
 76460  	// var nScript int32 at bp+20, 4
 76461  
 76462  	var zScript uintptr
 76463  
 76464  	// Parameters for thread creation
 76465  	var nStack int32 = 0
 76466  	var flags int32 = 0000
 76467  
 76468  	_ = clientData
 76469  	_ = objc
 76470  
 76471  	zVarname = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+16 /* &nVarname */)
 76472  	zScript = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+20 /* &nScript */)
 76473  
 76474  	pNew = tcl.XTcl_Alloc(tls, (uint32(((uint64(unsafe.Sizeof(SqlThread{})) + uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)))) + uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nScript */)))) + uint64(2))))
 76475  	(*SqlThread)(unsafe.Pointer(pNew)).FzVarname = (pNew + 1*32)
 76476  	(*SqlThread)(unsafe.Pointer(pNew)).FzScript = ((*SqlThread)(unsafe.Pointer(pNew)).FzVarname + uintptr((*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)) + 1)))
 76477  	libc.Xmemcpy(tls, (*SqlThread)(unsafe.Pointer(pNew)).FzVarname, zVarname, (uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)) + 1)))
 76478  	libc.Xmemcpy(tls, (*SqlThread)(unsafe.Pointer(pNew)).FzScript, zScript, (uint64(*(*int32)(unsafe.Pointer(bp + 20 /* nScript */)) + 1)))
 76479  	(*SqlThread)(unsafe.Pointer(pNew)).Fparent = tcl.XTcl_GetCurrentThread(tls)
 76480  	(*SqlThread)(unsafe.Pointer(pNew)).Finterp = interp
 76481  
 76482  	rc = tcl.XTcl_CreateThread(tls, bp+24 /* &x */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{tclScriptThread})), pNew, nStack, flags)
 76483  	if rc != TCL_OK {
 76484  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38500 /* "Error in Tcl_Cre..." */, 0))
 76485  		tcl.XTcl_Free(tls, pNew)
 76486  		return TCL_ERROR
 76487  	}
 76488  
 76489  	return TCL_OK
 76490  }
 76491  
 76492  // sqlthread parent SCRIPT
 76493  //
 76494  //     This can be called by spawned threads only. It sends the specified
 76495  //     script back to the parent thread for execution. The result of
 76496  //     evaluating the SCRIPT is returned. The parent thread must enter
 76497  //     the event loop for this to work - otherwise the caller will
 76498  //     block indefinitely.
 76499  //
 76500  //     NOTE: At the moment, this doesn't work. FIXME.
 76501  func sqlthread_parent(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:227:26: */
 76502  	bp := tls.Alloc(20)
 76503  	defer tls.Free(20)
 76504  
 76505  	var pEvent uintptr
 76506  	var zMsg uintptr
 76507  	// var nMsg int32 at bp+16, 4
 76508  
 76509  	var p uintptr = clientData
 76510  
 76511  	_ = objc
 76512  
 76513  	if p == uintptr(0) {
 76514  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38528 /* "no parent thread" */, 0))
 76515  		return TCL_ERROR
 76516  	}
 76517  
 76518  	zMsg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+16 /* &nMsg */)
 76519  	pEvent = tcl.XTcl_Alloc(tls, (uint32((uint64(unsafe.Sizeof(EvalEvent{})) + uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nMsg */)))) + uint64(1))))
 76520  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.FnextPtr = uintptr(0)
 76521  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.Fproc = *(*uintptr)(unsafe.Pointer(&struct {
 76522  		f func(*libc.TLS, uintptr, int32) int32
 76523  	}{tclScriptEvent}))
 76524  	(*EvalEvent)(unsafe.Pointer(pEvent)).FzScript = (pEvent + 1*32)
 76525  	libc.Xmemcpy(tls, (*EvalEvent)(unsafe.Pointer(pEvent)).FzScript, zMsg, (uint64(*(*int32)(unsafe.Pointer(bp + 16 /* nMsg */)) + 1)))
 76526  	(*EvalEvent)(unsafe.Pointer(pEvent)).Finterp = (*SqlThread)(unsafe.Pointer(p)).Finterp
 76527  	tcl.XTcl_ThreadQueueEvent(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent, pEvent, TCL_QUEUE_TAIL)
 76528  	tcl.XTcl_ThreadAlert(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent)
 76529  
 76530  	return TCL_OK
 76531  }
 76532  
 76533  func xBusy(tls *libc.TLS, pArg uintptr, nBusy int32) int32 { /* test_thread.c:259:12: */
 76534  	_ = pArg
 76535  	_ = nBusy
 76536  	sqlite3.Xsqlite3_sleep(tls, 50)
 76537  	return 1 // Try again...
 76538  }
 76539  
 76540  // sqlthread open
 76541  //
 76542  //     Open a database handle and return the string representation of
 76543  //     the pointer value.
 76544  func sqlthread_open(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:272:26: */
 76545  	bp := tls.Alloc(124)
 76546  	defer tls.Free(124)
 76547  
 76548  	var zFilename uintptr
 76549  	// var db uintptr at bp+16, 8
 76550  
 76551  	// var zBuf [100]int8 at bp+24, 100
 76552  
 76553  	_ = clientData
 76554  	_ = objc
 76555  
 76556  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 76557  	sqlite3.Xsqlite3_open(tls, zFilename, bp+16 /* &db */)
 76558  	Md5_Register(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), uintptr(0), uintptr(0))
 76559  	sqlite3.Xsqlite3_busy_handler(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 76560  		f func(*libc.TLS, uintptr, int32) int32
 76561  	}{xBusy})), uintptr(0))
 76562  
 76563  	if sqlite3TestMakePointerStr(tls, interp, bp+24 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))) != 0 {
 76564  		return TCL_ERROR
 76565  	}
 76566  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+24 /* &zBuf[0] */, 0))
 76567  
 76568  	return TCL_OK
 76569  }
 76570  
 76571  // sqlthread open
 76572  //
 76573  //     Return the current thread-id (Tcl_GetCurrentThread()) cast to
 76574  //     an integer.
 76575  func sqlthread_id(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:306:26: */
 76576  	var id Tcl_ThreadId = tcl.XTcl_GetCurrentThread(tls)
 76577  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(id)))
 76578  	_ = clientData
 76579  	_ = objc
 76580  	_ = objv
 76581  	return TCL_OK
 76582  }
 76583  
 76584  // Dispatch routine for the sub-commands of [sqlthread].
 76585  func sqlthread_proc(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:324:26: */
 76586  	bp := tls.Alloc(164)
 76587  	defer tls.Free(164)
 76588  
 76589  	*(*[5]struct {
 76590  		FzName  uintptr
 76591  		FxProc  uintptr
 76592  		FnArg   int32
 76593  		_       [4]byte
 76594  		FzUsage uintptr
 76595  	})(unsafe.Pointer(bp /* aSub */)) = [5]struct {
 76596  		FzName  uintptr
 76597  		FxProc  uintptr
 76598  		FnArg   int32
 76599  		_       [4]byte
 76600  		FzUsage uintptr
 76601  	}{
 76602  		{FzName: ts + 38545 /* "parent" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 76603  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76604  		}{sqlthread_parent})), FnArg: 1, FzUsage: ts + 10650 /* "SCRIPT" */},
 76605  		{FzName: ts + 38552 /* "spawn" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 76606  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76607  		}{sqlthread_spawn})), FnArg: 2, FzUsage: ts + 38558 /* "VARNAME SCRIPT" */},
 76608  		{FzName: ts + 37162 /* "open" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 76609  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76610  		}{sqlthread_open})), FnArg: 1, FzUsage: ts + 38573 /* "DBNAME" */},
 76611  		{FzName: ts + 38580 /* "id" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 76612  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76613  		}{sqlthread_id})), FzUsage: ts + 489 /* "" */},
 76614  		{},
 76615  	}
 76616  	var pSub uintptr
 76617  	var rc int32
 76618  	// var iIndex int32 at bp+160, 4
 76619  
 76620  	if objc < 2 {
 76621  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2384 /* "SUB-COMMAND" */)
 76622  		return TCL_ERROR
 76623  	}
 76624  
 76625  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 76626  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp /* &aSub[0] */, int32(unsafe.Sizeof(struct {
 76627  			FzName  uintptr
 76628  			FxProc  uintptr
 76629  			FnArg   int32
 76630  			_       [4]byte
 76631  			FzUsage uintptr
 76632  		}{})), ts+1875 /* "sub-command" */, 0, bp+160 /* &iIndex */)
 76633  	if rc != TCL_OK {
 76634  		return rc
 76635  	}
 76636  	pSub = (bp /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 160 /* iIndex */)))*32)
 76637  
 76638  	if objc < ((*struct {
 76639  		FzName  uintptr
 76640  		FxProc  uintptr
 76641  		FnArg   int32
 76642  		_       [4]byte
 76643  		FzUsage uintptr
 76644  	})(unsafe.Pointer(pSub)).FnArg + 2) {
 76645  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*struct {
 76646  			FzName  uintptr
 76647  			FxProc  uintptr
 76648  			FnArg   int32
 76649  			_       [4]byte
 76650  			FzUsage uintptr
 76651  		})(unsafe.Pointer(pSub)).FzUsage)
 76652  		return TCL_ERROR
 76653  	}
 76654  
 76655  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSub + 8 /* &.xProc */))))(tls, clientData, interp, objc, objv)
 76656  }
 76657  
 76658  /*
 76659  ** The [clock_seconds] command. This is more or less the same as the
 76660  ** regular tcl [clock seconds], except that it is available in testfixture
 76661  ** when linked against both Tcl 8.4 and 8.5. Because [clock seconds] is
 76662  ** implemented as a script in Tcl 8.5, it is not usually available to
 76663  ** testfixture.
 76664   */
 76665  func clock_seconds_proc(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:372:26: */
 76666  	bp := tls.Alloc(16)
 76667  	defer tls.Free(16)
 76668  
 76669  	// var now Tcl_Time at bp, 16
 76670  
 76671  	tcl.XTcl_GetTime(tls, bp /* &now */)
 76672  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32((*Tcl_Time)(unsafe.Pointer(bp /* &now */)).Fsec)))
 76673  	_ = clientData
 76674  	_ = objc
 76675  	_ = objv
 76676  	return TCL_OK
 76677  }
 76678  
 76679  // A pointer to an instance of this structure is passed as the user-context
 76680  // pointer when registering for an unlock-notify callback.
 76681  type UnlockNotification1 = struct {
 76682  	Ffired int32
 76683  	_      [4]byte
 76684  	Fcond  pthread_cond_t
 76685  	Fmutex pthread_mutex_t
 76686  } /* test_thread.c:410:9 */
 76687  
 76688  // A pointer to an instance of this structure is passed as the user-context
 76689  // pointer when registering for an unlock-notify callback.
 76690  type UnlockNotification = UnlockNotification1 /* test_thread.c:410:35 */
 76691  
 76692  // This function is an unlock-notify callback registered with SQLite.
 76693  func unlock_notify_cb(tls *libc.TLS, apArg uintptr, nArg int32) { /* test_thread.c:420:13: */
 76694  	var i int32
 76695  	for i = 0; i < nArg; i++ {
 76696  		var p uintptr = *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*8))
 76697  		libc2.Xpthread_mutex_lock(tls, (p + 16 /* &.mutex */))
 76698  		(*UnlockNotification)(unsafe.Pointer(p)).Ffired = 1
 76699  		libc2.Xpthread_cond_signal(tls, (p + 8 /* &.cond */))
 76700  		libc2.Xpthread_mutex_unlock(tls, (p + 16 /* &.mutex */))
 76701  	}
 76702  }
 76703  
 76704  // This function assumes that an SQLite API call (either sqlite3_prepare_v2()
 76705  // or sqlite3_step()) has just returned SQLITE_LOCKED. The argument is the
 76706  // associated database connection.
 76707  //
 76708  // This function calls sqlite3_unlock_notify() to register for an
 76709  // unlock-notify callback, then blocks until that callback is delivered
 76710  // and returns SQLITE_OK. The caller should then retry the failed operation.
 76711  //
 76712  // Or, if sqlite3_unlock_notify() indicates that to block would deadlock
 76713  // the system, then this function returns SQLITE_LOCKED immediately. In
 76714  // this case the caller should not retry the operation and should roll
 76715  // back the current transaction (if any).
 76716  func wait_for_unlock_notify(tls *libc.TLS, db uintptr) int32 { /* test_thread.c:445:12: */
 76717  	bp := tls.Alloc(24)
 76718  	defer tls.Free(24)
 76719  
 76720  	var rc int32
 76721  	// var un UnlockNotification at bp, 24
 76722  
 76723  	// Initialize the UnlockNotification structure.
 76724  	(*UnlockNotification)(unsafe.Pointer(bp /* &un */)).Ffired = 0
 76725  	libc2.Xpthread_mutex_init(tls, (bp /* &un */ + 16 /* &.mutex */), uintptr(0))
 76726  	libc2.Xpthread_cond_init(tls, (bp /* &un */ + 8 /* &.cond */), uintptr(0))
 76727  
 76728  	// Register for an unlock-notify callback.
 76729  	rc = sqlite3.Xsqlite3_unlock_notify(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 76730  		f func(*libc.TLS, uintptr, int32)
 76731  	}{unlock_notify_cb})), bp /* &un */)
 76732  
 76733  	// The call to sqlite3_unlock_notify() always returns either SQLITE_LOCKED
 76734  	// or SQLITE_OK.
 76735  	//
 76736  	// If SQLITE_LOCKED was returned, then the system is deadlocked. In this
 76737  	// case this function needs to return SQLITE_LOCKED to the caller so
 76738  	// that the current transaction can be rolled back. Otherwise, block
 76739  	// until the unlock-notify callback is invoked, then return SQLITE_OK.
 76740  	if rc == SQLITE_OK {
 76741  		libc2.Xpthread_mutex_lock(tls, (bp /* &un */ + 16 /* &.mutex */))
 76742  		if !((*UnlockNotification)(unsafe.Pointer(bp /* &un */)).Ffired != 0) {
 76743  			libc2.Xpthread_cond_wait(tls, (bp /* &un */ + 8 /* &.cond */), (bp /* &un */ + 16 /* &.mutex */))
 76744  		}
 76745  		libc2.Xpthread_mutex_unlock(tls, (bp /* &un */ + 16 /* &.mutex */))
 76746  	}
 76747  
 76748  	// Destroy the mutex and condition variables.
 76749  	libc2.Xpthread_cond_destroy(tls, (bp /* &un */ + 8 /* &.cond */))
 76750  	libc2.Xpthread_mutex_destroy(tls, (bp /* &un */ + 16 /* &.mutex */))
 76751  
 76752  	return rc
 76753  }
 76754  
 76755  // This function is a wrapper around the SQLite function sqlite3_step().
 76756  // It functions in the same way as step(), except that if a required
 76757  // shared-cache lock cannot be obtained, this function may block waiting for
 76758  // the lock to become available. In this scenario the normal API step()
 76759  // function always returns SQLITE_LOCKED.
 76760  //
 76761  // If this function returns SQLITE_LOCKED, the caller should rollback
 76762  // the current transaction (if any) and try again later. Otherwise, the
 76763  // system may become deadlocked.
 76764  func sqlite3_blocking_step(tls *libc.TLS, pStmt uintptr) int32 { /* test_thread.c:492:5: */
 76765  	var rc int32
 76766  	for SQLITE_LOCKED == (libc.AssignInt32(&rc, sqlite3.Xsqlite3_step(tls, pStmt))) {
 76767  		rc = wait_for_unlock_notify(tls, sqlite3.Xsqlite3_db_handle(tls, pStmt))
 76768  		if rc != SQLITE_OK {
 76769  			break
 76770  		}
 76771  		sqlite3.Xsqlite3_reset(tls, pStmt)
 76772  	}
 76773  	return rc
 76774  }
 76775  
 76776  // This function is a wrapper around the SQLite function sqlite3_prepare_v2().
 76777  // It functions in the same way as prepare_v2(), except that if a required
 76778  // shared-cache lock cannot be obtained, this function may block waiting for
 76779  // the lock to become available. In this scenario the normal API prepare_v2()
 76780  // function always returns SQLITE_LOCKED.
 76781  //
 76782  // If this function returns SQLITE_LOCKED, the caller should rollback
 76783  // the current transaction (if any) and try again later. Otherwise, the
 76784  // system may become deadlocked.
 76785  func sqlite3_blocking_prepare_v2(tls *libc.TLS, db uintptr, zSql uintptr, nSql int32, ppStmt uintptr, pz uintptr) int32 { /* test_thread.c:513:5: */
 76786  	var rc int32
 76787  	for SQLITE_LOCKED == (libc.AssignInt32(&rc, sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, pz))) {
 76788  		rc = wait_for_unlock_notify(tls, db)
 76789  		if rc != SQLITE_OK {
 76790  			break
 76791  		}
 76792  	}
 76793  	return rc
 76794  }
 76795  
 76796  // END_SQLITE_BLOCKING_STEP
 76797  
 76798  // Usage: sqlite3_blocking_step STMT
 76799  //
 76800  // Advance the statement to the next row.
 76801  func blocking_step_proc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:534:26: */
 76802  	var pStmt uintptr
 76803  	var rc int32
 76804  
 76805  	if objc != 2 {
 76806  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 76807  		return TCL_ERROR
 76808  	}
 76809  
 76810  	pStmt = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))))
 76811  	rc = sqlite3_blocking_step(tls, pStmt)
 76812  
 76813  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 76814  	return TCL_OK
 76815  }
 76816  
 76817  // Usage: sqlite3_blocking_prepare_v2 DB sql bytes ?tailvar?
 76818  // Usage: sqlite3_nonblocking_prepare_v2 DB sql bytes ?tailvar?
 76819  func blocking_prepare_v2_proc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:560:26: */
 76820  	bp := tls.Alloc(162)
 76821  	defer tls.Free(162)
 76822  
 76823  	// var db uintptr at bp+80, 8
 76824  
 76825  	var zSql uintptr
 76826  	// var bytes int32 at bp+88, 4
 76827  
 76828  	*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)) = uintptr(0)
 76829  	*(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) = uintptr(0)
 76830  	// var zBuf [50]int8 at bp+112, 50
 76831  
 76832  	var rc int32
 76833  	var isBlocking int32 = libc.BoolInt32(!(clientData == uintptr(0)))
 76834  
 76835  	if (objc != 5) && (objc != 4) {
 76836  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 76837  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 76838  		return TCL_ERROR
 76839  	}
 76840  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+80 /* &db */) != 0 {
 76841  		return TCL_ERROR
 76842  	}
 76843  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 76844  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+88 /* &bytes */) != 0 {
 76845  		return TCL_ERROR
 76846  	}
 76847  
 76848  	if isBlocking != 0 {
 76849  		rc = sqlite3_blocking_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)), bp+96 /* &pStmt */, bp+104 /* &zTail */)
 76850  	} else {
 76851  		rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)), bp+96 /* &pStmt */, bp+104 /* &zTail */)
 76852  	}
 76853  
 76854  	if (*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)) != 0) && (objc >= 5) {
 76855  		if *(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) >= 0 {
 76856  			*(*int32)(unsafe.Pointer(bp + 88 /* bytes */)) = (int32(int64(*(*int32)(unsafe.Pointer(bp + 88 /* bytes */))) - ((int64(*(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */))) - int64(zSql)) / 1)))
 76857  		}
 76858  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 104 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 88 /* bytes */))), 0)
 76859  	}
 76860  	if rc != SQLITE_OK {
 76861  
 76862  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+112 /* &zBuf[0] */, ts+38583 /* "%s " */, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc)))
 76863  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+112 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 76864  		return TCL_ERROR
 76865  	}
 76866  
 76867  	if *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) != 0 {
 76868  		if sqlite3TestMakePointerStr(tls, interp, bp+112 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) != 0 {
 76869  			return TCL_ERROR
 76870  		}
 76871  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+112 /* &zBuf[0] */, 0))
 76872  	}
 76873  	return TCL_OK
 76874  }
 76875  
 76876  //
 76877  // End of implementation of [sqlite3_blocking_step].
 76878  //
 76879  
 76880  // Register commands with the TCL interpreter.
 76881  func SqlitetestThread_Init(tls *libc.TLS, interp uintptr) int32 { /* test_thread.c:619:5: */
 76882  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38405 /* "sqlthread" */, *(*uintptr)(unsafe.Pointer(&struct {
 76883  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76884  	}{sqlthread_proc})), uintptr(0), uintptr(0))
 76885  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38391 /* "clock_seconds" */, *(*uintptr)(unsafe.Pointer(&struct {
 76886  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 76887  	}{clock_seconds_proc})), uintptr(0), uintptr(0))
 76888  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38415 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76889  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76890  	}{blocking_step_proc})), uintptr(0), uintptr(0))
 76891  	tcl.XTcl_CreateObjCommand(tls, interp,
 76892  		ts+38437 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76893  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76894  		}{blocking_prepare_v2_proc})), uintptr(1), uintptr(0))
 76895  	tcl.XTcl_CreateObjCommand(tls, interp,
 76896  		ts+38465 /* "sqlite3_nonblock..." */, *(*uintptr)(unsafe.Pointer(&struct {
 76897  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 76898  		}{blocking_prepare_v2_proc})), uintptr(0), uintptr(0))
 76899  	return TCL_OK
 76900  }
 76901  
 76902  // end block for C++
 76903  
 76904  // Local Variables:
 76905  // mode: c
 76906  // c-basic-offset: 4
 76907  // fill-column: 78
 76908  // End:
 76909  
 76910  func Sqlitetestvdbecov_Init(tls *libc.TLS, interp uintptr) int32 { /* test_vdbecov.c:113:5: */
 76911  	return TCL_OK
 76912  }
 76913  
 76914  // end block for C++
 76915  
 76916  // Local Variables:
 76917  // mode: c
 76918  // c-basic-offset: 4
 76919  // fill-column: 78
 76920  // End:
 76921  
 76922  type Testvfs1 = struct {
 76923  	FzName        uintptr
 76924  	FpParent      uintptr
 76925  	FpVfs         uintptr
 76926  	Finterp       uintptr
 76927  	FpScript      uintptr
 76928  	FpBuffer      uintptr
 76929  	FisNoshm      int32
 76930  	FisFullshm    int32
 76931  	Fmask         int32
 76932  	Fioerr_err    TestFaultInject
 76933  	Ffull_err     TestFaultInject
 76934  	Fcantopen_err TestFaultInject
 76935  	FiDevchar     int32
 76936  	FiSectorsize  int32
 76937  } /* test_vfs.c:37:9 */
 76938  
 76939  // end block for C++
 76940  
 76941  // Local Variables:
 76942  // mode: c
 76943  // c-basic-offset: 4
 76944  // fill-column: 78
 76945  // End:
 76946  
 76947  type Testvfs = Testvfs1 /* test_vfs.c:37:24 */
 76948  type TestvfsBuffer1 = struct {
 76949  	FzFile uintptr
 76950  	Fpgsz  int32
 76951  	_      [4]byte
 76952  	FaPage [1024]uintptr
 76953  	FpFile uintptr
 76954  	FpNext uintptr
 76955  } /* test_vfs.c:37:9 */
 76956  
 76957  type TestvfsBuffer = TestvfsBuffer1 /* test_vfs.c:39:30 */
 76958  type TestvfsFile1 = struct {
 76959  	Fbase sqlite3_file
 76960  	FpFd  uintptr
 76961  } /* test_vfs.c:40:9 */
 76962  
 76963  type TestvfsFile = TestvfsFile1 /* test_vfs.c:40:28 */
 76964  type TestvfsFd1 = struct {
 76965  	FpVfs       uintptr
 76966  	FzFilename  uintptr
 76967  	FpReal      uintptr
 76968  	FpShmId     uintptr
 76969  	FpShm       uintptr
 76970  	Fexcllock   u32
 76971  	Fsharedlock u32
 76972  	FpNext      uintptr
 76973  } /* test_vfs.c:37:9 */
 76974  
 76975  type TestvfsFd = TestvfsFd1 /* test_vfs.c:41:26 */
 76976  
 76977  type TestFaultInject1 = struct {
 76978  	FiCnt   int32
 76979  	FeFault int32
 76980  	FnFail  int32
 76981  } /* test_vfs.c:37:9 */
 76982  
 76983  type TestFaultInject = TestFaultInject1 /* test_vfs.c:69:32 */
 76984  
 76985  var tvfs_io_methods = sqlite3_io_methods{
 76986  	FiVersion:               3, // iVersion
 76987  	FxClose:                 0, // xClose
 76988  	FxRead:                  0, // xRead
 76989  	FxWrite:                 0, // xWrite
 76990  	FxTruncate:              0, // xTruncate
 76991  	FxSync:                  0, // xSync
 76992  	FxFileSize:              0, // xFileSize
 76993  	FxLock:                  0, // xLock
 76994  	FxUnlock:                0, // xUnlock
 76995  	FxCheckReservedLock:     0, // xCheckReservedLock
 76996  	FxFileControl:           0, // xFileControl
 76997  	FxSectorSize:            0, // xSectorSize
 76998  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 76999  	FxShmMap:                0, // xShmMap
 77000  	FxShmLock:               0, // xShmLock
 77001  	FxShmBarrier:            0, // xShmBarrier
 77002  	FxShmUnmap:              0, // xShmUnmap
 77003  	FxFetch:                 0,
 77004  	FxUnfetch:               0,
 77005  } /* test_vfs.c:204:27 */
 77006  
 77007  func tvfsResultCode(tls *libc.TLS, p uintptr, pRc uintptr) int32 { /* test_vfs.c:226:12: */
 77008  	bp := tls.Alloc(144)
 77009  	defer tls.Free(144)
 77010  
 77011  	*(*[9]errcode)(unsafe.Pointer(bp /* aCode */)) = [9]errcode{
 77012  		{FzCode: ts + 1988 /* "SQLITE_OK" */},
 77013  		{FeCode: SQLITE_ERROR, FzCode: ts + 1975 /* "SQLITE_ERROR" */},
 77014  		{FeCode: SQLITE_IOERR, FzCode: ts + 38587 /* "SQLITE_IOERR" */},
 77015  		{FeCode: SQLITE_LOCKED, FzCode: ts + 38600 /* "SQLITE_LOCKED" */},
 77016  		{FeCode: SQLITE_BUSY, FzCode: ts + 38614 /* "SQLITE_BUSY" */},
 77017  		{FeCode: SQLITE_READONLY, FzCode: ts + 38626 /* "SQLITE_READONLY" */},
 77018  		{FeCode: (SQLITE_READONLY | (int32(5) << 8)), FzCode: ts + 38642 /* "SQLITE_READONLY_..." */},
 77019  		{FeCode: SQLITE_NOTFOUND, FzCode: ts + 38667 /* "SQLITE_NOTFOUND" */},
 77020  		{FeCode: -1, FzCode: ts + 38683 /* "SQLITE_OMIT" */},
 77021  	}
 77022  	var z uintptr
 77023  	var i int32
 77024  
 77025  	z = tcl.XTcl_GetStringResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77026  	for i = 0; i < (int32(uint64(unsafe.Sizeof([9]errcode{})) / uint64(unsafe.Sizeof(errcode{})))); i++ {
 77027  		if 0 == libc.Xstrcmp(tls, z, (*errcode)(unsafe.Pointer(bp /* &aCode */ +uintptr(i)*16)).FzCode) {
 77028  			*(*int32)(unsafe.Pointer(pRc)) = (*errcode)(unsafe.Pointer(bp /* &aCode */ + uintptr(i)*16)).FeCode
 77029  			return 1
 77030  		}
 77031  	}
 77032  
 77033  	return 0
 77034  }
 77035  
 77036  type errcode = struct {
 77037  	FeCode int32
 77038  	_      [4]byte
 77039  	FzCode uintptr
 77040  } /* test_vfs.c:227:3 */
 77041  
 77042  func tvfsInjectFault(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:256:12: */
 77043  	var ret int32 = 0
 77044  	if (*TestFaultInject)(unsafe.Pointer(p)).FeFault != 0 {
 77045  		(*TestFaultInject)(unsafe.Pointer(p)).FiCnt--
 77046  		if ((*TestFaultInject)(unsafe.Pointer(p)).FiCnt == 0) || (((*TestFaultInject)(unsafe.Pointer(p)).FiCnt < 0) && ((*TestFaultInject)(unsafe.Pointer(p)).FeFault == FAULT_INJECT_PERSISTENT)) {
 77047  			ret = 1
 77048  			(*TestFaultInject)(unsafe.Pointer(p)).FnFail++
 77049  		}
 77050  	}
 77051  	return ret
 77052  }
 77053  
 77054  func tvfsInjectIoerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:269:12: */
 77055  	return tvfsInjectFault(tls, (p + 60 /* &.ioerr_err */))
 77056  }
 77057  
 77058  func tvfsInjectFullerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:273:12: */
 77059  	return tvfsInjectFault(tls, (p + 72 /* &.full_err */))
 77060  }
 77061  
 77062  func tvfsInjectCantopenerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:276:12: */
 77063  	return tvfsInjectFault(tls, (p + 84 /* &.cantopen_err */))
 77064  }
 77065  
 77066  func tvfsExecTcl(tls *libc.TLS, p uintptr, zMethod uintptr, arg1 uintptr, arg2 uintptr, arg3 uintptr, arg4 uintptr) { /* test_vfs.c:281:13: */
 77067  	var rc int32 // Return code from Tcl_EvalObj()
 77068  	var pEval uintptr
 77069  
 77070  	pEval = tcl.XTcl_DuplicateObj(tls, (*Testvfs)(unsafe.Pointer(p)).FpScript)
 77071  	(*Tcl_Obj)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpScript)).FrefCount++
 77072  	tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zMethod, -1))
 77073  	if arg1 != 0 {
 77074  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg1)
 77075  	}
 77076  	if arg2 != 0 {
 77077  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg2)
 77078  	}
 77079  	if arg3 != 0 {
 77080  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg3)
 77081  	}
 77082  	if arg4 != 0 {
 77083  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg4)
 77084  	}
 77085  
 77086  	rc = tcl.XTcl_EvalObjEx(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 77087  	if rc != TCL_OK {
 77088  		tcl.XTcl_BackgroundError(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77089  		tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77090  	}
 77091  }
 77092  
 77093  // Close an tvfs-file.
 77094  func tvfsClose(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:317:12: */
 77095  	var pTestfile uintptr = pFile
 77096  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd
 77097  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77098  
 77099  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_CLOSE_MASK) != 0) {
 77100  		tvfsExecTcl(tls, p, ts+35685, /* "xClose" */
 77101  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 77102  	}
 77103  
 77104  	if (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId != 0 {
 77105  		for ok := true; ok; ok = 0 != 0 {
 77106  			var _objPtr uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId
 77107  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77108  				tcl.XTclFreeObj(tls, _objPtr)
 77109  			}
 77110  		}
 77111  		(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = uintptr(0)
 77112  	}
 77113  	if (*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods != 0 {
 77114  		tcl.XTcl_Free(tls, (*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)
 77115  	}
 77116  	sqlite3.Xsqlite3OsClose(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 77117  	tcl.XTcl_Free(tls, pFd)
 77118  	(*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd = uintptr(0)
 77119  	return SQLITE_OK
 77120  }
 77121  
 77122  // Read data from an tvfs-file.
 77123  func tvfsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_vfs.c:344:12: */
 77124  	bp := tls.Alloc(4)
 77125  	defer tls.Free(4)
 77126  
 77127  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77128  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77129  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77130  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_READ_MASK) != 0) {
 77131  		tvfsExecTcl(tls, p, ts+35692, /* "xRead" */
 77132  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 77133  		tvfsResultCode(tls, p, bp /* &rc */)
 77134  	}
 77135  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_READ_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 77136  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 77137  	}
 77138  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 77139  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsRead(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, zBuf, iAmt, iOfst)
 77140  	}
 77141  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77142  }
 77143  
 77144  // Write data to an tvfs-file.
 77145  func tvfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_vfs.c:371:12: */
 77146  	bp := tls.Alloc(4)
 77147  	defer tls.Free(4)
 77148  
 77149  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77150  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77151  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77152  
 77153  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0) {
 77154  		tvfsExecTcl(tls, p, ts+35698, /* "xWrite" */
 77155  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 77156  			tcl.XTcl_NewWideIntObj(tls, iOfst), tcl.XTcl_NewIntObj(tls, iAmt))
 77157  		tvfsResultCode(tls, p, bp /* &rc */)
 77158  		if *(*int32)(unsafe.Pointer(bp /* rc */)) < 0 {
 77159  			return SQLITE_OK
 77160  		}
 77161  	}
 77162  
 77163  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (tvfsInjectFullerr(tls, p) != 0) {
 77164  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_FULL
 77165  	}
 77166  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 77167  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 77168  	}
 77169  
 77170  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 77171  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsWrite(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, zBuf, iAmt, iOfst)
 77172  	}
 77173  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77174  }
 77175  
 77176  // Truncate an tvfs-file.
 77177  func tvfsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_vfs.c:406:12: */
 77178  	bp := tls.Alloc(4)
 77179  	defer tls.Free(4)
 77180  
 77181  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77182  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77183  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77184  
 77185  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_TRUNCATE_MASK) != 0) {
 77186  		tvfsExecTcl(tls, p, ts+35705, /* "xTruncate" */
 77187  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 77188  		tvfsResultCode(tls, p, bp /* &rc */)
 77189  	}
 77190  
 77191  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 77192  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsTruncate(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, size)
 77193  	}
 77194  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77195  }
 77196  
 77197  // Sync an tvfs-file.
 77198  func tvfsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_vfs.c:427:12: */
 77199  	bp := tls.Alloc(4)
 77200  	defer tls.Free(4)
 77201  
 77202  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77203  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77204  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77205  
 77206  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SYNC_MASK) != 0) {
 77207  		var zFlags uintptr = uintptr(0)
 77208  
 77209  		switch flags {
 77210  		case SQLITE_SYNC_NORMAL:
 77211  			zFlags = ts + 16869 /* "normal" */
 77212  			break
 77213  			fallthrough
 77214  		case SQLITE_SYNC_FULL:
 77215  			zFlags = ts + 18730 /* "full" */
 77216  			break
 77217  			fallthrough
 77218  		case (SQLITE_SYNC_NORMAL | SQLITE_SYNC_DATAONLY):
 77219  			zFlags = ts + 38695 /* "normal|dataonly" */
 77220  			break
 77221  			fallthrough
 77222  		case (SQLITE_SYNC_FULL | SQLITE_SYNC_DATAONLY):
 77223  			zFlags = ts + 38711 /* "full|dataonly" */
 77224  			break
 77225  			fallthrough
 77226  		default:
 77227  
 77228  		}
 77229  
 77230  		tvfsExecTcl(tls, p, ts+28129, /* "xSync" */
 77231  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 77232  			tcl.XTcl_NewStringObj(tls, zFlags, -1), uintptr(0))
 77233  		tvfsResultCode(tls, p, bp /* &rc */)
 77234  	}
 77235  
 77236  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (tvfsInjectFullerr(tls, p) != 0) {
 77237  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_FULL
 77238  	}
 77239  
 77240  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 77241  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsSync(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, flags)
 77242  	}
 77243  
 77244  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77245  }
 77246  
 77247  // Return the current file-size of an tvfs-file.
 77248  func tvfsFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_vfs.c:471:12: */
 77249  	var p uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77250  	return sqlite3.Xsqlite3OsFileSize(tls, (*TestvfsFd)(unsafe.Pointer(p)).FpReal, pSize)
 77251  }
 77252  
 77253  // Lock an tvfs-file.
 77254  func tvfsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_vfs.c:479:12: */
 77255  	bp := tls.Alloc(38)
 77256  	defer tls.Free(38)
 77257  
 77258  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77259  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77260  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_LOCK_MASK) != 0) {
 77261  		// var zLock [30]int8 at bp+8, 30
 77262  
 77263  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zLock[0] */, ts+1238 /* "%d" */, libc.VaList(bp, eLock))
 77264  		tvfsExecTcl(tls, p, ts+35725 /* "xLock" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 77265  			tcl.XTcl_NewStringObj(tls, bp+8 /* &zLock[0] */, -1), uintptr(0), uintptr(0))
 77266  	}
 77267  	return sqlite3.Xsqlite3OsLock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, eLock)
 77268  }
 77269  
 77270  // Unlock an tvfs-file.
 77271  func tvfsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_vfs.c:494:12: */
 77272  	bp := tls.Alloc(38)
 77273  	defer tls.Free(38)
 77274  
 77275  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77276  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77277  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_UNLOCK_MASK) != 0) {
 77278  		// var zLock [30]int8 at bp+8, 30
 77279  
 77280  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zLock[0] */, ts+1238 /* "%d" */, libc.VaList(bp, eLock))
 77281  		tvfsExecTcl(tls, p, ts+35731 /* "xUnlock" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 77282  			tcl.XTcl_NewStringObj(tls, bp+8 /* &zLock[0] */, -1), uintptr(0), uintptr(0))
 77283  	}
 77284  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 77285  		return (SQLITE_IOERR | (int32(8) << 8))
 77286  	}
 77287  	return sqlite3.Xsqlite3OsUnlock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, eLock)
 77288  }
 77289  
 77290  // Check if another file-handle holds a RESERVED lock on an tvfs-file.
 77291  func tvfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_vfs.c:512:12: */
 77292  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77293  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77294  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_CKLOCK_MASK) != 0) {
 77295  		tvfsExecTcl(tls, p, ts+38725 /* "xCheckReservedLo..." */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 77296  			uintptr(0), uintptr(0), uintptr(0))
 77297  	}
 77298  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, pResOut)
 77299  }
 77300  
 77301  // File control method. For custom operations on an tvfs-file.
 77302  func tvfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_vfs.c:525:12: */
 77303  	bp := tls.Alloc(68)
 77304  	defer tls.Free(68)
 77305  
 77306  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77307  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77308  	if op == SQLITE_FCNTL_PRAGMA {
 77309  		var argv uintptr = pArg
 77310  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+10309 /* "error" */) == 0 {
 77311  			var rc int32 = SQLITE_ERROR
 77312  			if *(*uintptr)(unsafe.Pointer(argv + 2*8)) != 0 {
 77313  				var z uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*8))
 77314  				var x int32 = libc.Xatoi(tls, z)
 77315  				if x != 0 {
 77316  					rc = x
 77317  					for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0 {
 77318  						z++
 77319  					}
 77320  					for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x01) != 0 {
 77321  						z++
 77322  					}
 77323  				}
 77324  				if *(*int8)(unsafe.Pointer(z)) != 0 {
 77325  					*(*uintptr)(unsafe.Pointer(argv)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, z))
 77326  				}
 77327  			}
 77328  			return rc
 77329  		}
 77330  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)), ts+4655 /* "filename" */) == 0 {
 77331  			*(*uintptr)(unsafe.Pointer(argv)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename))
 77332  			return SQLITE_OK
 77333  		}
 77334  	}
 77335  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_FCNTL_MASK) != 0) {
 77336  		*(*[3]Fcntl)(unsafe.Pointer(bp + 16 /* aF */)) = [3]Fcntl{
 77337  			{FiFnctl: SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, FzFnctl: ts + 38744 /* "BEGIN_ATOMIC_WRI..." */},
 77338  			{FiFnctl: SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, FzFnctl: ts + 38763 /* "COMMIT_ATOMIC_WR..." */},
 77339  			{FiFnctl: SQLITE_FCNTL_ZIPVFS, FzFnctl: ts + 38783 /* "ZIPVFS" */},
 77340  		}
 77341  		var i int32
 77342  		for i = 0; uint64(i) < (uint64(unsafe.Sizeof([3]Fcntl{})) / uint64(unsafe.Sizeof(Fcntl{}))); i++ {
 77343  			if op == (*Fcntl)(unsafe.Pointer(bp+16 /* &aF */ +uintptr(i)*16)).FiFnctl {
 77344  				break
 77345  			}
 77346  		}
 77347  		if uint64(i) < (uint64(unsafe.Sizeof([3]Fcntl{})) / uint64(unsafe.Sizeof(Fcntl{}))) {
 77348  			*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = 0
 77349  			tvfsExecTcl(tls, p, ts+35753, /* "xFileControl" */
 77350  				tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 77351  				tcl.XTcl_NewStringObj(tls, (*Fcntl)(unsafe.Pointer(bp+16 /* &aF */ +uintptr(i)*16)).FzFnctl, -1),
 77352  				uintptr(0), uintptr(0))
 77353  			tvfsResultCode(tls, p, bp+64 /* &rc */)
 77354  			if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) != 0 {
 77355  				return func() int32 {
 77356  					if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) < 0 {
 77357  						return SQLITE_OK
 77358  					}
 77359  					return *(*int32)(unsafe.Pointer(bp + 64 /* rc */))
 77360  				}()
 77361  			}
 77362  		}
 77363  	}
 77364  	return sqlite3.Xsqlite3OsFileControl(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, op, pArg)
 77365  }
 77366  
 77367  type Fcntl = struct {
 77368  	FiFnctl int32
 77369  	_       [4]byte
 77370  	FzFnctl uintptr
 77371  } /* test_vfs.c:550:5 */
 77372  
 77373  // Return the sector-size in bytes for an tvfs-file.
 77374  func tvfsSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:579:12: */
 77375  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77376  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77377  	if (*Testvfs)(unsafe.Pointer(p)).FiSectorsize >= 0 {
 77378  		return (*Testvfs)(unsafe.Pointer(p)).FiSectorsize
 77379  	}
 77380  	return sqlite3.Xsqlite3OsSectorSize(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 77381  }
 77382  
 77383  // Return the device characteristic flags supported by an tvfs-file.
 77384  func tvfsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:591:12: */
 77385  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77386  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77387  	if (*Testvfs)(unsafe.Pointer(p)).FiDevchar >= 0 {
 77388  		return (*Testvfs)(unsafe.Pointer(p)).FiDevchar
 77389  	}
 77390  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 77391  }
 77392  
 77393  // Open an tvfs file handle.
 77394  func tvfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_vfs.c:603:12: */
 77395  	bp := tls.Alloc(4)
 77396  	defer tls.Free(4)
 77397  
 77398  	// var rc int32 at bp, 4
 77399  
 77400  	var pTestfile uintptr = pFile
 77401  	var pFd uintptr
 77402  	var pId uintptr = uintptr(0)
 77403  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 77404  
 77405  	pFd = tcl.XTcl_Alloc(tls, (uint32(uint64(unsafe.Sizeof(TestvfsFd{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent))).FszOsFile))))
 77406  	libc.Xmemset(tls, pFd, 0, (uint64(unsafe.Sizeof(TestvfsFd{})) + uint64((*sqlite3_vfs)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent))).FszOsFile)))
 77407  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = uintptr(0)
 77408  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = uintptr(0)
 77409  	(*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename = zName
 77410  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs = pVfs
 77411  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpReal = (pFd + 1*56)
 77412  	libc.Xmemset(tls, pTestfile, 0, uint64(unsafe.Sizeof(TestvfsFile{})))
 77413  	(*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd = pFd
 77414  
 77415  	// Evaluate the Tcl script:
 77416  	//
 77417  	//   SCRIPT xOpen FILENAME KEY-VALUE-ARGS
 77418  	//
 77419  	// If the script returns an SQLite error code other than SQLITE_OK, an
 77420  	// error is returned to the caller. If it returns SQLITE_OK, the new
 77421  	// connection is named "anon". Otherwise, the value returned by the
 77422  	// script is used as the connection name.
 77423  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77424  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_OPEN_MASK) != 0) {
 77425  		var pArg uintptr = tcl.XTcl_NewObj(tls)
 77426  		(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 77427  		if (flags & SQLITE_OPEN_MAIN_DB) != 0 {
 77428  			var z uintptr = (zName + uintptr((libc.Xstrlen(tls, zName) + uint64(1))))
 77429  			for *(*int8)(unsafe.Pointer(z)) != 0 {
 77430  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, tcl.XTcl_NewStringObj(tls, z, -1))
 77431  				z += (uintptr(libc.Xstrlen(tls, z) + uint64(1)))
 77432  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, tcl.XTcl_NewStringObj(tls, z, -1))
 77433  				z += (uintptr(libc.Xstrlen(tls, z) + uint64(1)))
 77434  			}
 77435  		}
 77436  		tvfsExecTcl(tls, p, ts+27701 /* "xOpen" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), pArg, uintptr(0), uintptr(0))
 77437  		for ok := true; ok; ok = 0 != 0 {
 77438  			var _objPtr uintptr = pArg
 77439  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77440  				tcl.XTclFreeObj(tls, _objPtr)
 77441  			}
 77442  		}
 77443  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 77444  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 77445  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 77446  			}
 77447  		} else {
 77448  			pId = tcl.XTcl_GetObjResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77449  		}
 77450  	}
 77451  
 77452  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_OPEN_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 77453  		return SQLITE_IOERR
 77454  	}
 77455  	if tvfsInjectCantopenerr(tls, p) != 0 {
 77456  		return SQLITE_CANTOPEN
 77457  	}
 77458  	if tvfsInjectFullerr(tls, p) != 0 {
 77459  		return SQLITE_FULL
 77460  	}
 77461  
 77462  	if !(pId != 0) {
 77463  		pId = tcl.XTcl_NewStringObj(tls, ts+38790 /* "anon" */, -1)
 77464  	}
 77465  	(*Tcl_Obj)(unsafe.Pointer(pId)).FrefCount++
 77466  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = pId
 77467  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77468  
 77469  	*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsOpen(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zName, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, flags, pOutFlags)
 77470  	if (*sqlite3_file)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)).FpMethods != 0 {
 77471  		var pMethods uintptr
 77472  		var nByte int32
 77473  
 77474  		if (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion > 1 {
 77475  			nByte = int32(unsafe.Sizeof(sqlite3_io_methods{}))
 77476  		} else {
 77477  			nByte = int32((uintptr(0) + 104 /* &.xShmMap */))
 77478  		}
 77479  
 77480  		pMethods = tcl.XTcl_Alloc(tls, uint32(nByte))
 77481  		libc.Xmemcpy(tls, pMethods, uintptr(unsafe.Pointer(&tvfs_io_methods)), uint64(nByte))
 77482  		(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion = (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)).FpMethods)).FiVersion
 77483  		if (*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion > (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion {
 77484  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion
 77485  		}
 77486  		if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion > 1) && ((*Testvfs)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData))).FisNoshm != 0) {
 77487  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmUnmap = uintptr(0)
 77488  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmLock = uintptr(0)
 77489  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmBarrier = uintptr(0)
 77490  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmMap = uintptr(0)
 77491  		}
 77492  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = pMethods
 77493  	}
 77494  
 77495  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77496  }
 77497  
 77498  // Delete the file located at zPath. If the dirSync argument is true,
 77499  // ensure the file-system modifications are synced to disk before
 77500  // returning.
 77501  func tvfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_vfs.c:702:12: */
 77502  	bp := tls.Alloc(4)
 77503  	defer tls.Free(4)
 77504  
 77505  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77506  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 77507  
 77508  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_DELETE_MASK) != 0) {
 77509  		tvfsExecTcl(tls, p, ts+35790, /* "xDelete" */
 77510  			tcl.XTcl_NewStringObj(tls, zPath, -1), tcl.XTcl_NewIntObj(tls, dirSync), uintptr(0), uintptr(0))
 77511  		tvfsResultCode(tls, p, bp /* &rc */)
 77512  	}
 77513  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 77514  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsDelete(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, dirSync)
 77515  	}
 77516  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77517  }
 77518  
 77519  // Test for access permissions. Return true if the requested permission
 77520  // is available, or false otherwise.
 77521  func tvfsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_vfs.c:722:12: */
 77522  	bp := tls.Alloc(4)
 77523  	defer tls.Free(4)
 77524  
 77525  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 77526  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_ACCESS_MASK) != 0) {
 77527  		// var rc int32 at bp, 4
 77528  
 77529  		var zArg uintptr = uintptr(0)
 77530  		if flags == SQLITE_ACCESS_EXISTS {
 77531  			zArg = ts + 38795 /* "SQLITE_ACCESS_EX..." */
 77532  		}
 77533  		if flags == SQLITE_ACCESS_READWRITE {
 77534  			zArg = ts + 38816 /* "SQLITE_ACCESS_RE..." */
 77535  		}
 77536  		if flags == SQLITE_ACCESS_READ {
 77537  			zArg = ts + 38840 /* "SQLITE_ACCESS_RE..." */
 77538  		}
 77539  		tvfsExecTcl(tls, p, ts+35798, /* "xAccess" */
 77540  			tcl.XTcl_NewStringObj(tls, zPath, -1), tcl.XTcl_NewStringObj(tls, zArg, -1), uintptr(0), uintptr(0))
 77541  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 77542  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 77543  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 77544  			}
 77545  		} else {
 77546  			var interp uintptr = (*Testvfs)(unsafe.Pointer(p)).Finterp
 77547  			if TCL_OK == tcl.XTcl_GetBooleanFromObj(tls, uintptr(0), tcl.XTcl_GetObjResult(tls, interp), pResOut) {
 77548  				return SQLITE_OK
 77549  			}
 77550  		}
 77551  	}
 77552  	return sqlite3.Xsqlite3OsAccess(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, flags, pResOut)
 77553  }
 77554  
 77555  // Populate buffer zOut with the full canonical pathname corresponding
 77556  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 77557  // of at least (DEVSYM_MAX_PATHNAME+1) bytes.
 77558  func tvfsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_vfs.c:755:12: */
 77559  	bp := tls.Alloc(4)
 77560  	defer tls.Free(4)
 77561  
 77562  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 77563  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_FULLPATHNAME_MASK) != 0) {
 77564  		// var rc int32 at bp, 4
 77565  
 77566  		tvfsExecTcl(tls, p, ts+35806 /* "xFullPathname" */, tcl.XTcl_NewStringObj(tls, zPath, -1), uintptr(0), uintptr(0), uintptr(0))
 77567  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 77568  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 77569  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 77570  			}
 77571  		}
 77572  	}
 77573  	return sqlite3.Xsqlite3OsFullPathname(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, nOut, zOut)
 77574  }
 77575  
 77576  // Populate the buffer pointed to by zBufOut with nByte bytes of
 77577  // random data.
 77578  func tvfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_vfs.c:808:12: */
 77579  	return sqlite3.Xsqlite3OsRandomness(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, nByte, zBufOut)
 77580  }
 77581  
 77582  // Sleep for nMicro microseconds. Return the number of microseconds
 77583  // actually slept.
 77584  func tvfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_vfs.c:816:12: */
 77585  	return sqlite3.Xsqlite3OsSleep(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, nMicro)
 77586  }
 77587  
 77588  // Return the current time as a Julian Day number in *pTimeOut.
 77589  func tvfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_vfs.c:823:12: */
 77590  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent + 120 /* &.xCurrentTime */))))(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, pTimeOut)
 77591  }
 77592  
 77593  func tvfsShmOpen(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:827:12: */
 77594  	bp := tls.Alloc(4)
 77595  	defer tls.Free(4)
 77596  
 77597  	var p uintptr
 77598  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Return code
 77599  	var pBuffer uintptr                                // Buffer to open connection to
 77600  	var pFd uintptr                                    // The testvfs file structure
 77601  
 77602  	pFd = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77603  	p = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77604  
 77605  	// Evaluate the Tcl script:
 77606  	//
 77607  	//   SCRIPT xShmOpen FILENAME
 77608  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 77609  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMOPEN_MASK) != 0) {
 77610  		tvfsExecTcl(tls, p, ts+38859 /* "xShmOpen" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), uintptr(0), uintptr(0), uintptr(0))
 77611  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 77612  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 77613  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 77614  			}
 77615  		}
 77616  	}
 77617  
 77618  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMOPEN_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 77619  		return SQLITE_IOERR
 77620  	}
 77621  
 77622  	// Search for a TestvfsBuffer. Create a new one if required.
 77623  	for pBuffer = (*Testvfs)(unsafe.Pointer(p)).FpBuffer; pBuffer != 0; pBuffer = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext {
 77624  		if 0 == libc.Xstrcmp(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile) {
 77625  			break
 77626  		}
 77627  	}
 77628  	if !(pBuffer != 0) {
 77629  		var szName int32 = int32(libc.Xstrlen(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename))
 77630  		var nByte int32 = (int32((uint64(unsafe.Sizeof(TestvfsBuffer{})) + uint64(szName)) + uint64(1)))
 77631  		pBuffer = tcl.XTcl_Alloc(tls, uint32(nByte))
 77632  		libc.Xmemset(tls, pBuffer, 0, uint64(nByte))
 77633  		(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile = (pBuffer + 1*8224)
 77634  		libc.Xmemcpy(tls, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, (uint64(szName + 1)))
 77635  		(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext = (*Testvfs)(unsafe.Pointer(p)).FpBuffer
 77636  		(*Testvfs)(unsafe.Pointer(p)).FpBuffer = pBuffer
 77637  	}
 77638  
 77639  	// Connect the TestvfsBuffer to the new TestvfsShm handle and return.
 77640  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpNext = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile
 77641  	(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile = pFd
 77642  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = pBuffer
 77643  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77644  }
 77645  
 77646  func tvfsAllocPage(tls *libc.TLS, p uintptr, iPage int32, pgsz int32) { /* test_vfs.c:877:13: */
 77647  
 77648  	if *(*uintptr)(unsafe.Pointer((p + 16 /* &.aPage */) + uintptr(iPage)*8)) == uintptr(0) {
 77649  		*(*uintptr)(unsafe.Pointer((p + 16 /* &.aPage */) + uintptr(iPage)*8)) = tcl.XTcl_Alloc(tls, uint32(pgsz))
 77650  		libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((p + 16 /* &.aPage */) + uintptr(iPage)*8)), 0, uint64(pgsz))
 77651  		(*TestvfsBuffer)(unsafe.Pointer(p)).Fpgsz = pgsz
 77652  	}
 77653  }
 77654  
 77655  func tvfsShmMap(tls *libc.TLS, pFile uintptr, iPage int32, pgsz int32, isWrite int32, pp uintptr) int32 { /* test_vfs.c:886:12: */
 77656  	bp := tls.Alloc(4)
 77657  	defer tls.Free(4)
 77658  
 77659  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77660  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77661  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77662  
 77663  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 77664  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 77665  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 104 /* &.xShmMap */))))(tls, pReal, iPage, pgsz, isWrite, libc.AtomicLoadUintptr(&pp))
 77666  	}
 77667  
 77668  	if uintptr(0) == (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm {
 77669  		*(*int32)(unsafe.Pointer(bp /* rc */)) = tvfsShmOpen(tls, pFile)
 77670  		if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 77671  			return *(*int32)(unsafe.Pointer(bp /* rc */))
 77672  		}
 77673  	}
 77674  
 77675  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMMAP_MASK) != 0) {
 77676  		var pArg uintptr = tcl.XTcl_NewObj(tls)
 77677  		(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 77678  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, iPage))
 77679  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, pgsz))
 77680  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, isWrite))
 77681  		tvfsExecTcl(tls, p, ts+35883, /* "xShmMap" */
 77682  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, pArg, uintptr(0))
 77683  		tvfsResultCode(tls, p, bp /* &rc */)
 77684  		for ok := true; ok; ok = 0 != 0 {
 77685  			var _objPtr uintptr = pArg
 77686  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77687  				tcl.XTclFreeObj(tls, _objPtr)
 77688  			}
 77689  		}
 77690  	}
 77691  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMMAP_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 77692  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 77693  	}
 77694  
 77695  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (isWrite != 0)) && !(int32(*(*uintptr)(unsafe.Pointer(((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm + 16 /* &.aPage */) + uintptr(iPage)*8))) != 0) {
 77696  		tvfsAllocPage(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm, iPage, pgsz)
 77697  	}
 77698  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_READONLY) {
 77699  		*(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = *(*uintptr)(unsafe.Pointer(((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm + 16 /* &.aPage */) + uintptr(iPage)*8))
 77700  	}
 77701  
 77702  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77703  }
 77704  
 77705  func tvfsShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_vfs.c:936:12: */
 77706  	bp := tls.Alloc(100)
 77707  	defer tls.Free(100)
 77708  
 77709  	*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_OK
 77710  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77711  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77712  	var nLock int32
 77713  	// var zLock [80]int8 at bp+16, 80
 77714  
 77715  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 77716  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 77717  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 112 /* &.xShmLock */))))(tls, pReal, ofst, n, flags)
 77718  	}
 77719  
 77720  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMLOCK_MASK) != 0) {
 77721  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([80]int8{})), bp+16 /* &zLock[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp, ofst, n))
 77722  		nLock = int32(libc.Xstrlen(tls, bp+16 /* &zLock[0] */))
 77723  		if (flags & SQLITE_SHM_LOCK) != 0 {
 77724  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38868 /* " lock" */)
 77725  		} else {
 77726  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38874 /* " unlock" */)
 77727  		}
 77728  		nLock = nLock + (int32(libc.Xstrlen(tls, (bp + 16 /* &zLock */ + uintptr(nLock)))))
 77729  		if (flags & SQLITE_SHM_SHARED) != 0 {
 77730  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38882 /* " shared" */)
 77731  		} else {
 77732  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38890 /* " exclusive" */)
 77733  		}
 77734  		tvfsExecTcl(tls, p, ts+35862, /* "xShmLock" */
 77735  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 77736  			tcl.XTcl_NewStringObj(tls, bp+16 /* &zLock[0] */, -1), uintptr(0))
 77737  		tvfsResultCode(tls, p, bp+96 /* &rc */)
 77738  	}
 77739  
 77740  	if ((*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMLOCK_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 77741  		*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_IOERR
 77742  	}
 77743  
 77744  	if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK {
 77745  		var isLock int32 = (flags & SQLITE_SHM_LOCK)
 77746  		var isExcl int32 = (flags & SQLITE_SHM_EXCLUSIVE)
 77747  		var mask u32 = (u32(((int32(1) << n) - 1) << ofst))
 77748  		if isLock != 0 {
 77749  			var p2 uintptr
 77750  			for p2 = (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FpFile; p2 != 0; p2 = (*TestvfsFd)(unsafe.Pointer(p2)).FpNext {
 77751  				if p2 == pFd {
 77752  					continue
 77753  				}
 77754  				if (((*TestvfsFd)(unsafe.Pointer(p2)).Fexcllock & mask) != 0) || ((isExcl != 0) && (((*TestvfsFd)(unsafe.Pointer(p2)).Fsharedlock & mask) != 0)) {
 77755  					*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_BUSY
 77756  					break
 77757  				}
 77758  			}
 77759  			if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK {
 77760  				if isExcl != 0 {
 77761  					*(*u32)(unsafe.Pointer(pFd + 40 /* &.excllock */)) |= (mask)
 77762  				}
 77763  				if !(isExcl != 0) {
 77764  					*(*u32)(unsafe.Pointer(pFd + 44 /* &.sharedlock */)) |= (mask)
 77765  				}
 77766  			}
 77767  		} else {
 77768  			if isExcl != 0 {
 77769  				*(*u32)(unsafe.Pointer(pFd + 40 /* &.excllock */)) &= (^mask)
 77770  			}
 77771  			if !(isExcl != 0) {
 77772  				*(*u32)(unsafe.Pointer(pFd + 44 /* &.sharedlock */)) &= (^mask)
 77773  			}
 77774  		}
 77775  	}
 77776  
 77777  	return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 77778  }
 77779  
 77780  func tvfsShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_vfs.c:1004:13: */
 77781  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77782  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77783  
 77784  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMBARRIER_MASK) != 0) {
 77785  		var z uintptr
 77786  		if (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm != 0 {
 77787  			z = (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile
 77788  		} else {
 77789  			z = ts + 489 /* "" */
 77790  		}
 77791  		tvfsExecTcl(tls, p, ts+35871 /* "xShmBarrier" */, tcl.XTcl_NewStringObj(tls, z, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 77792  	}
 77793  
 77794  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 77795  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 77796  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 120 /* &.xShmBarrier */))))(tls, pReal)
 77797  		return
 77798  	}
 77799  }
 77800  
 77801  func tvfsShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* test_vfs.c:1020:12: */
 77802  	bp := tls.Alloc(4)
 77803  	defer tls.Free(4)
 77804  
 77805  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 77806  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77807  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 77808  	var pBuffer uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm
 77809  	var ppFd uintptr
 77810  
 77811  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 77812  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 77813  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 128 /* &.xShmUnmap */))))(tls, pReal, deleteFlag)
 77814  	}
 77815  
 77816  	if !(pBuffer != 0) {
 77817  		return SQLITE_OK
 77818  	}
 77819  
 77820  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMCLOSE_MASK) != 0) {
 77821  		tvfsExecTcl(tls, p, ts+35852, /* "xShmUnmap" */
 77822  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 77823  		tvfsResultCode(tls, p, bp /* &rc */)
 77824  	}
 77825  
 77826  	for ppFd = (pBuffer + 8208 /* &.pFile */); *(*uintptr)(unsafe.Pointer(ppFd)) != pFd; ppFd = (*(*uintptr)(unsafe.Pointer(ppFd)) + 48 /* &.pNext */) {
 77827  	}
 77828  
 77829  	*(*uintptr)(unsafe.Pointer(ppFd)) = (*TestvfsFd)(unsafe.Pointer(pFd)).FpNext
 77830  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpNext = uintptr(0)
 77831  
 77832  	if (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile == uintptr(0) {
 77833  		var i int32
 77834  		var pp uintptr
 77835  		for pp = (p + 40 /* &.pBuffer */); *(*uintptr)(unsafe.Pointer(pp)) != pBuffer; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 8216 /* &.pNext */) {
 77836  		}
 77837  		*(*uintptr)(unsafe.Pointer(pp)) = (*TestvfsBuffer)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext
 77838  		for i = 0; *(*uintptr)(unsafe.Pointer((pBuffer + 16 /* &.aPage */) + uintptr(i)*8)) != 0; i++ {
 77839  			tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 16 /* &.aPage */) + uintptr(i)*8)))
 77840  		}
 77841  		tcl.XTcl_Free(tls, pBuffer)
 77842  	}
 77843  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = uintptr(0)
 77844  
 77845  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 77846  }
 77847  
 77848  func tvfsFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* test_vfs.c:1065:12: */
 77849  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77850  	return sqlite3.Xsqlite3OsFetch(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, iOfst, iAmt, pp)
 77851  }
 77852  
 77853  func tvfsUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, p uintptr) int32 { /* test_vfs.c:1075:12: */
 77854  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 77855  	return sqlite3.Xsqlite3OsUnfetch(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, iOfst, p)
 77856  }
 77857  
 77858  func testvfs_obj_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1080:26: */
 77859  	bp := tls.Alloc(568)
 77860  	defer tls.Free(568)
 77861  
 77862  	var p uintptr = cd
 77863  	*(*[10]TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* aSubcmd */)) = [10]TestvfsSubcmd{
 77864  		{FzName: ts + 38901 /* "shm" */},
 77865  		{FzName: ts + 10601 /* "delete" */, FeCmd: uint32(1) /* CMD_DELETE */},
 77866  		{FzName: ts + 38905 /* "filter" */, FeCmd: uint32(2) /* CMD_FILTER */},
 77867  		{FzName: ts + 38912 /* "ioerr" */, FeCmd: uint32(3) /* CMD_IOERR */},
 77868  		{FzName: ts + 38918 /* "fullerr" */, FeCmd: uint32(7) /* CMD_FULLERR */},
 77869  		{FzName: ts + 38926 /* "cantopenerr" */, FeCmd: uint32(8) /* CMD_CANTOPENERR */},
 77870  		{FzName: ts + 38938 /* "script" */, FeCmd: uint32(4) /* CMD_SCRIPT */},
 77871  		{FzName: ts + 38945 /* "devchar" */, FeCmd: uint32(5) /* CMD_DEVCHAR */},
 77872  		{FzName: ts + 38953 /* "sectorsize" */, FeCmd: uint32(6) /* CMD_SECTORSIZE */},
 77873  		{},
 77874  	}
 77875  	// var i int32 at bp+256, 4
 77876  
 77877  	if objc < 2 {
 77878  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 77879  		return TCL_ERROR
 77880  	}
 77881  	if tcl.XTcl_GetIndexFromObjStruct(tls,
 77882  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*8)), bp+96 /* &aSubcmd[0] */, int32(unsafe.Sizeof(TestvfsSubcmd{})), ts+38964 /* "subcommand" */, 0, bp+256 /* &i */) != 0 {
 77883  		return TCL_ERROR
 77884  	}
 77885  	tcl.XTcl_ResetResult(tls, interp)
 77886  
 77887  	switch (*TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* &aSubcmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*16)).FeCmd {
 77888  	case uint32(0) /* CMD_SHM */ :
 77889  		{
 77890  			var pObj uintptr
 77891  			var rc int32
 77892  			var pBuffer uintptr
 77893  			var zName uintptr
 77894  			if (objc != 3) && (objc != 4) {
 77895  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+38975 /* "FILE ?VALUE?" */)
 77896  				return TCL_ERROR
 77897  			}
 77898  			zName = tcl.XTcl_Alloc(tls, uint32((*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname))
 77899  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer(p)).FpParent + 64 /* &.xFullPathname */))))(tls,
 77900  				(*Testvfs)(unsafe.Pointer(p)).FpParent, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))),
 77901  				(*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname, zName)
 77902  			if rc != SQLITE_OK {
 77903  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38988, /* "failed to get fu..." */
 77904  					tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 0))
 77905  				tcl.XTcl_Free(tls, zName)
 77906  				return TCL_ERROR
 77907  			}
 77908  			for pBuffer = (*Testvfs)(unsafe.Pointer(p)).FpBuffer; pBuffer != 0; pBuffer = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext {
 77909  				if 0 == libc.Xstrcmp(tls, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile, zName) {
 77910  					break
 77911  				}
 77912  			}
 77913  			tcl.XTcl_Free(tls, zName)
 77914  			if !(pBuffer != 0) {
 77915  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+39014 /* "no such file: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 0))
 77916  				return TCL_ERROR
 77917  			}
 77918  			if objc == 4 {
 77919  				// var n int32 at bp+260, 4
 77920  
 77921  				var a uintptr = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+260 /* &n */)
 77922  				var pgsz int32 = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).Fpgsz
 77923  				if pgsz == 0 {
 77924  					pgsz = 65536
 77925  				}
 77926  				for *(*int32)(unsafe.Pointer(bp + 256 /* i */)) = 0; (*(*int32)(unsafe.Pointer(bp + 256 /* i */)) * pgsz) < *(*int32)(unsafe.Pointer(bp + 260 /* n */)); *(*int32)(unsafe.Pointer(bp + 256 /* i */))++ {
 77927  					var nByte int32 = pgsz
 77928  					tvfsAllocPage(tls, pBuffer, *(*int32)(unsafe.Pointer(bp + 256 /* i */)), pgsz)
 77929  					if (*(*int32)(unsafe.Pointer(bp + 260 /* n */)) - (*(*int32)(unsafe.Pointer(bp + 256 /* i */)) * pgsz)) < pgsz {
 77930  						nByte = *(*int32)(unsafe.Pointer(bp + 260 /* n */))
 77931  					}
 77932  					libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 16 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*8)), (a + uintptr((*(*int32)(unsafe.Pointer(bp + 256 /* i */)) * pgsz))), uint64(nByte))
 77933  				}
 77934  			}
 77935  
 77936  			pObj = tcl.XTcl_NewObj(tls)
 77937  			for *(*int32)(unsafe.Pointer(bp + 256 /* i */)) = 0; *(*uintptr)(unsafe.Pointer((pBuffer + 16 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*8)) != 0; *(*int32)(unsafe.Pointer(bp + 256 /* i */))++ {
 77938  				var pgsz int32 = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).Fpgsz
 77939  				if pgsz == 0 {
 77940  					pgsz = 65536
 77941  				}
 77942  				tcl.XTcl_AppendObjToObj(tls, pObj, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 16 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*8)), pgsz))
 77943  			}
 77944  			tcl.XTcl_SetObjResult(tls, interp, pObj)
 77945  			break
 77946  
 77947  		}
 77948  
 77949  	// TESTVFS filter METHOD-LIST
 77950  	//
 77951  	//     Activate special processing for those methods contained in the list
 77952  	case uint32(2) /* CMD_FILTER */ :
 77953  		{
 77954  			*(*uintptr)(unsafe.Pointer(bp + 272 /* apElem */)) = uintptr(0)
 77955  			*(*int32)(unsafe.Pointer(bp + 264 /* nElem */)) = 0
 77956  			var mask int32 = 0
 77957  			if objc != 3 {
 77958  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+32617 /* "LIST" */)
 77959  				return TCL_ERROR
 77960  			}
 77961  			if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+264 /* &nElem */, bp+272 /* &apElem */) != 0 {
 77962  				return TCL_ERROR
 77963  			}
 77964  			tcl.XTcl_ResetResult(tls, interp)
 77965  			for *(*int32)(unsafe.Pointer(bp + 256 /* i */)) = 0; *(*int32)(unsafe.Pointer(bp + 256 /* i */)) < *(*int32)(unsafe.Pointer(bp + 264 /* nElem */)); *(*int32)(unsafe.Pointer(bp + 256 /* i */))++ {
 77966  				var iMethod int32
 77967  				var zElem uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 272 /* apElem */)) + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*8)))
 77968  				for iMethod = 0; iMethod < (int32(uint64(unsafe.Sizeof(vfsmethod)) / uint64(unsafe.Sizeof(VfsMethod{})))); iMethod++ {
 77969  					if libc.Xstrcmp(tls, zElem, vfsmethod[iMethod].FzName) == 0 {
 77970  						mask = mask | (vfsmethod[iMethod].Fmask)
 77971  						break
 77972  					}
 77973  				}
 77974  				if iMethod == (int32(uint64(unsafe.Sizeof(vfsmethod)) / uint64(unsafe.Sizeof(VfsMethod{})))) {
 77975  					tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+39029 /* "unknown method: " */, zElem, 0))
 77976  					return TCL_ERROR
 77977  				}
 77978  			}
 77979  			(*Testvfs)(unsafe.Pointer(p)).Fmask = mask
 77980  			break
 77981  
 77982  		}
 77983  
 77984  	//  TESTVFS script ?SCRIPT?
 77985  	//
 77986  	//  Query or set the script to be run when filtered VFS events
 77987  	//  occur.
 77988  	case uint32(4) /* CMD_SCRIPT */ :
 77989  		{
 77990  			if objc == 3 {
 77991  				// var nByte int32 at bp+280, 4
 77992  
 77993  				if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 77994  					for ok := true; ok; ok = 0 != 0 {
 77995  						var _objPtr uintptr = (*Testvfs)(unsafe.Pointer(p)).FpScript
 77996  						if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77997  							tcl.XTclFreeObj(tls, _objPtr)
 77998  						}
 77999  					}
 78000  					(*Testvfs)(unsafe.Pointer(p)).FpScript = uintptr(0)
 78001  				}
 78002  				tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+280 /* &nByte */)
 78003  				if *(*int32)(unsafe.Pointer(bp + 280 /* nByte */)) > 0 {
 78004  					(*Testvfs)(unsafe.Pointer(p)).FpScript = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 78005  					(*Tcl_Obj)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpScript)).FrefCount++
 78006  				}
 78007  			} else if objc != 2 {
 78008  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 78009  				return TCL_ERROR
 78010  			}
 78011  
 78012  			tcl.XTcl_ResetResult(tls, interp)
 78013  			if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 78014  				tcl.XTcl_SetObjResult(tls, interp, (*Testvfs)(unsafe.Pointer(p)).FpScript)
 78015  			}
 78016  
 78017  			break
 78018  
 78019  		}
 78020  
 78021  	// TESTVFS ioerr ?IFAIL PERSIST?
 78022  	//
 78023  	//   Where IFAIL is an integer and PERSIST is boolean.
 78024  	case uint32(8) /* CMD_CANTOPENERR */ :
 78025  		fallthrough
 78026  	case uint32(3) /* CMD_IOERR */ :
 78027  		fallthrough
 78028  	case uint32(7) /* CMD_FULLERR */ :
 78029  		{
 78030  			var pTest uintptr = uintptr(0)
 78031  			var iRet int32
 78032  
 78033  			switch (*TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* &aSubcmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 256 /* i */)))*16)).FeCmd {
 78034  			case uint32(3) /* CMD_IOERR */ :
 78035  				pTest = (p + 60 /* &.ioerr_err */)
 78036  				break
 78037  			case uint32(7) /* CMD_FULLERR */ :
 78038  				pTest = (p + 72 /* &.full_err */)
 78039  				break
 78040  			case uint32(8) /* CMD_CANTOPENERR */ :
 78041  				pTest = (p + 84 /* &.cantopen_err */)
 78042  				break
 78043  			default:
 78044  			}
 78045  			iRet = (*TestFaultInject)(unsafe.Pointer(pTest)).FnFail
 78046  			(*TestFaultInject)(unsafe.Pointer(pTest)).FnFail = 0
 78047  			(*TestFaultInject)(unsafe.Pointer(pTest)).FeFault = 0
 78048  			(*TestFaultInject)(unsafe.Pointer(pTest)).FiCnt = 0
 78049  
 78050  			if objc == 4 {
 78051  				// var iCnt int32 at bp+284, 4
 78052  
 78053  				// var iPersist int32 at bp+288, 4
 78054  
 78055  				if (TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+284 /* &iCnt */)) ||
 78056  					(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+288 /* &iPersist */)) {
 78057  					return TCL_ERROR
 78058  				}
 78059  				(*TestFaultInject)(unsafe.Pointer(pTest)).FeFault = func() int32 {
 78060  					if *(*int32)(unsafe.Pointer(bp + 288 /* iPersist */)) != 0 {
 78061  						return FAULT_INJECT_PERSISTENT
 78062  					}
 78063  					return FAULT_INJECT_TRANSIENT
 78064  				}()
 78065  				(*TestFaultInject)(unsafe.Pointer(pTest)).FiCnt = *(*int32)(unsafe.Pointer(bp + 284 /* iCnt */))
 78066  			} else if objc != 2 {
 78067  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39046 /* "?CNT PERSIST?" */)
 78068  				return TCL_ERROR
 78069  			}
 78070  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iRet))
 78071  			break
 78072  
 78073  		}
 78074  
 78075  	case uint32(1) /* CMD_DELETE */ :
 78076  		{
 78077  			tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 78078  			break
 78079  
 78080  		}
 78081  
 78082  	case uint32(5) /* CMD_DEVCHAR */ :
 78083  		{
 78084  			*(*[16]DeviceFlag)(unsafe.Pointer(bp + 304 /* aFlag */)) = [16]DeviceFlag{
 78085  				{FzName: ts + 39060 /* "default" */, FiValue: -1},
 78086  				{FzName: ts + 26683 /* "atomic" */, FiValue: SQLITE_IOCAP_ATOMIC},
 78087  				{FzName: ts + 26690 /* "atomic512" */, FiValue: SQLITE_IOCAP_ATOMIC512},
 78088  				{FzName: ts + 26700 /* "atomic1k" */, FiValue: SQLITE_IOCAP_ATOMIC1K},
 78089  				{FzName: ts + 26709 /* "atomic2k" */, FiValue: SQLITE_IOCAP_ATOMIC2K},
 78090  				{FzName: ts + 26718 /* "atomic4k" */, FiValue: SQLITE_IOCAP_ATOMIC4K},
 78091  				{FzName: ts + 26727 /* "atomic8k" */, FiValue: SQLITE_IOCAP_ATOMIC8K},
 78092  				{FzName: ts + 26736 /* "atomic16k" */, FiValue: SQLITE_IOCAP_ATOMIC16K},
 78093  				{FzName: ts + 26746 /* "atomic32k" */, FiValue: SQLITE_IOCAP_ATOMIC32K},
 78094  				{FzName: ts + 26756 /* "atomic64k" */, FiValue: SQLITE_IOCAP_ATOMIC64K},
 78095  				{FzName: ts + 26766 /* "sequential" */, FiValue: SQLITE_IOCAP_SEQUENTIAL},
 78096  				{FzName: ts + 26777 /* "safe_append" */, FiValue: SQLITE_IOCAP_SAFE_APPEND},
 78097  				{FzName: ts + 39068 /* "undeletable_when..." */, FiValue: SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},
 78098  				{FzName: ts + 26789 /* "powersafe_overwr..." */, FiValue: SQLITE_IOCAP_POWERSAFE_OVERWRITE},
 78099  				{FzName: ts + 39090 /* "immutable" */, FiValue: SQLITE_IOCAP_IMMUTABLE},
 78100  				{},
 78101  			}
 78102  			var pRet uintptr
 78103  			var iFlag int32
 78104  
 78105  			if objc > 3 {
 78106  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39100 /* "?ATTR-LIST?" */)
 78107  				return TCL_ERROR
 78108  			}
 78109  			if objc == 3 {
 78110  				var j int32
 78111  				var iNew int32 = 0
 78112  				*(*uintptr)(unsafe.Pointer(bp + 296 /* flags */)) = uintptr(0)
 78113  				*(*int32)(unsafe.Pointer(bp + 292 /* nFlags */)) = 0
 78114  
 78115  				if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+292 /* &nFlags */, bp+296 /* &flags */) != 0 {
 78116  					return TCL_ERROR
 78117  				}
 78118  
 78119  				for j = 0; j < *(*int32)(unsafe.Pointer(bp + 292 /* nFlags */)); j++ {
 78120  					*(*int32)(unsafe.Pointer(bp + 560 /* idx */)) = 0
 78121  					if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 296 /* flags */)) + uintptr(j)*8)), bp+304, /* &aFlag[0] */
 78122  						int32(unsafe.Sizeof(DeviceFlag{})), ts+17985 /* "flag" */, 0, bp+560 /* &idx */) != 0 {
 78123  						return TCL_ERROR
 78124  					}
 78125  					if ((*DeviceFlag)(unsafe.Pointer(bp+304 /* &aFlag */ +uintptr(*(*int32)(unsafe.Pointer(bp + 560 /* idx */)))*16)).FiValue < 0) && (*(*int32)(unsafe.Pointer(bp + 292 /* nFlags */)) > 1) {
 78126  						tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+39112 /* "bad flags: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8))), 0))
 78127  						return TCL_ERROR
 78128  					}
 78129  					iNew = iNew | ((*DeviceFlag)(unsafe.Pointer(bp + 304 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 560 /* idx */)))*16)).FiValue)
 78130  				}
 78131  
 78132  				(*Testvfs)(unsafe.Pointer(p)).FiDevchar = (iNew | 0x10000000)
 78133  			}
 78134  
 78135  			pRet = tcl.XTcl_NewObj(tls)
 78136  			for iFlag = 0; uint64(iFlag) < (uint64(unsafe.Sizeof([16]DeviceFlag{})) / uint64(unsafe.Sizeof(DeviceFlag{}))); iFlag++ {
 78137  				if ((*Testvfs)(unsafe.Pointer(p)).FiDevchar & (*DeviceFlag)(unsafe.Pointer(bp+304 /* &aFlag */ +uintptr(iFlag)*16)).FiValue) != 0 {
 78138  					tcl.XTcl_ListObjAppendElement(tls,
 78139  						interp, pRet, tcl.XTcl_NewStringObj(tls, (*DeviceFlag)(unsafe.Pointer(bp+304 /* &aFlag */ +uintptr(iFlag)*16)).FzName, -1))
 78140  				}
 78141  			}
 78142  			tcl.XTcl_SetObjResult(tls, interp, pRet)
 78143  
 78144  			break
 78145  
 78146  		}
 78147  
 78148  	case uint32(6) /* CMD_SECTORSIZE */ :
 78149  		{
 78150  			if objc > 3 {
 78151  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39124 /* "?VALUE?" */)
 78152  				return TCL_ERROR
 78153  			}
 78154  			if objc == 3 {
 78155  				*(*int32)(unsafe.Pointer(bp + 564 /* iNew */)) = 0
 78156  				if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*8)), bp+564 /* &iNew */) != 0 {
 78157  					return TCL_ERROR
 78158  				}
 78159  				(*Testvfs)(unsafe.Pointer(p)).FiSectorsize = *(*int32)(unsafe.Pointer(bp + 564 /* iNew */))
 78160  			}
 78161  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (*Testvfs)(unsafe.Pointer(p)).FiSectorsize))
 78162  			break
 78163  
 78164  		}
 78165  	}
 78166  
 78167  	return TCL_OK
 78168  }
 78169  
 78170  type TestvfsSubcmd = struct {
 78171  	FzName uintptr
 78172  	FeCmd  uint32
 78173  	_      [4]byte
 78174  } /* test_vfs.c:1092:3 */
 78175  
 78176  type VfsMethod = struct {
 78177  	FzName uintptr
 78178  	Fmask  int32
 78179  	_      [4]byte
 78180  } /* test_vfs.c:1179:14 */
 78181  
 78182  var vfsmethod = [18]VfsMethod{
 78183  	{FzName: ts + 38859 /* "xShmOpen" */, Fmask: TESTVFS_SHMOPEN_MASK},
 78184  	{FzName: ts + 35862 /* "xShmLock" */, Fmask: TESTVFS_SHMLOCK_MASK},
 78185  	{FzName: ts + 35871 /* "xShmBarrier" */, Fmask: TESTVFS_SHMBARRIER_MASK},
 78186  	{FzName: ts + 35852 /* "xShmUnmap" */, Fmask: TESTVFS_SHMCLOSE_MASK},
 78187  	{FzName: ts + 35883 /* "xShmMap" */, Fmask: TESTVFS_SHMMAP_MASK},
 78188  	{FzName: ts + 28129 /* "xSync" */, Fmask: TESTVFS_SYNC_MASK},
 78189  	{FzName: ts + 35790 /* "xDelete" */, Fmask: TESTVFS_DELETE_MASK},
 78190  	{FzName: ts + 35698 /* "xWrite" */, Fmask: TESTVFS_WRITE_MASK},
 78191  	{FzName: ts + 35692 /* "xRead" */, Fmask: TESTVFS_READ_MASK},
 78192  	{FzName: ts + 35705 /* "xTruncate" */, Fmask: TESTVFS_TRUNCATE_MASK},
 78193  	{FzName: ts + 27701 /* "xOpen" */, Fmask: TESTVFS_OPEN_MASK},
 78194  	{FzName: ts + 35685 /* "xClose" */, Fmask: TESTVFS_CLOSE_MASK},
 78195  	{FzName: ts + 35798 /* "xAccess" */, Fmask: TESTVFS_ACCESS_MASK},
 78196  	{FzName: ts + 35806 /* "xFullPathname" */, Fmask: TESTVFS_FULLPATHNAME_MASK},
 78197  	{FzName: ts + 35731 /* "xUnlock" */, Fmask: TESTVFS_UNLOCK_MASK},
 78198  	{FzName: ts + 35725 /* "xLock" */, Fmask: TESTVFS_LOCK_MASK},
 78199  	{FzName: ts + 38725 /* "xCheckReservedLo..." */, Fmask: TESTVFS_CKLOCK_MASK},
 78200  	{FzName: ts + 35753 /* "xFileControl" */, Fmask: TESTVFS_FCNTL_MASK},
 78201  } /* test_vfs.c:1182:9 */
 78202  
 78203  func testvfs_obj_del(tls *libc.TLS, cd ClientData) { /* test_vfs.c:1393:27: */
 78204  	var p uintptr = cd
 78205  	if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 78206  		for ok := true; ok; ok = 0 != 0 {
 78207  			var _objPtr uintptr = (*Testvfs)(unsafe.Pointer(p)).FpScript
 78208  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78209  				tcl.XTclFreeObj(tls, _objPtr)
 78210  			}
 78211  		}
 78212  	}
 78213  	sqlite3.Xsqlite3_vfs_unregister(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs)
 78214  	libc.Xmemset(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs, 0, uint64(unsafe.Sizeof(sqlite3_vfs{})))
 78215  	tcl.XTcl_Free(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs)
 78216  	libc.Xmemset(tls, p, 0, uint64(unsafe.Sizeof(Testvfs{})))
 78217  	tcl.XTcl_Free(tls, p)
 78218  }
 78219  
 78220  // Usage:  testvfs VFSNAME ?SWITCHES?
 78221  //
 78222  // Switches are:
 78223  //
 78224  //   -noshm   BOOLEAN             (True to omit shm methods. Default false)
 78225  //   -default BOOLEAN             (True to make the vfs default. Default false)
 78226  //
 78227  // This command creates two things when it is invoked: an SQLite VFS, and
 78228  // a Tcl command. Both are named VFSNAME. The VFS is installed. It is not
 78229  // installed as the default VFS.
 78230  //
 78231  // The VFS passes all file I/O calls through to the underlying VFS.
 78232  //
 78233  // Whenever the xShmMap method of the VFS
 78234  // is invoked, the SCRIPT is executed as follows:
 78235  //
 78236  //   SCRIPT xShmMap    FILENAME ID
 78237  //
 78238  // The value returned by the invocation of SCRIPT above is interpreted as
 78239  // an SQLite error code and returned to SQLite. Either a symbolic
 78240  // "SQLITE_OK" or numeric "0" value may be returned.
 78241  //
 78242  // The contents of the shared-memory buffer associated with a given file
 78243  // may be read and set using the following command:
 78244  //
 78245  //   VFSNAME shm FILENAME ?NEWVALUE?
 78246  //
 78247  // When the xShmLock method is invoked by SQLite, the following script is
 78248  // run:
 78249  //
 78250  //   SCRIPT xShmLock    FILENAME ID LOCK
 78251  //
 78252  // where LOCK is of the form "OFFSET NBYTE lock/unlock shared/exclusive"
 78253  func testvfs_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1438:26: */
 78254  	bp := tls.Alloc(28)
 78255  	defer tls.Free(28)
 78256  
 78257  	var p uintptr    // New object
 78258  	var pVfs uintptr // New VFS
 78259  	var zVfs uintptr
 78260  	var nByte int32 // Bytes of space to allocate at p
 78261  
 78262  	var i int32
 78263  	// var isNoshm int32 at bp+4, 4
 78264  	// True if -noshm is passed
 78265  	// var isFullshm int32 at bp+24, 4
 78266  	// True if -fullshm is passed
 78267  	// var isDefault int32 at bp+8, 4
 78268  	// True if -default is passed
 78269  	// var szOsFile int32 at bp+12, 4
 78270  	// Value passed to -szosfile
 78271  	// var mxPathname int32 at bp+16, 4
 78272  	// Value passed to -mxpathname
 78273  	// var iVersion int32 at bp+20, 4
 78274  
 78275  	// var nSwitch int32 at bp, 4
 78276  
 78277  	var zSwitch uintptr
 78278  	*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) = 0
 78279  	*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) = 0
 78280  	*(*int32)(unsafe.Pointer(bp + 8 /* isDefault */)) = 0
 78281  	*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */)) = 0
 78282  	*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) = -1
 78283  	*(*int32)(unsafe.Pointer(bp + 20 /* iVersion */)) = 3 // Value passed to -iversion
 78284  
 78285  	if !((objc < 2) || (0 != (objc % 2))) {
 78286  		goto __1
 78287  	}
 78288  	goto bad_args
 78289  __1:
 78290  	;
 78291  	i = 2
 78292  __2:
 78293  	if !(i < objc) {
 78294  		goto __4
 78295  	}
 78296  	zSwitch = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*8)), bp /* &nSwitch */)
 78297  
 78298  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39132 /* "-noshm" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78299  		goto __5
 78300  	}
 78301  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+4 /* &isNoshm */) != 0) {
 78302  		goto __7
 78303  	}
 78304  	return TCL_ERROR
 78305  __7:
 78306  	;
 78307  	if !(*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) != 0) {
 78308  		goto __8
 78309  	}
 78310  	*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) = 0
 78311  __8:
 78312  	;
 78313  	goto __6
 78314  __5:
 78315  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+27059 /* "-default" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78316  		goto __9
 78317  	}
 78318  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+8 /* &isDefault */) != 0) {
 78319  		goto __11
 78320  	}
 78321  	return TCL_ERROR
 78322  __11:
 78323  	;
 78324  	goto __10
 78325  __9:
 78326  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39139 /* "-szosfile" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78327  		goto __12
 78328  	}
 78329  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+12 /* &szOsFile */) != 0) {
 78330  		goto __14
 78331  	}
 78332  	return TCL_ERROR
 78333  __14:
 78334  	;
 78335  	goto __13
 78336  __12:
 78337  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39149 /* "-mxpathname" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78338  		goto __15
 78339  	}
 78340  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+16 /* &mxPathname */) != 0) {
 78341  		goto __17
 78342  	}
 78343  	return TCL_ERROR
 78344  __17:
 78345  	;
 78346  	goto __16
 78347  __15:
 78348  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39161 /* "-iversion" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78349  		goto __18
 78350  	}
 78351  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+20 /* &iVersion */) != 0) {
 78352  		goto __20
 78353  	}
 78354  	return TCL_ERROR
 78355  __20:
 78356  	;
 78357  	goto __19
 78358  __18:
 78359  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39171 /* "-fullshm" */, zSwitch, uint64(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 78360  		goto __21
 78361  	}
 78362  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*8)), bp+24 /* &isFullshm */) != 0) {
 78363  		goto __23
 78364  	}
 78365  	return TCL_ERROR
 78366  __23:
 78367  	;
 78368  	if !(*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) != 0) {
 78369  		goto __24
 78370  	}
 78371  	*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) = 0
 78372  __24:
 78373  	;
 78374  	goto __22
 78375  __21:
 78376  	goto bad_args
 78377  __22:
 78378  	;
 78379  __19:
 78380  	;
 78381  __16:
 78382  	;
 78383  __13:
 78384  	;
 78385  __10:
 78386  	;
 78387  __6:
 78388  	;
 78389  	goto __3
 78390  __3:
 78391  	i = i + (2)
 78392  	goto __2
 78393  	goto __4
 78394  __4:
 78395  	;
 78396  
 78397  	if !(uint64(*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */))) < uint64(unsafe.Sizeof(TestvfsFile{}))) {
 78398  		goto __25
 78399  	}
 78400  	*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */)) = int32(unsafe.Sizeof(TestvfsFile{}))
 78401  __25:
 78402  	;
 78403  
 78404  	zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8)))
 78405  	nByte = (int32((uint64(unsafe.Sizeof(Testvfs{})) + uint64(int32(libc.Xstrlen(tls, zVfs)))) + uint64(1)))
 78406  	p = tcl.XTcl_Alloc(tls, uint32(nByte))
 78407  	libc.Xmemset(tls, p, 0, uint64(nByte))
 78408  	(*Testvfs)(unsafe.Pointer(p)).FiDevchar = -1
 78409  	(*Testvfs)(unsafe.Pointer(p)).FiSectorsize = -1
 78410  
 78411  	// Create the new object command before querying SQLite for a default VFS
 78412  	// to use for 'real' IO operations. This is because creating the new VFS
 78413  	// may delete an existing [testvfs] VFS of the same name. If such a VFS
 78414  	// is currently the default, the new [testvfs] may end up calling the
 78415  	// methods of a deleted object.
 78416  	tcl.XTcl_CreateObjCommand(tls, interp, zVfs, *(*uintptr)(unsafe.Pointer(&struct {
 78417  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78418  	}{testvfs_obj_cmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{testvfs_obj_del})))
 78419  	(*Testvfs)(unsafe.Pointer(p)).FpParent = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 78420  	(*Testvfs)(unsafe.Pointer(p)).Finterp = interp
 78421  
 78422  	(*Testvfs)(unsafe.Pointer(p)).FzName = (p + 1*104)
 78423  	libc.Xmemcpy(tls, (*Testvfs)(unsafe.Pointer(p)).FzName, zVfs, (libc.Xstrlen(tls, zVfs) + uint64(1)))
 78424  
 78425  	pVfs = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(sqlite3_vfs{})))
 78426  	libc.Xmemcpy(tls, pVfs, uintptr(unsafe.Pointer(&tvfs_vfs)), uint64(unsafe.Sizeof(sqlite3_vfs{})))
 78427  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData = p
 78428  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion = *(*int32)(unsafe.Pointer(bp + 20 /* iVersion */))
 78429  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName = (*Testvfs)(unsafe.Pointer(p)).FzName
 78430  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname = (*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname
 78431  	if !((*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) >= 0) && (*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) < (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname)) {
 78432  		goto __26
 78433  	}
 78434  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname = *(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */))
 78435  __26:
 78436  	;
 78437  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile = *(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */))
 78438  	(*Testvfs)(unsafe.Pointer(p)).FpVfs = pVfs
 78439  	(*Testvfs)(unsafe.Pointer(p)).FisNoshm = *(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */))
 78440  	(*Testvfs)(unsafe.Pointer(p)).FisFullshm = *(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */))
 78441  	(*Testvfs)(unsafe.Pointer(p)).Fmask = TESTVFS_ALL_MASK
 78442  
 78443  	sqlite3.Xsqlite3_vfs_register(tls, pVfs, *(*int32)(unsafe.Pointer(bp + 8 /* isDefault */)))
 78444  
 78445  	return TCL_OK
 78446  
 78447  bad_args:
 78448  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39180 /* "VFSNAME ?-noshm ..." */)
 78449  	return TCL_ERROR
 78450  }
 78451  
 78452  var tvfs_vfs = sqlite3_vfs{
 78453  	FiVersion:      3, // pAppData
 78454  	FxOpen:         0, // xOpen
 78455  	FxDelete:       0, // xDelete
 78456  	FxAccess:       0, // xAccess
 78457  	FxFullPathname: 0, // xDlClose
 78458  	FxRandomness:   0, // xRandomness
 78459  	FxSleep:        0, // xSleep
 78460  	FxCurrentTime:  0, // xNextSystemCall
 78461  } /* test_vfs.c:1444:22 */
 78462  
 78463  // tclcmd: vfs_shmlock DB DBNAME (shared|exclusive) (lock|unlock) OFFSET N
 78464  func test_vfs_shmlock(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1586:26: */
 78465  	bp := tls.Alloc(88)
 78466  	defer tls.Free(88)
 78467  
 78468  	*(*[3]uintptr)(unsafe.Pointer(bp + 8 /* azArg1 */)) = [3]uintptr{ts + 39284 /* "shared" */, ts + 14439 /* "exclusive" */, uintptr(0)}
 78469  	*(*[3]uintptr)(unsafe.Pointer(bp + 40 /* azArg2 */)) = [3]uintptr{ts + 39291 /* "lock" */, ts + 39296 /* "unlock" */, uintptr(0)}
 78470  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 78471  	var rc int32 = SQLITE_OK
 78472  	var zDbname uintptr = uintptr(0)
 78473  	*(*int32)(unsafe.Pointer(bp + 32 /* iArg1 */)) = 0
 78474  	*(*int32)(unsafe.Pointer(bp + 64 /* iArg2 */)) = 0
 78475  	*(*int32)(unsafe.Pointer(bp + 68 /* iOffset */)) = 0
 78476  	*(*int32)(unsafe.Pointer(bp + 72 /* n */)) = 0
 78477  	// var pFd uintptr at bp+80, 8
 78478  
 78479  	if objc != 7 {
 78480  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 78481  			ts+39303 /* "DB DBNAME (share..." */)
 78482  		return TCL_ERROR
 78483  	}
 78484  
 78485  	zDbname = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 78486  	if ((((getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) ||
 78487  		(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+8 /* &azArg1[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+39355 /* "ARG" */, 0, bp+32 /* &iArg1 */) != 0)) ||
 78488  		(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+40 /* &azArg2[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+39355 /* "ARG" */, 0, bp+64 /* &iArg2 */) != 0)) ||
 78489  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*8)), bp+68 /* &iOffset */) != 0)) ||
 78490  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 6*8)), bp+72 /* &n */) != 0) {
 78491  		return TCL_ERROR
 78492  	}
 78493  
 78494  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbname, SQLITE_FCNTL_FILE_POINTER, bp+80 /* &pFd */)
 78495  	if *(*uintptr)(unsafe.Pointer(bp + 80 /* pFd */)) == uintptr(0) {
 78496  		return TCL_ERROR
 78497  	}
 78498  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 80 /* pFd */)))).FpMethods + 112 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pFd */)), *(*int32)(unsafe.Pointer(bp + 68 /* iOffset */)), *(*int32)(unsafe.Pointer(bp + 72 /* n */)),
 78499  		((func() int32 {
 78500  			if *(*int32)(unsafe.Pointer(bp + 32 /* iArg1 */)) == 0 {
 78501  				return SQLITE_SHM_SHARED
 78502  			}
 78503  			return SQLITE_SHM_EXCLUSIVE
 78504  		}()) |
 78505  			(func() int32 {
 78506  				if *(*int32)(unsafe.Pointer(bp + 64 /* iArg2 */)) == 0 {
 78507  					return SQLITE_SHM_LOCK
 78508  				}
 78509  				return SQLITE_SHM_UNLOCK
 78510  			}())))
 78511  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 78512  	return TCL_OK
 78513  }
 78514  
 78515  func test_vfs_set_readmark(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1632:26: */
 78516  	bp := tls.Alloc(48)
 78517  	defer tls.Free(48)
 78518  
 78519  	*(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0)
 78520  	var rc int32 = SQLITE_OK
 78521  	var zDbname uintptr = uintptr(0)
 78522  	*(*int32)(unsafe.Pointer(bp + 24 /* iSlot */)) = 0
 78523  	*(*int32)(unsafe.Pointer(bp + 28 /* iVal */)) = -1
 78524  	// var pFd uintptr at bp+32, 8
 78525  
 78526  	*(*uintptr)(unsafe.Pointer(bp + 40 /* pShm */)) = uintptr(0)
 78527  	var aShm uintptr
 78528  	var iOff int32
 78529  
 78530  	if (objc != 4) && (objc != 5) {
 78531  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39359 /* "DB DBNAME SLOT ?..." */)
 78532  		return TCL_ERROR
 78533  	}
 78534  
 78535  	zDbname = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 78536  	if ((getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp+16 /* &db */) != 0) ||
 78537  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*8)), bp+24 /* &iSlot */) != 0)) ||
 78538  		((objc == 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*8)), bp+28 /* &iVal */) != 0)) {
 78539  		return TCL_ERROR
 78540  	}
 78541  
 78542  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDbname, SQLITE_FCNTL_FILE_POINTER, bp+32 /* &pFd */)
 78543  	if *(*uintptr)(unsafe.Pointer(bp + 32 /* pFd */)) == uintptr(0) {
 78544  		return TCL_ERROR
 78545  	}
 78546  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pFd */)))).FpMethods + 104 /* &.xShmMap */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pFd */)), 0, (32 * 1024), 0, bp+40 /* &pShm */)
 78547  	if rc != SQLITE_OK {
 78548  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 78549  		return TCL_ERROR
 78550  	}
 78551  	if libc.AtomicLoadPUintptr(bp+40 /* pShm */) == uintptr(0) {
 78552  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+39382 /* "*-shm is not yet..." */, 0))
 78553  		return TCL_ERROR
 78554  	}
 78555  	aShm = libc.AtomicLoadPUintptr(bp + 40 /* pShm */)
 78556  	iOff = (((12 * 2) + 1) + *(*int32)(unsafe.Pointer(bp + 24 /* iSlot */)))
 78557  
 78558  	if objc == 5 {
 78559  		*(*u32)(unsafe.Pointer(aShm + uintptr(iOff)*4)) = u32(*(*int32)(unsafe.Pointer(bp + 28 /* iVal */)))
 78560  	}
 78561  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(*(*u32)(unsafe.Pointer(aShm + uintptr(iOff)*4)))))
 78562  
 78563  	return TCL_OK
 78564  }
 78565  
 78566  func Sqlitetestvfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_vfs.c:1685:5: */
 78567  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39406 /* "testvfs" */, *(*uintptr)(unsafe.Pointer(&struct {
 78568  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78569  	}{testvfs_cmd})), uintptr(0), uintptr(0))
 78570  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39414 /* "vfs_shmlock" */, *(*uintptr)(unsafe.Pointer(&struct {
 78571  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78572  	}{test_vfs_shmlock})), uintptr(0), uintptr(0))
 78573  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39426 /* "vfs_set_readmark" */, *(*uintptr)(unsafe.Pointer(&struct {
 78574  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78575  	}{test_vfs_set_readmark})), uintptr(0), uintptr(0))
 78576  	return TCL_OK
 78577  }
 78578  
 78579  // 2015 November 30
 78580  //
 78581  // The author disclaims copyright to this source code.  In place of
 78582  // a legal notice, here is a blessing:
 78583  //
 78584  //    May you do good and not evil.
 78585  //    May you find forgiveness for yourself and forgive others.
 78586  //    May you share freely, never taking more than you give.
 78587  //
 78588  //
 78589  // This file contains code to implement most of the opendir() family of
 78590  // POSIX functions on Win32 using the MSVCRT.
 78591  
 78592  type TestWindow1 = struct {
 78593  	FxStep    uintptr
 78594  	FxFinal   uintptr
 78595  	FxValue   uintptr
 78596  	FxInverse uintptr
 78597  	Finterp   uintptr
 78598  } /* test_window.c:24:9 */
 78599  
 78600  type TestWindow = TestWindow1 /* test_window.c:24:27 */
 78601  
 78602  type TestWindowCtx1 = struct{ FpVal uintptr } /* test_window.c:33:9 */
 78603  
 78604  type TestWindowCtx = TestWindowCtx1 /* test_window.c:33:30 */
 78605  
 78606  func doTestWindowStep(tls *libc.TLS, bInverse int32, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:38:13: */
 78607  	var i int32
 78608  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, ctx)
 78609  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, func() uintptr {
 78610  		if bInverse != 0 {
 78611  			return (*TestWindow)(unsafe.Pointer(p)).FxInverse
 78612  		}
 78613  		return (*TestWindow)(unsafe.Pointer(p)).FxStep
 78614  	}())
 78615  	var pCtx uintptr = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(TestWindowCtx{})))
 78616  
 78617  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 78618  	if pCtx != 0 {
 78619  		var zResult uintptr
 78620  		var rc int32
 78621  		if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 78622  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_DuplicateObj(tls, (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal))
 78623  		} else {
 78624  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 78625  		}
 78626  		for i = 0; i < nArg; i++ {
 78627  			var pArg uintptr
 78628  			pArg = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*8))), -1)
 78629  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, pArg)
 78630  		}
 78631  		rc = tcl.XTcl_EvalObjEx(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 78632  		if rc != TCL_OK {
 78633  			zResult = tcl.XTcl_GetStringResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp)
 78634  			sqlite3.Xsqlite3_result_error(tls, ctx, zResult, -1)
 78635  		} else {
 78636  			if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 78637  				for ok := true; ok; ok = 0 != 0 {
 78638  					var _objPtr uintptr = (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal
 78639  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78640  						tcl.XTclFreeObj(tls, _objPtr)
 78641  					}
 78642  				}
 78643  			}
 78644  			(*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal = tcl.XTcl_DuplicateObj(tls, tcl.XTcl_GetObjResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp))
 78645  			(*Tcl_Obj)(unsafe.Pointer((*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal)).FrefCount++
 78646  		}
 78647  	}
 78648  	for ok1 := true; ok1; ok1 = 0 != 0 {
 78649  		var _objPtr uintptr = pEval
 78650  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78651  			tcl.XTclFreeObj(tls, _objPtr)
 78652  		}
 78653  	}
 78654  }
 78655  
 78656  func doTestWindowFinalize(tls *libc.TLS, bValue int32, ctx uintptr) { /* test_window.c:76:13: */
 78657  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, ctx)
 78658  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, func() uintptr {
 78659  		if bValue != 0 {
 78660  			return (*TestWindow)(unsafe.Pointer(p)).FxValue
 78661  		}
 78662  		return (*TestWindow)(unsafe.Pointer(p)).FxFinal
 78663  	}())
 78664  	var pCtx uintptr = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(TestWindowCtx{})))
 78665  
 78666  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 78667  	if pCtx != 0 {
 78668  		var zResult uintptr
 78669  		var rc int32
 78670  		if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 78671  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_DuplicateObj(tls, (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal))
 78672  		} else {
 78673  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 78674  		}
 78675  
 78676  		rc = tcl.XTcl_EvalObjEx(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 78677  		zResult = tcl.XTcl_GetStringResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp)
 78678  		if rc != TCL_OK {
 78679  			sqlite3.Xsqlite3_result_error(tls, ctx, zResult, -1)
 78680  		} else {
 78681  			sqlite3.Xsqlite3_result_text(tls, ctx, zResult, -1, libc.UintptrFromInt32(-1))
 78682  		}
 78683  
 78684  		if bValue == 0 {
 78685  			if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 78686  				for ok := true; ok; ok = 0 != 0 {
 78687  					var _objPtr uintptr = (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal
 78688  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78689  						tcl.XTclFreeObj(tls, _objPtr)
 78690  					}
 78691  				}
 78692  			}
 78693  			(*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal = uintptr(0)
 78694  		}
 78695  	}
 78696  	for ok1 := true; ok1; ok1 = 0 != 0 {
 78697  		var _objPtr uintptr = pEval
 78698  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78699  			tcl.XTclFreeObj(tls, _objPtr)
 78700  		}
 78701  	}
 78702  }
 78703  
 78704  func testWindowStep(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:107:13: */
 78705  	doTestWindowStep(tls, 0, ctx, nArg, apArg)
 78706  }
 78707  
 78708  func testWindowInverse(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:114:13: */
 78709  	doTestWindowStep(tls, 1, ctx, nArg, apArg)
 78710  }
 78711  
 78712  func testWindowFinal(tls *libc.TLS, ctx uintptr) { /* test_window.c:122:13: */
 78713  	doTestWindowFinalize(tls, 0, ctx)
 78714  }
 78715  
 78716  func testWindowValue(tls *libc.TLS, ctx uintptr) { /* test_window.c:125:13: */
 78717  	doTestWindowFinalize(tls, 1, ctx)
 78718  }
 78719  
 78720  func testWindowDestroy(tls *libc.TLS, pCtx uintptr) { /* test_window.c:129:13: */
 78721  	tcl.XTcl_Free(tls, pCtx)
 78722  }
 78723  
 78724  // Usage: sqlite3_create_window_function DB NAME XSTEP XFINAL XVALUE XINVERSE
 78725  func test_create_window(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:136:26: */
 78726  	bp := tls.Alloc(8)
 78727  	defer tls.Free(8)
 78728  
 78729  	var pNew uintptr
 78730  	// var db uintptr at bp, 8
 78731  
 78732  	var zName uintptr
 78733  	var rc int32
 78734  
 78735  	if objc != 7 {
 78736  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39443 /* "DB NAME XSTEP XF..." */)
 78737  		return TCL_ERROR
 78738  	}
 78739  
 78740  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 78741  		return TCL_ERROR
 78742  	}
 78743  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*8)))
 78744  	pNew = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(TestWindow{})))
 78745  	libc.Xmemset(tls, pNew, 0, uint64(unsafe.Sizeof(TestWindow{})))
 78746  	(*TestWindow)(unsafe.Pointer(pNew)).FxStep = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*8)))
 78747  	(*TestWindow)(unsafe.Pointer(pNew)).FxFinal = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 4*8)))
 78748  	(*TestWindow)(unsafe.Pointer(pNew)).FxValue = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 5*8)))
 78749  	(*TestWindow)(unsafe.Pointer(pNew)).FxInverse = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 6*8)))
 78750  	(*TestWindow)(unsafe.Pointer(pNew)).Finterp = interp
 78751  
 78752  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxStep)).FrefCount++
 78753  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxFinal)).FrefCount++
 78754  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxValue)).FrefCount++
 78755  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxInverse)).FrefCount++
 78756  
 78757  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, -1, SQLITE_UTF8, pNew,
 78758  		*(*uintptr)(unsafe.Pointer(&struct {
 78759  			f func(*libc.TLS, uintptr, int32, uintptr)
 78760  		}{testWindowStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), *(*uintptr)(unsafe.Pointer(&struct {
 78761  			f func(*libc.TLS, uintptr, int32, uintptr)
 78762  		}{testWindowInverse})),
 78763  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowDestroy})))
 78764  	if rc != SQLITE_OK {
 78765  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 78766  		return TCL_ERROR
 78767  	}
 78768  
 78769  	return TCL_OK
 78770  }
 78771  
 78772  func test_create_window_misuse(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:179:26: */
 78773  	bp := tls.Alloc(8)
 78774  	defer tls.Free(8)
 78775  
 78776  	// var db uintptr at bp, 8
 78777  
 78778  	var rc int32
 78779  
 78780  	if !(objc != 2) {
 78781  		goto __1
 78782  	}
 78783  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 78784  	return TCL_ERROR
 78785  __1:
 78786  	;
 78787  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0) {
 78788  		goto __2
 78789  	}
 78790  	return TCL_ERROR
 78791  __2:
 78792  	;
 78793  
 78794  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 78795  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), *(*uintptr)(unsafe.Pointer(&struct {
 78796  			f func(*libc.TLS, uintptr, int32, uintptr)
 78797  		}{testWindowInverse})),
 78798  		uintptr(0))
 78799  	if !(rc != SQLITE_MISUSE) {
 78800  		goto __3
 78801  	}
 78802  	goto error
 78803  __3:
 78804  	;
 78805  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 78806  		*(*uintptr)(unsafe.Pointer(&struct {
 78807  			f func(*libc.TLS, uintptr, int32, uintptr)
 78808  		}{testWindowStep})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), *(*uintptr)(unsafe.Pointer(&struct {
 78809  			f func(*libc.TLS, uintptr, int32, uintptr)
 78810  		}{testWindowInverse})),
 78811  		uintptr(0))
 78812  	if !(rc != SQLITE_MISUSE) {
 78813  		goto __4
 78814  	}
 78815  	goto error
 78816  __4:
 78817  	;
 78818  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 78819  		*(*uintptr)(unsafe.Pointer(&struct {
 78820  			f func(*libc.TLS, uintptr, int32, uintptr)
 78821  		}{testWindowStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 78822  			f func(*libc.TLS, uintptr, int32, uintptr)
 78823  		}{testWindowInverse})),
 78824  		uintptr(0))
 78825  	if !(rc != SQLITE_MISUSE) {
 78826  		goto __5
 78827  	}
 78828  	goto error
 78829  __5:
 78830  	;
 78831  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 78832  		*(*uintptr)(unsafe.Pointer(&struct {
 78833  			f func(*libc.TLS, uintptr, int32, uintptr)
 78834  		}{testWindowStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), uintptr(0),
 78835  		uintptr(0))
 78836  	if !(rc != SQLITE_MISUSE) {
 78837  		goto __6
 78838  	}
 78839  	goto error
 78840  __6:
 78841  	;
 78842  
 78843  	return TCL_OK
 78844  
 78845  error:
 78846  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, ts+39484 /* "misuse test erro..." */, -1))
 78847  	return TCL_ERROR
 78848  }
 78849  
 78850  // xStep for sumint().
 78851  func sumintStep(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:225:13: */
 78852  	var pInt uintptr
 78853  
 78854  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_INTEGER {
 78855  		sqlite3.Xsqlite3_result_error(tls, ctx, ts+39502 /* "invalid argument" */, -1)
 78856  		return
 78857  	}
 78858  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(sqlite3_int64(0))))
 78859  	if pInt != 0 {
 78860  		*(*sqlite3_int64)(unsafe.Pointer(pInt)) += (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))))
 78861  	}
 78862  }
 78863  
 78864  // xInverse for sumint().
 78865  func sumintInverse(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:246:13: */
 78866  	var pInt uintptr
 78867  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(sqlite3_int64(0))))
 78868  	*(*sqlite3_int64)(unsafe.Pointer(pInt)) -= (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))))
 78869  }
 78870  
 78871  // xFinal for sumint().
 78872  func sumintFinal(tls *libc.TLS, ctx uintptr) { /* test_window.c:259:13: */
 78873  	var res sqlite3_int64 = int64(0)
 78874  	var pInt uintptr
 78875  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, 0)
 78876  	if pInt != 0 {
 78877  		res = *(*sqlite3_int64)(unsafe.Pointer(pInt))
 78878  	}
 78879  	sqlite3.Xsqlite3_result_int64(tls, ctx, res)
 78880  }
 78881  
 78882  // xValue for sumint().
 78883  func sumintValue(tls *libc.TLS, ctx uintptr) { /* test_window.c:270:13: */
 78884  	var res sqlite3_int64 = int64(0)
 78885  	var pInt uintptr
 78886  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, 0)
 78887  	if pInt != 0 {
 78888  		res = *(*sqlite3_int64)(unsafe.Pointer(pInt))
 78889  	}
 78890  	sqlite3.Xsqlite3_result_int64(tls, ctx, res)
 78891  }
 78892  
 78893  func test_create_sumint(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:278:26: */
 78894  	bp := tls.Alloc(8)
 78895  	defer tls.Free(8)
 78896  
 78897  	// var db uintptr at bp, 8
 78898  
 78899  	var rc int32
 78900  
 78901  	if objc != 2 {
 78902  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 78903  		return TCL_ERROR
 78904  	}
 78905  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 78906  		return TCL_ERROR
 78907  	}
 78908  
 78909  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39519 /* "sumint" */, 1, SQLITE_UTF8, uintptr(0),
 78910  		*(*uintptr)(unsafe.Pointer(&struct {
 78911  			f func(*libc.TLS, uintptr, int32, uintptr)
 78912  		}{sumintStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sumintFinal})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sumintValue})), *(*uintptr)(unsafe.Pointer(&struct {
 78913  			f func(*libc.TLS, uintptr, int32, uintptr)
 78914  		}{sumintInverse})),
 78915  		uintptr(0))
 78916  
 78917  	if rc != SQLITE_OK {
 78918  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 78919  		return TCL_ERROR
 78920  	}
 78921  	return TCL_OK
 78922  }
 78923  
 78924  func test_override_sum(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:305:26: */
 78925  	bp := tls.Alloc(8)
 78926  	defer tls.Free(8)
 78927  
 78928  	// var db uintptr at bp, 8
 78929  
 78930  	var rc int32
 78931  
 78932  	if objc != 2 {
 78933  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 78934  		return TCL_ERROR
 78935  	}
 78936  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*8))), bp /* &db */) != 0 {
 78937  		return TCL_ERROR
 78938  	}
 78939  
 78940  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39526 /* "sum" */, -1, SQLITE_UTF8, uintptr(0),
 78941  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 78942  			f func(*libc.TLS, uintptr, int32, uintptr)
 78943  		}{sumintStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sumintFinal})))
 78944  
 78945  	if rc != SQLITE_OK {
 78946  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 78947  		return TCL_ERROR
 78948  	}
 78949  	return TCL_OK
 78950  }
 78951  
 78952  func Sqlitetest_window_Init(tls *libc.TLS, interp uintptr) int32 { /* test_window.c:331:5: */
 78953  	var i int32
 78954  	for i = 0; uint64(i) < (uint64(unsafe.Sizeof(aObjCmd14)) / uint64(unsafe.Sizeof(struct {
 78955  		FzName      uintptr
 78956  		FxProc      uintptr
 78957  		FclientData int32
 78958  		_           [4]byte
 78959  	}{}))); i++ {
 78960  		var c ClientData = uintptr(intptr_t(aObjCmd14[i].FclientData))
 78961  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd14[i].FzName, aObjCmd14[i].FxProc, c, uintptr(0))
 78962  	}
 78963  	return TCL_OK
 78964  }
 78965  
 78966  var aObjCmd14 = [4]struct {
 78967  	FzName      uintptr
 78968  	FxProc      uintptr
 78969  	FclientData int32
 78970  	_           [4]byte
 78971  }{
 78972  	{FzName: ts + 39530 /* "sqlite3_create_w..." */, FxProc: 0},
 78973  	{FzName: ts + 39561 /* "test_create_wind..." */, FxProc: 0},
 78974  	{FzName: ts + 39596 /* "test_create_sumi..." */, FxProc: 0},
 78975  	{FzName: ts + 39615 /* "test_override_su..." */, FxProc: 0},
 78976  } /* test_window.c:336:5 */
 78977  
 78978  // 2008 September 1
 78979  //
 78980  // The author disclaims copyright to this source code.  In place of
 78981  // a legal notice, here is a blessing:
 78982  //
 78983  //    May you do good and not evil.
 78984  //    May you find forgiveness for yourself and forgive others.
 78985  //    May you share freely, never taking more than you give.
 78986  //
 78987  //
 78988  //
 78989  // The code in this file contains sample implementations of the
 78990  // sqlite3_wsd_init() and sqlite3_wsd_find() functions required if the
 78991  // SQLITE_OMIT_WSD symbol is defined at build time.
 78992  
 78993  func init() {
 78994  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 8 /* .xClose */)) = cfClose                                                          // test6.c:577:3:
 78995  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 16 /* .xRead */)) = cfRead                             // test6.c:578:3:
 78996  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 24 /* .xWrite */)) = cfWrite                           // test6.c:579:3:
 78997  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 32 /* .xTruncate */)) = cfTruncate                                     // test6.c:580:3:
 78998  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 40 /* .xSync */)) = cfSync                                                    // test6.c:581:3:
 78999  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 48 /* .xFileSize */)) = cfFileSize                                          // test6.c:582:3:
 79000  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 56 /* .xLock */)) = cfLock                                                    // test6.c:583:3:
 79001  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 64 /* .xUnlock */)) = cfUnlock                                                // test6.c:584:3:
 79002  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 72 /* .xCheckReservedLock */)) = cfCheckReservedLock                        // test6.c:585:3:
 79003  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 80 /* .xFileControl */)) = cfFileControl                             // test6.c:586:3:
 79004  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 88 /* .xSectorSize */)) = cfSectorSize                                               // test6.c:587:3:
 79005  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 96 /* .xDeviceCharacteristics */)) = cfDeviceCharacteristics                         // test6.c:588:3:
 79006  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 104 /* .xShmMap */)) = cfShmMap                        // test6.c:589:3:
 79007  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 112 /* .xShmLock */)) = cfShmLock                               // test6.c:590:3:
 79008  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 120 /* .xShmBarrier */)) = cfShmBarrier                                                    // test6.c:591:3:
 79009  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 128 /* .xShmUnmap */)) = cfShmUnmap                                           // test6.c:592:3:
 79010  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 8 /* .xCreate */)) = csvtabCreate             // csv.c:874:3:
 79011  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 16 /* .xConnect */)) = csvtabConnect          // csv.c:875:3:
 79012  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 24 /* .xBestIndex */)) = csvtabBestIndex                                        // csv.c:876:3:
 79013  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 32 /* .xDisconnect */)) = csvtabDisconnect                                               // csv.c:877:3:
 79014  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 40 /* .xDestroy */)) = csvtabDisconnect                                                  // csv.c:878:3:
 79015  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 48 /* .xOpen */)) = csvtabOpen                                                  // csv.c:879:3:
 79016  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 56 /* .xClose */)) = csvtabClose                                                         // csv.c:880:3:
 79017  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 64 /* .xFilter */)) = csvtabFilter                       // csv.c:881:3:
 79018  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 72 /* .xNext */)) = csvtabNext                                                           // csv.c:882:3:
 79019  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 80 /* .xEof */)) = csvtabEof                                                             // csv.c:883:3:
 79020  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 88 /* .xColumn */)) = csvtabColumn                                       // csv.c:884:3:
 79021  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 96 /* .xRowid */)) = csvtabRowid                                                // csv.c:885:3:
 79022  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 8 /* .xCreate */)) = csvtabCreate    // csv.c:906:3:
 79023  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 16 /* .xConnect */)) = csvtabConnect // csv.c:907:3:
 79024  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 24 /* .xBestIndex */)) = csvtabBestIndex                               // csv.c:908:3:
 79025  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 32 /* .xDisconnect */)) = csvtabDisconnect                                      // csv.c:909:3:
 79026  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 40 /* .xDestroy */)) = csvtabDisconnect                                         // csv.c:910:3:
 79027  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 48 /* .xOpen */)) = csvtabOpen                                         // csv.c:911:3:
 79028  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 56 /* .xClose */)) = csvtabClose                                                // csv.c:912:3:
 79029  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 64 /* .xFilter */)) = csvtabFilter              // csv.c:913:3:
 79030  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 72 /* .xNext */)) = csvtabNext                                                  // csv.c:914:3:
 79031  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 80 /* .xEof */)) = csvtabEof                                                    // csv.c:915:3:
 79032  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 88 /* .xColumn */)) = csvtabColumn                              // csv.c:916:3:
 79033  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 96 /* .xRowid */)) = csvtabRowid                                       // csv.c:917:3:
 79034  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 104 /* .xUpdate */)) = csvtabUpdate                    // csv.c:918:3:
 79035  	*(*func(*libc.TLS, ClientData, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 16 /* .closeProc */)) = incrblobClose                              // tclsqlite.c:372:3:
 79036  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 24 /* .inputProc */)) = incrblobInput              // tclsqlite.c:373:3:
 79037  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 32 /* .outputProc */)) = incrblobOutput            // tclsqlite.c:374:3:
 79038  	*(*func(*libc.TLS, ClientData, int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 40 /* .seekProc */)) = incrblobSeek                  // tclsqlite.c:375:3:
 79039  	*(*func(*libc.TLS, ClientData, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 64 /* .watchProc */)) = incrblobWatch                                      // tclsqlite.c:378:3:
 79040  	*(*func(*libc.TLS, ClientData, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 72 /* .getHandleProc */)) = incrblobHandle                  // tclsqlite.c:379:3:
 79041  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 8 /* .xProc */)) = f5tCreateTokenizer                             // fts5_tcl.c:1129:42:
 79042  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 32 /* .xProc */)) = f5tTokenizerReturn                               // fts5_tcl.c:1130:42:
 79043  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 56 /* .xProc */)) = f5tTokenize                                      // fts5_tcl.c:1131:42:
 79044  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 80 /* .xProc */)) = f5tCreateFunction                                // fts5_tcl.c:1132:42:
 79045  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 104 /* .xProc */)) = f5tMayBeCorrupt                                 // fts5_tcl.c:1133:42:
 79046  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 128 /* .xProc */)) = f5tTokenHash                                    // fts5_tcl.c:1134:42:
 79047  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 152 /* .xProc */)) = f5tRegisterMatchinfo                            // fts5_tcl.c:1135:42:
 79048  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 176 /* .xProc */)) = f5tRegisterTok                                  // fts5_tcl.c:1136:45:
 79049  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79050  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79051  	}{db_enter})) // test1.c:8289:41:
 79052  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79053  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79054  	}{db_leave})) // test1.c:8290:41:
 79055  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79056  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79057  	}{sqlite3_mprintf_int})) // test1.c:8291:41:
 79058  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79059  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79060  	}{sqlite3_mprintf_int64})) // test1.c:8292:41:
 79061  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79062  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79063  	}{sqlite3_mprintf_long})) // test1.c:8293:41:
 79064  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79065  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79066  	}{sqlite3_mprintf_str})) // test1.c:8294:41:
 79067  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79068  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79069  	}{sqlite3_snprintf_str})) // test1.c:8295:41:
 79070  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79071  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79072  	}{sqlite3_mprintf_stronly})) // test1.c:8296:41:
 79073  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79074  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79075  	}{sqlite3_mprintf_double})) // test1.c:8297:41:
 79076  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79077  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79078  	}{sqlite3_mprintf_scaled})) // test1.c:8298:41:
 79079  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79080  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79081  	}{sqlite3_mprintf_hexdouble})) // test1.c:8299:39:
 79082  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 184 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79083  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79084  	}{test_mprintf_z})) // test1.c:8300:41:
 79085  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 200 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79086  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79087  	}{test_mprintf_n})) // test1.c:8301:41:
 79088  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 216 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79089  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79090  	}{test_snprintf_int})) // test1.c:8302:41:
 79091  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 232 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79092  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79093  	}{test_last_rowid})) // test1.c:8303:41:
 79094  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 248 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79095  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79096  	}{test_exec_printf})) // test1.c:8304:41:
 79097  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 264 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79098  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79099  	}{test_exec_hex})) // test1.c:8305:41:
 79100  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 280 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79101  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79102  	}{test_exec})) // test1.c:8306:41:
 79103  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 296 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79104  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79105  	}{test_exec_nr})) // test1.c:8307:41:
 79106  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 312 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79107  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79108  	}{test_get_table_printf})) // test1.c:8309:41:
 79109  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 328 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79110  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79111  	}{sqlite_test_close})) // test1.c:8311:41:
 79112  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 344 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79113  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79114  	}{sqlite_test_close_v2})) // test1.c:8312:41:
 79115  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 360 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79116  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79117  	}{test_create_function})) // test1.c:8313:41:
 79118  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 376 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79119  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79120  	}{test_create_aggregate})) // test1.c:8314:41:
 79121  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 392 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79122  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79123  	}{test_drop_modules})) // test1.c:8315:41:
 79124  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 408 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79125  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79126  	}{test_register_func})) // test1.c:8316:41:
 79127  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 424 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79128  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79129  	}{sqlite_abort})) // test1.c:8317:41:
 79130  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 440 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79131  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79132  	}{test_bind})) // test1.c:8318:41:
 79133  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 456 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79134  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79135  	}{test_breakpoint})) // test1.c:8319:41:
 79136  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 472 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79137  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79138  	}{test_key})) // test1.c:8320:41:
 79139  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 488 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79140  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79141  	}{test_rekey})) // test1.c:8321:41:
 79142  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 504 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79143  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79144  	}{sqlite_set_magic})) // test1.c:8322:41:
 79145  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 520 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79146  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79147  	}{test_interrupt})) // test1.c:8323:41:
 79148  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 536 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79149  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79150  	}{delete_function})) // test1.c:8324:41:
 79151  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 552 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79152  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79153  	}{delete_collation})) // test1.c:8325:41:
 79154  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 568 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79155  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79156  	}{get_autocommit})) // test1.c:8326:41:
 79157  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 584 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79158  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79159  	}{test_busy_timeout})) // test1.c:8327:41:
 79160  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 600 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79161  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79162  	}{test_printf})) // test1.c:8328:41:
 79163  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 616 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79164  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79165  	}{test_io_trace})) // test1.c:8329:39:
 79166  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 632 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79167  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79168  	}{clang_sanitize_address})) // test1.c:8330:41:
 79169  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79170  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79171  	}{pager_open})) // test2.c:708:34:
 79172  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79173  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79174  	}{pager_close})) // test2.c:709:34:
 79175  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79176  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79177  	}{pager_commit})) // test2.c:710:34:
 79178  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79179  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79180  	}{pager_rollback})) // test2.c:711:34:
 79181  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79182  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79183  	}{pager_stmt_begin})) // test2.c:712:34:
 79184  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79185  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79186  	}{pager_stmt_commit})) // test2.c:713:34:
 79187  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79188  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79189  	}{pager_stmt_rollback})) // test2.c:714:34:
 79190  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79191  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79192  	}{pager_stats})) // test2.c:715:34:
 79193  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79194  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79195  	}{pager_pagecount})) // test2.c:716:34:
 79196  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79197  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79198  	}{page_get})) // test2.c:717:34:
 79199  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79200  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79201  	}{page_lookup})) // test2.c:718:34:
 79202  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 184 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79203  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79204  	}{page_unref})) // test2.c:719:34:
 79205  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 200 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79206  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79207  	}{page_read})) // test2.c:720:34:
 79208  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 216 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79209  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79210  	}{page_write})) // test2.c:721:34:
 79211  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 232 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79212  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79213  	}{page_number})) // test2.c:722:34:
 79214  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 248 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79215  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79216  	}{pager_truncate})) // test2.c:723:34:
 79217  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 264 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79218  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79219  	}{fake_big_file})) // test2.c:725:34:
 79220  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 280 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79221  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79222  	}{testBitvecBuiltinTest})) // test2.c:727:34:
 79223  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 296 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79224  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79225  	}{testPendingByte})) // test2.c:728:45:
 79226  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 312 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79227  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79228  	}{faultInstallCmd})) // test2.c:729:45:
 79229  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79230  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79231  	}{btree_open})) // test3.c:666:36:
 79232  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79233  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79234  	}{btree_close})) // test3.c:667:36:
 79235  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79236  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79237  	}{btree_begin_transaction})) // test3.c:668:36:
 79238  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79239  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79240  	}{btree_pager_stats})) // test3.c:669:36:
 79241  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79242  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79243  	}{btree_cursor})) // test3.c:670:36:
 79244  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79245  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79246  	}{btree_close_cursor})) // test3.c:671:36:
 79247  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79248  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79249  	}{btree_next})) // test3.c:672:36:
 79250  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79251  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79252  	}{btree_eof})) // test3.c:673:36:
 79253  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79254  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79255  	}{btree_payload_size})) // test3.c:674:36:
 79256  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79257  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79258  	}{btree_first})) // test3.c:675:36:
 79259  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79260  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79261  	}{btree_varint_test})) // test3.c:676:36:
 79262  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 184 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79263  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79264  	}{btree_from_db})) // test3.c:677:36:
 79265  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 200 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79266  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79267  	}{btree_ismemdb})) // test3.c:678:36:
 79268  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 216 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79269  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79270  	}{btree_set_cache_size})) // test3.c:679:36:
 79271  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79272  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79273  	}{tcl_thread_create})) // test4.c:701:29:
 79274  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79275  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79276  	}{tcl_thread_wait})) // test4.c:702:29:
 79277  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79278  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79279  	}{tcl_thread_halt})) // test4.c:703:29:
 79280  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79281  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79282  	}{tcl_thread_argc})) // test4.c:704:29:
 79283  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79284  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79285  	}{tcl_thread_argv})) // test4.c:705:29:
 79286  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79287  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79288  	}{tcl_thread_colname})) // test4.c:706:29:
 79289  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79290  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79291  	}{tcl_thread_result})) // test4.c:707:29:
 79292  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79293  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79294  	}{tcl_thread_error})) // test4.c:708:29:
 79295  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79296  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79297  	}{tcl_thread_compile})) // test4.c:709:29:
 79298  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79299  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79300  	}{tcl_thread_step})) // test4.c:710:29:
 79301  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79302  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79303  	}{tcl_thread_finalize})) // test4.c:711:29:
 79304  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 184 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79305  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79306  	}{tcl_thread_swap})) // test4.c:712:29:
 79307  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 200 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79308  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79309  	}{tcl_thread_db_get})) // test4.c:713:29:
 79310  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 216 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79311  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79312  	}{tcl_thread_db_put})) // test4.c:714:29:
 79313  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 232 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79314  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79315  	}{tcl_thread_stmt_get})) // test4.c:715:29:
 79316  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79317  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79318  	}{binarize})) // test5.c:210:34:
 79319  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79320  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79321  	}{test_value_overhead})) // test5.c:211:34:
 79322  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79323  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79324  	}{test_translate})) // test5.c:212:34:
 79325  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79326  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79327  	}{test_translate_selftest})) // test5.c:213:34:
 79328  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79329  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79330  	}{tcl_client_create})) // test7.c:695:29:
 79331  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79332  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79333  	}{tcl_client_wait})) // test7.c:696:29:
 79334  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79335  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79336  	}{tcl_client_halt})) // test7.c:697:29:
 79337  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79338  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79339  	}{tcl_client_argc})) // test7.c:698:29:
 79340  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79341  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79342  	}{tcl_client_argv})) // test7.c:699:29:
 79343  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79344  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79345  	}{tcl_client_colname})) // test7.c:700:29:
 79346  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79347  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79348  	}{tcl_client_result})) // test7.c:701:29:
 79349  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79350  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79351  	}{tcl_client_error})) // test7.c:702:29:
 79352  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79353  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79354  	}{tcl_client_compile})) // test7.c:703:29:
 79355  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79356  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79357  	}{tcl_client_step})) // test7.c:704:29:
 79358  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79359  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79360  	}{tcl_client_reset})) // test7.c:705:29:
 79361  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 184 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79362  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79363  	}{tcl_client_finalize})) // test7.c:706:29:
 79364  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 200 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79365  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79366  	}{tcl_client_swap})) // test7.c:707:29:
 79367  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 8 /* .xProc */)) = test_multiplex_initialize  // test_multiplex.c:1311:39:
 79368  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 24 /* .xProc */)) = test_multiplex_shutdown   // test_multiplex.c:1312:37:
 79369  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 40 /* .xProc */)) = test_multiplex_control // test_multiplex.c:1313:36:
 79370  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 8 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79371  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79372  	}{test_shutdown})) // test_mutex.c:485:34:
 79373  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 24 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79374  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79375  	}{test_initialize})) // test_mutex.c:486:34:
 79376  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 40 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79377  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79378  	}{test_config})) // test_mutex.c:487:34:
 79379  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 56 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79380  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79381  	}{test_enter_static_mutex})) // test_mutex.c:489:34:
 79382  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 72 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79383  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79384  	}{test_leave_static_mutex})) // test_mutex.c:490:34:
 79385  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 88 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79386  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79387  	}{test_enter_db_mutex})) // test_mutex.c:492:34:
 79388  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 104 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79389  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79390  	}{test_leave_db_mutex})) // test_mutex.c:493:34:
 79391  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 120 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79392  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79393  	}{test_alloc_mutex})) // test_mutex.c:495:34:
 79394  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 136 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79395  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79396  	}{test_install_mutex_counters})) // test_mutex.c:496:34:
 79397  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 152 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79398  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79399  	}{test_read_mutex_counters})) // test_mutex.c:497:34:
 79400  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 168 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79401  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 79402  	}{test_clear_mutex_counters})) // test_mutex.c:498:34:
 79403  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 8 /* .xProc */)) = test_quota_initialize                  // test_quota.c:1949:38:
 79404  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 24 /* .xProc */)) = test_quota_shutdown                   // test_quota.c:1950:38:
 79405  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 40 /* .xProc */)) = test_quota_set                        // test_quota.c:1951:38:
 79406  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 56 /* .xProc */)) = test_quota_file                       // test_quota.c:1952:38:
 79407  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 72 /* .xProc */)) = test_quota_dump                       // test_quota.c:1953:38:
 79408  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 88 /* .xProc */)) = test_quota_fopen                      // test_quota.c:1954:38:
 79409  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 104 /* .xProc */)) = test_quota_fread                     // test_quota.c:1955:38:
 79410  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 120 /* .xProc */)) = test_quota_fwrite                    // test_quota.c:1956:38:
 79411  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 136 /* .xProc */)) = test_quota_fclose                    // test_quota.c:1957:38:
 79412  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 152 /* .xProc */)) = test_quota_fflush                    // test_quota.c:1958:38:
 79413  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 168 /* .xProc */)) = test_quota_fseek                     // test_quota.c:1959:38:
 79414  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 184 /* .xProc */)) = test_quota_rewind                    // test_quota.c:1960:38:
 79415  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 200 /* .xProc */)) = test_quota_ftell                     // test_quota.c:1961:38:
 79416  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 216 /* .xProc */)) = test_quota_ftruncate                 // test_quota.c:1962:38:
 79417  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 232 /* .xProc */)) = test_quota_file_size                 // test_quota.c:1963:38:
 79418  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 248 /* .xProc */)) = test_quota_file_truesize             // test_quota.c:1964:38:
 79419  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 264 /* .xProc */)) = test_quota_file_mtime                // test_quota.c:1965:38:
 79420  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 280 /* .xProc */)) = test_quota_remove                    // test_quota.c:1966:38:
 79421  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 296 /* .xProc */)) = test_quota_glob                      // test_quota.c:1967:38:
 79422  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 312 /* .xProc */)) = test_quota_file_available            // test_quota.c:1968:38:
 79423  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 328 /* .xProc */)) = test_quota_ferror                    // test_quota.c:1969:38:
 79424  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 8 /* .pInit */)) = sqlite3_amatch_init                      // test1.c:7586:32:
 79425  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 24 /* .pInit */)) = sqlite3_appendvfs_init                  // test1.c:7587:32:
 79426  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 40 /* .pInit */)) = sqlite3_carray_init                     // test1.c:7588:32:
 79427  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 56 /* .pInit */)) = sqlite3_closure_init                    // test1.c:7589:32:
 79428  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 72 /* .pInit */)) = sqlite3_csv_init                        // test1.c:7590:32:
 79429  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 88 /* .pInit */)) = sqlite3_decimal_init                    // test1.c:7591:32:
 79430  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 104 /* .pInit */)) = sqlite3_eval_init                      // test1.c:7592:32:
 79431  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 120 /* .pInit */)) = sqlite3_explain_init                   // test1.c:7593:32:
 79432  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 136 /* .pInit */)) = sqlite3_fileio_init                    // test1.c:7594:32:
 79433  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 152 /* .pInit */)) = sqlite3_fuzzer_init                    // test1.c:7595:32:
 79434  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 168 /* .pInit */)) = sqlite3_ieee_init                      // test1.c:7596:32:
 79435  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 184 /* .pInit */)) = sqlite3_nextchar_init                  // test1.c:7597:32:
 79436  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 200 /* .pInit */)) = sqlite3_percentile_init                // test1.c:7598:32:
 79437  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 216 /* .pInit */)) = sqlite3_prefixes_init                  // test1.c:7600:32:
 79438  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 232 /* .pInit */)) = sqlite3_regexp_init                    // test1.c:7602:32:
 79439  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 248 /* .pInit */)) = sqlite3_remember_init                  // test1.c:7603:32:
 79440  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 264 /* .pInit */)) = sqlite3_series_init                    // test1.c:7604:32:
 79441  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 280 /* .pInit */)) = sqlite3_spellfix_init                  // test1.c:7605:32:
 79442  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 296 /* .pInit */)) = sqlite3_totype_init                    // test1.c:7606:32:
 79443  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 312 /* .pInit */)) = sqlite3_unionvtab_init                 // test1.c:7607:32:
 79444  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 328 /* .pInit */)) = sqlite3_wholenumber_init               // test1.c:7608:32:
 79445  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 344 /* .pInit */)) = sqlite3_zipfile_init                   // test1.c:7610:32:
 79446  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 16 /* .xFunc */)) = decimalFunc                                          // decimal.c:608:29:
 79447  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 40 /* .xFunc */)) = decimalCmpFunc                                       // decimal.c:609:29:
 79448  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 64 /* .xFunc */)) = decimalAddFunc                                       // decimal.c:610:29:
 79449  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 88 /* .xFunc */)) = decimalSubFunc                                       // decimal.c:611:29:
 79450  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 112 /* .xFunc */)) = decimalMulFunc                                      // decimal.c:612:29:
 79451  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 16 /* .xFunc */)) = ieee754func                                         // ieee754.c:270:36:
 79452  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 40 /* .xFunc */)) = ieee754func                                         // ieee754.c:271:36:
 79453  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 64 /* .xFunc */)) = ieee754func                                         // ieee754.c:272:36:
 79454  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 88 /* .xFunc */)) = ieee754func                                         // ieee754.c:273:36:
 79455  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 112 /* .xFunc */)) = ieee754func_to_blob                                // ieee754.c:274:36:
 79456  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 136 /* .xFunc */)) = ieee754func_from_blob                              // ieee754.c:275:36:
 79457  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 16 /* .xFunc */)) = randStr                                             // test_func.c:675:48:
 79458  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 40 /* .xFunc */)) = test_destructor                                     // test_func.c:676:48:
 79459  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 64 /* .xFunc */)) = test_destructor16                                   // test_func.c:678:48:
 79460  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 88 /* .xFunc */)) = testHexToUtf16be                                    // test_func.c:679:48:
 79461  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 112 /* .xFunc */)) = testHexToUtf16le                                   // test_func.c:680:48:
 79462  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 136 /* .xFunc */)) = testHexToUtf8                                      // test_func.c:682:48:
 79463  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 160 /* .xFunc */)) = test_destructor_count                              // test_func.c:683:48:
 79464  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 184 /* .xFunc */)) = test_auxdata                                       // test_func.c:684:48:
 79465  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 208 /* .xFunc */)) = test_error                                         // test_func.c:685:48:
 79466  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 232 /* .xFunc */)) = test_error                                         // test_func.c:686:48:
 79467  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 256 /* .xFunc */)) = test_eval                                          // test_func.c:687:48:
 79468  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 280 /* .xFunc */)) = test_isolation                                     // test_func.c:688:48:
 79469  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 304 /* .xFunc */)) = counterFunc                                        // test_func.c:689:48:
 79470  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 328 /* .xFunc */)) = real2hex                                           // test_func.c:690:48:
 79471  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 352 /* .xFunc */)) = test_decode                                        // test_func.c:691:48:
 79472  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 376 /* .xFunc */)) = test_extract                                       // test_func.c:692:48:
 79473  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 400 /* .xFunc */)) = test_zeroblob                                      // test_func.c:693:62:
 79474  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 424 /* .xFunc */)) = test_getsubtype                                    // test_func.c:694:48:
 79475  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 448 /* .xFunc */)) = test_setsubtype                                    // test_func.c:695:48:
 79476  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 472 /* .xFunc */)) = test_frombind                                      // test_func.c:696:48:
 79477  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 8 /* .xProc */)) = test_sqlite3rbu                   // test_rbu.c:370:21:
 79478  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 24 /* .xProc */)) = test_sqlite3rbu_vacuum           // test_rbu.c:371:28:
 79479  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 40 /* .xProc */)) = test_sqlite3rbu_create_vfs       // test_rbu.c:372:32:
 79480  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 56 /* .xProc */)) = test_sqlite3rbu_destroy_vfs      // test_rbu.c:373:33:
 79481  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 72 /* .xProc */)) = test_sqlite3rbu_internal_test    // test_rbu.c:374:35:
 79482  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 8 /* .xProc */)) = test_sqlite3_db_config              // test1.c:8337:41:
 79483  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 32 /* .xProc */)) = test_sqlite3_txn_state             // test1.c:8338:41:
 79484  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 56 /* .xProc */)) = test_bad_behavior               // test1.c:8339:41:
 79485  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 64 /* .clientData */)) = uintptr(unsafe.Pointer(&iZero))                                               // test1.c:8339:61:
 79486  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 80 /* .xProc */)) = test_register_dbstat_vtab          // test1.c:8340:41:
 79487  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 104 /* .xProc */)) = get_sqlite_pointer                // test1.c:8341:41:
 79488  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 128 /* .xProc */)) = test_intarray_addr                // test1.c:8342:41:
 79489  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 152 /* .xProc */)) = test_int64array_addr              // test1.c:8343:41:
 79490  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 176 /* .xProc */)) = test_doublearray_addr             // test1.c:8344:41:
 79491  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 200 /* .xProc */)) = test_textarray_addr               // test1.c:8345:41:
 79492  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 224 /* .xProc */)) = test_bind_int                     // test1.c:8346:41:
 79493  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 248 /* .xProc */)) = test_bind_zeroblob                // test1.c:8347:41:
 79494  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 272 /* .xProc */)) = test_bind_zeroblob64              // test1.c:8348:41:
 79495  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 296 /* .xProc */)) = test_bind_int64                   // test1.c:8349:41:
 79496  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 320 /* .xProc */)) = test_bind_double                  // test1.c:8350:41:
 79497  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 344 /* .xProc */)) = test_bind_null                    // test1.c:8351:41:
 79498  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 368 /* .xProc */)) = test_bind_text                    // test1.c:8352:41:
 79499  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 392 /* .xProc */)) = test_bind_text16                  // test1.c:8353:41:
 79500  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 416 /* .xProc */)) = test_bind_blob                    // test1.c:8354:41:
 79501  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 440 /* .xProc */)) = test_carray_bind                  // test1.c:8356:41:
 79502  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 464 /* .xProc */)) = test_bind_parameter_count         // test1.c:8358:41:
 79503  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 488 /* .xProc */)) = test_bind_parameter_name          // test1.c:8359:41:
 79504  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 512 /* .xProc */)) = test_bind_parameter_index         // test1.c:8360:41:
 79505  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 536 /* .xProc */)) = test_clear_bindings               // test1.c:8361:41:
 79506  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 560 /* .xProc */)) = test_sleep                        // test1.c:8362:41:
 79507  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 584 /* .xProc */)) = test_errcode                      // test1.c:8363:41:
 79508  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 608 /* .xProc */)) = test_ex_errcode                   // test1.c:8364:41:
 79509  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 632 /* .xProc */)) = test_errmsg                       // test1.c:8365:41:
 79510  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 656 /* .xProc */)) = test_errmsg16                     // test1.c:8366:41:
 79511  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 680 /* .xProc */)) = test_open                         // test1.c:8367:41:
 79512  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 704 /* .xProc */)) = test_open16                       // test1.c:8368:41:
 79513  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 728 /* .xProc */)) = test_open_v2                      // test1.c:8369:41:
 79514  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 752 /* .xProc */)) = test_complete16                   // test1.c:8370:41:
 79515  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 776 /* .xProc */)) = test_normalize                    // test1.c:8371:41:
 79516  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 800 /* .xProc */)) = test_prepare                      // test1.c:8373:41:
 79517  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 824 /* .xProc */)) = test_prepare16                    // test1.c:8374:41:
 79518  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 848 /* .xProc */)) = test_prepare_v2                   // test1.c:8375:41:
 79519  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 872 /* .xProc */)) = test_prepare_v3                   // test1.c:8376:41:
 79520  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 896 /* .xProc */)) = test_prepare_tkt3134              // test1.c:8377:41:
 79521  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 920 /* .xProc */)) = test_prepare16_v2                 // test1.c:8378:41:
 79522  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 944 /* .xProc */)) = test_finalize                     // test1.c:8379:41:
 79523  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 968 /* .xProc */)) = test_stmt_status                  // test1.c:8380:41:
 79524  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 992 /* .xProc */)) = test_reset                        // test1.c:8381:41:
 79525  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1016 /* .xProc */)) = test_expired                     // test1.c:8382:41:
 79526  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1040 /* .xProc */)) = test_transfer_bind               // test1.c:8383:41:
 79527  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1064 /* .xProc */)) = test_changes                     // test1.c:8384:41:
 79528  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1088 /* .xProc */)) = test_step                        // test1.c:8385:41:
 79529  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1112 /* .xProc */)) = test_sql                         // test1.c:8386:41:
 79530  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1136 /* .xProc */)) = test_ex_sql                      // test1.c:8387:41:
 79531  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1160 /* .xProc */)) = test_next_stmt                   // test1.c:8391:41:
 79532  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1184 /* .xProc */)) = test_stmt_readonly               // test1.c:8392:41:
 79533  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1208 /* .xProc */)) = test_stmt_isexplain              // test1.c:8393:41:
 79534  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1232 /* .xProc */)) = test_stmt_busy                   // test1.c:8394:41:
 79535  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1256 /* .xProc */)) = uses_stmt_journal                // test1.c:8395:41:
 79536  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1280 /* .xProc */)) = test_release_memory              // test1.c:8397:41:
 79537  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1304 /* .xProc */)) = test_db_release_memory           // test1.c:8398:41:
 79538  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1328 /* .xProc */)) = test_db_cacheflush               // test1.c:8399:41:
 79539  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1352 /* .xProc */)) = test_system_errno                // test1.c:8400:41:
 79540  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1376 /* .xProc */)) = test_db_filename                 // test1.c:8401:41:
 79541  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1400 /* .xProc */)) = test_db_readonly                 // test1.c:8402:41:
 79542  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1424 /* .xProc */)) = test_soft_heap_limit             // test1.c:8403:41:
 79543  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1448 /* .xProc */)) = test_soft_heap_limit             // test1.c:8404:41:
 79544  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1472 /* .xProc */)) = test_hard_heap_limit             // test1.c:8405:41:
 79545  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1496 /* .xProc */)) = test_thread_cleanup              // test1.c:8406:41:
 79546  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1520 /* .xProc */)) = test_pager_refcounts             // test1.c:8407:41:
 79547  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1544 /* .xProc */)) = test_load_extension           // test1.c:8409:41:
 79548  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1568 /* .xProc */)) = test_enable_load              // test1.c:8410:41:
 79549  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1592 /* .xProc */)) = test_extended_result_codes    // test1.c:8411:41:
 79550  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1616 /* .xProc */)) = test_limit                    // test1.c:8412:41:
 79551  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1640 /* .xProc */)) = test_dbconfig_maindbname_icecube // test1.c:8413:41:
 79552  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1664 /* .xProc */)) = save_prng_state               // test1.c:8415:41:
 79553  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1688 /* .xProc */)) = restore_prng_state            // test1.c:8416:41:
 79554  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1712 /* .xProc */)) = reset_prng_state              // test1.c:8417:41:
 79555  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1736 /* .xProc */)) = prng_seed                     // test1.c:8418:41:
 79556  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1760 /* .xProc */)) = extra_schema_checks           // test1.c:8419:41:
 79557  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1784 /* .xProc */)) = database_never_corrupt        // test1.c:8420:41:
 79558  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1808 /* .xProc */)) = database_may_be_corrupt       // test1.c:8421:41:
 79559  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1832 /* .xProc */)) = optimization_control             // test1.c:8422:41:
 79560  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1856 /* .xProc */)) = runAsObjProc                     // test1.c:8431:41:
 79561  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1880 /* .xProc */)) = test_column_count                // test1.c:8434:41:
 79562  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1904 /* .xProc */)) = test_data_count                  // test1.c:8435:41:
 79563  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1928 /* .xProc */)) = test_column_type                 // test1.c:8436:41:
 79564  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1952 /* .xProc */)) = test_column_blob                 // test1.c:8437:41:
 79565  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1976 /* .xProc */)) = test_column_double               // test1.c:8438:41:
 79566  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2000 /* .xProc */)) = test_column_int64                // test1.c:8439:41:
 79567  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2024 /* .xProc */)) = test_stmt_utf8                   // test1.c:8440:33:
 79568  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2032 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79569  		f func(*libc.TLS, uintptr, int32) uintptr
 79570  	}{sqlite3.Xsqlite3_column_text})) // test1.c:8440:50:
 79571  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2048 /* .xProc */)) = test_stmt_utf8 // test1.c:8441:33:
 79572  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2056 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79573  		f func(*libc.TLS, uintptr, int32) uintptr
 79574  	}{sqlite3.Xsqlite3_column_name})) // test1.c:8441:50:
 79575  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2072 /* .xProc */)) = test_stmt_int // test1.c:8442:33:
 79576  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2080 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79577  		f func(*libc.TLS, uintptr, int32) int32
 79578  	}{sqlite3.Xsqlite3_column_int})) // test1.c:8442:50:
 79579  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2096 /* .xProc */)) = test_stmt_int // test1.c:8443:33:
 79580  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2104 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79581  		f func(*libc.TLS, uintptr, int32) int32
 79582  	}{sqlite3.Xsqlite3_column_bytes})) // test1.c:8443:50:
 79583  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2120 /* .xProc */)) = test_stmt_utf8 // test1.c:8445:34:
 79584  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2128 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79585  		f func(*libc.TLS, uintptr, int32) uintptr
 79586  	}{sqlite3.Xsqlite3_column_decltype})) // test1.c:8445:49:
 79587  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2144 /* .xProc */)) = test_stmt_utf8 // test1.c:8448:34:
 79588  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2152 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79589  		f func(*libc.TLS, uintptr, int32) uintptr
 79590  	}{sqlite3.Xsqlite3_column_database_name})) // test1.c:8448:49:
 79591  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2168 /* .xProc */)) = test_stmt_utf8 // test1.c:8449:31:
 79592  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2176 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79593  		f func(*libc.TLS, uintptr, int32) uintptr
 79594  	}{sqlite3.Xsqlite3_column_table_name})) // test1.c:8449:46:
 79595  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2192 /* .xProc */)) = test_stmt_utf8 // test1.c:8450:32:
 79596  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2200 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79597  		f func(*libc.TLS, uintptr, int32) uintptr
 79598  	}{sqlite3.Xsqlite3_column_origin_name})) // test1.c:8450:47:
 79599  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2216 /* .xProc */)) = test_stmt_int // test1.c:8454:34:
 79600  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2224 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79601  		f func(*libc.TLS, uintptr, int32) int32
 79602  	}{sqlite3.Xsqlite3_column_bytes16})) // test1.c:8454:49:
 79603  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2240 /* .xProc */)) = test_stmt_utf16 // test1.c:8455:34:
 79604  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2248 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79605  		f func(*libc.TLS, uintptr, int32) uintptr
 79606  	}{sqlite3.Xsqlite3_column_text16})) // test1.c:8455:51:
 79607  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2264 /* .xProc */)) = test_stmt_utf16 // test1.c:8456:34:
 79608  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2272 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79609  		f func(*libc.TLS, uintptr, int32) uintptr
 79610  	}{sqlite3.Xsqlite3_column_name16})) // test1.c:8456:51:
 79611  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2288 /* .xProc */)) = add_alignment_test_collations // test1.c:8457:41:
 79612  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2312 /* .xProc */)) = test_stmt_utf16               // test1.c:8459:36:
 79613  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2320 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79614  		f func(*libc.TLS, uintptr, int32) uintptr
 79615  	}{sqlite3.Xsqlite3_column_decltype16})) // test1.c:8459:52:
 79616  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2336 /* .xProc */)) = test_stmt_utf16 // test1.c:8463:3:
 79617  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2344 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79618  		f func(*libc.TLS, uintptr, int32) uintptr
 79619  	}{sqlite3.Xsqlite3_column_database_name16})) // test1.c:8463:20:
 79620  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2360 /* .xProc */)) = test_stmt_utf16 // test1.c:8464:33:
 79621  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2368 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79622  		f func(*libc.TLS, uintptr, int32) uintptr
 79623  	}{sqlite3.Xsqlite3_column_table_name16})) // test1.c:8464:50:
 79624  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2384 /* .xProc */)) = test_stmt_utf16 // test1.c:8465:34:
 79625  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2392 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79626  		f func(*libc.TLS, uintptr, int32) uintptr
 79627  	}{sqlite3.Xsqlite3_column_origin_name16})) // test1.c:8465:51:
 79628  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2408 /* .xProc */)) = test_create_collation_v2         // test1.c:8468:39:
 79629  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2432 /* .xProc */)) = test_global_recover                 // test1.c:8469:38:
 79630  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2456 /* .xProc */)) = working_64bit_int                // test1.c:8470:38:
 79631  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2480 /* .xProc */)) = vfs_unlink_test                  // test1.c:8471:38:
 79632  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2504 /* .xProc */)) = vfs_initfail_test                // test1.c:8472:38:
 79633  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2528 /* .xProc */)) = vfs_unregister_all               // test1.c:8473:38:
 79634  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2552 /* .xProc */)) = vfs_reregister_all               // test1.c:8474:38:
 79635  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2576 /* .xProc */)) = file_control_test                // test1.c:8475:38:
 79636  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2600 /* .xProc */)) = file_control_lasterrno_test      // test1.c:8476:39:
 79637  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2624 /* .xProc */)) = file_control_lockproxy_test      // test1.c:8477:39:
 79638  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2648 /* .xProc */)) = file_control_chunksize_test      // test1.c:8478:39:
 79639  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2672 /* .xProc */)) = file_control_sizehint_test       // test1.c:8479:39:
 79640  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2696 /* .xProc */)) = file_control_data_version        // test1.c:8480:39:
 79641  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2720 /* .xProc */)) = file_control_persist_wal         // test1.c:8486:39:
 79642  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2744 /* .xProc */)) = file_control_powersafe_overwrite // test1.c:8487:43:
 79643  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2768 /* .xProc */)) = file_control_vfsname             // test1.c:8488:39:
 79644  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2792 /* .xProc */)) = file_control_reservebytes        // test1.c:8489:39:
 79645  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2816 /* .xProc */)) = file_control_tempfilename        // test1.c:8490:39:
 79646  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2840 /* .xProc */)) = file_control_external_reader     // test1.c:8491:42:
 79647  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2864 /* .xProc */)) = vfs_list                         // test1.c:8492:38:
 79648  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2888 /* .xProc */)) = test_create_function_v2          // test1.c:8493:38:
 79649  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2912 /* .xProc */)) = test_collate                        // test1.c:8497:35:
 79650  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2936 /* .xProc */)) = test_collate_needed                 // test1.c:8498:35:
 79651  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2960 /* .xProc */)) = test_function                       // test1.c:8499:35:
 79652  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 2984 /* .xProc */)) = test_utf16bin_collate               // test1.c:8500:40:
 79653  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3008 /* .xProc */)) = test_errstr                         // test1.c:8502:35:
 79654  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3032 /* .xProc */)) = tcl_variable_type                   // test1.c:8503:35:
 79655  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3056 /* .xProc */)) = test_enable_shared               // test1.c:8505:39:
 79656  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3080 /* .xProc */)) = sqlite3BtreeSharedCacheReport       // test1.c:8506:39:
 79657  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3104 /* .xProc */)) = test_libversion_number           // test1.c:8508:37:
 79658  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3128 /* .xProc */)) = test_table_column_metadata       // test1.c:8509:41:
 79659  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3152 /* .xProc */)) = test_blob_reopen                 // test1.c:8511:31:
 79660  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3176 /* .xProc */)) = test_pcache_stats                // test1.c:8513:30:
 79661  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3200 /* .xProc */)) = test_unlock_notify               // test1.c:8515:33:
 79662  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3224 /* .xProc */)) = test_wal_checkpoint              // test1.c:8517:36:
 79663  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3248 /* .xProc */)) = test_wal_checkpoint_v2           // test1.c:8518:36:
 79664  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3272 /* .xProc */)) = test_wal_autocheckpoint          // test1.c:8519:37:
 79665  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3296 /* .xProc */)) = test_sqlite3_log                 // test1.c:8520:36:
 79666  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3320 /* .xProc */)) = test_print_eqp                      // test1.c:8522:36:
 79667  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3344 /* .xProc */)) = test_test_control                   // test1.c:8524:32:
 79668  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3368 /* .xProc */)) = test_getrusage                      // test1.c:8526:21:
 79669  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3392 /* .xProc */)) = tclLoadStaticExtensionCmd           // test1.c:8528:33:
 79670  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3416 /* .xProc */)) = sorter_test_fakeheap                // test1.c:8529:32:
 79671  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3440 /* .xProc */)) = sorter_test_sort4_helper            // test1.c:8530:36:
 79672  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3464 /* .xProc */)) = vfsCurrentTimeInt64                 // test1.c:8544:44:
 79673  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3488 /* .xProc */)) = test_snapshot_get                   // test1.c:8546:32:
 79674  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3512 /* .xProc */)) = test_snapshot_open                  // test1.c:8547:33:
 79675  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3536 /* .xProc */)) = test_snapshot_free                  // test1.c:8548:33:
 79676  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3560 /* .xProc */)) = test_snapshot_cmp                   // test1.c:8549:32:
 79677  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3584 /* .xProc */)) = test_snapshot_recover               // test1.c:8550:36:
 79678  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3608 /* .xProc */)) = test_snapshot_get_blob              // test1.c:8551:37:
 79679  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3632 /* .xProc */)) = test_snapshot_open_blob             // test1.c:8552:38:
 79680  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3656 /* .xProc */)) = test_snapshot_cmp_blob              // test1.c:8553:37:
 79681  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3680 /* .xProc */)) = test_delete_database                // test1.c:8555:35:
 79682  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3704 /* .xProc */)) = test_atomic_batch_write             // test1.c:8556:35:
 79683  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3728 /* .xProc */)) = test_mmap_warm                      // test1.c:8557:35:
 79684  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3752 /* .xProc */)) = test_config_sorterref               // test1.c:8558:36:
 79685  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3776 /* .xProc */)) = test_decode_hexdb                   // test1.c:8559:36:
 79686  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3800 /* .xProc */)) = test_write_db                       // test1.c:8560:36:
 79687  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3824 /* .xProc */)) = test_register_cksumvfs              // test1.c:8561:37:
 79688  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 3848 /* .xProc */)) = test_unregister_cksumvfs            // test1.c:8562:39:
 79689  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd10)) + 8 /* .xProc */)) = test_intarray_create               // test_intarray.c:381:35:
 79690  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd10)) + 32 /* .xProc */)) = test_intarray_bind                // test_intarray.c:382:33:
 79691  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 8 /* .xProc */)) = test_malloc                           // test_malloc.c:1473:38:
 79692  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 32 /* .xProc */)) = test_realloc                         // test_malloc.c:1474:38:
 79693  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 56 /* .xProc */)) = test_free                            // test_malloc.c:1475:38:
 79694  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 80 /* .xProc */)) = test_memset                          // test_malloc.c:1476:38:
 79695  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 104 /* .xProc */)) = test_memget                         // test_malloc.c:1477:38:
 79696  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 128 /* .xProc */)) = test_memory_used                    // test_malloc.c:1478:38:
 79697  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 152 /* .xProc */)) = test_memory_highwater               // test_malloc.c:1479:38:
 79698  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 176 /* .xProc */)) = test_memdebug_backtrace             // test_malloc.c:1480:38:
 79699  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 200 /* .xProc */)) = test_memdebug_dump                  // test_malloc.c:1481:38:
 79700  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 224 /* .xProc */)) = test_memdebug_fail                  // test_malloc.c:1482:38:
 79701  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 248 /* .xProc */)) = test_memdebug_pending               // test_malloc.c:1483:38:
 79702  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 272 /* .xProc */)) = test_memdebug_settitle              // test_malloc.c:1484:38:
 79703  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 296 /* .xProc */)) = test_memdebug_malloc_count          // test_malloc.c:1485:41:
 79704  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 320 /* .xProc */)) = test_memdebug_log                   // test_malloc.c:1486:38:
 79705  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 344 /* .xProc */)) = test_config_pagecache               // test_malloc.c:1487:38:
 79706  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 368 /* .xProc */)) = test_alt_pcache                     // test_malloc.c:1488:38:
 79707  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 392 /* .xProc */)) = test_status                         // test_malloc.c:1489:38:
 79708  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 416 /* .xProc */)) = test_db_status                      // test_malloc.c:1490:38:
 79709  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 440 /* .xProc */)) = test_install_malloc_faultsim        // test_malloc.c:1491:38:
 79710  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 464 /* .xProc */)) = test_config_heap                    // test_malloc.c:1492:38:
 79711  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 488 /* .xProc */)) = test_config_heap_size               // test_malloc.c:1493:38:
 79712  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 512 /* .xProc */)) = test_config_memstatus               // test_malloc.c:1494:38:
 79713  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 536 /* .xProc */)) = test_config_lookaside               // test_malloc.c:1495:38:
 79714  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 560 /* .xProc */)) = test_config_error                   // test_malloc.c:1496:38:
 79715  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 584 /* .xProc */)) = test_config_uri                     // test_malloc.c:1497:38:
 79716  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 608 /* .xProc */)) = test_config_cis                     // test_malloc.c:1498:38:
 79717  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 632 /* .xProc */)) = test_config_pmasz                   // test_malloc.c:1499:38:
 79718  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 656 /* .xProc */)) = test_db_config_lookaside            // test_malloc.c:1500:38:
 79719  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 680 /* .xProc */)) = test_dump_memsys3                   // test_malloc.c:1501:38:
 79720  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 704 /* .xProc */)) = test_dump_memsys3                   // test_malloc.c:1502:38:
 79721  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 728 /* .xProc */)) = test_install_memsys3                // test_malloc.c:1503:38:
 79722  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 752 /* .xProc */)) = test_vfs_oom_test                   // test_malloc.c:1504:41:
 79723  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd12)) + 8 /* .xProc */)) = register_schema_module             // test_schema.c:336:34:
 79724  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd13)) + 8 /* .xProc */)) = register_tclvar_module             // test_tclvar.c:553:36:
 79725  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 8 /* .xProc */)) = test_create_window                    // test_window.c:337:42:
 79726  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 32 /* .xProc */)) = test_create_window_misuse            // test_window.c:338:46:
 79727  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 56 /* .xProc */)) = test_create_sumint                   // test_window.c:339:30:
 79728  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 80 /* .xProc */)) = test_override_sum                    // test_window.c:340:29:
 79729  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd2)) + 8 /* .xProc */)) = register_echo_module                // test8.c:1440:38:
 79730  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd2)) + 32 /* .xProc */)) = declare_vtab                       // test8.c:1441:38:
 79731  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 8 /* .xProc */)) = c_misuse_test                       // test9.c:194:28:
 79732  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 32 /* .xProc */)) = c_realloc_test                     // test9.c:195:28:
 79733  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 56 /* .xProc */)) = c_collation_test                   // test9.c:196:28:
 79734  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd4)) + 8 /* .xProc */)) = register_tcl_module                 // test_bestindex.c:611:33:
 79735  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 8 /* .xProc */)) = test_blob_open                      // test_blob.c:318:40:
 79736  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 24 /* .xProc */)) = test_blob_close                    // test_blob.c:319:40:
 79737  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 40 /* .xProc */)) = test_blob_bytes                    // test_blob.c:320:40:
 79738  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 56 /* .xProc */)) = test_blob_read                     // test_blob.c:321:40:
 79739  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 72 /* .xProc */)) = test_blob_write                    // test_blob.c:322:40:
 79740  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd6)) + 8 /* .xProc */)) = register_fs_module                  // test_fs.c:908:32:
 79741  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 8 /* .xProc */)) = autoinstall_test_funcs                 // test_func.c:938:41:
 79742  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 24 /* .xProc */)) = abuse_create_function                 // test_func.c:939:41:
 79743  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 40 /* .xProc */)) = install_fts3_rank_function            // test_func.c:940:41:
 79744  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 8 /* .xProc */)) = hexio_read                             // test_hexio.c:451:40:
 79745  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 24 /* .xProc */)) = hexio_write                           // test_hexio.c:452:40:
 79746  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 40 /* .xProc */)) = hexio_get_int                         // test_hexio.c:453:40:
 79747  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 56 /* .xProc */)) = hexio_render_int16                    // test_hexio.c:454:40:
 79748  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 72 /* .xProc */)) = hexio_render_int32                    // test_hexio.c:455:40:
 79749  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 88 /* .xProc */)) = utf8_to_utf8                          // test_hexio.c:456:40:
 79750  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 104 /* .xProc */)) = read_fts3varint                      // test_hexio.c:457:40:
 79751  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 120 /* .xProc */)) = make_fts3record                      // test_hexio.c:458:40:
 79752  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 8 /* .xProc */)) = init_wrapper_install                // test_init.c:283:32:
 79753  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 24 /* .xProc */)) = init_wrapper_query                 // test_init.c:284:32:
 79754  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 40 /* .xProc */)) = init_wrapper_uninstall             // test_init.c:285:32:
 79755  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 56 /* .xProc */)) = init_wrapper_clear                 // test_init.c:286:32:
 79756  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 8 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79757  		f func(*libc.TLS, uintptr, int32, int32) int32
 79758  	}{ts_open})) // test_syscall.c:134:27:
 79759  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 40 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{ts_close})) // test_syscall.c:135:27:
 79760  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 72 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79761  		f func(*libc.TLS, uintptr, int32) int32
 79762  	}{ts_access})) // test_syscall.c:136:27:
 79763  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 104 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79764  		f func(*libc.TLS, uintptr, size_t) uintptr
 79765  	}{ts_getcwd})) // test_syscall.c:137:27:
 79766  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 136 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79767  		f func(*libc.TLS, uintptr, uintptr) int32
 79768  	}{ts_stat})) // test_syscall.c:138:27:
 79769  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 168 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79770  		f func(*libc.TLS, int32, uintptr) int32
 79771  	}{ts_fstat})) // test_syscall.c:139:27:
 79772  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 200 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79773  		f func(*libc.TLS, int32, off_t) int32
 79774  	}{ts_ftruncate})) // test_syscall.c:140:27:
 79775  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 232 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79776  		f func(*libc.TLS, int32, int32, uintptr) int32
 79777  	}{ts_fcntl})) // test_syscall.c:141:27:
 79778  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 264 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79779  		f func(*libc.TLS, int32, uintptr, size_t) int32
 79780  	}{ts_read})) // test_syscall.c:142:27:
 79781  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 296 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79782  		f func(*libc.TLS, int32, uintptr, size_t, off_t) int32
 79783  	}{ts_pread})) // test_syscall.c:143:27:
 79784  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 328 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79785  		f func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) int32
 79786  	}{ts_pread64})) // test_syscall.c:144:27:
 79787  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 360 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79788  		f func(*libc.TLS, int32, uintptr, size_t) int32
 79789  	}{ts_write})) // test_syscall.c:145:27:
 79790  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 392 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79791  		f func(*libc.TLS, int32, uintptr, size_t, off_t) int32
 79792  	}{ts_pwrite})) // test_syscall.c:146:27:
 79793  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 424 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79794  		f func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) int32
 79795  	}{ts_pwrite64})) // test_syscall.c:147:27:
 79796  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 456 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79797  		f func(*libc.TLS, int32, mode_t) int32
 79798  	}{ts_fchmod})) // test_syscall.c:148:27:
 79799  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 488 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79800  		f func(*libc.TLS, int32, off_t, off_t) int32
 79801  	}{ts_fallocate})) // test_syscall.c:149:27:
 79802  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 520 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79803  		f func(*libc.TLS, uintptr, size_t, int32, int32, int32, off_t) uintptr
 79804  	}{ts_mmap})) // test_syscall.c:150:27:
 79805  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 552 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 79806  		f func(*libc.TLS, uintptr, size_t, size_t, int32, uintptr) uintptr
 79807  	}{ts_mremap})) // test_syscall.c:151:27:
 79808  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 8 /* .xCreate */)) = amatchConnect             // amatch.c:1456:3:
 79809  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 16 /* .xConnect */)) = amatchConnect           // amatch.c:1457:3:
 79810  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 24 /* .xBestIndex */)) = amatchBestIndex                                         // amatch.c:1458:3:
 79811  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 32 /* .xDisconnect */)) = amatchDisconnect                                                // amatch.c:1459:3:
 79812  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 40 /* .xDestroy */)) = amatchDisconnect                                                   // amatch.c:1460:3:
 79813  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 48 /* .xOpen */)) = amatchOpen                                                   // amatch.c:1461:3:
 79814  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 56 /* .xClose */)) = amatchClose                                                          // amatch.c:1462:3:
 79815  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 64 /* .xFilter */)) = amatchFilter                        // amatch.c:1463:3:
 79816  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 72 /* .xNext */)) = amatchNext                                                            // amatch.c:1464:3:
 79817  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 80 /* .xEof */)) = amatchEof                                                              // amatch.c:1465:3:
 79818  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 88 /* .xColumn */)) = amatchColumn                                        // amatch.c:1466:3:
 79819  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 96 /* .xRowid */)) = amatchRowid                                                 // amatch.c:1467:3:
 79820  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 104 /* .xUpdate */)) = amatchUpdate                              // amatch.c:1468:3:
 79821  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 8 /* .xClose */)) = apndClose                                                          // appendvfs.c:204:3:
 79822  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 16 /* .xRead */)) = apndRead                            // appendvfs.c:205:3:
 79823  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 24 /* .xWrite */)) = apndWrite                          // appendvfs.c:206:3:
 79824  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 32 /* .xTruncate */)) = apndTruncate                                    // appendvfs.c:207:3:
 79825  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 40 /* .xSync */)) = apndSync                                                    // appendvfs.c:208:3:
 79826  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 48 /* .xFileSize */)) = apndFileSize                                          // appendvfs.c:209:3:
 79827  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 56 /* .xLock */)) = apndLock                                                    // appendvfs.c:210:3:
 79828  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 64 /* .xUnlock */)) = apndUnlock                                                // appendvfs.c:211:3:
 79829  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 72 /* .xCheckReservedLock */)) = apndCheckReservedLock                        // appendvfs.c:212:3:
 79830  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 80 /* .xFileControl */)) = apndFileControl                             // appendvfs.c:213:3:
 79831  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 88 /* .xSectorSize */)) = apndSectorSize                                               // appendvfs.c:214:3:
 79832  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 96 /* .xDeviceCharacteristics */)) = apndDeviceCharacteristics                         // appendvfs.c:215:3:
 79833  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 104 /* .xShmMap */)) = apndShmMap                        // appendvfs.c:216:3:
 79834  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 112 /* .xShmLock */)) = apndShmLock                               // appendvfs.c:217:3:
 79835  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 120 /* .xShmBarrier */)) = apndShmBarrier                                                    // appendvfs.c:218:3:
 79836  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 128 /* .xShmUnmap */)) = apndShmUnmap                                           // appendvfs.c:219:3:
 79837  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 136 /* .xFetch */)) = apndFetch                         // appendvfs.c:220:3:
 79838  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 144 /* .xUnfetch */)) = apndUnfetch                            // appendvfs.c:221:3:
 79839  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 40 /* .xOpen */)) = apndOpen                                // appendvfs.c:184:3:
 79840  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 48 /* .xDelete */)) = apndDelete                                              // appendvfs.c:185:3:
 79841  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 56 /* .xAccess */)) = apndAccess                                     // appendvfs.c:186:3:
 79842  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 64 /* .xFullPathname */)) = apndFullPathname                         // appendvfs.c:187:3:
 79843  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 72 /* .xDlOpen */)) = apndDlOpen                                                   // appendvfs.c:188:3:
 79844  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 80 /* .xDlError */)) = apndDlError                                                  // appendvfs.c:189:3:
 79845  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 88 /* .xDlSym */)) = apndDlSym                                            // appendvfs.c:190:3:
 79846  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 96 /* .xDlClose */)) = apndDlClose                                                         // appendvfs.c:191:3:
 79847  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 104 /* .xRandomness */)) = apndRandomness                                     // appendvfs.c:192:3:
 79848  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 112 /* .xSleep */)) = apndSleep                                                        // appendvfs.c:193:3:
 79849  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 120 /* .xCurrentTime */)) = apndCurrentTime                                          // appendvfs.c:194:3:
 79850  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 128 /* .xGetLastError */)) = apndGetLastError                                 // appendvfs.c:195:3:
 79851  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 136 /* .xCurrentTimeInt64 */)) = apndCurrentTimeInt64                                // appendvfs.c:196:3:
 79852  	*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 144 /* .xSetSystemCall */)) = apndSetSystemCall                 // appendvfs.c:197:3:
 79853  	*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 152 /* .xGetSystemCall */)) = apndGetSystemCall                        // appendvfs.c:198:3:
 79854  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 160 /* .xNextSystemCall */)) = apndNextSystemCall                                  // appendvfs.c:199:3:
 79855  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 16 /* .xConnect */)) = carrayConnect           // carray.c:368:3:
 79856  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 24 /* .xBestIndex */)) = carrayBestIndex                                         // carray.c:369:3:
 79857  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 32 /* .xDisconnect */)) = carrayDisconnect                                                // carray.c:370:3:
 79858  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 48 /* .xOpen */)) = carrayOpen                                                   // carray.c:372:3:
 79859  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 56 /* .xClose */)) = carrayClose                                                          // carray.c:373:3:
 79860  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 64 /* .xFilter */)) = carrayFilter                        // carray.c:374:3:
 79861  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 72 /* .xNext */)) = carrayNext                                                            // carray.c:375:3:
 79862  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 80 /* .xEof */)) = carrayEof                                                              // carray.c:376:3:
 79863  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 88 /* .xColumn */)) = carrayColumn                                        // carray.c:377:3:
 79864  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 96 /* .xRowid */)) = carrayRowid                                                 // carray.c:378:3:
 79865  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 8 /* .xClose */)) = cksmClose                                                          // cksumvfs.c:274:3:
 79866  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 16 /* .xRead */)) = cksmRead                            // cksumvfs.c:275:3:
 79867  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 24 /* .xWrite */)) = cksmWrite                          // cksumvfs.c:276:3:
 79868  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 32 /* .xTruncate */)) = cksmTruncate                                    // cksumvfs.c:277:3:
 79869  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 40 /* .xSync */)) = cksmSync                                                    // cksumvfs.c:278:3:
 79870  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 48 /* .xFileSize */)) = cksmFileSize                                          // cksumvfs.c:279:3:
 79871  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 56 /* .xLock */)) = cksmLock                                                    // cksumvfs.c:280:3:
 79872  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 64 /* .xUnlock */)) = cksmUnlock                                                // cksumvfs.c:281:3:
 79873  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 72 /* .xCheckReservedLock */)) = cksmCheckReservedLock                        // cksumvfs.c:282:3:
 79874  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 80 /* .xFileControl */)) = cksmFileControl                             // cksumvfs.c:283:3:
 79875  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 88 /* .xSectorSize */)) = cksmSectorSize                                               // cksumvfs.c:284:3:
 79876  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 96 /* .xDeviceCharacteristics */)) = cksmDeviceCharacteristics                         // cksumvfs.c:285:3:
 79877  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 104 /* .xShmMap */)) = cksmShmMap                        // cksumvfs.c:286:3:
 79878  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 112 /* .xShmLock */)) = cksmShmLock                               // cksumvfs.c:287:3:
 79879  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 120 /* .xShmBarrier */)) = cksmShmBarrier                                                    // cksumvfs.c:288:3:
 79880  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 128 /* .xShmUnmap */)) = cksmShmUnmap                                           // cksumvfs.c:289:3:
 79881  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 136 /* .xFetch */)) = cksmFetch                         // cksumvfs.c:290:3:
 79882  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 144 /* .xUnfetch */)) = cksmUnfetch                            // cksumvfs.c:291:3:
 79883  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 40 /* .xOpen */)) = cksmOpen                                // cksumvfs.c:254:3:
 79884  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 48 /* .xDelete */)) = cksmDelete                                              // cksumvfs.c:255:3:
 79885  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 56 /* .xAccess */)) = cksmAccess                                     // cksumvfs.c:256:3:
 79886  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 64 /* .xFullPathname */)) = cksmFullPathname                         // cksumvfs.c:257:3:
 79887  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 72 /* .xDlOpen */)) = cksmDlOpen                                                   // cksumvfs.c:258:3:
 79888  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 80 /* .xDlError */)) = cksmDlError                                                  // cksumvfs.c:259:3:
 79889  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 88 /* .xDlSym */)) = cksmDlSym                                            // cksumvfs.c:260:3:
 79890  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 96 /* .xDlClose */)) = cksmDlClose                                                         // cksumvfs.c:261:3:
 79891  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 104 /* .xRandomness */)) = cksmRandomness                                     // cksumvfs.c:262:3:
 79892  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 112 /* .xSleep */)) = cksmSleep                                                        // cksumvfs.c:263:3:
 79893  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 120 /* .xCurrentTime */)) = cksmCurrentTime                                          // cksumvfs.c:264:3:
 79894  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 128 /* .xGetLastError */)) = cksmGetLastError                                 // cksumvfs.c:265:3:
 79895  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 136 /* .xCurrentTimeInt64 */)) = cksmCurrentTimeInt64                                // cksumvfs.c:266:3:
 79896  	*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 144 /* .xSetSystemCall */)) = cksmSetSystemCall                 // cksumvfs.c:267:3:
 79897  	*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 152 /* .xGetSystemCall */)) = cksmGetSystemCall                        // cksumvfs.c:268:3:
 79898  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 160 /* .xNextSystemCall */)) = cksmNextSystemCall                                  // cksumvfs.c:269:3:
 79899  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 8 /* .xCreate */)) = closureConnect           // closure.c:920:3:
 79900  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 16 /* .xConnect */)) = closureConnect         // closure.c:921:3:
 79901  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 24 /* .xBestIndex */)) = closureBestIndex                                       // closure.c:922:3:
 79902  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 32 /* .xDisconnect */)) = closureDisconnect                                              // closure.c:923:3:
 79903  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 40 /* .xDestroy */)) = closureDisconnect                                                 // closure.c:924:3:
 79904  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 48 /* .xOpen */)) = closureOpen                                                 // closure.c:925:3:
 79905  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 56 /* .xClose */)) = closureClose                                                        // closure.c:926:3:
 79906  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 64 /* .xFilter */)) = closureFilter                      // closure.c:927:3:
 79907  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 72 /* .xNext */)) = closureNext                                                          // closure.c:928:3:
 79908  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 80 /* .xEof */)) = closureEof                                                            // closure.c:929:3:
 79909  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 88 /* .xColumn */)) = closureColumn                                      // closure.c:930:3:
 79910  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 96 /* .xRowid */)) = closureRowid                                               // closure.c:931:3:
 79911  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 40 /* .xOpen */)) = cfOpen                                  // test6.c:857:5:
 79912  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 48 /* .xDelete */)) = cfDelete                                                // test6.c:858:5:
 79913  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 56 /* .xAccess */)) = cfAccess                                       // test6.c:859:5:
 79914  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 64 /* .xFullPathname */)) = cfFullPathname                           // test6.c:860:5:
 79915  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 72 /* .xDlOpen */)) = cfDlOpen                                                     // test6.c:861:5:
 79916  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 80 /* .xDlError */)) = cfDlError                                                    // test6.c:862:5:
 79917  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 88 /* .xDlSym */)) = cfDlSym                                              // test6.c:863:5:
 79918  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 96 /* .xDlClose */)) = cfDlClose                                                           // test6.c:864:5:
 79919  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 104 /* .xRandomness */)) = cfRandomness                                       // test6.c:865:5:
 79920  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 112 /* .xSleep */)) = cfSleep                                                          // test6.c:866:5:
 79921  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 120 /* .xCurrentTime */)) = cfCurrentTime                                            // test6.c:867:5:
 79922  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 128 /* .xGetLastError */)) = cfGetLastError                                   // test6.c:868:5:
 79923  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 8 /* .xClose */)) = devsymClose                                                      // test_devsym.c:229:3:
 79924  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 16 /* .xRead */)) = devsymRead                         // test_devsym.c:230:3:
 79925  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 24 /* .xWrite */)) = devsymWrite                       // test_devsym.c:231:3:
 79926  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 32 /* .xTruncate */)) = devsymTruncate                                 // test_devsym.c:232:3:
 79927  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 40 /* .xSync */)) = devsymSync                                                // test_devsym.c:233:3:
 79928  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 48 /* .xFileSize */)) = devsymFileSize                                      // test_devsym.c:234:3:
 79929  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 56 /* .xLock */)) = devsymLock                                                // test_devsym.c:235:3:
 79930  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 64 /* .xUnlock */)) = devsymUnlock                                            // test_devsym.c:236:3:
 79931  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 72 /* .xCheckReservedLock */)) = devsymCheckReservedLock                    // test_devsym.c:237:3:
 79932  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 80 /* .xFileControl */)) = devsymFileControl                         // test_devsym.c:238:3:
 79933  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 88 /* .xSectorSize */)) = devsymSectorSize                                           // test_devsym.c:239:3:
 79934  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 96 /* .xDeviceCharacteristics */)) = devsymDeviceCharacteristics                     // test_devsym.c:240:3:
 79935  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 104 /* .xShmMap */)) = devsymShmMap                    // test_devsym.c:241:3:
 79936  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 112 /* .xShmLock */)) = devsymShmLock                           // test_devsym.c:242:3:
 79937  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 120 /* .xShmBarrier */)) = devsymShmBarrier                                                // test_devsym.c:243:3:
 79938  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 128 /* .xShmUnmap */)) = devsymShmUnmap                                       // test_devsym.c:244:3:
 79939  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 40 /* .xOpen */)) = devsymOpen                            // test_devsym.c:428:3:
 79940  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 48 /* .xDelete */)) = devsymDelete                                          // test_devsym.c:429:3:
 79941  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 56 /* .xAccess */)) = devsymAccess                                 // test_devsym.c:430:3:
 79942  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 64 /* .xFullPathname */)) = devsymFullPathname                     // test_devsym.c:431:3:
 79943  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 104 /* .xRandomness */)) = devsymRandomness                                 // test_devsym.c:443:3:
 79944  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 112 /* .xSleep */)) = devsymSleep                                                    // test_devsym.c:444:3:
 79945  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 120 /* .xCurrentTime */)) = devsymCurrentTime                                      // test_devsym.c:445:3:
 79946  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 8 /* .xCreate */)) = echoCreate                  // test8.c:1302:3:
 79947  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 16 /* .xConnect */)) = echoConnect               // test8.c:1303:3:
 79948  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 24 /* .xBestIndex */)) = echoBestIndex                                             // test8.c:1304:3:
 79949  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 32 /* .xDisconnect */)) = echoDisconnect                                                    // test8.c:1305:3:
 79950  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 40 /* .xDestroy */)) = echoDestroy                                                          // test8.c:1306:3:
 79951  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 48 /* .xOpen */)) = echoOpen                                                       // test8.c:1307:3:
 79952  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 56 /* .xClose */)) = echoClose                                                              // test8.c:1308:3:
 79953  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 64 /* .xFilter */)) = echoFilter                            // test8.c:1309:3:
 79954  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 72 /* .xNext */)) = echoNext                                                                // test8.c:1310:3:
 79955  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 80 /* .xEof */)) = echoEof                                                                  // test8.c:1311:3:
 79956  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 88 /* .xColumn */)) = echoColumn                                            // test8.c:1312:3:
 79957  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 96 /* .xRowid */)) = echoRowid                                                     // test8.c:1313:3:
 79958  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 104 /* .xUpdate */)) = echoUpdate                                  // test8.c:1314:3:
 79959  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 112 /* .xBegin */)) = echoBegin                                                             // test8.c:1315:3:
 79960  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 120 /* .xSync */)) = echoSync                                                               // test8.c:1316:3:
 79961  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 128 /* .xCommit */)) = echoCommit                                                           // test8.c:1317:3:
 79962  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 136 /* .xRollback */)) = echoRollback                                                       // test8.c:1318:3:
 79963  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 144 /* .xFindFunction */)) = echoFindFunction             // test8.c:1319:3:
 79964  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 152 /* .xRename */)) = echoRename                                                  // test8.c:1320:3:
 79965  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 8 /* .xCreate */)) = echoCreate                // test8.c:1325:3:
 79966  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 16 /* .xConnect */)) = echoConnect             // test8.c:1326:3:
 79967  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 24 /* .xBestIndex */)) = echoBestIndex                                           // test8.c:1327:3:
 79968  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 32 /* .xDisconnect */)) = echoDisconnect                                                  // test8.c:1328:3:
 79969  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 40 /* .xDestroy */)) = echoDestroy                                                        // test8.c:1329:3:
 79970  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 48 /* .xOpen */)) = echoOpen                                                     // test8.c:1330:3:
 79971  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 56 /* .xClose */)) = echoClose                                                            // test8.c:1331:3:
 79972  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 64 /* .xFilter */)) = echoFilter                          // test8.c:1332:3:
 79973  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 72 /* .xNext */)) = echoNext                                                              // test8.c:1333:3:
 79974  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 80 /* .xEof */)) = echoEof                                                                // test8.c:1334:3:
 79975  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 88 /* .xColumn */)) = echoColumn                                          // test8.c:1335:3:
 79976  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 96 /* .xRowid */)) = echoRowid                                                   // test8.c:1336:3:
 79977  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 104 /* .xUpdate */)) = echoUpdate                                // test8.c:1337:3:
 79978  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 112 /* .xBegin */)) = echoBegin                                                           // test8.c:1338:3:
 79979  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 120 /* .xSync */)) = echoSync                                                             // test8.c:1339:3:
 79980  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 128 /* .xCommit */)) = echoCommit                                                         // test8.c:1340:3:
 79981  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 136 /* .xRollback */)) = echoRollback                                                     // test8.c:1341:3:
 79982  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 144 /* .xFindFunction */)) = echoFindFunction           // test8.c:1342:3:
 79983  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 152 /* .xRename */)) = echoRename                                                // test8.c:1343:3:
 79984  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 160 /* .xSavepoint */)) = echoSavepoint                                            // test8.c:1344:3:
 79985  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 168 /* .xRelease */)) = echoRelease                                                // test8.c:1345:3:
 79986  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 176 /* .xRollbackTo */)) = echoRollbackTo                                          // test8.c:1346:3:
 79987  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 8 /* .xCreate */)) = expertConnect             // sqlite3expert.c:625:5:
 79988  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 16 /* .xConnect */)) = expertConnect           // sqlite3expert.c:626:5:
 79989  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 24 /* .xBestIndex */)) = expertBestIndex                                         // sqlite3expert.c:627:5:
 79990  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 32 /* .xDisconnect */)) = expertDisconnect                                                // sqlite3expert.c:628:5:
 79991  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 40 /* .xDestroy */)) = expertDisconnect                                                   // sqlite3expert.c:629:5:
 79992  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 48 /* .xOpen */)) = expertOpen                                                   // sqlite3expert.c:630:5:
 79993  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 56 /* .xClose */)) = expertClose                                                          // sqlite3expert.c:631:5:
 79994  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 64 /* .xFilter */)) = expertFilter                        // sqlite3expert.c:632:5:
 79995  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 72 /* .xNext */)) = expertNext                                                            // sqlite3expert.c:633:5:
 79996  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 80 /* .xEof */)) = expertEof                                                              // sqlite3expert.c:634:5:
 79997  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 88 /* .xColumn */)) = expertColumn                                        // sqlite3expert.c:635:5:
 79998  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 96 /* .xRowid */)) = expertRowid                                                 // sqlite3expert.c:636:5:
 79999  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 104 /* .xUpdate */)) = expertUpdate                              // sqlite3expert.c:637:5:
 80000  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 16 /* .xConnect */)) = explainConnect         // explain.c:274:3:
 80001  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 24 /* .xBestIndex */)) = explainBestIndex                                       // explain.c:275:3:
 80002  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 32 /* .xDisconnect */)) = explainDisconnect                                              // explain.c:276:3:
 80003  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 48 /* .xOpen */)) = explainOpen                                                 // explain.c:278:3:
 80004  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 56 /* .xClose */)) = explainClose                                                        // explain.c:279:3:
 80005  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 64 /* .xFilter */)) = explainFilter                      // explain.c:280:3:
 80006  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 72 /* .xNext */)) = explainNext                                                          // explain.c:281:3:
 80007  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 80 /* .xEof */)) = explainEof                                                            // explain.c:282:3:
 80008  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 88 /* .xColumn */)) = explainColumn                                      // explain.c:283:3:
 80009  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 96 /* .xRowid */)) = explainRowid                                               // explain.c:284:3:
 80010  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 8 /* .xCreate */)) = fsConnect                     // test_fs.c:800:3:
 80011  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 16 /* .xConnect */)) = fsConnect                   // test_fs.c:801:3:
 80012  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 24 /* .xBestIndex */)) = fsBestIndex                                                 // test_fs.c:802:3:
 80013  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 32 /* .xDisconnect */)) = fsDisconnect                                                        // test_fs.c:803:3:
 80014  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 40 /* .xDestroy */)) = fsDisconnect                                                           // test_fs.c:804:3:
 80015  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 48 /* .xOpen */)) = fsOpen                                                           // test_fs.c:805:3:
 80016  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 56 /* .xClose */)) = fsClose                                                                  // test_fs.c:806:3:
 80017  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 64 /* .xFilter */)) = fsFilter                                // test_fs.c:807:3:
 80018  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 72 /* .xNext */)) = fsNext                                                                    // test_fs.c:808:3:
 80019  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 80 /* .xEof */)) = fsEof                                                                      // test_fs.c:809:3:
 80020  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 88 /* .xColumn */)) = fsColumn                                                // test_fs.c:810:3:
 80021  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 96 /* .xRowid */)) = fsRowid                                                         // test_fs.c:811:3:
 80022  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 8 /* .xClose */)) = fsClose1                                                             // test_onefile.c:210:3:
 80023  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 16 /* .xRead */)) = fsRead                                // test_onefile.c:211:3:
 80024  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 24 /* .xWrite */)) = fsWrite                              // test_onefile.c:212:3:
 80025  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 32 /* .xTruncate */)) = fsTruncate                                        // test_onefile.c:213:3:
 80026  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 40 /* .xSync */)) = fsSync                                                        // test_onefile.c:214:3:
 80027  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 48 /* .xFileSize */)) = fsFileSize                                              // test_onefile.c:215:3:
 80028  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 56 /* .xLock */)) = fsLock                                                        // test_onefile.c:216:3:
 80029  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 64 /* .xUnlock */)) = fsUnlock                                                    // test_onefile.c:217:3:
 80030  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 72 /* .xCheckReservedLock */)) = fsCheckReservedLock                            // test_onefile.c:218:3:
 80031  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 80 /* .xFileControl */)) = fsFileControl                                 // test_onefile.c:219:3:
 80032  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 88 /* .xSectorSize */)) = fsSectorSize                                                   // test_onefile.c:220:3:
 80033  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 96 /* .xDeviceCharacteristics */)) = fsDeviceCharacteristics                             // test_onefile.c:221:3:
 80034  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 40 /* .xOpen */)) = fsOpen1                                   // test_onefile.c:191:5:
 80035  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 48 /* .xDelete */)) = fsDelete                                                  // test_onefile.c:192:5:
 80036  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 56 /* .xAccess */)) = fsAccess                                         // test_onefile.c:193:5:
 80037  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 64 /* .xFullPathname */)) = fsFullPathname                             // test_onefile.c:194:5:
 80038  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 72 /* .xDlOpen */)) = fsDlOpen                                                       // test_onefile.c:195:5:
 80039  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 80 /* .xDlError */)) = fsDlError                                                      // test_onefile.c:196:5:
 80040  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 88 /* .xDlSym */)) = fsDlSym                                                // test_onefile.c:197:5:
 80041  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 96 /* .xDlClose */)) = fsDlClose                                                             // test_onefile.c:198:5:
 80042  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 104 /* .xRandomness */)) = fsRandomness                                         // test_onefile.c:199:5:
 80043  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 112 /* .xSleep */)) = fsSleep                                                            // test_onefile.c:200:5:
 80044  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 120 /* .xCurrentTime */)) = fsCurrentTime                                              // test_onefile.c:201:5:
 80045  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 8 /* .xCreate */)) = fsdirConnect1              // test_fs.c:823:3:
 80046  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 16 /* .xConnect */)) = fsdirConnect1            // test_fs.c:824:3:
 80047  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 24 /* .xBestIndex */)) = fsdirBestIndex1                                          // test_fs.c:825:3:
 80048  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 32 /* .xDisconnect */)) = fsdirDisconnect1                                                 // test_fs.c:826:3:
 80049  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 40 /* .xDestroy */)) = fsdirDisconnect1                                                    // test_fs.c:827:3:
 80050  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 48 /* .xOpen */)) = fsdirOpen1                                                    // test_fs.c:828:3:
 80051  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 56 /* .xClose */)) = fsdirClose1                                                           // test_fs.c:829:3:
 80052  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 64 /* .xFilter */)) = fsdirFilter1                         // test_fs.c:830:3:
 80053  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 72 /* .xNext */)) = fsdirNext1                                                             // test_fs.c:831:3:
 80054  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 80 /* .xEof */)) = fsdirEof1                                                               // test_fs.c:832:3:
 80055  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 88 /* .xColumn */)) = fsdirColumn1                                         // test_fs.c:833:3:
 80056  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 96 /* .xRowid */)) = fsdirRowid1                                                  // test_fs.c:834:3:
 80057  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 16 /* .xConnect */)) = fsdirConnect            // fileio.c:942:5:
 80058  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 24 /* .xBestIndex */)) = fsdirBestIndex                                          // fileio.c:943:5:
 80059  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 32 /* .xDisconnect */)) = fsdirDisconnect                                                 // fileio.c:944:5:
 80060  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 48 /* .xOpen */)) = fsdirOpen                                                    // fileio.c:946:5:
 80061  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 56 /* .xClose */)) = fsdirClose                                                           // fileio.c:947:5:
 80062  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 64 /* .xFilter */)) = fsdirFilter                         // fileio.c:948:5:
 80063  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 72 /* .xNext */)) = fsdirNext                                                             // fileio.c:949:5:
 80064  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 80 /* .xEof */)) = fsdirEof                                                               // fileio.c:950:5:
 80065  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 88 /* .xColumn */)) = fsdirColumn                                         // fileio.c:951:5:
 80066  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 96 /* .xRowid */)) = fsdirRowid                                                  // fileio.c:952:5:
 80067  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 8 /* .xCreate */)) = fstreeConnect             // test_fs.c:846:3:
 80068  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 16 /* .xConnect */)) = fstreeConnect           // test_fs.c:847:3:
 80069  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 24 /* .xBestIndex */)) = fstreeBestIndex                                         // test_fs.c:848:3:
 80070  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 32 /* .xDisconnect */)) = fstreeDisconnect                                                // test_fs.c:849:3:
 80071  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 40 /* .xDestroy */)) = fstreeDisconnect                                                   // test_fs.c:850:3:
 80072  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 48 /* .xOpen */)) = fstreeOpen                                                   // test_fs.c:851:3:
 80073  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 56 /* .xClose */)) = fstreeClose                                                          // test_fs.c:852:3:
 80074  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 64 /* .xFilter */)) = fstreeFilter                        // test_fs.c:853:3:
 80075  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 72 /* .xNext */)) = fstreeNext                                                            // test_fs.c:854:3:
 80076  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 80 /* .xEof */)) = fstreeEof                                                              // test_fs.c:855:3:
 80077  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 88 /* .xColumn */)) = fstreeColumn                                        // test_fs.c:856:3:
 80078  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 96 /* .xRowid */)) = fstreeRowid                                                 // test_fs.c:857:3:
 80079  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 8 /* .xCreate */)) = fts5tokConnectMethod    // fts5_test_tok.c:453:6:
 80080  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 16 /* .xConnect */)) = fts5tokConnectMethod  // fts5_test_tok.c:454:6:
 80081  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 24 /* .xBestIndex */)) = fts5tokBestIndexMethod                                // fts5_test_tok.c:455:6:
 80082  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 32 /* .xDisconnect */)) = fts5tokDisconnectMethod                                       // fts5_test_tok.c:456:6:
 80083  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 40 /* .xDestroy */)) = fts5tokDisconnectMethod                                          // fts5_test_tok.c:457:6:
 80084  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 48 /* .xOpen */)) = fts5tokOpenMethod                                          // fts5_test_tok.c:458:6:
 80085  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 56 /* .xClose */)) = fts5tokCloseMethod                                                 // fts5_test_tok.c:459:6:
 80086  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 64 /* .xFilter */)) = fts5tokFilterMethod               // fts5_test_tok.c:460:6:
 80087  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 72 /* .xNext */)) = fts5tokNextMethod                                                   // fts5_test_tok.c:461:6:
 80088  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 80 /* .xEof */)) = fts5tokEofMethod                                                     // fts5_test_tok.c:462:6:
 80089  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 88 /* .xColumn */)) = fts5tokColumnMethod                               // fts5_test_tok.c:463:6:
 80090  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 96 /* .xRowid */)) = fts5tokRowidMethod                                        // fts5_test_tok.c:464:6:
 80091  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 8 /* .xCreate */)) = fuzzerConnect             // fuzzer.c:1149:3:
 80092  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 16 /* .xConnect */)) = fuzzerConnect           // fuzzer.c:1150:3:
 80093  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 24 /* .xBestIndex */)) = fuzzerBestIndex                                         // fuzzer.c:1151:3:
 80094  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 32 /* .xDisconnect */)) = fuzzerDisconnect                                                // fuzzer.c:1152:3:
 80095  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 40 /* .xDestroy */)) = fuzzerDisconnect                                                   // fuzzer.c:1153:3:
 80096  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 48 /* .xOpen */)) = fuzzerOpen                                                   // fuzzer.c:1154:3:
 80097  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 56 /* .xClose */)) = fuzzerClose                                                          // fuzzer.c:1155:3:
 80098  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 64 /* .xFilter */)) = fuzzerFilter                        // fuzzer.c:1156:3:
 80099  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 72 /* .xNext */)) = fuzzerNext                                                            // fuzzer.c:1157:3:
 80100  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 80 /* .xEof */)) = fuzzerEof                                                              // fuzzer.c:1158:3:
 80101  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 88 /* .xColumn */)) = fuzzerColumn                                        // fuzzer.c:1159:3:
 80102  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 96 /* .xRowid */)) = fuzzerRowid                                                 // fuzzer.c:1160:3:
 80103  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 8 /* .xCreate */)) = intarrayCreate          // test_intarray.c:189:3:
 80104  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 16 /* .xConnect */)) = intarrayCreate        // test_intarray.c:190:3:
 80105  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 24 /* .xBestIndex */)) = intarrayBestIndex                                     // test_intarray.c:191:3:
 80106  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 32 /* .xDisconnect */)) = intarrayDestroy                                               // test_intarray.c:192:3:
 80107  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 40 /* .xDestroy */)) = intarrayDestroy                                                  // test_intarray.c:193:3:
 80108  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 48 /* .xOpen */)) = intarrayOpen                                               // test_intarray.c:194:3:
 80109  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 56 /* .xClose */)) = intarrayClose                                                      // test_intarray.c:195:3:
 80110  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 64 /* .xFilter */)) = intarrayFilter                    // test_intarray.c:196:3:
 80111  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 72 /* .xNext */)) = intarrayNext                                                        // test_intarray.c:197:3:
 80112  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 80 /* .xEof */)) = intarrayEof                                                          // test_intarray.c:198:3:
 80113  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 88 /* .xColumn */)) = intarrayColumn                                    // test_intarray.c:199:3:
 80114  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 96 /* .xRowid */)) = intarrayRowid                                             // test_intarray.c:200:3:
 80115  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 8 /* .xClose */)) = jtClose                                                              // test_journal.c:189:3:
 80116  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 16 /* .xRead */)) = jtRead                                // test_journal.c:190:3:
 80117  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 24 /* .xWrite */)) = jtWrite                              // test_journal.c:191:3:
 80118  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 32 /* .xTruncate */)) = jtTruncate                                        // test_journal.c:192:3:
 80119  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 40 /* .xSync */)) = jtSync                                                        // test_journal.c:193:3:
 80120  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 48 /* .xFileSize */)) = jtFileSize                                              // test_journal.c:194:3:
 80121  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 56 /* .xLock */)) = jtLock                                                        // test_journal.c:195:3:
 80122  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 64 /* .xUnlock */)) = jtUnlock                                                    // test_journal.c:196:3:
 80123  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 72 /* .xCheckReservedLock */)) = jtCheckReservedLock                            // test_journal.c:197:3:
 80124  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 80 /* .xFileControl */)) = jtFileControl                                 // test_journal.c:198:3:
 80125  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 88 /* .xSectorSize */)) = jtSectorSize                                                   // test_journal.c:199:3:
 80126  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 96 /* .xDeviceCharacteristics */)) = jtDeviceCharacteristics                             // test_journal.c:200:3:
 80127  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 40 /* .xOpen */)) = jtOpen                                    // test_journal.c:172:3:
 80128  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 48 /* .xDelete */)) = jtDelete                                                  // test_journal.c:173:3:
 80129  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 56 /* .xAccess */)) = jtAccess                                         // test_journal.c:174:3:
 80130  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 64 /* .xFullPathname */)) = jtFullPathname                             // test_journal.c:175:3:
 80131  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 72 /* .xDlOpen */)) = jtDlOpen                                                       // test_journal.c:176:3:
 80132  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 80 /* .xDlError */)) = jtDlError                                                      // test_journal.c:177:3:
 80133  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 88 /* .xDlSym */)) = jtDlSym                                                // test_journal.c:178:3:
 80134  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 96 /* .xDlClose */)) = jtDlClose                                                             // test_journal.c:179:3:
 80135  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 104 /* .xRandomness */)) = jtRandomness                                         // test_journal.c:180:3:
 80136  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 112 /* .xSleep */)) = jtSleep                                                            // test_journal.c:181:3:
 80137  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 120 /* .xCurrentTime */)) = jtCurrentTime                                              // test_journal.c:182:3:
 80138  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 128 /* .xGetLastError */)) = jtGetLastError                                     // test_journal.c:183:3:
 80139  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 136 /* .xCurrentTimeInt64 */)) = jtCurrentTimeInt64                                    // test_journal.c:184:3:
 80140  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 16 /* .xConnect */)) = prefixesConnect       // prefixes.c:230:21:
 80141  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 24 /* .xBestIndex */)) = prefixesBestIndex                                     // prefixes.c:231:21:
 80142  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 32 /* .xDisconnect */)) = prefixesDisconnect                                            // prefixes.c:232:21:
 80143  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 48 /* .xOpen */)) = prefixesOpen                                               // prefixes.c:234:21:
 80144  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 56 /* .xClose */)) = prefixesClose                                                      // prefixes.c:235:21:
 80145  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 64 /* .xFilter */)) = prefixesFilter                    // prefixes.c:236:21:
 80146  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 72 /* .xNext */)) = prefixesNext                                                        // prefixes.c:237:21:
 80147  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 80 /* .xEof */)) = prefixesEof                                                          // prefixes.c:238:21:
 80148  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 88 /* .xColumn */)) = prefixesColumn                                    // prefixes.c:239:21:
 80149  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 96 /* .xRowid */)) = prefixesRowid                                             // prefixes.c:240:21:
 80150  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&pzNeededCollation)) + 0)) = uintptr(unsafe.Pointer(&zNeededCollation))                                                            // test1.c:3130:34:
 80151  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 8 /* .xCreate */)) = schemaCreate              // test_schema.c:276:3:
 80152  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 16 /* .xConnect */)) = schemaCreate            // test_schema.c:277:3:
 80153  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 24 /* .xBestIndex */)) = schemaBestIndex                                         // test_schema.c:278:3:
 80154  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 32 /* .xDisconnect */)) = schemaDestroy                                                   // test_schema.c:279:3:
 80155  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 40 /* .xDestroy */)) = schemaDestroy                                                      // test_schema.c:280:3:
 80156  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 48 /* .xOpen */)) = schemaOpen                                                   // test_schema.c:281:3:
 80157  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 56 /* .xClose */)) = schemaClose                                                          // test_schema.c:282:3:
 80158  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 64 /* .xFilter */)) = schemaFilter                        // test_schema.c:283:3:
 80159  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 72 /* .xNext */)) = schemaNext                                                            // test_schema.c:284:3:
 80160  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 80 /* .xEof */)) = schemaEof                                                              // test_schema.c:285:3:
 80161  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 88 /* .xColumn */)) = schemaColumn                                        // test_schema.c:286:3:
 80162  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 96 /* .xRowid */)) = schemaRowid                                                 // test_schema.c:287:3:
 80163  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 16 /* .xConnect */)) = seriesConnect           // series.c:400:3:
 80164  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 24 /* .xBestIndex */)) = seriesBestIndex                                         // series.c:401:3:
 80165  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 32 /* .xDisconnect */)) = seriesDisconnect                                                // series.c:402:3:
 80166  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 48 /* .xOpen */)) = seriesOpen                                                   // series.c:404:3:
 80167  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 56 /* .xClose */)) = seriesClose                                                          // series.c:405:3:
 80168  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 64 /* .xFilter */)) = seriesFilter                        // series.c:406:3:
 80169  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 72 /* .xNext */)) = seriesNext                                                            // series.c:407:3:
 80170  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 80 /* .xEof */)) = seriesEof                                                              // series.c:408:3:
 80171  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 88 /* .xColumn */)) = seriesColumn                                        // series.c:409:3:
 80172  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 96 /* .xRowid */)) = seriesRowid                                                 // series.c:410:3:
 80173  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 8 /* .xCreate */)) = spellfix1Create        // spellfix.c:2993:3:
 80174  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 16 /* .xConnect */)) = spellfix1Connect     // spellfix.c:2994:3:
 80175  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 24 /* .xBestIndex */)) = spellfix1BestIndex                                   // spellfix.c:2995:3:
 80176  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 32 /* .xDisconnect */)) = spellfix1Disconnect                                          // spellfix.c:2996:3:
 80177  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 40 /* .xDestroy */)) = spellfix1Destroy                                                // spellfix.c:2997:3:
 80178  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 48 /* .xOpen */)) = spellfix1Open                                             // spellfix.c:2998:3:
 80179  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 56 /* .xClose */)) = spellfix1Close                                                    // spellfix.c:2999:3:
 80180  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 64 /* .xFilter */)) = spellfix1Filter                  // spellfix.c:3000:3:
 80181  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 72 /* .xNext */)) = spellfix1Next                                                      // spellfix.c:3001:3:
 80182  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 80 /* .xEof */)) = spellfix1Eof                                                        // spellfix.c:3002:3:
 80183  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 88 /* .xColumn */)) = spellfix1Column                                  // spellfix.c:3003:3:
 80184  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 96 /* .xRowid */)) = spellfix1Rowid                                           // spellfix.c:3004:3:
 80185  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 104 /* .xUpdate */)) = spellfix1Update                        // spellfix.c:3005:3:
 80186  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 152 /* .xRename */)) = spellfix1Rename                                        // spellfix.c:3011:3:
 80187  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 8 /* .xCreate */)) = tclConnect                   // test_bestindex.c:551:3:
 80188  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 16 /* .xConnect */)) = tclConnect                 // test_bestindex.c:552:3:
 80189  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 24 /* .xBestIndex */)) = tclBestIndex                                               // test_bestindex.c:553:3:
 80190  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 32 /* .xDisconnect */)) = tclDisconnect                                                      // test_bestindex.c:554:3:
 80191  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 40 /* .xDestroy */)) = tclDisconnect                                                         // test_bestindex.c:555:3:
 80192  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 48 /* .xOpen */)) = tclOpen                                                         // test_bestindex.c:556:3:
 80193  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 56 /* .xClose */)) = tclClose                                                                // test_bestindex.c:557:3:
 80194  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 64 /* .xFilter */)) = tclFilter                              // test_bestindex.c:558:3:
 80195  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 72 /* .xNext */)) = tclNext                                                                  // test_bestindex.c:559:3:
 80196  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 80 /* .xEof */)) = tclEof                                                                    // test_bestindex.c:560:3:
 80197  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 88 /* .xColumn */)) = tclColumn                                              // test_bestindex.c:561:3:
 80198  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 96 /* .xRowid */)) = tclRowid                                                       // test_bestindex.c:562:3:
 80199  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 8 /* .xCreate */)) = tclvarConnect             // test_tclvar.c:471:3:
 80200  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 16 /* .xConnect */)) = tclvarConnect           // test_tclvar.c:472:3:
 80201  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 24 /* .xBestIndex */)) = tclvarBestIndex                                         // test_tclvar.c:473:3:
 80202  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 32 /* .xDisconnect */)) = tclvarDisconnect                                                // test_tclvar.c:474:3:
 80203  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 40 /* .xDestroy */)) = tclvarDisconnect                                                   // test_tclvar.c:475:3:
 80204  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 48 /* .xOpen */)) = tclvarOpen                                                   // test_tclvar.c:476:3:
 80205  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 56 /* .xClose */)) = tclvarClose                                                          // test_tclvar.c:477:3:
 80206  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 64 /* .xFilter */)) = tclvarFilter                        // test_tclvar.c:478:3:
 80207  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 72 /* .xNext */)) = tclvarNext                                                            // test_tclvar.c:479:3:
 80208  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 80 /* .xEof */)) = tclvarEof                                                              // test_tclvar.c:480:3:
 80209  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 88 /* .xColumn */)) = tclvarColumn                                        // test_tclvar.c:481:3:
 80210  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 96 /* .xRowid */)) = tclvarRowid                                                 // test_tclvar.c:482:3:
 80211  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 104 /* .xUpdate */)) = tclvarUpdate                              // test_tclvar.c:483:3:
 80212  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 8 /* .pArg */)) = uintptr(unsafe.Pointer(&testpcacheGlobal))                                                       // test_pcache.c:435:5:
 80213  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 16 /* .xInit */)) = testpcacheInit                                                          // test_pcache.c:436:5:
 80214  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 24 /* .xShutdown */)) = testpcacheShutdown                                                        // test_pcache.c:437:5:
 80215  	*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 32 /* .xCreate */)) = testpcacheCreate                                        // test_pcache.c:438:5:
 80216  	*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 40 /* .xCachesize */)) = testpcacheCachesize                                               // test_pcache.c:439:5:
 80217  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 48 /* .xPagecount */)) = testpcachePagecount                                                // test_pcache.c:440:5:
 80218  	*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 56 /* .xFetch */)) = testpcacheFetch                                       // test_pcache.c:441:5:
 80219  	*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 64 /* .xUnpin */)) = testpcacheUnpin                                              // test_pcache.c:442:5:
 80220  	*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 72 /* .xRekey */)) = testpcacheRekey                                     // test_pcache.c:443:5:
 80221  	*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 80 /* .xTruncate */)) = testpcacheTruncate                                                // test_pcache.c:444:5:
 80222  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 88 /* .xDestroy */)) = testpcacheDestroy                                                          // test_pcache.c:445:5:
 80223  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 8 /* .xClose */)) = tmpClose                                                            // test_onefile.c:231:3:
 80224  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 16 /* .xRead */)) = tmpRead                              // test_onefile.c:232:3:
 80225  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 24 /* .xWrite */)) = tmpWrite                            // test_onefile.c:233:3:
 80226  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 32 /* .xTruncate */)) = tmpTruncate                                      // test_onefile.c:234:3:
 80227  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 40 /* .xSync */)) = tmpSync                                                      // test_onefile.c:235:3:
 80228  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 48 /* .xFileSize */)) = tmpFileSize                                            // test_onefile.c:236:3:
 80229  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 56 /* .xLock */)) = tmpLock                                                      // test_onefile.c:237:3:
 80230  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 64 /* .xUnlock */)) = tmpUnlock                                                  // test_onefile.c:238:3:
 80231  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 72 /* .xCheckReservedLock */)) = tmpCheckReservedLock                          // test_onefile.c:239:3:
 80232  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 80 /* .xFileControl */)) = tmpFileControl                               // test_onefile.c:240:3:
 80233  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 88 /* .xSectorSize */)) = tmpSectorSize                                                 // test_onefile.c:241:3:
 80234  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 96 /* .xDeviceCharacteristics */)) = tmpDeviceCharacteristics                           // test_onefile.c:242:3:
 80235  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 8 /* .xClose */)) = tvfsClose                                                          // test_vfs.c:206:3:
 80236  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 16 /* .xRead */)) = tvfsRead                            // test_vfs.c:207:3:
 80237  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 24 /* .xWrite */)) = tvfsWrite                          // test_vfs.c:208:3:
 80238  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 32 /* .xTruncate */)) = tvfsTruncate                                    // test_vfs.c:209:3:
 80239  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 40 /* .xSync */)) = tvfsSync                                                    // test_vfs.c:210:3:
 80240  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 48 /* .xFileSize */)) = tvfsFileSize                                          // test_vfs.c:211:3:
 80241  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 56 /* .xLock */)) = tvfsLock                                                    // test_vfs.c:212:3:
 80242  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 64 /* .xUnlock */)) = tvfsUnlock                                                // test_vfs.c:213:3:
 80243  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 72 /* .xCheckReservedLock */)) = tvfsCheckReservedLock                        // test_vfs.c:214:3:
 80244  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 80 /* .xFileControl */)) = tvfsFileControl                             // test_vfs.c:215:3:
 80245  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 88 /* .xSectorSize */)) = tvfsSectorSize                                               // test_vfs.c:216:3:
 80246  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 96 /* .xDeviceCharacteristics */)) = tvfsDeviceCharacteristics                         // test_vfs.c:217:3:
 80247  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 104 /* .xShmMap */)) = tvfsShmMap                        // test_vfs.c:218:3:
 80248  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 112 /* .xShmLock */)) = tvfsShmLock                               // test_vfs.c:219:3:
 80249  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 120 /* .xShmBarrier */)) = tvfsShmBarrier                                                    // test_vfs.c:220:3:
 80250  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 128 /* .xShmUnmap */)) = tvfsShmUnmap                                           // test_vfs.c:221:3:
 80251  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 136 /* .xFetch */)) = tvfsFetch                         // test_vfs.c:222:3:
 80252  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 144 /* .xUnfetch */)) = tvfsUnfetch                            // test_vfs.c:223:3:
 80253  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 40 /* .xOpen */)) = tvfsOpen                                // test_vfs.c:1451:5:
 80254  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 48 /* .xDelete */)) = tvfsDelete                                              // test_vfs.c:1452:5:
 80255  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 56 /* .xAccess */)) = tvfsAccess                                     // test_vfs.c:1453:5:
 80256  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 64 /* .xFullPathname */)) = tvfsFullPathname                         // test_vfs.c:1454:5:
 80257  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 104 /* .xRandomness */)) = tvfsRandomness                                     // test_vfs.c:1466:5:
 80258  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 112 /* .xSleep */)) = tvfsSleep                                                        // test_vfs.c:1467:5:
 80259  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 120 /* .xCurrentTime */)) = tvfsCurrentTime                                          // test_vfs.c:1468:5:
 80260  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 8 /* .xCreate */)) = unionConnect               // unionvtab.c:1332:5:
 80261  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 16 /* .xConnect */)) = unionConnect             // unionvtab.c:1333:5:
 80262  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 24 /* .xBestIndex */)) = unionBestIndex                                           // unionvtab.c:1334:5:
 80263  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 32 /* .xDisconnect */)) = unionDisconnect                                                  // unionvtab.c:1335:5:
 80264  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 40 /* .xDestroy */)) = unionDisconnect                                                     // unionvtab.c:1336:5:
 80265  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 48 /* .xOpen */)) = unionOpen                                                     // unionvtab.c:1337:5:
 80266  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 56 /* .xClose */)) = unionClose                                                            // unionvtab.c:1338:5:
 80267  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 64 /* .xFilter */)) = unionFilter                          // unionvtab.c:1339:5:
 80268  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 72 /* .xNext */)) = unionNext                                                              // unionvtab.c:1340:5:
 80269  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 80 /* .xEof */)) = unionEof                                                                // unionvtab.c:1341:5:
 80270  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 88 /* .xColumn */)) = unionColumn                                          // unionvtab.c:1342:5:
 80271  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 96 /* .xRowid */)) = unionRowid                                                   // unionvtab.c:1343:5:
 80272  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 8 /* .xClose */)) = vfslogClose                                                      // test_osinst.c:204:3:
 80273  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 16 /* .xRead */)) = vfslogRead                        // test_osinst.c:205:3:
 80274  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 24 /* .xWrite */)) = vfslogWrite                      // test_osinst.c:206:3:
 80275  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 32 /* .xTruncate */)) = vfslogTruncate                                // test_osinst.c:207:3:
 80276  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 40 /* .xSync */)) = vfslogSync                                                // test_osinst.c:208:3:
 80277  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 48 /* .xFileSize */)) = vfslogFileSize                                      // test_osinst.c:209:3:
 80278  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 56 /* .xLock */)) = vfslogLock                                                // test_osinst.c:210:3:
 80279  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 64 /* .xUnlock */)) = vfslogUnlock                                            // test_osinst.c:211:3:
 80280  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 72 /* .xCheckReservedLock */)) = vfslogCheckReservedLock                    // test_osinst.c:212:3:
 80281  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 80 /* .xFileControl */)) = vfslogFileControl                         // test_osinst.c:213:3:
 80282  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 88 /* .xSectorSize */)) = vfslogSectorSize                                           // test_osinst.c:214:3:
 80283  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 96 /* .xDeviceCharacteristics */)) = vfslogDeviceCharacteristics                     // test_osinst.c:215:3:
 80284  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 104 /* .xShmMap */)) = vfslogShmMap                    // test_osinst.c:216:3:
 80285  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 112 /* .xShmLock */)) = vfslogShmLock                           // test_osinst.c:217:3:
 80286  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 120 /* .xShmBarrier */)) = vfslogShmBarrier                                                // test_osinst.c:218:3:
 80287  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 128 /* .xShmUnmap */)) = vfslogShmUnmap                                       // test_osinst.c:219:3:
 80288  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 8 /* .xCreate */)) = vlogConnect              // test_osinst.c:1074:5:
 80289  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 16 /* .xConnect */)) = vlogConnect            // test_osinst.c:1075:5:
 80290  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 24 /* .xBestIndex */)) = vlogBestIndex                                          // test_osinst.c:1076:5:
 80291  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 32 /* .xDisconnect */)) = vlogDisconnect                                                 // test_osinst.c:1077:5:
 80292  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 40 /* .xDestroy */)) = vlogDisconnect                                                    // test_osinst.c:1078:5:
 80293  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 48 /* .xOpen */)) = vlogOpen                                                    // test_osinst.c:1079:5:
 80294  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 56 /* .xClose */)) = vlogClose                                                           // test_osinst.c:1080:5:
 80295  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 64 /* .xFilter */)) = vlogFilter                         // test_osinst.c:1081:5:
 80296  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 72 /* .xNext */)) = vlogNext                                                             // test_osinst.c:1082:5:
 80297  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 80 /* .xEof */)) = vlogEof                                                               // test_osinst.c:1083:5:
 80298  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 88 /* .xColumn */)) = vlogColumn                                         // test_osinst.c:1084:5:
 80299  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 96 /* .xRowid */)) = vlogRowid                                                  // test_osinst.c:1085:5:
 80300  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 40 /* .xOpen */)) = vfslogOpen                            // test_osinst.c:187:3:
 80301  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 48 /* .xDelete */)) = vfslogDelete                                          // test_osinst.c:188:3:
 80302  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 56 /* .xAccess */)) = vfslogAccess                                 // test_osinst.c:189:3:
 80303  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 64 /* .xFullPathname */)) = vfslogFullPathname                     // test_osinst.c:190:3:
 80304  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 72 /* .xDlOpen */)) = vfslogDlOpen                                               // test_osinst.c:191:3:
 80305  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 80 /* .xDlError */)) = vfslogDlError                                              // test_osinst.c:192:3:
 80306  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 88 /* .xDlSym */)) = vfslogDlSym                                        // test_osinst.c:193:3:
 80307  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 96 /* .xDlClose */)) = vfslogDlClose                                                     // test_osinst.c:194:3:
 80308  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 104 /* .xRandomness */)) = vfslogRandomness                                 // test_osinst.c:195:3:
 80309  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 112 /* .xSleep */)) = vfslogSleep                                                    // test_osinst.c:196:3:
 80310  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 120 /* .xCurrentTime */)) = vfslogCurrentTime                                      // test_osinst.c:197:3:
 80311  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 128 /* .xGetLastError */)) = vfslogGetLastError                             // test_osinst.c:198:3:
 80312  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 136 /* .xCurrentTimeInt64 */)) = vfslogCurrentTimeInt64                            // test_osinst.c:199:3:
 80313  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 8 /* .xCreate */)) = wholenumberConnect   // wholenumber.c:238:3:
 80314  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 16 /* .xConnect */)) = wholenumberConnect // wholenumber.c:239:3:
 80315  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 24 /* .xBestIndex */)) = wholenumberBestIndex                               // wholenumber.c:240:3:
 80316  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 32 /* .xDisconnect */)) = wholenumberDisconnect                                      // wholenumber.c:241:3:
 80317  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 40 /* .xDestroy */)) = wholenumberDisconnect                                         // wholenumber.c:242:3:
 80318  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 48 /* .xOpen */)) = wholenumberOpen                                         // wholenumber.c:243:3:
 80319  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 56 /* .xClose */)) = wholenumberClose                                                // wholenumber.c:244:3:
 80320  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 64 /* .xFilter */)) = wholenumberFilter              // wholenumber.c:245:3:
 80321  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 72 /* .xNext */)) = wholenumberNext                                                  // wholenumber.c:246:3:
 80322  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 80 /* .xEof */)) = wholenumberEof                                                    // wholenumber.c:247:3:
 80323  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 88 /* .xColumn */)) = wholenumberColumn                              // wholenumber.c:248:3:
 80324  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 96 /* .xRowid */)) = wholenumberRowid                                       // wholenumber.c:249:3:
 80325  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 8 /* .xClose */)) = devsymClose                                                  // test_devsym.c:393:3:
 80326  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 16 /* .xRead */)) = devsymRead                     // test_devsym.c:394:3:
 80327  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 24 /* .xWrite */)) = writecrashWrite               // test_devsym.c:395:3:
 80328  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 32 /* .xTruncate */)) = devsymTruncate                             // test_devsym.c:396:3:
 80329  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 40 /* .xSync */)) = devsymSync                                            // test_devsym.c:397:3:
 80330  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 48 /* .xFileSize */)) = devsymFileSize                                  // test_devsym.c:398:3:
 80331  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 56 /* .xLock */)) = devsymLock                                            // test_devsym.c:399:3:
 80332  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 64 /* .xUnlock */)) = devsymUnlock                                        // test_devsym.c:400:3:
 80333  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 72 /* .xCheckReservedLock */)) = devsymCheckReservedLock                // test_devsym.c:401:3:
 80334  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 80 /* .xFileControl */)) = devsymFileControl                     // test_devsym.c:402:3:
 80335  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 88 /* .xSectorSize */)) = writecrashSectorSize                                   // test_devsym.c:403:3:
 80336  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 96 /* .xDeviceCharacteristics */)) = writecrashDeviceCharacteristics             // test_devsym.c:404:3:
 80337  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 104 /* .xShmMap */)) = devsymShmMap                // test_devsym.c:405:3:
 80338  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 112 /* .xShmLock */)) = devsymShmLock                       // test_devsym.c:406:3:
 80339  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 120 /* .xShmBarrier */)) = devsymShmBarrier                                            // test_devsym.c:407:3:
 80340  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 128 /* .xShmUnmap */)) = devsymShmUnmap                                   // test_devsym.c:408:3:
 80341  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 40 /* .xOpen */)) = writecrashOpen                    // test_devsym.c:457:3:
 80342  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 48 /* .xDelete */)) = devsymDelete                                      // test_devsym.c:458:3:
 80343  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 56 /* .xAccess */)) = devsymAccess                             // test_devsym.c:459:3:
 80344  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 64 /* .xFullPathname */)) = devsymFullPathname                 // test_devsym.c:460:3:
 80345  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 104 /* .xRandomness */)) = devsymRandomness                             // test_devsym.c:472:3:
 80346  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 112 /* .xSleep */)) = devsymSleep                                                // test_devsym.c:473:3:
 80347  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 120 /* .xCurrentTime */)) = devsymCurrentTime                                  // test_devsym.c:474:3:
 80348  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 8 /* .xCreate */)) = zipfileConnect           // zipfile.c:2150:5:
 80349  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 16 /* .xConnect */)) = zipfileConnect         // zipfile.c:2151:5:
 80350  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 24 /* .xBestIndex */)) = zipfileBestIndex                                       // zipfile.c:2152:5:
 80351  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 32 /* .xDisconnect */)) = zipfileDisconnect                                              // zipfile.c:2153:5:
 80352  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 40 /* .xDestroy */)) = zipfileDisconnect                                                 // zipfile.c:2154:5:
 80353  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 48 /* .xOpen */)) = zipfileOpen                                                 // zipfile.c:2155:5:
 80354  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 56 /* .xClose */)) = zipfileClose                                                        // zipfile.c:2156:5:
 80355  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 64 /* .xFilter */)) = zipfileFilter                      // zipfile.c:2157:5:
 80356  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 72 /* .xNext */)) = zipfileNext                                                          // zipfile.c:2158:5:
 80357  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 80 /* .xEof */)) = zipfileEof                                                            // zipfile.c:2159:5:
 80358  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 88 /* .xColumn */)) = zipfileColumn                                      // zipfile.c:2160:5:
 80359  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 104 /* .xUpdate */)) = zipfileUpdate                            // zipfile.c:2162:5:
 80360  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 112 /* .xBegin */)) = zipfileBegin                                                       // zipfile.c:2163:5:
 80361  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 128 /* .xCommit */)) = zipfileCommit                                                     // zipfile.c:2165:5:
 80362  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 136 /* .xRollback */)) = zipfileRollback                                                 // zipfile.c:2166:5:
 80363  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 144 /* .xFindFunction */)) = zipfileFindFunction       // zipfile.c:2167:5:
 80364  }
 80365  
 80366  var ts1 = "%s\x00internal error!\x00SELECT * FROM main.%Q WHERE sample()\x00expert\x00PRAGMA table_xinfo=%Q\x00main\x00, \x00%Q\x00 COLLATE %Q\x00 COLLATE %s\x00 DESC\x00PRAGMA index_list=%Q\x00PRAGMA index_xInfo=%Q\x00%s_idx_%08x\x00CREATE INDEX '%q' ON %Q(%s)\x00CREATE INDEX %s ON %s(%s)\x00EXPLAIN QUERY PLAN %s\x00 USING INDEX \x00 USING COVERING INDEX \x00%s\n\x00%s;\n\x00SELECT 'CREATE TEMP' || substr(sql, 7) FROM sqlite_schema WHERE tbl_name = %Q AND type IN ('table', 'trigger') ORDER BY type;\x00ALTER TABLE temp.%Q RENAME TO %Q\x00INSERT INTO %Q VALUES(\x00%s?\x00\x00)\x00UPDATE %Q SET \x00%s%Q=?\x00DELETE FROM %Q\x00t592690916721053953805701627921227776\x00DROP TABLE t592690916721053953805701627921227776\x00SELECT type, name, sql, 1 FROM sqlite_schema WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%%'  UNION ALL SELECT type, name, sql, 2 FROM sqlite_schema WHERE type = 'trigger'  AND tbl_name IN(SELECT name FROM sqlite_schema WHERE type = 'view') ORDER BY 4, 1\x00CREATE TABLE x(\x00%s%Q COLLATE %s\x00CREATE VIRTUAL TABLE %Q USING expert(%Q)\x00SELECT max(i.seqno) FROM   sqlite_schema AS s,   pragma_index_list(s.name) AS l,   pragma_index_info(l.name) AS i WHERE s.type = 'table'\x00%sx.%Q IS rem(%d, x.%Q) COLLATE %s\x00%s%d\x00SELECT %s FROM %Q x ORDER BY %s\x00SELECT %s FROM temp.t592690916721053953805701627921227776 x ORDER BY %s\x00%d\x00 %d\x00DROP TABLE IF EXISTS temp.t592690916721053953805701627921227776\x00CREATE TABLE temp.t592690916721053953805701627921227776 AS SELECT * FROM %Q\x00SELECT s.rowid, s.name, l.name FROM   sqlite_schema AS s,   pragma_index_list(s.name) AS l WHERE s.type = 'table'\x00SELECT name, coll FROM pragma_index_xinfo(?) WHERE key\x00INSERT INTO sqlite_stat1 VALUES(?, ?, ?)\x00ANALYZE; PRAGMA writable_schema=1\x00rem\x00sample\x00ANALYZE sqlite_schema\x00:memory:\x00SELECT sql FROM sqlite_schema WHERE name NOT LIKE 'sqlite_%%' AND sql NOT LIKE 'CREATE VIRTUAL %%'\x00%s;%s%s\n\x00 -- stat1: \x00no such handle: \x00sql\x00TABLE\x00analyze\x00count\x00report\x00STMT EREPORT\x00destroy\x00SUBCOMMAND ...\x00sub-command\x00indexes\x00plan\x00candidates\x00DB\x00sqlite3expert%d\x00out of memory\x00sqlite3_expert_new\x00SQLITE_DONE\x00SQLITE_ERROR\x00SQLITE_OK\x00SELECT fts5(?1)\x00error: \x00fts5_api_ptr\x00f5t_2_%lld\x00xColumnCount\x00xRowCount\x00xColumnTotalSize\x00COL\x00xTokenize\x00TEXT SCRIPT\x00xPhraseCount\x00xPhraseSize\x00PHRASE\x00xInstCount\x00xInst\x00IDX\x00xRowid\x00xColumnText\x00xColumnSize\x00xQueryPhrase\x00PHRASE SCRIPT\x00xSetAuxdata\x00VALUE\x00xGetAuxdata\x00CLEAR\x00xSetAuxdataInt\x00INTEGER\x00xGetAuxdataInt\x00xPhraseForeach\x00IPHRASE COLVAR OFFVAR SCRIPT\x00xPhraseColumnForeach\x00IPHRASE COLVAR SCRIPT\x00SUB-COMMAND\x00f5t_%lld\x00bytearray\x00boolean\x00double\x00wideInt\x00int\x00DB NAME SCRIPT\x00?-subst? DB NAME TEXT\x00-subst\x00unrecognized option: \x00no such tokenizer: \x00error in tokenizer.xCreate()\x00error in tokenizer.xTokenize()\x00document\x00aux\x00query\x00prefixquery\x00invalid\x00-colocated\x00sqlite3_fts5_token may only be used by tokenizer callback\x00?-colocated? TEXT START END\x00error in fts5_api.xCreateTokenizer()\x00NSLOT TOKEN\x00sqlite3_fts5_create_tokenizer\x00sqlite3_fts5_token\x00sqlite3_fts5_tokenize\x00sqlite3_fts5_create_function\x00sqlite3_fts5_may_be_corrupt\x00sqlite3_fts5_token_hash\x00sqlite3_fts5_register_matchinfo\x00sqlite3_fts5_register_fts5tokenize\x00unrecognized matchinfo flag: %c\x00pcx\x00matchinfo\x00CREATE TABLE x(input HIDDEN, token, start, end, position)\x00fts5tokenize\x00apndvfs\x00Start-Of-SQLite3-\x00apnd(%lld)/%z\x00SQLite format 3\x00%s: cost must be between 1 and %d\x00%s: maximum string length is %d\x00%s: iLang must be between 0 and %d\x00?\x00SELECT * FROM %Q.%Q\x00%s: %s\x00%s: %s has %d columns, expected 4\x00vocabulary_table\x00vocabulary_word\x00vocabulary_language\x00edit_distances\x00unrecognized argument: [%s]\n\x00no edit_distances table specified\x00CREATE TABLE x(word,distance,language,command HIDDEN,nword HIDDEN)\x000123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^abcdefghijklmnopqrstuvwxyz~\x00SELECT \"%w\" FROM \"%w\"\x00 WHERE \"%w\">=?1 AND \"%w\"=?2 ORDER BY 1\x00SELECT \"%w\" FROM \"%w\" WHERE \"%w\">=?1 ORDER BY 1\x00*\x00DELETE from %s is not allowed\x00UPDATE of %s is not allowed\x00INSERT INTO %s allowed for column [command] only\x00approximate_match\x00int32\x00int64\x00char*\x00CREATE TABLE x(value,pointer hidden,count hidden,ctype hidden)\x00carray-bind\x00carray\x00unknown datatype: %Q\x00inttoptr\x00cksmvfs\x00ZV-\x00checksum fault offset %lld of \"%s\"\x00checksum_verification\x00enable%\x00yes\x00on\x00page_size\x00cksm/%z\x00verify_checksum\x00tablename\x00idcolumn\x00parentcolumn\x00CREATE TABLE x(id,depth,root HIDDEN,tablename HIDDEN,idcolumn HIDDEN,parentcolumn HIDDEN)\x00SELECT \"%w\".\"%w\" FROM \"%w\" WHERE \"%w\".\"%w\"=?1\x00transitive_closure\x00rb\x00cannot open '%s' for reading\x00line %d: unescaped %c character\x00line %d: unterminated %c-quoted field\n\x00more than one '%s' parameter\x00true\x00no\x00off\x00false\x00header\x00more than one 'header' parameter\x00testflags\x00columns\x00more than one 'columns' parameter\x00column= value must be positive\x00bad parameter: '%s'\x00must specify either filename= or data= but not both\x00%sc%d TEXT\x00,\x00%s\"%w\" TEXT\x00bad schema: '%s' - %s\x00filename\x00data\x00schema\x00csv\x00csv_wr\x00decimal_sum\x00decimal\x00decimal_cmp\x00decimal_add\x00decimal_sub\x00decimal_mul\x00 \x00eval\x00CREATE TABLE x(addr,opcode,p1,p2,p3,p4,p5,comment,sql HIDDEN)\x00EXPLAIN %s\x00explain\x00wb\x00wrong number of arguments to function writefile()\x00failed to create symlink: %s\x00failed to create directory: %s\x00failed to write file: %s\x00CREATE TABLE x(name,mode,mtime,data,path HIDDEN,dir HIDDEN)\x00cannot read directory: %s\x00%s/%s\x00cannot stat file: %s\x00table function fsdir requires an argument\x00table function fsdir requires a non-NULL argument\x00fsdir\x00readfile\x00writefile\x00lsmode\x00%s: ruleset must be between 0 and %d\x00%s: wrong number of CREATE VIRTUAL TABLE arguments\x00CREATE TABLE x(word,distance,ruleset)\x00fuzzer\x00ieee754(%lld,%d)\x00ieee754\x00ieee754_mantissa\x00ieee754_exponent\x00ieee754_to_blob\x00ieee754_from_blob\x00BEGIN; SELECT * FROM %s%q%ssqlite_schema\x00'\x00'.\x00PRAGMA %s%q%spage_size\x00sqlite3_mmap_warm_cache: Warmed up %d pages of %s\x00END\x00AND (%s)\x00collate \"%w\"\x00SELECT %s FROM %s WHERE %s>=(?1 || ?2) %s   AND %s<=(?1 || char(1114111)) %s   %s ORDER BY 1 %s ASC LIMIT 1\x00next_char\x00NULL\x00is\x00not\x00in(\x00in(select\x00in(with\x00?,?,?\x002nd argument to percentile() is not a number between 0.0 and 100.0\x002nd argument to percentile() is not the same for all input rows\x001st argument to percentile() is not numeric\x00Inf input to percentile()\x00percentile\x00CREATE TABLE prefixes(prefix TEXT, original_string TEXT HIDDEN)\x00prefixes\x00prefix_length\x00unknown \\ escape\x00afnrtv\\()*.+?[$^{|}]\x00\a\f\n\r\t\v\x00unmatched '('\x00'*' without operand\x00'+' without operand\x00'?' without operand\x00'{m,n}' without operand\x00unmatched '{'\x00n less than m in '{m,n}'\x00both m and n are zero in '{m,n}'\x00POSIX character classes not supported\x00unclosed '['\x00unrecognized character\x00regexp\x00regexpi\x00remember\x00CREATE TABLE x(value,start hidden,stop hidden,step hidden)\x00generate_series() requires SQLite 3.8.12 or later\x00generate_series\x00.ABCDHLRMY9 ?\x00non-ASCII input to editdist()\x00NULL input to editdist()\x00SELECT iLang, cFrom, cTo, iCost FROM \"%w\" WHERE iLang>=0 ORDER BY iLang\x00editdist3\x00DROP TABLE IF EXISTS \"%w\".\"%w_vocab\"\x00CREATE TABLE x(word,rank,distance,langid, score, matchlen, phonehash HIDDEN, top HIDDEN, scope HIDDEN, srchcnt HIDDEN, soundslike HIDDEN, command HIDDEN)\x00CREATE TABLE IF NOT EXISTS \"%w\".\"%w_vocab\"(\n  id INTEGER PRIMARY KEY,\n  rank INT,\n  langid INT,\n  word TEXT,\n  k1 TEXT,\n  k2 TEXT\n);\n\x00CREATE INDEX IF NOT EXISTS \"%w\".\"%w_vocab_index_langid_k2\" ON \"%w_vocab\"(langid,k2);\x00edit_cost_table=\x00bad argument to spellfix1(): \"%s\"\x00SELECT id, word, rank, coalesce(k1,word)  FROM \"%w\".\"%w_vocab\" WHERE langid=%d AND k2>=?1 AND k2<?2\x00SELECT word, rank, NULL, langid, id FROM \"%w\".\"%w_vocab\"%s\x00 WHERE rowid=?\x00ROLLBACK\x00IGNORE\x00ABORT\x00REPLACE\x00DELETE FROM \"%w\".\"%w_vocab\"  WHERE id=%lld\x00NOT NULL constraint failed: %s.word\x00reset\x00null\x00unknown value for %s.command: \"%w\"\x00INSERT INTO \"%w\".\"%w_vocab\"(rank,langid,word,k1,k2) VALUES(%d,%d,%Q,nullif(%Q,%Q),%Q)\x00INSERT OR %s INTO \"%w\".\"%w_vocab\"(id,rank,langid,word,k1,k2) VALUES(%lld,%d,%d,%Q,nullif(%Q,%Q),%Q)\x00UPDATE OR %s \"%w\".\"%w_vocab\" SET id=%lld, rank=%d, langid=%d, word=%Q, k1=nullif(%Q,%Q), k2=%Q WHERE id=%lld\x00ALTER TABLE \"%w\".\"%w_vocab\" RENAME TO \"%w_vocab\"\x00spellfix1_translit\x00spellfix1_editdist\x00spellfix1_phonehash\x00spellfix1_scriptcode\x00spellfix1\x00922337203685477580\x00tointeger\x00toreal\x00sql error: %s\x00_rowid_\x00integer\x00no such rowid table: %s%s%s\x00.\x00SELECT group_concat(quote(name) || '.' || quote(type)) FROM pragma_table_info(?, ?)\x00source table schema mismatch\x00swarmvtab: no such SQL parameter: %s\x00maxopen\x00swarmvtab: illegal maxopen value\x00missing\x00swarmvtab: duplicate \"missing\" option\x00SELECT \"%w\"(?%s)\x00,?\x00openclose\x00swarmvtab: duplicate \"openclose\" option\x00SELECT \"%w\"(?,?%s)\x00swarmvtab: unrecognized option: %s\x00SELECT \"%w\"(?)\x00swarmvtab: parse error: %s\x00swarmvtab\x00unionvtab\x00temp\x00%s tables must be created in TEMP schema\x00wrong number of arguments for %s\x00SELECT * FROM (%z) ORDER BY 3\x00rowid range mismatch error\x00no source tables configured\x00SELECT 'CREATE TABLE xyz('    || group_concat(quote(name) || ' ' || type, ', ')    || ')',max((cid+1) * (type='INTEGER' COLLATE nocase AND pk=1))-1 FROM pragma_table_info(%Q, ?)\x00SELECT rowid, * FROM %Q %s %lld\x00WHERE _rowid_ <=\x00-- \x00%z%sSELECT rowid, * FROM %s%q%s%Q\x00 UNION ALL \x00%z WHERE rowid=%lld\x00WHERE\x00%z WHERE rowid>=%lld\x00AND\x00%z %s rowid<=%lld\x00CREATE TABLE x(value)\x00wholenumber\x00CREATE TABLE y(name PRIMARY KEY,mode,mtime,sz,rawdata,data,method,z HIDDEN) WITHOUT ROWID;\x00zipfile\x00zipfile constructor requires one argument\x00error in fread()\x00error in fwrite()\x00failed to read CDS at offset %lld\x00%.*s\x00failed to read LFH at offset %d\x001.2.11\x00inflateInit2() failed (%d)\x00inflate() failed (%d)\x00zipfile: deflate() error\x00cannot find end of central directory record\x00zipfile() function requires an argument\x00cannot open file: %s\x00-rwxrwxrwx\x00zipfile: mode does not match data\x00zipfile: parse error in mode: %s\x00zipfile: missing filename\x00ab+\x00zipfile: failed to open file %s for writing\x00sz must be NULL\x00rawdata must be NULL\x00unknown compression method: %d\x00%s/\x00duplicate name: \"%s\"\x00{\"version-made-by\" : %u, \"version-to-extract\" : %u, \"flags\" : %u, \"compression\" : %u, \"time\" : %u, \"date\" : %u, \"crc32\" : %u, \"compressed-size\" : %u, \"uncompressed-size\" : %u, \"file-name-length\" : %u, \"extra-field-length\" : %u, \"file-comment-length\" : %u, \"disk-number-start\" : %u, \"internal-attr\" : %u, \"external-attr\" : %u, \"offset\" : %u }\x00zipfile_cds\x00wrong number of arguments to function zipfile()\x00first argument to zipfile() must be non-NULL\x00illegal method value: %d\x00non-directory name must not end with /\x00rbu_delta\x00step\x00close\x00create_rbu_delta\x00savestate\x00dbMain_eval\x00SQL\x00bp_progress\x00db\x00RBU\x00state\x00progress\x00close_no_error\x00temp_size_limit\x00LIMIT\x00temp_size\x00dbRbu_eval\x00METHOD\x00method\x00 - \x00oal\x00move\x00checkpoint\x00done\x00error\x00NAME TARGET-DB RBU-DB ?STATE-DB?\x00NAME TARGET-DB ?STATE-DB?\x00?-default? NAME PARENT\x00NAME\x00sqlite3rbu_db(0, 0)!=0\x00sqlite3rbu\x00sqlite3rbu_vacuum\x00sqlite3rbu_create_vfs\x00sqlite3rbu_destroy_vfs\x00sqlite3rbu_internal_test\x00DB SQL\x00error in sql_exec_changeset()\x00sqlite3session_streams\x00attach\x00changeset\x00delete\x00enable\x00BOOL\x00indirect\x00isempty\x00table_filter\x00SCRIPT\x00patchset\x00diff\x00FROMDB TBL\x00memory_used\x00changeset_size\x00object_config_size\x00CMD DB-HANDLE DB-NAME\x00n\x00i\x00f\x00t\x00b\x00FOREIGN_KEY\x00INSERT\x00UPDATE\x00DELETE\x00DATA\x00NOTFOUND\x00CONFLICT\x00CONSTRAINT\x00OMIT\x00-nosavepoint\x00-invert\x00?-nosavepoint? ?-inverse? DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?\x00DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?\x00DB CHANGESET\x00CHANGESET\x00LEFT RIGHT\x00-next\x00?-next? ?-invert? VARNAME CHANGESET SCRIPT\x00configure\x00REBASE-BLOB\x00rebase\x00OP VALUE\x00strm_size\x00sqlite3session\x00sqlite3session_foreach\x00sqlite3changeset_invert\x00sqlite3changeset_concat\x00sqlite3changeset_apply\x00sqlite3changeset_apply_v2\x00sqlite3changeset_apply_replace_all\x00sql_exec_changeset\x00sqlite3rebaser_create\x00sqlite3session_config\x00incrblob\x00incrblob_%d\x00%lld\x00sqlite_unlock_notify_arg\x00sqlite_unlock_notify_argcount\x00SQLITE_COPY\x00SQLITE_CREATE_INDEX\x00SQLITE_CREATE_TABLE\x00SQLITE_CREATE_TEMP_INDEX\x00SQLITE_CREATE_TEMP_TABLE\x00SQLITE_CREATE_TEMP_TRIGGER\x00SQLITE_CREATE_TEMP_VIEW\x00SQLITE_CREATE_TRIGGER\x00SQLITE_CREATE_VIEW\x00SQLITE_DELETE\x00SQLITE_DROP_INDEX\x00SQLITE_DROP_TABLE\x00SQLITE_DROP_TEMP_INDEX\x00SQLITE_DROP_TEMP_TABLE\x00SQLITE_DROP_TEMP_TRIGGER\x00SQLITE_DROP_TEMP_VIEW\x00SQLITE_DROP_TRIGGER\x00SQLITE_DROP_VIEW\x00SQLITE_INSERT\x00SQLITE_PRAGMA\x00SQLITE_READ\x00SQLITE_SELECT\x00SQLITE_TRANSACTION\x00SQLITE_UPDATE\x00SQLITE_ATTACH\x00SQLITE_DETACH\x00SQLITE_ALTER_TABLE\x00SQLITE_REINDEX\x00SQLITE_ANALYZE\x00SQLITE_CREATE_VTABLE\x00SQLITE_DROP_VTABLE\x00SQLITE_FUNCTION\x00SQLITE_SAVEPOINT\x00SQLITE_RECURSIVE\x00????\x00SQLITE_DENY\x00SQLITE_IGNORE\x00RELEASE _tcl_transaction\x00COMMIT\x00ROLLBACK TO _tcl_transaction ; RELEASE _tcl_transaction\x00option\x00?CALLBACK?\x00?DATABASE? FILENAME\x00cannot open target database: \x00backup failed: \x00CALLBACK\x00cache option ?arg?\x00flush\x00size\x00size n\x00cannot convert \"\x00\" to integer\x00bad option \"\x00\": must be flush or size\x00NAME SCRIPT\x00?OPTION? ?BOOLEAN?\x00unknown config option: \"\x00\"\x00CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?\x00\t\x00Error: non-null separator required for copy\x00rollback\x00abort\x00fail\x00ignore\x00replace\x00Error: \"\x00\", conflict-algorithm must be one of: rollback, abort, fail, ignore, or replace\x00SELECT * FROM '%q'\x00Error: no such table: \x00Error: \x00Error: can't malloc()\x00INSERT OR %q INTO '%q' VALUES(?\x00Error: cannot open file: \x00BEGIN\x00Error: %s line %d: expected %d columns of data but found %d\x00, failed while processing line: \x00?DATABASE? VALUE\x00-maxsize\x00-readonly\x00unknown option: \x00unable to set MEMDB content\x00extension loading is turned off at compile-time\x00-withoutnulls\x00unknown option: \"\x00?OPTIONS? SQL ?ARRAY-NAME? ?SCRIPT?\x00NAME ?SWITCHES? SCRIPT\x00-argcount\x00option requires an argument: \x00number of arguments must be non-negative\x00-deterministic\x00-directonly\x00-innocuous\x00-returntype\x00real\x00text\x00blob\x00any\x00type\x00\": must be -argcount, -deterministic, -directonly, -innocuous, or -returntype\x00?-readonly? ?DB? TABLE COLUMN ROWID\x00NULLVALUE\x00N CALLBACK\x00KEY\x00cannot open source database: \x00restore failed: \x00restore failed: source database busy\x00?DATABASE?\x00(step|sort|autoindex)\x00sort\x00autoindex\x00vmstep\x00bad argument: should be autoindex, step, sort or vmstep\x00MILLISECONDS\x00?CALLBACK? ?MASK?\x00trace type\x00SAVEPOINT _tcl_transaction\x00[TYPE] SCRIPT\x00transaction type\x00BEGIN EXCLUSIVE\x00BEGIN IMMEDIATE\x00?SCRIPT?\x00SUB-COMMAND ?ARGS?\x00hook ?SCRIPT?\x00INDEX\x00-use-legacy-prepare\x00-last-stmt-ptr\x00%p\x00unknown argument: \x00authorizer\x00backup\x00bind_fallback\x00busy\x00cache\x00changes\x00collate\x00collation_needed\x00commit_hook\x00complete\x00config\x00copy\x00deserialize\x00enable_load_extension\x00errorcode\x00exists\x00function\x00interrupt\x00last_insert_rowid\x00nullvalue\x00onecolumn\x00preupdate\x00profile\x00rekey\x00restore\x00rollback_hook\x00serialize\x00status\x00timeout\x00total_changes\x00trace\x00trace_v2\x00transaction\x00unlock_notify\x00update_hook\x00version\x00wal_hook\x00defensive\x00dqs_ddl\x00dqs_dml\x00enable_fkey\x00enable_qpsg\x00enable_trigger\x00enable_view\x00fts3_tokenizer\x00legacy_alter_table\x00legacy_file_format\x00load_extension\x00no_ckpt_on_close\x00reset_database\x00trigger_eqp\x00trusted_schema\x00writable_schema\x00statement\x00row\x00deferred\x00exclusive\x00immediate\x00depth\x00hook\x00new\x00old\x00HANDLE ?FILENAME? ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN? ?-nofollow BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex BOOLEAN? ?-uri BOOLEAN?\x00-version\x00-sourceid\x00-has-codec\x000\x00-key\x00-vfs\x00-create\x00-nofollow\x00-nomutex\x00-fullmutex\x00-uri\x00-translatefilename\x00sqlite3\x00sqlite\x003.36.0\x00if {[llength $argv]>=1} {\nset argv0 [lindex $argv 0]\nset argv [lrange $argv 1 end]\nsource $argv0\n} else {\nset line {}\nwhile {![eof stdin]} {\nif {$line!=\"\"} {\nputs -nonewline \"> \"\n} else {\nputs -nonewline \"% \"\n}\nflush stdout\nappend line [gets stdin]\nif {[info complete $line]} {\nif {[catch {uplevel #0 $line} result]} {\nputs stderr \"Error: $result\"\n} elseif {$result!=\"\"} {\nputs $result\n}\nset line {}\n} else {\nappend line \\n\n}\n}\n}\n\x00SQLITE_DEBUG_BREAK\x00attach debugger to process %d and press any key to continue.\n\x00utf-8\x00argc\x00argv0\x00argv\x00errorInfo\x00%s: %s\n\x00SQLITE-CONNECTION\x00command not found: \x00error code %s (%d) does not match sqlite3_errcode %s (%d)\x00OMIT_MISUSE\x00wrong # args: should be \"\x00 DB FORMAT STRING\x00 DB HEX\x00 DB\x00 DB SQL\x00%z%s%s\x00%s%n\x00abcdefghijklmnopqrstuvwxyz\x00 DB FORMAT STRING ?COUNT?\x00 DB\"\x00 FILENAME\"\x00%02x\x00%04x\x00tkt2213 is not fixed\x00text16\x00bytes\x00bytes16\x00noop\x00x_coalesce\x00hex8\x00hex16\x00tkt2213func\x00pointer_change\x00counter1\x00counter2\x00intreal\x00x_sqlite_exec\x00value of 40 handed to x_count\x00x_count totals to 42\x00x_count\x00legacy_count\x00 TEXT\"\x00 FORMAT INT INT INT\"\x00argument is not a valid 64-bit integer\x00 FORMAT INT INT ?STRING?\"\x00 INT FORMAT INT INT ?STRING?\"\x00N must be non-negative\x00 FORMAT INT INT DOUBLE\"\x00 FORMAT DOUBLE DOUBLE\"\x00 FORMAT STRING\"\x00%08x%08x\x002nd argument should be 16-characters of hex\x00?BOOLEAN?\x00DB BOOLEAN\x00DB dbname tblname colname\x00CHANNEL ROWID\x00DB-HANDLE NAME CMP-PROC DEL-PROC\x00sqlite3_create_collate_v2() failed to detect an invalid encoding\x00utf8\x00utf16\x00utf16le\x00utf16be\x00DB NAME NARG ENC SWITCHES...\x00encoding\x00-func\x00-step\x00-final\x00-destroy\x00switch\x00DB-HANDLE FILE ?PROC?\x00this build omits sqlite3_load_extension()\x00DB-HANDLE ONOFF\x00string\x00value\x00first argument should be one of: int int64 string double null value\x00 DB FUNCTION-NAME\x00 <STMT>\x00STMT PARAMETER RESETFLAG\x00SQLITE_STMTSTATUS_FULLSCAN_STEP\x00SQLITE_STMTSTATUS_SORT\x00SQLITE_STMTSTATUS_AUTOINDEX\x00SQLITE_STMTSTATUS_VM_STEP\x00SQLITE_STMTSTATUS_REPREPARE\x00SQLITE_STMTSTATUS_RUN\x00SQLITE_STMTSTATUS_MEMUSED\x00NBYTE\x00DB DBNAME\x00DB DBNAME SNAPSHOT\x00SNAPSHOT\x00SNAPSHOT1 SNAPSHOT2\x00bad SNAPSHOT\x00FILE\x00PATH\x00 DB STMT\x00 STMT\x00 FROM-STMT TO-STMT\x00 VM IDX VALUE (null|static|normal)\"\x00static\x00static-nbytes\x00normal\x00blob10\x00abc\x00xyz\x00pq\x004th argument should be \"null\" or \"static\" or \"normal\"\x00(%d) \x00test_collate\x00UTF-8\x00UTF-16LE\x00UTF-16BE\x00 <DB> <utf8> <utf16le> <utf16be>\x00utf16bin\x00utf16_unaligned\x00utf16_aligned\x00test_function\x00<error code>\x00STMT IDX N\x00 STMT N VALUE\x00NaN\x00SNaN\x00-NaN\x00-SNaN\x00+Inf\x00-Inf\x00Epsilon\x00-Epsilon\x00NaN0\x00-NaN0\x00 STMT N\x00 STMT N VALUE BYTES\x00 STMT N DATA BYTES\x00cannot use %d blob bytes, have %d\x00-transient\x00-static\x00-int32\x00-int64\x00-double\x00-text\x00--\x00text data must be either -static or -transient\x00cannot be both -static and -transient\x00[OPTIONS] STMT IDX VALUE ...\x00STMT\x00STMT N\x00STMT NAME\x00 DB sql bytes ?tailvar?\x00 DB sql bytes tailvar\x00 DB sql bytes flags tailvar\x00\x00SELECT 1\x00 filename options-list\x00FILENAME FLAGS VFS\x00SQLITE_OPEN_READONLY\x00SQLITE_OPEN_READWRITE\x00SQLITE_OPEN_CREATE\x00SQLITE_OPEN_DELETEONCLOSE\x00SQLITE_OPEN_EXCLUSIVE\x00SQLITE_OPEN_AUTOPROXY\x00SQLITE_OPEN_MAIN_DB\x00SQLITE_OPEN_TEMP_DB\x00SQLITE_OPEN_TRANSIENT_DB\x00SQLITE_OPEN_MAIN_JOURNAL\x00SQLITE_OPEN_TEMP_JOURNAL\x00SQLITE_OPEN_SUBJOURNAL\x00SQLITE_OPEN_SUPER_JOURNAL\x00SQLITE_OPEN_NOMUTEX\x00SQLITE_OPEN_FULLMUTEX\x00SQLITE_OPEN_SHAREDCACHE\x00SQLITE_OPEN_PRIVATECACHE\x00SQLITE_OPEN_WAL\x00SQLITE_OPEN_URI\x00flag\x00<utf-16 sql>\x00 STMT column\x00FLOAT\x00TEXT\x00BLOB\x00 DB MAGIC\x00SQLITE_MAGIC_OPEN\x00SQLITE_MAGIC_CLOSED\x00SQLITE_MAGIC_BUSY\x00SQLITE_MAGIC_ERROR\x00 DB function-name\x00VARIABLE\x00?N?\x001234567890000000\x00__one\x00__two\x00notadatabase\x00Unexpected non-zero errno: \x00DB [DBNAME]\x00%u\x00DB DBNAME SIZE\x00 DB PWD\x00 DB FLAG\x00%d %d\x00 DB ?AUXDB?\x00DB N\x00 DB ID VALUE\x00unknown limit type: \x00SQLITE_LIMIT_LENGTH\x00SQLITE_LIMIT_SQL_LENGTH\x00SQLITE_LIMIT_COLUMN\x00SQLITE_LIMIT_EXPR_DEPTH\x00SQLITE_LIMIT_COMPOUND_SELECT\x00SQLITE_LIMIT_VDBE_OP\x00SQLITE_LIMIT_FUNCTION_ARG\x00SQLITE_LIMIT_ATTACHED\x00SQLITE_LIMIT_LIKE_PATTERN_LENGTH\x00SQLITE_LIMIT_VARIABLE_NUMBER\x00SQLITE_LIMIT_TRIGGER_DEPTH\x00SQLITE_LIMIT_WORKER_THREADS\x00SQLITE_LIMIT_TOOSMALL\x00SQLITE_LIMIT_TOOBIG\x00SEED ?DB?\x00BOOLEAN\x00current\x00max\x00min\x00recyclable\x00DB ?NAME?\x00passive\x00full\x00restart\x00truncate\x00DB MODE ?NAME?\x00mode\x00DB VALUE\x00COMMAND ...\x00command has no objProc: \x00%d %d %d %s\n\x00SQLITE_TESTCTRL_LOCALTIME_FAULT\x00SQLITE_TESTCTRL_SORTER_MMAP\x00SQLITE_TESTCTRL_IMPOSTER\x00SQLITE_TESTCTRL_INTERNAL_FUNCTIONS\x00VERB ARGS...\x00VERB\x00ONOFF\x00DB LIMIT\x00DB dbName onOff tnum\x00ru_utime=%d.%06d ru_stime=%d.%06d ru_minflt=%d ru_majflt=%d\x00DB OPT BOOLEAN\x00unknown optimization - should be one of:\x00all\x00none\x00query-flattener\x00groupby-order\x00factor-constants\x00distinct-opt\x00cover-idx-scan\x00order-by-idx-join\x00transitive\x00omit-noop-join\x00stat4\x00skip-scan\x00push-down\x00DB NAME ...\x00no such extension: \x00initialization of \x00 failed: \x00amatch\x00appendvfs\x00closure\x00fileio\x00nextchar\x00series\x00spellfix\x00totype\x00DB SQL1 NSTEP SQL2\x00data error: (a!=b)\x00checksum mismatch\x00sql error: \x00TYPE\x00Deliberate panic\x00DB SETTING [VALUE]\x00SQLITE_*\x00DBCONFIG_*\x00ENABLE_*\x00unknown sqlite3_db_config setting\x00FKEY\x00TRIGGER\x00FTS3_TOKENIZER\x00LOAD_EXTENSION\x00NO_CKPT_ON_CLOSE\x00QPSG\x00TRIGGER_EQP\x00RESET_DB\x00DEFENSIVE\x00WRITABLE_SCHEMA\x00LEGACY_ALTER_TABLE\x00DQS_DML\x00DQS_DDL\x00LEGACY_FILE_FORMAT\x00DB ?SCHEMA?\x00icecube\x00DB ?DBNAME?\x00DB OFFSET DATA\x00HEXDB\x00| size %d pagesize %d\x00bad 'pagesize' field\x00bad 'size' field\x00| page %d offset %d\x00| %d: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x\x00sqlite_search_count\x00sqlite_found_count\x00sqlite_sort_count\x00sqlite3_max_blobsize\x00sqlite_like_count\x00sqlite_interrupt_count\x00sqlite_open_file_count\x00sqlite_current_time\x00sqlite3_xferopt_count\x00sqlite3_pager_readdb_count\x00sqlite3_pager_writedb_count\x00sqlite3_pager_writej_count\x00unaligned_string_counter\x00sqlite_last_needed_collation\x00sqlite_query_plan\x00sqlite_opentemp_count\x00sqlite_static_bind_value\x00sqlite_static_bind_nbyte\x00sqlite_temp_directory\x00sqlite_data_directory\x00bitmask_size\x00longdouble_size\x00sqlite_sync_count\x00sqlite_fullsync_count\x00db_enter\x00db_leave\x00sqlite3_mprintf_int\x00sqlite3_mprintf_int64\x00sqlite3_mprintf_long\x00sqlite3_mprintf_str\x00sqlite3_snprintf_str\x00sqlite3_mprintf_stronly\x00sqlite3_mprintf_double\x00sqlite3_mprintf_scaled\x00sqlite3_mprintf_hexdouble\x00sqlite3_mprintf_z_test\x00sqlite3_mprintf_n_test\x00sqlite3_snprintf_int\x00sqlite3_last_insert_rowid\x00sqlite3_exec_printf\x00sqlite3_exec_hex\x00sqlite3_exec\x00sqlite3_exec_nr\x00sqlite3_get_table_printf\x00sqlite3_close\x00sqlite3_close_v2\x00sqlite3_create_function\x00sqlite3_create_aggregate\x00sqlite3_drop_modules\x00sqlite_register_test_function\x00sqlite_abort\x00sqlite_bind\x00breakpoint\x00sqlite3_key\x00sqlite3_rekey\x00sqlite_set_magic\x00sqlite3_interrupt\x00sqlite_delete_function\x00sqlite_delete_collation\x00sqlite3_get_autocommit\x00sqlite3_busy_timeout\x00printf\x00sqlite3IoTrace\x00clang_sanitize_address\x00sqlite3_db_config\x00sqlite3_txn_state\x00bad_behavior\x00register_dbstat_vtab\x00sqlite3_connection_pointer\x00intarray_addr\x00int64array_addr\x00doublearray_addr\x00textarray_addr\x00sqlite3_bind_int\x00sqlite3_bind_zeroblob\x00sqlite3_bind_zeroblob64\x00sqlite3_bind_int64\x00sqlite3_bind_double\x00sqlite3_bind_null\x00sqlite3_bind_text\x00sqlite3_bind_text16\x00sqlite3_bind_blob\x00sqlite3_carray_bind\x00sqlite3_bind_parameter_count\x00sqlite3_bind_parameter_name\x00sqlite3_bind_parameter_index\x00sqlite3_clear_bindings\x00sqlite3_sleep\x00sqlite3_errcode\x00sqlite3_extended_errcode\x00sqlite3_errmsg\x00sqlite3_errmsg16\x00sqlite3_open\x00sqlite3_open16\x00sqlite3_open_v2\x00sqlite3_complete16\x00sqlite3_normalize\x00sqlite3_prepare\x00sqlite3_prepare16\x00sqlite3_prepare_v2\x00sqlite3_prepare_v3\x00sqlite3_prepare_tkt3134\x00sqlite3_prepare16_v2\x00sqlite3_finalize\x00sqlite3_stmt_status\x00sqlite3_reset\x00sqlite3_expired\x00sqlite3_transfer_bindings\x00sqlite3_changes\x00sqlite3_step\x00sqlite3_sql\x00sqlite3_expanded_sql\x00sqlite3_next_stmt\x00sqlite3_stmt_readonly\x00sqlite3_stmt_isexplain\x00sqlite3_stmt_busy\x00uses_stmt_journal\x00sqlite3_release_memory\x00sqlite3_db_release_memory\x00sqlite3_db_cacheflush\x00sqlite3_system_errno\x00sqlite3_db_filename\x00sqlite3_db_readonly\x00sqlite3_soft_heap_limit\x00sqlite3_soft_heap_limit64\x00sqlite3_hard_heap_limit64\x00sqlite3_thread_cleanup\x00sqlite3_pager_refcounts\x00sqlite3_load_extension\x00sqlite3_enable_load_extension\x00sqlite3_extended_result_codes\x00sqlite3_limit\x00dbconfig_maindbname_icecube\x00save_prng_state\x00restore_prng_state\x00reset_prng_state\x00prng_seed\x00extra_schema_checks\x00database_never_corrupt\x00database_may_be_corrupt\x00optimization_control\x00tcl_objproc\x00sqlite3_column_count\x00sqlite3_data_count\x00sqlite3_column_type\x00sqlite3_column_blob\x00sqlite3_column_double\x00sqlite3_column_int64\x00sqlite3_column_text\x00sqlite3_column_name\x00sqlite3_column_int\x00sqlite3_column_bytes\x00sqlite3_column_decltype\x00sqlite3_column_database_name\x00sqlite3_column_table_name\x00sqlite3_column_origin_name\x00sqlite3_column_bytes16\x00sqlite3_column_text16\x00sqlite3_column_name16\x00add_alignment_test_collations\x00sqlite3_column_decltype16\x00sqlite3_column_database_name16\x00sqlite3_column_table_name16\x00sqlite3_column_origin_name16\x00sqlite3_create_collation_v2\x00sqlite3_global_recover\x00working_64bit_int\x00vfs_unlink_test\x00vfs_initfail_test\x00vfs_unregister_all\x00vfs_reregister_all\x00file_control_test\x00file_control_lasterrno_test\x00file_control_lockproxy_test\x00file_control_chunksize_test\x00file_control_sizehint_test\x00file_control_data_version\x00file_control_persist_wal\x00file_control_powersafe_overwrite\x00file_control_vfsname\x00file_control_reservebytes\x00file_control_tempfilename\x00file_control_external_reader\x00sqlite3_vfs_list\x00sqlite3_create_function_v2\x00add_test_collate\x00add_test_collate_needed\x00add_test_function\x00add_test_utf16bin_collate\x00sqlite3_test_errstr\x00tcl_variable_type\x00sqlite3_enable_shared_cache\x00sqlite3_shared_cache_report\x00sqlite3_libversion_number\x00sqlite3_table_column_metadata\x00sqlite3_blob_reopen\x00pcache_stats\x00sqlite3_unlock_notify\x00sqlite3_wal_checkpoint\x00sqlite3_wal_checkpoint_v2\x00sqlite3_wal_autocheckpoint\x00test_sqlite3_log\x00print_explain_query_plan\x00sqlite3_test_control\x00getrusage\x00load_static_extension\x00sorter_test_fakeheap\x00sorter_test_sort4_helper\x00vfs_current_time_int64\x00sqlite3_snapshot_get\x00sqlite3_snapshot_open\x00sqlite3_snapshot_free\x00sqlite3_snapshot_cmp\x00sqlite3_snapshot_recover\x00sqlite3_snapshot_get_blob\x00sqlite3_snapshot_open_blob\x00sqlite3_snapshot_cmp_blob\x00sqlite3_delete_database\x00atomic_batch_write\x00sqlite3_mmap_warm\x00sqlite3_config_sorterref\x00decode_hexdb\x00test_write_db\x00sqlite3_register_cksumvfs\x00sqlite3_unregister_cksumvfs\x00*** OBSOLETE VARIABLE ***\x00 FILENAME N-PAGE\"\x00 ID\"\x00ref\x00page\x00err\x00hit\x00miss\x00ovfl\x00 ID PGNO\"\x00 PAGE\"\x00 PAGE DATA\"\x00 N-MEGABYTES FILE\"\x00open failed: \x00Hello, World!\x00write failed: \x00 PENDING-BYTE\"\x00fault simulator script failed: [%s]\x00 SCRIPT\"\x00 SIZE PROGRAM\"\x00sqlite_io_error_pending\x00sqlite_io_error_persist\x00sqlite_io_error_hit\x00sqlite_io_error_hardhit\x00sqlite_diskfull_pending\x00sqlite_diskfull\x00sqlite_pending_byte\x00pager_open\x00pager_close\x00pager_commit\x00pager_rollback\x00pager_stmt_begin\x00pager_stmt_commit\x00pager_stmt_rollback\x00pager_stats\x00pager_pagecount\x00page_get\x00page_lookup\x00page_unref\x00page_read\x00page_write\x00page_number\x00pager_truncate\x00fake_big_file\x00sqlite3BitvecBuiltinTest\x00sqlite3_test_control_pending_byte\x00sqlite3_test_control_fault_install\x00 FILENAME NCACHE FLAGS\"\x00read\x00write\x00 ID TABLENUM WRITEABLE\"\x00 START MULTIPLIER COUNT INCREMENT\"\x00putVarint returned %d - should be between 1 and 9\x00putVarint returned %d and getVarint returned %d\x00Wrote 0x%016llx and got back 0x%016llx\x00putVarint returned %d and GetVarint32 returned %d\x00Wrote 0x%016llx and got back 0x%016llx from GetVarint32\x00 DB-HANDLE ?N?\"\x00No such db-handle: \"\x00 BT NCACHE\"\x00?-intkey? CSR KEY VALUE\x00btree_insert\x00btree_open\x00btree_close\x00btree_begin_transaction\x00btree_pager_stats\x00btree_cursor\x00btree_close_cursor\x00btree_next\x00btree_eof\x00btree_payload_size\x00btree_first\x00btree_varint_test\x00btree_from_db\x00btree_ismemdb\x00btree_set_cache_size\x00thread ID must be an upper case letter\x00 ID FILENAME\x00thread \x00 is already running\x00failed to create the thread\x00 ID\x00no such thread\x00 ID N\x00column number out of range\x00no database is open\x00 ID SQL\x00no virtual machine available\x00 IDL\x00 ID1 ID2\x00 ID DB\x00thread_create\x00thread_wait\x00thread_halt\x00thread_argc\x00thread_argv\x00thread_colname\x00thread_result\x00thread_error\x00thread_compile\x00thread_step\x00thread_finalize\x00thread_swap\x00thread_db_get\x00thread_db_put\x00thread_stmt_get\x00 <repeat-count> <do-calls>\x00hello world\x00UTF8\x00UTF16LE\x00UTF16BE\x00UTF16\x00No such encoding: \x00 <string/blob> <from enc> <to enc>\x00binarize\x00test_value_overhead\x00test_translate\x00translate_selftest\x00out of memory in the crash simulator\n\x00atomic\x00atomic512\x00atomic1k\x00atomic2k\x00atomic4k\x00atomic8k\x00atomic16k\x00atomic32k\x00atomic64k\x00sequential\x00safe_append\x00powersafe_overwrite\x00batch-atomic\x00-sectorsize\x00-characteristics\x00Bad option: \"\x00\" - must be \"-characteristics\" or \"-sectorsize\"\x00Option requires an argument: \"\x00no such flag\x00ENABLE ?DEFAULT?\x00crash\x00?OPTIONS? DELAY CRASHFILE\x00Filename is too long: \"\x00NWRITE\x00?-default? PARENT-VFS\x00-default\x00\": must be -default\x00Error in jt_register\x00sqlite3_crash_enable\x00sqlite3_crashparams\x00sqlite3_crash_now\x00sqlite3_simulate_device\x00sqlite3_crash_on_write\x00unregister_devsim\x00register_jt_vfs\x00unregister_jt_vfs\x00client_create\x00client_wait\x00client_halt\x00client_argc\x00client_argv\x00client_colname\x00client_result\x00client_error\x00client_compile\x00client_step\x00client_reset\x00client_finalize\x00client_swap\x00echo_module_fail(%s,%s)\x00echo-vtab-error: %s\x00SELECT * FROM %Q\x00PRAGMA index_list(%s)\x00PRAGMA index_info(%s)\x00echo_module\x00SELECT sql FROM sqlite_schema WHERE type = 'table' AND name = ?\x00%s%s\x00xCreate\x00CREATE TABLE %Q(logmsg)\x00xConnect\x00xDisconnect\x00xDestroy\x00DROP TABLE %Q\x00xOpen\x00xNext\x00xColumn\x00xFilter\x00, *\x00%z, %s\x00%z, NULL\x00echo_module_ignore_usable\x00xBestIndex\x00echo_module_cost\x00SELECT count(*) FROM %Q\x00SELECT rowid%z FROM %Q\x00rowid\x00=\x00<\x00>\x00<=\x00>=\x00LIKE\x00like\x00glob\x00 %s %s LIKE (SELECT '%%'||?||'%%')\x00 %s %s %s ?\x00DESC\x00ASC\x00 ORDER BY %s %s\x00xUpdate\x00 SET\x00UPDATE %Q\x00 SET rowid=?1 \x00%s %Q=?%d\x00 WHERE rowid=?%d\x00DELETE FROM %Q WHERE rowid = ?1\x00INSERT INTO %Q (\x00%s%Q\x00%s?%d\x00) VALUES(\x00echo(%s)\x00xBegin\x00echo_module_begin_fail\x00xSync\x00echo_module_sync_fail\x00xCommit\x00xRollback\x00::echo_glob_overload\x00xRename\x00ALTER TABLE %s RENAME TO %s%s\x00function_that_does_not_exist_0982ma98\x00echo\x00echo_v2\x00register_echo_module\x00sqlite3_declare_vtab\x00N/A\x00sqlite3_create_collation\x00Error testing function: \x00sqlite3_malloc\x00sqlite3_realloc\x00c_misuse_test\x00c_realloc_test\x00c_collation_test\x00sqlite3_reset_auto_extension\x00npage\x00finish\x00remaining\x00pagecount\x00CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME\x00sqlite3_backup_init() failed\x00sqlite3_backup\x00wrong number of arguments\x00unexpected: %s\x00eq\x00gt\x00le\x00lt\x00ge\x00match\x00ne\x00isnot\x00isnotnull\x00isnull\x00op\x00column\x00usable\x00desc\x00cost\x00orderby\x00idxnum\x00idxstr\x00rows\x00use\x00omit\x00unexpected: %d\x00tcl\x00register_tcl_module\x00incrblob_\x00DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME\x00HANDLE\x00CHANNEL OFFSET N\x00out of memory in testdata/sqlite-src-3360000/src/test_blob.c\x00HANDLE OFFSET DATA ?NDATA?\x00sqlite3_blob_open\x00sqlite3_blob_close\x00sqlite3_blob_bytes\x00sqlite3_blob_read\x00sqlite3_blob_write\x00sqlite_options\x00malloc_usable_size\x001\x00rowid32\x00casesensitivelike\x00configslower\x001.0\x00curdir\x00win32malloc\x00debug\x00default_ckptfullfsync\x00direct_read\x00dirsync\x00lfs\x00pagecache_overflow_stats\x00mmap\x00worker_threads\x008\x00memdebug\x008_3_names\x00cursorhints\x00hiddencolumns\x00mathlib\x00mem3\x00mem5\x00offset_sql_func\x00snapshot\x00mutex\x00mutex_noop\x00altertable\x00api_armor\x00atomicwrite\x00geopoly\x00json1\x00has_codec\x00like_match_blobs\x00auth\x00autoinc\x00autoreset\x00autovacuum\x00default_autovacuum\x00between_opt\x00builtin_test\x00bloblit\x00cast\x00check\x00cte\x00columnmetadata\x00oversize_cell_check\x00compileoption_diags\x00compound\x00conflict\x00crashtest\x00datetime\x00decltype\x00deprecated\x00diskio\x00floatingpoint\x00foreignkey\x00fts1\x00fts2\x00fts3\x00fts5\x00fts3_unicode\x00fts4_deferred\x00gettable\x00icu\x00icu_collations\x00integrityck\x00legacyformat\x00like_opt\x00load_ext\x00localtime\x00lookaside\x00long_double\x00memorydb\x00memorymanage\x00mergesort\x00null_trim\x00or_opt\x00rbu\x00pager_pragmas\x00pragma\x00reindex\x00rtree\x00rtree_int_only\x00schema_pragmas\x00schema_version\x00session\x00stmtvtab\x00scanstatus\x00lock_proxy_pragmas\x00prefer_proxy_locking\x00shared_cache\x00subquery\x00tclvar\x00threadsafe\x00threadsafe1\x00threadsafe2\x00tempdb\x00trigger\x00truncate_opt\x00vacuum\x00view\x00vtab\x00wal\x00wsd\x00update_delete_limit\x00fast_secure_delete\x00secure_delete\x00userauth\x00multiplex_ext_overwrite\x00yytrackmaxstackdepth\x00sqllog\x00uri_00_error\x00normalize\x00windowfunc\x00SQLITE_MAX_LENGTH\x00SQLITE_MAX_COLUMN\x00SQLITE_MAX_SQL_LENGTH\x00SQLITE_MAX_EXPR_DEPTH\x00SQLITE_MAX_COMPOUND_SELECT\x00SQLITE_MAX_VDBE_OP\x00SQLITE_MAX_FUNCTION_ARG\x00SQLITE_MAX_VARIABLE_NUMBER\x00SQLITE_MAX_PAGE_SIZE\x00SQLITE_MAX_PAGE_COUNT\x00SQLITE_MAX_LIKE_PATTERN_LENGTH\x00SQLITE_MAX_TRIGGER_DEPTH\x00SQLITE_DEFAULT_CACHE_SIZE\x00SQLITE_DEFAULT_PAGE_SIZE\x00SQLITE_DEFAULT_FILE_FORMAT\x00SQLITE_DEFAULT_SYNCHRONOUS\x00SQLITE_DEFAULT_WAL_SYNCHRONOUS\x00SQLITE_MAX_ATTACHED\x00SQLITE_MAX_DEFAULT_PAGE_SIZE\x00SQLITE_MAX_WORKER_THREADS\x00TEMP_STORE\x00__GNUC__\x00%s-journal\x00%s-wal\x00%s-shm\x00%s%03d\x00%s-journal%03d\x00%s-wal%03d\x00devsym\x00writecrash\x00CREATE TABLE xyz(dir, name);\x00CREATE TABLE xyz(path, size, data);\x00WITH r(d) AS (  SELECT CASE WHEN dir=?2 THEN ?3 ELSE dir END || '/' || name     FROM fsdir WHERE dir=?1 AND name NOT LIKE '.%'  UNION ALL  SELECT dir || '/' || name FROM r, fsdir WHERE dir=d AND name NOT LIKE '.%') SELECT d FROM r;\x00/\x00CREATE TABLE x(path TEXT, data TEXT)\x00SELECT * FROM %Q.%Q WHERE rowid=?\x00fs\x00fstree\x00register_fs_module\x00abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-!,:*^+=_|?/<> \x00sqlite3_prepare_v2() error: %s\x000123456789abcdef\x00x'\x00test_agg_errmsg16\x00randstr\x00test_destructor\x00test_destructor16\x00hex_to_utf16be\x00hex_to_utf16le\x00hex_to_utf8\x00test_destructor_count\x00test_auxdata\x00test_error\x00test_eval\x00test_isolation\x00test_counter\x00real2hex\x00test_decode\x00test_extract\x00test_zeroblob\x00test_getsubtype\x00test_setsubtype\x00test_frombind\x00tx\x00funcxx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789\x00nullx_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789\x00sqlite3_create_function abused test failed\x00invalid matchinfo blob passed to function rank()\x00wrong number of arguments to function rank()\x00rank\x00autoinstall_test_functions\x00abuse_create_function\x00install_fts3_rank_function\x000123456789ABCDEF\x00FILENAME OFFSET AMT\x00r\x00cannot open input file \x00FILENAME OFFSET HEXDATA\x00r+b\x00r+\x00cannot open output file \x00HEXDATA\x00[utf8_to_utf8] unavailable - SQLITE_DEBUG not defined\x00BLOB VARNAME\x00LIST\x00hexio_read\x00hexio_write\x00hexio_get_int\x00hexio_render_int16\x00hexio_render_int32\x00utf8_to_utf8\x00read_fts3varint\x00make_fts3record\x00mem\x00pcache\x00Unknown argument: \"\x00init_wrapper_install\x00init_wrapper_query\x00init_wrapper_uninstall\x00init_wrapper_clear\x00CREATE TABLE x(value INTEGER PRIMARY KEY)\x00CREATE VIRTUAL TABLE temp.%Q USING %Q\x00INTARRAY\x00SQLITE_NOMEM\x00sqlite3_intarray_create\x00sqlite3_intarray_bind\x00jt\x00-journal\x00NBYTES\x00PRIOR NBYTES\x00bad pointer: \x00PRIOR\x00ADDRESS SIZE HEX\x00size must be positive\x00no data\x00ADDRESS SIZE\x00?RESET?\x00DEPT\x00FILENAME\x00COUNTER ?OPTIONS?\x00-repeat\x00-benigncnt\x00TITLE\x00SUB-COMMAND ...\x00start\x00stop\x00dump\x00clear\x00sync\x00SIZE N\x00INSTALLFLAG DISCARDCHANCE PRNGSEEED HIGHSTRESS\x00discard-chance should be between 0 and 100\x00SIZE COUNT\x00BUFID SIZE COUNT\x00illegal arguments - see documentation\x00NBYTE NMINALLOC\x00[DB]\x00sqlite3_db_config(db, 99999) does not return SQLITE_ERROR\x00sqlite3_config(99999) does not return SQLITE_ERROR\x00PARAMETER RESETFLAG\x00SQLITE_STATUS_MEMORY_USED\x00SQLITE_STATUS_MALLOC_SIZE\x00SQLITE_STATUS_PAGECACHE_USED\x00SQLITE_STATUS_PAGECACHE_OVERFLOW\x00SQLITE_STATUS_PAGECACHE_SIZE\x00SQLITE_STATUS_SCRATCH_USED\x00SQLITE_STATUS_SCRATCH_OVERFLOW\x00SQLITE_STATUS_SCRATCH_SIZE\x00SQLITE_STATUS_PARSER_STACK\x00SQLITE_STATUS_MALLOC_COUNT\x00DB PARAMETER RESETFLAG\x00SQLITE_\x00DBSTATUS_\x00LOOKASIDE_USED\x00CACHE_USED\x00SCHEMA_USED\x00STMT_USED\x00LOOKASIDE_HIT\x00LOOKASIDE_MISS_SIZE\x00LOOKASIDE_MISS_FULL\x00CACHE_HIT\x00CACHE_MISS\x00CACHE_WRITE\x00DEFERRED_FKS\x00CACHE_USED_SHARED\x00CACHE_SPILL\x00?INTEGER?\x00sqlite3_free\x00memset\x00memget\x00sqlite3_memory_used\x00sqlite3_memory_highwater\x00sqlite3_memdebug_backtrace\x00sqlite3_memdebug_dump\x00sqlite3_memdebug_fail\x00sqlite3_memdebug_pending\x00sqlite3_memdebug_settitle\x00sqlite3_memdebug_malloc_count\x00sqlite3_memdebug_log\x00sqlite3_config_pagecache\x00sqlite3_config_alt_pcache\x00sqlite3_status\x00sqlite3_db_status\x00install_malloc_faultsim\x00sqlite3_config_heap\x00sqlite3_config_heap_size\x00sqlite3_config_memstatus\x00sqlite3_config_lookaside\x00sqlite3_config_error\x00sqlite3_config_uri\x00sqlite3_config_cis\x00sqlite3_config_pmasz\x00sqlite3_db_config_lookaside\x00sqlite3_dump_memsys3\x00sqlite3_dump_memsys5\x00sqlite3_install_memsys3\x00sqlite3_memdebug_vfs_oom_test\x00%05u\x00 FILENAME [OFFSET AMT]\"\x00unable to open file \"\x00\" for reading\x00md5\x00md5-10x8\x00md5file\x00md5file-10x8\x00md5sum\x00%03d\x00multiplexor.xAccess failure on %s\x00multiplexor.xOpen failure on %s\x00multiplex_control\x00chunksize\x00multiplex_truncate\x00multiplex/%z\x00multiplex\x00NAME MAKEDEFAULT\x00-force\x00?-force?\x00chunk_size\x00max_chunks\x00HANDLE DBNAME SUB-COMMAND INT-VALUE\x00expected database handle, got \"\x00sqlite3_multiplex_initialize\x00sqlite3_multiplex_shutdown\x00sqlite3_multiplex_control\x00fast\x00recursive\x00static_main\x00static_mem\x00static_open\x00static_prng\x00static_lru\x00static_pmem\x00static_app1\x00static_app2\x00static_app3\x00static_vfs1\x00static_vfs2\x00static_vfs3\x00mutex counters are \x00already installed\x00not installed\x00singlethread\x00multithread\x00serialized\x00mutex name\x00disable_mutex_init\x00disable_mutex_try\x00sqlite3_shutdown\x00sqlite3_initialize\x00sqlite3_config\x00enter_static_mutex\x00leave_static_mutex\x00enter_db_mutex\x00leave_db_mutex\x00alloc_dealloc_mutex\x00install_mutex_counters\x00read_mutex_counters\x00clear_mutex_counters\x00\x00\x00\x00\x00\x00\x00\x00vfslog/%z\x00sqlite_ostrace1.....\x00xClose\x00xRead\x00xWrite\x00xTruncate\x00xFilesize\x00xLock\x00xUnlock\x00xCheckResLock\x00xFileControl\x00xSectorSize\x00xDeviceChar\x00xDelete\x00xAccess\x00xFullPathname\x00xRandomness\x00xSleep\x00xCurrentTime\x00xShmUnmap\x00xShmLock\x00xShmBarrier\x00xShmMap\x00annotation\x00CREATE TABLE xxx(event, file, click, rc, size, offset)\x00vfslog\x00VFS\x00failed\x00VFS PARENT LOGFILE\x00bad sqlite3 handle: \x00annotate\x00finalize\x00register\x00quota/%z\x00quota\x00::piLimit_\x00PATTERN LIMIT SCRIPT\x00FILENAME MODE\x00HANDLE SIZE NELEM\x00HANDLE SIZE NELEM CONTENT\x00HANDLE ?HARDSYNC?\x00HANDLE OFFSET WHENCE\x00SEEK_SET\x00SEEK_CUR\x00SEEK_END\x00WHENCE should be SEEK_SET, SEEK_CUR, or SEEK_END\x00HANDLE SIZE\x00PATTERN TEXT\x00sqlite3_quota_initialize\x00sqlite3_quota_shutdown\x00sqlite3_quota_set\x00sqlite3_quota_file\x00sqlite3_quota_dump\x00sqlite3_quota_fopen\x00sqlite3_quota_fread\x00sqlite3_quota_fwrite\x00sqlite3_quota_fclose\x00sqlite3_quota_fflush\x00sqlite3_quota_fseek\x00sqlite3_quota_rewind\x00sqlite3_quota_ftell\x00sqlite3_quota_ftruncate\x00sqlite3_quota_file_size\x00sqlite3_quota_file_truesize\x00sqlite3_quota_file_mtime\x00sqlite3_quota_remove\x00sqlite3_quota_glob\x00sqlite3_quota_file_available\x00sqlite3_quota_ferror\x00cube\x00circle\x00Qcircle\x00breadthfirstsearch\x00register_cube_geom\x00register_circle_geom\x00CREATE TABLE x(database,tablename,cid,name,type,not_null,dflt_value,pk)\x00SELECT name FROM sqlite_temp_schema WHERE type='table'\x00SELECT name FROM %Q.sqlite_schema WHERE type='table'\x00PRAGMA %Q.table_info(%Q)\x00PRAGMA database_list\x00register_schema_module\x00PRAGMA main.journal_mode\x00CMDNAME PATH ?VFS? ?BUSY-HANDLER-SCRIPT?\x00sqlite3demo_superlock\x00open\x00access\x00getcwd\x00stat\x00fstat\x00ftruncate\x00fcntl\x00pread\x00pread64\x00pwrite\x00pwrite64\x00fchmod\x00fallocate\x00mremap\x00SYSCALL-LIST\x00system-call\x00?COUNT PERSIST?\x00EACCES\x00EINTR\x00EIO\x00EOVERFLOW\x00ENOMEM\x00EAGAIN\x00ETIMEDOUT\x00EBUSY\x00EPERM\x00EDEADLK\x00ENOLCK\x00SYSCALL ERRNO\x00errno\x00PGSZ\x00getpagesize\x00pgsz out of range\x00fault\x00install\x00uninstall\x00list\x00defaultvfs\x00pagesize\x00VFS does not support xSetSystemCall\x00test_syscall\x00load_testfixture_extensions\x00SLAVE\x00CREATE TABLE x(  name TEXT,  arrayname TEXT,  value TEXT,  fullname TEXT PRIMARY KEY) WITHOUT ROWID\x00array names\x00tclvar_filter_cmd\x00%s(%s)\x00expr {[info exists ::tclvar_set_omit] && $::tclvar_set_omit}\x00the 'fullname' column must be TEXT\x00prohibited TCL variable change\x00proc like {pattern str} {\n  set p [string map {% * _ ?} $pattern]\n  string match $p $str\n}\nproc tclvar_filter_cmd {eq match glob regexp like} {\n  set res {}\n  set pattern $eq\n  if {$pattern=={}} { set pattern $match }\n  if {$pattern=={}} { set pattern * }\n  foreach v [uplevel #0 info vars $pattern] {\n    if {($glob=={} || [string match $glob [uplevel #0 set $v]])\n     && ($like=={} || [like $like [uplevel #0 set $v]])\n     && ($regexp=={} || [regexp $regexp [uplevel #0 set $v]])\n    } {\n      lappend res $v\n    }\n  }\n  set res\n}\n\x00register_tclvar_module\x00clock_seconds\x00sqlthread\x00sqlite3_blocking_step\x00sqlite3_blocking_prepare_v2\x00sqlite3_nonblocking_prepare_v2\x00set\x00Error in Tcl_CreateThread()\x00no parent thread\x00parent\x00spawn\x00VARNAME SCRIPT\x00DBNAME\x00id\x00%s \x00SQLITE_IOERR\x00SQLITE_LOCKED\x00SQLITE_BUSY\x00SQLITE_READONLY\x00SQLITE_READONLY_CANTINIT\x00SQLITE_NOTFOUND\x00SQLITE_OMIT\x00normal|dataonly\x00full|dataonly\x00xCheckReservedLock\x00BEGIN_ATOMIC_WRITE\x00COMMIT_ATOMIC_WRITE\x00ZIPVFS\x00anon\x00SQLITE_ACCESS_EXISTS\x00SQLITE_ACCESS_READWRITE\x00SQLITE_ACCESS_READ\x00xShmOpen\x00 lock\x00 unlock\x00 shared\x00 exclusive\x00shm\x00filter\x00ioerr\x00fullerr\x00cantopenerr\x00script\x00devchar\x00sectorsize\x00subcommand\x00FILE ?VALUE?\x00failed to get full path: \x00no such file: \x00unknown method: \x00?CNT PERSIST?\x00default\x00undeletable_when_open\x00immutable\x00?ATTR-LIST?\x00bad flags: \x00?VALUE?\x00-noshm\x00-szosfile\x00-mxpathname\x00-iversion\x00-fullshm\x00VFSNAME ?-noshm BOOL? ?-fullshm BOOL? ?-default BOOL? ?-mxpathname INT? ?-szosfile INT? ?-iversion INT?\x00shared\x00lock\x00unlock\x00DB DBNAME (shared|exclusive) (lock|unlock) OFFSET N\x00ARG\x00DB DBNAME SLOT ?VALUE?\x00*-shm is not yet mapped\x00testvfs\x00vfs_shmlock\x00vfs_set_readmark\x00DB NAME XSTEP XFINAL XVALUE XINVERSE\x00fff\x00misuse test error\x00invalid argument\x00sumint\x00sum\x00sqlite3_create_window_function\x00test_create_window_function_misuse\x00test_create_sumint\x00test_override_sum\x00"
 80367  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data