github.com/jdgcs/sqlite3@v1.12.1-0.20210908114423-bc5f96e4dd51/internal/testfixture/testfixture_linux_arm.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_linux_arm.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  )
    17  
    18  var _ = math.Pi
    19  var _ reflect.Kind
    20  var _ atomic.Value
    21  var _ unsafe.Pointer
    22  var _ types.Size_t
    23  
    24  func main() { libc.Start(main1) }
    25  
    26  const (
    27  	BUFSIZ                                = 8192
    28  	EOF                                   = -1
    29  	EXPERT_CONFIG_SAMPLE                  = 1
    30  	EXPERT_REPORT_CANDIDATES              = 4
    31  	EXPERT_REPORT_INDEXES                 = 2
    32  	EXPERT_REPORT_PLAN                    = 3
    33  	EXPERT_REPORT_SQL                     = 1
    34  	FILENAME_MAX                          = 4096
    35  	FOPEN_MAX                             = 16
    36  	FTS5_TOKENIZE_AUX                     = 0x0008
    37  	FTS5_TOKENIZE_DOCUMENT                = 0x0004
    38  	FTS5_TOKENIZE_PREFIX                  = 0x0002
    39  	FTS5_TOKENIZE_QUERY                   = 0x0001
    40  	FTS5_TOKEN_COLOCATED                  = 0x0001
    41  	FULLY_WITHIN                          = 2
    42  	HAVE_USLEEP                           = 1
    43  	IDX_HASH_SIZE                         = 1023
    44  	L_ctermid                             = 9
    45  	L_tmpnam                              = 20
    46  	NDEBUG                                = 1
    47  	NOT_WITHIN                            = 0
    48  	PARTLY_WITHIN                         = 1
    49  	P_tmpdir                              = "/tmp"
    50  	SEEK_CUR                              = 1
    51  	SEEK_END                              = 2
    52  	SEEK_SET                              = 0
    53  	SQLITE3_H                             = 0
    54  	SQLITE3_TEXT                          = 3
    55  	SQLITEEXPERT_H                        = 1
    56  	SQLITE_ABORT                          = 4
    57  	SQLITE_ABORT_ROLLBACK                 = 516
    58  	SQLITE_ACCESS_EXISTS                  = 0
    59  	SQLITE_ACCESS_READ                    = 2
    60  	SQLITE_ACCESS_READWRITE               = 1
    61  	SQLITE_ALTER_TABLE                    = 26
    62  	SQLITE_ANALYZE                        = 28
    63  	SQLITE_ANY                            = 5
    64  	SQLITE_API                            = 0
    65  	SQLITE_APICALL                        = 0
    66  	SQLITE_ATTACH                         = 24
    67  	SQLITE_AUTH                           = 23
    68  	SQLITE_AUTH_USER                      = 279
    69  	SQLITE_BLOB                           = 4
    70  	SQLITE_BUSY                           = 5
    71  	SQLITE_BUSY_RECOVERY                  = 261
    72  	SQLITE_BUSY_SNAPSHOT                  = 517
    73  	SQLITE_BUSY_TIMEOUT                   = 773
    74  	SQLITE_CALLBACK                       = 0
    75  	SQLITE_CANTOPEN                       = 14
    76  	SQLITE_CANTOPEN_CONVPATH              = 1038
    77  	SQLITE_CANTOPEN_DIRTYWAL              = 1294
    78  	SQLITE_CANTOPEN_FULLPATH              = 782
    79  	SQLITE_CANTOPEN_ISDIR                 = 526
    80  	SQLITE_CANTOPEN_NOTEMPDIR             = 270
    81  	SQLITE_CANTOPEN_SYMLINK               = 1550
    82  	SQLITE_CDECL                          = 0
    83  	SQLITE_CHANGESETAPPLY_INVERT          = 0x0002
    84  	SQLITE_CHANGESETAPPLY_NOSAVEPOINT     = 0x0001
    85  	SQLITE_CHANGESETSTART_INVERT          = 0x0002
    86  	SQLITE_CHANGESET_ABORT                = 2
    87  	SQLITE_CHANGESET_CONFLICT             = 3
    88  	SQLITE_CHANGESET_CONSTRAINT           = 4
    89  	SQLITE_CHANGESET_DATA                 = 1
    90  	SQLITE_CHANGESET_FOREIGN_KEY          = 5
    91  	SQLITE_CHANGESET_NOTFOUND             = 2
    92  	SQLITE_CHANGESET_OMIT                 = 0
    93  	SQLITE_CHANGESET_REPLACE              = 1
    94  	SQLITE_CHECKPOINT_FULL                = 1
    95  	SQLITE_CHECKPOINT_PASSIVE             = 0
    96  	SQLITE_CHECKPOINT_RESTART             = 2
    97  	SQLITE_CHECKPOINT_TRUNCATE            = 3
    98  	SQLITE_CKSUMVFS_STATIC                = 1
    99  	SQLITE_CONFIG_COVERING_INDEX_SCAN     = 20
   100  	SQLITE_CONFIG_GETMALLOC               = 5
   101  	SQLITE_CONFIG_GETMUTEX                = 11
   102  	SQLITE_CONFIG_GETPCACHE               = 15
   103  	SQLITE_CONFIG_GETPCACHE2              = 19
   104  	SQLITE_CONFIG_HEAP                    = 8
   105  	SQLITE_CONFIG_LOG                     = 16
   106  	SQLITE_CONFIG_LOOKASIDE               = 13
   107  	SQLITE_CONFIG_MALLOC                  = 4
   108  	SQLITE_CONFIG_MEMDB_MAXSIZE           = 29
   109  	SQLITE_CONFIG_MEMSTATUS               = 9
   110  	SQLITE_CONFIG_MMAP_SIZE               = 22
   111  	SQLITE_CONFIG_MULTITHREAD             = 2
   112  	SQLITE_CONFIG_MUTEX                   = 10
   113  	SQLITE_CONFIG_PAGECACHE               = 7
   114  	SQLITE_CONFIG_PCACHE                  = 14
   115  	SQLITE_CONFIG_PCACHE2                 = 18
   116  	SQLITE_CONFIG_PCACHE_HDRSZ            = 24
   117  	SQLITE_CONFIG_PMASZ                   = 25
   118  	SQLITE_CONFIG_SCRATCH                 = 6
   119  	SQLITE_CONFIG_SERIALIZED              = 3
   120  	SQLITE_CONFIG_SINGLETHREAD            = 1
   121  	SQLITE_CONFIG_SMALL_MALLOC            = 27
   122  	SQLITE_CONFIG_SORTERREF_SIZE          = 28
   123  	SQLITE_CONFIG_SQLLOG                  = 21
   124  	SQLITE_CONFIG_STMTJRNL_SPILL          = 26
   125  	SQLITE_CONFIG_URI                     = 17
   126  	SQLITE_CONFIG_WIN32_HEAPSIZE          = 23
   127  	SQLITE_CONSTRAINT                     = 19
   128  	SQLITE_CONSTRAINT_CHECK               = 275
   129  	SQLITE_CONSTRAINT_COMMITHOOK          = 531
   130  	SQLITE_CONSTRAINT_FOREIGNKEY          = 787
   131  	SQLITE_CONSTRAINT_FUNCTION            = 1043
   132  	SQLITE_CONSTRAINT_NOTNULL             = 1299
   133  	SQLITE_CONSTRAINT_PINNED              = 2835
   134  	SQLITE_CONSTRAINT_PRIMARYKEY          = 1555
   135  	SQLITE_CONSTRAINT_ROWID               = 2579
   136  	SQLITE_CONSTRAINT_TRIGGER             = 1811
   137  	SQLITE_CONSTRAINT_UNIQUE              = 2067
   138  	SQLITE_CONSTRAINT_VTAB                = 2323
   139  	SQLITE_COPY                           = 0
   140  	SQLITE_CORE                           = 1
   141  	SQLITE_CORRUPT                        = 11
   142  	SQLITE_CORRUPT_INDEX                  = 779
   143  	SQLITE_CORRUPT_SEQUENCE               = 523
   144  	SQLITE_CORRUPT_VTAB                   = 267
   145  	SQLITE_CREATE_INDEX                   = 1
   146  	SQLITE_CREATE_TABLE                   = 2
   147  	SQLITE_CREATE_TEMP_INDEX              = 3
   148  	SQLITE_CREATE_TEMP_TABLE              = 4
   149  	SQLITE_CREATE_TEMP_TRIGGER            = 5
   150  	SQLITE_CREATE_TEMP_VIEW               = 6
   151  	SQLITE_CREATE_TRIGGER                 = 7
   152  	SQLITE_CREATE_VIEW                    = 8
   153  	SQLITE_CREATE_VTABLE                  = 29
   154  	SQLITE_DBCONFIG_DEFENSIVE             = 1010
   155  	SQLITE_DBCONFIG_DQS_DDL               = 1014
   156  	SQLITE_DBCONFIG_DQS_DML               = 1013
   157  	SQLITE_DBCONFIG_ENABLE_FKEY           = 1002
   158  	SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004
   159  	SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005
   160  	SQLITE_DBCONFIG_ENABLE_QPSG           = 1007
   161  	SQLITE_DBCONFIG_ENABLE_TRIGGER        = 1003
   162  	SQLITE_DBCONFIG_ENABLE_VIEW           = 1015
   163  	SQLITE_DBCONFIG_LEGACY_ALTER_TABLE    = 1012
   164  	SQLITE_DBCONFIG_LEGACY_FILE_FORMAT    = 1016
   165  	SQLITE_DBCONFIG_LOOKASIDE             = 1001
   166  	SQLITE_DBCONFIG_MAINDBNAME            = 1000
   167  	SQLITE_DBCONFIG_MAX                   = 1017
   168  	SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE      = 1006
   169  	SQLITE_DBCONFIG_RESET_DATABASE        = 1009
   170  	SQLITE_DBCONFIG_TRIGGER_EQP           = 1008
   171  	SQLITE_DBCONFIG_TRUSTED_SCHEMA        = 1017
   172  	SQLITE_DBCONFIG_WRITABLE_SCHEMA       = 1011
   173  	SQLITE_DBSTATUS_CACHE_HIT             = 7
   174  	SQLITE_DBSTATUS_CACHE_MISS            = 8
   175  	SQLITE_DBSTATUS_CACHE_SPILL           = 12
   176  	SQLITE_DBSTATUS_CACHE_USED            = 1
   177  	SQLITE_DBSTATUS_CACHE_USED_SHARED     = 11
   178  	SQLITE_DBSTATUS_CACHE_WRITE           = 9
   179  	SQLITE_DBSTATUS_DEFERRED_FKS          = 10
   180  	SQLITE_DBSTATUS_LOOKASIDE_HIT         = 4
   181  	SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL   = 6
   182  	SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE   = 5
   183  	SQLITE_DBSTATUS_LOOKASIDE_USED        = 0
   184  	SQLITE_DBSTATUS_MAX                   = 12
   185  	SQLITE_DBSTATUS_SCHEMA_USED           = 2
   186  	SQLITE_DBSTATUS_STMT_USED             = 3
   187  	SQLITE_DEFAULT_MEMSTATUS              = 0
   188  	SQLITE_DEFAULT_PAGE_SIZE              = 1024
   189  	SQLITE_DELETE                         = 9
   190  	SQLITE_DENY                           = 1
   191  	SQLITE_DEPRECATED                     = 0
   192  	SQLITE_DESERIALIZE_FREEONCLOSE        = 1
   193  	SQLITE_DESERIALIZE_READONLY           = 4
   194  	SQLITE_DESERIALIZE_RESIZEABLE         = 2
   195  	SQLITE_DETACH                         = 25
   196  	SQLITE_DETERMINISTIC                  = 0x000000800
   197  	SQLITE_DIRECTONLY                     = 0x000080000
   198  	SQLITE_DONE                           = 101
   199  	SQLITE_DROP_INDEX                     = 10
   200  	SQLITE_DROP_TABLE                     = 11
   201  	SQLITE_DROP_TEMP_INDEX                = 12
   202  	SQLITE_DROP_TEMP_TABLE                = 13
   203  	SQLITE_DROP_TEMP_TRIGGER              = 14
   204  	SQLITE_DROP_TEMP_VIEW                 = 15
   205  	SQLITE_DROP_TRIGGER                   = 16
   206  	SQLITE_DROP_VIEW                      = 17
   207  	SQLITE_DROP_VTABLE                    = 30
   208  	SQLITE_EMPTY                          = 16
   209  	SQLITE_ENABLE_BYTECODE_VTAB           = 1
   210  	SQLITE_ENABLE_COLUMN_METADATA         = 1
   211  	SQLITE_ENABLE_DBPAGE_VTAB             = 1
   212  	SQLITE_ENABLE_DBSTAT_VTAB             = 1
   213  	SQLITE_ENABLE_DESERIALIZE             = 1
   214  	SQLITE_ENABLE_EXPLAIN_COMMENTS        = 1
   215  	SQLITE_ENABLE_FTS5                    = 1
   216  	SQLITE_ENABLE_GEOPOLY                 = 1
   217  	SQLITE_ENABLE_JSON1                   = 1
   218  	SQLITE_ENABLE_MEMORY_MANAGEMENT       = 1
   219  	SQLITE_ENABLE_OFFSET_SQL_FUNC         = 1
   220  	SQLITE_ENABLE_PREUPDATE_HOOK          = 1
   221  	SQLITE_ENABLE_RBU                     = 1
   222  	SQLITE_ENABLE_RTREE                   = 1
   223  	SQLITE_ENABLE_SESSION                 = 1
   224  	SQLITE_ENABLE_SNAPSHOT                = 1
   225  	SQLITE_ENABLE_STAT4                   = 1
   226  	SQLITE_ENABLE_STMTVTAB                = 1
   227  	SQLITE_ENABLE_UNLOCK_NOTIFY           = 1
   228  	SQLITE_ERROR                          = 1
   229  	SQLITE_ERROR_MISSING_COLLSEQ          = 257
   230  	SQLITE_ERROR_RETRY                    = 513
   231  	SQLITE_ERROR_SNAPSHOT                 = 769
   232  	SQLITE_EXPERIMENTAL                   = 0
   233  	SQLITE_FAIL                           = 3
   234  	SQLITE_FCNTL_BEGIN_ATOMIC_WRITE       = 31
   235  	SQLITE_FCNTL_BUSYHANDLER              = 15
   236  	SQLITE_FCNTL_CHUNK_SIZE               = 6
   237  	SQLITE_FCNTL_CKPT_DONE                = 37
   238  	SQLITE_FCNTL_CKPT_START               = 39
   239  	SQLITE_FCNTL_CKSM_FILE                = 41
   240  	SQLITE_FCNTL_COMMIT_ATOMIC_WRITE      = 32
   241  	SQLITE_FCNTL_COMMIT_PHASETWO          = 22
   242  	SQLITE_FCNTL_DATA_VERSION             = 35
   243  	SQLITE_FCNTL_EXTERNAL_READER          = 40
   244  	SQLITE_FCNTL_FILE_POINTER             = 7
   245  	SQLITE_FCNTL_GET_LOCKPROXYFILE        = 2
   246  	SQLITE_FCNTL_HAS_MOVED                = 20
   247  	SQLITE_FCNTL_JOURNAL_POINTER          = 28
   248  	SQLITE_FCNTL_LAST_ERRNO               = 4
   249  	SQLITE_FCNTL_LOCKSTATE                = 1
   250  	SQLITE_FCNTL_LOCK_TIMEOUT             = 34
   251  	SQLITE_FCNTL_MMAP_SIZE                = 18
   252  	SQLITE_FCNTL_OVERWRITE                = 11
   253  	SQLITE_FCNTL_PDB                      = 30
   254  	SQLITE_FCNTL_PERSIST_WAL              = 10
   255  	SQLITE_FCNTL_POWERSAFE_OVERWRITE      = 13
   256  	SQLITE_FCNTL_PRAGMA                   = 14
   257  	SQLITE_FCNTL_RBU                      = 26
   258  	SQLITE_FCNTL_RESERVE_BYTES            = 38
   259  	SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE    = 33
   260  	SQLITE_FCNTL_SET_LOCKPROXYFILE        = 3
   261  	SQLITE_FCNTL_SIZE_HINT                = 5
   262  	SQLITE_FCNTL_SIZE_LIMIT               = 36
   263  	SQLITE_FCNTL_SYNC                     = 21
   264  	SQLITE_FCNTL_SYNC_OMITTED             = 8
   265  	SQLITE_FCNTL_TEMPFILENAME             = 16
   266  	SQLITE_FCNTL_TRACE                    = 19
   267  	SQLITE_FCNTL_VFSNAME                  = 12
   268  	SQLITE_FCNTL_VFS_POINTER              = 27
   269  	SQLITE_FCNTL_WAL_BLOCK                = 24
   270  	SQLITE_FCNTL_WIN32_AV_RETRY           = 9
   271  	SQLITE_FCNTL_WIN32_GET_HANDLE         = 29
   272  	SQLITE_FCNTL_WIN32_SET_HANDLE         = 23
   273  	SQLITE_FCNTL_ZIPVFS                   = 25
   274  	SQLITE_FLOAT                          = 2
   275  	SQLITE_FORMAT                         = 24
   276  	SQLITE_FULL                           = 13
   277  	SQLITE_FUNCTION                       = 31
   278  	SQLITE_GET_LOCKPROXYFILE              = 2
   279  	SQLITE_HAVE_ZLIB                      = 1
   280  	SQLITE_IGNORE                         = 2
   281  	SQLITE_INDEX_CONSTRAINT_EQ            = 2
   282  	SQLITE_INDEX_CONSTRAINT_FUNCTION      = 150
   283  	SQLITE_INDEX_CONSTRAINT_GE            = 32
   284  	SQLITE_INDEX_CONSTRAINT_GLOB          = 66
   285  	SQLITE_INDEX_CONSTRAINT_GT            = 4
   286  	SQLITE_INDEX_CONSTRAINT_IS            = 72
   287  	SQLITE_INDEX_CONSTRAINT_ISNOT         = 69
   288  	SQLITE_INDEX_CONSTRAINT_ISNOTNULL     = 70
   289  	SQLITE_INDEX_CONSTRAINT_ISNULL        = 71
   290  	SQLITE_INDEX_CONSTRAINT_LE            = 8
   291  	SQLITE_INDEX_CONSTRAINT_LIKE          = 65
   292  	SQLITE_INDEX_CONSTRAINT_LT            = 16
   293  	SQLITE_INDEX_CONSTRAINT_MATCH         = 64
   294  	SQLITE_INDEX_CONSTRAINT_NE            = 68
   295  	SQLITE_INDEX_CONSTRAINT_REGEXP        = 67
   296  	SQLITE_INDEX_SCAN_UNIQUE              = 1
   297  	SQLITE_INNOCUOUS                      = 0x000200000
   298  	SQLITE_INSERT                         = 18
   299  	SQLITE_INTEGER                        = 1
   300  	SQLITE_INTERNAL                       = 2
   301  	SQLITE_INTERRUPT                      = 9
   302  	SQLITE_IOCAP_ATOMIC                   = 0x00000001
   303  	SQLITE_IOCAP_ATOMIC16K                = 0x00000040
   304  	SQLITE_IOCAP_ATOMIC1K                 = 0x00000004
   305  	SQLITE_IOCAP_ATOMIC2K                 = 0x00000008
   306  	SQLITE_IOCAP_ATOMIC32K                = 0x00000080
   307  	SQLITE_IOCAP_ATOMIC4K                 = 0x00000010
   308  	SQLITE_IOCAP_ATOMIC512                = 0x00000002
   309  	SQLITE_IOCAP_ATOMIC64K                = 0x00000100
   310  	SQLITE_IOCAP_ATOMIC8K                 = 0x00000020
   311  	SQLITE_IOCAP_BATCH_ATOMIC             = 0x00004000
   312  	SQLITE_IOCAP_IMMUTABLE                = 0x00002000
   313  	SQLITE_IOCAP_POWERSAFE_OVERWRITE      = 0x00001000
   314  	SQLITE_IOCAP_SAFE_APPEND              = 0x00000200
   315  	SQLITE_IOCAP_SEQUENTIAL               = 0x00000400
   316  	SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN    = 0x00000800
   317  	SQLITE_IOERR                          = 10
   318  	SQLITE_IOERR_ACCESS                   = 3338
   319  	SQLITE_IOERR_AUTH                     = 7178
   320  	SQLITE_IOERR_BEGIN_ATOMIC             = 7434
   321  	SQLITE_IOERR_BLOCKED                  = 2826
   322  	SQLITE_IOERR_CHECKRESERVEDLOCK        = 3594
   323  	SQLITE_IOERR_CLOSE                    = 4106
   324  	SQLITE_IOERR_COMMIT_ATOMIC            = 7690
   325  	SQLITE_IOERR_CONVPATH                 = 6666
   326  	SQLITE_IOERR_CORRUPTFS                = 8458
   327  	SQLITE_IOERR_DATA                     = 8202
   328  	SQLITE_IOERR_DELETE                   = 2570
   329  	SQLITE_IOERR_DELETE_NOENT             = 5898
   330  	SQLITE_IOERR_DIR_CLOSE                = 4362
   331  	SQLITE_IOERR_DIR_FSYNC                = 1290
   332  	SQLITE_IOERR_FSTAT                    = 1802
   333  	SQLITE_IOERR_FSYNC                    = 1034
   334  	SQLITE_IOERR_GETTEMPPATH              = 6410
   335  	SQLITE_IOERR_LOCK                     = 3850
   336  	SQLITE_IOERR_MMAP                     = 6154
   337  	SQLITE_IOERR_NOMEM                    = 3082
   338  	SQLITE_IOERR_RDLOCK                   = 2314
   339  	SQLITE_IOERR_READ                     = 266
   340  	SQLITE_IOERR_ROLLBACK_ATOMIC          = 7946
   341  	SQLITE_IOERR_SEEK                     = 5642
   342  	SQLITE_IOERR_SHMLOCK                  = 5130
   343  	SQLITE_IOERR_SHMMAP                   = 5386
   344  	SQLITE_IOERR_SHMOPEN                  = 4618
   345  	SQLITE_IOERR_SHMSIZE                  = 4874
   346  	SQLITE_IOERR_SHORT_READ               = 522
   347  	SQLITE_IOERR_TRUNCATE                 = 1546
   348  	SQLITE_IOERR_UNLOCK                   = 2058
   349  	SQLITE_IOERR_VNODE                    = 6922
   350  	SQLITE_IOERR_WRITE                    = 778
   351  	SQLITE_LAST_ERRNO                     = 4
   352  	SQLITE_LIKE_DOESNT_MATCH_BLOBS        = 1
   353  	SQLITE_LIMIT_ATTACHED                 = 7
   354  	SQLITE_LIMIT_COLUMN                   = 2
   355  	SQLITE_LIMIT_COMPOUND_SELECT          = 4
   356  	SQLITE_LIMIT_EXPR_DEPTH               = 3
   357  	SQLITE_LIMIT_FUNCTION_ARG             = 6
   358  	SQLITE_LIMIT_LENGTH                   = 0
   359  	SQLITE_LIMIT_LIKE_PATTERN_LENGTH      = 8
   360  	SQLITE_LIMIT_SQL_LENGTH               = 1
   361  	SQLITE_LIMIT_TRIGGER_DEPTH            = 10
   362  	SQLITE_LIMIT_VARIABLE_NUMBER          = 9
   363  	SQLITE_LIMIT_VDBE_OP                  = 5
   364  	SQLITE_LIMIT_WORKER_THREADS           = 11
   365  	SQLITE_LOCKED                         = 6
   366  	SQLITE_LOCKED_SHAREDCACHE             = 262
   367  	SQLITE_LOCKED_VTAB                    = 518
   368  	SQLITE_LOCK_EXCLUSIVE                 = 4
   369  	SQLITE_LOCK_NONE                      = 0
   370  	SQLITE_LOCK_PENDING                   = 3
   371  	SQLITE_LOCK_RESERVED                  = 2
   372  	SQLITE_LOCK_SHARED                    = 1
   373  	SQLITE_MISMATCH                       = 20
   374  	SQLITE_MISUSE                         = 21
   375  	SQLITE_MUTEX_APPDEF                   = 1
   376  	SQLITE_MUTEX_FAST                     = 0
   377  	SQLITE_MUTEX_NOOP                     = 1
   378  	SQLITE_MUTEX_RECURSIVE                = 1
   379  	SQLITE_MUTEX_STATIC_APP1              = 8
   380  	SQLITE_MUTEX_STATIC_APP2              = 9
   381  	SQLITE_MUTEX_STATIC_APP3              = 10
   382  	SQLITE_MUTEX_STATIC_LRU               = 6
   383  	SQLITE_MUTEX_STATIC_LRU2              = 7
   384  	SQLITE_MUTEX_STATIC_MAIN              = 2
   385  	SQLITE_MUTEX_STATIC_MASTER            = 2
   386  	SQLITE_MUTEX_STATIC_MEM               = 3
   387  	SQLITE_MUTEX_STATIC_MEM2              = 4
   388  	SQLITE_MUTEX_STATIC_OPEN              = 4
   389  	SQLITE_MUTEX_STATIC_PMEM              = 7
   390  	SQLITE_MUTEX_STATIC_PRNG              = 5
   391  	SQLITE_MUTEX_STATIC_VFS1              = 11
   392  	SQLITE_MUTEX_STATIC_VFS2              = 12
   393  	SQLITE_MUTEX_STATIC_VFS3              = 13
   394  	SQLITE_NOLFS                          = 22
   395  	SQLITE_NOMEM                          = 7
   396  	SQLITE_NOTADB                         = 26
   397  	SQLITE_NOTFOUND                       = 12
   398  	SQLITE_NOTICE                         = 27
   399  	SQLITE_NOTICE_RECOVER_ROLLBACK        = 539
   400  	SQLITE_NOTICE_RECOVER_WAL             = 283
   401  	SQLITE_NULL                           = 5
   402  	SQLITE_OK                             = 0
   403  	SQLITE_OK_LOAD_PERMANENTLY            = 256
   404  	SQLITE_OK_SYMLINK                     = 512
   405  	SQLITE_OMIT_LOAD_EXTENSION            = 1
   406  	SQLITE_OPEN_AUTOPROXY                 = 0x00000020
   407  	SQLITE_OPEN_CREATE                    = 0x00000004
   408  	SQLITE_OPEN_DELETEONCLOSE             = 0x00000008
   409  	SQLITE_OPEN_EXCLUSIVE                 = 0x00000010
   410  	SQLITE_OPEN_FULLMUTEX                 = 0x00010000
   411  	SQLITE_OPEN_MAIN_DB                   = 0x00000100
   412  	SQLITE_OPEN_MAIN_JOURNAL              = 0x00000800
   413  	SQLITE_OPEN_MASTER_JOURNAL            = 0x00004000
   414  	SQLITE_OPEN_MEMORY                    = 0x00000080
   415  	SQLITE_OPEN_NOFOLLOW                  = 0x01000000
   416  	SQLITE_OPEN_NOMUTEX                   = 0x00008000
   417  	SQLITE_OPEN_PRIVATECACHE              = 0x00040000
   418  	SQLITE_OPEN_READONLY                  = 0x00000001
   419  	SQLITE_OPEN_READWRITE                 = 0x00000002
   420  	SQLITE_OPEN_SHAREDCACHE               = 0x00020000
   421  	SQLITE_OPEN_SUBJOURNAL                = 0x00002000
   422  	SQLITE_OPEN_SUPER_JOURNAL             = 0x00004000
   423  	SQLITE_OPEN_TEMP_DB                   = 0x00000200
   424  	SQLITE_OPEN_TEMP_JOURNAL              = 0x00001000
   425  	SQLITE_OPEN_TRANSIENT_DB              = 0x00000400
   426  	SQLITE_OPEN_URI                       = 0x00000040
   427  	SQLITE_OPEN_WAL                       = 0x00080000
   428  	SQLITE_PERM                           = 3
   429  	SQLITE_PRAGMA                         = 19
   430  	SQLITE_PREPARE_NORMALIZE              = 0x02
   431  	SQLITE_PREPARE_NO_VTAB                = 0x04
   432  	SQLITE_PREPARE_PERSISTENT             = 0x01
   433  	SQLITE_PROTOCOL                       = 15
   434  	SQLITE_RANGE                          = 25
   435  	SQLITE_READ                           = 20
   436  	SQLITE_READONLY                       = 8
   437  	SQLITE_READONLY_CANTINIT              = 1288
   438  	SQLITE_READONLY_CANTLOCK              = 520
   439  	SQLITE_READONLY_DBMOVED               = 1032
   440  	SQLITE_READONLY_DIRECTORY             = 1544
   441  	SQLITE_READONLY_RECOVERY              = 264
   442  	SQLITE_READONLY_ROLLBACK              = 776
   443  	SQLITE_RECURSIVE                      = 33
   444  	SQLITE_REINDEX                        = 27
   445  	SQLITE_REPLACE                        = 5
   446  	SQLITE_ROLLBACK                       = 1
   447  	SQLITE_ROW                            = 100
   448  	SQLITE_SAVEPOINT                      = 32
   449  	SQLITE_SCANSTAT_EST                   = 2
   450  	SQLITE_SCANSTAT_EXPLAIN               = 4
   451  	SQLITE_SCANSTAT_NAME                  = 3
   452  	SQLITE_SCANSTAT_NLOOP                 = 0
   453  	SQLITE_SCANSTAT_NVISIT                = 1
   454  	SQLITE_SCANSTAT_SELECTID              = 5
   455  	SQLITE_SCHEMA                         = 17
   456  	SQLITE_SELECT                         = 21
   457  	SQLITE_SERIALIZE_NOCOPY               = 0x001
   458  	SQLITE_SERIES_CONSTRAINT_VERIFY       = 1
   459  	SQLITE_SERVER                         = 1
   460  	SQLITE_SESSION_CONFIG_STRMSIZE        = 1
   461  	SQLITE_SESSION_OBJCONFIG_SIZE         = 1
   462  	SQLITE_SET_LOCKPROXYFILE              = 3
   463  	SQLITE_SHM_EXCLUSIVE                  = 8
   464  	SQLITE_SHM_LOCK                       = 2
   465  	SQLITE_SHM_NLOCK                      = 8
   466  	SQLITE_SHM_SHARED                     = 4
   467  	SQLITE_SHM_UNLOCK                     = 1
   468  	SQLITE_SOUNDEX                        = 1
   469  	SQLITE_SOURCE_ID                      = "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5"
   470  	SQLITE_STATUS_MALLOC_COUNT            = 9
   471  	SQLITE_STATUS_MALLOC_SIZE             = 5
   472  	SQLITE_STATUS_MEMORY_USED             = 0
   473  	SQLITE_STATUS_PAGECACHE_OVERFLOW      = 2
   474  	SQLITE_STATUS_PAGECACHE_SIZE          = 7
   475  	SQLITE_STATUS_PAGECACHE_USED          = 1
   476  	SQLITE_STATUS_PARSER_STACK            = 6
   477  	SQLITE_STATUS_SCRATCH_OVERFLOW        = 4
   478  	SQLITE_STATUS_SCRATCH_SIZE            = 8
   479  	SQLITE_STATUS_SCRATCH_USED            = 3
   480  	SQLITE_STDCALL                        = 0
   481  	SQLITE_STMTSTATUS_AUTOINDEX           = 3
   482  	SQLITE_STMTSTATUS_FULLSCAN_STEP       = 1
   483  	SQLITE_STMTSTATUS_MEMUSED             = 99
   484  	SQLITE_STMTSTATUS_REPREPARE           = 5
   485  	SQLITE_STMTSTATUS_RUN                 = 6
   486  	SQLITE_STMTSTATUS_SORT                = 2
   487  	SQLITE_STMTSTATUS_VM_STEP             = 4
   488  	SQLITE_SUBTYPE                        = 0x000100000
   489  	SQLITE_SYNC_DATAONLY                  = 0x00010
   490  	SQLITE_SYNC_FULL                      = 0x00003
   491  	SQLITE_SYNC_NORMAL                    = 0x00002
   492  	SQLITE_SYSAPI                         = 0
   493  	SQLITE_TEMP_STORE                     = 1
   494  	SQLITE_TEST                           = 1
   495  	SQLITE_TESTCTRL_ALWAYS                = 13
   496  	SQLITE_TESTCTRL_ASSERT                = 12
   497  	SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS   = 10
   498  	SQLITE_TESTCTRL_BITVEC_TEST           = 8
   499  	SQLITE_TESTCTRL_BYTEORDER             = 22
   500  	SQLITE_TESTCTRL_EXPLAIN_STMT          = 19
   501  	SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS   = 29
   502  	SQLITE_TESTCTRL_FAULT_INSTALL         = 9
   503  	SQLITE_TESTCTRL_FIRST                 = 5
   504  	SQLITE_TESTCTRL_IMPOSTER              = 25
   505  	SQLITE_TESTCTRL_INTERNAL_FUNCTIONS    = 17
   506  	SQLITE_TESTCTRL_ISINIT                = 23
   507  	SQLITE_TESTCTRL_ISKEYWORD             = 16
   508  	SQLITE_TESTCTRL_LAST                  = 32
   509  	SQLITE_TESTCTRL_LOCALTIME_FAULT       = 18
   510  	SQLITE_TESTCTRL_NEVER_CORRUPT         = 20
   511  	SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD  = 19
   512  	SQLITE_TESTCTRL_OPTIMIZATIONS         = 15
   513  	SQLITE_TESTCTRL_PARSER_COVERAGE       = 26
   514  	SQLITE_TESTCTRL_PENDING_BYTE          = 11
   515  	SQLITE_TESTCTRL_PRNG_RESET            = 7
   516  	SQLITE_TESTCTRL_PRNG_RESTORE          = 6
   517  	SQLITE_TESTCTRL_PRNG_SAVE             = 5
   518  	SQLITE_TESTCTRL_PRNG_SEED             = 28
   519  	SQLITE_TESTCTRL_RESERVE               = 14
   520  	SQLITE_TESTCTRL_RESULT_INTREAL        = 27
   521  	SQLITE_TESTCTRL_SCRATCHMALLOC         = 17
   522  	SQLITE_TESTCTRL_SEEK_COUNT            = 30
   523  	SQLITE_TESTCTRL_SORTER_MMAP           = 24
   524  	SQLITE_TESTCTRL_TRACEFLAGS            = 31
   525  	SQLITE_TESTCTRL_TUNE                  = 32
   526  	SQLITE_TESTCTRL_VDBE_COVERAGE         = 21
   527  	SQLITE_TEXT                           = 3
   528  	SQLITE_THREADSAFE                     = 1
   529  	SQLITE_TOOBIG                         = 18
   530  	SQLITE_TRACE_CLOSE                    = 0x08
   531  	SQLITE_TRACE_PROFILE                  = 0x02
   532  	SQLITE_TRACE_ROW                      = 0x04
   533  	SQLITE_TRACE_STMT                     = 0x01
   534  	SQLITE_TRANSACTION                    = 22
   535  	SQLITE_TXN_NONE                       = 0
   536  	SQLITE_TXN_READ                       = 1
   537  	SQLITE_TXN_WRITE                      = 2
   538  	SQLITE_UPDATE                         = 23
   539  	SQLITE_UTF16                          = 4
   540  	SQLITE_UTF16BE                        = 3
   541  	SQLITE_UTF16LE                        = 2
   542  	SQLITE_UTF16_ALIGNED                  = 8
   543  	SQLITE_UTF8                           = 1
   544  	SQLITE_VERSION                        = "3.36.0"
   545  	SQLITE_VERSION_NUMBER                 = 3036000
   546  	SQLITE_VTAB_CONSTRAINT_SUPPORT        = 1
   547  	SQLITE_VTAB_DIRECTONLY                = 3
   548  	SQLITE_VTAB_INNOCUOUS                 = 2
   549  	SQLITE_WARNING                        = 28
   550  	SQLITE_WARNING_AUTOINDEX              = 284
   551  	SQLITE_WIN32_DATA_DIRECTORY_TYPE      = 1
   552  	SQLITE_WIN32_TEMP_DIRECTORY_TYPE      = 2
   553  	TMP_MAX                               = 238328
   554  	UNIQUE_TABLE_NAME                     = "t592690916721053953805701627921227776"
   555  	X_ANSI_STDARG_H_                      = 0
   556  	X_ASSERT_H                            = 1
   557  	X_ATFILE_SOURCE                       = 1
   558  	X_BITS_STDIO_LIM_H                    = 1
   559  	X_BITS_TYPESIZES_H                    = 1
   560  	X_BITS_TYPES_H                        = 1
   561  	X_BITS_TYPES_LOCALE_T_H               = 1
   562  	X_BITS_TYPES___LOCALE_T_H             = 1
   563  	X_BSD_SIZE_T_                         = 0
   564  	X_BSD_SIZE_T_DEFINED_                 = 0
   565  	X_DEFAULT_SOURCE                      = 1
   566  	X_FEATURES_H                          = 1
   567  	X_FILE_OFFSET_BITS                    = 64
   568  	X_FTS5_H                              = 0
   569  	X_GCC_SIZE_T                          = 0
   570  	X_HAVE_SQLITE_CONFIG_H                = 1
   571  	X_IOFBF                               = 0
   572  	X_IOLBF                               = 1
   573  	X_IONBF                               = 2
   574  	X_IO_EOF_SEEN                         = 0x0010
   575  	X_IO_ERR_SEEN                         = 0x0020
   576  	X_IO_USER_LOCK                        = 0x8000
   577  	X_POSIX_C_SOURCE                      = 200809
   578  	X_POSIX_SOURCE                        = 1
   579  	X_SIZET_                              = 0
   580  	X_SIZE_T                              = 0
   581  	X_SIZE_T_                             = 0
   582  	X_SIZE_T_DECLARED                     = 0
   583  	X_SIZE_T_DEFINED                      = 0
   584  	X_SIZE_T_DEFINED_                     = 0
   585  	X_SQLITE3RTREE_H_                     = 0
   586  	X_STDARG_H                            = 0
   587  	X_STDC_PREDEF_H                       = 1
   588  	X_STDIO_H                             = 1
   589  	X_STRINGS_H                           = 1
   590  	X_STRING_H                            = 1
   591  	X_SYS_CDEFS_H                         = 1
   592  	X_SYS_SIZE_T_H                        = 0
   593  	X_T_SIZE                              = 0
   594  	X_T_SIZE_                             = 0
   595  	X_VA_LIST                             = 0
   596  	X_VA_LIST_                            = 0
   597  	X_VA_LIST_DEFINED                     = 0
   598  	X_VA_LIST_T_H                         = 0
   599  	Linux                                 = 1
   600  	Unix                                  = 1
   601  	CRTIMPORT                             = 0
   602  	DLLIMPORT                             = 0
   603  	INLINE                                = 0
   604  	MP_DIGIT_DECLARED                     = 0
   605  	MP_INT_DECLARED                       = 0
   606  	NUM_STATIC_TOKENS                     = 20
   607  	SQLITE_TCLAPI                         = 0
   608  	TCL_ALLOW_INLINE_COMPILATION          = 0x20000
   609  	TCL_ALL_EVENTS                        = -3
   610  	TCL_ALPHA_RELEASE                     = 0
   611  	TCL_APPEND_VALUE                      = 4
   612  	TCL_ARGV_CONSTANT                     = 15
   613  	TCL_ARGV_END                          = 23
   614  	TCL_ARGV_FLOAT                        = 19
   615  	TCL_ARGV_FUNC                         = 20
   616  	TCL_ARGV_GENFUNC                      = 21
   617  	TCL_ARGV_HELP                         = 22
   618  	TCL_ARGV_INT                          = 16
   619  	TCL_ARGV_REST                         = 18
   620  	TCL_ARGV_STRING                       = 17
   621  	TCL_BETA_RELEASE                      = 1
   622  	TCL_BREAK                             = 3
   623  	TCL_CANCEL_UNWIND                     = 0x100000
   624  	TCL_CHANNEL_THREAD_INSERT             = 0
   625  	TCL_CHANNEL_THREAD_REMOVE             = 1
   626  	TCL_CLOSE_READ                        = 2
   627  	TCL_CLOSE_WRITE                       = 4
   628  	TCL_CONTINUE                          = 4
   629  	TCL_CONVERT_MULTIBYTE                 = -1
   630  	TCL_CONVERT_NOSPACE                   = -4
   631  	TCL_CONVERT_SYNTAX                    = -2
   632  	TCL_CONVERT_UNKNOWN                   = -3
   633  	TCL_CREATE_HARD_LINK                  = 0x02
   634  	TCL_CREATE_SYMBOLIC_LINK              = 0x01
   635  	TCL_CUSTOM_PTR_KEYS                   = -1
   636  	TCL_CUSTOM_TYPE_KEYS                  = -2
   637  	TCL_DONT_QUOTE_HASH                   = 8
   638  	TCL_DONT_USE_BRACES                   = 1
   639  	TCL_DONT_WAIT                         = 2
   640  	TCL_DOUBLE_SPACE                      = 27
   641  	TCL_DSTRING_STATIC_SIZE               = 200
   642  	TCL_ENCODING_CHAR_LIMIT               = 0x10
   643  	TCL_ENCODING_END                      = 0x02
   644  	TCL_ENCODING_NO_TERMINATE             = 0x08
   645  	TCL_ENCODING_START                    = 0x01
   646  	TCL_ENCODING_STOPONERROR              = 0x04
   647  	TCL_ENFORCE_MODE                      = 16
   648  	TCL_ENSEMBLE_PREFIX                   = 0x02
   649  	TCL_ERROR                             = 1
   650  	TCL_EVAL_DIRECT                       = 0x040000
   651  	TCL_EVAL_GLOBAL                       = 0x020000
   652  	TCL_EVAL_INVOKE                       = 0x080000
   653  	TCL_EVAL_NOERR                        = 0x200000
   654  	TCL_EXACT                             = 1
   655  	TCL_EXCEPTION                         = 8
   656  	TCL_FILE_EVENTS                       = 8
   657  	TCL_FINAL_RELEASE                     = 2
   658  	TCL_GLOBAL_ONLY                       = 1
   659  	TCL_GLOB_PERM_HIDDEN                  = 2
   660  	TCL_GLOB_PERM_R                       = 4
   661  	TCL_GLOB_PERM_RONLY                   = 1
   662  	TCL_GLOB_PERM_W                       = 8
   663  	TCL_GLOB_PERM_X                       = 16
   664  	TCL_GLOB_TYPE_BLOCK                   = 1
   665  	TCL_GLOB_TYPE_CHAR                    = 2
   666  	TCL_GLOB_TYPE_DIR                     = 4
   667  	TCL_GLOB_TYPE_FILE                    = 16
   668  	TCL_GLOB_TYPE_LINK                    = 32
   669  	TCL_GLOB_TYPE_MOUNT                   = 128
   670  	TCL_GLOB_TYPE_PIPE                    = 8
   671  	TCL_GLOB_TYPE_SOCK                    = 64
   672  	TCL_HASH_KEY_RANDOMIZE_HASH           = 0x1
   673  	TCL_HASH_KEY_STORE_HASH               = 1
   674  	TCL_HASH_KEY_SYSTEM_HASH              = 0x2
   675  	TCL_HASH_KEY_TYPE_VERSION             = 1
   676  	TCL_IDLE_EVENTS                       = 32
   677  	TCL_INTEGER_SPACE                     = 24
   678  	TCL_INTERP_DESTROYED                  = 0x100
   679  	TCL_LEAVE_ERR_MSG                     = 0x200
   680  	TCL_LIMIT_COMMANDS                    = 0x01
   681  	TCL_LIMIT_TIME                        = 0x02
   682  	TCL_LINK_BOOLEAN                      = 3
   683  	TCL_LINK_CHAR                         = 6
   684  	TCL_LINK_DOUBLE                       = 2
   685  	TCL_LINK_FLOAT                        = 13
   686  	TCL_LINK_INT                          = 1
   687  	TCL_LINK_LONG                         = 11
   688  	TCL_LINK_READ_ONLY                    = 0x80
   689  	TCL_LINK_SHORT                        = 8
   690  	TCL_LINK_STRING                       = 4
   691  	TCL_LINK_UCHAR                        = 7
   692  	TCL_LINK_UINT                         = 10
   693  	TCL_LINK_ULONG                        = 12
   694  	TCL_LINK_USHORT                       = 9
   695  	TCL_LINK_WIDE_INT                     = 5
   696  	TCL_LINK_WIDE_UINT                    = 14
   697  	TCL_LIST_ELEMENT                      = 8
   698  	TCL_LL_MODIFIER                       = "ll"
   699  	TCL_LOAD_GLOBAL                       = 1
   700  	TCL_LOAD_LAZY                         = 2
   701  	TCL_MAJOR_VERSION                     = 8
   702  	TCL_MATCH_NOCASE                      = 1
   703  	TCL_MAX_PREC                          = 17
   704  	TCL_MINOR_VERSION                     = 6
   705  	TCL_MODE_BLOCKING                     = 0
   706  	TCL_MODE_NONBLOCKING                  = 1
   707  	TCL_NAMESPACE_ONLY                    = 2
   708  	TCL_NORETURN1                         = 0
   709  	TCL_NO_EVAL                           = 0x010000
   710  	TCL_OK                                = 0
   711  	TCL_ONE_WORD_KEYS                     = 1
   712  	TCL_PARSE_BAD_NUMBER                  = 9
   713  	TCL_PARSE_BRACE_EXTRA                 = 2
   714  	TCL_PARSE_MISSING_BRACE               = 3
   715  	TCL_PARSE_MISSING_BRACKET             = 4
   716  	TCL_PARSE_MISSING_PAREN               = 5
   717  	TCL_PARSE_MISSING_QUOTE               = 6
   718  	TCL_PARSE_MISSING_VAR_BRACE           = 7
   719  	TCL_PARSE_PART1                       = 0x400
   720  	TCL_PARSE_QUOTE_EXTRA                 = 1
   721  	TCL_PARSE_SUCCESS                     = 0
   722  	TCL_PARSE_SYNTAX                      = 8
   723  	TCL_PATCH_LEVEL                       = "8.6.9"
   724  	TCL_READABLE                          = 2
   725  	TCL_REG_ADVANCED                      = 000003
   726  	TCL_REG_ADVF                          = 000002
   727  	TCL_REG_BASIC                         = 000000
   728  	TCL_REG_CANMATCH                      = 001000
   729  	TCL_REG_EXPANDED                      = 000040
   730  	TCL_REG_EXTENDED                      = 000001
   731  	TCL_REG_NEWLINE                       = 000300
   732  	TCL_REG_NLANCH                        = 000200
   733  	TCL_REG_NLSTOP                        = 000100
   734  	TCL_REG_NOCASE                        = 000010
   735  	TCL_REG_NOSUB                         = 000020
   736  	TCL_REG_NOTBOL                        = 0001
   737  	TCL_REG_NOTEOL                        = 0002
   738  	TCL_REG_QUOTE                         = 000004
   739  	TCL_RELEASE_LEVEL                     = 2
   740  	TCL_RELEASE_SERIAL                    = 9
   741  	TCL_RESULT_SIZE                       = 200
   742  	TCL_RETURN                            = 2
   743  	TCL_SERVICE_ALL                       = 1
   744  	TCL_SERVICE_NONE                      = 0
   745  	TCL_SMALL_HASH_TABLE                  = 4
   746  	TCL_STDERR                            = 8
   747  	TCL_STDIN                             = 2
   748  	TCL_STDOUT                            = 4
   749  	TCL_STORAGE_CLASS                     = 0
   750  	TCL_STRING_KEYS                       = 0
   751  	TCL_SUBST_ALL                         = 007
   752  	TCL_SUBST_BACKSLASHES                 = 004
   753  	TCL_SUBST_COMMANDS                    = 001
   754  	TCL_SUBST_VARIABLES                   = 002
   755  	TCL_THREAD_CREATE_RETURN              = 0
   756  	TCL_THREAD_JOINABLE                   = 1
   757  	TCL_THREAD_NOFLAGS                    = 0
   758  	TCL_THREAD_STACK_DEFAULT              = 0
   759  	TCL_TIMER_EVENTS                      = 16
   760  	TCL_TOKEN_BS                          = 8
   761  	TCL_TOKEN_COMMAND                     = 16
   762  	TCL_TOKEN_EXPAND_WORD                 = 256
   763  	TCL_TOKEN_OPERATOR                    = 128
   764  	TCL_TOKEN_SIMPLE_WORD                 = 2
   765  	TCL_TOKEN_SUB_EXPR                    = 64
   766  	TCL_TOKEN_TEXT                        = 4
   767  	TCL_TOKEN_VARIABLE                    = 32
   768  	TCL_TOKEN_WORD                        = 1
   769  	TCL_TRACE_ARRAY                       = 0x800
   770  	TCL_TRACE_DELETE                      = 0x4000
   771  	TCL_TRACE_DESTROYED                   = 0x80
   772  	TCL_TRACE_OLD_STYLE                   = 0x1000
   773  	TCL_TRACE_READS                       = 0x10
   774  	TCL_TRACE_RENAME                      = 0x2000
   775  	TCL_TRACE_RESULT_DYNAMIC              = 0x8000
   776  	TCL_TRACE_RESULT_OBJECT               = 0x10000
   777  	TCL_TRACE_UNSETS                      = 0x40
   778  	TCL_TRACE_WRITES                      = 0x20
   779  	TCL_UNLOAD_DETACH_FROM_INTERPRETER    = 1
   780  	TCL_UNLOAD_DETACH_FROM_PROCESS        = 2
   781  	TCL_UTF_MAX                           = 3
   782  	TCL_VERSION                           = "8.6"
   783  	TCL_WINDOW_EVENTS                     = 4
   784  	TCL_WRITABLE                          = 4
   785  	TCL_ZLIB_COMPRESS_BEST                = 9
   786  	TCL_ZLIB_COMPRESS_DEFAULT             = -1
   787  	TCL_ZLIB_COMPRESS_FAST                = 1
   788  	TCL_ZLIB_COMPRESS_NONE                = 0
   789  	TCL_ZLIB_FINALIZE                     = 4
   790  	TCL_ZLIB_FLUSH                        = 2
   791  	TCL_ZLIB_FORMAT_AUTO                  = 8
   792  	TCL_ZLIB_FORMAT_GZIP                  = 4
   793  	TCL_ZLIB_FORMAT_RAW                   = 1
   794  	TCL_ZLIB_FORMAT_ZLIB                  = 2
   795  	TCL_ZLIB_FULLFLUSH                    = 3
   796  	TCL_ZLIB_NO_FLUSH                     = 0
   797  	TCL_ZLIB_STREAM_DEFLATE               = 16
   798  	TCL_ZLIB_STREAM_INFLATE               = 32
   799  	X_CLIENTDATA                          = 0
   800  	X_TCL                                 = 0
   801  	X_TCLDECLS                            = 0
   802  	X_TCLPLATDECLS                        = 0
   803  	X_FTSINT_H                            = 0
   804  	FTS3_TOK_SCHEMA                       = "CREATE TABLE x(input HIDDEN, token, start, end, position)"
   805  	APND_MARK_FOS_SZ                      = 8
   806  	APND_MARK_PREFIX                      = "Start-Of-SQLite3-"
   807  	APND_MARK_PREFIX_SZ                   = 17
   808  	APND_MARK_SIZE                        = 25
   809  	APND_MAX_SIZE                         = 1073741824
   810  	APND_ROUNDUP                          = 4096
   811  	SQLITE3EXT_H                          = 0
   812  	SQLITE_EXTENSION_INIT1                = 0
   813  	SQLITE_EXTENSION_INIT3                = 0
   814  	AMATCH_COL_COMMAND                    = 3
   815  	AMATCH_COL_DISTANCE                   = 1
   816  	AMATCH_COL_LANGUAGE                   = 2
   817  	AMATCH_COL_NWORD                      = 4
   818  	AMATCH_COL_WORD                       = 0
   819  	AMATCH_MX_COST                        = 1000
   820  	AMATCH_MX_LANGID                      = 2147483647
   821  	AMATCH_MX_LENGTH                      = 50
   822  	BIG_ENDIAN                            = 4321
   823  	BYTE_ORDER                            = 1234
   824  	EXIT_FAILURE                          = 1
   825  	EXIT_SUCCESS                          = 0
   826  	FD_SETSIZE                            = 1024
   827  	LITTLE_ENDIAN                         = 1234
   828  	PDP_ENDIAN                            = 3412
   829  	RAND_MAX                              = 2147483647
   830  	WCONTINUED                            = 8
   831  	WEXITED                               = 4
   832  	WNOHANG                               = 1
   833  	WNOWAIT                               = 0x01000000
   834  	WSTOPPED                              = 2
   835  	WUNTRACED                             = 2
   836  	X_ALLOCA_H                            = 1
   837  	X_BITS_BYTESWAP_H                     = 1
   838  	X_BITS_FLOATN_COMMON_H                = 0
   839  	X_BITS_PTHREADTYPES_ARCH_H            = 1
   840  	X_BITS_PTHREADTYPES_COMMON_H          = 1
   841  	X_BITS_STDINT_INTN_H                  = 1
   842  	X_BITS_UINTN_IDENTITY_H               = 1
   843  	X_CTYPE_H                             = 1
   844  	X_ENDIAN_H                            = 1
   845  	X_GCC_WCHAR_T                         = 0
   846  	X_STDLIB_H                            = 1
   847  	X_STRUCT_TIMESPEC                     = 1
   848  	X_SYS_SELECT_H                        = 1
   849  	X_SYS_TYPES_H                         = 1
   850  	X_THREAD_SHARED_TYPES_H               = 1
   851  	X_T_WCHAR                             = 0
   852  	X_T_WCHAR_                            = 0
   853  	X_WCHAR_T                             = 0
   854  	X_WCHAR_T_                            = 0
   855  	X_WCHAR_T_DECLARED                    = 0
   856  	X_WCHAR_T_DEFINED                     = 0
   857  	X_WCHAR_T_DEFINED_                    = 0
   858  	X_WCHAR_T_H                           = 0
   859  	CARRAY_COLUMN_COUNT                   = 2
   860  	CARRAY_COLUMN_CTYPE                   = 3
   861  	CARRAY_COLUMN_POINTER                 = 1
   862  	CARRAY_COLUMN_VALUE                   = 0
   863  	CARRAY_DOUBLE                         = 2
   864  	CARRAY_INT32                          = 0
   865  	CARRAY_INT64                          = 1
   866  	CARRAY_TEXT                           = 3
   867  	CLOSURE_COL_DEPTH                     = 1
   868  	CLOSURE_COL_ID                        = 0
   869  	CLOSURE_COL_IDCOLUMN                  = 4
   870  	CLOSURE_COL_PARENTCOLUMN              = 5
   871  	CLOSURE_COL_ROOT                      = 2
   872  	CLOSURE_COL_TABLENAME                 = 3
   873  	CSVTEST_FIDX                          = 0x0001
   874  	CSV_INBUFSZ                           = 1024
   875  	CSV_MXERR                             = 200
   876  	EXPLN_COLUMN_ADDR                     = 0
   877  	EXPLN_COLUMN_COMMENT                  = 7
   878  	EXPLN_COLUMN_OPCODE                   = 1
   879  	EXPLN_COLUMN_P1                       = 2
   880  	EXPLN_COLUMN_P2                       = 3
   881  	EXPLN_COLUMN_P3                       = 4
   882  	EXPLN_COLUMN_P4                       = 5
   883  	EXPLN_COLUMN_P5                       = 6
   884  	EXPLN_COLUMN_SQL                      = 8
   885  	ACCESSPERMS                           = 511
   886  	AIO_PRIO_DELTA_MAX                    = 20
   887  	ALLPERMS                              = 4095
   888  	AT_EACCESS                            = 0x200
   889  	AT_FDCWD                              = -100
   890  	AT_REMOVEDIR                          = 0x200
   891  	AT_SYMLINK_FOLLOW                     = 0x400
   892  	AT_SYMLINK_NOFOLLOW                   = 0x100
   893  	CLOCK_BOOTTIME                        = 7
   894  	CLOCK_BOOTTIME_ALARM                  = 9
   895  	CLOCK_MONOTONIC                       = 1
   896  	CLOCK_MONOTONIC_COARSE                = 6
   897  	CLOCK_MONOTONIC_RAW                   = 4
   898  	CLOCK_PROCESS_CPUTIME_ID              = 2
   899  	CLOCK_REALTIME                        = 0
   900  	CLOCK_REALTIME_ALARM                  = 8
   901  	CLOCK_REALTIME_COARSE                 = 5
   902  	CLOCK_TAI                             = 11
   903  	CLOCK_THREAD_CPUTIME_ID               = 3
   904  	DEFFILEMODE                           = 438
   905  	DELAYTIMER_MAX                        = 2147483647
   906  	E2BIG                                 = 7
   907  	EACCES                                = 13
   908  	EADDRINUSE                            = 98
   909  	EADDRNOTAVAIL                         = 99
   910  	EADV                                  = 68
   911  	EAFNOSUPPORT                          = 97
   912  	EAGAIN                                = 11
   913  	EALREADY                              = 114
   914  	EBADE                                 = 52
   915  	EBADF                                 = 9
   916  	EBADFD                                = 77
   917  	EBADMSG                               = 74
   918  	EBADR                                 = 53
   919  	EBADRQC                               = 56
   920  	EBADSLT                               = 57
   921  	EBFONT                                = 59
   922  	EBUSY                                 = 16
   923  	ECANCELED                             = 125
   924  	ECHILD                                = 10
   925  	ECHRNG                                = 44
   926  	ECOMM                                 = 70
   927  	ECONNABORTED                          = 103
   928  	ECONNREFUSED                          = 111
   929  	ECONNRESET                            = 104
   930  	EDEADLK                               = 35
   931  	EDEADLOCK                             = 35
   932  	EDESTADDRREQ                          = 89
   933  	EDOM                                  = 33
   934  	EDOTDOT                               = 73
   935  	EDQUOT                                = 122
   936  	EEXIST                                = 17
   937  	EFAULT                                = 14
   938  	EFBIG                                 = 27
   939  	EHOSTDOWN                             = 112
   940  	EHOSTUNREACH                          = 113
   941  	EHWPOISON                             = 133
   942  	EIDRM                                 = 43
   943  	EILSEQ                                = 84
   944  	EINPROGRESS                           = 115
   945  	EINTR                                 = 4
   946  	EINVAL                                = 22
   947  	EIO                                   = 5
   948  	EISCONN                               = 106
   949  	EISDIR                                = 21
   950  	EISNAM                                = 120
   951  	EKEYEXPIRED                           = 127
   952  	EKEYREJECTED                          = 129
   953  	EKEYREVOKED                           = 128
   954  	EL2HLT                                = 51
   955  	EL2NSYNC                              = 45
   956  	EL3HLT                                = 46
   957  	EL3RST                                = 47
   958  	ELIBACC                               = 79
   959  	ELIBBAD                               = 80
   960  	ELIBEXEC                              = 83
   961  	ELIBMAX                               = 82
   962  	ELIBSCN                               = 81
   963  	ELNRNG                                = 48
   964  	ELOOP                                 = 40
   965  	EMEDIUMTYPE                           = 124
   966  	EMFILE                                = 24
   967  	EMLINK                                = 31
   968  	EMSGSIZE                              = 90
   969  	EMULTIHOP                             = 72
   970  	ENAMETOOLONG                          = 36
   971  	ENAVAIL                               = 119
   972  	ENETDOWN                              = 100
   973  	ENETRESET                             = 102
   974  	ENETUNREACH                           = 101
   975  	ENFILE                                = 23
   976  	ENOANO                                = 55
   977  	ENOBUFS                               = 105
   978  	ENOCSI                                = 50
   979  	ENODATA                               = 61
   980  	ENODEV                                = 19
   981  	ENOENT                                = 2
   982  	ENOEXEC                               = 8
   983  	ENOKEY                                = 126
   984  	ENOLCK                                = 37
   985  	ENOLINK                               = 67
   986  	ENOMEDIUM                             = 123
   987  	ENOMEM                                = 12
   988  	ENOMSG                                = 42
   989  	ENONET                                = 64
   990  	ENOPKG                                = 65
   991  	ENOPROTOOPT                           = 92
   992  	ENOSPC                                = 28
   993  	ENOSR                                 = 63
   994  	ENOSTR                                = 60
   995  	ENOSYS                                = 38
   996  	ENOTBLK                               = 15
   997  	ENOTCONN                              = 107
   998  	ENOTDIR                               = 20
   999  	ENOTEMPTY                             = 39
  1000  	ENOTNAM                               = 118
  1001  	ENOTRECOVERABLE                       = 131
  1002  	ENOTSOCK                              = 88
  1003  	ENOTSUP                               = 95
  1004  	ENOTTY                                = 25
  1005  	ENOTUNIQ                              = 76
  1006  	ENXIO                                 = 6
  1007  	EOPNOTSUPP                            = 95
  1008  	EOVERFLOW                             = 75
  1009  	EOWNERDEAD                            = 130
  1010  	EPERM                                 = 1
  1011  	EPFNOSUPPORT                          = 96
  1012  	EPIPE                                 = 32
  1013  	EPROTO                                = 71
  1014  	EPROTONOSUPPORT                       = 93
  1015  	EPROTOTYPE                            = 91
  1016  	ERANGE                                = 34
  1017  	EREMCHG                               = 78
  1018  	EREMOTE                               = 66
  1019  	EREMOTEIO                             = 121
  1020  	ERESTART                              = 85
  1021  	ERFKILL                               = 132
  1022  	EROFS                                 = 30
  1023  	ESHUTDOWN                             = 108
  1024  	ESOCKTNOSUPPORT                       = 94
  1025  	ESPIPE                                = 29
  1026  	ESRCH                                 = 3
  1027  	ESRMNT                                = 69
  1028  	ESTALE                                = 116
  1029  	ESTRPIPE                              = 86
  1030  	ETIME                                 = 62
  1031  	ETIMEDOUT                             = 110
  1032  	ETOOMANYREFS                          = 109
  1033  	ETXTBSY                               = 26
  1034  	EUCLEAN                               = 117
  1035  	EUNATCH                               = 49
  1036  	EUSERS                                = 87
  1037  	EWOULDBLOCK                           = 11
  1038  	EXDEV                                 = 18
  1039  	EXFULL                                = 54
  1040  	FAPPEND                               = 1024
  1041  	FASYNC                                = 8192
  1042  	FD_CLOEXEC                            = 1
  1043  	FFSYNC                                = 1052672
  1044  	FNDELAY                               = 2048
  1045  	FNONBLOCK                             = 2048
  1046  	FSDIR_COLUMN_DATA                     = 3
  1047  	FSDIR_COLUMN_DIR                      = 5
  1048  	FSDIR_COLUMN_MODE                     = 1
  1049  	FSDIR_COLUMN_MTIME                    = 2
  1050  	FSDIR_COLUMN_NAME                     = 0
  1051  	FSDIR_COLUMN_PATH                     = 4
  1052  	FSDIR_SCHEMA                          = "(name,mode,mtime,data,path HIDDEN,dir HIDDEN)"
  1053  	F_DUPFD                               = 0
  1054  	F_DUPFD_CLOEXEC                       = 1030
  1055  	F_EXLCK                               = 4
  1056  	F_GETFD                               = 1
  1057  	F_GETFL                               = 3
  1058  	F_GETLK                               = 12
  1059  	F_GETLK64                             = 12
  1060  	F_GETOWN                              = 9
  1061  	F_LOCK                                = 1
  1062  	F_OK                                  = 0
  1063  	F_RDLCK                               = 0
  1064  	F_SETFD                               = 2
  1065  	F_SETFL                               = 4
  1066  	F_SETLK                               = 13
  1067  	F_SETLK64                             = 13
  1068  	F_SETLKW                              = 14
  1069  	F_SETLKW64                            = 14
  1070  	F_SETOWN                              = 8
  1071  	F_SHLCK                               = 8
  1072  	F_TEST                                = 3
  1073  	F_TLOCK                               = 2
  1074  	F_ULOCK                               = 0
  1075  	F_UNLCK                               = 2
  1076  	F_WRLCK                               = 1
  1077  	HOST_NAME_MAX                         = 64
  1078  	LOCK_EX                               = 2
  1079  	LOCK_NB                               = 4
  1080  	LOCK_SH                               = 1
  1081  	LOCK_UN                               = 8
  1082  	LOGIN_NAME_MAX                        = 256
  1083  	L_INCR                                = 1
  1084  	L_SET                                 = 0
  1085  	L_XTND                                = 2
  1086  	MAXNAMLEN                             = 255
  1087  	MAX_CANON                             = 255
  1088  	MAX_INPUT                             = 255
  1089  	MQ_PRIO_MAX                           = 32768
  1090  	NAME_MAX                              = 255
  1091  	NGROUPS_MAX                           = 65536
  1092  	O_ACCMODE                             = 0003
  1093  	O_APPEND                              = 02000
  1094  	O_ASYNC                               = 020000
  1095  	O_CLOEXEC                             = 524288
  1096  	O_CREAT                               = 0100
  1097  	O_DIRECTORY                           = 16384
  1098  	O_DSYNC                               = 4096
  1099  	O_EXCL                                = 0200
  1100  	O_FSYNC                               = 1052672
  1101  	O_NDELAY                              = 2048
  1102  	O_NOCTTY                              = 0400
  1103  	O_NOFOLLOW                            = 32768
  1104  	O_NONBLOCK                            = 04000
  1105  	O_RDONLY                              = 00
  1106  	O_RDWR                                = 02
  1107  	O_RSYNC                               = 1052672
  1108  	O_SYNC                                = 04010000
  1109  	O_TRUNC                               = 01000
  1110  	O_WRONLY                              = 01
  1111  	PATH_MAX                              = 4096
  1112  	PIPE_BUF                              = 4096
  1113  	POSIX_FADV_DONTNEED                   = 4
  1114  	POSIX_FADV_NOREUSE                    = 5
  1115  	POSIX_FADV_NORMAL                     = 0
  1116  	POSIX_FADV_RANDOM                     = 1
  1117  	POSIX_FADV_SEQUENTIAL                 = 2
  1118  	POSIX_FADV_WILLNEED                   = 3
  1119  	PTHREAD_DESTRUCTOR_ITERATIONS         = 4
  1120  	PTHREAD_KEYS_MAX                      = 1024
  1121  	PTHREAD_STACK_MIN                     = 16384
  1122  	RTSIG_MAX                             = 32
  1123  	R_OK                                  = 4
  1124  	SEM_VALUE_MAX                         = 2147483647
  1125  	STDERR_FILENO                         = 2
  1126  	STDIN_FILENO                          = 0
  1127  	STDOUT_FILENO                         = 1
  1128  	S_BLKSIZE                             = 512
  1129  	S_IEXEC                               = 64
  1130  	S_IFBLK                               = 24576
  1131  	S_IFCHR                               = 8192
  1132  	S_IFDIR                               = 16384
  1133  	S_IFIFO                               = 4096
  1134  	S_IFLNK                               = 40960
  1135  	S_IFMT                                = 61440
  1136  	S_IFREG                               = 32768
  1137  	S_IFSOCK                              = 49152
  1138  	S_IREAD                               = 256
  1139  	S_IRGRP                               = 32
  1140  	S_IROTH                               = 4
  1141  	S_IRUSR                               = 256
  1142  	S_IRWXG                               = 56
  1143  	S_IRWXO                               = 7
  1144  	S_IRWXU                               = 448
  1145  	S_ISGID                               = 1024
  1146  	S_ISUID                               = 2048
  1147  	S_ISVTX                               = 512
  1148  	S_IWGRP                               = 16
  1149  	S_IWOTH                               = 2
  1150  	S_IWRITE                              = 128
  1151  	S_IWUSR                               = 128
  1152  	S_IXGRP                               = 8
  1153  	S_IXOTH                               = 1
  1154  	S_IXUSR                               = 64
  1155  	TIMER_ABSTIME                         = 1
  1156  	TIME_UTC                              = 1
  1157  	TTY_NAME_MAX                          = 32
  1158  	UTIME_NOW                             = 1073741823
  1159  	UTIME_OMIT                            = 1073741822
  1160  	W_OK                                  = 2
  1161  	XATTR_LIST_MAX                        = 65536
  1162  	XATTR_NAME_MAX                        = 255
  1163  	XATTR_SIZE_MAX                        = 65536
  1164  	X_OK                                  = 1
  1165  	X_ASM_GENERIC_ERRNO_BASE_H            = 0
  1166  	X_ASM_GENERIC_ERRNO_H                 = 0
  1167  	X_BITS_ERRNO_H                        = 1
  1168  	X_BITS_POSIX1_LIM_H                   = 1
  1169  	X_BITS_POSIX_OPT_H                    = 1
  1170  	X_BITS_STAT_H                         = 1
  1171  	X_BITS_TIME_H                         = 1
  1172  	X_DIRENT_H                            = 1
  1173  	X_DIRENT_HAVE_D_OFF                   = 0
  1174  	X_DIRENT_HAVE_D_RECLEN                = 0
  1175  	X_DIRENT_HAVE_D_TYPE                  = 0
  1176  	X_DIRENT_MATCHES_DIRENT64             = 0
  1177  	X_ERRNO_H                             = 1
  1178  	X_FCNTL_H                             = 1
  1179  	X_GETOPT_CORE_H                       = 1
  1180  	X_GETOPT_POSIX_H                      = 1
  1181  	X_LFS64_ASYNCHRONOUS_IO               = 1
  1182  	X_LFS64_LARGEFILE                     = 1
  1183  	X_LFS64_STDIO                         = 1
  1184  	X_LFS_ASYNCHRONOUS_IO                 = 1
  1185  	X_LFS_LARGEFILE                       = 1
  1186  	X_LINUX_LIMITS_H                      = 0
  1187  	X_MKNOD_VER                           = 1
  1188  	X_MKNOD_VER_LINUX                     = 1
  1189  	X_MKNOD_VER_SVR4                      = 2
  1190  	X_POSIX2_CHAR_TERM                    = 200809
  1191  	X_POSIX2_C_BIND                       = 200809
  1192  	X_POSIX2_C_DEV                        = 200809
  1193  	X_POSIX2_C_VERSION                    = 200809
  1194  	X_POSIX2_LOCALEDEF                    = 200809
  1195  	X_POSIX2_SW_DEV                       = 200809
  1196  	X_POSIX2_VERSION                      = 200809
  1197  	X_POSIX_ADVISORY_INFO                 = 200809
  1198  	X_POSIX_AIO_LISTIO_MAX                = 2
  1199  	X_POSIX_AIO_MAX                       = 1
  1200  	X_POSIX_ARG_MAX                       = 4096
  1201  	X_POSIX_ASYNCHRONOUS_IO               = 200809
  1202  	X_POSIX_ASYNC_IO                      = 1
  1203  	X_POSIX_BARRIERS                      = 200809
  1204  	X_POSIX_CHILD_MAX                     = 25
  1205  	X_POSIX_CHOWN_RESTRICTED              = 0
  1206  	X_POSIX_CLOCKRES_MIN                  = 20000000
  1207  	X_POSIX_CLOCK_SELECTION               = 200809
  1208  	X_POSIX_CPUTIME                       = 0
  1209  	X_POSIX_DELAYTIMER_MAX                = 32
  1210  	X_POSIX_FSYNC                         = 200809
  1211  	X_POSIX_HOST_NAME_MAX                 = 255
  1212  	X_POSIX_IPV6                          = 200809
  1213  	X_POSIX_JOB_CONTROL                   = 1
  1214  	X_POSIX_LINK_MAX                      = 8
  1215  	X_POSIX_LOGIN_NAME_MAX                = 9
  1216  	X_POSIX_MAPPED_FILES                  = 200809
  1217  	X_POSIX_MAX_CANON                     = 255
  1218  	X_POSIX_MAX_INPUT                     = 255
  1219  	X_POSIX_MEMLOCK                       = 200809
  1220  	X_POSIX_MEMLOCK_RANGE                 = 200809
  1221  	X_POSIX_MEMORY_PROTECTION             = 200809
  1222  	X_POSIX_MESSAGE_PASSING               = 200809
  1223  	X_POSIX_MONOTONIC_CLOCK               = 0
  1224  	X_POSIX_MQ_OPEN_MAX                   = 8
  1225  	X_POSIX_MQ_PRIO_MAX                   = 32
  1226  	X_POSIX_NAME_MAX                      = 14
  1227  	X_POSIX_NGROUPS_MAX                   = 8
  1228  	X_POSIX_NO_TRUNC                      = 1
  1229  	X_POSIX_OPEN_MAX                      = 20
  1230  	X_POSIX_PATH_MAX                      = 256
  1231  	X_POSIX_PIPE_BUF                      = 512
  1232  	X_POSIX_PRIORITIZED_IO                = 200809
  1233  	X_POSIX_PRIORITY_SCHEDULING           = 200809
  1234  	X_POSIX_RAW_SOCKETS                   = 200809
  1235  	X_POSIX_READER_WRITER_LOCKS           = 200809
  1236  	X_POSIX_REALTIME_SIGNALS              = 200809
  1237  	X_POSIX_REENTRANT_FUNCTIONS           = 1
  1238  	X_POSIX_REGEXP                        = 1
  1239  	X_POSIX_RE_DUP_MAX                    = 255
  1240  	X_POSIX_RTSIG_MAX                     = 8
  1241  	X_POSIX_SAVED_IDS                     = 1
  1242  	X_POSIX_SEMAPHORES                    = 200809
  1243  	X_POSIX_SEM_NSEMS_MAX                 = 256
  1244  	X_POSIX_SEM_VALUE_MAX                 = 32767
  1245  	X_POSIX_SHARED_MEMORY_OBJECTS         = 200809
  1246  	X_POSIX_SHELL                         = 1
  1247  	X_POSIX_SIGQUEUE_MAX                  = 32
  1248  	X_POSIX_SPAWN                         = 200809
  1249  	X_POSIX_SPIN_LOCKS                    = 200809
  1250  	X_POSIX_SPORADIC_SERVER               = -1
  1251  	X_POSIX_SSIZE_MAX                     = 32767
  1252  	X_POSIX_STREAM_MAX                    = 8
  1253  	X_POSIX_SYMLINK_MAX                   = 255
  1254  	X_POSIX_SYMLOOP_MAX                   = 8
  1255  	X_POSIX_SYNCHRONIZED_IO               = 200809
  1256  	X_POSIX_THREADS                       = 200809
  1257  	X_POSIX_THREAD_ATTR_STACKADDR         = 200809
  1258  	X_POSIX_THREAD_ATTR_STACKSIZE         = 200809
  1259  	X_POSIX_THREAD_CPUTIME                = 0
  1260  	X_POSIX_THREAD_DESTRUCTOR_ITERATIONS  = 4
  1261  	X_POSIX_THREAD_KEYS_MAX               = 128
  1262  	X_POSIX_THREAD_PRIORITY_SCHEDULING    = 200809
  1263  	X_POSIX_THREAD_PRIO_INHERIT           = 200809
  1264  	X_POSIX_THREAD_PRIO_PROTECT           = 200809
  1265  	X_POSIX_THREAD_PROCESS_SHARED         = 200809
  1266  	X_POSIX_THREAD_ROBUST_PRIO_INHERIT    = 200809
  1267  	X_POSIX_THREAD_ROBUST_PRIO_PROTECT    = -1
  1268  	X_POSIX_THREAD_SAFE_FUNCTIONS         = 200809
  1269  	X_POSIX_THREAD_SPORADIC_SERVER        = -1
  1270  	X_POSIX_THREAD_THREADS_MAX            = 64
  1271  	X_POSIX_TIMEOUTS                      = 200809
  1272  	X_POSIX_TIMERS                        = 200809
  1273  	X_POSIX_TIMER_MAX                     = 32
  1274  	X_POSIX_TRACE                         = -1
  1275  	X_POSIX_TRACE_EVENT_FILTER            = -1
  1276  	X_POSIX_TRACE_INHERIT                 = -1
  1277  	X_POSIX_TRACE_LOG                     = -1
  1278  	X_POSIX_TTY_NAME_MAX                  = 9
  1279  	X_POSIX_TYPED_MEMORY_OBJECTS          = -1
  1280  	X_POSIX_TZNAME_MAX                    = 6
  1281  	X_POSIX_V6_ILP32_OFF32                = 1
  1282  	X_POSIX_V6_ILP32_OFFBIG               = 1
  1283  	X_POSIX_V6_LP64_OFF64                 = -1
  1284  	X_POSIX_V6_LPBIG_OFFBIG               = -1
  1285  	X_POSIX_V7_ILP32_OFF32                = 1
  1286  	X_POSIX_V7_ILP32_OFFBIG               = 1
  1287  	X_POSIX_V7_LP64_OFF64                 = -1
  1288  	X_POSIX_V7_LPBIG_OFFBIG               = -1
  1289  	X_POSIX_VDISABLE                      = 0
  1290  	X_POSIX_VERSION                       = 200809
  1291  	X_STATBUF_ST_BLKSIZE                  = 0
  1292  	X_STATBUF_ST_NSEC                     = 0
  1293  	X_STATBUF_ST_RDEV                     = 0
  1294  	X_STAT_VER                            = 3
  1295  	X_STAT_VER_KERNEL                     = 1
  1296  	X_STAT_VER_LINUX                      = 3
  1297  	X_STAT_VER_LINUX_OLD                  = 1
  1298  	X_STAT_VER_SVR4                       = 2
  1299  	X_SYS_STAT_H                          = 1
  1300  	X_SYS_TIME_H                          = 1
  1301  	X_TIME_H                              = 1
  1302  	X_UNISTD_H                            = 1
  1303  	X_UTIME_H                             = 1
  1304  	X_XBS5_ILP32_OFF32                    = 1
  1305  	X_XBS5_ILP32_OFFBIG                   = 1
  1306  	X_XBS5_LP64_OFF64                     = -1
  1307  	X_XBS5_LPBIG_OFFBIG                   = -1
  1308  	X_XOPEN_ENH_I18N                      = 1
  1309  	X_XOPEN_LEGACY                        = 1
  1310  	X_XOPEN_REALTIME                      = 1
  1311  	X_XOPEN_REALTIME_THREADS              = 1
  1312  	X_XOPEN_SHM                           = 1
  1313  	X_XOPEN_UNIX                          = 1
  1314  	X_XOPEN_VERSION                       = 700
  1315  	X_XOPEN_XCU_VERSION                   = 4
  1316  	X_XOPEN_XPG2                          = 1
  1317  	X_XOPEN_XPG3                          = 1
  1318  	X_XOPEN_XPG4                          = 1
  1319  	FUZZER_HASH                           = 4001
  1320  	FUZZER_MX_COST                        = 1000
  1321  	FUZZER_MX_LENGTH                      = 50
  1322  	FUZZER_MX_OUTPUT_LENGTH               = 100
  1323  	FUZZER_MX_RULEID                      = 2147483647
  1324  	FUZZER_NQUEUE                         = 20
  1325  	CC_AND                                = 24
  1326  	CC_BANG                               = 15
  1327  	CC_COMMA                              = 23
  1328  	CC_DIGIT                              = 3
  1329  	CC_DOLLAR                             = 4
  1330  	CC_DOT                                = 26
  1331  	CC_EQ                                 = 14
  1332  	CC_GT                                 = 13
  1333  	CC_ID                                 = 2
  1334  	CC_ILLEGAL                            = 27
  1335  	CC_KYWD                               = 1
  1336  	CC_LP                                 = 17
  1337  	CC_LT                                 = 12
  1338  	CC_MINUS                              = 11
  1339  	CC_PERCENT                            = 22
  1340  	CC_PIPE                               = 10
  1341  	CC_PLUS                               = 20
  1342  	CC_QUOTE                              = 8
  1343  	CC_QUOTE2                             = 9
  1344  	CC_RP                                 = 18
  1345  	CC_SEMI                               = 19
  1346  	CC_SLASH                              = 16
  1347  	CC_SPACE                              = 7
  1348  	CC_STAR                               = 21
  1349  	CC_TILDA                              = 25
  1350  	CC_VARALPHA                           = 5
  1351  	CC_VARNUM                             = 6
  1352  	CC_X                                  = 0
  1353  	TK_BITAND                             = 3
  1354  	TK_BITNOT                             = 3
  1355  	TK_BITOR                              = 3
  1356  	TK_BLOB                               = 2
  1357  	TK_COMMA                              = 3
  1358  	TK_CONCAT                             = 3
  1359  	TK_DOT                                = 3
  1360  	TK_EQ                                 = 3
  1361  	TK_ERROR                              = 4
  1362  	TK_FLOAT                              = 2
  1363  	TK_GE                                 = 3
  1364  	TK_GT                                 = 3
  1365  	TK_ID                                 = 1
  1366  	TK_ILLEGAL                            = 4
  1367  	TK_INTEGER                            = 2
  1368  	TK_LE                                 = 3
  1369  	TK_LITERAL                            = 2
  1370  	TK_LP                                 = 3
  1371  	TK_LSHIFT                             = 3
  1372  	TK_LT                                 = 3
  1373  	TK_MINUS                              = 3
  1374  	TK_NAME                               = 1
  1375  	TK_NE                                 = 3
  1376  	TK_PLUS                               = 3
  1377  	TK_PUNCT                              = 3
  1378  	TK_REM                                = 3
  1379  	TK_RP                                 = 3
  1380  	TK_RSHIFT                             = 3
  1381  	TK_SEMI                               = 3
  1382  	TK_SLASH                              = 3
  1383  	TK_SPACE                              = 0
  1384  	TK_STAR                               = 3
  1385  	TK_STRING                             = 2
  1386  	TK_VARIABLE                           = 2
  1387  	Deliberate_fall_through               = 0
  1388  	RE_EOF                                = 0
  1389  	RE_OP_ACCEPT                          = 6
  1390  	RE_OP_ANY                             = 2
  1391  	RE_OP_ANYSTAR                         = 3
  1392  	RE_OP_BOUNDARY                        = 17
  1393  	RE_OP_CC_EXC                          = 8
  1394  	RE_OP_CC_INC                          = 7
  1395  	RE_OP_CC_RANGE                        = 10
  1396  	RE_OP_CC_VALUE                        = 9
  1397  	RE_OP_DIGIT                           = 13
  1398  	RE_OP_FORK                            = 4
  1399  	RE_OP_GOTO                            = 5
  1400  	RE_OP_MATCH                           = 1
  1401  	RE_OP_NOTDIGIT                        = 14
  1402  	RE_OP_NOTSPACE                        = 16
  1403  	RE_OP_NOTWORD                         = 12
  1404  	RE_OP_SPACE                           = 15
  1405  	RE_OP_WORD                            = 11
  1406  	SERIES_COLUMN_START                   = 1
  1407  	SERIES_COLUMN_STEP                    = 3
  1408  	SERIES_COLUMN_STOP                    = 2
  1409  	SERIES_COLUMN_VALUE                   = 0
  1410  	CCLASS_B                              = 2
  1411  	CCLASS_C                              = 3
  1412  	CCLASS_D                              = 4
  1413  	CCLASS_DIGIT                          = 10
  1414  	CCLASS_H                              = 5
  1415  	CCLASS_L                              = 6
  1416  	CCLASS_M                              = 8
  1417  	CCLASS_OTHER                          = 12
  1418  	CCLASS_R                              = 7
  1419  	CCLASS_SILENT                         = 0
  1420  	CCLASS_SPACE                          = 11
  1421  	CCLASS_VOWEL                          = 1
  1422  	CCLASS_Y                              = 9
  1423  	FINAL_INS_COST_DIV                    = 4
  1424  	SCRIPT_ARABIC                         = 0x0010
  1425  	SCRIPT_CYRILLIC                       = 0x0002
  1426  	SCRIPT_GREEK                          = 0x0004
  1427  	SCRIPT_HEBREW                         = 0x0008
  1428  	SCRIPT_LATIN                          = 0x0001
  1429  	SPELLFIX_COL_COMMAND                  = 11
  1430  	SPELLFIX_COL_DISTANCE                 = 2
  1431  	SPELLFIX_COL_LANGID                   = 3
  1432  	SPELLFIX_COL_MATCHLEN                 = 5
  1433  	SPELLFIX_COL_PHONEHASH                = 6
  1434  	SPELLFIX_COL_RANK                     = 1
  1435  	SPELLFIX_COL_SCOPE                    = 8
  1436  	SPELLFIX_COL_SCORE                    = 4
  1437  	SPELLFIX_COL_SOUNDSLIKE               = 10
  1438  	SPELLFIX_COL_SRCHCNT                  = 9
  1439  	SPELLFIX_COL_TOP                      = 7
  1440  	SPELLFIX_COL_WORD                     = 0
  1441  	SPELLFIX_IDXNUM_DIST                  = 48
  1442  	SPELLFIX_IDXNUM_DISTLE                = 0x20
  1443  	SPELLFIX_IDXNUM_DISTLT                = 0x10
  1444  	SPELLFIX_IDXNUM_LANGID                = 0x02
  1445  	SPELLFIX_IDXNUM_MATCH                 = 0x01
  1446  	SPELLFIX_IDXNUM_ROWID                 = 0x40
  1447  	SPELLFIX_IDXNUM_SCOPE                 = 0x08
  1448  	SPELLFIX_IDXNUM_TOP                   = 0x04
  1449  	SPELLFIX_MX_HASH                      = 32
  1450  	SPELLFIX_MX_RUN                       = 1
  1451  	SQLITE_SPELLFIX_STACKALLOC_SZ         = 1024
  1452  	SWARMVTAB_MAX_OPEN                    = 9
  1453  	BC_BASE_MAX                           = 99
  1454  	BC_DIM_MAX                            = 2048
  1455  	BC_SCALE_MAX                          = 99
  1456  	BC_STRING_MAX                         = 1000
  1457  	CHARCLASS_NAME_MAX                    = 2048
  1458  	CHAR_BIT                              = 8
  1459  	CHAR_MAX                              = 255
  1460  	CHAR_MIN                              = 0
  1461  	COLL_WEIGHTS_MAX                      = 255
  1462  	EXPR_NEST_MAX                         = 32
  1463  	FAR                                   = 0
  1464  	INT_MAX                               = 2147483647
  1465  	INT_MIN                               = -2147483648
  1466  	LINE_MAX                              = 2048
  1467  	LLONG_MAX                             = 9223372036854775807
  1468  	LLONG_MIN                             = -9223372036854775808
  1469  	LONG_MAX                              = 2147483647
  1470  	LONG_MIN                              = -2147483648
  1471  	MAX_MEM_LEVEL                         = 9
  1472  	MAX_WBITS                             = 15
  1473  	MB_LEN_MAX                            = 16
  1474  	RE_DUP_MAX                            = 32767
  1475  	SCHAR_MAX                             = 127
  1476  	SCHAR_MIN                             = -128
  1477  	SHRT_MAX                              = 32767
  1478  	SHRT_MIN                              = -32768
  1479  	STDC                                  = 0
  1480  	STDC99                                = 0
  1481  	UCHAR_MAX                             = 255
  1482  	UINT_MAX                              = 4294967295
  1483  	ULLONG_MAX                            = 18446744073709551615
  1484  	ULONG_MAX                             = 4294967295
  1485  	USHRT_MAX                             = 65535
  1486  	ZCONF_H                               = 0
  1487  	ZEXPORT                               = 0
  1488  	ZEXPORTVA                             = 0
  1489  	ZIPFILE_BUFFER_SIZE                   = 65536
  1490  	ZIPFILE_CDS_FIXED_SZ                  = 46
  1491  	ZIPFILE_CDS_NFILE_OFF                 = 28
  1492  	ZIPFILE_CDS_SZCOMPRESSED_OFF          = 20
  1493  	ZIPFILE_EOCD_FIXED_SZ                 = 22
  1494  	ZIPFILE_EXTRA_TIMESTAMP               = 0x5455
  1495  	ZIPFILE_F_COLUMN_IDX                  = 7
  1496  	ZIPFILE_LFH_FIXED_SZ                  = 30
  1497  	ZIPFILE_NEWENTRY_FLAGS                = 0x800
  1498  	ZIPFILE_NEWENTRY_MADEBY               = 798
  1499  	ZIPFILE_NEWENTRY_REQUIRED             = 20
  1500  	ZIPFILE_SIGNATURE_CDS                 = 0x02014b50
  1501  	ZIPFILE_SIGNATURE_EOCD                = 0x06054b50
  1502  	ZIPFILE_SIGNATURE_LFH                 = 0x04034b50
  1503  	ZLIB_H                                = 0
  1504  	ZLIB_VERNUM                           = 0x12b0
  1505  	ZLIB_VERSION                          = "1.2.11"
  1506  	ZLIB_VER_MAJOR                        = 1
  1507  	ZLIB_VER_MINOR                        = 2
  1508  	ZLIB_VER_REVISION                     = 11
  1509  	ZLIB_VER_SUBREVISION                  = 0
  1510  	Z_ASCII                               = 1
  1511  	Z_BEST_COMPRESSION                    = 9
  1512  	Z_BEST_SPEED                          = 1
  1513  	Z_BINARY                              = 0
  1514  	Z_BLOCK                               = 5
  1515  	Z_BUF_ERROR                           = -5
  1516  	Z_DATA_ERROR                          = -3
  1517  	Z_DEFAULT_COMPRESSION                 = -1
  1518  	Z_DEFAULT_STRATEGY                    = 0
  1519  	Z_DEFLATED                            = 8
  1520  	Z_ERRNO                               = -1
  1521  	Z_FILTERED                            = 1
  1522  	Z_FINISH                              = 4
  1523  	Z_FIXED                               = 4
  1524  	Z_FULL_FLUSH                          = 3
  1525  	Z_HAVE_STDARG_H                       = 0
  1526  	Z_HAVE_UNISTD_H                       = 0
  1527  	Z_HUFFMAN_ONLY                        = 2
  1528  	Z_LFS64                               = 0
  1529  	Z_MEM_ERROR                           = -4
  1530  	Z_NEED_DICT                           = 2
  1531  	Z_NO_COMPRESSION                      = 0
  1532  	Z_NO_FLUSH                            = 0
  1533  	Z_NULL                                = 0
  1534  	Z_OK                                  = 0
  1535  	Z_PARTIAL_FLUSH                       = 1
  1536  	Z_RLE                                 = 3
  1537  	Z_STREAM_END                          = 1
  1538  	Z_STREAM_ERROR                        = -2
  1539  	Z_SYNC_FLUSH                          = 2
  1540  	Z_TEXT                                = 1
  1541  	Z_TREES                               = 6
  1542  	Z_UNKNOWN                             = 2
  1543  	Z_VERSION_ERROR                       = -6
  1544  	Z_WANT64                              = 0
  1545  	X_ANSI_STDDEF_H                       = 0
  1546  	X_BITS_POSIX2_LIM_H                   = 1
  1547  	X_BSD_PTRDIFF_T_                      = 0
  1548  	X_GCC_LIMITS_H_                       = 0
  1549  	X_GCC_MAX_ALIGN_T                     = 0
  1550  	X_GCC_PTRDIFF_T                       = 0
  1551  	X_LIBC_LIMITS_H_                      = 1
  1552  	X_LIMITS_H___                         = 0
  1553  	X_POSIX2_BC_BASE_MAX                  = 99
  1554  	X_POSIX2_BC_DIM_MAX                   = 2048
  1555  	X_POSIX2_BC_SCALE_MAX                 = 99
  1556  	X_POSIX2_BC_STRING_MAX                = 1000
  1557  	X_POSIX2_CHARCLASS_NAME_MAX           = 14
  1558  	X_POSIX2_COLL_WEIGHTS_MAX             = 2
  1559  	X_POSIX2_EXPR_NEST_MAX                = 32
  1560  	X_POSIX2_LINE_MAX                     = 2048
  1561  	X_POSIX2_RE_DUP_MAX                   = 255
  1562  	X_PTRDIFF_T                           = 0
  1563  	X_PTRDIFF_T_                          = 0
  1564  	X_PTRDIFF_T_DECLARED                  = 0
  1565  	X_STDDEF_H                            = 0
  1566  	X_STDDEF_H_                           = 0
  1567  	X_T_PTRDIFF                           = 0
  1568  	X_T_PTRDIFF_                          = 0
  1569  	Z_const                               = 0
  1570  	SQLITE_RBU_STATE_CHECKPOINT           = 3
  1571  	SQLITE_RBU_STATE_DONE                 = 4
  1572  	SQLITE_RBU_STATE_ERROR                = 5
  1573  	SQLITE_RBU_STATE_MOVE                 = 2
  1574  	SQLITE_RBU_STATE_OAL                  = 1
  1575  	X_SQLITE3RBU_H                        = 0
  1576  	SESSION_STREAM_TCL_VAR                = "sqlite3session_streams"
  1577  	MAX_PREPARED_STMTS                    = 100
  1578  	MINSIGSTKSZ                           = 2048
  1579  	NGREG                                 = 18
  1580  	NSIG                                  = 65
  1581  	NUM_PREPARED_STMTS                    = 10
  1582  	SA_INTERRUPT                          = 0x20000000
  1583  	SA_NOCLDSTOP                          = 1
  1584  	SA_NOCLDWAIT                          = 2
  1585  	SA_NODEFER                            = 0x40000000
  1586  	SA_NOMASK                             = 1073741824
  1587  	SA_ONESHOT                            = 2147483648
  1588  	SA_ONSTACK                            = 0x08000000
  1589  	SA_RESETHAND                          = 0x80000000
  1590  	SA_RESTART                            = 0x10000000
  1591  	SA_SIGINFO                            = 4
  1592  	SA_STACK                              = 134217728
  1593  	SIGABRT                               = 6
  1594  	SIGALRM                               = 14
  1595  	SIGBUS                                = 7
  1596  	SIGCHLD                               = 17
  1597  	SIGCLD                                = 17
  1598  	SIGCONT                               = 18
  1599  	SIGFPE                                = 8
  1600  	SIGHUP                                = 1
  1601  	SIGILL                                = 4
  1602  	SIGINT                                = 2
  1603  	SIGIO                                 = 29
  1604  	SIGIOT                                = 6
  1605  	SIGKILL                               = 9
  1606  	SIGPIPE                               = 13
  1607  	SIGPOLL                               = 29
  1608  	SIGPROF                               = 27
  1609  	SIGPWR                                = 30
  1610  	SIGQUIT                               = 3
  1611  	SIGSEGV                               = 11
  1612  	SIGSTKFLT                             = 16
  1613  	SIGSTKSZ                              = 8192
  1614  	SIGSTOP                               = 19
  1615  	SIGSYS                                = 31
  1616  	SIGTERM                               = 15
  1617  	SIGTRAP                               = 5
  1618  	SIGTSTP                               = 20
  1619  	SIGTTIN                               = 21
  1620  	SIGTTOU                               = 22
  1621  	SIGURG                                = 23
  1622  	SIGUSR1                               = 10
  1623  	SIGUSR2                               = 12
  1624  	SIGVTALRM                             = 26
  1625  	SIGWINCH                              = 28
  1626  	SIGXCPU                               = 24
  1627  	SIGXFSZ                               = 25
  1628  	SIG_BLOCK                             = 0
  1629  	SIG_SETMASK                           = 2
  1630  	SIG_UNBLOCK                           = 1
  1631  	SQLITE_EVAL_WITHOUTNULLS              = 0x00001
  1632  	SQLITE_TCL_NRE                        = 1
  1633  	TCLSH                                 = 1
  1634  	X_ASMARM_SIGCONTEXT_H                 = 0
  1635  	X_BITS_SIGACTION_H                    = 1
  1636  	X_BITS_SIGCONTEXT_H                   = 1
  1637  	X_BITS_SIGEVENT_CONSTS_H              = 1
  1638  	X_BITS_SIGINFO_ARCH_H                 = 1
  1639  	X_BITS_SIGINFO_CONSTS_H               = 1
  1640  	X_BITS_SIGNUM_GENERIC_H               = 1
  1641  	X_BITS_SIGNUM_H                       = 1
  1642  	X_BITS_SIGSTACK_H                     = 1
  1643  	X_BITS_SIGTHREAD_H                    = 1
  1644  	X_BITS_SS_FLAGS_H                     = 1
  1645  	X_NSIG                                = 65
  1646  	X_SIGNAL_H                            = 0
  1647  	X_SYS_UCONTEXT_H                      = 1
  1648  	ALT_SCHEMA_TABLE                      = "sqlite_schema"
  1649  	ALT_TEMP_SCHEMA_TABLE                 = "sqlite_temp_schema"
  1650  	BTREE_APPEND                          = 0x08
  1651  	BTREE_APPLICATION_ID                  = 8
  1652  	BTREE_AUTOVACUUM_FULL                 = 1
  1653  	BTREE_AUTOVACUUM_INCR                 = 2
  1654  	BTREE_AUTOVACUUM_NONE                 = 0
  1655  	BTREE_AUXDELETE                       = 0x04
  1656  	BTREE_BLOBKEY                         = 2
  1657  	BTREE_BULKLOAD                        = 0x00000001
  1658  	BTREE_DATA_VERSION                    = 15
  1659  	BTREE_DEFAULT_CACHE_SIZE              = 3
  1660  	BTREE_FILE_FORMAT                     = 2
  1661  	BTREE_FORDELETE                       = 0x00000008
  1662  	BTREE_FREE_PAGE_COUNT                 = 0
  1663  	BTREE_HINT_RANGE                      = 0
  1664  	BTREE_INCR_VACUUM                     = 7
  1665  	BTREE_INTKEY                          = 1
  1666  	BTREE_LARGEST_ROOT_PAGE               = 4
  1667  	BTREE_MEMORY                          = 2
  1668  	BTREE_OMIT_JOURNAL                    = 1
  1669  	BTREE_PREFORMAT                       = 0x80
  1670  	BTREE_SAVEPOSITION                    = 0x02
  1671  	BTREE_SCHEMA_VERSION                  = 1
  1672  	BTREE_SEEK_EQ                         = 0x00000002
  1673  	BTREE_SINGLE                          = 4
  1674  	BTREE_TEXT_ENCODING                   = 5
  1675  	BTREE_UNORDERED                       = 8
  1676  	BTREE_USER_VERSION                    = 6
  1677  	BTREE_WRCSR                           = 0x00000004
  1678  	CACHE_STALE                           = 0
  1679  	COLFLAG_BUSY                          = 0x0100
  1680  	COLFLAG_GENERATED                     = 0x0060
  1681  	COLFLAG_HASTYPE                       = 0x0004
  1682  	COLFLAG_HIDDEN                        = 0x0002
  1683  	COLFLAG_NOINSERT                      = 0x0062
  1684  	COLFLAG_NOTAVAIL                      = 0x0080
  1685  	COLFLAG_PRIMKEY                       = 0x0001
  1686  	COLFLAG_SORTERREF                     = 0x0010
  1687  	COLFLAG_STORED                        = 0x0040
  1688  	COLFLAG_UNIQUE                        = 0x0008
  1689  	COLFLAG_VIRTUAL                       = 0x0020
  1690  	COLNAME_COLUMN                        = 4
  1691  	COLNAME_DATABASE                      = 2
  1692  	COLNAME_DECLTYPE                      = 1
  1693  	COLNAME_N                             = 5
  1694  	COLNAME_NAME                          = 0
  1695  	COLNAME_TABLE                         = 3
  1696  	CURTYPE_BTREE                         = 0
  1697  	CURTYPE_PSEUDO                        = 3
  1698  	CURTYPE_SORTER                        = 1
  1699  	CURTYPE_VTAB                          = 2
  1700  	DBFLAG_EncodingFixed                  = 0x0040
  1701  	DBFLAG_InternalFunc                   = 0x0020
  1702  	DBFLAG_PreferBuiltin                  = 0x0002
  1703  	DBFLAG_SchemaChange                   = 0x0001
  1704  	DBFLAG_SchemaKnownOk                  = 0x0010
  1705  	DBFLAG_Vacuum                         = 0x0004
  1706  	DBFLAG_VacuumInto                     = 0x0008
  1707  	DB_ResetWanted                        = 0x0008
  1708  	DB_SchemaLoaded                       = 0x0001
  1709  	DB_UnresetViews                       = 0x0002
  1710  	DFLT_SCHEMA_TABLE                     = "sqlite_master"
  1711  	DFLT_TEMP_SCHEMA_TABLE                = "sqlite_temp_master"
  1712  	ENAME_NAME                            = 0
  1713  	ENAME_SPAN                            = 1
  1714  	ENAME_TAB                             = 2
  1715  	EP_Agg                                = 0x000010
  1716  	EP_CanBeNull                          = 0x100000
  1717  	EP_Collate                            = 0x000100
  1718  	EP_Commuted                           = 0x000200
  1719  	EP_ConstFunc                          = 0x080000
  1720  	EP_DblQuoted                          = 0x000040
  1721  	EP_Distinct                           = 0x000002
  1722  	EP_FixedCol                           = 0x000008
  1723  	EP_FromDDL                            = 0x40000000
  1724  	EP_FromJoin                           = 0x000001
  1725  	EP_HasFunc                            = 0x000004
  1726  	EP_IfNullRow                          = 0x020000
  1727  	EP_Immutable                          = 0x02
  1728  	EP_InfixFunc                          = 0x000080
  1729  	EP_IntValue                           = 0x000400
  1730  	EP_IsFalse                            = 0x20000000
  1731  	EP_IsTrue                             = 0x10000000
  1732  	EP_Leaf                               = 0x800000
  1733  	EP_MemToken                           = 0x010000
  1734  	EP_NoReduce                           = 0x01
  1735  	EP_Propagate                          = 2097412
  1736  	EP_Quoted                             = 0x4000000
  1737  	EP_Reduced                            = 0x002000
  1738  	EP_Skip                               = 0x001000
  1739  	EP_Static                             = 0x8000000
  1740  	EP_Subquery                           = 0x200000
  1741  	EP_Subrtn                             = 0x2000000
  1742  	EP_TokenOnly                          = 0x004000
  1743  	EP_Unlikely                           = 0x040000
  1744  	EP_VarSelect                          = 0x000020
  1745  	EP_Win                                = 0x008000
  1746  	EP_WinFunc                            = 0x1000000
  1747  	EP_xIsSelect                          = 0x000800
  1748  	EXCLUSIVE_LOCK                        = 4
  1749  	EXPRDUP_REDUCE                        = 0x0001
  1750  	GCC_VERSION                           = 8003000
  1751  	HAVE_DLFCN_H                          = 1
  1752  	HAVE_FCHOWN                           = 1
  1753  	HAVE_FDATASYNC                        = 1
  1754  	HAVE_GMTIME_R                         = 1
  1755  	HAVE_INT16_T                          = 1
  1756  	HAVE_INT32_T                          = 1
  1757  	HAVE_INT64_T                          = 1
  1758  	HAVE_INT8_T                           = 1
  1759  	HAVE_INTPTR_T                         = 1
  1760  	HAVE_INTTYPES_H                       = 1
  1761  	HAVE_ISNAN                            = 1
  1762  	HAVE_LOCALTIME_R                      = 1
  1763  	HAVE_LSTAT                            = 1
  1764  	HAVE_MALLOC_H                         = 1
  1765  	HAVE_MALLOC_USABLE_SIZE               = 1
  1766  	HAVE_MEMORY_H                         = 1
  1767  	HAVE_PREAD                            = 1
  1768  	HAVE_PREAD64                          = 1
  1769  	HAVE_PWRITE                           = 1
  1770  	HAVE_PWRITE64                         = 1
  1771  	HAVE_READLINK                         = 1
  1772  	HAVE_STDINT_H                         = 1
  1773  	HAVE_STDLIB_H                         = 1
  1774  	HAVE_STRCHRNUL                        = 1
  1775  	HAVE_STRINGS_H                        = 1
  1776  	HAVE_STRING_H                         = 1
  1777  	HAVE_SYS_STAT_H                       = 1
  1778  	HAVE_SYS_TYPES_H                      = 1
  1779  	HAVE_UINT16_T                         = 1
  1780  	HAVE_UINT32_T                         = 1
  1781  	HAVE_UINT64_T                         = 1
  1782  	HAVE_UINT8_T                          = 1
  1783  	HAVE_UINTPTR_T                        = 1
  1784  	HAVE_UNISTD_H                         = 1
  1785  	HAVE_UTIME                            = 1
  1786  	INITFLAG_AlterDrop                    = 0x0002
  1787  	INITFLAG_AlterRename                  = 0x0001
  1788  	INLINEFUNC_affinity                   = 4
  1789  	INLINEFUNC_coalesce                   = 0
  1790  	INLINEFUNC_expr_compare               = 3
  1791  	INLINEFUNC_expr_implies_expr          = 2
  1792  	INLINEFUNC_iif                        = 5
  1793  	INLINEFUNC_implies_nonnull_row        = 1
  1794  	INLINEFUNC_unlikely                   = 99
  1795  	INT16_MAX                             = 32767
  1796  	INT16_MIN                             = -32768
  1797  	INT16_WIDTH                           = 16
  1798  	INT32_MAX                             = 2147483647
  1799  	INT32_MIN                             = -2147483648
  1800  	INT32_WIDTH                           = 32
  1801  	INT64_MAX                             = 9223372036854775807
  1802  	INT64_MIN                             = -9223372036854775808
  1803  	INT64_WIDTH                           = 64
  1804  	INT8_MAX                              = 127
  1805  	INT8_MIN                              = -128
  1806  	INT8_WIDTH                            = 8
  1807  	INTMAX_MAX                            = 9223372036854775807
  1808  	INTMAX_MIN                            = -9223372036854775808
  1809  	INTMAX_WIDTH                          = 64
  1810  	INTPTR_MAX                            = 2147483647
  1811  	INTPTR_MIN                            = -2147483648
  1812  	INTPTR_WIDTH                          = 32
  1813  	INT_FAST16_MAX                        = 2147483647
  1814  	INT_FAST16_MIN                        = -2147483648
  1815  	INT_FAST16_WIDTH                      = 32
  1816  	INT_FAST32_MAX                        = 2147483647
  1817  	INT_FAST32_MIN                        = -2147483648
  1818  	INT_FAST32_WIDTH                      = 32
  1819  	INT_FAST64_MAX                        = 9223372036854775807
  1820  	INT_FAST64_MIN                        = -9223372036854775808
  1821  	INT_FAST64_WIDTH                      = 64
  1822  	INT_FAST8_MAX                         = 127
  1823  	INT_FAST8_MIN                         = -128
  1824  	INT_FAST8_WIDTH                       = 8
  1825  	INT_LEAST16_MAX                       = 32767
  1826  	INT_LEAST16_MIN                       = -32768
  1827  	INT_LEAST16_WIDTH                     = 16
  1828  	INT_LEAST32_MAX                       = 2147483647
  1829  	INT_LEAST32_MIN                       = -2147483648
  1830  	INT_LEAST32_WIDTH                     = 32
  1831  	INT_LEAST64_MAX                       = 9223372036854775807
  1832  	INT_LEAST64_MIN                       = -9223372036854775808
  1833  	INT_LEAST64_WIDTH                     = 64
  1834  	INT_LEAST8_MAX                        = 127
  1835  	INT_LEAST8_MIN                        = -128
  1836  	INT_LEAST8_WIDTH                      = 8
  1837  	IN_INDEX_EPH                          = 2
  1838  	IN_INDEX_INDEX_ASC                    = 3
  1839  	IN_INDEX_INDEX_DESC                   = 4
  1840  	IN_INDEX_LOOP                         = 0x0004
  1841  	IN_INDEX_MEMBERSHIP                   = 0x0002
  1842  	IN_INDEX_NOOP                         = 5
  1843  	IN_INDEX_NOOP_OK                      = 0x0001
  1844  	IN_INDEX_ROWID                        = 1
  1845  	JT_CROSS                              = 0x0002
  1846  	JT_ERROR                              = 0x0040
  1847  	JT_INNER                              = 0x0001
  1848  	JT_LEFT                               = 0x0008
  1849  	JT_NATURAL                            = 0x0004
  1850  	JT_OUTER                              = 0x0020
  1851  	JT_RIGHT                              = 0x0010
  1852  	KEYINFO_ORDER_BIGNULL                 = 0x02
  1853  	KEYINFO_ORDER_DESC                    = 0x01
  1854  	LOCATE_NOERR                          = 0x02
  1855  	LOCATE_VIEW                           = 0x01
  1856  	LOOKASIDE_SMALL                       = 128
  1857  	LT_OBJDIR                             = ".libs/"
  1858  	L_cuserid                             = 9
  1859  	M10d_Any                              = 1
  1860  	M10d_No                               = 2
  1861  	M10d_Yes                              = 0
  1862  	MEMTYPE_HEAP                          = 0x01
  1863  	MEMTYPE_LOOKASIDE                     = 0x02
  1864  	MEMTYPE_PCACHE                        = 0x04
  1865  	MEM_AffMask                           = 0x003f
  1866  	MEM_Agg                               = 0x2000
  1867  	MEM_Blob                              = 0x0010
  1868  	MEM_Cleared                           = 0x0100
  1869  	MEM_Dyn                               = 0x0400
  1870  	MEM_Ephem                             = 0x1000
  1871  	MEM_FromBind                          = 0x0040
  1872  	MEM_Int                               = 0x0004
  1873  	MEM_IntReal                           = 0x0020
  1874  	MEM_Null                              = 0x0001
  1875  	MEM_Real                              = 0x0008
  1876  	MEM_Static                            = 0x0800
  1877  	MEM_Str                               = 0x0002
  1878  	MEM_Subtype                           = 0x8000
  1879  	MEM_Term                              = 0x0200
  1880  	MEM_TypeMask                          = 0xc1bf
  1881  	MEM_Undefined                         = 0x0080
  1882  	MEM_Zero                              = 0x4000
  1883  	MSVC_VERSION                          = 0
  1884  	NC_AllowAgg                           = 0x00001
  1885  	NC_AllowWin                           = 0x04000
  1886  	NC_Complex                            = 0x02000
  1887  	NC_FromDDL                            = 0x40000
  1888  	NC_GenCol                             = 0x00008
  1889  	NC_HasAgg                             = 0x00010
  1890  	NC_HasWin                             = 0x08000
  1891  	NC_IdxExpr                            = 0x00020
  1892  	NC_InAggFunc                          = 0x20000
  1893  	NC_IsCheck                            = 0x00004
  1894  	NC_IsDDL                              = 0x10000
  1895  	NC_MinMaxAgg                          = 0x01000
  1896  	NC_NoSelect                           = 0x80000
  1897  	NC_PartIdx                            = 0x00002
  1898  	NC_SelfRef                            = 0x0002e
  1899  	NC_UAggInfo                           = 0x00100
  1900  	NC_UBaseReg                           = 0x00400
  1901  	NC_UEList                             = 0x00080
  1902  	NC_UUpsert                            = 0x00200
  1903  	NC_VarSelect                          = 0x00040
  1904  	NO_LOCK                               = 0
  1905  	OE_Abort                              = 2
  1906  	OE_Cascade                            = 10
  1907  	OE_Default                            = 11
  1908  	OE_Fail                               = 3
  1909  	OE_Ignore                             = 4
  1910  	OE_None                               = 0
  1911  	OE_Replace                            = 5
  1912  	OE_Restrict                           = 7
  1913  	OE_Rollback                           = 1
  1914  	OE_SetDflt                            = 9
  1915  	OE_SetNull                            = 8
  1916  	OE_Update                             = 6
  1917  	OMIT_TEMPDB                           = 0
  1918  	ONEPASS_MULTI                         = 2
  1919  	ONEPASS_OFF                           = 0
  1920  	ONEPASS_SINGLE                        = 1
  1921  	OPFLAG_APPEND                         = 0x08
  1922  	OPFLAG_AUXDELETE                      = 0x04
  1923  	OPFLAG_BULKCSR                        = 0x01
  1924  	OPFLAG_EPHEM                          = 0x01
  1925  	OPFLAG_FORDELETE                      = 0x08
  1926  	OPFLAG_ISNOOP                         = 0x40
  1927  	OPFLAG_ISUPDATE                       = 0x04
  1928  	OPFLAG_LASTROWID                      = 0x20
  1929  	OPFLAG_LENGTHARG                      = 0x40
  1930  	OPFLAG_NCHANGE                        = 0x01
  1931  	OPFLAG_NOCHNG                         = 0x01
  1932  	OPFLAG_NOCHNG_MAGIC                   = 0x6d
  1933  	OPFLAG_P2ISREG                        = 0x10
  1934  	OPFLAG_PERMUTE                        = 0x01
  1935  	OPFLAG_PREFORMAT                      = 0x80
  1936  	OPFLAG_SAVEPOSITION                   = 0x02
  1937  	OPFLAG_SEEKEQ                         = 0x02
  1938  	OPFLAG_TYPEOFARG                      = 0x80
  1939  	OPFLAG_USESEEKRESULT                  = 0x10
  1940  	OPFLG_IN1                             = 0x02
  1941  	OPFLG_IN2                             = 0x04
  1942  	OPFLG_IN3                             = 0x08
  1943  	OPFLG_JUMP                            = 0x01
  1944  	OPFLG_OUT2                            = 0x10
  1945  	OPFLG_OUT3                            = 0x20
  1946  	OP_Abortable                          = 179
  1947  	OP_Add                                = 106
  1948  	OP_AddImm                             = 83
  1949  	OP_Affinity                           = 92
  1950  	OP_AggFinal                           = 161
  1951  	OP_AggInverse                         = 157
  1952  	OP_AggStep                            = 158
  1953  	OP_AggStep1                           = 159
  1954  	OP_AggValue                           = 160
  1955  	OP_And                                = 44
  1956  	OP_AutoCommit                         = 1
  1957  	OP_BitAnd                             = 102
  1958  	OP_BitNot                             = 113
  1959  	OP_BitOr                              = 103
  1960  	OP_Blob                               = 74
  1961  	OP_Cast                               = 85
  1962  	OP_Checkpoint                         = 6
  1963  	OP_ChngCntRow                         = 80
  1964  	OP_Clear                              = 141
  1965  	OP_Close                              = 118
  1966  	OP_CollSeq                            = 82
  1967  	OP_Column                             = 91
  1968  	OP_ColumnsUsed                        = 119
  1969  	OP_Compare                            = 87
  1970  	OP_Concat                             = 111
  1971  	OP_Copy                               = 77
  1972  	OP_Count                              = 94
  1973  	OP_CreateBtree                        = 143
  1974  	OP_CursorHint                         = 175
  1975  	OP_CursorLock                         = 163
  1976  	OP_CursorUnlock                       = 164
  1977  	OP_DecrJumpZero                       = 59
  1978  	OP_DeferredSeek                       = 137
  1979  	OP_Delete                             = 126
  1980  	OP_Destroy                            = 140
  1981  	OP_Divide                             = 109
  1982  	OP_DropIndex                          = 148
  1983  	OP_DropTable                          = 147
  1984  	OP_DropTrigger                        = 149
  1985  	OP_ElseEq                             = 58
  1986  	OP_EndCoroutine                       = 66
  1987  	OP_Eq                                 = 53
  1988  	OP_Expire                             = 162
  1989  	OP_Explain                            = 178
  1990  	OP_FinishSeek                         = 139
  1991  	OP_FkCounter                          = 154
  1992  	OP_FkIfZero                           = 47
  1993  	OP_Found                              = 30
  1994  	OP_Function                           = 64
  1995  	OP_Ge                                 = 57
  1996  	OP_Gosub                              = 12
  1997  	OP_Goto                               = 11
  1998  	OP_Gt                                 = 54
  1999  	OP_Halt                               = 68
  2000  	OP_HaltIfNull                         = 67
  2001  	OP_IdxDelete                          = 136
  2002  	OP_IdxGE                              = 41
  2003  	OP_IdxGT                              = 39
  2004  	OP_IdxInsert                          = 134
  2005  	OP_IdxLE                              = 38
  2006  	OP_IdxLT                              = 40
  2007  	OP_IdxRowid                           = 138
  2008  	OP_If                                 = 18
  2009  	OP_IfNoHope                           = 27
  2010  	OP_IfNot                              = 20
  2011  	OP_IfNotOpen                          = 26
  2012  	OP_IfNotZero                          = 49
  2013  	OP_IfNullRow                          = 21
  2014  	OP_IfPos                              = 48
  2015  	OP_IfSmaller                          = 34
  2016  	OP_IncrVacuum                         = 60
  2017  	OP_Init                               = 62
  2018  	OP_InitCoroutine                      = 13
  2019  	OP_Insert                             = 124
  2020  	OP_Int64                              = 70
  2021  	OP_IntCopy                            = 79
  2022  	OP_Integer                            = 69
  2023  	OP_IntegrityCk                        = 150
  2024  	OP_IsNull                             = 50
  2025  	OP_IsTrue                             = 88
  2026  	OP_JournalMode                        = 7
  2027  	OP_Jump                               = 16
  2028  	OP_Last                               = 33
  2029  	OP_Le                                 = 55
  2030  	OP_LoadAnalysis                       = 146
  2031  	OP_Lt                                 = 56
  2032  	OP_MakeRecord                         = 93
  2033  	OP_MaxPgcnt                           = 173
  2034  	OP_MemMax                             = 155
  2035  	OP_Move                               = 76
  2036  	OP_Multiply                           = 108
  2037  	OP_MustBeInt                          = 15
  2038  	OP_Ne                                 = 52
  2039  	OP_NewRowid                           = 123
  2040  	OP_Next                               = 5
  2041  	OP_NoConflict                         = 28
  2042  	OP_Noop                               = 177
  2043  	OP_Not                                = 19
  2044  	OP_NotExists                          = 32
  2045  	OP_NotFound                           = 29
  2046  	OP_NotNull                            = 51
  2047  	OP_Null                               = 72
  2048  	OP_NullRow                            = 132
  2049  	OP_Offset                             = 90
  2050  	OP_OffsetLimit                        = 156
  2051  	OP_Once                               = 17
  2052  	OP_OpenAutoindex                      = 101
  2053  	OP_OpenDup                            = 100
  2054  	OP_OpenEphemeral                      = 112
  2055  	OP_OpenPseudo                         = 117
  2056  	OP_OpenRead                           = 98
  2057  	OP_OpenWrite                          = 99
  2058  	OP_Or                                 = 43
  2059  	OP_Pagecount                          = 172
  2060  	OP_Param                              = 153
  2061  	OP_ParseSchema                        = 145
  2062  	OP_Permutation                        = 86
  2063  	OP_Prev                               = 4
  2064  	OP_Program                            = 46
  2065  	OP_PureFunc                           = 63
  2066  	OP_ReadCookie                         = 95
  2067  	OP_Real                               = 152
  2068  	OP_RealAffinity                       = 84
  2069  	OP_ReleaseReg                         = 176
  2070  	OP_Remainder                          = 110
  2071  	OP_ReopenIdx                          = 97
  2072  	OP_ResetCount                         = 127
  2073  	OP_ResetSorter                        = 142
  2074  	OP_ResultRow                          = 81
  2075  	OP_Return                             = 65
  2076  	OP_Rewind                             = 37
  2077  	OP_RowCell                            = 125
  2078  	OP_RowData                            = 130
  2079  	OP_RowSetAdd                          = 151
  2080  	OP_RowSetRead                         = 42
  2081  	OP_RowSetTest                         = 45
  2082  	OP_Rowid                              = 131
  2083  	OP_SCopy                              = 78
  2084  	OP_Savepoint                          = 0
  2085  	OP_SeekEnd                            = 133
  2086  	OP_SeekGE                             = 24
  2087  	OP_SeekGT                             = 25
  2088  	OP_SeekHit                            = 121
  2089  	OP_SeekLE                             = 23
  2090  	OP_SeekLT                             = 22
  2091  	OP_SeekRowid                          = 31
  2092  	OP_SeekScan                           = 120
  2093  	OP_Sequence                           = 122
  2094  	OP_SequenceTest                       = 115
  2095  	OP_SetCookie                          = 96
  2096  	OP_ShiftLeft                          = 104
  2097  	OP_ShiftRight                         = 105
  2098  	OP_SoftNull                           = 73
  2099  	OP_Sort                               = 36
  2100  	OP_SorterCompare                      = 128
  2101  	OP_SorterData                         = 129
  2102  	OP_SorterInsert                       = 135
  2103  	OP_SorterNext                         = 3
  2104  	OP_SorterOpen                         = 114
  2105  	OP_SorterSort                         = 35
  2106  	OP_SqlExec                            = 144
  2107  	OP_String                             = 71
  2108  	OP_String8                            = 116
  2109  	OP_Subtract                           = 107
  2110  	OP_TableLock                          = 165
  2111  	OP_Trace                              = 174
  2112  	OP_Transaction                        = 2
  2113  	OP_VBegin                             = 166
  2114  	OP_VColumn                            = 170
  2115  	OP_VCreate                            = 167
  2116  	OP_VDestroy                           = 168
  2117  	OP_VFilter                            = 9
  2118  	OP_VNext                              = 61
  2119  	OP_VOpen                              = 169
  2120  	OP_VRename                            = 171
  2121  	OP_VUpdate                            = 10
  2122  	OP_Vacuum                             = 8
  2123  	OP_Variable                           = 75
  2124  	OP_Yield                              = 14
  2125  	OP_ZeroOrNull                         = 89
  2126  	OS_VXWORKS                            = 0
  2127  	P4_ADVANCE                            = -5
  2128  	P4_COLLSEQ                            = -2
  2129  	P4_DYNAMIC                            = -7
  2130  	P4_DYNBLOB                            = -17
  2131  	P4_EXPR                               = -10
  2132  	P4_FREE_IF_LE                         = -7
  2133  	P4_FUNCCTX                            = -16
  2134  	P4_FUNCDEF                            = -8
  2135  	P4_INT32                              = -3
  2136  	P4_INT64                              = -14
  2137  	P4_INTARRAY                           = -15
  2138  	P4_KEYINFO                            = -9
  2139  	P4_MEM                                = -11
  2140  	P4_NOTUSED                            = 0
  2141  	P4_REAL                               = -13
  2142  	P4_STATIC                             = -1
  2143  	P4_SUBPROGRAM                         = -4
  2144  	P4_TABLE                              = -6
  2145  	P4_TRANSIENT                          = 0
  2146  	P4_VTAB                               = -12
  2147  	P5_ConstraintCheck                    = 3
  2148  	P5_ConstraintFK                       = 4
  2149  	P5_ConstraintNotNull                  = 1
  2150  	P5_ConstraintUnique                   = 2
  2151  	PACKAGE_BUGREPORT                     = ""
  2152  	PACKAGE_NAME                          = "sqlite"
  2153  	PACKAGE_STRING                        = "sqlite 3.36.0"
  2154  	PACKAGE_TARNAME                       = "sqlite"
  2155  	PAGER_CACHESPILL                      = 0x20
  2156  	PAGER_CKPT_FULLFSYNC                  = 0x10
  2157  	PAGER_FLAGS_MASK                      = 0x38
  2158  	PAGER_FULLFSYNC                       = 0x08
  2159  	PAGER_GET_NOCONTENT                   = 0x01
  2160  	PAGER_GET_READONLY                    = 0x02
  2161  	PAGER_JOURNALMODE_DELETE              = 0
  2162  	PAGER_JOURNALMODE_MEMORY              = 4
  2163  	PAGER_JOURNALMODE_OFF                 = 2
  2164  	PAGER_JOURNALMODE_PERSIST             = 1
  2165  	PAGER_JOURNALMODE_QUERY               = -1
  2166  	PAGER_JOURNALMODE_TRUNCATE            = 3
  2167  	PAGER_JOURNALMODE_WAL                 = 5
  2168  	PAGER_LOCKINGMODE_EXCLUSIVE           = 1
  2169  	PAGER_LOCKINGMODE_NORMAL              = 0
  2170  	PAGER_LOCKINGMODE_QUERY               = -1
  2171  	PAGER_MEMORY                          = 0x0002
  2172  	PAGER_OMIT_JOURNAL                    = 0x0001
  2173  	PAGER_SYNCHRONOUS_EXTRA               = 0x04
  2174  	PAGER_SYNCHRONOUS_FULL                = 0x03
  2175  	PAGER_SYNCHRONOUS_MASK                = 0x07
  2176  	PAGER_SYNCHRONOUS_NORMAL              = 0x02
  2177  	PAGER_SYNCHRONOUS_OFF                 = 0x01
  2178  	PARSE_MODE_DECLARE_VTAB               = 1
  2179  	PARSE_MODE_NORMAL                     = 0
  2180  	PARSE_MODE_RENAME                     = 2
  2181  	PARSE_MODE_UNMAP                      = 3
  2182  	PENDING_LOCK                          = 3
  2183  	PGHDR_CLEAN                           = 0x001
  2184  	PGHDR_DIRTY                           = 0x002
  2185  	PGHDR_DONT_WRITE                      = 0x010
  2186  	PGHDR_MMAP                            = 0x020
  2187  	PGHDR_NEED_SYNC                       = 0x008
  2188  	PGHDR_WAL_APPEND                      = 0x040
  2189  	PGHDR_WRITEABLE                       = 0x004
  2190  	PRIO_MAX                              = 20
  2191  	PRIO_MIN                              = -20
  2192  	PRIX16                                = "X"
  2193  	PRIX32                                = "X"
  2194  	PRIX8                                 = "X"
  2195  	PRIXFAST8                             = "X"
  2196  	PRIXLEAST16                           = "X"
  2197  	PRIXLEAST32                           = "X"
  2198  	PRIXLEAST8                            = "X"
  2199  	PRId16                                = "d"
  2200  	PRId32                                = "d"
  2201  	PRId8                                 = "d"
  2202  	PRIdFAST8                             = "d"
  2203  	PRIdLEAST16                           = "d"
  2204  	PRIdLEAST32                           = "d"
  2205  	PRIdLEAST8                            = "d"
  2206  	PRIi16                                = "i"
  2207  	PRIi32                                = "i"
  2208  	PRIi8                                 = "i"
  2209  	PRIiFAST8                             = "i"
  2210  	PRIiLEAST16                           = "i"
  2211  	PRIiLEAST32                           = "i"
  2212  	PRIiLEAST8                            = "i"
  2213  	PRIo16                                = "o"
  2214  	PRIo32                                = "o"
  2215  	PRIo8                                 = "o"
  2216  	PRIoFAST8                             = "o"
  2217  	PRIoLEAST16                           = "o"
  2218  	PRIoLEAST32                           = "o"
  2219  	PRIoLEAST8                            = "o"
  2220  	PRIu16                                = "u"
  2221  	PRIu32                                = "u"
  2222  	PRIu8                                 = "u"
  2223  	PRIuFAST8                             = "u"
  2224  	PRIuLEAST16                           = "u"
  2225  	PRIuLEAST32                           = "u"
  2226  	PRIuLEAST8                            = "u"
  2227  	PRIx16                                = "x"
  2228  	PRIx32                                = "x"
  2229  	PRIx8                                 = "x"
  2230  	PRIxFAST8                             = "x"
  2231  	PRIxLEAST16                           = "x"
  2232  	PRIxLEAST32                           = "x"
  2233  	PRIxLEAST8                            = "x"
  2234  	PTRDIFF_MAX                           = 2147483647
  2235  	PTRDIFF_MIN                           = -2147483648
  2236  	PTRDIFF_WIDTH                         = 32
  2237  	RENAME_EXCHANGE                       = 2
  2238  	RENAME_NOREPLACE                      = 1
  2239  	RENAME_WHITEOUT                       = 4
  2240  	RESERVED_LOCK                         = 2
  2241  	RLIM64_INFINITY                       = 0xffffffffffffffff
  2242  	RLIM_INFINITY                         = 0xffffffffffffffff
  2243  	RLIM_SAVED_CUR                        = 18446744073709551615
  2244  	RLIM_SAVED_MAX                        = 18446744073709551615
  2245  	SAVEPOINT_BEGIN                       = 0
  2246  	SAVEPOINT_RELEASE                     = 1
  2247  	SAVEPOINT_ROLLBACK                    = 2
  2248  	SCHEMA_ROOT                           = 1
  2249  	SCNd16                                = "hd"
  2250  	SCNd32                                = "d"
  2251  	SCNd8                                 = "hhd"
  2252  	SCNdFAST8                             = "hhd"
  2253  	SCNdLEAST16                           = "hd"
  2254  	SCNdLEAST32                           = "d"
  2255  	SCNdLEAST8                            = "hhd"
  2256  	SCNi16                                = "hi"
  2257  	SCNi32                                = "i"
  2258  	SCNi8                                 = "hhi"
  2259  	SCNiFAST8                             = "hhi"
  2260  	SCNiLEAST16                           = "hi"
  2261  	SCNiLEAST32                           = "i"
  2262  	SCNiLEAST8                            = "hhi"
  2263  	SCNo16                                = "ho"
  2264  	SCNo32                                = "o"
  2265  	SCNo8                                 = "hho"
  2266  	SCNoFAST8                             = "hho"
  2267  	SCNoLEAST16                           = "ho"
  2268  	SCNoLEAST32                           = "o"
  2269  	SCNoLEAST8                            = "hho"
  2270  	SCNu16                                = "hu"
  2271  	SCNu32                                = "u"
  2272  	SCNu8                                 = "hhu"
  2273  	SCNuFAST8                             = "hhu"
  2274  	SCNuLEAST16                           = "hu"
  2275  	SCNuLEAST32                           = "u"
  2276  	SCNuLEAST8                            = "hhu"
  2277  	SCNx16                                = "hx"
  2278  	SCNx32                                = "x"
  2279  	SCNx8                                 = "hhx"
  2280  	SCNxFAST8                             = "hhx"
  2281  	SCNxLEAST16                           = "hx"
  2282  	SCNxLEAST32                           = "x"
  2283  	SCNxLEAST8                            = "hhx"
  2284  	SEEK_DATA                             = 3
  2285  	SEEK_HOLE                             = 4
  2286  	SELECTTRACE_ENABLED                   = 0
  2287  	SF_Aggregate                          = 0x0000008
  2288  	SF_All                                = 0x0000002
  2289  	SF_ComplexResult                      = 0x0040000
  2290  	SF_Compound                           = 0x0000100
  2291  	SF_Converted                          = 0x0010000
  2292  	SF_CopyCte                            = 0x4000000
  2293  	SF_Distinct                           = 0x0000001
  2294  	SF_Expanded                           = 0x0000040
  2295  	SF_FixedLimit                         = 0x0004000
  2296  	SF_HasAgg                             = 0x0000010
  2297  	SF_HasTypeInfo                        = 0x0000080
  2298  	SF_IncludeHidden                      = 0x0020000
  2299  	SF_MaybeConvert                       = 0x0008000
  2300  	SF_MinMaxAgg                          = 0x0001000
  2301  	SF_MultiPart                          = 0x2000000
  2302  	SF_MultiValue                         = 0x0000400
  2303  	SF_NestedFrom                         = 0x0000800
  2304  	SF_NoopOrderBy                        = 0x0400000
  2305  	SF_PushDown                           = 0x1000000
  2306  	SF_Recursive                          = 0x0002000
  2307  	SF_Resolved                           = 0x0000004
  2308  	SF_UpdateFrom                         = 0x0800000
  2309  	SF_UsesEphemeral                      = 0x0000020
  2310  	SF_Values                             = 0x0000200
  2311  	SF_View                               = 0x0200000
  2312  	SF_WhereBegin                         = 0x0080000
  2313  	SF_WinRewrite                         = 0x0100000
  2314  	SHARED_LOCK                           = 1
  2315  	SHARED_SIZE                           = 510
  2316  	SIG_ATOMIC_MAX                        = 2147483647
  2317  	SIG_ATOMIC_MIN                        = -2147483648
  2318  	SIG_ATOMIC_WIDTH                      = 32
  2319  	SIZE_MAX                              = 4294967295
  2320  	SIZE_WIDTH                            = 32
  2321  	SQLITECONFIG_H                        = 1
  2322  	SQLITEINT_H                           = 0
  2323  	SQLITE_AFF_BLOB                       = 0x41
  2324  	SQLITE_AFF_INTEGER                    = 0x44
  2325  	SQLITE_AFF_MASK                       = 0x47
  2326  	SQLITE_AFF_NONE                       = 0x40
  2327  	SQLITE_AFF_NUMERIC                    = 0x43
  2328  	SQLITE_AFF_REAL                       = 0x45
  2329  	SQLITE_AFF_TEXT                       = 0x42
  2330  	SQLITE_ASCII                          = 1
  2331  	SQLITE_AllOpts                        = 0xffffffff
  2332  	SQLITE_AutoIndex                      = 0x00008000
  2333  	SQLITE_BIGENDIAN                      = 0
  2334  	SQLITE_BIG_DBL                        = 0
  2335  	SQLITE_BTREE_H                        = 0
  2336  	SQLITE_BYTEORDER                      = 1234
  2337  	SQLITE_CacheSpill                     = 0x00000020
  2338  	SQLITE_CellSizeCk                     = 0x00200000
  2339  	SQLITE_CkptFullFSync                  = 0x00000010
  2340  	SQLITE_CountOfView                    = 0x00000200
  2341  	SQLITE_CoverIdxScan                   = 0x00000020
  2342  	SQLITE_CursorHints                    = 0x00000400
  2343  	SQLITE_DEFAULT_AUTOVACUUM             = 0
  2344  	SQLITE_DEFAULT_CACHE_SIZE             = -2000
  2345  	SQLITE_DEFAULT_FILE_FORMAT            = 4
  2346  	SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT     = -1
  2347  	SQLITE_DEFAULT_MMAP_SIZE              = 0
  2348  	SQLITE_DEFAULT_PCACHE_INITSZ          = 20
  2349  	SQLITE_DEFAULT_RECURSIVE_TRIGGERS     = 0
  2350  	SQLITE_DEFAULT_SECTOR_SIZE            = 4096
  2351  	SQLITE_DEFAULT_SORTERREF_SIZE         = 0x7fffffff
  2352  	SQLITE_DEFAULT_SYNCHRONOUS            = 2
  2353  	SQLITE_DEFAULT_WAL_AUTOCHECKPOINT     = 1000
  2354  	SQLITE_DEFAULT_WAL_SYNCHRONOUS        = 2
  2355  	SQLITE_DEFAULT_WORKER_THREADS         = 0
  2356  	SQLITE_Defensive                      = 0x10000000
  2357  	SQLITE_DeferFKs                       = 0x00080000
  2358  	SQLITE_DistinctOpt                    = 0x00000010
  2359  	SQLITE_DqsDDL                         = 0x20000000
  2360  	SQLITE_DqsDML                         = 0x40000000
  2361  	SQLITE_ECEL_DUP                       = 0x01
  2362  	SQLITE_ECEL_FACTOR                    = 0x02
  2363  	SQLITE_ECEL_OMITREF                   = 0x08
  2364  	SQLITE_ECEL_REF                       = 0x04
  2365  	SQLITE_ENABLE_LOCKING_STYLE           = 0
  2366  	SQLITE_EnableQPSG                     = 0x00800000
  2367  	SQLITE_EnableTrigger                  = 0x00040000
  2368  	SQLITE_EnableView                     = 0x80000000
  2369  	SQLITE_FAULTINJECTOR_COUNT            = 1
  2370  	SQLITE_FAULTINJECTOR_MALLOC           = 0
  2371  	SQLITE_FCNTL_DB_UNCHANGED             = 0xca093fa0
  2372  	SQLITE_FRAME_MAGIC                    = 0x879fb71e
  2373  	SQLITE_FUNC_CASE                      = 0x0008
  2374  	SQLITE_FUNC_CONSTANT                  = 0x0800
  2375  	SQLITE_FUNC_COUNT                     = 0x0100
  2376  	SQLITE_FUNC_DIRECT                    = 0x00080000
  2377  	SQLITE_FUNC_ENCMASK                   = 0x0003
  2378  	SQLITE_FUNC_EPHEM                     = 0x0010
  2379  	SQLITE_FUNC_HASH_SZ                   = 23
  2380  	SQLITE_FUNC_INLINE                    = 0x00400000
  2381  	SQLITE_FUNC_INTERNAL                  = 0x00040000
  2382  	SQLITE_FUNC_LENGTH                    = 0x0040
  2383  	SQLITE_FUNC_LIKE                      = 0x0004
  2384  	SQLITE_FUNC_MINMAX                    = 0x1000
  2385  	SQLITE_FUNC_NEEDCOLL                  = 0x0020
  2386  	SQLITE_FUNC_OFFSET                    = 0x8000
  2387  	SQLITE_FUNC_SLOCHNG                   = 0x2000
  2388  	SQLITE_FUNC_SUBTYPE                   = 0x00100000
  2389  	SQLITE_FUNC_TEST                      = 0x4000
  2390  	SQLITE_FUNC_TYPEOF                    = 0x0080
  2391  	SQLITE_FUNC_UNLIKELY                  = 0x0400
  2392  	SQLITE_FUNC_UNSAFE                    = 0x00200000
  2393  	SQLITE_FUNC_WINDOW                    = 0x00010000
  2394  	SQLITE_FactorOutConst                 = 0x00000008
  2395  	SQLITE_ForeignKeys                    = 0x00004000
  2396  	SQLITE_Fts3Tokenizer                  = 0x00400000
  2397  	SQLITE_FullColNames                   = 0x00000004
  2398  	SQLITE_FullFSync                      = 0x00000008
  2399  	SQLITE_GroupByOrder                   = 0x00000004
  2400  	SQLITE_HASH_H                         = 0
  2401  	SQLITE_HAVE_C99_MATH_FUNCS            = 1
  2402  	SQLITE_HAVE_OS_TRACE                  = 0
  2403  	SQLITE_IDXTYPE_APPDEF                 = 0
  2404  	SQLITE_IDXTYPE_IPK                    = 3
  2405  	SQLITE_IDXTYPE_PRIMARYKEY             = 2
  2406  	SQLITE_IDXTYPE_UNIQUE                 = 1
  2407  	SQLITE_IOERR_NOMEM_BKPT               = 3082
  2408  	SQLITE_IgnoreChecks                   = 0x00000200
  2409  	SQLITE_JUMPIFNULL                     = 0x10
  2410  	SQLITE_LITTLEENDIAN                   = 1
  2411  	SQLITE_LegacyAlter                    = 0x04000000
  2412  	SQLITE_LegacyFileFmt                  = 0x00000002
  2413  	SQLITE_LoadExtFunc                    = 0x00020000
  2414  	SQLITE_LoadExtension                  = 0x00010000
  2415  	SQLITE_MAGIC_BUSY                     = 0xf03b7906
  2416  	SQLITE_MAGIC_CLOSED                   = 0x9f3c2d33
  2417  	SQLITE_MAGIC_ERROR                    = 0xb5357930
  2418  	SQLITE_MAGIC_OPEN                     = 0xa029a697
  2419  	SQLITE_MAGIC_SICK                     = 0x4b771290
  2420  	SQLITE_MAGIC_ZOMBIE                   = 0x64cffc7f
  2421  	SQLITE_MALLOC_SOFT_LIMIT              = 1024
  2422  	SQLITE_MAX_ATTACHED                   = 10
  2423  	SQLITE_MAX_COLUMN                     = 2000
  2424  	SQLITE_MAX_COMPOUND_SELECT            = 500
  2425  	SQLITE_MAX_DB                         = 12
  2426  	SQLITE_MAX_DEFAULT_PAGE_SIZE          = 8192
  2427  	SQLITE_MAX_EXPR_DEPTH                 = 1000
  2428  	SQLITE_MAX_FILE_FORMAT                = 4
  2429  	SQLITE_MAX_FUNCTION_ARG               = 127
  2430  	SQLITE_MAX_LENGTH                     = 1000000000
  2431  	SQLITE_MAX_LIKE_PATTERN_LENGTH        = 50000
  2432  	SQLITE_MAX_MMAP_SIZE                  = 0x7fff0000
  2433  	SQLITE_MAX_PAGE_COUNT                 = 1073741823
  2434  	SQLITE_MAX_PAGE_SIZE                  = 65536
  2435  	SQLITE_MAX_PATHLEN                    = 4096
  2436  	SQLITE_MAX_SCHEMA_RETRY               = 50
  2437  	SQLITE_MAX_SQL_LENGTH                 = 1000000000
  2438  	SQLITE_MAX_TRIGGER_DEPTH              = 1000
  2439  	SQLITE_MAX_VARIABLE_NUMBER            = 32766
  2440  	SQLITE_MAX_VDBE_OP                    = 250000000
  2441  	SQLITE_MAX_WORKER_THREADS             = 8
  2442  	SQLITE_MSVC_H                         = 0
  2443  	SQLITE_MX_JUMP_OPCODE                 = 62
  2444  	SQLITE_MinMaxOpt                      = 0x00010000
  2445  	SQLITE_NEED_ERR_NAME                  = 0
  2446  	SQLITE_NOMEM_BKPT                     = 7
  2447  	SQLITE_NOTNULL                        = 0x90
  2448  	SQLITE_NTUNE                          = 6
  2449  	SQLITE_NULLEQ                         = 0x80
  2450  	SQLITE_N_BTREE_META                   = 16
  2451  	SQLITE_N_LIMIT                        = 12
  2452  	SQLITE_NoCkptOnClose                  = 0x00000800
  2453  	SQLITE_NoSchemaError                  = 0x08000000
  2454  	SQLITE_NullCallback                   = 0x00000100
  2455  	SQLITE_OS_OTHER                       = 0
  2456  	SQLITE_OS_SETUP_H                     = 0
  2457  	SQLITE_OS_UNIX                        = 1
  2458  	SQLITE_OS_WIN                         = 0
  2459  	SQLITE_OmitNoopJoin                   = 0x00000100
  2460  	SQLITE_OrderByIdxJoin                 = 0x00000040
  2461  	SQLITE_PAGER_H                        = 0
  2462  	SQLITE_POWERSAFE_OVERWRITE            = 1
  2463  	SQLITE_PREPARE_MASK                   = 0x0f
  2464  	SQLITE_PREPARE_SAVESQL                = 0x80
  2465  	SQLITE_PRINTF_INTERNAL                = 0x01
  2466  	SQLITE_PRINTF_MALLOCED                = 0x04
  2467  	SQLITE_PRINTF_SQLFUNC                 = 0x02
  2468  	SQLITE_PTRSIZE                        = 4
  2469  	SQLITE_PropagateConst                 = 0x00008000
  2470  	SQLITE_PushDown                       = 0x00001000
  2471  	SQLITE_QueryFlattener                 = 0x00000001
  2472  	SQLITE_QueryOnly                      = 0x00100000
  2473  	SQLITE_ReadUncommit                   = 0x00000400
  2474  	SQLITE_RecTriggers                    = 0x00002000
  2475  	SQLITE_ResetDatabase                  = 0x02000000
  2476  	SQLITE_ReverseOrder                   = 0x00001000
  2477  	SQLITE_SO_ASC                         = 0
  2478  	SQLITE_SO_DESC                        = 1
  2479  	SQLITE_SO_UNDEFINED                   = -1
  2480  	SQLITE_SYSTEM_MALLOC                  = 1
  2481  	SQLITE_SeekScan                       = 0x00020000
  2482  	SQLITE_ShortColNames                  = 0x00000040
  2483  	SQLITE_SimplifyJoin                   = 0x00002000
  2484  	SQLITE_SkipScan                       = 0x00004000
  2485  	SQLITE_Stat4                          = 0x00000800
  2486  	SQLITE_TEMP_FILE_PREFIX               = "etilqs_"
  2487  	SQLITE_TOKEN_KEYWORD                  = 0x2
  2488  	SQLITE_TOKEN_QUOTED                   = 0x1
  2489  	SQLITE_TRACE_LEGACY                   = 0x40
  2490  	SQLITE_TRACE_NONLEGACY_MASK           = 0x0f
  2491  	SQLITE_TRACE_XPROFILE                 = 0x80
  2492  	SQLITE_Transitive                     = 0x00000080
  2493  	SQLITE_TriggerEQP                     = 0x01000000
  2494  	SQLITE_TrustedSchema                  = 0x00000080
  2495  	SQLITE_UTF16NATIVE                    = 2
  2496  	SQLITE_VDBEINT_H                      = 0
  2497  	SQLITE_VDBE_H                         = 0
  2498  	SQLITE_VTABRISK_High                  = 2
  2499  	SQLITE_VTABRISK_Low                   = 0
  2500  	SQLITE_VTABRISK_Normal                = 1
  2501  	SQLITE_WSD                            = 0
  2502  	SQLITE_WindowFunc                     = 0x00000002
  2503  	SQLITE_WriteSchema                    = 0x00000001
  2504  	SRT_Coroutine                         = 13
  2505  	SRT_Discard                           = 4
  2506  	SRT_DistFifo                          = 5
  2507  	SRT_DistQueue                         = 6
  2508  	SRT_EphemTab                          = 12
  2509  	SRT_Except                            = 2
  2510  	SRT_Exists                            = 3
  2511  	SRT_Fifo                              = 8
  2512  	SRT_Mem                               = 10
  2513  	SRT_Output                            = 9
  2514  	SRT_Queue                             = 7
  2515  	SRT_Set                               = 11
  2516  	SRT_Table                             = 14
  2517  	SRT_Union                             = 1
  2518  	SRT_Upfrom                            = 15
  2519  	STDC_HEADERS                          = 1
  2520  	TF_Autoincrement                      = 0x0008
  2521  	TF_Ephemeral                          = 0x4000
  2522  	TF_Eponymous                          = 0x8000
  2523  	TF_HasGenerated                       = 0x0060
  2524  	TF_HasHidden                          = 0x0002
  2525  	TF_HasNotNull                         = 0x0800
  2526  	TF_HasPrimaryKey                      = 0x0004
  2527  	TF_HasStat1                           = 0x0010
  2528  	TF_HasStat4                           = 0x2000
  2529  	TF_HasStored                          = 0x0040
  2530  	TF_HasVirtual                         = 0x0020
  2531  	TF_NoVisibleRowid                     = 0x0200
  2532  	TF_OOOHidden                          = 0x0400
  2533  	TF_Readonly                           = 0x0001
  2534  	TF_Shadow                             = 0x1000
  2535  	TF_StatsUsed                          = 0x0100
  2536  	TF_WithoutRowid                       = 0x0080
  2537  	TK_ABORT                              = 27
  2538  	TK_ACTION                             = 28
  2539  	TK_ADD                                = 162
  2540  	TK_AFTER                              = 29
  2541  	TK_AGG_COLUMN                         = 168
  2542  	TK_AGG_FUNCTION                       = 167
  2543  	TK_ALL                                = 134
  2544  	TK_ALTER                              = 161
  2545  	TK_ALWAYS                             = 96
  2546  	TK_ANALYZE                            = 30
  2547  	TK_AND                                = 44
  2548  	TK_ANY                                = 101
  2549  	TK_AS                                 = 24
  2550  	TK_ASC                                = 31
  2551  	TK_ASTERISK                           = 179
  2552  	TK_ATTACH                             = 32
  2553  	TK_AUTOINCR                           = 125
  2554  	TK_BEFORE                             = 33
  2555  	TK_BEGIN                              = 5
  2556  	TK_BETWEEN                            = 48
  2557  	TK_BY                                 = 34
  2558  	TK_CASCADE                            = 35
  2559  	TK_CASE                               = 156
  2560  	TK_CAST                               = 36
  2561  	TK_CHECK                              = 123
  2562  	TK_COLLATE                            = 112
  2563  	TK_COLUMN                             = 166
  2564  	TK_COLUMNKW                           = 60
  2565  	TK_COMMIT                             = 10
  2566  	TK_CONFLICT                           = 37
  2567  	TK_CONSTRAINT                         = 118
  2568  	TK_CREATE                             = 17
  2569  	TK_CTIME_KW                           = 100
  2570  	TK_CURRENT                            = 85
  2571  	TK_DATABASE                           = 38
  2572  	TK_DEFAULT                            = 119
  2573  	TK_DEFERRABLE                         = 130
  2574  	TK_DEFERRED                           = 7
  2575  	TK_DELETE                             = 127
  2576  	TK_DESC                               = 39
  2577  	TK_DETACH                             = 40
  2578  	TK_DISTINCT                           = 139
  2579  	TK_DO                                 = 61
  2580  	TK_DROP                               = 132
  2581  	TK_EACH                               = 41
  2582  	TK_ELSE                               = 159
  2583  	TK_END                                = 11
  2584  	TK_ESCAPE                             = 58
  2585  	TK_EXCEPT                             = 135
  2586  	TK_EXCLUDE                            = 91
  2587  	TK_EXCLUSIVE                          = 9
  2588  	TK_EXISTS                             = 20
  2589  	TK_EXPLAIN                            = 2
  2590  	TK_FAIL                               = 42
  2591  	TK_FILTER                             = 165
  2592  	TK_FIRST                              = 83
  2593  	TK_FOLLOWING                          = 86
  2594  	TK_FOR                                = 62
  2595  	TK_FOREIGN                            = 131
  2596  	TK_FROM                               = 141
  2597  	TK_FUNCTION                           = 171
  2598  	TK_GENERATED                          = 95
  2599  	TK_GROUP                              = 145
  2600  	TK_GROUPS                             = 92
  2601  	TK_HAVING                             = 146
  2602  	TK_IF                                 = 18
  2603  	TK_IF_NULL_ROW                        = 178
  2604  	TK_IGNORE                             = 63
  2605  	TK_IMMEDIATE                          = 8
  2606  	TK_IN                                 = 49
  2607  	TK_INDEX                              = 160
  2608  	TK_INDEXED                            = 115
  2609  	TK_INITIALLY                          = 64
  2610  	TK_INSERT                             = 126
  2611  	TK_INSTEAD                            = 65
  2612  	TK_INTERSECT                          = 136
  2613  	TK_INTO                               = 150
  2614  	TK_IS                                 = 45
  2615  	TK_ISNOT                              = 170
  2616  	TK_ISNULL                             = 50
  2617  	TK_JOIN                               = 142
  2618  	TK_JOIN_KW                            = 117
  2619  	TK_KEY                                = 67
  2620  	TK_LAST                               = 84
  2621  	TK_LIKE_KW                            = 47
  2622  	TK_LIMIT                              = 147
  2623  	TK_MATCH                              = 46
  2624  	TK_MATERIALIZED                       = 97
  2625  	TK_NO                                 = 66
  2626  	TK_NOT                                = 19
  2627  	TK_NOTHING                            = 151
  2628  	TK_NOTNULL                            = 51
  2629  	TK_NULL                               = 120
  2630  	TK_NULLS                              = 82
  2631  	TK_OF                                 = 68
  2632  	TK_OFFSET                             = 69
  2633  	TK_ON                                 = 114
  2634  	TK_OR                                 = 43
  2635  	TK_ORDER                              = 144
  2636  	TK_OTHERS                             = 93
  2637  	TK_OVER                               = 164
  2638  	TK_PARTITION                          = 87
  2639  	TK_PLAN                               = 4
  2640  	TK_PRAGMA                             = 70
  2641  	TK_PRECEDING                          = 88
  2642  	TK_PRIMARY                            = 121
  2643  	TK_QUERY                              = 3
  2644  	TK_RAISE                              = 71
  2645  	TK_RANGE                              = 89
  2646  	TK_RECURSIVE                          = 72
  2647  	TK_REFERENCES                         = 124
  2648  	TK_REGISTER                           = 175
  2649  	TK_REINDEX                            = 98
  2650  	TK_RELEASE                            = 14
  2651  	TK_RENAME                             = 99
  2652  	TK_REPLACE                            = 73
  2653  	TK_RESTRICT                           = 74
  2654  	TK_RETURNING                          = 149
  2655  	TK_ROLLBACK                           = 12
  2656  	TK_ROW                                = 75
  2657  	TK_ROWS                               = 76
  2658  	TK_SAVEPOINT                          = 13
  2659  	TK_SELECT                             = 137
  2660  	TK_SELECT_COLUMN                      = 177
  2661  	TK_SET                                = 129
  2662  	TK_SPAN                               = 180
  2663  	TK_TABLE                              = 16
  2664  	TK_TEMP                               = 21
  2665  	TK_THEN                               = 158
  2666  	TK_TIES                               = 94
  2667  	TK_TO                                 = 15
  2668  	TK_TRANSACTION                        = 6
  2669  	TK_TRIGGER                            = 77
  2670  	TK_TRUEFALSE                          = 169
  2671  	TK_TRUTH                              = 174
  2672  	TK_UMINUS                             = 172
  2673  	TK_UNBOUNDED                          = 90
  2674  	TK_UNION                              = 133
  2675  	TK_UNIQUE                             = 122
  2676  	TK_UPDATE                             = 128
  2677  	TK_UPLUS                              = 173
  2678  	TK_USING                              = 143
  2679  	TK_VACUUM                             = 78
  2680  	TK_VALUES                             = 138
  2681  	TK_VECTOR                             = 176
  2682  	TK_VIEW                               = 79
  2683  	TK_VIRTUAL                            = 80
  2684  	TK_WHEN                               = 157
  2685  	TK_WHERE                              = 148
  2686  	TK_WINDOW                             = 163
  2687  	TK_WITH                               = 81
  2688  	TK_WITHOUT                            = 25
  2689  	TRIGGER_AFTER                         = 2
  2690  	TRIGGER_BEFORE                        = 1
  2691  	UINT16_MAX                            = 65535
  2692  	UINT16_WIDTH                          = 16
  2693  	UINT32_MAX                            = 4294967295
  2694  	UINT32_WIDTH                          = 32
  2695  	UINT64_MAX                            = 18446744073709551615
  2696  	UINT64_WIDTH                          = 64
  2697  	UINT8_MAX                             = 255
  2698  	UINT8_WIDTH                           = 8
  2699  	UINTMAX_MAX                           = 18446744073709551615
  2700  	UINTMAX_WIDTH                         = 64
  2701  	UINTPTR_MAX                           = 4294967295
  2702  	UINTPTR_WIDTH                         = 32
  2703  	UINT_FAST16_MAX                       = 4294967295
  2704  	UINT_FAST16_WIDTH                     = 32
  2705  	UINT_FAST32_MAX                       = 4294967295
  2706  	UINT_FAST32_WIDTH                     = 32
  2707  	UINT_FAST64_MAX                       = 18446744073709551615
  2708  	UINT_FAST64_WIDTH                     = 64
  2709  	UINT_FAST8_MAX                        = 255
  2710  	UINT_FAST8_WIDTH                      = 8
  2711  	UINT_LEAST16_MAX                      = 65535
  2712  	UINT_LEAST16_WIDTH                    = 16
  2713  	UINT_LEAST32_MAX                      = 4294967295
  2714  	UINT_LEAST32_WIDTH                    = 32
  2715  	UINT_LEAST64_MAX                      = 18446744073709551615
  2716  	UINT_LEAST64_WIDTH                    = 64
  2717  	UINT_LEAST8_MAX                       = 255
  2718  	UINT_LEAST8_WIDTH                     = 8
  2719  	VDBE_DISPLAY_P4                       = 1
  2720  	VDBE_MAGIC_DEAD                       = 0x5606c3c8
  2721  	VDBE_MAGIC_HALT                       = 0x319c2973
  2722  	VDBE_MAGIC_INIT                       = 0x16bceaa5
  2723  	VDBE_MAGIC_RESET                      = 0x48fa9f76
  2724  	VDBE_MAGIC_RUN                        = 0x2df20da3
  2725  	WCHAR_MAX                             = 4294967295
  2726  	WCHAR_MIN                             = 0
  2727  	WCHAR_WIDTH                           = 32
  2728  	WHERE_AGG_DISTINCT                    = 0x0400
  2729  	WHERE_DISTINCTBY                      = 0x0080
  2730  	WHERE_DISTINCT_NOOP                   = 0
  2731  	WHERE_DISTINCT_ORDERED                = 2
  2732  	WHERE_DISTINCT_UNIQUE                 = 1
  2733  	WHERE_DISTINCT_UNORDERED              = 3
  2734  	WHERE_DUPLICATES_OK                   = 0x0010
  2735  	WHERE_GROUPBY                         = 0x0040
  2736  	WHERE_ONEPASS_DESIRED                 = 0x0004
  2737  	WHERE_ONEPASS_MULTIROW                = 0x0008
  2738  	WHERE_ORDERBY_LIMIT                   = 0x0800
  2739  	WHERE_ORDERBY_MAX                     = 0x0002
  2740  	WHERE_ORDERBY_MIN                     = 0x0001
  2741  	WHERE_ORDERBY_NORMAL                  = 0x0000
  2742  	WHERE_OR_SUBCLAUSE                    = 0x0020
  2743  	WHERE_SORTBYGROUP                     = 0x0200
  2744  	WHERE_USE_LIMIT                       = 0x4000
  2745  	WHERE_WANT_DISTINCT                   = 0x0100
  2746  	WINT_MAX                              = 4294967295
  2747  	WINT_MIN                              = 0
  2748  	WINT_WIDTH                            = 32
  2749  	WRC_Abort                             = 2
  2750  	WRC_Continue                          = 0
  2751  	WRC_Prune                             = 1
  2752  	XN_EXPR                               = -2
  2753  	XN_ROWID                              = -1
  2754  	X_BITS_STDINT_UINTN_H                 = 1
  2755  	X_BITS_WCHAR_H                        = 1
  2756  	X_GCC_WRAP_STDINT_H                   = 0
  2757  	X_GNU_SOURCE                          = 0
  2758  	X_INTTYPES_H                          = 1
  2759  	X_ISOC11_SOURCE                       = 1
  2760  	X_ISOC95_SOURCE                       = 1
  2761  	X_ISOC99_SOURCE                       = 1
  2762  	X_LARGEFILE64_SOURCE                  = 1
  2763  	X_LARGEFILE_SOURCE                    = 1
  2764  	X_LARGE_FILE                          = 1
  2765  	X_SQLITE_OS_H_                        = 0
  2766  	X_STDINT_H                            = 1
  2767  	X_SYS_RESOURCE_H                      = 1
  2768  	X_XOPEN_SOURCE                        = 700
  2769  	X_XOPEN_SOURCE_EXTENDED               = 1
  2770  	BTCF_AtLast                           = 0x08
  2771  	BTCF_Incrblob                         = 0x10
  2772  	BTCF_Multiple                         = 0x20
  2773  	BTCF_Pinned                           = 0x40
  2774  	BTCF_ValidNKey                        = 0x02
  2775  	BTCF_ValidOvfl                        = 0x04
  2776  	BTCF_WriteFlag                        = 0x01
  2777  	BTCURSOR_MAX_DEPTH                    = 20
  2778  	BTS_EXCLUSIVE                         = 0x0040
  2779  	BTS_FAST_SECURE                       = 0x000c
  2780  	BTS_INITIALLY_EMPTY                   = 0x0010
  2781  	BTS_NO_WAL                            = 0x0020
  2782  	BTS_OVERWRITE                         = 0x0008
  2783  	BTS_PAGESIZE_FIXED                    = 0x0002
  2784  	BTS_PENDING                           = 0x0080
  2785  	BTS_READ_ONLY                         = 0x0001
  2786  	BTS_SECURE_DELETE                     = 0x0004
  2787  	CURSOR_FAULT                          = 4
  2788  	CURSOR_INVALID                        = 1
  2789  	CURSOR_REQUIRESEEK                    = 3
  2790  	CURSOR_SKIPNEXT                       = 2
  2791  	CURSOR_VALID                          = 0
  2792  	PTF_INTKEY                            = 0x01
  2793  	PTF_LEAF                              = 0x08
  2794  	PTF_LEAFDATA                          = 0x04
  2795  	PTF_ZERODATA                          = 0x02
  2796  	PTRMAP_BTREE                          = 5
  2797  	PTRMAP_FREEPAGE                       = 2
  2798  	PTRMAP_OVERFLOW1                      = 3
  2799  	PTRMAP_OVERFLOW2                      = 4
  2800  	PTRMAP_ROOTPAGE                       = 1
  2801  	READ_LOCK                             = 1
  2802  	SQLITE_FILE_HEADER                    = "SQLite format 3"
  2803  	TRANS_NONE                            = 0
  2804  	TRANS_READ                            = 1
  2805  	TRANS_WRITE                           = 2
  2806  	WRITE_LOCK                            = 2
  2807  	ADJ_ESTERROR                          = 0x0008
  2808  	ADJ_FREQUENCY                         = 0x0002
  2809  	ADJ_MAXERROR                          = 0x0004
  2810  	ADJ_MICRO                             = 0x1000
  2811  	ADJ_NANO                              = 0x2000
  2812  	ADJ_OFFSET                            = 0x0001
  2813  	ADJ_OFFSET_SINGLESHOT                 = 0x8001
  2814  	ADJ_OFFSET_SS_READ                    = 0xa001
  2815  	ADJ_SETOFFSET                         = 0x0100
  2816  	ADJ_STATUS                            = 0x0010
  2817  	ADJ_TAI                               = 0x0080
  2818  	ADJ_TICK                              = 0x4000
  2819  	ADJ_TIMECONST                         = 0x0020
  2820  	CLONE_CHILD_CLEARTID                  = 0x00200000
  2821  	CLONE_CHILD_SETTID                    = 0x01000000
  2822  	CLONE_DETACHED                        = 0x00400000
  2823  	CLONE_FILES                           = 0x00000400
  2824  	CLONE_FS                              = 0x00000200
  2825  	CLONE_IO                              = 0x80000000
  2826  	CLONE_NEWCGROUP                       = 0x02000000
  2827  	CLONE_NEWIPC                          = 0x08000000
  2828  	CLONE_NEWNET                          = 0x40000000
  2829  	CLONE_NEWNS                           = 0x00020000
  2830  	CLONE_NEWPID                          = 0x20000000
  2831  	CLONE_NEWUSER                         = 0x10000000
  2832  	CLONE_NEWUTS                          = 0x04000000
  2833  	CLONE_PARENT                          = 0x00008000
  2834  	CLONE_PARENT_SETTID                   = 0x00100000
  2835  	CLONE_PTRACE                          = 0x00002000
  2836  	CLONE_SETTLS                          = 0x00080000
  2837  	CLONE_SIGHAND                         = 0x00000800
  2838  	CLONE_SYSVSEM                         = 0x00040000
  2839  	CLONE_THREAD                          = 0x00010000
  2840  	CLONE_UNTRACED                        = 0x00800000
  2841  	CLONE_VFORK                           = 0x00004000
  2842  	CLONE_VM                              = 0x00000100
  2843  	CPU_SETSIZE                           = 1024
  2844  	CSIGNAL                               = 0x000000ff
  2845  	MOD_CLKA                              = 32769
  2846  	MOD_CLKB                              = 16384
  2847  	MOD_ESTERROR                          = 8
  2848  	MOD_FREQUENCY                         = 2
  2849  	MOD_MAXERROR                          = 4
  2850  	MOD_MICRO                             = 4096
  2851  	MOD_NANO                              = 8192
  2852  	MOD_OFFSET                            = 1
  2853  	MOD_STATUS                            = 16
  2854  	MOD_TAI                               = 128
  2855  	MOD_TIMECONST                         = 32
  2856  	N_THREAD                              = 26
  2857  	PTHREAD_BARRIER_SERIAL_THREAD         = -1
  2858  	PTHREAD_ONCE_INIT                     = 0
  2859  	SCHED_BATCH                           = 3
  2860  	SCHED_DEADLINE                        = 6
  2861  	SCHED_FIFO                            = 1
  2862  	SCHED_IDLE                            = 5
  2863  	SCHED_ISO                             = 4
  2864  	SCHED_OTHER                           = 0
  2865  	SCHED_RESET_ON_FORK                   = 0x40000000
  2866  	SCHED_RR                              = 2
  2867  	STA_CLK                               = 0x8000
  2868  	STA_CLOCKERR                          = 0x1000
  2869  	STA_DEL                               = 0x0020
  2870  	STA_FLL                               = 0x0008
  2871  	STA_FREQHOLD                          = 0x0080
  2872  	STA_INS                               = 0x0010
  2873  	STA_MODE                              = 0x4000
  2874  	STA_NANO                              = 0x2000
  2875  	STA_PLL                               = 0x0001
  2876  	STA_PPSERROR                          = 0x0800
  2877  	STA_PPSFREQ                           = 0x0002
  2878  	STA_PPSJITTER                         = 0x0200
  2879  	STA_PPSSIGNAL                         = 0x0100
  2880  	STA_PPSTIME                           = 0x0004
  2881  	STA_PPSWANDER                         = 0x0400
  2882  	STA_RONLY                             = 65280
  2883  	STA_UNSYNC                            = 0x0040
  2884  	X_BITS_CPU_SET_H                      = 1
  2885  	X_BITS_SCHED_H                        = 1
  2886  	X_BITS_SETJMP_H                       = 1
  2887  	X_BITS_TIMEX_H                        = 1
  2888  	X_BITS_TYPES_STRUCT_SCHED_PARAM       = 1
  2889  	X_PTHREAD_H                           = 1
  2890  	X_SCHED_H                             = 1
  2891  	TCL_THREADS                           = 0
  2892  	MX_CHUNK_NUMBER                       = 299
  2893  	SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET   = 400
  2894  	SQLITE_MULTIPLEX_WAL_8_3_OFFSET       = 700
  2895  	DEVSYM_MAX_PATHNAME                   = 512
  2896  	DEVSYM_VFS_NAME                       = "devsym"
  2897  	WRITECRASH_NAME                       = "writecrash"
  2898  	AT_EMPTY_PATH                         = 0x1000
  2899  	AT_NO_AUTOMOUNT                       = 0x800
  2900  	AT_STATX_DONT_SYNC                    = 0x4000
  2901  	AT_STATX_FORCE_SYNC                   = 0x2000
  2902  	AT_STATX_SYNC_AS_STAT                 = 0x0000
  2903  	AT_STATX_SYNC_TYPE                    = 0x6000
  2904  	DN_ACCESS                             = 0x00000001
  2905  	DN_ATTRIB                             = 0x00000020
  2906  	DN_CREATE                             = 0x00000004
  2907  	DN_DELETE                             = 0x00000008
  2908  	DN_MODIFY                             = 0x00000002
  2909  	DN_MULTISHOT                          = 0x80000000
  2910  	DN_RENAME                             = 0x00000010
  2911  	FALLOC_FL_COLLAPSE_RANGE              = 0x08
  2912  	FALLOC_FL_INSERT_RANGE                = 0x20
  2913  	FALLOC_FL_KEEP_SIZE                   = 0x01
  2914  	FALLOC_FL_NO_HIDE_STALE               = 0x04
  2915  	FALLOC_FL_PUNCH_HOLE                  = 0x02
  2916  	FALLOC_FL_UNSHARE_RANGE               = 0x40
  2917  	FALLOC_FL_ZERO_RANGE                  = 0x10
  2918  	F_ADD_SEALS                           = 1033
  2919  	F_GETLEASE                            = 1025
  2920  	F_GETOWN_EX                           = 16
  2921  	F_GETPIPE_SZ                          = 1032
  2922  	F_GETSIG                              = 11
  2923  	F_GET_FILE_RW_HINT                    = 1037
  2924  	F_GET_RW_HINT                         = 1035
  2925  	F_GET_SEALS                           = 1034
  2926  	F_NOTIFY                              = 1026
  2927  	F_OFD_GETLK                           = 36
  2928  	F_OFD_SETLK                           = 37
  2929  	F_OFD_SETLKW                          = 38
  2930  	F_SEAL_GROW                           = 0x0004
  2931  	F_SEAL_SEAL                           = 0x0001
  2932  	F_SEAL_SHRINK                         = 0x0002
  2933  	F_SEAL_WRITE                          = 0x0008
  2934  	F_SETLEASE                            = 1024
  2935  	F_SETOWN_EX                           = 15
  2936  	F_SETPIPE_SZ                          = 1031
  2937  	F_SETSIG                              = 10
  2938  	F_SET_FILE_RW_HINT                    = 1038
  2939  	F_SET_RW_HINT                         = 1036
  2940  	LOCK_MAND                             = 32
  2941  	LOCK_READ                             = 64
  2942  	LOCK_RW                               = 192
  2943  	LOCK_WRITE                            = 128
  2944  	MAX_HANDLE_SZ                         = 128
  2945  	O_DIRECT                              = 65536
  2946  	O_LARGEFILE                           = 131072
  2947  	O_NOATIME                             = 262144
  2948  	O_PATH                                = 2097152
  2949  	O_TMPFILE                             = 4210688
  2950  	RWF_WRITE_LIFE_NOT_SET                = 0
  2951  	RWH_WRITE_LIFE_EXTREME                = 5
  2952  	RWH_WRITE_LIFE_LONG                   = 4
  2953  	RWH_WRITE_LIFE_MEDIUM                 = 3
  2954  	RWH_WRITE_LIFE_NONE                   = 1
  2955  	RWH_WRITE_LIFE_SHORT                  = 2
  2956  	SPLICE_F_GIFT                         = 8
  2957  	SPLICE_F_MORE                         = 4
  2958  	SPLICE_F_MOVE                         = 1
  2959  	SPLICE_F_NONBLOCK                     = 2
  2960  	STATX_ALL                             = 0x0fff
  2961  	STATX_ATIME                           = 0x0020
  2962  	STATX_ATTR_APPEND                     = 0x0020
  2963  	STATX_ATTR_AUTOMOUNT                  = 0x1000
  2964  	STATX_ATTR_COMPRESSED                 = 0x0004
  2965  	STATX_ATTR_ENCRYPTED                  = 0x0800
  2966  	STATX_ATTR_IMMUTABLE                  = 0x0010
  2967  	STATX_ATTR_NODUMP                     = 0x0040
  2968  	STATX_BASIC_STATS                     = 0x07ff
  2969  	STATX_BLOCKS                          = 0x0400
  2970  	STATX_BTIME                           = 0x0800
  2971  	STATX_CTIME                           = 0x0080
  2972  	STATX_GID                             = 0x0010
  2973  	STATX_INO                             = 0x0100
  2974  	STATX_MODE                            = 0x0002
  2975  	STATX_MTIME                           = 0x0040
  2976  	STATX_NLINK                           = 0x0004
  2977  	STATX_SIZE                            = 0x0200
  2978  	STATX_TYPE                            = 0x0001
  2979  	STATX_UID                             = 0x0008
  2980  	STATX__RESERVED                       = 0x80000000
  2981  	SYNC_FILE_RANGE_WAIT_AFTER            = 4
  2982  	SYNC_FILE_RANGE_WAIT_BEFORE           = 1
  2983  	SYNC_FILE_RANGE_WRITE                 = 2
  2984  	X_FALLOC_H_                           = 0
  2985  	X_POSIX_FD_SETSIZE                    = 20
  2986  	X_POSIX_HIWAT                         = 512
  2987  	X_POSIX_QLIMIT                        = 1
  2988  	X_POSIX_UIO_MAXIOV                    = 16
  2989  	SQLITE_INTARRAY_H                     = 0
  2990  	JT_MAX_PATHNAME                       = 512
  2991  	JT_VFS_NAME                           = "jt"
  2992  	MALLOC_LOG_FRAMES                     = 10
  2993  	DEFAULT_SECTOR_SIZE                   = 0x1000
  2994  	MAX_PAGE_SIZE                         = 0x10000
  2995  	MULTIPLEX_CTRL_ENABLE                 = 214014
  2996  	MULTIPLEX_CTRL_SET_CHUNK_SIZE         = 214015
  2997  	MULTIPLEX_CTRL_SET_MAX_CHUNKS         = 214016
  2998  	SQLITE_MULTIPLEX_CHUNK_SIZE           = 2147418112
  2999  	SQLITE_MULTIPLEX_MAX_CHUNKS           = 12
  3000  	SQLITE_MULTIPLEX_VFS_NAME             = "multiplex"
  3001  	SQLITE_TEST_MULTIPLEX_H               = 0
  3002  	MAX_MUTEXES                           = 14
  3003  	STATIC_MUTEXES                        = 12
  3004  	BLOBSIZE                              = 10485760
  3005  	BLOCKSIZE                             = 512
  3006  	DATABASE_FILE                         = 1
  3007  	FS_VFS_NAME                           = "fs"
  3008  	JOURNAL_FILE                          = 2
  3009  	INST_MAX_PATHNAME                     = 512
  3010  	OS_ACCESS                             = 1
  3011  	OS_ANNOTATE                           = 28
  3012  	OS_CHECKRESERVEDLOCK                  = 2
  3013  	OS_CLOSE                              = 3
  3014  	OS_CURRENTTIME                        = 4
  3015  	OS_DELETE                             = 5
  3016  	OS_DEVCHAR                            = 6
  3017  	OS_FILECONTROL                        = 7
  3018  	OS_FILESIZE                           = 8
  3019  	OS_FULLPATHNAME                       = 9
  3020  	OS_LOCK                               = 11
  3021  	OS_NUMEVENTS                          = 29
  3022  	OS_OPEN                               = 12
  3023  	OS_RANDOMNESS                         = 13
  3024  	OS_READ                               = 14
  3025  	OS_SECTORSIZE                         = 15
  3026  	OS_SHMBARRIER                         = 26
  3027  	OS_SHMLOCK                            = 25
  3028  	OS_SHMMAP                             = 23
  3029  	OS_SHMUNMAP                           = 22
  3030  	OS_SLEEP                              = 16
  3031  	OS_SYNC                               = 17
  3032  	OS_TRUNCATE                           = 18
  3033  	OS_UNLOCK                             = 19
  3034  	OS_WRITE                              = 20
  3035  	VFSLOG_BUFFERSIZE                     = 8192
  3036  	TESTPCACHE_CLEAR                      = 0xd42670d4
  3037  	TESTPCACHE_NPAGE                      = 217
  3038  	TESTPCACHE_RESERVE                    = 17
  3039  	TESTPCACHE_VALID                      = 0x364585fd
  3040  	MSG_Close                             = 6
  3041  	MSG_Done                              = 7
  3042  	MSG_Finalize                          = 5
  3043  	MSG_Open                              = 1
  3044  	MSG_Prepare                           = 2
  3045  	MSG_Reset                             = 4
  3046  	MSG_Step                              = 3
  3047  	MADV_DODUMP                           = 17
  3048  	MADV_DOFORK                           = 11
  3049  	MADV_DONTDUMP                         = 16
  3050  	MADV_DONTFORK                         = 10
  3051  	MADV_DONTNEED                         = 4
  3052  	MADV_FREE                             = 8
  3053  	MADV_HUGEPAGE                         = 14
  3054  	MADV_HWPOISON                         = 100
  3055  	MADV_KEEPONFORK                       = 19
  3056  	MADV_MERGEABLE                        = 12
  3057  	MADV_NOHUGEPAGE                       = 15
  3058  	MADV_NORMAL                           = 0
  3059  	MADV_RANDOM                           = 1
  3060  	MADV_REMOVE                           = 9
  3061  	MADV_SEQUENTIAL                       = 2
  3062  	MADV_UNMERGEABLE                      = 13
  3063  	MADV_WILLNEED                         = 3
  3064  	MADV_WIPEONFORK                       = 18
  3065  	MAP_ANON                              = 32
  3066  	MAP_ANONYMOUS                         = 0x20
  3067  	MAP_DENYWRITE                         = 0x00800
  3068  	MAP_EXECUTABLE                        = 0x01000
  3069  	MAP_FILE                              = 0
  3070  	MAP_FIXED                             = 0x10
  3071  	MAP_FIXED_NOREPLACE                   = 0x100000
  3072  	MAP_GROWSDOWN                         = 0x00100
  3073  	MAP_HUGETLB                           = 0x40000
  3074  	MAP_HUGE_MASK                         = 0x3f
  3075  	MAP_HUGE_SHIFT                        = 26
  3076  	MAP_LOCKED                            = 0x02000
  3077  	MAP_NONBLOCK                          = 0x10000
  3078  	MAP_NORESERVE                         = 0x04000
  3079  	MAP_POPULATE                          = 0x08000
  3080  	MAP_PRIVATE                           = 0x02
  3081  	MAP_SHARED                            = 0x01
  3082  	MAP_SHARED_VALIDATE                   = 0x03
  3083  	MAP_STACK                             = 0x20000
  3084  	MAP_SYNC                              = 0x80000
  3085  	MAP_TYPE                              = 0x0f
  3086  	MCL_CURRENT                           = 1
  3087  	MCL_FUTURE                            = 2
  3088  	MCL_ONFAULT                           = 4
  3089  	MFD_ALLOW_SEALING                     = 2
  3090  	MFD_CLOEXEC                           = 1
  3091  	MFD_HUGETLB                           = 4
  3092  	MLOCK_ONFAULT                         = 1
  3093  	MREMAP_FIXED                          = 2
  3094  	MREMAP_MAYMOVE                        = 1
  3095  	MS_ASYNC                              = 1
  3096  	MS_INVALIDATE                         = 2
  3097  	MS_SYNC                               = 4
  3098  	PKEY_DISABLE_ACCESS                   = 0x1
  3099  	PKEY_DISABLE_WRITE                    = 0x2
  3100  	POSIX_MADV_DONTNEED                   = 4
  3101  	POSIX_MADV_NORMAL                     = 0
  3102  	POSIX_MADV_RANDOM                     = 1
  3103  	POSIX_MADV_SEQUENTIAL                 = 2
  3104  	POSIX_MADV_WILLNEED                   = 3
  3105  	PROT_EXEC                             = 0x4
  3106  	PROT_GROWSDOWN                        = 0x01000000
  3107  	PROT_GROWSUP                          = 0x02000000
  3108  	PROT_NONE                             = 0x0
  3109  	PROT_READ                             = 0x1
  3110  	PROT_WRITE                            = 0x2
  3111  	X_SYS_MMAN_H                          = 1
  3112  	TCLVAR_NAME_EQ                        = 101
  3113  	TCLVAR_NAME_MATCH                     = 109
  3114  	TCLVAR_VALUE_GLOB                     = 103
  3115  	TCLVAR_VALUE_LIKE                     = 108
  3116  	TCLVAR_VALUE_REGEXP                   = 114
  3117  	FAULT_INJECT_NONE                     = 0
  3118  	FAULT_INJECT_PERSISTENT               = 2
  3119  	FAULT_INJECT_TRANSIENT                = 1
  3120  	TESTVFS_ACCESS_MASK                   = 0x00004000
  3121  	TESTVFS_ALL_MASK                      = 0x001FFFFF
  3122  	TESTVFS_CKLOCK_MASK                   = 0x00080000
  3123  	TESTVFS_CLOSE_MASK                    = 0x00000800
  3124  	TESTVFS_DELETE_MASK                   = 0x00000400
  3125  	TESTVFS_FCNTL_MASK                    = 0x00100000
  3126  	TESTVFS_FULLPATHNAME_MASK             = 0x00008000
  3127  	TESTVFS_LOCK_MASK                     = 0x00040000
  3128  	TESTVFS_MAX_ARGS                      = 12
  3129  	TESTVFS_MAX_PAGES                     = 1024
  3130  	TESTVFS_OPEN_MASK                     = 0x00000100
  3131  	TESTVFS_READ_MASK                     = 0x00010000
  3132  	TESTVFS_SHMBARRIER_MASK               = 0x00000040
  3133  	TESTVFS_SHMCLOSE_MASK                 = 0x00000080
  3134  	TESTVFS_SHMLOCK_MASK                  = 0x00000010
  3135  	TESTVFS_SHMMAP_MASK                   = 0x00000020
  3136  	TESTVFS_SHMOPEN_MASK                  = 0x00000001
  3137  	TESTVFS_SYNC_MASK                     = 0x00000200
  3138  	TESTVFS_TRUNCATE_MASK                 = 0x00002000
  3139  	TESTVFS_UNLOCK_MASK                   = 0x00020000
  3140  	TESTVFS_WRITE_MASK                    = 0x00001000
  3141  )
  3142  
  3143  // Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf';
  3144  //    the `_SC_*' symbols for the NAME argument to `sysconf';
  3145  //    and the `_CS_*' symbols for the NAME argument to `confstr'.
  3146  // `sysconf', `pathconf', and `confstr' NAME values.  Generic version.
  3147  //    Copyright (C) 1993-2018 Free Software Foundation, Inc.
  3148  //    This file is part of the GNU C Library.
  3149  //
  3150  //    The GNU C Library is free software; you can redistribute it and/or
  3151  //    modify it under the terms of the GNU Lesser General Public
  3152  //    License as published by the Free Software Foundation; either
  3153  //    version 2.1 of the License, or (at your option) any later version.
  3154  //
  3155  //    The GNU C Library is distributed in the hope that it will be useful,
  3156  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3157  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3158  //    Lesser General Public License for more details.
  3159  //
  3160  //    You should have received a copy of the GNU Lesser General Public
  3161  //    License along with the GNU C Library; if not, see
  3162  //    <http://www.gnu.org/licenses/>.
  3163  
  3164  // Values for the NAME argument to `pathconf' and `fpathconf'.
  3165  const ( /* confname.h:24:1: */
  3166  	_PC_LINK_MAX           = 0
  3167  	_PC_MAX_CANON          = 1
  3168  	_PC_MAX_INPUT          = 2
  3169  	_PC_NAME_MAX           = 3
  3170  	_PC_PATH_MAX           = 4
  3171  	_PC_PIPE_BUF           = 5
  3172  	_PC_CHOWN_RESTRICTED   = 6
  3173  	_PC_NO_TRUNC           = 7
  3174  	_PC_VDISABLE           = 8
  3175  	_PC_SYNC_IO            = 9
  3176  	_PC_ASYNC_IO           = 10
  3177  	_PC_PRIO_IO            = 11
  3178  	_PC_SOCK_MAXBUF        = 12
  3179  	_PC_FILESIZEBITS       = 13
  3180  	_PC_REC_INCR_XFER_SIZE = 14
  3181  	_PC_REC_MAX_XFER_SIZE  = 15
  3182  	_PC_REC_MIN_XFER_SIZE  = 16
  3183  	_PC_REC_XFER_ALIGN     = 17
  3184  	_PC_ALLOC_SIZE_MIN     = 18
  3185  	_PC_SYMLINK_MAX        = 19
  3186  	_PC_2_SYMLINKS         = 20
  3187  )
  3188  
  3189  // Values for the NAME argument to `confstr'.
  3190  const ( /* confname.h:533:1: */
  3191  	_CS_PATH = 0 // The default search path.
  3192  
  3193  	_CS_V6_WIDTH_RESTRICTED_ENVS = 1
  3194  
  3195  	_CS_GNU_LIBC_VERSION       = 2
  3196  	_CS_GNU_LIBPTHREAD_VERSION = 3
  3197  
  3198  	_CS_V5_WIDTH_RESTRICTED_ENVS = 4
  3199  
  3200  	_CS_V7_WIDTH_RESTRICTED_ENVS = 5
  3201  
  3202  	_CS_LFS_CFLAGS      = 1000
  3203  	_CS_LFS_LDFLAGS     = 1001
  3204  	_CS_LFS_LIBS        = 1002
  3205  	_CS_LFS_LINTFLAGS   = 1003
  3206  	_CS_LFS64_CFLAGS    = 1004
  3207  	_CS_LFS64_LDFLAGS   = 1005
  3208  	_CS_LFS64_LIBS      = 1006
  3209  	_CS_LFS64_LINTFLAGS = 1007
  3210  
  3211  	_CS_XBS5_ILP32_OFF32_CFLAGS     = 1100
  3212  	_CS_XBS5_ILP32_OFF32_LDFLAGS    = 1101
  3213  	_CS_XBS5_ILP32_OFF32_LIBS       = 1102
  3214  	_CS_XBS5_ILP32_OFF32_LINTFLAGS  = 1103
  3215  	_CS_XBS5_ILP32_OFFBIG_CFLAGS    = 1104
  3216  	_CS_XBS5_ILP32_OFFBIG_LDFLAGS   = 1105
  3217  	_CS_XBS5_ILP32_OFFBIG_LIBS      = 1106
  3218  	_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107
  3219  	_CS_XBS5_LP64_OFF64_CFLAGS      = 1108
  3220  	_CS_XBS5_LP64_OFF64_LDFLAGS     = 1109
  3221  	_CS_XBS5_LP64_OFF64_LIBS        = 1110
  3222  	_CS_XBS5_LP64_OFF64_LINTFLAGS   = 1111
  3223  	_CS_XBS5_LPBIG_OFFBIG_CFLAGS    = 1112
  3224  	_CS_XBS5_LPBIG_OFFBIG_LDFLAGS   = 1113
  3225  	_CS_XBS5_LPBIG_OFFBIG_LIBS      = 1114
  3226  	_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115
  3227  
  3228  	_CS_POSIX_V6_ILP32_OFF32_CFLAGS     = 1116
  3229  	_CS_POSIX_V6_ILP32_OFF32_LDFLAGS    = 1117
  3230  	_CS_POSIX_V6_ILP32_OFF32_LIBS       = 1118
  3231  	_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS  = 1119
  3232  	_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS    = 1120
  3233  	_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS   = 1121
  3234  	_CS_POSIX_V6_ILP32_OFFBIG_LIBS      = 1122
  3235  	_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123
  3236  	_CS_POSIX_V6_LP64_OFF64_CFLAGS      = 1124
  3237  	_CS_POSIX_V6_LP64_OFF64_LDFLAGS     = 1125
  3238  	_CS_POSIX_V6_LP64_OFF64_LIBS        = 1126
  3239  	_CS_POSIX_V6_LP64_OFF64_LINTFLAGS   = 1127
  3240  	_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS    = 1128
  3241  	_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS   = 1129
  3242  	_CS_POSIX_V6_LPBIG_OFFBIG_LIBS      = 1130
  3243  	_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131
  3244  
  3245  	_CS_POSIX_V7_ILP32_OFF32_CFLAGS     = 1132
  3246  	_CS_POSIX_V7_ILP32_OFF32_LDFLAGS    = 1133
  3247  	_CS_POSIX_V7_ILP32_OFF32_LIBS       = 1134
  3248  	_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS  = 1135
  3249  	_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS    = 1136
  3250  	_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS   = 1137
  3251  	_CS_POSIX_V7_ILP32_OFFBIG_LIBS      = 1138
  3252  	_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139
  3253  	_CS_POSIX_V7_LP64_OFF64_CFLAGS      = 1140
  3254  	_CS_POSIX_V7_LP64_OFF64_LDFLAGS     = 1141
  3255  	_CS_POSIX_V7_LP64_OFF64_LIBS        = 1142
  3256  	_CS_POSIX_V7_LP64_OFF64_LINTFLAGS   = 1143
  3257  	_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS    = 1144
  3258  	_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS   = 1145
  3259  	_CS_POSIX_V7_LPBIG_OFFBIG_LIBS      = 1146
  3260  	_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147
  3261  
  3262  	_CS_V6_ENV = 1148
  3263  	_CS_V7_ENV = 1149
  3264  )
  3265  
  3266  // Values for the argument to `sysconf'.
  3267  const ( /* confname.h:71:1: */
  3268  	_SC_ARG_MAX               = 0
  3269  	_SC_CHILD_MAX             = 1
  3270  	_SC_CLK_TCK               = 2
  3271  	_SC_NGROUPS_MAX           = 3
  3272  	_SC_OPEN_MAX              = 4
  3273  	_SC_STREAM_MAX            = 5
  3274  	_SC_TZNAME_MAX            = 6
  3275  	_SC_JOB_CONTROL           = 7
  3276  	_SC_SAVED_IDS             = 8
  3277  	_SC_REALTIME_SIGNALS      = 9
  3278  	_SC_PRIORITY_SCHEDULING   = 10
  3279  	_SC_TIMERS                = 11
  3280  	_SC_ASYNCHRONOUS_IO       = 12
  3281  	_SC_PRIORITIZED_IO        = 13
  3282  	_SC_SYNCHRONIZED_IO       = 14
  3283  	_SC_FSYNC                 = 15
  3284  	_SC_MAPPED_FILES          = 16
  3285  	_SC_MEMLOCK               = 17
  3286  	_SC_MEMLOCK_RANGE         = 18
  3287  	_SC_MEMORY_PROTECTION     = 19
  3288  	_SC_MESSAGE_PASSING       = 20
  3289  	_SC_SEMAPHORES            = 21
  3290  	_SC_SHARED_MEMORY_OBJECTS = 22
  3291  	_SC_AIO_LISTIO_MAX        = 23
  3292  	_SC_AIO_MAX               = 24
  3293  	_SC_AIO_PRIO_DELTA_MAX    = 25
  3294  	_SC_DELAYTIMER_MAX        = 26
  3295  	_SC_MQ_OPEN_MAX           = 27
  3296  	_SC_MQ_PRIO_MAX           = 28
  3297  	_SC_VERSION               = 29
  3298  	_SC_PAGESIZE              = 30
  3299  	_SC_RTSIG_MAX             = 31
  3300  	_SC_SEM_NSEMS_MAX         = 32
  3301  	_SC_SEM_VALUE_MAX         = 33
  3302  	_SC_SIGQUEUE_MAX          = 34
  3303  	_SC_TIMER_MAX             = 35
  3304  
  3305  	// Values for the argument to `sysconf'
  3306  	//        corresponding to _POSIX2_* symbols.
  3307  	_SC_BC_BASE_MAX        = 36
  3308  	_SC_BC_DIM_MAX         = 37
  3309  	_SC_BC_SCALE_MAX       = 38
  3310  	_SC_BC_STRING_MAX      = 39
  3311  	_SC_COLL_WEIGHTS_MAX   = 40
  3312  	_SC_EQUIV_CLASS_MAX    = 41
  3313  	_SC_EXPR_NEST_MAX      = 42
  3314  	_SC_LINE_MAX           = 43
  3315  	_SC_RE_DUP_MAX         = 44
  3316  	_SC_CHARCLASS_NAME_MAX = 45
  3317  
  3318  	_SC_2_VERSION   = 46
  3319  	_SC_2_C_BIND    = 47
  3320  	_SC_2_C_DEV     = 48
  3321  	_SC_2_FORT_DEV  = 49
  3322  	_SC_2_FORT_RUN  = 50
  3323  	_SC_2_SW_DEV    = 51
  3324  	_SC_2_LOCALEDEF = 52
  3325  
  3326  	_SC_PII                 = 53
  3327  	_SC_PII_XTI             = 54
  3328  	_SC_PII_SOCKET          = 55
  3329  	_SC_PII_INTERNET        = 56
  3330  	_SC_PII_OSI             = 57
  3331  	_SC_POLL                = 58
  3332  	_SC_SELECT              = 59
  3333  	_SC_UIO_MAXIOV          = 60
  3334  	_SC_IOV_MAX             = 60
  3335  	_SC_PII_INTERNET_STREAM = 61
  3336  	_SC_PII_INTERNET_DGRAM  = 62
  3337  	_SC_PII_OSI_COTS        = 63
  3338  	_SC_PII_OSI_CLTS        = 64
  3339  	_SC_PII_OSI_M           = 65
  3340  	_SC_T_IOV_MAX           = 66
  3341  
  3342  	// Values according to POSIX 1003.1c (POSIX threads).
  3343  	_SC_THREADS                      = 67
  3344  	_SC_THREAD_SAFE_FUNCTIONS        = 68
  3345  	_SC_GETGR_R_SIZE_MAX             = 69
  3346  	_SC_GETPW_R_SIZE_MAX             = 70
  3347  	_SC_LOGIN_NAME_MAX               = 71
  3348  	_SC_TTY_NAME_MAX                 = 72
  3349  	_SC_THREAD_DESTRUCTOR_ITERATIONS = 73
  3350  	_SC_THREAD_KEYS_MAX              = 74
  3351  	_SC_THREAD_STACK_MIN             = 75
  3352  	_SC_THREAD_THREADS_MAX           = 76
  3353  	_SC_THREAD_ATTR_STACKADDR        = 77
  3354  	_SC_THREAD_ATTR_STACKSIZE        = 78
  3355  	_SC_THREAD_PRIORITY_SCHEDULING   = 79
  3356  	_SC_THREAD_PRIO_INHERIT          = 80
  3357  	_SC_THREAD_PRIO_PROTECT          = 81
  3358  	_SC_THREAD_PROCESS_SHARED        = 82
  3359  
  3360  	_SC_NPROCESSORS_CONF = 83
  3361  	_SC_NPROCESSORS_ONLN = 84
  3362  	_SC_PHYS_PAGES       = 85
  3363  	_SC_AVPHYS_PAGES     = 86
  3364  	_SC_ATEXIT_MAX       = 87
  3365  	_SC_PASS_MAX         = 88
  3366  
  3367  	_SC_XOPEN_VERSION     = 89
  3368  	_SC_XOPEN_XCU_VERSION = 90
  3369  	_SC_XOPEN_UNIX        = 91
  3370  	_SC_XOPEN_CRYPT       = 92
  3371  	_SC_XOPEN_ENH_I18N    = 93
  3372  	_SC_XOPEN_SHM         = 94
  3373  
  3374  	_SC_2_CHAR_TERM = 95
  3375  	_SC_2_C_VERSION = 96
  3376  	_SC_2_UPE       = 97
  3377  
  3378  	_SC_XOPEN_XPG2 = 98
  3379  	_SC_XOPEN_XPG3 = 99
  3380  	_SC_XOPEN_XPG4 = 100
  3381  
  3382  	_SC_CHAR_BIT   = 101
  3383  	_SC_CHAR_MAX   = 102
  3384  	_SC_CHAR_MIN   = 103
  3385  	_SC_INT_MAX    = 104
  3386  	_SC_INT_MIN    = 105
  3387  	_SC_LONG_BIT   = 106
  3388  	_SC_WORD_BIT   = 107
  3389  	_SC_MB_LEN_MAX = 108
  3390  	_SC_NZERO      = 109
  3391  	_SC_SSIZE_MAX  = 110
  3392  	_SC_SCHAR_MAX  = 111
  3393  	_SC_SCHAR_MIN  = 112
  3394  	_SC_SHRT_MAX   = 113
  3395  	_SC_SHRT_MIN   = 114
  3396  	_SC_UCHAR_MAX  = 115
  3397  	_SC_UINT_MAX   = 116
  3398  	_SC_ULONG_MAX  = 117
  3399  	_SC_USHRT_MAX  = 118
  3400  
  3401  	_SC_NL_ARGMAX  = 119
  3402  	_SC_NL_LANGMAX = 120
  3403  	_SC_NL_MSGMAX  = 121
  3404  	_SC_NL_NMAX    = 122
  3405  	_SC_NL_SETMAX  = 123
  3406  	_SC_NL_TEXTMAX = 124
  3407  
  3408  	_SC_XBS5_ILP32_OFF32  = 125
  3409  	_SC_XBS5_ILP32_OFFBIG = 126
  3410  	_SC_XBS5_LP64_OFF64   = 127
  3411  	_SC_XBS5_LPBIG_OFFBIG = 128
  3412  
  3413  	_SC_XOPEN_LEGACY           = 129
  3414  	_SC_XOPEN_REALTIME         = 130
  3415  	_SC_XOPEN_REALTIME_THREADS = 131
  3416  
  3417  	_SC_ADVISORY_INFO          = 132
  3418  	_SC_BARRIERS               = 133
  3419  	_SC_BASE                   = 134
  3420  	_SC_C_LANG_SUPPORT         = 135
  3421  	_SC_C_LANG_SUPPORT_R       = 136
  3422  	_SC_CLOCK_SELECTION        = 137
  3423  	_SC_CPUTIME                = 138
  3424  	_SC_THREAD_CPUTIME         = 139
  3425  	_SC_DEVICE_IO              = 140
  3426  	_SC_DEVICE_SPECIFIC        = 141
  3427  	_SC_DEVICE_SPECIFIC_R      = 142
  3428  	_SC_FD_MGMT                = 143
  3429  	_SC_FIFO                   = 144
  3430  	_SC_PIPE                   = 145
  3431  	_SC_FILE_ATTRIBUTES        = 146
  3432  	_SC_FILE_LOCKING           = 147
  3433  	_SC_FILE_SYSTEM            = 148
  3434  	_SC_MONOTONIC_CLOCK        = 149
  3435  	_SC_MULTI_PROCESS          = 150
  3436  	_SC_SINGLE_PROCESS         = 151
  3437  	_SC_NETWORKING             = 152
  3438  	_SC_READER_WRITER_LOCKS    = 153
  3439  	_SC_SPIN_LOCKS             = 154
  3440  	_SC_REGEXP                 = 155
  3441  	_SC_REGEX_VERSION          = 156
  3442  	_SC_SHELL                  = 157
  3443  	_SC_SIGNALS                = 158
  3444  	_SC_SPAWN                  = 159
  3445  	_SC_SPORADIC_SERVER        = 160
  3446  	_SC_THREAD_SPORADIC_SERVER = 161
  3447  	_SC_SYSTEM_DATABASE        = 162
  3448  	_SC_SYSTEM_DATABASE_R      = 163
  3449  	_SC_TIMEOUTS               = 164
  3450  	_SC_TYPED_MEMORY_OBJECTS   = 165
  3451  	_SC_USER_GROUPS            = 166
  3452  	_SC_USER_GROUPS_R          = 167
  3453  	_SC_2_PBS                  = 168
  3454  	_SC_2_PBS_ACCOUNTING       = 169
  3455  	_SC_2_PBS_LOCATE           = 170
  3456  	_SC_2_PBS_MESSAGE          = 171
  3457  	_SC_2_PBS_TRACK            = 172
  3458  	_SC_SYMLOOP_MAX            = 173
  3459  	_SC_STREAMS                = 174
  3460  	_SC_2_PBS_CHECKPOINT       = 175
  3461  
  3462  	_SC_V6_ILP32_OFF32  = 176
  3463  	_SC_V6_ILP32_OFFBIG = 177
  3464  	_SC_V6_LP64_OFF64   = 178
  3465  	_SC_V6_LPBIG_OFFBIG = 179
  3466  
  3467  	_SC_HOST_NAME_MAX      = 180
  3468  	_SC_TRACE              = 181
  3469  	_SC_TRACE_EVENT_FILTER = 182
  3470  	_SC_TRACE_INHERIT      = 183
  3471  	_SC_TRACE_LOG          = 184
  3472  
  3473  	_SC_LEVEL1_ICACHE_SIZE     = 185
  3474  	_SC_LEVEL1_ICACHE_ASSOC    = 186
  3475  	_SC_LEVEL1_ICACHE_LINESIZE = 187
  3476  	_SC_LEVEL1_DCACHE_SIZE     = 188
  3477  	_SC_LEVEL1_DCACHE_ASSOC    = 189
  3478  	_SC_LEVEL1_DCACHE_LINESIZE = 190
  3479  	_SC_LEVEL2_CACHE_SIZE      = 191
  3480  	_SC_LEVEL2_CACHE_ASSOC     = 192
  3481  	_SC_LEVEL2_CACHE_LINESIZE  = 193
  3482  	_SC_LEVEL3_CACHE_SIZE      = 194
  3483  	_SC_LEVEL3_CACHE_ASSOC     = 195
  3484  	_SC_LEVEL3_CACHE_LINESIZE  = 196
  3485  	_SC_LEVEL4_CACHE_SIZE      = 197
  3486  	_SC_LEVEL4_CACHE_ASSOC     = 198
  3487  	_SC_LEVEL4_CACHE_LINESIZE  = 199
  3488  	// Leave room here, maybe we need a few more cache levels some day.
  3489  
  3490  	_SC_IPV6        = 235
  3491  	_SC_RAW_SOCKETS = 236
  3492  
  3493  	_SC_V7_ILP32_OFF32  = 237
  3494  	_SC_V7_ILP32_OFFBIG = 238
  3495  	_SC_V7_LP64_OFF64   = 239
  3496  	_SC_V7_LPBIG_OFFBIG = 240
  3497  
  3498  	_SC_SS_REPL_MAX = 241
  3499  
  3500  	_SC_TRACE_EVENT_NAME_MAX = 242
  3501  	_SC_TRACE_NAME_MAX       = 243
  3502  	_SC_TRACE_SYS_MAX        = 244
  3503  	_SC_TRACE_USER_EVENT_MAX = 245
  3504  
  3505  	_SC_XOPEN_STREAMS = 246
  3506  
  3507  	_SC_THREAD_ROBUST_PRIO_INHERIT = 247
  3508  	_SC_THREAD_ROBUST_PRIO_PROTECT = 248
  3509  )
  3510  
  3511  // open/fcntl.
  3512  
  3513  // open file description locks.
  3514  //
  3515  //    Usually record locks held by a process are released on *any* close and are
  3516  //    not inherited across a fork.
  3517  //
  3518  //    These cmd values will set locks that conflict with process-associated record
  3519  //    locks, but are "owned" by the opened file description, not the process.
  3520  //    This means that they are inherited across fork or clone with CLONE_FILES
  3521  //    like BSD (flock) locks, and they are only released automatically when the
  3522  //    last reference to the the file description against which they were acquired
  3523  //    is put.
  3524  
  3525  // For now, Linux has no separate synchronicity options for read
  3526  //    operations.  We define O_RSYNC therefore as the same as O_SYNC
  3527  //    since this is a superset.
  3528  
  3529  // Values for the second argument to `fcntl'.
  3530  
  3531  // Set / get write life time hints.
  3532  
  3533  // For F_[GET|SET]FD.
  3534  
  3535  // For posix fcntl() and `l_type' field of a `struct flock' for lockf().
  3536  
  3537  // For old implementation of BSD flock.
  3538  
  3539  // Operations for BSD flock, also used by the kernel implementation.
  3540  
  3541  // Types of directory notifications that may be requested with F_NOTIFY.
  3542  
  3543  // Owner types.
  3544  const ( /* fcntl-linux.h:265:1: */
  3545  	F_OWNER_TID  = 0 // Kernel thread.
  3546  	F_OWNER_PID  = 1 // Process.
  3547  	F_OWNER_PGRP = 2 // Process group.
  3548  	F_OWNER_GID  = 2
  3549  )
  3550  
  3551  // Whose usage statistics do you want?
  3552  const ( /* resource.h:158:1: */
  3553  	// The calling process.
  3554  	RUSAGE_SELF = 0
  3555  
  3556  	// All of its terminated child processes.
  3557  	RUSAGE_CHILDREN = -1
  3558  )
  3559  
  3560  // Whose usage statistics do you want?
  3561  const ( /* resource.h:158:1: */
  3562  	// The calling thread.
  3563  	RUSAGE_THREAD = 1
  3564  )
  3565  
  3566  // Priority limits.
  3567  
  3568  // The type of the WHICH argument to `getpriority' and `setpriority',
  3569  //    indicating what flavor of entity the WHO argument specifies.
  3570  const ( /* resource.h:187:1: */
  3571  	PRIO_PROCESS = 0 // WHO is a process ID.
  3572  	PRIO_PGRP    = 1 // WHO is a process group ID.
  3573  	PRIO_USER    = 2
  3574  )
  3575  
  3576  // end block for C++
  3577  
  3578  // Local Variables:
  3579  // mode: c
  3580  // c-basic-offset: 4
  3581  // fill-column: 78
  3582  // End:
  3583  
  3584  // Needed for the setrlimit() system call on unix
  3585  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
  3586  //    This file is part of the GNU C Library.
  3587  //
  3588  //    The GNU C Library is free software; you can redistribute it and/or
  3589  //    modify it under the terms of the GNU Lesser General Public
  3590  //    License as published by the Free Software Foundation; either
  3591  //    version 2.1 of the License, or (at your option) any later version.
  3592  //
  3593  //    The GNU C Library is distributed in the hope that it will be useful,
  3594  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3595  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3596  //    Lesser General Public License for more details.
  3597  //
  3598  //    You should have received a copy of the GNU Lesser General Public
  3599  //    License along with the GNU C Library; if not, see
  3600  //    <http://www.gnu.org/licenses/>.
  3601  
  3602  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
  3603  //    This file is part of the GNU C Library.
  3604  //
  3605  //    The GNU C Library is free software; you can redistribute it and/or
  3606  //    modify it under the terms of the GNU Lesser General Public
  3607  //    License as published by the Free Software Foundation; either
  3608  //    version 2.1 of the License, or (at your option) any later version.
  3609  //
  3610  //    The GNU C Library is distributed in the hope that it will be useful,
  3611  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3612  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3613  //    Lesser General Public License for more details.
  3614  //
  3615  //    You should have received a copy of the GNU Lesser General Public
  3616  //    License along with the GNU C Library; if not, see
  3617  //    <http://www.gnu.org/licenses/>.
  3618  
  3619  // Get the system-dependent definitions of structures and bit values.
  3620  // Bit values & structures for resource limits.  Linux version.
  3621  //    Copyright (C) 1994-2018 Free Software Foundation, Inc.
  3622  //    This file is part of the GNU C Library.
  3623  //
  3624  //    The GNU C Library is free software; you can redistribute it and/or
  3625  //    modify it under the terms of the GNU Lesser General Public
  3626  //    License as published by the Free Software Foundation; either
  3627  //    version 2.1 of the License, or (at your option) any later version.
  3628  //
  3629  //    The GNU C Library is distributed in the hope that it will be useful,
  3630  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3631  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3632  //    Lesser General Public License for more details.
  3633  //
  3634  //    You should have received a copy of the GNU Lesser General Public
  3635  //    License along with the GNU C Library; if not, see
  3636  //    <http://www.gnu.org/licenses/>.
  3637  
  3638  // bits/types.h -- definitions of __*_t types underlying *_t types.
  3639  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
  3640  //    This file is part of the GNU C Library.
  3641  //
  3642  //    The GNU C Library is free software; you can redistribute it and/or
  3643  //    modify it under the terms of the GNU Lesser General Public
  3644  //    License as published by the Free Software Foundation; either
  3645  //    version 2.1 of the License, or (at your option) any later version.
  3646  //
  3647  //    The GNU C Library is distributed in the hope that it will be useful,
  3648  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3649  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3650  //    Lesser General Public License for more details.
  3651  //
  3652  //    You should have received a copy of the GNU Lesser General Public
  3653  //    License along with the GNU C Library; if not, see
  3654  //    <http://www.gnu.org/licenses/>.
  3655  
  3656  // Never include this file directly; use <sys/types.h> instead.
  3657  
  3658  // Transmute defines to enumerations.  The macro re-definitions are
  3659  //    necessary because some programs want to test for operating system
  3660  //    features with #ifdef RUSAGE_SELF.  In ISO C the reflexive
  3661  //    definition is a no-op.
  3662  
  3663  // Kinds of resource limit.
  3664  const ( /* resource.h:31:1: */
  3665  	// Per-process CPU limit, in seconds.
  3666  	RLIMIT_CPU = 0
  3667  
  3668  	// Largest file that can be created, in bytes.
  3669  	RLIMIT_FSIZE = 1
  3670  
  3671  	// Maximum size of data segment, in bytes.
  3672  	RLIMIT_DATA = 2
  3673  
  3674  	// Maximum size of stack segment, in bytes.
  3675  	RLIMIT_STACK = 3
  3676  
  3677  	// Largest core file that can be created, in bytes.
  3678  	RLIMIT_CORE = 4
  3679  
  3680  	// Largest resident set size, in bytes.
  3681  	//      This affects swapping; processes that are exceeding their
  3682  	//      resident set size will be more likely to have physical memory
  3683  	//      taken from them.
  3684  	__RLIMIT_RSS = 5
  3685  
  3686  	// Number of open files.
  3687  	RLIMIT_NOFILE  = 7
  3688  	__RLIMIT_OFILE = 7 // BSD name for same.
  3689  
  3690  	// Address space limit.
  3691  	RLIMIT_AS = 9
  3692  
  3693  	// Number of processes.
  3694  	__RLIMIT_NPROC = 6
  3695  
  3696  	// Locked-in-memory address space.
  3697  	__RLIMIT_MEMLOCK = 8
  3698  
  3699  	// Maximum number of file locks.
  3700  	__RLIMIT_LOCKS = 10
  3701  
  3702  	// Maximum number of pending signals.
  3703  	__RLIMIT_SIGPENDING = 11
  3704  
  3705  	// Maximum bytes in POSIX message queues.
  3706  	__RLIMIT_MSGQUEUE = 12
  3707  
  3708  	// Maximum nice priority allowed to raise to.
  3709  	//      Nice levels 19 .. -20 correspond to 0 .. 39
  3710  	//      values of this resource limit.
  3711  	__RLIMIT_NICE = 13
  3712  
  3713  	// Maximum realtime priority allowed for non-priviledged
  3714  	//      processes.
  3715  	__RLIMIT_RTPRIO = 14
  3716  
  3717  	// Maximum CPU time in µs that a process scheduled under a real-time
  3718  	//      scheduling policy may consume without making a blocking system
  3719  	//      call before being forcibly descheduled.
  3720  	__RLIMIT_RTTIME = 15
  3721  
  3722  	__RLIMIT_NLIMITS = 16
  3723  	__RLIM_NLIMITS   = 16
  3724  )
  3725  
  3726  // POSIX names to access some of the members.
  3727  
  3728  // sigevent constants.  Linux version.
  3729  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
  3730  //    This file is part of the GNU C Library.
  3731  //
  3732  //    The GNU C Library is free software; you can redistribute it and/or
  3733  //    modify it under the terms of the GNU Lesser General Public
  3734  //    License as published by the Free Software Foundation; either
  3735  //    version 2.1 of the License, or (at your option) any later version.
  3736  //
  3737  //    The GNU C Library is distributed in the hope that it will be useful,
  3738  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3739  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3740  //    Lesser General Public License for more details.
  3741  //
  3742  //    You should have received a copy of the GNU Lesser General Public
  3743  //    License along with the GNU C Library; if not, see
  3744  //    <http://www.gnu.org/licenses/>.
  3745  
  3746  // `sigev_notify' values.
  3747  const ( /* sigevent-consts.h:27:1: */
  3748  	SIGEV_SIGNAL = 0 // Notify via signal.
  3749  	SIGEV_NONE   = 1 // Other notification: meaningless.
  3750  	SIGEV_THREAD = 2 // Deliver via thread creation.
  3751  
  3752  	SIGEV_THREAD_ID = 4
  3753  )
  3754  
  3755  // `si_code' values for SIGSEGV signal.
  3756  const ( /* siginfo-consts.h:110:1: */
  3757  	SEGV_MAPERR = 1 // Address not mapped to object.
  3758  	SEGV_ACCERR = 2 // Invalid permissions for mapped object.
  3759  	SEGV_BNDERR = 3 // Bounds checking failure.
  3760  	SEGV_PKUERR = 4
  3761  )
  3762  
  3763  // `si_code' values for SIGBUS signal.
  3764  const ( /* siginfo-consts.h:123:1: */
  3765  	BUS_ADRALN    = 1 // Invalid address alignment.
  3766  	BUS_ADRERR    = 2 // Non-existant physical address.
  3767  	BUS_OBJERR    = 3 // Object specific hardware error.
  3768  	BUS_MCEERR_AR = 4 // Hardware memory error: action required.
  3769  	BUS_MCEERR_AO = 5
  3770  )
  3771  
  3772  // `si_code' values for SIGCHLD signal.
  3773  const ( /* siginfo-consts.h:151:1: */
  3774  	CLD_EXITED    = 1 // Child has exited.
  3775  	CLD_KILLED    = 2 // Child was killed.
  3776  	CLD_DUMPED    = 3 // Child terminated abnormally.
  3777  	CLD_TRAPPED   = 4 // Traced child has trapped.
  3778  	CLD_STOPPED   = 5 // Child has stopped.
  3779  	CLD_CONTINUED = 6
  3780  )
  3781  
  3782  // `si_code' values for SIGPOLL signal.
  3783  const ( /* siginfo-consts.h:168:1: */
  3784  	POLL_IN  = 1 // Data input available.
  3785  	POLL_OUT = 2 // Output buffers available.
  3786  	POLL_MSG = 3 // Input message available.
  3787  	POLL_ERR = 4 // I/O error.
  3788  	POLL_PRI = 5 // High priority input available.
  3789  	POLL_HUP = 6
  3790  )
  3791  
  3792  // X/Open requires some more fields with fixed names.
  3793  
  3794  // siginfo constants.  Linux version.
  3795  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
  3796  //    This file is part of the GNU C Library.
  3797  //
  3798  //    The GNU C Library is free software; you can redistribute it and/or
  3799  //    modify it under the terms of the GNU Lesser General Public
  3800  //    License as published by the Free Software Foundation; either
  3801  //    version 2.1 of the License, or (at your option) any later version.
  3802  //
  3803  //    The GNU C Library is distributed in the hope that it will be useful,
  3804  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3805  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3806  //    Lesser General Public License for more details.
  3807  //
  3808  //    You should have received a copy of the GNU Lesser General Public
  3809  //    License along with the GNU C Library; if not, see
  3810  //    <http://www.gnu.org/licenses/>.
  3811  
  3812  // Most of these constants are uniform across all architectures, but there
  3813  //    is one exception.
  3814  // Architecture-specific adjustments to siginfo_t.
  3815  
  3816  // Values for `si_code'.  Positive values are reserved for kernel-generated
  3817  //    signals.
  3818  const ( /* siginfo-consts.h:35:1: */
  3819  	SI_ASYNCNL = -60 // Sent by asynch name lookup completion.
  3820  	SI_TKILL   = -6  // Sent by tkill.
  3821  	SI_SIGIO   = -5  // Sent by queued SIGIO.
  3822  	SI_ASYNCIO = -4  // Sent by AIO completion.
  3823  	SI_MESGQ   = -3  // Sent by real time mesq state change.
  3824  	SI_TIMER   = -2  // Sent by timer expiration.
  3825  	SI_QUEUE   = -1  // Sent by sigqueue.
  3826  	SI_USER    = 0   // Sent by kill, sigsend.
  3827  	SI_KERNEL  = 128
  3828  )
  3829  
  3830  // `si_code' values for SIGILL signal.
  3831  const ( /* siginfo-consts.h:68:1: */
  3832  	ILL_ILLOPC = 1 // Illegal opcode.
  3833  	ILL_ILLOPN = 2 // Illegal operand.
  3834  	ILL_ILLADR = 3 // Illegal addressing mode.
  3835  	ILL_ILLTRP = 4 // Illegal trap.
  3836  	ILL_PRVOPC = 5 // Privileged opcode.
  3837  	ILL_PRVREG = 6 // Privileged register.
  3838  	ILL_COPROC = 7 // Coprocessor error.
  3839  	ILL_BADSTK = 8
  3840  )
  3841  
  3842  // `si_code' values for SIGFPE signal.
  3843  const ( /* siginfo-consts.h:89:1: */
  3844  	FPE_INTDIV = 1 // Integer divide by zero.
  3845  	FPE_INTOVF = 2 // Integer overflow.
  3846  	FPE_FLTDIV = 3 // Floating point divide by zero.
  3847  	FPE_FLTOVF = 4 // Floating point overflow.
  3848  	FPE_FLTUND = 5 // Floating point underflow.
  3849  	FPE_FLTRES = 6 // Floating point inexact result.
  3850  	FPE_FLTINV = 7 // Floating point invalid operation.
  3851  	FPE_FLTSUB = 8
  3852  )
  3853  
  3854  // sigstack, sigaltstack definitions.
  3855  //    Copyright (C) 1998-2018 Free Software Foundation, Inc.
  3856  //    This file is part of the GNU C Library.
  3857  //
  3858  //    The GNU C Library is free software; you can redistribute it and/or
  3859  //    modify it under the terms of the GNU Lesser General Public
  3860  //    License as published by the Free Software Foundation; either
  3861  //    version 2.1 of the License, or (at your option) any later version.
  3862  //
  3863  //    The GNU C Library is distributed in the hope that it will be useful,
  3864  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3865  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3866  //    Lesser General Public License for more details.
  3867  //
  3868  //    You should have received a copy of the GNU Lesser General Public
  3869  //    License along with the GNU C Library; if not, see
  3870  //    <http://www.gnu.org/licenses/>.
  3871  
  3872  // Minimum stack size for a signal handler.
  3873  
  3874  // System default stack size.
  3875  
  3876  // ss_flags values for stack_t.  Linux version.
  3877  //    Copyright (C) 1998-2018 Free Software Foundation, Inc.
  3878  //    This file is part of the GNU C Library.
  3879  //
  3880  //    The GNU C Library is free software; you can redistribute it and/or
  3881  //    modify it under the terms of the GNU Lesser General Public
  3882  //    License as published by the Free Software Foundation; either
  3883  //    version 2.1 of the License, or (at your option) any later version.
  3884  //
  3885  //    The GNU C Library is distributed in the hope that it will be useful,
  3886  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3887  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3888  //    Lesser General Public License for more details.
  3889  //
  3890  //    You should have received a copy of the GNU Lesser General Public
  3891  //    License along with the GNU C Library; if not, see
  3892  //    <http://www.gnu.org/licenses/>.
  3893  
  3894  // Possible values for `ss_flags'.
  3895  const ( /* ss_flags.h:27:1: */
  3896  	SS_ONSTACK = 1
  3897  	SS_DISABLE = 2
  3898  )
  3899  
  3900  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
  3901  //     are already defined.
  3902  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
  3903  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
  3904  
  3905  // A null pointer constant.
  3906  
  3907  // XPG requires a few symbols from <sys/wait.h> being defined.
  3908  // Definitions of flag bits for `waitpid' et al.
  3909  //    Copyright (C) 1992-2018 Free Software Foundation, Inc.
  3910  //    This file is part of the GNU C Library.
  3911  //
  3912  //    The GNU C Library is free software; you can redistribute it and/or
  3913  //    modify it under the terms of the GNU Lesser General Public
  3914  //    License as published by the Free Software Foundation; either
  3915  //    version 2.1 of the License, or (at your option) any later version.
  3916  //
  3917  //    The GNU C Library is distributed in the hope that it will be useful,
  3918  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3919  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3920  //    Lesser General Public License for more details.
  3921  //
  3922  //    You should have received a copy of the GNU Lesser General Public
  3923  //    License along with the GNU C Library; if not, see
  3924  //    <http://www.gnu.org/licenses/>.
  3925  
  3926  // Bits in the third argument to `waitpid'.
  3927  
  3928  // Bits in the fourth argument to `waitid'.
  3929  
  3930  // The following values are used by the `waitid' function.
  3931  
  3932  // The Linux kernel defines these bare, rather than an enum,
  3933  //    which causes a conflict if the include order is reversed.
  3934  
  3935  const ( /* waitflags.h:52:1: */
  3936  	P_ALL  = 0 // Wait for any child.
  3937  	P_PID  = 1 // Wait for specified process.
  3938  	P_PGID = 2
  3939  )
  3940  
  3941  // If we are compiling with optimizing read this file.  It contains
  3942  //    several optimizing inline functions and macros.
  3943  
  3944  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
  3945  //    This file is part of the GNU C Library.
  3946  //
  3947  //    The GNU C Library is free software; you can redistribute it and/or
  3948  //    modify it under the terms of the GNU Lesser General Public
  3949  //    License as published by the Free Software Foundation; either
  3950  //    version 2.1 of the License, or (at your option) any later version.
  3951  //
  3952  //    The GNU C Library is distributed in the hope that it will be useful,
  3953  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3954  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3955  //    Lesser General Public License for more details.
  3956  //
  3957  //    You should have received a copy of the GNU Lesser General Public
  3958  //    License along with the GNU C Library; if not, see
  3959  //    <http://www.gnu.org/licenses/>.
  3960  
  3961  //	ISO C99 Standard 7.4: Character handling	<ctype.h>
  3962  
  3963  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
  3964  //    This file is part of the GNU C Library.
  3965  //
  3966  //    The GNU C Library is free software; you can redistribute it and/or
  3967  //    modify it under the terms of the GNU Lesser General Public
  3968  //    License as published by the Free Software Foundation; either
  3969  //    version 2.1 of the License, or (at your option) any later version.
  3970  //
  3971  //    The GNU C Library is distributed in the hope that it will be useful,
  3972  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3973  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3974  //    Lesser General Public License for more details.
  3975  //
  3976  //    You should have received a copy of the GNU Lesser General Public
  3977  //    License along with the GNU C Library; if not, see
  3978  //    <http://www.gnu.org/licenses/>.
  3979  
  3980  // bits/types.h -- definitions of __*_t types underlying *_t types.
  3981  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
  3982  //    This file is part of the GNU C Library.
  3983  //
  3984  //    The GNU C Library is free software; you can redistribute it and/or
  3985  //    modify it under the terms of the GNU Lesser General Public
  3986  //    License as published by the Free Software Foundation; either
  3987  //    version 2.1 of the License, or (at your option) any later version.
  3988  //
  3989  //    The GNU C Library is distributed in the hope that it will be useful,
  3990  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  3991  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  3992  //    Lesser General Public License for more details.
  3993  //
  3994  //    You should have received a copy of the GNU Lesser General Public
  3995  //    License along with the GNU C Library; if not, see
  3996  //    <http://www.gnu.org/licenses/>.
  3997  
  3998  // Never include this file directly; use <sys/types.h> instead.
  3999  
  4000  // These are all the characteristics of characters.
  4001  //    If there get to be more than 16 distinct characteristics,
  4002  //    many things must be changed that use `unsigned short int's.
  4003  //
  4004  //    The characteristics are stored always in network byte order (big
  4005  //    endian).  We define the bit value interpretations here dependent on the
  4006  //    machine's byte order.
  4007  
  4008  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
  4009  //    This file is part of the GNU C Library.
  4010  //
  4011  //    The GNU C Library is free software; you can redistribute it and/or
  4012  //    modify it under the terms of the GNU Lesser General Public
  4013  //    License as published by the Free Software Foundation; either
  4014  //    version 2.1 of the License, or (at your option) any later version.
  4015  //
  4016  //    The GNU C Library is distributed in the hope that it will be useful,
  4017  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  4018  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  4019  //    Lesser General Public License for more details.
  4020  //
  4021  //    You should have received a copy of the GNU Lesser General Public
  4022  //    License along with the GNU C Library; if not, see
  4023  //    <http://www.gnu.org/licenses/>.
  4024  
  4025  const ( /* ctype.h:46:1: */
  4026  	_ISupper  = 256   // UPPERCASE.
  4027  	_ISlower  = 512   // lowercase.
  4028  	_ISalpha  = 1024  // Alphabetic.
  4029  	_ISdigit  = 2048  // Numeric.
  4030  	_ISxdigit = 4096  // Hexadecimal numeric.
  4031  	_ISspace  = 8192  // Whitespace.
  4032  	_ISprint  = 16384 // Printing.
  4033  	_ISgraph  = 32768 // Graphical.
  4034  	_ISblank  = 1     // Blank (usually SPC and TAB).
  4035  	_IScntrl  = 2     // Control character.
  4036  	_ISpunct  = 4     // Punctuation.
  4037  	_ISalnum  = 8
  4038  )
  4039  
  4040  // These macros extract size information from a `struct dirent *'.
  4041  //    They may evaluate their argument multiple times, so it must not
  4042  //    have side effects.  Each of these may involve a relatively costly
  4043  //    call to `strlen' on some systems, so these values should be cached.
  4044  //
  4045  //    _D_EXACT_NAMLEN (DP)	returns the length of DP->d_name, not including
  4046  //    its terminating null character.
  4047  //
  4048  //    _D_ALLOC_NAMLEN (DP)	returns a size at least (_D_EXACT_NAMLEN (DP) + 1);
  4049  //    that is, the allocation size needed to hold the DP->d_name string.
  4050  //    Use this macro when you don't need the exact length, just an upper bound.
  4051  //    This macro is less likely to require calling `strlen' than _D_EXACT_NAMLEN.
  4052  //
  4053  
  4054  // File types for `d_type'.
  4055  const ( /* dirent.h:97:1: */
  4056  	DT_UNKNOWN = 0
  4057  	DT_FIFO    = 1
  4058  	DT_CHR     = 2
  4059  	DT_DIR     = 4
  4060  	DT_BLK     = 6
  4061  	DT_REG     = 8
  4062  	DT_LNK     = 10
  4063  	DT_SOCK    = 12
  4064  	DT_WHT     = 14
  4065  )
  4066  
  4067  // Read-write lock types.
  4068  const ( /* pthread.h:115:1: */
  4069  	PTHREAD_RWLOCK_PREFER_READER_NP              = 0
  4070  	PTHREAD_RWLOCK_PREFER_WRITER_NP              = 1
  4071  	PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP = 2
  4072  	PTHREAD_RWLOCK_DEFAULT_NP                    = 0
  4073  )
  4074  
  4075  // Define __PTHREAD_RWLOCK_INT_FLAGS_SHARED to 1 if pthread_rwlock_t
  4076  //    has the shared field.  All 64-bit architectures have the shared field
  4077  //    in pthread_rwlock_t.
  4078  
  4079  // Read-write lock initializers.
  4080  
  4081  // Scheduler inheritance.
  4082  const ( /* pthread.h:156:1: */
  4083  	PTHREAD_INHERIT_SCHED  = 0
  4084  	PTHREAD_EXPLICIT_SCHED = 1
  4085  )
  4086  
  4087  // Scope handling.
  4088  const ( /* pthread.h:166:1: */
  4089  	PTHREAD_SCOPE_SYSTEM  = 0
  4090  	PTHREAD_SCOPE_PROCESS = 1
  4091  )
  4092  
  4093  // Process shared or private flag.
  4094  const ( /* pthread.h:176:1: */
  4095  	PTHREAD_PROCESS_PRIVATE = 0
  4096  	PTHREAD_PROCESS_SHARED  = 1
  4097  )
  4098  
  4099  // Cancellation
  4100  const ( /* pthread.h:200:1: */
  4101  	PTHREAD_CANCEL_ENABLE  = 0
  4102  	PTHREAD_CANCEL_DISABLE = 1
  4103  )
  4104  const ( /* pthread.h:207:1: */
  4105  	PTHREAD_CANCEL_DEFERRED     = 0
  4106  	PTHREAD_CANCEL_ASYNCHRONOUS = 1
  4107  )
  4108  
  4109  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
  4110  //    This file is part of the GNU C Library.
  4111  //
  4112  //    The GNU C Library is free software; you can redistribute it and/or
  4113  //    modify it under the terms of the GNU Lesser General Public
  4114  //    License as published by the Free Software Foundation; either
  4115  //    version 2.1 of the License, or (at your option) any later version.
  4116  //
  4117  //    The GNU C Library is distributed in the hope that it will be useful,
  4118  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  4119  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  4120  //    Lesser General Public License for more details.
  4121  //
  4122  //    You should have received a copy of the GNU Lesser General Public
  4123  //    License along with the GNU C Library; if not, see
  4124  //    <http://www.gnu.org/licenses/>.
  4125  
  4126  // NB: Include guard matches what <linux/time.h> uses.
  4127  
  4128  // Detach state.
  4129  const ( /* pthread.h:33:1: */
  4130  	PTHREAD_CREATE_JOINABLE = 0
  4131  	PTHREAD_CREATE_DETACHED = 1
  4132  )
  4133  
  4134  // Mutex types.
  4135  const ( /* pthread.h:43:1: */
  4136  	PTHREAD_MUTEX_TIMED_NP      = 0
  4137  	PTHREAD_MUTEX_RECURSIVE_NP  = 1
  4138  	PTHREAD_MUTEX_ERRORCHECK_NP = 2
  4139  	PTHREAD_MUTEX_ADAPTIVE_NP   = 3
  4140  	PTHREAD_MUTEX_NORMAL        = 0
  4141  	PTHREAD_MUTEX_RECURSIVE     = 1
  4142  	PTHREAD_MUTEX_ERRORCHECK    = 2
  4143  	PTHREAD_MUTEX_DEFAULT       = 0
  4144  	PTHREAD_MUTEX_FAST_NP       = 0
  4145  )
  4146  
  4147  // Robust mutex or not flags.
  4148  const ( /* pthread.h:65:1: */
  4149  	PTHREAD_MUTEX_STALLED    = 0
  4150  	PTHREAD_MUTEX_STALLED_NP = 0
  4151  	PTHREAD_MUTEX_ROBUST     = 1
  4152  	PTHREAD_MUTEX_ROBUST_NP  = 1
  4153  )
  4154  
  4155  // Mutex protocols.
  4156  const ( /* pthread.h:77:1: */
  4157  	PTHREAD_PRIO_NONE    = 0
  4158  	PTHREAD_PRIO_INHERIT = 1
  4159  	PTHREAD_PRIO_PROTECT = 2
  4160  )
  4161  
  4162  // Values for the first argument to `getitimer' and `setitimer'.
  4163  const ( /* time.h:88:1: */
  4164  	// Timers run in real time.
  4165  	ITIMER_REAL = 0
  4166  	// Timers run only when the process is executing.
  4167  	ITIMER_VIRTUAL = 1
  4168  	// Timers run when the process is executing and when
  4169  	//        the system is executing on behalf of the process.
  4170  	ITIMER_PROF = 2
  4171  )
  4172  
  4173  // Number of each register is the `gregset_t' array.
  4174  const ( /* ucontext.h:45:1: */
  4175  	REG_R0  = 0
  4176  	REG_R1  = 1
  4177  	REG_R2  = 2
  4178  	REG_R3  = 3
  4179  	REG_R4  = 4
  4180  	REG_R5  = 5
  4181  	REG_R6  = 6
  4182  	REG_R7  = 7
  4183  	REG_R8  = 8
  4184  	REG_R9  = 9
  4185  	REG_R10 = 10
  4186  	REG_R11 = 11
  4187  	REG_R12 = 12
  4188  	REG_R13 = 13
  4189  	REG_R14 = 14
  4190  	REG_R15 = 15
  4191  )
  4192  
  4193  // Positions to pass to Tcl_QueueEvent:
  4194  
  4195  const ( /* tcl.h:1387:1: */
  4196  	TCL_QUEUE_TAIL = 0
  4197  	TCL_QUEUE_HEAD = 1
  4198  	TCL_QUEUE_MARK = 2
  4199  )
  4200  
  4201  // The following flags determine whether the blockModeProc above should set
  4202  // the channel into blocking or nonblocking mode. They are passed as arguments
  4203  // to the blockModeProc function in the above structure.
  4204  
  4205  //----------------------------------------------------------------------------
  4206  // Enum for different types of file paths.
  4207  
  4208  const ( /* tcl.h:1609:1: */
  4209  	TCL_PATH_ABSOLUTE        = 0
  4210  	TCL_PATH_RELATIVE        = 1
  4211  	TCL_PATH_VOLUME_RELATIVE = 2
  4212  )
  4213  
  4214  //----------------------------------------------------------------------------
  4215  // When a TCL command returns, the interpreter contains a result from the
  4216  // command. Programmers are strongly encouraged to use one of the functions
  4217  // Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's
  4218  // result. See the SetResult man page for details. Besides this result, the
  4219  // command function returns an integer code, which is one of the following:
  4220  //
  4221  // TCL_OK		Command completed normally; the interpreter's result
  4222  //			contains the command's result.
  4223  // TCL_ERROR		The command couldn't be completed successfully; the
  4224  //			interpreter's result describes what went wrong.
  4225  // TCL_RETURN		The command requests that the current function return;
  4226  //			the interpreter's result contains the function's
  4227  //			return value.
  4228  // TCL_BREAK		The command requests that the innermost loop be
  4229  //			exited; the interpreter's result is meaningless.
  4230  // TCL_CONTINUE		Go on to the next iteration of the current loop; the
  4231  //			interpreter's result is meaningless.
  4232  
  4233  //----------------------------------------------------------------------------
  4234  // Flags to control what substitutions are performed by Tcl_SubstObj():
  4235  
  4236  // Argument descriptors for math function callbacks in expressions:
  4237  
  4238  const ( /* tcl.h:690:1: */
  4239  	TCL_INT      = 0
  4240  	TCL_DOUBLE   = 1
  4241  	TCL_EITHER   = 2
  4242  	TCL_WIDE_INT = 3
  4243  )
  4244  
  4245  type ptrdiff_t = int32 /* <builtin>:3:26 */
  4246  
  4247  type size_t = uint32 /* <builtin>:9:23 */
  4248  
  4249  type wchar_t = uint32 /* <builtin>:15:24 */
  4250  
  4251  // Define the standard macros for the user,
  4252  //    if this invocation was from the user program.
  4253  
  4254  // Define va_list, if desired, from __gnuc_va_list.
  4255  // We deliberately do not define va_list when called from
  4256  //    stdio.h, because ANSI C says that stdio.h is not supposed to define
  4257  //    va_list.  stdio.h needs to have access to that data type,
  4258  //    but must not use that name.  It should use the name __gnuc_va_list,
  4259  //    which is safe because it is reserved for the implementation.
  4260  
  4261  // The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  4262  //    But on BSD NET2 we must not test or define or undef it.
  4263  //    (Note that the comments in NET 2's ansi.h
  4264  //    are incorrect for _VA_LIST_--see stdio.h!)
  4265  // The macro _VA_LIST_DEFINED is used in Windows NT 3.5
  4266  // The macro _VA_LIST is used in SCO Unix 3.2.
  4267  // The macro _VA_LIST_T_H is used in the Bull dpx2
  4268  // The macro __va_list__ is used by BeOS.
  4269  type va_list = uintptr /* stdarg.h:99:24 */
  4270  
  4271  // CAPI3REF: Database Connection Handle
  4272  // KEYWORDS: {database connection} {database connections}
  4273  //
  4274  // Each open SQLite database is represented by a pointer to an instance of
  4275  // the opaque structure named "sqlite3".  It is useful to think of an sqlite3
  4276  // pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
  4277  // [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
  4278  // and [sqlite3_close_v2()] are its destructors.  There are many other
  4279  // interfaces (such as
  4280  // [sqlite3_prepare_v2()], [sqlite3_create_function()], and
  4281  // [sqlite3_busy_timeout()] to name but three) that are methods on an
  4282  // sqlite3 object.
  4283  type sqlite32 = struct {
  4284  	FpVfs                   uintptr
  4285  	FpVdbe                  uintptr
  4286  	FpDfltColl              uintptr
  4287  	Fmutex                  uintptr
  4288  	FaDb                    uintptr
  4289  	FnDb                    int32
  4290  	FmDbFlags               u32
  4291  	_                       [4]byte
  4292  	Fflags                  u64
  4293  	FlastRowid              i64
  4294  	FszMmap                 i64
  4295  	FnSchemaLock            u32
  4296  	FopenFlags              uint32
  4297  	FerrCode                int32
  4298  	FerrMask                int32
  4299  	FiSysErrno              int32
  4300  	FdbOptFlags             u32
  4301  	Fenc                    u8
  4302  	FautoCommit             u8
  4303  	Ftemp_store             u8
  4304  	FmallocFailed           u8
  4305  	FbBenignMalloc          u8
  4306  	FdfltLockMode           u8
  4307  	FnextAutovac            int8
  4308  	FsuppressErr            u8
  4309  	FvtabOnConflict         u8
  4310  	FisTransactionSavepoint u8
  4311  	FmTrace                 u8
  4312  	FnoSharedCache          u8
  4313  	FnSqlExec               u8
  4314  	_                       [3]byte
  4315  	FnextPagesize           int32
  4316  	Fmagic                  u32
  4317  	FnChange                int32
  4318  	FnTotalChange           int32
  4319  	FaLimit                 [12]int32
  4320  	FnMaxSorterMmap         int32
  4321  	Finit                   struct {
  4322  		FnewTnum       Pgno
  4323  		FiDb           u8
  4324  		Fbusy          u8
  4325  		_              [2]byte
  4326  		ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */
  4327  		_              [3]byte
  4328  		FazInit        uintptr
  4329  	}
  4330  	FnVdbeActive        int32
  4331  	FnVdbeRead          int32
  4332  	FnVdbeWrite         int32
  4333  	FnVdbeExec          int32
  4334  	FnVDestroy          int32
  4335  	FnExtension         int32
  4336  	FaExtension         uintptr
  4337  	Ftrace              struct{ FxLegacy uintptr }
  4338  	FpTraceArg          uintptr
  4339  	FxProfile           uintptr
  4340  	FpProfileArg        uintptr
  4341  	FpCommitArg         uintptr
  4342  	FxCommitCallback    uintptr
  4343  	FpRollbackArg       uintptr
  4344  	FxRollbackCallback  uintptr
  4345  	FpUpdateArg         uintptr
  4346  	FxUpdateCallback    uintptr
  4347  	FpParse             uintptr
  4348  	FpPreUpdateArg      uintptr
  4349  	FxPreUpdateCallback uintptr
  4350  	FpPreUpdate         uintptr
  4351  	FxWalCallback       uintptr
  4352  	FpWalArg            uintptr
  4353  	FxCollNeeded        uintptr
  4354  	FxCollNeeded16      uintptr
  4355  	FpCollNeededArg     uintptr
  4356  	FpErr               uintptr
  4357  	Fu1                 struct {
  4358  		_              [0]uint64
  4359  		FisInterrupted int32
  4360  		_              [4]byte
  4361  	}
  4362  	Flookaside           Lookaside
  4363  	FxAuth               sqlite3_xauth
  4364  	FpAuthArg            uintptr
  4365  	FxProgress           uintptr
  4366  	FpProgressArg        uintptr
  4367  	FnProgressOps        uint32
  4368  	FnVTrans             int32
  4369  	FaModule             Hash
  4370  	FpVtabCtx            uintptr
  4371  	FaVTrans             uintptr
  4372  	FpDisconnect         uintptr
  4373  	FaFunc               Hash
  4374  	FaCollSeq            Hash
  4375  	FbusyHandler         BusyHandler
  4376  	FaDbStatic           [2]Db
  4377  	FpSavepoint          uintptr
  4378  	FnAnalysisLimit      int32
  4379  	FbusyTimeout         int32
  4380  	FnSavepoint          int32
  4381  	FnStatement          int32
  4382  	_                    [4]byte
  4383  	FnDeferredCons       i64
  4384  	FnDeferredImmCons    i64
  4385  	FpnBytesFreed        uintptr
  4386  	FpBlockingConnection uintptr
  4387  	FpUnlockConnection   uintptr
  4388  	FpUnlockArg          uintptr
  4389  	FxUnlockNotify       uintptr
  4390  	FpNextBlocked        uintptr
  4391  } /* sqlite3.h:249:9 */
  4392  
  4393  // CAPI3REF: 64-Bit Integer Types
  4394  // KEYWORDS: sqlite_int64 sqlite_uint64
  4395  //
  4396  // Because there is no cross-platform way to specify 64-bit integer types
  4397  // SQLite includes typedefs for 64-bit signed and unsigned integers.
  4398  //
  4399  // The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
  4400  // The sqlite_int64 and sqlite_uint64 types are supported for backwards
  4401  // compatibility only.
  4402  //
  4403  // ^The sqlite3_int64 and sqlite_int64 types can store integer values
  4404  // between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
  4405  // sqlite3_uint64 and sqlite_uint64 types can store integer values
  4406  // between 0 and +18446744073709551615 inclusive.
  4407  type sqlite_int64 = int64           /* sqlite3.h:278:25 */
  4408  type sqlite_uint64 = uint64         /* sqlite3.h:279:34 */
  4409  type sqlite3_int64 = sqlite_int64   /* sqlite3.h:281:22 */
  4410  type sqlite3_uint64 = sqlite_uint64 /* sqlite3.h:282:23 */
  4411  
  4412  // The type for a callback function.
  4413  // This is legacy and deprecated.  It is included for historical
  4414  // compatibility and is not documented.
  4415  type sqlite3_callback = uintptr /* sqlite3.h:338:13 */
  4416  
  4417  // CAPI3REF: Result Codes
  4418  // KEYWORDS: {result code definitions}
  4419  //
  4420  // Many SQLite functions return an integer result code from the set shown
  4421  // here in order to indicate success or failure.
  4422  //
  4423  // New error codes may be added in future versions of SQLite.
  4424  //
  4425  // See also: [extended result code definitions]
  4426  // beginning-of-error-codes
  4427  // end-of-error-codes
  4428  
  4429  // CAPI3REF: Extended Result Codes
  4430  // KEYWORDS: {extended result code definitions}
  4431  //
  4432  // In its default configuration, SQLite API routines return one of 30 integer
  4433  // [result codes].  However, experience has shown that many of
  4434  // these result codes are too coarse-grained.  They do not provide as
  4435  // much information about problems as programmers might like.  In an effort to
  4436  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  4437  // and later) include
  4438  // support for additional result codes that provide more detailed information
  4439  // about errors. These [extended result codes] are enabled or disabled
  4440  // on a per database connection basis using the
  4441  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  4442  // the most recent error can be obtained using
  4443  // [sqlite3_extended_errcode()].
  4444  
  4445  // CAPI3REF: Flags For File Open Operations
  4446  //
  4447  // These bit values are intended for use in the
  4448  // 3rd parameter to the [sqlite3_open_v2()] interface and
  4449  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  4450  
  4451  // Reserved:                         0x00F00000
  4452  // Legacy compatibility:
  4453  
  4454  // CAPI3REF: Device Characteristics
  4455  //
  4456  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  4457  // object returns an integer which is a vector of these
  4458  // bit values expressing I/O characteristics of the mass storage
  4459  // device that holds the file that the [sqlite3_io_methods]
  4460  // refers to.
  4461  //
  4462  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  4463  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  4464  // mean that writes of blocks that are nnn bytes in size and
  4465  // are aligned to an address which is an integer multiple of
  4466  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  4467  // that when data is appended to a file, the data is appended
  4468  // first then the size of the file is extended, never the other
  4469  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  4470  // information is written to disk in the same order as calls
  4471  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  4472  // after reboot following a crash or power loss, the only bytes in a
  4473  // file that were written at the application level might have changed
  4474  // and that adjacent bytes, even bytes within the same sector are
  4475  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  4476  // flag indicates that a file cannot be deleted when open.  The
  4477  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  4478  // read-only media and cannot be changed even by processes with
  4479  // elevated privileges.
  4480  //
  4481  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  4482  // filesystem supports doing multiple write operations atomically when those
  4483  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  4484  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  4485  
  4486  // CAPI3REF: File Locking Levels
  4487  //
  4488  // SQLite uses one of these integer values as the second
  4489  // argument to calls it makes to the xLock() and xUnlock() methods
  4490  // of an [sqlite3_io_methods] object.
  4491  
  4492  // CAPI3REF: Synchronization Type Flags
  4493  //
  4494  // When SQLite invokes the xSync() method of an
  4495  // [sqlite3_io_methods] object it uses a combination of
  4496  // these integer values as the second argument.
  4497  //
  4498  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  4499  // sync operation only needs to flush data to mass storage.  Inode
  4500  // information need not be flushed. If the lower four bits of the flag
  4501  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  4502  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  4503  // to use Mac OS X style fullsync instead of fsync().
  4504  //
  4505  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  4506  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  4507  // settings.  The [synchronous pragma] determines when calls to the
  4508  // xSync VFS method occur and applies uniformly across all platforms.
  4509  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  4510  // energetic or rigorous or forceful the sync operations are and
  4511  // only make a difference on Mac OSX for the default SQLite code.
  4512  // (Third-party VFS implementations might also make the distinction
  4513  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  4514  // operating systems natively supported by SQLite, only Mac OSX
  4515  // cares about the difference.)
  4516  
  4517  // CAPI3REF: OS Interface Open File Handle
  4518  //
  4519  // An [sqlite3_file] object represents an open file in the
  4520  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  4521  // implementations will
  4522  // want to subclass this object by appending additional fields
  4523  // for their own use.  The pMethods entry is a pointer to an
  4524  // [sqlite3_io_methods] object that defines methods for performing
  4525  // I/O operations on the open file.
  4526  type sqlite3_file1 = struct{ FpMethods uintptr } /* sqlite3.h:684:9 */
  4527  
  4528  // CAPI3REF: Result Codes
  4529  // KEYWORDS: {result code definitions}
  4530  //
  4531  // Many SQLite functions return an integer result code from the set shown
  4532  // here in order to indicate success or failure.
  4533  //
  4534  // New error codes may be added in future versions of SQLite.
  4535  //
  4536  // See also: [extended result code definitions]
  4537  // beginning-of-error-codes
  4538  // end-of-error-codes
  4539  
  4540  // CAPI3REF: Extended Result Codes
  4541  // KEYWORDS: {extended result code definitions}
  4542  //
  4543  // In its default configuration, SQLite API routines return one of 30 integer
  4544  // [result codes].  However, experience has shown that many of
  4545  // these result codes are too coarse-grained.  They do not provide as
  4546  // much information about problems as programmers might like.  In an effort to
  4547  // address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
  4548  // and later) include
  4549  // support for additional result codes that provide more detailed information
  4550  // about errors. These [extended result codes] are enabled or disabled
  4551  // on a per database connection basis using the
  4552  // [sqlite3_extended_result_codes()] API.  Or, the extended code for
  4553  // the most recent error can be obtained using
  4554  // [sqlite3_extended_errcode()].
  4555  
  4556  // CAPI3REF: Flags For File Open Operations
  4557  //
  4558  // These bit values are intended for use in the
  4559  // 3rd parameter to the [sqlite3_open_v2()] interface and
  4560  // in the 4th parameter to the [sqlite3_vfs.xOpen] method.
  4561  
  4562  // Reserved:                         0x00F00000
  4563  // Legacy compatibility:
  4564  
  4565  // CAPI3REF: Device Characteristics
  4566  //
  4567  // The xDeviceCharacteristics method of the [sqlite3_io_methods]
  4568  // object returns an integer which is a vector of these
  4569  // bit values expressing I/O characteristics of the mass storage
  4570  // device that holds the file that the [sqlite3_io_methods]
  4571  // refers to.
  4572  //
  4573  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  4574  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  4575  // mean that writes of blocks that are nnn bytes in size and
  4576  // are aligned to an address which is an integer multiple of
  4577  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  4578  // that when data is appended to a file, the data is appended
  4579  // first then the size of the file is extended, never the other
  4580  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  4581  // information is written to disk in the same order as calls
  4582  // to xWrite().  The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
  4583  // after reboot following a crash or power loss, the only bytes in a
  4584  // file that were written at the application level might have changed
  4585  // and that adjacent bytes, even bytes within the same sector are
  4586  // guaranteed to be unchanged.  The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
  4587  // flag indicates that a file cannot be deleted when open.  The
  4588  // SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
  4589  // read-only media and cannot be changed even by processes with
  4590  // elevated privileges.
  4591  //
  4592  // The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
  4593  // filesystem supports doing multiple write operations atomically when those
  4594  // write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
  4595  // [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
  4596  
  4597  // CAPI3REF: File Locking Levels
  4598  //
  4599  // SQLite uses one of these integer values as the second
  4600  // argument to calls it makes to the xLock() and xUnlock() methods
  4601  // of an [sqlite3_io_methods] object.
  4602  
  4603  // CAPI3REF: Synchronization Type Flags
  4604  //
  4605  // When SQLite invokes the xSync() method of an
  4606  // [sqlite3_io_methods] object it uses a combination of
  4607  // these integer values as the second argument.
  4608  //
  4609  // When the SQLITE_SYNC_DATAONLY flag is used, it means that the
  4610  // sync operation only needs to flush data to mass storage.  Inode
  4611  // information need not be flushed. If the lower four bits of the flag
  4612  // equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
  4613  // If the lower four bits equal SQLITE_SYNC_FULL, that means
  4614  // to use Mac OS X style fullsync instead of fsync().
  4615  //
  4616  // Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
  4617  // with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
  4618  // settings.  The [synchronous pragma] determines when calls to the
  4619  // xSync VFS method occur and applies uniformly across all platforms.
  4620  // The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
  4621  // energetic or rigorous or forceful the sync operations are and
  4622  // only make a difference on Mac OSX for the default SQLite code.
  4623  // (Third-party VFS implementations might also make the distinction
  4624  // between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
  4625  // operating systems natively supported by SQLite, only Mac OSX
  4626  // cares about the difference.)
  4627  
  4628  // CAPI3REF: OS Interface Open File Handle
  4629  //
  4630  // An [sqlite3_file] object represents an open file in the
  4631  // [sqlite3_vfs | OS interface layer].  Individual OS interface
  4632  // implementations will
  4633  // want to subclass this object by appending additional fields
  4634  // for their own use.  The pMethods entry is a pointer to an
  4635  // [sqlite3_io_methods] object that defines methods for performing
  4636  // I/O operations on the open file.
  4637  type sqlite3_file = sqlite3_file1 /* sqlite3.h:684:29 */
  4638  type sqlite3_io_methods1 = struct {
  4639  	FiVersion               int32
  4640  	FxClose                 uintptr
  4641  	FxRead                  uintptr
  4642  	FxWrite                 uintptr
  4643  	FxTruncate              uintptr
  4644  	FxSync                  uintptr
  4645  	FxFileSize              uintptr
  4646  	FxLock                  uintptr
  4647  	FxUnlock                uintptr
  4648  	FxCheckReservedLock     uintptr
  4649  	FxFileControl           uintptr
  4650  	FxSectorSize            uintptr
  4651  	FxDeviceCharacteristics uintptr
  4652  	FxShmMap                uintptr
  4653  	FxShmLock               uintptr
  4654  	FxShmBarrier            uintptr
  4655  	FxShmUnmap              uintptr
  4656  	FxFetch                 uintptr
  4657  	FxUnfetch               uintptr
  4658  } /* sqlite3.h:684:9 */
  4659  
  4660  // CAPI3REF: OS Interface File Virtual Methods Object
  4661  //
  4662  // Every file opened by the [sqlite3_vfs.xOpen] method populates an
  4663  // [sqlite3_file] object (or, more commonly, a subclass of the
  4664  // [sqlite3_file] object) with a pointer to an instance of this object.
  4665  // This object defines the methods used to perform various operations
  4666  // against the open file represented by the [sqlite3_file] object.
  4667  //
  4668  // If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
  4669  // to a non-NULL pointer, then the sqlite3_io_methods.xClose method
  4670  // may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed.  The
  4671  // only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
  4672  // is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
  4673  // to NULL.
  4674  //
  4675  // The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
  4676  // [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
  4677  // The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]
  4678  // flag may be ORed in to indicate that only the data of the file
  4679  // and not its inode needs to be synced.
  4680  //
  4681  // The integer values to xLock() and xUnlock() are one of
  4682  // <ul>
  4683  // <li> [SQLITE_LOCK_NONE],
  4684  // <li> [SQLITE_LOCK_SHARED],
  4685  // <li> [SQLITE_LOCK_RESERVED],
  4686  // <li> [SQLITE_LOCK_PENDING], or
  4687  // <li> [SQLITE_LOCK_EXCLUSIVE].
  4688  // </ul>
  4689  // xLock() increases the lock. xUnlock() decreases the lock.
  4690  // The xCheckReservedLock() method checks whether any database connection,
  4691  // either in this process or in some other process, is holding a RESERVED,
  4692  // PENDING, or EXCLUSIVE lock on the file.  It returns true
  4693  // if such a lock exists and false otherwise.
  4694  //
  4695  // The xFileControl() method is a generic interface that allows custom
  4696  // VFS implementations to directly control an open file using the
  4697  // [sqlite3_file_control()] interface.  The second "op" argument is an
  4698  // integer opcode.  The third argument is a generic pointer intended to
  4699  // point to a structure that may contain arguments or space in which to
  4700  // write return values.  Potential uses for xFileControl() might be
  4701  // functions to enable blocking locks with timeouts, to change the
  4702  // locking strategy (for example to use dot-file locks), to inquire
  4703  // about the status of a lock, or to break stale locks.  The SQLite
  4704  // core reserves all opcodes less than 100 for its own use.
  4705  // A [file control opcodes | list of opcodes] less than 100 is available.
  4706  // Applications that define a custom xFileControl method should use opcodes
  4707  // greater than 100 to avoid conflicts.  VFS implementations should
  4708  // return [SQLITE_NOTFOUND] for file control opcodes that they do not
  4709  // recognize.
  4710  //
  4711  // The xSectorSize() method returns the sector size of the
  4712  // device that underlies the file.  The sector size is the
  4713  // minimum write that can be performed without disturbing
  4714  // other bytes in the file.  The xDeviceCharacteristics()
  4715  // method returns a bit vector describing behaviors of the
  4716  // underlying device:
  4717  //
  4718  // <ul>
  4719  // <li> [SQLITE_IOCAP_ATOMIC]
  4720  // <li> [SQLITE_IOCAP_ATOMIC512]
  4721  // <li> [SQLITE_IOCAP_ATOMIC1K]
  4722  // <li> [SQLITE_IOCAP_ATOMIC2K]
  4723  // <li> [SQLITE_IOCAP_ATOMIC4K]
  4724  // <li> [SQLITE_IOCAP_ATOMIC8K]
  4725  // <li> [SQLITE_IOCAP_ATOMIC16K]
  4726  // <li> [SQLITE_IOCAP_ATOMIC32K]
  4727  // <li> [SQLITE_IOCAP_ATOMIC64K]
  4728  // <li> [SQLITE_IOCAP_SAFE_APPEND]
  4729  // <li> [SQLITE_IOCAP_SEQUENTIAL]
  4730  // <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
  4731  // <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
  4732  // <li> [SQLITE_IOCAP_IMMUTABLE]
  4733  // <li> [SQLITE_IOCAP_BATCH_ATOMIC]
  4734  // </ul>
  4735  //
  4736  // The SQLITE_IOCAP_ATOMIC property means that all writes of
  4737  // any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
  4738  // mean that writes of blocks that are nnn bytes in size and
  4739  // are aligned to an address which is an integer multiple of
  4740  // nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
  4741  // that when data is appended to a file, the data is appended
  4742  // first then the size of the file is extended, never the other
  4743  // way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
  4744  // information is written to disk in the same order as calls
  4745  // to xWrite().
  4746  //
  4747  // If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
  4748  // in the unread portions of the buffer with zeros.  A VFS that
  4749  // fails to zero-fill short reads might seem to work.  However,
  4750  // failure to zero-fill short reads will eventually lead to
  4751  // database corruption.
  4752  type sqlite3_io_methods = sqlite3_io_methods1 /* sqlite3.h:783:35 */
  4753  
  4754  // CAPI3REF: Standard File Control Opcodes
  4755  // KEYWORDS: {file control opcodes} {file control opcode}
  4756  //
  4757  // These integer constants are opcodes for the xFileControl method
  4758  // of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
  4759  // interface.
  4760  //
  4761  // <ul>
  4762  // <li>[[SQLITE_FCNTL_LOCKSTATE]]
  4763  // The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
  4764  // opcode causes the xFileControl method to write the current state of
  4765  // the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
  4766  // [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
  4767  // into an integer that the pArg argument points to. This capability
  4768  // is used during testing and is only available when the SQLITE_TEST
  4769  // compile-time option is used.
  4770  //
  4771  // <li>[[SQLITE_FCNTL_SIZE_HINT]]
  4772  // The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
  4773  // layer a hint of how large the database file will grow to be during the
  4774  // current transaction.  This hint is not guaranteed to be accurate but it
  4775  // is often close.  The underlying VFS might choose to preallocate database
  4776  // file space based on this hint in order to help writes to the database
  4777  // file run faster.
  4778  //
  4779  // <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
  4780  // The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
  4781  // implements [sqlite3_deserialize()] to set an upper bound on the size
  4782  // of the in-memory database.  The argument is a pointer to a [sqlite3_int64].
  4783  // If the integer pointed to is negative, then it is filled in with the
  4784  // current limit.  Otherwise the limit is set to the larger of the value
  4785  // of the integer pointed to and the current database size.  The integer
  4786  // pointed to is set to the new limit.
  4787  //
  4788  // <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
  4789  // The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
  4790  // extends and truncates the database file in chunks of a size specified
  4791  // by the user. The fourth argument to [sqlite3_file_control()] should
  4792  // point to an integer (type int) containing the new chunk-size to use
  4793  // for the nominated database. Allocating database file space in large
  4794  // chunks (say 1MB at a time), may reduce file-system fragmentation and
  4795  // improve performance on some systems.
  4796  //
  4797  // <li>[[SQLITE_FCNTL_FILE_POINTER]]
  4798  // The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
  4799  // to the [sqlite3_file] object associated with a particular database
  4800  // connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].
  4801  //
  4802  // <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
  4803  // The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
  4804  // to the [sqlite3_file] object associated with the journal file (either
  4805  // the [rollback journal] or the [write-ahead log]) for a particular database
  4806  // connection.  See also [SQLITE_FCNTL_FILE_POINTER].
  4807  //
  4808  // <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
  4809  // No longer in use.
  4810  //
  4811  // <li>[[SQLITE_FCNTL_SYNC]]
  4812  // The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
  4813  // sent to the VFS immediately before the xSync method is invoked on a
  4814  // database file descriptor. Or, if the xSync method is not invoked
  4815  // because the user has configured SQLite with
  4816  // [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
  4817  // of the xSync method. In most cases, the pointer argument passed with
  4818  // this file-control is NULL. However, if the database file is being synced
  4819  // as part of a multi-database commit, the argument points to a nul-terminated
  4820  // string containing the transactions super-journal file name. VFSes that
  4821  // do not need this signal should silently ignore this opcode. Applications
  4822  // should not call [sqlite3_file_control()] with this opcode as doing so may
  4823  // disrupt the operation of the specialized VFSes that do require it.
  4824  //
  4825  // <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
  4826  // The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
  4827  // and sent to the VFS after a transaction has been committed immediately
  4828  // but before the database is unlocked. VFSes that do not need this signal
  4829  // should silently ignore this opcode. Applications should not call
  4830  // [sqlite3_file_control()] with this opcode as doing so may disrupt the
  4831  // operation of the specialized VFSes that do require it.
  4832  //
  4833  // <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
  4834  // ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
  4835  // retry counts and intervals for certain disk I/O operations for the
  4836  // windows [VFS] in order to provide robustness in the presence of
  4837  // anti-virus programs.  By default, the windows VFS will retry file read,
  4838  // file write, and file delete operations up to 10 times, with a delay
  4839  // of 25 milliseconds before the first retry and with the delay increasing
  4840  // by an additional 25 milliseconds with each subsequent retry.  This
  4841  // opcode allows these two values (10 retries and 25 milliseconds of delay)
  4842  // to be adjusted.  The values are changed for all database connections
  4843  // within the same process.  The argument is a pointer to an array of two
  4844  // integers where the first integer is the new retry count and the second
  4845  // integer is the delay.  If either integer is negative, then the setting
  4846  // is not changed but instead the prior value of that setting is written
  4847  // into the array entry, allowing the current retry settings to be
  4848  // interrogated.  The zDbName parameter is ignored.
  4849  //
  4850  // <li>[[SQLITE_FCNTL_PERSIST_WAL]]
  4851  // ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
  4852  // persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
  4853  // write ahead log ([WAL file]) and shared memory
  4854  // files used for transaction control
  4855  // are automatically deleted when the latest connection to the database
  4856  // closes.  Setting persistent WAL mode causes those files to persist after
  4857  // close.  Persisting the files is useful when other processes that do not
  4858  // have write permission on the directory containing the database file want
  4859  // to read the database file, as the WAL and shared memory files must exist
  4860  // in order for the database to be readable.  The fourth parameter to
  4861  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
  4862  // That integer is 0 to disable persistent WAL mode or 1 to enable persistent
  4863  // WAL mode.  If the integer is -1, then it is overwritten with the current
  4864  // WAL persistence setting.
  4865  //
  4866  // <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
  4867  // ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
  4868  // persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting
  4869  // determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
  4870  // xDeviceCharacteristics methods. The fourth parameter to
  4871  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
  4872  // That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
  4873  // mode.  If the integer is -1, then it is overwritten with the current
  4874  // zero-damage mode setting.
  4875  //
  4876  // <li>[[SQLITE_FCNTL_OVERWRITE]]
  4877  // ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
  4878  // a write transaction to indicate that, unless it is rolled back for some
  4879  // reason, the entire database file will be overwritten by the current
  4880  // transaction. This is used by VACUUM operations.
  4881  //
  4882  // <li>[[SQLITE_FCNTL_VFSNAME]]
  4883  // ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
  4884  // all [VFSes] in the VFS stack.  The names are of all VFS shims and the
  4885  // final bottom-level VFS are written into memory obtained from
  4886  // [sqlite3_malloc()] and the result is stored in the char* variable
  4887  // that the fourth parameter of [sqlite3_file_control()] points to.
  4888  // The caller is responsible for freeing the memory when done.  As with
  4889  // all file-control actions, there is no guarantee that this will actually
  4890  // do anything.  Callers should initialize the char* variable to a NULL
  4891  // pointer in case this file-control is not implemented.  This file-control
  4892  // is intended for diagnostic use only.
  4893  //
  4894  // <li>[[SQLITE_FCNTL_VFS_POINTER]]
  4895  // ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
  4896  // [VFSes] currently in use.  ^(The argument X in
  4897  // sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
  4898  // of type "[sqlite3_vfs] **".  This opcodes will set *X
  4899  // to a pointer to the top-level VFS.)^
  4900  // ^When there are multiple VFS shims in the stack, this opcode finds the
  4901  // upper-most shim only.
  4902  //
  4903  // <li>[[SQLITE_FCNTL_PRAGMA]]
  4904  // ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
  4905  // file control is sent to the open [sqlite3_file] object corresponding
  4906  // to the database file to which the pragma statement refers. ^The argument
  4907  // to the [SQLITE_FCNTL_PRAGMA] file control is an array of
  4908  // pointers to strings (char**) in which the second element of the array
  4909  // is the name of the pragma and the third element is the argument to the
  4910  // pragma or NULL if the pragma has no argument.  ^The handler for an
  4911  // [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
  4912  // of the char** argument point to a string obtained from [sqlite3_mprintf()]
  4913  // or the equivalent and that string will become the result of the pragma or
  4914  // the error message if the pragma fails. ^If the
  4915  // [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
  4916  // [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]
  4917  // file control returns [SQLITE_OK], then the parser assumes that the
  4918  // VFS has handled the PRAGMA itself and the parser generates a no-op
  4919  // prepared statement if result string is NULL, or that returns a copy
  4920  // of the result string if the string is non-NULL.
  4921  // ^If the [SQLITE_FCNTL_PRAGMA] file control returns
  4922  // any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
  4923  // that the VFS encountered an error while handling the [PRAGMA] and the
  4924  // compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]
  4925  // file control occurs at the beginning of pragma statement analysis and so
  4926  // it is able to override built-in [PRAGMA] statements.
  4927  //
  4928  // <li>[[SQLITE_FCNTL_BUSYHANDLER]]
  4929  // ^The [SQLITE_FCNTL_BUSYHANDLER]
  4930  // file-control may be invoked by SQLite on the database file handle
  4931  // shortly after it is opened in order to provide a custom VFS with access
  4932  // to the connection's busy-handler callback. The argument is of type (void**)
  4933  // - an array of two (void *) values. The first (void *) actually points
  4934  // to a function of type (int (*)(void *)). In order to invoke the connection's
  4935  // busy-handler, this function should be invoked with the second (void *) in
  4936  // the array as the only argument. If it returns non-zero, then the operation
  4937  // should be retried. If it returns zero, the custom VFS should abandon the
  4938  // current operation.
  4939  //
  4940  // <li>[[SQLITE_FCNTL_TEMPFILENAME]]
  4941  // ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
  4942  // to have SQLite generate a
  4943  // temporary filename using the same algorithm that is followed to generate
  4944  // temporary filenames for TEMP tables and other internal uses.  The
  4945  // argument should be a char** which will be filled with the filename
  4946  // written into memory obtained from [sqlite3_malloc()].  The caller should
  4947  // invoke [sqlite3_free()] on the result to avoid a memory leak.
  4948  //
  4949  // <li>[[SQLITE_FCNTL_MMAP_SIZE]]
  4950  // The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
  4951  // maximum number of bytes that will be used for memory-mapped I/O.
  4952  // The argument is a pointer to a value of type sqlite3_int64 that
  4953  // is an advisory maximum number of bytes in the file to memory map.  The
  4954  // pointer is overwritten with the old value.  The limit is not changed if
  4955  // the value originally pointed to is negative, and so the current limit
  4956  // can be queried by passing in a pointer to a negative number.  This
  4957  // file-control is used internally to implement [PRAGMA mmap_size].
  4958  //
  4959  // <li>[[SQLITE_FCNTL_TRACE]]
  4960  // The [SQLITE_FCNTL_TRACE] file control provides advisory information
  4961  // to the VFS about what the higher layers of the SQLite stack are doing.
  4962  // This file control is used by some VFS activity tracing [shims].
  4963  // The argument is a zero-terminated string.  Higher layers in the
  4964  // SQLite stack may generate instances of this file control if
  4965  // the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
  4966  //
  4967  // <li>[[SQLITE_FCNTL_HAS_MOVED]]
  4968  // The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
  4969  // pointer to an integer and it writes a boolean into that integer depending
  4970  // on whether or not the file has been renamed, moved, or deleted since it
  4971  // was first opened.
  4972  //
  4973  // <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
  4974  // The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
  4975  // underlying native file handle associated with a file handle.  This file
  4976  // control interprets its argument as a pointer to a native file handle and
  4977  // writes the resulting value there.
  4978  //
  4979  // <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
  4980  // The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
  4981  // opcode causes the xFileControl method to swap the file handle with the one
  4982  // pointed to by the pArg argument.  This capability is used during testing
  4983  // and only needs to be supported when SQLITE_TEST is defined.
  4984  //
  4985  // <li>[[SQLITE_FCNTL_WAL_BLOCK]]
  4986  // The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
  4987  // be advantageous to block on the next WAL lock if the lock is not immediately
  4988  // available.  The WAL subsystem issues this signal during rare
  4989  // circumstances in order to fix a problem with priority inversion.
  4990  // Applications should <em>not</em> use this file-control.
  4991  //
  4992  // <li>[[SQLITE_FCNTL_ZIPVFS]]
  4993  // The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
  4994  // VFS should return SQLITE_NOTFOUND for this opcode.
  4995  //
  4996  // <li>[[SQLITE_FCNTL_RBU]]
  4997  // The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
  4998  // the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for
  4999  // this opcode.
  5000  //
  5001  // <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
  5002  // If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
  5003  // the file descriptor is placed in "batch write mode", which
  5004  // means all subsequent write operations will be deferred and done
  5005  // atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].  Systems
  5006  // that do not support batch atomic writes will return SQLITE_NOTFOUND.
  5007  // ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
  5008  // the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
  5009  // [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
  5010  // no VFS interface calls on the same [sqlite3_file] file descriptor
  5011  // except for calls to the xWrite method and the xFileControl method
  5012  // with [SQLITE_FCNTL_SIZE_HINT].
  5013  //
  5014  // <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
  5015  // The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
  5016  // operations since the previous successful call to
  5017  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
  5018  // This file control returns [SQLITE_OK] if and only if the writes were
  5019  // all performed successfully and have been committed to persistent storage.
  5020  // ^Regardless of whether or not it is successful, this file control takes
  5021  // the file descriptor out of batch write mode so that all subsequent
  5022  // write operations are independent.
  5023  // ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
  5024  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
  5025  //
  5026  // <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
  5027  // The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
  5028  // operations since the previous successful call to
  5029  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
  5030  // ^This file control takes the file descriptor out of batch write mode
  5031  // so that all subsequent write operations are independent.
  5032  // ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
  5033  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
  5034  //
  5035  // <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
  5036  // The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
  5037  // to block for up to M milliseconds before failing when attempting to
  5038  // obtain a file lock using the xLock or xShmLock methods of the VFS.
  5039  // The parameter is a pointer to a 32-bit signed integer that contains
  5040  // the value that M is to be set to. Before returning, the 32-bit signed
  5041  // integer is overwritten with the previous value of M.
  5042  //
  5043  // <li>[[SQLITE_FCNTL_DATA_VERSION]]
  5044  // The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
  5045  // a database file.  The argument is a pointer to a 32-bit unsigned integer.
  5046  // The "data version" for the pager is written into the pointer.  The
  5047  // "data version" changes whenever any change occurs to the corresponding
  5048  // database file, either through SQL statements on the same database
  5049  // connection or through transactions committed by separate database
  5050  // connections possibly in other processes. The [sqlite3_total_changes()]
  5051  // interface can be used to find if any database on the connection has changed,
  5052  // but that interface responds to changes on TEMP as well as MAIN and does
  5053  // not provide a mechanism to detect changes to MAIN only.  Also, the
  5054  // [sqlite3_total_changes()] interface responds to internal changes only and
  5055  // omits changes made by other database connections.  The
  5056  // [PRAGMA data_version] command provides a mechanism to detect changes to
  5057  // a single attached database that occur due to other database connections,
  5058  // but omits changes implemented by the database connection on which it is
  5059  // called.  This file control is the only mechanism to detect changes that
  5060  // happen either internally or externally and that are associated with
  5061  // a particular attached database.
  5062  //
  5063  // <li>[[SQLITE_FCNTL_CKPT_START]]
  5064  // The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
  5065  // in wal mode before the client starts to copy pages from the wal
  5066  // file to the database file.
  5067  //
  5068  // <li>[[SQLITE_FCNTL_CKPT_DONE]]
  5069  // The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
  5070  // in wal mode after the client has finished copying pages from the wal
  5071  // file to the database file, but before the *-shm file is updated to
  5072  // record the fact that the pages have been checkpointed.
  5073  // </ul>
  5074  //
  5075  // <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
  5076  // The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
  5077  // whether or not there is a database client in another process with a wal-mode
  5078  // transaction open on the database or not. It is only available on unix.The
  5079  // (void*) argument passed with this file-control should be a pointer to a
  5080  // value of type (int). The integer value is set to 1 if the database is a wal
  5081  // mode database and there exists at least one client in another process that
  5082  // currently has an SQL transaction open on the database. It is set to 0 if
  5083  // the database is not a wal-mode db, or if there is no such connection in any
  5084  // other process. This opcode cannot be used to detect transactions opened
  5085  // by clients within the current process, only within other processes.
  5086  // </ul>
  5087  //
  5088  // <li>[[SQLITE_FCNTL_CKSM_FILE]]
  5089  // Used by the cksmvfs VFS module only.
  5090  // </ul>
  5091  
  5092  // deprecated names
  5093  
  5094  // CAPI3REF: Mutex Handle
  5095  //
  5096  // The mutex module within SQLite defines [sqlite3_mutex] to be an
  5097  // abstract type for a mutex object.  The SQLite core never looks
  5098  // at the internal representation of an [sqlite3_mutex].  It only
  5099  // deals with pointers to the [sqlite3_mutex] object.
  5100  //
  5101  // Mutexes are created using [sqlite3_mutex_alloc()].
  5102  type sqlite3_mutex1 = struct {
  5103  	FpReal uintptr
  5104  	FeType int32
  5105  } /* sqlite3.h:1206:9 */
  5106  
  5107  // CAPI3REF: Loadable Extension Thunk
  5108  //
  5109  // A pointer to the opaque sqlite3_api_routines structure is passed as
  5110  // the third parameter to entry points of [loadable extensions].  This
  5111  // structure must be typedefed in order to work around compiler warnings
  5112  // on some platforms.
  5113  type sqlite3_api_routines1 = struct {
  5114  	Faggregate_context      uintptr
  5115  	Faggregate_count        uintptr
  5116  	Fbind_blob              uintptr
  5117  	Fbind_double            uintptr
  5118  	Fbind_int               uintptr
  5119  	Fbind_int64             uintptr
  5120  	Fbind_null              uintptr
  5121  	Fbind_parameter_count   uintptr
  5122  	Fbind_parameter_index   uintptr
  5123  	Fbind_parameter_name    uintptr
  5124  	Fbind_text              uintptr
  5125  	Fbind_text16            uintptr
  5126  	Fbind_value             uintptr
  5127  	Fbusy_handler           uintptr
  5128  	Fbusy_timeout           uintptr
  5129  	Fchanges                uintptr
  5130  	Fclose                  uintptr
  5131  	Fcollation_needed       uintptr
  5132  	Fcollation_needed16     uintptr
  5133  	Fcolumn_blob            uintptr
  5134  	Fcolumn_bytes           uintptr
  5135  	Fcolumn_bytes16         uintptr
  5136  	Fcolumn_count           uintptr
  5137  	Fcolumn_database_name   uintptr
  5138  	Fcolumn_database_name16 uintptr
  5139  	Fcolumn_decltype        uintptr
  5140  	Fcolumn_decltype16      uintptr
  5141  	Fcolumn_double          uintptr
  5142  	Fcolumn_int             uintptr
  5143  	Fcolumn_int64           uintptr
  5144  	Fcolumn_name            uintptr
  5145  	Fcolumn_name16          uintptr
  5146  	Fcolumn_origin_name     uintptr
  5147  	Fcolumn_origin_name16   uintptr
  5148  	Fcolumn_table_name      uintptr
  5149  	Fcolumn_table_name16    uintptr
  5150  	Fcolumn_text            uintptr
  5151  	Fcolumn_text16          uintptr
  5152  	Fcolumn_type            uintptr
  5153  	Fcolumn_value           uintptr
  5154  	Fcommit_hook            uintptr
  5155  	Fcomplete               uintptr
  5156  	Fcomplete16             uintptr
  5157  	Fcreate_collation       uintptr
  5158  	Fcreate_collation16     uintptr
  5159  	Fcreate_function        uintptr
  5160  	Fcreate_function16      uintptr
  5161  	Fcreate_module          uintptr
  5162  	Fdata_count             uintptr
  5163  	Fdb_handle              uintptr
  5164  	Fdeclare_vtab           uintptr
  5165  	Fenable_shared_cache    uintptr
  5166  	Ferrcode                uintptr
  5167  	Ferrmsg                 uintptr
  5168  	Ferrmsg16               uintptr
  5169  	Fexec                   uintptr
  5170  	Fexpired                uintptr
  5171  	Ffinalize               uintptr
  5172  	Ffree                   uintptr
  5173  	Ffree_table             uintptr
  5174  	Fget_autocommit         uintptr
  5175  	Fget_auxdata            uintptr
  5176  	Fget_table              uintptr
  5177  	Fglobal_recover         uintptr
  5178  	Finterruptx             uintptr
  5179  	Flast_insert_rowid      uintptr
  5180  	Flibversion             uintptr
  5181  	Flibversion_number      uintptr
  5182  	Fmalloc                 uintptr
  5183  	Fmprintf                uintptr
  5184  	Fopen                   uintptr
  5185  	Fopen16                 uintptr
  5186  	Fprepare                uintptr
  5187  	Fprepare16              uintptr
  5188  	Fprofile                uintptr
  5189  	Fprogress_handler       uintptr
  5190  	Frealloc                uintptr
  5191  	Freset                  uintptr
  5192  	Fresult_blob            uintptr
  5193  	Fresult_double          uintptr
  5194  	Fresult_error           uintptr
  5195  	Fresult_error16         uintptr
  5196  	Fresult_int             uintptr
  5197  	Fresult_int64           uintptr
  5198  	Fresult_null            uintptr
  5199  	Fresult_text            uintptr
  5200  	Fresult_text16          uintptr
  5201  	Fresult_text16be        uintptr
  5202  	Fresult_text16le        uintptr
  5203  	Fresult_value           uintptr
  5204  	Frollback_hook          uintptr
  5205  	Fset_authorizer         uintptr
  5206  	Fset_auxdata            uintptr
  5207  	Fxsnprintf              uintptr
  5208  	Fstep                   uintptr
  5209  	Ftable_column_metadata  uintptr
  5210  	Fthread_cleanup         uintptr
  5211  	Ftotal_changes          uintptr
  5212  	Ftrace                  uintptr
  5213  	Ftransfer_bindings      uintptr
  5214  	Fupdate_hook            uintptr
  5215  	Fuser_data              uintptr
  5216  	Fvalue_blob             uintptr
  5217  	Fvalue_bytes            uintptr
  5218  	Fvalue_bytes16          uintptr
  5219  	Fvalue_double           uintptr
  5220  	Fvalue_int              uintptr
  5221  	Fvalue_int64            uintptr
  5222  	Fvalue_numeric_type     uintptr
  5223  	Fvalue_text             uintptr
  5224  	Fvalue_text16           uintptr
  5225  	Fvalue_text16be         uintptr
  5226  	Fvalue_text16le         uintptr
  5227  	Fvalue_type             uintptr
  5228  	Fvmprintf               uintptr
  5229  	Foverload_function      uintptr
  5230  	Fprepare_v2             uintptr
  5231  	Fprepare16_v2           uintptr
  5232  	Fclear_bindings         uintptr
  5233  	Fcreate_module_v2       uintptr
  5234  	Fbind_zeroblob          uintptr
  5235  	Fblob_bytes             uintptr
  5236  	Fblob_close             uintptr
  5237  	Fblob_open              uintptr
  5238  	Fblob_read              uintptr
  5239  	Fblob_write             uintptr
  5240  	Fcreate_collation_v2    uintptr
  5241  	Ffile_control           uintptr
  5242  	Fmemory_highwater       uintptr
  5243  	Fmemory_used            uintptr
  5244  	Fmutex_alloc            uintptr
  5245  	Fmutex_enter            uintptr
  5246  	Fmutex_free             uintptr
  5247  	Fmutex_leave            uintptr
  5248  	Fmutex_try              uintptr
  5249  	Fopen_v2                uintptr
  5250  	Frelease_memory         uintptr
  5251  	Fresult_error_nomem     uintptr
  5252  	Fresult_error_toobig    uintptr
  5253  	Fsleep                  uintptr
  5254  	Fsoft_heap_limit        uintptr
  5255  	Fvfs_find               uintptr
  5256  	Fvfs_register           uintptr
  5257  	Fvfs_unregister         uintptr
  5258  	Fxthreadsafe            uintptr
  5259  	Fresult_zeroblob        uintptr
  5260  	Fresult_error_code      uintptr
  5261  	Ftest_control           uintptr
  5262  	Frandomness             uintptr
  5263  	Fcontext_db_handle      uintptr
  5264  	Fextended_result_codes  uintptr
  5265  	Flimit                  uintptr
  5266  	Fnext_stmt              uintptr
  5267  	Fsql                    uintptr
  5268  	Fstatus                 uintptr
  5269  	Fbackup_finish          uintptr
  5270  	Fbackup_init            uintptr
  5271  	Fbackup_pagecount       uintptr
  5272  	Fbackup_remaining       uintptr
  5273  	Fbackup_step            uintptr
  5274  	Fcompileoption_get      uintptr
  5275  	Fcompileoption_used     uintptr
  5276  	Fcreate_function_v2     uintptr
  5277  	Fdb_config              uintptr
  5278  	Fdb_mutex               uintptr
  5279  	Fdb_status              uintptr
  5280  	Fextended_errcode       uintptr
  5281  	Flog                    uintptr
  5282  	Fsoft_heap_limit64      uintptr
  5283  	Fsourceid               uintptr
  5284  	Fstmt_status            uintptr
  5285  	Fstrnicmp               uintptr
  5286  	Funlock_notify          uintptr
  5287  	Fwal_autocheckpoint     uintptr
  5288  	Fwal_checkpoint         uintptr
  5289  	Fwal_hook               uintptr
  5290  	Fblob_reopen            uintptr
  5291  	Fvtab_config            uintptr
  5292  	Fvtab_on_conflict       uintptr
  5293  	Fclose_v2               uintptr
  5294  	Fdb_filename            uintptr
  5295  	Fdb_readonly            uintptr
  5296  	Fdb_release_memory      uintptr
  5297  	Ferrstr                 uintptr
  5298  	Fstmt_busy              uintptr
  5299  	Fstmt_readonly          uintptr
  5300  	Fstricmp                uintptr
  5301  	Furi_boolean            uintptr
  5302  	Furi_int64              uintptr
  5303  	Furi_parameter          uintptr
  5304  	Fxvsnprintf             uintptr
  5305  	Fwal_checkpoint_v2      uintptr
  5306  	Fauto_extension         uintptr
  5307  	Fbind_blob64            uintptr
  5308  	Fbind_text64            uintptr
  5309  	Fcancel_auto_extension  uintptr
  5310  	Fload_extension         uintptr
  5311  	Fmalloc64               uintptr
  5312  	Fmsize                  uintptr
  5313  	Frealloc64              uintptr
  5314  	Freset_auto_extension   uintptr
  5315  	Fresult_blob64          uintptr
  5316  	Fresult_text64          uintptr
  5317  	Fstrglob                uintptr
  5318  	Fvalue_dup              uintptr
  5319  	Fvalue_free             uintptr
  5320  	Fresult_zeroblob64      uintptr
  5321  	Fbind_zeroblob64        uintptr
  5322  	Fvalue_subtype          uintptr
  5323  	Fresult_subtype         uintptr
  5324  	Fstatus64               uintptr
  5325  	Fstrlike                uintptr
  5326  	Fdb_cacheflush          uintptr
  5327  	Fsystem_errno           uintptr
  5328  	Ftrace_v2               uintptr
  5329  	Fexpanded_sql           uintptr
  5330  	Fset_last_insert_rowid  uintptr
  5331  	Fprepare_v3             uintptr
  5332  	Fprepare16_v3           uintptr
  5333  	Fbind_pointer           uintptr
  5334  	Fresult_pointer         uintptr
  5335  	Fvalue_pointer          uintptr
  5336  	Fvtab_nochange          uintptr
  5337  	Fvalue_nochange         uintptr
  5338  	Fvtab_collation         uintptr
  5339  	Fkeyword_count          uintptr
  5340  	Fkeyword_name           uintptr
  5341  	Fkeyword_check          uintptr
  5342  	Fstr_new                uintptr
  5343  	Fstr_finish             uintptr
  5344  	Fstr_appendf            uintptr
  5345  	Fstr_vappendf           uintptr
  5346  	Fstr_append             uintptr
  5347  	Fstr_appendall          uintptr
  5348  	Fstr_appendchar         uintptr
  5349  	Fstr_reset              uintptr
  5350  	Fstr_errcode            uintptr
  5351  	Fstr_length             uintptr
  5352  	Fstr_value              uintptr
  5353  	Fcreate_window_function uintptr
  5354  	Fnormalized_sql         uintptr
  5355  	Fstmt_isexplain         uintptr
  5356  	Fvalue_frombind         uintptr
  5357  	Fdrop_modules           uintptr
  5358  	Fhard_heap_limit64      uintptr
  5359  	Furi_key                uintptr
  5360  	Ffilename_database      uintptr
  5361  	Ffilename_journal       uintptr
  5362  	Ffilename_wal           uintptr
  5363  	Fcreate_filename        uintptr
  5364  	Ffree_filename          uintptr
  5365  	Fdatabase_file_object   uintptr
  5366  	Ftxn_state              uintptr
  5367  } /* sqlite3.h:1216:9 */
  5368  
  5369  // CAPI3REF: OS Interface Object
  5370  //
  5371  // An instance of the sqlite3_vfs object defines the interface between
  5372  // the SQLite core and the underlying operating system.  The "vfs"
  5373  // in the name of the object stands for "virtual file system".  See
  5374  // the [VFS | VFS documentation] for further information.
  5375  //
  5376  // The VFS interface is sometimes extended by adding new methods onto
  5377  // the end.  Each time such an extension occurs, the iVersion field
  5378  // is incremented.  The iVersion value started out as 1 in
  5379  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  5380  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  5381  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  5382  // may be appended to the sqlite3_vfs object and the iVersion value
  5383  // may increase again in future versions of SQLite.
  5384  // Note that due to an oversight, the structure
  5385  // of the sqlite3_vfs object changed in the transition from
  5386  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  5387  // and yet the iVersion field was not increased.
  5388  //
  5389  // The szOsFile field is the size of the subclassed [sqlite3_file]
  5390  // structure used by this VFS.  mxPathname is the maximum length of
  5391  // a pathname in this VFS.
  5392  //
  5393  // Registered sqlite3_vfs objects are kept on a linked list formed by
  5394  // the pNext pointer.  The [sqlite3_vfs_register()]
  5395  // and [sqlite3_vfs_unregister()] interfaces manage this list
  5396  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  5397  // searches the list.  Neither the application code nor the VFS
  5398  // implementation should use the pNext pointer.
  5399  //
  5400  // The pNext field is the only field in the sqlite3_vfs
  5401  // structure that SQLite will ever modify.  SQLite will only access
  5402  // or modify this field while holding a particular static mutex.
  5403  // The application should never modify anything within the sqlite3_vfs
  5404  // object once the object has been registered.
  5405  //
  5406  // The zName field holds the name of the VFS module.  The name must
  5407  // be unique across all VFS modules.
  5408  //
  5409  // [[sqlite3_vfs.xOpen]]
  5410  // ^SQLite guarantees that the zFilename parameter to xOpen
  5411  // is either a NULL pointer or string obtained
  5412  // from xFullPathname() with an optional suffix added.
  5413  // ^If a suffix is added to the zFilename parameter, it will
  5414  // consist of a single "-" character followed by no more than
  5415  // 11 alphanumeric and/or "-" characters.
  5416  // ^SQLite further guarantees that
  5417  // the string will be valid and unchanged until xClose() is
  5418  // called. Because of the previous sentence,
  5419  // the [sqlite3_file] can safely store a pointer to the
  5420  // filename if it needs to remember the filename for some reason.
  5421  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  5422  // must invent its own temporary name for the file.  ^Whenever the
  5423  // xFilename parameter is NULL it will also be the case that the
  5424  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  5425  //
  5426  // The flags argument to xOpen() includes all bits set in
  5427  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  5428  // or [sqlite3_open16()] is used, then flags includes at least
  5429  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  5430  // If xOpen() opens a file read-only then it sets *pOutFlags to
  5431  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  5432  //
  5433  // ^(SQLite will also add one of the following flags to the xOpen()
  5434  // call, depending on the object being opened:
  5435  //
  5436  // <ul>
  5437  // <li>  [SQLITE_OPEN_MAIN_DB]
  5438  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  5439  // <li>  [SQLITE_OPEN_TEMP_DB]
  5440  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  5441  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  5442  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  5443  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  5444  // <li>  [SQLITE_OPEN_WAL]
  5445  // </ul>)^
  5446  //
  5447  // The file I/O implementation can use the object type flags to
  5448  // change the way it deals with files.  For example, an application
  5449  // that does not care about crash recovery or rollback might make
  5450  // the open of a journal file a no-op.  Writes to this journal would
  5451  // also be no-ops, and any attempt to read the journal would return
  5452  // SQLITE_IOERR.  Or the implementation might recognize that a database
  5453  // file will be doing page-aligned sector reads and writes in a random
  5454  // order and set up its I/O subsystem accordingly.
  5455  //
  5456  // SQLite might also add one of the following flags to the xOpen method:
  5457  //
  5458  // <ul>
  5459  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  5460  // <li> [SQLITE_OPEN_EXCLUSIVE]
  5461  // </ul>
  5462  //
  5463  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  5464  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  5465  // will be set for TEMP databases and their journals, transient
  5466  // databases, and subjournals.
  5467  //
  5468  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  5469  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  5470  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  5471  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  5472  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  5473  // be created, and that it is an error if it already exists.
  5474  // It is <i>not</i> used to indicate the file should be opened
  5475  // for exclusive access.
  5476  //
  5477  // ^At least szOsFile bytes of memory are allocated by SQLite
  5478  // to hold the [sqlite3_file] structure passed as the third
  5479  // argument to xOpen.  The xOpen method does not have to
  5480  // allocate the structure; it should just fill it in.  Note that
  5481  // the xOpen method must set the sqlite3_file.pMethods to either
  5482  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  5483  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  5484  // element will be valid after xOpen returns regardless of the success
  5485  // or failure of the xOpen call.
  5486  //
  5487  // [[sqlite3_vfs.xAccess]]
  5488  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  5489  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  5490  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  5491  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  5492  // flag is never actually used and is not implemented in the built-in
  5493  // VFSes of SQLite.  The file is named by the second argument and can be a
  5494  // directory. The xAccess method returns [SQLITE_OK] on success or some
  5495  // non-zero error code if there is an I/O error or if the name of
  5496  // the file given in the second argument is illegal.  If SQLITE_OK
  5497  // is returned, then non-zero or zero is written into *pResOut to indicate
  5498  // whether or not the file is accessible.
  5499  //
  5500  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  5501  // output buffer xFullPathname.  The exact size of the output buffer
  5502  // is also passed as a parameter to both  methods. If the output buffer
  5503  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  5504  // handled as a fatal error by SQLite, vfs implementations should endeavor
  5505  // to prevent this by setting mxPathname to a sufficiently large value.
  5506  //
  5507  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  5508  // interfaces are not strictly a part of the filesystem, but they are
  5509  // included in the VFS structure for completeness.
  5510  // The xRandomness() function attempts to return nBytes bytes
  5511  // of good-quality randomness into zOut.  The return value is
  5512  // the actual number of bytes of randomness obtained.
  5513  // The xSleep() method causes the calling thread to sleep for at
  5514  // least the number of microseconds given.  ^The xCurrentTime()
  5515  // method returns a Julian Day Number for the current date and time as
  5516  // a floating point value.
  5517  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  5518  // Day Number multiplied by 86400000 (the number of milliseconds in
  5519  // a 24-hour day).
  5520  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  5521  // date and time if that method is available (if iVersion is 2 or
  5522  // greater and the function pointer is not NULL) and will fall back
  5523  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  5524  //
  5525  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  5526  // are not used by the SQLite core.  These optional interfaces are provided
  5527  // by some VFSes to facilitate testing of the VFS code. By overriding
  5528  // system calls with functions under its control, a test program can
  5529  // simulate faults and error conditions that would otherwise be difficult
  5530  // or impossible to induce.  The set of system calls that can be overridden
  5531  // varies from one VFS to another, and from one version of the same VFS to the
  5532  // next.  Applications that use these interfaces must be prepared for any
  5533  // or all of these interfaces to be NULL or for their behavior to change
  5534  // from one release to the next.  Applications must not attempt to access
  5535  // any of these methods if the iVersion of the VFS is less than 3.
  5536  type sqlite3_vfs1 = struct {
  5537  	FiVersion          int32
  5538  	FszOsFile          int32
  5539  	FmxPathname        int32
  5540  	FpNext             uintptr
  5541  	FzName             uintptr
  5542  	FpAppData          uintptr
  5543  	FxOpen             uintptr
  5544  	FxDelete           uintptr
  5545  	FxAccess           uintptr
  5546  	FxFullPathname     uintptr
  5547  	FxDlOpen           uintptr
  5548  	FxDlError          uintptr
  5549  	FxDlSym            uintptr
  5550  	FxDlClose          uintptr
  5551  	FxRandomness       uintptr
  5552  	FxSleep            uintptr
  5553  	FxCurrentTime      uintptr
  5554  	FxGetLastError     uintptr
  5555  	FxCurrentTimeInt64 uintptr
  5556  	FxSetSystemCall    uintptr
  5557  	FxGetSystemCall    uintptr
  5558  	FxNextSystemCall   uintptr
  5559  } /* sqlite3.h:1387:9 */
  5560  
  5561  // CAPI3REF: OS Interface Object
  5562  //
  5563  // An instance of the sqlite3_vfs object defines the interface between
  5564  // the SQLite core and the underlying operating system.  The "vfs"
  5565  // in the name of the object stands for "virtual file system".  See
  5566  // the [VFS | VFS documentation] for further information.
  5567  //
  5568  // The VFS interface is sometimes extended by adding new methods onto
  5569  // the end.  Each time such an extension occurs, the iVersion field
  5570  // is incremented.  The iVersion value started out as 1 in
  5571  // SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
  5572  // with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
  5573  // to 3 with SQLite [version 3.7.6] on [dateof:3.7.6].  Additional fields
  5574  // may be appended to the sqlite3_vfs object and the iVersion value
  5575  // may increase again in future versions of SQLite.
  5576  // Note that due to an oversight, the structure
  5577  // of the sqlite3_vfs object changed in the transition from
  5578  // SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
  5579  // and yet the iVersion field was not increased.
  5580  //
  5581  // The szOsFile field is the size of the subclassed [sqlite3_file]
  5582  // structure used by this VFS.  mxPathname is the maximum length of
  5583  // a pathname in this VFS.
  5584  //
  5585  // Registered sqlite3_vfs objects are kept on a linked list formed by
  5586  // the pNext pointer.  The [sqlite3_vfs_register()]
  5587  // and [sqlite3_vfs_unregister()] interfaces manage this list
  5588  // in a thread-safe way.  The [sqlite3_vfs_find()] interface
  5589  // searches the list.  Neither the application code nor the VFS
  5590  // implementation should use the pNext pointer.
  5591  //
  5592  // The pNext field is the only field in the sqlite3_vfs
  5593  // structure that SQLite will ever modify.  SQLite will only access
  5594  // or modify this field while holding a particular static mutex.
  5595  // The application should never modify anything within the sqlite3_vfs
  5596  // object once the object has been registered.
  5597  //
  5598  // The zName field holds the name of the VFS module.  The name must
  5599  // be unique across all VFS modules.
  5600  //
  5601  // [[sqlite3_vfs.xOpen]]
  5602  // ^SQLite guarantees that the zFilename parameter to xOpen
  5603  // is either a NULL pointer or string obtained
  5604  // from xFullPathname() with an optional suffix added.
  5605  // ^If a suffix is added to the zFilename parameter, it will
  5606  // consist of a single "-" character followed by no more than
  5607  // 11 alphanumeric and/or "-" characters.
  5608  // ^SQLite further guarantees that
  5609  // the string will be valid and unchanged until xClose() is
  5610  // called. Because of the previous sentence,
  5611  // the [sqlite3_file] can safely store a pointer to the
  5612  // filename if it needs to remember the filename for some reason.
  5613  // If the zFilename parameter to xOpen is a NULL pointer then xOpen
  5614  // must invent its own temporary name for the file.  ^Whenever the
  5615  // xFilename parameter is NULL it will also be the case that the
  5616  // flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
  5617  //
  5618  // The flags argument to xOpen() includes all bits set in
  5619  // the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
  5620  // or [sqlite3_open16()] is used, then flags includes at least
  5621  // [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
  5622  // If xOpen() opens a file read-only then it sets *pOutFlags to
  5623  // include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
  5624  //
  5625  // ^(SQLite will also add one of the following flags to the xOpen()
  5626  // call, depending on the object being opened:
  5627  //
  5628  // <ul>
  5629  // <li>  [SQLITE_OPEN_MAIN_DB]
  5630  // <li>  [SQLITE_OPEN_MAIN_JOURNAL]
  5631  // <li>  [SQLITE_OPEN_TEMP_DB]
  5632  // <li>  [SQLITE_OPEN_TEMP_JOURNAL]
  5633  // <li>  [SQLITE_OPEN_TRANSIENT_DB]
  5634  // <li>  [SQLITE_OPEN_SUBJOURNAL]
  5635  // <li>  [SQLITE_OPEN_SUPER_JOURNAL]
  5636  // <li>  [SQLITE_OPEN_WAL]
  5637  // </ul>)^
  5638  //
  5639  // The file I/O implementation can use the object type flags to
  5640  // change the way it deals with files.  For example, an application
  5641  // that does not care about crash recovery or rollback might make
  5642  // the open of a journal file a no-op.  Writes to this journal would
  5643  // also be no-ops, and any attempt to read the journal would return
  5644  // SQLITE_IOERR.  Or the implementation might recognize that a database
  5645  // file will be doing page-aligned sector reads and writes in a random
  5646  // order and set up its I/O subsystem accordingly.
  5647  //
  5648  // SQLite might also add one of the following flags to the xOpen method:
  5649  //
  5650  // <ul>
  5651  // <li> [SQLITE_OPEN_DELETEONCLOSE]
  5652  // <li> [SQLITE_OPEN_EXCLUSIVE]
  5653  // </ul>
  5654  //
  5655  // The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
  5656  // deleted when it is closed.  ^The [SQLITE_OPEN_DELETEONCLOSE]
  5657  // will be set for TEMP databases and their journals, transient
  5658  // databases, and subjournals.
  5659  //
  5660  // ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
  5661  // with the [SQLITE_OPEN_CREATE] flag, which are both directly
  5662  // analogous to the O_EXCL and O_CREAT flags of the POSIX open()
  5663  // API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
  5664  // SQLITE_OPEN_CREATE, is used to indicate that file should always
  5665  // be created, and that it is an error if it already exists.
  5666  // It is <i>not</i> used to indicate the file should be opened
  5667  // for exclusive access.
  5668  //
  5669  // ^At least szOsFile bytes of memory are allocated by SQLite
  5670  // to hold the [sqlite3_file] structure passed as the third
  5671  // argument to xOpen.  The xOpen method does not have to
  5672  // allocate the structure; it should just fill it in.  Note that
  5673  // the xOpen method must set the sqlite3_file.pMethods to either
  5674  // a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
  5675  // this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
  5676  // element will be valid after xOpen returns regardless of the success
  5677  // or failure of the xOpen call.
  5678  //
  5679  // [[sqlite3_vfs.xAccess]]
  5680  // ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
  5681  // to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
  5682  // test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
  5683  // to test whether a file is at least readable.  The SQLITE_ACCESS_READ
  5684  // flag is never actually used and is not implemented in the built-in
  5685  // VFSes of SQLite.  The file is named by the second argument and can be a
  5686  // directory. The xAccess method returns [SQLITE_OK] on success or some
  5687  // non-zero error code if there is an I/O error or if the name of
  5688  // the file given in the second argument is illegal.  If SQLITE_OK
  5689  // is returned, then non-zero or zero is written into *pResOut to indicate
  5690  // whether or not the file is accessible.
  5691  //
  5692  // ^SQLite will always allocate at least mxPathname+1 bytes for the
  5693  // output buffer xFullPathname.  The exact size of the output buffer
  5694  // is also passed as a parameter to both  methods. If the output buffer
  5695  // is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
  5696  // handled as a fatal error by SQLite, vfs implementations should endeavor
  5697  // to prevent this by setting mxPathname to a sufficiently large value.
  5698  //
  5699  // The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
  5700  // interfaces are not strictly a part of the filesystem, but they are
  5701  // included in the VFS structure for completeness.
  5702  // The xRandomness() function attempts to return nBytes bytes
  5703  // of good-quality randomness into zOut.  The return value is
  5704  // the actual number of bytes of randomness obtained.
  5705  // The xSleep() method causes the calling thread to sleep for at
  5706  // least the number of microseconds given.  ^The xCurrentTime()
  5707  // method returns a Julian Day Number for the current date and time as
  5708  // a floating point value.
  5709  // ^The xCurrentTimeInt64() method returns, as an integer, the Julian
  5710  // Day Number multiplied by 86400000 (the number of milliseconds in
  5711  // a 24-hour day).
  5712  // ^SQLite will use the xCurrentTimeInt64() method to get the current
  5713  // date and time if that method is available (if iVersion is 2 or
  5714  // greater and the function pointer is not NULL) and will fall back
  5715  // to xCurrentTime() if xCurrentTimeInt64() is unavailable.
  5716  //
  5717  // ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
  5718  // are not used by the SQLite core.  These optional interfaces are provided
  5719  // by some VFSes to facilitate testing of the VFS code. By overriding
  5720  // system calls with functions under its control, a test program can
  5721  // simulate faults and error conditions that would otherwise be difficult
  5722  // or impossible to induce.  The set of system calls that can be overridden
  5723  // varies from one VFS to another, and from one version of the same VFS to the
  5724  // next.  Applications that use these interfaces must be prepared for any
  5725  // or all of these interfaces to be NULL or for their behavior to change
  5726  // from one release to the next.  Applications must not attempt to access
  5727  // any of these methods if the iVersion of the VFS is less than 3.
  5728  type sqlite3_vfs = sqlite3_vfs1    /* sqlite3.h:1387:28 */
  5729  type sqlite3_syscall_ptr = uintptr /* sqlite3.h:1388:14 */
  5730  
  5731  // CAPI3REF: Memory Allocation Routines
  5732  //
  5733  // An instance of this object defines the interface between SQLite
  5734  // and low-level memory allocation routines.
  5735  //
  5736  // This object is used in only one place in the SQLite interface.
  5737  // A pointer to an instance of this object is the argument to
  5738  // [sqlite3_config()] when the configuration option is
  5739  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  5740  // By creating an instance of this object
  5741  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  5742  // during configuration, an application can specify an alternative
  5743  // memory allocation subsystem for SQLite to use for all of its
  5744  // dynamic memory needs.
  5745  //
  5746  // Note that SQLite comes with several [built-in memory allocators]
  5747  // that are perfectly adequate for the overwhelming majority of applications
  5748  // and that this object is only useful to a tiny minority of applications
  5749  // with specialized memory allocation requirements.  This object is
  5750  // also used during testing of SQLite in order to specify an alternative
  5751  // memory allocator that simulates memory out-of-memory conditions in
  5752  // order to verify that SQLite recovers gracefully from such
  5753  // conditions.
  5754  //
  5755  // The xMalloc, xRealloc, and xFree methods must work like the
  5756  // malloc(), realloc() and free() functions from the standard C library.
  5757  // ^SQLite guarantees that the second argument to
  5758  // xRealloc is always a value returned by a prior call to xRoundup.
  5759  //
  5760  // xSize should return the allocated size of a memory allocation
  5761  // previously obtained from xMalloc or xRealloc.  The allocated size
  5762  // is always at least as big as the requested size but may be larger.
  5763  //
  5764  // The xRoundup method returns what would be the allocated size of
  5765  // a memory allocation given a particular requested size.  Most memory
  5766  // allocators round up memory allocations at least to the next multiple
  5767  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  5768  // Every memory allocation request coming in through [sqlite3_malloc()]
  5769  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  5770  // that causes the corresponding memory allocation to fail.
  5771  //
  5772  // The xInit method initializes the memory allocator.  For example,
  5773  // it might allocate any required mutexes or initialize internal data
  5774  // structures.  The xShutdown method is invoked (indirectly) by
  5775  // [sqlite3_shutdown()] and should deallocate any resources acquired
  5776  // by xInit.  The pAppData pointer is used as the only parameter to
  5777  // xInit and xShutdown.
  5778  //
  5779  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  5780  // the xInit method, so the xInit method need not be threadsafe.  The
  5781  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5782  // not need to be threadsafe either.  For all other methods, SQLite
  5783  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  5784  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  5785  // it is by default) and so the methods are automatically serialized.
  5786  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  5787  // methods must be threadsafe or else make their own arrangements for
  5788  // serialization.
  5789  //
  5790  // SQLite will never invoke xInit() more than once without an intervening
  5791  // call to xShutdown().
  5792  type sqlite3_mem_methods1 = struct {
  5793  	FxMalloc   uintptr
  5794  	FxFree     uintptr
  5795  	FxRealloc  uintptr
  5796  	FxSize     uintptr
  5797  	FxRoundup  uintptr
  5798  	FxInit     uintptr
  5799  	FxShutdown uintptr
  5800  	FpAppData  uintptr
  5801  } /* sqlite3.h:1685:9 */
  5802  
  5803  // CAPI3REF: Memory Allocation Routines
  5804  //
  5805  // An instance of this object defines the interface between SQLite
  5806  // and low-level memory allocation routines.
  5807  //
  5808  // This object is used in only one place in the SQLite interface.
  5809  // A pointer to an instance of this object is the argument to
  5810  // [sqlite3_config()] when the configuration option is
  5811  // [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
  5812  // By creating an instance of this object
  5813  // and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
  5814  // during configuration, an application can specify an alternative
  5815  // memory allocation subsystem for SQLite to use for all of its
  5816  // dynamic memory needs.
  5817  //
  5818  // Note that SQLite comes with several [built-in memory allocators]
  5819  // that are perfectly adequate for the overwhelming majority of applications
  5820  // and that this object is only useful to a tiny minority of applications
  5821  // with specialized memory allocation requirements.  This object is
  5822  // also used during testing of SQLite in order to specify an alternative
  5823  // memory allocator that simulates memory out-of-memory conditions in
  5824  // order to verify that SQLite recovers gracefully from such
  5825  // conditions.
  5826  //
  5827  // The xMalloc, xRealloc, and xFree methods must work like the
  5828  // malloc(), realloc() and free() functions from the standard C library.
  5829  // ^SQLite guarantees that the second argument to
  5830  // xRealloc is always a value returned by a prior call to xRoundup.
  5831  //
  5832  // xSize should return the allocated size of a memory allocation
  5833  // previously obtained from xMalloc or xRealloc.  The allocated size
  5834  // is always at least as big as the requested size but may be larger.
  5835  //
  5836  // The xRoundup method returns what would be the allocated size of
  5837  // a memory allocation given a particular requested size.  Most memory
  5838  // allocators round up memory allocations at least to the next multiple
  5839  // of 8.  Some allocators round up to a larger multiple or to a power of 2.
  5840  // Every memory allocation request coming in through [sqlite3_malloc()]
  5841  // or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0,
  5842  // that causes the corresponding memory allocation to fail.
  5843  //
  5844  // The xInit method initializes the memory allocator.  For example,
  5845  // it might allocate any required mutexes or initialize internal data
  5846  // structures.  The xShutdown method is invoked (indirectly) by
  5847  // [sqlite3_shutdown()] and should deallocate any resources acquired
  5848  // by xInit.  The pAppData pointer is used as the only parameter to
  5849  // xInit and xShutdown.
  5850  //
  5851  // SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
  5852  // the xInit method, so the xInit method need not be threadsafe.  The
  5853  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  5854  // not need to be threadsafe either.  For all other methods, SQLite
  5855  // holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
  5856  // [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
  5857  // it is by default) and so the methods are automatically serialized.
  5858  // However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
  5859  // methods must be threadsafe or else make their own arrangements for
  5860  // serialization.
  5861  //
  5862  // SQLite will never invoke xInit() more than once without an intervening
  5863  // call to xShutdown().
  5864  type sqlite3_mem_methods = sqlite3_mem_methods1 /* sqlite3.h:1685:36 */
  5865  
  5866  // CAPI3REF: Dynamically Typed Value Object
  5867  // KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
  5868  //
  5869  // SQLite uses the sqlite3_value object to represent all values
  5870  // that can be stored in a database table. SQLite uses dynamic typing
  5871  // for the values it stores.  ^Values stored in sqlite3_value objects
  5872  // can be integers, floating point values, strings, BLOBs, or NULL.
  5873  //
  5874  // An sqlite3_value object may be either "protected" or "unprotected".
  5875  // Some interfaces require a protected sqlite3_value.  Other interfaces
  5876  // will accept either a protected or an unprotected sqlite3_value.
  5877  // Every interface that accepts sqlite3_value arguments specifies
  5878  // whether or not it requires a protected sqlite3_value.  The
  5879  // [sqlite3_value_dup()] interface can be used to construct a new
  5880  // protected sqlite3_value from an unprotected sqlite3_value.
  5881  //
  5882  // The terms "protected" and "unprotected" refer to whether or not
  5883  // a mutex is held.  An internal mutex is held for a protected
  5884  // sqlite3_value object but no mutex is held for an unprotected
  5885  // sqlite3_value object.  If SQLite is compiled to be single-threaded
  5886  // (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
  5887  // or if SQLite is run in one of reduced mutex modes
  5888  // [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
  5889  // then there is no distinction between protected and unprotected
  5890  // sqlite3_value objects and they can be used interchangeably.  However,
  5891  // for maximum code portability it is recommended that applications
  5892  // still make the distinction between protected and unprotected
  5893  // sqlite3_value objects even when not strictly required.
  5894  //
  5895  // ^The sqlite3_value objects that are passed as parameters into the
  5896  // implementation of [application-defined SQL functions] are protected.
  5897  // ^The sqlite3_value object returned by
  5898  // [sqlite3_column_value()] is unprotected.
  5899  // Unprotected sqlite3_value objects may only be used as arguments
  5900  // to [sqlite3_result_value()], [sqlite3_bind_value()], and
  5901  // [sqlite3_value_dup()].
  5902  // The [sqlite3_value_blob | sqlite3_value_type()] family of
  5903  // interfaces require protected sqlite3_value objects.
  5904  type sqlite3_value1 = struct {
  5905  	Fu        struct{ Fr float64 }
  5906  	Fflags    u16
  5907  	Fenc      u8
  5908  	FeSubtype u8
  5909  	Fn        int32
  5910  	Fz        uintptr
  5911  	FzMalloc  uintptr
  5912  	FszMalloc int32
  5913  	FuTemp    u32
  5914  	Fdb       uintptr
  5915  	FxDel     uintptr
  5916  } /* sqlite3.h:249:9 */
  5917  
  5918  // CAPI3REF: SQL Function Context Object
  5919  //
  5920  // The context in which an SQL function executes is stored in an
  5921  // sqlite3_context object.  ^A pointer to an sqlite3_context object
  5922  // is always first parameter to [application-defined SQL functions].
  5923  // The application-defined SQL function implementation will pass this
  5924  // pointer through into calls to [sqlite3_result_int | sqlite3_result()],
  5925  // [sqlite3_aggregate_context()], [sqlite3_user_data()],
  5926  // [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
  5927  // and/or [sqlite3_set_auxdata()].
  5928  type sqlite3_context1 = struct {
  5929  	FpOut     uintptr
  5930  	FpFunc    uintptr
  5931  	FpMem     uintptr
  5932  	FpVdbe    uintptr
  5933  	FiOp      int32
  5934  	FisError  int32
  5935  	FskipFlag u8
  5936  	Fargc     u8
  5937  	_         [2]byte
  5938  	Fargv     [1]uintptr
  5939  } /* sqlite3.h:249:9 */
  5940  
  5941  // CAPI3REF: Constants Defining Special Destructor Behavior
  5942  //
  5943  // These are special values for the destructor that is passed in as the
  5944  // final argument to routines like [sqlite3_result_blob()].  ^If the destructor
  5945  // argument is SQLITE_STATIC, it means that the content pointer is constant
  5946  // and will never change.  It does not need to be destroyed.  ^The
  5947  // SQLITE_TRANSIENT value means that the content will likely change in
  5948  // the near future and that SQLite should make its own private copy of
  5949  // the content before returning.
  5950  //
  5951  // The typedef is necessary to work around problems in certain
  5952  // C++ compilers.
  5953  type sqlite3_destructor_type = uintptr /* sqlite3.h:5665:14 */
  5954  
  5955  // The interface to the virtual-table mechanism is currently considered
  5956  // to be experimental.  The interface might change in incompatible ways.
  5957  // If this is a problem for you, do not use the interface at this time.
  5958  //
  5959  // When the virtual-table mechanism stabilizes, we will declare the
  5960  // interface fixed, support it indefinitely, and remove this comment.
  5961  
  5962  // Structures used by the virtual table interface
  5963  type sqlite3_vtab1 = struct {
  5964  	FpModule uintptr
  5965  	FnRef    int32
  5966  	FzErrMsg uintptr
  5967  } /* sqlite3.h:6784:9 */
  5968  
  5969  // The interface to the virtual-table mechanism is currently considered
  5970  // to be experimental.  The interface might change in incompatible ways.
  5971  // If this is a problem for you, do not use the interface at this time.
  5972  //
  5973  // When the virtual-table mechanism stabilizes, we will declare the
  5974  // interface fixed, support it indefinitely, and remove this comment.
  5975  
  5976  // Structures used by the virtual table interface
  5977  type sqlite3_vtab = sqlite3_vtab1 /* sqlite3.h:6784:29 */
  5978  type sqlite3_index_info1 = struct {
  5979  	FnConstraint      int32
  5980  	FaConstraint      uintptr
  5981  	FnOrderBy         int32
  5982  	FaOrderBy         uintptr
  5983  	FaConstraintUsage uintptr
  5984  	FidxNum           int32
  5985  	FidxStr           uintptr
  5986  	FneedToFreeIdxStr int32
  5987  	ForderByConsumed  int32
  5988  	_                 [4]byte
  5989  	FestimatedCost    float64
  5990  	FestimatedRows    sqlite3_int64
  5991  	FidxFlags         int32
  5992  	_                 [4]byte
  5993  	FcolUsed          sqlite3_uint64
  5994  } /* sqlite3.h:6785:9 */
  5995  
  5996  type sqlite3_index_info = sqlite3_index_info1        /* sqlite3.h:6785:35 */
  5997  type sqlite3_vtab_cursor1 = struct{ FpVtab uintptr } /* sqlite3.h:6786:9 */
  5998  
  5999  type sqlite3_vtab_cursor = sqlite3_vtab_cursor1 /* sqlite3.h:6786:36 */
  6000  type sqlite3_module1 = struct {
  6001  	FiVersion      int32
  6002  	FxCreate       uintptr
  6003  	FxConnect      uintptr
  6004  	FxBestIndex    uintptr
  6005  	FxDisconnect   uintptr
  6006  	FxDestroy      uintptr
  6007  	FxOpen         uintptr
  6008  	FxClose        uintptr
  6009  	FxFilter       uintptr
  6010  	FxNext         uintptr
  6011  	FxEof          uintptr
  6012  	FxColumn       uintptr
  6013  	FxRowid        uintptr
  6014  	FxUpdate       uintptr
  6015  	FxBegin        uintptr
  6016  	FxSync         uintptr
  6017  	FxCommit       uintptr
  6018  	FxRollback     uintptr
  6019  	FxFindFunction uintptr
  6020  	FxRename       uintptr
  6021  	FxSavepoint    uintptr
  6022  	FxRelease      uintptr
  6023  	FxRollbackTo   uintptr
  6024  	FxShadowName   uintptr
  6025  } /* sqlite3.h:6784:9 */
  6026  
  6027  type sqlite3_module = sqlite3_module1 /* sqlite3.h:6787:31 */
  6028  
  6029  // CAPI3REF: Virtual Table Indexing Information
  6030  // KEYWORDS: sqlite3_index_info
  6031  //
  6032  // The sqlite3_index_info structure and its substructures is used as part
  6033  // of the [virtual table] interface to
  6034  // pass information into and receive the reply from the [xBestIndex]
  6035  // method of a [virtual table module].  The fields under **Inputs** are the
  6036  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  6037  // results into the **Outputs** fields.
  6038  //
  6039  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  6040  //
  6041  // <blockquote>column OP expr</blockquote>
  6042  //
  6043  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  6044  // stored in aConstraint[].op using one of the
  6045  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  6046  // ^(The index of the column is stored in
  6047  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  6048  // expr on the right-hand side can be evaluated (and thus the constraint
  6049  // is usable) and false if it cannot.)^
  6050  //
  6051  // ^The optimizer automatically inverts terms of the form "expr OP column"
  6052  // and makes other simplifications to the WHERE clause in an attempt to
  6053  // get as many WHERE clause terms into the form shown above as possible.
  6054  // ^The aConstraint[] array only reports WHERE clause terms that are
  6055  // relevant to the particular virtual table being queried.
  6056  //
  6057  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  6058  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  6059  //
  6060  // The colUsed field indicates which columns of the virtual table may be
  6061  // required by the current scan. Virtual table columns are numbered from
  6062  // zero in the order in which they appear within the CREATE TABLE statement
  6063  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  6064  // the corresponding bit is set within the colUsed mask if the column may be
  6065  // required by SQLite. If the table has at least 64 columns and any column
  6066  // to the right of the first 63 is required, then bit 63 of colUsed is also
  6067  // set. In other words, column iCol may be required if the expression
  6068  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  6069  // non-zero.
  6070  //
  6071  // The [xBestIndex] method must fill aConstraintUsage[] with information
  6072  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  6073  // the right-hand side of the corresponding aConstraint[] is evaluated
  6074  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  6075  // is true, then the constraint is assumed to be fully handled by the
  6076  // virtual table and might not be checked again by the byte code.)^ ^(The
  6077  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  6078  // is left in its default setting of false, the constraint will always be
  6079  // checked separately in byte code.  If the omit flag is change to true, then
  6080  // the constraint may or may not be checked in byte code.  In other words,
  6081  // when the omit flag is true there is no guarantee that the constraint will
  6082  // not be checked again using byte code.)^
  6083  //
  6084  // ^The idxNum and idxPtr values are recorded and passed into the
  6085  // [xFilter] method.
  6086  // ^[sqlite3_free()] is used to free idxPtr if and only if
  6087  // needToFreeIdxPtr is true.
  6088  //
  6089  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  6090  // the correct order to satisfy the ORDER BY clause so that no separate
  6091  // sorting step is required.
  6092  //
  6093  // ^The estimatedCost value is an estimate of the cost of a particular
  6094  // strategy. A cost of N indicates that the cost of the strategy is similar
  6095  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  6096  // indicates that the expense of the operation is similar to that of a
  6097  // binary search on a unique indexed field of an SQLite table with N rows.
  6098  //
  6099  // ^The estimatedRows value is an estimate of the number of rows that
  6100  // will be returned by the strategy.
  6101  //
  6102  // The xBestIndex method may optionally populate the idxFlags field with a
  6103  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  6104  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  6105  // assumes that the strategy may visit at most one row.
  6106  //
  6107  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  6108  // SQLite also assumes that if a call to the xUpdate() method is made as
  6109  // part of the same statement to delete or update a virtual table row and the
  6110  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  6111  // any database changes. In other words, if the xUpdate() returns
  6112  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  6113  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  6114  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  6115  // the xUpdate method are automatically rolled back by SQLite.
  6116  //
  6117  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  6118  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  6119  // If a virtual table extension is
  6120  // used with an SQLite version earlier than 3.8.2, the results of attempting
  6121  // to read or write the estimatedRows field are undefined (but are likely
  6122  // to include crashing the application). The estimatedRows field should
  6123  // therefore only be used if [sqlite3_libversion_number()] returns a
  6124  // value greater than or equal to 3008002. Similarly, the idxFlags field
  6125  // was added for [version 3.9.0] ([dateof:3.9.0]).
  6126  // It may therefore only be used if
  6127  // sqlite3_libversion_number() returns a value greater than or equal to
  6128  // 3009000.
  6129  type sqlite3_index_constraint = struct {
  6130  	FiColumn     int32
  6131  	Fop          uint8
  6132  	Fusable      uint8
  6133  	_            [2]byte
  6134  	FiTermOffset int32
  6135  } /* sqlite3.h:6785:9 */
  6136  
  6137  // CAPI3REF: Virtual Table Indexing Information
  6138  // KEYWORDS: sqlite3_index_info
  6139  //
  6140  // The sqlite3_index_info structure and its substructures is used as part
  6141  // of the [virtual table] interface to
  6142  // pass information into and receive the reply from the [xBestIndex]
  6143  // method of a [virtual table module].  The fields under **Inputs** are the
  6144  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  6145  // results into the **Outputs** fields.
  6146  //
  6147  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  6148  //
  6149  // <blockquote>column OP expr</blockquote>
  6150  //
  6151  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  6152  // stored in aConstraint[].op using one of the
  6153  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  6154  // ^(The index of the column is stored in
  6155  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  6156  // expr on the right-hand side can be evaluated (and thus the constraint
  6157  // is usable) and false if it cannot.)^
  6158  //
  6159  // ^The optimizer automatically inverts terms of the form "expr OP column"
  6160  // and makes other simplifications to the WHERE clause in an attempt to
  6161  // get as many WHERE clause terms into the form shown above as possible.
  6162  // ^The aConstraint[] array only reports WHERE clause terms that are
  6163  // relevant to the particular virtual table being queried.
  6164  //
  6165  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  6166  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  6167  //
  6168  // The colUsed field indicates which columns of the virtual table may be
  6169  // required by the current scan. Virtual table columns are numbered from
  6170  // zero in the order in which they appear within the CREATE TABLE statement
  6171  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  6172  // the corresponding bit is set within the colUsed mask if the column may be
  6173  // required by SQLite. If the table has at least 64 columns and any column
  6174  // to the right of the first 63 is required, then bit 63 of colUsed is also
  6175  // set. In other words, column iCol may be required if the expression
  6176  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  6177  // non-zero.
  6178  //
  6179  // The [xBestIndex] method must fill aConstraintUsage[] with information
  6180  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  6181  // the right-hand side of the corresponding aConstraint[] is evaluated
  6182  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  6183  // is true, then the constraint is assumed to be fully handled by the
  6184  // virtual table and might not be checked again by the byte code.)^ ^(The
  6185  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  6186  // is left in its default setting of false, the constraint will always be
  6187  // checked separately in byte code.  If the omit flag is change to true, then
  6188  // the constraint may or may not be checked in byte code.  In other words,
  6189  // when the omit flag is true there is no guarantee that the constraint will
  6190  // not be checked again using byte code.)^
  6191  //
  6192  // ^The idxNum and idxPtr values are recorded and passed into the
  6193  // [xFilter] method.
  6194  // ^[sqlite3_free()] is used to free idxPtr if and only if
  6195  // needToFreeIdxPtr is true.
  6196  //
  6197  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  6198  // the correct order to satisfy the ORDER BY clause so that no separate
  6199  // sorting step is required.
  6200  //
  6201  // ^The estimatedCost value is an estimate of the cost of a particular
  6202  // strategy. A cost of N indicates that the cost of the strategy is similar
  6203  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  6204  // indicates that the expense of the operation is similar to that of a
  6205  // binary search on a unique indexed field of an SQLite table with N rows.
  6206  //
  6207  // ^The estimatedRows value is an estimate of the number of rows that
  6208  // will be returned by the strategy.
  6209  //
  6210  // The xBestIndex method may optionally populate the idxFlags field with a
  6211  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  6212  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  6213  // assumes that the strategy may visit at most one row.
  6214  //
  6215  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  6216  // SQLite also assumes that if a call to the xUpdate() method is made as
  6217  // part of the same statement to delete or update a virtual table row and the
  6218  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  6219  // any database changes. In other words, if the xUpdate() returns
  6220  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  6221  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  6222  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  6223  // the xUpdate method are automatically rolled back by SQLite.
  6224  //
  6225  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  6226  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  6227  // If a virtual table extension is
  6228  // used with an SQLite version earlier than 3.8.2, the results of attempting
  6229  // to read or write the estimatedRows field are undefined (but are likely
  6230  // to include crashing the application). The estimatedRows field should
  6231  // therefore only be used if [sqlite3_libversion_number()] returns a
  6232  // value greater than or equal to 3008002. Similarly, the idxFlags field
  6233  // was added for [version 3.9.0] ([dateof:3.9.0]).
  6234  // It may therefore only be used if
  6235  // sqlite3_libversion_number() returns a value greater than or equal to
  6236  // 3009000.
  6237  type sqlite3_index_orderby = struct {
  6238  	FiColumn int32
  6239  	Fdesc    uint8
  6240  	_        [3]byte
  6241  } /* sqlite3.h:6785:9 */
  6242  
  6243  // CAPI3REF: Virtual Table Indexing Information
  6244  // KEYWORDS: sqlite3_index_info
  6245  //
  6246  // The sqlite3_index_info structure and its substructures is used as part
  6247  // of the [virtual table] interface to
  6248  // pass information into and receive the reply from the [xBestIndex]
  6249  // method of a [virtual table module].  The fields under **Inputs** are the
  6250  // inputs to xBestIndex and are read-only.  xBestIndex inserts its
  6251  // results into the **Outputs** fields.
  6252  //
  6253  // ^(The aConstraint[] array records WHERE clause constraints of the form:
  6254  //
  6255  // <blockquote>column OP expr</blockquote>
  6256  //
  6257  // where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
  6258  // stored in aConstraint[].op using one of the
  6259  // [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
  6260  // ^(The index of the column is stored in
  6261  // aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
  6262  // expr on the right-hand side can be evaluated (and thus the constraint
  6263  // is usable) and false if it cannot.)^
  6264  //
  6265  // ^The optimizer automatically inverts terms of the form "expr OP column"
  6266  // and makes other simplifications to the WHERE clause in an attempt to
  6267  // get as many WHERE clause terms into the form shown above as possible.
  6268  // ^The aConstraint[] array only reports WHERE clause terms that are
  6269  // relevant to the particular virtual table being queried.
  6270  //
  6271  // ^Information about the ORDER BY clause is stored in aOrderBy[].
  6272  // ^Each term of aOrderBy records a column of the ORDER BY clause.
  6273  //
  6274  // The colUsed field indicates which columns of the virtual table may be
  6275  // required by the current scan. Virtual table columns are numbered from
  6276  // zero in the order in which they appear within the CREATE TABLE statement
  6277  // passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
  6278  // the corresponding bit is set within the colUsed mask if the column may be
  6279  // required by SQLite. If the table has at least 64 columns and any column
  6280  // to the right of the first 63 is required, then bit 63 of colUsed is also
  6281  // set. In other words, column iCol may be required if the expression
  6282  // (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
  6283  // non-zero.
  6284  //
  6285  // The [xBestIndex] method must fill aConstraintUsage[] with information
  6286  // about what parameters to pass to xFilter.  ^If argvIndex>0 then
  6287  // the right-hand side of the corresponding aConstraint[] is evaluated
  6288  // and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
  6289  // is true, then the constraint is assumed to be fully handled by the
  6290  // virtual table and might not be checked again by the byte code.)^ ^(The
  6291  // aConstraintUsage[].omit flag is an optimization hint. When the omit flag
  6292  // is left in its default setting of false, the constraint will always be
  6293  // checked separately in byte code.  If the omit flag is change to true, then
  6294  // the constraint may or may not be checked in byte code.  In other words,
  6295  // when the omit flag is true there is no guarantee that the constraint will
  6296  // not be checked again using byte code.)^
  6297  //
  6298  // ^The idxNum and idxPtr values are recorded and passed into the
  6299  // [xFilter] method.
  6300  // ^[sqlite3_free()] is used to free idxPtr if and only if
  6301  // needToFreeIdxPtr is true.
  6302  //
  6303  // ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
  6304  // the correct order to satisfy the ORDER BY clause so that no separate
  6305  // sorting step is required.
  6306  //
  6307  // ^The estimatedCost value is an estimate of the cost of a particular
  6308  // strategy. A cost of N indicates that the cost of the strategy is similar
  6309  // to a linear scan of an SQLite table with N rows. A cost of log(N)
  6310  // indicates that the expense of the operation is similar to that of a
  6311  // binary search on a unique indexed field of an SQLite table with N rows.
  6312  //
  6313  // ^The estimatedRows value is an estimate of the number of rows that
  6314  // will be returned by the strategy.
  6315  //
  6316  // The xBestIndex method may optionally populate the idxFlags field with a
  6317  // mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
  6318  // SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
  6319  // assumes that the strategy may visit at most one row.
  6320  //
  6321  // Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
  6322  // SQLite also assumes that if a call to the xUpdate() method is made as
  6323  // part of the same statement to delete or update a virtual table row and the
  6324  // implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
  6325  // any database changes. In other words, if the xUpdate() returns
  6326  // SQLITE_CONSTRAINT, the database contents must be exactly as they were
  6327  // before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
  6328  // set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
  6329  // the xUpdate method are automatically rolled back by SQLite.
  6330  //
  6331  // IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
  6332  // structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
  6333  // If a virtual table extension is
  6334  // used with an SQLite version earlier than 3.8.2, the results of attempting
  6335  // to read or write the estimatedRows field are undefined (but are likely
  6336  // to include crashing the application). The estimatedRows field should
  6337  // therefore only be used if [sqlite3_libversion_number()] returns a
  6338  // value greater than or equal to 3008002. Similarly, the idxFlags field
  6339  // was added for [version 3.9.0] ([dateof:3.9.0]).
  6340  // It may therefore only be used if
  6341  // sqlite3_libversion_number() returns a value greater than or equal to
  6342  // 3009000.
  6343  type sqlite3_index_constraint_usage = struct {
  6344  	FargvIndex int32
  6345  	Fomit      uint8
  6346  	_          [3]byte
  6347  } /* sqlite3.h:6785:9 */
  6348  
  6349  // CAPI3REF: Mutex Methods Object
  6350  //
  6351  // An instance of this structure defines the low-level routines
  6352  // used to allocate and use mutexes.
  6353  //
  6354  // Usually, the default mutex implementations provided by SQLite are
  6355  // sufficient, however the application has the option of substituting a custom
  6356  // implementation for specialized deployments or systems for which SQLite
  6357  // does not provide a suitable implementation. In this case, the application
  6358  // creates and populates an instance of this structure to pass
  6359  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  6360  // Additionally, an instance of this structure can be used as an
  6361  // output variable when querying the system for the current mutex
  6362  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  6363  //
  6364  // ^The xMutexInit method defined by this structure is invoked as
  6365  // part of system initialization by the sqlite3_initialize() function.
  6366  // ^The xMutexInit routine is called by SQLite exactly once for each
  6367  // effective call to [sqlite3_initialize()].
  6368  //
  6369  // ^The xMutexEnd method defined by this structure is invoked as
  6370  // part of system shutdown by the sqlite3_shutdown() function. The
  6371  // implementation of this method is expected to release all outstanding
  6372  // resources obtained by the mutex methods implementation, especially
  6373  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  6374  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  6375  //
  6376  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  6377  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  6378  // xMutexNotheld) implement the following interfaces (respectively):
  6379  //
  6380  // <ul>
  6381  //   <li>  [sqlite3_mutex_alloc()] </li>
  6382  //   <li>  [sqlite3_mutex_free()] </li>
  6383  //   <li>  [sqlite3_mutex_enter()] </li>
  6384  //   <li>  [sqlite3_mutex_try()] </li>
  6385  //   <li>  [sqlite3_mutex_leave()] </li>
  6386  //   <li>  [sqlite3_mutex_held()] </li>
  6387  //   <li>  [sqlite3_mutex_notheld()] </li>
  6388  // </ul>)^
  6389  //
  6390  // The only difference is that the public sqlite3_XXX functions enumerated
  6391  // above silently ignore any invocations that pass a NULL pointer instead
  6392  // of a valid mutex handle. The implementations of the methods defined
  6393  // by this structure are not required to handle this case. The results
  6394  // of passing a NULL pointer instead of a valid mutex handle are undefined
  6395  // (i.e. it is acceptable to provide an implementation that segfaults if
  6396  // it is passed a NULL pointer).
  6397  //
  6398  // The xMutexInit() method must be threadsafe.  It must be harmless to
  6399  // invoke xMutexInit() multiple times within the same process and without
  6400  // intervening calls to xMutexEnd().  Second and subsequent calls to
  6401  // xMutexInit() must be no-ops.
  6402  //
  6403  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  6404  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  6405  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  6406  // memory allocation for a fast or recursive mutex.
  6407  //
  6408  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  6409  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  6410  // If xMutexInit fails in any way, it is expected to clean up after itself
  6411  // prior to returning.
  6412  type sqlite3_mutex_methods1 = struct {
  6413  	FxMutexInit    uintptr
  6414  	FxMutexEnd     uintptr
  6415  	FxMutexAlloc   uintptr
  6416  	FxMutexFree    uintptr
  6417  	FxMutexEnter   uintptr
  6418  	FxMutexTry     uintptr
  6419  	FxMutexLeave   uintptr
  6420  	FxMutexHeld    uintptr
  6421  	FxMutexNotheld uintptr
  6422  } /* sqlite3.h:7619:9 */
  6423  
  6424  // CAPI3REF: Mutex Methods Object
  6425  //
  6426  // An instance of this structure defines the low-level routines
  6427  // used to allocate and use mutexes.
  6428  //
  6429  // Usually, the default mutex implementations provided by SQLite are
  6430  // sufficient, however the application has the option of substituting a custom
  6431  // implementation for specialized deployments or systems for which SQLite
  6432  // does not provide a suitable implementation. In this case, the application
  6433  // creates and populates an instance of this structure to pass
  6434  // to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
  6435  // Additionally, an instance of this structure can be used as an
  6436  // output variable when querying the system for the current mutex
  6437  // implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
  6438  //
  6439  // ^The xMutexInit method defined by this structure is invoked as
  6440  // part of system initialization by the sqlite3_initialize() function.
  6441  // ^The xMutexInit routine is called by SQLite exactly once for each
  6442  // effective call to [sqlite3_initialize()].
  6443  //
  6444  // ^The xMutexEnd method defined by this structure is invoked as
  6445  // part of system shutdown by the sqlite3_shutdown() function. The
  6446  // implementation of this method is expected to release all outstanding
  6447  // resources obtained by the mutex methods implementation, especially
  6448  // those obtained by the xMutexInit method.  ^The xMutexEnd()
  6449  // interface is invoked exactly once for each call to [sqlite3_shutdown()].
  6450  //
  6451  // ^(The remaining seven methods defined by this structure (xMutexAlloc,
  6452  // xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
  6453  // xMutexNotheld) implement the following interfaces (respectively):
  6454  //
  6455  // <ul>
  6456  //   <li>  [sqlite3_mutex_alloc()] </li>
  6457  //   <li>  [sqlite3_mutex_free()] </li>
  6458  //   <li>  [sqlite3_mutex_enter()] </li>
  6459  //   <li>  [sqlite3_mutex_try()] </li>
  6460  //   <li>  [sqlite3_mutex_leave()] </li>
  6461  //   <li>  [sqlite3_mutex_held()] </li>
  6462  //   <li>  [sqlite3_mutex_notheld()] </li>
  6463  // </ul>)^
  6464  //
  6465  // The only difference is that the public sqlite3_XXX functions enumerated
  6466  // above silently ignore any invocations that pass a NULL pointer instead
  6467  // of a valid mutex handle. The implementations of the methods defined
  6468  // by this structure are not required to handle this case. The results
  6469  // of passing a NULL pointer instead of a valid mutex handle are undefined
  6470  // (i.e. it is acceptable to provide an implementation that segfaults if
  6471  // it is passed a NULL pointer).
  6472  //
  6473  // The xMutexInit() method must be threadsafe.  It must be harmless to
  6474  // invoke xMutexInit() multiple times within the same process and without
  6475  // intervening calls to xMutexEnd().  Second and subsequent calls to
  6476  // xMutexInit() must be no-ops.
  6477  //
  6478  // xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
  6479  // and its associates).  Similarly, xMutexAlloc() must not use SQLite memory
  6480  // allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
  6481  // memory allocation for a fast or recursive mutex.
  6482  //
  6483  // ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
  6484  // called, but only if the prior call to xMutexInit returned SQLITE_OK.
  6485  // If xMutexInit fails in any way, it is expected to clean up after itself
  6486  // prior to returning.
  6487  type sqlite3_mutex_methods = sqlite3_mutex_methods1 /* sqlite3.h:7619:38 */
  6488  
  6489  // CAPI3REF: Dynamic String Object
  6490  // KEYWORDS: {dynamic string}
  6491  //
  6492  // An instance of the sqlite3_str object contains a dynamically-sized
  6493  // string under construction.
  6494  //
  6495  // The lifecycle of an sqlite3_str object is as follows:
  6496  // <ol>
  6497  // <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
  6498  // <li> ^Text is appended to the sqlite3_str object using various
  6499  // methods, such as [sqlite3_str_appendf()].
  6500  // <li> ^The sqlite3_str object is destroyed and the string it created
  6501  // is returned using the [sqlite3_str_finish()] interface.
  6502  // </ol>
  6503  type sqlite3_str1 = struct {
  6504  	Fdb          uintptr
  6505  	FzText       uintptr
  6506  	FnAlloc      u32
  6507  	FmxAlloc     u32
  6508  	FnChar       u32
  6509  	FaccError    u8
  6510  	FprintfFlags u8
  6511  	_            [2]byte
  6512  } /* sqlite3.h:7882:9 */
  6513  
  6514  // CAPI3REF: Custom Page Cache Object
  6515  //
  6516  // The sqlite3_pcache_page object represents a single page in the
  6517  // page cache.  The page cache will allocate instances of this
  6518  // object.  Various methods of the page cache use pointers to instances
  6519  // of this object as parameters or as their return value.
  6520  //
  6521  // See [sqlite3_pcache_methods2] for additional information.
  6522  type sqlite3_pcache_page1 = struct {
  6523  	FpBuf   uintptr
  6524  	FpExtra uintptr
  6525  } /* sqlite3.h:8375:9 */
  6526  
  6527  // CAPI3REF: Custom Page Cache Object
  6528  //
  6529  // The sqlite3_pcache_page object represents a single page in the
  6530  // page cache.  The page cache will allocate instances of this
  6531  // object.  Various methods of the page cache use pointers to instances
  6532  // of this object as parameters or as their return value.
  6533  //
  6534  // See [sqlite3_pcache_methods2] for additional information.
  6535  type sqlite3_pcache_page = sqlite3_pcache_page1 /* sqlite3.h:8375:36 */
  6536  
  6537  // CAPI3REF: Application Defined Page Cache.
  6538  // KEYWORDS: {page cache}
  6539  //
  6540  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  6541  // register an alternative page cache implementation by passing in an
  6542  // instance of the sqlite3_pcache_methods2 structure.)^
  6543  // In many applications, most of the heap memory allocated by
  6544  // SQLite is used for the page cache.
  6545  // By implementing a
  6546  // custom page cache using this API, an application can better control
  6547  // the amount of memory consumed by SQLite, the way in which
  6548  // that memory is allocated and released, and the policies used to
  6549  // determine exactly which parts of a database file are cached and for
  6550  // how long.
  6551  //
  6552  // The alternative page cache mechanism is an
  6553  // extreme measure that is only needed by the most demanding applications.
  6554  // The built-in page cache is recommended for most uses.
  6555  //
  6556  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  6557  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  6558  // the application may discard the parameter after the call to
  6559  // [sqlite3_config()] returns.)^
  6560  //
  6561  // [[the xInit() page cache method]]
  6562  // ^(The xInit() method is called once for each effective
  6563  // call to [sqlite3_initialize()])^
  6564  // (usually only once during the lifetime of the process). ^(The xInit()
  6565  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  6566  // The intent of the xInit() method is to set up global data structures
  6567  // required by the custom page cache implementation.
  6568  // ^(If the xInit() method is NULL, then the
  6569  // built-in default page cache is used instead of the application defined
  6570  // page cache.)^
  6571  //
  6572  // [[the xShutdown() page cache method]]
  6573  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  6574  // It can be used to clean up
  6575  // any outstanding resources before process shutdown, if required.
  6576  // ^The xShutdown() method may be NULL.
  6577  //
  6578  // ^SQLite automatically serializes calls to the xInit method,
  6579  // so the xInit method need not be threadsafe.  ^The
  6580  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  6581  // not need to be threadsafe either.  All other methods must be threadsafe
  6582  // in multithreaded applications.
  6583  //
  6584  // ^SQLite will never invoke xInit() more than once without an intervening
  6585  // call to xShutdown().
  6586  //
  6587  // [[the xCreate() page cache methods]]
  6588  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  6589  // SQLite will typically create one cache instance for each open database file,
  6590  // though this is not guaranteed. ^The
  6591  // first parameter, szPage, is the size in bytes of the pages that must
  6592  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  6593  // second parameter szExtra is a number of bytes of extra storage
  6594  // associated with each page cache entry.  ^The szExtra parameter will
  6595  // a number less than 250.  SQLite will use the
  6596  // extra szExtra bytes on each page to store metadata about the underlying
  6597  // database page on disk.  The value passed into szExtra depends
  6598  // on the SQLite version, the target platform, and how SQLite was compiled.
  6599  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  6600  // created will be used to cache database pages of a file stored on disk, or
  6601  // false if it is used for an in-memory database. The cache implementation
  6602  // does not have to do anything special based with the value of bPurgeable;
  6603  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  6604  // never invoke xUnpin() except to deliberately delete a page.
  6605  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  6606  // false will always have the "discard" flag set to true.
  6607  // ^Hence, a cache created with bPurgeable false will
  6608  // never contain any unpinned pages.
  6609  //
  6610  // [[the xCachesize() page cache method]]
  6611  // ^(The xCachesize() method may be called at any time by SQLite to set the
  6612  // suggested maximum cache-size (number of pages stored by) the cache
  6613  // instance passed as the first argument. This is the value configured using
  6614  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  6615  // parameter, the implementation is not required to do anything with this
  6616  // value; it is advisory only.
  6617  //
  6618  // [[the xPagecount() page cache methods]]
  6619  // The xPagecount() method must return the number of pages currently
  6620  // stored in the cache, both pinned and unpinned.
  6621  //
  6622  // [[the xFetch() page cache methods]]
  6623  // The xFetch() method locates a page in the cache and returns a pointer to
  6624  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  6625  // The pBuf element of the returned sqlite3_pcache_page object will be a
  6626  // pointer to a buffer of szPage bytes used to store the content of a
  6627  // single database page.  The pExtra element of sqlite3_pcache_page will be
  6628  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  6629  // for each entry in the page cache.
  6630  //
  6631  // The page to be fetched is determined by the key. ^The minimum key value
  6632  // is 1.  After it has been retrieved using xFetch, the page is considered
  6633  // to be "pinned".
  6634  //
  6635  // If the requested page is already in the page cache, then the page cache
  6636  // implementation must return a pointer to the page buffer with its content
  6637  // intact.  If the requested page is not already in the cache, then the
  6638  // cache implementation should use the value of the createFlag
  6639  // parameter to help it determined what action to take:
  6640  //
  6641  // <table border=1 width=85% align=center>
  6642  // <tr><th> createFlag <th> Behavior when page is not already in cache
  6643  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  6644  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  6645  //                 Otherwise return NULL.
  6646  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  6647  //                 NULL if allocating a new page is effectively impossible.
  6648  // </table>
  6649  //
  6650  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  6651  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  6652  // failed.)^  In between the xFetch() calls, SQLite may
  6653  // attempt to unpin one or more cache pages by spilling the content of
  6654  // pinned pages to disk and synching the operating system disk cache.
  6655  //
  6656  // [[the xUnpin() page cache method]]
  6657  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  6658  // as its second argument.  If the third parameter, discard, is non-zero,
  6659  // then the page must be evicted from the cache.
  6660  // ^If the discard parameter is
  6661  // zero, then the page may be discarded or retained at the discretion of
  6662  // page cache implementation. ^The page cache implementation
  6663  // may choose to evict unpinned pages at any time.
  6664  //
  6665  // The cache must not perform any reference counting. A single
  6666  // call to xUnpin() unpins the page regardless of the number of prior calls
  6667  // to xFetch().
  6668  //
  6669  // [[the xRekey() page cache methods]]
  6670  // The xRekey() method is used to change the key value associated with the
  6671  // page passed as the second argument. If the cache
  6672  // previously contains an entry associated with newKey, it must be
  6673  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  6674  // to be pinned.
  6675  //
  6676  // When SQLite calls the xTruncate() method, the cache must discard all
  6677  // existing cache entries with page numbers (keys) greater than or equal
  6678  // to the value of the iLimit parameter passed to xTruncate(). If any
  6679  // of these pages are pinned, they are implicitly unpinned, meaning that
  6680  // they can be safely discarded.
  6681  //
  6682  // [[the xDestroy() page cache method]]
  6683  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  6684  // All resources associated with the specified cache should be freed. ^After
  6685  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  6686  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  6687  // functions.
  6688  //
  6689  // [[the xShrink() page cache method]]
  6690  // ^SQLite invokes the xShrink() method when it wants the page cache to
  6691  // free up as much of heap memory as possible.  The page cache implementation
  6692  // is not obligated to free any memory, but well-behaved implementations should
  6693  // do their best.
  6694  type sqlite3_pcache_methods21 = struct {
  6695  	FiVersion   int32
  6696  	FpArg       uintptr
  6697  	FxInit      uintptr
  6698  	FxShutdown  uintptr
  6699  	FxCreate    uintptr
  6700  	FxCachesize uintptr
  6701  	FxPagecount uintptr
  6702  	FxFetch     uintptr
  6703  	FxUnpin     uintptr
  6704  	FxRekey     uintptr
  6705  	FxTruncate  uintptr
  6706  	FxDestroy   uintptr
  6707  	FxShrink    uintptr
  6708  } /* sqlite3.h:8540:9 */
  6709  
  6710  // CAPI3REF: Application Defined Page Cache.
  6711  // KEYWORDS: {page cache}
  6712  //
  6713  // ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
  6714  // register an alternative page cache implementation by passing in an
  6715  // instance of the sqlite3_pcache_methods2 structure.)^
  6716  // In many applications, most of the heap memory allocated by
  6717  // SQLite is used for the page cache.
  6718  // By implementing a
  6719  // custom page cache using this API, an application can better control
  6720  // the amount of memory consumed by SQLite, the way in which
  6721  // that memory is allocated and released, and the policies used to
  6722  // determine exactly which parts of a database file are cached and for
  6723  // how long.
  6724  //
  6725  // The alternative page cache mechanism is an
  6726  // extreme measure that is only needed by the most demanding applications.
  6727  // The built-in page cache is recommended for most uses.
  6728  //
  6729  // ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
  6730  // internal buffer by SQLite within the call to [sqlite3_config].  Hence
  6731  // the application may discard the parameter after the call to
  6732  // [sqlite3_config()] returns.)^
  6733  //
  6734  // [[the xInit() page cache method]]
  6735  // ^(The xInit() method is called once for each effective
  6736  // call to [sqlite3_initialize()])^
  6737  // (usually only once during the lifetime of the process). ^(The xInit()
  6738  // method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
  6739  // The intent of the xInit() method is to set up global data structures
  6740  // required by the custom page cache implementation.
  6741  // ^(If the xInit() method is NULL, then the
  6742  // built-in default page cache is used instead of the application defined
  6743  // page cache.)^
  6744  //
  6745  // [[the xShutdown() page cache method]]
  6746  // ^The xShutdown() method is called by [sqlite3_shutdown()].
  6747  // It can be used to clean up
  6748  // any outstanding resources before process shutdown, if required.
  6749  // ^The xShutdown() method may be NULL.
  6750  //
  6751  // ^SQLite automatically serializes calls to the xInit method,
  6752  // so the xInit method need not be threadsafe.  ^The
  6753  // xShutdown method is only called from [sqlite3_shutdown()] so it does
  6754  // not need to be threadsafe either.  All other methods must be threadsafe
  6755  // in multithreaded applications.
  6756  //
  6757  // ^SQLite will never invoke xInit() more than once without an intervening
  6758  // call to xShutdown().
  6759  //
  6760  // [[the xCreate() page cache methods]]
  6761  // ^SQLite invokes the xCreate() method to construct a new cache instance.
  6762  // SQLite will typically create one cache instance for each open database file,
  6763  // though this is not guaranteed. ^The
  6764  // first parameter, szPage, is the size in bytes of the pages that must
  6765  // be allocated by the cache.  ^szPage will always a power of two.  ^The
  6766  // second parameter szExtra is a number of bytes of extra storage
  6767  // associated with each page cache entry.  ^The szExtra parameter will
  6768  // a number less than 250.  SQLite will use the
  6769  // extra szExtra bytes on each page to store metadata about the underlying
  6770  // database page on disk.  The value passed into szExtra depends
  6771  // on the SQLite version, the target platform, and how SQLite was compiled.
  6772  // ^The third argument to xCreate(), bPurgeable, is true if the cache being
  6773  // created will be used to cache database pages of a file stored on disk, or
  6774  // false if it is used for an in-memory database. The cache implementation
  6775  // does not have to do anything special based with the value of bPurgeable;
  6776  // it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
  6777  // never invoke xUnpin() except to deliberately delete a page.
  6778  // ^In other words, calls to xUnpin() on a cache with bPurgeable set to
  6779  // false will always have the "discard" flag set to true.
  6780  // ^Hence, a cache created with bPurgeable false will
  6781  // never contain any unpinned pages.
  6782  //
  6783  // [[the xCachesize() page cache method]]
  6784  // ^(The xCachesize() method may be called at any time by SQLite to set the
  6785  // suggested maximum cache-size (number of pages stored by) the cache
  6786  // instance passed as the first argument. This is the value configured using
  6787  // the SQLite "[PRAGMA cache_size]" command.)^  As with the bPurgeable
  6788  // parameter, the implementation is not required to do anything with this
  6789  // value; it is advisory only.
  6790  //
  6791  // [[the xPagecount() page cache methods]]
  6792  // The xPagecount() method must return the number of pages currently
  6793  // stored in the cache, both pinned and unpinned.
  6794  //
  6795  // [[the xFetch() page cache methods]]
  6796  // The xFetch() method locates a page in the cache and returns a pointer to
  6797  // an sqlite3_pcache_page object associated with that page, or a NULL pointer.
  6798  // The pBuf element of the returned sqlite3_pcache_page object will be a
  6799  // pointer to a buffer of szPage bytes used to store the content of a
  6800  // single database page.  The pExtra element of sqlite3_pcache_page will be
  6801  // a pointer to the szExtra bytes of extra storage that SQLite has requested
  6802  // for each entry in the page cache.
  6803  //
  6804  // The page to be fetched is determined by the key. ^The minimum key value
  6805  // is 1.  After it has been retrieved using xFetch, the page is considered
  6806  // to be "pinned".
  6807  //
  6808  // If the requested page is already in the page cache, then the page cache
  6809  // implementation must return a pointer to the page buffer with its content
  6810  // intact.  If the requested page is not already in the cache, then the
  6811  // cache implementation should use the value of the createFlag
  6812  // parameter to help it determined what action to take:
  6813  //
  6814  // <table border=1 width=85% align=center>
  6815  // <tr><th> createFlag <th> Behavior when page is not already in cache
  6816  // <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
  6817  // <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
  6818  //                 Otherwise return NULL.
  6819  // <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
  6820  //                 NULL if allocating a new page is effectively impossible.
  6821  // </table>
  6822  //
  6823  // ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  SQLite
  6824  // will only use a createFlag of 2 after a prior call with a createFlag of 1
  6825  // failed.)^  In between the xFetch() calls, SQLite may
  6826  // attempt to unpin one or more cache pages by spilling the content of
  6827  // pinned pages to disk and synching the operating system disk cache.
  6828  //
  6829  // [[the xUnpin() page cache method]]
  6830  // ^xUnpin() is called by SQLite with a pointer to a currently pinned page
  6831  // as its second argument.  If the third parameter, discard, is non-zero,
  6832  // then the page must be evicted from the cache.
  6833  // ^If the discard parameter is
  6834  // zero, then the page may be discarded or retained at the discretion of
  6835  // page cache implementation. ^The page cache implementation
  6836  // may choose to evict unpinned pages at any time.
  6837  //
  6838  // The cache must not perform any reference counting. A single
  6839  // call to xUnpin() unpins the page regardless of the number of prior calls
  6840  // to xFetch().
  6841  //
  6842  // [[the xRekey() page cache methods]]
  6843  // The xRekey() method is used to change the key value associated with the
  6844  // page passed as the second argument. If the cache
  6845  // previously contains an entry associated with newKey, it must be
  6846  // discarded. ^Any prior cache entry associated with newKey is guaranteed not
  6847  // to be pinned.
  6848  //
  6849  // When SQLite calls the xTruncate() method, the cache must discard all
  6850  // existing cache entries with page numbers (keys) greater than or equal
  6851  // to the value of the iLimit parameter passed to xTruncate(). If any
  6852  // of these pages are pinned, they are implicitly unpinned, meaning that
  6853  // they can be safely discarded.
  6854  //
  6855  // [[the xDestroy() page cache method]]
  6856  // ^The xDestroy() method is used to delete a cache allocated by xCreate().
  6857  // All resources associated with the specified cache should be freed. ^After
  6858  // calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
  6859  // handle invalid, and will not use it with any other sqlite3_pcache_methods2
  6860  // functions.
  6861  //
  6862  // [[the xShrink() page cache method]]
  6863  // ^SQLite invokes the xShrink() method when it wants the page cache to
  6864  // free up as much of heap memory as possible.  The page cache implementation
  6865  // is not obligated to free any memory, but well-behaved implementations should
  6866  // do their best.
  6867  type sqlite3_pcache_methods2 = sqlite3_pcache_methods21 /* sqlite3.h:8540:40 */
  6868  
  6869  // This is the obsolete pcache_methods object that has now been replaced
  6870  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  6871  // retained in the header file for backwards compatibility only.
  6872  type sqlite3_pcache_methods1 = struct {
  6873  	FpArg       uintptr
  6874  	FxInit      uintptr
  6875  	FxShutdown  uintptr
  6876  	FxCreate    uintptr
  6877  	FxCachesize uintptr
  6878  	FxPagecount uintptr
  6879  	FxFetch     uintptr
  6880  	FxUnpin     uintptr
  6881  	FxRekey     uintptr
  6882  	FxTruncate  uintptr
  6883  	FxDestroy   uintptr
  6884  } /* sqlite3.h:8563:9 */
  6885  
  6886  // This is the obsolete pcache_methods object that has now been replaced
  6887  // by sqlite3_pcache_methods2.  This object is not used by SQLite.  It is
  6888  // retained in the header file for backwards compatibility only.
  6889  type sqlite3_pcache_methods = sqlite3_pcache_methods1 /* sqlite3.h:8563:39 */
  6890  
  6891  // CAPI3REF: Database Snapshot
  6892  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  6893  //
  6894  // An instance of the snapshot object records the state of a [WAL mode]
  6895  // database for some specific point in history.
  6896  //
  6897  // In [WAL mode], multiple [database connections] that are open on the
  6898  // same database file can each be reading a different historical version
  6899  // of the database file.  When a [database connection] begins a read
  6900  // transaction, that connection sees an unchanging copy of the database
  6901  // as it existed for the point in time when the transaction first started.
  6902  // Subsequent changes to the database from other connections are not seen
  6903  // by the reader until a new read transaction is started.
  6904  //
  6905  // The sqlite3_snapshot object records state information about an historical
  6906  // version of the database file so that it is possible to later open a new read
  6907  // transaction that sees that historical version of the database rather than
  6908  // the most recent version.
  6909  type sqlite3_snapshot1 = struct{ Fhidden [48]uint8 } /* sqlite3.h:9630:9 */
  6910  
  6911  // CAPI3REF: Database Snapshot
  6912  // KEYWORDS: {snapshot} {sqlite3_snapshot}
  6913  //
  6914  // An instance of the snapshot object records the state of a [WAL mode]
  6915  // database for some specific point in history.
  6916  //
  6917  // In [WAL mode], multiple [database connections] that are open on the
  6918  // same database file can each be reading a different historical version
  6919  // of the database file.  When a [database connection] begins a read
  6920  // transaction, that connection sees an unchanging copy of the database
  6921  // as it existed for the point in time when the transaction first started.
  6922  // Subsequent changes to the database from other connections are not seen
  6923  // by the reader until a new read transaction is started.
  6924  //
  6925  // The sqlite3_snapshot object records state information about an historical
  6926  // version of the database file so that it is possible to later open a new read
  6927  // transaction that sees that historical version of the database rather than
  6928  // the most recent version.
  6929  type sqlite3_snapshot = sqlite3_snapshot1 /* sqlite3.h:9632:3 */
  6930  
  6931  // CAPI3REF: Flags for sqlite3_deserialize()
  6932  //
  6933  // The following are allowed values for 6th argument (the F argument) to
  6934  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  6935  //
  6936  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  6937  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  6938  // and that SQLite should take ownership of this memory and automatically
  6939  // free it when it has finished using it.  Without this flag, the caller
  6940  // is responsible for freeing any dynamically allocated memory.
  6941  //
  6942  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  6943  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  6944  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  6945  // Without this flag, the deserialized database cannot increase in size beyond
  6946  // the number of bytes specified by the M parameter.
  6947  //
  6948  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  6949  // should be treated as read-only.
  6950  
  6951  // Undo the hack that converts floating point types to integer for
  6952  // builds on processors without floating point support.
  6953  
  6954  //******* Begin file sqlite3rtree.h ********
  6955  // 2010 August 30
  6956  //
  6957  // The author disclaims copyright to this source code.  In place of
  6958  // a legal notice, here is a blessing:
  6959  //
  6960  //    May you do good and not evil.
  6961  //    May you find forgiveness for yourself and forgive others.
  6962  //    May you share freely, never taking more than you give.
  6963  //
  6964  //
  6965  
  6966  type sqlite3_rtree_geometry1 = struct {
  6967  	FpContext uintptr
  6968  	FnParam   int32
  6969  	FaParam   uintptr
  6970  	FpUser    uintptr
  6971  	FxDelUser uintptr
  6972  } /* sqlite3.h:9957:9 */
  6973  
  6974  // CAPI3REF: Flags for sqlite3_deserialize()
  6975  //
  6976  // The following are allowed values for 6th argument (the F argument) to
  6977  // the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
  6978  //
  6979  // The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
  6980  // in the P argument is held in memory obtained from [sqlite3_malloc64()]
  6981  // and that SQLite should take ownership of this memory and automatically
  6982  // free it when it has finished using it.  Without this flag, the caller
  6983  // is responsible for freeing any dynamically allocated memory.
  6984  //
  6985  // The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
  6986  // grow the size of the database using calls to [sqlite3_realloc64()].  This
  6987  // flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
  6988  // Without this flag, the deserialized database cannot increase in size beyond
  6989  // the number of bytes specified by the M parameter.
  6990  //
  6991  // The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
  6992  // should be treated as read-only.
  6993  
  6994  // Undo the hack that converts floating point types to integer for
  6995  // builds on processors without floating point support.
  6996  
  6997  //******* Begin file sqlite3rtree.h ********
  6998  // 2010 August 30
  6999  //
  7000  // The author disclaims copyright to this source code.  In place of
  7001  // a legal notice, here is a blessing:
  7002  //
  7003  //    May you do good and not evil.
  7004  //    May you find forgiveness for yourself and forgive others.
  7005  //    May you share freely, never taking more than you give.
  7006  //
  7007  //
  7008  
  7009  type sqlite3_rtree_geometry = sqlite3_rtree_geometry1 /* sqlite3.h:9957:39 */
  7010  type sqlite3_rtree_query_info1 = struct {
  7011  	FpContext      uintptr
  7012  	FnParam        int32
  7013  	FaParam        uintptr
  7014  	FpUser         uintptr
  7015  	FxDelUser      uintptr
  7016  	FaCoord        uintptr
  7017  	FanQueue       uintptr
  7018  	FnCoord        int32
  7019  	FiLevel        int32
  7020  	FmxLevel       int32
  7021  	FiRowid        sqlite3_int64
  7022  	FrParentScore  sqlite3_rtree_dbl
  7023  	FeParentWithin int32
  7024  	FeWithin       int32
  7025  	FrScore        sqlite3_rtree_dbl
  7026  	FapSqlParam    uintptr
  7027  	_              [4]byte
  7028  } /* sqlite3.h:9958:9 */
  7029  
  7030  type sqlite3_rtree_query_info = sqlite3_rtree_query_info1 /* sqlite3.h:9958:41 */
  7031  
  7032  // The double-precision datatype used by RTree depends on the
  7033  // SQLITE_RTREE_INT_ONLY compile-time option.
  7034  type sqlite3_rtree_dbl = float64 /* sqlite3.h:9966:18 */
  7035  
  7036  // CAPI3REF: Values for sqlite3session_config().
  7037  
  7038  // Make sure we can call this stuff from C++.
  7039  
  7040  //******* End of sqlite3session.h ********
  7041  //******* Begin file fts5.h ********
  7042  // 2014 May 31
  7043  //
  7044  // The author disclaims copyright to this source code.  In place of
  7045  // a legal notice, here is a blessing:
  7046  //
  7047  //    May you do good and not evil.
  7048  //    May you find forgiveness for yourself and forgive others.
  7049  //    May you share freely, never taking more than you give.
  7050  //
  7051  //
  7052  //
  7053  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  7054  // FTS5 may be extended with:
  7055  //
  7056  //     * custom tokenizers, and
  7057  //     * custom auxiliary functions.
  7058  
  7059  // ************************************************************************
  7060  //
  7061  // CUSTOM AUXILIARY FUNCTIONS
  7062  //
  7063  // Virtual table implementations may overload SQL functions by implementing
  7064  // the sqlite3_module.xFindFunction() method.
  7065  
  7066  type Fts5ExtensionApi1 = struct {
  7067  	FiVersion           int32
  7068  	FxUserData          uintptr
  7069  	FxColumnCount       uintptr
  7070  	FxRowCount          uintptr
  7071  	FxColumnTotalSize   uintptr
  7072  	FxTokenize          uintptr
  7073  	FxPhraseCount       uintptr
  7074  	FxPhraseSize        uintptr
  7075  	FxInstCount         uintptr
  7076  	FxInst              uintptr
  7077  	FxRowid             uintptr
  7078  	FxColumnText        uintptr
  7079  	FxColumnSize        uintptr
  7080  	FxQueryPhrase       uintptr
  7081  	FxSetAuxdata        uintptr
  7082  	FxGetAuxdata        uintptr
  7083  	FxPhraseFirst       uintptr
  7084  	FxPhraseNext        uintptr
  7085  	FxPhraseFirstColumn uintptr
  7086  	FxPhraseNextColumn  uintptr
  7087  } /* sqlite3.h:11813:9 */
  7088  
  7089  // CAPI3REF: Values for sqlite3session_config().
  7090  
  7091  // Make sure we can call this stuff from C++.
  7092  
  7093  //******* End of sqlite3session.h ********
  7094  //******* Begin file fts5.h ********
  7095  // 2014 May 31
  7096  //
  7097  // The author disclaims copyright to this source code.  In place of
  7098  // a legal notice, here is a blessing:
  7099  //
  7100  //    May you do good and not evil.
  7101  //    May you find forgiveness for yourself and forgive others.
  7102  //    May you share freely, never taking more than you give.
  7103  //
  7104  //
  7105  //
  7106  // Interfaces to extend FTS5. Using the interfaces defined in this file,
  7107  // FTS5 may be extended with:
  7108  //
  7109  //     * custom tokenizers, and
  7110  //     * custom auxiliary functions.
  7111  
  7112  // ************************************************************************
  7113  //
  7114  // CUSTOM AUXILIARY FUNCTIONS
  7115  //
  7116  // Virtual table implementations may overload SQL functions by implementing
  7117  // the sqlite3_module.xFindFunction() method.
  7118  
  7119  type Fts5ExtensionApi = Fts5ExtensionApi1 /* sqlite3.h:11813:33 */
  7120  type Fts5PhraseIter1 = struct {
  7121  	Fa uintptr
  7122  	Fb uintptr
  7123  } /* sqlite3.h:11815:9 */
  7124  
  7125  type Fts5PhraseIter = Fts5PhraseIter1 /* sqlite3.h:11815:31 */
  7126  
  7127  type fts5_extension_function = uintptr /* sqlite3.h:11817:14 */
  7128  type fts5_tokenizer1 = struct {
  7129  	FxCreate   uintptr
  7130  	FxDelete   uintptr
  7131  	FxTokenize uintptr
  7132  } /* sqlite3.h:12276:9 */
  7133  
  7134  type fts5_tokenizer = fts5_tokenizer1 /* sqlite3.h:12276:31 */
  7135  
  7136  // Flags that may be passed as the third argument to xTokenize()
  7137  
  7138  // Flags that may be passed by the tokenizer implementation back to FTS5
  7139  // as the third argument to the supplied xToken callback.
  7140  
  7141  //
  7142  // END OF CUSTOM TOKENIZERS
  7143  //
  7144  
  7145  // ************************************************************************
  7146  //
  7147  // FTS5 EXTENSION REGISTRATION API
  7148  type fts5_api1 = struct {
  7149  	FiVersion         int32
  7150  	FxCreateTokenizer uintptr
  7151  	FxFindTokenizer   uintptr
  7152  	FxCreateFunction  uintptr
  7153  } /* sqlite3.h:12312:9 */
  7154  
  7155  // Flags that may be passed as the third argument to xTokenize()
  7156  
  7157  // Flags that may be passed by the tokenizer implementation back to FTS5
  7158  // as the third argument to the supplied xToken callback.
  7159  
  7160  //
  7161  // END OF CUSTOM TOKENIZERS
  7162  //
  7163  
  7164  // ************************************************************************
  7165  //
  7166  // FTS5 EXTENSION REGISTRATION API
  7167  type fts5_api = fts5_api1 /* sqlite3.h:12312:25 */
  7168  
  7169  //
  7170  // END OF REGISTRATION API
  7171  //
  7172  
  7173  //******* End of fts5.h ********
  7174  
  7175  type sqlite3expert1 = struct {
  7176  	FiSample     int32
  7177  	Fdb          uintptr
  7178  	Fdbm         uintptr
  7179  	Fdbv         uintptr
  7180  	FpTable      uintptr
  7181  	FpScan       uintptr
  7182  	FpWrite      uintptr
  7183  	FpStatement  uintptr
  7184  	FbRun        int32
  7185  	FpzErrmsg    uintptr
  7186  	Frc          int32
  7187  	FhIdx        IdxHash
  7188  	FzCandidates uintptr
  7189  } /* sqlite3expert.h:17:9 */
  7190  
  7191  //
  7192  // END OF REGISTRATION API
  7193  //
  7194  
  7195  //******* End of fts5.h ********
  7196  
  7197  type sqlite3expert = sqlite3expert1 /* sqlite3expert.h:17:30 */
  7198  
  7199  // POSIX.1-2008 extended locale interface (see locale.h).
  7200  // Definition of locale_t.
  7201  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
  7202  //    This file is part of the GNU C Library.
  7203  //
  7204  //    The GNU C Library is free software; you can redistribute it and/or
  7205  //    modify it under the terms of the GNU Lesser General Public
  7206  //    License as published by the Free Software Foundation; either
  7207  //    version 2.1 of the License, or (at your option) any later version.
  7208  //
  7209  //    The GNU C Library is distributed in the hope that it will be useful,
  7210  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  7211  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  7212  //    Lesser General Public License for more details.
  7213  //
  7214  //    You should have received a copy of the GNU Lesser General Public
  7215  //    License along with the GNU C Library; if not, see
  7216  //    <http://www.gnu.org/licenses/>.
  7217  
  7218  // Definition of struct __locale_struct and __locale_t.
  7219  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
  7220  //    This file is part of the GNU C Library.
  7221  //    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
  7222  //
  7223  //    The GNU C Library is free software; you can redistribute it and/or
  7224  //    modify it under the terms of the GNU Lesser General Public
  7225  //    License as published by the Free Software Foundation; either
  7226  //    version 2.1 of the License, or (at your option) any later version.
  7227  //
  7228  //    The GNU C Library is distributed in the hope that it will be useful,
  7229  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  7230  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  7231  //    Lesser General Public License for more details.
  7232  //
  7233  //    You should have received a copy of the GNU Lesser General Public
  7234  //    License along with the GNU C Library; if not, see
  7235  //    <http://www.gnu.org/licenses/>.
  7236  
  7237  // POSIX.1-2008: the locale_t type, representing a locale context
  7238  //    (implementation-namespace version).  This type should be treated
  7239  //    as opaque by applications; some details are exposed for the sake of
  7240  //    efficiency in e.g. ctype functions.
  7241  
  7242  type __locale_struct = struct {
  7243  	F__locales       [13]uintptr
  7244  	F__ctype_b       uintptr
  7245  	F__ctype_tolower uintptr
  7246  	F__ctype_toupper uintptr
  7247  	F__names         [13]uintptr
  7248  } /* __locale_t.h:28:1 */
  7249  
  7250  type locale_t = uintptr /* locale_t.h:24:20 */
  7251  
  7252  // The tag name of this struct is _G_fpos_t to preserve historic
  7253  //    C++ mangled names for functions taking fpos_t arguments.
  7254  //    That name should not be used in new code.
  7255  type _G_fpos_t = struct {
  7256  	F__pos   int32
  7257  	F__state struct {
  7258  		F__count int32
  7259  		F__value struct{ F__wch uint32 }
  7260  	}
  7261  } /* __fpos_t.h:10:9 */
  7262  
  7263  // bits/types.h -- definitions of __*_t types underlying *_t types.
  7264  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
  7265  //    This file is part of the GNU C Library.
  7266  //
  7267  //    The GNU C Library is free software; you can redistribute it and/or
  7268  //    modify it under the terms of the GNU Lesser General Public
  7269  //    License as published by the Free Software Foundation; either
  7270  //    version 2.1 of the License, or (at your option) any later version.
  7271  //
  7272  //    The GNU C Library is distributed in the hope that it will be useful,
  7273  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  7274  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  7275  //    Lesser General Public License for more details.
  7276  //
  7277  //    You should have received a copy of the GNU Lesser General Public
  7278  //    License along with the GNU C Library; if not, see
  7279  //    <http://www.gnu.org/licenses/>.
  7280  
  7281  // Never include this file directly; use <sys/types.h> instead.
  7282  
  7283  // The tag name of this struct is _G_fpos64_t to preserve historic
  7284  //    C++ mangled names for functions taking fpos_t and/or fpos64_t
  7285  //    arguments.  That name should not be used in new code.
  7286  type _G_fpos64_t = struct {
  7287  	F__pos   int64
  7288  	F__state struct {
  7289  		F__count int32
  7290  		F__value struct{ F__wch uint32 }
  7291  	}
  7292  } /* __fpos64_t.h:10:9 */
  7293  
  7294  type _IO_FILE = struct {
  7295  	F_flags          int32
  7296  	F_IO_read_ptr    uintptr
  7297  	F_IO_read_end    uintptr
  7298  	F_IO_read_base   uintptr
  7299  	F_IO_write_base  uintptr
  7300  	F_IO_write_ptr   uintptr
  7301  	F_IO_write_end   uintptr
  7302  	F_IO_buf_base    uintptr
  7303  	F_IO_buf_end     uintptr
  7304  	F_IO_save_base   uintptr
  7305  	F_IO_backup_base uintptr
  7306  	F_IO_save_end    uintptr
  7307  	F_markers        uintptr
  7308  	F_chain          uintptr
  7309  	F_fileno         int32
  7310  	F_flags2         int32
  7311  	F_old_offset     int32
  7312  	F_cur_column     uint16
  7313  	F_vtable_offset  int8
  7314  	F_shortbuf       [1]int8
  7315  	F_lock           uintptr
  7316  	_                [4]byte
  7317  	F_offset         int64
  7318  	F_codecvt        uintptr
  7319  	F_wide_data      uintptr
  7320  	F_freeres_list   uintptr
  7321  	F_freeres_buf    uintptr
  7322  	F__pad5          size_t
  7323  	F_mode           int32
  7324  	F_unused2        [40]int8
  7325  } /* __FILE.h:4:1 */
  7326  
  7327  // The opaque type of streams.  This is the definition used elsewhere.
  7328  type FILE = _IO_FILE /* FILE.h:7:25 */
  7329  
  7330  // These macros are used by bits/stdio.h and internal headers.
  7331  
  7332  // Many more flag bits are defined internally.
  7333  
  7334  type off_t = int64 /* stdio.h:65:19 */
  7335  
  7336  type ssize_t = int32 /* stdio.h:77:19 */
  7337  
  7338  // The type of the second argument to `fgetpos' and `fsetpos'.
  7339  type fpos_t = _G_fpos64_t /* stdio.h:86:20 */
  7340  
  7341  // If we are compiling with optimizing read this file.  It contains
  7342  //    several optimizing inline functions and macros.
  7343  
  7344  type i64 = sqlite3_int64  /* sqlite3expert.c:20:23 */
  7345  type u64 = sqlite3_uint64 /* sqlite3expert.c:21:24 */
  7346  
  7347  type IdxColumn1 = struct {
  7348  	FzName uintptr
  7349  	FzColl uintptr
  7350  	FiPk   int32
  7351  } /* sqlite3expert.h:17:9 */
  7352  
  7353  type IdxColumn = IdxColumn1 /* sqlite3expert.c:23:26 */
  7354  type IdxConstraint1 = struct {
  7355  	FzColl  uintptr
  7356  	FbRange int32
  7357  	FiCol   int32
  7358  	FbFlag  int32
  7359  	FbDesc  int32
  7360  	FpNext  uintptr
  7361  	FpLink  uintptr
  7362  } /* sqlite3expert.h:17:9 */
  7363  
  7364  type IdxConstraint = IdxConstraint1 /* sqlite3expert.c:24:30 */
  7365  type IdxScan1 = struct {
  7366  	FpTab      uintptr
  7367  	FiDb       int32
  7368  	Fcovering  i64
  7369  	FpOrder    uintptr
  7370  	FpEq       uintptr
  7371  	FpRange    uintptr
  7372  	FpNextScan uintptr
  7373  } /* sqlite3expert.h:17:9 */
  7374  
  7375  type IdxScan = IdxScan1 /* sqlite3expert.c:25:24 */
  7376  type IdxStatement1 = struct {
  7377  	FiId   int32
  7378  	FzSql  uintptr
  7379  	FzIdx  uintptr
  7380  	FzEQP  uintptr
  7381  	FpNext uintptr
  7382  } /* sqlite3expert.h:17:9 */
  7383  
  7384  type IdxStatement = IdxStatement1 /* sqlite3expert.c:26:29 */
  7385  type IdxTable1 = struct {
  7386  	FnCol  int32
  7387  	FzName uintptr
  7388  	FaCol  uintptr
  7389  	FpNext uintptr
  7390  } /* sqlite3expert.h:17:9 */
  7391  
  7392  type IdxTable = IdxTable1 /* sqlite3expert.c:27:25 */
  7393  type IdxWrite1 = struct {
  7394  	FpTab  uintptr
  7395  	FeOp   int32
  7396  	FpNext uintptr
  7397  } /* sqlite3expert.h:17:9 */
  7398  
  7399  type IdxWrite = IdxWrite1 /* sqlite3expert.c:28:25 */
  7400  
  7401  // A hash table for storing strings. With space for a payload string
  7402  // with each entry. Methods are:
  7403  //
  7404  //   idxHashInit()
  7405  //   idxHashClear()
  7406  //   idxHashAdd()
  7407  //   idxHashSearch()
  7408  type IdxHashEntry1 = struct {
  7409  	FzKey      uintptr
  7410  	FzVal      uintptr
  7411  	FzVal2     uintptr
  7412  	FpHashNext uintptr
  7413  	FpNext     uintptr
  7414  } /* sqlite3expert.h:17:9 */
  7415  
  7416  // A hash table for storing strings. With space for a payload string
  7417  // with each entry. Methods are:
  7418  //
  7419  //   idxHashInit()
  7420  //   idxHashClear()
  7421  //   idxHashAdd()
  7422  //   idxHashSearch()
  7423  type IdxHashEntry = IdxHashEntry1 /* sqlite3expert.c:120:29 */
  7424  type IdxHash1 = struct {
  7425  	FpFirst uintptr
  7426  	FaHash  [1023]uintptr
  7427  } /* sqlite3expert.h:17:9 */
  7428  
  7429  type IdxHash = IdxHash1 /* sqlite3expert.c:121:24 */
  7430  
  7431  // Allocate and return nByte bytes of zeroed memory using sqlite3_malloc().
  7432  // If the allocation fails, set *pRc to SQLITE_NOMEM and return NULL.
  7433  func idxMalloc(tls *libc.TLS, pRc uintptr, nByte int32) uintptr { /* sqlite3expert.c:158:13: */
  7434  	var pRet uintptr
  7435  
  7436  	pRet = sqlite3.Xsqlite3_malloc(tls, nByte)
  7437  	if pRet != 0 {
  7438  		libc.Xmemset(tls, pRet, 0, uint32(nByte))
  7439  	} else {
  7440  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
  7441  	}
  7442  	return pRet
  7443  }
  7444  
  7445  // Initialize an IdxHash hash table.
  7446  func idxHashInit(tls *libc.TLS, pHash uintptr) { /* sqlite3expert.c:174:13: */
  7447  	libc.Xmemset(tls, pHash, 0, uint32(unsafe.Sizeof(IdxHash{})))
  7448  }
  7449  
  7450  // Reset an IdxHash hash table.
  7451  func idxHashClear(tls *libc.TLS, pHash uintptr) { /* sqlite3expert.c:181:13: */
  7452  	var i int32
  7453  	for i = 0; i < IDX_HASH_SIZE; i++ {
  7454  		var pEntry uintptr
  7455  		var pNext uintptr
  7456  		for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 4 /* &.aHash */) + uintptr(i)*4)); pEntry != 0; pEntry = pNext {
  7457  			pNext = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext
  7458  			sqlite3.Xsqlite3_free(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2)
  7459  			sqlite3.Xsqlite3_free(tls, pEntry)
  7460  		}
  7461  	}
  7462  	libc.Xmemset(tls, pHash, 0, uint32(unsafe.Sizeof(IdxHash{})))
  7463  }
  7464  
  7465  // Return the index of the hash bucket that the string specified by the
  7466  // arguments to this function belongs.
  7467  func idxHashString(tls *libc.TLS, z uintptr, n int32) int32 { /* sqlite3expert.c:199:12: */
  7468  	var ret uint32 = uint32(0)
  7469  	var i int32
  7470  	for i = 0; i < n; i++ {
  7471  		ret = ret + ((ret << 3) + uint32((uint8(*(*int8)(unsafe.Pointer(z + uintptr(i)))))))
  7472  	}
  7473  	return (int32(ret % uint32(IDX_HASH_SIZE)))
  7474  }
  7475  
  7476  // If zKey is already present in the hash table, return non-zero and do
  7477  // nothing. Otherwise, add an entry with key zKey and payload string zVal to
  7478  // the hash table passed as the second argument.
  7479  func idxHashAdd(tls *libc.TLS, pRc uintptr, pHash uintptr, zKey uintptr, zVal uintptr) int32 { /* sqlite3expert.c:213:12: */
  7480  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
  7481  	var iHash int32 = idxHashString(tls, zKey, nKey)
  7482  	var nVal int32 = func() int32 {
  7483  		if zVal != 0 {
  7484  			return int32(libc.Xstrlen(tls, zVal))
  7485  		}
  7486  		return 0
  7487  	}()
  7488  	var pEntry uintptr
  7489  
  7490  	for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 4 /* &.aHash */) + uintptr(iHash)*4)); pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext {
  7491  		if (int32(libc.Xstrlen(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey)) == nKey) && (0 == libc.Xmemcmp(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint32(nKey))) {
  7492  			return 1
  7493  		}
  7494  	}
  7495  	pEntry = idxMalloc(tls, pRc, (int32((((uint32(unsafe.Sizeof(IdxHashEntry{})) + uint32(nKey)) + uint32(1)) + uint32(nVal)) + uint32(1))))
  7496  	if pEntry != 0 {
  7497  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey = (pEntry + 1*20)
  7498  		libc.Xmemcpy(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint32(nKey))
  7499  		if zVal != 0 {
  7500  			(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal = ((*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey + uintptr((nKey + 1)))
  7501  			libc.Xmemcpy(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal, zVal, uint32(nVal))
  7502  		}
  7503  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext = *(*uintptr)(unsafe.Pointer((pHash + 4 /* &.aHash */) + uintptr(iHash)*4))
  7504  		*(*uintptr)(unsafe.Pointer((pHash + 4 /* &.aHash */) + uintptr(iHash)*4)) = pEntry
  7505  
  7506  		(*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext = (*IdxHash)(unsafe.Pointer(pHash)).FpFirst
  7507  		(*IdxHash)(unsafe.Pointer(pHash)).FpFirst = pEntry
  7508  	}
  7509  	return 0
  7510  }
  7511  
  7512  // If zKey/nKey is present in the hash table, return a pointer to the
  7513  // hash-entry object.
  7514  func idxHashFind(tls *libc.TLS, pHash uintptr, zKey uintptr, nKey int32) uintptr { /* sqlite3expert.c:250:21: */
  7515  	var iHash int32
  7516  	var pEntry uintptr
  7517  	if nKey < 0 {
  7518  		nKey = int32(libc.Xstrlen(tls, zKey))
  7519  	}
  7520  	iHash = idxHashString(tls, zKey, nKey)
  7521  
  7522  	for pEntry = *(*uintptr)(unsafe.Pointer((pHash + 4 /* &.aHash */) + uintptr(iHash)*4)); pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpHashNext {
  7523  		if (int32(libc.Xstrlen(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey)) == nKey) && (0 == libc.Xmemcmp(tls, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey, zKey, uint32(nKey))) {
  7524  			return pEntry
  7525  		}
  7526  	}
  7527  	return uintptr(0)
  7528  }
  7529  
  7530  // If the hash table contains an entry with a key equal to the string
  7531  // passed as the final two arguments to this function, return a pointer
  7532  // to the payload string. Otherwise, if zKey/nKey is not present in the
  7533  // hash table, return NULL.
  7534  func idxHashSearch(tls *libc.TLS, pHash uintptr, zKey uintptr, nKey int32) uintptr { /* sqlite3expert.c:270:19: */
  7535  	var pEntry uintptr = idxHashFind(tls, pHash, zKey, nKey)
  7536  	if pEntry != 0 {
  7537  		return (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal
  7538  	}
  7539  	return uintptr(0)
  7540  }
  7541  
  7542  // Allocate and return a new IdxConstraint object. Set the IdxConstraint.zColl
  7543  // variable to point to a copy of nul-terminated string zColl.
  7544  func idxNewConstraint(tls *libc.TLS, pRc uintptr, zColl uintptr) uintptr { /* sqlite3expert.c:280:22: */
  7545  	var pNew uintptr
  7546  	var nColl int32 = int32(libc.Xstrlen(tls, zColl))
  7547  
  7548  	pNew = idxMalloc(tls, pRc, (int32((uint32(unsafe.Sizeof(IdxConstraint{})) * uint32(nColl)) + uint32(1))))
  7549  	if pNew != 0 {
  7550  		(*IdxConstraint)(unsafe.Pointer(pNew)).FzColl = (pNew + 1*28)
  7551  		libc.Xmemcpy(tls, (*IdxConstraint)(unsafe.Pointer(pNew)).FzColl, zColl, (uint32(nColl + 1)))
  7552  	}
  7553  	return pNew
  7554  }
  7555  
  7556  // An error associated with database handle db has just occurred. Pass
  7557  // the error message to callback function xOut.
  7558  func idxDatabaseError(tls *libc.TLS, db uintptr, pzErrmsg uintptr) { /* sqlite3expert.c:297:13: */
  7559  	bp := tls.Alloc(8)
  7560  	defer tls.Free(8)
  7561  
  7562  	*(*uintptr)(unsafe.Pointer(pzErrmsg)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
  7563  }
  7564  
  7565  // Prepare an SQL statement.
  7566  func idxPrepareStmt(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zSql uintptr) int32 { /* sqlite3expert.c:307:12: */
  7567  	var rc int32 = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, ppStmt, uintptr(0))
  7568  	if rc != SQLITE_OK {
  7569  		*(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0)
  7570  		idxDatabaseError(tls, db, pzErrmsg)
  7571  	}
  7572  	return rc
  7573  }
  7574  
  7575  // Prepare an SQL statement using the results of a printf() formatting.
  7576  func idxPrintfPrepareStmt(tls *libc.TLS, db uintptr, ppStmt uintptr, pzErrmsg uintptr, zFmt uintptr, va uintptr) int32 { /* sqlite3expert.c:324:12: */
  7577  	var ap va_list
  7578  	_ = ap
  7579  	var rc int32
  7580  	var zSql uintptr
  7581  	ap = va
  7582  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
  7583  	if zSql == uintptr(0) {
  7584  		rc = SQLITE_NOMEM
  7585  	} else {
  7586  		rc = idxPrepareStmt(tls, db, ppStmt, pzErrmsg, zSql)
  7587  		sqlite3.Xsqlite3_free(tls, zSql)
  7588  	}
  7589  	_ = ap
  7590  	return rc
  7591  }
  7592  
  7593  // ************************************************************************
  7594  //
  7595  // Beginning of virtual table implementation.
  7596  type ExpertVtab1 = struct {
  7597  	Fbase    sqlite3_vtab
  7598  	FpTab    uintptr
  7599  	FpExpert uintptr
  7600  } /* sqlite3expert.c:350:9 */
  7601  
  7602  // ************************************************************************
  7603  //
  7604  // Beginning of virtual table implementation.
  7605  type ExpertVtab = ExpertVtab1 /* sqlite3expert.c:350:27 */
  7606  
  7607  type ExpertCsr1 = struct {
  7608  	Fbase  sqlite3_vtab_cursor
  7609  	FpData uintptr
  7610  } /* sqlite3expert.c:357:9 */
  7611  
  7612  type ExpertCsr = ExpertCsr1 /* sqlite3expert.c:357:26 */
  7613  
  7614  func expertDequote(tls *libc.TLS, zIn uintptr) uintptr { /* sqlite3expert.c:363:13: */
  7615  	var n int32 = int32(libc.Xstrlen(tls, zIn))
  7616  	var zRet uintptr = sqlite3.Xsqlite3_malloc(tls, n)
  7617  
  7618  	if zRet != 0 {
  7619  		var iOut int32 = 0
  7620  		var iIn int32 = 0
  7621  		for iIn = 1; iIn < (n - 1); iIn++ {
  7622  			if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == '\'' {
  7623  
  7624  				iIn++
  7625  			}
  7626  			*(*int8)(unsafe.Pointer(zRet + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
  7627  		}
  7628  		*(*int8)(unsafe.Pointer(zRet + uintptr(iOut))) = int8(0)
  7629  	}
  7630  
  7631  	return zRet
  7632  }
  7633  
  7634  // This function is the implementation of both the xConnect and xCreate
  7635  // methods of the r-tree virtual table.
  7636  //
  7637  //   argv[0]   -> module name
  7638  //   argv[1]   -> database name
  7639  //   argv[2]   -> table name
  7640  //   argv[...] -> column names...
  7641  func expertConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:395:12: */
  7642  	bp := tls.Alloc(4)
  7643  	defer tls.Free(4)
  7644  
  7645  	var pExpert uintptr = pAux
  7646  	var p uintptr = uintptr(0)
  7647  	// var rc int32 at bp, 4
  7648  
  7649  	if argc != 4 {
  7650  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3 /* "internal error!" */, 0)
  7651  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
  7652  	} else {
  7653  		var zCreateTable uintptr = expertDequote(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
  7654  		if zCreateTable != 0 {
  7655  			*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db, zCreateTable)
  7656  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  7657  				p = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(ExpertVtab{})))
  7658  			}
  7659  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  7660  				(*ExpertVtab)(unsafe.Pointer(p)).FpExpert = pExpert
  7661  				(*ExpertVtab)(unsafe.Pointer(p)).FpTab = (*sqlite3expert)(unsafe.Pointer(pExpert)).FpTable
  7662  
  7663  			}
  7664  			sqlite3.Xsqlite3_free(tls, zCreateTable)
  7665  		} else {
  7666  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM
  7667  		}
  7668  	}
  7669  
  7670  	*(*uintptr)(unsafe.Pointer(ppVtab)) = p
  7671  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7672  }
  7673  
  7674  func expertDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* sqlite3expert.c:431:12: */
  7675  	var p uintptr = pVtab
  7676  	sqlite3.Xsqlite3_free(tls, p)
  7677  	return SQLITE_OK
  7678  }
  7679  
  7680  func expertBestIndex(tls *libc.TLS, pVtab uintptr, pIdxInfo uintptr) int32 { /* sqlite3expert.c:437:12: */
  7681  	bp := tls.Alloc(4)
  7682  	defer tls.Free(4)
  7683  
  7684  	var p uintptr = pVtab
  7685  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  7686  	var n int32 = 0
  7687  	var pScan uintptr
  7688  	var opmask int32 = ((((SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_GT) | SQLITE_INDEX_CONSTRAINT_LT) | SQLITE_INDEX_CONSTRAINT_GE) | SQLITE_INDEX_CONSTRAINT_LE)
  7689  
  7690  	pScan = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(IdxScan{})))
  7691  	if pScan != 0 {
  7692  		var i int32
  7693  
  7694  		// Link the new scan object into the list
  7695  		(*IdxScan)(unsafe.Pointer(pScan)).FpTab = (*ExpertVtab)(unsafe.Pointer(p)).FpTab
  7696  		(*IdxScan)(unsafe.Pointer(pScan)).FpNextScan = (*sqlite3expert)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpExpert)).FpScan
  7697  		(*sqlite3expert)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpExpert)).FpScan = pScan
  7698  
  7699  		// Add the constraints to the IdxScan object
  7700  		for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
  7701  			var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
  7702  			if ((((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0) &&
  7703  				((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn >= 0)) &&
  7704  				((*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpTab)).FaCol+uintptr((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn)*12)).FiPk == 0)) &&
  7705  				((int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) & opmask) != 0) {
  7706  				var pNew uintptr
  7707  				var zColl uintptr = sqlite3.Xsqlite3_vtab_collation(tls, pIdxInfo, i)
  7708  				pNew = idxNewConstraint(tls, bp /* &rc */, zColl)
  7709  				if pNew != 0 {
  7710  					(*IdxConstraint)(unsafe.Pointer(pNew)).FiCol = (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn
  7711  					if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
  7712  						(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpEq
  7713  						(*IdxScan)(unsafe.Pointer(pScan)).FpEq = pNew
  7714  					} else {
  7715  						(*IdxConstraint)(unsafe.Pointer(pNew)).FbRange = 1
  7716  						(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpRange
  7717  						(*IdxScan)(unsafe.Pointer(pScan)).FpRange = pNew
  7718  					}
  7719  				}
  7720  				n++
  7721  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = n
  7722  			}
  7723  		}
  7724  
  7725  		// Add the ORDER BY to the IdxScan object
  7726  		for i = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy - 1); i >= 0; i-- {
  7727  			var iCol int32 = (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(i)*8)).FiColumn
  7728  			if iCol >= 0 {
  7729  				var pNew uintptr = idxNewConstraint(tls, bp /* &rc */, (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(p)).FpTab)).FaCol+uintptr(iCol)*12)).FzColl)
  7730  				if pNew != 0 {
  7731  					(*IdxConstraint)(unsafe.Pointer(pNew)).FiCol = iCol
  7732  					(*IdxConstraint)(unsafe.Pointer(pNew)).FbDesc = int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(i)*8)).Fdesc)
  7733  					(*IdxConstraint)(unsafe.Pointer(pNew)).FpNext = (*IdxScan)(unsafe.Pointer(pScan)).FpOrder
  7734  					(*IdxConstraint)(unsafe.Pointer(pNew)).FpLink = (*IdxScan)(unsafe.Pointer(pScan)).FpOrder
  7735  					(*IdxScan)(unsafe.Pointer(pScan)).FpOrder = pNew
  7736  					n++
  7737  				}
  7738  			}
  7739  		}
  7740  	}
  7741  
  7742  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (1000000.0 / (float64(n + 1)))
  7743  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7744  }
  7745  
  7746  func expertUpdate(tls *libc.TLS, pVtab uintptr, nData int32, azData uintptr, pRowid uintptr) int32 { /* sqlite3expert.c:504:12: */
  7747  	_ = pVtab
  7748  	_ = nData
  7749  	_ = azData
  7750  	_ = pRowid
  7751  	return SQLITE_OK
  7752  }
  7753  
  7754  // Virtual table module xOpen method.
  7755  func expertOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* sqlite3expert.c:520:12: */
  7756  	bp := tls.Alloc(4)
  7757  	defer tls.Free(4)
  7758  
  7759  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  7760  	var pCsr uintptr
  7761  	_ = pVTab
  7762  	pCsr = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(ExpertCsr{})))
  7763  	*(*uintptr)(unsafe.Pointer(ppCursor)) = pCsr
  7764  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  7765  }
  7766  
  7767  // Virtual table module xClose method.
  7768  func expertClose(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:532:12: */
  7769  	var pCsr uintptr = cur
  7770  	sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7771  	sqlite3.Xsqlite3_free(tls, pCsr)
  7772  	return SQLITE_OK
  7773  }
  7774  
  7775  // Virtual table module xEof method.
  7776  //
  7777  // Return non-zero if the cursor does not currently point to a valid
  7778  // record (i.e if the scan has finished), or zero otherwise.
  7779  func expertEof(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:545:12: */
  7780  	var pCsr uintptr = cur
  7781  	return (libc.Bool32((*ExpertCsr)(unsafe.Pointer(pCsr)).FpData == uintptr(0)))
  7782  }
  7783  
  7784  // Virtual table module xNext method.
  7785  func expertNext(tls *libc.TLS, cur uintptr) int32 { /* sqlite3expert.c:553:12: */
  7786  	var pCsr uintptr = cur
  7787  	var rc int32 = SQLITE_OK
  7788  
  7789  	rc = sqlite3.Xsqlite3_step(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7790  	if rc != SQLITE_ROW {
  7791  		rc = sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7792  		(*ExpertCsr)(unsafe.Pointer(pCsr)).FpData = uintptr(0)
  7793  	} else {
  7794  		rc = SQLITE_OK
  7795  	}
  7796  
  7797  	return rc
  7798  }
  7799  
  7800  // Virtual table module xRowid method.
  7801  func expertRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* sqlite3expert.c:572:12: */
  7802  	_ = cur
  7803  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
  7804  	return SQLITE_OK
  7805  }
  7806  
  7807  // Virtual table module xColumn method.
  7808  func expertColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* sqlite3expert.c:581:12: */
  7809  	var pCsr uintptr = cur
  7810  	var pVal uintptr
  7811  	pVal = sqlite3.Xsqlite3_column_value(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData, i)
  7812  	if pVal != 0 {
  7813  		sqlite3.Xsqlite3_result_value(tls, ctx, pVal)
  7814  	}
  7815  	return SQLITE_OK
  7816  }
  7817  
  7818  // Virtual table module xFilter method.
  7819  func expertFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* sqlite3expert.c:594:12: */
  7820  	bp := tls.Alloc(8)
  7821  	defer tls.Free(8)
  7822  
  7823  	var pCsr uintptr = cur
  7824  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
  7825  	var pExpert uintptr = (*ExpertVtab)(unsafe.Pointer(pVtab)).FpExpert
  7826  	var rc int32
  7827  
  7828  	_ = idxNum
  7829  	_ = idxStr
  7830  	_ = argc
  7831  	_ = argv
  7832  	rc = sqlite3.Xsqlite3_finalize(tls, (*ExpertCsr)(unsafe.Pointer(pCsr)).FpData)
  7833  	(*ExpertCsr)(unsafe.Pointer(pCsr)).FpData = uintptr(0)
  7834  	if rc == SQLITE_OK {
  7835  		rc = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(pExpert)).Fdb, (pCsr + 4 /* &.pData */), (pVtab /* &.base */ + 8 /* &.zErrMsg */),
  7836  			ts+19 /* "SELECT * FROM ma..." */, libc.VaList(bp, (*IdxTable)(unsafe.Pointer((*ExpertVtab)(unsafe.Pointer(pVtab)).FpTab)).FzName))
  7837  	}
  7838  
  7839  	if rc == SQLITE_OK {
  7840  		rc = expertNext(tls, cur)
  7841  	}
  7842  	return rc
  7843  }
  7844  
  7845  func idxRegisterVtab(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:622:12: */
  7846  
  7847  	return sqlite3.Xsqlite3_create_module(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, ts+56 /* "expert" */, uintptr(unsafe.Pointer(&expertModule)), p)
  7848  }
  7849  
  7850  var expertModule = sqlite3_module{
  7851  	FiVersion:    2, // iVersion
  7852  	FxCreate:     0, // xCreate - create a table
  7853  	FxConnect:    0, // xConnect - connect to an existing table
  7854  	FxBestIndex:  0, // xBestIndex - Determine search strategy
  7855  	FxDisconnect: 0, // xDisconnect - Disconnect from a table
  7856  	FxDestroy:    0, // xDestroy - Drop a table
  7857  	FxOpen:       0, // xOpen - open a cursor
  7858  	FxClose:      0, // xClose - close a cursor
  7859  	FxFilter:     0, // xFilter - configure scan constraints
  7860  	FxNext:       0, // xNext - advance a cursor
  7861  	FxEof:        0, // xEof
  7862  	FxColumn:     0, // xColumn - read data
  7863  	FxRowid:      0, // xRowid - read data
  7864  	FxUpdate:     0, // xShadowName
  7865  } /* sqlite3expert.c:623:25 */
  7866  
  7867  //
  7868  // End of virtual table implementation.
  7869  //
  7870  // Finalize SQL statement pStmt. If (*pRc) is SQLITE_OK when this function
  7871  // is called, set it to the return value of sqlite3_finalize() before
  7872  // returning. Otherwise, discard the sqlite3_finalize() return value.
  7873  func idxFinalize(tls *libc.TLS, pRc uintptr, pStmt uintptr) { /* sqlite3expert.c:660:13: */
  7874  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, pStmt)
  7875  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
  7876  		*(*int32)(unsafe.Pointer(pRc)) = rc
  7877  	}
  7878  }
  7879  
  7880  // Attempt to allocate an IdxTable structure corresponding to table zTab
  7881  // in the main database of connection db. If successful, set (*ppOut) to
  7882  // point to the new object and return SQLITE_OK. Otherwise, return an
  7883  // SQLite error code and set (*ppOut) to NULL. In this case *pzErrmsg may be
  7884  // set to point to an error string.
  7885  //
  7886  // It is the responsibility of the caller to eventually free either the
  7887  // IdxTable object or error message using sqlite3_free().
  7888  func idxGetTableInfo(tls *libc.TLS, db uintptr, zTab uintptr, ppOut uintptr, pzErrmsg uintptr) int32 { /* sqlite3expert.c:675:12: */
  7889  	bp := tls.Alloc(24)
  7890  	defer tls.Free(24)
  7891  
  7892  	*(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)) = uintptr(0)
  7893  	var nCol int32 = 0
  7894  	var nTab int32 = int32(libc.Xstrlen(tls, zTab))
  7895  	var nByte int32 = (int32((uint32(unsafe.Sizeof(IdxTable{})) + uint32(nTab)) + uint32(1)))
  7896  	var pNew uintptr = uintptr(0)
  7897  	// var rc int32 at bp+16, 4
  7898  
  7899  	var rc2 int32
  7900  	var pCsr uintptr = uintptr(0)
  7901  	var nPk int32 = 0
  7902  
  7903  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = idxPrintfPrepareStmt(tls, db, bp+8 /* &p1 */, pzErrmsg, ts+63 /* "PRAGMA table_xin..." */, libc.VaList(bp, zTab))
  7904  	for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))) {
  7905  		*(*uintptr)(unsafe.Pointer(bp + 12 /* zCol */)) = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 1)
  7906  		nByte = nByte + (1 + int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* zCol */)))))
  7907  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_table_column_metadata(tls,
  7908  			db, ts+85 /* "main" */, zTab, *(*uintptr)(unsafe.Pointer(bp + 12 /* zCol */)), uintptr(0), bp+12 /* &zCol */, uintptr(0), uintptr(0), uintptr(0))
  7909  		nByte = nByte + (1 + int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* zCol */)))))
  7910  		nCol++
  7911  		nPk = nPk + (libc.Bool32(sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 5) > 0))
  7912  	}
  7913  	rc2 = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))
  7914  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  7915  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = rc2
  7916  	}
  7917  
  7918  	nByte = int32(uint32(nByte) + (uint32(unsafe.Sizeof(IdxColumn{})) * uint32(nCol)))
  7919  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  7920  		pNew = idxMalloc(tls, bp+16 /* &rc */, nByte)
  7921  	}
  7922  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  7923  		(*IdxTable)(unsafe.Pointer(pNew)).FaCol = (pNew + 1*16)
  7924  		(*IdxTable)(unsafe.Pointer(pNew)).FnCol = nCol
  7925  		pCsr = ((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*12)
  7926  	}
  7927  
  7928  	nCol = 0
  7929  	for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))) {
  7930  		*(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)) = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 1)
  7931  		var nCopy int32 = (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)))) + 1)
  7932  		(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*12)).FzName = pCsr
  7933  		(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*12)).FiPk = (libc.Bool32((sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)), 5) == 1) && (nPk == 1)))
  7934  		libc.Xmemcpy(tls, pCsr, *(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)), uint32(nCopy))
  7935  		pCsr += uintptr(nCopy)
  7936  
  7937  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_table_column_metadata(tls,
  7938  			db, ts+85 /* "main" */, zTab, *(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)), uintptr(0), bp+20 /* &zCol */, uintptr(0), uintptr(0), uintptr(0))
  7939  		if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  7940  			nCopy = (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)))) + 1)
  7941  			(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pNew)).FaCol + uintptr(nCol)*12)).FzColl = pCsr
  7942  			libc.Xmemcpy(tls, pCsr, *(*uintptr)(unsafe.Pointer(bp + 20 /* zCol */)), uint32(nCopy))
  7943  			pCsr += uintptr(nCopy)
  7944  		}
  7945  
  7946  		nCol++
  7947  	}
  7948  	idxFinalize(tls, bp+16 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 8 /* p1 */)))
  7949  
  7950  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK {
  7951  		sqlite3.Xsqlite3_free(tls, pNew)
  7952  		pNew = uintptr(0)
  7953  	} else {
  7954  		(*IdxTable)(unsafe.Pointer(pNew)).FzName = pCsr
  7955  		libc.Xmemcpy(tls, (*IdxTable)(unsafe.Pointer(pNew)).FzName, zTab, (uint32(nTab + 1)))
  7956  	}
  7957  
  7958  	*(*uintptr)(unsafe.Pointer(ppOut)) = pNew
  7959  	return *(*int32)(unsafe.Pointer(bp + 16 /* rc */))
  7960  }
  7961  
  7962  // This function is a no-op if *pRc is set to anything other than
  7963  // SQLITE_OK when it is called.
  7964  //
  7965  // If *pRc is initially set to SQLITE_OK, then the text specified by
  7966  // the printf() style arguments is appended to zIn and the result returned
  7967  // in a buffer allocated by sqlite3_malloc(). sqlite3_free() is called on
  7968  // zIn before returning.
  7969  func idxAppendText(tls *libc.TLS, pRc uintptr, zIn uintptr, zFmt uintptr, va uintptr) uintptr { /* sqlite3expert.c:758:13: */
  7970  	var ap va_list
  7971  	_ = ap
  7972  	var zAppend uintptr = uintptr(0)
  7973  	var zRet uintptr = uintptr(0)
  7974  	var nIn int32
  7975  	if zIn != 0 {
  7976  		nIn = int32(libc.Xstrlen(tls, zIn))
  7977  	} else {
  7978  		nIn = 0
  7979  	}
  7980  	var nAppend int32 = 0
  7981  	ap = va
  7982  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
  7983  		zAppend = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
  7984  		if zAppend != 0 {
  7985  			nAppend = int32(libc.Xstrlen(tls, zAppend))
  7986  			zRet = sqlite3.Xsqlite3_malloc(tls, ((nIn + nAppend) + 1))
  7987  		}
  7988  		if (zAppend != 0) && (zRet != 0) {
  7989  			if nIn != 0 {
  7990  				libc.Xmemcpy(tls, zRet, zIn, uint32(nIn))
  7991  			}
  7992  			libc.Xmemcpy(tls, (zRet + uintptr(nIn)), zAppend, (uint32(nAppend + 1)))
  7993  		} else {
  7994  			sqlite3.Xsqlite3_free(tls, zRet)
  7995  			zRet = uintptr(0)
  7996  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
  7997  		}
  7998  		sqlite3.Xsqlite3_free(tls, zAppend)
  7999  		sqlite3.Xsqlite3_free(tls, zIn)
  8000  	}
  8001  	_ = ap
  8002  	return zRet
  8003  }
  8004  
  8005  // Return true if zId must be quoted in order to use it as an SQL
  8006  // identifier, or false otherwise.
  8007  func idxIdentifierRequiresQuotes(tls *libc.TLS, zId uintptr) int32 { /* sqlite3expert.c:790:12: */
  8008  	var i int32
  8009  	for i = 0; *(*int8)(unsafe.Pointer(zId + uintptr(i))) != 0; i++ {
  8010  		if ((!(int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) == '_') &&
  8011  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= '0') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= '9'))) &&
  8012  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= 'a') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= 'z'))) &&
  8013  			!((int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) >= 'A') && (int32(*(*int8)(unsafe.Pointer(zId + uintptr(i)))) <= 'Z')) {
  8014  			return 1
  8015  		}
  8016  	}
  8017  	return 0
  8018  }
  8019  
  8020  // This function appends an index column definition suitable for constraint
  8021  // pCons to the string passed as zIn and returns the result.
  8022  func idxAppendColDefn(tls *libc.TLS, pRc uintptr, zIn uintptr, pTab uintptr, pCons uintptr) uintptr { /* sqlite3expert.c:808:13: */
  8023  	bp := tls.Alloc(32)
  8024  	defer tls.Free(32)
  8025  
  8026  	var zRet uintptr = zIn
  8027  	var p uintptr = ((*IdxTable)(unsafe.Pointer(pTab)).FaCol + uintptr((*IdxConstraint)(unsafe.Pointer(pCons)).FiCol)*12)
  8028  	if zRet != 0 {
  8029  		zRet = idxAppendText(tls, pRc, zRet, ts+90 /* ", " */, 0)
  8030  	}
  8031  
  8032  	if idxIdentifierRequiresQuotes(tls, (*IdxColumn)(unsafe.Pointer(p)).FzName) != 0 {
  8033  		zRet = idxAppendText(tls, pRc, zRet, ts+93 /* "%Q" */, libc.VaList(bp, (*IdxColumn)(unsafe.Pointer(p)).FzName))
  8034  	} else {
  8035  		zRet = idxAppendText(tls, pRc, zRet, ts /* "%s" */, libc.VaList(bp+8, (*IdxColumn)(unsafe.Pointer(p)).FzName))
  8036  	}
  8037  
  8038  	if sqlite3.Xsqlite3_stricmp(tls, (*IdxColumn)(unsafe.Pointer(p)).FzColl, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl) != 0 {
  8039  		if idxIdentifierRequiresQuotes(tls, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl) != 0 {
  8040  			zRet = idxAppendText(tls, pRc, zRet, ts+96 /* " COLLATE %Q" */, libc.VaList(bp+16, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl))
  8041  		} else {
  8042  			zRet = idxAppendText(tls, pRc, zRet, ts+108 /* " COLLATE %s" */, libc.VaList(bp+24, (*IdxConstraint)(unsafe.Pointer(pCons)).FzColl))
  8043  		}
  8044  	}
  8045  
  8046  	if (*IdxConstraint)(unsafe.Pointer(pCons)).FbDesc != 0 {
  8047  		zRet = idxAppendText(tls, pRc, zRet, ts+120 /* " DESC" */, 0)
  8048  	}
  8049  	return zRet
  8050  }
  8051  
  8052  // Search database dbm for an index compatible with the one idxCreateFromCons()
  8053  // would create from arguments pScan, pEq and pTail. If no error occurs and
  8054  // such an index is found, return non-zero. Or, if no such index is found,
  8055  // return zero.
  8056  //
  8057  // If an error occurs, set *pRc to an SQLite error code and return zero.
  8058  func idxFindCompatible(tls *libc.TLS, pRc uintptr, dbm uintptr, pScan uintptr, pEq uintptr, pTail uintptr) int32 { /* sqlite3expert.c:846:12: */
  8059  	bp := tls.Alloc(28)
  8060  	defer tls.Free(28)
  8061  
  8062  	var zTbl uintptr = (*IdxTable)(unsafe.Pointer((*IdxScan)(unsafe.Pointer(pScan)).FpTab)).FzName
  8063  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)) = uintptr(0)
  8064  	var pIter uintptr
  8065  	var nEq int32 = 0 // Number of elements in pEq
  8066  	// var rc int32 at bp+24, 4
  8067  
  8068  	// Count the elements in list pEq
  8069  	for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  8070  		nEq++
  8071  	}
  8072  
  8073  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+16 /* &pIdxList */, uintptr(0), ts+126 /* "PRAGMA index_lis..." */, libc.VaList(bp, zTbl))
  8074  	for (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */))) == SQLITE_ROW) {
  8075  		var bMatch int32 = 1
  8076  		var pT uintptr = pTail
  8077  		*(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */)) = uintptr(0)
  8078  		var zIdx uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)), 1)
  8079  
  8080  		// Zero the IdxConstraint.bFlag values in the pEq list
  8081  		for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  8082  			(*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag = 0
  8083  		}
  8084  
  8085  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+20 /* &pInfo */, uintptr(0), ts+147 /* "PRAGMA index_xIn..." */, libc.VaList(bp+8, zIdx))
  8086  		for (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */))) == SQLITE_ROW) {
  8087  			var iIdx int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */)), 0)
  8088  			var iCol int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */)), 1)
  8089  			var zColl uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */)), 4)
  8090  
  8091  			if iIdx < nEq {
  8092  				for pIter = pEq; pIter != 0; pIter = (*IdxConstraint)(unsafe.Pointer(pIter)).FpLink {
  8093  					if (*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag != 0 {
  8094  						continue
  8095  					}
  8096  					if (*IdxConstraint)(unsafe.Pointer(pIter)).FiCol != iCol {
  8097  						continue
  8098  					}
  8099  					if sqlite3.Xsqlite3_stricmp(tls, (*IdxConstraint)(unsafe.Pointer(pIter)).FzColl, zColl) != 0 {
  8100  						continue
  8101  					}
  8102  					(*IdxConstraint)(unsafe.Pointer(pIter)).FbFlag = 1
  8103  					break
  8104  				}
  8105  				if pIter == uintptr(0) {
  8106  					bMatch = 0
  8107  					break
  8108  				}
  8109  			} else {
  8110  				if pT != 0 {
  8111  					if ((*IdxConstraint)(unsafe.Pointer(pT)).FiCol != iCol) || (sqlite3.Xsqlite3_stricmp(tls, (*IdxConstraint)(unsafe.Pointer(pT)).FzColl, zColl) != 0) {
  8112  						bMatch = 0
  8113  						break
  8114  					}
  8115  					pT = (*IdxConstraint)(unsafe.Pointer(pT)).FpLink
  8116  				}
  8117  			}
  8118  		}
  8119  		idxFinalize(tls, bp+24 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 20 /* pInfo */)))
  8120  
  8121  		if (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && (bMatch != 0) {
  8122  			sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)))
  8123  			return 1
  8124  		}
  8125  	}
  8126  	idxFinalize(tls, bp+24 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 16 /* pIdxList */)))
  8127  
  8128  	*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
  8129  	return 0
  8130  }
  8131  
  8132  func idxCreateFromCons(tls *libc.TLS, p uintptr, pScan uintptr, pEq uintptr, pTail uintptr) int32 { /* sqlite3expert.c:913:12: */
  8133  	bp := tls.Alloc(44)
  8134  	defer tls.Free(44)
  8135  
  8136  	var dbm uintptr = (*sqlite3expert)(unsafe.Pointer(p)).Fdbm
  8137  	*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK
  8138  	if ((pEq != 0) || (pTail != 0)) && (0 == idxFindCompatible(tls, bp+40 /* &rc */, dbm, pScan, pEq, pTail)) {
  8139  		var pTab uintptr = (*IdxScan)(unsafe.Pointer(pScan)).FpTab
  8140  		var zCols uintptr = uintptr(0)
  8141  		var zIdx uintptr = uintptr(0)
  8142  		var pCons uintptr
  8143  		var h uint32 = uint32(0)
  8144  		var zFmt uintptr
  8145  
  8146  		for pCons = pEq; pCons != 0; pCons = (*IdxConstraint)(unsafe.Pointer(pCons)).FpLink {
  8147  			zCols = idxAppendColDefn(tls, bp+40 /* &rc */, zCols, pTab, pCons)
  8148  		}
  8149  		for pCons = pTail; pCons != 0; pCons = (*IdxConstraint)(unsafe.Pointer(pCons)).FpLink {
  8150  			zCols = idxAppendColDefn(tls, bp+40 /* &rc */, zCols, pTab, pCons)
  8151  		}
  8152  
  8153  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
  8154  			// Hash the list of columns to come up with a name for the index
  8155  			var zTable uintptr = (*IdxTable)(unsafe.Pointer((*IdxScan)(unsafe.Pointer(pScan)).FpTab)).FzName
  8156  			var zName uintptr // Index name
  8157  			var i int32
  8158  			for i = 0; *(*int8)(unsafe.Pointer(zCols + uintptr(i))) != 0; i++ {
  8159  				h = h + ((h << 3) + uint32(*(*int8)(unsafe.Pointer(zCols + uintptr(i)))))
  8160  			}
  8161  			zName = sqlite3.Xsqlite3_mprintf(tls, ts+169 /* "%s_idx_%08x" */, libc.VaList(bp, zTable, h))
  8162  			if zName == uintptr(0) {
  8163  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
  8164  			} else {
  8165  				if idxIdentifierRequiresQuotes(tls, zTable) != 0 {
  8166  					zFmt = ts + 181 /* "CREATE INDEX '%q..." */
  8167  				} else {
  8168  					zFmt = ts + 209 /* "CREATE INDEX %s ..." */
  8169  				}
  8170  				zIdx = sqlite3.Xsqlite3_mprintf(tls, zFmt, libc.VaList(bp+16, zName, zTable, zCols))
  8171  				if !(zIdx != 0) {
  8172  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
  8173  				} else {
  8174  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3.Xsqlite3_exec(tls, dbm, zIdx, uintptr(0), uintptr(0), (*sqlite3expert)(unsafe.Pointer(p)).FpzErrmsg)
  8175  					idxHashAdd(tls, bp+40 /* &rc */, (p + 44 /* &.hIdx */), zName, zIdx)
  8176  				}
  8177  				sqlite3.Xsqlite3_free(tls, zName)
  8178  				sqlite3.Xsqlite3_free(tls, zIdx)
  8179  			}
  8180  		}
  8181  
  8182  		sqlite3.Xsqlite3_free(tls, zCols)
  8183  	}
  8184  	return *(*int32)(unsafe.Pointer(bp + 40 /* rc */))
  8185  }
  8186  
  8187  // Return true if list pList (linked by IdxConstraint.pLink) contains
  8188  // a constraint compatible with *p. Otherwise return false.
  8189  func idxFindConstraint(tls *libc.TLS, pList uintptr, p uintptr) int32 { /* sqlite3expert.c:974:12: */
  8190  	var pCmp uintptr
  8191  	for pCmp = pList; pCmp != 0; pCmp = (*IdxConstraint)(unsafe.Pointer(pCmp)).FpLink {
  8192  		if (*IdxConstraint)(unsafe.Pointer(p)).FiCol == (*IdxConstraint)(unsafe.Pointer(pCmp)).FiCol {
  8193  			return 1
  8194  		}
  8195  	}
  8196  	return 0
  8197  }
  8198  
  8199  func idxCreateFromWhere(tls *libc.TLS, p uintptr, pScan uintptr, pTail uintptr) int32 { /* sqlite3expert.c:982:12: */
  8200  	var p1 uintptr = uintptr(0)
  8201  	var pCon uintptr
  8202  	var rc int32
  8203  
  8204  	// Gather up all the == constraints.
  8205  	for pCon = (*IdxScan)(unsafe.Pointer(pScan)).FpEq; pCon != 0; pCon = (*IdxConstraint)(unsafe.Pointer(pCon)).FpNext {
  8206  		if !(idxFindConstraint(tls, p1, pCon) != 0) && !(idxFindConstraint(tls, pTail, pCon) != 0) {
  8207  			(*IdxConstraint)(unsafe.Pointer(pCon)).FpLink = p1
  8208  			p1 = pCon
  8209  		}
  8210  	}
  8211  
  8212  	// Create an index using the == constraints collected above. And the
  8213  	// range constraint/ORDER BY terms passed in by the caller, if any.
  8214  	rc = idxCreateFromCons(tls, p, pScan, p1, pTail)
  8215  
  8216  	// If no range/ORDER BY passed by the caller, create a version of the
  8217  	// index for each range constraint.
  8218  	if pTail == uintptr(0) {
  8219  		for pCon = (*IdxScan)(unsafe.Pointer(pScan)).FpRange; (rc == SQLITE_OK) && (pCon != 0); pCon = (*IdxConstraint)(unsafe.Pointer(pCon)).FpNext {
  8220  
  8221  			if !(idxFindConstraint(tls, p1, pCon) != 0) && !(idxFindConstraint(tls, pTail, pCon) != 0) {
  8222  				rc = idxCreateFromCons(tls, p, pScan, p1, pCon)
  8223  			}
  8224  		}
  8225  	}
  8226  
  8227  	return rc
  8228  }
  8229  
  8230  // Create candidate indexes in database [dbm] based on the data in
  8231  // linked-list pScan.
  8232  func idxCreateCandidates(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:1021:12: */
  8233  	var rc int32 = SQLITE_OK
  8234  	var pIter uintptr
  8235  
  8236  	for pIter = (*sqlite3expert)(unsafe.Pointer(p)).FpScan; (pIter != 0) && (rc == SQLITE_OK); pIter = (*IdxScan)(unsafe.Pointer(pIter)).FpNextScan {
  8237  		rc = idxCreateFromWhere(tls, p, pIter, uintptr(0))
  8238  		if (rc == SQLITE_OK) && ((*IdxScan)(unsafe.Pointer(pIter)).FpOrder != 0) {
  8239  			rc = idxCreateFromWhere(tls, p, pIter, (*IdxScan)(unsafe.Pointer(pIter)).FpOrder)
  8240  		}
  8241  	}
  8242  
  8243  	return rc
  8244  }
  8245  
  8246  // Free all elements of the linked list starting at pConstraint.
  8247  func idxConstraintFree(tls *libc.TLS, pConstraint uintptr) { /* sqlite3expert.c:1038:13: */
  8248  	var pNext uintptr
  8249  	var p uintptr
  8250  
  8251  	for p = pConstraint; p != 0; p = pNext {
  8252  		pNext = (*IdxConstraint)(unsafe.Pointer(p)).FpNext
  8253  		sqlite3.Xsqlite3_free(tls, p)
  8254  	}
  8255  }
  8256  
  8257  // Free all elements of the linked list starting from pScan up until pLast
  8258  // (pLast is not freed).
  8259  func idxScanFree(tls *libc.TLS, pScan uintptr, pLast uintptr) { /* sqlite3expert.c:1052:13: */
  8260  	var p uintptr
  8261  	var pNext uintptr
  8262  	for p = pScan; p != pLast; p = pNext {
  8263  		pNext = (*IdxScan)(unsafe.Pointer(p)).FpNextScan
  8264  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpOrder)
  8265  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpEq)
  8266  		idxConstraintFree(tls, (*IdxScan)(unsafe.Pointer(p)).FpRange)
  8267  		sqlite3.Xsqlite3_free(tls, p)
  8268  	}
  8269  }
  8270  
  8271  // Free all elements of the linked list starting from pStatement up
  8272  // until pLast (pLast is not freed).
  8273  func idxStatementFree(tls *libc.TLS, pStatement uintptr, pLast uintptr) { /* sqlite3expert.c:1068:13: */
  8274  	var p uintptr
  8275  	var pNext uintptr
  8276  	for p = pStatement; p != pLast; p = pNext {
  8277  		pNext = (*IdxStatement)(unsafe.Pointer(p)).FpNext
  8278  		sqlite3.Xsqlite3_free(tls, (*IdxStatement)(unsafe.Pointer(p)).FzEQP)
  8279  		sqlite3.Xsqlite3_free(tls, (*IdxStatement)(unsafe.Pointer(p)).FzIdx)
  8280  		sqlite3.Xsqlite3_free(tls, p)
  8281  	}
  8282  }
  8283  
  8284  // Free the linked list of IdxTable objects starting at pTab.
  8285  func idxTableFree(tls *libc.TLS, pTab uintptr) { /* sqlite3expert.c:1082:13: */
  8286  	var pIter uintptr
  8287  	var pNext uintptr
  8288  	for pIter = pTab; pIter != 0; pIter = pNext {
  8289  		pNext = (*IdxTable)(unsafe.Pointer(pIter)).FpNext
  8290  		sqlite3.Xsqlite3_free(tls, pIter)
  8291  	}
  8292  }
  8293  
  8294  // Free the linked list of IdxWrite objects starting at pTab.
  8295  func idxWriteFree(tls *libc.TLS, pTab uintptr) { /* sqlite3expert.c:1094:13: */
  8296  	var pIter uintptr
  8297  	var pNext uintptr
  8298  	for pIter = pTab; pIter != 0; pIter = pNext {
  8299  		pNext = (*IdxWrite)(unsafe.Pointer(pIter)).FpNext
  8300  		sqlite3.Xsqlite3_free(tls, pIter)
  8301  	}
  8302  }
  8303  
  8304  // This function is called after candidate indexes have been created. It
  8305  // runs all the queries to see which indexes they prefer, and populates
  8306  // IdxStatement.zIdx and IdxStatement.zEQP with the results.
  8307  func idxFindIndexes(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1110:5: */
  8308  	bp := tls.Alloc(4128)
  8309  	defer tls.Free(4128)
  8310  
  8311  	var pStmt uintptr
  8312  	var dbm uintptr
  8313  	// var rc int32 at bp+4124, 4
  8314  
  8315  	// var hIdx IdxHash at bp+24, 4096
  8316  
  8317  	var zSql uintptr
  8318  	var nIdx int32
  8319  	var zIdx uintptr
  8320  	// int iId = sqlite3_column_int(pExplain, 0);
  8321  	// int iParent = sqlite3_column_int(pExplain, 1);
  8322  	// int iNotUsed = sqlite3_column_int(pExplain, 2);
  8323  	var zDetail uintptr
  8324  	var nDetail int32
  8325  	var i int32
  8326  	var pEntry uintptr
  8327  	// var pExplain uintptr at bp+4120, 4
  8328  	dbm = (*sqlite3expert)(unsafe.Pointer(p)).Fdbm
  8329  	*(*int32)(unsafe.Pointer(bp + 4124 /* rc */)) = SQLITE_OK
  8330  	idxHashInit(tls, bp+24 /* &hIdx */)
  8331  
  8332  	pStmt = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  8333  __1:
  8334  	if !((*(*int32)(unsafe.Pointer(bp + 4124 /* rc */)) == SQLITE_OK) && (pStmt != 0)) {
  8335  		goto __3
  8336  	}
  8337  	*(*uintptr)(unsafe.Pointer(bp + 4120 /* pExplain */)) = uintptr(0)
  8338  	idxHashClear(tls, bp+24 /* &hIdx */)
  8339  	*(*int32)(unsafe.Pointer(bp + 4124 /* rc */)) = idxPrintfPrepareStmt(tls, dbm, bp+4120 /* &pExplain */, pzErr,
  8340  		ts+235 /* "EXPLAIN QUERY PL..." */, libc.VaList(bp, (*IdxStatement)(unsafe.Pointer(pStmt)).FzSql))
  8341  __4:
  8342  	if !((*(*int32)(unsafe.Pointer(bp + 4124 /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 4120 /* pExplain */))) == SQLITE_ROW)) {
  8343  		goto __5
  8344  	}
  8345  	// int iId = sqlite3_column_int(pExplain, 0);
  8346  	// int iParent = sqlite3_column_int(pExplain, 1);
  8347  	// int iNotUsed = sqlite3_column_int(pExplain, 2);
  8348  	zDetail = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 4120 /* pExplain */)), 3)
  8349  
  8350  	if !(!(zDetail != 0)) {
  8351  		goto __6
  8352  	}
  8353  	goto __4
  8354  __6:
  8355  	;
  8356  	nDetail = int32(libc.Xstrlen(tls, zDetail))
  8357  
  8358  	i = 0
  8359  __7:
  8360  	if !(i < nDetail) {
  8361  		goto __9
  8362  	}
  8363  	zIdx = uintptr(0)
  8364  	if !(((i + 13) < nDetail) && (libc.Xmemcmp(tls, (zDetail+uintptr(i)), ts+257 /* " USING INDEX " */, uint32(13)) == 0)) {
  8365  		goto __10
  8366  	}
  8367  	zIdx = (zDetail + uintptr((i + 13)))
  8368  	goto __11
  8369  __10:
  8370  	if !(((i + 22) < nDetail) &&
  8371  		(libc.Xmemcmp(tls, (zDetail+uintptr(i)), ts+271 /* " USING COVERING ..." */, uint32(22)) == 0)) {
  8372  		goto __12
  8373  	}
  8374  	zIdx = (zDetail + uintptr((i + 22)))
  8375  __12:
  8376  	;
  8377  __11:
  8378  	;
  8379  	if !(zIdx != 0) {
  8380  		goto __13
  8381  	}
  8382  	nIdx = 0
  8383  __14:
  8384  	if !((int32(*(*int8)(unsafe.Pointer(zIdx + uintptr(nIdx)))) != 0) && ((int32(*(*int8)(unsafe.Pointer(zIdx + uintptr(nIdx)))) != ' ') || (int32(*(*int8)(unsafe.Pointer(zIdx + uintptr((nIdx + 1))))) != '('))) {
  8385  		goto __15
  8386  	}
  8387  	nIdx++
  8388  	goto __14
  8389  __15:
  8390  	;
  8391  	zSql = idxHashSearch(tls, (p + 44 /* &.hIdx */), zIdx, nIdx)
  8392  	if !(zSql != 0) {
  8393  		goto __16
  8394  	}
  8395  	idxHashAdd(tls, bp+4124 /* &rc */, bp+24 /* &hIdx */, zSql, uintptr(0))
  8396  	if !(*(*int32)(unsafe.Pointer(bp + 4124 /* rc */)) != 0) {
  8397  		goto __17
  8398  	}
  8399  	goto find_indexes_out
  8400  __17:
  8401  	;
  8402  __16:
  8403  	;
  8404  	goto __9
  8405  __13:
  8406  	;
  8407  	goto __8
  8408  __8:
  8409  	i++
  8410  	goto __7
  8411  	goto __9
  8412  __9:
  8413  	;
  8414  
  8415  	if !(int32(*(*int8)(unsafe.Pointer(zDetail))) != '-') {
  8416  		goto __18
  8417  	}
  8418  	(*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP = idxAppendText(tls, bp+4124 /* &rc */, (*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP, ts+294 /* "%s\n" */, libc.VaList(bp+8, zDetail))
  8419  __18:
  8420  	;
  8421  	goto __4
  8422  __5:
  8423  	;
  8424  
  8425  	pEntry = (*IdxHash)(unsafe.Pointer(bp + 24 /* &hIdx */)).FpFirst
  8426  __19:
  8427  	if !(pEntry != 0) {
  8428  		goto __21
  8429  	}
  8430  	(*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx = idxAppendText(tls, bp+4124 /* &rc */, (*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx, ts+298 /* "%s;\n" */, libc.VaList(bp+16, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzKey))
  8431  	goto __20
  8432  __20:
  8433  	pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext
  8434  	goto __19
  8435  	goto __21
  8436  __21:
  8437  	;
  8438  
  8439  	idxFinalize(tls, bp+4124 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 4120 /* pExplain */)))
  8440  	goto __2
  8441  __2:
  8442  	pStmt = (*IdxStatement)(unsafe.Pointer(pStmt)).FpNext
  8443  	goto __1
  8444  	goto __3
  8445  __3:
  8446  	;
  8447  
  8448  find_indexes_out:
  8449  	idxHashClear(tls, bp+24 /* &hIdx */)
  8450  	return *(*int32)(unsafe.Pointer(bp + 4124 /* rc */))
  8451  }
  8452  
  8453  func idxAuthCallback(tls *libc.TLS, pCtx uintptr, eOp int32, z3 uintptr, z4 uintptr, zDb uintptr, zTrigger uintptr) int32 { /* sqlite3expert.c:1180:12: */
  8454  	bp := tls.Alloc(4)
  8455  	defer tls.Free(4)
  8456  
  8457  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
  8458  	_ = z4
  8459  	_ = zTrigger
  8460  	if ((eOp == SQLITE_INSERT) || (eOp == SQLITE_UPDATE)) || (eOp == SQLITE_DELETE) {
  8461  		if sqlite3.Xsqlite3_stricmp(tls, zDb, ts+85 /* "main" */) == 0 {
  8462  			var p uintptr = pCtx
  8463  			var pTab uintptr
  8464  			for pTab = (*sqlite3expert)(unsafe.Pointer(p)).FpTable; pTab != 0; pTab = (*IdxTable)(unsafe.Pointer(pTab)).FpNext {
  8465  				if 0 == sqlite3.Xsqlite3_stricmp(tls, z3, (*IdxTable)(unsafe.Pointer(pTab)).FzName) {
  8466  					break
  8467  				}
  8468  			}
  8469  			if pTab != 0 {
  8470  				var pWrite uintptr
  8471  				for pWrite = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite; pWrite != 0; pWrite = (*IdxWrite)(unsafe.Pointer(pWrite)).FpNext {
  8472  					if ((*IdxWrite)(unsafe.Pointer(pWrite)).FpTab == pTab) && ((*IdxWrite)(unsafe.Pointer(pWrite)).FeOp == eOp) {
  8473  						break
  8474  					}
  8475  				}
  8476  				if pWrite == uintptr(0) {
  8477  					pWrite = idxMalloc(tls, bp /* &rc */, int32(unsafe.Sizeof(IdxWrite{})))
  8478  					if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
  8479  						(*IdxWrite)(unsafe.Pointer(pWrite)).FpTab = pTab
  8480  						(*IdxWrite)(unsafe.Pointer(pWrite)).FeOp = eOp
  8481  						(*IdxWrite)(unsafe.Pointer(pWrite)).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  8482  						(*sqlite3expert)(unsafe.Pointer(p)).FpWrite = pWrite
  8483  					}
  8484  				}
  8485  			}
  8486  		}
  8487  	}
  8488  	return *(*int32)(unsafe.Pointer(bp /* rc */))
  8489  }
  8490  
  8491  func idxProcessOneTrigger(tls *libc.TLS, p uintptr, pWrite uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1218:12: */
  8492  	bp := tls.Alloc(92)
  8493  	defer tls.Free(92)
  8494  
  8495  	var pTab uintptr = (*IdxWrite)(unsafe.Pointer(pWrite)).FpTab
  8496  	var zTab uintptr = (*IdxTable)(unsafe.Pointer(pTab)).FzName
  8497  	var zSql uintptr = ts + 303 /* "SELECT 'CREATE T..." */
  8498  	*(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)) = uintptr(0)
  8499  	*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = SQLITE_OK
  8500  	var zWrite uintptr = uintptr(0)
  8501  
  8502  	// Create the table and its triggers in the temp schema
  8503  	*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, bp+80 /* &pSelect */, pzErr, zSql, libc.VaList(bp, zTab, zTab))
  8504  	for (*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)))) {
  8505  		var zCreate uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)), 0)
  8506  		*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zCreate, uintptr(0), uintptr(0), pzErr)
  8507  	}
  8508  	idxFinalize(tls, bp+84 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 80 /* pSelect */)))
  8509  
  8510  	// Rename the table in the temp schema to zInt
  8511  	if *(*int32)(unsafe.Pointer(bp + 84 /* rc */)) == SQLITE_OK {
  8512  		var z uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+429 /* "ALTER TABLE temp..." */, libc.VaList(bp+16, zTab, zInt))
  8513  		if z == uintptr(0) {
  8514  			*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = SQLITE_NOMEM
  8515  		} else {
  8516  			*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, z, uintptr(0), uintptr(0), pzErr)
  8517  			sqlite3.Xsqlite3_free(tls, z)
  8518  		}
  8519  	}
  8520  
  8521  	switch (*IdxWrite)(unsafe.Pointer(pWrite)).FeOp {
  8522  	case SQLITE_INSERT:
  8523  		{
  8524  			var i int32
  8525  			zWrite = idxAppendText(tls, bp+84 /* &rc */, zWrite, ts+462 /* "INSERT INTO %Q V..." */, libc.VaList(bp+32, zInt))
  8526  			for i = 0; i < (*IdxTable)(unsafe.Pointer(pTab)).FnCol; i++ {
  8527  				zWrite = idxAppendText(tls, bp+84 /* &rc */, zWrite, ts+485 /* "%s?" */, libc.VaList(bp+40, func() uintptr {
  8528  					if i == 0 {
  8529  						return ts + 489 /* "" */
  8530  					}
  8531  					return ts + 90 /* ", " */
  8532  				}()))
  8533  			}
  8534  			zWrite = idxAppendText(tls, bp+84 /* &rc */, zWrite, ts+490 /* ")" */, 0)
  8535  			break
  8536  
  8537  		}
  8538  	case SQLITE_UPDATE:
  8539  		{
  8540  			var i int32
  8541  			zWrite = idxAppendText(tls, bp+84 /* &rc */, zWrite, ts+492 /* "UPDATE %Q SET " */, libc.VaList(bp+48, zInt))
  8542  			for i = 0; i < (*IdxTable)(unsafe.Pointer(pTab)).FnCol; i++ {
  8543  				zWrite = idxAppendText(tls, bp+84 /* &rc */, zWrite, ts+507 /* "%s%Q=?" */, libc.VaList(bp+56, func() uintptr {
  8544  					if i == 0 {
  8545  						return ts + 489 /* "" */
  8546  					}
  8547  					return ts + 90 /* ", " */
  8548  				}(),
  8549  					(*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(pTab)).FaCol+uintptr(i)*12)).FzName))
  8550  			}
  8551  			break
  8552  
  8553  		}
  8554  	default:
  8555  		{
  8556  
  8557  			if *(*int32)(unsafe.Pointer(bp + 84 /* rc */)) == SQLITE_OK {
  8558  				zWrite = sqlite3.Xsqlite3_mprintf(tls, ts+514 /* "DELETE FROM %Q" */, libc.VaList(bp+72, zInt))
  8559  				if zWrite == uintptr(0) {
  8560  					*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = SQLITE_NOMEM
  8561  				}
  8562  			}
  8563  
  8564  		}
  8565  	}
  8566  
  8567  	if *(*int32)(unsafe.Pointer(bp + 84 /* rc */)) == SQLITE_OK {
  8568  		*(*uintptr)(unsafe.Pointer(bp + 88 /* pX */)) = uintptr(0)
  8569  		*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = sqlite3.Xsqlite3_prepare_v2(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zWrite, -1, bp+88 /* &pX */, uintptr(0))
  8570  		idxFinalize(tls, bp+84 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 88 /* pX */)))
  8571  		if *(*int32)(unsafe.Pointer(bp + 84 /* rc */)) != SQLITE_OK {
  8572  			idxDatabaseError(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, pzErr)
  8573  		}
  8574  	}
  8575  	sqlite3.Xsqlite3_free(tls, zWrite)
  8576  
  8577  	if *(*int32)(unsafe.Pointer(bp + 84 /* rc */)) == SQLITE_OK {
  8578  		*(*int32)(unsafe.Pointer(bp + 84 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zDrop, uintptr(0), uintptr(0), pzErr)
  8579  	}
  8580  
  8581  	return *(*int32)(unsafe.Pointer(bp + 84 /* rc */))
  8582  }
  8583  
  8584  var zInt uintptr = ts + 529  /* "t592690916721053..." */ /* sqlite3expert.c:1223:21 */
  8585  var zDrop uintptr = ts + 567 /* "DROP TABLE t5926..." */ /* sqlite3expert.c:1224:21 */
  8586  
  8587  func idxProcessTriggers(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1300:12: */
  8588  	var rc int32 = SQLITE_OK
  8589  	var pEnd uintptr = uintptr(0)
  8590  	var pFirst uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  8591  
  8592  	for (rc == SQLITE_OK) && (pFirst != pEnd) {
  8593  		var pIter uintptr
  8594  		for pIter = pFirst; (rc == SQLITE_OK) && (pIter != pEnd); pIter = (*IdxWrite)(unsafe.Pointer(pIter)).FpNext {
  8595  			rc = idxProcessOneTrigger(tls, p, pIter, pzErr)
  8596  		}
  8597  		pEnd = pFirst
  8598  		pFirst = (*sqlite3expert)(unsafe.Pointer(p)).FpWrite
  8599  	}
  8600  
  8601  	return rc
  8602  }
  8603  
  8604  func idxCreateVtabSchema(tls *libc.TLS, p uintptr, pzErrmsg uintptr) int32 { /* sqlite3expert.c:1318:12: */
  8605  	bp := tls.Alloc(52)
  8606  	defer tls.Free(52)
  8607  
  8608  	*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = idxRegisterVtab(tls, p)
  8609  	*(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)) = uintptr(0)
  8610  
  8611  	// For each table in the main db schema:
  8612  	//
  8613  	//   1) Add an entry to the p->pTable list, and
  8614  	//   2) Create the equivalent virtual table in dbv.
  8615  	*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, bp+40 /* &pSchema */, pzErrmsg,
  8616  
  8617  		ts+616 /* "SELECT type, nam..." */)
  8618  	for (*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)))) {
  8619  		var zType uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 0)
  8620  		var zName uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 1)
  8621  		var zSql uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)), 2)
  8622  
  8623  		if (int32(*(*int8)(unsafe.Pointer(zType))) == 'v') || (int32(*(*int8)(unsafe.Pointer(zType + 1))) == 'r') {
  8624  			*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zSql, uintptr(0), uintptr(0), pzErrmsg)
  8625  		} else {
  8626  			// var pTab uintptr at bp+44, 4
  8627  
  8628  			*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = idxGetTableInfo(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, zName, bp+44 /* &pTab */, pzErrmsg)
  8629  			if *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK {
  8630  				var i int32
  8631  				var zInner uintptr = uintptr(0)
  8632  				var zOuter uintptr = uintptr(0)
  8633  				(*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* pTab */)))).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpTable
  8634  				(*sqlite3expert)(unsafe.Pointer(p)).FpTable = *(*uintptr)(unsafe.Pointer(bp + 44 /* pTab */))
  8635  
  8636  				// The statement the vtab will pass to sqlite3_declare_vtab()
  8637  				zInner = idxAppendText(tls, bp+48 /* &rc */, uintptr(0), ts+884 /* "CREATE TABLE x(" */, 0)
  8638  				for i = 0; i < (*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* pTab */)))).FnCol; i++ {
  8639  					zInner = idxAppendText(tls, bp+48 /* &rc */, zInner, ts+900, /* "%s%Q COLLATE %s" */
  8640  						libc.VaList(bp, func() uintptr {
  8641  							if i == 0 {
  8642  								return ts + 489 /* "" */
  8643  							}
  8644  							return ts + 90 /* ", " */
  8645  						}(), (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* pTab */)))).FaCol+uintptr(i)*12)).FzName, (*IdxColumn)(unsafe.Pointer((*IdxTable)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* pTab */)))).FaCol+uintptr(i)*12)).FzColl))
  8646  				}
  8647  				zInner = idxAppendText(tls, bp+48 /* &rc */, zInner, ts+490 /* ")" */, 0)
  8648  
  8649  				// The CVT statement to create the vtab
  8650  				zOuter = idxAppendText(tls, bp+48 /* &rc */, uintptr(0),
  8651  					ts+916 /* "CREATE VIRTUAL T..." */, libc.VaList(bp+24, zName, zInner))
  8652  				if *(*int32)(unsafe.Pointer(bp + 48 /* rc */)) == SQLITE_OK {
  8653  					*(*int32)(unsafe.Pointer(bp + 48 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zOuter, uintptr(0), uintptr(0), pzErrmsg)
  8654  				}
  8655  				sqlite3.Xsqlite3_free(tls, zInner)
  8656  				sqlite3.Xsqlite3_free(tls, zOuter)
  8657  			}
  8658  		}
  8659  	}
  8660  	idxFinalize(tls, bp+48 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 40 /* pSchema */)))
  8661  	return *(*int32)(unsafe.Pointer(bp + 48 /* rc */))
  8662  }
  8663  
  8664  type IdxSampleCtx = struct {
  8665  	FiTarget int32
  8666  	_        [4]byte
  8667  	Ftarget  float64
  8668  	FnRow    float64
  8669  	FnRet    float64
  8670  } /* sqlite3expert.c:1378:1 */
  8671  
  8672  func idxSampleFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* sqlite3expert.c:1385:13: */
  8673  	bp := tls.Alloc(2)
  8674  	defer tls.Free(2)
  8675  
  8676  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
  8677  	var bRet int32
  8678  
  8679  	_ = argv
  8680  
  8681  	if (*IdxSampleCtx)(unsafe.Pointer(p)).FnRow == 0.0 {
  8682  		bRet = 1
  8683  	} else {
  8684  		bRet = (libc.Bool32(((*IdxSampleCtx)(unsafe.Pointer(p)).FnRet / (*IdxSampleCtx)(unsafe.Pointer(p)).FnRow) <= (*IdxSampleCtx)(unsafe.Pointer(p)).Ftarget))
  8685  		if bRet == 0 {
  8686  			// var rnd uint16 at bp, 2
  8687  
  8688  			sqlite3.Xsqlite3_randomness(tls, 2, bp /* &rnd */)
  8689  			bRet = (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(bp /* rnd */))) % 100) <= (*IdxSampleCtx)(unsafe.Pointer(p)).FiTarget))
  8690  		}
  8691  	}
  8692  
  8693  	sqlite3.Xsqlite3_result_int(tls, pCtx, bRet)
  8694  	*(*float64)(unsafe.Pointer(p + 16 /* &.nRow */)) += (1.0)
  8695  	*(*float64)(unsafe.Pointer(p + 24 /* &.nRet */)) += (float64(bRet))
  8696  }
  8697  
  8698  type IdxRemCtx = struct {
  8699  	FnSlot int32
  8700  	_      [4]byte
  8701  	FaSlot [1]struct {
  8702  		FeType int32
  8703  		_      [4]byte
  8704  		FiVal  i64
  8705  		FrVal  float64
  8706  		FnByte int32
  8707  		Fn     int32
  8708  		Fz     uintptr
  8709  		_      [4]byte
  8710  	}
  8711  } /* sqlite3expert.c:1411:1 */
  8712  
  8713  type IdxRemSlot = struct {
  8714  	FeType int32
  8715  	_      [4]byte
  8716  	FiVal  i64
  8717  	FrVal  float64
  8718  	FnByte int32
  8719  	Fn     int32
  8720  	Fz     uintptr
  8721  	_      [4]byte
  8722  } /* sqlite3expert.c:1411:1 */
  8723  
  8724  // Implementation of scalar function rem().
  8725  func idxRemFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* sqlite3expert.c:1426:13: */
  8726  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
  8727  	var pSlot uintptr
  8728  	var iSlot int32
  8729  
  8730  	iSlot = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
  8731  
  8732  	pSlot = ((p + 8 /* &.aSlot */) + uintptr(iSlot)*40)
  8733  
  8734  	switch (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType {
  8735  	case SQLITE_NULL:
  8736  		// no-op
  8737  		break
  8738  
  8739  	case SQLITE_INTEGER:
  8740  		sqlite3.Xsqlite3_result_int64(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).FiVal)
  8741  		break
  8742  
  8743  	case SQLITE_FLOAT:
  8744  		sqlite3.Xsqlite3_result_double(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).FrVal)
  8745  		break
  8746  
  8747  	case SQLITE_BLOB:
  8748  		sqlite3.Xsqlite3_result_blob(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn, libc.UintptrFromInt32(-1))
  8749  		break
  8750  
  8751  	case SQLITE_TEXT:
  8752  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn, libc.UintptrFromInt32(-1))
  8753  		break
  8754  	}
  8755  
  8756  	(*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType = sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
  8757  	switch (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType {
  8758  	case SQLITE_NULL:
  8759  		// no-op
  8760  		break
  8761  
  8762  	case SQLITE_INTEGER:
  8763  		(*IdxRemSlot)(unsafe.Pointer(pSlot)).FiVal = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
  8764  		break
  8765  
  8766  	case SQLITE_FLOAT:
  8767  		(*IdxRemSlot)(unsafe.Pointer(pSlot)).FrVal = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
  8768  		break
  8769  
  8770  	case SQLITE_BLOB:
  8771  		fallthrough
  8772  	case SQLITE_TEXT:
  8773  		{
  8774  			var nByte int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
  8775  			if nByte > (*IdxRemSlot)(unsafe.Pointer(pSlot)).FnByte {
  8776  				var zNew uintptr = sqlite3.Xsqlite3_realloc(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, (nByte * 2))
  8777  				if zNew == uintptr(0) {
  8778  					sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
  8779  					return
  8780  				}
  8781  				(*IdxRemSlot)(unsafe.Pointer(pSlot)).FnByte = (nByte * 2)
  8782  				(*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz = zNew
  8783  			}
  8784  			(*IdxRemSlot)(unsafe.Pointer(pSlot)).Fn = nByte
  8785  			if (*IdxRemSlot)(unsafe.Pointer(pSlot)).FeType == SQLITE_BLOB {
  8786  				libc.Xmemcpy(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))), uint32(nByte))
  8787  			} else {
  8788  				libc.Xmemcpy(tls, (*IdxRemSlot)(unsafe.Pointer(pSlot)).Fz, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))), uint32(nByte))
  8789  			}
  8790  			break
  8791  
  8792  		}
  8793  	}
  8794  }
  8795  
  8796  func idxLargestIndex(tls *libc.TLS, db uintptr, pnMax uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1499:12: */
  8797  	bp := tls.Alloc(8)
  8798  	defer tls.Free(8)
  8799  
  8800  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK
  8801  	var zMax uintptr = ts + 957 /* "SELECT max(i.seq..." */
  8802  	*(*uintptr)(unsafe.Pointer(bp /* pMax */)) = uintptr(0)
  8803  
  8804  	*(*int32)(unsafe.Pointer(pnMax)) = 0
  8805  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, db, bp /* &pMax */, pzErr, zMax)
  8806  	if (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pMax */)))) {
  8807  		*(*int32)(unsafe.Pointer(pnMax)) = (sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pMax */)), 0) + 1)
  8808  	}
  8809  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp /* pMax */)))
  8810  
  8811  	return *(*int32)(unsafe.Pointer(bp + 4 /* rc */))
  8812  }
  8813  
  8814  func idxPopulateOneStat1(tls *libc.TLS, p uintptr, pIndexXInfo uintptr, pWriteStat uintptr, zTab uintptr, zIdx uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1519:12: */
  8815  	bp := tls.Alloc(120)
  8816  	defer tls.Free(120)
  8817  
  8818  	var zCols uintptr = uintptr(0)
  8819  	var zOrder uintptr = uintptr(0)
  8820  	var zQuery uintptr = uintptr(0)
  8821  	var nCol int32 = 0
  8822  	var i int32
  8823  	*(*uintptr)(unsafe.Pointer(bp + 116 /* pQuery */)) = uintptr(0)
  8824  	var aStat uintptr = uintptr(0)
  8825  	*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = SQLITE_OK
  8826  
  8827  	// Formulate the query text
  8828  	sqlite3.Xsqlite3_bind_text(tls, pIndexXInfo, 1, zIdx, -1, uintptr(0))
  8829  	for (SQLITE_OK == *(*int32)(unsafe.Pointer(bp + 112 /* rc */))) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pIndexXInfo)) {
  8830  		var zComma uintptr
  8831  		if zCols == uintptr(0) {
  8832  			zComma = ts + 489 /* "" */
  8833  		} else {
  8834  			zComma = ts + 90 /* ", " */
  8835  		}
  8836  		var zName uintptr = sqlite3.Xsqlite3_column_text(tls, pIndexXInfo, 0)
  8837  		var zColl uintptr = sqlite3.Xsqlite3_column_text(tls, pIndexXInfo, 1)
  8838  		zCols = idxAppendText(tls, bp+112 /* &rc */, zCols,
  8839  			ts+1094 /* "%sx.%Q IS rem(%d..." */, libc.VaList(bp, zComma, zName, nCol, zName, zColl))
  8840  		zOrder = idxAppendText(tls, bp+112 /* &rc */, zOrder, ts+1129 /* "%s%d" */, libc.VaList(bp+40, zComma, libc.PreIncInt32(&nCol, 1)))
  8841  	}
  8842  	sqlite3.Xsqlite3_reset(tls, pIndexXInfo)
  8843  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8844  		if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8845  			zQuery = sqlite3.Xsqlite3_mprintf(tls,
  8846  				ts+1134 /* "SELECT %s FROM %..." */, libc.VaList(bp+56, zCols, zTab, zOrder))
  8847  		} else {
  8848  			zQuery = sqlite3.Xsqlite3_mprintf(tls,
  8849  				ts+1166 /* "SELECT %s FROM t..." */, libc.VaList(bp+80, zCols, zOrder))
  8850  		}
  8851  	}
  8852  	sqlite3.Xsqlite3_free(tls, zCols)
  8853  	sqlite3.Xsqlite3_free(tls, zOrder)
  8854  
  8855  	// Formulate the query text
  8856  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8857  		var dbrem uintptr = func() uintptr {
  8858  			if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8859  				return (*sqlite3expert)(unsafe.Pointer(p)).Fdb
  8860  			}
  8861  			return (*sqlite3expert)(unsafe.Pointer(p)).Fdbv
  8862  		}()
  8863  		*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = idxPrepareStmt(tls, dbrem, bp+116 /* &pQuery */, pzErr, zQuery)
  8864  	}
  8865  	sqlite3.Xsqlite3_free(tls, zQuery)
  8866  
  8867  	if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8868  		aStat = idxMalloc(tls, bp+112 /* &rc */, (int32(uint32(unsafe.Sizeof(int32(0))) * (uint32(nCol + 1)))))
  8869  	}
  8870  	if (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 116 /* pQuery */)))) {
  8871  		var pEntry uintptr
  8872  		var zStat uintptr = uintptr(0)
  8873  		for i = 0; i <= nCol; i++ {
  8874  			*(*int32)(unsafe.Pointer(aStat + uintptr(i)*4)) = 1
  8875  		}
  8876  		for (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 116 /* pQuery */)))) {
  8877  			*(*int32)(unsafe.Pointer(aStat))++
  8878  			for i = 0; i < nCol; i++ {
  8879  				if sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 116 /* pQuery */)), i) == 0 {
  8880  					break
  8881  				}
  8882  			}
  8883  			for ; i < nCol; i++ {
  8884  				*(*int32)(unsafe.Pointer(aStat + uintptr((i+1))*4))++
  8885  			}
  8886  		}
  8887  
  8888  		if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8889  			var s0 int32 = *(*int32)(unsafe.Pointer(aStat))
  8890  			zStat = sqlite3.Xsqlite3_mprintf(tls, ts+1238 /* "%d" */, libc.VaList(bp+96, s0))
  8891  			if zStat == uintptr(0) {
  8892  				*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = SQLITE_NOMEM
  8893  			}
  8894  			for i = 1; (*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK) && (i <= nCol); i++ {
  8895  				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)))))
  8896  			}
  8897  		}
  8898  
  8899  		if *(*int32)(unsafe.Pointer(bp + 112 /* rc */)) == SQLITE_OK {
  8900  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 1, zTab, -1, uintptr(0))
  8901  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 2, zIdx, -1, uintptr(0))
  8902  			sqlite3.Xsqlite3_bind_text(tls, pWriteStat, 3, zStat, -1, uintptr(0))
  8903  			sqlite3.Xsqlite3_step(tls, pWriteStat)
  8904  			*(*int32)(unsafe.Pointer(bp + 112 /* rc */)) = sqlite3.Xsqlite3_reset(tls, pWriteStat)
  8905  		}
  8906  
  8907  		pEntry = idxHashFind(tls, (p + 44 /* &.hIdx */), zIdx, int32(libc.Xstrlen(tls, zIdx)))
  8908  		if pEntry != 0 {
  8909  
  8910  			(*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2 = zStat
  8911  		} else {
  8912  			sqlite3.Xsqlite3_free(tls, zStat)
  8913  		}
  8914  	}
  8915  	sqlite3.Xsqlite3_free(tls, aStat)
  8916  	idxFinalize(tls, bp+112 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 116 /* pQuery */)))
  8917  
  8918  	return *(*int32)(unsafe.Pointer(bp + 112 /* rc */))
  8919  }
  8920  
  8921  func idxBuildSampleTable(tls *libc.TLS, p uintptr, zTab uintptr) int32 { /* sqlite3expert.c:1619:12: */
  8922  	bp := tls.Alloc(8)
  8923  	defer tls.Free(8)
  8924  
  8925  	var rc int32
  8926  	var zSql uintptr
  8927  
  8928  	rc = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  8929  	if rc != SQLITE_OK {
  8930  		return rc
  8931  	}
  8932  
  8933  	zSql = sqlite3.Xsqlite3_mprintf(tls,
  8934  		ts+1309 /* "CREATE TABLE tem..." */, libc.VaList(bp, zTab))
  8935  	if zSql == uintptr(0) {
  8936  		return SQLITE_NOMEM
  8937  	}
  8938  	rc = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, zSql, uintptr(0), uintptr(0), uintptr(0))
  8939  	sqlite3.Xsqlite3_free(tls, zSql)
  8940  
  8941  	return rc
  8942  }
  8943  
  8944  // This function is called as part of sqlite3_expert_analyze(). Candidate
  8945  // indexes have already been created in database sqlite3expert.dbm, this
  8946  // function populates sqlite_stat1 table in the same database.
  8947  //
  8948  // The stat1 data is generated by querying the
  8949  func idxPopulateStat1(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1643:12: */
  8950  	bp := tls.Alloc(52)
  8951  	defer tls.Free(52)
  8952  
  8953  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = SQLITE_OK
  8954  	*(*int32)(unsafe.Pointer(bp /* nMax */)) = 0
  8955  	var pCtx uintptr = uintptr(0)
  8956  	// var samplectx IdxSampleCtx at bp+8, 32
  8957  
  8958  	var i int32
  8959  	var iPrev i64 = int64(-100000)
  8960  	*(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)) = uintptr(0)
  8961  	*(*uintptr)(unsafe.Pointer(bp + 44 /* pIndexXInfo */)) = uintptr(0)
  8962  	*(*uintptr)(unsafe.Pointer(bp + 48 /* pWrite */)) = uintptr(0)
  8963  
  8964  	var zAllIndex uintptr = ts + 1385   /* "SELECT s.rowid, ..." */
  8965  	var zIndexXInfo uintptr = ts + 1499 /* "SELECT name, col..." */
  8966  	var zWrite uintptr = ts + 1554      /* "INSERT INTO sqli..." */
  8967  
  8968  	// If iSample==0, no sqlite_stat1 data is required.
  8969  	if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 0 {
  8970  		return SQLITE_OK
  8971  	}
  8972  
  8973  	*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxLargestIndex(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp /* &nMax */, pzErr)
  8974  	if (*(*int32)(unsafe.Pointer(bp /* nMax */)) <= 0) || (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK) {
  8975  		return *(*int32)(unsafe.Pointer(bp + 4 /* rc */))
  8976  	}
  8977  
  8978  	*(*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))
  8979  
  8980  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8981  		var nByte int32 = (int32(uint32(unsafe.Sizeof(IdxRemCtx{})) + (uint32(unsafe.Sizeof(IdxRemSlot{})) * uint32(*(*int32)(unsafe.Pointer(bp /* nMax */))))))
  8982  		pCtx = idxMalloc(tls, bp+4 /* &rc */, nByte)
  8983  	}
  8984  
  8985  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8986  		var dbrem uintptr = func() uintptr {
  8987  			if (*sqlite3expert)(unsafe.Pointer(p)).FiSample == 100 {
  8988  				return (*sqlite3expert)(unsafe.Pointer(p)).Fdb
  8989  			}
  8990  			return (*sqlite3expert)(unsafe.Pointer(p)).Fdbv
  8991  		}()
  8992  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_create_function(tls,
  8993  			dbrem, ts+1629 /* "rem" */, 2, SQLITE_UTF8, pCtx, *(*uintptr)(unsafe.Pointer(&struct {
  8994  				f func(*libc.TLS, uintptr, int32, uintptr)
  8995  			}{idxRemFunc})), uintptr(0), uintptr(0))
  8996  	}
  8997  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  8998  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_create_function(tls,
  8999  			(*sqlite3expert)(unsafe.Pointer(p)).Fdb, ts+1633 /* "sample" */, 0, SQLITE_UTF8, bp+8 /* &samplectx */, *(*uintptr)(unsafe.Pointer(&struct {
  9000  				f func(*libc.TLS, uintptr, int32, uintptr)
  9001  			}{idxSampleFunc})), uintptr(0), uintptr(0))
  9002  	}
  9003  
  9004  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  9005  		(*IdxRemCtx)(unsafe.Pointer(pCtx)).FnSlot = (*(*int32)(unsafe.Pointer(bp /* nMax */)) + 1)
  9006  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+40 /* &pAllIndex */, pzErr, zAllIndex)
  9007  	}
  9008  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  9009  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+44 /* &pIndexXInfo */, pzErr, zIndexXInfo)
  9010  	}
  9011  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  9012  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm, bp+48 /* &pWrite */, pzErr, zWrite)
  9013  	}
  9014  
  9015  	for (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)))) {
  9016  		var iRowid i64 = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 0)
  9017  		var zTab uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 1)
  9018  		var zIdx uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)), 2)
  9019  		if ((*sqlite3expert)(unsafe.Pointer(p)).FiSample < 100) && (iPrev != iRowid) {
  9020  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).Ftarget = (float64((*sqlite3expert)(unsafe.Pointer(p)).FiSample) / 100.0)
  9021  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FiTarget = (*sqlite3expert)(unsafe.Pointer(p)).FiSample
  9022  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FnRow = 0.0
  9023  			(*IdxSampleCtx)(unsafe.Pointer(bp + 8 /* &samplectx */)).FnRet = 0.0
  9024  			*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxBuildSampleTable(tls, p, zTab)
  9025  			if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) != SQLITE_OK {
  9026  				break
  9027  			}
  9028  		}
  9029  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = idxPopulateOneStat1(tls, p, *(*uintptr)(unsafe.Pointer(bp + 44 /* pIndexXInfo */)), *(*uintptr)(unsafe.Pointer(bp + 48 /* pWrite */)), zTab, zIdx, pzErr)
  9030  		iPrev = iRowid
  9031  	}
  9032  	if (*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK) && ((*sqlite3expert)(unsafe.Pointer(p)).FiSample < 100) {
  9033  		*(*int32)(unsafe.Pointer(bp + 4 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv,
  9034  			ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  9035  	}
  9036  
  9037  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 40 /* pAllIndex */)))
  9038  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 44 /* pIndexXInfo */)))
  9039  	idxFinalize(tls, bp+4 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 48 /* pWrite */)))
  9040  
  9041  	if pCtx != 0 {
  9042  		for i = 0; i < (*IdxRemCtx)(unsafe.Pointer(pCtx)).FnSlot; i++ {
  9043  			sqlite3.Xsqlite3_free(tls, (*IdxRemSlot)(unsafe.Pointer((pCtx+8 /* &.aSlot */)+uintptr(i)*40)).Fz)
  9044  		}
  9045  		sqlite3.Xsqlite3_free(tls, pCtx)
  9046  	}
  9047  
  9048  	if *(*int32)(unsafe.Pointer(bp + 4 /* rc */)) == SQLITE_OK {
  9049  		*(*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))
  9050  	}
  9051  
  9052  	sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdb, ts+1245 /* "DROP TABLE IF EX..." */, uintptr(0), uintptr(0), uintptr(0))
  9053  	return *(*int32)(unsafe.Pointer(bp + 4 /* rc */))
  9054  }
  9055  
  9056  // Allocate a new sqlite3expert object.
  9057  func sqlite3_expert_new(tls *libc.TLS, db uintptr, pzErrmsg uintptr) uintptr { /* sqlite3expert.c:1742:15: */
  9058  	bp := tls.Alloc(24)
  9059  	defer tls.Free(24)
  9060  
  9061  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK
  9062  	var pNew uintptr
  9063  
  9064  	pNew = idxMalloc(tls, bp+16 /* &rc */, int32(unsafe.Sizeof(sqlite3expert{})))
  9065  
  9066  	// Open two in-memory databases to work with. The "vtab database" (dbv)
  9067  	// will contain a virtual table corresponding to each real table in
  9068  	// the user database schema, and a copy of each view. It is used to
  9069  	// collect information regarding the WHERE, ORDER BY and other clauses
  9070  	// of the user's query.
  9071  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9072  		(*sqlite3expert)(unsafe.Pointer(pNew)).Fdb = db
  9073  		(*sqlite3expert)(unsafe.Pointer(pNew)).FiSample = 100
  9074  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, (pNew + 12 /* &.dbv */))
  9075  	}
  9076  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9077  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, (pNew + 8 /* &.dbm */))
  9078  		if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9079  			sqlite3.Xsqlite3_db_config(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbm, SQLITE_DBCONFIG_TRIGGER_EQP, libc.VaList(bp, 1, uintptr(0)))
  9080  		}
  9081  	}
  9082  
  9083  	// Copy the entire schema of database [db] into [dbm].
  9084  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9085  		// var pSql uintptr at bp+20, 4
  9086  
  9087  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = idxPrintfPrepareStmt(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdb, bp+20 /* &pSql */, pzErrmsg,
  9088  
  9089  			ts+1671 /* "SELECT sql FROM ..." */, 0)
  9090  		for (*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pSql */)))) {
  9091  			var zSql uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pSql */)), 0)
  9092  			*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = sqlite3.Xsqlite3_exec(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbm, zSql, uintptr(0), uintptr(0), pzErrmsg)
  9093  		}
  9094  		idxFinalize(tls, bp+16 /* &rc */, *(*uintptr)(unsafe.Pointer(bp + 20 /* pSql */)))
  9095  	}
  9096  
  9097  	// Create the vtab schema
  9098  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9099  		*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = idxCreateVtabSchema(tls, pNew, pzErrmsg)
  9100  	}
  9101  
  9102  	// Register the auth callback with dbv
  9103  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
  9104  		sqlite3.Xsqlite3_set_authorizer(tls, (*sqlite3expert)(unsafe.Pointer(pNew)).Fdbv, *(*uintptr)(unsafe.Pointer(&struct {
  9105  			f func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32
  9106  		}{idxAuthCallback})), pNew)
  9107  	}
  9108  
  9109  	// If an error has occurred, free the new object and reutrn NULL. Otherwise,
  9110  	// return the new sqlite3expert handle.
  9111  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) != SQLITE_OK {
  9112  		sqlite3_expert_destroy(tls, pNew)
  9113  		pNew = uintptr(0)
  9114  	}
  9115  	return pNew
  9116  }
  9117  
  9118  // Configure an sqlite3expert object.
  9119  func sqlite3_expert_config(tls *libc.TLS, p uintptr, op int32, va uintptr) int32 { /* sqlite3expert.c:1803:5: */
  9120  	var rc int32 = SQLITE_OK
  9121  	var ap va_list
  9122  	_ = ap
  9123  	ap = va
  9124  	switch op {
  9125  	case EXPERT_CONFIG_SAMPLE:
  9126  		{
  9127  			var iVal int32 = int32(libc.VaInt32(&ap))
  9128  			if iVal < 0 {
  9129  				iVal = 0
  9130  			}
  9131  			if iVal > 100 {
  9132  				iVal = 100
  9133  			}
  9134  			(*sqlite3expert)(unsafe.Pointer(p)).FiSample = iVal
  9135  			break
  9136  
  9137  		}
  9138  	default:
  9139  		rc = SQLITE_NOTFOUND
  9140  		break
  9141  	}
  9142  
  9143  	_ = ap
  9144  	return rc
  9145  }
  9146  
  9147  // Add an SQL statement to the analysis.
  9148  func sqlite3_expert_sql(tls *libc.TLS, p uintptr, zSql uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1827:5: */
  9149  	bp := tls.Alloc(12)
  9150  	defer tls.Free(12)
  9151  
  9152  	var pScanOrig uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpScan
  9153  	var pStmtOrig uintptr = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  9154  	*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
  9155  	*(*uintptr)(unsafe.Pointer(bp + 4 /* zStmt */)) = zSql
  9156  
  9157  	if (*sqlite3expert)(unsafe.Pointer(p)).FbRun != 0 {
  9158  		return SQLITE_MISUSE
  9159  	}
  9160  
  9161  	for ((*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 4 /* zStmt */)) != 0)) && (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* zStmt */)))) != 0) {
  9162  		*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
  9163  		*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = sqlite3.Xsqlite3_prepare_v2(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, *(*uintptr)(unsafe.Pointer(bp + 4 /* zStmt */)), -1, bp /* &pStmt */, bp+4 /* &zStmt */)
  9164  		if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK {
  9165  			if *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) != 0 {
  9166  				var pNew uintptr
  9167  				var z uintptr = sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
  9168  				var n int32 = int32(libc.Xstrlen(tls, z))
  9169  				pNew = idxMalloc(tls, bp+8 /* &rc */, (int32((uint32(unsafe.Sizeof(IdxStatement{})) + uint32(n)) + uint32(1))))
  9170  				if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK {
  9171  					(*IdxStatement)(unsafe.Pointer(pNew)).FzSql = (pNew + 1*20)
  9172  					libc.Xmemcpy(tls, (*IdxStatement)(unsafe.Pointer(pNew)).FzSql, z, (uint32(n + 1)))
  9173  					(*IdxStatement)(unsafe.Pointer(pNew)).FpNext = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement
  9174  					if (*sqlite3expert)(unsafe.Pointer(p)).FpStatement != 0 {
  9175  						(*IdxStatement)(unsafe.Pointer(pNew)).FiId = ((*IdxStatement)(unsafe.Pointer((*sqlite3expert)(unsafe.Pointer(p)).FpStatement)).FiId + 1)
  9176  					}
  9177  					(*sqlite3expert)(unsafe.Pointer(p)).FpStatement = pNew
  9178  				}
  9179  				sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
  9180  			}
  9181  		} else {
  9182  			idxDatabaseError(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv, pzErr)
  9183  		}
  9184  	}
  9185  
  9186  	if *(*int32)(unsafe.Pointer(bp + 8 /* rc */)) != SQLITE_OK {
  9187  		idxScanFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpScan, pScanOrig)
  9188  		idxStatementFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpStatement, pStmtOrig)
  9189  		(*sqlite3expert)(unsafe.Pointer(p)).FpScan = pScanOrig
  9190  		(*sqlite3expert)(unsafe.Pointer(p)).FpStatement = pStmtOrig
  9191  	}
  9192  
  9193  	return *(*int32)(unsafe.Pointer(bp + 8 /* rc */))
  9194  }
  9195  
  9196  func sqlite3_expert_analyze(tls *libc.TLS, p uintptr, pzErr uintptr) int32 { /* sqlite3expert.c:1872:5: */
  9197  	bp := tls.Alloc(28)
  9198  	defer tls.Free(28)
  9199  
  9200  	// var rc int32 at bp+24, 4
  9201  
  9202  	var pEntry uintptr
  9203  
  9204  	// Do trigger processing to collect any extra IdxScan structures
  9205  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxProcessTriggers(tls, p, pzErr)
  9206  
  9207  	// Create candidate indexes within the in-memory database file
  9208  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  9209  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxCreateCandidates(tls, p)
  9210  	}
  9211  
  9212  	// Generate the stat1 data
  9213  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  9214  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxPopulateStat1(tls, p, pzErr)
  9215  	}
  9216  
  9217  	// Formulate the EXPERT_REPORT_CANDIDATES text
  9218  	for pEntry = (*sqlite3expert)(unsafe.Pointer(p)).FhIdx.FpFirst; pEntry != 0; pEntry = (*IdxHashEntry)(unsafe.Pointer(pEntry)).FpNext {
  9219  		(*sqlite3expert)(unsafe.Pointer(p)).FzCandidates = idxAppendText(tls, bp+24 /* &rc */, (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates,
  9220  			ts+1770 /* "%s;%s%s\n" */, libc.VaList(bp, (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal,
  9221  				func() uintptr {
  9222  					if (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2 != 0 {
  9223  						return ts + 1779 /* " -- stat1: " */
  9224  					}
  9225  					return ts + 489 /* "" */
  9226  				}(), (*IdxHashEntry)(unsafe.Pointer(pEntry)).FzVal2))
  9227  	}
  9228  
  9229  	// Figure out which of the candidate indexes are preferred by the query
  9230  	// planner and report the results to the user.
  9231  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  9232  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = idxFindIndexes(tls, p, pzErr)
  9233  	}
  9234  
  9235  	if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
  9236  		(*sqlite3expert)(unsafe.Pointer(p)).FbRun = 1
  9237  	}
  9238  	return *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
  9239  }
  9240  
  9241  // Return the total number of statements that have been added to this
  9242  // sqlite3expert using sqlite3_expert_sql().
  9243  func sqlite3_expert_count(tls *libc.TLS, p uintptr) int32 { /* sqlite3expert.c:1913:5: */
  9244  	var nRet int32 = 0
  9245  	if (*sqlite3expert)(unsafe.Pointer(p)).FpStatement != 0 {
  9246  		nRet = ((*IdxStatement)(unsafe.Pointer((*sqlite3expert)(unsafe.Pointer(p)).FpStatement)).FiId + 1)
  9247  	}
  9248  	return nRet
  9249  }
  9250  
  9251  // Return a component of the report.
  9252  func sqlite3_expert_report(tls *libc.TLS, p uintptr, iStmt int32, eReport int32) uintptr { /* sqlite3expert.c:1922:12: */
  9253  	var zRet uintptr = uintptr(0)
  9254  	var pStmt uintptr
  9255  
  9256  	if (*sqlite3expert)(unsafe.Pointer(p)).FbRun == 0 {
  9257  		return uintptr(0)
  9258  	}
  9259  	for pStmt = (*sqlite3expert)(unsafe.Pointer(p)).FpStatement; (pStmt != 0) && ((*IdxStatement)(unsafe.Pointer(pStmt)).FiId != iStmt); pStmt = (*IdxStatement)(unsafe.Pointer(pStmt)).FpNext {
  9260  	}
  9261  	switch eReport {
  9262  	case EXPERT_REPORT_SQL:
  9263  		if pStmt != 0 {
  9264  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzSql
  9265  		}
  9266  		break
  9267  	case EXPERT_REPORT_INDEXES:
  9268  		if pStmt != 0 {
  9269  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzIdx
  9270  		}
  9271  		break
  9272  	case EXPERT_REPORT_PLAN:
  9273  		if pStmt != 0 {
  9274  			zRet = (*IdxStatement)(unsafe.Pointer(pStmt)).FzEQP
  9275  		}
  9276  		break
  9277  	case EXPERT_REPORT_CANDIDATES:
  9278  		zRet = (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates
  9279  		break
  9280  	}
  9281  	return zRet
  9282  }
  9283  
  9284  // Free an sqlite3expert object.
  9285  func sqlite3_expert_destroy(tls *libc.TLS, p uintptr) { /* sqlite3expert.c:1948:6: */
  9286  	if p != 0 {
  9287  		sqlite3.Xsqlite3_close(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbm)
  9288  		sqlite3.Xsqlite3_close(tls, (*sqlite3expert)(unsafe.Pointer(p)).Fdbv)
  9289  		idxScanFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpScan, uintptr(0))
  9290  		idxStatementFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpStatement, uintptr(0))
  9291  		idxTableFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpTable)
  9292  		idxWriteFree(tls, (*sqlite3expert)(unsafe.Pointer(p)).FpWrite)
  9293  		idxHashClear(tls, (p + 44 /* &.hIdx */))
  9294  		sqlite3.Xsqlite3_free(tls, (*sqlite3expert)(unsafe.Pointer(p)).FzCandidates)
  9295  		sqlite3.Xsqlite3_free(tls, p)
  9296  	}
  9297  }
  9298  
  9299  // If we are compiling with optimizing read this file.  It contains
  9300  //    several optimizing inline functions and macros.
  9301  
  9302  //----------------------------------------------------------------------------
  9303  // Support for functions with a variable number of arguments.
  9304  //
  9305  // The following TCL_VARARGS* macros are to support old extensions
  9306  // written for older versions of Tcl where the macros permitted
  9307  // support for the varargs.h system as well as stdarg.h .
  9308  //
  9309  // New code should just directly be written to use stdarg.h conventions.
  9310  
  9311  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
  9312  //
  9313  // This file is part of GCC.
  9314  //
  9315  // GCC is free software; you can redistribute it and/or modify
  9316  // it under the terms of the GNU General Public License as published by
  9317  // the Free Software Foundation; either version 3, or (at your option)
  9318  // any later version.
  9319  //
  9320  // GCC is distributed in the hope that it will be useful,
  9321  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  9322  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9323  // GNU General Public License for more details.
  9324  //
  9325  // Under Section 7 of GPL version 3, you are granted additional
  9326  // permissions described in the GCC Runtime Library Exception, version
  9327  // 3.1, as published by the Free Software Foundation.
  9328  //
  9329  // You should have received a copy of the GNU General Public License and
  9330  // a copy of the GCC Runtime Library Exception along with this program;
  9331  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
  9332  // <http://www.gnu.org/licenses/>.
  9333  
  9334  // ISO C Standard:  7.15  Variable arguments  <stdarg.h>
  9335  
  9336  // Allow a part of Tcl's API to be explicitly marked as deprecated.
  9337  //
  9338  // Used to make TIP 330/336 generate moans even if people use the
  9339  // compatibility macros. Change your code, guys! We won't support you forever.
  9340  
  9341  //----------------------------------------------------------------------------
  9342  // Macros used to declare a function to be exported by a DLL. Used by Windows,
  9343  // maps to no-op declarations on non-Windows systems. The default build on
  9344  // windows is for a DLL, which causes the DLLIMPORT and DLLEXPORT macros to be
  9345  // nonempty. To build a static library, the macro STATIC_BUILD should be
  9346  // defined.
  9347  //
  9348  // Note: when building static but linking dynamically to MSVCRT we must still
  9349  //       correctly decorate the C library imported function.  Use CRTIMPORT
  9350  //       for this purpose.  _DLL is defined by the compiler when linking to
  9351  //       MSVCRT.
  9352  
  9353  // These macros are used to control whether functions are being declared for
  9354  // import or export. If a function is being declared while it is being built
  9355  // to be included in a shared library, then it should have the DLLEXPORT
  9356  // storage class. If is being declared for use by a module that is going to
  9357  // link against the shared library, then it should have the DLLIMPORT storage
  9358  // class. If the symbol is beind declared for a static build or for use from a
  9359  // stub library, then the storage class should be empty.
  9360  //
  9361  // The convention is that a macro called BUILD_xxxx, where xxxx is the name of
  9362  // a library we are building, is set on the compile line for sources that are
  9363  // to be placed in the library. When this macro is set, the storage class will
  9364  // be set to DLLEXPORT. At the end of the header file, the storage class will
  9365  // be reset to DLLIMPORT.
  9366  
  9367  // The following _ANSI_ARGS_ macro is to support old extensions
  9368  // written for older versions of Tcl where it permitted support
  9369  // for compilers written in the pre-prototype era of C.
  9370  //
  9371  // New code should use prototypes.
  9372  
  9373  // Definitions that allow this header file to be used either with or without
  9374  // ANSI C features.
  9375  
  9376  // Make sure EXTERN isn't defined elsewhere.
  9377  
  9378  //----------------------------------------------------------------------------
  9379  // The following code is copied from winnt.h. If we don't replicate it here,
  9380  // then <windows.h> can't be included after tcl.h, since tcl.h also defines
  9381  // VOID. This block is skipped under Cygwin and Mingw.
  9382  
  9383  // Macro to use instead of "void" for arguments that must have type "void *"
  9384  // in ANSI C; maps them to type "char *" in non-ANSI systems.
  9385  
  9386  // Miscellaneous declarations.
  9387  
  9388  type ClientData = uintptr /* tcl.h:340:15 */
  9389  
  9390  // Darwin specific configure overrides (to support fat compiles, where
  9391  // configure runs only once for multiple architectures):
  9392  
  9393  // Define Tcl_WideInt to be a type that is (at least) 64-bits wide, and define
  9394  // Tcl_WideUInt to be the unsigned variant of that type (assuming that where
  9395  // we have one, we can have the other.)
  9396  //
  9397  // Also defines the following macros:
  9398  // TCL_WIDE_INT_IS_LONG - if wide ints are really longs (i.e. we're on a
  9399  //	LP64 system such as modern Solaris or Linux ... not including Win64)
  9400  // Tcl_WideAsLong - forgetful converter from wideInt to long.
  9401  // Tcl_LongAsWide - sign-extending converter from long to wideInt.
  9402  // Tcl_WideAsDouble - converter from wideInt to double.
  9403  // Tcl_DoubleAsWide - converter from double to wideInt.
  9404  //
  9405  // The following invariant should hold for any long value 'longVal':
  9406  //	longVal == Tcl_WideAsLong(Tcl_LongAsWide(longVal))
  9407  //
  9408  // Note on converting between Tcl_WideInt and strings. This implementation (in
  9409  // tclObj.c) depends on the function
  9410  // sprintf(...,"%" TCL_LL_MODIFIER "d",...).
  9411  
  9412  type Tcl_WideInt = int64   /* tcl.h:415:28 */
  9413  type Tcl_WideUInt = uint64 /* tcl.h:416:36 */
  9414  
  9415  // The next short section of defines are only done when not running on Windows
  9416  // or some other strange platform.
  9417  
  9418  type stat = struct {
  9419  	Fst_dev     uint64
  9420  	F__pad1     uint16
  9421  	_           [2]byte
  9422  	F__st_ino   uint32
  9423  	Fst_mode    uint32
  9424  	Fst_nlink   uint32
  9425  	Fst_uid     uint32
  9426  	Fst_gid     uint32
  9427  	Fst_rdev    uint64
  9428  	F__pad2     uint16
  9429  	_           [6]byte
  9430  	Fst_size    int64
  9431  	Fst_blksize int32
  9432  	_           [4]byte
  9433  	Fst_blocks  int64
  9434  	Fst_atim    struct {
  9435  		Ftv_sec  int32
  9436  		Ftv_nsec int32
  9437  	}
  9438  	Fst_mtim struct {
  9439  		Ftv_sec  int32
  9440  		Ftv_nsec int32
  9441  	}
  9442  	Fst_ctim struct {
  9443  		Ftv_sec  int32
  9444  		Ftv_nsec int32
  9445  	}
  9446  	Fst_ino uint64
  9447  } /* stat.h:38:1 */
  9448  
  9449  //----------------------------------------------------------------------------
  9450  // Data structures defined opaquely in this module. The definitions below just
  9451  // provide dummy types. A few fields are made visible in Tcl_Interp
  9452  // structures, namely those used for returning a string result from commands.
  9453  // Direct access to the result field is discouraged in Tcl 8.0. The
  9454  // interpreter result is either an object or a string, and the two values are
  9455  // kept consistent unless some C code sets interp->result directly.
  9456  // Programmers should use either the function Tcl_GetObjResult() or
  9457  // Tcl_GetStringResult() to read the interpreter's result. See the SetResult
  9458  // man page for details.
  9459  //
  9460  // Note: any change to the Tcl_Interp definition below must be mirrored in the
  9461  // "real" definition in tclInt.h.
  9462  //
  9463  // Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
  9464  // Instead, they set a Tcl_Obj member in the "real" structure that can be
  9465  // accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
  9466  
  9467  type Tcl_Interp1 = struct {
  9468  	FresultDontUse    uintptr
  9469  	FfreeProcDontUse  uintptr
  9470  	FerrorLineDontUse int32
  9471  } /* tcl.h:493:9 */
  9472  
  9473  //----------------------------------------------------------------------------
  9474  // Data structures defined opaquely in this module. The definitions below just
  9475  // provide dummy types. A few fields are made visible in Tcl_Interp
  9476  // structures, namely those used for returning a string result from commands.
  9477  // Direct access to the result field is discouraged in Tcl 8.0. The
  9478  // interpreter result is either an object or a string, and the two values are
  9479  // kept consistent unless some C code sets interp->result directly.
  9480  // Programmers should use either the function Tcl_GetObjResult() or
  9481  // Tcl_GetStringResult() to read the interpreter's result. See the SetResult
  9482  // man page for details.
  9483  //
  9484  // Note: any change to the Tcl_Interp definition below must be mirrored in the
  9485  // "real" definition in tclInt.h.
  9486  //
  9487  // Note: Tcl_ObjCmdProc functions do not directly set result and freeProc.
  9488  // Instead, they set a Tcl_Obj member in the "real" structure that can be
  9489  // accessed with Tcl_GetObjResult() and Tcl_SetObjResult().
  9490  
  9491  type Tcl_Interp = Tcl_Interp1 /* tcl.h:525:1 */
  9492  
  9493  type Tcl_AsyncHandler = uintptr       /* tcl.h:527:34 */
  9494  type Tcl_Channel = uintptr            /* tcl.h:528:29 */
  9495  type Tcl_ChannelTypeVersion = uintptr /* tcl.h:529:40 */
  9496  type Tcl_Command = uintptr            /* tcl.h:530:29 */
  9497  type Tcl_Condition = uintptr          /* tcl.h:531:31 */
  9498  type Tcl_Dict = uintptr               /* tcl.h:532:26 */
  9499  type Tcl_EncodingState = uintptr      /* tcl.h:533:35 */
  9500  type Tcl_Encoding = uintptr           /* tcl.h:534:30 */
  9501  type Tcl_Event1 = struct {
  9502  	Fproc    uintptr
  9503  	FnextPtr uintptr
  9504  } /* tcl.h:535:9 */
  9505  
  9506  type Tcl_Event = Tcl_Event1      /* tcl.h:535:26 */
  9507  type Tcl_InterpState = uintptr   /* tcl.h:536:33 */
  9508  type Tcl_LoadHandle = uintptr    /* tcl.h:537:32 */
  9509  type Tcl_Mutex = uintptr         /* tcl.h:538:27 */
  9510  type Tcl_Pid = uintptr           /* tcl.h:539:25 */
  9511  type Tcl_RegExp = uintptr        /* tcl.h:540:28 */
  9512  type Tcl_ThreadDataKey = uintptr /* tcl.h:541:35 */
  9513  type Tcl_ThreadId = uintptr      /* tcl.h:542:30 */
  9514  type Tcl_TimerToken = uintptr    /* tcl.h:543:32 */
  9515  type Tcl_Trace = uintptr         /* tcl.h:544:27 */
  9516  type Tcl_Var = uintptr           /* tcl.h:545:25 */
  9517  type Tcl_ZlibStream = uintptr    /* tcl.h:546:32 */
  9518  
  9519  // Threading function return types used for abstracting away platform
  9520  // differences when writing a Tcl_ThreadCreateProc. See the NewThread function
  9521  // in generic/tclThreadTest.c for it's usage.
  9522  
  9523  // Definition of values for default stacksize and the possible flags to be
  9524  // given to Tcl_CreateThread.
  9525  
  9526  // Flag values passed to Tcl_StringCaseMatch.
  9527  
  9528  // Flag values passed to Tcl_GetRegExpFromObj.
  9529  
  9530  // Flags values passed to Tcl_RegExpExecObj.
  9531  
  9532  // Structures filled in by Tcl_RegExpInfo. Note that all offset values are
  9533  // relative to the start of the match string, not the beginning of the entire
  9534  // string.
  9535  
  9536  type Tcl_RegExpIndices1 = struct {
  9537  	Fstart int32
  9538  	Fend   int32
  9539  } /* tcl.h:623:9 */
  9540  
  9541  // Threading function return types used for abstracting away platform
  9542  // differences when writing a Tcl_ThreadCreateProc. See the NewThread function
  9543  // in generic/tclThreadTest.c for it's usage.
  9544  
  9545  // Definition of values for default stacksize and the possible flags to be
  9546  // given to Tcl_CreateThread.
  9547  
  9548  // Flag values passed to Tcl_StringCaseMatch.
  9549  
  9550  // Flag values passed to Tcl_GetRegExpFromObj.
  9551  
  9552  // Flags values passed to Tcl_RegExpExecObj.
  9553  
  9554  // Structures filled in by Tcl_RegExpInfo. Note that all offset values are
  9555  // relative to the start of the match string, not the beginning of the entire
  9556  // string.
  9557  
  9558  type Tcl_RegExpIndices = Tcl_RegExpIndices1 /* tcl.h:628:3 */
  9559  
  9560  type Tcl_RegExpInfo1 = struct {
  9561  	Fnsubs       int32
  9562  	Fmatches     uintptr
  9563  	FextendStart int32
  9564  	Freserved    int32
  9565  } /* tcl.h:630:9 */
  9566  
  9567  type Tcl_RegExpInfo = Tcl_RegExpInfo1 /* tcl.h:637:3 */
  9568  
  9569  // Picky compilers complain if this typdef doesn't appear before the struct's
  9570  // reference in tclDecls.h.
  9571  
  9572  type Tcl_Stat_ = uintptr    /* tcl.h:644:21 */
  9573  type Tcl_OldStat_ = uintptr /* tcl.h:645:21 */
  9574  
  9575  //----------------------------------------------------------------------------
  9576  // When a TCL command returns, the interpreter contains a result from the
  9577  // command. Programmers are strongly encouraged to use one of the functions
  9578  // Tcl_GetObjResult() or Tcl_GetStringResult() to read the interpreter's
  9579  // result. See the SetResult man page for details. Besides this result, the
  9580  // command function returns an integer code, which is one of the following:
  9581  //
  9582  // TCL_OK		Command completed normally; the interpreter's result
  9583  //			contains the command's result.
  9584  // TCL_ERROR		The command couldn't be completed successfully; the
  9585  //			interpreter's result describes what went wrong.
  9586  // TCL_RETURN		The command requests that the current function return;
  9587  //			the interpreter's result contains the function's
  9588  //			return value.
  9589  // TCL_BREAK		The command requests that the innermost loop be
  9590  //			exited; the interpreter's result is meaningless.
  9591  // TCL_CONTINUE		Go on to the next iteration of the current loop; the
  9592  //			interpreter's result is meaningless.
  9593  
  9594  //----------------------------------------------------------------------------
  9595  // Flags to control what substitutions are performed by Tcl_SubstObj():
  9596  
  9597  // Argument descriptors for math function callbacks in expressions:
  9598  
  9599  type Tcl_ValueType = uint32 /* tcl.h:692:3 */
  9600  
  9601  type Tcl_Value1 = struct {
  9602  	Ftype        Tcl_ValueType
  9603  	FintValue    int32
  9604  	FdoubleValue float64
  9605  	FwideValue   Tcl_WideInt
  9606  } /* tcl.h:694:9 */
  9607  
  9608  type Tcl_Value = Tcl_Value1 /* tcl.h:700:3 */
  9609  
  9610  // Forward declaration of Tcl_Obj to prevent an error when the forward
  9611  // reference to Tcl_Obj is encountered in the function types declared below.
  9612  
  9613  type Tcl_Obj1 = struct {
  9614  	FrefCount    int32
  9615  	Fbytes       uintptr
  9616  	Flength      int32
  9617  	FtypePtr     uintptr
  9618  	FinternalRep struct {
  9619  		_          [0]uint64
  9620  		FlongValue int32
  9621  		_          [4]byte
  9622  	}
  9623  } /* tcl.h:707:1 */
  9624  
  9625  //----------------------------------------------------------------------------
  9626  // The following structure represents a type of object, which is a particular
  9627  // internal representation for an object plus a set of functions that provide
  9628  // standard operations on objects of that type.
  9629  
  9630  type Tcl_ObjType1 = struct {
  9631  	Fname             uintptr
  9632  	FfreeIntRepProc   uintptr
  9633  	FdupIntRepProc    uintptr
  9634  	FupdateStringProc uintptr
  9635  	FsetFromAnyProc   uintptr
  9636  } /* tcl.h:707:1 */
  9637  
  9638  //----------------------------------------------------------------------------
  9639  // The following structure represents a type of object, which is a particular
  9640  // internal representation for an object plus a set of functions that provide
  9641  // standard operations on objects of that type.
  9642  
  9643  type Tcl_ObjType = Tcl_ObjType1 /* tcl.h:796:3 */
  9644  
  9645  // One of the following structures exists for each object in the Tcl system.
  9646  // An object stores a value as either a string, some internal representation,
  9647  // or both.
  9648  
  9649  type Tcl_Obj = Tcl_Obj1 /* tcl.h:843:3 */
  9650  
  9651  //----------------------------------------------------------------------------
  9652  // The following structure contains the state needed by Tcl_SaveResult. No-one
  9653  // outside of Tcl should access any of these fields. This structure is
  9654  // typically allocated on the stack.
  9655  
  9656  type Tcl_SavedResult1 = struct {
  9657  	Fresult       uintptr
  9658  	FfreeProc     uintptr
  9659  	FobjResultPtr uintptr
  9660  	FappendResult uintptr
  9661  	FappendAvl    int32
  9662  	FappendUsed   int32
  9663  	FresultSpace  [201]int8
  9664  	_             [3]byte
  9665  } /* tcl.h:864:9 */
  9666  
  9667  //----------------------------------------------------------------------------
  9668  // The following structure contains the state needed by Tcl_SaveResult. No-one
  9669  // outside of Tcl should access any of these fields. This structure is
  9670  // typically allocated on the stack.
  9671  
  9672  type Tcl_SavedResult = Tcl_SavedResult1 /* tcl.h:872:3 */
  9673  
  9674  //----------------------------------------------------------------------------
  9675  // The following definitions support Tcl's namespace facility. Note: the first
  9676  // five fields must match exactly the fields in a Namespace structure (see
  9677  // tclInt.h).
  9678  
  9679  type Tcl_Namespace1 = struct {
  9680  	Fname       uintptr
  9681  	FfullName   uintptr
  9682  	FclientData ClientData
  9683  	FdeleteProc uintptr
  9684  	FparentPtr  uintptr
  9685  } /* tcl.h:881:9 */
  9686  
  9687  //----------------------------------------------------------------------------
  9688  // The following definitions support Tcl's namespace facility. Note: the first
  9689  // five fields must match exactly the fields in a Namespace structure (see
  9690  // tclInt.h).
  9691  
  9692  type Tcl_Namespace = Tcl_Namespace1 /* tcl.h:897:3 */
  9693  
  9694  //----------------------------------------------------------------------------
  9695  // The following structure represents a call frame, or activation record. A
  9696  // call frame defines a naming context for a procedure call: its local scope
  9697  // (for local variables) and its namespace scope (used for non-local
  9698  // variables; often the global :: namespace). A call frame can also define the
  9699  // naming context for a namespace eval or namespace inscope command: the
  9700  // namespace in which the command's code should execute. The Tcl_CallFrame
  9701  // structures exist only while procedures or namespace eval/inscope's are
  9702  // being executed, and provide a Tcl call stack.
  9703  //
  9704  // A call frame is initialized and pushed using Tcl_PushCallFrame and popped
  9705  // using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the
  9706  // Tcl_PushCallFrame caller, and callers typically allocate them on the C call
  9707  // stack for efficiency. For this reason, Tcl_CallFrame is defined as a
  9708  // structure and not as an opaque token. However, most Tcl_CallFrame fields
  9709  // are hidden since applications should not access them directly; others are
  9710  // declared as "dummyX".
  9711  //
  9712  // WARNING!! The structure definition must be kept consistent with the
  9713  // CallFrame structure in tclInt.h. If you change one, change the other.
  9714  
  9715  type Tcl_CallFrame1 = struct {
  9716  	FnsPtr   uintptr
  9717  	Fdummy1  int32
  9718  	Fdummy2  int32
  9719  	Fdummy3  uintptr
  9720  	Fdummy4  uintptr
  9721  	Fdummy5  uintptr
  9722  	Fdummy6  int32
  9723  	Fdummy7  uintptr
  9724  	Fdummy8  uintptr
  9725  	Fdummy9  int32
  9726  	Fdummy10 uintptr
  9727  	Fdummy11 uintptr
  9728  	Fdummy12 uintptr
  9729  	Fdummy13 uintptr
  9730  } /* tcl.h:922:9 */
  9731  
  9732  //----------------------------------------------------------------------------
  9733  // The following structure represents a call frame, or activation record. A
  9734  // call frame defines a naming context for a procedure call: its local scope
  9735  // (for local variables) and its namespace scope (used for non-local
  9736  // variables; often the global :: namespace). A call frame can also define the
  9737  // naming context for a namespace eval or namespace inscope command: the
  9738  // namespace in which the command's code should execute. The Tcl_CallFrame
  9739  // structures exist only while procedures or namespace eval/inscope's are
  9740  // being executed, and provide a Tcl call stack.
  9741  //
  9742  // A call frame is initialized and pushed using Tcl_PushCallFrame and popped
  9743  // using Tcl_PopCallFrame. Storage for a Tcl_CallFrame must be provided by the
  9744  // Tcl_PushCallFrame caller, and callers typically allocate them on the C call
  9745  // stack for efficiency. For this reason, Tcl_CallFrame is defined as a
  9746  // structure and not as an opaque token. However, most Tcl_CallFrame fields
  9747  // are hidden since applications should not access them directly; others are
  9748  // declared as "dummyX".
  9749  //
  9750  // WARNING!! The structure definition must be kept consistent with the
  9751  // CallFrame structure in tclInt.h. If you change one, change the other.
  9752  
  9753  type Tcl_CallFrame = Tcl_CallFrame1 /* tcl.h:937:3 */
  9754  
  9755  //----------------------------------------------------------------------------
  9756  // Information about commands that is returned by Tcl_GetCommandInfo and
  9757  // passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command
  9758  // function while proc is a traditional Tcl argc/argv string-based function.
  9759  // Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and
  9760  // proc are non-NULL and can be called to execute the command. However, it may
  9761  // be faster to call one instead of the other. The member isNativeObjectProc
  9762  // is set to 1 if an object-based function was registered by
  9763  // Tcl_CreateObjCommand, and to 0 if a string-based function was registered by
  9764  // Tcl_CreateCommand. The other function is typically set to a compatibility
  9765  // wrapper that does string-to-object or object-to-string argument conversions
  9766  // then calls the other function.
  9767  
  9768  type Tcl_CmdInfo1 = struct {
  9769  	FisNativeObjectProc int32
  9770  	FobjProc            uintptr
  9771  	FobjClientData      ClientData
  9772  	Fproc               uintptr
  9773  	FclientData         ClientData
  9774  	FdeleteProc         uintptr
  9775  	FdeleteData         ClientData
  9776  	FnamespacePtr       uintptr
  9777  } /* tcl.h:954:9 */
  9778  
  9779  //----------------------------------------------------------------------------
  9780  // Information about commands that is returned by Tcl_GetCommandInfo and
  9781  // passed to Tcl_SetCommandInfo. objProc is an objc/objv object-based command
  9782  // function while proc is a traditional Tcl argc/argv string-based function.
  9783  // Tcl_CreateObjCommand and Tcl_CreateCommand ensure that both objProc and
  9784  // proc are non-NULL and can be called to execute the command. However, it may
  9785  // be faster to call one instead of the other. The member isNativeObjectProc
  9786  // is set to 1 if an object-based function was registered by
  9787  // Tcl_CreateObjCommand, and to 0 if a string-based function was registered by
  9788  // Tcl_CreateCommand. The other function is typically set to a compatibility
  9789  // wrapper that does string-to-object or object-to-string argument conversions
  9790  // then calls the other function.
  9791  
  9792  type Tcl_CmdInfo = Tcl_CmdInfo1 /* tcl.h:973:3 */
  9793  
  9794  //----------------------------------------------------------------------------
  9795  // The structure defined below is used to hold dynamic strings. The only
  9796  // fields that clients should use are string and length, accessible via the
  9797  // macros Tcl_DStringValue and Tcl_DStringLength.
  9798  
  9799  type Tcl_DString1 = struct {
  9800  	Fstring      uintptr
  9801  	Flength      int32
  9802  	FspaceAvl    int32
  9803  	FstaticSpace [200]int8
  9804  } /* tcl.h:983:9 */
  9805  
  9806  //----------------------------------------------------------------------------
  9807  // The structure defined below is used to hold dynamic strings. The only
  9808  // fields that clients should use are string and length, accessible via the
  9809  // macros Tcl_DStringValue and Tcl_DStringLength.
  9810  
  9811  type Tcl_DString = Tcl_DString1 /* tcl.h:993:3 */
  9812  
  9813  // Definitions for the maximum number of digits of precision that may be
  9814  // specified in the "tcl_precision" variable, and the number of bytes of
  9815  // buffer space required by Tcl_PrintDouble.
  9816  
  9817  // Definition for a number of bytes of buffer space sufficient to hold the
  9818  // string representation of an integer in base 10 (assuming the existence of
  9819  // 64-bit integers).
  9820  
  9821  // Flag values passed to Tcl_ConvertElement.
  9822  // TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to
  9823  //	use backslash quoting instead.
  9824  // TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It
  9825  //	is safe to leave the hash unquoted when the element is not the first
  9826  //	element of a list, and this flag can be used by the caller to indicate
  9827  //	that condition.
  9828  
  9829  // Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  9830  // abbreviated strings.
  9831  
  9832  //----------------------------------------------------------------------------
  9833  // Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
  9834  // WARNING: these bit choices must not conflict with the bit choices for
  9835  // evalFlag bits in tclInt.h!
  9836  //
  9837  // Meanings:
  9838  //	TCL_NO_EVAL:		Just record this command
  9839  //	TCL_EVAL_GLOBAL:	Execute script in global namespace
  9840  //	TCL_EVAL_DIRECT:	Do not compile this script
  9841  //	TCL_EVAL_INVOKE:	Magical Tcl_EvalObjv mode for aliases/ensembles
  9842  //				o Run in iPtr->lookupNsPtr or global namespace
  9843  //				o Cut out of error traces
  9844  //				o Don't reset the flags controlling ensemble
  9845  //				  error message rewriting.
  9846  //	TCL_CANCEL_UNWIND:	Magical Tcl_CancelEval mode that causes the
  9847  //				stack for the script in progress to be
  9848  //				completely unwound.
  9849  //	TCL_EVAL_NOERR:	Do no exception reporting at all, just return
  9850  //				as the caller will report.
  9851  
  9852  // Special freeProc values that may be passed to Tcl_SetResult (see the man
  9853  // page for details):
  9854  
  9855  // Flag values passed to variable-related functions.
  9856  // WARNING: these bit choices must not conflict with the bit choice for
  9857  // TCL_CANCEL_UNWIND, above.
  9858  
  9859  // Required to support old variable/vdelete/vinfo traces.
  9860  // Indicate the semantics of the result of a trace.
  9861  
  9862  // Flag values for ensemble commands.
  9863  
  9864  // Flag values passed to command-related functions.
  9865  
  9866  // The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  9867  // always parsed whenever the part2 is NULL. (This is to avoid a common error
  9868  // when converting code to use the new object based APIs and forgetting to
  9869  // give the flag)
  9870  
  9871  // Types for linked variables:
  9872  
  9873  //----------------------------------------------------------------------------
  9874  // Forward declarations of Tcl_HashTable and related types.
  9875  
  9876  type Tcl_HashKeyType1 = struct {
  9877  	Fversion         int32
  9878  	Fflags           int32
  9879  	FhashKeyProc     uintptr
  9880  	FcompareKeysProc uintptr
  9881  	FallocEntryProc  uintptr
  9882  	FfreeEntryProc   uintptr
  9883  } /* tcl.h:1152:9 */
  9884  
  9885  // Definitions for the maximum number of digits of precision that may be
  9886  // specified in the "tcl_precision" variable, and the number of bytes of
  9887  // buffer space required by Tcl_PrintDouble.
  9888  
  9889  // Definition for a number of bytes of buffer space sufficient to hold the
  9890  // string representation of an integer in base 10 (assuming the existence of
  9891  // 64-bit integers).
  9892  
  9893  // Flag values passed to Tcl_ConvertElement.
  9894  // TCL_DONT_USE_BRACES forces it not to enclose the element in braces, but to
  9895  //	use backslash quoting instead.
  9896  // TCL_DONT_QUOTE_HASH disables the default quoting of the '#' character. It
  9897  //	is safe to leave the hash unquoted when the element is not the first
  9898  //	element of a list, and this flag can be used by the caller to indicate
  9899  //	that condition.
  9900  
  9901  // Flag that may be passed to Tcl_GetIndexFromObj to force it to disallow
  9902  // abbreviated strings.
  9903  
  9904  //----------------------------------------------------------------------------
  9905  // Flag values passed to Tcl_RecordAndEval, Tcl_EvalObj, Tcl_EvalObjv.
  9906  // WARNING: these bit choices must not conflict with the bit choices for
  9907  // evalFlag bits in tclInt.h!
  9908  //
  9909  // Meanings:
  9910  //	TCL_NO_EVAL:		Just record this command
  9911  //	TCL_EVAL_GLOBAL:	Execute script in global namespace
  9912  //	TCL_EVAL_DIRECT:	Do not compile this script
  9913  //	TCL_EVAL_INVOKE:	Magical Tcl_EvalObjv mode for aliases/ensembles
  9914  //				o Run in iPtr->lookupNsPtr or global namespace
  9915  //				o Cut out of error traces
  9916  //				o Don't reset the flags controlling ensemble
  9917  //				  error message rewriting.
  9918  //	TCL_CANCEL_UNWIND:	Magical Tcl_CancelEval mode that causes the
  9919  //				stack for the script in progress to be
  9920  //				completely unwound.
  9921  //	TCL_EVAL_NOERR:	Do no exception reporting at all, just return
  9922  //				as the caller will report.
  9923  
  9924  // Special freeProc values that may be passed to Tcl_SetResult (see the man
  9925  // page for details):
  9926  
  9927  // Flag values passed to variable-related functions.
  9928  // WARNING: these bit choices must not conflict with the bit choice for
  9929  // TCL_CANCEL_UNWIND, above.
  9930  
  9931  // Required to support old variable/vdelete/vinfo traces.
  9932  // Indicate the semantics of the result of a trace.
  9933  
  9934  // Flag values for ensemble commands.
  9935  
  9936  // Flag values passed to command-related functions.
  9937  
  9938  // The TCL_PARSE_PART1 flag is deprecated and has no effect. The part1 is now
  9939  // always parsed whenever the part2 is NULL. (This is to avoid a common error
  9940  // when converting code to use the new object based APIs and forgetting to
  9941  // give the flag)
  9942  
  9943  // Types for linked variables:
  9944  
  9945  //----------------------------------------------------------------------------
  9946  // Forward declarations of Tcl_HashTable and related types.
  9947  
  9948  type Tcl_HashKeyType = Tcl_HashKeyType1 /* tcl.h:1152:32 */
  9949  type Tcl_HashTable1 = struct {
  9950  	Fbuckets       uintptr
  9951  	FstaticBuckets [4]uintptr
  9952  	FnumBuckets    int32
  9953  	FnumEntries    int32
  9954  	FrebuildSize   int32
  9955  	FdownShift     int32
  9956  	Fmask          int32
  9957  	FkeyType       int32
  9958  	FfindProc      uintptr
  9959  	FcreateProc    uintptr
  9960  	FtypePtr       uintptr
  9961  } /* tcl.h:1153:9 */
  9962  
  9963  type Tcl_HashTable = Tcl_HashTable1 /* tcl.h:1153:30 */
  9964  type Tcl_HashEntry1 = struct {
  9965  	FnextPtr    uintptr
  9966  	FtablePtr   uintptr
  9967  	Fhash       uintptr
  9968  	FclientData ClientData
  9969  	Fkey        struct{ FoneWordValue uintptr }
  9970  } /* tcl.h:1153:9 */
  9971  
  9972  type Tcl_HashEntry = Tcl_HashEntry1 /* tcl.h:1154:30 */
  9973  
  9974  // Structure definition for information used to keep track of searches through
  9975  // hash tables:
  9976  
  9977  type Tcl_HashSearch1 = struct {
  9978  	FtablePtr     uintptr
  9979  	FnextIndex    int32
  9980  	FnextEntryPtr uintptr
  9981  } /* tcl.h:1308:9 */
  9982  
  9983  // Structure definition for information used to keep track of searches through
  9984  // hash tables:
  9985  
  9986  type Tcl_HashSearch = Tcl_HashSearch1 /* tcl.h:1314:3 */
  9987  
  9988  // Acceptable key types for hash tables:
  9989  //
  9990  // TCL_STRING_KEYS:		The keys are strings, they are copied into the
  9991  //				entry.
  9992  // TCL_ONE_WORD_KEYS:		The keys are pointers, the pointer is stored
  9993  //				in the entry.
  9994  // TCL_CUSTOM_TYPE_KEYS:	The keys are arbitrary types which are copied
  9995  //				into the entry.
  9996  // TCL_CUSTOM_PTR_KEYS:		The keys are pointers to arbitrary types, the
  9997  //				pointer is stored in the entry.
  9998  //
  9999  // While maintaining binary compatibility the above have to be distinct values
 10000  // as they are used to differentiate between old versions of the hash table
 10001  // which don't have a typePtr and new ones which do. Once binary compatibility
 10002  // is discarded in favour of making more wide spread changes TCL_STRING_KEYS
 10003  // can be the same as TCL_CUSTOM_TYPE_KEYS, and TCL_ONE_WORD_KEYS can be the
 10004  // same as TCL_CUSTOM_PTR_KEYS because they simply determine how the key is
 10005  // accessed from the entry and not the behaviour.
 10006  
 10007  // Structure definition for information used to keep track of searches through
 10008  // dictionaries. These fields should not be accessed by code outside
 10009  // tclDictObj.c
 10010  
 10011  type Tcl_DictSearch = struct {
 10012  	Fnext          uintptr
 10013  	Fepoch         int32
 10014  	FdictionaryPtr Tcl_Dict
 10015  } /* tcl.h:1354:3 */
 10016  
 10017  // Positions to pass to Tcl_QueueEvent:
 10018  
 10019  type Tcl_QueuePosition = uint32 /* tcl.h:1389:3 */
 10020  
 10021  // Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
 10022  // event routines.
 10023  
 10024  // The following structure keeps is used to hold a time value, either as an
 10025  // absolute time (the number of seconds from the epoch) or as an elapsed time.
 10026  // On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
 10027  
 10028  type Tcl_Time1 = struct {
 10029  	Fsec  int32
 10030  	Fusec int32
 10031  } /* tcl.h:1405:9 */
 10032  
 10033  // Values to pass to Tcl_SetServiceMode to specify the behavior of notifier
 10034  // event routines.
 10035  
 10036  // The following structure keeps is used to hold a time value, either as an
 10037  // absolute time (the number of seconds from the epoch) or as an elapsed time.
 10038  // On Unix systems the epoch is Midnight Jan 1, 1970 GMT.
 10039  
 10040  type Tcl_Time = Tcl_Time1 /* tcl.h:1408:3 */
 10041  
 10042  // struct Tcl_ChannelType:
 10043  //
 10044  // One such structure exists for each type (kind) of channel. It collects
 10045  // together in one place all the functions that are part of the specific
 10046  // channel type.
 10047  //
 10048  // It is recommend that the Tcl_Channel* functions are used to access elements
 10049  // of this structure, instead of direct accessing.
 10050  
 10051  type Tcl_ChannelType1 = struct {
 10052  	FtypeName         uintptr
 10053  	Fversion          Tcl_ChannelTypeVersion
 10054  	FcloseProc        uintptr
 10055  	FinputProc        uintptr
 10056  	FoutputProc       uintptr
 10057  	FseekProc         uintptr
 10058  	FsetOptionProc    uintptr
 10059  	FgetOptionProc    uintptr
 10060  	FwatchProc        uintptr
 10061  	FgetHandleProc    uintptr
 10062  	Fclose2Proc       uintptr
 10063  	FblockModeProc    uintptr
 10064  	FflushProc        uintptr
 10065  	FhandlerProc      uintptr
 10066  	FwideSeekProc     uintptr
 10067  	FthreadActionProc uintptr
 10068  	FtruncateProc     uintptr
 10069  } /* tcl.h:1524:9 */
 10070  
 10071  // struct Tcl_ChannelType:
 10072  //
 10073  // One such structure exists for each type (kind) of channel. It collects
 10074  // together in one place all the functions that are part of the specific
 10075  // channel type.
 10076  //
 10077  // It is recommend that the Tcl_Channel* functions are used to access elements
 10078  // of this structure, instead of direct accessing.
 10079  
 10080  type Tcl_ChannelType = Tcl_ChannelType1 /* tcl.h:1592:3 */
 10081  
 10082  // The following flags determine whether the blockModeProc above should set
 10083  // the channel into blocking or nonblocking mode. They are passed as arguments
 10084  // to the blockModeProc function in the above structure.
 10085  
 10086  //----------------------------------------------------------------------------
 10087  // Enum for different types of file paths.
 10088  
 10089  type Tcl_PathType = uint32 /* tcl.h:1613:3 */
 10090  
 10091  // The following structure is used to pass glob type data amongst the various
 10092  // glob routines and Tcl_FSMatchInDirectory.
 10093  
 10094  type Tcl_GlobTypeData1 = struct {
 10095  	Ftype       int32
 10096  	Fperm       int32
 10097  	FmacType    uintptr
 10098  	FmacCreator uintptr
 10099  } /* tcl.h:1620:9 */
 10100  
 10101  // The following structure is used to pass glob type data amongst the various
 10102  // glob routines and Tcl_FSMatchInDirectory.
 10103  
 10104  type Tcl_GlobTypeData = Tcl_GlobTypeData1 /* tcl.h:1625:3 */
 10105  // We have to declare the utime structure here.
 10106  type utimbuf = struct {
 10107  	Factime  int32
 10108  	Fmodtime int32
 10109  } /* utime.h:36:1 */
 10110  
 10111  type Tcl_FSVersion = uintptr /* tcl.h:1700:31 */
 10112  
 10113  //----------------------------------------------------------------------------
 10114  // Data structures related to hooking into the filesystem
 10115  
 10116  // Filesystem version tag.  This was introduced in 8.4.
 10117  
 10118  // struct Tcl_Filesystem:
 10119  //
 10120  // One such structure exists for each type (kind) of filesystem. It collects
 10121  // together in one place all the functions that are part of the specific
 10122  // filesystem. Tcl always accesses the filesystem through one of these
 10123  // structures.
 10124  //
 10125  // Not all entries need be non-NULL; any which are NULL are simply ignored.
 10126  // However, a complete filesystem should provide all of these functions. The
 10127  // explanations in the structure show the importance of each function.
 10128  
 10129  type Tcl_Filesystem1 = struct {
 10130  	FtypeName                 uintptr
 10131  	FstructureLength          int32
 10132  	Fversion                  Tcl_FSVersion
 10133  	FpathInFilesystemProc     uintptr
 10134  	FdupInternalRepProc       uintptr
 10135  	FfreeInternalRepProc      uintptr
 10136  	FinternalToNormalizedProc uintptr
 10137  	FcreateInternalRepProc    uintptr
 10138  	FnormalizePathProc        uintptr
 10139  	FfilesystemPathTypeProc   uintptr
 10140  	FfilesystemSeparatorProc  uintptr
 10141  	FstatProc                 uintptr
 10142  	FaccessProc               uintptr
 10143  	FopenFileChannelProc      uintptr
 10144  	FmatchInDirectoryProc     uintptr
 10145  	FutimeProc                uintptr
 10146  	FlinkProc                 uintptr
 10147  	FlistVolumesProc          uintptr
 10148  	FfileAttrStringsProc      uintptr
 10149  	FfileAttrsGetProc         uintptr
 10150  	FfileAttrsSetProc         uintptr
 10151  	FcreateDirectoryProc      uintptr
 10152  	FremoveDirectoryProc      uintptr
 10153  	FdeleteFileProc           uintptr
 10154  	FcopyFileProc             uintptr
 10155  	FrenameFileProc           uintptr
 10156  	FcopyDirectoryProc        uintptr
 10157  	FlstatProc                uintptr
 10158  	FloadFileProc             uintptr
 10159  	FgetCwdProc               uintptr
 10160  	FchdirProc                uintptr
 10161  } /* tcl.h:1726:9 */
 10162  
 10163  //----------------------------------------------------------------------------
 10164  // Data structures related to hooking into the filesystem
 10165  
 10166  // Filesystem version tag.  This was introduced in 8.4.
 10167  
 10168  // struct Tcl_Filesystem:
 10169  //
 10170  // One such structure exists for each type (kind) of filesystem. It collects
 10171  // together in one place all the functions that are part of the specific
 10172  // filesystem. Tcl always accesses the filesystem through one of these
 10173  // structures.
 10174  //
 10175  // Not all entries need be non-NULL; any which are NULL are simply ignored.
 10176  // However, a complete filesystem should provide all of these functions. The
 10177  // explanations in the structure show the importance of each function.
 10178  
 10179  type Tcl_Filesystem = Tcl_Filesystem1 /* tcl.h:1873:3 */
 10180  
 10181  // The following definitions are used as values for the 'linkAction' flag to
 10182  // Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can
 10183  // be given. For link creation, the linkProc should create a link which
 10184  // matches any of the types given.
 10185  //
 10186  // TCL_CREATE_SYMBOLIC_LINK -	Create a symbolic or soft link.
 10187  // TCL_CREATE_HARD_LINK -	Create a hard link.
 10188  
 10189  //----------------------------------------------------------------------------
 10190  // The following structure represents the Notifier functions that you can
 10191  // override with the Tcl_SetNotifier call.
 10192  
 10193  type Tcl_NotifierProcs1 = struct {
 10194  	FsetTimerProc          uintptr
 10195  	FwaitForEventProc      uintptr
 10196  	FcreateFileHandlerProc uintptr
 10197  	FdeleteFileHandlerProc uintptr
 10198  	FinitNotifierProc      uintptr
 10199  	FfinalizeNotifierProc  uintptr
 10200  	FalertNotifierProc     uintptr
 10201  	FserviceModeHookProc   uintptr
 10202  } /* tcl.h:1894:9 */
 10203  
 10204  // The following definitions are used as values for the 'linkAction' flag to
 10205  // Tcl_FSLink, or the linkProc of any filesystem. Any combination of flags can
 10206  // be given. For link creation, the linkProc should create a link which
 10207  // matches any of the types given.
 10208  //
 10209  // TCL_CREATE_SYMBOLIC_LINK -	Create a symbolic or soft link.
 10210  // TCL_CREATE_HARD_LINK -	Create a hard link.
 10211  
 10212  //----------------------------------------------------------------------------
 10213  // The following structure represents the Notifier functions that you can
 10214  // override with the Tcl_SetNotifier call.
 10215  
 10216  type Tcl_NotifierProcs = Tcl_NotifierProcs1 /* tcl.h:1903:3 */
 10217  
 10218  //----------------------------------------------------------------------------
 10219  // The following data structures and declarations are for the new Tcl parser.
 10220  //
 10221  // For each word of a command, and for each piece of a word such as a variable
 10222  // reference, one of the following structures is created to describe the
 10223  // token.
 10224  
 10225  type Tcl_Token1 = struct {
 10226  	Ftype          int32
 10227  	Fstart         uintptr
 10228  	Fsize          int32
 10229  	FnumComponents int32
 10230  } /* tcl.h:1914:9 */
 10231  
 10232  //----------------------------------------------------------------------------
 10233  // The following data structures and declarations are for the new Tcl parser.
 10234  //
 10235  // For each word of a command, and for each piece of a word such as a variable
 10236  // reference, one of the following structures is created to describe the
 10237  // token.
 10238  
 10239  type Tcl_Token = Tcl_Token1 /* tcl.h:1924:3 */
 10240  
 10241  // Type values defined for Tcl_Token structures. These values are defined as
 10242  // mask bits so that it's easy to check for collections of types.
 10243  //
 10244  // TCL_TOKEN_WORD -		The token describes one word of a command,
 10245  //				from the first non-blank character of the word
 10246  //				(which may be " or {) up to but not including
 10247  //				the space, semicolon, or bracket that
 10248  //				terminates the word. NumComponents counts the
 10249  //				total number of sub-tokens that make up the
 10250  //				word. This includes, for example, sub-tokens
 10251  //				of TCL_TOKEN_VARIABLE tokens.
 10252  // TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD except
 10253  //				that the word is guaranteed to consist of a
 10254  //				single TCL_TOKEN_TEXT sub-token.
 10255  // TCL_TOKEN_TEXT -		The token describes a range of literal text
 10256  //				that is part of a word. NumComponents is
 10257  //				always 0.
 10258  // TCL_TOKEN_BS -		The token describes a backslash sequence that
 10259  //				must be collapsed. NumComponents is always 0.
 10260  // TCL_TOKEN_COMMAND -		The token describes a command whose result
 10261  //				must be substituted into the word. The token
 10262  //				includes the enclosing brackets. NumComponents
 10263  //				is always 0.
 10264  // TCL_TOKEN_VARIABLE -		The token describes a variable substitution,
 10265  //				including the dollar sign, variable name, and
 10266  //				array index (if there is one) up through the
 10267  //				right parentheses. NumComponents tells how
 10268  //				many additional tokens follow to represent the
 10269  //				variable name. The first token will be a
 10270  //				TCL_TOKEN_TEXT token that describes the
 10271  //				variable name. If the variable is an array
 10272  //				reference then there will be one or more
 10273  //				additional tokens, of type TCL_TOKEN_TEXT,
 10274  //				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
 10275  //				TCL_TOKEN_VARIABLE, that describe the array
 10276  //				index; numComponents counts the total number
 10277  //				of nested tokens that make up the variable
 10278  //				reference, including sub-tokens of
 10279  //				TCL_TOKEN_VARIABLE tokens.
 10280  // TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of an
 10281  //				expression, from the first non-blank character
 10282  //				of the subexpression up to but not including
 10283  //				the space, brace, or bracket that terminates
 10284  //				the subexpression. NumComponents counts the
 10285  //				total number of following subtokens that make
 10286  //				up the subexpression; this includes all
 10287  //				subtokens for any nested TCL_TOKEN_SUB_EXPR
 10288  //				tokens. For example, a numeric value used as a
 10289  //				primitive operand is described by a
 10290  //				TCL_TOKEN_SUB_EXPR token followed by a
 10291  //				TCL_TOKEN_TEXT token. A binary subexpression
 10292  //				is described by a TCL_TOKEN_SUB_EXPR token
 10293  //				followed by the TCL_TOKEN_OPERATOR token for
 10294  //				the operator, then TCL_TOKEN_SUB_EXPR tokens
 10295  //				for the left then the right operands.
 10296  // TCL_TOKEN_OPERATOR -		The token describes one expression operator.
 10297  //				An operator might be the name of a math
 10298  //				function such as "abs". A TCL_TOKEN_OPERATOR
 10299  //				token is always preceded by one
 10300  //				TCL_TOKEN_SUB_EXPR token for the operator's
 10301  //				subexpression, and is followed by zero or more
 10302  //				TCL_TOKEN_SUB_EXPR tokens for the operator's
 10303  //				operands. NumComponents is always 0.
 10304  // TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
 10305  //				that it marks a word that began with the
 10306  //				literal character prefix "{*}". This word is
 10307  //				marked to be expanded - that is, broken into
 10308  //				words after substitution is complete.
 10309  
 10310  // Parsing error types. On any parsing error, one of these values will be
 10311  // stored in the error field of the Tcl_Parse structure defined below.
 10312  
 10313  // A structure of the following type is filled in by Tcl_ParseCommand. It
 10314  // describes a single command parsed from an input string.
 10315  
 10316  type Tcl_Parse1 = struct {
 10317  	FcommentStart    uintptr
 10318  	FcommentSize     int32
 10319  	FcommandStart    uintptr
 10320  	FcommandSize     int32
 10321  	FnumWords        int32
 10322  	FtokenPtr        uintptr
 10323  	FnumTokens       int32
 10324  	FtokensAvailable int32
 10325  	FerrorType       int32
 10326  	Fstring          uintptr
 10327  	Fend             uintptr
 10328  	Finterp          uintptr
 10329  	Fterm            uintptr
 10330  	Fincomplete      int32
 10331  	FstaticTokens    [20]Tcl_Token
 10332  } /* tcl.h:2030:9 */
 10333  
 10334  // Type values defined for Tcl_Token structures. These values are defined as
 10335  // mask bits so that it's easy to check for collections of types.
 10336  //
 10337  // TCL_TOKEN_WORD -		The token describes one word of a command,
 10338  //				from the first non-blank character of the word
 10339  //				(which may be " or {) up to but not including
 10340  //				the space, semicolon, or bracket that
 10341  //				terminates the word. NumComponents counts the
 10342  //				total number of sub-tokens that make up the
 10343  //				word. This includes, for example, sub-tokens
 10344  //				of TCL_TOKEN_VARIABLE tokens.
 10345  // TCL_TOKEN_SIMPLE_WORD -	This token is just like TCL_TOKEN_WORD except
 10346  //				that the word is guaranteed to consist of a
 10347  //				single TCL_TOKEN_TEXT sub-token.
 10348  // TCL_TOKEN_TEXT -		The token describes a range of literal text
 10349  //				that is part of a word. NumComponents is
 10350  //				always 0.
 10351  // TCL_TOKEN_BS -		The token describes a backslash sequence that
 10352  //				must be collapsed. NumComponents is always 0.
 10353  // TCL_TOKEN_COMMAND -		The token describes a command whose result
 10354  //				must be substituted into the word. The token
 10355  //				includes the enclosing brackets. NumComponents
 10356  //				is always 0.
 10357  // TCL_TOKEN_VARIABLE -		The token describes a variable substitution,
 10358  //				including the dollar sign, variable name, and
 10359  //				array index (if there is one) up through the
 10360  //				right parentheses. NumComponents tells how
 10361  //				many additional tokens follow to represent the
 10362  //				variable name. The first token will be a
 10363  //				TCL_TOKEN_TEXT token that describes the
 10364  //				variable name. If the variable is an array
 10365  //				reference then there will be one or more
 10366  //				additional tokens, of type TCL_TOKEN_TEXT,
 10367  //				TCL_TOKEN_BS, TCL_TOKEN_COMMAND, and
 10368  //				TCL_TOKEN_VARIABLE, that describe the array
 10369  //				index; numComponents counts the total number
 10370  //				of nested tokens that make up the variable
 10371  //				reference, including sub-tokens of
 10372  //				TCL_TOKEN_VARIABLE tokens.
 10373  // TCL_TOKEN_SUB_EXPR -		The token describes one subexpression of an
 10374  //				expression, from the first non-blank character
 10375  //				of the subexpression up to but not including
 10376  //				the space, brace, or bracket that terminates
 10377  //				the subexpression. NumComponents counts the
 10378  //				total number of following subtokens that make
 10379  //				up the subexpression; this includes all
 10380  //				subtokens for any nested TCL_TOKEN_SUB_EXPR
 10381  //				tokens. For example, a numeric value used as a
 10382  //				primitive operand is described by a
 10383  //				TCL_TOKEN_SUB_EXPR token followed by a
 10384  //				TCL_TOKEN_TEXT token. A binary subexpression
 10385  //				is described by a TCL_TOKEN_SUB_EXPR token
 10386  //				followed by the TCL_TOKEN_OPERATOR token for
 10387  //				the operator, then TCL_TOKEN_SUB_EXPR tokens
 10388  //				for the left then the right operands.
 10389  // TCL_TOKEN_OPERATOR -		The token describes one expression operator.
 10390  //				An operator might be the name of a math
 10391  //				function such as "abs". A TCL_TOKEN_OPERATOR
 10392  //				token is always preceded by one
 10393  //				TCL_TOKEN_SUB_EXPR token for the operator's
 10394  //				subexpression, and is followed by zero or more
 10395  //				TCL_TOKEN_SUB_EXPR tokens for the operator's
 10396  //				operands. NumComponents is always 0.
 10397  // TCL_TOKEN_EXPAND_WORD -	This token is just like TCL_TOKEN_WORD except
 10398  //				that it marks a word that began with the
 10399  //				literal character prefix "{*}". This word is
 10400  //				marked to be expanded - that is, broken into
 10401  //				words after substitution is complete.
 10402  
 10403  // Parsing error types. On any parsing error, one of these values will be
 10404  // stored in the error field of the Tcl_Parse structure defined below.
 10405  
 10406  // A structure of the following type is filled in by Tcl_ParseCommand. It
 10407  // describes a single command parsed from an input string.
 10408  
 10409  type Tcl_Parse = Tcl_Parse1 /* tcl.h:2083:3 */
 10410  
 10411  //----------------------------------------------------------------------------
 10412  // The following structure represents a user-defined encoding. It collects
 10413  // together all the functions that are used by the specific encoding.
 10414  
 10415  type Tcl_EncodingType1 = struct {
 10416  	FencodingName uintptr
 10417  	FtoUtfProc    uintptr
 10418  	FfromUtfProc  uintptr
 10419  	FfreeProc     uintptr
 10420  	FclientData   ClientData
 10421  	FnullSize     int32
 10422  } /* tcl.h:2091:9 */
 10423  
 10424  //----------------------------------------------------------------------------
 10425  // The following structure represents a user-defined encoding. It collects
 10426  // together all the functions that are used by the specific encoding.
 10427  
 10428  type Tcl_EncodingType = Tcl_EncodingType1 /* tcl.h:2111:3 */
 10429  
 10430  // The following definitions are used as values for the conversion control
 10431  // flags argument when converting text from one character set to another:
 10432  //
 10433  // TCL_ENCODING_START -		Signifies that the source buffer is the first
 10434  //				block in a (potentially multi-block) input
 10435  //				stream. Tells the conversion function to reset
 10436  //				to an initial state and perform any
 10437  //				initialization that needs to occur before the
 10438  //				first byte is converted. If the source buffer
 10439  //				contains the entire input stream to be
 10440  //				converted, this flag should be set.
 10441  // TCL_ENCODING_END -		Signifies that the source buffer is the last
 10442  //				block in a (potentially multi-block) input
 10443  //				stream. Tells the conversion routine to
 10444  //				perform any finalization that needs to occur
 10445  //				after the last byte is converted and then to
 10446  //				reset to an initial state. If the source
 10447  //				buffer contains the entire input stream to be
 10448  //				converted, this flag should be set.
 10449  // TCL_ENCODING_STOPONERROR -	If set, then the converter will return
 10450  //				immediately upon encountering an invalid byte
 10451  //				sequence or a source character that has no
 10452  //				mapping in the target encoding. If clear, then
 10453  //				the converter will skip the problem,
 10454  //				substituting one or more "close" characters in
 10455  //				the destination buffer and then continue to
 10456  //				convert the source.
 10457  // TCL_ENCODING_NO_TERMINATE - 	If set, Tcl_ExternalToUtf will not append a
 10458  //				terminating NUL byte.  Knowing that it will
 10459  //				not need space to do so, it will fill all
 10460  //				dstLen bytes with encoded UTF-8 content, as
 10461  //				other circumstances permit.  If clear, the
 10462  //				default behavior is to reserve a byte in
 10463  //				the dst space for NUL termination, and to
 10464  //				append the NUL byte.
 10465  // TCL_ENCODING_CHAR_LIMIT -	If set and dstCharsPtr is not NULL, then
 10466  //				Tcl_ExternalToUtf takes the initial value
 10467  //				of *dstCharsPtr is taken as a limit of the
 10468  //				maximum number of chars to produce in the
 10469  //				encoded UTF-8 content.  Otherwise, the
 10470  //				number of chars produced is controlled only
 10471  //				by other limiting factors.
 10472  
 10473  // The following definitions are the error codes returned by the conversion
 10474  // routines:
 10475  //
 10476  // TCL_OK -			All characters were converted.
 10477  // TCL_CONVERT_NOSPACE -	The output buffer would not have been large
 10478  //				enough for all of the converted data; as many
 10479  //				characters as could fit were converted though.
 10480  // TCL_CONVERT_MULTIBYTE -	The last few bytes in the source string were
 10481  //				the beginning of a multibyte sequence, but
 10482  //				more bytes were needed to complete this
 10483  //				sequence. A subsequent call to the conversion
 10484  //				routine should pass the beginning of this
 10485  //				unconverted sequence plus additional bytes
 10486  //				from the source stream to properly convert the
 10487  //				formerly split-up multibyte sequence.
 10488  // TCL_CONVERT_SYNTAX -		The source stream contained an invalid
 10489  //				character sequence. This may occur if the
 10490  //				input stream has been damaged or if the input
 10491  //				encoding method was misidentified. This error
 10492  //				is reported only if TCL_ENCODING_STOPONERROR
 10493  //				was specified.
 10494  // TCL_CONVERT_UNKNOWN -	The source string contained a character that
 10495  //				could not be represented in the target
 10496  //				encoding. This error is reported only if
 10497  //				TCL_ENCODING_STOPONERROR was specified.
 10498  
 10499  // The maximum number of bytes that are necessary to represent a single
 10500  // Unicode character in UTF-8. The valid values should be 3, 4 or 6
 10501  // (or perhaps 1 if we want to support a non-unicode enabled core). If 3 or
 10502  // 4, then Tcl_UniChar must be 2-bytes in size (UCS-2) (the default). If 6,
 10503  // then Tcl_UniChar must be 4-bytes in size (UCS-4). At this time UCS-2 mode
 10504  // is the default and recommended mode. UCS-4 is experimental and not
 10505  // recommended. It works for the core, but most extensions expect UCS-2.
 10506  
 10507  // This represents a Unicode character. Any changes to this should also be
 10508  // reflected in regcustom.h.
 10509  
 10510  type Tcl_UniChar = uint16 /* tcl.h:2228:24 */
 10511  
 10512  //----------------------------------------------------------------------------
 10513  // TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to
 10514  // provide the system with the embedded configuration data.
 10515  
 10516  type Tcl_Config1 = struct {
 10517  	Fkey   uintptr
 10518  	Fvalue uintptr
 10519  } /* tcl.h:2237:9 */
 10520  
 10521  //----------------------------------------------------------------------------
 10522  // TIP #59: The following structure is used in calls 'Tcl_RegisterConfig' to
 10523  // provide the system with the embedded configuration data.
 10524  
 10525  type Tcl_Config = Tcl_Config1 /* tcl.h:2242:3 */
 10526  type mp_digit = uint32        /* tcl.h:2268:22 */
 10527  
 10528  //----------------------------------------------------------------------------
 10529  // Definitions needed for Tcl_ParseArgvObj routines.
 10530  // Based on tkArgv.c.
 10531  // Modifications from the original are copyright (c) Sam Bromley 2006
 10532  
 10533  type Tcl_ArgvInfo = struct {
 10534  	Ftype       int32
 10535  	FkeyStr     uintptr
 10536  	FsrcPtr     uintptr
 10537  	FdstPtr     uintptr
 10538  	FhelpStr    uintptr
 10539  	FclientData ClientData
 10540  } /* tcl.h:2289:3 */
 10541  
 10542  type TclPlatStubs1 = struct {
 10543  	Fmagic int32
 10544  	Fhooks uintptr
 10545  } /* tclDecls.h:1821:11 */
 10546  
 10547  type TclStubHooks = struct {
 10548  	FtclPlatStubs    uintptr
 10549  	FtclIntStubs     uintptr
 10550  	FtclIntPlatStubs uintptr
 10551  } /* tclDecls.h:1824:3 */
 10552  
 10553  type TclStubs1 = struct {
 10554  	Fmagic                                  int32
 10555  	Fhooks                                  uintptr
 10556  	Ftcl_PkgProvideEx                       uintptr
 10557  	Ftcl_PkgRequireEx                       uintptr
 10558  	Ftcl_Panic                              uintptr
 10559  	Ftcl_Alloc                              uintptr
 10560  	Ftcl_Free                               uintptr
 10561  	Ftcl_Realloc                            uintptr
 10562  	Ftcl_DbCkalloc                          uintptr
 10563  	Ftcl_DbCkfree                           uintptr
 10564  	Ftcl_DbCkrealloc                        uintptr
 10565  	Ftcl_CreateFileHandler                  uintptr
 10566  	Ftcl_DeleteFileHandler                  uintptr
 10567  	Ftcl_SetTimer                           uintptr
 10568  	Ftcl_Sleep                              uintptr
 10569  	Ftcl_WaitForEvent                       uintptr
 10570  	Ftcl_AppendAllObjTypes                  uintptr
 10571  	Ftcl_AppendStringsToObj                 uintptr
 10572  	Ftcl_AppendToObj                        uintptr
 10573  	Ftcl_ConcatObj                          uintptr
 10574  	Ftcl_ConvertToType                      uintptr
 10575  	Ftcl_DbDecrRefCount                     uintptr
 10576  	Ftcl_DbIncrRefCount                     uintptr
 10577  	Ftcl_DbIsShared                         uintptr
 10578  	Ftcl_DbNewBooleanObj                    uintptr
 10579  	Ftcl_DbNewByteArrayObj                  uintptr
 10580  	Ftcl_DbNewDoubleObj                     uintptr
 10581  	Ftcl_DbNewListObj                       uintptr
 10582  	Ftcl_DbNewLongObj                       uintptr
 10583  	Ftcl_DbNewObj                           uintptr
 10584  	Ftcl_DbNewStringObj                     uintptr
 10585  	Ftcl_DuplicateObj                       uintptr
 10586  	FtclFreeObj                             uintptr
 10587  	Ftcl_GetBoolean                         uintptr
 10588  	Ftcl_GetBooleanFromObj                  uintptr
 10589  	Ftcl_GetByteArrayFromObj                uintptr
 10590  	Ftcl_GetDouble                          uintptr
 10591  	Ftcl_GetDoubleFromObj                   uintptr
 10592  	Ftcl_GetIndexFromObj                    uintptr
 10593  	Ftcl_GetInt                             uintptr
 10594  	Ftcl_GetIntFromObj                      uintptr
 10595  	Ftcl_GetLongFromObj                     uintptr
 10596  	Ftcl_GetObjType                         uintptr
 10597  	Ftcl_GetStringFromObj                   uintptr
 10598  	Ftcl_InvalidateStringRep                uintptr
 10599  	Ftcl_ListObjAppendList                  uintptr
 10600  	Ftcl_ListObjAppendElement               uintptr
 10601  	Ftcl_ListObjGetElements                 uintptr
 10602  	Ftcl_ListObjIndex                       uintptr
 10603  	Ftcl_ListObjLength                      uintptr
 10604  	Ftcl_ListObjReplace                     uintptr
 10605  	Ftcl_NewBooleanObj                      uintptr
 10606  	Ftcl_NewByteArrayObj                    uintptr
 10607  	Ftcl_NewDoubleObj                       uintptr
 10608  	Ftcl_NewIntObj                          uintptr
 10609  	Ftcl_NewListObj                         uintptr
 10610  	Ftcl_NewLongObj                         uintptr
 10611  	Ftcl_NewObj                             uintptr
 10612  	Ftcl_NewStringObj                       uintptr
 10613  	Ftcl_SetBooleanObj                      uintptr
 10614  	Ftcl_SetByteArrayLength                 uintptr
 10615  	Ftcl_SetByteArrayObj                    uintptr
 10616  	Ftcl_SetDoubleObj                       uintptr
 10617  	Ftcl_SetIntObj                          uintptr
 10618  	Ftcl_SetListObj                         uintptr
 10619  	Ftcl_SetLongObj                         uintptr
 10620  	Ftcl_SetObjLength                       uintptr
 10621  	Ftcl_SetStringObj                       uintptr
 10622  	Ftcl_AddErrorInfo                       uintptr
 10623  	Ftcl_AddObjErrorInfo                    uintptr
 10624  	Ftcl_AllowExceptions                    uintptr
 10625  	Ftcl_AppendElement                      uintptr
 10626  	Ftcl_AppendResult                       uintptr
 10627  	Ftcl_AsyncCreate                        uintptr
 10628  	Ftcl_AsyncDelete                        uintptr
 10629  	Ftcl_AsyncInvoke                        uintptr
 10630  	Ftcl_AsyncMark                          uintptr
 10631  	Ftcl_AsyncReady                         uintptr
 10632  	Ftcl_BackgroundError                    uintptr
 10633  	Ftcl_Backslash                          uintptr
 10634  	Ftcl_BadChannelOption                   uintptr
 10635  	Ftcl_CallWhenDeleted                    uintptr
 10636  	Ftcl_CancelIdleCall                     uintptr
 10637  	Ftcl_Close                              uintptr
 10638  	Ftcl_CommandComplete                    uintptr
 10639  	Ftcl_Concat                             uintptr
 10640  	Ftcl_ConvertElement                     uintptr
 10641  	Ftcl_ConvertCountedElement              uintptr
 10642  	Ftcl_CreateAlias                        uintptr
 10643  	Ftcl_CreateAliasObj                     uintptr
 10644  	Ftcl_CreateChannel                      uintptr
 10645  	Ftcl_CreateChannelHandler               uintptr
 10646  	Ftcl_CreateCloseHandler                 uintptr
 10647  	Ftcl_CreateCommand                      uintptr
 10648  	Ftcl_CreateEventSource                  uintptr
 10649  	Ftcl_CreateExitHandler                  uintptr
 10650  	Ftcl_CreateInterp                       uintptr
 10651  	Ftcl_CreateMathFunc                     uintptr
 10652  	Ftcl_CreateObjCommand                   uintptr
 10653  	Ftcl_CreateSlave                        uintptr
 10654  	Ftcl_CreateTimerHandler                 uintptr
 10655  	Ftcl_CreateTrace                        uintptr
 10656  	Ftcl_DeleteAssocData                    uintptr
 10657  	Ftcl_DeleteChannelHandler               uintptr
 10658  	Ftcl_DeleteCloseHandler                 uintptr
 10659  	Ftcl_DeleteCommand                      uintptr
 10660  	Ftcl_DeleteCommandFromToken             uintptr
 10661  	Ftcl_DeleteEvents                       uintptr
 10662  	Ftcl_DeleteEventSource                  uintptr
 10663  	Ftcl_DeleteExitHandler                  uintptr
 10664  	Ftcl_DeleteHashEntry                    uintptr
 10665  	Ftcl_DeleteHashTable                    uintptr
 10666  	Ftcl_DeleteInterp                       uintptr
 10667  	Ftcl_DetachPids                         uintptr
 10668  	Ftcl_DeleteTimerHandler                 uintptr
 10669  	Ftcl_DeleteTrace                        uintptr
 10670  	Ftcl_DontCallWhenDeleted                uintptr
 10671  	Ftcl_DoOneEvent                         uintptr
 10672  	Ftcl_DoWhenIdle                         uintptr
 10673  	Ftcl_DStringAppend                      uintptr
 10674  	Ftcl_DStringAppendElement               uintptr
 10675  	Ftcl_DStringEndSublist                  uintptr
 10676  	Ftcl_DStringFree                        uintptr
 10677  	Ftcl_DStringGetResult                   uintptr
 10678  	Ftcl_DStringInit                        uintptr
 10679  	Ftcl_DStringResult                      uintptr
 10680  	Ftcl_DStringSetLength                   uintptr
 10681  	Ftcl_DStringStartSublist                uintptr
 10682  	Ftcl_Eof                                uintptr
 10683  	Ftcl_ErrnoId                            uintptr
 10684  	Ftcl_ErrnoMsg                           uintptr
 10685  	Ftcl_Eval                               uintptr
 10686  	Ftcl_EvalFile                           uintptr
 10687  	Ftcl_EvalObj                            uintptr
 10688  	Ftcl_EventuallyFree                     uintptr
 10689  	Ftcl_Exit                               uintptr
 10690  	Ftcl_ExposeCommand                      uintptr
 10691  	Ftcl_ExprBoolean                        uintptr
 10692  	Ftcl_ExprBooleanObj                     uintptr
 10693  	Ftcl_ExprDouble                         uintptr
 10694  	Ftcl_ExprDoubleObj                      uintptr
 10695  	Ftcl_ExprLong                           uintptr
 10696  	Ftcl_ExprLongObj                        uintptr
 10697  	Ftcl_ExprObj                            uintptr
 10698  	Ftcl_ExprString                         uintptr
 10699  	Ftcl_Finalize                           uintptr
 10700  	Ftcl_FindExecutable                     uintptr
 10701  	Ftcl_FirstHashEntry                     uintptr
 10702  	Ftcl_Flush                              uintptr
 10703  	Ftcl_FreeResult                         uintptr
 10704  	Ftcl_GetAlias                           uintptr
 10705  	Ftcl_GetAliasObj                        uintptr
 10706  	Ftcl_GetAssocData                       uintptr
 10707  	Ftcl_GetChannel                         uintptr
 10708  	Ftcl_GetChannelBufferSize               uintptr
 10709  	Ftcl_GetChannelHandle                   uintptr
 10710  	Ftcl_GetChannelInstanceData             uintptr
 10711  	Ftcl_GetChannelMode                     uintptr
 10712  	Ftcl_GetChannelName                     uintptr
 10713  	Ftcl_GetChannelOption                   uintptr
 10714  	Ftcl_GetChannelType                     uintptr
 10715  	Ftcl_GetCommandInfo                     uintptr
 10716  	Ftcl_GetCommandName                     uintptr
 10717  	Ftcl_GetErrno                           uintptr
 10718  	Ftcl_GetHostName                        uintptr
 10719  	Ftcl_GetInterpPath                      uintptr
 10720  	Ftcl_GetMaster                          uintptr
 10721  	Ftcl_GetNameOfExecutable                uintptr
 10722  	Ftcl_GetObjResult                       uintptr
 10723  	Ftcl_GetOpenFile                        uintptr
 10724  	Ftcl_GetPathType                        uintptr
 10725  	Ftcl_Gets                               uintptr
 10726  	Ftcl_GetsObj                            uintptr
 10727  	Ftcl_GetServiceMode                     uintptr
 10728  	Ftcl_GetSlave                           uintptr
 10729  	Ftcl_GetStdChannel                      uintptr
 10730  	Ftcl_GetStringResult                    uintptr
 10731  	Ftcl_GetVar                             uintptr
 10732  	Ftcl_GetVar2                            uintptr
 10733  	Ftcl_GlobalEval                         uintptr
 10734  	Ftcl_GlobalEvalObj                      uintptr
 10735  	Ftcl_HideCommand                        uintptr
 10736  	Ftcl_Init                               uintptr
 10737  	Ftcl_InitHashTable                      uintptr
 10738  	Ftcl_InputBlocked                       uintptr
 10739  	Ftcl_InputBuffered                      uintptr
 10740  	Ftcl_InterpDeleted                      uintptr
 10741  	Ftcl_IsSafe                             uintptr
 10742  	Ftcl_JoinPath                           uintptr
 10743  	Ftcl_LinkVar                            uintptr
 10744  	Freserved188                            uintptr
 10745  	Ftcl_MakeFileChannel                    uintptr
 10746  	Ftcl_MakeSafe                           uintptr
 10747  	Ftcl_MakeTcpClientChannel               uintptr
 10748  	Ftcl_Merge                              uintptr
 10749  	Ftcl_NextHashEntry                      uintptr
 10750  	Ftcl_NotifyChannel                      uintptr
 10751  	Ftcl_ObjGetVar2                         uintptr
 10752  	Ftcl_ObjSetVar2                         uintptr
 10753  	Ftcl_OpenCommandChannel                 uintptr
 10754  	Ftcl_OpenFileChannel                    uintptr
 10755  	Ftcl_OpenTcpClient                      uintptr
 10756  	Ftcl_OpenTcpServer                      uintptr
 10757  	Ftcl_Preserve                           uintptr
 10758  	Ftcl_PrintDouble                        uintptr
 10759  	Ftcl_PutEnv                             uintptr
 10760  	Ftcl_PosixError                         uintptr
 10761  	Ftcl_QueueEvent                         uintptr
 10762  	Ftcl_Read                               uintptr
 10763  	Ftcl_ReapDetachedProcs                  uintptr
 10764  	Ftcl_RecordAndEval                      uintptr
 10765  	Ftcl_RecordAndEvalObj                   uintptr
 10766  	Ftcl_RegisterChannel                    uintptr
 10767  	Ftcl_RegisterObjType                    uintptr
 10768  	Ftcl_RegExpCompile                      uintptr
 10769  	Ftcl_RegExpExec                         uintptr
 10770  	Ftcl_RegExpMatch                        uintptr
 10771  	Ftcl_RegExpRange                        uintptr
 10772  	Ftcl_Release                            uintptr
 10773  	Ftcl_ResetResult                        uintptr
 10774  	Ftcl_ScanElement                        uintptr
 10775  	Ftcl_ScanCountedElement                 uintptr
 10776  	Ftcl_SeekOld                            uintptr
 10777  	Ftcl_ServiceAll                         uintptr
 10778  	Ftcl_ServiceEvent                       uintptr
 10779  	Ftcl_SetAssocData                       uintptr
 10780  	Ftcl_SetChannelBufferSize               uintptr
 10781  	Ftcl_SetChannelOption                   uintptr
 10782  	Ftcl_SetCommandInfo                     uintptr
 10783  	Ftcl_SetErrno                           uintptr
 10784  	Ftcl_SetErrorCode                       uintptr
 10785  	Ftcl_SetMaxBlockTime                    uintptr
 10786  	Ftcl_SetPanicProc                       uintptr
 10787  	Ftcl_SetRecursionLimit                  uintptr
 10788  	Ftcl_SetResult                          uintptr
 10789  	Ftcl_SetServiceMode                     uintptr
 10790  	Ftcl_SetObjErrorCode                    uintptr
 10791  	Ftcl_SetObjResult                       uintptr
 10792  	Ftcl_SetStdChannel                      uintptr
 10793  	Ftcl_SetVar                             uintptr
 10794  	Ftcl_SetVar2                            uintptr
 10795  	Ftcl_SignalId                           uintptr
 10796  	Ftcl_SignalMsg                          uintptr
 10797  	Ftcl_SourceRCFile                       uintptr
 10798  	Ftcl_SplitList                          uintptr
 10799  	Ftcl_SplitPath                          uintptr
 10800  	Ftcl_StaticPackage                      uintptr
 10801  	Ftcl_StringMatch                        uintptr
 10802  	Ftcl_TellOld                            uintptr
 10803  	Ftcl_TraceVar                           uintptr
 10804  	Ftcl_TraceVar2                          uintptr
 10805  	Ftcl_TranslateFileName                  uintptr
 10806  	Ftcl_Ungets                             uintptr
 10807  	Ftcl_UnlinkVar                          uintptr
 10808  	Ftcl_UnregisterChannel                  uintptr
 10809  	Ftcl_UnsetVar                           uintptr
 10810  	Ftcl_UnsetVar2                          uintptr
 10811  	Ftcl_UntraceVar                         uintptr
 10812  	Ftcl_UntraceVar2                        uintptr
 10813  	Ftcl_UpdateLinkedVar                    uintptr
 10814  	Ftcl_UpVar                              uintptr
 10815  	Ftcl_UpVar2                             uintptr
 10816  	Ftcl_VarEval                            uintptr
 10817  	Ftcl_VarTraceInfo                       uintptr
 10818  	Ftcl_VarTraceInfo2                      uintptr
 10819  	Ftcl_Write                              uintptr
 10820  	Ftcl_WrongNumArgs                       uintptr
 10821  	Ftcl_DumpActiveMemory                   uintptr
 10822  	Ftcl_ValidateAllMemory                  uintptr
 10823  	Ftcl_AppendResultVA                     uintptr
 10824  	Ftcl_AppendStringsToObjVA               uintptr
 10825  	Ftcl_HashStats                          uintptr
 10826  	Ftcl_ParseVar                           uintptr
 10827  	Ftcl_PkgPresent                         uintptr
 10828  	Ftcl_PkgPresentEx                       uintptr
 10829  	Ftcl_PkgProvide                         uintptr
 10830  	Ftcl_PkgRequire                         uintptr
 10831  	Ftcl_SetErrorCodeVA                     uintptr
 10832  	Ftcl_VarEvalVA                          uintptr
 10833  	Ftcl_WaitPid                            uintptr
 10834  	Ftcl_PanicVA                            uintptr
 10835  	Ftcl_GetVersion                         uintptr
 10836  	Ftcl_InitMemory                         uintptr
 10837  	Ftcl_StackChannel                       uintptr
 10838  	Ftcl_UnstackChannel                     uintptr
 10839  	Ftcl_GetStackedChannel                  uintptr
 10840  	Ftcl_SetMainLoop                        uintptr
 10841  	Freserved285                            uintptr
 10842  	Ftcl_AppendObjToObj                     uintptr
 10843  	Ftcl_CreateEncoding                     uintptr
 10844  	Ftcl_CreateThreadExitHandler            uintptr
 10845  	Ftcl_DeleteThreadExitHandler            uintptr
 10846  	Ftcl_DiscardResult                      uintptr
 10847  	Ftcl_EvalEx                             uintptr
 10848  	Ftcl_EvalObjv                           uintptr
 10849  	Ftcl_EvalObjEx                          uintptr
 10850  	Ftcl_ExitThread                         uintptr
 10851  	Ftcl_ExternalToUtf                      uintptr
 10852  	Ftcl_ExternalToUtfDString               uintptr
 10853  	Ftcl_FinalizeThread                     uintptr
 10854  	Ftcl_FinalizeNotifier                   uintptr
 10855  	Ftcl_FreeEncoding                       uintptr
 10856  	Ftcl_GetCurrentThread                   uintptr
 10857  	Ftcl_GetEncoding                        uintptr
 10858  	Ftcl_GetEncodingName                    uintptr
 10859  	Ftcl_GetEncodingNames                   uintptr
 10860  	Ftcl_GetIndexFromObjStruct              uintptr
 10861  	Ftcl_GetThreadData                      uintptr
 10862  	Ftcl_GetVar2Ex                          uintptr
 10863  	Ftcl_InitNotifier                       uintptr
 10864  	Ftcl_MutexLock                          uintptr
 10865  	Ftcl_MutexUnlock                        uintptr
 10866  	Ftcl_ConditionNotify                    uintptr
 10867  	Ftcl_ConditionWait                      uintptr
 10868  	Ftcl_NumUtfChars                        uintptr
 10869  	Ftcl_ReadChars                          uintptr
 10870  	Ftcl_RestoreResult                      uintptr
 10871  	Ftcl_SaveResult                         uintptr
 10872  	Ftcl_SetSystemEncoding                  uintptr
 10873  	Ftcl_SetVar2Ex                          uintptr
 10874  	Ftcl_ThreadAlert                        uintptr
 10875  	Ftcl_ThreadQueueEvent                   uintptr
 10876  	Ftcl_UniCharAtIndex                     uintptr
 10877  	Ftcl_UniCharToLower                     uintptr
 10878  	Ftcl_UniCharToTitle                     uintptr
 10879  	Ftcl_UniCharToUpper                     uintptr
 10880  	Ftcl_UniCharToUtf                       uintptr
 10881  	Ftcl_UtfAtIndex                         uintptr
 10882  	Ftcl_UtfCharComplete                    uintptr
 10883  	Ftcl_UtfBackslash                       uintptr
 10884  	Ftcl_UtfFindFirst                       uintptr
 10885  	Ftcl_UtfFindLast                        uintptr
 10886  	Ftcl_UtfNext                            uintptr
 10887  	Ftcl_UtfPrev                            uintptr
 10888  	Ftcl_UtfToExternal                      uintptr
 10889  	Ftcl_UtfToExternalDString               uintptr
 10890  	Ftcl_UtfToLower                         uintptr
 10891  	Ftcl_UtfToTitle                         uintptr
 10892  	Ftcl_UtfToUniChar                       uintptr
 10893  	Ftcl_UtfToUpper                         uintptr
 10894  	Ftcl_WriteChars                         uintptr
 10895  	Ftcl_WriteObj                           uintptr
 10896  	Ftcl_GetString                          uintptr
 10897  	Ftcl_GetDefaultEncodingDir              uintptr
 10898  	Ftcl_SetDefaultEncodingDir              uintptr
 10899  	Ftcl_AlertNotifier                      uintptr
 10900  	Ftcl_ServiceModeHook                    uintptr
 10901  	Ftcl_UniCharIsAlnum                     uintptr
 10902  	Ftcl_UniCharIsAlpha                     uintptr
 10903  	Ftcl_UniCharIsDigit                     uintptr
 10904  	Ftcl_UniCharIsLower                     uintptr
 10905  	Ftcl_UniCharIsSpace                     uintptr
 10906  	Ftcl_UniCharIsUpper                     uintptr
 10907  	Ftcl_UniCharIsWordChar                  uintptr
 10908  	Ftcl_UniCharLen                         uintptr
 10909  	Ftcl_UniCharNcmp                        uintptr
 10910  	Ftcl_UniCharToUtfDString                uintptr
 10911  	Ftcl_UtfToUniCharDString                uintptr
 10912  	Ftcl_GetRegExpFromObj                   uintptr
 10913  	Ftcl_EvalTokens                         uintptr
 10914  	Ftcl_FreeParse                          uintptr
 10915  	Ftcl_LogCommandInfo                     uintptr
 10916  	Ftcl_ParseBraces                        uintptr
 10917  	Ftcl_ParseCommand                       uintptr
 10918  	Ftcl_ParseExpr                          uintptr
 10919  	Ftcl_ParseQuotedString                  uintptr
 10920  	Ftcl_ParseVarName                       uintptr
 10921  	Ftcl_GetCwd                             uintptr
 10922  	Ftcl_Chdir                              uintptr
 10923  	Ftcl_Access                             uintptr
 10924  	Ftcl_Stat                               uintptr
 10925  	Ftcl_UtfNcmp                            uintptr
 10926  	Ftcl_UtfNcasecmp                        uintptr
 10927  	Ftcl_StringCaseMatch                    uintptr
 10928  	Ftcl_UniCharIsControl                   uintptr
 10929  	Ftcl_UniCharIsGraph                     uintptr
 10930  	Ftcl_UniCharIsPrint                     uintptr
 10931  	Ftcl_UniCharIsPunct                     uintptr
 10932  	Ftcl_RegExpExecObj                      uintptr
 10933  	Ftcl_RegExpGetInfo                      uintptr
 10934  	Ftcl_NewUnicodeObj                      uintptr
 10935  	Ftcl_SetUnicodeObj                      uintptr
 10936  	Ftcl_GetCharLength                      uintptr
 10937  	Ftcl_GetUniChar                         uintptr
 10938  	Ftcl_GetUnicode                         uintptr
 10939  	Ftcl_GetRange                           uintptr
 10940  	Ftcl_AppendUnicodeToObj                 uintptr
 10941  	Ftcl_RegExpMatchObj                     uintptr
 10942  	Ftcl_SetNotifier                        uintptr
 10943  	Ftcl_GetAllocMutex                      uintptr
 10944  	Ftcl_GetChannelNames                    uintptr
 10945  	Ftcl_GetChannelNamesEx                  uintptr
 10946  	Ftcl_ProcObjCmd                         uintptr
 10947  	Ftcl_ConditionFinalize                  uintptr
 10948  	Ftcl_MutexFinalize                      uintptr
 10949  	Ftcl_CreateThread                       uintptr
 10950  	Ftcl_ReadRaw                            uintptr
 10951  	Ftcl_WriteRaw                           uintptr
 10952  	Ftcl_GetTopChannel                      uintptr
 10953  	Ftcl_ChannelBuffered                    uintptr
 10954  	Ftcl_ChannelName                        uintptr
 10955  	Ftcl_ChannelVersion                     uintptr
 10956  	Ftcl_ChannelBlockModeProc               uintptr
 10957  	Ftcl_ChannelCloseProc                   uintptr
 10958  	Ftcl_ChannelClose2Proc                  uintptr
 10959  	Ftcl_ChannelInputProc                   uintptr
 10960  	Ftcl_ChannelOutputProc                  uintptr
 10961  	Ftcl_ChannelSeekProc                    uintptr
 10962  	Ftcl_ChannelSetOptionProc               uintptr
 10963  	Ftcl_ChannelGetOptionProc               uintptr
 10964  	Ftcl_ChannelWatchProc                   uintptr
 10965  	Ftcl_ChannelGetHandleProc               uintptr
 10966  	Ftcl_ChannelFlushProc                   uintptr
 10967  	Ftcl_ChannelHandlerProc                 uintptr
 10968  	Ftcl_JoinThread                         uintptr
 10969  	Ftcl_IsChannelShared                    uintptr
 10970  	Ftcl_IsChannelRegistered                uintptr
 10971  	Ftcl_CutChannel                         uintptr
 10972  	Ftcl_SpliceChannel                      uintptr
 10973  	Ftcl_ClearChannelHandlers               uintptr
 10974  	Ftcl_IsChannelExisting                  uintptr
 10975  	Ftcl_UniCharNcasecmp                    uintptr
 10976  	Ftcl_UniCharCaseMatch                   uintptr
 10977  	Ftcl_FindHashEntry                      uintptr
 10978  	Ftcl_CreateHashEntry                    uintptr
 10979  	Ftcl_InitCustomHashTable                uintptr
 10980  	Ftcl_InitObjHashTable                   uintptr
 10981  	Ftcl_CommandTraceInfo                   uintptr
 10982  	Ftcl_TraceCommand                       uintptr
 10983  	Ftcl_UntraceCommand                     uintptr
 10984  	Ftcl_AttemptAlloc                       uintptr
 10985  	Ftcl_AttemptDbCkalloc                   uintptr
 10986  	Ftcl_AttemptRealloc                     uintptr
 10987  	Ftcl_AttemptDbCkrealloc                 uintptr
 10988  	Ftcl_AttemptSetObjLength                uintptr
 10989  	Ftcl_GetChannelThread                   uintptr
 10990  	Ftcl_GetUnicodeFromObj                  uintptr
 10991  	Ftcl_GetMathFuncInfo                    uintptr
 10992  	Ftcl_ListMathFuncs                      uintptr
 10993  	Ftcl_SubstObj                           uintptr
 10994  	Ftcl_DetachChannel                      uintptr
 10995  	Ftcl_IsStandardChannel                  uintptr
 10996  	Ftcl_FSCopyFile                         uintptr
 10997  	Ftcl_FSCopyDirectory                    uintptr
 10998  	Ftcl_FSCreateDirectory                  uintptr
 10999  	Ftcl_FSDeleteFile                       uintptr
 11000  	Ftcl_FSLoadFile                         uintptr
 11001  	Ftcl_FSMatchInDirectory                 uintptr
 11002  	Ftcl_FSLink                             uintptr
 11003  	Ftcl_FSRemoveDirectory                  uintptr
 11004  	Ftcl_FSRenameFile                       uintptr
 11005  	Ftcl_FSLstat                            uintptr
 11006  	Ftcl_FSUtime                            uintptr
 11007  	Ftcl_FSFileAttrsGet                     uintptr
 11008  	Ftcl_FSFileAttrsSet                     uintptr
 11009  	Ftcl_FSFileAttrStrings                  uintptr
 11010  	Ftcl_FSStat                             uintptr
 11011  	Ftcl_FSAccess                           uintptr
 11012  	Ftcl_FSOpenFileChannel                  uintptr
 11013  	Ftcl_FSGetCwd                           uintptr
 11014  	Ftcl_FSChdir                            uintptr
 11015  	Ftcl_FSConvertToPathType                uintptr
 11016  	Ftcl_FSJoinPath                         uintptr
 11017  	Ftcl_FSSplitPath                        uintptr
 11018  	Ftcl_FSEqualPaths                       uintptr
 11019  	Ftcl_FSGetNormalizedPath                uintptr
 11020  	Ftcl_FSJoinToPath                       uintptr
 11021  	Ftcl_FSGetInternalRep                   uintptr
 11022  	Ftcl_FSGetTranslatedPath                uintptr
 11023  	Ftcl_FSEvalFile                         uintptr
 11024  	Ftcl_FSNewNativePath                    uintptr
 11025  	Ftcl_FSGetNativePath                    uintptr
 11026  	Ftcl_FSFileSystemInfo                   uintptr
 11027  	Ftcl_FSPathSeparator                    uintptr
 11028  	Ftcl_FSListVolumes                      uintptr
 11029  	Ftcl_FSRegister                         uintptr
 11030  	Ftcl_FSUnregister                       uintptr
 11031  	Ftcl_FSData                             uintptr
 11032  	Ftcl_FSGetTranslatedStringPath          uintptr
 11033  	Ftcl_FSGetFileSystemForPath             uintptr
 11034  	Ftcl_FSGetPathType                      uintptr
 11035  	Ftcl_OutputBuffered                     uintptr
 11036  	Ftcl_FSMountsChanged                    uintptr
 11037  	Ftcl_EvalTokensStandard                 uintptr
 11038  	Ftcl_GetTime                            uintptr
 11039  	Ftcl_CreateObjTrace                     uintptr
 11040  	Ftcl_GetCommandInfoFromToken            uintptr
 11041  	Ftcl_SetCommandInfoFromToken            uintptr
 11042  	Ftcl_DbNewWideIntObj                    uintptr
 11043  	Ftcl_GetWideIntFromObj                  uintptr
 11044  	Ftcl_NewWideIntObj                      uintptr
 11045  	Ftcl_SetWideIntObj                      uintptr
 11046  	Ftcl_AllocStatBuf                       uintptr
 11047  	Ftcl_Seek                               uintptr
 11048  	Ftcl_Tell                               uintptr
 11049  	Ftcl_ChannelWideSeekProc                uintptr
 11050  	Ftcl_DictObjPut                         uintptr
 11051  	Ftcl_DictObjGet                         uintptr
 11052  	Ftcl_DictObjRemove                      uintptr
 11053  	Ftcl_DictObjSize                        uintptr
 11054  	Ftcl_DictObjFirst                       uintptr
 11055  	Ftcl_DictObjNext                        uintptr
 11056  	Ftcl_DictObjDone                        uintptr
 11057  	Ftcl_DictObjPutKeyList                  uintptr
 11058  	Ftcl_DictObjRemoveKeyList               uintptr
 11059  	Ftcl_NewDictObj                         uintptr
 11060  	Ftcl_DbNewDictObj                       uintptr
 11061  	Ftcl_RegisterConfig                     uintptr
 11062  	Ftcl_CreateNamespace                    uintptr
 11063  	Ftcl_DeleteNamespace                    uintptr
 11064  	Ftcl_AppendExportList                   uintptr
 11065  	Ftcl_Export                             uintptr
 11066  	Ftcl_Import                             uintptr
 11067  	Ftcl_ForgetImport                       uintptr
 11068  	Ftcl_GetCurrentNamespace                uintptr
 11069  	Ftcl_GetGlobalNamespace                 uintptr
 11070  	Ftcl_FindNamespace                      uintptr
 11071  	Ftcl_FindCommand                        uintptr
 11072  	Ftcl_GetCommandFromObj                  uintptr
 11073  	Ftcl_GetCommandFullName                 uintptr
 11074  	Ftcl_FSEvalFileEx                       uintptr
 11075  	Ftcl_SetExitProc                        uintptr
 11076  	Ftcl_LimitAddHandler                    uintptr
 11077  	Ftcl_LimitRemoveHandler                 uintptr
 11078  	Ftcl_LimitReady                         uintptr
 11079  	Ftcl_LimitCheck                         uintptr
 11080  	Ftcl_LimitExceeded                      uintptr
 11081  	Ftcl_LimitSetCommands                   uintptr
 11082  	Ftcl_LimitSetTime                       uintptr
 11083  	Ftcl_LimitSetGranularity                uintptr
 11084  	Ftcl_LimitTypeEnabled                   uintptr
 11085  	Ftcl_LimitTypeExceeded                  uintptr
 11086  	Ftcl_LimitTypeSet                       uintptr
 11087  	Ftcl_LimitTypeReset                     uintptr
 11088  	Ftcl_LimitGetCommands                   uintptr
 11089  	Ftcl_LimitGetTime                       uintptr
 11090  	Ftcl_LimitGetGranularity                uintptr
 11091  	Ftcl_SaveInterpState                    uintptr
 11092  	Ftcl_RestoreInterpState                 uintptr
 11093  	Ftcl_DiscardInterpState                 uintptr
 11094  	Ftcl_SetReturnOptions                   uintptr
 11095  	Ftcl_GetReturnOptions                   uintptr
 11096  	Ftcl_IsEnsemble                         uintptr
 11097  	Ftcl_CreateEnsemble                     uintptr
 11098  	Ftcl_FindEnsemble                       uintptr
 11099  	Ftcl_SetEnsembleSubcommandList          uintptr
 11100  	Ftcl_SetEnsembleMappingDict             uintptr
 11101  	Ftcl_SetEnsembleUnknownHandler          uintptr
 11102  	Ftcl_SetEnsembleFlags                   uintptr
 11103  	Ftcl_GetEnsembleSubcommandList          uintptr
 11104  	Ftcl_GetEnsembleMappingDict             uintptr
 11105  	Ftcl_GetEnsembleUnknownHandler          uintptr
 11106  	Ftcl_GetEnsembleFlags                   uintptr
 11107  	Ftcl_GetEnsembleNamespace               uintptr
 11108  	Ftcl_SetTimeProc                        uintptr
 11109  	Ftcl_QueryTimeProc                      uintptr
 11110  	Ftcl_ChannelThreadActionProc            uintptr
 11111  	Ftcl_NewBignumObj                       uintptr
 11112  	Ftcl_DbNewBignumObj                     uintptr
 11113  	Ftcl_SetBignumObj                       uintptr
 11114  	Ftcl_GetBignumFromObj                   uintptr
 11115  	Ftcl_TakeBignumFromObj                  uintptr
 11116  	Ftcl_TruncateChannel                    uintptr
 11117  	Ftcl_ChannelTruncateProc                uintptr
 11118  	Ftcl_SetChannelErrorInterp              uintptr
 11119  	Ftcl_GetChannelErrorInterp              uintptr
 11120  	Ftcl_SetChannelError                    uintptr
 11121  	Ftcl_GetChannelError                    uintptr
 11122  	Ftcl_InitBignumFromDouble               uintptr
 11123  	Ftcl_GetNamespaceUnknownHandler         uintptr
 11124  	Ftcl_SetNamespaceUnknownHandler         uintptr
 11125  	Ftcl_GetEncodingFromObj                 uintptr
 11126  	Ftcl_GetEncodingSearchPath              uintptr
 11127  	Ftcl_SetEncodingSearchPath              uintptr
 11128  	Ftcl_GetEncodingNameFromEnvironment     uintptr
 11129  	Ftcl_PkgRequireProc                     uintptr
 11130  	Ftcl_AppendObjToErrorInfo               uintptr
 11131  	Ftcl_AppendLimitedToObj                 uintptr
 11132  	Ftcl_Format                             uintptr
 11133  	Ftcl_AppendFormatToObj                  uintptr
 11134  	Ftcl_ObjPrintf                          uintptr
 11135  	Ftcl_AppendPrintfToObj                  uintptr
 11136  	Ftcl_CancelEval                         uintptr
 11137  	Ftcl_Canceled                           uintptr
 11138  	Ftcl_CreatePipe                         uintptr
 11139  	Ftcl_NRCreateCommand                    uintptr
 11140  	Ftcl_NREvalObj                          uintptr
 11141  	Ftcl_NREvalObjv                         uintptr
 11142  	Ftcl_NRCmdSwap                          uintptr
 11143  	Ftcl_NRAddCallback                      uintptr
 11144  	Ftcl_NRCallObjProc                      uintptr
 11145  	Ftcl_GetFSDeviceFromStat                uintptr
 11146  	Ftcl_GetFSInodeFromStat                 uintptr
 11147  	Ftcl_GetModeFromStat                    uintptr
 11148  	Ftcl_GetLinkCountFromStat               uintptr
 11149  	Ftcl_GetUserIdFromStat                  uintptr
 11150  	Ftcl_GetGroupIdFromStat                 uintptr
 11151  	Ftcl_GetDeviceTypeFromStat              uintptr
 11152  	Ftcl_GetAccessTimeFromStat              uintptr
 11153  	Ftcl_GetModificationTimeFromStat        uintptr
 11154  	Ftcl_GetChangeTimeFromStat              uintptr
 11155  	Ftcl_GetSizeFromStat                    uintptr
 11156  	Ftcl_GetBlocksFromStat                  uintptr
 11157  	Ftcl_GetBlockSizeFromStat               uintptr
 11158  	Ftcl_SetEnsembleParameterList           uintptr
 11159  	Ftcl_GetEnsembleParameterList           uintptr
 11160  	Ftcl_ParseArgsObjv                      uintptr
 11161  	Ftcl_GetErrorLine                       uintptr
 11162  	Ftcl_SetErrorLine                       uintptr
 11163  	Ftcl_TransferResult                     uintptr
 11164  	Ftcl_InterpActive                       uintptr
 11165  	Ftcl_BackgroundException                uintptr
 11166  	Ftcl_ZlibDeflate                        uintptr
 11167  	Ftcl_ZlibInflate                        uintptr
 11168  	Ftcl_ZlibCRC32                          uintptr
 11169  	Ftcl_ZlibAdler32                        uintptr
 11170  	Ftcl_ZlibStreamInit                     uintptr
 11171  	Ftcl_ZlibStreamGetCommandName           uintptr
 11172  	Ftcl_ZlibStreamEof                      uintptr
 11173  	Ftcl_ZlibStreamChecksum                 uintptr
 11174  	Ftcl_ZlibStreamPut                      uintptr
 11175  	Ftcl_ZlibStreamGet                      uintptr
 11176  	Ftcl_ZlibStreamClose                    uintptr
 11177  	Ftcl_ZlibStreamReset                    uintptr
 11178  	Ftcl_SetStartupScript                   uintptr
 11179  	Ftcl_GetStartupScript                   uintptr
 11180  	Ftcl_CloseEx                            uintptr
 11181  	Ftcl_NRExprObj                          uintptr
 11182  	Ftcl_NRSubstObj                         uintptr
 11183  	Ftcl_LoadFile                           uintptr
 11184  	Ftcl_FindSymbol                         uintptr
 11185  	Ftcl_FSUnloadFile                       uintptr
 11186  	Ftcl_ZlibStreamSetCompressionDictionary uintptr
 11187  } /* tclDecls.h:1826:9 */
 11188  
 11189  type TclStubs = TclStubs1 /* tclDecls.h:2485:3 */
 11190  
 11191  // !END!: Do not edit above this line.
 11192  
 11193  // Deprecated Tcl procedures:
 11194  
 11195  // Include platform specific public function declarations that are accessible
 11196  // via the stubs table. Make all TclOO symbols MODULE_SCOPE (which only
 11197  // has effect on building it as a shared library). See ticket [3010352].
 11198  
 11199  // tclPlatDecls.h --
 11200  //
 11201  //	Declarations of platform specific Tcl APIs.
 11202  //
 11203  // Copyright (c) 1998-1999 by Scriptics Corporation.
 11204  // All rights reserved.
 11205  
 11206  // WARNING: This file is automatically generated by the tools/genStubs.tcl
 11207  // script.  Any modifications to the function declarations below should be made
 11208  // in the generic/tcl.decls script.
 11209  
 11210  // TCHAR is needed here for win32, so if it is not defined yet do it here.
 11211  // This way, we don't need to include <tchar.h> just for one define.
 11212  
 11213  // !BEGIN!: Do not edit below this line.
 11214  
 11215  // Exported function declarations:
 11216  
 11217  type TclPlatStubs = TclPlatStubs1 /* tclPlatDecls.h:86:3 */
 11218  
 11219  // end block for C++
 11220  
 11221  // Local Variables:
 11222  // mode: c
 11223  // c-basic-offset: 4
 11224  // fill-column: 78
 11225  // End:
 11226  
 11227  // Extract an sqlite3* db handle from the object passed as the second
 11228  // argument. If successful, set *pDb to point to the db handle and return
 11229  // TCL_OK. Otherwise, return TCL_ERROR.
 11230  func dbHandleFromObj(tls *libc.TLS, interp uintptr, pObj uintptr, pDb uintptr) int32 { /* test_expert.c:36:12: */
 11231  	bp := tls.Alloc(56)
 11232  	defer tls.Free(56)
 11233  
 11234  	// var info Tcl_CmdInfo at bp+24, 32
 11235  
 11236  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, pObj), bp+24 /* &info */) {
 11237  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, pObj), 0))
 11238  		return TCL_ERROR
 11239  	}
 11240  
 11241  	*(*uintptr)(unsafe.Pointer(pDb)) = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 11242  	return TCL_OK
 11243  }
 11244  
 11245  // Tclcmd:  $expert sql SQL
 11246  //          $expert analyze
 11247  //          $expert count
 11248  //          $expert report STMT EREPORT
 11249  //          $expert destroy
 11250  func testExpertCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_expert.c:55:26: */
 11251  	bp := tls.Alloc(108)
 11252  	defer tls.Free(108)
 11253  
 11254  	var pExpert uintptr = clientData
 11255  	*(*[6]Subcmd)(unsafe.Pointer(bp /* aSub */)) = [6]Subcmd{
 11256  		{FzSub: ts + 1808 /* "sql" */, FnArg: 1, FzMsg: ts + 1812 /* "TABLE" */},           // 0
 11257  		{FzSub: ts + 1818 /* "analyze" */, FzMsg: ts + 489 /* "" */},                       // 1
 11258  		{FzSub: ts + 1826 /* "count" */, FzMsg: ts + 489 /* "" */},                         // 2
 11259  		{FzSub: ts + 1832 /* "report" */, FnArg: 2, FzMsg: ts + 1839 /* "STMT EREPORT" */}, // 3
 11260  		{FzSub: ts + 1852 /* "destroy" */, FzMsg: ts + 489 /* "" */},                       // 4
 11261  		{},
 11262  	}
 11263  	// var iSub int32 at bp+72, 4
 11264  
 11265  	var rc int32 = TCL_OK
 11266  	*(*uintptr)(unsafe.Pointer(bp + 76 /* zErr */)) = uintptr(0)
 11267  
 11268  	if objc < 2 {
 11269  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 11270  		return TCL_ERROR
 11271  	}
 11272  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 11273  		*(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &aSub[0] */, int32(unsafe.Sizeof(Subcmd{})), ts+1875 /* "sub-command" */, 0, bp+72 /* &iSub */)
 11274  	if rc != TCL_OK {
 11275  		return rc
 11276  	}
 11277  	if objc != (2 + (*Subcmd)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* iSub */)))*12)).FnArg) {
 11278  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*Subcmd)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* iSub */)))*12)).FzMsg)
 11279  		return TCL_ERROR
 11280  	}
 11281  
 11282  	switch *(*int32)(unsafe.Pointer(bp + 72 /* iSub */)) {
 11283  	case 0:
 11284  		{ // sql
 11285  			var zArg uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 11286  			rc = sqlite3_expert_sql(tls, pExpert, zArg, bp+76 /* &zErr */)
 11287  			break
 11288  
 11289  		}
 11290  
 11291  	case 1:
 11292  		{ // analyze
 11293  			rc = sqlite3_expert_analyze(tls, pExpert, bp+76 /* &zErr */)
 11294  			break
 11295  
 11296  		}
 11297  
 11298  	case 2:
 11299  		{ // count
 11300  			var n int32 = sqlite3_expert_count(tls, pExpert)
 11301  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, n))
 11302  			break
 11303  
 11304  		}
 11305  
 11306  	case 3:
 11307  		{ // report
 11308  			*(*[5]uintptr)(unsafe.Pointer(bp + 84 /* aEnum */)) = [5]uintptr{
 11309  				ts + 1808 /* "sql" */, ts + 1887 /* "indexes" */, ts + 1895 /* "plan" */, ts + 1900 /* "candidates" */, uintptr(0),
 11310  			}
 11311  			// var iEnum int32 at bp+104, 4
 11312  
 11313  			// var iStmt int32 at bp+80, 4
 11314  
 11315  			var zReport uintptr
 11316  
 11317  			if (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+80 /* &iStmt */) != 0) ||
 11318  				(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+84 /* &aEnum[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+1832 /* "report" */, 0, bp+104 /* &iEnum */) != 0) {
 11319  				return TCL_ERROR
 11320  			}
 11321  
 11322  			zReport = sqlite3_expert_report(tls, pExpert, *(*int32)(unsafe.Pointer(bp + 80 /* iStmt */)), (1 + *(*int32)(unsafe.Pointer(bp + 104 /* iEnum */))))
 11323  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zReport, -1))
 11324  			break
 11325  
 11326  		}
 11327  
 11328  	default: // destroy
 11329  
 11330  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 11331  		break
 11332  	}
 11333  
 11334  	if rc != TCL_OK {
 11335  		if *(*uintptr)(unsafe.Pointer(bp + 76 /* zErr */)) != 0 {
 11336  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 76 /* zErr */)), -1))
 11337  		} else {
 11338  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 11339  		}
 11340  	}
 11341  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 76 /* zErr */)))
 11342  	return rc
 11343  }
 11344  
 11345  type Subcmd = struct {
 11346  	FzSub uintptr
 11347  	FnArg int32
 11348  	FzMsg uintptr
 11349  } /* test_expert.c:62:3 */
 11350  
 11351  func testExpertDel(tls *libc.TLS, clientData uintptr) { /* test_expert.c:150:27: */
 11352  	var pExpert uintptr = clientData
 11353  	sqlite3_expert_destroy(tls, pExpert)
 11354  }
 11355  
 11356  // sqlite3_expert_new DB
 11357  func test_sqlite3_expert_new(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_expert.c:158:26: */
 11358  	bp := tls.Alloc(48)
 11359  	defer tls.Free(48)
 11360  
 11361  	// var db uintptr at bp+40, 4
 11362  
 11363  	var zCmd uintptr = uintptr(0)
 11364  	*(*uintptr)(unsafe.Pointer(bp + 44 /* zErr */)) = uintptr(0)
 11365  	var pExpert uintptr
 11366  	var rc int32 = TCL_OK
 11367  
 11368  	if objc != 2 {
 11369  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 11370  		return TCL_ERROR
 11371  	}
 11372  	if dbHandleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+40 /* &db */) != 0 {
 11373  		return TCL_ERROR
 11374  	}
 11375  
 11376  	zCmd = sqlite3.Xsqlite3_mprintf(tls, ts+1914 /* "sqlite3expert%d" */, libc.VaList(bp, libc.PreIncInt32(&iCmd, 1)))
 11377  	if zCmd == uintptr(0) {
 11378  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, ts+1930 /* "out of memory" */, uintptr(0)))
 11379  		return TCL_ERROR
 11380  	}
 11381  
 11382  	pExpert = sqlite3_expert_new(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), bp+44 /* &zErr */)
 11383  	if pExpert == uintptr(0) {
 11384  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(bp + 44 /* zErr */)), uintptr(0)))
 11385  		rc = TCL_ERROR
 11386  	} else {
 11387  		var p uintptr = pExpert
 11388  		tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 11389  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11390  		}{testExpertCmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testExpertDel})))
 11391  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zCmd, -1))
 11392  	}
 11393  
 11394  	sqlite3.Xsqlite3_free(tls, zCmd)
 11395  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 44 /* zErr */)))
 11396  	return rc
 11397  }
 11398  
 11399  var iCmd int32 = 0 /* test_expert.c:164:14 */
 11400  
 11401  func TestExpert_Init(tls *libc.TLS, interp uintptr) int32 { /* test_expert.c:202:5: */
 11402  	bp := tls.Alloc(8)
 11403  	defer tls.Free(8)
 11404  
 11405  	*(*[1]struct {
 11406  		FzCmd  uintptr
 11407  		FxProc uintptr
 11408  	})(unsafe.Pointer(bp /* aCmd */)) = [1]struct {
 11409  		FzCmd  uintptr
 11410  		FxProc uintptr
 11411  	}{
 11412  		{FzCmd: ts + 1944 /* "sqlite3_expert_n..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 11413  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11414  		}{test_sqlite3_expert_new}))},
 11415  	}
 11416  	var i int32
 11417  
 11418  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof([1]struct {
 11419  		FzCmd  uintptr
 11420  		FxProc uintptr
 11421  	}{})) / uint32(unsafe.Sizeof(struct {
 11422  		FzCmd  uintptr
 11423  		FxProc uintptr
 11424  	}{}))); i++ {
 11425  		var p uintptr = (bp /* &aCmd */ + uintptr(i)*8)
 11426  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 11427  			FzCmd  uintptr
 11428  			FxProc uintptr
 11429  		})(unsafe.Pointer(p)).FzCmd, (*struct {
 11430  			FzCmd  uintptr
 11431  			FxProc uintptr
 11432  		})(unsafe.Pointer(p)).FxProc, uintptr(0), uintptr(0))
 11433  	}
 11434  	return TCL_OK
 11435  }
 11436  
 11437  // 2011 Jan 27
 11438  //
 11439  // The author disclaims copyright to this source code.  In place of
 11440  // a legal notice, here is a blessing:
 11441  //
 11442  //    May you do good and not evil.
 11443  //    May you find forgiveness for yourself and forgive others.
 11444  //    May you share freely, never taking more than you give.
 11445  //
 11446  //
 11447  //
 11448  // This file is not part of the production FTS code. It is only used for
 11449  // testing. It contains a virtual table implementation that provides direct
 11450  // access to the full-text index of an FTS table.
 11451  
 11452  // 2009 Nov 12
 11453  //
 11454  // The author disclaims copyright to this source code.  In place of
 11455  // a legal notice, here is a blessing:
 11456  //
 11457  //    May you do good and not evil.
 11458  //    May you find forgiveness for yourself and forgive others.
 11459  //    May you share freely, never taking more than you give.
 11460  //
 11461  //
 11462  //
 11463  
 11464  // FTS3/FTS4 require virtual tables
 11465  
 11466  // FTS4 is really an extension for FTS3.  It is enabled using the
 11467  // SQLITE_ENABLE_FTS3 macro.  But to avoid confusion we also all
 11468  // the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
 11469  
 11470  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 11471  //    This file is part of the GNU C Library.
 11472  //
 11473  //    The GNU C Library is free software; you can redistribute it and/or
 11474  //    modify it under the terms of the GNU Lesser General Public
 11475  //    License as published by the Free Software Foundation; either
 11476  //    version 2.1 of the License, or (at your option) any later version.
 11477  //
 11478  //    The GNU C Library is distributed in the hope that it will be useful,
 11479  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 11480  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 11481  //    Lesser General Public License for more details.
 11482  //
 11483  //    You should have received a copy of the GNU Lesser General Public
 11484  //    License along with the GNU C Library; if not, see
 11485  //    <http://www.gnu.org/licenses/>.
 11486  
 11487  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 11488  
 11489  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 11490  //    This file is part of the GNU C Library.
 11491  //
 11492  //    The GNU C Library is free software; you can redistribute it and/or
 11493  //    modify it under the terms of the GNU Lesser General Public
 11494  //    License as published by the Free Software Foundation; either
 11495  //    version 2.1 of the License, or (at your option) any later version.
 11496  //
 11497  //    The GNU C Library is distributed in the hope that it will be useful,
 11498  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 11499  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 11500  //    Lesser General Public License for more details.
 11501  //
 11502  //    You should have received a copy of the GNU Lesser General Public
 11503  //    License along with the GNU C Library; if not, see
 11504  //    <http://www.gnu.org/licenses/>.
 11505  
 11506  // void assert (int expression);
 11507  //
 11508  //    If NDEBUG is defined, do nothing.
 11509  //    If not, and EXPRESSION is zero, print an error message and abort.
 11510  
 11511  // void assert_perror (int errnum);
 11512  //
 11513  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 11514  //    error message with the error text for ERRNUM and abort.
 11515  //    (This is a GNU extension.)
 11516  
 11517  // Decode a pointer to an sqlite3 object.
 11518  func f5tDbPointer(tls *libc.TLS, interp uintptr, pObj uintptr, ppDb uintptr) int32 { /* fts5_tcl.c:54:12: */
 11519  	bp := tls.Alloc(32)
 11520  	defer tls.Free(32)
 11521  
 11522  	var p uintptr
 11523  	// var cmdInfo Tcl_CmdInfo at bp, 32
 11524  
 11525  	var z uintptr = tcl.XTcl_GetString(tls, pObj)
 11526  	if tcl.XTcl_GetCommandInfo(tls, interp, z, bp /* &cmdInfo */) != 0 {
 11527  		p = (*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData
 11528  		*(*uintptr)(unsafe.Pointer(ppDb)) = (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb
 11529  		return TCL_OK
 11530  	}
 11531  	return TCL_ERROR
 11532  }
 11533  
 11534  // End of code that accesses the SqliteDb struct.
 11535  //
 11536  
 11537  func f5tResultToErrorCode(tls *libc.TLS, zRes uintptr) int32 { /* fts5_tcl.c:69:12: */
 11538  	bp := tls.Alloc(32)
 11539  	defer tls.Free(32)
 11540  
 11541  	*(*[4]ErrorCode)(unsafe.Pointer(bp /* aErr */)) = [4]ErrorCode{
 11542  		{Frc: SQLITE_DONE, FzError: ts + 1963 /* "SQLITE_DONE" */},
 11543  		{Frc: SQLITE_ERROR, FzError: ts + 1975 /* "SQLITE_ERROR" */},
 11544  		{FzError: ts + 1988 /* "SQLITE_OK" */},
 11545  		{FzError: ts + 489 /* "" */},
 11546  	}
 11547  	var i int32
 11548  
 11549  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof([4]ErrorCode{})) / uint32(unsafe.Sizeof(ErrorCode{}))); i++ {
 11550  		if 0 == sqlite3.Xsqlite3_stricmp(tls, zRes, (*ErrorCode)(unsafe.Pointer(bp /* &aErr */ +uintptr(i)*8)).FzError) {
 11551  			return (*ErrorCode)(unsafe.Pointer(bp /* &aErr */ + uintptr(i)*8)).Frc
 11552  		}
 11553  	}
 11554  
 11555  	return SQLITE_ERROR
 11556  }
 11557  
 11558  type ErrorCode = struct {
 11559  	Frc     int32
 11560  	FzError uintptr
 11561  } /* fts5_tcl.c:70:3 */
 11562  
 11563  func f5tDbAndApi(tls *libc.TLS, interp uintptr, pObj uintptr, ppDb uintptr, ppApi uintptr) int32 { /* fts5_tcl.c:90:26: */
 11564  	bp := tls.Alloc(60)
 11565  	defer tls.Free(60)
 11566  
 11567  	*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)) = uintptr(0)
 11568  	var rc int32 = f5tDbPointer(tls, interp, pObj, bp+48 /* &db */)
 11569  	if rc != TCL_OK {
 11570  		return TCL_ERROR
 11571  	} else {
 11572  		*(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)) = uintptr(0)
 11573  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pApi */)) = uintptr(0)
 11574  
 11575  		rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+1998 /* "SELECT fts5(?1)" */, -1, bp+52 /* &pStmt */, uintptr(0))
 11576  		if rc != SQLITE_OK {
 11577  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))), 0))
 11578  			return TCL_ERROR
 11579  		}
 11580  		sqlite3.Xsqlite3_bind_pointer(tls, *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)), 1, bp+56 /* &pApi */, ts+2022 /* "fts5_api_ptr" */, uintptr(0))
 11581  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)))
 11582  
 11583  		if sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */))) != SQLITE_OK {
 11584  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))), 0))
 11585  			return TCL_ERROR
 11586  		}
 11587  
 11588  		*(*uintptr)(unsafe.Pointer(ppDb)) = *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))
 11589  		*(*uintptr)(unsafe.Pointer(ppApi)) = *(*uintptr)(unsafe.Pointer(bp + 56 /* pApi */))
 11590  	}
 11591  
 11592  	return TCL_OK
 11593  }
 11594  
 11595  type F5tFunction1 = struct {
 11596  	Finterp  uintptr
 11597  	FpScript uintptr
 11598  } /* fts5_tcl.c:124:9 */
 11599  
 11600  type F5tFunction = F5tFunction1 /* fts5_tcl.c:124:28 */
 11601  
 11602  type F5tApi1 = struct {
 11603  	FpApi uintptr
 11604  	FpFts uintptr
 11605  } /* fts5_tcl.c:130:9 */
 11606  
 11607  type F5tApi = F5tApi1 /* fts5_tcl.c:130:23 */
 11608  
 11609  // An object of this type is used with the xSetAuxdata() and xGetAuxdata()
 11610  // API test wrappers. The tcl interface allows a single tcl value to be
 11611  // saved using xSetAuxdata(). Instead of simply storing a pointer to the
 11612  // tcl object, the code in this file wraps it in an sqlite3_malloc'd
 11613  // instance of the following struct so that if the destructor is not
 11614  // correctly invoked it will be reported as an SQLite memory leak.
 11615  type F5tAuxData1 = struct{ FpObj uintptr } /* fts5_tcl.c:144:9 */
 11616  
 11617  // An object of this type is used with the xSetAuxdata() and xGetAuxdata()
 11618  // API test wrappers. The tcl interface allows a single tcl value to be
 11619  // saved using xSetAuxdata(). Instead of simply storing a pointer to the
 11620  // tcl object, the code in this file wraps it in an sqlite3_malloc'd
 11621  // instance of the following struct so that if the destructor is not
 11622  // correctly invoked it will be reported as an SQLite memory leak.
 11623  type F5tAuxData = F5tAuxData1 /* fts5_tcl.c:144:27 */
 11624  
 11625  func xTokenizeCb(tls *libc.TLS, pCtx uintptr, tflags int32, zToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_tcl.c:149:12: */
 11626  	var p uintptr = pCtx
 11627  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 11628  	var rc int32
 11629  
 11630  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11631  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 11632  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, iStart))
 11633  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, iEnd))
 11634  
 11635  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, 0)
 11636  	for ok := true; ok; ok = 0 != 0 {
 11637  		var _objPtr uintptr = pEval
 11638  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11639  			tcl.XTclFreeObj(tls, _objPtr)
 11640  		}
 11641  	}
 11642  	if rc == TCL_OK {
 11643  		rc = f5tResultToErrorCode(tls, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp))
 11644  	}
 11645  
 11646  	return rc
 11647  }
 11648  
 11649  func xQueryPhraseCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr) int32 { /* fts5_tcl.c:175:12: */
 11650  	bp := tls.Alloc(80)
 11651  	defer tls.Free(80)
 11652  
 11653  	var p uintptr = pCtx
 11654  	var pEval uintptr
 11655  	var rc int32
 11656  	// var zCmd [64]int8 at bp+8, 64
 11657  
 11658  	// var sApi F5tApi at bp+72, 8
 11659  
 11660  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpApi = pApi
 11661  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpFts = pFts
 11662  	libc.Xsprintf(tls, bp+8 /* &zCmd[0] */, ts+2035 /* "f5t_2_%lld" */, libc.VaList(bp, libc.PostIncInt64(&iCmd1, 1)))
 11663  	tcl.XTcl_CreateObjCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 11664  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 11665  	}{xF5tApi})), bp+72 /* &sApi */, uintptr(0))
 11666  
 11667  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 11668  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 11669  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, bp+8 /* &zCmd[0] */, -1))
 11670  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, 0)
 11671  	for ok := true; ok; ok = 0 != 0 {
 11672  		var _objPtr uintptr = pEval
 11673  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11674  			tcl.XTclFreeObj(tls, _objPtr)
 11675  		}
 11676  	}
 11677  	tcl.XTcl_DeleteCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */)
 11678  
 11679  	if rc == TCL_OK {
 11680  		rc = f5tResultToErrorCode(tls, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp))
 11681  	}
 11682  
 11683  	return rc
 11684  }
 11685  
 11686  var iCmd1 sqlite3_int64 = int64(0) /* fts5_tcl.c:181:24 */
 11687  
 11688  func xSetAuxdataDestructor(tls *libc.TLS, p uintptr) { /* fts5_tcl.c:207:13: */
 11689  	var pData uintptr = p
 11690  	for ok := true; ok; ok = 0 != 0 {
 11691  		var _objPtr uintptr = (*F5tAuxData)(unsafe.Pointer(pData)).FpObj
 11692  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 11693  			tcl.XTclFreeObj(tls, _objPtr)
 11694  		}
 11695  	}
 11696  	sqlite3.Xsqlite3_free(tls, pData)
 11697  }
 11698  
 11699  //      api sub-command...
 11700  //
 11701  // Description...
 11702  func xF5tApi(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:218:26: */
 11703  	bp := tls.Alloc(404)
 11704  	defer tls.Free(404)
 11705  
 11706  	*(*[19]Sub)(unsafe.Pointer(bp + 32 /* aSub */)) = [19]Sub{
 11707  		{FzName: ts + 2046 /* "xColumnCount" */, FzMsg: ts + 489 /* "" */},                                      //  0
 11708  		{FzName: ts + 2059 /* "xRowCount" */, FzMsg: ts + 489 /* "" */},                                         //  1
 11709  		{FzName: ts + 2069 /* "xColumnTotalSize" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                    //  2
 11710  		{FzName: ts + 2090 /* "xTokenize" */, FnArg: 2, FzMsg: ts + 2100 /* "TEXT SCRIPT" */},                   //  3
 11711  		{FzName: ts + 2112 /* "xPhraseCount" */, FzMsg: ts + 489 /* "" */},                                      //  4
 11712  		{FzName: ts + 2125 /* "xPhraseSize" */, FnArg: 1, FzMsg: ts + 2137 /* "PHRASE" */},                      //  5
 11713  		{FzName: ts + 2144 /* "xInstCount" */, FzMsg: ts + 489 /* "" */},                                        //  6
 11714  		{FzName: ts + 2155 /* "xInst" */, FnArg: 1, FzMsg: ts + 2161 /* "IDX" */},                               //  7
 11715  		{FzName: ts + 2165 /* "xRowid" */, FzMsg: ts + 489 /* "" */},                                            //  8
 11716  		{FzName: ts + 2172 /* "xColumnText" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                         //  9
 11717  		{FzName: ts + 2184 /* "xColumnSize" */, FnArg: 1, FzMsg: ts + 2086 /* "COL" */},                         // 10
 11718  		{FzName: ts + 2196 /* "xQueryPhrase" */, FnArg: 2, FzMsg: ts + 2209 /* "PHRASE SCRIPT" */},              // 11
 11719  		{FzName: ts + 2223 /* "xSetAuxdata" */, FnArg: 1, FzMsg: ts + 2235 /* "VALUE" */},                       // 12
 11720  		{FzName: ts + 2241 /* "xGetAuxdata" */, FnArg: 1, FzMsg: ts + 2253 /* "CLEAR" */},                       // 13
 11721  		{FzName: ts + 2259 /* "xSetAuxdataInt" */, FnArg: 1, FzMsg: ts + 2274 /* "INTEGER" */},                  // 14
 11722  		{FzName: ts + 2282 /* "xGetAuxdataInt" */, FnArg: 1, FzMsg: ts + 2253 /* "CLEAR" */},                    // 15
 11723  		{FzName: ts + 2297 /* "xPhraseForeach" */, FnArg: 4, FzMsg: ts + 2312 /* "IPHRASE COLVAR O..." */},      // 16
 11724  		{FzName: ts + 2341 /* "xPhraseColumnFor..." */, FnArg: 3, FzMsg: ts + 2362 /* "IPHRASE COLVAR S..." */}, // 17
 11725  		{},
 11726  	}
 11727  	var rc int32
 11728  	*(*int32)(unsafe.Pointer(bp + 260 /* iSub */)) = 0
 11729  	var p uintptr = clientData
 11730  
 11731  	if objc < 2 {
 11732  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2384 /* "SUB-COMMAND" */)
 11733  		return TCL_ERROR
 11734  	}
 11735  
 11736  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 11737  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+32 /* &aSub[0] */, int32(unsafe.Sizeof(Sub{})), ts+2384 /* "SUB-COMMAND" */, 0, bp+260 /* &iSub */)
 11738  	if rc != TCL_OK {
 11739  		return rc
 11740  	}
 11741  	if (*Sub)(unsafe.Pointer(bp+32 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 260 /* iSub */)))*12)).FnArg != (objc - 2) {
 11742  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, (*Sub)(unsafe.Pointer(bp+32 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 260 /* iSub */)))*12)).FzMsg)
 11743  		return TCL_ERROR
 11744  	}
 11745  
 11746  	switch *(*int32)(unsafe.Pointer(bp + 260 /* iSub */)) {
 11747  	case 0:
 11748  		{
 11749  			var nCol int32
 11750  			nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 8 /* &.xColumnCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11751  			if rc == SQLITE_OK {
 11752  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nCol))
 11753  			}
 11754  			break
 11755  
 11756  		}
 11757  	case 1:
 11758  		{
 11759  			// var nRow sqlite3_int64 at bp+264, 8
 11760  
 11761  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 12 /* &.xRowCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+264 /* &nRow */)
 11762  			if rc == SQLITE_OK {
 11763  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 264 /* nRow */))))
 11764  			}
 11765  			break
 11766  
 11767  		}
 11768  	case 2:
 11769  		{
 11770  			// var iCol int32 at bp+272, 4
 11771  
 11772  			// var nSize sqlite3_int64 at bp+280, 8
 11773  
 11774  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+272 /* &iCol */) != 0 {
 11775  				return TCL_ERROR
 11776  			}
 11777  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 16 /* &.xColumnTotalSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 272 /* iCol */)), bp+280 /* &nSize */)
 11778  			if rc == SQLITE_OK {
 11779  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 280 /* nSize */))))
 11780  			}
 11781  			break
 11782  
 11783  		}
 11784  	case 3:
 11785  		{
 11786  			// var nText int32 at bp+288, 4
 11787  
 11788  			var zText uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+288 /* &nText */)
 11789  			// var ctx F5tFunction at bp+292, 8
 11790  
 11791  			(*F5tFunction)(unsafe.Pointer(bp + 292 /* &ctx */)).Finterp = interp
 11792  			(*F5tFunction)(unsafe.Pointer(bp + 292 /* &ctx */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 11793  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 20 /* &.xTokenize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, zText, *(*int32)(unsafe.Pointer(bp + 288 /* nText */)), bp+292 /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct {
 11794  				f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 11795  			}{xTokenizeCb})))
 11796  			if rc == SQLITE_OK {
 11797  				tcl.XTcl_ResetResult(tls, interp)
 11798  			}
 11799  			return rc
 11800  
 11801  		}
 11802  	case 4:
 11803  		{
 11804  			var nPhrase int32
 11805  			nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 24 /* &.xPhraseCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11806  			if rc == SQLITE_OK {
 11807  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nPhrase))
 11808  			}
 11809  			break
 11810  
 11811  		}
 11812  	case 5:
 11813  		{
 11814  			// var iPhrase int32 at bp+300, 4
 11815  
 11816  			var sz int32
 11817  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+300 /* &iPhrase */) != 0 {
 11818  				return TCL_ERROR
 11819  			}
 11820  			sz = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 28 /* &.xPhraseSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 300 /* iPhrase */)))
 11821  			if rc == SQLITE_OK {
 11822  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sz))
 11823  			}
 11824  			break
 11825  
 11826  		}
 11827  	case 6:
 11828  		{
 11829  			// var nInst int32 at bp+304, 4
 11830  
 11831  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 32 /* &.xInstCount */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+304 /* &nInst */)
 11832  			if rc == SQLITE_OK {
 11833  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 304 /* nInst */))))
 11834  			}
 11835  			break
 11836  
 11837  		}
 11838  	case 7:
 11839  		{
 11840  			// var iIdx int32 at bp+308, 4
 11841  
 11842  			// var ip int32 at bp+312, 4
 11843  
 11844  			// var ic int32 at bp+316, 4
 11845  
 11846  			// var io int32 at bp+320, 4
 11847  
 11848  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+308 /* &iIdx */) != 0 {
 11849  				return TCL_ERROR
 11850  			}
 11851  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 36 /* &.xInst */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 308 /* iIdx */)), bp+312 /* &ip */, bp+316 /* &ic */, bp+320 /* &io */)
 11852  			if rc == SQLITE_OK {
 11853  				var pList uintptr = tcl.XTcl_NewObj(tls)
 11854  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 312 /* ip */))))
 11855  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 316 /* ic */))))
 11856  				tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 320 /* io */))))
 11857  				tcl.XTcl_SetObjResult(tls, interp, pList)
 11858  			}
 11859  			break
 11860  
 11861  		}
 11862  	case 8:
 11863  		{
 11864  			var iRowid sqlite3_int64 = (*(*func(*libc.TLS, uintptr) sqlite3_int64)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 40 /* &.xRowid */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts)
 11865  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, iRowid))
 11866  			break
 11867  
 11868  		}
 11869  	case 9:
 11870  		{
 11871  			*(*uintptr)(unsafe.Pointer(bp + 328 /* z */)) = uintptr(0)
 11872  			*(*int32)(unsafe.Pointer(bp + 332 /* n */)) = 0
 11873  			// var iCol int32 at bp+324, 4
 11874  
 11875  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+324 /* &iCol */) != 0 {
 11876  				return TCL_ERROR
 11877  			}
 11878  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 44 /* &.xColumnText */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 324 /* iCol */)), bp+328 /* &z */, bp+332 /* &n */)
 11879  			if rc == SQLITE_OK {
 11880  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 328 /* z */)), *(*int32)(unsafe.Pointer(bp + 332 /* n */))))
 11881  			}
 11882  			break
 11883  
 11884  		}
 11885  	case 10:
 11886  		{
 11887  			*(*int32)(unsafe.Pointer(bp + 340 /* n */)) = 0
 11888  			// var iCol int32 at bp+336, 4
 11889  
 11890  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+336 /* &iCol */) != 0 {
 11891  				return TCL_ERROR
 11892  			}
 11893  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 48 /* &.xColumnSize */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 336 /* iCol */)), bp+340 /* &n */)
 11894  			if rc == SQLITE_OK {
 11895  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 340 /* n */))))
 11896  			}
 11897  			break
 11898  
 11899  		}
 11900  	case 11:
 11901  		{
 11902  			// var iPhrase int32 at bp+344, 4
 11903  
 11904  			// var ctx F5tFunction at bp+348, 8
 11905  
 11906  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+344 /* &iPhrase */) != 0 {
 11907  				return TCL_ERROR
 11908  			}
 11909  			(*F5tFunction)(unsafe.Pointer(bp + 348 /* &ctx */)).Finterp = interp
 11910  			(*F5tFunction)(unsafe.Pointer(bp + 348 /* &ctx */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 11911  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 52 /* &.xQueryPhrase */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 344 /* iPhrase */)), bp+348 /* &ctx */, *(*uintptr)(unsafe.Pointer(&struct {
 11912  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 11913  			}{xQueryPhraseCb})))
 11914  			if rc == SQLITE_OK {
 11915  				tcl.XTcl_ResetResult(tls, interp)
 11916  			}
 11917  			break
 11918  
 11919  		}
 11920  	case 12:
 11921  		{
 11922  			var pData uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(F5tAuxData{})))
 11923  			if pData == uintptr(0) {
 11924  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1930 /* "out of memory" */, 0))
 11925  				return TCL_ERROR
 11926  			}
 11927  			(*F5tAuxData)(unsafe.Pointer(pData)).FpObj = *(*uintptr)(unsafe.Pointer(objv + 2*4))
 11928  			(*Tcl_Obj)(unsafe.Pointer((*F5tAuxData)(unsafe.Pointer(pData)).FpObj)).FrefCount++
 11929  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 56 /* &.xSetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, pData, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{xSetAuxdataDestructor})))
 11930  			break
 11931  
 11932  		}
 11933  	case 13:
 11934  		{
 11935  			var pData uintptr
 11936  			// var bClear int32 at bp+356, 4
 11937  
 11938  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+356 /* &bClear */) != 0 {
 11939  				return TCL_ERROR
 11940  			}
 11941  			pData = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 60 /* &.xGetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 356 /* bClear */)))
 11942  			if pData == uintptr(0) {
 11943  				tcl.XTcl_ResetResult(tls, interp)
 11944  			} else {
 11945  				tcl.XTcl_SetObjResult(tls, interp, (*F5tAuxData)(unsafe.Pointer(pData)).FpObj)
 11946  				if *(*int32)(unsafe.Pointer(bp + 356 /* bClear */)) != 0 {
 11947  					xSetAuxdataDestructor(tls, pData)
 11948  				}
 11949  			}
 11950  			break
 11951  
 11952  		}
 11953  
 11954  	// These two - xSetAuxdataInt and xGetAuxdataInt - are similar to the
 11955  	// xSetAuxdata and xGetAuxdata methods implemented above. The difference
 11956  	// is that they may only save an integer value as auxiliary data, and
 11957  	// do not specify a destructor function.
 11958  	case 14:
 11959  		{
 11960  			// var iVal int32 at bp+360, 4
 11961  
 11962  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+360 /* &iVal */) != 0 {
 11963  				return TCL_ERROR
 11964  			}
 11965  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 56 /* &.xSetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, (uintptr(0) + uintptr(*(*int32)(unsafe.Pointer(bp + 360 /* iVal */)))), uintptr(0))
 11966  			break
 11967  
 11968  		}
 11969  	case 15:
 11970  		{
 11971  			var iVal int32
 11972  			// var bClear int32 at bp+364, 4
 11973  
 11974  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+364 /* &bClear */) != 0 {
 11975  				return TCL_ERROR
 11976  			}
 11977  			iVal = ((int32((*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 60 /* &.xGetAuxdata */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 364 /* bClear */)))) - int32(uintptr(0))) / 1)
 11978  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iVal))
 11979  			break
 11980  
 11981  		}
 11982  
 11983  	case 16:
 11984  		{
 11985  			// var iPhrase int32 at bp+368, 4
 11986  
 11987  			// var iCol int32 at bp+380, 4
 11988  
 11989  			// var iOff int32 at bp+384, 4
 11990  
 11991  			var zColvar uintptr
 11992  			var zOffvar uintptr
 11993  			var pScript uintptr = *(*uintptr)(unsafe.Pointer(objv + 5*4))
 11994  			// var iter Fts5PhraseIter at bp+372, 8
 11995  
 11996  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+368 /* &iPhrase */) != 0 {
 11997  				return TCL_ERROR
 11998  			}
 11999  			zColvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 12000  			zOffvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 12001  
 12002  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 64 /* &.xPhraseFirst */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 368 /* iPhrase */)), bp+372 /* &iter */, bp+380 /* &iCol */, bp+384 /* &iOff */)
 12003  			if rc != SQLITE_OK {
 12004  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 12005  				return TCL_ERROR
 12006  			}
 12007  			for ; *(*int32)(unsafe.Pointer(bp + 380 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 68 /* &.xPhraseNext */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+372 /* &iter */, bp+380 /* &iCol */, bp+384 /* &iOff */) {
 12008  				tcl.XTcl_SetVar2Ex(tls, interp, zColvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 380 /* iCol */))), 0)
 12009  				tcl.XTcl_SetVar2Ex(tls, interp, zOffvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 384 /* iOff */))), 0)
 12010  				rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 12011  				if rc == TCL_CONTINUE {
 12012  					rc = TCL_OK
 12013  				}
 12014  				if rc != TCL_OK {
 12015  					if rc == TCL_BREAK {
 12016  						rc = TCL_OK
 12017  					}
 12018  					break
 12019  				}
 12020  			}
 12021  
 12022  			break
 12023  
 12024  		}
 12025  
 12026  	case 17:
 12027  		{
 12028  			// var iPhrase int32 at bp+388, 4
 12029  
 12030  			// var iCol int32 at bp+400, 4
 12031  
 12032  			var zColvar uintptr
 12033  			var pScript uintptr = *(*uintptr)(unsafe.Pointer(objv + 4*4))
 12034  			// var iter Fts5PhraseIter at bp+392, 8
 12035  
 12036  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+388 /* &iPhrase */) != 0 {
 12037  				return TCL_ERROR
 12038  			}
 12039  			zColvar = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 12040  
 12041  			rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 72 /* &.xPhraseFirstColumn */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, *(*int32)(unsafe.Pointer(bp + 388 /* iPhrase */)), bp+392 /* &iter */, bp+400 /* &iCol */)
 12042  			if rc != SQLITE_OK {
 12043  				tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12044  				return TCL_ERROR
 12045  			}
 12046  			for ; *(*int32)(unsafe.Pointer(bp + 400 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer(((*F5tApi)(unsafe.Pointer(p)).FpApi + 76 /* &.xPhraseNextColumn */))))(tls, (*F5tApi)(unsafe.Pointer(p)).FpFts, bp+392 /* &iter */, bp+400 /* &iCol */) {
 12047  				tcl.XTcl_SetVar2Ex(tls, interp, zColvar, uintptr(0), tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 400 /* iCol */))), 0)
 12048  				rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 12049  				if rc == TCL_CONTINUE {
 12050  					rc = TCL_OK
 12051  				}
 12052  				if rc != TCL_OK {
 12053  					if rc == TCL_BREAK {
 12054  						rc = TCL_OK
 12055  					}
 12056  					break
 12057  				}
 12058  			}
 12059  
 12060  			break
 12061  
 12062  		}
 12063  
 12064  	default:
 12065  
 12066  		break
 12067  	}
 12068  
 12069  	if rc != SQLITE_OK {
 12070  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12071  		return TCL_ERROR
 12072  	}
 12073  
 12074  	return TCL_OK
 12075  }
 12076  
 12077  type Sub = struct {
 12078  	FzName uintptr
 12079  	FnArg  int32
 12080  	FzMsg  uintptr
 12081  } /* fts5_tcl.c:224:3 */
 12082  
 12083  func xF5tFunction(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* fts5_tcl.c:517:13: */
 12084  	bp := tls.Alloc(104)
 12085  	defer tls.Free(104)
 12086  
 12087  	var p uintptr = (*(*func(*libc.TLS, uintptr) uintptr)(unsafe.Pointer((pApi + 4 /* &.xUserData */))))(tls, pFts)
 12088  	var pEval uintptr // Script to evaluate
 12089  	var i int32
 12090  	var rc int32
 12091  	// var zCmd [64]int8 at bp+8, 64
 12092  
 12093  	// var sApi F5tApi at bp+72, 8
 12094  
 12095  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpApi = pApi
 12096  	(*F5tApi)(unsafe.Pointer(bp + 72 /* &sApi */)).FpFts = pFts
 12097  
 12098  	libc.Xsprintf(tls, bp+8 /* &zCmd[0] */, ts+2396 /* "f5t_%lld" */, libc.VaList(bp, libc.PostIncInt64(&iCmd2, 1)))
 12099  	tcl.XTcl_CreateObjCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 12100  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 12101  	}{xF5tApi})), bp+72 /* &sApi */, uintptr(0))
 12102  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tFunction)(unsafe.Pointer(p)).FpScript)
 12103  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 12104  	tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, bp+8 /* &zCmd[0] */, -1))
 12105  
 12106  	for i = 0; i < nVal; i++ {
 12107  		var pObj uintptr = uintptr(0)
 12108  		switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))) {
 12109  		case SQLITE_TEXT:
 12110  			pObj = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))), -1)
 12111  			break
 12112  		case SQLITE_BLOB:
 12113  			pObj = tcl.XTcl_NewByteArrayObj(tls,
 12114  				sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))), sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))))
 12115  			break
 12116  		case SQLITE_INTEGER:
 12117  			pObj = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))))
 12118  			break
 12119  		case SQLITE_FLOAT:
 12120  			pObj = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))))
 12121  			break
 12122  		default:
 12123  			pObj = tcl.XTcl_NewObj(tls)
 12124  			break
 12125  		}
 12126  		tcl.XTcl_ListObjAppendElement(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, pObj)
 12127  	}
 12128  
 12129  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, pEval, TCL_GLOBAL_ONLY)
 12130  	for ok := true; ok; ok = 0 != 0 {
 12131  		var _objPtr uintptr = pEval
 12132  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12133  			tcl.XTclFreeObj(tls, _objPtr)
 12134  		}
 12135  	}
 12136  	tcl.XTcl_DeleteCommand(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp, bp+8 /* &zCmd[0] */)
 12137  
 12138  	if rc != TCL_OK {
 12139  		sqlite3.Xsqlite3_result_error(tls, pCtx, tcl.XTcl_GetStringResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp), -1)
 12140  	} else {
 12141  		var pVar uintptr = tcl.XTcl_GetObjResult(tls, (*F5tFunction)(unsafe.Pointer(p)).Finterp)
 12142  		// var n int32 at bp+80, 4
 12143  
 12144  		var zType uintptr = func() uintptr {
 12145  			if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 12146  				return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 12147  			}
 12148  			return ts + 489 /* "" */
 12149  		}()
 12150  		var c int8 = *(*int8)(unsafe.Pointer(zType))
 12151  		if ((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2405 /* "bytearray" */) == 0)) && ((*Tcl_Obj)(unsafe.Pointer(pVar)).Fbytes == uintptr(0)) {
 12152  			// Only return a BLOB type if the Tcl variable is a bytearray and
 12153  			// has no string representation.
 12154  			var data uintptr = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+80 /* &n */)
 12155  			sqlite3.Xsqlite3_result_blob(tls, pCtx, data, *(*int32)(unsafe.Pointer(bp + 80 /* n */)), libc.UintptrFromInt32(-1))
 12156  		} else if (int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0) {
 12157  			tcl.XTcl_GetIntFromObj(tls, uintptr(0), pVar, bp+80 /* &n */)
 12158  			sqlite3.Xsqlite3_result_int(tls, pCtx, *(*int32)(unsafe.Pointer(bp + 80 /* n */)))
 12159  		} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 12160  			// var r float64 at bp+88, 8
 12161  
 12162  			tcl.XTcl_GetDoubleFromObj(tls, uintptr(0), pVar, bp+88 /* &r */)
 12163  			sqlite3.Xsqlite3_result_double(tls, pCtx, *(*float64)(unsafe.Pointer(bp + 88 /* r */)))
 12164  		} else if ((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0)) || ((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 12165  			// var v Tcl_WideInt at bp+96, 8
 12166  
 12167  			tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), pVar, bp+96 /* &v */)
 12168  			sqlite3.Xsqlite3_result_int64(tls, pCtx, *(*Tcl_WideInt)(unsafe.Pointer(bp + 96 /* v */)))
 12169  		} else {
 12170  			var data uintptr = tcl.XTcl_GetStringFromObj(tls, pVar, bp+80 /* &n */)
 12171  			sqlite3.Xsqlite3_result_text(tls, pCtx, data, *(*int32)(unsafe.Pointer(bp + 80 /* n */)), libc.UintptrFromInt32(-1))
 12172  		}
 12173  	}
 12174  }
 12175  
 12176  var iCmd2 sqlite3_int64 = int64(0) /* fts5_tcl.c:529:24 */
 12177  
 12178  func xF5tDestroy(tls *libc.TLS, pCtx uintptr) { /* fts5_tcl.c:600:13: */
 12179  	var p uintptr = pCtx
 12180  	for ok := true; ok; ok = 0 != 0 {
 12181  		var _objPtr uintptr = (*F5tFunction)(unsafe.Pointer(p)).FpScript
 12182  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12183  			tcl.XTclFreeObj(tls, _objPtr)
 12184  		}
 12185  	}
 12186  	tcl.XTcl_Free(tls, p)
 12187  }
 12188  
 12189  //      sqlite3_fts5_create_function DB NAME SCRIPT
 12190  //
 12191  // Description...
 12192  func f5tCreateFunction(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:611:26: */
 12193  	bp := tls.Alloc(32)
 12194  	defer tls.Free(32)
 12195  
 12196  	var zName uintptr
 12197  	var pScript uintptr
 12198  	*(*uintptr)(unsafe.Pointer(bp + 24 /* db */)) = uintptr(0)
 12199  	*(*uintptr)(unsafe.Pointer(bp + 28 /* pApi */)) = uintptr(0)
 12200  	var pCtx uintptr = uintptr(0)
 12201  	var rc int32
 12202  
 12203  	if objc != 4 {
 12204  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2442 /* "DB NAME SCRIPT" */)
 12205  		return TCL_ERROR
 12206  	}
 12207  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+24 /* &db */, bp+28 /* &pApi */) != 0 {
 12208  		return TCL_ERROR
 12209  	}
 12210  
 12211  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 12212  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 12213  	pCtx = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tFunction{})))
 12214  	(*F5tFunction)(unsafe.Pointer(pCtx)).Finterp = interp
 12215  	(*F5tFunction)(unsafe.Pointer(pCtx)).FpScript = pScript
 12216  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 12217  
 12218  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, fts5_extension_function, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 28 /* pApi */)) + 12 /* &.xCreateFunction */))))(tls,
 12219  		*(*uintptr)(unsafe.Pointer(bp + 28 /* pApi */)), zName, pCtx, *(*uintptr)(unsafe.Pointer(&struct {
 12220  			f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr)
 12221  		}{xF5tFunction})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{xF5tDestroy})))
 12222  	if rc != SQLITE_OK {
 12223  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2014 /* "error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */))), 0))
 12224  		return TCL_ERROR
 12225  	}
 12226  
 12227  	return TCL_OK
 12228  }
 12229  
 12230  type F5tTokenizeCtx1 = struct {
 12231  	FpRet   uintptr
 12232  	FbSubst int32
 12233  	FzInput uintptr
 12234  } /* fts5_tcl.c:648:9 */
 12235  
 12236  type F5tTokenizeCtx = F5tTokenizeCtx1 /* fts5_tcl.c:648:31 */
 12237  
 12238  func xTokenizeCb2(tls *libc.TLS, pCtx uintptr, tflags int32, zToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_tcl.c:655:12: */
 12239  	var p uintptr = pCtx
 12240  	if (*F5tTokenizeCtx)(unsafe.Pointer(p)).FbSubst != 0 {
 12241  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 12242  		tcl.XTcl_ListObjAppendElement(tls,
 12243  			uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, ((*F5tTokenizeCtx)(unsafe.Pointer(p)).FzInput+uintptr(iStart)), (iEnd-iStart)))
 12244  	} else {
 12245  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewStringObj(tls, zToken, nToken))
 12246  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewIntObj(tls, iStart))
 12247  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), (*F5tTokenizeCtx)(unsafe.Pointer(p)).FpRet, tcl.XTcl_NewIntObj(tls, iEnd))
 12248  	}
 12249  	return SQLITE_OK
 12250  }
 12251  
 12252  //      sqlite3_fts5_tokenize DB TOKENIZER TEXT
 12253  //
 12254  // Description...
 12255  func f5tTokenize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:681:26: */
 12256  	bp := tls.Alloc(148)
 12257  	defer tls.Free(148)
 12258  
 12259  	var zText uintptr
 12260  	// var nText int32 at bp+112, 4
 12261  
 12262  	*(*uintptr)(unsafe.Pointer(bp + 96 /* db */)) = uintptr(0)
 12263  	*(*uintptr)(unsafe.Pointer(bp + 100 /* pApi */)) = uintptr(0)
 12264  	*(*uintptr)(unsafe.Pointer(bp + 132 /* pTok */)) = uintptr(0)
 12265  	// var tokenizer fts5_tokenizer at bp+120, 12
 12266  
 12267  	var pRet uintptr = uintptr(0)
 12268  	// var pUserdata uintptr at bp+116, 4
 12269  
 12270  	var rc int32
 12271  	// var nArg int32 at bp+104, 4
 12272  
 12273  	// var azArg uintptr at bp+108, 4
 12274  
 12275  	// var ctx F5tTokenizeCtx at bp+136, 12
 12276  
 12277  	if (objc != 4) && (objc != 5) {
 12278  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2457 /* "?-subst? DB NAME..." */)
 12279  		return TCL_ERROR
 12280  	}
 12281  	if objc == 5 {
 12282  		var zOpt uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 12283  		if libc.Xstrcmp(tls, ts+2479 /* "-subst" */, zOpt) != 0 {
 12284  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2486 /* "unrecognized opt..." */, zOpt, 0))
 12285  			return TCL_ERROR
 12286  		}
 12287  	}
 12288  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*4)), bp+96 /* &db */, bp+100 /* &pApi */) != 0 {
 12289  		return TCL_ERROR
 12290  	}
 12291  	if tcl.XTcl_SplitList(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4))), bp+104 /* &nArg */, bp+108 /* &azArg */) != 0 {
 12292  		return TCL_ERROR
 12293  	}
 12294  	if *(*int32)(unsafe.Pointer(bp + 104 /* nArg */)) == 0 {
 12295  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+2508 /* "no such tokenize..." */, 0))
 12296  		tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer(bp + 108 /* azArg */)))
 12297  		return TCL_ERROR
 12298  	}
 12299  	zText = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4)), bp+112 /* &nText */)
 12300  
 12301  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 100 /* pApi */)) + 8 /* &.xFindTokenizer */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 100 /* pApi */)), *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 108 /* azArg */)))), bp+116 /* &pUserdata */, bp+120 /* &tokenizer */)
 12302  	if rc != SQLITE_OK {
 12303  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+2508 /* "no such tokenize..." */, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 108 /* azArg */)))), 0))
 12304  		return TCL_ERROR
 12305  	}
 12306  
 12307  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 120 /* &tokenizer */ /* &.xCreate */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 116 /* pUserdata */)), (*(*uintptr)(unsafe.Pointer(bp + 108 /* azArg */)) + 1*4), (*(*int32)(unsafe.Pointer(bp + 104 /* nArg */)) - 1), bp+132 /* &pTok */)
 12308  	if rc != SQLITE_OK {
 12309  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, ts+2528 /* "error in tokeniz..." */, 0))
 12310  		return TCL_ERROR
 12311  	}
 12312  
 12313  	pRet = tcl.XTcl_NewObj(tls)
 12314  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 12315  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 136 /* &ctx */)).FbSubst = (libc.Bool32(objc == 5))
 12316  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 136 /* &ctx */)).FpRet = pRet
 12317  	(*F5tTokenizeCtx)(unsafe.Pointer(bp + 136 /* &ctx */)).FzInput = zText
 12318  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 120 /* &tokenizer */ + 8 /* &.xTokenize */))))(tls,
 12319  		*(*uintptr)(unsafe.Pointer(bp + 132 /* pTok */)), bp+136 /* &ctx */, FTS5_TOKENIZE_DOCUMENT, zText, *(*int32)(unsafe.Pointer(bp + 112 /* nText */)), *(*uintptr)(unsafe.Pointer(&struct {
 12320  			f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 12321  		}{xTokenizeCb2})))
 12322  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((bp + 120 /* &tokenizer */ + 4 /* &.xDelete */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 132 /* pTok */)))
 12323  	if rc != SQLITE_OK {
 12324  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+80, ts+2557 /* "error in tokeniz..." */, 0))
 12325  		for ok := true; ok; ok = 0 != 0 {
 12326  			var _objPtr uintptr = pRet
 12327  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12328  				tcl.XTclFreeObj(tls, _objPtr)
 12329  			}
 12330  		}
 12331  		return TCL_ERROR
 12332  	}
 12333  
 12334  	tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer(bp + 108 /* azArg */)))
 12335  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 12336  	for ok1 := true; ok1; ok1 = 0 != 0 {
 12337  		var _objPtr uintptr = pRet
 12338  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12339  			tcl.XTclFreeObj(tls, _objPtr)
 12340  		}
 12341  	}
 12342  	return TCL_OK
 12343  }
 12344  
 12345  // ************************************************************************
 12346  //
 12347  // Start of tokenizer wrapper.
 12348  
 12349  type F5tTokenizerContext1 = struct {
 12350  	FpCtx   uintptr
 12351  	FxToken uintptr
 12352  } /* fts5_tcl.c:761:9 */
 12353  
 12354  // ************************************************************************
 12355  //
 12356  // Start of tokenizer wrapper.
 12357  
 12358  type F5tTokenizerContext = F5tTokenizerContext1 /* fts5_tcl.c:761:36 */
 12359  type F5tTokenizerModule1 = struct {
 12360  	Finterp   uintptr
 12361  	FpScript  uintptr
 12362  	FpContext uintptr
 12363  } /* fts5_tcl.c:763:9 */
 12364  
 12365  type F5tTokenizerModule = F5tTokenizerModule1 /* fts5_tcl.c:763:35 */
 12366  type F5tTokenizerInstance1 = struct {
 12367  	Finterp   uintptr
 12368  	FpScript  uintptr
 12369  	FpContext uintptr
 12370  } /* fts5_tcl.c:764:9 */
 12371  
 12372  type F5tTokenizerInstance = F5tTokenizerInstance1 /* fts5_tcl.c:764:37 */
 12373  
 12374  func f5tTokenizerCreate(tls *libc.TLS, pCtx uintptr, azArg uintptr, nArg int32, ppOut uintptr) int32 { /* fts5_tcl.c:783:12: */
 12375  	var pMod uintptr = pCtx
 12376  	var pEval uintptr
 12377  	var rc int32 = TCL_OK
 12378  	var i int32
 12379  
 12380  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript)
 12381  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 12382  	for i = 0; (rc == TCL_OK) && (i < nArg); i++ {
 12383  		var pObj uintptr = tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)), -1)
 12384  		rc = tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp, pEval, pObj)
 12385  	}
 12386  
 12387  	if rc == TCL_OK {
 12388  		rc = tcl.XTcl_EvalObjEx(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp, pEval, TCL_GLOBAL_ONLY)
 12389  	}
 12390  	for ok := true; ok; ok = 0 != 0 {
 12391  		var _objPtr uintptr = pEval
 12392  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12393  			tcl.XTclFreeObj(tls, _objPtr)
 12394  		}
 12395  	}
 12396  
 12397  	if rc == TCL_OK {
 12398  		var pInst uintptr
 12399  		pInst = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerInstance{})))
 12400  		libc.Xmemset(tls, pInst, 0, uint32(unsafe.Sizeof(F5tTokenizerInstance{})))
 12401  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp
 12402  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript = tcl.XTcl_GetObjResult(tls, (*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp)
 12403  		(*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpContext
 12404  		(*Tcl_Obj)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript)).FrefCount++
 12405  		*(*uintptr)(unsafe.Pointer(ppOut)) = pInst
 12406  	}
 12407  
 12408  	return rc
 12409  }
 12410  
 12411  func f5tTokenizerDelete(tls *libc.TLS, p uintptr) { /* fts5_tcl.c:821:13: */
 12412  	var pInst uintptr = p
 12413  	for ok := true; ok; ok = 0 != 0 {
 12414  		var _objPtr uintptr = (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript
 12415  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12416  			tcl.XTclFreeObj(tls, _objPtr)
 12417  		}
 12418  	}
 12419  	tcl.XTcl_Free(tls, pInst)
 12420  }
 12421  
 12422  func f5tTokenizerTokenize(tls *libc.TLS, p uintptr, pCtx uintptr, flags int32, pText uintptr, nText int32, xToken uintptr) int32 { /* fts5_tcl.c:827:12: */
 12423  	var pInst uintptr = p
 12424  	var pOldCtx uintptr
 12425  	var xOldToken uintptr
 12426  	var pEval uintptr
 12427  	var rc int32
 12428  	var zFlags uintptr
 12429  
 12430  	pOldCtx = (*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx
 12431  	xOldToken = (*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken
 12432  
 12433  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx = pCtx
 12434  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken = xToken
 12435  
 12436  	pEval = tcl.XTcl_DuplicateObj(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpScript)
 12437  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 12438  	switch flags {
 12439  	case FTS5_TOKENIZE_DOCUMENT:
 12440  		zFlags = ts + 2588 /* "document" */
 12441  		break
 12442  	case FTS5_TOKENIZE_AUX:
 12443  		zFlags = ts + 2597 /* "aux" */
 12444  		break
 12445  	case FTS5_TOKENIZE_QUERY:
 12446  		zFlags = ts + 2601 /* "query" */
 12447  		break
 12448  	case (FTS5_TOKENIZE_PREFIX | FTS5_TOKENIZE_QUERY):
 12449  		zFlags = ts + 2607 /* "prefixquery" */
 12450  		break
 12451  	default:
 12452  
 12453  		zFlags = ts + 2619 /* "invalid" */
 12454  		break
 12455  	}
 12456  
 12457  	tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zFlags, -1))
 12458  	tcl.XTcl_ListObjAppendElement(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, pText, nText))
 12459  	rc = tcl.XTcl_EvalObjEx(tls, (*F5tTokenizerInstance)(unsafe.Pointer(pInst)).Finterp, pEval, TCL_GLOBAL_ONLY)
 12460  	for ok := true; ok; ok = 0 != 0 {
 12461  		var _objPtr uintptr = pEval
 12462  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12463  			tcl.XTclFreeObj(tls, _objPtr)
 12464  		}
 12465  	}
 12466  
 12467  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FpCtx = pOldCtx
 12468  	(*F5tTokenizerContext)(unsafe.Pointer((*F5tTokenizerInstance)(unsafe.Pointer(pInst)).FpContext)).FxToken = xOldToken
 12469  	return rc
 12470  }
 12471  
 12472  // sqlite3_fts5_token ?-colocated? TEXT START END
 12473  func f5tTokenizerReturn(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:887:26: */
 12474  	bp := tls.Alloc(32)
 12475  	defer tls.Free(32)
 12476  
 12477  	var p uintptr
 12478  	// var iStart int32 at bp+24, 4
 12479  
 12480  	// var iEnd int32 at bp+28, 4
 12481  
 12482  	// var nToken int32 at bp+20, 4
 12483  
 12484  	var tflags int32
 12485  	var zToken uintptr
 12486  	var rc int32
 12487  	// var nArg int32 at bp+16, 4
 12488  
 12489  	var zArg uintptr
 12490  	p = clientData
 12491  	tflags = 0
 12492  
 12493  	if !(objc == 5) {
 12494  		goto __1
 12495  	}
 12496  	zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &nArg */)
 12497  	if !(((*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)) <= 10) && (*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)) >= 2)) && (libc.Xmemcmp(tls, ts+2627 /* "-colocated" */, zArg, uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nArg */)))) == 0)) {
 12498  		goto __3
 12499  	}
 12500  	tflags = tflags | (FTS5_TOKEN_COLOCATED)
 12501  	goto __4
 12502  __3:
 12503  	goto usage
 12504  __4:
 12505  	;
 12506  	goto __2
 12507  __1:
 12508  	if !(objc != 4) {
 12509  		goto __5
 12510  	}
 12511  	goto usage
 12512  __5:
 12513  	;
 12514  __2:
 12515  	;
 12516  
 12517  	zToken = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*4)), bp+20 /* &nToken */)
 12518  	if !((tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4)), bp+24 /* &iStart */) != 0) ||
 12519  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4)), bp+28 /* &iEnd */) != 0)) {
 12520  		goto __6
 12521  	}
 12522  	return TCL_ERROR
 12523  __6:
 12524  	;
 12525  
 12526  	if !((*F5tTokenizerContext)(unsafe.Pointer(p)).FxToken == uintptr(0)) {
 12527  		goto __7
 12528  	}
 12529  	tcl.XTcl_AppendResult(tls, interp,
 12530  		libc.VaList(bp, ts+2638 /* "sqlite3_fts5_tok..." */, 0))
 12531  	return TCL_ERROR
 12532  __7:
 12533  	;
 12534  
 12535  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32)(unsafe.Pointer((p + 4 /* &.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 */)))
 12536  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12537  	if rc == SQLITE_OK {
 12538  		return TCL_OK
 12539  	}
 12540  	return TCL_ERROR
 12541  
 12542  usage:
 12543  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2696 /* "?-colocated? TEX..." */)
 12544  	return TCL_ERROR
 12545  }
 12546  
 12547  func f5tDelTokenizer(tls *libc.TLS, pCtx uintptr) { /* fts5_tcl.c:936:13: */
 12548  	var pMod uintptr = pCtx
 12549  	for ok := true; ok; ok = 0 != 0 {
 12550  		var _objPtr uintptr = (*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript
 12551  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 12552  			tcl.XTclFreeObj(tls, _objPtr)
 12553  		}
 12554  	}
 12555  	tcl.XTcl_Free(tls, pMod)
 12556  }
 12557  
 12558  //      sqlite3_fts5_create_tokenizer DB NAME SCRIPT
 12559  //
 12560  // Register a tokenizer named NAME implemented by script SCRIPT. When
 12561  // a tokenizer instance is created (fts5_tokenizer.xCreate), any tokenizer
 12562  // arguments are appended to SCRIPT and the result executed.
 12563  //
 12564  // The value returned by (SCRIPT + args) is itself a tcl script. This
 12565  // script - call it SCRIPT2 - is executed to tokenize text using the
 12566  // tokenizer instance "returned" by SCRIPT. Specifically, to tokenize
 12567  // text SCRIPT2 is invoked with a single argument appended to it - the
 12568  // text to tokenize.
 12569  //
 12570  // SCRIPT2 should invoke the [sqlite3_fts5_token] command once for each
 12571  // token within the tokenized text.
 12572  func f5tCreateTokenizer(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:958:26: */
 12573  	bp := tls.Alloc(36)
 12574  	defer tls.Free(36)
 12575  
 12576  	var pContext uintptr = clientData
 12577  	// var db uintptr at bp+16, 4
 12578  
 12579  	// var pApi uintptr at bp+20, 4
 12580  
 12581  	var zName uintptr
 12582  	var pScript uintptr
 12583  	// var t fts5_tokenizer at bp+24, 12
 12584  
 12585  	var pMod uintptr
 12586  	var rc int32
 12587  
 12588  	if objc != 4 {
 12589  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2442 /* "DB NAME SCRIPT" */)
 12590  		return TCL_ERROR
 12591  	}
 12592  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &db */, bp+20 /* &pApi */) != 0 {
 12593  		return TCL_ERROR
 12594  	}
 12595  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 12596  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 12597  
 12598  	(*fts5_tokenizer)(unsafe.Pointer(bp + 24 /* &t */)).FxCreate = *(*uintptr)(unsafe.Pointer(&struct {
 12599  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 12600  	}{f5tTokenizerCreate}))
 12601  	(*fts5_tokenizer)(unsafe.Pointer(bp + 24 /* &t */)).FxTokenize = *(*uintptr)(unsafe.Pointer(&struct {
 12602  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32
 12603  	}{f5tTokenizerTokenize}))
 12604  	(*fts5_tokenizer)(unsafe.Pointer(bp + 24 /* &t */)).FxDelete = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{f5tTokenizerDelete}))
 12605  
 12606  	pMod = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerModule{})))
 12607  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).Finterp = interp
 12608  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpScript = pScript
 12609  	(*F5tTokenizerModule)(unsafe.Pointer(pMod)).FpContext = pContext
 12610  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 12611  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp + 20 /* pApi */)) + 4 /* &.xCreateTokenizer */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pApi */)), zName, pMod, bp+24 /* &t */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{f5tDelTokenizer})))
 12612  	if rc != SQLITE_OK {
 12613  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+2724 /* "error in fts5_ap..." */, 0))
 12614  		return TCL_ERROR
 12615  	}
 12616  
 12617  	return TCL_OK
 12618  }
 12619  
 12620  func xF5tFree(tls *libc.TLS, clientData ClientData) { /* fts5_tcl.c:1001:27: */
 12621  	tcl.XTcl_Free(tls, clientData)
 12622  }
 12623  
 12624  //      sqlite3_fts5_may_be_corrupt BOOLEAN
 12625  //
 12626  // Set or clear the global "may-be-corrupt" flag. Return the old value.
 12627  func f5tMayBeCorrupt(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1010:26: */
 12628  	return TCL_OK
 12629  }
 12630  
 12631  func f5t_fts5HashKey(tls *libc.TLS, nSlot int32, p uintptr, n int32) uint32 { /* fts5_tcl.c:1035:21: */
 12632  	var i int32
 12633  	var h uint32 = uint32(13)
 12634  	for i = (n - 1); i >= 0; i-- {
 12635  		h = (((h << 3) ^ h) ^ uint32(*(*int8)(unsafe.Pointer(p + uintptr(i)))))
 12636  	}
 12637  	return (h % uint32(nSlot))
 12638  }
 12639  
 12640  func f5tTokenHash(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1044:26: */
 12641  	bp := tls.Alloc(8)
 12642  	defer tls.Free(8)
 12643  
 12644  	var z uintptr
 12645  	// var n int32 at bp+4, 4
 12646  
 12647  	var iVal uint32
 12648  	// var nSlot int32 at bp, 4
 12649  
 12650  	if objc != 3 {
 12651  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2761 /* "NSLOT TOKEN" */)
 12652  		return TCL_ERROR
 12653  	}
 12654  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &nSlot */) != 0 {
 12655  		return TCL_ERROR
 12656  	}
 12657  	z = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &n */)
 12658  
 12659  	iVal = f5t_fts5HashKey(tls, *(*int32)(unsafe.Pointer(bp /* nSlot */)), z, *(*int32)(unsafe.Pointer(bp + 4 /* n */)))
 12660  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(iVal)))
 12661  	return TCL_OK
 12662  }
 12663  
 12664  func f5tRegisterMatchinfo(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1069:26: */
 12665  	bp := tls.Alloc(4)
 12666  	defer tls.Free(4)
 12667  
 12668  	var rc int32
 12669  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 12670  
 12671  	if objc != 2 {
 12672  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 12673  		return TCL_ERROR
 12674  	}
 12675  	if f5tDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &db */) != 0 {
 12676  		return TCL_ERROR
 12677  	}
 12678  
 12679  	rc = sqlite3Fts5TestRegisterMatchinfo(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 12680  	if rc != SQLITE_OK {
 12681  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12682  		return TCL_ERROR
 12683  	}
 12684  	return TCL_OK
 12685  }
 12686  
 12687  func f5tRegisterTok(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* fts5_tcl.c:1094:26: */
 12688  	bp := tls.Alloc(8)
 12689  	defer tls.Free(8)
 12690  
 12691  	var rc int32
 12692  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 12693  	*(*uintptr)(unsafe.Pointer(bp + 4 /* pApi */)) = uintptr(0)
 12694  
 12695  	if objc != 2 {
 12696  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 12697  		return TCL_ERROR
 12698  	}
 12699  	if f5tDbAndApi(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &db */, bp+4 /* &pApi */) != 0 {
 12700  		return TCL_ERROR
 12701  	}
 12702  
 12703  	rc = sqlite3Fts5TestRegisterTok(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*uintptr)(unsafe.Pointer(bp + 4 /* pApi */)))
 12704  	if rc != SQLITE_OK {
 12705  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 12706  		return TCL_ERROR
 12707  	}
 12708  	return TCL_OK
 12709  }
 12710  
 12711  // Entry point.
 12712  func Fts5tcl_Init(tls *libc.TLS, interp uintptr) int32 { /* fts5_tcl.c:1123:5: */
 12713  	var i int32
 12714  	var pContext uintptr
 12715  
 12716  	pContext = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(F5tTokenizerContext{})))
 12717  	libc.Xmemset(tls, pContext, 0, uint32(unsafe.Sizeof(F5tTokenizerContext{})))
 12718  
 12719  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd)) / uint32(unsafe.Sizeof(struct {
 12720  		FzName        uintptr
 12721  		FxProc        uintptr
 12722  		FbTokenizeCtx int32
 12723  	}{}))); i++ {
 12724  		var p uintptr = (uintptr(unsafe.Pointer(&aCmd)) + uintptr(i)*12)
 12725  		var pCtx uintptr = uintptr(0)
 12726  		if (*struct {
 12727  			FzName        uintptr
 12728  			FxProc        uintptr
 12729  			FbTokenizeCtx int32
 12730  		})(unsafe.Pointer(p)).FbTokenizeCtx != 0 {
 12731  			pCtx = pContext
 12732  		}
 12733  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 12734  			FzName        uintptr
 12735  			FxProc        uintptr
 12736  			FbTokenizeCtx int32
 12737  		})(unsafe.Pointer(p)).FzName, (*struct {
 12738  			FzName        uintptr
 12739  			FxProc        uintptr
 12740  			FbTokenizeCtx int32
 12741  		})(unsafe.Pointer(p)).FxProc, pCtx, func() uintptr {
 12742  			if i != 0 {
 12743  				return uintptr(0)
 12744  			}
 12745  			return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{xF5tFree}))
 12746  		}())
 12747  	}
 12748  
 12749  	return TCL_OK
 12750  }
 12751  
 12752  var aCmd = [8]struct {
 12753  	FzName        uintptr
 12754  	FxProc        uintptr
 12755  	FbTokenizeCtx int32
 12756  }{
 12757  	{FzName: ts + 2773 /* "sqlite3_fts5_cre..." */, FxProc: 0, FbTokenizeCtx: 1},
 12758  	{FzName: ts + 2803 /* "sqlite3_fts5_tok..." */, FxProc: 0, FbTokenizeCtx: 1},
 12759  	{FzName: ts + 2822 /* "sqlite3_fts5_tok..." */, FxProc: 0},
 12760  	{FzName: ts + 2844 /* "sqlite3_fts5_cre..." */, FxProc: 0},
 12761  	{FzName: ts + 2873 /* "sqlite3_fts5_may..." */, FxProc: 0},
 12762  	{FzName: ts + 2901 /* "sqlite3_fts5_tok..." */, FxProc: 0},
 12763  	{FzName: ts + 2925 /* "sqlite3_fts5_reg..." */, FxProc: 0},
 12764  	{FzName: ts + 2957 /* "sqlite3_fts5_reg..." */, FxProc: 0},
 12765  } /* fts5_tcl.c:1128:5 */
 12766  
 12767  type Fts5MatchinfoCtx1 = struct {
 12768  	FnCol    int32
 12769  	FnPhrase int32
 12770  	FzArg    uintptr
 12771  	FnRet    int32
 12772  	FaRet    uintptr
 12773  } /* fts5_test_mi.c:50:9 */
 12774  
 12775  type Fts5MatchinfoCtx = Fts5MatchinfoCtx1 /* fts5_test_mi.c:50:33 */
 12776  
 12777  type u32 = uint32 /* fts5_test_mi.c:53:22 */
 12778  
 12779  // Return a pointer to the fts5_api pointer for database connection db.
 12780  // If an error occurs, return NULL and leave an error in the database
 12781  // handle (accessible using sqlite3_errcode()/errmsg()).
 12782  func fts5_api_from_db(tls *libc.TLS, db uintptr, ppApi uintptr) int32 { /* fts5_test_mi.c:71:12: */
 12783  	bp := tls.Alloc(4)
 12784  	defer tls.Free(4)
 12785  
 12786  	*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
 12787  	var rc int32
 12788  
 12789  	*(*uintptr)(unsafe.Pointer(ppApi)) = uintptr(0)
 12790  	rc = sqlite3.Xsqlite3_prepare(tls, db, ts+1998 /* "SELECT fts5(?1)" */, -1, bp /* &pStmt */, uintptr(0))
 12791  	if rc == SQLITE_OK {
 12792  		sqlite3.Xsqlite3_bind_pointer(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 1, ppApi, ts+2022 /* "fts5_api_ptr" */, uintptr(0))
 12793  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 12794  		rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 12795  	}
 12796  
 12797  	return rc
 12798  }
 12799  
 12800  // Argument f should be a flag accepted by matchinfo() (a valid character
 12801  // in the string passed as the second argument). If it is not, -1 is
 12802  // returned. Otherwise, if f is a valid matchinfo flag, the value returned
 12803  // is the number of 32-bit integers added to the output array if the
 12804  // table has nCol columns and the query nPhrase phrases.
 12805  func fts5MatchinfoFlagsize(tls *libc.TLS, nCol int32, nPhrase int32, f int8) int32 { /* fts5_test_mi.c:94:12: */
 12806  	var ret int32 = -1
 12807  	switch int32(f) {
 12808  	case 'p':
 12809  		ret = 1
 12810  		break
 12811  	case 'c':
 12812  		ret = 1
 12813  		break
 12814  	case 'x':
 12815  		ret = ((3 * nCol) * nPhrase)
 12816  		break
 12817  	case 'y':
 12818  		ret = (nCol * nPhrase)
 12819  		break
 12820  	case 'b':
 12821  		ret = (((nCol + 31) / 32) * nPhrase)
 12822  		break
 12823  	case 'n':
 12824  		ret = 1
 12825  		break
 12826  	case 'a':
 12827  		ret = nCol
 12828  		break
 12829  	case 'l':
 12830  		ret = nCol
 12831  		break
 12832  	case 's':
 12833  		ret = nCol
 12834  		break
 12835  	}
 12836  	return ret
 12837  }
 12838  
 12839  func fts5MatchinfoIter(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, x uintptr) int32 { /* fts5_test_mi.c:110:12: */
 12840  	var i int32
 12841  	var n int32 = 0
 12842  	var rc int32 = SQLITE_OK
 12843  	var f int8
 12844  	for i = 0; libc.AssignInt8(&f, *(*int8)(unsafe.Pointer((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg + uintptr(i)))) != 0; i++ {
 12845  		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))
 12846  		if rc != SQLITE_OK {
 12847  			break
 12848  		}
 12849  		n = n + (fts5MatchinfoFlagsize(tls, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase, f))
 12850  	}
 12851  	return rc
 12852  }
 12853  
 12854  func fts5MatchinfoXCb(tls *libc.TLS, pApi uintptr, pFts uintptr, pUserData uintptr) int32 { /* fts5_test_mi.c:128:12: */
 12855  	bp := tls.Alloc(16)
 12856  	defer tls.Free(16)
 12857  
 12858  	// var iter Fts5PhraseIter at bp, 8
 12859  
 12860  	// var iCol int32 at bp+8, 4
 12861  
 12862  	// var iOff int32 at bp+12, 4
 12863  
 12864  	var aOut uintptr = pUserData
 12865  	var iPrev int32 = -1
 12866  
 12867  	for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xPhraseFirst */))))(tls, pFts, 0, bp /* &iter */, bp+8 /* &iCol */, bp+12 /* &iOff */); *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 68 /* &.xPhraseNext */))))(tls, pFts, bp /* &iter */, bp+8 /* &iCol */, bp+12 /* &iOff */) {
 12868  		*(*u32)(unsafe.Pointer(aOut + uintptr(((*(*int32)(unsafe.Pointer(bp + 8 /* iCol */))*3)+1))*4))++
 12869  		if *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) != iPrev {
 12870  			*(*u32)(unsafe.Pointer(aOut + uintptr(((*(*int32)(unsafe.Pointer(bp + 8 /* iCol */))*3)+2))*4))++
 12871  		}
 12872  		iPrev = *(*int32)(unsafe.Pointer(bp + 8 /* iCol */))
 12873  	}
 12874  
 12875  	return SQLITE_OK
 12876  }
 12877  
 12878  func fts5MatchinfoGlobalCb(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, f int8, aOut uintptr) int32 { /* fts5_test_mi.c:150:12: */
 12879  	bp := tls.Alloc(24)
 12880  	defer tls.Free(24)
 12881  
 12882  	var rc int32 = SQLITE_OK
 12883  	switch int32(f) {
 12884  	case 'p':
 12885  		*(*u32)(unsafe.Pointer(aOut)) = u32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase)
 12886  		break
 12887  
 12888  	case 'c':
 12889  		*(*u32)(unsafe.Pointer(aOut)) = u32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)
 12890  		break
 12891  
 12892  	case 'x':
 12893  		{
 12894  			var i int32
 12895  			for i = 0; (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase) && (rc == SQLITE_OK); i++ {
 12896  				var pPtr uintptr = (aOut + uintptr(((i*(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)*3))*4)
 12897  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 52 /* &.xQueryPhrase */))))(tls, pFts, i, pPtr, *(*uintptr)(unsafe.Pointer(&struct {
 12898  					f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 12899  				}{fts5MatchinfoXCb})))
 12900  			}
 12901  			break
 12902  
 12903  		}
 12904  
 12905  	case 'n':
 12906  		{
 12907  			// var nRow sqlite3_int64 at bp, 8
 12908  
 12909  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 12 /* &.xRowCount */))))(tls, pFts, bp /* &nRow */)
 12910  			*(*u32)(unsafe.Pointer(aOut)) = u32(*(*sqlite3_int64)(unsafe.Pointer(bp /* nRow */)))
 12911  			break
 12912  
 12913  		}
 12914  
 12915  	case 'a':
 12916  		{
 12917  			*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */)) = int64(0)
 12918  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 12 /* &.xRowCount */))))(tls, pFts, bp+8 /* &nRow */)
 12919  			if *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* nRow */)) == int64(0) {
 12920  				libc.Xmemset(tls, aOut, 0, (uint32(unsafe.Sizeof(u32(0))) * uint32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)))
 12921  			} else {
 12922  				var i int32
 12923  				for i = 0; (rc == SQLITE_OK) && (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol); i++ {
 12924  					// var nToken sqlite3_int64 at bp+16, 8
 12925  
 12926  					rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 16 /* &.xColumnTotalSize */))))(tls, pFts, i, bp+16 /* &nToken */)
 12927  					if rc == SQLITE_OK {
 12928  						*(*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 */)))))
 12929  					}
 12930  				}
 12931  			}
 12932  			break
 12933  
 12934  		}
 12935  
 12936  	}
 12937  	return rc
 12938  }
 12939  
 12940  func fts5MatchinfoLocalCb(tls *libc.TLS, pApi uintptr, pFts uintptr, p uintptr, f int8, aOut uintptr) int32 { /* fts5_test_mi.c:205:12: */
 12941  	bp := tls.Alloc(60)
 12942  	defer tls.Free(60)
 12943  
 12944  	var i int32
 12945  	var rc int32 = SQLITE_OK
 12946  
 12947  	switch int32(f) {
 12948  	case 'b':
 12949  		{
 12950  			var iPhrase int32
 12951  			var nInt int32 = ((((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol + 31) / 32) * (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase)
 12952  			for i = 0; i < nInt; i++ {
 12953  				*(*u32)(unsafe.Pointer(aOut + uintptr(i)*4)) = u32(0)
 12954  			}
 12955  
 12956  			for iPhrase = 0; iPhrase < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase; iPhrase++ {
 12957  				// var iter Fts5PhraseIter at bp, 8
 12958  
 12959  				// var iCol int32 at bp+8, 4
 12960  
 12961  				for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 72 /* &.xPhraseFirstColumn */))))(tls, pFts, iPhrase, bp /* &iter */, bp+8 /* &iCol */); *(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 76 /* &.xPhraseNextColumn */))))(tls, pFts, bp /* &iter */, bp+8 /* &iCol */) {
 12962  					*(*u32)(unsafe.Pointer(aOut + uintptr(((iPhrase*(((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol+31)/32))+(*(*int32)(unsafe.Pointer(bp + 8 /* iCol */))/32)))*4)) |= (u32(u32(1)) << (*(*int32)(unsafe.Pointer(bp + 8 /* iCol */)) % 32))
 12963  				}
 12964  			}
 12965  
 12966  			break
 12967  
 12968  		}
 12969  
 12970  	case 'x':
 12971  		fallthrough
 12972  	case 'y':
 12973  		{
 12974  			var nMul int32 = func() int32 {
 12975  				if int32(f) == 'x' {
 12976  					return 3
 12977  				}
 12978  				return 1
 12979  			}()
 12980  			var iPhrase int32
 12981  
 12982  			for i = 0; i < ((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol * (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase); i++ {
 12983  				*(*u32)(unsafe.Pointer(aOut + uintptr((i*nMul))*4)) = u32(0)
 12984  			}
 12985  
 12986  			for iPhrase = 0; iPhrase < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase; iPhrase++ {
 12987  				// var iter Fts5PhraseIter at bp+12, 8
 12988  
 12989  				// var iOff int32 at bp+24, 4
 12990  
 12991  				// var iCol int32 at bp+20, 4
 12992  
 12993  				for (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 64 /* &.xPhraseFirst */))))(tls, pFts, iPhrase, bp+12 /* &iter */, bp+20 /* &iCol */, bp+24 /* &iOff */); *(*int32)(unsafe.Pointer(bp + 24 /* iOff */)) >= 0; (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr))(unsafe.Pointer((pApi + 68 /* &.xPhraseNext */))))(tls, pFts, bp+12 /* &iter */, bp+20 /* &iCol */, bp+24 /* &iOff */) {
 12994  					*(*u32)(unsafe.Pointer(aOut + uintptr((nMul*(*(*int32)(unsafe.Pointer(bp + 20 /* iCol */))+(iPhrase*(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol))))*4))++
 12995  				}
 12996  			}
 12997  
 12998  			break
 12999  
 13000  		}
 13001  
 13002  	case 'l':
 13003  		{
 13004  			for i = 0; (rc == SQLITE_OK) && (i < (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol); i++ {
 13005  				// var nToken int32 at bp+28, 4
 13006  
 13007  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pApi + 48 /* &.xColumnSize */))))(tls, pFts, i, bp+28 /* &nToken */)
 13008  				*(*u32)(unsafe.Pointer(aOut + uintptr(i)*4)) = u32(*(*int32)(unsafe.Pointer(bp + 28 /* nToken */)))
 13009  			}
 13010  			break
 13011  
 13012  		}
 13013  
 13014  	case 's':
 13015  		{
 13016  			// var nInst int32 at bp+32, 4
 13017  
 13018  			libc.Xmemset(tls, aOut, 0, (uint32(unsafe.Sizeof(u32(0))) * uint32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol)))
 13019  
 13020  			rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 32 /* &.xInstCount */))))(tls, pFts, bp+32 /* &nInst */)
 13021  			for i = 0; (rc == SQLITE_OK) && (i < *(*int32)(unsafe.Pointer(bp + 32 /* nInst */))); i++ {
 13022  				// var iPhrase int32 at bp+36, 4
 13023  
 13024  				// var iOff int32 at bp+44, 4
 13025  
 13026  				*(*int32)(unsafe.Pointer(bp + 40 /* iCol */)) = 0
 13027  				var iNextPhrase int32
 13028  				var iNextOff int32
 13029  				var nSeq u32 = u32(1)
 13030  				var j int32
 13031  
 13032  				rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 36 /* &.xInst */))))(tls, pFts, i, bp+36 /* &iPhrase */, bp+40 /* &iCol */, bp+44 /* &iOff */)
 13033  				iNextPhrase = (*(*int32)(unsafe.Pointer(bp + 36 /* iPhrase */)) + 1)
 13034  				iNextOff = (*(*int32)(unsafe.Pointer(bp + 44 /* iOff */)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pApi + 28 /* &.xPhraseSize */))))(tls, pFts, 0))
 13035  				for j = (i + 1); (rc == SQLITE_OK) && (j < *(*int32)(unsafe.Pointer(bp + 32 /* nInst */))); j++ {
 13036  					// var ip int32 at bp+48, 4
 13037  
 13038  					// var ic int32 at bp+52, 4
 13039  
 13040  					// var io int32 at bp+56, 4
 13041  
 13042  					rc = (*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 36 /* &.xInst */))))(tls, pFts, j, bp+48 /* &ip */, bp+52 /* &ic */, bp+56 /* &io */)
 13043  					if (*(*int32)(unsafe.Pointer(bp + 52 /* ic */)) != *(*int32)(unsafe.Pointer(bp + 40 /* iCol */))) || (*(*int32)(unsafe.Pointer(bp + 56 /* io */)) > iNextOff) {
 13044  						break
 13045  					}
 13046  					if (*(*int32)(unsafe.Pointer(bp + 48 /* ip */)) == iNextPhrase) && (*(*int32)(unsafe.Pointer(bp + 56 /* io */)) == iNextOff) {
 13047  						nSeq++
 13048  						iNextPhrase = (*(*int32)(unsafe.Pointer(bp + 48 /* ip */)) + 1)
 13049  						iNextOff = (*(*int32)(unsafe.Pointer(bp + 56 /* io */)) + (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pApi + 28 /* &.xPhraseSize */))))(tls, pFts, *(*int32)(unsafe.Pointer(bp + 48 /* ip */))))
 13050  					}
 13051  				}
 13052  
 13053  				if nSeq > *(*u32)(unsafe.Pointer(aOut + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* iCol */)))*4)) {
 13054  					*(*u32)(unsafe.Pointer(aOut + uintptr(*(*int32)(unsafe.Pointer(bp + 40 /* iCol */)))*4)) = nSeq
 13055  				}
 13056  			}
 13057  
 13058  			break
 13059  
 13060  		}
 13061  	}
 13062  	return rc
 13063  }
 13064  
 13065  func fts5MatchinfoNew(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, zArg uintptr) uintptr { /* fts5_test_mi.c:301:25: */
 13066  	bp := tls.Alloc(8)
 13067  	defer tls.Free(8)
 13068  
 13069  	var p uintptr
 13070  	var nCol int32
 13071  	var nPhrase int32
 13072  	var i int32
 13073  	var nInt int32
 13074  	var nByte sqlite3_int64
 13075  	var rc int32
 13076  
 13077  	nCol = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 8 /* &.xColumnCount */))))(tls, pFts)
 13078  	nPhrase = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((pApi + 24 /* &.xPhraseCount */))))(tls, pFts)
 13079  
 13080  	nInt = 0
 13081  	for i = 0; *(*int8)(unsafe.Pointer(zArg + uintptr(i))) != 0; i++ {
 13082  		var n int32 = fts5MatchinfoFlagsize(tls, nCol, nPhrase, *(*int8)(unsafe.Pointer(zArg + uintptr(i))))
 13083  		if n < 0 {
 13084  			var zErr uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+2992 /* "unrecognized mat..." */, libc.VaList(bp, int32(*(*int8)(unsafe.Pointer(zArg + uintptr(i))))))
 13085  			sqlite3.Xsqlite3_result_error(tls, pCtx, zErr, -1)
 13086  			sqlite3.Xsqlite3_free(tls, zErr)
 13087  			return uintptr(0)
 13088  		}
 13089  		nInt = nInt + (n)
 13090  	}
 13091  
 13092  	nByte = (sqlite3_int64((uint32(unsafe.Sizeof(Fts5MatchinfoCtx{})) + // The struct itself
 13093  		(uint32(unsafe.Sizeof(u32(0))) * uint32(nInt))) + // The p->aRet[] array
 13094  		(uint32(i + 1)))) // The p->zArg string
 13095  	p = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 13096  	if p == uintptr(0) {
 13097  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 13098  		return uintptr(0)
 13099  	}
 13100  	libc.Xmemset(tls, p, 0, uint32(nByte))
 13101  
 13102  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnCol = nCol
 13103  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnPhrase = nPhrase
 13104  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet = (p + 1*20)
 13105  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnRet = nInt
 13106  	(*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg = ((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet + uintptr(nInt)*4)
 13107  	libc.Xmemcpy(tls, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg, zArg, uint32(i))
 13108  
 13109  	rc = fts5MatchinfoIter(tls, pApi, pFts, p, *(*uintptr)(unsafe.Pointer(&struct {
 13110  		f func(*libc.TLS, uintptr, uintptr, uintptr, int8, uintptr) int32
 13111  	}{fts5MatchinfoGlobalCb})))
 13112  	if rc != SQLITE_OK {
 13113  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 13114  		sqlite3.Xsqlite3_free(tls, p)
 13115  		p = uintptr(0)
 13116  	}
 13117  
 13118  	return p
 13119  }
 13120  
 13121  func fts5MatchinfoFunc(tls *libc.TLS, pApi uintptr, pFts uintptr, pCtx uintptr, nVal int32, apVal uintptr) { /* fts5_test_mi.c:357:13: */
 13122  	var zArg uintptr
 13123  	var p uintptr
 13124  	var rc int32 = SQLITE_OK
 13125  
 13126  	if nVal > 0 {
 13127  		zArg = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 13128  	} else {
 13129  		zArg = ts + 3024 /* "pcx" */
 13130  	}
 13131  
 13132  	p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((pApi + 60 /* &.xGetAuxdata */))))(tls, pFts, 0)
 13133  	if (p == uintptr(0)) || (sqlite3.Xsqlite3_stricmp(tls, zArg, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FzArg) != 0) {
 13134  		p = fts5MatchinfoNew(tls, pApi, pFts, pCtx, zArg)
 13135  		if p == uintptr(0) {
 13136  			rc = SQLITE_NOMEM
 13137  		} else {
 13138  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 56 /* &.xSetAuxdata */))))(tls, pFts, p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 13139  		}
 13140  	}
 13141  
 13142  	if rc == SQLITE_OK {
 13143  		rc = fts5MatchinfoIter(tls, pApi, pFts, p, *(*uintptr)(unsafe.Pointer(&struct {
 13144  			f func(*libc.TLS, uintptr, uintptr, uintptr, int8, uintptr) int32
 13145  		}{fts5MatchinfoLocalCb})))
 13146  	}
 13147  	if rc != SQLITE_OK {
 13148  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 13149  	} else {
 13150  		// No errors has occured, so return a copy of the array of integers.
 13151  		var nByte int32 = (int32(uint32((*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FnRet) * uint32(unsafe.Sizeof(u32(0)))))
 13152  		sqlite3.Xsqlite3_result_blob(tls, pCtx, (*Fts5MatchinfoCtx)(unsafe.Pointer(p)).FaRet, nByte, libc.UintptrFromInt32(-1))
 13153  	}
 13154  }
 13155  
 13156  func sqlite3Fts5TestRegisterMatchinfo(tls *libc.TLS, db uintptr) int32 { /* fts5_test_mi.c:396:5: */
 13157  	bp := tls.Alloc(4)
 13158  	defer tls.Free(4)
 13159  
 13160  	var rc int32 // Return code
 13161  	// var pApi uintptr at bp, 4
 13162  	// FTS5 API functions
 13163  
 13164  	// Extract the FTS5 API pointer from the database handle. The
 13165  	// fts5_api_from_db() function above is copied verbatim from the
 13166  	// FTS5 documentation. Refer there for details.
 13167  	rc = fts5_api_from_db(tls, db, bp /* &pApi */)
 13168  	if rc != SQLITE_OK {
 13169  		return rc
 13170  	}
 13171  
 13172  	/* If fts5_api_from_db() returns NULL, then either FTS5 is not registered
 13173  	 ** with this database handle, or an error (OOM perhaps?) has occurred.
 13174  	 **
 13175  	 ** Also check that the fts5_api object is version 2 or newer.
 13176  	 */
 13177  	if (*(*uintptr)(unsafe.Pointer(bp /* pApi */)) == uintptr(0)) || ((*fts5_api)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pApi */)))).FiVersion < 2) {
 13178  		return SQLITE_ERROR
 13179  	}
 13180  
 13181  	// Register the implementation of matchinfo()
 13182  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, fts5_extension_function, uintptr) int32)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(bp /* pApi */)) + 12 /* &.xCreateFunction */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pApi */)), ts+3028 /* "matchinfo" */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 13183  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr)
 13184  	}{fts5MatchinfoFunc})), uintptr(0))
 13185  
 13186  	return rc
 13187  }
 13188  
 13189  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13190  //    This file is part of the GNU C Library.
 13191  //
 13192  //    The GNU C Library is free software; you can redistribute it and/or
 13193  //    modify it under the terms of the GNU Lesser General Public
 13194  //    License as published by the Free Software Foundation; either
 13195  //    version 2.1 of the License, or (at your option) any later version.
 13196  //
 13197  //    The GNU C Library is distributed in the hope that it will be useful,
 13198  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13199  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13200  //    Lesser General Public License for more details.
 13201  //
 13202  //    You should have received a copy of the GNU Lesser General Public
 13203  //    License along with the GNU C Library; if not, see
 13204  //    <http://www.gnu.org/licenses/>.
 13205  
 13206  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 13207  
 13208  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13209  //    This file is part of the GNU C Library.
 13210  //
 13211  //    The GNU C Library is free software; you can redistribute it and/or
 13212  //    modify it under the terms of the GNU Lesser General Public
 13213  //    License as published by the Free Software Foundation; either
 13214  //    version 2.1 of the License, or (at your option) any later version.
 13215  //
 13216  //    The GNU C Library is distributed in the hope that it will be useful,
 13217  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13218  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13219  //    Lesser General Public License for more details.
 13220  //
 13221  //    You should have received a copy of the GNU Lesser General Public
 13222  //    License along with the GNU C Library; if not, see
 13223  //    <http://www.gnu.org/licenses/>.
 13224  
 13225  // void assert (int expression);
 13226  //
 13227  //    If NDEBUG is defined, do nothing.
 13228  //    If not, and EXPRESSION is zero, print an error message and abort.
 13229  
 13230  // void assert_perror (int errnum);
 13231  //
 13232  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 13233  //    error message with the error text for ERRNUM and abort.
 13234  //    (This is a GNU extension.)
 13235  
 13236  type Fts5tokTable1 = struct {
 13237  	Fbase sqlite3_vtab
 13238  	Ftok  fts5_tokenizer
 13239  	FpTok uintptr
 13240  } /* fts5_test_tok.c:47:9 */
 13241  
 13242  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13243  //    This file is part of the GNU C Library.
 13244  //
 13245  //    The GNU C Library is free software; you can redistribute it and/or
 13246  //    modify it under the terms of the GNU Lesser General Public
 13247  //    License as published by the Free Software Foundation; either
 13248  //    version 2.1 of the License, or (at your option) any later version.
 13249  //
 13250  //    The GNU C Library is distributed in the hope that it will be useful,
 13251  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13252  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13253  //    Lesser General Public License for more details.
 13254  //
 13255  //    You should have received a copy of the GNU Lesser General Public
 13256  //    License along with the GNU C Library; if not, see
 13257  //    <http://www.gnu.org/licenses/>.
 13258  
 13259  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 13260  
 13261  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13262  //    This file is part of the GNU C Library.
 13263  //
 13264  //    The GNU C Library is free software; you can redistribute it and/or
 13265  //    modify it under the terms of the GNU Lesser General Public
 13266  //    License as published by the Free Software Foundation; either
 13267  //    version 2.1 of the License, or (at your option) any later version.
 13268  //
 13269  //    The GNU C Library is distributed in the hope that it will be useful,
 13270  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13271  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13272  //    Lesser General Public License for more details.
 13273  //
 13274  //    You should have received a copy of the GNU Lesser General Public
 13275  //    License along with the GNU C Library; if not, see
 13276  //    <http://www.gnu.org/licenses/>.
 13277  
 13278  // void assert (int expression);
 13279  //
 13280  //    If NDEBUG is defined, do nothing.
 13281  //    If not, and EXPRESSION is zero, print an error message and abort.
 13282  
 13283  // void assert_perror (int errnum);
 13284  //
 13285  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 13286  //    error message with the error text for ERRNUM and abort.
 13287  //    (This is a GNU extension.)
 13288  
 13289  type Fts5tokTable = Fts5tokTable1 /* fts5_test_tok.c:47:29 */
 13290  type Fts5tokCursor1 = struct {
 13291  	Fbase   sqlite3_vtab_cursor
 13292  	FiRowid int32
 13293  	FzInput uintptr
 13294  	FnRow   int32
 13295  	FaRow   uintptr
 13296  } /* fts5_test_tok.c:48:9 */
 13297  
 13298  type Fts5tokCursor = Fts5tokCursor1 /* fts5_test_tok.c:48:30 */
 13299  type Fts5tokRow1 = struct {
 13300  	FzToken uintptr
 13301  	FiStart int32
 13302  	FiEnd   int32
 13303  	FiPos   int32
 13304  } /* fts5_test_tok.c:48:9 */
 13305  
 13306  type Fts5tokRow = Fts5tokRow1 /* fts5_test_tok.c:49:27 */
 13307  
 13308  func fts5tokDequote(tls *libc.TLS, z uintptr) { /* fts5_test_tok.c:81:13: */
 13309  	var q int8 = *(*int8)(unsafe.Pointer(z))
 13310  
 13311  	if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 13312  		var iIn int32 = 1
 13313  		var iOut int32 = 0
 13314  		if int32(q) == '[' {
 13315  			q = int8(']')
 13316  		}
 13317  
 13318  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 13319  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 13320  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 13321  					// Character iIn was the close quote.
 13322  					iIn++
 13323  					break
 13324  				} else {
 13325  					// Character iIn and iIn+1 form an escaped quote character. Skip
 13326  					// the input cursor past both and copy a single quote character
 13327  					// to the output buffer.
 13328  					iIn = iIn + (2)
 13329  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 13330  				}
 13331  			} else {
 13332  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 13333  			}
 13334  		}
 13335  
 13336  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 13337  	}
 13338  }
 13339  
 13340  // The second argument, argv[], is an array of pointers to nul-terminated
 13341  // strings. This function makes a copy of the array and strings into a
 13342  // single block of memory. It then dequotes any of the strings that appear
 13343  // to be quoted.
 13344  //
 13345  // If successful, output parameter *pazDequote is set to point at the
 13346  // array of dequoted strings and SQLITE_OK is returned. The caller is
 13347  // responsible for eventually calling sqlite3_free() to free the array
 13348  // in this case. Or, if an error occurs, an SQLite error code is returned.
 13349  // The final value of *pazDequote is undefined in this case.
 13350  func fts5tokDequoteArray(tls *libc.TLS, argc int32, argv uintptr, pazDequote uintptr) int32 { /* fts5_test_tok.c:123:12: */
 13351  	var rc int32 = SQLITE_OK // Return code
 13352  	if argc == 0 {
 13353  		*(*uintptr)(unsafe.Pointer(pazDequote)) = uintptr(0)
 13354  	} else {
 13355  		var i int32
 13356  		var nByte int32 = 0
 13357  		var azDequote uintptr
 13358  
 13359  		for i = 0; i < argc; i++ {
 13360  			nByte = nByte + (int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) + size_t(1)))
 13361  		}
 13362  
 13363  		*(*uintptr)(unsafe.Pointer(pazDequote)) = libc.AssignUintptr(&azDequote, sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(uintptr(0)))*uint32(argc))+uint32(nByte)))))
 13364  		if azDequote == uintptr(0) {
 13365  			rc = SQLITE_NOMEM
 13366  		} else {
 13367  			var pSpace uintptr = (azDequote + uintptr(argc)*4)
 13368  			for i = 0; i < argc; i++ {
 13369  				var n int32 = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 13370  				*(*uintptr)(unsafe.Pointer(azDequote + uintptr(i)*4)) = pSpace
 13371  				libc.Xmemcpy(tls, pSpace, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (uint32(n + 1)))
 13372  				fts5tokDequote(tls, pSpace)
 13373  				pSpace += (uintptr(n + 1))
 13374  			}
 13375  		}
 13376  	}
 13377  
 13378  	return rc
 13379  }
 13380  
 13381  // Schema of the tokenizer table.
 13382  
 13383  // This function does all the work for both the xConnect and xCreate methods.
 13384  // These tables have no persistent representation of their own, so xConnect
 13385  // and xCreate are identical operations.
 13386  //
 13387  //   argv[0]: module name
 13388  //   argv[1]: database name
 13389  //   argv[2]: table name
 13390  //   argv[3]: first argument (tokenizer name)
 13391  func fts5tokConnectMethod(tls *libc.TLS, db uintptr, pCtx uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fts5_test_tok.c:173:12: */
 13392  	bp := tls.Alloc(8)
 13393  	defer tls.Free(8)
 13394  
 13395  	var pApi uintptr = pCtx
 13396  	var pTab uintptr = uintptr(0)
 13397  	var rc int32
 13398  	*(*uintptr)(unsafe.Pointer(bp /* azDequote */)) = uintptr(0)
 13399  	var nDequote int32 = 0
 13400  
 13401  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 13402  		ts+3038 /* "CREATE TABLE x(i..." */)
 13403  
 13404  	if rc == SQLITE_OK {
 13405  		nDequote = (argc - 3)
 13406  		rc = fts5tokDequoteArray(tls, nDequote, (argv + 3*4), bp /* &azDequote */)
 13407  	}
 13408  
 13409  	if rc == SQLITE_OK {
 13410  		pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5tokTable{})))
 13411  		if pTab == uintptr(0) {
 13412  			rc = SQLITE_NOMEM
 13413  		} else {
 13414  			libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(Fts5tokTable{})))
 13415  		}
 13416  	}
 13417  
 13418  	if rc == SQLITE_OK {
 13419  		*(*uintptr)(unsafe.Pointer(bp + 4 /* pTokCtx */)) = uintptr(0)
 13420  		var zModule uintptr = uintptr(0)
 13421  		if nDequote > 0 {
 13422  			zModule = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* azDequote */))))
 13423  		}
 13424  
 13425  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((pApi + 8 /* &.xFindTokenizer */))))(tls, pApi, zModule, bp+4 /* &pTokCtx */, (pTab + 12 /* &.tok */))
 13426  		if rc == SQLITE_OK {
 13427  			var azArg uintptr = func() uintptr {
 13428  				if nDequote > 1 {
 13429  					return (*(*uintptr)(unsafe.Pointer(bp /* azDequote */)) + 1*4)
 13430  				}
 13431  				return uintptr(0)
 13432  			}()
 13433  			var nArg int32
 13434  			if nDequote > 0 {
 13435  				nArg = (nDequote - 1)
 13436  			} else {
 13437  				nArg = 0
 13438  			}
 13439  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pTab + 12 /* &.tok */ /* &.xCreate */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pTokCtx */)), azArg, nArg, (pTab + 24 /* &.pTok */))
 13440  		}
 13441  	}
 13442  
 13443  	if rc != SQLITE_OK {
 13444  		sqlite3.Xsqlite3_free(tls, pTab)
 13445  		pTab = uintptr(0)
 13446  	}
 13447  
 13448  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pTab
 13449  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp /* azDequote */)))
 13450  	return rc
 13451  }
 13452  
 13453  // This function does the work for both the xDisconnect and xDestroy methods.
 13454  // These tables have no persistent representation of their own, so xDisconnect
 13455  // and xDestroy are identical operations.
 13456  func fts5tokDisconnectMethod(tls *libc.TLS, pVtab uintptr) int32 { /* fts5_test_tok.c:235:12: */
 13457  	var pTab uintptr = pVtab
 13458  	if (*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok != 0 {
 13459  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pTab + 12 /* &.tok */ + 4 /* &.xDelete */))))(tls, (*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok)
 13460  	}
 13461  	sqlite3.Xsqlite3_free(tls, pTab)
 13462  	return SQLITE_OK
 13463  }
 13464  
 13465  // xBestIndex - Analyze a WHERE and ORDER BY clause.
 13466  func fts5tokBestIndexMethod(tls *libc.TLS, pVTab uintptr, pInfo uintptr) int32 { /* fts5_test_tok.c:247:12: */
 13467  	var i int32
 13468  
 13469  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pInfo)).FnConstraint; i++ {
 13470  		if (((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).Fusable != 0) &&
 13471  			((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).FiColumn == 0)) &&
 13472  			(int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraint+uintptr(i)*12)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 13473  			(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = 1
 13474  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 13475  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 13476  			(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FestimatedCost = float64(1)
 13477  			return SQLITE_OK
 13478  		}
 13479  	}
 13480  
 13481  	(*sqlite3_index_info)(unsafe.Pointer(pInfo)).FidxNum = 0
 13482  
 13483  	return SQLITE_OK
 13484  }
 13485  
 13486  // xOpen - Open a cursor.
 13487  func fts5tokOpenMethod(tls *libc.TLS, pVTab uintptr, ppCsr uintptr) int32 { /* fts5_test_tok.c:275:12: */
 13488  	var pCsr uintptr
 13489  
 13490  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Fts5tokCursor{})))
 13491  	if pCsr == uintptr(0) {
 13492  		return SQLITE_NOMEM
 13493  	}
 13494  	libc.Xmemset(tls, pCsr, 0, uint32(unsafe.Sizeof(Fts5tokCursor{})))
 13495  
 13496  	*(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr
 13497  	return SQLITE_OK
 13498  }
 13499  
 13500  // Reset the tokenizer cursor passed as the only argument. As if it had
 13501  // just been returned by fts5tokOpenMethod().
 13502  func fts5tokResetCursor(tls *libc.TLS, pCsr uintptr) { /* fts5_test_tok.c:292:13: */
 13503  	var i int32
 13504  	for i = 0; i < (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow; i++ {
 13505  		sqlite3.Xsqlite3_free(tls, (*Fts5tokRow)(unsafe.Pointer((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow+uintptr(i)*16)).FzToken)
 13506  	}
 13507  	sqlite3.Xsqlite3_free(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput)
 13508  	sqlite3.Xsqlite3_free(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow)
 13509  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput = uintptr(0)
 13510  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow = uintptr(0)
 13511  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow = 0
 13512  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid = 0
 13513  }
 13514  
 13515  // xClose - Close a cursor.
 13516  func fts5tokCloseMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:308:12: */
 13517  	var pCsr uintptr = pCursor
 13518  	fts5tokResetCursor(tls, pCsr)
 13519  	sqlite3.Xsqlite3_free(tls, pCsr)
 13520  	return SQLITE_OK
 13521  }
 13522  
 13523  // xNext - Advance the cursor to the next row, if any.
 13524  func fts5tokNextMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:318:12: */
 13525  	var pCsr uintptr = pCursor
 13526  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid++
 13527  	return SQLITE_OK
 13528  }
 13529  
 13530  func fts5tokCb(tls *libc.TLS, pCtx uintptr, tflags int32, pToken uintptr, nToken int32, iStart int32, iEnd int32) int32 { /* fts5_test_tok.c:324:12: */
 13531  	var pCsr uintptr = pCtx
 13532  	var pRow uintptr
 13533  
 13534  	if ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow & ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow - 1)) == 0 {
 13535  		var nNew int32
 13536  		if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow != 0 {
 13537  			nNew = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow * 2)
 13538  		} else {
 13539  			nNew = 32
 13540  		}
 13541  		var aNew uintptr
 13542  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow, (uint64(uint32(nNew) * uint32(unsafe.Sizeof(Fts5tokRow{})))))
 13543  		if aNew == uintptr(0) {
 13544  			return SQLITE_NOMEM
 13545  		}
 13546  		libc.Xmemset(tls, (aNew + uintptr((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow)*16), 0, (uint32(unsafe.Sizeof(Fts5tokRow{})) * (uint32(nNew - (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow))))
 13547  		(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow = aNew
 13548  	}
 13549  
 13550  	pRow = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow + uintptr((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow)*16)
 13551  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FiStart = iStart
 13552  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FiEnd = iEnd
 13553  	if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow != 0 {
 13554  		(*Fts5tokRow)(unsafe.Pointer(pRow)).FiPos = ((*Fts5tokRow)(unsafe.Pointer(pRow+libc.UintptrFromInt32(-1)*16)).FiPos + (func() int32 {
 13555  			if (tflags & FTS5_TOKEN_COLOCATED) != 0 {
 13556  				return 0
 13557  			}
 13558  			return 1
 13559  		}()))
 13560  	}
 13561  	(*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken = sqlite3.Xsqlite3_malloc(tls, (nToken + 1))
 13562  	if (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken == uintptr(0) {
 13563  		return SQLITE_NOMEM
 13564  	}
 13565  	libc.Xmemcpy(tls, (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken, pToken, uint32(nToken))
 13566  	*(*int8)(unsafe.Pointer((*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken + uintptr(nToken))) = int8(0)
 13567  	(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow++
 13568  
 13569  	return SQLITE_OK
 13570  }
 13571  
 13572  // xFilter - Initialize a cursor to point at the start of its data.
 13573  func fts5tokFilterMethod(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, nVal int32, apVal uintptr) int32 { /* fts5_test_tok.c:362:12: */
 13574  	var rc int32 = SQLITE_ERROR
 13575  	var pCsr uintptr = pCursor
 13576  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 13577  
 13578  	fts5tokResetCursor(tls, pCsr)
 13579  	if idxNum == 1 {
 13580  		var zByte uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 13581  		var nByte int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 13582  		(*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput = sqlite3.Xsqlite3_malloc(tls, (nByte + 1))
 13583  		if (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput == uintptr(0) {
 13584  			rc = SQLITE_NOMEM
 13585  		} else {
 13586  			if nByte > 0 {
 13587  				libc.Xmemcpy(tls, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput, zByte, uint32(nByte))
 13588  			}
 13589  			*(*int8)(unsafe.Pointer((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput + uintptr(nByte))) = int8(0)
 13590  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer((pTab + 12 /* &.tok */ + 8 /* &.xTokenize */))))(tls,
 13591  				(*Fts5tokTable)(unsafe.Pointer(pTab)).FpTok, pCsr, 0, zByte, nByte, *(*uintptr)(unsafe.Pointer(&struct {
 13592  					f func(*libc.TLS, uintptr, int32, uintptr, int32, int32, int32) int32
 13593  				}{fts5tokCb})))
 13594  		}
 13595  	}
 13596  
 13597  	if rc != SQLITE_OK {
 13598  		return rc
 13599  	}
 13600  	return fts5tokNextMethod(tls, pCursor)
 13601  }
 13602  
 13603  // xEof - Return true if the cursor is at EOF, or false otherwise.
 13604  func fts5tokEofMethod(tls *libc.TLS, pCursor uintptr) int32 { /* fts5_test_tok.c:396:12: */
 13605  	var pCsr uintptr = pCursor
 13606  	return (libc.Bool32((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid > (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FnRow))
 13607  }
 13608  
 13609  // xColumn - Return a column value.
 13610  func fts5tokColumnMethod(tls *libc.TLS, pCursor uintptr, pCtx uintptr, iCol int32) int32 { /* fts5_test_tok.c:404:12: */
 13611  	var pCsr uintptr = pCursor
 13612  	var pRow uintptr = ((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FaRow + uintptr(((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid-1))*16)
 13613  
 13614  	// CREATE TABLE x(input, token, start, end, position)
 13615  	switch iCol {
 13616  	case 0:
 13617  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*Fts5tokCursor)(unsafe.Pointer(pCsr)).FzInput, -1, libc.UintptrFromInt32(-1))
 13618  		break
 13619  	case 1:
 13620  		sqlite3.Xsqlite3_result_text(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FzToken, -1, libc.UintptrFromInt32(-1))
 13621  		break
 13622  	case 2:
 13623  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiStart)
 13624  		break
 13625  	case 3:
 13626  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiEnd)
 13627  		break
 13628  	default:
 13629  
 13630  		sqlite3.Xsqlite3_result_int(tls, pCtx, (*Fts5tokRow)(unsafe.Pointer(pRow)).FiPos)
 13631  		break
 13632  	}
 13633  	return SQLITE_OK
 13634  }
 13635  
 13636  // xRowid - Return the current rowid for the cursor.
 13637  func fts5tokRowidMethod(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* fts5_test_tok.c:437:12: */
 13638  	var pCsr uintptr = pCursor
 13639  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3_int64((*Fts5tokCursor)(unsafe.Pointer(pCsr)).FiRowid)
 13640  	return SQLITE_OK
 13641  }
 13642  
 13643  // Register the fts5tok module with database connection db. Return SQLITE_OK
 13644  // if successful or an error code if sqlite3_create_module() fails.
 13645  func sqlite3Fts5TestRegisterTok(tls *libc.TLS, db uintptr, pApi uintptr) int32 { /* fts5_test_tok.c:450:5: */
 13646  	var rc int32 // Return code
 13647  
 13648  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3096 /* "fts5tokenize" */, uintptr(unsafe.Pointer(&fts5tok_module)), pApi)
 13649  	return rc
 13650  }
 13651  
 13652  var fts5tok_module = sqlite3_module{ // iVersion
 13653  	FxCreate:     0, // xCreate
 13654  	FxConnect:    0, // xConnect
 13655  	FxBestIndex:  0, // xBestIndex
 13656  	FxDisconnect: 0, // xDisconnect
 13657  	FxDestroy:    0, // xDestroy
 13658  	FxOpen:       0, // xOpen
 13659  	FxClose:      0, // xClose
 13660  	FxFilter:     0, // xFilter
 13661  	FxNext:       0, // xNext
 13662  	FxEof:        0, // xEof
 13663  	FxColumn:     0, // xColumn
 13664  	FxRowid:      0, // xShadowName
 13665  } /* fts5_test_tok.c:451:31 */
 13666  
 13667  // CAPI3REF: Loadable Extension Thunk
 13668  //
 13669  // A pointer to the opaque sqlite3_api_routines structure is passed as
 13670  // the third parameter to entry points of [loadable extensions].  This
 13671  // structure must be typedefed in order to work around compiler warnings
 13672  // on some platforms.
 13673  type sqlite3_api_routines = sqlite3_api_routines1 /* sqlite3.h:1216:37 */
 13674  
 13675  // This is the function signature used for all extension entry points.  It
 13676  // is also defined in the file "loadext.c".
 13677  type sqlite3_loadext_entry = uintptr /* sqlite3ext.h:346:13 */
 13678  
 13679  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13680  //    This file is part of the GNU C Library.
 13681  //
 13682  //    The GNU C Library is free software; you can redistribute it and/or
 13683  //    modify it under the terms of the GNU Lesser General Public
 13684  //    License as published by the Free Software Foundation; either
 13685  //    version 2.1 of the License, or (at your option) any later version.
 13686  //
 13687  //    The GNU C Library is distributed in the hope that it will be useful,
 13688  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13689  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13690  //    Lesser General Public License for more details.
 13691  //
 13692  //    You should have received a copy of the GNU Lesser General Public
 13693  //    License along with the GNU C Library; if not, see
 13694  //    <http://www.gnu.org/licenses/>.
 13695  
 13696  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 13697  
 13698  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 13699  //    This file is part of the GNU C Library.
 13700  //
 13701  //    The GNU C Library is free software; you can redistribute it and/or
 13702  //    modify it under the terms of the GNU Lesser General Public
 13703  //    License as published by the Free Software Foundation; either
 13704  //    version 2.1 of the License, or (at your option) any later version.
 13705  //
 13706  //    The GNU C Library is distributed in the hope that it will be useful,
 13707  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 13708  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13709  //    Lesser General Public License for more details.
 13710  //
 13711  //    You should have received a copy of the GNU Lesser General Public
 13712  //    License along with the GNU C Library; if not, see
 13713  //    <http://www.gnu.org/licenses/>.
 13714  
 13715  // void assert (int expression);
 13716  //
 13717  //    If NDEBUG is defined, do nothing.
 13718  //    If not, and EXPRESSION is zero, print an error message and abort.
 13719  
 13720  // void assert_perror (int errnum);
 13721  //
 13722  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 13723  //    error message with the error text for ERRNUM and abort.
 13724  //    (This is a GNU extension.)
 13725  
 13726  // The append mark at the end of the database is:
 13727  //
 13728  //     Start-Of-SQLite3-NNNNNNNN
 13729  //     123456789 123456789 12345
 13730  //
 13731  // The NNNNNNNN represents a 64-bit big-endian unsigned integer which is
 13732  // the offset to page 1, and also the length of the prefix content.
 13733  
 13734  // Maximum size of the combined prefix + database + append-mark.  This
 13735  // must be less than 0x40000000 to avoid locking issues on Windows.
 13736  
 13737  // Try to align the database to an even multiple of APND_ROUNDUP bytes.
 13738  
 13739  // Forward declaration of objects used by this utility
 13740  type ApndVfs = sqlite3_vfs1 /* appendvfs.c:85:28 */
 13741  type ApndFile1 = struct {
 13742  	Fbase   sqlite3_file
 13743  	_       [4]byte
 13744  	FiPgOne sqlite3_int64
 13745  	FiMark  sqlite3_int64
 13746  } /* appendvfs.c:86:9 */
 13747  
 13748  type ApndFile = ApndFile1 /* appendvfs.c:86:25 */
 13749  
 13750  var apnd_vfs = sqlite3_vfs{
 13751  	FiVersion:          3,         // szOsFile (set when registered)
 13752  	FmxPathname:        1024,      // pNext
 13753  	FzName:             ts + 3109, /* "apndvfs" */ /* pAppData (set when registered) */
 13754  	FxOpen:             0,         // xOpen
 13755  	FxDelete:           0,         // xDelete
 13756  	FxAccess:           0,         // xAccess
 13757  	FxFullPathname:     0,         // xFullPathname
 13758  	FxDlOpen:           0,         // xDlOpen
 13759  	FxDlError:          0,         // xDlError
 13760  	FxDlSym:            0,         // xDlSym
 13761  	FxDlClose:          0,         // xDlClose
 13762  	FxRandomness:       0,         // xRandomness
 13763  	FxSleep:            0,         // xSleep
 13764  	FxCurrentTime:      0,         // xCurrentTime
 13765  	FxGetLastError:     0,         // xGetLastError
 13766  	FxCurrentTimeInt64: 0,         // xCurrentTimeInt64
 13767  	FxSetSystemCall:    0,         // xSetSystemCall
 13768  	FxGetSystemCall:    0,         // xGetSystemCall
 13769  	FxNextSystemCall:   0,         // xNextSystemCall
 13770  } /* appendvfs.c:177:20 */
 13771  
 13772  var apnd_io_methods = sqlite3_io_methods{
 13773  	FiVersion:               3, // iVersion
 13774  	FxClose:                 0, // xClose
 13775  	FxRead:                  0, // xRead
 13776  	FxWrite:                 0, // xWrite
 13777  	FxTruncate:              0, // xTruncate
 13778  	FxSync:                  0, // xSync
 13779  	FxFileSize:              0, // xFileSize
 13780  	FxLock:                  0, // xLock
 13781  	FxUnlock:                0, // xUnlock
 13782  	FxCheckReservedLock:     0, // xCheckReservedLock
 13783  	FxFileControl:           0, // xFileControl
 13784  	FxSectorSize:            0, // xSectorSize
 13785  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 13786  	FxShmMap:                0, // xShmMap
 13787  	FxShmLock:               0, // xShmLock
 13788  	FxShmBarrier:            0, // xShmBarrier
 13789  	FxShmUnmap:              0, // xShmUnmap
 13790  	FxFetch:                 0, // xFetch
 13791  	FxUnfetch:               0, // xUnfetch
 13792  } /* appendvfs.c:202:33 */
 13793  
 13794  // Close an apnd-file.
 13795  func apndClose(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:227:12: */
 13796  	pFile = ((pFile) + uintptr(1)*24)
 13797  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 4 /* &.xClose */))))(tls, pFile)
 13798  }
 13799  
 13800  // Read data from an apnd-file.
 13801  func apndRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* appendvfs.c:235:12: */
 13802  	var paf uintptr = pFile
 13803  	pFile = ((pFile) + uintptr(1)*24)
 13804  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xRead */))))(tls, pFile, zBuf, iAmt, ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iOfst))
 13805  }
 13806  
 13807  // Add the append-mark onto what should become the end of the file.
 13808  //  If and only if this succeeds, internal ApndFile.iMark is updated.
 13809  //  Parameter iWriteEnd is the appendvfs-relative offset of the new mark.
 13810  func apndWriteMark(tls *libc.TLS, paf uintptr, pFile uintptr, iWriteEnd sqlite_int64) int32 { /* appendvfs.c:251:12: */
 13811  	bp := tls.Alloc(25)
 13812  	defer tls.Free(25)
 13813  
 13814  	var iPgOne sqlite_int64 = (*ApndFile)(unsafe.Pointer(paf)).FiPgOne
 13815  	// var a [25]uint8 at bp, 25
 13816  
 13817  	var i int32 = APND_MARK_FOS_SZ
 13818  	var rc int32
 13819  
 13820  	libc.Xmemcpy(tls, bp /* &a[0] */, ts+3117 /* "Start-Of-SQLite3..." */, uint32(APND_MARK_PREFIX_SZ))
 13821  	for libc.PreDecInt32(&i, 1) >= 0 {
 13822  		*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + uintptr((APND_MARK_PREFIX_SZ + i)))) = (uint8(iPgOne & int64(0xff)))
 13823  		iPgOne >>= 8
 13824  	}
 13825  	iWriteEnd = iWriteEnd + ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13826  	if SQLITE_OK == (libc.AssignInt32(&rc, (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 12 /* &.xWrite */))))(tls, pFile, bp /* &a[0] */, (APND_MARK_PREFIX_SZ+APND_MARK_FOS_SZ), iWriteEnd))) {
 13827  		(*ApndFile)(unsafe.Pointer(paf)).FiMark = iWriteEnd
 13828  	}
 13829  	return rc
 13830  }
 13831  
 13832  // Write data to an apnd-file.
 13833  func apndWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* appendvfs.c:277:12: */
 13834  	var paf uintptr = pFile
 13835  	var iWriteEnd sqlite_int64 = (iOfst + sqlite_int64(iAmt))
 13836  	if iWriteEnd >= (int64(0x40000000)) {
 13837  		return SQLITE_FULL
 13838  	}
 13839  	pFile = ((pFile) + uintptr(1)*24)
 13840  	// If append-mark is absent or will be overwritten, write it.
 13841  	if ((*ApndFile)(unsafe.Pointer(paf)).FiMark < int64(0)) || (((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iWriteEnd) > (*ApndFile)(unsafe.Pointer(paf)).FiMark) {
 13842  		var rc int32 = apndWriteMark(tls, paf, pFile, iWriteEnd)
 13843  		if SQLITE_OK != rc {
 13844  			return rc
 13845  		}
 13846  	}
 13847  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 12 /* &.xWrite */))))(tls, pFile, zBuf, iAmt, ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne + iOfst))
 13848  }
 13849  
 13850  // Truncate an apnd-file.
 13851  func apndTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* appendvfs.c:298:12: */
 13852  	var paf uintptr = pFile
 13853  	pFile = ((pFile) + uintptr(1)*24)
 13854  	// The append mark goes out first so truncate failure does not lose it.
 13855  	if SQLITE_OK != apndWriteMark(tls, paf, pFile, size) {
 13856  		return SQLITE_IOERR
 13857  	}
 13858  	// Truncate underlying file just past append mark
 13859  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xTruncate */))))(tls, pFile, ((*ApndFile)(unsafe.Pointer(paf)).FiMark + (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))))
 13860  }
 13861  
 13862  // Sync an apnd-file.
 13863  func apndSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* appendvfs.c:310:12: */
 13864  	pFile = ((pFile) + uintptr(1)*24)
 13865  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 20 /* &.xSync */))))(tls, pFile, flags)
 13866  }
 13867  
 13868  // Return the current file-size of an apnd-file.
 13869  // If the append mark is not yet there, the file-size is 0.
 13870  func apndFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* appendvfs.c:319:12: */
 13871  	var paf uintptr = pFile
 13872  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = func() int64 {
 13873  		if (*ApndFile)(unsafe.Pointer(paf)).FiMark >= int64(0) {
 13874  			return ((*ApndFile)(unsafe.Pointer(paf)).FiMark - (*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13875  		}
 13876  		return int64(0)
 13877  	}()
 13878  	return SQLITE_OK
 13879  }
 13880  
 13881  // Lock an apnd-file.
 13882  func apndLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* appendvfs.c:328:12: */
 13883  	pFile = ((pFile) + uintptr(1)*24)
 13884  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 28 /* &.xLock */))))(tls, pFile, eLock)
 13885  }
 13886  
 13887  // Unlock an apnd-file.
 13888  func apndUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* appendvfs.c:336:12: */
 13889  	pFile = ((pFile) + uintptr(1)*24)
 13890  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 32 /* &.xUnlock */))))(tls, pFile, eLock)
 13891  }
 13892  
 13893  // Check if another file-handle holds a RESERVED lock on an apnd-file.
 13894  func apndCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* appendvfs.c:344:12: */
 13895  	pFile = ((pFile) + uintptr(1)*24)
 13896  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 36 /* &.xCheckReservedLock */))))(tls, pFile, pResOut)
 13897  }
 13898  
 13899  // File control method. For custom operations on an apnd-file.
 13900  func apndFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* appendvfs.c:352:12: */
 13901  	bp := tls.Alloc(16)
 13902  	defer tls.Free(16)
 13903  
 13904  	var paf uintptr = pFile
 13905  	var rc int32
 13906  	pFile = ((pFile) + uintptr(1)*24)
 13907  	if op == SQLITE_FCNTL_SIZE_HINT {
 13908  		*(*sqlite3_int64)(unsafe.Pointer(pArg)) += ((*ApndFile)(unsafe.Pointer(paf)).FiPgOne)
 13909  	}
 13910  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 40 /* &.xFileControl */))))(tls, pFile, op, pArg)
 13911  	if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) {
 13912  		*(*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))))
 13913  	}
 13914  	return rc
 13915  }
 13916  
 13917  // Return the sector-size in bytes for an apnd-file.
 13918  func apndSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:367:12: */
 13919  	pFile = ((pFile) + uintptr(1)*24)
 13920  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 44 /* &.xSectorSize */))))(tls, pFile)
 13921  }
 13922  
 13923  // Return the device characteristic flags supported by an apnd-file.
 13924  func apndDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* appendvfs.c:375:12: */
 13925  	pFile = ((pFile) + uintptr(1)*24)
 13926  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, pFile)
 13927  }
 13928  
 13929  // Create a shared memory file mapping
 13930  func apndShmMap(tls *libc.TLS, pFile uintptr, iPg int32, pgsz int32, bExtend int32, pp uintptr) int32 { /* appendvfs.c:381:12: */
 13931  	pFile = ((pFile) + uintptr(1)*24)
 13932  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 52 /* &.xShmMap */))))(tls, pFile, iPg, pgsz, bExtend, libc.AtomicLoadUintptr(&pp))
 13933  }
 13934  
 13935  // Perform locking on a shared-memory segment
 13936  func apndShmLock(tls *libc.TLS, pFile uintptr, offset int32, n int32, flags int32) int32 { /* appendvfs.c:393:12: */
 13937  	pFile = ((pFile) + uintptr(1)*24)
 13938  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 56 /* &.xShmLock */))))(tls, pFile, offset, n, flags)
 13939  }
 13940  
 13941  // Memory barrier operation on shared memory
 13942  func apndShmBarrier(tls *libc.TLS, pFile uintptr) { /* appendvfs.c:399:13: */
 13943  	pFile = ((pFile) + uintptr(1)*24)
 13944  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pFile)
 13945  }
 13946  
 13947  // Unmap a shared memory segment
 13948  func apndShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* appendvfs.c:405:12: */
 13949  	pFile = ((pFile) + uintptr(1)*24)
 13950  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pFile, deleteFlag)
 13951  }
 13952  
 13953  // Fetch a page of a memory-mapped file
 13954  func apndFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* appendvfs.c:411:12: */
 13955  	var p uintptr = pFile
 13956  	if ((*ApndFile)(unsafe.Pointer(p)).FiMark < int64(0)) || ((iOfst + sqlite3_int64(iAmt)) > (*ApndFile)(unsafe.Pointer(p)).FiMark) {
 13957  		return SQLITE_IOERR // Cannot read what is not yet there.
 13958  	}
 13959  	pFile = ((pFile) + uintptr(1)*24)
 13960  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 68 /* &.xFetch */))))(tls, pFile, (iOfst + (*ApndFile)(unsafe.Pointer(p)).FiPgOne), iAmt, pp)
 13961  }
 13962  
 13963  // Release a memory-mapped page
 13964  func apndUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, pPage uintptr) int32 { /* appendvfs.c:426:12: */
 13965  	var p uintptr = pFile
 13966  	pFile = ((pFile) + uintptr(1)*24)
 13967  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 72 /* &.xUnfetch */))))(tls, pFile, (iOfst + (*ApndFile)(unsafe.Pointer(p)).FiPgOne), pPage)
 13968  }
 13969  
 13970  // Try to read the append-mark off the end of a file.  Return the
 13971  // start of the appended database if the append-mark is present.
 13972  // If there is no valid append-mark, return -1;
 13973  //
 13974  // An append-mark is only valid if the NNNNNNNN start-of-database offset
 13975  // indicates that the appended database contains at least one page.  The
 13976  // start-of-database value must be a multiple of 512.
 13977  func apndReadMark(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) sqlite3_int64 { /* appendvfs.c:441:22: */
 13978  	bp := tls.Alloc(25)
 13979  	defer tls.Free(25)
 13980  
 13981  	var rc int32
 13982  	var i int32
 13983  	var iMark sqlite3_int64
 13984  	var msbs int32 = (8 * (APND_MARK_FOS_SZ - 1))
 13985  	// var a [25]uint8 at bp, 25
 13986  
 13987  	if (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)) != (sz & int64(0x1ff)) {
 13988  		return int64(-1)
 13989  	}
 13990  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xRead */))))(tls, pFile, bp /* &a[0] */, (APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ), (sz - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))))
 13991  	if rc != 0 {
 13992  		return int64(-1)
 13993  	}
 13994  	if libc.Xmemcmp(tls, bp /* &a[0] */, ts+3117 /* "Start-Of-SQLite3..." */, uint32(APND_MARK_PREFIX_SZ)) != 0 {
 13995  		return int64(-1)
 13996  	}
 13997  	iMark = ((sqlite3_int64(int32(*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + 17))) & 0x7f)) << msbs)
 13998  	for i = 1; i < 8; i++ {
 13999  		msbs = msbs - (8)
 14000  		iMark = iMark | (sqlite3_int64(*(*uint8)(unsafe.Pointer(bp /* &a[0] */ + uintptr((APND_MARK_PREFIX_SZ + i))))) << msbs)
 14001  	}
 14002  	if iMark > ((sz - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))) - int64(512)) {
 14003  		return int64(-1)
 14004  	}
 14005  	if (iMark & int64(0x1ff)) != 0 {
 14006  		return int64(-1)
 14007  	}
 14008  	return iMark
 14009  }
 14010  
 14011  var apvfsSqliteHdr = *(*[16]int8)(unsafe.Pointer(ts + 3149 /* "SQLite format 3" */)) /* appendvfs.c:461:19 */
 14012  
 14013  // Check to see if the file is an appendvfs SQLite database file.
 14014  // Return true iff it is such. Parameter sz is the file's size.
 14015  func apndIsAppendvfsDatabase(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) int32 { /* appendvfs.c:466:12: */
 14016  	bp := tls.Alloc(16)
 14017  	defer tls.Free(16)
 14018  
 14019  	var rc int32
 14020  	// var zHdr [16]int8 at bp, 16
 14021  
 14022  	var iMark sqlite3_int64 = apndReadMark(tls, sz, pFile)
 14023  	if iMark >= int64(0) {
 14024  		// If file has the correct end-marker, the expected odd size, and the
 14025  		// SQLite DB type marker where the end-marker puts it, then it
 14026  		// is an appendvfs database.
 14027  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xRead */))))(tls, pFile, bp /* &zHdr[0] */, int32(unsafe.Sizeof([16]int8{})), iMark)
 14028  		if (((SQLITE_OK == rc) &&
 14029  			(libc.Xmemcmp(tls, bp /* &zHdr[0] */, uintptr(unsafe.Pointer(&apvfsSqliteHdr)), uint32(unsafe.Sizeof([16]int8{}))) == 0)) &&
 14030  			((sz & int64(0x1ff)) == (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)))) &&
 14031  			(sz >= (int64(512 + (APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ)))) {
 14032  			return 1 // It's an appendvfs database
 14033  		}
 14034  	}
 14035  	return 0
 14036  }
 14037  
 14038  // Check to see if the file is an ordinary SQLite database file.
 14039  // Return true iff so. Parameter sz is the file's size.
 14040  func apndIsOrdinaryDatabaseFile(tls *libc.TLS, sz sqlite3_int64, pFile uintptr) int32 { /* appendvfs.c:491:12: */
 14041  	bp := tls.Alloc(16)
 14042  	defer tls.Free(16)
 14043  
 14044  	// var zHdr [16]int8 at bp, 16
 14045  
 14046  	if (((apndIsAppendvfsDatabase(tls, sz, pFile) != 0) || // rule 2
 14047  		((sz & int64(0x1ff)) != int64(0))) ||
 14048  		(SQLITE_OK != (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xRead */))))(tls, pFile, bp /* &zHdr[0] */, int32(unsafe.Sizeof([16]int8{})), int64(0)))) ||
 14049  		(libc.Xmemcmp(tls, bp /* &zHdr[0] */, uintptr(unsafe.Pointer(&apvfsSqliteHdr)), uint32(unsafe.Sizeof([16]int8{}))) != 0) {
 14050  		return 0
 14051  	} else {
 14052  		return 1
 14053  	}
 14054  	return int32(0)
 14055  }
 14056  
 14057  // Open an apnd file handle.
 14058  func apndOpen(tls *libc.TLS, pApndVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* appendvfs.c:507:12: */
 14059  	bp := tls.Alloc(8)
 14060  	defer tls.Free(8)
 14061  
 14062  	var pApndFile uintptr = pFile
 14063  	var pBaseFile uintptr = ((pFile) + uintptr(1)*24)
 14064  	var pBaseVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pApndVfs)).FpAppData
 14065  	var rc int32
 14066  	*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = int64(0)
 14067  	if (flags & SQLITE_OPEN_MAIN_DB) == 0 {
 14068  		// The appendvfs is not to be used for transient or temporary databases.
 14069  		// Just use the base VFS open to initialize the given file object and
 14070  		// open the underlying file. (Appendvfs is then unused for this file.)
 14071  		return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pBaseVfs + 24 /* &.xOpen */))))(tls, pBaseVfs, zName, pFile, flags, pOutFlags)
 14072  	}
 14073  	libc.Xmemset(tls, pApndFile, 0, uint32(unsafe.Sizeof(ApndFile{})))
 14074  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&apnd_io_methods))
 14075  	(*ApndFile)(unsafe.Pointer(pApndFile)).FiMark = int64(-1) // Append mark not yet written
 14076  
 14077  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pBaseVfs + 24 /* &.xOpen */))))(tls, pBaseVfs, zName, pBaseFile, flags, pOutFlags)
 14078  	if rc == SQLITE_OK {
 14079  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 24 /* &.xFileSize */))))(tls, pBaseFile, bp /* &sz */)
 14080  		if rc != 0 {
 14081  			(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 4 /* &.xClose */))))(tls, pBaseFile)
 14082  		}
 14083  	}
 14084  	if rc != 0 {
 14085  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 14086  		return rc
 14087  	}
 14088  	if apndIsOrdinaryDatabaseFile(tls, *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)), pBaseFile) != 0 {
 14089  		// The file being opened appears to be just an ordinary DB. Copy
 14090  		// the base dispatch-table so this instance mimics the base VFS.
 14091  		libc.Xmemmove(tls, pApndFile, pBaseFile, uint32((*sqlite3_vfs)(unsafe.Pointer(pBaseVfs)).FszOsFile))
 14092  		return SQLITE_OK
 14093  	}
 14094  	(*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne = apndReadMark(tls, *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)), pFile)
 14095  	if (*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne >= int64(0) {
 14096  		(*ApndFile)(unsafe.Pointer(pApndFile)).FiMark = (*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) - (int64(APND_MARK_PREFIX_SZ + APND_MARK_FOS_SZ))) // Append mark found
 14097  		return SQLITE_OK
 14098  	}
 14099  	if (flags & SQLITE_OPEN_CREATE) == 0 {
 14100  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pBaseFile)).FpMethods + 4 /* &.xClose */))))(tls, pBaseFile)
 14101  		rc = SQLITE_CANTOPEN
 14102  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 14103  	} else {
 14104  		// Round newly added appendvfs location to #define'd page boundary.
 14105  		// Note that nothing has yet been written to the underlying file.
 14106  		// The append mark will be written along with first content write.
 14107  		// Until then, paf->iMark value indicates it is not yet written.
 14108  		(*ApndFile)(unsafe.Pointer(pApndFile)).FiPgOne = (((*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))) + (int64(APND_ROUNDUP - 1))) & libc.CplInt64((int64(APND_ROUNDUP - 1))))
 14109  	}
 14110  	return rc
 14111  }
 14112  
 14113  // Delete an apnd file.
 14114  // For an appendvfs, this could mean delete the appendvfs portion,
 14115  // leaving the appendee as it was before it gained an appendvfs.
 14116  // For now, this code deletes the underlying file too.
 14117  func apndDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* appendvfs.c:574:12: */
 14118  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 28 /* &.xDelete */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, dirSync)
 14119  }
 14120  
 14121  // All other VFS methods are pass-thrus.
 14122  func apndAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* appendvfs.c:581:12: */
 14123  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 32 /* &.xAccess */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, flags, pResOut)
 14124  }
 14125  
 14126  func apndFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* appendvfs.c:589:12: */
 14127  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 36 /* &.xFullPathname */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, nOut, zOut)
 14128  }
 14129  
 14130  func apndDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* appendvfs.c:597:13: */
 14131  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 40 /* &.xDlOpen */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath)
 14132  }
 14133  
 14134  func apndDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* appendvfs.c:600:13: */
 14135  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 44 /* &.xDlError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg)
 14136  }
 14137  
 14138  func apndDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* appendvfs.c:603:13: */
 14139  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 48 /* &.xDlSym */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym)
 14140  }
 14141  
 14142  func apndDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* appendvfs.c:606:13: */
 14143  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 52 /* &.xDlClose */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle)
 14144  }
 14145  
 14146  func apndRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* appendvfs.c:609:12: */
 14147  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 56 /* &.xRandomness */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut)
 14148  }
 14149  
 14150  func apndSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* appendvfs.c:612:12: */
 14151  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 60 /* &.xSleep */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro)
 14152  }
 14153  
 14154  func apndCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* appendvfs.c:615:12: */
 14155  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 64 /* &.xCurrentTime */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pTimeOut)
 14156  }
 14157  
 14158  func apndGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* appendvfs.c:618:12: */
 14159  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 68 /* &.xGetLastError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b)
 14160  }
 14161  
 14162  func apndCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* appendvfs.c:621:12: */
 14163  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 72 /* &.xCurrentTimeInt64 */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p)
 14164  }
 14165  
 14166  func apndSetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr, pCall sqlite3_syscall_ptr) int32 { /* appendvfs.c:624:12: */
 14167  	return (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 76 /* &.xSetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName, pCall)
 14168  }
 14169  
 14170  func apndGetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) sqlite3_syscall_ptr { /* appendvfs.c:631:28: */
 14171  	return (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 80 /* &.xGetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 14172  }
 14173  
 14174  func apndNextSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) uintptr { /* appendvfs.c:637:19: */
 14175  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 84 /* &.xNextSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 14176  }
 14177  
 14178  // This routine is called when the extension is loaded.
 14179  // Register the new VFS.
 14180  func sqlite3_appendvfs_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* appendvfs.c:649:5: */
 14181  	var rc int32 = SQLITE_OK
 14182  	var pOrig uintptr
 14183  	_ = pApi
 14184  
 14185  	_ = pzErrMsg
 14186  	_ = db
 14187  	pOrig = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 14188  	if pOrig == uintptr(0) {
 14189  		return SQLITE_ERROR
 14190  	}
 14191  	apnd_vfs.FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FiVersion
 14192  	apnd_vfs.FpAppData = pOrig
 14193  	apnd_vfs.FszOsFile = (int32(uint32((*sqlite3_vfs)(unsafe.Pointer(pOrig)).FszOsFile) + uint32(unsafe.Sizeof(ApndFile{}))))
 14194  	rc = sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&apnd_vfs)), 0)
 14195  	if rc == SQLITE_OK {
 14196  		rc = (SQLITE_OK | (int32(1) << 8))
 14197  	}
 14198  	return rc
 14199  }
 14200  
 14201  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 14202  //     are already defined.
 14203  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 14204  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 14205  
 14206  // A null pointer constant.
 14207  
 14208  // XPG requires a few symbols from <sys/wait.h> being defined.
 14209  // Definitions of flag bits for `waitpid' et al.
 14210  //    Copyright (C) 1992-2018 Free Software Foundation, Inc.
 14211  //    This file is part of the GNU C Library.
 14212  //
 14213  //    The GNU C Library is free software; you can redistribute it and/or
 14214  //    modify it under the terms of the GNU Lesser General Public
 14215  //    License as published by the Free Software Foundation; either
 14216  //    version 2.1 of the License, or (at your option) any later version.
 14217  //
 14218  //    The GNU C Library is distributed in the hope that it will be useful,
 14219  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14220  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14221  //    Lesser General Public License for more details.
 14222  //
 14223  //    You should have received a copy of the GNU Lesser General Public
 14224  //    License along with the GNU C Library; if not, see
 14225  //    <http://www.gnu.org/licenses/>.
 14226  
 14227  // Bits in the third argument to `waitpid'.
 14228  
 14229  // Bits in the fourth argument to `waitid'.
 14230  
 14231  // The following values are used by the `waitid' function.
 14232  
 14233  // The Linux kernel defines these bare, rather than an enum,
 14234  //    which causes a conflict if the include order is reversed.
 14235  
 14236  type idtype_t = uint32 /* waitflags.h:57:3 */
 14237  // Definitions of status bits for `wait' et al.
 14238  //    Copyright (C) 1992-2018 Free Software Foundation, Inc.
 14239  //    This file is part of the GNU C Library.
 14240  //
 14241  //    The GNU C Library is free software; you can redistribute it and/or
 14242  //    modify it under the terms of the GNU Lesser General Public
 14243  //    License as published by the Free Software Foundation; either
 14244  //    version 2.1 of the License, or (at your option) any later version.
 14245  //
 14246  //    The GNU C Library is distributed in the hope that it will be useful,
 14247  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14248  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14249  //    Lesser General Public License for more details.
 14250  //
 14251  //    You should have received a copy of the GNU Lesser General Public
 14252  //    License along with the GNU C Library; if not, see
 14253  //    <http://www.gnu.org/licenses/>.
 14254  
 14255  // Everything extant so far uses these same bits.
 14256  
 14257  // If WIFEXITED(STATUS), the low-order 8 bits of the status.
 14258  
 14259  // If WIFSIGNALED(STATUS), the terminating signal.
 14260  
 14261  // If WIFSTOPPED(STATUS), the signal that stopped the child.
 14262  
 14263  // Nonzero if STATUS indicates normal termination.
 14264  
 14265  // Nonzero if STATUS indicates termination by a signal.
 14266  
 14267  // Nonzero if STATUS indicates the child is stopped.
 14268  
 14269  // Nonzero if STATUS indicates the child continued after a stop.  We only
 14270  //    define this if <bits/waitflags.h> provides the WCONTINUED flag bit.
 14271  
 14272  // Nonzero if STATUS indicates the child dumped core.
 14273  
 14274  // Macros for constructing status values.
 14275  
 14276  // Define the macros <sys/wait.h> also would define this way.
 14277  
 14278  // _FloatN API tests for enablement.
 14279  // Macros to control TS 18661-3 glibc features.
 14280  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 14281  //    This file is part of the GNU C Library.
 14282  //
 14283  //    The GNU C Library is free software; you can redistribute it and/or
 14284  //    modify it under the terms of the GNU Lesser General Public
 14285  //    License as published by the Free Software Foundation; either
 14286  //    version 2.1 of the License, or (at your option) any later version.
 14287  //
 14288  //    The GNU C Library is distributed in the hope that it will be useful,
 14289  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14290  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14291  //    Lesser General Public License for more details.
 14292  //
 14293  //    You should have received a copy of the GNU Lesser General Public
 14294  //    License along with the GNU C Library; if not, see
 14295  //    <http://www.gnu.org/licenses/>.
 14296  
 14297  // Defined to 1 if the current compiler invocation provides a
 14298  //    floating-point type with the IEEE 754 binary128 format, and this glibc
 14299  //    includes corresponding *f128 interfaces for it.
 14300  
 14301  // Defined to 1 if __HAVE_FLOAT128 is 1 and the type is ABI-distinct
 14302  //    from the default float, double and long double types in this glibc.
 14303  
 14304  // Defined to 1 if the current compiler invocation provides a
 14305  //    floating-point type with the right format for _Float64x, and this
 14306  //    glibc includes corresponding *f64x interfaces for it.
 14307  
 14308  // Defined to 1 if __HAVE_FLOAT64X is 1 and _Float64x has the format
 14309  //    of long double.  Otherwise, if __HAVE_FLOAT64X is 1, _Float64x has
 14310  //    the format of _Float128, which must be different from that of long
 14311  //    double.
 14312  
 14313  // Defined to concatenate the literal suffix to be used with _Float128
 14314  //    types, if __HAVE_FLOAT128 is 1.
 14315  //    E.g.: #define __f128(x) x##f128.
 14316  
 14317  // Defined to a complex binary128 type if __HAVE_FLOAT128 is 1.
 14318  //    E.g.: #define __CFLOAT128 _Complex _Float128.
 14319  
 14320  // Macros to control TS 18661-3 glibc features where the same
 14321  //    definitions are appropriate for all platforms.
 14322  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 14323  //    This file is part of the GNU C Library.
 14324  //
 14325  //    The GNU C Library is free software; you can redistribute it and/or
 14326  //    modify it under the terms of the GNU Lesser General Public
 14327  //    License as published by the Free Software Foundation; either
 14328  //    version 2.1 of the License, or (at your option) any later version.
 14329  //
 14330  //    The GNU C Library is distributed in the hope that it will be useful,
 14331  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14332  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14333  //    Lesser General Public License for more details.
 14334  //
 14335  //    You should have received a copy of the GNU Lesser General Public
 14336  //    License along with the GNU C Library; if not, see
 14337  //    <http://www.gnu.org/licenses/>.
 14338  
 14339  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 14340  //    This file is part of the GNU C Library.
 14341  //
 14342  //    The GNU C Library is free software; you can redistribute it and/or
 14343  //    modify it under the terms of the GNU Lesser General Public
 14344  //    License as published by the Free Software Foundation; either
 14345  //    version 2.1 of the License, or (at your option) any later version.
 14346  //
 14347  //    The GNU C Library is distributed in the hope that it will be useful,
 14348  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14349  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14350  //    Lesser General Public License for more details.
 14351  //
 14352  //    You should have received a copy of the GNU Lesser General Public
 14353  //    License along with the GNU C Library; if not, see
 14354  //    <http://www.gnu.org/licenses/>.
 14355  
 14356  // Properties of long double type.
 14357  //    Copyright (C) 2016-2018 Free Software Foundation, Inc.
 14358  //    This file is part of the GNU C Library.
 14359  //
 14360  //    The GNU C Library is free software; you can redistribute it and/or
 14361  //    modify it under the terms of the GNU Lesser General Public
 14362  //    License  published by the Free Software Foundation; either
 14363  //    version 2.1 of the License, or (at your option) any later version.
 14364  //
 14365  //    The GNU C Library is distributed in the hope that it will be useful,
 14366  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14367  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14368  //    Lesser General Public License for more details.
 14369  //
 14370  //    You should have received a copy of the GNU Lesser General Public
 14371  //    License along with the GNU C Library; if not, see
 14372  //    <http://www.gnu.org/licenses/>.
 14373  
 14374  // This header is included by <sys/cdefs.h>.
 14375  //
 14376  //    If long double is ABI-compatible with double, it should define
 14377  //    __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
 14378  //    __NO_LONG_DOUBLE_MATH undefined.
 14379  //
 14380  //    If this build of the GNU C Library supports both long double
 14381  //    ABI-compatible with double and some other long double format not
 14382  //    ABI-compatible with double, it should define
 14383  //    __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
 14384  //    __LONG_DOUBLE_MATH_OPTIONAL undefined.
 14385  //
 14386  //    If __NO_LONG_DOUBLE_MATH is already defined, this header must not
 14387  //    define anything; this is needed to work with the definition of
 14388  //    __NO_LONG_DOUBLE_MATH in nldbl-compat.h.
 14389  
 14390  // In the default version of this header, long double is
 14391  //    ABI-compatible with double.
 14392  
 14393  // This header should be included at the bottom of each bits/floatn.h.
 14394  //    It defines the following macros for each _FloatN and _FloatNx type,
 14395  //    where the same definitions, or definitions based only on the macros
 14396  //    in bits/floatn.h, are appropriate for all glibc configurations.
 14397  
 14398  // Defined to 1 if the current compiler invocation provides a
 14399  //    floating-point type with the right format for this type, and this
 14400  //    glibc includes corresponding *fN or *fNx interfaces for it.
 14401  
 14402  // Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
 14403  //    type is the first with its format in the sequence of (the default
 14404  //    choices for) float, double, long double, _Float16, _Float32,
 14405  //    _Float64, _Float128, _Float32x, _Float64x, _Float128x for this
 14406  //    glibc; that is, if functions present once per floating-point format
 14407  //    rather than once per type are present for this type.
 14408  //
 14409  //    All configurations supported by glibc have _Float32 the same format
 14410  //    as float, _Float64 and _Float32x the same format as double, the
 14411  //    _Float64x the same format as either long double or _Float128.  No
 14412  //    configurations support _Float128x or, as of GCC 7, have compiler
 14413  //    support for a type meeting the requirements for _Float128x.
 14414  
 14415  // Defined to 1 if the corresponding _FloatN type is not binary compatible
 14416  //    with the corresponding ISO C type in the current compilation unit as
 14417  //    opposed to __HAVE_DISTINCT_FLOATN, which indicates the default types built
 14418  //    in glibc.
 14419  
 14420  // Defined to 1 if any _FloatN or _FloatNx types that are not
 14421  //    ABI-distinct are however distinct types at the C language level (so
 14422  //    for the purposes of __builtin_types_compatible_p and _Generic).
 14423  
 14424  // Defined to concatenate the literal suffix to be used with _FloatN
 14425  //    or _FloatNx types, if __HAVE_<type> is 1.  The corresponding
 14426  //    literal suffixes exist since GCC 7, for C only.
 14427  
 14428  // Defined to a complex type if __HAVE_<type> is 1.
 14429  
 14430  // The remaining of this file provides support for older compilers.
 14431  
 14432  // If double, long double and _Float64 all have the same set of
 14433  //    values, TS 18661-3 requires the usual arithmetic conversions on
 14434  //    long double and _Float64 to produce _Float64.  For this to be the
 14435  //    case when building with a compiler without a distinct _Float64
 14436  //    type, _Float64 must be a typedef for long double, not for
 14437  //    double.
 14438  
 14439  // Returned by `div'.
 14440  type div_t = struct {
 14441  	Fquot int32
 14442  	Frem  int32
 14443  } /* stdlib.h:62:5 */
 14444  
 14445  // Returned by `ldiv'.
 14446  type ldiv_t = struct {
 14447  	Fquot int32
 14448  	Frem  int32
 14449  } /* stdlib.h:70:5 */
 14450  
 14451  // Returned by `lldiv'.
 14452  type lldiv_t = struct {
 14453  	Fquot int64
 14454  	Frem  int64
 14455  } /* stdlib.h:80:5 */
 14456  
 14457  type u_char = uint8                     /* types.h:33:18 */
 14458  type u_short = uint16                   /* types.h:34:19 */
 14459  type u_int = uint32                     /* types.h:35:17 */
 14460  type u_long = uint32                    /* types.h:36:18 */
 14461  type quad_t = int64                     /* types.h:37:18 */
 14462  type u_quad_t = uint64                  /* types.h:38:20 */
 14463  type fsid_t = struct{ F__val [2]int32 } /* types.h:39:18 */
 14464  type loff_t = int64                     /* types.h:42:18 */
 14465  
 14466  type ino_t = uint64 /* types.h:49:19 */
 14467  
 14468  type dev_t = uint64 /* types.h:59:17 */
 14469  
 14470  type gid_t = uint32 /* types.h:64:17 */
 14471  
 14472  type mode_t = uint32 /* types.h:69:18 */
 14473  
 14474  type nlink_t = uint32 /* types.h:74:19 */
 14475  
 14476  type uid_t = uint32 /* types.h:79:17 */
 14477  
 14478  type pid_t = int32 /* types.h:97:17 */
 14479  
 14480  type id_t = uint32 /* types.h:103:16 */
 14481  
 14482  type daddr_t = int32   /* types.h:114:19 */
 14483  type caddr_t = uintptr /* types.h:115:19 */
 14484  
 14485  type key_t = int32 /* types.h:121:17 */
 14486  
 14487  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14488  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14489  //    This file is part of the GNU C Library.
 14490  //
 14491  //    The GNU C Library is free software; you can redistribute it and/or
 14492  //    modify it under the terms of the GNU Lesser General Public
 14493  //    License as published by the Free Software Foundation; either
 14494  //    version 2.1 of the License, or (at your option) any later version.
 14495  //
 14496  //    The GNU C Library is distributed in the hope that it will be useful,
 14497  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14498  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14499  //    Lesser General Public License for more details.
 14500  //
 14501  //    You should have received a copy of the GNU Lesser General Public
 14502  //    License along with the GNU C Library; if not, see
 14503  //    <http://www.gnu.org/licenses/>.
 14504  
 14505  // Never include this file directly; use <sys/types.h> instead.
 14506  
 14507  // Returned by `clock'.
 14508  type clock_t = int32 /* clock_t.h:7:19 */
 14509  
 14510  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14511  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14512  //    This file is part of the GNU C Library.
 14513  //
 14514  //    The GNU C Library is free software; you can redistribute it and/or
 14515  //    modify it under the terms of the GNU Lesser General Public
 14516  //    License as published by the Free Software Foundation; either
 14517  //    version 2.1 of the License, or (at your option) any later version.
 14518  //
 14519  //    The GNU C Library is distributed in the hope that it will be useful,
 14520  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14521  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14522  //    Lesser General Public License for more details.
 14523  //
 14524  //    You should have received a copy of the GNU Lesser General Public
 14525  //    License along with the GNU C Library; if not, see
 14526  //    <http://www.gnu.org/licenses/>.
 14527  
 14528  // Never include this file directly; use <sys/types.h> instead.
 14529  
 14530  // Clock ID used in clock and timer functions.
 14531  type clockid_t = int32 /* clockid_t.h:7:21 */
 14532  
 14533  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14534  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14535  //    This file is part of the GNU C Library.
 14536  //
 14537  //    The GNU C Library is free software; you can redistribute it and/or
 14538  //    modify it under the terms of the GNU Lesser General Public
 14539  //    License as published by the Free Software Foundation; either
 14540  //    version 2.1 of the License, or (at your option) any later version.
 14541  //
 14542  //    The GNU C Library is distributed in the hope that it will be useful,
 14543  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14544  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14545  //    Lesser General Public License for more details.
 14546  //
 14547  //    You should have received a copy of the GNU Lesser General Public
 14548  //    License along with the GNU C Library; if not, see
 14549  //    <http://www.gnu.org/licenses/>.
 14550  
 14551  // Never include this file directly; use <sys/types.h> instead.
 14552  
 14553  // Returned by `time'.
 14554  type time_t = int32 /* time_t.h:7:18 */
 14555  
 14556  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14557  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14558  //    This file is part of the GNU C Library.
 14559  //
 14560  //    The GNU C Library is free software; you can redistribute it and/or
 14561  //    modify it under the terms of the GNU Lesser General Public
 14562  //    License as published by the Free Software Foundation; either
 14563  //    version 2.1 of the License, or (at your option) any later version.
 14564  //
 14565  //    The GNU C Library is distributed in the hope that it will be useful,
 14566  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14567  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14568  //    Lesser General Public License for more details.
 14569  //
 14570  //    You should have received a copy of the GNU Lesser General Public
 14571  //    License along with the GNU C Library; if not, see
 14572  //    <http://www.gnu.org/licenses/>.
 14573  
 14574  // Never include this file directly; use <sys/types.h> instead.
 14575  
 14576  // Timer ID returned by `timer_create'.
 14577  type timer_t = uintptr /* timer_t.h:7:19 */
 14578  
 14579  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 14580  //
 14581  // This file is part of GCC.
 14582  //
 14583  // GCC is free software; you can redistribute it and/or modify
 14584  // it under the terms of the GNU General Public License as published by
 14585  // the Free Software Foundation; either version 3, or (at your option)
 14586  // any later version.
 14587  //
 14588  // GCC is distributed in the hope that it will be useful,
 14589  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 14590  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 14591  // GNU General Public License for more details.
 14592  //
 14593  // Under Section 7 of GPL version 3, you are granted additional
 14594  // permissions described in the GCC Runtime Library Exception, version
 14595  // 3.1, as published by the Free Software Foundation.
 14596  //
 14597  // You should have received a copy of the GNU General Public License and
 14598  // a copy of the GCC Runtime Library Exception along with this program;
 14599  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 14600  // <http://www.gnu.org/licenses/>.
 14601  
 14602  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 14603  
 14604  // Any one of these symbols __need_* means that GNU libc
 14605  //    wants us just to define one data type.  So don't define
 14606  //    the symbols that indicate this file's entire job has been done.
 14607  
 14608  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 14609  //    There's no way to win with the other order!  Sun lossage.
 14610  
 14611  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 14612  //    one less case to deal with in the following.
 14613  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 14614  
 14615  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 14616  //    defined if the corresponding type is *not* defined.
 14617  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 14618  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 14619  
 14620  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 14621  //    Just ignore it.
 14622  
 14623  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 14624  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 14625  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 14626  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 14627  //    If we find that the macros are still defined at this point, we must
 14628  //    invoke them so that the type is defined as expected.
 14629  
 14630  // In case nobody has defined these types, but we aren't running under
 14631  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 14632  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 14633  //    parts of GCC is compiled by an older compiler, that actually
 14634  //    include gstddef.h, such as collect2.
 14635  
 14636  // Signed type of difference of two pointers.
 14637  
 14638  // Define this type if we are doing the whole job,
 14639  //    or if we want this type in particular.
 14640  
 14641  // Unsigned type of `sizeof' something.
 14642  
 14643  // Define this type if we are doing the whole job,
 14644  //    or if we want this type in particular.
 14645  
 14646  // Wide character type.
 14647  //    Locale-writers should change this as necessary to
 14648  //    be big enough to hold unique values not between 0 and 127,
 14649  //    and not (wchar_t) -1, for each defined multibyte character.
 14650  
 14651  // Define this type if we are doing the whole job,
 14652  //    or if we want this type in particular.
 14653  
 14654  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 14655  //     are already defined.
 14656  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 14657  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 14658  
 14659  // A null pointer constant.
 14660  
 14661  // Old compatibility names for C types.
 14662  type ulong = uint32  /* types.h:148:27 */
 14663  type ushort = uint16 /* types.h:149:28 */
 14664  type uint = uint32   /* types.h:150:22 */
 14665  
 14666  // These size-specific names are used by some of the inet code.
 14667  
 14668  // Define intN_t types.
 14669  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 14670  //    This file is part of the GNU C Library.
 14671  //
 14672  //    The GNU C Library is free software; you can redistribute it and/or
 14673  //    modify it under the terms of the GNU Lesser General Public
 14674  //    License as published by the Free Software Foundation; either
 14675  //    version 2.1 of the License, or (at your option) any later version.
 14676  //
 14677  //    The GNU C Library is distributed in the hope that it will be useful,
 14678  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14679  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14680  //    Lesser General Public License for more details.
 14681  //
 14682  //    You should have received a copy of the GNU Lesser General Public
 14683  //    License along with the GNU C Library; if not, see
 14684  //    <http://www.gnu.org/licenses/>.
 14685  
 14686  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14687  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14688  //    This file is part of the GNU C Library.
 14689  //
 14690  //    The GNU C Library is free software; you can redistribute it and/or
 14691  //    modify it under the terms of the GNU Lesser General Public
 14692  //    License as published by the Free Software Foundation; either
 14693  //    version 2.1 of the License, or (at your option) any later version.
 14694  //
 14695  //    The GNU C Library is distributed in the hope that it will be useful,
 14696  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14697  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14698  //    Lesser General Public License for more details.
 14699  //
 14700  //    You should have received a copy of the GNU Lesser General Public
 14701  //    License along with the GNU C Library; if not, see
 14702  //    <http://www.gnu.org/licenses/>.
 14703  
 14704  // Never include this file directly; use <sys/types.h> instead.
 14705  
 14706  type int8_t = int8   /* stdint-intn.h:24:18 */
 14707  type int16_t = int16 /* stdint-intn.h:25:19 */
 14708  type int32_t = int32 /* stdint-intn.h:26:19 */
 14709  type int64_t = int64 /* stdint-intn.h:27:19 */
 14710  
 14711  // For GCC 2.7 and later, we can use specific type-size attributes.
 14712  
 14713  type u_int8_t = uint32  /* types.h:177:1 */
 14714  type u_int16_t = uint32 /* types.h:178:1 */
 14715  type u_int32_t = uint32 /* types.h:179:1 */
 14716  type u_int64_t = uint32 /* types.h:180:1 */
 14717  
 14718  type register_t = int32 /* types.h:182:13 */
 14719  
 14720  // A set of signals to be blocked, unblocked, or waited for.
 14721  type sigset_t = struct{ F__val [32]uint32 } /* sigset_t.h:7:20 */
 14722  
 14723  // Get definition of timer specification structures.
 14724  
 14725  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14726  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14727  //    This file is part of the GNU C Library.
 14728  //
 14729  //    The GNU C Library is free software; you can redistribute it and/or
 14730  //    modify it under the terms of the GNU Lesser General Public
 14731  //    License as published by the Free Software Foundation; either
 14732  //    version 2.1 of the License, or (at your option) any later version.
 14733  //
 14734  //    The GNU C Library is distributed in the hope that it will be useful,
 14735  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14736  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14737  //    Lesser General Public License for more details.
 14738  //
 14739  //    You should have received a copy of the GNU Lesser General Public
 14740  //    License along with the GNU C Library; if not, see
 14741  //    <http://www.gnu.org/licenses/>.
 14742  
 14743  // Never include this file directly; use <sys/types.h> instead.
 14744  
 14745  // A time value that is accurate to the nearest
 14746  //    microsecond but also has a range of years.
 14747  type timeval = struct {
 14748  	Ftv_sec  int32
 14749  	Ftv_usec int32
 14750  } /* struct_timeval.h:8:1 */
 14751  
 14752  // NB: Include guard matches what <linux/time.h> uses.
 14753  
 14754  // bits/types.h -- definitions of __*_t types underlying *_t types.
 14755  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14756  //    This file is part of the GNU C Library.
 14757  //
 14758  //    The GNU C Library is free software; you can redistribute it and/or
 14759  //    modify it under the terms of the GNU Lesser General Public
 14760  //    License as published by the Free Software Foundation; either
 14761  //    version 2.1 of the License, or (at your option) any later version.
 14762  //
 14763  //    The GNU C Library is distributed in the hope that it will be useful,
 14764  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14765  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14766  //    Lesser General Public License for more details.
 14767  //
 14768  //    You should have received a copy of the GNU Lesser General Public
 14769  //    License along with the GNU C Library; if not, see
 14770  //    <http://www.gnu.org/licenses/>.
 14771  
 14772  // Never include this file directly; use <sys/types.h> instead.
 14773  
 14774  // POSIX.1b structure for a time value.  This is like a `struct timeval' but
 14775  //    has nanoseconds instead of microseconds.
 14776  type timespec = struct {
 14777  	Ftv_sec  int32
 14778  	Ftv_nsec int32
 14779  } /* struct_timespec.h:9:1 */
 14780  
 14781  type suseconds_t = int32 /* select.h:43:23 */
 14782  
 14783  // Some versions of <linux/posix_types.h> define this macros.
 14784  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 14785  
 14786  // fd_set for select and pselect.
 14787  type fd_set = struct{ F__fds_bits [32]int32 } /* select.h:70:5 */
 14788  
 14789  // Maximum number of file descriptors in `fd_set'.
 14790  
 14791  // Sometimes the fd_set member is assumed to have this type.
 14792  type fd_mask = int32 /* select.h:77:19 */
 14793  
 14794  // Define some inlines helping to catch common problems.
 14795  
 14796  type blksize_t = int32 /* types.h:202:21 */
 14797  
 14798  // Types from the Large File Support interface.
 14799  type blkcnt_t = int64    /* types.h:222:22 */ // Type to count number of disk blocks.
 14800  type fsblkcnt_t = uint64 /* types.h:226:24 */ // Type to count file system blocks.
 14801  type fsfilcnt_t = uint64 /* types.h:230:24 */ // Type to count file system inodes.
 14802  
 14803  // Now add the thread types.
 14804  // Declaration of common pthread types for all architectures.
 14805  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 14806  //    This file is part of the GNU C Library.
 14807  //
 14808  //    The GNU C Library is free software; you can redistribute it and/or
 14809  //    modify it under the terms of the GNU Lesser General Public
 14810  //    License as published by the Free Software Foundation; either
 14811  //    version 2.1 of the License, or (at your option) any later version.
 14812  //
 14813  //    The GNU C Library is distributed in the hope that it will be useful,
 14814  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14815  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14816  //    Lesser General Public License for more details.
 14817  //
 14818  //    You should have received a copy of the GNU Lesser General Public
 14819  //    License along with the GNU C Library; if not, see
 14820  //    <http://www.gnu.org/licenses/>.
 14821  
 14822  // For internal mutex and condition variable definitions.
 14823  // Common threading primitives definitions for both POSIX and C11.
 14824  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 14825  //    This file is part of the GNU C Library.
 14826  //
 14827  //    The GNU C Library is free software; you can redistribute it and/or
 14828  //    modify it under the terms of the GNU Lesser General Public
 14829  //    License as published by the Free Software Foundation; either
 14830  //    version 2.1 of the License, or (at your option) any later version.
 14831  //
 14832  //    The GNU C Library is distributed in the hope that it will be useful,
 14833  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14834  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14835  //    Lesser General Public License for more details.
 14836  //
 14837  //    You should have received a copy of the GNU Lesser General Public
 14838  //    License along with the GNU C Library; if not, see
 14839  //    <http://www.gnu.org/licenses/>.
 14840  
 14841  // Arch-specific definitions.  Each architecture must define the following
 14842  //    macros to define the expected sizes of pthread data types:
 14843  //
 14844  //    __SIZEOF_PTHREAD_ATTR_T        - size of pthread_attr_t.
 14845  //    __SIZEOF_PTHREAD_MUTEX_T       - size of pthread_mutex_t.
 14846  //    __SIZEOF_PTHREAD_MUTEXATTR_T   - size of pthread_mutexattr_t.
 14847  //    __SIZEOF_PTHREAD_COND_T        - size of pthread_cond_t.
 14848  //    __SIZEOF_PTHREAD_CONDATTR_T    - size of pthread_condattr_t.
 14849  //    __SIZEOF_PTHREAD_RWLOCK_T      - size of pthread_rwlock_t.
 14850  //    __SIZEOF_PTHREAD_RWLOCKATTR_T  - size of pthread_rwlockattr_t.
 14851  //    __SIZEOF_PTHREAD_BARRIER_T     - size of pthread_barrier_t.
 14852  //    __SIZEOF_PTHREAD_BARRIERATTR_T - size of pthread_barrierattr_t.
 14853  //
 14854  //    Also, the following macros must be define for internal pthread_mutex_t
 14855  //    struct definitions (struct __pthread_mutex_s):
 14856  //
 14857  //    __PTHREAD_COMPAT_PADDING_MID   - any additional members after 'kind'
 14858  // 				    and before '__spin' (for 64 bits) or
 14859  // 				    '__nusers' (for 32 bits).
 14860  //    __PTHREAD_COMPAT_PADDING_END   - any additional members at the end of
 14861  // 				    the internal structure.
 14862  //    __PTHREAD_MUTEX_LOCK_ELISION   - 1 if the architecture supports lock
 14863  // 				    elision or 0 otherwise.
 14864  //    __PTHREAD_MUTEX_NUSERS_AFTER_KIND - control where to put __nusers.  The
 14865  // 				       preferred value for new architectures
 14866  // 				       is 0.
 14867  //    __PTHREAD_MUTEX_USE_UNION      - control whether internal __spins and
 14868  // 				    __list will be place inside a union for
 14869  // 				    linuxthreads compatibility.
 14870  // 				    The preferred value for new architectures
 14871  // 				    is 0.
 14872  //
 14873  //    For a new port the preferred values for the required defines are:
 14874  //
 14875  //    #define __PTHREAD_COMPAT_PADDING_MID
 14876  //    #define __PTHREAD_COMPAT_PADDING_END
 14877  //    #define __PTHREAD_MUTEX_LOCK_ELISION         0
 14878  //    #define __PTHREAD_MUTEX_NUSERS_AFTER_KIND    0
 14879  //    #define __PTHREAD_MUTEX_USE_UNION            0
 14880  //
 14881  //    __PTHREAD_MUTEX_LOCK_ELISION can be set to 1 if the hardware plans to
 14882  //    eventually support lock elision using transactional memory.
 14883  //
 14884  //    The additional macro defines any constraint for the lock alignment
 14885  //    inside the thread structures:
 14886  //
 14887  //    __LOCK_ALIGNMENT - for internal lock/futex usage.
 14888  //
 14889  //    Same idea but for the once locking primitive:
 14890  //
 14891  //    __ONCE_ALIGNMENT - for pthread_once_t/once_flag definition.
 14892  //
 14893  //    And finally the internal pthread_rwlock_t (struct __pthread_rwlock_arch_t)
 14894  //    must be defined.
 14895  //
 14896  // Copyright (C) 2002-2018 Free Software Foundation, Inc.
 14897  //    This file is part of the GNU C Library.
 14898  //
 14899  //    The GNU C Library is free software; you can redistribute it and/or
 14900  //    modify it under the terms of the GNU Lesser General Public
 14901  //    License as published by the Free Software Foundation; either
 14902  //    version 2.1 of the License, or (at your option) any later version.
 14903  //
 14904  //    The GNU C Library is distributed in the hope that it will be useful,
 14905  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14906  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14907  //    Lesser General Public License for more details.
 14908  //
 14909  //    You should have received a copy of the GNU Lesser General Public
 14910  //    License along with the GNU C Library.  If not, see
 14911  //    <http://www.gnu.org/licenses/>.
 14912  
 14913  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
 14914  //    This file is part of the GNU C Library.
 14915  //
 14916  //    The GNU C Library is free software; you can redistribute it and/or
 14917  //    modify it under the terms of the GNU Lesser General Public
 14918  //    License as published by the Free Software Foundation; either
 14919  //    version 2.1 of the License, or (at your option) any later version.
 14920  //
 14921  //    The GNU C Library is distributed in the hope that it will be useful,
 14922  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 14923  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14924  //    Lesser General Public License for more details.
 14925  //
 14926  //    You should have received a copy of the GNU Lesser General Public
 14927  //    License along with the GNU C Library; if not, see
 14928  //    <http://www.gnu.org/licenses/>.
 14929  
 14930  // Data structure for mutex handling.
 14931  
 14932  type __pthread_rwlock_arch_t = struct {
 14933  	F__readers       uint32
 14934  	F__writers       uint32
 14935  	F__wrphase_futex uint32
 14936  	F__writers_futex uint32
 14937  	F__pad3          uint32
 14938  	F__pad4          uint32
 14939  	F__flags         uint8
 14940  	F__shared        uint8
 14941  	F__pad1          uint8
 14942  	F__pad2          uint8
 14943  	F__cur_writer    int32
 14944  } /* pthreadtypes-arch.h:43:1 */
 14945  
 14946  // Common definition of pthread_mutex_t.
 14947  
 14948  type __pthread_internal_slist = struct{ F__next uintptr } /* thread-shared-types.h:88:9 */
 14949  
 14950  // Lock elision support.
 14951  // Mutex __spins initializer used by PTHREAD_MUTEX_INITIALIZER.
 14952  
 14953  type __pthread_mutex_s = struct {
 14954  	F__lock   int32
 14955  	F__count  uint32
 14956  	F__owner  int32
 14957  	F__kind   int32
 14958  	F__nusers uint32
 14959  	F__20     struct{ F__spins int32 }
 14960  } /* thread-shared-types.h:118:1 */
 14961  
 14962  // Common definition of pthread_cond_t.
 14963  
 14964  type __pthread_cond_s = struct {
 14965  	F__0            struct{ F__wseq uint64 }
 14966  	F__8            struct{ F__g1_start uint64 }
 14967  	F__g_refs       [2]uint32
 14968  	F__g_size       [2]uint32
 14969  	F__g1_orig_size uint32
 14970  	F__wrefs        uint32
 14971  	F__g_signals    [2]uint32
 14972  } /* thread-shared-types.h:171:1 */
 14973  
 14974  // Thread identifiers.  The structure of the attribute type is not
 14975  //    exposed on purpose.
 14976  type pthread_t = uint32 /* pthreadtypes.h:27:27 */
 14977  
 14978  // Data structures for mutex handling.  The structure of the attribute
 14979  //    type is not exposed on purpose.
 14980  type pthread_mutexattr_t = struct {
 14981  	_       [0]uint32
 14982  	F__size [4]int8
 14983  } /* pthreadtypes.h:36:3 */
 14984  
 14985  // Data structure for condition variable handling.  The structure of
 14986  //    the attribute type is not exposed on purpose.
 14987  type pthread_condattr_t = struct {
 14988  	_       [0]uint32
 14989  	F__size [4]int8
 14990  } /* pthreadtypes.h:45:3 */
 14991  
 14992  // Keys for thread-specific data
 14993  type pthread_key_t = uint32 /* pthreadtypes.h:49:22 */
 14994  
 14995  // Once-only execution
 14996  type pthread_once_t = int32 /* pthreadtypes.h:53:30 */
 14997  
 14998  type pthread_attr_t1 = struct {
 14999  	_       [0]uint32
 15000  	F__size [36]int8
 15001  } /* pthreadtypes.h:56:1 */
 15002  
 15003  type pthread_attr_t = pthread_attr_t1 /* pthreadtypes.h:62:30 */
 15004  
 15005  type pthread_mutex_t = struct{ F__data __pthread_mutex_s } /* pthreadtypes.h:72:3 */
 15006  
 15007  type pthread_cond_t = struct{ F__data __pthread_cond_s } /* pthreadtypes.h:80:3 */
 15008  
 15009  // Data structure for reader-writer lock variable handling.  The
 15010  //    structure of the attribute type is deliberately not exposed.
 15011  type pthread_rwlock_t = struct{ F__data __pthread_rwlock_arch_t } /* pthreadtypes.h:91:3 */
 15012  
 15013  type pthread_rwlockattr_t = struct {
 15014  	_       [0]uint32
 15015  	F__size [8]int8
 15016  } /* pthreadtypes.h:97:3 */
 15017  
 15018  // POSIX spinlock data type.
 15019  type pthread_spinlock_t = int32 /* pthreadtypes.h:103:22 */
 15020  
 15021  // POSIX barriers data type.  The structure of the type is
 15022  //    deliberately not exposed.
 15023  type pthread_barrier_t = struct {
 15024  	_       [0]uint32
 15025  	F__size [20]int8
 15026  } /* pthreadtypes.h:112:3 */
 15027  
 15028  type pthread_barrierattr_t = struct {
 15029  	_       [0]uint32
 15030  	F__size [4]int8
 15031  } /* pthreadtypes.h:118:3 */
 15032  
 15033  // Reentrant versions of the `random' family of functions.
 15034  //    These functions all use the following data structure to contain
 15035  //    state, rather than global state variables.
 15036  
 15037  type random_data = struct {
 15038  	Ffptr      uintptr
 15039  	Frptr      uintptr
 15040  	Fstate     uintptr
 15041  	Frand_type int32
 15042  	Frand_deg  int32
 15043  	Frand_sep  int32
 15044  	Fend_ptr   uintptr
 15045  } /* stdlib.h:423:1 */
 15046  
 15047  // Data structure for communication with thread safe versions.  This
 15048  //    type is to be regarded as opaque.  It's only exported because users
 15049  //    have to allocate objects of this type.
 15050  type drand48_data = struct {
 15051  	F__x     [3]uint16
 15052  	F__old_x [3]uint16
 15053  	F__c     uint16
 15054  	F__init  uint16
 15055  	F__a     uint64
 15056  } /* stdlib.h:490:1 */
 15057  
 15058  // Forward declaration of objects used by this implementation
 15059  type amatch_vtab1 = struct {
 15060  	Fbase       sqlite3_vtab
 15061  	FzClassName uintptr
 15062  	FzDb        uintptr
 15063  	FzSelf      uintptr
 15064  	FzCostTab   uintptr
 15065  	FzVocabTab  uintptr
 15066  	FzVocabWord uintptr
 15067  	FzVocabLang uintptr
 15068  	FpRule      uintptr
 15069  	FrIns       amatch_cost
 15070  	FrDel       amatch_cost
 15071  	FrSub       amatch_cost
 15072  	Fdb         uintptr
 15073  	FpVCheck    uintptr
 15074  	FnCursor    int32
 15075  } /* amatch.c:172:9 */
 15076  
 15077  // Forward declaration of objects used by this implementation
 15078  type amatch_vtab = amatch_vtab1 /* amatch.c:172:28 */
 15079  type amatch_cursor1 = struct {
 15080  	Fbase      sqlite3_vtab_cursor
 15081  	_          [4]byte
 15082  	FiRowid    sqlite3_int64
 15083  	FiLang     amatch_langid
 15084  	FrLimit    amatch_cost
 15085  	FnBuf      int32
 15086  	FoomErr    int32
 15087  	FnWord     int32
 15088  	FzBuf      uintptr
 15089  	FzInput    uintptr
 15090  	FpVtab     uintptr
 15091  	FpAllWords uintptr
 15092  	FpCurrent  uintptr
 15093  	FpCost     uintptr
 15094  	FpWord     uintptr
 15095  } /* amatch.c:173:9 */
 15096  
 15097  type amatch_cursor = amatch_cursor1 /* amatch.c:173:30 */
 15098  type amatch_rule1 = struct {
 15099  	FpNext uintptr
 15100  	FzFrom uintptr
 15101  	FrCost amatch_cost
 15102  	FiLang amatch_langid
 15103  	FnFrom amatch_len
 15104  	FnTo   amatch_len
 15105  	FzTo   [4]int8
 15106  	_      [2]byte
 15107  } /* amatch.c:172:9 */
 15108  
 15109  type amatch_rule = amatch_rule1 /* amatch.c:174:28 */
 15110  type amatch_word1 = struct {
 15111  	FpNext  uintptr
 15112  	FsCost  amatch_avl
 15113  	FsWord  amatch_avl
 15114  	FrCost  amatch_cost
 15115  	FiSeq   int32
 15116  	FzCost  [10]int8
 15117  	FnMatch int16
 15118  	FzWord  [4]int8
 15119  } /* amatch.c:173:9 */
 15120  
 15121  type amatch_word = amatch_word1 /* amatch.c:175:28 */
 15122  type amatch_avl1 = struct {
 15123  	FpWord     uintptr
 15124  	FzKey      uintptr
 15125  	FpBefore   uintptr
 15126  	FpAfter    uintptr
 15127  	FpUp       uintptr
 15128  	Fheight    int16
 15129  	Fimbalance int16
 15130  } /* amatch.c:173:9 */
 15131  
 15132  type amatch_avl = amatch_avl1 /* amatch.c:176:27 */
 15133  
 15134  // Recompute the amatch_avl.height and amatch_avl.imbalance fields for p.
 15135  // Assume that the children of p have correct heights.
 15136  func amatchAvlRecomputeHeight(tls *libc.TLS, p uintptr) { /* amatch.c:199:13: */
 15137  	var hBefore int16
 15138  	if (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 15139  		hBefore = (*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(p)).FpBefore)).Fheight
 15140  	} else {
 15141  		hBefore = int16(0)
 15142  	}
 15143  	var hAfter int16
 15144  	if (*amatch_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 15145  		hAfter = (*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(p)).FpAfter)).Fheight
 15146  	} else {
 15147  		hAfter = int16(0)
 15148  	}
 15149  	(*amatch_avl)(unsafe.Pointer(p)).Fimbalance = (int16(int32(hBefore) - int32(hAfter))) // -: pAfter higher.  +: pBefore higher
 15150  	(*amatch_avl)(unsafe.Pointer(p)).Fheight = (int16((func() int32 {
 15151  		if int32(hBefore) > int32(hAfter) {
 15152  			return int32(hBefore)
 15153  		}
 15154  		return int32(hAfter)
 15155  	}()) + 1))
 15156  }
 15157  
 15158  //     P                B
 15159  //    / \              / **   B   Z    ==>     X   P
 15160  //  / \                  / ** X   Y                Y   Z
 15161  //
 15162  func amatchAvlRotateBefore(tls *libc.TLS, pP uintptr) uintptr { /* amatch.c:214:19: */
 15163  	var pB uintptr = (*amatch_avl)(unsafe.Pointer(pP)).FpBefore
 15164  	var pY uintptr = (*amatch_avl)(unsafe.Pointer(pB)).FpAfter
 15165  	(*amatch_avl)(unsafe.Pointer(pB)).FpUp = (*amatch_avl)(unsafe.Pointer(pP)).FpUp
 15166  	(*amatch_avl)(unsafe.Pointer(pB)).FpAfter = pP
 15167  	(*amatch_avl)(unsafe.Pointer(pP)).FpUp = pB
 15168  	(*amatch_avl)(unsafe.Pointer(pP)).FpBefore = pY
 15169  	if pY != 0 {
 15170  		(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pP
 15171  	}
 15172  	amatchAvlRecomputeHeight(tls, pP)
 15173  	amatchAvlRecomputeHeight(tls, pB)
 15174  	return pB
 15175  }
 15176  
 15177  //     P                A
 15178  //    / \              / **   X   A    ==>     P   Z
 15179  //      / \          / **     Y   Z        X   Y
 15180  //
 15181  func amatchAvlRotateAfter(tls *libc.TLS, pP uintptr) uintptr { /* amatch.c:235:19: */
 15182  	var pA uintptr = (*amatch_avl)(unsafe.Pointer(pP)).FpAfter
 15183  	var pY uintptr = (*amatch_avl)(unsafe.Pointer(pA)).FpBefore
 15184  	(*amatch_avl)(unsafe.Pointer(pA)).FpUp = (*amatch_avl)(unsafe.Pointer(pP)).FpUp
 15185  	(*amatch_avl)(unsafe.Pointer(pA)).FpBefore = pP
 15186  	(*amatch_avl)(unsafe.Pointer(pP)).FpUp = pA
 15187  	(*amatch_avl)(unsafe.Pointer(pP)).FpAfter = pY
 15188  	if pY != 0 {
 15189  		(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pP
 15190  	}
 15191  	amatchAvlRecomputeHeight(tls, pP)
 15192  	amatchAvlRecomputeHeight(tls, pA)
 15193  	return pA
 15194  }
 15195  
 15196  // Return a pointer to the pBefore or pAfter pointer in the parent
 15197  // of p that points to p.  Or if p is the root node, return pp.
 15198  func amatchAvlFromPtr(tls *libc.TLS, p uintptr, pp uintptr) uintptr { /* amatch.c:252:19: */
 15199  	var pUp uintptr = (*amatch_avl)(unsafe.Pointer(p)).FpUp
 15200  	if pUp == uintptr(0) {
 15201  		return pp
 15202  	}
 15203  	if (*amatch_avl)(unsafe.Pointer(pUp)).FpAfter == p {
 15204  		return (pUp + 12 /* &.pAfter */)
 15205  	}
 15206  	return (pUp + 8 /* &.pBefore */)
 15207  }
 15208  
 15209  // Rebalance all nodes starting with p and working up to the root.
 15210  // Return the new root.
 15211  func amatchAvlBalance(tls *libc.TLS, p uintptr) uintptr { /* amatch.c:263:19: */
 15212  	bp := tls.Alloc(4)
 15213  	defer tls.Free(4)
 15214  	*(*uintptr)(unsafe.Pointer(bp)) = p
 15215  
 15216  	var pTop uintptr = *(*uintptr)(unsafe.Pointer(bp /* p */))
 15217  	var pp uintptr
 15218  	for *(*uintptr)(unsafe.Pointer(bp /* p */)) != 0 {
 15219  		amatchAvlRecomputeHeight(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)))
 15220  		if int32((*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) >= 2 {
 15221  			var pB uintptr = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore
 15222  			if int32((*amatch_avl)(unsafe.Pointer(pB)).Fimbalance) < 0 {
 15223  				(*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore = amatchAvlRotateAfter(tls, pB)
 15224  			}
 15225  			pp = amatchAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 15226  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, amatchAvlRotateBefore(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 15227  		} else if int32((*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) <= (-2) {
 15228  			var pA uintptr = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter
 15229  			if int32((*amatch_avl)(unsafe.Pointer(pA)).Fimbalance) > 0 {
 15230  				(*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter = amatchAvlRotateBefore(tls, pA)
 15231  			}
 15232  			pp = amatchAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 15233  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, amatchAvlRotateAfter(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 15234  		}
 15235  		pTop = *(*uintptr)(unsafe.Pointer(bp /* p */))
 15236  		*(*uintptr)(unsafe.Pointer(bp /* p */)) = (*amatch_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpUp
 15237  	}
 15238  	return pTop
 15239  }
 15240  
 15241  // Search the tree rooted at p for an entry with zKey.  Return a pointer
 15242  // to the entry or return NULL.
 15243  func amatchAvlSearch(tls *libc.TLS, p uintptr, zKey uintptr) uintptr { /* amatch.c:288:19: */
 15244  	var c int32
 15245  	for (p != 0) && ((libc.AssignInt32(&c, libc.Xstrcmp(tls, zKey, (*amatch_avl)(unsafe.Pointer(p)).FzKey))) != 0) {
 15246  		if c < 0 {
 15247  			p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 15248  		} else {
 15249  			p = (*amatch_avl)(unsafe.Pointer(p)).FpAfter
 15250  		}
 15251  	}
 15252  	return p
 15253  }
 15254  
 15255  // Find the first node (the one with the smallest key).
 15256  func amatchAvlFirst(tls *libc.TLS, p uintptr) uintptr { /* amatch.c:298:19: */
 15257  	if p != 0 {
 15258  		for (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 15259  			p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 15260  		}
 15261  	}
 15262  	return p
 15263  }
 15264  
 15265  // Insert a new node pNew.  Return NULL on success.  If the key is not
 15266  // unique, then do not perform the insert but instead leave pNew unchanged
 15267  // and return a pointer to an existing node with the same key.
 15268  func amatchAvlInsert(tls *libc.TLS, ppHead uintptr, pNew uintptr) uintptr { /* amatch.c:356:19: */
 15269  	var c int32
 15270  	var p uintptr = *(*uintptr)(unsafe.Pointer(ppHead))
 15271  	if p == uintptr(0) {
 15272  		p = pNew
 15273  		(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = uintptr(0)
 15274  	} else {
 15275  		for p != 0 {
 15276  			c = libc.Xstrcmp(tls, (*amatch_avl)(unsafe.Pointer(pNew)).FzKey, (*amatch_avl)(unsafe.Pointer(p)).FzKey)
 15277  			if c < 0 {
 15278  				if (*amatch_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 15279  					p = (*amatch_avl)(unsafe.Pointer(p)).FpBefore
 15280  				} else {
 15281  					(*amatch_avl)(unsafe.Pointer(p)).FpBefore = pNew
 15282  					(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = p
 15283  					break
 15284  				}
 15285  			} else if c > 0 {
 15286  				if (*amatch_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 15287  					p = (*amatch_avl)(unsafe.Pointer(p)).FpAfter
 15288  				} else {
 15289  					(*amatch_avl)(unsafe.Pointer(p)).FpAfter = pNew
 15290  					(*amatch_avl)(unsafe.Pointer(pNew)).FpUp = p
 15291  					break
 15292  				}
 15293  			} else {
 15294  				return p
 15295  			}
 15296  		}
 15297  	}
 15298  	(*amatch_avl)(unsafe.Pointer(pNew)).FpBefore = uintptr(0)
 15299  	(*amatch_avl)(unsafe.Pointer(pNew)).FpAfter = uintptr(0)
 15300  	(*amatch_avl)(unsafe.Pointer(pNew)).Fheight = int16(1)
 15301  	(*amatch_avl)(unsafe.Pointer(pNew)).Fimbalance = int16(0)
 15302  	*(*uintptr)(unsafe.Pointer(ppHead)) = amatchAvlBalance(tls, p)
 15303  	// assert( amatchAvlIntegrity(*ppHead) );
 15304  	// assert( amatchAvlIntegrity2(*ppHead) );
 15305  	return uintptr(0)
 15306  }
 15307  
 15308  // Remove node pOld from the tree.  pOld must be an element of the tree or
 15309  // the AVL tree will become corrupt.
 15310  func amatchAvlRemove(tls *libc.TLS, ppHead uintptr, pOld uintptr) { /* amatch.c:399:13: */
 15311  	var ppParent uintptr
 15312  	var pBalance uintptr = uintptr(0)
 15313  	// assert( amatchAvlSearch(*ppHead, pOld->zKey)==pOld );
 15314  	ppParent = amatchAvlFromPtr(tls, pOld, ppHead)
 15315  	if ((*amatch_avl)(unsafe.Pointer(pOld)).FpBefore == uintptr(0)) && ((*amatch_avl)(unsafe.Pointer(pOld)).FpAfter == uintptr(0)) {
 15316  		*(*uintptr)(unsafe.Pointer(ppParent)) = uintptr(0)
 15317  		pBalance = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 15318  	} else if ((*amatch_avl)(unsafe.Pointer(pOld)).FpBefore != 0) && ((*amatch_avl)(unsafe.Pointer(pOld)).FpAfter != 0) {
 15319  		var pX uintptr
 15320  		var pY uintptr
 15321  		pX = amatchAvlFirst(tls, (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter)
 15322  		*(*uintptr)(unsafe.Pointer(amatchAvlFromPtr(tls, pX, uintptr(0)))) = (*amatch_avl)(unsafe.Pointer(pX)).FpAfter
 15323  		if (*amatch_avl)(unsafe.Pointer(pX)).FpAfter != 0 {
 15324  			(*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(pX)).FpAfter)).FpUp = (*amatch_avl)(unsafe.Pointer(pX)).FpUp
 15325  		}
 15326  		pBalance = (*amatch_avl)(unsafe.Pointer(pX)).FpUp
 15327  		(*amatch_avl)(unsafe.Pointer(pX)).FpAfter = (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter
 15328  		if (*amatch_avl)(unsafe.Pointer(pX)).FpAfter != 0 {
 15329  			(*amatch_avl)(unsafe.Pointer((*amatch_avl)(unsafe.Pointer(pX)).FpAfter)).FpUp = pX
 15330  		} else {
 15331  
 15332  			pBalance = pX
 15333  		}
 15334  		(*amatch_avl)(unsafe.Pointer(pX)).FpBefore = libc.AssignUintptr(&pY, (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore)
 15335  		if pY != 0 {
 15336  			(*amatch_avl)(unsafe.Pointer(pY)).FpUp = pX
 15337  		}
 15338  		(*amatch_avl)(unsafe.Pointer(pX)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 15339  		*(*uintptr)(unsafe.Pointer(ppParent)) = pX
 15340  	} else if (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore == uintptr(0) {
 15341  		*(*uintptr)(unsafe.Pointer(ppParent)) = libc.AssignUintptr(&pBalance, (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter)
 15342  		(*amatch_avl)(unsafe.Pointer(pBalance)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 15343  	} else if (*amatch_avl)(unsafe.Pointer(pOld)).FpAfter == uintptr(0) {
 15344  		*(*uintptr)(unsafe.Pointer(ppParent)) = libc.AssignUintptr(&pBalance, (*amatch_avl)(unsafe.Pointer(pOld)).FpBefore)
 15345  		(*amatch_avl)(unsafe.Pointer(pBalance)).FpUp = (*amatch_avl)(unsafe.Pointer(pOld)).FpUp
 15346  	}
 15347  	*(*uintptr)(unsafe.Pointer(ppHead)) = amatchAvlBalance(tls, pBalance)
 15348  	(*amatch_avl)(unsafe.Pointer(pOld)).FpUp = uintptr(0)
 15349  	(*amatch_avl)(unsafe.Pointer(pOld)).FpBefore = uintptr(0)
 15350  	(*amatch_avl)(unsafe.Pointer(pOld)).FpAfter = uintptr(0)
 15351  	// assert( amatchAvlIntegrity(*ppHead) );
 15352  	// assert( amatchAvlIntegrity2(*ppHead) );
 15353  }
 15354  
 15355  //
 15356  // End of the AVL Tree implementation
 15357  //
 15358  
 15359  // Various types.
 15360  //
 15361  // amatch_cost is the "cost" of an edit operation.
 15362  //
 15363  // amatch_len is the length of a matching string.
 15364  //
 15365  // amatch_langid is an ruleset identifier.
 15366  type amatch_cost = int32   /* amatch.c:452:13 */
 15367  type amatch_len = int8     /* amatch.c:453:21 */
 15368  type amatch_langid = int32 /* amatch.c:454:13 */
 15369  
 15370  // The two input rule lists are both sorted in order of increasing
 15371  // cost.  Merge them together into a single list, sorted by cost, and
 15372  // return a pointer to the head of that list.
 15373  func amatchMergeRules(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* amatch.c:534:20: */
 15374  	bp := tls.Alloc(24)
 15375  	defer tls.Free(24)
 15376  
 15377  	// var head amatch_rule at bp, 24
 15378  
 15379  	var pTail uintptr
 15380  
 15381  	pTail = bp /* &head */
 15382  	for (pA != 0) && (pB != 0) {
 15383  		if (*amatch_rule)(unsafe.Pointer(pA)).FrCost <= (*amatch_rule)(unsafe.Pointer(pB)).FrCost {
 15384  			(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pA
 15385  			pTail = pA
 15386  			pA = (*amatch_rule)(unsafe.Pointer(pA)).FpNext
 15387  		} else {
 15388  			(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pB
 15389  			pTail = pB
 15390  			pB = (*amatch_rule)(unsafe.Pointer(pB)).FpNext
 15391  		}
 15392  	}
 15393  	if pA == uintptr(0) {
 15394  		(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pB
 15395  	} else {
 15396  		(*amatch_rule)(unsafe.Pointer(pTail)).FpNext = pA
 15397  	}
 15398  	return (*amatch_rule)(unsafe.Pointer(bp /* &head */)).FpNext
 15399  }
 15400  
 15401  // Statement pStmt currently points to a row in the amatch data table. This
 15402  // function allocates and populates a amatch_rule structure according to
 15403  // the content of the row.
 15404  //
 15405  // If successful, *ppRule is set to point to the new object and SQLITE_OK
 15406  // is returned. Otherwise, *ppRule is zeroed, *pzErr may be set to point
 15407  // to an error message and an SQLite error code returned.
 15408  func amatchLoadOneRule(tls *libc.TLS, p uintptr, pStmt uintptr, ppRule uintptr, pzErr uintptr) int32 { /* amatch.c:567:12: */
 15409  	bp := tls.Alloc(48)
 15410  	defer tls.Free(48)
 15411  
 15412  	var iLang sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 15413  	var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 15414  	var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 2)
 15415  	var rCost amatch_cost = sqlite3.Xsqlite3_column_int(tls, pStmt, 3)
 15416  
 15417  	var rc int32 = SQLITE_OK       // Return code
 15418  	var nFrom int32                // Size of string zFrom, in bytes
 15419  	var nTo int32                  // Size of string zTo, in bytes
 15420  	var pRule uintptr = uintptr(0) // New rule object to return
 15421  
 15422  	if zFrom == uintptr(0) {
 15423  		zFrom = ts + 489 /* "" */
 15424  	}
 15425  	if zTo == uintptr(0) {
 15426  		zTo = ts + 489 /* "" */
 15427  	}
 15428  	nFrom = int32(libc.Xstrlen(tls, zFrom))
 15429  	nTo = int32(libc.Xstrlen(tls, zTo))
 15430  
 15431  	// Silently ignore null transformations
 15432  	if libc.Xstrcmp(tls, zFrom, zTo) == 0 {
 15433  		if (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?') && (int32(*(*int8)(unsafe.Pointer(zFrom + 1))) == 0) {
 15434  			if ((*amatch_vtab)(unsafe.Pointer(p)).FrSub == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrSub > rCost) {
 15435  				(*amatch_vtab)(unsafe.Pointer(p)).FrSub = rCost
 15436  			}
 15437  		}
 15438  		*(*uintptr)(unsafe.Pointer(ppRule)) = uintptr(0)
 15439  		return SQLITE_OK
 15440  	}
 15441  
 15442  	if (rCost <= 0) || (rCost > AMATCH_MX_COST) {
 15443  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3165, /* "%s: cost must be..." */
 15444  			libc.VaList(bp, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_COST))
 15445  		rc = SQLITE_ERROR
 15446  	} else if (nFrom > AMATCH_MX_LENGTH) || (nTo > AMATCH_MX_LENGTH) {
 15447  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3199, /* "%s: maximum stri..." */
 15448  			libc.VaList(bp+16, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_LENGTH))
 15449  		rc = SQLITE_ERROR
 15450  	} else if (iLang < int64(0)) || (iLang > int64(AMATCH_MX_LANGID)) {
 15451  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3231, /* "%s: iLang must b..." */
 15452  			libc.VaList(bp+32, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName, AMATCH_MX_LANGID))
 15453  		rc = SQLITE_ERROR
 15454  	} else if (libc.Xstrcmp(tls, zFrom, ts+489 /* "" */) == 0) && (libc.Xstrcmp(tls, zTo, ts+3266 /* "?" */) == 0) {
 15455  		if ((*amatch_vtab)(unsafe.Pointer(p)).FrIns == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrIns > rCost) {
 15456  			(*amatch_vtab)(unsafe.Pointer(p)).FrIns = rCost
 15457  		}
 15458  	} else if (libc.Xstrcmp(tls, zFrom, ts+3266 /* "?" */) == 0) && (libc.Xstrcmp(tls, zTo, ts+489 /* "" */) == 0) {
 15459  		if ((*amatch_vtab)(unsafe.Pointer(p)).FrDel == 0) || ((*amatch_vtab)(unsafe.Pointer(p)).FrDel > rCost) {
 15460  			(*amatch_vtab)(unsafe.Pointer(p)).FrDel = rCost
 15461  		}
 15462  	} else {
 15463  		pRule = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(amatch_rule{})) + uint32(nFrom)) + uint32(nTo))))
 15464  		if pRule == uintptr(0) {
 15465  			rc = SQLITE_NOMEM
 15466  		} else {
 15467  			libc.Xmemset(tls, pRule, 0, uint32(unsafe.Sizeof(amatch_rule{})))
 15468  			(*amatch_rule)(unsafe.Pointer(pRule)).FzFrom = ((pRule + 18 /* &.zTo */) + uintptr((nTo + 1)))
 15469  			(*amatch_rule)(unsafe.Pointer(pRule)).FnFrom = amatch_len(nFrom)
 15470  			libc.Xmemcpy(tls, (*amatch_rule)(unsafe.Pointer(pRule)).FzFrom, zFrom, (uint32(nFrom + 1)))
 15471  			libc.Xmemcpy(tls, pRule+18 /* &.zTo */, zTo, (uint32(nTo + 1)))
 15472  			(*amatch_rule)(unsafe.Pointer(pRule)).FnTo = amatch_len(nTo)
 15473  			(*amatch_rule)(unsafe.Pointer(pRule)).FrCost = rCost
 15474  			(*amatch_rule)(unsafe.Pointer(pRule)).FiLang = int32(iLang)
 15475  		}
 15476  	}
 15477  
 15478  	*(*uintptr)(unsafe.Pointer(ppRule)) = pRule
 15479  	return rc
 15480  }
 15481  
 15482  // Free all the content in the edit-cost-table
 15483  func amatchFreeRules(tls *libc.TLS, p uintptr) { /* amatch.c:644:13: */
 15484  	for (*amatch_vtab)(unsafe.Pointer(p)).FpRule != 0 {
 15485  		var pRule uintptr = (*amatch_vtab)(unsafe.Pointer(p)).FpRule
 15486  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = (*amatch_rule)(unsafe.Pointer(pRule)).FpNext
 15487  		sqlite3.Xsqlite3_free(tls, pRule)
 15488  	}
 15489  	(*amatch_vtab)(unsafe.Pointer(p)).FpRule = uintptr(0)
 15490  }
 15491  
 15492  // Load the content of the amatch data table into memory.
 15493  func amatchLoadRules(tls *libc.TLS, db uintptr, p uintptr, pzErr uintptr) int32 { /* amatch.c:656:12: */
 15494  	bp := tls.Alloc(124)
 15495  	defer tls.Free(124)
 15496  
 15497  	var rc int32 = SQLITE_OK // Return code
 15498  	var zSql uintptr         // SELECT used to read from rules table
 15499  	var pHead uintptr = uintptr(0)
 15500  
 15501  	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))
 15502  	if zSql == uintptr(0) {
 15503  		rc = SQLITE_NOMEM
 15504  	} else {
 15505  		var rc2 int32 // finalize() return code
 15506  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0)
 15507  		rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+56 /* &pStmt */, uintptr(0))
 15508  		if rc != SQLITE_OK {
 15509  			*(*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)))
 15510  		} else if sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != 4 {
 15511  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3295, /* "%s: %s has %d co..." */
 15512  				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 */)))))
 15513  			rc = SQLITE_ERROR
 15514  		} else {
 15515  			for (rc == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))) {
 15516  				*(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)) = uintptr(0)
 15517  				rc = amatchLoadOneRule(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), bp+60 /* &pRule */, pzErr)
 15518  				if *(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)) != 0 {
 15519  					(*amatch_rule)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)))).FpNext = pHead
 15520  					pHead = *(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */))
 15521  				}
 15522  			}
 15523  		}
 15524  		rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 15525  		if rc == SQLITE_OK {
 15526  			rc = rc2
 15527  		}
 15528  	}
 15529  	sqlite3.Xsqlite3_free(tls, zSql)
 15530  
 15531  	// All rules are now in a singly linked list starting at pHead. This
 15532  	// block sorts them by cost and then sets amatch_vtab.pRule to point to
 15533  	// point to the head of the sorted list.
 15534  	if rc == SQLITE_OK {
 15535  		var i uint32
 15536  		var pX uintptr
 15537  		// var a [15]uintptr at bp+64, 60
 15538  
 15539  		for i = uint32(0); i < (uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 15540  			*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = uintptr(0)
 15541  		}
 15542  		for (libc.AssignUintptr(&pX, pHead)) != uintptr(0) {
 15543  			pHead = (*amatch_rule)(unsafe.Pointer(pX)).FpNext
 15544  			(*amatch_rule)(unsafe.Pointer(pX)).FpNext = uintptr(0)
 15545  			for i = uint32(0); (*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) != 0) && (i < ((uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))) - uint32(1))); i++ {
 15546  				pX = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 15547  				*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = uintptr(0)
 15548  			}
 15549  			*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 15550  		}
 15551  		pX = *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */))
 15552  		i = uint32(1)
 15553  		for ; i < (uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 15554  			pX = amatchMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 15555  		}
 15556  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = amatchMergeRules(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpRule, pX)
 15557  	} else {
 15558  		// An error has occurred. Setting p->pRule to point to the head of the
 15559  		// allocated list ensures that the list will be cleaned up in this case.
 15560  
 15561  		(*amatch_vtab)(unsafe.Pointer(p)).FpRule = pHead
 15562  	}
 15563  
 15564  	return rc
 15565  }
 15566  
 15567  // This function converts an SQL quoted string into an unquoted string
 15568  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 15569  // containing the result. The caller should eventually free this buffer
 15570  // using sqlite3_free.
 15571  //
 15572  // Examples:
 15573  //
 15574  //     "abc"   becomes   abc
 15575  //     'xyz'   becomes   xyz
 15576  //     [pqr]   becomes   pqr
 15577  //     `mno`   becomes   mno
 15578  func amatchDequote(tls *libc.TLS, zIn uintptr) uintptr { /* amatch.c:740:13: */
 15579  	var nIn sqlite3_int64 // Size of input string, in bytes
 15580  	var zOut uintptr      // Output (dequoted) string
 15581  
 15582  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 15583  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 15584  	if zOut != 0 {
 15585  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 15586  
 15587  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 15588  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 15589  		} else {
 15590  			var iOut int32 = 0 // Index of next byte to write to output
 15591  			var iIn int32      // Index of next byte to read from input
 15592  
 15593  			if int32(q) == '[' {
 15594  				q = int8(']')
 15595  			}
 15596  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 15597  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 15598  					iIn++
 15599  				}
 15600  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 15601  			}
 15602  		}
 15603  
 15604  	}
 15605  	return zOut
 15606  }
 15607  
 15608  // Deallocate the pVCheck prepared statement.
 15609  func amatchVCheckClear(tls *libc.TLS, p uintptr) { /* amatch.c:769:13: */
 15610  	if (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck != 0 {
 15611  		sqlite3.Xsqlite3_finalize(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 15612  		(*amatch_vtab)(unsafe.Pointer(p)).FpVCheck = uintptr(0)
 15613  	}
 15614  }
 15615  
 15616  // Deallocate an amatch_vtab object
 15617  func amatchFree(tls *libc.TLS, p uintptr) { /* amatch.c:779:13: */
 15618  	if p != 0 {
 15619  		amatchFreeRules(tls, p)
 15620  		amatchVCheckClear(tls, p)
 15621  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzClassName)
 15622  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzDb)
 15623  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzCostTab)
 15624  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab)
 15625  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord)
 15626  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang)
 15627  		sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf)
 15628  		libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(amatch_vtab{})))
 15629  		sqlite3.Xsqlite3_free(tls, p)
 15630  	}
 15631  }
 15632  
 15633  // xDisconnect/xDestroy method for the amatch module.
 15634  func amatchDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* amatch.c:798:12: */
 15635  	var p uintptr = pVtab
 15636  
 15637  	amatchFree(tls, p)
 15638  	return SQLITE_OK
 15639  }
 15640  
 15641  // Check to see if the argument is of the form:
 15642  //
 15643  //       KEY = VALUE
 15644  //
 15645  // If it is, return a pointer to the first character of VALUE.
 15646  // If not, return NULL.  Spaces around the = are ignored.
 15647  func amatchValueOfKey(tls *libc.TLS, zKey uintptr, zStr uintptr) uintptr { /* amatch.c:813:19: */
 15648  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
 15649  	var nStr int32 = int32(libc.Xstrlen(tls, zStr))
 15650  	var i int32
 15651  	if nStr < (nKey + 1) {
 15652  		return uintptr(0)
 15653  	}
 15654  	if libc.Xmemcmp(tls, zStr, zKey, uint32(nKey)) != 0 {
 15655  		return uintptr(0)
 15656  	}
 15657  	for i = nKey; (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))))*2))) & int32(_ISspace)) != 0; i++ {
 15658  	}
 15659  	if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) != '=' {
 15660  		return uintptr(0)
 15661  	}
 15662  	i++
 15663  	for (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))))*2))) & int32(_ISspace)) != 0 {
 15664  		i++
 15665  	}
 15666  	return (zStr + uintptr(i))
 15667  }
 15668  
 15669  // xConnect/xCreate method for the amatch module. Arguments are:
 15670  //
 15671  //   argv[0]    -> module name  ("approximate_match")
 15672  //   argv[1]    -> database name
 15673  //   argv[2]    -> table name
 15674  //   argv[3...] -> arguments
 15675  func amatchConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* amatch.c:834:12: */
 15676  	bp := tls.Alloc(32)
 15677  	defer tls.Free(32)
 15678  
 15679  	var rc int32     // Return code
 15680  	var pNew uintptr // New virtual table
 15681  	var zModule uintptr
 15682  	var zDb uintptr
 15683  	var zVal uintptr
 15684  	var i int32
 15685  	rc = SQLITE_OK
 15686  	pNew = uintptr(0)
 15687  	zModule = *(*uintptr)(unsafe.Pointer(argv))
 15688  	zDb = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 15689  
 15690  	_ = pAux
 15691  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 15692  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(amatch_vtab{})))
 15693  	if !(pNew == uintptr(0)) {
 15694  		goto __1
 15695  	}
 15696  	return SQLITE_NOMEM
 15697  __1:
 15698  	;
 15699  	rc = SQLITE_NOMEM
 15700  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(amatch_vtab{})))
 15701  	(*amatch_vtab)(unsafe.Pointer(pNew)).Fdb = db
 15702  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzClassName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zModule))
 15703  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzClassName == uintptr(0)) {
 15704  		goto __2
 15705  	}
 15706  	goto amatchConnectError
 15707  __2:
 15708  	;
 15709  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzDb = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zDb))
 15710  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzDb == uintptr(0)) {
 15711  		goto __3
 15712  	}
 15713  	goto amatchConnectError
 15714  __3:
 15715  	;
 15716  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzSelf = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 15717  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzSelf == uintptr(0)) {
 15718  		goto __4
 15719  	}
 15720  	goto amatchConnectError
 15721  __4:
 15722  	;
 15723  	i = 3
 15724  __5:
 15725  	if !(i < argc) {
 15726  		goto __7
 15727  	}
 15728  	zVal = amatchValueOfKey(tls, ts+3329 /* "vocabulary_table" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 15729  	if !(zVal != 0) {
 15730  		goto __8
 15731  	}
 15732  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab)
 15733  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab = amatchDequote(tls, zVal)
 15734  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabTab == uintptr(0)) {
 15735  		goto __9
 15736  	}
 15737  	goto amatchConnectError
 15738  __9:
 15739  	;
 15740  	goto __6
 15741  __8:
 15742  	;
 15743  	zVal = amatchValueOfKey(tls, ts+3346 /* "vocabulary_word" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 15744  	if !(zVal != 0) {
 15745  		goto __10
 15746  	}
 15747  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord)
 15748  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord = amatchDequote(tls, zVal)
 15749  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabWord == uintptr(0)) {
 15750  		goto __11
 15751  	}
 15752  	goto amatchConnectError
 15753  __11:
 15754  	;
 15755  	goto __6
 15756  __10:
 15757  	;
 15758  	zVal = amatchValueOfKey(tls, ts+3362 /* "vocabulary_langu..." */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 15759  	if !(zVal != 0) {
 15760  		goto __12
 15761  	}
 15762  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang)
 15763  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang = amatchDequote(tls, zVal)
 15764  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzVocabLang == uintptr(0)) {
 15765  		goto __13
 15766  	}
 15767  	goto amatchConnectError
 15768  __13:
 15769  	;
 15770  	goto __6
 15771  __12:
 15772  	;
 15773  	zVal = amatchValueOfKey(tls, ts+3382 /* "edit_distances" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 15774  	if !(zVal != 0) {
 15775  		goto __14
 15776  	}
 15777  	sqlite3.Xsqlite3_free(tls, (*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab)
 15778  	(*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab = amatchDequote(tls, zVal)
 15779  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab == uintptr(0)) {
 15780  		goto __15
 15781  	}
 15782  	goto amatchConnectError
 15783  __15:
 15784  	;
 15785  	goto __6
 15786  __14:
 15787  	;
 15788  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3397 /* "unrecognized arg..." */, libc.VaList(bp+24, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 15789  	amatchFree(tls, pNew)
 15790  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 15791  	return SQLITE_ERROR
 15792  	goto __6
 15793  __6:
 15794  	i++
 15795  	goto __5
 15796  	goto __7
 15797  __7:
 15798  	;
 15799  	rc = SQLITE_OK
 15800  	if !((*amatch_vtab)(unsafe.Pointer(pNew)).FzCostTab == uintptr(0)) {
 15801  		goto __16
 15802  	}
 15803  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3426 /* "no edit_distance..." */, 0)
 15804  	rc = SQLITE_ERROR
 15805  	goto __17
 15806  __16:
 15807  	rc = amatchLoadRules(tls, db, pNew, pzErr)
 15808  __17:
 15809  	;
 15810  	if !(rc == SQLITE_OK) {
 15811  		goto __18
 15812  	}
 15813  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 15814  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 15815  
 15816  		ts+3460 /* "CREATE TABLE x(w..." */)
 15817  __18:
 15818  	;
 15819  	if !(rc != SQLITE_OK) {
 15820  		goto __19
 15821  	}
 15822  	amatchFree(tls, pNew)
 15823  __19:
 15824  	;
 15825  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pNew /* &.base */)
 15826  	return rc
 15827  
 15828  amatchConnectError:
 15829  	amatchFree(tls, pNew)
 15830  	return rc
 15831  }
 15832  
 15833  // Open a new amatch cursor.
 15834  func amatchOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* amatch.c:928:12: */
 15835  	var p uintptr = pVTab
 15836  	var pCur uintptr
 15837  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(amatch_cursor{})))
 15838  	if pCur == uintptr(0) {
 15839  		return SQLITE_NOMEM
 15840  	}
 15841  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(amatch_cursor{})))
 15842  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 15843  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 15844  	(*amatch_vtab)(unsafe.Pointer(p)).FnCursor++
 15845  	return SQLITE_OK
 15846  }
 15847  
 15848  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 15849  // to indicate that it is at EOF.
 15850  func amatchClearCursor(tls *libc.TLS, pCur uintptr) { /* amatch.c:944:13: */
 15851  	var pWord uintptr
 15852  	var pNextWord uintptr
 15853  	for pWord = (*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords; pWord != 0; pWord = pNextWord {
 15854  		pNextWord = (*amatch_word)(unsafe.Pointer(pWord)).FpNext
 15855  		sqlite3.Xsqlite3_free(tls, pWord)
 15856  	}
 15857  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords = uintptr(0)
 15858  	sqlite3.Xsqlite3_free(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzInput)
 15859  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzInput = uintptr(0)
 15860  	sqlite3.Xsqlite3_free(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 15861  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf = uintptr(0)
 15862  	(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = 0
 15863  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCost = uintptr(0)
 15864  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpWord = uintptr(0)
 15865  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent = uintptr(0)
 15866  	(*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit = 1000000
 15867  	(*amatch_cursor)(unsafe.Pointer(pCur)).FiLang = 0
 15868  	(*amatch_cursor)(unsafe.Pointer(pCur)).FnWord = 0
 15869  }
 15870  
 15871  // Close a amatch cursor.
 15872  func amatchClose(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:967:12: */
 15873  	var pCur uintptr = cur
 15874  	amatchClearCursor(tls, pCur)
 15875  	(*amatch_vtab)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 15876  	sqlite3.Xsqlite3_free(tls, pCur)
 15877  	return SQLITE_OK
 15878  }
 15879  
 15880  // Render a 24-bit unsigned integer as a 4-byte base-64 number.
 15881  func amatchEncodeInt(tls *libc.TLS, x int32, z uintptr) { /* amatch.c:978:13: */
 15882  	*(*int8)(unsafe.Pointer(z)) = a[((x >> 18) & 0x3f)]
 15883  	*(*int8)(unsafe.Pointer(z + 1)) = a[((x >> 12) & 0x3f)]
 15884  	*(*int8)(unsafe.Pointer(z + 2)) = a[((x >> 6) & 0x3f)]
 15885  	*(*int8)(unsafe.Pointer(z + 3)) = a[(x & 0x3f)]
 15886  }
 15887  
 15888  var a = *(*[65]int8)(unsafe.Pointer(ts + 3527 /* "0123456789ABCDEF..." */)) /* amatch.c:979:21 */
 15889  
 15890  // Write the zCost[] field for a amatch_word object
 15891  func amatchWriteCost(tls *libc.TLS, pWord uintptr) { /* amatch.c:996:13: */
 15892  	amatchEncodeInt(tls, (*amatch_word)(unsafe.Pointer(pWord)).FrCost, pWord+60 /* &.zCost */)
 15893  	amatchEncodeInt(tls, (*amatch_word)(unsafe.Pointer(pWord)).FiSeq, ((pWord + 60 /* &.zCost */) + uintptr(4)))
 15894  	*(*int8)(unsafe.Pointer((pWord + 60 /* &.zCost */) + 8)) = int8(0)
 15895  }
 15896  
 15897  // Circumvent compiler warnings about the use of strcpy() by supplying
 15898  // our own implementation.
 15899  func amatchStrcpy(tls *libc.TLS, dest uintptr, src uintptr) { /* amatch.c:1005:13: */
 15900  	for (int32(libc.AssignPtrInt8(libc.PostIncUintptr(&dest, 1), *(*int8)(unsafe.Pointer(libc.PostIncUintptr(&src, 1)))))) != 0 {
 15901  	}
 15902  }
 15903  
 15904  func amatchStrcat(tls *libc.TLS, dest uintptr, src uintptr) { /* amatch.c:1008:13: */
 15905  	for *(*int8)(unsafe.Pointer(dest)) != 0 {
 15906  		dest++
 15907  	}
 15908  	amatchStrcpy(tls, dest, src)
 15909  }
 15910  
 15911  // Add a new amatch_word object to the queue.
 15912  //
 15913  // If a prior amatch_word object with the same zWord, and nMatch
 15914  // already exists, update its rCost (if the new rCost is less) but
 15915  // otherwise leave it unchanged.  Do not add a duplicate.
 15916  //
 15917  // Do nothing if the cost exceeds threshold.
 15918  func amatchAddWord(tls *libc.TLS, pCur uintptr, rCost amatch_cost, nMatch int32, zWordBase uintptr, zWordTail uintptr) { /* amatch.c:1022:13: */
 15919  	bp := tls.Alloc(4)
 15920  	defer tls.Free(4)
 15921  
 15922  	var pWord uintptr
 15923  	var pNode uintptr
 15924  	var pOther uintptr
 15925  	_ = pOther
 15926  	var nBase int32
 15927  	var nTail int32
 15928  	// var zBuf [4]int8 at bp, 4
 15929  
 15930  	if rCost > (*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit {
 15931  		return
 15932  	}
 15933  	nBase = int32(libc.Xstrlen(tls, zWordBase))
 15934  	nTail = int32(libc.Xstrlen(tls, zWordTail))
 15935  	if ((nBase + nTail) + 3) > (*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf {
 15936  		(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = ((nBase + nTail) + 100)
 15937  		(*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf = sqlite3.Xsqlite3_realloc(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf, (*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf)
 15938  		if (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf == uintptr(0) {
 15939  			(*amatch_cursor)(unsafe.Pointer(pCur)).FnBuf = 0
 15940  			return
 15941  		}
 15942  	}
 15943  	amatchEncodeInt(tls, nMatch, bp /* &zBuf[0] */)
 15944  	libc.Xmemcpy(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf, (bp /* &zBuf[0] */ + uintptr(2)), uint32(2))
 15945  	libc.Xmemcpy(tls, ((*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr(2)), zWordBase, uint32(nBase))
 15946  	libc.Xmemcpy(tls, (((*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr(2)) + uintptr(nBase)), zWordTail, (uint32(nTail + 1)))
 15947  	pNode = amatchAvlSearch(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FpWord, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 15948  	if pNode != 0 {
 15949  		pWord = (*amatch_avl)(unsafe.Pointer(pNode)).FpWord
 15950  		if (*amatch_word)(unsafe.Pointer(pWord)).FrCost > rCost {
 15951  			amatchAvlRemove(tls, (pCur + 56 /* &.pCost */), (pWord + 4 /* &.sCost */))
 15952  			(*amatch_word)(unsafe.Pointer(pWord)).FrCost = rCost
 15953  			amatchWriteCost(tls, pWord)
 15954  			pOther = amatchAvlInsert(tls, (pCur + 56 /* &.pCost */), (pWord + 4 /* &.sCost */))
 15955  			_ = pOther
 15956  		}
 15957  		return
 15958  	}
 15959  	pWord = sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint32(unsafe.Sizeof(amatch_word{})) + uint32(nBase)) + uint32(nTail)) - uint32(1))))
 15960  	if pWord == uintptr(0) {
 15961  		return
 15962  	}
 15963  	libc.Xmemset(tls, pWord, 0, uint32(unsafe.Sizeof(amatch_word{})))
 15964  	(*amatch_word)(unsafe.Pointer(pWord)).FrCost = rCost
 15965  	(*amatch_word)(unsafe.Pointer(pWord)).FiSeq = libc.PostIncInt32(&(*amatch_cursor)(unsafe.Pointer(pCur)).FnWord, 1)
 15966  	amatchWriteCost(tls, pWord)
 15967  	(*amatch_word)(unsafe.Pointer(pWord)).FnMatch = int16(nMatch)
 15968  	(*amatch_word)(unsafe.Pointer(pWord)).FpNext = (*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords
 15969  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpAllWords = pWord
 15970  	(*amatch_word)(unsafe.Pointer(pWord)).FsCost.FzKey = pWord + 60 /* &.zCost */
 15971  	(*amatch_word)(unsafe.Pointer(pWord)).FsCost.FpWord = pWord
 15972  	pOther = amatchAvlInsert(tls, (pCur + 56 /* &.pCost */), (pWord + 4 /* &.sCost */))
 15973  	_ = pOther
 15974  	(*amatch_word)(unsafe.Pointer(pWord)).FsWord.FzKey = pWord + 72 /* &.zWord */
 15975  	(*amatch_word)(unsafe.Pointer(pWord)).FsWord.FpWord = pWord
 15976  	amatchStrcpy(tls, pWord+72 /* &.zWord */, (*amatch_cursor)(unsafe.Pointer(pCur)).FzBuf)
 15977  	pOther = amatchAvlInsert(tls, (pCur + 60 /* &.pWord */), (pWord + 28 /* &.sWord */))
 15978  	_ = pOther
 15979  }
 15980  
 15981  // Advance a cursor to its next row of output
 15982  func amatchNext(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:1102:12: */
 15983  	bp := tls.Alloc(80)
 15984  	defer tls.Free(80)
 15985  
 15986  	var pCur uintptr = cur
 15987  	var pWord uintptr = uintptr(0)
 15988  	var pNode uintptr
 15989  	var isMatch int32 = 0
 15990  	var p uintptr = (*amatch_cursor)(unsafe.Pointer(pCur)).FpVtab
 15991  	var nWord int32
 15992  	var rc int32
 15993  	var i int32
 15994  	var zW uintptr
 15995  	var pRule uintptr
 15996  	var zBuf uintptr = uintptr(0)
 15997  	var nBuf int8 = int8(0)
 15998  	// var zNext [8]int8 at bp+64, 8
 15999  
 16000  	// var zNextIn [8]int8 at bp+72, 8
 16001  
 16002  	var nNextIn int32
 16003  
 16004  	if (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck == uintptr(0) {
 16005  		var zSql uintptr
 16006  		if ((*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang != 0) && (*(*int8)(unsafe.Pointer((*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang)) != 0) {
 16007  			zSql = sqlite3.Xsqlite3_mprintf(tls,
 16008  				ts+3592, /* "SELECT \"%w\" FROM..." */
 16009  
 16010  				libc.VaList(bp, ts+3614, /* " WHERE \"%w\">=?1 ..." */
 16011  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab,
 16012  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabLang))
 16013  		} else {
 16014  			zSql = sqlite3.Xsqlite3_mprintf(tls,
 16015  
 16016  				ts+3653, /* "SELECT \"%w\" FROM..." */
 16017  				libc.VaList(bp+40, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord, (*amatch_vtab)(unsafe.Pointer(p)).FzVocabTab,
 16018  					(*amatch_vtab)(unsafe.Pointer(p)).FzVocabWord))
 16019  		}
 16020  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*amatch_vtab)(unsafe.Pointer(p)).Fdb, zSql, -1, (p + 60 /* &.pVCheck */), uintptr(0))
 16021  		sqlite3.Xsqlite3_free(tls, zSql)
 16022  		if rc != 0 {
 16023  			return rc
 16024  		}
 16025  	}
 16026  	sqlite3.Xsqlite3_bind_int(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 2, (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang)
 16027  
 16028  	for ok := true; ok; ok = !(isMatch != 0) {
 16029  		pNode = amatchAvlFirst(tls, (*amatch_cursor)(unsafe.Pointer(pCur)).FpCost)
 16030  		if pNode == uintptr(0) {
 16031  			pWord = uintptr(0)
 16032  			break
 16033  		}
 16034  		pWord = (*amatch_avl)(unsafe.Pointer(pNode)).FpWord
 16035  		amatchAvlRemove(tls, (pCur + 56 /* &.pCost */), (pWord + 4 /* &.sCost */))
 16036  
 16037  		nWord = int32(libc.Xstrlen(tls, ((pWord + 72 /* &.zWord */) + uintptr(2))))
 16038  		if (nWord + 20) > int32(nBuf) {
 16039  			nBuf = (int8(nWord + 100))
 16040  			zBuf = sqlite3.Xsqlite3_realloc(tls, zBuf, int32(nBuf))
 16041  			if zBuf == uintptr(0) {
 16042  				return SQLITE_NOMEM
 16043  			}
 16044  		}
 16045  		amatchStrcpy(tls, zBuf, ((pWord + 72 /* &.zWord */) + uintptr(2)))
 16046  		*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */)) = int8(0)
 16047  		*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) = *(*int8)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput + uintptr((*amatch_word)(unsafe.Pointer(pWord)).FnMatch)))
 16048  		if *(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) != 0 {
 16049  			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++ {
 16050  				*(*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))))
 16051  			}
 16052  			*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */ + uintptr(i))) = int8(0)
 16053  			nNextIn = i
 16054  		} else {
 16055  			nNextIn = 0
 16056  		}
 16057  
 16058  		if (*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) != 0) && (int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) != '*') {
 16059  			sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 16060  			amatchStrcat(tls, zBuf, bp+72 /* &zNextIn[0] */)
 16061  			sqlite3.Xsqlite3_bind_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 1, zBuf, (nWord + nNextIn), uintptr(0))
 16062  			rc = sqlite3.Xsqlite3_step(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 16063  			if rc == SQLITE_ROW {
 16064  				zW = sqlite3.Xsqlite3_column_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 0)
 16065  				if libc.Xstrncmp(tls, zBuf, zW, (uint32(nWord+nNextIn))) == 0 {
 16066  					amatchAddWord(tls, pCur, (*amatch_word)(unsafe.Pointer(pWord)).FrCost, (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn), zBuf, ts+489 /* "" */)
 16067  				}
 16068  			}
 16069  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 16070  		}
 16071  
 16072  		for 1 != 0 {
 16073  			amatchStrcpy(tls, (zBuf + uintptr(nWord)), bp+64 /* &zNext[0] */)
 16074  			sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 16075  			sqlite3.Xsqlite3_bind_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 1, zBuf, -1, libc.UintptrFromInt32(-1))
 16076  			rc = sqlite3.Xsqlite3_step(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 16077  			if rc != SQLITE_ROW {
 16078  				break
 16079  			}
 16080  			zW = sqlite3.Xsqlite3_column_text(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck, 0)
 16081  			amatchStrcpy(tls, (zBuf + uintptr(nWord)), bp+64 /* &zNext[0] */)
 16082  			if libc.Xstrncmp(tls, zW, zBuf, uint32(nWord)) != 0 {
 16083  				break
 16084  			}
 16085  			if ((int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) == '*') && (int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */ + 1))) == 0)) ||
 16086  				((int32(*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */))) == 0) && (int32(*(*int8)(unsafe.Pointer(zW + uintptr(nWord)))) == 0)) {
 16087  				isMatch = 1
 16088  				*(*int8)(unsafe.Pointer(bp + 72 /* &zNextIn[0] */)) = int8(0)
 16089  				nNextIn = 0
 16090  				break
 16091  			}
 16092  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */)) = *(*int8)(unsafe.Pointer(zW + uintptr(nWord)))
 16093  			for i = 1; (i <= 4) && ((int32(*(*int8)(unsafe.Pointer(zW + uintptr((nWord + i))))) & 0xc0) == 0x80); i++ {
 16094  				*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr(i))) = *(*int8)(unsafe.Pointer(zW + uintptr((nWord + i))))
 16095  			}
 16096  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr(i))) = int8(0)
 16097  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 16098  			if (*amatch_vtab)(unsafe.Pointer(p)).FrIns > 0 {
 16099  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrIns), int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch),
 16100  					zBuf, bp+64 /* &zNext[0] */)
 16101  			}
 16102  			if (*amatch_vtab)(unsafe.Pointer(p)).FrSub > 0 {
 16103  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrSub), (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn),
 16104  					zBuf, bp+64 /* &zNext[0] */)
 16105  			}
 16106  			if ((*amatch_vtab)(unsafe.Pointer(p)).FrIns < 0) && ((*amatch_vtab)(unsafe.Pointer(p)).FrSub < 0) {
 16107  				break
 16108  			}
 16109  			*(*int8)(unsafe.Pointer(bp + 64 /* &zNext[0] */ + uintptr((i - 1))))++ // FIX ME
 16110  		}
 16111  		sqlite3.Xsqlite3_reset(tls, (*amatch_vtab)(unsafe.Pointer(p)).FpVCheck)
 16112  
 16113  		if (*amatch_vtab)(unsafe.Pointer(p)).FrDel > 0 {
 16114  			*(*int8)(unsafe.Pointer(zBuf + uintptr(nWord))) = int8(0)
 16115  			amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_vtab)(unsafe.Pointer(p)).FrDel), (int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + nNextIn),
 16116  				zBuf, ts+489 /* "" */)
 16117  		}
 16118  
 16119  		for pRule = (*amatch_vtab)(unsafe.Pointer(p)).FpRule; pRule != 0; pRule = (*amatch_rule)(unsafe.Pointer(pRule)).FpNext {
 16120  			if (*amatch_rule)(unsafe.Pointer(pRule)).FiLang != (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang {
 16121  				continue
 16122  			}
 16123  			if libc.Xstrncmp(tls, (*amatch_rule)(unsafe.Pointer(pRule)).FzFrom, ((*amatch_cursor)(unsafe.Pointer(pCur)).FzInput+uintptr((*amatch_word)(unsafe.Pointer(pWord)).FnMatch)), uint32((*amatch_rule)(unsafe.Pointer(pRule)).FnFrom)) == 0 {
 16124  				amatchAddWord(tls, pCur, ((*amatch_word)(unsafe.Pointer(pWord)).FrCost + (*amatch_rule)(unsafe.Pointer(pRule)).FrCost),
 16125  					(int32((*amatch_word)(unsafe.Pointer(pWord)).FnMatch) + int32((*amatch_rule)(unsafe.Pointer(pRule)).FnFrom)), ((pWord + 72 /* &.zWord */) + uintptr(2)), pRule+18 /* &.zTo */)
 16126  			}
 16127  		}
 16128  	}
 16129  	(*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent = pWord
 16130  	sqlite3.Xsqlite3_free(tls, zBuf)
 16131  	return SQLITE_OK
 16132  }
 16133  
 16134  // Called to "rewind" a cursor back to the beginning so that
 16135  // it starts its output over again.  Always called at least once
 16136  // prior to any amatchColumn, amatchRowid, or amatchEof call.
 16137  func amatchFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* amatch.c:1251:12: */
 16138  	bp := tls.Alloc(8)
 16139  	defer tls.Free(8)
 16140  
 16141  	var pCur uintptr = pVtabCursor
 16142  	var zWord uintptr = ts + 3701 /* "*" */
 16143  	var idx int32
 16144  
 16145  	amatchClearCursor(tls, pCur)
 16146  	idx = 0
 16147  	if (idxNum & 1) != 0 {
 16148  		zWord = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 16149  		idx++
 16150  	}
 16151  	if (idxNum & 2) != 0 {
 16152  		(*amatch_cursor)(unsafe.Pointer(pCur)).FrLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*4)))
 16153  		idx++
 16154  	}
 16155  	if (idxNum & 4) != 0 {
 16156  		(*amatch_cursor)(unsafe.Pointer(pCur)).FiLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*4)))
 16157  		idx++
 16158  	}
 16159  	(*amatch_cursor)(unsafe.Pointer(pCur)).FzInput = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zWord))
 16160  	if (*amatch_cursor)(unsafe.Pointer(pCur)).FzInput == uintptr(0) {
 16161  		return SQLITE_NOMEM
 16162  	}
 16163  	amatchAddWord(tls, pCur, 0, 0, ts+489 /* "" */, ts+489 /* "" */)
 16164  	amatchNext(tls, pVtabCursor)
 16165  
 16166  	return SQLITE_OK
 16167  }
 16168  
 16169  // Only the word and distance columns have values.  All other columns
 16170  // return NULL
 16171  func amatchColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* amatch.c:1286:12: */
 16172  	var pCur uintptr = cur
 16173  	switch i {
 16174  	case AMATCH_COL_WORD:
 16175  		{
 16176  			sqlite3.Xsqlite3_result_text(tls, ctx, (((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent + 72 /* &.zWord */) + uintptr(2)), -1, uintptr(0))
 16177  			break
 16178  
 16179  		}
 16180  	case AMATCH_COL_DISTANCE:
 16181  		{
 16182  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_word)(unsafe.Pointer((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent)).FrCost)
 16183  			break
 16184  
 16185  		}
 16186  	case AMATCH_COL_LANGUAGE:
 16187  		{
 16188  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_cursor)(unsafe.Pointer(pCur)).FiLang)
 16189  			break
 16190  
 16191  		}
 16192  	case AMATCH_COL_NWORD:
 16193  		{
 16194  			sqlite3.Xsqlite3_result_int(tls, ctx, (*amatch_cursor)(unsafe.Pointer(pCur)).FnWord)
 16195  			break
 16196  
 16197  		}
 16198  	default:
 16199  		{
 16200  			sqlite3.Xsqlite3_result_null(tls, ctx)
 16201  			break
 16202  
 16203  		}
 16204  	}
 16205  	return SQLITE_OK
 16206  }
 16207  
 16208  // The rowid.
 16209  func amatchRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* amatch.c:1316:12: */
 16210  	var pCur uintptr = cur
 16211  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*amatch_cursor)(unsafe.Pointer(pCur)).FiRowid
 16212  	return SQLITE_OK
 16213  }
 16214  
 16215  // EOF indicator
 16216  func amatchEof(tls *libc.TLS, cur uintptr) int32 { /* amatch.c:1325:12: */
 16217  	var pCur uintptr = cur
 16218  	return (libc.Bool32((*amatch_cursor)(unsafe.Pointer(pCur)).FpCurrent == uintptr(0)))
 16219  }
 16220  
 16221  // Search for terms of these forms:
 16222  //
 16223  //   (A)    word MATCH $str
 16224  //   (B1)   distance < $value
 16225  //   (B2)   distance <= $value
 16226  //   (C)    language == $language
 16227  //
 16228  // The distance< and distance<= are both treated as distance<=.
 16229  // The query plan number is a bit vector:
 16230  //
 16231  //   bit 1:   Term of the form (A) found
 16232  //   bit 2:   Term like (B1) or (B2) found
 16233  //   bit 3:   Term like (C) found
 16234  //
 16235  // If bit-1 is set, $str is always in filter.argv[0].  If bit-2 is set
 16236  // then $value is in filter.argv[0] if bit-1 is clear and is in
 16237  // filter.argv[1] if bit-1 is set.  If bit-3 is set, then $ruleid is
 16238  // in filter.argv[0] if bit-1 and bit-2 are both zero, is in
 16239  // filter.argv[1] if exactly one of bit-1 and bit-2 are set, and is in
 16240  // filter.argv[2] if both bit-1 and bit-2 are set.
 16241  func amatchBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* amatch.c:1352:12: */
 16242  	var iPlan int32 = 0
 16243  	var iDistTerm int32 = -1
 16244  	var iLangTerm int32 = -1
 16245  	var i int32
 16246  	var pConstraint uintptr
 16247  
 16248  	_ = tab
 16249  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 16250  	i = 0
 16251  __1:
 16252  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 16253  		goto __3
 16254  	}
 16255  	{
 16256  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 16257  			goto __2
 16258  		}
 16259  		if (((iPlan & 1) == 0) &&
 16260  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0)) &&
 16261  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 16262  			iPlan = iPlan | (1)
 16263  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 16264  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16265  		}
 16266  		if (((iPlan & 2) == 0) &&
 16267  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 1)) &&
 16268  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 16269  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 16270  			iPlan = iPlan | (2)
 16271  			iDistTerm = i
 16272  		}
 16273  		if (((iPlan & 4) == 0) &&
 16274  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 2)) &&
 16275  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 16276  			iPlan = iPlan | (4)
 16277  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 16278  			iLangTerm = i
 16279  		}
 16280  
 16281  	}
 16282  	goto __2
 16283  __2:
 16284  	i++
 16285  	pConstraint += 12
 16286  	goto __1
 16287  	goto __3
 16288  __3:
 16289  	;
 16290  	if (iPlan & 2) != 0 {
 16291  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = (1 + (libc.Bool32((iPlan & 1) != 0)))
 16292  	}
 16293  	if (iPlan & 4) != 0 {
 16294  		var idx int32 = 1
 16295  		if (iPlan & 1) != 0 {
 16296  			idx++
 16297  		}
 16298  		if (iPlan & 2) != 0 {
 16299  			idx++
 16300  		}
 16301  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).FargvIndex = idx
 16302  	}
 16303  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 16304  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 16305  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == 1)) &&
 16306  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 16307  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 16308  	}
 16309  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10000)
 16310  
 16311  	return SQLITE_OK
 16312  }
 16313  
 16314  // The xUpdate() method.
 16315  //
 16316  // This implementation disallows DELETE and UPDATE.  The only thing
 16317  // allowed is INSERT into the "command" column.
 16318  func amatchUpdate(tls *libc.TLS, pVTab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* amatch.c:1418:12: */
 16319  	bp := tls.Alloc(24)
 16320  	defer tls.Free(24)
 16321  
 16322  	var p uintptr = pVTab
 16323  	var zCmd uintptr
 16324  	_ = pRowid
 16325  	if argc == 1 {
 16326  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+3703, /* "DELETE from %s i..." */
 16327  			libc.VaList(bp, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 16328  		return SQLITE_ERROR
 16329  	}
 16330  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_NULL {
 16331  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+3733, /* "UPDATE of %s is ..." */
 16332  			libc.VaList(bp+8, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 16333  		return SQLITE_ERROR
 16334  	}
 16335  	if ((sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4))) != SQLITE_NULL) ||
 16336  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))) != SQLITE_NULL)) ||
 16337  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4))) != SQLITE_NULL) {
 16338  		(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 16339  			ts+3761 /* "INSERT INTO %s a..." */, libc.VaList(bp+16, (*amatch_vtab)(unsafe.Pointer(p)).FzSelf))
 16340  		return SQLITE_ERROR
 16341  	}
 16342  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*4)))
 16343  	if zCmd == uintptr(0) {
 16344  		return SQLITE_OK
 16345  	}
 16346  
 16347  	return SQLITE_OK
 16348  }
 16349  
 16350  // A virtual table module that implements the "approximate_match".
 16351  var amatchModule = sqlite3_module{ // iVersion
 16352  	FxCreate:     0, // xCreate
 16353  	FxConnect:    0, // xConnect
 16354  	FxBestIndex:  0, // xBestIndex
 16355  	FxDisconnect: 0, // xDisconnect
 16356  	FxDestroy:    0, // xDestroy
 16357  	FxOpen:       0, // xOpen - open a cursor
 16358  	FxClose:      0, // xClose - close a cursor
 16359  	FxFilter:     0, // xFilter - configure scan constraints
 16360  	FxNext:       0, // xNext - advance a cursor
 16361  	FxEof:        0, // xEof - check for end of scan
 16362  	FxColumn:     0, // xColumn - read data
 16363  	FxRowid:      0, // xRowid - read data
 16364  	FxUpdate:     0, // xShadowName
 16365  } /* amatch.c:1454:23 */
 16366  
 16367  // Register the amatch virtual table
 16368  func sqlite3_amatch_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* amatch.c:1489:5: */
 16369  	var rc int32 = SQLITE_OK
 16370  	_ = pApi
 16371  
 16372  	_ = pzErrMsg // Not used
 16373  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3810 /* "approximate_matc..." */, uintptr(unsafe.Pointer(&amatchModule)), uintptr(0))
 16374  	return rc
 16375  }
 16376  
 16377  // Allowed values for the mFlags parameter to sqlite3_carray_bind().
 16378  // Must exactly match the definitions in carray.h.
 16379  
 16380  // Names of allowed datatypes
 16381  var azType = [4]uintptr{ts + 3828 /* "int32" */, ts + 3834 /* "int64" */, ts + 2423 /* "double" */, ts + 3840 /* "char*" */} /* carray.c:73:19 */
 16382  
 16383  // Structure used to hold the sqlite3_carray_bind() information
 16384  type carray_bind1 = struct {
 16385  	FaData  uintptr
 16386  	FnData  int32
 16387  	FmFlags int32
 16388  	FxDel   uintptr
 16389  } /* carray.c:78:9 */
 16390  
 16391  // Structure used to hold the sqlite3_carray_bind() information
 16392  type carray_bind = carray_bind1 /* carray.c:78:28 */
 16393  
 16394  // carray_cursor is a subclass of sqlite3_vtab_cursor which will
 16395  // serve as the underlying representation of a cursor that scans
 16396  // over rows of the result
 16397  type carray_cursor1 = struct {
 16398  	Fbase   sqlite3_vtab_cursor
 16399  	_       [4]byte
 16400  	FiRowid sqlite3_int64
 16401  	FpPtr   uintptr
 16402  	_       [4]byte
 16403  	FiCnt   sqlite3_int64
 16404  	FeType  uint8
 16405  	_       [7]byte
 16406  } /* carray.c:91:9 */
 16407  
 16408  // carray_cursor is a subclass of sqlite3_vtab_cursor which will
 16409  // serve as the underlying representation of a cursor that scans
 16410  // over rows of the result
 16411  type carray_cursor = carray_cursor1 /* carray.c:91:30 */
 16412  
 16413  // The carrayConnect() method is invoked to create a new
 16414  // carray_vtab that describes the carray virtual table.
 16415  //
 16416  // Think of this routine as the constructor for carray_vtab objects.
 16417  //
 16418  // All this routine needs to do is:
 16419  //
 16420  //    (1) Allocate the carray_vtab object and initialize all fields.
 16421  //
 16422  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 16423  //        result set of queries against carray will look like.
 16424  func carrayConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* carray.c:113:12: */
 16425  	var pNew uintptr
 16426  	var rc int32
 16427  
 16428  	// Column numbers
 16429  
 16430  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 16431  		ts+3846 /* "CREATE TABLE x(v..." */)
 16432  	if rc == SQLITE_OK {
 16433  		pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 16434  		if pNew == uintptr(0) {
 16435  			return SQLITE_NOMEM
 16436  		}
 16437  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(sqlite3_vtab{})))
 16438  	}
 16439  	return rc
 16440  }
 16441  
 16442  // This method is the destructor for carray_cursor objects.
 16443  func carrayDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* carray.c:142:12: */
 16444  	sqlite3.Xsqlite3_free(tls, pVtab)
 16445  	return SQLITE_OK
 16446  }
 16447  
 16448  // Constructor for a new carray_cursor object.
 16449  func carrayOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* carray.c:150:12: */
 16450  	var pCur uintptr
 16451  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(carray_cursor{})))
 16452  	if pCur == uintptr(0) {
 16453  		return SQLITE_NOMEM
 16454  	}
 16455  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(carray_cursor{})))
 16456  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 16457  	return SQLITE_OK
 16458  }
 16459  
 16460  // Destructor for a carray_cursor.
 16461  func carrayClose(tls *libc.TLS, cur uintptr) int32 { /* carray.c:162:12: */
 16462  	sqlite3.Xsqlite3_free(tls, cur)
 16463  	return SQLITE_OK
 16464  }
 16465  
 16466  // Advance a carray_cursor to its next row of output.
 16467  func carrayNext(tls *libc.TLS, cur uintptr) int32 { /* carray.c:171:12: */
 16468  	var pCur uintptr = cur
 16469  	(*carray_cursor)(unsafe.Pointer(pCur)).FiRowid++
 16470  	return SQLITE_OK
 16471  }
 16472  
 16473  // Return values of columns for the row at which the carray_cursor
 16474  // is currently pointing.
 16475  func carrayColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* carray.c:181:12: */
 16476  	var pCur uintptr = cur
 16477  	var x sqlite3_int64 = int64(0)
 16478  	switch i {
 16479  	case CARRAY_COLUMN_POINTER:
 16480  		return SQLITE_OK
 16481  	case CARRAY_COLUMN_COUNT:
 16482  		x = (*carray_cursor)(unsafe.Pointer(pCur)).FiCnt
 16483  		break
 16484  	case CARRAY_COLUMN_CTYPE:
 16485  		{
 16486  			sqlite3.Xsqlite3_result_text(tls, ctx, azType[(*carray_cursor)(unsafe.Pointer(pCur)).FeType], -1, uintptr(0))
 16487  			return SQLITE_OK
 16488  
 16489  		}
 16490  	default:
 16491  		{
 16492  			switch int32((*carray_cursor)(unsafe.Pointer(pCur)).FeType) {
 16493  			case CARRAY_INT32:
 16494  				{
 16495  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 16496  					sqlite3.Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*4)))
 16497  					return SQLITE_OK
 16498  
 16499  				}
 16500  			case CARRAY_INT64:
 16501  				{
 16502  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 16503  					sqlite3.Xsqlite3_result_int64(tls, ctx, *(*sqlite3_int64)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*8)))
 16504  					return SQLITE_OK
 16505  
 16506  				}
 16507  			case CARRAY_DOUBLE:
 16508  				{
 16509  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 16510  					sqlite3.Xsqlite3_result_double(tls, ctx, *(*float64)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*8)))
 16511  					return SQLITE_OK
 16512  
 16513  				}
 16514  			case CARRAY_TEXT:
 16515  				{
 16516  					var p uintptr = (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr
 16517  					sqlite3.Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer(p + uintptr(((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid-int64(1)))*4)), -1, libc.UintptrFromInt32(-1))
 16518  					return SQLITE_OK
 16519  
 16520  				}
 16521  			}
 16522  
 16523  		}
 16524  	}
 16525  	sqlite3.Xsqlite3_result_int64(tls, ctx, x)
 16526  	return SQLITE_OK
 16527  }
 16528  
 16529  // Return the rowid for the current row.  In this implementation, the
 16530  // rowid is the same as the output value.
 16531  func carrayRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* carray.c:228:12: */
 16532  	var pCur uintptr = cur
 16533  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*carray_cursor)(unsafe.Pointer(pCur)).FiRowid
 16534  	return SQLITE_OK
 16535  }
 16536  
 16537  // Return TRUE if the cursor has been moved off of the last
 16538  // row of output.
 16539  func carrayEof(tls *libc.TLS, cur uintptr) int32 { /* carray.c:238:12: */
 16540  	var pCur uintptr = cur
 16541  	return (libc.Bool32((*carray_cursor)(unsafe.Pointer(pCur)).FiRowid > (*carray_cursor)(unsafe.Pointer(pCur)).FiCnt))
 16542  }
 16543  
 16544  // This method is called to "rewind" the carray_cursor object back
 16545  // to the first row of output.
 16546  func carrayFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* carray.c:247:12: */
 16547  	bp := tls.Alloc(8)
 16548  	defer tls.Free(8)
 16549  
 16550  	var pCur uintptr = pVtabCursor
 16551  	(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = uintptr(0)
 16552  	(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = int64(0)
 16553  	switch idxNum {
 16554  	case 1:
 16555  		{
 16556  			var pBind uintptr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+3909 /* "carray-bind" */)
 16557  			if pBind == uintptr(0) {
 16558  				break
 16559  			}
 16560  			(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = (*carray_bind)(unsafe.Pointer(pBind)).FaData
 16561  			(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = sqlite3_int64((*carray_bind)(unsafe.Pointer(pBind)).FnData)
 16562  			(*carray_cursor)(unsafe.Pointer(pCur)).FeType = (uint8((*carray_bind)(unsafe.Pointer(pBind)).FmFlags & 0x03))
 16563  			break
 16564  
 16565  		}
 16566  	case 2:
 16567  		fallthrough
 16568  	case 3:
 16569  		{
 16570  			(*carray_cursor)(unsafe.Pointer(pCur)).FpPtr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv)), ts+3921 /* "carray" */)
 16571  			(*carray_cursor)(unsafe.Pointer(pCur)).FiCnt = func() int64 {
 16572  				if (*carray_cursor)(unsafe.Pointer(pCur)).FpPtr != 0 {
 16573  					return sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 16574  				}
 16575  				return int64(0)
 16576  			}()
 16577  			if idxNum < 3 {
 16578  				(*carray_cursor)(unsafe.Pointer(pCur)).FeType = uint8(CARRAY_INT32)
 16579  			} else {
 16580  				var i uint8
 16581  				var zType uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 16582  				for i = uint8(0); uint32(i) < (uint32(unsafe.Sizeof(azType)) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 16583  					if sqlite3.Xsqlite3_stricmp(tls, zType, azType[i]) == 0 {
 16584  						break
 16585  					}
 16586  				}
 16587  				if uint32(i) >= (uint32(unsafe.Sizeof(azType)) / uint32(unsafe.Sizeof(uintptr(0)))) {
 16588  					(*sqlite3_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 16589  						ts+3928 /* "unknown datatype..." */, libc.VaList(bp, zType))
 16590  					return SQLITE_ERROR
 16591  				} else {
 16592  					(*carray_cursor)(unsafe.Pointer(pCur)).FeType = i
 16593  				}
 16594  			}
 16595  			break
 16596  
 16597  		}
 16598  	}
 16599  	(*carray_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 16600  	return SQLITE_OK
 16601  }
 16602  
 16603  // SQLite will invoke this method one or more times while planning a query
 16604  // that uses the carray virtual table.  This routine needs to create
 16605  // a query plan for each invocation and compute an estimated cost for that
 16606  // plan.
 16607  //
 16608  // In this implementation idxNum is used to represent the
 16609  // query plan.  idxStr is unused.
 16610  //
 16611  // idxNum is:
 16612  //
 16613  //    1    If only the pointer= constraint exists.  In this case, the
 16614  //         parameter must be bound using sqlite3_carray_bind().
 16615  //
 16616  //    2    if the pointer= and count= constraints exist.
 16617  //
 16618  //    3    if the ctype= constraint also exists.
 16619  //
 16620  // idxNum is 0 otherwise and carray becomes an empty table.
 16621  func carrayBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* carray.c:311:12: */
 16622  	var i int32             // Loop over constraints
 16623  	var ptrIdx int32 = -1   // Index of the pointer= constraint, or -1 if none
 16624  	var cntIdx int32 = -1   // Index of the count= constraint, or -1 if none
 16625  	var ctypeIdx int32 = -1 // Index of the ctype= constraint, or -1 if none
 16626  
 16627  	var pConstraint uintptr
 16628  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 16629  	i = 0
 16630  __1:
 16631  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 16632  		goto __3
 16633  	}
 16634  	{
 16635  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 16636  			goto __2
 16637  		}
 16638  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 16639  			goto __2
 16640  		}
 16641  		switch (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn {
 16642  		case CARRAY_COLUMN_POINTER:
 16643  			ptrIdx = i
 16644  			break
 16645  		case CARRAY_COLUMN_COUNT:
 16646  			cntIdx = i
 16647  			break
 16648  		case CARRAY_COLUMN_CTYPE:
 16649  			ctypeIdx = i
 16650  			break
 16651  		}
 16652  
 16653  	}
 16654  	goto __2
 16655  __2:
 16656  	i++
 16657  	pConstraint += 12
 16658  	goto __1
 16659  	goto __3
 16660  __3:
 16661  	;
 16662  	if ptrIdx >= 0 {
 16663  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ptrIdx)*8)).FargvIndex = 1
 16664  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ptrIdx)*8)).Fomit = uint8(1)
 16665  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1)
 16666  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(100)
 16667  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 16668  		if cntIdx >= 0 {
 16669  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(cntIdx)*8)).FargvIndex = 2
 16670  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(cntIdx)*8)).Fomit = uint8(1)
 16671  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2
 16672  			if ctypeIdx >= 0 {
 16673  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ctypeIdx)*8)).FargvIndex = 3
 16674  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ctypeIdx)*8)).Fomit = uint8(1)
 16675  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 3
 16676  			}
 16677  		}
 16678  	} else {
 16679  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(2147483647)
 16680  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647)
 16681  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 16682  	}
 16683  	return SQLITE_OK
 16684  }
 16685  
 16686  // This following structure defines all the methods for the
 16687  // carray virtual table.
 16688  var carrayModule = sqlite3_module{ // xCreate
 16689  	FxConnect:    0, // xConnect
 16690  	FxBestIndex:  0, // xBestIndex
 16691  	FxDisconnect: 0, // xDestroy
 16692  	FxOpen:       0, // xOpen - open a cursor
 16693  	FxClose:      0, // xClose - close a cursor
 16694  	FxFilter:     0, // xFilter - configure scan constraints
 16695  	FxNext:       0, // xNext - advance a cursor
 16696  	FxEof:        0, // xEof - check for end of scan
 16697  	FxColumn:     0, // xColumn - read data
 16698  	FxRowid:      0, // xRename
 16699  } /* carray.c:365:23 */
 16700  
 16701  // Destructor for the carray_bind object
 16702  func carrayBindDel(tls *libc.TLS, pPtr uintptr) { /* carray.c:391:13: */
 16703  	var p uintptr = pPtr
 16704  	if (*carray_bind)(unsafe.Pointer(p)).FxDel != (uintptr(0)) {
 16705  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 12 /* &.xDel */))))(tls, (*carray_bind)(unsafe.Pointer(p)).FaData)
 16706  	}
 16707  	sqlite3.Xsqlite3_free(tls, p)
 16708  }
 16709  
 16710  // Invoke this interface in order to bind to the single-argument
 16711  // version of CARRAY().
 16712  func sqlite3_carray_bind(tls *libc.TLS, pStmt uintptr, idx int32, aData uintptr, nData int32, mFlags int32, xDestroy uintptr) int32 { /* carray.c:406:5: */
 16713  	var pNew uintptr
 16714  	var i int32
 16715  	pNew = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(carray_bind{})))
 16716  	if pNew == uintptr(0) {
 16717  		if (xDestroy != (uintptr(0))) && (xDestroy != (libc.UintptrFromInt32(-1))) {
 16718  			(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, aData)
 16719  		}
 16720  		return SQLITE_NOMEM
 16721  	}
 16722  	(*carray_bind)(unsafe.Pointer(pNew)).FnData = nData
 16723  	(*carray_bind)(unsafe.Pointer(pNew)).FmFlags = mFlags
 16724  	if xDestroy == (libc.UintptrFromInt32(-1)) {
 16725  		var sz sqlite3_int64 = sqlite3_int64(nData)
 16726  		switch mFlags & 0x03 {
 16727  		case CARRAY_INT32:
 16728  			sz = sz * (int64(4))
 16729  			break
 16730  			fallthrough
 16731  		case CARRAY_INT64:
 16732  			sz = sz * (int64(8))
 16733  			break
 16734  			fallthrough
 16735  		case CARRAY_DOUBLE:
 16736  			sz = sz * (int64(8))
 16737  			break
 16738  			fallthrough
 16739  		case CARRAY_TEXT:
 16740  			sz = sz * (sqlite3_int64(unsafe.Sizeof(uintptr(0))))
 16741  			break
 16742  		}
 16743  		if (mFlags & 0x03) == CARRAY_TEXT {
 16744  			for i = 0; i < nData; i++ {
 16745  				var z uintptr = *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*4))
 16746  				if z != 0 {
 16747  					sz = sz + (sqlite3_int64(libc.Xstrlen(tls, z) + size_t(1)))
 16748  				}
 16749  			}
 16750  		}
 16751  		(*carray_bind)(unsafe.Pointer(pNew)).FaData = sqlite3.Xsqlite3_malloc64(tls, uint64(sz))
 16752  		if (*carray_bind)(unsafe.Pointer(pNew)).FaData == uintptr(0) {
 16753  			sqlite3.Xsqlite3_free(tls, pNew)
 16754  			return SQLITE_NOMEM
 16755  		}
 16756  		if (mFlags & 0x03) == CARRAY_TEXT {
 16757  			var az uintptr = (*carray_bind)(unsafe.Pointer(pNew)).FaData
 16758  			var z uintptr = (az + uintptr(nData)*4)
 16759  			for i = 0; i < nData; i++ {
 16760  				var zData uintptr = *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*4))
 16761  				var n sqlite3_int64
 16762  				if zData == uintptr(0) {
 16763  					*(*uintptr)(unsafe.Pointer(az + uintptr(i)*4)) = uintptr(0)
 16764  					continue
 16765  				}
 16766  				*(*uintptr)(unsafe.Pointer(az + uintptr(i)*4)) = z
 16767  				n = sqlite3_int64(libc.Xstrlen(tls, zData))
 16768  				libc.Xmemcpy(tls, z, zData, (uint32(n + int64(1))))
 16769  				z += (uintptr(n + int64(1)))
 16770  			}
 16771  		} else {
 16772  			libc.Xmemcpy(tls, (*carray_bind)(unsafe.Pointer(pNew)).FaData, aData, (uint32(sz * sqlite3_int64(nData))))
 16773  		}
 16774  		(*carray_bind)(unsafe.Pointer(pNew)).FxDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 16775  	} else {
 16776  		(*carray_bind)(unsafe.Pointer(pNew)).FaData = aData
 16777  		(*carray_bind)(unsafe.Pointer(pNew)).FxDel = xDestroy
 16778  	}
 16779  	return sqlite3.Xsqlite3_bind_pointer(tls, pStmt, idx, pNew, ts+3909 /* "carray-bind" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{carrayBindDel})))
 16780  }
 16781  
 16782  // For testing purpose in the TCL test harness, we need a method for
 16783  // setting the pointer value.  The inttoptr(X) SQL function accomplishes
 16784  // this.  Tcl script will bind an integer to X and the inttoptr() SQL
 16785  // function will use sqlite3_result_pointer() to convert that integer into
 16786  // a pointer.
 16787  //
 16788  // This is for testing on TCL only.
 16789  func inttoptrFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* carray.c:481:13: */
 16790  	bp := tls.Alloc(20)
 16791  	defer tls.Free(20)
 16792  
 16793  	// var p uintptr at bp, 4
 16794  
 16795  	// var i64 sqlite3_int64 at bp+8, 8
 16796  
 16797  	*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* i64 */)) = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 16798  	if uint32(unsafe.Sizeof(sqlite3_int64(0))) == uint32(unsafe.Sizeof(uintptr(0))) {
 16799  		libc.Xmemcpy(tls, bp /* &p */, bp+8 /* &i64 */, uint32(unsafe.Sizeof(uintptr(0))))
 16800  	} else {
 16801  		*(*int32)(unsafe.Pointer(bp + 16 /* i32 */)) = (int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* i64 */)) & int64(0xffffffff)))
 16802  		libc.Xmemcpy(tls, bp /* &p */, bp+16 /* &i32 */, uint32(unsafe.Sizeof(uintptr(0))))
 16803  	}
 16804  	sqlite3.Xsqlite3_result_pointer(tls, context, *(*uintptr)(unsafe.Pointer(bp /* p */)), ts+3921 /* "carray" */, uintptr(0))
 16805  }
 16806  
 16807  func sqlite3_carray_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* carray.c:504:5: */
 16808  	var rc int32 = SQLITE_OK
 16809  	_ = pApi
 16810  
 16811  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+3921 /* "carray" */, uintptr(unsafe.Pointer(&carrayModule)), uintptr(0))
 16812  	if rc == SQLITE_OK {
 16813  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+3949 /* "inttoptr" */, 1, SQLITE_UTF8, uintptr(0),
 16814  			*(*uintptr)(unsafe.Pointer(&struct {
 16815  				f func(*libc.TLS, uintptr, int32, uintptr)
 16816  			}{inttoptrFunc})), uintptr(0), uintptr(0))
 16817  	}
 16818  	return rc
 16819  }
 16820  
 16821  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 16822  //    This file is part of the GNU C Library.
 16823  //
 16824  //    The GNU C Library is free software; you can redistribute it and/or
 16825  //    modify it under the terms of the GNU Lesser General Public
 16826  //    License as published by the Free Software Foundation; either
 16827  //    version 2.1 of the License, or (at your option) any later version.
 16828  //
 16829  //    The GNU C Library is distributed in the hope that it will be useful,
 16830  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 16831  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16832  //    Lesser General Public License for more details.
 16833  //
 16834  //    You should have received a copy of the GNU Lesser General Public
 16835  //    License along with the GNU C Library; if not, see
 16836  //    <http://www.gnu.org/licenses/>.
 16837  
 16838  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 16839  
 16840  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 16841  //    This file is part of the GNU C Library.
 16842  //
 16843  //    The GNU C Library is free software; you can redistribute it and/or
 16844  //    modify it under the terms of the GNU Lesser General Public
 16845  //    License as published by the Free Software Foundation; either
 16846  //    version 2.1 of the License, or (at your option) any later version.
 16847  //
 16848  //    The GNU C Library is distributed in the hope that it will be useful,
 16849  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 16850  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16851  //    Lesser General Public License for more details.
 16852  //
 16853  //    You should have received a copy of the GNU Lesser General Public
 16854  //    License along with the GNU C Library; if not, see
 16855  //    <http://www.gnu.org/licenses/>.
 16856  
 16857  // void assert (int expression);
 16858  //
 16859  //    If NDEBUG is defined, do nothing.
 16860  //    If not, and EXPRESSION is zero, print an error message and abort.
 16861  
 16862  // void assert_perror (int errnum);
 16863  //
 16864  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 16865  //    error message with the error text for ERRNUM and abort.
 16866  //    (This is a GNU extension.)
 16867  
 16868  // Forward declaration of objects used by this utility
 16869  type CksmVfs = sqlite3_vfs1 /* cksumvfs.c:176:28 */
 16870  type CksmFile1 = struct {
 16871  	Fbase        sqlite3_file
 16872  	FzFName      uintptr
 16873  	FcomputeCksm int8
 16874  	FverifyCksm  int8
 16875  	FisWal       int8
 16876  	FinCkpt      int8
 16877  	FpPartner    uintptr
 16878  } /* cksumvfs.c:177:9 */
 16879  
 16880  type CksmFile = CksmFile1 /* cksumvfs.c:177:25 */
 16881  
 16882  // Useful datatype abbreviations
 16883  type u8 = uint8 /* cksumvfs.c:183:25 */
 16884  
 16885  var cksm_vfs = sqlite3_vfs{
 16886  	FiVersion:          3,         // szOsFile (set when registered)
 16887  	FmxPathname:        1024,      // pNext
 16888  	FzName:             ts + 3958, /* "cksmvfs" */ /* pAppData (set when registered) */
 16889  	FxOpen:             0,         // xOpen
 16890  	FxDelete:           0,         // xDelete
 16891  	FxAccess:           0,         // xAccess
 16892  	FxFullPathname:     0,         // xFullPathname
 16893  	FxDlOpen:           0,         // xDlOpen
 16894  	FxDlError:          0,         // xDlError
 16895  	FxDlSym:            0,         // xDlSym
 16896  	FxDlClose:          0,         // xDlClose
 16897  	FxRandomness:       0,         // xRandomness
 16898  	FxSleep:            0,         // xSleep
 16899  	FxCurrentTime:      0,         // xCurrentTime
 16900  	FxGetLastError:     0,         // xGetLastError
 16901  	FxCurrentTimeInt64: 0,         // xCurrentTimeInt64
 16902  	FxSetSystemCall:    0,         // xSetSystemCall
 16903  	FxGetSystemCall:    0,         // xGetSystemCall
 16904  	FxNextSystemCall:   0,         // xNextSystemCall
 16905  } /* cksumvfs.c:247:20 */
 16906  
 16907  var cksm_io_methods = sqlite3_io_methods{
 16908  	FiVersion:               3, // iVersion
 16909  	FxClose:                 0, // xClose
 16910  	FxRead:                  0, // xRead
 16911  	FxWrite:                 0, // xWrite
 16912  	FxTruncate:              0, // xTruncate
 16913  	FxSync:                  0, // xSync
 16914  	FxFileSize:              0, // xFileSize
 16915  	FxLock:                  0, // xLock
 16916  	FxUnlock:                0, // xUnlock
 16917  	FxCheckReservedLock:     0, // xCheckReservedLock
 16918  	FxFileControl:           0, // xFileControl
 16919  	FxSectorSize:            0, // xSectorSize
 16920  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 16921  	FxShmMap:                0, // xShmMap
 16922  	FxShmLock:               0, // xShmLock
 16923  	FxShmBarrier:            0, // xShmBarrier
 16924  	FxShmUnmap:              0, // xShmUnmap
 16925  	FxFetch:                 0, // xFetch
 16926  	FxUnfetch:               0, // xUnfetch
 16927  } /* cksumvfs.c:272:33 */
 16928  
 16929  // Do byte swapping on a unsigned 32-bit integer
 16930  
 16931  // Compute a checksum on a buffer
 16932  func cksmCompute(tls *libc.TLS, a uintptr, nByte int32, aOut uintptr) { /* cksumvfs.c:301:13: */
 16933  	bp := tls.Alloc(12)
 16934  	defer tls.Free(12)
 16935  
 16936  	*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) = u32(0)
 16937  	*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) = u32(0)
 16938  	var aData uintptr = a
 16939  	var aEnd uintptr = (a + uintptr(nByte))
 16940  	*(*u32)(unsafe.Pointer(bp /* x */)) = u32(1)
 16941  
 16942  	if 1 == int32(*(*u8)(unsafe.Pointer(bp /* &x */))) {
 16943  		// Little-endian
 16944  		for ok := true; ok; ok = (aData < aEnd) {
 16945  			*(*u32)(unsafe.Pointer(bp + 4 /* s1 */)) += (*(*u32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + *(*u32)(unsafe.Pointer(bp + 8 /* s2 */)))
 16946  			*(*u32)(unsafe.Pointer(bp + 8 /* s2 */)) += (*(*u32)(unsafe.Pointer(libc.PostIncUintptr(&aData, 4))) + *(*u32)(unsafe.Pointer(bp + 4 /* s1 */)))
 16947  		}
 16948  	} else {
 16949  		// Big-endian
 16950  		for ok1 := true; ok1; ok1 = (aData < aEnd) {
 16951  			*(*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 */)))
 16952  			*(*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 */)))
 16953  			aData += 4 * (uintptr(2))
 16954  		}
 16955  		*(*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))
 16956  		*(*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))
 16957  	}
 16958  	libc.Xmemcpy(tls, aOut, bp+4 /* &s1 */, uint32(4))
 16959  	libc.Xmemcpy(tls, (aOut + uintptr(4)), bp+8 /* &s2 */, uint32(4))
 16960  }
 16961  
 16962  // SQL function:    verify_checksum(BLOB)
 16963  //
 16964  // Return 0 or 1 if the checksum is invalid or valid.  Or return
 16965  // NULL if the input is not a BLOB that is the right size for a
 16966  // database page.
 16967  func cksmVerifyFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* cksumvfs.c:342:13: */
 16968  	bp := tls.Alloc(8)
 16969  	defer tls.Free(8)
 16970  
 16971  	var nByte int32
 16972  	var data uintptr
 16973  	// var cksum [8]u8 at bp, 8
 16974  
 16975  	data = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 16976  	if data == uintptr(0) {
 16977  		return
 16978  	}
 16979  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_BLOB {
 16980  		return
 16981  	}
 16982  	nByte = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 16983  	if ((nByte < 512) || (nByte > 65536)) || ((nByte & (nByte - 1)) != 0) {
 16984  		return
 16985  	}
 16986  	cksmCompute(tls, data, (nByte - 8), bp /* &cksum[0] */)
 16987  	sqlite3.Xsqlite3_result_int(tls, context, (libc.Bool32(libc.Xmemcmp(tls, ((data+uintptr(nByte))-uintptr(8)), bp /* &cksum[0] */, uint32(8)) == 0)))
 16988  }
 16989  
 16990  // Close a cksm-file.
 16991  func cksmClose(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:397:12: */
 16992  	var p uintptr = pFile
 16993  	if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 16994  
 16995  		(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FpPartner = uintptr(0)
 16996  		(*CksmFile)(unsafe.Pointer(p)).FpPartner = uintptr(0)
 16997  	}
 16998  	pFile = ((pFile) + uintptr(1)*16)
 16999  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 4 /* &.xClose */))))(tls, pFile)
 17000  }
 17001  
 17002  // Set the computeCkSm and verifyCksm flags, if they need to be
 17003  // changed.
 17004  func cksmSetFlags(tls *libc.TLS, p uintptr, hasCorrectReserveSize int32) { /* cksumvfs.c:412:13: */
 17005  	if hasCorrectReserveSize != int32((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm) {
 17006  		(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = libc.AssignPtrInt8(p+9 /* &.verifyCksm */, int8(hasCorrectReserveSize))
 17007  		if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 17008  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FverifyCksm = int8(hasCorrectReserveSize)
 17009  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FcomputeCksm = int8(hasCorrectReserveSize)
 17010  		}
 17011  	}
 17012  }
 17013  
 17014  // Read data from a cksm-file.
 17015  func cksmRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* cksumvfs.c:425:12: */
 17016  	bp := tls.Alloc(24)
 17017  	defer tls.Free(24)
 17018  
 17019  	var rc int32
 17020  	var p uintptr = pFile
 17021  	pFile = ((pFile) + uintptr(1)*16)
 17022  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 8 /* &.xRead */))))(tls, pFile, zBuf, iAmt, iOfst)
 17023  	if rc == SQLITE_OK {
 17024  		if ((iOfst == int64(0)) && (iAmt >= 100)) && ((libc.Xmemcmp(tls, zBuf, ts+3149 /* "SQLite format 3" */, uint32(16)) == 0) || (libc.Xmemcmp(tls, zBuf, ts+3966 /* "ZV-" */, uint32(3)) == 0)) {
 17025  			var d uintptr = zBuf
 17026  			var hasCorrectReserveSize int8 = (int8(libc.Bool32(int32(*(*u8)(unsafe.Pointer(d + 20))) == 8)))
 17027  			cksmSetFlags(tls, p, int32(hasCorrectReserveSize))
 17028  		}
 17029  		// Verify the checksum if
 17030  		//    (1) the size indicates that we are dealing with a complete
 17031  		//        database page
 17032  		//    (2) checksum verification is enabled
 17033  		//    (3) we are not in the middle of checkpoint
 17034  		if ((iAmt >= 512) && // (1)
 17035  			((*CksmFile)(unsafe.Pointer(p)).FverifyCksm != 0)) && // (2)
 17036  			!(int32((*CksmFile)(unsafe.Pointer(p)).FinCkpt) != 0) {
 17037  			// var cksum [8]u8 at bp+16, 8
 17038  
 17039  			cksmCompute(tls, zBuf, (iAmt - 8), bp+16 /* &cksum[0] */)
 17040  			if libc.Xmemcmp(tls, ((zBuf+uintptr(iAmt))-uintptr(8)), bp+16 /* &cksum[0] */, uint32(8)) != 0 {
 17041  				sqlite3.Xsqlite3_log(tls, (SQLITE_IOERR | (int32(32) << 8)),
 17042  					ts+3970, /* "checksum fault o..." */
 17043  					libc.VaList(bp, iOfst, (*CksmFile)(unsafe.Pointer(p)).FzFName))
 17044  				rc = (SQLITE_IOERR | (int32(32) << 8))
 17045  			}
 17046  		}
 17047  	}
 17048  	return rc
 17049  }
 17050  
 17051  // Write data to a cksm-file.
 17052  func cksmWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* cksumvfs.c:469:12: */
 17053  	var p uintptr = pFile
 17054  	pFile = ((pFile) + uintptr(1)*16)
 17055  	if ((iOfst == int64(0)) && (iAmt >= 100)) && ((libc.Xmemcmp(tls, zBuf, ts+3149 /* "SQLite format 3" */, uint32(16)) == 0) || (libc.Xmemcmp(tls, zBuf, ts+3966 /* "ZV-" */, uint32(3)) == 0)) {
 17056  		var d uintptr = zBuf
 17057  		var hasCorrectReserveSize int8 = (int8(libc.Bool32(int32(*(*u8)(unsafe.Pointer(d + 20))) == 8)))
 17058  		cksmSetFlags(tls, p, int32(hasCorrectReserveSize))
 17059  	}
 17060  	// If the write size is appropriate for a database page and if
 17061  	// checksums where ever enabled, then it will be safe to compute
 17062  	// the checksums.  The reserve byte size might have increased, but
 17063  	// it will never decrease.  And because it cannot decrease, the
 17064  	// checksum will not overwrite anything.
 17065  	if ((iAmt >= 512) &&
 17066  		((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0)) &&
 17067  		!(int32((*CksmFile)(unsafe.Pointer(p)).FinCkpt) != 0) {
 17068  		cksmCompute(tls, zBuf, (iAmt - 8), (((zBuf) + uintptr(iAmt)) - uintptr(8)))
 17069  	}
 17070  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 12 /* &.xWrite */))))(tls, pFile, zBuf, iAmt, iOfst)
 17071  }
 17072  
 17073  // Truncate a cksm-file.
 17074  func cksmTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* cksumvfs.c:502:12: */
 17075  	pFile = ((pFile) + uintptr(1)*16)
 17076  	return (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 16 /* &.xTruncate */))))(tls, pFile, size)
 17077  }
 17078  
 17079  // Sync a cksm-file.
 17080  func cksmSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* cksumvfs.c:510:12: */
 17081  	pFile = ((pFile) + uintptr(1)*16)
 17082  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 20 /* &.xSync */))))(tls, pFile, flags)
 17083  }
 17084  
 17085  // Return the current file-size of a cksm-file.
 17086  func cksmFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* cksumvfs.c:518:12: */
 17087  	var p uintptr = pFile
 17088  	pFile = ((p) + uintptr(1)*16)
 17089  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 24 /* &.xFileSize */))))(tls, pFile, pSize)
 17090  }
 17091  
 17092  // Lock a cksm-file.
 17093  func cksmLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* cksumvfs.c:527:12: */
 17094  	pFile = ((pFile) + uintptr(1)*16)
 17095  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 28 /* &.xLock */))))(tls, pFile, eLock)
 17096  }
 17097  
 17098  // Unlock a cksm-file.
 17099  func cksmUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* cksumvfs.c:535:12: */
 17100  	pFile = ((pFile) + uintptr(1)*16)
 17101  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 32 /* &.xUnlock */))))(tls, pFile, eLock)
 17102  }
 17103  
 17104  // Check if another file-handle holds a RESERVED lock on a cksm-file.
 17105  func cksmCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* cksumvfs.c:543:12: */
 17106  	pFile = ((pFile) + uintptr(1)*16)
 17107  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 36 /* &.xCheckReservedLock */))))(tls, pFile, pResOut)
 17108  }
 17109  
 17110  // File control method. For custom operations on a cksm-file.
 17111  func cksmFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* cksumvfs.c:551:12: */
 17112  	bp := tls.Alloc(16)
 17113  	defer tls.Free(16)
 17114  
 17115  	var rc int32
 17116  	var p uintptr = pFile
 17117  	pFile = ((pFile) + uintptr(1)*16)
 17118  	if op == SQLITE_FCNTL_PRAGMA {
 17119  		var azArg uintptr = pArg
 17120  
 17121  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + 1*4)), ts+4005 /* "checksum_verific..." */) == 0 {
 17122  			var zArg uintptr = *(*uintptr)(unsafe.Pointer(azArg + 2*4))
 17123  			if zArg != uintptr(0) {
 17124  				if ((((int32(*(*int8)(unsafe.Pointer(zArg))) >= '1') && (int32(*(*int8)(unsafe.Pointer(zArg))) <= '9')) ||
 17125  					(sqlite3.Xsqlite3_strlike(tls, ts+4027 /* "enable%" */, zArg, uint32(0)) == 0)) ||
 17126  					(sqlite3.Xsqlite3_stricmp(tls, ts+4035 /* "yes" */, zArg) == 0)) ||
 17127  					(sqlite3.Xsqlite3_stricmp(tls, ts+4039 /* "on" */, zArg) == 0) {
 17128  					(*CksmFile)(unsafe.Pointer(p)).FverifyCksm = (*CksmFile)(unsafe.Pointer(p)).FcomputeCksm
 17129  				} else {
 17130  					(*CksmFile)(unsafe.Pointer(p)).FverifyCksm = int8(0)
 17131  				}
 17132  				if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 17133  					(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FverifyCksm = (*CksmFile)(unsafe.Pointer(p)).FverifyCksm
 17134  				}
 17135  			}
 17136  			*(*uintptr)(unsafe.Pointer(azArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+1238 /* "%d" */, libc.VaList(bp, int32((*CksmFile)(unsafe.Pointer(p)).FverifyCksm)))
 17137  			return SQLITE_OK
 17138  		} else if (((*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0) && (*(*uintptr)(unsafe.Pointer(azArg + 2*4)) != uintptr(0))) &&
 17139  			(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(azArg + 1*4)), ts+4042 /* "page_size" */) == 0) {
 17140  			// Do not allow page size changes on a checksum database
 17141  			return SQLITE_OK
 17142  		}
 17143  	} else if (op == SQLITE_FCNTL_CKPT_START) || (op == SQLITE_FCNTL_CKPT_DONE) {
 17144  		(*CksmFile)(unsafe.Pointer(p)).FinCkpt = (int8(libc.Bool32(op == SQLITE_FCNTL_CKPT_START)))
 17145  		if (*CksmFile)(unsafe.Pointer(p)).FpPartner != 0 {
 17146  			(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FinCkpt = (*CksmFile)(unsafe.Pointer(p)).FinCkpt
 17147  		}
 17148  	} else if op == SQLITE_FCNTL_CKSM_FILE {
 17149  		// This VFS needs to obtain a pointer to the corresponding database
 17150  		// file handle from within xOpen() calls to open wal files. To do this,
 17151  		// it uses the sqlite3_database_file_object() API to obtain a pointer
 17152  		// to the file-handle used by SQLite to access the db file. This is
 17153  		// fine if cksmvfs happens to be the top-level VFS, but not if there
 17154  		// are one or more wrapper VFS. To handle this case, this file-control
 17155  		// is used to extract the cksmvfs file-handle from any wrapper file
 17156  		// handle.
 17157  		var ppFile uintptr = pArg
 17158  		*(*uintptr)(unsafe.Pointer(ppFile)) = p
 17159  		return SQLITE_OK
 17160  	}
 17161  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 40 /* &.xFileControl */))))(tls, pFile, op, pArg)
 17162  	if (rc == SQLITE_OK) && (op == SQLITE_FCNTL_VFSNAME) {
 17163  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+4052 /* "cksm/%z" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(pArg))))
 17164  	}
 17165  	return rc
 17166  }
 17167  
 17168  // Return the sector-size in bytes for a cksm-file.
 17169  func cksmSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:605:12: */
 17170  	pFile = ((pFile) + uintptr(1)*16)
 17171  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 44 /* &.xSectorSize */))))(tls, pFile)
 17172  }
 17173  
 17174  // Return the device characteristic flags supported by a cksm-file.
 17175  func cksmDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* cksumvfs.c:613:12: */
 17176  	pFile = ((pFile) + uintptr(1)*16)
 17177  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, pFile)
 17178  }
 17179  
 17180  // Create a shared memory file mapping
 17181  func cksmShmMap(tls *libc.TLS, pFile uintptr, iPg int32, pgsz int32, bExtend int32, pp uintptr) int32 { /* cksumvfs.c:619:12: */
 17182  	pFile = ((pFile) + uintptr(1)*16)
 17183  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 52 /* &.xShmMap */))))(tls, pFile, iPg, pgsz, bExtend, libc.AtomicLoadUintptr(&pp))
 17184  }
 17185  
 17186  // Perform locking on a shared-memory segment
 17187  func cksmShmLock(tls *libc.TLS, pFile uintptr, offset int32, n int32, flags int32) int32 { /* cksumvfs.c:631:12: */
 17188  	pFile = ((pFile) + uintptr(1)*16)
 17189  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 56 /* &.xShmLock */))))(tls, pFile, offset, n, flags)
 17190  }
 17191  
 17192  // Memory barrier operation on shared memory
 17193  func cksmShmBarrier(tls *libc.TLS, pFile uintptr) { /* cksumvfs.c:637:13: */
 17194  	pFile = ((pFile) + uintptr(1)*16)
 17195  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pFile)
 17196  }
 17197  
 17198  // Unmap a shared memory segment
 17199  func cksmShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* cksumvfs.c:643:12: */
 17200  	pFile = ((pFile) + uintptr(1)*16)
 17201  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pFile, deleteFlag)
 17202  }
 17203  
 17204  // Fetch a page of a memory-mapped file
 17205  func cksmFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* cksumvfs.c:649:12: */
 17206  	var p uintptr = pFile
 17207  	if (*CksmFile)(unsafe.Pointer(p)).FcomputeCksm != 0 {
 17208  		*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 17209  		return SQLITE_OK
 17210  	}
 17211  	pFile = ((pFile) + uintptr(1)*16)
 17212  	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) {
 17213  		return (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 68 /* &.xFetch */))))(tls, pFile, iOfst, iAmt, pp)
 17214  	}
 17215  	*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 17216  	return SQLITE_OK
 17217  }
 17218  
 17219  // Release a memory-mapped page
 17220  func cksmUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, pPage uintptr) int32 { /* cksumvfs.c:669:12: */
 17221  	pFile = ((pFile) + uintptr(1)*16)
 17222  	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) {
 17223  		return (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods + 72 /* &.xUnfetch */))))(tls, pFile, iOfst, pPage)
 17224  	}
 17225  	return SQLITE_OK
 17226  }
 17227  
 17228  // Open a cksm file handle.
 17229  func cksmOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* cksumvfs.c:680:12: */
 17230  	bp := tls.Alloc(4)
 17231  	defer tls.Free(4)
 17232  
 17233  	var p uintptr
 17234  	var pSubFile uintptr
 17235  	var pSubVfs uintptr
 17236  	var rc int32
 17237  	// var pDb uintptr at bp, 4
 17238  
 17239  	pSubVfs = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 17240  	if !((flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_WAL)) == 0) {
 17241  		goto __1
 17242  	}
 17243  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSubVfs + 24 /* &.xOpen */))))(tls, pSubVfs, zName, pFile, flags, pOutFlags)
 17244  __1:
 17245  	;
 17246  	p = pFile
 17247  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(CksmFile{})))
 17248  	pSubFile = ((pFile) + uintptr(1)*16)
 17249  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&cksm_io_methods))
 17250  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSubVfs + 24 /* &.xOpen */))))(tls, pSubVfs, zName, pSubFile, flags, pOutFlags)
 17251  	if !(rc != 0) {
 17252  		goto __2
 17253  	}
 17254  	goto cksm_open_done
 17255  __2:
 17256  	;
 17257  	if !((flags & SQLITE_OPEN_WAL) != 0) {
 17258  		goto __3
 17259  	}
 17260  	*(*uintptr)(unsafe.Pointer(bp /* pDb */)) = sqlite3.Xsqlite3_database_file_object(tls, zName)
 17261  	rc = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* pDb */)))).FpMethods + 40 /* &.xFileControl */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* pDb */)), SQLITE_FCNTL_CKSM_FILE, bp /* &pDb */)
 17262  
 17263  	(*CksmFile)(unsafe.Pointer(p)).FpPartner = *(*uintptr)(unsafe.Pointer(bp /* pDb */))
 17264  
 17265  	(*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FpPartner = p
 17266  	(*CksmFile)(unsafe.Pointer(p)).FisWal = int8(1)
 17267  	(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = (*CksmFile)(unsafe.Pointer((*CksmFile)(unsafe.Pointer(p)).FpPartner)).FcomputeCksm
 17268  	goto __4
 17269  __3:
 17270  	(*CksmFile)(unsafe.Pointer(p)).FisWal = int8(0)
 17271  	(*CksmFile)(unsafe.Pointer(p)).FcomputeCksm = int8(0)
 17272  __4:
 17273  	;
 17274  	(*CksmFile)(unsafe.Pointer(p)).FzFName = zName
 17275  cksm_open_done:
 17276  	if !(rc != 0) {
 17277  		goto __5
 17278  	}
 17279  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 17280  __5:
 17281  	;
 17282  	return rc
 17283  }
 17284  
 17285  // All other VFS methods are pass-thrus.
 17286  func cksmDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* cksumvfs.c:723:12: */
 17287  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 28 /* &.xDelete */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, dirSync)
 17288  }
 17289  
 17290  func cksmAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* cksumvfs.c:726:12: */
 17291  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 32 /* &.xAccess */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, flags, pResOut)
 17292  }
 17293  
 17294  func cksmFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* cksumvfs.c:734:12: */
 17295  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 36 /* &.xFullPathname */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath, nOut, zOut)
 17296  }
 17297  
 17298  func cksmDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* cksumvfs.c:742:13: */
 17299  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 40 /* &.xDlOpen */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zPath)
 17300  }
 17301  
 17302  func cksmDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* cksumvfs.c:745:13: */
 17303  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 44 /* &.xDlError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zErrMsg)
 17304  }
 17305  
 17306  func cksmDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* cksumvfs.c:748:13: */
 17307  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 48 /* &.xDlSym */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, p, zSym)
 17308  }
 17309  
 17310  func cksmDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* cksumvfs.c:751:13: */
 17311  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 52 /* &.xDlClose */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pHandle)
 17312  }
 17313  
 17314  func cksmRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* cksumvfs.c:754:12: */
 17315  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 56 /* &.xRandomness */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nByte, zBufOut)
 17316  }
 17317  
 17318  func cksmSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* cksumvfs.c:757:12: */
 17319  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 60 /* &.xSleep */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, nMicro)
 17320  }
 17321  
 17322  func cksmCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* cksumvfs.c:760:12: */
 17323  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 64 /* &.xCurrentTime */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, pTimeOut)
 17324  }
 17325  
 17326  func cksmGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* cksumvfs.c:763:12: */
 17327  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 68 /* &.xGetLastError */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, a, b)
 17328  }
 17329  
 17330  func cksmCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* cksumvfs.c:766:12: */
 17331  	bp := tls.Alloc(8)
 17332  	defer tls.Free(8)
 17333  
 17334  	var pOrig uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 17335  	var rc int32
 17336  
 17337  	if (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FxCurrentTimeInt64 != 0 {
 17338  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pOrig + 72 /* &.xCurrentTimeInt64 */))))(tls, pOrig, p)
 17339  	} else {
 17340  		// var r float64 at bp, 8
 17341  
 17342  		rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pOrig + 64 /* &.xCurrentTime */))))(tls, pOrig, bp /* &r */)
 17343  		*(*sqlite3_int64)(unsafe.Pointer(p)) = (sqlite3_int64(*(*float64)(unsafe.Pointer(bp /* r */)) * 86400000.0))
 17344  	}
 17345  	return rc
 17346  }
 17347  
 17348  func cksmSetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr, pCall sqlite3_syscall_ptr) int32 { /* cksumvfs.c:779:12: */
 17349  	return (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 76 /* &.xSetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName, pCall)
 17350  }
 17351  
 17352  func cksmGetSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) sqlite3_syscall_ptr { /* cksumvfs.c:786:28: */
 17353  	return (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 80 /* &.xGetSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 17354  }
 17355  
 17356  func cksmNextSystemCall(tls *libc.TLS, pVfs uintptr, zName uintptr) uintptr { /* cksumvfs.c:792:19: */
 17357  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData + 84 /* &.xNextSystemCall */))))(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData, zName)
 17358  }
 17359  
 17360  // Register the verify_checksum() SQL function.
 17361  func cksmRegisterFunc(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* cksumvfs.c:798:12: */
 17362  	var rc int32
 17363  	if db == uintptr(0) {
 17364  		return SQLITE_OK
 17365  	}
 17366  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4060 /* "verify_checksum" */, 1,
 17367  		((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC),
 17368  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 17369  			f func(*libc.TLS, uintptr, int32, uintptr)
 17370  		}{cksmVerifyFunc})), uintptr(0), uintptr(0))
 17371  	return rc
 17372  }
 17373  
 17374  // Register the cksum VFS as the default VFS for the system.
 17375  // Also make arrangements to automatically register the "verify_checksum()"
 17376  // SQL function on each new database connection.
 17377  func cksmRegisterVfs(tls *libc.TLS) int32 { /* cksumvfs.c:821:12: */
 17378  	var rc int32 = SQLITE_OK
 17379  	var pOrig uintptr
 17380  	if sqlite3.Xsqlite3_vfs_find(tls, ts+3958 /* "cksmvfs" */) != uintptr(0) {
 17381  		return SQLITE_OK
 17382  	}
 17383  	pOrig = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 17384  	if pOrig == uintptr(0) {
 17385  		return SQLITE_ERROR
 17386  	}
 17387  	cksm_vfs.FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pOrig)).FiVersion
 17388  	cksm_vfs.FpAppData = pOrig
 17389  	cksm_vfs.FszOsFile = (int32(uint32((*sqlite3_vfs)(unsafe.Pointer(pOrig)).FszOsFile) + uint32(unsafe.Sizeof(CksmFile{}))))
 17390  	rc = sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&cksm_vfs)), 1)
 17391  	if rc == SQLITE_OK {
 17392  		rc = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 17393  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 17394  		}{cksmRegisterFunc})))
 17395  	}
 17396  	return rc
 17397  }
 17398  
 17399  // This variant of the initializer runs when the extension is
 17400  // statically linked.
 17401  func sqlite3_register_cksumvfs(tls *libc.TLS, NotUsed uintptr) int32 { /* cksumvfs.c:841:5: */
 17402  	_ = NotUsed
 17403  	return cksmRegisterVfs(tls)
 17404  }
 17405  
 17406  func sqlite3_unregister_cksumvfs(tls *libc.TLS) int32 { /* cksumvfs.c:845:5: */
 17407  	if sqlite3.Xsqlite3_vfs_find(tls, ts+3958 /* "cksmvfs" */) != 0 {
 17408  		sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&cksm_vfs)))
 17409  		sqlite3.Xsqlite3_cancel_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 17410  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 17411  		}{cksmRegisterFunc})))
 17412  	}
 17413  	return SQLITE_OK
 17414  }
 17415  
 17416  // Forward declaration of objects used by this implementation
 17417  type closure_vtab1 = struct {
 17418  	Fbase          sqlite3_vtab
 17419  	FzDb           uintptr
 17420  	FzSelf         uintptr
 17421  	FzTableName    uintptr
 17422  	FzIdColumn     uintptr
 17423  	FzParentColumn uintptr
 17424  	Fdb            uintptr
 17425  	FnCursor       int32
 17426  } /* closure.c:156:9 */
 17427  
 17428  // Forward declaration of objects used by this implementation
 17429  type closure_vtab = closure_vtab1 /* closure.c:156:29 */
 17430  type closure_cursor1 = struct {
 17431  	Fbase          sqlite3_vtab_cursor
 17432  	FpVtab         uintptr
 17433  	FzTableName    uintptr
 17434  	FzIdColumn     uintptr
 17435  	FzParentColumn uintptr
 17436  	FpCurrent      uintptr
 17437  	FpClosure      uintptr
 17438  } /* closure.c:157:9 */
 17439  
 17440  type closure_cursor = closure_cursor1 /* closure.c:157:31 */
 17441  type closure_queue1 = struct {
 17442  	FpFirst uintptr
 17443  	FpLast  uintptr
 17444  } /* closure.c:158:9 */
 17445  
 17446  type closure_queue = closure_queue1 /* closure.c:158:30 */
 17447  type closure_avl1 = struct {
 17448  	Fid          sqlite3_int64
 17449  	FiGeneration int32
 17450  	FpList       uintptr
 17451  	FpBefore     uintptr
 17452  	FpAfter      uintptr
 17453  	FpUp         uintptr
 17454  	Fheight      int16
 17455  	Fimbalance   int16
 17456  } /* closure.c:157:9 */
 17457  
 17458  type closure_avl = closure_avl1 /* closure.c:159:28 */
 17459  
 17460  // Recompute the closure_avl.height and closure_avl.imbalance fields for p.
 17461  // Assume that the children of p have correct heights.
 17462  func closureAvlRecomputeHeight(tls *libc.TLS, p uintptr) { /* closure.c:182:13: */
 17463  	var hBefore int16
 17464  	if (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 17465  		hBefore = (*closure_avl)(unsafe.Pointer((*closure_avl)(unsafe.Pointer(p)).FpBefore)).Fheight
 17466  	} else {
 17467  		hBefore = int16(0)
 17468  	}
 17469  	var hAfter int16
 17470  	if (*closure_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 17471  		hAfter = (*closure_avl)(unsafe.Pointer((*closure_avl)(unsafe.Pointer(p)).FpAfter)).Fheight
 17472  	} else {
 17473  		hAfter = int16(0)
 17474  	}
 17475  	(*closure_avl)(unsafe.Pointer(p)).Fimbalance = (int16(int32(hBefore) - int32(hAfter))) // -: pAfter higher.  +: pBefore higher
 17476  	(*closure_avl)(unsafe.Pointer(p)).Fheight = (int16((func() int32 {
 17477  		if int32(hBefore) > int32(hAfter) {
 17478  			return int32(hBefore)
 17479  		}
 17480  		return int32(hAfter)
 17481  	}()) + 1))
 17482  }
 17483  
 17484  //     P                B
 17485  //    / \              / **   B   Z    ==>     X   P
 17486  //  / \                  / ** X   Y                Y   Z
 17487  //
 17488  func closureAvlRotateBefore(tls *libc.TLS, pP uintptr) uintptr { /* closure.c:197:20: */
 17489  	var pB uintptr = (*closure_avl)(unsafe.Pointer(pP)).FpBefore
 17490  	var pY uintptr = (*closure_avl)(unsafe.Pointer(pB)).FpAfter
 17491  	(*closure_avl)(unsafe.Pointer(pB)).FpUp = (*closure_avl)(unsafe.Pointer(pP)).FpUp
 17492  	(*closure_avl)(unsafe.Pointer(pB)).FpAfter = pP
 17493  	(*closure_avl)(unsafe.Pointer(pP)).FpUp = pB
 17494  	(*closure_avl)(unsafe.Pointer(pP)).FpBefore = pY
 17495  	if pY != 0 {
 17496  		(*closure_avl)(unsafe.Pointer(pY)).FpUp = pP
 17497  	}
 17498  	closureAvlRecomputeHeight(tls, pP)
 17499  	closureAvlRecomputeHeight(tls, pB)
 17500  	return pB
 17501  }
 17502  
 17503  //     P                A
 17504  //    / \              / **   X   A    ==>     P   Z
 17505  //      / \          / **     Y   Z        X   Y
 17506  //
 17507  func closureAvlRotateAfter(tls *libc.TLS, pP uintptr) uintptr { /* closure.c:218:20: */
 17508  	var pA uintptr = (*closure_avl)(unsafe.Pointer(pP)).FpAfter
 17509  	var pY uintptr = (*closure_avl)(unsafe.Pointer(pA)).FpBefore
 17510  	(*closure_avl)(unsafe.Pointer(pA)).FpUp = (*closure_avl)(unsafe.Pointer(pP)).FpUp
 17511  	(*closure_avl)(unsafe.Pointer(pA)).FpBefore = pP
 17512  	(*closure_avl)(unsafe.Pointer(pP)).FpUp = pA
 17513  	(*closure_avl)(unsafe.Pointer(pP)).FpAfter = pY
 17514  	if pY != 0 {
 17515  		(*closure_avl)(unsafe.Pointer(pY)).FpUp = pP
 17516  	}
 17517  	closureAvlRecomputeHeight(tls, pP)
 17518  	closureAvlRecomputeHeight(tls, pA)
 17519  	return pA
 17520  }
 17521  
 17522  // Return a pointer to the pBefore or pAfter pointer in the parent
 17523  // of p that points to p.  Or if p is the root node, return pp.
 17524  func closureAvlFromPtr(tls *libc.TLS, p uintptr, pp uintptr) uintptr { /* closure.c:235:20: */
 17525  	var pUp uintptr = (*closure_avl)(unsafe.Pointer(p)).FpUp
 17526  	if pUp == uintptr(0) {
 17527  		return pp
 17528  	}
 17529  	if (*closure_avl)(unsafe.Pointer(pUp)).FpAfter == p {
 17530  		return (pUp + 20 /* &.pAfter */)
 17531  	}
 17532  	return (pUp + 16 /* &.pBefore */)
 17533  }
 17534  
 17535  // Rebalance all nodes starting with p and working up to the root.
 17536  // Return the new root.
 17537  func closureAvlBalance(tls *libc.TLS, p uintptr) uintptr { /* closure.c:246:20: */
 17538  	bp := tls.Alloc(4)
 17539  	defer tls.Free(4)
 17540  	*(*uintptr)(unsafe.Pointer(bp)) = p
 17541  
 17542  	var pTop uintptr = *(*uintptr)(unsafe.Pointer(bp /* p */))
 17543  	var pp uintptr
 17544  	for *(*uintptr)(unsafe.Pointer(bp /* p */)) != 0 {
 17545  		closureAvlRecomputeHeight(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)))
 17546  		if int32((*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) >= 2 {
 17547  			var pB uintptr = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore
 17548  			if int32((*closure_avl)(unsafe.Pointer(pB)).Fimbalance) < 0 {
 17549  				(*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpBefore = closureAvlRotateAfter(tls, pB)
 17550  			}
 17551  			pp = closureAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 17552  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, closureAvlRotateBefore(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 17553  		} else if int32((*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).Fimbalance) <= (-2) {
 17554  			var pA uintptr = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter
 17555  			if int32((*closure_avl)(unsafe.Pointer(pA)).Fimbalance) > 0 {
 17556  				(*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpAfter = closureAvlRotateBefore(tls, pA)
 17557  			}
 17558  			pp = closureAvlFromPtr(tls, *(*uintptr)(unsafe.Pointer(bp /* p */)), bp /* &p */)
 17559  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = libc.AssignPtrUintptr(pp, closureAvlRotateAfter(tls, *(*uintptr)(unsafe.Pointer(bp /* p */))))
 17560  		}
 17561  		pTop = *(*uintptr)(unsafe.Pointer(bp /* p */))
 17562  		*(*uintptr)(unsafe.Pointer(bp /* p */)) = (*closure_avl)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* p */)))).FpUp
 17563  	}
 17564  	return pTop
 17565  }
 17566  
 17567  // Search the tree rooted at p for an entry with id.  Return a pointer
 17568  // to the entry or return NULL.
 17569  func closureAvlSearch(tls *libc.TLS, p uintptr, id sqlite3_int64) uintptr { /* closure.c:271:20: */
 17570  	for (p != 0) && (id != (*closure_avl)(unsafe.Pointer(p)).Fid) {
 17571  		if id < (*closure_avl)(unsafe.Pointer(p)).Fid {
 17572  			p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 17573  		} else {
 17574  			p = (*closure_avl)(unsafe.Pointer(p)).FpAfter
 17575  		}
 17576  	}
 17577  	return p
 17578  }
 17579  
 17580  // Find the first node (the one with the smallest key).
 17581  func closureAvlFirst(tls *libc.TLS, p uintptr) uintptr { /* closure.c:280:20: */
 17582  	if p != 0 {
 17583  		for (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 17584  			p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 17585  		}
 17586  	}
 17587  	return p
 17588  }
 17589  
 17590  // Return the node with the next larger key after p.
 17591  func closureAvlNext(tls *libc.TLS, p uintptr) uintptr { /* closure.c:287:13: */
 17592  	var pPrev uintptr = uintptr(0)
 17593  	for (p != 0) && ((*closure_avl)(unsafe.Pointer(p)).FpAfter == pPrev) {
 17594  		pPrev = p
 17595  		p = (*closure_avl)(unsafe.Pointer(p)).FpUp
 17596  	}
 17597  	if (p != 0) && (pPrev == uintptr(0)) {
 17598  		p = closureAvlFirst(tls, (*closure_avl)(unsafe.Pointer(p)).FpAfter)
 17599  	}
 17600  	return p
 17601  }
 17602  
 17603  // Insert a new node pNew.  Return NULL on success.  If the key is not
 17604  // unique, then do not perform the insert but instead leave pNew unchanged
 17605  // and return a pointer to an existing node with the same key.
 17606  func closureAvlInsert(tls *libc.TLS, ppHead uintptr, pNew uintptr) uintptr { /* closure.c:303:20: */
 17607  	var p uintptr = *(*uintptr)(unsafe.Pointer(ppHead))
 17608  	if p == uintptr(0) {
 17609  		p = pNew
 17610  		(*closure_avl)(unsafe.Pointer(pNew)).FpUp = uintptr(0)
 17611  	} else {
 17612  		for p != 0 {
 17613  			if (*closure_avl)(unsafe.Pointer(pNew)).Fid < (*closure_avl)(unsafe.Pointer(p)).Fid {
 17614  				if (*closure_avl)(unsafe.Pointer(p)).FpBefore != 0 {
 17615  					p = (*closure_avl)(unsafe.Pointer(p)).FpBefore
 17616  				} else {
 17617  					(*closure_avl)(unsafe.Pointer(p)).FpBefore = pNew
 17618  					(*closure_avl)(unsafe.Pointer(pNew)).FpUp = p
 17619  					break
 17620  				}
 17621  			} else if (*closure_avl)(unsafe.Pointer(pNew)).Fid > (*closure_avl)(unsafe.Pointer(p)).Fid {
 17622  				if (*closure_avl)(unsafe.Pointer(p)).FpAfter != 0 {
 17623  					p = (*closure_avl)(unsafe.Pointer(p)).FpAfter
 17624  				} else {
 17625  					(*closure_avl)(unsafe.Pointer(p)).FpAfter = pNew
 17626  					(*closure_avl)(unsafe.Pointer(pNew)).FpUp = p
 17627  					break
 17628  				}
 17629  			} else {
 17630  				return p
 17631  			}
 17632  		}
 17633  	}
 17634  	(*closure_avl)(unsafe.Pointer(pNew)).FpBefore = uintptr(0)
 17635  	(*closure_avl)(unsafe.Pointer(pNew)).FpAfter = uintptr(0)
 17636  	(*closure_avl)(unsafe.Pointer(pNew)).Fheight = int16(1)
 17637  	(*closure_avl)(unsafe.Pointer(pNew)).Fimbalance = int16(0)
 17638  	*(*uintptr)(unsafe.Pointer(ppHead)) = closureAvlBalance(tls, p)
 17639  	return uintptr(0)
 17640  }
 17641  
 17642  // Walk the tree can call xDestroy on each node
 17643  func closureAvlDestroy(tls *libc.TLS, p uintptr, xDestroy uintptr) { /* closure.c:344:13: */
 17644  	if p != 0 {
 17645  		closureAvlDestroy(tls, (*closure_avl)(unsafe.Pointer(p)).FpBefore, xDestroy)
 17646  		closureAvlDestroy(tls, (*closure_avl)(unsafe.Pointer(p)).FpAfter, xDestroy)
 17647  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(&xDestroy)))(tls, p)
 17648  	}
 17649  }
 17650  
 17651  // Add a node to the end of the queue
 17652  func queuePush(tls *libc.TLS, pQueue uintptr, pNode uintptr) { /* closure.c:389:13: */
 17653  	(*closure_avl)(unsafe.Pointer(pNode)).FpList = uintptr(0)
 17654  	if (*closure_queue)(unsafe.Pointer(pQueue)).FpLast != 0 {
 17655  		(*closure_avl)(unsafe.Pointer((*closure_queue)(unsafe.Pointer(pQueue)).FpLast)).FpList = pNode
 17656  	} else {
 17657  		(*closure_queue)(unsafe.Pointer(pQueue)).FpFirst = pNode
 17658  	}
 17659  	(*closure_queue)(unsafe.Pointer(pQueue)).FpLast = pNode
 17660  }
 17661  
 17662  // Extract the oldest element (the front element) from the queue.
 17663  func queuePull(tls *libc.TLS, pQueue uintptr) uintptr { /* closure.c:402:20: */
 17664  	var p uintptr = (*closure_queue)(unsafe.Pointer(pQueue)).FpFirst
 17665  	if p != 0 {
 17666  		(*closure_queue)(unsafe.Pointer(pQueue)).FpFirst = (*closure_avl)(unsafe.Pointer(p)).FpList
 17667  		if (*closure_queue)(unsafe.Pointer(pQueue)).FpFirst == uintptr(0) {
 17668  			(*closure_queue)(unsafe.Pointer(pQueue)).FpLast = uintptr(0)
 17669  		}
 17670  	}
 17671  	return p
 17672  }
 17673  
 17674  // This function converts an SQL quoted string into an unquoted string
 17675  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 17676  // containing the result. The caller should eventually free this buffer
 17677  // using sqlite3_free.
 17678  //
 17679  // Examples:
 17680  //
 17681  //     "abc"   becomes   abc
 17682  //     'xyz'   becomes   xyz
 17683  //     [pqr]   becomes   pqr
 17684  //     `mno`   becomes   mno
 17685  func closureDequote(tls *libc.TLS, zIn uintptr) uintptr { /* closure.c:424:13: */
 17686  	var nIn sqlite3_int64 // Size of input string, in bytes
 17687  	var zOut uintptr      // Output (dequoted) string
 17688  
 17689  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 17690  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 17691  	if zOut != 0 {
 17692  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 17693  
 17694  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 17695  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 17696  		} else {
 17697  			var iOut int32 = 0 // Index of next byte to write to output
 17698  			var iIn int32      // Index of next byte to read from input
 17699  
 17700  			if int32(q) == '[' {
 17701  				q = int8(']')
 17702  			}
 17703  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 17704  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 17705  					iIn++
 17706  				}
 17707  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 17708  			}
 17709  		}
 17710  
 17711  	}
 17712  	return zOut
 17713  }
 17714  
 17715  // Deallocate an closure_vtab object
 17716  func closureFree(tls *libc.TLS, p uintptr) { /* closure.c:453:13: */
 17717  	if p != 0 {
 17718  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzDb)
 17719  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzSelf)
 17720  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzTableName)
 17721  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzIdColumn)
 17722  		sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(p)).FzParentColumn)
 17723  		libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(closure_vtab{})))
 17724  		sqlite3.Xsqlite3_free(tls, p)
 17725  	}
 17726  }
 17727  
 17728  // xDisconnect/xDestroy method for the closure module.
 17729  func closureDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* closure.c:468:12: */
 17730  	var p uintptr = pVtab
 17731  
 17732  	closureFree(tls, p)
 17733  	return SQLITE_OK
 17734  }
 17735  
 17736  // Check to see if the argument is of the form:
 17737  //
 17738  //       KEY = VALUE
 17739  //
 17740  // If it is, return a pointer to the first character of VALUE.
 17741  // If not, return NULL.  Spaces around the = are ignored.
 17742  func closureValueOfKey(tls *libc.TLS, zKey uintptr, zStr uintptr) uintptr { /* closure.c:483:19: */
 17743  	var nKey int32 = int32(libc.Xstrlen(tls, zKey))
 17744  	var nStr int32 = int32(libc.Xstrlen(tls, zStr))
 17745  	var i int32
 17746  	if nStr < (nKey + 1) {
 17747  		return uintptr(0)
 17748  	}
 17749  	if libc.Xmemcmp(tls, zStr, zKey, uint32(nKey)) != 0 {
 17750  		return uintptr(0)
 17751  	}
 17752  	for i = nKey; (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))))*2))) & int32(_ISspace)) != 0; i++ {
 17753  	}
 17754  	if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) != '=' {
 17755  		return uintptr(0)
 17756  	}
 17757  	i++
 17758  	for (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zStr + uintptr(i))))))*2))) & int32(_ISspace)) != 0 {
 17759  		i++
 17760  	}
 17761  	return (zStr + uintptr(i))
 17762  }
 17763  
 17764  // xConnect/xCreate method for the closure module. Arguments are:
 17765  //
 17766  //   argv[0]    -> module name  ("transitive_closure")
 17767  //   argv[1]    -> database name
 17768  //   argv[2]    -> table name
 17769  //   argv[3...] -> arguments
 17770  func closureConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* closure.c:504:12: */
 17771  	bp := tls.Alloc(24)
 17772  	defer tls.Free(24)
 17773  
 17774  	var rc int32     // Return code
 17775  	var pNew uintptr // New virtual table
 17776  	var zDb uintptr
 17777  	var zVal uintptr
 17778  	var i int32
 17779  	rc = SQLITE_OK
 17780  	pNew = uintptr(0)
 17781  	zDb = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 17782  
 17783  	_ = pAux
 17784  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 17785  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_vtab{})))
 17786  	if !(pNew == uintptr(0)) {
 17787  		goto __1
 17788  	}
 17789  	return SQLITE_NOMEM
 17790  __1:
 17791  	;
 17792  	rc = SQLITE_NOMEM
 17793  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(closure_vtab{})))
 17794  	(*closure_vtab)(unsafe.Pointer(pNew)).Fdb = db
 17795  	(*closure_vtab)(unsafe.Pointer(pNew)).FzDb = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zDb))
 17796  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzDb == uintptr(0)) {
 17797  		goto __2
 17798  	}
 17799  	goto closureConnectError
 17800  __2:
 17801  	;
 17802  	(*closure_vtab)(unsafe.Pointer(pNew)).FzSelf = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 17803  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzSelf == uintptr(0)) {
 17804  		goto __3
 17805  	}
 17806  	goto closureConnectError
 17807  __3:
 17808  	;
 17809  	i = 3
 17810  __4:
 17811  	if !(i < argc) {
 17812  		goto __6
 17813  	}
 17814  	zVal = closureValueOfKey(tls, ts+4076 /* "tablename" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 17815  	if !(zVal != 0) {
 17816  		goto __7
 17817  	}
 17818  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzTableName)
 17819  	(*closure_vtab)(unsafe.Pointer(pNew)).FzTableName = closureDequote(tls, zVal)
 17820  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzTableName == uintptr(0)) {
 17821  		goto __8
 17822  	}
 17823  	goto closureConnectError
 17824  __8:
 17825  	;
 17826  	goto __5
 17827  __7:
 17828  	;
 17829  	zVal = closureValueOfKey(tls, ts+4086 /* "idcolumn" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 17830  	if !(zVal != 0) {
 17831  		goto __9
 17832  	}
 17833  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn)
 17834  	(*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn = closureDequote(tls, zVal)
 17835  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzIdColumn == uintptr(0)) {
 17836  		goto __10
 17837  	}
 17838  	goto closureConnectError
 17839  __10:
 17840  	;
 17841  	goto __5
 17842  __9:
 17843  	;
 17844  	zVal = closureValueOfKey(tls, ts+4095 /* "parentcolumn" */, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 17845  	if !(zVal != 0) {
 17846  		goto __11
 17847  	}
 17848  	sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn)
 17849  	(*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn = closureDequote(tls, zVal)
 17850  	if !((*closure_vtab)(unsafe.Pointer(pNew)).FzParentColumn == uintptr(0)) {
 17851  		goto __12
 17852  	}
 17853  	goto closureConnectError
 17854  __12:
 17855  	;
 17856  	goto __5
 17857  __11:
 17858  	;
 17859  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3397 /* "unrecognized arg..." */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 17860  	closureFree(tls, pNew)
 17861  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 17862  	return SQLITE_ERROR
 17863  	goto __5
 17864  __5:
 17865  	i++
 17866  	goto __4
 17867  	goto __6
 17868  __6:
 17869  	;
 17870  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 17871  
 17872  		ts+4108 /* "CREATE TABLE x(i..." */)
 17873  	if !(rc != SQLITE_OK) {
 17874  		goto __13
 17875  	}
 17876  	closureFree(tls, pNew)
 17877  __13:
 17878  	;
 17879  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pNew /* &.base */)
 17880  	return rc
 17881  
 17882  closureConnectError:
 17883  	closureFree(tls, pNew)
 17884  	return rc
 17885  }
 17886  
 17887  // Open a new closure cursor.
 17888  func closureOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* closure.c:579:12: */
 17889  	var p uintptr = pVTab
 17890  	var pCur uintptr
 17891  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_cursor{})))
 17892  	if pCur == uintptr(0) {
 17893  		return SQLITE_NOMEM
 17894  	}
 17895  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(closure_cursor{})))
 17896  	(*closure_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 17897  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 17898  	(*closure_vtab)(unsafe.Pointer(p)).FnCursor++
 17899  	return SQLITE_OK
 17900  }
 17901  
 17902  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 17903  // to indicate that it is at EOF.
 17904  func closureClearCursor(tls *libc.TLS, pCur uintptr) { /* closure.c:595:13: */
 17905  	closureAvlDestroy(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 17906  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName)
 17907  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn)
 17908  	sqlite3.Xsqlite3_free(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn)
 17909  	(*closure_cursor)(unsafe.Pointer(pCur)).FzTableName = uintptr(0)
 17910  	(*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn = uintptr(0)
 17911  	(*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn = uintptr(0)
 17912  	(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = uintptr(0)
 17913  	(*closure_cursor)(unsafe.Pointer(pCur)).FpClosure = uintptr(0)
 17914  }
 17915  
 17916  // Close a closure cursor.
 17917  func closureClose(tls *libc.TLS, cur uintptr) int32 { /* closure.c:610:12: */
 17918  	var pCur uintptr = cur
 17919  	closureClearCursor(tls, pCur)
 17920  	(*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 17921  	sqlite3.Xsqlite3_free(tls, pCur)
 17922  	return SQLITE_OK
 17923  }
 17924  
 17925  // Advance a cursor to its next row of output
 17926  func closureNext(tls *libc.TLS, cur uintptr) int32 { /* closure.c:621:12: */
 17927  	var pCur uintptr = cur
 17928  	(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = closureAvlNext(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)
 17929  	return SQLITE_OK
 17930  }
 17931  
 17932  // Allocate and insert a node
 17933  func closureInsertNode(tls *libc.TLS, pQueue uintptr, pCur uintptr, id sqlite3_int64, iGeneration int32) int32 { /* closure.c:630:12: */
 17934  	var pNew uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(closure_avl{})))
 17935  	if pNew == uintptr(0) {
 17936  		return SQLITE_NOMEM
 17937  	}
 17938  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(closure_avl{})))
 17939  	(*closure_avl)(unsafe.Pointer(pNew)).Fid = id
 17940  	(*closure_avl)(unsafe.Pointer(pNew)).FiGeneration = iGeneration
 17941  	closureAvlInsert(tls, (pCur + 24 /* &.pClosure */), pNew)
 17942  	queuePush(tls, pQueue, pNew)
 17943  	return SQLITE_OK
 17944  }
 17945  
 17946  // Called to "rewind" a cursor back to the beginning so that
 17947  // it starts its output over again.  Always called at least once
 17948  // prior to any closureColumn, closureRowid, or closureEof call.
 17949  //
 17950  // This routine actually computes the closure.
 17951  //
 17952  // See the comment at the beginning of closureBestIndex() for a
 17953  // description of the meaning of idxNum.  The idxStr parameter is
 17954  // not used.
 17955  func closureFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* closure.c:657:12: */
 17956  	bp := tls.Alloc(84)
 17957  	defer tls.Free(84)
 17958  
 17959  	var pCur uintptr = pVtabCursor
 17960  	var pVtab uintptr = (*closure_cursor)(unsafe.Pointer(pCur)).FpVtab
 17961  	var iRoot sqlite3_int64
 17962  	var mxGen int32 = 999999999
 17963  	var zSql uintptr
 17964  	// var pStmt uintptr at bp+80, 4
 17965  
 17966  	var pAvl uintptr
 17967  	var rc int32 = SQLITE_OK
 17968  	var zTableName uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzTableName
 17969  	var zIdColumn uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzIdColumn
 17970  	var zParentColumn uintptr = (*closure_vtab)(unsafe.Pointer(pVtab)).FzParentColumn
 17971  	// var sQueue closure_queue at bp+72, 8
 17972  
 17973  	_ = idxStr // Unused parameter
 17974  	_ = argc   // Unused parameter
 17975  	closureClearCursor(tls, pCur)
 17976  	libc.Xmemset(tls, bp+72 /* &sQueue */, 0, uint32(unsafe.Sizeof(closure_queue{})))
 17977  	if (idxNum & 1) == 0 {
 17978  		// No root=$root in the WHERE clause.  Return an empty set
 17979  		return SQLITE_OK
 17980  	}
 17981  	iRoot = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 17982  	if (idxNum & 0x000f0) != 0 {
 17983  		mxGen = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>4)&0x0f))*4)))
 17984  		if (idxNum & 0x00002) != 0 {
 17985  			mxGen--
 17986  		}
 17987  	}
 17988  	if (idxNum & 0x00f00) != 0 {
 17989  		zTableName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>8)&0x0f))*4)))
 17990  		(*closure_cursor)(unsafe.Pointer(pCur)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zTableName))
 17991  	}
 17992  	if (idxNum & 0x0f000) != 0 {
 17993  		zIdColumn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>12)&0x0f))*4)))
 17994  		(*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zIdColumn))
 17995  	}
 17996  	if (idxNum & 0x0f0000) != 0 {
 17997  		zParentColumn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(((idxNum>>16)&0x0f))*4)))
 17998  		(*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zParentColumn))
 17999  	}
 18000  
 18001  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 18002  		ts+4198, /* "SELECT \"%w\".\"%w\"..." */
 18003  		libc.VaList(bp+24, zTableName, zIdColumn, zTableName, zTableName, zParentColumn))
 18004  	if zSql == uintptr(0) {
 18005  		return SQLITE_NOMEM
 18006  	} else {
 18007  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*closure_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, bp+80 /* &pStmt */, uintptr(0))
 18008  		sqlite3.Xsqlite3_free(tls, zSql)
 18009  		if rc != 0 {
 18010  			sqlite3.Xsqlite3_free(tls, (*closure_vtab)(unsafe.Pointer(pVtab)).Fbase.FzErrMsg)
 18011  			(*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)))
 18012  			return rc
 18013  		}
 18014  	}
 18015  	if rc == SQLITE_OK {
 18016  		rc = closureInsertNode(tls, bp+72 /* &sQueue */, pCur, iRoot, 0)
 18017  	}
 18018  	for (libc.AssignUintptr(&pAvl, queuePull(tls, bp+72 /* &sQueue */))) != uintptr(0) {
 18019  		if (*closure_avl)(unsafe.Pointer(pAvl)).FiGeneration >= mxGen {
 18020  			continue
 18021  		}
 18022  		sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 1, (*closure_avl)(unsafe.Pointer(pAvl)).Fid)
 18023  		for (rc == SQLITE_OK) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */))) == SQLITE_ROW) {
 18024  			if sqlite3.Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 0) == SQLITE_INTEGER {
 18025  				var iNew sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 0)
 18026  				if closureAvlSearch(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure, iNew) == uintptr(0) {
 18027  					rc = closureInsertNode(tls, bp+72 /* &sQueue */, pCur, iNew, ((*closure_avl)(unsafe.Pointer(pAvl)).FiGeneration + 1))
 18028  				}
 18029  			}
 18030  		}
 18031  		sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 18032  	}
 18033  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 18034  	if rc == SQLITE_OK {
 18035  		(*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent = closureAvlFirst(tls, (*closure_cursor)(unsafe.Pointer(pCur)).FpClosure)
 18036  	}
 18037  
 18038  	return rc
 18039  }
 18040  
 18041  // Only the word and distance columns have values.  All other columns
 18042  // return NULL
 18043  func closureColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* closure.c:743:12: */
 18044  	var pCur uintptr = cur
 18045  	switch i {
 18046  	case CLOSURE_COL_ID:
 18047  		{
 18048  			sqlite3.Xsqlite3_result_int64(tls, ctx, (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).Fid)
 18049  			break
 18050  
 18051  		}
 18052  	case CLOSURE_COL_DEPTH:
 18053  		{
 18054  			sqlite3.Xsqlite3_result_int(tls, ctx, (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).FiGeneration)
 18055  			break
 18056  
 18057  		}
 18058  	case CLOSURE_COL_ROOT:
 18059  		{
 18060  			sqlite3.Xsqlite3_result_null(tls, ctx)
 18061  			break
 18062  
 18063  		}
 18064  	case CLOSURE_COL_TABLENAME:
 18065  		{
 18066  			sqlite3.Xsqlite3_result_text(tls, ctx,
 18067  				func() uintptr {
 18068  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName != 0 {
 18069  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzTableName
 18070  					}
 18071  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzTableName
 18072  				}(),
 18073  				-1, libc.UintptrFromInt32(-1))
 18074  			break
 18075  
 18076  		}
 18077  	case CLOSURE_COL_IDCOLUMN:
 18078  		{
 18079  			sqlite3.Xsqlite3_result_text(tls, ctx,
 18080  				func() uintptr {
 18081  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn != 0 {
 18082  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzIdColumn
 18083  					}
 18084  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzIdColumn
 18085  				}(),
 18086  				-1, libc.UintptrFromInt32(-1))
 18087  			break
 18088  
 18089  		}
 18090  	case CLOSURE_COL_PARENTCOLUMN:
 18091  		{
 18092  			sqlite3.Xsqlite3_result_text(tls, ctx,
 18093  				func() uintptr {
 18094  					if (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn != 0 {
 18095  						return (*closure_cursor)(unsafe.Pointer(pCur)).FzParentColumn
 18096  					}
 18097  					return (*closure_vtab)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpVtab)).FzParentColumn
 18098  				}(),
 18099  				-1, libc.UintptrFromInt32(-1))
 18100  			break
 18101  
 18102  		}
 18103  	}
 18104  	return SQLITE_OK
 18105  }
 18106  
 18107  // The rowid.  For the closure table, this is the same as the "id" column.
 18108  func closureRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* closure.c:783:12: */
 18109  	var pCur uintptr = cur
 18110  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*closure_avl)(unsafe.Pointer((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent)).Fid
 18111  	return SQLITE_OK
 18112  }
 18113  
 18114  // EOF indicator
 18115  func closureEof(tls *libc.TLS, cur uintptr) int32 { /* closure.c:792:12: */
 18116  	var pCur uintptr = cur
 18117  	return (libc.Bool32((*closure_cursor)(unsafe.Pointer(pCur)).FpCurrent == uintptr(0)))
 18118  }
 18119  
 18120  // Search for terms of these forms:
 18121  //
 18122  //   (A)    root = $root
 18123  //   (B1)   depth < $depth
 18124  //   (B2)   depth <= $depth
 18125  //   (B3)   depth = $depth
 18126  //   (C)    tablename = $tablename
 18127  //   (D)    idcolumn = $idcolumn
 18128  //   (E)    parentcolumn = $parentcolumn
 18129  //
 18130  //
 18131  //
 18132  //   idxNum       meaning
 18133  //   ----------   ------------------------------------------------------
 18134  //   0x00000001   Term of the form (A) found
 18135  //   0x00000002   The term of bit-2 is like (B1)
 18136  //   0x000000f0   Index in filter.argv[] of $depth.  0 if not used.
 18137  //   0x00000f00   Index in filter.argv[] of $tablename.  0 if not used.
 18138  //   0x0000f000   Index in filter.argv[] of $idcolumn.  0 if not used
 18139  //   0x000f0000   Index in filter.argv[] of $parentcolumn.  0 if not used.
 18140  //
 18141  // There must be a term of type (A).  If there is not, then the index type
 18142  // is 0 and the query will return an empty set.
 18143  func closureBestIndex(tls *libc.TLS, pTab uintptr, pIdxInfo uintptr) int32 { /* closure.c:822:12: */
 18144  	var iPlan int32 = 0
 18145  	var i int32
 18146  	var idx int32 = 1
 18147  	var pConstraint uintptr
 18148  	var pVtab uintptr = pTab
 18149  	var rCost float64 = 10000000.0
 18150  
 18151  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 18152  	i = 0
 18153  __1:
 18154  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 18155  		goto __3
 18156  	}
 18157  	{
 18158  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 18159  			goto __2
 18160  		}
 18161  		if (((iPlan & 1) == 0) &&
 18162  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_ROOT)) &&
 18163  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 18164  			iPlan = iPlan | (1)
 18165  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 18166  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 18167  			rCost = rCost / (100.0)
 18168  		}
 18169  		if (((iPlan & 0x0000f0) == 0) &&
 18170  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_DEPTH)) &&
 18171  			(((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 18172  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) ||
 18173  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ)) {
 18174  			iPlan = iPlan | (idx << 4)
 18175  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 18176  			if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT {
 18177  				iPlan = iPlan | (0x000002)
 18178  			}
 18179  			rCost = rCost / (5.0)
 18180  		}
 18181  		if (((iPlan & 0x000f00) == 0) &&
 18182  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_TABLENAME)) &&
 18183  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 18184  			iPlan = iPlan | (idx << 8)
 18185  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 18186  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 18187  			rCost = rCost / (5.0)
 18188  		}
 18189  		if (((iPlan & 0x00f000) == 0) &&
 18190  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_IDCOLUMN)) &&
 18191  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 18192  			iPlan = iPlan | (idx << 12)
 18193  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 18194  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 18195  		}
 18196  		if (((iPlan & 0x0f0000) == 0) &&
 18197  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == CLOSURE_COL_PARENTCOLUMN)) &&
 18198  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 18199  			iPlan = iPlan | (idx << 16)
 18200  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = libc.PreIncInt32(&idx, 1)
 18201  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 18202  		}
 18203  
 18204  	}
 18205  	goto __2
 18206  __2:
 18207  	i++
 18208  	pConstraint += 12
 18209  	goto __1
 18210  	goto __3
 18211  __3:
 18212  	;
 18213  	if ((((*closure_vtab)(unsafe.Pointer(pVtab)).FzTableName == uintptr(0)) && ((iPlan & 0x000f00) == 0)) ||
 18214  		(((*closure_vtab)(unsafe.Pointer(pVtab)).FzIdColumn == uintptr(0)) && ((iPlan & 0x00f000) == 0))) ||
 18215  		(((*closure_vtab)(unsafe.Pointer(pVtab)).FzParentColumn == uintptr(0)) && ((iPlan & 0x0f0000) == 0)) {
 18216  		// All of tablename, idcolumn, and parentcolumn must be specified
 18217  		// in either the CREATE VIRTUAL TABLE or in the WHERE clause constraints
 18218  		// or else the result is an empty set.
 18219  		iPlan = 0
 18220  	}
 18221  	if (iPlan & 1) == 0 {
 18222  		// If there is no usable "root=?" term, then set the index-type to 0.
 18223  		// Also clear any argvIndex variables already set. This is necessary
 18224  		// to prevent the core from throwing an "xBestIndex malfunction error"
 18225  		// error (because the argvIndex values are not contiguously assigned
 18226  		// starting from 1).
 18227  		rCost = rCost * (1e30)
 18228  		i = 0
 18229  	__4:
 18230  		if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 18231  			goto __6
 18232  		}
 18233  		{
 18234  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 0
 18235  
 18236  		}
 18237  		goto __5
 18238  	__5:
 18239  		i++
 18240  		pConstraint += 12
 18241  		goto __4
 18242  		goto __6
 18243  	__6:
 18244  		;
 18245  		iPlan = 0
 18246  	}
 18247  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 18248  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 18249  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == CLOSURE_COL_ID)) &&
 18250  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 18251  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 18252  	}
 18253  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = rCost
 18254  
 18255  	return SQLITE_OK
 18256  }
 18257  
 18258  // A virtual table module that implements the "transitive_closure".
 18259  var closureModule = sqlite3_module{ // iVersion
 18260  	FxCreate:     0, // xCreate
 18261  	FxConnect:    0, // xConnect
 18262  	FxBestIndex:  0, // xBestIndex
 18263  	FxDisconnect: 0, // xDisconnect
 18264  	FxDestroy:    0, // xDestroy
 18265  	FxOpen:       0, // xOpen - open a cursor
 18266  	FxClose:      0, // xClose - close a cursor
 18267  	FxFilter:     0, // xFilter - configure scan constraints
 18268  	FxNext:       0, // xNext - advance a cursor
 18269  	FxEof:        0, // xEof - check for end of scan
 18270  	FxColumn:     0, // xColumn - read data
 18271  	FxRowid:      0, // xShadowName
 18272  } /* closure.c:918:23 */
 18273  
 18274  // Register the closure virtual table
 18275  func sqlite3_closure_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* closure.c:953:5: */
 18276  	var rc int32 = SQLITE_OK
 18277  	_ = pApi
 18278  
 18279  	_ = pzErrMsg
 18280  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4244 /* "transitive_closu..." */, uintptr(unsafe.Pointer(&closureModule)), uintptr(0))
 18281  	return rc
 18282  }
 18283  
 18284  // If we are compiling with optimizing read this file.  It contains
 18285  //    several optimizing inline functions and macros.
 18286  
 18287  // A macro to hint to the compiler that a function should not be
 18288  // inlined.
 18289  
 18290  // Max size of the error message in a CsvReader
 18291  
 18292  // Size of the CsvReader input buffer
 18293  
 18294  // A context object used when read a CSV file.
 18295  type CsvReader1 = struct {
 18296  	Fin        uintptr
 18297  	Fz         uintptr
 18298  	Fn         int32
 18299  	FnAlloc    int32
 18300  	FnLine     int32
 18301  	FbNotFirst int32
 18302  	FcTerm     int32
 18303  	FiIn       size_t
 18304  	FnIn       size_t
 18305  	FzIn       uintptr
 18306  	FzErr      [200]int8
 18307  } /* csv.c:73:9 */
 18308  
 18309  // If we are compiling with optimizing read this file.  It contains
 18310  //    several optimizing inline functions and macros.
 18311  
 18312  // A macro to hint to the compiler that a function should not be
 18313  // inlined.
 18314  
 18315  // Max size of the error message in a CsvReader
 18316  
 18317  // Size of the CsvReader input buffer
 18318  
 18319  // A context object used when read a CSV file.
 18320  type CsvReader = CsvReader1 /* csv.c:73:26 */
 18321  
 18322  // Initialize a CsvReader object
 18323  func csv_reader_init(tls *libc.TLS, p uintptr) { /* csv.c:89:13: */
 18324  	(*CsvReader)(unsafe.Pointer(p)).Fin = uintptr(0)
 18325  	(*CsvReader)(unsafe.Pointer(p)).Fz = uintptr(0)
 18326  	(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 18327  	(*CsvReader)(unsafe.Pointer(p)).FnAlloc = 0
 18328  	(*CsvReader)(unsafe.Pointer(p)).FnLine = 0
 18329  	(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 0
 18330  	(*CsvReader)(unsafe.Pointer(p)).FnIn = size_t(0)
 18331  	(*CsvReader)(unsafe.Pointer(p)).FzIn = uintptr(0)
 18332  	*(*int8)(unsafe.Pointer((p + 40 /* &.zErr */))) = int8(0)
 18333  }
 18334  
 18335  // Close and reset a CsvReader object
 18336  func csv_reader_reset(tls *libc.TLS, p uintptr) { /* csv.c:102:13: */
 18337  	if (*CsvReader)(unsafe.Pointer(p)).Fin != 0 {
 18338  		libc.Xfclose(tls, (*CsvReader)(unsafe.Pointer(p)).Fin)
 18339  		sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)
 18340  	}
 18341  	sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).Fz)
 18342  	csv_reader_init(tls, p)
 18343  }
 18344  
 18345  // Report an error on a CsvReader
 18346  func csv_errmsg(tls *libc.TLS, p uintptr, zFormat uintptr, va uintptr) { /* csv.c:112:13: */
 18347  	var ap va_list
 18348  	_ = ap
 18349  	ap = va
 18350  	sqlite3.Xsqlite3_vsnprintf(tls, CSV_MXERR, p+40 /* &.zErr */, zFormat, ap)
 18351  	_ = ap
 18352  }
 18353  
 18354  // Open the file associated with a CsvReader
 18355  // Return the number of errors.
 18356  func csv_reader_open(tls *libc.TLS, p uintptr, zFilename uintptr, zData uintptr) int32 { /* csv.c:122:12: */
 18357  	bp := tls.Alloc(8)
 18358  	defer tls.Free(8)
 18359  
 18360  	if zFilename != 0 {
 18361  		(*CsvReader)(unsafe.Pointer(p)).FzIn = sqlite3.Xsqlite3_malloc(tls, CSV_INBUFSZ)
 18362  		if (*CsvReader)(unsafe.Pointer(p)).FzIn == uintptr(0) {
 18363  			csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 18364  			return 1
 18365  		}
 18366  		(*CsvReader)(unsafe.Pointer(p)).Fin = libc.Xfopen(tls, zFilename, ts+4263 /* "rb" */)
 18367  		if (*CsvReader)(unsafe.Pointer(p)).Fin == uintptr(0) {
 18368  			sqlite3.Xsqlite3_free(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn)
 18369  			csv_reader_reset(tls, p)
 18370  			csv_errmsg(tls, p, ts+4266 /* "cannot open '%s'..." */, libc.VaList(bp, zFilename))
 18371  			return 1
 18372  		}
 18373  	} else {
 18374  
 18375  		(*CsvReader)(unsafe.Pointer(p)).FzIn = zData
 18376  		(*CsvReader)(unsafe.Pointer(p)).FnIn = libc.Xstrlen(tls, zData)
 18377  	}
 18378  	return 0
 18379  }
 18380  
 18381  // The input buffer has overflowed.  Refill the input buffer, then
 18382  // return the next character
 18383  func csv_getc_refill(tls *libc.TLS, p uintptr) int32 { /* csv.c:151:25: */
 18384  	var got size_t
 18385  
 18386  	// Only called on an empty input buffer
 18387  	// Only called if reading froma file
 18388  
 18389  	got = libc.Xfread(tls, (*CsvReader)(unsafe.Pointer(p)).FzIn, uint32(1), uint32(CSV_INBUFSZ), (*CsvReader)(unsafe.Pointer(p)).Fin)
 18390  	if got == size_t(0) {
 18391  		return -1
 18392  	}
 18393  	(*CsvReader)(unsafe.Pointer(p)).FnIn = got
 18394  	(*CsvReader)(unsafe.Pointer(p)).FiIn = size_t(1)
 18395  	return int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).FzIn)))
 18396  }
 18397  
 18398  // Return the next character of input.  Return EOF at end of input.
 18399  func csv_getc(tls *libc.TLS, p uintptr) int32 { /* csv.c:165:12: */
 18400  	if (*CsvReader)(unsafe.Pointer(p)).FiIn >= (*CsvReader)(unsafe.Pointer(p)).FnIn {
 18401  		if (*CsvReader)(unsafe.Pointer(p)).Fin != uintptr(0) {
 18402  			return csv_getc_refill(tls, p)
 18403  		}
 18404  		return -1
 18405  	}
 18406  	return int32(*(*uint8)(unsafe.Pointer(((*CsvReader)(unsafe.Pointer(p)).FzIn) + uintptr(libc.PostIncUint32(&(*CsvReader)(unsafe.Pointer(p)).FiIn, 1)))))
 18407  }
 18408  
 18409  // Increase the size of p->z and append character c to the end.
 18410  // Return 0 on success and non-zero if there is an OOM error
 18411  func csv_resize_and_append(tls *libc.TLS, p uintptr, c int8) int32 { /* csv.c:175:25: */
 18412  	var zNew uintptr
 18413  	var nNew int32 = (((*CsvReader)(unsafe.Pointer(p)).FnAlloc * 2) + 100)
 18414  	zNew = sqlite3.Xsqlite3_realloc64(tls, (*CsvReader)(unsafe.Pointer(p)).Fz, uint64(nNew))
 18415  	if zNew != 0 {
 18416  		(*CsvReader)(unsafe.Pointer(p)).Fz = zNew
 18417  		(*CsvReader)(unsafe.Pointer(p)).FnAlloc = nNew
 18418  		*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*CsvReader)(unsafe.Pointer(p)).Fn, 1)))) = c
 18419  		return 0
 18420  	} else {
 18421  		csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 18422  		return 1
 18423  	}
 18424  	return int32(0)
 18425  }
 18426  
 18427  // Append a single character to the CsvReader.z[] array.
 18428  // Return 0 on success and non-zero if there is an OOM error
 18429  func csv_append(tls *libc.TLS, p uintptr, c int8) int32 { /* csv.c:192:12: */
 18430  	if (*CsvReader)(unsafe.Pointer(p)).Fn >= ((*CsvReader)(unsafe.Pointer(p)).FnAlloc - 1) {
 18431  		return csv_resize_and_append(tls, p, c)
 18432  	}
 18433  	*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*CsvReader)(unsafe.Pointer(p)).Fn, 1)))) = c
 18434  	return 0
 18435  }
 18436  
 18437  // Read a single field of CSV text.  Compatible with rfc4180 and extended
 18438  // with the option of having a separator other than ",".
 18439  //
 18440  //   +  Input comes from p->in.
 18441  //   +  Store results in p->z of length p->n.  Space to hold p->z comes
 18442  //      from sqlite3_malloc64().
 18443  //   +  Keep track of the line number in p->nLine.
 18444  //   +  Store the character that terminates the field in p->cTerm.  Store
 18445  //      EOF on end-of-file.
 18446  //
 18447  // Return 0 at EOF or on OOM.  On EOF, the p->cTerm character will have
 18448  // been set to EOF.
 18449  func csv_read_one_field(tls *libc.TLS, p uintptr) uintptr { /* csv.c:211:13: */
 18450  	bp := tls.Alloc(32)
 18451  	defer tls.Free(32)
 18452  
 18453  	var c int32
 18454  	(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 18455  	c = csv_getc(tls, p)
 18456  	if c == (-1) {
 18457  		(*CsvReader)(unsafe.Pointer(p)).FcTerm = -1
 18458  		return uintptr(0)
 18459  	}
 18460  	if c == '"' {
 18461  		var pc int32
 18462  		var ppc int32
 18463  		var startLine int32 = (*CsvReader)(unsafe.Pointer(p)).FnLine
 18464  		pc = libc.AssignInt32(&ppc, 0)
 18465  		for 1 != 0 {
 18466  			c = csv_getc(tls, p)
 18467  			if (c <= '"') || (pc == '"') {
 18468  				if c == '\n' {
 18469  					(*CsvReader)(unsafe.Pointer(p)).FnLine++
 18470  				}
 18471  				if c == '"' {
 18472  					if pc == '"' {
 18473  						pc = 0
 18474  						continue
 18475  					}
 18476  				}
 18477  				if ((((c == ',') && (pc == '"')) ||
 18478  					((c == '\n') && (pc == '"'))) ||
 18479  					(((c == '\n') && (pc == '\r')) && (ppc == '"'))) ||
 18480  					((c == (-1)) && (pc == '"')) {
 18481  					for ok := true; ok; ok = (int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr((*CsvReader)(unsafe.Pointer(p)).Fn)))) != '"') {
 18482  						(*CsvReader)(unsafe.Pointer(p)).Fn--
 18483  					}
 18484  					(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 18485  					break
 18486  				}
 18487  				if (pc == '"') && (c != '\r') {
 18488  					csv_errmsg(tls, p, ts+4295 /* "line %d: unescap..." */, libc.VaList(bp, (*CsvReader)(unsafe.Pointer(p)).FnLine, '"'))
 18489  					break
 18490  				}
 18491  				if c == (-1) {
 18492  					csv_errmsg(tls, p, ts+4327, /* "line %d: untermi..." */
 18493  						libc.VaList(bp+16, startLine, '"'))
 18494  					(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 18495  					break
 18496  				}
 18497  			}
 18498  			if csv_append(tls, p, int8(c)) != 0 {
 18499  				return uintptr(0)
 18500  			}
 18501  			ppc = pc
 18502  			pc = c
 18503  		}
 18504  	} else {
 18505  		// If this is the first field being parsed and it begins with the
 18506  		// UTF-8 BOM  (0xEF BB BF) then skip the BOM
 18507  		if ((c & 0xff) == 0xef) && ((*CsvReader)(unsafe.Pointer(p)).FbNotFirst == 0) {
 18508  			csv_append(tls, p, int8(c))
 18509  			c = csv_getc(tls, p)
 18510  			if (c & 0xff) == 0xbb {
 18511  				csv_append(tls, p, int8(c))
 18512  				c = csv_getc(tls, p)
 18513  				if (c & 0xff) == 0xbf {
 18514  					(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 1
 18515  					(*CsvReader)(unsafe.Pointer(p)).Fn = 0
 18516  					return csv_read_one_field(tls, p)
 18517  				}
 18518  			}
 18519  		}
 18520  		for (c > ',') || (((c != (-1)) && (c != ',')) && (c != '\n')) {
 18521  			if csv_append(tls, p, int8(c)) != 0 {
 18522  				return uintptr(0)
 18523  			}
 18524  			c = csv_getc(tls, p)
 18525  		}
 18526  		if c == '\n' {
 18527  			(*CsvReader)(unsafe.Pointer(p)).FnLine++
 18528  			if ((*CsvReader)(unsafe.Pointer(p)).Fn > 0) && (int32(*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr(((*CsvReader)(unsafe.Pointer(p)).Fn - 1))))) == '\r') {
 18529  				(*CsvReader)(unsafe.Pointer(p)).Fn--
 18530  			}
 18531  		}
 18532  		(*CsvReader)(unsafe.Pointer(p)).FcTerm = int32(int8(c))
 18533  	}
 18534  	if (*CsvReader)(unsafe.Pointer(p)).Fz != 0 {
 18535  		*(*int8)(unsafe.Pointer((*CsvReader)(unsafe.Pointer(p)).Fz + uintptr((*CsvReader)(unsafe.Pointer(p)).Fn))) = int8(0)
 18536  	}
 18537  	(*CsvReader)(unsafe.Pointer(p)).FbNotFirst = 1
 18538  	return (*CsvReader)(unsafe.Pointer(p)).Fz
 18539  }
 18540  
 18541  // An instance of the CSV virtual table
 18542  type CsvTable1 = struct {
 18543  	Fbase      sqlite3_vtab
 18544  	FzFilename uintptr
 18545  	FzData     uintptr
 18546  	FiStart    int32
 18547  	FnCol      int32
 18548  	FtstFlags  uint32
 18549  } /* csv.c:307:9 */
 18550  
 18551  // An instance of the CSV virtual table
 18552  type CsvTable = CsvTable1 /* csv.c:314:3 */
 18553  
 18554  // Allowed values for tstFlags
 18555  
 18556  // A cursor for the CSV virtual table
 18557  type CsvCursor1 = struct {
 18558  	Fbase   sqlite3_vtab_cursor
 18559  	Frdr    CsvReader
 18560  	FazVal  uintptr
 18561  	FaLen   uintptr
 18562  	_       [4]byte
 18563  	FiRowid sqlite3_int64
 18564  } /* csv.c:320:9 */
 18565  
 18566  // Allowed values for tstFlags
 18567  
 18568  // A cursor for the CSV virtual table
 18569  type CsvCursor = CsvCursor1 /* csv.c:326:3 */
 18570  
 18571  // Transfer error message text from a reader into a CsvTable
 18572  func csv_xfer_error(tls *libc.TLS, pTab uintptr, pRdr uintptr) { /* csv.c:329:13: */
 18573  	bp := tls.Alloc(8)
 18574  	defer tls.Free(8)
 18575  
 18576  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(pTab)).Fbase.FzErrMsg)
 18577  	(*CsvTable)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, pRdr+40 /* &.zErr */))
 18578  }
 18579  
 18580  // This method is the destructor fo a CsvTable object.
 18581  func csvtabDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* csv.c:337:12: */
 18582  	var p uintptr = pVtab
 18583  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(p)).FzFilename)
 18584  	sqlite3.Xsqlite3_free(tls, (*CsvTable)(unsafe.Pointer(p)).FzData)
 18585  	sqlite3.Xsqlite3_free(tls, p)
 18586  	return SQLITE_OK
 18587  }
 18588  
 18589  // Skip leading whitespace.  Return a pointer to the first non-whitespace
 18590  // character, or to the zero terminator if the string has only whitespace
 18591  func csv_skip_whitespace(tls *libc.TLS, z uintptr) uintptr { /* csv.c:347:19: */
 18592  	for (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(z)))))*2))) & int32(_ISspace)) != 0 {
 18593  		z++
 18594  	}
 18595  	return z
 18596  }
 18597  
 18598  // Remove trailing whitespace from the end of string z[]
 18599  func csv_trim_whitespace(tls *libc.TLS, z uintptr) { /* csv.c:353:13: */
 18600  	var n size_t = libc.Xstrlen(tls, z)
 18601  	for (n > size_t(0)) && ((int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(z + uintptr(n))))))*2))) & int32(_ISspace)) != 0) {
 18602  		n--
 18603  	}
 18604  	*(*int8)(unsafe.Pointer(z + uintptr(n))) = int8(0)
 18605  }
 18606  
 18607  // Dequote the string
 18608  func csv_dequote(tls *libc.TLS, z uintptr) { /* csv.c:360:13: */
 18609  	var j int32
 18610  	var cQuote int8 = *(*int8)(unsafe.Pointer(z))
 18611  	var i size_t
 18612  	var n size_t
 18613  
 18614  	if (int32(cQuote) != '\'') && (int32(cQuote) != '"') {
 18615  		return
 18616  	}
 18617  	n = libc.Xstrlen(tls, z)
 18618  	if (n < size_t(2)) || (int32(*(*int8)(unsafe.Pointer(z + uintptr((n - size_t(1)))))) != int32(*(*int8)(unsafe.Pointer(z)))) {
 18619  		return
 18620  	}
 18621  	i = size_t(1)
 18622  	j = 0
 18623  	for ; i < (n - size_t(1)); i++ {
 18624  		if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(cQuote)) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((i + size_t(1)))))) == int32(cQuote)) {
 18625  			i++
 18626  		}
 18627  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(i)))
 18628  	}
 18629  	*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 18630  }
 18631  
 18632  // Check to see if the string is of the form:  "TAG = VALUE" with optional
 18633  // whitespace before and around tokens.  If it is, return a pointer to the
 18634  // first character of VALUE.  If it is not, return NULL.
 18635  func csv_parameter(tls *libc.TLS, zTag uintptr, nTag int32, z uintptr) uintptr { /* csv.c:379:19: */
 18636  	z = csv_skip_whitespace(tls, z)
 18637  	if libc.Xstrncmp(tls, zTag, z, uint32(nTag)) != 0 {
 18638  		return uintptr(0)
 18639  	}
 18640  	z = csv_skip_whitespace(tls, (z + uintptr(nTag)))
 18641  	if int32(*(*int8)(unsafe.Pointer(z))) != '=' {
 18642  		return uintptr(0)
 18643  	}
 18644  	return csv_skip_whitespace(tls, (z + uintptr(1)))
 18645  }
 18646  
 18647  // Decode a parameter that requires a dequoted string.
 18648  //
 18649  // Return 1 if the parameter is seen, or 0 if not.  1 is returned
 18650  // even if there is an error.  If an error occurs, then an error message
 18651  // is left in p->zErr.  If there are no errors, p->zErr[0]==0.
 18652  func csv_string_parameter(tls *libc.TLS, p uintptr, zParam uintptr, zArg uintptr, pzVal uintptr) int32 { /* csv.c:393:12: */
 18653  	bp := tls.Alloc(16)
 18654  	defer tls.Free(16)
 18655  
 18656  	var zValue uintptr
 18657  	zValue = csv_parameter(tls, zParam, int32(libc.Xstrlen(tls, zParam)), zArg)
 18658  	if zValue == uintptr(0) {
 18659  		return 0
 18660  	}
 18661  	*(*int8)(unsafe.Pointer((p + 40 /* &.zErr */))) = int8(0)
 18662  	if *(*uintptr)(unsafe.Pointer(pzVal)) != 0 {
 18663  		csv_errmsg(tls, p, ts+4366 /* "more than one '%..." */, libc.VaList(bp, zParam))
 18664  		return 1
 18665  	}
 18666  	*(*uintptr)(unsafe.Pointer(pzVal)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zValue))
 18667  	if *(*uintptr)(unsafe.Pointer(pzVal)) == uintptr(0) {
 18668  		csv_errmsg(tls, p, ts+1930 /* "out of memory" */, 0)
 18669  		return 1
 18670  	}
 18671  	csv_trim_whitespace(tls, *(*uintptr)(unsafe.Pointer(pzVal)))
 18672  	csv_dequote(tls, *(*uintptr)(unsafe.Pointer(pzVal)))
 18673  	return 1
 18674  }
 18675  
 18676  // Return 0 if the argument is false and 1 if it is true.  Return -1 if
 18677  // we cannot really tell.
 18678  func csv_boolean(tls *libc.TLS, z uintptr) int32 { /* csv.c:421:12: */
 18679  	if (((sqlite3.Xsqlite3_stricmp(tls, ts+4035 /* "yes" */, z) == 0) ||
 18680  		(sqlite3.Xsqlite3_stricmp(tls, ts+4039 /* "on" */, z) == 0)) ||
 18681  		(sqlite3.Xsqlite3_stricmp(tls, ts+4395 /* "true" */, z) == 0)) ||
 18682  		((int32(*(*int8)(unsafe.Pointer(z))) == '1') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 0)) {
 18683  		return 1
 18684  	}
 18685  	if (((sqlite3.Xsqlite3_stricmp(tls, ts+4400 /* "no" */, z) == 0) ||
 18686  		(sqlite3.Xsqlite3_stricmp(tls, ts+4403 /* "off" */, z) == 0)) ||
 18687  		(sqlite3.Xsqlite3_stricmp(tls, ts+4407 /* "false" */, z) == 0)) ||
 18688  		((int32(*(*int8)(unsafe.Pointer(z))) == '0') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 0)) {
 18689  		return 0
 18690  	}
 18691  	return -1
 18692  }
 18693  
 18694  // Check to see if the string is of the form:  "TAG = BOOLEAN" or just "TAG".
 18695  // If it is, set *pValue to be the value of the boolean ("true" if there is
 18696  // not "= BOOLEAN" component) and return non-zero.  If the input string
 18697  // does not begin with TAG, return zero.
 18698  func csv_boolean_parameter(tls *libc.TLS, zTag uintptr, nTag int32, z uintptr, pValue uintptr) int32 { /* csv.c:444:12: */
 18699  	var b int32
 18700  	z = csv_skip_whitespace(tls, z)
 18701  	if libc.Xstrncmp(tls, zTag, z, uint32(nTag)) != 0 {
 18702  		return 0
 18703  	}
 18704  	z = csv_skip_whitespace(tls, (z + uintptr(nTag)))
 18705  	if int32(*(*int8)(unsafe.Pointer(z))) == 0 {
 18706  		*(*int32)(unsafe.Pointer(pValue)) = 1
 18707  		return 1
 18708  	}
 18709  	if int32(*(*int8)(unsafe.Pointer(z))) != '=' {
 18710  		return 0
 18711  	}
 18712  	z = csv_skip_whitespace(tls, (z + uintptr(1)))
 18713  	b = csv_boolean(tls, z)
 18714  	if b >= 0 {
 18715  		*(*int32)(unsafe.Pointer(pValue)) = b
 18716  		return 1
 18717  	}
 18718  	return 0
 18719  }
 18720  
 18721  // Parameters:
 18722  //    filename=FILENAME          Name of file containing CSV content
 18723  //    data=TEXT                  Direct CSV content.
 18724  //    schema=SCHEMA              Alternative CSV schema.
 18725  //    header=YES|NO              First row of CSV defines the names of
 18726  //                               columns if "yes".  Default "no".
 18727  //    columns=N                  Assume the CSV file contains N columns.
 18728  //
 18729  // Only available if compiled with SQLITE_TEST:
 18730  //
 18731  //    testflags=N                Bitmask of test flags.  Optional
 18732  //
 18733  // If schema= is omitted, then the columns are named "c0", "c1", "c2",
 18734  // and so forth.  If columns=N is omitted, then the file is opened and
 18735  // the number of columns in the first row is counted to determine the
 18736  // column count.  If header=YES, then the first row is skipped.
 18737  func csvtabConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* csv.c:486:12: */
 18738  	bp := tls.Alloc(336)
 18739  	defer tls.Free(336)
 18740  
 18741  	var pNew uintptr  // The CsvTable object to construct
 18742  	var bHeader int32 // header= flags.  -1 means not seen yet
 18743  	var rc int32      // Result code from this routine
 18744  	var i int32
 18745  	var j int32        // Loop counters
 18746  	var tstFlags int32 // Value for testflags=N parameter
 18747  	// var b int32 at bp+332, 4
 18748  	// Value of a boolean parameter
 18749  	var nCol int32 // Value of the columns= parameter
 18750  	// var sRdr CsvReader at bp+80, 240
 18751  
 18752  	// var azPValue [3]uintptr at bp+320, 12
 18753  
 18754  	var z uintptr
 18755  	var zValue uintptr
 18756  	var z1 uintptr
 18757  	var pStr uintptr
 18758  	var zSep uintptr
 18759  	var iCol int32
 18760  	pNew = uintptr(0)
 18761  	bHeader = -1
 18762  	rc = SQLITE_OK
 18763  	tstFlags = 0
 18764  	nCol = -99 // Parameter values
 18765  
 18766  	libc.Xmemset(tls, bp+80 /* &sRdr */, 0, uint32(unsafe.Sizeof(CsvReader{})))
 18767  	libc.Xmemset(tls, bp+320 /* &azPValue[0] */, 0, uint32(unsafe.Sizeof([3]uintptr{})))
 18768  	i = 3
 18769  __1:
 18770  	if !(i < argc) {
 18771  		goto __3
 18772  	}
 18773  	z = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))
 18774  	j = 0
 18775  __4:
 18776  	if !(uint32(j) < (uint32(unsafe.Sizeof(azParam)) / uint32(unsafe.Sizeof(uintptr(0))))) {
 18777  		goto __6
 18778  	}
 18779  	if !(csv_string_parameter(tls, bp+80 /* &sRdr */, azParam[j], z, (bp+320 /* &azPValue */ +uintptr(j)*4)) != 0) {
 18780  		goto __7
 18781  	}
 18782  	goto __6
 18783  __7:
 18784  	;
 18785  	goto __5
 18786  __5:
 18787  	j++
 18788  	goto __4
 18789  	goto __6
 18790  __6:
 18791  	;
 18792  	if !(uint32(j) < (uint32(unsafe.Sizeof(azParam)) / uint32(unsafe.Sizeof(uintptr(0))))) {
 18793  		goto __8
 18794  	}
 18795  	if !(*(*int8)(unsafe.Pointer((bp + 80 /* &sRdr */ + 40 /* &.zErr */))) != 0) {
 18796  		goto __10
 18797  	}
 18798  	goto csvtab_connect_error
 18799  __10:
 18800  	;
 18801  	goto __9
 18802  __8:
 18803  	if !(csv_boolean_parameter(tls, ts+4413 /* "header" */, 6, z, bp+332 /* &b */) != 0) {
 18804  		goto __11
 18805  	}
 18806  	if !(bHeader >= 0) {
 18807  		goto __13
 18808  	}
 18809  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4420 /* "more than one 'h..." */, 0)
 18810  	goto csvtab_connect_error
 18811  __13:
 18812  	;
 18813  	bHeader = *(*int32)(unsafe.Pointer(bp + 332 /* b */))
 18814  	goto __12
 18815  __11:
 18816  	if !((libc.AssignUintptr(&zValue, csv_parameter(tls, ts+4453 /* "testflags" */, 9, z))) != uintptr(0)) {
 18817  		goto __14
 18818  	}
 18819  	tstFlags = int32(uint32(libc.Xatoi(tls, zValue)))
 18820  	goto __15
 18821  __14:
 18822  	if !((libc.AssignUintptr(&zValue, csv_parameter(tls, ts+4463 /* "columns" */, 7, z))) != uintptr(0)) {
 18823  		goto __16
 18824  	}
 18825  	if !(nCol > 0) {
 18826  		goto __18
 18827  	}
 18828  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4471 /* "more than one 'c..." */, 0)
 18829  	goto csvtab_connect_error
 18830  __18:
 18831  	;
 18832  	nCol = libc.Xatoi(tls, zValue)
 18833  	if !(nCol <= 0) {
 18834  		goto __19
 18835  	}
 18836  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4505 /* "column= value mu..." */, 0)
 18837  	goto csvtab_connect_error
 18838  __19:
 18839  	;
 18840  	goto __17
 18841  __16:
 18842  
 18843  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4536 /* "bad parameter: '..." */, libc.VaList(bp, z))
 18844  	goto csvtab_connect_error
 18845  __17:
 18846  	;
 18847  __15:
 18848  	;
 18849  __12:
 18850  	;
 18851  __9:
 18852  	;
 18853  	goto __2
 18854  __2:
 18855  	i++
 18856  	goto __1
 18857  	goto __3
 18858  __3:
 18859  	;
 18860  	if !((libc.Bool32((*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */))) == uintptr(0))) == (libc.Bool32((*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 1*4))) == uintptr(0)))) {
 18861  		goto __20
 18862  	}
 18863  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4556 /* "must specify eit..." */, 0)
 18864  	goto csvtab_connect_error
 18865  __20:
 18866  	;
 18867  
 18868  	if !(((nCol <= 0) || (bHeader == 1)) &&
 18869  		(csv_reader_open(tls, bp+80 /* &sRdr */, *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */)), *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 1*4))) != 0)) {
 18870  		goto __21
 18871  	}
 18872  	goto csvtab_connect_error
 18873  __21:
 18874  	;
 18875  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(CsvTable{})))
 18876  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 18877  	if !(pNew == uintptr(0)) {
 18878  		goto __22
 18879  	}
 18880  	goto csvtab_connect_oom
 18881  __22:
 18882  	;
 18883  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(CsvTable{})))
 18884  	if !((*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 2*4))) == uintptr(0)) {
 18885  		goto __23
 18886  	}
 18887  	pStr = sqlite3.Xsqlite3_str_new(tls, uintptr(0))
 18888  	zSep = ts + 489 /* "" */
 18889  	iCol = 0
 18890  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+884 /* "CREATE TABLE x(" */, 0)
 18891  	if !((nCol < 0) && (bHeader < 1)) {
 18892  		goto __25
 18893  	}
 18894  	nCol = 0
 18895  __26:
 18896  	csv_read_one_field(tls, bp+80 /* &sRdr */)
 18897  	nCol++
 18898  	goto __27
 18899  __27:
 18900  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 18901  		goto __26
 18902  	}
 18903  	goto __28
 18904  __28:
 18905  	;
 18906  __25:
 18907  	;
 18908  	if !((nCol > 0) && (bHeader < 1)) {
 18909  		goto __29
 18910  	}
 18911  	iCol = 0
 18912  __31:
 18913  	if !(iCol < nCol) {
 18914  		goto __33
 18915  	}
 18916  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4608 /* "%sc%d TEXT" */, libc.VaList(bp+8, zSep, iCol))
 18917  	zSep = ts + 4619 /* "," */
 18918  	goto __32
 18919  __32:
 18920  	iCol++
 18921  	goto __31
 18922  	goto __33
 18923  __33:
 18924  	;
 18925  	goto __30
 18926  __29:
 18927  __34:
 18928  	z1 = csv_read_one_field(tls, bp+80 /* &sRdr */)
 18929  	if !(((nCol > 0) && (iCol < nCol)) || ((nCol < 0) && (bHeader != 0))) {
 18930  		goto __37
 18931  	}
 18932  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4621 /* "%s\"%w\" TEXT" */, libc.VaList(bp+24, zSep, z1))
 18933  	zSep = ts + 4619 /* "," */
 18934  	iCol++
 18935  __37:
 18936  	;
 18937  	goto __35
 18938  __35:
 18939  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 18940  		goto __34
 18941  	}
 18942  	goto __36
 18943  __36:
 18944  	;
 18945  	if !(nCol < 0) {
 18946  		goto __38
 18947  	}
 18948  	nCol = iCol
 18949  	goto __39
 18950  __38:
 18951  __40:
 18952  	if !(iCol < nCol) {
 18953  		goto __41
 18954  	}
 18955  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+4608 /* "%sc%d TEXT" */, libc.VaList(bp+40, zSep, libc.PreIncInt32(&iCol, 1)))
 18956  	zSep = ts + 4619 /* "," */
 18957  	goto __40
 18958  __41:
 18959  	;
 18960  __39:
 18961  	;
 18962  __30:
 18963  	;
 18964  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol = nCol
 18965  	sqlite3.Xsqlite3_str_appendf(tls, pStr, ts+490 /* ")" */, 0)
 18966  	(*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 2*4))) = sqlite3.Xsqlite3_str_finish(tls, pStr)
 18967  	if !((*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 2*4))) == uintptr(0)) {
 18968  		goto __42
 18969  	}
 18970  	goto csvtab_connect_oom
 18971  __42:
 18972  	;
 18973  	goto __24
 18974  __23:
 18975  	if !(nCol < 0) {
 18976  		goto __43
 18977  	}
 18978  __45:
 18979  	csv_read_one_field(tls, bp+80 /* &sRdr */)
 18980  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol++
 18981  	goto __46
 18982  __46:
 18983  	if (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FcTerm == ',' {
 18984  		goto __45
 18985  	}
 18986  	goto __47
 18987  __47:
 18988  	;
 18989  	goto __44
 18990  __43:
 18991  	(*CsvTable)(unsafe.Pointer(pNew)).FnCol = nCol
 18992  __44:
 18993  	;
 18994  __24:
 18995  	;
 18996  	(*CsvTable)(unsafe.Pointer(pNew)).FzFilename = *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */))
 18997  	(*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */))) = uintptr(0)
 18998  	(*CsvTable)(unsafe.Pointer(pNew)).FzData = *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 1*4))
 18999  	(*(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 1*4))) = uintptr(0)
 19000  	(*CsvTable)(unsafe.Pointer(pNew)).FtstFlags = uint32(tstFlags)
 19001  	if !(bHeader != 1) {
 19002  		goto __48
 19003  	}
 19004  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = 0
 19005  	goto __49
 19006  __48:
 19007  	if !((*CsvTable)(unsafe.Pointer(pNew)).FzData != 0) {
 19008  		goto __50
 19009  	}
 19010  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = int32(int32((*CsvReader)(unsafe.Pointer(bp + 80 /* &sRdr */)).FiIn))
 19011  	goto __51
 19012  __50:
 19013  	(*CsvTable)(unsafe.Pointer(pNew)).FiStart = int32((int32((uint32(libc.Xftell(tls, (*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).Fin)) - uint32((*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FnIn)) + uint32((*CsvReader)(unsafe.Pointer(bp+80 /* &sRdr */)).FiIn))))
 19014  __51:
 19015  	;
 19016  __49:
 19017  	;
 19018  	csv_reader_reset(tls, bp+80 /* &sRdr */)
 19019  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 2*4)))
 19020  	if !(rc != 0) {
 19021  		goto __52
 19022  	}
 19023  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+4633 /* "bad schema: '%s'..." */, libc.VaList(bp+56, *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + 2*4)), sqlite3.Xsqlite3_errmsg(tls, db)))
 19024  	goto csvtab_connect_error
 19025  __52:
 19026  	;
 19027  	i = 0
 19028  __53:
 19029  	if !(uint32(i) < (uint32(unsafe.Sizeof([3]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0))))) {
 19030  		goto __55
 19031  	}
 19032  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + uintptr(i)*4)))
 19033  	goto __54
 19034  __54:
 19035  	i++
 19036  	goto __53
 19037  	goto __55
 19038  __55:
 19039  	;
 19040  	// Rationale for DIRECTONLY:
 19041  	// An attacker who controls a database schema could use this vtab
 19042  	// to exfiltrate sensitive data from other files in the filesystem.
 19043  	// And, recommended practice is to put all CSV virtual tables in the
 19044  	// TEMP namespace, so they should still be usable from within TEMP
 19045  	// views, so there shouldn't be a serious loss of functionality by
 19046  	// prohibiting the use of this vtab from persistent triggers and views.
 19047  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 19048  	return SQLITE_OK
 19049  
 19050  csvtab_connect_oom:
 19051  	rc = SQLITE_NOMEM
 19052  	csv_errmsg(tls, bp+80 /* &sRdr */, ts+1930 /* "out of memory" */, 0)
 19053  
 19054  csvtab_connect_error:
 19055  	if !(pNew != 0) {
 19056  		goto __56
 19057  	}
 19058  	csvtabDisconnect(tls, (pNew /* &.base */))
 19059  __56:
 19060  	;
 19061  	i = 0
 19062  __57:
 19063  	if !(uint32(i) < (uint32(unsafe.Sizeof([3]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0))))) {
 19064  		goto __59
 19065  	}
 19066  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 320 /* &azPValue[0] */ + uintptr(i)*4)))
 19067  	goto __58
 19068  __58:
 19069  	i++
 19070  	goto __57
 19071  	goto __59
 19072  __59:
 19073  	;
 19074  	if !(*(*int8)(unsafe.Pointer((bp + 80 /* &sRdr */ + 40 /* &.zErr */))) != 0) {
 19075  		goto __60
 19076  	}
 19077  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(pzErr)))
 19078  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+72, bp+80 /* &sRdr */ +40 /* &.zErr */))
 19079  __60:
 19080  	;
 19081  	csv_reader_reset(tls, bp+80 /* &sRdr */)
 19082  	if !(rc == SQLITE_OK) {
 19083  		goto __61
 19084  	}
 19085  	rc = SQLITE_ERROR
 19086  __61:
 19087  	;
 19088  	return rc
 19089  }
 19090  
 19091  var azParam = [3]uintptr{
 19092  	ts + 4655 /* "filename" */, ts + 4664 /* "data" */, ts + 4669, /* "schema" */
 19093  } /* csv.c:504:21 */
 19094  
 19095  // Reset the current row content held by a CsvCursor.
 19096  func csvtabCursorRowReset(tls *libc.TLS, pCur uintptr) { /* csv.c:667:13: */
 19097  	var pTab uintptr = (*CsvCursor)(unsafe.Pointer(pCur)).Fbase.FpVtab
 19098  	var i int32
 19099  	for i = 0; i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol; i++ {
 19100  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)))
 19101  		*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)) = uintptr(0)
 19102  		*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = 0
 19103  	}
 19104  }
 19105  
 19106  // The xConnect and xCreate methods do the same thing, but they must be
 19107  // different so that the virtual table is not an eponymous virtual table.
 19108  func csvtabCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* csv.c:681:12: */
 19109  	return csvtabConnect(tls, db, pAux, argc, argv, ppVtab, pzErr)
 19110  }
 19111  
 19112  // Destructor for a CsvCursor.
 19113  func csvtabClose(tls *libc.TLS, cur uintptr) int32 { /* csv.c:694:12: */
 19114  	var pCur uintptr = cur
 19115  	csvtabCursorRowReset(tls, pCur)
 19116  	csv_reader_reset(tls, (pCur + 4 /* &.rdr */))
 19117  	sqlite3.Xsqlite3_free(tls, cur)
 19118  	return SQLITE_OK
 19119  }
 19120  
 19121  // Constructor for a new CsvTable cursor object.
 19122  func csvtabOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* csv.c:705:12: */
 19123  	var pTab uintptr = p
 19124  	var pCur uintptr
 19125  	var nByte size_t
 19126  	nByte = (uint32(unsafe.Sizeof(CsvCursor{})) + ((uint32(unsafe.Sizeof(uintptr(0))) + uint32(unsafe.Sizeof(int32(0)))) * uint32((*CsvTable)(unsafe.Pointer(pTab)).FnCol)))
 19127  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 19128  	if pCur == uintptr(0) {
 19129  		return SQLITE_NOMEM
 19130  	}
 19131  	libc.Xmemset(tls, pCur, 0, nByte)
 19132  	(*CsvCursor)(unsafe.Pointer(pCur)).FazVal = (pCur + 1*264)
 19133  	(*CsvCursor)(unsafe.Pointer(pCur)).FaLen = ((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr((*CsvTable)(unsafe.Pointer(pTab)).FnCol)*4)
 19134  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 19135  	if csv_reader_open(tls, (pCur+4 /* &.rdr */), (*CsvTable)(unsafe.Pointer(pTab)).FzFilename, (*CsvTable)(unsafe.Pointer(pTab)).FzData) != 0 {
 19136  		csv_xfer_error(tls, pTab, (pCur + 4 /* &.rdr */))
 19137  		return SQLITE_ERROR
 19138  	}
 19139  	return SQLITE_OK
 19140  }
 19141  
 19142  // Advance a CsvCursor to its next row of input.
 19143  // Set the EOF marker if we reach the end of input.
 19144  func csvtabNext(tls *libc.TLS, cur uintptr) int32 { /* csv.c:728:12: */
 19145  	var pCur uintptr = cur
 19146  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 19147  	var i int32 = 0
 19148  	var z uintptr
 19149  	for ok := true; ok; ok = ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FcTerm == ',') {
 19150  		z = csv_read_one_field(tls, (pCur + 4 /* &.rdr */))
 19151  		if z == uintptr(0) {
 19152  			break
 19153  		}
 19154  		if i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol {
 19155  			if *(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) < ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1) {
 19156  				var zNew uintptr = sqlite3.Xsqlite3_realloc64(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)), (uint64((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)))
 19157  				if zNew == uintptr(0) {
 19158  					csv_errmsg(tls, (pCur + 4 /* &.rdr */), ts+1930 /* "out of memory" */, 0)
 19159  					csv_xfer_error(tls, pTab, (pCur + 4 /* &.rdr */))
 19160  					break
 19161  				}
 19162  				*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)) = zNew
 19163  				*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = ((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)
 19164  			}
 19165  			libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)), z, (uint32((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fn + 1)))
 19166  			i++
 19167  		}
 19168  	}
 19169  	if (z == uintptr(0)) || (((*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FcTerm == (-1)) && (i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol)) {
 19170  		(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid = int64(-1)
 19171  	} else {
 19172  		(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid++
 19173  		for i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol {
 19174  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)))
 19175  			*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)) = uintptr(0)
 19176  			*(*int32)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FaLen + uintptr(i)*4)) = 0
 19177  			i++
 19178  		}
 19179  	}
 19180  	return SQLITE_OK
 19181  }
 19182  
 19183  // Return values of columns for the row at which the CsvCursor
 19184  // is currently pointing.
 19185  func csvtabColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* csv.c:771:12: */
 19186  	var pCur uintptr = cur
 19187  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 19188  	if ((i >= 0) && (i < (*CsvTable)(unsafe.Pointer(pTab)).FnCol)) && (*(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)) != uintptr(0)) {
 19189  		sqlite3.Xsqlite3_result_text(tls, ctx, *(*uintptr)(unsafe.Pointer((*CsvCursor)(unsafe.Pointer(pCur)).FazVal + uintptr(i)*4)), -1, libc.UintptrFromInt32(-1))
 19190  	}
 19191  	return SQLITE_OK
 19192  }
 19193  
 19194  // Return the rowid for the current row.
 19195  func csvtabRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* csv.c:787:12: */
 19196  	var pCur uintptr = cur
 19197  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*CsvCursor)(unsafe.Pointer(pCur)).FiRowid
 19198  	return SQLITE_OK
 19199  }
 19200  
 19201  // Return TRUE if the cursor has been moved off of the last
 19202  // row of output.
 19203  func csvtabEof(tls *libc.TLS, cur uintptr) int32 { /* csv.c:797:12: */
 19204  	var pCur uintptr = cur
 19205  	return (libc.Bool32((*CsvCursor)(unsafe.Pointer(pCur)).FiRowid < int64(0)))
 19206  }
 19207  
 19208  // Only a full table scan is supported.  So xFilter simply rewinds to
 19209  // the beginning.
 19210  func csvtabFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* csv.c:806:12: */
 19211  	var pCur uintptr = pVtabCursor
 19212  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 19213  	(*CsvCursor)(unsafe.Pointer(pCur)).FiRowid = int64(0)
 19214  	if (*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fin == uintptr(0) {
 19215  
 19216  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FiIn = size_t((*CsvTable)(unsafe.Pointer(pTab)).FiStart)
 19217  	} else {
 19218  		libc.Xfseek(tls, (*CsvCursor)(unsafe.Pointer(pCur)).Frdr.Fin, (*CsvTable)(unsafe.Pointer(pTab)).FiStart, SEEK_SET)
 19219  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FiIn = size_t(0)
 19220  		(*CsvCursor)(unsafe.Pointer(pCur)).Frdr.FnIn = size_t(0)
 19221  	}
 19222  	return csvtabNext(tls, pVtabCursor)
 19223  }
 19224  
 19225  // Only a forward full table scan is supported.  xBestIndex is mostly
 19226  // a no-op.  If CSVTEST_FIDX is set, then the presence of equality
 19227  // constraints lowers the estimated cost, which is fiction, but is useful
 19228  // for testing certain kinds of virtual table behavior.
 19229  func csvtabBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* csv.c:833:12: */
 19230  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1000000)
 19231  	if ((*CsvTable)(unsafe.Pointer((tab))).FtstFlags & uint32(CSVTEST_FIDX)) != uint32(0) {
 19232  		// The usual (and sensible) case is to always do a full table scan.
 19233  		// The code in this branch only runs when testflags=1.  This code
 19234  		// generates an artifical and unrealistic plan which is useful
 19235  		// for testing virtual table logic but is not helpful to real applications.
 19236  		//
 19237  		// Any ==, LIKE, or GLOB constraint is marked as usable by the virtual
 19238  		// table (even though it is not) and the cost of running the virtual table
 19239  		// is reduced from 1 million to just 10.  The constraints are *not* marked
 19240  		// as omittable, however, so the query planner should still generate a
 19241  		// plan that gives a correct answer, even if they plan is not optimal.
 19242  		var i int32
 19243  		var nConst int32 = 0
 19244  		for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 19245  			var op uint8
 19246  			if int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint+uintptr(i)*12)).Fusable) == 0 {
 19247  				continue
 19248  			}
 19249  			op = (*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)).Fop
 19250  			if ((int32(op) == SQLITE_INDEX_CONSTRAINT_EQ) ||
 19251  				(int32(op) == SQLITE_INDEX_CONSTRAINT_LIKE)) ||
 19252  				(int32(op) == SQLITE_INDEX_CONSTRAINT_GLOB) {
 19253  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10)
 19254  				(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(nConst)*8)).FargvIndex = (nConst + 1)
 19255  				nConst++
 19256  			}
 19257  		}
 19258  	}
 19259  	return SQLITE_OK
 19260  }
 19261  
 19262  var CsvModule = sqlite3_module{ // iVersion
 19263  	FxCreate:     0, // xCreate
 19264  	FxConnect:    0, // xConnect
 19265  	FxBestIndex:  0, // xBestIndex
 19266  	FxDisconnect: 0, // xDisconnect
 19267  	FxDestroy:    0, // xDestroy
 19268  	FxOpen:       0, // xOpen - open a cursor
 19269  	FxClose:      0, // xClose - close a cursor
 19270  	FxFilter:     0, // xFilter - configure scan constraints
 19271  	FxNext:       0, // xNext - advance a cursor
 19272  	FxEof:        0, // xEof - check for end of scan
 19273  	FxColumn:     0, // xColumn - read data
 19274  	FxRowid:      0, // xRename
 19275  } /* csv.c:872:23 */
 19276  
 19277  // For virtual table testing, make a version of the CSV virtual table
 19278  // available that has an xUpdate function.  But the xUpdate always returns
 19279  // SQLITE_READONLY since the CSV file is not really writable.
 19280  func csvtabUpdate(tls *libc.TLS, p uintptr, n int32, v uintptr, x uintptr) int32 { /* csv.c:901:12: */
 19281  	return SQLITE_READONLY
 19282  }
 19283  
 19284  var CsvModuleFauxWrite = sqlite3_module{ // iVersion
 19285  	FxCreate:     0, // xCreate
 19286  	FxConnect:    0, // xConnect
 19287  	FxBestIndex:  0, // xBestIndex
 19288  	FxDisconnect: 0, // xDisconnect
 19289  	FxDestroy:    0, // xDestroy
 19290  	FxOpen:       0, // xOpen - open a cursor
 19291  	FxClose:      0, // xClose - close a cursor
 19292  	FxFilter:     0, // xFilter - configure scan constraints
 19293  	FxNext:       0, // xNext - advance a cursor
 19294  	FxEof:        0, // xEof - check for end of scan
 19295  	FxColumn:     0, // xColumn - read data
 19296  	FxRowid:      0, // xRowid - read data
 19297  	FxUpdate:     0, // xRename
 19298  } /* csv.c:904:23 */
 19299  
 19300  // This routine is called when the extension is loaded.  The new
 19301  // CSV virtual table module is registered with the calling database
 19302  // connection.
 19303  func sqlite3_csv_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* csv.c:939:5: */
 19304  	var rc int32
 19305  	_ = pApi
 19306  
 19307  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4676 /* "csv" */, uintptr(unsafe.Pointer(&CsvModule)), uintptr(0))
 19308  	if rc == SQLITE_OK {
 19309  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4680 /* "csv_wr" */, uintptr(unsafe.Pointer(&CsvModuleFauxWrite)), uintptr(0))
 19310  	}
 19311  	return rc
 19312  }
 19313  
 19314  // Floating-point inline functions for stdlib.h.
 19315  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 19316  //    This file is part of the GNU C Library.
 19317  //
 19318  //    The GNU C Library is free software; you can redistribute it and/or
 19319  //    modify it under the terms of the GNU Lesser General Public
 19320  //    License as published by the Free Software Foundation; either
 19321  //    version 2.1 of the License, or (at your option) any later version.
 19322  //
 19323  //    The GNU C Library is distributed in the hope that it will be useful,
 19324  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 19325  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 19326  //    Lesser General Public License for more details.
 19327  //
 19328  //    You should have received a copy of the GNU Lesser General Public
 19329  //    License along with the GNU C Library; if not, see
 19330  //    <http://www.gnu.org/licenses/>.
 19331  
 19332  // Define some macros helping to catch buffer overflows.
 19333  
 19334  // Mark a function parameter as unused, to suppress nuisance compiler
 19335  // warnings.
 19336  
 19337  // A decimal object
 19338  type Decimal1 = struct {
 19339  	Fsign   int8
 19340  	Foom    int8
 19341  	FisNull int8
 19342  	FisInit int8
 19343  	FnDigit int32
 19344  	FnFrac  int32
 19345  	Fa      uintptr
 19346  } /* decimal.c:32:9 */
 19347  
 19348  // Floating-point inline functions for stdlib.h.
 19349  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 19350  //    This file is part of the GNU C Library.
 19351  //
 19352  //    The GNU C Library is free software; you can redistribute it and/or
 19353  //    modify it under the terms of the GNU Lesser General Public
 19354  //    License as published by the Free Software Foundation; either
 19355  //    version 2.1 of the License, or (at your option) any later version.
 19356  //
 19357  //    The GNU C Library is distributed in the hope that it will be useful,
 19358  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 19359  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 19360  //    Lesser General Public License for more details.
 19361  //
 19362  //    You should have received a copy of the GNU Lesser General Public
 19363  //    License along with the GNU C Library; if not, see
 19364  //    <http://www.gnu.org/licenses/>.
 19365  
 19366  // Define some macros helping to catch buffer overflows.
 19367  
 19368  // Mark a function parameter as unused, to suppress nuisance compiler
 19369  // warnings.
 19370  
 19371  // A decimal object
 19372  type Decimal = Decimal1 /* decimal.c:32:24 */
 19373  
 19374  // Release memory held by a Decimal, but do not free the object itself.
 19375  func decimal_clear(tls *libc.TLS, p uintptr) { /* decimal.c:46:13: */
 19376  	sqlite3.Xsqlite3_free(tls, (*Decimal)(unsafe.Pointer(p)).Fa)
 19377  }
 19378  
 19379  // Destroy a Decimal object
 19380  func decimal_free(tls *libc.TLS, p uintptr) { /* decimal.c:53:13: */
 19381  	if p != 0 {
 19382  		decimal_clear(tls, p)
 19383  		sqlite3.Xsqlite3_free(tls, p)
 19384  	}
 19385  }
 19386  
 19387  // Allocate a new Decimal object.  Initialize it to the number given
 19388  // by the input string.
 19389  func decimal_new(tls *libc.TLS, pCtx uintptr, pIn uintptr, nAlt int32, zAlt uintptr) uintptr { /* decimal.c:64:16: */
 19390  	var p uintptr
 19391  	var n int32
 19392  	var i int32
 19393  	var zIn uintptr
 19394  	var iExp int32
 19395  	var j int32
 19396  	var neg int32
 19397  	var c int8
 19398  	var nExtra int32
 19399  	iExp = 0
 19400  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Decimal{})))
 19401  	if !(p == uintptr(0)) {
 19402  		goto __1
 19403  	}
 19404  	goto new_no_mem
 19405  __1:
 19406  	;
 19407  	(*Decimal)(unsafe.Pointer(p)).Fsign = int8(0)
 19408  	(*Decimal)(unsafe.Pointer(p)).Foom = int8(0)
 19409  	(*Decimal)(unsafe.Pointer(p)).FisInit = int8(1)
 19410  	(*Decimal)(unsafe.Pointer(p)).FisNull = int8(0)
 19411  	(*Decimal)(unsafe.Pointer(p)).FnDigit = 0
 19412  	(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 19413  	if !(zAlt != 0) {
 19414  		goto __2
 19415  	}
 19416  	n = nAlt
 19417  	zIn = zAlt
 19418  	goto __3
 19419  __2:
 19420  	if !(sqlite3.Xsqlite3_value_type(tls, pIn) == SQLITE_NULL) {
 19421  		goto __4
 19422  	}
 19423  	(*Decimal)(unsafe.Pointer(p)).Fa = uintptr(0)
 19424  	(*Decimal)(unsafe.Pointer(p)).FisNull = int8(1)
 19425  	return p
 19426  __4:
 19427  	;
 19428  	n = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 19429  	zIn = sqlite3.Xsqlite3_value_text(tls, pIn)
 19430  __3:
 19431  	;
 19432  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_malloc64(tls, (uint64(n + 1)))
 19433  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 19434  		goto __5
 19435  	}
 19436  	goto new_no_mem
 19437  __5:
 19438  	;
 19439  	i = 0
 19440  __6:
 19441  	if !((int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))))*2))) & int32(_ISspace)) != 0) {
 19442  		goto __8
 19443  	}
 19444  	goto __7
 19445  __7:
 19446  	i++
 19447  	goto __6
 19448  	goto __8
 19449  __8:
 19450  	;
 19451  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '-') {
 19452  		goto __9
 19453  	}
 19454  	(*Decimal)(unsafe.Pointer(p)).Fsign = int8(1)
 19455  	i++
 19456  	goto __10
 19457  __9:
 19458  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '+') {
 19459  		goto __11
 19460  	}
 19461  	i++
 19462  __11:
 19463  	;
 19464  __10:
 19465  	;
 19466  __12:
 19467  	if !((i < n) && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(i)))) == '0')) {
 19468  		goto __13
 19469  	}
 19470  	i++
 19471  	goto __12
 19472  __13:
 19473  	;
 19474  __14:
 19475  	if !(i < n) {
 19476  		goto __15
 19477  	}
 19478  	c = int8(*(*uint8)(unsafe.Pointer(zIn + uintptr(i))))
 19479  	if !((int32(c) >= '0') && (int32(c) <= '9')) {
 19480  		goto __16
 19481  	}
 19482  	*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(libc.PostIncInt32(&(*Decimal)(unsafe.Pointer(p)).FnDigit, 1)))) = (int8(int32(c) - '0'))
 19483  	goto __17
 19484  __16:
 19485  	if !(int32(c) == '.') {
 19486  		goto __18
 19487  	}
 19488  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit + 1)
 19489  	goto __19
 19490  __18:
 19491  	if !((int32(c) == 'e') || (int32(c) == 'E')) {
 19492  		goto __20
 19493  	}
 19494  	j = (i + 1)
 19495  	neg = 0
 19496  	if !(j >= n) {
 19497  		goto __21
 19498  	}
 19499  	goto __15
 19500  __21:
 19501  	;
 19502  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) == '-') {
 19503  		goto __22
 19504  	}
 19505  	neg = 1
 19506  	j++
 19507  	goto __23
 19508  __22:
 19509  	if !(int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) == '+') {
 19510  		goto __24
 19511  	}
 19512  	j++
 19513  __24:
 19514  	;
 19515  __23:
 19516  	;
 19517  __25:
 19518  	if !((j < n) && (iExp < 1000000)) {
 19519  		goto __26
 19520  	}
 19521  	if !((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) >= '0') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j)))) <= '9')) {
 19522  		goto __27
 19523  	}
 19524  	iExp = (((iExp * 10) + int32(*(*uint8)(unsafe.Pointer(zIn + uintptr(j))))) - '0')
 19525  __27:
 19526  	;
 19527  	j++
 19528  	goto __25
 19529  __26:
 19530  	;
 19531  	if !(neg != 0) {
 19532  		goto __28
 19533  	}
 19534  	iExp = -iExp
 19535  __28:
 19536  	;
 19537  	goto __15
 19538  __20:
 19539  	;
 19540  __19:
 19541  	;
 19542  __17:
 19543  	;
 19544  	i++
 19545  	goto __14
 19546  __15:
 19547  	;
 19548  	if !((*Decimal)(unsafe.Pointer(p)).FnFrac != 0) {
 19549  		goto __29
 19550  	}
 19551  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit - ((*Decimal)(unsafe.Pointer(p)).FnFrac - 1))
 19552  __29:
 19553  	;
 19554  	if !(iExp > 0) {
 19555  		goto __30
 19556  	}
 19557  	if !((*Decimal)(unsafe.Pointer(p)).FnFrac > 0) {
 19558  		goto __32
 19559  	}
 19560  	if !(iExp <= (*Decimal)(unsafe.Pointer(p)).FnFrac) {
 19561  		goto __33
 19562  	}
 19563  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) -= (iExp)
 19564  	iExp = 0
 19565  	goto __34
 19566  __33:
 19567  	iExp = iExp - ((*Decimal)(unsafe.Pointer(p)).FnFrac)
 19568  	(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 19569  __34:
 19570  	;
 19571  __32:
 19572  	;
 19573  	if !(iExp > 0) {
 19574  		goto __35
 19575  	}
 19576  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(((*Decimal)(unsafe.Pointer(p)).FnDigit + iExp) + 1)))
 19577  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 19578  		goto __36
 19579  	}
 19580  	goto new_no_mem
 19581  __36:
 19582  	;
 19583  	libc.Xmemset(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr((*Decimal)(unsafe.Pointer(p)).FnDigit)), 0, uint32(iExp))
 19584  	*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (iExp)
 19585  __35:
 19586  	;
 19587  	goto __31
 19588  __30:
 19589  	if !(iExp < 0) {
 19590  		goto __37
 19591  	}
 19592  	iExp = -iExp
 19593  	nExtra = (((*Decimal)(unsafe.Pointer(p)).FnDigit - (*Decimal)(unsafe.Pointer(p)).FnFrac) - 1)
 19594  	if !(nExtra != 0) {
 19595  		goto __38
 19596  	}
 19597  	if !(nExtra >= iExp) {
 19598  		goto __39
 19599  	}
 19600  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (iExp)
 19601  	iExp = 0
 19602  	goto __40
 19603  __39:
 19604  	iExp = iExp - (nExtra)
 19605  	(*Decimal)(unsafe.Pointer(p)).FnFrac = ((*Decimal)(unsafe.Pointer(p)).FnDigit - 1)
 19606  __40:
 19607  	;
 19608  __38:
 19609  	;
 19610  	if !(iExp > 0) {
 19611  		goto __41
 19612  	}
 19613  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(((*Decimal)(unsafe.Pointer(p)).FnDigit + iExp) + 1)))
 19614  	if !((*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0)) {
 19615  		goto __42
 19616  	}
 19617  	goto new_no_mem
 19618  __42:
 19619  	;
 19620  	libc.Xmemmove(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(iExp)), (*Decimal)(unsafe.Pointer(p)).Fa, uint32((*Decimal)(unsafe.Pointer(p)).FnDigit))
 19621  	libc.Xmemset(tls, (*Decimal)(unsafe.Pointer(p)).Fa, 0, uint32(iExp))
 19622  	*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (iExp)
 19623  	*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (iExp)
 19624  __41:
 19625  	;
 19626  __37:
 19627  	;
 19628  __31:
 19629  	;
 19630  	return p
 19631  
 19632  new_no_mem:
 19633  	if !(pCtx != 0) {
 19634  		goto __43
 19635  	}
 19636  	sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 19637  __43:
 19638  	;
 19639  	sqlite3.Xsqlite3_free(tls, p)
 19640  	return uintptr(0)
 19641  }
 19642  
 19643  // Make the given Decimal the result.
 19644  func decimal_result(tls *libc.TLS, pCtx uintptr, p uintptr) { /* decimal.c:183:13: */
 19645  	var z uintptr
 19646  	var i int32
 19647  	var j int32
 19648  	var n int32
 19649  	if (p == uintptr(0)) || ((*Decimal)(unsafe.Pointer(p)).Foom != 0) {
 19650  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 19651  		return
 19652  	}
 19653  	if (*Decimal)(unsafe.Pointer(p)).FisNull != 0 {
 19654  		sqlite3.Xsqlite3_result_null(tls, pCtx)
 19655  		return
 19656  	}
 19657  	z = sqlite3.Xsqlite3_malloc(tls, ((*Decimal)(unsafe.Pointer(p)).FnDigit + 4))
 19658  	if z == uintptr(0) {
 19659  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 19660  		return
 19661  	}
 19662  	i = 0
 19663  	if ((*Decimal)(unsafe.Pointer(p)).FnDigit == 0) || (((*Decimal)(unsafe.Pointer(p)).FnDigit == 1) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa))) == 0)) {
 19664  		(*Decimal)(unsafe.Pointer(p)).Fsign = int8(0)
 19665  	}
 19666  	if (*Decimal)(unsafe.Pointer(p)).Fsign != 0 {
 19667  		*(*int8)(unsafe.Pointer(z)) = int8('-')
 19668  		i = 1
 19669  	}
 19670  	n = ((*Decimal)(unsafe.Pointer(p)).FnDigit - (*Decimal)(unsafe.Pointer(p)).FnFrac)
 19671  	if n <= 0 {
 19672  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('0')
 19673  	}
 19674  	j = 0
 19675  	for (n > 1) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) == 0) {
 19676  		j++
 19677  		n--
 19678  	}
 19679  	for n > 0 {
 19680  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = (int8(int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) + '0'))
 19681  		j++
 19682  		n--
 19683  	}
 19684  	if (*Decimal)(unsafe.Pointer(p)).FnFrac != 0 {
 19685  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = int8('.')
 19686  		for ok := true; ok; ok = (j < (*Decimal)(unsafe.Pointer(p)).FnDigit) {
 19687  			*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))) = (int8(int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(j)))) + '0'))
 19688  			j++
 19689  		}
 19690  	}
 19691  	*(*int8)(unsafe.Pointer(z + uintptr(i))) = int8(0)
 19692  	sqlite3.Xsqlite3_result_text(tls, pCtx, z, i, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 19693  }
 19694  
 19695  // SQL Function:   decimal(X)
 19696  //
 19697  // Convert input X into decimal and then back into text
 19698  func decimalFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:238:13: */
 19699  	var p uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19700  	_ = argc
 19701  	decimal_result(tls, context, p)
 19702  	decimal_free(tls, p)
 19703  }
 19704  
 19705  // Compare to Decimal objects.  Return negative, 0, or positive if the
 19706  // first object is less than, equal to, or greater than the second.
 19707  //
 19708  // Preconditions for this routine:
 19709  //
 19710  //    pA!=0
 19711  //    pA->isNull==0
 19712  //    pB!=0
 19713  //    pB->isNull==0
 19714  func decimal_cmp(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* decimal.c:260:12: */
 19715  	var nASig int32
 19716  	var nBSig int32
 19717  	var rc int32
 19718  	var n int32
 19719  	if int32((*Decimal)(unsafe.Pointer(pA)).Fsign) != int32((*Decimal)(unsafe.Pointer(pB)).Fsign) {
 19720  		if (*Decimal)(unsafe.Pointer(pA)).Fsign != 0 {
 19721  			return -1
 19722  		}
 19723  		return +1
 19724  	}
 19725  	if (*Decimal)(unsafe.Pointer(pA)).Fsign != 0 {
 19726  		var pTemp uintptr = pA
 19727  		pA = pB
 19728  		pB = pTemp
 19729  	}
 19730  	nASig = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pA)).FnFrac)
 19731  	nBSig = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac)
 19732  	if nASig != nBSig {
 19733  		return (nASig - nBSig)
 19734  	}
 19735  	n = (*Decimal)(unsafe.Pointer(pA)).FnDigit
 19736  	if n > (*Decimal)(unsafe.Pointer(pB)).FnDigit {
 19737  		n = (*Decimal)(unsafe.Pointer(pB)).FnDigit
 19738  	}
 19739  	rc = libc.Xmemcmp(tls, (*Decimal)(unsafe.Pointer(pA)).Fa, (*Decimal)(unsafe.Pointer(pB)).Fa, uint32(n))
 19740  	if rc == 0 {
 19741  		rc = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnDigit)
 19742  	}
 19743  	return rc
 19744  }
 19745  
 19746  // SQL Function:   decimal_cmp(X, Y)
 19747  //
 19748  // Return negative, zero, or positive if X is less then, equal to, or
 19749  // greater than Y.
 19750  func decimalCmpFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:290:13: */
 19751  	var pA uintptr
 19752  	var pB uintptr
 19753  	var rc int32
 19754  	pA = uintptr(0)
 19755  	pB = uintptr(0)
 19756  
 19757  	_ = argc
 19758  	pA = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19759  	if !((pA == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0)) {
 19760  		goto __1
 19761  	}
 19762  	goto cmp_done
 19763  __1:
 19764  	;
 19765  	pB = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 0, uintptr(0))
 19766  	if !((pB == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0)) {
 19767  		goto __2
 19768  	}
 19769  	goto cmp_done
 19770  __2:
 19771  	;
 19772  	rc = decimal_cmp(tls, pA, pB)
 19773  	if !(rc < 0) {
 19774  		goto __3
 19775  	}
 19776  	rc = -1
 19777  	goto __4
 19778  __3:
 19779  	if !(rc > 0) {
 19780  		goto __5
 19781  	}
 19782  	rc = +1
 19783  __5:
 19784  	;
 19785  __4:
 19786  	;
 19787  	sqlite3.Xsqlite3_result_int(tls, context, rc)
 19788  cmp_done:
 19789  	decimal_free(tls, pA)
 19790  	decimal_free(tls, pB)
 19791  }
 19792  
 19793  // Expand the Decimal so that it has a least nDigit digits and nFrac
 19794  // digits to the right of the decimal point.
 19795  func decimal_expand(tls *libc.TLS, p uintptr, nDigit int32, nFrac int32) { /* decimal.c:316:13: */
 19796  	var nAddSig int32
 19797  	var nAddFrac int32
 19798  	if p == uintptr(0) {
 19799  		return
 19800  	}
 19801  	nAddFrac = (nFrac - (*Decimal)(unsafe.Pointer(p)).FnFrac)
 19802  	nAddSig = ((nDigit - (*Decimal)(unsafe.Pointer(p)).FnDigit) - nAddFrac)
 19803  	if (nAddFrac == 0) && (nAddSig == 0) {
 19804  		return
 19805  	}
 19806  	(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_realloc64(tls, (*Decimal)(unsafe.Pointer(p)).Fa, (uint64(nDigit + 1)))
 19807  	if (*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0) {
 19808  		(*Decimal)(unsafe.Pointer(p)).Foom = int8(1)
 19809  		return
 19810  	}
 19811  	if nAddSig != 0 {
 19812  		libc.Xmemmove(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr(nAddSig)), (*Decimal)(unsafe.Pointer(p)).Fa, uint32((*Decimal)(unsafe.Pointer(p)).FnDigit))
 19813  		libc.Xmemset(tls, (*Decimal)(unsafe.Pointer(p)).Fa, 0, uint32(nAddSig))
 19814  		*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (nAddSig)
 19815  	}
 19816  	if nAddFrac != 0 {
 19817  		libc.Xmemset(tls, ((*Decimal)(unsafe.Pointer(p)).Fa + uintptr((*Decimal)(unsafe.Pointer(p)).FnDigit)), 0, uint32(nAddFrac))
 19818  		*(*int32)(unsafe.Pointer(p + 4 /* &.nDigit */)) += (nAddFrac)
 19819  		*(*int32)(unsafe.Pointer(p + 8 /* &.nFrac */)) += (nAddFrac)
 19820  	}
 19821  }
 19822  
 19823  // Add the value pB into pA.
 19824  //
 19825  // Both pA and pB might become denormalized by this routine.
 19826  func decimal_add(tls *libc.TLS, pA uintptr, pB uintptr) { /* decimal.c:345:13: */
 19827  	var nSig int32
 19828  	var nFrac int32
 19829  	var nDigit int32
 19830  	var i int32
 19831  	var rc int32
 19832  	if pA == uintptr(0) {
 19833  		return
 19834  	}
 19835  	if (((*Decimal)(unsafe.Pointer(pA)).Foom != 0) || (pB == uintptr(0))) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0) {
 19836  		(*Decimal)(unsafe.Pointer(pA)).Foom = int8(1)
 19837  		return
 19838  	}
 19839  	if ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0) {
 19840  		(*Decimal)(unsafe.Pointer(pA)).FisNull = int8(1)
 19841  		return
 19842  	}
 19843  	nSig = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - (*Decimal)(unsafe.Pointer(pA)).FnFrac)
 19844  	if (nSig != 0) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa))) == 0) {
 19845  		nSig--
 19846  	}
 19847  	if nSig < ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac) {
 19848  		nSig = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - (*Decimal)(unsafe.Pointer(pB)).FnFrac)
 19849  	}
 19850  	nFrac = (*Decimal)(unsafe.Pointer(pA)).FnFrac
 19851  	if nFrac < (*Decimal)(unsafe.Pointer(pB)).FnFrac {
 19852  		nFrac = (*Decimal)(unsafe.Pointer(pB)).FnFrac
 19853  	}
 19854  	nDigit = ((nSig + nFrac) + 1)
 19855  	decimal_expand(tls, pA, nDigit, nFrac)
 19856  	decimal_expand(tls, pB, nDigit, nFrac)
 19857  	if ((*Decimal)(unsafe.Pointer(pA)).Foom != 0) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0) {
 19858  		(*Decimal)(unsafe.Pointer(pA)).Foom = int8(1)
 19859  	} else {
 19860  		if int32((*Decimal)(unsafe.Pointer(pA)).Fsign) == int32((*Decimal)(unsafe.Pointer(pB)).Fsign) {
 19861  			var carry int32 = 0
 19862  			for i = (nDigit - 1); i >= 0; i-- {
 19863  				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)
 19864  				if x >= 10 {
 19865  					carry = 1
 19866  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = (int8(x - 10))
 19867  				} else {
 19868  					carry = 0
 19869  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = int8(x)
 19870  				}
 19871  			}
 19872  		} else {
 19873  			var aA uintptr
 19874  			var aB uintptr
 19875  			var borrow int32 = 0
 19876  			rc = libc.Xmemcmp(tls, (*Decimal)(unsafe.Pointer(pA)).Fa, (*Decimal)(unsafe.Pointer(pB)).Fa, uint32(nDigit))
 19877  			if rc < 0 {
 19878  				aA = (*Decimal)(unsafe.Pointer(pB)).Fa
 19879  				aB = (*Decimal)(unsafe.Pointer(pA)).Fa
 19880  				(*Decimal)(unsafe.Pointer(pA)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pA)).Fsign != 0))
 19881  			} else {
 19882  				aA = (*Decimal)(unsafe.Pointer(pA)).Fa
 19883  				aB = (*Decimal)(unsafe.Pointer(pB)).Fa
 19884  			}
 19885  			for i = (nDigit - 1); i >= 0; i-- {
 19886  				var x int32 = ((int32(*(*int8)(unsafe.Pointer(aA + uintptr(i)))) - int32(*(*int8)(unsafe.Pointer(aB + uintptr(i))))) - borrow)
 19887  				if x < 0 {
 19888  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = (int8(x + 10))
 19889  					borrow = 1
 19890  				} else {
 19891  					*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i))) = int8(x)
 19892  					borrow = 0
 19893  				}
 19894  			}
 19895  		}
 19896  	}
 19897  }
 19898  
 19899  // Compare text in decimal order.
 19900  func decimalCollFunc(tls *libc.TLS, notUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* decimal.c:413:12: */
 19901  	var zA uintptr = pKey1
 19902  	var zB uintptr = pKey2
 19903  	var pA uintptr = decimal_new(tls, uintptr(0), uintptr(0), nKey1, zA)
 19904  	var pB uintptr = decimal_new(tls, uintptr(0), uintptr(0), nKey2, zB)
 19905  	var rc int32
 19906  	_ = notUsed
 19907  	if (pA == uintptr(0)) || (pB == uintptr(0)) {
 19908  		rc = 0
 19909  	} else {
 19910  		rc = decimal_cmp(tls, pA, pB)
 19911  	}
 19912  	decimal_free(tls, pA)
 19913  	decimal_free(tls, pB)
 19914  	return rc
 19915  }
 19916  
 19917  // SQL Function:   decimal_add(X, Y)
 19918  //                 decimal_sub(X, Y)
 19919  //
 19920  // Return the sum or difference of X and Y.
 19921  func decimalAddFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:441:13: */
 19922  	var pA uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19923  	var pB uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 0, uintptr(0))
 19924  	_ = argc
 19925  	decimal_add(tls, pA, pB)
 19926  	decimal_result(tls, context, pA)
 19927  	decimal_free(tls, pA)
 19928  	decimal_free(tls, pB)
 19929  }
 19930  
 19931  func decimalSubFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:454:13: */
 19932  	var pA uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19933  	var pB uintptr = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 0, uintptr(0))
 19934  	_ = argc
 19935  	if pB != 0 {
 19936  		(*Decimal)(unsafe.Pointer(pB)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pB)).Fsign != 0))
 19937  		decimal_add(tls, pA, pB)
 19938  		decimal_result(tls, context, pA)
 19939  	}
 19940  	decimal_free(tls, pA)
 19941  	decimal_free(tls, pB)
 19942  }
 19943  
 19944  // Aggregate funcion:   decimal_sum(X)
 19945  //
 19946  // Works like sum() except that it uses decimal arithmetic for unlimited
 19947  // precision.
 19948  func decimalSumStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:476:13: */
 19949  	var p uintptr
 19950  	var pArg uintptr
 19951  	_ = argc
 19952  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(Decimal{})))
 19953  	if p == uintptr(0) {
 19954  		return
 19955  	}
 19956  	if !(int32((*Decimal)(unsafe.Pointer(p)).FisInit) != 0) {
 19957  		(*Decimal)(unsafe.Pointer(p)).FisInit = int8(1)
 19958  		(*Decimal)(unsafe.Pointer(p)).Fa = sqlite3.Xsqlite3_malloc(tls, 2)
 19959  		if (*Decimal)(unsafe.Pointer(p)).Fa == uintptr(0) {
 19960  			(*Decimal)(unsafe.Pointer(p)).Foom = int8(1)
 19961  		} else {
 19962  			*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(p)).Fa)) = int8(0)
 19963  		}
 19964  		(*Decimal)(unsafe.Pointer(p)).FnDigit = 1
 19965  		(*Decimal)(unsafe.Pointer(p)).FnFrac = 0
 19966  	}
 19967  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 19968  		return
 19969  	}
 19970  	pArg = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19971  	decimal_add(tls, p, pArg)
 19972  	decimal_free(tls, pArg)
 19973  }
 19974  
 19975  func decimalSumInverse(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:502:13: */
 19976  	var p uintptr
 19977  	var pArg uintptr
 19978  	_ = argc
 19979  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(Decimal{})))
 19980  	if p == uintptr(0) {
 19981  		return
 19982  	}
 19983  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 19984  		return
 19985  	}
 19986  	pArg = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 19987  	if pArg != 0 {
 19988  		(*Decimal)(unsafe.Pointer(pArg)).Fsign = libc.BoolInt8(!((*Decimal)(unsafe.Pointer(pArg)).Fsign != 0))
 19989  	}
 19990  	decimal_add(tls, p, pArg)
 19991  	decimal_free(tls, pArg)
 19992  }
 19993  
 19994  func decimalSumValue(tls *libc.TLS, context uintptr) { /* decimal.c:518:13: */
 19995  	var p uintptr = sqlite3.Xsqlite3_aggregate_context(tls, context, 0)
 19996  	if p == uintptr(0) {
 19997  		return
 19998  	}
 19999  	decimal_result(tls, context, p)
 20000  }
 20001  
 20002  func decimalSumFinalize(tls *libc.TLS, context uintptr) { /* decimal.c:523:13: */
 20003  	var p uintptr = sqlite3.Xsqlite3_aggregate_context(tls, context, 0)
 20004  	if p == uintptr(0) {
 20005  		return
 20006  	}
 20007  	decimal_result(tls, context, p)
 20008  	decimal_clear(tls, p)
 20009  }
 20010  
 20011  // SQL Function:   decimal_mul(X, Y)
 20012  //
 20013  // Return the product of X and Y.
 20014  //
 20015  // All significant digits after the decimal point are retained.
 20016  // Trailing zeros after the decimal point are omitted as long as
 20017  // the number of digits after the decimal point is no less than
 20018  // either the number of digits in either input.
 20019  func decimalMulFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* decimal.c:540:13: */
 20020  	var pA uintptr
 20021  	var pB uintptr
 20022  	var acc uintptr
 20023  	var i int32
 20024  	var j int32
 20025  	var k int32
 20026  	var minFrac int32
 20027  	var f int8
 20028  	var carry int32
 20029  	var x int32
 20030  	pA = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv)), 0, uintptr(0))
 20031  	pB = decimal_new(tls, context, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 0, uintptr(0))
 20032  	acc = uintptr(0)
 20033  	_ = argc
 20034  	if !((((((pA == uintptr(0)) || ((*Decimal)(unsafe.Pointer(pA)).Foom != 0)) || ((*Decimal)(unsafe.Pointer(pA)).FisNull != 0)) ||
 20035  		(pB == uintptr(0))) || ((*Decimal)(unsafe.Pointer(pB)).Foom != 0)) || ((*Decimal)(unsafe.Pointer(pB)).FisNull != 0)) {
 20036  		goto __1
 20037  	}
 20038  	goto mul_end
 20039  __1:
 20040  	;
 20041  	acc = sqlite3.Xsqlite3_malloc64(tls, (uint64(((*Decimal)(unsafe.Pointer(pA)).FnDigit + (*Decimal)(unsafe.Pointer(pB)).FnDigit) + 2)))
 20042  	if !(acc == uintptr(0)) {
 20043  		goto __2
 20044  	}
 20045  	sqlite3.Xsqlite3_result_error_nomem(tls, context)
 20046  	goto mul_end
 20047  __2:
 20048  	;
 20049  	libc.Xmemset(tls, acc, 0, (uint32(((*Decimal)(unsafe.Pointer(pA)).FnDigit + (*Decimal)(unsafe.Pointer(pB)).FnDigit) + 2)))
 20050  	minFrac = (*Decimal)(unsafe.Pointer(pA)).FnFrac
 20051  	if !((*Decimal)(unsafe.Pointer(pB)).FnFrac < minFrac) {
 20052  		goto __3
 20053  	}
 20054  	minFrac = (*Decimal)(unsafe.Pointer(pB)).FnFrac
 20055  __3:
 20056  	;
 20057  	i = ((*Decimal)(unsafe.Pointer(pA)).FnDigit - 1)
 20058  __4:
 20059  	if !(i >= 0) {
 20060  		goto __6
 20061  	}
 20062  	f = *(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(i)))
 20063  	carry = 0
 20064  	j = ((*Decimal)(unsafe.Pointer(pB)).FnDigit - 1)
 20065  	k = ((i + j) + 3)
 20066  __7:
 20067  	if !(j >= 0) {
 20068  		goto __9
 20069  	}
 20070  	x = ((int32(*(*int8)(unsafe.Pointer(acc + uintptr(k)))) + (int32(f) * int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pB)).Fa + uintptr(j)))))) + carry)
 20071  	*(*int8)(unsafe.Pointer(acc + uintptr(k))) = (int8(x % 10))
 20072  	carry = (x / 10)
 20073  	goto __8
 20074  __8:
 20075  	j--
 20076  	k--
 20077  	goto __7
 20078  	goto __9
 20079  __9:
 20080  	;
 20081  	x = (int32(*(*int8)(unsafe.Pointer(acc + uintptr(k)))) + carry)
 20082  	*(*int8)(unsafe.Pointer(acc + uintptr(k))) = (int8(x % 10))
 20083  	*(*int8)(unsafe.Pointer(acc + uintptr((k - 1)))) += int8((x / 10))
 20084  	goto __5
 20085  __5:
 20086  	i--
 20087  	goto __4
 20088  	goto __6
 20089  __6:
 20090  	;
 20091  	sqlite3.Xsqlite3_free(tls, (*Decimal)(unsafe.Pointer(pA)).Fa)
 20092  	(*Decimal)(unsafe.Pointer(pA)).Fa = acc
 20093  	acc = uintptr(0)
 20094  	*(*int32)(unsafe.Pointer(pA + 4 /* &.nDigit */)) += ((*Decimal)(unsafe.Pointer(pB)).FnDigit + 2)
 20095  	*(*int32)(unsafe.Pointer(pA + 8 /* &.nFrac */)) += ((*Decimal)(unsafe.Pointer(pB)).FnFrac)
 20096  	*(*int8)(unsafe.Pointer(pA /* &.sign */)) ^= int8((int32((*Decimal)(unsafe.Pointer(pB)).Fsign)))
 20097  __10:
 20098  	if !(((*Decimal)(unsafe.Pointer(pA)).FnFrac > minFrac) && (int32(*(*int8)(unsafe.Pointer((*Decimal)(unsafe.Pointer(pA)).Fa + uintptr(((*Decimal)(unsafe.Pointer(pA)).FnDigit - 1))))) == 0)) {
 20099  		goto __11
 20100  	}
 20101  	(*Decimal)(unsafe.Pointer(pA)).FnFrac--
 20102  	(*Decimal)(unsafe.Pointer(pA)).FnDigit--
 20103  	goto __10
 20104  __11:
 20105  	;
 20106  	decimal_result(tls, context, pA)
 20107  
 20108  mul_end:
 20109  	sqlite3.Xsqlite3_free(tls, acc)
 20110  	decimal_free(tls, pA)
 20111  	decimal_free(tls, pB)
 20112  }
 20113  
 20114  func sqlite3_decimal_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* decimal.c:597:5: */
 20115  	var rc int32 = SQLITE_OK
 20116  	var i uint32
 20117  	_ = pzErrMsg // Unused parameter
 20118  
 20119  	_ = pApi
 20120  
 20121  	for i = uint32(0); (i < (uint32(unsafe.Sizeof(aFunc)) / uint32(unsafe.Sizeof(struct {
 20122  		FzFuncName uintptr
 20123  		FnArg      int32
 20124  		FxFunc     uintptr
 20125  	}{})))) && (rc == SQLITE_OK); i++ {
 20126  		rc = sqlite3.Xsqlite3_create_function(tls, db, aFunc[i].FzFuncName, aFunc[i].FnArg,
 20127  			((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC),
 20128  			uintptr(0), aFunc[i].FxFunc, uintptr(0), uintptr(0))
 20129  	}
 20130  	if rc == SQLITE_OK {
 20131  		rc = sqlite3.Xsqlite3_create_window_function(tls, db, ts+4687 /* "decimal_sum" */, 1,
 20132  			((SQLITE_UTF8 | SQLITE_INNOCUOUS) | SQLITE_DETERMINISTIC), uintptr(0),
 20133  			*(*uintptr)(unsafe.Pointer(&struct {
 20134  				f func(*libc.TLS, uintptr, int32, uintptr)
 20135  			}{decimalSumStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{decimalSumFinalize})),
 20136  			*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{decimalSumValue})), *(*uintptr)(unsafe.Pointer(&struct {
 20137  				f func(*libc.TLS, uintptr, int32, uintptr)
 20138  			}{decimalSumInverse})), uintptr(0))
 20139  	}
 20140  	if rc == SQLITE_OK {
 20141  		rc = sqlite3.Xsqlite3_create_collation(tls, db, ts+4699 /* "decimal" */, SQLITE_UTF8,
 20142  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 20143  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 20144  			}{decimalCollFunc})))
 20145  	}
 20146  	return rc
 20147  }
 20148  
 20149  var aFunc = [5]struct {
 20150  	FzFuncName uintptr
 20151  	FnArg      int32
 20152  	FxFunc     uintptr
 20153  }{
 20154  	{FzFuncName: ts + 4699 /* "decimal" */, FnArg: 1, FxFunc: 0},
 20155  	{FzFuncName: ts + 4707 /* "decimal_cmp" */, FnArg: 2, FxFunc: 0},
 20156  	{FzFuncName: ts + 4719 /* "decimal_add" */, FnArg: 2, FxFunc: 0},
 20157  	{FzFuncName: ts + 4731 /* "decimal_sub" */, FnArg: 2, FxFunc: 0},
 20158  	{FzFuncName: ts + 4743 /* "decimal_mul" */, FnArg: 2, FxFunc: 0},
 20159  } /* decimal.c:607:5 */
 20160  
 20161  // Structure used to accumulate the output
 20162  type EvalResult = struct {
 20163  	Fz      uintptr
 20164  	FzSep   uintptr
 20165  	FszSep  int32
 20166  	_       [4]byte
 20167  	FnAlloc sqlite3_int64
 20168  	FnUsed  sqlite3_int64
 20169  } /* eval.c:23:1 */
 20170  
 20171  // Callback from sqlite_exec() for the eval() function.
 20172  func callback(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr, colnames uintptr) int32 { /* eval.c:34:12: */
 20173  	var p uintptr = pCtx
 20174  	var i int32
 20175  	if argv == uintptr(0) {
 20176  		return 0
 20177  	}
 20178  	for i = 0; i < argc; i++ {
 20179  		var z uintptr
 20180  		if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) != 0 {
 20181  			z = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))
 20182  		} else {
 20183  			z = ts + 489 /* "" */
 20184  		}
 20185  		var sz size_t = libc.Xstrlen(tls, z)
 20186  		if (((sqlite3_int64(sz) + (*EvalResult)(unsafe.Pointer(p)).FnUsed) + sqlite3_int64((*EvalResult)(unsafe.Pointer(p)).FszSep)) + int64(1)) > (*EvalResult)(unsafe.Pointer(p)).FnAlloc {
 20187  			var zNew uintptr
 20188  			(*EvalResult)(unsafe.Pointer(p)).FnAlloc = (((((*EvalResult)(unsafe.Pointer(p)).FnAlloc * int64(2)) + sqlite3_int64(sz)) + sqlite3_int64((*EvalResult)(unsafe.Pointer(p)).FszSep)) + int64(1))
 20189  			// Using sqlite3_realloc64() would be better, but it is a recent
 20190  			// addition and will cause a segfault if loaded by an older version
 20191  			// of SQLite.
 20192  			if (*EvalResult)(unsafe.Pointer(p)).FnAlloc <= int64(0x7fffffff) {
 20193  				zNew = sqlite3.Xsqlite3_realloc64(tls, (*EvalResult)(unsafe.Pointer(p)).Fz, uint64((*EvalResult)(unsafe.Pointer(p)).FnAlloc))
 20194  			} else {
 20195  				zNew = uintptr(0)
 20196  			}
 20197  			if zNew == uintptr(0) {
 20198  				sqlite3.Xsqlite3_free(tls, (*EvalResult)(unsafe.Pointer(p)).Fz)
 20199  				libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(EvalResult{})))
 20200  				return 1
 20201  			}
 20202  			(*EvalResult)(unsafe.Pointer(p)).Fz = zNew
 20203  		}
 20204  		if (*EvalResult)(unsafe.Pointer(p)).FnUsed > int64(0) {
 20205  			libc.Xmemcpy(tls, ((*EvalResult)(unsafe.Pointer(p)).Fz + uintptr((*EvalResult)(unsafe.Pointer(p)).FnUsed)), (*EvalResult)(unsafe.Pointer(p)).FzSep, uint32((*EvalResult)(unsafe.Pointer(p)).FszSep))
 20206  			*(*sqlite3_int64)(unsafe.Pointer(p + 24 /* &.nUsed */)) += (sqlite3_int64((*EvalResult)(unsafe.Pointer(p)).FszSep))
 20207  		}
 20208  		libc.Xmemcpy(tls, ((*EvalResult)(unsafe.Pointer(p)).Fz + uintptr((*EvalResult)(unsafe.Pointer(p)).FnUsed)), z, sz)
 20209  		*(*sqlite3_int64)(unsafe.Pointer(p + 24 /* &.nUsed */)) += (sqlite3_int64(sz))
 20210  	}
 20211  	return 0
 20212  }
 20213  
 20214  // Implementation of the eval(X) and eval(X,Y) SQL functions.
 20215  //
 20216  // Evaluate the SQL text in X.  Return the results, using string
 20217  // Y as the separator.  If Y is omitted, use a single space character.
 20218  func sqlEvalFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* eval.c:71:13: */
 20219  	bp := tls.Alloc(36)
 20220  	defer tls.Free(36)
 20221  
 20222  	var zSql uintptr
 20223  	var db uintptr
 20224  	*(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)) = uintptr(0)
 20225  	var rc int32
 20226  	// var x EvalResult at bp, 32
 20227  
 20228  	libc.Xmemset(tls, bp /* &x */, 0, uint32(unsafe.Sizeof(EvalResult{})))
 20229  	(*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep = ts + 4755 /* " " */
 20230  	zSql = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 20231  	if zSql == uintptr(0) {
 20232  		return
 20233  	}
 20234  	if argc > 1 {
 20235  		(*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 20236  		if (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep == uintptr(0) {
 20237  			return
 20238  		}
 20239  	}
 20240  	(*EvalResult)(unsafe.Pointer(bp /* &x */)).FszSep = int32(libc.Xstrlen(tls, (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep))
 20241  	db = sqlite3.Xsqlite3_context_db_handle(tls, context)
 20242  	rc = sqlite3.Xsqlite3_exec(tls, db, zSql, *(*uintptr)(unsafe.Pointer(&struct {
 20243  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 20244  	}{callback})), bp /* &x */, bp+32 /* &zErr */)
 20245  	if rc != SQLITE_OK {
 20246  		sqlite3.Xsqlite3_result_error(tls, context, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)), -1)
 20247  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* zErr */)))
 20248  	} else if (*EvalResult)(unsafe.Pointer(bp /* &x */)).FzSep == uintptr(0) {
 20249  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 20250  		sqlite3.Xsqlite3_free(tls, (*EvalResult)(unsafe.Pointer(bp /* &x */)).Fz)
 20251  	} else {
 20252  		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})))
 20253  	}
 20254  }
 20255  
 20256  func sqlite3_eval_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* eval.c:108:5: */
 20257  	var rc int32 = SQLITE_OK
 20258  	_ = pApi
 20259  
 20260  	_ = pzErrMsg // Unused parameter
 20261  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4757 /* "eval" */, 1,
 20262  		(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 20263  		*(*uintptr)(unsafe.Pointer(&struct {
 20264  			f func(*libc.TLS, uintptr, int32, uintptr)
 20265  		}{sqlEvalFunc})), uintptr(0), uintptr(0))
 20266  	if rc == SQLITE_OK {
 20267  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+4757 /* "eval" */, 2,
 20268  			(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 20269  			*(*uintptr)(unsafe.Pointer(&struct {
 20270  				f func(*libc.TLS, uintptr, int32, uintptr)
 20271  			}{sqlEvalFunc})), uintptr(0), uintptr(0))
 20272  	}
 20273  	return rc
 20274  }
 20275  
 20276  // explain_vtab is a subclass of sqlite3_vtab which will
 20277  // serve as the underlying representation of a explain virtual table
 20278  type explain_vtab1 = struct {
 20279  	Fbase sqlite3_vtab
 20280  	Fdb   uintptr
 20281  } /* explain.c:38:9 */
 20282  
 20283  // explain_vtab is a subclass of sqlite3_vtab which will
 20284  // serve as the underlying representation of a explain virtual table
 20285  type explain_vtab = explain_vtab1 /* explain.c:38:29 */
 20286  
 20287  // explain_cursor is a subclass of sqlite3_vtab_cursor which will
 20288  // serve as the underlying representation of a cursor that scans
 20289  // over rows of the result from an EXPLAIN operation.
 20290  type explain_cursor1 = struct {
 20291  	Fbase     sqlite3_vtab_cursor
 20292  	Fdb       uintptr
 20293  	FzSql     uintptr
 20294  	FpExplain uintptr
 20295  	Frc       int32
 20296  } /* explain.c:48:9 */
 20297  
 20298  // explain_cursor is a subclass of sqlite3_vtab_cursor which will
 20299  // serve as the underlying representation of a cursor that scans
 20300  // over rows of the result from an EXPLAIN operation.
 20301  type explain_cursor = explain_cursor1 /* explain.c:48:31 */
 20302  
 20303  // The explainConnect() method is invoked to create a new
 20304  // explain_vtab that describes the explain virtual table.
 20305  //
 20306  // Think of this routine as the constructor for explain_vtab objects.
 20307  //
 20308  // All this routine needs to do is:
 20309  //
 20310  //    (1) Allocate the explain_vtab object and initialize all fields.
 20311  //
 20312  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 20313  //        result set of queries against explain will look like.
 20314  func explainConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* explain.c:70:12: */
 20315  	var pNew uintptr
 20316  	var rc int32
 20317  
 20318  	// Column numbers
 20319  
 20320  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 20321  		ts+4762 /* "CREATE TABLE x(a..." */)
 20322  	if rc == SQLITE_OK {
 20323  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(explain_vtab{})))
 20324  		*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 20325  		if pNew == uintptr(0) {
 20326  			return SQLITE_NOMEM
 20327  		}
 20328  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(explain_vtab{})))
 20329  		(*explain_vtab)(unsafe.Pointer(pNew)).Fdb = db
 20330  	}
 20331  	return rc
 20332  }
 20333  
 20334  // This method is the destructor for explain_cursor objects.
 20335  func explainDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* explain.c:107:12: */
 20336  	sqlite3.Xsqlite3_free(tls, pVtab)
 20337  	return SQLITE_OK
 20338  }
 20339  
 20340  // Constructor for a new explain_cursor object.
 20341  func explainOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* explain.c:115:12: */
 20342  	var pCur uintptr
 20343  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(explain_cursor{})))
 20344  	if pCur == uintptr(0) {
 20345  		return SQLITE_NOMEM
 20346  	}
 20347  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(explain_cursor{})))
 20348  	(*explain_cursor)(unsafe.Pointer(pCur)).Fdb = (*explain_vtab)(unsafe.Pointer(p)).Fdb
 20349  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 20350  	return SQLITE_OK
 20351  }
 20352  
 20353  // Destructor for a explain_cursor.
 20354  func explainClose(tls *libc.TLS, cur uintptr) int32 { /* explain.c:128:12: */
 20355  	var pCur uintptr = cur
 20356  	sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 20357  	sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 20358  	sqlite3.Xsqlite3_free(tls, pCur)
 20359  	return SQLITE_OK
 20360  }
 20361  
 20362  // Advance a explain_cursor to its next row of output.
 20363  func explainNext(tls *libc.TLS, cur uintptr) int32 { /* explain.c:140:12: */
 20364  	var pCur uintptr = cur
 20365  	(*explain_cursor)(unsafe.Pointer(pCur)).Frc = sqlite3.Xsqlite3_step(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 20366  	if ((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_DONE) && ((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_ROW) {
 20367  		return (*explain_cursor)(unsafe.Pointer(pCur)).Frc
 20368  	}
 20369  	return SQLITE_OK
 20370  }
 20371  
 20372  // Return values of columns for the row at which the explain_cursor
 20373  // is currently pointing.
 20374  func explainColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* explain.c:151:12: */
 20375  	var pCur uintptr = cur
 20376  	if i == EXPLN_COLUMN_SQL {
 20377  		sqlite3.Xsqlite3_result_text(tls, ctx, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql, -1, libc.UintptrFromInt32(-1))
 20378  	} else {
 20379  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain, i))
 20380  	}
 20381  	return SQLITE_OK
 20382  }
 20383  
 20384  // Return the rowid for the current row.  In this implementation, the
 20385  // rowid is the same as the output value.
 20386  func explainRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* explain.c:169:12: */
 20387  	var pCur uintptr = cur
 20388  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain, 0)
 20389  	return SQLITE_OK
 20390  }
 20391  
 20392  // Return TRUE if the cursor has been moved off of the last
 20393  // row of output.
 20394  func explainEof(tls *libc.TLS, cur uintptr) int32 { /* explain.c:179:12: */
 20395  	var pCur uintptr = cur
 20396  	return (libc.Bool32((*explain_cursor)(unsafe.Pointer(pCur)).Frc != SQLITE_ROW))
 20397  }
 20398  
 20399  // This method is called to "rewind" the explain_cursor object back
 20400  // to the first row of output.  This method is always called at least
 20401  // once prior to any call to explainColumn() or explainRowid() or
 20402  // explainEof().
 20403  //
 20404  // The argv[0] is the SQL statement that is to be explained.
 20405  func explainFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* explain.c:192:12: */
 20406  	bp := tls.Alloc(16)
 20407  	defer tls.Free(16)
 20408  
 20409  	var pCur uintptr = pVtabCursor
 20410  	var zSql uintptr = uintptr(0)
 20411  	var rc int32
 20412  	sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 20413  	(*explain_cursor)(unsafe.Pointer(pCur)).FpExplain = uintptr(0)
 20414  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) != SQLITE_TEXT {
 20415  		(*explain_cursor)(unsafe.Pointer(pCur)).Frc = SQLITE_DONE
 20416  		return SQLITE_OK
 20417  	}
 20418  	sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 20419  	(*explain_cursor)(unsafe.Pointer(pCur)).FzSql = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 20420  	if (*explain_cursor)(unsafe.Pointer(pCur)).FzSql != 0 {
 20421  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+4824 /* "EXPLAIN %s" */, libc.VaList(bp+8, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql))
 20422  	}
 20423  	if zSql == uintptr(0) {
 20424  		rc = SQLITE_NOMEM
 20425  	} else {
 20426  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*explain_cursor)(unsafe.Pointer(pCur)).Fdb, zSql, -1, (pCur + 12 /* &.pExplain */), uintptr(0))
 20427  		sqlite3.Xsqlite3_free(tls, zSql)
 20428  	}
 20429  	if rc != 0 {
 20430  		sqlite3.Xsqlite3_finalize(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 20431  		(*explain_cursor)(unsafe.Pointer(pCur)).FpExplain = uintptr(0)
 20432  		sqlite3.Xsqlite3_free(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FzSql)
 20433  		(*explain_cursor)(unsafe.Pointer(pCur)).FzSql = uintptr(0)
 20434  	} else {
 20435  		(*explain_cursor)(unsafe.Pointer(pCur)).Frc = sqlite3.Xsqlite3_step(tls, (*explain_cursor)(unsafe.Pointer(pCur)).FpExplain)
 20436  		if ((*explain_cursor)(unsafe.Pointer(pCur)).Frc == SQLITE_DONE) || ((*explain_cursor)(unsafe.Pointer(pCur)).Frc == SQLITE_ROW) {
 20437  			rc = SQLITE_OK
 20438  		} else {
 20439  			rc = (*explain_cursor)(unsafe.Pointer(pCur)).Frc
 20440  		}
 20441  	}
 20442  	return rc
 20443  }
 20444  
 20445  // SQLite will invoke this method one or more times while planning a query
 20446  // that uses the explain virtual table.  This routine needs to create
 20447  // a query plan for each invocation and compute an estimated cost for that
 20448  // plan.
 20449  func explainBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* explain.c:235:12: */
 20450  	var i int32            // Loop counter
 20451  	var idx int32 = -1     // Index of a usable == constraint against SQL
 20452  	var unusable int32 = 0 // True if there are unusable constraints on SQL
 20453  
 20454  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(500)
 20455  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 20456  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 20457  		if (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn != EXPLN_COLUMN_SQL {
 20458  			continue
 20459  		}
 20460  		if !(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) != 0) {
 20461  			unusable = 1
 20462  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 20463  			idx = i
 20464  		}
 20465  	}
 20466  	if idx >= 0 {
 20467  		// There exists a usable == constraint against the SQL column
 20468  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 20469  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 20470  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).FargvIndex = 1
 20471  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).Fomit = uint8(1)
 20472  	} else if unusable != 0 {
 20473  		// There are unusable constraints against the SQL column.  Do not allow
 20474  		// this plan to continue forward.
 20475  		return SQLITE_CONSTRAINT
 20476  	}
 20477  	return SQLITE_OK
 20478  }
 20479  
 20480  // This following structure defines all the methods for the
 20481  // explain virtual table.
 20482  var explainModule = sqlite3_module{ // xCreate
 20483  	FxConnect:    0, // xConnect
 20484  	FxBestIndex:  0, // xBestIndex
 20485  	FxDisconnect: 0, // xDestroy
 20486  	FxOpen:       0, // xOpen - open a cursor
 20487  	FxClose:      0, // xClose - close a cursor
 20488  	FxFilter:     0, // xFilter - configure scan constraints
 20489  	FxNext:       0, // xNext - advance a cursor
 20490  	FxEof:        0, // xEof - check for end of scan
 20491  	FxColumn:     0, // xColumn - read data
 20492  	FxRowid:      0, // xShadowName
 20493  } /* explain.c:271:23 */
 20494  
 20495  func sqlite3ExplainVtabInit(tls *libc.TLS, db uintptr) int32 { /* explain.c:300:5: */
 20496  	var rc int32 = SQLITE_OK
 20497  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+4835 /* "explain" */, uintptr(unsafe.Pointer(&explainModule)), uintptr(0))
 20498  	return rc
 20499  }
 20500  
 20501  func sqlite3_explain_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* explain.c:311:5: */
 20502  	var rc int32 = SQLITE_OK
 20503  	_ = pApi
 20504  
 20505  	rc = sqlite3ExplainVtabInit(tls, db)
 20506  	return rc
 20507  }
 20508  
 20509  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 20510  //    This file is part of the GNU C Library.
 20511  //
 20512  //    The GNU C Library is free software; you can redistribute it and/or
 20513  //    modify it under the terms of the GNU Lesser General Public
 20514  //    License as published by the Free Software Foundation; either
 20515  //    version 2.1 of the License, or (at your option) any later version.
 20516  //
 20517  //    The GNU C Library is distributed in the hope that it will be useful,
 20518  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20519  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20520  //    Lesser General Public License for more details.
 20521  //
 20522  //    You should have received a copy of the GNU Lesser General Public
 20523  //    License along with the GNU C Library; if not, see
 20524  //    <http://www.gnu.org/licenses/>.
 20525  
 20526  //	POSIX Standard: 6.5 File Control Operations	<fcntl.h>
 20527  
 20528  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 20529  //    This file is part of the GNU C Library.
 20530  //
 20531  //    The GNU C Library is free software; you can redistribute it and/or
 20532  //    modify it under the terms of the GNU Lesser General Public
 20533  //    License as published by the Free Software Foundation; either
 20534  //    version 2.1 of the License, or (at your option) any later version.
 20535  //
 20536  //    The GNU C Library is distributed in the hope that it will be useful,
 20537  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20538  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20539  //    Lesser General Public License for more details.
 20540  //
 20541  //    You should have received a copy of the GNU Lesser General Public
 20542  //    License along with the GNU C Library; if not, see
 20543  //    <http://www.gnu.org/licenses/>.
 20544  
 20545  // This must be early so <bits/fcntl.h> can define types winningly.
 20546  
 20547  // Get __mode_t, __dev_t and __off_t  .
 20548  // bits/types.h -- definitions of __*_t types underlying *_t types.
 20549  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 20550  //    This file is part of the GNU C Library.
 20551  //
 20552  //    The GNU C Library is free software; you can redistribute it and/or
 20553  //    modify it under the terms of the GNU Lesser General Public
 20554  //    License as published by the Free Software Foundation; either
 20555  //    version 2.1 of the License, or (at your option) any later version.
 20556  //
 20557  //    The GNU C Library is distributed in the hope that it will be useful,
 20558  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20559  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20560  //    Lesser General Public License for more details.
 20561  //
 20562  //    You should have received a copy of the GNU Lesser General Public
 20563  //    License along with the GNU C Library; if not, see
 20564  //    <http://www.gnu.org/licenses/>.
 20565  
 20566  // Never include this file directly; use <sys/types.h> instead.
 20567  
 20568  // Get the definitions of O_*, F_*, FD_*: all the
 20569  //    numbers and flag bits for `open', `fcntl', et al.
 20570  // O_*, F_*, FD_* bit values for Linux.
 20571  //    Copyright (C) 1995-2018 Free Software Foundation, Inc.
 20572  //    This file is part of the GNU C Library.
 20573  //
 20574  //    The GNU C Library is free software; you can redistribute it and/or
 20575  //    modify it under the terms of the GNU Lesser General Public
 20576  //    License as published by the Free Software Foundation; either
 20577  //    version 2.1 of the License, or (at your option) any later version.
 20578  //
 20579  //    The GNU C Library is distributed in the hope that it will be useful,
 20580  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20581  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20582  //    Lesser General Public License for more details.
 20583  //
 20584  //    You should have received a copy of the GNU Lesser General Public
 20585  //    License along with the GNU C Library.  If not, see
 20586  //    <http://www.gnu.org/licenses/>.
 20587  
 20588  type flock = struct {
 20589  	Fl_type   int16
 20590  	Fl_whence int16
 20591  	_         [4]byte
 20592  	Fl_start  int64
 20593  	Fl_len    int64
 20594  	Fl_pid    int32
 20595  	_         [4]byte
 20596  } /* fcntl.h:28:1 */
 20597  
 20598  // Define some inlines helping to catch common problems.
 20599  
 20600  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 20601  //    This file is part of the GNU C Library.
 20602  //
 20603  //    The GNU C Library is free software; you can redistribute it and/or
 20604  //    modify it under the terms of the GNU Lesser General Public
 20605  //    License as published by the Free Software Foundation; either
 20606  //    version 2.1 of the License, or (at your option) any later version.
 20607  //
 20608  //    The GNU C Library is distributed in the hope that it will be useful,
 20609  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20610  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20611  //    Lesser General Public License for more details.
 20612  //
 20613  //    You should have received a copy of the GNU Lesser General Public
 20614  //    License along with the GNU C Library; if not, see
 20615  //    <http://www.gnu.org/licenses/>.
 20616  
 20617  //	POSIX Standard: 2.10 Symbolic Constants		<unistd.h>
 20618  
 20619  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 20620  //    This file is part of the GNU C Library.
 20621  //
 20622  //    The GNU C Library is free software; you can redistribute it and/or
 20623  //    modify it under the terms of the GNU Lesser General Public
 20624  //    License as published by the Free Software Foundation; either
 20625  //    version 2.1 of the License, or (at your option) any later version.
 20626  //
 20627  //    The GNU C Library is distributed in the hope that it will be useful,
 20628  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20629  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20630  //    Lesser General Public License for more details.
 20631  //
 20632  //    You should have received a copy of the GNU Lesser General Public
 20633  //    License along with the GNU C Library; if not, see
 20634  //    <http://www.gnu.org/licenses/>.
 20635  
 20636  // These may be used to determine what facilities are present at compile time.
 20637  //    Their values can be obtained at run time from `sysconf'.
 20638  
 20639  // POSIX Standard approved as ISO/IEC 9945-1 as of September 2008.
 20640  
 20641  // These are not #ifdef __USE_POSIX2 because they are
 20642  //    in the theoretically application-owned namespace.
 20643  
 20644  // The utilities on GNU systems also correspond to this version.
 20645  
 20646  // The utilities on GNU systems also correspond to this version.
 20647  
 20648  // This symbol was required until the 2001 edition of POSIX.
 20649  
 20650  // If defined, the implementation supports the
 20651  //    C Language Bindings Option.
 20652  
 20653  // If defined, the implementation supports the
 20654  //    C Language Development Utilities Option.
 20655  
 20656  // If defined, the implementation supports the
 20657  //    Software Development Utilities Option.
 20658  
 20659  // If defined, the implementation supports the
 20660  //    creation of locales with the localedef utility.
 20661  
 20662  // X/Open version number to which the library conforms.  It is selectable.
 20663  
 20664  // Commands and utilities from XPG4 are available.
 20665  
 20666  // We are compatible with the old published standards as well.
 20667  
 20668  // The X/Open Unix extensions are available.
 20669  
 20670  // The enhanced internationalization capabilities according to XPG4.2
 20671  //    are present.
 20672  
 20673  // The legacy interfaces are also available.
 20674  
 20675  // Get values of POSIX options:
 20676  //
 20677  //    If these symbols are defined, the corresponding features are
 20678  //    always available.  If not, they may be available sometimes.
 20679  //    The current values can be obtained with `sysconf'.
 20680  //
 20681  //    _POSIX_JOB_CONTROL		Job control is supported.
 20682  //    _POSIX_SAVED_IDS		Processes have a saved set-user-ID
 20683  // 				and a saved set-group-ID.
 20684  //    _POSIX_REALTIME_SIGNALS	Real-time, queued signals are supported.
 20685  //    _POSIX_PRIORITY_SCHEDULING	Priority scheduling is supported.
 20686  //    _POSIX_TIMERS		POSIX.4 clocks and timers are supported.
 20687  //    _POSIX_ASYNCHRONOUS_IO	Asynchronous I/O is supported.
 20688  //    _POSIX_PRIORITIZED_IO	Prioritized asynchronous I/O is supported.
 20689  //    _POSIX_SYNCHRONIZED_IO	Synchronizing file data is supported.
 20690  //    _POSIX_FSYNC			The fsync function is present.
 20691  //    _POSIX_MAPPED_FILES		Mapping of files to memory is supported.
 20692  //    _POSIX_MEMLOCK		Locking of all memory is supported.
 20693  //    _POSIX_MEMLOCK_RANGE		Locking of ranges of memory is supported.
 20694  //    _POSIX_MEMORY_PROTECTION	Setting of memory protections is supported.
 20695  //    _POSIX_MESSAGE_PASSING	POSIX.4 message queues are supported.
 20696  //    _POSIX_SEMAPHORES		POSIX.4 counting semaphores are supported.
 20697  //    _POSIX_SHARED_MEMORY_OBJECTS	POSIX.4 shared memory objects are supported.
 20698  //    _POSIX_THREADS		POSIX.1c pthreads are supported.
 20699  //    _POSIX_THREAD_ATTR_STACKADDR	Thread stack address attribute option supported.
 20700  //    _POSIX_THREAD_ATTR_STACKSIZE	Thread stack size attribute option supported.
 20701  //    _POSIX_THREAD_SAFE_FUNCTIONS	Thread-safe functions are supported.
 20702  //    _POSIX_THREAD_PRIORITY_SCHEDULING
 20703  // 				POSIX.1c thread execution scheduling supported.
 20704  //    _POSIX_THREAD_PRIO_INHERIT	Thread priority inheritance option supported.
 20705  //    _POSIX_THREAD_PRIO_PROTECT	Thread priority protection option supported.
 20706  //    _POSIX_THREAD_PROCESS_SHARED	Process-shared synchronization supported.
 20707  //    _POSIX_PII			Protocol-independent interfaces are supported.
 20708  //    _POSIX_PII_XTI		XTI protocol-indep. interfaces are supported.
 20709  //    _POSIX_PII_SOCKET		Socket protocol-indep. interfaces are supported.
 20710  //    _POSIX_PII_INTERNET		Internet family of protocols supported.
 20711  //    _POSIX_PII_INTERNET_STREAM	Connection-mode Internet protocol supported.
 20712  //    _POSIX_PII_INTERNET_DGRAM	Connectionless Internet protocol supported.
 20713  //    _POSIX_PII_OSI		ISO/OSI family of protocols supported.
 20714  //    _POSIX_PII_OSI_COTS		Connection-mode ISO/OSI service supported.
 20715  //    _POSIX_PII_OSI_CLTS		Connectionless ISO/OSI service supported.
 20716  //    _POSIX_POLL			Implementation supports `poll' function.
 20717  //    _POSIX_SELECT		Implementation supports `select' and `pselect'.
 20718  //
 20719  //    _XOPEN_REALTIME		X/Open realtime support is available.
 20720  //    _XOPEN_REALTIME_THREADS	X/Open realtime thread support is available.
 20721  //    _XOPEN_SHM			Shared memory interface according to XPG4.2.
 20722  //
 20723  //    _XBS5_ILP32_OFF32		Implementation provides environment with 32-bit
 20724  // 				int, long, pointer, and off_t types.
 20725  //    _XBS5_ILP32_OFFBIG		Implementation provides environment with 32-bit
 20726  // 				int, long, and pointer and off_t with at least
 20727  // 				64 bits.
 20728  //    _XBS5_LP64_OFF64		Implementation provides environment with 32-bit
 20729  // 				int, and 64-bit long, pointer, and off_t types.
 20730  //    _XBS5_LPBIG_OFFBIG		Implementation provides environment with at
 20731  // 				least 32 bits int and long, pointer, and off_t
 20732  // 				with at least 64 bits.
 20733  //
 20734  //    If any of these symbols is defined as -1, the corresponding option is not
 20735  //    true for any file.  If any is defined as other than -1, the corresponding
 20736  //    option is true for all files.  If a symbol is not defined at all, the value
 20737  //    for a specific file can be obtained from `pathconf' and `fpathconf'.
 20738  //
 20739  //    _POSIX_CHOWN_RESTRICTED	Only the super user can use `chown' to change
 20740  // 				the owner of a file.  `chown' can only be used
 20741  // 				to change the group ID of a file to a group of
 20742  // 				which the calling process is a member.
 20743  //    _POSIX_NO_TRUNC		Pathname components longer than
 20744  // 				NAME_MAX generate an error.
 20745  //    _POSIX_VDISABLE		If defined, if the value of an element of the
 20746  // 				`c_cc' member of `struct termios' is
 20747  // 				_POSIX_VDISABLE, no character will have the
 20748  // 				effect associated with that element.
 20749  //    _POSIX_SYNC_IO		Synchronous I/O may be performed.
 20750  //    _POSIX_ASYNC_IO		Asynchronous I/O may be performed.
 20751  //    _POSIX_PRIO_IO		Prioritized Asynchronous I/O may be performed.
 20752  //
 20753  //    Support for the Large File Support interface is not generally available.
 20754  //    If it is available the following constants are defined to one.
 20755  //    _LFS64_LARGEFILE		Low-level I/O supports large files.
 20756  //    _LFS64_STDIO			Standard I/O supports large files.
 20757  //
 20758  
 20759  // Define POSIX options for Linux.
 20760  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 20761  //    This file is part of the GNU C Library.
 20762  //
 20763  //    The GNU C Library is free software; you can redistribute it and/or
 20764  //    modify it under the terms of the GNU Lesser General Public License as
 20765  //    published by the Free Software Foundation; either version 2.1 of the
 20766  //    License, or (at your option) any later version.
 20767  //
 20768  //    The GNU C Library is distributed in the hope that it will be useful,
 20769  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20770  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20771  //    Lesser General Public License for more details.
 20772  //
 20773  //    You should have received a copy of the GNU Lesser General Public
 20774  //    License along with the GNU C Library; see the file COPYING.LIB.  If
 20775  //    not, see <http://www.gnu.org/licenses/>.
 20776  
 20777  // Job control is supported.
 20778  
 20779  // Processes have a saved set-user-ID and a saved set-group-ID.
 20780  
 20781  // Priority scheduling is supported.
 20782  
 20783  // Synchronizing file data is supported.
 20784  
 20785  // The fsync function is present.
 20786  
 20787  // Mapping of files to memory is supported.
 20788  
 20789  // Locking of all memory is supported.
 20790  
 20791  // Locking of ranges of memory is supported.
 20792  
 20793  // Setting of memory protections is supported.
 20794  
 20795  // Some filesystems allow all users to change file ownership.
 20796  
 20797  // `c_cc' member of 'struct termios' structure can be disabled by
 20798  //    using the value _POSIX_VDISABLE.
 20799  
 20800  // Filenames are not silently truncated.
 20801  
 20802  // X/Open realtime support is available.
 20803  
 20804  // X/Open thread realtime support is available.
 20805  
 20806  // XPG4.2 shared memory is supported.
 20807  
 20808  // Tell we have POSIX threads.
 20809  
 20810  // We have the reentrant functions described in POSIX.
 20811  
 20812  // We provide priority scheduling for threads.
 20813  
 20814  // We support user-defined stack sizes.
 20815  
 20816  // We support user-defined stacks.
 20817  
 20818  // We support priority inheritence.
 20819  
 20820  // We support priority protection, though only for non-robust
 20821  //    mutexes.
 20822  
 20823  // We support priority inheritence for robust mutexes.
 20824  
 20825  // We do not support priority protection for robust mutexes.
 20826  
 20827  // We support POSIX.1b semaphores.
 20828  
 20829  // Real-time signals are supported.
 20830  
 20831  // We support asynchronous I/O.
 20832  // Alternative name for Unix98.
 20833  // Support for prioritization is also available.
 20834  
 20835  // The LFS support in asynchronous I/O is also available.
 20836  
 20837  // The rest of the LFS is also available.
 20838  
 20839  // POSIX shared memory objects are implemented.
 20840  
 20841  // CPU-time clocks support needs to be checked at runtime.
 20842  
 20843  // Clock support in threads must be also checked at runtime.
 20844  
 20845  // GNU libc provides regular expression handling.
 20846  
 20847  // Reader/Writer locks are available.
 20848  
 20849  // We have a POSIX shell.
 20850  
 20851  // We support the Timeouts option.
 20852  
 20853  // We support spinlocks.
 20854  
 20855  // The `spawn' function family is supported.
 20856  
 20857  // We have POSIX timers.
 20858  
 20859  // The barrier functions are available.
 20860  
 20861  // POSIX message queues are available.
 20862  
 20863  // Thread process-shared synchronization is supported.
 20864  
 20865  // The monotonic clock might be available.
 20866  
 20867  // The clock selection interfaces are available.
 20868  
 20869  // Advisory information interfaces are available.
 20870  
 20871  // IPv6 support is available.
 20872  
 20873  // Raw socket support is available.
 20874  
 20875  // We have at least one terminal.
 20876  
 20877  // Neither process nor thread sporadic server interfaces is available.
 20878  
 20879  // trace.h is not available.
 20880  
 20881  // Typed memory objects are not available.
 20882  
 20883  // Get the environment definitions from Unix98.
 20884  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 20885  //    This file is part of the GNU C Library.
 20886  //
 20887  //    The GNU C Library is free software; you can redistribute it and/or
 20888  //    modify it under the terms of the GNU Lesser General Public
 20889  //    License as published by the Free Software Foundation; either
 20890  //    version 2.1 of the License, or (at your option) any later version.
 20891  //
 20892  //    The GNU C Library is distributed in the hope that it will be useful,
 20893  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20894  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20895  //    Lesser General Public License for more details.
 20896  //
 20897  //    You should have received a copy of the GNU Lesser General Public
 20898  //    License along with the GNU C Library; if not, see
 20899  //    <http://www.gnu.org/licenses/>.
 20900  
 20901  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 20902  //    This file is part of the GNU C Library.
 20903  //
 20904  //    The GNU C Library is free software; you can redistribute it and/or
 20905  //    modify it under the terms of the GNU Lesser General Public
 20906  //    License as published by the Free Software Foundation; either
 20907  //    version 2.1 of the License, or (at your option) any later version.
 20908  //
 20909  //    The GNU C Library is distributed in the hope that it will be useful,
 20910  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20911  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20912  //    Lesser General Public License for more details.
 20913  //
 20914  //    You should have received a copy of the GNU Lesser General Public
 20915  //    License along with the GNU C Library; if not, see
 20916  //    <http://www.gnu.org/licenses/>.
 20917  
 20918  // This header should define the following symbols under the described
 20919  //    situations.  A value `1' means that the model is always supported,
 20920  //    `-1' means it is never supported.  Undefined means it cannot be
 20921  //    statically decided.
 20922  //
 20923  //    _POSIX_V7_ILP32_OFF32   32bit int, long, pointers, and off_t type
 20924  //    _POSIX_V7_ILP32_OFFBIG  32bit int, long, and pointers and larger off_t type
 20925  //
 20926  //    _POSIX_V7_LP64_OFF32	   64bit long and pointers and 32bit off_t type
 20927  //    _POSIX_V7_LPBIG_OFFBIG  64bit long and pointers and large off_t type
 20928  //
 20929  //    The macros _POSIX_V6_ILP32_OFF32, _POSIX_V6_ILP32_OFFBIG,
 20930  //    _POSIX_V6_LP64_OFF32, _POSIX_V6_LPBIG_OFFBIG, _XBS5_ILP32_OFF32,
 20931  //    _XBS5_ILP32_OFFBIG, _XBS5_LP64_OFF32, and _XBS5_LPBIG_OFFBIG were
 20932  //    used in previous versions of the Unix standard and are available
 20933  //    only for compatibility.
 20934  
 20935  // By default we have 32-bit wide `int', `long int', pointers and `off_t'
 20936  //    and all platforms support LFS.
 20937  
 20938  // We optionally provide an environment with the above size but an 64-bit
 20939  //    side `off_t'.  Therefore we don't define _POSIX_V7_ILP32_OFFBIG.
 20940  
 20941  // We can never provide environments with 64-bit wide pointers.
 20942  
 20943  // CFLAGS.
 20944  
 20945  // Standard file descriptors.
 20946  
 20947  // All functions that are not declared anywhere else.
 20948  
 20949  // bits/types.h -- definitions of __*_t types underlying *_t types.
 20950  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 20951  //    This file is part of the GNU C Library.
 20952  //
 20953  //    The GNU C Library is free software; you can redistribute it and/or
 20954  //    modify it under the terms of the GNU Lesser General Public
 20955  //    License as published by the Free Software Foundation; either
 20956  //    version 2.1 of the License, or (at your option) any later version.
 20957  //
 20958  //    The GNU C Library is distributed in the hope that it will be useful,
 20959  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 20960  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 20961  //    Lesser General Public License for more details.
 20962  //
 20963  //    You should have received a copy of the GNU Lesser General Public
 20964  //    License along with the GNU C Library; if not, see
 20965  //    <http://www.gnu.org/licenses/>.
 20966  
 20967  // Never include this file directly; use <sys/types.h> instead.
 20968  
 20969  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 20970  //
 20971  // This file is part of GCC.
 20972  //
 20973  // GCC is free software; you can redistribute it and/or modify
 20974  // it under the terms of the GNU General Public License as published by
 20975  // the Free Software Foundation; either version 3, or (at your option)
 20976  // any later version.
 20977  //
 20978  // GCC is distributed in the hope that it will be useful,
 20979  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 20980  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20981  // GNU General Public License for more details.
 20982  //
 20983  // Under Section 7 of GPL version 3, you are granted additional
 20984  // permissions described in the GCC Runtime Library Exception, version
 20985  // 3.1, as published by the Free Software Foundation.
 20986  //
 20987  // You should have received a copy of the GNU General Public License and
 20988  // a copy of the GCC Runtime Library Exception along with this program;
 20989  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 20990  // <http://www.gnu.org/licenses/>.
 20991  
 20992  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 20993  
 20994  // Any one of these symbols __need_* means that GNU libc
 20995  //    wants us just to define one data type.  So don't define
 20996  //    the symbols that indicate this file's entire job has been done.
 20997  
 20998  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 20999  //    There's no way to win with the other order!  Sun lossage.
 21000  
 21001  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 21002  //    one less case to deal with in the following.
 21003  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 21004  
 21005  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 21006  //    defined if the corresponding type is *not* defined.
 21007  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 21008  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 21009  
 21010  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 21011  //    Just ignore it.
 21012  
 21013  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 21014  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 21015  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 21016  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 21017  //    If we find that the macros are still defined at this point, we must
 21018  //    invoke them so that the type is defined as expected.
 21019  
 21020  // In case nobody has defined these types, but we aren't running under
 21021  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 21022  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 21023  //    parts of GCC is compiled by an older compiler, that actually
 21024  //    include gstddef.h, such as collect2.
 21025  
 21026  // Signed type of difference of two pointers.
 21027  
 21028  // Define this type if we are doing the whole job,
 21029  //    or if we want this type in particular.
 21030  
 21031  // Unsigned type of `sizeof' something.
 21032  
 21033  // Define this type if we are doing the whole job,
 21034  //    or if we want this type in particular.
 21035  
 21036  // Wide character type.
 21037  //    Locale-writers should change this as necessary to
 21038  //    be big enough to hold unique values not between 0 and 127,
 21039  //    and not (wchar_t) -1, for each defined multibyte character.
 21040  
 21041  // Define this type if we are doing the whole job,
 21042  //    or if we want this type in particular.
 21043  
 21044  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 21045  //     are already defined.
 21046  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 21047  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 21048  
 21049  // A null pointer constant.
 21050  
 21051  // The Single Unix specification says that some more types are
 21052  //    available here.
 21053  
 21054  type useconds_t = uint32 /* unistd.h:255:22 */
 21055  
 21056  type intptr_t = int32 /* unistd.h:267:20 */
 21057  
 21058  type socklen_t = uint32 /* unistd.h:274:21 */
 21059  
 21060  // Define some macros helping to catch buffer overflows.
 21061  
 21062  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21063  //    This file is part of the GNU C Library.
 21064  //
 21065  //    The GNU C Library is free software; you can redistribute it and/or
 21066  //    modify it under the terms of the GNU Lesser General Public
 21067  //    License as published by the Free Software Foundation; either
 21068  //    version 2.1 of the License, or (at your option) any later version.
 21069  //
 21070  //    The GNU C Library is distributed in the hope that it will be useful,
 21071  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21072  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21073  //    Lesser General Public License for more details.
 21074  //
 21075  //    You should have received a copy of the GNU Lesser General Public
 21076  //    License along with the GNU C Library; if not, see
 21077  //    <http://www.gnu.org/licenses/>.
 21078  
 21079  //	POSIX Standard: 5.1.2 Directory Operations	<dirent.h>
 21080  
 21081  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21082  //    This file is part of the GNU C Library.
 21083  //
 21084  //    The GNU C Library is free software; you can redistribute it and/or
 21085  //    modify it under the terms of the GNU Lesser General Public
 21086  //    License as published by the Free Software Foundation; either
 21087  //    version 2.1 of the License, or (at your option) any later version.
 21088  //
 21089  //    The GNU C Library is distributed in the hope that it will be useful,
 21090  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21091  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21092  //    Lesser General Public License for more details.
 21093  //
 21094  //    You should have received a copy of the GNU Lesser General Public
 21095  //    License along with the GNU C Library; if not, see
 21096  //    <http://www.gnu.org/licenses/>.
 21097  
 21098  // bits/types.h -- definitions of __*_t types underlying *_t types.
 21099  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 21100  //    This file is part of the GNU C Library.
 21101  //
 21102  //    The GNU C Library is free software; you can redistribute it and/or
 21103  //    modify it under the terms of the GNU Lesser General Public
 21104  //    License as published by the Free Software Foundation; either
 21105  //    version 2.1 of the License, or (at your option) any later version.
 21106  //
 21107  //    The GNU C Library is distributed in the hope that it will be useful,
 21108  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21109  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21110  //    Lesser General Public License for more details.
 21111  //
 21112  //    You should have received a copy of the GNU Lesser General Public
 21113  //    License along with the GNU C Library; if not, see
 21114  //    <http://www.gnu.org/licenses/>.
 21115  
 21116  // Never include this file directly; use <sys/types.h> instead.
 21117  
 21118  // This file defines `struct dirent'.
 21119  //
 21120  //    It defines the macro `_DIRENT_HAVE_D_NAMLEN' iff there is a `d_namlen'
 21121  //    member that gives the length of `d_name'.
 21122  //
 21123  //    It defines the macro `_DIRENT_HAVE_D_RECLEN' iff there is a `d_reclen'
 21124  //    member that gives the size of the entire directory entry.
 21125  //
 21126  //    It defines the macro `_DIRENT_HAVE_D_OFF' iff there is a `d_off'
 21127  //    member that gives the file offset of the next directory entry.
 21128  //
 21129  //    It defines the macro `_DIRENT_HAVE_D_TYPE' iff there is a `d_type'
 21130  //    member that gives the type of the file.
 21131  //
 21132  
 21133  // Copyright (C) 1996-2018 Free Software Foundation, Inc.
 21134  //    This file is part of the GNU C Library.
 21135  //
 21136  //    The GNU C Library is free software; you can redistribute it and/or
 21137  //    modify it under the terms of the GNU Lesser General Public
 21138  //    License as published by the Free Software Foundation; either
 21139  //    version 2.1 of the License, or (at your option) any later version.
 21140  //
 21141  //    The GNU C Library is distributed in the hope that it will be useful,
 21142  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21143  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21144  //    Lesser General Public License for more details.
 21145  //
 21146  //    You should have received a copy of the GNU Lesser General Public
 21147  //    License along with the GNU C Library; if not, see
 21148  //    <http://www.gnu.org/licenses/>.
 21149  
 21150  type dirent = struct {
 21151  	Fd_ino    uint64
 21152  	Fd_off    int64
 21153  	Fd_reclen uint16
 21154  	Fd_type   uint8
 21155  	Fd_name   [256]int8
 21156  	_         [5]byte
 21157  } /* dirent.h:22:1 */
 21158  
 21159  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21160  //    This file is part of the GNU C Library.
 21161  //
 21162  //    The GNU C Library is free software; you can redistribute it and/or
 21163  //    modify it under the terms of the GNU Lesser General Public
 21164  //    License as published by the Free Software Foundation; either
 21165  //    version 2.1 of the License, or (at your option) any later version.
 21166  //
 21167  //    The GNU C Library is distributed in the hope that it will be useful,
 21168  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21169  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21170  //    Lesser General Public License for more details.
 21171  //
 21172  //    You should have received a copy of the GNU Lesser General Public
 21173  //    License along with the GNU C Library; if not, see
 21174  //    <http://www.gnu.org/licenses/>.
 21175  
 21176  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21177  //    This file is part of the GNU C Library.
 21178  //
 21179  //    The GNU C Library is free software; you can redistribute it and/or
 21180  //    modify it under the terms of the GNU Lesser General Public
 21181  //    License as published by the Free Software Foundation; either
 21182  //    version 2.1 of the License, or (at your option) any later version.
 21183  //
 21184  //    The GNU C Library is distributed in the hope that it will be useful,
 21185  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21186  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21187  //    Lesser General Public License for more details.
 21188  //
 21189  //    You should have received a copy of the GNU Lesser General Public
 21190  //    License along with the GNU C Library; if not, see
 21191  //    <http://www.gnu.org/licenses/>.
 21192  
 21193  // bits/types.h -- definitions of __*_t types underlying *_t types.
 21194  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 21195  //    This file is part of the GNU C Library.
 21196  //
 21197  //    The GNU C Library is free software; you can redistribute it and/or
 21198  //    modify it under the terms of the GNU Lesser General Public
 21199  //    License as published by the Free Software Foundation; either
 21200  //    version 2.1 of the License, or (at your option) any later version.
 21201  //
 21202  //    The GNU C Library is distributed in the hope that it will be useful,
 21203  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21204  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21205  //    Lesser General Public License for more details.
 21206  //
 21207  //    You should have received a copy of the GNU Lesser General Public
 21208  //    License along with the GNU C Library; if not, see
 21209  //    <http://www.gnu.org/licenses/>.
 21210  
 21211  // Never include this file directly; use <sys/types.h> instead.
 21212  
 21213  // `fd_set' type and related macros, and `select'/`pselect' declarations.
 21214  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 21215  //    This file is part of the GNU C Library.
 21216  //
 21217  //    The GNU C Library is free software; you can redistribute it and/or
 21218  //    modify it under the terms of the GNU Lesser General Public
 21219  //    License as published by the Free Software Foundation; either
 21220  //    version 2.1 of the License, or (at your option) any later version.
 21221  //
 21222  //    The GNU C Library is distributed in the hope that it will be useful,
 21223  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21224  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21225  //    Lesser General Public License for more details.
 21226  //
 21227  //    You should have received a copy of the GNU Lesser General Public
 21228  //    License along with the GNU C Library; if not, see
 21229  //    <http://www.gnu.org/licenses/>.
 21230  
 21231  //	POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h>
 21232  
 21233  // Structure crudely representing a timezone.
 21234  //    This is obsolete and should never be used.
 21235  type timezone = struct {
 21236  	Ftz_minuteswest int32
 21237  	Ftz_dsttime     int32
 21238  } /* time.h:52:1 */
 21239  
 21240  // Type of the second argument to `getitimer' and
 21241  //    the second and third arguments `setitimer'.
 21242  type itimerval = struct {
 21243  	Fit_interval struct {
 21244  		Ftv_sec  int32
 21245  		Ftv_usec int32
 21246  	}
 21247  	Fit_value struct {
 21248  		Ftv_sec  int32
 21249  		Ftv_usec int32
 21250  	}
 21251  } /* time.h:104:1 */
 21252  
 21253  // Convenience macros for operations on timevals.
 21254  //    NOTE: `timercmp' does not work for >= or <=.
 21255  
 21256  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21257  //    This file is part of the GNU C Library.
 21258  //
 21259  //    The GNU C Library is free software; you can redistribute it and/or
 21260  //    modify it under the terms of the GNU Lesser General Public
 21261  //    License as published by the Free Software Foundation; either
 21262  //    version 2.1 of the License, or (at your option) any later version.
 21263  //
 21264  //    The GNU C Library is distributed in the hope that it will be useful,
 21265  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21266  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21267  //    Lesser General Public License for more details.
 21268  //
 21269  //    You should have received a copy of the GNU Lesser General Public
 21270  //    License along with the GNU C Library; if not, see
 21271  //    <http://www.gnu.org/licenses/>.
 21272  
 21273  //	ISO C99 Standard: 7.23 Date and time	<time.h>
 21274  
 21275  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 21276  //    This file is part of the GNU C Library.
 21277  //
 21278  //    The GNU C Library is free software; you can redistribute it and/or
 21279  //    modify it under the terms of the GNU Lesser General Public
 21280  //    License as published by the Free Software Foundation; either
 21281  //    version 2.1 of the License, or (at your option) any later version.
 21282  //
 21283  //    The GNU C Library is distributed in the hope that it will be useful,
 21284  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21285  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21286  //    Lesser General Public License for more details.
 21287  //
 21288  //    You should have received a copy of the GNU Lesser General Public
 21289  //    License along with the GNU C Library; if not, see
 21290  //    <http://www.gnu.org/licenses/>.
 21291  
 21292  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 21293  //
 21294  // This file is part of GCC.
 21295  //
 21296  // GCC is free software; you can redistribute it and/or modify
 21297  // it under the terms of the GNU General Public License as published by
 21298  // the Free Software Foundation; either version 3, or (at your option)
 21299  // any later version.
 21300  //
 21301  // GCC is distributed in the hope that it will be useful,
 21302  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 21303  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 21304  // GNU General Public License for more details.
 21305  //
 21306  // Under Section 7 of GPL version 3, you are granted additional
 21307  // permissions described in the GCC Runtime Library Exception, version
 21308  // 3.1, as published by the Free Software Foundation.
 21309  //
 21310  // You should have received a copy of the GNU General Public License and
 21311  // a copy of the GCC Runtime Library Exception along with this program;
 21312  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 21313  // <http://www.gnu.org/licenses/>.
 21314  
 21315  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 21316  
 21317  // Any one of these symbols __need_* means that GNU libc
 21318  //    wants us just to define one data type.  So don't define
 21319  //    the symbols that indicate this file's entire job has been done.
 21320  
 21321  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 21322  //    There's no way to win with the other order!  Sun lossage.
 21323  
 21324  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 21325  //    one less case to deal with in the following.
 21326  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 21327  
 21328  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 21329  //    defined if the corresponding type is *not* defined.
 21330  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 21331  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 21332  
 21333  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 21334  //    Just ignore it.
 21335  
 21336  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 21337  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 21338  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 21339  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 21340  //    If we find that the macros are still defined at this point, we must
 21341  //    invoke them so that the type is defined as expected.
 21342  
 21343  // In case nobody has defined these types, but we aren't running under
 21344  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 21345  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 21346  //    parts of GCC is compiled by an older compiler, that actually
 21347  //    include gstddef.h, such as collect2.
 21348  
 21349  // Signed type of difference of two pointers.
 21350  
 21351  // Define this type if we are doing the whole job,
 21352  //    or if we want this type in particular.
 21353  
 21354  // Unsigned type of `sizeof' something.
 21355  
 21356  // Define this type if we are doing the whole job,
 21357  //    or if we want this type in particular.
 21358  
 21359  // Wide character type.
 21360  //    Locale-writers should change this as necessary to
 21361  //    be big enough to hold unique values not between 0 and 127,
 21362  //    and not (wchar_t) -1, for each defined multibyte character.
 21363  
 21364  // Define this type if we are doing the whole job,
 21365  //    or if we want this type in particular.
 21366  
 21367  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 21368  //     are already defined.
 21369  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 21370  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 21371  
 21372  // A null pointer constant.
 21373  
 21374  // This defines CLOCKS_PER_SEC, which is the number of processor clock
 21375  //    ticks per second, and possibly a number of other constants.
 21376  // System-dependent timing definitions.  Linux version.
 21377  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 21378  //    This file is part of the GNU C Library.
 21379  //
 21380  //    The GNU C Library is free software; you can redistribute it and/or
 21381  //    modify it under the terms of the GNU Lesser General Public
 21382  //    License as published by the Free Software Foundation; either
 21383  //    version 2.1 of the License, or (at your option) any later version.
 21384  //
 21385  //    The GNU C Library is distributed in the hope that it will be useful,
 21386  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21387  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21388  //    Lesser General Public License for more details.
 21389  //
 21390  //    You should have received a copy of the GNU Lesser General Public
 21391  //    License along with the GNU C Library; if not, see
 21392  //    <http://www.gnu.org/licenses/>.
 21393  
 21394  // Never include this file directly; use <time.h> instead.
 21395  
 21396  // bits/types.h -- definitions of __*_t types underlying *_t types.
 21397  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 21398  //    This file is part of the GNU C Library.
 21399  //
 21400  //    The GNU C Library is free software; you can redistribute it and/or
 21401  //    modify it under the terms of the GNU Lesser General Public
 21402  //    License as published by the Free Software Foundation; either
 21403  //    version 2.1 of the License, or (at your option) any later version.
 21404  //
 21405  //    The GNU C Library is distributed in the hope that it will be useful,
 21406  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21407  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21408  //    Lesser General Public License for more details.
 21409  //
 21410  //    You should have received a copy of the GNU Lesser General Public
 21411  //    License along with the GNU C Library; if not, see
 21412  //    <http://www.gnu.org/licenses/>.
 21413  
 21414  // Never include this file directly; use <sys/types.h> instead.
 21415  
 21416  // ISO/IEC 9899:1999 7.23.1: Components of time
 21417  //    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
 21418  //    the number per second of the value returned by the `clock' function.
 21419  // CAE XSH, Issue 4, Version 2: <time.h>
 21420  //    The value of CLOCKS_PER_SEC is required to be 1 million on all
 21421  //    XSI-conformant systems.
 21422  
 21423  // Identifier for system-wide realtime clock.
 21424  // Monotonic system-wide clock.
 21425  // High-resolution timer from the CPU.
 21426  // Thread-specific CPU-time clock.
 21427  // Monotonic system-wide clock, not adjusted for frequency scaling.
 21428  // Identifier for system-wide realtime clock, updated only on ticks.
 21429  // Monotonic system-wide clock, updated only on ticks.
 21430  // Monotonic system-wide clock that includes time spent in suspension.
 21431  // Like CLOCK_REALTIME but also wakes suspended system.
 21432  // Like CLOCK_BOOTTIME but also wakes suspended system.
 21433  // Like CLOCK_REALTIME but in International Atomic Time.
 21434  
 21435  // Flag to indicate time is absolute.
 21436  
 21437  // Many of the typedefs and structs whose official home is this header
 21438  //    may also need to be defined by other headers.
 21439  
 21440  // bits/types.h -- definitions of __*_t types underlying *_t types.
 21441  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 21442  //    This file is part of the GNU C Library.
 21443  //
 21444  //    The GNU C Library is free software; you can redistribute it and/or
 21445  //    modify it under the terms of the GNU Lesser General Public
 21446  //    License as published by the Free Software Foundation; either
 21447  //    version 2.1 of the License, or (at your option) any later version.
 21448  //
 21449  //    The GNU C Library is distributed in the hope that it will be useful,
 21450  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21451  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21452  //    Lesser General Public License for more details.
 21453  //
 21454  //    You should have received a copy of the GNU Lesser General Public
 21455  //    License along with the GNU C Library; if not, see
 21456  //    <http://www.gnu.org/licenses/>.
 21457  
 21458  // Never include this file directly; use <sys/types.h> instead.
 21459  
 21460  // ISO C `broken-down time' structure.
 21461  type tm = struct {
 21462  	Ftm_sec    int32
 21463  	Ftm_min    int32
 21464  	Ftm_hour   int32
 21465  	Ftm_mday   int32
 21466  	Ftm_mon    int32
 21467  	Ftm_year   int32
 21468  	Ftm_wday   int32
 21469  	Ftm_yday   int32
 21470  	Ftm_isdst  int32
 21471  	Ftm_gmtoff int32
 21472  	Ftm_zone   uintptr
 21473  } /* struct_tm.h:7:1 */
 21474  
 21475  // NB: Include guard matches what <linux/time.h> uses.
 21476  
 21477  // bits/types.h -- definitions of __*_t types underlying *_t types.
 21478  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 21479  //    This file is part of the GNU C Library.
 21480  //
 21481  //    The GNU C Library is free software; you can redistribute it and/or
 21482  //    modify it under the terms of the GNU Lesser General Public
 21483  //    License as published by the Free Software Foundation; either
 21484  //    version 2.1 of the License, or (at your option) any later version.
 21485  //
 21486  //    The GNU C Library is distributed in the hope that it will be useful,
 21487  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 21488  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 21489  //    Lesser General Public License for more details.
 21490  //
 21491  //    You should have received a copy of the GNU Lesser General Public
 21492  //    License along with the GNU C Library; if not, see
 21493  //    <http://www.gnu.org/licenses/>.
 21494  
 21495  // Never include this file directly; use <sys/types.h> instead.
 21496  
 21497  // NB: Include guard matches what <linux/time.h> uses.
 21498  
 21499  // POSIX.1b structure for timer start values and intervals.
 21500  type itimerspec = struct {
 21501  	Fit_interval struct {
 21502  		Ftv_sec  int32
 21503  		Ftv_nsec int32
 21504  	}
 21505  	Fit_value struct {
 21506  		Ftv_sec  int32
 21507  		Ftv_nsec int32
 21508  	}
 21509  } /* struct_itimerspec.h:8:1 */
 21510  
 21511  type sigevent = struct {
 21512  	Fsigev_value  struct{ Fsival_int int32 }
 21513  	Fsigev_signo  int32
 21514  	Fsigev_notify int32
 21515  	F_sigev_un    struct{ F_pad [13]int32 }
 21516  } /* sigevent_t.h:22:9 */
 21517  
 21518  // Structure of the fsdir() table-valued function
 21519  //    0    1    2     3    4           5
 21520  
 21521  // Set the result stored by context ctx to a blob containing the
 21522  // contents of file zName.  Or, leave the result unchanged (NULL)
 21523  // if the file does not exist or is unreadable.
 21524  //
 21525  // If the file exceeds the SQLite blob size limit, through an
 21526  // SQLITE_TOOBIG error.
 21527  //
 21528  // Throw an SQLITE_IOERR if there are difficulties pulling the file
 21529  // off of disk.
 21530  func readFileContents(tls *libc.TLS, ctx uintptr, zName uintptr) { /* fileio.c:133:13: */
 21531  	var in uintptr
 21532  	var nIn sqlite3_int64
 21533  	var pBuf uintptr
 21534  	var db uintptr
 21535  	var mxBlob int32
 21536  
 21537  	in = libc.Xfopen(tls, zName, ts+4263 /* "rb" */)
 21538  	if in == uintptr(0) {
 21539  		// File does not exist or is unreadable. Leave the result set to NULL.
 21540  		return
 21541  	}
 21542  	libc.Xfseek(tls, in, 0, SEEK_END)
 21543  	nIn = sqlite3_int64(libc.Xftell(tls, in))
 21544  	libc.Xrewind(tls, in)
 21545  	db = sqlite3.Xsqlite3_context_db_handle(tls, ctx)
 21546  	mxBlob = sqlite3.Xsqlite3_limit(tls, db, SQLITE_LIMIT_LENGTH, -1)
 21547  	if nIn > sqlite3_int64(mxBlob) {
 21548  		sqlite3.Xsqlite3_result_error_code(tls, ctx, SQLITE_TOOBIG)
 21549  		libc.Xfclose(tls, in)
 21550  		return
 21551  	}
 21552  	pBuf = sqlite3.Xsqlite3_malloc64(tls, func() uint64 {
 21553  		if nIn != 0 {
 21554  			return uint64(nIn)
 21555  		}
 21556  		return uint64(1)
 21557  	}())
 21558  	if pBuf == uintptr(0) {
 21559  		sqlite3.Xsqlite3_result_error_nomem(tls, ctx)
 21560  		libc.Xfclose(tls, in)
 21561  		return
 21562  	}
 21563  	if nIn == sqlite3_int64(libc.Xfread(tls, pBuf, uint32(1), size_t(nIn), in)) {
 21564  		sqlite3.Xsqlite3_result_blob64(tls, ctx, pBuf, uint64(nIn), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 21565  	} else {
 21566  		sqlite3.Xsqlite3_result_error_code(tls, ctx, SQLITE_IOERR)
 21567  		sqlite3.Xsqlite3_free(tls, pBuf)
 21568  	}
 21569  	libc.Xfclose(tls, in)
 21570  }
 21571  
 21572  // Implementation of the "readfile(X)" SQL function.  The entire content
 21573  // of the file named X is read and returned as a BLOB.  NULL is returned
 21574  // if the file does not exist or is unreadable.
 21575  func readfileFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:175:13: */
 21576  	var zName uintptr
 21577  	_ = argc // Unused parameter
 21578  	zName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 21579  	if zName == uintptr(0) {
 21580  		return
 21581  	}
 21582  	readFileContents(tls, context, zName)
 21583  }
 21584  
 21585  // Set the error message contained in context ctx to the results of
 21586  // vprintf(zFmt, ...).
 21587  func ctxErrorMsg(tls *libc.TLS, ctx uintptr, zFmt uintptr, va uintptr) { /* fileio.c:191:13: */
 21588  	var zMsg uintptr = uintptr(0)
 21589  	var ap va_list
 21590  	_ = ap
 21591  	ap = va
 21592  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 21593  	sqlite3.Xsqlite3_result_error(tls, ctx, zMsg, -1)
 21594  	sqlite3.Xsqlite3_free(tls, zMsg)
 21595  	_ = ap
 21596  }
 21597  
 21598  // This function is used in place of stat().  On Windows, special handling
 21599  // is required in order for the included time to be returned as UTC.  On all
 21600  // other systems, this function simply calls stat().
 21601  func fileStat(tls *libc.TLS, zPath uintptr, pStatBuf uintptr) int32 { /* fileio.c:261:12: */
 21602  	return libc.Xstat(tls, zPath, pStatBuf)
 21603  }
 21604  
 21605  // This function is used in place of lstat().  On Windows, special handling
 21606  // is required in order for the included time to be returned as UTC.  On all
 21607  // other systems, this function simply calls lstat().
 21608  func fileLinkStat(tls *libc.TLS, zPath uintptr, pStatBuf uintptr) int32 { /* fileio.c:279:12: */
 21609  	return libc.Xlstat(tls, zPath, pStatBuf)
 21610  }
 21611  
 21612  // Argument zFile is the name of a file that will be created and/or written
 21613  // by SQL function writefile(). This function ensures that the directory
 21614  // zFile will be written to exists, creating it if required. The permissions
 21615  // for any path components created by this function are set in accordance
 21616  // with the current umask.
 21617  //
 21618  // If an OOM condition is encountered, SQLITE_NOMEM is returned. Otherwise,
 21619  // SQLITE_OK is returned if the directory is successfully created, or
 21620  // SQLITE_ERROR otherwise.
 21621  func makeDirectory(tls *libc.TLS, zFile uintptr) int32 { /* fileio.c:303:12: */
 21622  	bp := tls.Alloc(112)
 21623  	defer tls.Free(112)
 21624  
 21625  	var zCopy uintptr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zFile))
 21626  	var rc int32 = SQLITE_OK
 21627  
 21628  	if zCopy == uintptr(0) {
 21629  		rc = SQLITE_NOMEM
 21630  	} else {
 21631  		var nCopy int32 = int32(libc.Xstrlen(tls, zCopy))
 21632  		var i int32 = 1
 21633  
 21634  		for rc == SQLITE_OK {
 21635  			// var sStat stat at bp+8, 104
 21636  
 21637  			var rc2 int32
 21638  
 21639  			for ; (int32(*(*int8)(unsafe.Pointer(zCopy + uintptr(i)))) != '/') && (i < nCopy); i++ {
 21640  			}
 21641  			if i == nCopy {
 21642  				break
 21643  			}
 21644  			*(*int8)(unsafe.Pointer(zCopy + uintptr(i))) = int8(0)
 21645  
 21646  			rc2 = fileStat(tls, zCopy, bp+8 /* &sStat */)
 21647  			if rc2 != 0 {
 21648  				if libc.Xmkdir(tls, zCopy, uint32(0777)) != 0 {
 21649  					rc = SQLITE_ERROR
 21650  				}
 21651  			} else {
 21652  				if !((((*stat)(unsafe.Pointer(bp + 8 /* &sStat */)).Fst_mode) & uint32(0170000)) == (uint32(0040000))) {
 21653  					rc = SQLITE_ERROR
 21654  				}
 21655  			}
 21656  			*(*int8)(unsafe.Pointer(zCopy + uintptr(i))) = int8('/')
 21657  			i++
 21658  		}
 21659  
 21660  		sqlite3.Xsqlite3_free(tls, zCopy)
 21661  	}
 21662  
 21663  	return rc
 21664  }
 21665  
 21666  // This function does the work for the writefile() UDF. Refer to
 21667  // header comments at the top of this file for details.
 21668  func writeFile(tls *libc.TLS, pCtx uintptr, zFile uintptr, pData uintptr, mode mode_t, mtime sqlite3_int64) int32 { /* fileio.c:343:12: */
 21669  	bp := tls.Alloc(120)
 21670  	defer tls.Free(120)
 21671  
 21672  	if ((mode) & mode_t(0170000)) == (mode_t(0120000)) {
 21673  		var zTo uintptr = sqlite3.Xsqlite3_value_text(tls, pData)
 21674  		if libc.Xsymlink(tls, zTo, zFile) < 0 {
 21675  			return 1
 21676  		}
 21677  	} else {
 21678  		if ((mode) & mode_t(0170000)) == (mode_t(0040000)) {
 21679  			if libc.Xmkdir(tls, zFile, mode) != 0 {
 21680  				// The mkdir() call to create the directory failed. This might not
 21681  				// be an error though - if there is already a directory at the same
 21682  				// path and either the permissions already match or can be changed
 21683  				// to do so using chmod(), it is not an error.
 21684  				// var sStat stat at bp, 104
 21685  
 21686  				if ((((*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) != EEXIST) ||
 21687  					(0 != fileStat(tls, zFile, bp /* &sStat */))) ||
 21688  					!((((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_mode) & uint32(0170000)) == (uint32(0040000)))) ||
 21689  					((((*stat)(unsafe.Pointer(bp /* &sStat */)).Fst_mode & uint32(0777)) != (mode & mode_t(0777))) && (0 != libc.Xchmod(tls, zFile, (mode&mode_t(0777))))) {
 21690  					return 1
 21691  				}
 21692  			}
 21693  		} else {
 21694  			var nWrite sqlite3_int64 = int64(0)
 21695  			var z uintptr
 21696  			var rc int32 = 0
 21697  			var out uintptr = libc.Xfopen(tls, zFile, ts+4843 /* "wb" */)
 21698  			if out == uintptr(0) {
 21699  				return 1
 21700  			}
 21701  			z = sqlite3.Xsqlite3_value_blob(tls, pData)
 21702  			if z != 0 {
 21703  				var n sqlite3_int64 = sqlite3_int64(libc.Xfwrite(tls, z, uint32(1), uint32(sqlite3.Xsqlite3_value_bytes(tls, pData)), out))
 21704  				nWrite = sqlite3_int64(sqlite3.Xsqlite3_value_bytes(tls, pData))
 21705  				if nWrite != n {
 21706  					rc = 1
 21707  				}
 21708  			}
 21709  			libc.Xfclose(tls, out)
 21710  			if ((rc == 0) && (mode != 0)) && (libc.Xchmod(tls, zFile, (mode&mode_t(0777))) != 0) {
 21711  				rc = 1
 21712  			}
 21713  			if rc != 0 {
 21714  				return 2
 21715  			}
 21716  			sqlite3.Xsqlite3_result_int64(tls, pCtx, nWrite)
 21717  		}
 21718  	}
 21719  
 21720  	if mtime >= int64(0) {
 21721  		// Legacy unix
 21722  		// var times [2]timeval at bp+104, 16
 21723  
 21724  		(*timeval)(unsafe.Pointer(bp + 104 /* &times */)).Ftv_usec = libc.AssignPtrInt32(bp+104 /* &times */ +1*8+4 /* &.tv_usec */, 0)
 21725  		(*timeval)(unsafe.Pointer(bp + 104 /* &times */)).Ftv_sec = libc.Xtime(tls, uintptr(0))
 21726  		(*timeval)(unsafe.Pointer(bp + 104 /* &times */ + 1*8)).Ftv_sec = int32(mtime)
 21727  		if libc.Xutimes(tls, zFile, bp+104 /* &times[0] */) != 0 {
 21728  			return 1
 21729  		}
 21730  	}
 21731  
 21732  	return 0
 21733  }
 21734  
 21735  // Implementation of the "writefile(W,X[,Y[,Z]]])" SQL function.
 21736  // Refer to header comments at the top of this file for details.
 21737  func writefileFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:457:13: */
 21738  	bp := tls.Alloc(24)
 21739  	defer tls.Free(24)
 21740  
 21741  	var zFile uintptr
 21742  	var mode mode_t = mode_t(0)
 21743  	var res int32
 21744  	var mtime sqlite3_int64 = int64(-1)
 21745  
 21746  	if (argc < 2) || (argc > 4) {
 21747  		sqlite3.Xsqlite3_result_error(tls, context,
 21748  			ts+4846 /* "wrong number of ..." */, -1)
 21749  		return
 21750  	}
 21751  
 21752  	zFile = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 21753  	if zFile == uintptr(0) {
 21754  		return
 21755  	}
 21756  	if argc >= 3 {
 21757  		mode = mode_t(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 21758  	}
 21759  	if argc == 4 {
 21760  		mtime = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 21761  	}
 21762  
 21763  	res = writeFile(tls, context, zFile, *(*uintptr)(unsafe.Pointer(argv + 1*4)), mode, mtime)
 21764  	if (res == 1) && ((*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT) {
 21765  		if makeDirectory(tls, zFile) == SQLITE_OK {
 21766  			res = writeFile(tls, context, zFile, *(*uintptr)(unsafe.Pointer(argv + 1*4)), mode, mtime)
 21767  		}
 21768  	}
 21769  
 21770  	if (argc > 2) && (res != 0) {
 21771  		if ((mode) & mode_t(0170000)) == (mode_t(0120000)) {
 21772  			ctxErrorMsg(tls, context, ts+4896 /* "failed to create..." */, libc.VaList(bp, zFile))
 21773  		} else if ((mode) & mode_t(0170000)) == (mode_t(0040000)) {
 21774  			ctxErrorMsg(tls, context, ts+4925 /* "failed to create..." */, libc.VaList(bp+8, zFile))
 21775  		} else {
 21776  			ctxErrorMsg(tls, context, ts+4956 /* "failed to write ..." */, libc.VaList(bp+16, zFile))
 21777  		}
 21778  	}
 21779  }
 21780  
 21781  // SQL function:   lsmode(MODE)
 21782  //
 21783  // Given a numberic st_mode from stat(), convert it into a human-readable
 21784  // text string in the style of "ls -l".
 21785  func lsModeFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* fileio.c:507:13: */
 21786  	bp := tls.Alloc(16)
 21787  	defer tls.Free(16)
 21788  
 21789  	var i int32
 21790  	var iMode int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 21791  	// var z [16]int8 at bp, 16
 21792  
 21793  	_ = argc
 21794  	if ((iMode) & 0170000) == (0120000) {
 21795  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('l')
 21796  	} else if ((iMode) & 0170000) == (0100000) {
 21797  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('-')
 21798  	} else if ((iMode) & 0170000) == (0040000) {
 21799  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('d')
 21800  	} else {
 21801  		*(*int8)(unsafe.Pointer(bp /* &z[0] */)) = int8('?')
 21802  	}
 21803  	for i = 0; i < 3; i++ {
 21804  		var m int32 = (iMode >> ((2 - i) * 3))
 21805  		var a uintptr = (bp /* &z */ + uintptr((1 + (i * 3))))
 21806  		*(*int8)(unsafe.Pointer(a)) = func() int8 {
 21807  			if (m & 0x4) != 0 {
 21808  				return int8('r')
 21809  			}
 21810  			return int8('-')
 21811  		}()
 21812  		*(*int8)(unsafe.Pointer(a + 1)) = func() int8 {
 21813  			if (m & 0x2) != 0 {
 21814  				return int8('w')
 21815  			}
 21816  			return int8('-')
 21817  		}()
 21818  		*(*int8)(unsafe.Pointer(a + 2)) = func() int8 {
 21819  			if (m & 0x1) != 0 {
 21820  				return int8('x')
 21821  			}
 21822  			return int8('-')
 21823  		}()
 21824  	}
 21825  	*(*int8)(unsafe.Pointer(bp /* &z[0] */ + 10)) = int8(0)
 21826  	sqlite3.Xsqlite3_result_text(tls, context, bp /* &z[0] */, -1, libc.UintptrFromInt32(-1))
 21827  }
 21828  
 21829  // Cursor type for recursively iterating through a directory structure.
 21830  type fsdir_cursor1 = struct {
 21831  	Fbase  sqlite3_vtab_cursor
 21832  	FnLvl  int32
 21833  	FiLvl  int32
 21834  	FaLvl  uintptr
 21835  	FzBase uintptr
 21836  	FnBase int32
 21837  	FsStat struct {
 21838  		Fst_dev     uint64
 21839  		F__pad1     uint16
 21840  		_           [2]byte
 21841  		F__st_ino   uint32
 21842  		Fst_mode    uint32
 21843  		Fst_nlink   uint32
 21844  		Fst_uid     uint32
 21845  		Fst_gid     uint32
 21846  		Fst_rdev    uint64
 21847  		F__pad2     uint16
 21848  		_           [6]byte
 21849  		Fst_size    int64
 21850  		Fst_blksize int32
 21851  		_           [4]byte
 21852  		Fst_blocks  int64
 21853  		Fst_atim    struct {
 21854  			Ftv_sec  int32
 21855  			Ftv_nsec int32
 21856  		}
 21857  		Fst_mtim struct {
 21858  			Ftv_sec  int32
 21859  			Ftv_nsec int32
 21860  		}
 21861  		Fst_ctim struct {
 21862  			Ftv_sec  int32
 21863  			Ftv_nsec int32
 21864  		}
 21865  		Fst_ino uint64
 21866  	}
 21867  	FzPath  uintptr
 21868  	_       [4]byte
 21869  	FiRowid sqlite3_int64
 21870  } /* fileio.c:541:9 */
 21871  
 21872  // Cursor type for recursively iterating through a directory structure.
 21873  type fsdir_cursor = fsdir_cursor1 /* fileio.c:541:29 */
 21874  type FsdirLevel1 = struct {
 21875  	FpDir uintptr
 21876  	FzDir uintptr
 21877  } /* fileio.c:541:9 */
 21878  
 21879  type FsdirLevel = FsdirLevel1 /* fileio.c:542:27 */
 21880  
 21881  type fsdir_tab1 = struct{ Fbase sqlite3_vtab } /* fileio.c:564:9 */
 21882  
 21883  type fsdir_tab = fsdir_tab1 /* fileio.c:564:26 */
 21884  
 21885  // Construct a new fsdir virtual table object.
 21886  func fsdirConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fileio.c:572:12: */
 21887  	var pNew uintptr = uintptr(0)
 21888  	var rc int32
 21889  	_ = pAux
 21890  	_ = argc
 21891  	_ = argv
 21892  	_ = pzErr
 21893  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+4981 /* "CREATE TABLE x(n..." */)
 21894  	if rc == SQLITE_OK {
 21895  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fsdir_tab{})))
 21896  		if pNew == uintptr(0) {
 21897  			return SQLITE_NOMEM
 21898  		}
 21899  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(fsdir_tab{})))
 21900  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 21901  	}
 21902  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 21903  	return rc
 21904  }
 21905  
 21906  // This method is the destructor for fsdir vtab objects.
 21907  func fsdirDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* fileio.c:599:12: */
 21908  	sqlite3.Xsqlite3_free(tls, pVtab)
 21909  	return SQLITE_OK
 21910  }
 21911  
 21912  // Constructor for a new fsdir_cursor object.
 21913  func fsdirOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* fileio.c:607:12: */
 21914  	var pCur uintptr
 21915  	_ = p
 21916  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fsdir_cursor{})))
 21917  	if pCur == uintptr(0) {
 21918  		return SQLITE_NOMEM
 21919  	}
 21920  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(fsdir_cursor{})))
 21921  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = -1
 21922  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 21923  	return SQLITE_OK
 21924  }
 21925  
 21926  // Reset a cursor back to the state it was in when first returned
 21927  // by fsdirOpen().
 21928  func fsdirResetCursor(tls *libc.TLS, pCur uintptr) { /* fileio.c:622:13: */
 21929  	var i int32
 21930  	for i = 0; i <= (*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl; i++ {
 21931  		var pLvl uintptr = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr(i)*8)
 21932  		if (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir != 0 {
 21933  			libc.Xclosedir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 21934  		}
 21935  		sqlite3.Xsqlite3_free(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 21936  	}
 21937  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 21938  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl)
 21939  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl = uintptr(0)
 21940  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 21941  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase = uintptr(0)
 21942  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase = 0
 21943  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl = 0
 21944  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = -1
 21945  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 21946  }
 21947  
 21948  // Destructor for an fsdir_cursor.
 21949  func fsdirClose(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:643:12: */
 21950  	var pCur uintptr = cur
 21951  
 21952  	fsdirResetCursor(tls, pCur)
 21953  	sqlite3.Xsqlite3_free(tls, pCur)
 21954  	return SQLITE_OK
 21955  }
 21956  
 21957  // Set the error message for the virtual table associated with cursor
 21958  // pCur to the results of vprintf(zFmt, ...).
 21959  func fsdirSetErrmsg(tls *libc.TLS, pCur uintptr, zFmt uintptr, va uintptr) { /* fileio.c:655:13: */
 21960  	var ap va_list
 21961  	_ = ap
 21962  	ap = va
 21963  	(*sqlite3_vtab)(unsafe.Pointer((*fsdir_cursor)(unsafe.Pointer(pCur)).Fbase.FpVtab)).FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 21964  	_ = ap
 21965  }
 21966  
 21967  // Advance an fsdir_cursor to its next row of output.
 21968  func fsdirNext(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:666:12: */
 21969  	bp := tls.Alloc(32)
 21970  	defer tls.Free(32)
 21971  
 21972  	var pCur uintptr = cur
 21973  	var m mode_t = (*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode
 21974  
 21975  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid++
 21976  	if ((m) & mode_t(0170000)) == (mode_t(0040000)) {
 21977  		// Descend into this directory
 21978  		var iNew int32 = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl + 1)
 21979  		var pLvl uintptr
 21980  		if iNew >= (*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl {
 21981  			var nNew int32 = (iNew + 1)
 21982  			var nByte sqlite3_int64 = (sqlite3_int64(uint32(nNew) * uint32(unsafe.Sizeof(FsdirLevel{}))))
 21983  			var aNew uintptr = sqlite3.Xsqlite3_realloc64(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl, uint64(nByte))
 21984  			if aNew == uintptr(0) {
 21985  				return SQLITE_NOMEM
 21986  			}
 21987  			libc.Xmemset(tls, (aNew + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl)*8), 0, (uint32(unsafe.Sizeof(FsdirLevel{})) * (uint32(nNew - (*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl))))
 21988  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl = aNew
 21989  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FnLvl = nNew
 21990  		}
 21991  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl = iNew
 21992  		pLvl = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr(iNew)*8)
 21993  
 21994  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir = (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath
 21995  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 21996  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir = libc.Xopendir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 21997  		if (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir == uintptr(0) {
 21998  			fsdirSetErrmsg(tls, pCur, ts+5041 /* "cannot read dire..." */, libc.VaList(bp, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 21999  			return SQLITE_ERROR
 22000  		}
 22001  	}
 22002  
 22003  	for (*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl >= 0 {
 22004  		var pLvl uintptr = ((*fsdir_cursor)(unsafe.Pointer(pCur)).FaLvl + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl)*8)
 22005  		var pEntry uintptr = libc.Xreaddir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 22006  		if pEntry != 0 {
 22007  			if int32(*(*int8)(unsafe.Pointer((pEntry + 19 /* &.d_name */)))) == '.' {
 22008  				if (int32(*(*int8)(unsafe.Pointer((pEntry + 19 /* &.d_name */) + 1))) == '.') && (int32(*(*int8)(unsafe.Pointer((pEntry + 19 /* &.d_name */) + 2))) == 0) {
 22009  					continue
 22010  				}
 22011  				if int32(*(*int8)(unsafe.Pointer((pEntry + 19 /* &.d_name */) + 1))) == 0 {
 22012  					continue
 22013  				}
 22014  			}
 22015  			sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 22016  			(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts+5067 /* "%s/%s" */, libc.VaList(bp+8, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir, pEntry+19 /* &.d_name */))
 22017  			if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0) {
 22018  				return SQLITE_NOMEM
 22019  			}
 22020  			if fileLinkStat(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, (pCur+24 /* &.sStat */)) != 0 {
 22021  				fsdirSetErrmsg(tls, pCur, ts+5073 /* "cannot stat file..." */, libc.VaList(bp+24, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 22022  				return SQLITE_ERROR
 22023  			}
 22024  			return SQLITE_OK
 22025  		}
 22026  		libc.Xclosedir(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir)
 22027  		sqlite3.Xsqlite3_free(tls, (*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir)
 22028  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FpDir = uintptr(0)
 22029  		(*FsdirLevel)(unsafe.Pointer(pLvl)).FzDir = uintptr(0)
 22030  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FiLvl--
 22031  	}
 22032  
 22033  	// EOF
 22034  	sqlite3.Xsqlite3_free(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 22035  	(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = uintptr(0)
 22036  	return SQLITE_OK
 22037  }
 22038  
 22039  // Return values of columns for the row at which the series_cursor
 22040  // is currently pointing.
 22041  func fsdirColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* fileio.c:730:12: */
 22042  	bp := tls.Alloc(64)
 22043  	defer tls.Free(64)
 22044  
 22045  	var pCur uintptr = cur
 22046  	switch i {
 22047  	case FSDIR_COLUMN_NAME:
 22048  		{
 22049  			sqlite3.Xsqlite3_result_text(tls, ctx, ((*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath + uintptr((*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase)), -1, libc.UintptrFromInt32(-1))
 22050  			break
 22051  
 22052  		}
 22053  
 22054  	case FSDIR_COLUMN_MODE:
 22055  		sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode))
 22056  		break
 22057  
 22058  	case FSDIR_COLUMN_MTIME:
 22059  		sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mtim.Ftv_sec))
 22060  		break
 22061  
 22062  	case FSDIR_COLUMN_DATA:
 22063  		{
 22064  			var m mode_t = (*fsdir_cursor)(unsafe.Pointer(pCur)).FsStat.Fst_mode
 22065  			if ((m) & mode_t(0170000)) == (mode_t(0040000)) {
 22066  				sqlite3.Xsqlite3_result_null(tls, ctx)
 22067  			} else if ((m) & mode_t(0170000)) == (mode_t(0120000)) {
 22068  				// var aStatic [64]int8 at bp, 64
 22069  
 22070  				var aBuf uintptr = bp /* aStatic */
 22071  				var nBuf sqlite3_int64 = int64(64)
 22072  				var n int32
 22073  
 22074  				for 1 != 0 {
 22075  					n = libc.Xreadlink(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, aBuf, uint32(nBuf))
 22076  					if sqlite3_int64(n) < nBuf {
 22077  						break
 22078  					}
 22079  					if aBuf != bp /* aStatic */ {
 22080  						sqlite3.Xsqlite3_free(tls, aBuf)
 22081  					}
 22082  					nBuf = (nBuf * int64(2))
 22083  					aBuf = sqlite3.Xsqlite3_malloc64(tls, uint64(nBuf))
 22084  					if aBuf == uintptr(0) {
 22085  						sqlite3.Xsqlite3_result_error_nomem(tls, ctx)
 22086  						return SQLITE_NOMEM
 22087  					}
 22088  				}
 22089  
 22090  				sqlite3.Xsqlite3_result_text(tls, ctx, aBuf, n, libc.UintptrFromInt32(-1))
 22091  				if aBuf != bp /* aStatic */ {
 22092  					sqlite3.Xsqlite3_free(tls, aBuf)
 22093  				}
 22094  			} else {
 22095  				readFileContents(tls, ctx, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath)
 22096  			}
 22097  
 22098  		}
 22099  		fallthrough
 22100  	case FSDIR_COLUMN_PATH:
 22101  		fallthrough
 22102  	default:
 22103  		{
 22104  			// The FSDIR_COLUMN_PATH and FSDIR_COLUMN_DIR are input parameters.
 22105  			// always return their values as NULL
 22106  			break
 22107  
 22108  		}
 22109  	}
 22110  	return SQLITE_OK
 22111  }
 22112  
 22113  // Return the rowid for the current row. In this implementation, the
 22114  // first row returned is assigned rowid value 1, and each subsequent
 22115  // row a value 1 more than that of the previous.
 22116  func fsdirRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* fileio.c:795:12: */
 22117  	var pCur uintptr = cur
 22118  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*fsdir_cursor)(unsafe.Pointer(pCur)).FiRowid
 22119  	return SQLITE_OK
 22120  }
 22121  
 22122  // Return TRUE if the cursor has been moved off of the last
 22123  // row of output.
 22124  func fsdirEof(tls *libc.TLS, cur uintptr) int32 { /* fileio.c:805:12: */
 22125  	var pCur uintptr = cur
 22126  	return (libc.Bool32((*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0)))
 22127  }
 22128  
 22129  // xFilter callback.
 22130  //
 22131  // idxNum==1   PATH parameter only
 22132  // idxNum==2   Both PATH and DIR supplied
 22133  func fsdirFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* fileio.c:816:12: */
 22134  	bp := tls.Alloc(32)
 22135  	defer tls.Free(32)
 22136  
 22137  	var zDir uintptr = uintptr(0)
 22138  	var pCur uintptr = cur
 22139  	_ = idxStr
 22140  	fsdirResetCursor(tls, pCur)
 22141  
 22142  	if idxNum == 0 {
 22143  		fsdirSetErrmsg(tls, pCur, ts+5094 /* "table function f..." */, 0)
 22144  		return SQLITE_ERROR
 22145  	}
 22146  
 22147  	zDir = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 22148  	if zDir == uintptr(0) {
 22149  		fsdirSetErrmsg(tls, pCur, ts+5136 /* "table function f..." */, 0)
 22150  		return SQLITE_ERROR
 22151  	}
 22152  	if argc == 2 {
 22153  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 22154  	}
 22155  	if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase != 0 {
 22156  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FnBase = (int32(libc.Xstrlen(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase)) + 1)
 22157  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts+5067 /* "%s/%s" */, libc.VaList(bp, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzBase, zDir))
 22158  	} else {
 22159  		(*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zDir))
 22160  	}
 22161  
 22162  	if (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath == uintptr(0) {
 22163  		return SQLITE_NOMEM
 22164  	}
 22165  	if fileLinkStat(tls, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath, (pCur+24 /* &.sStat */)) != 0 {
 22166  		fsdirSetErrmsg(tls, pCur, ts+5073 /* "cannot stat file..." */, libc.VaList(bp+24, (*fsdir_cursor)(unsafe.Pointer(pCur)).FzPath))
 22167  		return SQLITE_ERROR
 22168  	}
 22169  
 22170  	return SQLITE_OK
 22171  }
 22172  
 22173  // SQLite will invoke this method one or more times while planning a query
 22174  // that uses the generate_series virtual table.  This routine needs to create
 22175  // a query plan for each invocation and compute an estimated cost for that
 22176  // plan.
 22177  //
 22178  // In this implementation idxNum is used to represent the
 22179  // query plan.  idxStr is unused.
 22180  //
 22181  // The query plan is represented by values of idxNum:
 22182  //
 22183  //  (1)  The path value is supplied by argv[0]
 22184  //  (2)  Path is in argv[0] and dir is in argv[1]
 22185  func fsdirBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* fileio.c:872:12: */
 22186  	var i int32            // Loop over constraints
 22187  	var idxPath int32 = -1 // Index in pIdxInfo->aConstraint of PATH=
 22188  	var idxDir int32 = -1  // Index in pIdxInfo->aConstraint of DIR=
 22189  	var seenPath int32 = 0 // True if an unusable PATH= constraint is seen
 22190  	var seenDir int32 = 0  // True if an unusable DIR= constraint is seen
 22191  	var pConstraint uintptr
 22192  
 22193  	_ = tab
 22194  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 22195  	i = 0
 22196  __1:
 22197  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 22198  		goto __3
 22199  	}
 22200  	{
 22201  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 22202  			goto __2
 22203  		}
 22204  		switch (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn {
 22205  		case FSDIR_COLUMN_PATH:
 22206  			{
 22207  				if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable != 0 {
 22208  					idxPath = i
 22209  					seenPath = 0
 22210  				} else if idxPath < 0 {
 22211  					seenPath = 1
 22212  				}
 22213  				break
 22214  
 22215  			}
 22216  		case FSDIR_COLUMN_DIR:
 22217  			{
 22218  				if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable != 0 {
 22219  					idxDir = i
 22220  					seenDir = 0
 22221  				} else if idxDir < 0 {
 22222  					seenDir = 1
 22223  				}
 22224  				break
 22225  
 22226  			}
 22227  		}
 22228  
 22229  	}
 22230  	goto __2
 22231  __2:
 22232  	i++
 22233  	pConstraint += 12
 22234  	goto __1
 22235  	goto __3
 22236  __3:
 22237  	;
 22238  	if (seenPath != 0) || (seenDir != 0) {
 22239  		// If input parameters are unusable, disallow this plan
 22240  		return SQLITE_CONSTRAINT
 22241  	}
 22242  
 22243  	if idxPath < 0 {
 22244  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 22245  		// The pIdxInfo->estimatedCost should have been initialized to a huge
 22246  		// number.  Leave it unchanged.
 22247  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(0x7fffffff)
 22248  	} else {
 22249  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxPath)*8)).Fomit = uint8(1)
 22250  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxPath)*8)).FargvIndex = 1
 22251  		if idxDir >= 0 {
 22252  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxDir)*8)).Fomit = uint8(1)
 22253  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idxDir)*8)).FargvIndex = 2
 22254  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 2
 22255  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 22256  		} else {
 22257  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 22258  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 100.0
 22259  		}
 22260  	}
 22261  
 22262  	return SQLITE_OK
 22263  }
 22264  
 22265  // Register the "fsdir" virtual table.
 22266  func fsdirRegister(tls *libc.TLS, db uintptr) int32 { /* fileio.c:938:12: */
 22267  
 22268  	var rc int32 = sqlite3.Xsqlite3_create_module(tls, db, ts+5186 /* "fsdir" */, uintptr(unsafe.Pointer(&fsdirModule1)), uintptr(0))
 22269  	return rc
 22270  }
 22271  
 22272  var fsdirModule1 = sqlite3_module{ // xCreate
 22273  	FxConnect:    0, // xConnect
 22274  	FxBestIndex:  0, // xBestIndex
 22275  	FxDisconnect: 0, // xDestroy
 22276  	FxOpen:       0, // xOpen - open a cursor
 22277  	FxClose:      0, // xClose - close a cursor
 22278  	FxFilter:     0, // xFilter - configure scan constraints
 22279  	FxNext:       0, // xNext - advance a cursor
 22280  	FxEof:        0, // xEof - check for end of scan
 22281  	FxColumn:     0, // xColumn - read data
 22282  	FxRowid:      0, // xShadowName
 22283  } /* fileio.c:939:25 */
 22284  
 22285  func sqlite3_fileio_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* fileio.c:976:5: */
 22286  	var rc int32 = SQLITE_OK
 22287  	_ = pApi
 22288  
 22289  	_ = pzErrMsg // Unused parameter
 22290  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5192 /* "readfile" */, 1,
 22291  		(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 22292  		*(*uintptr)(unsafe.Pointer(&struct {
 22293  			f func(*libc.TLS, uintptr, int32, uintptr)
 22294  		}{readfileFunc})), uintptr(0), uintptr(0))
 22295  	if rc == SQLITE_OK {
 22296  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5201 /* "writefile" */, -1,
 22297  			(SQLITE_UTF8 | SQLITE_DIRECTONLY), uintptr(0),
 22298  			*(*uintptr)(unsafe.Pointer(&struct {
 22299  				f func(*libc.TLS, uintptr, int32, uintptr)
 22300  			}{writefileFunc})), uintptr(0), uintptr(0))
 22301  	}
 22302  	if rc == SQLITE_OK {
 22303  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5211 /* "lsmode" */, 1, SQLITE_UTF8, uintptr(0),
 22304  			*(*uintptr)(unsafe.Pointer(&struct {
 22305  				f func(*libc.TLS, uintptr, int32, uintptr)
 22306  			}{lsModeFunc})), uintptr(0), uintptr(0))
 22307  	}
 22308  	if rc == SQLITE_OK {
 22309  		rc = fsdirRegister(tls, db)
 22310  	}
 22311  	return rc
 22312  }
 22313  
 22314  // If we are compiling with optimizing read this file.  It contains
 22315  //    several optimizing inline functions and macros.
 22316  
 22317  // Forward declaration of objects used by this implementation
 22318  type fuzzer_vtab1 = struct {
 22319  	Fbase       sqlite3_vtab
 22320  	FzClassName uintptr
 22321  	FpRule      uintptr
 22322  	FnCursor    int32
 22323  } /* fuzzer.c:162:9 */
 22324  
 22325  // If we are compiling with optimizing read this file.  It contains
 22326  //    several optimizing inline functions and macros.
 22327  
 22328  // Forward declaration of objects used by this implementation
 22329  type fuzzer_vtab = fuzzer_vtab1 /* fuzzer.c:162:28 */
 22330  type fuzzer_cursor1 = struct {
 22331  	Fbase     sqlite3_vtab_cursor
 22332  	_         [4]byte
 22333  	FiRowid   sqlite3_int64
 22334  	FpVtab    uintptr
 22335  	FrLimit   fuzzer_cost
 22336  	FpStem    uintptr
 22337  	FpDone    uintptr
 22338  	FaQueue   [20]uintptr
 22339  	FmxQueue  int32
 22340  	FzBuf     uintptr
 22341  	FnBuf     int32
 22342  	FnStem    int32
 22343  	FiRuleset int32
 22344  	FnullRule fuzzer_rule
 22345  	FapHash   [4001]uintptr
 22346  } /* fuzzer.c:163:9 */
 22347  
 22348  type fuzzer_cursor = fuzzer_cursor1 /* fuzzer.c:163:30 */
 22349  type fuzzer_rule1 = struct {
 22350  	FpNext    uintptr
 22351  	FzFrom    uintptr
 22352  	FrCost    fuzzer_cost
 22353  	FnFrom    fuzzer_len
 22354  	FnTo      fuzzer_len
 22355  	_         [2]byte
 22356  	FiRuleset fuzzer_ruleid
 22357  	FzTo      [4]int8
 22358  } /* fuzzer.c:162:9 */
 22359  
 22360  type fuzzer_rule = fuzzer_rule1 /* fuzzer.c:164:28 */
 22361  type fuzzer_stem1 = struct {
 22362  	FzBasis    uintptr
 22363  	FpRule     uintptr
 22364  	FpNext     uintptr
 22365  	FpHash     uintptr
 22366  	FrBaseCost fuzzer_cost
 22367  	FrCostX    fuzzer_cost
 22368  	FnBasis    fuzzer_len
 22369  	Fn         fuzzer_len
 22370  	_          [2]byte
 22371  } /* fuzzer.c:163:9 */
 22372  
 22373  type fuzzer_stem = fuzzer_stem1 /* fuzzer.c:166:28 */
 22374  
 22375  // Various types.
 22376  //
 22377  // fuzzer_cost is the "cost" of an edit operation.
 22378  //
 22379  // fuzzer_len is the length of a matching string.
 22380  //
 22381  // fuzzer_ruleid is an ruleset identifier.
 22382  type fuzzer_cost = int32   /* fuzzer.c:177:13 */
 22383  type fuzzer_len = int8     /* fuzzer.c:178:21 */
 22384  type fuzzer_ruleid = int32 /* fuzzer.c:179:13 */
 22385  
 22386  // The two input rule lists are both sorted in order of increasing
 22387  // cost.  Merge them together into a single list, sorted by cost, and
 22388  // return a pointer to the head of that list.
 22389  func fuzzerMergeRules(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* fuzzer.c:261:20: */
 22390  	bp := tls.Alloc(24)
 22391  	defer tls.Free(24)
 22392  
 22393  	// var head fuzzer_rule at bp, 24
 22394  
 22395  	var pTail uintptr
 22396  
 22397  	pTail = bp /* &head */
 22398  	for (pA != 0) && (pB != 0) {
 22399  		if (*fuzzer_rule)(unsafe.Pointer(pA)).FrCost <= (*fuzzer_rule)(unsafe.Pointer(pB)).FrCost {
 22400  			(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pA
 22401  			pTail = pA
 22402  			pA = (*fuzzer_rule)(unsafe.Pointer(pA)).FpNext
 22403  		} else {
 22404  			(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pB
 22405  			pTail = pB
 22406  			pB = (*fuzzer_rule)(unsafe.Pointer(pB)).FpNext
 22407  		}
 22408  	}
 22409  	if pA == uintptr(0) {
 22410  		(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pB
 22411  	} else {
 22412  		(*fuzzer_rule)(unsafe.Pointer(pTail)).FpNext = pA
 22413  	}
 22414  	return (*fuzzer_rule)(unsafe.Pointer(bp /* &head */)).FpNext
 22415  }
 22416  
 22417  // Statement pStmt currently points to a row in the fuzzer data table. This
 22418  // function allocates and populates a fuzzer_rule structure according to
 22419  // the content of the row.
 22420  //
 22421  // If successful, *ppRule is set to point to the new object and SQLITE_OK
 22422  // is returned. Otherwise, *ppRule is zeroed, *pzErr may be set to point
 22423  // to an error message and an SQLite error code returned.
 22424  func fuzzerLoadOneRule(tls *libc.TLS, p uintptr, pStmt uintptr, ppRule uintptr, pzErr uintptr) int32 { /* fuzzer.c:294:12: */
 22425  	bp := tls.Alloc(48)
 22426  	defer tls.Free(48)
 22427  
 22428  	var iRuleset sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 22429  	var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 22430  	var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 2)
 22431  	var nCost int32 = sqlite3.Xsqlite3_column_int(tls, pStmt, 3)
 22432  
 22433  	var rc int32 = SQLITE_OK       // Return code
 22434  	var nFrom int32                // Size of string zFrom, in bytes
 22435  	var nTo int32                  // Size of string zTo, in bytes
 22436  	var pRule uintptr = uintptr(0) // New rule object to return
 22437  
 22438  	if zFrom == uintptr(0) {
 22439  		zFrom = ts + 489 /* "" */
 22440  	}
 22441  	if zTo == uintptr(0) {
 22442  		zTo = ts + 489 /* "" */
 22443  	}
 22444  	nFrom = int32(libc.Xstrlen(tls, zFrom))
 22445  	nTo = int32(libc.Xstrlen(tls, zTo))
 22446  
 22447  	// Silently ignore null transformations
 22448  	if libc.Xstrcmp(tls, zFrom, zTo) == 0 {
 22449  		*(*uintptr)(unsafe.Pointer(ppRule)) = uintptr(0)
 22450  		return SQLITE_OK
 22451  	}
 22452  
 22453  	if (nCost <= 0) || (nCost > FUZZER_MX_COST) {
 22454  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3165, /* "%s: cost must be..." */
 22455  			libc.VaList(bp, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_COST))
 22456  		rc = SQLITE_ERROR
 22457  	} else if (nFrom > FUZZER_MX_LENGTH) || (nTo > FUZZER_MX_LENGTH) {
 22458  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3199, /* "%s: maximum stri..." */
 22459  			libc.VaList(bp+16, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_LENGTH))
 22460  		rc = SQLITE_ERROR
 22461  	} else if (iRuleset < int64(0)) || (iRuleset > int64(FUZZER_MX_RULEID)) {
 22462  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+5218, /* "%s: ruleset must..." */
 22463  			libc.VaList(bp+32, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, FUZZER_MX_RULEID))
 22464  		rc = SQLITE_ERROR
 22465  	} else {
 22466  
 22467  		pRule = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(fuzzer_rule{})) + uint32(nFrom)) + uint32(nTo))))
 22468  		if pRule == uintptr(0) {
 22469  			rc = SQLITE_NOMEM
 22470  		} else {
 22471  			libc.Xmemset(tls, pRule, 0, uint32(unsafe.Sizeof(fuzzer_rule{})))
 22472  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom = pRule + 20 /* &.zTo */
 22473  			*(*uintptr)(unsafe.Pointer(pRule + 4 /* &.zFrom */)) += (uintptr(nTo + 1))
 22474  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom = fuzzer_len(nFrom)
 22475  			libc.Xmemcpy(tls, (*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom, zFrom, (uint32(nFrom + 1)))
 22476  			libc.Xmemcpy(tls, pRule+20 /* &.zTo */, zTo, (uint32(nTo + 1)))
 22477  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo = fuzzer_len(nTo)
 22478  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FrCost = nCost
 22479  			(*fuzzer_rule)(unsafe.Pointer(pRule)).FiRuleset = int32(iRuleset)
 22480  		}
 22481  	}
 22482  
 22483  	*(*uintptr)(unsafe.Pointer(ppRule)) = pRule
 22484  	return rc
 22485  }
 22486  
 22487  // Load the content of the fuzzer data table into memory.
 22488  func fuzzerLoadRules(tls *libc.TLS, db uintptr, p uintptr, zDb uintptr, zData uintptr, pzErr uintptr) int32 { /* fuzzer.c:363:12: */
 22489  	bp := tls.Alloc(124)
 22490  	defer tls.Free(124)
 22491  
 22492  	var rc int32 = SQLITE_OK // Return code
 22493  	var zSql uintptr         // SELECT used to read from rules table
 22494  	var pHead uintptr = uintptr(0)
 22495  
 22496  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+3268 /* "SELECT * FROM %Q..." */, libc.VaList(bp, zDb, zData))
 22497  	if zSql == uintptr(0) {
 22498  		rc = SQLITE_NOMEM
 22499  	} else {
 22500  		var rc2 int32 // finalize() return code
 22501  		*(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)) = uintptr(0)
 22502  		rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+56 /* &pStmt */, uintptr(0))
 22503  		if rc != SQLITE_OK {
 22504  			*(*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)))
 22505  		} else if sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */))) != 4 {
 22506  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+3295, /* "%s: %s has %d co..." */
 22507  				libc.VaList(bp+32, (*fuzzer_vtab)(unsafe.Pointer(p)).FzClassName, zData, sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))))
 22508  			rc = SQLITE_ERROR
 22509  		} else {
 22510  			for (rc == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))) {
 22511  				*(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)) = uintptr(0)
 22512  				rc = fuzzerLoadOneRule(tls, p, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)), bp+60 /* &pRule */, pzErr)
 22513  				if *(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)) != 0 {
 22514  					(*fuzzer_rule)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */)))).FpNext = pHead
 22515  					pHead = *(*uintptr)(unsafe.Pointer(bp + 60 /* pRule */))
 22516  				}
 22517  			}
 22518  		}
 22519  		rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* pStmt */)))
 22520  		if rc == SQLITE_OK {
 22521  			rc = rc2
 22522  		}
 22523  	}
 22524  	sqlite3.Xsqlite3_free(tls, zSql)
 22525  
 22526  	// All rules are now in a singly linked list starting at pHead. This
 22527  	// block sorts them by cost and then sets fuzzer_vtab.pRule to point to
 22528  	// point to the head of the sorted list.
 22529  	if rc == SQLITE_OK {
 22530  		var i uint32
 22531  		var pX uintptr
 22532  		// var a [15]uintptr at bp+64, 60
 22533  
 22534  		for i = uint32(0); i < (uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 22535  			*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = uintptr(0)
 22536  		}
 22537  		for (libc.AssignUintptr(&pX, pHead)) != uintptr(0) {
 22538  			pHead = (*fuzzer_rule)(unsafe.Pointer(pX)).FpNext
 22539  			(*fuzzer_rule)(unsafe.Pointer(pX)).FpNext = uintptr(0)
 22540  			for i = uint32(0); (*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) != 0) && (i < ((uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))) - uint32(1))); i++ {
 22541  				pX = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 22542  				*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = uintptr(0)
 22543  			}
 22544  			*(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)) = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 22545  		}
 22546  		pX = *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */))
 22547  		i = uint32(1)
 22548  		for ; i < (uint32(unsafe.Sizeof([15]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 22549  			pX = fuzzerMergeRules(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* &a[0] */ + uintptr(i)*4)), pX)
 22550  		}
 22551  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = fuzzerMergeRules(tls, (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule, pX)
 22552  	} else {
 22553  		// An error has occurred. Setting p->pRule to point to the head of the
 22554  		// allocated list ensures that the list will be cleaned up in this case.
 22555  
 22556  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = pHead
 22557  	}
 22558  
 22559  	return rc
 22560  }
 22561  
 22562  // This function converts an SQL quoted string into an unquoted string
 22563  // and returns a pointer to a buffer allocated using sqlite3_malloc()
 22564  // containing the result. The caller should eventually free this buffer
 22565  // using sqlite3_free.
 22566  //
 22567  // Examples:
 22568  //
 22569  //     "abc"   becomes   abc
 22570  //     'xyz'   becomes   xyz
 22571  //     [pqr]   becomes   pqr
 22572  //     `mno`   becomes   mno
 22573  func fuzzerDequote(tls *libc.TLS, zIn uintptr) uintptr { /* fuzzer.c:449:13: */
 22574  	var nIn sqlite3_int64 // Size of input string, in bytes
 22575  	var zOut uintptr      // Output (dequoted) string
 22576  
 22577  	nIn = sqlite3_int64(libc.Xstrlen(tls, zIn))
 22578  	zOut = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + int64(1))))
 22579  	if zOut != 0 {
 22580  		var q int8 = *(*int8)(unsafe.Pointer(zIn)) // Quote character (if any )
 22581  
 22582  		if (((int32(q) != '[') && (int32(q) != '\'')) && (int32(q) != '"')) && (int32(q) != '`') {
 22583  			libc.Xmemcpy(tls, zOut, zIn, (size_t(nIn + int64(1))))
 22584  		} else {
 22585  			var iOut int32 = 0 // Index of next byte to write to output
 22586  			var iIn int32      // Index of next byte to read from input
 22587  
 22588  			if int32(q) == '[' {
 22589  				q = int8(']')
 22590  			}
 22591  			for iIn = 1; sqlite3_int64(iIn) < nIn; iIn++ {
 22592  				if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))) == int32(q) {
 22593  					iIn++
 22594  				}
 22595  				*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(zIn + uintptr(iIn)))
 22596  			}
 22597  		}
 22598  
 22599  	}
 22600  	return zOut
 22601  }
 22602  
 22603  // xDisconnect/xDestroy method for the fuzzer module.
 22604  func fuzzerDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* fuzzer.c:478:12: */
 22605  	var p uintptr = pVtab
 22606  
 22607  	for (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule != 0 {
 22608  		var pRule uintptr = (*fuzzer_vtab)(unsafe.Pointer(p)).FpRule
 22609  		(*fuzzer_vtab)(unsafe.Pointer(p)).FpRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 22610  		sqlite3.Xsqlite3_free(tls, pRule)
 22611  	}
 22612  	sqlite3.Xsqlite3_free(tls, p)
 22613  	return SQLITE_OK
 22614  }
 22615  
 22616  // xConnect/xCreate method for the fuzzer module. Arguments are:
 22617  //
 22618  //   argv[0]   -> module name  ("fuzzer")
 22619  //   argv[1]   -> database name
 22620  //   argv[2]   -> table name
 22621  //   argv[3]   -> fuzzer rule table name
 22622  func fuzzerConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* fuzzer.c:498:12: */
 22623  	bp := tls.Alloc(8)
 22624  	defer tls.Free(8)
 22625  
 22626  	var rc int32 = SQLITE_OK      // Return code
 22627  	var pNew uintptr = uintptr(0) // New virtual table
 22628  	var zModule uintptr = *(*uintptr)(unsafe.Pointer(argv))
 22629  	var zDb uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 22630  
 22631  	if argc != 4 {
 22632  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 22633  			ts+5255 /* "%s: wrong number..." */, libc.VaList(bp, zModule))
 22634  		rc = SQLITE_ERROR
 22635  	} else {
 22636  		var nModule sqlite3_int64 // Length of zModule, in bytes
 22637  
 22638  		nModule = sqlite3_int64(libc.Xstrlen(tls, zModule))
 22639  		pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64((sqlite3_int64(unsafe.Sizeof(fuzzer_vtab{})) + nModule) + int64(1))))
 22640  		if pNew == uintptr(0) {
 22641  			rc = SQLITE_NOMEM
 22642  		} else {
 22643  			var zTab uintptr // Dequoted name of fuzzer data table
 22644  
 22645  			libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(fuzzer_vtab{})))
 22646  			(*fuzzer_vtab)(unsafe.Pointer(pNew)).FzClassName = (pNew + 1*24)
 22647  			libc.Xmemcpy(tls, (*fuzzer_vtab)(unsafe.Pointer(pNew)).FzClassName, zModule, (size_t(nModule + int64(1))))
 22648  
 22649  			zTab = fuzzerDequote(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 22650  			if zTab == uintptr(0) {
 22651  				rc = SQLITE_NOMEM
 22652  			} else {
 22653  				rc = fuzzerLoadRules(tls, db, pNew, zDb, zTab, pzErr)
 22654  				sqlite3.Xsqlite3_free(tls, zTab)
 22655  			}
 22656  
 22657  			if rc == SQLITE_OK {
 22658  				rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+5306 /* "CREATE TABLE x(w..." */)
 22659  			}
 22660  			if rc != SQLITE_OK {
 22661  				fuzzerDisconnect(tls, pNew)
 22662  				pNew = uintptr(0)
 22663  			} else {
 22664  				sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 22665  			}
 22666  		}
 22667  	}
 22668  
 22669  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 22670  	return rc
 22671  }
 22672  
 22673  // Open a new fuzzer cursor.
 22674  func fuzzerOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* fuzzer.c:556:12: */
 22675  	var p uintptr = pVTab
 22676  	var pCur uintptr
 22677  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(fuzzer_cursor{})))
 22678  	if pCur == uintptr(0) {
 22679  		return SQLITE_NOMEM
 22680  	}
 22681  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(fuzzer_cursor{})))
 22682  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab = p
 22683  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 22684  	(*fuzzer_vtab)(unsafe.Pointer(p)).FnCursor++
 22685  	return SQLITE_OK
 22686  }
 22687  
 22688  // Free all stems in a list.
 22689  func fuzzerClearStemList(tls *libc.TLS, pStem uintptr) { /* fuzzer.c:571:13: */
 22690  	for pStem != 0 {
 22691  		var pNext uintptr = (*fuzzer_stem)(unsafe.Pointer(pStem)).FpNext
 22692  		sqlite3.Xsqlite3_free(tls, pStem)
 22693  		pStem = pNext
 22694  	}
 22695  }
 22696  
 22697  // Free up all the memory allocated by a cursor.  Set it rLimit to 0
 22698  // to indicate that it is at EOF.
 22699  func fuzzerClearCursor(tls *libc.TLS, pCur uintptr, clearHash int32) { /* fuzzer.c:583:13: */
 22700  	var i int32
 22701  	fuzzerClearStemList(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)
 22702  	fuzzerClearStemList(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone)
 22703  	for i = 0; i < FUZZER_NQUEUE; i++ {
 22704  		fuzzerClearStemList(tls, *(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)))
 22705  	}
 22706  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 22707  	if (clearHash != 0) && ((*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem != 0) {
 22708  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue = 0
 22709  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 22710  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = uintptr(0)
 22711  		libc.Xmemset(tls, pCur+32 /* &.aQueue */, 0, uint32(unsafe.Sizeof([20]uintptr{})))
 22712  		libc.Xmemset(tls, pCur+156 /* &.apHash */, 0, uint32(unsafe.Sizeof([4001]uintptr{})))
 22713  	}
 22714  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem = 0
 22715  }
 22716  
 22717  // Close a fuzzer cursor.
 22718  func fuzzerClose(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:602:12: */
 22719  	var pCur uintptr = cur
 22720  	fuzzerClearCursor(tls, pCur, 0)
 22721  	sqlite3.Xsqlite3_free(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf)
 22722  	(*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FnCursor--
 22723  	sqlite3.Xsqlite3_free(tls, pCur)
 22724  	return SQLITE_OK
 22725  }
 22726  
 22727  // Compute the current output term for a fuzzer_stem.
 22728  func fuzzerRender(tls *libc.TLS, pStem uintptr, pzBuf uintptr, pnBuf uintptr) int32 { /* fuzzer.c:614:12: */
 22729  	var pRule uintptr = (*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule
 22730  	var n int32   // Size of output term without nul-term
 22731  	var z uintptr // Buffer to assemble output term in
 22732  
 22733  	n = ((int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) + int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo)) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom))
 22734  	if (*(*int32)(unsafe.Pointer(pnBuf))) < (n + 1) {
 22735  		(*(*uintptr)(unsafe.Pointer(pzBuf))) = sqlite3.Xsqlite3_realloc(tls, *(*uintptr)(unsafe.Pointer(pzBuf)), (n + 100))
 22736  		if (*(*uintptr)(unsafe.Pointer(pzBuf))) == uintptr(0) {
 22737  			return SQLITE_NOMEM
 22738  		}
 22739  		(*(*int32)(unsafe.Pointer(pnBuf))) = (n + 100)
 22740  	}
 22741  	n = int32((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn)
 22742  	z = *(*uintptr)(unsafe.Pointer(pzBuf))
 22743  	if n < 0 {
 22744  		libc.Xmemcpy(tls, z, (*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis, (uint32(int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) + 1)))
 22745  	} else {
 22746  		libc.Xmemcpy(tls, z, (*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis, uint32(n))
 22747  		libc.Xmemcpy(tls, (z + uintptr(n)), pRule+20 /* &.zTo */, uint32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnTo))
 22748  		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)))),
 22749  			(uint32(((int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) - n) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) + 1)))
 22750  	}
 22751  
 22752  	return SQLITE_OK
 22753  }
 22754  
 22755  // Compute a hash on zBasis.
 22756  func fuzzerHash(tls *libc.TLS, z uintptr) uint32 { /* fuzzer.c:647:21: */
 22757  	var h uint32 = uint32(0)
 22758  	for *(*int8)(unsafe.Pointer(z)) != 0 {
 22759  		h = (((h << 3) ^ (h >> 29)) ^ uint32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))
 22760  	}
 22761  	return (h % uint32(FUZZER_HASH))
 22762  }
 22763  
 22764  // Current cost of a stem
 22765  func fuzzerCost(tls *libc.TLS, pStem uintptr) fuzzer_cost { /* fuzzer.c:656:20: */
 22766  	return libc.AssignPtrInt32(pStem+20 /* &.rCostX */, ((*fuzzer_stem)(unsafe.Pointer(pStem)).FrBaseCost + (*fuzzer_rule)(unsafe.Pointer((*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule)).FrCost))
 22767  }
 22768  
 22769  // Return 1 if the string to which the cursor is point has already
 22770  // been emitted.  Return 0 if not.  Return -1 on a memory allocation
 22771  // failures.
 22772  func fuzzerSeen(tls *libc.TLS, pCur uintptr, pStem uintptr) int32 { /* fuzzer.c:694:12: */
 22773  	var h uint32
 22774  	var pLookup uintptr
 22775  
 22776  	if fuzzerRender(tls, pStem, (pCur+116 /* &.zBuf */), (pCur+120 /* &.nBuf */)) == SQLITE_NOMEM {
 22777  		return -1
 22778  	}
 22779  	h = fuzzerHash(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf)
 22780  	pLookup = *(*uintptr)(unsafe.Pointer((pCur + 156 /* &.apHash */) + uintptr(h)*4))
 22781  	for (pLookup != 0) && (libc.Xstrcmp(tls, (*fuzzer_stem)(unsafe.Pointer(pLookup)).FzBasis, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf) != 0) {
 22782  		pLookup = (*fuzzer_stem)(unsafe.Pointer(pLookup)).FpHash
 22783  	}
 22784  	return (libc.Bool32(pLookup != uintptr(0)))
 22785  }
 22786  
 22787  // If argument pRule is NULL, this function returns false.
 22788  //
 22789  // Otherwise, it returns true if rule pRule should be skipped. A rule
 22790  // should be skipped if it does not belong to rule-set iRuleset, or if
 22791  // applying it to stem pStem would create a string longer than
 22792  // FUZZER_MX_OUTPUT_LENGTH bytes.
 22793  func fuzzerSkipRule(tls *libc.TLS, pRule uintptr, pStem uintptr, iRuleset int32) int32 { /* fuzzer.c:717:12: */
 22794  	return (libc.Bool32((pRule != 0) && (((*fuzzer_rule)(unsafe.Pointer(pRule)).FiRuleset != iRuleset) ||
 22795  		(((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))))
 22796  }
 22797  
 22798  // Advance a fuzzer_stem to its next value.   Return 0 if there are
 22799  // no more values that can be generated by this fuzzer_stem.  Return
 22800  // -1 on a memory allocation failure.
 22801  func fuzzerAdvance(tls *libc.TLS, pCur uintptr, pStem uintptr) int32 { /* fuzzer.c:733:12: */
 22802  	var pRule uintptr
 22803  	for (libc.AssignUintptr(&pRule, (*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule)) != uintptr(0) {
 22804  
 22805  		for int32((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn) < (int32((*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis) - int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) {
 22806  			(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn++
 22807  			if (int32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom) == 0) ||
 22808  				(libc.Xmemcmp(tls, ((*fuzzer_stem)(unsafe.Pointer(pStem)).FzBasis+uintptr((*fuzzer_stem)(unsafe.Pointer(pStem)).Fn)), (*fuzzer_rule)(unsafe.Pointer(pRule)).FzFrom, uint32((*fuzzer_rule)(unsafe.Pointer(pRule)).FnFrom)) == 0) {
 22809  				// Found a rewrite case.  Make sure it is not a duplicate
 22810  				var rc int32 = fuzzerSeen(tls, pCur, pStem)
 22811  				if rc < 0 {
 22812  					return -1
 22813  				}
 22814  				if rc == 0 {
 22815  					fuzzerCost(tls, pStem)
 22816  					return 1
 22817  				}
 22818  			}
 22819  		}
 22820  		(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn = int8(-1)
 22821  		for ok := true; ok; ok = fuzzerSkipRule(tls, pRule, pStem, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset) != 0 {
 22822  			pRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 22823  		}
 22824  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = pRule
 22825  		if (pRule != 0) && (fuzzerCost(tls, pStem) > (*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit) {
 22826  			(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = uintptr(0)
 22827  		}
 22828  	}
 22829  	return 0
 22830  }
 22831  
 22832  // The two input stem lists are both sorted in order of increasing
 22833  // rCostX.  Merge them together into a single list, sorted by rCostX, and
 22834  // return a pointer to the head of that new list.
 22835  func fuzzerMergeStems(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* fuzzer.c:766:20: */
 22836  	bp := tls.Alloc(28)
 22837  	defer tls.Free(28)
 22838  
 22839  	// var head fuzzer_stem at bp, 28
 22840  
 22841  	var pTail uintptr
 22842  
 22843  	pTail = bp /* &head */
 22844  	for (pA != 0) && (pB != 0) {
 22845  		if (*fuzzer_stem)(unsafe.Pointer(pA)).FrCostX <= (*fuzzer_stem)(unsafe.Pointer(pB)).FrCostX {
 22846  			(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pA
 22847  			pTail = pA
 22848  			pA = (*fuzzer_stem)(unsafe.Pointer(pA)).FpNext
 22849  		} else {
 22850  			(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pB
 22851  			pTail = pB
 22852  			pB = (*fuzzer_stem)(unsafe.Pointer(pB)).FpNext
 22853  		}
 22854  	}
 22855  	if pA == uintptr(0) {
 22856  		(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pB
 22857  	} else {
 22858  		(*fuzzer_stem)(unsafe.Pointer(pTail)).FpNext = pA
 22859  	}
 22860  	return (*fuzzer_stem)(unsafe.Pointer(bp /* &head */)).FpNext
 22861  }
 22862  
 22863  // Load pCur->pStem with the lowest-cost stem.  Return a pointer
 22864  // to the lowest-cost stem.
 22865  func fuzzerLowestCostStem(tls *libc.TLS, pCur uintptr) uintptr { /* fuzzer.c:794:20: */
 22866  	var pBest uintptr
 22867  	var pX uintptr
 22868  	var iBest int32
 22869  	var i int32
 22870  
 22871  	if (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem == uintptr(0) {
 22872  		iBest = -1
 22873  		pBest = uintptr(0)
 22874  		for i = 0; i <= (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue; i++ {
 22875  			pX = *(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4))
 22876  			if pX == uintptr(0) {
 22877  				continue
 22878  			}
 22879  			if (pBest == uintptr(0)) || ((*fuzzer_stem)(unsafe.Pointer(pBest)).FrCostX > (*fuzzer_stem)(unsafe.Pointer(pX)).FrCostX) {
 22880  				pBest = pX
 22881  				iBest = i
 22882  			}
 22883  		}
 22884  		if pBest != 0 {
 22885  			*(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(iBest)*4)) = (*fuzzer_stem)(unsafe.Pointer(pBest)).FpNext
 22886  			(*fuzzer_stem)(unsafe.Pointer(pBest)).FpNext = uintptr(0)
 22887  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = pBest
 22888  		}
 22889  	}
 22890  	return (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem
 22891  }
 22892  
 22893  // Insert pNew into queue of pending stems.  Then find the stem
 22894  // with the lowest rCostX and move it into pCur->pStem.
 22895  // list.  The insert is done such the pNew is in the correct order
 22896  // according to fuzzer_stem.zBaseCost+fuzzer_stem.pRule->rCost.
 22897  func fuzzerInsert(tls *libc.TLS, pCur uintptr, pNew uintptr) uintptr { /* fuzzer.c:825:20: */
 22898  	var pX uintptr
 22899  	var i int32
 22900  
 22901  	// If pCur->pStem exists and is greater than pNew, then make pNew
 22902  	// the new pCur->pStem and insert the old pCur->pStem instead.
 22903  	if ((libc.AssignUintptr(&pX, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)) != uintptr(0)) && ((*fuzzer_stem)(unsafe.Pointer(pX)).FrCostX > (*fuzzer_stem)(unsafe.Pointer(pNew)).FrCostX) {
 22904  		(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = uintptr(0)
 22905  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = pNew
 22906  		pNew = pX
 22907  	}
 22908  
 22909  	// Insert the new value
 22910  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = uintptr(0)
 22911  	pX = pNew
 22912  	for i = 0; i <= (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue; i++ {
 22913  		if *(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)) != 0 {
 22914  			pX = fuzzerMergeStems(tls, pX, *(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)))
 22915  			*(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)) = uintptr(0)
 22916  		} else {
 22917  			*(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)) = pX
 22918  			break
 22919  		}
 22920  	}
 22921  	if i > (*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue {
 22922  		if i < FUZZER_NQUEUE {
 22923  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FmxQueue = i
 22924  			*(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + uintptr(i)*4)) = pX
 22925  		} else {
 22926  
 22927  			pX = fuzzerMergeStems(tls, pX, *(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + 19*4)))
 22928  			*(*uintptr)(unsafe.Pointer((pCur + 32 /* &.aQueue */) + 19*4)) = pX
 22929  		}
 22930  	}
 22931  
 22932  	return fuzzerLowestCostStem(tls, pCur)
 22933  }
 22934  
 22935  // Allocate a new fuzzer_stem.  Add it to the hash table but do not
 22936  // link it into either the pCur->pStem or pCur->pDone lists.
 22937  func fuzzerNewStem(tls *libc.TLS, pCur uintptr, zWord uintptr, rBaseCost fuzzer_cost) uintptr { /* fuzzer.c:868:20: */
 22938  	var pNew uintptr
 22939  	var pRule uintptr
 22940  	var h uint32
 22941  
 22942  	pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(fuzzer_stem{})) + libc.Xstrlen(tls, zWord)) + uint32(1))))
 22943  	if pNew == uintptr(0) {
 22944  		return uintptr(0)
 22945  	}
 22946  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(fuzzer_stem{})))
 22947  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis = (pNew + 1*28)
 22948  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FnBasis = fuzzer_len(libc.Xstrlen(tls, zWord))
 22949  	libc.Xmemcpy(tls, (*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis, zWord, (uint32(int32((*fuzzer_stem)(unsafe.Pointer(pNew)).FnBasis) + 1)))
 22950  	pRule = (*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FpRule
 22951  	for fuzzerSkipRule(tls, pRule, pNew, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset) != 0 {
 22952  		pRule = (*fuzzer_rule)(unsafe.Pointer(pRule)).FpNext
 22953  	}
 22954  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpRule = pRule
 22955  	(*fuzzer_stem)(unsafe.Pointer(pNew)).Fn = int8(-1)
 22956  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FrBaseCost = libc.AssignPtrInt32(pNew+20 /* &.rCostX */, rBaseCost)
 22957  	h = fuzzerHash(tls, (*fuzzer_stem)(unsafe.Pointer(pNew)).FzBasis)
 22958  	(*fuzzer_stem)(unsafe.Pointer(pNew)).FpHash = *(*uintptr)(unsafe.Pointer((pCur + 156 /* &.apHash */) + uintptr(h)*4))
 22959  	*(*uintptr)(unsafe.Pointer((pCur + 156 /* &.apHash */) + uintptr(h)*4)) = pNew
 22960  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnStem++
 22961  	return pNew
 22962  }
 22963  
 22964  // Advance a cursor to its next row of output
 22965  func fuzzerNext(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:901:12: */
 22966  	var pCur uintptr = cur
 22967  	var rc int32
 22968  	var pStem uintptr
 22969  	var pNew uintptr
 22970  
 22971  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid++
 22972  
 22973  	// Use the element the cursor is currently point to to create
 22974  	// a new stem and insert the new stem into the priority queue.
 22975  	pStem = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem
 22976  	if (*fuzzer_stem)(unsafe.Pointer(pStem)).FrCostX > 0 {
 22977  		rc = fuzzerRender(tls, pStem, (pCur + 116 /* &.zBuf */), (pCur + 120 /* &.nBuf */))
 22978  		if rc == SQLITE_NOMEM {
 22979  			return SQLITE_NOMEM
 22980  		}
 22981  		pNew = fuzzerNewStem(tls, pCur, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf, (*fuzzer_stem)(unsafe.Pointer(pStem)).FrCostX)
 22982  		if pNew != 0 {
 22983  			if fuzzerAdvance(tls, pCur, pNew) == 0 {
 22984  				(*fuzzer_stem)(unsafe.Pointer(pNew)).FpNext = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone
 22985  				(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = pNew
 22986  			} else {
 22987  				if fuzzerInsert(tls, pCur, pNew) == pNew {
 22988  					return SQLITE_OK
 22989  				}
 22990  			}
 22991  		} else {
 22992  			return SQLITE_NOMEM
 22993  		}
 22994  	}
 22995  
 22996  	// Adjust the priority queue so that the first element of the
 22997  	// stem list is the next lowest cost word.
 22998  	for (libc.AssignUintptr(&pStem, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)) != uintptr(0) {
 22999  		var res int32 = fuzzerAdvance(tls, pCur, pStem)
 23000  		if res < 0 {
 23001  			return SQLITE_NOMEM
 23002  		} else if res > 0 {
 23003  			(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 23004  			pStem = fuzzerInsert(tls, pCur, pStem)
 23005  			if (libc.AssignInt32(&rc, fuzzerSeen(tls, pCur, pStem))) != 0 {
 23006  				if rc < 0 {
 23007  					return SQLITE_NOMEM
 23008  				}
 23009  				continue
 23010  			}
 23011  			return SQLITE_OK // New word found
 23012  		}
 23013  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = uintptr(0)
 23014  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpNext = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone
 23015  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpDone = pStem
 23016  		if fuzzerLowestCostStem(tls, pCur) != 0 {
 23017  			rc = fuzzerSeen(tls, pCur, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)
 23018  			if rc < 0 {
 23019  				return SQLITE_NOMEM
 23020  			}
 23021  			if rc == 0 {
 23022  				return SQLITE_OK
 23023  			}
 23024  		}
 23025  	}
 23026  
 23027  	// Reach this point only if queue has been exhausted and there is
 23028  	// nothing left to be output.
 23029  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 23030  	return SQLITE_OK
 23031  }
 23032  
 23033  // Called to "rewind" a cursor back to the beginning so that
 23034  // it starts its output over again.  Always called at least once
 23035  // prior to any fuzzerColumn, fuzzerRowid, or fuzzerEof call.
 23036  func fuzzerFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* fuzzer.c:969:12: */
 23037  	var pCur uintptr = pVtabCursor
 23038  	var zWord uintptr = ts + 489 /* "" */
 23039  	var pStem uintptr
 23040  	var idx int32
 23041  
 23042  	fuzzerClearCursor(tls, pCur, 1)
 23043  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 2147483647
 23044  	idx = 0
 23045  	if (idxNum & 1) != 0 {
 23046  		zWord = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23047  		idx++
 23048  	}
 23049  	if (idxNum & 2) != 0 {
 23050  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*4)))
 23051  		idx++
 23052  	}
 23053  	if (idxNum & 4) != 0 {
 23054  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRuleset = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(idx)*4)))
 23055  		idx++
 23056  	}
 23057  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FpNext = (*fuzzer_vtab)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpVtab)).FpRule
 23058  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FrCost = 0
 23059  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FnFrom = int8(0)
 23060  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FnTo = int8(0)
 23061  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FnullRule.FzFrom = ts + 489 /* "" */
 23062  	(*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 23063  
 23064  	// If the query term is longer than FUZZER_MX_OUTPUT_LENGTH bytes, this
 23065  	// query will return zero rows.
 23066  	if int32(libc.Xstrlen(tls, zWord)) < FUZZER_MX_OUTPUT_LENGTH {
 23067  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem = libc.AssignUintptr(&pStem, fuzzerNewStem(tls, pCur, zWord, 0))
 23068  		if pStem == uintptr(0) {
 23069  			return SQLITE_NOMEM
 23070  		}
 23071  		(*fuzzer_stem)(unsafe.Pointer(pStem)).FpRule = (pCur + 132 /* &.nullRule */)
 23072  		(*fuzzer_stem)(unsafe.Pointer(pStem)).Fn = (*fuzzer_stem)(unsafe.Pointer(pStem)).FnBasis
 23073  	} else {
 23074  		(*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit = 0
 23075  	}
 23076  
 23077  	return SQLITE_OK
 23078  }
 23079  
 23080  // Only the word and distance columns have values.  All other columns
 23081  // return NULL
 23082  func fuzzerColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* fuzzer.c:1020:12: */
 23083  	var pCur uintptr = cur
 23084  	if i == 0 {
 23085  		// the "word" column
 23086  		if fuzzerRender(tls, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem, (pCur+116 /* &.zBuf */), (pCur+120 /* &.nBuf */)) == SQLITE_NOMEM {
 23087  			return SQLITE_NOMEM
 23088  		}
 23089  		sqlite3.Xsqlite3_result_text(tls, ctx, (*fuzzer_cursor)(unsafe.Pointer(pCur)).FzBuf, -1, libc.UintptrFromInt32(-1))
 23090  	} else if i == 1 {
 23091  		// the "distance" column
 23092  		sqlite3.Xsqlite3_result_int(tls, ctx, (*fuzzer_stem)(unsafe.Pointer((*fuzzer_cursor)(unsafe.Pointer(pCur)).FpStem)).FrCostX)
 23093  	} else {
 23094  		// All other columns are NULL
 23095  		sqlite3.Xsqlite3_result_null(tls, ctx)
 23096  	}
 23097  	return SQLITE_OK
 23098  }
 23099  
 23100  // The rowid.
 23101  func fuzzerRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* fuzzer.c:1041:12: */
 23102  	var pCur uintptr = cur
 23103  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*fuzzer_cursor)(unsafe.Pointer(pCur)).FiRowid
 23104  	return SQLITE_OK
 23105  }
 23106  
 23107  // When the fuzzer_cursor.rLimit value is 0 or less, that is a signal
 23108  // that the cursor has nothing more to output.
 23109  func fuzzerEof(tls *libc.TLS, cur uintptr) int32 { /* fuzzer.c:1051:12: */
 23110  	var pCur uintptr = cur
 23111  	return (libc.Bool32((*fuzzer_cursor)(unsafe.Pointer(pCur)).FrLimit <= 0))
 23112  }
 23113  
 23114  // Search for terms of these forms:
 23115  //
 23116  //   (A)    word MATCH $str
 23117  //   (B1)   distance < $value
 23118  //   (B2)   distance <= $value
 23119  //   (C)    ruleid == $ruleid
 23120  //
 23121  // The distance< and distance<= are both treated as distance<=.
 23122  // The query plan number is a bit vector:
 23123  //
 23124  //   bit 1:   Term of the form (A) found
 23125  //   bit 2:   Term like (B1) or (B2) found
 23126  //   bit 3:   Term like (C) found
 23127  //
 23128  // If bit-1 is set, $str is always in filter.argv[0].  If bit-2 is set
 23129  // then $value is in filter.argv[0] if bit-1 is clear and is in
 23130  // filter.argv[1] if bit-1 is set.  If bit-3 is set, then $ruleid is
 23131  // in filter.argv[0] if bit-1 and bit-2 are both zero, is in
 23132  // filter.argv[1] if exactly one of bit-1 and bit-2 are set, and is in
 23133  // filter.argv[2] if both bit-1 and bit-2 are set.
 23134  func fuzzerBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* fuzzer.c:1078:12: */
 23135  	var iPlan int32 = 0
 23136  	var iDistTerm int32 = -1
 23137  	var iRulesetTerm int32 = -1
 23138  	var i int32
 23139  	var seenMatch int32 = 0
 23140  	var pConstraint uintptr
 23141  	var rCost float64 = 1e12
 23142  
 23143  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 23144  	i = 0
 23145  __1:
 23146  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 23147  		goto __3
 23148  	}
 23149  	{
 23150  		if ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0) &&
 23151  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 23152  			seenMatch = 1
 23153  		}
 23154  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 23155  			goto __2
 23156  		}
 23157  		if (((iPlan & 1) == 0) &&
 23158  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 0)) &&
 23159  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 23160  			iPlan = iPlan | (1)
 23161  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 23162  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 23163  			rCost = rCost / (1e6)
 23164  		}
 23165  		if (((iPlan & 2) == 0) &&
 23166  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 1)) &&
 23167  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 23168  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 23169  			iPlan = iPlan | (2)
 23170  			iDistTerm = i
 23171  			rCost = rCost / (10.0)
 23172  		}
 23173  		if (((iPlan & 4) == 0) &&
 23174  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == 2)) &&
 23175  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 23176  			iPlan = iPlan | (4)
 23177  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 23178  			iRulesetTerm = i
 23179  			rCost = rCost / (10.0)
 23180  		}
 23181  
 23182  	}
 23183  	goto __2
 23184  __2:
 23185  	i++
 23186  	pConstraint += 12
 23187  	goto __1
 23188  	goto __3
 23189  __3:
 23190  	;
 23191  	if (iPlan & 2) != 0 {
 23192  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = (1 + (libc.Bool32((iPlan & 1) != 0)))
 23193  	}
 23194  	if (iPlan & 4) != 0 {
 23195  		var idx int32 = 1
 23196  		if (iPlan & 1) != 0 {
 23197  			idx++
 23198  		}
 23199  		if (iPlan & 2) != 0 {
 23200  			idx++
 23201  		}
 23202  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRulesetTerm)*8)).FargvIndex = idx
 23203  	}
 23204  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 23205  	if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 23206  		((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == 1)) &&
 23207  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 23208  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 23209  	}
 23210  	if (seenMatch != 0) && ((iPlan & 1) == 0) {
 23211  		rCost = 1e99
 23212  	}
 23213  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = rCost
 23214  
 23215  	return SQLITE_OK
 23216  }
 23217  
 23218  // A virtual table module that implements the "fuzzer".
 23219  var fuzzerModule = sqlite3_module{ // iVersion
 23220  	FxCreate:     0,
 23221  	FxConnect:    0,
 23222  	FxBestIndex:  0,
 23223  	FxDisconnect: 0,
 23224  	FxDestroy:    0,
 23225  	FxOpen:       0, // xOpen - open a cursor
 23226  	FxClose:      0, // xClose - close a cursor
 23227  	FxFilter:     0, // xFilter - configure scan constraints
 23228  	FxNext:       0, // xNext - advance a cursor
 23229  	FxEof:        0, // xEof - check for end of scan
 23230  	FxColumn:     0, // xColumn - read data
 23231  	FxRowid:      0, // xRename
 23232  } /* fuzzer.c:1147:23 */
 23233  
 23234  func sqlite3_fuzzer_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* fuzzer.c:1176:5: */
 23235  	var rc int32 = SQLITE_OK
 23236  	_ = pApi
 23237  
 23238  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+5344 /* "fuzzer" */, uintptr(unsafe.Pointer(&fuzzerModule)), uintptr(0))
 23239  	return rc
 23240  }
 23241  
 23242  // Mark a function parameter as unused, to suppress nuisance compiler
 23243  // warnings.
 23244  
 23245  // Implementation of the ieee754() function
 23246  func ieee754func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:102:13: */
 23247  	bp := tls.Alloc(160)
 23248  	defer tls.Free(160)
 23249  
 23250  	if argc == 1 {
 23251  		var m sqlite3_int64
 23252  		// var a sqlite3_int64 at bp+32, 8
 23253  
 23254  		// var r float64 at bp+16, 8
 23255  
 23256  		var e int32
 23257  		var isNeg int32
 23258  		// var zResult [100]int8 at bp+40, 100
 23259  
 23260  		if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB) &&
 23261  			(uint32(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) == uint32(unsafe.Sizeof(float64(0)))) {
 23262  			var x uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23263  			var i uint32
 23264  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) = uint64(0)
 23265  			for i = uint32(0); i < uint32(unsafe.Sizeof(float64(0))); i++ {
 23266  				*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp + 24 /* v */)) << 8) | sqlite3_uint64(*(*uint8)(unsafe.Pointer(x + uintptr(i)))))
 23267  			}
 23268  			libc.Xmemcpy(tls, bp+16 /* &r */, bp+24 /* &v */, uint32(unsafe.Sizeof(float64(0))))
 23269  		} else {
 23270  			*(*float64)(unsafe.Pointer(bp + 16 /* r */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23271  		}
 23272  		if *(*float64)(unsafe.Pointer(bp + 16 /* r */)) < 0.0 {
 23273  			isNeg = 1
 23274  			*(*float64)(unsafe.Pointer(bp + 16 /* r */)) = -*(*float64)(unsafe.Pointer(bp + 16 /* r */))
 23275  		} else {
 23276  			isNeg = 0
 23277  		}
 23278  		libc.Xmemcpy(tls, bp+32 /* &a */, bp+16 /* &r */, uint32(unsafe.Sizeof(sqlite3_int64(0))))
 23279  		if *(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) == int64(0) {
 23280  			e = 0
 23281  			m = int64(0)
 23282  		} else {
 23283  			e = (int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) >> 52))
 23284  			m = (*(*sqlite3_int64)(unsafe.Pointer(bp + 32 /* a */)) & ((sqlite3_int64((int64(1))) << 52) - int64(1)))
 23285  			if e == 0 {
 23286  				m <<= 1
 23287  			} else {
 23288  				m = m | (sqlite3_int64((int64(1))) << 52)
 23289  			}
 23290  			for ((e < 1075) && (m > int64(0))) && ((m & int64(1)) == int64(0)) {
 23291  				m >>= 1
 23292  				e++
 23293  			}
 23294  			if isNeg != 0 {
 23295  				m = -m
 23296  			}
 23297  		}
 23298  		switch *(*int32)(unsafe.Pointer(sqlite3.Xsqlite3_user_data(tls, context))) {
 23299  		case 0:
 23300  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+40 /* &zResult[0] */, ts+5351, /* "ieee754(%lld,%d)" */
 23301  				libc.VaList(bp, m, (e-1075)))
 23302  			sqlite3.Xsqlite3_result_text(tls, context, bp+40 /* &zResult[0] */, -1, libc.UintptrFromInt32(-1))
 23303  			break
 23304  			fallthrough
 23305  		case 1:
 23306  			sqlite3.Xsqlite3_result_int64(tls, context, m)
 23307  			break
 23308  			fallthrough
 23309  		case 2:
 23310  			sqlite3.Xsqlite3_result_int(tls, context, (e - 1075))
 23311  			break
 23312  		}
 23313  	} else {
 23314  		var m sqlite3_int64
 23315  		var e sqlite3_int64
 23316  		// var a sqlite3_int64 at bp+152, 8
 23317  
 23318  		// var r float64 at bp+144, 8
 23319  
 23320  		var isNeg int32 = 0
 23321  		m = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23322  		e = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 23323  
 23324  		// Limit the range of e.  Ticket 22dea1cfdb9151e4 2021-03-02
 23325  		if e > int64(10000) {
 23326  			e = int64(10000)
 23327  		} else if e < int64(-10000) {
 23328  			e = int64(-10000)
 23329  		}
 23330  
 23331  		if m < int64(0) {
 23332  			isNeg = 1
 23333  			m = -m
 23334  			if m < int64(0) {
 23335  				return
 23336  			}
 23337  		} else if ((m == int64(0)) && (e > int64(-1000))) && (e < int64(1000)) {
 23338  			sqlite3.Xsqlite3_result_double(tls, context, 0.0)
 23339  			return
 23340  		}
 23341  		for ((m >> 32) & int64(0xffe00000)) != 0 {
 23342  			m >>= 1
 23343  			e++
 23344  		}
 23345  		for (m != int64(0)) && (((m >> 32) & int64(0xfff00000)) == int64(0)) {
 23346  			m <<= 1
 23347  			e--
 23348  		}
 23349  		e = e + (int64(1075))
 23350  		if e <= int64(0) {
 23351  			// Subnormal
 23352  			m >>= (int64(1) - e)
 23353  			e = int64(0)
 23354  		} else if e > int64(0x7ff) {
 23355  			e = int64(0x7ff)
 23356  		}
 23357  		*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) = (m & ((sqlite3_int64((int64(1))) << 52) - int64(1)))
 23358  		*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) |= (e << 52)
 23359  		if isNeg != 0 {
 23360  			*(*sqlite3_int64)(unsafe.Pointer(bp + 152 /* a */)) |= libc.Int64FromUint64((sqlite3_uint64((uint64(1))) << 63))
 23361  		}
 23362  		libc.Xmemcpy(tls, bp+144 /* &r */, bp+152 /* &a */, uint32(unsafe.Sizeof(float64(0))))
 23363  		sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 144 /* r */)))
 23364  	}
 23365  }
 23366  
 23367  // Functions to convert between blobs and floats.
 23368  func ieee754func_from_blob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:213:13: */
 23369  	bp := tls.Alloc(16)
 23370  	defer tls.Free(16)
 23371  
 23372  	_ = argc
 23373  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB) &&
 23374  		(uint32(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))) == uint32(unsafe.Sizeof(float64(0)))) {
 23375  		// var r float64 at bp, 8
 23376  
 23377  		var x uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23378  		var i uint32
 23379  		*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) = uint64(0)
 23380  		for i = uint32(0); i < uint32(unsafe.Sizeof(float64(0))); i++ {
 23381  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp + 8 /* v */)) << 8) | sqlite3_uint64(*(*uint8)(unsafe.Pointer(x + uintptr(i)))))
 23382  		}
 23383  		libc.Xmemcpy(tls, bp /* &r */, bp+8 /* &v */, uint32(unsafe.Sizeof(float64(0))))
 23384  		sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp /* r */)))
 23385  	}
 23386  }
 23387  
 23388  func ieee754func_to_blob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* ieee754.c:233:13: */
 23389  	bp := tls.Alloc(24)
 23390  	defer tls.Free(24)
 23391  
 23392  	_ = argc
 23393  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_FLOAT) ||
 23394  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_INTEGER) {
 23395  		*(*float64)(unsafe.Pointer(bp + 8 /* r */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23396  		// var v sqlite3_uint64 at bp, 8
 23397  
 23398  		// var a [8]uint8 at bp+16, 8
 23399  
 23400  		var i uint32
 23401  		libc.Xmemcpy(tls, bp /* &v */, bp+8 /* &r */, uint32(unsafe.Sizeof(float64(0))))
 23402  		for i = uint32(1); i <= uint32(unsafe.Sizeof(float64(0))); i++ {
 23403  			*(*uint8)(unsafe.Pointer(bp + 16 /* &a[0] */ + uintptr((uint32(unsafe.Sizeof(float64(0))) - i)))) = (uint8(*(*sqlite3_uint64)(unsafe.Pointer(bp /* v */)) & uint64(0xff)))
 23404  			*(*sqlite3_uint64)(unsafe.Pointer(bp /* v */)) >>= 8
 23405  		}
 23406  		sqlite3.Xsqlite3_result_blob(tls, context, bp+16 /* &a[0] */, int32(unsafe.Sizeof(float64(0))), libc.UintptrFromInt32(-1))
 23407  	}
 23408  }
 23409  
 23410  func sqlite3_ieee_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* ieee754.c:259:5: */
 23411  	var i uint32
 23412  	var rc int32 = SQLITE_OK
 23413  	_ = pApi
 23414  
 23415  	_ = pzErrMsg // Unused parameter
 23416  	for i = uint32(0); (i < (uint32(unsafe.Sizeof(aFunc1)) / uint32(unsafe.Sizeof(struct {
 23417  		FzFName uintptr
 23418  		FnArg   int32
 23419  		FiAux   int32
 23420  		FxFunc  uintptr
 23421  	}{})))) && (rc == SQLITE_OK); i++ {
 23422  		rc = sqlite3.Xsqlite3_create_function(tls, db, aFunc1[i].FzFName, aFunc1[i].FnArg,
 23423  			(SQLITE_UTF8 | SQLITE_INNOCUOUS),
 23424  			(uintptr(unsafe.Pointer(&aFunc1)) + uintptr(i)*16 + 8 /* &.iAux */),
 23425  			aFunc1[i].FxFunc, uintptr(0), uintptr(0))
 23426  	}
 23427  	return rc
 23428  }
 23429  
 23430  var aFunc1 = [6]struct {
 23431  	FzFName uintptr
 23432  	FnArg   int32
 23433  	FiAux   int32
 23434  	FxFunc  uintptr
 23435  }{
 23436  	{FzFName: ts + 5368 /* "ieee754" */, FnArg: 1, FxFunc: 0},
 23437  	{FzFName: ts + 5368 /* "ieee754" */, FnArg: 2, FxFunc: 0},
 23438  	{FzFName: ts + 5376 /* "ieee754_mantissa" */, FnArg: 1, FiAux: 1, FxFunc: 0},
 23439  	{FzFName: ts + 5393 /* "ieee754_exponent" */, FnArg: 1, FiAux: 2, FxFunc: 0},
 23440  	{FzFName: ts + 5410 /* "ieee754_to_blob" */, FnArg: 1, FxFunc: 0},
 23441  	{FzFName: ts + 5426 /* "ieee754_from_blo..." */, FnArg: 1, FxFunc: 0},
 23442  } /* ieee754.c:269:5 */
 23443  
 23444  //
 23445  // END OF REGISTRATION API
 23446  //
 23447  
 23448  //******* End of fts5.h ********
 23449  
 23450  // This function is used to touch each page of a mapping of a memory
 23451  // mapped SQLite database. Assuming that the system has sufficient free
 23452  // memory and supports sufficiently large mappings, this causes the OS
 23453  // to cache the entire database in main memory, making subsequent
 23454  // database accesses faster.
 23455  //
 23456  // If the second parameter to this function is not NULL, it is the name of
 23457  // the specific database to operate on (i.e. "main" or the name of an
 23458  // attached database).
 23459  //
 23460  // SQLITE_OK is returned if successful, or an SQLite error code otherwise.
 23461  // It is not considered an error if the file is not memory-mapped, or if
 23462  // the mapping does not span the entire file. If an error does occur, a
 23463  // transaction may be left open on the database file.
 23464  //
 23465  // It is illegal to call this function when the database handle has an
 23466  // open transaction. SQLITE_MISUSE is returned in this case.
 23467  func sqlite3_mmap_warm(tls *libc.TLS, db uintptr, zDb uintptr) int32 { /* mmapwarm.c:37:5: */
 23468  	bp := tls.Alloc(76)
 23469  	defer tls.Free(76)
 23470  
 23471  	var rc int32 = SQLITE_OK
 23472  	var zSql uintptr = uintptr(0)
 23473  	var pgsz int32 = 0
 23474  	var nTotal int32 = 0
 23475  
 23476  	if 0 == sqlite3.Xsqlite3_get_autocommit(tls, db) {
 23477  		return SQLITE_MISUSE
 23478  	}
 23479  
 23480  	// Open a read-only transaction on the file in question
 23481  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+5444, /* "BEGIN; SELECT * ..." */
 23482  		libc.VaList(bp, func() uintptr {
 23483  			if zDb != 0 {
 23484  				return ts + 5485 /* "'" */
 23485  			}
 23486  			return ts + 489 /* "" */
 23487  		}(), func() uintptr {
 23488  			if zDb != 0 {
 23489  				return zDb
 23490  			}
 23491  			return ts + 489 /* "" */
 23492  		}(), func() uintptr {
 23493  			if zDb != 0 {
 23494  				return ts + 5487 /* "'." */
 23495  			}
 23496  			return ts + 489 /* "" */
 23497  		}()))
 23498  	if zSql == uintptr(0) {
 23499  		return SQLITE_NOMEM
 23500  	}
 23501  	rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 23502  	sqlite3.Xsqlite3_free(tls, zSql)
 23503  
 23504  	// Find the SQLite page size of the file
 23505  	if rc == SQLITE_OK {
 23506  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+5490, /* "PRAGMA %s%q%spag..." */
 23507  			libc.VaList(bp+24, func() uintptr {
 23508  				if zDb != 0 {
 23509  					return ts + 5485 /* "'" */
 23510  				}
 23511  				return ts + 489 /* "" */
 23512  			}(), func() uintptr {
 23513  				if zDb != 0 {
 23514  					return zDb
 23515  				}
 23516  				return ts + 489 /* "" */
 23517  			}(), func() uintptr {
 23518  				if zDb != 0 {
 23519  					return ts + 5487 /* "'." */
 23520  				}
 23521  				return ts + 489 /* "" */
 23522  			}()))
 23523  		if zSql == uintptr(0) {
 23524  			rc = SQLITE_NOMEM
 23525  		} else {
 23526  			*(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)) = uintptr(0)
 23527  			rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+64 /* &pPgsz */, uintptr(0))
 23528  			sqlite3.Xsqlite3_free(tls, zSql)
 23529  			if rc == SQLITE_OK {
 23530  				if sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */))) == SQLITE_ROW {
 23531  					pgsz = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)), 0)
 23532  				}
 23533  				rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pPgsz */)))
 23534  			}
 23535  			if (rc == SQLITE_OK) && (pgsz == 0) {
 23536  				rc = SQLITE_ERROR
 23537  			}
 23538  		}
 23539  	}
 23540  
 23541  	// Touch each mmap'd page of the file
 23542  	if rc == SQLITE_OK {
 23543  		var rc2 int32
 23544  		*(*uintptr)(unsafe.Pointer(bp + 68 /* pFd */)) = uintptr(0)
 23545  		rc = sqlite3.Xsqlite3_file_control(tls, db, zDb, SQLITE_FCNTL_FILE_POINTER, bp+68 /* &pFd */)
 23546  		if (rc == SQLITE_OK) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 68 /* pFd */)))).FpMethods)).FiVersion >= 3) {
 23547  			var iPg sqlite3_int64 = int64(1)
 23548  			var p uintptr = (*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 68 /* pFd */)))).FpMethods
 23549  			for 1 != 0 {
 23550  				// var pMap uintptr at bp+72, 4
 23551  
 23552  				rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer((p + 68 /* &.xFetch */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 68 /* pFd */)), (sqlite3_int64(pgsz) * iPg), pgsz, bp+72 /* &pMap */)
 23553  				if (rc != SQLITE_OK) || (*(*uintptr)(unsafe.Pointer(bp + 72 /* pMap */)) == uintptr(0)) {
 23554  					break
 23555  				}
 23556  
 23557  				nTotal = nTotal + (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 72 /* pMap */))))))
 23558  				nTotal = nTotal + (int32(*(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 72 /* pMap */)) + uintptr((pgsz - 1))))))
 23559  
 23560  				rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer((p + 72 /* &.xUnfetch */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 68 /* pFd */)), (sqlite3_int64(pgsz) * iPg), *(*uintptr)(unsafe.Pointer(bp + 72 /* pMap */)))
 23561  				if rc != SQLITE_OK {
 23562  					break
 23563  				}
 23564  				iPg++
 23565  			}
 23566  			sqlite3.Xsqlite3_log(tls, SQLITE_OK,
 23567  				ts+5513 /* "sqlite3_mmap_war..." */, libc.VaList(bp+48, func() int64 {
 23568  					if iPg == int64(1) {
 23569  						return int64(0)
 23570  					}
 23571  					return iPg
 23572  				}(),
 23573  					sqlite3.Xsqlite3_db_filename(tls, db, zDb)))
 23574  		}
 23575  
 23576  		rc2 = sqlite3.Xsqlite3_exec(tls, db, ts+5563 /* "END" */, uintptr(0), uintptr(0), uintptr(0))
 23577  		if rc == SQLITE_OK {
 23578  			rc = rc2
 23579  		}
 23580  	}
 23581  
 23582  	return rc
 23583  }
 23584  
 23585  // A structure to hold context of the next_char() computation across
 23586  // nested function calls.
 23587  type nextCharContext1 = struct {
 23588  	Fdb           uintptr
 23589  	FpStmt        uintptr
 23590  	FzPrefix      uintptr
 23591  	FnPrefix      int32
 23592  	FnAlloc       int32
 23593  	FnUsed        int32
 23594  	FaResult      uintptr
 23595  	FmallocFailed int32
 23596  	FotherError   int32
 23597  } /* nextchar.c:63:9 */
 23598  
 23599  // A structure to hold context of the next_char() computation across
 23600  // nested function calls.
 23601  type nextCharContext = nextCharContext1 /* nextchar.c:63:32 */
 23602  
 23603  // Append a result character if the character is not already in the
 23604  // result.
 23605  func nextCharAppend(tls *libc.TLS, p uintptr, c uint32) { /* nextchar.c:80:13: */
 23606  	var i int32
 23607  	for i = 0; i < (*nextCharContext)(unsafe.Pointer(p)).FnUsed; i++ {
 23608  		if *(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(p)).FaResult + uintptr(i)*4)) == c {
 23609  			return
 23610  		}
 23611  	}
 23612  	if ((*nextCharContext)(unsafe.Pointer(p)).FnUsed + 1) > (*nextCharContext)(unsafe.Pointer(p)).FnAlloc {
 23613  		var aNew uintptr
 23614  		var n int32 = (((*nextCharContext)(unsafe.Pointer(p)).FnAlloc * 2) + 30)
 23615  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*nextCharContext)(unsafe.Pointer(p)).FaResult, (uint64(uint32(n) * uint32(unsafe.Sizeof(uint32(0))))))
 23616  		if aNew == uintptr(0) {
 23617  			(*nextCharContext)(unsafe.Pointer(p)).FmallocFailed = 1
 23618  			return
 23619  		} else {
 23620  			(*nextCharContext)(unsafe.Pointer(p)).FaResult = aNew
 23621  			(*nextCharContext)(unsafe.Pointer(p)).FnAlloc = n
 23622  		}
 23623  	}
 23624  	*(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(p)).FaResult + uintptr(libc.PostIncInt32(&(*nextCharContext)(unsafe.Pointer(p)).FnUsed, 1))*4)) = c
 23625  }
 23626  
 23627  // Write a character into z[] as UTF8.  Return the number of bytes needed
 23628  // to hold the character
 23629  func writeUtf8(tls *libc.TLS, z uintptr, c uint32) int32 { /* nextchar.c:104:12: */
 23630  	if c < uint32(0x00080) {
 23631  		*(*uint8)(unsafe.Pointer(z)) = (uint8(c & uint32(0xff)))
 23632  		return 1
 23633  	}
 23634  	if c < uint32(0x00800) {
 23635  		*(*uint8)(unsafe.Pointer(z)) = (uint8(0xC0 + int32((uint8((c >> 6) & uint32(0x1F))))))
 23636  		*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 23637  		return 2
 23638  	}
 23639  	if c < uint32(0x10000) {
 23640  		*(*uint8)(unsafe.Pointer(z)) = (uint8(0xE0 + int32((uint8((c >> 12) & uint32(0x0F))))))
 23641  		*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8((c >> 6) & uint32(0x3F))))))
 23642  		*(*uint8)(unsafe.Pointer(z + 2)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 23643  		return 3
 23644  	}
 23645  	*(*uint8)(unsafe.Pointer(z)) = (uint8(0xF0 + int32((uint8((c >> 18) & uint32(0x07))))))
 23646  	*(*uint8)(unsafe.Pointer(z + 1)) = (uint8(0x80 + int32((uint8((c >> 12) & uint32(0x3F))))))
 23647  	*(*uint8)(unsafe.Pointer(z + 2)) = (uint8(0x80 + int32((uint8((c >> 6) & uint32(0x3F))))))
 23648  	*(*uint8)(unsafe.Pointer(z + 3)) = (uint8(0x80 + int32((uint8(c & uint32(0x3F))))))
 23649  	return 4
 23650  }
 23651  
 23652  // Read a UTF8 character out of z[] and write it into *pOut.  Return
 23653  // the number of bytes in z[] that were used to construct the character.
 23654  func readUtf8(tls *libc.TLS, z uintptr, pOut uintptr) int32 { /* nextchar.c:131:12: */
 23655  	var c uint32 = uint32(*(*uint8)(unsafe.Pointer(z)))
 23656  	if c < uint32(0xc0) {
 23657  		*(*uint32)(unsafe.Pointer(pOut)) = c
 23658  		return 1
 23659  	} else {
 23660  		var n int32 = 1
 23661  		c = uint32(validBits[(c - uint32(0xc0))])
 23662  		for (int32(*(*uint8)(unsafe.Pointer(z + uintptr(n)))) & 0xc0) == 0x80 {
 23663  			c = ((c << 6) + (uint32(0x3f & int32(*(*uint8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&n, 1))))))))
 23664  		}
 23665  		if ((c < uint32(0x80)) || ((c & 0xFFFFF800) == uint32(0xD800))) || ((c & 0xFFFFFFFE) == uint32(0xFFFE)) {
 23666  			c = uint32(0xFFFD)
 23667  		}
 23668  		*(*uint32)(unsafe.Pointer(pOut)) = c
 23669  		return n
 23670  	}
 23671  	return int32(0)
 23672  }
 23673  
 23674  var validBits = [64]uint8{
 23675  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 23676  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 23677  	uint8(0x10), uint8(0x11), uint8(0x12), uint8(0x13), uint8(0x14), uint8(0x15), uint8(0x16), uint8(0x17),
 23678  	uint8(0x18), uint8(0x19), uint8(0x1a), uint8(0x1b), uint8(0x1c), uint8(0x1d), uint8(0x1e), uint8(0x1f),
 23679  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 23680  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 23681  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 23682  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x00),
 23683  } /* nextchar.c:132:30 */
 23684  
 23685  // The nextCharContext structure has been set up.  Add all "next" characters
 23686  // to the result set.
 23687  func findNextChars(tls *libc.TLS, p uintptr) { /* nextchar.c:164:13: */
 23688  	bp := tls.Alloc(12)
 23689  	defer tls.Free(12)
 23690  
 23691  	var cPrev uint32 = uint32(0)
 23692  	// var zPrev [8]uint8 at bp, 8
 23693  
 23694  	var n int32
 23695  	var rc int32
 23696  
 23697  	for {
 23698  		sqlite3.Xsqlite3_bind_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 1, (*nextCharContext)(unsafe.Pointer(p)).FzPrefix, (*nextCharContext)(unsafe.Pointer(p)).FnPrefix,
 23699  			uintptr(0))
 23700  		n = writeUtf8(tls, bp /* &zPrev[0] */, (cPrev + uint32(1)))
 23701  		sqlite3.Xsqlite3_bind_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 2, bp /* zPrev */, n, uintptr(0))
 23702  		rc = sqlite3.Xsqlite3_step(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 23703  		if rc == SQLITE_DONE {
 23704  			sqlite3.Xsqlite3_reset(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 23705  			return
 23706  		} else if rc != SQLITE_ROW {
 23707  			(*nextCharContext)(unsafe.Pointer(p)).FotherError = rc
 23708  			return
 23709  		} else {
 23710  			var zOut uintptr = sqlite3.Xsqlite3_column_text(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt, 0)
 23711  			// var cNext uint32 at bp+8, 4
 23712  
 23713  			n = readUtf8(tls, (zOut + uintptr((*nextCharContext)(unsafe.Pointer(p)).FnPrefix)), bp+8 /* &cNext */)
 23714  			sqlite3.Xsqlite3_reset(tls, (*nextCharContext)(unsafe.Pointer(p)).FpStmt)
 23715  			nextCharAppend(tls, p, *(*uint32)(unsafe.Pointer(bp + 8 /* cNext */)))
 23716  			cPrev = *(*uint32)(unsafe.Pointer(bp + 8 /* cNext */))
 23717  			if (*nextCharContext)(unsafe.Pointer(p)).FmallocFailed != 0 {
 23718  				return
 23719  			}
 23720  		}
 23721  	}
 23722  }
 23723  
 23724  // next_character(A,T,F,W)
 23725  //
 23726  // Return a string composted of all next possible characters after
 23727  // A for elements of T.F.  If W is supplied, then it is an SQL expression
 23728  // that limits the elements in T.F that are considered.
 23729  func nextCharFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* nextchar.c:201:13: */
 23730  	bp := tls.Alloc(116)
 23731  	defer tls.Free(116)
 23732  
 23733  	// var c nextCharContext at bp+80, 36
 23734  
 23735  	var zTable uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 23736  	var zField uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 23737  	var zWhere uintptr
 23738  	var zCollName uintptr
 23739  	var zWhereClause uintptr = uintptr(0)
 23740  	var zColl uintptr = uintptr(0)
 23741  	var zSql uintptr
 23742  	var rc int32
 23743  
 23744  	libc.Xmemset(tls, bp+80 /* &c */, 0, uint32(unsafe.Sizeof(nextCharContext{})))
 23745  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).Fdb = sqlite3.Xsqlite3_context_db_handle(tls, context)
 23746  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).FzPrefix = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23747  	(*nextCharContext)(unsafe.Pointer(bp + 80 /* &c */)).FnPrefix = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 23748  	if ((zTable == uintptr(0)) || (zField == uintptr(0))) || ((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FzPrefix == uintptr(0)) {
 23749  		return
 23750  	}
 23751  	if ((argc >= 4) &&
 23752  		((libc.AssignUintptr(&zWhere, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))))) != uintptr(0))) &&
 23753  		(int32(*(*uint8)(unsafe.Pointer(zWhere))) != 0) {
 23754  		zWhereClause = sqlite3.Xsqlite3_mprintf(tls, ts+5567 /* "AND (%s)" */, libc.VaList(bp, zWhere))
 23755  		if zWhereClause == uintptr(0) {
 23756  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23757  			return
 23758  		}
 23759  	} else {
 23760  		zWhereClause = ts + 489 /* "" */
 23761  	}
 23762  	if ((argc >= 5) &&
 23763  		((libc.AssignUintptr(&zCollName, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4))))) != uintptr(0))) &&
 23764  		(int32(*(*uint8)(unsafe.Pointer(zCollName))) != 0) {
 23765  		zColl = sqlite3.Xsqlite3_mprintf(tls, ts+5576 /* "collate \"%w\"" */, libc.VaList(bp+8, zCollName))
 23766  		if zColl == uintptr(0) {
 23767  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23768  			if *(*int8)(unsafe.Pointer(zWhereClause)) != 0 {
 23769  				sqlite3.Xsqlite3_free(tls, zWhereClause)
 23770  			}
 23771  			return
 23772  		}
 23773  	} else {
 23774  		zColl = ts + 489 /* "" */
 23775  	}
 23776  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 23777  
 23778  		// 1114111 == 0x10ffff
 23779  
 23780  		ts+5589, /* "SELECT %s FROM %..." */
 23781  		libc.VaList(bp+16, zField, zTable, zField, zColl, zField, zColl, zWhereClause, zColl))
 23782  	if *(*int8)(unsafe.Pointer(zWhereClause)) != 0 {
 23783  		sqlite3.Xsqlite3_free(tls, zWhereClause)
 23784  	}
 23785  	if *(*int8)(unsafe.Pointer(zColl)) != 0 {
 23786  		sqlite3.Xsqlite3_free(tls, zColl)
 23787  	}
 23788  	if zSql == uintptr(0) {
 23789  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23790  		return
 23791  	}
 23792  
 23793  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).Fdb, zSql, -1, (bp + 80 /* &c */ + 4 /* &.pStmt */), uintptr(0))
 23794  	sqlite3.Xsqlite3_free(tls, zSql)
 23795  	if rc != 0 {
 23796  		sqlite3.Xsqlite3_result_error(tls, context, sqlite3.Xsqlite3_errmsg(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).Fdb), -1)
 23797  		return
 23798  	}
 23799  	findNextChars(tls, bp+80 /* &c */)
 23800  	if (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FmallocFailed != 0 {
 23801  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23802  	} else {
 23803  		var pRes uintptr
 23804  		pRes = sqlite3.Xsqlite3_malloc64(tls, (uint64(((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FnUsed * 4) + 1)))
 23805  		if pRes == uintptr(0) {
 23806  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 23807  		} else {
 23808  			var i int32
 23809  			var n int32 = 0
 23810  			for i = 0; i < (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FnUsed; i++ {
 23811  				n = n + (writeUtf8(tls, (pRes + uintptr(n)), *(*uint32)(unsafe.Pointer((*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FaResult + uintptr(i)*4))))
 23812  			}
 23813  			*(*uint8)(unsafe.Pointer(pRes + uintptr(n))) = uint8(0)
 23814  			sqlite3.Xsqlite3_result_text(tls, context, pRes, n, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 23815  		}
 23816  	}
 23817  	sqlite3.Xsqlite3_finalize(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FpStmt)
 23818  	sqlite3.Xsqlite3_free(tls, (*nextCharContext)(unsafe.Pointer(bp+80 /* &c */)).FaResult)
 23819  }
 23820  
 23821  func sqlite3_nextchar_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* nextchar.c:292:5: */
 23822  	var rc int32 = SQLITE_OK
 23823  	_ = pApi
 23824  
 23825  	_ = pzErrMsg // Unused parameter
 23826  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 3,
 23827  		(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23828  		*(*uintptr)(unsafe.Pointer(&struct {
 23829  			f func(*libc.TLS, uintptr, int32, uintptr)
 23830  		}{nextCharFunc})), uintptr(0), uintptr(0))
 23831  	if rc == SQLITE_OK {
 23832  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 4,
 23833  			(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23834  			*(*uintptr)(unsafe.Pointer(&struct {
 23835  				f func(*libc.TLS, uintptr, int32, uintptr)
 23836  			}{nextCharFunc})), uintptr(0), uintptr(0))
 23837  	}
 23838  	if rc == SQLITE_OK {
 23839  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5697 /* "next_char" */, 5,
 23840  			(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 23841  			*(*uintptr)(unsafe.Pointer(&struct {
 23842  				f func(*libc.TLS, uintptr, int32, uintptr)
 23843  			}{nextCharFunc})), uintptr(0), uintptr(0))
 23844  	}
 23845  	return rc
 23846  }
 23847  
 23848  // Implementation note:
 23849  //
 23850  // Much of the tokenizer logic is copied out of the tokenize.c source file
 23851  // of SQLite.  That logic could be simplified for this particular application,
 23852  // but that would impose a risk of introducing subtle errors.  It is best to
 23853  // keep the code as close to the original as possible.
 23854  //
 23855  // The tokenize code is in sync with the SQLite core as of 2018-01-08.
 23856  // Any future changes to the core tokenizer might require corresponding
 23857  // adjustments to the tokenizer logic in this module.
 23858  
 23859  // Character classes for tokenizing
 23860  //
 23861  // In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented
 23862  // using a lookup table, whereas a switch() directly on c uses a binary search.
 23863  // The lookup table is much faster.  To maximize speed, and to ensure that
 23864  // a lookup table is used, all of the classes need to be small integers and
 23865  // all of them need to be used within the switch.
 23866  
 23867  var aiClass = [256]uint8{
 23868  	//         x0  x1  x2  x3  x4  x5  x6  x7  x8  x9  xa  xb  xc  xd  xe  xf
 23869  	/* 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),
 23870  	/* 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),
 23871  	/* 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),
 23872  	/* 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),
 23873  	/* 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),
 23874  	/* 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),
 23875  	/* 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),
 23876  	/* 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),
 23877  	/* 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),
 23878  	/* 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),
 23879  	/* 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),
 23880  	/* 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),
 23881  	/* 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),
 23882  	/* 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),
 23883  	/* 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),
 23884  	/* 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),
 23885  } /* normalize.c:106:28 */
 23886  
 23887  // An array to map all upper-case characters into their corresponding
 23888  // lower-case character.
 23889  //
 23890  // SQLite only considers US-ASCII (or EBCDIC) characters.  We do not
 23891  // handle case conversions for the UTF character set since the tables
 23892  // involved are nearly as big or bigger than SQLite itself.
 23893  var sqlite3UpperToLower = [256]uint8{
 23894  	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),
 23895  	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),
 23896  	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),
 23897  	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),
 23898  	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),
 23899  	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),
 23900  	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),
 23901  	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),
 23902  	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),
 23903  	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),
 23904  	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),
 23905  	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),
 23906  	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),
 23907  	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),
 23908  	uint8(252), uint8(253), uint8(254), uint8(255),
 23909  } /* normalize.c:133:28 */
 23910  
 23911  // The following 256 byte lookup table is used to support SQLites built-in
 23912  // equivalents to the following standard library functions:
 23913  //
 23914  //   isspace()                        0x01
 23915  //   isalpha()                        0x02
 23916  //   isdigit()                        0x04
 23917  //   isalnum()                        0x06
 23918  //   isxdigit()                       0x08
 23919  //   toupper()                        0x20
 23920  //   SQLite identifier character      0x40
 23921  //   Quote character                  0x80
 23922  //
 23923  // Bit 0x20 is set if the mapped character requires translation to upper
 23924  // case. i.e. if the character is a lower-case ASCII character.
 23925  // If x is a lower-case ASCII character, then its upper-case equivalent
 23926  // is (x - 0x20). Therefore toupper() can be implemented as:
 23927  //
 23928  //   (x & ~(map[x]&0x20))
 23929  //
 23930  // The equivalent of tolower() is implemented using the sqlite3UpperToLower[]
 23931  // array. tolower() is used more often than toupper() by SQLite.
 23932  //
 23933  // Bit 0x40 is set if the character is non-alphanumeric and can be used in an
 23934  // SQLite identifier.  Identifiers are alphanumerics, "_", "$", and any
 23935  // non-ASCII UTF character. Hence the test for whether or not a character is
 23936  // part of an identifier is 0x46.
 23937  var sqlite3CtypeMap = [256]uint8{
 23938  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 00..07    ........
 23939  	uint8(0x00), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x01), uint8(0x00), uint8(0x00), // 08..0f    ........
 23940  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 10..17    ........
 23941  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 18..1f    ........
 23942  	uint8(0x01), uint8(0x00), uint8(0x80), uint8(0x00), uint8(0x40), uint8(0x00), uint8(0x00), uint8(0x80), // 20..27     !"#$%&'
 23943  	uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 28..2f    ()*+,-./
 23944  	uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), uint8(0x0c), // 30..37    01234567
 23945  	uint8(0x0c), uint8(0x0c), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 38..3f    89:;<=>?
 23946  
 23947  	uint8(0x00), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x0a), uint8(0x02), // 40..47    @ABCDEFG
 23948  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 48..4f    HIJKLMNO
 23949  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x02), // 50..57    PQRSTUVW
 23950  	uint8(0x02), uint8(0x02), uint8(0x02), uint8(0x80), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x40), // 58..5f    XYZ[\]^_
 23951  	uint8(0x80), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x2a), uint8(0x22), // 60..67    `abcdefg
 23952  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 68..6f    hijklmno
 23953  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x22), // 70..77    pqrstuvw
 23954  	uint8(0x22), uint8(0x22), uint8(0x22), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), uint8(0x00), // 78..7f    xyz{|}~.
 23955  
 23956  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 80..87    ........
 23957  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 88..8f    ........
 23958  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 90..97    ........
 23959  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // 98..9f    ........
 23960  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a0..a7    ........
 23961  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // a8..af    ........
 23962  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b0..b7    ........
 23963  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // b8..bf    ........
 23964  
 23965  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c0..c7    ........
 23966  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // c8..cf    ........
 23967  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d0..d7    ........
 23968  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // d8..df    ........
 23969  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e0..e7    ........
 23970  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // e8..ef    ........
 23971  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f0..f7    ........
 23972  	uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), uint8(0x40), // f8..ff    ........
 23973  } /* normalize.c:179:28 */
 23974  
 23975  // If X is a character that can be used in an identifier then
 23976  // IdChar(X) will be true.  Otherwise it is false.
 23977  //
 23978  // For ASCII, any character with the high-order bit set is
 23979  // allowed in an identifier.  For 7-bit characters,
 23980  // sqlite3IsIdChar[X] must be 1.
 23981  //
 23982  // For EBCDIC, the rules are more complex but have the same
 23983  // end result.
 23984  //
 23985  // Ticket #1066.  the SQL standard does not allow '$' in the
 23986  // middle of identifiers.  But many SQL implementations do.
 23987  // SQLite will allow '$' in identifiers for compatibility.
 23988  // But the feature is undocumented.
 23989  
 23990  // Ignore testcase() macros
 23991  
 23992  // Token values
 23993  
 23994  // Disable nuisence warnings about case fall-through
 23995  
 23996  // Return the length (in bytes) of the token that begins at z[0].
 23997  // Store the token type in *tokenType before returning.
 23998  func sqlite3GetToken(tls *libc.TLS, z uintptr, tokenType uintptr) int32 { /* normalize.c:300:12: */
 23999  	var i int32
 24000  	var c int32
 24001  	switch int32(aiClass[*(*uint8)(unsafe.Pointer(z))]) { // Switch on the character-class of the first byte
 24002  	// of the token. See the comment on the CC_ defines
 24003  	// above.
 24004  	case CC_SPACE:
 24005  		{
 24006  			for i = 1; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x01) != 0; i++ {
 24007  			}
 24008  			*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 24009  			return i
 24010  
 24011  		}
 24012  	case CC_MINUS:
 24013  		{
 24014  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '-' {
 24015  				for i = 2; ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && (c != '\n'); i++ {
 24016  				}
 24017  				*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 24018  				return i
 24019  			}
 24020  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24021  			return 1
 24022  
 24023  		}
 24024  	case CC_LP:
 24025  		{
 24026  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24027  			return 1
 24028  
 24029  		}
 24030  	case CC_RP:
 24031  		{
 24032  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24033  			return 1
 24034  
 24035  		}
 24036  	case CC_SEMI:
 24037  		{
 24038  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24039  			return 1
 24040  
 24041  		}
 24042  	case CC_PLUS:
 24043  		{
 24044  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24045  			return 1
 24046  
 24047  		}
 24048  	case CC_STAR:
 24049  		{
 24050  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24051  			return 1
 24052  
 24053  		}
 24054  	case CC_SLASH:
 24055  		{
 24056  			if (int32(*(*uint8)(unsafe.Pointer(z + 1))) != '*') || (int32(*(*uint8)(unsafe.Pointer(z + 2))) == 0) {
 24057  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24058  				return 1
 24059  			}
 24060  			i = 3
 24061  			c = int32(*(*uint8)(unsafe.Pointer(z + 2)))
 24062  			for ; ((c != '*') || (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '/')) && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ {
 24063  			}
 24064  			if c != 0 {
 24065  				i++
 24066  			}
 24067  			*(*int32)(unsafe.Pointer(tokenType)) = TK_SPACE
 24068  			return i
 24069  
 24070  		}
 24071  	case CC_PERCENT:
 24072  		{
 24073  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24074  			return 1
 24075  
 24076  		}
 24077  	case CC_EQ:
 24078  		{
 24079  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24080  			return (1 + (libc.Bool32(int32(*(*uint8)(unsafe.Pointer(z + 1))) == '=')))
 24081  
 24082  		}
 24083  	case CC_LT:
 24084  		{
 24085  			if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' {
 24086  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24087  				return 2
 24088  			} else if c == '>' {
 24089  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24090  				return 2
 24091  			} else if c == '<' {
 24092  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24093  				return 2
 24094  			} else {
 24095  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24096  				return 1
 24097  			}
 24098  
 24099  		}
 24100  		fallthrough
 24101  	case CC_GT:
 24102  		{
 24103  			if (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + 1))))) == '=' {
 24104  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24105  				return 2
 24106  			} else if c == '>' {
 24107  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24108  				return 2
 24109  			} else {
 24110  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24111  				return 1
 24112  			}
 24113  
 24114  		}
 24115  		fallthrough
 24116  	case CC_BANG:
 24117  		{
 24118  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '=' {
 24119  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24120  				return 1
 24121  			} else {
 24122  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24123  				return 2
 24124  			}
 24125  
 24126  		}
 24127  		fallthrough
 24128  	case CC_PIPE:
 24129  		{
 24130  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) != '|' {
 24131  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24132  				return 1
 24133  			} else {
 24134  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24135  				return 2
 24136  			}
 24137  
 24138  		}
 24139  		fallthrough
 24140  	case CC_COMMA:
 24141  		{
 24142  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24143  			return 1
 24144  
 24145  		}
 24146  	case CC_AND:
 24147  		{
 24148  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24149  			return 1
 24150  
 24151  		}
 24152  	case CC_TILDA:
 24153  		{
 24154  			*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24155  			return 1
 24156  
 24157  		}
 24158  	case CC_QUOTE:
 24159  		{
 24160  			var delim int32 = int32(*(*uint8)(unsafe.Pointer(z)))
 24161  
 24162  			for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ {
 24163  				if c == delim {
 24164  					if int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == delim {
 24165  						i++
 24166  					} else {
 24167  						break
 24168  					}
 24169  				}
 24170  			}
 24171  			if c == '\'' {
 24172  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24173  				return (i + 1)
 24174  			} else if c != 0 {
 24175  				*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 24176  				return (i + 1)
 24177  			} else {
 24178  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24179  				return i
 24180  			}
 24181  
 24182  		}
 24183  		fallthrough
 24184  	case CC_DOT:
 24185  		{
 24186  			if !((int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + 1))]) & 0x04) != 0) {
 24187  				*(*int32)(unsafe.Pointer(tokenType)) = TK_PUNCT
 24188  				return 1
 24189  			}
 24190  			// If the next character is a digit, this is a floating point
 24191  			// number that begins with ".".  Fall thru into the next case
 24192  			/* no break */
 24193  
 24194  		}
 24195  		fallthrough
 24196  	case CC_DIGIT:
 24197  		{
 24198  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24199  			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) {
 24200  				for i = 3; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ {
 24201  				}
 24202  				return i
 24203  			}
 24204  			for i = 0; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ {
 24205  			}
 24206  			if int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) == '.' {
 24207  				i++
 24208  				for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 {
 24209  					i++
 24210  				}
 24211  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24212  			}
 24213  			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) ||
 24214  				(((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))) {
 24215  				i = i + (2)
 24216  				for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0 {
 24217  					i++
 24218  				}
 24219  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24220  			}
 24221  			for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 24222  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24223  				i++
 24224  			}
 24225  			return i
 24226  
 24227  		}
 24228  	case CC_QUOTE2:
 24229  		{
 24230  			i = 1
 24231  			c = int32(*(*uint8)(unsafe.Pointer(z)))
 24232  			for ; (c != ']') && ((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0); i++ {
 24233  			}
 24234  			*(*int32)(unsafe.Pointer(tokenType)) = func() int32 {
 24235  				if c == ']' {
 24236  					return TK_NAME
 24237  				}
 24238  				return TK_ERROR
 24239  			}()
 24240  			return i
 24241  
 24242  		}
 24243  	case CC_VARNUM:
 24244  		{
 24245  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24246  			for i = 1; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x04) != 0; i++ {
 24247  			}
 24248  			return i
 24249  
 24250  		}
 24251  	case CC_DOLLAR:
 24252  		fallthrough
 24253  	case CC_VARALPHA:
 24254  		{
 24255  			var n int32 = 0
 24256  
 24257  			*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24258  			for i = 1; (libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0; i++ {
 24259  				if (int32(sqlite3CtypeMap[uint8(c)]) & 0x46) != 0 {
 24260  					n++
 24261  				} else if (c == '(') && (n > 0) {
 24262  					for ok := true; ok; ok = ((((libc.AssignInt32(&c, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))))) != 0) && !((int32(sqlite3CtypeMap[uint8(c)]) & 0x01) != 0)) && (c != ')')) {
 24263  						i++
 24264  					}
 24265  					if c == ')' {
 24266  						i++
 24267  					} else {
 24268  						*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24269  					}
 24270  					break
 24271  				} else if (c == ':') && (int32(*(*uint8)(unsafe.Pointer(z + uintptr((i + 1))))) == ':') {
 24272  					i++
 24273  				} else {
 24274  					break
 24275  				}
 24276  			}
 24277  			if n == 0 {
 24278  				*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24279  			}
 24280  			return i
 24281  
 24282  		}
 24283  	case CC_KYWD:
 24284  		{
 24285  			for i = 1; int32(aiClass[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) <= CC_KYWD; i++ {
 24286  			}
 24287  			if (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 24288  				// This token started out using characters that can appear in keywords,
 24289  				// but z[i] is a character not allowed within keywords, so this must
 24290  				// be an identifier instead
 24291  				i++
 24292  				break
 24293  			}
 24294  			*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 24295  			return i
 24296  
 24297  		}
 24298  	case CC_X:
 24299  		{
 24300  
 24301  			if int32(*(*uint8)(unsafe.Pointer(z + 1))) == '\'' {
 24302  				*(*int32)(unsafe.Pointer(tokenType)) = TK_LITERAL
 24303  				for i = 2; (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x08) != 0; i++ {
 24304  				}
 24305  				if (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') || ((i % 2) != 0) {
 24306  					*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24307  					for (*(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0) && (int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) != '\'') {
 24308  						i++
 24309  					}
 24310  				}
 24311  				if *(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0 {
 24312  					i++
 24313  				}
 24314  				return i
 24315  			}
 24316  			// If it is not a BLOB literal, then it must be an ID, since no
 24317  			// SQL keywords start with the letter 'x'.  Fall through
 24318  			/* no break */
 24319  
 24320  		}
 24321  		fallthrough
 24322  	case CC_ID:
 24323  		{
 24324  			i = 1
 24325  			break
 24326  
 24327  		}
 24328  	default:
 24329  		{
 24330  			*(*int32)(unsafe.Pointer(tokenType)) = TK_ERROR
 24331  			return 1
 24332  
 24333  		}
 24334  	}
 24335  	for (int32(sqlite3CtypeMap[*(*uint8)(unsafe.Pointer(z + uintptr(i)))]) & 0x46) != 0 {
 24336  		i++
 24337  	}
 24338  	*(*int32)(unsafe.Pointer(tokenType)) = TK_NAME
 24339  	return i
 24340  }
 24341  
 24342  func sqlite3_normalize(tls *libc.TLS, zSql uintptr) uintptr { /* normalize.c:555:6: */
 24343  	bp := tls.Alloc(4)
 24344  	defer tls.Free(4)
 24345  
 24346  	var z uintptr          // The output string
 24347  	var nZ sqlite3_int64   // Size of the output string in bytes
 24348  	var nSql sqlite3_int64 // Size of the input string in bytes
 24349  	var i int32            // Next character to read from zSql[]
 24350  	var j int32            // Next slot to fill in on z[]
 24351  	// var tokenType int32 at bp, 4
 24352  	// Type of the next token
 24353  	var n int32 // Size of the next token
 24354  	var k int32 // Loop counter
 24355  
 24356  	nSql = sqlite3_int64(libc.Xstrlen(tls, zSql))
 24357  	nZ = nSql
 24358  	z = sqlite3.Xsqlite3_malloc64(tls, (uint64(nZ + int64(2))))
 24359  	if z == uintptr(0) {
 24360  		return uintptr(0)
 24361  	}
 24362  	for i = libc.AssignInt32(&j, 0); *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0; i = i + (n) {
 24363  		n = sqlite3GetToken(tls, (zSql + uintptr(i)), bp /* &tokenType */)
 24364  		switch *(*int32)(unsafe.Pointer(bp /* tokenType */)) {
 24365  		case TK_SPACE:
 24366  			{
 24367  				break
 24368  
 24369  			}
 24370  		case TK_ERROR:
 24371  			{
 24372  				sqlite3.Xsqlite3_free(tls, z)
 24373  				return uintptr(0)
 24374  
 24375  			}
 24376  		case TK_LITERAL:
 24377  			{
 24378  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 24379  				break
 24380  
 24381  			}
 24382  		case TK_PUNCT:
 24383  			fallthrough
 24384  		case TK_NAME:
 24385  			{
 24386  				if (n == 4) && (sqlite3.Xsqlite3_strnicmp(tls, (zSql+uintptr(i)), ts+5707 /* "NULL" */, 4) == 0) {
 24387  					if (((j >= 3) && (libc.Xstrncmp(tls, ((z+uintptr(j))-uintptr(2)), ts+5712 /* "is" */, uint32(2)) == 0)) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((j - 3)))))]) & 0x46) != 0)) ||
 24388  						(((j >= 4) && (libc.Xstrncmp(tls, ((z+uintptr(j))-uintptr(3)), ts+5715 /* "not" */, uint32(3)) == 0)) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z + uintptr((j - 4)))))]) & 0x46) != 0)) {
 24389  						// NULL is a keyword in this case, not a literal value
 24390  					} else {
 24391  						// Here the NULL is a literal value
 24392  						*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 24393  						break
 24394  					}
 24395  				}
 24396  				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) {
 24397  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(' ')
 24398  				}
 24399  				for k = 0; k < n; k++ {
 24400  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(sqlite3UpperToLower[uint8(*(*int8)(unsafe.Pointer(zSql + uintptr((i + k)))))])
 24401  				}
 24402  				break
 24403  
 24404  			}
 24405  		}
 24406  	}
 24407  	for (j > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j - 1))))) == ' ') {
 24408  		j--
 24409  	}
 24410  	if (j > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((j - 1))))) != ';') {
 24411  		*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(';')
 24412  	}
 24413  	*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 24414  
 24415  	// Make a second pass converting "in(...)" where the "..." is not a
 24416  	// SELECT statement into "in(?,?,?)"
 24417  	for i = 0; i < j; i = n {
 24418  		var zIn uintptr = libc.Xstrstr(tls, (z + uintptr(i)), ts+5719 /* "in(" */)
 24419  		var nParen int32
 24420  		if zIn == uintptr(0) {
 24421  			break
 24422  		}
 24423  		n = (((int32(zIn) - int32(z)) / 1) + 3) // Index of first char past "in("
 24424  		if (n != 0) && ((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + libc.UintptrFromInt32(-1))))]) & 0x46) != 0) {
 24425  			continue
 24426  		}
 24427  		if (libc.Xstrncmp(tls, zIn, ts+5723 /* "in(select" */, uint32(9)) == 0) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + 9)))]) & 0x46) != 0) {
 24428  			continue
 24429  		}
 24430  		if (libc.Xstrncmp(tls, zIn, ts+5733 /* "in(with" */, uint32(7)) == 0) && !((int32(sqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(zIn + 7)))]) & 0x46) != 0) {
 24431  			continue
 24432  		}
 24433  		nParen = 1
 24434  		k = 0
 24435  		for ; *(*int8)(unsafe.Pointer(z + uintptr((n + k)))) != 0; k++ {
 24436  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((n + k))))) == '(' {
 24437  				nParen++
 24438  			}
 24439  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((n + k))))) == ')' {
 24440  				nParen--
 24441  				if nParen == 0 {
 24442  					break
 24443  				}
 24444  			}
 24445  		}
 24446  		// k is the number of bytes in the "..." within "in(...)"
 24447  		if k < 5 {
 24448  			z = sqlite3.Xsqlite3_realloc64(tls, z, (uint64((j + (5 - k)) + 1)))
 24449  			if z == uintptr(0) {
 24450  				return uintptr(0)
 24451  			}
 24452  			libc.Xmemmove(tls, ((z + uintptr(n)) + uintptr(5)), ((z + uintptr(n)) + uintptr(k)), (uint32(j - (n + k))))
 24453  		} else if k > 5 {
 24454  			libc.Xmemmove(tls, ((z + uintptr(n)) + uintptr(5)), ((z + uintptr(n)) + uintptr(k)), (uint32(j - (n + k))))
 24455  		}
 24456  		j = ((j - k) + 5)
 24457  		*(*int8)(unsafe.Pointer(z + uintptr(j))) = int8(0)
 24458  		libc.Xmemcpy(tls, (z + uintptr(n)), ts+5741 /* "?,?,?" */, uint32(5))
 24459  	}
 24460  	return z
 24461  }
 24462  
 24463  // For testing purposes, or to build a stand-alone SQL normalizer program,
 24464  // compile this one source file with the -DSQLITE_NORMALIZE_CLI and link
 24465  // it against any SQLite library.  The resulting command-line program will
 24466  // run sqlite3_normalize() over the text of all files named on the command-
 24467  // line and show the result on standard output.
 24468  
 24469  // Floating-point inline functions for stdlib.h.
 24470  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 24471  //    This file is part of the GNU C Library.
 24472  //
 24473  //    The GNU C Library is free software; you can redistribute it and/or
 24474  //    modify it under the terms of the GNU Lesser General Public
 24475  //    License as published by the Free Software Foundation; either
 24476  //    version 2.1 of the License, or (at your option) any later version.
 24477  //
 24478  //    The GNU C Library is distributed in the hope that it will be useful,
 24479  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24480  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24481  //    Lesser General Public License for more details.
 24482  //
 24483  //    You should have received a copy of the GNU Lesser General Public
 24484  //    License along with the GNU C Library; if not, see
 24485  //    <http://www.gnu.org/licenses/>.
 24486  
 24487  // Define some macros helping to catch buffer overflows.
 24488  
 24489  // The following object is the session context for a single percentile()
 24490  // function.  We have to remember all input Y values until the very end.
 24491  // Those values are accumulated in the Percentile.a[] array.
 24492  type Percentile1 = struct {
 24493  	FnAlloc uint32
 24494  	FnUsed  uint32
 24495  	FrPct   float64
 24496  	Fa      uintptr
 24497  	_       [4]byte
 24498  } /* percentile.c:71:9 */
 24499  
 24500  // Floating-point inline functions for stdlib.h.
 24501  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 24502  //    This file is part of the GNU C Library.
 24503  //
 24504  //    The GNU C Library is free software; you can redistribute it and/or
 24505  //    modify it under the terms of the GNU Lesser General Public
 24506  //    License as published by the Free Software Foundation; either
 24507  //    version 2.1 of the License, or (at your option) any later version.
 24508  //
 24509  //    The GNU C Library is distributed in the hope that it will be useful,
 24510  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24511  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24512  //    Lesser General Public License for more details.
 24513  //
 24514  //    You should have received a copy of the GNU Lesser General Public
 24515  //    License along with the GNU C Library; if not, see
 24516  //    <http://www.gnu.org/licenses/>.
 24517  
 24518  // Define some macros helping to catch buffer overflows.
 24519  
 24520  // The following object is the session context for a single percentile()
 24521  // function.  We have to remember all input Y values until the very end.
 24522  // Those values are accumulated in the Percentile.a[] array.
 24523  type Percentile = Percentile1 /* percentile.c:71:27 */
 24524  
 24525  // Return TRUE if the input floating-point number is an infinity.
 24526  func isInfinity(tls *libc.TLS, r float64) int32 { /* percentile.c:82:12: */
 24527  	bp := tls.Alloc(16)
 24528  	defer tls.Free(16)
 24529  	*(*float64)(unsafe.Pointer(bp + 8)) = r
 24530  
 24531  	// var u sqlite3_uint64 at bp, 8
 24532  
 24533  	libc.Xmemcpy(tls, bp /* &u */, bp+8 /* &r */, uint32(unsafe.Sizeof(sqlite3_uint64(0))))
 24534  	return (libc.Bool32(((*(*sqlite3_uint64)(unsafe.Pointer(bp /* u */)) >> 52) & uint64(0x7ff)) == uint64(0x7ff)))
 24535  }
 24536  
 24537  // Return TRUE if two doubles differ by 0.001 or less
 24538  func sameValue(tls *libc.TLS, a float64, b float64) int32 { /* percentile.c:92:12: */
 24539  	a = a - (b)
 24540  	return (libc.Bool32((a >= -0.001) && (a <= 0.001)))
 24541  }
 24542  
 24543  // The "step" function for percentile(Y,P) is called once for each
 24544  // input row.
 24545  func percentStep(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* percentile.c:101:13: */
 24546  	var p uintptr
 24547  	var rPct float64
 24548  	var eType int32
 24549  	var y float64
 24550  
 24551  	// Requirement 3:  P must be a number between 0 and 100
 24552  	eType = sqlite3.Xsqlite3_value_numeric_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 24553  	rPct = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 24554  	if (((eType != SQLITE_INTEGER) && (eType != SQLITE_FLOAT)) ||
 24555  		(rPct < 0.0)) || (rPct > 100.0) {
 24556  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 24557  			ts+5747 /* "2nd argument to ..." */, -1)
 24558  		return
 24559  	}
 24560  
 24561  	// Allocate the session context.
 24562  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(Percentile{})))
 24563  	if p == uintptr(0) {
 24564  		return
 24565  	}
 24566  
 24567  	// Remember the P value.  Throw an error if the P value is different
 24568  	// from any prior row, per Requirement (2).
 24569  	if (*Percentile)(unsafe.Pointer(p)).FrPct == 0.0 {
 24570  		(*Percentile)(unsafe.Pointer(p)).FrPct = (rPct + 1.0)
 24571  	} else if !(sameValue(tls, (*Percentile)(unsafe.Pointer(p)).FrPct, (rPct+1.0)) != 0) {
 24572  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 24573  			ts+5814 /* "2nd argument to ..." */, -1)
 24574  		return
 24575  	}
 24576  
 24577  	// Ignore rows for which Y is NULL
 24578  	eType = sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv)))
 24579  	if eType == SQLITE_NULL {
 24580  		return
 24581  	}
 24582  
 24583  	// If not NULL, then Y must be numeric.  Otherwise throw an error.
 24584  	// Requirement 4
 24585  	if (eType != SQLITE_INTEGER) && (eType != SQLITE_FLOAT) {
 24586  		sqlite3.Xsqlite3_result_error(tls, pCtx,
 24587  			ts+5878 /* "1st argument to ..." */, -1)
 24588  		return
 24589  	}
 24590  
 24591  	// Throw an error if the Y value is infinity or NaN
 24592  	y = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 24593  	if isInfinity(tls, y) != 0 {
 24594  		sqlite3.Xsqlite3_result_error(tls, pCtx, ts+5922 /* "Inf input to per..." */, -1)
 24595  		return
 24596  	}
 24597  
 24598  	// Allocate and store the Y
 24599  	if (*Percentile)(unsafe.Pointer(p)).FnUsed >= (*Percentile)(unsafe.Pointer(p)).FnAlloc {
 24600  		var n uint32 = (((*Percentile)(unsafe.Pointer(p)).FnAlloc * uint32(2)) + uint32(250))
 24601  		var a uintptr = sqlite3.Xsqlite3_realloc64(tls, (*Percentile)(unsafe.Pointer(p)).Fa, (uint64(uint32(unsafe.Sizeof(float64(0))) * n)))
 24602  		if a == uintptr(0) {
 24603  			sqlite3.Xsqlite3_free(tls, (*Percentile)(unsafe.Pointer(p)).Fa)
 24604  			libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Percentile{})))
 24605  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 24606  			return
 24607  		}
 24608  		(*Percentile)(unsafe.Pointer(p)).FnAlloc = n
 24609  		(*Percentile)(unsafe.Pointer(p)).Fa = a
 24610  	}
 24611  	*(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(libc.PostIncUint32(&(*Percentile)(unsafe.Pointer(p)).FnUsed, 1))*8)) = y
 24612  }
 24613  
 24614  // Compare to doubles for sorting using qsort()
 24615  func doubleCmp(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* percentile.c:170:25: */
 24616  	var a float64 = *(*float64)(unsafe.Pointer(pA))
 24617  	var b float64 = *(*float64)(unsafe.Pointer(pB))
 24618  	if a == b {
 24619  		return 0
 24620  	}
 24621  	if a < b {
 24622  		return -1
 24623  	}
 24624  	return +1
 24625  }
 24626  
 24627  // Called to compute the final output of percentile() and to clean
 24628  // up all allocated memory.
 24629  func percentFinal(tls *libc.TLS, pCtx uintptr) { /* percentile.c:182:13: */
 24630  	var p uintptr
 24631  	var i1 uint32
 24632  	var i2 uint32
 24633  	var v1 float64
 24634  	var v2 float64
 24635  	var ix float64
 24636  	var vx float64
 24637  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, 0)
 24638  	if p == uintptr(0) {
 24639  		return
 24640  	}
 24641  	if (*Percentile)(unsafe.Pointer(p)).Fa == uintptr(0) {
 24642  		return
 24643  	}
 24644  	if (*Percentile)(unsafe.Pointer(p)).FnUsed != 0 {
 24645  		libc.Xqsort(tls, (*Percentile)(unsafe.Pointer(p)).Fa, (*Percentile)(unsafe.Pointer(p)).FnUsed, uint32(unsafe.Sizeof(float64(0))), *(*uintptr)(unsafe.Pointer(&struct {
 24646  			f func(*libc.TLS, uintptr, uintptr) int32
 24647  		}{doubleCmp})))
 24648  		ix = ((((*Percentile)(unsafe.Pointer(p)).FrPct - 1.0) * (float64((*Percentile)(unsafe.Pointer(p)).FnUsed - uint32(1)))) * 0.01)
 24649  		i1 = uint32(ix)
 24650  		if (ix == float64(i1)) || (i1 == ((*Percentile)(unsafe.Pointer(p)).FnUsed - uint32(1))) {
 24651  			i2 = i1
 24652  		} else {
 24653  			i2 = (i1 + uint32(1))
 24654  		}
 24655  		v1 = *(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(i1)*8))
 24656  		v2 = *(*float64)(unsafe.Pointer((*Percentile)(unsafe.Pointer(p)).Fa + uintptr(i2)*8))
 24657  		vx = (v1 + ((v2 - v1) * (ix - float64(i1))))
 24658  		sqlite3.Xsqlite3_result_double(tls, pCtx, vx)
 24659  	}
 24660  	sqlite3.Xsqlite3_free(tls, (*Percentile)(unsafe.Pointer(p)).Fa)
 24661  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Percentile{})))
 24662  }
 24663  
 24664  func sqlite3_percentile_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* percentile.c:208:5: */
 24665  	var rc int32 = SQLITE_OK
 24666  	_ = pApi
 24667  
 24668  	_ = pzErrMsg // Unused parameter
 24669  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+5948 /* "percentile" */, 2,
 24670  		(SQLITE_UTF8 | SQLITE_INNOCUOUS), uintptr(0),
 24671  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 24672  			f func(*libc.TLS, uintptr, int32, uintptr)
 24673  		}{percentStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{percentFinal})))
 24674  	return rc
 24675  }
 24676  
 24677  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 24678  //    This file is part of the GNU C Library.
 24679  //
 24680  //    The GNU C Library is free software; you can redistribute it and/or
 24681  //    modify it under the terms of the GNU Lesser General Public
 24682  //    License as published by the Free Software Foundation; either
 24683  //    version 2.1 of the License, or (at your option) any later version.
 24684  //
 24685  //    The GNU C Library is distributed in the hope that it will be useful,
 24686  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24687  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24688  //    Lesser General Public License for more details.
 24689  //
 24690  //    You should have received a copy of the GNU Lesser General Public
 24691  //    License along with the GNU C Library; if not, see
 24692  //    <http://www.gnu.org/licenses/>.
 24693  
 24694  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 24695  
 24696  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 24697  //    This file is part of the GNU C Library.
 24698  //
 24699  //    The GNU C Library is free software; you can redistribute it and/or
 24700  //    modify it under the terms of the GNU Lesser General Public
 24701  //    License as published by the Free Software Foundation; either
 24702  //    version 2.1 of the License, or (at your option) any later version.
 24703  //
 24704  //    The GNU C Library is distributed in the hope that it will be useful,
 24705  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24706  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24707  //    Lesser General Public License for more details.
 24708  //
 24709  //    You should have received a copy of the GNU Lesser General Public
 24710  //    License along with the GNU C Library; if not, see
 24711  //    <http://www.gnu.org/licenses/>.
 24712  
 24713  // void assert (int expression);
 24714  //
 24715  //    If NDEBUG is defined, do nothing.
 24716  //    If not, and EXPRESSION is zero, print an error message and abort.
 24717  
 24718  // void assert_perror (int errnum);
 24719  //
 24720  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 24721  //    error message with the error text for ERRNUM and abort.
 24722  //    (This is a GNU extension.)
 24723  
 24724  // prefixes_vtab is a subclass of sqlite3_vtab which is
 24725  // underlying representation of the virtual table
 24726  type prefixes_vtab1 = struct{ Fbase sqlite3_vtab } /* prefixes.c:33:9 */
 24727  
 24728  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 24729  //    This file is part of the GNU C Library.
 24730  //
 24731  //    The GNU C Library is free software; you can redistribute it and/or
 24732  //    modify it under the terms of the GNU Lesser General Public
 24733  //    License as published by the Free Software Foundation; either
 24734  //    version 2.1 of the License, or (at your option) any later version.
 24735  //
 24736  //    The GNU C Library is distributed in the hope that it will be useful,
 24737  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24738  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24739  //    Lesser General Public License for more details.
 24740  //
 24741  //    You should have received a copy of the GNU Lesser General Public
 24742  //    License along with the GNU C Library; if not, see
 24743  //    <http://www.gnu.org/licenses/>.
 24744  
 24745  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 24746  
 24747  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 24748  //    This file is part of the GNU C Library.
 24749  //
 24750  //    The GNU C Library is free software; you can redistribute it and/or
 24751  //    modify it under the terms of the GNU Lesser General Public
 24752  //    License as published by the Free Software Foundation; either
 24753  //    version 2.1 of the License, or (at your option) any later version.
 24754  //
 24755  //    The GNU C Library is distributed in the hope that it will be useful,
 24756  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 24757  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 24758  //    Lesser General Public License for more details.
 24759  //
 24760  //    You should have received a copy of the GNU Lesser General Public
 24761  //    License along with the GNU C Library; if not, see
 24762  //    <http://www.gnu.org/licenses/>.
 24763  
 24764  // void assert (int expression);
 24765  //
 24766  //    If NDEBUG is defined, do nothing.
 24767  //    If not, and EXPRESSION is zero, print an error message and abort.
 24768  
 24769  // void assert_perror (int errnum);
 24770  //
 24771  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 24772  //    error message with the error text for ERRNUM and abort.
 24773  //    (This is a GNU extension.)
 24774  
 24775  // prefixes_vtab is a subclass of sqlite3_vtab which is
 24776  // underlying representation of the virtual table
 24777  type prefixes_vtab = prefixes_vtab1 /* prefixes.c:33:30 */
 24778  
 24779  // prefixes_cursor is a subclass of sqlite3_vtab_cursor which will
 24780  // serve as the underlying representation of a cursor that scans
 24781  // over rows of the result
 24782  type prefixes_cursor1 = struct {
 24783  	Fbase   sqlite3_vtab_cursor
 24784  	_       [4]byte
 24785  	FiRowid sqlite3_int64
 24786  	FzStr   uintptr
 24787  	FnStr   int32
 24788  } /* prefixes.c:43:9 */
 24789  
 24790  // prefixes_cursor is a subclass of sqlite3_vtab_cursor which will
 24791  // serve as the underlying representation of a cursor that scans
 24792  // over rows of the result
 24793  type prefixes_cursor = prefixes_cursor1 /* prefixes.c:43:32 */
 24794  
 24795  // The prefixesConnect() method is invoked to create a new
 24796  // template virtual table.
 24797  //
 24798  // Think of this routine as the constructor for prefixes_vtab objects.
 24799  //
 24800  // All this routine needs to do is:
 24801  //
 24802  //    (1) Allocate the prefixes_vtab object and initialize all fields.
 24803  //
 24804  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 24805  //        result set of queries against the virtual table will look like.
 24806  func prefixesConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* prefixes.c:64:12: */
 24807  	var pNew uintptr
 24808  	var rc int32
 24809  
 24810  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 24811  		ts+5959 /* "CREATE TABLE pre..." */)
 24812  	if rc == SQLITE_OK {
 24813  		pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(prefixes_vtab{})))
 24814  		*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 24815  		if pNew == uintptr(0) {
 24816  			return SQLITE_NOMEM
 24817  		}
 24818  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(prefixes_vtab{})))
 24819  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 24820  	}
 24821  	return rc
 24822  }
 24823  
 24824  // This method is the destructor for prefixes_vtab objects.
 24825  func prefixesDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* prefixes.c:90:12: */
 24826  	var p uintptr = pVtab
 24827  	sqlite3.Xsqlite3_free(tls, p)
 24828  	return SQLITE_OK
 24829  }
 24830  
 24831  // Constructor for a new prefixes_cursor object.
 24832  func prefixesOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* prefixes.c:99:12: */
 24833  	var pCur uintptr
 24834  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(prefixes_cursor{})))
 24835  	if pCur == uintptr(0) {
 24836  		return SQLITE_NOMEM
 24837  	}
 24838  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(prefixes_cursor{})))
 24839  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 24840  	return SQLITE_OK
 24841  }
 24842  
 24843  // Destructor for a prefixes_cursor.
 24844  func prefixesClose(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:111:12: */
 24845  	var pCur uintptr = cur
 24846  	sqlite3.Xsqlite3_free(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr)
 24847  	sqlite3.Xsqlite3_free(tls, pCur)
 24848  	return SQLITE_OK
 24849  }
 24850  
 24851  // Advance a prefixes_cursor to its next row of output.
 24852  func prefixesNext(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:122:12: */
 24853  	var pCur uintptr = cur
 24854  	(*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid++
 24855  	return SQLITE_OK
 24856  }
 24857  
 24858  // Return values of columns for the row at which the prefixes_cursor
 24859  // is currently pointing.
 24860  func prefixesColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* prefixes.c:132:12: */
 24861  	var pCur uintptr = cur
 24862  	switch i {
 24863  	case 0:
 24864  		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)),
 24865  			uintptr(0))
 24866  		break
 24867  	default:
 24868  		sqlite3.Xsqlite3_result_text(tls, ctx, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr, (*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr, uintptr(0))
 24869  		break
 24870  	}
 24871  	return SQLITE_OK
 24872  }
 24873  
 24874  // Return the rowid for the current row.  In this implementation, the
 24875  // rowid is the same as the output value.
 24876  func prefixesRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* prefixes.c:154:12: */
 24877  	var pCur uintptr = cur
 24878  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid
 24879  	return SQLITE_OK
 24880  }
 24881  
 24882  // Return TRUE if the cursor has been moved off of the last
 24883  // row of output.
 24884  func prefixesEof(tls *libc.TLS, cur uintptr) int32 { /* prefixes.c:164:12: */
 24885  	var pCur uintptr = cur
 24886  	return (libc.Bool32((*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid > sqlite3_int64((*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr)))
 24887  }
 24888  
 24889  // This method is called to "rewind" the prefixes_cursor object back
 24890  // to the first row of output.  This method is always called at least
 24891  // once prior to any call to prefixesColumn() or prefixesRowid() or
 24892  // prefixesEof().
 24893  func prefixesFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* prefixes.c:175:12: */
 24894  	bp := tls.Alloc(8)
 24895  	defer tls.Free(8)
 24896  
 24897  	var pCur uintptr = pVtabCursor
 24898  	sqlite3.Xsqlite3_free(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr)
 24899  	if argc > 0 {
 24900  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 24901  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr = func() int32 {
 24902  			if (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr != 0 {
 24903  				return int32(libc.Xstrlen(tls, (*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr))
 24904  			}
 24905  			return 0
 24906  		}()
 24907  	} else {
 24908  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FzStr = uintptr(0)
 24909  		(*prefixes_cursor)(unsafe.Pointer(pCur)).FnStr = 0
 24910  	}
 24911  	(*prefixes_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(0)
 24912  	return SQLITE_OK
 24913  }
 24914  
 24915  // SQLite will invoke this method one or more times while planning a query
 24916  // that uses the virtual table.  This routine needs to create
 24917  // a query plan for each invocation and compute an estimated cost for that
 24918  // plan.
 24919  func prefixesBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* prefixes.c:199:12: */
 24920  	// Search for a usable equality constraint against column 1
 24921  	// (original_string) and use it if at all possible
 24922  	var i int32
 24923  	var p uintptr
 24924  
 24925  	i = 0
 24926  	p = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 24927  __1:
 24928  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 24929  		goto __3
 24930  	}
 24931  	{
 24932  		if (*sqlite3_index_constraint)(unsafe.Pointer(p)).FiColumn != 1 {
 24933  			goto __2
 24934  		}
 24935  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) != SQLITE_INDEX_CONSTRAINT_EQ {
 24936  			goto __2
 24937  		}
 24938  		if !(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fusable) != 0) {
 24939  			goto __2
 24940  		}
 24941  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 24942  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 24943  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(10)
 24944  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(10)
 24945  		return SQLITE_OK
 24946  
 24947  	}
 24948  	goto __2
 24949  __2:
 24950  	i++
 24951  	p += 12
 24952  	goto __1
 24953  	goto __3
 24954  __3:
 24955  	;
 24956  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1000000000)
 24957  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000000000)
 24958  	return SQLITE_OK
 24959  }
 24960  
 24961  // This following structure defines all the methods for the
 24962  // virtual table.
 24963  var prefixesModule = sqlite3_module{
 24964  	/* xConnect    */ FxConnect: 0,
 24965  	/* xBestIndex  */ FxBestIndex: 0,
 24966  	/* xDisconnect */ FxDisconnect: 0,
 24967  	/* xOpen       */ FxOpen: 0,
 24968  	/* xClose      */ FxClose: 0,
 24969  	/* xFilter     */ FxFilter: 0,
 24970  	/* xNext       */ FxNext: 0,
 24971  	/* xEof        */ FxEof: 0,
 24972  	/* xColumn     */ FxColumn: 0,
 24973  	/* xRowid      */ FxRowid: 0,
 24974  } /* prefixes.c:227:23 */
 24975  
 24976  // This is a copy of the SQLITE_SKIP_UTF8(zIn) macro in sqliteInt.h.
 24977  //
 24978  // Assuming zIn points to the first byte of a UTF-8 character,
 24979  // advance zIn to point to the first byte of the next UTF-8 character.
 24980  
 24981  // Implementation of function prefix_length(). This function accepts two
 24982  // strings as arguments and returns the length in characters (not bytes),
 24983  // of the longest prefix shared by the two strings. For example:
 24984  //
 24985  //   prefix_length('abcdxxx', 'abcyy') == 3
 24986  //   prefix_length('abcdxxx', 'bcyyy') == 0
 24987  //   prefix_length('abcdxxx', 'ab')    == 2
 24988  //   prefix_length('ab',      'abcd')  == 2
 24989  //
 24990  // This function assumes the input is well-formed utf-8. If it is not,
 24991  // it is possible for this function to return -1.
 24992  func prefixLengthFunc(tls *libc.TLS, ctx uintptr, nVal int32, apVal uintptr) { /* prefixes.c:279:13: */
 24993  	var nByte int32    // Number of bytes to compare
 24994  	var nRet int32 = 0 // Return value
 24995  	var zL uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 24996  	var zR uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*4)))
 24997  	var nL int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 24998  	var nR int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*4)))
 24999  	var i int32
 25000  
 25001  	nByte = func() int32 {
 25002  		if nL > nR {
 25003  			return nL
 25004  		}
 25005  		return nR
 25006  	}()
 25007  	for i = 0; i < nByte; i++ {
 25008  		if int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) != int32(*(*uint8)(unsafe.Pointer(zR + uintptr(i)))) {
 25009  			break
 25010  		}
 25011  		if (int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) & 0xC0) != 0x80 {
 25012  			nRet++
 25013  		}
 25014  	}
 25015  
 25016  	if (int32(*(*uint8)(unsafe.Pointer(zL + uintptr(i)))) & 0xC0) == 0x80 {
 25017  		nRet--
 25018  	}
 25019  	sqlite3.Xsqlite3_result_int(tls, ctx, nRet)
 25020  }
 25021  
 25022  func sqlite3_prefixes_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* prefixes.c:305:5: */
 25023  	var rc int32 = SQLITE_OK
 25024  	_ = pApi
 25025  
 25026  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+6023 /* "prefixes" */, uintptr(unsafe.Pointer(&prefixesModule)), uintptr(0))
 25027  	if rc == SQLITE_OK {
 25028  		rc = sqlite3.Xsqlite3_create_function(tls,
 25029  			db, ts+6032 /* "prefix_length" */, 2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 25030  				f func(*libc.TLS, uintptr, int32, uintptr)
 25031  			}{prefixLengthFunc})), uintptr(0), uintptr(0))
 25032  	}
 25033  	return rc
 25034  }
 25035  
 25036  // The following macros redefine the API routines so that they are
 25037  // redirected through the global sqlite3_api structure.
 25038  //
 25039  // This header file is also used by the loadext.c source file
 25040  // (part of the main SQLite library - not an extension) so that
 25041  // it can get access to the sqlite3_api_routines structure
 25042  // definition.  But the main library does not want to redefine
 25043  // the API.  So the redefinition macros are only valid if the
 25044  // SQLITE_CORE macros is undefined.
 25045  
 25046  // This case when the file is being statically linked into the
 25047  // application
 25048  
 25049  // The following #defines change the names of some functions implemented in
 25050  // this file to prevent name collisions with C-library functions of the
 25051  // same name.
 25052  
 25053  // The end-of-input character
 25054  
 25055  // The NFA is implemented as sequence of opcodes taken from the following
 25056  // set.  Each opcode has a single integer argument.
 25057  
 25058  // Each opcode is a "state" in the NFA
 25059  type ReStateNumber = uint16 /* regexp.c:98:24 */
 25060  
 25061  // Because this is an NFA and not a DFA, multiple states can be active at
 25062  // once.  An instance of the following object records all active states in
 25063  // the NFA.  The implementation is optimized for the common case where the
 25064  // number of actives states is small.
 25065  type ReStateSet1 = struct {
 25066  	FnState uint32
 25067  	FaState uintptr
 25068  } /* regexp.c:105:9 */
 25069  
 25070  // Because this is an NFA and not a DFA, multiple states can be active at
 25071  // once.  An instance of the following object records all active states in
 25072  // the NFA.  The implementation is optimized for the common case where the
 25073  // number of actives states is small.
 25074  type ReStateSet = ReStateSet1 /* regexp.c:108:3 */
 25075  
 25076  // An input string read one character at a time.
 25077  type ReInput1 = struct {
 25078  	Fz  uintptr
 25079  	Fi  int32
 25080  	Fmx int32
 25081  } /* regexp.c:112:9 */
 25082  
 25083  // An input string read one character at a time.
 25084  type ReInput = ReInput1 /* regexp.c:112:24 */
 25085  
 25086  // A compiled NFA (or an NFA that is in the process of being compiled) is
 25087  // an instance of the following object.
 25088  type ReCompiled1 = struct {
 25089  	FsIn       ReInput
 25090  	FzErr      uintptr
 25091  	FaOp       uintptr
 25092  	FaArg      uintptr
 25093  	FxNextChar uintptr
 25094  	FzInit     [12]uint8
 25095  	FnInit     int32
 25096  	FnState    uint32
 25097  	FnAlloc    uint32
 25098  } /* regexp.c:122:9 */
 25099  
 25100  // A compiled NFA (or an NFA that is in the process of being compiled) is
 25101  // an instance of the following object.
 25102  type ReCompiled = ReCompiled1 /* regexp.c:122:27 */
 25103  
 25104  // Add a state to the given state set if it is not already there
 25105  func re_add_state(tls *libc.TLS, pSet uintptr, newState int32) { /* regexp.c:136:13: */
 25106  	var i uint32
 25107  	for i = uint32(0); i < (*ReStateSet)(unsafe.Pointer(pSet)).FnState; i++ {
 25108  		if int32(*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pSet)).FaState + uintptr(i)*2))) == newState {
 25109  			return
 25110  		}
 25111  	}
 25112  	*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pSet)).FaState + uintptr(libc.PostIncUint32(&(*ReStateSet)(unsafe.Pointer(pSet)).FnState, 1))*2)) = ReStateNumber(newState)
 25113  }
 25114  
 25115  // Extract the next unicode character from *pzIn and return it.  Advance
 25116  // *pzIn to the first byte past the end of the character returned.  To
 25117  // be clear:  this routine converts utf8 to unicode.  This routine is
 25118  // optimized for the common case where the next character is a single byte.
 25119  func re_next_char(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:147:17: */
 25120  	var c uint32
 25121  	if (*ReInput)(unsafe.Pointer(p)).Fi >= (*ReInput)(unsafe.Pointer(p)).Fmx {
 25122  		return uint32(0)
 25123  	}
 25124  	c = uint32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*ReInput)(unsafe.Pointer(p)).Fi, 1)))))
 25125  	if c >= uint32(0x80) {
 25126  		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) {
 25127  			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)))
 25128  			if c < uint32(0x80) {
 25129  				c = uint32(0xfffd)
 25130  			}
 25131  		} 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)) &&
 25132  			((int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 1))))) & 0xc0) == 0x80) {
 25133  			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)))
 25134  			*(*int32)(unsafe.Pointer(p + 4 /* &.i */)) += (2)
 25135  			if (c <= uint32(0x7ff)) || ((c >= uint32(0xd800)) && (c <= uint32(0xdfff))) {
 25136  				c = uint32(0xfffd)
 25137  			}
 25138  		} 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)) &&
 25139  			((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) {
 25140  			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))) |
 25141  				(uint32(int32(*(*uint8)(unsafe.Pointer((*ReInput)(unsafe.Pointer(p)).Fz + uintptr(((*ReInput)(unsafe.Pointer(p)).Fi + 2))))) & 0x3f)))
 25142  			*(*int32)(unsafe.Pointer(p + 4 /* &.i */)) += (3)
 25143  			if (c <= uint32(0xffff)) || (c > uint32(0x10ffff)) {
 25144  				c = uint32(0xfffd)
 25145  			}
 25146  		} else {
 25147  			c = uint32(0xfffd)
 25148  		}
 25149  	}
 25150  	return c
 25151  }
 25152  
 25153  func re_next_char_nocase(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:172:17: */
 25154  	var c uint32 = re_next_char(tls, p)
 25155  	if (c >= uint32('A')) && (c <= uint32('Z')) {
 25156  		c = c + (uint32('a' - 'A'))
 25157  	}
 25158  	return c
 25159  }
 25160  
 25161  // Return true if c is a perl "word" character:  [A-Za-z0-9_]
 25162  func re_word_char(tls *libc.TLS, c int32) int32 { /* regexp.c:179:12: */
 25163  	return (libc.Bool32(((((c >= '0') && (c <= '9')) || ((c >= 'a') && (c <= 'z'))) ||
 25164  		((c >= 'A') && (c <= 'Z'))) || (c == '_')))
 25165  }
 25166  
 25167  // Return true if c is a "digit" character:  [0-9]
 25168  func re_digit_char(tls *libc.TLS, c int32) int32 { /* regexp.c:185:12: */
 25169  	return (libc.Bool32((c >= '0') && (c <= '9')))
 25170  }
 25171  
 25172  // Return true if c is a perl "space" character:  [ \t\r\n\v\f]
 25173  func re_space_char(tls *libc.TLS, c int32) int32 { /* regexp.c:190:12: */
 25174  	return (libc.Bool32((((((c == ' ') || (c == '\t')) || (c == '\n')) || (c == '\r')) || (c == '\v')) || (c == '\f')))
 25175  }
 25176  
 25177  // Run a compiled regular expression on the zero-terminated input
 25178  // string zIn[].  Return true on a match and false if there is no match.
 25179  func sqlite3re_match(tls *libc.TLS, pRe uintptr, zIn uintptr, nIn int32) int32 { /* regexp.c:197:12: */
 25180  	bp := tls.Alloc(228)
 25181  	defer tls.Free(228)
 25182  
 25183  	// var aStateSet [2]ReStateSet at bp, 16
 25184  
 25185  	var pThis uintptr
 25186  	var pNext uintptr
 25187  	// var aSpace [100]ReStateNumber at bp+16, 200
 25188  
 25189  	var pToFree uintptr
 25190  	var i uint32
 25191  	var iSwap uint32
 25192  	var c int32
 25193  	var cPrev int32
 25194  	var rc int32
 25195  	// var in ReInput at bp+216, 12
 25196  
 25197  	var x uint8
 25198  	var j int32
 25199  	var n int32
 25200  	var hit int32
 25201  	var x1 int32
 25202  	i = uint32(0)
 25203  	iSwap = uint32(0)
 25204  	c = (RE_EOF + 1)
 25205  	cPrev = 0
 25206  	rc = 0
 25207  
 25208  	(*ReInput)(unsafe.Pointer(bp + 216 /* &in */)).Fz = zIn
 25209  	(*ReInput)(unsafe.Pointer(bp + 216 /* &in */)).Fi = 0
 25210  	(*ReInput)(unsafe.Pointer(bp + 216 /* &in */)).Fmx = func() int32 {
 25211  		if nIn >= 0 {
 25212  			return nIn
 25213  		}
 25214  		return int32(libc.Xstrlen(tls, zIn))
 25215  	}()
 25216  
 25217  	// Look for the initial prefix match, if there is one.
 25218  	if !((*ReCompiled)(unsafe.Pointer(pRe)).FnInit != 0) {
 25219  		goto __1
 25220  	}
 25221  	x = *(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */)))
 25222  __2:
 25223  	if !((((*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fi + (*ReCompiled)(unsafe.Pointer(pRe)).FnInit) <= (*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fmx) &&
 25224  		((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fi)))) != int32(x)) || (libc.Xstrncmp(tls, (zIn+uintptr((*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fi)), pRe+28 /* &.zInit */, uint32((*ReCompiled)(unsafe.Pointer(pRe)).FnInit)) != 0))) {
 25225  		goto __3
 25226  	}
 25227  	(*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fi++
 25228  	goto __2
 25229  __3:
 25230  	;
 25231  	if !(((*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fi + (*ReCompiled)(unsafe.Pointer(pRe)).FnInit) > (*ReInput)(unsafe.Pointer(bp+216 /* &in */)).Fmx) {
 25232  		goto __4
 25233  	}
 25234  	return 0
 25235  __4:
 25236  	;
 25237  __1:
 25238  	;
 25239  
 25240  	if !((*ReCompiled)(unsafe.Pointer(pRe)).FnState <= (uint32(unsafe.Sizeof([100]ReStateNumber{})) / (uint32(unsafe.Sizeof(ReStateNumber(0))) * uint32(2)))) {
 25241  		goto __5
 25242  	}
 25243  	pToFree = uintptr(0)
 25244  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState = bp + 16 /* &aSpace[0] */
 25245  	goto __6
 25246  __5:
 25247  	pToFree = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(ReStateNumber(0))) * uint32(2)) * (*ReCompiled)(unsafe.Pointer(pRe)).FnState)))
 25248  	if !(pToFree == uintptr(0)) {
 25249  		goto __7
 25250  	}
 25251  	return -1
 25252  __7:
 25253  	;
 25254  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState = pToFree
 25255  __6:
 25256  	;
 25257  	(*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */ + 1*8)).FaState = ((*ReStateSet)(unsafe.Pointer(bp /* &aStateSet */)).FaState + uintptr((*ReCompiled)(unsafe.Pointer(pRe)).FnState)*2)
 25258  	pNext = (bp /* &aStateSet */ + 1*8)
 25259  	(*ReStateSet)(unsafe.Pointer(pNext)).FnState = uint32(0)
 25260  	re_add_state(tls, pNext, 0)
 25261  __8:
 25262  	if !((c != RE_EOF) && ((*ReStateSet)(unsafe.Pointer(pNext)).FnState > uint32(0))) {
 25263  		goto __9
 25264  	}
 25265  	cPrev = c
 25266  	c = int32((*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((pRe + 24 /* &.xNextChar */))))(tls, bp+216 /* &in */))
 25267  	pThis = pNext
 25268  	pNext = (bp /* &aStateSet */ + uintptr(iSwap)*8)
 25269  	iSwap = (uint32(1) - iSwap)
 25270  	(*ReStateSet)(unsafe.Pointer(pNext)).FnState = uint32(0)
 25271  	i = uint32(0)
 25272  __10:
 25273  	if !(i < (*ReStateSet)(unsafe.Pointer(pThis)).FnState) {
 25274  		goto __12
 25275  	}
 25276  	x1 = int32(*(*ReStateNumber)(unsafe.Pointer((*ReStateSet)(unsafe.Pointer(pThis)).FaState + uintptr(i)*2)))
 25277  	switch int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(x1)))) {
 25278  	case RE_OP_MATCH:
 25279  		goto __14
 25280  	case RE_OP_ANY:
 25281  		goto __15
 25282  	case RE_OP_WORD:
 25283  		goto __16
 25284  	case RE_OP_NOTWORD:
 25285  		goto __17
 25286  	case RE_OP_DIGIT:
 25287  		goto __18
 25288  	case RE_OP_NOTDIGIT:
 25289  		goto __19
 25290  	case RE_OP_SPACE:
 25291  		goto __20
 25292  	case RE_OP_NOTSPACE:
 25293  		goto __21
 25294  	case RE_OP_BOUNDARY:
 25295  		goto __22
 25296  	case RE_OP_ANYSTAR:
 25297  		goto __23
 25298  	case RE_OP_FORK:
 25299  		goto __24
 25300  	case RE_OP_GOTO:
 25301  		goto __25
 25302  	case RE_OP_ACCEPT:
 25303  		goto __26
 25304  	case RE_OP_CC_EXC:
 25305  		goto __27
 25306  	case RE_OP_CC_INC:
 25307  		goto __28
 25308  	}
 25309  	goto __13
 25310  __14:
 25311  	if !(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4)) == c) {
 25312  		goto __29
 25313  	}
 25314  	re_add_state(tls, pNext, (x1 + 1))
 25315  __29:
 25316  	;
 25317  	goto __13
 25318  
 25319  __15:
 25320  	if !(c != 0) {
 25321  		goto __30
 25322  	}
 25323  	re_add_state(tls, pNext, (x1 + 1))
 25324  __30:
 25325  	;
 25326  	goto __13
 25327  
 25328  __16:
 25329  	if !(re_word_char(tls, c) != 0) {
 25330  		goto __31
 25331  	}
 25332  	re_add_state(tls, pNext, (x1 + 1))
 25333  __31:
 25334  	;
 25335  	goto __13
 25336  
 25337  __17:
 25338  	if !(!(re_word_char(tls, c) != 0) && (c != 0)) {
 25339  		goto __32
 25340  	}
 25341  	re_add_state(tls, pNext, (x1 + 1))
 25342  __32:
 25343  	;
 25344  	goto __13
 25345  
 25346  __18:
 25347  	if !(re_digit_char(tls, c) != 0) {
 25348  		goto __33
 25349  	}
 25350  	re_add_state(tls, pNext, (x1 + 1))
 25351  __33:
 25352  	;
 25353  	goto __13
 25354  
 25355  __19:
 25356  	if !(!(re_digit_char(tls, c) != 0) && (c != 0)) {
 25357  		goto __34
 25358  	}
 25359  	re_add_state(tls, pNext, (x1 + 1))
 25360  __34:
 25361  	;
 25362  	goto __13
 25363  
 25364  __20:
 25365  	if !(re_space_char(tls, c) != 0) {
 25366  		goto __35
 25367  	}
 25368  	re_add_state(tls, pNext, (x1 + 1))
 25369  __35:
 25370  	;
 25371  	goto __13
 25372  
 25373  __21:
 25374  	if !(!(re_space_char(tls, c) != 0) && (c != 0)) {
 25375  		goto __36
 25376  	}
 25377  	re_add_state(tls, pNext, (x1 + 1))
 25378  __36:
 25379  	;
 25380  	goto __13
 25381  
 25382  __22:
 25383  	if !(re_word_char(tls, c) != re_word_char(tls, cPrev)) {
 25384  		goto __37
 25385  	}
 25386  	re_add_state(tls, pThis, (x1 + 1))
 25387  __37:
 25388  	;
 25389  	goto __13
 25390  
 25391  __23:
 25392  	re_add_state(tls, pNext, x1)
 25393  	re_add_state(tls, pThis, (x1 + 1))
 25394  	goto __13
 25395  
 25396  __24:
 25397  	re_add_state(tls, pThis, (x1 + *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))))
 25398  	re_add_state(tls, pThis, (x1 + 1))
 25399  	goto __13
 25400  
 25401  __25:
 25402  	re_add_state(tls, pThis, (x1 + *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))))
 25403  	goto __13
 25404  
 25405  __26:
 25406  	rc = 1
 25407  	goto re_match_end
 25408  
 25409  __27:
 25410  	if !(c == 0) {
 25411  		goto __38
 25412  	}
 25413  	goto __13
 25414  __38:
 25415  	;
 25416  	// fall-through
 25417  
 25418  __28:
 25419  	j = 1
 25420  	n = *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(x1)*4))
 25421  	hit = 0
 25422  	j = 1
 25423  __39:
 25424  	if !((j > 0) && (j < n)) {
 25425  		goto __41
 25426  	}
 25427  	if !(int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr((x1 + j))))) == RE_OP_CC_VALUE) {
 25428  		goto __42
 25429  	}
 25430  	if !(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr((x1+j))*4)) == c) {
 25431  		goto __44
 25432  	}
 25433  	hit = 1
 25434  	j = -1
 25435  __44:
 25436  	;
 25437  	goto __43
 25438  __42:
 25439  	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)) {
 25440  		goto __45
 25441  	}
 25442  	hit = 1
 25443  	j = -1
 25444  	goto __46
 25445  __45:
 25446  	j++
 25447  __46:
 25448  	;
 25449  __43:
 25450  	;
 25451  	goto __40
 25452  __40:
 25453  	j++
 25454  	goto __39
 25455  	goto __41
 25456  __41:
 25457  	;
 25458  	if !(int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(x1)))) == RE_OP_CC_EXC) {
 25459  		goto __47
 25460  	}
 25461  	hit = libc.BoolInt32(!(hit != 0))
 25462  __47:
 25463  	;
 25464  	if !(hit != 0) {
 25465  		goto __48
 25466  	}
 25467  	re_add_state(tls, pNext, (x1 + n))
 25468  __48:
 25469  	;
 25470  	goto __13
 25471  
 25472  __13:
 25473  	;
 25474  	goto __11
 25475  __11:
 25476  	i++
 25477  	goto __10
 25478  	goto __12
 25479  __12:
 25480  	;
 25481  	goto __8
 25482  __9:
 25483  	;
 25484  	i = uint32(0)
 25485  __49:
 25486  	if !(i < (*ReStateSet)(unsafe.Pointer(pNext)).FnState) {
 25487  		goto __51
 25488  	}
 25489  	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) {
 25490  		goto __52
 25491  	}
 25492  	rc = 1
 25493  	goto __51
 25494  __52:
 25495  	;
 25496  	goto __50
 25497  __50:
 25498  	i++
 25499  	goto __49
 25500  	goto __51
 25501  __51:
 25502  	;
 25503  re_match_end:
 25504  	sqlite3.Xsqlite3_free(tls, pToFree)
 25505  	return rc
 25506  }
 25507  
 25508  // Resize the opcode and argument arrays for an RE under construction.
 25509  func re_resize(tls *libc.TLS, p uintptr, N int32) int32 { /* regexp.c:340:12: */
 25510  	var aOp uintptr
 25511  	var aArg uintptr
 25512  	aOp = sqlite3.Xsqlite3_realloc64(tls, (*ReCompiled)(unsafe.Pointer(p)).FaOp, (uint64(uint32(N) * uint32(unsafe.Sizeof(int8(0))))))
 25513  	if aOp == uintptr(0) {
 25514  		return 1
 25515  	}
 25516  	(*ReCompiled)(unsafe.Pointer(p)).FaOp = aOp
 25517  	aArg = sqlite3.Xsqlite3_realloc64(tls, (*ReCompiled)(unsafe.Pointer(p)).FaArg, (uint64(uint32(N) * uint32(unsafe.Sizeof(int32(0))))))
 25518  	if aArg == uintptr(0) {
 25519  		return 1
 25520  	}
 25521  	(*ReCompiled)(unsafe.Pointer(p)).FaArg = aArg
 25522  	(*ReCompiled)(unsafe.Pointer(p)).FnAlloc = uint32(N)
 25523  	return 0
 25524  }
 25525  
 25526  // Insert a new opcode and argument into an RE under construction.  The
 25527  // insertion point is just prior to existing opcode iBefore.
 25528  func re_insert(tls *libc.TLS, p uintptr, iBefore int32, op int32, arg int32) int32 { /* regexp.c:356:12: */
 25529  	var i int32
 25530  	if ((*ReCompiled)(unsafe.Pointer(p)).FnAlloc <= (*ReCompiled)(unsafe.Pointer(p)).FnState) && (re_resize(tls, p, (int32((*ReCompiled)(unsafe.Pointer(p)).FnAlloc*uint32(2)))) != 0) {
 25531  		return 0
 25532  	}
 25533  	for i = int32((*ReCompiled)(unsafe.Pointer(p)).FnState); i > iBefore; i-- {
 25534  		*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(i))) = *(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr((i - 1))))
 25535  		*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(i)*4)) = *(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr((i-1))*4))
 25536  	}
 25537  	(*ReCompiled)(unsafe.Pointer(p)).FnState++
 25538  	*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(iBefore))) = int8(op)
 25539  	*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iBefore)*4)) = arg
 25540  	return iBefore
 25541  }
 25542  
 25543  // Append a new opcode and argument to the end of the RE under construction.
 25544  func re_append(tls *libc.TLS, p uintptr, op int32, arg int32) int32 { /* regexp.c:371:12: */
 25545  	return re_insert(tls, p, int32((*ReCompiled)(unsafe.Pointer(p)).FnState), op, arg)
 25546  }
 25547  
 25548  // Make a copy of N opcodes starting at iStart onto the end of the RE
 25549  // under construction.
 25550  func re_copy(tls *libc.TLS, p uintptr, iStart int32, N int32) { /* regexp.c:378:13: */
 25551  	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) {
 25552  		return
 25553  	}
 25554  	libc.Xmemcpy(tls, ((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr((*ReCompiled)(unsafe.Pointer(p)).FnState)), ((*ReCompiled)(unsafe.Pointer(p)).FaOp + uintptr(iStart)), (uint32(N) * uint32(unsafe.Sizeof(int8(0)))))
 25555  	libc.Xmemcpy(tls, ((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr((*ReCompiled)(unsafe.Pointer(p)).FnState)*4), ((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iStart)*4), (uint32(N) * uint32(unsafe.Sizeof(int32(0)))))
 25556  	*(*uint32)(unsafe.Pointer(p + 44 /* &.nState */)) += (uint32(N))
 25557  }
 25558  
 25559  // Return true if c is a hexadecimal digit character:  [0-9a-fA-F]
 25560  // If c is a hex digit, also set *pV = (*pV)*16 + valueof(c).  If
 25561  // c is not a hex digit *pV is unchanged.
 25562  func re_hex(tls *libc.TLS, c int32, pV uintptr) int32 { /* regexp.c:389:12: */
 25563  	if (c >= '0') && (c <= '9') {
 25564  		c = c - ('0')
 25565  	} else if (c >= 'a') && (c <= 'f') {
 25566  		c = c - ('a' - 10)
 25567  	} else if (c >= 'A') && (c <= 'F') {
 25568  		c = c - ('A' - 10)
 25569  	} else {
 25570  		return 0
 25571  	}
 25572  	*(*int32)(unsafe.Pointer(pV)) = (((*(*int32)(unsafe.Pointer(pV))) * 16) + (c & 0xff))
 25573  	return 1
 25574  }
 25575  
 25576  // A backslash character has been seen, read the next character and
 25577  // return its interpretation.
 25578  func re_esc_char(tls *libc.TLS, p uintptr) uint32 { /* regexp.c:406:17: */
 25579  	bp := tls.Alloc(4)
 25580  	defer tls.Free(4)
 25581  
 25582  	var i int32
 25583  	*(*int32)(unsafe.Pointer(bp /* v */)) = 0
 25584  	var c int8
 25585  	if (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi >= (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx {
 25586  		return uint32(0)
 25587  	}
 25588  	c = int8(*(*uint8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))))
 25589  	if (int32(c) == 'u') && (((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi + 4) < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx) {
 25590  		var zIn uintptr = ((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))
 25591  		if (((re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 1))), bp /* &v */) != 0) &&
 25592  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 2))), bp /* &v */) != 0)) &&
 25593  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 3))), bp /* &v */) != 0)) &&
 25594  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 4))), bp /* &v */) != 0) {
 25595  			*(*int32)(unsafe.Pointer(p /* &.sIn */ + 4 /* &.i */)) += (5)
 25596  			return uint32(*(*int32)(unsafe.Pointer(bp /* v */)))
 25597  		}
 25598  	}
 25599  	if (int32(c) == 'x') && (((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi + 2) < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx) {
 25600  		var zIn uintptr = ((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi))
 25601  		if (re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 1))), bp /* &v */) != 0) &&
 25602  			(re_hex(tls, int32(*(*uint8)(unsafe.Pointer(zIn + 2))), bp /* &v */) != 0) {
 25603  			*(*int32)(unsafe.Pointer(p /* &.sIn */ + 4 /* &.i */)) += (3)
 25604  			return uint32(*(*int32)(unsafe.Pointer(bp /* v */)))
 25605  		}
 25606  	}
 25607  	for i = 0; (zEsc[i] != 0) && (int32(zEsc[i]) != int32(c)); i++ {
 25608  	}
 25609  	if zEsc[i] != 0 {
 25610  		if i < 6 {
 25611  			c = zTrans[i]
 25612  		}
 25613  		(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25614  	} else {
 25615  		(*ReCompiled)(unsafe.Pointer(p)).FzErr = ts + 6046 /* "unknown \\ escape" */
 25616  	}
 25617  	return uint32(c)
 25618  }
 25619  
 25620  var zEsc = *(*[21]int8)(unsafe.Pointer(ts + 6063 /* "afnrtv\\()*.+?[$^..." */)) /* regexp.c:407:21 */
 25621  var zTrans = *(*[7]int8)(unsafe.Pointer(ts + 6084 /* "\a\f\n\r\t\v" */))        /* regexp.c:408:21 */
 25622  
 25623  // Peek at the next byte of input
 25624  func rePeek(tls *libc.TLS, p uintptr) uint8 { /* regexp.c:447:22: */
 25625  	if (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi < (*ReCompiled)(unsafe.Pointer(p)).FsIn.Fmx {
 25626  		return *(*uint8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fz + uintptr((*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi)))
 25627  	}
 25628  	return uint8(0)
 25629  }
 25630  
 25631  // Compile RE text into a sequence of opcodes.  Continue up to the
 25632  // first unmatched ")" character, then return.  If an error is found,
 25633  // return a pointer to the error message string.
 25634  func re_subcompile_re(tls *libc.TLS, p uintptr) uintptr { /* regexp.c:455:19: */
 25635  	var zErr uintptr
 25636  	var iStart int32
 25637  	var iEnd int32
 25638  	var iGoto int32
 25639  	iStart = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 25640  	zErr = re_subcompile_string(tls, p)
 25641  	if zErr != 0 {
 25642  		return zErr
 25643  	}
 25644  	for int32(rePeek(tls, p)) == '|' {
 25645  		iEnd = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 25646  		re_insert(tls, p, iStart, RE_OP_FORK, ((iEnd + 2) - iStart))
 25647  		iGoto = re_append(tls, p, RE_OP_GOTO, 0)
 25648  		(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25649  		zErr = re_subcompile_string(tls, p)
 25650  		if zErr != 0 {
 25651  			return zErr
 25652  		}
 25653  		*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iGoto)*4)) = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iGoto)))
 25654  	}
 25655  	return uintptr(0)
 25656  }
 25657  
 25658  // Compile an element of regular expression text (anything that can be
 25659  // an operand to the "|" operator).  Return NULL on success or a pointer
 25660  // to the error message if there is a problem.
 25661  func re_subcompile_string(tls *libc.TLS, p uintptr) uintptr { /* regexp.c:477:19: */
 25662  	var iPrev int32 = -1
 25663  	var iStart int32
 25664  	var c uint32
 25665  	var zErr uintptr
 25666  	for (libc.AssignUint32(&c, (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 24 /* &.xNextChar */))))(tls, (p /* &.sIn */)))) != uint32(0) {
 25667  		iStart = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 25668  		switch c {
 25669  		case uint32('|'):
 25670  			fallthrough
 25671  		case uint32('$'):
 25672  			fallthrough
 25673  		case uint32(')'):
 25674  			{
 25675  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi--
 25676  				return uintptr(0)
 25677  
 25678  			}
 25679  		case uint32('('):
 25680  			{
 25681  				zErr = re_subcompile_re(tls, p)
 25682  				if zErr != 0 {
 25683  					return zErr
 25684  				}
 25685  				if int32(rePeek(tls, p)) != ')' {
 25686  					return ts + 6091 /* "unmatched '('" */
 25687  				}
 25688  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25689  				break
 25690  
 25691  			}
 25692  		case uint32('.'):
 25693  			{
 25694  				if int32(rePeek(tls, p)) == '*' {
 25695  					re_append(tls, p, RE_OP_ANYSTAR, 0)
 25696  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25697  				} else {
 25698  					re_append(tls, p, RE_OP_ANY, 0)
 25699  				}
 25700  				break
 25701  
 25702  			}
 25703  		case uint32('*'):
 25704  			{
 25705  				if iPrev < 0 {
 25706  					return ts + 6105 /* "'*' without oper..." */
 25707  				}
 25708  				re_insert(tls, p, iPrev, RE_OP_GOTO, (int32(((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)) + uint32(1))))
 25709  				re_append(tls, p, RE_OP_FORK, (int32((uint32(iPrev) - (*ReCompiled)(unsafe.Pointer(p)).FnState) + uint32(1))))
 25710  				break
 25711  
 25712  			}
 25713  		case uint32('+'):
 25714  			{
 25715  				if iPrev < 0 {
 25716  					return ts + 6125 /* "'+' without oper..." */
 25717  				}
 25718  				re_append(tls, p, RE_OP_FORK, (int32(uint32(iPrev) - (*ReCompiled)(unsafe.Pointer(p)).FnState)))
 25719  				break
 25720  
 25721  			}
 25722  		case uint32('?'):
 25723  			{
 25724  				if iPrev < 0 {
 25725  					return ts + 6145 /* "'?' without oper..." */
 25726  				}
 25727  				re_insert(tls, p, iPrev, RE_OP_FORK, (int32(((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)) + uint32(1))))
 25728  				break
 25729  
 25730  			}
 25731  		case uint32('{'):
 25732  			{
 25733  				var m int32 = 0
 25734  				var n int32 = 0
 25735  				var sz int32
 25736  				var j int32
 25737  				if iPrev < 0 {
 25738  					return ts + 6165 /* "'{m,n}' without ..." */
 25739  				}
 25740  				for ((libc.AssignUint32(&c, uint32(rePeek(tls, p)))) >= uint32('0')) && (c <= uint32('9')) {
 25741  					m = (int32(((uint32(m * 10)) + c) - uint32('0')))
 25742  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25743  				}
 25744  				n = m
 25745  				if c == uint32(',') {
 25746  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25747  					n = 0
 25748  					for ((libc.AssignUint32(&c, uint32(rePeek(tls, p)))) >= uint32('0')) && (c <= uint32('9')) {
 25749  						n = (int32(((uint32(n * 10)) + c) - uint32('0')))
 25750  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25751  					}
 25752  				}
 25753  				if c != uint32('}') {
 25754  					return ts + 6189 /* "unmatched '{'" */
 25755  				}
 25756  				if (n > 0) && (n < m) {
 25757  					return ts + 6203 /* "n less than m in..." */
 25758  				}
 25759  				(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25760  				sz = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iPrev)))
 25761  				if m == 0 {
 25762  					if n == 0 {
 25763  						return ts + 6228 /* "both m and n are..." */
 25764  					}
 25765  					re_insert(tls, p, iPrev, RE_OP_FORK, (sz + 1))
 25766  					n--
 25767  				} else {
 25768  					for j = 1; j < m; j++ {
 25769  						re_copy(tls, p, iPrev, sz)
 25770  					}
 25771  				}
 25772  				for j = m; j < n; j++ {
 25773  					re_append(tls, p, RE_OP_FORK, (sz + 1))
 25774  					re_copy(tls, p, iPrev, sz)
 25775  				}
 25776  				if (n == 0) && (m > 0) {
 25777  					re_append(tls, p, RE_OP_FORK, -sz)
 25778  				}
 25779  				break
 25780  
 25781  			}
 25782  		case uint32('['):
 25783  			{
 25784  				var iFirst int32 = int32((*ReCompiled)(unsafe.Pointer(p)).FnState)
 25785  				if int32(rePeek(tls, p)) == '^' {
 25786  					re_append(tls, p, RE_OP_CC_EXC, 0)
 25787  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25788  				} else {
 25789  					re_append(tls, p, RE_OP_CC_INC, 0)
 25790  				}
 25791  				for (libc.AssignUint32(&c, (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 24 /* &.xNextChar */))))(tls, (p /* &.sIn */)))) != uint32(0) {
 25792  					if (c == uint32('[')) && (int32(rePeek(tls, p)) == ':') {
 25793  						return ts + 6261 /* "POSIX character ..." */
 25794  					}
 25795  					if c == uint32('\\') {
 25796  						c = re_esc_char(tls, p)
 25797  					}
 25798  					if int32(rePeek(tls, p)) == '-' {
 25799  						re_append(tls, p, RE_OP_CC_RANGE, int32(c))
 25800  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25801  						c = (*(*func(*libc.TLS, uintptr) uint32)(unsafe.Pointer((p + 24 /* &.xNextChar */))))(tls, (p /* &.sIn */))
 25802  						if c == uint32('\\') {
 25803  							c = re_esc_char(tls, p)
 25804  						}
 25805  						re_append(tls, p, RE_OP_CC_RANGE, int32(c))
 25806  					} else {
 25807  						re_append(tls, p, RE_OP_CC_VALUE, int32(c))
 25808  					}
 25809  					if int32(rePeek(tls, p)) == ']' {
 25810  						(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25811  						break
 25812  					}
 25813  				}
 25814  				if c == uint32(0) {
 25815  					return ts + 6299 /* "unclosed '['" */
 25816  				}
 25817  				*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(p)).FaArg + uintptr(iFirst)*4)) = (int32((*ReCompiled)(unsafe.Pointer(p)).FnState - uint32(iFirst)))
 25818  				break
 25819  
 25820  			}
 25821  		case uint32('\\'):
 25822  			{
 25823  				var specialOp int32 = 0
 25824  				switch int32(rePeek(tls, p)) {
 25825  				case 'b':
 25826  					specialOp = RE_OP_BOUNDARY
 25827  					break
 25828  				case 'd':
 25829  					specialOp = RE_OP_DIGIT
 25830  					break
 25831  				case 'D':
 25832  					specialOp = RE_OP_NOTDIGIT
 25833  					break
 25834  				case 's':
 25835  					specialOp = RE_OP_SPACE
 25836  					break
 25837  				case 'S':
 25838  					specialOp = RE_OP_NOTSPACE
 25839  					break
 25840  				case 'w':
 25841  					specialOp = RE_OP_WORD
 25842  					break
 25843  				case 'W':
 25844  					specialOp = RE_OP_NOTWORD
 25845  					break
 25846  				}
 25847  				if specialOp != 0 {
 25848  					(*ReCompiled)(unsafe.Pointer(p)).FsIn.Fi++
 25849  					re_append(tls, p, specialOp, 0)
 25850  				} else {
 25851  					c = re_esc_char(tls, p)
 25852  					re_append(tls, p, RE_OP_MATCH, int32(c))
 25853  				}
 25854  				break
 25855  
 25856  			}
 25857  		default:
 25858  			{
 25859  				re_append(tls, p, RE_OP_MATCH, int32(c))
 25860  				break
 25861  
 25862  			}
 25863  		}
 25864  		iPrev = iStart
 25865  	}
 25866  	return uintptr(0)
 25867  }
 25868  
 25869  // Free and reclaim all the memory used by a previously compiled
 25870  // regular expression.  Applications should invoke this routine once
 25871  // for every call to re_compile() to avoid memory leaks.
 25872  func sqlite3re_free(tls *libc.TLS, pRe uintptr) { /* regexp.c:616:13: */
 25873  	if pRe != 0 {
 25874  		sqlite3.Xsqlite3_free(tls, (*ReCompiled)(unsafe.Pointer(pRe)).FaOp)
 25875  		sqlite3.Xsqlite3_free(tls, (*ReCompiled)(unsafe.Pointer(pRe)).FaArg)
 25876  		sqlite3.Xsqlite3_free(tls, pRe)
 25877  	}
 25878  }
 25879  
 25880  // Compile a textual regular expression in zIn[] into a compiled regular
 25881  // expression suitable for us by re_match() and return a pointer to the
 25882  // compiled regular expression in *ppRe.  Return NULL on success or an
 25883  // error message if something goes wrong.
 25884  func sqlite3re_compile(tls *libc.TLS, ppRe uintptr, zIn uintptr, noCase int32) uintptr { /* regexp.c:630:19: */
 25885  	var pRe uintptr
 25886  	var zErr uintptr
 25887  	var i int32
 25888  	var j int32
 25889  
 25890  	*(*uintptr)(unsafe.Pointer(ppRe)) = uintptr(0)
 25891  	pRe = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ReCompiled{})))
 25892  	if pRe == uintptr(0) {
 25893  		return ts + 1930 /* "out of memory" */
 25894  	}
 25895  	libc.Xmemset(tls, pRe, 0, uint32(unsafe.Sizeof(ReCompiled{})))
 25896  	(*ReCompiled)(unsafe.Pointer(pRe)).FxNextChar = func() uintptr {
 25897  		if noCase != 0 {
 25898  			return *(*uintptr)(unsafe.Pointer(&struct {
 25899  				f func(*libc.TLS, uintptr) uint32
 25900  			}{re_next_char_nocase}))
 25901  		}
 25902  		return *(*uintptr)(unsafe.Pointer(&struct {
 25903  			f func(*libc.TLS, uintptr) uint32
 25904  		}{re_next_char}))
 25905  	}()
 25906  	if re_resize(tls, pRe, 30) != 0 {
 25907  		sqlite3re_free(tls, pRe)
 25908  		return ts + 1930 /* "out of memory" */
 25909  	}
 25910  	if int32(*(*int8)(unsafe.Pointer(zIn))) == '^' {
 25911  		zIn++
 25912  	} else {
 25913  		re_append(tls, pRe, RE_OP_ANYSTAR, 0)
 25914  	}
 25915  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fz = zIn
 25916  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi = 0
 25917  	(*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx = int32(libc.Xstrlen(tls, zIn))
 25918  	zErr = re_subcompile_re(tls, pRe)
 25919  	if zErr != 0 {
 25920  		sqlite3re_free(tls, pRe)
 25921  		return zErr
 25922  	}
 25923  	if (int32(rePeek(tls, pRe)) == '$') && (((*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi + 1) >= (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx) {
 25924  		re_append(tls, pRe, RE_OP_MATCH, RE_EOF)
 25925  		re_append(tls, pRe, RE_OP_ACCEPT, 0)
 25926  		*(*uintptr)(unsafe.Pointer(ppRe)) = pRe
 25927  	} else if (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fi >= (*ReCompiled)(unsafe.Pointer(pRe)).FsIn.Fmx {
 25928  		re_append(tls, pRe, RE_OP_ACCEPT, 0)
 25929  		*(*uintptr)(unsafe.Pointer(ppRe)) = pRe
 25930  	} else {
 25931  		sqlite3re_free(tls, pRe)
 25932  		return ts + 6312 /* "unrecognized cha..." */
 25933  	}
 25934  
 25935  	// The following is a performance optimization.  If the regex begins with
 25936  	// ".*" (if the input regex lacks an initial "^") and afterwards there are
 25937  	// one or more matching characters, enter those matching characters into
 25938  	// zInit[].  The re_match() routine can then search ahead in the input
 25939  	// string looking for the initial match without having to run the whole
 25940  	// regex engine over the string.  Do not worry able trying to match
 25941  	// unicode characters beyond plane 0 - those are very rare and this is
 25942  	// just an optimization.
 25943  	if (int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp))) == RE_OP_ANYSTAR) && !(noCase != 0) {
 25944  		j = 0
 25945  		i = 1
 25946  		for ; (j < (int32(unsafe.Sizeof([12]uint8{})) - 2)) && (int32(*(*int8)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaOp + uintptr(i)))) == RE_OP_MATCH); i++ {
 25947  			var x uint32 = uint32(*(*int32)(unsafe.Pointer((*ReCompiled)(unsafe.Pointer(pRe)).FaArg + uintptr(i)*4)))
 25948  			if x <= uint32(127) {
 25949  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = uint8(x)
 25950  			} else if x <= uint32(0xfff) {
 25951  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0xc0) | (x >> 6)))
 25952  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | (x & uint32(0x3f))))
 25953  			} else if x <= uint32(0xffff) {
 25954  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0xd0) | (x >> 12)))
 25955  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | ((x >> 6) & uint32(0x3f))))
 25956  				*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr(libc.PostIncInt32(&j, 1)))) = (uint8(uint32(0x80) | (x & uint32(0x3f))))
 25957  			} else {
 25958  				break
 25959  			}
 25960  		}
 25961  		if (j > 0) && (int32(*(*uint8)(unsafe.Pointer((pRe + 28 /* &.zInit */) + uintptr((j - 1))))) == 0) {
 25962  			j--
 25963  		}
 25964  		(*ReCompiled)(unsafe.Pointer(pRe)).FnInit = j
 25965  	}
 25966  	return (*ReCompiled)(unsafe.Pointer(pRe)).FzErr
 25967  }
 25968  
 25969  // Implementation of the regexp() SQL function.  This function implements
 25970  // the build-in REGEXP operator.  The first argument to the function is the
 25971  // pattern and the second argument is the string.  So, the SQL statements:
 25972  //
 25973  //       A REGEXP B
 25974  //
 25975  // is implemented as regexp(B,A).
 25976  func re_sql_func(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* regexp.c:710:13: */
 25977  	bp := tls.Alloc(4)
 25978  	defer tls.Free(4)
 25979  
 25980  	// var pRe uintptr at bp, 4
 25981  	// Compiled regular expression
 25982  	var zPattern uintptr // The regular expression
 25983  	var zStr uintptr     // String being searched
 25984  	var zErr uintptr     // Compile error message
 25985  	var setAux int32 = 0 // True to invoke sqlite3_set_auxdata()
 25986  
 25987  	_ = argc // Unused
 25988  	*(*uintptr)(unsafe.Pointer(bp /* pRe */)) = sqlite3.Xsqlite3_get_auxdata(tls, context, 0)
 25989  	if *(*uintptr)(unsafe.Pointer(bp /* pRe */)) == uintptr(0) {
 25990  		zPattern = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 25991  		if zPattern == uintptr(0) {
 25992  			return
 25993  		}
 25994  		zErr = sqlite3re_compile(tls, bp /* &pRe */, zPattern, (libc.Bool32(sqlite3.Xsqlite3_user_data(tls, context) != uintptr(0))))
 25995  		if zErr != 0 {
 25996  			sqlite3re_free(tls, *(*uintptr)(unsafe.Pointer(bp /* pRe */)))
 25997  			sqlite3.Xsqlite3_result_error(tls, context, zErr, -1)
 25998  			return
 25999  		}
 26000  		if *(*uintptr)(unsafe.Pointer(bp /* pRe */)) == uintptr(0) {
 26001  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 26002  			return
 26003  		}
 26004  		setAux = 1
 26005  	}
 26006  	zStr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 26007  	if zStr != uintptr(0) {
 26008  		sqlite3.Xsqlite3_result_int(tls, context, sqlite3re_match(tls, *(*uintptr)(unsafe.Pointer(bp /* pRe */)), zStr, -1))
 26009  	}
 26010  	if setAux != 0 {
 26011  		sqlite3.Xsqlite3_set_auxdata(tls, context, 0, *(*uintptr)(unsafe.Pointer(bp /* pRe */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3re_free})))
 26012  	}
 26013  }
 26014  
 26015  // Invoke this routine to register the regexp() function with the
 26016  // SQLite database connection.
 26017  func sqlite3_regexp_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* regexp.c:754:5: */
 26018  	var rc int32 = SQLITE_OK
 26019  	_ = pApi
 26020  
 26021  	_ = pzErrMsg // Unused
 26022  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6335 /* "regexp" */, 2, (SQLITE_UTF8 | SQLITE_INNOCUOUS),
 26023  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 26024  			f func(*libc.TLS, uintptr, int32, uintptr)
 26025  		}{re_sql_func})), uintptr(0), uintptr(0))
 26026  	if rc == SQLITE_OK {
 26027  		// The regexpi(PATTERN,STRING) function is a case-insensitive version
 26028  		// of regexp(PATTERN,STRING).
 26029  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6342 /* "regexpi" */, 2, (SQLITE_UTF8 | SQLITE_INNOCUOUS),
 26030  			db, *(*uintptr)(unsafe.Pointer(&struct {
 26031  				f func(*libc.TLS, uintptr, int32, uintptr)
 26032  			}{re_sql_func})), uintptr(0), uintptr(0))
 26033  	}
 26034  	return rc
 26035  }
 26036  
 26037  // The following macros redefine the API routines so that they are
 26038  // redirected through the global sqlite3_api structure.
 26039  //
 26040  // This header file is also used by the loadext.c source file
 26041  // (part of the main SQLite library - not an extension) so that
 26042  // it can get access to the sqlite3_api_routines structure
 26043  // definition.  But the main library does not want to redefine
 26044  // the API.  So the redefinition macros are only valid if the
 26045  // SQLITE_CORE macros is undefined.
 26046  
 26047  // This case when the file is being statically linked into the
 26048  // application
 26049  
 26050  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 26051  //    This file is part of the GNU C Library.
 26052  //
 26053  //    The GNU C Library is free software; you can redistribute it and/or
 26054  //    modify it under the terms of the GNU Lesser General Public
 26055  //    License as published by the Free Software Foundation; either
 26056  //    version 2.1 of the License, or (at your option) any later version.
 26057  //
 26058  //    The GNU C Library is distributed in the hope that it will be useful,
 26059  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26060  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26061  //    Lesser General Public License for more details.
 26062  //
 26063  //    You should have received a copy of the GNU Lesser General Public
 26064  //    License along with the GNU C Library; if not, see
 26065  //    <http://www.gnu.org/licenses/>.
 26066  
 26067  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 26068  
 26069  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 26070  //    This file is part of the GNU C Library.
 26071  //
 26072  //    The GNU C Library is free software; you can redistribute it and/or
 26073  //    modify it under the terms of the GNU Lesser General Public
 26074  //    License as published by the Free Software Foundation; either
 26075  //    version 2.1 of the License, or (at your option) any later version.
 26076  //
 26077  //    The GNU C Library is distributed in the hope that it will be useful,
 26078  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26079  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26080  //    Lesser General Public License for more details.
 26081  //
 26082  //    You should have received a copy of the GNU Lesser General Public
 26083  //    License along with the GNU C Library; if not, see
 26084  //    <http://www.gnu.org/licenses/>.
 26085  
 26086  // These are defined by the user (or the compiler)
 26087  //    to specify the desired environment:
 26088  //
 26089  //    __STRICT_ANSI__	ISO Standard C.
 26090  //    _ISOC99_SOURCE	Extensions to ISO C89 from ISO C99.
 26091  //    _ISOC11_SOURCE	Extensions to ISO C99 from ISO C11.
 26092  //    __STDC_WANT_LIB_EXT2__
 26093  // 			Extensions to ISO C99 from TR 27431-2:2010.
 26094  //    __STDC_WANT_IEC_60559_BFP_EXT__
 26095  // 			Extensions to ISO C11 from TS 18661-1:2014.
 26096  //    __STDC_WANT_IEC_60559_FUNCS_EXT__
 26097  // 			Extensions to ISO C11 from TS 18661-4:2015.
 26098  //    __STDC_WANT_IEC_60559_TYPES_EXT__
 26099  // 			Extensions to ISO C11 from TS 18661-3:2015.
 26100  //
 26101  //    _POSIX_SOURCE	IEEE Std 1003.1.
 26102  //    _POSIX_C_SOURCE	If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
 26103  // 			if >=199309L, add IEEE Std 1003.1b-1993;
 26104  // 			if >=199506L, add IEEE Std 1003.1c-1995;
 26105  // 			if >=200112L, all of IEEE 1003.1-2004
 26106  // 			if >=200809L, all of IEEE 1003.1-2008
 26107  //    _XOPEN_SOURCE	Includes POSIX and XPG things.  Set to 500 if
 26108  // 			Single Unix conformance is wanted, to 600 for the
 26109  // 			sixth revision, to 700 for the seventh revision.
 26110  //    _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
 26111  //    _LARGEFILE_SOURCE	Some more functions for correct standard I/O.
 26112  //    _LARGEFILE64_SOURCE	Additional functionality from LFS for large files.
 26113  //    _FILE_OFFSET_BITS=N	Select default filesystem interface.
 26114  //    _ATFILE_SOURCE	Additional *at interfaces.
 26115  //    _GNU_SOURCE		All of the above, plus GNU extensions.
 26116  //    _DEFAULT_SOURCE	The default set of features (taking precedence over
 26117  // 			__STRICT_ANSI__).
 26118  //
 26119  //    _FORTIFY_SOURCE	Add security hardening to many library functions.
 26120  // 			Set to 1 or 2; 2 performs stricter checks than 1.
 26121  //
 26122  //    _REENTRANT, _THREAD_SAFE
 26123  // 			Obsolete; equivalent to _POSIX_C_SOURCE=199506L.
 26124  //
 26125  //    The `-ansi' switch to the GNU C compiler, and standards conformance
 26126  //    options such as `-std=c99', define __STRICT_ANSI__.  If none of
 26127  //    these are defined, or if _DEFAULT_SOURCE is defined, the default is
 26128  //    to have _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
 26129  //    200809L, as well as enabling miscellaneous functions from BSD and
 26130  //    SVID.  If more than one of these are defined, they accumulate.  For
 26131  //    example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE together
 26132  //    give you ISO C, 1003.1, and 1003.2, but nothing else.
 26133  //
 26134  //    These are defined by this file and are used by the
 26135  //    header files to decide what to declare or define:
 26136  //
 26137  //    __GLIBC_USE (F)	Define things from feature set F.  This is defined
 26138  // 			to 1 or 0; the subsequent macros are either defined
 26139  // 			or undefined, and those tests should be moved to
 26140  // 			__GLIBC_USE.
 26141  //    __USE_ISOC11		Define ISO C11 things.
 26142  //    __USE_ISOC99		Define ISO C99 things.
 26143  //    __USE_ISOC95		Define ISO C90 AMD1 (C95) things.
 26144  //    __USE_ISOCXX11	Define ISO C++11 things.
 26145  //    __USE_POSIX		Define IEEE Std 1003.1 things.
 26146  //    __USE_POSIX2		Define IEEE Std 1003.2 things.
 26147  //    __USE_POSIX199309	Define IEEE Std 1003.1, and .1b things.
 26148  //    __USE_POSIX199506	Define IEEE Std 1003.1, .1b, .1c and .1i things.
 26149  //    __USE_XOPEN		Define XPG things.
 26150  //    __USE_XOPEN_EXTENDED	Define X/Open Unix things.
 26151  //    __USE_UNIX98		Define Single Unix V2 things.
 26152  //    __USE_XOPEN2K        Define XPG6 things.
 26153  //    __USE_XOPEN2KXSI     Define XPG6 XSI things.
 26154  //    __USE_XOPEN2K8       Define XPG7 things.
 26155  //    __USE_XOPEN2K8XSI    Define XPG7 XSI things.
 26156  //    __USE_LARGEFILE	Define correct standard I/O things.
 26157  //    __USE_LARGEFILE64	Define LFS things with separate names.
 26158  //    __USE_FILE_OFFSET64	Define 64bit interface as default.
 26159  //    __USE_MISC		Define things from 4.3BSD or System V Unix.
 26160  //    __USE_ATFILE		Define *at interfaces and AT_* constants for them.
 26161  //    __USE_GNU		Define GNU extensions.
 26162  //    __USE_FORTIFY_LEVEL	Additional security measures used, according to level.
 26163  //
 26164  //    The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
 26165  //    defined by this file unconditionally.  `__GNU_LIBRARY__' is provided
 26166  //    only for compatibility.  All new code should use the other symbols
 26167  //    to test for features.
 26168  //
 26169  //    All macros listed above as possibly being defined by this file are
 26170  //    explicitly undefined if they are not explicitly defined.
 26171  //    Feature-test macros that are not defined by the user or compiler
 26172  //    but are implied by the other feature-test macros defined (or by the
 26173  //    lack of any definitions) are defined by the file.
 26174  //
 26175  //    ISO C feature test macros depend on the definition of the macro
 26176  //    when an affected header is included, not when the first system
 26177  //    header is included, and so they are handled in
 26178  //    <bits/libc-header-start.h>, which does not have a multiple include
 26179  //    guard.  Feature test macros that can be handled from the first
 26180  //    system header included are handled here.
 26181  
 26182  // Undefine everything, so we get a clean slate.
 26183  
 26184  // Suppress kernel-name space pollution unless user expressedly asks
 26185  //    for it.
 26186  
 26187  // Convenience macro to test the version of gcc.
 26188  //    Use like this:
 26189  //    #if __GNUC_PREREQ (2,8)
 26190  //    ... code requiring gcc 2.8 or later ...
 26191  //    #endif
 26192  //    Note: only works for GCC 2.0 and later, because __GNUC_MINOR__ was
 26193  //    added in 2.0.
 26194  
 26195  // Similarly for clang.  Features added to GCC after version 4.2 may
 26196  //    or may not also be available in clang, and clang's definitions of
 26197  //    __GNUC(_MINOR)__ are fixed at 4 and 2 respectively.  Not all such
 26198  //    features can be queried via __has_extension/__has_feature.
 26199  
 26200  // Whether to use feature set F.
 26201  
 26202  // _BSD_SOURCE and _SVID_SOURCE are deprecated aliases for
 26203  //    _DEFAULT_SOURCE.  If _DEFAULT_SOURCE is present we do not
 26204  //    issue a warning; the expectation is that the source is being
 26205  //    transitioned to use the new macro.
 26206  
 26207  // If _GNU_SOURCE was defined by the user, turn on all the other features.
 26208  
 26209  // If nothing (other than _GNU_SOURCE and _DEFAULT_SOURCE) is defined,
 26210  //    define _DEFAULT_SOURCE.
 26211  
 26212  // This is to enable the ISO C11 extension.
 26213  
 26214  // This is to enable the ISO C99 extension.
 26215  
 26216  // This is to enable the ISO C90 Amendment 1:1995 extension.
 26217  
 26218  // If none of the ANSI/POSIX macros are defined, or if _DEFAULT_SOURCE
 26219  //    is defined, use POSIX.1-2008 (or another version depending on
 26220  //    _XOPEN_SOURCE).
 26221  
 26222  // Some C libraries once required _REENTRANT and/or _THREAD_SAFE to be
 26223  //    defined in all multithreaded code.  GNU libc has not required this
 26224  //    for many years.  We now treat them as compatibility synonyms for
 26225  //    _POSIX_C_SOURCE=199506L, which is the earliest level of POSIX with
 26226  //    comprehensive support for multithreaded code.  Using them never
 26227  //    lowers the selected level of POSIX conformance, only raises it.
 26228  
 26229  // The function 'gets' existed in C89, but is impossible to use
 26230  //    safely.  It has been removed from ISO C11 and ISO C++14.  Note: for
 26231  //    compatibility with various implementations of <cstdio>, this test
 26232  //    must consider only the value of __cplusplus when compiling C++.
 26233  
 26234  // Get definitions of __STDC_* predefined macros, if the compiler has
 26235  //    not preincluded this header automatically.
 26236  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 26237  //    This file is part of the GNU C Library.
 26238  //
 26239  //    The GNU C Library is free software; you can redistribute it and/or
 26240  //    modify it under the terms of the GNU Lesser General Public
 26241  //    License as published by the Free Software Foundation; either
 26242  //    version 2.1 of the License, or (at your option) any later version.
 26243  //
 26244  //    The GNU C Library is distributed in the hope that it will be useful,
 26245  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26246  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26247  //    Lesser General Public License for more details.
 26248  //
 26249  //    You should have received a copy of the GNU Lesser General Public
 26250  //    License along with the GNU C Library; if not, see
 26251  //    <http://www.gnu.org/licenses/>.
 26252  
 26253  // This macro indicates that the installed library is the GNU C Library.
 26254  //    For historic reasons the value now is 6 and this will stay from now
 26255  //    on.  The use of this variable is deprecated.  Use __GLIBC__ and
 26256  //    __GLIBC_MINOR__ now (see below) when you want to test for a specific
 26257  //    GNU C library version and use the values in <gnu/lib-names.h> to get
 26258  //    the sonames of the shared libraries.
 26259  
 26260  // Major and minor version number of the GNU C library package.  Use
 26261  //    these macros to test for features in specific releases.
 26262  
 26263  // This is here only because every header file already includes this one.
 26264  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
 26265  //    This file is part of the GNU C Library.
 26266  //
 26267  //    The GNU C Library is free software; you can redistribute it and/or
 26268  //    modify it under the terms of the GNU Lesser General Public
 26269  //    License as published by the Free Software Foundation; either
 26270  //    version 2.1 of the License, or (at your option) any later version.
 26271  //
 26272  //    The GNU C Library is distributed in the hope that it will be useful,
 26273  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26274  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26275  //    Lesser General Public License for more details.
 26276  //
 26277  //    You should have received a copy of the GNU Lesser General Public
 26278  //    License along with the GNU C Library; if not, see
 26279  //    <http://www.gnu.org/licenses/>.
 26280  
 26281  // We are almost always included from features.h.
 26282  
 26283  // The GNU libc does not support any K&R compilers or the traditional mode
 26284  //    of ISO C compilers anymore.  Check for some of the combinations not
 26285  //    anymore supported.
 26286  
 26287  // Some user header file might have defined this before.
 26288  
 26289  // All functions, except those with callbacks or those that
 26290  //    synchronize memory, are leaf functions.
 26291  
 26292  // GCC can always grok prototypes.  For C++ programs we add throw()
 26293  //    to help it optimize the function calls.  But this works only with
 26294  //    gcc 2.8.x and egcs.  For gcc 3.2 and up we even mark C functions
 26295  //    as non-throwing using a function attribute since programs can use
 26296  //    the -fexceptions options for C code as well.
 26297  
 26298  // Compilers that are not clang may object to
 26299  //        #if defined __clang__ && __has_extension(...)
 26300  //    even though they do not need to evaluate the right-hand side of the &&.
 26301  
 26302  // These two macros are not used in glibc anymore.  They are kept here
 26303  //    only because some other projects expect the macros to be defined.
 26304  
 26305  // For these things, GCC behaves the ANSI way normally,
 26306  //    and the non-ANSI way under -traditional.
 26307  
 26308  // This is not a typedef so `const __ptr_t' does the right thing.
 26309  
 26310  // C++ needs to know that types and declarations are C, not C++.
 26311  
 26312  // Fortify support.
 26313  
 26314  // Support for flexible arrays.
 26315  //    Headers that should use flexible arrays only if they're "real"
 26316  //    (e.g. only if they won't affect sizeof()) should test
 26317  //    #if __glibc_c99_flexarr_available.
 26318  
 26319  // __asm__ ("xyz") is used throughout the headers to rename functions
 26320  //    at the assembly language level.  This is wrapped by the __REDIRECT
 26321  //    macro, in order to support compilers that can do this some other
 26322  //    way.  When compilers don't support asm-names at all, we have to do
 26323  //    preprocessor tricks instead (which don't have exactly the right
 26324  //    semantics, but it's the best we can do).
 26325  //
 26326  //    Example:
 26327  //    int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid);
 26328  
 26329  //
 26330  // #elif __SOME_OTHER_COMPILER__
 26331  //
 26332  // # define __REDIRECT(name, proto, alias) name proto; 	_Pragma("let " #name " = " #alias)
 26333  
 26334  // GCC has various useful declarations that can be made with the
 26335  //    `__attribute__' syntax.  All of the ways we use this do fine if
 26336  //    they are omitted for compilers that don't understand it.
 26337  
 26338  // At some point during the gcc 2.96 development the `malloc' attribute
 26339  //    for functions was introduced.  We don't want to use it unconditionally
 26340  //    (although this would be possible) since it generates warnings.
 26341  
 26342  // Tell the compiler which arguments to an allocation function
 26343  //    indicate the size of the allocation.
 26344  
 26345  // At some point during the gcc 2.96 development the `pure' attribute
 26346  //    for functions was introduced.  We don't want to use it unconditionally
 26347  //    (although this would be possible) since it generates warnings.
 26348  
 26349  // This declaration tells the compiler that the value is constant.
 26350  
 26351  // At some point during the gcc 3.1 development the `used' attribute
 26352  //    for functions was introduced.  We don't want to use it unconditionally
 26353  //    (although this would be possible) since it generates warnings.
 26354  
 26355  // Since version 3.2, gcc allows marking deprecated functions.
 26356  
 26357  // Since version 4.5, gcc also allows one to specify the message printed
 26358  //    when a deprecated function is used.  clang claims to be gcc 4.2, but
 26359  //    may also support this feature.
 26360  
 26361  // At some point during the gcc 2.8 development the `format_arg' attribute
 26362  //    for functions was introduced.  We don't want to use it unconditionally
 26363  //    (although this would be possible) since it generates warnings.
 26364  //    If several `format_arg' attributes are given for the same function, in
 26365  //    gcc-3.0 and older, all but the last one are ignored.  In newer gccs,
 26366  //    all designated arguments are considered.
 26367  
 26368  // At some point during the gcc 2.97 development the `strfmon' format
 26369  //    attribute for functions was introduced.  We don't want to use it
 26370  //    unconditionally (although this would be possible) since it
 26371  //    generates warnings.
 26372  
 26373  // The nonull function attribute allows to mark pointer parameters which
 26374  //    must not be NULL.
 26375  
 26376  // If fortification mode, we warn about unused results of certain
 26377  //    function calls which can lead to problems.
 26378  
 26379  // Forces a function to be always inlined.
 26380  // The Linux kernel defines __always_inline in stddef.h (283d7573), and
 26381  //    it conflicts with this definition.  Therefore undefine it first to
 26382  //    allow either header to be included first.
 26383  
 26384  // Associate error messages with the source location of the call site rather
 26385  //    than with the source location inside the function.
 26386  
 26387  // GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
 26388  //    inline semantics, unless -fgnu89-inline is used.  Using __GNUC_STDC_INLINE__
 26389  //    or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
 26390  //    older than 4.3 may define these macros and still not guarantee GNU inlining
 26391  //    semantics.
 26392  //
 26393  //    clang++ identifies itself as gcc-4.2, but has support for GNU inlining
 26394  //    semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
 26395  //    __GNUC_GNU_INLINE__ macro definitions.
 26396  
 26397  // GCC 4.3 and above allow passing all anonymous arguments of an
 26398  //    __extern_always_inline function to some other vararg function.
 26399  
 26400  // It is possible to compile containing GCC extensions even if GCC is
 26401  //    run in pedantic mode if the uses are carefully marked using the
 26402  //    `__extension__' keyword.  But this is not generally available before
 26403  //    version 2.8.
 26404  
 26405  // __restrict is known in EGCS 1.2 and above.
 26406  
 26407  // ISO C99 also allows to declare arrays as non-overlapping.  The syntax is
 26408  //      array_name[restrict]
 26409  //    GCC 3.1 supports this.
 26410  
 26411  // Describes a char array whose address can safely be passed as the first
 26412  //    argument to strncpy and strncat, as the char array is not necessarily
 26413  //    a NUL-terminated string.
 26414  
 26415  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 26416  //    This file is part of the GNU C Library.
 26417  //
 26418  //    The GNU C Library is free software; you can redistribute it and/or
 26419  //    modify it under the terms of the GNU Lesser General Public
 26420  //    License as published by the Free Software Foundation; either
 26421  //    version 2.1 of the License, or (at your option) any later version.
 26422  //
 26423  //    The GNU C Library is distributed in the hope that it will be useful,
 26424  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26425  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26426  //    Lesser General Public License for more details.
 26427  //
 26428  //    You should have received a copy of the GNU Lesser General Public
 26429  //    License along with the GNU C Library; if not, see
 26430  //    <http://www.gnu.org/licenses/>.
 26431  
 26432  // Properties of long double type.
 26433  //    Copyright (C) 2016-2018 Free Software Foundation, Inc.
 26434  //    This file is part of the GNU C Library.
 26435  //
 26436  //    The GNU C Library is free software; you can redistribute it and/or
 26437  //    modify it under the terms of the GNU Lesser General Public
 26438  //    License  published by the Free Software Foundation; either
 26439  //    version 2.1 of the License, or (at your option) any later version.
 26440  //
 26441  //    The GNU C Library is distributed in the hope that it will be useful,
 26442  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 26443  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 26444  //    Lesser General Public License for more details.
 26445  //
 26446  //    You should have received a copy of the GNU Lesser General Public
 26447  //    License along with the GNU C Library; if not, see
 26448  //    <http://www.gnu.org/licenses/>.
 26449  
 26450  // This header is included by <sys/cdefs.h>.
 26451  //
 26452  //    If long double is ABI-compatible with double, it should define
 26453  //    __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
 26454  //    __NO_LONG_DOUBLE_MATH undefined.
 26455  //
 26456  //    If this build of the GNU C Library supports both long double
 26457  //    ABI-compatible with double and some other long double format not
 26458  //    ABI-compatible with double, it should define
 26459  //    __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
 26460  //    __LONG_DOUBLE_MATH_OPTIONAL undefined.
 26461  //
 26462  //    If __NO_LONG_DOUBLE_MATH is already defined, this header must not
 26463  //    define anything; this is needed to work with the definition of
 26464  //    __NO_LONG_DOUBLE_MATH in nldbl-compat.h.
 26465  
 26466  // In the default version of this header, long double is
 26467  //    ABI-compatible with double.
 26468  
 26469  // __glibc_macro_warning (MESSAGE) issues warning MESSAGE.  This is
 26470  //    intended for use in preprocessor macros.
 26471  //
 26472  //    Note: MESSAGE must be a _single_ string; concatenation of string
 26473  //    literals is not supported.
 26474  
 26475  // Generic selection (ISO C11) is a C-only feature, available in GCC
 26476  //    since version 4.9.  Previous versions do not provide generic
 26477  //    selection, even though they might set __STDC_VERSION__ to 201112L,
 26478  //    when in -std=c11 mode.  Thus, we must check for !defined __GNUC__
 26479  //    when testing __STDC_VERSION__ for generic selection support.
 26480  //    On the other hand, Clang also defines __GNUC__, so a clang-specific
 26481  //    check is required to enable the use of generic selection.
 26482  
 26483  // If we don't have __REDIRECT, prototypes will be missing if
 26484  //    __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64].
 26485  
 26486  // Decide whether we can define 'extern inline' functions in headers.
 26487  
 26488  // This is here only because every header file already includes this one.
 26489  //    Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
 26490  //    <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
 26491  //    that will always return failure (and set errno to ENOSYS).
 26492  // This file is automatically generated.
 26493  //    This file selects the right generated file of `__stub_FUNCTION' macros
 26494  //    based on the architecture being compiled for.
 26495  
 26496  // This file is automatically generated.
 26497  //    It defines a symbol `__stub_FUNCTION' for each function
 26498  //    in the C library which is a stub, meaning it will fail
 26499  //    every time called, usually setting errno to ENOSYS.
 26500  
 26501  // void assert (int expression);
 26502  //
 26503  //    If NDEBUG is defined, do nothing.
 26504  //    If not, and EXPRESSION is zero, print an error message and abort.
 26505  
 26506  // void assert_perror (int errnum);
 26507  //
 26508  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 26509  //    error message with the error text for ERRNUM and abort.
 26510  //    (This is a GNU extension.)
 26511  
 26512  //      remember(V,PTR)
 26513  //
 26514  // Return the integer value V.  Also save the value of V in a
 26515  // C-language variable whose address is PTR.
 26516  func rememberFunc(tls *libc.TLS, pCtx uintptr, argc int32, argv uintptr) { /* remember.c:45:13: */
 26517  	var v sqlite3_int64
 26518  	var ptr uintptr
 26519  
 26520  	v = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 26521  	ptr = sqlite3.Xsqlite3_value_pointer(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+3921 /* "carray" */)
 26522  	if ptr != 0 {
 26523  		*(*sqlite3_int64)(unsafe.Pointer(ptr)) = v
 26524  	}
 26525  	sqlite3.Xsqlite3_result_int64(tls, pCtx, v)
 26526  }
 26527  
 26528  func sqlite3_remember_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* remember.c:62:5: */
 26529  	var rc int32 = SQLITE_OK
 26530  	_ = pApi
 26531  
 26532  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+6350 /* "remember" */, 2, SQLITE_UTF8, uintptr(0),
 26533  		*(*uintptr)(unsafe.Pointer(&struct {
 26534  			f func(*libc.TLS, uintptr, int32, uintptr)
 26535  		}{rememberFunc})), uintptr(0), uintptr(0))
 26536  	return rc
 26537  }
 26538  
 26539  // series_cursor is a subclass of sqlite3_vtab_cursor which will
 26540  // serve as the underlying representation of a cursor that scans
 26541  // over rows of the result
 26542  type series_cursor1 = struct {
 26543  	Fbase    sqlite3_vtab_cursor
 26544  	FisDesc  int32
 26545  	FiRowid  sqlite3_int64
 26546  	FiValue  sqlite3_int64
 26547  	FmnValue sqlite3_int64
 26548  	FmxValue sqlite3_int64
 26549  	FiStep   sqlite3_int64
 26550  } /* series.c:83:9 */
 26551  
 26552  // series_cursor is a subclass of sqlite3_vtab_cursor which will
 26553  // serve as the underlying representation of a cursor that scans
 26554  // over rows of the result
 26555  type series_cursor = series_cursor1 /* series.c:83:30 */
 26556  
 26557  // The seriesConnect() method is invoked to create a new
 26558  // series_vtab that describes the generate_series virtual table.
 26559  //
 26560  // Think of this routine as the constructor for series_vtab objects.
 26561  //
 26562  // All this routine needs to do is:
 26563  //
 26564  //    (1) Allocate the series_vtab object and initialize all fields.
 26565  //
 26566  //    (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
 26567  //        result set of queries against generate_series will look like.
 26568  func seriesConnect(tls *libc.TLS, db uintptr, pUnused uintptr, argcUnused int32, argvUnused uintptr, ppVtab uintptr, pzErrUnused uintptr) int32 { /* series.c:107:12: */
 26569  	var pNew uintptr
 26570  	var rc int32
 26571  
 26572  	// Column numbers
 26573  
 26574  	_ = pUnused
 26575  	_ = argcUnused
 26576  	_ = argvUnused
 26577  	_ = pzErrUnused
 26578  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db,
 26579  		ts+6359 /* "CREATE TABLE x(v..." */)
 26580  	if rc == SQLITE_OK {
 26581  		pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 26582  		if pNew == uintptr(0) {
 26583  			return SQLITE_NOMEM
 26584  		}
 26585  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(sqlite3_vtab{})))
 26586  		sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 26587  	}
 26588  	return rc
 26589  }
 26590  
 26591  // This method is the destructor for series_cursor objects.
 26592  func seriesDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* series.c:141:12: */
 26593  	sqlite3.Xsqlite3_free(tls, pVtab)
 26594  	return SQLITE_OK
 26595  }
 26596  
 26597  // Constructor for a new series_cursor object.
 26598  func seriesOpen(tls *libc.TLS, pUnused uintptr, ppCursor uintptr) int32 { /* series.c:149:12: */
 26599  	var pCur uintptr
 26600  	_ = pUnused
 26601  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(series_cursor{})))
 26602  	if pCur == uintptr(0) {
 26603  		return SQLITE_NOMEM
 26604  	}
 26605  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(series_cursor{})))
 26606  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 26607  	return SQLITE_OK
 26608  }
 26609  
 26610  // Destructor for a series_cursor.
 26611  func seriesClose(tls *libc.TLS, cur uintptr) int32 { /* series.c:162:12: */
 26612  	sqlite3.Xsqlite3_free(tls, cur)
 26613  	return SQLITE_OK
 26614  }
 26615  
 26616  // Advance a series_cursor to its next row of output.
 26617  func seriesNext(tls *libc.TLS, cur uintptr) int32 { /* series.c:171:12: */
 26618  	var pCur uintptr = cur
 26619  	if (*series_cursor)(unsafe.Pointer(pCur)).FisDesc != 0 {
 26620  		*(*sqlite3_int64)(unsafe.Pointer(pCur + 16 /* &.iValue */)) -= ((*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 26621  	} else {
 26622  		*(*sqlite3_int64)(unsafe.Pointer(pCur + 16 /* &.iValue */)) += ((*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 26623  	}
 26624  	(*series_cursor)(unsafe.Pointer(pCur)).FiRowid++
 26625  	return SQLITE_OK
 26626  }
 26627  
 26628  // Return values of columns for the row at which the series_cursor
 26629  // is currently pointing.
 26630  func seriesColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* series.c:186:12: */
 26631  	var pCur uintptr = cur
 26632  	var x sqlite3_int64 = int64(0)
 26633  	switch i {
 26634  	case SERIES_COLUMN_START:
 26635  		x = (*series_cursor)(unsafe.Pointer(pCur)).FmnValue
 26636  		break
 26637  	case SERIES_COLUMN_STOP:
 26638  		x = (*series_cursor)(unsafe.Pointer(pCur)).FmxValue
 26639  		break
 26640  	case SERIES_COLUMN_STEP:
 26641  		x = (*series_cursor)(unsafe.Pointer(pCur)).FiStep
 26642  		break
 26643  	default:
 26644  		x = (*series_cursor)(unsafe.Pointer(pCur)).FiValue
 26645  		break
 26646  	}
 26647  	sqlite3.Xsqlite3_result_int64(tls, ctx, x)
 26648  	return SQLITE_OK
 26649  }
 26650  
 26651  // Return the rowid for the current row. In this implementation, the
 26652  // first row returned is assigned rowid value 1, and each subsequent
 26653  // row a value 1 more than that of the previous.
 26654  func seriesRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* series.c:208:12: */
 26655  	var pCur uintptr = cur
 26656  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*series_cursor)(unsafe.Pointer(pCur)).FiRowid
 26657  	return SQLITE_OK
 26658  }
 26659  
 26660  // Return TRUE if the cursor has been moved off of the last
 26661  // row of output.
 26662  func seriesEof(tls *libc.TLS, cur uintptr) int32 { /* series.c:218:12: */
 26663  	var pCur uintptr = cur
 26664  	if (*series_cursor)(unsafe.Pointer(pCur)).FisDesc != 0 {
 26665  		return (libc.Bool32((*series_cursor)(unsafe.Pointer(pCur)).FiValue < (*series_cursor)(unsafe.Pointer(pCur)).FmnValue))
 26666  	} else {
 26667  		return (libc.Bool32((*series_cursor)(unsafe.Pointer(pCur)).FiValue > (*series_cursor)(unsafe.Pointer(pCur)).FmxValue))
 26668  	}
 26669  	return int32(0)
 26670  }
 26671  
 26672  // True to cause run-time checking of the start=, stop=, and/or step=
 26673  // parameters.  The only reason to do this is for testing the
 26674  // constraint checking logic for virtual tables in the SQLite core.
 26675  
 26676  // This method is called to "rewind" the series_cursor object back
 26677  // to the first row of output.  This method is always called at least
 26678  // once prior to any call to seriesColumn() or seriesRowid() or
 26679  // seriesEof().
 26680  //
 26681  // The query plan selected by seriesBestIndex is passed in the idxNum
 26682  // parameter.  (idxStr is not used in this implementation.)  idxNum
 26683  // is a bitmask showing which constraints are available:
 26684  //
 26685  //    1:    start=VALUE
 26686  //    2:    stop=VALUE
 26687  //    4:    step=VALUE
 26688  //
 26689  // Also, if bit 8 is set, that means that the series should be output
 26690  // in descending order rather than in ascending order.  If bit 16 is
 26691  // set, then output must appear in ascending order.
 26692  //
 26693  // This routine should initialize the cursor and position it so that it
 26694  // is pointing at the first row, or pointing off the end of the table
 26695  // (so that seriesEof() will return true) if the table is empty.
 26696  func seriesFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStrUnused uintptr, argc int32, argv uintptr) int32 { /* series.c:257:12: */
 26697  	var pCur uintptr = pVtabCursor
 26698  	var i int32 = 0
 26699  	_ = idxStrUnused
 26700  	if (idxNum & 1) != 0 {
 26701  		(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*4)))
 26702  	} else {
 26703  		(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = int64(0)
 26704  	}
 26705  	if (idxNum & 2) != 0 {
 26706  		(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*4)))
 26707  	} else {
 26708  		(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0xffffffff)
 26709  	}
 26710  	if (idxNum & 4) != 0 {
 26711  		(*series_cursor)(unsafe.Pointer(pCur)).FiStep = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&i, 1))*4)))
 26712  		if (*series_cursor)(unsafe.Pointer(pCur)).FiStep == int64(0) {
 26713  			(*series_cursor)(unsafe.Pointer(pCur)).FiStep = int64(1)
 26714  		} else if (*series_cursor)(unsafe.Pointer(pCur)).FiStep < int64(0) {
 26715  			(*series_cursor)(unsafe.Pointer(pCur)).FiStep = -(*series_cursor)(unsafe.Pointer(pCur)).FiStep
 26716  			if (idxNum & 16) == 0 {
 26717  				idxNum = idxNum | (8)
 26718  			}
 26719  		}
 26720  	} else {
 26721  		(*series_cursor)(unsafe.Pointer(pCur)).FiStep = int64(1)
 26722  	}
 26723  	for i = 0; i < argc; i++ {
 26724  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) == SQLITE_NULL {
 26725  			// If any of the constraints have a NULL value, then return no rows.
 26726  			// See ticket https://www.sqlite.org/src/info/fac496b61722daf2
 26727  			(*series_cursor)(unsafe.Pointer(pCur)).FmnValue = int64(1)
 26728  			(*series_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0)
 26729  			break
 26730  		}
 26731  	}
 26732  	if (idxNum & 8) != 0 {
 26733  		(*series_cursor)(unsafe.Pointer(pCur)).FisDesc = 1
 26734  		(*series_cursor)(unsafe.Pointer(pCur)).FiValue = (*series_cursor)(unsafe.Pointer(pCur)).FmxValue
 26735  		if (*series_cursor)(unsafe.Pointer(pCur)).FiStep > int64(0) {
 26736  			*(*sqlite3_int64)(unsafe.Pointer(pCur + 16 /* &.iValue */)) -= (((*series_cursor)(unsafe.Pointer(pCur)).FmxValue - (*series_cursor)(unsafe.Pointer(pCur)).FmnValue) % (*series_cursor)(unsafe.Pointer(pCur)).FiStep)
 26737  		}
 26738  	} else {
 26739  		(*series_cursor)(unsafe.Pointer(pCur)).FisDesc = 0
 26740  		(*series_cursor)(unsafe.Pointer(pCur)).FiValue = (*series_cursor)(unsafe.Pointer(pCur)).FmnValue
 26741  	}
 26742  	(*series_cursor)(unsafe.Pointer(pCur)).FiRowid = int64(1)
 26743  	return SQLITE_OK
 26744  }
 26745  
 26746  // SQLite will invoke this method one or more times while planning a query
 26747  // that uses the generate_series virtual table.  This routine needs to create
 26748  // a query plan for each invocation and compute an estimated cost for that
 26749  // plan.
 26750  //
 26751  // In this implementation idxNum is used to represent the
 26752  // query plan.  idxStr is unused.
 26753  //
 26754  // The query plan is represented by bits in idxNum:
 26755  //
 26756  //  (1)  start = $value  -- constraint exists
 26757  //  (2)  stop = $value   -- constraint exists
 26758  //  (4)  step = $value   -- constraint exists
 26759  //  (8)  output in descending order
 26760  func seriesBestIndex(tls *libc.TLS, tabUnused uintptr, pIdxInfo uintptr) int32 { /* series.c:325:12: */
 26761  	bp := tls.Alloc(12)
 26762  	defer tls.Free(12)
 26763  
 26764  	var i int32
 26765  	var j int32                // Loop over constraints
 26766  	var idxNum int32 = 0       // The query plan bitmask
 26767  	var unusableMask int32 = 0 // Mask of unusable constraints
 26768  	var nArg int32 = 0         // Number of arguments that seriesFilter() expects
 26769  	// var aIdx [3]int32 at bp, 12
 26770  	// Constraints on start, stop, and step
 26771  	var pConstraint uintptr
 26772  
 26773  	// This implementation assumes that the start, stop, and step columns
 26774  	// are the last three columns in the virtual table.
 26775  
 26776  	_ = tabUnused
 26777  	*(*int32)(unsafe.Pointer(bp /* &aIdx[0] */)) = libc.AssignPtrInt32(bp /* &aIdx */ +1*4, libc.AssignPtrInt32(bp /* &aIdx */ +2*4, -1))
 26778  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 26779  	i = 0
 26780  __1:
 26781  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 26782  		goto __3
 26783  	}
 26784  	{
 26785  		var iCol int32  // 0 for start, 1 for stop, 2 for step
 26786  		var iMask int32 // bitmask for those column
 26787  		if (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < SERIES_COLUMN_START {
 26788  			goto __2
 26789  		}
 26790  		iCol = ((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn - SERIES_COLUMN_START)
 26791  
 26792  		iMask = (int32(1) << iCol)
 26793  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 26794  			unusableMask = unusableMask | (iMask)
 26795  			goto __2
 26796  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 26797  			idxNum = idxNum | (iMask)
 26798  			*(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + uintptr(iCol)*4)) = i
 26799  		}
 26800  
 26801  	}
 26802  	goto __2
 26803  __2:
 26804  	i++
 26805  	pConstraint += 12
 26806  	goto __1
 26807  	goto __3
 26808  __3:
 26809  	;
 26810  	for i = 0; i < 3; i++ {
 26811  		if (libc.AssignInt32(&j, *(*int32)(unsafe.Pointer(bp /* &aIdx[0] */ + uintptr(i)*4)))) >= 0 {
 26812  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).FargvIndex = libc.PreIncInt32(&nArg, 1)
 26813  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(j)*8)).Fomit = libc.BoolUint8(!(1 != 0))
 26814  		}
 26815  	}
 26816  	if (unusableMask & ^idxNum) != 0 {
 26817  		// The start, stop, and step columns are inputs.  Therefore if there
 26818  		// are unusable constraints on any of start, stop, or step then
 26819  		// this plan is unusable
 26820  		return SQLITE_CONSTRAINT
 26821  	}
 26822  	if (idxNum & 3) == 3 {
 26823  		// Both start= and stop= boundaries are available.  This is the
 26824  		// the preferred case
 26825  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (float64(2 - (libc.Bool32((idxNum & 4) != 0))))
 26826  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1000)
 26827  		if (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1 {
 26828  			if (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc != 0 {
 26829  				idxNum = idxNum | (8)
 26830  			} else {
 26831  				idxNum = idxNum | (16)
 26832  			}
 26833  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 26834  		}
 26835  	} else {
 26836  		// If either boundary is missing, we have to generate a huge span
 26837  		// of numbers.  Make this case very expensive so that the query
 26838  		// planner will work hard to avoid it.
 26839  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(2147483647)
 26840  	}
 26841  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 26842  	return SQLITE_OK
 26843  }
 26844  
 26845  // This following structure defines all the methods for the
 26846  // generate_series virtual table.
 26847  var seriesModule = sqlite3_module{ // xCreate
 26848  	FxConnect:    0, // xConnect
 26849  	FxBestIndex:  0, // xBestIndex
 26850  	FxDisconnect: 0, // xDestroy
 26851  	FxOpen:       0, // xOpen - open a cursor
 26852  	FxClose:      0, // xClose - close a cursor
 26853  	FxFilter:     0, // xFilter - configure scan constraints
 26854  	FxNext:       0, // xNext - advance a cursor
 26855  	FxEof:        0, // xEof - check for end of scan
 26856  	FxColumn:     0, // xColumn - read data
 26857  	FxRowid:      0, // xShadowName
 26858  } /* series.c:397:23 */
 26859  
 26860  func sqlite3_series_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* series.c:429:5: */
 26861  	var rc int32 = SQLITE_OK
 26862  	_ = pApi
 26863  
 26864  	if sqlite3.Xsqlite3_libversion_number(tls) < 3008012 {
 26865  		*(*uintptr)(unsafe.Pointer(pzErrMsg)) = sqlite3.Xsqlite3_mprintf(tls,
 26866  			ts+6418 /* "generate_series(..." */, 0)
 26867  		return SQLITE_ERROR
 26868  	}
 26869  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+6468 /* "generate_series" */, uintptr(unsafe.Pointer(&seriesModule)), uintptr(0))
 26870  	return rc
 26871  }
 26872  
 26873  type u16 = uint16 /* spellfix.c:34:26 */
 26874  
 26875  // Character classes for ASCII characters:
 26876  //
 26877  //   0   ''        Silent letters:   H W
 26878  //   1   'A'       Any vowel:   A E I O U (Y)
 26879  //   2   'B'       A bilabeal stop or fricative:  B F P V W
 26880  //   3   'C'       Other fricatives or back stops:  C G J K Q S X Z
 26881  //   4   'D'       Alveolar stops:  D T
 26882  //   5   'H'       Letter H at the beginning of a word
 26883  //   6   'L'       Glide:  L
 26884  //   7   'R'       Semivowel:  R
 26885  //   8   'M'       Nasals:  M N
 26886  //   9   'Y'       Letter Y at the beginning of a word.
 26887  //   10  '9'       Digits: 0 1 2 3 4 5 6 7 8 9
 26888  //   11  ' '       White space
 26889  //   12  '?'       Other.
 26890  
 26891  // The following table gives the character class for non-initial ASCII
 26892  // characters.
 26893  var midClass = [128]uint8{
 26894  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26895  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26896  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26897  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26898  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER),
 26899  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26900  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26901  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26902  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26903  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26904  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_SPACE),
 26905  	/* ! */ uint8(CCLASS_OTHER) /* " */, uint8(CCLASS_OTHER) /* # */, uint8(CCLASS_OTHER),
 26906  	/* $ */ uint8(CCLASS_OTHER) /* % */, uint8(CCLASS_OTHER) /* & */, uint8(CCLASS_OTHER),
 26907  	/* ' */ uint8(CCLASS_SILENT) /* ( */, uint8(CCLASS_OTHER) /* ) */, uint8(CCLASS_OTHER),
 26908  	/* * */ uint8(CCLASS_OTHER) /* + */, uint8(CCLASS_OTHER) /* , */, uint8(CCLASS_OTHER),
 26909  	/* - */ uint8(CCLASS_OTHER) /* . */, uint8(CCLASS_OTHER) /* / */, uint8(CCLASS_OTHER),
 26910  	/* 0 */ uint8(CCLASS_DIGIT) /* 1 */, uint8(CCLASS_DIGIT) /* 2 */, uint8(CCLASS_DIGIT),
 26911  	/* 3 */ uint8(CCLASS_DIGIT) /* 4 */, uint8(CCLASS_DIGIT) /* 5 */, uint8(CCLASS_DIGIT),
 26912  	/* 6 */ uint8(CCLASS_DIGIT) /* 7 */, uint8(CCLASS_DIGIT) /* 8 */, uint8(CCLASS_DIGIT),
 26913  	/* 9 */ uint8(CCLASS_DIGIT) /* : */, uint8(CCLASS_OTHER) /* ; */, uint8(CCLASS_OTHER),
 26914  	/* < */ uint8(CCLASS_OTHER) /* = */, uint8(CCLASS_OTHER) /* > */, uint8(CCLASS_OTHER),
 26915  	/* ? */ uint8(CCLASS_OTHER) /* @ */, uint8(CCLASS_OTHER) /* A */, uint8(CCLASS_VOWEL),
 26916  	/* B */ uint8(CCLASS_B) /* C */, uint8(CCLASS_C) /* D */, uint8(CCLASS_D),
 26917  	/* E */ uint8(CCLASS_VOWEL) /* F */, uint8(CCLASS_B) /* G */, uint8(CCLASS_C),
 26918  	/* H */ uint8(CCLASS_SILENT) /* I */, uint8(CCLASS_VOWEL) /* J */, uint8(CCLASS_C),
 26919  	/* K */ uint8(CCLASS_C) /* L */, uint8(CCLASS_L) /* M */, uint8(CCLASS_M),
 26920  	/* N */ uint8(CCLASS_M) /* O */, uint8(CCLASS_VOWEL) /* P */, uint8(CCLASS_B),
 26921  	/* Q */ uint8(CCLASS_C) /* R */, uint8(CCLASS_R) /* S */, uint8(CCLASS_C),
 26922  	/* T */ uint8(CCLASS_D) /* U */, uint8(CCLASS_VOWEL) /* V */, uint8(CCLASS_B),
 26923  	/* W */ uint8(CCLASS_B) /* X */, uint8(CCLASS_C) /* Y */, uint8(CCLASS_VOWEL),
 26924  	/* Z */ uint8(CCLASS_C) /* [ */, uint8(CCLASS_OTHER) /* \ */, uint8(CCLASS_OTHER),
 26925  	/* ] */ uint8(CCLASS_OTHER) /* ^ */, uint8(CCLASS_OTHER) /* _ */, uint8(CCLASS_OTHER),
 26926  	/* ` */ uint8(CCLASS_OTHER) /* a */, uint8(CCLASS_VOWEL) /* b */, uint8(CCLASS_B),
 26927  	/* c */ uint8(CCLASS_C) /* d */, uint8(CCLASS_D) /* e */, uint8(CCLASS_VOWEL),
 26928  	/* f */ uint8(CCLASS_B) /* g */, uint8(CCLASS_C) /* h */, uint8(CCLASS_SILENT),
 26929  	/* i */ uint8(CCLASS_VOWEL) /* j */, uint8(CCLASS_C) /* k */, uint8(CCLASS_C),
 26930  	/* l */ uint8(CCLASS_L) /* m */, uint8(CCLASS_M) /* n */, uint8(CCLASS_M),
 26931  	/* o */ uint8(CCLASS_VOWEL) /* p */, uint8(CCLASS_B) /* q */, uint8(CCLASS_C),
 26932  	/* r */ uint8(CCLASS_R) /* s */, uint8(CCLASS_C) /* t */, uint8(CCLASS_D),
 26933  	/* u */ uint8(CCLASS_VOWEL) /* v */, uint8(CCLASS_B) /* w */, uint8(CCLASS_B),
 26934  	/* x */ uint8(CCLASS_C) /* y */, uint8(CCLASS_VOWEL) /* z */, uint8(CCLASS_C),
 26935  	/* { */ uint8(CCLASS_OTHER) /* | */, uint8(CCLASS_OTHER) /* } */, uint8(CCLASS_OTHER),
 26936  	/* ~ */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26937  } /* spellfix.c:75:28 */
 26938  // This tables gives the character class for ASCII characters that form the
 26939  // initial character of a word.  The only difference from midClass is with
 26940  // the letters H, W, and Y.
 26941  var initClass = [128]uint8{
 26942  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26943  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26944  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26945  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26946  	/*   */ uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_SPACE) /*   */, uint8(CCLASS_OTHER),
 26947  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26948  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26949  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26950  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26951  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26952  	/*   */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_SPACE),
 26953  	/* ! */ uint8(CCLASS_OTHER) /* " */, uint8(CCLASS_OTHER) /* # */, uint8(CCLASS_OTHER),
 26954  	/* $ */ uint8(CCLASS_OTHER) /* % */, uint8(CCLASS_OTHER) /* & */, uint8(CCLASS_OTHER),
 26955  	/* ' */ uint8(CCLASS_OTHER) /* ( */, uint8(CCLASS_OTHER) /* ) */, uint8(CCLASS_OTHER),
 26956  	/* * */ uint8(CCLASS_OTHER) /* + */, uint8(CCLASS_OTHER) /* , */, uint8(CCLASS_OTHER),
 26957  	/* - */ uint8(CCLASS_OTHER) /* . */, uint8(CCLASS_OTHER) /* / */, uint8(CCLASS_OTHER),
 26958  	/* 0 */ uint8(CCLASS_DIGIT) /* 1 */, uint8(CCLASS_DIGIT) /* 2 */, uint8(CCLASS_DIGIT),
 26959  	/* 3 */ uint8(CCLASS_DIGIT) /* 4 */, uint8(CCLASS_DIGIT) /* 5 */, uint8(CCLASS_DIGIT),
 26960  	/* 6 */ uint8(CCLASS_DIGIT) /* 7 */, uint8(CCLASS_DIGIT) /* 8 */, uint8(CCLASS_DIGIT),
 26961  	/* 9 */ uint8(CCLASS_DIGIT) /* : */, uint8(CCLASS_OTHER) /* ; */, uint8(CCLASS_OTHER),
 26962  	/* < */ uint8(CCLASS_OTHER) /* = */, uint8(CCLASS_OTHER) /* > */, uint8(CCLASS_OTHER),
 26963  	/* ? */ uint8(CCLASS_OTHER) /* @ */, uint8(CCLASS_OTHER) /* A */, uint8(CCLASS_VOWEL),
 26964  	/* B */ uint8(CCLASS_B) /* C */, uint8(CCLASS_C) /* D */, uint8(CCLASS_D),
 26965  	/* E */ uint8(CCLASS_VOWEL) /* F */, uint8(CCLASS_B) /* G */, uint8(CCLASS_C),
 26966  	/* H */ uint8(CCLASS_SILENT) /* I */, uint8(CCLASS_VOWEL) /* J */, uint8(CCLASS_C),
 26967  	/* K */ uint8(CCLASS_C) /* L */, uint8(CCLASS_L) /* M */, uint8(CCLASS_M),
 26968  	/* N */ uint8(CCLASS_M) /* O */, uint8(CCLASS_VOWEL) /* P */, uint8(CCLASS_B),
 26969  	/* Q */ uint8(CCLASS_C) /* R */, uint8(CCLASS_R) /* S */, uint8(CCLASS_C),
 26970  	/* T */ uint8(CCLASS_D) /* U */, uint8(CCLASS_VOWEL) /* V */, uint8(CCLASS_B),
 26971  	/* W */ uint8(CCLASS_B) /* X */, uint8(CCLASS_C) /* Y */, uint8(CCLASS_Y),
 26972  	/* Z */ uint8(CCLASS_C) /* [ */, uint8(CCLASS_OTHER) /* \ */, uint8(CCLASS_OTHER),
 26973  	/* ] */ uint8(CCLASS_OTHER) /* ^ */, uint8(CCLASS_OTHER) /* _ */, uint8(CCLASS_OTHER),
 26974  	/* ` */ uint8(CCLASS_OTHER) /* a */, uint8(CCLASS_VOWEL) /* b */, uint8(CCLASS_B),
 26975  	/* c */ uint8(CCLASS_C) /* d */, uint8(CCLASS_D) /* e */, uint8(CCLASS_VOWEL),
 26976  	/* f */ uint8(CCLASS_B) /* g */, uint8(CCLASS_C) /* h */, uint8(CCLASS_SILENT),
 26977  	/* i */ uint8(CCLASS_VOWEL) /* j */, uint8(CCLASS_C) /* k */, uint8(CCLASS_C),
 26978  	/* l */ uint8(CCLASS_L) /* m */, uint8(CCLASS_M) /* n */, uint8(CCLASS_M),
 26979  	/* o */ uint8(CCLASS_VOWEL) /* p */, uint8(CCLASS_B) /* q */, uint8(CCLASS_C),
 26980  	/* r */ uint8(CCLASS_R) /* s */, uint8(CCLASS_C) /* t */, uint8(CCLASS_D),
 26981  	/* u */ uint8(CCLASS_VOWEL) /* v */, uint8(CCLASS_B) /* w */, uint8(CCLASS_B),
 26982  	/* x */ uint8(CCLASS_C) /* y */, uint8(CCLASS_Y) /* z */, uint8(CCLASS_C),
 26983  	/* { */ uint8(CCLASS_OTHER) /* | */, uint8(CCLASS_OTHER) /* } */, uint8(CCLASS_OTHER),
 26984  	/* ~ */ uint8(CCLASS_OTHER) /*   */, uint8(CCLASS_OTHER),
 26985  } /* spellfix.c:125:28 */
 26986  
 26987  // Mapping from the character class number (0-13) to a symbol for each
 26988  // character class.  Note that initClass[] can be used to map the class
 26989  // symbol back into the class number.
 26990  var className = *(*[14]uint8)(unsafe.Pointer(ts + 6484 /* ".ABCDHLRMY9 ?" */)) /* spellfix.c:176:28 */
 26991  
 26992  // Generate a "phonetic hash" from a string of ASCII characters
 26993  // in zIn[0..nIn-1].
 26994  //
 26995  //   * Map characters by character class as defined above.
 26996  //   * Omit double-letters
 26997  //   * Omit vowels beside R and L
 26998  //   * Omit T when followed by CH
 26999  //   * Omit W when followed by R
 27000  //   * Omit D when followed by J or G
 27001  //   * Omit K in KN or G in GN at the beginning of a word
 27002  //
 27003  // Space to hold the result is obtained from sqlite3_malloc()
 27004  //
 27005  // Return NULL if memory allocation fails.
 27006  func phoneticHash(tls *libc.TLS, zIn uintptr, nIn int32) uintptr { /* spellfix.c:194:22: */
 27007  	var zOut uintptr = sqlite3.Xsqlite3_malloc64(tls, (uint64(nIn + 1)))
 27008  	var i int32
 27009  	var nOut int32 = 0
 27010  	var cPrev int8 = int8(0x77)
 27011  	var cPrevX int8 = int8(0x77)
 27012  	var aClass uintptr = uintptr(unsafe.Pointer(&initClass))
 27013  
 27014  	if zOut == uintptr(0) {
 27015  		return uintptr(0)
 27016  	}
 27017  	if nIn > 2 {
 27018  		switch int32(*(*uint8)(unsafe.Pointer(zIn))) {
 27019  		case 'g':
 27020  			fallthrough
 27021  		case 'k':
 27022  			{
 27023  				if int32(*(*uint8)(unsafe.Pointer(zIn + 1))) == 'n' {
 27024  					zIn++
 27025  					nIn--
 27026  				}
 27027  				break
 27028  
 27029  			}
 27030  		}
 27031  	}
 27032  	for i = 0; i < nIn; i++ {
 27033  		var c uint8 = *(*uint8)(unsafe.Pointer(zIn + uintptr(i)))
 27034  		if (i + 1) < nIn {
 27035  			if (int32(c) == 'w') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'r') {
 27036  				continue
 27037  			}
 27038  			if (int32(c) == 'd') && ((int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'j') || (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'g')) {
 27039  				continue
 27040  			}
 27041  			if (i + 2) < nIn {
 27042  				if ((int32(c) == 't') && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 1))))) == 'c')) && (int32(*(*uint8)(unsafe.Pointer(zIn + uintptr((i + 2))))) == 'h') {
 27043  					continue
 27044  				}
 27045  			}
 27046  		}
 27047  		c = *(*uint8)(unsafe.Pointer(aClass + uintptr((int32(c) & 0x7f))))
 27048  		if int32(c) == CCLASS_SPACE {
 27049  			continue
 27050  		}
 27051  		if (int32(c) == CCLASS_OTHER) && (int32(cPrev) != CCLASS_DIGIT) {
 27052  			continue
 27053  		}
 27054  		aClass = uintptr(unsafe.Pointer(&midClass))
 27055  		if (int32(c) == CCLASS_VOWEL) && ((int32(cPrevX) == CCLASS_R) || (int32(cPrevX) == CCLASS_L)) {
 27056  			continue /* No vowels beside L or R */
 27057  		}
 27058  		if ((int32(c) == CCLASS_R) || (int32(c) == CCLASS_L)) && (int32(cPrevX) == CCLASS_VOWEL) {
 27059  			nOut-- // No vowels beside L or R
 27060  		}
 27061  		cPrev = int8(c)
 27062  		if int32(c) == CCLASS_SILENT {
 27063  			continue
 27064  		}
 27065  		cPrevX = int8(c)
 27066  		c = className[c]
 27067  
 27068  		if (nOut == 0) || (int32(c) != int32(*(*uint8)(unsafe.Pointer(zOut + uintptr((nOut - 1)))))) {
 27069  			*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = c
 27070  		}
 27071  	}
 27072  	*(*uint8)(unsafe.Pointer(zOut + uintptr(nOut))) = uint8(0)
 27073  	return zOut
 27074  }
 27075  
 27076  // This is an SQL function wrapper around phoneticHash().  See
 27077  // the description of phoneticHash() for additional information.
 27078  func phoneticHashSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:246:13: */
 27079  	var zIn uintptr
 27080  	var zOut uintptr
 27081  
 27082  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 27083  	if zIn == uintptr(0) {
 27084  		return
 27085  	}
 27086  	zOut = phoneticHash(tls, zIn, sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))))
 27087  	if zOut == uintptr(0) {
 27088  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 27089  	} else {
 27090  		sqlite3.Xsqlite3_result_text(tls, context, zOut, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 27091  	}
 27092  }
 27093  
 27094  // Return the character class number for a character given its
 27095  // context.
 27096  func characterClass(tls *libc.TLS, cPrev int8, c int8) int8 { /* spellfix.c:268:13: */
 27097  	if int32(cPrev) == 0 {
 27098  		return int8(initClass[(int32(c) & 0x7f)])
 27099  	}
 27100  	return int8(midClass[(int32(c) & 0x7f)])
 27101  }
 27102  
 27103  // Return the cost of inserting or deleting character c immediately
 27104  // following character cPrev.  If cPrev==0, that means c is the first
 27105  // character of the word.
 27106  func insertOrDeleteCost(tls *libc.TLS, cPrev int8, c int8, cNext int8) int32 { /* spellfix.c:277:12: */
 27107  	var classC int8 = characterClass(tls, cPrev, c)
 27108  	var classCprev int8
 27109  
 27110  	if int32(classC) == CCLASS_SILENT {
 27111  		// Insert or delete "silent" characters such as H or W
 27112  		return 1
 27113  	}
 27114  	if int32(cPrev) == int32(c) {
 27115  		// Repeated characters, or miss a repeat
 27116  		return 10
 27117  	}
 27118  	if (int32(classC) == CCLASS_VOWEL) && ((int32(cPrev) == 'r') || (int32(cNext) == 'r')) {
 27119  		return 20 // Insert a vowel before or after 'r'
 27120  	}
 27121  	classCprev = characterClass(tls, cPrev, cPrev)
 27122  	if int32(classC) == int32(classCprev) {
 27123  		if int32(classC) == CCLASS_VOWEL {
 27124  			// Remove or add a new vowel to a vowel cluster
 27125  			return 15
 27126  		} else {
 27127  			// Remove or add a consonant not in the same class
 27128  			return 50
 27129  		}
 27130  	}
 27131  
 27132  	// any other character insertion or deletion
 27133  	return 100
 27134  }
 27135  
 27136  // Divide the insertion cost by this factor when appending to the
 27137  // end of the word.
 27138  
 27139  // Return the cost of substituting cTo in place of cFrom assuming
 27140  // the previous character is cPrev.  If cPrev==0 then cTo is the first
 27141  // character of the word.
 27142  func substituteCost(tls *libc.TLS, cPrev int8, cFrom int8, cTo int8) int32 { /* spellfix.c:318:12: */
 27143  	var classFrom int8
 27144  	var classTo int8
 27145  	if int32(cFrom) == int32(cTo) {
 27146  		// Exact match
 27147  		return 0
 27148  	}
 27149  	if (int32(cFrom) == (int32(cTo) ^ 0x20)) && (((int32(cTo) >= 'A') && (int32(cTo) <= 'Z')) || ((int32(cTo) >= 'a') && (int32(cTo) <= 'z'))) {
 27150  		// differ only in case
 27151  		return 0
 27152  	}
 27153  	classFrom = characterClass(tls, cPrev, cFrom)
 27154  	classTo = characterClass(tls, cPrev, cTo)
 27155  	if int32(classFrom) == int32(classTo) {
 27156  		// Same character class
 27157  		return 40
 27158  	}
 27159  	if (((int32(classFrom) >= CCLASS_B) && (int32(classFrom) <= CCLASS_Y)) &&
 27160  		(int32(classTo) >= CCLASS_B)) && (int32(classTo) <= CCLASS_Y) {
 27161  		// Convert from one consonant to another, but in a different class
 27162  		return 75
 27163  	}
 27164  	// Any other subsitution
 27165  	return 100
 27166  }
 27167  
 27168  // Given two strings zA and zB which are pure ASCII, return the cost
 27169  // of transforming zA into zB.  If zA ends with '*' assume that it is
 27170  // a prefix of zB and give only minimal penalty for extra characters
 27171  // on the end of zB.
 27172  //
 27173  // Smaller numbers mean a closer match.
 27174  //
 27175  // Negative values indicate an error:
 27176  //    -1  One of the inputs is NULL
 27177  //    -2  Non-ASCII characters on input
 27178  //    -3  Unable to allocate memory
 27179  //
 27180  // If pnMatch is not NULL, then *pnMatch is set to the number of bytes
 27181  // of zB that matched the pattern in zA. If zA does not end with a '*',
 27182  // then this value is always the number of bytes in zB (i.e. strlen(zB)).
 27183  // If zA does end in a '*', then it is the number of bytes in the prefix
 27184  // of zB that was deemed to match zA.
 27185  func editdist1(tls *libc.TLS, zA uintptr, zB uintptr, pnMatch uintptr) int32 { /* spellfix.c:362:12: */
 27186  	bp := tls.Alloc(300)
 27187  	defer tls.Free(300)
 27188  
 27189  	var nA int32
 27190  	var nB int32 // Number of characters in zA[] and zB[]
 27191  	var xA int32
 27192  	var xB int32 // Loop counters for zA[] and zB[]
 27193  	var cA int8 = int8(0)
 27194  	var cB int8 // Current character of zA and zB
 27195  	var cAprev int8
 27196  	var cBprev int8 // Previous character of zA and zB
 27197  	var cAnext int8
 27198  	var cBnext int8                 // Next character in zA and zB
 27199  	var d int32                     // North-west cost value
 27200  	var dc int32 = 0                // North-west character value
 27201  	var res int32                   // Final result
 27202  	var m uintptr                   // The cost matrix
 27203  	var cx uintptr                  // Corresponding character values
 27204  	var toFree uintptr = uintptr(0) // Malloced space
 27205  	var nMatch int32 = 0
 27206  	// var mStack [75]int32 at bp, 300
 27207  	// Stack space to use if not too much is needed
 27208  
 27209  	// Early out if either input is NULL
 27210  	if (zA == uintptr(0)) || (zB == uintptr(0)) {
 27211  		return -1
 27212  	}
 27213  
 27214  	// Skip any common prefix
 27215  	for (*(*int8)(unsafe.Pointer(zA)) != 0) && (int32(*(*int8)(unsafe.Pointer(zA))) == int32(*(*int8)(unsafe.Pointer(zB)))) {
 27216  		dc = int32(*(*int8)(unsafe.Pointer(zA)))
 27217  		zA++
 27218  		zB++
 27219  		nMatch++
 27220  	}
 27221  	if pnMatch != 0 {
 27222  		*(*int32)(unsafe.Pointer(pnMatch)) = nMatch
 27223  	}
 27224  	if (int32(*(*int8)(unsafe.Pointer(zA))) == 0) && (int32(*(*int8)(unsafe.Pointer(zB))) == 0) {
 27225  		return 0
 27226  	}
 27227  
 27228  	// Verify input strings and measure their lengths
 27229  	for nA = 0; *(*int8)(unsafe.Pointer(zA + uintptr(nA))) != 0; nA++ {
 27230  		if (int32(*(*int8)(unsafe.Pointer(zA + uintptr(nA)))) & 0x80) != 0 {
 27231  			return -2
 27232  		}
 27233  	}
 27234  	for nB = 0; *(*int8)(unsafe.Pointer(zB + uintptr(nB))) != 0; nB++ {
 27235  		if (int32(*(*int8)(unsafe.Pointer(zB + uintptr(nB)))) & 0x80) != 0 {
 27236  			return -2
 27237  		}
 27238  	}
 27239  
 27240  	// Special processing if either string is empty
 27241  	if nA == 0 {
 27242  		cBprev = int8(dc)
 27243  		for xB = libc.AssignInt32(&res, 0); (int32(libc.AssignInt8(&cB, *(*int8)(unsafe.Pointer(zB + uintptr(xB)))))) != 0; xB++ {
 27244  			res = res + (insertOrDeleteCost(tls, cBprev, cB, *(*int8)(unsafe.Pointer(zB + uintptr((xB + 1))))) / FINAL_INS_COST_DIV)
 27245  			cBprev = cB
 27246  		}
 27247  		return res
 27248  	}
 27249  	if nB == 0 {
 27250  		cAprev = int8(dc)
 27251  		for xA = libc.AssignInt32(&res, 0); (int32(libc.AssignInt8(&cA, *(*int8)(unsafe.Pointer(zA + uintptr(xA)))))) != 0; xA++ {
 27252  			res = res + (insertOrDeleteCost(tls, cAprev, cA, *(*int8)(unsafe.Pointer(zA + uintptr((xA + 1))))))
 27253  			cAprev = cA
 27254  		}
 27255  		return res
 27256  	}
 27257  
 27258  	// A is a prefix of B
 27259  	if (int32(*(*int8)(unsafe.Pointer(zA))) == '*') && (int32(*(*int8)(unsafe.Pointer(zA + 1))) == 0) {
 27260  		return 0
 27261  	}
 27262  
 27263  	// Allocate and initialize the Wagner matrix
 27264  	if uint32(nB) < ((uint32(unsafe.Sizeof([75]int32{})) * uint32(4)) / (uint32(unsafe.Sizeof(int32(0))) * uint32(5))) {
 27265  		m = bp /* &mStack[0] */
 27266  	} else {
 27267  		m = libc.AssignUintptr(&toFree, sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint32((nB+1)*5))*uint32(unsafe.Sizeof(int32(0))))/uint32(4)))))
 27268  		if m == uintptr(0) {
 27269  			return -3
 27270  		}
 27271  	}
 27272  	cx = (m + uintptr((nB+1))*4)
 27273  
 27274  	// Compute the Wagner edit distance
 27275  	*(*int32)(unsafe.Pointer(m)) = 0
 27276  	*(*int8)(unsafe.Pointer(cx)) = int8(dc)
 27277  	cBprev = int8(dc)
 27278  	for xB = 1; xB <= nB; xB++ {
 27279  		cBnext = *(*int8)(unsafe.Pointer(zB + uintptr(xB)))
 27280  		cB = *(*int8)(unsafe.Pointer(zB + uintptr((xB - 1))))
 27281  		*(*int8)(unsafe.Pointer(cx + uintptr(xB))) = cB
 27282  		*(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) = (*(*int32)(unsafe.Pointer(m + uintptr((xB-1))*4)) + insertOrDeleteCost(tls, cBprev, cB, cBnext))
 27283  		cBprev = cB
 27284  	}
 27285  	cAprev = int8(dc)
 27286  	for xA = 1; xA <= nA; xA++ {
 27287  		var lastA int32 = (libc.Bool32(xA == nA))
 27288  		cA = *(*int8)(unsafe.Pointer(zA + uintptr((xA - 1))))
 27289  		cAnext = *(*int8)(unsafe.Pointer(zA + uintptr(xA)))
 27290  		if (int32(cA) == '*') && (lastA != 0) {
 27291  			break
 27292  		}
 27293  		d = *(*int32)(unsafe.Pointer(m))
 27294  		dc = int32(*(*int8)(unsafe.Pointer(cx)))
 27295  		*(*int32)(unsafe.Pointer(m)) = (d + insertOrDeleteCost(tls, cAprev, cA, cAnext))
 27296  		cBprev = int8(0)
 27297  		for xB = 1; xB <= nB; xB++ {
 27298  			var totalCost int32
 27299  			var insCost int32
 27300  			var delCost int32
 27301  			var subCost int32
 27302  			var ncx int32
 27303  			cB = *(*int8)(unsafe.Pointer(zB + uintptr((xB - 1))))
 27304  			cBnext = *(*int8)(unsafe.Pointer(zB + uintptr(xB)))
 27305  
 27306  			// Cost to insert cB
 27307  			insCost = insertOrDeleteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr((xB - 1)))), cB, cBnext)
 27308  			if lastA != 0 {
 27309  				insCost = insCost / (FINAL_INS_COST_DIV)
 27310  			}
 27311  
 27312  			// Cost to delete cA
 27313  			delCost = insertOrDeleteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr(xB))), cA, cBnext)
 27314  
 27315  			// Cost to substitute cA->cB
 27316  			subCost = substituteCost(tls, *(*int8)(unsafe.Pointer(cx + uintptr((xB - 1)))), cA, cB)
 27317  
 27318  			// Best cost
 27319  			totalCost = (insCost + *(*int32)(unsafe.Pointer(m + uintptr((xB-1))*4)))
 27320  			ncx = int32(cB)
 27321  			if (delCost + *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))) < totalCost {
 27322  				totalCost = (delCost + *(*int32)(unsafe.Pointer(m + uintptr(xB)*4)))
 27323  				ncx = int32(cA)
 27324  			}
 27325  			if (subCost + d) < totalCost {
 27326  				totalCost = (subCost + d)
 27327  			}
 27328  
 27329  			// Update the matrix
 27330  			d = *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))
 27331  			dc = int32(*(*int8)(unsafe.Pointer(cx + uintptr(xB))))
 27332  			*(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) = totalCost
 27333  			*(*int8)(unsafe.Pointer(cx + uintptr(xB))) = int8(ncx)
 27334  			cBprev = cB
 27335  		}
 27336  		cAprev = cA
 27337  	}
 27338  
 27339  	// Free the wagner matrix and return the result
 27340  	if int32(cA) == '*' {
 27341  		res = *(*int32)(unsafe.Pointer(m + 1*4))
 27342  		for xB = 1; xB <= nB; xB++ {
 27343  			if *(*int32)(unsafe.Pointer(m + uintptr(xB)*4)) < res {
 27344  				res = *(*int32)(unsafe.Pointer(m + uintptr(xB)*4))
 27345  				if pnMatch != 0 {
 27346  					*(*int32)(unsafe.Pointer(pnMatch)) = (xB + nMatch)
 27347  				}
 27348  			}
 27349  		}
 27350  	} else {
 27351  		res = *(*int32)(unsafe.Pointer(m + uintptr(nB)*4))
 27352  		// In the current implementation, pnMatch is always NULL if zA does
 27353  		// not end in "*"
 27354  
 27355  	}
 27356  	sqlite3.Xsqlite3_free(tls, toFree)
 27357  	return res
 27358  }
 27359  
 27360  // Function:    editdist(A,B)
 27361  //
 27362  // Return the cost of transforming string A into string B.  Both strings
 27363  // must be pure ASCII text.  If A ends with '*' then it is assumed to be
 27364  // a prefix of B and extra characters on the end of B have minimal additional
 27365  // cost.
 27366  func editdistSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:518:13: */
 27367  	var res int32 = editdist1(tls,
 27368  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))),
 27369  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))),
 27370  		uintptr(0))
 27371  	if res < 0 {
 27372  		if res == (-3) {
 27373  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 27374  		} else if res == (-2) {
 27375  			sqlite3.Xsqlite3_result_error(tls, context, ts+6498 /* "non-ASCII input ..." */, -1)
 27376  		} else {
 27377  			sqlite3.Xsqlite3_result_error(tls, context, ts+6528 /* "NULL input to ed..." */, -1)
 27378  		}
 27379  	} else {
 27380  		sqlite3.Xsqlite3_result_int(tls, context, res)
 27381  	}
 27382  }
 27383  
 27384  // End of the fixed-cost edit distance implementation
 27385  //
 27386  //
 27387  // Begin: Configurable cost unicode edit distance routines
 27388  // Forward declaration of structures
 27389  type EditDist3Cost1 = struct {
 27390  	FpNext uintptr
 27391  	FnFrom u8
 27392  	FnTo   u8
 27393  	FiCost u16
 27394  	Fa     [4]int8
 27395  } /* spellfix.c:546:9 */
 27396  
 27397  // End of the fixed-cost edit distance implementation
 27398  //
 27399  //
 27400  // Begin: Configurable cost unicode edit distance routines
 27401  // Forward declaration of structures
 27402  type EditDist3Cost = EditDist3Cost1 /* spellfix.c:546:30 */
 27403  type EditDist3Config1 = struct {
 27404  	FnLang int32
 27405  	Fa     uintptr
 27406  } /* spellfix.c:547:9 */
 27407  
 27408  type EditDist3Config = EditDist3Config1 /* spellfix.c:547:32 */
 27409  type EditDist3From1 = struct {
 27410  	FnSubst  int32
 27411  	FnDel    int32
 27412  	FnByte   int32
 27413  	FapSubst uintptr
 27414  	FapDel   uintptr
 27415  } /* spellfix.c:549:9 */
 27416  
 27417  type EditDist3From = EditDist3From1 /* spellfix.c:549:30 */
 27418  type EditDist3FromString1 = struct {
 27419  	Fz        uintptr
 27420  	Fn        int32
 27421  	FisPrefix int32
 27422  	Fa        uintptr
 27423  } /* spellfix.c:550:9 */
 27424  
 27425  type EditDist3FromString = EditDist3FromString1 /* spellfix.c:550:36 */
 27426  type EditDist3To1 = struct {
 27427  	FnIns  int32
 27428  	FnByte int32
 27429  	FapIns uintptr
 27430  } /* spellfix.c:551:9 */
 27431  
 27432  type EditDist3To = EditDist3To1 /* spellfix.c:551:28 */
 27433  type EditDist3ToString1 = struct {
 27434  	Fz uintptr
 27435  	Fn int32
 27436  	Fa uintptr
 27437  } /* spellfix.c:552:9 */
 27438  
 27439  type EditDist3ToString = EditDist3ToString1 /* spellfix.c:552:34 */
 27440  type EditDist3Lang1 = struct {
 27441  	FiLang    int32
 27442  	FiInsCost int32
 27443  	FiDelCost int32
 27444  	FiSubCost int32
 27445  	FpCost    uintptr
 27446  } /* spellfix.c:547:9 */
 27447  
 27448  type EditDist3Lang = EditDist3Lang1 /* spellfix.c:553:30 */
 27449  
 27450  // The default EditDist3Lang object, with default costs.
 27451  var editDist3Lang = EditDist3Lang{FiInsCost: 100, FiDelCost: 100, FiSubCost: 150} /* spellfix.c:583:28 */
 27452  
 27453  // Clear or delete an instance of the object that records all edit-distance
 27454  // weights.
 27455  func editDist3ConfigClear(tls *libc.TLS, p uintptr) { /* spellfix.c:640:13: */
 27456  	var i int32
 27457  	if p == uintptr(0) {
 27458  		return
 27459  	}
 27460  	for i = 0; i < (*EditDist3Config)(unsafe.Pointer(p)).FnLang; i++ {
 27461  		var pCost uintptr
 27462  		var pNext uintptr
 27463  		pCost = (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr(i)*20)).FpCost
 27464  		for pCost != 0 {
 27465  			pNext = (*EditDist3Cost)(unsafe.Pointer(pCost)).FpNext
 27466  			sqlite3.Xsqlite3_free(tls, pCost)
 27467  			pCost = pNext
 27468  		}
 27469  	}
 27470  	sqlite3.Xsqlite3_free(tls, (*EditDist3Config)(unsafe.Pointer(p)).Fa)
 27471  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(EditDist3Config{})))
 27472  }
 27473  
 27474  func editDist3ConfigDelete(tls *libc.TLS, pIn uintptr) { /* spellfix.c:655:13: */
 27475  	var p uintptr = pIn
 27476  	editDist3ConfigClear(tls, p)
 27477  	sqlite3.Xsqlite3_free(tls, p)
 27478  }
 27479  
 27480  // Compare the FROM values of two EditDist3Cost objects, for sorting.
 27481  // Return negative, zero, or positive if the A is less than, equal to,
 27482  // or greater than B.
 27483  func editDist3CostCompare(tls *libc.TLS, pA uintptr, pB uintptr) int32 { /* spellfix.c:665:12: */
 27484  	var n int32 = int32((*EditDist3Cost)(unsafe.Pointer(pA)).FnFrom)
 27485  	var rc int32
 27486  	if n > int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom) {
 27487  		n = int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom)
 27488  	}
 27489  	rc = libc.Xstrncmp(tls, pA+8 /* &.a */, pB+8 /* &.a */, uint32(n))
 27490  	if rc == 0 {
 27491  		rc = (int32((*EditDist3Cost)(unsafe.Pointer(pA)).FnFrom) - int32((*EditDist3Cost)(unsafe.Pointer(pB)).FnFrom))
 27492  	}
 27493  	return rc
 27494  }
 27495  
 27496  // Merge together two sorted lists of EditDist3Cost objects, in order
 27497  // of increasing FROM.
 27498  func editDist3CostMerge(tls *libc.TLS, pA uintptr, pB uintptr) uintptr { /* spellfix.c:678:22: */
 27499  	bp := tls.Alloc(4)
 27500  	defer tls.Free(4)
 27501  
 27502  	*(*uintptr)(unsafe.Pointer(bp /* pHead */)) = uintptr(0)
 27503  	var ppTail uintptr = bp /* &pHead */
 27504  	var p uintptr
 27505  	for (pA != 0) && (pB != 0) {
 27506  		if editDist3CostCompare(tls, pA, pB) <= 0 {
 27507  			p = pA
 27508  			pA = (*EditDist3Cost)(unsafe.Pointer(pA)).FpNext
 27509  		} else {
 27510  			p = pB
 27511  			pB = (*EditDist3Cost)(unsafe.Pointer(pB)).FpNext
 27512  		}
 27513  		*(*uintptr)(unsafe.Pointer(ppTail)) = p
 27514  		ppTail = (p /* &.pNext */)
 27515  	}
 27516  	if pA != 0 {
 27517  		*(*uintptr)(unsafe.Pointer(ppTail)) = pA
 27518  	} else {
 27519  		*(*uintptr)(unsafe.Pointer(ppTail)) = pB
 27520  	}
 27521  	return *(*uintptr)(unsafe.Pointer(bp /* pHead */))
 27522  }
 27523  
 27524  // Sort a list of EditDist3Cost objects into order of increasing FROM
 27525  func editDist3CostSort(tls *libc.TLS, pList uintptr) uintptr { /* spellfix.c:707:22: */
 27526  	bp := tls.Alloc(240)
 27527  	defer tls.Free(240)
 27528  
 27529  	// var ap [60]uintptr at bp, 240
 27530  
 27531  	var p uintptr
 27532  	var i int32
 27533  	var mx int32 = 0
 27534  	*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */)) = uintptr(0)
 27535  	*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + 1*4)) = uintptr(0)
 27536  	for pList != 0 {
 27537  		p = pList
 27538  		pList = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext
 27539  		(*EditDist3Cost)(unsafe.Pointer(p)).FpNext = uintptr(0)
 27540  		for i = 0; *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)) != 0; i++ {
 27541  			p = editDist3CostMerge(tls, *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)), p)
 27542  			*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)) = uintptr(0)
 27543  		}
 27544  		*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)) = p
 27545  		if i > mx {
 27546  			mx = i
 27547  			*(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr((i+1))*4)) = uintptr(0)
 27548  		}
 27549  	}
 27550  	p = uintptr(0)
 27551  	for i = 0; i <= mx; i++ {
 27552  		if *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)) != 0 {
 27553  			p = editDist3CostMerge(tls, p, *(*uintptr)(unsafe.Pointer(bp /* &ap[0] */ + uintptr(i)*4)))
 27554  		}
 27555  	}
 27556  	return p
 27557  }
 27558  
 27559  // Load all edit-distance weights from a table.
 27560  func editDist3ConfigLoad(tls *libc.TLS, p uintptr, db uintptr, zTable uintptr) int32 { /* spellfix.c:737:12: */
 27561  	bp := tls.Alloc(12)
 27562  	defer tls.Free(12)
 27563  
 27564  	// var pStmt uintptr at bp+8, 4
 27565  
 27566  	var rc int32
 27567  	var rc2 int32
 27568  	var zSql uintptr
 27569  	var iLangPrev int32 = -9999
 27570  	var pLang uintptr = uintptr(0)
 27571  
 27572  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 27573  		ts+6553 /* "SELECT iLang, cF..." */, libc.VaList(bp, zTable))
 27574  	if zSql == uintptr(0) {
 27575  		return SQLITE_NOMEM
 27576  	}
 27577  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0))
 27578  	sqlite3.Xsqlite3_free(tls, zSql)
 27579  	if rc != 0 {
 27580  		return rc
 27581  	}
 27582  	editDist3ConfigClear(tls, p)
 27583  	for sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */))) == SQLITE_ROW {
 27584  		var iLang int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0)
 27585  		var zFrom uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)
 27586  		var nFrom int32
 27587  		if zFrom != 0 {
 27588  			nFrom = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 1)
 27589  		} else {
 27590  			nFrom = 0
 27591  		}
 27592  		var zTo uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 2)
 27593  		var nTo int32
 27594  		if zTo != 0 {
 27595  			nTo = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 2)
 27596  		} else {
 27597  			nTo = 0
 27598  		}
 27599  		var iCost int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 3)
 27600  
 27601  		if (nFrom > 100) || (nTo > 100) {
 27602  			continue
 27603  		}
 27604  		if iCost < 0 {
 27605  			continue
 27606  		}
 27607  		if iCost >= 10000 {
 27608  			continue
 27609  		} // Costs above 10K are considered infinite
 27610  		if (pLang == uintptr(0)) || (iLang != iLangPrev) {
 27611  			var pNew uintptr
 27612  			pNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3Config)(unsafe.Pointer(p)).Fa, (uint64((uint32((*EditDist3Config)(unsafe.Pointer(p)).FnLang + 1)) * uint32(unsafe.Sizeof(EditDist3Lang{})))))
 27613  			if pNew == uintptr(0) {
 27614  				rc = SQLITE_NOMEM
 27615  				break
 27616  			}
 27617  			(*EditDist3Config)(unsafe.Pointer(p)).Fa = pNew
 27618  			pLang = ((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr((*EditDist3Config)(unsafe.Pointer(p)).FnLang)*20)
 27619  			(*EditDist3Config)(unsafe.Pointer(p)).FnLang++
 27620  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiLang = iLang
 27621  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost = 100
 27622  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost = 100
 27623  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost = 150
 27624  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost = uintptr(0)
 27625  			iLangPrev = iLang
 27626  		}
 27627  		if ((nFrom == 1) && (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?')) && (nTo == 0) {
 27628  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost = iCost
 27629  		} else if ((nFrom == 0) && (nTo == 1)) && (int32(*(*int8)(unsafe.Pointer(zTo))) == '?') {
 27630  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost = iCost
 27631  		} else if (((nFrom == 1) && (nTo == 1)) && (int32(*(*int8)(unsafe.Pointer(zFrom))) == '?')) && (int32(*(*int8)(unsafe.Pointer(zTo))) == '?') {
 27632  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost = iCost
 27633  		} else {
 27634  			var pCost uintptr
 27635  			var nExtra int32 = ((nFrom + nTo) - 4)
 27636  			if nExtra < 0 {
 27637  				nExtra = 0
 27638  			}
 27639  			pCost = sqlite3.Xsqlite3_malloc64(tls, (uint64(uint32(unsafe.Sizeof(EditDist3Cost{})) + uint32(nExtra))))
 27640  			if pCost == uintptr(0) {
 27641  				rc = SQLITE_NOMEM
 27642  				break
 27643  			}
 27644  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FnFrom = u8(nFrom)
 27645  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FnTo = u8(nTo)
 27646  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FiCost = u16(iCost)
 27647  			libc.Xmemcpy(tls, pCost+8 /* &.a */, zFrom, uint32(nFrom))
 27648  			libc.Xmemcpy(tls, ((pCost + 8 /* &.a */) + uintptr(nFrom)), zTo, uint32(nTo))
 27649  			(*EditDist3Cost)(unsafe.Pointer(pCost)).FpNext = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost
 27650  			(*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost = pCost
 27651  		}
 27652  	}
 27653  	rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 27654  	if rc == SQLITE_OK {
 27655  		rc = rc2
 27656  	}
 27657  	if rc == SQLITE_OK {
 27658  		var iLang int32
 27659  		for iLang = 0; iLang < (*EditDist3Config)(unsafe.Pointer(p)).FnLang; iLang++ {
 27660  			(*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa + uintptr(iLang)*20)).FpCost = editDist3CostSort(tls, (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(p)).Fa+uintptr(iLang)*20)).FpCost)
 27661  		}
 27662  	}
 27663  	return rc
 27664  }
 27665  
 27666  // Return the length (in bytes) of a utf-8 character.  Or return a maximum
 27667  // of N.
 27668  func utf8Len(tls *libc.TLS, c uint8, N int32) int32 { /* spellfix.c:818:12: */
 27669  	var len int32 = 1
 27670  	if int32(c) > 0x7f {
 27671  		if (int32(c) & 0xe0) == 0xc0 {
 27672  			len = 2
 27673  		} else if (int32(c) & 0xf0) == 0xe0 {
 27674  			len = 3
 27675  		} else {
 27676  			len = 4
 27677  		}
 27678  	}
 27679  	if len > N {
 27680  		len = N
 27681  	}
 27682  	return len
 27683  }
 27684  
 27685  // Return TRUE (non-zero) if the To side of the given cost matches
 27686  // the given string.
 27687  func matchTo(tls *libc.TLS, p uintptr, z uintptr, n int32) int32 { /* spellfix.c:837:12: */
 27688  
 27689  	if int32(*(*int8)(unsafe.Pointer((p + 8 /* &.a */) + uintptr((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)))) != int32(*(*int8)(unsafe.Pointer(z))) {
 27690  		return 0
 27691  	}
 27692  	if int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo) > n {
 27693  		return 0
 27694  	}
 27695  	if libc.Xstrncmp(tls, ((p+8 /* &.a */)+uintptr((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), z, uint32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo)) != 0 {
 27696  		return 0
 27697  	}
 27698  	return 1
 27699  }
 27700  
 27701  // Return TRUE (non-zero) if the From side of the given cost matches
 27702  // the given string.
 27703  func matchFrom(tls *libc.TLS, p uintptr, z uintptr, n int32) int32 { /* spellfix.c:849:12: */
 27704  
 27705  	if (*EditDist3Cost)(unsafe.Pointer(p)).FnFrom != 0 {
 27706  		if int32(*(*int8)(unsafe.Pointer((p + 8 /* &.a */)))) != int32(*(*int8)(unsafe.Pointer(z))) {
 27707  			return 0
 27708  		}
 27709  		if libc.Xstrncmp(tls, p+8 /* &.a */, z, uint32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) != 0 {
 27710  			return 0
 27711  		}
 27712  	}
 27713  	return 1
 27714  }
 27715  
 27716  // Return TRUE (non-zero) of the next FROM character and the next TO
 27717  // character are the same.
 27718  func matchFromTo(tls *libc.TLS, pStr uintptr, n1 int32, z2 uintptr, n2 int32) int32 { /* spellfix.c:862:12: */
 27719  	var b1 int32 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(n1)*20)).FnByte
 27720  	if b1 > n2 {
 27721  		return 0
 27722  	}
 27723  
 27724  	if int32(*(*int8)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz + uintptr(n1)))) != int32(*(*int8)(unsafe.Pointer(z2))) {
 27725  		return 0
 27726  	}
 27727  	if libc.Xstrncmp(tls, ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz+uintptr(n1)), z2, uint32(b1)) != 0 {
 27728  		return 0
 27729  	}
 27730  	return 1
 27731  }
 27732  
 27733  // Delete an EditDist3FromString objecct
 27734  func editDist3FromStringDelete(tls *libc.TLS, p uintptr) { /* spellfix.c:879:13: */
 27735  	var i int32
 27736  	if p != 0 {
 27737  		for i = 0; i < (*EditDist3FromString)(unsafe.Pointer(p)).Fn; i++ {
 27738  			sqlite3.Xsqlite3_free(tls, (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(p)).Fa+uintptr(i)*20)).FapDel)
 27739  			sqlite3.Xsqlite3_free(tls, (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(p)).Fa+uintptr(i)*20)).FapSubst)
 27740  		}
 27741  		sqlite3.Xsqlite3_free(tls, p)
 27742  	}
 27743  }
 27744  
 27745  // Create a EditDist3FromString object.
 27746  func editDist3FromStringNew(tls *libc.TLS, pLang uintptr, z uintptr, n int32) uintptr { /* spellfix.c:893:28: */
 27747  	var pStr uintptr
 27748  	var p uintptr
 27749  	var i int32
 27750  
 27751  	if z == uintptr(0) {
 27752  		return uintptr(0)
 27753  	}
 27754  	if n < 0 {
 27755  		n = int32(libc.Xstrlen(tls, z))
 27756  	}
 27757  	pStr = sqlite3.Xsqlite3_malloc64(tls, (uint64(((uint32(unsafe.Sizeof(EditDist3FromString{})) + (uint32(unsafe.Sizeof(EditDist3From{})) * uint32(n))) + uint32(n)) + uint32(1))))
 27758  	if pStr == uintptr(0) {
 27759  		return uintptr(0)
 27760  	}
 27761  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fa = (pStr + 1*16)
 27762  	libc.Xmemset(tls, (*EditDist3FromString)(unsafe.Pointer(pStr)).Fa, 0, (uint32(unsafe.Sizeof(EditDist3From{})) * uint32(n)))
 27763  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fn = n
 27764  	(*EditDist3FromString)(unsafe.Pointer(pStr)).Fz = ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(n)*20)
 27765  	libc.Xmemcpy(tls, (*EditDist3FromString)(unsafe.Pointer(pStr)).Fz, z, (uint32(n + 1)))
 27766  	if (n != 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr((n - 1))))) == '*') {
 27767  		(*EditDist3FromString)(unsafe.Pointer(pStr)).FisPrefix = 1
 27768  		n--
 27769  		(*EditDist3FromString)(unsafe.Pointer(pStr)).Fn--
 27770  		*(*int8)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(pStr)).Fz + uintptr(n))) = int8(0)
 27771  	} else {
 27772  		(*EditDist3FromString)(unsafe.Pointer(pStr)).FisPrefix = 0
 27773  	}
 27774  
 27775  	for i = 0; i < n; i++ {
 27776  		var pFrom uintptr = ((*EditDist3FromString)(unsafe.Pointer(pStr)).Fa + uintptr(i)*20)
 27777  		libc.Xmemset(tls, pFrom, 0, uint32(unsafe.Sizeof(EditDist3From{})))
 27778  		(*EditDist3From)(unsafe.Pointer(pFrom)).FnByte = utf8Len(tls, uint8(*(*int8)(unsafe.Pointer(z + uintptr(i)))), (n - i))
 27779  		for p = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost; p != 0; p = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext {
 27780  			var apNew uintptr
 27781  			if (i + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) > n {
 27782  				continue
 27783  			}
 27784  			if matchFrom(tls, p, (z+uintptr(i)), (n-i)) == 0 {
 27785  				continue
 27786  			}
 27787  			if int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo) == 0 {
 27788  				apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3From)(unsafe.Pointer(pFrom)).FapDel,
 27789  					(uint64(uint32(unsafe.Sizeof(uintptr(0))) * (uint32((*EditDist3From)(unsafe.Pointer(pFrom)).FnDel + 1)))))
 27790  				if apNew == uintptr(0) {
 27791  					break
 27792  				}
 27793  				(*EditDist3From)(unsafe.Pointer(pFrom)).FapDel = apNew
 27794  				*(*uintptr)(unsafe.Pointer(apNew + uintptr(libc.PostIncInt32(&(*EditDist3From)(unsafe.Pointer(pFrom)).FnDel, 1))*4)) = p
 27795  			} else {
 27796  				apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3From)(unsafe.Pointer(pFrom)).FapSubst,
 27797  					(uint64(uint32(unsafe.Sizeof(uintptr(0))) * (uint32((*EditDist3From)(unsafe.Pointer(pFrom)).FnSubst + 1)))))
 27798  				if apNew == uintptr(0) {
 27799  					break
 27800  				}
 27801  				(*EditDist3From)(unsafe.Pointer(pFrom)).FapSubst = apNew
 27802  				*(*uintptr)(unsafe.Pointer(apNew + uintptr(libc.PostIncInt32(&(*EditDist3From)(unsafe.Pointer(pFrom)).FnSubst, 1))*4)) = p
 27803  			}
 27804  		}
 27805  		if p != 0 {
 27806  			editDist3FromStringDelete(tls, pStr)
 27807  			pStr = uintptr(0)
 27808  			break
 27809  		}
 27810  	}
 27811  	return pStr
 27812  }
 27813  
 27814  // Update entry m[i] such that it is the minimum of its current value
 27815  // and m[j]+iCost.
 27816  func updateCost(tls *libc.TLS, m uintptr, i int32, j int32, iCost int32) { /* spellfix.c:955:13: */
 27817  	var b uint32
 27818  
 27819  	b = (*(*uint32)(unsafe.Pointer(m + uintptr(j)*4)) + uint32(iCost))
 27820  	if b < *(*uint32)(unsafe.Pointer(m + uintptr(i)*4)) {
 27821  		*(*uint32)(unsafe.Pointer(m + uintptr(i)*4)) = b
 27822  	}
 27823  }
 27824  
 27825  // How much stack space (int bytes) to use for Wagner matrix in
 27826  // editDist3Core().  If more space than this is required, the entire
 27827  // matrix is taken from the heap.  To reduce the load on the memory
 27828  // allocator, make this value as large as practical for the
 27829  // architecture in use.
 27830  
 27831  // Compute the edit distance between two strings.
 27832  //
 27833  // If an error occurs, return a negative number which is the error code.
 27834  //
 27835  // If pnMatch is not NULL, then *pnMatch is set to the number of characters
 27836  // (not bytes) in z2 that matched the search pattern in *pFrom. If pFrom does
 27837  // not contain the pattern for a prefix-search, then this is always the number
 27838  // of characters in z2. If pFrom does contain a prefix search pattern, then
 27839  // it is the number of characters in the prefix of z2 that was deemed to
 27840  // match pFrom.
 27841  func editDist3Core(tls *libc.TLS, pFrom uintptr, z2 uintptr, n2 int32, pLang uintptr, pnMatch uintptr) int32 { /* spellfix.c:990:12: */
 27842  	bp := tls.Alloc(1040)
 27843  	defer tls.Free(1040)
 27844  
 27845  	var k int32
 27846  	var n int32
 27847  	var i1 int32
 27848  	var b1 int32
 27849  	var i2 int32
 27850  	var b2 int32
 27851  	// var f EditDist3FromString at bp+1024, 16
 27852  
 27853  	var a2 uintptr
 27854  	var m uintptr
 27855  	var pToFree uintptr
 27856  	var szRow int32
 27857  	var p uintptr
 27858  	var res int32
 27859  	var nByte sqlite3_uint64
 27860  	// var stackSpace [256]uint32 at bp, 1024
 27861  
 27862  	var apNew uintptr
 27863  	var cx int32  // Index of current cell
 27864  	var cxp int32 // Index of cell immediately to the left
 27865  	var cxd int32 // Index of cell to the left and one row above
 27866  	var cxu int32
 27867  	var rx int32 // Starting index for current row
 27868  	var rxp int32
 27869  	var b int32
 27870  	var nExtra int32
 27871  	*(*EditDist3FromString)(unsafe.Pointer(bp + 1024 /* f */)) = *(*EditDist3FromString)(unsafe.Pointer(pFrom))
 27872  
 27873  	// allocate the Wagner matrix and the aTo[] array for the TO string
 27874  	n = (((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn + 1) * (n2 + 1))
 27875  	n = ((n + 1) & libc.CplInt32(1))
 27876  	nByte = (sqlite3_uint64((uint32(n) * uint32(unsafe.Sizeof(uint32(0)))) + (uint32(unsafe.Sizeof(EditDist3To{})) * uint32(n2))))
 27877  	if !(nByte <= sqlite3_uint64(unsafe.Sizeof([256]uint32{}))) {
 27878  		goto __1
 27879  	}
 27880  	m = bp /* &stackSpace[0] */
 27881  	pToFree = uintptr(0)
 27882  	goto __2
 27883  __1:
 27884  	m = libc.AssignUintptr(&pToFree, sqlite3.Xsqlite3_malloc64(tls, nByte))
 27885  	if !(m == uintptr(0)) {
 27886  		goto __3
 27887  	}
 27888  	return -1
 27889  __3:
 27890  	; // Out of memory
 27891  __2:
 27892  	;
 27893  	a2 = (m + uintptr(n)*4)
 27894  	libc.Xmemset(tls, a2, 0, (uint32(unsafe.Sizeof(EditDist3To{})) * uint32(n2)))
 27895  
 27896  	// Fill in the a1[] matrix for all characters of the TO string
 27897  	i2 = 0
 27898  __4:
 27899  	if !(i2 < n2) {
 27900  		goto __6
 27901  	}
 27902  	(*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*12)).FnByte = utf8Len(tls, uint8(*(*int8)(unsafe.Pointer(z2 + uintptr(i2)))), (n2 - i2))
 27903  	p = (*EditDist3Lang)(unsafe.Pointer(pLang)).FpCost
 27904  __7:
 27905  	if !(p != 0) {
 27906  		goto __9
 27907  	}
 27908  	if !(int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom) > 0) {
 27909  		goto __10
 27910  	}
 27911  	goto __9
 27912  __10:
 27913  	;
 27914  	if !((i2 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo)) > n2) {
 27915  		goto __11
 27916  	}
 27917  	goto __8
 27918  __11:
 27919  	;
 27920  	if !(int32(*(*int8)(unsafe.Pointer((p + 8 /* &.a */)))) > int32(*(*int8)(unsafe.Pointer(z2 + uintptr(i2))))) {
 27921  		goto __12
 27922  	}
 27923  	goto __9
 27924  __12:
 27925  	;
 27926  	if !(matchTo(tls, p, (z2+uintptr(i2)), (n2-i2)) == 0) {
 27927  		goto __13
 27928  	}
 27929  	goto __8
 27930  __13:
 27931  	;
 27932  	(*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FnIns++
 27933  	apNew = sqlite3.Xsqlite3_realloc64(tls, (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FapIns, (uint64(uint32(unsafe.Sizeof(uintptr(0))) * uint32((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FnIns))))
 27934  	if !(apNew == uintptr(0)) {
 27935  		goto __14
 27936  	}
 27937  	res = -1 // Out of memory
 27938  	goto editDist3Abort
 27939  __14:
 27940  	;
 27941  	(*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*12)).FapIns = apNew
 27942  	*(*uintptr)(unsafe.Pointer((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FapIns + uintptr(((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FnIns-1))*4)) = p
 27943  	goto __8
 27944  __8:
 27945  	p = (*EditDist3Cost)(unsafe.Pointer(p)).FpNext
 27946  	goto __7
 27947  	goto __9
 27948  __9:
 27949  	;
 27950  	goto __5
 27951  __5:
 27952  	i2++
 27953  	goto __4
 27954  	goto __6
 27955  __6:
 27956  	;
 27957  
 27958  	// Prepare to compute the minimum edit distance
 27959  	szRow = ((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn + 1)
 27960  	libc.Xmemset(tls, m, 0x01, ((uint32((n2 + 1) * szRow)) * uint32(unsafe.Sizeof(uint32(0)))))
 27961  	*(*uint32)(unsafe.Pointer(m)) = uint32(0)
 27962  
 27963  	// First fill in the top-row of the matrix with FROM deletion costs
 27964  	i1 = 0
 27965  __15:
 27966  	if !(i1 < (*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn) {
 27967  		goto __17
 27968  	}
 27969  	b1 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa + uintptr(i1)*20)).FnByte
 27970  	updateCost(tls, m, (i1 + b1), i1, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost)
 27971  	k = 0
 27972  __18:
 27973  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FnDel) {
 27974  		goto __20
 27975  	}
 27976  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FapDel + uintptr(k)*4))
 27977  	updateCost(tls, m, (i1 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), i1, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 27978  	goto __19
 27979  __19:
 27980  	k++
 27981  	goto __18
 27982  	goto __20
 27983  __20:
 27984  	;
 27985  	goto __16
 27986  __16:
 27987  	i1 = i1 + (b1)
 27988  	goto __15
 27989  	goto __17
 27990  __17:
 27991  	;
 27992  
 27993  	// Fill in all subsequent rows, top-to-bottom, left-to-right
 27994  	i2 = 0
 27995  __21:
 27996  	if !(i2 < n2) {
 27997  		goto __23
 27998  	} // Starting index for previous row
 27999  	b2 = (*EditDist3To)(unsafe.Pointer(a2 + uintptr(i2)*12)).FnByte
 28000  	rx = (szRow * (i2 + b2))
 28001  	rxp = (szRow * i2)
 28002  	updateCost(tls, m, rx, rxp, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost)
 28003  	k = 0
 28004  __24:
 28005  	if !(k < (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FnIns) {
 28006  		goto __26
 28007  	}
 28008  	p = *(*uintptr)(unsafe.Pointer((*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FapIns + uintptr(k)*4))
 28009  	updateCost(tls, m, (szRow * (i2 + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo))), rxp, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 28010  	goto __25
 28011  __25:
 28012  	k++
 28013  	goto __24
 28014  	goto __26
 28015  __26:
 28016  	;
 28017  	i1 = 0
 28018  __27:
 28019  	if !(i1 < (*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fn) {
 28020  		goto __29
 28021  	} // Index of cell immediately above
 28022  	b1 = (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa + uintptr(i1)*20)).FnByte
 28023  	cxp = (rx + i1)
 28024  	cx = (cxp + b1)
 28025  	cxd = (rxp + i1)
 28026  	cxu = (cxd + b1)
 28027  	updateCost(tls, m, cx, cxp, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiDelCost)
 28028  	k = 0
 28029  __30:
 28030  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FnDel) {
 28031  		goto __32
 28032  	}
 28033  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FapDel + uintptr(k)*4))
 28034  	updateCost(tls, m, (cxp + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)), cxp, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 28035  	goto __31
 28036  __31:
 28037  	k++
 28038  	goto __30
 28039  	goto __32
 28040  __32:
 28041  	;
 28042  	updateCost(tls, m, cx, cxu, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiInsCost)
 28043  	if !(matchFromTo(tls, bp+1024 /* &f */, i1, (z2+uintptr(i2)), (n2-i2)) != 0) {
 28044  		goto __33
 28045  	}
 28046  	updateCost(tls, m, cx, cxd, 0)
 28047  __33:
 28048  	;
 28049  	updateCost(tls, m, cx, cxd, (*EditDist3Lang)(unsafe.Pointer(pLang)).FiSubCost)
 28050  	k = 0
 28051  __34:
 28052  	if !(k < (*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FnSubst) {
 28053  		goto __36
 28054  	}
 28055  	p = *(*uintptr)(unsafe.Pointer((*EditDist3From)(unsafe.Pointer((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).Fa+uintptr(i1)*20)).FapSubst + uintptr(k)*4))
 28056  	if !(matchTo(tls, p, (z2+uintptr(i2)), (n2-i2)) != 0) {
 28057  		goto __37
 28058  	}
 28059  	updateCost(tls, m, ((cxd + int32((*EditDist3Cost)(unsafe.Pointer(p)).FnFrom)) + (szRow * int32((*EditDist3Cost)(unsafe.Pointer(p)).FnTo))), cxd, int32((*EditDist3Cost)(unsafe.Pointer(p)).FiCost))
 28060  __37:
 28061  	;
 28062  	goto __35
 28063  __35:
 28064  	k++
 28065  	goto __34
 28066  	goto __36
 28067  __36:
 28068  	;
 28069  	goto __28
 28070  __28:
 28071  	i1 = i1 + (b1)
 28072  	goto __27
 28073  	goto __29
 28074  __29:
 28075  	;
 28076  	goto __22
 28077  __22:
 28078  	i2 = i2 + (b2)
 28079  	goto __21
 28080  	goto __23
 28081  __23:
 28082  	;
 28083  
 28084  	// Free memory allocations and return the result
 28085  	res = int32(*(*uint32)(unsafe.Pointer(m + uintptr(((szRow*(n2+1))-1))*4)))
 28086  	n = n2
 28087  	if !((*EditDist3FromString)(unsafe.Pointer(bp+1024 /* &f */)).FisPrefix != 0) {
 28088  		goto __38
 28089  	}
 28090  	i2 = 1
 28091  __39:
 28092  	if !(i2 <= n2) {
 28093  		goto __41
 28094  	}
 28095  	b = int32(*(*uint32)(unsafe.Pointer(m + uintptr(((szRow*i2)-1))*4)))
 28096  	if !(b <= res) {
 28097  		goto __42
 28098  	}
 28099  	res = b
 28100  	n = (i2 - 1)
 28101  __42:
 28102  	;
 28103  	goto __40
 28104  __40:
 28105  	i2++
 28106  	goto __39
 28107  	goto __41
 28108  __41:
 28109  	;
 28110  __38:
 28111  	;
 28112  	if !(pnMatch != 0) {
 28113  		goto __43
 28114  	}
 28115  	nExtra = 0
 28116  	k = 0
 28117  __44:
 28118  	if !(k < n) {
 28119  		goto __46
 28120  	}
 28121  	if !((int32(*(*int8)(unsafe.Pointer(z2 + uintptr(k)))) & 0xc0) == 0x80) {
 28122  		goto __47
 28123  	}
 28124  	nExtra++
 28125  __47:
 28126  	;
 28127  	goto __45
 28128  __45:
 28129  	k++
 28130  	goto __44
 28131  	goto __46
 28132  __46:
 28133  	;
 28134  	*(*int32)(unsafe.Pointer(pnMatch)) = (n - nExtra)
 28135  __43:
 28136  	;
 28137  
 28138  editDist3Abort:
 28139  	i2 = 0
 28140  __48:
 28141  	if !(i2 < n2) {
 28142  		goto __50
 28143  	}
 28144  	sqlite3.Xsqlite3_free(tls, (*EditDist3To)(unsafe.Pointer(a2+uintptr(i2)*12)).FapIns)
 28145  	goto __49
 28146  __49:
 28147  	i2++
 28148  	goto __48
 28149  	goto __50
 28150  __50:
 28151  	;
 28152  	sqlite3.Xsqlite3_free(tls, pToFree)
 28153  	return res
 28154  }
 28155  
 28156  // Get an appropriate EditDist3Lang object.
 28157  func editDist3FindLang(tls *libc.TLS, pConfig uintptr, iLang int32) uintptr { /* spellfix.c:1150:28: */
 28158  	var i int32
 28159  	for i = 0; i < (*EditDist3Config)(unsafe.Pointer(pConfig)).FnLang; i++ {
 28160  		if (*EditDist3Lang)(unsafe.Pointer((*EditDist3Config)(unsafe.Pointer(pConfig)).Fa+uintptr(i)*20)).FiLang == iLang {
 28161  			return ((*EditDist3Config)(unsafe.Pointer(pConfig)).Fa + uintptr(i)*20)
 28162  		}
 28163  	}
 28164  	return uintptr(unsafe.Pointer(&editDist3Lang))
 28165  }
 28166  
 28167  // Function:    editdist3(A,B,iLang)
 28168  //              editdist3(tablename)
 28169  //
 28170  // Return the cost of transforming string A into string B using edit
 28171  // weights for iLang.
 28172  //
 28173  // The second form loads edit weights into memory from a table.
 28174  func editDist3SqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1170:13: */
 28175  	var pConfig uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 28176  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 28177  	var rc int32
 28178  	if argc == 1 {
 28179  		var zTable uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28180  		rc = editDist3ConfigLoad(tls, pConfig, db, zTable)
 28181  		if rc != 0 {
 28182  			sqlite3.Xsqlite3_result_error_code(tls, context, rc)
 28183  		}
 28184  	} else {
 28185  		var zA uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28186  		var zB uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 28187  		var nA int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28188  		var nB int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 28189  		var iLang int32
 28190  		if argc == 3 {
 28191  			iLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 28192  		} else {
 28193  			iLang = 0
 28194  		}
 28195  		var pLang uintptr = editDist3FindLang(tls, pConfig, iLang)
 28196  		var pFrom uintptr
 28197  		var dist int32
 28198  
 28199  		pFrom = editDist3FromStringNew(tls, pLang, zA, nA)
 28200  		if pFrom == uintptr(0) {
 28201  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 28202  			return
 28203  		}
 28204  		dist = editDist3Core(tls, pFrom, zB, nB, pLang, uintptr(0))
 28205  		editDist3FromStringDelete(tls, pFrom)
 28206  		if dist == (-1) {
 28207  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 28208  		} else {
 28209  			sqlite3.Xsqlite3_result_int(tls, context, dist)
 28210  		}
 28211  	}
 28212  }
 28213  
 28214  // Register the editDist3 function with SQLite
 28215  func editDist3Install(tls *libc.TLS, db uintptr) int32 { /* spellfix.c:1210:12: */
 28216  	var rc int32
 28217  	var pConfig uintptr = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(EditDist3Config{})))
 28218  	if pConfig == uintptr(0) {
 28219  		return SQLITE_NOMEM
 28220  	}
 28221  	libc.Xmemset(tls, pConfig, 0, uint32(unsafe.Sizeof(EditDist3Config{})))
 28222  	rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 28223  		2, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 28224  		*(*uintptr)(unsafe.Pointer(&struct {
 28225  			f func(*libc.TLS, uintptr, int32, uintptr)
 28226  		}{editDist3SqlFunc})), uintptr(0), uintptr(0), uintptr(0))
 28227  	if rc == SQLITE_OK {
 28228  		rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 28229  			3, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 28230  			*(*uintptr)(unsafe.Pointer(&struct {
 28231  				f func(*libc.TLS, uintptr, int32, uintptr)
 28232  			}{editDist3SqlFunc})), uintptr(0), uintptr(0), uintptr(0))
 28233  	}
 28234  	if rc == SQLITE_OK {
 28235  		rc = sqlite3.Xsqlite3_create_function_v2(tls, db, ts+6625, /* "editdist3" */
 28236  			1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC), pConfig,
 28237  			*(*uintptr)(unsafe.Pointer(&struct {
 28238  				f func(*libc.TLS, uintptr, int32, uintptr)
 28239  			}{editDist3SqlFunc})), uintptr(0), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{editDist3ConfigDelete})))
 28240  	} else {
 28241  		sqlite3.Xsqlite3_free(tls, pConfig)
 28242  	}
 28243  	return rc
 28244  }
 28245  
 28246  // End configurable cost unicode edit distance routines
 28247  //
 28248  //
 28249  // Begin transliterate unicode-to-ascii implementation
 28250  
 28251  // This lookup table is used to help decode the first byte of
 28252  // a multi-byte UTF8 character.
 28253  var sqlite3Utf8Trans1 = [64]uint8{
 28254  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 28255  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 28256  	uint8(0x10), uint8(0x11), uint8(0x12), uint8(0x13), uint8(0x14), uint8(0x15), uint8(0x16), uint8(0x17),
 28257  	uint8(0x18), uint8(0x19), uint8(0x1a), uint8(0x1b), uint8(0x1c), uint8(0x1d), uint8(0x1e), uint8(0x1f),
 28258  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 28259  	uint8(0x08), uint8(0x09), uint8(0x0a), uint8(0x0b), uint8(0x0c), uint8(0x0d), uint8(0x0e), uint8(0x0f),
 28260  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x04), uint8(0x05), uint8(0x06), uint8(0x07),
 28261  	uint8(0x00), uint8(0x01), uint8(0x02), uint8(0x03), uint8(0x00), uint8(0x01), uint8(0x00), uint8(0x00),
 28262  } /* spellfix.c:1243:28 */
 28263  
 28264  // Return the value of the first UTF-8 character in the string.
 28265  func utf8Read(tls *libc.TLS, z uintptr, n int32, pSize uintptr) int32 { /* spellfix.c:1258:12: */
 28266  	var c int32
 28267  	var i int32
 28268  
 28269  	// All callers to this routine (in the current implementation)
 28270  	// always have n>0.
 28271  	if 0 != 0 {
 28272  		c = libc.AssignInt32(&i, 0)
 28273  	} else {
 28274  		c = int32(*(*uint8)(unsafe.Pointer(z)))
 28275  		i = 1
 28276  		if c >= 0xc0 {
 28277  			c = int32(sqlite3Utf8Trans1[(c - 0xc0)])
 28278  			for (i < n) && ((int32(*(*uint8)(unsafe.Pointer(z + uintptr(i)))) & 0xc0) == 0x80) {
 28279  				c = ((c << 6) + (0x3f & int32(*(*uint8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&i, 1)))))))
 28280  			}
 28281  		}
 28282  	}
 28283  	*(*int32)(unsafe.Pointer(pSize)) = i
 28284  	return c
 28285  }
 28286  
 28287  // Return the number of characters in the utf-8 string in the nIn byte
 28288  // buffer pointed to by zIn.
 28289  func utf8Charlen(tls *libc.TLS, zIn uintptr, nIn int32) int32 { /* spellfix.c:1283:12: */
 28290  	bp := tls.Alloc(4)
 28291  	defer tls.Free(4)
 28292  
 28293  	var i int32
 28294  	var nChar int32 = 0
 28295  	for i = 0; i < nIn; nChar++ {
 28296  		// var sz int32 at bp, 4
 28297  
 28298  		utf8Read(tls, (zIn + uintptr(i)), (nIn - i), bp /* &sz */)
 28299  		i = i + (*(*int32)(unsafe.Pointer(bp /* sz */)))
 28300  	}
 28301  	return nChar
 28302  }
 28303  
 28304  type Transliteration1 = struct {
 28305  	FcFrom uint16
 28306  	FcTo0  uint8
 28307  	FcTo1  uint8
 28308  	FcTo2  uint8
 28309  	FcTo3  uint8
 28310  } /* spellfix.c:1294:9 */
 28311  
 28312  type Transliteration = Transliteration1 /* spellfix.c:1294:32 */
 28313  
 28314  // Table of translations from unicode characters into ASCII.
 28315  var translit = [389]Transliteration{
 28316  	{FcFrom: uint16(0x00A0), FcTo0: uint8(0x20)},                                                             //   to
 28317  	{FcFrom: uint16(0x00B5), FcTo0: uint8(0x75)},                                                             // µ to u
 28318  	{FcFrom: uint16(0x00C0), FcTo0: uint8(0x41)},                                                             // À to A
 28319  	{FcFrom: uint16(0x00C1), FcTo0: uint8(0x41)},                                                             // Á to A
 28320  	{FcFrom: uint16(0x00C2), FcTo0: uint8(0x41)},                                                             // Â to A
 28321  	{FcFrom: uint16(0x00C3), FcTo0: uint8(0x41)},                                                             // Ã to A
 28322  	{FcFrom: uint16(0x00C4), FcTo0: uint8(0x41), FcTo1: uint8(0x65)},                                         // Ä to Ae
 28323  	{FcFrom: uint16(0x00C5), FcTo0: uint8(0x41), FcTo1: uint8(0x61)},                                         // Å to Aa
 28324  	{FcFrom: uint16(0x00C6), FcTo0: uint8(0x41), FcTo1: uint8(0x45)},                                         // Æ to AE
 28325  	{FcFrom: uint16(0x00C7), FcTo0: uint8(0x43)},                                                             // Ç to C
 28326  	{FcFrom: uint16(0x00C8), FcTo0: uint8(0x45)},                                                             // È to E
 28327  	{FcFrom: uint16(0x00C9), FcTo0: uint8(0x45)},                                                             // É to E
 28328  	{FcFrom: uint16(0x00CA), FcTo0: uint8(0x45)},                                                             // Ê to E
 28329  	{FcFrom: uint16(0x00CB), FcTo0: uint8(0x45)},                                                             // Ë to E
 28330  	{FcFrom: uint16(0x00CC), FcTo0: uint8(0x49)},                                                             // Ì to I
 28331  	{FcFrom: uint16(0x00CD), FcTo0: uint8(0x49)},                                                             // Í to I
 28332  	{FcFrom: uint16(0x00CE), FcTo0: uint8(0x49)},                                                             // Î to I
 28333  	{FcFrom: uint16(0x00CF), FcTo0: uint8(0x49)},                                                             // Ï to I
 28334  	{FcFrom: uint16(0x00D0), FcTo0: uint8(0x44)},                                                             // Ð to D
 28335  	{FcFrom: uint16(0x00D1), FcTo0: uint8(0x4E)},                                                             // Ñ to N
 28336  	{FcFrom: uint16(0x00D2), FcTo0: uint8(0x4F)},                                                             // Ò to O
 28337  	{FcFrom: uint16(0x00D3), FcTo0: uint8(0x4F)},                                                             // Ó to O
 28338  	{FcFrom: uint16(0x00D4), FcTo0: uint8(0x4F)},                                                             // Ô to O
 28339  	{FcFrom: uint16(0x00D5), FcTo0: uint8(0x4F)},                                                             // Õ to O
 28340  	{FcFrom: uint16(0x00D6), FcTo0: uint8(0x4F), FcTo1: uint8(0x65)},                                         // Ö to Oe
 28341  	{FcFrom: uint16(0x00D7), FcTo0: uint8(0x78)},                                                             // × to x
 28342  	{FcFrom: uint16(0x00D8), FcTo0: uint8(0x4F)},                                                             // Ø to O
 28343  	{FcFrom: uint16(0x00D9), FcTo0: uint8(0x55)},                                                             // Ù to U
 28344  	{FcFrom: uint16(0x00DA), FcTo0: uint8(0x55)},                                                             // Ú to U
 28345  	{FcFrom: uint16(0x00DB), FcTo0: uint8(0x55)},                                                             // Û to U
 28346  	{FcFrom: uint16(0x00DC), FcTo0: uint8(0x55), FcTo1: uint8(0x65)},                                         // Ü to Ue
 28347  	{FcFrom: uint16(0x00DD), FcTo0: uint8(0x59)},                                                             // Ý to Y
 28348  	{FcFrom: uint16(0x00DE), FcTo0: uint8(0x54), FcTo1: uint8(0x68)},                                         // Þ to Th
 28349  	{FcFrom: uint16(0x00DF), FcTo0: uint8(0x73), FcTo1: uint8(0x73)},                                         // ß to ss
 28350  	{FcFrom: uint16(0x00E0), FcTo0: uint8(0x61)},                                                             // à to a
 28351  	{FcFrom: uint16(0x00E1), FcTo0: uint8(0x61)},                                                             // á to a
 28352  	{FcFrom: uint16(0x00E2), FcTo0: uint8(0x61)},                                                             // â to a
 28353  	{FcFrom: uint16(0x00E3), FcTo0: uint8(0x61)},                                                             // ã to a
 28354  	{FcFrom: uint16(0x00E4), FcTo0: uint8(0x61), FcTo1: uint8(0x65)},                                         // ä to ae
 28355  	{FcFrom: uint16(0x00E5), FcTo0: uint8(0x61), FcTo1: uint8(0x61)},                                         // å to aa
 28356  	{FcFrom: uint16(0x00E6), FcTo0: uint8(0x61), FcTo1: uint8(0x65)},                                         // æ to ae
 28357  	{FcFrom: uint16(0x00E7), FcTo0: uint8(0x63)},                                                             // ç to c
 28358  	{FcFrom: uint16(0x00E8), FcTo0: uint8(0x65)},                                                             // è to e
 28359  	{FcFrom: uint16(0x00E9), FcTo0: uint8(0x65)},                                                             // é to e
 28360  	{FcFrom: uint16(0x00EA), FcTo0: uint8(0x65)},                                                             // ê to e
 28361  	{FcFrom: uint16(0x00EB), FcTo0: uint8(0x65)},                                                             // ë to e
 28362  	{FcFrom: uint16(0x00EC), FcTo0: uint8(0x69)},                                                             // ì to i
 28363  	{FcFrom: uint16(0x00ED), FcTo0: uint8(0x69)},                                                             // í to i
 28364  	{FcFrom: uint16(0x00EE), FcTo0: uint8(0x69)},                                                             // î to i
 28365  	{FcFrom: uint16(0x00EF), FcTo0: uint8(0x69)},                                                             // ï to i
 28366  	{FcFrom: uint16(0x00F0), FcTo0: uint8(0x64)},                                                             // ð to d
 28367  	{FcFrom: uint16(0x00F1), FcTo0: uint8(0x6E)},                                                             // ñ to n
 28368  	{FcFrom: uint16(0x00F2), FcTo0: uint8(0x6F)},                                                             // ò to o
 28369  	{FcFrom: uint16(0x00F3), FcTo0: uint8(0x6F)},                                                             // ó to o
 28370  	{FcFrom: uint16(0x00F4), FcTo0: uint8(0x6F)},                                                             // ô to o
 28371  	{FcFrom: uint16(0x00F5), FcTo0: uint8(0x6F)},                                                             // õ to o
 28372  	{FcFrom: uint16(0x00F6), FcTo0: uint8(0x6F), FcTo1: uint8(0x65)},                                         // ö to oe
 28373  	{FcFrom: uint16(0x00F7), FcTo0: uint8(0x3A)},                                                             // ÷ to :
 28374  	{FcFrom: uint16(0x00F8), FcTo0: uint8(0x6F)},                                                             // ø to o
 28375  	{FcFrom: uint16(0x00F9), FcTo0: uint8(0x75)},                                                             // ù to u
 28376  	{FcFrom: uint16(0x00FA), FcTo0: uint8(0x75)},                                                             // ú to u
 28377  	{FcFrom: uint16(0x00FB), FcTo0: uint8(0x75)},                                                             // û to u
 28378  	{FcFrom: uint16(0x00FC), FcTo0: uint8(0x75), FcTo1: uint8(0x65)},                                         // ü to ue
 28379  	{FcFrom: uint16(0x00FD), FcTo0: uint8(0x79)},                                                             // ý to y
 28380  	{FcFrom: uint16(0x00FE), FcTo0: uint8(0x74), FcTo1: uint8(0x68)},                                         // þ to th
 28381  	{FcFrom: uint16(0x00FF), FcTo0: uint8(0x79)},                                                             // ÿ to y
 28382  	{FcFrom: uint16(0x0100), FcTo0: uint8(0x41)},                                                             // Ā to A
 28383  	{FcFrom: uint16(0x0101), FcTo0: uint8(0x61)},                                                             // ā to a
 28384  	{FcFrom: uint16(0x0102), FcTo0: uint8(0x41)},                                                             // Ă to A
 28385  	{FcFrom: uint16(0x0103), FcTo0: uint8(0x61)},                                                             // ă to a
 28386  	{FcFrom: uint16(0x0104), FcTo0: uint8(0x41)},                                                             // Ą to A
 28387  	{FcFrom: uint16(0x0105), FcTo0: uint8(0x61)},                                                             // ą to a
 28388  	{FcFrom: uint16(0x0106), FcTo0: uint8(0x43)},                                                             // Ć to C
 28389  	{FcFrom: uint16(0x0107), FcTo0: uint8(0x63)},                                                             // ć to c
 28390  	{FcFrom: uint16(0x0108), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Ĉ to Ch
 28391  	{FcFrom: uint16(0x0109), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // ĉ to ch
 28392  	{FcFrom: uint16(0x010A), FcTo0: uint8(0x43)},                                                             // Ċ to C
 28393  	{FcFrom: uint16(0x010B), FcTo0: uint8(0x63)},                                                             // ċ to c
 28394  	{FcFrom: uint16(0x010C), FcTo0: uint8(0x43)},                                                             // Č to C
 28395  	{FcFrom: uint16(0x010D), FcTo0: uint8(0x63)},                                                             // č to c
 28396  	{FcFrom: uint16(0x010E), FcTo0: uint8(0x44)},                                                             // Ď to D
 28397  	{FcFrom: uint16(0x010F), FcTo0: uint8(0x64)},                                                             // ď to d
 28398  	{FcFrom: uint16(0x0110), FcTo0: uint8(0x44)},                                                             // Đ to D
 28399  	{FcFrom: uint16(0x0111), FcTo0: uint8(0x64)},                                                             // đ to d
 28400  	{FcFrom: uint16(0x0112), FcTo0: uint8(0x45)},                                                             // Ē to E
 28401  	{FcFrom: uint16(0x0113), FcTo0: uint8(0x65)},                                                             // ē to e
 28402  	{FcFrom: uint16(0x0114), FcTo0: uint8(0x45)},                                                             // Ĕ to E
 28403  	{FcFrom: uint16(0x0115), FcTo0: uint8(0x65)},                                                             // ĕ to e
 28404  	{FcFrom: uint16(0x0116), FcTo0: uint8(0x45)},                                                             // Ė to E
 28405  	{FcFrom: uint16(0x0117), FcTo0: uint8(0x65)},                                                             // ė to e
 28406  	{FcFrom: uint16(0x0118), FcTo0: uint8(0x45)},                                                             // Ę to E
 28407  	{FcFrom: uint16(0x0119), FcTo0: uint8(0x65)},                                                             // ę to e
 28408  	{FcFrom: uint16(0x011A), FcTo0: uint8(0x45)},                                                             // Ě to E
 28409  	{FcFrom: uint16(0x011B), FcTo0: uint8(0x65)},                                                             // ě to e
 28410  	{FcFrom: uint16(0x011C), FcTo0: uint8(0x47), FcTo1: uint8(0x68)},                                         // Ĝ to Gh
 28411  	{FcFrom: uint16(0x011D), FcTo0: uint8(0x67), FcTo1: uint8(0x68)},                                         // ĝ to gh
 28412  	{FcFrom: uint16(0x011E), FcTo0: uint8(0x47)},                                                             // Ğ to G
 28413  	{FcFrom: uint16(0x011F), FcTo0: uint8(0x67)},                                                             // ğ to g
 28414  	{FcFrom: uint16(0x0120), FcTo0: uint8(0x47)},                                                             // Ġ to G
 28415  	{FcFrom: uint16(0x0121), FcTo0: uint8(0x67)},                                                             // ġ to g
 28416  	{FcFrom: uint16(0x0122), FcTo0: uint8(0x47)},                                                             // Ģ to G
 28417  	{FcFrom: uint16(0x0123), FcTo0: uint8(0x67)},                                                             // ģ to g
 28418  	{FcFrom: uint16(0x0124), FcTo0: uint8(0x48), FcTo1: uint8(0x68)},                                         // Ĥ to Hh
 28419  	{FcFrom: uint16(0x0125), FcTo0: uint8(0x68), FcTo1: uint8(0x68)},                                         // ĥ to hh
 28420  	{FcFrom: uint16(0x0126), FcTo0: uint8(0x48)},                                                             // Ħ to H
 28421  	{FcFrom: uint16(0x0127), FcTo0: uint8(0x68)},                                                             // ħ to h
 28422  	{FcFrom: uint16(0x0128), FcTo0: uint8(0x49)},                                                             // Ĩ to I
 28423  	{FcFrom: uint16(0x0129), FcTo0: uint8(0x69)},                                                             // ĩ to i
 28424  	{FcFrom: uint16(0x012A), FcTo0: uint8(0x49)},                                                             // Ī to I
 28425  	{FcFrom: uint16(0x012B), FcTo0: uint8(0x69)},                                                             // ī to i
 28426  	{FcFrom: uint16(0x012C), FcTo0: uint8(0x49)},                                                             // Ĭ to I
 28427  	{FcFrom: uint16(0x012D), FcTo0: uint8(0x69)},                                                             // ĭ to i
 28428  	{FcFrom: uint16(0x012E), FcTo0: uint8(0x49)},                                                             // Į to I
 28429  	{FcFrom: uint16(0x012F), FcTo0: uint8(0x69)},                                                             // į to i
 28430  	{FcFrom: uint16(0x0130), FcTo0: uint8(0x49)},                                                             // İ to I
 28431  	{FcFrom: uint16(0x0131), FcTo0: uint8(0x69)},                                                             // ı to i
 28432  	{FcFrom: uint16(0x0132), FcTo0: uint8(0x49), FcTo1: uint8(0x4A)},                                         // IJ to IJ
 28433  	{FcFrom: uint16(0x0133), FcTo0: uint8(0x69), FcTo1: uint8(0x6A)},                                         // ij to ij
 28434  	{FcFrom: uint16(0x0134), FcTo0: uint8(0x4A), FcTo1: uint8(0x68)},                                         // Ĵ to Jh
 28435  	{FcFrom: uint16(0x0135), FcTo0: uint8(0x6A), FcTo1: uint8(0x68)},                                         // ĵ to jh
 28436  	{FcFrom: uint16(0x0136), FcTo0: uint8(0x4B)},                                                             // Ķ to K
 28437  	{FcFrom: uint16(0x0137), FcTo0: uint8(0x6B)},                                                             // ķ to k
 28438  	{FcFrom: uint16(0x0138), FcTo0: uint8(0x6B)},                                                             // ĸ to k
 28439  	{FcFrom: uint16(0x0139), FcTo0: uint8(0x4C)},                                                             // Ĺ to L
 28440  	{FcFrom: uint16(0x013A), FcTo0: uint8(0x6C)},                                                             // ĺ to l
 28441  	{FcFrom: uint16(0x013B), FcTo0: uint8(0x4C)},                                                             // Ļ to L
 28442  	{FcFrom: uint16(0x013C), FcTo0: uint8(0x6C)},                                                             // ļ to l
 28443  	{FcFrom: uint16(0x013D), FcTo0: uint8(0x4C)},                                                             // Ľ to L
 28444  	{FcFrom: uint16(0x013E), FcTo0: uint8(0x6C)},                                                             // ľ to l
 28445  	{FcFrom: uint16(0x013F), FcTo0: uint8(0x4C), FcTo1: uint8(0x2E)},                                         // Ŀ to L.
 28446  	{FcFrom: uint16(0x0140), FcTo0: uint8(0x6C), FcTo1: uint8(0x2E)},                                         // ŀ to l.
 28447  	{FcFrom: uint16(0x0141), FcTo0: uint8(0x4C)},                                                             // Ł to L
 28448  	{FcFrom: uint16(0x0142), FcTo0: uint8(0x6C)},                                                             // ł to l
 28449  	{FcFrom: uint16(0x0143), FcTo0: uint8(0x4E)},                                                             // Ń to N
 28450  	{FcFrom: uint16(0x0144), FcTo0: uint8(0x6E)},                                                             // ń to n
 28451  	{FcFrom: uint16(0x0145), FcTo0: uint8(0x4E)},                                                             // Ņ to N
 28452  	{FcFrom: uint16(0x0146), FcTo0: uint8(0x6E)},                                                             // ņ to n
 28453  	{FcFrom: uint16(0x0147), FcTo0: uint8(0x4E)},                                                             // Ň to N
 28454  	{FcFrom: uint16(0x0148), FcTo0: uint8(0x6E)},                                                             // ň to n
 28455  	{FcFrom: uint16(0x0149), FcTo0: uint8(0x27), FcTo1: uint8(0x6E)},                                         // ʼn to 'n
 28456  	{FcFrom: uint16(0x014A), FcTo0: uint8(0x4E), FcTo1: uint8(0x47)},                                         // Ŋ to NG
 28457  	{FcFrom: uint16(0x014B), FcTo0: uint8(0x6E), FcTo1: uint8(0x67)},                                         // ŋ to ng
 28458  	{FcFrom: uint16(0x014C), FcTo0: uint8(0x4F)},                                                             // Ō to O
 28459  	{FcFrom: uint16(0x014D), FcTo0: uint8(0x6F)},                                                             // ō to o
 28460  	{FcFrom: uint16(0x014E), FcTo0: uint8(0x4F)},                                                             // Ŏ to O
 28461  	{FcFrom: uint16(0x014F), FcTo0: uint8(0x6F)},                                                             // ŏ to o
 28462  	{FcFrom: uint16(0x0150), FcTo0: uint8(0x4F)},                                                             // Ő to O
 28463  	{FcFrom: uint16(0x0151), FcTo0: uint8(0x6F)},                                                             // ő to o
 28464  	{FcFrom: uint16(0x0152), FcTo0: uint8(0x4F), FcTo1: uint8(0x45)},                                         // Œ to OE
 28465  	{FcFrom: uint16(0x0153), FcTo0: uint8(0x6F), FcTo1: uint8(0x65)},                                         // œ to oe
 28466  	{FcFrom: uint16(0x0154), FcTo0: uint8(0x52)},                                                             // Ŕ to R
 28467  	{FcFrom: uint16(0x0155), FcTo0: uint8(0x72)},                                                             // ŕ to r
 28468  	{FcFrom: uint16(0x0156), FcTo0: uint8(0x52)},                                                             // Ŗ to R
 28469  	{FcFrom: uint16(0x0157), FcTo0: uint8(0x72)},                                                             // ŗ to r
 28470  	{FcFrom: uint16(0x0158), FcTo0: uint8(0x52)},                                                             // Ř to R
 28471  	{FcFrom: uint16(0x0159), FcTo0: uint8(0x72)},                                                             // ř to r
 28472  	{FcFrom: uint16(0x015A), FcTo0: uint8(0x53)},                                                             // Ś to S
 28473  	{FcFrom: uint16(0x015B), FcTo0: uint8(0x73)},                                                             // ś to s
 28474  	{FcFrom: uint16(0x015C), FcTo0: uint8(0x53), FcTo1: uint8(0x68)},                                         // Ŝ to Sh
 28475  	{FcFrom: uint16(0x015D), FcTo0: uint8(0x73), FcTo1: uint8(0x68)},                                         // ŝ to sh
 28476  	{FcFrom: uint16(0x015E), FcTo0: uint8(0x53)},                                                             // Ş to S
 28477  	{FcFrom: uint16(0x015F), FcTo0: uint8(0x73)},                                                             // ş to s
 28478  	{FcFrom: uint16(0x0160), FcTo0: uint8(0x53)},                                                             // Š to S
 28479  	{FcFrom: uint16(0x0161), FcTo0: uint8(0x73)},                                                             // š to s
 28480  	{FcFrom: uint16(0x0162), FcTo0: uint8(0x54)},                                                             // Ţ to T
 28481  	{FcFrom: uint16(0x0163), FcTo0: uint8(0x74)},                                                             // ţ to t
 28482  	{FcFrom: uint16(0x0164), FcTo0: uint8(0x54)},                                                             // Ť to T
 28483  	{FcFrom: uint16(0x0165), FcTo0: uint8(0x74)},                                                             // ť to t
 28484  	{FcFrom: uint16(0x0166), FcTo0: uint8(0x54)},                                                             // Ŧ to T
 28485  	{FcFrom: uint16(0x0167), FcTo0: uint8(0x74)},                                                             // ŧ to t
 28486  	{FcFrom: uint16(0x0168), FcTo0: uint8(0x55)},                                                             // Ũ to U
 28487  	{FcFrom: uint16(0x0169), FcTo0: uint8(0x75)},                                                             // ũ to u
 28488  	{FcFrom: uint16(0x016A), FcTo0: uint8(0x55)},                                                             // Ū to U
 28489  	{FcFrom: uint16(0x016B), FcTo0: uint8(0x75)},                                                             // ū to u
 28490  	{FcFrom: uint16(0x016C), FcTo0: uint8(0x55)},                                                             // Ŭ to U
 28491  	{FcFrom: uint16(0x016D), FcTo0: uint8(0x75)},                                                             // ŭ to u
 28492  	{FcFrom: uint16(0x016E), FcTo0: uint8(0x55)},                                                             // Ů to U
 28493  	{FcFrom: uint16(0x016F), FcTo0: uint8(0x75)},                                                             // ů to u
 28494  	{FcFrom: uint16(0x0170), FcTo0: uint8(0x55)},                                                             // Ű to U
 28495  	{FcFrom: uint16(0x0171), FcTo0: uint8(0x75)},                                                             // ű to u
 28496  	{FcFrom: uint16(0x0172), FcTo0: uint8(0x55)},                                                             // Ų to U
 28497  	{FcFrom: uint16(0x0173), FcTo0: uint8(0x75)},                                                             // ų to u
 28498  	{FcFrom: uint16(0x0174), FcTo0: uint8(0x57)},                                                             // Ŵ to W
 28499  	{FcFrom: uint16(0x0175), FcTo0: uint8(0x77)},                                                             // ŵ to w
 28500  	{FcFrom: uint16(0x0176), FcTo0: uint8(0x59)},                                                             // Ŷ to Y
 28501  	{FcFrom: uint16(0x0177), FcTo0: uint8(0x79)},                                                             // ŷ to y
 28502  	{FcFrom: uint16(0x0178), FcTo0: uint8(0x59)},                                                             // Ÿ to Y
 28503  	{FcFrom: uint16(0x0179), FcTo0: uint8(0x5A)},                                                             // Ź to Z
 28504  	{FcFrom: uint16(0x017A), FcTo0: uint8(0x7A)},                                                             // ź to z
 28505  	{FcFrom: uint16(0x017B), FcTo0: uint8(0x5A)},                                                             // Ż to Z
 28506  	{FcFrom: uint16(0x017C), FcTo0: uint8(0x7A)},                                                             // ż to z
 28507  	{FcFrom: uint16(0x017D), FcTo0: uint8(0x5A)},                                                             // Ž to Z
 28508  	{FcFrom: uint16(0x017E), FcTo0: uint8(0x7A)},                                                             // ž to z
 28509  	{FcFrom: uint16(0x017F), FcTo0: uint8(0x73)},                                                             // ſ to s
 28510  	{FcFrom: uint16(0x0192), FcTo0: uint8(0x66)},                                                             // ƒ to f
 28511  	{FcFrom: uint16(0x0218), FcTo0: uint8(0x53)},                                                             // Ș to S
 28512  	{FcFrom: uint16(0x0219), FcTo0: uint8(0x73)},                                                             // ș to s
 28513  	{FcFrom: uint16(0x021A), FcTo0: uint8(0x54)},                                                             // Ț to T
 28514  	{FcFrom: uint16(0x021B), FcTo0: uint8(0x74)},                                                             // ț to t
 28515  	{FcFrom: uint16(0x0386), FcTo0: uint8(0x41)},                                                             // Ά to A
 28516  	{FcFrom: uint16(0x0388), FcTo0: uint8(0x45)},                                                             // Έ to E
 28517  	{FcFrom: uint16(0x0389), FcTo0: uint8(0x49)},                                                             // Ή to I
 28518  	{FcFrom: uint16(0x038A), FcTo0: uint8(0x49)},                                                             // Ί to I
 28519  	{FcFrom: uint16(0x038C), FcTo0: uint8(0x4f)},                                                             // Ό to O
 28520  	{FcFrom: uint16(0x038E), FcTo0: uint8(0x59)},                                                             // Ύ to Y
 28521  	{FcFrom: uint16(0x038F), FcTo0: uint8(0x4f)},                                                             // Ώ to O
 28522  	{FcFrom: uint16(0x0390), FcTo0: uint8(0x69)},                                                             // ΐ to i
 28523  	{FcFrom: uint16(0x0391), FcTo0: uint8(0x41)},                                                             // Α to A
 28524  	{FcFrom: uint16(0x0392), FcTo0: uint8(0x42)},                                                             // Β to B
 28525  	{FcFrom: uint16(0x0393), FcTo0: uint8(0x47)},                                                             // Γ to G
 28526  	{FcFrom: uint16(0x0394), FcTo0: uint8(0x44)},                                                             // Δ to D
 28527  	{FcFrom: uint16(0x0395), FcTo0: uint8(0x45)},                                                             // Ε to E
 28528  	{FcFrom: uint16(0x0396), FcTo0: uint8(0x5a)},                                                             // Ζ to Z
 28529  	{FcFrom: uint16(0x0397), FcTo0: uint8(0x49)},                                                             // Η to I
 28530  	{FcFrom: uint16(0x0398), FcTo0: uint8(0x54), FcTo1: uint8(0x68)},                                         // Θ to Th
 28531  	{FcFrom: uint16(0x0399), FcTo0: uint8(0x49)},                                                             // Ι to I
 28532  	{FcFrom: uint16(0x039A), FcTo0: uint8(0x4b)},                                                             // Κ to K
 28533  	{FcFrom: uint16(0x039B), FcTo0: uint8(0x4c)},                                                             // Λ to L
 28534  	{FcFrom: uint16(0x039C), FcTo0: uint8(0x4d)},                                                             // Μ to M
 28535  	{FcFrom: uint16(0x039D), FcTo0: uint8(0x4e)},                                                             // Ν to N
 28536  	{FcFrom: uint16(0x039E), FcTo0: uint8(0x58)},                                                             // Ξ to X
 28537  	{FcFrom: uint16(0x039F), FcTo0: uint8(0x4f)},                                                             // Ο to O
 28538  	{FcFrom: uint16(0x03A0), FcTo0: uint8(0x50)},                                                             // Π to P
 28539  	{FcFrom: uint16(0x03A1), FcTo0: uint8(0x52)},                                                             // Ρ to R
 28540  	{FcFrom: uint16(0x03A3), FcTo0: uint8(0x53)},                                                             // Σ to S
 28541  	{FcFrom: uint16(0x03A4), FcTo0: uint8(0x54)},                                                             // Τ to T
 28542  	{FcFrom: uint16(0x03A5), FcTo0: uint8(0x59)},                                                             // Υ to Y
 28543  	{FcFrom: uint16(0x03A6), FcTo0: uint8(0x46)},                                                             // Φ to F
 28544  	{FcFrom: uint16(0x03A7), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Χ to Ch
 28545  	{FcFrom: uint16(0x03A8), FcTo0: uint8(0x50), FcTo1: uint8(0x73)},                                         // Ψ to Ps
 28546  	{FcFrom: uint16(0x03A9), FcTo0: uint8(0x4f)},                                                             // Ω to O
 28547  	{FcFrom: uint16(0x03AA), FcTo0: uint8(0x49)},                                                             // Ϊ to I
 28548  	{FcFrom: uint16(0x03AB), FcTo0: uint8(0x59)},                                                             // Ϋ to Y
 28549  	{FcFrom: uint16(0x03AC), FcTo0: uint8(0x61)},                                                             // ά to a
 28550  	{FcFrom: uint16(0x03AD), FcTo0: uint8(0x65)},                                                             // έ to e
 28551  	{FcFrom: uint16(0x03AE), FcTo0: uint8(0x69)},                                                             // ή to i
 28552  	{FcFrom: uint16(0x03AF), FcTo0: uint8(0x69)},                                                             // ί to i
 28553  	{FcFrom: uint16(0x03B1), FcTo0: uint8(0x61)},                                                             // α to a
 28554  	{FcFrom: uint16(0x03B2), FcTo0: uint8(0x62)},                                                             // β to b
 28555  	{FcFrom: uint16(0x03B3), FcTo0: uint8(0x67)},                                                             // γ to g
 28556  	{FcFrom: uint16(0x03B4), FcTo0: uint8(0x64)},                                                             // δ to d
 28557  	{FcFrom: uint16(0x03B5), FcTo0: uint8(0x65)},                                                             // ε to e
 28558  	{FcFrom: uint16(0x03B6), FcTo0: uint8(0x7a)},                                                             // ζ to z
 28559  	{FcFrom: uint16(0x03B7), FcTo0: uint8(0x69)},                                                             // η to i
 28560  	{FcFrom: uint16(0x03B8), FcTo0: uint8(0x74), FcTo1: uint8(0x68)},                                         // θ to th
 28561  	{FcFrom: uint16(0x03B9), FcTo0: uint8(0x69)},                                                             // ι to i
 28562  	{FcFrom: uint16(0x03BA), FcTo0: uint8(0x6b)},                                                             // κ to k
 28563  	{FcFrom: uint16(0x03BB), FcTo0: uint8(0x6c)},                                                             // λ to l
 28564  	{FcFrom: uint16(0x03BC), FcTo0: uint8(0x6d)},                                                             // μ to m
 28565  	{FcFrom: uint16(0x03BD), FcTo0: uint8(0x6e)},                                                             // ν to n
 28566  	{FcFrom: uint16(0x03BE), FcTo0: uint8(0x78)},                                                             // ξ to x
 28567  	{FcFrom: uint16(0x03BF), FcTo0: uint8(0x6f)},                                                             // ο to o
 28568  	{FcFrom: uint16(0x03C0), FcTo0: uint8(0x70)},                                                             // π to p
 28569  	{FcFrom: uint16(0x03C1), FcTo0: uint8(0x72)},                                                             // ρ to r
 28570  	{FcFrom: uint16(0x03C3), FcTo0: uint8(0x73)},                                                             // σ to s
 28571  	{FcFrom: uint16(0x03C4), FcTo0: uint8(0x74)},                                                             // τ to t
 28572  	{FcFrom: uint16(0x03C5), FcTo0: uint8(0x79)},                                                             // υ to y
 28573  	{FcFrom: uint16(0x03C6), FcTo0: uint8(0x66)},                                                             // φ to f
 28574  	{FcFrom: uint16(0x03C7), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // χ to ch
 28575  	{FcFrom: uint16(0x03C8), FcTo0: uint8(0x70), FcTo1: uint8(0x73)},                                         // ψ to ps
 28576  	{FcFrom: uint16(0x03C9), FcTo0: uint8(0x6f)},                                                             // ω to o
 28577  	{FcFrom: uint16(0x03CA), FcTo0: uint8(0x69)},                                                             // ϊ to i
 28578  	{FcFrom: uint16(0x03CB), FcTo0: uint8(0x79)},                                                             // ϋ to y
 28579  	{FcFrom: uint16(0x03CC), FcTo0: uint8(0x6f)},                                                             // ό to o
 28580  	{FcFrom: uint16(0x03CD), FcTo0: uint8(0x79)},                                                             // ύ to y
 28581  	{FcFrom: uint16(0x03CE), FcTo0: uint8(0x69)},                                                             // ώ to i
 28582  	{FcFrom: uint16(0x0400), FcTo0: uint8(0x45)},                                                             // Ѐ to E
 28583  	{FcFrom: uint16(0x0401), FcTo0: uint8(0x45)},                                                             // Ё to E
 28584  	{FcFrom: uint16(0x0402), FcTo0: uint8(0x44)},                                                             // Ђ to D
 28585  	{FcFrom: uint16(0x0403), FcTo0: uint8(0x47)},                                                             // Ѓ to G
 28586  	{FcFrom: uint16(0x0404), FcTo0: uint8(0x45)},                                                             // Є to E
 28587  	{FcFrom: uint16(0x0405), FcTo0: uint8(0x5a)},                                                             // Ѕ to Z
 28588  	{FcFrom: uint16(0x0406), FcTo0: uint8(0x49)},                                                             // І to I
 28589  	{FcFrom: uint16(0x0407), FcTo0: uint8(0x49)},                                                             // Ї to I
 28590  	{FcFrom: uint16(0x0408), FcTo0: uint8(0x4a)},                                                             // Ј to J
 28591  	{FcFrom: uint16(0x0409), FcTo0: uint8(0x49)},                                                             // Љ to I
 28592  	{FcFrom: uint16(0x040A), FcTo0: uint8(0x4e)},                                                             // Њ to N
 28593  	{FcFrom: uint16(0x040B), FcTo0: uint8(0x44)},                                                             // Ћ to D
 28594  	{FcFrom: uint16(0x040C), FcTo0: uint8(0x4b)},                                                             // Ќ to K
 28595  	{FcFrom: uint16(0x040D), FcTo0: uint8(0x49)},                                                             // Ѝ to I
 28596  	{FcFrom: uint16(0x040E), FcTo0: uint8(0x55)},                                                             // Ў to U
 28597  	{FcFrom: uint16(0x040F), FcTo0: uint8(0x44)},                                                             // Џ to D
 28598  	{FcFrom: uint16(0x0410), FcTo0: uint8(0x41)},                                                             // А to A
 28599  	{FcFrom: uint16(0x0411), FcTo0: uint8(0x42)},                                                             // Б to B
 28600  	{FcFrom: uint16(0x0412), FcTo0: uint8(0x56)},                                                             // В to V
 28601  	{FcFrom: uint16(0x0413), FcTo0: uint8(0x47)},                                                             // Г to G
 28602  	{FcFrom: uint16(0x0414), FcTo0: uint8(0x44)},                                                             // Д to D
 28603  	{FcFrom: uint16(0x0415), FcTo0: uint8(0x45)},                                                             // Е to E
 28604  	{FcFrom: uint16(0x0416), FcTo0: uint8(0x5a), FcTo1: uint8(0x68)},                                         // Ж to Zh
 28605  	{FcFrom: uint16(0x0417), FcTo0: uint8(0x5a)},                                                             // З to Z
 28606  	{FcFrom: uint16(0x0418), FcTo0: uint8(0x49)},                                                             // И to I
 28607  	{FcFrom: uint16(0x0419), FcTo0: uint8(0x49)},                                                             // Й to I
 28608  	{FcFrom: uint16(0x041A), FcTo0: uint8(0x4b)},                                                             // К to K
 28609  	{FcFrom: uint16(0x041B), FcTo0: uint8(0x4c)},                                                             // Л to L
 28610  	{FcFrom: uint16(0x041C), FcTo0: uint8(0x4d)},                                                             // М to M
 28611  	{FcFrom: uint16(0x041D), FcTo0: uint8(0x4e)},                                                             // Н to N
 28612  	{FcFrom: uint16(0x041E), FcTo0: uint8(0x4f)},                                                             // О to O
 28613  	{FcFrom: uint16(0x041F), FcTo0: uint8(0x50)},                                                             // П to P
 28614  	{FcFrom: uint16(0x0420), FcTo0: uint8(0x52)},                                                             // Р to R
 28615  	{FcFrom: uint16(0x0421), FcTo0: uint8(0x53)},                                                             // С to S
 28616  	{FcFrom: uint16(0x0422), FcTo0: uint8(0x54)},                                                             // Т to T
 28617  	{FcFrom: uint16(0x0423), FcTo0: uint8(0x55)},                                                             // У to U
 28618  	{FcFrom: uint16(0x0424), FcTo0: uint8(0x46)},                                                             // Ф to F
 28619  	{FcFrom: uint16(0x0425), FcTo0: uint8(0x4b), FcTo1: uint8(0x68)},                                         // Х to Kh
 28620  	{FcFrom: uint16(0x0426), FcTo0: uint8(0x54), FcTo1: uint8(0x63)},                                         // Ц to Tc
 28621  	{FcFrom: uint16(0x0427), FcTo0: uint8(0x43), FcTo1: uint8(0x68)},                                         // Ч to Ch
 28622  	{FcFrom: uint16(0x0428), FcTo0: uint8(0x53), FcTo1: uint8(0x68)},                                         // Ш to Sh
 28623  	{FcFrom: uint16(0x0429), FcTo0: uint8(0x53), FcTo1: uint8(0x68), FcTo2: uint8(0x63), FcTo3: uint8(0x68)}, // Щ to Shch
 28624  	{FcFrom: uint16(0x042A), FcTo0: uint8(0x61)},                                                             //  to A
 28625  	{FcFrom: uint16(0x042B), FcTo0: uint8(0x59)},                                                             // Ы to Y
 28626  	{FcFrom: uint16(0x042C), FcTo0: uint8(0x59)},                                                             //  to Y
 28627  	{FcFrom: uint16(0x042D), FcTo0: uint8(0x45)},                                                             // Э to E
 28628  	{FcFrom: uint16(0x042E), FcTo0: uint8(0x49), FcTo1: uint8(0x75)},                                         // Ю to Iu
 28629  	{FcFrom: uint16(0x042F), FcTo0: uint8(0x49), FcTo1: uint8(0x61)},                                         // Я to Ia
 28630  	{FcFrom: uint16(0x0430), FcTo0: uint8(0x61)},                                                             // а to a
 28631  	{FcFrom: uint16(0x0431), FcTo0: uint8(0x62)},                                                             // б to b
 28632  	{FcFrom: uint16(0x0432), FcTo0: uint8(0x76)},                                                             // в to v
 28633  	{FcFrom: uint16(0x0433), FcTo0: uint8(0x67)},                                                             // г to g
 28634  	{FcFrom: uint16(0x0434), FcTo0: uint8(0x64)},                                                             // д to d
 28635  	{FcFrom: uint16(0x0435), FcTo0: uint8(0x65)},                                                             // е to e
 28636  	{FcFrom: uint16(0x0436), FcTo0: uint8(0x7a), FcTo1: uint8(0x68)},                                         // ж to zh
 28637  	{FcFrom: uint16(0x0437), FcTo0: uint8(0x7a)},                                                             // з to z
 28638  	{FcFrom: uint16(0x0438), FcTo0: uint8(0x69)},                                                             // и to i
 28639  	{FcFrom: uint16(0x0439), FcTo0: uint8(0x69)},                                                             // й to i
 28640  	{FcFrom: uint16(0x043A), FcTo0: uint8(0x6b)},                                                             // к to k
 28641  	{FcFrom: uint16(0x043B), FcTo0: uint8(0x6c)},                                                             // л to l
 28642  	{FcFrom: uint16(0x043C), FcTo0: uint8(0x6d)},                                                             // м to m
 28643  	{FcFrom: uint16(0x043D), FcTo0: uint8(0x6e)},                                                             // н to n
 28644  	{FcFrom: uint16(0x043E), FcTo0: uint8(0x6f)},                                                             // о to o
 28645  	{FcFrom: uint16(0x043F), FcTo0: uint8(0x70)},                                                             // п to p
 28646  	{FcFrom: uint16(0x0440), FcTo0: uint8(0x72)},                                                             // р to r
 28647  	{FcFrom: uint16(0x0441), FcTo0: uint8(0x73)},                                                             // с to s
 28648  	{FcFrom: uint16(0x0442), FcTo0: uint8(0x74)},                                                             // т to t
 28649  	{FcFrom: uint16(0x0443), FcTo0: uint8(0x75)},                                                             // у to u
 28650  	{FcFrom: uint16(0x0444), FcTo0: uint8(0x66)},                                                             // ф to f
 28651  	{FcFrom: uint16(0x0445), FcTo0: uint8(0x6b), FcTo1: uint8(0x68)},                                         // х to kh
 28652  	{FcFrom: uint16(0x0446), FcTo0: uint8(0x74), FcTo1: uint8(0x63)},                                         // ц to tc
 28653  	{FcFrom: uint16(0x0447), FcTo0: uint8(0x63), FcTo1: uint8(0x68)},                                         // ч to ch
 28654  	{FcFrom: uint16(0x0448), FcTo0: uint8(0x73), FcTo1: uint8(0x68)},                                         // ш to sh
 28655  	{FcFrom: uint16(0x0449), FcTo0: uint8(0x73), FcTo1: uint8(0x68), FcTo2: uint8(0x63), FcTo3: uint8(0x68)}, // щ to shch
 28656  	{FcFrom: uint16(0x044A), FcTo0: uint8(0x61)},                                                             //  to a
 28657  	{FcFrom: uint16(0x044B), FcTo0: uint8(0x79)},                                                             // ы to y
 28658  	{FcFrom: uint16(0x044C), FcTo0: uint8(0x79)},                                                             //  to y
 28659  	{FcFrom: uint16(0x044D), FcTo0: uint8(0x65)},                                                             // э to e
 28660  	{FcFrom: uint16(0x044E), FcTo0: uint8(0x69), FcTo1: uint8(0x75)},                                         // ю to iu
 28661  	{FcFrom: uint16(0x044F), FcTo0: uint8(0x69), FcTo1: uint8(0x61)},                                         // я to ia
 28662  	{FcFrom: uint16(0x0450), FcTo0: uint8(0x65)},                                                             // ѐ to e
 28663  	{FcFrom: uint16(0x0451), FcTo0: uint8(0x65)},                                                             // ё to e
 28664  	{FcFrom: uint16(0x0452), FcTo0: uint8(0x64)},                                                             // ђ to d
 28665  	{FcFrom: uint16(0x0453), FcTo0: uint8(0x67)},                                                             // ѓ to g
 28666  	{FcFrom: uint16(0x0454), FcTo0: uint8(0x65)},                                                             // є to e
 28667  	{FcFrom: uint16(0x0455), FcTo0: uint8(0x7a)},                                                             // ѕ to z
 28668  	{FcFrom: uint16(0x0456), FcTo0: uint8(0x69)},                                                             // і to i
 28669  	{FcFrom: uint16(0x0457), FcTo0: uint8(0x69)},                                                             // ї to i
 28670  	{FcFrom: uint16(0x0458), FcTo0: uint8(0x6a)},                                                             // ј to j
 28671  	{FcFrom: uint16(0x0459), FcTo0: uint8(0x69)},                                                             // љ to i
 28672  	{FcFrom: uint16(0x045A), FcTo0: uint8(0x6e)},                                                             // њ to n
 28673  	{FcFrom: uint16(0x045B), FcTo0: uint8(0x64)},                                                             // ћ to d
 28674  	{FcFrom: uint16(0x045C), FcTo0: uint8(0x6b)},                                                             // ќ to k
 28675  	{FcFrom: uint16(0x045D), FcTo0: uint8(0x69)},                                                             // ѝ to i
 28676  	{FcFrom: uint16(0x045E), FcTo0: uint8(0x75)},                                                             // ў to u
 28677  	{FcFrom: uint16(0x045F), FcTo0: uint8(0x64)},                                                             // џ to d
 28678  	{FcFrom: uint16(0x1E02), FcTo0: uint8(0x42)},                                                             // Ḃ to B
 28679  	{FcFrom: uint16(0x1E03), FcTo0: uint8(0x62)},                                                             // ḃ to b
 28680  	{FcFrom: uint16(0x1E0A), FcTo0: uint8(0x44)},                                                             // Ḋ to D
 28681  	{FcFrom: uint16(0x1E0B), FcTo0: uint8(0x64)},                                                             // ḋ to d
 28682  	{FcFrom: uint16(0x1E1E), FcTo0: uint8(0x46)},                                                             // Ḟ to F
 28683  	{FcFrom: uint16(0x1E1F), FcTo0: uint8(0x66)},                                                             // ḟ to f
 28684  	{FcFrom: uint16(0x1E40), FcTo0: uint8(0x4D)},                                                             // Ṁ to M
 28685  	{FcFrom: uint16(0x1E41), FcTo0: uint8(0x6D)},                                                             // ṁ to m
 28686  	{FcFrom: uint16(0x1E56), FcTo0: uint8(0x50)},                                                             // Ṗ to P
 28687  	{FcFrom: uint16(0x1E57), FcTo0: uint8(0x70)},                                                             // ṗ to p
 28688  	{FcFrom: uint16(0x1E60), FcTo0: uint8(0x53)},                                                             // Ṡ to S
 28689  	{FcFrom: uint16(0x1E61), FcTo0: uint8(0x73)},                                                             // ṡ to s
 28690  	{FcFrom: uint16(0x1E6A), FcTo0: uint8(0x54)},                                                             // Ṫ to T
 28691  	{FcFrom: uint16(0x1E6B), FcTo0: uint8(0x74)},                                                             // ṫ to t
 28692  	{FcFrom: uint16(0x1E80), FcTo0: uint8(0x57)},                                                             // Ẁ to W
 28693  	{FcFrom: uint16(0x1E81), FcTo0: uint8(0x77)},                                                             // ẁ to w
 28694  	{FcFrom: uint16(0x1E82), FcTo0: uint8(0x57)},                                                             // Ẃ to W
 28695  	{FcFrom: uint16(0x1E83), FcTo0: uint8(0x77)},                                                             // ẃ to w
 28696  	{FcFrom: uint16(0x1E84), FcTo0: uint8(0x57)},                                                             // Ẅ to W
 28697  	{FcFrom: uint16(0x1E85), FcTo0: uint8(0x77)},                                                             // ẅ to w
 28698  	{FcFrom: uint16(0x1EF2), FcTo0: uint8(0x59)},                                                             // Ỳ to Y
 28699  	{FcFrom: uint16(0x1EF3), FcTo0: uint8(0x79)},                                                             // ỳ to y
 28700  	{FcFrom: uint16(0xFB00), FcTo0: uint8(0x66), FcTo1: uint8(0x66)},                                         // ff to ff
 28701  	{FcFrom: uint16(0xFB01), FcTo0: uint8(0x66), FcTo1: uint8(0x69)},                                         // fi to fi
 28702  	{FcFrom: uint16(0xFB02), FcTo0: uint8(0x66), FcTo1: uint8(0x6C)},                                         // fl to fl
 28703  	{FcFrom: uint16(0xFB05), FcTo0: uint8(0x73), FcTo1: uint8(0x74)},                                         // ſt to st
 28704  	{FcFrom: uint16(0xFB06), FcTo0: uint8(0x73), FcTo1: uint8(0x74)},                                         // st to st
 28705  } /* spellfix.c:1306:30 */
 28706  
 28707  func spellfixFindTranslit(tls *libc.TLS, c int32, pxTop uintptr) uintptr { /* spellfix.c:1698:30: */
 28708  	*(*int32)(unsafe.Pointer(pxTop)) = (int32((uint32(unsafe.Sizeof(translit)) / uint32(unsafe.Sizeof(Transliteration{}))) - uint32(1)))
 28709  	return uintptr(unsafe.Pointer(&translit))
 28710  }
 28711  
 28712  // Convert the input string from UTF-8 into pure ASCII by converting
 28713  // all non-ASCII characters to some combination of characters in the
 28714  // ASCII subset.
 28715  //
 28716  // The returned string might contain more characters than the input.
 28717  //
 28718  // Space to hold the returned string comes from sqlite3_malloc() and
 28719  // should be freed by the caller.
 28720  func transliterate(tls *libc.TLS, zIn uintptr, nIn int32) uintptr { /* spellfix.c:1713:22: */
 28721  	bp := tls.Alloc(8)
 28722  	defer tls.Free(8)
 28723  
 28724  	var zOut uintptr = sqlite3.Xsqlite3_malloc64(tls, (uint64((nIn * 4) + 1)))
 28725  	var c int32
 28726  	// var sz int32 at bp, 4
 28727  
 28728  	var nOut int32
 28729  	if zOut == uintptr(0) {
 28730  		return uintptr(0)
 28731  	}
 28732  	nOut = 0
 28733  	for nIn > 0 {
 28734  		c = utf8Read(tls, zIn, nIn, bp /* &sz */)
 28735  		zIn += uintptr(*(*int32)(unsafe.Pointer(bp /* sz */)))
 28736  		nIn = nIn - (*(*int32)(unsafe.Pointer(bp /* sz */)))
 28737  		if c <= 127 {
 28738  			*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = uint8(c)
 28739  		} else {
 28740  			// var xTop int32 at bp+4, 4
 28741  
 28742  			var xBtm int32
 28743  			var x int32
 28744  			var tbl uintptr = spellfixFindTranslit(tls, c, bp+4 /* &xTop */)
 28745  			xBtm = 0
 28746  			for *(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) >= xBtm {
 28747  				x = ((*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) + xBtm) / 2)
 28748  				if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) == c {
 28749  					*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo0
 28750  					if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo1 != 0 {
 28751  						*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo1
 28752  						if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo2 != 0 {
 28753  							*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo2
 28754  							if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo3 != 0 {
 28755  								*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = (*Transliteration)(unsafe.Pointer(tbl + uintptr(x)*6)).FcTo3
 28756  							}
 28757  						}
 28758  					}
 28759  					c = 0
 28760  					break
 28761  				} else if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) > c {
 28762  					*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) = (x - 1)
 28763  				} else {
 28764  					xBtm = (x + 1)
 28765  				}
 28766  			}
 28767  			if c != 0 {
 28768  				*(*uint8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&nOut, 1)))) = uint8('?')
 28769  			}
 28770  		}
 28771  	}
 28772  	*(*uint8)(unsafe.Pointer(zOut + uintptr(nOut))) = uint8(0)
 28773  	return zOut
 28774  }
 28775  
 28776  // Return the number of characters in the shortest prefix of the input
 28777  // string that transliterates to an ASCII string nTrans bytes or longer.
 28778  // Or, if the transliteration of the input string is less than nTrans
 28779  // bytes in size, return the number of characters in the input string.
 28780  func translen_to_charlen(tls *libc.TLS, zIn uintptr, nIn int32, nTrans int32) int32 { /* spellfix.c:1771:12: */
 28781  	bp := tls.Alloc(8)
 28782  	defer tls.Free(8)
 28783  
 28784  	var i int32
 28785  	var c int32
 28786  	// var sz int32 at bp, 4
 28787  
 28788  	var nOut int32
 28789  	var nChar int32
 28790  
 28791  	i = libc.AssignInt32(&nOut, 0)
 28792  	for nChar = 0; (i < nIn) && (nOut < nTrans); nChar++ {
 28793  		c = utf8Read(tls, (zIn + uintptr(i)), (nIn - i), bp /* &sz */)
 28794  		i = i + (*(*int32)(unsafe.Pointer(bp /* sz */)))
 28795  
 28796  		nOut++
 28797  		if c >= 128 {
 28798  			// var xTop int32 at bp+4, 4
 28799  
 28800  			var xBtm int32
 28801  			var x int32
 28802  			var tbl uintptr = spellfixFindTranslit(tls, c, bp+4 /* &xTop */)
 28803  			xBtm = 0
 28804  			for *(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) >= xBtm {
 28805  				x = ((*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) + xBtm) / 2)
 28806  				if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) == c {
 28807  					if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo1 != 0 {
 28808  						nOut++
 28809  						if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo2 != 0 {
 28810  							nOut++
 28811  							if (*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcTo3 != 0 {
 28812  								nOut++
 28813  							}
 28814  						}
 28815  					}
 28816  					break
 28817  				} else if int32((*Transliteration)(unsafe.Pointer(tbl+uintptr(x)*6)).FcFrom) > c {
 28818  					*(*int32)(unsafe.Pointer(bp + 4 /* xTop */)) = (x - 1)
 28819  				} else {
 28820  					xBtm = (x + 1)
 28821  				}
 28822  			}
 28823  		}
 28824  	}
 28825  
 28826  	return nChar
 28827  }
 28828  
 28829  //    spellfix1_translit(X)
 28830  //
 28831  // Convert a string that contains non-ASCII Roman characters into
 28832  // pure ASCII.
 28833  func transliterateSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1817:13: */
 28834  	var zIn uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28835  	var nIn int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28836  	var zOut uintptr = transliterate(tls, zIn, nIn)
 28837  	if zOut == uintptr(0) {
 28838  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 28839  	} else {
 28840  		sqlite3.Xsqlite3_result_text(tls, context, zOut, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 28841  	}
 28842  }
 28843  
 28844  //    spellfix1_scriptcode(X)
 28845  //
 28846  // Try to determine the dominant script used by the word X and return
 28847  // its ISO 15924 numeric code.
 28848  //
 28849  // The current implementation only understands the following scripts:
 28850  //
 28851  //    215  (Latin)
 28852  //    220  (Cyrillic)
 28853  //    200  (Greek)
 28854  //
 28855  // This routine will return 998 if the input X contains characters from
 28856  // two or more of the above scripts or 999 if X contains no characters
 28857  // from any of the above scripts.
 28858  func scriptCodeSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* spellfix.c:1848:13: */
 28859  	bp := tls.Alloc(4)
 28860  	defer tls.Free(4)
 28861  
 28862  	var zIn uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28863  	var nIn int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 28864  	var c int32
 28865  	// var sz int32 at bp, 4
 28866  
 28867  	var scriptMask int32 = 0
 28868  	var res int32
 28869  	var seenDigit int32 = 0
 28870  
 28871  	for nIn > 0 {
 28872  		c = utf8Read(tls, zIn, nIn, bp /* &sz */)
 28873  		zIn += uintptr(*(*int32)(unsafe.Pointer(bp /* sz */)))
 28874  		nIn = nIn - (*(*int32)(unsafe.Pointer(bp /* sz */)))
 28875  		if c < 0x02af {
 28876  			if (c >= 0x80) || (int32(midClass[(c&0x7f)]) < CCLASS_DIGIT) {
 28877  				scriptMask = scriptMask | (SCRIPT_LATIN)
 28878  			} else if (c >= '0') && (c <= '9') {
 28879  				seenDigit = 1
 28880  			}
 28881  		} else if (c >= 0x0400) && (c <= 0x04ff) {
 28882  			scriptMask = scriptMask | (SCRIPT_CYRILLIC)
 28883  		} else if (c >= 0x0386) && (c <= 0x03ce) {
 28884  			scriptMask = scriptMask | (SCRIPT_GREEK)
 28885  		} else if (c >= 0x0590) && (c <= 0x05ff) {
 28886  			scriptMask = scriptMask | (SCRIPT_HEBREW)
 28887  		} else if (c >= 0x0600) && (c <= 0x06ff) {
 28888  			scriptMask = scriptMask | (SCRIPT_ARABIC)
 28889  		}
 28890  	}
 28891  	if (scriptMask == 0) && (seenDigit != 0) {
 28892  		scriptMask = SCRIPT_LATIN
 28893  	}
 28894  	switch scriptMask {
 28895  	case 0:
 28896  		res = 999
 28897  		break
 28898  	case SCRIPT_LATIN:
 28899  		res = 215
 28900  		break
 28901  	case SCRIPT_CYRILLIC:
 28902  		res = 220
 28903  		break
 28904  	case SCRIPT_GREEK:
 28905  		res = 200
 28906  		break
 28907  	case SCRIPT_HEBREW:
 28908  		res = 125
 28909  		break
 28910  	case SCRIPT_ARABIC:
 28911  		res = 160
 28912  		break
 28913  	default:
 28914  		res = 998
 28915  		break
 28916  	}
 28917  	sqlite3.Xsqlite3_result_int(tls, context, res)
 28918  }
 28919  
 28920  // End transliterate
 28921  //
 28922  //
 28923  // Begin spellfix1 virtual table.
 28924  
 28925  // Maximum length of a phonehash used for querying the shadow table
 28926  
 28927  // Maximum number of hash strings to examine per query
 28928  
 28929  type spellfix1_vtab1 = struct {
 28930  	Fbase       sqlite3_vtab
 28931  	Fdb         uintptr
 28932  	FzDbName    uintptr
 28933  	FzTableName uintptr
 28934  	FzCostTable uintptr
 28935  	FpConfig3   uintptr
 28936  } /* spellfix.c:1910:9 */
 28937  
 28938  // End transliterate
 28939  //
 28940  //
 28941  // Begin spellfix1 virtual table.
 28942  
 28943  // Maximum length of a phonehash used for querying the shadow table
 28944  
 28945  // Maximum number of hash strings to examine per query
 28946  
 28947  type spellfix1_vtab = spellfix1_vtab1 /* spellfix.c:1910:31 */
 28948  type spellfix1_cursor1 = struct {
 28949  	Fbase      sqlite3_vtab_cursor
 28950  	FpVTab     uintptr
 28951  	FzPattern  uintptr
 28952  	FidxNum    int32
 28953  	FnRow      int32
 28954  	FnAlloc    int32
 28955  	FiRow      int32
 28956  	FiLang     int32
 28957  	FiTop      int32
 28958  	FiScope    int32
 28959  	FnSearch   int32
 28960  	FpFullScan uintptr
 28961  	Fa         uintptr
 28962  } /* spellfix.c:1911:9 */
 28963  
 28964  type spellfix1_cursor = spellfix1_cursor1 /* spellfix.c:1911:33 */
 28965  
 28966  // Fuzzy-search cursor object
 28967  type spellfix1_row = struct {
 28968  	FiRowid    sqlite3_int64
 28969  	FzWord     uintptr
 28970  	FiRank     int32
 28971  	FiDistance int32
 28972  	FiScore    int32
 28973  	FiMatchlen int32
 28974  	FzHash     [32]int8
 28975  	_          [4]byte
 28976  } /* spellfix.c:1911:9 */
 28977  
 28978  // Construct one or more SQL statements from the format string given
 28979  // and then evaluate those statements. The success code is written
 28980  // into *pRc.
 28981  //
 28982  // If *pRc is initially non-zero then this routine is a no-op.
 28983  func spellfix1DbExec(tls *libc.TLS, pRc uintptr, db uintptr, zFormat uintptr, va uintptr) { /* spellfix.c:1955:13: */
 28984  	var ap va_list
 28985  	_ = ap
 28986  	var zSql uintptr
 28987  	if *(*int32)(unsafe.Pointer(pRc)) != 0 {
 28988  		return
 28989  	}
 28990  	ap = va
 28991  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFormat, ap)
 28992  	_ = ap
 28993  	if zSql == uintptr(0) {
 28994  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 28995  	} else {
 28996  		*(*int32)(unsafe.Pointer(pRc)) = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 28997  		sqlite3.Xsqlite3_free(tls, zSql)
 28998  	}
 28999  }
 29000  
 29001  // xDisconnect/xDestroy method for the fuzzy-search module.
 29002  func spellfix1Uninit(tls *libc.TLS, isDestroy int32, pVTab uintptr) int32 { /* spellfix.c:1978:12: */
 29003  	bp := tls.Alloc(20)
 29004  	defer tls.Free(20)
 29005  
 29006  	var p uintptr = pVTab
 29007  	*(*int32)(unsafe.Pointer(bp + 16 /* rc */)) = SQLITE_OK
 29008  	if isDestroy != 0 {
 29009  		var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 29010  		spellfix1DbExec(tls, bp+16 /* &rc */, db, ts+6635, /* "DROP TABLE IF EX..." */
 29011  			libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName))
 29012  	}
 29013  	if *(*int32)(unsafe.Pointer(bp + 16 /* rc */)) == SQLITE_OK {
 29014  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName)
 29015  		editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 29016  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 29017  		sqlite3.Xsqlite3_free(tls, p)
 29018  	}
 29019  	return *(*int32)(unsafe.Pointer(bp + 16 /* rc */))
 29020  }
 29021  
 29022  func spellfix1Disconnect(tls *libc.TLS, pVTab uintptr) int32 { /* spellfix.c:1994:12: */
 29023  	return spellfix1Uninit(tls, 0, pVTab)
 29024  }
 29025  
 29026  func spellfix1Destroy(tls *libc.TLS, pVTab uintptr) int32 { /* spellfix.c:1997:12: */
 29027  	return spellfix1Uninit(tls, 1, pVTab)
 29028  }
 29029  
 29030  // Make a copy of a string.  Remove leading and trailing whitespace
 29031  // and dequote it.
 29032  func spellfix1Dequote(tls *libc.TLS, zIn uintptr) uintptr { /* spellfix.c:2005:13: */
 29033  	bp := tls.Alloc(8)
 29034  	defer tls.Free(8)
 29035  
 29036  	var zOut uintptr
 29037  	var i int32
 29038  	var j int32
 29039  	var c int8
 29040  	for (int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zIn)))))*2))) & int32(_ISspace)) != 0 {
 29041  		zIn++
 29042  	}
 29043  	zOut = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zIn))
 29044  	if zOut == uintptr(0) {
 29045  		return uintptr(0)
 29046  	}
 29047  	i = int32(libc.Xstrlen(tls, zOut))
 29048  	*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = int8(0)
 29049  	c = *(*int8)(unsafe.Pointer(zOut))
 29050  	if (int32(c) == '\'') || (int32(c) == '"') {
 29051  		i = 1
 29052  		j = 0
 29053  		for ; 1 != 0; i++ {
 29054  			*(*int8)(unsafe.Pointer(zOut + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(zOut + uintptr(i)))
 29055  			if int32(*(*int8)(unsafe.Pointer(zOut + uintptr(i)))) == int32(c) {
 29056  				if int32(*(*int8)(unsafe.Pointer(zOut + uintptr((i + 1))))) == int32(c) {
 29057  					i++
 29058  				} else {
 29059  					*(*int8)(unsafe.Pointer(zOut + uintptr((j - 1)))) = int8(0)
 29060  					break
 29061  				}
 29062  			}
 29063  		}
 29064  	}
 29065  	return zOut
 29066  }
 29067  
 29068  // xConnect/xCreate method for the spellfix1 module. Arguments are:
 29069  //
 29070  //   argv[0]   -> module name  ("spellfix1")
 29071  //   argv[1]   -> database name
 29072  //   argv[2]   -> table name
 29073  //   argv[3].. -> optional arguments (i.e. "edit_cost_table" parameter)
 29074  func spellfix1Init(tls *libc.TLS, isCreate int32, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2043:12: */
 29075  	bp := tls.Alloc(60)
 29076  	defer tls.Free(60)
 29077  
 29078  	var pNew uintptr = uintptr(0)
 29079  	// const char *zModule = argv[0]; // not used
 29080  	var zDbName uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 29081  	var zTableName uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*4))
 29082  	var nDbName int32
 29083  	*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_OK
 29084  	var i int32
 29085  
 29086  	nDbName = int32(libc.Xstrlen(tls, zDbName))
 29087  	pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64((uint32(unsafe.Sizeof(spellfix1_vtab{})) + uint32(nDbName)) + uint32(1))))
 29088  	if pNew == uintptr(0) {
 29089  		*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 29090  	} else {
 29091  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(spellfix1_vtab{})))
 29092  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzDbName = (pNew + 1*32)
 29093  		libc.Xmemcpy(tls, (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzDbName, zDbName, (uint32(nDbName + 1)))
 29094  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zTableName))
 29095  		(*spellfix1_vtab)(unsafe.Pointer(pNew)).Fdb = db
 29096  		if (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzTableName == uintptr(0) {
 29097  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 29098  		} else {
 29099  			sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 29100  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db,
 29101  
 29102  				ts+6672 /* "CREATE TABLE x(w..." */)
 29103  		}
 29104  		if (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK) && (isCreate != 0) {
 29105  			spellfix1DbExec(tls, bp+56 /* &rc */, db,
 29106  
 29107  				ts+6826, /* "CREATE TABLE IF ..." */
 29108  				libc.VaList(bp+8, zDbName, zTableName))
 29109  			spellfix1DbExec(tls, bp+56 /* &rc */, db,
 29110  
 29111  				ts+6960, /* "CREATE INDEX IF ..." */
 29112  				libc.VaList(bp+24, zDbName, zTableName, zTableName))
 29113  		}
 29114  		for i = 3; (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) == SQLITE_OK) && (i < argc); i++ {
 29115  			if (libc.Xstrncmp(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), ts+7045 /* "edit_cost_table=" */, uint32(16)) == 0) && ((*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable == uintptr(0)) {
 29116  				(*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable = spellfix1Dequote(tls, (*(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) + 16))
 29117  				if (*spellfix1_vtab)(unsafe.Pointer(pNew)).FzCostTable == uintptr(0) {
 29118  					*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_NOMEM
 29119  				}
 29120  				continue
 29121  			}
 29122  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7062 /* "bad argument to ..." */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 29123  			*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = SQLITE_ERROR
 29124  		}
 29125  	}
 29126  
 29127  	if (*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) != 0) && (pNew != 0) {
 29128  		*(*uintptr)(unsafe.Pointer(ppVTab)) = uintptr(0)
 29129  		spellfix1Uninit(tls, 0, (pNew /* &.base */))
 29130  	} else {
 29131  		*(*uintptr)(unsafe.Pointer(ppVTab)) = pNew
 29132  	}
 29133  	return *(*int32)(unsafe.Pointer(bp + 56 /* rc */))
 29134  }
 29135  
 29136  // The xConnect and xCreate methods
 29137  func spellfix1Connect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2133:12: */
 29138  	return spellfix1Init(tls, 0, db, pAux, argc, argv, ppVTab, pzErr)
 29139  }
 29140  
 29141  func spellfix1Create(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVTab uintptr, pzErr uintptr) int32 { /* spellfix.c:2142:12: */
 29142  	return spellfix1Init(tls, 1, db, pAux, argc, argv, ppVTab, pzErr)
 29143  }
 29144  
 29145  // Clear all of the content from a cursor.
 29146  func spellfix1ResetCursor(tls *libc.TLS, pCur uintptr) { /* spellfix.c:2155:13: */
 29147  	var i int32
 29148  	for i = 0; i < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow; i++ {
 29149  		sqlite3.Xsqlite3_free(tls, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(i)*64)).FzWord)
 29150  	}
 29151  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow = 0
 29152  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = 0
 29153  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch = 0
 29154  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 29155  		sqlite3.Xsqlite3_finalize(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 29156  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan = uintptr(0)
 29157  	}
 29158  }
 29159  
 29160  // Resize the cursor to hold up to N rows of content
 29161  func spellfix1ResizeCursor(tls *libc.TLS, pCur uintptr, N int32) { /* spellfix.c:2172:13: */
 29162  	var aNew uintptr
 29163  
 29164  	aNew = sqlite3.Xsqlite3_realloc64(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa, (uint64(uint32(unsafe.Sizeof(spellfix1_row{})) * uint32(N))))
 29165  	if (aNew == uintptr(0)) && (N > 0) {
 29166  		spellfix1ResetCursor(tls, pCur)
 29167  		sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa)
 29168  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc = 0
 29169  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa = uintptr(0)
 29170  	} else {
 29171  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc = N
 29172  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa = aNew
 29173  	}
 29174  }
 29175  
 29176  // Close a fuzzy-search cursor.
 29177  func spellfix1Close(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2191:12: */
 29178  	var pCur uintptr = cur
 29179  	spellfix1ResetCursor(tls, pCur)
 29180  	spellfix1ResizeCursor(tls, pCur, 0)
 29181  	sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern)
 29182  	sqlite3.Xsqlite3_free(tls, pCur)
 29183  	return SQLITE_OK
 29184  }
 29185  
 29186  //
 29187  // The plan number is a bitmask of the SPELLFIX_IDXNUM_* values defined
 29188  // above.
 29189  //
 29190  // filter.argv[*] values contains $str, $langid, $top, $scope and $rowid
 29191  // if specified and in that order.
 29192  func spellfix1BestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* spellfix.c:2217:12: */
 29193  	var iPlan int32 = 0
 29194  	var iLangTerm int32 = -1
 29195  	var iTopTerm int32 = -1
 29196  	var iScopeTerm int32 = -1
 29197  	var iDistTerm int32 = -1
 29198  	var iRowidTerm int32 = -1
 29199  	var i int32
 29200  	var pConstraint uintptr
 29201  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 29202  	i = 0
 29203  __1:
 29204  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 29205  		goto __3
 29206  	}
 29207  	{
 29208  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 29209  			goto __2
 29210  		}
 29211  
 29212  		// Terms of the form:  word MATCH $str
 29213  		if (((iPlan & SPELLFIX_IDXNUM_MATCH) == 0) &&
 29214  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_WORD)) &&
 29215  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) {
 29216  			iPlan = iPlan | (SPELLFIX_IDXNUM_MATCH)
 29217  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).FargvIndex = 1
 29218  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(i)*8)).Fomit = uint8(1)
 29219  		}
 29220  
 29221  		// Terms of the form:  langid = $langid
 29222  		if (((iPlan & SPELLFIX_IDXNUM_LANGID) == 0) &&
 29223  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_LANGID)) &&
 29224  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 29225  			iPlan = iPlan | (SPELLFIX_IDXNUM_LANGID)
 29226  			iLangTerm = i
 29227  		}
 29228  
 29229  		// Terms of the form:  top = $top
 29230  		if (((iPlan & SPELLFIX_IDXNUM_TOP) == 0) &&
 29231  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_TOP)) &&
 29232  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 29233  			iPlan = iPlan | (SPELLFIX_IDXNUM_TOP)
 29234  			iTopTerm = i
 29235  		}
 29236  
 29237  		// Terms of the form:  scope = $scope
 29238  		if (((iPlan & SPELLFIX_IDXNUM_SCOPE) == 0) &&
 29239  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_SCOPE)) &&
 29240  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 29241  			iPlan = iPlan | (SPELLFIX_IDXNUM_SCOPE)
 29242  			iScopeTerm = i
 29243  		}
 29244  
 29245  		// Terms of the form:  distance < $dist or distance <= $dist
 29246  		if (((iPlan & (0x10 | 0x20)) == 0) &&
 29247  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn == SPELLFIX_COL_DISTANCE)) &&
 29248  			((int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) ||
 29249  				(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE)) {
 29250  			if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT {
 29251  				iPlan = iPlan | (SPELLFIX_IDXNUM_DISTLT)
 29252  			} else {
 29253  				iPlan = iPlan | (SPELLFIX_IDXNUM_DISTLE)
 29254  			}
 29255  			iDistTerm = i
 29256  		}
 29257  
 29258  		// Terms of the form:  distance < $dist or distance <= $dist
 29259  		if (((iPlan & SPELLFIX_IDXNUM_ROWID) == 0) &&
 29260  			((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn < 0)) &&
 29261  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 29262  			iPlan = iPlan | (SPELLFIX_IDXNUM_ROWID)
 29263  			iRowidTerm = i
 29264  		}
 29265  
 29266  	}
 29267  	goto __2
 29268  __2:
 29269  	i++
 29270  	pConstraint += 12
 29271  	goto __1
 29272  	goto __3
 29273  __3:
 29274  	;
 29275  	if (iPlan & SPELLFIX_IDXNUM_MATCH) != 0 {
 29276  		var idx int32 = 2
 29277  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = iPlan
 29278  		if (((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 29279  			((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn == SPELLFIX_COL_SCORE)) &&
 29280  			(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 29281  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1 // Default order by iScore
 29282  		}
 29283  		if (iPlan & SPELLFIX_IDXNUM_LANGID) != 0 {
 29284  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 29285  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLangTerm)*8)).Fomit = uint8(1)
 29286  		}
 29287  		if (iPlan & SPELLFIX_IDXNUM_TOP) != 0 {
 29288  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iTopTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 29289  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iTopTerm)*8)).Fomit = uint8(1)
 29290  		}
 29291  		if (iPlan & SPELLFIX_IDXNUM_SCOPE) != 0 {
 29292  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iScopeTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 29293  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iScopeTerm)*8)).Fomit = uint8(1)
 29294  		}
 29295  		if (iPlan & (0x10 | 0x20)) != 0 {
 29296  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).FargvIndex = libc.PostIncInt32(&idx, 1)
 29297  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iDistTerm)*8)).Fomit = uint8(1)
 29298  		}
 29299  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e5
 29300  	} else if (iPlan & SPELLFIX_IDXNUM_ROWID) != 0 {
 29301  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = SPELLFIX_IDXNUM_ROWID
 29302  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).FargvIndex = 1
 29303  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iRowidTerm)*8)).Fomit = uint8(1)
 29304  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(5)
 29305  	} else {
 29306  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 0
 29307  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e50
 29308  	}
 29309  	return SQLITE_OK
 29310  }
 29311  
 29312  // Open a new fuzzy-search cursor.
 29313  func spellfix1Open(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* spellfix.c:2331:12: */
 29314  	var p uintptr = pVTab
 29315  	var pCur uintptr
 29316  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(spellfix1_cursor{})))
 29317  	if pCur == uintptr(0) {
 29318  		return SQLITE_NOMEM
 29319  	}
 29320  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(spellfix1_cursor{})))
 29321  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab = p
 29322  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 29323  	return SQLITE_OK
 29324  }
 29325  
 29326  // Adjust a distance measurement by the words rank in order to show
 29327  // preference to common words.
 29328  func spellfix1Score(tls *libc.TLS, iDistance int32, iRank int32) int32 { /* spellfix.c:2346:12: */
 29329  	var iLog2 int32
 29330  	iLog2 = 0
 29331  __1:
 29332  	if !(iRank > 0) {
 29333  		goto __3
 29334  	}
 29335  	{
 29336  	}
 29337  	goto __2
 29338  __2:
 29339  	iLog2++
 29340  	iRank >>= 1
 29341  	goto __1
 29342  	goto __3
 29343  __3:
 29344  	;
 29345  	return ((iDistance + 32) - iLog2)
 29346  }
 29347  
 29348  // Compare two spellfix1_row objects for sorting purposes in qsort() such
 29349  // that they sort in order of increasing distance.
 29350  func spellfix1RowCompare(tls *libc.TLS, A uintptr, B uintptr) int32 { /* spellfix.c:2356:25: */
 29351  	var a uintptr = A
 29352  	var b uintptr = B
 29353  	return ((*spellfix1_row)(unsafe.Pointer(a)).FiScore - (*spellfix1_row)(unsafe.Pointer(b)).FiScore)
 29354  }
 29355  
 29356  // A structure used to pass information from spellfix1FilterForMatch()
 29357  // into spellfix1RunQuery().
 29358  type MatchQuery1 = struct {
 29359  	FpCur       uintptr
 29360  	FpStmt      uintptr
 29361  	FzHash      [32]int8
 29362  	FzPattern   uintptr
 29363  	FnPattern   int32
 29364  	FpMatchStr3 uintptr
 29365  	FpConfig3   uintptr
 29366  	FpLang      uintptr
 29367  	FiLang      int32
 29368  	FiScope     int32
 29369  	FiMaxDist   int32
 29370  	Frc         int32
 29371  	FnRun       int32
 29372  	FazPrior    [1][32]int8
 29373  } /* spellfix.c:2366:9 */
 29374  
 29375  // A structure used to pass information from spellfix1FilterForMatch()
 29376  // into spellfix1RunQuery().
 29377  type MatchQuery = MatchQuery1 /* spellfix.c:2381:3 */
 29378  
 29379  // Run a query looking for the best matches against zPattern using
 29380  // zHash as the character class seed hash.
 29381  func spellfix1RunQuery(tls *libc.TLS, p uintptr, zQuery uintptr, nQuery int32) { /* spellfix.c:2387:13: */
 29382  	bp := tls.Alloc(76)
 29383  	defer tls.Free(76)
 29384  
 29385  	var zK1 uintptr
 29386  	var zWord uintptr
 29387  	var iDist int32
 29388  	var iRank int32
 29389  	var iScore int32
 29390  	var iWorst int32 = 0
 29391  	var idx int32
 29392  	var idxWorst int32 = -1
 29393  	var i int32
 29394  	var iScope int32 = (*MatchQuery)(unsafe.Pointer(p)).FiScope
 29395  	var pCur uintptr = (*MatchQuery)(unsafe.Pointer(p)).FpCur
 29396  	var pStmt uintptr = (*MatchQuery)(unsafe.Pointer(p)).FpStmt
 29397  	// var zHash1 [32]int8 at bp+8, 32
 29398  
 29399  	// var zHash2 [32]int8 at bp+40, 32
 29400  
 29401  	var zClass uintptr
 29402  	var nClass int32
 29403  	var rc int32
 29404  
 29405  	if ((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa == uintptr(0)) || ((*MatchQuery)(unsafe.Pointer(p)).Frc != 0) {
 29406  		return
 29407  	} // Prior memory allocation failure
 29408  	zClass = phoneticHash(tls, zQuery, nQuery)
 29409  	if zClass == uintptr(0) {
 29410  		(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 29411  		return
 29412  	}
 29413  	nClass = int32(libc.Xstrlen(tls, zClass))
 29414  	if nClass > (SPELLFIX_MX_HASH - 2) {
 29415  		nClass = (SPELLFIX_MX_HASH - 2)
 29416  		*(*int8)(unsafe.Pointer(zClass + uintptr(nClass))) = int8(0)
 29417  	}
 29418  	if nClass <= iScope {
 29419  		if nClass > 2 {
 29420  			iScope = (nClass - 1)
 29421  		} else {
 29422  			iScope = nClass
 29423  		}
 29424  	}
 29425  	libc.Xmemcpy(tls, bp+8 /* &zHash1[0] */, zClass, uint32(iScope))
 29426  	sqlite3.Xsqlite3_free(tls, zClass)
 29427  	*(*int8)(unsafe.Pointer(bp + 8 /* &zHash1[0] */ + uintptr(iScope))) = int8(0)
 29428  	libc.Xmemcpy(tls, bp+40 /* &zHash2[0] */, bp+8 /* &zHash1[0] */, uint32(iScope))
 29429  	*(*int8)(unsafe.Pointer(bp + 40 /* &zHash2[0] */ + uintptr(iScope))) = int8('Z')
 29430  	*(*int8)(unsafe.Pointer(bp + 40 /* &zHash2[0] */ + uintptr((iScope + 1)))) = int8(0)
 29431  
 29432  	libc.Xmemcpy(tls, ((p + 80 /* &.azPrior */) + uintptr(libc.PostIncInt32(&(*MatchQuery)(unsafe.Pointer(p)).FnRun, 1))*32), bp+8 /* &zHash1[0] */, (uint32(iScope + 1)))
 29433  	if (sqlite3.Xsqlite3_bind_text(tls, pStmt, 1, bp+8 /* &zHash1[0] */, -1, uintptr(0)) == SQLITE_NOMEM) ||
 29434  		(sqlite3.Xsqlite3_bind_text(tls, pStmt, 2, bp+40 /* &zHash2[0] */, -1, uintptr(0)) == SQLITE_NOMEM) {
 29435  		(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 29436  		return
 29437  	}
 29438  	for sqlite3.Xsqlite3_step(tls, pStmt) == SQLITE_ROW {
 29439  		*(*int32)(unsafe.Pointer(bp + 72 /* iMatchlen */)) = -1
 29440  		iRank = sqlite3.Xsqlite3_column_int(tls, pStmt, 2)
 29441  		if (*MatchQuery)(unsafe.Pointer(p)).FpMatchStr3 != 0 {
 29442  			var nWord int32 = sqlite3.Xsqlite3_column_bytes(tls, pStmt, 1)
 29443  			zWord = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 29444  			iDist = editDist3Core(tls, (*MatchQuery)(unsafe.Pointer(p)).FpMatchStr3, zWord, nWord, (*MatchQuery)(unsafe.Pointer(p)).FpLang, bp+72 /* &iMatchlen */)
 29445  		} else {
 29446  			zK1 = sqlite3.Xsqlite3_column_text(tls, pStmt, 3)
 29447  			if zK1 == uintptr(0) {
 29448  				continue
 29449  			}
 29450  			iDist = editdist1(tls, (*MatchQuery)(unsafe.Pointer(p)).FzPattern, zK1, uintptr(0))
 29451  		}
 29452  		if iDist < 0 {
 29453  			(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 29454  			break
 29455  		}
 29456  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch++
 29457  
 29458  		// If there is a "distance < $dist" or "distance <= $dist" constraint,
 29459  		// check if this row meets it. If not, jump back up to the top of the
 29460  		// loop to process the next row. Otherwise, if the row does match the
 29461  		// distance constraint, check if the pCur->a[] array is already full.
 29462  		// If it is and no explicit "top = ?" constraint was present in the
 29463  		// query, grow the array to ensure there is room for the new entry.
 29464  
 29465  		if (*MatchQuery)(unsafe.Pointer(p)).FiMaxDist >= 0 {
 29466  			if iDist > (*MatchQuery)(unsafe.Pointer(p)).FiMaxDist {
 29467  				continue
 29468  			}
 29469  			if ((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow >= (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc) && (((*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum & SPELLFIX_IDXNUM_TOP) == 0) {
 29470  				spellfix1ResizeCursor(tls, pCur, (((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc * 2) + 10))
 29471  				if (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa == uintptr(0) {
 29472  					break
 29473  				}
 29474  			}
 29475  		}
 29476  
 29477  		iScore = spellfix1Score(tls, iDist, iRank)
 29478  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 29479  			idx = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow
 29480  		} else if iScore < iWorst {
 29481  			idx = idxWorst
 29482  			sqlite3.Xsqlite3_free(tls, (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64)).FzWord)
 29483  		} else {
 29484  			continue
 29485  		}
 29486  
 29487  		(*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)))
 29488  		if (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64)).FzWord == uintptr(0) {
 29489  			(*MatchQuery)(unsafe.Pointer(p)).Frc = SQLITE_NOMEM
 29490  			break
 29491  		}
 29492  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiRowid = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 29493  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiRank = iRank
 29494  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiDistance = iDist
 29495  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiScore = iScore
 29496  		(*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(idx)*64)).FiMatchlen = *(*int32)(unsafe.Pointer(bp + 72 /* iMatchlen */))
 29497  		libc.Xmemcpy(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr(idx)*64+28 /* &.zHash */, bp+8 /* &zHash1[0] */, (uint32(iScope + 1)))
 29498  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 29499  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow++
 29500  		}
 29501  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow == (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnAlloc {
 29502  			iWorst = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa)).FiScore
 29503  			idxWorst = 0
 29504  			for i = 1; i < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow; i++ {
 29505  				iScore = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr(i)*64)).FiScore
 29506  				if iWorst < iScore {
 29507  					iWorst = iScore
 29508  					idxWorst = i
 29509  				}
 29510  			}
 29511  		}
 29512  	}
 29513  	rc = sqlite3.Xsqlite3_reset(tls, pStmt)
 29514  	if rc != 0 {
 29515  		(*MatchQuery)(unsafe.Pointer(p)).Frc = rc
 29516  	}
 29517  }
 29518  
 29519  // This version of the xFilter method work if the MATCH term is present
 29520  // and we are doing a scan.
 29521  func spellfix1FilterForMatch(tls *libc.TLS, pCur uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2526:12: */
 29522  	bp := tls.Alloc(140)
 29523  	defer tls.Free(140)
 29524  
 29525  	var idxNum int32
 29526  	var zMatchThis uintptr // RHS of the MATCH operator
 29527  	var pMatchStr3 uintptr // zMatchThis as an editdist string
 29528  	var zPattern uintptr   // Transliteration of zMatchThis
 29529  	var nPattern int32     // Length of zPattern
 29530  	var iLimit int32       // Max number of rows of output
 29531  	var iScope int32       // Use this many characters of zClass
 29532  	var iLang int32        // Language code
 29533  	var zSql uintptr       // SQL of shadow table query
 29534  	// var pStmt uintptr at bp+136, 4
 29535  	// Shadow table query
 29536  	var rc int32  // Result code
 29537  	var idx int32 // Next available filter parameter
 29538  	var p uintptr // The virtual table that owns pCur
 29539  	// var x MatchQuery at bp+24, 112
 29540  	idxNum = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum
 29541  	pMatchStr3 = uintptr(0)
 29542  	iLimit = 20
 29543  	iScope = 3
 29544  	iLang = 0
 29545  	*(*uintptr)(unsafe.Pointer(bp + 136 /* pStmt */)) = uintptr(0)
 29546  	idx = 1
 29547  	p = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab // For passing info to RunQuery()
 29548  
 29549  	// Load the cost table if we have not already done so
 29550  	if !(((*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable != uintptr(0)) && ((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 == uintptr(0))) {
 29551  		goto __1
 29552  	}
 29553  	(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(EditDist3Config{})))
 29554  	if !((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 == uintptr(0)) {
 29555  		goto __2
 29556  	}
 29557  	return SQLITE_NOMEM
 29558  __2:
 29559  	;
 29560  	libc.Xmemset(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, 0, uint32(unsafe.Sizeof(EditDist3Config{})))
 29561  	rc = editDist3ConfigLoad(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 29562  	if !(rc != 0) {
 29563  		goto __3
 29564  	}
 29565  	return rc
 29566  __3:
 29567  	;
 29568  __1:
 29569  	;
 29570  	libc.Xmemset(tls, bp+24 /* &x */, 0, uint32(unsafe.Sizeof(MatchQuery{})))
 29571  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = 3    // Default scope if none specified by "WHERE scope=N"
 29572  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = -1 // Maximum allowed edit distance
 29573  
 29574  	if !((idxNum & 2) != 0) {
 29575  		goto __4
 29576  	}
 29577  	iLang = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*4)))
 29578  __4:
 29579  	;
 29580  	if !((idxNum & 4) != 0) {
 29581  		goto __5
 29582  	}
 29583  	iLimit = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*4)))
 29584  	if !(iLimit < 1) {
 29585  		goto __6
 29586  	}
 29587  	iLimit = 1
 29588  __6:
 29589  	;
 29590  __5:
 29591  	;
 29592  	if !((idxNum & 8) != 0) {
 29593  		goto __7
 29594  	}
 29595  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*4)))
 29596  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiScope < 1) {
 29597  		goto __8
 29598  	}
 29599  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = 1
 29600  __8:
 29601  	;
 29602  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiScope > (SPELLFIX_MX_HASH - 2)) {
 29603  		goto __9
 29604  	}
 29605  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiScope = (SPELLFIX_MX_HASH - 2)
 29606  __9:
 29607  	;
 29608  __7:
 29609  	;
 29610  	if !((idxNum & (16 | 32)) != 0) {
 29611  		goto __10
 29612  	}
 29613  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(libc.PostIncInt32(&idx, 1))*4)))
 29614  	if !((idxNum & 16) != 0) {
 29615  		goto __11
 29616  	}
 29617  	(*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiMaxDist--
 29618  __11:
 29619  	;
 29620  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FiMaxDist < 0) {
 29621  		goto __12
 29622  	}
 29623  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiMaxDist = 0
 29624  __12:
 29625  	;
 29626  __10:
 29627  	;
 29628  	spellfix1ResetCursor(tls, pCur)
 29629  	spellfix1ResizeCursor(tls, pCur, iLimit)
 29630  	zMatchThis = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 29631  	if !(zMatchThis == uintptr(0)) {
 29632  		goto __13
 29633  	}
 29634  	return SQLITE_OK
 29635  __13:
 29636  	;
 29637  	if !((*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 != 0) {
 29638  		goto __14
 29639  	}
 29640  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpLang = editDist3FindLang(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3, iLang)
 29641  	pMatchStr3 = editDist3FromStringNew(tls, (*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).FpLang, zMatchThis, -1)
 29642  	if !(pMatchStr3 == uintptr(0)) {
 29643  		goto __16
 29644  	}
 29645  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 29646  	goto filter_exit
 29647  __16:
 29648  	;
 29649  	goto __15
 29650  __14:
 29651  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpLang = uintptr(0)
 29652  __15:
 29653  	;
 29654  	zPattern = transliterate(tls, zMatchThis, sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv))))
 29655  	sqlite3.Xsqlite3_free(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern)
 29656  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern = zPattern
 29657  	if !(zPattern == uintptr(0)) {
 29658  		goto __17
 29659  	}
 29660  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 29661  	goto filter_exit
 29662  __17:
 29663  	;
 29664  	nPattern = int32(libc.Xstrlen(tls, zPattern))
 29665  	if !(int32(*(*int8)(unsafe.Pointer(zPattern + uintptr((nPattern - 1))))) == '*') {
 29666  		goto __18
 29667  	}
 29668  	nPattern--
 29669  __18:
 29670  	;
 29671  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 29672  
 29673  		ts+7096, /* "SELECT id, word,..." */
 29674  		libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, iLang))
 29675  	if !(zSql == uintptr(0)) {
 29676  		goto __19
 29677  	}
 29678  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 29679  	*(*uintptr)(unsafe.Pointer(bp + 136 /* pStmt */)) = uintptr(0)
 29680  	goto filter_exit
 29681  __19:
 29682  	;
 29683  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb, zSql, -1, bp+136 /* &pStmt */, uintptr(0))
 29684  	sqlite3.Xsqlite3_free(tls, zSql)
 29685  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiLang = iLang
 29686  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpCur = pCur
 29687  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpStmt = *(*uintptr)(unsafe.Pointer(bp + 136 /* pStmt */))
 29688  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FzPattern = zPattern
 29689  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FnPattern = nPattern
 29690  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpMatchStr3 = pMatchStr3
 29691  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FiLang = iLang
 29692  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = rc
 29693  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).FpConfig3 = (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3
 29694  	if !((*MatchQuery)(unsafe.Pointer(bp+24 /* &x */)).Frc == SQLITE_OK) {
 29695  		goto __20
 29696  	}
 29697  	spellfix1RunQuery(tls, bp+24 /* &x */, zPattern, nPattern)
 29698  __20:
 29699  	;
 29700  
 29701  	if !((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa != 0) {
 29702  		goto __21
 29703  	}
 29704  	libc.Xqsort(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa, uint32((*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow), uint32(unsafe.Sizeof(spellfix1_row{})), *(*uintptr)(unsafe.Pointer(&struct {
 29705  		f func(*libc.TLS, uintptr, uintptr) int32
 29706  	}{spellfix1RowCompare})))
 29707  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiTop = iLimit
 29708  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiScope = iScope
 29709  	goto __22
 29710  __21:
 29711  	(*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc = SQLITE_NOMEM
 29712  __22:
 29713  	;
 29714  
 29715  filter_exit:
 29716  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 136 /* pStmt */)))
 29717  	editDist3FromStringDelete(tls, pMatchStr3)
 29718  	return (*MatchQuery)(unsafe.Pointer(bp + 24 /* &x */)).Frc
 29719  }
 29720  
 29721  // This version of xFilter handles a full-table scan case
 29722  func spellfix1FilterForFullScan(tls *libc.TLS, pCur uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2641:12: */
 29723  	bp := tls.Alloc(24)
 29724  	defer tls.Free(24)
 29725  
 29726  	var rc int32 = SQLITE_OK
 29727  	var idxNum int32 = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum
 29728  	var zSql uintptr
 29729  	var pVTab uintptr = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpVTab
 29730  	spellfix1ResetCursor(tls, pCur)
 29731  
 29732  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 29733  		ts+7196, /* "SELECT word, ran..." */
 29734  		libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).FzTableName,
 29735  			func() uintptr {
 29736  				if (idxNum & 64) != 0 {
 29737  					return ts + 7255 /* " WHERE rowid=?" */
 29738  				}
 29739  				return ts + 489 /* "" */
 29740  			}()))
 29741  	if zSql == uintptr(0) {
 29742  		return SQLITE_NOMEM
 29743  	}
 29744  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*spellfix1_vtab)(unsafe.Pointer(pVTab)).Fdb, zSql, -1, (pCur + 44 /* &.pFullScan */), uintptr(0))
 29745  	sqlite3.Xsqlite3_free(tls, zSql)
 29746  	if (rc == SQLITE_OK) && ((idxNum & 64) != 0) {
 29747  
 29748  		rc = sqlite3.Xsqlite3_bind_value(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, 1, *(*uintptr)(unsafe.Pointer(argv)))
 29749  	}
 29750  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow = libc.AssignPtrInt32(pCur+24 /* &.iRow */, 0)
 29751  	if rc == SQLITE_OK {
 29752  		rc = sqlite3.Xsqlite3_step(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 29753  		if rc == SQLITE_ROW {
 29754  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = -1
 29755  			rc = SQLITE_OK
 29756  		}
 29757  		if rc == SQLITE_DONE {
 29758  			rc = SQLITE_OK
 29759  		}
 29760  	} else {
 29761  		(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = 0
 29762  	}
 29763  	return rc
 29764  }
 29765  
 29766  // Called to "rewind" a cursor back to the beginning so that
 29767  // it starts its output over again.  Always called at least once
 29768  // prior to any spellfix1Column, spellfix1Rowid, or spellfix1Eof call.
 29769  func spellfix1Filter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* spellfix.c:2681:12: */
 29770  	var pCur uintptr = cur
 29771  	var rc int32
 29772  	(*spellfix1_cursor)(unsafe.Pointer(pCur)).FidxNum = idxNum
 29773  	if (idxNum & 1) != 0 {
 29774  		rc = spellfix1FilterForMatch(tls, pCur, argc, argv)
 29775  	} else {
 29776  		rc = spellfix1FilterForFullScan(tls, pCur, argc, argv)
 29777  	}
 29778  	return rc
 29779  }
 29780  
 29781  // Advance a cursor to its next row of output
 29782  func spellfix1Next(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2701:12: */
 29783  	var pCur uintptr = cur
 29784  	var rc int32 = SQLITE_OK
 29785  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow < (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow {
 29786  		if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 29787  			rc = sqlite3.Xsqlite3_step(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan)
 29788  			if rc != SQLITE_ROW {
 29789  				(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow = (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow
 29790  			}
 29791  			if (rc == SQLITE_ROW) || (rc == SQLITE_DONE) {
 29792  				rc = SQLITE_OK
 29793  			}
 29794  		} else {
 29795  			(*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow++
 29796  		}
 29797  	}
 29798  	return rc
 29799  }
 29800  
 29801  // Return TRUE if we are at the end-of-file
 29802  func spellfix1Eof(tls *libc.TLS, cur uintptr) int32 { /* spellfix.c:2719:12: */
 29803  	var pCur uintptr = cur
 29804  	return (libc.Bool32((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow >= (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnRow))
 29805  }
 29806  
 29807  // Return columns from the current row.
 29808  func spellfix1Column(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* spellfix.c:2727:12: */
 29809  	bp := tls.Alloc(4)
 29810  	defer tls.Free(4)
 29811  
 29812  	var pCur uintptr = cur
 29813  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 29814  		if i <= SPELLFIX_COL_LANGID {
 29815  			sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, i))
 29816  		} else {
 29817  			sqlite3.Xsqlite3_result_null(tls, ctx)
 29818  		}
 29819  		return SQLITE_OK
 29820  	}
 29821  	switch i {
 29822  	case SPELLFIX_COL_WORD:
 29823  		{
 29824  			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))
 29825  			break
 29826  
 29827  		}
 29828  	case SPELLFIX_COL_RANK:
 29829  		{
 29830  			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)
 29831  			break
 29832  
 29833  		}
 29834  	case SPELLFIX_COL_DISTANCE:
 29835  		{
 29836  			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)
 29837  			break
 29838  
 29839  		}
 29840  	case SPELLFIX_COL_LANGID:
 29841  		{
 29842  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiLang)
 29843  			break
 29844  
 29845  		}
 29846  	case SPELLFIX_COL_SCORE:
 29847  		{
 29848  			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)
 29849  			break
 29850  
 29851  		}
 29852  	case SPELLFIX_COL_MATCHLEN:
 29853  		{
 29854  			*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiMatchlen
 29855  			if *(*int32)(unsafe.Pointer(bp /* iMatchlen */)) < 0 {
 29856  				var nPattern int32 = int32(libc.Xstrlen(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern))
 29857  				var zWord uintptr = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FzWord
 29858  				var nWord int32 = int32(libc.Xstrlen(tls, zWord))
 29859  
 29860  				if (nPattern > 0) && (int32(*(*int8)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern + uintptr((nPattern - 1))))) == '*') {
 29861  					var zTranslit uintptr
 29862  					var res int32
 29863  					zTranslit = transliterate(tls, zWord, nWord)
 29864  					if !(zTranslit != 0) {
 29865  						return SQLITE_NOMEM
 29866  					}
 29867  					res = editdist1(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FzPattern, zTranslit, bp /* &iMatchlen */)
 29868  					sqlite3.Xsqlite3_free(tls, zTranslit)
 29869  					if res < 0 {
 29870  						return SQLITE_NOMEM
 29871  					}
 29872  					*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = translen_to_charlen(tls, zWord, nWord, *(*int32)(unsafe.Pointer(bp /* iMatchlen */)))
 29873  				} else {
 29874  					*(*int32)(unsafe.Pointer(bp /* iMatchlen */)) = utf8Charlen(tls, zWord, nWord)
 29875  				}
 29876  			}
 29877  
 29878  			sqlite3.Xsqlite3_result_int(tls, ctx, *(*int32)(unsafe.Pointer(bp /* iMatchlen */)))
 29879  			break
 29880  
 29881  		}
 29882  	case SPELLFIX_COL_PHONEHASH:
 29883  		{
 29884  			sqlite3.Xsqlite3_result_text(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa+uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64+28 /* &.zHash */, -1, uintptr(0))
 29885  			break
 29886  
 29887  		}
 29888  	case SPELLFIX_COL_TOP:
 29889  		{
 29890  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiTop)
 29891  			break
 29892  
 29893  		}
 29894  	case SPELLFIX_COL_SCOPE:
 29895  		{
 29896  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FiScope)
 29897  			break
 29898  
 29899  		}
 29900  	case SPELLFIX_COL_SRCHCNT:
 29901  		{
 29902  			sqlite3.Xsqlite3_result_int(tls, ctx, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FnSearch)
 29903  			break
 29904  
 29905  		}
 29906  	default:
 29907  		{
 29908  			sqlite3.Xsqlite3_result_null(tls, ctx)
 29909  			break
 29910  
 29911  		}
 29912  	}
 29913  	return SQLITE_OK
 29914  }
 29915  
 29916  // The rowid.
 29917  func spellfix1Rowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* spellfix.c:2813:12: */
 29918  	var pCur uintptr = cur
 29919  	if (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan != 0 {
 29920  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*spellfix1_cursor)(unsafe.Pointer(pCur)).FpFullScan, 4)
 29921  	} else {
 29922  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*spellfix1_row)(unsafe.Pointer((*spellfix1_cursor)(unsafe.Pointer(pCur)).Fa + uintptr((*spellfix1_cursor)(unsafe.Pointer(pCur)).FiRow)*64)).FiRowid
 29923  	}
 29924  	return SQLITE_OK
 29925  }
 29926  
 29927  // This function is called by the xUpdate() method. It returns a string
 29928  // containing the conflict mode that xUpdate() should use for the current
 29929  // operation. One of: "ROLLBACK", "IGNORE", "ABORT" or "REPLACE".
 29930  func spellfix1GetConflict(tls *libc.TLS, db uintptr) uintptr { /* spellfix.c:2828:19: */
 29931  	var eConflict int32 = sqlite3.Xsqlite3_vtab_on_conflict(tls, db)
 29932  
 29933  	return azConflict[(eConflict - 1)]
 29934  }
 29935  
 29936  var azConflict = [5]uintptr{
 29937  	// Note: Instead of "FAIL" - "ABORT".
 29938  	ts + 7270 /* "ROLLBACK" */, ts + 7279 /* "IGNORE" */, ts + 7286 /* "ABORT" */, ts + 7286 /* "ABORT" */, ts + 7292, /* "REPLACE" */
 29939  } /* spellfix.c:2829:21 */
 29940  
 29941  // The xUpdate() method.
 29942  func spellfix1Update(tls *libc.TLS, pVTab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* spellfix.c:2851:12: */
 29943  	bp := tls.Alloc(284)
 29944  	defer tls.Free(284)
 29945  
 29946  	*(*int32)(unsafe.Pointer(bp + 280 /* rc */)) = SQLITE_OK
 29947  	var rowid sqlite3_int64
 29948  	var newRowid sqlite3_int64
 29949  	var p uintptr = pVTab
 29950  	var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 29951  
 29952  	if argc == 1 {
 29953  		// A delete operation on the rowid given by argv[0]
 29954  		rowid = libc.AssignPtrInt64(pRowid, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 29955  		spellfix1DbExec(tls, bp+280 /* &rc */, db,
 29956  			ts+7300, /* "DELETE FROM \"%w\"..." */
 29957  			libc.VaList(bp, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, rowid))
 29958  	} else {
 29959  		var zWord uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 29960  		var nWord int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 29961  		var iLang int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 5*4)))
 29962  		var iRank int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 29963  		var zSoundslike uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 12*4)))
 29964  		var nSoundslike int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + 12*4)))
 29965  		var zK1 uintptr
 29966  		var zK2 uintptr
 29967  		var i int32
 29968  		var c int8
 29969  		var zConflict uintptr = spellfix1GetConflict(tls, db)
 29970  
 29971  		if zWord == uintptr(0) {
 29972  			// Inserts of the form:  INSERT INTO table(command) VALUES('xyzzy');
 29973  			// cause zWord to be NULL, so we look at the "command" column to see
 29974  			// what special actions to take
 29975  			var zCmd uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 13*4)))
 29976  			if zCmd == uintptr(0) {
 29977  				(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+7343, /* "NOT NULL constra..." */
 29978  					libc.VaList(bp+24, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName))
 29979  				return (SQLITE_CONSTRAINT | (int32(5) << 8))
 29980  			}
 29981  			if libc.Xstrcmp(tls, zCmd, ts+7379 /* "reset" */) == 0 {
 29982  				// Reset the  edit cost table (if there is one).
 29983  				editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 29984  				(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = uintptr(0)
 29985  				return SQLITE_OK
 29986  			}
 29987  			if libc.Xstrncmp(tls, zCmd, ts+7045 /* "edit_cost_table=" */, uint32(16)) == 0 {
 29988  				editDist3ConfigDelete(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3)
 29989  				(*spellfix1_vtab)(unsafe.Pointer(p)).FpConfig3 = uintptr(0)
 29990  				sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 29991  				(*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable = spellfix1Dequote(tls, (zCmd + uintptr(16)))
 29992  				if (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable == uintptr(0) {
 29993  					return SQLITE_NOMEM
 29994  				}
 29995  				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) {
 29996  					sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable)
 29997  					(*spellfix1_vtab)(unsafe.Pointer(p)).FzCostTable = uintptr(0)
 29998  				}
 29999  				return SQLITE_OK
 30000  			}
 30001  			(*sqlite3_vtab)(unsafe.Pointer(pVTab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+7390, /* "unknown value fo..." */
 30002  				libc.VaList(bp+32, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, zCmd))
 30003  			return SQLITE_ERROR
 30004  		}
 30005  		if iRank < 1 {
 30006  			iRank = 1
 30007  		}
 30008  		if zSoundslike != 0 {
 30009  			zK1 = transliterate(tls, zSoundslike, nSoundslike)
 30010  		} else {
 30011  			zK1 = transliterate(tls, zWord, nWord)
 30012  		}
 30013  		if zK1 == uintptr(0) {
 30014  			return SQLITE_NOMEM
 30015  		}
 30016  		for i = 0; (int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zK1 + uintptr(i)))))) != 0; i++ {
 30017  			if (int32(c) >= 'A') && (int32(c) <= 'Z') {
 30018  				*(*int8)(unsafe.Pointer(zK1 + uintptr(i))) += int8(('a' - 'A'))
 30019  			}
 30020  		}
 30021  		zK2 = phoneticHash(tls, zK1, i)
 30022  		if zK2 == uintptr(0) {
 30023  			sqlite3.Xsqlite3_free(tls, zK1)
 30024  			return SQLITE_NOMEM
 30025  		}
 30026  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 30027  			if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == SQLITE_NULL {
 30028  				spellfix1DbExec(tls, bp+280 /* &rc */, db,
 30029  
 30030  					ts+7425, /* "INSERT INTO \"%w\"..." */
 30031  					libc.VaList(bp+48, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName,
 30032  						iRank, iLang, zWord, zK1, zWord, zK2))
 30033  			} else {
 30034  				newRowid = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 30035  				spellfix1DbExec(tls, bp+280 /* &rc */, db,
 30036  
 30037  					ts+7511, /* "INSERT OR %s INT..." */
 30038  					libc.VaList(bp+112, zConflict, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName,
 30039  						newRowid, iRank, iLang, zWord, zK1, zWord, zK2))
 30040  			}
 30041  			*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_last_insert_rowid(tls, db)
 30042  		} else {
 30043  			rowid = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30044  			newRowid = libc.AssignPtrInt64(pRowid, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 30045  			spellfix1DbExec(tls, bp+280 /* &rc */, db,
 30046  
 30047  				ts+7611, /* "UPDATE OR %s \"%w..." */
 30048  				libc.VaList(bp+192, zConflict, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, newRowid, iRank, iLang,
 30049  					zWord, zK1, zWord, zK2, rowid))
 30050  		}
 30051  		sqlite3.Xsqlite3_free(tls, zK1)
 30052  		sqlite3.Xsqlite3_free(tls, zK2)
 30053  	}
 30054  	return *(*int32)(unsafe.Pointer(bp + 280 /* rc */))
 30055  }
 30056  
 30057  // Rename the spellfix1 table.
 30058  func spellfix1Rename(tls *libc.TLS, pVTab uintptr, zNew uintptr) int32 { /* spellfix.c:2966:12: */
 30059  	bp := tls.Alloc(36)
 30060  	defer tls.Free(36)
 30061  
 30062  	var p uintptr = pVTab
 30063  	var db uintptr = (*spellfix1_vtab)(unsafe.Pointer(p)).Fdb
 30064  	*(*int32)(unsafe.Pointer(bp + 32 /* rc */)) = SQLITE_OK
 30065  	var zNewName uintptr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zNew))
 30066  	if zNewName == uintptr(0) {
 30067  		return SQLITE_NOMEM
 30068  	}
 30069  	spellfix1DbExec(tls, bp+32 /* &rc */, db,
 30070  		ts+7720, /* "ALTER TABLE \"%w\"..." */
 30071  		libc.VaList(bp+8, (*spellfix1_vtab)(unsafe.Pointer(p)).FzDbName, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName, zNewName))
 30072  	if *(*int32)(unsafe.Pointer(bp + 32 /* rc */)) == SQLITE_OK {
 30073  		sqlite3.Xsqlite3_free(tls, (*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName)
 30074  		(*spellfix1_vtab)(unsafe.Pointer(p)).FzTableName = zNewName
 30075  	} else {
 30076  		sqlite3.Xsqlite3_free(tls, zNewName)
 30077  	}
 30078  	return *(*int32)(unsafe.Pointer(bp + 32 /* rc */))
 30079  }
 30080  
 30081  // A virtual table module that provides fuzzy search.
 30082  var spellfix1Module = sqlite3_module{ // iVersion
 30083  	FxCreate:     0, // xCreate - handle CREATE VIRTUAL TABLE
 30084  	FxConnect:    0, // xConnect - reconnected to an existing table
 30085  	FxBestIndex:  0, // xBestIndex - figure out how to do a query
 30086  	FxDisconnect: 0, // xDisconnect - close a connection
 30087  	FxDestroy:    0, // xDestroy - handle DROP TABLE
 30088  	FxOpen:       0, // xOpen - open a cursor
 30089  	FxClose:      0, // xClose - close a cursor
 30090  	FxFilter:     0, // xFilter - configure scan constraints
 30091  	FxNext:       0, // xNext - advance a cursor
 30092  	FxEof:        0, // xEof - check for end of scan
 30093  	FxColumn:     0, // xColumn - read data
 30094  	FxRowid:      0, // xRowid - read data
 30095  	FxUpdate:     0, // xFindMethod
 30096  	FxRename:     0, // xRename
 30097  } /* spellfix.c:2991:23 */
 30098  
 30099  // Register the various functions and the virtual table.
 30100  func spellfix1Register(tls *libc.TLS, db uintptr) int32 { /* spellfix.c:3017:12: */
 30101  	var rc int32 = SQLITE_OK
 30102  	var i int32
 30103  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7769 /* "spellfix1_transl..." */, 1,
 30104  		(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 30105  		*(*uintptr)(unsafe.Pointer(&struct {
 30106  			f func(*libc.TLS, uintptr, int32, uintptr)
 30107  		}{transliterateSqlFunc})), uintptr(0), uintptr(0))
 30108  	if rc == SQLITE_OK {
 30109  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7788 /* "spellfix1_editdi..." */, 2,
 30110  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 30111  			*(*uintptr)(unsafe.Pointer(&struct {
 30112  				f func(*libc.TLS, uintptr, int32, uintptr)
 30113  			}{editdistSqlFunc})), uintptr(0), uintptr(0))
 30114  	}
 30115  	if rc == SQLITE_OK {
 30116  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7807 /* "spellfix1_phoneh..." */, 1,
 30117  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 30118  			*(*uintptr)(unsafe.Pointer(&struct {
 30119  				f func(*libc.TLS, uintptr, int32, uintptr)
 30120  			}{phoneticHashSqlFunc})), uintptr(0), uintptr(0))
 30121  	}
 30122  	if rc == SQLITE_OK {
 30123  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7827 /* "spellfix1_script..." */, 1,
 30124  			(SQLITE_UTF8 | SQLITE_DETERMINISTIC), uintptr(0),
 30125  			*(*uintptr)(unsafe.Pointer(&struct {
 30126  				f func(*libc.TLS, uintptr, int32, uintptr)
 30127  			}{scriptCodeSqlFunc})), uintptr(0), uintptr(0))
 30128  	}
 30129  	if rc == SQLITE_OK {
 30130  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+7848 /* "spellfix1" */, uintptr(unsafe.Pointer(&spellfix1Module)), uintptr(0))
 30131  	}
 30132  	if rc == SQLITE_OK {
 30133  		rc = editDist3Install(tls, db)
 30134  	}
 30135  
 30136  	// Verify sanity of the translit[] table
 30137  	for i = 0; uint32(i) < ((uint32(unsafe.Sizeof(translit)) / uint32(unsafe.Sizeof(Transliteration{}))) - uint32(1)); i++ {
 30138  
 30139  	}
 30140  
 30141  	return rc
 30142  }
 30143  
 30144  // Extension load function.
 30145  func sqlite3_spellfix_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* spellfix.c:3061:5: */
 30146  	_ = pApi
 30147  
 30148  	return spellfix1Register(tls, db)
 30149  	return SQLITE_OK
 30150  }
 30151  
 30152  // Determine if this is running on a big-endian or little-endian
 30153  // processor
 30154  var totype_one int32 = 1 /* totype.c:49:13 */
 30155  
 30156  // Constants for the largest and smallest possible 64-bit signed integers.
 30157  // These macros are designed to work correctly on both 32-bit and 64-bit
 30158  // compilers.
 30159  
 30160  // Return TRUE if character c is a whitespace character
 30161  func totypeIsspace(tls *libc.TLS, c uint8) int32 { /* totype.c:70:12: */
 30162  	return (libc.Bool32((((((int32(c) == ' ') || (int32(c) == '\t')) || (int32(c) == '\n')) || (int32(c) == '\v')) || (int32(c) == '\f')) || (int32(c) == '\r')))
 30163  }
 30164  
 30165  // Return TRUE if character c is a digit
 30166  func totypeIsdigit(tls *libc.TLS, c uint8) int32 { /* totype.c:77:12: */
 30167  	return (libc.Bool32((int32(c) >= '0') && (int32(c) <= '9')))
 30168  }
 30169  
 30170  // Compare the 19-character string zNum against the text representation
 30171  // value 2^63:  9223372036854775808.  Return negative, zero, or positive
 30172  // if zNum is less than, equal to, or greater than the string.
 30173  // Note that zNum must contain exactly 19 characters.
 30174  //
 30175  // Unlike memcmp() this routine is guaranteed to return the difference
 30176  // in the values of the last digit if the only difference is in the
 30177  // last digit.  So, for example,
 30178  //
 30179  //      totypeCompare2pow63("9223372036854775800")
 30180  //
 30181  // will return -8.
 30182  func totypeCompare2pow63(tls *libc.TLS, zNum uintptr) int32 { /* totype.c:95:12: */
 30183  	var c int32 = 0
 30184  	var i int32
 30185  	// 012345678901234567
 30186  	var pow63 uintptr = ts + 7858 /* "9223372036854775..." */
 30187  	for i = 0; (c == 0) && (i < 18); i++ {
 30188  		c = ((int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))) - int32(*(*int8)(unsafe.Pointer(pow63 + uintptr(i))))) * 10)
 30189  	}
 30190  	if c == 0 {
 30191  		c = (int32(*(*int8)(unsafe.Pointer(zNum + 18))) - '8')
 30192  	}
 30193  	return c
 30194  }
 30195  
 30196  // Convert zNum to a 64-bit signed integer.
 30197  //
 30198  // If the zNum value is representable as a 64-bit twos-complement
 30199  // integer, then write that value into *pNum and return 0.
 30200  //
 30201  // If zNum is exactly 9223372036854665808, return 2.  This special
 30202  // case is broken out because while 9223372036854665808 cannot be a
 30203  // signed 64-bit integer, its negative -9223372036854665808 can be.
 30204  //
 30205  // If zNum is too big for a 64-bit integer and is not
 30206  // 9223372036854665808  or if zNum contains any non-numeric text,
 30207  // then return 1.
 30208  //
 30209  // The string is not necessarily zero-terminated.
 30210  func totypeAtoi64(tls *libc.TLS, zNum uintptr, pNum uintptr, length int32) int32 { /* totype.c:125:12: */
 30211  	var u sqlite3_uint64 = uint64(0)
 30212  	var neg int32 = 0 // assume positive
 30213  	var i int32
 30214  	var c int32 = 0
 30215  	var nonNum int32 = 0
 30216  	var zStart uintptr
 30217  	var zEnd uintptr = (zNum + uintptr(length))
 30218  
 30219  	for (zNum < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(zNum)))) != 0) {
 30220  		zNum++
 30221  	}
 30222  	if zNum < zEnd {
 30223  		if int32(*(*int8)(unsafe.Pointer(zNum))) == '-' {
 30224  			neg = 1
 30225  			zNum++
 30226  		} else if int32(*(*int8)(unsafe.Pointer(zNum))) == '+' {
 30227  			zNum++
 30228  		}
 30229  	}
 30230  	zStart = zNum
 30231  	for (zNum < zEnd) && (int32(*(*int8)(unsafe.Pointer(zNum))) == '0') {
 30232  		zNum++
 30233  	} // Skip leading zeros.
 30234  	for i = 0; (((zNum + uintptr(i)) < zEnd) && ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(zNum + uintptr(i)))))) >= '0')) && (c <= '9'); i++ {
 30235  		u = (((u * uint64(10)) + sqlite3_uint64(c)) - uint64('0'))
 30236  	}
 30237  	if u > (uint64(int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) {
 30238  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))
 30239  	} else if neg != 0 {
 30240  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = -sqlite3_int64(u)
 30241  	} else {
 30242  		*(*sqlite3_int64)(unsafe.Pointer(pNum)) = sqlite3_int64(u)
 30243  	}
 30244  	if ((((c != 0) && ((zNum + uintptr(i)) < zEnd)) || ((i == 0) && (zStart == zNum))) || (i > 19)) || (nonNum != 0) {
 30245  		// zNum is empty or contains non-numeric text or is longer
 30246  		// than 19 digits (thus guaranteeing that it is too large)
 30247  		return 1
 30248  	} else if i < 19 {
 30249  		// Less than 19 digits, so we know that it fits in 64 bits
 30250  
 30251  		return 0
 30252  	} else {
 30253  		// zNum is a 19-digit numbers.  Compare it against 9223372036854775808.
 30254  		c = totypeCompare2pow63(tls, zNum)
 30255  		if c < 0 {
 30256  			// zNum is less than 9223372036854775808 so it fits
 30257  
 30258  			return 0
 30259  		} else if c > 0 {
 30260  			// zNum is greater than 9223372036854775808 so it overflows
 30261  			return 1
 30262  		} else {
 30263  			// zNum is exactly 9223372036854775808.  Fits if negative.  The
 30264  			// special case 2 overflow if positive
 30265  
 30266  			if neg != 0 {
 30267  				return 0
 30268  			}
 30269  			return 2
 30270  		}
 30271  	}
 30272  	return int32(0)
 30273  }
 30274  
 30275  // The string z[] is an text representation of a real number.
 30276  // Convert this string to a double and write it into *pResult.
 30277  //
 30278  // The string is not necessarily zero-terminated.
 30279  //
 30280  // Return TRUE if the result is a valid real number (or integer) and FALSE
 30281  // if the string is empty or contains extraneous text.  Valid numbers
 30282  // are in one of these formats:
 30283  //
 30284  //    [+-]digits[E[+-]digits]
 30285  //    [+-]digits.[digits][E[+-]digits]
 30286  //    [+-].digits[E[+-]digits]
 30287  //
 30288  // Leading and trailing whitespace is ignored for the purpose of determining
 30289  // validity.
 30290  //
 30291  // If some prefix of the input string is a valid number, this routine
 30292  // returns FALSE but it still converts the prefix and writes the result
 30293  // into *pResult.
 30294  func totypeAtoF(tls *libc.TLS, z uintptr, pResult uintptr, length int32) int32 { /* totype.c:204:12: */
 30295  	var zEnd uintptr
 30296  	// sign * significand * (10 ^ (esign * exponent))
 30297  	var sign int32      // sign of significand
 30298  	var s sqlite3_int64 // significand
 30299  	var d int32         // adjust exponent for shifting decimal point
 30300  	var esign int32     // sign of exponent
 30301  	var e int32         // exponent
 30302  	var eValid int32    // True exponent is either not used or is well-formed
 30303  	var result float64
 30304  	var nDigits int32
 30305  	var nonNum int32
 30306  	var scale float64
 30307  	zEnd = (z + uintptr(length))
 30308  	sign = 1
 30309  	s = int64(0)
 30310  	d = 0
 30311  	esign = 1
 30312  	e = 0
 30313  	eValid = 1
 30314  	nDigits = 0
 30315  	nonNum = 0
 30316  
 30317  	*(*float64)(unsafe.Pointer(pResult)) = 0.0 // Default return value, in case of an error
 30318  
 30319  	// skip leading spaces
 30320  __1:
 30321  	if !((z < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 30322  		goto __2
 30323  	}
 30324  	z++
 30325  	goto __1
 30326  __2:
 30327  	;
 30328  	if !(z >= zEnd) {
 30329  		goto __3
 30330  	}
 30331  	return 0
 30332  __3:
 30333  	;
 30334  
 30335  	// get sign of significand
 30336  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') {
 30337  		goto __4
 30338  	}
 30339  	sign = -1
 30340  	z++
 30341  	goto __5
 30342  __4:
 30343  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') {
 30344  		goto __6
 30345  	}
 30346  	z++
 30347  __6:
 30348  	;
 30349  __5:
 30350  	;
 30351  
 30352  	// skip leading zeroes
 30353  __7:
 30354  	if !((z < zEnd) && (int32(*(*int8)(unsafe.Pointer(z))) == '0')) {
 30355  		goto __8
 30356  	}
 30357  	z++
 30358  	nDigits++
 30359  	goto __7
 30360  __8:
 30361  	;
 30362  
 30363  	// copy max significant digits to significand
 30364  __9:
 30365  	if !(((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) && (s < (((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10)))) {
 30366  		goto __10
 30367  	}
 30368  	s = ((s * int64(10)) + (sqlite3_int64(int32(*(*int8)(unsafe.Pointer(z))) - '0')))
 30369  	z++
 30370  	nDigits++
 30371  	goto __9
 30372  __10:
 30373  	;
 30374  
 30375  	// skip non-significant significand digits
 30376  	// (increase exponent by d to shift decimal left)
 30377  __11:
 30378  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 30379  		goto __12
 30380  	}
 30381  	z++
 30382  	nDigits++
 30383  	d++
 30384  	goto __11
 30385  __12:
 30386  	;
 30387  	if !(z >= zEnd) {
 30388  		goto __13
 30389  	}
 30390  	goto totype_atof_calc
 30391  __13:
 30392  	;
 30393  
 30394  	// if decimal point is present
 30395  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '.') {
 30396  		goto __14
 30397  	}
 30398  	z++
 30399  	// copy digits from after decimal to significand
 30400  	// (decrease exponent by d to shift decimal right)
 30401  __15:
 30402  	if !(((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) && (s < (((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) - int64(9)) / int64(10)))) {
 30403  		goto __16
 30404  	}
 30405  	s = ((s * int64(10)) + (sqlite3_int64(int32(*(*int8)(unsafe.Pointer(z))) - '0')))
 30406  	z++
 30407  	nDigits++
 30408  	d--
 30409  	goto __15
 30410  __16:
 30411  	;
 30412  	// skip non-significant digits
 30413  __17:
 30414  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 30415  		goto __18
 30416  	}
 30417  	z++
 30418  	nDigits++
 30419  	goto __17
 30420  __18:
 30421  	;
 30422  __14:
 30423  	;
 30424  	if !(z >= zEnd) {
 30425  		goto __19
 30426  	}
 30427  	goto totype_atof_calc
 30428  __19:
 30429  	;
 30430  
 30431  	// if exponent is present
 30432  	if !((int32(*(*int8)(unsafe.Pointer(z))) == 'e') || (int32(*(*int8)(unsafe.Pointer(z))) == 'E')) {
 30433  		goto __20
 30434  	}
 30435  	z++
 30436  	eValid = 0
 30437  	if !(z >= zEnd) {
 30438  		goto __21
 30439  	}
 30440  	goto totype_atof_calc
 30441  __21:
 30442  	;
 30443  	// get sign of exponent
 30444  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '-') {
 30445  		goto __22
 30446  	}
 30447  	esign = -1
 30448  	z++
 30449  	goto __23
 30450  __22:
 30451  	if !(int32(*(*int8)(unsafe.Pointer(z))) == '+') {
 30452  		goto __24
 30453  	}
 30454  	z++
 30455  __24:
 30456  	;
 30457  __23:
 30458  	;
 30459  	// copy digits to exponent
 30460  __25:
 30461  	if !((z < zEnd) && (totypeIsdigit(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 30462  		goto __26
 30463  	}
 30464  	if e < 10000 {
 30465  		e = ((e * 10) + (int32(*(*int8)(unsafe.Pointer(z))) - '0'))
 30466  	} else {
 30467  		e = 10000
 30468  	}
 30469  	z++
 30470  	eValid = 1
 30471  	goto __25
 30472  __26:
 30473  	;
 30474  __20:
 30475  	;
 30476  
 30477  	// skip trailing spaces
 30478  	if !((nDigits != 0) && (eValid != 0)) {
 30479  		goto __27
 30480  	}
 30481  __28:
 30482  	if !((z < zEnd) && (totypeIsspace(tls, uint8(*(*int8)(unsafe.Pointer(z)))) != 0)) {
 30483  		goto __29
 30484  	}
 30485  	z++
 30486  	goto __28
 30487  __29:
 30488  	;
 30489  __27:
 30490  	;
 30491  
 30492  totype_atof_calc:
 30493  	// adjust exponent by d, and update sign
 30494  	e = ((e * esign) + d)
 30495  	if !(e < 0) {
 30496  		goto __30
 30497  	}
 30498  	esign = -1
 30499  	e = e * (-1)
 30500  	goto __31
 30501  __30:
 30502  	esign = 1
 30503  __31:
 30504  	;
 30505  
 30506  	// if 0 significand
 30507  	if !(!(s != 0)) {
 30508  		goto __32
 30509  	}
 30510  	// In the IEEE 754 standard, zero is signed.
 30511  	// Add the sign if we've seen at least one digit
 30512  	if (sign < 0) && (nDigits != 0) {
 30513  		result = -libc.Float64FromFloat64(float64(0))
 30514  	} else {
 30515  		result = float64(0)
 30516  	}
 30517  	goto __33
 30518  __32:
 30519  	// attempt to reduce exponent
 30520  	if !(esign > 0) {
 30521  		goto __34
 30522  	}
 30523  __36:
 30524  	if !((s < ((int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) / int64(10))) && (e > 0)) {
 30525  		goto __37
 30526  	}
 30527  	e--
 30528  	s = s * (int64(10))
 30529  	goto __36
 30530  __37:
 30531  	;
 30532  	goto __35
 30533  __34:
 30534  __38:
 30535  	if !(!((int32(s % int64(10))) != 0) && (e > 0)) {
 30536  		goto __39
 30537  	}
 30538  	e--
 30539  	s = s / (int64(10))
 30540  	goto __38
 30541  __39:
 30542  	;
 30543  __35:
 30544  	;
 30545  
 30546  	// adjust the sign of significand
 30547  	if sign < 0 {
 30548  		s = -s
 30549  	} else {
 30550  		s = s
 30551  	}
 30552  
 30553  	// if exponent, scale significand as appropriate
 30554  	// and store in result.
 30555  	if !(e != 0) {
 30556  		goto __40
 30557  	}
 30558  	scale = 1.0
 30559  	// attempt to handle extremely small/large numbers better
 30560  	if !((e > 307) && (e < 342)) {
 30561  		goto __42
 30562  	}
 30563  __44:
 30564  	if !((e % 308) != 0) {
 30565  		goto __45
 30566  	}
 30567  	scale = scale * (1.0e+1)
 30568  	e = e - (1)
 30569  	goto __44
 30570  __45:
 30571  	;
 30572  	if !(esign < 0) {
 30573  		goto __46
 30574  	}
 30575  	result = (float64(s) / scale)
 30576  	result = result / (1.0e+308)
 30577  	goto __47
 30578  __46:
 30579  	result = (float64(s) * scale)
 30580  	result = result * (1.0e+308)
 30581  __47:
 30582  	;
 30583  	goto __43
 30584  __42:
 30585  	if !(e >= 342) {
 30586  		goto __48
 30587  	}
 30588  	if !(esign < 0) {
 30589  		goto __50
 30590  	}
 30591  	result = (0.0 * float64(s))
 30592  	goto __51
 30593  __50:
 30594  	result = ((libc.Float64(1e308) * libc.Float64(1e308)) * float64(s)) // Infinity
 30595  __51:
 30596  	;
 30597  	goto __49
 30598  __48:
 30599  	// 1.0e+22 is the largest power of 10 than can be
 30600  	// represented exactly.
 30601  __52:
 30602  	if !((e % 22) != 0) {
 30603  		goto __53
 30604  	}
 30605  	scale = scale * (1.0e+1)
 30606  	e = e - (1)
 30607  	goto __52
 30608  __53:
 30609  	;
 30610  __54:
 30611  	if !(e > 0) {
 30612  		goto __55
 30613  	}
 30614  	scale = scale * (1.0e+22)
 30615  	e = e - (22)
 30616  	goto __54
 30617  __55:
 30618  	;
 30619  	if !(esign < 0) {
 30620  		goto __56
 30621  	}
 30622  	result = (float64(s) / scale)
 30623  	goto __57
 30624  __56:
 30625  	result = (float64(s) * scale)
 30626  __57:
 30627  	;
 30628  __49:
 30629  	;
 30630  __43:
 30631  	;
 30632  	goto __41
 30633  __40:
 30634  	result = float64(s)
 30635  __41:
 30636  	;
 30637  __33:
 30638  	;
 30639  
 30640  	// store the result
 30641  	*(*float64)(unsafe.Pointer(pResult)) = result
 30642  
 30643  	// return true if number and no extra non-whitespace chracters after
 30644  	return (libc.Bool32((((z >= zEnd) && (nDigits > 0)) && (eValid != 0)) && (nonNum == 0)))
 30645  }
 30646  
 30647  // tointeger(X):  If X is any value (integer, double, blob, or string) that
 30648  // can be losslessly converted into an integer, then make the conversion and
 30649  // return the result.  Otherwise, return NULL.
 30650  func tointegerFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* totype.c:358:13: */
 30651  	bp := tls.Alloc(24)
 30652  	defer tls.Free(24)
 30653  
 30654  	_ = argc
 30655  	switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) {
 30656  	case SQLITE_FLOAT:
 30657  		{
 30658  			var rVal float64 = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30659  			var iVal sqlite3_int64 = sqlite3_int64(rVal)
 30660  			if rVal == float64(iVal) {
 30661  				sqlite3.Xsqlite3_result_int64(tls, context, iVal)
 30662  			}
 30663  			break
 30664  
 30665  		}
 30666  	case SQLITE_INTEGER:
 30667  		{
 30668  			sqlite3.Xsqlite3_result_int64(tls, context, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 30669  			break
 30670  
 30671  		}
 30672  	case SQLITE_BLOB:
 30673  		{
 30674  			var zBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30675  			if zBlob != 0 {
 30676  				var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30677  				if uint32(nBlob) == uint32(unsafe.Sizeof(sqlite3_int64(0))) {
 30678  					// var iVal sqlite3_int64 at bp+8, 8
 30679  
 30680  					if int32(*(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&totype_one))))) == 0 {
 30681  						var i int32
 30682  						// var zBlobRev [8]uint8 at bp, 8
 30683  
 30684  						for i = 0; uint32(i) < uint32(unsafe.Sizeof(sqlite3_int64(0))); i++ {
 30685  							*(*uint8)(unsafe.Pointer(bp /* &zBlobRev[0] */ + uintptr(i))) = *(*uint8)(unsafe.Pointer(zBlob + uintptr(((uint32(unsafe.Sizeof(sqlite3_int64(0))) - uint32(1)) - uint32(i)))))
 30686  						}
 30687  						libc.Xmemcpy(tls, bp+8 /* &iVal */, bp /* &zBlobRev[0] */, uint32(unsafe.Sizeof(sqlite3_int64(0))))
 30688  					} else {
 30689  						libc.Xmemcpy(tls, bp+8 /* &iVal */, zBlob, uint32(unsafe.Sizeof(sqlite3_int64(0))))
 30690  					}
 30691  					sqlite3.Xsqlite3_result_int64(tls, context, *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* iVal */)))
 30692  				}
 30693  			}
 30694  			break
 30695  
 30696  		}
 30697  	case SQLITE_TEXT:
 30698  		{
 30699  			var zStr uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30700  			if zStr != 0 {
 30701  				var nStr int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30702  				if (nStr != 0) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr))) != 0) {
 30703  					// var iVal sqlite3_int64 at bp+16, 8
 30704  
 30705  					if !(totypeAtoi64(tls, zStr, bp+16 /* &iVal */, nStr) != 0) {
 30706  						sqlite3.Xsqlite3_result_int64(tls, context, *(*sqlite3_int64)(unsafe.Pointer(bp + 16 /* iVal */)))
 30707  					}
 30708  				}
 30709  			}
 30710  			break
 30711  
 30712  		}
 30713  	default:
 30714  		{
 30715  
 30716  			break
 30717  
 30718  		}
 30719  	}
 30720  }
 30721  
 30722  // toreal(X): If X is any value (integer, double, blob, or string) that can
 30723  // be losslessly converted into a real number, then do so and return that
 30724  // real number.  Otherwise return NULL.
 30725  func torealFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* totype.c:428:13: */
 30726  	bp := tls.Alloc(24)
 30727  	defer tls.Free(24)
 30728  
 30729  	_ = argc
 30730  	switch sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) {
 30731  	case SQLITE_FLOAT:
 30732  		{
 30733  			sqlite3.Xsqlite3_result_double(tls, context, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv))))
 30734  			break
 30735  
 30736  		}
 30737  	case SQLITE_INTEGER:
 30738  		{
 30739  			var iVal sqlite3_int64 = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30740  			var rVal float64 = float64(iVal)
 30741  			if iVal == sqlite3_int64(rVal) {
 30742  				sqlite3.Xsqlite3_result_double(tls, context, rVal)
 30743  			}
 30744  			break
 30745  
 30746  		}
 30747  	case SQLITE_BLOB:
 30748  		{
 30749  			var zBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30750  			if zBlob != 0 {
 30751  				var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30752  				if uint32(nBlob) == uint32(unsafe.Sizeof(float64(0))) {
 30753  					// var rVal float64 at bp+8, 8
 30754  
 30755  					if int32(*(*int8)(unsafe.Pointer(uintptr(unsafe.Pointer(&totype_one))))) == 1 {
 30756  						var i int32
 30757  						// var zBlobRev [8]uint8 at bp, 8
 30758  
 30759  						for i = 0; uint32(i) < uint32(unsafe.Sizeof(float64(0))); i++ {
 30760  							*(*uint8)(unsafe.Pointer(bp /* &zBlobRev[0] */ + uintptr(i))) = *(*uint8)(unsafe.Pointer(zBlob + uintptr(((uint32(unsafe.Sizeof(float64(0))) - uint32(1)) - uint32(i)))))
 30761  						}
 30762  						libc.Xmemcpy(tls, bp+8 /* &rVal */, bp /* &zBlobRev[0] */, uint32(unsafe.Sizeof(float64(0))))
 30763  					} else {
 30764  						libc.Xmemcpy(tls, bp+8 /* &rVal */, zBlob, uint32(unsafe.Sizeof(float64(0))))
 30765  					}
 30766  					sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 8 /* rVal */)))
 30767  				}
 30768  			}
 30769  			break
 30770  
 30771  		}
 30772  	case SQLITE_TEXT:
 30773  		{
 30774  			var zStr uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30775  			if zStr != 0 {
 30776  				var nStr int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 30777  				if ((nStr != 0) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr))) != 0)) && !(totypeIsspace(tls, *(*uint8)(unsafe.Pointer(zStr + uintptr((nStr - 1))))) != 0) {
 30778  					// var rVal float64 at bp+16, 8
 30779  
 30780  					if totypeAtoF(tls, zStr, bp+16 /* &rVal */, nStr) != 0 {
 30781  						sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 16 /* rVal */)))
 30782  						return
 30783  					}
 30784  				}
 30785  			}
 30786  			break
 30787  
 30788  		}
 30789  	default:
 30790  		{
 30791  
 30792  			break
 30793  
 30794  		}
 30795  	}
 30796  }
 30797  
 30798  func sqlite3_totype_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* totype.c:497:5: */
 30799  	var rc int32 = SQLITE_OK
 30800  	_ = pApi
 30801  
 30802  	_ = pzErrMsg // Unused parameter
 30803  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7877 /* "tointeger" */, 1,
 30804  		((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS), uintptr(0),
 30805  		*(*uintptr)(unsafe.Pointer(&struct {
 30806  			f func(*libc.TLS, uintptr, int32, uintptr)
 30807  		}{tointegerFunc})), uintptr(0), uintptr(0))
 30808  	if rc == SQLITE_OK {
 30809  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+7887 /* "toreal" */, 1,
 30810  			((SQLITE_UTF8 | SQLITE_DETERMINISTIC) | SQLITE_INNOCUOUS), uintptr(0),
 30811  			*(*uintptr)(unsafe.Pointer(&struct {
 30812  				f func(*libc.TLS, uintptr, int32, uintptr)
 30813  			}{torealFunc})), uintptr(0), uintptr(0))
 30814  	}
 30815  	return rc
 30816  }
 30817  
 30818  // Floating-point inline functions for stdlib.h.
 30819  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 30820  //    This file is part of the GNU C Library.
 30821  //
 30822  //    The GNU C Library is free software; you can redistribute it and/or
 30823  //    modify it under the terms of the GNU Lesser General Public
 30824  //    License as published by the Free Software Foundation; either
 30825  //    version 2.1 of the License, or (at your option) any later version.
 30826  //
 30827  //    The GNU C Library is distributed in the hope that it will be useful,
 30828  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 30829  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 30830  //    Lesser General Public License for more details.
 30831  //
 30832  //    You should have received a copy of the GNU Lesser General Public
 30833  //    License along with the GNU C Library; if not, see
 30834  //    <http://www.gnu.org/licenses/>.
 30835  
 30836  // Define some macros helping to catch buffer overflows.
 30837  
 30838  // Largest and smallest possible 64-bit signed integers. These macros
 30839  // copied from sqliteInt.h.
 30840  
 30841  // The following is also copied from sqliteInt.h. To facilitate coverage
 30842  // testing.
 30843  
 30844  // The swarmvtab module attempts to keep the number of open database files
 30845  // at or below this limit. This may not be possible if there are too many
 30846  // simultaneous queries.
 30847  
 30848  type UnionCsr1 = struct {
 30849  	Fbase      sqlite3_vtab_cursor
 30850  	FpStmt     uintptr
 30851  	FiMaxRowid sqlite3_int64
 30852  	FiTab      int32
 30853  	_          [4]byte
 30854  } /* unionvtab.c:181:9 */
 30855  
 30856  // Floating-point inline functions for stdlib.h.
 30857  //    Copyright (C) 2012-2018 Free Software Foundation, Inc.
 30858  //    This file is part of the GNU C Library.
 30859  //
 30860  //    The GNU C Library is free software; you can redistribute it and/or
 30861  //    modify it under the terms of the GNU Lesser General Public
 30862  //    License as published by the Free Software Foundation; either
 30863  //    version 2.1 of the License, or (at your option) any later version.
 30864  //
 30865  //    The GNU C Library is distributed in the hope that it will be useful,
 30866  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 30867  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 30868  //    Lesser General Public License for more details.
 30869  //
 30870  //    You should have received a copy of the GNU Lesser General Public
 30871  //    License along with the GNU C Library; if not, see
 30872  //    <http://www.gnu.org/licenses/>.
 30873  
 30874  // Define some macros helping to catch buffer overflows.
 30875  
 30876  // Largest and smallest possible 64-bit signed integers. These macros
 30877  // copied from sqliteInt.h.
 30878  
 30879  // The following is also copied from sqliteInt.h. To facilitate coverage
 30880  // testing.
 30881  
 30882  // The swarmvtab module attempts to keep the number of open database files
 30883  // at or below this limit. This may not be possible if there are too many
 30884  // simultaneous queries.
 30885  
 30886  type UnionCsr = UnionCsr1 /* unionvtab.c:181:25 */
 30887  type UnionTab1 = struct {
 30888  	Fbase        sqlite3_vtab
 30889  	Fdb          uintptr
 30890  	FbSwarm      int32
 30891  	FiPK         int32
 30892  	FnSrc        int32
 30893  	FaSrc        uintptr
 30894  	FbHasContext int32
 30895  	FzSourceStr  uintptr
 30896  	FpNotFound   uintptr
 30897  	FpOpenClose  uintptr
 30898  	FpClosable   uintptr
 30899  	FnOpen       int32
 30900  	FnMaxOpen    int32
 30901  } /* unionvtab.c:182:9 */
 30902  
 30903  type UnionTab = UnionTab1 /* unionvtab.c:182:25 */
 30904  type UnionSrc1 = struct {
 30905  	FzDb           uintptr
 30906  	FzTab          uintptr
 30907  	FiMin          sqlite3_int64
 30908  	FiMax          sqlite3_int64
 30909  	FzFile         uintptr
 30910  	FzContext      uintptr
 30911  	FnUser         int32
 30912  	Fdb            uintptr
 30913  	FpNextClosable uintptr
 30914  	_              [4]byte
 30915  } /* unionvtab.c:182:9 */
 30916  
 30917  type UnionSrc = UnionSrc1 /* unionvtab.c:183:25 */
 30918  
 30919  // Given UnionTab table pTab and UnionSrc object pSrc, return the database
 30920  // handle that should be used to access the table identified by pSrc. This
 30921  // is the main db handle for "unionvtab" tables, or the source-specific
 30922  // handle for "swarmvtab".
 30923  
 30924  // If *pRc is other than SQLITE_OK when this function is called, it
 30925  // always returns NULL. Otherwise, it attempts to allocate and return
 30926  // a pointer to nByte bytes of zeroed memory. If the memory allocation
 30927  // is attempted but fails, NULL is returned and *pRc is set to
 30928  // SQLITE_NOMEM.
 30929  func unionMalloc(tls *libc.TLS, pRc uintptr, nByte sqlite3_int64) uintptr { /* unionvtab.c:253:13: */
 30930  	var pRet uintptr
 30931  
 30932  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 30933  		pRet = sqlite3.Xsqlite3_malloc64(tls, uint64(nByte))
 30934  		if pRet != 0 {
 30935  			libc.Xmemset(tls, pRet, 0, size_t(nByte))
 30936  		} else {
 30937  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 30938  		}
 30939  	} else {
 30940  		pRet = uintptr(0)
 30941  	}
 30942  	return pRet
 30943  }
 30944  
 30945  // If *pRc is other than SQLITE_OK when this function is called, it
 30946  // always returns NULL. Otherwise, it attempts to allocate and return
 30947  // a copy of the nul-terminated string passed as the second argument.
 30948  // If the allocation is attempted but fails, NULL is returned and *pRc is
 30949  // set to SQLITE_NOMEM.
 30950  func unionStrdup(tls *libc.TLS, pRc uintptr, zIn uintptr) uintptr { /* unionvtab.c:276:13: */
 30951  	var zRet uintptr = uintptr(0)
 30952  	if zIn != 0 {
 30953  		var nByte sqlite3_int64 = (sqlite3_int64(libc.Xstrlen(tls, zIn) + size_t(1)))
 30954  		zRet = unionMalloc(tls, pRc, nByte)
 30955  		if zRet != 0 {
 30956  			libc.Xmemcpy(tls, zRet, zIn, size_t(nByte))
 30957  		}
 30958  	}
 30959  	return zRet
 30960  }
 30961  
 30962  // If the first character of the string passed as the only argument to this
 30963  // function is one of the 4 that may be used as an open quote character
 30964  // in SQL, this function assumes that the input is a well-formed quoted SQL
 30965  // string. In this case the string is dequoted in place.
 30966  //
 30967  // If the first character of the input is not an open quote, then this
 30968  // function is a no-op.
 30969  func unionDequote(tls *libc.TLS, z uintptr) { /* unionvtab.c:297:13: */
 30970  	if z != 0 {
 30971  		var q int8 = *(*int8)(unsafe.Pointer(z))
 30972  
 30973  		// Set stack variable q to the close-quote character
 30974  		if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 30975  			var iIn int32 = 1
 30976  			var iOut int32 = 0
 30977  			if int32(q) == '[' {
 30978  				q = int8(']')
 30979  			}
 30980  			for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 30981  				if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 30982  					if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 30983  						// Character iIn was the close quote.
 30984  						iIn++
 30985  						break
 30986  					} else {
 30987  						// Character iIn and iIn+1 form an escaped quote character. Skip
 30988  						// the input cursor past both and copy a single quote character
 30989  						// to the output buffer.
 30990  						iIn = iIn + (2)
 30991  						*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 30992  					}
 30993  				} else {
 30994  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 30995  				}
 30996  			}
 30997  			*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 30998  		}
 30999  	}
 31000  }
 31001  
 31002  // This function is a no-op if *pRc is set to other than SQLITE_OK when it
 31003  // is called. NULL is returned in this case.
 31004  //
 31005  // Otherwise, the SQL statement passed as the third argument is prepared
 31006  // against the database handle passed as the second. If the statement is
 31007  // successfully prepared, a pointer to the new statement handle is
 31008  // returned. It is the responsibility of the caller to eventually free the
 31009  // statement by calling sqlite3_finalize(). Alternatively, if statement
 31010  // compilation fails, NULL is returned, *pRc is set to an SQLite error
 31011  // code and *pzErr may be set to an error message buffer allocated by
 31012  // sqlite3_malloc().
 31013  func unionPrepare(tls *libc.TLS, pRc uintptr, db uintptr, zSql uintptr, pzErr uintptr) uintptr { /* unionvtab.c:341:21: */
 31014  	bp := tls.Alloc(12)
 31015  	defer tls.Free(12)
 31016  
 31017  	*(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */)) = uintptr(0)
 31018  
 31019  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 31020  		var rc int32 = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pRet */, uintptr(0))
 31021  		if rc != SQLITE_OK {
 31022  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7894 /* "sql error: %s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 31023  			*(*int32)(unsafe.Pointer(pRc)) = rc
 31024  		}
 31025  	}
 31026  	return *(*uintptr)(unsafe.Pointer(bp + 8 /* pRet */))
 31027  }
 31028  
 31029  // Like unionPrepare(), except prepare the results of vprintf(zFmt, ...)
 31030  // instead of a constant SQL string.
 31031  func unionPreparePrintf(tls *libc.TLS, pRc uintptr, pzErr uintptr, db uintptr, zFmt uintptr, va uintptr) uintptr { /* unionvtab.c:363:21: */
 31032  	var pRet uintptr = uintptr(0)
 31033  	var zSql uintptr
 31034  	var ap va_list
 31035  	_ = ap
 31036  	ap = va
 31037  
 31038  	zSql = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 31039  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 31040  		if zSql == uintptr(0) {
 31041  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 31042  		} else {
 31043  			pRet = unionPrepare(tls, pRc, db, zSql, pzErr)
 31044  		}
 31045  	}
 31046  	sqlite3.Xsqlite3_free(tls, zSql)
 31047  
 31048  	_ = ap
 31049  	return pRet
 31050  }
 31051  
 31052  // Call sqlite3_reset() on SQL statement pStmt. If *pRc is set to
 31053  // SQLITE_OK when this function is called, then it is set to the
 31054  // value returned by sqlite3_reset() before this function exits.
 31055  // In this case, *pzErr may be set to point to an error message
 31056  // buffer allocated by sqlite3_malloc().
 31057  
 31058  // Call sqlite3_finalize() on SQL statement pStmt. If *pRc is set to
 31059  // SQLITE_OK when this function is called, then it is set to the
 31060  // value returned by sqlite3_finalize() before this function exits.
 31061  func unionFinalize(tls *libc.TLS, pRc uintptr, pStmt uintptr, pzErr uintptr) { /* unionvtab.c:414:13: */
 31062  	bp := tls.Alloc(8)
 31063  	defer tls.Free(8)
 31064  
 31065  	var db uintptr = sqlite3.Xsqlite3_db_handle(tls, pStmt)
 31066  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, pStmt)
 31067  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 31068  		*(*int32)(unsafe.Pointer(pRc)) = rc
 31069  		if rc != 0 {
 31070  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 31071  		}
 31072  	}
 31073  }
 31074  
 31075  // If an "openclose" UDF was supplied when this virtual table was created,
 31076  // invoke it now. The first argument passed is the name of the database
 31077  // file for source pSrc. The second is integer value bClose.
 31078  //
 31079  // If successful, return SQLITE_OK. Otherwise an SQLite error code. In this
 31080  // case if argument pzErr is not NULL, also set (*pzErr) to an English
 31081  // language error message. The caller is responsible for eventually freeing
 31082  // any error message using sqlite3_free().
 31083  func unionInvokeOpenClose(tls *libc.TLS, pTab uintptr, pSrc uintptr, bClose int32, pzErr uintptr) int32 { /* unionvtab.c:435:12: */
 31084  	bp := tls.Alloc(8)
 31085  	defer tls.Free(8)
 31086  
 31087  	var rc int32 = SQLITE_OK
 31088  	if (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose != 0 {
 31089  		sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, -1, uintptr(0))
 31090  		if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 31091  			sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext, -1, uintptr(0))
 31092  		}
 31093  		sqlite3.Xsqlite3_bind_int(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose, (2 + (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext), bClose)
 31094  		sqlite3.Xsqlite3_step(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose)
 31095  		if SQLITE_OK != (libc.AssignInt32(&rc, sqlite3.Xsqlite3_reset(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose))) {
 31096  			if pzErr != 0 {
 31097  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*UnionTab)(unsafe.Pointer(pTab)).Fdb)))
 31098  			}
 31099  		}
 31100  	}
 31101  	return rc
 31102  }
 31103  
 31104  // This function is a no-op for unionvtab. For swarmvtab, it attempts to
 31105  // close open database files until at most nMax are open. An SQLite error
 31106  // code is returned if an error occurs, or SQLITE_OK otherwise.
 31107  func unionCloseSources(tls *libc.TLS, pTab uintptr, nMax int32) { /* unionvtab.c:463:13: */
 31108  	for ((*UnionTab)(unsafe.Pointer(pTab)).FpClosable != 0) && ((*UnionTab)(unsafe.Pointer(pTab)).FnOpen > nMax) {
 31109  		var p uintptr
 31110  		var pp uintptr
 31111  		for pp = (pTab + 48 /* &.pClosable */); (*UnionSrc)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNextClosable != 0; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 40 /* &.pNextClosable */) {
 31112  		}
 31113  		p = *(*uintptr)(unsafe.Pointer(pp))
 31114  
 31115  		sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(p)).Fdb)
 31116  		(*UnionSrc)(unsafe.Pointer(p)).Fdb = uintptr(0)
 31117  		*(*uintptr)(unsafe.Pointer(pp)) = uintptr(0)
 31118  		(*UnionTab)(unsafe.Pointer(pTab)).FnOpen--
 31119  		unionInvokeOpenClose(tls, pTab, p, 1, uintptr(0))
 31120  	}
 31121  }
 31122  
 31123  // xDisconnect method.
 31124  func unionDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* unionvtab.c:481:12: */
 31125  	if pVtab != 0 {
 31126  		var pTab uintptr = pVtab
 31127  		var i int32
 31128  		for i = 0; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 31129  			var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*48)
 31130  			var bHaveSrcDb int32 = (libc.Bool32((*UnionSrc)(unsafe.Pointer(pSrc)).Fdb != uintptr(0)))
 31131  			sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 31132  			if bHaveSrcDb != 0 {
 31133  				unionInvokeOpenClose(tls, pTab, pSrc, 1, uintptr(0))
 31134  			}
 31135  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb)
 31136  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab)
 31137  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile)
 31138  			sqlite3.Xsqlite3_free(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext)
 31139  		}
 31140  		sqlite3.Xsqlite3_finalize(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound)
 31141  		sqlite3.Xsqlite3_finalize(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose)
 31142  		sqlite3.Xsqlite3_free(tls, (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr)
 31143  		sqlite3.Xsqlite3_free(tls, (*UnionTab)(unsafe.Pointer(pTab)).FaSrc)
 31144  		sqlite3.Xsqlite3_free(tls, pTab)
 31145  	}
 31146  	return SQLITE_OK
 31147  }
 31148  
 31149  // Check that the table identified by pSrc is a rowid table. If not,
 31150  // return SQLITE_ERROR and set (*pzErr) to point to an English language
 31151  // error message. If the table is a rowid table and no error occurs,
 31152  // return SQLITE_OK and leave (*pzErr) unmodified.
 31153  func unionIsIntkeyTable(tls *libc.TLS, db uintptr, pSrc uintptr, pzErr uintptr) int32 { /* unionvtab.c:512:12: */
 31154  	bp := tls.Alloc(32)
 31155  	defer tls.Free(32)
 31156  
 31157  	*(*int32)(unsafe.Pointer(bp + 28 /* bPk */)) = 0
 31158  	*(*uintptr)(unsafe.Pointer(bp + 24 /* zType */)) = uintptr(0)
 31159  	var rc int32
 31160  
 31161  	sqlite3.Xsqlite3_table_column_metadata(tls,
 31162  		db, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, ts+7908 /* "_rowid_" */, bp+24 /* &zType */, uintptr(0), uintptr(0), bp+28 /* &bPk */, uintptr(0))
 31163  	rc = sqlite3.Xsqlite3_errcode(tls, db)
 31164  	if (rc == SQLITE_ERROR) ||
 31165  		((rc == SQLITE_OK) && (!(*(*int32)(unsafe.Pointer(bp + 28 /* bPk */)) != 0) || (sqlite3.Xsqlite3_stricmp(tls, ts+7916 /* "integer" */, *(*uintptr)(unsafe.Pointer(bp + 24 /* zType */))) != 0))) {
 31166  		rc = SQLITE_ERROR
 31167  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+7924, /* "no such rowid ta..." */
 31168  			libc.VaList(bp, func() uintptr {
 31169  				if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 31170  					return (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb
 31171  				}
 31172  				return ts + 489 /* "" */
 31173  			}(),
 31174  				func() uintptr {
 31175  					if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 31176  						return ts + 7952 /* "." */
 31177  					}
 31178  					return ts + 489 /* "" */
 31179  				}(),
 31180  				(*UnionSrc)(unsafe.Pointer(pSrc)).FzTab))
 31181  	}
 31182  	return rc
 31183  }
 31184  
 31185  // This function is a no-op if *pRc is other than SQLITE_OK when it is
 31186  // called. In this case it returns NULL.
 31187  //
 31188  // Otherwise, this function checks that the source table passed as the
 31189  // second argument (a) exists, (b) is not a view and (c) has a column
 31190  // named "_rowid_" of type "integer" that is the primary key.
 31191  // If this is not the case, *pRc is set to SQLITE_ERROR and NULL is
 31192  // returned.
 31193  //
 31194  // Finally, if the source table passes the checks above, a nul-terminated
 31195  // string describing the column names and types belonging to the source
 31196  // table is returned. Tables with the same set of column names and types
 31197  // cause this function to return identical strings. Is is the responsibility
 31198  // of the caller to free the returned string using sqlite3_free() when
 31199  // it is no longer required.
 31200  func unionSourceToStr(tls *libc.TLS, pRc uintptr, pTab uintptr, pSrc uintptr, pzErr uintptr) uintptr { /* unionvtab.c:555:13: */
 31201  	bp := tls.Alloc(4)
 31202  	defer tls.Free(4)
 31203  
 31204  	var zRet uintptr = uintptr(0)
 31205  	if *(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK {
 31206  		var db uintptr = func() uintptr {
 31207  			if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31208  				return (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb
 31209  			}
 31210  			return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 31211  		}()
 31212  		*(*int32)(unsafe.Pointer(bp /* rc */)) = unionIsIntkeyTable(tls, db, pSrc, pzErr)
 31213  		var pStmt uintptr = unionPrepare(tls, bp /* &rc */, db,
 31214  
 31215  			ts+7954 /* "SELECT group_con..." */, pzErr)
 31216  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 31217  			sqlite3.Xsqlite3_bind_text(tls, pStmt, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, -1, uintptr(0))
 31218  			sqlite3.Xsqlite3_bind_text(tls, pStmt, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb, -1, uintptr(0))
 31219  			if SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt) {
 31220  				var z uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 31221  				zRet = unionStrdup(tls, bp /* &rc */, z)
 31222  			}
 31223  			unionFinalize(tls, bp /* &rc */, pStmt, pzErr)
 31224  		}
 31225  		*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp /* rc */))
 31226  	}
 31227  
 31228  	return zRet
 31229  }
 31230  
 31231  // Check that all configured source tables exist and have the same column
 31232  // names and datatypes. If this is not the case, or if some other error
 31233  // occurs, return an SQLite error code. In this case *pzErr may be set
 31234  // to point to an error message buffer allocated by sqlite3_mprintf().
 31235  // Or, if no problems regarding the source tables are detected and no
 31236  // other error occurs, SQLITE_OK is returned.
 31237  func unionSourceCheck(tls *libc.TLS, pTab uintptr, pzErr uintptr) int32 { /* unionvtab.c:592:12: */
 31238  	bp := tls.Alloc(4)
 31239  	defer tls.Free(4)
 31240  
 31241  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 31242  	var z0 uintptr = uintptr(0)
 31243  	var i int32
 31244  
 31245  	z0 = unionSourceToStr(tls, bp /* &rc */, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc), pzErr)
 31246  	for i = 1; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 31247  		var z uintptr = unionSourceToStr(tls, bp /* &rc */, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*48), pzErr)
 31248  		if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (sqlite3.Xsqlite3_stricmp(tls, z, z0) != 0) {
 31249  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8038 /* "source table sch..." */, 0)
 31250  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
 31251  		}
 31252  		sqlite3.Xsqlite3_free(tls, z)
 31253  	}
 31254  	sqlite3.Xsqlite3_free(tls, z0)
 31255  
 31256  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 31257  }
 31258  
 31259  // Try to open the swarmvtab database.  If initially unable, invoke the
 31260  // not-found callback UDF and then try again.
 31261  func unionOpenDatabaseInner(tls *libc.TLS, pTab uintptr, pSrc uintptr, pzErr uintptr) int32 { /* unionvtab.c:616:12: */
 31262  	bp := tls.Alloc(16)
 31263  	defer tls.Free(16)
 31264  
 31265  	var rc int32
 31266  
 31267  	rc = unionInvokeOpenClose(tls, pTab, pSrc, 0, pzErr)
 31268  	if rc != SQLITE_OK {
 31269  		return rc
 31270  	}
 31271  
 31272  	rc = sqlite3.Xsqlite3_open_v2(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, (pSrc + 36 /* &.db */), openFlags, uintptr(0))
 31273  	if rc == SQLITE_OK {
 31274  		return rc
 31275  	}
 31276  	if (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound != 0 {
 31277  		sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 31278  		(*UnionSrc)(unsafe.Pointer(pSrc)).Fdb = uintptr(0)
 31279  		sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound, 1, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, -1, uintptr(0))
 31280  		if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 31281  			sqlite3.Xsqlite3_bind_text(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound, 2, (*UnionSrc)(unsafe.Pointer(pSrc)).FzContext, -1, uintptr(0))
 31282  		}
 31283  		sqlite3.Xsqlite3_step(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound)
 31284  		if SQLITE_OK != (libc.AssignInt32(&rc, sqlite3.Xsqlite3_reset(tls, (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound))) {
 31285  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*UnionTab)(unsafe.Pointer(pTab)).Fdb)))
 31286  			return rc
 31287  		}
 31288  		rc = sqlite3.Xsqlite3_open_v2(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).FzFile, (pSrc + 36 /* &.db */), openFlags, uintptr(0))
 31289  	}
 31290  	if rc != SQLITE_OK {
 31291  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, sqlite3.Xsqlite3_errmsg(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)))
 31292  	}
 31293  	return rc
 31294  }
 31295  
 31296  var openFlags int32 = (SQLITE_OPEN_READONLY | SQLITE_OPEN_URI) /* unionvtab.c:617:20 */
 31297  
 31298  // This function may only be called for swarmvtab tables. The results of
 31299  // calling it on a unionvtab table are undefined.
 31300  //
 31301  // For a swarmvtab table, this function ensures that source database iSrc
 31302  // is open. If the database is opened successfully and the schema is as
 31303  // expected, or if it is already open when this function is called, SQLITE_OK
 31304  // is returned.
 31305  //
 31306  // Alternatively If an error occurs while opening the databases, or if the
 31307  // database schema is unsuitable, an SQLite error code is returned and (*pzErr)
 31308  // may be set to point to an English language error message. In this case it is
 31309  // the responsibility of the caller to eventually free the error message buffer
 31310  // using sqlite3_free().
 31311  func unionOpenDatabase(tls *libc.TLS, pTab uintptr, iSrc int32, pzErr uintptr) int32 { /* unionvtab.c:660:12: */
 31312  	bp := tls.Alloc(4)
 31313  	defer tls.Free(4)
 31314  
 31315  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 31316  	var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(iSrc)*48)
 31317  
 31318  	if (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb == uintptr(0) {
 31319  		unionCloseSources(tls, pTab, ((*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen - 1))
 31320  		*(*int32)(unsafe.Pointer(bp /* rc */)) = unionOpenDatabaseInner(tls, pTab, pSrc, pzErr)
 31321  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 31322  			var z uintptr = unionSourceToStr(tls, bp /* &rc */, pTab, pSrc, pzErr)
 31323  			if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 31324  				if (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr == uintptr(0) {
 31325  					(*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr = z
 31326  				} else {
 31327  					if sqlite3.Xsqlite3_stricmp(tls, z, (*UnionTab)(unsafe.Pointer(pTab)).FzSourceStr) != 0 {
 31328  						*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8038 /* "source table sch..." */, 0)
 31329  						*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_ERROR
 31330  					}
 31331  					sqlite3.Xsqlite3_free(tls, z)
 31332  				}
 31333  			}
 31334  		}
 31335  
 31336  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 31337  			(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = (*UnionTab)(unsafe.Pointer(pTab)).FpClosable
 31338  			(*UnionTab)(unsafe.Pointer(pTab)).FpClosable = pSrc
 31339  			(*UnionTab)(unsafe.Pointer(pTab)).FnOpen++
 31340  		} else {
 31341  			sqlite3.Xsqlite3_close(tls, (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb)
 31342  			(*UnionSrc)(unsafe.Pointer(pSrc)).Fdb = uintptr(0)
 31343  			unionInvokeOpenClose(tls, pTab, pSrc, 1, uintptr(0))
 31344  		}
 31345  	}
 31346  
 31347  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 31348  }
 31349  
 31350  // This function is a no-op for unionvtab tables. For swarmvtab, increment
 31351  // the reference count for source table iTab. If the reference count was
 31352  // zero before it was incremented, also remove the source from the closable
 31353  // list.
 31354  func unionIncrRefcount(tls *libc.TLS, pTab uintptr, iTab int32) { /* unionvtab.c:704:13: */
 31355  	if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31356  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(iTab)*48)
 31357  
 31358  		if (*UnionSrc)(unsafe.Pointer(pSrc)).FnUser == 0 {
 31359  			var pp uintptr
 31360  			for pp = (pTab + 48 /* &.pClosable */); *(*uintptr)(unsafe.Pointer(pp)) != pSrc; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 40 /* &.pNextClosable */) {
 31361  			}
 31362  			*(*uintptr)(unsafe.Pointer(pp)) = (*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable
 31363  			(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = uintptr(0)
 31364  		}
 31365  		(*UnionSrc)(unsafe.Pointer(pSrc)).FnUser++
 31366  	}
 31367  }
 31368  
 31369  // Finalize the SQL statement pCsr->pStmt and return the result.
 31370  //
 31371  // If this is a swarmvtab table (not unionvtab) and pCsr->pStmt was not
 31372  // NULL when this function was called, also decrement the reference
 31373  // count on the associated source table. If this means the source tables
 31374  // refcount is now zero, add it to the closable list.
 31375  func unionFinalizeCsrStmt(tls *libc.TLS, pCsr uintptr) int32 { /* unionvtab.c:726:12: */
 31376  	var rc int32 = SQLITE_OK
 31377  	if (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 31378  		var pTab uintptr = (*UnionCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 31379  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*48)
 31380  		rc = sqlite3.Xsqlite3_finalize(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt)
 31381  		(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 31382  		if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31383  			(*UnionSrc)(unsafe.Pointer(pSrc)).FnUser--
 31384  
 31385  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FnUser == 0 {
 31386  				(*UnionSrc)(unsafe.Pointer(pSrc)).FpNextClosable = (*UnionTab)(unsafe.Pointer(pTab)).FpClosable
 31387  				(*UnionTab)(unsafe.Pointer(pTab)).FpClosable = pSrc
 31388  			}
 31389  			unionCloseSources(tls, pTab, (*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen)
 31390  		}
 31391  	}
 31392  	return rc
 31393  }
 31394  
 31395  // Return true if the argument is a space, tab, CR or LF character.
 31396  func union_isspace(tls *libc.TLS, c int8) int32 { /* unionvtab.c:749:12: */
 31397  	return (libc.Bool32((((int32(c) == ' ') || (int32(c) == '\n')) || (int32(c) == '\r')) || (int32(c) == '\t')))
 31398  }
 31399  
 31400  // Return true if the argument is an alphanumeric character in the
 31401  // ASCII range.
 31402  func union_isidchar(tls *libc.TLS, c int8) int32 { /* unionvtab.c:757:12: */
 31403  	return (libc.Bool32((((int32(c) >= 'a') && (int32(c) <= 'z')) || ((int32(c) >= 'A') && (int32(c) < 'Z'))) || ((int32(c) >= '0') && (int32(c) <= '9'))))
 31404  }
 31405  
 31406  // This function is called to handle all arguments following the first
 31407  // (the SQL statement) passed to a swarmvtab (not unionvtab) CREATE
 31408  // VIRTUAL TABLE statement. It may bind parameters to the SQL statement
 31409  // or configure members of the UnionTab object passed as the second
 31410  // argument.
 31411  //
 31412  // Refer to header comments at the top of this file for a description
 31413  // of the arguments parsed.
 31414  //
 31415  // This function is a no-op if *pRc is other than SQLITE_OK when it is
 31416  // called. Otherwise, if an error occurs, *pRc is set to an SQLite error
 31417  // code. In this case *pzErr may be set to point to a buffer containing
 31418  // an English language error message. It is the responsibility of the
 31419  // caller to eventually free the buffer using sqlite3_free().
 31420  func unionConfigureVtab(tls *libc.TLS, pRc uintptr, pTab uintptr, pStmt uintptr, nArg int32, azArg uintptr, pzErr uintptr) { /* unionvtab.c:777:13: */
 31421  	bp := tls.Alloc(68)
 31422  	defer tls.Free(68)
 31423  
 31424  	*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = *(*int32)(unsafe.Pointer(pRc))
 31425  	var i int32
 31426  	if *(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK {
 31427  		(*UnionTab)(unsafe.Pointer(pTab)).FbHasContext = (libc.Bool32(sqlite3.Xsqlite3_column_count(tls, pStmt) > 4))
 31428  	}
 31429  	for i = 0; (*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) == SQLITE_OK) && (i < nArg); i++ {
 31430  		var zArg uintptr = unionStrdup(tls, bp+64 /* &rc */, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4)))
 31431  		if zArg != 0 {
 31432  			var nOpt int32 = 0 // Size of option name in bytes
 31433  			var zOpt uintptr   // Pointer to option name
 31434  			var zVal uintptr   // Pointer to value
 31435  
 31436  			unionDequote(tls, zArg)
 31437  			zOpt = zArg
 31438  			for union_isspace(tls, *(*int8)(unsafe.Pointer(zOpt))) != 0 {
 31439  				zOpt++
 31440  			}
 31441  			zVal = zOpt
 31442  			if int32(*(*int8)(unsafe.Pointer(zVal))) == ':' {
 31443  				zVal++
 31444  			}
 31445  			for union_isidchar(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 31446  				zVal++
 31447  			}
 31448  			nOpt = ((int32(zVal) - int32(zOpt)) / 1)
 31449  
 31450  			for union_isspace(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 31451  				zVal++
 31452  			}
 31453  			if int32(*(*int8)(unsafe.Pointer(zVal))) == '=' {
 31454  				*(*int8)(unsafe.Pointer(zOpt + uintptr(nOpt))) = int8(0)
 31455  				zVal++
 31456  				for union_isspace(tls, *(*int8)(unsafe.Pointer(zVal))) != 0 {
 31457  					zVal++
 31458  				}
 31459  				zVal = unionStrdup(tls, bp+64 /* &rc */, zVal)
 31460  				if zVal != 0 {
 31461  					unionDequote(tls, zVal)
 31462  					if int32(*(*int8)(unsafe.Pointer(zOpt))) == ':' {
 31463  						// A value to bind to the SQL statement
 31464  						var iParam int32 = sqlite3.Xsqlite3_bind_parameter_index(tls, pStmt, zOpt)
 31465  						if iParam == 0 {
 31466  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 31467  								ts+8067 /* "swarmvtab: no su..." */, libc.VaList(bp, zOpt))
 31468  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31469  						} else {
 31470  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = sqlite3.Xsqlite3_bind_text(tls, pStmt, iParam, zVal, -1, libc.UintptrFromInt32(-1))
 31471  						}
 31472  					} else if (nOpt == 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8104 /* "maxopen" */, 7)) {
 31473  						(*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen = libc.Xatoi(tls, zVal)
 31474  						if (*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen <= 0 {
 31475  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8112 /* "swarmvtab: illeg..." */, 0)
 31476  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31477  						}
 31478  					} else if (nOpt == 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8145 /* "missing" */, 7)) {
 31479  						if (*UnionTab)(unsafe.Pointer(pTab)).FpNotFound != 0 {
 31480  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 31481  								ts+8153 /* "swarmvtab: dupli..." */, 0)
 31482  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31483  						} else {
 31484  							(*UnionTab)(unsafe.Pointer(pTab)).FpNotFound = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 31485  								ts+8191 /* "SELECT \"%w\"(?%s)" */, libc.VaList(bp+8, zVal, func() uintptr {
 31486  									if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 31487  										return ts + 8208 /* ",?" */
 31488  									}
 31489  									return ts + 489 /* "" */
 31490  								}()))
 31491  						}
 31492  					} else if (nOpt == 9) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+8211 /* "openclose" */, 9)) {
 31493  						if (*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose != 0 {
 31494  							*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls,
 31495  								ts+8221 /* "swarmvtab: dupli..." */, 0)
 31496  							*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31497  						} else {
 31498  							(*UnionTab)(unsafe.Pointer(pTab)).FpOpenClose = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 31499  								ts+8261 /* "SELECT \"%w\"(?,?%..." */, libc.VaList(bp+24, zVal, func() uintptr {
 31500  									if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 31501  										return ts + 8208 /* ",?" */
 31502  									}
 31503  									return ts + 489 /* "" */
 31504  								}()))
 31505  						}
 31506  					} else {
 31507  						*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8280 /* "swarmvtab: unrec..." */, libc.VaList(bp+40, zOpt))
 31508  						*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31509  					}
 31510  					sqlite3.Xsqlite3_free(tls, zVal)
 31511  				}
 31512  			} else {
 31513  				if (i == 0) && (nArg == 1) {
 31514  					(*UnionTab)(unsafe.Pointer(pTab)).FpNotFound = unionPreparePrintf(tls, bp+64 /* &rc */, pzErr, (*UnionTab)(unsafe.Pointer(pTab)).Fdb,
 31515  						ts+8315 /* "SELECT \"%w\"(?)" */, libc.VaList(bp+48, zArg))
 31516  				} else {
 31517  					*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8330 /* "swarmvtab: parse..." */, libc.VaList(bp+56, *(*uintptr)(unsafe.Pointer(azArg + uintptr(i)*4))))
 31518  					*(*int32)(unsafe.Pointer(bp + 64 /* rc */)) = SQLITE_ERROR
 31519  				}
 31520  			}
 31521  			sqlite3.Xsqlite3_free(tls, zArg)
 31522  		}
 31523  	}
 31524  	*(*int32)(unsafe.Pointer(pRc)) = *(*int32)(unsafe.Pointer(bp + 64 /* rc */))
 31525  }
 31526  
 31527  // xConnect/xCreate method.
 31528  //
 31529  // The argv[] array contains the following:
 31530  //
 31531  //   argv[0]   -> module name  ("unionvtab" or "swarmvtab")
 31532  //   argv[1]   -> database name
 31533  //   argv[2]   -> table name
 31534  //   argv[3]   -> SQL statement
 31535  //   argv[4]   -> not-found callback UDF name
 31536  func unionConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* unionvtab.c:883:12: */
 31537  	bp := tls.Alloc(44)
 31538  	defer tls.Free(44)
 31539  
 31540  	var pTab uintptr = uintptr(0)
 31541  	*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_OK
 31542  	var bSwarm int32 = func() int32 {
 31543  		if pAux == uintptr(0) {
 31544  			return 0
 31545  		}
 31546  		return 1
 31547  	}()
 31548  	var zVtab uintptr = func() uintptr {
 31549  		if bSwarm != 0 {
 31550  			return ts + 8357 /* "swarmvtab" */
 31551  		}
 31552  		return ts + 8367 /* "unionvtab" */
 31553  	}()
 31554  
 31555  	if sqlite3.Xsqlite3_stricmp(tls, ts+8377 /* "temp" */, *(*uintptr)(unsafe.Pointer(argv + 1*4))) != 0 {
 31556  		// unionvtab tables may only be created in the temp schema
 31557  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8382 /* "%s tables must b..." */, libc.VaList(bp, zVtab))
 31558  		*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 31559  	} else if (argc < 4) || ((argc > 4) && (bSwarm == 0)) {
 31560  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8423 /* "wrong number of ..." */, libc.VaList(bp+8, zVtab))
 31561  		*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 31562  	} else {
 31563  		var nAlloc int32 = 0                                                                          // Allocated size of pTab->aSrc[]
 31564  		var pStmt uintptr = uintptr(0)                                                                // Argument statement
 31565  		var zArg uintptr = unionStrdup(tls, bp+40 /* &rc */, *(*uintptr)(unsafe.Pointer(argv + 3*4))) // Copy of argument to CVT
 31566  
 31567  		// Prepare the SQL statement. Instead of executing it directly, sort
 31568  		// the results by the "minimum rowid" field. This makes it easier to
 31569  		// check that there are no rowid range overlaps between source tables
 31570  		// and that the UnionTab.aSrc[] array is always sorted by rowid.
 31571  		unionDequote(tls, zArg)
 31572  		pStmt = unionPreparePrintf(tls, bp+40 /* &rc */, pzErr, db,
 31573  			ts+8456 /* "SELECT * FROM (%..." */, libc.VaList(bp+16, zArg))
 31574  
 31575  		// Allocate the UnionTab structure
 31576  		pTab = unionMalloc(tls, bp+40 /* &rc */, int64(unsafe.Sizeof(UnionTab{})))
 31577  		if pTab != 0 {
 31578  
 31579  			(*UnionTab)(unsafe.Pointer(pTab)).Fdb = db
 31580  			(*UnionTab)(unsafe.Pointer(pTab)).FbSwarm = bSwarm
 31581  			(*UnionTab)(unsafe.Pointer(pTab)).FnMaxOpen = SWARMVTAB_MAX_OPEN
 31582  		}
 31583  
 31584  		// Parse other CVT arguments, if any
 31585  		if bSwarm != 0 {
 31586  			unionConfigureVtab(tls, bp+40 /* &rc */, pTab, pStmt, (argc - 4), (argv + 4*4), pzErr)
 31587  		}
 31588  
 31589  		// Iterate through the rows returned by the SQL statement specified
 31590  		// as an argument to the CREATE VIRTUAL TABLE statement.
 31591  		for (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt)) {
 31592  			var zDb uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 31593  			var zTab uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 1)
 31594  			var iMin sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 2)
 31595  			var iMax sqlite3_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, 3)
 31596  			var pSrc uintptr
 31597  
 31598  			// Grow the pTab->aSrc[] array if required.
 31599  			if nAlloc <= (*UnionTab)(unsafe.Pointer(pTab)).FnSrc {
 31600  				var nNew int32
 31601  				if nAlloc != 0 {
 31602  					nNew = (nAlloc * 2)
 31603  				} else {
 31604  					nNew = 8
 31605  				}
 31606  				var aNew uintptr = sqlite3.Xsqlite3_realloc64(tls,
 31607  					(*UnionTab)(unsafe.Pointer(pTab)).FaSrc, (uint64(uint32(nNew) * uint32(unsafe.Sizeof(UnionSrc{})))))
 31608  				if aNew == uintptr(0) {
 31609  					*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_NOMEM
 31610  					break
 31611  				} else {
 31612  					libc.Xmemset(tls, (aNew + uintptr((*UnionTab)(unsafe.Pointer(pTab)).FnSrc)*48), 0, ((uint32(nNew - (*UnionTab)(unsafe.Pointer(pTab)).FnSrc)) * uint32(unsafe.Sizeof(UnionSrc{}))))
 31613  					(*UnionTab)(unsafe.Pointer(pTab)).FaSrc = aNew
 31614  					nAlloc = nNew
 31615  				}
 31616  			}
 31617  
 31618  			// Check for problems with the specified range of rowids
 31619  			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))*48)).FiMax)) {
 31620  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8486 /* "rowid range mism..." */, 0)
 31621  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 31622  			}
 31623  
 31624  			if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 31625  				pSrc = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(libc.PostIncInt32(&(*UnionTab)(unsafe.Pointer(pTab)).FnSrc, 1))*48)
 31626  				(*UnionSrc)(unsafe.Pointer(pSrc)).FzTab = unionStrdup(tls, bp+40 /* &rc */, zTab)
 31627  				(*UnionSrc)(unsafe.Pointer(pSrc)).FiMin = iMin
 31628  				(*UnionSrc)(unsafe.Pointer(pSrc)).FiMax = iMax
 31629  				if bSwarm != 0 {
 31630  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzFile = unionStrdup(tls, bp+40 /* &rc */, zDb)
 31631  				} else {
 31632  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzDb = unionStrdup(tls, bp+40 /* &rc */, zDb)
 31633  				}
 31634  				if (*UnionTab)(unsafe.Pointer(pTab)).FbHasContext != 0 {
 31635  					var zContext uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 4)
 31636  					(*UnionSrc)(unsafe.Pointer(pSrc)).FzContext = unionStrdup(tls, bp+40 /* &rc */, zContext)
 31637  				}
 31638  			}
 31639  		}
 31640  		unionFinalize(tls, bp+40 /* &rc */, pStmt, pzErr)
 31641  		pStmt = uintptr(0)
 31642  
 31643  		// It is an error if the SELECT statement returned zero rows. If only
 31644  		// because there is no way to determine the schema of the virtual
 31645  		// table in this case.
 31646  		if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && ((*UnionTab)(unsafe.Pointer(pTab)).FnSrc == 0) {
 31647  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+8513 /* "no source tables..." */, 0)
 31648  			*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = SQLITE_ERROR
 31649  		}
 31650  
 31651  		// For unionvtab, verify that all source tables exist and have
 31652  		// compatible schemas. For swarmvtab, attach the first database and
 31653  		// check that the first table is a rowid table only.
 31654  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 31655  			if bSwarm != 0 {
 31656  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = unionOpenDatabase(tls, pTab, 0, pzErr)
 31657  			} else {
 31658  				*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = unionSourceCheck(tls, pTab, pzErr)
 31659  			}
 31660  		}
 31661  
 31662  		// Compose a CREATE TABLE statement and pass it to declare_vtab()
 31663  		if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK {
 31664  			var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc)
 31665  			var tdb uintptr = func() uintptr {
 31666  				if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31667  					return (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb
 31668  				}
 31669  				return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 31670  			}()
 31671  			pStmt = unionPreparePrintf(tls, bp+40 /* &rc */, pzErr, tdb,
 31672  
 31673  				ts+8541, /* "SELECT 'CREATE T..." */
 31674  				libc.VaList(bp+24, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab, (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb))
 31675  		}
 31676  		if (*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) == SQLITE_OK) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, pStmt)) {
 31677  			var zDecl uintptr = sqlite3.Xsqlite3_column_text(tls, pStmt, 0)
 31678  			*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = sqlite3.Xsqlite3_declare_vtab(tls, db, zDecl)
 31679  			(*UnionTab)(unsafe.Pointer(pTab)).FiPK = sqlite3.Xsqlite3_column_int(tls, pStmt, 1)
 31680  		}
 31681  
 31682  		unionFinalize(tls, bp+40 /* &rc */, pStmt, pzErr)
 31683  	}
 31684  
 31685  	if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != SQLITE_OK {
 31686  		unionDisconnect(tls, pTab)
 31687  		pTab = uintptr(0)
 31688  	}
 31689  
 31690  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pTab
 31691  	return *(*int32)(unsafe.Pointer(bp + 40 /* rc */))
 31692  }
 31693  
 31694  // xOpen
 31695  func unionOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* unionvtab.c:1033:12: */
 31696  	bp := tls.Alloc(4)
 31697  	defer tls.Free(4)
 31698  
 31699  	var pCsr uintptr
 31700  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 31701  	_ = p // Suppress harmless warning
 31702  	pCsr = unionMalloc(tls, bp /* &rc */, int64(unsafe.Sizeof(UnionCsr{})))
 31703  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCsr /* &.base */)
 31704  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 31705  }
 31706  
 31707  // xClose
 31708  func unionClose(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1045:12: */
 31709  	var pCsr uintptr = cur
 31710  	unionFinalizeCsrStmt(tls, pCsr)
 31711  	sqlite3.Xsqlite3_free(tls, pCsr)
 31712  	return SQLITE_OK
 31713  }
 31714  
 31715  // This function does the work of the xNext() method. Except that, if it
 31716  // returns SQLITE_ROW, it should be called again within the same xNext()
 31717  // method call. See unionNext() for details.
 31718  func doUnionNext(tls *libc.TLS, pCsr uintptr) int32 { /* unionvtab.c:1057:12: */
 31719  	bp := tls.Alloc(28)
 31720  	defer tls.Free(28)
 31721  
 31722  	*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_OK
 31723  
 31724  	if sqlite3.Xsqlite3_step(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt) != SQLITE_ROW {
 31725  		var pTab uintptr = (*UnionCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 31726  		*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = unionFinalizeCsrStmt(tls, pCsr)
 31727  		if (*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK) && ((*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0) {
 31728  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiTab++
 31729  			if (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc {
 31730  				var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*48)
 31731  				if (*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid >= (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin {
 31732  					// It is necessary to scan the next table.
 31733  					*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = unionOpenDatabase(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 31734  					(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = unionPreparePrintf(tls, bp+24 /* &rc */, (pTab /* &.base */ + 8 /* &.zErrMsg */), (*UnionSrc)(unsafe.Pointer(pSrc)).Fdb,
 31735  						ts+8719, /* "SELECT rowid, * ..." */
 31736  						libc.VaList(bp, (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab,
 31737  							func() uintptr {
 31738  								if (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax > (*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid {
 31739  									return ts + 8751 /* "WHERE _rowid_ <=" */
 31740  								}
 31741  								return ts + 8768 /* "-- " */
 31742  							}(),
 31743  							(*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid))
 31744  					if *(*int32)(unsafe.Pointer(bp + 24 /* rc */)) == SQLITE_OK {
 31745  
 31746  						unionIncrRefcount(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)
 31747  						*(*int32)(unsafe.Pointer(bp + 24 /* rc */)) = SQLITE_ROW
 31748  					}
 31749  				}
 31750  			}
 31751  		}
 31752  	}
 31753  
 31754  	return *(*int32)(unsafe.Pointer(bp + 24 /* rc */))
 31755  }
 31756  
 31757  // xNext
 31758  func unionNext(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1092:12: */
 31759  	var rc int32
 31760  	for ok := true; ok; ok = (rc == SQLITE_ROW) {
 31761  		rc = doUnionNext(tls, cur)
 31762  	}
 31763  	return rc
 31764  }
 31765  
 31766  // xColumn
 31767  func unionColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* unionvtab.c:1103:12: */
 31768  	var pCsr uintptr = cur
 31769  	sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt, (i+1)))
 31770  	return SQLITE_OK
 31771  }
 31772  
 31773  // xRowid
 31774  func unionRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* unionvtab.c:1116:12: */
 31775  	var pCsr uintptr = cur
 31776  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt, 0)
 31777  	return SQLITE_OK
 31778  }
 31779  
 31780  // xEof
 31781  func unionEof(tls *libc.TLS, cur uintptr) int32 { /* unionvtab.c:1125:12: */
 31782  	var pCsr uintptr = cur
 31783  	return (libc.Bool32((*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 31784  }
 31785  
 31786  // xFilter
 31787  func unionFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* unionvtab.c:1133:12: */
 31788  	bp := tls.Alloc(108)
 31789  	defer tls.Free(108)
 31790  
 31791  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 31792  	var pCsr uintptr = pVtabCursor
 31793  	*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_OK
 31794  	var i int32
 31795  	var zSql uintptr = uintptr(0)
 31796  	var bZero int32 = 0
 31797  
 31798  	var iMin sqlite3_int64 = ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))
 31799  	var iMax sqlite3_int64 = (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))
 31800  
 31801  	_ = idxStr // Suppress harmless warning
 31802  
 31803  	if idxNum == SQLITE_INDEX_CONSTRAINT_EQ {
 31804  
 31805  		iMin = libc.AssignInt64(&iMax, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 31806  	} else {
 31807  
 31808  		if (idxNum & (SQLITE_INDEX_CONSTRAINT_LE | SQLITE_INDEX_CONSTRAINT_LT)) != 0 {
 31809  
 31810  			iMax = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 31811  			if (idxNum & SQLITE_INDEX_CONSTRAINT_LT) != 0 {
 31812  				if iMax == ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) {
 31813  					bZero = 1
 31814  				} else {
 31815  					iMax--
 31816  				}
 31817  			}
 31818  		}
 31819  
 31820  		if (idxNum & (SQLITE_INDEX_CONSTRAINT_GE | SQLITE_INDEX_CONSTRAINT_GT)) != 0 {
 31821  
 31822  			iMin = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr((argc-1))*4)))
 31823  			if (idxNum & SQLITE_INDEX_CONSTRAINT_GT) != 0 {
 31824  				if iMin == (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)) {
 31825  					bZero = 1
 31826  				} else {
 31827  					iMin++
 31828  				}
 31829  			}
 31830  		}
 31831  	}
 31832  
 31833  	unionFinalizeCsrStmt(tls, pCsr)
 31834  	if bZero != 0 {
 31835  		return SQLITE_OK
 31836  	}
 31837  
 31838  	for i = 0; i < (*UnionTab)(unsafe.Pointer(pTab)).FnSrc; i++ {
 31839  		var pSrc uintptr = ((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr(i)*48)
 31840  		if (iMin > (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax) || (iMax < (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin) {
 31841  			continue
 31842  		}
 31843  
 31844  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8772 /* "%z%sSELECT rowid..." */, libc.VaList(bp, zSql, func() uintptr {
 31845  			if zSql != 0 {
 31846  				return ts + 8806 /* " UNION ALL " */
 31847  			}
 31848  			return ts + 489 /* "" */
 31849  		}(), func() uintptr {
 31850  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 31851  				return ts + 5485 /* "'" */
 31852  			}
 31853  			return ts + 489 /* "" */
 31854  		}(), func() uintptr {
 31855  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 31856  				return (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb
 31857  			}
 31858  			return ts + 489 /* "" */
 31859  		}(), func() uintptr {
 31860  			if (*UnionSrc)(unsafe.Pointer(pSrc)).FzDb != 0 {
 31861  				return ts + 5487 /* "'." */
 31862  			}
 31863  			return ts + 489 /* "" */
 31864  		}(), (*UnionSrc)(unsafe.Pointer(pSrc)).FzTab))
 31865  		if zSql == uintptr(0) {
 31866  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = SQLITE_NOMEM
 31867  			break
 31868  		}
 31869  
 31870  		if iMin == iMax {
 31871  			zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8818 /* "%z WHERE rowid=%..." */, libc.VaList(bp+48, zSql, iMin))
 31872  		} else {
 31873  			var zWhere uintptr = ts + 8838 /* "WHERE" */
 31874  			if (iMin != ((int64(-1)) - (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32)))) && (iMin > (*UnionSrc)(unsafe.Pointer(pSrc)).FiMin) {
 31875  				zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8844 /* "%z WHERE rowid>=..." */, libc.VaList(bp+64, zSql, iMin))
 31876  				zWhere = ts + 8865 /* "AND" */
 31877  			}
 31878  			if (iMax != (int64(0xffffffff) | (sqlite3_int64((int64(0x7fffffff))) << 32))) && (iMax < (*UnionSrc)(unsafe.Pointer(pSrc)).FiMax) {
 31879  				zSql = sqlite3.Xsqlite3_mprintf(tls, ts+8869 /* "%z %s rowid<=%ll..." */, libc.VaList(bp+80, zSql, zWhere, iMax))
 31880  			}
 31881  		}
 31882  
 31883  		if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31884  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiTab = i
 31885  			(*UnionCsr)(unsafe.Pointer(pCsr)).FiMaxRowid = iMax
 31886  			*(*int32)(unsafe.Pointer(bp + 104 /* rc */)) = unionOpenDatabase(tls, pTab, i, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 31887  			break
 31888  		}
 31889  	}
 31890  
 31891  	if zSql == uintptr(0) {
 31892  		return *(*int32)(unsafe.Pointer(bp + 104 /* rc */))
 31893  	} else {
 31894  		var db uintptr = func() uintptr {
 31895  			if (*UnionTab)(unsafe.Pointer(pTab)).FbSwarm != 0 {
 31896  				return (*UnionSrc)(unsafe.Pointer(((*UnionTab)(unsafe.Pointer(pTab)).FaSrc + uintptr((*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)*48))).Fdb
 31897  			}
 31898  			return (*UnionTab)(unsafe.Pointer(pTab)).Fdb
 31899  		}()
 31900  		(*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt = unionPrepare(tls, bp+104 /* &rc */, db, zSql, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 31901  		if (*UnionCsr)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 31902  			unionIncrRefcount(tls, pTab, (*UnionCsr)(unsafe.Pointer(pCsr)).FiTab)
 31903  		}
 31904  		sqlite3.Xsqlite3_free(tls, zSql)
 31905  	}
 31906  	if *(*int32)(unsafe.Pointer(bp + 104 /* rc */)) != SQLITE_OK {
 31907  		return *(*int32)(unsafe.Pointer(bp + 104 /* rc */))
 31908  	}
 31909  	return unionNext(tls, pVtabCursor)
 31910  }
 31911  
 31912  // xBestIndex.
 31913  //
 31914  // This implementation searches for constraints on the rowid field. EQ,
 31915  // LE, LT, GE and GT are handled.
 31916  //
 31917  // If there is an EQ comparison, then idxNum is set to INDEX_CONSTRAINT_EQ.
 31918  // In this case the only argument passed to xFilter is the rhs of the ==
 31919  // operator.
 31920  //
 31921  // Otherwise, if an LE or LT constraint is found, then the INDEX_CONSTRAINT_LE
 31922  // or INDEX_CONSTRAINT_LT (but not both) bit is set in idxNum. The first
 31923  // argument to xFilter is the rhs of the <= or < operator.  Similarly, if
 31924  // an GE or GT constraint is found, then the INDEX_CONSTRAINT_GE or
 31925  // INDEX_CONSTRAINT_GT bit is set in idxNum. The rhs of the >= or > operator
 31926  // is passed as either the first or second argument to xFilter, depending
 31927  // on whether or not there is also a LT|LE constraint.
 31928  func unionBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* unionvtab.c:1266:12: */
 31929  	var pTab uintptr = tab
 31930  	var iEq int32 = -1
 31931  	var iLt int32 = -1
 31932  	var iGt int32 = -1
 31933  	var i int32
 31934  
 31935  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 31936  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 31937  		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)) {
 31938  			switch int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) {
 31939  			case SQLITE_INDEX_CONSTRAINT_EQ:
 31940  				iEq = i
 31941  				break
 31942  				fallthrough
 31943  			case SQLITE_INDEX_CONSTRAINT_LE:
 31944  				fallthrough
 31945  			case SQLITE_INDEX_CONSTRAINT_LT:
 31946  				iLt = i
 31947  				break
 31948  				fallthrough
 31949  			case SQLITE_INDEX_CONSTRAINT_GE:
 31950  				fallthrough
 31951  			case SQLITE_INDEX_CONSTRAINT_GT:
 31952  				iGt = i
 31953  				break
 31954  			}
 31955  		}
 31956  	}
 31957  
 31958  	if iEq >= 0 {
 31959  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = int64(1)
 31960  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxFlags = SQLITE_INDEX_SCAN_UNIQUE
 31961  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 3.0
 31962  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = SQLITE_INDEX_CONSTRAINT_EQ
 31963  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iEq)*8)).FargvIndex = 1
 31964  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iEq)*8)).Fomit = uint8(1)
 31965  	} else {
 31966  		var iCons int32 = 1
 31967  		var idxNum int32 = 0
 31968  		var nRow sqlite3_int64 = int64(1000000)
 31969  		if iLt >= 0 {
 31970  			nRow = (nRow / int64(2))
 31971  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLt)*8)).FargvIndex = libc.PostIncInt32(&iCons, 1)
 31972  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iLt)*8)).Fomit = uint8(1)
 31973  			idxNum = idxNum | (int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iLt)*12)).Fop))
 31974  		}
 31975  		if iGt >= 0 {
 31976  			nRow = (nRow / int64(2))
 31977  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iGt)*8)).FargvIndex = libc.PostIncInt32(&iCons, 1)
 31978  			(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(iGt)*8)).Fomit = uint8(1)
 31979  			idxNum = idxNum | (int32((*sqlite3_index_constraint)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(iGt)*12)).Fop))
 31980  		}
 31981  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = nRow
 31982  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = (3.0 * float64(nRow))
 31983  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 31984  	}
 31985  
 31986  	return SQLITE_OK
 31987  }
 31988  
 31989  // Register the unionvtab virtual table module with database handle db.
 31990  func createUnionVtab(tls *libc.TLS, db uintptr) int32 { /* unionvtab.c:1329:12: */
 31991  	var rc int32
 31992  
 31993  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8367 /* "unionvtab" */, uintptr(unsafe.Pointer(&unionModule)), uintptr(0))
 31994  	if rc == SQLITE_OK {
 31995  		rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8357 /* "swarmvtab" */, uintptr(unsafe.Pointer(&unionModule)), db)
 31996  	}
 31997  	return rc
 31998  }
 31999  
 32000  var unionModule = sqlite3_module{ // iVersion
 32001  	FxCreate:     0,
 32002  	FxConnect:    0,
 32003  	FxBestIndex:  0, // xBestIndex - query planner
 32004  	FxDisconnect: 0,
 32005  	FxDestroy:    0,
 32006  	FxOpen:       0, // xOpen - open a cursor
 32007  	FxClose:      0, // xClose - close a cursor
 32008  	FxFilter:     0, // xFilter - configure scan constraints
 32009  	FxNext:       0, // xNext - advance a cursor
 32010  	FxEof:        0, // xEof - check for end of scan
 32011  	FxColumn:     0, // xColumn - read data
 32012  	FxRowid:      0, // xShadowName
 32013  } /* unionvtab.c:1330:25 */
 32014  
 32015  func sqlite3_unionvtab_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* unionvtab.c:1370:5: */
 32016  	var rc int32 = SQLITE_OK
 32017  	_ = pApi
 32018  
 32019  	_ = pzErrMsg // Suppress harmless warning
 32020  	rc = createUnionVtab(tls, db)
 32021  	return rc
 32022  }
 32023  
 32024  // A wholenumber cursor object
 32025  type wholenumber_cursor1 = struct {
 32026  	Fbase    sqlite3_vtab_cursor
 32027  	_        [4]byte
 32028  	FiValue  sqlite3_int64
 32029  	FmxValue sqlite3_int64
 32030  } /* wholenumber.c:34:9 */
 32031  
 32032  // A wholenumber cursor object
 32033  type wholenumber_cursor = wholenumber_cursor1 /* wholenumber.c:34:35 */
 32034  
 32035  // Methods for the wholenumber module
 32036  func wholenumberConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* wholenumber.c:42:12: */
 32037  	var pNew uintptr
 32038  	pNew = libc.AssignPtrUintptr(ppVtab, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(sqlite3_vtab{}))))
 32039  	if pNew == uintptr(0) {
 32040  		return SQLITE_NOMEM
 32041  	}
 32042  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+8887 /* "CREATE TABLE x(v..." */)
 32043  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_INNOCUOUS, 0)
 32044  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(sqlite3_vtab{})))
 32045  	return SQLITE_OK
 32046  }
 32047  
 32048  // Note that for this virtual table, the xCreate and xConnect
 32049  // methods are identical.
 32050  
 32051  func wholenumberDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* wholenumber.c:60:12: */
 32052  	sqlite3.Xsqlite3_free(tls, pVtab)
 32053  	return SQLITE_OK
 32054  }
 32055  
 32056  // The xDisconnect and xDestroy methods are also the same
 32057  
 32058  // Open a new wholenumber cursor.
 32059  func wholenumberOpen(tls *libc.TLS, p uintptr, ppCursor uintptr) int32 { /* wholenumber.c:70:12: */
 32060  	var pCur uintptr
 32061  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(wholenumber_cursor{})))
 32062  	if pCur == uintptr(0) {
 32063  		return SQLITE_NOMEM
 32064  	}
 32065  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(wholenumber_cursor{})))
 32066  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 32067  	return SQLITE_OK
 32068  }
 32069  
 32070  // Close a wholenumber cursor.
 32071  func wholenumberClose(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:82:12: */
 32072  	sqlite3.Xsqlite3_free(tls, cur)
 32073  	return SQLITE_OK
 32074  }
 32075  
 32076  // Advance a cursor to its next row of output
 32077  func wholenumberNext(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:91:12: */
 32078  	var pCur uintptr = cur
 32079  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue++
 32080  	return SQLITE_OK
 32081  }
 32082  
 32083  // Return the value associated with a wholenumber.
 32084  func wholenumberColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* wholenumber.c:100:12: */
 32085  	var pCur uintptr = cur
 32086  	sqlite3.Xsqlite3_result_int64(tls, ctx, (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue)
 32087  	return SQLITE_OK
 32088  }
 32089  
 32090  // The rowid.
 32091  func wholenumberRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* wholenumber.c:113:12: */
 32092  	var pCur uintptr = cur
 32093  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue
 32094  	return SQLITE_OK
 32095  }
 32096  
 32097  // When the wholenumber_cursor.rLimit value is 0 or less, that is a signal
 32098  // that the cursor has nothing more to output.
 32099  func wholenumberEof(tls *libc.TLS, cur uintptr) int32 { /* wholenumber.c:123:12: */
 32100  	var pCur uintptr = cur
 32101  	return (libc.Bool32(((*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue > (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) || ((*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue == int64(0))))
 32102  }
 32103  
 32104  // Called to "rewind" a cursor back to the beginning so that
 32105  // it starts its output over again.  Always called at least once
 32106  // prior to any wholenumberColumn, wholenumberRowid, or wholenumberEof call.
 32107  //
 32108  //    idxNum   Constraints
 32109  //    ------   ---------------------
 32110  //      0      (none)
 32111  //      1      value > $argv0
 32112  //      2      value >= $argv0
 32113  //      4      value < $argv0
 32114  //      8      value <= $argv0
 32115  //
 32116  //      5      value > $argv0 AND value < $argv1
 32117  //      6      value >= $argv0 AND value < $argv1
 32118  //      9      value > $argv0 AND value <= $argv1
 32119  //     10      value >= $argv0 AND value <= $argv1
 32120  func wholenumberFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* wholenumber.c:146:12: */
 32121  	var pCur uintptr = pVtabCursor
 32122  	var v sqlite3_int64
 32123  	var i int32 = 0
 32124  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue = int64(1)
 32125  	(*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue = int64(0xffffffff) // 4294967295
 32126  	if (idxNum & 3) != 0 {
 32127  		v = (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))) + (sqlite3_int64(idxNum & 1)))
 32128  		if (v > (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue) && (v <= (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) {
 32129  			(*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue = v
 32130  		}
 32131  		i++
 32132  	}
 32133  	if (idxNum & 12) != 0 {
 32134  		v = (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) - (sqlite3_int64((idxNum >> 2) & 1)))
 32135  		if (v >= (*wholenumber_cursor)(unsafe.Pointer(pCur)).FiValue) && (v < (*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue) {
 32136  			(*wholenumber_cursor)(unsafe.Pointer(pCur)).FmxValue = v
 32137  		}
 32138  	}
 32139  	return SQLITE_OK
 32140  }
 32141  
 32142  // Search for terms of these forms:
 32143  //
 32144  //  (1)  value > $value
 32145  //  (2)  value >= $value
 32146  //  (4)  value < $value
 32147  //  (8)  value <= $value
 32148  //
 32149  // idxNum is an ORed combination of 1 or 2 with 4 or 8.
 32150  func wholenumberBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* wholenumber.c:178:12: */
 32151  	var i int32
 32152  	var idxNum int32 = 0
 32153  	var argvIdx int32 = 1
 32154  	var ltIdx int32 = -1
 32155  	var gtIdx int32 = -1
 32156  	var pConstraint uintptr
 32157  	pConstraint = (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint
 32158  	i = 0
 32159  __1:
 32160  	if !(i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 32161  		goto __3
 32162  	}
 32163  	{
 32164  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) == 0 {
 32165  			goto __2
 32166  		}
 32167  		if ((idxNum & 3) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_GT) {
 32168  			idxNum = idxNum | (1)
 32169  			ltIdx = i
 32170  		}
 32171  		if ((idxNum & 3) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_GE) {
 32172  			idxNum = idxNum | (2)
 32173  			ltIdx = i
 32174  		}
 32175  		if ((idxNum & 12) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LT) {
 32176  			idxNum = idxNum | (4)
 32177  			gtIdx = i
 32178  		}
 32179  		if ((idxNum & 12) == 0) && (int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) == SQLITE_INDEX_CONSTRAINT_LE) {
 32180  			idxNum = idxNum | (8)
 32181  			gtIdx = i
 32182  		}
 32183  
 32184  	}
 32185  	goto __2
 32186  __2:
 32187  	i++
 32188  	pConstraint += 12
 32189  	goto __1
 32190  	goto __3
 32191  __3:
 32192  	;
 32193  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = idxNum
 32194  	if ltIdx >= 0 {
 32195  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ltIdx)*8)).FargvIndex = libc.PostIncInt32(&argvIdx, 1)
 32196  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ltIdx)*8)).Fomit = uint8(1)
 32197  	}
 32198  	if gtIdx >= 0 {
 32199  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(gtIdx)*8)).FargvIndex = argvIdx
 32200  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(gtIdx)*8)).Fomit = uint8(1)
 32201  	}
 32202  	if ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy == 1) &&
 32203  		(int32((*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc) == 0) {
 32204  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 32205  	}
 32206  	if (idxNum & 12) == 0 {
 32207  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1e99
 32208  	} else if (idxNum & 3) == 0 {
 32209  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(5)
 32210  	} else {
 32211  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(1)
 32212  	}
 32213  	return SQLITE_OK
 32214  }
 32215  
 32216  // A virtual table module that provides read-only access to a
 32217  // Tcl global variable namespace.
 32218  var wholenumberModule = sqlite3_module{ // iVersion
 32219  	FxCreate:     0,
 32220  	FxConnect:    0,
 32221  	FxBestIndex:  0,
 32222  	FxDisconnect: 0,
 32223  	FxDestroy:    0,
 32224  	FxOpen:       0, // xOpen - open a cursor
 32225  	FxClose:      0, // xClose - close a cursor
 32226  	FxFilter:     0, // xFilter - configure scan constraints
 32227  	FxNext:       0, // xNext - advance a cursor
 32228  	FxEof:        0, // xEof - check for end of scan
 32229  	FxColumn:     0, // xColumn - read data
 32230  	FxRowid:      0, // xRename
 32231  } /* wholenumber.c:236:23 */
 32232  
 32233  func sqlite3_wholenumber_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* wholenumber.c:264:5: */
 32234  	var rc int32 = SQLITE_OK
 32235  	_ = pApi
 32236  
 32237  	rc = sqlite3.Xsqlite3_create_module(tls, db, ts+8909 /* "wholenumber" */, uintptr(unsafe.Pointer(&wholenumberModule)), uintptr(0))
 32238  	return rc
 32239  }
 32240  
 32241  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 32242  //     are already defined.
 32243  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 32244  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 32245  
 32246  // A null pointer constant.
 32247  
 32248  // Offset of member MEMBER in a struct of type TYPE.
 32249  
 32250  // Type whose alignment is supported in every context and is at least
 32251  //    as great as that of any standard type not using alignment
 32252  //    specifiers.
 32253  type max_align_t = struct {
 32254  	F__max_align_ll int64
 32255  	F__max_align_ld float64
 32256  } /* stddef.h:437:3 */
 32257  
 32258  type z_size_t = size_t /* zconf.h:248:21 */
 32259  
 32260  // Maximum value for memLevel in deflateInit2
 32261  
 32262  // Maximum value for windowBits in deflateInit2 and inflateInit2.
 32263  // WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 32264  // created by gzip. (Files created by minigzip can still be extracted by
 32265  // gzip.)
 32266  
 32267  // The memory requirements for deflate are (in bytes):
 32268  //             (1 << (windowBits+2)) +  (1 << (memLevel+9))
 32269  //  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 32270  //  plus a few kilobytes for small objects. For example, if you want to reduce
 32271  //  the default memory requirements from 256K to 128K, compile with
 32272  //      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 32273  //  Of course this will generally degrade compression (there's no free lunch).
 32274  //
 32275  //    The memory requirements for inflate are (in bytes) 1 << windowBits
 32276  //  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
 32277  //  for small objects.
 32278  
 32279  // Type declarations
 32280  
 32281  // The following definitions for FAR are needed only for MSDOS mixed
 32282  // model programming (small or medium model with some far allocations).
 32283  // This was tested only with MSC; for other MSDOS compilers you may have
 32284  // to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 32285  // just define FAR to be empty.
 32286  
 32287  type Byte = uint8   /* zconf.h:391:24 */ // 8 bits
 32288  type uInt = uint32  /* zconf.h:393:24 */ // 16 bits or more
 32289  type uLong = uint32 /* zconf.h:394:24 */ // 32 bits or more
 32290  
 32291  type Bytef = Byte   /* zconf.h:400:22 */
 32292  type charf = int8   /* zconf.h:402:19 */
 32293  type intf = int32   /* zconf.h:403:19 */
 32294  type uIntf = uInt   /* zconf.h:404:19 */
 32295  type uLongf = uLong /* zconf.h:405:19 */
 32296  
 32297  type voidpc = uintptr /* zconf.h:408:23 */
 32298  type voidpf = uintptr /* zconf.h:409:23 */
 32299  type voidp = uintptr  /* zconf.h:410:23 */
 32300  
 32301  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
 32302  //
 32303  // This file is part of GCC.
 32304  //
 32305  // GCC is free software; you can redistribute it and/or modify it under
 32306  // the terms of the GNU General Public License as published by the Free
 32307  // Software Foundation; either version 3, or (at your option) any later
 32308  // version.
 32309  //
 32310  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
 32311  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
 32312  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 32313  // for more details.
 32314  //
 32315  // Under Section 7 of GPL version 3, you are granted additional
 32316  // permissions described in the GCC Runtime Library Exception, version
 32317  // 3.1, as published by the Free Software Foundation.
 32318  //
 32319  // You should have received a copy of the GNU General Public License and
 32320  // a copy of the GCC Runtime Library Exception along with this program;
 32321  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 32322  // <http://www.gnu.org/licenses/>.
 32323  
 32324  // This administrivia gets added to the beginning of limits.h
 32325  //    if the system has its own version of limits.h.
 32326  
 32327  // We use _GCC_LIMITS_H_ because we want this not to match
 32328  //    any macros that the system's limits.h uses for its own purposes.
 32329  
 32330  // Use "..." so that we find syslimits.h only in this same directory.
 32331  // syslimits.h stands for the system's own limits.h file.
 32332  //    If we can use it ok unmodified, then we install this text.
 32333  //    If fixincludes fixes it, then the fixed version is installed
 32334  //    instead of this text.
 32335  
 32336  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 32337  //    This file is part of the GNU C Library.
 32338  //
 32339  //    The GNU C Library is free software; you can redistribute it and/or
 32340  //    modify it under the terms of the GNU Lesser General Public
 32341  //    License as published by the Free Software Foundation; either
 32342  //    version 2.1 of the License, or (at your option) any later version.
 32343  //
 32344  //    The GNU C Library is distributed in the hope that it will be useful,
 32345  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32346  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32347  //    Lesser General Public License for more details.
 32348  //
 32349  //    You should have received a copy of the GNU Lesser General Public
 32350  //    License along with the GNU C Library; if not, see
 32351  //    <http://www.gnu.org/licenses/>.
 32352  
 32353  //	ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types	<limits.h>
 32354  
 32355  // Handle feature test macros at the start of a header.
 32356  //    Copyright (C) 2016-2018 Free Software Foundation, Inc.
 32357  //    This file is part of the GNU C Library.
 32358  //
 32359  //    The GNU C Library is free software; you can redistribute it and/or
 32360  //    modify it under the terms of the GNU Lesser General Public
 32361  //    License as published by the Free Software Foundation; either
 32362  //    version 2.1 of the License, or (at your option) any later version.
 32363  //
 32364  //    The GNU C Library is distributed in the hope that it will be useful,
 32365  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32366  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32367  //    Lesser General Public License for more details.
 32368  //
 32369  //    You should have received a copy of the GNU Lesser General Public
 32370  //    License along with the GNU C Library; if not, see
 32371  //    <http://www.gnu.org/licenses/>.
 32372  
 32373  // This header is internal to glibc and should not be included outside
 32374  //    of glibc headers.  Headers including it must define
 32375  //    __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first.  This header
 32376  //    cannot have multiple include guards because ISO C feature test
 32377  //    macros depend on the definition of the macro when an affected
 32378  //    header is included, not when the first system header is
 32379  //    included.
 32380  
 32381  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 32382  //    This file is part of the GNU C Library.
 32383  //
 32384  //    The GNU C Library is free software; you can redistribute it and/or
 32385  //    modify it under the terms of the GNU Lesser General Public
 32386  //    License as published by the Free Software Foundation; either
 32387  //    version 2.1 of the License, or (at your option) any later version.
 32388  //
 32389  //    The GNU C Library is distributed in the hope that it will be useful,
 32390  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32391  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32392  //    Lesser General Public License for more details.
 32393  //
 32394  //    You should have received a copy of the GNU Lesser General Public
 32395  //    License along with the GNU C Library; if not, see
 32396  //    <http://www.gnu.org/licenses/>.
 32397  
 32398  // ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__
 32399  //    macro.
 32400  
 32401  // ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
 32402  //    macro.
 32403  
 32404  // ISO/IEC TS 18661-4:2015 defines the
 32405  //    __STDC_WANT_IEC_60559_FUNCS_EXT__ macro.
 32406  
 32407  // ISO/IEC TS 18661-3:2015 defines the
 32408  //    __STDC_WANT_IEC_60559_TYPES_EXT__ macro.
 32409  
 32410  // Maximum length of any multibyte character in any locale.
 32411  //    We define this value here since the gcc header does not define
 32412  //    the correct value.
 32413  
 32414  // If we are not using GNU CC we have to define all the symbols ourself.
 32415  //    Otherwise use gcc's definitions (see below).
 32416  
 32417  // Get the compiler's limits.h, which defines almost all the ISO constants.
 32418  //
 32419  //     We put this #include_next outside the double inclusion check because
 32420  //     it should be possible to include this file more than once and still get
 32421  //     the definitions from gcc's header.
 32422  
 32423  // The <limits.h> files in some gcc versions don't define LLONG_MIN,
 32424  //    LLONG_MAX, and ULLONG_MAX.  Instead only the values gcc defined for
 32425  //    ages are available.
 32426  
 32427  // The integer width macros are not defined by GCC's <limits.h> before
 32428  //    GCC 7, or if _GNU_SOURCE rather than
 32429  //    __STDC_WANT_IEC_60559_BFP_EXT__ is used to enable this feature.
 32430  
 32431  // POSIX adds things to <limits.h>.
 32432  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 32433  //    This file is part of the GNU C Library.
 32434  //
 32435  //    The GNU C Library is free software; you can redistribute it and/or
 32436  //    modify it under the terms of the GNU Lesser General Public
 32437  //    License as published by the Free Software Foundation; either
 32438  //    version 2.1 of the License, or (at your option) any later version.
 32439  //
 32440  //    The GNU C Library is distributed in the hope that it will be useful,
 32441  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32442  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32443  //    Lesser General Public License for more details.
 32444  //
 32445  //    You should have received a copy of the GNU Lesser General Public
 32446  //    License along with the GNU C Library; if not, see
 32447  //    <http://www.gnu.org/licenses/>.
 32448  
 32449  //	POSIX Standard: 2.9.2 Minimum Values	Added to <limits.h>
 32450  //
 32451  //	Never include this file directly; use <limits.h> instead.
 32452  
 32453  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 32454  //    This file is part of the GNU C Library.
 32455  //
 32456  //    The GNU C Library is free software; you can redistribute it and/or
 32457  //    modify it under the terms of the GNU Lesser General Public
 32458  //    License as published by the Free Software Foundation; either
 32459  //    version 2.1 of the License, or (at your option) any later version.
 32460  //
 32461  //    The GNU C Library is distributed in the hope that it will be useful,
 32462  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32463  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32464  //    Lesser General Public License for more details.
 32465  //
 32466  //    You should have received a copy of the GNU Lesser General Public
 32467  //    License along with the GNU C Library; if not, see
 32468  //    <http://www.gnu.org/licenses/>.
 32469  
 32470  // These are the standard-mandated minimum values.
 32471  
 32472  // Minimum number of operations in one list I/O call.
 32473  
 32474  // Minimal number of outstanding asynchronous I/O operations.
 32475  
 32476  // Maximum length of arguments to `execve', including environment.
 32477  
 32478  // Maximum simultaneous processes per real user ID.
 32479  
 32480  // Minimal number of timer expiration overruns.
 32481  
 32482  // Maximum length of a host name (not including the terminating null)
 32483  //    as returned from the GETHOSTNAME function.
 32484  
 32485  // Maximum link count of a file.
 32486  
 32487  // Maximum length of login name.
 32488  
 32489  // Number of bytes in a terminal canonical input queue.
 32490  
 32491  // Number of bytes for which space will be
 32492  //    available in a terminal input queue.
 32493  
 32494  // Maximum number of message queues open for a process.
 32495  
 32496  // Maximum number of supported message priorities.
 32497  
 32498  // Number of bytes in a filename.
 32499  
 32500  // Number of simultaneous supplementary group IDs per process.
 32501  
 32502  // Number of files one process can have open at once.
 32503  
 32504  // Number of bytes in a pathname.
 32505  
 32506  // Number of bytes than can be written atomically to a pipe.
 32507  
 32508  // The number of repeated occurrences of a BRE permitted by the
 32509  //    REGEXEC and REGCOMP functions when using the interval notation.
 32510  
 32511  // Minimal number of realtime signals reserved for the application.
 32512  
 32513  // Number of semaphores a process can have.
 32514  
 32515  // Maximal value of a semaphore.
 32516  
 32517  // Number of pending realtime signals.
 32518  
 32519  // Largest value of a `ssize_t'.
 32520  
 32521  // Number of streams a process can have open at once.
 32522  
 32523  // The number of bytes in a symbolic link.
 32524  
 32525  // The number of symbolic links that can be traversed in the
 32526  //    resolution of a pathname in the absence of a loop.
 32527  
 32528  // Number of timer for a process.
 32529  
 32530  // Maximum number of characters in a tty name.
 32531  
 32532  // Maximum length of a timezone name (element of `tzname').
 32533  
 32534  // Maximum clock resolution in nanoseconds.
 32535  
 32536  // Get the implementation-specific values for the above.
 32537  // Minimum guaranteed maximum values for system limits.  Linux version.
 32538  //    Copyright (C) 1993-2018 Free Software Foundation, Inc.
 32539  //    This file is part of the GNU C Library.
 32540  //
 32541  //    The GNU C Library is free software; you can redistribute it and/or
 32542  //    modify it under the terms of the GNU Lesser General Public License as
 32543  //    published by the Free Software Foundation; either version 2.1 of the
 32544  //    License, or (at your option) any later version.
 32545  //
 32546  //    The GNU C Library is distributed in the hope that it will be useful,
 32547  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32548  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32549  //    Lesser General Public License for more details.
 32550  //
 32551  //    You should have received a copy of the GNU Lesser General Public
 32552  //    License along with the GNU C Library; see the file COPYING.LIB.  If
 32553  //    not, see <http://www.gnu.org/licenses/>.
 32554  
 32555  // The kernel header pollutes the namespace with the NR_OPEN symbol
 32556  //    and defines LINK_MAX although filesystems have different maxima.  A
 32557  //    similar thing is true for OPEN_MAX: the limit can be changed at
 32558  //    runtime and therefore the macro must not be defined.  Remove this
 32559  //    after including the header if necessary.
 32560  
 32561  // The kernel sources contain a file with all the needed information.
 32562  // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 32563  
 32564  // Have to remove NR_OPEN?
 32565  // Have to remove LINK_MAX?
 32566  // Have to remove OPEN_MAX?
 32567  // Have to remove ARG_MAX?
 32568  
 32569  // The number of data keys per process.
 32570  // This is the value this implementation supports.
 32571  
 32572  // Controlling the iterations of destructors for thread-specific data.
 32573  // Number of iterations this implementation does.
 32574  
 32575  // The number of threads per process.
 32576  // We have no predefined limit on the number of threads.
 32577  
 32578  // Maximum amount by which a process can descrease its asynchronous I/O
 32579  //    priority level.
 32580  
 32581  // Minimum size for a thread.  We are free to choose a reasonable value.
 32582  
 32583  // Maximum number of timer expiration overruns.
 32584  
 32585  // Maximum tty name length.
 32586  
 32587  // Maximum login name length.  This is arbitrary.
 32588  
 32589  // Maximum host name length.
 32590  
 32591  // Maximum message queue priority level.
 32592  
 32593  // Maximum value the semaphore can have.
 32594  
 32595  // ssize_t is not formally required to be the signed type
 32596  //    corresponding to size_t, but it is for all configurations supported
 32597  //    by glibc.
 32598  
 32599  // This value is a guaranteed minimum maximum.
 32600  //    The current maximum can be got from `sysconf'.
 32601  
 32602  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 32603  //    This file is part of the GNU C Library.
 32604  //
 32605  //    The GNU C Library is free software; you can redistribute it and/or
 32606  //    modify it under the terms of the GNU Lesser General Public
 32607  //    License as published by the Free Software Foundation; either
 32608  //    version 2.1 of the License, or (at your option) any later version.
 32609  //
 32610  //    The GNU C Library is distributed in the hope that it will be useful,
 32611  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 32612  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 32613  //    Lesser General Public License for more details.
 32614  //
 32615  //    You should have received a copy of the GNU Lesser General Public
 32616  //    License along with the GNU C Library; if not, see
 32617  //    <http://www.gnu.org/licenses/>.
 32618  
 32619  // Never include this file directly; include <limits.h> instead.
 32620  
 32621  // The maximum `ibase' and `obase' values allowed by the `bc' utility.
 32622  
 32623  // The maximum number of elements allowed in an array by the `bc' utility.
 32624  
 32625  // The maximum `scale' value allowed by the `bc' utility.
 32626  
 32627  // The maximum length of a string constant accepted by the `bc' utility.
 32628  
 32629  // The maximum number of weights that can be assigned to an entry of
 32630  //    the LC_COLLATE `order' keyword in the locale definition file.
 32631  
 32632  // The maximum number of expressions that can be nested
 32633  //    within parentheses by the `expr' utility.
 32634  
 32635  // The maximum length, in bytes, of an input line.
 32636  
 32637  // The maximum number of repeated occurrences of a regular expression
 32638  //    permitted when using the interval notation `\{M,N\}'.
 32639  
 32640  // The maximum number of bytes in a character class name.  We have no
 32641  //    fixed limit, 2048 is a high number.
 32642  
 32643  // These values are implementation-specific,
 32644  //    and may vary within the implementation.
 32645  //    Their precise values can be obtained from sysconf.
 32646  
 32647  // This value is defined like this in regex.h.
 32648  
 32649  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 32650  //
 32651  // This file is part of GCC.
 32652  //
 32653  // GCC is free software; you can redistribute it and/or modify it under
 32654  // the terms of the GNU General Public License as published by the Free
 32655  // Software Foundation; either version 3, or (at your option) any later
 32656  // version.
 32657  //
 32658  // GCC is distributed in the hope that it will be useful, but WITHOUT ANY
 32659  // WARRANTY; without even the implied warranty of MERCHANTABILITY or
 32660  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 32661  // for more details.
 32662  //
 32663  // Under Section 7 of GPL version 3, you are granted additional
 32664  // permissions described in the GCC Runtime Library Exception, version
 32665  // 3.1, as published by the Free Software Foundation.
 32666  //
 32667  // You should have received a copy of the GNU General Public License and
 32668  // a copy of the GCC Runtime Library Exception along with this program;
 32669  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 32670  // <http://www.gnu.org/licenses/>.
 32671  
 32672  // Number of bits in a `char'.
 32673  
 32674  // Maximum length of a multibyte character.
 32675  
 32676  // Minimum and maximum values a `signed char' can hold.
 32677  
 32678  // Maximum value an `unsigned char' can hold.  (Minimum is 0).
 32679  
 32680  // Minimum and maximum values a `char' can hold.
 32681  
 32682  // Minimum and maximum values a `signed short int' can hold.
 32683  
 32684  // Maximum value an `unsigned short int' can hold.  (Minimum is 0).
 32685  
 32686  // Minimum and maximum values a `signed int' can hold.
 32687  
 32688  // Maximum value an `unsigned int' can hold.  (Minimum is 0).
 32689  
 32690  // Minimum and maximum values a `signed long int' can hold.
 32691  //    (Same as `int').
 32692  
 32693  // Maximum value an `unsigned long int' can hold.  (Minimum is 0).
 32694  
 32695  // Minimum and maximum values a `signed long long int' can hold.
 32696  
 32697  // Maximum value an `unsigned long long int' can hold.  (Minimum is 0).
 32698  
 32699  // This administrivia gets added to the end of limits.h
 32700  //    if the system has its own version of limits.h.
 32701  
 32702  type z_crc_t = uint32 /* zconf.h:429:17 */
 32703  
 32704  // Define some macros helping to catch buffer overflows.
 32705  
 32706  // MVS linker does not support external names larger than 8 bytes
 32707  
 32708  //
 32709  //     The 'zlib' compression library provides in-memory compression and
 32710  //   decompression functions, including integrity checks of the uncompressed data.
 32711  //   This version of the library supports only one compression method (deflation)
 32712  //   but other algorithms will be added later and will have the same stream
 32713  //   interface.
 32714  //
 32715  //     Compression can be done in a single step if the buffers are large enough,
 32716  //   or can be done by repeated calls of the compression function.  In the latter
 32717  //   case, the application must provide more input and/or consume the output
 32718  //   (providing more output space) before each call.
 32719  //
 32720  //     The compressed data format used by default by the in-memory functions is
 32721  //   the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped
 32722  //   around a deflate stream, which is itself documented in RFC 1951.
 32723  //
 32724  //     The library also supports reading and writing files in gzip (.gz) format
 32725  //   with an interface similar to that of stdio using the functions that start
 32726  //   with "gz".  The gzip format is different from the zlib format.  gzip is a
 32727  //   gzip wrapper, documented in RFC 1952, wrapped around a deflate stream.
 32728  //
 32729  //     This library can optionally read and write gzip and raw deflate streams in
 32730  //   memory as well.
 32731  //
 32732  //     The zlib format was designed to be compact and fast for use in memory
 32733  //   and on communications channels.  The gzip format was designed for single-
 32734  //   file compression on file systems, has a larger header than zlib to maintain
 32735  //   directory information, and uses a different, slower check method than zlib.
 32736  //
 32737  //     The library does not install any signal handler.  The decoder checks
 32738  //   the consistency of the compressed data, so the library should never crash
 32739  //   even in the case of corrupted input.
 32740  
 32741  type alloc_func = uintptr /* zlib.h:81:16 */
 32742  type free_func = uintptr  /* zlib.h:82:16 */
 32743  
 32744  type z_stream_s = struct {
 32745  	Fnext_in   uintptr
 32746  	Favail_in  uInt
 32747  	Ftotal_in  uLong
 32748  	Fnext_out  uintptr
 32749  	Favail_out uInt
 32750  	Ftotal_out uLong
 32751  	Fmsg       uintptr
 32752  	Fstate     uintptr
 32753  	Fzalloc    alloc_func
 32754  	Fzfree     free_func
 32755  	Fopaque    voidpf
 32756  	Fdata_type int32
 32757  	Fadler     uLong
 32758  	Freserved  uLong
 32759  } /* zlib.h:86:9 */
 32760  
 32761  type z_stream = z_stream_s /* zlib.h:106:3 */
 32762  
 32763  type z_streamp = uintptr /* zlib.h:108:22 */
 32764  
 32765  //
 32766  //      gzip header information passed to and from zlib routines.  See RFC 1952
 32767  //   for more details on the meanings of these fields.
 32768  type gz_header_s = struct {
 32769  	Ftext      int32
 32770  	Ftime      uLong
 32771  	Fxflags    int32
 32772  	Fos        int32
 32773  	Fextra     uintptr
 32774  	Fextra_len uInt
 32775  	Fextra_max uInt
 32776  	Fname      uintptr
 32777  	Fname_max  uInt
 32778  	Fcomment   uintptr
 32779  	Fcomm_max  uInt
 32780  	Fhcrc      int32
 32781  	Fdone      int32
 32782  } /* zlib.h:114:9 */
 32783  
 32784  //
 32785  //      gzip header information passed to and from zlib routines.  See RFC 1952
 32786  //   for more details on the meanings of these fields.
 32787  type gz_header = gz_header_s /* zlib.h:129:3 */
 32788  
 32789  type gz_headerp = uintptr /* zlib.h:131:23 */
 32790  //
 32791  //      inflateGetHeader() requests that gzip header information be stored in the
 32792  //    provided gz_header structure.  inflateGetHeader() may be called after
 32793  //    inflateInit2() or inflateReset(), and before the first call of inflate().
 32794  //    As inflate() processes the gzip stream, head->done is zero until the header
 32795  //    is completed, at which time head->done is set to one.  If a zlib stream is
 32796  //    being decoded, then head->done is set to -1 to indicate that there will be
 32797  //    no gzip header information forthcoming.  Note that Z_BLOCK or Z_TREES can be
 32798  //    used to force inflate() to return immediately after header processing is
 32799  //    complete and before any actual data is decompressed.
 32800  //
 32801  //      The text, time, xflags, and os fields are filled in with the gzip header
 32802  //    contents.  hcrc is set to true if there is a header CRC.  (The header CRC
 32803  //    was valid if done is set to one.) If extra is not Z_NULL, then extra_max
 32804  //    contains the maximum number of bytes to write to extra.  Once done is true,
 32805  //    extra_len contains the actual extra field length, and extra contains the
 32806  //    extra field, or that field truncated if extra_max is less than extra_len.
 32807  //    If name is not Z_NULL, then up to name_max characters are written there,
 32808  //    terminated with a zero unless the length is greater than name_max.  If
 32809  //    comment is not Z_NULL, then up to comm_max characters are written there,
 32810  //    terminated with a zero unless the length is greater than comm_max.  When any
 32811  //    of extra, name, or comment are not Z_NULL and the respective field is not
 32812  //    present in the header, then that field is set to Z_NULL to signal its
 32813  //    absence.  This allows the use of deflateSetHeader() with the returned
 32814  //    structure to duplicate the header.  However if those fields are set to
 32815  //    allocated memory, then the application will need to save those pointers
 32816  //    elsewhere so that they can be eventually freed.
 32817  //
 32818  //      If inflateGetHeader is not used, then the header information is simply
 32819  //    discarded.  The header is always checked for validity, including the header
 32820  //    CRC if present.  inflateReset() will reset the process to discard the header
 32821  //    information.  The application would need to call inflateGetHeader() again to
 32822  //    retrieve the header from the next gzip stream.
 32823  //
 32824  //      inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source
 32825  //    stream state was inconsistent.
 32826  
 32827  //
 32828  // ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
 32829  //                                         unsigned char FAR *window));
 32830  //
 32831  //      Initialize the internal stream state for decompression using inflateBack()
 32832  //    calls.  The fields zalloc, zfree and opaque in strm must be initialized
 32833  //    before the call.  If zalloc and zfree are Z_NULL, then the default library-
 32834  //    derived memory allocation routines are used.  windowBits is the base two
 32835  //    logarithm of the window size, in the range 8..15.  window is a caller
 32836  //    supplied buffer of that size.  Except for special applications where it is
 32837  //    assured that deflate was used with small window sizes, windowBits must be 15
 32838  //    and a 32K byte window must be supplied to be able to decompress general
 32839  //    deflate streams.
 32840  //
 32841  //      See inflateBack() for the usage of these routines.
 32842  //
 32843  //      inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of
 32844  //    the parameters are invalid, Z_MEM_ERROR if the internal state could not be
 32845  //    allocated, or Z_VERSION_ERROR if the version of the library does not match
 32846  //    the version of the header file.
 32847  
 32848  type in_func = uintptr  /* zlib.h:1092:18 */
 32849  type out_func = uintptr /* zlib.h:1094:13 */
 32850  //
 32851  //      Same as uncompress, except that sourceLen is a pointer, where the
 32852  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
 32853  //    source bytes consumed.
 32854  
 32855  // gzip file access functions
 32856  
 32857  //
 32858  //      This library supports reading and writing files in gzip (.gz) format with
 32859  //    an interface similar to that of stdio, using the functions that start with
 32860  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
 32861  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
 32862  
 32863  type gzFile_s = struct {
 32864  	Fhave uint32
 32865  	Fnext uintptr
 32866  	Fpos  off_t
 32867  } /* zlib.h:1300:9 */
 32868  
 32869  //
 32870  //      Same as uncompress, except that sourceLen is a pointer, where the
 32871  //    length of the source is *sourceLen.  On return, *sourceLen is the number of
 32872  //    source bytes consumed.
 32873  
 32874  // gzip file access functions
 32875  
 32876  //
 32877  //      This library supports reading and writing files in gzip (.gz) format with
 32878  //    an interface similar to that of stdio, using the functions that start with
 32879  //    "gz".  The gzip format is different from the zlib format.  gzip is a gzip
 32880  //    wrapper, documented in RFC 1952, wrapped around a deflate stream.
 32881  
 32882  type gzFile = uintptr /* zlib.h:1300:25 */ // 2-byte unsigned integer
 32883  
 32884  // Definitions for mode bitmasks S_IFDIR, S_IFREG and S_IFLNK.
 32885  //
 32886  // In some ways it would be better to obtain these values from system
 32887  // header files. But, the dependency is undesirable and (a) these
 32888  // have been stable for decades, (b) the values are part of POSIX and
 32889  // are also made explicit in [man stat], and (c) are part of the
 32890  // file format for zip archives.
 32891  
 32892  var ZIPFILE_SCHEMA =
 32893  
 32894  // 0: Name of file in zip archive
 32895  // 1: POSIX mode for file
 32896  // 2: Last modification time (secs since 1970)
 32897  // 3: Size of object
 32898  // 4: Raw data
 32899  // 5: Uncompressed data
 32900  // 6: Compression method (integer)
 32901  // 7: Name of zip file
 32902  *(*[91]int8)(unsafe.Pointer(ts + 8921 /* "CREATE TABLE y(n..." */)) /* zipfile.c:91:19 */
 32903  
 32904  // Magic numbers used to read and write zip files.
 32905  //
 32906  // ZIPFILE_NEWENTRY_MADEBY:
 32907  //   Use this value for the "version-made-by" field in new zip file
 32908  //   entries. The upper byte indicates "unix", and the lower byte
 32909  //   indicates that the zip file matches pkzip specification 3.0.
 32910  //   This is what info-zip seems to do.
 32911  //
 32912  // ZIPFILE_NEWENTRY_REQUIRED:
 32913  //   Value for "version-required-to-extract" field of new entries.
 32914  //   Version 2.0 is required to support folders and deflate compression.
 32915  //
 32916  // ZIPFILE_NEWENTRY_FLAGS:
 32917  //   Value for "general-purpose-bit-flags" field of new entries. Bit
 32918  //   11 means "utf-8 filename and comment".
 32919  //
 32920  // ZIPFILE_SIGNATURE_CDS:
 32921  //   First 4 bytes of a valid CDS record.
 32922  //
 32923  // ZIPFILE_SIGNATURE_LFH:
 32924  //   First 4 bytes of a valid LFH record.
 32925  //
 32926  // ZIPFILE_SIGNATURE_EOCD
 32927  //   First 4 bytes of a valid EOCD record.
 32928  
 32929  // The sizes of the fixed-size part of each of the three main data
 32930  // structures in a zip archive.
 32931  
 32932  // 4.3.16  End of central directory record:
 32933  //
 32934  //   end of central dir signature    4 bytes  (0x06054b50)
 32935  //   number of this disk             2 bytes
 32936  //   number of the disk with the
 32937  //   start of the central directory  2 bytes
 32938  //   total number of entries in the
 32939  //   central directory on this disk  2 bytes
 32940  //   total number of entries in
 32941  //   the central directory           2 bytes
 32942  //   size of the central directory   4 bytes
 32943  //   offset of start of central
 32944  //   directory with respect to
 32945  //   the starting disk number        4 bytes
 32946  //   .ZIP file comment length        2 bytes
 32947  //   .ZIP file comment       (variable size)
 32948  type ZipfileEOCD1 = struct {
 32949  	FiDisk       u16
 32950  	FiFirstDisk  u16
 32951  	FnEntry      u16
 32952  	FnEntryTotal u16
 32953  	FnSize       u32
 32954  	FiOffset     u32
 32955  } /* zipfile.c:167:9 */
 32956  
 32957  // Magic numbers used to read and write zip files.
 32958  //
 32959  // ZIPFILE_NEWENTRY_MADEBY:
 32960  //   Use this value for the "version-made-by" field in new zip file
 32961  //   entries. The upper byte indicates "unix", and the lower byte
 32962  //   indicates that the zip file matches pkzip specification 3.0.
 32963  //   This is what info-zip seems to do.
 32964  //
 32965  // ZIPFILE_NEWENTRY_REQUIRED:
 32966  //   Value for "version-required-to-extract" field of new entries.
 32967  //   Version 2.0 is required to support folders and deflate compression.
 32968  //
 32969  // ZIPFILE_NEWENTRY_FLAGS:
 32970  //   Value for "general-purpose-bit-flags" field of new entries. Bit
 32971  //   11 means "utf-8 filename and comment".
 32972  //
 32973  // ZIPFILE_SIGNATURE_CDS:
 32974  //   First 4 bytes of a valid CDS record.
 32975  //
 32976  // ZIPFILE_SIGNATURE_LFH:
 32977  //   First 4 bytes of a valid LFH record.
 32978  //
 32979  // ZIPFILE_SIGNATURE_EOCD
 32980  //   First 4 bytes of a valid EOCD record.
 32981  
 32982  // The sizes of the fixed-size part of each of the three main data
 32983  // structures in a zip archive.
 32984  
 32985  // 4.3.16  End of central directory record:
 32986  //
 32987  //   end of central dir signature    4 bytes  (0x06054b50)
 32988  //   number of this disk             2 bytes
 32989  //   number of the disk with the
 32990  //   start of the central directory  2 bytes
 32991  //   total number of entries in the
 32992  //   central directory on this disk  2 bytes
 32993  //   total number of entries in
 32994  //   the central directory           2 bytes
 32995  //   size of the central directory   4 bytes
 32996  //   offset of start of central
 32997  //   directory with respect to
 32998  //   the starting disk number        4 bytes
 32999  //   .ZIP file comment length        2 bytes
 33000  //   .ZIP file comment       (variable size)
 33001  type ZipfileEOCD = ZipfileEOCD1 /* zipfile.c:167:28 */
 33002  
 33003  // 4.3.12  Central directory structure:
 33004  //
 33005  // ...
 33006  //
 33007  //   central file header signature   4 bytes  (0x02014b50)
 33008  //   version made by                 2 bytes
 33009  //   version needed to extract       2 bytes
 33010  //   general purpose bit flag        2 bytes
 33011  //   compression method              2 bytes
 33012  //   last mod file time              2 bytes
 33013  //   last mod file date              2 bytes
 33014  //   crc-32                          4 bytes
 33015  //   compressed size                 4 bytes
 33016  //   uncompressed size               4 bytes
 33017  //   file name length                2 bytes
 33018  //   extra field length              2 bytes
 33019  //   file comment length             2 bytes
 33020  //   disk number start               2 bytes
 33021  //   internal file attributes        2 bytes
 33022  //   external file attributes        4 bytes
 33023  //   relative offset of local header 4 bytes
 33024  type ZipfileCDS1 = struct {
 33025  	FiVersionMadeBy  u16
 33026  	FiVersionExtract u16
 33027  	Fflags           u16
 33028  	FiCompression    u16
 33029  	FmTime           u16
 33030  	FmDate           u16
 33031  	Fcrc32           u32
 33032  	FszCompressed    u32
 33033  	FszUncompressed  u32
 33034  	FnFile           u16
 33035  	FnExtra          u16
 33036  	FnComment        u16
 33037  	FiDiskStart      u16
 33038  	FiInternalAttr   u16
 33039  	_                [2]byte
 33040  	FiExternalAttr   u32
 33041  	FiOffset         u32
 33042  	FzFile           uintptr
 33043  } /* zipfile.c:200:9 */
 33044  
 33045  // 4.3.12  Central directory structure:
 33046  //
 33047  // ...
 33048  //
 33049  //   central file header signature   4 bytes  (0x02014b50)
 33050  //   version made by                 2 bytes
 33051  //   version needed to extract       2 bytes
 33052  //   general purpose bit flag        2 bytes
 33053  //   compression method              2 bytes
 33054  //   last mod file time              2 bytes
 33055  //   last mod file date              2 bytes
 33056  //   crc-32                          4 bytes
 33057  //   compressed size                 4 bytes
 33058  //   uncompressed size               4 bytes
 33059  //   file name length                2 bytes
 33060  //   extra field length              2 bytes
 33061  //   file comment length             2 bytes
 33062  //   disk number start               2 bytes
 33063  //   internal file attributes        2 bytes
 33064  //   external file attributes        4 bytes
 33065  //   relative offset of local header 4 bytes
 33066  type ZipfileCDS = ZipfileCDS1 /* zipfile.c:200:27 */
 33067  
 33068  // 4.3.7  Local file header:
 33069  //
 33070  //   local file header signature     4 bytes  (0x04034b50)
 33071  //   version needed to extract       2 bytes
 33072  //   general purpose bit flag        2 bytes
 33073  //   compression method              2 bytes
 33074  //   last mod file time              2 bytes
 33075  //   last mod file date              2 bytes
 33076  //   crc-32                          4 bytes
 33077  //   compressed size                 4 bytes
 33078  //   uncompressed size               4 bytes
 33079  //   file name length                2 bytes
 33080  //   extra field length              2 bytes
 33081  //
 33082  type ZipfileLFH1 = struct {
 33083  	FiVersionExtract u16
 33084  	Fflags           u16
 33085  	FiCompression    u16
 33086  	FmTime           u16
 33087  	FmDate           u16
 33088  	_                [2]byte
 33089  	Fcrc32           u32
 33090  	FszCompressed    u32
 33091  	FszUncompressed  u32
 33092  	FnFile           u16
 33093  	FnExtra          u16
 33094  } /* zipfile.c:237:9 */
 33095  
 33096  // 4.3.7  Local file header:
 33097  //
 33098  //   local file header signature     4 bytes  (0x04034b50)
 33099  //   version needed to extract       2 bytes
 33100  //   general purpose bit flag        2 bytes
 33101  //   compression method              2 bytes
 33102  //   last mod file time              2 bytes
 33103  //   last mod file date              2 bytes
 33104  //   crc-32                          4 bytes
 33105  //   compressed size                 4 bytes
 33106  //   uncompressed size               4 bytes
 33107  //   file name length                2 bytes
 33108  //   extra field length              2 bytes
 33109  //
 33110  type ZipfileLFH = ZipfileLFH1 /* zipfile.c:237:27 */
 33111  
 33112  type ZipfileEntry1 = struct {
 33113  	Fcds       ZipfileCDS
 33114  	FmUnixTime u32
 33115  	FaExtra    uintptr
 33116  	FiDataOff  i64
 33117  	FaData     uintptr
 33118  	FpNext     uintptr
 33119  } /* zipfile.c:251:9 */
 33120  
 33121  type ZipfileEntry = ZipfileEntry1 /* zipfile.c:251:29 */
 33122  
 33123  // Cursor type for zipfile tables.
 33124  type ZipfileCsr1 = struct {
 33125  	Fbase       sqlite3_vtab_cursor
 33126  	_           [4]byte
 33127  	FiId        i64
 33128  	FbEof       u8
 33129  	FbNoop      u8
 33130  	_           [2]byte
 33131  	FpFile      uintptr
 33132  	FiNextOff   i64
 33133  	Feocd       ZipfileEOCD
 33134  	FpFreeEntry uintptr
 33135  	FpCurrent   uintptr
 33136  	FpCsrNext   uintptr
 33137  	_           [4]byte
 33138  } /* zipfile.c:264:9 */
 33139  
 33140  // Cursor type for zipfile tables.
 33141  type ZipfileCsr = ZipfileCsr1 /* zipfile.c:264:27 */
 33142  
 33143  type ZipfileTab1 = struct {
 33144  	Fbase        sqlite3_vtab
 33145  	FzFile       uintptr
 33146  	Fdb          uintptr
 33147  	FaBuffer     uintptr
 33148  	FpCsrList    uintptr
 33149  	_            [4]byte
 33150  	FiNextCsrid  i64
 33151  	FpFirstEntry uintptr
 33152  	FpLastEntry  uintptr
 33153  	FpWriteFd    uintptr
 33154  	_            [4]byte
 33155  	FszCurrent   i64
 33156  	FszOrig      i64
 33157  } /* zipfile.c:281:9 */
 33158  
 33159  type ZipfileTab = ZipfileTab1 /* zipfile.c:281:27 */
 33160  
 33161  // Set the error message contained in context ctx to the results of
 33162  // vprintf(zFmt, ...).
 33163  func zipfileCtxErrorMsg(tls *libc.TLS, ctx uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:303:13: */
 33164  	var zMsg uintptr = uintptr(0)
 33165  	var ap va_list
 33166  	_ = ap
 33167  	ap = va
 33168  	zMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 33169  	sqlite3.Xsqlite3_result_error(tls, ctx, zMsg, -1)
 33170  	sqlite3.Xsqlite3_free(tls, zMsg)
 33171  	_ = ap
 33172  }
 33173  
 33174  // If string zIn is quoted, dequote it in place. Otherwise, if the string
 33175  // is not quoted, do nothing.
 33176  func zipfileDequote(tls *libc.TLS, zIn uintptr) { /* zipfile.c:317:13: */
 33177  	var q int8 = *(*int8)(unsafe.Pointer(zIn))
 33178  	if (((int32(q) == '"') || (int32(q) == '\'')) || (int32(q) == '`')) || (int32(q) == '[') {
 33179  		var iIn int32 = 1
 33180  		var iOut int32 = 0
 33181  		if int32(q) == '[' {
 33182  			q = int8(']')
 33183  		}
 33184  		for *(*int8)(unsafe.Pointer(zIn + uintptr(iIn))) != 0 {
 33185  			var c int8 = *(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iIn, 1))))
 33186  			if (int32(c) == int32(q)) && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iIn, 1))))) != int32(q)) {
 33187  				break
 33188  			}
 33189  			*(*int8)(unsafe.Pointer(zIn + uintptr(libc.PostIncInt32(&iOut, 1)))) = c
 33190  		}
 33191  		*(*int8)(unsafe.Pointer(zIn + uintptr(iOut))) = int8(0)
 33192  	}
 33193  }
 33194  
 33195  // Construct a new ZipfileTab virtual table object.
 33196  //
 33197  //   argv[0]   -> module name  ("zipfile")
 33198  //   argv[1]   -> database name
 33199  //   argv[2]   -> table name
 33200  //   argv[...] -> "column name" and other module argument fields.
 33201  func zipfileConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* zipfile.c:340:12: */
 33202  	var nByte int32 = (int32(uint32(unsafe.Sizeof(ZipfileTab{})) + (uint32(64 * 1024))))
 33203  	var nFile int32 = 0
 33204  	var zFile uintptr = uintptr(0)
 33205  	var pNew uintptr = uintptr(0)
 33206  	var rc int32
 33207  
 33208  	// If the table name is not "zipfile", require that the argument be
 33209  	// specified. This stops zipfile tables from being created as:
 33210  	//
 33211  	//   CREATE VIRTUAL TABLE zzz USING zipfile();
 33212  	//
 33213  	// It does not prevent:
 33214  	//
 33215  	//   CREATE VIRTUAL TABLE zipfile USING zipfile();
 33216  
 33217  	if ((0 != sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+9012 /* "zipfile" */)) && (argc < 4)) || (argc > 4) {
 33218  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9020 /* "zipfile construc..." */, 0)
 33219  		return SQLITE_ERROR
 33220  	}
 33221  
 33222  	if argc > 3 {
 33223  		zFile = *(*uintptr)(unsafe.Pointer(argv + 3*4))
 33224  		nFile = (int32(libc.Xstrlen(tls, zFile)) + 1)
 33225  	}
 33226  
 33227  	rc = sqlite3.Xsqlite3_declare_vtab(tls, db, uintptr(unsafe.Pointer(&ZIPFILE_SCHEMA)))
 33228  	if rc == SQLITE_OK {
 33229  		pNew = sqlite3.Xsqlite3_malloc64(tls, (uint64(sqlite3_int64(nByte) + sqlite3_int64(nFile))))
 33230  		if pNew == uintptr(0) {
 33231  			return SQLITE_NOMEM
 33232  		}
 33233  		libc.Xmemset(tls, pNew, 0, (uint32(nByte + nFile)))
 33234  		(*ZipfileTab)(unsafe.Pointer(pNew)).Fdb = db
 33235  		(*ZipfileTab)(unsafe.Pointer(pNew)).FaBuffer = (pNew + 1*72)
 33236  		if zFile != 0 {
 33237  			(*ZipfileTab)(unsafe.Pointer(pNew)).FzFile = ((*ZipfileTab)(unsafe.Pointer(pNew)).FaBuffer + 65536)
 33238  			libc.Xmemcpy(tls, (*ZipfileTab)(unsafe.Pointer(pNew)).FzFile, zFile, uint32(nFile))
 33239  			zipfileDequote(tls, (*ZipfileTab)(unsafe.Pointer(pNew)).FzFile)
 33240  		}
 33241  	}
 33242  	sqlite3.Xsqlite3_vtab_config(tls, db, SQLITE_VTAB_DIRECTONLY, 0)
 33243  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pNew
 33244  	return rc
 33245  }
 33246  
 33247  // Free the ZipfileEntry structure indicated by the only argument.
 33248  func zipfileEntryFree(tls *libc.TLS, p uintptr) { /* zipfile.c:394:13: */
 33249  	if p != 0 {
 33250  		sqlite3.Xsqlite3_free(tls, (*ZipfileEntry)(unsafe.Pointer(p)).Fcds.FzFile)
 33251  		sqlite3.Xsqlite3_free(tls, p)
 33252  	}
 33253  }
 33254  
 33255  // Release resources that should be freed at the end of a write
 33256  // transaction.
 33257  func zipfileCleanupTransaction(tls *libc.TLS, pTab uintptr) { /* zipfile.c:405:13: */
 33258  	var pEntry uintptr
 33259  	var pNext uintptr
 33260  
 33261  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd != 0 {
 33262  		libc.Xfclose(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)
 33263  		(*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd = uintptr(0)
 33264  	}
 33265  	for pEntry = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry; pEntry != 0; pEntry = pNext {
 33266  		pNext = (*ZipfileEntry)(unsafe.Pointer(pEntry)).FpNext
 33267  		zipfileEntryFree(tls, pEntry)
 33268  	}
 33269  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = uintptr(0)
 33270  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry = uintptr(0)
 33271  	(*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent = int64(0)
 33272  	(*ZipfileTab)(unsafe.Pointer(pTab)).FszOrig = int64(0)
 33273  }
 33274  
 33275  // This method is the destructor for zipfile vtab objects.
 33276  func zipfileDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:426:12: */
 33277  	zipfileCleanupTransaction(tls, pVtab)
 33278  	sqlite3.Xsqlite3_free(tls, pVtab)
 33279  	return SQLITE_OK
 33280  }
 33281  
 33282  // Constructor for a new ZipfileCsr object.
 33283  func zipfileOpen(tls *libc.TLS, p uintptr, ppCsr uintptr) int32 { /* zipfile.c:435:12: */
 33284  	var pTab uintptr = p
 33285  	var pCsr uintptr
 33286  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ZipfileCsr{})))
 33287  	*(*uintptr)(unsafe.Pointer(ppCsr)) = pCsr
 33288  	if pCsr == uintptr(0) {
 33289  		return SQLITE_NOMEM
 33290  	}
 33291  	libc.Xmemset(tls, pCsr, 0, uint32(unsafe.Sizeof(ZipfileCsr{})))
 33292  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId = libc.PreIncInt64(&(*ZipfileTab)(unsafe.Pointer(pTab)).FiNextCsrid, 1)
 33293  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList
 33294  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList = pCsr
 33295  	return SQLITE_OK
 33296  }
 33297  
 33298  // Reset a cursor back to the state it was in when first returned
 33299  // by zipfileOpen().
 33300  func zipfileResetCursor(tls *libc.TLS, pCsr uintptr) { /* zipfile.c:454:13: */
 33301  	var p uintptr
 33302  	var pNext uintptr
 33303  
 33304  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(0)
 33305  	if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile != 0 {
 33306  		libc.Xfclose(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile)
 33307  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile = uintptr(0)
 33308  		zipfileEntryFree(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)
 33309  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = uintptr(0)
 33310  	}
 33311  
 33312  	for p = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry; p != 0; p = pNext {
 33313  		pNext = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext
 33314  		zipfileEntryFree(tls, p)
 33315  	}
 33316  }
 33317  
 33318  // Destructor for an ZipfileCsr.
 33319  func zipfileClose(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:475:12: */
 33320  	var pCsr uintptr = cur
 33321  	var pTab uintptr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 33322  	var pp uintptr
 33323  	zipfileResetCursor(tls, pCsr)
 33324  
 33325  	// Remove this cursor from the ZipfileTab.pCsrList list.
 33326  	for pp = (pTab + 24 /* &.pCsrList */); *(*uintptr)(unsafe.Pointer(pp)) != pCsr; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 56 /* &.pCsrNext */) {
 33327  	}
 33328  	*(*uintptr)(unsafe.Pointer(pp)) = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext
 33329  
 33330  	sqlite3.Xsqlite3_free(tls, pCsr)
 33331  	return SQLITE_OK
 33332  }
 33333  
 33334  // Set the error message for the virtual table associated with cursor
 33335  // pCsr to the results of vprintf(zFmt, ...).
 33336  func zipfileTableErr(tls *libc.TLS, pTab uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:493:13: */
 33337  	var ap va_list
 33338  	_ = ap
 33339  	ap = va
 33340  	sqlite3.Xsqlite3_free(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg)
 33341  	(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 33342  	_ = ap
 33343  }
 33344  
 33345  func zipfileCursorErr(tls *libc.TLS, pCsr uintptr, zFmt uintptr, va uintptr) { /* zipfile.c:500:13: */
 33346  	var ap va_list
 33347  	_ = ap
 33348  	ap = va
 33349  	sqlite3.Xsqlite3_free(tls, (*sqlite3_vtab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg)
 33350  	(*sqlite3_vtab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FzErrMsg = sqlite3.Xsqlite3_vmprintf(tls, zFmt, ap)
 33351  	_ = ap
 33352  }
 33353  
 33354  // Read nRead bytes of data from offset iOff of file pFile into buffer
 33355  // aRead[]. Return SQLITE_OK if successful, or an SQLite error code
 33356  // otherwise.
 33357  //
 33358  // If an error does occur, output variable (*pzErrmsg) may be set to point
 33359  // to an English language error message. It is the responsibility of the
 33360  // caller to eventually free this buffer using
 33361  // sqlite3_free().
 33362  func zipfileReadData(tls *libc.TLS, pFile uintptr, aRead uintptr, nRead int32, iOff i64, pzErrmsg uintptr) int32 { /* zipfile.c:518:12: */
 33363  	var n size_t
 33364  	libc.Xfseek(tls, pFile, int32(iOff), SEEK_SET)
 33365  	n = libc.Xfread(tls, aRead, uint32(1), uint32(nRead), pFile)
 33366  	if int32(n) != nRead {
 33367  		*(*uintptr)(unsafe.Pointer(pzErrmsg)) = sqlite3.Xsqlite3_mprintf(tls, ts+9062 /* "error in fread()" */, 0)
 33368  		return SQLITE_ERROR
 33369  	}
 33370  	return SQLITE_OK
 33371  }
 33372  
 33373  func zipfileAppendData(tls *libc.TLS, pTab uintptr, aWrite uintptr, nWrite int32) int32 { /* zipfile.c:535:12: */
 33374  	if nWrite > 0 {
 33375  		var n size_t = size_t(nWrite)
 33376  		libc.Xfseek(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, int32((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent), SEEK_SET)
 33377  		n = libc.Xfwrite(tls, aWrite, uint32(1), uint32(nWrite), (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)
 33378  		if int32(n) != nWrite {
 33379  			(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+9079 /* "error in fwrite(..." */, 0)
 33380  			return SQLITE_ERROR
 33381  		}
 33382  		*(*i64)(unsafe.Pointer(pTab + 56 /* &.szCurrent */)) += (i64(nWrite))
 33383  	}
 33384  	return SQLITE_OK
 33385  }
 33386  
 33387  // Read and return a 16-bit little-endian unsigned integer from buffer aBuf.
 33388  func zipfileGetU16(tls *libc.TLS, aBuf uintptr) u16 { /* zipfile.c:556:12: */
 33389  	return (u16((int32(*(*u8)(unsafe.Pointer(aBuf + 1))) << 8) + int32(*(*u8)(unsafe.Pointer(aBuf)))))
 33390  }
 33391  
 33392  // Read and return a 32-bit little-endian unsigned integer from buffer aBuf.
 33393  func zipfileGetU32(tls *libc.TLS, aBuf uintptr) u32 { /* zipfile.c:563:12: */
 33394  	return (((((u32(*(*u8)(unsafe.Pointer(aBuf + 3)))) << 24) +
 33395  		((u32(*(*u8)(unsafe.Pointer(aBuf + 2)))) << 16)) +
 33396  		((u32(*(*u8)(unsafe.Pointer(aBuf + 1)))) << 8)) +
 33397  		((u32(*(*u8)(unsafe.Pointer(aBuf)))) << 0))
 33398  }
 33399  
 33400  // Write a 16-bit little endiate integer into buffer aBuf.
 33401  func zipfilePutU16(tls *libc.TLS, aBuf uintptr, val u16) { /* zipfile.c:573:13: */
 33402  	*(*u8)(unsafe.Pointer(aBuf)) = (u8(int32(val) & 0xFF))
 33403  	*(*u8)(unsafe.Pointer(aBuf + 1)) = (u8((int32(val) >> 8) & 0xFF))
 33404  }
 33405  
 33406  // Write a 32-bit little endiate integer into buffer aBuf.
 33407  func zipfilePutU32(tls *libc.TLS, aBuf uintptr, val u32) { /* zipfile.c:581:13: */
 33408  	*(*u8)(unsafe.Pointer(aBuf)) = (u8(val & u32(0xFF)))
 33409  	*(*u8)(unsafe.Pointer(aBuf + 1)) = (u8((val >> 8) & u32(0xFF)))
 33410  	*(*u8)(unsafe.Pointer(aBuf + 2)) = (u8((val >> 16) & u32(0xFF)))
 33411  	*(*u8)(unsafe.Pointer(aBuf + 3)) = (u8((val >> 24) & u32(0xFF)))
 33412  }
 33413  
 33414  // Magic numbers used to read CDS records.
 33415  
 33416  // Decode the CDS record in buffer aBuf into (*pCDS). Return SQLITE_ERROR
 33417  // if the record is not well-formed, or SQLITE_OK otherwise.
 33418  func zipfileReadCDS(tls *libc.TLS, aBuf uintptr, pCDS uintptr) int32 { /* zipfile.c:604:12: */
 33419  	var aRead uintptr = aBuf
 33420  	var sig u32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33421  	var rc int32 = SQLITE_OK
 33422  	if sig != u32(ZIPFILE_SIGNATURE_CDS) {
 33423  		rc = SQLITE_ERROR
 33424  	} else {
 33425  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionMadeBy = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33426  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionExtract = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33427  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).Fflags = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33428  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33429  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33430  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33431  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).Fcrc32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33432  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33433  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33434  
 33435  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33436  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33437  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33438  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiDiskStart = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33439  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiInternalAttr = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33440  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33441  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FiOffset = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33442  
 33443  	}
 33444  
 33445  	return rc
 33446  }
 33447  
 33448  // Decode the LFH record in buffer aBuf into (*pLFH). Return SQLITE_ERROR
 33449  // if the record is not well-formed, or SQLITE_OK otherwise.
 33450  func zipfileReadLFH(tls *libc.TLS, aBuffer uintptr, pLFH uintptr) int32 { /* zipfile.c:638:12: */
 33451  	var aRead uintptr = aBuffer
 33452  	var rc int32 = SQLITE_OK
 33453  
 33454  	var sig u32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33455  	if sig != u32(ZIPFILE_SIGNATURE_LFH) {
 33456  		rc = SQLITE_ERROR
 33457  	} else {
 33458  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FiVersionExtract = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33459  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).Fflags = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33460  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FiCompression = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33461  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FmTime = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33462  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FmDate = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33463  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).Fcrc32 = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33464  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FszCompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33465  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FszUncompressed = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33466  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FnFile = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33467  		(*ZipfileLFH)(unsafe.Pointer(pLFH)).FnExtra = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33468  	}
 33469  	return rc
 33470  }
 33471  
 33472  // Buffer aExtra (size nExtra bytes) contains zip archive "extra" fields.
 33473  // Scan through this buffer to find an "extra-timestamp" field. If one
 33474  // exists, extract the 32-bit modification-timestamp from it and store
 33475  // the value in output parameter *pmTime.
 33476  //
 33477  // Zero is returned if no extra-timestamp record could be found (and so
 33478  // *pmTime is left unchanged), or non-zero otherwise.
 33479  //
 33480  // The general format of an extra field is:
 33481  //
 33482  //   Header ID    2 bytes
 33483  //   Data Size    2 bytes
 33484  //   Data         N bytes
 33485  func zipfileScanExtra(tls *libc.TLS, aExtra uintptr, nExtra int32, pmTime uintptr) int32 { /* zipfile.c:679:12: */
 33486  	var ret int32 = 0
 33487  	var p uintptr = aExtra
 33488  	var pEnd uintptr = (aExtra + uintptr(nExtra))
 33489  
 33490  	for p < pEnd {
 33491  		var id u16 = func() u16 { p += uintptr(2); return zipfileGetU16(tls, (p - uintptr(2))) }()
 33492  		var nByte u16 = func() u16 { p += uintptr(2); return zipfileGetU16(tls, (p - uintptr(2))) }()
 33493  
 33494  		switch int32(id) {
 33495  		case ZIPFILE_EXTRA_TIMESTAMP:
 33496  			{
 33497  				var b u8 = *(*u8)(unsafe.Pointer(p))
 33498  				if (int32(b) & 0x01) != 0 { // 0x01 -> modtime is present
 33499  					*(*u32)(unsafe.Pointer(pmTime)) = zipfileGetU32(tls, (p + 1))
 33500  					ret = 1
 33501  				}
 33502  				break
 33503  
 33504  			}
 33505  		}
 33506  
 33507  		p += uintptr(nByte)
 33508  	}
 33509  	return ret
 33510  }
 33511  
 33512  // Convert the standard MS-DOS timestamp stored in the mTime and mDate
 33513  // fields of the CDS structure passed as the only argument to a 32-bit
 33514  // UNIX seconds-since-the-epoch timestamp. Return the result.
 33515  //
 33516  // "Standard" MS-DOS time format:
 33517  //
 33518  //   File modification time:
 33519  //     Bits 00-04: seconds divided by 2
 33520  //     Bits 05-10: minute
 33521  //     Bits 11-15: hour
 33522  //   File modification date:
 33523  //     Bits 00-04: day
 33524  //     Bits 05-08: month (1-12)
 33525  //     Bits 09-15: years from 1980
 33526  //
 33527  // https://msdn.microsoft.com/en-us/library/9kkf9tah.aspx
 33528  func zipfileMtime(tls *libc.TLS, pCDS uintptr) u32 { /* zipfile.c:722:12: */
 33529  	var Y int32
 33530  	var M int32
 33531  	var D int32
 33532  	var X1 int32
 33533  	var X2 int32
 33534  	var A int32
 33535  	var B int32
 33536  	var sec int32
 33537  	var min int32
 33538  	var hr int32
 33539  	var JDsec i64
 33540  	Y = (1980 + ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) >> 9) & 0x7F))
 33541  	M = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) >> 5) & 0x0F)
 33542  	D = (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate) & 0x1F)
 33543  	sec = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) & 0x1F) * 2)
 33544  	min = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) >> 5) & 0x3F)
 33545  	hr = ((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime) >> 11) & 0x1F)
 33546  	if M <= 2 {
 33547  		Y--
 33548  		M = M + (12)
 33549  	}
 33550  	X1 = ((36525 * (Y + 4716)) / 100)
 33551  	X2 = ((306001 * (M + 1)) / 10000)
 33552  	A = (Y / 100)
 33553  	B = ((2 - A) + (A / 4))
 33554  	JDsec = ((((i64(((float64(((X1 + X2) + D) + B)) - 1524.5) * float64(86400))) + (i64(hr * 3600))) + (i64(min * 60))) + i64(sec))
 33555  	return (u32(JDsec - (int64(24405875) * int64(8640))))
 33556  }
 33557  
 33558  // The opposite of zipfileMtime(). This function populates the mTime and
 33559  // mDate fields of the CDS structure passed as the first argument according
 33560  // to the UNIX timestamp value passed as the second.
 33561  func zipfileMtimeToDos(tls *libc.TLS, pCds uintptr, mUnixTime u32) { /* zipfile.c:748:13: */
 33562  	// Convert unix timestamp to JD (2440588 is noon on 1/1/1970)
 33563  	var JD i64 = (int64(2440588) + (i64(mUnixTime / (u32((24 * 60) * 60)))))
 33564  	var A int32
 33565  	var B int32
 33566  	var C int32
 33567  	var D int32
 33568  	var E int32
 33569  	var yr int32
 33570  	var mon int32
 33571  	var day int32
 33572  	var hr int32
 33573  	var min int32
 33574  	var sec int32
 33575  
 33576  	A = (int32((float64(JD) - 1867216.25) / 36524.25))
 33577  	A = (int32(((JD + int64(1)) + i64(A)) - (i64(A / 4))))
 33578  	B = (A + 1524)
 33579  	C = (int32((float64(B) - 122.1) / 365.25))
 33580  	D = ((36525 * (C & 32767)) / 100)
 33581  	E = (int32((float64(B - D)) / 30.6001))
 33582  
 33583  	day = ((B - D) - (int32(30.6001 * float64(E))))
 33584  	mon = func() int32 {
 33585  		if E < 14 {
 33586  			return (E - 1)
 33587  		}
 33588  		return (E - 13)
 33589  	}()
 33590  	if mon > 2 {
 33591  		yr = (C - 4716)
 33592  	} else {
 33593  		yr = (C - 4715)
 33594  	}
 33595  
 33596  	hr = (int32((mUnixTime % (u32((24 * 60) * 60))) / (u32(60 * 60))))
 33597  	min = (int32((mUnixTime % (u32(60 * 60))) / u32(60)))
 33598  	sec = (int32(mUnixTime % u32(60)))
 33599  
 33600  	if yr >= 1980 {
 33601  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate = (u16((day + (mon << 5)) + ((yr - 1980) << 9)))
 33602  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmTime = (u16(((sec / 2) + (min << 5)) + (hr << 11)))
 33603  	} else {
 33604  		(*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate = libc.AssignPtrUint16(pCds+8 /* &.mTime */, u16(0))
 33605  	}
 33606  
 33607  }
 33608  
 33609  // If aBlob is not NULL, then it is a pointer to a buffer (nBlob bytes in
 33610  // size) containing an entire zip archive image. Or, if aBlob is NULL,
 33611  // then pFile is a file-handle open on a zip file. In either case, this
 33612  // function creates a ZipfileEntry object based on the zip archive entry
 33613  // for which the CDS record is at offset iOff.
 33614  //
 33615  // If successful, SQLITE_OK is returned and (*ppEntry) set to point to
 33616  // the new object. Otherwise, an SQLite error code is returned and the
 33617  // final value of (*ppEntry) undefined.
 33618  func zipfileGetEntry(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32, pFile uintptr, iOff i64, ppEntry uintptr) int32 { /* zipfile.c:796:12: */
 33619  	bp := tls.Alloc(60)
 33620  	defer tls.Free(60)
 33621  
 33622  	var aRead uintptr
 33623  	var pzErr uintptr = (pTab /* &.base */ + 8 /* &.zErrMsg */)
 33624  	var rc int32 = SQLITE_OK
 33625  
 33626  	if aBlob == uintptr(0) {
 33627  		aRead = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer
 33628  		rc = zipfileReadData(tls, pFile, aRead, ZIPFILE_CDS_FIXED_SZ, iOff, pzErr)
 33629  	} else {
 33630  		aRead = (aBlob + uintptr(iOff))
 33631  	}
 33632  
 33633  	if rc == SQLITE_OK {
 33634  		var nAlloc sqlite3_int64
 33635  		var pNew uintptr
 33636  
 33637  		var nFile int32 = int32(zipfileGetU16(tls, (aRead + 28)))
 33638  		var nExtra int32 = int32(zipfileGetU16(tls, (aRead + 30)))
 33639  		nExtra = nExtra + (int32(zipfileGetU16(tls, (aRead + 32))))
 33640  
 33641  		nAlloc = (sqlite3_int64(uint32(unsafe.Sizeof(ZipfileEntry{})) + uint32(nExtra)))
 33642  		if aBlob != 0 {
 33643  			nAlloc = nAlloc + (sqlite3_int64(zipfileGetU32(tls, (aRead + 20))))
 33644  		}
 33645  
 33646  		pNew = sqlite3.Xsqlite3_malloc64(tls, uint64(nAlloc))
 33647  		if pNew == uintptr(0) {
 33648  			rc = SQLITE_NOMEM
 33649  		} else {
 33650  			libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(ZipfileEntry{})))
 33651  			rc = zipfileReadCDS(tls, aRead, (pNew /* &.cds */))
 33652  			if rc != SQLITE_OK {
 33653  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9097 /* "failed to read C..." */, libc.VaList(bp, iOff))
 33654  			} else if aBlob == uintptr(0) {
 33655  				rc = zipfileReadData(tls,
 33656  					pFile, aRead, (nExtra + nFile), (iOff + int64(ZIPFILE_CDS_FIXED_SZ)), pzErr)
 33657  			} else {
 33658  				aRead = (aBlob + uintptr((iOff + int64(ZIPFILE_CDS_FIXED_SZ))))
 33659  			}
 33660  		}
 33661  
 33662  		if rc == SQLITE_OK {
 33663  			var pt uintptr = (pNew + 48 /* &.mUnixTime */)
 33664  			(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile = sqlite3.Xsqlite3_mprintf(tls, ts+9131 /* "%.*s" */, libc.VaList(bp+8, nFile, aRead))
 33665  			(*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra = (pNew + 1*72)
 33666  			libc.Xmemcpy(tls, (*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra, (aRead + uintptr(nFile)), uint32(nExtra))
 33667  			if (*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile == uintptr(0) {
 33668  				rc = SQLITE_NOMEM
 33669  			} else if 0 == zipfileScanExtra(tls, (aRead+uintptr(nFile)), int32((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FnExtra), pt) {
 33670  				(*ZipfileEntry)(unsafe.Pointer(pNew)).FmUnixTime = zipfileMtime(tls, (pNew /* &.cds */))
 33671  			}
 33672  		}
 33673  
 33674  		if rc == SQLITE_OK {
 33675  			// var lfh ZipfileLFH at bp+32, 28
 33676  
 33677  			if pFile != 0 {
 33678  				rc = zipfileReadData(tls, pFile, aRead, szFix, int64((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset), pzErr)
 33679  			} else {
 33680  				aRead = (aBlob + uintptr((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset))
 33681  			}
 33682  
 33683  			rc = zipfileReadLFH(tls, aRead, bp+32 /* &lfh */)
 33684  			if rc == SQLITE_OK {
 33685  				(*ZipfileEntry)(unsafe.Pointer(pNew)).FiDataOff = (i64((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset + u32(ZIPFILE_LFH_FIXED_SZ)))
 33686  				*(*i64)(unsafe.Pointer(pNew + 56 /* &.iDataOff */)) += (i64(int32((*ZipfileLFH)(unsafe.Pointer(bp+32 /* &lfh */)).FnFile) + int32((*ZipfileLFH)(unsafe.Pointer(bp+32 /* &lfh */)).FnExtra)))
 33687  				if (aBlob != 0) && ((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed != 0) {
 33688  					(*ZipfileEntry)(unsafe.Pointer(pNew)).FaData = ((*ZipfileEntry)(unsafe.Pointer(pNew)).FaExtra + uintptr(nExtra))
 33689  					libc.Xmemcpy(tls, (*ZipfileEntry)(unsafe.Pointer(pNew)).FaData, (aBlob + uintptr((*ZipfileEntry)(unsafe.Pointer(pNew)).FiDataOff)), (*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed)
 33690  				}
 33691  			} else {
 33692  				*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9136, /* "failed to read L..." */
 33693  					libc.VaList(bp+24, int32((*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset)))
 33694  			}
 33695  		}
 33696  
 33697  		if rc != SQLITE_OK {
 33698  			zipfileEntryFree(tls, pNew)
 33699  		} else {
 33700  			*(*uintptr)(unsafe.Pointer(ppEntry)) = pNew
 33701  		}
 33702  	}
 33703  
 33704  	return rc
 33705  }
 33706  
 33707  var szFix int32 = ZIPFILE_LFH_FIXED_SZ /* zipfile.c:858:24 */
 33708  
 33709  // Advance an ZipfileCsr to its next row of output.
 33710  func zipfileNext(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:894:12: */
 33711  	bp := tls.Alloc(4)
 33712  	defer tls.Free(4)
 33713  
 33714  	var pCsr uintptr = cur
 33715  	var rc int32 = SQLITE_OK
 33716  
 33717  	if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile != 0 {
 33718  		var iEof i64 = (i64((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FiOffset + (*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FnSize))
 33719  		zipfileEntryFree(tls, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)
 33720  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = uintptr(0)
 33721  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff >= iEof {
 33722  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 33723  		} else {
 33724  			*(*uintptr)(unsafe.Pointer(bp /* p */)) = uintptr(0)
 33725  			var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 33726  			rc = zipfileGetEntry(tls, pTab, uintptr(0), 0, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff, bp /* &p */)
 33727  			if rc == SQLITE_OK {
 33728  				*(*i64)(unsafe.Pointer(pCsr + 24 /* &.iNextOff */)) += (int64(ZIPFILE_CDS_FIXED_SZ))
 33729  				*(*i64)(unsafe.Pointer(pCsr + 24 /* &.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)))
 33730  			}
 33731  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = *(*uintptr)(unsafe.Pointer(bp /* p */))
 33732  		}
 33733  	} else {
 33734  		if !(int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop) != 0) {
 33735  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FpNext
 33736  		}
 33737  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == uintptr(0) {
 33738  			(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 33739  		}
 33740  	}
 33741  
 33742  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(0)
 33743  	return rc
 33744  }
 33745  
 33746  func zipfileFree(tls *libc.TLS, p uintptr) { /* zipfile.c:927:13: */
 33747  	sqlite3.Xsqlite3_free(tls, p)
 33748  }
 33749  
 33750  // Buffer aIn (size nIn bytes) contains compressed data. Uncompressed, the
 33751  // size is nOut bytes. This function uncompresses the data and sets the
 33752  // return value in context pCtx to the result (a blob).
 33753  //
 33754  // If an error occurs, an error code is left in pCtx instead.
 33755  func zipfileInflate(tls *libc.TLS, pCtx uintptr, aIn uintptr, nIn int32, nOut int32) { /* zipfile.c:938:13: */
 33756  	bp := tls.Alloc(72)
 33757  	defer tls.Free(72)
 33758  
 33759  	var aRes uintptr = sqlite3.Xsqlite3_malloc(tls, nOut)
 33760  	if aRes == uintptr(0) {
 33761  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 33762  	} else {
 33763  		var err int32
 33764  		// var str z_stream at bp+16, 56
 33765  
 33766  		libc.Xmemset(tls, bp+16 /* &str */, 0, uint32(unsafe.Sizeof(z_stream{})))
 33767  
 33768  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Fnext_in = aIn
 33769  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Favail_in = uInt(nIn)
 33770  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Fnext_out = aRes
 33771  		(*z_stream)(unsafe.Pointer(bp + 16 /* &str */)).Favail_out = uInt(nOut)
 33772  
 33773  		err = tcl.XinflateInit2_(tls, bp+16 /* &str */, -15, ts+9168 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{})))
 33774  		if err != Z_OK {
 33775  			zipfileCtxErrorMsg(tls, pCtx, ts+9175 /* "inflateInit2() f..." */, libc.VaList(bp, err))
 33776  		} else {
 33777  			err = tcl.Xinflate(tls, bp+16 /* &str */, Z_NO_FLUSH)
 33778  			if err != Z_STREAM_END {
 33779  				zipfileCtxErrorMsg(tls, pCtx, ts+9202 /* "inflate() failed..." */, libc.VaList(bp+8, err))
 33780  			} else {
 33781  				sqlite3.Xsqlite3_result_blob(tls, pCtx, aRes, nOut, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFree})))
 33782  				aRes = uintptr(0)
 33783  			}
 33784  		}
 33785  		sqlite3.Xsqlite3_free(tls, aRes)
 33786  		tcl.XinflateEnd(tls, bp+16 /* &str */)
 33787  	}
 33788  }
 33789  
 33790  // Buffer aIn (size nIn bytes) contains uncompressed data. This function
 33791  // compresses it and sets (*ppOut) to point to a buffer containing the
 33792  // compressed data. The caller is responsible for eventually calling
 33793  // sqlite3_free() to release buffer (*ppOut). Before returning, (*pnOut)
 33794  // is set to the size of buffer (*ppOut) in bytes.
 33795  //
 33796  // If no error occurs, SQLITE_OK is returned. Otherwise, an SQLite error
 33797  // code is returned and an error message left in virtual-table handle
 33798  // pTab. The values of (*ppOut) and (*pnOut) are left unchanged in this
 33799  // case.
 33800  func zipfileDeflate(tls *libc.TLS, aIn uintptr, nIn int32, ppOut uintptr, pnOut uintptr, pzErr uintptr) int32 { /* zipfile.c:986:12: */
 33801  	bp := tls.Alloc(56)
 33802  	defer tls.Free(56)
 33803  
 33804  	var rc int32 = SQLITE_OK
 33805  	var nAlloc sqlite3_int64
 33806  	// var str z_stream at bp, 56
 33807  
 33808  	var aOut uintptr
 33809  
 33810  	libc.Xmemset(tls, bp /* &str */, 0, uint32(unsafe.Sizeof(z_stream{})))
 33811  	(*z_stream)(unsafe.Pointer(bp /* &str */)).Fnext_in = aIn
 33812  	(*z_stream)(unsafe.Pointer(bp /* &str */)).Favail_in = uInt(nIn)
 33813  	tcl.XdeflateInit2_(tls, bp /* &str */, 9, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY, ts+9168 /* "1.2.11" */, int32(unsafe.Sizeof(z_stream{})))
 33814  
 33815  	nAlloc = sqlite3_int64(tcl.XdeflateBound(tls, bp /* &str */, uint32(nIn)))
 33816  	aOut = sqlite3.Xsqlite3_malloc64(tls, uint64(nAlloc))
 33817  	if aOut == uintptr(0) {
 33818  		rc = SQLITE_NOMEM
 33819  	} else {
 33820  		var res int32
 33821  		(*z_stream)(unsafe.Pointer(bp /* &str */)).Fnext_out = aOut
 33822  		(*z_stream)(unsafe.Pointer(bp /* &str */)).Favail_out = uInt(nAlloc)
 33823  		res = tcl.Xdeflate(tls, bp /* &str */, Z_FINISH)
 33824  		if res == Z_STREAM_END {
 33825  			*(*uintptr)(unsafe.Pointer(ppOut)) = aOut
 33826  			*(*int32)(unsafe.Pointer(pnOut)) = int32((*z_stream)(unsafe.Pointer(bp /* &str */)).Ftotal_out)
 33827  		} else {
 33828  			sqlite3.Xsqlite3_free(tls, aOut)
 33829  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9224 /* "zipfile: deflate..." */, 0)
 33830  			rc = SQLITE_ERROR
 33831  		}
 33832  		tcl.XdeflateEnd(tls, bp /* &str */)
 33833  	}
 33834  
 33835  	return rc
 33836  }
 33837  
 33838  // Return values of columns for the row at which the series_cursor
 33839  // is currently pointing.
 33840  func zipfileColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* zipfile.c:1029:12: */
 33841  	var pCsr uintptr = cur
 33842  	var pCDS uintptr = ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent /* &.cds */)
 33843  	var rc int32 = SQLITE_OK
 33844  	switch i {
 33845  	case 0: // name
 33846  		sqlite3.Xsqlite3_result_text(tls, ctx, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile, -1, libc.UintptrFromInt32(-1))
 33847  		break
 33848  	case 1: // mode
 33849  		// TODO: Whether or not the following is correct surely depends on
 33850  		// the platform on which the archive was created.
 33851  		sqlite3.Xsqlite3_result_int(tls, ctx, (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr >> 16)))
 33852  		break
 33853  	case 2:
 33854  		{ // mtime
 33855  			sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FmUnixTime))
 33856  			break
 33857  
 33858  		}
 33859  	case 3:
 33860  		{ // sz
 33861  			if sqlite3.Xsqlite3_vtab_nochange(tls, ctx) == 0 {
 33862  				sqlite3.Xsqlite3_result_int64(tls, ctx, int64((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed))
 33863  			}
 33864  			break
 33865  
 33866  		}
 33867  	case 4: // rawdata
 33868  		if sqlite3.Xsqlite3_vtab_nochange(tls, ctx) != 0 {
 33869  			break
 33870  		}
 33871  		fallthrough
 33872  	case 5:
 33873  		{ // data
 33874  			if ((i == 4) || (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression) == 0)) || (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression) == 8) {
 33875  				var sz int32 = int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed)
 33876  				var szFinal int32 = int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed)
 33877  				if szFinal > 0 {
 33878  					var aBuf uintptr
 33879  					var aFree uintptr = uintptr(0)
 33880  					if (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FaData != 0 {
 33881  						aBuf = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FaData
 33882  					} else {
 33883  						aBuf = libc.AssignUintptr(&aFree, sqlite3.Xsqlite3_malloc64(tls, uint64(sz)))
 33884  						if aBuf == uintptr(0) {
 33885  							rc = SQLITE_NOMEM
 33886  						} else {
 33887  							var pFile uintptr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile
 33888  							if pFile == uintptr(0) {
 33889  								pFile = (*ZipfileTab)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab)).FpWriteFd
 33890  							}
 33891  							rc = zipfileReadData(tls, pFile, aBuf, sz, (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FiDataOff,
 33892  								((*ZipfileCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab + 8 /* &.zErrMsg */))
 33893  						}
 33894  					}
 33895  					if rc == SQLITE_OK {
 33896  						if (i == 5) && ((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression != 0) {
 33897  							zipfileInflate(tls, ctx, aBuf, sz, szFinal)
 33898  						} else {
 33899  							sqlite3.Xsqlite3_result_blob(tls, ctx, aBuf, sz, libc.UintptrFromInt32(-1))
 33900  						}
 33901  					}
 33902  					sqlite3.Xsqlite3_free(tls, aFree)
 33903  				} else {
 33904  					// Figure out if this is a directory or a zero-sized file. Consider
 33905  					// it to be a directory either if the mode suggests so, or if
 33906  					// the final character in the name is '/'.
 33907  					var mode u32 = ((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr >> 16)
 33908  					if !((mode & u32(S_IFDIR)) != 0) && (int32(*(*int8)(unsafe.Pointer((*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile + uintptr((int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile) - 1))))) != '/') {
 33909  						sqlite3.Xsqlite3_result_blob(tls, ctx, ts+489 /* "" */, 0, uintptr(0))
 33910  					}
 33911  				}
 33912  			}
 33913  			break
 33914  
 33915  		}
 33916  	case 6: // method
 33917  		sqlite3.Xsqlite3_result_int(tls, ctx, int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression))
 33918  		break
 33919  	default: // z
 33920  
 33921  		sqlite3.Xsqlite3_result_int64(tls, ctx, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId)
 33922  		break
 33923  	}
 33924  
 33925  	return rc
 33926  }
 33927  
 33928  // Return TRUE if the cursor is at EOF.
 33929  func zipfileEof(tls *libc.TLS, cur uintptr) int32 { /* zipfile.c:1116:12: */
 33930  	var pCsr uintptr = cur
 33931  	return int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof)
 33932  }
 33933  
 33934  // If aBlob is not NULL, then it points to a buffer nBlob bytes in size
 33935  // containing an entire zip archive image. Or, if aBlob is NULL, then pFile
 33936  // is guaranteed to be a file-handle open on a zip file.
 33937  //
 33938  // This function attempts to locate the EOCD record within the zip archive
 33939  // and populate *pEOCD with the results of decoding it. SQLITE_OK is
 33940  // returned if successful. Otherwise, an SQLite error code is returned and
 33941  // an English language error message may be left in virtual-table pTab.
 33942  func zipfileReadEOCD(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32, pFile uintptr, pEOCD uintptr) int32 { /* zipfile.c:1131:12: */
 33943  	var aRead uintptr = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer // Temporary buffer
 33944  	var nRead int32                                                  // Bytes to read from file
 33945  	var rc int32 = SQLITE_OK
 33946  
 33947  	if aBlob == uintptr(0) {
 33948  		var iOff i64   // Offset to read from
 33949  		var szFile i64 // Total size of file in bytes
 33950  		libc.Xfseek(tls, pFile, 0, SEEK_END)
 33951  		szFile = i64(libc.Xftell(tls, pFile))
 33952  		if szFile == int64(0) {
 33953  			libc.Xmemset(tls, pEOCD, 0, uint32(unsafe.Sizeof(ZipfileEOCD{})))
 33954  			return SQLITE_OK
 33955  		}
 33956  		nRead = func() int32 {
 33957  			if (szFile) < (int64(64 * 1024)) {
 33958  				return int32(szFile)
 33959  			}
 33960  			return (64 * 1024)
 33961  		}()
 33962  		iOff = (szFile - i64(nRead))
 33963  		rc = zipfileReadData(tls, pFile, aRead, nRead, iOff, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 33964  	} else {
 33965  		nRead = func() int32 {
 33966  			if (nBlob) < (64 * 1024) {
 33967  				return nBlob
 33968  			}
 33969  			return (64 * 1024)
 33970  		}()
 33971  		aRead = (aBlob + uintptr((nBlob - nRead)))
 33972  	}
 33973  
 33974  	if rc == SQLITE_OK {
 33975  		var i int32
 33976  
 33977  		// Scan backwards looking for the signature bytes
 33978  		for i = (nRead - 20); i >= 0; i-- {
 33979  			if (((int32(*(*u8)(unsafe.Pointer(aRead + uintptr(i)))) == 0x50) && (int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 1))))) == 0x4b)) &&
 33980  				(int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 2))))) == 0x05)) && (int32(*(*u8)(unsafe.Pointer(aRead + uintptr((i + 3))))) == 0x06) {
 33981  				break
 33982  			}
 33983  		}
 33984  		if i < 0 {
 33985  			(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 33986  				ts+9249 /* "cannot find end ..." */, 0)
 33987  			return SQLITE_ERROR
 33988  		}
 33989  
 33990  		aRead += (uintptr(i + 4))
 33991  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiDisk = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33992  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiFirstDisk = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33993  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnEntry = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33994  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnEntryTotal = func() u16 { aRead += uintptr(2); return zipfileGetU16(tls, (aRead - uintptr(2))) }()
 33995  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FnSize = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33996  		(*ZipfileEOCD)(unsafe.Pointer(pEOCD)).FiOffset = func() u32 { aRead += uintptr(4); return zipfileGetU32(tls, (aRead - uintptr(4))) }()
 33997  	}
 33998  
 33999  	return rc
 34000  }
 34001  
 34002  // Add object pNew to the linked list that begins at ZipfileTab.pFirstEntry
 34003  // and ends with pLastEntry. If argument pBefore is NULL, then pNew is added
 34004  // to the end of the list. Otherwise, it is added to the list immediately
 34005  // before pBefore (which is guaranteed to be a part of said list).
 34006  func zipfileAddEntry(tls *libc.TLS, pTab uintptr, pBefore uintptr, pNew uintptr) { /* zipfile.c:1195:13: */
 34007  
 34008  	if pBefore == uintptr(0) {
 34009  		if (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry == uintptr(0) {
 34010  			(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = libc.AssignPtrUintptr(pTab+44 /* &.pLastEntry */, pNew)
 34011  		} else {
 34012  
 34013  			(*ZipfileEntry)(unsafe.Pointer((*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry)).FpNext = pNew
 34014  			(*ZipfileTab)(unsafe.Pointer(pTab)).FpLastEntry = pNew
 34015  		}
 34016  	} else {
 34017  		var pp uintptr
 34018  		for pp = (pTab + 40 /* &.pFirstEntry */); *(*uintptr)(unsafe.Pointer(pp)) != pBefore; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 68 /* &.pNext */) {
 34019  		}
 34020  		(*ZipfileEntry)(unsafe.Pointer(pNew)).FpNext = pBefore
 34021  		*(*uintptr)(unsafe.Pointer(pp)) = pNew
 34022  	}
 34023  }
 34024  
 34025  func zipfileLoadDirectory(tls *libc.TLS, pTab uintptr, aBlob uintptr, nBlob int32) int32 { /* zipfile.c:1218:12: */
 34026  	bp := tls.Alloc(20)
 34027  	defer tls.Free(20)
 34028  
 34029  	// var eocd ZipfileEOCD at bp, 16
 34030  
 34031  	var rc int32
 34032  	var i int32
 34033  	var iOff i64
 34034  
 34035  	rc = zipfileReadEOCD(tls, pTab, aBlob, nBlob, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, bp /* &eocd */)
 34036  	iOff = i64((*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset)
 34037  	for i = 0; (rc == SQLITE_OK) && (i < int32((*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry)); i++ {
 34038  		*(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)) = uintptr(0)
 34039  		rc = zipfileGetEntry(tls, pTab, aBlob, nBlob, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, iOff, bp+16 /* &pNew */)
 34040  
 34041  		if rc == SQLITE_OK {
 34042  			zipfileAddEntry(tls, pTab, uintptr(0), *(*uintptr)(unsafe.Pointer(bp + 16 /* pNew */)))
 34043  			iOff = iOff + (int64(ZIPFILE_CDS_FIXED_SZ))
 34044  			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)))
 34045  		}
 34046  	}
 34047  	return rc
 34048  }
 34049  
 34050  // xFilter callback.
 34051  func zipfileFilter(tls *libc.TLS, cur uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* zipfile.c:1242:12: */
 34052  	bp := tls.Alloc(8)
 34053  	defer tls.Free(8)
 34054  
 34055  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 34056  	var pCsr uintptr = cur
 34057  	var zFile uintptr = uintptr(0) // Zip file to scan
 34058  	var rc int32 = SQLITE_OK       // Return Code
 34059  	var bInMemory int32 = 0        // True for an in-memory zipfile
 34060  
 34061  	zipfileResetCursor(tls, pCsr)
 34062  
 34063  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile != 0 {
 34064  		zFile = (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile
 34065  	} else if idxNum == 0 {
 34066  		zipfileCursorErr(tls, pCsr, ts+9293 /* "zipfile() functi..." */, 0)
 34067  		return SQLITE_ERROR
 34068  	} else if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_BLOB {
 34069  		var aBlob uintptr = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 34070  		var nBlob int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 34071  
 34072  		rc = zipfileLoadDirectory(tls, pTab, aBlob, nBlob)
 34073  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 34074  		(*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry = libc.AssignPtrUintptr(pTab+44 /* &.pLastEntry */, uintptr(0))
 34075  		if rc != SQLITE_OK {
 34076  			return rc
 34077  		}
 34078  		bInMemory = 1
 34079  	} else {
 34080  		zFile = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 34081  	}
 34082  
 34083  	if (uintptr(0) == (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd) && (0 == bInMemory) {
 34084  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 34085  		if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile == uintptr(0) {
 34086  			zipfileCursorErr(tls, pCsr, ts+9333 /* "cannot open file..." */, libc.VaList(bp, zFile))
 34087  			rc = SQLITE_ERROR
 34088  		} else {
 34089  			rc = zipfileReadEOCD(tls, pTab, uintptr(0), 0, (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFile, (pCsr + 32 /* &.eocd */))
 34090  			if rc == SQLITE_OK {
 34091  				if int32((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FnEntry) == 0 {
 34092  					(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbEof = u8(1)
 34093  				} else {
 34094  					(*ZipfileCsr)(unsafe.Pointer(pCsr)).FiNextOff = i64((*ZipfileCsr)(unsafe.Pointer(pCsr)).Feocd.FiOffset)
 34095  					rc = zipfileNext(tls, cur)
 34096  				}
 34097  			}
 34098  		}
 34099  	} else {
 34100  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(1)
 34101  		(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = func() uintptr {
 34102  			if (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry != 0 {
 34103  				return (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpFreeEntry
 34104  			}
 34105  			return (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 34106  		}()
 34107  		rc = zipfileNext(tls, cur)
 34108  	}
 34109  
 34110  	return rc
 34111  }
 34112  
 34113  // xBestIndex callback.
 34114  func zipfileBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* zipfile.c:1301:12: */
 34115  	var i int32
 34116  	var idx int32 = -1
 34117  	var unusable int32 = 0
 34118  
 34119  	for i = 0; i < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; i++ {
 34120  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(i)*12)
 34121  		if (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn != ZIPFILE_F_COLUMN_IDX {
 34122  			continue
 34123  		}
 34124  		if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable) == 0 {
 34125  			unusable = 1
 34126  		} else if int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ {
 34127  			idx = i
 34128  		}
 34129  	}
 34130  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000.0
 34131  	if idx >= 0 {
 34132  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).FargvIndex = 1
 34133  		(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(idx)*8)).Fomit = uint8(1)
 34134  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 34135  	} else if unusable != 0 {
 34136  		return SQLITE_CONSTRAINT
 34137  	}
 34138  	return SQLITE_OK
 34139  }
 34140  
 34141  func zipfileNewEntry(tls *libc.TLS, zPath uintptr) uintptr { /* zipfile.c:1329:21: */
 34142  	bp := tls.Alloc(8)
 34143  	defer tls.Free(8)
 34144  
 34145  	var pNew uintptr
 34146  	pNew = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(ZipfileEntry{})))
 34147  	if pNew != 0 {
 34148  		libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(ZipfileEntry{})))
 34149  		(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zPath))
 34150  		if (*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FzFile == uintptr(0) {
 34151  			sqlite3.Xsqlite3_free(tls, pNew)
 34152  			pNew = uintptr(0)
 34153  		}
 34154  	}
 34155  	return pNew
 34156  }
 34157  
 34158  func zipfileSerializeLFH(tls *libc.TLS, pEntry uintptr, aBuf uintptr) int32 { /* zipfile.c:1343:12: */
 34159  	var pCds uintptr = (pEntry /* &.cds */)
 34160  	var a uintptr = aBuf
 34161  
 34162  	(*ZipfileCDS)(unsafe.Pointer(pCds)).FnExtra = u16(9)
 34163  
 34164  	/* Write the LFH itself */
 34165  	{
 34166  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_LFH))
 34167  		a += uintptr(4)
 34168  	}
 34169  
 34170  	{
 34171  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FiVersionExtract)
 34172  		a += uintptr(2)
 34173  	}
 34174  
 34175  	{
 34176  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).Fflags)
 34177  		a += uintptr(2)
 34178  	}
 34179  
 34180  	{
 34181  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FiCompression)
 34182  		a += uintptr(2)
 34183  	}
 34184  
 34185  	{
 34186  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FmTime)
 34187  		a += uintptr(2)
 34188  	}
 34189  
 34190  	{
 34191  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FmDate)
 34192  		a += uintptr(2)
 34193  	}
 34194  
 34195  	{
 34196  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).Fcrc32)
 34197  		a += uintptr(4)
 34198  	}
 34199  
 34200  	{
 34201  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FszCompressed)
 34202  		a += uintptr(4)
 34203  	}
 34204  
 34205  	{
 34206  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FszUncompressed)
 34207  		a += uintptr(4)
 34208  	}
 34209  
 34210  	{
 34211  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile)
 34212  		a += uintptr(2)
 34213  	}
 34214  
 34215  	{
 34216  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FnExtra)
 34217  		a += uintptr(2)
 34218  	}
 34219  
 34220  	// Add the file name
 34221  	libc.Xmemcpy(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCds)).FzFile, uint32(int32((*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile)))
 34222  	a += uintptr(int32((*ZipfileCDS)(unsafe.Pointer(pCds)).FnFile))
 34223  
 34224  	/* The "extra" data */
 34225  	{
 34226  		zipfilePutU16(tls, a, uint16(ZIPFILE_EXTRA_TIMESTAMP))
 34227  		a += uintptr(2)
 34228  	}
 34229  
 34230  	{
 34231  		zipfilePutU16(tls, a, uint16(5))
 34232  		a += uintptr(2)
 34233  	}
 34234  
 34235  	*(*u8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1))) = u8(0x01)
 34236  	{
 34237  		zipfilePutU32(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FmUnixTime)
 34238  		a += uintptr(4)
 34239  	}
 34240  
 34241  	return ((int32(a) - int32(aBuf)) / 1)
 34242  }
 34243  
 34244  func zipfileAppendEntry(tls *libc.TLS, pTab uintptr, pEntry uintptr, pData uintptr, nData int32) int32 { /* zipfile.c:1376:12: */
 34245  	var aBuf uintptr = (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer
 34246  	var nBuf int32
 34247  	var rc int32
 34248  
 34249  	nBuf = zipfileSerializeLFH(tls, pEntry, aBuf)
 34250  	rc = zipfileAppendData(tls, pTab, aBuf, nBuf)
 34251  	if rc == SQLITE_OK {
 34252  		(*ZipfileEntry)(unsafe.Pointer(pEntry)).FiDataOff = (*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent
 34253  		rc = zipfileAppendData(tls, pTab, pData, nData)
 34254  	}
 34255  
 34256  	return rc
 34257  }
 34258  
 34259  func zipfileGetMode(tls *libc.TLS, pVal uintptr, bIsDir int32, pMode uintptr, pzErr uintptr) int32 { /* zipfile.c:1396:12: */
 34260  	bp := tls.Alloc(19)
 34261  	defer tls.Free(19)
 34262  
 34263  	var z uintptr
 34264  	var mode u32
 34265  	// var zTemplate [11]int8 at bp+8, 11
 34266  
 34267  	var i int32
 34268  	z = sqlite3.Xsqlite3_value_text(tls, pVal)
 34269  	mode = u32(0)
 34270  	if !(z == uintptr(0)) {
 34271  		goto __1
 34272  	}
 34273  	mode = func() uint32 {
 34274  		if bIsDir != 0 {
 34275  			return (uint32(S_IFDIR + 0755))
 34276  		}
 34277  		return (uint32(S_IFREG + 0644))
 34278  	}()
 34279  	goto __2
 34280  __1:
 34281  	if !((int32(*(*int8)(unsafe.Pointer(z))) >= '0') && (int32(*(*int8)(unsafe.Pointer(z))) <= '9')) {
 34282  		goto __3
 34283  	}
 34284  	mode = uint32(sqlite3.Xsqlite3_value_int(tls, pVal))
 34285  	goto __4
 34286  __3:
 34287  	*(*[11]int8)(unsafe.Pointer(bp + 8 /* zTemplate */)) = *(*[11]int8)(unsafe.Pointer(ts + 9354 /* "-rwxrwxrwx" */))
 34288  	if !(libc.Xstrlen(tls, z) != size_t(10)) {
 34289  		goto __5
 34290  	}
 34291  	goto parse_error
 34292  __5:
 34293  	;
 34294  	switch int32(*(*int8)(unsafe.Pointer(z))) {
 34295  	case '-':
 34296  		goto __7
 34297  	case 'd':
 34298  		goto __8
 34299  	case 'l':
 34300  		goto __9
 34301  	default:
 34302  		goto __10
 34303  	}
 34304  	goto __6
 34305  __7:
 34306  	mode = mode | (u32(S_IFREG))
 34307  	goto __6
 34308  __8:
 34309  	mode = mode | (u32(S_IFDIR))
 34310  	goto __6
 34311  __9:
 34312  	mode = mode | (u32(S_IFLNK))
 34313  	goto __6
 34314  __10:
 34315  	goto parse_error
 34316  __6:
 34317  	;
 34318  	i = 1
 34319  __11:
 34320  	if !(i < 10) {
 34321  		goto __13
 34322  	}
 34323  	if !(int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zTemplate[0] */ + uintptr(i))))) {
 34324  		goto __14
 34325  	}
 34326  	mode = mode | (u32(int32(1) << (9 - i)))
 34327  	goto __15
 34328  __14:
 34329  	if !(int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '-') {
 34330  		goto __16
 34331  	}
 34332  	goto parse_error
 34333  __16:
 34334  	;
 34335  __15:
 34336  	;
 34337  	goto __12
 34338  __12:
 34339  	i++
 34340  	goto __11
 34341  	goto __13
 34342  __13:
 34343  	;
 34344  __4:
 34345  	;
 34346  __2:
 34347  	;
 34348  	if !((libc.Bool32((mode & u32(S_IFDIR)) == u32(0))) == bIsDir) {
 34349  		goto __17
 34350  	}
 34351  	// The "mode" attribute is a directory, but data has been specified.
 34352  	// Or vice-versa - no data but "mode" is a file or symlink.
 34353  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9365 /* "zipfile: mode do..." */, 0)
 34354  	return SQLITE_CONSTRAINT
 34355  __17:
 34356  	;
 34357  	*(*u32)(unsafe.Pointer(pMode)) = mode
 34358  	return SQLITE_OK
 34359  
 34360  parse_error:
 34361  	*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+9399 /* "zipfile: parse e..." */, libc.VaList(bp, z))
 34362  	return SQLITE_ERROR
 34363  }
 34364  
 34365  //
 34366  // Both (const char*) arguments point to nul-terminated strings. Argument
 34367  // nB is the value of strlen(zB). This function returns 0 if the strings are
 34368  // identical, ignoring any trailing '/' character in either path.
 34369  func zipfileComparePath(tls *libc.TLS, zA uintptr, zB uintptr, nB int32) int32 { /* zipfile.c:1441:12: */
 34370  	var nA int32 = int32(libc.Xstrlen(tls, zA))
 34371  	if (nA > 0) && (int32(*(*int8)(unsafe.Pointer(zA + uintptr((nA - 1))))) == '/') {
 34372  		nA--
 34373  	}
 34374  	if (nB > 0) && (int32(*(*int8)(unsafe.Pointer(zB + uintptr((nB - 1))))) == '/') {
 34375  		nB--
 34376  	}
 34377  	if (nA == nB) && (libc.Xmemcmp(tls, zA, zB, uint32(nA)) == 0) {
 34378  		return 0
 34379  	}
 34380  	return 1
 34381  }
 34382  
 34383  func zipfileBegin(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1449:12: */
 34384  	bp := tls.Alloc(8)
 34385  	defer tls.Free(8)
 34386  
 34387  	var pTab uintptr = pVtab
 34388  	var rc int32 = SQLITE_OK
 34389  
 34390  	if ((*ZipfileTab)(unsafe.Pointer(pTab)).FzFile == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer((*ZipfileTab)(unsafe.Pointer(pTab)).FzFile))) == 0) {
 34391  		(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+9432 /* "zipfile: missing..." */, 0)
 34392  		return SQLITE_ERROR
 34393  	}
 34394  
 34395  	// Open a write fd on the file. Also load the entire central directory
 34396  	// structure into memory. During the transaction any new file data is
 34397  	// appended to the archive file, but the central directory is accumulated
 34398  	// in main-memory until the transaction is committed.
 34399  	(*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd = libc.Xfopen(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile, ts+9458 /* "ab+" */)
 34400  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd == uintptr(0) {
 34401  		(*ZipfileTab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls,
 34402  			ts+9462 /* "zipfile: failed ..." */, libc.VaList(bp, (*ZipfileTab)(unsafe.Pointer(pTab)).FzFile))
 34403  		rc = SQLITE_ERROR
 34404  	} else {
 34405  		libc.Xfseek(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd, 0, SEEK_END)
 34406  		(*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent = libc.AssignPtrInt64(pTab+64 /* &.szOrig */, i64(libc.Xftell(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd)))
 34407  		rc = zipfileLoadDirectory(tls, pTab, uintptr(0), 0)
 34408  	}
 34409  
 34410  	if rc != SQLITE_OK {
 34411  		zipfileCleanupTransaction(tls, pTab)
 34412  	}
 34413  
 34414  	return rc
 34415  }
 34416  
 34417  // Return the current time as a 32-bit timestamp in UNIX epoch format (like
 34418  // time(2)).
 34419  func zipfileTime(tls *libc.TLS) u32 { /* zipfile.c:1486:12: */
 34420  	bp := tls.Alloc(16)
 34421  	defer tls.Free(16)
 34422  
 34423  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 34424  	var ret u32
 34425  	if pVfs == uintptr(0) {
 34426  		return u32(0)
 34427  	}
 34428  	if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion >= 2) && ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxCurrentTimeInt64 != 0) {
 34429  		// var ms i64 at bp, 8
 34430  
 34431  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 72 /* &.xCurrentTimeInt64 */))))(tls, pVfs, bp /* &ms */)
 34432  		ret = (u32((*(*i64)(unsafe.Pointer(bp /* ms */)) / int64(1000)) - (int64(24405875) * int64(8640))))
 34433  	} else {
 34434  		// var day float64 at bp+8, 8
 34435  
 34436  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 64 /* &.xCurrentTime */))))(tls, pVfs, bp+8 /* &day */)
 34437  		ret = (u32((*(*float64)(unsafe.Pointer(bp + 8 /* day */)) - 2440587.5) * float64(86400)))
 34438  	}
 34439  	return ret
 34440  }
 34441  
 34442  // Return a 32-bit timestamp in UNIX epoch format.
 34443  //
 34444  // If the value passed as the only argument is either NULL or an SQL NULL,
 34445  // return the current time. Otherwise, return the value stored in (*pVal)
 34446  // cast to a 32-bit unsigned integer.
 34447  func zipfileGetTime(tls *libc.TLS, pVal uintptr) u32 { /* zipfile.c:1509:12: */
 34448  	if (pVal == uintptr(0)) || (sqlite3.Xsqlite3_value_type(tls, pVal) == SQLITE_NULL) {
 34449  		return zipfileTime(tls)
 34450  	}
 34451  	return u32(sqlite3.Xsqlite3_value_int64(tls, pVal))
 34452  }
 34453  
 34454  // Unless it is NULL, entry pOld is currently part of the pTab->pFirstEntry
 34455  // linked list.  Remove it from the list and free the object.
 34456  func zipfileRemoveEntryFromList(tls *libc.TLS, pTab uintptr, pOld uintptr) { /* zipfile.c:1520:13: */
 34457  	if pOld != 0 {
 34458  		var pp uintptr
 34459  		for pp = (pTab + 40 /* &.pFirstEntry */); (*(*uintptr)(unsafe.Pointer(pp))) != pOld; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 68 /* &.pNext */) {
 34460  		}
 34461  		*(*uintptr)(unsafe.Pointer(pp)) = (*ZipfileEntry)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext
 34462  		zipfileEntryFree(tls, pOld)
 34463  	}
 34464  }
 34465  
 34466  // xUpdate method.
 34467  func zipfileUpdate(tls *libc.TLS, pVtab uintptr, nVal int32, apVal uintptr, pRowid uintptr) int32 { /* zipfile.c:1532:12: */
 34468  	bp := tls.Alloc(36)
 34469  	defer tls.Free(36)
 34470  
 34471  	var pTab uintptr
 34472  	var rc int32     // Return Code
 34473  	var pNew uintptr // New in-memory CDS entry
 34474  
 34475  	// var mode u32 at bp+32, 4
 34476  	// Mode for new entry
 34477  	var mTime u32     // Modification time for new entry
 34478  	var sz i64        // Uncompressed size
 34479  	var zPath uintptr // Path for new entry
 34480  	var nPath int32   // strlen(zPath)
 34481  	var pData uintptr // Pointer to buffer containing content
 34482  	var nData int32   // Size of pData buffer in bytes
 34483  	var iMethod int32 // Compression method for new entry
 34484  	// var pFree uintptr at bp+24, 4
 34485  	// Free this
 34486  	var zFree uintptr // Also free this
 34487  	var pOld uintptr
 34488  	var pOld2 uintptr
 34489  	var bUpdate int32 // True for an update that modifies "name"
 34490  	var bIsDir int32
 34491  	var iCrc32 u32
 34492  	var zUpdate uintptr
 34493  	var zDelete uintptr
 34494  	var nDelete int32
 34495  	// var nCmp int32 at bp+28, 4
 34496  
 34497  	// Value specified for "data", and possibly "method". This must be
 34498  	// a regular file or a symlink.
 34499  	var aIn uintptr
 34500  	var nIn int32
 34501  	var bAuto int32
 34502  	var p uintptr
 34503  	var pCsr uintptr
 34504  	pTab = pVtab
 34505  	rc = SQLITE_OK
 34506  	pNew = uintptr(0)
 34507  	*(*u32)(unsafe.Pointer(bp + 32 /* mode */)) = u32(0)
 34508  	mTime = u32(0)
 34509  	sz = int64(0)
 34510  	zPath = uintptr(0)
 34511  	nPath = 0
 34512  	pData = uintptr(0)
 34513  	nData = 0
 34514  	iMethod = 0
 34515  	*(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */)) = uintptr(0)
 34516  	zFree = uintptr(0)
 34517  	pOld = uintptr(0)
 34518  	pOld2 = uintptr(0)
 34519  	bUpdate = 0
 34520  	bIsDir = 0
 34521  	iCrc32 = u32(0)
 34522  
 34523  	if !((*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd == uintptr(0)) {
 34524  		goto __1
 34525  	}
 34526  	rc = zipfileBegin(tls, pVtab)
 34527  	if !(rc != SQLITE_OK) {
 34528  		goto __2
 34529  	}
 34530  	return rc
 34531  __2:
 34532  	;
 34533  __1:
 34534  	;
 34535  
 34536  	// If this is a DELETE or UPDATE, find the archive entry to delete.
 34537  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal))) != SQLITE_NULL) {
 34538  		goto __3
 34539  	}
 34540  	zDelete = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 34541  	nDelete = int32(libc.Xstrlen(tls, zDelete))
 34542  	if !(nVal > 1) {
 34543  		goto __4
 34544  	}
 34545  	zUpdate = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 1*4)))
 34546  	if !((zUpdate != 0) && (zipfileComparePath(tls, zUpdate, zDelete, nDelete) != 0)) {
 34547  		goto __5
 34548  	}
 34549  	bUpdate = 1
 34550  __5:
 34551  	;
 34552  __4:
 34553  	;
 34554  	pOld = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 34555  __6:
 34556  	if !(1 != 0) {
 34557  		goto __8
 34558  	}
 34559  	if !(zipfileComparePath(tls, (*ZipfileEntry)(unsafe.Pointer(pOld)).Fcds.FzFile, zDelete, nDelete) == 0) {
 34560  		goto __9
 34561  	}
 34562  	goto __8
 34563  __9:
 34564  	;
 34565  
 34566  	goto __7
 34567  __7:
 34568  	pOld = (*ZipfileEntry)(unsafe.Pointer(pOld)).FpNext
 34569  	goto __6
 34570  	goto __8
 34571  __8:
 34572  	;
 34573  __3:
 34574  	;
 34575  
 34576  	if !(nVal > 1) {
 34577  		goto __10
 34578  	}
 34579  	// Check that "sz" and "rawdata" are both NULL:
 34580  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 5*4))) != SQLITE_NULL) {
 34581  		goto __11
 34582  	}
 34583  	zipfileTableErr(tls, pTab, ts+9506 /* "sz must be NULL" */, 0)
 34584  	rc = SQLITE_CONSTRAINT
 34585  __11:
 34586  	;
 34587  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 6*4))) != SQLITE_NULL) {
 34588  		goto __12
 34589  	}
 34590  	zipfileTableErr(tls, pTab, ts+9522 /* "rawdata must be ..." */, 0)
 34591  	rc = SQLITE_CONSTRAINT
 34592  __12:
 34593  	;
 34594  
 34595  	if !(rc == SQLITE_OK) {
 34596  		goto __13
 34597  	}
 34598  	if !(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*4))) == SQLITE_NULL) {
 34599  		goto __14
 34600  	}
 34601  	// data=NULL. A directory
 34602  	bIsDir = 1
 34603  	goto __15
 34604  __14:
 34605  	// Value specified for "data", and possibly "method". This must be
 34606  	// a regular file or a symlink.
 34607  	aIn = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*4)))
 34608  	nIn = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal + 7*4)))
 34609  	bAuto = (libc.Bool32(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apVal + 8*4))) == SQLITE_NULL))
 34610  
 34611  	iMethod = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(apVal + 8*4)))
 34612  	sz = i64(nIn)
 34613  	pData = aIn
 34614  	nData = nIn
 34615  	if !((iMethod != 0) && (iMethod != 8)) {
 34616  		goto __16
 34617  	}
 34618  	zipfileTableErr(tls, pTab, ts+9543 /* "unknown compress..." */, libc.VaList(bp, iMethod))
 34619  	rc = SQLITE_CONSTRAINT
 34620  	goto __17
 34621  __16:
 34622  	if !((bAuto != 0) || (iMethod != 0)) {
 34623  		goto __18
 34624  	}
 34625  	rc = zipfileDeflate(tls, aIn, nIn, bp+24 /* &pFree */, bp+28 /* &nCmp */, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 34626  	if !(rc == SQLITE_OK) {
 34627  		goto __19
 34628  	}
 34629  	if !((iMethod != 0) || (*(*int32)(unsafe.Pointer(bp + 28 /* nCmp */)) < nIn)) {
 34630  		goto __20
 34631  	}
 34632  	iMethod = 8
 34633  	pData = *(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */))
 34634  	nData = *(*int32)(unsafe.Pointer(bp + 28 /* nCmp */))
 34635  __20:
 34636  	;
 34637  __19:
 34638  	;
 34639  __18:
 34640  	;
 34641  	iCrc32 = u32(tcl.Xcrc32(tls, uint32(0), aIn, uint32(nIn)))
 34642  __17:
 34643  	;
 34644  __15:
 34645  	;
 34646  __13:
 34647  	;
 34648  
 34649  	if !(rc == SQLITE_OK) {
 34650  		goto __21
 34651  	}
 34652  	rc = zipfileGetMode(tls, *(*uintptr)(unsafe.Pointer(apVal + 3*4)), bIsDir, bp+32 /* &mode */, (pTab /* &.base */ + 8 /* &.zErrMsg */))
 34653  __21:
 34654  	;
 34655  
 34656  	if !(rc == SQLITE_OK) {
 34657  		goto __22
 34658  	}
 34659  	zPath = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apVal + 2*4)))
 34660  	if !(zPath == uintptr(0)) {
 34661  		goto __23
 34662  	}
 34663  	zPath = ts + 489 /* "" */
 34664  __23:
 34665  	;
 34666  	nPath = int32(libc.Xstrlen(tls, zPath))
 34667  	mTime = zipfileGetTime(tls, *(*uintptr)(unsafe.Pointer(apVal + 4*4)))
 34668  __22:
 34669  	;
 34670  
 34671  	if !((rc == SQLITE_OK) && (bIsDir != 0)) {
 34672  		goto __24
 34673  	}
 34674  	// For a directory, check that the last character in the path is a
 34675  	// '/'. This appears to be required for compatibility with info-zip
 34676  	// (the unzip command on unix). It does not create directories
 34677  	// otherwise.
 34678  	if !((nPath <= 0) || (int32(*(*int8)(unsafe.Pointer(zPath + uintptr((nPath - 1))))) != '/')) {
 34679  		goto __25
 34680  	}
 34681  	zFree = sqlite3.Xsqlite3_mprintf(tls, ts+9574 /* "%s/" */, libc.VaList(bp+8, zPath))
 34682  	zPath = zFree
 34683  	if !(zFree == uintptr(0)) {
 34684  		goto __26
 34685  	}
 34686  	rc = SQLITE_NOMEM
 34687  	nPath = 0
 34688  	goto __27
 34689  __26:
 34690  	nPath = int32(libc.Xstrlen(tls, zPath))
 34691  __27:
 34692  	;
 34693  __25:
 34694  	;
 34695  __24:
 34696  	;
 34697  
 34698  	// Check that we're not inserting a duplicate entry -OR- updating an
 34699  	// entry with a path, thereby making it into a duplicate.
 34700  	if !(((pOld == uintptr(0)) || (bUpdate != 0)) && (rc == SQLITE_OK)) {
 34701  		goto __28
 34702  	}
 34703  	p = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry
 34704  __29:
 34705  	if !(p != 0) {
 34706  		goto __31
 34707  	}
 34708  	if !(zipfileComparePath(tls, (*ZipfileEntry)(unsafe.Pointer(p)).Fcds.FzFile, zPath, nPath) == 0) {
 34709  		goto __32
 34710  	}
 34711  	switch sqlite3.Xsqlite3_vtab_on_conflict(tls, (*ZipfileTab)(unsafe.Pointer(pTab)).Fdb) {
 34712  	case SQLITE_IGNORE:
 34713  		goto __34
 34714  	case SQLITE_REPLACE:
 34715  		goto __35
 34716  	default:
 34717  		goto __36
 34718  	}
 34719  	goto __33
 34720  __34:
 34721  	goto zipfile_update_done
 34722  
 34723  __35:
 34724  	pOld2 = p
 34725  	goto __33
 34726  
 34727  __36:
 34728  	zipfileTableErr(tls, pTab, ts+9578 /* "duplicate name: ..." */, libc.VaList(bp+16, zPath))
 34729  	rc = SQLITE_CONSTRAINT
 34730  	goto __33
 34731  
 34732  __33:
 34733  	;
 34734  	goto __31
 34735  __32:
 34736  	;
 34737  	goto __30
 34738  __30:
 34739  	p = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext
 34740  	goto __29
 34741  	goto __31
 34742  __31:
 34743  	;
 34744  __28:
 34745  	;
 34746  
 34747  	if !(rc == SQLITE_OK) {
 34748  		goto __37
 34749  	}
 34750  	// Create the new CDS record.
 34751  	pNew = zipfileNewEntry(tls, zPath)
 34752  	if !(pNew == uintptr(0)) {
 34753  		goto __38
 34754  	}
 34755  	rc = SQLITE_NOMEM
 34756  	goto __39
 34757  __38:
 34758  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiVersionMadeBy = (u16((int32(3) << 8) + 30))
 34759  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiVersionExtract = u16(ZIPFILE_NEWENTRY_REQUIRED)
 34760  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.Fflags = u16(ZIPFILE_NEWENTRY_FLAGS)
 34761  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiCompression = u16(iMethod)
 34762  	zipfileMtimeToDos(tls, (pNew /* &.cds */), mTime)
 34763  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.Fcrc32 = iCrc32
 34764  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszCompressed = u32(nData)
 34765  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FszUncompressed = u32(sz)
 34766  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiExternalAttr = (*(*u32)(unsafe.Pointer(bp + 32 /* mode */)) << 16)
 34767  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FiOffset = u32((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent)
 34768  	(*ZipfileEntry)(unsafe.Pointer(pNew)).Fcds.FnFile = u16(nPath)
 34769  	(*ZipfileEntry)(unsafe.Pointer(pNew)).FmUnixTime = mTime
 34770  	rc = zipfileAppendEntry(tls, pTab, pNew, pData, nData)
 34771  	zipfileAddEntry(tls, pTab, pOld, pNew)
 34772  __39:
 34773  	;
 34774  __37:
 34775  	;
 34776  __10:
 34777  	;
 34778  
 34779  	if !((rc == SQLITE_OK) && ((pOld != 0) || (pOld2 != 0))) {
 34780  		goto __40
 34781  	}
 34782  	pCsr = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList
 34783  __41:
 34784  	if !(pCsr != 0) {
 34785  		goto __43
 34786  	}
 34787  	if !(((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent != 0) && (((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == pOld) || ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent == pOld2))) {
 34788  		goto __44
 34789  	}
 34790  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent = (*ZipfileEntry)(unsafe.Pointer((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent)).FpNext
 34791  	(*ZipfileCsr)(unsafe.Pointer(pCsr)).FbNoop = u8(1)
 34792  __44:
 34793  	;
 34794  	goto __42
 34795  __42:
 34796  	pCsr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext
 34797  	goto __41
 34798  	goto __43
 34799  __43:
 34800  	;
 34801  
 34802  	zipfileRemoveEntryFromList(tls, pTab, pOld)
 34803  	zipfileRemoveEntryFromList(tls, pTab, pOld2)
 34804  __40:
 34805  	;
 34806  
 34807  zipfile_update_done:
 34808  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pFree */)))
 34809  	sqlite3.Xsqlite3_free(tls, zFree)
 34810  	return rc
 34811  }
 34812  
 34813  func zipfileSerializeEOCD(tls *libc.TLS, p uintptr, aBuf uintptr) int32 { /* zipfile.c:1723:12: */
 34814  	var a uintptr = aBuf
 34815  	{
 34816  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_EOCD))
 34817  		a += uintptr(4)
 34818  	}
 34819  
 34820  	{
 34821  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiDisk)
 34822  		a += uintptr(2)
 34823  	}
 34824  
 34825  	{
 34826  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiFirstDisk)
 34827  		a += uintptr(2)
 34828  	}
 34829  
 34830  	{
 34831  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnEntry)
 34832  		a += uintptr(2)
 34833  	}
 34834  
 34835  	{
 34836  		zipfilePutU16(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnEntryTotal)
 34837  		a += uintptr(2)
 34838  	}
 34839  
 34840  	{
 34841  		zipfilePutU32(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FnSize)
 34842  		a += uintptr(4)
 34843  	}
 34844  
 34845  	{
 34846  		zipfilePutU32(tls, a, (*ZipfileEOCD)(unsafe.Pointer(p)).FiOffset)
 34847  		a += uintptr(4)
 34848  	}
 34849  
 34850  	{
 34851  		zipfilePutU16(tls, a, uint16(0))
 34852  		a += uintptr(2)
 34853  	}
 34854  	// Size of trailing comment in bytes
 34855  
 34856  	return ((int32(a) - int32(aBuf)) / 1)
 34857  }
 34858  
 34859  func zipfileAppendEOCD(tls *libc.TLS, pTab uintptr, p uintptr) int32 { /* zipfile.c:1737:12: */
 34860  	var nBuf int32 = zipfileSerializeEOCD(tls, p, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer)
 34861  
 34862  	return zipfileAppendData(tls, pTab, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer, nBuf)
 34863  }
 34864  
 34865  // Serialize the CDS structure into buffer aBuf[]. Return the number
 34866  // of bytes written.
 34867  func zipfileSerializeCDS(tls *libc.TLS, pEntry uintptr, aBuf uintptr) int32 { /* zipfile.c:1747:12: */
 34868  	var a uintptr = aBuf
 34869  	var pCDS uintptr = (pEntry /* &.cds */)
 34870  
 34871  	if (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra == uintptr(0) {
 34872  		(*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra = u16(9)
 34873  	}
 34874  
 34875  	{
 34876  		zipfilePutU32(tls, a, uint32(ZIPFILE_SIGNATURE_CDS))
 34877  		a += uintptr(4)
 34878  	}
 34879  
 34880  	{
 34881  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionMadeBy)
 34882  		a += uintptr(2)
 34883  	}
 34884  
 34885  	{
 34886  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiVersionExtract)
 34887  		a += uintptr(2)
 34888  	}
 34889  
 34890  	{
 34891  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).Fflags)
 34892  		a += uintptr(2)
 34893  	}
 34894  
 34895  	{
 34896  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiCompression)
 34897  		a += uintptr(2)
 34898  	}
 34899  
 34900  	{
 34901  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FmTime)
 34902  		a += uintptr(2)
 34903  	}
 34904  
 34905  	{
 34906  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FmDate)
 34907  		a += uintptr(2)
 34908  	}
 34909  
 34910  	{
 34911  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).Fcrc32)
 34912  		a += uintptr(4)
 34913  	}
 34914  
 34915  	{
 34916  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FszCompressed)
 34917  		a += uintptr(4)
 34918  	}
 34919  
 34920  	{
 34921  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FszUncompressed)
 34922  		a += uintptr(4)
 34923  	}
 34924  
 34925  	{
 34926  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile)
 34927  		a += uintptr(2)
 34928  	}
 34929  
 34930  	{
 34931  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra)
 34932  		a += uintptr(2)
 34933  	}
 34934  
 34935  	{
 34936  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment)
 34937  		a += uintptr(2)
 34938  	}
 34939  
 34940  	{
 34941  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiDiskStart)
 34942  		a += uintptr(2)
 34943  	}
 34944  
 34945  	{
 34946  		zipfilePutU16(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiInternalAttr)
 34947  		a += uintptr(2)
 34948  	}
 34949  
 34950  	{
 34951  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiExternalAttr)
 34952  		a += uintptr(4)
 34953  	}
 34954  
 34955  	{
 34956  		zipfilePutU32(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FiOffset)
 34957  		a += uintptr(4)
 34958  	}
 34959  
 34960  	libc.Xmemcpy(tls, a, (*ZipfileCDS)(unsafe.Pointer(pCDS)).FzFile, uint32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile))
 34961  	a += uintptr((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnFile)
 34962  
 34963  	if (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra != 0 {
 34964  		var n int32 = (int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnExtra) + int32((*ZipfileCDS)(unsafe.Pointer(pCDS)).FnComment))
 34965  		libc.Xmemcpy(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FaExtra, uint32(n))
 34966  		a += uintptr(n)
 34967  	} else {
 34968  
 34969  		{
 34970  			zipfilePutU16(tls, a, uint16(ZIPFILE_EXTRA_TIMESTAMP))
 34971  			a += uintptr(2)
 34972  		}
 34973  
 34974  		{
 34975  			zipfilePutU16(tls, a, uint16(5))
 34976  			a += uintptr(2)
 34977  		}
 34978  
 34979  		*(*u8)(unsafe.Pointer(libc.PostIncUintptr(&a, 1))) = u8(0x01)
 34980  		{
 34981  			zipfilePutU32(tls, a, (*ZipfileEntry)(unsafe.Pointer(pEntry)).FmUnixTime)
 34982  			a += uintptr(4)
 34983  		}
 34984  
 34985  	}
 34986  
 34987  	return ((int32(a) - int32(aBuf)) / 1)
 34988  }
 34989  
 34990  func zipfileCommit(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1792:12: */
 34991  	bp := tls.Alloc(16)
 34992  	defer tls.Free(16)
 34993  
 34994  	var pTab uintptr = pVtab
 34995  	var rc int32 = SQLITE_OK
 34996  	if (*ZipfileTab)(unsafe.Pointer(pTab)).FpWriteFd != 0 {
 34997  		var iOffset i64 = (*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent
 34998  		var p uintptr
 34999  		// var eocd ZipfileEOCD at bp, 16
 35000  
 35001  		var nEntry int32 = 0
 35002  
 35003  		// Write out all entries
 35004  		for p = (*ZipfileTab)(unsafe.Pointer(pTab)).FpFirstEntry; (rc == SQLITE_OK) && (p != 0); p = (*ZipfileEntry)(unsafe.Pointer(p)).FpNext {
 35005  			var n int32 = zipfileSerializeCDS(tls, p, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer)
 35006  			rc = zipfileAppendData(tls, pTab, (*ZipfileTab)(unsafe.Pointer(pTab)).FaBuffer, n)
 35007  			nEntry++
 35008  		}
 35009  
 35010  		// Write out the EOCD record
 35011  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiDisk = u16(0)
 35012  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiFirstDisk = u16(0)
 35013  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry = u16(nEntry)
 35014  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntryTotal = u16(nEntry)
 35015  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnSize = (u32((*ZipfileTab)(unsafe.Pointer(pTab)).FszCurrent - iOffset))
 35016  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset = u32(iOffset)
 35017  		rc = zipfileAppendEOCD(tls, pTab, bp /* &eocd */)
 35018  
 35019  		zipfileCleanupTransaction(tls, pTab)
 35020  	}
 35021  	return rc
 35022  }
 35023  
 35024  func zipfileRollback(tls *libc.TLS, pVtab uintptr) int32 { /* zipfile.c:1822:12: */
 35025  	return zipfileCommit(tls, pVtab)
 35026  }
 35027  
 35028  func zipfileFindCursor(tls *libc.TLS, pTab uintptr, iId i64) uintptr { /* zipfile.c:1826:19: */
 35029  	var pCsr uintptr
 35030  	for pCsr = (*ZipfileTab)(unsafe.Pointer(pTab)).FpCsrList; pCsr != 0; pCsr = (*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCsrNext {
 35031  		if iId == (*ZipfileCsr)(unsafe.Pointer(pCsr)).FiId {
 35032  			break
 35033  		}
 35034  	}
 35035  	return pCsr
 35036  }
 35037  
 35038  func zipfileFunctionCds(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* zipfile.c:1834:13: */
 35039  	bp := tls.Alloc(128)
 35040  	defer tls.Free(128)
 35041  
 35042  	var pCsr uintptr
 35043  	var pTab uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 35044  
 35045  	pCsr = zipfileFindCursor(tls, pTab, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv))))
 35046  	if pCsr != 0 {
 35047  		var p uintptr = ((*ZipfileCsr)(unsafe.Pointer(pCsr)).FpCurrent /* &.cds */)
 35048  		var zRes uintptr = sqlite3.Xsqlite3_mprintf(tls,
 35049  
 35050  			ts+9599, /* "{\"version-made-b..." */
 35051  			libc.VaList(bp, u32((*ZipfileCDS)(unsafe.Pointer(p)).FiVersionMadeBy), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiVersionExtract),
 35052  				u32((*ZipfileCDS)(unsafe.Pointer(p)).Fflags), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiCompression),
 35053  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FmTime), u32((*ZipfileCDS)(unsafe.Pointer(p)).FmDate),
 35054  				(*ZipfileCDS)(unsafe.Pointer(p)).Fcrc32, (*ZipfileCDS)(unsafe.Pointer(p)).FszCompressed,
 35055  				(*ZipfileCDS)(unsafe.Pointer(p)).FszUncompressed, u32((*ZipfileCDS)(unsafe.Pointer(p)).FnFile),
 35056  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FnExtra), u32((*ZipfileCDS)(unsafe.Pointer(p)).FnComment),
 35057  				u32((*ZipfileCDS)(unsafe.Pointer(p)).FiDiskStart), u32((*ZipfileCDS)(unsafe.Pointer(p)).FiInternalAttr),
 35058  				(*ZipfileCDS)(unsafe.Pointer(p)).FiExternalAttr, (*ZipfileCDS)(unsafe.Pointer(p)).FiOffset))
 35059  
 35060  		if zRes == uintptr(0) {
 35061  			sqlite3.Xsqlite3_result_error_nomem(tls, context)
 35062  		} else {
 35063  			sqlite3.Xsqlite3_result_text(tls, context, zRes, -1, libc.UintptrFromInt32(-1))
 35064  			sqlite3.Xsqlite3_free(tls, zRes)
 35065  		}
 35066  	}
 35067  }
 35068  
 35069  // xFindFunction method.
 35070  func zipfileFindFunction(tls *libc.TLS, pVtab uintptr, nArg int32, zName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* zipfile.c:1885:12: */
 35071  	if sqlite3.Xsqlite3_stricmp(tls, ts+9941 /* "zipfile_cds" */, zName) == 0 {
 35072  		*(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct {
 35073  			f func(*libc.TLS, uintptr, int32, uintptr)
 35074  		}{zipfileFunctionCds}))
 35075  		*(*uintptr)(unsafe.Pointer(ppArg)) = pVtab
 35076  		return 1
 35077  	}
 35078  	return 0
 35079  }
 35080  
 35081  type ZipfileBuffer1 = struct {
 35082  	Fa      uintptr
 35083  	Fn      int32
 35084  	FnAlloc int32
 35085  } /* zipfile.c:1900:9 */
 35086  
 35087  type ZipfileBuffer = ZipfileBuffer1 /* zipfile.c:1900:30 */
 35088  
 35089  type ZipfileCtx1 = struct {
 35090  	FnEntry int32
 35091  	Fbody   ZipfileBuffer
 35092  	Fcds    ZipfileBuffer
 35093  } /* zipfile.c:1907:9 */
 35094  
 35095  type ZipfileCtx = ZipfileCtx1 /* zipfile.c:1907:27 */
 35096  
 35097  func zipfileBufferGrow(tls *libc.TLS, pBuf uintptr, nByte int32) int32 { /* zipfile.c:1914:12: */
 35098  	if ((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn + nByte) > (*ZipfileBuffer)(unsafe.Pointer(pBuf)).FnAlloc {
 35099  		var aNew uintptr
 35100  		var nNew sqlite3_int64
 35101  		if (*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn != 0 {
 35102  			nNew = (int64((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn * 2))
 35103  		} else {
 35104  			nNew = int64(512)
 35105  		}
 35106  		var nReq int32 = ((*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fn + nByte)
 35107  
 35108  		for nNew < sqlite3_int64(nReq) {
 35109  			nNew = (nNew * int64(2))
 35110  		}
 35111  		aNew = sqlite3.Xsqlite3_realloc64(tls, (*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fa, uint64(nNew))
 35112  		if aNew == uintptr(0) {
 35113  			return SQLITE_NOMEM
 35114  		}
 35115  		(*ZipfileBuffer)(unsafe.Pointer(pBuf)).Fa = aNew
 35116  		(*ZipfileBuffer)(unsafe.Pointer(pBuf)).FnAlloc = int32(nNew)
 35117  	}
 35118  	return SQLITE_OK
 35119  }
 35120  
 35121  // xStep() callback for the zipfile() aggregate. This can be called in
 35122  // any of the following ways:
 35123  //
 35124  //   SELECT zipfile(name,data) ...
 35125  //   SELECT zipfile(name,mode,mtime,data) ...
 35126  //   SELECT zipfile(name,mode,mtime,data,method) ...
 35127  func zipfileStep(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* zipfile.c:1937:6: */
 35128  	bp := tls.Alloc(104)
 35129  	defer tls.Free(104)
 35130  
 35131  	var p uintptr // Aggregate function context
 35132  	// var e ZipfileEntry at bp+16, 72
 35133  	// New entry to add to zip archive
 35134  
 35135  	var pName uintptr
 35136  	var pMode uintptr
 35137  	var pMtime uintptr
 35138  	var pData uintptr
 35139  	var pMethod uintptr
 35140  	var bIsDir int32
 35141  	// var mode u32 at bp+100, 4
 35142  
 35143  	var rc int32
 35144  	// var zErr uintptr at bp+96, 4
 35145  
 35146  	var iMethod int32 // Compression method to use (0 or 8)
 35147  
 35148  	var aData uintptr        // Possibly compressed data for new entry
 35149  	var nData int32          // Size of aData[] in bytes
 35150  	var szUncompressed int32 // Size of data before compression
 35151  	// var aFree uintptr at bp+88, 4
 35152  	// Free this before returning
 35153  	var iCrc32 u32 // crc32 of uncompressed data
 35154  
 35155  	var zName uintptr // Path (name) of new entry
 35156  	var nName int32   // Size of zName in bytes
 35157  	var zFree uintptr // Free this before returning
 35158  	var nByte int32
 35159  	// var nOut int32 at bp+92, 4
 35160  	pName = uintptr(0)
 35161  	pMode = uintptr(0)
 35162  	pMtime = uintptr(0)
 35163  	pData = uintptr(0)
 35164  	pMethod = uintptr(0)
 35165  	bIsDir = 0
 35166  	rc = SQLITE_OK
 35167  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = uintptr(0)
 35168  	iMethod = -1
 35169  	aData = uintptr(0)
 35170  	nData = 0
 35171  	szUncompressed = 0
 35172  	*(*uintptr)(unsafe.Pointer(bp + 88 /* aFree */)) = uintptr(0)
 35173  	iCrc32 = u32(0)
 35174  	zName = uintptr(0)
 35175  	nName = 0
 35176  	zFree = uintptr(0)
 35177  
 35178  	libc.Xmemset(tls, bp+16 /* &e */, 0, uint32(unsafe.Sizeof(ZipfileEntry{})))
 35179  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(ZipfileCtx{})))
 35180  	if !(p == uintptr(0)) {
 35181  		goto __1
 35182  	}
 35183  	return
 35184  __1:
 35185  	;
 35186  
 35187  	// Martial the arguments into stack variables
 35188  	if !(((nVal != 2) && (nVal != 4)) && (nVal != 5)) {
 35189  		goto __2
 35190  	}
 35191  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+9953 /* "wrong number of ..." */, 0)
 35192  	rc = SQLITE_ERROR
 35193  	goto zipfile_step_out
 35194  __2:
 35195  	;
 35196  	pName = *(*uintptr)(unsafe.Pointer(apVal))
 35197  	if !(nVal == 2) {
 35198  		goto __3
 35199  	}
 35200  	pData = *(*uintptr)(unsafe.Pointer(apVal + 1*4))
 35201  	goto __4
 35202  __3:
 35203  	pMode = *(*uintptr)(unsafe.Pointer(apVal + 1*4))
 35204  	pMtime = *(*uintptr)(unsafe.Pointer(apVal + 2*4))
 35205  	pData = *(*uintptr)(unsafe.Pointer(apVal + 3*4))
 35206  	if !(nVal == 5) {
 35207  		goto __5
 35208  	}
 35209  	pMethod = *(*uintptr)(unsafe.Pointer(apVal + 4*4))
 35210  __5:
 35211  	;
 35212  __4:
 35213  	;
 35214  
 35215  	// Check that the 'name' parameter looks ok.
 35216  	zName = sqlite3.Xsqlite3_value_text(tls, pName)
 35217  	nName = sqlite3.Xsqlite3_value_bytes(tls, pName)
 35218  	if !(zName == uintptr(0)) {
 35219  		goto __6
 35220  	}
 35221  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10001 /* "first argument t..." */, 0)
 35222  	rc = SQLITE_ERROR
 35223  	goto zipfile_step_out
 35224  __6:
 35225  	;
 35226  
 35227  	// Inspect the 'method' parameter. This must be either 0 (store), 8 (use
 35228  	// deflate compression) or NULL (choose automatically).
 35229  	if !((pMethod != 0) && (SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, pMethod))) {
 35230  		goto __7
 35231  	}
 35232  	iMethod = int32(sqlite3.Xsqlite3_value_int64(tls, pMethod))
 35233  	if !((iMethod != 0) && (iMethod != 8)) {
 35234  		goto __8
 35235  	}
 35236  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10046 /* "illegal method v..." */, libc.VaList(bp, iMethod))
 35237  	rc = SQLITE_ERROR
 35238  	goto zipfile_step_out
 35239  __8:
 35240  	;
 35241  __7:
 35242  	;
 35243  
 35244  	// Now inspect the data. If this is NULL, then the new entry must be a
 35245  	// directory.  Otherwise, figure out whether or not the data should
 35246  	// be deflated or simply stored in the zip archive.
 35247  	if !(sqlite3.Xsqlite3_value_type(tls, pData) == SQLITE_NULL) {
 35248  		goto __9
 35249  	}
 35250  	bIsDir = 1
 35251  	iMethod = 0
 35252  	goto __10
 35253  __9:
 35254  	aData = sqlite3.Xsqlite3_value_blob(tls, pData)
 35255  	szUncompressed = libc.AssignInt32(&nData, sqlite3.Xsqlite3_value_bytes(tls, pData))
 35256  	iCrc32 = u32(tcl.Xcrc32(tls, uint32(0), aData, uint32(nData)))
 35257  	if !((iMethod < 0) || (iMethod == 8)) {
 35258  		goto __11
 35259  	}
 35260  	*(*int32)(unsafe.Pointer(bp + 92 /* nOut */)) = 0
 35261  	rc = zipfileDeflate(tls, aData, nData, bp+88 /* &aFree */, bp+92 /* &nOut */, bp+96 /* &zErr */)
 35262  	if !(rc != SQLITE_OK) {
 35263  		goto __12
 35264  	}
 35265  	goto zipfile_step_out
 35266  __12:
 35267  	;
 35268  	if !((iMethod == 8) || (*(*int32)(unsafe.Pointer(bp + 92 /* nOut */)) < nData)) {
 35269  		goto __13
 35270  	}
 35271  	aData = *(*uintptr)(unsafe.Pointer(bp + 88 /* aFree */))
 35272  	nData = *(*int32)(unsafe.Pointer(bp + 92 /* nOut */))
 35273  	iMethod = 8
 35274  	goto __14
 35275  __13:
 35276  	iMethod = 0
 35277  __14:
 35278  	;
 35279  __11:
 35280  	;
 35281  __10:
 35282  	;
 35283  
 35284  	// Decode the "mode" argument.
 35285  	rc = zipfileGetMode(tls, pMode, bIsDir, bp+100 /* &mode */, bp+96 /* &zErr */)
 35286  	if !(rc != 0) {
 35287  		goto __15
 35288  	}
 35289  	goto zipfile_step_out
 35290  __15:
 35291  	;
 35292  
 35293  	// Decode the "mtime" argument.
 35294  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).FmUnixTime = zipfileGetTime(tls, pMtime)
 35295  
 35296  	// If this is a directory entry, ensure that there is exactly one '/'
 35297  	// at the end of the path. Or, if this is not a directory and the path
 35298  	// ends in '/' it is an error.
 35299  	if !(bIsDir == 0) {
 35300  		goto __16
 35301  	}
 35302  	if !((nName > 0) && (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 1))))) == '/')) {
 35303  		goto __18
 35304  	}
 35305  	*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) = sqlite3.Xsqlite3_mprintf(tls, ts+10071 /* "non-directory na..." */, 0)
 35306  	rc = SQLITE_ERROR
 35307  	goto zipfile_step_out
 35308  __18:
 35309  	;
 35310  	goto __17
 35311  __16:
 35312  	if !((nName == 0) || (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 1))))) != '/')) {
 35313  		goto __19
 35314  	}
 35315  	zName = libc.AssignUintptr(&zFree, sqlite3.Xsqlite3_mprintf(tls, ts+9574 /* "%s/" */, libc.VaList(bp+8, zName)))
 35316  	if !(zName == uintptr(0)) {
 35317  		goto __21
 35318  	}
 35319  	rc = SQLITE_NOMEM
 35320  	goto zipfile_step_out
 35321  __21:
 35322  	;
 35323  	nName = int32(libc.Xstrlen(tls, zName))
 35324  	goto __20
 35325  __19:
 35326  __22:
 35327  	if !((nName > 1) && (int32(*(*int8)(unsafe.Pointer(zName + uintptr((nName - 2))))) == '/')) {
 35328  		goto __23
 35329  	}
 35330  	nName--
 35331  	goto __22
 35332  __23:
 35333  	;
 35334  __20:
 35335  	;
 35336  __17:
 35337  	;
 35338  
 35339  	// Assemble the ZipfileEntry object for the new zip archive entry
 35340  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiVersionMadeBy = (u16((int32(3) << 8) + 30))
 35341  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiVersionExtract = u16(ZIPFILE_NEWENTRY_REQUIRED)
 35342  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.Fflags = u16(ZIPFILE_NEWENTRY_FLAGS)
 35343  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiCompression = u16(iMethod)
 35344  	zipfileMtimeToDos(tls, (bp + 16 /* &e */ /* &.cds */), (*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).FmUnixTime)
 35345  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.Fcrc32 = iCrc32
 35346  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FszCompressed = u32(nData)
 35347  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FszUncompressed = u32(szUncompressed)
 35348  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiExternalAttr = (*(*u32)(unsafe.Pointer(bp + 100 /* mode */)) << 16)
 35349  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FiOffset = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)
 35350  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FnFile = u16(nName)
 35351  	(*ZipfileEntry)(unsafe.Pointer(bp + 16 /* &e */)).Fcds.FzFile = zName
 35352  
 35353  	// Append the LFH to the body of the new archive
 35354  	nByte = ((ZIPFILE_LFH_FIXED_SZ + int32((*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).Fcds.FnFile)) + 9)
 35355  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+4 /* &.body */), nByte)) != 0) {
 35356  		goto __24
 35357  	}
 35358  	goto zipfile_step_out
 35359  __24:
 35360  	;
 35361  	*(*int32)(unsafe.Pointer(p + 4 /* &.body */ + 4 /* &.n */)) += (zipfileSerializeLFH(tls, bp+16 /* &e */, ((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn))))
 35362  
 35363  	// Append the data to the body of the new archive
 35364  	if !(nData > 0) {
 35365  		goto __25
 35366  	}
 35367  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+4 /* &.body */), nData)) != 0) {
 35368  		goto __26
 35369  	}
 35370  	goto zipfile_step_out
 35371  __26:
 35372  	;
 35373  	libc.Xmemcpy(tls, ((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)), aData, uint32(nData))
 35374  	*(*int32)(unsafe.Pointer(p + 4 /* &.body */ + 4 /* &.n */)) += (nData)
 35375  __25:
 35376  	;
 35377  
 35378  	// Append the CDS record to the directory of the new archive
 35379  	nByte = ((ZIPFILE_CDS_FIXED_SZ + int32((*ZipfileEntry)(unsafe.Pointer(bp+16 /* &e */)).Fcds.FnFile)) + 9)
 35380  	if !(libc.AssignInt32(&rc, zipfileBufferGrow(tls, (p+16 /* &.cds */), nByte)) != 0) {
 35381  		goto __27
 35382  	}
 35383  	goto zipfile_step_out
 35384  __27:
 35385  	;
 35386  	*(*int32)(unsafe.Pointer(p + 16 /* &.cds */ + 4 /* &.n */)) += (zipfileSerializeCDS(tls, bp+16 /* &e */, ((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))))
 35387  
 35388  	// Increment the count of entries in the archive
 35389  	(*ZipfileCtx)(unsafe.Pointer(p)).FnEntry++
 35390  
 35391  zipfile_step_out:
 35392  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* aFree */)))
 35393  	sqlite3.Xsqlite3_free(tls, zFree)
 35394  	if !(rc != 0) {
 35395  		goto __28
 35396  	}
 35397  	if !(*(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)) != 0) {
 35398  		goto __29
 35399  	}
 35400  	sqlite3.Xsqlite3_result_error(tls, pCtx, *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)), -1)
 35401  	goto __30
 35402  __29:
 35403  	sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 35404  __30:
 35405  	;
 35406  __28:
 35407  	;
 35408  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* zErr */)))
 35409  }
 35410  
 35411  // xFinalize() callback for zipfile aggregate function.
 35412  func zipfileFinal(tls *libc.TLS, pCtx uintptr) { /* zipfile.c:2112:6: */
 35413  	bp := tls.Alloc(16)
 35414  	defer tls.Free(16)
 35415  
 35416  	var p uintptr
 35417  	// var eocd ZipfileEOCD at bp, 16
 35418  
 35419  	var nZip sqlite3_int64
 35420  	var aZip uintptr
 35421  
 35422  	p = sqlite3.Xsqlite3_aggregate_context(tls, pCtx, int32(unsafe.Sizeof(ZipfileCtx{})))
 35423  	if p == uintptr(0) {
 35424  		return
 35425  	}
 35426  	if (*ZipfileCtx)(unsafe.Pointer(p)).FnEntry > 0 {
 35427  		libc.Xmemset(tls, bp /* &eocd */, 0, uint32(unsafe.Sizeof(ZipfileEOCD{})))
 35428  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntry = u16((*ZipfileCtx)(unsafe.Pointer(p)).FnEntry)
 35429  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnEntryTotal = u16((*ZipfileCtx)(unsafe.Pointer(p)).FnEntry)
 35430  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FnSize = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn)
 35431  		(*ZipfileEOCD)(unsafe.Pointer(bp /* &eocd */)).FiOffset = u32((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)
 35432  
 35433  		nZip = (sqlite3_int64(((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn + (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn) + ZIPFILE_EOCD_FIXED_SZ))
 35434  		aZip = sqlite3.Xsqlite3_malloc64(tls, uint64(nZip))
 35435  		if aZip == uintptr(0) {
 35436  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 35437  		} else {
 35438  			libc.Xmemcpy(tls, aZip, (*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa, uint32((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn))
 35439  			libc.Xmemcpy(tls, (aZip + uintptr((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn)), (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa, uint32((*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))
 35440  			zipfileSerializeEOCD(tls, bp /* &eocd */, (aZip + uintptr(((*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fn + (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fn))))
 35441  			sqlite3.Xsqlite3_result_blob(tls, pCtx, aZip, int32(nZip), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFree})))
 35442  		}
 35443  	}
 35444  
 35445  	sqlite3.Xsqlite3_free(tls, (*ZipfileCtx)(unsafe.Pointer(p)).Fbody.Fa)
 35446  	sqlite3.Xsqlite3_free(tls, (*ZipfileCtx)(unsafe.Pointer(p)).Fcds.Fa)
 35447  }
 35448  
 35449  // Register the "zipfile" virtual table.
 35450  func zipfileRegister(tls *libc.TLS, db uintptr) int32 { /* zipfile.c:2147:12: */
 35451  
 35452  	var rc int32 = sqlite3.Xsqlite3_create_module(tls, db, ts+9012 /* "zipfile" */, uintptr(unsafe.Pointer(&zipfileModule)), uintptr(0))
 35453  	if rc == SQLITE_OK {
 35454  		rc = sqlite3.Xsqlite3_overload_function(tls, db, ts+9941 /* "zipfile_cds" */, -1)
 35455  	}
 35456  	if rc == SQLITE_OK {
 35457  		rc = sqlite3.Xsqlite3_create_function(tls, db, ts+9012 /* "zipfile" */, -1, SQLITE_UTF8, uintptr(0), uintptr(0),
 35458  			*(*uintptr)(unsafe.Pointer(&struct {
 35459  				f func(*libc.TLS, uintptr, int32, uintptr)
 35460  			}{zipfileStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{zipfileFinal})))
 35461  	}
 35462  
 35463  	return rc
 35464  }
 35465  
 35466  var zipfileModule = sqlite3_module{
 35467  	FiVersion:      1, // iVersion
 35468  	FxCreate:       0, // xCreate
 35469  	FxConnect:      0, // xConnect
 35470  	FxBestIndex:    0, // xBestIndex
 35471  	FxDisconnect:   0, // xDisconnect
 35472  	FxDestroy:      0, // xDestroy
 35473  	FxOpen:         0, // xOpen - open a cursor
 35474  	FxClose:        0, // xClose - close a cursor
 35475  	FxFilter:       0, // xFilter - configure scan constraints
 35476  	FxNext:         0, // xNext - advance a cursor
 35477  	FxEof:          0, // xEof - check for end of scan
 35478  	FxColumn:       0, // xRowid - read data
 35479  	FxUpdate:       0, // xUpdate
 35480  	FxBegin:        0, // xSync
 35481  	FxCommit:       0, // xCommit
 35482  	FxRollback:     0, // xRollback
 35483  	FxFindFunction: 0, // xRename
 35484  } /* zipfile.c:2148:25 */
 35485  
 35486  func sqlite3_zipfile_init(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* zipfile.c:2191:5: */
 35487  	_ = pApi
 35488  
 35489  	_ = pzErrMsg // Unused parameter
 35490  	return zipfileRegister(tls, db)
 35491  }
 35492  
 35493  func test_rbu_delta(tls *libc.TLS, pCtx uintptr, nArg int32, apVal uintptr) { /* test_rbu.c:34:6: */
 35494  	var interp uintptr = sqlite3.Xsqlite3_user_data(tls, pCtx)
 35495  	var pScript uintptr
 35496  	var i int32
 35497  
 35498  	pScript = tcl.XTcl_NewObj(tls)
 35499  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 35500  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, ts+10110 /* "rbu_delta" */, -1))
 35501  	for i = 0; i < nArg; i++ {
 35502  		var pIn uintptr = *(*uintptr)(unsafe.Pointer(apVal + uintptr(i)*4))
 35503  		var z uintptr = sqlite3.Xsqlite3_value_text(tls, pIn)
 35504  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, z, -1))
 35505  	}
 35506  
 35507  	if TCL_OK == tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_GLOBAL_ONLY) {
 35508  		var z uintptr = tcl.XTcl_GetStringResult(tls, interp)
 35509  		sqlite3.Xsqlite3_result_text(tls, pCtx, z, -1, libc.UintptrFromInt32(-1))
 35510  	} else {
 35511  		tcl.XTcl_BackgroundError(tls, interp)
 35512  	}
 35513  
 35514  	for ok := true; ok; ok = 0 != 0 {
 35515  		var _objPtr uintptr = pScript
 35516  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 35517  			tcl.XTclFreeObj(tls, _objPtr)
 35518  		}
 35519  	}
 35520  }
 35521  
 35522  func test_sqlite3rbu_cmd(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:59:26: */
 35523  	bp := tls.Alloc(296)
 35524  	defer tls.Free(296)
 35525  
 35526  	var ret int32 = TCL_OK
 35527  	var pRbu uintptr = clientData
 35528  	*(*[14]RbuCmd)(unsafe.Pointer(bp + 24 /* aCmd */)) = [14]RbuCmd{
 35529  		{FzName: ts + 10120 /* "step" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                   // 0
 35530  		{FzName: ts + 10125 /* "close" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                  // 1
 35531  		{FzName: ts + 10131 /* "create_rbu_delta" */, FnArg: 2, FzUsage: ts + 489 /* "" */},       // 2
 35532  		{FzName: ts + 10148 /* "savestate" */, FnArg: 2, FzUsage: ts + 489 /* "" */},              // 3
 35533  		{FzName: ts + 10158 /* "dbMain_eval" */, FnArg: 3, FzUsage: ts + 10170 /* "SQL" */},       // 4
 35534  		{FzName: ts + 10174 /* "bp_progress" */, FnArg: 2, FzUsage: ts + 489 /* "" */},            // 5
 35535  		{FzName: ts + 10186 /* "db" */, FnArg: 3, FzUsage: ts + 10189 /* "RBU" */},                // 6
 35536  		{FzName: ts + 10193 /* "state" */, FnArg: 2, FzUsage: ts + 489 /* "" */},                  // 7
 35537  		{FzName: ts + 10199 /* "progress" */, FnArg: 2, FzUsage: ts + 489 /* "" */},               // 8
 35538  		{FzName: ts + 10208 /* "close_no_error" */, FnArg: 2, FzUsage: ts + 489 /* "" */},         // 9
 35539  		{FzName: ts + 10223 /* "temp_size_limit" */, FnArg: 3, FzUsage: ts + 10239 /* "LIMIT" */}, // 10
 35540  		{FzName: ts + 10245 /* "temp_size" */, FnArg: 2, FzUsage: ts + 489 /* "" */},              // 11
 35541  		{FzName: ts + 10255 /* "dbRbu_eval" */, FnArg: 3, FzUsage: ts + 10170 /* "SQL" */},        // 12
 35542  		{},
 35543  	}
 35544  	// var iCmd int32 at bp+192, 4
 35545  
 35546  	if objc < 2 {
 35547  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10266 /* "METHOD" */)
 35548  		return TCL_ERROR
 35549  	}
 35550  	ret = tcl.XTcl_GetIndexFromObjStruct(tls,
 35551  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+24 /* &aCmd[0] */, int32(unsafe.Sizeof(RbuCmd{})), ts+10273 /* "method" */, 0, bp+192 /* &iCmd */)
 35552  	if ret != 0 {
 35553  		return TCL_ERROR
 35554  	}
 35555  	if objc != (*RbuCmd)(unsafe.Pointer(bp+24 /* &aCmd */ +uintptr(*(*int32)(unsafe.Pointer(bp + 192 /* iCmd */)))*12)).FnArg {
 35556  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, (*RbuCmd)(unsafe.Pointer(bp+24 /* &aCmd */ +uintptr(*(*int32)(unsafe.Pointer(bp + 192 /* iCmd */)))*12)).FzUsage)
 35557  		return TCL_ERROR
 35558  	}
 35559  
 35560  	switch *(*int32)(unsafe.Pointer(bp + 192 /* iCmd */)) {
 35561  	case 0: /* step */
 35562  		{
 35563  			var rc int32 = sqlite3.Xsqlite3rbu_step(tls, pRbu)
 35564  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35565  			break
 35566  
 35567  		}
 35568  
 35569  	case 9:
 35570  		fallthrough /* close_no_error */
 35571  	case 1: /* close */
 35572  		{
 35573  			*(*uintptr)(unsafe.Pointer(bp + 196 /* zErrmsg */)) = uintptr(0)
 35574  			var rc int32
 35575  			tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 35576  			if *(*int32)(unsafe.Pointer(bp + 192 /* iCmd */)) == 1 {
 35577  				rc = sqlite3.Xsqlite3rbu_close(tls, pRbu, bp+196 /* &zErrmsg */)
 35578  			} else {
 35579  				rc = sqlite3.Xsqlite3rbu_close(tls, pRbu, uintptr(0))
 35580  			}
 35581  			if (rc == SQLITE_OK) || (rc == SQLITE_DONE) {
 35582  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35583  
 35584  			} else {
 35585  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35586  				if *(*uintptr)(unsafe.Pointer(bp + 196 /* zErrmsg */)) != 0 {
 35587  					tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10280 /* " - " */, *(*uintptr)(unsafe.Pointer(bp + 196 /* zErrmsg */)), 0))
 35588  					sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 196 /* zErrmsg */)))
 35589  				}
 35590  				ret = TCL_ERROR
 35591  			}
 35592  			break
 35593  
 35594  		}
 35595  
 35596  	case 2: /* create_rbu_delta */
 35597  		{
 35598  			var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, 0)
 35599  			var rc int32 = sqlite3.Xsqlite3_create_function(tls,
 35600  				db, ts+10110 /* "rbu_delta" */, -1, SQLITE_UTF8, interp, *(*uintptr)(unsafe.Pointer(&struct {
 35601  					f func(*libc.TLS, uintptr, int32, uintptr)
 35602  				}{test_rbu_delta})), uintptr(0), uintptr(0))
 35603  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35604  			ret = func() int32 {
 35605  				if rc == SQLITE_OK {
 35606  					return TCL_OK
 35607  				}
 35608  				return TCL_ERROR
 35609  			}()
 35610  			break
 35611  
 35612  		}
 35613  
 35614  	case 3: /* savestate */
 35615  		{
 35616  			var rc int32 = sqlite3.Xsqlite3rbu_savestate(tls, pRbu)
 35617  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35618  			ret = func() int32 {
 35619  				if rc == SQLITE_OK {
 35620  					return TCL_OK
 35621  				}
 35622  				return TCL_ERROR
 35623  			}()
 35624  			break
 35625  
 35626  		}
 35627  
 35628  	case 12:
 35629  		fallthrough /* dbRbu_eval */
 35630  	case 4: /* dbMain_eval */
 35631  		{
 35632  			var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, (libc.Bool32(*(*int32)(unsafe.Pointer(bp + 192 /* iCmd */)) == 12)))
 35633  			var rc int32 = sqlite3.Xsqlite3_exec(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), uintptr(0), uintptr(0), uintptr(0))
 35634  			if rc != SQLITE_OK {
 35635  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, db), -1))
 35636  				ret = TCL_ERROR
 35637  			}
 35638  			break
 35639  
 35640  		}
 35641  
 35642  	case 5: /* bp_progress */
 35643  		{
 35644  			// var one int32 at bp+200, 4
 35645  
 35646  			// var two int32 at bp+204, 4
 35647  
 35648  			var pObj uintptr
 35649  			sqlite3.Xsqlite3rbu_bp_progress(tls, pRbu, bp+200 /* &one */, bp+204 /* &two */)
 35650  
 35651  			pObj = tcl.XTcl_NewObj(tls)
 35652  			tcl.XTcl_ListObjAppendElement(tls, interp, pObj, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 200 /* one */))))
 35653  			tcl.XTcl_ListObjAppendElement(tls, interp, pObj, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 204 /* two */))))
 35654  			tcl.XTcl_SetObjResult(tls, interp, pObj)
 35655  			break
 35656  
 35657  		}
 35658  
 35659  	case 6: /* db */
 35660  		{
 35661  			// var bArg int32 at bp+208, 4
 35662  
 35663  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+208 /* &bArg */) != 0 {
 35664  				ret = TCL_ERROR
 35665  			} else {
 35666  				// var zBuf [50]int8 at bp+212, 50
 35667  
 35668  				var db uintptr = sqlite3.Xsqlite3rbu_db(tls, pRbu, *(*int32)(unsafe.Pointer(bp + 208 /* bArg */)))
 35669  				if sqlite3TestMakePointerStr(tls, interp, bp+212 /* &zBuf[0] */, db) != 0 {
 35670  					ret = TCL_ERROR
 35671  				} else {
 35672  					tcl.XTcl_SetResult(tls, interp, bp+212 /* &zBuf[0] */, uintptr(1))
 35673  				}
 35674  			}
 35675  			break
 35676  
 35677  		}
 35678  	case 7: /* state */
 35679  		{
 35680  			*(*[6]uintptr)(unsafe.Pointer(bp + 264 /* aRes */)) = [6]uintptr{uintptr(0), ts + 10284 /* "oal" */, ts + 10288 /* "move" */, ts + 10293 /* "checkpoint" */, ts + 10304 /* "done" */, ts + 10309 /* "error" */}
 35681  			var eState int32 = sqlite3.Xsqlite3rbu_state(tls, pRbu)
 35682  
 35683  			tcl.XTcl_SetResult(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 264 /* &aRes[0] */ + uintptr(eState)*4)), uintptr(0))
 35684  			break
 35685  
 35686  		}
 35687  	case 8: /* progress */
 35688  		{
 35689  			var nStep sqlite3_int64 = sqlite3.Xsqlite3rbu_progress(tls, pRbu)
 35690  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nStep))
 35691  			break
 35692  
 35693  		}
 35694  
 35695  	case 10: /* temp_size_limit */
 35696  		{
 35697  			// var nLimit sqlite3_int64 at bp+288, 8
 35698  
 35699  			if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+288 /* &nLimit */) != 0 {
 35700  				ret = TCL_ERROR
 35701  			} else {
 35702  				*(*sqlite3_int64)(unsafe.Pointer(bp + 288 /* nLimit */)) = sqlite3.Xsqlite3rbu_temp_size_limit(tls, pRbu, *(*sqlite3_int64)(unsafe.Pointer(bp + 288 /* nLimit */)))
 35703  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 288 /* nLimit */))))
 35704  			}
 35705  			break
 35706  
 35707  		}
 35708  	case 11: /* temp_size */
 35709  		{
 35710  			var sz sqlite3_int64 = sqlite3.Xsqlite3rbu_temp_size(tls, pRbu)
 35711  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, sz))
 35712  			break
 35713  
 35714  		}
 35715  
 35716  	default: // seems unlikely
 35717  
 35718  		break
 35719  	}
 35720  
 35721  	return ret
 35722  }
 35723  
 35724  type RbuCmd = struct {
 35725  	FzName  uintptr
 35726  	FnArg   int32
 35727  	FzUsage uintptr
 35728  } /* test_rbu.c:67:3 */
 35729  
 35730  // Tclcmd: sqlite3rbu CMD <target-db> <rbu-db> ?<state-db>?
 35731  func test_sqlite3rbu(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:228:26: */
 35732  	var pRbu uintptr = uintptr(0)
 35733  	var zCmd uintptr
 35734  	var zTarget uintptr
 35735  	var zRbu uintptr
 35736  	var zStateDb uintptr = uintptr(0)
 35737  
 35738  	if (objc != 4) && (objc != 5) {
 35739  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10315 /* "NAME TARGET-DB R..." */)
 35740  		return TCL_ERROR
 35741  	}
 35742  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 35743  	zTarget = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 35744  	zRbu = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 35745  	if objc == 5 {
 35746  		zStateDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 35747  	}
 35748  
 35749  	pRbu = sqlite3.Xsqlite3rbu_open(tls, zTarget, zRbu, zStateDb)
 35750  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 35751  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 35752  	}{test_sqlite3rbu_cmd})), pRbu, uintptr(0))
 35753  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 35754  	return TCL_OK
 35755  }
 35756  
 35757  // Tclcmd: sqlite3rbu_vacuum CMD <target-db> <state-db>
 35758  func test_sqlite3rbu_vacuum(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:258:26: */
 35759  	var pRbu uintptr = uintptr(0)
 35760  	var zCmd uintptr
 35761  	var zTarget uintptr
 35762  	var zStateDb uintptr = uintptr(0)
 35763  
 35764  	if (objc != 3) && (objc != 4) {
 35765  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10348 /* "NAME TARGET-DB ?..." */)
 35766  		return TCL_ERROR
 35767  	}
 35768  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 35769  	zTarget = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 35770  	if objc == 4 {
 35771  		zStateDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 35772  	}
 35773  	if (zStateDb != 0) && (int32(*(*int8)(unsafe.Pointer(zStateDb))) == 0) {
 35774  		zStateDb = uintptr(0)
 35775  	}
 35776  
 35777  	pRbu = sqlite3.Xsqlite3rbu_vacuum(tls, zTarget, zStateDb)
 35778  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 35779  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 35780  	}{test_sqlite3rbu_cmd})), pRbu, uintptr(0))
 35781  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 35782  	return TCL_OK
 35783  }
 35784  
 35785  // Tclcmd: sqlite3rbu_create_vfs ?-default? NAME PARENT
 35786  func test_sqlite3rbu_create_vfs(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:287:26: */
 35787  	var zName uintptr
 35788  	var zParent uintptr
 35789  	var rc int32
 35790  
 35791  	if (objc != 3) && (objc != 4) {
 35792  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10374 /* "?-default? NAME ..." */)
 35793  		return TCL_ERROR
 35794  	}
 35795  
 35796  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4)))
 35797  	zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4)))
 35798  	if int32(*(*int8)(unsafe.Pointer(zParent))) == 0 {
 35799  		zParent = uintptr(0)
 35800  	}
 35801  
 35802  	rc = sqlite3.Xsqlite3rbu_create_vfs(tls, zName, zParent)
 35803  	if rc != SQLITE_OK {
 35804  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 35805  		return TCL_ERROR
 35806  	} else if objc == 4 {
 35807  		var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, zName)
 35808  		sqlite3.Xsqlite3_vfs_register(tls, pVfs, 1)
 35809  	}
 35810  
 35811  	tcl.XTcl_ResetResult(tls, interp)
 35812  	return TCL_OK
 35813  }
 35814  
 35815  // Tclcmd: sqlite3rbu_destroy_vfs NAME
 35816  func test_sqlite3rbu_destroy_vfs(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:322:26: */
 35817  	var zName uintptr
 35818  
 35819  	if objc != 2 {
 35820  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 35821  		return TCL_ERROR
 35822  	}
 35823  
 35824  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 35825  	sqlite3.Xsqlite3rbu_destroy_vfs(tls, zName)
 35826  	return TCL_OK
 35827  }
 35828  
 35829  // Tclcmd: sqlite3rbu_internal_test
 35830  func test_sqlite3rbu_internal_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_rbu.c:343:26: */
 35831  	bp := tls.Alloc(16)
 35832  	defer tls.Free(16)
 35833  
 35834  	var db uintptr
 35835  
 35836  	if objc != 1 {
 35837  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 35838  		return TCL_ERROR
 35839  	}
 35840  
 35841  	db = sqlite3.Xsqlite3rbu_db(tls, uintptr(0), 0)
 35842  	if db != uintptr(0) {
 35843  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10402 /* "sqlite3rbu_db(0,..." */, 0))
 35844  		return TCL_ERROR
 35845  	}
 35846  
 35847  	return TCL_OK
 35848  }
 35849  
 35850  func SqliteRbu_Init(tls *libc.TLS, interp uintptr) int32 { /* test_rbu.c:365:5: */
 35851  	var i int32
 35852  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd)) / uint32(unsafe.Sizeof(struct {
 35853  		FzName uintptr
 35854  		FxProc uintptr
 35855  	}{}))); i++ {
 35856  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd[i].FzName, aObjCmd[i].FxProc, uintptr(0), uintptr(0))
 35857  	}
 35858  	return TCL_OK
 35859  }
 35860  
 35861  var aObjCmd = [5]struct {
 35862  	FzName uintptr
 35863  	FxProc uintptr
 35864  }{
 35865  	{FzName: ts + 10425 /* "sqlite3rbu" */, FxProc: 0},
 35866  	{FzName: ts + 10436 /* "sqlite3rbu_vacuu..." */, FxProc: 0},
 35867  	{FzName: ts + 10454 /* "sqlite3rbu_creat..." */, FxProc: 0},
 35868  	{FzName: ts + 10476 /* "sqlite3rbu_destr..." */, FxProc: 0},
 35869  	{FzName: ts + 10499 /* "sqlite3rbu_inter..." */, FxProc: 0},
 35870  } /* test_rbu.c:369:5 */
 35871  
 35872  type TestSession1 = struct {
 35873  	FpSession      uintptr
 35874  	Finterp        uintptr
 35875  	FpFilterScript uintptr
 35876  } /* test_session.c:21:9 */
 35877  
 35878  type TestSession = TestSession1 /* test_session.c:21:28 */
 35879  
 35880  type TestStreamInput1 = struct {
 35881  	FnStream int32
 35882  	FaData   uintptr
 35883  	FnData   int32
 35884  	FiData   int32
 35885  } /* test_session.c:28:9 */
 35886  
 35887  type TestStreamInput = TestStreamInput1 /* test_session.c:28:32 */
 35888  
 35889  // Extract an sqlite3* db handle from the object passed as the second
 35890  // argument. If successful, set *pDb to point to the db handle and return
 35891  // TCL_OK. Otherwise, return TCL_ERROR.
 35892  func dbHandleFromObj1(tls *libc.TLS, interp uintptr, pObj uintptr, pDb uintptr) int32 { /* test_session.c:41:12: */
 35893  	bp := tls.Alloc(56)
 35894  	defer tls.Free(56)
 35895  
 35896  	// var info Tcl_CmdInfo at bp+24, 32
 35897  
 35898  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, pObj), bp+24 /* &info */) {
 35899  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, pObj), 0))
 35900  		return TCL_ERROR
 35901  	}
 35902  
 35903  	*(*uintptr)(unsafe.Pointer(pDb)) = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 35904  	return TCL_OK
 35905  }
 35906  
 35907  /*************************************************************************
 35908  ** The following code is copied byte-for-byte from the sessions module
 35909  ** documentation.  It is used by some of the sessions modules tests to
 35910  ** ensure that the example in the documentation does actually work.
 35911   */
 35912  // Argument zSql points to a buffer containing an SQL script to execute
 35913  // against the database handle passed as the first argument. As well as
 35914  // executing the SQL script, this function collects a changeset recording
 35915  // all changes made to the "main" database file. Assuming no error occurs,
 35916  // output variables (*ppChangeset) and (*pnChangeset) are set to point
 35917  // to a buffer containing the changeset and the size of the changeset in
 35918  // bytes before returning SQLITE_OK. In this case it is the responsibility
 35919  // of the caller to eventually free the changeset blob by passing it to
 35920  // the sqlite3_free function.
 35921  //
 35922  // Or, if an error does occur, return an SQLite error code. The final
 35923  // value of (*pChangeset) and (*pnChangeset) are undefined in this case.
 35924  func sql_exec_changeset(tls *libc.TLS, db uintptr, zSql uintptr, pnChangeset uintptr, ppChangeset uintptr) int32 { /* test_session.c:71:5: */
 35925  	bp := tls.Alloc(4)
 35926  	defer tls.Free(4)
 35927  
 35928  	*(*uintptr)(unsafe.Pointer(bp /* pSession */)) = uintptr(0)
 35929  	var rc int32
 35930  
 35931  	// Create a new session object
 35932  	rc = sqlite3.Xsqlite3session_create(tls, db, ts+85 /* "main" */, bp /* &pSession */)
 35933  
 35934  	// Configure the session object to record changes to all tables
 35935  	if rc == SQLITE_OK {
 35936  		rc = sqlite3.Xsqlite3session_attach(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)), uintptr(0))
 35937  	}
 35938  
 35939  	// Execute the SQL script
 35940  	if rc == SQLITE_OK {
 35941  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 35942  	}
 35943  
 35944  	// Collect the changeset
 35945  	if rc == SQLITE_OK {
 35946  		rc = sqlite3.Xsqlite3session_changeset(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)), pnChangeset, ppChangeset)
 35947  	}
 35948  
 35949  	// Delete the session object
 35950  	sqlite3.Xsqlite3session_delete(tls, *(*uintptr)(unsafe.Pointer(bp /* pSession */)))
 35951  
 35952  	return rc
 35953  }
 35954  
 35955  //**********************************************************************
 35956  
 35957  // Tclcmd: sql_exec_changeset DB SQL
 35958  func test_sql_exec_changeset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:104:26: */
 35959  	bp := tls.Alloc(28)
 35960  	defer tls.Free(28)
 35961  
 35962  	var zSql uintptr
 35963  	// var db uintptr at bp+16, 4
 35964  
 35965  	// var pChangeset uintptr at bp+24, 4
 35966  
 35967  	// var nChangeset int32 at bp+20, 4
 35968  
 35969  	var rc int32
 35970  
 35971  	if objc != 3 {
 35972  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10524 /* "DB SQL" */)
 35973  		return TCL_ERROR
 35974  	}
 35975  	if dbHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &db */) != 0 {
 35976  		return TCL_ERROR
 35977  	}
 35978  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 35979  
 35980  	rc = sql_exec_changeset(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zSql, bp+20 /* &nChangeset */, bp+24 /* &pChangeset */)
 35981  	if rc != SQLITE_OK {
 35982  		tcl.XTcl_ResetResult(tls, interp)
 35983  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10531 /* "error in sql_exe..." */, 0))
 35984  		return TCL_ERROR
 35985  	}
 35986  
 35987  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pChangeset */)), *(*int32)(unsafe.Pointer(bp + 20 /* nChangeset */))))
 35988  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pChangeset */)))
 35989  	return TCL_OK
 35990  }
 35991  
 35992  // Attempt to find the global variable zVar within interpreter interp
 35993  // and extract an integer value from it. Return this value.
 35994  //
 35995  // If the named variable cannot be found, or if it cannot be interpreted
 35996  // as a integer, return 0.
 35997  func test_tcl_integer(tls *libc.TLS, interp uintptr, zVar uintptr) int32 { /* test_session.c:146:12: */
 35998  	bp := tls.Alloc(4)
 35999  	defer tls.Free(4)
 36000  
 36001  	var pObj uintptr
 36002  	*(*int32)(unsafe.Pointer(bp /* iVal */)) = 0
 36003  	var pName uintptr = tcl.XTcl_NewStringObj(tls, zVar, -1)
 36004  	(*Tcl_Obj)(unsafe.Pointer(pName)).FrefCount++
 36005  	pObj = tcl.XTcl_ObjGetVar2(tls, interp, pName, uintptr(0), TCL_GLOBAL_ONLY)
 36006  	for ok := true; ok; ok = 0 != 0 {
 36007  		var _objPtr uintptr = pName
 36008  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36009  			tcl.XTclFreeObj(tls, _objPtr)
 36010  		}
 36011  	}
 36012  	if pObj != 0 {
 36013  		tcl.XTcl_GetIntFromObj(tls, uintptr(0), pObj, bp /* &iVal */)
 36014  	}
 36015  	return *(*int32)(unsafe.Pointer(bp /* iVal */))
 36016  }
 36017  
 36018  func test_session_error(tls *libc.TLS, interp uintptr, rc int32, zErr uintptr) int32 { /* test_session.c:157:12: */
 36019  	bp := tls.Alloc(24)
 36020  	defer tls.Free(24)
 36021  
 36022  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 36023  	if zErr != 0 {
 36024  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+10280 /* " - " */, zErr, 0))
 36025  		sqlite3.Xsqlite3_free(tls, zErr)
 36026  	}
 36027  	return TCL_ERROR
 36028  }
 36029  
 36030  func test_table_filter(tls *libc.TLS, pCtx uintptr, zTbl uintptr) int32 { /* test_session.c:167:12: */
 36031  	bp := tls.Alloc(4)
 36032  	defer tls.Free(4)
 36033  
 36034  	var p uintptr = pCtx
 36035  	var pEval uintptr
 36036  	var rc int32
 36037  	*(*int32)(unsafe.Pointer(bp /* bRes */)) = 0
 36038  
 36039  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestSession)(unsafe.Pointer(p)).FpFilterScript)
 36040  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 36041  	rc = tcl.XTcl_ListObjAppendElement(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 36042  	if rc == TCL_OK {
 36043  		rc = tcl.XTcl_EvalObjEx(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 36044  	}
 36045  	if rc == TCL_OK {
 36046  		rc = tcl.XTcl_GetBooleanFromObj(tls, (*TestSession)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*TestSession)(unsafe.Pointer(p)).Finterp), bp /* &bRes */)
 36047  	}
 36048  	if rc != TCL_OK {
 36049  		// printf("error: %s\n", Tcl_GetStringResult(p->interp));
 36050  		tcl.XTcl_BackgroundError(tls, (*TestSession)(unsafe.Pointer(p)).Finterp)
 36051  	}
 36052  	for ok := true; ok; ok = 0 != 0 {
 36053  		var _objPtr uintptr = pEval
 36054  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36055  			tcl.XTclFreeObj(tls, _objPtr)
 36056  		}
 36057  	}
 36058  
 36059  	return *(*int32)(unsafe.Pointer(bp /* bRes */))
 36060  }
 36061  
 36062  type TestSessionsBlob1 = struct {
 36063  	Fp uintptr
 36064  	Fn int32
 36065  } /* test_session.c:191:1 */
 36066  
 36067  type TestSessionsBlob = TestSessionsBlob1 /* test_session.c:195:33 */
 36068  
 36069  func testStreamOutput(tls *libc.TLS, pCtx uintptr, pData uintptr, nData int32) int32 { /* test_session.c:197:12: */
 36070  	var pBlob uintptr = pCtx
 36071  	var pNew uintptr
 36072  
 36073  	pNew = sqlite3.Xsqlite3_realloc(tls, (*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fp, ((*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fn + nData))
 36074  	if pNew == uintptr(0) {
 36075  		return SQLITE_NOMEM
 36076  	}
 36077  	(*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fp = pNew
 36078  	libc.Xmemcpy(tls, (pNew + uintptr((*TestSessionsBlob)(unsafe.Pointer(pBlob)).Fn)), pData, uint32(nData))
 36079  	*(*int32)(unsafe.Pointer(pBlob + 4 /* &.n */)) += (nData)
 36080  	return SQLITE_OK
 36081  }
 36082  
 36083  // Tclcmd:  $session attach TABLE
 36084  //          $session changeset
 36085  //          $session delete
 36086  //          $session enable BOOL
 36087  //          $session indirect INTEGER
 36088  //          $session patchset
 36089  //          $session table_filter SCRIPT
 36090  func test_session_cmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:225:26: */
 36091  	bp := tls.Alloc(28)
 36092  	defer tls.Free(28)
 36093  
 36094  	var p uintptr = clientData
 36095  	var pSession uintptr = (*TestSession)(unsafe.Pointer(p)).FpSession
 36096  	// var iSub int32 at bp, 4
 36097  
 36098  	var rc int32
 36099  
 36100  	if objc < 2 {
 36101  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 36102  		return TCL_ERROR
 36103  	}
 36104  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 36105  		*(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&aSub)), int32(unsafe.Sizeof(SessionSubcmd{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 36106  	if rc != TCL_OK {
 36107  		return rc
 36108  	}
 36109  	if objc != (2 + aSub[*(*int32)(unsafe.Pointer(bp /* iSub */))].FnArg) {
 36110  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, aSub[*(*int32)(unsafe.Pointer(bp /* iSub */))].FzMsg)
 36111  		return TCL_ERROR
 36112  	}
 36113  
 36114  	switch *(*int32)(unsafe.Pointer(bp /* iSub */)) {
 36115  	case 0:
 36116  		{ // attach
 36117  			var zArg uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 36118  			if (int32(*(*int8)(unsafe.Pointer(zArg))) == '*') && (int32(*(*int8)(unsafe.Pointer(zArg + 1))) == 0) {
 36119  				zArg = uintptr(0)
 36120  			}
 36121  			rc = sqlite3.Xsqlite3session_attach(tls, pSession, zArg)
 36122  			if rc != SQLITE_OK {
 36123  				return test_session_error(tls, interp, rc, uintptr(0))
 36124  			}
 36125  			break
 36126  
 36127  		}
 36128  
 36129  	case 7:
 36130  		fallthrough // patchset
 36131  	case 1:
 36132  		{ // changeset
 36133  			*(*TestSessionsBlob)(unsafe.Pointer(bp + 4 /* o */)) = TestSessionsBlob{}
 36134  			if test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */) != 0 {
 36135  				var pCtx uintptr = bp + 4 /* &o */
 36136  				if *(*int32)(unsafe.Pointer(bp /* iSub */)) == 7 {
 36137  					rc = sqlite3.Xsqlite3session_patchset_strm(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 36138  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 36139  					}{testStreamOutput})), pCtx)
 36140  				} else {
 36141  					rc = sqlite3.Xsqlite3session_changeset_strm(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 36142  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 36143  					}{testStreamOutput})), pCtx)
 36144  				}
 36145  			} else {
 36146  				if *(*int32)(unsafe.Pointer(bp /* iSub */)) == 7 {
 36147  					rc = sqlite3.Xsqlite3session_patchset(tls, pSession, (bp + 4 /* &o */ + 4 /* &.n */), (bp + 4 /* &o */ /* &.p */))
 36148  				} else {
 36149  					rc = sqlite3.Xsqlite3session_changeset(tls, pSession, (bp + 4 /* &o */ + 4 /* &.n */), (bp + 4 /* &o */ /* &.p */))
 36150  				}
 36151  			}
 36152  			if rc == SQLITE_OK {
 36153  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+4 /* &o */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+4 /* &o */)).Fn))
 36154  			}
 36155  			sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+4 /* &o */)).Fp)
 36156  			if rc != SQLITE_OK {
 36157  				return test_session_error(tls, interp, rc, uintptr(0))
 36158  			}
 36159  			break
 36160  
 36161  		}
 36162  
 36163  	case 2: // delete
 36164  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 36165  		break
 36166  
 36167  	case 3:
 36168  		{ // enable
 36169  			// var val int32 at bp+12, 4
 36170  
 36171  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+12 /* &val */) != 0 {
 36172  				return TCL_ERROR
 36173  			}
 36174  			*(*int32)(unsafe.Pointer(bp + 12 /* val */)) = sqlite3.Xsqlite3session_enable(tls, pSession, *(*int32)(unsafe.Pointer(bp + 12 /* val */)))
 36175  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 12 /* val */))) != 0))))
 36176  			break
 36177  
 36178  		}
 36179  
 36180  	case 4:
 36181  		{ // indirect
 36182  			// var val int32 at bp+16, 4
 36183  
 36184  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &val */) != 0 {
 36185  				return TCL_ERROR
 36186  			}
 36187  			*(*int32)(unsafe.Pointer(bp + 16 /* val */)) = sqlite3.Xsqlite3session_indirect(tls, pSession, *(*int32)(unsafe.Pointer(bp + 16 /* val */)))
 36188  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 16 /* val */))) != 0))))
 36189  			break
 36190  
 36191  		}
 36192  
 36193  	case 5:
 36194  		{ // isempty
 36195  			var val int32
 36196  			val = sqlite3.Xsqlite3session_isempty(tls, pSession)
 36197  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((val) != 0))))
 36198  			break
 36199  
 36200  		}
 36201  
 36202  	case 6:
 36203  		{ // table_filter
 36204  			if (*TestSession)(unsafe.Pointer(p)).FpFilterScript != 0 {
 36205  				for ok := true; ok; ok = 0 != 0 {
 36206  					var _objPtr uintptr = (*TestSession)(unsafe.Pointer(p)).FpFilterScript
 36207  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36208  						tcl.XTclFreeObj(tls, _objPtr)
 36209  					}
 36210  				}
 36211  			}
 36212  			(*TestSession)(unsafe.Pointer(p)).Finterp = interp
 36213  			(*TestSession)(unsafe.Pointer(p)).FpFilterScript = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 36214  			(*Tcl_Obj)(unsafe.Pointer((*TestSession)(unsafe.Pointer(p)).FpFilterScript)).FrefCount++
 36215  			sqlite3.Xsqlite3session_table_filter(tls, pSession, *(*uintptr)(unsafe.Pointer(&struct {
 36216  				f func(*libc.TLS, uintptr, uintptr) int32
 36217  			}{test_table_filter})), clientData)
 36218  			break
 36219  
 36220  		}
 36221  
 36222  	case 8:
 36223  		{ // diff
 36224  			*(*uintptr)(unsafe.Pointer(bp + 20 /* zErr */)) = uintptr(0)
 36225  			rc = sqlite3.Xsqlite3session_diff(tls, pSession,
 36226  				tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))),
 36227  				tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4))),
 36228  				bp+20 /* &zErr */)
 36229  
 36230  			if rc != 0 {
 36231  				return test_session_error(tls, interp, rc, *(*uintptr)(unsafe.Pointer(bp + 20 /* zErr */)))
 36232  			}
 36233  			break
 36234  
 36235  		}
 36236  
 36237  	case 9:
 36238  		{ // memory_used
 36239  			var nMalloc sqlite3_int64 = sqlite3.Xsqlite3session_memory_used(tls, pSession)
 36240  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nMalloc))
 36241  			break
 36242  
 36243  		}
 36244  
 36245  	case 10:
 36246  		{
 36247  			var nSize sqlite3_int64 = sqlite3.Xsqlite3session_changeset_size(tls, pSession)
 36248  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, nSize))
 36249  			break
 36250  
 36251  		}
 36252  	case 11:
 36253  		{
 36254  			var rc int32
 36255  			// var iArg int32 at bp+24, 4
 36256  
 36257  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+24 /* &iArg */) != 0 {
 36258  				return TCL_ERROR
 36259  			}
 36260  			rc = sqlite3.Xsqlite3session_object_config(tls,
 36261  				pSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+24 /* &iArg */)
 36262  			if rc != SQLITE_OK {
 36263  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 36264  			} else {
 36265  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 24 /* iArg */))))
 36266  			}
 36267  			break
 36268  
 36269  		}
 36270  	}
 36271  
 36272  	return TCL_OK
 36273  }
 36274  
 36275  type SessionSubcmd = struct {
 36276  	FzSub uintptr
 36277  	FnArg int32
 36278  	FzMsg uintptr
 36279  	FiSub int32
 36280  } /* test_session.c:233:10 */
 36281  
 36282  var aSub = [13]SessionSubcmd{
 36283  	{FzSub: ts + 10584 /* "attach" */, FnArg: 1, FzMsg: ts + 1812 /* "TABLE" */},                // 0
 36284  	{FzSub: ts + 10591 /* "changeset" */, FzMsg: ts + 489 /* "" */},                             // 1
 36285  	{FzSub: ts + 10601 /* "delete" */, FzMsg: ts + 489 /* "" */},                                // 2
 36286  	{FzSub: ts + 10608 /* "enable" */, FnArg: 1, FzMsg: ts + 10615 /* "BOOL" */},                // 3
 36287  	{FzSub: ts + 10620 /* "indirect" */, FnArg: 1, FzMsg: ts + 10615 /* "BOOL" */},              // 4
 36288  	{FzSub: ts + 10629 /* "isempty" */, FzMsg: ts + 489 /* "" */},                               // 5
 36289  	{FzSub: ts + 10637 /* "table_filter" */, FnArg: 1, FzMsg: ts + 10650 /* "SCRIPT" */},        // 6
 36290  	{FzSub: ts + 10657 /* "patchset" */, FzMsg: ts + 489 /* "" */},                              // 7
 36291  	{FzSub: ts + 10666 /* "diff" */, FnArg: 2, FzMsg: ts + 10671 /* "FROMDB TBL" */},            // 8
 36292  	{FzSub: ts + 10682 /* "memory_used" */, FzMsg: ts + 489 /* "" */},                           // 9
 36293  	{FzSub: ts + 10694 /* "changeset_size" */, FzMsg: ts + 489 /* "" */},                        // 10
 36294  	{FzSub: ts + 10709 /* "object_config_si..." */, FnArg: 1, FzMsg: ts + 2274 /* "INTEGER" */}, // 11
 36295  	{},
 36296  } /* test_session.c:238:5 */
 36297  
 36298  func test_session_del(tls *libc.TLS, clientData uintptr) { /* test_session.c:390:27: */
 36299  	var p uintptr = clientData
 36300  	if (*TestSession)(unsafe.Pointer(p)).FpFilterScript != 0 {
 36301  		for ok := true; ok; ok = 0 != 0 {
 36302  			var _objPtr uintptr = (*TestSession)(unsafe.Pointer(p)).FpFilterScript
 36303  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36304  				tcl.XTclFreeObj(tls, _objPtr)
 36305  			}
 36306  		}
 36307  	}
 36308  	sqlite3.Xsqlite3session_delete(tls, (*TestSession)(unsafe.Pointer(p)).FpSession)
 36309  	tcl.XTcl_Free(tls, p)
 36310  }
 36311  
 36312  // Tclcmd:  sqlite3session CMD DB-HANDLE DB-NAME
 36313  func test_sqlite3session(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:400:26: */
 36314  	bp := tls.Alloc(60)
 36315  	defer tls.Free(60)
 36316  
 36317  	var db uintptr
 36318  	// var info Tcl_CmdInfo at bp+24, 32
 36319  
 36320  	var rc int32  // sqlite3session_create() return code
 36321  	var p uintptr // New wrapper object
 36322  	*(*int32)(unsafe.Pointer(bp + 56 /* iArg */)) = -1
 36323  
 36324  	if objc != 4 {
 36325  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10728 /* "CMD DB-HANDLE DB..." */)
 36326  		return TCL_ERROR
 36327  	}
 36328  
 36329  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+24 /* &info */) {
 36330  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 0))
 36331  		return TCL_ERROR
 36332  	}
 36333  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 36334  
 36335  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(TestSession{})))
 36336  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(TestSession{})))
 36337  	rc = sqlite3.Xsqlite3session_create(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4))), (p /* &.pSession */))
 36338  	if rc != SQLITE_OK {
 36339  		tcl.XTcl_Free(tls, p)
 36340  		return test_session_error(tls, interp, rc, uintptr(0))
 36341  	}
 36342  
 36343  	// Query the SQLITE_SESSION_OBJCONFIG_SIZE option to ensure that it
 36344  	// is clear by default. Then set it.
 36345  	sqlite3.Xsqlite3session_object_config(tls, (*TestSession)(unsafe.Pointer(p)).FpSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+56 /* &iArg */)
 36346  
 36347  	*(*int32)(unsafe.Pointer(bp + 56 /* iArg */)) = 1
 36348  	sqlite3.Xsqlite3session_object_config(tls, (*TestSession)(unsafe.Pointer(p)).FpSession, SQLITE_SESSION_OBJCONFIG_SIZE, bp+56 /* &iArg */)
 36349  
 36350  	tcl.XTcl_CreateObjCommand(tls,
 36351  		interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), *(*uintptr)(unsafe.Pointer(&struct {
 36352  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 36353  		}{test_session_cmd})), p,
 36354  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_session_del})))
 36355  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 36356  	return TCL_OK
 36357  }
 36358  
 36359  func test_append_value(tls *libc.TLS, pList uintptr, pVal uintptr) { /* test_session.c:446:13: */
 36360  	if pVal == uintptr(0) {
 36361  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewObj(tls))
 36362  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewObj(tls))
 36363  	} else {
 36364  		var pObj uintptr
 36365  		switch sqlite3.Xsqlite3_value_type(tls, pVal) {
 36366  		case SQLITE_NULL:
 36367  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10750 /* "n" */, 1))
 36368  			pObj = tcl.XTcl_NewObj(tls)
 36369  			break
 36370  			fallthrough
 36371  		case SQLITE_INTEGER:
 36372  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10752 /* "i" */, 1))
 36373  			pObj = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, pVal))
 36374  			break
 36375  			fallthrough
 36376  		case SQLITE_FLOAT:
 36377  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10754 /* "f" */, 1))
 36378  			pObj = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, pVal))
 36379  			break
 36380  			fallthrough
 36381  		case SQLITE_TEXT:
 36382  			{
 36383  				var z uintptr = sqlite3.Xsqlite3_value_blob(tls, pVal)
 36384  				var n int32 = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 36385  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10756 /* "t" */, 1))
 36386  				pObj = tcl.XTcl_NewStringObj(tls, z, n)
 36387  				break
 36388  
 36389  			}
 36390  			fallthrough
 36391  		default:
 36392  
 36393  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, tcl.XTcl_NewStringObj(tls, ts+10758 /* "b" */, 1))
 36394  			pObj = tcl.XTcl_NewByteArrayObj(tls,
 36395  				sqlite3.Xsqlite3_value_blob(tls, pVal),
 36396  				sqlite3.Xsqlite3_value_bytes(tls, pVal))
 36397  			break
 36398  		}
 36399  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pList, pObj)
 36400  	}
 36401  }
 36402  
 36403  type TestConflictHandler1 = struct {
 36404  	Finterp          uintptr
 36405  	FpConflictScript uintptr
 36406  	FpFilterScript   uintptr
 36407  } /* test_session.c:485:9 */
 36408  
 36409  type TestConflictHandler = TestConflictHandler1 /* test_session.c:485:36 */
 36410  
 36411  func test_obj_eq_string(tls *libc.TLS, p uintptr, z uintptr) int32 { /* test_session.c:492:12: */
 36412  	bp := tls.Alloc(4)
 36413  	defer tls.Free(4)
 36414  
 36415  	var n int32
 36416  	// var nObj int32 at bp, 4
 36417  
 36418  	var zObj uintptr
 36419  
 36420  	n = int32(libc.Xstrlen(tls, z))
 36421  	zObj = tcl.XTcl_GetStringFromObj(tls, p, bp /* &nObj */)
 36422  
 36423  	return (libc.Bool32((*(*int32)(unsafe.Pointer(bp /* nObj */)) == n) && ((n == 0) || (0 == libc.Xmemcmp(tls, zObj, z, uint32(n))))))
 36424  }
 36425  
 36426  func test_filter_handler(tls *libc.TLS, pCtx uintptr, zTab uintptr) int32 { /* test_session.c:503:12: */
 36427  	bp := tls.Alloc(4)
 36428  	defer tls.Free(4)
 36429  
 36430  	var p uintptr = pCtx
 36431  	*(*int32)(unsafe.Pointer(bp /* res */)) = 1
 36432  	var pEval uintptr
 36433  	var interp uintptr = (*TestConflictHandler)(unsafe.Pointer(p)).Finterp
 36434  
 36435  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestConflictHandler)(unsafe.Pointer(p)).FpFilterScript)
 36436  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 36437  
 36438  	if ((TCL_OK != tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, zTab, -1))) ||
 36439  		(TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, pEval, TCL_EVAL_GLOBAL))) ||
 36440  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, tcl.XTcl_GetObjResult(tls, interp), bp /* &res */)) {
 36441  		tcl.XTcl_BackgroundError(tls, interp)
 36442  	}
 36443  
 36444  	for ok := true; ok; ok = 0 != 0 {
 36445  		var _objPtr uintptr = pEval
 36446  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36447  			tcl.XTclFreeObj(tls, _objPtr)
 36448  		}
 36449  	}
 36450  	return *(*int32)(unsafe.Pointer(bp /* res */))
 36451  }
 36452  
 36453  func test_conflict_handler(tls *libc.TLS, pCtx uintptr, eConf int32, pIter uintptr) int32 { /* test_session.c:526:12: */
 36454  	bp := tls.Alloc(60)
 36455  	defer tls.Free(60)
 36456  
 36457  	var p uintptr = pCtx
 36458  	var pEval uintptr
 36459  	var interp uintptr = (*TestConflictHandler)(unsafe.Pointer(p)).Finterp
 36460  	*(*int32)(unsafe.Pointer(bp + 56 /* ret */)) = 0 // Return value
 36461  
 36462  	// var op int32 at bp+8, 4
 36463  	// SQLITE_UPDATE, DELETE or INSERT
 36464  	// var zTab uintptr at bp, 4
 36465  	// Name of table conflict is on
 36466  	// var nCol int32 at bp+4, 4
 36467  	// Number of columns in table zTab
 36468  
 36469  	pEval = tcl.XTcl_DuplicateObj(tls, (*TestConflictHandler)(unsafe.Pointer(p)).FpConflictScript)
 36470  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 36471  
 36472  	sqlite3.Xsqlite3changeset_op(tls, pIter, bp /* &zTab */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0))
 36473  
 36474  	if eConf == SQLITE_CHANGESET_FOREIGN_KEY {
 36475  		// var nFk int32 at bp+12, 4
 36476  
 36477  		sqlite3.Xsqlite3changeset_fk_conflicts(tls, pIter, bp+12 /* &nFk */)
 36478  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, ts+10760 /* "FOREIGN_KEY" */, -1))
 36479  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* nFk */))))
 36480  	} else {
 36481  
 36482  		// Append the operation type.
 36483  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls,
 36484  			func() uintptr {
 36485  				if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_INSERT {
 36486  					return ts + 10772 /* "INSERT" */
 36487  				}
 36488  				return func() uintptr {
 36489  					if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_UPDATE {
 36490  						return ts + 10779 /* "UPDATE" */
 36491  					}
 36492  					return ts + 10786 /* "DELETE" */
 36493  				}()
 36494  			}(), -1))
 36495  
 36496  		// Append the table name.
 36497  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp /* zTab */)), -1))
 36498  
 36499  		// Append the conflict type.
 36500  		switch eConf {
 36501  		case SQLITE_CHANGESET_DATA:
 36502  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10793 /* "DATA" */, -1))
 36503  			break
 36504  			fallthrough
 36505  		case SQLITE_CHANGESET_NOTFOUND:
 36506  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10798 /* "NOTFOUND" */, -1))
 36507  			break
 36508  			fallthrough
 36509  		case SQLITE_CHANGESET_CONFLICT:
 36510  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10807 /* "CONFLICT" */, -1))
 36511  			break
 36512  			fallthrough
 36513  		case SQLITE_CHANGESET_CONSTRAINT:
 36514  			tcl.XTcl_ListObjAppendElement(tls, interp, pEval, tcl.XTcl_NewStringObj(tls, ts+10816 /* "CONSTRAINT" */, -1))
 36515  			break
 36516  		}
 36517  
 36518  		// If this is not an INSERT, append the old row
 36519  		if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) != SQLITE_INSERT {
 36520  			var i int32
 36521  			var pOld uintptr = tcl.XTcl_NewObj(tls)
 36522  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)); i++ {
 36523  				// var pVal uintptr at bp+16, 4
 36524  
 36525  				sqlite3.Xsqlite3changeset_old(tls, pIter, i, bp+16 /* &pVal */)
 36526  				test_append_value(tls, pOld, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))
 36527  			}
 36528  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pOld)
 36529  		}
 36530  
 36531  		// If this is not a DELETE, append the new row
 36532  		if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) != SQLITE_DELETE {
 36533  			var i int32
 36534  			var pNew uintptr = tcl.XTcl_NewObj(tls)
 36535  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)); i++ {
 36536  				// var pVal uintptr at bp+20, 4
 36537  
 36538  				sqlite3.Xsqlite3changeset_new(tls, pIter, i, bp+20 /* &pVal */)
 36539  				test_append_value(tls, pNew, *(*uintptr)(unsafe.Pointer(bp + 20 /* pVal */)))
 36540  			}
 36541  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pNew)
 36542  		}
 36543  
 36544  		// If this is a CHANGESET_DATA or CHANGESET_CONFLICT conflict, append
 36545  		// the conflicting row.
 36546  		if (eConf == SQLITE_CHANGESET_DATA) || (eConf == SQLITE_CHANGESET_CONFLICT) {
 36547  			var i int32
 36548  			var pConflict uintptr = tcl.XTcl_NewObj(tls)
 36549  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)); i++ {
 36550  				var rc int32
 36551  				_ = rc
 36552  				// var pVal uintptr at bp+24, 4
 36553  
 36554  				rc = sqlite3.Xsqlite3changeset_conflict(tls, pIter, i, bp+24 /* &pVal */)
 36555  
 36556  				test_append_value(tls, pConflict, *(*uintptr)(unsafe.Pointer(bp + 24 /* pVal */)))
 36557  			}
 36558  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pConflict)
 36559  		}
 36560  
 36561  		// **********************************************************************
 36562  		//
 36563  		// This block is purely for testing some error conditions.
 36564  		if (eConf == SQLITE_CHANGESET_CONSTRAINT) ||
 36565  			(eConf == SQLITE_CHANGESET_NOTFOUND) {
 36566  			// var pVal uintptr at bp+28, 4
 36567  
 36568  			var rc int32 = sqlite3.Xsqlite3changeset_conflict(tls, pIter, 0, bp+28 /* &pVal */)
 36569  			_ = rc
 36570  
 36571  		} else {
 36572  			// var pVal uintptr at bp+32, 4
 36573  
 36574  			var rc int32 = sqlite3.Xsqlite3changeset_conflict(tls, pIter, -1, bp+32 /* &pVal */)
 36575  			_ = rc
 36576  
 36577  			rc = sqlite3.Xsqlite3changeset_conflict(tls, pIter, *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), bp+32 /* &pVal */)
 36578  
 36579  		}
 36580  		if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_DELETE {
 36581  			// var pVal uintptr at bp+36, 4
 36582  
 36583  			var rc int32 = sqlite3.Xsqlite3changeset_new(tls, pIter, 0, bp+36 /* &pVal */)
 36584  			_ = rc
 36585  
 36586  		} else {
 36587  			// var pVal uintptr at bp+40, 4
 36588  
 36589  			var rc int32 = sqlite3.Xsqlite3changeset_new(tls, pIter, -1, bp+40 /* &pVal */)
 36590  			_ = rc
 36591  
 36592  			rc = sqlite3.Xsqlite3changeset_new(tls, pIter, *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), bp+40 /* &pVal */)
 36593  
 36594  		}
 36595  		if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) == SQLITE_INSERT {
 36596  			// var pVal uintptr at bp+44, 4
 36597  
 36598  			var rc int32 = sqlite3.Xsqlite3changeset_old(tls, pIter, 0, bp+44 /* &pVal */)
 36599  			_ = rc
 36600  
 36601  		} else {
 36602  			// var pVal uintptr at bp+48, 4
 36603  
 36604  			var rc int32 = sqlite3.Xsqlite3changeset_old(tls, pIter, -1, bp+48 /* &pVal */)
 36605  			_ = rc
 36606  
 36607  			rc = sqlite3.Xsqlite3changeset_old(tls, pIter, *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)), bp+48 /* &pVal */)
 36608  
 36609  		}
 36610  		if eConf != SQLITE_CHANGESET_FOREIGN_KEY {
 36611  			// eConf!=FOREIGN_KEY is always true at this point. The condition is
 36612  			// just there to make it clearer what is being tested.
 36613  			// var nDummy int32 at bp+52, 4
 36614  
 36615  			var rc int32 = sqlite3.Xsqlite3changeset_fk_conflicts(tls, pIter, bp+52 /* &nDummy */)
 36616  			_ = rc
 36617  
 36618  		}
 36619  		// End of testing block
 36620  		//
 36621  	}
 36622  
 36623  	if TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, pEval, TCL_EVAL_GLOBAL) {
 36624  		tcl.XTcl_BackgroundError(tls, interp)
 36625  	} else {
 36626  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 36627  		if (test_obj_eq_string(tls, pRes, ts+10827 /* "OMIT" */) != 0) || (test_obj_eq_string(tls, pRes, ts+489 /* "" */) != 0) {
 36628  			*(*int32)(unsafe.Pointer(bp + 56 /* ret */)) = SQLITE_CHANGESET_OMIT
 36629  		} else if test_obj_eq_string(tls, pRes, ts+7292 /* "REPLACE" */) != 0 {
 36630  			*(*int32)(unsafe.Pointer(bp + 56 /* ret */)) = SQLITE_CHANGESET_REPLACE
 36631  		} else if test_obj_eq_string(tls, pRes, ts+7286 /* "ABORT" */) != 0 {
 36632  			*(*int32)(unsafe.Pointer(bp + 56 /* ret */)) = SQLITE_CHANGESET_ABORT
 36633  		} else {
 36634  			tcl.XTcl_GetIntFromObj(tls, uintptr(0), pRes, bp+56 /* &ret */)
 36635  		}
 36636  	}
 36637  
 36638  	for ok := true; ok; ok = 0 != 0 {
 36639  		var _objPtr uintptr = pEval
 36640  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 36641  			tcl.XTclFreeObj(tls, _objPtr)
 36642  		}
 36643  	}
 36644  	return *(*int32)(unsafe.Pointer(bp + 56 /* ret */))
 36645  }
 36646  
 36647  // The conflict handler used by sqlite3changeset_apply_replace_all().
 36648  // This conflict handler calls sqlite3_value_text16() on all available
 36649  // sqlite3_value objects and then returns CHANGESET_REPLACE, or
 36650  // CHANGESET_OMIT if REPLACE is not applicable. This is used to test the
 36651  // effect of a malloc failure within an sqlite3_value_xxx() function
 36652  // invoked by a conflict-handler callback.
 36653  func replace_handler(tls *libc.TLS, pCtx uintptr, eConf int32, pIter uintptr) int32 { /* test_session.c:693:12: */
 36654  	bp := tls.Alloc(20)
 36655  	defer tls.Free(20)
 36656  
 36657  	// var op int32 at bp+8, 4
 36658  	// SQLITE_UPDATE, DELETE or INSERT
 36659  	// var zTab uintptr at bp, 4
 36660  	// Name of table conflict is on
 36661  	// var nCol int32 at bp+4, 4
 36662  	// Number of columns in table zTab
 36663  	var i int32
 36664  	var x int32 = 0
 36665  
 36666  	sqlite3.Xsqlite3changeset_op(tls, pIter, bp /* &zTab */, bp+4 /* &nCol */, bp+8 /* &op */, uintptr(0))
 36667  
 36668  	if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) != SQLITE_INSERT {
 36669  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)); i++ {
 36670  			// var pVal uintptr at bp+12, 4
 36671  
 36672  			sqlite3.Xsqlite3changeset_old(tls, pIter, i, bp+12 /* &pVal */)
 36673  			sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 12 /* pVal */)))
 36674  			x++
 36675  		}
 36676  	}
 36677  
 36678  	if *(*int32)(unsafe.Pointer(bp + 8 /* op */)) != SQLITE_DELETE {
 36679  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 4 /* nCol */)); i++ {
 36680  			// var pVal uintptr at bp+16, 4
 36681  
 36682  			sqlite3.Xsqlite3changeset_new(tls, pIter, i, bp+16 /* &pVal */)
 36683  			sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pVal */)))
 36684  			x++
 36685  		}
 36686  	}
 36687  
 36688  	if eConf == SQLITE_CHANGESET_DATA {
 36689  		return SQLITE_CHANGESET_REPLACE
 36690  	}
 36691  	return SQLITE_CHANGESET_OMIT
 36692  }
 36693  
 36694  func testStreamInput(tls *libc.TLS, pCtx uintptr, pData uintptr, pnData uintptr) int32 { /* test_session.c:730:12: */
 36695  	var p uintptr = pCtx
 36696  	var nReq int32 = *(*int32)(unsafe.Pointer(pnData))                                                             // Bytes of data requested
 36697  	var nRem int32 = ((*TestStreamInput)(unsafe.Pointer(p)).FnData - (*TestStreamInput)(unsafe.Pointer(p)).FiData) // Bytes of data available
 36698  	var nRet int32 = (*TestStreamInput)(unsafe.Pointer(p)).FnStream                                                // Bytes actually returned
 36699  
 36700  	// Allocate and free some space. There is no point to this, other than
 36701  	// that it allows the regular OOM fault-injection tests to cause an error
 36702  	// in this function.
 36703  	var pAlloc uintptr = sqlite3.Xsqlite3_malloc(tls, 10)
 36704  	if pAlloc == uintptr(0) {
 36705  		return SQLITE_NOMEM
 36706  	}
 36707  	sqlite3.Xsqlite3_free(tls, pAlloc)
 36708  
 36709  	if nRet > nReq {
 36710  		nRet = nReq
 36711  	}
 36712  	if nRet > nRem {
 36713  		nRet = nRem
 36714  	}
 36715  
 36716  	if nRet > 0 {
 36717  		libc.Xmemcpy(tls, pData, ((*TestStreamInput)(unsafe.Pointer(p)).FaData + uintptr((*TestStreamInput)(unsafe.Pointer(p)).FiData)), uint32(nRet))
 36718  		*(*int32)(unsafe.Pointer(p + 12 /* &.iData */)) += (nRet)
 36719  	}
 36720  
 36721  	*(*int32)(unsafe.Pointer(pnData)) = nRet
 36722  	return SQLITE_OK
 36723  }
 36724  
 36725  func testSqlite3changesetApply(tls *libc.TLS, bV2 int32, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:761:26: */
 36726  	bp := tls.Alloc(96)
 36727  	defer tls.Free(96)
 36728  
 36729  	var db uintptr // Database handle
 36730  	// var info Tcl_CmdInfo at bp+40, 32
 36731  	// Database Tcl command (objv[1]) info
 36732  	var rc int32           // Return code from changeset_invert()
 36733  	var pChangeset uintptr // Buffer containing changeset
 36734  	// var nChangeset int32 at bp+72, 4
 36735  	// Size of buffer aChangeset in bytes
 36736  	// var ctx TestConflictHandler at bp+76, 12
 36737  
 36738  	// var sStr TestStreamInput at bp+24, 16
 36739  
 36740  	*(*uintptr)(unsafe.Pointer(bp + 88 /* pRebase */)) = uintptr(0)
 36741  	*(*int32)(unsafe.Pointer(bp + 92 /* nRebase */)) = 0
 36742  	var flags int32 = 0 // Flags for apply_v2()
 36743  
 36744  	libc.Xmemset(tls, bp+24 /* &sStr */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 36745  	(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 36746  
 36747  	// Check for the -nosavepoint flag
 36748  	if bV2 != 0 {
 36749  		if objc > 1 {
 36750  			var z1 uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 36751  			var n int32 = int32(libc.Xstrlen(tls, z1))
 36752  			if ((n > 1) && (n <= 12)) && (0 == sqlite3.Xsqlite3_strnicmp(tls, ts+10832 /* "-nosavepoint" */, z1, n)) {
 36753  				flags = flags | (SQLITE_CHANGESETAPPLY_NOSAVEPOINT)
 36754  				objc--
 36755  				objv += 4
 36756  			}
 36757  		}
 36758  		if objc > 1 {
 36759  			var z1 uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 36760  			var n int32 = int32(libc.Xstrlen(tls, z1))
 36761  			if ((n > 1) && (n <= 7)) && (0 == sqlite3.Xsqlite3_strnicmp(tls, ts+10845 /* "-invert" */, z1, n)) {
 36762  				flags = flags | (SQLITE_CHANGESETAPPLY_INVERT)
 36763  				objc--
 36764  				objv += 4
 36765  			}
 36766  		}
 36767  	}
 36768  
 36769  	if (objc != 4) && (objc != 5) {
 36770  		var zMsg uintptr
 36771  		if bV2 != 0 {
 36772  			zMsg = ts + 10853 /* "?-nosavepoint? ?..." */
 36773  		} else {
 36774  			zMsg = ts + 10924 /* "DB CHANGESET CON..." */
 36775  		}
 36776  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, zMsg)
 36777  		return TCL_ERROR
 36778  	}
 36779  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+40 /* &info */) {
 36780  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), 0))
 36781  		return TCL_ERROR
 36782  	}
 36783  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 40 /* &info */)).FobjClientData))
 36784  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+72 /* &nChangeset */)
 36785  	(*TestConflictHandler)(unsafe.Pointer(bp + 76 /* &ctx */)).FpConflictScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 36786  	(*TestConflictHandler)(unsafe.Pointer(bp + 76 /* &ctx */)).FpFilterScript = func() uintptr {
 36787  		if objc == 5 {
 36788  			return *(*uintptr)(unsafe.Pointer(objv + 4*4))
 36789  		}
 36790  		return uintptr(0)
 36791  	}()
 36792  	(*TestConflictHandler)(unsafe.Pointer(bp + 76 /* &ctx */)).Finterp = interp
 36793  
 36794  	if (*TestStreamInput)(unsafe.Pointer(bp+24 /* &sStr */)).FnStream == 0 {
 36795  		if bV2 == 0 {
 36796  			rc = sqlite3.Xsqlite3changeset_apply(tls, db, *(*int32)(unsafe.Pointer(bp + 72 /* nChangeset */)), pChangeset,
 36797  				func() uintptr {
 36798  					if objc == 5 {
 36799  						return *(*uintptr)(unsafe.Pointer(&struct {
 36800  							f func(*libc.TLS, uintptr, uintptr) int32
 36801  						}{test_filter_handler}))
 36802  					}
 36803  					return uintptr(0)
 36804  				}(), *(*uintptr)(unsafe.Pointer(&struct {
 36805  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 36806  				}{test_conflict_handler})), bp+76 /* &ctx */)
 36807  		} else {
 36808  			rc = sqlite3.Xsqlite3changeset_apply_v2(tls, db, *(*int32)(unsafe.Pointer(bp + 72 /* nChangeset */)), pChangeset,
 36809  				func() uintptr {
 36810  					if objc == 5 {
 36811  						return *(*uintptr)(unsafe.Pointer(&struct {
 36812  							f func(*libc.TLS, uintptr, uintptr) int32
 36813  						}{test_filter_handler}))
 36814  					}
 36815  					return uintptr(0)
 36816  				}(), *(*uintptr)(unsafe.Pointer(&struct {
 36817  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 36818  				}{test_conflict_handler})), bp+76, /* &ctx */
 36819  				bp+88 /* &pRebase */, bp+92 /* &nRebase */, flags)
 36820  		}
 36821  	} else {
 36822  		(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FaData = pChangeset
 36823  		(*TestStreamInput)(unsafe.Pointer(bp + 24 /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 72 /* nChangeset */))
 36824  		if bV2 == 0 {
 36825  			rc = sqlite3.Xsqlite3changeset_apply_strm(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 36826  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 36827  			}{testStreamInput})), bp+24, /* &sStr */
 36828  				func() uintptr {
 36829  					if objc == 5 {
 36830  						return *(*uintptr)(unsafe.Pointer(&struct {
 36831  							f func(*libc.TLS, uintptr, uintptr) int32
 36832  						}{test_filter_handler}))
 36833  					}
 36834  					return uintptr(0)
 36835  				}(),
 36836  				*(*uintptr)(unsafe.Pointer(&struct {
 36837  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 36838  				}{test_conflict_handler})), bp+76 /* &ctx */)
 36839  		} else {
 36840  			rc = sqlite3.Xsqlite3changeset_apply_v2_strm(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 36841  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 36842  			}{testStreamInput})), bp+24, /* &sStr */
 36843  				func() uintptr {
 36844  					if objc == 5 {
 36845  						return *(*uintptr)(unsafe.Pointer(&struct {
 36846  							f func(*libc.TLS, uintptr, uintptr) int32
 36847  						}{test_filter_handler}))
 36848  					}
 36849  					return uintptr(0)
 36850  				}(),
 36851  				*(*uintptr)(unsafe.Pointer(&struct {
 36852  					f func(*libc.TLS, uintptr, int32, uintptr) int32
 36853  				}{test_conflict_handler})), bp+76, /* &ctx */
 36854  				bp+88 /* &pRebase */, bp+92 /* &nRebase */, flags)
 36855  		}
 36856  	}
 36857  
 36858  	if rc != SQLITE_OK {
 36859  		return test_session_error(tls, interp, rc, uintptr(0))
 36860  	} else {
 36861  		tcl.XTcl_ResetResult(tls, interp)
 36862  		if (bV2 != 0) && (*(*uintptr)(unsafe.Pointer(bp + 88 /* pRebase */)) != 0) {
 36863  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pRebase */)), *(*int32)(unsafe.Pointer(bp + 92 /* nRebase */))))
 36864  		}
 36865  	}
 36866  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* pRebase */)))
 36867  	return TCL_OK
 36868  }
 36869  
 36870  // sqlite3changeset_apply DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?
 36871  func test_sqlite3changeset_apply(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:868:26: */
 36872  	return testSqlite3changesetApply(tls, 0, clientData, interp, objc, objv)
 36873  }
 36874  
 36875  // sqlite3changeset_apply_v2 DB CHANGESET CONFLICT-SCRIPT ?FILTER-SCRIPT?
 36876  func test_sqlite3changeset_apply_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:879:26: */
 36877  	return testSqlite3changesetApply(tls, 1, clientData, interp, objc, objv)
 36878  }
 36879  
 36880  // sqlite3changeset_apply_replace_all DB CHANGESET
 36881  func test_sqlite3changeset_apply_replace_all(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:891:26: */
 36882  	bp := tls.Alloc(60)
 36883  	defer tls.Free(60)
 36884  
 36885  	var db uintptr // Database handle
 36886  	// var info Tcl_CmdInfo at bp+24, 32
 36887  	// Database Tcl command (objv[1]) info
 36888  	var rc int32           // Return code from changeset_invert()
 36889  	var pChangeset uintptr // Buffer containing changeset
 36890  	// var nChangeset int32 at bp+56, 4
 36891  	// Size of buffer aChangeset in bytes
 36892  
 36893  	if objc != 3 {
 36894  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10969 /* "DB CHANGESET" */)
 36895  		return TCL_ERROR
 36896  	}
 36897  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+24 /* &info */) {
 36898  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+1791 /* "no such handle: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 0))
 36899  		return TCL_ERROR
 36900  	}
 36901  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &info */)).FobjClientData))
 36902  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+56 /* &nChangeset */)
 36903  
 36904  	rc = sqlite3.Xsqlite3changeset_apply(tls, db, *(*int32)(unsafe.Pointer(bp + 56 /* nChangeset */)), pChangeset, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 36905  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 36906  	}{replace_handler})), uintptr(0))
 36907  	if rc != SQLITE_OK {
 36908  		return test_session_error(tls, interp, rc, uintptr(0))
 36909  	}
 36910  	tcl.XTcl_ResetResult(tls, interp)
 36911  	return TCL_OK
 36912  }
 36913  
 36914  // sqlite3changeset_invert CHANGESET
 36915  func test_sqlite3changeset_invert(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:926:26: */
 36916  	bp := tls.Alloc(24)
 36917  	defer tls.Free(24)
 36918  
 36919  	var rc int32 // Return code from changeset_invert()
 36920  	// var sIn TestStreamInput at bp, 16
 36921  	// Input stream
 36922  	// var sOut TestSessionsBlob at bp+16, 8
 36923  	// Output blob
 36924  
 36925  	if objc != 2 {
 36926  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10982 /* "CHANGESET" */)
 36927  		return TCL_ERROR
 36928  	}
 36929  
 36930  	libc.Xmemset(tls, bp /* &sIn */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 36931  	libc.Xmemset(tls, bp+16 /* &sOut */, 0, uint32(unsafe.Sizeof(TestSessionsBlob{})))
 36932  	(*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 36933  	(*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), (bp /* &sIn */ + 8 /* &.nData */))
 36934  
 36935  	if (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnStream != 0 {
 36936  		rc = sqlite3.Xsqlite3changeset_invert_strm(tls,
 36937  			*(*uintptr)(unsafe.Pointer(&struct {
 36938  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 36939  			}{testStreamInput})), bp /* &sIn */, *(*uintptr)(unsafe.Pointer(&struct {
 36940  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 36941  			}{testStreamOutput})), bp+16 /* &sOut */)
 36942  	} else {
 36943  		rc = sqlite3.Xsqlite3changeset_invert(tls, (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp /* &sIn */)).FaData, (bp + 16 /* &sOut */ + 4 /* &.n */), (bp + 16 /* &sOut */ /* &.p */))
 36944  	}
 36945  	if rc != SQLITE_OK {
 36946  		rc = test_session_error(tls, interp, rc, uintptr(0))
 36947  	} else {
 36948  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+16 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+16 /* &sOut */)).Fn))
 36949  	}
 36950  	sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+16 /* &sOut */)).Fp)
 36951  	return rc
 36952  }
 36953  
 36954  // sqlite3changeset_concat LEFT RIGHT
 36955  func test_sqlite3changeset_concat(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:965:26: */
 36956  	bp := tls.Alloc(40)
 36957  	defer tls.Free(40)
 36958  
 36959  	var rc int32 // Return code from changeset_invert()
 36960  
 36961  	// var sLeft TestStreamInput at bp, 16
 36962  	// Input stream
 36963  	// var sRight TestStreamInput at bp+16, 16
 36964  	// Input stream
 36965  	*(*TestSessionsBlob)(unsafe.Pointer(bp + 32 /* sOut */)) = TestSessionsBlob{} // Output blob
 36966  
 36967  	if objc != 3 {
 36968  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10992 /* "LEFT RIGHT" */)
 36969  		return TCL_ERROR
 36970  	}
 36971  
 36972  	libc.Xmemset(tls, bp /* &sLeft */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 36973  	libc.Xmemset(tls, bp+16 /* &sRight */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 36974  	(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), (bp /* &sLeft */ + 8 /* &.nData */))
 36975  	(*TestStreamInput)(unsafe.Pointer(bp + 16 /* &sRight */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), (bp + 16 /* &sRight */ + 8 /* &.nData */))
 36976  	(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 36977  	(*TestStreamInput)(unsafe.Pointer(bp + 16 /* &sRight */)).FnStream = (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream
 36978  
 36979  	if (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnStream > 0 {
 36980  		rc = sqlite3.Xsqlite3changeset_concat_strm(tls,
 36981  			*(*uintptr)(unsafe.Pointer(&struct {
 36982  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 36983  			}{testStreamInput})), bp, /* &sLeft */
 36984  			*(*uintptr)(unsafe.Pointer(&struct {
 36985  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 36986  			}{testStreamInput})), bp+16, /* &sRight */
 36987  			*(*uintptr)(unsafe.Pointer(&struct {
 36988  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 36989  			}{testStreamOutput})), bp+32 /* &sOut */)
 36990  	} else {
 36991  		rc = sqlite3.Xsqlite3changeset_concat(tls,
 36992  			(*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp /* &sLeft */)).FaData, (*TestStreamInput)(unsafe.Pointer(bp+16 /* &sRight */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp+16 /* &sRight */)).FaData, (bp + 32 /* &sOut */ + 4 /* &.n */), (bp + 32 /* &sOut */ /* &.p */))
 36993  	}
 36994  
 36995  	if rc != SQLITE_OK {
 36996  		rc = test_session_error(tls, interp, rc, uintptr(0))
 36997  	} else {
 36998  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fn))
 36999  	}
 37000  	sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+32 /* &sOut */)).Fp)
 37001  	return rc
 37002  }
 37003  
 37004  // sqlite3session_foreach VARNAME CHANGESET SCRIPT
 37005  func test_sqlite3session_foreach(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1013:26: */
 37006  	bp := tls.Alloc(60)
 37007  	defer tls.Free(60)
 37008  
 37009  	var pChangeset uintptr
 37010  	// var nChangeset int32 at bp+16, 4
 37011  
 37012  	// var pIter uintptr at bp+20, 4
 37013  
 37014  	var rc int32
 37015  	var pVarname uintptr
 37016  	var pCS uintptr
 37017  	var pScript uintptr
 37018  	var isCheckNext int32 = 0
 37019  	var isInvert int32 = 0
 37020  	// var sStr TestStreamInput at bp, 16
 37021  
 37022  	libc.Xmemset(tls, bp /* &sStr */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 37023  
 37024  	for objc > 1 {
 37025  		var zOpt uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 37026  		var nOpt int32 = int32(libc.Xstrlen(tls, zOpt))
 37027  		if int32(*(*int8)(unsafe.Pointer(zOpt))) != '-' {
 37028  			break
 37029  		}
 37030  		if (nOpt <= 7) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+10845 /* "-invert" */, nOpt)) {
 37031  			isInvert = 1
 37032  		} else if (nOpt <= 5) && (0 == sqlite3.Xsqlite3_strnicmp(tls, zOpt, ts+11003 /* "-next" */, nOpt)) {
 37033  			isCheckNext = 1
 37034  		} else {
 37035  			break
 37036  		}
 37037  		objv += 4
 37038  		objc--
 37039  	}
 37040  	if objc != 4 {
 37041  		tcl.XTcl_WrongNumArgs(tls,
 37042  			interp, 1, objv, ts+11009 /* "?-next? ?-invert..." */)
 37043  		return TCL_ERROR
 37044  	}
 37045  
 37046  	pVarname = *(*uintptr)(unsafe.Pointer(objv + 1*4))
 37047  	pCS = *(*uintptr)(unsafe.Pointer(objv + 2*4))
 37048  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 37049  
 37050  	pChangeset = tcl.XTcl_GetByteArrayFromObj(tls, pCS, bp+16 /* &nChangeset */)
 37051  	(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 37052  	if isInvert != 0 {
 37053  		var f int32 = SQLITE_CHANGESETSTART_INVERT
 37054  		if (*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream == 0 {
 37055  			rc = sqlite3.Xsqlite3changeset_start_v2(tls, bp+20 /* &pIter */, *(*int32)(unsafe.Pointer(bp + 16 /* nChangeset */)), pChangeset, f)
 37056  		} else {
 37057  			var pCtx uintptr = bp /* &sStr */
 37058  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FaData = pChangeset
 37059  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 16 /* nChangeset */))
 37060  			rc = sqlite3.Xsqlite3changeset_start_v2_strm(tls, bp+20 /* &pIter */, *(*uintptr)(unsafe.Pointer(&struct {
 37061  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 37062  			}{testStreamInput})), pCtx, f)
 37063  		}
 37064  	} else {
 37065  		if (*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnStream == 0 {
 37066  			rc = sqlite3.Xsqlite3changeset_start(tls, bp+20 /* &pIter */, *(*int32)(unsafe.Pointer(bp + 16 /* nChangeset */)), pChangeset)
 37067  		} else {
 37068  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FaData = pChangeset
 37069  			(*TestStreamInput)(unsafe.Pointer(bp /* &sStr */)).FnData = *(*int32)(unsafe.Pointer(bp + 16 /* nChangeset */))
 37070  			rc = sqlite3.Xsqlite3changeset_start_strm(tls, bp+20 /* &pIter */, *(*uintptr)(unsafe.Pointer(&struct {
 37071  				f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 37072  			}{testStreamInput})), bp /* &sStr */)
 37073  		}
 37074  	}
 37075  	if rc != SQLITE_OK {
 37076  		return test_session_error(tls, interp, rc, uintptr(0))
 37077  	}
 37078  
 37079  	for SQLITE_ROW == sqlite3.Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */))) {
 37080  		// var nCol int32 at bp+32, 4
 37081  		// Number of columns in table
 37082  		// var nCol2 int32 at bp+48, 4
 37083  		// Number of columns in table
 37084  		// var op int32 at bp+36, 4
 37085  		// SQLITE_INSERT, UPDATE or DELETE
 37086  		// var zTab uintptr at bp+28, 4
 37087  		// Name of table change applies to
 37088  		var pVar uintptr // Tcl value to set $VARNAME to
 37089  		var pOld uintptr // Vector of old.* values
 37090  		var pNew uintptr // Vector of new.* values
 37091  		// var bIndirect int32 at bp+40, 4
 37092  
 37093  		var zPK uintptr
 37094  		// var abPK uintptr at bp+44, 4
 37095  
 37096  		var i int32
 37097  
 37098  		// Test that _fk_conflicts() returns SQLITE_MISUSE if called on this
 37099  		// iterator.
 37100  		// var nDummy int32 at bp+24, 4
 37101  
 37102  		if SQLITE_MISUSE != sqlite3.Xsqlite3changeset_fk_conflicts(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)), bp+24 /* &nDummy */) {
 37103  			sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)))
 37104  			return TCL_ERROR
 37105  		}
 37106  
 37107  		sqlite3.Xsqlite3changeset_op(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)), bp+28 /* &zTab */, bp+32 /* &nCol */, bp+36 /* &op */, bp+40 /* &bIndirect */)
 37108  		pVar = tcl.XTcl_NewObj(tls)
 37109  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls,
 37110  			func() uintptr {
 37111  				if *(*int32)(unsafe.Pointer(bp + 36 /* op */)) == SQLITE_INSERT {
 37112  					return ts + 10772 /* "INSERT" */
 37113  				}
 37114  				return func() uintptr {
 37115  					if *(*int32)(unsafe.Pointer(bp + 36 /* op */)) == SQLITE_UPDATE {
 37116  						return ts + 10779 /* "UPDATE" */
 37117  					}
 37118  					return ts + 10786 /* "DELETE" */
 37119  				}()
 37120  			}(), -1))
 37121  
 37122  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* zTab */)), -1))
 37123  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewIntObj(tls, (libc.Bool32((*(*int32)(unsafe.Pointer(bp + 40 /* bIndirect */))) != 0))))
 37124  
 37125  		zPK = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 32 /* nCol */)) + 1)))
 37126  		libc.Xmemset(tls, zPK, 0, (uint32(*(*int32)(unsafe.Pointer(bp + 32 /* nCol */)) + 1)))
 37127  		sqlite3.Xsqlite3changeset_pk(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)), bp+44 /* &abPK */, bp+48 /* &nCol2 */)
 37128  
 37129  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 32 /* nCol */)); i++ {
 37130  			*(*int8)(unsafe.Pointer(zPK + uintptr(i))) = func() int8 {
 37131  				if *(*uint8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* abPK */)) + uintptr(i))) != 0 {
 37132  					return int8('X')
 37133  				}
 37134  				return int8('.')
 37135  			}()
 37136  		}
 37137  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, tcl.XTcl_NewStringObj(tls, zPK, -1))
 37138  		tcl.XTcl_Free(tls, zPK)
 37139  
 37140  		pOld = tcl.XTcl_NewObj(tls)
 37141  		if *(*int32)(unsafe.Pointer(bp + 36 /* op */)) != SQLITE_INSERT {
 37142  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 32 /* nCol */)); i++ {
 37143  				// var pVal uintptr at bp+52, 4
 37144  
 37145  				sqlite3.Xsqlite3changeset_old(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)), i, bp+52 /* &pVal */)
 37146  				test_append_value(tls, pOld, *(*uintptr)(unsafe.Pointer(bp + 52 /* pVal */)))
 37147  			}
 37148  		}
 37149  		pNew = tcl.XTcl_NewObj(tls)
 37150  		if *(*int32)(unsafe.Pointer(bp + 36 /* op */)) != SQLITE_DELETE {
 37151  			for i = 0; i < *(*int32)(unsafe.Pointer(bp + 32 /* nCol */)); i++ {
 37152  				// var pVal uintptr at bp+56, 4
 37153  
 37154  				sqlite3.Xsqlite3changeset_new(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)), i, bp+56 /* &pVal */)
 37155  				test_append_value(tls, pNew, *(*uintptr)(unsafe.Pointer(bp + 56 /* pVal */)))
 37156  			}
 37157  		}
 37158  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, pOld)
 37159  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pVar, pNew)
 37160  
 37161  		tcl.XTcl_ObjSetVar2(tls, interp, pVarname, uintptr(0), pVar, 0)
 37162  		rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 37163  		if (rc != TCL_OK) && (rc != TCL_CONTINUE) {
 37164  			sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)))
 37165  			if rc == TCL_BREAK {
 37166  				return TCL_OK
 37167  			}
 37168  			return rc
 37169  		}
 37170  	}
 37171  
 37172  	if isCheckNext != 0 {
 37173  		var rc2 int32 = sqlite3.Xsqlite3changeset_next(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)))
 37174  		_ = rc2
 37175  		rc = sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)))
 37176  
 37177  	} else {
 37178  		rc = sqlite3.Xsqlite3changeset_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pIter */)))
 37179  	}
 37180  	if rc != SQLITE_OK {
 37181  		return test_session_error(tls, interp, rc, uintptr(0))
 37182  	}
 37183  
 37184  	return TCL_OK
 37185  }
 37186  
 37187  // tclcmd: CMD configure REBASE-BLOB
 37188  // tclcmd: CMD rebase CHANGESET
 37189  // tclcmd: CMD delete
 37190  func test_rebaser_cmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1171:26: */
 37191  	bp := tls.Alloc(32)
 37192  	defer tls.Free(32)
 37193  
 37194  	var p uintptr = clientData
 37195  	// var iSub int32 at bp, 4
 37196  
 37197  	var rc int32
 37198  
 37199  	if objc < 2 {
 37200  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 37201  		return TCL_ERROR
 37202  	}
 37203  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 37204  		*(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&aSub1)), int32(unsafe.Sizeof(RebaseSubcmd{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 37205  	if rc != TCL_OK {
 37206  		return rc
 37207  	}
 37208  	if objc != (2 + aSub1[*(*int32)(unsafe.Pointer(bp /* iSub */))].FnArg) {
 37209  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, aSub1[*(*int32)(unsafe.Pointer(bp /* iSub */))].FzMsg)
 37210  		return TCL_ERROR
 37211  	}
 37212  
 37213  	switch *(*int32)(unsafe.Pointer(bp /* iSub */)) {
 37214  	case 0:
 37215  		{ // configure
 37216  			*(*int32)(unsafe.Pointer(bp + 4 /* nRebase */)) = 0
 37217  			var pRebase uintptr = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &nRebase */)
 37218  			rc = sqlite3.Xsqlite3rebaser_configure(tls, p, *(*int32)(unsafe.Pointer(bp + 4 /* nRebase */)), pRebase)
 37219  			break
 37220  
 37221  		}
 37222  
 37223  	case 1: // delete
 37224  		tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 37225  		break
 37226  
 37227  	default:
 37228  		{ // rebase
 37229  			// var sStr TestStreamInput at bp+8, 16
 37230  			// Input stream
 37231  			// var sOut TestSessionsBlob at bp+24, 8
 37232  			// Output blob
 37233  
 37234  			libc.Xmemset(tls, bp+8 /* &sStr */, 0, uint32(unsafe.Sizeof(TestStreamInput{})))
 37235  			libc.Xmemset(tls, bp+24 /* &sOut */, 0, uint32(unsafe.Sizeof(TestSessionsBlob{})))
 37236  			(*TestStreamInput)(unsafe.Pointer(bp + 8 /* &sStr */)).FaData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), (bp + 8 /* &sStr */ + 8 /* &.nData */))
 37237  			(*TestStreamInput)(unsafe.Pointer(bp + 8 /* &sStr */)).FnStream = test_tcl_integer(tls, interp, ts+10561 /* "sqlite3session_s..." */)
 37238  
 37239  			if (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FnStream != 0 {
 37240  				rc = sqlite3.Xsqlite3rebaser_rebase_strm(tls, p,
 37241  					*(*uintptr)(unsafe.Pointer(&struct {
 37242  						f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 37243  					}{testStreamInput})), bp+8, /* &sStr */
 37244  					*(*uintptr)(unsafe.Pointer(&struct {
 37245  						f func(*libc.TLS, uintptr, uintptr, int32) int32
 37246  					}{testStreamOutput})), bp+24 /* &sOut */)
 37247  			} else {
 37248  				rc = sqlite3.Xsqlite3rebaser_rebase(tls, p, (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FnData, (*TestStreamInput)(unsafe.Pointer(bp+8 /* &sStr */)).FaData, (bp + 24 /* &sOut */ + 4 /* &.n */), (bp + 24 /* &sOut */ /* &.p */))
 37249  			}
 37250  
 37251  			if rc == SQLITE_OK {
 37252  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fp, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fn))
 37253  			}
 37254  			sqlite3.Xsqlite3_free(tls, (*TestSessionsBlob)(unsafe.Pointer(bp+24 /* &sOut */)).Fp)
 37255  			break
 37256  
 37257  		}
 37258  	}
 37259  
 37260  	if rc != SQLITE_OK {
 37261  		return test_session_error(tls, interp, rc, uintptr(0))
 37262  	}
 37263  	return TCL_OK
 37264  }
 37265  
 37266  type RebaseSubcmd = struct {
 37267  	FzSub uintptr
 37268  	FnArg int32
 37269  	FzMsg uintptr
 37270  	FiSub int32
 37271  } /* test_session.c:1177:10 */
 37272  
 37273  var aSub1 = [4]RebaseSubcmd{
 37274  	{FzSub: ts + 11052 /* "configure" */, FnArg: 1, FzMsg: ts + 11062 /* "REBASE-BLOB" */}, // 0
 37275  	{FzSub: ts + 10601 /* "delete" */, FzMsg: ts + 489 /* "" */},                           // 1
 37276  	{FzSub: ts + 11074 /* "rebase" */, FnArg: 1, FzMsg: ts + 10982 /* "CHANGESET" */},      // 2
 37277  	{},
 37278  } /* test_session.c:1182:5 */
 37279  
 37280  func test_rebaser_del(tls *libc.TLS, clientData uintptr) { /* test_session.c:1252:27: */
 37281  	var p uintptr = clientData
 37282  	sqlite3.Xsqlite3rebaser_delete(tls, p)
 37283  }
 37284  
 37285  // tclcmd: sqlite3rebaser_create NAME
 37286  func test_sqlite3rebaser_create(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1260:26: */
 37287  	bp := tls.Alloc(4)
 37288  	defer tls.Free(4)
 37289  
 37290  	var rc int32
 37291  	*(*uintptr)(unsafe.Pointer(bp /* pNew */)) = uintptr(0)
 37292  	if objc != 2 {
 37293  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 37294  		return SQLITE_ERROR
 37295  	}
 37296  
 37297  	rc = sqlite3.Xsqlite3rebaser_create(tls, bp /* &pNew */)
 37298  	if rc != SQLITE_OK {
 37299  		return test_session_error(tls, interp, rc, uintptr(0))
 37300  	}
 37301  
 37302  	tcl.XTcl_CreateObjCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), *(*uintptr)(unsafe.Pointer(&struct {
 37303  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37304  	}{test_rebaser_cmd})),
 37305  		*(*uintptr)(unsafe.Pointer(bp /* pNew */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_rebaser_del})))
 37306  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 37307  	return TCL_OK
 37308  }
 37309  
 37310  // tclcmd: sqlite3rebaser_configure OP VALUE
 37311  func test_sqlite3session_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_session.c:1288:26: */
 37312  	bp := tls.Alloc(8)
 37313  	defer tls.Free(8)
 37314  
 37315  	var rc int32
 37316  	// var iSub int32 at bp, 4
 37317  
 37318  	// var iVal int32 at bp+4, 4
 37319  
 37320  	if objc != 3 {
 37321  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+11081 /* "OP VALUE" */)
 37322  		return SQLITE_ERROR
 37323  	}
 37324  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 37325  		*(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&aSub2)), int32(unsafe.Sizeof(ConfigOpt{})), ts+1875 /* "sub-command" */, 0, bp /* &iSub */)
 37326  	if rc != TCL_OK {
 37327  		return rc
 37328  	}
 37329  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &iVal */) != 0 {
 37330  		return TCL_ERROR
 37331  	}
 37332  
 37333  	rc = sqlite3.Xsqlite3session_config(tls, aSub2[*(*int32)(unsafe.Pointer(bp /* iSub */))].Fop, bp+4 /* &iVal */)
 37334  	if rc != SQLITE_OK {
 37335  		return test_session_error(tls, interp, rc, uintptr(0))
 37336  	}
 37337  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* iVal */))))
 37338  	return TCL_OK
 37339  }
 37340  
 37341  type ConfigOpt = struct {
 37342  	FzSub uintptr
 37343  	Fop   int32
 37344  } /* test_session.c:1294:10 */
 37345  
 37346  var aSub2 = [3]ConfigOpt{
 37347  	{FzSub: ts + 11090 /* "strm_size" */, Fop: SQLITE_SESSION_CONFIG_STRMSIZE},
 37348  	{FzSub: ts + 2619 /* "invalid" */},
 37349  	{},
 37350  } /* test_session.c:1297:5 */
 37351  
 37352  func TestSession_Init(tls *libc.TLS, interp uintptr) int32 { /* test_session.c:1324:5: */
 37353  	bp := tls.Alloc(80)
 37354  	defer tls.Free(80)
 37355  
 37356  	*(*[10]struct {
 37357  		FzCmd  uintptr
 37358  		FxProc uintptr
 37359  	})(unsafe.Pointer(bp /* aCmd */)) = [10]struct {
 37360  		FzCmd  uintptr
 37361  		FxProc uintptr
 37362  	}{
 37363  		{FzCmd: ts + 11100 /* "sqlite3session" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37364  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37365  		}{test_sqlite3session}))},
 37366  		{FzCmd: ts + 11115 /* "sqlite3session_f..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37367  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37368  		}{test_sqlite3session_foreach}))},
 37369  		{FzCmd: ts + 11138 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37370  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37371  		}{test_sqlite3changeset_invert}))},
 37372  		{FzCmd: ts + 11162 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37373  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37374  		}{test_sqlite3changeset_concat}))},
 37375  		{FzCmd: ts + 11186 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37376  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37377  		}{test_sqlite3changeset_apply}))},
 37378  		{FzCmd: ts + 11209 /* "sqlite3changeset..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37379  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37380  		}{test_sqlite3changeset_apply_v2}))},
 37381  		{FzCmd: ts + 11235, /* "sqlite3changeset..." */
 37382  			FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37383  				f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37384  			}{test_sqlite3changeset_apply_replace_all}))},
 37385  		{FzCmd: ts + 11270 /* "sql_exec_changes..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37386  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37387  		}{test_sql_exec_changeset}))},
 37388  		{FzCmd: ts + 11289 /* "sqlite3rebaser_c..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37389  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37390  		}{test_sqlite3rebaser_create}))},
 37391  		{FzCmd: ts + 11311 /* "sqlite3session_c..." */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 37392  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 37393  		}{test_sqlite3session_config}))},
 37394  	}
 37395  	var i int32
 37396  
 37397  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof([10]struct {
 37398  		FzCmd  uintptr
 37399  		FxProc uintptr
 37400  	}{})) / uint32(unsafe.Sizeof(struct {
 37401  		FzCmd  uintptr
 37402  		FxProc uintptr
 37403  	}{}))); i++ {
 37404  		var p uintptr = (bp /* &aCmd */ + uintptr(i)*8)
 37405  		tcl.XTcl_CreateObjCommand(tls, interp, (*struct {
 37406  			FzCmd  uintptr
 37407  			FxProc uintptr
 37408  		})(unsafe.Pointer(p)).FzCmd, (*struct {
 37409  			FzCmd  uintptr
 37410  			FxProc uintptr
 37411  		})(unsafe.Pointer(p)).FxProc, uintptr(0), uintptr(0))
 37412  	}
 37413  
 37414  	return TCL_OK
 37415  }
 37416  
 37417  // 2014-09-08
 37418  //
 37419  // The author disclaims copyright to this source code.  In place of
 37420  // a legal notice, here is a blessing:
 37421  //
 37422  //    May you do good and not evil.
 37423  //    May you find forgiveness for yourself and forgive others.
 37424  //    May you share freely, never taking more than you give.
 37425  //
 37426  //
 37427  //
 37428  // This file contains the bulk of the implementation of the
 37429  // user-authentication extension feature.  Some parts of the user-
 37430  // authentication code are contained within the SQLite core (in the
 37431  // src/ subdirectory of the main source code tree) but those parts
 37432  // that could reasonable be separated out are moved into this file.
 37433  //
 37434  // To compile with the user-authentication feature, append this file to
 37435  // end of an SQLite amalgamation, then add the SQLITE_USER_AUTHENTICATION
 37436  // compile-time option.  See the user-auth.txt file in the same source
 37437  // directory as this file for additional information.
 37438  
 37439  // Used to get the current process ID
 37440  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 37441  //    This file is part of the GNU C Library.
 37442  //
 37443  //    The GNU C Library is free software; you can redistribute it and/or
 37444  //    modify it under the terms of the GNU Lesser General Public
 37445  //    License as published by the Free Software Foundation; either
 37446  //    version 2.1 of the License, or (at your option) any later version.
 37447  //
 37448  //    The GNU C Library is distributed in the hope that it will be useful,
 37449  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37450  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37451  //    Lesser General Public License for more details.
 37452  //
 37453  //    You should have received a copy of the GNU Lesser General Public
 37454  //    License along with the GNU C Library; if not, see
 37455  //    <http://www.gnu.org/licenses/>.
 37456  
 37457  //	ISO C99 Standard: 7.14 Signal handling <signal.h>
 37458  
 37459  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 37460  //    This file is part of the GNU C Library.
 37461  //
 37462  //    The GNU C Library is free software; you can redistribute it and/or
 37463  //    modify it under the terms of the GNU Lesser General Public
 37464  //    License as published by the Free Software Foundation; either
 37465  //    version 2.1 of the License, or (at your option) any later version.
 37466  //
 37467  //    The GNU C Library is distributed in the hope that it will be useful,
 37468  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37469  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37470  //    Lesser General Public License for more details.
 37471  //
 37472  //    You should have received a copy of the GNU Lesser General Public
 37473  //    License along with the GNU C Library; if not, see
 37474  //    <http://www.gnu.org/licenses/>.
 37475  
 37476  // bits/types.h -- definitions of __*_t types underlying *_t types.
 37477  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 37478  //    This file is part of the GNU C Library.
 37479  //
 37480  //    The GNU C Library is free software; you can redistribute it and/or
 37481  //    modify it under the terms of the GNU Lesser General Public
 37482  //    License as published by the Free Software Foundation; either
 37483  //    version 2.1 of the License, or (at your option) any later version.
 37484  //
 37485  //    The GNU C Library is distributed in the hope that it will be useful,
 37486  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37487  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37488  //    Lesser General Public License for more details.
 37489  //
 37490  //    You should have received a copy of the GNU Lesser General Public
 37491  //    License along with the GNU C Library; if not, see
 37492  //    <http://www.gnu.org/licenses/>.
 37493  
 37494  // Never include this file directly; use <sys/types.h> instead.
 37495  
 37496  // Signal number definitions.  Linux version.
 37497  //    Copyright (C) 1995-2018 Free Software Foundation, Inc.
 37498  //    This file is part of the GNU C Library.
 37499  //
 37500  //    The GNU C Library is free software; you can redistribute it and/or
 37501  //    modify it under the terms of the GNU Lesser General Public
 37502  //    License as published by the Free Software Foundation; either
 37503  //    version 2.1 of the License, or (at your option) any later version.
 37504  //
 37505  //    The GNU C Library is distributed in the hope that it will be useful,
 37506  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37507  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37508  //    Lesser General Public License for more details.
 37509  //
 37510  //    You should have received a copy of the GNU Lesser General Public
 37511  //    License along with the GNU C Library; if not, see
 37512  //    <http://www.gnu.org/licenses/>.
 37513  
 37514  // Signal number constants.  Generic template.
 37515  //    Copyright (C) 1991-2018 Free Software Foundation, Inc.
 37516  //    This file is part of the GNU C Library.
 37517  //
 37518  //    The GNU C Library is free software; you can redistribute it and/or
 37519  //    modify it under the terms of the GNU Lesser General Public
 37520  //    License as published by the Free Software Foundation; either
 37521  //    version 2.1 of the License, or (at your option) any later version.
 37522  //
 37523  //    The GNU C Library is distributed in the hope that it will be useful,
 37524  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37525  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37526  //    Lesser General Public License for more details.
 37527  //
 37528  //    You should have received a copy of the GNU Lesser General Public
 37529  //    License along with the GNU C Library; if not, see
 37530  //    <http://www.gnu.org/licenses/>.
 37531  
 37532  // Fake signal functions.
 37533  
 37534  // We define here all the signal names listed in POSIX (1003.1-2008);
 37535  //    as of 1003.1-2013, no additional signals have been added by POSIX.
 37536  //    We also define here signal names that historically exist in every
 37537  //    real-world POSIX variant (e.g. SIGWINCH).
 37538  //
 37539  //    Signals in the 1-15 range are defined with their historical numbers.
 37540  //    For other signals, we use the BSD numbers.
 37541  //    There are two unallocated signal numbers in the 1-31 range: 7 and 29.
 37542  //    Signal number 0 is reserved for use as kill(pid, 0), to test whether
 37543  //    a process exists without sending it a signal.
 37544  
 37545  // ISO C99 signals.
 37546  
 37547  // Historical signals specified by POSIX.
 37548  
 37549  // New(er) POSIX signals (1003.1-2008, 1003.1-2013).
 37550  
 37551  // Nonstandard signals found in all modern POSIX systems
 37552  //    (including both BSD and Linux).
 37553  
 37554  // Archaic names for compatibility.
 37555  
 37556  // Not all systems support real-time signals.  bits/signum.h indicates
 37557  //    that they are supported by overriding __SIGRTMAX to a value greater
 37558  //    than __SIGRTMIN.  These constants give the kernel-level hard limits,
 37559  //    but some real-time signals may be used internally by glibc.  Do not
 37560  //    use these constants in application code; use SIGRTMIN and SIGRTMAX
 37561  //    (defined in signal.h) instead.
 37562  
 37563  // Biggest signal number + 1 (including real-time signals).
 37564  
 37565  // Adjustments and additions to the signal number constants for
 37566  //    most Linux systems.
 37567  
 37568  // bits/types.h -- definitions of __*_t types underlying *_t types.
 37569  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 37570  //    This file is part of the GNU C Library.
 37571  //
 37572  //    The GNU C Library is free software; you can redistribute it and/or
 37573  //    modify it under the terms of the GNU Lesser General Public
 37574  //    License as published by the Free Software Foundation; either
 37575  //    version 2.1 of the License, or (at your option) any later version.
 37576  //
 37577  //    The GNU C Library is distributed in the hope that it will be useful,
 37578  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37579  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37580  //    Lesser General Public License for more details.
 37581  //
 37582  //    You should have received a copy of the GNU Lesser General Public
 37583  //    License along with the GNU C Library; if not, see
 37584  //    <http://www.gnu.org/licenses/>.
 37585  
 37586  // Never include this file directly; use <sys/types.h> instead.
 37587  
 37588  // An integral type that can be modified atomically, without the
 37589  //    possibility of a signal arriving in the middle of the operation.
 37590  type sig_atomic_t = int32 /* sig_atomic_t.h:8:24 */
 37591  
 37592  // We need `struct timespec' later on.
 37593  // NB: Include guard matches what <linux/time.h> uses.
 37594  
 37595  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 37596  //    This file is part of the GNU C Library.
 37597  //
 37598  //    The GNU C Library is free software; you can redistribute it and/or
 37599  //    modify it under the terms of the GNU Lesser General Public
 37600  //    License as published by the Free Software Foundation; either
 37601  //    version 2.1 of the License, or (at your option) any later version.
 37602  //
 37603  //    The GNU C Library is distributed in the hope that it will be useful,
 37604  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37605  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37606  //    Lesser General Public License for more details.
 37607  //
 37608  //    You should have received a copy of the GNU Lesser General Public
 37609  //    License along with the GNU C Library; if not, see
 37610  //    <http://www.gnu.org/licenses/>.
 37611  
 37612  // bits/types.h -- definitions of __*_t types underlying *_t types.
 37613  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 37614  //    This file is part of the GNU C Library.
 37615  //
 37616  //    The GNU C Library is free software; you can redistribute it and/or
 37617  //    modify it under the terms of the GNU Lesser General Public
 37618  //    License as published by the Free Software Foundation; either
 37619  //    version 2.1 of the License, or (at your option) any later version.
 37620  //
 37621  //    The GNU C Library is distributed in the hope that it will be useful,
 37622  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37623  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37624  //    Lesser General Public License for more details.
 37625  //
 37626  //    You should have received a copy of the GNU Lesser General Public
 37627  //    License along with the GNU C Library; if not, see
 37628  //    <http://www.gnu.org/licenses/>.
 37629  
 37630  // Never include this file directly; use <sys/types.h> instead.
 37631  
 37632  // Define __sigval_t.
 37633  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
 37634  //    This file is part of the GNU C Library.
 37635  //
 37636  //    The GNU C Library is free software; you can redistribute it and/or
 37637  //    modify it under the terms of the GNU Lesser General Public
 37638  //    License as published by the Free Software Foundation; either
 37639  //    version 2.1 of the License, or (at your option) any later version.
 37640  //
 37641  //    The GNU C Library is distributed in the hope that it will be useful,
 37642  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37643  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37644  //    Lesser General Public License for more details.
 37645  //
 37646  //    You should have received a copy of the GNU Lesser General Public
 37647  //    License along with the GNU C Library; if not, see
 37648  //    <http://www.gnu.org/licenses/>.
 37649  
 37650  // Type for data associated with a signal.
 37651  type sigval = struct{ Fsival_int int32 } /* __sigval_t.h:24:1 */
 37652  
 37653  // Some fields of siginfo_t have architecture-specific variations.
 37654  // Architecture-specific adjustments to siginfo_t.
 37655  
 37656  // This architecture has no adjustments to make to siginfo_t.
 37657  
 37658  type siginfo_t = struct {
 37659  	Fsi_signo  int32
 37660  	Fsi_errno  int32
 37661  	Fsi_code   int32
 37662  	F_sifields struct{ F_pad [29]int32 }
 37663  } /* siginfo_t.h:124:5 */
 37664  
 37665  // Architectures might also add architecture-specific constants.
 37666  //    These are all considered GNU extensions.
 37667  
 37668  // Define __sigval_t.
 37669  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
 37670  //    This file is part of the GNU C Library.
 37671  //
 37672  //    The GNU C Library is free software; you can redistribute it and/or
 37673  //    modify it under the terms of the GNU Lesser General Public
 37674  //    License as published by the Free Software Foundation; either
 37675  //    version 2.1 of the License, or (at your option) any later version.
 37676  //
 37677  //    The GNU C Library is distributed in the hope that it will be useful,
 37678  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37679  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37680  //    Lesser General Public License for more details.
 37681  //
 37682  //    You should have received a copy of the GNU Lesser General Public
 37683  //    License along with the GNU C Library; if not, see
 37684  //    <http://www.gnu.org/licenses/>.
 37685  
 37686  // To avoid sigval_t (not a standard type name) having C++ name
 37687  //    mangling depending on whether the selected standard includes union
 37688  //    sigval, it should not be defined at all when using a standard for
 37689  //    which the sigval name is not reserved; in that case, headers should
 37690  //    not include <bits/types/sigval_t.h> and should use only the
 37691  //    internal __sigval_t name.
 37692  
 37693  type sigval_t = sigval /* sigval_t.h:16:20 */
 37694  
 37695  // Copyright (C) 1999-2018 Free Software Foundation, Inc.
 37696  //    This file is part of the GNU C Library.
 37697  //
 37698  //    The GNU C Library is free software; you can redistribute it and/or
 37699  //    modify it under the terms of the GNU Lesser General Public
 37700  //    License as published by the Free Software Foundation; either
 37701  //    version 2.1 of the License, or (at your option) any later version.
 37702  //
 37703  //    The GNU C Library is distributed in the hope that it will be useful,
 37704  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37705  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37706  //    Lesser General Public License for more details.
 37707  //
 37708  //    You should have received a copy of the GNU Lesser General Public
 37709  //    License along with the GNU C Library; if not, see
 37710  //    <http://www.gnu.org/licenses/>.
 37711  
 37712  // bits/types.h -- definitions of __*_t types underlying *_t types.
 37713  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 37714  //    This file is part of the GNU C Library.
 37715  //
 37716  //    The GNU C Library is free software; you can redistribute it and/or
 37717  //    modify it under the terms of the GNU Lesser General Public
 37718  //    License as published by the Free Software Foundation; either
 37719  //    version 2.1 of the License, or (at your option) any later version.
 37720  //
 37721  //    The GNU C Library is distributed in the hope that it will be useful,
 37722  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37723  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37724  //    Lesser General Public License for more details.
 37725  //
 37726  //    You should have received a copy of the GNU Lesser General Public
 37727  //    License along with the GNU C Library; if not, see
 37728  //    <http://www.gnu.org/licenses/>.
 37729  
 37730  // Never include this file directly; use <sys/types.h> instead.
 37731  
 37732  // Define __sigval_t.
 37733  //    Copyright (C) 1997-2018 Free Software Foundation, Inc.
 37734  //    This file is part of the GNU C Library.
 37735  //
 37736  //    The GNU C Library is free software; you can redistribute it and/or
 37737  //    modify it under the terms of the GNU Lesser General Public
 37738  //    License as published by the Free Software Foundation; either
 37739  //    version 2.1 of the License, or (at your option) any later version.
 37740  //
 37741  //    The GNU C Library is distributed in the hope that it will be useful,
 37742  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37743  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37744  //    Lesser General Public License for more details.
 37745  //
 37746  //    You should have received a copy of the GNU Lesser General Public
 37747  //    License along with the GNU C Library; if not, see
 37748  //    <http://www.gnu.org/licenses/>.
 37749  
 37750  // Forward declaration.
 37751  
 37752  // Structure to transport application-defined values with signals.
 37753  type sigevent_t = sigevent /* sigevent_t.h:42:5 */
 37754  
 37755  // 4.4 BSD uses the name `sig_t' for this.
 37756  type sig_t = uintptr /* signal.h:190:24 */
 37757  
 37758  // Get the system-specific definitions of `struct sigaction'
 37759  //    and the `SA_*' and `SIG_*'. constants.
 37760  // The proper definitions for Linux's sigaction.
 37761  //    Copyright (C) 1993-2018 Free Software Foundation, Inc.
 37762  //    This file is part of the GNU C Library.
 37763  //
 37764  //    The GNU C Library is free software; you can redistribute it and/or
 37765  //    modify it under the terms of the GNU Lesser General Public
 37766  //    License as published by the Free Software Foundation; either
 37767  //    version 2.1 of the License, or (at your option) any later version.
 37768  //
 37769  //    The GNU C Library is distributed in the hope that it will be useful,
 37770  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37771  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37772  //    Lesser General Public License for more details.
 37773  //
 37774  //    You should have received a copy of the GNU Lesser General Public
 37775  //    License along with the GNU C Library; if not, see
 37776  //    <http://www.gnu.org/licenses/>.
 37777  
 37778  // Structure describing the action to be taken when a signal arrives.
 37779  type sigaction = struct {
 37780  	F__sigaction_handler struct{ Fsa_handler uintptr }
 37781  	Fsa_mask             struct{ F__val [32]uint32 }
 37782  	Fsa_flags            int32
 37783  	Fsa_restorer         uintptr
 37784  } /* sigaction.h:27:1 */
 37785  
 37786  // Get machine-dependent `struct sigcontext' and signal subcodes.
 37787  // Copyright (C) 1996-2018 Free Software Foundation, Inc.
 37788  //    This file is part of the GNU C Library.
 37789  //
 37790  //    The GNU C Library is free software; you can redistribute it and/or
 37791  //    modify it under the terms of the GNU Lesser General Public
 37792  //    License as published by the Free Software Foundation; either
 37793  //    version 2.1 of the License, or (at your option) any later version.
 37794  //
 37795  //    The GNU C Library is distributed in the hope that it will be useful,
 37796  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37797  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37798  //    Lesser General Public License for more details.
 37799  //
 37800  //    You should have received a copy of the GNU Lesser General Public
 37801  //    License along with the GNU C Library; if not, see
 37802  //    <http://www.gnu.org/licenses/>.
 37803  
 37804  // Kernel headers before 2.1.1 define a struct sigcontext_struct, but
 37805  //    we need sigcontext.
 37806  
 37807  // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 37808  
 37809  // Signal context structure - contains all info to do with the state
 37810  // before the signal handler was invoked.  Note: only add new entries
 37811  // to the end of the structure.
 37812  type sigcontext = struct {
 37813  	Ftrap_no       uint32
 37814  	Ferror_code    uint32
 37815  	Foldmask       uint32
 37816  	Farm_r0        uint32
 37817  	Farm_r1        uint32
 37818  	Farm_r2        uint32
 37819  	Farm_r3        uint32
 37820  	Farm_r4        uint32
 37821  	Farm_r5        uint32
 37822  	Farm_r6        uint32
 37823  	Farm_r7        uint32
 37824  	Farm_r8        uint32
 37825  	Farm_r9        uint32
 37826  	Farm_r10       uint32
 37827  	Farm_fp        uint32
 37828  	Farm_ip        uint32
 37829  	Farm_sp        uint32
 37830  	Farm_lr        uint32
 37831  	Farm_pc        uint32
 37832  	Farm_cpsr      uint32
 37833  	Ffault_address uint32
 37834  } /* sigcontext.h:10:1 */
 37835  
 37836  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 37837  //
 37838  // This file is part of GCC.
 37839  //
 37840  // GCC is free software; you can redistribute it and/or modify
 37841  // it under the terms of the GNU General Public License as published by
 37842  // the Free Software Foundation; either version 3, or (at your option)
 37843  // any later version.
 37844  //
 37845  // GCC is distributed in the hope that it will be useful,
 37846  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 37847  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 37848  // GNU General Public License for more details.
 37849  //
 37850  // Under Section 7 of GPL version 3, you are granted additional
 37851  // permissions described in the GCC Runtime Library Exception, version
 37852  // 3.1, as published by the Free Software Foundation.
 37853  //
 37854  // You should have received a copy of the GNU General Public License and
 37855  // a copy of the GCC Runtime Library Exception along with this program;
 37856  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 37857  // <http://www.gnu.org/licenses/>.
 37858  
 37859  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 37860  
 37861  // Any one of these symbols __need_* means that GNU libc
 37862  //    wants us just to define one data type.  So don't define
 37863  //    the symbols that indicate this file's entire job has been done.
 37864  
 37865  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 37866  //    There's no way to win with the other order!  Sun lossage.
 37867  
 37868  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 37869  //    one less case to deal with in the following.
 37870  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 37871  
 37872  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 37873  //    defined if the corresponding type is *not* defined.
 37874  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 37875  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 37876  
 37877  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 37878  //    Just ignore it.
 37879  
 37880  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 37881  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 37882  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 37883  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 37884  //    If we find that the macros are still defined at this point, we must
 37885  //    invoke them so that the type is defined as expected.
 37886  
 37887  // In case nobody has defined these types, but we aren't running under
 37888  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 37889  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 37890  //    parts of GCC is compiled by an older compiler, that actually
 37891  //    include gstddef.h, such as collect2.
 37892  
 37893  // Signed type of difference of two pointers.
 37894  
 37895  // Define this type if we are doing the whole job,
 37896  //    or if we want this type in particular.
 37897  
 37898  // Unsigned type of `sizeof' something.
 37899  
 37900  // Define this type if we are doing the whole job,
 37901  //    or if we want this type in particular.
 37902  
 37903  // Wide character type.
 37904  //    Locale-writers should change this as necessary to
 37905  //    be big enough to hold unique values not between 0 and 127,
 37906  //    and not (wchar_t) -1, for each defined multibyte character.
 37907  
 37908  // Define this type if we are doing the whole job,
 37909  //    or if we want this type in particular.
 37910  
 37911  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 37912  //     are already defined.
 37913  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 37914  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 37915  
 37916  // A null pointer constant.
 37917  
 37918  // Define stack_t.  Linux version.
 37919  //    Copyright (C) 1998-2018 Free Software Foundation, Inc.
 37920  //    This file is part of the GNU C Library.
 37921  //
 37922  //    The GNU C Library is free software; you can redistribute it and/or
 37923  //    modify it under the terms of the GNU Lesser General Public
 37924  //    License as published by the Free Software Foundation; either
 37925  //    version 2.1 of the License, or (at your option) any later version.
 37926  //
 37927  //    The GNU C Library is distributed in the hope that it will be useful,
 37928  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 37929  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 37930  //    Lesser General Public License for more details.
 37931  //
 37932  //    You should have received a copy of the GNU Lesser General Public
 37933  //    License along with the GNU C Library; if not, see
 37934  //    <http://www.gnu.org/licenses/>.
 37935  
 37936  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 37937  //
 37938  // This file is part of GCC.
 37939  //
 37940  // GCC is free software; you can redistribute it and/or modify
 37941  // it under the terms of the GNU General Public License as published by
 37942  // the Free Software Foundation; either version 3, or (at your option)
 37943  // any later version.
 37944  //
 37945  // GCC is distributed in the hope that it will be useful,
 37946  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 37947  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 37948  // GNU General Public License for more details.
 37949  //
 37950  // Under Section 7 of GPL version 3, you are granted additional
 37951  // permissions described in the GCC Runtime Library Exception, version
 37952  // 3.1, as published by the Free Software Foundation.
 37953  //
 37954  // You should have received a copy of the GNU General Public License and
 37955  // a copy of the GCC Runtime Library Exception along with this program;
 37956  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 37957  // <http://www.gnu.org/licenses/>.
 37958  
 37959  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 37960  
 37961  // Any one of these symbols __need_* means that GNU libc
 37962  //    wants us just to define one data type.  So don't define
 37963  //    the symbols that indicate this file's entire job has been done.
 37964  
 37965  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 37966  //    There's no way to win with the other order!  Sun lossage.
 37967  
 37968  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 37969  //    one less case to deal with in the following.
 37970  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 37971  
 37972  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 37973  //    defined if the corresponding type is *not* defined.
 37974  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 37975  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 37976  
 37977  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 37978  //    Just ignore it.
 37979  
 37980  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 37981  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 37982  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 37983  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 37984  //    If we find that the macros are still defined at this point, we must
 37985  //    invoke them so that the type is defined as expected.
 37986  
 37987  // In case nobody has defined these types, but we aren't running under
 37988  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 37989  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 37990  //    parts of GCC is compiled by an older compiler, that actually
 37991  //    include gstddef.h, such as collect2.
 37992  
 37993  // Signed type of difference of two pointers.
 37994  
 37995  // Define this type if we are doing the whole job,
 37996  //    or if we want this type in particular.
 37997  
 37998  // Unsigned type of `sizeof' something.
 37999  
 38000  // Define this type if we are doing the whole job,
 38001  //    or if we want this type in particular.
 38002  
 38003  // Wide character type.
 38004  //    Locale-writers should change this as necessary to
 38005  //    be big enough to hold unique values not between 0 and 127,
 38006  //    and not (wchar_t) -1, for each defined multibyte character.
 38007  
 38008  // Define this type if we are doing the whole job,
 38009  //    or if we want this type in particular.
 38010  
 38011  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 38012  //     are already defined.
 38013  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 38014  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 38015  
 38016  // A null pointer constant.
 38017  
 38018  // Structure describing a signal stack.
 38019  type stack_t = struct {
 38020  	Fss_sp    uintptr
 38021  	Fss_flags int32
 38022  	Fss_size  size_t
 38023  } /* stack_t.h:31:5 */
 38024  
 38025  // This will define `ucontext_t' and `mcontext_t'.
 38026  // Copyright (C) 1998-2018 Free Software Foundation, Inc.
 38027  //    This file is part of the GNU C Library.
 38028  //
 38029  //    The GNU C Library is free software; you can redistribute it and/or
 38030  //    modify it under the terms of the GNU Lesser General Public
 38031  //    License as published by the Free Software Foundation; either
 38032  //    version 2.1 of the License, or (at your option) any later version.
 38033  //
 38034  //    The GNU C Library is distributed in the hope that it will be useful,
 38035  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 38036  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 38037  //    Lesser General Public License for more details.
 38038  //
 38039  //    You should have received a copy of the GNU Lesser General Public
 38040  //    License along with the GNU C Library.  If not, see
 38041  //    <http://www.gnu.org/licenses/>.
 38042  
 38043  // System V/ARM ABI compliant context switching support.
 38044  
 38045  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 38046  //    This file is part of the GNU C Library.
 38047  //
 38048  //    The GNU C Library is free software; you can redistribute it and/or
 38049  //    modify it under the terms of the GNU Lesser General Public
 38050  //    License as published by the Free Software Foundation; either
 38051  //    version 2.1 of the License, or (at your option) any later version.
 38052  //
 38053  //    The GNU C Library is distributed in the hope that it will be useful,
 38054  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 38055  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 38056  //    Lesser General Public License for more details.
 38057  //
 38058  //    You should have received a copy of the GNU Lesser General Public
 38059  //    License along with the GNU C Library; if not, see
 38060  //    <http://www.gnu.org/licenses/>.
 38061  
 38062  // Define stack_t.  Linux version.
 38063  //    Copyright (C) 1998-2018 Free Software Foundation, Inc.
 38064  //    This file is part of the GNU C Library.
 38065  //
 38066  //    The GNU C Library is free software; you can redistribute it and/or
 38067  //    modify it under the terms of the GNU Lesser General Public
 38068  //    License as published by the Free Software Foundation; either
 38069  //    version 2.1 of the License, or (at your option) any later version.
 38070  //
 38071  //    The GNU C Library is distributed in the hope that it will be useful,
 38072  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 38073  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 38074  //    Lesser General Public License for more details.
 38075  //
 38076  //    You should have received a copy of the GNU Lesser General Public
 38077  //    License along with the GNU C Library; if not, see
 38078  //    <http://www.gnu.org/licenses/>.
 38079  
 38080  type greg_t = int32 /* ucontext.h:36:13 */
 38081  
 38082  // Number of general registers.
 38083  
 38084  // Container for all general registers.
 38085  type gregset_t = [18]greg_t /* ucontext.h:42:16 */
 38086  
 38087  type _libc_fpstate = struct {
 38088  	Ffpregs [8]struct {
 38089  		_          [0]uint32
 38090  		Fsign1     uint32 /* unsigned sign1: 1, unsigned unused: 15, unsigned sign2: 1, unsigned exponent: 14, unsigned j: 1 */
 38091  		Fmantissa1 uint32 /* unsigned mantissa1: 31 */
 38092  		Fmantissa0 uint32 /* unsigned mantissa0: 32 */
 38093  	}
 38094  	Ffpsr      uint32 /* unsigned fpsr: 32 */
 38095  	Ffpcr      uint32 /* unsigned fpcr: 32 */
 38096  	Fftype     [8]uint8
 38097  	Finit_flag uint32
 38098  } /* ucontext.h:81:1 */
 38099  
 38100  // Structure to describe FPU registers.
 38101  type fpregset_t = _libc_fpstate /* ucontext.h:99:30 */
 38102  
 38103  // Context to describe whole processor state.  This only describes
 38104  //    the core registers; coprocessor registers get saved elsewhere
 38105  //    (e.g. in uc_regspace, or somewhere unspecified on the stack
 38106  //    during non-RT signal handlers).
 38107  type mcontext_t = struct {
 38108  	Ftrap_no       uint32
 38109  	Ferror_code    uint32
 38110  	Foldmask       uint32
 38111  	Farm_r0        uint32
 38112  	Farm_r1        uint32
 38113  	Farm_r2        uint32
 38114  	Farm_r3        uint32
 38115  	Farm_r4        uint32
 38116  	Farm_r5        uint32
 38117  	Farm_r6        uint32
 38118  	Farm_r7        uint32
 38119  	Farm_r8        uint32
 38120  	Farm_r9        uint32
 38121  	Farm_r10       uint32
 38122  	Farm_fp        uint32
 38123  	Farm_ip        uint32
 38124  	Farm_sp        uint32
 38125  	Farm_lr        uint32
 38126  	Farm_pc        uint32
 38127  	Farm_cpsr      uint32
 38128  	Ffault_address uint32
 38129  } /* ucontext.h:129:5 */
 38130  
 38131  // Userlevel context.
 38132  type ucontext_t1 = struct {
 38133  	Fuc_flags    uint32
 38134  	Fuc_link     uintptr
 38135  	Fuc_stack    stack_t
 38136  	Fuc_mcontext mcontext_t
 38137  	Fuc_sigmask  sigset_t
 38138  	Fuc_regspace [128]uint32
 38139  } /* ucontext.h:132:9 */
 38140  
 38141  // Userlevel context.
 38142  type ucontext_t = ucontext_t1 /* ucontext.h:140:5 */
 38143  
 38144  // Define struct sigstack.
 38145  //    Copyright (C) 1998-2018 Free Software Foundation, Inc.
 38146  //    This file is part of the GNU C Library.
 38147  //
 38148  //    The GNU C Library is free software; you can redistribute it and/or
 38149  //    modify it under the terms of the GNU Lesser General Public
 38150  //    License as published by the Free Software Foundation; either
 38151  //    version 2.1 of the License, or (at your option) any later version.
 38152  //
 38153  //    The GNU C Library is distributed in the hope that it will be useful,
 38154  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 38155  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 38156  //    Lesser General Public License for more details.
 38157  //
 38158  //    You should have received a copy of the GNU Lesser General Public
 38159  //    License along with the GNU C Library; if not, see
 38160  //    <http://www.gnu.org/licenses/>.
 38161  
 38162  // Structure describing a signal stack (obsolete).
 38163  type sigstack = struct {
 38164  	Fss_sp      uintptr
 38165  	Fss_onstack int32
 38166  } /* struct_sigstack.h:23:1 */
 38167  
 38168  // Define some macros helping to catch buffer overflows.
 38169  
 38170  // Windows needs to know which symbols to export.  Unix does not.
 38171  // BUILD_sqlite should be undefined for Unix.
 38172  
 38173  // Forward declaration
 38174  type SqliteDb = struct {
 38175  	Fdb             uintptr
 38176  	Finterp         uintptr
 38177  	FzBusy          uintptr
 38178  	FzCommit        uintptr
 38179  	FzTrace         uintptr
 38180  	FzTraceV2       uintptr
 38181  	FzProfile       uintptr
 38182  	FzProgress      uintptr
 38183  	FzBindFallback  uintptr
 38184  	FzAuth          uintptr
 38185  	FdisableAuth    int32
 38186  	FzNull          uintptr
 38187  	FpFunc          uintptr
 38188  	FpUpdateHook    uintptr
 38189  	FpPreUpdateHook uintptr
 38190  	FpRollbackHook  uintptr
 38191  	FpWalHook       uintptr
 38192  	FpUnlockNotify  uintptr
 38193  	FpCollate       uintptr
 38194  	Frc             int32
 38195  	FpCollateNeeded uintptr
 38196  	FstmtList       uintptr
 38197  	FstmtLast       uintptr
 38198  	FmaxStmt        int32
 38199  	FnStmt          int32
 38200  	FpIncrblob      uintptr
 38201  	FnStep          int32
 38202  	FnSort          int32
 38203  	FnIndex         int32
 38204  	FnVMStep        int32
 38205  	FnTransaction   int32
 38206  	FopenFlags      int32
 38207  	FbLegacyPrepare int32
 38208  } /* tclsqlite.c:91:25 */
 38209  
 38210  // New SQL functions can be created as TCL scripts.  Each such function
 38211  // is described by an instance of the following structure.
 38212  //
 38213  // Variable eType may be set to SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT,
 38214  // SQLITE_BLOB or SQLITE_NULL. If it is SQLITE_NULL, then the implementation
 38215  // attempts to determine the type of the result based on the Tcl object.
 38216  // If it is SQLITE_TEXT or SQLITE_BLOB, then a text (sqlite3_result_text())
 38217  // or blob (sqlite3_result_blob()) is returned. If it is SQLITE_INTEGER
 38218  // or SQLITE_FLOAT, then an attempt is made to return an integer or float
 38219  // value, falling back to float and then text if this is not possible.
 38220  type SqlFunc1 = struct {
 38221  	Finterp      uintptr
 38222  	FpScript     uintptr
 38223  	FpDb         uintptr
 38224  	FuseEvalObjv int32
 38225  	FeType       int32
 38226  	FzName       uintptr
 38227  	FpNext       uintptr
 38228  } /* tclsqlite.c:105:9 */
 38229  
 38230  // New SQL functions can be created as TCL scripts.  Each such function
 38231  // is described by an instance of the following structure.
 38232  //
 38233  // Variable eType may be set to SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT,
 38234  // SQLITE_BLOB or SQLITE_NULL. If it is SQLITE_NULL, then the implementation
 38235  // attempts to determine the type of the result based on the Tcl object.
 38236  // If it is SQLITE_TEXT or SQLITE_BLOB, then a text (sqlite3_result_text())
 38237  // or blob (sqlite3_result_blob()) is returned. If it is SQLITE_INTEGER
 38238  // or SQLITE_FLOAT, then an attempt is made to return an integer or float
 38239  // value, falling back to float and then text if this is not possible.
 38240  type SqlFunc = SqlFunc1 /* tclsqlite.c:105:24 */
 38241  
 38242  // New collation sequences function can be created as TCL scripts.  Each such
 38243  // function is described by an instance of the following structure.
 38244  type SqlCollate1 = struct {
 38245  	Finterp  uintptr
 38246  	FzScript uintptr
 38247  	FpNext   uintptr
 38248  } /* tclsqlite.c:120:9 */
 38249  
 38250  // New collation sequences function can be created as TCL scripts.  Each such
 38251  // function is described by an instance of the following structure.
 38252  type SqlCollate = SqlCollate1 /* tclsqlite.c:120:27 */
 38253  
 38254  // Prepared statements are cached for faster execution.  Each prepared
 38255  // statement is described by an instance of the following structure.
 38256  type SqlPreparedStmt1 = struct {
 38257  	FpNext  uintptr
 38258  	FpPrev  uintptr
 38259  	FpStmt  uintptr
 38260  	FnSql   int32
 38261  	FzSql   uintptr
 38262  	FnParm  int32
 38263  	FapParm uintptr
 38264  } /* tclsqlite.c:131:9 */
 38265  
 38266  // Prepared statements are cached for faster execution.  Each prepared
 38267  // statement is described by an instance of the following structure.
 38268  type SqlPreparedStmt = SqlPreparedStmt1 /* tclsqlite.c:131:32 */
 38269  
 38270  type IncrblobChannel1 = struct {
 38271  	FpBlob   uintptr
 38272  	FpDb     uintptr
 38273  	FiSeek   int32
 38274  	Fchannel Tcl_Channel
 38275  	FpNext   uintptr
 38276  	FpPrev   uintptr
 38277  } /* tclsqlite.c:142:9 */
 38278  
 38279  type IncrblobChannel = IncrblobChannel1 /* tclsqlite.c:142:32 */
 38280  
 38281  // Compute a string length that is limited to what can be stored in
 38282  // lower 30 bits of a 32-bit signed integer.
 38283  func strlen30(tls *libc.TLS, z uintptr) int32 { /* tclsqlite.c:202:12: */
 38284  	var z2 uintptr = z
 38285  	for *(*int8)(unsafe.Pointer(z2)) != 0 {
 38286  		z2++
 38287  	}
 38288  	return (0x3fffffff & ((int32(z2) - int32(z)) / 1))
 38289  }
 38290  
 38291  // Close all incrblob channels opened using database connection pDb.
 38292  // This is called when shutting down the database connection.
 38293  func closeIncrblobChannels(tls *libc.TLS, pDb uintptr) { /* tclsqlite.c:214:13: */
 38294  	var p uintptr
 38295  	var pNext uintptr
 38296  
 38297  	for p = (*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob; p != 0; p = pNext {
 38298  		pNext = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 38299  
 38300  		// Note: Calling unregister here call Tcl_Close on the incrblob channel,
 38301  		// which deletes the IncrblobChannel structure at *p. So do not
 38302  		// call Tcl_Free() here.
 38303  		tcl.XTcl_UnregisterChannel(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel)
 38304  	}
 38305  }
 38306  
 38307  // Close an incremental blob channel.
 38308  func incrblobClose(tls *libc.TLS, instanceData ClientData, interp uintptr) int32 { /* tclsqlite.c:232:26: */
 38309  	var p uintptr = instanceData
 38310  	var rc int32 = sqlite3.Xsqlite3_blob_close(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 38311  	var db uintptr = (*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).Fdb
 38312  
 38313  	// Remove the channel from the SqliteDb.pIncrblob list.
 38314  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpNext != 0 {
 38315  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpNext)).FpPrev = (*IncrblobChannel)(unsafe.Pointer(p)).FpPrev
 38316  	}
 38317  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpPrev != 0 {
 38318  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpPrev)).FpNext = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 38319  	}
 38320  	if (*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).FpIncrblob == p {
 38321  		(*SqliteDb)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpDb)).FpIncrblob = (*IncrblobChannel)(unsafe.Pointer(p)).FpNext
 38322  	}
 38323  
 38324  	// Free the IncrblobChannel structure
 38325  	tcl.XTcl_Free(tls, p)
 38326  
 38327  	if rc != SQLITE_OK {
 38328  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, db), uintptr(1))
 38329  		return TCL_ERROR
 38330  	}
 38331  	return TCL_OK
 38332  }
 38333  
 38334  // Read data from an incremental blob channel.
 38335  func incrblobInput(tls *libc.TLS, instanceData ClientData, buf uintptr, bufSize int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:264:26: */
 38336  	var p uintptr = instanceData
 38337  	var nRead int32 = bufSize // Number of bytes to read
 38338  	var nBlob int32           // Total size of the blob
 38339  	var rc int32              // sqlite error code
 38340  
 38341  	nBlob = sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 38342  	if ((*IncrblobChannel)(unsafe.Pointer(p)).FiSeek + nRead) > nBlob {
 38343  		nRead = (nBlob - (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 38344  	}
 38345  	if nRead <= 0 {
 38346  		return 0
 38347  	}
 38348  
 38349  	rc = sqlite3.Xsqlite3_blob_read(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob, buf, nRead, (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 38350  	if rc != SQLITE_OK {
 38351  		*(*int32)(unsafe.Pointer(errorCodePtr)) = rc
 38352  		return -1
 38353  	}
 38354  
 38355  	*(*int32)(unsafe.Pointer(p + 8 /* &.iSeek */)) += (nRead)
 38356  	return nRead
 38357  }
 38358  
 38359  // Write data to an incremental blob channel.
 38360  func incrblobOutput(tls *libc.TLS, instanceData ClientData, buf uintptr, toWrite int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:296:26: */
 38361  	var p uintptr = instanceData
 38362  	var nWrite int32 = toWrite // Number of bytes to write
 38363  	var nBlob int32            // Total size of the blob
 38364  	var rc int32               // sqlite error code
 38365  
 38366  	nBlob = sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)
 38367  	if ((*IncrblobChannel)(unsafe.Pointer(p)).FiSeek + nWrite) > nBlob {
 38368  		*(*int32)(unsafe.Pointer(errorCodePtr)) = EINVAL
 38369  		return -1
 38370  	}
 38371  	if nWrite <= 0 {
 38372  		return 0
 38373  	}
 38374  
 38375  	rc = sqlite3.Xsqlite3_blob_write(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob, buf, nWrite, (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek)
 38376  	if rc != SQLITE_OK {
 38377  		*(*int32)(unsafe.Pointer(errorCodePtr)) = EIO
 38378  		return -1
 38379  	}
 38380  
 38381  	*(*int32)(unsafe.Pointer(p + 8 /* &.iSeek */)) += (nWrite)
 38382  	return nWrite
 38383  }
 38384  
 38385  // Seek an incremental blob channel.
 38386  func incrblobSeek(tls *libc.TLS, instanceData ClientData, offset int32, seekMode int32, errorCodePtr uintptr) int32 { /* tclsqlite.c:329:26: */
 38387  	var p uintptr = instanceData
 38388  
 38389  	switch seekMode {
 38390  	case SEEK_SET:
 38391  		(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = int32(offset)
 38392  		break
 38393  	case SEEK_CUR:
 38394  		*(*int32)(unsafe.Pointer(p + 8 /* &.iSeek */)) += int32((offset))
 38395  		break
 38396  	case SEEK_END:
 38397  		(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = (int32(int32(sqlite3.Xsqlite3_blob_bytes(tls, (*IncrblobChannel)(unsafe.Pointer(p)).FpBlob)) + offset))
 38398  		break
 38399  
 38400  	default:
 38401  	}
 38402  
 38403  	return (*IncrblobChannel)(unsafe.Pointer(p)).FiSeek
 38404  }
 38405  
 38406  func incrblobWatch(tls *libc.TLS, instanceData ClientData, mode int32) { /* tclsqlite.c:355:27: */
 38407  	// NO-OP
 38408  }
 38409  
 38410  func incrblobHandle(tls *libc.TLS, instanceData ClientData, dir int32, hPtr uintptr) int32 { /* tclsqlite.c:361:26: */
 38411  	return TCL_ERROR
 38412  }
 38413  
 38414  var IncrblobChannelType = Tcl_ChannelType{
 38415  	FtypeName:      ts + 11333,   /* "incrblob" */ // typeName
 38416  	Fversion:       uintptr(0x2), // version
 38417  	FcloseProc:     0,            // closeProc
 38418  	FinputProc:     0,            // inputProc
 38419  	FoutputProc:    0,            // outputProc
 38420  	FseekProc:      0,            // getOptionProc
 38421  	FwatchProc:     0,            // watchProc (this is a no-op)
 38422  	FgetHandleProc: 0,            // wideSeekProc
 38423  } /* tclsqlite.c:369:24 */
 38424  
 38425  // Create a new incrblob channel.
 38426  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: */
 38427  	bp := tls.Alloc(76)
 38428  	defer tls.Free(76)
 38429  
 38430  	var p uintptr
 38431  	var db uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Fdb
 38432  	// var pBlob uintptr at bp+8, 4
 38433  
 38434  	var rc int32
 38435  	var flags int32 = ((int32(1) << 1) | (func() int32 {
 38436  		if isReadonly != 0 {
 38437  			return 0
 38438  		}
 38439  		return (int32(1) << 2)
 38440  	}()))
 38441  	// var zChannel [64]int8 at bp+12, 64
 38442  
 38443  	rc = sqlite3.Xsqlite3_blob_open(tls, db, zDb, zTable, zColumn, iRow, libc.BoolInt32(!(isReadonly != 0)), bp+8 /* &pBlob */)
 38444  	if rc != SQLITE_OK {
 38445  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 38446  		return TCL_ERROR
 38447  	}
 38448  
 38449  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(IncrblobChannel{})))
 38450  	(*IncrblobChannel)(unsafe.Pointer(p)).FiSeek = 0
 38451  	(*IncrblobChannel)(unsafe.Pointer(p)).FpBlob = *(*uintptr)(unsafe.Pointer(bp + 8 /* pBlob */))
 38452  
 38453  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+12 /* &zChannel[0] */, ts+11342 /* "incrblob_%d" */, libc.VaList(bp, libc.PreIncInt32(&count, 1)))
 38454  	(*IncrblobChannel)(unsafe.Pointer(p)).Fchannel = tcl.XTcl_CreateChannel(tls, uintptr(unsafe.Pointer(&IncrblobChannelType)), bp+12 /* &zChannel[0] */, p, flags)
 38455  	tcl.XTcl_RegisterChannel(tls, interp, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel)
 38456  
 38457  	// Link the new channel into the SqliteDb.pIncrblob list.
 38458  	(*IncrblobChannel)(unsafe.Pointer(p)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob
 38459  	(*IncrblobChannel)(unsafe.Pointer(p)).FpPrev = uintptr(0)
 38460  	if (*IncrblobChannel)(unsafe.Pointer(p)).FpNext != 0 {
 38461  		(*IncrblobChannel)(unsafe.Pointer((*IncrblobChannel)(unsafe.Pointer(p)).FpNext)).FpPrev = p
 38462  	}
 38463  	(*SqliteDb)(unsafe.Pointer(pDb)).FpIncrblob = p
 38464  	(*IncrblobChannel)(unsafe.Pointer(p)).FpDb = pDb
 38465  
 38466  	tcl.XTcl_SetResult(tls, interp, tcl.XTcl_GetChannelName(tls, (*IncrblobChannel)(unsafe.Pointer(p)).Fchannel), uintptr(1))
 38467  	return TCL_OK
 38468  }
 38469  
 38470  var count int32 = 0 /* tclsqlite.c:406:14 */
 38471  
 38472  // Look at the script prefix in pCmd.  We will be executing this script
 38473  // after first appending one or more arguments.  This routine analyzes
 38474  // the script to see if it is safe to use Tcl_EvalObjv() on the script
 38475  // rather than the more general Tcl_EvalEx().  Tcl_EvalObjv() is much
 38476  // faster.
 38477  //
 38478  // Scripts that are safe to use with Tcl_EvalObjv() consists of a
 38479  // command name followed by zero or more arguments with no [...] or $
 38480  // or {...} or ; to be seen anywhere.  Most callback scripts consist
 38481  // of just a single procedure name and they meet this requirement.
 38482  func safeToUseEvalObjv(tls *libc.TLS, interp uintptr, pCmd uintptr) int32 { /* tclsqlite.c:451:12: */
 38483  	bp := tls.Alloc(4)
 38484  	defer tls.Free(4)
 38485  
 38486  	// We could try to do something with Tcl_Parse().  But we will instead
 38487  	// just do a search for forbidden characters.  If any of the forbidden
 38488  	// characters appear in pCmd, we will report the string as unsafe.
 38489  	var z uintptr
 38490  	// var n int32 at bp, 4
 38491  
 38492  	z = tcl.XTcl_GetStringFromObj(tls, pCmd, bp /* &n */)
 38493  	for libc.PostDecInt32(&*(*int32)(unsafe.Pointer(bp /* n */)), 1) > 0 {
 38494  		var c int32 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 38495  		if ((c == '$') || (c == '[')) || (c == ';') {
 38496  			return 0
 38497  		}
 38498  	}
 38499  	return 1
 38500  }
 38501  
 38502  // Find an SqlFunc structure with the given name.  Or create a new
 38503  // one if an existing one cannot be found.  Return a pointer to the
 38504  // structure.
 38505  func findSqlFunc(tls *libc.TLS, pDb uintptr, zName uintptr) uintptr { /* tclsqlite.c:471:16: */
 38506  	var p uintptr
 38507  	var pNew uintptr
 38508  	var nName int32 = strlen30(tls, zName)
 38509  	pNew = tcl.XTcl_Alloc(tls, ((uint32(unsafe.Sizeof(SqlFunc{})) + uint32(nName)) + uint32(1)))
 38510  	(*SqlFunc)(unsafe.Pointer(pNew)).FzName = (pNew + 1*28)
 38511  	libc.Xmemcpy(tls, (*SqlFunc)(unsafe.Pointer(pNew)).FzName, zName, (uint32(nName + 1)))
 38512  	for p = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc; p != 0; p = (*SqlFunc)(unsafe.Pointer(p)).FpNext {
 38513  		if sqlite3.Xsqlite3_stricmp(tls, (*SqlFunc)(unsafe.Pointer(p)).FzName, (*SqlFunc)(unsafe.Pointer(pNew)).FzName) == 0 {
 38514  			tcl.XTcl_Free(tls, pNew)
 38515  			return p
 38516  		}
 38517  	}
 38518  	(*SqlFunc)(unsafe.Pointer(pNew)).Finterp = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 38519  	(*SqlFunc)(unsafe.Pointer(pNew)).FpDb = pDb
 38520  	(*SqlFunc)(unsafe.Pointer(pNew)).FpScript = uintptr(0)
 38521  	(*SqlFunc)(unsafe.Pointer(pNew)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc
 38522  	(*SqliteDb)(unsafe.Pointer(pDb)).FpFunc = pNew
 38523  	return pNew
 38524  }
 38525  
 38526  // Free a single SqlPreparedStmt object.
 38527  func dbFreeStmt(tls *libc.TLS, pStmt uintptr) { /* tclsqlite.c:494:13: */
 38528  	if sqlite3.Xsqlite3_sql(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FpStmt) == uintptr(0) {
 38529  		tcl.XTcl_Free(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FzSql)
 38530  	}
 38531  	sqlite3.Xsqlite3_finalize(tls, (*SqlPreparedStmt)(unsafe.Pointer(pStmt)).FpStmt)
 38532  	tcl.XTcl_Free(tls, pStmt)
 38533  }
 38534  
 38535  // Finalize and free a list of prepared statements
 38536  func flushStmtCache(tls *libc.TLS, pDb uintptr) { /* tclsqlite.c:507:13: */
 38537  	var pPreStmt uintptr
 38538  	var pNext uintptr
 38539  
 38540  	for pPreStmt = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList; pPreStmt != 0; pPreStmt = pNext {
 38541  		pNext = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 38542  		dbFreeStmt(tls, pPreStmt)
 38543  	}
 38544  	(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt = 0
 38545  	(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = uintptr(0)
 38546  	(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = uintptr(0)
 38547  }
 38548  
 38549  // TCL calls this procedure when an sqlite3 database command is
 38550  // deleted.
 38551  func DbDeleteCmd(tls *libc.TLS, db uintptr) { /* tclsqlite.c:524:27: */
 38552  	var pDb uintptr = db
 38553  	flushStmtCache(tls, pDb)
 38554  	closeIncrblobChannels(tls, pDb)
 38555  	sqlite3.Xsqlite3_close(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 38556  	for (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc != 0 {
 38557  		var pFunc uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpFunc
 38558  		(*SqliteDb)(unsafe.Pointer(pDb)).FpFunc = (*SqlFunc)(unsafe.Pointer(pFunc)).FpNext
 38559  
 38560  		for ok := true; ok; ok = 0 != 0 {
 38561  			var _objPtr uintptr = (*SqlFunc)(unsafe.Pointer(pFunc)).FpScript
 38562  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38563  				tcl.XTclFreeObj(tls, _objPtr)
 38564  			}
 38565  		}
 38566  		tcl.XTcl_Free(tls, pFunc)
 38567  	}
 38568  	for (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate != 0 {
 38569  		var pCollate uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate
 38570  		(*SqliteDb)(unsafe.Pointer(pDb)).FpCollate = (*SqlCollate)(unsafe.Pointer(pCollate)).FpNext
 38571  		tcl.XTcl_Free(tls, pCollate)
 38572  	}
 38573  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0 {
 38574  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy)
 38575  	}
 38576  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0 {
 38577  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace)
 38578  	}
 38579  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0 {
 38580  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2)
 38581  	}
 38582  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0 {
 38583  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile)
 38584  	}
 38585  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0 {
 38586  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback)
 38587  	}
 38588  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0 {
 38589  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth)
 38590  	}
 38591  	if (*SqliteDb)(unsafe.Pointer(pDb)).FzNull != 0 {
 38592  		tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull)
 38593  	}
 38594  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook != 0 {
 38595  		for ok1 := true; ok1; ok1 = 0 != 0 {
 38596  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook
 38597  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38598  				tcl.XTclFreeObj(tls, _objPtr)
 38599  			}
 38600  		}
 38601  	}
 38602  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook != 0 {
 38603  		for ok2 := true; ok2; ok2 = 0 != 0 {
 38604  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook
 38605  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38606  				tcl.XTclFreeObj(tls, _objPtr)
 38607  			}
 38608  		}
 38609  	}
 38610  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook != 0 {
 38611  		for ok3 := true; ok3; ok3 = 0 != 0 {
 38612  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook
 38613  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38614  				tcl.XTclFreeObj(tls, _objPtr)
 38615  			}
 38616  		}
 38617  	}
 38618  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook != 0 {
 38619  		for ok4 := true; ok4; ok4 = 0 != 0 {
 38620  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook
 38621  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38622  				tcl.XTclFreeObj(tls, _objPtr)
 38623  			}
 38624  		}
 38625  	}
 38626  	if (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded != 0 {
 38627  		for ok5 := true; ok5; ok5 = 0 != 0 {
 38628  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded
 38629  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38630  				tcl.XTclFreeObj(tls, _objPtr)
 38631  			}
 38632  		}
 38633  	}
 38634  	tcl.XTcl_Free(tls, pDb)
 38635  }
 38636  
 38637  // This routine is called when a database file is locked while trying
 38638  // to execute SQL.
 38639  func DbBusyHandler(tls *libc.TLS, cd uintptr, nTries int32) int32 { /* tclsqlite.c:584:12: */
 38640  	bp := tls.Alloc(70)
 38641  	defer tls.Free(70)
 38642  
 38643  	var pDb uintptr = cd
 38644  	var rc int32
 38645  	// var zVal [30]int8 at bp+40, 30
 38646  
 38647  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+40 /* &zVal[0] */, ts+1238 /* "%d" */, libc.VaList(bp, nTries))
 38648  	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)))
 38649  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 38650  		return 0
 38651  	}
 38652  	return 1
 38653  }
 38654  
 38655  // This routine is invoked as the 'progress callback' for the database.
 38656  func DbProgressHandler(tls *libc.TLS, cd uintptr) int32 { /* tclsqlite.c:601:12: */
 38657  	var pDb uintptr = cd
 38658  	var rc int32
 38659  
 38660  	rc = tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress)
 38661  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 38662  		return 1
 38663  	}
 38664  	return 0
 38665  }
 38666  
 38667  // This routine is called by the SQLite trace handler whenever a new
 38668  // block of SQL is executed.  The TCL script in pDb->zTrace is executed.
 38669  func DbTraceHandler(tls *libc.TLS, cd uintptr, zSql uintptr) { /* tclsqlite.c:620:13: */
 38670  	bp := tls.Alloc(212)
 38671  	defer tls.Free(212)
 38672  
 38673  	var pDb uintptr = cd
 38674  	// var str Tcl_DString at bp, 212
 38675  
 38676  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 38677  	tcl.XTcl_DStringAppend(tls, bp /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, -1)
 38678  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, zSql)
 38679  	tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 38680  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 38681  	tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38682  }
 38683  
 38684  // This routine is called by the SQLite trace_v2 handler whenever a new
 38685  // supported event is generated.  Unsupported event types are ignored.
 38686  // The TCL script in pDb->zTraceV2 is executed, with the arguments for
 38687  // the event appended to it (as list elements).
 38688  func DbTraceV2Handler(tls *libc.TLS, type1 uint32, cd uintptr, pd uintptr, xd uintptr) int32 { /* tclsqlite.c:640:12: */
 38689  	var pDb uintptr = cd
 38690  	var pCmd uintptr
 38691  
 38692  	switch type1 {
 38693  	case uint32(SQLITE_TRACE_STMT):
 38694  		{
 38695  			var pStmt uintptr = pd
 38696  			var zSql uintptr = xd
 38697  
 38698  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 38699  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38700  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38701  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 38702  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38703  				tcl.XTcl_NewStringObj(tls, zSql, -1))
 38704  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38705  			for ok := true; ok; ok = 0 != 0 {
 38706  				var _objPtr uintptr = pCmd
 38707  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38708  					tcl.XTclFreeObj(tls, _objPtr)
 38709  				}
 38710  			}
 38711  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38712  			break
 38713  
 38714  		}
 38715  	case uint32(SQLITE_TRACE_PROFILE):
 38716  		{
 38717  			var pStmt uintptr = pd
 38718  			var ns sqlite3_int64 = *(*sqlite3_int64)(unsafe.Pointer(xd))
 38719  
 38720  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 38721  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38722  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38723  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 38724  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38725  				tcl.XTcl_NewWideIntObj(tls, ns))
 38726  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38727  			for ok1 := true; ok1; ok1 = 0 != 0 {
 38728  				var _objPtr uintptr = pCmd
 38729  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38730  					tcl.XTclFreeObj(tls, _objPtr)
 38731  				}
 38732  			}
 38733  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38734  			break
 38735  
 38736  		}
 38737  	case uint32(SQLITE_TRACE_ROW):
 38738  		{
 38739  			var pStmt uintptr = pd
 38740  
 38741  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 38742  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38743  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38744  				tcl.XTcl_NewWideIntObj(tls, int64(pStmt)))
 38745  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38746  			for ok2 := true; ok2; ok2 = 0 != 0 {
 38747  				var _objPtr uintptr = pCmd
 38748  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38749  					tcl.XTclFreeObj(tls, _objPtr)
 38750  				}
 38751  			}
 38752  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38753  			break
 38754  
 38755  		}
 38756  	case uint32(SQLITE_TRACE_CLOSE):
 38757  		{
 38758  			var db uintptr = pd
 38759  
 38760  			pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, -1)
 38761  			(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38762  			tcl.XTcl_ListObjAppendElement(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd,
 38763  				tcl.XTcl_NewWideIntObj(tls, int64(db)))
 38764  			tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38765  			for ok3 := true; ok3; ok3 = 0 != 0 {
 38766  				var _objPtr uintptr = pCmd
 38767  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38768  					tcl.XTclFreeObj(tls, _objPtr)
 38769  				}
 38770  			}
 38771  			tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38772  			break
 38773  
 38774  		}
 38775  	}
 38776  	return SQLITE_OK
 38777  }
 38778  
 38779  // This routine is called by the SQLite profile handler after a statement
 38780  // SQL has executed.  The TCL script in pDb->zProfile is evaluated.
 38781  func DbProfileHandler(tls *libc.TLS, cd uintptr, zSql uintptr, tm1 sqlite_uint64) { /* tclsqlite.c:715:13: */
 38782  	bp := tls.Alloc(320)
 38783  	defer tls.Free(320)
 38784  
 38785  	var pDb uintptr = cd
 38786  	// var str Tcl_DString at bp+108, 212
 38787  
 38788  	// var zTm [100]int8 at bp+8, 100
 38789  
 38790  	sqlite3.Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof([100]int8{})) - uint32(1))), bp+8 /* &zTm[0] */, ts+11354 /* "%lld" */, libc.VaList(bp, tm1))
 38791  	tcl.XTcl_DStringInit(tls, bp+108 /* &str */)
 38792  	tcl.XTcl_DStringAppend(tls, bp+108 /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, -1)
 38793  	tcl.XTcl_DStringAppendElement(tls, bp+108 /* &str */, zSql)
 38794  	tcl.XTcl_DStringAppendElement(tls, bp+108 /* &str */, bp+8 /* &zTm[0] */)
 38795  	tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp+108 /* &str */)).Fstring)
 38796  	tcl.XTcl_DStringFree(tls, bp+108 /* &str */)
 38797  	tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38798  }
 38799  
 38800  // This routine is called when a transaction is committed.  The
 38801  // TCL script in pDb->zCommit is executed.  If it returns non-zero or
 38802  // if it throws an exception, the transaction is rolled back instead
 38803  // of being committed.
 38804  func DbCommitHandler(tls *libc.TLS, cd uintptr) int32 { /* tclsqlite.c:737:12: */
 38805  	var pDb uintptr = cd
 38806  	var rc int32
 38807  
 38808  	rc = tcl.XTcl_Eval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit)
 38809  	if (rc != TCL_OK) || (libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)) != 0) {
 38810  		return 1
 38811  	}
 38812  	return 0
 38813  }
 38814  
 38815  func DbRollbackHandler(tls *libc.TLS, clientData uintptr) { /* tclsqlite.c:748:13: */
 38816  	var pDb uintptr = clientData
 38817  
 38818  	if TCL_OK != tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook, 0) {
 38819  		tcl.XTcl_BackgroundError(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 38820  	}
 38821  }
 38822  
 38823  // This procedure handles wal_hook callbacks.
 38824  func DbWalHandler(tls *libc.TLS, clientData uintptr, db uintptr, zDb uintptr, nEntry int32) int32 { /* tclsqlite.c:759:12: */
 38825  	bp := tls.Alloc(4)
 38826  	defer tls.Free(4)
 38827  
 38828  	*(*int32)(unsafe.Pointer(bp /* ret */)) = SQLITE_OK
 38829  	var p uintptr
 38830  	var pDb uintptr = clientData
 38831  	var interp uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 38832  
 38833  	p = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook)
 38834  	(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 38835  	tcl.XTcl_ListObjAppendElement(tls, interp, p, tcl.XTcl_NewStringObj(tls, zDb, -1))
 38836  	tcl.XTcl_ListObjAppendElement(tls, interp, p, tcl.XTcl_NewIntObj(tls, nEntry))
 38837  	if (TCL_OK != tcl.XTcl_EvalObjEx(tls, interp, p, 0)) ||
 38838  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, tcl.XTcl_GetObjResult(tls, interp), bp /* &ret */)) {
 38839  		tcl.XTcl_BackgroundError(tls, interp)
 38840  	}
 38841  	for ok := true; ok; ok = 0 != 0 {
 38842  		var _objPtr uintptr = p
 38843  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38844  			tcl.XTclFreeObj(tls, _objPtr)
 38845  		}
 38846  	}
 38847  
 38848  	return *(*int32)(unsafe.Pointer(bp /* ret */))
 38849  }
 38850  
 38851  func setTestUnlockNotifyVars(tls *libc.TLS, interp uintptr, iArg int32, nArg int32) { /* tclsqlite.c:787:13: */
 38852  	bp := tls.Alloc(80)
 38853  	defer tls.Free(80)
 38854  
 38855  	// var zBuf [64]int8 at bp+16, 64
 38856  
 38857  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+16 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp, iArg))
 38858  	tcl.XTcl_SetVar2(tls, interp, ts+11359 /* "sqlite_unlock_no..." */, uintptr(0), bp+16 /* &zBuf[0] */, TCL_GLOBAL_ONLY)
 38859  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([64]int8{})), bp+16 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+8, nArg))
 38860  	tcl.XTcl_SetVar2(tls, interp, ts+11384 /* "sqlite_unlock_no..." */, uintptr(0), bp+16 /* &zBuf[0] */, TCL_GLOBAL_ONLY)
 38861  }
 38862  
 38863  func DbUnlockNotify(tls *libc.TLS, apArg uintptr, nArg int32) { /* tclsqlite.c:799:13: */
 38864  	var i int32
 38865  	for i = 0; i < nArg; i++ {
 38866  		var flags int32 = (TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT)
 38867  		var pDb uintptr = *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*4))
 38868  		setTestUnlockNotifyVars(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, i, nArg)
 38869  
 38870  		tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify, flags)
 38871  		for ok := true; ok; ok = 0 != 0 {
 38872  			var _objPtr uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify
 38873  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38874  				tcl.XTclFreeObj(tls, _objPtr)
 38875  			}
 38876  		}
 38877  		(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = uintptr(0)
 38878  	}
 38879  }
 38880  
 38881  // Pre-update hook callback.
 38882  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: */
 38883  	var pDb uintptr = p
 38884  	var pCmd uintptr
 38885  
 38886  	pCmd = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook)
 38887  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38888  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, azStr[((op-1)/9)], -1))
 38889  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zDb, -1))
 38890  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 38891  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, iKey1))
 38892  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, iKey2))
 38893  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38894  	for ok := true; ok; ok = 0 != 0 {
 38895  		var _objPtr uintptr = pCmd
 38896  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38897  			tcl.XTclFreeObj(tls, _objPtr)
 38898  		}
 38899  	}
 38900  }
 38901  
 38902  var azStr = [3]uintptr{ts + 10786 /* "DELETE" */, ts + 10772 /* "INSERT" */, ts + 10779 /* "UPDATE" */} /* tclsqlite.c:828:21 */
 38903  
 38904  func DbUpdateHandler(tls *libc.TLS, p uintptr, op int32, zDb uintptr, zTbl uintptr, rowid sqlite_int64) { /* tclsqlite.c:849:13: */
 38905  	var pDb uintptr = p
 38906  	var pCmd uintptr
 38907  
 38908  	pCmd = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook)
 38909  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38910  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, azStr1[((op-1)/9)], -1))
 38911  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zDb, -1))
 38912  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewStringObj(tls, zTbl, -1))
 38913  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pCmd, tcl.XTcl_NewWideIntObj(tls, rowid))
 38914  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38915  	for ok := true; ok; ok = 0 != 0 {
 38916  		var _objPtr uintptr = pCmd
 38917  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38918  			tcl.XTclFreeObj(tls, _objPtr)
 38919  		}
 38920  	}
 38921  }
 38922  
 38923  var azStr1 = [3]uintptr{ts + 10786 /* "DELETE" */, ts + 10772 /* "INSERT" */, ts + 10779 /* "UPDATE" */} /* tclsqlite.c:858:21 */
 38924  
 38925  func tclCollateNeeded(tls *libc.TLS, pCtx uintptr, db uintptr, enc int32, zName uintptr) { /* tclsqlite.c:877:13: */
 38926  	var pDb uintptr = pCtx
 38927  	var pScript uintptr = tcl.XTcl_DuplicateObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded)
 38928  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 38929  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zName, -1))
 38930  	tcl.XTcl_EvalObjEx(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, pScript, 0)
 38931  	for ok := true; ok; ok = 0 != 0 {
 38932  		var _objPtr uintptr = pScript
 38933  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38934  			tcl.XTclFreeObj(tls, _objPtr)
 38935  		}
 38936  	}
 38937  }
 38938  
 38939  // This routine is called to evaluate an SQL collation function implemented
 38940  // using TCL script.
 38941  func tclSqlCollate(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* tclsqlite.c:895:12: */
 38942  	var p uintptr = pCtx
 38943  	var pCmd uintptr
 38944  
 38945  	pCmd = tcl.XTcl_NewStringObj(tls, (*SqlCollate)(unsafe.Pointer(p)).FzScript, -1)
 38946  	(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38947  	tcl.XTcl_ListObjAppendElement(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, tcl.XTcl_NewStringObj(tls, zA, nA))
 38948  	tcl.XTcl_ListObjAppendElement(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, tcl.XTcl_NewStringObj(tls, zB, nB))
 38949  	tcl.XTcl_EvalObjEx(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp, pCmd, TCL_EVAL_DIRECT)
 38950  	for ok := true; ok; ok = 0 != 0 {
 38951  		var _objPtr uintptr = pCmd
 38952  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38953  			tcl.XTclFreeObj(tls, _objPtr)
 38954  		}
 38955  	}
 38956  	return libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, (*SqlCollate)(unsafe.Pointer(p)).Finterp))
 38957  }
 38958  
 38959  // This routine is called to evaluate an SQL function implemented
 38960  // using TCL script.
 38961  func tclSqlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* tclsqlite.c:918:13: */
 38962  	bp := tls.Alloc(32)
 38963  	defer tls.Free(32)
 38964  
 38965  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, context)
 38966  	var pCmd uintptr
 38967  	var i int32
 38968  	var rc int32
 38969  
 38970  	if argc == 0 {
 38971  		// If there are no arguments to the function, call Tcl_EvalObjEx on the
 38972  		// script object directly.  This allows the TCL compiler to generate
 38973  		// bytecode for the command on the first invocation and thus make
 38974  		// subsequent invocations much faster.
 38975  		pCmd = (*SqlFunc)(unsafe.Pointer(p)).FpScript
 38976  		(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 38977  		rc = tcl.XTcl_EvalObjEx(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, 0)
 38978  		for ok := true; ok; ok = 0 != 0 {
 38979  			var _objPtr uintptr = pCmd
 38980  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 38981  				tcl.XTclFreeObj(tls, _objPtr)
 38982  			}
 38983  		}
 38984  	} else {
 38985  		// If there are arguments to the function, make a shallow copy of the
 38986  		// script object, lappend the arguments, then evaluate the copy.
 38987  		//
 38988  		// By "shallow" copy, we mean only the outer list Tcl_Obj is duplicated.
 38989  		// The new Tcl_Obj contains pointers to the original list elements.
 38990  		// That way, when Tcl_EvalObjv() is run and shimmers the first element
 38991  		// of the list to tclCmdNameType, that alternate representation will
 38992  		// be preserved and reused on the next invocation.
 38993  		// var aArg uintptr at bp+4, 4
 38994  
 38995  		// var nArg int32 at bp, 4
 38996  
 38997  		if tcl.XTcl_ListObjGetElements(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, (*SqlFunc)(unsafe.Pointer(p)).FpScript, bp /* &nArg */, bp+4 /* &aArg */) != 0 {
 38998  			sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 38999  			return
 39000  		}
 39001  		pCmd = tcl.XTcl_NewListObj(tls, *(*int32)(unsafe.Pointer(bp /* nArg */)), *(*uintptr)(unsafe.Pointer(bp + 4 /* aArg */)))
 39002  		(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 39003  		for i = 0; i < argc; i++ {
 39004  			var pIn uintptr = *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))
 39005  			var pVal uintptr
 39006  
 39007  			// Set pVal to contain the i'th column of this row.
 39008  			switch sqlite3.Xsqlite3_value_type(tls, pIn) {
 39009  			case SQLITE_BLOB:
 39010  				{
 39011  					var bytes int32 = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 39012  					pVal = tcl.XTcl_NewByteArrayObj(tls, sqlite3.Xsqlite3_value_blob(tls, pIn), bytes)
 39013  					break
 39014  
 39015  				}
 39016  				fallthrough
 39017  			case SQLITE_INTEGER:
 39018  				{
 39019  					var v sqlite_int64 = sqlite3.Xsqlite3_value_int64(tls, pIn)
 39020  					if (v >= int64(-2147483647)) && (v <= int64(2147483647)) {
 39021  						pVal = tcl.XTcl_NewIntObj(tls, int32(v))
 39022  					} else {
 39023  						pVal = tcl.XTcl_NewWideIntObj(tls, v)
 39024  					}
 39025  					break
 39026  
 39027  				}
 39028  				fallthrough
 39029  			case SQLITE_FLOAT:
 39030  				{
 39031  					var r float64 = sqlite3.Xsqlite3_value_double(tls, pIn)
 39032  					pVal = tcl.XTcl_NewDoubleObj(tls, r)
 39033  					break
 39034  
 39035  				}
 39036  				fallthrough
 39037  			case SQLITE_NULL:
 39038  				{
 39039  					pVal = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer((*SqlFunc)(unsafe.Pointer(p)).FpDb)).FzNull, -1)
 39040  					break
 39041  
 39042  				}
 39043  				fallthrough
 39044  			default:
 39045  				{
 39046  					var bytes int32 = sqlite3.Xsqlite3_value_bytes(tls, pIn)
 39047  					pVal = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pIn), bytes)
 39048  					break
 39049  
 39050  				}
 39051  			}
 39052  			rc = tcl.XTcl_ListObjAppendElement(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, pVal)
 39053  			if rc != 0 {
 39054  				for ok1 := true; ok1; ok1 = 0 != 0 {
 39055  					var _objPtr uintptr = pCmd
 39056  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39057  						tcl.XTclFreeObj(tls, _objPtr)
 39058  					}
 39059  				}
 39060  				sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 39061  				return
 39062  			}
 39063  		}
 39064  		if !((*SqlFunc)(unsafe.Pointer(p)).FuseEvalObjv != 0) {
 39065  			// Tcl_EvalObjEx() will automatically call Tcl_EvalObjv() if pCmd
 39066  			// is a list without a string representation.  To prevent this from
 39067  			// happening, make sure pCmd has a valid string representation
 39068  			tcl.XTcl_GetString(tls, pCmd)
 39069  		}
 39070  		rc = tcl.XTcl_EvalObjEx(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp, pCmd, TCL_EVAL_DIRECT)
 39071  		for ok2 := true; ok2; ok2 = 0 != 0 {
 39072  			var _objPtr uintptr = pCmd
 39073  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39074  				tcl.XTclFreeObj(tls, _objPtr)
 39075  			}
 39076  		}
 39077  	}
 39078  
 39079  	if (rc != 0) && (rc != TCL_RETURN) {
 39080  		sqlite3.Xsqlite3_result_error(tls, context, tcl.XTcl_GetStringResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp), -1)
 39081  	} else {
 39082  		var pVar uintptr = tcl.XTcl_GetObjResult(tls, (*SqlFunc)(unsafe.Pointer(p)).Finterp)
 39083  		// var n int32 at bp+8, 4
 39084  
 39085  		var data uintptr
 39086  		var zType uintptr = func() uintptr {
 39087  			if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 39088  				return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 39089  			}
 39090  			return ts + 489 /* "" */
 39091  		}()
 39092  		var c int8 = *(*int8)(unsafe.Pointer(zType))
 39093  		var eType int32 = (*SqlFunc)(unsafe.Pointer(p)).FeType
 39094  
 39095  		if eType == SQLITE_NULL {
 39096  			if ((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2405 /* "bytearray" */) == 0)) && ((*Tcl_Obj)(unsafe.Pointer(pVar)).Fbytes == uintptr(0)) {
 39097  				// Only return a BLOB type if the Tcl variable is a bytearray and
 39098  				// has no string representation.
 39099  				eType = SQLITE_BLOB
 39100  			} else if (((int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0)) ||
 39101  				((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0))) ||
 39102  				((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 39103  				eType = SQLITE_INTEGER
 39104  			} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 39105  				eType = SQLITE_FLOAT
 39106  			} else {
 39107  				eType = SQLITE_TEXT
 39108  			}
 39109  		}
 39110  
 39111  		switch eType {
 39112  		case SQLITE_BLOB:
 39113  			{
 39114  				data = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+8 /* &n */)
 39115  				sqlite3.Xsqlite3_result_blob(tls, context, data, *(*int32)(unsafe.Pointer(bp + 8 /* n */)), libc.UintptrFromInt32(-1))
 39116  				break
 39117  
 39118  			}
 39119  			fallthrough
 39120  		case SQLITE_INTEGER:
 39121  			{
 39122  				// var v Tcl_WideInt at bp+16, 8
 39123  
 39124  				if TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), pVar, bp+16 /* &v */) {
 39125  					sqlite3.Xsqlite3_result_int64(tls, context, *(*Tcl_WideInt)(unsafe.Pointer(bp + 16 /* v */)))
 39126  					break
 39127  				}
 39128  				// fall-through
 39129  
 39130  			}
 39131  			fallthrough
 39132  		case SQLITE_FLOAT:
 39133  			{
 39134  				// var r float64 at bp+24, 8
 39135  
 39136  				if TCL_OK == tcl.XTcl_GetDoubleFromObj(tls, uintptr(0), pVar, bp+24 /* &r */) {
 39137  					sqlite3.Xsqlite3_result_double(tls, context, *(*float64)(unsafe.Pointer(bp + 24 /* r */)))
 39138  					break
 39139  				}
 39140  				// fall-through
 39141  
 39142  			}
 39143  			fallthrough
 39144  		default:
 39145  			{
 39146  				data = tcl.XTcl_GetStringFromObj(tls, pVar, bp+8 /* &n */)
 39147  				sqlite3.Xsqlite3_result_text(tls, context, data, *(*int32)(unsafe.Pointer(bp + 8 /* n */)), libc.UintptrFromInt32(-1))
 39148  				break
 39149  
 39150  			}
 39151  		}
 39152  
 39153  	}
 39154  }
 39155  
 39156  // This is the authentication function.  It appends the authentication
 39157  // type code and the two arguments to zCmd[] then invokes the result
 39158  // on the interpreter.  The reply is examined to determine if the
 39159  // authentication fails or succeeds.
 39160  func auth_callback(tls *libc.TLS, pArg uintptr, code int32, zArg1 uintptr, zArg2 uintptr, zArg3 uintptr, zArg4 uintptr) int32 { /* tclsqlite.c:1069:12: */
 39161  	bp := tls.Alloc(212)
 39162  	defer tls.Free(212)
 39163  
 39164  	var zCode uintptr
 39165  	// var str Tcl_DString at bp, 212
 39166  
 39167  	var rc int32
 39168  	var zReply uintptr
 39169  	// EVIDENCE-OF: R-38590-62769 The first parameter to the authorizer
 39170  	// callback is a copy of the third parameter to the
 39171  	// sqlite3_set_authorizer() interface.
 39172  	var pDb uintptr = pArg
 39173  	if (*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth != 0 {
 39174  		return SQLITE_OK
 39175  	}
 39176  
 39177  	// EVIDENCE-OF: R-56518-44310 The second parameter to the callback is an
 39178  	// integer action code that specifies the particular action to be
 39179  	// authorized.
 39180  	switch code {
 39181  	case SQLITE_COPY:
 39182  		zCode = ts + 11414 /* "SQLITE_COPY" */
 39183  		break
 39184  	case SQLITE_CREATE_INDEX:
 39185  		zCode = ts + 11426 /* "SQLITE_CREATE_IN..." */
 39186  		break
 39187  	case SQLITE_CREATE_TABLE:
 39188  		zCode = ts + 11446 /* "SQLITE_CREATE_TA..." */
 39189  		break
 39190  	case SQLITE_CREATE_TEMP_INDEX:
 39191  		zCode = ts + 11466 /* "SQLITE_CREATE_TE..." */
 39192  		break
 39193  	case SQLITE_CREATE_TEMP_TABLE:
 39194  		zCode = ts + 11491 /* "SQLITE_CREATE_TE..." */
 39195  		break
 39196  	case SQLITE_CREATE_TEMP_TRIGGER:
 39197  		zCode = ts + 11516 /* "SQLITE_CREATE_TE..." */
 39198  		break
 39199  	case SQLITE_CREATE_TEMP_VIEW:
 39200  		zCode = ts + 11543 /* "SQLITE_CREATE_TE..." */
 39201  		break
 39202  	case SQLITE_CREATE_TRIGGER:
 39203  		zCode = ts + 11567 /* "SQLITE_CREATE_TR..." */
 39204  		break
 39205  	case SQLITE_CREATE_VIEW:
 39206  		zCode = ts + 11589 /* "SQLITE_CREATE_VI..." */
 39207  		break
 39208  	case SQLITE_DELETE:
 39209  		zCode = ts + 11608 /* "SQLITE_DELETE" */
 39210  		break
 39211  	case SQLITE_DROP_INDEX:
 39212  		zCode = ts + 11622 /* "SQLITE_DROP_INDE..." */
 39213  		break
 39214  	case SQLITE_DROP_TABLE:
 39215  		zCode = ts + 11640 /* "SQLITE_DROP_TABL..." */
 39216  		break
 39217  	case SQLITE_DROP_TEMP_INDEX:
 39218  		zCode = ts + 11658 /* "SQLITE_DROP_TEMP..." */
 39219  		break
 39220  	case SQLITE_DROP_TEMP_TABLE:
 39221  		zCode = ts + 11681 /* "SQLITE_DROP_TEMP..." */
 39222  		break
 39223  	case SQLITE_DROP_TEMP_TRIGGER:
 39224  		zCode = ts + 11704 /* "SQLITE_DROP_TEMP..." */
 39225  		break
 39226  	case SQLITE_DROP_TEMP_VIEW:
 39227  		zCode = ts + 11729 /* "SQLITE_DROP_TEMP..." */
 39228  		break
 39229  	case SQLITE_DROP_TRIGGER:
 39230  		zCode = ts + 11751 /* "SQLITE_DROP_TRIG..." */
 39231  		break
 39232  	case SQLITE_DROP_VIEW:
 39233  		zCode = ts + 11771 /* "SQLITE_DROP_VIEW" */
 39234  		break
 39235  	case SQLITE_INSERT:
 39236  		zCode = ts + 11788 /* "SQLITE_INSERT" */
 39237  		break
 39238  	case SQLITE_PRAGMA:
 39239  		zCode = ts + 11802 /* "SQLITE_PRAGMA" */
 39240  		break
 39241  	case SQLITE_READ:
 39242  		zCode = ts + 11816 /* "SQLITE_READ" */
 39243  		break
 39244  	case SQLITE_SELECT:
 39245  		zCode = ts + 11828 /* "SQLITE_SELECT" */
 39246  		break
 39247  	case SQLITE_TRANSACTION:
 39248  		zCode = ts + 11842 /* "SQLITE_TRANSACTI..." */
 39249  		break
 39250  	case SQLITE_UPDATE:
 39251  		zCode = ts + 11861 /* "SQLITE_UPDATE" */
 39252  		break
 39253  	case SQLITE_ATTACH:
 39254  		zCode = ts + 11875 /* "SQLITE_ATTACH" */
 39255  		break
 39256  	case SQLITE_DETACH:
 39257  		zCode = ts + 11889 /* "SQLITE_DETACH" */
 39258  		break
 39259  	case SQLITE_ALTER_TABLE:
 39260  		zCode = ts + 11903 /* "SQLITE_ALTER_TAB..." */
 39261  		break
 39262  	case SQLITE_REINDEX:
 39263  		zCode = ts + 11922 /* "SQLITE_REINDEX" */
 39264  		break
 39265  	case SQLITE_ANALYZE:
 39266  		zCode = ts + 11937 /* "SQLITE_ANALYZE" */
 39267  		break
 39268  	case SQLITE_CREATE_VTABLE:
 39269  		zCode = ts + 11952 /* "SQLITE_CREATE_VT..." */
 39270  		break
 39271  	case SQLITE_DROP_VTABLE:
 39272  		zCode = ts + 11973 /* "SQLITE_DROP_VTAB..." */
 39273  		break
 39274  	case SQLITE_FUNCTION:
 39275  		zCode = ts + 11992 /* "SQLITE_FUNCTION" */
 39276  		break
 39277  	case SQLITE_SAVEPOINT:
 39278  		zCode = ts + 12008 /* "SQLITE_SAVEPOINT" */
 39279  		break
 39280  	case SQLITE_RECURSIVE:
 39281  		zCode = ts + 12025 /* "SQLITE_RECURSIVE" */
 39282  		break
 39283  	default:
 39284  		zCode = ts + 12042 /* "????" */
 39285  		break
 39286  	}
 39287  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 39288  	tcl.XTcl_DStringAppend(tls, bp /* &str */, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, -1)
 39289  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, zCode)
 39290  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 39291  		if zArg1 != 0 {
 39292  			return zArg1
 39293  		}
 39294  		return ts + 489 /* "" */
 39295  	}())
 39296  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 39297  		if zArg2 != 0 {
 39298  			return zArg2
 39299  		}
 39300  		return ts + 489 /* "" */
 39301  	}())
 39302  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 39303  		if zArg3 != 0 {
 39304  			return zArg3
 39305  		}
 39306  		return ts + 489 /* "" */
 39307  	}())
 39308  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, func() uintptr {
 39309  		if zArg4 != 0 {
 39310  			return zArg4
 39311  		}
 39312  		return ts + 489 /* "" */
 39313  	}())
 39314  	rc = tcl.XTcl_GlobalEval(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 39315  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 39316  	if rc == TCL_OK {
 39317  		zReply = tcl.XTcl_GetStringResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 39318  	} else {
 39319  		zReply = ts + 12047 /* "SQLITE_DENY" */
 39320  	}
 39321  	if libc.Xstrcmp(tls, zReply, ts+1988 /* "SQLITE_OK" */) == 0 {
 39322  		rc = SQLITE_OK
 39323  	} else if libc.Xstrcmp(tls, zReply, ts+12047 /* "SQLITE_DENY" */) == 0 {
 39324  		rc = SQLITE_DENY
 39325  	} else if libc.Xstrcmp(tls, zReply, ts+12059 /* "SQLITE_IGNORE" */) == 0 {
 39326  		rc = SQLITE_IGNORE
 39327  	} else {
 39328  		rc = 999
 39329  	}
 39330  	return rc
 39331  }
 39332  
 39333  // This routine reads a line of text from FILE in, stores
 39334  // the text in memory obtained from malloc() and returns a pointer
 39335  // to the text.  NULL is returned at end of file, or if malloc()
 39336  // fails.
 39337  //
 39338  // The interface is like "readline" but no command-line editing
 39339  // is done.
 39340  //
 39341  // copied from shell.c from '.import' command
 39342  func local_getline(tls *libc.TLS, zPrompt uintptr, in uintptr) uintptr { /* tclsqlite.c:1168:13: */
 39343  	var zLine uintptr
 39344  	var nLine int32
 39345  	var n int32
 39346  
 39347  	nLine = 100
 39348  	zLine = libc.Xmalloc(tls, uint32(nLine))
 39349  	if zLine == uintptr(0) {
 39350  		return uintptr(0)
 39351  	}
 39352  	n = 0
 39353  	for 1 != 0 {
 39354  		if (n + 100) > nLine {
 39355  			nLine = ((nLine * 2) + 100)
 39356  			zLine = libc.Xrealloc(tls, zLine, uint32(nLine))
 39357  			if zLine == uintptr(0) {
 39358  				return uintptr(0)
 39359  			}
 39360  		}
 39361  		if libc.Xfgets(tls, (zLine+uintptr(n)), (nLine-n), in) == uintptr(0) {
 39362  			if n == 0 {
 39363  				libc.Xfree(tls, zLine)
 39364  				return uintptr(0)
 39365  			}
 39366  			*(*int8)(unsafe.Pointer(zLine + uintptr(n))) = int8(0)
 39367  			break
 39368  		}
 39369  		for *(*int8)(unsafe.Pointer(zLine + uintptr(n))) != 0 {
 39370  			n++
 39371  		}
 39372  		if (n > 0) && (int32(*(*int8)(unsafe.Pointer(zLine + uintptr((n - 1))))) == '\n') {
 39373  			n--
 39374  			*(*int8)(unsafe.Pointer(zLine + uintptr(n))) = int8(0)
 39375  			break
 39376  		}
 39377  	}
 39378  	zLine = libc.Xrealloc(tls, zLine, (uint32(n + 1)))
 39379  	return zLine
 39380  }
 39381  
 39382  // This function is part of the implementation of the command:
 39383  //
 39384  //   $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 39385  //
 39386  // It is invoked after evaluating the script SCRIPT to commit or rollback
 39387  // the transaction or savepoint opened by the [transaction] command.
 39388  func DbTransPostCmd(tls *libc.TLS, data uintptr, interp uintptr, result int32) int32 { /* tclsqlite.c:1211:26: */
 39389  	bp := tls.Alloc(16)
 39390  	defer tls.Free(16)
 39391  
 39392  	var pDb uintptr = *(*ClientData)(unsafe.Pointer(data))
 39393  	var rc int32 = result
 39394  	var zEnd uintptr
 39395  
 39396  	(*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction--
 39397  	zEnd = azEnd[(((libc.Bool32(rc == TCL_ERROR)) * 2) + (libc.Bool32((*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction == 0)))]
 39398  
 39399  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth++
 39400  	if sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zEnd, uintptr(0), uintptr(0), uintptr(0)) != 0 {
 39401  		// This is a tricky scenario to handle. The most likely cause of an
 39402  		// error is that the exec() above was an attempt to commit the
 39403  		// top-level transaction that returned SQLITE_BUSY. Or, less likely,
 39404  		// that an IO-error has occurred. In either case, throw a Tcl exception
 39405  		// and try to rollback the transaction.
 39406  		//
 39407  		// But it could also be that the user executed one or more BEGIN,
 39408  		// COMMIT, SAVEPOINT, RELEASE or ROLLBACK commands that are confusing
 39409  		// this method's logic. Not clear how this would be best handled.
 39410  		if rc != TCL_ERROR {
 39411  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 39412  			rc = TCL_ERROR
 39413  		}
 39414  		sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, ts+7270 /* "ROLLBACK" */, uintptr(0), uintptr(0), uintptr(0))
 39415  	}
 39416  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth--
 39417  
 39418  	return rc
 39419  }
 39420  
 39421  var azEnd = [4]uintptr{
 39422  	ts + 12073, /* "RELEASE _tcl_tra..." */ // rc==TCL_ERROR, nTransaction!=0
 39423  	ts + 12098, /* "COMMIT" */              // rc!=TCL_ERROR, nTransaction==0
 39424  	ts + 12105, /* "ROLLBACK TO _tcl..." */
 39425  	ts + 7270,  /* "ROLLBACK" */ // rc==TCL_ERROR, nTransaction==0
 39426  } /* tclsqlite.c:1216:21 */
 39427  
 39428  // Unless SQLITE_TEST is defined, this function is a simple wrapper around
 39429  // sqlite3_prepare_v2(). If SQLITE_TEST is defined, then it uses either
 39430  // sqlite3_prepare_v2() or legacy interface sqlite3_prepare(), depending
 39431  // on whether or not the [db_use_legacy_prepare] command has been used to
 39432  // configure the connection.
 39433  func dbPrepare(tls *libc.TLS, pDb uintptr, zSql uintptr, ppStmt uintptr, pzOut uintptr) int32 { /* tclsqlite.c:1259:12: */
 39434  	var prepFlags uint32 = uint32(0)
 39435  	if (*SqliteDb)(unsafe.Pointer(pDb)).FbLegacyPrepare != 0 {
 39436  		return sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, ppStmt, pzOut)
 39437  	}
 39438  	// If the statement cache is large, use the SQLITE_PREPARE_PERSISTENT
 39439  	// flags, which uses less lookaside memory.  But if the cache is small,
 39440  	// omit that flag to make full use of lookaside
 39441  	if (*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt > 5 {
 39442  		prepFlags = uint32(SQLITE_PREPARE_PERSISTENT)
 39443  	}
 39444  
 39445  	return sqlite3.Xsqlite3_prepare_v3(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, prepFlags, ppStmt, pzOut)
 39446  }
 39447  
 39448  // Search the cache for a prepared-statement object that implements the
 39449  // first SQL statement in the buffer pointed to by parameter zIn. If
 39450  // no such prepared-statement can be found, allocate and prepare a new
 39451  // one. In either case, bind the current values of the relevant Tcl
 39452  // variables to any $var, :var or @var variables in the statement. Before
 39453  // returning, set *ppPreStmt to point to the prepared-statement object.
 39454  //
 39455  // Output parameter *pzOut is set to point to the next SQL statement in
 39456  // buffer zIn, or to the '\0' byte at the end of zIn if there is no
 39457  // next statement.
 39458  //
 39459  // If successful, TCL_OK is returned. Otherwise, TCL_ERROR is returned
 39460  // and an error message loaded into interpreter pDb->interp.
 39461  func dbPrepareAndBind(tls *libc.TLS, pDb uintptr, zIn uintptr, pzOut uintptr, ppPreStmt uintptr) int32 { /* tclsqlite.c:1294:12: */
 39462  	bp := tls.Alloc(24)
 39463  	defer tls.Free(24)
 39464  
 39465  	var zSql uintptr = zIn                                   // Pointer to first SQL statement in zIn
 39466  	*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0) // Prepared statement object
 39467  	var pPreStmt uintptr                                     // Pointer to cached statement
 39468  	var nSql int32                                           // Length of zSql in bytes
 39469  	var nVar int32 = 0                                       // Number of variables in statement
 39470  	var iParm int32 = 0                                      // Next free entry in apParm
 39471  	var c int8
 39472  	var i int32
 39473  	var needResultReset int32 = 0 // Need to invoke Tcl_ResetResult()
 39474  	var rc int32 = SQLITE_OK      // Value to return
 39475  	var interp uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Finterp
 39476  
 39477  	*(*uintptr)(unsafe.Pointer(ppPreStmt)) = uintptr(0)
 39478  
 39479  	// Trim spaces from the start of zSql and calculate the remaining length.
 39480  	for ((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer(zSql))))) == ' ') || (int32(c) == '\t')) || (int32(c) == '\r')) || (int32(c) == '\n') {
 39481  		zSql++
 39482  	}
 39483  	nSql = strlen30(tls, zSql)
 39484  
 39485  	for pPreStmt = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList; pPreStmt != 0; pPreStmt = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext {
 39486  		var n int32 = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql
 39487  		if ((nSql >= n) &&
 39488  			(libc.Xmemcmp(tls, (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql, zSql, uint32(n)) == 0)) &&
 39489  			((int32(*(*int8)(unsafe.Pointer(zSql + uintptr(n)))) == 0) || (int32(*(*int8)(unsafe.Pointer(zSql + uintptr((n - 1))))) == ';')) {
 39490  			*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt
 39491  			*(*uintptr)(unsafe.Pointer(pzOut)) = (zSql + uintptr((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))
 39492  
 39493  			// When a prepared statement is found, unlink it from the
 39494  			// cache list.  It will later be added back to the beginning
 39495  			// of the cache list in order to implement LRU replacement.
 39496  			if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev != 0 {
 39497  				(*SqlPreparedStmt)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev)).FpNext = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 39498  			} else {
 39499  				(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext
 39500  			}
 39501  			if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext != 0 {
 39502  				(*SqlPreparedStmt)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext)).FpPrev = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev
 39503  			} else {
 39504  				(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev
 39505  			}
 39506  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt--
 39507  			nVar = sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 39508  			break
 39509  		}
 39510  	}
 39511  
 39512  	// If no prepared statement was found. Compile the SQL text. Also allocate
 39513  	// a new SqlPreparedStmt structure.
 39514  	if pPreStmt == uintptr(0) {
 39515  		var nByte int32
 39516  
 39517  		if SQLITE_OK != dbPrepare(tls, pDb, zSql, bp /* &pStmt */, pzOut) {
 39518  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 39519  			return TCL_ERROR
 39520  		}
 39521  		if *(*uintptr)(unsafe.Pointer(bp /* pStmt */)) == uintptr(0) {
 39522  			if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb) {
 39523  				// A compile-time error in the statement.
 39524  				tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 39525  				return TCL_ERROR
 39526  			} else {
 39527  				// The statement was a no-op.  Continue to the next statement
 39528  				// in the SQL string.
 39529  				return TCL_OK
 39530  			}
 39531  		}
 39532  
 39533  		nVar = sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 39534  		nByte = (int32(uint32(unsafe.Sizeof(SqlPreparedStmt{})) + (uint32(nVar) * uint32(unsafe.Sizeof(uintptr(0))))))
 39535  		pPreStmt = tcl.XTcl_Alloc(tls, uint32(nByte))
 39536  		libc.Xmemset(tls, pPreStmt, 0, uint32(nByte))
 39537  
 39538  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt = *(*uintptr)(unsafe.Pointer(bp /* pStmt */))
 39539  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql = ((int32(*(*uintptr)(unsafe.Pointer(pzOut))) - int32(zSql)) / 1)
 39540  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql = sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 39541  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm = (pPreStmt + 1*28)
 39542  		if (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql == uintptr(0) {
 39543  			var zCopy uintptr = tcl.XTcl_Alloc(tls, (uint32((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql + 1)))
 39544  			libc.Xmemcpy(tls, zCopy, zSql, uint32((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))
 39545  			*(*int8)(unsafe.Pointer(zCopy + uintptr((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnSql))) = int8(0)
 39546  			(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FzSql = zCopy
 39547  		}
 39548  	}
 39549  
 39550  	// Bind values to parameters that begin with $ or :
 39551  	for i = 1; i <= nVar; i++ {
 39552  		var zVar uintptr = sqlite3.Xsqlite3_bind_parameter_name(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i)
 39553  		if (zVar != uintptr(0)) && (((int32(*(*int8)(unsafe.Pointer(zVar))) == '$') || (int32(*(*int8)(unsafe.Pointer(zVar))) == ':')) || (int32(*(*int8)(unsafe.Pointer(zVar))) == '@')) {
 39554  			var pVar uintptr = tcl.XTcl_GetVar2Ex(tls, interp, (zVar + 1), uintptr(0), 0)
 39555  			if (pVar == uintptr(0)) && ((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != uintptr(0)) {
 39556  				var pCmd uintptr
 39557  				var rx int32
 39558  				pCmd = tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, -1)
 39559  				(*Tcl_Obj)(unsafe.Pointer(pCmd)).FrefCount++
 39560  				tcl.XTcl_ListObjAppendElement(tls, interp, pCmd, tcl.XTcl_NewStringObj(tls, zVar, -1))
 39561  				if needResultReset != 0 {
 39562  					tcl.XTcl_ResetResult(tls, interp)
 39563  				}
 39564  				needResultReset = 1
 39565  				rx = tcl.XTcl_EvalObjEx(tls, interp, pCmd, TCL_EVAL_DIRECT)
 39566  				for ok := true; ok; ok = 0 != 0 {
 39567  					var _objPtr uintptr = pCmd
 39568  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39569  						tcl.XTclFreeObj(tls, _objPtr)
 39570  					}
 39571  				}
 39572  				if rx == TCL_OK {
 39573  					pVar = tcl.XTcl_GetObjResult(tls, interp)
 39574  				} else if rx == TCL_ERROR {
 39575  					rc = TCL_ERROR
 39576  					break
 39577  				} else {
 39578  					pVar = uintptr(0)
 39579  				}
 39580  			}
 39581  			if pVar != 0 {
 39582  				// var n int32 at bp+4, 4
 39583  
 39584  				var data uintptr
 39585  				var zType uintptr = func() uintptr {
 39586  					if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 39587  						return (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname
 39588  					}
 39589  					return ts + 489 /* "" */
 39590  				}()
 39591  				c = *(*int8)(unsafe.Pointer(zType))
 39592  				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))) {
 39593  					// Load a BLOB type if the Tcl variable is a bytearray and
 39594  					// it has no string representation or the host
 39595  					// parameter name begins with "@".
 39596  					data = tcl.XTcl_GetByteArrayFromObj(tls, pVar, bp+4 /* &n */)
 39597  					sqlite3.Xsqlite3_bind_blob(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, data, *(*int32)(unsafe.Pointer(bp + 4 /* n */)), uintptr(0))
 39598  					(*Tcl_Obj)(unsafe.Pointer(pVar)).FrefCount++
 39599  					*(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(libc.PostIncInt32(&iParm, 1))*4)) = pVar
 39600  				} else if (int32(c) == 'b') && (libc.Xstrcmp(tls, zType, ts+2415 /* "boolean" */) == 0) {
 39601  					tcl.XTcl_GetIntFromObj(tls, interp, pVar, bp+4 /* &n */)
 39602  					sqlite3.Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*int32)(unsafe.Pointer(bp + 4 /* n */)))
 39603  				} else if (int32(c) == 'd') && (libc.Xstrcmp(tls, zType, ts+2423 /* "double" */) == 0) {
 39604  					// var r float64 at bp+8, 8
 39605  
 39606  					tcl.XTcl_GetDoubleFromObj(tls, interp, pVar, bp+8 /* &r */)
 39607  					sqlite3.Xsqlite3_bind_double(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*float64)(unsafe.Pointer(bp + 8 /* r */)))
 39608  				} else if ((int32(c) == 'w') && (libc.Xstrcmp(tls, zType, ts+2430 /* "wideInt" */) == 0)) || ((int32(c) == 'i') && (libc.Xstrcmp(tls, zType, ts+2438 /* "int" */) == 0)) {
 39609  					// var v Tcl_WideInt at bp+16, 8
 39610  
 39611  					tcl.XTcl_GetWideIntFromObj(tls, interp, pVar, bp+16 /* &v */)
 39612  					sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, *(*Tcl_WideInt)(unsafe.Pointer(bp + 16 /* v */)))
 39613  				} else {
 39614  					data = tcl.XTcl_GetStringFromObj(tls, pVar, bp+4 /* &n */)
 39615  					sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i, data, *(*int32)(unsafe.Pointer(bp + 4 /* n */)), uintptr(0))
 39616  					(*Tcl_Obj)(unsafe.Pointer(pVar)).FrefCount++
 39617  					*(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(libc.PostIncInt32(&iParm, 1))*4)) = pVar
 39618  				}
 39619  			} else {
 39620  				sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), i)
 39621  			}
 39622  			if needResultReset != 0 {
 39623  				tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 39624  			}
 39625  		}
 39626  	}
 39627  	(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm = iParm
 39628  	*(*uintptr)(unsafe.Pointer(ppPreStmt)) = pPreStmt
 39629  	if (needResultReset != 0) && (rc == TCL_OK) {
 39630  		tcl.XTcl_ResetResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp)
 39631  	}
 39632  
 39633  	return rc
 39634  }
 39635  
 39636  // Release a statement reference obtained by calling dbPrepareAndBind().
 39637  // There should be exactly one call to this function for each call to
 39638  // dbPrepareAndBind().
 39639  //
 39640  // If the discard parameter is non-zero, then the statement is deleted
 39641  // immediately. Otherwise it is added to the LRU list and may be returned
 39642  // by a subsequent call to dbPrepareAndBind().
 39643  func dbReleaseStmt(tls *libc.TLS, pDb uintptr, pPreStmt uintptr, discard int32) { /* tclsqlite.c:1470:13: */
 39644  	var i int32
 39645  
 39646  	// Free the bound string and blob parameters
 39647  	for i = 0; i < (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm; i++ {
 39648  		for ok := true; ok; ok = 0 != 0 {
 39649  			var _objPtr uintptr = *(*uintptr)(unsafe.Pointer((*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FapParm + uintptr(i)*4))
 39650  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39651  				tcl.XTclFreeObj(tls, _objPtr)
 39652  			}
 39653  		}
 39654  	}
 39655  	(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FnParm = 0
 39656  
 39657  	if ((*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt <= 0) || (discard != 0) {
 39658  		// If the cache is turned off, deallocated the statement
 39659  		dbFreeStmt(tls, pPreStmt)
 39660  	} else {
 39661  		// Add the prepared statement to the beginning of the cache list.
 39662  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList
 39663  		(*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpPrev = uintptr(0)
 39664  		if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList != 0 {
 39665  			(*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtList)).FpPrev = pPreStmt
 39666  		}
 39667  		(*SqliteDb)(unsafe.Pointer(pDb)).FstmtList = pPreStmt
 39668  		if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast == uintptr(0) {
 39669  
 39670  			(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = pPreStmt
 39671  		} else {
 39672  
 39673  		}
 39674  		(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt++
 39675  
 39676  		// If we have too many statement in cache, remove the surplus from
 39677  		// the end of the cache list.
 39678  		for (*SqliteDb)(unsafe.Pointer(pDb)).FnStmt > (*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt {
 39679  			var pLast uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast
 39680  			(*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast = (*SqlPreparedStmt)(unsafe.Pointer(pLast)).FpPrev
 39681  			(*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtLast)).FpNext = uintptr(0)
 39682  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStmt--
 39683  			dbFreeStmt(tls, pLast)
 39684  		}
 39685  	}
 39686  }
 39687  
 39688  // Structure used with dbEvalXXX() functions:
 39689  //
 39690  //   dbEvalInit()
 39691  //   dbEvalStep()
 39692  //   dbEvalFinalize()
 39693  //   dbEvalRowInfo()
 39694  //   dbEvalColumnValue()
 39695  type DbEvalContext1 = struct {
 39696  	FpDb       uintptr
 39697  	FpSql      uintptr
 39698  	FzSql      uintptr
 39699  	FpPreStmt  uintptr
 39700  	FnCol      int32
 39701  	FevalFlags int32
 39702  	FpArray    uintptr
 39703  	FapColName uintptr
 39704  } /* tclsqlite.c:1523:9 */
 39705  
 39706  // Structure used with dbEvalXXX() functions:
 39707  //
 39708  //   dbEvalInit()
 39709  //   dbEvalStep()
 39710  //   dbEvalFinalize()
 39711  //   dbEvalRowInfo()
 39712  //   dbEvalColumnValue()
 39713  type DbEvalContext = DbEvalContext1 /* tclsqlite.c:1523:30 */
 39714  
 39715  // Release any cache of column names currently held as part of
 39716  // the DbEvalContext structure passed as the first argument.
 39717  func dbReleaseColumnNames(tls *libc.TLS, p uintptr) { /* tclsqlite.c:1541:13: */
 39718  	if (*DbEvalContext)(unsafe.Pointer(p)).FapColName != 0 {
 39719  		var i int32
 39720  		for i = 0; i < (*DbEvalContext)(unsafe.Pointer(p)).FnCol; i++ {
 39721  			for ok := true; ok; ok = 0 != 0 {
 39722  				var _objPtr uintptr = *(*uintptr)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FapColName + uintptr(i)*4))
 39723  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39724  					tcl.XTclFreeObj(tls, _objPtr)
 39725  				}
 39726  			}
 39727  		}
 39728  		tcl.XTcl_Free(tls, (*DbEvalContext)(unsafe.Pointer(p)).FapColName)
 39729  		(*DbEvalContext)(unsafe.Pointer(p)).FapColName = uintptr(0)
 39730  	}
 39731  	(*DbEvalContext)(unsafe.Pointer(p)).FnCol = 0
 39732  }
 39733  
 39734  // Initialize a DbEvalContext structure.
 39735  //
 39736  // If pArray is not NULL, then it contains the name of a Tcl array
 39737  // variable. The "*" member of this array is set to a list containing
 39738  // the names of the columns returned by the statement as part of each
 39739  // call to dbEvalStep(), in order from left to right. e.g. if the names
 39740  // of the returned columns are a, b and c, it does the equivalent of the
 39741  // tcl command:
 39742  //
 39743  //     set ${pArray}(*) {a b c}
 39744  func dbEvalInit(tls *libc.TLS, p uintptr, pDb uintptr, pSql uintptr, pArray uintptr, evalFlags int32) { /* tclsqlite.c:1565:13: */
 39745  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(DbEvalContext{})))
 39746  	(*DbEvalContext)(unsafe.Pointer(p)).FpDb = pDb
 39747  	(*DbEvalContext)(unsafe.Pointer(p)).FzSql = tcl.XTcl_GetString(tls, pSql)
 39748  	(*DbEvalContext)(unsafe.Pointer(p)).FpSql = pSql
 39749  	(*Tcl_Obj)(unsafe.Pointer(pSql)).FrefCount++
 39750  	if pArray != 0 {
 39751  		(*DbEvalContext)(unsafe.Pointer(p)).FpArray = pArray
 39752  		(*Tcl_Obj)(unsafe.Pointer(pArray)).FrefCount++
 39753  	}
 39754  	(*DbEvalContext)(unsafe.Pointer(p)).FevalFlags = evalFlags
 39755  }
 39756  
 39757  // Obtain information about the row that the DbEvalContext passed as the
 39758  // first argument currently points to.
 39759  func dbEvalRowInfo(tls *libc.TLS, p uintptr, pnCol uintptr, papColName uintptr) { /* tclsqlite.c:1588:13: */
 39760  	// Compute column names
 39761  	if uintptr(0) == (*DbEvalContext)(unsafe.Pointer(p)).FapColName {
 39762  		var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt
 39763  		var i int32                        // Iterator variable
 39764  		var nCol int32                     // Number of columns returned by pStmt
 39765  		var apColName uintptr = uintptr(0) // Array of column names
 39766  
 39767  		(*DbEvalContext)(unsafe.Pointer(p)).FnCol = libc.AssignInt32(&nCol, sqlite3.Xsqlite3_column_count(tls, pStmt))
 39768  		if (nCol > 0) && ((papColName != 0) || ((*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0)) {
 39769  			apColName = tcl.XTcl_Alloc(tls, (uint32(unsafe.Sizeof(uintptr(0))) * uint32(nCol)))
 39770  			for i = 0; i < nCol; i++ {
 39771  				*(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*4)) = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_column_name(tls, pStmt, i), -1)
 39772  				(*Tcl_Obj)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*4)))).FrefCount++
 39773  			}
 39774  			(*DbEvalContext)(unsafe.Pointer(p)).FapColName = apColName
 39775  		}
 39776  
 39777  		// If results are being stored in an array variable, then create
 39778  		// the array(*) entry for that array
 39779  		if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 39780  			var interp uintptr = (*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).Finterp
 39781  			var pColList uintptr = tcl.XTcl_NewObj(tls)
 39782  			var pStar uintptr = tcl.XTcl_NewStringObj(tls, ts+3701 /* "*" */, -1)
 39783  
 39784  			for i = 0; i < nCol; i++ {
 39785  				tcl.XTcl_ListObjAppendElement(tls, interp, pColList, *(*uintptr)(unsafe.Pointer(apColName + uintptr(i)*4)))
 39786  			}
 39787  			(*Tcl_Obj)(unsafe.Pointer(pStar)).FrefCount++
 39788  			tcl.XTcl_ObjSetVar2(tls, interp, (*DbEvalContext)(unsafe.Pointer(p)).FpArray, pStar, pColList, 0)
 39789  			for ok := true; ok; ok = 0 != 0 {
 39790  				var _objPtr uintptr = pStar
 39791  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39792  					tcl.XTclFreeObj(tls, _objPtr)
 39793  				}
 39794  			}
 39795  		}
 39796  	}
 39797  
 39798  	if papColName != 0 {
 39799  		*(*uintptr)(unsafe.Pointer(papColName)) = (*DbEvalContext)(unsafe.Pointer(p)).FapColName
 39800  	}
 39801  	if pnCol != 0 {
 39802  		*(*int32)(unsafe.Pointer(pnCol)) = (*DbEvalContext)(unsafe.Pointer(p)).FnCol
 39803  	}
 39804  }
 39805  
 39806  // Return one of TCL_OK, TCL_BREAK or TCL_ERROR. If TCL_ERROR is
 39807  // returned, then an error message is stored in the interpreter before
 39808  // returning.
 39809  //
 39810  // A return value of TCL_OK means there is a row of data available. The
 39811  // data may be accessed using dbEvalRowInfo() and dbEvalColumnValue(). This
 39812  // is analogous to a return of SQLITE_ROW from sqlite3_step(). If TCL_BREAK
 39813  // is returned, then the SQL script has finished executing and there are
 39814  // no further rows available. This is similar to SQLITE_DONE.
 39815  func dbEvalStep(tls *libc.TLS, p uintptr) int32 { /* tclsqlite.c:1646:12: */
 39816  	var zPrevSql uintptr = uintptr(0) // Previous value of p->zSql
 39817  
 39818  	for (*(*int8)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FzSql)) != 0) || ((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt != 0) {
 39819  		var rc int32
 39820  		if (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt == uintptr(0) {
 39821  			zPrevSql = func() uintptr {
 39822  				if (*DbEvalContext)(unsafe.Pointer(p)).FzSql == zPrevSql {
 39823  					return uintptr(0)
 39824  				}
 39825  				return (*DbEvalContext)(unsafe.Pointer(p)).FzSql
 39826  			}()
 39827  			rc = dbPrepareAndBind(tls, (*DbEvalContext)(unsafe.Pointer(p)).FpDb, (*DbEvalContext)(unsafe.Pointer(p)).FzSql, (p + 8 /* &.zSql */), (p + 12 /* &.pPreStmt */))
 39828  			if rc != TCL_OK {
 39829  				return rc
 39830  			}
 39831  		} else {
 39832  			var rcs int32
 39833  			var pDb uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpDb
 39834  			var pPreStmt uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt
 39835  			var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer(pPreStmt)).FpStmt
 39836  
 39837  			rcs = sqlite3.Xsqlite3_step(tls, pStmt)
 39838  			if rcs == SQLITE_ROW {
 39839  				return TCL_OK
 39840  			}
 39841  			if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 39842  				dbEvalRowInfo(tls, p, uintptr(0), uintptr(0))
 39843  			}
 39844  			rcs = sqlite3.Xsqlite3_reset(tls, pStmt)
 39845  
 39846  			(*SqliteDb)(unsafe.Pointer(pDb)).FnStep = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, 1)
 39847  			(*SqliteDb)(unsafe.Pointer(pDb)).FnSort = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_SORT, 1)
 39848  			(*SqliteDb)(unsafe.Pointer(pDb)).FnIndex = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_AUTOINDEX, 1)
 39849  			(*SqliteDb)(unsafe.Pointer(pDb)).FnVMStep = sqlite3.Xsqlite3_stmt_status(tls, pStmt, SQLITE_STMTSTATUS_VM_STEP, 1)
 39850  			dbReleaseColumnNames(tls, p)
 39851  			(*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt = uintptr(0)
 39852  
 39853  			if rcs != SQLITE_OK {
 39854  				// If a run-time error occurs, report the error and stop reading
 39855  				// the SQL.
 39856  				dbReleaseStmt(tls, pDb, pPreStmt, 1)
 39857  				if (((*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).FbLegacyPrepare != 0) && (rcs == SQLITE_SCHEMA)) && (zPrevSql != 0) {
 39858  					// If the runtime error was an SQLITE_SCHEMA, and the database
 39859  					// handle is configured to use the legacy sqlite3_prepare()
 39860  					// interface, retry prepare()/step() on the same SQL statement.
 39861  					// This only happens once. If there is a second SQLITE_SCHEMA
 39862  					// error, the error will be returned to the caller.
 39863  					(*DbEvalContext)(unsafe.Pointer(p)).FzSql = zPrevSql
 39864  					continue
 39865  				}
 39866  				tcl.XTcl_SetObjResult(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Finterp,
 39867  					tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), -1))
 39868  				return TCL_ERROR
 39869  			} else {
 39870  				dbReleaseStmt(tls, pDb, pPreStmt, 0)
 39871  			}
 39872  		}
 39873  	}
 39874  
 39875  	// Finished
 39876  	return TCL_BREAK
 39877  }
 39878  
 39879  // Free all resources currently held by the DbEvalContext structure passed
 39880  // as the first argument. There should be exactly one call to this function
 39881  // for each call to dbEvalInit().
 39882  func dbEvalFinalize(tls *libc.TLS, p uintptr) { /* tclsqlite.c:1710:13: */
 39883  	if (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt != 0 {
 39884  		sqlite3.Xsqlite3_reset(tls, (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt)
 39885  		dbReleaseStmt(tls, (*DbEvalContext)(unsafe.Pointer(p)).FpDb, (*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt, 0)
 39886  		(*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt = uintptr(0)
 39887  	}
 39888  	if (*DbEvalContext)(unsafe.Pointer(p)).FpArray != 0 {
 39889  		for ok := true; ok; ok = 0 != 0 {
 39890  			var _objPtr uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpArray
 39891  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39892  				tcl.XTclFreeObj(tls, _objPtr)
 39893  			}
 39894  		}
 39895  		(*DbEvalContext)(unsafe.Pointer(p)).FpArray = uintptr(0)
 39896  	}
 39897  	for ok1 := true; ok1; ok1 = 0 != 0 {
 39898  		var _objPtr uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpSql
 39899  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 39900  			tcl.XTclFreeObj(tls, _objPtr)
 39901  		}
 39902  	}
 39903  	dbReleaseColumnNames(tls, p)
 39904  }
 39905  
 39906  // Return a pointer to a Tcl_Obj structure with ref-count 0 that contains
 39907  // the value for the iCol'th column of the row currently pointed to by
 39908  // the DbEvalContext structure passed as the first argument.
 39909  func dbEvalColumnValue(tls *libc.TLS, p uintptr, iCol int32) uintptr { /* tclsqlite.c:1729:16: */
 39910  	var pStmt uintptr = (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt
 39911  	switch sqlite3.Xsqlite3_column_type(tls, pStmt, iCol) {
 39912  	case SQLITE_BLOB:
 39913  		{
 39914  			var bytes int32 = sqlite3.Xsqlite3_column_bytes(tls, pStmt, iCol)
 39915  			var zBlob uintptr = sqlite3.Xsqlite3_column_blob(tls, pStmt, iCol)
 39916  			if !(zBlob != 0) {
 39917  				bytes = 0
 39918  			}
 39919  			return tcl.XTcl_NewByteArrayObj(tls, zBlob, bytes)
 39920  
 39921  		}
 39922  	case SQLITE_INTEGER:
 39923  		{
 39924  			var v sqlite_int64 = sqlite3.Xsqlite3_column_int64(tls, pStmt, iCol)
 39925  			if (v >= int64(-2147483647)) && (v <= int64(2147483647)) {
 39926  				return tcl.XTcl_NewIntObj(tls, int32(v))
 39927  			} else {
 39928  				return tcl.XTcl_NewWideIntObj(tls, v)
 39929  			}
 39930  
 39931  		}
 39932  		fallthrough
 39933  	case SQLITE_FLOAT:
 39934  		{
 39935  			return tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_column_double(tls, pStmt, iCol))
 39936  
 39937  		}
 39938  	case SQLITE_NULL:
 39939  		{
 39940  			return tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpDb)).FzNull, -1)
 39941  
 39942  		}
 39943  	}
 39944  
 39945  	return tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_column_text(tls, pStmt, iCol), -1)
 39946  }
 39947  
 39948  // If using Tcl version 8.6 or greater, use the NR functions to avoid
 39949  // recursive evalution of scripts by the [db eval] and [db trans]
 39950  // commands. Even if the headers used while compiling the extension
 39951  // are 8.6 or newer, the code still tests the Tcl version at runtime.
 39952  // This allows stubs-enabled builds to be used with older Tcl libraries.
 39953  func DbUseNre(tls *libc.TLS) int32 { /* tclsqlite.c:1766:12: */
 39954  	bp := tls.Alloc(8)
 39955  	defer tls.Free(8)
 39956  
 39957  	// var major int32 at bp, 4
 39958  
 39959  	// var minor int32 at bp+4, 4
 39960  
 39961  	tcl.XTcl_GetVersion(tls, bp /* &major */, bp+4 /* &minor */, uintptr(0), uintptr(0))
 39962  	return (libc.Bool32(((*(*int32)(unsafe.Pointer(bp /* major */)) == 8) && (*(*int32)(unsafe.Pointer(bp + 4 /* minor */)) >= 6)) || (*(*int32)(unsafe.Pointer(bp /* major */)) > 8)))
 39963  }
 39964  
 39965  // This function is part of the implementation of the command:
 39966  //
 39967  //   $db eval SQL ?ARRAYNAME? SCRIPT
 39968  func DbEvalNextCmd(tls *libc.TLS, data uintptr, interp uintptr, result int32) int32 { /* tclsqlite.c:1793:26: */
 39969  	bp := tls.Alloc(8)
 39970  	defer tls.Free(8)
 39971  
 39972  	var rc int32 = result // Return code
 39973  
 39974  	// The first element of the data[] array is a pointer to a DbEvalContext
 39975  	// structure allocated using Tcl_Alloc(). The second element of data[]
 39976  	// is a pointer to a Tcl_Obj containing the script to run for each row
 39977  	// returned by the queries encapsulated in data[0].
 39978  	var p uintptr = *(*ClientData)(unsafe.Pointer(data))
 39979  	var pScript uintptr = *(*ClientData)(unsafe.Pointer(data + 1*4))
 39980  	var pArray uintptr = (*DbEvalContext)(unsafe.Pointer(p)).FpArray
 39981  
 39982  	for ((rc == TCL_OK) || (rc == TCL_CONTINUE)) && (TCL_OK == (libc.AssignInt32(&rc, dbEvalStep(tls, p)))) {
 39983  		var i int32
 39984  		// var nCol int32 at bp, 4
 39985  
 39986  		// var apColName uintptr at bp+4, 4
 39987  
 39988  		dbEvalRowInfo(tls, p, bp /* &nCol */, bp+4 /* &apColName */)
 39989  		for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nCol */)); i++ {
 39990  			if pArray == uintptr(0) {
 39991  				tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* apColName */)) + uintptr(i)*4)), uintptr(0), dbEvalColumnValue(tls, p, i), 0)
 39992  			} else if (((*DbEvalContext)(unsafe.Pointer(p)).FevalFlags & SQLITE_EVAL_WITHOUTNULLS) != 0) &&
 39993  				(sqlite3.Xsqlite3_column_type(tls, (*SqlPreparedStmt)(unsafe.Pointer((*DbEvalContext)(unsafe.Pointer(p)).FpPreStmt)).FpStmt, i) == SQLITE_NULL) {
 39994  				tcl.XTcl_UnsetVar2(tls, interp, tcl.XTcl_GetString(tls, pArray),
 39995  					tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* apColName */)) + uintptr(i)*4))), 0)
 39996  			} else {
 39997  				tcl.XTcl_ObjSetVar2(tls, interp, pArray, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* apColName */)) + uintptr(i)*4)), dbEvalColumnValue(tls, p, i), 0)
 39998  			}
 39999  		}
 40000  
 40001  		// The required interpreter variables are now populated with the data
 40002  		// from the current row. If using NRE, schedule callbacks to evaluate
 40003  		// script pScript, then to invoke this function again to fetch the next
 40004  		// row (or clean up if there is no next row or the script throws an
 40005  		// exception). After scheduling the callbacks, return control to the
 40006  		// caller.
 40007  		//
 40008  		// If not using NRE, evaluate pScript directly and continue with the
 40009  		// next iteration of this while(...) loop.
 40010  		if DbUseNre(tls) != 0 {
 40011  			tcl.XTcl_NRAddCallback(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 40012  				f func(*libc.TLS, uintptr, uintptr, int32) int32
 40013  			}{DbEvalNextCmd})), p, pScript, uintptr(0), uintptr(0))
 40014  			return tcl.XTcl_NREvalObj(tls, interp, pScript, 0)
 40015  		} else {
 40016  			rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, 0)
 40017  		}
 40018  	}
 40019  
 40020  	for ok := true; ok; ok = 0 != 0 {
 40021  		var _objPtr uintptr = pScript
 40022  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 40023  			tcl.XTclFreeObj(tls, _objPtr)
 40024  		}
 40025  	}
 40026  	dbEvalFinalize(tls, p)
 40027  	tcl.XTcl_Free(tls, p)
 40028  
 40029  	if (rc == TCL_OK) || (rc == TCL_BREAK) {
 40030  		tcl.XTcl_ResetResult(tls, interp)
 40031  		rc = TCL_OK
 40032  	}
 40033  	return rc
 40034  }
 40035  
 40036  // This function is used by the implementations of the following database
 40037  // handle sub-commands:
 40038  //
 40039  //   $db update_hook ?SCRIPT?
 40040  //   $db wal_hook ?SCRIPT?
 40041  //   $db commit_hook ?SCRIPT?
 40042  //   $db preupdate hook ?SCRIPT?
 40043  func DbHookCmd(tls *libc.TLS, interp uintptr, pDb uintptr, pArg uintptr, ppHook uintptr) { /* tclsqlite.c:1863:13: */
 40044  	var db uintptr = (*SqliteDb)(unsafe.Pointer(pDb)).Fdb
 40045  
 40046  	if *(*uintptr)(unsafe.Pointer(ppHook)) != 0 {
 40047  		tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(ppHook)))
 40048  		if pArg != 0 {
 40049  			for ok := true; ok; ok = 0 != 0 {
 40050  				var _objPtr uintptr = *(*uintptr)(unsafe.Pointer(ppHook))
 40051  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 40052  					tcl.XTclFreeObj(tls, _objPtr)
 40053  				}
 40054  			}
 40055  			*(*uintptr)(unsafe.Pointer(ppHook)) = uintptr(0)
 40056  		}
 40057  	}
 40058  	if pArg != 0 {
 40059  
 40060  		if tcl.XTcl_GetCharLength(tls, pArg) > 0 {
 40061  			*(*uintptr)(unsafe.Pointer(ppHook)) = pArg
 40062  			(*Tcl_Obj)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppHook)))).FrefCount++
 40063  		}
 40064  	}
 40065  
 40066  	sqlite3.Xsqlite3_preupdate_hook(tls, db, func() uintptr {
 40067  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpPreUpdateHook != 0 {
 40068  			return *(*uintptr)(unsafe.Pointer(&struct {
 40069  				f func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, sqlite_int64, sqlite_int64)
 40070  			}{DbPreUpdateHandler}))
 40071  		}
 40072  		return uintptr(0)
 40073  	}(), pDb)
 40074  	sqlite3.Xsqlite3_update_hook(tls, db, func() uintptr {
 40075  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpUpdateHook != 0 {
 40076  			return *(*uintptr)(unsafe.Pointer(&struct {
 40077  				f func(*libc.TLS, uintptr, int32, uintptr, uintptr, sqlite_int64)
 40078  			}{DbUpdateHandler}))
 40079  		}
 40080  		return uintptr(0)
 40081  	}(), pDb)
 40082  	sqlite3.Xsqlite3_rollback_hook(tls, db, func() uintptr {
 40083  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpRollbackHook != 0 {
 40084  			return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbRollbackHandler}))
 40085  		}
 40086  		return uintptr(0)
 40087  	}(), pDb)
 40088  	sqlite3.Xsqlite3_wal_hook(tls, db, func() uintptr {
 40089  		if (*SqliteDb)(unsafe.Pointer(pDb)).FpWalHook != 0 {
 40090  			return *(*uintptr)(unsafe.Pointer(&struct {
 40091  				f func(*libc.TLS, uintptr, uintptr, uintptr, int32) int32
 40092  			}{DbWalHandler}))
 40093  		}
 40094  		return uintptr(0)
 40095  	}(), pDb)
 40096  }
 40097  
 40098  // The "sqlite" command below creates a new Tcl command for each
 40099  // connection it opens to an SQLite database.  This routine is invoked
 40100  // whenever one of those connection-specific commands is executed
 40101  // in Tcl.  For example, if you run Tcl code like this:
 40102  //
 40103  //       sqlite3 db1  "my_database"
 40104  //       db1 close
 40105  //
 40106  // The first command opens a connection to the "my_database" database
 40107  // and calls that connection "db1".  The second command causes this
 40108  // subroutine to be invoked.
 40109  func DbObjCmd(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:1907:26: */
 40110  	bp := tls.Alloc(1464)
 40111  	defer tls.Free(1464)
 40112  	*(*uintptr)(unsafe.Pointer(bp + 1348)) = cd
 40113  
 40114  	var pDb uintptr
 40115  	// var choice int32 at bp+1016, 4
 40116  
 40117  	var rc int32
 40118  	var zAuth uintptr
 40119  	// var len int32 at bp+1020, 4
 40120  
 40121  	var zDestFile uintptr
 40122  	var zSrcDb uintptr
 40123  	// var pDest uintptr at bp+1024, 4
 40124  
 40125  	var pBackup uintptr
 40126  	var zCallback uintptr
 40127  	// var len1 int32 at bp+1028, 4
 40128  
 40129  	var zBusy uintptr
 40130  	// var len2 int32 at bp+1032, 4
 40131  
 40132  	var subCmd uintptr
 40133  	// var n int32 at bp+1036, 4
 40134  
 40135  	var pResult uintptr
 40136  	var pCollate uintptr
 40137  	var zName uintptr
 40138  	var zScript uintptr
 40139  	// var nScript int32 at bp+1040, 4
 40140  
 40141  	var _objPtr uintptr
 40142  	var zCommit uintptr
 40143  	// var len3 int32 at bp+1044, 4
 40144  
 40145  	var pResult1 uintptr
 40146  	var isComplete int32
 40147  	// var v int32 at bp+1048, 4
 40148  
 40149  	var zOpt uintptr
 40150  	// var onoff int32 at bp+1052, 4
 40151  
 40152  	// var v1 int32 at bp+1056, 4
 40153  
 40154  	var pResult2 uintptr
 40155  	var ii int32
 40156  	var zErr uintptr
 40157  	var nErr int32
 40158  	var z uintptr
 40159  	var zTable uintptr    // Insert data into this table
 40160  	var zFile uintptr     // The file from which to extract data
 40161  	var zConflict uintptr // The conflict algorithm to use
 40162  	// var pStmt uintptr at bp+1060, 4
 40163  	// A statement
 40164  	var nCol int32  // Number of columns in the table
 40165  	var nByte int32 // Number of bytes in an SQL string
 40166  	var i int32
 40167  	var j int32          // Loop counters
 40168  	var nSep int32       // Number of bytes in zSep[]
 40169  	var nNull int32      // Number of bytes in zNull[]
 40170  	var zSql uintptr     // An SQL statement
 40171  	var zLine uintptr    // A single line of input from the file
 40172  	var azCol uintptr    // zLine[] broken up into columns
 40173  	var zCommit1 uintptr // How to commit changes
 40174  	var in uintptr       // The input file
 40175  	var lineno int32     // Line number of input file
 40176  	// var zLineNum [80]int8 at bp+1064, 80
 40177  	// Line number print buffer
 40178  	var pResult3 uintptr // interp result
 40179  
 40180  	var zSep uintptr
 40181  	var zNull uintptr
 40182  	var z1 uintptr
 40183  	var flags int32
 40184  	var zSchema uintptr
 40185  	var pValue uintptr
 40186  	var pBA uintptr
 40187  	var pData uintptr
 40188  	// var len4 int32 at bp+1156, 4
 40189  
 40190  	var xrc int32
 40191  	// var mxSize sqlite3_int64 at bp+1144, 8
 40192  
 40193  	var i1 int32
 40194  	// var isReadonly int32 at bp+1152, 4
 40195  
 40196  	var pResult4 uintptr
 40197  	// var sEval DbEvalContext at bp+1160, 32
 40198  
 40199  	var i2 int32
 40200  	// var nCol1 int32 at bp+1224, 4
 40201  
 40202  	var _objPtr1 uintptr
 40203  	// var sEval1 DbEvalContext at bp+1192, 32
 40204  
 40205  	var pRet uintptr
 40206  	// var cd2 [2]ClientData at bp+1228, 8
 40207  
 40208  	var p uintptr
 40209  	var pArray uintptr
 40210  	var pScript uintptr
 40211  	var evalFlags int32
 40212  	var zOpt1 uintptr
 40213  	// var azType [6]uintptr at bp+1240, 24
 40214  
 40215  	var z2 uintptr
 40216  	var n1 int32
 40217  	var _objPtr2 uintptr
 40218  	var flags1 int32
 40219  	var pFunc uintptr
 40220  	var pScript1 uintptr
 40221  	var zName1 uintptr
 40222  	// var nArg int32 at bp+1236, 4
 40223  
 40224  	var i3 int32
 40225  	// var eType int32 at bp+1264, 4
 40226  
 40227  	var isReadonly1 int32
 40228  	var zDb uintptr
 40229  	var zTable1 uintptr
 40230  	var zColumn uintptr
 40231  	// var iRow Tcl_WideInt at bp+1272, 8
 40232  
 40233  	// var len5 int32 at bp+1280, 4
 40234  
 40235  	var zNull1 uintptr
 40236  	var pResult5 uintptr
 40237  	var rowid Tcl_WideInt
 40238  	var zProgress uintptr
 40239  	// var len6 int32 at bp+1288, 4
 40240  
 40241  	// var N int32 at bp+1284, 4
 40242  
 40243  	var zProfile uintptr
 40244  	// var len7 int32 at bp+1292, 4
 40245  
 40246  	var zSrcFile uintptr
 40247  	var zDestDb uintptr
 40248  	// var pSrc uintptr at bp+1296, 4
 40249  
 40250  	var pBackup1 uintptr
 40251  	var nTimeout int32
 40252  	var needFree int32
 40253  	var zSchema1 uintptr
 40254  	// var sz sqlite3_int64 at bp+1304, 8
 40255  
 40256  	var pData1 uintptr
 40257  	var v2 int32
 40258  	var zOp uintptr
 40259  	// var ms int32 at bp+1312, 4
 40260  
 40261  	var pResult6 uintptr
 40262  	var zTrace uintptr
 40263  	// var len8 int32 at bp+1316, 4
 40264  
 40265  	var _objPtr3 uintptr
 40266  	var _objPtr4 uintptr
 40267  	// var wType Tcl_WideInt at bp+1336, 8
 40268  
 40269  	var pError uintptr
 40270  	// var pObj uintptr at bp+1324, 4
 40271  
 40272  	// var ttype int32 at bp+1328, 4
 40273  
 40274  	var i4 int32
 40275  	var zTraceV2 uintptr
 40276  	// var len9 int32 at bp+1320, 4
 40277  
 40278  	var wMask Tcl_WideInt
 40279  	// var ttype1 int32 at bp+1344, 4
 40280  
 40281  	var pScript2 uintptr
 40282  	var zBegin uintptr
 40283  	var _objPtr5 uintptr
 40284  	var xNotify uintptr
 40285  	var pNotifyArg uintptr
 40286  	var nCol2 int32
 40287  	var pRet1 uintptr
 40288  	var pObj1 uintptr
 40289  	// var iIdx int32 at bp+1356, 4
 40290  
 40291  	// var pValue1 uintptr at bp+1360, 4
 40292  
 40293  	// var iSub int32 at bp+1352, 4
 40294  
 40295  	// set ppHook to point at pUpdateHook or pRollbackHook, depending on
 40296  	// whether [$db update_hook] or [$db rollback_hook] was invoked.
 40297  	var ppHook uintptr
 40298  	// var zBuf [100]int8 at bp+1364, 100
 40299  
 40300  	var zArg uintptr
 40301  	var i5 int32
 40302  	pDb = *(*uintptr)(unsafe.Pointer(bp + 1348 /* cd */))
 40303  	rc = TCL_OK
 40304  	// don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler
 40305  
 40306  	if !(objc < 2) {
 40307  		goto __1
 40308  	}
 40309  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 40310  	return TCL_ERROR
 40311  __1:
 40312  	;
 40313  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&DB_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+12161 /* "option" */, 0, bp+1016 /* &choice */) != 0) {
 40314  		goto __2
 40315  	}
 40316  	return TCL_ERROR
 40317  __2:
 40318  	;
 40319  
 40320  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */))) {
 40321  
 40322  	// $db authorizer ?CALLBACK?
 40323  	//
 40324  	// Invoke the given callback to authorize each SQL operation as it is
 40325  	// compiled.  5 arguments are appended to the callback before it is
 40326  	// invoked:
 40327  	//
 40328  	//   (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...)
 40329  	//   (2) First descriptive name (depends on authorization type)
 40330  	//   (3) Second descriptive name
 40331  	//   (4) Name of the database (ex: "main", "temp")
 40332  	//   (5) Name of trigger that is doing the access
 40333  	//
 40334  	// The callback should return on of the following strings: SQLITE_OK,
 40335  	// SQLITE_IGNORE, or SQLITE_DENY.  Any other return value is an error.
 40336  	//
 40337  	// If this method is invoked with no arguments, the current authorization
 40338  	// callback string is returned.
 40339  	case uint32(0) /* DB_AUTHORIZER */ :
 40340  		goto __4
 40341  
 40342  	// $db backup ?DATABASE? FILENAME
 40343  	//
 40344  	// Open or create a database file named FILENAME.  Transfer the
 40345  	// content of local database DATABASE (default: "main") into the
 40346  	// FILENAME database.
 40347  	case uint32(1) /* DB_BACKUP */ :
 40348  		goto __5
 40349  
 40350  	// $db bind_fallback ?CALLBACK?
 40351  	//
 40352  	// When resolving bind parameters in an SQL statement, if the parameter
 40353  	// cannot be associated with a TCL variable then invoke CALLBACK with a
 40354  	// single argument that is the name of the parameter and use the return
 40355  	// value of the CALLBACK as the binding.  If CALLBACK returns something
 40356  	// other than TCL_OK or TCL_ERROR then bind a NULL.
 40357  	//
 40358  	// If CALLBACK is an empty string, then revert to the default behavior
 40359  	// which is to set the binding to NULL.
 40360  	//
 40361  	// If CALLBACK returns an error, that causes the statement execution to
 40362  	// abort.  Hence, to configure a connection so that it throws an error
 40363  	// on an attempt to bind an unknown variable, do something like this:
 40364  	//
 40365  	//     proc bind_error {name} {error "no such variable: $name"}
 40366  	//     db bind_fallback bind_error
 40367  	case uint32(2) /* DB_BIND_FALLBACK */ :
 40368  		goto __6
 40369  
 40370  	// $db busy ?CALLBACK?
 40371  	//
 40372  	// Invoke the given callback if an SQL statement attempts to open
 40373  	// a locked database file.
 40374  	case uint32(3) /* DB_BUSY */ :
 40375  		goto __7
 40376  
 40377  	// $db cache flush
 40378  	//     $db cache size n
 40379  	//
 40380  	// Flush the prepared statement cache, or set the maximum number of
 40381  	// cached statements.
 40382  	case uint32(4) /* DB_CACHE */ :
 40383  		goto __8
 40384  
 40385  	// $db changes
 40386  	//
 40387  	// Return the number of rows that were modified, inserted, or deleted by
 40388  	// the most recent INSERT, UPDATE or DELETE statement, not including
 40389  	// any changes made by trigger programs.
 40390  	case uint32(5) /* DB_CHANGES */ :
 40391  		goto __9
 40392  
 40393  	// $db close
 40394  	//
 40395  	// Shutdown the database
 40396  	case uint32(6) /* DB_CLOSE */ :
 40397  		goto __10
 40398  
 40399  	//     $db collate NAME SCRIPT
 40400  	//
 40401  	// Create a new SQL collation function called NAME.  Whenever
 40402  	// that function is called, invoke SCRIPT to evaluate the function.
 40403  	case uint32(7) /* DB_COLLATE */ :
 40404  		goto __11
 40405  
 40406  	//     $db collation_needed SCRIPT
 40407  	//
 40408  	// Create a new SQL collation function called NAME.  Whenever
 40409  	// that function is called, invoke SCRIPT to evaluate the function.
 40410  	case uint32(8) /* DB_COLLATION_NEEDED */ :
 40411  		goto __12
 40412  
 40413  	// $db commit_hook ?CALLBACK?
 40414  	//
 40415  	// Invoke the given callback just before committing every SQL transaction.
 40416  	// If the callback throws an exception or returns non-zero, then the
 40417  	// transaction is aborted.  If CALLBACK is an empty string, the callback
 40418  	// is disabled.
 40419  	case uint32(9) /* DB_COMMIT_HOOK */ :
 40420  		goto __13
 40421  
 40422  	// $db complete SQL
 40423  	//
 40424  	// Return TRUE if SQL is a complete SQL statement.  Return FALSE if
 40425  	// additional lines of input are needed.  This is similar to the
 40426  	// built-in "info complete" command of Tcl.
 40427  	case uint32(10) /* DB_COMPLETE */ :
 40428  		goto __14
 40429  
 40430  	// $db config ?OPTION? ?BOOLEAN?
 40431  	//
 40432  	// Configure the database connection using the sqlite3_db_config()
 40433  	// interface.
 40434  	case uint32(11) /* DB_CONFIG */ :
 40435  		goto __15
 40436  
 40437  	// $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
 40438  	//
 40439  	// Copy data into table from filename, optionally using SEPARATOR
 40440  	// as column separators.  If a column contains a null string, or the
 40441  	// value of NULLINDICATOR, a NULL is inserted for the column.
 40442  	// conflict-algorithm is one of the sqlite conflict algorithms:
 40443  	//    rollback, abort, fail, ignore, replace
 40444  	// On success, return the number of lines processed, not necessarily same
 40445  	// as 'db changes' due to conflict-algorithm selected.
 40446  	//
 40447  	// This code is basically an implementation/enhancement of
 40448  	// the sqlite3 shell.c ".import" command.
 40449  	//
 40450  	// This command usage is equivalent to the sqlite2.x COPY statement,
 40451  	// which imports file data into a table using the PostgreSQL COPY file format:
 40452  	//   $db copy $conflit_algo $table_name $filename \t \\N
 40453  	case uint32(12) /* DB_COPY */ :
 40454  		goto __16
 40455  
 40456  	//     $db deserialize ?-maxsize N? ?-readonly BOOL? ?DATABASE? VALUE
 40457  	//
 40458  	// Reopen DATABASE (default "main") using the content in $VALUE
 40459  	case uint32(13) /* DB_DESERIALIZE */ :
 40460  		goto __17
 40461  
 40462  	//    $db enable_load_extension BOOLEAN
 40463  	//
 40464  	// Turn the extension loading feature on or off.  It if off by
 40465  	// default.
 40466  	case uint32(14) /* DB_ENABLE_LOAD_EXTENSION */ :
 40467  		goto __18
 40468  
 40469  	//    $db errorcode
 40470  	//
 40471  	// Return the numeric error code that was returned by the most recent
 40472  	// call to sqlite3_exec().
 40473  	case uint32(15) /* DB_ERRORCODE */ :
 40474  		goto __19
 40475  
 40476  	//    $db exists $sql
 40477  	//    $db onecolumn $sql
 40478  	//
 40479  	// The onecolumn method is the equivalent of:
 40480  	//     lindex [$db eval $sql] 0
 40481  	case uint32(17) /* DB_EXISTS */ :
 40482  		goto __20
 40483  	case uint32(23) /* DB_ONECOLUMN */ :
 40484  		goto __21
 40485  
 40486  	//    $db eval ?options? $sql ?array? ?{  ...code... }?
 40487  	//
 40488  	// The SQL statement in $sql is evaluated.  For each row, the values are
 40489  	// placed in elements of the array named "array" and ...code... is executed.
 40490  	// If "array" and "code" are omitted, then no callback is every invoked.
 40491  	// If "array" is an empty string, then the values are placed in variables
 40492  	// that have the same name as the fields extracted by the query.
 40493  	case uint32(16) /* DB_EVAL */ :
 40494  		goto __22
 40495  
 40496  	//     $db function NAME [OPTIONS] SCRIPT
 40497  	//
 40498  	// Create a new SQL function called NAME.  Whenever that function is
 40499  	// called, invoke SCRIPT to evaluate the function.
 40500  	//
 40501  	// Options:
 40502  	//         --argcount N           Function has exactly N arguments
 40503  	//         --deterministic        The function is pure
 40504  	//         --directonly           Prohibit use inside triggers and views
 40505  	//         --innocuous            Has no side effects or information leaks
 40506  	//         --returntype TYPE      Specify the return type of the function
 40507  	case uint32(18) /* DB_FUNCTION */ :
 40508  		goto __23
 40509  
 40510  	//     $db incrblob ?-readonly? ?DB? TABLE COLUMN ROWID
 40511  	case uint32(19) /* DB_INCRBLOB */ :
 40512  		goto __24
 40513  
 40514  	//     $db interrupt
 40515  	//
 40516  	// Interrupt the execution of the inner-most SQL interpreter.  This
 40517  	// causes the SQL statement to return an error of SQLITE_INTERRUPT.
 40518  	case uint32(20) /* DB_INTERRUPT */ :
 40519  		goto __25
 40520  
 40521  	//     $db nullvalue ?STRING?
 40522  	//
 40523  	// Change text used when a NULL comes back from the database. If ?STRING?
 40524  	// is not present, then the current string used for NULL is returned.
 40525  	// If STRING is present, then STRING is returned.
 40526  	//
 40527  	case uint32(22) /* DB_NULLVALUE */ :
 40528  		goto __26
 40529  
 40530  	//     $db last_insert_rowid
 40531  	//
 40532  	// Return an integer which is the ROWID for the most recent insert.
 40533  	case uint32(21) /* DB_LAST_INSERT_ROWID */ :
 40534  		goto __27
 40535  
 40536  	// The DB_ONECOLUMN method is implemented together with DB_EXISTS.
 40537  
 40538  	// $db progress ?N CALLBACK?
 40539  	//
 40540  	// Invoke the given callback every N virtual machine opcodes while executing
 40541  	// queries.
 40542  	case uint32(26) /* DB_PROGRESS */ :
 40543  		goto __28
 40544  
 40545  	// $db profile ?CALLBACK?
 40546  	//
 40547  	// Make arrangements to invoke the CALLBACK routine after each SQL statement
 40548  	// that has run.  The text of the SQL and the amount of elapse time are
 40549  	// appended to CALLBACK before the script is run.
 40550  	case uint32(25) /* DB_PROFILE */ :
 40551  		goto __29
 40552  
 40553  	//     $db rekey KEY
 40554  	//
 40555  	// Change the encryption key on the currently open database.
 40556  	case uint32(27) /* DB_REKEY */ :
 40557  		goto __30
 40558  
 40559  	// $db restore ?DATABASE? FILENAME
 40560  	//
 40561  	// Open a database file named FILENAME.  Transfer the content
 40562  	// of FILENAME into the local database DATABASE (default: "main").
 40563  	case uint32(28) /* DB_RESTORE */ :
 40564  		goto __31
 40565  
 40566  	//     $db serialize ?DATABASE?
 40567  	//
 40568  	// Return a serialization of a database.
 40569  	case uint32(30) /* DB_SERIALIZE */ :
 40570  		goto __32
 40571  
 40572  	//     $db status (step|sort|autoindex|vmstep)
 40573  	//
 40574  	// Display SQLITE_STMTSTATUS_FULLSCAN_STEP or
 40575  	// SQLITE_STMTSTATUS_SORT for the most recent eval.
 40576  	case uint32(31) /* DB_STATUS */ :
 40577  		goto __33
 40578  
 40579  	//     $db timeout MILLESECONDS
 40580  	//
 40581  	// Delay for the number of milliseconds specified when a file is locked.
 40582  	case uint32(32) /* DB_TIMEOUT */ :
 40583  		goto __34
 40584  
 40585  	//     $db total_changes
 40586  	//
 40587  	// Return the number of rows that were modified, inserted, or deleted
 40588  	// since the database handle was created.
 40589  	case uint32(33) /* DB_TOTAL_CHANGES */ :
 40590  		goto __35
 40591  
 40592  	// $db trace ?CALLBACK?
 40593  	//
 40594  	// Make arrangements to invoke the CALLBACK routine for each SQL statement
 40595  	// that is executed.  The text of the SQL is appended to CALLBACK before
 40596  	// it is executed.
 40597  	case uint32(34) /* DB_TRACE */ :
 40598  		goto __36
 40599  
 40600  	// $db trace_v2 ?CALLBACK? ?MASK?
 40601  	//
 40602  	// Make arrangements to invoke the CALLBACK routine for each trace event
 40603  	// matching the mask that is generated.  The parameters are appended to
 40604  	// CALLBACK before it is executed.
 40605  	case uint32(35) /* DB_TRACE_V2 */ :
 40606  		goto __37
 40607  
 40608  	// $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 40609  	//
 40610  	// Start a new transaction (if we are not already in the midst of a
 40611  	// transaction) and execute the TCL script SCRIPT.  After SCRIPT
 40612  	// completes, either commit the transaction or roll it back if SCRIPT
 40613  	// throws an exception.  Or if no new transation was started, do nothing.
 40614  	// pass the exception on up the stack.
 40615  	//
 40616  	// This command was inspired by Dave Thomas's talk on Ruby at the
 40617  	// 2005 O'Reilly Open Source Convention (OSCON).
 40618  	case uint32(36) /* DB_TRANSACTION */ :
 40619  		goto __38
 40620  
 40621  	//    $db unlock_notify ?script?
 40622  	case uint32(37) /* DB_UNLOCK_NOTIFY */ :
 40623  		goto __39
 40624  
 40625  	//    $db preupdate_hook count
 40626  	//    $db preupdate_hook hook ?SCRIPT?
 40627  	//    $db preupdate_hook new INDEX
 40628  	//    $db preupdate_hook old INDEX
 40629  	case uint32(24) /* DB_PREUPDATE */ :
 40630  		goto __40
 40631  
 40632  	//    $db wal_hook ?script?
 40633  	//    $db update_hook ?script?
 40634  	//    $db rollback_hook ?script?
 40635  	case uint32(40) /* DB_WAL_HOOK */ :
 40636  		goto __41
 40637  	case uint32(38) /* DB_UPDATE_HOOK */ :
 40638  		goto __42
 40639  	case uint32(29) /* DB_ROLLBACK_HOOK */ :
 40640  		goto __43
 40641  
 40642  	// $db version
 40643  	//
 40644  	// Return the version string for this database.
 40645  	case uint32(39) /* DB_VERSION */ :
 40646  		goto __44
 40647  	}
 40648  	goto __3
 40649  
 40650  	// $db authorizer ?CALLBACK?
 40651  	//
 40652  	// Invoke the given callback to authorize each SQL operation as it is
 40653  	// compiled.  5 arguments are appended to the callback before it is
 40654  	// invoked:
 40655  	//
 40656  	//   (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...)
 40657  	//   (2) First descriptive name (depends on authorization type)
 40658  	//   (3) Second descriptive name
 40659  	//   (4) Name of the database (ex: "main", "temp")
 40660  	//   (5) Name of trigger that is doing the access
 40661  	//
 40662  	// The callback should return on of the following strings: SQLITE_OK,
 40663  	// SQLITE_IGNORE, or SQLITE_DENY.  Any other return value is an error.
 40664  	//
 40665  	// If this method is invoked with no arguments, the current authorization
 40666  	// callback string is returned.
 40667  __4:
 40668  	if !(objc > 3) {
 40669  		goto __45
 40670  	}
 40671  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 40672  	return TCL_ERROR
 40673  	goto __46
 40674  __45:
 40675  	if !(objc == 2) {
 40676  		goto __47
 40677  	}
 40678  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 40679  		goto __49
 40680  	}
 40681  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, uintptr(0)))
 40682  __49:
 40683  	;
 40684  	goto __48
 40685  __47:
 40686  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 40687  		goto __50
 40688  	}
 40689  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth)
 40690  __50:
 40691  	;
 40692  	zAuth = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1020 /* &len */)
 40693  	if !((zAuth != 0) && (*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) > 0)) {
 40694  		goto __51
 40695  	}
 40696  	(*SqliteDb)(unsafe.Pointer(pDb)).FzAuth = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) + 1)))
 40697  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzAuth, zAuth, (uint32(*(*int32)(unsafe.Pointer(bp + 1020 /* len */)) + 1)))
 40698  	goto __52
 40699  __51:
 40700  	(*SqliteDb)(unsafe.Pointer(pDb)).FzAuth = uintptr(0)
 40701  __52:
 40702  	;
 40703  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzAuth != 0) {
 40704  		goto __53
 40705  	}
 40706  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40707  	sqlite3.Xsqlite3_set_authorizer(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 40708  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr, uintptr) int32
 40709  	}{auth_callback})), pDb)
 40710  	goto __54
 40711  __53:
 40712  	sqlite3.Xsqlite3_set_authorizer(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 40713  __54:
 40714  	;
 40715  __48:
 40716  	;
 40717  __46:
 40718  	;
 40719  	goto __3
 40720  
 40721  	// $db backup ?DATABASE? FILENAME
 40722  	//
 40723  	// Open or create a database file named FILENAME.  Transfer the
 40724  	// content of local database DATABASE (default: "main") into the
 40725  	// FILENAME database.
 40726  __5:
 40727  
 40728  	if !(objc == 3) {
 40729  		goto __55
 40730  	}
 40731  	zSrcDb = ts + 85 /* "main" */
 40732  	zDestFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 40733  	goto __56
 40734  __55:
 40735  	if !(objc == 4) {
 40736  		goto __57
 40737  	}
 40738  	zSrcDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 40739  	zDestFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 40740  	goto __58
 40741  __57:
 40742  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12179 /* "?DATABASE? FILEN..." */)
 40743  	return TCL_ERROR
 40744  __58:
 40745  	;
 40746  __56:
 40747  	;
 40748  	rc = sqlite3.Xsqlite3_open_v2(tls, zDestFile, bp+1024, /* &pDest */
 40749  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | (*SqliteDb)(unsafe.Pointer(pDb)).FopenFlags), uintptr(0))
 40750  	if !(rc != SQLITE_OK) {
 40751  		goto __59
 40752  	}
 40753  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+12199, /* "cannot open targ..." */
 40754  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 40755  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 40756  	return TCL_ERROR
 40757  __59:
 40758  	;
 40759  	pBackup = sqlite3.Xsqlite3_backup_init(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)), ts+85 /* "main" */, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSrcDb)
 40760  	if !(pBackup == uintptr(0)) {
 40761  		goto __60
 40762  	}
 40763  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+12229, /* "backup failed: " */
 40764  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 40765  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 40766  	return TCL_ERROR
 40767  __60:
 40768  	;
 40769  __61:
 40770  	if !((libc.AssignInt32(&rc, sqlite3.Xsqlite3_backup_step(tls, pBackup, 100))) == SQLITE_OK) {
 40771  		goto __62
 40772  	}
 40773  	goto __61
 40774  __62:
 40775  	;
 40776  	sqlite3.Xsqlite3_backup_finish(tls, pBackup)
 40777  	if !(rc == SQLITE_DONE) {
 40778  		goto __63
 40779  	}
 40780  	rc = TCL_OK
 40781  	goto __64
 40782  __63:
 40783  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, ts+12229, /* "backup failed: " */
 40784  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */))), uintptr(0)))
 40785  	rc = TCL_ERROR
 40786  __64:
 40787  	;
 40788  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1024 /* pDest */)))
 40789  	goto __3
 40790  
 40791  	// $db bind_fallback ?CALLBACK?
 40792  	//
 40793  	// When resolving bind parameters in an SQL statement, if the parameter
 40794  	// cannot be associated with a TCL variable then invoke CALLBACK with a
 40795  	// single argument that is the name of the parameter and use the return
 40796  	// value of the CALLBACK as the binding.  If CALLBACK returns something
 40797  	// other than TCL_OK or TCL_ERROR then bind a NULL.
 40798  	//
 40799  	// If CALLBACK is an empty string, then revert to the default behavior
 40800  	// which is to set the binding to NULL.
 40801  	//
 40802  	// If CALLBACK returns an error, that causes the statement execution to
 40803  	// abort.  Hence, to configure a connection so that it throws an error
 40804  	// on an attempt to bind an unknown variable, do something like this:
 40805  	//
 40806  	//     proc bind_error {name} {error "no such variable: $name"}
 40807  	//     db bind_fallback bind_error
 40808  __6:
 40809  	if !(objc > 3) {
 40810  		goto __65
 40811  	}
 40812  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 40813  	return TCL_ERROR
 40814  	goto __66
 40815  __65:
 40816  	if !(objc == 2) {
 40817  		goto __67
 40818  	}
 40819  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0) {
 40820  		goto __69
 40821  	}
 40822  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+88, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, uintptr(0)))
 40823  __69:
 40824  	;
 40825  	goto __68
 40826  __67:
 40827  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback != 0) {
 40828  		goto __70
 40829  	}
 40830  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback)
 40831  __70:
 40832  	;
 40833  	zCallback = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1028 /* &len1 */)
 40834  	if !((zCallback != 0) && (*(*int32)(unsafe.Pointer(bp + 1028 /* len1 */)) > 0)) {
 40835  		goto __71
 40836  	}
 40837  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1028 /* len1 */)) + 1)))
 40838  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback, zCallback, (uint32(*(*int32)(unsafe.Pointer(bp + 1028 /* len1 */)) + 1)))
 40839  	goto __72
 40840  __71:
 40841  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBindFallback = uintptr(0)
 40842  __72:
 40843  	;
 40844  __68:
 40845  	;
 40846  __66:
 40847  	;
 40848  	goto __3
 40849  
 40850  	// $db busy ?CALLBACK?
 40851  	//
 40852  	// Invoke the given callback if an SQL statement attempts to open
 40853  	// a locked database file.
 40854  __7:
 40855  	if !(objc > 3) {
 40856  		goto __73
 40857  	}
 40858  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12245 /* "CALLBACK" */)
 40859  	return TCL_ERROR
 40860  	goto __74
 40861  __73:
 40862  	if !(objc == 2) {
 40863  		goto __75
 40864  	}
 40865  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 40866  		goto __77
 40867  	}
 40868  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+104, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy, uintptr(0)))
 40869  __77:
 40870  	;
 40871  	goto __76
 40872  __75:
 40873  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 40874  		goto __78
 40875  	}
 40876  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy)
 40877  __78:
 40878  	;
 40879  	zBusy = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1032 /* &len2 */)
 40880  	if !((zBusy != 0) && (*(*int32)(unsafe.Pointer(bp + 1032 /* len2 */)) > 0)) {
 40881  		goto __79
 40882  	}
 40883  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBusy = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1032 /* len2 */)) + 1)))
 40884  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzBusy, zBusy, (uint32(*(*int32)(unsafe.Pointer(bp + 1032 /* len2 */)) + 1)))
 40885  	goto __80
 40886  __79:
 40887  	(*SqliteDb)(unsafe.Pointer(pDb)).FzBusy = uintptr(0)
 40888  __80:
 40889  	;
 40890  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzBusy != 0) {
 40891  		goto __81
 40892  	}
 40893  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 40894  	sqlite3.Xsqlite3_busy_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 40895  		f func(*libc.TLS, uintptr, int32) int32
 40896  	}{DbBusyHandler})), pDb)
 40897  	goto __82
 40898  __81:
 40899  	sqlite3.Xsqlite3_busy_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 40900  __82:
 40901  	;
 40902  __76:
 40903  	;
 40904  __74:
 40905  	;
 40906  	goto __3
 40907  
 40908  	// $db cache flush
 40909  	//     $db cache size n
 40910  	//
 40911  	// Flush the prepared statement cache, or set the maximum number of
 40912  	// cached statements.
 40913  __8:
 40914  
 40915  	if !(objc <= 2) {
 40916  		goto __83
 40917  	}
 40918  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+12254 /* "cache option ?ar..." */)
 40919  	return TCL_ERROR
 40920  __83:
 40921  	;
 40922  	subCmd = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0))
 40923  	if !((int32(*(*int8)(unsafe.Pointer(subCmd))) == 'f') && (libc.Xstrcmp(tls, subCmd, ts+12273 /* "flush" */) == 0)) {
 40924  		goto __84
 40925  	}
 40926  	if !(objc != 3) {
 40927  		goto __86
 40928  	}
 40929  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12273 /* "flush" */)
 40930  	return TCL_ERROR
 40931  	goto __87
 40932  __86:
 40933  	flushStmtCache(tls, pDb)
 40934  __87:
 40935  	;
 40936  	goto __85
 40937  __84:
 40938  	if !((int32(*(*int8)(unsafe.Pointer(subCmd))) == 's') && (libc.Xstrcmp(tls, subCmd, ts+12279 /* "size" */) == 0)) {
 40939  		goto __88
 40940  	}
 40941  	if !(objc != 4) {
 40942  		goto __90
 40943  	}
 40944  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12284 /* "size n" */)
 40945  	return TCL_ERROR
 40946  	goto __91
 40947  __90:
 40948  	if !(TCL_ERROR == tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1036 /* &n */)) {
 40949  		goto __92
 40950  	}
 40951  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+120, ts+12291, /* "cannot convert \"" */
 40952  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), uintptr(0)), ts+12308 /* "\" to integer" */, uintptr(0)))
 40953  	return TCL_ERROR
 40954  	goto __93
 40955  __92:
 40956  	if !(*(*int32)(unsafe.Pointer(bp + 1036 /* n */)) < 0) {
 40957  		goto __94
 40958  	}
 40959  	flushStmtCache(tls, pDb)
 40960  	*(*int32)(unsafe.Pointer(bp + 1036 /* n */)) = 0
 40961  	goto __95
 40962  __94:
 40963  	if !(*(*int32)(unsafe.Pointer(bp + 1036 /* n */)) > MAX_PREPARED_STMTS) {
 40964  		goto __96
 40965  	}
 40966  	*(*int32)(unsafe.Pointer(bp + 1036 /* n */)) = MAX_PREPARED_STMTS
 40967  __96:
 40968  	;
 40969  __95:
 40970  	;
 40971  	(*SqliteDb)(unsafe.Pointer(pDb)).FmaxStmt = *(*int32)(unsafe.Pointer(bp + 1036 /* n */))
 40972  __93:
 40973  	;
 40974  __91:
 40975  	;
 40976  	goto __89
 40977  __88:
 40978  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+152, ts+12321, /* "bad option \"" */
 40979  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0)), ts+12334, /* "\": must be flush..." */
 40980  		uintptr(0)))
 40981  	return TCL_ERROR
 40982  __89:
 40983  	;
 40984  __85:
 40985  	;
 40986  	goto __3
 40987  
 40988  	// $db changes
 40989  	//
 40990  	// Return the number of rows that were modified, inserted, or deleted by
 40991  	// the most recent INSERT, UPDATE or DELETE statement, not including
 40992  	// any changes made by trigger programs.
 40993  __9:
 40994  	if !(objc != 2) {
 40995  		goto __97
 40996  	}
 40997  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 40998  	return TCL_ERROR
 40999  __97:
 41000  	;
 41001  	pResult = tcl.XTcl_GetObjResult(tls, interp)
 41002  	tcl.XTcl_SetIntObj(tls, pResult, sqlite3.Xsqlite3_changes(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 41003  	goto __3
 41004  
 41005  	// $db close
 41006  	//
 41007  	// Shutdown the database
 41008  __10:
 41009  	tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)))
 41010  	goto __3
 41011  
 41012  	//     $db collate NAME SCRIPT
 41013  	//
 41014  	// Create a new SQL collation function called NAME.  Whenever
 41015  	// that function is called, invoke SCRIPT to evaluate the function.
 41016  __11:
 41017  	if !(objc != 4) {
 41018  		goto __98
 41019  	}
 41020  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12359 /* "NAME SCRIPT" */)
 41021  	return TCL_ERROR
 41022  __98:
 41023  	;
 41024  	zName = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0))
 41025  	zScript = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1040 /* &nScript */)
 41026  	pCollate = tcl.XTcl_Alloc(tls, ((uint32(unsafe.Sizeof(SqlCollate{})) + uint32(*(*int32)(unsafe.Pointer(bp + 1040 /* nScript */)))) + uint32(1)))
 41027  	if !(pCollate == uintptr(0)) {
 41028  		goto __99
 41029  	}
 41030  	return TCL_ERROR
 41031  __99:
 41032  	;
 41033  	(*SqlCollate)(unsafe.Pointer(pCollate)).Finterp = interp
 41034  	(*SqlCollate)(unsafe.Pointer(pCollate)).FpNext = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollate
 41035  	(*SqlCollate)(unsafe.Pointer(pCollate)).FzScript = (pCollate + 1*12)
 41036  	(*SqliteDb)(unsafe.Pointer(pDb)).FpCollate = pCollate
 41037  	libc.Xmemcpy(tls, (*SqlCollate)(unsafe.Pointer(pCollate)).FzScript, zScript, (uint32(*(*int32)(unsafe.Pointer(bp + 1040 /* nScript */)) + 1)))
 41038  	if !(sqlite3.Xsqlite3_create_collation(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zName, SQLITE_UTF8,
 41039  		pCollate, *(*uintptr)(unsafe.Pointer(&struct {
 41040  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 41041  		}{tclSqlCollate}))) != 0) {
 41042  		goto __100
 41043  	}
 41044  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 41045  	return TCL_ERROR
 41046  __100:
 41047  	;
 41048  	goto __3
 41049  
 41050  	//     $db collation_needed SCRIPT
 41051  	//
 41052  	// Create a new SQL collation function called NAME.  Whenever
 41053  	// that function is called, invoke SCRIPT to evaluate the function.
 41054  __12:
 41055  	if !(objc != 3) {
 41056  		goto __101
 41057  	}
 41058  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10650 /* "SCRIPT" */)
 41059  	return TCL_ERROR
 41060  __101:
 41061  	;
 41062  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded != 0) {
 41063  		goto __102
 41064  	}
 41065  __103:
 41066  	_objPtr = (*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded
 41067  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1) {
 41068  		goto __106
 41069  	}
 41070  	tcl.XTclFreeObj(tls, _objPtr)
 41071  __106:
 41072  	;
 41073  	goto __104
 41074  __104:
 41075  	if 0 != 0 {
 41076  		goto __103
 41077  	}
 41078  	goto __105
 41079  __105:
 41080  	;
 41081  __102:
 41082  	;
 41083  	(*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 41084  	(*Tcl_Obj)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FpCollateNeeded)).FrefCount++
 41085  	sqlite3.Xsqlite3_collation_needed(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, pDb, *(*uintptr)(unsafe.Pointer(&struct {
 41086  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr)
 41087  	}{tclCollateNeeded})))
 41088  	goto __3
 41089  
 41090  	// $db commit_hook ?CALLBACK?
 41091  	//
 41092  	// Invoke the given callback just before committing every SQL transaction.
 41093  	// If the callback throws an exception or returns non-zero, then the
 41094  	// transaction is aborted.  If CALLBACK is an empty string, the callback
 41095  	// is disabled.
 41096  __13:
 41097  	if !(objc > 3) {
 41098  		goto __107
 41099  	}
 41100  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 41101  	return TCL_ERROR
 41102  	goto __108
 41103  __107:
 41104  	if !(objc == 2) {
 41105  		goto __109
 41106  	}
 41107  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 41108  		goto __111
 41109  	}
 41110  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+184, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit, uintptr(0)))
 41111  __111:
 41112  	;
 41113  	goto __110
 41114  __109:
 41115  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 41116  		goto __112
 41117  	}
 41118  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit)
 41119  __112:
 41120  	;
 41121  	zCommit = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1044 /* &len3 */)
 41122  	if !((zCommit != 0) && (*(*int32)(unsafe.Pointer(bp + 1044 /* len3 */)) > 0)) {
 41123  		goto __113
 41124  	}
 41125  	(*SqliteDb)(unsafe.Pointer(pDb)).FzCommit = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1044 /* len3 */)) + 1)))
 41126  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzCommit, zCommit, (uint32(*(*int32)(unsafe.Pointer(bp + 1044 /* len3 */)) + 1)))
 41127  	goto __114
 41128  __113:
 41129  	(*SqliteDb)(unsafe.Pointer(pDb)).FzCommit = uintptr(0)
 41130  __114:
 41131  	;
 41132  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzCommit != 0) {
 41133  		goto __115
 41134  	}
 41135  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 41136  	sqlite3.Xsqlite3_commit_hook(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 41137  		f func(*libc.TLS, uintptr) int32
 41138  	}{DbCommitHandler})), pDb)
 41139  	goto __116
 41140  __115:
 41141  	sqlite3.Xsqlite3_commit_hook(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 41142  __116:
 41143  	;
 41144  __110:
 41145  	;
 41146  __108:
 41147  	;
 41148  	goto __3
 41149  
 41150  	// $db complete SQL
 41151  	//
 41152  	// Return TRUE if SQL is a complete SQL statement.  Return FALSE if
 41153  	// additional lines of input are needed.  This is similar to the
 41154  	// built-in "info complete" command of Tcl.
 41155  __14:
 41156  	if !(objc != 3) {
 41157  		goto __117
 41158  	}
 41159  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10170 /* "SQL" */)
 41160  	return TCL_ERROR
 41161  __117:
 41162  	;
 41163  	isComplete = sqlite3.Xsqlite3_complete(tls, tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0)))
 41164  	pResult1 = tcl.XTcl_GetObjResult(tls, interp)
 41165  	tcl.XTcl_SetIntObj(tls, pResult1, (libc.Bool32((isComplete) != 0)))
 41166  	goto __3
 41167  
 41168  	// $db config ?OPTION? ?BOOLEAN?
 41169  	//
 41170  	// Configure the database connection using the sqlite3_db_config()
 41171  	// interface.
 41172  __15:
 41173  	if !(objc > 4) {
 41174  		goto __118
 41175  	}
 41176  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12371 /* "?OPTION? ?BOOLEA..." */)
 41177  	return TCL_ERROR
 41178  __118:
 41179  	;
 41180  	if !(objc == 2) {
 41181  		goto __119
 41182  	}
 41183  	// With no arguments, list all configuration options and with the
 41184  	// current value
 41185  	pResult2 = tcl.XTcl_NewListObj(tls, 0, uintptr(0))
 41186  	ii = 0
 41187  __121:
 41188  	if !(uint32(ii) < (uint32(unsafe.Sizeof(aDbConfig)) / uint32(unsafe.Sizeof(DbConfigChoices{})))) {
 41189  		goto __123
 41190  	}
 41191  	*(*int32)(unsafe.Pointer(bp + 1048 /* v */)) = 0
 41192  	sqlite3.Xsqlite3_db_config(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, aDbConfig[ii].Fop, libc.VaList(bp+200, -1, bp+1048 /* &v */))
 41193  	tcl.XTcl_ListObjAppendElement(tls, interp, pResult2,
 41194  		tcl.XTcl_NewStringObj(tls, aDbConfig[ii].FzName, -1))
 41195  	tcl.XTcl_ListObjAppendElement(tls, interp, pResult2,
 41196  		tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 1048 /* v */))))
 41197  	goto __122
 41198  __122:
 41199  	ii++
 41200  	goto __121
 41201  	goto __123
 41202  __123:
 41203  	;
 41204  	goto __120
 41205  __119:
 41206  	zOpt = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 41207  	*(*int32)(unsafe.Pointer(bp + 1052 /* onoff */)) = -1
 41208  	*(*int32)(unsafe.Pointer(bp + 1056 /* v1 */)) = 0
 41209  	if !(int32(*(*int8)(unsafe.Pointer(zOpt))) == '-') {
 41210  		goto __124
 41211  	}
 41212  	zOpt++
 41213  __124:
 41214  	;
 41215  	ii = 0
 41216  __125:
 41217  	if !(uint32(ii) < (uint32(unsafe.Sizeof(aDbConfig)) / uint32(unsafe.Sizeof(DbConfigChoices{})))) {
 41218  		goto __127
 41219  	}
 41220  	if !(libc.Xstrcmp(tls, aDbConfig[ii].FzName, zOpt) == 0) {
 41221  		goto __128
 41222  	}
 41223  	goto __127
 41224  __128:
 41225  	;
 41226  	goto __126
 41227  __126:
 41228  	ii++
 41229  	goto __125
 41230  	goto __127
 41231  __127:
 41232  	;
 41233  	if !(uint32(ii) >= (uint32(unsafe.Sizeof(aDbConfig)) / uint32(unsafe.Sizeof(DbConfigChoices{})))) {
 41234  		goto __129
 41235  	}
 41236  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+216, ts+12390 /* "unknown config o..." */, zOpt,
 41237  		ts+12415 /* "\"" */, uintptr(0)))
 41238  	return TCL_ERROR
 41239  __129:
 41240  	;
 41241  	if !(objc == 4) {
 41242  		goto __130
 41243  	}
 41244  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1052 /* &onoff */) != 0) {
 41245  		goto __131
 41246  	}
 41247  	return TCL_ERROR
 41248  __131:
 41249  	;
 41250  __130:
 41251  	;
 41252  	sqlite3.Xsqlite3_db_config(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, aDbConfig[ii].Fop, libc.VaList(bp+248, *(*int32)(unsafe.Pointer(bp + 1052 /* onoff */)), bp+1056 /* &v1 */))
 41253  	pResult2 = tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 1056 /* v1 */)))
 41254  __120:
 41255  	;
 41256  	tcl.XTcl_SetObjResult(tls, interp, pResult2)
 41257  	goto __3
 41258  
 41259  	// $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
 41260  	//
 41261  	// Copy data into table from filename, optionally using SEPARATOR
 41262  	// as column separators.  If a column contains a null string, or the
 41263  	// value of NULLINDICATOR, a NULL is inserted for the column.
 41264  	// conflict-algorithm is one of the sqlite conflict algorithms:
 41265  	//    rollback, abort, fail, ignore, replace
 41266  	// On success, return the number of lines processed, not necessarily same
 41267  	// as 'db changes' due to conflict-algorithm selected.
 41268  	//
 41269  	// This code is basically an implementation/enhancement of
 41270  	// the sqlite3 shell.c ".import" command.
 41271  	//
 41272  	// This command usage is equivalent to the sqlite2.x COPY statement,
 41273  	// which imports file data into a table using the PostgreSQL COPY file format:
 41274  	//   $db copy $conflit_algo $table_name $filename \t \\N
 41275  __16: // The input file
 41276  	lineno = 0
 41277  	if !((objc < 5) || (objc > 7)) {
 41278  		goto __132
 41279  	}
 41280  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv,
 41281  		ts+12417 /* "CONFLICT-ALGORIT..." */)
 41282  	return TCL_ERROR
 41283  __132:
 41284  	;
 41285  	if !(objc >= 6) {
 41286  		goto __133
 41287  	}
 41288  	zSep = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 5*4)), uintptr(0))
 41289  	goto __134
 41290  __133:
 41291  	zSep = ts + 12479 /* "\t" */
 41292  __134:
 41293  	;
 41294  	if !(objc >= 7) {
 41295  		goto __135
 41296  	}
 41297  	zNull = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 6*4)), uintptr(0))
 41298  	goto __136
 41299  __135:
 41300  	zNull = ts + 489 /* "" */
 41301  __136:
 41302  	;
 41303  	zConflict = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0))
 41304  	zTable = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), uintptr(0))
 41305  	zFile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0))
 41306  	nSep = strlen30(tls, zSep)
 41307  	nNull = strlen30(tls, zNull)
 41308  	if !(nSep == 0) {
 41309  		goto __137
 41310  	}
 41311  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+264, ts+12481, /* "Error: non-null ..." */
 41312  		uintptr(0)))
 41313  	return TCL_ERROR
 41314  __137:
 41315  	;
 41316  	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)) {
 41317  		goto __138
 41318  	}
 41319  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+280, ts+12560 /* "Error: \"" */, zConflict,
 41320  
 41321  		ts+12569 /* "\", conflict-algo..." */, uintptr(0)))
 41322  	return TCL_ERROR
 41323  __138:
 41324  	;
 41325  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+12649 /* "SELECT * FROM '%..." */, libc.VaList(bp+312, zTable))
 41326  	if !(zSql == uintptr(0)) {
 41327  		goto __139
 41328  	}
 41329  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+320, ts+12668 /* "Error: no such t..." */, zTable, uintptr(0)))
 41330  	return TCL_ERROR
 41331  __139:
 41332  	;
 41333  	nByte = strlen30(tls, zSql)
 41334  	rc = sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, bp+1060 /* &pStmt */, uintptr(0))
 41335  	sqlite3.Xsqlite3_free(tls, zSql)
 41336  	if !(rc != 0) {
 41337  		goto __140
 41338  	}
 41339  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+344, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 41340  	nCol = 0
 41341  	goto __141
 41342  __140:
 41343  	nCol = sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41344  __141:
 41345  	;
 41346  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41347  	if !(nCol == 0) {
 41348  		goto __142
 41349  	}
 41350  	return TCL_ERROR
 41351  __142:
 41352  	;
 41353  	zSql = libc.Xmalloc(tls, (uint32((nByte + 50) + (nCol * 2))))
 41354  	if !(zSql == uintptr(0)) {
 41355  		goto __143
 41356  	}
 41357  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+368, ts+12699 /* "Error: can't mal..." */, uintptr(0)))
 41358  	return TCL_ERROR
 41359  __143:
 41360  	;
 41361  	sqlite3.Xsqlite3_snprintf(tls, (nByte + 50), zSql, ts+12721, /* "INSERT OR %q INT..." */
 41362  		libc.VaList(bp+384, zConflict, zTable))
 41363  	j = strlen30(tls, zSql)
 41364  	i = 1
 41365  __144:
 41366  	if !(i < nCol) {
 41367  		goto __146
 41368  	}
 41369  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8(',')
 41370  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8('?')
 41371  	goto __145
 41372  __145:
 41373  	i++
 41374  	goto __144
 41375  	goto __146
 41376  __146:
 41377  	;
 41378  	*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = int8(')')
 41379  	*(*int8)(unsafe.Pointer(zSql + uintptr(j))) = int8(0)
 41380  	rc = sqlite3.Xsqlite3_prepare(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSql, -1, bp+1060 /* &pStmt */, uintptr(0))
 41381  	libc.Xfree(tls, zSql)
 41382  	if !(rc != 0) {
 41383  		goto __147
 41384  	}
 41385  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+400, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 41386  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41387  	return TCL_ERROR
 41388  __147:
 41389  	;
 41390  	in = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 41391  	if !(in == uintptr(0)) {
 41392  		goto __148
 41393  	}
 41394  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+424, ts+12753 /* "Error: cannot op..." */, zFile, uintptr(0)))
 41395  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41396  	return TCL_ERROR
 41397  __148:
 41398  	;
 41399  	azCol = libc.Xmalloc(tls, (uint32(unsafe.Sizeof(uintptr(0))) * (uint32(nCol + 1))))
 41400  	if !(azCol == uintptr(0)) {
 41401  		goto __149
 41402  	}
 41403  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+448, ts+12699 /* "Error: can't mal..." */, uintptr(0)))
 41404  	libc.Xfclose(tls, in)
 41405  	return TCL_ERROR
 41406  __149:
 41407  	;
 41408  	sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, ts+12779 /* "BEGIN" */, uintptr(0), uintptr(0), uintptr(0))
 41409  	zCommit1 = ts + 12098 /* "COMMIT" */
 41410  __150:
 41411  	if !((libc.AssignUintptr(&zLine, local_getline(tls, uintptr(0), in))) != uintptr(0)) {
 41412  		goto __151
 41413  	}
 41414  	lineno++
 41415  	*(*uintptr)(unsafe.Pointer(azCol)) = zLine
 41416  	i = 0
 41417  	z = zLine
 41418  __152:
 41419  	if !(*(*int8)(unsafe.Pointer(z)) != 0) {
 41420  		goto __154
 41421  	}
 41422  	if !((int32(*(*int8)(unsafe.Pointer(z))) == int32(*(*int8)(unsafe.Pointer(zSep)))) && (libc.Xstrncmp(tls, z, zSep, uint32(nSep)) == 0)) {
 41423  		goto __155
 41424  	}
 41425  	*(*int8)(unsafe.Pointer(z)) = int8(0)
 41426  	i++
 41427  	if !(i < nCol) {
 41428  		goto __156
 41429  	}
 41430  	*(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)) = (z + uintptr(nSep))
 41431  	z += (uintptr(nSep - 1))
 41432  __156:
 41433  	;
 41434  __155:
 41435  	;
 41436  	goto __153
 41437  __153:
 41438  	z++
 41439  	goto __152
 41440  	goto __154
 41441  __154:
 41442  	;
 41443  	if !((i + 1) != nCol) {
 41444  		goto __157
 41445  	}
 41446  	nErr = (strlen30(tls, zFile) + 200)
 41447  	zErr = libc.Xmalloc(tls, uint32(nErr))
 41448  	if !(zErr != 0) {
 41449  		goto __158
 41450  	}
 41451  	sqlite3.Xsqlite3_snprintf(tls, nErr, zErr,
 41452  		ts+12785, /* "Error: %s line %..." */
 41453  		libc.VaList(bp+464, zFile, lineno, nCol, (i+1)))
 41454  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+496, zErr, uintptr(0)))
 41455  	libc.Xfree(tls, zErr)
 41456  __158:
 41457  	;
 41458  	zCommit1 = ts + 7270 /* "ROLLBACK" */
 41459  	goto __151
 41460  __157:
 41461  	;
 41462  	i = 0
 41463  __159:
 41464  	if !(i < nCol) {
 41465  		goto __161
 41466  	}
 41467  	// check for null data, if so, bind as null
 41468  	if !(((nNull > 0) && (libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), zNull) == 0)) ||
 41469  		(strlen30(tls, *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4))) == 0)) {
 41470  		goto __162
 41471  	}
 41472  	sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)), (i + 1))
 41473  	goto __163
 41474  __162:
 41475  	sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)), (i + 1), *(*uintptr)(unsafe.Pointer(azCol + uintptr(i)*4)), -1, uintptr(0))
 41476  __163:
 41477  	;
 41478  	goto __160
 41479  __160:
 41480  	i++
 41481  	goto __159
 41482  	goto __161
 41483  __161:
 41484  	;
 41485  	sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41486  	rc = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41487  	libc.Xfree(tls, zLine)
 41488  	if !(rc != SQLITE_OK) {
 41489  		goto __164
 41490  	}
 41491  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+512, ts+12691 /* "Error: " */, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 41492  	zCommit1 = ts + 7270 /* "ROLLBACK" */
 41493  	goto __151
 41494  __164:
 41495  	;
 41496  	goto __150
 41497  __151:
 41498  	;
 41499  	libc.Xfree(tls, azCol)
 41500  	libc.Xfclose(tls, in)
 41501  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 1060 /* pStmt */)))
 41502  	sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zCommit1, uintptr(0), uintptr(0), uintptr(0))
 41503  
 41504  	if !(int32(*(*int8)(unsafe.Pointer(zCommit1))) == 'C') {
 41505  		goto __165
 41506  	}
 41507  	// success, set result as number of lines processed
 41508  	pResult3 = tcl.XTcl_GetObjResult(tls, interp)
 41509  	tcl.XTcl_SetIntObj(tls, pResult3, lineno)
 41510  	rc = TCL_OK
 41511  	goto __166
 41512  __165:
 41513  	// failure, append lineno where failed
 41514  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([80]int8{})), bp+1064 /* &zLineNum[0] */, ts+1238 /* "%d" */, libc.VaList(bp+536, lineno))
 41515  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+544, ts+12845 /* ", failed while p..." */, bp+1064, /* &zLineNum[0] */
 41516  		uintptr(0)))
 41517  	rc = TCL_ERROR
 41518  __166:
 41519  	;
 41520  	goto __3
 41521  
 41522  	//     $db deserialize ?-maxsize N? ?-readonly BOOL? ?DATABASE? VALUE
 41523  	//
 41524  	// Reopen DATABASE (default "main") using the content in $VALUE
 41525  __17:
 41526  	zSchema = uintptr(0)
 41527  	pValue = uintptr(0)
 41528  	*(*sqlite3_int64)(unsafe.Pointer(bp + 1144 /* mxSize */)) = int64(0)
 41529  	*(*int32)(unsafe.Pointer(bp + 1152 /* isReadonly */)) = 0
 41530  
 41531  	if !(objc < 3) {
 41532  		goto __167
 41533  	}
 41534  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12878 /* "?DATABASE? VALUE" */)
 41535  	rc = TCL_ERROR
 41536  	goto __3
 41537  __167:
 41538  	;
 41539  	i1 = 2
 41540  __168:
 41541  	if !(i1 < (objc - 1)) {
 41542  		goto __170
 41543  	}
 41544  	z1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i1)*4)))
 41545  	if !((libc.Xstrcmp(tls, z1, ts+12895 /* "-maxsize" */) == 0) && (i1 < (objc - 2))) {
 41546  		goto __171
 41547  	}
 41548  	rc = tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(libc.PreIncInt32(&i1, 1))*4)), bp+1144 /* &mxSize */)
 41549  	if !(rc != 0) {
 41550  		goto __172
 41551  	}
 41552  	goto deserialize_error
 41553  __172:
 41554  	;
 41555  	goto __169
 41556  __171:
 41557  	;
 41558  	if !((libc.Xstrcmp(tls, z1, ts+12904 /* "-readonly" */) == 0) && (i1 < (objc - 2))) {
 41559  		goto __173
 41560  	}
 41561  	rc = tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(libc.PreIncInt32(&i1, 1))*4)), bp+1152 /* &isReadonly */)
 41562  	if !(rc != 0) {
 41563  		goto __174
 41564  	}
 41565  	goto deserialize_error
 41566  __174:
 41567  	;
 41568  	goto __169
 41569  __173:
 41570  	;
 41571  	if !(((zSchema == uintptr(0)) && (i1 == (objc - 2))) && (int32(*(*int8)(unsafe.Pointer(z1))) != '-')) {
 41572  		goto __175
 41573  	}
 41574  	zSchema = z1
 41575  	goto __169
 41576  __175:
 41577  	;
 41578  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+568, ts+12914 /* "unknown option: " */, z1, uintptr(0)))
 41579  	rc = TCL_ERROR
 41580  	goto deserialize_error
 41581  	goto __169
 41582  __169:
 41583  	i1++
 41584  	goto __168
 41585  	goto __170
 41586  __170:
 41587  	;
 41588  	pValue = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4))
 41589  	pBA = tcl.XTcl_GetByteArrayFromObj(tls, pValue, bp+1156 /* &len4 */)
 41590  	pData = sqlite3.Xsqlite3_malloc64(tls, uint64(*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */))))
 41591  	if !((pData == uintptr(0)) && (*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */)) > 0)) {
 41592  		goto __176
 41593  	}
 41594  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+592, ts+1930 /* "out of memory" */, uintptr(0)))
 41595  	rc = TCL_ERROR
 41596  	goto __177
 41597  __176:
 41598  	if !(*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */)) > 0) {
 41599  		goto __178
 41600  	}
 41601  	libc.Xmemcpy(tls, pData, pBA, uint32(*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */))))
 41602  __178:
 41603  	;
 41604  	if !(*(*int32)(unsafe.Pointer(bp + 1152 /* isReadonly */)) != 0) {
 41605  		goto __179
 41606  	}
 41607  	flags = (SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_READONLY)
 41608  	goto __180
 41609  __179:
 41610  	flags = (SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_RESIZEABLE)
 41611  __180:
 41612  	;
 41613  	xrc = sqlite3.Xsqlite3_deserialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema, pData, int64(*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */))), int64(*(*int32)(unsafe.Pointer(bp + 1156 /* len4 */))), uint32(flags))
 41614  	if !(xrc != 0) {
 41615  		goto __181
 41616  	}
 41617  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+608, ts+12931 /* "unable to set ME..." */, uintptr(0)))
 41618  	rc = TCL_ERROR
 41619  __181:
 41620  	;
 41621  	if !(*(*sqlite3_int64)(unsafe.Pointer(bp + 1144 /* mxSize */)) > int64(0)) {
 41622  		goto __182
 41623  	}
 41624  	sqlite3.Xsqlite3_file_control(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema, SQLITE_FCNTL_SIZE_LIMIT, bp+1144 /* &mxSize */)
 41625  __182:
 41626  	;
 41627  __177:
 41628  	;
 41629  deserialize_error:
 41630  	goto __3
 41631  
 41632  	//    $db enable_load_extension BOOLEAN
 41633  	//
 41634  	// Turn the extension loading feature on or off.  It if off by
 41635  	// default.
 41636  __18:
 41637  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+624, ts+12959, /* "extension loadin..." */
 41638  		uintptr(0)))
 41639  	return TCL_ERROR
 41640  
 41641  	//    $db errorcode
 41642  	//
 41643  	// Return the numeric error code that was returned by the most recent
 41644  	// call to sqlite3_exec().
 41645  __19:
 41646  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)))
 41647  	goto __3
 41648  
 41649  	//    $db exists $sql
 41650  	//    $db onecolumn $sql
 41651  	//
 41652  	// The onecolumn method is the equivalent of:
 41653  	//     lindex [$db eval $sql] 0
 41654  __20:
 41655  __21:
 41656  	pResult4 = uintptr(0)
 41657  	if !(objc != 3) {
 41658  		goto __183
 41659  	}
 41660  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+10170 /* "SQL" */)
 41661  	return TCL_ERROR
 41662  __183:
 41663  	;
 41664  
 41665  	dbEvalInit(tls, bp+1160 /* &sEval */, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0), 0)
 41666  	rc = dbEvalStep(tls, bp+1160 /* &sEval */)
 41667  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 23 /* DB_ONECOLUMN */) {
 41668  		goto __184
 41669  	}
 41670  	if !(rc == TCL_OK) {
 41671  		goto __186
 41672  	}
 41673  	pResult4 = dbEvalColumnValue(tls, bp+1160 /* &sEval */, 0)
 41674  	goto __187
 41675  __186:
 41676  	if !(rc == TCL_BREAK) {
 41677  		goto __188
 41678  	}
 41679  	tcl.XTcl_ResetResult(tls, interp)
 41680  __188:
 41681  	;
 41682  __187:
 41683  	;
 41684  	goto __185
 41685  __184:
 41686  	if !((rc == TCL_BREAK) || (rc == TCL_OK)) {
 41687  		goto __189
 41688  	}
 41689  	pResult4 = tcl.XTcl_NewIntObj(tls, (libc.Bool32((libc.Bool32(rc == TCL_OK)) != 0)))
 41690  __189:
 41691  	;
 41692  __185:
 41693  	;
 41694  	dbEvalFinalize(tls, bp+1160 /* &sEval */)
 41695  	if !(pResult4 != 0) {
 41696  		goto __190
 41697  	}
 41698  	tcl.XTcl_SetObjResult(tls, interp, pResult4)
 41699  __190:
 41700  	;
 41701  
 41702  	if !(rc == TCL_BREAK) {
 41703  		goto __191
 41704  	}
 41705  	rc = TCL_OK
 41706  __191:
 41707  	;
 41708  	goto __3
 41709  
 41710  	//    $db eval ?options? $sql ?array? ?{  ...code... }?
 41711  	//
 41712  	// The SQL statement in $sql is evaluated.  For each row, the values are
 41713  	// placed in elements of the array named "array" and ...code... is executed.
 41714  	// If "array" and "code" are omitted, then no callback is every invoked.
 41715  	// If "array" is an empty string, then the values are placed in variables
 41716  	// that have the same name as the fields extracted by the query.
 41717  __22:
 41718  	evalFlags = 0
 41719  __192:
 41720  	if !(((objc > 3) && ((libc.AssignUintptr(&zOpt1, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))))) != uintptr(0))) && (int32(*(*int8)(unsafe.Pointer(zOpt1))) == '-')) {
 41721  		goto __193
 41722  	}
 41723  	if !(libc.Xstrcmp(tls, zOpt1, ts+13007 /* "-withoutnulls" */) == 0) {
 41724  		goto __194
 41725  	}
 41726  	evalFlags = evalFlags | (SQLITE_EVAL_WITHOUTNULLS)
 41727  	goto __195
 41728  __194:
 41729  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+640, ts+13021 /* "unknown option: ..." */, zOpt1, ts+12415 /* "\"" */, uintptr(0)))
 41730  	return TCL_ERROR
 41731  __195:
 41732  	;
 41733  	objc--
 41734  	objv += 4
 41735  	goto __192
 41736  __193:
 41737  	;
 41738  	if !((objc < 3) || (objc > 5)) {
 41739  		goto __196
 41740  	}
 41741  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv,
 41742  		ts+13039 /* "?OPTIONS? SQL ?A..." */)
 41743  	return TCL_ERROR
 41744  __196:
 41745  	;
 41746  
 41747  	if !(objc == 3) {
 41748  		goto __197
 41749  	}
 41750  	pRet = tcl.XTcl_NewObj(tls)
 41751  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 41752  	dbEvalInit(tls, bp+1192 /* &sEval1 */, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0), 0)
 41753  __199:
 41754  	if !(TCL_OK == (libc.AssignInt32(&rc, dbEvalStep(tls, bp+1192 /* &sEval1 */)))) {
 41755  		goto __200
 41756  	}
 41757  	dbEvalRowInfo(tls, bp+1192 /* &sEval1 */, bp+1224 /* &nCol1 */, uintptr(0))
 41758  	i2 = 0
 41759  __201:
 41760  	if !(i2 < *(*int32)(unsafe.Pointer(bp + 1224 /* nCol1 */))) {
 41761  		goto __203
 41762  	}
 41763  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, dbEvalColumnValue(tls, bp+1192 /* &sEval1 */, i2))
 41764  	goto __202
 41765  __202:
 41766  	i2++
 41767  	goto __201
 41768  	goto __203
 41769  __203:
 41770  	;
 41771  	goto __199
 41772  __200:
 41773  	;
 41774  	dbEvalFinalize(tls, bp+1192 /* &sEval1 */)
 41775  	if !(rc == TCL_BREAK) {
 41776  		goto __204
 41777  	}
 41778  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 41779  	rc = TCL_OK
 41780  __204:
 41781  	;
 41782  __205:
 41783  	_objPtr1 = pRet
 41784  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr1))).FrefCount, 1) <= 1) {
 41785  		goto __208
 41786  	}
 41787  	tcl.XTclFreeObj(tls, _objPtr1)
 41788  __208:
 41789  	;
 41790  	goto __206
 41791  __206:
 41792  	if 0 != 0 {
 41793  		goto __205
 41794  	}
 41795  	goto __207
 41796  __207:
 41797  	;
 41798  	goto __198
 41799  __197:
 41800  	pArray = uintptr(0)
 41801  
 41802  	if !((objc >= 5) && (*(*int8)(unsafe.Pointer(tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4))))) != 0)) {
 41803  		goto __209
 41804  	}
 41805  	pArray = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 41806  __209:
 41807  	;
 41808  	pScript = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4))
 41809  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 41810  
 41811  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(DbEvalContext{})))
 41812  	dbEvalInit(tls, p, pDb, *(*uintptr)(unsafe.Pointer(objv + 2*4)), pArray, evalFlags)
 41813  
 41814  	*(*ClientData)(unsafe.Pointer(bp + 1228 /* &cd2[0] */)) = p
 41815  	*(*ClientData)(unsafe.Pointer(bp + 1228 /* &cd2[0] */ + 1*4)) = pScript
 41816  	rc = DbEvalNextCmd(tls, bp+1228 /* &cd2[0] */, interp, TCL_OK)
 41817  __198:
 41818  	;
 41819  	goto __3
 41820  
 41821  	//     $db function NAME [OPTIONS] SCRIPT
 41822  	//
 41823  	// Create a new SQL function called NAME.  Whenever that function is
 41824  	// called, invoke SCRIPT to evaluate the function.
 41825  	//
 41826  	// Options:
 41827  	//         --argcount N           Function has exactly N arguments
 41828  	//         --deterministic        The function is pure
 41829  	//         --directonly           Prohibit use inside triggers and views
 41830  	//         --innocuous            Has no side effects or information leaks
 41831  	//         --returntype TYPE      Specify the return type of the function
 41832  __23:
 41833  	flags1 = SQLITE_UTF8
 41834  	*(*int32)(unsafe.Pointer(bp + 1236 /* nArg */)) = -1
 41835  	*(*int32)(unsafe.Pointer(bp + 1264 /* eType */)) = SQLITE_NULL
 41836  	if !(objc < 4) {
 41837  		goto __210
 41838  	}
 41839  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13075 /* "NAME ?SWITCHES? ..." */)
 41840  	return TCL_ERROR
 41841  __210:
 41842  	;
 41843  	i3 = 3
 41844  __211:
 41845  	if !(i3 < (objc - 1)) {
 41846  		goto __213
 41847  	}
 41848  	z2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i3)*4)))
 41849  	n1 = strlen30(tls, z2)
 41850  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13098 /* "-argcount" */, uint32(n1)) == 0)) {
 41851  		goto __214
 41852  	}
 41853  	if !(i3 == (objc - 2)) {
 41854  		goto __216
 41855  	}
 41856  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+672, ts+13108 /* "option requires ..." */, z2, uintptr(0)))
 41857  	return TCL_ERROR
 41858  __216:
 41859  	;
 41860  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i3+1))*4)), bp+1236 /* &nArg */) != 0) {
 41861  		goto __217
 41862  	}
 41863  	return TCL_ERROR
 41864  __217:
 41865  	;
 41866  	if !(*(*int32)(unsafe.Pointer(bp + 1236 /* nArg */)) < 0) {
 41867  		goto __218
 41868  	}
 41869  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+696, ts+13138, /* "number of argume..." */
 41870  		uintptr(0)))
 41871  	return TCL_ERROR
 41872  __218:
 41873  	;
 41874  	i3++
 41875  	goto __215
 41876  __214:
 41877  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13179 /* "-deterministic" */, uint32(n1)) == 0)) {
 41878  		goto __219
 41879  	}
 41880  	flags1 = flags1 | (SQLITE_DETERMINISTIC)
 41881  	goto __220
 41882  __219:
 41883  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13194 /* "-directonly" */, uint32(n1)) == 0)) {
 41884  		goto __221
 41885  	}
 41886  	flags1 = flags1 | (SQLITE_DIRECTONLY)
 41887  	goto __222
 41888  __221:
 41889  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13206 /* "-innocuous" */, uint32(n1)) == 0)) {
 41890  		goto __223
 41891  	}
 41892  	flags1 = flags1 | (SQLITE_INNOCUOUS)
 41893  	goto __224
 41894  __223:
 41895  	if !((n1 > 1) && (libc.Xstrncmp(tls, z2, ts+13217 /* "-returntype" */, uint32(n1)) == 0)) {
 41896  		goto __225
 41897  	}
 41898  	*(*[6]uintptr)(unsafe.Pointer(bp + 1240 /* azType */)) = [6]uintptr{ts + 7916 /* "integer" */, ts + 13229 /* "real" */, ts + 13234 /* "text" */, ts + 13239 /* "blob" */, ts + 13244 /* "any" */, uintptr(0)}
 41899  
 41900  	if !(i3 == (objc - 2)) {
 41901  		goto __227
 41902  	}
 41903  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+712, ts+13108 /* "option requires ..." */, z2, uintptr(0)))
 41904  	return TCL_ERROR
 41905  __227:
 41906  	;
 41907  	i3++
 41908  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i3)*4)), bp+1240 /* &azType[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+13248 /* "type" */, 0, bp+1264 /* &eType */) != 0) {
 41909  		goto __228
 41910  	}
 41911  	return TCL_ERROR
 41912  __228:
 41913  	;
 41914  	*(*int32)(unsafe.Pointer(bp + 1264 /* eType */))++
 41915  	goto __226
 41916  __225:
 41917  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+736, ts+12321 /* "bad option \"" */, z2,
 41918  
 41919  		ts+13253 /* "\": must be -argc..." */, uintptr(0)))
 41920  	return TCL_ERROR
 41921  __226:
 41922  	;
 41923  __224:
 41924  	;
 41925  __222:
 41926  	;
 41927  __220:
 41928  	;
 41929  __215:
 41930  	;
 41931  	goto __212
 41932  __212:
 41933  	i3++
 41934  	goto __211
 41935  	goto __213
 41936  __213:
 41937  	;
 41938  
 41939  	pScript1 = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4))
 41940  	zName1 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0))
 41941  	pFunc = findSqlFunc(tls, pDb, zName1)
 41942  	if !(pFunc == uintptr(0)) {
 41943  		goto __229
 41944  	}
 41945  	return TCL_ERROR
 41946  __229:
 41947  	;
 41948  	if !((*SqlFunc)(unsafe.Pointer(pFunc)).FpScript != 0) {
 41949  		goto __230
 41950  	}
 41951  __231:
 41952  	_objPtr2 = (*SqlFunc)(unsafe.Pointer(pFunc)).FpScript
 41953  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr2))).FrefCount, 1) <= 1) {
 41954  		goto __234
 41955  	}
 41956  	tcl.XTclFreeObj(tls, _objPtr2)
 41957  __234:
 41958  	;
 41959  	goto __232
 41960  __232:
 41961  	if 0 != 0 {
 41962  		goto __231
 41963  	}
 41964  	goto __233
 41965  __233:
 41966  	;
 41967  __230:
 41968  	;
 41969  	(*SqlFunc)(unsafe.Pointer(pFunc)).FpScript = pScript1
 41970  	(*Tcl_Obj)(unsafe.Pointer(pScript1)).FrefCount++
 41971  	(*SqlFunc)(unsafe.Pointer(pFunc)).FuseEvalObjv = safeToUseEvalObjv(tls, interp, pScript1)
 41972  	(*SqlFunc)(unsafe.Pointer(pFunc)).FeType = *(*int32)(unsafe.Pointer(bp + 1264 /* eType */))
 41973  	rc = sqlite3.Xsqlite3_create_function(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zName1, *(*int32)(unsafe.Pointer(bp + 1236 /* nArg */)), flags1,
 41974  		pFunc, *(*uintptr)(unsafe.Pointer(&struct {
 41975  			f func(*libc.TLS, uintptr, int32, uintptr)
 41976  		}{tclSqlFunc})), uintptr(0), uintptr(0))
 41977  	if !(rc != SQLITE_OK) {
 41978  		goto __235
 41979  	}
 41980  	rc = TCL_ERROR
 41981  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(1))
 41982  __235:
 41983  	;
 41984  	goto __3
 41985  
 41986  	//     $db incrblob ?-readonly? ?DB? TABLE COLUMN ROWID
 41987  __24:
 41988  	isReadonly1 = 0
 41989  	zDb = ts + 85 /* "main" */
 41990  
 41991  	// Check for the -readonly option
 41992  	if !((objc > 3) && (libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), ts+12904 /* "-readonly" */) == 0)) {
 41993  		goto __236
 41994  	}
 41995  	isReadonly1 = 1
 41996  __236:
 41997  	;
 41998  
 41999  	if !((objc != (5 + isReadonly1)) && (objc != (6 + isReadonly1))) {
 42000  		goto __237
 42001  	}
 42002  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13331 /* "?-readonly? ?DB?..." */)
 42003  	return TCL_ERROR
 42004  __237:
 42005  	;
 42006  
 42007  	if !(objc == (6 + isReadonly1)) {
 42008  		goto __238
 42009  	}
 42010  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 42011  __238:
 42012  	;
 42013  	zTable1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*4)))
 42014  	zColumn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4)))
 42015  	rc = tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4)), bp+1272 /* &iRow */)
 42016  
 42017  	if !(rc == TCL_OK) {
 42018  		goto __239
 42019  	}
 42020  	rc = createIncrblobChannel(tls,
 42021  		interp, pDb, zDb, zTable1, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 1272 /* iRow */)), isReadonly1)
 42022  __239:
 42023  	;
 42024  	goto __3
 42025  
 42026  	//     $db interrupt
 42027  	//
 42028  	// Interrupt the execution of the inner-most SQL interpreter.  This
 42029  	// causes the SQL statement to return an error of SQLITE_INTERRUPT.
 42030  __25:
 42031  	sqlite3.Xsqlite3_interrupt(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 42032  	goto __3
 42033  
 42034  	//     $db nullvalue ?STRING?
 42035  	//
 42036  	// Change text used when a NULL comes back from the database. If ?STRING?
 42037  	// is not present, then the current string used for NULL is returned.
 42038  	// If STRING is present, then STRING is returned.
 42039  	//
 42040  __26:
 42041  	if !((objc != 2) && (objc != 3)) {
 42042  		goto __240
 42043  	}
 42044  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13367 /* "NULLVALUE" */)
 42045  	return TCL_ERROR
 42046  __240:
 42047  	;
 42048  	if !(objc == 3) {
 42049  		goto __241
 42050  	}
 42051  	zNull1 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1280 /* &len5 */)
 42052  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzNull != 0) {
 42053  		goto __242
 42054  	}
 42055  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull)
 42056  __242:
 42057  	;
 42058  	if !((zNull1 != 0) && (*(*int32)(unsafe.Pointer(bp + 1280 /* len5 */)) > 0)) {
 42059  		goto __243
 42060  	}
 42061  	(*SqliteDb)(unsafe.Pointer(pDb)).FzNull = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1280 /* len5 */)) + 1)))
 42062  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull, zNull1, uint32(*(*int32)(unsafe.Pointer(bp + 1280 /* len5 */))))
 42063  	*(*int8)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FzNull + uintptr(*(*int32)(unsafe.Pointer(bp + 1280 /* len5 */))))) = int8(0)
 42064  	goto __244
 42065  __243:
 42066  	(*SqliteDb)(unsafe.Pointer(pDb)).FzNull = uintptr(0)
 42067  __244:
 42068  	;
 42069  __241:
 42070  	;
 42071  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzNull, -1))
 42072  	goto __3
 42073  
 42074  	//     $db last_insert_rowid
 42075  	//
 42076  	// Return an integer which is the ROWID for the most recent insert.
 42077  __27:
 42078  	if !(objc != 2) {
 42079  		goto __245
 42080  	}
 42081  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 42082  	return TCL_ERROR
 42083  __245:
 42084  	;
 42085  	rowid = sqlite3.Xsqlite3_last_insert_rowid(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 42086  	pResult5 = tcl.XTcl_GetObjResult(tls, interp)
 42087  	tcl.XTcl_SetWideIntObj(tls, pResult5, rowid)
 42088  	goto __3
 42089  
 42090  	// The DB_ONECOLUMN method is implemented together with DB_EXISTS.
 42091  
 42092  	// $db progress ?N CALLBACK?
 42093  	//
 42094  	// Invoke the given callback every N virtual machine opcodes while executing
 42095  	// queries.
 42096  __28:
 42097  	if !(objc == 2) {
 42098  		goto __246
 42099  	}
 42100  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 42101  		goto __248
 42102  	}
 42103  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+768, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress, uintptr(0)))
 42104  __248:
 42105  	;
 42106  	goto __247
 42107  __246:
 42108  	if !(objc == 4) {
 42109  		goto __249
 42110  	}
 42111  	if !(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1284 /* &N */)) {
 42112  		goto __251
 42113  	}
 42114  	return TCL_ERROR
 42115  __251:
 42116  	;
 42117  
 42118  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 42119  		goto __252
 42120  	}
 42121  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress)
 42122  __252:
 42123  	;
 42124  	zProgress = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1288 /* &len6 */)
 42125  	if !((zProgress != 0) && (*(*int32)(unsafe.Pointer(bp + 1288 /* len6 */)) > 0)) {
 42126  		goto __253
 42127  	}
 42128  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProgress = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1288 /* len6 */)) + 1)))
 42129  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProgress, zProgress, (uint32(*(*int32)(unsafe.Pointer(bp + 1288 /* len6 */)) + 1)))
 42130  	goto __254
 42131  __253:
 42132  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProgress = uintptr(0)
 42133  __254:
 42134  	;
 42135  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProgress != 0) {
 42136  		goto __255
 42137  	}
 42138  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 42139  	sqlite3.Xsqlite3_progress_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1284 /* N */)), *(*uintptr)(unsafe.Pointer(&struct {
 42140  		f func(*libc.TLS, uintptr) int32
 42141  	}{DbProgressHandler})), pDb)
 42142  	goto __256
 42143  __255:
 42144  	sqlite3.Xsqlite3_progress_handler(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, 0, uintptr(0), uintptr(0))
 42145  __256:
 42146  	;
 42147  	goto __250
 42148  __249:
 42149  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13377 /* "N CALLBACK" */)
 42150  	return TCL_ERROR
 42151  __250:
 42152  	;
 42153  __247:
 42154  	;
 42155  	goto __3
 42156  
 42157  	// $db profile ?CALLBACK?
 42158  	//
 42159  	// Make arrangements to invoke the CALLBACK routine after each SQL statement
 42160  	// that has run.  The text of the SQL and the amount of elapse time are
 42161  	// appended to CALLBACK before the script is run.
 42162  __29:
 42163  	if !(objc > 3) {
 42164  		goto __257
 42165  	}
 42166  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 42167  	return TCL_ERROR
 42168  	goto __258
 42169  __257:
 42170  	if !(objc == 2) {
 42171  		goto __259
 42172  	}
 42173  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 42174  		goto __261
 42175  	}
 42176  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+784, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, uintptr(0)))
 42177  __261:
 42178  	;
 42179  	goto __260
 42180  __259:
 42181  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 42182  		goto __262
 42183  	}
 42184  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile)
 42185  __262:
 42186  	;
 42187  	zProfile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1292 /* &len7 */)
 42188  	if !((zProfile != 0) && (*(*int32)(unsafe.Pointer(bp + 1292 /* len7 */)) > 0)) {
 42189  		goto __263
 42190  	}
 42191  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProfile = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1292 /* len7 */)) + 1)))
 42192  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzProfile, zProfile, (uint32(*(*int32)(unsafe.Pointer(bp + 1292 /* len7 */)) + 1)))
 42193  	goto __264
 42194  __263:
 42195  	(*SqliteDb)(unsafe.Pointer(pDb)).FzProfile = uintptr(0)
 42196  __264:
 42197  	;
 42198  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzProfile != 0) {
 42199  		goto __265
 42200  	}
 42201  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 42202  	sqlite3.Xsqlite3_profile(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 42203  		f func(*libc.TLS, uintptr, uintptr, sqlite_uint64)
 42204  	}{DbProfileHandler})), pDb)
 42205  	goto __266
 42206  __265:
 42207  	sqlite3.Xsqlite3_profile(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 42208  __266:
 42209  	;
 42210  __260:
 42211  	;
 42212  __258:
 42213  	;
 42214  	goto __3
 42215  
 42216  	//     $db rekey KEY
 42217  	//
 42218  	// Change the encryption key on the currently open database.
 42219  __30:
 42220  	if !(objc != 3) {
 42221  		goto __267
 42222  	}
 42223  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13388 /* "KEY" */)
 42224  	return TCL_ERROR
 42225  __267:
 42226  	;
 42227  	goto __3
 42228  
 42229  	// $db restore ?DATABASE? FILENAME
 42230  	//
 42231  	// Open a database file named FILENAME.  Transfer the content
 42232  	// of FILENAME into the local database DATABASE (default: "main").
 42233  __31:
 42234  	nTimeout = 0
 42235  
 42236  	if !(objc == 3) {
 42237  		goto __268
 42238  	}
 42239  	zDestDb = ts + 85 /* "main" */
 42240  	zSrcFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 42241  	goto __269
 42242  __268:
 42243  	if !(objc == 4) {
 42244  		goto __270
 42245  	}
 42246  	zDestDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 42247  	zSrcFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 42248  	goto __271
 42249  __270:
 42250  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12179 /* "?DATABASE? FILEN..." */)
 42251  	return TCL_ERROR
 42252  __271:
 42253  	;
 42254  __269:
 42255  	;
 42256  	rc = sqlite3.Xsqlite3_open_v2(tls, zSrcFile, bp+1296, /* &pSrc */
 42257  		(SQLITE_OPEN_READONLY | (*SqliteDb)(unsafe.Pointer(pDb)).FopenFlags), uintptr(0))
 42258  	if !(rc != SQLITE_OK) {
 42259  		goto __272
 42260  	}
 42261  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+800, ts+13392, /* "cannot open sour..." */
 42262  		sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 1296 /* pSrc */))), uintptr(0)))
 42263  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1296 /* pSrc */)))
 42264  	return TCL_ERROR
 42265  __272:
 42266  	;
 42267  	pBackup1 = sqlite3.Xsqlite3_backup_init(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zDestDb, *(*uintptr)(unsafe.Pointer(bp + 1296 /* pSrc */)), ts+85 /* "main" */)
 42268  	if !(pBackup1 == uintptr(0)) {
 42269  		goto __273
 42270  	}
 42271  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+824, ts+13422, /* "restore failed: " */
 42272  		sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 42273  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1296 /* pSrc */)))
 42274  	return TCL_ERROR
 42275  __273:
 42276  	;
 42277  __274:
 42278  	if !(((libc.AssignInt32(&rc, sqlite3.Xsqlite3_backup_step(tls, pBackup1, 100))) == SQLITE_OK) ||
 42279  		(rc == SQLITE_BUSY)) {
 42280  		goto __275
 42281  	}
 42282  	if !(rc == SQLITE_BUSY) {
 42283  		goto __276
 42284  	}
 42285  	if !(libc.PostIncInt32(&nTimeout, 1) >= 3) {
 42286  		goto __277
 42287  	}
 42288  	goto __275
 42289  __277:
 42290  	;
 42291  	sqlite3.Xsqlite3_sleep(tls, 100)
 42292  __276:
 42293  	;
 42294  	goto __274
 42295  __275:
 42296  	;
 42297  	sqlite3.Xsqlite3_backup_finish(tls, pBackup1)
 42298  	if !(rc == SQLITE_DONE) {
 42299  		goto __278
 42300  	}
 42301  	rc = TCL_OK
 42302  	goto __279
 42303  __278:
 42304  	if !((rc == SQLITE_BUSY) || (rc == SQLITE_LOCKED)) {
 42305  		goto __280
 42306  	}
 42307  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+848, ts+13439, /* "restore failed: ..." */
 42308  		uintptr(0)))
 42309  	rc = TCL_ERROR
 42310  	goto __281
 42311  __280:
 42312  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+864, ts+13422, /* "restore failed: " */
 42313  		sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 42314  	rc = TCL_ERROR
 42315  __281:
 42316  	;
 42317  __279:
 42318  	;
 42319  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 1296 /* pSrc */)))
 42320  	goto __3
 42321  
 42322  	//     $db serialize ?DATABASE?
 42323  	//
 42324  	// Return a serialization of a database.
 42325  __32:
 42326  	if objc >= 3 {
 42327  		zSchema1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 42328  	} else {
 42329  		zSchema1 = ts + 85 /* "main" */
 42330  	}
 42331  	*(*sqlite3_int64)(unsafe.Pointer(bp + 1304 /* sz */)) = int64(0)
 42332  	if !((objc != 2) && (objc != 3)) {
 42333  		goto __282
 42334  	}
 42335  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13476 /* "?DATABASE?" */)
 42336  	rc = TCL_ERROR
 42337  	goto __283
 42338  __282:
 42339  	pData1 = sqlite3.Xsqlite3_serialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema1, bp+1304 /* &sz */, uint32(SQLITE_SERIALIZE_NOCOPY))
 42340  	if !(pData1 != 0) {
 42341  		goto __284
 42342  	}
 42343  	needFree = 0
 42344  	goto __285
 42345  __284:
 42346  	pData1 = sqlite3.Xsqlite3_serialize(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zSchema1, bp+1304 /* &sz */, uint32(0))
 42347  	needFree = 1
 42348  __285:
 42349  	;
 42350  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, pData1, int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 1304 /* sz */)))))
 42351  	if !(needFree != 0) {
 42352  		goto __286
 42353  	}
 42354  	sqlite3.Xsqlite3_free(tls, pData1)
 42355  __286:
 42356  	;
 42357  __283:
 42358  	;
 42359  	goto __3
 42360  
 42361  	//     $db status (step|sort|autoindex|vmstep)
 42362  	//
 42363  	// Display SQLITE_STMTSTATUS_FULLSCAN_STEP or
 42364  	// SQLITE_STMTSTATUS_SORT for the most recent eval.
 42365  __33:
 42366  	if !(objc != 3) {
 42367  		goto __287
 42368  	}
 42369  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13487 /* "(step|sort|autoi..." */)
 42370  	return TCL_ERROR
 42371  __287:
 42372  	;
 42373  	zOp = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 42374  	if !(libc.Xstrcmp(tls, zOp, ts+10120 /* "step" */) == 0) {
 42375  		goto __288
 42376  	}
 42377  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnStep
 42378  	goto __289
 42379  __288:
 42380  	if !(libc.Xstrcmp(tls, zOp, ts+13509 /* "sort" */) == 0) {
 42381  		goto __290
 42382  	}
 42383  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnSort
 42384  	goto __291
 42385  __290:
 42386  	if !(libc.Xstrcmp(tls, zOp, ts+13514 /* "autoindex" */) == 0) {
 42387  		goto __292
 42388  	}
 42389  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnIndex
 42390  	goto __293
 42391  __292:
 42392  	if !(libc.Xstrcmp(tls, zOp, ts+13524 /* "vmstep" */) == 0) {
 42393  		goto __294
 42394  	}
 42395  	v2 = (*SqliteDb)(unsafe.Pointer(pDb)).FnVMStep
 42396  	goto __295
 42397  __294:
 42398  	tcl.XTcl_AppendResult(tls, interp,
 42399  		libc.VaList(bp+888, ts+13531, /* "bad argument: sh..." */
 42400  			uintptr(0)))
 42401  	return TCL_ERROR
 42402  __295:
 42403  	;
 42404  __293:
 42405  	;
 42406  __291:
 42407  	;
 42408  __289:
 42409  	;
 42410  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, v2))
 42411  	goto __3
 42412  
 42413  	//     $db timeout MILLESECONDS
 42414  	//
 42415  	// Delay for the number of milliseconds specified when a file is locked.
 42416  __34:
 42417  	if !(objc != 3) {
 42418  		goto __296
 42419  	}
 42420  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13587 /* "MILLISECONDS" */)
 42421  	return TCL_ERROR
 42422  __296:
 42423  	;
 42424  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1312 /* &ms */) != 0) {
 42425  		goto __297
 42426  	}
 42427  	return TCL_ERROR
 42428  __297:
 42429  	;
 42430  	sqlite3.Xsqlite3_busy_timeout(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1312 /* ms */)))
 42431  	goto __3
 42432  
 42433  	//     $db total_changes
 42434  	//
 42435  	// Return the number of rows that were modified, inserted, or deleted
 42436  	// since the database handle was created.
 42437  __35:
 42438  	if !(objc != 2) {
 42439  		goto __298
 42440  	}
 42441  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 42442  	return TCL_ERROR
 42443  __298:
 42444  	;
 42445  	pResult6 = tcl.XTcl_GetObjResult(tls, interp)
 42446  	tcl.XTcl_SetIntObj(tls, pResult6, sqlite3.Xsqlite3_total_changes(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 42447  	goto __3
 42448  
 42449  	// $db trace ?CALLBACK?
 42450  	//
 42451  	// Make arrangements to invoke the CALLBACK routine for each SQL statement
 42452  	// that is executed.  The text of the SQL is appended to CALLBACK before
 42453  	// it is executed.
 42454  __36:
 42455  	if !(objc > 3) {
 42456  		goto __299
 42457  	}
 42458  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+12168 /* "?CALLBACK?" */)
 42459  	return TCL_ERROR
 42460  	goto __300
 42461  __299:
 42462  	if !(objc == 2) {
 42463  		goto __301
 42464  	}
 42465  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 42466  		goto __303
 42467  	}
 42468  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+904, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, uintptr(0)))
 42469  __303:
 42470  	;
 42471  	goto __302
 42472  __301:
 42473  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 42474  		goto __304
 42475  	}
 42476  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace)
 42477  __304:
 42478  	;
 42479  	zTrace = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1316 /* &len8 */)
 42480  	if !((zTrace != 0) && (*(*int32)(unsafe.Pointer(bp + 1316 /* len8 */)) > 0)) {
 42481  		goto __305
 42482  	}
 42483  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTrace = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1316 /* len8 */)) + 1)))
 42484  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTrace, zTrace, (uint32(*(*int32)(unsafe.Pointer(bp + 1316 /* len8 */)) + 1)))
 42485  	goto __306
 42486  __305:
 42487  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTrace = uintptr(0)
 42488  __306:
 42489  	;
 42490  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTrace != 0) {
 42491  		goto __307
 42492  	}
 42493  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 42494  	sqlite3.Xsqlite3_trace(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 42495  		f func(*libc.TLS, uintptr, uintptr)
 42496  	}{DbTraceHandler})), pDb)
 42497  	goto __308
 42498  __307:
 42499  	sqlite3.Xsqlite3_trace(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uintptr(0), uintptr(0))
 42500  __308:
 42501  	;
 42502  __302:
 42503  	;
 42504  __300:
 42505  	;
 42506  	goto __3
 42507  
 42508  	// $db trace_v2 ?CALLBACK? ?MASK?
 42509  	//
 42510  	// Make arrangements to invoke the CALLBACK routine for each trace event
 42511  	// matching the mask that is generated.  The parameters are appended to
 42512  	// CALLBACK before it is executed.
 42513  __37:
 42514  	if !(objc > 4) {
 42515  		goto __309
 42516  	}
 42517  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13600 /* "?CALLBACK? ?MASK..." */)
 42518  	return TCL_ERROR
 42519  	goto __310
 42520  __309:
 42521  	if !(objc == 2) {
 42522  		goto __311
 42523  	}
 42524  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 42525  		goto __313
 42526  	}
 42527  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+920, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, uintptr(0)))
 42528  __313:
 42529  	;
 42530  	goto __312
 42531  __311:
 42532  	wMask = int64(0)
 42533  	if !(objc == 4) {
 42534  		goto __314
 42535  	}
 42536  	if !(TCL_OK != tcl.XTcl_ListObjLength(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1320 /* &len9 */)) {
 42537  		goto __316
 42538  	}
 42539  	return TCL_ERROR
 42540  __316:
 42541  	;
 42542  	i4 = 0
 42543  __317:
 42544  	if !(i4 < *(*int32)(unsafe.Pointer(bp + 1320 /* len9 */))) {
 42545  		goto __319
 42546  	}
 42547  	if !(TCL_OK != tcl.XTcl_ListObjIndex(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), i4, bp+1324 /* &pObj */)) {
 42548  		goto __320
 42549  	}
 42550  	return TCL_ERROR
 42551  __320:
 42552  	;
 42553  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 1324 /* pObj */)), uintptr(unsafe.Pointer(&TTYPE_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+13618 /* "trace type" */, 0, bp+1328 /* &ttype */) != TCL_OK) {
 42554  		goto __321
 42555  	}
 42556  	pError = tcl.XTcl_DuplicateObj(tls, tcl.XTcl_GetObjResult(tls, interp))
 42557  	(*Tcl_Obj)(unsafe.Pointer(pError)).FrefCount++
 42558  	if !(TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 1324 /* pObj */)), bp+1336 /* &wType */)) {
 42559  		goto __323
 42560  	}
 42561  __325:
 42562  	_objPtr3 = pError
 42563  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr3))).FrefCount, 1) <= 1) {
 42564  		goto __328
 42565  	}
 42566  	tcl.XTclFreeObj(tls, _objPtr3)
 42567  __328:
 42568  	;
 42569  	goto __326
 42570  __326:
 42571  	if 0 != 0 {
 42572  		goto __325
 42573  	}
 42574  	goto __327
 42575  __327:
 42576  	;
 42577  	wMask = wMask | (*(*Tcl_WideInt)(unsafe.Pointer(bp + 1336 /* wType */)))
 42578  	goto __324
 42579  __323:
 42580  	tcl.XTcl_SetObjResult(tls, interp, pError)
 42581  __329:
 42582  	_objPtr4 = pError
 42583  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr4))).FrefCount, 1) <= 1) {
 42584  		goto __332
 42585  	}
 42586  	tcl.XTclFreeObj(tls, _objPtr4)
 42587  __332:
 42588  	;
 42589  	goto __330
 42590  __330:
 42591  	if 0 != 0 {
 42592  		goto __329
 42593  	}
 42594  	goto __331
 42595  __331:
 42596  	;
 42597  	return TCL_ERROR
 42598  __324:
 42599  	;
 42600  	goto __322
 42601  __321:
 42602  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1328 /* ttype */))) {
 42603  	case uint32(0) /* TTYPE_STMT */ :
 42604  		goto __334
 42605  	case uint32(1) /* TTYPE_PROFILE */ :
 42606  		goto __335
 42607  	case uint32(2) /* TTYPE_ROW */ :
 42608  		goto __336
 42609  	case uint32(3) /* TTYPE_CLOSE */ :
 42610  		goto __337
 42611  	}
 42612  	goto __333
 42613  __334:
 42614  	wMask = wMask | (int64(SQLITE_TRACE_STMT))
 42615  	goto __333
 42616  __335:
 42617  	wMask = wMask | (int64(SQLITE_TRACE_PROFILE))
 42618  	goto __333
 42619  __336:
 42620  	wMask = wMask | (int64(SQLITE_TRACE_ROW))
 42621  	goto __333
 42622  __337:
 42623  	wMask = wMask | (int64(SQLITE_TRACE_CLOSE))
 42624  	goto __333
 42625  __333:
 42626  	;
 42627  __322:
 42628  	;
 42629  	goto __318
 42630  __318:
 42631  	i4++
 42632  	goto __317
 42633  	goto __319
 42634  __319:
 42635  	;
 42636  	goto __315
 42637  __314:
 42638  	wMask = int64(SQLITE_TRACE_STMT) // use the "legacy" default
 42639  __315:
 42640  	;
 42641  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 42642  		goto __338
 42643  	}
 42644  	tcl.XTcl_Free(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2)
 42645  __338:
 42646  	;
 42647  	zTraceV2 = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+1320 /* &len9 */)
 42648  	if !((zTraceV2 != 0) && (*(*int32)(unsafe.Pointer(bp + 1320 /* len9 */)) > 0)) {
 42649  		goto __339
 42650  	}
 42651  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 = tcl.XTcl_Alloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 1320 /* len9 */)) + 1)))
 42652  	libc.Xmemcpy(tls, (*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2, zTraceV2, (uint32(*(*int32)(unsafe.Pointer(bp + 1320 /* len9 */)) + 1)))
 42653  	goto __340
 42654  __339:
 42655  	(*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 = uintptr(0)
 42656  __340:
 42657  	;
 42658  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FzTraceV2 != 0) {
 42659  		goto __341
 42660  	}
 42661  	(*SqliteDb)(unsafe.Pointer(pDb)).Finterp = interp
 42662  	sqlite3.Xsqlite3_trace_v2(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uint32(wMask), *(*uintptr)(unsafe.Pointer(&struct {
 42663  		f func(*libc.TLS, uint32, uintptr, uintptr, uintptr) int32
 42664  	}{DbTraceV2Handler})), pDb)
 42665  	goto __342
 42666  __341:
 42667  	sqlite3.Xsqlite3_trace_v2(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, uint32(0), uintptr(0), uintptr(0))
 42668  __342:
 42669  	;
 42670  __312:
 42671  	;
 42672  __310:
 42673  	;
 42674  	goto __3
 42675  
 42676  	// $db transaction [-deferred|-immediate|-exclusive] SCRIPT
 42677  	//
 42678  	// Start a new transaction (if we are not already in the midst of a
 42679  	// transaction) and execute the TCL script SCRIPT.  After SCRIPT
 42680  	// completes, either commit the transaction or roll it back if SCRIPT
 42681  	// throws an exception.  Or if no new transation was started, do nothing.
 42682  	// pass the exception on up the stack.
 42683  	//
 42684  	// This command was inspired by Dave Thomas's talk on Ruby at the
 42685  	// 2005 O'Reilly Open Source Convention (OSCON).
 42686  __38:
 42687  	zBegin = ts + 13629 /* "SAVEPOINT _tcl_t..." */
 42688  	if !((objc != 3) && (objc != 4)) {
 42689  		goto __343
 42690  	}
 42691  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13656 /* "[TYPE] SCRIPT" */)
 42692  	return TCL_ERROR
 42693  __343:
 42694  	;
 42695  
 42696  	if !(((*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction == 0) && (objc == 4)) {
 42697  		goto __344
 42698  	}
 42699  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(unsafe.Pointer(&TTYPE_strs1)), int32(unsafe.Sizeof(uintptr(0))), ts+13670 /* "transaction type" */, 0, bp+1344 /* &ttype1 */) != 0) {
 42700  		goto __345
 42701  	}
 42702  	return TCL_ERROR
 42703  __345:
 42704  	;
 42705  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1344 /* ttype1 */))) {
 42706  	case uint32(0) /* TTYPE_DEFERRED */ :
 42707  		goto __347
 42708  	case uint32(1) /* TTYPE_EXCLUSIVE */ :
 42709  		goto __348
 42710  	case uint32(2) /* TTYPE_IMMEDIATE */ :
 42711  		goto __349
 42712  	}
 42713  	goto __346
 42714  __347: /* no-op */
 42715  	;
 42716  	goto __346
 42717  __348:
 42718  	zBegin = ts + 13687 /* "BEGIN EXCLUSIVE" */
 42719  	goto __346
 42720  __349:
 42721  	zBegin = ts + 13703 /* "BEGIN IMMEDIATE" */
 42722  	goto __346
 42723  __346:
 42724  	;
 42725  __344:
 42726  	;
 42727  	pScript2 = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4))
 42728  
 42729  	// Run the SQLite BEGIN command to open a transaction or savepoint.
 42730  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth++
 42731  	rc = sqlite3.Xsqlite3_exec(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, zBegin, uintptr(0), uintptr(0), uintptr(0))
 42732  	(*SqliteDb)(unsafe.Pointer(pDb)).FdisableAuth--
 42733  	if !(rc != SQLITE_OK) {
 42734  		goto __350
 42735  	}
 42736  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+936, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 42737  	return TCL_ERROR
 42738  __350:
 42739  	;
 42740  	(*SqliteDb)(unsafe.Pointer(pDb)).FnTransaction++
 42741  
 42742  	// If using NRE, schedule a callback to invoke the script pScript, then
 42743  	// a second callback to commit (or rollback) the transaction or savepoint
 42744  	// opened above. If not using NRE, evaluate the script directly, then
 42745  	// call function DbTransPostCmd() to commit (or rollback) the transaction
 42746  	// or savepoint.
 42747  	if !(DbUseNre(tls) != 0) {
 42748  		goto __351
 42749  	}
 42750  	tcl.XTcl_NRAddCallback(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 42751  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 42752  	}{DbTransPostCmd})), *(*uintptr)(unsafe.Pointer(bp + 1348 /* cd */)), uintptr(0), uintptr(0), uintptr(0))
 42753  	tcl.XTcl_NREvalObj(tls, interp, pScript2, 0)
 42754  	goto __352
 42755  __351:
 42756  	rc = DbTransPostCmd(tls, bp+1348 /* &cd */, interp, tcl.XTcl_EvalObjEx(tls, interp, pScript2, 0))
 42757  __352:
 42758  	;
 42759  	goto __3
 42760  
 42761  	//    $db unlock_notify ?script?
 42762  __39:
 42763  	if !((objc != 2) && (objc != 3)) {
 42764  		goto __353
 42765  	}
 42766  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 42767  	rc = TCL_ERROR
 42768  	goto __354
 42769  __353:
 42770  	xNotify = uintptr(0)
 42771  	pNotifyArg = uintptr(0)
 42772  
 42773  	if !((*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify != 0) {
 42774  		goto __355
 42775  	}
 42776  __356:
 42777  	_objPtr5 = (*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify
 42778  	if !(libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr5))).FrefCount, 1) <= 1) {
 42779  		goto __359
 42780  	}
 42781  	tcl.XTclFreeObj(tls, _objPtr5)
 42782  __359:
 42783  	;
 42784  	goto __357
 42785  __357:
 42786  	if 0 != 0 {
 42787  		goto __356
 42788  	}
 42789  	goto __358
 42790  __358:
 42791  	;
 42792  	(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = uintptr(0)
 42793  __355:
 42794  	;
 42795  
 42796  	if !(objc == 3) {
 42797  		goto __360
 42798  	}
 42799  	xNotify = *(*uintptr)(unsafe.Pointer(&struct {
 42800  		f func(*libc.TLS, uintptr, int32)
 42801  	}{DbUnlockNotify}))
 42802  	pNotifyArg = pDb
 42803  	(*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify = *(*uintptr)(unsafe.Pointer(objv + 2*4))
 42804  	(*Tcl_Obj)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FpUnlockNotify)).FrefCount++
 42805  __360:
 42806  	;
 42807  
 42808  	if !(sqlite3.Xsqlite3_unlock_notify(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, xNotify, pNotifyArg) != 0) {
 42809  		goto __361
 42810  	}
 42811  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+952, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 42812  	rc = TCL_ERROR
 42813  __361:
 42814  	;
 42815  __354:
 42816  	;
 42817  	goto __3
 42818  
 42819  	//    $db preupdate_hook count
 42820  	//    $db preupdate_hook hook ?SCRIPT?
 42821  	//    $db preupdate_hook new INDEX
 42822  	//    $db preupdate_hook old INDEX
 42823  __40:
 42824  
 42825  	if !(objc < 3) {
 42826  		goto __362
 42827  	}
 42828  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13728 /* "SUB-COMMAND ?ARG..." */)
 42829  __362:
 42830  	;
 42831  	if !(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(unsafe.Pointer(&azSub)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp+1352 /* &iSub */) != 0) {
 42832  		goto __363
 42833  	}
 42834  	return TCL_ERROR
 42835  __363:
 42836  	;
 42837  
 42838  	switch uint32(*(*int32)(unsafe.Pointer(bp + 1352 /* iSub */))) {
 42839  	case uint32(0) /* PRE_COUNT */ :
 42840  		goto __365
 42841  
 42842  	case uint32(2) /* PRE_HOOK */ :
 42843  		goto __366
 42844  
 42845  	case uint32(1) /* PRE_DEPTH */ :
 42846  		goto __367
 42847  
 42848  	case uint32(3) /* PRE_NEW */ :
 42849  		goto __368
 42850  	case uint32(4) /* PRE_OLD */ :
 42851  		goto __369
 42852  	}
 42853  	goto __364
 42854  __365:
 42855  	nCol2 = sqlite3.Xsqlite3_preupdate_count(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb)
 42856  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nCol2))
 42857  	goto __364
 42858  
 42859  __366:
 42860  	if !(objc > 4) {
 42861  		goto __370
 42862  	}
 42863  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13747 /* "hook ?SCRIPT?" */)
 42864  	return TCL_ERROR
 42865  __370:
 42866  	;
 42867  	DbHookCmd(tls, interp, pDb, func() uintptr {
 42868  		if objc == 4 {
 42869  			return *(*uintptr)(unsafe.Pointer(objv + 3*4))
 42870  		}
 42871  		return uintptr(0)
 42872  	}(), (pDb + 56 /* &.pPreUpdateHook */))
 42873  	goto __364
 42874  
 42875  __367:
 42876  	if !(objc != 3) {
 42877  		goto __371
 42878  	}
 42879  	tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+489 /* "" */)
 42880  	return TCL_ERROR
 42881  __371:
 42882  	;
 42883  	pRet1 = tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_preupdate_depth(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb))
 42884  	tcl.XTcl_SetObjResult(tls, interp, pRet1)
 42885  	goto __364
 42886  
 42887  __368:
 42888  __369:
 42889  	if !(objc != 4) {
 42890  		goto __372
 42891  	}
 42892  	tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+13761 /* "INDEX" */)
 42893  	return TCL_ERROR
 42894  __372:
 42895  	;
 42896  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+1356 /* &iIdx */) != 0) {
 42897  		goto __373
 42898  	}
 42899  	return TCL_ERROR
 42900  __373:
 42901  	;
 42902  
 42903  	if !(*(*int32)(unsafe.Pointer(bp + 1352 /* iSub */)) == 4 /* PRE_OLD */) {
 42904  		goto __374
 42905  	}
 42906  	rc = sqlite3.Xsqlite3_preupdate_old(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1356 /* iIdx */)), bp+1360 /* &pValue1 */)
 42907  	goto __375
 42908  __374:
 42909  	;
 42910  	rc = sqlite3.Xsqlite3_preupdate_new(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb, *(*int32)(unsafe.Pointer(bp + 1356 /* iIdx */)), bp+1360 /* &pValue1 */)
 42911  __375:
 42912  	;
 42913  
 42914  	if !(rc == SQLITE_OK) {
 42915  		goto __376
 42916  	}
 42917  	pObj1 = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(bp + 1360 /* pValue1 */))), -1)
 42918  	tcl.XTcl_SetObjResult(tls, interp, pObj1)
 42919  	goto __377
 42920  __376:
 42921  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+968, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(pDb)).Fdb), uintptr(0)))
 42922  	return TCL_ERROR
 42923  __377:
 42924  	;
 42925  
 42926  __364:
 42927  	;
 42928  	goto __3
 42929  
 42930  	//    $db wal_hook ?script?
 42931  	//    $db update_hook ?script?
 42932  	//    $db rollback_hook ?script?
 42933  __41:
 42934  __42:
 42935  __43:
 42936  	// set ppHook to point at pUpdateHook or pRollbackHook, depending on
 42937  	// whether [$db update_hook] or [$db rollback_hook] was invoked.
 42938  	ppHook = uintptr(0)
 42939  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 40 /* DB_WAL_HOOK */) {
 42940  		goto __378
 42941  	}
 42942  	ppHook = (pDb + 64 /* &.pWalHook */)
 42943  __378:
 42944  	;
 42945  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 38 /* DB_UPDATE_HOOK */) {
 42946  		goto __379
 42947  	}
 42948  	ppHook = (pDb + 52 /* &.pUpdateHook */)
 42949  __379:
 42950  	;
 42951  	if !(*(*int32)(unsafe.Pointer(bp + 1016 /* choice */)) == 29 /* DB_ROLLBACK_HOOK */) {
 42952  		goto __380
 42953  	}
 42954  	ppHook = (pDb + 60 /* &.pRollbackHook */)
 42955  __380:
 42956  	;
 42957  	if !(objc > 3) {
 42958  		goto __381
 42959  	}
 42960  	tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 42961  	return TCL_ERROR
 42962  __381:
 42963  	;
 42964  
 42965  	DbHookCmd(tls, interp, pDb, func() uintptr {
 42966  		if objc == 3 {
 42967  			return *(*uintptr)(unsafe.Pointer(objv + 2*4))
 42968  		}
 42969  		return uintptr(0)
 42970  	}(), ppHook)
 42971  	goto __3
 42972  
 42973  	// $db version
 42974  	//
 42975  	// Return the version string for this database.
 42976  __44:
 42977  	i5 = 2
 42978  __382:
 42979  	if !(i5 < objc) {
 42980  		goto __384
 42981  	}
 42982  	zArg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i5)*4)))
 42983  	// Optional arguments to $db version are used for testing purpose
 42984  	// $db version -use-legacy-prepare BOOLEAN
 42985  	//
 42986  	// Turn the use of legacy sqlite3_prepare() on or off.
 42987  	if !((libc.Xstrcmp(tls, zArg, ts+13767 /* "-use-legacy-prep..." */) == 0) && ((i5 + 1) < objc)) {
 42988  		goto __385
 42989  	}
 42990  	i5++
 42991  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i5)*4)), (pDb+128 /* &.bLegacyPrepare */)) != 0) {
 42992  		goto __387
 42993  	}
 42994  	return TCL_ERROR
 42995  __387:
 42996  	;
 42997  	goto __386
 42998  __385:
 42999  
 43000  	// $db version -last-stmt-ptr
 43001  	//
 43002  	// Return a string which is a hex encoding of the pointer to the
 43003  	// most recent sqlite3_stmt in the statement cache.
 43004  	if !(libc.Xstrcmp(tls, zArg, ts+13787 /* "-last-stmt-ptr" */) == 0) {
 43005  		goto __388
 43006  	}
 43007  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+1364 /* &zBuf[0] */, ts+13802, /* "%p" */
 43008  		libc.VaList(bp+984, func() uintptr {
 43009  			if (*SqliteDb)(unsafe.Pointer(pDb)).FstmtList != 0 {
 43010  				return (*SqlPreparedStmt)(unsafe.Pointer((*SqliteDb)(unsafe.Pointer(pDb)).FstmtList)).FpStmt
 43011  			}
 43012  			return uintptr(0)
 43013  		}()))
 43014  	tcl.XTcl_SetResult(tls, interp, bp+1364 /* &zBuf[0] */, uintptr(1))
 43015  	goto __389
 43016  __388:
 43017  
 43018  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+992, ts+13805 /* "unknown argument..." */, zArg, uintptr(0)))
 43019  	return TCL_ERROR
 43020  __389:
 43021  	;
 43022  __386:
 43023  	;
 43024  	goto __383
 43025  __383:
 43026  	i5++
 43027  	goto __382
 43028  	goto __384
 43029  __384:
 43030  	;
 43031  	if !(i5 == 2) {
 43032  		goto __390
 43033  	}
 43034  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_libversion(tls), uintptr(0))
 43035  __390:
 43036  	;
 43037  	goto __3
 43038  
 43039  __3:
 43040  	; // End of the SWITCH statement
 43041  	return rc
 43042  }
 43043  
 43044  type DbConfigChoices = struct {
 43045  	FzName uintptr
 43046  	Fop    int32
 43047  } /* tclsqlite.c:2340:18 */
 43048  
 43049  var DB_strs = [42]uintptr{
 43050  	ts + 13824 /* "authorizer" */, ts + 13835 /* "backup" */, ts + 13842, /* "bind_fallback" */
 43051  	ts + 13856 /* "busy" */, ts + 13861 /* "cache" */, ts + 13867, /* "changes" */
 43052  	ts + 10125 /* "close" */, ts + 13875 /* "collate" */, ts + 13883, /* "collation_needed" */
 43053  	ts + 13900 /* "commit_hook" */, ts + 13912 /* "complete" */, ts + 13921, /* "config" */
 43054  	ts + 13928 /* "copy" */, ts + 13933 /* "deserialize" */, ts + 13945, /* "enable_load_exte..." */
 43055  	ts + 13967 /* "errorcode" */, ts + 4757 /* "eval" */, ts + 13977, /* "exists" */
 43056  	ts + 13984 /* "function" */, ts + 11333 /* "incrblob" */, ts + 13993, /* "interrupt" */
 43057  	ts + 14003 /* "last_insert_rowi..." */, ts + 14021 /* "nullvalue" */, ts + 14031, /* "onecolumn" */
 43058  	ts + 14041 /* "preupdate" */, ts + 14051 /* "profile" */, ts + 10199, /* "progress" */
 43059  	ts + 14059 /* "rekey" */, ts + 14065 /* "restore" */, ts + 14073, /* "rollback_hook" */
 43060  	ts + 14087 /* "serialize" */, ts + 14097 /* "status" */, ts + 14104, /* "timeout" */
 43061  	ts + 14112 /* "total_changes" */, ts + 14126 /* "trace" */, ts + 14132, /* "trace_v2" */
 43062  	ts + 14141 /* "transaction" */, ts + 14153 /* "unlock_notify" */, ts + 14167, /* "update_hook" */
 43063  	ts + 14179 /* "version" */, ts + 14187 /* "wal_hook" */, uintptr(0),
 43064  } /* tclsqlite.c:1916:21 */
 43065  var aDbConfig = [16]DbConfigChoices{
 43066  	{FzName: ts + 14196 /* "defensive" */, Fop: SQLITE_DBCONFIG_DEFENSIVE},
 43067  	{FzName: ts + 14206 /* "dqs_ddl" */, Fop: SQLITE_DBCONFIG_DQS_DDL},
 43068  	{FzName: ts + 14214 /* "dqs_dml" */, Fop: SQLITE_DBCONFIG_DQS_DML},
 43069  	{FzName: ts + 14222 /* "enable_fkey" */, Fop: SQLITE_DBCONFIG_ENABLE_FKEY},
 43070  	{FzName: ts + 14234 /* "enable_qpsg" */, Fop: SQLITE_DBCONFIG_ENABLE_QPSG},
 43071  	{FzName: ts + 14246 /* "enable_trigger" */, Fop: SQLITE_DBCONFIG_ENABLE_TRIGGER},
 43072  	{FzName: ts + 14261 /* "enable_view" */, Fop: SQLITE_DBCONFIG_ENABLE_VIEW},
 43073  	{FzName: ts + 14273 /* "fts3_tokenizer" */, Fop: SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER},
 43074  	{FzName: ts + 14288 /* "legacy_alter_tab..." */, Fop: SQLITE_DBCONFIG_LEGACY_ALTER_TABLE},
 43075  	{FzName: ts + 14307 /* "legacy_file_form..." */, Fop: SQLITE_DBCONFIG_LEGACY_FILE_FORMAT},
 43076  	{FzName: ts + 14326 /* "load_extension" */, Fop: SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION},
 43077  	{FzName: ts + 14341 /* "no_ckpt_on_close" */, Fop: SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE},
 43078  	{FzName: ts + 14358 /* "reset_database" */, Fop: SQLITE_DBCONFIG_RESET_DATABASE},
 43079  	{FzName: ts + 14373 /* "trigger_eqp" */, Fop: SQLITE_DBCONFIG_TRIGGER_EQP},
 43080  	{FzName: ts + 14385 /* "trusted_schema" */, Fop: SQLITE_DBCONFIG_TRUSTED_SCHEMA},
 43081  	{FzName: ts + 14400 /* "writable_schema" */, Fop: SQLITE_DBCONFIG_WRITABLE_SCHEMA},
 43082  } /* tclsqlite.c:2343:7 */
 43083  var TTYPE_strs = [5]uintptr{
 43084  	ts + 14416 /* "statement" */, ts + 14051 /* "profile" */, ts + 14426 /* "row" */, ts + 10125 /* "close" */, uintptr(0),
 43085  } /* tclsqlite.c:3321:27 */
 43086  var TTYPE_strs1 = [4]uintptr{
 43087  	ts + 14430 /* "deferred" */, ts + 14439 /* "exclusive" */, ts + 14449 /* "immediate" */, uintptr(0),
 43088  }                                                                                                                                                              /* tclsqlite.c:3404:25 */
 43089  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 */
 43090  
 43091  // Adaptor that provides an objCmd interface to the NRE-enabled
 43092  // interface implementation.
 43093  func DbObjCmdAdaptor(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:3647:26: */
 43094  	return tcl.XTcl_NRCallObjProc(tls, interp, *(*uintptr)(unsafe.Pointer(&struct {
 43095  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43096  	}{DbObjCmd})), cd, objc, objv)
 43097  }
 43098  
 43099  // Issue the usage message when the "sqlite3" command arguments are
 43100  // incorrect.
 43101  func sqliteCmdUsage(tls *libc.TLS, interp uintptr, objv uintptr) int32 { /* tclsqlite.c:3661:12: */
 43102  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 43103  
 43104  		ts+14478 /* "HANDLE ?FILENAME..." */)
 43105  	return TCL_ERROR
 43106  }
 43107  
 43108  //   sqlite3 DBNAME FILENAME ?-vfs VFSNAME? ?-key KEY? ?-readonly BOOLEAN?
 43109  //                           ?-create BOOLEAN? ?-nomutex BOOLEAN?
 43110  //                           ?-nofollow BOOLEAN?
 43111  //
 43112  // This is the main Tcl command.  When the "sqlite" Tcl command is
 43113  // invoked, this routine runs to process that command.
 43114  //
 43115  // The first argument, DBNAME, is an arbitrary name for a new
 43116  // database connection.  This command creates a new command named
 43117  // DBNAME that is used to control that connection.  The database
 43118  // connection is deleted when the DBNAME command is deleted.
 43119  //
 43120  // The second argument is the name of the database file.
 43121  //
 43122  func DbMain(tls *libc.TLS, cd uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* tclsqlite.c:3689:26: */
 43123  	bp := tls.Alloc(328)
 43124  	defer tls.Free(328)
 43125  
 43126  	var p uintptr
 43127  	var zArg uintptr
 43128  	var zErrMsg uintptr
 43129  	var i int32
 43130  	var zFile uintptr = uintptr(0)
 43131  	var zVfs uintptr = uintptr(0)
 43132  	var flags int32
 43133  	*(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) = 1
 43134  	// var translatedFilename Tcl_DString at bp+116, 212
 43135  
 43136  	var rc int32
 43137  
 43138  	// In normal use, each TCL interpreter runs in a single thread.  So
 43139  	// by default, we can turn off mutexing on SQLite database connections.
 43140  	// However, for testing purposes it is useful to have mutexes turned
 43141  	// on.  So, by default, mutexes default off.  But if compiled with
 43142  	// SQLITE_TCL_DEFAULT_FULLMUTEX then mutexes default on.
 43143  	flags = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_NOMUTEX)
 43144  
 43145  	if objc == 1 {
 43146  		return sqliteCmdUsage(tls, interp, objv)
 43147  	}
 43148  	if objc == 2 {
 43149  		zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(0))
 43150  		if libc.Xstrcmp(tls, zArg, ts+14624 /* "-version" */) == 0 {
 43151  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_libversion(tls), uintptr(0)))
 43152  			return TCL_OK
 43153  		}
 43154  		if libc.Xstrcmp(tls, zArg, ts+14633 /* "-sourceid" */) == 0 {
 43155  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3_sourceid(tls), uintptr(0)))
 43156  			return TCL_OK
 43157  		}
 43158  		if libc.Xstrcmp(tls, zArg, ts+14643 /* "-has-codec" */) == 0 {
 43159  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+14654 /* "0" */, uintptr(0)))
 43160  			return TCL_OK
 43161  		}
 43162  		if int32(*(*int8)(unsafe.Pointer(zArg))) == '-' {
 43163  			return sqliteCmdUsage(tls, interp, objv)
 43164  		}
 43165  	}
 43166  	for i = 2; i < objc; i++ {
 43167  		zArg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)))
 43168  		if int32(*(*int8)(unsafe.Pointer(zArg))) != '-' {
 43169  			if zFile != uintptr(0) {
 43170  				return sqliteCmdUsage(tls, interp, objv)
 43171  			}
 43172  			zFile = zArg
 43173  			continue
 43174  		}
 43175  		if i == (objc - 1) {
 43176  			return sqliteCmdUsage(tls, interp, objv)
 43177  		}
 43178  		i++
 43179  		if libc.Xstrcmp(tls, zArg, ts+14656 /* "-key" */) == 0 {
 43180  			// no-op
 43181  		} else if libc.Xstrcmp(tls, zArg, ts+14661 /* "-vfs" */) == 0 {
 43182  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)))
 43183  		} else if libc.Xstrcmp(tls, zArg, ts+12904 /* "-readonly" */) == 0 {
 43184  			// var b int32 at bp+88, 4
 43185  
 43186  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+88 /* &b */) != 0 {
 43187  				return TCL_ERROR
 43188  			}
 43189  			if *(*int32)(unsafe.Pointer(bp + 88 /* b */)) != 0 {
 43190  				flags = flags & (libc.CplInt32((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)))
 43191  				flags = flags | (SQLITE_OPEN_READONLY)
 43192  			} else {
 43193  				flags = flags & (libc.CplInt32(SQLITE_OPEN_READONLY))
 43194  				flags = flags | (SQLITE_OPEN_READWRITE)
 43195  			}
 43196  		} else if libc.Xstrcmp(tls, zArg, ts+14666 /* "-create" */) == 0 {
 43197  			// var b int32 at bp+92, 4
 43198  
 43199  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+92 /* &b */) != 0 {
 43200  				return TCL_ERROR
 43201  			}
 43202  			if (*(*int32)(unsafe.Pointer(bp + 92 /* b */)) != 0) && ((flags & SQLITE_OPEN_READONLY) == 0) {
 43203  				flags = flags | (SQLITE_OPEN_CREATE)
 43204  			} else {
 43205  				flags = flags & (libc.CplInt32(SQLITE_OPEN_CREATE))
 43206  			}
 43207  		} else if libc.Xstrcmp(tls, zArg, ts+14674 /* "-nofollow" */) == 0 {
 43208  			// var b int32 at bp+96, 4
 43209  
 43210  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+96 /* &b */) != 0 {
 43211  				return TCL_ERROR
 43212  			}
 43213  			if *(*int32)(unsafe.Pointer(bp + 96 /* b */)) != 0 {
 43214  				flags = flags | (SQLITE_OPEN_NOFOLLOW)
 43215  			} else {
 43216  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOFOLLOW))
 43217  			}
 43218  		} else if libc.Xstrcmp(tls, zArg, ts+14684 /* "-nomutex" */) == 0 {
 43219  			// var b int32 at bp+100, 4
 43220  
 43221  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+100 /* &b */) != 0 {
 43222  				return TCL_ERROR
 43223  			}
 43224  			if *(*int32)(unsafe.Pointer(bp + 100 /* b */)) != 0 {
 43225  				flags = flags | (SQLITE_OPEN_NOMUTEX)
 43226  				flags = flags & (libc.CplInt32(SQLITE_OPEN_FULLMUTEX))
 43227  			} else {
 43228  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOMUTEX))
 43229  			}
 43230  		} else if libc.Xstrcmp(tls, zArg, ts+14693 /* "-fullmutex" */) == 0 {
 43231  			// var b int32 at bp+104, 4
 43232  
 43233  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+104 /* &b */) != 0 {
 43234  				return TCL_ERROR
 43235  			}
 43236  			if *(*int32)(unsafe.Pointer(bp + 104 /* b */)) != 0 {
 43237  				flags = flags | (SQLITE_OPEN_FULLMUTEX)
 43238  				flags = flags & (libc.CplInt32(SQLITE_OPEN_NOMUTEX))
 43239  			} else {
 43240  				flags = flags & (libc.CplInt32(SQLITE_OPEN_FULLMUTEX))
 43241  			}
 43242  		} else if libc.Xstrcmp(tls, zArg, ts+14704 /* "-uri" */) == 0 {
 43243  			// var b int32 at bp+108, 4
 43244  
 43245  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+108 /* &b */) != 0 {
 43246  				return TCL_ERROR
 43247  			}
 43248  			if *(*int32)(unsafe.Pointer(bp + 108 /* b */)) != 0 {
 43249  				flags = flags | (SQLITE_OPEN_URI)
 43250  			} else {
 43251  				flags = flags & (libc.CplInt32(SQLITE_OPEN_URI))
 43252  			}
 43253  		} else if libc.Xstrcmp(tls, zArg, ts+14709 /* "-translatefilena..." */) == 0 {
 43254  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+112 /* &bTranslateFileName */) != 0 {
 43255  				return TCL_ERROR
 43256  			}
 43257  		} else {
 43258  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+12914 /* "unknown option: " */, zArg, uintptr(0)))
 43259  			return TCL_ERROR
 43260  		}
 43261  	}
 43262  	zErrMsg = uintptr(0)
 43263  	p = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(SqliteDb{})))
 43264  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(SqliteDb{})))
 43265  	if zFile == uintptr(0) {
 43266  		zFile = ts + 489 /* "" */
 43267  	}
 43268  	if *(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) != 0 {
 43269  		zFile = tcl.XTcl_TranslateFileName(tls, interp, zFile, bp+116 /* &translatedFilename */)
 43270  	}
 43271  	rc = sqlite3.Xsqlite3_open_v2(tls, zFile, (p /* &.db */), flags, zVfs)
 43272  	if *(*int32)(unsafe.Pointer(bp + 112 /* bTranslateFileName */)) != 0 {
 43273  		tcl.XTcl_DStringFree(tls, bp+116 /* &translatedFilename */)
 43274  	}
 43275  	if (*SqliteDb)(unsafe.Pointer(p)).Fdb != 0 {
 43276  		if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb) {
 43277  			zErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+72, sqlite3.Xsqlite3_errmsg(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb)))
 43278  			sqlite3.Xsqlite3_close(tls, (*SqliteDb)(unsafe.Pointer(p)).Fdb)
 43279  			(*SqliteDb)(unsafe.Pointer(p)).Fdb = uintptr(0)
 43280  		}
 43281  	} else {
 43282  		zErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+80, sqlite3.Xsqlite3_errstr(tls, rc)))
 43283  	}
 43284  	if (*SqliteDb)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 43285  		tcl.XTcl_SetResult(tls, interp, zErrMsg, uintptr(1))
 43286  		tcl.XTcl_Free(tls, p)
 43287  		sqlite3.Xsqlite3_free(tls, zErrMsg)
 43288  		return TCL_ERROR
 43289  	}
 43290  	(*SqliteDb)(unsafe.Pointer(p)).FmaxStmt = NUM_PREPARED_STMTS
 43291  	(*SqliteDb)(unsafe.Pointer(p)).FopenFlags = (flags & SQLITE_OPEN_URI)
 43292  	(*SqliteDb)(unsafe.Pointer(p)).Finterp = interp
 43293  	zArg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(0))
 43294  	if DbUseNre(tls) != 0 {
 43295  		tcl.XTcl_NRCreateCommand(tls, interp, zArg, *(*uintptr)(unsafe.Pointer(&struct {
 43296  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43297  		}{DbObjCmdAdaptor})), *(*uintptr)(unsafe.Pointer(&struct {
 43298  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43299  		}{DbObjCmd})),
 43300  			p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbDeleteCmd})))
 43301  	} else {
 43302  		tcl.XTcl_CreateObjCommand(tls, interp, zArg, *(*uintptr)(unsafe.Pointer(&struct {
 43303  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43304  		}{DbObjCmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{DbDeleteCmd})))
 43305  	}
 43306  	return TCL_OK
 43307  }
 43308  
 43309  // Provide a dummy Tcl_InitStubs if we are using this as a static
 43310  // library.
 43311  
 43312  // Make sure we have a PACKAGE_VERSION macro defined.  This will be
 43313  // defined automatically by the TEA makefile.  But other makefiles
 43314  // do not define it.
 43315  
 43316  // Initialize this module.
 43317  //
 43318  // This Tcl module contains only a single new Tcl command named "sqlite".
 43319  // (Hence there is no namespace.  There is no point in using a namespace
 43320  // if the extension only supplies one new name!)  The "sqlite" command is
 43321  // used to open a new SQLite database.  See the DbMain() routine above
 43322  // for additional information.
 43323  //
 43324  // The EXTERN macros are required by TCL in order to work on windows.
 43325  func Sqlite3_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3877:12: */
 43326  	var rc int32
 43327  	if 1 != 0 {
 43328  		rc = TCL_OK
 43329  	} else {
 43330  		rc = TCL_ERROR
 43331  	}
 43332  	if rc == TCL_OK {
 43333  		tcl.XTcl_CreateObjCommand(tls, interp, ts+14728 /* "sqlite3" */, *(*uintptr)(unsafe.Pointer(&struct {
 43334  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43335  		}{DbMain})), uintptr(0), uintptr(0))
 43336  		// The "sqlite" alias is undocumented.  It is here only to support
 43337  		// legacy scripts.  All new scripts should use only the "sqlite3"
 43338  		// command.
 43339  		tcl.XTcl_CreateObjCommand(tls, interp, ts+14736 /* "sqlite" */, *(*uintptr)(unsafe.Pointer(&struct {
 43340  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 43341  		}{DbMain})), uintptr(0), uintptr(0))
 43342  		rc = tcl.XTcl_PkgProvideEx(tls, interp, ts+14728 /* "sqlite3" */, ts+14743 /* "3.36.0" */, uintptr(0))
 43343  	}
 43344  	return rc
 43345  }
 43346  
 43347  func Tclsqlite3_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3891:12: */
 43348  	return Sqlite3_Init(tls, interp)
 43349  }
 43350  
 43351  func Sqlite3_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3892:12: */
 43352  	return TCL_OK
 43353  }
 43354  
 43355  func Tclsqlite3_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3893:12: */
 43356  	return TCL_OK
 43357  }
 43358  
 43359  // Because it accesses the file-system and uses persistent state, SQLite
 43360  // is not considered appropriate for safe interpreters.  Hence, we cause
 43361  // the _SafeInit() interfaces return TCL_ERROR.
 43362  func Sqlite3_SafeInit(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3899:12: */
 43363  	return TCL_ERROR
 43364  }
 43365  
 43366  func Sqlite3_SafeUnload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3900:12: */
 43367  	return TCL_ERROR
 43368  }
 43369  
 43370  func Sqlite_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3905:5: */
 43371  	return Sqlite3_Init(tls, interp)
 43372  }
 43373  
 43374  func Tclsqlite_Init(tls *libc.TLS, interp uintptr) int32 { /* tclsqlite.c:3906:5: */
 43375  	return Sqlite3_Init(tls, interp)
 43376  }
 43377  
 43378  func Sqlite_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3907:5: */
 43379  	return TCL_OK
 43380  }
 43381  
 43382  func Tclsqlite_Unload(tls *libc.TLS, interp uintptr, flags int32) int32 { /* tclsqlite.c:3908:5: */
 43383  	return TCL_OK
 43384  }
 43385  
 43386  // If the TCLSH macro is defined, add code to make a stand-alone program.
 43387  
 43388  // This is the main routine for an ordinary TCL shell.  If there are
 43389  // are arguments, run the first argument as a script.  Otherwise,
 43390  // read TCL commands from standard input
 43391  func tclsh_main_loop(tls *libc.TLS) uintptr { /* tclsqlite.c:3920:19: */
 43392  	return uintptr(unsafe.Pointer(&zMainloop))
 43393  }
 43394  
 43395  var zMainloop = *(*[431]int8)(unsafe.Pointer(ts + 14750 /* "if {[llength $ar..." */)) /* tclsqlite.c:3921:21 */
 43396  
 43397  func main1(tls *libc.TLS, argc int32, argv uintptr) int32 { /* tclsqlite.c:3953:18: */
 43398  	bp := tls.Alloc(64)
 43399  	defer tls.Free(64)
 43400  
 43401  	var interp uintptr
 43402  	var i int32
 43403  	var zScript uintptr = uintptr(0)
 43404  	// var zArgc [32]int8 at bp+32, 32
 43405  
 43406  	if libc.Xgetenv(tls, ts+15181 /* "SQLITE_DEBUG_BRE..." */) != 0 {
 43407  		if (libc.Xisatty(tls, 0) != 0) && (libc.Xisatty(tls, 2) != 0) {
 43408  			libc.Xfprintf(tls, libc.Xstderr,
 43409  				ts+15200, /* "attach debugger ..." */
 43410  				libc.VaList(bp, libc.Xgetpid(tls)))
 43411  			libc.Xfgetc(tls, libc.Xstdin)
 43412  		} else {
 43413  			libc.Xraise(tls, SIGTRAP)
 43414  		}
 43415  	}
 43416  
 43417  	// Call sqlite3_shutdown() once before doing anything else. This is to
 43418  	// test that sqlite3_shutdown() can be safely called by a process before
 43419  	// sqlite3_initialize() is.
 43420  	sqlite3.Xsqlite3_shutdown(tls)
 43421  
 43422  	tcl.XTcl_FindExecutable(tls, *(*uintptr)(unsafe.Pointer(argv)))
 43423  	tcl.XTcl_SetSystemEncoding(tls, uintptr(0), ts+15262 /* "utf-8" */)
 43424  	interp = tcl.XTcl_CreateInterp(tls)
 43425  	Sqlite3_Init(tls, interp)
 43426  
 43427  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([32]int8{})), bp+32 /* &zArgc[0] */, ts+1238 /* "%d" */, libc.VaList(bp+8, (argc-1)))
 43428  	tcl.XTcl_SetVar2(tls, interp, ts+15268 /* "argc" */, uintptr(0), bp+32 /* &zArgc[0] */, TCL_GLOBAL_ONLY)
 43429  	tcl.XTcl_SetVar2(tls, interp, ts+15273 /* "argv0" */, uintptr(0), *(*uintptr)(unsafe.Pointer(argv)), TCL_GLOBAL_ONLY)
 43430  	tcl.XTcl_SetVar2(tls, interp, ts+15279 /* "argv" */, uintptr(0), ts+489 /* "" */, TCL_GLOBAL_ONLY)
 43431  	for i = 1; i < argc; i++ {
 43432  		tcl.XTcl_SetVar2(tls, interp, ts+15279 /* "argv" */, uintptr(0), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), ((TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT) | TCL_APPEND_VALUE))
 43433  	}
 43434  	zScript = sqlite3TestInit(tls, interp)
 43435  	if zScript == uintptr(0) {
 43436  		zScript = tclsh_main_loop(tls)
 43437  	}
 43438  	if tcl.XTcl_GlobalEval(tls, interp, zScript) != TCL_OK {
 43439  		var zInfo uintptr = tcl.XTcl_GetVar2(tls, interp, ts+15284 /* "errorInfo" */, uintptr(0), TCL_GLOBAL_ONLY)
 43440  		if zInfo == uintptr(0) {
 43441  			zInfo = tcl.XTcl_GetStringResult(tls, interp)
 43442  		}
 43443  		libc.Xfprintf(tls, libc.Xstderr, ts+15294 /* "%s: %s\n" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv)), zInfo))
 43444  		return 1
 43445  	}
 43446  	return 0
 43447  }
 43448  
 43449  // CAPI3REF: Database Connection Handle
 43450  // KEYWORDS: {database connection} {database connections}
 43451  //
 43452  // Each open SQLite database is represented by a pointer to an instance of
 43453  // the opaque structure named "sqlite3".  It is useful to think of an sqlite3
 43454  // pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
 43455  // [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
 43456  // and [sqlite3_close_v2()] are its destructors.  There are many other
 43457  // interfaces (such as
 43458  // [sqlite3_prepare_v2()], [sqlite3_create_function()], and
 43459  // [sqlite3_busy_timeout()] to name but three) that are methods on an
 43460  // sqlite3 object.
 43461  type sqlite31 = sqlite32 /* sqlite3.h:249:24 */
 43462  
 43463  // CAPI3REF: Dynamically Typed Value Object
 43464  // KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
 43465  //
 43466  // SQLite uses the sqlite3_value object to represent all values
 43467  // that can be stored in a database table. SQLite uses dynamic typing
 43468  // for the values it stores.  ^Values stored in sqlite3_value objects
 43469  // can be integers, floating point values, strings, BLOBs, or NULL.
 43470  //
 43471  // An sqlite3_value object may be either "protected" or "unprotected".
 43472  // Some interfaces require a protected sqlite3_value.  Other interfaces
 43473  // will accept either a protected or an unprotected sqlite3_value.
 43474  // Every interface that accepts sqlite3_value arguments specifies
 43475  // whether or not it requires a protected sqlite3_value.  The
 43476  // [sqlite3_value_dup()] interface can be used to construct a new
 43477  // protected sqlite3_value from an unprotected sqlite3_value.
 43478  //
 43479  // The terms "protected" and "unprotected" refer to whether or not
 43480  // a mutex is held.  An internal mutex is held for a protected
 43481  // sqlite3_value object but no mutex is held for an unprotected
 43482  // sqlite3_value object.  If SQLite is compiled to be single-threaded
 43483  // (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
 43484  // or if SQLite is run in one of reduced mutex modes
 43485  // [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
 43486  // then there is no distinction between protected and unprotected
 43487  // sqlite3_value objects and they can be used interchangeably.  However,
 43488  // for maximum code portability it is recommended that applications
 43489  // still make the distinction between protected and unprotected
 43490  // sqlite3_value objects even when not strictly required.
 43491  //
 43492  // ^The sqlite3_value objects that are passed as parameters into the
 43493  // implementation of [application-defined SQL functions] are protected.
 43494  // ^The sqlite3_value object returned by
 43495  // [sqlite3_column_value()] is unprotected.
 43496  // Unprotected sqlite3_value objects may only be used as arguments
 43497  // to [sqlite3_result_value()], [sqlite3_bind_value()], and
 43498  // [sqlite3_value_dup()].
 43499  // The [sqlite3_value_blob | sqlite3_value_type()] family of
 43500  // interfaces require protected sqlite3_value objects.
 43501  type sqlite3_value = sqlite3_value1 /* sqlite3.h:4286:30 */
 43502  
 43503  // CAPI3REF: SQL Function Context Object
 43504  //
 43505  // The context in which an SQL function executes is stored in an
 43506  // sqlite3_context object.  ^A pointer to an sqlite3_context object
 43507  // is always first parameter to [application-defined SQL functions].
 43508  // The application-defined SQL function implementation will pass this
 43509  // pointer through into calls to [sqlite3_result_int | sqlite3_result()],
 43510  // [sqlite3_aggregate_context()], [sqlite3_user_data()],
 43511  // [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
 43512  // and/or [sqlite3_set_auxdata()].
 43513  type sqlite3_context = sqlite3_context1 /* sqlite3.h:4300:32 */
 43514  
 43515  // CAPI3REF: Dynamic String Object
 43516  // KEYWORDS: {dynamic string}
 43517  //
 43518  // An instance of the sqlite3_str object contains a dynamically-sized
 43519  // string under construction.
 43520  //
 43521  // The lifecycle of an sqlite3_str object is as follows:
 43522  // <ol>
 43523  // <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
 43524  // <li> ^Text is appended to the sqlite3_str object using various
 43525  // methods, such as [sqlite3_str_appendf()].
 43526  // <li> ^The sqlite3_str object is destroyed and the string it created
 43527  // is returned using the [sqlite3_str_finish()] interface.
 43528  // </ol>
 43529  type sqlite3_str = sqlite3_str1 /* sqlite3.h:7882:28 */
 43530  
 43531  // Unsigned.
 43532  // Define uintN_t types.
 43533  //    Copyright (C) 2017-2018 Free Software Foundation, Inc.
 43534  //    This file is part of the GNU C Library.
 43535  //
 43536  //    The GNU C Library is free software; you can redistribute it and/or
 43537  //    modify it under the terms of the GNU Lesser General Public
 43538  //    License as published by the Free Software Foundation; either
 43539  //    version 2.1 of the License, or (at your option) any later version.
 43540  //
 43541  //    The GNU C Library is distributed in the hope that it will be useful,
 43542  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 43543  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 43544  //    Lesser General Public License for more details.
 43545  //
 43546  //    You should have received a copy of the GNU Lesser General Public
 43547  //    License along with the GNU C Library; if not, see
 43548  //    <http://www.gnu.org/licenses/>.
 43549  
 43550  // bits/types.h -- definitions of __*_t types underlying *_t types.
 43551  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 43552  //    This file is part of the GNU C Library.
 43553  //
 43554  //    The GNU C Library is free software; you can redistribute it and/or
 43555  //    modify it under the terms of the GNU Lesser General Public
 43556  //    License as published by the Free Software Foundation; either
 43557  //    version 2.1 of the License, or (at your option) any later version.
 43558  //
 43559  //    The GNU C Library is distributed in the hope that it will be useful,
 43560  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 43561  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 43562  //    Lesser General Public License for more details.
 43563  //
 43564  //    You should have received a copy of the GNU Lesser General Public
 43565  //    License along with the GNU C Library; if not, see
 43566  //    <http://www.gnu.org/licenses/>.
 43567  
 43568  // Never include this file directly; use <sys/types.h> instead.
 43569  
 43570  type uint8_t = uint8   /* stdint-uintn.h:24:19 */
 43571  type uint16_t = uint16 /* stdint-uintn.h:25:20 */
 43572  type uint32_t = uint32 /* stdint-uintn.h:26:20 */
 43573  type uint64_t = uint64 /* stdint-uintn.h:27:20 */
 43574  
 43575  // Small types.
 43576  
 43577  // Signed.
 43578  type int_least8_t = int8   /* stdint.h:43:24 */
 43579  type int_least16_t = int16 /* stdint.h:44:25 */
 43580  type int_least32_t = int32 /* stdint.h:45:25 */
 43581  type int_least64_t = int64 /* stdint.h:46:25 */
 43582  
 43583  // Unsigned.
 43584  type uint_least8_t = uint8   /* stdint.h:49:25 */
 43585  type uint_least16_t = uint16 /* stdint.h:50:26 */
 43586  type uint_least32_t = uint32 /* stdint.h:51:26 */
 43587  type uint_least64_t = uint64 /* stdint.h:52:26 */
 43588  
 43589  // Fast types.
 43590  
 43591  // Signed.
 43592  type int_fast8_t = int8   /* stdint.h:58:22 */
 43593  type int_fast16_t = int32 /* stdint.h:64:15 */
 43594  type int_fast32_t = int32 /* stdint.h:65:15 */
 43595  
 43596  type int_fast64_t = int64 /* stdint.h:67:24 */
 43597  
 43598  // Unsigned.
 43599  type uint_fast8_t = uint8   /* stdint.h:71:24 */
 43600  type uint_fast16_t = uint32 /* stdint.h:77:23 */
 43601  type uint_fast32_t = uint32 /* stdint.h:78:23 */
 43602  
 43603  type uint_fast64_t = uint64 /* stdint.h:80:32 */
 43604  type uintptr_t = uint32     /* stdint.h:96:23 */
 43605  
 43606  // Largest integral types.
 43607  type intmax_t = int64   /* stdint.h:101:21 */
 43608  type uintmax_t = uint64 /* stdint.h:102:22 */
 43609  
 43610  // Macros for printing format specifiers.
 43611  
 43612  // Decimal notation.
 43613  
 43614  // Octal notation.
 43615  
 43616  // Unsigned integers.
 43617  
 43618  // lowercase hexadecimal notation.
 43619  
 43620  // UPPERCASE hexadecimal notation.
 43621  
 43622  // Macros for printing `intmax_t' and `uintmax_t'.
 43623  
 43624  // Macros for printing `intptr_t' and `uintptr_t'.
 43625  
 43626  // Macros for scanning format specifiers.
 43627  
 43628  // Signed decimal notation.
 43629  
 43630  // Signed decimal notation.
 43631  
 43632  // Unsigned decimal notation.
 43633  
 43634  // Octal notation.
 43635  
 43636  // Hexadecimal notation.
 43637  
 43638  // Macros for scanning `intmax_t' and `uintmax_t'.
 43639  
 43640  // Macros for scaning `intptr_t' and `uintptr_t'.
 43641  
 43642  // We have to define the `uintmax_t' type using `lldiv_t'.
 43643  type imaxdiv_t = struct {
 43644  	Fquot int64
 43645  	Frem  int64
 43646  } /* inttypes.h:284:5 */
 43647  
 43648  // Is the sqlite3ErrName() function needed in the build?  Currently,
 43649  // it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
 43650  // OSTRACE is enabled), and by several "test*.c" files (which are
 43651  // compiled using SQLITE_TEST).
 43652  
 43653  // SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
 43654  
 43655  // Return true (non-zero) if the input is an integer that is too large
 43656  // to fit in 32-bits.  This macro is used inside of various testcase()
 43657  // macros to verify that we have tested SQLite for large-file support.
 43658  
 43659  // The macro unlikely() is a hint that surrounds a boolean
 43660  // expression that is usually false.  Macro likely() surrounds
 43661  // a boolean expression that is usually true.  These hints could,
 43662  // in theory, be used by the compiler to generate better code, but
 43663  // currently they are just comments for human readers.
 43664  
 43665  // 2001 September 22
 43666  //
 43667  // The author disclaims copyright to this source code.  In place of
 43668  // a legal notice, here is a blessing:
 43669  //
 43670  //    May you do good and not evil.
 43671  //    May you find forgiveness for yourself and forgive others.
 43672  //    May you share freely, never taking more than you give.
 43673  //
 43674  //
 43675  // This is the header file for the generic hash-table implementation
 43676  // used in SQLite.
 43677  
 43678  // Forward declarations of structures.
 43679  type Hash1 = struct {
 43680  	Fhtsize uint32
 43681  	Fcount  uint32
 43682  	Ffirst  uintptr
 43683  	Fht     uintptr
 43684  } /* sqlite3.h:249:9 */
 43685  
 43686  // Is the sqlite3ErrName() function needed in the build?  Currently,
 43687  // it is needed by "mutex_w32.c" (when debugging), "os_win.c" (when
 43688  // OSTRACE is enabled), and by several "test*.c" files (which are
 43689  // compiled using SQLITE_TEST).
 43690  
 43691  // SQLITE_ENABLE_EXPLAIN_COMMENTS is incompatible with SQLITE_OMIT_EXPLAIN
 43692  
 43693  // Return true (non-zero) if the input is an integer that is too large
 43694  // to fit in 32-bits.  This macro is used inside of various testcase()
 43695  // macros to verify that we have tested SQLite for large-file support.
 43696  
 43697  // The macro unlikely() is a hint that surrounds a boolean
 43698  // expression that is usually false.  Macro likely() surrounds
 43699  // a boolean expression that is usually true.  These hints could,
 43700  // in theory, be used by the compiler to generate better code, but
 43701  // currently they are just comments for human readers.
 43702  
 43703  // 2001 September 22
 43704  //
 43705  // The author disclaims copyright to this source code.  In place of
 43706  // a legal notice, here is a blessing:
 43707  //
 43708  //    May you do good and not evil.
 43709  //    May you find forgiveness for yourself and forgive others.
 43710  //    May you share freely, never taking more than you give.
 43711  //
 43712  //
 43713  // This is the header file for the generic hash-table implementation
 43714  // used in SQLite.
 43715  
 43716  // Forward declarations of structures.
 43717  type Hash = Hash1 /* hash.h:19:21 */
 43718  type HashElem1 = struct {
 43719  	Fnext uintptr
 43720  	Fprev uintptr
 43721  	Fdata uintptr
 43722  	FpKey uintptr
 43723  } /* sqlite3.h:249:9 */
 43724  
 43725  type HashElem = HashElem1 /* hash.h:20:25 */
 43726  
 43727  // A complete hash table is an instance of the following structure.
 43728  // The internals of this structure are intended to be opaque -- client
 43729  // code should not attempt to access or modify the fields of this structure
 43730  // directly.  Change this structure only by using the routines below.
 43731  // However, some of the "procedures" and "functions" for modifying and
 43732  // accessing this structure are really macros, so we can't really make
 43733  // this structure opaque.
 43734  //
 43735  // All elements of the hash table are on a single doubly-linked list.
 43736  // Hash.first points to the head of this list.
 43737  //
 43738  // There are Hash.htsize buckets.  Each bucket points to a spot in
 43739  // the global doubly-linked list.  The contents of the bucket are the
 43740  // element pointed to plus the next _ht.count-1 elements in the list.
 43741  //
 43742  // Hash.htsize and Hash.ht may be zero.  In that case lookup is done
 43743  // by a linear search of the global list.  For small tables, the
 43744  // Hash.ht table is never allocated because if there are few elements
 43745  // in the table, it is faster to do a linear search than to manage
 43746  // the hash table.
 43747  type _ht = struct {
 43748  	Fcount uint32
 43749  	Fchain uintptr
 43750  } /* sqlite3.h:249:9 */
 43751  
 43752  // The structure with the cookie function pointers.
 43753  //    The tag name of this struct is _IO_cookie_io_functions_t to
 43754  //    preserve historic C++ mangled names for functions taking
 43755  //    cookie_io_functions_t arguments.  That name should not be used in
 43756  //    new code.
 43757  type _IO_cookie_io_functions_t = struct {
 43758  	Fread  uintptr
 43759  	Fwrite uintptr
 43760  	Fseek  uintptr
 43761  	Fclose uintptr
 43762  } /* cookie_io_functions_t.h:55:9 */
 43763  
 43764  // The structure with the cookie function pointers.
 43765  //    The tag name of this struct is _IO_cookie_io_functions_t to
 43766  //    preserve historic C++ mangled names for functions taking
 43767  //    cookie_io_functions_t arguments.  That name should not be used in
 43768  //    new code.
 43769  type cookie_io_functions_t = _IO_cookie_io_functions_t /* cookie_io_functions_t.h:61:3 */
 43770  type off64_t = int64                                   /* stdio.h:70:19 */
 43771  type fpos64_t = _G_fpos64_t                            /* stdio.h:89:20 */
 43772  type ino64_t = uint64                                  /* types.h:54:19 */
 43773  
 43774  // Some versions of <linux/posix_types.h> define this macros.
 43775  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 43776  
 43777  // fd_set for select and pselect.
 43778  type fd_set1 = struct{ Ffds_bits [32]int32 } /* select.h:70:5 */ // Type to count file system inodes.
 43779  
 43780  type blkcnt64_t = int64    /* types.h:236:22 */ // Type to count number of disk blocks.
 43781  type fsblkcnt64_t = uint64 /* types.h:237:24 */ // Type to count file system blocks.
 43782  type fsfilcnt64_t = uint64 /* types.h:238:24 */
 43783  
 43784  type comparison_fn_t = uintptr /* stdlib.h:808:23 */    // 2-byte unsigned integer
 43785  type i16 = int16_t             /* sqliteInt.h:795:20 */ // 1-byte unsigned integer
 43786  type i8 = int8_t               /* sqliteInt.h:797:19 */ // 1-byte signed integer
 43787  
 43788  // SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
 43789  // that can be stored in a u32 without loss of data.  The value
 43790  // is 0x00000000ffffffff.  But because of quirks of some compilers, we
 43791  // have to specify the value in the less intuitive manner shown:
 43792  
 43793  // The datatype used to store estimates of the number of rows in a
 43794  // table or index.  This is an unsigned integer type.  For 99.9% of
 43795  // the world, a 32-bit integer is sufficient.  But a 64-bit integer
 43796  // can be used at compile-time if desired.
 43797  type tRowcnt = u32 /* sqliteInt.h:816:14 */ // 32-bit is the default
 43798  
 43799  // Estimated quantities used for query planning are stored as 16-bit
 43800  // logarithms.  For quantity X, the value stored is 10*log2(X).  This
 43801  // gives a possible range of values of approximately 1.0e986 to 1e-986.
 43802  // But the allowed values are "grainy".  Not every value is representable.
 43803  // For example, quantities 16 and 17 are both represented by a LogEst
 43804  // of 40.  However, since LogEst quantities are suppose to be estimates,
 43805  // not exact values, this imprecision is not a problem.
 43806  //
 43807  // "LogEst" is short for "Logarithmic Estimate".
 43808  //
 43809  // Examples:
 43810  //      1 -> 0              20 -> 43          10000 -> 132
 43811  //      2 -> 10             25 -> 46          25000 -> 146
 43812  //      3 -> 16            100 -> 66        1000000 -> 199
 43813  //      4 -> 20           1000 -> 99        1048576 -> 200
 43814  //     10 -> 33           1024 -> 100    4294967296 -> 320
 43815  //
 43816  // The LogEst can be negative to indicate fractional values.
 43817  // Examples:
 43818  //
 43819  //    0.5 -> -10           0.1 -> -33        0.0625 -> -40
 43820  type LogEst = int16_t /* sqliteInt.h:842:20 */
 43821  
 43822  // Set the SQLITE_PTRSIZE macro to the number of bytes in a pointer
 43823  
 43824  // The uptr type is an unsigned integer large enough to hold a pointer
 43825  type uptr = uintptr_t /* sqliteInt.h:862:21 */
 43826  
 43827  // An instance of the following structure is used to store the busy-handler
 43828  // callback for a given sqlite handle.
 43829  //
 43830  // The sqlite.busyHandler member of the sqlite struct contains the busy
 43831  // callback for the database handle. Each pager opened via the sqlite
 43832  // handle is passed a pointer to sqlite.busyHandler. The busy-handler
 43833  // callback is currently invoked only from within pager.c.
 43834  type BusyHandler1 = struct {
 43835  	FxBusyHandler uintptr
 43836  	FpBusyArg     uintptr
 43837  	FnBusy        int32
 43838  } /* sqlite3.h:249:9 */
 43839  
 43840  // An instance of the following structure is used to store the busy-handler
 43841  // callback for a given sqlite handle.
 43842  //
 43843  // The sqlite.busyHandler member of the sqlite struct contains the busy
 43844  // callback for the database handle. Each pager opened via the sqlite
 43845  // handle is passed a pointer to sqlite.busyHandler. The busy-handler
 43846  // callback is currently invoked only from within pager.c.
 43847  type BusyHandler = BusyHandler1 /* sqliteInt.h:1037:28 */
 43848  
 43849  // Name of table that holds the database schema.
 43850  
 43851  // The root-page of the schema table.
 43852  
 43853  // The name of the schema table.  The name is different for TEMP.
 43854  
 43855  // A convenience macro that returns the number of elements in
 43856  // an array.
 43857  
 43858  // Determine if the argument is a power of two
 43859  
 43860  // The following value as a destructor means to use sqlite3DbFree().
 43861  // The sqlite3DbFree() routine requires two parameters instead of the
 43862  // one parameter that destructors normally want.  So we have to introduce
 43863  // this magic value that the code knows to handle differently.  Any
 43864  // pointer will work here as long as it is distinct from SQLITE_STATIC
 43865  // and SQLITE_TRANSIENT.
 43866  
 43867  // When SQLITE_OMIT_WSD is defined, it means that the target platform does
 43868  // not support Writable Static Data (WSD) such as global and static variables.
 43869  // All variables must either be on the stack or dynamically allocated from
 43870  // the heap.  When WSD is unsupported, the variable declarations scattered
 43871  // throughout the SQLite code must become constants instead.  The SQLITE_WSD
 43872  // macro is used for this purpose.  And instead of referencing the variable
 43873  // directly, we use its constant as a key to lookup the run-time allocated
 43874  // buffer that holds real variable.  The constant is also the initializer
 43875  // for the run-time allocated buffer.
 43876  //
 43877  // In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
 43878  // macros become no-ops and have zero performance impact.
 43879  
 43880  // The following macros are used to suppress compiler warnings and to
 43881  // make it clear to human readers when a function parameter is deliberately
 43882  // left unused within the body of a function. This usually happens when
 43883  // a function is called via a function pointer. For example the
 43884  // implementation of an SQL aggregate step callback may not use the
 43885  // parameter indicating the number of arguments passed to the aggregate,
 43886  // if it knows that this is enforced elsewhere.
 43887  //
 43888  // When a function parameter is not used at all within the body of a function,
 43889  // it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
 43890  // However, these macros may also be used to suppress warnings related to
 43891  // parameters that may or may not be used depending on compilation options.
 43892  // For example those parameters only used in assert() statements. In these
 43893  // cases the parameters are named as per the usual conventions.
 43894  
 43895  // Forward references to structures
 43896  type AggInfo1 = struct {
 43897  	FdirectMode     u8
 43898  	FuseSortingIdx  u8
 43899  	_               [2]byte
 43900  	FsortingIdx     int32
 43901  	FsortingIdxPTab int32
 43902  	FnSortingColumn int32
 43903  	FmnReg          int32
 43904  	FmxReg          int32
 43905  	FpGroupBy       uintptr
 43906  	FaCol           uintptr
 43907  	FnColumn        int32
 43908  	FnAccumulator   int32
 43909  	FaFunc          uintptr
 43910  	FnFunc          int32
 43911  	FselId          u32
 43912  } /* sqlite3.h:249:9 */
 43913  
 43914  // Name of table that holds the database schema.
 43915  
 43916  // The root-page of the schema table.
 43917  
 43918  // The name of the schema table.  The name is different for TEMP.
 43919  
 43920  // A convenience macro that returns the number of elements in
 43921  // an array.
 43922  
 43923  // Determine if the argument is a power of two
 43924  
 43925  // The following value as a destructor means to use sqlite3DbFree().
 43926  // The sqlite3DbFree() routine requires two parameters instead of the
 43927  // one parameter that destructors normally want.  So we have to introduce
 43928  // this magic value that the code knows to handle differently.  Any
 43929  // pointer will work here as long as it is distinct from SQLITE_STATIC
 43930  // and SQLITE_TRANSIENT.
 43931  
 43932  // When SQLITE_OMIT_WSD is defined, it means that the target platform does
 43933  // not support Writable Static Data (WSD) such as global and static variables.
 43934  // All variables must either be on the stack or dynamically allocated from
 43935  // the heap.  When WSD is unsupported, the variable declarations scattered
 43936  // throughout the SQLite code must become constants instead.  The SQLITE_WSD
 43937  // macro is used for this purpose.  And instead of referencing the variable
 43938  // directly, we use its constant as a key to lookup the run-time allocated
 43939  // buffer that holds real variable.  The constant is also the initializer
 43940  // for the run-time allocated buffer.
 43941  //
 43942  // In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
 43943  // macros become no-ops and have zero performance impact.
 43944  
 43945  // The following macros are used to suppress compiler warnings and to
 43946  // make it clear to human readers when a function parameter is deliberately
 43947  // left unused within the body of a function. This usually happens when
 43948  // a function is called via a function pointer. For example the
 43949  // implementation of an SQL aggregate step callback may not use the
 43950  // parameter indicating the number of arguments passed to the aggregate,
 43951  // if it knows that this is enforced elsewhere.
 43952  //
 43953  // When a function parameter is not used at all within the body of a function,
 43954  // it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
 43955  // However, these macros may also be used to suppress warnings related to
 43956  // parameters that may or may not be used depending on compilation options.
 43957  // For example those parameters only used in assert() statements. In these
 43958  // cases the parameters are named as per the usual conventions.
 43959  
 43960  // Forward references to structures
 43961  type AggInfo = AggInfo1 /* sqliteInt.h:1133:24 */
 43962  type AuthContext1 = struct {
 43963  	FzAuthContext uintptr
 43964  	FpParse       uintptr
 43965  } /* sqliteInt.h:1134:9 */
 43966  
 43967  type AuthContext = AuthContext1 /* sqliteInt.h:1134:28 */
 43968  type AutoincInfo1 = struct {
 43969  	FpNext  uintptr
 43970  	FpTab   uintptr
 43971  	FiDb    int32
 43972  	FregCtr int32
 43973  } /* sqlite3.h:249:9 */
 43974  
 43975  type AutoincInfo = AutoincInfo1 /* sqliteInt.h:1135:28 */
 43976  type CollSeq1 = struct {
 43977  	FzName uintptr
 43978  	Fenc   u8
 43979  	_      [3]byte
 43980  	FpUser uintptr
 43981  	FxCmp  uintptr
 43982  	FxDel  uintptr
 43983  } /* sqlite3.h:249:9 */
 43984  
 43985  type CollSeq = CollSeq1 /* sqliteInt.h:1137:24 */
 43986  type Column1 = struct {
 43987  	FzName    uintptr
 43988  	FpDflt    uintptr
 43989  	FzColl    uintptr
 43990  	FnotNull  u8
 43991  	Faffinity int8
 43992  	FszEst    u8
 43993  	FhName    u8
 43994  	FcolFlags u16
 43995  	_         [2]byte
 43996  } /* sqlite3.h:249:9 */
 43997  
 43998  type Column = Column1 /* sqliteInt.h:1138:23 */
 43999  type Cte1 = struct {
 44000  	FzName   uintptr
 44001  	FpCols   uintptr
 44002  	FpSelect uintptr
 44003  	FzCteErr uintptr
 44004  	FpUse    uintptr
 44005  	FeM10d   u8
 44006  	_        [3]byte
 44007  } /* sqlite3.h:249:9 */
 44008  
 44009  type Cte = Cte1 /* sqliteInt.h:1139:20 */
 44010  type CteUse1 = struct {
 44011  	FnUse    int32
 44012  	FaddrM9e int32
 44013  	FregRtn  int32
 44014  	FiCur    int32
 44015  	FnRowEst LogEst
 44016  	FeM10d   u8
 44017  	_        [1]byte
 44018  } /* sqlite3.h:249:9 */
 44019  
 44020  type CteUse = CteUse1 /* sqliteInt.h:1140:23 */
 44021  type Db1 = struct {
 44022  	FzDbSName     uintptr
 44023  	FpBt          uintptr
 44024  	Fsafety_level u8
 44025  	FbSyncSet     u8
 44026  	_             [2]byte
 44027  	FpSchema      uintptr
 44028  } /* sqlite3.h:249:9 */
 44029  
 44030  type Db = Db1 /* sqliteInt.h:1141:19 */
 44031  type DbFixer1 = struct {
 44032  	FpParse  uintptr
 44033  	Fw       Walker
 44034  	FpSchema uintptr
 44035  	FbTemp   u8
 44036  	_        [3]byte
 44037  	FzDb     uintptr
 44038  	FzType   uintptr
 44039  	FpName   uintptr
 44040  } /* sqliteInt.h:1142:9 */
 44041  
 44042  type DbFixer = DbFixer1 /* sqliteInt.h:1142:24 */
 44043  type Schema1 = struct {
 44044  	Fschema_cookie int32
 44045  	FiGeneration   int32
 44046  	FtblHash       Hash
 44047  	FidxHash       Hash
 44048  	FtrigHash      Hash
 44049  	FfkeyHash      Hash
 44050  	FpSeqTab       uintptr
 44051  	Ffile_format   u8
 44052  	Fenc           u8
 44053  	FschemaFlags   u16
 44054  	Fcache_size    int32
 44055  } /* sqlite3.h:249:9 */
 44056  
 44057  type Schema = Schema1 /* sqliteInt.h:1143:23 */
 44058  type Expr1 = struct {
 44059  	Fop              u8
 44060  	FaffExpr         int8
 44061  	Fop2             u8
 44062  	_                [1]byte
 44063  	Fflags           u32
 44064  	Fu               struct{ FzToken uintptr }
 44065  	FpLeft           uintptr
 44066  	FpRight          uintptr
 44067  	Fx               struct{ FpList uintptr }
 44068  	FnHeight         int32
 44069  	FiTable          int32
 44070  	FiColumn         ynVar
 44071  	FiAgg            i16
 44072  	FiRightJoinTable int32
 44073  	FpAggInfo        uintptr
 44074  	Fy               struct {
 44075  		FpTab uintptr
 44076  		_     [4]byte
 44077  	}
 44078  } /* sqlite3.h:249:9 */
 44079  
 44080  type Expr = Expr1 /* sqliteInt.h:1144:21 */
 44081  type ExprList1 = struct {
 44082  	FnExpr  int32
 44083  	FnAlloc int32
 44084  	Fa      [1]struct {
 44085  		FpExpr     uintptr
 44086  		FzEName    uintptr
 44087  		FsortFlags u8
 44088  		_          [3]byte
 44089  		FeEName    uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */
 44090  		_          [3]byte
 44091  		Fu         struct {
 44092  			_  [0]uint32
 44093  			Fx struct {
 44094  				FiOrderByCol u16
 44095  				FiAlias      u16
 44096  			}
 44097  		}
 44098  	}
 44099  } /* sqlite3.h:249:9 */
 44100  
 44101  type ExprList = ExprList1 /* sqliteInt.h:1145:25 */
 44102  type FKey1 = struct {
 44103  	FpFrom      uintptr
 44104  	FpNextFrom  uintptr
 44105  	FzTo        uintptr
 44106  	FpNextTo    uintptr
 44107  	FpPrevTo    uintptr
 44108  	FnCol       int32
 44109  	FisDeferred u8
 44110  	FaAction    [2]u8
 44111  	_           [1]byte
 44112  	FapTrigger  [2]uintptr
 44113  	FaCol       [1]struct {
 44114  		FiFrom int32
 44115  		FzCol  uintptr
 44116  	}
 44117  } /* sqlite3.h:249:9 */
 44118  
 44119  type FKey = FKey1 /* sqliteInt.h:1146:21 */
 44120  type FuncDestructor1 = struct {
 44121  	FnRef      int32
 44122  	FxDestroy  uintptr
 44123  	FpUserData uintptr
 44124  } /* sqliteInt.h:1147:9 */
 44125  
 44126  type FuncDestructor = FuncDestructor1 /* sqliteInt.h:1147:31 */
 44127  type FuncDef1 = struct {
 44128  	FnArg      i8
 44129  	_          [3]byte
 44130  	FfuncFlags u32
 44131  	FpUserData uintptr
 44132  	FpNext     uintptr
 44133  	FxSFunc    uintptr
 44134  	FxFinalize uintptr
 44135  	FxValue    uintptr
 44136  	FxInverse  uintptr
 44137  	FzName     uintptr
 44138  	Fu         struct{ FpHash uintptr }
 44139  } /* sqlite3.h:249:9 */
 44140  
 44141  type FuncDef = FuncDef1                      /* sqliteInt.h:1148:24 */
 44142  type FuncDefHash1 = struct{ Fa [23]uintptr } /* sqliteInt.h:1149:9 */
 44143  
 44144  type FuncDefHash = FuncDefHash1 /* sqliteInt.h:1149:28 */
 44145  type IdList1 = struct {
 44146  	Fa   uintptr
 44147  	FnId int32
 44148  } /* sqlite3.h:249:9 */
 44149  
 44150  type IdList = IdList1 /* sqliteInt.h:1150:23 */
 44151  type Index1 = struct {
 44152  	FzName         uintptr
 44153  	FaiColumn      uintptr
 44154  	FaiRowLogEst   uintptr
 44155  	FpTable        uintptr
 44156  	FzColAff       uintptr
 44157  	FpNext         uintptr
 44158  	FpSchema       uintptr
 44159  	FaSortOrder    uintptr
 44160  	FazColl        uintptr
 44161  	FpPartIdxWhere uintptr
 44162  	FaColExpr      uintptr
 44163  	Ftnum          Pgno
 44164  	FszIdxRow      LogEst
 44165  	FnKeyCol       u16
 44166  	FnColumn       u16
 44167  	FonError       u8
 44168  	_              [1]byte
 44169  	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 */
 44170  	_              [2]byte
 44171  	FnSample       int32
 44172  	FnSampleCol    int32
 44173  	FaAvgEq        uintptr
 44174  	FaSample       uintptr
 44175  	FaiRowEst      uintptr
 44176  	FnRowEst0      tRowcnt
 44177  	_              [4]byte
 44178  	FcolNotIdxed   Bitmask
 44179  } /* sqlite3.h:249:9 */
 44180  
 44181  type Index = Index1 /* sqliteInt.h:1151:22 */
 44182  type IndexSample1 = struct {
 44183  	Fp     uintptr
 44184  	Fn     int32
 44185  	FanEq  uintptr
 44186  	FanLt  uintptr
 44187  	FanDLt uintptr
 44188  } /* sqlite3.h:249:9 */
 44189  
 44190  type IndexSample = IndexSample1 /* sqliteInt.h:1152:28 */
 44191  type KeyInfo1 = struct {
 44192  	FnRef       u32
 44193  	Fenc        u8
 44194  	_           [1]byte
 44195  	FnKeyField  u16
 44196  	FnAllField  u16
 44197  	_           [2]byte
 44198  	Fdb         uintptr
 44199  	FaSortFlags uintptr
 44200  	FaColl      [1]uintptr
 44201  } /* sqlite3.h:249:9 */
 44202  
 44203  type KeyInfo = KeyInfo1 /* sqliteInt.h:1154:24 */
 44204  type Lookaside1 = struct {
 44205  	FbDisable   u32
 44206  	Fsz         u16
 44207  	FszTrue     u16
 44208  	FbMalloced  u8
 44209  	_           [3]byte
 44210  	FnSlot      u32
 44211  	FanStat     [3]u32
 44212  	FpInit      uintptr
 44213  	FpFree      uintptr
 44214  	FpSmallInit uintptr
 44215  	FpSmallFree uintptr
 44216  	FpMiddle    uintptr
 44217  	FpStart     uintptr
 44218  	FpEnd       uintptr
 44219  } /* sqlite3.h:249:9 */
 44220  
 44221  type Lookaside = Lookaside1                    /* sqliteInt.h:1155:26 */
 44222  type LookasideSlot1 = struct{ FpNext uintptr } /* sqlite3.h:249:9 */
 44223  
 44224  type LookasideSlot = LookasideSlot1 /* sqliteInt.h:1156:30 */
 44225  type Module1 = struct {
 44226  	FpModule    uintptr
 44227  	FzName      uintptr
 44228  	FnRefModule int32
 44229  	FpAux       uintptr
 44230  	FxDestroy   uintptr
 44231  	FpEpoTab    uintptr
 44232  } /* sqlite3.h:249:9 */
 44233  
 44234  type Module = Module1 /* sqliteInt.h:1157:23 */
 44235  type NameContext1 = struct {
 44236  	FpParse     uintptr
 44237  	FpSrcList   uintptr
 44238  	FuNC        struct{ FpEList uintptr }
 44239  	FpNext      uintptr
 44240  	FnRef       int32
 44241  	FnNcErr     int32
 44242  	FncFlags    int32
 44243  	FpWinSelect uintptr
 44244  } /* sqliteInt.h:1158:9 */
 44245  
 44246  type NameContext = NameContext1 /* sqliteInt.h:1158:28 */
 44247  type Parse1 = struct {
 44248  	Fdb               uintptr
 44249  	FzErrMsg          uintptr
 44250  	FpVdbe            uintptr
 44251  	Frc               int32
 44252  	FcolNamesSet      u8
 44253  	FcheckSchema      u8
 44254  	Fnested           u8
 44255  	FnTempReg         u8
 44256  	FisMultiWrite     u8
 44257  	FmayAbort         u8
 44258  	FhasCompound      u8
 44259  	FokConstFactor    u8
 44260  	FdisableLookaside u8
 44261  	FdisableVtab      u8
 44262  	_                 [2]byte
 44263  	FnRangeReg        int32
 44264  	FiRangeReg        int32
 44265  	FnErr             int32
 44266  	FnTab             int32
 44267  	FnMem             int32
 44268  	FszOpAlloc        int32
 44269  	FiSelfTab         int32
 44270  	FnLabel           int32
 44271  	FnLabelAlloc      int32
 44272  	FaLabel           uintptr
 44273  	FpConstExpr       uintptr
 44274  	FconstraintName   Token
 44275  	FwriteMask        yDbMask
 44276  	FcookieMask       yDbMask
 44277  	FregRowid         int32
 44278  	FregRoot          int32
 44279  	FnMaxArg          int32
 44280  	FnSelect          int32
 44281  	FnTableLock       int32
 44282  	FaTableLock       uintptr
 44283  	FpAinc            uintptr
 44284  	FpToplevel        uintptr
 44285  	FpTriggerTab      uintptr
 44286  	FpParentParse     uintptr
 44287  	Fu1               struct{ FaddrCrTab int32 }
 44288  	FnQueryLoop       u32
 44289  	Foldmask          u32
 44290  	Fnewmask          u32
 44291  	FeTriggerOp       u8
 44292  	FbReturning       u8
 44293  	FeOrconf          u8
 44294  	FdisableTriggers  u8
 44295  	FaTempReg         [8]int32
 44296  	FsNameToken       Token
 44297  	FsLastToken       Token
 44298  	FnVar             ynVar
 44299  	FiPkSortOrder     u8
 44300  	Fexplain          u8
 44301  	FeParseMode       u8
 44302  	_                 [3]byte
 44303  	FnVtabLock        int32
 44304  	FnHeight          int32
 44305  	FaddrExplain      int32
 44306  	FpVList           uintptr
 44307  	FpReprepare       uintptr
 44308  	FzTail            uintptr
 44309  	FpNewTable        uintptr
 44310  	FpNewIndex        uintptr
 44311  	FpNewTrigger      uintptr
 44312  	FzAuthContext     uintptr
 44313  	FsArg             Token
 44314  	FapVtabLock       uintptr
 44315  	FpTriggerPrg      uintptr
 44316  	FpWith            uintptr
 44317  	FpCleanup         uintptr
 44318  	FpRename          uintptr
 44319  } /* sqlite3.h:249:9 */
 44320  
 44321  type Parse = Parse1 /* sqliteInt.h:1159:22 */
 44322  type ParseCleanup1 = struct {
 44323  	FpNext    uintptr
 44324  	FpPtr     uintptr
 44325  	FxCleanup uintptr
 44326  } /* sqlite3.h:249:9 */
 44327  
 44328  type ParseCleanup = ParseCleanup1 /* sqliteInt.h:1160:29 */
 44329  type PreUpdate1 = struct {
 44330  	Fv            uintptr
 44331  	FpCsr         uintptr
 44332  	Fop           int32
 44333  	FaRecord      uintptr
 44334  	Fkeyinfo      KeyInfo
 44335  	FpUnpacked    uintptr
 44336  	FpNewUnpacked uintptr
 44337  	FiNewReg      int32
 44338  	FiBlobWrite   int32
 44339  	FiKey1        i64
 44340  	FiKey2        i64
 44341  	FaNew         uintptr
 44342  	FpTab         uintptr
 44343  	FpPk          uintptr
 44344  	_             [4]byte
 44345  } /* sqlite3.h:249:9 */
 44346  
 44347  type PreUpdate = PreUpdate1 /* sqliteInt.h:1161:26 */
 44348  type PrintfArguments1 = struct {
 44349  	FnArg  int32
 44350  	FnUsed int32
 44351  	FapArg uintptr
 44352  } /* sqliteInt.h:1162:9 */
 44353  
 44354  type PrintfArguments = PrintfArguments1 /* sqliteInt.h:1162:32 */
 44355  type Returning1 = struct {
 44356  	FpParse    uintptr
 44357  	FpReturnEL uintptr
 44358  	FretTrig   Trigger
 44359  	FretTStep  TriggerStep
 44360  	FiRetCur   int32
 44361  	FnRetCol   int32
 44362  	FiRetReg   int32
 44363  } /* sqliteInt.h:1164:9 */
 44364  
 44365  type Returning = Returning1 /* sqliteInt.h:1164:26 */
 44366  type Savepoint1 = struct {
 44367  	FzName            uintptr
 44368  	_                 [4]byte
 44369  	FnDeferredCons    i64
 44370  	FnDeferredImmCons i64
 44371  	FpNext            uintptr
 44372  	_                 [4]byte
 44373  } /* sqlite3.h:249:9 */
 44374  
 44375  type Savepoint = Savepoint1 /* sqliteInt.h:1166:26 */
 44376  type Select1 = struct {
 44377  	Fop           u8
 44378  	_             [1]byte
 44379  	FnSelectRow   LogEst
 44380  	FselFlags     u32
 44381  	FiLimit       int32
 44382  	FiOffset      int32
 44383  	FselId        u32
 44384  	FaddrOpenEphm [2]int32
 44385  	FpEList       uintptr
 44386  	FpSrc         uintptr
 44387  	FpWhere       uintptr
 44388  	FpGroupBy     uintptr
 44389  	FpHaving      uintptr
 44390  	FpOrderBy     uintptr
 44391  	FpPrior       uintptr
 44392  	FpNext        uintptr
 44393  	FpLimit       uintptr
 44394  	FpWith        uintptr
 44395  	FpWin         uintptr
 44396  	FpWinDefn     uintptr
 44397  } /* sqlite3.h:249:9 */
 44398  
 44399  type Select = Select1 /* sqliteInt.h:1167:23 */
 44400  type SelectDest1 = struct {
 44401  	FeDest    u8
 44402  	_         [3]byte
 44403  	FiSDParm  int32
 44404  	FiSDParm2 int32
 44405  	FiSdst    int32
 44406  	FnSdst    int32
 44407  	FzAffSdst uintptr
 44408  	FpOrderBy uintptr
 44409  } /* sqliteInt.h:1169:9 */
 44410  
 44411  type SelectDest = SelectDest1 /* sqliteInt.h:1169:27 */
 44412  type SrcItem1 = struct {
 44413  	FpSchema     uintptr
 44414  	FzDatabase   uintptr
 44415  	FzName       uintptr
 44416  	FzAlias      uintptr
 44417  	FpTab        uintptr
 44418  	FpSelect     uintptr
 44419  	FaddrFillSub int32
 44420  	FregReturn   int32
 44421  	FregResult   int32
 44422  	Ffg          struct {
 44423  		_           [0]uint32
 44424  		Fjointype   u8
 44425  		_           [3]byte
 44426  		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 */
 44427  		_           [2]byte
 44428  	}
 44429  	FiCursor int32
 44430  	FpOn     uintptr
 44431  	FpUsing  uintptr
 44432  	FcolUsed Bitmask
 44433  	Fu1      struct{ FzIndexedBy uintptr }
 44434  	Fu2      struct{ FpIBIndex uintptr }
 44435  } /* sqlite3.h:249:9 */
 44436  
 44437  type SrcItem = SrcItem1 /* sqliteInt.h:1170:24 */
 44438  type SrcList1 = struct {
 44439  	FnSrc   int32
 44440  	FnAlloc u32
 44441  	Fa      [1]SrcItem
 44442  } /* sqlite3.h:249:9 */
 44443  
 44444  type SrcList = SrcList1      /* sqliteInt.h:1171:24 */
 44445  type StrAccum = sqlite3_str1 /* sqliteInt.h:1172:28 */ // Internal alias for sqlite3_str
 44446  type Table1 = struct {
 44447  	FzName        uintptr
 44448  	FaCol         uintptr
 44449  	FpIndex       uintptr
 44450  	FpSelect      uintptr
 44451  	FpFKey        uintptr
 44452  	FzColAff      uintptr
 44453  	FpCheck       uintptr
 44454  	Ftnum         Pgno
 44455  	FnTabRef      u32
 44456  	FtabFlags     u32
 44457  	FiPKey        i16
 44458  	FnCol         i16
 44459  	FnNVCol       i16
 44460  	FnRowLogEst   LogEst
 44461  	FszTabRow     LogEst
 44462  	FkeyConf      u8
 44463  	_             [1]byte
 44464  	FaddColOffset int32
 44465  	FnModuleArg   int32
 44466  	FazModuleArg  uintptr
 44467  	FpVTable      uintptr
 44468  	FpTrigger     uintptr
 44469  	FpSchema      uintptr
 44470  } /* sqlite3.h:249:9 */
 44471  
 44472  // Internal alias for sqlite3_str
 44473  type Table = Table1 /* sqliteInt.h:1173:22 */
 44474  type Token1 = struct {
 44475  	Fz uintptr
 44476  	Fn uint32
 44477  } /* sqlite3.h:249:9 */
 44478  
 44479  type Token = Token1 /* sqliteInt.h:1175:22 */
 44480  type Trigger1 = struct {
 44481  	FzName      uintptr
 44482  	Ftable      uintptr
 44483  	Fop         u8
 44484  	Ftr_tm      u8
 44485  	FbReturning u8
 44486  	_           [1]byte
 44487  	FpWhen      uintptr
 44488  	FpColumns   uintptr
 44489  	FpSchema    uintptr
 44490  	FpTabSchema uintptr
 44491  	Fstep_list  uintptr
 44492  	FpNext      uintptr
 44493  } /* sqlite3.h:249:9 */
 44494  
 44495  type Trigger = Trigger1 /* sqliteInt.h:1177:24 */
 44496  type TriggerPrg1 = struct {
 44497  	FpTrigger uintptr
 44498  	FpNext    uintptr
 44499  	FpProgram uintptr
 44500  	Forconf   int32
 44501  	FaColmask [2]u32
 44502  } /* sqlite3.h:249:9 */
 44503  
 44504  type TriggerPrg = TriggerPrg1 /* sqliteInt.h:1178:27 */
 44505  type TriggerStep1 = struct {
 44506  	Fop        u8
 44507  	Forconf    u8
 44508  	_          [2]byte
 44509  	FpTrig     uintptr
 44510  	FpSelect   uintptr
 44511  	FzTarget   uintptr
 44512  	FpFrom     uintptr
 44513  	FpWhere    uintptr
 44514  	FpExprList uintptr
 44515  	FpIdList   uintptr
 44516  	FpUpsert   uintptr
 44517  	FzSpan     uintptr
 44518  	FpNext     uintptr
 44519  	FpLast     uintptr
 44520  } /* sqlite3.h:249:9 */
 44521  
 44522  type TriggerStep = TriggerStep1 /* sqliteInt.h:1179:28 */
 44523  type UnpackedRecord1 = struct {
 44524  	FpKeyInfo   uintptr
 44525  	FaMem       uintptr
 44526  	FnField     u16
 44527  	Fdefault_rc i8
 44528  	FerrCode    u8
 44529  	Fr1         i8
 44530  	Fr2         i8
 44531  	FeqSeen     u8
 44532  	_           [1]byte
 44533  } /* sqlite3.h:249:9 */
 44534  
 44535  type UnpackedRecord = UnpackedRecord1 /* sqliteInt.h:1180:31 */
 44536  type Upsert1 = struct {
 44537  	FpUpsertTarget      uintptr
 44538  	FpUpsertTargetWhere uintptr
 44539  	FpUpsertSet         uintptr
 44540  	FpUpsertWhere       uintptr
 44541  	FpNextUpsert        uintptr
 44542  	FisDoUpdate         u8
 44543  	_                   [3]byte
 44544  	FpToFree            uintptr
 44545  	FpUpsertIdx         uintptr
 44546  	FpUpsertSrc         uintptr
 44547  	FregData            int32
 44548  	FiDataCur           int32
 44549  	FiIdxCur            int32
 44550  } /* sqlite3.h:249:9 */
 44551  
 44552  type Upsert = Upsert1 /* sqliteInt.h:1181:23 */
 44553  type VTable1 = struct {
 44554  	Fdb          uintptr
 44555  	FpMod        uintptr
 44556  	FpVtab       uintptr
 44557  	FnRef        int32
 44558  	FbConstraint u8
 44559  	FeVtabRisk   u8
 44560  	_            [2]byte
 44561  	FiSavepoint  int32
 44562  	FpNext       uintptr
 44563  } /* sqlite3.h:249:9 */
 44564  
 44565  type VTable = VTable1 /* sqliteInt.h:1182:23 */
 44566  type Walker1 = struct {
 44567  	FpParse           uintptr
 44568  	FxExprCallback    uintptr
 44569  	FxSelectCallback  uintptr
 44570  	FxSelectCallback2 uintptr
 44571  	FwalkerDepth      int32
 44572  	FeCode            u16
 44573  	_                 [2]byte
 44574  	Fu                struct{ FpNC uintptr }
 44575  } /* sqliteInt.h:1142:9 */
 44576  
 44577  type Walker = Walker1 /* sqliteInt.h:1184:23 */
 44578  type Window1 = struct {
 44579  	FzName          uintptr
 44580  	FzBase          uintptr
 44581  	FpPartition     uintptr
 44582  	FpOrderBy       uintptr
 44583  	FeFrmType       u8
 44584  	FeStart         u8
 44585  	FeEnd           u8
 44586  	FbImplicitFrame u8
 44587  	FeExclude       u8
 44588  	_               [3]byte
 44589  	FpStart         uintptr
 44590  	FpEnd           uintptr
 44591  	FppThis         uintptr
 44592  	FpNextWin       uintptr
 44593  	FpFilter        uintptr
 44594  	FpFunc          uintptr
 44595  	FiEphCsr        int32
 44596  	FregAccum       int32
 44597  	FregResult      int32
 44598  	FcsrApp         int32
 44599  	FregApp         int32
 44600  	FregPart        int32
 44601  	FpOwner         uintptr
 44602  	FnBufferCol     int32
 44603  	FiArgCol        int32
 44604  	FregOne         int32
 44605  	FregStartRowid  int32
 44606  	FregEndRowid    int32
 44607  	FbExprArgs      u8
 44608  	_               [3]byte
 44609  } /* sqlite3.h:249:9 */
 44610  
 44611  type Window = Window1 /* sqliteInt.h:1186:23 */
 44612  type With1 = struct {
 44613  	FnCte   int32
 44614  	FbView  int32
 44615  	FpOuter uintptr
 44616  	Fa      [1]Cte
 44617  } /* sqlite3.h:249:9 */
 44618  
 44619  type With = With1 /* sqliteInt.h:1187:21 */
 44620  
 44621  // The bitmask datatype defined below is used for various optimizations.
 44622  //
 44623  // Changing this from a 64-bit to a 32-bit type limits the number of
 44624  // tables in a join to 32 instead of 64.  But it also reduces the size
 44625  // of the library by 738 bytes on ix86.
 44626  type Bitmask = u64 /* sqliteInt.h:1200:15 */
 44627  
 44628  // The number of bits in a Bitmask.  "BMS" means "BitMask Size".
 44629  
 44630  // A bit in a Bitmask
 44631  
 44632  // A VList object records a mapping between parameters/variables/wildcards
 44633  // in the SQL statement (such as $abc, @pqr, or :xyz) and the integer
 44634  // variable number associated with that parameter.  See the format description
 44635  // on the sqlite3VListAdd() routine for more information.  A VList is really
 44636  // just an array of integers.
 44637  type VList = int32 /* sqliteInt.h:1222:13 */
 44638  
 44639  // Defer sourcing vdbe.h and btree.h until after the "u8" and
 44640  // "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
 44641  // pointer types (i.e. FuncDef) defined above.
 44642  // 2001 September 15
 44643  //
 44644  // The author disclaims copyright to this source code.  In place of
 44645  // a legal notice, here is a blessing:
 44646  //
 44647  //    May you do good and not evil.
 44648  //    May you find forgiveness for yourself and forgive others.
 44649  //    May you share freely, never taking more than you give.
 44650  //
 44651  //
 44652  // This header file defines the interface that the sqlite page cache
 44653  // subsystem.  The page cache subsystem reads and writes a file a page
 44654  // at a time and provides a journal for rollback.
 44655  
 44656  // Default maximum size for persistent journal files. A negative
 44657  // value means no limit. This value may be overridden using the
 44658  // sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit".
 44659  
 44660  // The type used to represent a page number.  The first page in a file
 44661  // is called page 1.  0 is used to represent "not a page".
 44662  type Pgno = u32 /* pager.h:33:13 */
 44663  
 44664  // Handle type for pages.
 44665  type PgHdr1 = struct {
 44666  	FpPage      uintptr
 44667  	FpData      uintptr
 44668  	FpExtra     uintptr
 44669  	FpCache     uintptr
 44670  	FpDirty     uintptr
 44671  	FpPager     uintptr
 44672  	Fpgno       Pgno
 44673  	Fflags      u16
 44674  	FnRef       i16
 44675  	FpDirtyNext uintptr
 44676  	FpDirtyPrev uintptr
 44677  } /* pager.h:43:9 */
 44678  
 44679  // Handle type for pages.
 44680  type DbPage = PgHdr1 /* pager.h:43:22 */
 44681  
 44682  // 2001 September 15
 44683  //
 44684  // The author disclaims copyright to this source code.  In place of
 44685  // a legal notice, here is a blessing:
 44686  //
 44687  //    May you do good and not evil.
 44688  //    May you find forgiveness for yourself and forgive others.
 44689  //    May you share freely, never taking more than you give.
 44690  //
 44691  //
 44692  // This header file defines the interface that the sqlite B-Tree file
 44693  // subsystem.  See comments in the source code for a detailed description
 44694  // of what each interface routine does.
 44695  
 44696  // TODO: This definition is just included so other modules compile. It
 44697  // needs to be revisited.
 44698  
 44699  // If defined as non-zero, auto-vacuum is enabled by default. Otherwise
 44700  // it must be turned on for each database using "PRAGMA auto_vacuum = 1".
 44701  
 44702  // Forward declarations of structure
 44703  type Btree1 = struct {
 44704  	Fdb             uintptr
 44705  	FpBt            uintptr
 44706  	FinTrans        u8
 44707  	Fsharable       u8
 44708  	Flocked         u8
 44709  	FhasIncrblobCur u8
 44710  	FwantToLock     int32
 44711  	FnBackup        int32
 44712  	FiBDataVersion  u32
 44713  	FpNext          uintptr
 44714  	FpPrev          uintptr
 44715  	Flock           BtLock
 44716  } /* btree.h:39:9 */
 44717  
 44718  type BtCursor1 = struct {
 44719  	FeState        u8
 44720  	FcurFlags      u8
 44721  	FcurPagerFlags u8
 44722  	Fhints         u8
 44723  	FskipNext      int32
 44724  	FpBtree        uintptr
 44725  	FaOverflow     uintptr
 44726  	FpKey          uintptr
 44727  	FpBt           uintptr
 44728  	FpNext         uintptr
 44729  	_              [4]byte
 44730  	Finfo          CellInfo
 44731  	FnKey          i64
 44732  	FpgnoRoot      Pgno
 44733  	FiPage         i8
 44734  	FcurIntKey     u8
 44735  	Fix            u16
 44736  	FaiIdx         [19]u16
 44737  	_              [2]byte
 44738  	FpKeyInfo      uintptr
 44739  	FpPage         uintptr
 44740  	FapPage        [19]uintptr
 44741  	_              [4]byte
 44742  } /* btree.h:39:9 */
 44743  
 44744  type BtShared1 = struct {
 44745  	FpPager          uintptr
 44746  	Fdb              uintptr
 44747  	FpCursor         uintptr
 44748  	FpPage1          uintptr
 44749  	FopenFlags       u8
 44750  	FautoVacuum      u8
 44751  	FincrVacuum      u8
 44752  	FbDoTruncate     u8
 44753  	FinTransaction   u8
 44754  	Fmax1bytePayload u8
 44755  	FnReserveWanted  u8
 44756  	_                [1]byte
 44757  	FbtsFlags        u16
 44758  	FmaxLocal        u16
 44759  	FminLocal        u16
 44760  	FmaxLeaf         u16
 44761  	FminLeaf         u16
 44762  	_                [2]byte
 44763  	FpageSize        u32
 44764  	FusableSize      u32
 44765  	FnTransaction    int32
 44766  	FnPage           u32
 44767  	FpSchema         uintptr
 44768  	FxFreeSchema     uintptr
 44769  	Fmutex           uintptr
 44770  	FpHasContent     uintptr
 44771  	FnRef            int32
 44772  	FpNext           uintptr
 44773  	FpLock           uintptr
 44774  	FpWriter         uintptr
 44775  	FpTmpSpace       uintptr
 44776  	FnPreformatSize  int32
 44777  } /* btree.h:39:9 */
 44778  
 44779  type BtreePayload1 = struct {
 44780  	FpKey  uintptr
 44781  	_      [4]byte
 44782  	FnKey  sqlite3_int64
 44783  	FpData uintptr
 44784  	FaMem  uintptr
 44785  	FnMem  u16
 44786  	_      [2]byte
 44787  	FnData int32
 44788  	FnZero int32
 44789  	_      [4]byte
 44790  } /* btree.h:42:9 */
 44791  
 44792  type BtreePayload = BtreePayload1 /* btree.h:42:29 */
 44793  
 44794  // 2001 September 15
 44795  //
 44796  // The author disclaims copyright to this source code.  In place of
 44797  // a legal notice, here is a blessing:
 44798  //
 44799  //    May you do good and not evil.
 44800  //    May you find forgiveness for yourself and forgive others.
 44801  //    May you share freely, never taking more than you give.
 44802  //
 44803  //
 44804  // Header file for the Virtual DataBase Engine (VDBE)
 44805  //
 44806  // This header defines the interface to the virtual database engine
 44807  // or VDBE.  The VDBE implements an abstract machine that runs a
 44808  // simple program to access and modify the underlying database.
 44809  // Define ISO C stdio on top of C++ iostreams.
 44810  //    Copyright (C) 1991-2018 Free Software Foundation, Inc.
 44811  //    This file is part of the GNU C Library.
 44812  //
 44813  //    The GNU C Library is free software; you can redistribute it and/or
 44814  //    modify it under the terms of the GNU Lesser General Public
 44815  //    License as published by the Free Software Foundation; either
 44816  //    version 2.1 of the License, or (at your option) any later version.
 44817  //
 44818  //    The GNU C Library is distributed in the hope that it will be useful,
 44819  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 44820  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 44821  //    Lesser General Public License for more details.
 44822  //
 44823  //    You should have received a copy of the GNU Lesser General Public
 44824  //    License along with the GNU C Library; if not, see
 44825  //    <http://www.gnu.org/licenses/>.
 44826  
 44827  //	ISO C99 Standard: 7.19 Input/output	<stdio.h>
 44828  
 44829  // A single VDBE is an opaque structure named "Vdbe".  Only routines
 44830  // in the source file sqliteVdbe.c are allowed to see the insides
 44831  // of this structure.
 44832  type Vdbe1 = struct {
 44833  	Fdb                 uintptr
 44834  	FpPrev              uintptr
 44835  	FpNext              uintptr
 44836  	FpParse             uintptr
 44837  	FnVar               ynVar
 44838  	_                   [2]byte
 44839  	FiVdbeMagic         u32
 44840  	FnMem               int32
 44841  	FnCursor            int32
 44842  	FcacheCtr           u32
 44843  	Fpc                 int32
 44844  	Frc                 int32
 44845  	FnChange            int32
 44846  	FiStatement         int32
 44847  	_                   [4]byte
 44848  	FiCurrentTime       i64
 44849  	FnFkConstraint      i64
 44850  	FnStmtDefCons       i64
 44851  	FnStmtDefImmCons    i64
 44852  	FaMem               uintptr
 44853  	FapArg              uintptr
 44854  	FapCsr              uintptr
 44855  	FaVar               uintptr
 44856  	FaOp                uintptr
 44857  	FnOp                int32
 44858  	FnOpAlloc           int32
 44859  	FaColName           uintptr
 44860  	FpResultSet         uintptr
 44861  	FzErrMsg            uintptr
 44862  	FpVList             uintptr
 44863  	_                   [4]byte
 44864  	FstartTime          i64
 44865  	FnResColumn         u16
 44866  	FerrorAction        u8
 44867  	FminWriteFileFormat u8
 44868  	FprepFlags          u8
 44869  	FdoingRerun         u8
 44870  	_                   [2]byte
 44871  	Fexpired            uint16 /* bft expired: 2, bft explain: 2, bft changeCntOn: 1, bft runOnlyOnce: 1, bft usesStmtJournal: 1, bft readOnly: 1, bft bIsReader: 1 */
 44872  	_                   [2]byte
 44873  	FbtreeMask          yDbMask
 44874  	FlockMask           yDbMask
 44875  	FaCounter           [7]u32
 44876  	FzSql               uintptr
 44877  	FpFree              uintptr
 44878  	FpFrame             uintptr
 44879  	FpDelFrame          uintptr
 44880  	FnFrame             int32
 44881  	Fexpmask            u32
 44882  	FpProgram           uintptr
 44883  	FpAuxData           uintptr
 44884  } /* sqlite3.h:249:9 */
 44885  
 44886  // 2001 September 15
 44887  //
 44888  // The author disclaims copyright to this source code.  In place of
 44889  // a legal notice, here is a blessing:
 44890  //
 44891  //    May you do good and not evil.
 44892  //    May you find forgiveness for yourself and forgive others.
 44893  //    May you share freely, never taking more than you give.
 44894  //
 44895  //
 44896  // Header file for the Virtual DataBase Engine (VDBE)
 44897  //
 44898  // This header defines the interface to the virtual database engine
 44899  // or VDBE.  The VDBE implements an abstract machine that runs a
 44900  // simple program to access and modify the underlying database.
 44901  // Define ISO C stdio on top of C++ iostreams.
 44902  //    Copyright (C) 1991-2018 Free Software Foundation, Inc.
 44903  //    This file is part of the GNU C Library.
 44904  //
 44905  //    The GNU C Library is free software; you can redistribute it and/or
 44906  //    modify it under the terms of the GNU Lesser General Public
 44907  //    License as published by the Free Software Foundation; either
 44908  //    version 2.1 of the License, or (at your option) any later version.
 44909  //
 44910  //    The GNU C Library is distributed in the hope that it will be useful,
 44911  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 44912  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 44913  //    Lesser General Public License for more details.
 44914  //
 44915  //    You should have received a copy of the GNU Lesser General Public
 44916  //    License along with the GNU C Library; if not, see
 44917  //    <http://www.gnu.org/licenses/>.
 44918  
 44919  //	ISO C99 Standard: 7.19 Input/output	<stdio.h>
 44920  
 44921  // A single VDBE is an opaque structure named "Vdbe".  Only routines
 44922  // in the source file sqliteVdbe.c are allowed to see the insides
 44923  // of this structure.
 44924  type Vdbe = Vdbe1 /* vdbe.h:27:21 */
 44925  
 44926  // The names of the following types declared in vdbeInt.h are required
 44927  // for the VdbeOp definition.
 44928  type Mem = sqlite3_value1 /* vdbe.h:33:30 */
 44929  type SubProgram1 = struct {
 44930  	FaOp   uintptr
 44931  	FnOp   int32
 44932  	FnMem  int32
 44933  	FnCsr  int32
 44934  	FaOnce uintptr
 44935  	Ftoken uintptr
 44936  	FpNext uintptr
 44937  } /* sqlite3.h:249:9 */
 44938  
 44939  type SubProgram = SubProgram1 /* vdbe.h:34:27 */
 44940  
 44941  // A single instruction of the virtual machine has an opcode
 44942  // and as many as three operands.  The instruction is recorded
 44943  // as an instance of the following structure:
 44944  type VdbeOp1 = struct {
 44945  	Fopcode   u8
 44946  	Fp4type   int8
 44947  	Fp5       u16
 44948  	Fp1       int32
 44949  	Fp2       int32
 44950  	Fp3       int32
 44951  	Fp4       struct{ Fi int32 }
 44952  	FzComment uintptr
 44953  } /* sqlite3.h:249:9 */
 44954  
 44955  // A single instruction of the virtual machine has an opcode
 44956  // and as many as three operands.  The instruction is recorded
 44957  // as an instance of the following structure:
 44958  type p4union = struct{ Fi int32 } /* sqlite3.h:249:9 */
 44959  
 44960  type VdbeOp = VdbeOp1 /* vdbe.h:80:23 */
 44961  
 44962  // A smaller version of VdbeOp used for the VdbeAddOpList() function because
 44963  // it takes up less space.
 44964  type VdbeOpList1 = struct {
 44965  	Fopcode u8
 44966  	Fp1     int8
 44967  	Fp2     int8
 44968  	Fp3     int8
 44969  } /* vdbe.h:100:1 */
 44970  
 44971  type VdbeOpList = VdbeOpList1 /* vdbe.h:106:27 */
 44972  
 44973  type RecordCompare = uintptr /* vdbe.h:286:13 */
 44974  
 44975  // The VdbeCoverage macros are used to set a coverage testing point
 44976  // for VDBE branch instructions.  The coverage testing points are line
 44977  // numbers in the sqlite3.c source file.  VDBE branch coverage testing
 44978  // only works with an amalagmation build.  That's ok since a VDBE branch
 44979  // coverage build designed for testing the test suite only.  No application
 44980  // should ever ship with VDBE branch coverage measuring turned on.
 44981  //
 44982  //    VdbeCoverage(v)                  // Mark the previously coded instruction
 44983  //                                     // as a branch
 44984  //
 44985  //    VdbeCoverageIf(v, conditional)   // Mark previous if conditional true
 44986  //
 44987  //    VdbeCoverageAlwaysTaken(v)       // Previous branch is always taken
 44988  //
 44989  //    VdbeCoverageNeverTaken(v)        // Previous branch is never taken
 44990  //
 44991  //    VdbeCoverageNeverNull(v)         // Previous three-way branch is only
 44992  //                                     // taken on the first two ways.  The
 44993  //                                     // NULL option is not possible
 44994  //
 44995  //    VdbeCoverageEqNe(v)              // Previous OP_Jump is only interested
 44996  //                                     // in distingishing equal and not-equal.
 44997  //
 44998  // Every VDBE branch operation must be tagged with one of the macros above.
 44999  // If not, then when "make test" is run with -DSQLITE_VDBE_COVERAGE and
 45000  // -DSQLITE_DEBUG then an ALWAYS() will fail in the vdbeTakeBranch()
 45001  // routine in vdbe.c, alerting the developer to the missed tag.
 45002  //
 45003  // During testing, the test application will invoke
 45004  // sqlite3_test_control(SQLITE_TESTCTRL_VDBE_COVERAGE,...) to set a callback
 45005  // routine that is invoked as each bytecode branch is taken.  The callback
 45006  // contains the sqlite3.c source line number ov the VdbeCoverage macro and
 45007  // flags to indicate whether or not the branch was taken.  The test application
 45008  // is responsible for keeping track of this and reporting byte-code branches
 45009  // that are never taken.
 45010  //
 45011  // See the VdbeBranchTaken() macro and vdbeTakeBranch() function in the
 45012  // vdbe.c source file for additional information.
 45013  
 45014  // 2008 August 05
 45015  //
 45016  // The author disclaims copyright to this source code.  In place of
 45017  // a legal notice, here is a blessing:
 45018  //
 45019  //    May you do good and not evil.
 45020  //    May you find forgiveness for yourself and forgive others.
 45021  //    May you share freely, never taking more than you give.
 45022  //
 45023  //
 45024  // This header file defines the interface that the sqlite page cache
 45025  // subsystem.
 45026  
 45027  type PgHdr = PgHdr1 /* pcache.h:18:22 */
 45028  
 45029  // typedef for the authorization callback function.
 45030  type sqlite3_xauth = uintptr /* sqliteInt.h:1468:15 */
 45031  
 45032  // This is an extra SQLITE_TRACE macro that indicates "legacy" tracing
 45033  // in the style of sqlite3_trace()
 45034  
 45035  // Maximum number of sqlite3.aDb[] entries.  This is the number of attached
 45036  // databases plus 2 for "main" and "temp".
 45037  
 45038  // Each database connection is an instance of the following structure.
 45039  type sqlite3InitInfo = struct {
 45040  	FnewTnum       Pgno
 45041  	FiDb           u8
 45042  	Fbusy          u8
 45043  	_              [2]byte
 45044  	ForphanTrigger uint8 /* unsigned orphanTrigger: 1, unsigned imposterTable: 1, unsigned reopenMemdb: 1 */
 45045  	_              [3]byte
 45046  	FazInit        uintptr
 45047  } /* sqlite3.h:249:9 */
 45048  
 45049  // Allowed values for Table.tabFlags.
 45050  //
 45051  // TF_OOOHidden applies to tables or view that have hidden columns that are
 45052  // followed by non-hidden columns.  Example:  "CREATE VIRTUAL TABLE x USING
 45053  // vtab1(a HIDDEN, b);".  Since "b" is a non-hidden column but "a" is hidden,
 45054  // the TF_OOOHidden attribute would apply in this case.  Such tables require
 45055  // special handling during INSERT processing. The "OOO" means "Out Of Order".
 45056  //
 45057  // Constraints:
 45058  //
 45059  //         TF_HasVirtual == COLFLAG_VIRTUAL
 45060  //         TF_HasStored  == COLFLAG_STORED
 45061  //         TF_HasHidden  == COLFLAG_HIDDEN
 45062  
 45063  // Test to see whether or not a table is a virtual table.  This is
 45064  // done as a macro so that it will be optimized out when virtual
 45065  // table support is omitted from the build.
 45066  
 45067  // Macros to determine if a column is hidden.  IsOrdinaryHiddenColumn()
 45068  // only works for non-virtual tables (ordinary tables and views) and is
 45069  // always false unless SQLITE_ENABLE_HIDDEN_COLUMNS is defined.  The
 45070  // IsHiddenColumn() macro is general purpose.
 45071  
 45072  // Does the table have a rowid
 45073  
 45074  // Each foreign key constraint is an instance of the following structure.
 45075  //
 45076  // A foreign key is associated with two tables.  The "from" table is
 45077  // the table that contains the REFERENCES clause that creates the foreign
 45078  // key.  The "to" table is the table that is named in the REFERENCES clause.
 45079  // Consider this example:
 45080  //
 45081  //     CREATE TABLE ex1(
 45082  //       a INTEGER PRIMARY KEY,
 45083  //       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
 45084  //     );
 45085  //
 45086  // For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
 45087  // Equivalent names:
 45088  //
 45089  //     from-table == child-table
 45090  //       to-table == parent-table
 45091  //
 45092  // Each REFERENCES clause generates an instance of the following structure
 45093  // which is attached to the from-table.  The to-table need not exist when
 45094  // the from-table is created.  The existence of the to-table is not checked.
 45095  //
 45096  // The list of all parents for child Table X is held at X.pFKey.
 45097  //
 45098  // A list of all children for a table named Z (which might not even exist)
 45099  // is held in Schema.fkeyHash with a hash key of Z.
 45100  type sColMap = struct {
 45101  	FiFrom int32
 45102  	FzCol  uintptr
 45103  } /* sqlite3.h:249:9 */
 45104  
 45105  // An instance of this structure contains information needed to generate
 45106  // code for a SELECT that contains aggregate functions.
 45107  //
 45108  // If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
 45109  // pointer to this structure.  The Expr.iAgg field is the index in
 45110  // AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
 45111  // code for that node.
 45112  //
 45113  // AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
 45114  // original Select structure that describes the SELECT statement.  These
 45115  // fields do not need to be freed when deallocating the AggInfo structure.
 45116  type AggInfo_col = struct {
 45117  	FpTab          uintptr
 45118  	FpCExpr        uintptr
 45119  	FiTable        int32
 45120  	FiMem          int32
 45121  	FiColumn       i16
 45122  	FiSorterColumn i16
 45123  } /* sqlite3.h:249:9 */
 45124  
 45125  // An instance of this structure contains information needed to generate
 45126  // code for a SELECT that contains aggregate functions.
 45127  //
 45128  // If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
 45129  // pointer to this structure.  The Expr.iAgg field is the index in
 45130  // AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
 45131  // code for that node.
 45132  //
 45133  // AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
 45134  // original Select structure that describes the SELECT statement.  These
 45135  // fields do not need to be freed when deallocating the AggInfo structure.
 45136  type AggInfo_func = struct {
 45137  	FpFExpr    uintptr
 45138  	FpFunc     uintptr
 45139  	FiMem      int32
 45140  	FiDistinct int32
 45141  	FiDistAddr int32
 45142  } /* sqlite3.h:249:9 */
 45143  
 45144  // The datatype ynVar is a signed integer, either 16-bit or 32-bit.
 45145  // Usually it is 16-bits.  But if SQLITE_MAX_VARIABLE_NUMBER is greater
 45146  // than 32767 we have to make it 32-bit.  16-bit is preferred because
 45147  // it uses less memory in the Expr object, which is a big memory user
 45148  // in systems with lots of prepared statements.  And few applications
 45149  // need more than about 10 or 20 variables.  But some extreme users want
 45150  // to have prepared statements with over 32766 variables, and for them
 45151  // the option is available (at compile-time).
 45152  type ynVar = i16 /* sqliteInt.h:2622:13 */
 45153  
 45154  // The following are the meanings of bits in the Expr.flags field.
 45155  // Value restrictions:
 45156  //
 45157  //          EP_Agg == NC_HasAgg == SF_HasAgg
 45158  //          EP_Win == NC_HasWin
 45159  //   0x400000 // Available
 45160  //   0x80000000 // Available
 45161  
 45162  // The EP_Propagate mask is a set of properties that automatically propagate
 45163  // upwards into parent nodes.
 45164  
 45165  // These macros can be used to test, set, or clear bits in the
 45166  // Expr.flags field.
 45167  
 45168  // Flags for use with Expr.vvaFlags
 45169  
 45170  // The ExprSetVVAProperty() macro is used for Verification, Validation,
 45171  // and Accreditation only.  It works like ExprSetProperty() during VVA
 45172  // processes but is a no-op for delivery.
 45173  
 45174  // Macros to determine the number of bytes required by a normal Expr
 45175  // struct, an Expr struct with the EP_Reduced flag set in Expr.flags
 45176  // and an Expr struct with the EP_TokenOnly flag set.
 45177  
 45178  // Flags passed to the sqlite3ExprDup() function. See the header comment
 45179  // above sqlite3ExprDup() for details.
 45180  
 45181  // True if the expression passed as an argument was a function with
 45182  // an OVER() clause (a window function).
 45183  
 45184  // A list of expressions.  Each expression may optionally have a
 45185  // name.  An expr/name combination can be used in several ways, such
 45186  // as the list of "expr AS ID" fields following a "SELECT" or in the
 45187  // list of "ID = expr" items in an UPDATE.  A list of expressions can
 45188  // also be used as the argument to a function, in which case the a.zName
 45189  // field is not used.
 45190  //
 45191  // In order to try to keep memory usage down, the Expr.a.zEName field
 45192  // is used for multiple purposes:
 45193  //
 45194  //     eEName          Usage
 45195  //    ----------       -------------------------
 45196  //    ENAME_NAME       (1) the AS of result set column
 45197  //                     (2) COLUMN= of an UPDATE
 45198  //
 45199  //    ENAME_TAB        DB.TABLE.NAME used to resolve names
 45200  //                     of subqueries
 45201  //
 45202  //    ENAME_SPAN       Text of the original result set
 45203  //                     expression.
 45204  type ExprList_item = struct {
 45205  	FpExpr     uintptr
 45206  	FzEName    uintptr
 45207  	FsortFlags u8
 45208  	_          [3]byte
 45209  	FeEName    uint8 /* unsigned eEName: 2, unsigned done: 1, unsigned reusable: 1, unsigned bSorterRef: 1, unsigned bNulls: 1 */
 45210  	_          [3]byte
 45211  	Fu         struct {
 45212  		_  [0]uint32
 45213  		Fx struct {
 45214  			FiOrderByCol u16
 45215  			FiAlias      u16
 45216  		}
 45217  	}
 45218  } /* sqlite3.h:249:9 */
 45219  
 45220  // Allowed values for Expr.a.eEName
 45221  
 45222  // An instance of this structure can hold a simple list of identifiers,
 45223  // such as the list "a,b,c" in the following statements:
 45224  //
 45225  //      INSERT INTO t(a,b,c) VALUES ...;
 45226  //      CREATE INDEX idx ON t(a,b,c);
 45227  //      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
 45228  //
 45229  // The IdList.a.idx field is used when the IdList represents the list of
 45230  // column names after a table name in an INSERT statement.  In the statement
 45231  //
 45232  //     INSERT INTO t(a,b,c) ...
 45233  //
 45234  // If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
 45235  type IdList_item = struct {
 45236  	FzName uintptr
 45237  	Fidx   int32
 45238  } /* sqlite3.h:249:9 */
 45239  
 45240  // The yDbMask datatype for the bitmask of all attached databases.
 45241  type yDbMask = uint32 /* sqliteInt.h:3379:24 */
 45242  
 45243  // A pointer to this structure is used to communicate information
 45244  // from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
 45245  type InitData = struct {
 45246  	Fdb         uintptr
 45247  	FpzErrMsg   uintptr
 45248  	FiDb        int32
 45249  	Frc         int32
 45250  	FmInitFlags u32
 45251  	FnInitRow   u32
 45252  	FmxPage     Pgno
 45253  } /* sqliteInt.h:3737:3 */
 45254  
 45255  // Allowed values for mInitFlags
 45256  
 45257  // Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled
 45258  // on debug-builds of the CLI using ".testctrl tune ID VALUE".  Tuning
 45259  // parameters are for temporary use during development, to help find
 45260  // optimial values for parameters in the query planner.  The should not
 45261  // be used on trunk check-ins.  They are a temporary mechanism available
 45262  // for transient development builds only.
 45263  //
 45264  // Tuning parameters are numbered starting with 1.
 45265  
 45266  // Structure containing global configuration data for the SQLite library.
 45267  //
 45268  // This structure also contains some state information.
 45269  type Sqlite3Config = struct {
 45270  	FbMemstat            int32
 45271  	FbCoreMutex          u8
 45272  	FbFullMutex          u8
 45273  	FbOpenUri            u8
 45274  	FbUseCis             u8
 45275  	FbSmallMalloc        u8
 45276  	FbExtraSchemaChecks  u8
 45277  	_                    [2]byte
 45278  	FmxStrlen            int32
 45279  	FneverCorrupt        int32
 45280  	FszLookaside         int32
 45281  	FnLookaside          int32
 45282  	FnStmtSpill          int32
 45283  	Fm                   sqlite3_mem_methods
 45284  	Fmutex               sqlite3_mutex_methods
 45285  	Fpcache2             sqlite3_pcache_methods2
 45286  	FpHeap               uintptr
 45287  	FnHeap               int32
 45288  	FmnReq               int32
 45289  	FmxReq               int32
 45290  	FszMmap              sqlite3_int64
 45291  	FmxMmap              sqlite3_int64
 45292  	FpPage               uintptr
 45293  	FszPage              int32
 45294  	FnPage               int32
 45295  	FmxParserStack       int32
 45296  	FsharedCacheEnabled  int32
 45297  	FszPma               u32
 45298  	FisInit              int32
 45299  	FinProgress          int32
 45300  	FisMutexInit         int32
 45301  	FisMallocInit        int32
 45302  	FisPCacheInit        int32
 45303  	FnRefInitMutex       int32
 45304  	FpInitMutex          uintptr
 45305  	FxLog                uintptr
 45306  	FpLogArg             uintptr
 45307  	_                    [4]byte
 45308  	FmxMemdbSize         sqlite3_int64
 45309  	FxTestCallback       uintptr
 45310  	FbLocaltimeFault     int32
 45311  	FiOnceResetThreshold int32
 45312  	FszSorterRef         u32
 45313  	FiPrngSeed           uint32
 45314  	_                    [4]byte
 45315  } /* sqliteInt.h:3766:1 */
 45316  
 45317  // 2003 September 6
 45318  //
 45319  // The author disclaims copyright to this source code.  In place of
 45320  // a legal notice, here is a blessing:
 45321  //
 45322  //    May you do good and not evil.
 45323  //    May you find forgiveness for yourself and forgive others.
 45324  //    May you share freely, never taking more than you give.
 45325  //
 45326  //
 45327  // This is the header file for information that is private to the
 45328  // VDBE.  This information used to all be at the top of the single
 45329  // source code file "vdbe.c".  When that file became too big (over
 45330  // 6000 lines long) it was split up into several smaller files and
 45331  // this header information was factored out.
 45332  
 45333  // The maximum number of times that a statement will try to reparse
 45334  // itself before giving up and returning SQLITE_SCHEMA.
 45335  
 45336  // VDBE_DISPLAY_P4 is true or false depending on whether or not the
 45337  // "explain" P4 display logic is enabled.
 45338  
 45339  // SQL is translated into a sequence of instructions to be
 45340  // executed by a virtual machine.  Each instruction is an instance
 45341  // of the following structure.
 45342  type Op = VdbeOp1 /* vdbeInt.h:46:23 */
 45343  
 45344  // Boolean values
 45345  type Bool = uint32 /* vdbeInt.h:51:18 */
 45346  
 45347  // Elements of the linked list at Vdbe.pAuxData
 45348  type AuxData1 = struct {
 45349  	FiAuxOp     int32
 45350  	FiAuxArg    int32
 45351  	FpAux       uintptr
 45352  	FxDeleteAux uintptr
 45353  	FpNextAux   uintptr
 45354  } /* sqlite3.h:249:9 */
 45355  
 45356  // Elements of the linked list at Vdbe.pAuxData
 45357  type AuxData = AuxData1 /* vdbeInt.h:57:24 */
 45358  
 45359  // Types of VDBE cursors
 45360  
 45361  // A VdbeCursor is an superclass (a wrapper) for various cursor objects:
 45362  //
 45363  //      * A b-tree cursor
 45364  //          -  In the main database or in an ephemeral database
 45365  //          -  On either an index or a table
 45366  //      * A sorter
 45367  //      * A virtual table
 45368  //      * A one-row "pseudotable" stored in a single register
 45369  type VdbeCursor1 = struct {
 45370  	FeCurType       u8
 45371  	FiDb            i8
 45372  	FnullRow        u8
 45373  	FdeferredMoveto u8
 45374  	FisTable        u8
 45375  	_               [3]byte
 45376  	FisEphemeral    uint8 /* Bool isEphemeral: 1, Bool useRandomRowid: 1, Bool isOrdered: 1, Bool hasBeenDuped: 1 */
 45377  	_               [1]byte
 45378  	FseekHit        u16
 45379  	FpBtx           uintptr
 45380  	FseqCount       i64
 45381  	FaAltMap        uintptr
 45382  	FcacheStatus    u32
 45383  	FseekResult     int32
 45384  	FpAltCursor     uintptr
 45385  	Fuc             struct{ FpCursor uintptr }
 45386  	FpKeyInfo       uintptr
 45387  	FiHdrOffset     u32
 45388  	FpgnoRoot       Pgno
 45389  	FnField         i16
 45390  	FnHdrParsed     u16
 45391  	_               [4]byte
 45392  	FmovetoTarget   i64
 45393  	FaOffset        uintptr
 45394  	FaRow           uintptr
 45395  	FpayloadSize    u32
 45396  	FszRow          u32
 45397  	FaType          [1]u32
 45398  	_               [4]byte
 45399  } /* sqlite3.h:249:9 */
 45400  
 45401  // Types of VDBE cursors
 45402  
 45403  // A VdbeCursor is an superclass (a wrapper) for various cursor objects:
 45404  //
 45405  //      * A b-tree cursor
 45406  //          -  In the main database or in an ephemeral database
 45407  //          -  On either an index or a table
 45408  //      * A sorter
 45409  //      * A virtual table
 45410  //      * A one-row "pseudotable" stored in a single register
 45411  type VdbeCursor = VdbeCursor1 /* vdbeInt.h:75:27 */
 45412  
 45413  // A value for VdbeCursor.cacheStatus that means the cache is always invalid.
 45414  
 45415  // When a sub-program is executed (OP_Program), a structure of this type
 45416  // is allocated to store the current value of the program counter, as
 45417  // well as the current memory cell array and various other frame specific
 45418  // values stored in the Vdbe struct. When the sub-program is finished,
 45419  // these values are copied back to the Vdbe from the VdbeFrame structure,
 45420  // restoring the state of the VM to as it was before the sub-program
 45421  // began executing.
 45422  //
 45423  // The memory for a VdbeFrame object is allocated and managed by a memory
 45424  // cell in the parent (calling) frame. When the memory cell is deleted or
 45425  // overwritten, the VdbeFrame object is not freed immediately. Instead, it
 45426  // is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
 45427  // list is deleted when the VM is reset in VdbeHalt(). The reason for doing
 45428  // this instead of deleting the VdbeFrame immediately is to avoid recursive
 45429  // calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
 45430  // child frame are released.
 45431  //
 45432  // The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
 45433  // set to NULL if the currently executing frame is the main program.
 45434  type VdbeFrame1 = struct {
 45435  	Fv         uintptr
 45436  	FpParent   uintptr
 45437  	FaOp       uintptr
 45438  	FanExec    uintptr
 45439  	FaMem      uintptr
 45440  	FapCsr     uintptr
 45441  	FaOnce     uintptr
 45442  	Ftoken     uintptr
 45443  	FlastRowid i64
 45444  	FpAuxData  uintptr
 45445  	FnCursor   int32
 45446  	Fpc        int32
 45447  	FnOp       int32
 45448  	FnMem      int32
 45449  	FnChildMem int32
 45450  	FnChildCsr int32
 45451  	FnChange   int32
 45452  	FnDbChange int32
 45453  	_          [4]byte
 45454  } /* sqlite3.h:249:9 */
 45455  
 45456  // A value for VdbeCursor.cacheStatus that means the cache is always invalid.
 45457  
 45458  // When a sub-program is executed (OP_Program), a structure of this type
 45459  // is allocated to store the current value of the program counter, as
 45460  // well as the current memory cell array and various other frame specific
 45461  // values stored in the Vdbe struct. When the sub-program is finished,
 45462  // these values are copied back to the Vdbe from the VdbeFrame structure,
 45463  // restoring the state of the VM to as it was before the sub-program
 45464  // began executing.
 45465  //
 45466  // The memory for a VdbeFrame object is allocated and managed by a memory
 45467  // cell in the parent (calling) frame. When the memory cell is deleted or
 45468  // overwritten, the VdbeFrame object is not freed immediately. Instead, it
 45469  // is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame
 45470  // list is deleted when the VM is reset in VdbeHalt(). The reason for doing
 45471  // this instead of deleting the VdbeFrame immediately is to avoid recursive
 45472  // calls to sqlite3VdbeMemRelease() when the memory cells belonging to the
 45473  // child frame are released.
 45474  //
 45475  // The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is
 45476  // set to NULL if the currently executing frame is the main program.
 45477  type VdbeFrame = VdbeFrame1 /* vdbeInt.h:162:26 */
 45478  
 45479  // Magic number for sanity checking on VdbeFrame objects
 45480  
 45481  // Return a pointer to the array of registers allocated for use
 45482  // by a VdbeFrame.
 45483  
 45484  // Internally, the vdbe manipulates nearly all SQL values as Mem
 45485  // structures. Each Mem struct may cache multiple representations (string,
 45486  // integer etc.) of the same value.
 45487  type MemValue = struct{ Fr float64 } /* sqlite3.h:249:9 */
 45488  
 45489  // A bitfield type for use inside of structures.  Always follow with :N where
 45490  // N is the number of bits.
 45491  type bft = uint32 /* vdbeInt.h:345:18 */ // Bit Field Type
 45492  
 45493  // The ScanStatus object holds a single value for the
 45494  // sqlite3_stmt_scanstatus() interface.
 45495  type ScanStatus1 = struct {
 45496  	FaddrExplain int32
 45497  	FaddrLoop    int32
 45498  	FaddrVisit   int32
 45499  	FiSelectID   int32
 45500  	FnEst        LogEst
 45501  	_            [2]byte
 45502  	FzName       uintptr
 45503  } /* vdbeInt.h:350:9 */
 45504  
 45505  // Bit Field Type
 45506  
 45507  // The ScanStatus object holds a single value for the
 45508  // sqlite3_stmt_scanstatus() interface.
 45509  type ScanStatus = ScanStatus1 /* vdbeInt.h:350:27 */
 45510  
 45511  // The DblquoteStr object holds the text of a double-quoted
 45512  // string for a prepared statement.  A linked list of these objects
 45513  // is constructed during statement parsing and is held on Vdbe.pDblStr.
 45514  // When computing a normalized SQL statement for an SQL statement, that
 45515  // list is consulted for each double-quoted identifier to see if the
 45516  // identifier should really be a string literal.
 45517  type DblquoteStr1 = struct {
 45518  	FpNextStr uintptr
 45519  	Fz        [8]int8
 45520  } /* vdbeInt.h:367:9 */
 45521  
 45522  // The DblquoteStr object holds the text of a double-quoted
 45523  // string for a prepared statement.  A linked list of these objects
 45524  // is constructed during statement parsing and is held on Vdbe.pDblStr.
 45525  // When computing a normalized SQL statement for an SQL statement, that
 45526  // list is consulted for each double-quoted identifier to see if the
 45527  // identifier should really be a string literal.
 45528  type DblquoteStr = DblquoteStr1 /* vdbeInt.h:367:28 */
 45529  
 45530  // Convert text generated by the "%p" conversion format back into
 45531  // a pointer.
 45532  func testHexToInt(tls *libc.TLS, h int32) int32 { /* test1.c:44:12: */
 45533  	if (h >= '0') && (h <= '9') {
 45534  		return (h - '0')
 45535  	} else if (h >= 'a') && (h <= 'f') {
 45536  		return ((h - 'a') + 10)
 45537  	} else {
 45538  
 45539  		return ((h - 'A') + 10)
 45540  	}
 45541  	return int32(0)
 45542  }
 45543  
 45544  func sqlite3TestTextToPtr(tls *libc.TLS, z uintptr) uintptr { /* test1.c:54:6: */
 45545  	bp := tls.Alloc(20)
 45546  	defer tls.Free(20)
 45547  
 45548  	// var p uintptr at bp, 4
 45549  
 45550  	// var v u64 at bp+8, 8
 45551  
 45552  	// var v2 u32 at bp+16, 4
 45553  
 45554  	if (int32(*(*int8)(unsafe.Pointer(z))) == '0') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == 'x') {
 45555  		z += uintptr(2)
 45556  	}
 45557  	*(*u64)(unsafe.Pointer(bp + 8 /* v */)) = uint64(0)
 45558  	for *(*int8)(unsafe.Pointer(z)) != 0 {
 45559  		*(*u64)(unsafe.Pointer(bp + 8 /* v */)) = ((*(*u64)(unsafe.Pointer(bp + 8 /* v */)) << 4) + u64(testHexToInt(tls, int32(*(*int8)(unsafe.Pointer(z))))))
 45560  		z++
 45561  	}
 45562  	if uint32(unsafe.Sizeof(uintptr(0))) == uint32(unsafe.Sizeof(u64(0))) {
 45563  		libc.Xmemcpy(tls, bp /* &p */, bp+8 /* &v */, uint32(unsafe.Sizeof(uintptr(0))))
 45564  	} else {
 45565  
 45566  		*(*u32)(unsafe.Pointer(bp + 16 /* v2 */)) = u32(*(*u64)(unsafe.Pointer(bp + 8 /* v */)))
 45567  		libc.Xmemcpy(tls, bp /* &p */, bp+16 /* &v2 */, uint32(unsafe.Sizeof(uintptr(0))))
 45568  	}
 45569  	return *(*uintptr)(unsafe.Pointer(bp /* p */))
 45570  }
 45571  
 45572  // A TCL command that returns the address of the sqlite* pointer
 45573  // for an sqlite connection instance.  Bad things happen if the
 45574  // input is not an sqlite connection.
 45575  func get_sqlite_pointer(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:82:26: */
 45576  	bp := tls.Alloc(180)
 45577  	defer tls.Free(180)
 45578  
 45579  	var p uintptr
 45580  	// var cmdInfo Tcl_CmdInfo at bp+48, 32
 45581  
 45582  	// var zBuf [100]int8 at bp+80, 100
 45583  
 45584  	if objc != 2 {
 45585  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+15302 /* "SQLITE-CONNECTIO..." */)
 45586  		return TCL_ERROR
 45587  	}
 45588  	if !(tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &cmdInfo */) != 0) {
 45589  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320, /* "command not foun..." */
 45590  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 45591  		return TCL_ERROR
 45592  	}
 45593  	p = (*Tcl_CmdInfo)(unsafe.Pointer(bp + 48 /* &cmdInfo */)).FobjClientData
 45594  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+80 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+24, (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb))
 45595  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+80 /* &zBuf[0] */, 0))
 45596  	return TCL_OK
 45597  }
 45598  
 45599  // Decode a pointer to an sqlite3 object.
 45600  func getDbPointer(tls *libc.TLS, interp uintptr, zA uintptr, ppDb uintptr) int32 { /* test1.c:109:5: */
 45601  	bp := tls.Alloc(32)
 45602  	defer tls.Free(32)
 45603  
 45604  	var p uintptr
 45605  	// var cmdInfo Tcl_CmdInfo at bp, 32
 45606  
 45607  	if tcl.XTcl_GetCommandInfo(tls, interp, zA, bp /* &cmdInfo */) != 0 {
 45608  		p = (*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData
 45609  		*(*uintptr)(unsafe.Pointer(ppDb)) = (*struct{ Fdb uintptr })(unsafe.Pointer(p)).Fdb
 45610  	} else {
 45611  		*(*uintptr)(unsafe.Pointer(ppDb)) = sqlite3TestTextToPtr(tls, zA)
 45612  	}
 45613  	return TCL_OK
 45614  }
 45615  
 45616  // Convert an sqlite3_stmt* into an sqlite3*.  This depends on the
 45617  // fact that the sqlite3* is the first field in the Vdbe structure.
 45618  
 45619  // Check a return value to make sure it agrees with the results
 45620  // from sqlite3_errcode.
 45621  func sqlite3TestErrCode(tls *libc.TLS, interp uintptr, db uintptr, rc int32) int32 { /* test1.c:144:5: */
 45622  	bp := tls.Alloc(248)
 45623  	defer tls.Free(248)
 45624  
 45625  	if (((sqlite3.Xsqlite3_threadsafe(tls) == 0) && (rc != SQLITE_MISUSE)) && (rc != SQLITE_OK)) &&
 45626  		(sqlite3.Xsqlite3_errcode(tls, db) != rc) {
 45627  		// var zBuf [200]int8 at bp+48, 200
 45628  
 45629  		var r2 int32 = sqlite3.Xsqlite3_errcode(tls, db)
 45630  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+48, /* &zBuf[0] */
 45631  			ts+15340, /* "error code %s (%..." */
 45632  			libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), rc, sqlite3.Xsqlite3ErrName(tls, r2), r2))
 45633  		tcl.XTcl_ResetResult(tls, interp)
 45634  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+48 /* &zBuf[0] */, 0))
 45635  		return 1
 45636  	}
 45637  	return 0
 45638  }
 45639  
 45640  // Decode a pointer to an sqlite3_stmt object.
 45641  func getStmtPointer(tls *libc.TLS, interp uintptr, zArg uintptr, ppStmt uintptr) int32 { /* test1.c:162:12: */
 45642  	*(*uintptr)(unsafe.Pointer(ppStmt)) = sqlite3TestTextToPtr(tls, zArg)
 45643  	return TCL_OK
 45644  }
 45645  
 45646  // Generate a text representation of a pointer that can be understood
 45647  // by the getDbPointer and getVmPointer routines above.
 45648  //
 45649  // The problem is, on some machines (Solaris) if you do a printf with
 45650  // "%p" you cannot turn around and do a scanf with the same "%p" and
 45651  // get your pointer back.  You have to prepend a "0x" before it will
 45652  // work.  Or at least that is what is reported to me (drh).  But this
 45653  // behavior varies from machine to machine.  The solution used her is
 45654  // to test the string right after it is generated to see if it can be
 45655  // understood by scanf, and if not, try prepending an "0x" to see if
 45656  // that helps.  If nothing works, a fatal error is generated.
 45657  func sqlite3TestMakePointerStr(tls *libc.TLS, interp uintptr, zPtr uintptr, p uintptr) int32 { /* test1.c:184:5: */
 45658  	bp := tls.Alloc(8)
 45659  	defer tls.Free(8)
 45660  
 45661  	sqlite3.Xsqlite3_snprintf(tls, 100, zPtr, ts+13802 /* "%p" */, libc.VaList(bp, p))
 45662  	return TCL_OK
 45663  }
 45664  
 45665  // The callback routine for sqlite3_exec_printf().
 45666  func exec_printf_cb(tls *libc.TLS, pArg uintptr, argc int32, argv uintptr, name uintptr) int32 { /* test1.c:192:12: */
 45667  	var str uintptr = pArg
 45668  	var i int32
 45669  
 45670  	if ((*Tcl_DString)(unsafe.Pointer(str)).Flength) == 0 {
 45671  		for i = 0; i < argc; i++ {
 45672  			tcl.XTcl_DStringAppendElement(tls, str, func() uintptr {
 45673  				if *(*uintptr)(unsafe.Pointer(name + uintptr(i)*4)) != 0 {
 45674  					return *(*uintptr)(unsafe.Pointer(name + uintptr(i)*4))
 45675  				}
 45676  				return ts + 5707 /* "NULL" */
 45677  			}())
 45678  		}
 45679  	}
 45680  	for i = 0; i < argc; i++ {
 45681  		tcl.XTcl_DStringAppendElement(tls, str, func() uintptr {
 45682  			if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) != 0 {
 45683  				return *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))
 45684  			}
 45685  			return ts + 5707 /* "NULL" */
 45686  		}())
 45687  	}
 45688  	return 0
 45689  }
 45690  
 45691  // The I/O tracing callback.
 45692  
 45693  // Usage:  io_trace FILENAME
 45694  //
 45695  // Turn I/O tracing on or off.  If FILENAME is not an empty string,
 45696  // I/O tracing begins going into FILENAME. If FILENAME is an empty
 45697  // string, I/O tracing is turned off.
 45698  func test_io_trace(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:228:26: */
 45699  	return TCL_OK
 45700  }
 45701  
 45702  // Usage:  clang_sanitize_address
 45703  //
 45704  // Returns true if the program was compiled using clang with the
 45705  // -fsanitize=address switch on the command line. False otherwise.
 45706  //
 45707  // Also return true if the OMIT_MISUSE environment variable exists.
 45708  func clang_sanitize_address(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:269:26: */
 45709  	var res int32 = 0
 45710  	if (res == 0) && (libc.Xgetenv(tls, ts+15398 /* "OMIT_MISUSE" */) != uintptr(0)) {
 45711  		res = 1
 45712  	}
 45713  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 45714  	return TCL_OK
 45715  }
 45716  
 45717  // Usage:  sqlite3_exec_printf  DB  FORMAT  STRING
 45718  //
 45719  // Invoke the sqlite3_exec_printf() interface using the open database
 45720  // DB.  The SQL is the string FORMAT.  The format string should contain
 45721  // one %s or %q.  STRING is the value inserted into %s or %q.
 45722  func test_exec_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:296:26: */
 45723  	bp := tls.Alloc(298)
 45724  	defer tls.Free(298)
 45725  
 45726  	// var db uintptr at bp+48, 4
 45727  
 45728  	// var str Tcl_DString at bp+52, 212
 45729  
 45730  	var rc int32
 45731  	*(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)) = uintptr(0)
 45732  	var zSql uintptr
 45733  	// var zBuf [30]int8 at bp+268, 30
 45734  
 45735  	if argc != 4 {
 45736  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45737  			ts+15436 /* " DB FORMAT STRIN..." */, 0))
 45738  		return TCL_ERROR
 45739  	}
 45740  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+48 /* &db */) != 0 {
 45741  		return TCL_ERROR
 45742  	}
 45743  	tcl.XTcl_DStringInit(tls, bp+52 /* &str */)
 45744  	zSql = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 3*4))))
 45745  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*uintptr)(unsafe.Pointer(&struct {
 45746  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 45747  	}{exec_printf_cb})), bp+52 /* &str */, bp+264 /* &zErr */)
 45748  	sqlite3.Xsqlite3_free(tls, zSql)
 45749  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+268 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 45750  	tcl.XTcl_AppendElement(tls, interp, bp+268 /* &zBuf[0] */)
 45751  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 45752  		if rc == SQLITE_OK {
 45753  			return (*Tcl_DString)(unsafe.Pointer(bp + 52 /* &str */)).Fstring
 45754  		}
 45755  		return *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */))
 45756  	}())
 45757  	tcl.XTcl_DStringFree(tls, bp+52 /* &str */)
 45758  	if *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)) != 0 {
 45759  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)))
 45760  	}
 45761  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 45762  		return TCL_ERROR
 45763  	}
 45764  	return TCL_OK
 45765  }
 45766  
 45767  // Usage:  sqlite3_exec_hex  DB  HEX
 45768  //
 45769  // Invoke the sqlite3_exec() on a string that is obtained by translating
 45770  // HEX into ASCII.  Most characters are translated as is.  %HH becomes
 45771  // a hex character.
 45772  func test_exec_hex(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:334:26: */
 45773  	bp := tls.Alloc(794)
 45774  	defer tls.Free(794)
 45775  
 45776  	// var db uintptr at bp+40, 4
 45777  
 45778  	// var str Tcl_DString at bp+548, 212
 45779  
 45780  	var rc int32
 45781  	var i int32
 45782  	var j int32
 45783  	*(*uintptr)(unsafe.Pointer(bp + 760 /* zErr */)) = uintptr(0)
 45784  	var zHex uintptr
 45785  	// var zSql [501]int8 at bp+44, 501
 45786  
 45787  	// var zBuf [30]int8 at bp+764, 30
 45788  
 45789  	if argc != 3 {
 45790  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45791  			ts+15454 /* " DB HEX" */, 0))
 45792  		return TCL_ERROR
 45793  	}
 45794  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+40 /* &db */) != 0 {
 45795  		return TCL_ERROR
 45796  	}
 45797  	zHex = *(*uintptr)(unsafe.Pointer(argv + 2*4))
 45798  	i = libc.AssignInt32(&j, 0)
 45799  __1:
 45800  	if !((uint32(i) < (uint32(unsafe.Sizeof([501]int8{})) - uint32(1))) && (*(*int8)(unsafe.Pointer(zHex + uintptr(j))) != 0)) {
 45801  		goto __3
 45802  	}
 45803  	{
 45804  		if ((int32(*(*int8)(unsafe.Pointer(zHex + uintptr(j)))) == '%') && (*(*int8)(unsafe.Pointer(zHex + uintptr((j + 2)))) != 0)) && (*(*int8)(unsafe.Pointer(zHex + uintptr((j + 2)))) != 0) {
 45805  			*(*int8)(unsafe.Pointer(bp + 44 /* &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))))))))
 45806  			j = j + (2)
 45807  		} else {
 45808  			*(*int8)(unsafe.Pointer(bp + 44 /* &zSql[0] */ + uintptr(i))) = *(*int8)(unsafe.Pointer(zHex + uintptr(j)))
 45809  		}
 45810  
 45811  	}
 45812  	goto __2
 45813  __2:
 45814  	i++
 45815  	j++
 45816  	goto __1
 45817  	goto __3
 45818  __3:
 45819  	;
 45820  	*(*int8)(unsafe.Pointer(bp + 44 /* &zSql[0] */ + uintptr(i))) = int8(0)
 45821  	tcl.XTcl_DStringInit(tls, bp+548 /* &str */)
 45822  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), bp+44 /* &zSql[0] */, *(*uintptr)(unsafe.Pointer(&struct {
 45823  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 45824  	}{exec_printf_cb})), bp+548 /* &str */, bp+760 /* &zErr */)
 45825  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+764 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, rc))
 45826  	tcl.XTcl_AppendElement(tls, interp, bp+764 /* &zBuf[0] */)
 45827  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 45828  		if rc == SQLITE_OK {
 45829  			return (*Tcl_DString)(unsafe.Pointer(bp + 548 /* &str */)).Fstring
 45830  		}
 45831  		return *(*uintptr)(unsafe.Pointer(bp + 760 /* zErr */))
 45832  	}())
 45833  	tcl.XTcl_DStringFree(tls, bp+548 /* &str */)
 45834  	if *(*uintptr)(unsafe.Pointer(bp + 760 /* zErr */)) != 0 {
 45835  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 760 /* zErr */)))
 45836  	}
 45837  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 40 /* db */)), rc) != 0 {
 45838  		return TCL_ERROR
 45839  	}
 45840  	return TCL_OK
 45841  }
 45842  
 45843  // Usage:  db_enter DB
 45844  //         db_leave DB
 45845  //
 45846  // Enter or leave the mutex on a database connection.
 45847  func db_enter(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:380:26: */
 45848  	bp := tls.Alloc(36)
 45849  	defer tls.Free(36)
 45850  
 45851  	// var db uintptr at bp+32, 4
 45852  
 45853  	if argc != 2 {
 45854  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45855  			ts+15462 /* " DB" */, 0))
 45856  		return TCL_ERROR
 45857  	}
 45858  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 45859  		return TCL_ERROR
 45860  	}
 45861  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 45862  	return TCL_OK
 45863  }
 45864  
 45865  func db_leave(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:396:26: */
 45866  	bp := tls.Alloc(36)
 45867  	defer tls.Free(36)
 45868  
 45869  	// var db uintptr at bp+32, 4
 45870  
 45871  	if argc != 2 {
 45872  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45873  			ts+15462 /* " DB" */, 0))
 45874  		return TCL_ERROR
 45875  	}
 45876  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 45877  		return TCL_ERROR
 45878  	}
 45879  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 45880  	return TCL_OK
 45881  }
 45882  
 45883  // Usage:  sqlite3_exec  DB  SQL
 45884  //
 45885  // Invoke the sqlite3_exec interface using the open database DB
 45886  func test_exec(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:418:26: */
 45887  	bp := tls.Alloc(298)
 45888  	defer tls.Free(298)
 45889  
 45890  	// var db uintptr at bp+48, 4
 45891  
 45892  	// var str Tcl_DString at bp+52, 212
 45893  
 45894  	var rc int32
 45895  	*(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)) = uintptr(0)
 45896  	var zSql uintptr
 45897  	var i int32
 45898  	var j int32
 45899  	// var zBuf [30]int8 at bp+268, 30
 45900  
 45901  	if argc != 3 {
 45902  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45903  			ts+15466 /* " DB SQL" */, 0))
 45904  		return TCL_ERROR
 45905  	}
 45906  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+48 /* &db */) != 0 {
 45907  		return TCL_ERROR
 45908  	}
 45909  	tcl.XTcl_DStringInit(tls, bp+52 /* &str */)
 45910  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 45911  	for i = libc.AssignInt32(&j, 0); *(*int8)(unsafe.Pointer(zSql + uintptr(i))) != 0; {
 45912  		if int32(*(*int8)(unsafe.Pointer(zSql + uintptr(i)))) == '%' {
 45913  			*(*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))))))))
 45914  			i = i + (3)
 45915  		} else {
 45916  			*(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(zSql + uintptr(libc.PostIncInt32(&i, 1))))
 45917  		}
 45918  	}
 45919  	*(*int8)(unsafe.Pointer(zSql + uintptr(j))) = int8(0)
 45920  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*uintptr)(unsafe.Pointer(&struct {
 45921  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 45922  	}{exec_printf_cb})), bp+52 /* &str */, bp+264 /* &zErr */)
 45923  	sqlite3.Xsqlite3_free(tls, zSql)
 45924  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+268 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 45925  	tcl.XTcl_AppendElement(tls, interp, bp+268 /* &zBuf[0] */)
 45926  	tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 45927  		if rc == SQLITE_OK {
 45928  			return (*Tcl_DString)(unsafe.Pointer(bp + 52 /* &str */)).Fstring
 45929  		}
 45930  		return *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */))
 45931  	}())
 45932  	tcl.XTcl_DStringFree(tls, bp+52 /* &str */)
 45933  	if *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)) != 0 {
 45934  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 264 /* zErr */)))
 45935  	}
 45936  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 45937  		return TCL_ERROR
 45938  	}
 45939  	return TCL_OK
 45940  }
 45941  
 45942  // Usage:  sqlite3_exec_nr  DB  SQL
 45943  //
 45944  // Invoke the sqlite3_exec interface using the open database DB.  Discard
 45945  // all results
 45946  func test_exec_nr(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:465:26: */
 45947  	bp := tls.Alloc(40)
 45948  	defer tls.Free(40)
 45949  
 45950  	// var db uintptr at bp+32, 4
 45951  
 45952  	var rc int32
 45953  	*(*uintptr)(unsafe.Pointer(bp + 36 /* zErr */)) = uintptr(0)
 45954  	if argc != 3 {
 45955  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 45956  			ts+15466 /* " DB SQL" */, 0))
 45957  		return TCL_ERROR
 45958  	}
 45959  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 45960  		return TCL_ERROR
 45961  	}
 45962  	rc = sqlite3.Xsqlite3_exec(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), uintptr(0), uintptr(0), bp+36 /* &zErr */)
 45963  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 45964  		return TCL_ERROR
 45965  	}
 45966  	return TCL_OK
 45967  }
 45968  
 45969  // Usage:  sqlite3_mprintf_z_test  SEPARATOR  ARG0  ARG1 ...
 45970  //
 45971  // Test the %z format of sqlite_mprintf().  Use multiple mprintf() calls to
 45972  // concatenate arg0 through argn using separator as the separator.
 45973  // Return the result.
 45974  func test_mprintf_z(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:492:26: */
 45975  	bp := tls.Alloc(40)
 45976  	defer tls.Free(40)
 45977  
 45978  	var zResult uintptr = uintptr(0)
 45979  	var i int32
 45980  
 45981  	for i = 2; (i < argc) && ((i == 2) || (zResult != 0)); i++ {
 45982  		zResult = sqlite3.Xsqlite3_mprintf(tls, ts+15474 /* "%z%s%s" */, libc.VaList(bp, zResult, *(*uintptr)(unsafe.Pointer(argv + 1*4)), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 45983  	}
 45984  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, zResult, 0))
 45985  	sqlite3.Xsqlite3_free(tls, zResult)
 45986  	return TCL_OK
 45987  }
 45988  
 45989  // Usage:  sqlite3_mprintf_n_test  STRING
 45990  //
 45991  // Test the %n format of sqlite_mprintf().  Return the length of the
 45992  // input string.
 45993  func test_mprintf_n(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:515:26: */
 45994  	bp := tls.Alloc(20)
 45995  	defer tls.Free(20)
 45996  
 45997  	var zStr uintptr
 45998  	*(*int32)(unsafe.Pointer(bp + 16 /* n */)) = 0
 45999  	zStr = sqlite3.Xsqlite3_mprintf(tls, ts+15481 /* "%s%n" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+16 /* &n */))
 46000  	sqlite3.Xsqlite3_free(tls, zStr)
 46001  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 16 /* n */))))
 46002  	return TCL_OK
 46003  }
 46004  
 46005  // Usage:  sqlite3_snprintf_int  SIZE FORMAT  INT
 46006  //
 46007  // Test the of sqlite3_snprintf() routine.  SIZE is the size of the
 46008  // output buffer in bytes.  The maximum size is 100.  FORMAT is the
 46009  // format string.  INT is a single integer argument.  The FORMAT
 46010  // string must require no more than this one integer argument.  If
 46011  // You pass in a format string that requires more than one argument,
 46012  // bad things will happen.
 46013  func test_snprintf_int(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:539:26: */
 46014  	bp := tls.Alloc(124)
 46015  	defer tls.Free(124)
 46016  
 46017  	// var zStr [100]int8 at bp+24, 100
 46018  
 46019  	var n int32 = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 46020  	var zFormat uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*4))
 46021  	var a1 int32 = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 46022  	if uint32(n) > uint32(unsafe.Sizeof([100]int8{})) {
 46023  		n = int32(unsafe.Sizeof([100]int8{}))
 46024  	}
 46025  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+24 /* &zStr[0] */, ts+15486 /* "abcdefghijklmnop..." */, 0)
 46026  	sqlite3.Xsqlite3_snprintf(tls, n, bp+24 /* &zStr[0] */, zFormat, libc.VaList(bp, a1))
 46027  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, bp+24 /* &zStr[0] */, 0))
 46028  	return TCL_OK
 46029  }
 46030  
 46031  // Usage:  sqlite3_get_table_printf  DB  FORMAT  STRING  ?--no-counts?
 46032  //
 46033  // Invoke the sqlite3_get_table_printf() interface using the open database
 46034  // DB.  The SQL is the string FORMAT.  The format string should contain
 46035  // one %s or %q.  STRING is the value inserted into %s or %q.
 46036  func test_get_table_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:565:26: */
 46037  	bp := tls.Alloc(330)
 46038  	defer tls.Free(330)
 46039  
 46040  	// var db uintptr at bp+68, 4
 46041  
 46042  	// var str Tcl_DString at bp+72, 212
 46043  
 46044  	var rc int32
 46045  	*(*uintptr)(unsafe.Pointer(bp + 288 /* zErr */)) = uintptr(0)
 46046  	*(*int32)(unsafe.Pointer(bp + 292 /* nRow */)) = 0
 46047  	*(*int32)(unsafe.Pointer(bp + 296 /* nCol */)) = 0
 46048  	// var aResult uintptr at bp+284, 4
 46049  
 46050  	var i int32
 46051  	// var zBuf [30]int8 at bp+300, 30
 46052  
 46053  	var zSql uintptr
 46054  	*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = -1
 46055  	if argc == 5 {
 46056  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*4)), bp+64 /* &resCount */) != 0 {
 46057  			return TCL_ERROR
 46058  		}
 46059  	}
 46060  	if (argc != 4) && (argc != 5) {
 46061  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46062  			ts+15513 /* " DB FORMAT STRIN..." */, 0))
 46063  		return TCL_ERROR
 46064  	}
 46065  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+68 /* &db */) != 0 {
 46066  		return TCL_ERROR
 46067  	}
 46068  	tcl.XTcl_DStringInit(tls, bp+72 /* &str */)
 46069  	zSql = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 3*4))))
 46070  	if argc == 5 {
 46071  		rc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 68 /* db */)), zSql, bp+284 /* &aResult */, uintptr(0), uintptr(0), bp+288 /* &zErr */)
 46072  	} else {
 46073  		rc = sqlite3.Xsqlite3_get_table(tls, *(*uintptr)(unsafe.Pointer(bp + 68 /* db */)), zSql, bp+284 /* &aResult */, bp+292 /* &nRow */, bp+296 /* &nCol */, bp+288 /* &zErr */)
 46074  		*(*int32)(unsafe.Pointer(bp + 64 /* resCount */)) = ((*(*int32)(unsafe.Pointer(bp + 292 /* nRow */)) + 1) * *(*int32)(unsafe.Pointer(bp + 296 /* nCol */)))
 46075  	}
 46076  	sqlite3.Xsqlite3_free(tls, zSql)
 46077  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+300 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+40, rc))
 46078  	tcl.XTcl_AppendElement(tls, interp, bp+300 /* &zBuf[0] */)
 46079  	if rc == SQLITE_OK {
 46080  		if argc == 4 {
 46081  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+300 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 292 /* nRow */))))
 46082  			tcl.XTcl_AppendElement(tls, interp, bp+300 /* &zBuf[0] */)
 46083  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+300 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+56, *(*int32)(unsafe.Pointer(bp + 296 /* nCol */))))
 46084  			tcl.XTcl_AppendElement(tls, interp, bp+300 /* &zBuf[0] */)
 46085  		}
 46086  		for i = 0; i < *(*int32)(unsafe.Pointer(bp + 64 /* resCount */)); i++ {
 46087  			tcl.XTcl_AppendElement(tls, interp, func() uintptr {
 46088  				if *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 284 /* aResult */)) + uintptr(i)*4)) != 0 {
 46089  					return *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 284 /* aResult */)) + uintptr(i)*4))
 46090  				}
 46091  				return ts + 5707 /* "NULL" */
 46092  			}())
 46093  		}
 46094  	} else {
 46095  		tcl.XTcl_AppendElement(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErr */)))
 46096  	}
 46097  	sqlite3.Xsqlite3_free_table(tls, *(*uintptr)(unsafe.Pointer(bp + 284 /* aResult */)))
 46098  	if *(*uintptr)(unsafe.Pointer(bp + 288 /* zErr */)) != 0 {
 46099  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 288 /* zErr */)))
 46100  	}
 46101  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 68 /* db */)), rc) != 0 {
 46102  		return TCL_ERROR
 46103  	}
 46104  	return TCL_OK
 46105  }
 46106  
 46107  // Usage:  sqlite3_last_insert_rowid DB
 46108  //
 46109  // Returns the integer ROWID of the most recent insert.
 46110  func test_last_rowid(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:628:26: */
 46111  	bp := tls.Alloc(90)
 46112  	defer tls.Free(90)
 46113  
 46114  	// var db uintptr at bp+56, 4
 46115  
 46116  	// var zBuf [30]int8 at bp+60, 30
 46117  
 46118  	if argc != 2 {
 46119  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+15539 /* " DB\"" */, 0))
 46120  		return TCL_ERROR
 46121  	}
 46122  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+56 /* &db */) != 0 {
 46123  		return TCL_ERROR
 46124  	}
 46125  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+60 /* &zBuf[0] */, ts+11354 /* "%lld" */, libc.VaList(bp+32, sqlite3.Xsqlite3_last_insert_rowid(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)))))
 46126  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 46127  	return SQLITE_OK
 46128  }
 46129  
 46130  // Usage:  sqlite3_key DB KEY
 46131  //
 46132  // Set the codec key.
 46133  func test_key(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:652:26: */
 46134  	return TCL_OK
 46135  }
 46136  
 46137  // Usage:  sqlite3_rekey DB KEY
 46138  //
 46139  // Change the codec key.
 46140  func test_rekey(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:666:26: */
 46141  	return TCL_OK
 46142  }
 46143  
 46144  // Usage:  sqlite3_close DB
 46145  //
 46146  // Closes the database opened by sqlite3_open.
 46147  func sqlite_test_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:680:26: */
 46148  	bp := tls.Alloc(36)
 46149  	defer tls.Free(36)
 46150  
 46151  	// var db uintptr at bp+32, 4
 46152  
 46153  	var rc int32
 46154  	if argc != 2 {
 46155  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46156  			ts+15544 /* " FILENAME\"" */, 0))
 46157  		return TCL_ERROR
 46158  	}
 46159  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 46160  		return TCL_ERROR
 46161  	}
 46162  	rc = sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 46163  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 46164  	return TCL_OK
 46165  }
 46166  
 46167  // Usage:  sqlite3_close_v2 DB
 46168  //
 46169  // Closes the database opened by sqlite3_open.
 46170  func sqlite_test_close_v2(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:704:26: */
 46171  	bp := tls.Alloc(36)
 46172  	defer tls.Free(36)
 46173  
 46174  	// var db uintptr at bp+32, 4
 46175  
 46176  	var rc int32
 46177  	if argc != 2 {
 46178  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46179  			ts+15544 /* " FILENAME\"" */, 0))
 46180  		return TCL_ERROR
 46181  	}
 46182  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 46183  		return TCL_ERROR
 46184  	}
 46185  	rc = sqlite3.Xsqlite3_close_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 46186  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 46187  	return TCL_OK
 46188  }
 46189  
 46190  // Implementation of the x_coalesce() function.
 46191  // Return the first argument non-NULL argument.
 46192  func t1_ifnullFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:727:13: */
 46193  	var i int32
 46194  	for i = 0; i < argc; i++ {
 46195  		if SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) {
 46196  			var n int32 = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 46197  			sqlite3.Xsqlite3_result_text(tls, context, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))),
 46198  				n, libc.UintptrFromInt32(-1))
 46199  			break
 46200  		}
 46201  	}
 46202  }
 46203  
 46204  // These are test functions.    hex8() interprets its argument as
 46205  // UTF8 and returns a hex encoding.  hex16le() interprets its argument
 46206  // as UTF16le and returns a hex encoding.
 46207  func hex8Func(tls *libc.TLS, p uintptr, argc int32, argv uintptr) { /* test1.c:748:13: */
 46208  	bp := tls.Alloc(208)
 46209  	defer tls.Free(208)
 46210  
 46211  	var z uintptr
 46212  	var i int32
 46213  	// var zBuf [200]int8 at bp+8, 200
 46214  
 46215  	z = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46216  	for i = 0; (uint32(i) < ((uint32(unsafe.Sizeof([200]int8{})) / uint32(2)) - uint32(2))) && (*(*uint8)(unsafe.Pointer(z + uintptr(i))) != 0); i++ {
 46217  		sqlite3.Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof([200]int8{})) - (uint32(i * 2)))), (bp + 8 /* &zBuf */ + uintptr((i * 2))), ts+15555 /* "%02x" */, libc.VaList(bp, int32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))))
 46218  	}
 46219  	*(*int8)(unsafe.Pointer(bp + 8 /* &zBuf[0] */ + uintptr((i * 2)))) = int8(0)
 46220  	sqlite3.Xsqlite3_result_text(tls, p, bp+8 /* zBuf */, -1, libc.UintptrFromInt32(-1))
 46221  }
 46222  
 46223  func hex16Func(tls *libc.TLS, p uintptr, argc int32, argv uintptr) { /* test1.c:760:13: */
 46224  	bp := tls.Alloc(408)
 46225  	defer tls.Free(408)
 46226  
 46227  	var z uintptr
 46228  	var i int32
 46229  	// var zBuf [400]int8 at bp+8, 400
 46230  
 46231  	z = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46232  	for i = 0; (uint32(i) < ((uint32(unsafe.Sizeof([400]int8{})) / uint32(4)) - uint32(4))) && (*(*uint16)(unsafe.Pointer(z + uintptr(i)*2)) != 0); i++ {
 46233  		sqlite3.Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof([400]int8{})) - (uint32(i * 4)))), (bp + 8 /* &zBuf */ + uintptr((i * 4))), ts+15560 /* "%04x" */, libc.VaList(bp, (int32(*(*uint16)(unsafe.Pointer(z + uintptr(i)*2)))&0xff)))
 46234  	}
 46235  	*(*int8)(unsafe.Pointer(bp + 8 /* &zBuf[0] */ + uintptr((i * 4)))) = int8(0)
 46236  	sqlite3.Xsqlite3_result_text(tls, p, bp+8 /* zBuf */, -1, libc.UintptrFromInt32(-1))
 46237  }
 46238  
 46239  // A structure into which to accumulate text.
 46240  type dstr = struct {
 46241  	FnAlloc int32
 46242  	FnUsed  int32
 46243  	Fz      uintptr
 46244  } /* test1.c:776:1 */
 46245  
 46246  // Append text to a dstr
 46247  func dstrAppend(tls *libc.TLS, p uintptr, z uintptr, divider int32) { /* test1.c:785:13: */
 46248  	var n int32 = int32(libc.Xstrlen(tls, z))
 46249  	if (((*dstr)(unsafe.Pointer(p)).FnUsed + n) + 2) > (*dstr)(unsafe.Pointer(p)).FnAlloc {
 46250  		var zNew uintptr
 46251  		(*dstr)(unsafe.Pointer(p)).FnAlloc = ((((*dstr)(unsafe.Pointer(p)).FnAlloc * 2) + n) + 200)
 46252  		zNew = sqlite3.Xsqlite3_realloc(tls, (*dstr)(unsafe.Pointer(p)).Fz, (*dstr)(unsafe.Pointer(p)).FnAlloc)
 46253  		if zNew == uintptr(0) {
 46254  			sqlite3.Xsqlite3_free(tls, (*dstr)(unsafe.Pointer(p)).Fz)
 46255  			libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(dstr{})))
 46256  			return
 46257  		}
 46258  		(*dstr)(unsafe.Pointer(p)).Fz = zNew
 46259  	}
 46260  	if (divider != 0) && ((*dstr)(unsafe.Pointer(p)).FnUsed > 0) {
 46261  		*(*int8)(unsafe.Pointer((*dstr)(unsafe.Pointer(p)).Fz + uintptr(libc.PostIncInt32(&(*dstr)(unsafe.Pointer(p)).FnUsed, 1)))) = int8(divider)
 46262  	}
 46263  	libc.Xmemcpy(tls, ((*dstr)(unsafe.Pointer(p)).Fz + uintptr((*dstr)(unsafe.Pointer(p)).FnUsed)), z, (uint32(n + 1)))
 46264  	*(*int32)(unsafe.Pointer(p + 4 /* &.nUsed */)) += (n)
 46265  }
 46266  
 46267  // Invoked for each callback from sqlite3ExecFunc
 46268  func execFuncCallback(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, NotUsed uintptr) int32 { /* test1.c:808:12: */
 46269  	var p uintptr = pData
 46270  	var i int32
 46271  	for i = 0; i < argc; i++ {
 46272  		if *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)) == uintptr(0) {
 46273  			dstrAppend(tls, p, ts+5707 /* "NULL" */, ' ')
 46274  		} else {
 46275  			dstrAppend(tls, p, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), ' ')
 46276  		}
 46277  	}
 46278  	return 0
 46279  }
 46280  
 46281  // Implementation of the x_sqlite_exec() function.  This function takes
 46282  // a single argument and attempts to execute that argument as SQL code.
 46283  // This is illegal and should set the SQLITE_MISUSE flag on the database.
 46284  //
 46285  // 2004-Jan-07:  We have changed this to make it legal to call sqlite3_exec()
 46286  // from within a function call.
 46287  //
 46288  // This routine simulates the effect of having two threads attempt to
 46289  // use the same database at the same time.
 46290  func sqlite3ExecFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:832:13: */
 46291  	bp := tls.Alloc(12)
 46292  	defer tls.Free(12)
 46293  
 46294  	// var x dstr at bp, 12
 46295  
 46296  	libc.Xmemset(tls, bp /* &x */, 0, uint32(unsafe.Sizeof(dstr{})))
 46297  	sqlite3.Xsqlite3_exec(tls, sqlite3.Xsqlite3_user_data(tls, context),
 46298  		sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))),
 46299  		*(*uintptr)(unsafe.Pointer(&struct {
 46300  			f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 46301  		}{execFuncCallback})), bp /* &x */, uintptr(0))
 46302  	sqlite3.Xsqlite3_result_text(tls, context, (*dstr)(unsafe.Pointer(bp /* &x */)).Fz, (*dstr)(unsafe.Pointer(bp /* &x */)).FnUsed, libc.UintptrFromInt32(-1))
 46303  	sqlite3.Xsqlite3_free(tls, (*dstr)(unsafe.Pointer(bp /* &x */)).Fz)
 46304  }
 46305  
 46306  // Implementation of tkt2213func(), a scalar function that takes exactly
 46307  // one argument. It has two interesting features:
 46308  //
 46309  // * It calls sqlite3_value_text() 3 times on the argument sqlite3_value*.
 46310  //   If the three pointers returned are not the same an SQL error is raised.
 46311  //
 46312  // * Otherwise it returns a copy of the text representation of its
 46313  //   argument in such a way as the VDBE representation is a Mem* cell
 46314  //   with the MEM_Term flag clear.
 46315  //
 46316  // Ticket #2213 can therefore be tested by evaluating the following
 46317  // SQL expression:
 46318  //
 46319  //   tkt2213func(tkt2213func('a string'));
 46320  func tkt2213Function(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:862:13: */
 46321  	var nText int32
 46322  	var zText1 uintptr
 46323  	var zText2 uintptr
 46324  	var zText3 uintptr
 46325  
 46326  	nText = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46327  	zText1 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46328  	zText2 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46329  	zText3 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46330  
 46331  	if (zText1 != zText2) || (zText2 != zText3) {
 46332  		sqlite3.Xsqlite3_result_error(tls, context, ts+15565 /* "tkt2213 is not f..." */, -1)
 46333  	} else {
 46334  		var zCopy uintptr = sqlite3.Xsqlite3_malloc(tls, nText)
 46335  		libc.Xmemcpy(tls, zCopy, zText1, uint32(nText))
 46336  		sqlite3.Xsqlite3_result_text(tls, context, zCopy, nText, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 46337  	}
 46338  }
 46339  
 46340  // The following SQL function takes 4 arguments.  The 2nd and
 46341  // 4th argument must be one of these strings:  'text', 'text16',
 46342  // or 'blob' corresponding to API functions
 46343  //
 46344  //      sqlite3_value_text()
 46345  //      sqlite3_value_text16()
 46346  //      sqlite3_value_blob()
 46347  //
 46348  // The third argument is a string, either 'bytes' or 'bytes16' or 'noop',
 46349  // corresponding to APIs:
 46350  //
 46351  //      sqlite3_value_bytes()
 46352  //      sqlite3_value_bytes16()
 46353  //      noop
 46354  //
 46355  // The APIs designated by the 2nd through 4th arguments are applied
 46356  // to the first argument in order.  If the pointers returned by the
 46357  // second and fourth are different, this routine returns 1.  Otherwise,
 46358  // this routine returns 0.
 46359  //
 46360  // This function is used to test to see when returned pointers from
 46361  // the _text(), _text16() and _blob() APIs become invalidated.
 46362  func ptrChngFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:910:13: */
 46363  	var p1 uintptr
 46364  	var p2 uintptr
 46365  	var zCmd uintptr
 46366  	if argc != 4 {
 46367  		return
 46368  	}
 46369  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 46370  	if zCmd == uintptr(0) {
 46371  		return
 46372  	}
 46373  	if libc.Xstrcmp(tls, zCmd, ts+13234 /* "text" */) == 0 {
 46374  		p1 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46375  	} else if libc.Xstrcmp(tls, zCmd, ts+15586 /* "text16" */) == 0 {
 46376  		p1 = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46377  	} else if libc.Xstrcmp(tls, zCmd, ts+13239 /* "blob" */) == 0 {
 46378  		p1 = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46379  	} else {
 46380  		return
 46381  	}
 46382  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 46383  	if zCmd == uintptr(0) {
 46384  		return
 46385  	}
 46386  	if libc.Xstrcmp(tls, zCmd, ts+15593 /* "bytes" */) == 0 {
 46387  		sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46388  	} else if libc.Xstrcmp(tls, zCmd, ts+15599 /* "bytes16" */) == 0 {
 46389  		sqlite3.Xsqlite3_value_bytes16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46390  	} else if libc.Xstrcmp(tls, zCmd, ts+15607 /* "noop" */) == 0 {
 46391  		// do nothing
 46392  	} else {
 46393  		return
 46394  	}
 46395  	zCmd = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 46396  	if zCmd == uintptr(0) {
 46397  		return
 46398  	}
 46399  	if libc.Xstrcmp(tls, zCmd, ts+13234 /* "text" */) == 0 {
 46400  		p2 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46401  	} else if libc.Xstrcmp(tls, zCmd, ts+15586 /* "text16" */) == 0 {
 46402  		p2 = sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46403  	} else if libc.Xstrcmp(tls, zCmd, ts+13239 /* "blob" */) == 0 {
 46404  		p2 = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46405  	} else {
 46406  		return
 46407  	}
 46408  	sqlite3.Xsqlite3_result_int(tls, context, (libc.Bool32(p1 != p2)))
 46409  }
 46410  
 46411  // This SQL function returns a different answer each time it is called, even if
 46412  // the arguments are the same.
 46413  func nondeterministicFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:964:13: */
 46414  	sqlite3.Xsqlite3_result_int(tls, context, libc.PostIncInt32(&cnt, 1))
 46415  }
 46416  
 46417  var cnt int32 = 0 /* test1.c:969:14 */
 46418  
 46419  // This SQL function returns the integer value of its argument as a MEM_IntReal
 46420  // value.
 46421  func intrealFunction(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:977:13: */
 46422  	bp := tls.Alloc(8)
 46423  	defer tls.Free(8)
 46424  
 46425  	var v sqlite3_int64 = sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46426  	sqlite3.Xsqlite3_result_int64(tls, context, v)
 46427  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_RESULT_INTREAL, libc.VaList(bp, context))
 46428  }
 46429  
 46430  // Usage:  sqlite3_create_function DB
 46431  //
 46432  // Call the sqlite3_create_function API on the given database in order
 46433  // to create a function named "x_coalesce".  This function does the same thing
 46434  // as the "coalesce" function.  This function also registers an SQL function
 46435  // named "x_sqlite_exec" that invokes sqlite3_exec().  Invoking sqlite3_exec()
 46436  // in this way is illegal recursion and should raise an SQLITE_MISUSE error.
 46437  // The effect is similar to trying to use the same database connection from
 46438  // two threads at the same time.
 46439  //
 46440  // The original motivation for this routine was to be able to call the
 46441  // sqlite3_create_function function while a query is in progress in order
 46442  // to test the SQLITE_MISUSE detection logic.
 46443  func test_create_function(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1002:26: */
 46444  	bp := tls.Alloc(36)
 46445  	defer tls.Free(36)
 46446  
 46447  	var rc int32
 46448  	// var db uintptr at bp+32, 4
 46449  
 46450  	if argc != 2 {
 46451  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46452  			ts+15539 /* " DB\"" */, 0))
 46453  		return TCL_ERROR
 46454  	}
 46455  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 46456  		return TCL_ERROR
 46457  	}
 46458  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15612 /* "x_coalesce" */, -1, SQLITE_UTF8, uintptr(0),
 46459  		*(*uintptr)(unsafe.Pointer(&struct {
 46460  			f func(*libc.TLS, uintptr, int32, uintptr)
 46461  		}{t1_ifnullFunc})), uintptr(0), uintptr(0))
 46462  	if rc == SQLITE_OK {
 46463  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15623 /* "hex8" */, 1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC),
 46464  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46465  				f func(*libc.TLS, uintptr, int32, uintptr)
 46466  			}{hex8Func})), uintptr(0), uintptr(0))
 46467  	}
 46468  	if rc == SQLITE_OK {
 46469  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15628 /* "hex16" */, 1, (SQLITE_UTF16 | SQLITE_DETERMINISTIC),
 46470  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46471  				f func(*libc.TLS, uintptr, int32, uintptr)
 46472  			}{hex16Func})), uintptr(0), uintptr(0))
 46473  	}
 46474  	if rc == SQLITE_OK {
 46475  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15634 /* "tkt2213func" */, 1, SQLITE_ANY, uintptr(0),
 46476  			*(*uintptr)(unsafe.Pointer(&struct {
 46477  				f func(*libc.TLS, uintptr, int32, uintptr)
 46478  			}{tkt2213Function})), uintptr(0), uintptr(0))
 46479  	}
 46480  	if rc == SQLITE_OK {
 46481  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15646 /* "pointer_change" */, 4, SQLITE_ANY, uintptr(0),
 46482  			*(*uintptr)(unsafe.Pointer(&struct {
 46483  				f func(*libc.TLS, uintptr, int32, uintptr)
 46484  			}{ptrChngFunction})), uintptr(0), uintptr(0))
 46485  	}
 46486  
 46487  	// Functions counter1() and counter2() have the same implementation - they
 46488  	// both return an ascending integer with each call.  But counter1() is marked
 46489  	// as non-deterministic and counter2() is marked as deterministic.
 46490  	if rc == SQLITE_OK {
 46491  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15661 /* "counter1" */, -1, SQLITE_UTF8,
 46492  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46493  				f func(*libc.TLS, uintptr, int32, uintptr)
 46494  			}{nondeterministicFunction})), uintptr(0), uintptr(0))
 46495  	}
 46496  	if rc == SQLITE_OK {
 46497  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15670 /* "counter2" */, -1, (SQLITE_UTF8 | SQLITE_DETERMINISTIC),
 46498  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46499  				f func(*libc.TLS, uintptr, int32, uintptr)
 46500  			}{nondeterministicFunction})), uintptr(0), uintptr(0))
 46501  	}
 46502  
 46503  	// The intreal() function converts its argument to an integer and returns
 46504  	// it as a MEM_IntReal.
 46505  	if rc == SQLITE_OK {
 46506  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15679 /* "intreal" */, 1, SQLITE_UTF8,
 46507  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 46508  				f func(*libc.TLS, uintptr, int32, uintptr)
 46509  			}{intrealFunction})), uintptr(0), uintptr(0))
 46510  	}
 46511  
 46512  	// Use the sqlite3_create_function16() API here. Mainly for fun, but also
 46513  	// because it is not tested anywhere else.
 46514  	if rc == SQLITE_OK {
 46515  		var zUtf16 uintptr
 46516  		var pVal uintptr
 46517  		sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 46518  		pVal = sqlite3.Xsqlite3ValueNew(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 46519  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, ts+15687 /* "x_sqlite_exec" */, uint8(SQLITE_UTF8), uintptr(0))
 46520  		zUtf16 = sqlite3.Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE))
 46521  		if (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FmallocFailed != 0 {
 46522  			rc = SQLITE_NOMEM
 46523  		} else {
 46524  			rc = sqlite3.Xsqlite3_create_function16(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zUtf16,
 46525  				1, SQLITE_UTF16, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 46526  					f func(*libc.TLS, uintptr, int32, uintptr)
 46527  				}{sqlite3ExecFunc})), uintptr(0), uintptr(0))
 46528  		}
 46529  		sqlite3.Xsqlite3ValueFree(tls, pVal)
 46530  		sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 46531  	}
 46532  
 46533  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 46534  		return TCL_ERROR
 46535  	}
 46536  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 46537  	return TCL_OK
 46538  }
 46539  
 46540  // Usage:  sqlite3_drop_modules DB ?NAME ...?
 46541  //
 46542  // Invoke the sqlite3_drop_modules(D,L) interface on database
 46543  // connection DB, in order to drop all modules except those named in
 46544  // the argument.
 46545  func test_drop_modules(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1092:26: */
 46546  	bp := tls.Alloc(36)
 46547  	defer tls.Free(36)
 46548  
 46549  	// var db uintptr at bp+32, 4
 46550  
 46551  	if argc != 2 {
 46552  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46553  			ts+15539 /* " DB\"" */, 0))
 46554  		return TCL_ERROR
 46555  	}
 46556  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 46557  		return TCL_ERROR
 46558  	}
 46559  	sqlite3.Xsqlite3_drop_modules(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), func() uintptr {
 46560  		if argc > 2 {
 46561  			return (argv + uintptr(2)*4)
 46562  		}
 46563  		return uintptr(0)
 46564  	}())
 46565  	return TCL_OK
 46566  }
 46567  
 46568  // Routines to implement the x_count() aggregate function.
 46569  //
 46570  // x_count() counts the number of non-null arguments.  But there are
 46571  // some twists for testing purposes.
 46572  //
 46573  // If the argument to x_count() is 40 then a UTF-8 error is reported
 46574  // on the step function.  If x_count(41) is seen, then a UTF-16 error
 46575  // is reported on the step function.  If the total count is 42, then
 46576  // a UTF-8 error is reported on the finalize function.
 46577  type t1CountCtx1 = struct{ Fn int32 } /* test1.c:1123:9 */
 46578  
 46579  // Routines to implement the x_count() aggregate function.
 46580  //
 46581  // x_count() counts the number of non-null arguments.  But there are
 46582  // some twists for testing purposes.
 46583  //
 46584  // If the argument to x_count() is 40 then a UTF-8 error is reported
 46585  // on the step function.  If x_count(41) is seen, then a UTF-16 error
 46586  // is reported on the step function.  If the total count is 42, then
 46587  // a UTF-8 error is reported on the finalize function.
 46588  type t1CountCtx = t1CountCtx1 /* test1.c:1123:27 */
 46589  
 46590  func t1CountStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:1127:13: */
 46591  	bp := tls.Alloc(9)
 46592  	defer tls.Free(9)
 46593  
 46594  	var p uintptr
 46595  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(t1CountCtx{})))
 46596  	if ((argc == 0) || (SQLITE_NULL != sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))))) && (p != 0) {
 46597  		(*t1CountCtx)(unsafe.Pointer(p)).Fn++
 46598  	}
 46599  	if argc > 0 {
 46600  		var v int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 46601  		if v == 40 {
 46602  			sqlite3.Xsqlite3_result_error(tls, context, ts+15701 /* "value of 40 hand..." */, -1)
 46603  		} else if v == 41 {
 46604  			*(*[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)}
 46605  			sqlite3.Xsqlite3_result_error16(tls, context, (bp /* &zUtf16ErrMsg */ + 1), -1)
 46606  		}
 46607  	}
 46608  }
 46609  
 46610  func t1CountFinalize(tls *libc.TLS, context uintptr) { /* test1.c:1149:13: */
 46611  	var p uintptr
 46612  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(t1CountCtx{})))
 46613  	if p != 0 {
 46614  		if (*t1CountCtx)(unsafe.Pointer(p)).Fn == 42 {
 46615  			sqlite3.Xsqlite3_result_error(tls, context, ts+15731 /* "x_count totals t..." */, -1)
 46616  		} else {
 46617  			sqlite3.Xsqlite3_result_int(tls, context, func() int32 {
 46618  				if p != 0 {
 46619  					return (*t1CountCtx)(unsafe.Pointer(p)).Fn
 46620  				}
 46621  				return 0
 46622  			}())
 46623  		}
 46624  	}
 46625  }
 46626  
 46627  func legacyCountStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:1162:13: */
 46628  	// no-op
 46629  }
 46630  
 46631  func legacyCountFinalize(tls *libc.TLS, context uintptr) { /* test1.c:1170:13: */
 46632  	sqlite3.Xsqlite3_result_int(tls, context, sqlite3.Xsqlite3_aggregate_count(tls, context))
 46633  }
 46634  
 46635  // Usage:  sqlite3_create_aggregate DB
 46636  //
 46637  // Call the sqlite3_create_function API on the given database in order
 46638  // to create a function named "x_count".  This function is similar
 46639  // to the built-in count() function, with a few special quirks
 46640  // for testing the sqlite3_result_error() APIs.
 46641  //
 46642  // The original motivation for this routine was to be able to call the
 46643  // sqlite3_create_aggregate function while a query is in progress in order
 46644  // to test the SQLITE_MISUSE detection logic.  See misuse.test.
 46645  //
 46646  // This routine was later extended to test the use of sqlite3_result_error()
 46647  // within aggregate functions.
 46648  //
 46649  // Later: It is now also extended to register the aggregate function
 46650  // "legacy_count()" with the supplied database handle. This is used
 46651  // to test the deprecated sqlite3_aggregate_count() API.
 46652  func test_create_aggregate(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1194:26: */
 46653  	bp := tls.Alloc(36)
 46654  	defer tls.Free(36)
 46655  
 46656  	// var db uintptr at bp+32, 4
 46657  
 46658  	var rc int32
 46659  	if argc != 2 {
 46660  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46661  			ts+15544 /* " FILENAME\"" */, 0))
 46662  		return TCL_ERROR
 46663  	}
 46664  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 46665  		return TCL_ERROR
 46666  	}
 46667  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15752 /* "x_count" */, 0, SQLITE_UTF8, uintptr(0), uintptr(0),
 46668  		*(*uintptr)(unsafe.Pointer(&struct {
 46669  			f func(*libc.TLS, uintptr, int32, uintptr)
 46670  		}{t1CountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{t1CountFinalize})))
 46671  	if rc == SQLITE_OK {
 46672  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15752 /* "x_count" */, 1, SQLITE_UTF8, uintptr(0), uintptr(0),
 46673  			*(*uintptr)(unsafe.Pointer(&struct {
 46674  				f func(*libc.TLS, uintptr, int32, uintptr)
 46675  			}{t1CountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{t1CountFinalize})))
 46676  	}
 46677  	if rc == SQLITE_OK {
 46678  		rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+15760 /* "legacy_count" */, 0, SQLITE_ANY, uintptr(0), uintptr(0),
 46679  			*(*uintptr)(unsafe.Pointer(&struct {
 46680  				f func(*libc.TLS, uintptr, int32, uintptr)
 46681  			}{legacyCountStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{legacyCountFinalize})))
 46682  	}
 46683  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), rc) != 0 {
 46684  		return TCL_ERROR
 46685  	}
 46686  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 46687  	return TCL_OK
 46688  }
 46689  
 46690  // Usage:  printf TEXT
 46691  //
 46692  // Send output to printf.  Use this rather than puts to merge the output
 46693  // in the correct sequence with debugging printfs inserted into C code.
 46694  // Puts uses a separate buffer and debugging statements will be out of
 46695  // sequence if it is used.
 46696  func test_printf(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1235:26: */
 46697  	bp := tls.Alloc(40)
 46698  	defer tls.Free(40)
 46699  
 46700  	if argc != 2 {
 46701  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46702  			ts+15773 /* " TEXT\"" */, 0))
 46703  		return TCL_ERROR
 46704  	}
 46705  	libc.Xprintf(tls, ts+294 /* "%s\n" */, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 46706  	return TCL_OK
 46707  }
 46708  
 46709  // Usage:  sqlite3_mprintf_int FORMAT INTEGER INTEGER INTEGER
 46710  //
 46711  // Call mprintf with three integer arguments
 46712  func sqlite3_mprintf_int(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1257:26: */
 46713  	bp := tls.Alloc(84)
 46714  	defer tls.Free(84)
 46715  
 46716  	// var a [3]int32 at bp+72, 12
 46717  
 46718  	var i int32
 46719  	var z uintptr
 46720  	if argc != 5 {
 46721  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46722  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 46723  		return TCL_ERROR
 46724  	}
 46725  	for i = 2; i < 5; i++ {
 46726  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 46727  			return TCL_ERROR
 46728  		}
 46729  	}
 46730  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 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))))
 46731  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 46732  	sqlite3.Xsqlite3_free(tls, z)
 46733  	return TCL_OK
 46734  }
 46735  
 46736  // Usage:  sqlite3_mprintf_int64 FORMAT INTEGER INTEGER INTEGER
 46737  //
 46738  // Call mprintf with three 64-bit integer arguments
 46739  func sqlite3_mprintf_int64(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1284:26: */
 46740  	bp := tls.Alloc(112)
 46741  	defer tls.Free(112)
 46742  
 46743  	var i int32
 46744  	// var a [3]sqlite_int64 at bp+88, 24
 46745  
 46746  	var z uintptr
 46747  	if argc != 5 {
 46748  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46749  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 46750  		return TCL_ERROR
 46751  	}
 46752  	for i = 2; i < 5; i++ {
 46753  		if sqlite3.Xsqlite3Atoi64(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+88 /* &a */ +uintptr((i-2))*8), sqlite3.Xsqlite3Strlen30(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))), uint8(SQLITE_UTF8)) != 0 {
 46754  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+15801 /* "argument is not ..." */, 0))
 46755  			return TCL_ERROR
 46756  		}
 46757  	}
 46758  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 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))))
 46759  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 46760  	sqlite3.Xsqlite3_free(tls, z)
 46761  	return TCL_OK
 46762  }
 46763  
 46764  // Usage:  sqlite3_mprintf_long FORMAT INTEGER INTEGER INTEGER
 46765  //
 46766  // Call mprintf with three long integer arguments.   This might be the
 46767  // same as sqlite3_mprintf_int or sqlite3_mprintf_int64, depending on
 46768  // platform.
 46769  func sqlite3_mprintf_long(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1317:26: */
 46770  	bp := tls.Alloc(96)
 46771  	defer tls.Free(96)
 46772  
 46773  	var i int32
 46774  	// var a [3]int32 at bp+84, 12
 46775  
 46776  	// var b [3]int32 at bp+72, 12
 46777  
 46778  	var z uintptr
 46779  	if argc != 5 {
 46780  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46781  			ts+15780 /* " FORMAT INT INT ..." */, 0))
 46782  		return TCL_ERROR
 46783  	}
 46784  	for i = 2; i < 5; i++ {
 46785  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+72 /* &b */ +uintptr((i-2))*4)) != 0 {
 46786  			return TCL_ERROR
 46787  		}
 46788  		*(*int32)(unsafe.Pointer(bp + 84 /* &a[0] */ + uintptr((i-2))*4)) = int32(*(*int32)(unsafe.Pointer(bp + 72 /* &b[0] */ + uintptr((i-2))*4)))
 46789  		*(*int32)(unsafe.Pointer(bp + 84 /* &a */ + uintptr((i-2))*4)) &= libc.Int32FromUint64(((u64((uint64(1))) << (uint32(unsafe.Sizeof(int32(0))) * uint32(8))) - uint64(1)))
 46790  	}
 46791  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 84 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 84 /* &a[0] */ + 1*4)), *(*int32)(unsafe.Pointer(bp + 84 /* &a[0] */ + 2*4))))
 46792  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 46793  	sqlite3.Xsqlite3_free(tls, z)
 46794  	return TCL_OK
 46795  }
 46796  
 46797  // Usage:  sqlite3_mprintf_str FORMAT INTEGER INTEGER STRING
 46798  //
 46799  // Call mprintf with two integer arguments and one string argument
 46800  func sqlite3_mprintf_str(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1348:26: */
 46801  	bp := tls.Alloc(84)
 46802  	defer tls.Free(84)
 46803  
 46804  	// var a [3]int32 at bp+72, 12
 46805  
 46806  	var i int32
 46807  	var z uintptr
 46808  	if (argc < 4) || (argc > 5) {
 46809  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46810  			ts+15840 /* " FORMAT INT INT ..." */, 0))
 46811  		return TCL_ERROR
 46812  	}
 46813  	for i = 2; i < 4; i++ {
 46814  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 46815  			return TCL_ERROR
 46816  		}
 46817  	}
 46818  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 72 /* &a[0] */ + 1*4)), func() uintptr {
 46819  		if argc > 4 {
 46820  			return *(*uintptr)(unsafe.Pointer(argv + 4*4))
 46821  		}
 46822  		return uintptr(0)
 46823  	}()))
 46824  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 46825  	sqlite3.Xsqlite3_free(tls, z)
 46826  	return TCL_OK
 46827  }
 46828  
 46829  // Usage:  sqlite3_snprintf_str INTEGER FORMAT INTEGER INTEGER STRING
 46830  //
 46831  // Call mprintf with two integer arguments and one string argument
 46832  func sqlite3_snprintf_str(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1375:26: */
 46833  	bp := tls.Alloc(104)
 46834  	defer tls.Free(104)
 46835  
 46836  	// var a [3]int32 at bp+92, 12
 46837  
 46838  	var i int32
 46839  	// var n int32 at bp+88, 4
 46840  
 46841  	var z uintptr
 46842  	if (argc < 5) || (argc > 6) {
 46843  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46844  			ts+15866 /* " INT FORMAT INT ..." */, 0))
 46845  		return TCL_ERROR
 46846  	}
 46847  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+88 /* &n */) != 0 {
 46848  		return TCL_ERROR
 46849  	}
 46850  	if *(*int32)(unsafe.Pointer(bp + 88 /* n */)) < 0 {
 46851  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+15896 /* "N must be non-ne..." */, 0))
 46852  		return TCL_ERROR
 46853  	}
 46854  	for i = 3; i < 5; i++ {
 46855  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+92 /* &a */ +uintptr((i-3))*4)) != 0 {
 46856  			return TCL_ERROR
 46857  		}
 46858  	}
 46859  	z = sqlite3.Xsqlite3_malloc(tls, (*(*int32)(unsafe.Pointer(bp + 88 /* n */)) + 1))
 46860  	sqlite3.Xsqlite3_snprintf(tls, *(*int32)(unsafe.Pointer(bp + 88 /* n */)), z, *(*uintptr)(unsafe.Pointer(argv + 2*4)), libc.VaList(bp+48, *(*int32)(unsafe.Pointer(bp + 92 /* &a[0] */)), *(*int32)(unsafe.Pointer(bp + 92 /* &a[0] */ + 1*4)), func() uintptr {
 46861  		if argc > 4 {
 46862  			return *(*uintptr)(unsafe.Pointer(argv + 5*4))
 46863  		}
 46864  		return uintptr(0)
 46865  	}()))
 46866  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 46867  	sqlite3.Xsqlite3_free(tls, z)
 46868  	return TCL_OK
 46869  }
 46870  
 46871  // Usage:  sqlite3_mprintf_double FORMAT INTEGER INTEGER DOUBLE
 46872  //
 46873  // Call mprintf with two integer arguments and one double argument
 46874  func sqlite3_mprintf_double(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1409:26: */
 46875  	bp := tls.Alloc(96)
 46876  	defer tls.Free(96)
 46877  
 46878  	// var a [3]int32 at bp+72, 12
 46879  
 46880  	var i int32
 46881  	// var r float64 at bp+88, 8
 46882  
 46883  	var z uintptr
 46884  	if argc != 5 {
 46885  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46886  			ts+15919 /* " FORMAT INT INT ..." */, 0))
 46887  		return TCL_ERROR
 46888  	}
 46889  	for i = 2; i < 4; i++ {
 46890  		if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+72 /* &a */ +uintptr((i-2))*4)) != 0 {
 46891  			return TCL_ERROR
 46892  		}
 46893  	}
 46894  	if tcl.XTcl_GetDouble(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*4)), bp+88 /* &r */) != 0 {
 46895  		return TCL_ERROR
 46896  	}
 46897  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 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 */))))
 46898  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, z, 0))
 46899  	sqlite3.Xsqlite3_free(tls, z)
 46900  	return TCL_OK
 46901  }
 46902  
 46903  // Usage:  sqlite3_mprintf_scaled FORMAT DOUBLE DOUBLE
 46904  //
 46905  // Call mprintf with a single double argument which is the product of the
 46906  // two arguments given above.  This is used to generate overflow and underflow
 46907  // doubles to test that they are converted properly.
 46908  func sqlite3_mprintf_scaled(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1440:26: */
 46909  	bp := tls.Alloc(72)
 46910  	defer tls.Free(72)
 46911  
 46912  	var i int32
 46913  	// var r [2]float64 at bp+56, 16
 46914  
 46915  	var z uintptr
 46916  	if argc != 4 {
 46917  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46918  			ts+15943 /* " FORMAT DOUBLE D..." */, 0))
 46919  		return TCL_ERROR
 46920  	}
 46921  	for i = 2; i < 4; i++ {
 46922  		if tcl.XTcl_GetDouble(tls, interp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)), (bp+56 /* &r */ +uintptr((i-2))*8)) != 0 {
 46923  			return TCL_ERROR
 46924  		}
 46925  	}
 46926  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.VaList(bp+32, (*(*float64)(unsafe.Pointer(bp + 56 /* &r[0] */))**(*float64)(unsafe.Pointer(bp + 56 /* &r[0] */ + 1*8)))))
 46927  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, z, 0))
 46928  	sqlite3.Xsqlite3_free(tls, z)
 46929  	return TCL_OK
 46930  }
 46931  
 46932  // Usage:  sqlite3_mprintf_stronly FORMAT STRING
 46933  //
 46934  // Call mprintf with a single double argument which is the product of the
 46935  // two arguments given above.  This is used to generate overflow and underflow
 46936  // doubles to test that they are converted properly.
 46937  func sqlite3_mprintf_stronly(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1470:26: */
 46938  	bp := tls.Alloc(56)
 46939  	defer tls.Free(56)
 46940  
 46941  	var z uintptr
 46942  	if argc != 3 {
 46943  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46944  			ts+15966 /* " FORMAT STRING\"" */, 0))
 46945  		return TCL_ERROR
 46946  	}
 46947  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 46948  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, z, 0))
 46949  	sqlite3.Xsqlite3_free(tls, z)
 46950  	return TCL_OK
 46951  }
 46952  
 46953  // Usage:  sqlite3_mprintf_hexdouble FORMAT HEX
 46954  //
 46955  // Call mprintf with a single double argument which is derived from the
 46956  // hexadecimal encoding of an IEEE double.
 46957  func sqlite3_mprintf_hexdouble(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:1494:26: */
 46958  	bp := tls.Alloc(112)
 46959  	defer tls.Free(112)
 46960  
 46961  	var z uintptr
 46962  	// var r float64 at bp+96, 8
 46963  
 46964  	// var x1 uint32 at bp+92, 4
 46965  
 46966  	// var x2 uint32 at bp+88, 4
 46967  
 46968  	// var d sqlite_uint64 at bp+104, 8
 46969  
 46970  	if argc != 3 {
 46971  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 46972  			ts+15966 /* " FORMAT STRING\"" */, 0))
 46973  		return TCL_ERROR
 46974  	}
 46975  	if libc.Xsscanf(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+15982 /* "%08x%08x" */, libc.VaList(bp+32, bp+88 /* &x2 */, bp+92 /* &x1 */)) != 2 {
 46976  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+15991 /* "2nd argument sho..." */, 0))
 46977  		return TCL_ERROR
 46978  	}
 46979  	*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) = sqlite_uint64(*(*uint32)(unsafe.Pointer(bp + 88 /* x2 */)))
 46980  	*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) = ((*(*sqlite_uint64)(unsafe.Pointer(bp + 104 /* d */)) << 32) + sqlite_uint64(*(*uint32)(unsafe.Pointer(bp + 92 /* x1 */))))
 46981  	libc.Xmemcpy(tls, bp+96 /* &r */, bp+104 /* &d */, uint32(unsafe.Sizeof(float64(0))))
 46982  	z = sqlite3.Xsqlite3_mprintf(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.VaList(bp+64, *(*float64)(unsafe.Pointer(bp + 96 /* r */))))
 46983  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, z, 0))
 46984  	sqlite3.Xsqlite3_free(tls, z)
 46985  	return TCL_OK
 46986  }
 46987  
 46988  // Usage: sqlite3_enable_shared_cache ?BOOLEAN?
 46989  //
 46990  func test_enable_shared(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1527:26: */
 46991  	bp := tls.Alloc(4)
 46992  	defer tls.Free(4)
 46993  
 46994  	var rc int32
 46995  	// var enable int32 at bp, 4
 46996  
 46997  	var ret int32 = 0
 46998  
 46999  	if (objc != 2) && (objc != 1) {
 47000  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16035 /* "?BOOLEAN?" */)
 47001  		return TCL_ERROR
 47002  	}
 47003  	ret = sqlite3.Xsqlite3Config.FsharedCacheEnabled
 47004  
 47005  	if objc == 2 {
 47006  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &enable */) != 0 {
 47007  			return TCL_ERROR
 47008  		}
 47009  		rc = sqlite3.Xsqlite3_enable_shared_cache(tls, *(*int32)(unsafe.Pointer(bp /* enable */)))
 47010  		if rc != SQLITE_OK {
 47011  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, rc), uintptr(0))
 47012  			return TCL_ERROR
 47013  		}
 47014  	}
 47015  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((ret) != 0))))
 47016  	return TCL_OK
 47017  }
 47018  
 47019  // Usage: sqlite3_extended_result_codes   DB    BOOLEAN
 47020  //
 47021  func test_extended_result_codes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1564:26: */
 47022  	bp := tls.Alloc(8)
 47023  	defer tls.Free(8)
 47024  
 47025  	// var enable int32 at bp+4, 4
 47026  
 47027  	// var db uintptr at bp, 4
 47028  
 47029  	if objc != 3 {
 47030  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16045 /* "DB BOOLEAN" */)
 47031  		return TCL_ERROR
 47032  	}
 47033  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 47034  		return TCL_ERROR
 47035  	}
 47036  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &enable */) != 0 {
 47037  		return TCL_ERROR
 47038  	}
 47039  	sqlite3.Xsqlite3_extended_result_codes(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 4 /* enable */)))
 47040  	return TCL_OK
 47041  }
 47042  
 47043  // Usage: sqlite3_libversion_number
 47044  //
 47045  func test_libversion_number(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1587:26: */
 47046  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_libversion_number(tls)))
 47047  	return TCL_OK
 47048  }
 47049  
 47050  // Usage: sqlite3_table_column_metadata DB dbname tblname colname
 47051  //
 47052  func test_table_column_metadata(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1601:26: */
 47053  	bp := tls.Alloc(40)
 47054  	defer tls.Free(40)
 47055  
 47056  	// var db uintptr at bp+16, 4
 47057  
 47058  	var zDb uintptr
 47059  	var zTbl uintptr
 47060  	var zCol uintptr
 47061  	var rc int32
 47062  	var pRet uintptr
 47063  	// var zDatatype uintptr at bp+20, 4
 47064  
 47065  	// var zCollseq uintptr at bp+24, 4
 47066  
 47067  	// var notnull int32 at bp+28, 4
 47068  
 47069  	// var primarykey int32 at bp+32, 4
 47070  
 47071  	// var autoincrement int32 at bp+36, 4
 47072  
 47073  	if (objc != 5) && (objc != 4) {
 47074  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16056 /* "DB dbname tblnam..." */)
 47075  		return TCL_ERROR
 47076  	}
 47077  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 47078  		return TCL_ERROR
 47079  	}
 47080  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47081  	zTbl = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 47082  	if objc == 5 {
 47083  		zCol = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 47084  	} else {
 47085  		zCol = uintptr(0)
 47086  	}
 47087  
 47088  	if libc.Xstrlen(tls, zDb) == size_t(0) {
 47089  		zDb = uintptr(0)
 47090  	}
 47091  
 47092  	rc = sqlite3.Xsqlite3_table_column_metadata(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDb, zTbl, zCol,
 47093  		bp+20 /* &zDatatype */, bp+24 /* &zCollseq */, bp+28 /* &notnull */, bp+32 /* &primarykey */, bp+36 /* &autoincrement */)
 47094  
 47095  	if rc != SQLITE_OK {
 47096  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))), 0))
 47097  		return TCL_ERROR
 47098  	}
 47099  
 47100  	pRet = tcl.XTcl_NewObj(tls)
 47101  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* zDatatype */)), -1))
 47102  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* zCollseq */)), -1))
 47103  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 28 /* notnull */))))
 47104  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 32 /* primarykey */))))
 47105  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 36 /* autoincrement */))))
 47106  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 47107  
 47108  	return TCL_OK
 47109  }
 47110  
 47111  func blobHandleFromObj(tls *libc.TLS, interp uintptr, pObj uintptr, ppBlob uintptr) int32 { /* test1.c:1652:26: */
 47112  	bp := tls.Alloc(8)
 47113  	defer tls.Free(8)
 47114  
 47115  	var z uintptr
 47116  	// var n int32 at bp, 4
 47117  
 47118  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 47119  	if *(*int32)(unsafe.Pointer(bp /* n */)) == 0 {
 47120  		*(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0)
 47121  	} else {
 47122  		// var notUsed int32 at bp+4, 4
 47123  
 47124  		var channel Tcl_Channel
 47125  		var instanceData ClientData
 47126  
 47127  		channel = tcl.XTcl_GetChannel(tls, interp, z, bp+4 /* &notUsed */)
 47128  		if !(channel != 0) {
 47129  			return TCL_ERROR
 47130  		}
 47131  
 47132  		tcl.XTcl_Flush(tls, channel)
 47133  		tcl.XTcl_Seek(tls, channel, int64(0), SEEK_SET)
 47134  
 47135  		instanceData = tcl.XTcl_GetChannelInstanceData(tls, channel)
 47136  		*(*uintptr)(unsafe.Pointer(ppBlob)) = *(*uintptr)(unsafe.Pointer(instanceData))
 47137  	}
 47138  
 47139  	return TCL_OK
 47140  }
 47141  
 47142  func test_blob_reopen(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1681:26: */
 47143  	bp := tls.Alloc(16)
 47144  	defer tls.Free(16)
 47145  
 47146  	// var iRowid Tcl_WideInt at bp+8, 8
 47147  
 47148  	// var pBlob uintptr at bp, 4
 47149  
 47150  	var rc int32
 47151  
 47152  	if objc != 3 {
 47153  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16082 /* "CHANNEL ROWID" */)
 47154  		return TCL_ERROR
 47155  	}
 47156  
 47157  	if blobHandleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &pBlob */) != 0 {
 47158  		return TCL_ERROR
 47159  	}
 47160  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+8 /* &iRowid */) != 0 {
 47161  		return TCL_ERROR
 47162  	}
 47163  
 47164  	rc = sqlite3.Xsqlite3_blob_reopen(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iRowid */)))
 47165  	if rc != SQLITE_OK {
 47166  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 47167  	}
 47168  
 47169  	return func() int32 {
 47170  		if rc == SQLITE_OK {
 47171  			return TCL_OK
 47172  		}
 47173  		return TCL_ERROR
 47174  	}()
 47175  }
 47176  
 47177  // Usage: sqlite3_create_collation_v2 DB-HANDLE NAME CMP-PROC DEL-PROC
 47178  //
 47179  //   This Tcl proc is used for testing the experimental
 47180  //   sqlite3_create_collation_v2() interface.
 47181  type TestCollationX1 = struct {
 47182  	Finterp uintptr
 47183  	FpCmp   uintptr
 47184  	FpDel   uintptr
 47185  } /* test1.c:1715:1 */
 47186  
 47187  type TestCollationX = TestCollationX1 /* test1.c:1720:31 */
 47188  
 47189  func testCreateCollationDel(tls *libc.TLS, pCtx uintptr) { /* test1.c:1721:13: */
 47190  	var p uintptr = pCtx
 47191  
 47192  	var rc int32 = tcl.XTcl_EvalObjEx(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, (*TestCollationX)(unsafe.Pointer(p)).FpDel, (TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL))
 47193  	if rc != TCL_OK {
 47194  		tcl.XTcl_BackgroundError(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp)
 47195  	}
 47196  
 47197  	for ok := true; ok; ok = 0 != 0 {
 47198  		var _objPtr uintptr = (*TestCollationX)(unsafe.Pointer(p)).FpCmp
 47199  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47200  			tcl.XTclFreeObj(tls, _objPtr)
 47201  		}
 47202  	}
 47203  	for ok1 := true; ok1; ok1 = 0 != 0 {
 47204  		var _objPtr uintptr = (*TestCollationX)(unsafe.Pointer(p)).FpDel
 47205  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47206  			tcl.XTclFreeObj(tls, _objPtr)
 47207  		}
 47208  	}
 47209  	sqlite3.Xsqlite3_free(tls, p)
 47210  }
 47211  
 47212  func testCreateCollationCmp(tls *libc.TLS, pCtx uintptr, nLeft int32, zLeft uintptr, nRight int32, zRight uintptr) int32 { /* test1.c:1733:12: */
 47213  	bp := tls.Alloc(4)
 47214  	defer tls.Free(4)
 47215  
 47216  	var p uintptr = pCtx
 47217  	var pScript uintptr = tcl.XTcl_DuplicateObj(tls, (*TestCollationX)(unsafe.Pointer(p)).FpCmp)
 47218  	*(*int32)(unsafe.Pointer(bp /* iRes */)) = 0
 47219  
 47220  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 47221  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zLeft, nLeft))
 47222  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewStringObj(tls, zRight, nRight))
 47223  
 47224  	if (TCL_OK != tcl.XTcl_EvalObjEx(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, pScript, (TCL_EVAL_DIRECT|TCL_EVAL_GLOBAL))) ||
 47225  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp), bp /* &iRes */)) {
 47226  		tcl.XTcl_BackgroundError(tls, (*TestCollationX)(unsafe.Pointer(p)).Finterp)
 47227  	}
 47228  	for ok := true; ok; ok = 0 != 0 {
 47229  		var _objPtr uintptr = pScript
 47230  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47231  			tcl.XTclFreeObj(tls, _objPtr)
 47232  		}
 47233  	}
 47234  
 47235  	return *(*int32)(unsafe.Pointer(bp /* iRes */))
 47236  }
 47237  
 47238  func test_create_collation_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1757:26: */
 47239  	bp := tls.Alloc(20)
 47240  	defer tls.Free(20)
 47241  
 47242  	var p uintptr
 47243  	// var db uintptr at bp+16, 4
 47244  
 47245  	var rc int32
 47246  
 47247  	if objc != 5 {
 47248  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16096 /* "DB-HANDLE NAME C..." */)
 47249  		return TCL_ERROR
 47250  	}
 47251  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 47252  		return TCL_ERROR
 47253  	}
 47254  
 47255  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(TestCollationX{})))
 47256  	(*TestCollationX)(unsafe.Pointer(p)).FpCmp = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 47257  	(*TestCollationX)(unsafe.Pointer(p)).FpDel = *(*uintptr)(unsafe.Pointer(objv + 4*4))
 47258  	(*TestCollationX)(unsafe.Pointer(p)).Finterp = interp
 47259  	(*Tcl_Obj)(unsafe.Pointer((*TestCollationX)(unsafe.Pointer(p)).FpCmp)).FrefCount++
 47260  	(*Tcl_Obj)(unsafe.Pointer((*TestCollationX)(unsafe.Pointer(p)).FpDel)).FrefCount++
 47261  
 47262  	rc = sqlite3.Xsqlite3_create_collation_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 16,
 47263  		p, *(*uintptr)(unsafe.Pointer(&struct {
 47264  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 47265  		}{testCreateCollationCmp})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testCreateCollationDel})))
 47266  	if rc != SQLITE_MISUSE {
 47267  		tcl.XTcl_AppendResult(tls, interp,
 47268  			libc.VaList(bp, ts+16129 /* "sqlite3_create_c..." */, uintptr(0)))
 47269  		return TCL_ERROR
 47270  	}
 47271  	rc = sqlite3.Xsqlite3_create_collation_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), SQLITE_UTF8,
 47272  		p, *(*uintptr)(unsafe.Pointer(&struct {
 47273  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 47274  		}{testCreateCollationCmp})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testCreateCollationDel})))
 47275  	return TCL_OK
 47276  }
 47277  
 47278  // USAGE: sqlite3_create_function_v2 DB NAME NARG ENC ?SWITCHES?
 47279  //
 47280  // Available switches are:
 47281  //
 47282  //   -func    SCRIPT
 47283  //   -step    SCRIPT
 47284  //   -final   SCRIPT
 47285  //   -destroy SCRIPT
 47286  type CreateFunctionV21 = struct {
 47287  	Finterp   uintptr
 47288  	FpFunc    uintptr
 47289  	FpStep    uintptr
 47290  	FpFinal   uintptr
 47291  	FpDestroy uintptr
 47292  } /* test1.c:1804:9 */
 47293  
 47294  // USAGE: sqlite3_create_function_v2 DB NAME NARG ENC ?SWITCHES?
 47295  //
 47296  // Available switches are:
 47297  //
 47298  //   -func    SCRIPT
 47299  //   -step    SCRIPT
 47300  //   -final   SCRIPT
 47301  //   -destroy SCRIPT
 47302  type CreateFunctionV2 = CreateFunctionV21 /* test1.c:1804:33 */
 47303  
 47304  func cf2Func(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* test1.c:1812:13: */
 47305  }
 47306  
 47307  func cf2Step(tls *libc.TLS, ctx uintptr, nArg int32, aArg uintptr) { /* test1.c:1814:13: */
 47308  }
 47309  
 47310  func cf2Final(tls *libc.TLS, ctx uintptr) { /* test1.c:1816:13: */
 47311  }
 47312  
 47313  func cf2Destroy(tls *libc.TLS, pUser uintptr) { /* test1.c:1818:13: */
 47314  	var p uintptr = pUser
 47315  
 47316  	if ((*CreateFunctionV2)(unsafe.Pointer(p)).Finterp != 0) && ((*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0) {
 47317  		var rc int32 = tcl.XTcl_EvalObjEx(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).Finterp, (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy, 0)
 47318  		if rc != TCL_OK {
 47319  			tcl.XTcl_BackgroundError(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).Finterp)
 47320  		}
 47321  	}
 47322  
 47323  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 47324  		for ok := true; ok; ok = 0 != 0 {
 47325  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc
 47326  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47327  				tcl.XTclFreeObj(tls, _objPtr)
 47328  			}
 47329  		}
 47330  	}
 47331  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 47332  		for ok1 := true; ok1; ok1 = 0 != 0 {
 47333  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep
 47334  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47335  				tcl.XTclFreeObj(tls, _objPtr)
 47336  			}
 47337  		}
 47338  	}
 47339  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 47340  		for ok2 := true; ok2; ok2 = 0 != 0 {
 47341  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal
 47342  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47343  				tcl.XTclFreeObj(tls, _objPtr)
 47344  			}
 47345  		}
 47346  	}
 47347  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 47348  		for ok3 := true; ok3; ok3 = 0 != 0 {
 47349  			var _objPtr uintptr = (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy
 47350  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 47351  				tcl.XTclFreeObj(tls, _objPtr)
 47352  			}
 47353  		}
 47354  	}
 47355  	sqlite3.Xsqlite3_free(tls, p)
 47356  }
 47357  
 47358  func test_create_function_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1832:26: */
 47359  	bp := tls.Alloc(100)
 47360  	defer tls.Free(100)
 47361  
 47362  	// var db uintptr at bp+16, 4
 47363  
 47364  	var zFunc uintptr
 47365  	// var nArg int32 at bp+20, 4
 47366  
 47367  	// var enc int32 at bp+72, 4
 47368  
 47369  	var p uintptr
 47370  	var i int32
 47371  	var rc int32
 47372  
 47373  	*(*[6]EncTable)(unsafe.Pointer(bp + 24 /* aEnc */)) = [6]EncTable{
 47374  		{FzEnc: ts + 16194 /* "utf8" */, Fenc: SQLITE_UTF8},
 47375  		{FzEnc: ts + 16199 /* "utf16" */, Fenc: SQLITE_UTF16},
 47376  		{FzEnc: ts + 16205 /* "utf16le" */, Fenc: SQLITE_UTF16LE},
 47377  		{FzEnc: ts + 16213 /* "utf16be" */, Fenc: SQLITE_UTF16BE},
 47378  		{FzEnc: ts + 13244 /* "any" */, Fenc: SQLITE_ANY},
 47379  		{FzEnc: ts + 14654 /* "0" */},
 47380  	}
 47381  
 47382  	if (objc < 5) || ((objc % 2) == 0) {
 47383  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16221 /* "DB NAME NARG ENC..." */)
 47384  		return TCL_ERROR
 47385  	}
 47386  
 47387  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 47388  		return TCL_ERROR
 47389  	}
 47390  	zFunc = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47391  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+20 /* &nArg */) != 0 {
 47392  		return TCL_ERROR
 47393  	}
 47394  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+24 /* &aEnc[0] */, int32(unsafe.Sizeof(EncTable{})),
 47395  		ts+16250 /* "encoding" */, 0, bp+72 /* &enc */) != 0 {
 47396  		return TCL_ERROR
 47397  	}
 47398  	*(*int32)(unsafe.Pointer(bp + 72 /* enc */)) = (*EncTable)(unsafe.Pointer(bp + 24 /* &aEnc */ + uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* enc */)))*8)).Fenc
 47399  
 47400  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(CreateFunctionV2{})))
 47401  
 47402  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(CreateFunctionV2{})))
 47403  	(*CreateFunctionV2)(unsafe.Pointer(p)).Finterp = interp
 47404  
 47405  	for i = 5; i < objc; i = i + (2) {
 47406  		// var iSwitch int32 at bp+96, 4
 47407  
 47408  		*(*[5]uintptr)(unsafe.Pointer(bp + 76 /* azSwitch */)) = [5]uintptr{ts + 16259 /* "-func" */, ts + 16265 /* "-step" */, ts + 16271 /* "-final" */, ts + 16278 /* "-destroy" */, uintptr(0)}
 47409  		if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+76 /* &azSwitch[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+16287 /* "switch" */, 0, bp+96 /* &iSwitch */) != 0 {
 47410  			sqlite3.Xsqlite3_free(tls, p)
 47411  			return TCL_ERROR
 47412  		}
 47413  
 47414  		switch *(*int32)(unsafe.Pointer(bp + 96 /* iSwitch */)) {
 47415  		case 0:
 47416  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4))
 47417  			break
 47418  		case 1:
 47419  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpStep = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4))
 47420  			break
 47421  		case 2:
 47422  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4))
 47423  			break
 47424  		case 3:
 47425  			(*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy = *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4))
 47426  			break
 47427  		}
 47428  	}
 47429  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 47430  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc)
 47431  	}
 47432  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 47433  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpStep = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep)
 47434  	}
 47435  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 47436  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal)
 47437  	}
 47438  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 47439  		(*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy = tcl.XTcl_DuplicateObj(tls, (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy)
 47440  	}
 47441  
 47442  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 47443  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc)).FrefCount++
 47444  	}
 47445  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 47446  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpStep)).FrefCount++
 47447  	}
 47448  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 47449  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal)).FrefCount++
 47450  	}
 47451  	if (*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy != 0 {
 47452  		(*Tcl_Obj)(unsafe.Pointer((*CreateFunctionV2)(unsafe.Pointer(p)).FpDestroy)).FrefCount++
 47453  	}
 47454  
 47455  	rc = sqlite3.Xsqlite3_create_function_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zFunc, *(*int32)(unsafe.Pointer(bp + 20 /* nArg */)), *(*int32)(unsafe.Pointer(bp + 72 /* enc */)), p,
 47456  		func() uintptr {
 47457  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFunc != 0 {
 47458  				return *(*uintptr)(unsafe.Pointer(&struct {
 47459  					f func(*libc.TLS, uintptr, int32, uintptr)
 47460  				}{cf2Func}))
 47461  			}
 47462  			return uintptr(0)
 47463  		}(),
 47464  		func() uintptr {
 47465  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpStep != 0 {
 47466  				return *(*uintptr)(unsafe.Pointer(&struct {
 47467  					f func(*libc.TLS, uintptr, int32, uintptr)
 47468  				}{cf2Step}))
 47469  			}
 47470  			return uintptr(0)
 47471  		}(),
 47472  		func() uintptr {
 47473  			if (*CreateFunctionV2)(unsafe.Pointer(p)).FpFinal != 0 {
 47474  				return *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cf2Final}))
 47475  			}
 47476  			return uintptr(0)
 47477  		}(),
 47478  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cf2Destroy})))
 47479  	if rc != SQLITE_OK {
 47480  		tcl.XTcl_ResetResult(tls, interp)
 47481  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 47482  		return TCL_ERROR
 47483  	}
 47484  	return TCL_OK
 47485  }
 47486  
 47487  type EncTable = struct {
 47488  	FzEnc uintptr
 47489  	Fenc  int32
 47490  } /* test1.c:1846:3 */
 47491  
 47492  // Usage: sqlite3_load_extension DB-HANDLE FILE ?PROC?
 47493  func test_load_extension(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1920:26: */
 47494  	bp := tls.Alloc(56)
 47495  	defer tls.Free(56)
 47496  
 47497  	// var cmdInfo Tcl_CmdInfo at bp+24, 32
 47498  
 47499  	var db uintptr
 47500  	_ = db
 47501  	var rc int32
 47502  	var zDb uintptr
 47503  	var zFile uintptr
 47504  	_ = zFile
 47505  	var zProc uintptr = uintptr(0)
 47506  	_ = zProc
 47507  	var zErr uintptr = uintptr(0)
 47508  
 47509  	if (objc != 4) && (objc != 3) {
 47510  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16294 /* "DB-HANDLE FILE ?..." */)
 47511  		return TCL_ERROR
 47512  	}
 47513  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 47514  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47515  	if objc == 4 {
 47516  		zProc = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 47517  	}
 47518  
 47519  	// Extract the C database handle from the Tcl command name
 47520  	if !(tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+24 /* &cmdInfo */) != 0) {
 47521  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320 /* "command not foun..." */, zDb, uintptr(0)))
 47522  		return TCL_ERROR
 47523  	}
 47524  	db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 24 /* &cmdInfo */)).FobjClientData)).Fdb
 47525  
 47526  	// Call the underlying C function. If an error occurs, set rc to
 47527  	// TCL_ERROR and load any error string into the interpreter. If no
 47528  	// error occurs, set rc to TCL_OK.
 47529  	rc = SQLITE_ERROR
 47530  	zErr = sqlite3.Xsqlite3_mprintf(tls, ts+16316 /* "this build omits..." */, 0)
 47531  	_ = zProc
 47532  	_ = zFile
 47533  	if rc != SQLITE_OK {
 47534  		tcl.XTcl_SetResult(tls, interp, func() uintptr {
 47535  			if zErr != 0 {
 47536  				return zErr
 47537  			}
 47538  			return ts + 489 /* "" */
 47539  		}(), uintptr(1))
 47540  		rc = TCL_ERROR
 47541  	} else {
 47542  		rc = TCL_OK
 47543  	}
 47544  	sqlite3.Xsqlite3_free(tls, zErr)
 47545  
 47546  	return rc
 47547  }
 47548  
 47549  // Usage: sqlite3_enable_load_extension DB-HANDLE ONOFF
 47550  func test_enable_load(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:1978:26: */
 47551  	bp := tls.Alloc(68)
 47552  	defer tls.Free(68)
 47553  
 47554  	// var cmdInfo Tcl_CmdInfo at bp+32, 32
 47555  
 47556  	var db uintptr
 47557  	_ = db
 47558  	var zDb uintptr
 47559  	// var onoff int32 at bp+64, 4
 47560  
 47561  	if objc != 3 {
 47562  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16358 /* "DB-HANDLE ONOFF" */)
 47563  		return TCL_ERROR
 47564  	}
 47565  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 47566  
 47567  	// Extract the C database handle from the Tcl command name
 47568  	if !(tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+32 /* &cmdInfo */) != 0) {
 47569  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320 /* "command not foun..." */, zDb, uintptr(0)))
 47570  		return TCL_ERROR
 47571  	}
 47572  	db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 32 /* &cmdInfo */)).FobjClientData)).Fdb
 47573  
 47574  	// Get the onoff parameter
 47575  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+64 /* &onoff */) != 0 {
 47576  		return TCL_ERROR
 47577  	}
 47578  
 47579  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+16316 /* "this build omits..." */))
 47580  	return TCL_ERROR
 47581  }
 47582  
 47583  // Usage:  sqlite_abort
 47584  //
 47585  // Shutdown the process immediately.  This is not a clean shutdown.
 47586  // This command is used to test the recoverability of a database in
 47587  // the event of a program crash.
 47588  func sqlite_abort(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2024:26: */
 47589  	libc.Xexit(tls, 255)
 47590  	// This will always fail
 47591  	return TCL_OK
 47592  }
 47593  
 47594  // The following routine is a user-defined SQL function whose purpose
 47595  // is to test the sqlite_set_result() API.
 47596  func testFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test1.c:2045:13: */
 47597  	var zArg0 uintptr
 47598  __1:
 47599  	if !(argc >= 2) {
 47600  		goto __2
 47601  	}
 47602  	zArg0 = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 47603  	if !(zArg0 != 0) {
 47604  		goto __3
 47605  	}
 47606  	if !(0 == sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+2438 /* "int" */)) {
 47607  		goto __5
 47608  	}
 47609  	sqlite3.Xsqlite3_result_int(tls, context, sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 47610  	goto __6
 47611  __5:
 47612  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+3834 /* "int64" */) == 0) {
 47613  		goto __7
 47614  	}
 47615  	sqlite3.Xsqlite3_result_int64(tls, context, sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 47616  	goto __8
 47617  __7:
 47618  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+16374 /* "string" */) == 0) {
 47619  		goto __9
 47620  	}
 47621  	sqlite3.Xsqlite3_result_text(tls, context, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))), -1,
 47622  		libc.UintptrFromInt32(-1))
 47623  	goto __10
 47624  __9:
 47625  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+2423 /* "double" */) == 0) {
 47626  		goto __11
 47627  	}
 47628  	sqlite3.Xsqlite3_result_double(tls, context, sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 47629  	goto __12
 47630  __11:
 47631  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+7385 /* "null" */) == 0) {
 47632  		goto __13
 47633  	}
 47634  	sqlite3.Xsqlite3_result_null(tls, context)
 47635  	goto __14
 47636  __13:
 47637  	if !(sqlite3.Xsqlite3StrICmp(tls, zArg0, ts+16381 /* "value" */) == 0) {
 47638  		goto __15
 47639  	}
 47640  	sqlite3.Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv + uintptr(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))*4)))
 47641  	goto __16
 47642  __15:
 47643  	goto error_out
 47644  __16:
 47645  	;
 47646  __14:
 47647  	;
 47648  __12:
 47649  	;
 47650  __10:
 47651  	;
 47652  __8:
 47653  	;
 47654  __6:
 47655  	;
 47656  	goto __4
 47657  __3:
 47658  	goto error_out
 47659  __4:
 47660  	;
 47661  	argc = argc - (2)
 47662  	argv += 4 * (uintptr(2))
 47663  	goto __1
 47664  __2:
 47665  	;
 47666  	return
 47667  
 47668  error_out:
 47669  	sqlite3.Xsqlite3_result_error(tls, context,
 47670  		ts+16387 /* "first argument s..." */, -1)
 47671  }
 47672  
 47673  // Usage:   sqlite_register_test_function  DB  NAME
 47674  //
 47675  // Register the test SQL function on the database DB under the name NAME.
 47676  func test_register_func(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2083:26: */
 47677  	bp := tls.Alloc(52)
 47678  	defer tls.Free(52)
 47679  
 47680  	// var db uintptr at bp+48, 4
 47681  
 47682  	var rc int32
 47683  	if argc != 3 {
 47684  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 47685  			ts+16455 /* " DB FUNCTION-NAM..." */, 0))
 47686  		return TCL_ERROR
 47687  	}
 47688  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+48 /* &db */) != 0 {
 47689  		return TCL_ERROR
 47690  	}
 47691  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), -1, SQLITE_UTF8, uintptr(0),
 47692  		*(*uintptr)(unsafe.Pointer(&struct {
 47693  			f func(*libc.TLS, uintptr, int32, uintptr)
 47694  		}{testFunc})), uintptr(0), uintptr(0))
 47695  	if rc != 0 {
 47696  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 47697  		return TCL_ERROR
 47698  	}
 47699  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 47700  		return TCL_ERROR
 47701  	}
 47702  	return TCL_OK
 47703  }
 47704  
 47705  // Usage:  sqlite3_finalize  STMT
 47706  //
 47707  // Finalize a statement handle.
 47708  func test_finalize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2112:26: */
 47709  	bp := tls.Alloc(36)
 47710  	defer tls.Free(36)
 47711  
 47712  	// var pStmt uintptr at bp+32, 4
 47713  
 47714  	var rc int32
 47715  	var db uintptr = uintptr(0)
 47716  
 47717  	if objc != 2 {
 47718  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 47719  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 47720  		return TCL_ERROR
 47721  	}
 47722  
 47723  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 47724  		return TCL_ERROR
 47725  	}
 47726  
 47727  	if *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) != 0 {
 47728  		db = sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 47729  	}
 47730  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 47731  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 47732  	if (db != 0) && (sqlite3TestErrCode(tls, interp, db, rc) != 0) {
 47733  		return TCL_ERROR
 47734  	}
 47735  	return TCL_OK
 47736  }
 47737  
 47738  // Usage:  sqlite3_stmt_status  STMT  CODE  RESETFLAG
 47739  //
 47740  // Get the value of a status counter from a statement.
 47741  func test_stmt_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2144:26: */
 47742  	bp := tls.Alloc(12)
 47743  	defer tls.Free(12)
 47744  
 47745  	var iValue int32
 47746  	var i int32
 47747  	*(*int32)(unsafe.Pointer(bp + 4 /* op */)) = 0
 47748  	// var resetFlag int32 at bp+8, 4
 47749  
 47750  	var zOpName uintptr
 47751  	// var pStmt uintptr at bp, 4
 47752  
 47753  	if objc != 4 {
 47754  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16481 /* "STMT PARAMETER R..." */)
 47755  		return TCL_ERROR
 47756  	}
 47757  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 47758  		return TCL_ERROR
 47759  	}
 47760  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47761  	for i = 0; i < (int32(uint32(unsafe.Sizeof(aOp)) / uint32(unsafe.Sizeof(struct {
 47762  		FzName uintptr
 47763  		Fop    int32
 47764  	}{})))); i++ {
 47765  		if libc.Xstrcmp(tls, aOp[i].FzName, zOpName) == 0 {
 47766  			*(*int32)(unsafe.Pointer(bp + 4 /* op */)) = aOp[i].Fop
 47767  			break
 47768  		}
 47769  	}
 47770  	if i >= (int32(uint32(unsafe.Sizeof(aOp)) / uint32(unsafe.Sizeof(struct {
 47771  		FzName uintptr
 47772  		Fop    int32
 47773  	}{})))) {
 47774  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &op */) != 0 {
 47775  			return TCL_ERROR
 47776  		}
 47777  	}
 47778  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+8 /* &resetFlag */) != 0 {
 47779  		return TCL_ERROR
 47780  	}
 47781  	iValue = sqlite3.Xsqlite3_stmt_status(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 4 /* op */)), *(*int32)(unsafe.Pointer(bp + 8 /* resetFlag */)))
 47782  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iValue))
 47783  	return TCL_OK
 47784  }
 47785  
 47786  var aOp = [7]struct {
 47787  	FzName uintptr
 47788  	Fop    int32
 47789  }{
 47790  	{FzName: ts + 16506 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_FULLSCAN_STEP},
 47791  	{FzName: ts + 16538 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_SORT},
 47792  	{FzName: ts + 16561 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_AUTOINDEX},
 47793  	{FzName: ts + 16589 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_VM_STEP},
 47794  	{FzName: ts + 16615 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_REPREPARE},
 47795  	{FzName: ts + 16643 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_RUN},
 47796  	{FzName: ts + 16665 /* "SQLITE_STMTSTATU..." */, Fop: SQLITE_STMTSTATUS_MEMUSED},
 47797  } /* test1.c:2158:5 */
 47798  
 47799  // Usage:  sqlite3_config_sorterref
 47800  //
 47801  // Set the SQLITE_CONFIG_SORTERREF_SIZE configuration option
 47802  func test_config_sorterref(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2285:26: */
 47803  	bp := tls.Alloc(12)
 47804  	defer tls.Free(12)
 47805  
 47806  	// var iVal int32 at bp+8, 4
 47807  
 47808  	if objc != 2 {
 47809  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16691 /* "NBYTE" */)
 47810  		return TCL_ERROR
 47811  	}
 47812  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &iVal */) != 0 {
 47813  		return TCL_ERROR
 47814  	}
 47815  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_SORTERREF_SIZE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* iVal */))))
 47816  	return TCL_OK
 47817  }
 47818  
 47819  // Usage: vfs_current_time_int64
 47820  //
 47821  // Return the value returned by the default VFS's xCurrentTimeInt64 method.
 47822  func vfsCurrentTimeInt64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2306:26: */
 47823  	bp := tls.Alloc(8)
 47824  	defer tls.Free(8)
 47825  
 47826  	// var t i64 at bp, 8
 47827  
 47828  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 47829  	if objc != 1 {
 47830  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 47831  		return TCL_ERROR
 47832  	}
 47833  	(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 72 /* &.xCurrentTimeInt64 */))))(tls, pVfs, bp /* &t */)
 47834  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, *(*i64)(unsafe.Pointer(bp /* t */))))
 47835  	return TCL_OK
 47836  }
 47837  
 47838  // Usage: sqlite3_snapshot_get DB DBNAME
 47839  func test_snapshot_get(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2327:26: */
 47840  	bp := tls.Alloc(108)
 47841  	defer tls.Free(108)
 47842  
 47843  	var rc int32
 47844  	// var db uintptr at bp, 4
 47845  
 47846  	var zName uintptr
 47847  	*(*uintptr)(unsafe.Pointer(bp + 4 /* pSnapshot */)) = uintptr(0)
 47848  
 47849  	if objc != 3 {
 47850  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 47851  		return TCL_ERROR
 47852  	}
 47853  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 47854  		return TCL_ERROR
 47855  	}
 47856  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47857  
 47858  	rc = sqlite3.Xsqlite3_snapshot_get(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, bp+4 /* &pSnapshot */)
 47859  	if rc != SQLITE_OK {
 47860  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 47861  		return TCL_ERROR
 47862  	} else {
 47863  		// var zBuf [100]int8 at bp+8, 100
 47864  
 47865  		if sqlite3TestMakePointerStr(tls, interp, bp+8 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 4 /* pSnapshot */))) != 0 {
 47866  			return TCL_ERROR
 47867  		}
 47868  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+8 /* &zBuf[0] */, -1))
 47869  	}
 47870  	return TCL_OK
 47871  }
 47872  
 47873  // Usage: sqlite3_snapshot_recover DB DBNAME
 47874  func test_snapshot_recover(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2362:26: */
 47875  	bp := tls.Alloc(4)
 47876  	defer tls.Free(4)
 47877  
 47878  	var rc int32
 47879  	// var db uintptr at bp, 4
 47880  
 47881  	var zName uintptr
 47882  
 47883  	if objc != 3 {
 47884  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 47885  		return TCL_ERROR
 47886  	}
 47887  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 47888  		return TCL_ERROR
 47889  	}
 47890  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47891  
 47892  	rc = sqlite3.Xsqlite3_snapshot_recover(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName)
 47893  	if rc != SQLITE_OK {
 47894  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 47895  		return TCL_ERROR
 47896  	} else {
 47897  		tcl.XTcl_ResetResult(tls, interp)
 47898  	}
 47899  	return TCL_OK
 47900  }
 47901  
 47902  // Usage: sqlite3_snapshot_open DB DBNAME SNAPSHOT
 47903  func test_snapshot_open(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2394:26: */
 47904  	bp := tls.Alloc(4)
 47905  	defer tls.Free(4)
 47906  
 47907  	var rc int32
 47908  	// var db uintptr at bp, 4
 47909  
 47910  	var zName uintptr
 47911  	var pSnapshot uintptr
 47912  
 47913  	if objc != 4 {
 47914  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16707 /* "DB DBNAME SNAPSH..." */)
 47915  		return TCL_ERROR
 47916  	}
 47917  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 47918  		return TCL_ERROR
 47919  	}
 47920  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47921  	pSnapshot = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4))))
 47922  
 47923  	rc = sqlite3.Xsqlite3_snapshot_open(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, pSnapshot)
 47924  	if rc != SQLITE_OK {
 47925  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 47926  		return TCL_ERROR
 47927  	} else {
 47928  		tcl.XTcl_ResetResult(tls, interp)
 47929  	}
 47930  	return TCL_OK
 47931  }
 47932  
 47933  // Usage: sqlite3_snapshot_free SNAPSHOT
 47934  func test_snapshot_free(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2428:26: */
 47935  	var pSnapshot uintptr
 47936  	if objc != 2 {
 47937  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16726 /* "SNAPSHOT" */)
 47938  		return TCL_ERROR
 47939  	}
 47940  	pSnapshot = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 47941  	sqlite3.Xsqlite3_snapshot_free(tls, pSnapshot)
 47942  	return TCL_OK
 47943  }
 47944  
 47945  // Usage: sqlite3_snapshot_cmp SNAPSHOT1 SNAPSHOT2
 47946  func test_snapshot_cmp(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2449:26: */
 47947  	var res int32
 47948  	var p1 uintptr
 47949  	var p2 uintptr
 47950  	if objc != 3 {
 47951  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16735 /* "SNAPSHOT1 SNAPSH..." */)
 47952  		return TCL_ERROR
 47953  	}
 47954  	p1 = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 47955  	p2 = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))))
 47956  	res = sqlite3.Xsqlite3_snapshot_cmp(tls, p1, p2)
 47957  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 47958  	return TCL_OK
 47959  }
 47960  
 47961  // Usage: sqlite3_snapshot_get_blob DB DBNAME
 47962  func test_snapshot_get_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2474:26: */
 47963  	bp := tls.Alloc(8)
 47964  	defer tls.Free(8)
 47965  
 47966  	var rc int32
 47967  	// var db uintptr at bp, 4
 47968  
 47969  	var zName uintptr
 47970  	*(*uintptr)(unsafe.Pointer(bp + 4 /* pSnapshot */)) = uintptr(0)
 47971  
 47972  	if objc != 3 {
 47973  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 47974  		return TCL_ERROR
 47975  	}
 47976  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 47977  		return TCL_ERROR
 47978  	}
 47979  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 47980  
 47981  	rc = sqlite3.Xsqlite3_snapshot_get(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, bp+4 /* &pSnapshot */)
 47982  	if rc != SQLITE_OK {
 47983  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 47984  		return TCL_ERROR
 47985  	} else {
 47986  		tcl.XTcl_SetObjResult(tls, interp,
 47987  			tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pSnapshot */)), int32(unsafe.Sizeof(sqlite3_snapshot{}))))
 47988  		sqlite3.Xsqlite3_snapshot_free(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* pSnapshot */)))
 47989  	}
 47990  	return TCL_OK
 47991  }
 47992  
 47993  // Usage: sqlite3_snapshot_open_blob DB DBNAME SNAPSHOT
 47994  func test_snapshot_open_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2510:26: */
 47995  	bp := tls.Alloc(24)
 47996  	defer tls.Free(24)
 47997  
 47998  	var rc int32
 47999  	// var db uintptr at bp+16, 4
 48000  
 48001  	var zName uintptr
 48002  	var pBlob uintptr
 48003  	// var nBlob int32 at bp+20, 4
 48004  
 48005  	if objc != 4 {
 48006  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16707 /* "DB DBNAME SNAPSH..." */)
 48007  		return TCL_ERROR
 48008  	}
 48009  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 48010  		return TCL_ERROR
 48011  	}
 48012  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 48013  	pBlob = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+20 /* &nBlob */)
 48014  	if (uint32(*(*int32)(unsafe.Pointer(bp + 20 /* nBlob */))) != uint32(unsafe.Sizeof(sqlite3_snapshot{}))) {
 48015  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+16755 /* "bad SNAPSHOT" */, 0))
 48016  		return TCL_ERROR
 48017  	}
 48018  	rc = sqlite3.Xsqlite3_snapshot_open(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zName, pBlob)
 48019  	if rc != SQLITE_OK {
 48020  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 48021  		return TCL_ERROR
 48022  	}
 48023  	return TCL_OK
 48024  }
 48025  
 48026  // Usage: sqlite3_snapshot_cmp_blob SNAPSHOT1 SNAPSHOT2
 48027  func test_snapshot_cmp_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2546:26: */
 48028  	bp := tls.Alloc(24)
 48029  	defer tls.Free(24)
 48030  
 48031  	var res int32
 48032  	var p1 uintptr
 48033  	var p2 uintptr
 48034  	// var n1 int32 at bp+16, 4
 48035  
 48036  	// var n2 int32 at bp+20, 4
 48037  
 48038  	if objc != 3 {
 48039  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16735 /* "SNAPSHOT1 SNAPSH..." */)
 48040  		return TCL_ERROR
 48041  	}
 48042  
 48043  	p1 = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &n1 */)
 48044  	p2 = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+20 /* &n2 */)
 48045  
 48046  	if (uint32(*(*int32)(unsafe.Pointer(bp + 16 /* n1 */))) != uint32(unsafe.Sizeof(sqlite3_snapshot{}))) || (*(*int32)(unsafe.Pointer(bp + 16 /* n1 */)) != *(*int32)(unsafe.Pointer(bp + 20 /* n2 */))) {
 48047  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+16755 /* "bad SNAPSHOT" */, 0))
 48048  		return TCL_ERROR
 48049  	}
 48050  
 48051  	res = sqlite3.Xsqlite3_snapshot_cmp(tls, p1, p2)
 48052  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, res))
 48053  	return TCL_OK
 48054  }
 48055  
 48056  // in test_delete.c
 48057  func test_delete_database(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2581:26: */
 48058  	var rc int32
 48059  	var zFile uintptr
 48060  	if objc != 2 {
 48061  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16768 /* "FILE" */)
 48062  		return TCL_ERROR
 48063  	}
 48064  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 48065  	rc = sqlite3_delete_database(tls, zFile)
 48066  
 48067  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 48068  	return TCL_OK
 48069  }
 48070  
 48071  // Usage: atomic_batch_write PATH
 48072  func test_atomic_batch_write(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2603:26: */
 48073  	bp := tls.Alloc(24)
 48074  	defer tls.Free(24)
 48075  
 48076  	var zFile uintptr = uintptr(0)                              // Path to file to test
 48077  	*(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0)  // Database handle
 48078  	*(*uintptr)(unsafe.Pointer(bp + 20 /* pFd */)) = uintptr(0) // SQLite fd open on zFile
 48079  	var bRes int32 = 0                                          // Integer result of this command
 48080  	var dc int32 = 0                                            // Device-characteristics mask
 48081  	var rc int32                                                // sqlite3_open() return code
 48082  
 48083  	if objc != 2 {
 48084  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16773 /* "PATH" */)
 48085  		return TCL_ERROR
 48086  	}
 48087  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 48088  
 48089  	rc = sqlite3.Xsqlite3_open(tls, zFile, bp+16 /* &db */)
 48090  	if rc != SQLITE_OK {
 48091  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))), 0))
 48092  		sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)))
 48093  		return TCL_ERROR
 48094  	}
 48095  
 48096  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp+20 /* &pFd */)
 48097  	dc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* pFd */)))).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pFd */)))
 48098  	if (dc & SQLITE_IOCAP_BATCH_ATOMIC) != 0 {
 48099  		bRes = 1
 48100  	}
 48101  
 48102  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, bRes))
 48103  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)))
 48104  	return TCL_OK
 48105  }
 48106  
 48107  // Usage:  sqlite3_next_stmt  DB  STMT
 48108  //
 48109  // Return the next statment in sequence after STMT.
 48110  func test_next_stmt(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2645:26: */
 48111  	bp := tls.Alloc(106)
 48112  	defer tls.Free(106)
 48113  
 48114  	// var pStmt uintptr at bp+52, 4
 48115  
 48116  	*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)) = uintptr(0)
 48117  	// var zBuf [50]int8 at bp+56, 50
 48118  
 48119  	if objc != 3 {
 48120  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48121  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16778 /* " DB STMT" */, 0))
 48122  		return TCL_ERROR
 48123  	}
 48124  
 48125  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 48126  		return TCL_ERROR
 48127  	}
 48128  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+52 /* &pStmt */) != 0 {
 48129  		return TCL_ERROR
 48130  	}
 48131  	*(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)) = sqlite3.Xsqlite3_next_stmt(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)))
 48132  	if *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */)) != 0 {
 48133  		if sqlite3TestMakePointerStr(tls, interp, bp+56 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 52 /* pStmt */))) != 0 {
 48134  			return TCL_ERROR
 48135  		}
 48136  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+56 /* &zBuf[0] */, 0))
 48137  	}
 48138  	return TCL_OK
 48139  }
 48140  
 48141  // Usage:  sqlite3_stmt_readonly  STMT
 48142  //
 48143  // Return true if STMT is a NULL pointer or a pointer to a statement
 48144  // that is guaranteed to leave the database unmodified.
 48145  func test_stmt_readonly(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2677:26: */
 48146  	bp := tls.Alloc(36)
 48147  	defer tls.Free(36)
 48148  
 48149  	// var pStmt uintptr at bp+32, 4
 48150  
 48151  	var rc int32
 48152  
 48153  	if objc != 2 {
 48154  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48155  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 48156  		return TCL_ERROR
 48157  	}
 48158  
 48159  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48160  		return TCL_ERROR
 48161  	}
 48162  	rc = sqlite3.Xsqlite3_stmt_readonly(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 48163  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((rc) != 0))))
 48164  	return TCL_OK
 48165  }
 48166  
 48167  // Usage:  sqlite3_stmt_isexplain  STMT
 48168  //
 48169  // Return 1, 2, or 0 respectively if STMT is an EXPLAIN statement, an
 48170  // EXPLAIN QUERY PLAN statement or an ordinary statement or NULL pointer.
 48171  func test_stmt_isexplain(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2704:26: */
 48172  	bp := tls.Alloc(36)
 48173  	defer tls.Free(36)
 48174  
 48175  	// var pStmt uintptr at bp+32, 4
 48176  
 48177  	var rc int32
 48178  
 48179  	if objc != 2 {
 48180  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48181  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 48182  		return TCL_ERROR
 48183  	}
 48184  
 48185  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48186  		return TCL_ERROR
 48187  	}
 48188  	rc = sqlite3.Xsqlite3_stmt_isexplain(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 48189  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 48190  	return TCL_OK
 48191  }
 48192  
 48193  // Usage:  sqlite3_stmt_busy  STMT
 48194  //
 48195  // Return true if STMT is a non-NULL pointer to a statement
 48196  // that has been stepped but not to completion.
 48197  func test_stmt_busy(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2731:26: */
 48198  	bp := tls.Alloc(36)
 48199  	defer tls.Free(36)
 48200  
 48201  	// var pStmt uintptr at bp+32, 4
 48202  
 48203  	var rc int32
 48204  
 48205  	if objc != 2 {
 48206  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48207  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 48208  		return TCL_ERROR
 48209  	}
 48210  
 48211  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48212  		return TCL_ERROR
 48213  	}
 48214  	rc = sqlite3.Xsqlite3_stmt_busy(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 48215  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((rc) != 0))))
 48216  	return TCL_OK
 48217  }
 48218  
 48219  // Usage:  uses_stmt_journal  STMT
 48220  //
 48221  // Return true if STMT uses a statement journal.
 48222  func uses_stmt_journal(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2757:26: */
 48223  	bp := tls.Alloc(36)
 48224  	defer tls.Free(36)
 48225  
 48226  	// var pStmt uintptr at bp+32, 4
 48227  
 48228  	if objc != 2 {
 48229  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48230  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16787 /* " STMT" */, 0))
 48231  		return TCL_ERROR
 48232  	}
 48233  
 48234  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48235  		return TCL_ERROR
 48236  	}
 48237  	sqlite3.Xsqlite3_stmt_readonly(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 48238  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((int32(*(*uint16)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) + 152 /* &.usesStmtJournal */))&0x40>>6)) != 0))))
 48239  	return TCL_OK
 48240  }
 48241  
 48242  // Usage:  sqlite3_reset  STMT
 48243  //
 48244  // Reset a statement handle.
 48245  func test_reset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2783:26: */
 48246  	bp := tls.Alloc(36)
 48247  	defer tls.Free(36)
 48248  
 48249  	// var pStmt uintptr at bp+32, 4
 48250  
 48251  	var rc int32
 48252  
 48253  	if objc != 2 {
 48254  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48255  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 48256  		return TCL_ERROR
 48257  	}
 48258  
 48259  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48260  		return TCL_ERROR
 48261  	}
 48262  
 48263  	rc = sqlite3.Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 48264  	if (*(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)) != 0) && (sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0) {
 48265  		return TCL_ERROR
 48266  	}
 48267  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 48268  	//
 48269  	//   if( rc ){
 48270  	//     return TCL_ERROR;
 48271  	//   }
 48272  	return TCL_OK
 48273  }
 48274  
 48275  // Usage:  sqlite3_expired STMT
 48276  //
 48277  // Return TRUE if a recompilation of the statement is recommended.
 48278  func test_expired(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2818:26: */
 48279  	bp := tls.Alloc(36)
 48280  	defer tls.Free(36)
 48281  
 48282  	// var pStmt uintptr at bp+32, 4
 48283  
 48284  	if objc != 2 {
 48285  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48286  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16473 /* " <STMT>" */, 0))
 48287  		return TCL_ERROR
 48288  	}
 48289  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 48290  		return TCL_ERROR
 48291  	}
 48292  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((sqlite3.Xsqlite3_expired(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))) != 0))))
 48293  	return TCL_OK
 48294  }
 48295  
 48296  // Usage:  sqlite3_transfer_bindings FROMSTMT TOSTMT
 48297  //
 48298  // Transfer all bindings from FROMSTMT over to TOSTMT
 48299  func test_transfer_bind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2842:26: */
 48300  	bp := tls.Alloc(40)
 48301  	defer tls.Free(40)
 48302  
 48303  	// var pStmt1 uintptr at bp+32, 4
 48304  
 48305  	// var pStmt2 uintptr at bp+36, 4
 48306  
 48307  	if objc != 3 {
 48308  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48309  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16793 /* " FROM-STMT TO-ST..." */, 0))
 48310  		return TCL_ERROR
 48311  	}
 48312  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt1 */) != 0 {
 48313  		return TCL_ERROR
 48314  	}
 48315  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+36 /* &pStmt2 */) != 0 {
 48316  		return TCL_ERROR
 48317  	}
 48318  	tcl.XTcl_SetObjResult(tls, interp,
 48319  		tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_transfer_bindings(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt1 */)), *(*uintptr)(unsafe.Pointer(bp + 36 /* pStmt2 */)))))
 48320  	return TCL_OK
 48321  }
 48322  
 48323  // Usage:  sqlite3_changes DB
 48324  //
 48325  // Return the number of changes made to the database by the last SQL
 48326  // execution.
 48327  func test_changes(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:2869:26: */
 48328  	bp := tls.Alloc(36)
 48329  	defer tls.Free(36)
 48330  
 48331  	// var db uintptr at bp+32, 4
 48332  
 48333  	if objc != 2 {
 48334  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48335  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 48336  		return TCL_ERROR
 48337  	}
 48338  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 48339  		return TCL_ERROR
 48340  	}
 48341  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_changes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))))
 48342  	return TCL_OK
 48343  }
 48344  
 48345  // This is the "static_bind_value" that variables are bound to when
 48346  // the FLAG option of sqlite3_bind is "static"
 48347  var sqlite_static_bind_value uintptr = uintptr(0) /* test1.c:2890:13 */
 48348  var sqlite_static_bind_nbyte int32 = 0            /* test1.c:2891:12 */
 48349  
 48350  // Usage:  sqlite3_bind  VM  IDX  VALUE  FLAGS
 48351  //
 48352  // Sets the value of the IDX-th occurrence of "?" in the original SQL
 48353  // string.  VALUE is the new value.  If FLAGS=="null" then VALUE is
 48354  // ignored and the value is set to NULL.  If FLAGS=="static" then
 48355  // the value is set to the value of a static variable named
 48356  // "sqlite_static_bind_value".  If FLAGS=="normal" then a copy
 48357  // of the VALUE is made.  If FLAGS=="blob10" then a VALUE is ignored
 48358  // an a 10-byte blob "abc\000xyz\000pq" is inserted.
 48359  func test_bind(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:2904:26: */
 48360  	bp := tls.Alloc(138)
 48361  	defer tls.Free(138)
 48362  
 48363  	// var pStmt uintptr at bp+80, 4
 48364  
 48365  	var rc int32
 48366  	// var idx int32 at bp+84, 4
 48367  
 48368  	if argc != 5 {
 48369  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 48370  			ts+16812 /* " VM IDX VALUE (n..." */, 0))
 48371  		return TCL_ERROR
 48372  	}
 48373  	if getStmtPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+80 /* &pStmt */) != 0 {
 48374  		return TCL_ERROR
 48375  	}
 48376  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+84 /* &idx */) != 0 {
 48377  		return TCL_ERROR
 48378  	}
 48379  	if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)), ts+7385 /* "null" */) == 0 {
 48380  		rc = sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)))
 48381  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)), ts+16848 /* "static" */) == 0 {
 48382  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)), sqlite_static_bind_value, -1, uintptr(0))
 48383  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)), ts+16855 /* "static-nbytes" */) == 0 {
 48384  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)), sqlite_static_bind_value,
 48385  			sqlite_static_bind_nbyte, uintptr(0))
 48386  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)), ts+16869 /* "normal" */) == 0 {
 48387  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)), *(*uintptr)(unsafe.Pointer(argv + 3*4)), -1, libc.UintptrFromInt32(-1))
 48388  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)), ts+16876 /* "blob10" */) == 0 {
 48389  		rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)), ts+16883 /* "abc\x00xyz\x00pq" */, 10, uintptr(0))
 48390  	} else {
 48391  		tcl.XTcl_AppendResult(tls, interp,
 48392  			libc.VaList(bp+32, ts+16894 /* "4th argument sho..." */, 0))
 48393  		return TCL_ERROR
 48394  	}
 48395  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */))), rc) != 0 {
 48396  		return TCL_ERROR
 48397  	}
 48398  	if rc != 0 {
 48399  		// var zBuf [50]int8 at bp+88, 50
 48400  
 48401  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+88 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+48, rc))
 48402  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+88 /* &zBuf[0] */, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 48403  		return TCL_ERROR
 48404  	}
 48405  	return TCL_OK
 48406  }
 48407  
 48408  // Usage: add_test_collate <db ptr> <utf8> <utf16le> <utf16be>
 48409  //
 48410  // This function is used to test that SQLite selects the correct collation
 48411  // sequence callback when multiple versions (for different text encodings)
 48412  // are available.
 48413  //
 48414  // Calling this routine registers the collation sequence "test_collate"
 48415  // with database handle <db>. The second argument must be a list of three
 48416  // boolean values. If the first is true, then a version of test_collate is
 48417  // registered for UTF-8, if the second is true, a version is registered for
 48418  // UTF-16le, if the third is true, a UTF-16be version is available.
 48419  // Previous versions of test_collate are deleted.
 48420  //
 48421  // The collation sequence test_collate is implemented by calling the
 48422  // following TCL script:
 48423  //
 48424  //   "test_collate <enc> <lhs> <rhs>"
 48425  //
 48426  // The <lhs> and <rhs> are the two values being compared, encoded in UTF-8.
 48427  // The <enc> parameter is the encoding of the collation function that
 48428  // SQLite selected to call. The TCL test script implements the
 48429  // "test_collate" proc.
 48430  //
 48431  // Note that this will only work with one interpreter at a time, as the
 48432  // interp pointer to use when evaluating the TCL script is stored in
 48433  // pTestCollateInterp.
 48434  var pTestCollateInterp uintptr /* test1.c:2975:18: */
 48435  
 48436  func test_collate_func(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* test1.c:2976:12: */
 48437  	bp := tls.Alloc(4)
 48438  	defer tls.Free(4)
 48439  
 48440  	var i uintptr = pTestCollateInterp
 48441  	var encin int32 = int32(pCtx)
 48442  	// var res int32 at bp, 4
 48443  
 48444  	var n int32
 48445  	var pVal uintptr
 48446  	var pX uintptr
 48447  
 48448  	pX = tcl.XTcl_NewStringObj(tls, ts+16954 /* "test_collate" */, -1)
 48449  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 48450  
 48451  	switch encin {
 48452  	case SQLITE_UTF8:
 48453  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16967 /* "UTF-8" */, -1))
 48454  		break
 48455  	case SQLITE_UTF16LE:
 48456  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16973 /* "UTF-16LE" */, -1))
 48457  		break
 48458  	case SQLITE_UTF16BE:
 48459  		tcl.XTcl_ListObjAppendElement(tls, i, pX, tcl.XTcl_NewStringObj(tls, ts+16982 /* "UTF-16BE" */, -1))
 48460  		break
 48461  	default:
 48462  
 48463  	}
 48464  
 48465  	sqlite3.Xsqlite3BeginBenignMalloc(tls)
 48466  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 48467  	if pVal != 0 {
 48468  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, nA, zA, uint8(encin), uintptr(0))
 48469  		n = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 48470  		tcl.XTcl_ListObjAppendElement(tls, i, pX,
 48471  			tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pVal), n))
 48472  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, nB, zB, uint8(encin), uintptr(0))
 48473  		n = sqlite3.Xsqlite3_value_bytes(tls, pVal)
 48474  		tcl.XTcl_ListObjAppendElement(tls, i, pX,
 48475  			tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, pVal), n))
 48476  		sqlite3.Xsqlite3ValueFree(tls, pVal)
 48477  	}
 48478  	sqlite3.Xsqlite3EndBenignMalloc(tls)
 48479  
 48480  	tcl.XTcl_EvalObjEx(tls, i, pX, 0)
 48481  	for ok := true; ok; ok = 0 != 0 {
 48482  		var _objPtr uintptr = pX
 48483  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48484  			tcl.XTclFreeObj(tls, _objPtr)
 48485  		}
 48486  	}
 48487  	tcl.XTcl_GetIntFromObj(tls, i, tcl.XTcl_GetObjResult(tls, i), bp /* &res */)
 48488  	return *(*int32)(unsafe.Pointer(bp /* res */))
 48489  }
 48490  
 48491  func test_collate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3026:26: */
 48492  	bp := tls.Alloc(56)
 48493  	defer tls.Free(56)
 48494  
 48495  	// var db uintptr at bp+48, 4
 48496  
 48497  	// var val int32 at bp+52, 4
 48498  
 48499  	var pVal uintptr
 48500  	var rc int32
 48501  	var zUtf16 uintptr
 48502  
 48503  	if !(objc != 5) {
 48504  		goto __1
 48505  	}
 48506  	goto bad_args
 48507  __1:
 48508  	;
 48509  	pTestCollateInterp = interp
 48510  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0) {
 48511  		goto __2
 48512  	}
 48513  	return TCL_ERROR
 48514  __2:
 48515  	;
 48516  
 48517  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+52 /* &val */)) {
 48518  		goto __3
 48519  	}
 48520  	return TCL_ERROR
 48521  __3:
 48522  	;
 48523  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+16954 /* "test_collate" */, SQLITE_UTF8,
 48524  		uintptr(SQLITE_UTF8), func() uintptr {
 48525  			if *(*int32)(unsafe.Pointer(bp + 52 /* val */)) != 0 {
 48526  				return *(*uintptr)(unsafe.Pointer(&struct {
 48527  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48528  				}{test_collate_func}))
 48529  			}
 48530  			return uintptr(0)
 48531  		}())
 48532  	if !(rc == SQLITE_OK) {
 48533  		goto __4
 48534  	}
 48535  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+52 /* &val */)) {
 48536  		goto __5
 48537  	}
 48538  	return TCL_ERROR
 48539  __5:
 48540  	;
 48541  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), ts+16954 /* "test_collate" */, SQLITE_UTF16LE,
 48542  		uintptr(SQLITE_UTF16LE), func() uintptr {
 48543  			if *(*int32)(unsafe.Pointer(bp + 52 /* val */)) != 0 {
 48544  				return *(*uintptr)(unsafe.Pointer(&struct {
 48545  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48546  				}{test_collate_func}))
 48547  			}
 48548  			return uintptr(0)
 48549  		}())
 48550  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+52 /* &val */)) {
 48551  		goto __6
 48552  	}
 48553  	return TCL_ERROR
 48554  __6:
 48555  	;
 48556  
 48557  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).Fmutex)
 48558  	pVal = sqlite3.Xsqlite3ValueNew(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 48559  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, ts+16954 /* "test_collate" */, uint8(SQLITE_UTF8), uintptr(0))
 48560  	zUtf16 = sqlite3.Xsqlite3ValueText(tls, pVal, uint8(SQLITE_UTF16LE))
 48561  	if !((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).FmallocFailed != 0) {
 48562  		goto __7
 48563  	}
 48564  	rc = SQLITE_NOMEM
 48565  	goto __8
 48566  __7:
 48567  	rc = sqlite3.Xsqlite3_create_collation16(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zUtf16, SQLITE_UTF16BE,
 48568  		uintptr(SQLITE_UTF16BE), func() uintptr {
 48569  			if *(*int32)(unsafe.Pointer(bp + 52 /* val */)) != 0 {
 48570  				return *(*uintptr)(unsafe.Pointer(&struct {
 48571  					f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48572  				}{test_collate_func}))
 48573  			}
 48574  			return uintptr(0)
 48575  		}())
 48576  __8:
 48577  	;
 48578  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 48579  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))).Fmutex)
 48580  __4:
 48581  	;
 48582  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0) {
 48583  		goto __9
 48584  	}
 48585  	return TCL_ERROR
 48586  __9:
 48587  	;
 48588  
 48589  	if !(rc != SQLITE_OK) {
 48590  		goto __10
 48591  	}
 48592  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 48593  	return TCL_ERROR
 48594  __10:
 48595  	;
 48596  	return TCL_OK
 48597  
 48598  bad_args:
 48599  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+15410, /* "wrong # args: sh..." */
 48600  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16991 /* " <DB> <utf8> <ut..." */, 0))
 48601  	return TCL_ERROR
 48602  }
 48603  
 48604  // Usage: add_test_utf16bin_collate <db ptr>
 48605  //
 48606  // Add a utf-16 collation sequence named "utf16bin" to the database
 48607  // handle. This collation sequence compares arguments in the same way as the
 48608  // built-in collation "binary".
 48609  func test_utf16bin_collate_func(tls *libc.TLS, pCtx uintptr, nA int32, zA uintptr, nB int32, zB uintptr) int32 { /* test1.c:3090:12: */
 48610  	var nCmp int32 = func() int32 {
 48611  		if nA > nB {
 48612  			return nB
 48613  		}
 48614  		return nA
 48615  	}()
 48616  	var res int32 = libc.Xmemcmp(tls, zA, zB, uint32(nCmp))
 48617  	if res == 0 {
 48618  		res = (nA - nB)
 48619  	}
 48620  	return res
 48621  }
 48622  
 48623  func test_utf16bin_collate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3100:26: */
 48624  	bp := tls.Alloc(4)
 48625  	defer tls.Free(4)
 48626  
 48627  	// var db uintptr at bp, 4
 48628  
 48629  	var rc int32
 48630  
 48631  	if !(objc != 2) {
 48632  		goto __1
 48633  	}
 48634  	goto bad_args
 48635  __1:
 48636  	;
 48637  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) {
 48638  		goto __2
 48639  	}
 48640  	return TCL_ERROR
 48641  __2:
 48642  	;
 48643  
 48644  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17024 /* "utf16bin" */, SQLITE_UTF16, uintptr(0),
 48645  		*(*uintptr)(unsafe.Pointer(&struct {
 48646  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48647  		}{test_utf16bin_collate_func})))
 48648  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp /* db */)), rc) != 0) {
 48649  		goto __3
 48650  	}
 48651  	return TCL_ERROR
 48652  __3:
 48653  	;
 48654  	return TCL_OK
 48655  
 48656  bad_args:
 48657  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 48658  	return TCL_ERROR
 48659  }
 48660  
 48661  // When the collation needed callback is invoked, record the name of
 48662  // the requested collating function here.  The recorded name is linked
 48663  // to a TCL variable and used to make sure that the requested collation
 48664  // name is correct.
 48665  var zNeededCollation [200]int8    /* test1.c:3129:13: */
 48666  var pzNeededCollation uintptr = 0 /* test1.c:3130:13 */
 48667  
 48668  // Called when a collating sequence is needed.  Registered using
 48669  // sqlite3_collation_needed16().
 48670  func test_collate_needed_cb(tls *libc.TLS, pCtx uintptr, db uintptr, eTextRep int32, pName uintptr) { /* test1.c:3137:13: */
 48671  	var enc int32 = int32((*sqlite31)(unsafe.Pointer(db)).Fenc)
 48672  	var i int32
 48673  	var z uintptr
 48674  	z = pName
 48675  	i = 0
 48676  	for ; (*(*int8)(unsafe.Pointer(z)) != 0) || (*(*int8)(unsafe.Pointer(z + 1)) != 0); z++ {
 48677  		if *(*int8)(unsafe.Pointer(z)) != 0 {
 48678  			zNeededCollation[libc.PostIncInt32(&i, 1)] = *(*int8)(unsafe.Pointer(z))
 48679  		}
 48680  	}
 48681  	zNeededCollation[i] = int8(0)
 48682  	sqlite3.Xsqlite3_create_collation(tls,
 48683  		db, ts+16954 /* "test_collate" */, int32((*sqlite31)(unsafe.Pointer(db)).Fenc), uintptr(enc), *(*uintptr)(unsafe.Pointer(&struct {
 48684  			f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48685  		}{test_collate_func})))
 48686  }
 48687  
 48688  // Usage: add_test_collate_needed DB
 48689  func test_collate_needed(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3157:26: */
 48690  	bp := tls.Alloc(4)
 48691  	defer tls.Free(4)
 48692  
 48693  	// var db uintptr at bp, 4
 48694  
 48695  	var rc int32
 48696  
 48697  	if !(objc != 2) {
 48698  		goto __1
 48699  	}
 48700  	goto bad_args
 48701  __1:
 48702  	;
 48703  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) {
 48704  		goto __2
 48705  	}
 48706  	return TCL_ERROR
 48707  __2:
 48708  	;
 48709  	rc = sqlite3.Xsqlite3_collation_needed16(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 48710  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr)
 48711  	}{test_collate_needed_cb})))
 48712  	zNeededCollation[0] = int8(0)
 48713  	if !(sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp /* db */)), rc) != 0) {
 48714  		goto __3
 48715  	}
 48716  	return TCL_ERROR
 48717  __3:
 48718  	;
 48719  	return TCL_OK
 48720  
 48721  bad_args:
 48722  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 48723  	return TCL_ERROR
 48724  }
 48725  
 48726  // tclcmd:   add_alignment_test_collations  DB
 48727  //
 48728  // Add two new collating sequences to the database DB
 48729  //
 48730  //     utf16_aligned
 48731  //     utf16_unaligned
 48732  //
 48733  // Both collating sequences use the same sort order as BINARY.
 48734  // The only difference is that the utf16_aligned collating
 48735  // sequence is declared with the SQLITE_UTF16_ALIGNED flag.
 48736  // Both collating functions increment the unaligned utf16 counter
 48737  // whenever they see a string that begins on an odd byte boundary.
 48738  var unaligned_string_counter int32 = 0 /* test1.c:3192:12 */
 48739  
 48740  func alignmentCollFunc(tls *libc.TLS, NotUsed uintptr, nKey1 int32, pKey1 uintptr, nKey2 int32, pKey2 uintptr) int32 { /* test1.c:3193:12: */
 48741  	var rc int32
 48742  	var n int32
 48743  	if nKey1 < nKey2 {
 48744  		n = nKey1
 48745  	} else {
 48746  		n = nKey2
 48747  	}
 48748  	if (nKey1 > 0) && (1 == (1 & (int32(pKey1)))) {
 48749  		unaligned_string_counter++
 48750  	}
 48751  	if (nKey2 > 0) && (1 == (1 & (int32(pKey2)))) {
 48752  		unaligned_string_counter++
 48753  	}
 48754  	rc = libc.Xmemcmp(tls, pKey1, pKey2, uint32(n))
 48755  	if rc == 0 {
 48756  		rc = (nKey1 - nKey2)
 48757  	}
 48758  	return rc
 48759  }
 48760  
 48761  func add_alignment_test_collations(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3208:26: */
 48762  	bp := tls.Alloc(4)
 48763  	defer tls.Free(4)
 48764  
 48765  	// var db uintptr at bp, 4
 48766  
 48767  	if objc >= 2 {
 48768  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 48769  			return TCL_ERROR
 48770  		}
 48771  		sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17033 /* "utf16_unaligned" */, SQLITE_UTF16,
 48772  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 48773  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48774  			}{alignmentCollFunc})))
 48775  		sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+17049 /* "utf16_aligned" */, SQLITE_UTF16_ALIGNED,
 48776  			uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 48777  				f func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32
 48778  			}{alignmentCollFunc})))
 48779  	}
 48780  	return SQLITE_OK
 48781  }
 48782  
 48783  // Usage: add_test_function <db ptr> <utf8> <utf16le> <utf16be>
 48784  //
 48785  // This function is used to test that SQLite selects the correct user
 48786  // function callback when multiple versions (for different text encodings)
 48787  // are available.
 48788  //
 48789  // Calling this routine registers up to three versions of the user function
 48790  // "test_function" with database handle <db>.  If the second argument is
 48791  // true, then a version of test_function is registered for UTF-8, if the
 48792  // third is true, a version is registered for UTF-16le, if the fourth is
 48793  // true, a UTF-16be version is available.  Previous versions of
 48794  // test_function are deleted.
 48795  //
 48796  // The user function is implemented by calling the following TCL script:
 48797  //
 48798  //   "test_function <enc> <arg>"
 48799  //
 48800  // Where <enc> is one of UTF-8, UTF-16LE or UTF16BE, and <arg> is the
 48801  // single argument passed to the SQL function. The value returned by
 48802  // the TCL script is used as the return value of the SQL function. It
 48803  // is passed to SQLite using UTF-16BE for a UTF-8 test_function(), UTF-8
 48804  // for a UTF-16LE test_function(), and UTF-16LE for an implementation that
 48805  // prefers UTF-16BE.
 48806  func test_function_utf8(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3252:13: */
 48807  	var interp uintptr
 48808  	var pX uintptr
 48809  	var pVal uintptr
 48810  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 48811  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 48812  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 48813  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16967 /* "UTF-8" */, -1))
 48814  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 48815  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 48816  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 48817  	for ok := true; ok; ok = 0 != 0 {
 48818  		var _objPtr uintptr = pX
 48819  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48820  			tcl.XTclFreeObj(tls, _objPtr)
 48821  		}
 48822  	}
 48823  	sqlite3.Xsqlite3_result_text(tls, pCtx, tcl.XTcl_GetStringResult(tls, interp), -1, libc.UintptrFromInt32(-1))
 48824  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 48825  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 48826  		uint8(SQLITE_UTF8), uintptr(0))
 48827  	sqlite3.Xsqlite3_result_text16be(tls, pCtx, sqlite3.Xsqlite3_value_text16be(tls, pVal),
 48828  		-1, libc.UintptrFromInt32(-1))
 48829  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 48830  }
 48831  
 48832  func test_function_utf16le(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3276:13: */
 48833  	var interp uintptr
 48834  	var pX uintptr
 48835  	var pVal uintptr
 48836  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 48837  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 48838  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 48839  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16973 /* "UTF-16LE" */, -1))
 48840  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 48841  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 48842  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 48843  	for ok := true; ok; ok = 0 != 0 {
 48844  		var _objPtr uintptr = pX
 48845  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48846  			tcl.XTclFreeObj(tls, _objPtr)
 48847  		}
 48848  	}
 48849  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 48850  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 48851  		uint8(SQLITE_UTF8), uintptr(0))
 48852  	sqlite3.Xsqlite3_result_text(tls, pCtx, sqlite3.Xsqlite3_value_text(tls, pVal), -1, libc.UintptrFromInt32(-1))
 48853  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 48854  }
 48855  
 48856  func test_function_utf16be(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test1.c:3298:13: */
 48857  	var interp uintptr
 48858  	var pX uintptr
 48859  	var pVal uintptr
 48860  	interp = sqlite3.Xsqlite3_user_data(tls, pCtx)
 48861  	pX = tcl.XTcl_NewStringObj(tls, ts+17063 /* "test_function" */, -1)
 48862  	(*Tcl_Obj)(unsafe.Pointer(pX)).FrefCount++
 48863  	tcl.XTcl_ListObjAppendElement(tls, interp, pX, tcl.XTcl_NewStringObj(tls, ts+16982 /* "UTF-16BE" */, -1))
 48864  	tcl.XTcl_ListObjAppendElement(tls, interp, pX,
 48865  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1))
 48866  	tcl.XTcl_EvalObjEx(tls, interp, pX, 0)
 48867  	for ok := true; ok; ok = 0 != 0 {
 48868  		var _objPtr uintptr = pX
 48869  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 48870  			tcl.XTclFreeObj(tls, _objPtr)
 48871  		}
 48872  	}
 48873  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 48874  	sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, tcl.XTcl_GetStringResult(tls, interp),
 48875  		uint8(SQLITE_UTF8), uintptr(0))
 48876  	sqlite3.Xsqlite3_result_text16(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 48877  		-1, libc.UintptrFromInt32(-1))
 48878  	sqlite3.Xsqlite3_result_text16be(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 48879  		-1, libc.UintptrFromInt32(-1))
 48880  	sqlite3.Xsqlite3_result_text16le(tls, pCtx, sqlite3.Xsqlite3_value_text16le(tls, pVal),
 48881  		-1, libc.UintptrFromInt32(-1))
 48882  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 48883  }
 48884  
 48885  func test_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3326:26: */
 48886  	bp := tls.Alloc(40)
 48887  	defer tls.Free(40)
 48888  
 48889  	// var db uintptr at bp+32, 4
 48890  
 48891  	// var val int32 at bp+36, 4
 48892  
 48893  	if !(objc != 5) {
 48894  		goto __1
 48895  	}
 48896  	goto bad_args
 48897  __1:
 48898  	;
 48899  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0) {
 48900  		goto __2
 48901  	}
 48902  	return TCL_ERROR
 48903  __2:
 48904  	;
 48905  
 48906  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &val */)) {
 48907  		goto __3
 48908  	}
 48909  	return TCL_ERROR
 48910  __3:
 48911  	;
 48912  	if !(*(*int32)(unsafe.Pointer(bp + 36 /* val */)) != 0) {
 48913  		goto __4
 48914  	}
 48915  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF8,
 48916  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 48917  			f func(*libc.TLS, uintptr, int32, uintptr)
 48918  		}{test_function_utf8})), uintptr(0), uintptr(0))
 48919  __4:
 48920  	;
 48921  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+36 /* &val */)) {
 48922  		goto __5
 48923  	}
 48924  	return TCL_ERROR
 48925  __5:
 48926  	;
 48927  	if !(*(*int32)(unsafe.Pointer(bp + 36 /* val */)) != 0) {
 48928  		goto __6
 48929  	}
 48930  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF16LE,
 48931  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 48932  			f func(*libc.TLS, uintptr, int32, uintptr)
 48933  		}{test_function_utf16le})), uintptr(0), uintptr(0))
 48934  __6:
 48935  	;
 48936  	if !(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+36 /* &val */)) {
 48937  		goto __7
 48938  	}
 48939  	return TCL_ERROR
 48940  __7:
 48941  	;
 48942  	if !(*(*int32)(unsafe.Pointer(bp + 36 /* val */)) != 0) {
 48943  		goto __8
 48944  	}
 48945  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+17063 /* "test_function" */, 1, SQLITE_UTF16BE,
 48946  		interp, *(*uintptr)(unsafe.Pointer(&struct {
 48947  			f func(*libc.TLS, uintptr, int32, uintptr)
 48948  		}{test_function_utf16be})), uintptr(0), uintptr(0))
 48949  __8:
 48950  	;
 48951  
 48952  	return TCL_OK
 48953  bad_args:
 48954  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 48955  		tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+16991 /* " <DB> <utf8> <ut..." */, 0))
 48956  	return TCL_ERROR
 48957  }
 48958  
 48959  // Usage:         sqlite3_test_errstr <err code>
 48960  //
 48961  // Test that the english language string equivalents for sqlite error codes
 48962  // are sane. The parameter is an integer representing an sqlite error code.
 48963  // The result is a list of two elements, the string representation of the
 48964  // error code and the english language explanation.
 48965  func test_errstr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3371:26: */
 48966  	var zCode uintptr
 48967  	var i int32
 48968  	if objc != 1 {
 48969  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17077 /* "<error code>" */)
 48970  	}
 48971  
 48972  	zCode = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 48973  	for i = 0; i < 200; i++ {
 48974  		if 0 == libc.Xstrcmp(tls, sqlite3.Xsqlite3ErrName(tls, i), zCode) {
 48975  			break
 48976  		}
 48977  	}
 48978  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, i), uintptr(0))
 48979  	return TCL_OK
 48980  }
 48981  
 48982  // Usage:    breakpoint
 48983  //
 48984  // This routine exists for one purpose - to provide a place to put a
 48985  // breakpoint with GDB that can be triggered using TCL code.  The use
 48986  // for this is when a particular test fails on (say) the 1485th iteration.
 48987  // In the TCL test script, we can add code like this:
 48988  //
 48989  //     if {$i==1485} breakpoint
 48990  //
 48991  // Then run testfixture in the debugger and wait for the breakpoint to
 48992  // fire.  Then additional breakpoints can be set to trace down the bug.
 48993  func test_breakpoint(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:3404:26: */
 48994  	return TCL_OK // Do nothing
 48995  }
 48996  
 48997  // Usage:   sqlite3_bind_zeroblob  STMT IDX N
 48998  //
 48999  // Test the sqlite3_bind_zeroblob interface.  STMT is a prepared statement.
 49000  // IDX is the index of a wildcard in the prepared statement.  This command
 49001  // binds a N-byte zero-filled BLOB to the wildcard.
 49002  func test_bind_zeroblob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3420:26: */
 49003  	bp := tls.Alloc(12)
 49004  	defer tls.Free(12)
 49005  
 49006  	// var pStmt uintptr at bp, 4
 49007  
 49008  	// var idx int32 at bp+4, 4
 49009  
 49010  	// var n int32 at bp+8, 4
 49011  
 49012  	var rc int32
 49013  
 49014  	if objc != 4 {
 49015  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17090 /* "STMT IDX N" */)
 49016  		return TCL_ERROR
 49017  	}
 49018  
 49019  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 49020  		return TCL_ERROR
 49021  	}
 49022  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &idx */) != 0 {
 49023  		return TCL_ERROR
 49024  	}
 49025  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+8 /* &n */) != 0 {
 49026  		return TCL_ERROR
 49027  	}
 49028  
 49029  	rc = sqlite3.Xsqlite3_bind_zeroblob(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 4 /* idx */)), *(*int32)(unsafe.Pointer(bp + 8 /* n */)))
 49030  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))), rc) != 0 {
 49031  		return TCL_ERROR
 49032  	}
 49033  	if rc != SQLITE_OK {
 49034  		return TCL_ERROR
 49035  	}
 49036  
 49037  	return TCL_OK
 49038  }
 49039  
 49040  // Usage:   sqlite3_bind_zeroblob64  STMT IDX N
 49041  //
 49042  // Test the sqlite3_bind_zeroblob64 interface.  STMT is a prepared statement.
 49043  // IDX is the index of a wildcard in the prepared statement.  This command
 49044  // binds a N-byte zero-filled BLOB to the wildcard.
 49045  func test_bind_zeroblob64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3456:26: */
 49046  	bp := tls.Alloc(32)
 49047  	defer tls.Free(32)
 49048  
 49049  	// var pStmt uintptr at bp+16, 4
 49050  
 49051  	// var idx int32 at bp+20, 4
 49052  
 49053  	// var n Tcl_WideInt at bp+24, 8
 49054  
 49055  	var rc int32
 49056  
 49057  	if objc != 4 {
 49058  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17090 /* "STMT IDX N" */)
 49059  		return TCL_ERROR
 49060  	}
 49061  
 49062  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &pStmt */) != 0 {
 49063  		return TCL_ERROR
 49064  	}
 49065  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+20 /* &idx */) != 0 {
 49066  		return TCL_ERROR
 49067  	}
 49068  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+24 /* &n */) != 0 {
 49069  		return TCL_ERROR
 49070  	}
 49071  
 49072  	rc = sqlite3.Xsqlite3_bind_zeroblob64(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 20 /* idx */)), uint64(*(*Tcl_WideInt)(unsafe.Pointer(bp + 24 /* n */))))
 49073  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))), rc) != 0 {
 49074  		return TCL_ERROR
 49075  	}
 49076  	if rc != SQLITE_OK {
 49077  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 49078  		return TCL_ERROR
 49079  	}
 49080  
 49081  	return TCL_OK
 49082  }
 49083  
 49084  // Usage:   sqlite3_bind_int  STMT N VALUE
 49085  //
 49086  // Test the sqlite3_bind_int interface.  STMT is a prepared statement.
 49087  // N is the index of a wildcard in the prepared statement.  This command
 49088  // binds a 32-bit integer VALUE to that wildcard.
 49089  func test_bind_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3493:26: */
 49090  	bp := tls.Alloc(44)
 49091  	defer tls.Free(44)
 49092  
 49093  	// var pStmt uintptr at bp+32, 4
 49094  
 49095  	// var idx int32 at bp+36, 4
 49096  
 49097  	// var value int32 at bp+40, 4
 49098  
 49099  	var rc int32
 49100  
 49101  	if objc != 4 {
 49102  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49103  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 49104  		return TCL_ERROR
 49105  	}
 49106  
 49107  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 49108  		return TCL_ERROR
 49109  	}
 49110  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &idx */) != 0 {
 49111  		return TCL_ERROR
 49112  	}
 49113  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+40 /* &value */) != 0 {
 49114  		return TCL_ERROR
 49115  	}
 49116  
 49117  	rc = sqlite3.Xsqlite3_bind_int(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* idx */)), *(*int32)(unsafe.Pointer(bp + 40 /* value */)))
 49118  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 49119  		return TCL_ERROR
 49120  	}
 49121  	if rc != SQLITE_OK {
 49122  		return TCL_ERROR
 49123  	}
 49124  
 49125  	return TCL_OK
 49126  }
 49127  
 49128  // Usage:   intarray_addr  INT  ...
 49129  //
 49130  // Return the address of a C-language array of 32-bit integers.
 49131  //
 49132  // Space to hold the array is obtained from malloc().  Call this procedure once
 49133  // with no arguments in order to release memory.  Each call to this procedure
 49134  // overwrites the previous array.
 49135  func test_intarray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3533:26: */
 49136  	var i int32
 49137  
 49138  	sqlite3.Xsqlite3_free(tls, p)
 49139  	p = uintptr(0)
 49140  	if objc > 1 {
 49141  		p = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(int32(0))) * (uint32(objc - 1)))))
 49142  		if p == uintptr(0) {
 49143  			return TCL_ERROR
 49144  		}
 49145  		for i = 0; i < (objc - 1); i++ {
 49146  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*4)), (p+uintptr(i)*4)) != 0 {
 49147  				sqlite3.Xsqlite3_free(tls, p)
 49148  				p = uintptr(0)
 49149  				return TCL_ERROR
 49150  			}
 49151  		}
 49152  	}
 49153  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p)))
 49154  	return TCL_OK
 49155  }
 49156  
 49157  var p uintptr = uintptr(0) /* test1.c:3540:14 */
 49158  
 49159  // Usage:   intarray_addr  INT  ...
 49160  //
 49161  // Return the address of a C-language array of 32-bit integers.
 49162  //
 49163  // Space to hold the array is obtained from malloc().  Call this procedure once
 49164  // with no arguments in order to release memory.  Each call to this procedure
 49165  // overwrites the previous array.
 49166  func test_int64array_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3567:26: */
 49167  	bp := tls.Alloc(8)
 49168  	defer tls.Free(8)
 49169  
 49170  	var i int32
 49171  
 49172  	sqlite3.Xsqlite3_free(tls, p1)
 49173  	p1 = uintptr(0)
 49174  	if objc > 1 {
 49175  		p1 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(sqlite3_int64(0))) * (uint32(objc - 1)))))
 49176  		if p1 == uintptr(0) {
 49177  			return TCL_ERROR
 49178  		}
 49179  		for i = 0; i < (objc - 1); i++ {
 49180  			// var v Tcl_WideInt at bp, 8
 49181  
 49182  			if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*4)), bp /* &v */) != 0 {
 49183  				sqlite3.Xsqlite3_free(tls, p1)
 49184  				p1 = uintptr(0)
 49185  				return TCL_ERROR
 49186  			}
 49187  			*(*sqlite3_int64)(unsafe.Pointer(p1 + uintptr(i)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp /* v */))
 49188  		}
 49189  	}
 49190  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p1)))
 49191  	return TCL_OK
 49192  }
 49193  
 49194  var p1 uintptr = uintptr(0) /* test1.c:3574:24 */
 49195  
 49196  // Usage:   doublearray_addr  INT  ...
 49197  //
 49198  // Return the address of a C-language array of doubles.
 49199  //
 49200  // Space to hold the array is obtained from malloc().  Call this procedure once
 49201  // with no arguments in order to release memory.  Each call to this procedure
 49202  // overwrites the previous array.
 49203  func test_doublearray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3603:26: */
 49204  	var i int32
 49205  
 49206  	sqlite3.Xsqlite3_free(tls, p2)
 49207  	p2 = uintptr(0)
 49208  	if objc > 1 {
 49209  		p2 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(float64(0))) * (uint32(objc - 1)))))
 49210  		if p2 == uintptr(0) {
 49211  			return TCL_ERROR
 49212  		}
 49213  		for i = 0; i < (objc - 1); i++ {
 49214  			if tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*4)), (p2+uintptr(i)*8)) != 0 {
 49215  				sqlite3.Xsqlite3_free(tls, p2)
 49216  				p2 = uintptr(0)
 49217  				return TCL_ERROR
 49218  			}
 49219  		}
 49220  	}
 49221  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p2)))
 49222  	return TCL_OK
 49223  }
 49224  
 49225  var p2 uintptr = uintptr(0) /* test1.c:3610:17 */
 49226  
 49227  // Usage:   textarray_addr  TEXT ...
 49228  //
 49229  // Return the address of a C-language array of strings.
 49230  //
 49231  // Space to hold the array is obtained from malloc().  Call this procedure once
 49232  // with no arguments in order to release memory.  Each call to this procedure
 49233  // overwrites the previous array.
 49234  func test_textarray_addr(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3637:26: */
 49235  	bp := tls.Alloc(8)
 49236  	defer tls.Free(8)
 49237  
 49238  	var i int32
 49239  
 49240  	for i = 0; i < n; i++ {
 49241  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(p3 + uintptr(i)*4)))
 49242  	}
 49243  	sqlite3.Xsqlite3_free(tls, p3)
 49244  	p3 = uintptr(0)
 49245  	if objc > 1 {
 49246  		p3 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(uintptr(0))) * (uint32(objc - 1)))))
 49247  		if p3 == uintptr(0) {
 49248  			return TCL_ERROR
 49249  		}
 49250  		for i = 0; i < (objc - 1); i++ {
 49251  			*(*uintptr)(unsafe.Pointer(p3 + uintptr(i)*4)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((1+i))*4)))))
 49252  		}
 49253  	}
 49254  	n = (objc - 1)
 49255  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(p3)))
 49256  	return TCL_OK
 49257  }
 49258  
 49259  var n int32 = 0             /* test1.c:3644:14 */
 49260  var p3 uintptr = uintptr(0) /* test1.c:3645:15 */
 49261  
 49262  // Usage:   sqlite3_bind_int64  STMT N VALUE
 49263  //
 49264  // Test the sqlite3_bind_int64 interface.  STMT is a prepared statement.
 49265  // N is the index of a wildcard in the prepared statement.  This command
 49266  // binds a 64-bit integer VALUE to that wildcard.
 49267  func test_bind_int64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3670:26: */
 49268  	bp := tls.Alloc(48)
 49269  	defer tls.Free(48)
 49270  
 49271  	// var pStmt uintptr at bp+32, 4
 49272  
 49273  	// var idx int32 at bp+36, 4
 49274  
 49275  	// var value Tcl_WideInt at bp+40, 8
 49276  
 49277  	var rc int32
 49278  
 49279  	if objc != 4 {
 49280  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49281  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 49282  		return TCL_ERROR
 49283  	}
 49284  
 49285  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 49286  		return TCL_ERROR
 49287  	}
 49288  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &idx */) != 0 {
 49289  		return TCL_ERROR
 49290  	}
 49291  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+40 /* &value */) != 0 {
 49292  		return TCL_ERROR
 49293  	}
 49294  
 49295  	rc = sqlite3.Xsqlite3_bind_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* idx */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 40 /* value */)))
 49296  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 49297  		return TCL_ERROR
 49298  	}
 49299  	if rc != SQLITE_OK {
 49300  		return TCL_ERROR
 49301  	}
 49302  
 49303  	return TCL_OK
 49304  }
 49305  
 49306  // Usage:   sqlite3_bind_double  STMT N VALUE
 49307  //
 49308  // Test the sqlite3_bind_double interface.  STMT is a prepared statement.
 49309  // N is the index of a wildcard in the prepared statement.  This command
 49310  // binds a 64-bit integer VALUE to that wildcard.
 49311  func test_bind_double(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3708:26: */
 49312  	bp := tls.Alloc(56)
 49313  	defer tls.Free(56)
 49314  
 49315  	// var pStmt uintptr at bp+32, 4
 49316  
 49317  	// var idx int32 at bp+36, 4
 49318  
 49319  	*(*float64)(unsafe.Pointer(bp + 40 /* value */)) = float64(0)
 49320  	var rc int32
 49321  	var zVal uintptr
 49322  	var i int32
 49323  
 49324  	if objc != 4 {
 49325  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49326  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17101 /* " STMT N VALUE" */, 0))
 49327  		return TCL_ERROR
 49328  	}
 49329  
 49330  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 49331  		return TCL_ERROR
 49332  	}
 49333  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &idx */) != 0 {
 49334  		return TCL_ERROR
 49335  	}
 49336  
 49337  	// Intercept the string "NaN" and generate a NaN value for it.
 49338  	// All other strings are passed through to Tcl_GetDoubleFromObj().
 49339  	// Tcl_GetDoubleFromObj() should understand "NaN" but some versions
 49340  	// contain a bug.
 49341  	zVal = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 49342  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aSpecialFp)) / uint32(unsafe.Sizeof(struct {
 49343  		FzName  uintptr
 49344  		FiUpper uint32
 49345  		FiLower uint32
 49346  	}{}))); i++ {
 49347  		if libc.Xstrcmp(tls, aSpecialFp[i].FzName, zVal) == 0 {
 49348  			// var x sqlite3_uint64 at bp+48, 8
 49349  
 49350  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 48 /* x */)) = sqlite3_uint64(aSpecialFp[i].FiUpper)
 49351  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 48 /* x */)) <<= 32
 49352  			*(*sqlite3_uint64)(unsafe.Pointer(bp + 48 /* x */)) |= sqlite3_uint64(aSpecialFp[i].FiLower)
 49353  
 49354  			libc.Xmemcpy(tls, bp+40 /* &value */, bp+48 /* &x */, uint32(8))
 49355  			break
 49356  		}
 49357  	}
 49358  	if (uint32(i) >= (uint32(unsafe.Sizeof(aSpecialFp)) / uint32(unsafe.Sizeof(struct {
 49359  		FzName  uintptr
 49360  		FiUpper uint32
 49361  		FiLower uint32
 49362  	}{})))) && (tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+40 /* &value */) != 0) {
 49363  		return TCL_ERROR
 49364  	}
 49365  	rc = sqlite3.Xsqlite3_bind_double(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* idx */)), *(*float64)(unsafe.Pointer(bp + 40 /* value */)))
 49366  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 49367  		return TCL_ERROR
 49368  	}
 49369  	if rc != SQLITE_OK {
 49370  		return TCL_ERROR
 49371  	}
 49372  
 49373  	return TCL_OK
 49374  }
 49375  
 49376  var aSpecialFp = [10]struct {
 49377  	FzName  uintptr
 49378  	FiUpper uint32
 49379  	FiLower uint32
 49380  }{
 49381  	{FzName: ts + 17115 /* "NaN" */, FiUpper: uint32(0x7fffffff), FiLower: 0xffffffff},
 49382  	{FzName: ts + 17119 /* "SNaN" */, FiUpper: uint32(0x7ff7ffff), FiLower: 0xffffffff},
 49383  	{FzName: ts + 17124 /* "-NaN" */, FiUpper: 0xffffffff, FiLower: 0xffffffff},
 49384  	{FzName: ts + 17129 /* "-SNaN" */, FiUpper: 0xfff7ffff, FiLower: 0xffffffff},
 49385  	{FzName: ts + 17135 /* "+Inf" */, FiUpper: uint32(0x7ff00000)},
 49386  	{FzName: ts + 17140 /* "-Inf" */, FiUpper: 0xfff00000},
 49387  	{FzName: ts + 17145 /* "Epsilon" */, FiLower: uint32(0x00000001)},
 49388  	{FzName: ts + 17153 /* "-Epsilon" */, FiUpper: 0x80000000, FiLower: uint32(0x00000001)},
 49389  	{FzName: ts + 17162 /* "NaN0" */, FiUpper: uint32(0x7ff80000)},
 49390  	{FzName: ts + 17167 /* "-NaN0" */, FiUpper: 0xfff80000},
 49391  } /* test1.c:3724:5 */
 49392  
 49393  // Usage:   sqlite3_bind_null  STMT N
 49394  //
 49395  // Test the sqlite3_bind_null interface.  STMT is a prepared statement.
 49396  // N is the index of a wildcard in the prepared statement.  This command
 49397  // binds a NULL to the wildcard.
 49398  func test_bind_null(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3784:26: */
 49399  	bp := tls.Alloc(40)
 49400  	defer tls.Free(40)
 49401  
 49402  	// var pStmt uintptr at bp+32, 4
 49403  
 49404  	// var idx int32 at bp+36, 4
 49405  
 49406  	var rc int32
 49407  
 49408  	if objc != 3 {
 49409  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49410  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17173 /* " STMT N" */, 0))
 49411  		return TCL_ERROR
 49412  	}
 49413  
 49414  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 49415  		return TCL_ERROR
 49416  	}
 49417  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &idx */) != 0 {
 49418  		return TCL_ERROR
 49419  	}
 49420  
 49421  	rc = sqlite3.Xsqlite3_bind_null(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* idx */)))
 49422  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */))), rc) != 0 {
 49423  		return TCL_ERROR
 49424  	}
 49425  	if rc != SQLITE_OK {
 49426  		return TCL_ERROR
 49427  	}
 49428  
 49429  	return TCL_OK
 49430  }
 49431  
 49432  // Usage:   sqlite3_bind_text  STMT N STRING BYTES
 49433  //
 49434  // Test the sqlite3_bind_text interface.  STMT is a prepared statement.
 49435  // N is the index of a wildcard in the prepared statement.  This command
 49436  // binds a UTF-8 string STRING to the wildcard.  The string is BYTES bytes
 49437  // long.
 49438  func test_bind_text(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3820:26: */
 49439  	bp := tls.Alloc(80)
 49440  	defer tls.Free(80)
 49441  
 49442  	// var pStmt uintptr at bp+64, 4
 49443  
 49444  	// var idx int32 at bp+68, 4
 49445  
 49446  	*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */)) = 0
 49447  	// var bytes int32 at bp+76, 4
 49448  
 49449  	var value uintptr
 49450  	var rc int32
 49451  	var toFree uintptr = uintptr(0)
 49452  
 49453  	if objc != 5 {
 49454  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49455  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17181 /* " STMT N VALUE BY..." */, 0))
 49456  		return TCL_ERROR
 49457  	}
 49458  
 49459  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &pStmt */) != 0 {
 49460  		return TCL_ERROR
 49461  	}
 49462  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+68 /* &idx */) != 0 {
 49463  		return TCL_ERROR
 49464  	}
 49465  	value = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+72 /* &trueLength */)
 49466  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+76 /* &bytes */) != 0 {
 49467  		return TCL_ERROR
 49468  	}
 49469  	if *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)) < 0 {
 49470  		toFree = libc.Xmalloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */)) + 1)))
 49471  		if toFree == uintptr(0) {
 49472  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+1930 /* "out of memory" */, uintptr(0)))
 49473  			return TCL_ERROR
 49474  		}
 49475  		libc.Xmemcpy(tls, toFree, value, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */))))
 49476  		*(*int8)(unsafe.Pointer(toFree + uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */))))) = int8(0)
 49477  		value = toFree
 49478  	}
 49479  	rc = sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 68 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)), libc.UintptrFromInt32(-1))
 49480  	libc.Xfree(tls, toFree)
 49481  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 49482  		return TCL_ERROR
 49483  	}
 49484  	if rc != SQLITE_OK {
 49485  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 49486  		return TCL_ERROR
 49487  	}
 49488  
 49489  	return TCL_OK
 49490  }
 49491  
 49492  // Usage:   sqlite3_bind_text16 ?-static? STMT N STRING BYTES
 49493  //
 49494  // Test the sqlite3_bind_text16 interface.  STMT is a prepared statement.
 49495  // N is the index of a wildcard in the prepared statement.  This command
 49496  // binds a UTF-16 string STRING to the wildcard.  The string is BYTES bytes
 49497  // long.
 49498  func test_bind_text16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3873:26: */
 49499  	bp := tls.Alloc(80)
 49500  	defer tls.Free(80)
 49501  
 49502  	// var pStmt uintptr at bp+64, 4
 49503  
 49504  	// var idx int32 at bp+68, 4
 49505  
 49506  	// var bytes int32 at bp+76, 4
 49507  
 49508  	var value uintptr
 49509  	var toFree uintptr = uintptr(0)
 49510  	var rc int32
 49511  	*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */)) = 0
 49512  
 49513  	var xDel uintptr = func() uintptr {
 49514  		if objc == 6 {
 49515  			return uintptr(0)
 49516  		}
 49517  		return libc.UintptrFromInt32(-1)
 49518  	}()
 49519  	var oStmt uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-4))*4))
 49520  	var oN uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-3))*4))
 49521  	var oString uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4))
 49522  	var oBytes uintptr = *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4))
 49523  
 49524  	if (objc != 5) && (objc != 6) {
 49525  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49526  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17181 /* " STMT N VALUE BY..." */, 0))
 49527  		return TCL_ERROR
 49528  	}
 49529  
 49530  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, oStmt), bp+64 /* &pStmt */) != 0 {
 49531  		return TCL_ERROR
 49532  	}
 49533  	if tcl.XTcl_GetIntFromObj(tls, interp, oN, bp+68 /* &idx */) != 0 {
 49534  		return TCL_ERROR
 49535  	}
 49536  	value = tcl.XTcl_GetByteArrayFromObj(tls, oString, bp+72 /* &trueLength */)
 49537  	if tcl.XTcl_GetIntFromObj(tls, interp, oBytes, bp+76 /* &bytes */) != 0 {
 49538  		return TCL_ERROR
 49539  	}
 49540  	if (*(*int32)(unsafe.Pointer(bp + 76 /* bytes */)) < 0) && (xDel == (libc.UintptrFromInt32(-1))) {
 49541  		toFree = libc.Xmalloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */)) + 3)))
 49542  		if toFree == uintptr(0) {
 49543  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+1930 /* "out of memory" */, uintptr(0)))
 49544  			return TCL_ERROR
 49545  		}
 49546  		libc.Xmemcpy(tls, toFree, value, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */))))
 49547  		libc.Xmemset(tls, (toFree + uintptr(*(*int32)(unsafe.Pointer(bp + 72 /* trueLength */)))), 0, uint32(3))
 49548  		value = toFree
 49549  	}
 49550  	rc = sqlite3.Xsqlite3_bind_text16(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 68 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)), xDel)
 49551  	libc.Xfree(tls, toFree)
 49552  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 49553  		return TCL_ERROR
 49554  	}
 49555  	if rc != SQLITE_OK {
 49556  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 49557  		return TCL_ERROR
 49558  	}
 49559  
 49560  	return TCL_OK
 49561  }
 49562  
 49563  // Usage:   sqlite3_bind_blob ?-static? STMT N DATA BYTES
 49564  //
 49565  // Test the sqlite3_bind_blob interface.  STMT is a prepared statement.
 49566  // N is the index of a wildcard in the prepared statement.  This command
 49567  // binds a BLOB to the wildcard.  The BLOB is BYTES bytes in size.
 49568  func test_bind_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3933:26: */
 49569  	bp := tls.Alloc(280)
 49570  	defer tls.Free(280)
 49571  
 49572  	// var pStmt uintptr at bp+64, 4
 49573  
 49574  	// var len int32 at bp+72, 4
 49575  
 49576  	// var idx int32 at bp+68, 4
 49577  
 49578  	// var bytes int32 at bp+76, 4
 49579  
 49580  	var value uintptr
 49581  	var rc int32
 49582  	var xDestructor sqlite3_destructor_type = libc.UintptrFromInt32(-1)
 49583  
 49584  	if (objc != 5) && (objc != 6) {
 49585  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 49586  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+17201 /* " STMT N DATA BYT..." */, 0))
 49587  		return TCL_ERROR
 49588  	}
 49589  
 49590  	if objc == 6 {
 49591  		xDestructor = uintptr(0)
 49592  		objv += 4
 49593  	}
 49594  
 49595  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &pStmt */) != 0 {
 49596  		return TCL_ERROR
 49597  	}
 49598  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+68 /* &idx */) != 0 {
 49599  		return TCL_ERROR
 49600  	}
 49601  
 49602  	value = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+72 /* &len */)
 49603  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+76 /* &bytes */) != 0 {
 49604  		return TCL_ERROR
 49605  	}
 49606  
 49607  	if *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)) > *(*int32)(unsafe.Pointer(bp + 72 /* len */)) {
 49608  		// var zBuf [200]int8 at bp+80, 200
 49609  
 49610  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+80, /* &zBuf[0] */
 49611  			ts+17220 /* "cannot use %d bl..." */, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)), *(*int32)(unsafe.Pointer(bp + 72 /* len */))))
 49612  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+80 /* &zBuf[0] */, uintptr(0)))
 49613  		return TCL_ERROR
 49614  	}
 49615  
 49616  	rc = sqlite3.Xsqlite3_bind_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 68 /* idx */)), value, *(*int32)(unsafe.Pointer(bp + 76 /* bytes */)), xDestructor)
 49617  	if sqlite3TestErrCode(tls, interp, sqlite3.Xsqlite3_db_handle(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))), rc) != 0 {
 49618  		return TCL_ERROR
 49619  	}
 49620  	if rc != SQLITE_OK {
 49621  		return TCL_ERROR
 49622  	}
 49623  
 49624  	return TCL_OK
 49625  }
 49626  
 49627  // sqlite3_carray_bind [options...] STMT NAME VALUE ...
 49628  //
 49629  // Options:
 49630  //    -transient
 49631  //    -static
 49632  //    -int32
 49633  //    -int64
 49634  //    -double
 49635  //    -text
 49636  //
 49637  // Each call clears static data.  Called with no options does nothing
 49638  // but clear static data.
 49639  func test_carray_bind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:3996:26: */
 49640  	bp := tls.Alloc(112)
 49641  	defer tls.Free(112)
 49642  
 49643  	// var pStmt uintptr at bp+80, 4
 49644  
 49645  	var eType int32 // CARRAY_INT32
 49646  	var nData int32
 49647  	var aData uintptr
 49648  	var isTransient int32
 49649  	var isStatic int32
 49650  	// var idx int32 at bp+84, 4
 49651  
 49652  	var i int32
 49653  	var j int32
 49654  	var rc int32
 49655  	var xDel uintptr
 49656  	var z uintptr
 49657  	// var v int32 at bp+88, 4
 49658  	// INT32
 49659  	var a uintptr
 49660  	// var v1 Tcl_WideInt at bp+96, 8
 49661  	// INT64
 49662  	var a1 uintptr
 49663  	// var v2 float64 at bp+104, 8
 49664  	// DOUBLE
 49665  	var a2 uintptr
 49666  	var v3 uintptr // TEXT
 49667  	var a3 uintptr
 49668  	eType = 0
 49669  	nData = 0
 49670  	aData = uintptr(0)
 49671  	isTransient = 0
 49672  	isStatic = 0
 49673  	xDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 49674  
 49675  	if !(aStaticData != 0) {
 49676  		goto __1
 49677  	}
 49678  	// Always clear preexisting static data on every call
 49679  	if !(eStaticType == 3) {
 49680  		goto __2
 49681  	}
 49682  	i = 0
 49683  __3:
 49684  	if !(i < nStaticData) {
 49685  		goto __5
 49686  	}
 49687  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((aStaticData) + uintptr(i)*4)))
 49688  	goto __4
 49689  __4:
 49690  	i++
 49691  	goto __3
 49692  	goto __5
 49693  __5:
 49694  	;
 49695  __2:
 49696  	;
 49697  	sqlite3.Xsqlite3_free(tls, aStaticData)
 49698  	aStaticData = uintptr(0)
 49699  	nStaticData = 0
 49700  	eStaticType = 0
 49701  __1:
 49702  	;
 49703  	if !(objc == 1) {
 49704  		goto __6
 49705  	}
 49706  	return TCL_OK
 49707  __6:
 49708  	;
 49709  
 49710  	i = 1
 49711  __7:
 49712  	if !((i < objc) && (int32(*(*int8)(unsafe.Pointer(tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)))))) == '-')) {
 49713  		goto __9
 49714  	}
 49715  	z = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)))
 49716  	if !(libc.Xstrcmp(tls, z, ts+17254 /* "-transient" */) == 0) {
 49717  		goto __10
 49718  	}
 49719  	isTransient = 1
 49720  	xDel = libc.UintptrFromInt32(-1)
 49721  	goto __11
 49722  __10:
 49723  	if !(libc.Xstrcmp(tls, z, ts+17265 /* "-static" */) == 0) {
 49724  		goto __12
 49725  	}
 49726  	isStatic = 1
 49727  	xDel = uintptr(0)
 49728  	goto __13
 49729  __12:
 49730  	if !(libc.Xstrcmp(tls, z, ts+17273 /* "-int32" */) == 0) {
 49731  		goto __14
 49732  	}
 49733  	eType = 0 // CARRAY_INT32
 49734  	goto __15
 49735  __14:
 49736  	if !(libc.Xstrcmp(tls, z, ts+17280 /* "-int64" */) == 0) {
 49737  		goto __16
 49738  	}
 49739  	eType = 1 // CARRAY_INT64
 49740  	goto __17
 49741  __16:
 49742  	if !(libc.Xstrcmp(tls, z, ts+17287 /* "-double" */) == 0) {
 49743  		goto __18
 49744  	}
 49745  	eType = 2 // CARRAY_DOUBLE
 49746  	goto __19
 49747  __18:
 49748  	if !(libc.Xstrcmp(tls, z, ts+17295 /* "-text" */) == 0) {
 49749  		goto __20
 49750  	}
 49751  	eType = 3 // CARRAY_TEXT
 49752  	goto __21
 49753  __20:
 49754  	if !(libc.Xstrcmp(tls, z, ts+17301 /* "--" */) == 0) {
 49755  		goto __22
 49756  	}
 49757  	goto __9
 49758  	goto __23
 49759  __22:
 49760  
 49761  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+12914 /* "unknown option: " */, z, uintptr(0)))
 49762  	return TCL_ERROR
 49763  __23:
 49764  	;
 49765  __21:
 49766  	;
 49767  __19:
 49768  	;
 49769  __17:
 49770  	;
 49771  __15:
 49772  	;
 49773  __13:
 49774  	;
 49775  __11:
 49776  	;
 49777  	goto __8
 49778  __8:
 49779  	i++
 49780  	goto __7
 49781  	goto __9
 49782  __9:
 49783  	;
 49784  	if !(((eType == 3) && !(isStatic != 0)) && !(isTransient != 0)) {
 49785  		goto __24
 49786  	}
 49787  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+17304, /* "text data must b..." */
 49788  		uintptr(0)))
 49789  	return TCL_ERROR
 49790  __24:
 49791  	;
 49792  	if !((isStatic != 0) && (isTransient != 0)) {
 49793  		goto __25
 49794  	}
 49795  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+17351, /* "cannot be both -..." */
 49796  		uintptr(0)))
 49797  	return TCL_ERROR
 49798  __25:
 49799  	;
 49800  	if !((objc - i) < 2) {
 49801  		goto __26
 49802  	}
 49803  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17389 /* "[OPTIONS] STMT I..." */)
 49804  	return TCL_ERROR
 49805  __26:
 49806  	;
 49807  	if !(getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4))), bp+80 /* &pStmt */) != 0) {
 49808  		goto __27
 49809  	}
 49810  	return TCL_ERROR
 49811  __27:
 49812  	;
 49813  	i++
 49814  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+84 /* &idx */) != 0) {
 49815  		goto __28
 49816  	}
 49817  	return TCL_ERROR
 49818  __28:
 49819  	;
 49820  	i++
 49821  	nData = (objc - i)
 49822  	switch eType + (4 * (libc.Bool32(nData <= 0))) {
 49823  	case 0:
 49824  		goto __30
 49825  	case 1:
 49826  		goto __31
 49827  	case 2:
 49828  		goto __32
 49829  	case 3:
 49830  		goto __33
 49831  	case 4:
 49832  		goto __34
 49833  	}
 49834  	goto __29
 49835  __30: // INT32
 49836  	a = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(int32(0))) * uint32(nData))))
 49837  	if !(a == uintptr(0)) {
 49838  		goto __35
 49839  	}
 49840  	rc = SQLITE_NOMEM
 49841  	goto carray_bind_done
 49842  __35:
 49843  	;
 49844  	j = 0
 49845  __36:
 49846  	if !(j < nData) {
 49847  		goto __38
 49848  	}
 49849  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*4)), bp+88 /* &v */) != 0) {
 49850  		goto __39
 49851  	}
 49852  	sqlite3.Xsqlite3_free(tls, a)
 49853  	return TCL_ERROR
 49854  __39:
 49855  	;
 49856  	*(*int32)(unsafe.Pointer(a + uintptr(j)*4)) = *(*int32)(unsafe.Pointer(bp + 88 /* v */))
 49857  	goto __37
 49858  __37:
 49859  	j++
 49860  	goto __36
 49861  	goto __38
 49862  __38:
 49863  	;
 49864  	aData = a
 49865  	goto __29
 49866  
 49867  __31: // INT64
 49868  	a1 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(sqlite3_int64(0))) * uint32(nData))))
 49869  	if !(a1 == uintptr(0)) {
 49870  		goto __40
 49871  	}
 49872  	rc = SQLITE_NOMEM
 49873  	goto carray_bind_done
 49874  __40:
 49875  	;
 49876  	j = 0
 49877  __41:
 49878  	if !(j < nData) {
 49879  		goto __43
 49880  	}
 49881  	if !(tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*4)), bp+96 /* &v1 */) != 0) {
 49882  		goto __44
 49883  	}
 49884  	sqlite3.Xsqlite3_free(tls, a1)
 49885  	return TCL_ERROR
 49886  __44:
 49887  	;
 49888  	*(*sqlite3_int64)(unsafe.Pointer(a1 + uintptr(j)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 96 /* v1 */))
 49889  	goto __42
 49890  __42:
 49891  	j++
 49892  	goto __41
 49893  	goto __43
 49894  __43:
 49895  	;
 49896  	aData = a1
 49897  	goto __29
 49898  
 49899  __32: // DOUBLE
 49900  	a2 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(float64(0))) * uint32(nData))))
 49901  	if !(a2 == uintptr(0)) {
 49902  		goto __45
 49903  	}
 49904  	rc = SQLITE_NOMEM
 49905  	goto carray_bind_done
 49906  __45:
 49907  	;
 49908  	j = 0
 49909  __46:
 49910  	if !(j < nData) {
 49911  		goto __48
 49912  	}
 49913  	if !(tcl.XTcl_GetDoubleFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*4)), bp+104 /* &v2 */) != 0) {
 49914  		goto __49
 49915  	}
 49916  	sqlite3.Xsqlite3_free(tls, a2)
 49917  	return TCL_ERROR
 49918  __49:
 49919  	;
 49920  	*(*float64)(unsafe.Pointer(a2 + uintptr(j)*8)) = *(*float64)(unsafe.Pointer(bp + 104 /* v2 */))
 49921  	goto __47
 49922  __47:
 49923  	j++
 49924  	goto __46
 49925  	goto __48
 49926  __48:
 49927  	;
 49928  	aData = a2
 49929  	goto __29
 49930  
 49931  __33: // TEXT
 49932  	a3 = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(uintptr(0))) * uint32(nData))))
 49933  	if !(a3 == uintptr(0)) {
 49934  		goto __50
 49935  	}
 49936  	rc = SQLITE_NOMEM
 49937  	goto carray_bind_done
 49938  __50:
 49939  	;
 49940  	j = 0
 49941  __51:
 49942  	if !(j < nData) {
 49943  		goto __53
 49944  	}
 49945  	v3 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+j))*4)))
 49946  	*(*uintptr)(unsafe.Pointer(a3 + uintptr(j)*4)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+56, v3))
 49947  	goto __52
 49948  __52:
 49949  	j++
 49950  	goto __51
 49951  	goto __53
 49952  __53:
 49953  	;
 49954  	aData = a3
 49955  	goto __29
 49956  
 49957  __34: // nData==0
 49958  	aData = ts + 489 /* "" */
 49959  	xDel = uintptr(0)
 49960  	isTransient = 0
 49961  	isStatic = 0
 49962  	goto __29
 49963  
 49964  __29:
 49965  	;
 49966  	if !(isStatic != 0) {
 49967  		goto __54
 49968  	}
 49969  	aStaticData = aData
 49970  	nStaticData = nData
 49971  	eStaticType = eType
 49972  __54:
 49973  	;
 49974  	rc = sqlite3_carray_bind(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 84 /* idx */)), aData, nData, eType, xDel)
 49975  	if !(isTransient != 0) {
 49976  		goto __55
 49977  	}
 49978  	if !(eType == 3) {
 49979  		goto __56
 49980  	}
 49981  	i = 0
 49982  __57:
 49983  	if !(i < nData) {
 49984  		goto __59
 49985  	}
 49986  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((aData) + uintptr(i)*4)))
 49987  	goto __58
 49988  __58:
 49989  	i++
 49990  	goto __57
 49991  	goto __59
 49992  __59:
 49993  	;
 49994  __56:
 49995  	;
 49996  	sqlite3.Xsqlite3_free(tls, aData)
 49997  __55:
 49998  	;
 49999  carray_bind_done:
 50000  	if !(rc != 0) {
 50001  		goto __60
 50002  	}
 50003  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, sqlite3.Xsqlite3_errstr(tls, rc), uintptr(0)))
 50004  	return TCL_ERROR
 50005  __60:
 50006  	;
 50007  	return TCL_OK
 50008  }
 50009  
 50010  var aStaticData uintptr = uintptr(0) /* test1.c:4012:15 */
 50011  var nStaticData int32 = 0            /* test1.c:4013:14 */
 50012  var eStaticType int32 = 0            /* test1.c:4014:14 */
 50013  
 50014  // Usage:   sqlite3_bind_parameter_count  STMT
 50015  //
 50016  // Return the number of wildcards in the given statement.
 50017  func test_bind_parameter_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4174:26: */
 50018  	bp := tls.Alloc(4)
 50019  	defer tls.Free(4)
 50020  
 50021  	// var pStmt uintptr at bp, 4
 50022  
 50023  	if objc != 2 {
 50024  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 50025  		return TCL_ERROR
 50026  	}
 50027  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50028  		return TCL_ERROR
 50029  	}
 50030  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_bind_parameter_count(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))))
 50031  	return TCL_OK
 50032  }
 50033  
 50034  // Usage:   sqlite3_bind_parameter_name  STMT  N
 50035  //
 50036  // Return the name of the Nth wildcard.  The first wildcard is 1.
 50037  // An empty string is returned if N is out of range or if the wildcard
 50038  // is nameless.
 50039  func test_bind_parameter_name(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4198:26: */
 50040  	bp := tls.Alloc(8)
 50041  	defer tls.Free(8)
 50042  
 50043  	// var pStmt uintptr at bp, 4
 50044  
 50045  	// var i int32 at bp+4, 4
 50046  
 50047  	if objc != 3 {
 50048  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17423 /* "STMT N" */)
 50049  		return TCL_ERROR
 50050  	}
 50051  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50052  		return TCL_ERROR
 50053  	}
 50054  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &i */) != 0 {
 50055  		return TCL_ERROR
 50056  	}
 50057  	tcl.XTcl_SetObjResult(tls, interp,
 50058  		tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_bind_parameter_name(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 4 /* i */))), -1))
 50059  	return TCL_OK
 50060  }
 50061  
 50062  // Usage:   sqlite3_bind_parameter_index  STMT  NAME
 50063  //
 50064  // Return the index of the wildcard called NAME.  Return 0 if there is
 50065  // no such wildcard.
 50066  func test_bind_parameter_index(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4225:26: */
 50067  	bp := tls.Alloc(4)
 50068  	defer tls.Free(4)
 50069  
 50070  	// var pStmt uintptr at bp, 4
 50071  
 50072  	if objc != 3 {
 50073  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17430 /* "STMT NAME" */)
 50074  		return TCL_ERROR
 50075  	}
 50076  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50077  		return TCL_ERROR
 50078  	}
 50079  	tcl.XTcl_SetObjResult(tls, interp,
 50080  		tcl.XTcl_NewIntObj(tls,
 50081  			sqlite3.Xsqlite3_bind_parameter_index(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))))))
 50082  	return TCL_OK
 50083  }
 50084  
 50085  // Usage:   sqlite3_clear_bindings STMT
 50086  //
 50087  func test_clear_bindings(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4250:26: */
 50088  	bp := tls.Alloc(4)
 50089  	defer tls.Free(4)
 50090  
 50091  	// var pStmt uintptr at bp, 4
 50092  
 50093  	if objc != 2 {
 50094  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 50095  		return TCL_ERROR
 50096  	}
 50097  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50098  		return TCL_ERROR
 50099  	}
 50100  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_clear_bindings(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))))
 50101  	return TCL_OK
 50102  }
 50103  
 50104  // Usage:   sqlite3_sleep MILLISECONDS
 50105  func test_sleep(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4270:26: */
 50106  	bp := tls.Alloc(4)
 50107  	defer tls.Free(4)
 50108  
 50109  	// var ms int32 at bp, 4
 50110  
 50111  	if objc != 2 {
 50112  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+13587 /* "MILLISECONDS" */)
 50113  		return TCL_ERROR
 50114  	}
 50115  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &ms */) != 0 {
 50116  		return TCL_ERROR
 50117  	}
 50118  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_sleep(tls, *(*int32)(unsafe.Pointer(bp /* ms */)))))
 50119  	return TCL_OK
 50120  }
 50121  
 50122  // Usage: sqlite3_extended_errcode DB
 50123  //
 50124  // Return the string representation of the most recent sqlite3_* API
 50125  // error code. e.g. "SQLITE_ERROR".
 50126  func test_ex_errcode(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4295:26: */
 50127  	bp := tls.Alloc(52)
 50128  	defer tls.Free(52)
 50129  
 50130  	// var db uintptr at bp+48, 4
 50131  
 50132  	var rc int32
 50133  
 50134  	if objc != 2 {
 50135  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50136  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 50137  		return TCL_ERROR
 50138  	}
 50139  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 50140  		return TCL_ERROR
 50141  	}
 50142  	rc = sqlite3.Xsqlite3_extended_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 50143  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 50144  	return TCL_OK
 50145  }
 50146  
 50147  // Usage: sqlite3_errcode DB
 50148  //
 50149  // Return the string representation of the most recent sqlite3_* API
 50150  // error code. e.g. "SQLITE_ERROR".
 50151  func test_errcode(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4322:26: */
 50152  	bp := tls.Alloc(52)
 50153  	defer tls.Free(52)
 50154  
 50155  	// var db uintptr at bp+48, 4
 50156  
 50157  	var rc int32
 50158  
 50159  	if objc != 2 {
 50160  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50161  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 50162  		return TCL_ERROR
 50163  	}
 50164  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 50165  		return TCL_ERROR
 50166  	}
 50167  	rc = sqlite3.Xsqlite3_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)))
 50168  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 50169  	return TCL_OK
 50170  }
 50171  
 50172  // Usage:   sqlite3_errmsg DB
 50173  //
 50174  // Returns the UTF-8 representation of the error message string for the
 50175  // most recent sqlite3_* API call.
 50176  func test_errmsg(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4348:26: */
 50177  	bp := tls.Alloc(36)
 50178  	defer tls.Free(36)
 50179  
 50180  	// var db uintptr at bp+32, 4
 50181  
 50182  	var zErr uintptr
 50183  
 50184  	if objc != 2 {
 50185  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50186  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 50187  		return TCL_ERROR
 50188  	}
 50189  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 50190  		return TCL_ERROR
 50191  	}
 50192  
 50193  	zErr = sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 50194  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zErr, -1))
 50195  	return TCL_OK
 50196  }
 50197  
 50198  // Usage:   test_errmsg16 DB
 50199  //
 50200  // Returns the UTF-16 representation of the error message string for the
 50201  // most recent sqlite3_* API call. This is a byte array object at the TCL
 50202  // level, and it includes the 0x00 0x00 terminator bytes at the end of the
 50203  // UTF-16 string.
 50204  func test_errmsg16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4377:26: */
 50205  	bp := tls.Alloc(36)
 50206  	defer tls.Free(36)
 50207  
 50208  	// var db uintptr at bp+32, 4
 50209  
 50210  	var zErr uintptr
 50211  	var z uintptr
 50212  	var bytes int32 = 0
 50213  
 50214  	if objc != 2 {
 50215  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50216  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+15462 /* " DB" */, 0))
 50217  		return TCL_ERROR
 50218  	}
 50219  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 50220  		return TCL_ERROR
 50221  	}
 50222  
 50223  	zErr = sqlite3.Xsqlite3_errmsg16(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 50224  	if zErr != 0 {
 50225  		z = zErr
 50226  		for bytes = 0; (*(*int8)(unsafe.Pointer(z + uintptr(bytes))) != 0) || (*(*int8)(unsafe.Pointer(z + uintptr((bytes + 1)))) != 0); bytes = bytes + (2) {
 50227  		}
 50228  	}
 50229  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, zErr, bytes))
 50230  	return TCL_OK
 50231  }
 50232  
 50233  // Usage: sqlite3_prepare DB sql bytes ?tailvar?
 50234  //
 50235  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 50236  // database handle <DB>. The parameter <tailval> is the name of a global
 50237  // variable that is set to the unused portion of <sql> (if any). A
 50238  // STMT handle is returned.
 50239  func test_prepare(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4414:26: */
 50240  	bp := tls.Alloc(146)
 50241  	defer tls.Free(146)
 50242  
 50243  	// var db uintptr at bp+80, 4
 50244  
 50245  	var zSql uintptr
 50246  	// var bytes int32 at bp+84, 4
 50247  
 50248  	*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) = uintptr(0)
 50249  	*(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) = uintptr(0)
 50250  	// var zBuf [50]int8 at bp+96, 50
 50251  
 50252  	var rc int32
 50253  
 50254  	if (objc != 5) && (objc != 4) {
 50255  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50256  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 50257  		return TCL_ERROR
 50258  	}
 50259  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+80 /* &db */) != 0 {
 50260  		return TCL_ERROR
 50261  	}
 50262  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 50263  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+84 /* &bytes */) != 0 {
 50264  		return TCL_ERROR
 50265  	}
 50266  
 50267  	rc = sqlite3.Xsqlite3_prepare(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)), bp+88 /* &pStmt */, func() uintptr {
 50268  		if objc >= 5 {
 50269  			return bp + 92 /* &zTail */
 50270  		}
 50271  		return uintptr(0)
 50272  	}())
 50273  	tcl.XTcl_ResetResult(tls, interp)
 50274  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 50275  		return TCL_ERROR
 50276  	}
 50277  	if (*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) != 0) && (objc >= 5) {
 50278  		if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 50279  			*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */))) - int32(zSql)) / 1))
 50280  		}
 50281  		if int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)))) < *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) {
 50282  			*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */))))
 50283  		}
 50284  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 84 /* bytes */))), 0)
 50285  	}
 50286  	if rc != SQLITE_OK {
 50287  
 50288  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+96 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 50289  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+96 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 50290  		return TCL_ERROR
 50291  	}
 50292  
 50293  	if *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) != 0 {
 50294  		if sqlite3TestMakePointerStr(tls, interp, bp+96 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */))) != 0 {
 50295  			return TCL_ERROR
 50296  		}
 50297  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+96 /* &zBuf[0] */, 0))
 50298  	}
 50299  	return TCL_OK
 50300  }
 50301  
 50302  // Usage: sqlite3_prepare_v2 DB sql bytes ?tailvar?
 50303  //
 50304  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 50305  // database handle <DB>. The parameter <tailval> is the name of a global
 50306  // variable that is set to the unused portion of <sql> (if any). A
 50307  // STMT handle is returned.
 50308  func test_prepare_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4471:26: */
 50309  	bp := tls.Alloc(146)
 50310  	defer tls.Free(146)
 50311  
 50312  	// var db uintptr at bp+80, 4
 50313  
 50314  	var zSql uintptr
 50315  	var zCopy uintptr = uintptr(0) // malloc() copy of zSql
 50316  	// var bytes int32 at bp+84, 4
 50317  
 50318  	*(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */)) = uintptr(0)
 50319  	var pzTail uintptr
 50320  	*(*uintptr)(unsafe.Pointer(bp + 92 /* pStmt */)) = uintptr(0)
 50321  	// var zBuf [50]int8 at bp+96, 50
 50322  
 50323  	var rc int32
 50324  
 50325  	if (objc != 5) && (objc != 4) {
 50326  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50327  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 50328  		return TCL_ERROR
 50329  	}
 50330  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+80 /* &db */) != 0 {
 50331  		return TCL_ERROR
 50332  	}
 50333  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 50334  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+84 /* &bytes */) != 0 {
 50335  		return TCL_ERROR
 50336  	}
 50337  
 50338  	// Instead of using zSql directly, make a copy into a buffer obtained
 50339  	// directly from malloc(). The idea is to make it easier for valgrind
 50340  	// to spot buffer overreads.
 50341  	if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 50342  		zCopy = libc.Xmalloc(tls, uint32(*(*int32)(unsafe.Pointer(bp + 84 /* bytes */))))
 50343  		libc.Xmemcpy(tls, zCopy, zSql, uint32(*(*int32)(unsafe.Pointer(bp + 84 /* bytes */))))
 50344  	} else {
 50345  		var n int32 = (int32(libc.Xstrlen(tls, zSql)) + 1)
 50346  		zCopy = libc.Xmalloc(tls, uint32(n))
 50347  		libc.Xmemcpy(tls, zCopy, zSql, uint32(n))
 50348  	}
 50349  	if objc >= 5 {
 50350  		pzTail = bp + 88 /* &zTail */
 50351  	} else {
 50352  		pzTail = uintptr(0)
 50353  	}
 50354  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zCopy, *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)), bp+92 /* &pStmt */, pzTail)
 50355  	if objc >= 5 {
 50356  		*(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */)) = (zSql + uintptr(((int32(*(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */))) - int32(zCopy)) / 1)))
 50357  	}
 50358  	libc.Xfree(tls, zCopy)
 50359  
 50360  	tcl.XTcl_ResetResult(tls, interp)
 50361  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 50362  		return TCL_ERROR
 50363  	}
 50364  	if ((rc == SQLITE_OK) && (objc >= 5)) && (*(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */)) != 0) {
 50365  		if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 50366  			*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */))) - int32(zSql)) / 1))
 50367  		}
 50368  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 88 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 84 /* bytes */))), 0)
 50369  	}
 50370  	if rc != SQLITE_OK {
 50371  
 50372  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+96 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 50373  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+96 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 50374  		return TCL_ERROR
 50375  	}
 50376  
 50377  	if *(*uintptr)(unsafe.Pointer(bp + 92 /* pStmt */)) != 0 {
 50378  		if sqlite3TestMakePointerStr(tls, interp, bp+96 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 92 /* pStmt */))) != 0 {
 50379  			return TCL_ERROR
 50380  		}
 50381  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+96 /* &zBuf[0] */, 0))
 50382  	}
 50383  	return TCL_OK
 50384  }
 50385  
 50386  // Usage: sqlite3_prepare_v3 DB sql bytes flags ?tailvar?
 50387  //
 50388  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 50389  // database handle <DB> and flags <flags>. The parameter <tailval> is
 50390  // the name of a global variable that is set to the unused portion of
 50391  // <sql> (if any). A STMT handle is returned.
 50392  func test_prepare_v3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4545:26: */
 50393  	bp := tls.Alloc(150)
 50394  	defer tls.Free(150)
 50395  
 50396  	// var db uintptr at bp+80, 4
 50397  
 50398  	var zSql uintptr
 50399  	var zCopy uintptr = uintptr(0) // malloc() copy of zSql
 50400  	// var bytes int32 at bp+84, 4
 50401  
 50402  	// var flags int32 at bp+88, 4
 50403  
 50404  	*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) = uintptr(0)
 50405  	var pzTail uintptr
 50406  	*(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) = uintptr(0)
 50407  	// var zBuf [50]int8 at bp+100, 50
 50408  
 50409  	var rc int32
 50410  
 50411  	if (objc != 6) && (objc != 5) {
 50412  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50413  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17486 /* " DB sql bytes fl..." */, 0))
 50414  		return TCL_ERROR
 50415  	}
 50416  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+80 /* &db */) != 0 {
 50417  		return TCL_ERROR
 50418  	}
 50419  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 50420  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+84 /* &bytes */) != 0 {
 50421  		return TCL_ERROR
 50422  	}
 50423  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+88 /* &flags */) != 0 {
 50424  		return TCL_ERROR
 50425  	}
 50426  
 50427  	// Instead of using zSql directly, make a copy into a buffer obtained
 50428  	// directly from malloc(). The idea is to make it easier for valgrind
 50429  	// to spot buffer overreads.
 50430  	if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 50431  		zCopy = libc.Xmalloc(tls, uint32(*(*int32)(unsafe.Pointer(bp + 84 /* bytes */))))
 50432  		libc.Xmemcpy(tls, zCopy, zSql, uint32(*(*int32)(unsafe.Pointer(bp + 84 /* bytes */))))
 50433  	} else {
 50434  		var n int32 = (int32(libc.Xstrlen(tls, zSql)) + 1)
 50435  		zCopy = libc.Xmalloc(tls, uint32(n))
 50436  		libc.Xmemcpy(tls, zCopy, zSql, uint32(n))
 50437  	}
 50438  	if objc >= 6 {
 50439  		pzTail = bp + 92 /* &zTail */
 50440  	} else {
 50441  		pzTail = uintptr(0)
 50442  	}
 50443  	rc = sqlite3.Xsqlite3_prepare_v3(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zCopy, *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)), uint32(*(*int32)(unsafe.Pointer(bp + 88 /* flags */))), bp+96 /* &pStmt */, pzTail)
 50444  	libc.Xfree(tls, zCopy)
 50445  	*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) = (zSql + uintptr(((int32(*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */))) - int32(zCopy)) / 1)))
 50446  
 50447  	tcl.XTcl_ResetResult(tls, interp)
 50448  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 50449  		return TCL_ERROR
 50450  	}
 50451  	if ((rc == SQLITE_OK) && (*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) != 0)) && (objc >= 6) {
 50452  		if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 50453  			*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */))) - int32(zSql)) / 1))
 50454  		}
 50455  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*4)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 84 /* bytes */))), 0)
 50456  	}
 50457  	if rc != SQLITE_OK {
 50458  
 50459  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+100 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 50460  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+100 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 50461  		return TCL_ERROR
 50462  	}
 50463  
 50464  	if *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */)) != 0 {
 50465  		if sqlite3TestMakePointerStr(tls, interp, bp+100 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 96 /* pStmt */))) != 0 {
 50466  			return TCL_ERROR
 50467  		}
 50468  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+100 /* &zBuf[0] */, 0))
 50469  	}
 50470  	return TCL_OK
 50471  }
 50472  
 50473  // Usage: sqlite3_prepare_tkt3134 DB
 50474  //
 50475  // Generate a prepared statement for a zero-byte string as a test
 50476  // for ticket #3134.  The string should be preceded by a zero byte.
 50477  func test_prepare_tkt3134(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4616:26: */
 50478  	bp := tls.Alloc(138)
 50479  	defer tls.Free(138)
 50480  
 50481  	// var db uintptr at bp+80, 4
 50482  
 50483  	*(*uintptr)(unsafe.Pointer(bp + 84 /* pStmt */)) = uintptr(0)
 50484  	// var zBuf [50]int8 at bp+88, 50
 50485  
 50486  	var rc int32
 50487  
 50488  	if objc != 2 {
 50489  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50490  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 50491  		return TCL_ERROR
 50492  	}
 50493  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+80 /* &db */) != 0 {
 50494  		return TCL_ERROR
 50495  	}
 50496  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), (uintptr(unsafe.Pointer(&zSql)) + 1), 0, bp+84 /* &pStmt */, uintptr(0))
 50497  
 50498  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), rc) != 0 {
 50499  		return TCL_ERROR
 50500  	}
 50501  	if rc != SQLITE_OK {
 50502  
 50503  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+88 /* &zBuf[0] */, ts+16948 /* "(%d) " */, libc.VaList(bp+32, rc))
 50504  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+88 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 50505  		return TCL_ERROR
 50506  	}
 50507  
 50508  	if *(*uintptr)(unsafe.Pointer(bp + 84 /* pStmt */)) != 0 {
 50509  		if sqlite3TestMakePointerStr(tls, interp, bp+88 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 84 /* pStmt */))) != 0 {
 50510  			return TCL_ERROR
 50511  		}
 50512  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+88 /* &zBuf[0] */, 0))
 50513  	}
 50514  	return TCL_OK
 50515  }
 50516  
 50517  var zSql = *(*[10]int8)(unsafe.Pointer(ts + 17514 /* "\x00SELECT 1" */)) /* test1.c:4623:21 */
 50518  
 50519  // Usage: sqlite3_prepare16 DB sql bytes tailvar
 50520  //
 50521  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 50522  // database handle <DB>. The parameter <tailval> is the name of a global
 50523  // variable that is set to the unused portion of <sql> (if any). A
 50524  // STMT handle is returned.
 50525  func test_prepare16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4659:26: */
 50526  	bp := tls.Alloc(118)
 50527  	defer tls.Free(118)
 50528  
 50529  	// var db uintptr at bp+48, 4
 50530  
 50531  	var zSql uintptr
 50532  	*(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)) = uintptr(0)
 50533  	var pTail uintptr = uintptr(0)
 50534  	*(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)) = uintptr(0)
 50535  	// var zBuf [50]int8 at bp+68, 50
 50536  
 50537  	var rc int32
 50538  	// var bytes int32 at bp+56, 4
 50539  	// The integer specified as arg 3
 50540  	// var objlen int32 at bp+52, 4
 50541  	// The byte-array length of arg 2
 50542  
 50543  	if (objc != 5) && (objc != 4) {
 50544  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50545  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 50546  		return TCL_ERROR
 50547  	}
 50548  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 50549  		return TCL_ERROR
 50550  	}
 50551  	zSql = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+52 /* &objlen */)
 50552  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+56 /* &bytes */) != 0 {
 50553  		return TCL_ERROR
 50554  	}
 50555  
 50556  	rc = sqlite3.Xsqlite3_prepare16(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 56 /* bytes */)), bp+60 /* &pStmt */, func() uintptr {
 50557  		if objc >= 5 {
 50558  			return bp + 64 /* &zTail */
 50559  		}
 50560  		return uintptr(0)
 50561  	}())
 50562  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 50563  		return TCL_ERROR
 50564  	}
 50565  	if rc != 0 {
 50566  		return TCL_ERROR
 50567  	}
 50568  
 50569  	if objc >= 5 {
 50570  		if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)) != 0 {
 50571  			*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) = (*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */))) - int32(zSql)) / 1))
 50572  		} else {
 50573  			*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) = 0
 50574  		}
 50575  		pTail = tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 52 /* objlen */)))
 50576  		(*Tcl_Obj)(unsafe.Pointer(pTail)).FrefCount++
 50577  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0), pTail, 0)
 50578  		for ok := true; ok; ok = 0 != 0 {
 50579  			var _objPtr uintptr = pTail
 50580  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 50581  				tcl.XTclFreeObj(tls, _objPtr)
 50582  			}
 50583  		}
 50584  	}
 50585  
 50586  	if *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)) != 0 {
 50587  		if sqlite3TestMakePointerStr(tls, interp, bp+68 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */))) != 0 {
 50588  			return TCL_ERROR
 50589  		}
 50590  	}
 50591  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+68 /* &zBuf[0] */, 0))
 50592  	return TCL_OK
 50593  }
 50594  
 50595  // Usage: sqlite3_prepare16_v2 DB sql bytes ?tailvar?
 50596  //
 50597  // Compile up to <bytes> bytes of the supplied SQL string <sql> using
 50598  // database handle <DB>. The parameter <tailval> is the name of a global
 50599  // variable that is set to the unused portion of <sql> (if any). A
 50600  // STMT handle is returned.
 50601  func test_prepare16_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4719:26: */
 50602  	bp := tls.Alloc(118)
 50603  	defer tls.Free(118)
 50604  
 50605  	// var db uintptr at bp+48, 4
 50606  
 50607  	var zSql uintptr
 50608  	*(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)) = uintptr(0)
 50609  	var pTail uintptr = uintptr(0)
 50610  	*(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)) = uintptr(0)
 50611  	// var zBuf [50]int8 at bp+68, 50
 50612  
 50613  	var rc int32
 50614  	// var bytes int32 at bp+56, 4
 50615  	// The integer specified as arg 3
 50616  	// var objlen int32 at bp+52, 4
 50617  	// The byte-array length of arg 2
 50618  
 50619  	if (objc != 5) && (objc != 4) {
 50620  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50621  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17440 /* " DB sql bytes ?t..." */, 0))
 50622  		return TCL_ERROR
 50623  	}
 50624  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 50625  		return TCL_ERROR
 50626  	}
 50627  	zSql = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+52 /* &objlen */)
 50628  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+56 /* &bytes */) != 0 {
 50629  		return TCL_ERROR
 50630  	}
 50631  
 50632  	rc = sqlite3.Xsqlite3_prepare16_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 56 /* bytes */)), bp+60 /* &pStmt */, func() uintptr {
 50633  		if objc >= 5 {
 50634  			return bp + 64 /* &zTail */
 50635  		}
 50636  		return uintptr(0)
 50637  	}())
 50638  	if sqlite3TestErrCode(tls, interp, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), rc) != 0 {
 50639  		return TCL_ERROR
 50640  	}
 50641  	if rc != 0 {
 50642  		return TCL_ERROR
 50643  	}
 50644  
 50645  	if objc >= 5 {
 50646  		if *(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)) != 0 {
 50647  			*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) = (*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */))) - int32(zSql)) / 1))
 50648  		} else {
 50649  			*(*int32)(unsafe.Pointer(bp + 52 /* objlen */)) = 0
 50650  		}
 50651  		pTail = tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 52 /* objlen */)))
 50652  		(*Tcl_Obj)(unsafe.Pointer(pTail)).FrefCount++
 50653  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0), pTail, 0)
 50654  		for ok := true; ok; ok = 0 != 0 {
 50655  			var _objPtr uintptr = pTail
 50656  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 50657  				tcl.XTclFreeObj(tls, _objPtr)
 50658  			}
 50659  		}
 50660  	}
 50661  
 50662  	if *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */)) != 0 {
 50663  		if sqlite3TestMakePointerStr(tls, interp, bp+68 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 60 /* pStmt */))) != 0 {
 50664  			return TCL_ERROR
 50665  		}
 50666  	}
 50667  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+68 /* &zBuf[0] */, 0))
 50668  	return TCL_OK
 50669  }
 50670  
 50671  // Usage: sqlite3_open filename ?options-list?
 50672  func test_open(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4774:26: */
 50673  	bp := tls.Alloc(152)
 50674  	defer tls.Free(152)
 50675  
 50676  	var zFilename uintptr
 50677  	// var db uintptr at bp+48, 4
 50678  
 50679  	// var zBuf [100]int8 at bp+52, 100
 50680  
 50681  	if ((objc != 3) && (objc != 2)) && (objc != 1) {
 50682  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50683  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17524 /* " filename option..." */, 0))
 50684  		return TCL_ERROR
 50685  	}
 50686  
 50687  	if objc > 1 {
 50688  		zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 50689  	} else {
 50690  		zFilename = uintptr(0)
 50691  	}
 50692  	sqlite3.Xsqlite3_open(tls, zFilename, bp+48 /* &db */)
 50693  
 50694  	if sqlite3TestMakePointerStr(tls, interp, bp+52 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))) != 0 {
 50695  		return TCL_ERROR
 50696  	}
 50697  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+52 /* &zBuf[0] */, 0))
 50698  	return TCL_OK
 50699  }
 50700  
 50701  // Usage: sqlite3_open_v2 FILENAME FLAGS VFS
 50702  func test_open_v2(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4801:26: */
 50703  	bp := tls.Alloc(292)
 50704  	defer tls.Free(292)
 50705  
 50706  	var zFilename uintptr
 50707  	var zVfs uintptr
 50708  	var flags int32 = 0
 50709  	// var db uintptr at bp+188, 4
 50710  
 50711  	var rc int32
 50712  	// var zBuf [100]int8 at bp+192, 100
 50713  
 50714  	// var nFlag int32 at bp+16, 4
 50715  
 50716  	// var apFlag uintptr at bp+20, 4
 50717  
 50718  	var i int32
 50719  
 50720  	if objc != 4 {
 50721  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17547 /* "FILENAME FLAGS V..." */)
 50722  		return TCL_ERROR
 50723  	}
 50724  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 50725  	zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 50726  	if int32(*(*int8)(unsafe.Pointer(zVfs))) == 0x00 {
 50727  		zVfs = uintptr(0)
 50728  	}
 50729  
 50730  	rc = tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &nFlag */, bp+20 /* &apFlag */)
 50731  	if rc != TCL_OK {
 50732  		return rc
 50733  	}
 50734  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 16 /* nFlag */)); i++ {
 50735  		// var iFlag int32 at bp+184, 4
 50736  
 50737  		*(*[20]OpenFlag)(unsafe.Pointer(bp + 24 /* aFlag */)) = [20]OpenFlag{
 50738  			{FzFlag: ts + 17566 /* "SQLITE_OPEN_READ..." */, Fflag: SQLITE_OPEN_READONLY},
 50739  			{FzFlag: ts + 17587 /* "SQLITE_OPEN_READ..." */, Fflag: SQLITE_OPEN_READWRITE},
 50740  			{FzFlag: ts + 17609 /* "SQLITE_OPEN_CREA..." */, Fflag: SQLITE_OPEN_CREATE},
 50741  			{FzFlag: ts + 17628 /* "SQLITE_OPEN_DELE..." */, Fflag: SQLITE_OPEN_DELETEONCLOSE},
 50742  			{FzFlag: ts + 17654 /* "SQLITE_OPEN_EXCL..." */, Fflag: SQLITE_OPEN_EXCLUSIVE},
 50743  			{FzFlag: ts + 17676 /* "SQLITE_OPEN_AUTO..." */, Fflag: SQLITE_OPEN_AUTOPROXY},
 50744  			{FzFlag: ts + 17698 /* "SQLITE_OPEN_MAIN..." */, Fflag: SQLITE_OPEN_MAIN_DB},
 50745  			{FzFlag: ts + 17718 /* "SQLITE_OPEN_TEMP..." */, Fflag: SQLITE_OPEN_TEMP_DB},
 50746  			{FzFlag: ts + 17738 /* "SQLITE_OPEN_TRAN..." */, Fflag: SQLITE_OPEN_TRANSIENT_DB},
 50747  			{FzFlag: ts + 17763 /* "SQLITE_OPEN_MAIN..." */, Fflag: SQLITE_OPEN_MAIN_JOURNAL},
 50748  			{FzFlag: ts + 17788 /* "SQLITE_OPEN_TEMP..." */, Fflag: SQLITE_OPEN_TEMP_JOURNAL},
 50749  			{FzFlag: ts + 17813 /* "SQLITE_OPEN_SUBJ..." */, Fflag: SQLITE_OPEN_SUBJOURNAL},
 50750  			{FzFlag: ts + 17836 /* "SQLITE_OPEN_SUPE..." */, Fflag: SQLITE_OPEN_SUPER_JOURNAL},
 50751  			{FzFlag: ts + 17862 /* "SQLITE_OPEN_NOMU..." */, Fflag: SQLITE_OPEN_NOMUTEX},
 50752  			{FzFlag: ts + 17882 /* "SQLITE_OPEN_FULL..." */, Fflag: SQLITE_OPEN_FULLMUTEX},
 50753  			{FzFlag: ts + 17904 /* "SQLITE_OPEN_SHAR..." */, Fflag: SQLITE_OPEN_SHAREDCACHE},
 50754  			{FzFlag: ts + 17928 /* "SQLITE_OPEN_PRIV..." */, Fflag: SQLITE_OPEN_PRIVATECACHE},
 50755  			{FzFlag: ts + 17953 /* "SQLITE_OPEN_WAL" */, Fflag: SQLITE_OPEN_WAL},
 50756  			{FzFlag: ts + 17969 /* "SQLITE_OPEN_URI" */, Fflag: SQLITE_OPEN_URI},
 50757  			{},
 50758  		}
 50759  		rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* apFlag */)) + uintptr(i)*4)), bp+24 /* &aFlag[0] */, int32(unsafe.Sizeof(OpenFlag{})),
 50760  			ts+17985 /* "flag" */, 0, bp+184 /* &iFlag */)
 50761  		if rc != TCL_OK {
 50762  			return rc
 50763  		}
 50764  		flags = flags | ((*OpenFlag)(unsafe.Pointer(bp + 24 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 184 /* iFlag */)))*8)).Fflag)
 50765  	}
 50766  
 50767  	rc = sqlite3.Xsqlite3_open_v2(tls, zFilename, bp+188 /* &db */, flags, zVfs)
 50768  	if sqlite3TestMakePointerStr(tls, interp, bp+192 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 188 /* db */))) != 0 {
 50769  		return TCL_ERROR
 50770  	}
 50771  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+192 /* &zBuf[0] */, 0))
 50772  	return TCL_OK
 50773  }
 50774  
 50775  type OpenFlag = struct {
 50776  	FzFlag uintptr
 50777  	Fflag  int32
 50778  } /* test1.c:4830:5 */
 50779  
 50780  // Usage: sqlite3_open16 filename options
 50781  func test_open16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4871:26: */
 50782  	bp := tls.Alloc(152)
 50783  	defer tls.Free(152)
 50784  
 50785  	var zFilename uintptr
 50786  	// var db uintptr at bp+48, 4
 50787  
 50788  	// var zBuf [100]int8 at bp+52, 100
 50789  
 50790  	if objc != 3 {
 50791  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50792  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17524 /* " filename option..." */, 0))
 50793  		return TCL_ERROR
 50794  	}
 50795  
 50796  	zFilename = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(0))
 50797  	sqlite3.Xsqlite3_open16(tls, zFilename, bp+48 /* &db */)
 50798  
 50799  	if sqlite3TestMakePointerStr(tls, interp, bp+52 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */))) != 0 {
 50800  		return TCL_ERROR
 50801  	}
 50802  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+52 /* &zBuf[0] */, 0))
 50803  	return TCL_OK
 50804  }
 50805  
 50806  // Usage: sqlite3_complete16 <UTF-16 string>
 50807  //
 50808  // Return 1 if the supplied argument is a complete SQL statement, or zero
 50809  // otherwise.
 50810  func test_complete16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4903:26: */
 50811  	var zBuf uintptr
 50812  
 50813  	if objc != 2 {
 50814  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17990 /* "<utf-16 sql>" */)
 50815  		return TCL_ERROR
 50816  	}
 50817  
 50818  	zBuf = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(0))
 50819  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_complete16(tls, zBuf)))
 50820  	return TCL_OK
 50821  }
 50822  
 50823  // Usage: sqlite3_normalize SQL
 50824  //
 50825  // Return the normalized value for an SQL statement.
 50826  func test_normalize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4928:26: */
 50827  	var zSql uintptr
 50828  	var zNorm uintptr
 50829  
 50830  	if objc != 2 {
 50831  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10170 /* "SQL" */)
 50832  		return TCL_ERROR
 50833  	}
 50834  
 50835  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 50836  	zNorm = sqlite3_normalize(tls, zSql)
 50837  	if zNorm != 0 {
 50838  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zNorm, -1))
 50839  		sqlite3.Xsqlite3_free(tls, zNorm)
 50840  	}
 50841  	return TCL_OK
 50842  }
 50843  
 50844  // Usage: sqlite3_step STMT
 50845  //
 50846  // Advance the statement to the next row.
 50847  func test_step(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4957:26: */
 50848  	bp := tls.Alloc(36)
 50849  	defer tls.Free(36)
 50850  
 50851  	// var pStmt uintptr at bp+32, 4
 50852  
 50853  	var rc int32
 50854  
 50855  	if objc != 2 {
 50856  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50857  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+16787 /* " STMT" */, 0))
 50858  		return TCL_ERROR
 50859  	}
 50860  
 50861  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 50862  		return TCL_ERROR
 50863  	}
 50864  	rc = sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))
 50865  
 50866  	// if( rc!=SQLITE_DONE && rc!=SQLITE_ROW ) return TCL_ERROR;
 50867  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 50868  	return TCL_OK
 50869  }
 50870  
 50871  func test_sql(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4980:26: */
 50872  	bp := tls.Alloc(4)
 50873  	defer tls.Free(4)
 50874  
 50875  	// var pStmt uintptr at bp, 4
 50876  
 50877  	if objc != 2 {
 50878  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 50879  		return TCL_ERROR
 50880  	}
 50881  
 50882  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50883  		return TCL_ERROR
 50884  	}
 50885  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))), uintptr(1))
 50886  	return TCL_OK
 50887  }
 50888  
 50889  func test_ex_sql(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:4997:26: */
 50890  	bp := tls.Alloc(4)
 50891  	defer tls.Free(4)
 50892  
 50893  	// var pStmt uintptr at bp, 4
 50894  
 50895  	var z uintptr
 50896  
 50897  	if objc != 2 {
 50898  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 50899  		return TCL_ERROR
 50900  	}
 50901  
 50902  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 50903  		return TCL_ERROR
 50904  	}
 50905  	z = sqlite3.Xsqlite3_expanded_sql(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 50906  	tcl.XTcl_SetResult(tls, interp, z, uintptr(1))
 50907  	sqlite3.Xsqlite3_free(tls, z)
 50908  	return TCL_OK
 50909  }
 50910  
 50911  // Usage: sqlite3_column_count STMT
 50912  //
 50913  // Return the number of columns returned by the sql statement STMT.
 50914  func test_column_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5042:26: */
 50915  	bp := tls.Alloc(36)
 50916  	defer tls.Free(36)
 50917  
 50918  	// var pStmt uintptr at bp+32, 4
 50919  
 50920  	if objc != 2 {
 50921  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50922  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 50923  		return TCL_ERROR
 50924  	}
 50925  
 50926  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 50927  		return TCL_ERROR
 50928  	}
 50929  
 50930  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))))
 50931  	return TCL_OK
 50932  }
 50933  
 50934  // Usage: sqlite3_column_type STMT column
 50935  //
 50936  // Return the type of the data in column 'column' of the current row.
 50937  func test_column_type(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5067:26: */
 50938  	bp := tls.Alloc(40)
 50939  	defer tls.Free(40)
 50940  
 50941  	// var pStmt uintptr at bp+32, 4
 50942  
 50943  	// var col int32 at bp+36, 4
 50944  
 50945  	var tp int32
 50946  
 50947  	if objc != 3 {
 50948  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 50949  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 50950  		return TCL_ERROR
 50951  	}
 50952  
 50953  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 50954  		return TCL_ERROR
 50955  	}
 50956  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 50957  		return TCL_ERROR
 50958  	}
 50959  
 50960  	tp = sqlite3.Xsqlite3_column_type(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 50961  	switch tp {
 50962  	case SQLITE_INTEGER:
 50963  		tcl.XTcl_SetResult(tls, interp, ts+2274 /* "INTEGER" */, uintptr(0))
 50964  		break
 50965  	case SQLITE_NULL:
 50966  		tcl.XTcl_SetResult(tls, interp, ts+5707 /* "NULL" */, uintptr(0))
 50967  		break
 50968  	case SQLITE_FLOAT:
 50969  		tcl.XTcl_SetResult(tls, interp, ts+18016 /* "FLOAT" */, uintptr(0))
 50970  		break
 50971  	case SQLITE_TEXT:
 50972  		tcl.XTcl_SetResult(tls, interp, ts+18022 /* "TEXT" */, uintptr(0))
 50973  		break
 50974  	case SQLITE_BLOB:
 50975  		tcl.XTcl_SetResult(tls, interp, ts+18027 /* "BLOB" */, uintptr(0))
 50976  		break
 50977  	default:
 50978  
 50979  	}
 50980  
 50981  	return TCL_OK
 50982  }
 50983  
 50984  // Usage: sqlite3_column_int64 STMT column
 50985  //
 50986  // Return the data in column 'column' of the current row cast as an
 50987  // wide (64-bit) integer.
 50988  func test_column_int64(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5116:26: */
 50989  	bp := tls.Alloc(40)
 50990  	defer tls.Free(40)
 50991  
 50992  	// var pStmt uintptr at bp+32, 4
 50993  
 50994  	// var col int32 at bp+36, 4
 50995  
 50996  	var iVal i64
 50997  
 50998  	if objc != 3 {
 50999  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51000  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51001  		return TCL_ERROR
 51002  	}
 51003  
 51004  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51005  		return TCL_ERROR
 51006  	}
 51007  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51008  		return TCL_ERROR
 51009  	}
 51010  
 51011  	iVal = sqlite3.Xsqlite3_column_int64(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51012  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, iVal))
 51013  	return TCL_OK
 51014  }
 51015  
 51016  // Usage: sqlite3_column_blob STMT column
 51017  func test_column_blob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5143:26: */
 51018  	bp := tls.Alloc(40)
 51019  	defer tls.Free(40)
 51020  
 51021  	// var pStmt uintptr at bp+32, 4
 51022  
 51023  	// var col int32 at bp+36, 4
 51024  
 51025  	var len int32
 51026  	var pBlob uintptr
 51027  
 51028  	if objc != 3 {
 51029  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51030  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51031  		return TCL_ERROR
 51032  	}
 51033  
 51034  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51035  		return TCL_ERROR
 51036  	}
 51037  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51038  		return TCL_ERROR
 51039  	}
 51040  
 51041  	len = sqlite3.Xsqlite3_column_bytes(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51042  	pBlob = sqlite3.Xsqlite3_column_blob(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51043  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, pBlob, len))
 51044  	return TCL_OK
 51045  }
 51046  
 51047  // Usage: sqlite3_column_double STMT column
 51048  //
 51049  // Return the data in column 'column' of the current row cast as a double.
 51050  func test_column_double(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5175:26: */
 51051  	bp := tls.Alloc(40)
 51052  	defer tls.Free(40)
 51053  
 51054  	// var pStmt uintptr at bp+32, 4
 51055  
 51056  	// var col int32 at bp+36, 4
 51057  
 51058  	var rVal float64
 51059  
 51060  	if objc != 3 {
 51061  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51062  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51063  		return TCL_ERROR
 51064  	}
 51065  
 51066  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51067  		return TCL_ERROR
 51068  	}
 51069  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51070  		return TCL_ERROR
 51071  	}
 51072  
 51073  	rVal = sqlite3.Xsqlite3_column_double(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51074  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewDoubleObj(tls, rVal))
 51075  	return TCL_OK
 51076  }
 51077  
 51078  // Usage: sqlite3_data_count STMT
 51079  //
 51080  // Return the number of columns returned by the sql statement STMT.
 51081  func test_data_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5204:26: */
 51082  	bp := tls.Alloc(36)
 51083  	defer tls.Free(36)
 51084  
 51085  	// var pStmt uintptr at bp+32, 4
 51086  
 51087  	if objc != 2 {
 51088  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51089  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51090  		return TCL_ERROR
 51091  	}
 51092  
 51093  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51094  		return TCL_ERROR
 51095  	}
 51096  
 51097  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_data_count(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)))))
 51098  	return TCL_OK
 51099  }
 51100  
 51101  // Usage: sqlite3_column_text STMT column
 51102  //
 51103  // Usage: sqlite3_column_decltype STMT column
 51104  //
 51105  // Usage: sqlite3_column_name STMT column
 51106  func test_stmt_utf8(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5231:26: */
 51107  	bp := tls.Alloc(40)
 51108  	defer tls.Free(40)
 51109  
 51110  	// var pStmt uintptr at bp+32, 4
 51111  
 51112  	// var col int32 at bp+36, 4
 51113  
 51114  	var xFunc uintptr
 51115  	var zRet uintptr
 51116  
 51117  	xFunc = clientData
 51118  	if objc != 3 {
 51119  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51120  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51121  		return TCL_ERROR
 51122  	}
 51123  
 51124  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51125  		return TCL_ERROR
 51126  	}
 51127  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51128  		return TCL_ERROR
 51129  	}
 51130  	zRet = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&xFunc)))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51131  	if zRet != 0 {
 51132  		tcl.XTcl_SetResult(tls, interp, zRet, uintptr(0))
 51133  	}
 51134  	return TCL_OK
 51135  }
 51136  
 51137  func test_global_recover(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5258:26: */
 51138  	var rc int32
 51139  	if objc != 1 {
 51140  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 51141  		return TCL_ERROR
 51142  	}
 51143  	rc = sqlite3.Xsqlite3_global_recover(tls)
 51144  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51145  	return TCL_OK
 51146  }
 51147  
 51148  // Usage: sqlite3_column_text STMT column
 51149  //
 51150  // Usage: sqlite3_column_decltype STMT column
 51151  //
 51152  // Usage: sqlite3_column_name STMT column
 51153  func test_stmt_utf16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5283:26: */
 51154  	bp := tls.Alloc(40)
 51155  	defer tls.Free(40)
 51156  
 51157  	// var pStmt uintptr at bp+32, 4
 51158  
 51159  	// var col int32 at bp+36, 4
 51160  
 51161  	var pRet uintptr
 51162  	var zName16 uintptr
 51163  	var xFunc uintptr
 51164  
 51165  	xFunc = clientData
 51166  	if objc != 3 {
 51167  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51168  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51169  		return TCL_ERROR
 51170  	}
 51171  
 51172  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51173  		return TCL_ERROR
 51174  	}
 51175  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51176  		return TCL_ERROR
 51177  	}
 51178  
 51179  	zName16 = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer(&xFunc)))(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* pStmt */)), *(*int32)(unsafe.Pointer(bp + 36 /* col */)))
 51180  	if zName16 != 0 {
 51181  		var n int32
 51182  		var z uintptr = zName16
 51183  		for n = 0; (*(*int8)(unsafe.Pointer(z + uintptr(n))) != 0) || (*(*int8)(unsafe.Pointer(z + uintptr((n + 1)))) != 0); n = n + (2) {
 51184  		}
 51185  		pRet = tcl.XTcl_NewByteArrayObj(tls, zName16, (n + 2))
 51186  		tcl.XTcl_SetObjResult(tls, interp, pRet)
 51187  	}
 51188  
 51189  	return TCL_OK
 51190  }
 51191  
 51192  // Usage: sqlite3_column_int STMT column
 51193  //
 51194  // Usage: sqlite3_column_bytes STMT column
 51195  //
 51196  // Usage: sqlite3_column_bytes16 STMT column
 51197  //
 51198  func test_stmt_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5327:26: */
 51199  	bp := tls.Alloc(40)
 51200  	defer tls.Free(40)
 51201  
 51202  	// var pStmt uintptr at bp+32, 4
 51203  
 51204  	// var col int32 at bp+36, 4
 51205  
 51206  	var xFunc uintptr
 51207  
 51208  	xFunc = clientData
 51209  	if objc != 3 {
 51210  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51211  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+18003 /* " STMT column" */, 0))
 51212  		return TCL_ERROR
 51213  	}
 51214  
 51215  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &pStmt */) != 0 {
 51216  		return TCL_ERROR
 51217  	}
 51218  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &col */) != 0 {
 51219  		return TCL_ERROR
 51220  	}
 51221  
 51222  	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 + 36 /* col */)))))
 51223  	return TCL_OK
 51224  }
 51225  
 51226  // Usage:  sqlite_set_magic  DB  MAGIC-NUMBER
 51227  //
 51228  // Set the db->magic value.  This is used to test error recovery logic.
 51229  func sqlite_set_magic(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5356:26: */
 51230  	bp := tls.Alloc(36)
 51231  	defer tls.Free(36)
 51232  
 51233  	// var db uintptr at bp+32, 4
 51234  
 51235  	if argc != 3 {
 51236  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 51237  			ts+18032 /* " DB MAGIC" */, 0))
 51238  		return TCL_ERROR
 51239  	}
 51240  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 51241  		return TCL_ERROR
 51242  	}
 51243  	if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+18042 /* "SQLITE_MAGIC_OPE..." */) == 0 {
 51244  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_OPEN
 51245  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+18060 /* "SQLITE_MAGIC_CLO..." */) == 0 {
 51246  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_CLOSED
 51247  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+18080 /* "SQLITE_MAGIC_BUS..." */) == 0 {
 51248  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_BUSY
 51249  	} else if libc.Xstrcmp(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ts+18098 /* "SQLITE_MAGIC_ERR..." */) == 0 {
 51250  		(*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmagic = SQLITE_MAGIC_ERROR
 51251  	} else if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), (*(*uintptr)(unsafe.Pointer(bp + 32 /* db */))+100 /* &.magic */)) != 0 {
 51252  		return TCL_ERROR
 51253  	}
 51254  	return TCL_OK
 51255  }
 51256  
 51257  // Usage:  sqlite3_interrupt  DB
 51258  //
 51259  // Trigger an interrupt on DB
 51260  func test_interrupt(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5388:26: */
 51261  	bp := tls.Alloc(36)
 51262  	defer tls.Free(36)
 51263  
 51264  	// var db uintptr at bp+32, 4
 51265  
 51266  	if argc != 2 {
 51267  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+15462 /* " DB" */, 0))
 51268  		return TCL_ERROR
 51269  	}
 51270  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 51271  		return TCL_ERROR
 51272  	}
 51273  	sqlite3.Xsqlite3_interrupt(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))
 51274  	return TCL_OK
 51275  }
 51276  
 51277  // Usage: sqlite_delete_function DB function-name
 51278  //
 51279  // Delete the user function 'function-name' from database handle DB. It
 51280  // is assumed that the user function was created as UTF8, any number of
 51281  // arguments (the way the TCL interface does it).
 51282  func delete_function(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5411:26: */
 51283  	bp := tls.Alloc(36)
 51284  	defer tls.Free(36)
 51285  
 51286  	var rc int32
 51287  	// var db uintptr at bp+32, 4
 51288  
 51289  	if argc != 3 {
 51290  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 51291  			ts+18117 /* " DB function-nam..." */, 0))
 51292  		return TCL_ERROR
 51293  	}
 51294  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 51295  		return TCL_ERROR
 51296  	}
 51297  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), -1, SQLITE_UTF8, uintptr(0), uintptr(0), uintptr(0), uintptr(0))
 51298  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51299  	return TCL_OK
 51300  }
 51301  
 51302  // Usage: sqlite_delete_collation DB collation-name
 51303  //
 51304  // Delete the collation sequence 'collation-name' from database handle
 51305  // DB. It is assumed that the collation sequence was created as UTF8 (the
 51306  // way the TCL interface does it).
 51307  func delete_collation(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5437:26: */
 51308  	bp := tls.Alloc(36)
 51309  	defer tls.Free(36)
 51310  
 51311  	var rc int32
 51312  	// var db uintptr at bp+32, 4
 51313  
 51314  	if argc != 3 {
 51315  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 51316  			ts+18117 /* " DB function-nam..." */, 0))
 51317  		return TCL_ERROR
 51318  	}
 51319  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+32 /* &db */) != 0 {
 51320  		return TCL_ERROR
 51321  	}
 51322  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), *(*uintptr)(unsafe.Pointer(argv + 2*4)), SQLITE_UTF8, uintptr(0), uintptr(0))
 51323  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51324  	return TCL_OK
 51325  }
 51326  
 51327  // Usage: sqlite3_get_autocommit DB
 51328  //
 51329  // Return true if the database DB is currently in auto-commit mode.
 51330  // Return false if not.
 51331  func get_autocommit(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5462:26: */
 51332  	bp := tls.Alloc(90)
 51333  	defer tls.Free(90)
 51334  
 51335  	// var zBuf [30]int8 at bp+60, 30
 51336  
 51337  	// var db uintptr at bp+56, 4
 51338  
 51339  	if argc != 2 {
 51340  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 51341  			ts+15462 /* " DB" */, 0))
 51342  		return TCL_ERROR
 51343  	}
 51344  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+56 /* &db */) != 0 {
 51345  		return TCL_ERROR
 51346  	}
 51347  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+60 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, sqlite3.Xsqlite3_get_autocommit(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)))))
 51348  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 51349  	return TCL_OK
 51350  }
 51351  
 51352  // Usage: sqlite3_busy_timeout DB MS
 51353  //
 51354  // Set the busy timeout.  This is more easily done using the timeout
 51355  // method of the TCL interface.  But we need a way to test the case
 51356  // where it returns SQLITE_MISUSE.
 51357  func test_busy_timeout(tls *libc.TLS, clientData uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test1.c:5488:26: */
 51358  	bp := tls.Alloc(56)
 51359  	defer tls.Free(56)
 51360  
 51361  	var rc int32
 51362  	// var ms int32 at bp+52, 4
 51363  
 51364  	// var db uintptr at bp+48, 4
 51365  
 51366  	if argc != 3 {
 51367  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 51368  			ts+15462 /* " DB" */, 0))
 51369  		return TCL_ERROR
 51370  	}
 51371  	if getDbPointer(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+48 /* &db */) != 0 {
 51372  		return TCL_ERROR
 51373  	}
 51374  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+52 /* &ms */) != 0 {
 51375  		return TCL_ERROR
 51376  	}
 51377  	rc = sqlite3.Xsqlite3_busy_timeout(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), *(*int32)(unsafe.Pointer(bp + 52 /* ms */)))
 51378  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 51379  	return TCL_OK
 51380  }
 51381  
 51382  // Usage:  tcl_variable_type VARIABLENAME
 51383  //
 51384  // Return the name of the internal representation for the
 51385  // value of the given variable.
 51386  func tcl_variable_type(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5514:26: */
 51387  	var pVar uintptr
 51388  	if objc != 2 {
 51389  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18135 /* "VARIABLE" */)
 51390  		return TCL_ERROR
 51391  	}
 51392  	pVar = tcl.XTcl_GetVar2Ex(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0), TCL_LEAVE_ERR_MSG)
 51393  	if pVar == uintptr(0) {
 51394  		return TCL_ERROR
 51395  	}
 51396  	if (*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr != 0 {
 51397  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*Tcl_ObjType)(unsafe.Pointer((*Tcl_Obj)(unsafe.Pointer(pVar)).FtypePtr)).Fname, -1))
 51398  	}
 51399  	return TCL_OK
 51400  }
 51401  
 51402  // Usage:  sqlite3_release_memory ?N?
 51403  //
 51404  // Attempt to release memory currently held but not actually required.
 51405  // The integer N is the number of bytes we are trying to release.  The
 51406  // return value is the amount of memory actually released.
 51407  func test_release_memory(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5540:26: */
 51408  	bp := tls.Alloc(4)
 51409  	defer tls.Free(4)
 51410  
 51411  	// var N int32 at bp, 4
 51412  
 51413  	var amt int32
 51414  	if (objc != 1) && (objc != 2) {
 51415  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 51416  		return TCL_ERROR
 51417  	}
 51418  	if objc == 2 {
 51419  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &N */) != 0 {
 51420  			return TCL_ERROR
 51421  		}
 51422  	} else {
 51423  		*(*int32)(unsafe.Pointer(bp /* N */)) = -1
 51424  	}
 51425  	amt = sqlite3.Xsqlite3_release_memory(tls, *(*int32)(unsafe.Pointer(bp /* N */)))
 51426  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, amt))
 51427  	return TCL_OK
 51428  }
 51429  
 51430  // Usage:  sqlite3_db_release_memory DB
 51431  //
 51432  // Attempt to release memory currently held by database DB.  Return the
 51433  // result code (which in the current implementation is always zero).
 51434  func test_db_release_memory(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5571:26: */
 51435  	bp := tls.Alloc(4)
 51436  	defer tls.Free(4)
 51437  
 51438  	// var db uintptr at bp, 4
 51439  
 51440  	var rc int32
 51441  	if objc != 2 {
 51442  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 51443  		return TCL_ERROR
 51444  	}
 51445  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 51446  		return TCL_ERROR
 51447  	}
 51448  	rc = sqlite3.Xsqlite3_db_release_memory(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 51449  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 51450  	return TCL_OK
 51451  }
 51452  
 51453  // Usage:  sqlite3_db_cacheflush DB
 51454  //
 51455  // Attempt to flush any dirty pages to disk.
 51456  func test_db_cacheflush(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5594:26: */
 51457  	bp := tls.Alloc(4)
 51458  	defer tls.Free(4)
 51459  
 51460  	// var db uintptr at bp, 4
 51461  
 51462  	var rc int32
 51463  	if objc != 2 {
 51464  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 51465  		return TCL_ERROR
 51466  	}
 51467  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 51468  		return TCL_ERROR
 51469  	}
 51470  	rc = sqlite3.Xsqlite3_db_cacheflush(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 51471  	if rc != 0 {
 51472  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrStr(tls, rc), uintptr(0))
 51473  		return TCL_ERROR
 51474  	}
 51475  
 51476  	tcl.XTcl_ResetResult(tls, interp)
 51477  	return TCL_OK
 51478  }
 51479  
 51480  // Usage:  sqlite3_system_errno DB
 51481  //
 51482  // Return the low-level system errno value.
 51483  func test_system_errno(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5622:26: */
 51484  	bp := tls.Alloc(4)
 51485  	defer tls.Free(4)
 51486  
 51487  	// var db uintptr at bp, 4
 51488  
 51489  	var iErrno int32
 51490  	if objc != 2 {
 51491  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 51492  		return TCL_ERROR
 51493  	}
 51494  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 51495  		return TCL_ERROR
 51496  	}
 51497  	iErrno = sqlite3.Xsqlite3_system_errno(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)))
 51498  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iErrno))
 51499  	return TCL_OK
 51500  }
 51501  
 51502  // Usage:  sqlite3_db_filename DB DBNAME
 51503  //
 51504  // Return the name of a file associated with a database.
 51505  func test_db_filename(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5645:26: */
 51506  	bp := tls.Alloc(20)
 51507  	defer tls.Free(20)
 51508  
 51509  	// var db uintptr at bp+16, 4
 51510  
 51511  	var zDbName uintptr
 51512  	if objc != 3 {
 51513  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 51514  		return TCL_ERROR
 51515  	}
 51516  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 51517  		return TCL_ERROR
 51518  	}
 51519  	zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 51520  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3_db_filename(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDbName), uintptr(0)))
 51521  	return TCL_OK
 51522  }
 51523  
 51524  // Usage:  sqlite3_db_readonly DB DBNAME
 51525  //
 51526  // Return 1 or 0 if DBNAME is readonly or not.  Return -1 if DBNAME does
 51527  // not exist.
 51528  func test_db_readonly(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5669:26: */
 51529  	bp := tls.Alloc(4)
 51530  	defer tls.Free(4)
 51531  
 51532  	// var db uintptr at bp, 4
 51533  
 51534  	var zDbName uintptr
 51535  	if objc != 3 {
 51536  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16697 /* "DB DBNAME" */)
 51537  		return TCL_ERROR
 51538  	}
 51539  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 51540  		return TCL_ERROR
 51541  	}
 51542  	zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 51543  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_db_readonly(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbName)))
 51544  	return TCL_OK
 51545  }
 51546  
 51547  // Usage:  sqlite3_soft_heap_limit ?N?
 51548  //
 51549  // Query or set the soft heap limit for the current thread.  The
 51550  // limit is only changed if the N is present.  The previous limit
 51551  // is returned.
 51552  func test_soft_heap_limit(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5694:26: */
 51553  	bp := tls.Alloc(8)
 51554  	defer tls.Free(8)
 51555  
 51556  	var amt sqlite3_int64
 51557  	*(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)) = int64(-1)
 51558  	if (objc != 1) && (objc != 2) {
 51559  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 51560  		return TCL_ERROR
 51561  	}
 51562  	if objc == 2 {
 51563  		if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &N */) != 0 {
 51564  			return TCL_ERROR
 51565  		}
 51566  	}
 51567  	amt = sqlite3.Xsqlite3_soft_heap_limit64(tls, *(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)))
 51568  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, amt))
 51569  	return TCL_OK
 51570  }
 51571  
 51572  // Usage:  sqlite3_hard_heap_limit ?N?
 51573  //
 51574  // Query or set the hard heap limit for the current thread.  The
 51575  // limit is only changed if the N is present.  The previous limit
 51576  // is returned.
 51577  func test_hard_heap_limit(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5721:26: */
 51578  	bp := tls.Alloc(8)
 51579  	defer tls.Free(8)
 51580  
 51581  	var amt sqlite3_int64
 51582  	*(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)) = int64(-1)
 51583  	if (objc != 1) && (objc != 2) {
 51584  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18144 /* "?N?" */)
 51585  		return TCL_ERROR
 51586  	}
 51587  	if objc == 2 {
 51588  		if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &N */) != 0 {
 51589  			return TCL_ERROR
 51590  		}
 51591  	}
 51592  	amt = sqlite3.Xsqlite3_hard_heap_limit64(tls, *(*Tcl_WideInt)(unsafe.Pointer(bp /* N */)))
 51593  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, amt))
 51594  	return TCL_OK
 51595  }
 51596  
 51597  // Usage:   sqlite3_thread_cleanup
 51598  //
 51599  // Call the sqlite3_thread_cleanup API.
 51600  func test_thread_cleanup(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5746:26: */
 51601  	sqlite3.Xsqlite3_thread_cleanup(tls)
 51602  	return TCL_OK
 51603  }
 51604  
 51605  // Usage:   sqlite3_pager_refcounts  DB
 51606  //
 51607  // Return a list of numbers which are the PagerRefcount for all
 51608  // pagers on each database connection.
 51609  func test_pager_refcounts(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5764:26: */
 51610  	bp := tls.Alloc(36)
 51611  	defer tls.Free(36)
 51612  
 51613  	// var db uintptr at bp+32, 4
 51614  
 51615  	var i int32
 51616  	var v int32
 51617  	var a uintptr
 51618  	var pResult uintptr
 51619  
 51620  	if objc != 2 {
 51621  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51622  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 51623  		return TCL_ERROR
 51624  	}
 51625  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 51626  		return TCL_ERROR
 51627  	}
 51628  	pResult = tcl.XTcl_NewObj(tls)
 51629  	for i = 0; i < (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FnDb; i++ {
 51630  		if (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FaDb+uintptr(i)*16)).FpBt == uintptr(0) {
 51631  			v = -1
 51632  		} else {
 51633  			sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 51634  			a = sqlite3.Xsqlite3PagerStats(tls, sqlite3.Xsqlite3BtreePager(tls, (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).FaDb+uintptr(i)*16)).FpBt))
 51635  			v = *(*int32)(unsafe.Pointer(a))
 51636  			sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32 /* db */)))).Fmutex)
 51637  		}
 51638  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, v))
 51639  	}
 51640  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 51641  	return TCL_OK
 51642  }
 51643  
 51644  // tclcmd:   working_64bit_int
 51645  //
 51646  // Some TCL builds (ex: cygwin) do not support 64-bit integers.  This
 51647  // leads to a number of test failures.  The present command checks the
 51648  // TCL build to see whether or not it supports 64-bit integers.  It
 51649  // returns TRUE if it does and FALSE if not.
 51650  //
 51651  // This command is used to warn users that their TCL build is defective
 51652  // and that the errors they are seeing in the test scripts might be
 51653  // a result of their defective TCL rather than problems in SQLite.
 51654  func working_64bit_int(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5810:26: */
 51655  	var pTestObj uintptr
 51656  	var working int32 = 0
 51657  
 51658  	pTestObj = tcl.XTcl_NewWideIntObj(tls, (int64(1000000) * int64(1234567890)))
 51659  	working = (libc.Bool32(libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, pTestObj), ts+18148 /* "1234567890000000" */) == 0))
 51660  	for ok := true; ok; ok = 0 != 0 {
 51661  		var _objPtr uintptr = pTestObj
 51662  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 51663  			tcl.XTclFreeObj(tls, _objPtr)
 51664  		}
 51665  	}
 51666  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((working) != 0))))
 51667  	return TCL_OK
 51668  }
 51669  
 51670  // tclcmd:   vfs_unlink_test
 51671  //
 51672  // This TCL command unregisters the primary VFS and then registers
 51673  // it back again.  This is used to test the ability to register a
 51674  // VFS when none are previously registered, and the ability to
 51675  // unregister the only available VFS.  Ticket #2738
 51676  func vfs_unlink_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5835:26: */
 51677  	bp := tls.Alloc(256)
 51678  	defer tls.Free(256)
 51679  
 51680  	var i int32
 51681  	var pMain uintptr
 51682  	// var apVfs [20]uintptr at bp+176, 80
 51683  
 51684  	// var one sqlite3_vfs at bp, 88
 51685  
 51686  	// var two sqlite3_vfs at bp+88, 88
 51687  
 51688  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(0))                       // Unregister of NULL is harmless
 51689  	(*sqlite3_vfs)(unsafe.Pointer(bp /* &one */)).FzName = ts + 18165      /* "__one" */
 51690  	(*sqlite3_vfs)(unsafe.Pointer(bp + 88 /* &two */)).FzName = ts + 18171 /* "__two" */
 51691  
 51692  	// Calling sqlite3_vfs_register with 2nd argument of 0 does not
 51693  	// change the default VFS
 51694  	pMain = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 51695  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 0)
 51696  
 51697  	sqlite3.Xsqlite3_vfs_register(tls, bp+88 /* &two */, 0)
 51698  
 51699  	// We can find a VFS by its name
 51700  
 51701  	// Calling sqlite_vfs_register with non-zero second parameter changes the
 51702  	// default VFS, even if the 1st parameter is an existig VFS that is
 51703  	// previously registered as the non-default.
 51704  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 1)
 51705  
 51706  	sqlite3.Xsqlite3_vfs_register(tls, bp+88 /* &two */, 1)
 51707  
 51708  	if pMain != 0 {
 51709  		sqlite3.Xsqlite3_vfs_register(tls, pMain, 1)
 51710  
 51711  	}
 51712  
 51713  	// Unlink the default VFS.  Repeat until there are no more VFSes
 51714  	// registered.
 51715  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof([20]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))); i++ {
 51716  		*(*uintptr)(unsafe.Pointer(bp + 176 /* &apVfs[0] */ + uintptr(i)*4)) = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 51717  		if *(*uintptr)(unsafe.Pointer(bp + 176 /* &apVfs[0] */ + uintptr(i)*4)) != 0 {
 51718  
 51719  			sqlite3.Xsqlite3_vfs_unregister(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &apVfs[0] */ + uintptr(i)*4)))
 51720  
 51721  		}
 51722  	}
 51723  
 51724  	// Register the main VFS as non-default (will be made default, since
 51725  	// it'll be the only one in existence).
 51726  	sqlite3.Xsqlite3_vfs_register(tls, pMain, 0)
 51727  
 51728  	// Un-register the main VFS again to restore an empty VFS list
 51729  	sqlite3.Xsqlite3_vfs_unregister(tls, pMain)
 51730  
 51731  	/* Relink all VFSes in reverse order. */
 51732  	for i = (int32((uint32(unsafe.Sizeof([20]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0)))) - uint32(1))); i >= 0; i-- {
 51733  		if *(*uintptr)(unsafe.Pointer(bp + 176 /* &apVfs[0] */ + uintptr(i)*4)) != 0 {
 51734  			sqlite3.Xsqlite3_vfs_register(tls, *(*uintptr)(unsafe.Pointer(bp + 176 /* &apVfs[0] */ + uintptr(i)*4)), 1)
 51735  
 51736  		}
 51737  	}
 51738  
 51739  	// Unregister out sample VFSes.
 51740  	sqlite3.Xsqlite3_vfs_unregister(tls, bp /* &one */)
 51741  	sqlite3.Xsqlite3_vfs_unregister(tls, bp+88 /* &two */)
 51742  
 51743  	// Unregistering a VFS that is not currently registered is harmless
 51744  	sqlite3.Xsqlite3_vfs_unregister(tls, bp /* &one */)
 51745  	sqlite3.Xsqlite3_vfs_unregister(tls, bp+88 /* &two */)
 51746  
 51747  	// We should be left with the original default VFS back as the
 51748  	// original
 51749  
 51750  	return TCL_OK
 51751  }
 51752  
 51753  // tclcmd:   vfs_initfail_test
 51754  //
 51755  // This TCL command attempts to vfs_find and vfs_register when the
 51756  // sqlite3_initialize() interface is failing.  All calls should fail.
 51757  func vfs_initfail_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5937:26: */
 51758  	bp := tls.Alloc(88)
 51759  	defer tls.Free(88)
 51760  
 51761  	// var one sqlite3_vfs at bp, 88
 51762  
 51763  	(*sqlite3_vfs)(unsafe.Pointer(bp /* &one */)).FzName = ts + 18165 /* "__one" */
 51764  
 51765  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 51766  		return TCL_ERROR
 51767  	}
 51768  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 0)
 51769  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 51770  		return TCL_ERROR
 51771  	}
 51772  	sqlite3.Xsqlite3_vfs_register(tls, bp /* &one */, 1)
 51773  	if sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)) != 0 {
 51774  		return TCL_ERROR
 51775  	}
 51776  	return TCL_OK
 51777  }
 51778  
 51779  // Saved VFSes
 51780  var apVfs [20]uintptr /* test1.c:5957:20: */
 51781  var nVfs int32 = 0    /* test1.c:5958:12 */
 51782  
 51783  // tclcmd:   vfs_unregister_all
 51784  //
 51785  // Unregister all VFSes.
 51786  func vfs_unregister_all(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5965:26: */
 51787  	var i int32
 51788  	for i = 0; i < (int32(uint32(unsafe.Sizeof(apVfs)) / uint32(unsafe.Sizeof(uintptr(0))))); i++ {
 51789  		apVfs[i] = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 51790  		if apVfs[i] == uintptr(0) {
 51791  			break
 51792  		}
 51793  		sqlite3.Xsqlite3_vfs_unregister(tls, apVfs[i])
 51794  	}
 51795  	nVfs = i
 51796  	return TCL_OK
 51797  }
 51798  
 51799  // tclcmd:   vfs_reregister_all
 51800  //
 51801  // Restore all VFSes that were removed using vfs_unregister_all. Taking
 51802  // care to put the linked list back together in the same order as it was
 51803  // in before vfs_unregister_all was invoked.
 51804  func vfs_reregister_all(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:5987:26: */
 51805  	var i int32
 51806  	for i = (nVfs - 1); i >= 0; i-- {
 51807  		sqlite3.Xsqlite3_vfs_register(tls, apVfs[i], 1)
 51808  	}
 51809  	return TCL_OK
 51810  }
 51811  
 51812  // tclcmd:   file_control_test DB
 51813  //
 51814  // This TCL command runs the sqlite3_file_control interface and
 51815  // verifies correct operation of the same.
 51816  func file_control_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6007:26: */
 51817  	bp := tls.Alloc(40)
 51818  	defer tls.Free(40)
 51819  
 51820  	*(*int32)(unsafe.Pointer(bp + 36 /* iArg */)) = 0
 51821  	// var db uintptr at bp+32, 4
 51822  
 51823  	var rc int32
 51824  	_ = rc
 51825  
 51826  	if objc != 2 {
 51827  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51828  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 51829  		return TCL_ERROR
 51830  	}
 51831  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 51832  		return TCL_ERROR
 51833  	}
 51834  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), uintptr(0), 0, bp+36 /* &iArg */)
 51835  
 51836  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+18177 /* "notadatabase" */, SQLITE_FCNTL_LOCKSTATE, bp+36 /* &iArg */)
 51837  
 51838  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+85 /* "main" */, -1, bp+36 /* &iArg */)
 51839  
 51840  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), ts+8377 /* "temp" */, -1, bp+36 /* &iArg */)
 51841  
 51842  	return TCL_OK
 51843  }
 51844  
 51845  // tclcmd:   file_control_lasterrno_test DB
 51846  //
 51847  // This TCL command runs the sqlite3_file_control interface and
 51848  // verifies correct operation of the SQLITE_LAST_ERRNO verb.
 51849  func file_control_lasterrno_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6042:26: */
 51850  	bp := tls.Alloc(72)
 51851  	defer tls.Free(72)
 51852  
 51853  	*(*int32)(unsafe.Pointer(bp + 68 /* iArg */)) = 0
 51854  	// var db uintptr at bp+64, 4
 51855  
 51856  	var rc int32
 51857  
 51858  	if objc != 2 {
 51859  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 51860  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+15462 /* " DB" */, 0))
 51861  		return TCL_ERROR
 51862  	}
 51863  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &db */) != 0 {
 51864  		return TCL_ERROR
 51865  	}
 51866  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_LAST_ERRNO, bp+68 /* &iArg */)
 51867  	if rc != 0 {
 51868  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 51869  		return TCL_ERROR
 51870  	}
 51871  	if *(*int32)(unsafe.Pointer(bp + 68 /* iArg */)) != 0 {
 51872  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+18190, /* "Unexpected non-z..." */
 51873  			tcl.XTcl_GetStringFromObj(tls, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 68 /* iArg */))), uintptr(0)), ts+4755 /* " " */, 0))
 51874  		return TCL_ERROR
 51875  	}
 51876  	return TCL_OK
 51877  }
 51878  
 51879  // tclcmd:   file_control_data_version DB DBNAME
 51880  //
 51881  // This TCL command runs the sqlite3_file_control with the
 51882  // SQLITE_FCNTL_DATA_VERSION opcode, returning the result.
 51883  func file_control_data_version(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6079:26: */
 51884  	bp := tls.Alloc(116)
 51885  	defer tls.Free(116)
 51886  
 51887  	// var iVers uint32 at bp+12, 4
 51888  	// data version
 51889  	var zDb uintptr // Db name ("main", "temp" etc.)
 51890  	// var db uintptr at bp+8, 4
 51891  	// Database handle
 51892  	var rc int32 // file_control() return code
 51893  	// var zBuf [100]int8 at bp+16, 100
 51894  
 51895  	if (objc != 3) && (objc != 2) {
 51896  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18218 /* "DB [DBNAME]" */)
 51897  		return TCL_ERROR
 51898  	}
 51899  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+8 /* &db */) != 0 {
 51900  		return TCL_ERROR
 51901  	}
 51902  	if objc == 3 {
 51903  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 51904  	} else {
 51905  		zDb = uintptr(0)
 51906  	}
 51907  
 51908  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), zDb, SQLITE_FCNTL_DATA_VERSION, bp+12 /* &iVers */)
 51909  	if rc != 0 {
 51910  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51911  		return TCL_ERROR
 51912  	} else {
 51913  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+16 /* &zBuf[0] */, ts+18230 /* "%u" */, libc.VaList(bp, *(*uint32)(unsafe.Pointer(bp + 12 /* iVers */))))
 51914  		tcl.XTcl_SetResult(tls, interp, bp+16 /* zBuf */, uintptr(1))
 51915  		return TCL_OK
 51916  	}
 51917  	return int32(0)
 51918  }
 51919  
 51920  // tclcmd:   file_control_chunksize_test DB DBNAME SIZE
 51921  //
 51922  // This TCL command runs the sqlite3_file_control interface and
 51923  // verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and
 51924  // SQLITE_SET_LOCKPROXYFILE verbs.
 51925  func file_control_chunksize_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6118:26: */
 51926  	bp := tls.Alloc(8)
 51927  	defer tls.Free(8)
 51928  
 51929  	// var nSize int32 at bp+4, 4
 51930  	// New chunk size
 51931  	var zDb uintptr // Db name ("main", "temp" etc.)
 51932  	// var db uintptr at bp, 4
 51933  	// Database handle
 51934  	var rc int32 // file_control() return code
 51935  
 51936  	if objc != 4 {
 51937  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18233 /* "DB DBNAME SIZE" */)
 51938  		return TCL_ERROR
 51939  	}
 51940  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) ||
 51941  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &nSize */) != 0) {
 51942  		return TCL_ERROR
 51943  	}
 51944  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 51945  	if int32(*(*int8)(unsafe.Pointer(zDb))) == 0 {
 51946  		zDb = uintptr(0)
 51947  	}
 51948  
 51949  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb, SQLITE_FCNTL_CHUNK_SIZE, bp+4 /* &nSize */)
 51950  	if rc != 0 {
 51951  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51952  		return TCL_ERROR
 51953  	}
 51954  	return TCL_OK
 51955  }
 51956  
 51957  // tclcmd:   file_control_sizehint_test DB DBNAME SIZE
 51958  //
 51959  // This TCL command runs the sqlite3_file_control interface
 51960  // with SQLITE_FCNTL_SIZE_HINT
 51961  func file_control_sizehint_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6155:26: */
 51962  	bp := tls.Alloc(16)
 51963  	defer tls.Free(16)
 51964  
 51965  	// var nSize Tcl_WideInt at bp+8, 8
 51966  	// Hinted size
 51967  	var zDb uintptr // Db name ("main", "temp" etc.)
 51968  	// var db uintptr at bp, 4
 51969  	// Database handle
 51970  	var rc int32 // file_control() return code
 51971  
 51972  	if objc != 4 {
 51973  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18233 /* "DB DBNAME SIZE" */)
 51974  		return TCL_ERROR
 51975  	}
 51976  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) ||
 51977  		(tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+8 /* &nSize */) != 0) {
 51978  		return TCL_ERROR
 51979  	}
 51980  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 51981  	if int32(*(*int8)(unsafe.Pointer(zDb))) == 0 {
 51982  		zDb = uintptr(0)
 51983  	}
 51984  
 51985  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb, SQLITE_FCNTL_SIZE_HINT, bp+8 /* &nSize */)
 51986  	if rc != 0 {
 51987  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 51988  		return TCL_ERROR
 51989  	}
 51990  	return TCL_OK
 51991  }
 51992  
 51993  // tclcmd:   file_control_lockproxy_test DB PWD
 51994  //
 51995  // This TCL command runs the sqlite3_file_control interface and
 51996  // verifies correct operation of the SQLITE_GET_LOCKPROXYFILE and
 51997  // SQLITE_SET_LOCKPROXYFILE verbs.
 51998  func file_control_lockproxy_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6193:26: */
 51999  	bp := tls.Alloc(36)
 52000  	defer tls.Free(36)
 52001  
 52002  	// var db uintptr at bp+32, 4
 52003  
 52004  	if objc != 3 {
 52005  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52006  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18248 /* " DB PWD" */, 0))
 52007  		return TCL_ERROR
 52008  	}
 52009  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 52010  		return TCL_ERROR
 52011  	}
 52012  
 52013  	return TCL_OK
 52014  }
 52015  
 52016  // tclcmd:   file_control_persist_wal DB PERSIST-FLAG
 52017  //
 52018  // This TCL command runs the sqlite3_file_control interface with
 52019  // the SQLITE_FCNTL_PERSIST_WAL opcode.
 52020  func file_control_persist_wal(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6364:26: */
 52021  	bp := tls.Alloc(172)
 52022  	defer tls.Free(172)
 52023  
 52024  	// var db uintptr at bp+64, 4
 52025  
 52026  	var rc int32
 52027  	// var bPersist int32 at bp+68, 4
 52028  
 52029  	// var z [100]int8 at bp+72, 100
 52030  
 52031  	if objc != 3 {
 52032  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52033  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18256 /* " DB FLAG" */, 0))
 52034  		return TCL_ERROR
 52035  	}
 52036  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &db */) != 0 {
 52037  		return TCL_ERROR
 52038  	}
 52039  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+68 /* &bPersist */) != 0 {
 52040  		return TCL_ERROR
 52041  	}
 52042  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_PERSIST_WAL, bp+68 /* &bPersist */)
 52043  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &z[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp+32, rc, *(*int32)(unsafe.Pointer(bp + 68 /* bPersist */))))
 52044  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+72 /* &z[0] */, uintptr(0)))
 52045  	return TCL_OK
 52046  }
 52047  
 52048  // tclcmd:   file_control_powersafe_overwrite DB PSOW-FLAG
 52049  //
 52050  // This TCL command runs the sqlite3_file_control interface with
 52051  // the SQLITE_FCNTL_POWERSAFE_OVERWRITE opcode.
 52052  func file_control_powersafe_overwrite(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6396:26: */
 52053  	bp := tls.Alloc(172)
 52054  	defer tls.Free(172)
 52055  
 52056  	// var db uintptr at bp+64, 4
 52057  
 52058  	var rc int32
 52059  	// var b int32 at bp+68, 4
 52060  
 52061  	// var z [100]int8 at bp+72, 100
 52062  
 52063  	if objc != 3 {
 52064  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52065  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18256 /* " DB FLAG" */, 0))
 52066  		return TCL_ERROR
 52067  	}
 52068  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &db */) != 0 {
 52069  		return TCL_ERROR
 52070  	}
 52071  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+68 /* &b */) != 0 {
 52072  		return TCL_ERROR
 52073  	}
 52074  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), uintptr(0), SQLITE_FCNTL_POWERSAFE_OVERWRITE, bp+68 /* &b */)
 52075  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &z[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp+32, rc, *(*int32)(unsafe.Pointer(bp + 68 /* b */))))
 52076  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+72 /* &z[0] */, uintptr(0)))
 52077  	return TCL_OK
 52078  }
 52079  
 52080  // tclcmd:   file_control_vfsname DB ?AUXDB?
 52081  //
 52082  // Return a string that describes the stack of VFSes.
 52083  func file_control_vfsname(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6428:26: */
 52084  	bp := tls.Alloc(56)
 52085  	defer tls.Free(56)
 52086  
 52087  	// var db uintptr at bp+48, 4
 52088  
 52089  	var zDbName uintptr = ts + 85 /* "main" */
 52090  	*(*uintptr)(unsafe.Pointer(bp + 52 /* zVfsName */)) = uintptr(0)
 52091  
 52092  	if (objc != 2) && (objc != 3) {
 52093  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52094  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 52095  		return TCL_ERROR
 52096  	}
 52097  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 52098  		return TCL_ERROR
 52099  	}
 52100  	if objc == 3 {
 52101  		zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52102  	}
 52103  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zDbName, SQLITE_FCNTL_VFSNAME, bp+52 /* &zVfsName */)
 52104  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 52 /* zVfsName */)), uintptr(0)))
 52105  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 52 /* zVfsName */)))
 52106  	return TCL_OK
 52107  }
 52108  
 52109  // tclcmd:   file_control_reservebytes DB N
 52110  func file_control_reservebytes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6458:26: */
 52111  	bp := tls.Alloc(8)
 52112  	defer tls.Free(8)
 52113  
 52114  	// var db uintptr at bp, 4
 52115  
 52116  	var zDbName uintptr = ts + 85 /* "main" */
 52117  	*(*int32)(unsafe.Pointer(bp + 4 /* n */)) = 0
 52118  	var rc int32
 52119  
 52120  	if objc != 3 {
 52121  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18283 /* "DB N" */)
 52122  		return TCL_ERROR
 52123  	}
 52124  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) ||
 52125  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &n */) != 0) {
 52126  		return TCL_ERROR
 52127  	}
 52128  
 52129  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbName, SQLITE_FCNTL_RESERVE_BYTES, bp+4 /* &n */)
 52130  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 52131  	return TCL_OK
 52132  }
 52133  
 52134  // tclcmd:   file_control_tempfilename DB ?AUXDB?
 52135  //
 52136  // Return a string that is a temporary filename
 52137  func file_control_tempfilename(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6490:26: */
 52138  	bp := tls.Alloc(56)
 52139  	defer tls.Free(56)
 52140  
 52141  	// var db uintptr at bp+48, 4
 52142  
 52143  	var zDbName uintptr = ts + 85 /* "main" */
 52144  	*(*uintptr)(unsafe.Pointer(bp + 52 /* zTName */)) = uintptr(0)
 52145  
 52146  	if (objc != 2) && (objc != 3) {
 52147  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52148  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 52149  		return TCL_ERROR
 52150  	}
 52151  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &db */) != 0 {
 52152  		return TCL_ERROR
 52153  	}
 52154  	if objc == 3 {
 52155  		zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52156  	}
 52157  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 48 /* db */)), zDbName, SQLITE_FCNTL_TEMPFILENAME, bp+52 /* &zTName */)
 52158  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 52 /* zTName */)), uintptr(0)))
 52159  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 52 /* zTName */)))
 52160  	return TCL_OK
 52161  }
 52162  
 52163  // tclcmd:   file_control_external_reader DB ?AUXDB?
 52164  //
 52165  // Return a string that is a temporary filename
 52166  func file_control_external_reader(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6522:26: */
 52167  	bp := tls.Alloc(40)
 52168  	defer tls.Free(40)
 52169  
 52170  	// var db uintptr at bp+32, 4
 52171  
 52172  	var zName uintptr = ts + 85 /* "main" */
 52173  	*(*int32)(unsafe.Pointer(bp + 36 /* iRes */)) = 0
 52174  	var rc int32 = SQLITE_OK
 52175  
 52176  	if (objc != 2) && (objc != 3) {
 52177  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52178  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18271 /* " DB ?AUXDB?" */, 0))
 52179  		return TCL_ERROR
 52180  	}
 52181  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 52182  		return TCL_ERROR
 52183  	}
 52184  	if objc == 3 {
 52185  		zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52186  	}
 52187  	rc = sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zName, SQLITE_FCNTL_EXTERNAL_READER, bp+36 /* &iRes */)
 52188  	if rc != SQLITE_OK {
 52189  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 52190  		return TCL_ERROR
 52191  	}
 52192  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 36 /* iRes */))))
 52193  	return TCL_OK
 52194  }
 52195  
 52196  // tclcmd:   sqlite3_vfs_list
 52197  //
 52198  //   Return a tcl list containing the names of all registered vfs's.
 52199  func vfs_list(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6559:26: */
 52200  	var pVfs uintptr
 52201  	var pRet uintptr = tcl.XTcl_NewObj(tls)
 52202  	if objc != 1 {
 52203  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 52204  		return TCL_ERROR
 52205  	}
 52206  	for pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)); pVfs != 0; pVfs = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpNext {
 52207  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, -1))
 52208  	}
 52209  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 52210  	return TCL_OK
 52211  }
 52212  
 52213  // tclcmd:   sqlite3_limit DB ID VALUE
 52214  //
 52215  // This TCL command runs the sqlite3_limit interface and
 52216  // verifies correct operation of the same.
 52217  func test_limit(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6584:26: */
 52218  	bp := tls.Alloc(64)
 52219  	defer tls.Free(64)
 52220  
 52221  	// var db uintptr at bp+56, 4
 52222  
 52223  	var rc int32
 52224  	var i int32
 52225  	var id int32 = 0
 52226  	// var val int32 at bp+60, 4
 52227  
 52228  	var zId uintptr
 52229  
 52230  	if objc != 4 {
 52231  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 52232  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+18288 /* " DB ID VALUE" */, 0))
 52233  		return TCL_ERROR
 52234  	}
 52235  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+56 /* &db */) != 0 {
 52236  		return TCL_ERROR
 52237  	}
 52238  	zId = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52239  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aId)) / uint32(unsafe.Sizeof(struct {
 52240  		FzName uintptr
 52241  		Fid    int32
 52242  	}{}))); i++ {
 52243  		if libc.Xstrcmp(tls, zId, aId[i].FzName) == 0 {
 52244  			id = aId[i].Fid
 52245  			break
 52246  		}
 52247  	}
 52248  	if uint32(i) >= (uint32(unsafe.Sizeof(aId)) / uint32(unsafe.Sizeof(struct {
 52249  		FzName uintptr
 52250  		Fid    int32
 52251  	}{}))) {
 52252  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+18301 /* "unknown limit ty..." */, zId, uintptr(0)))
 52253  		return TCL_ERROR
 52254  	}
 52255  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+60 /* &val */) != 0 {
 52256  		return TCL_ERROR
 52257  	}
 52258  	rc = sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), id, *(*int32)(unsafe.Pointer(bp + 60 /* val */)))
 52259  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 52260  	return TCL_OK
 52261  }
 52262  
 52263  var aId = [14]struct {
 52264  	FzName uintptr
 52265  	Fid    int32
 52266  }{
 52267  	{FzName: ts + 18322 /* "SQLITE_LIMIT_LEN..." */},
 52268  	{FzName: ts + 18342 /* "SQLITE_LIMIT_SQL..." */, Fid: SQLITE_LIMIT_SQL_LENGTH},
 52269  	{FzName: ts + 18366 /* "SQLITE_LIMIT_COL..." */, Fid: SQLITE_LIMIT_COLUMN},
 52270  	{FzName: ts + 18386 /* "SQLITE_LIMIT_EXP..." */, Fid: SQLITE_LIMIT_EXPR_DEPTH},
 52271  	{FzName: ts + 18410 /* "SQLITE_LIMIT_COM..." */, Fid: SQLITE_LIMIT_COMPOUND_SELECT},
 52272  	{FzName: ts + 18439 /* "SQLITE_LIMIT_VDB..." */, Fid: SQLITE_LIMIT_VDBE_OP},
 52273  	{FzName: ts + 18460 /* "SQLITE_LIMIT_FUN..." */, Fid: SQLITE_LIMIT_FUNCTION_ARG},
 52274  	{FzName: ts + 18486 /* "SQLITE_LIMIT_ATT..." */, Fid: SQLITE_LIMIT_ATTACHED},
 52275  	{FzName: ts + 18508 /* "SQLITE_LIMIT_LIK..." */, Fid: SQLITE_LIMIT_LIKE_PATTERN_LENGTH},
 52276  	{FzName: ts + 18541 /* "SQLITE_LIMIT_VAR..." */, Fid: SQLITE_LIMIT_VARIABLE_NUMBER},
 52277  	{FzName: ts + 18570 /* "SQLITE_LIMIT_TRI..." */, Fid: SQLITE_LIMIT_TRIGGER_DEPTH},
 52278  	{FzName: ts + 18597 /* "SQLITE_LIMIT_WOR..." */, Fid: SQLITE_LIMIT_WORKER_THREADS},
 52279  
 52280  	// Out of range test cases
 52281  	{FzName: ts + 18625 /* "SQLITE_LIMIT_TOO..." */, Fid: -1},
 52282  	{FzName: ts + 18647 /* "SQLITE_LIMIT_TOO..." */, Fid: (SQLITE_LIMIT_WORKER_THREADS + 1)},
 52283  } /* test1.c:6595:5 */
 52284  
 52285  // tclcmd:  save_prng_state
 52286  //
 52287  // Save the state of the pseudo-random number generator.
 52288  // At the same time, verify that sqlite3_test_control works even when
 52289  // called with an out-of-range opcode.
 52290  func save_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6647:26: */
 52291  	var rc int32 = sqlite3.Xsqlite3_test_control(tls, 9999, 0)
 52292  	_ = rc
 52293  
 52294  	rc = sqlite3.Xsqlite3_test_control(tls, -1, 0)
 52295  
 52296  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_SAVE, 0)
 52297  	return TCL_OK
 52298  }
 52299  
 52300  // tclcmd:  restore_prng_state
 52301  func restore_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6663:26: */
 52302  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_RESTORE, 0)
 52303  	return TCL_OK
 52304  }
 52305  
 52306  // tclcmd:  reset_prng_state
 52307  func reset_prng_state(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6675:26: */
 52308  	sqlite3.Xsqlite3_randomness(tls, 0, uintptr(0))
 52309  	return TCL_OK
 52310  }
 52311  
 52312  // tclcmd:  prng_seed INT ?DB?
 52313  //
 52314  // Set up the SQLITE_TESTCTRL_PRNG_SEED pragma with parameter INT and DB.
 52315  // INT is an integer.  DB is a database connection, or a NULL pointer if
 52316  // omitted.
 52317  //
 52318  // When INT!=0 and DB!=0, set the PRNG seed to the value of the schema
 52319  // cookie for DB, or to INT if the schema cookie happens to be zero.
 52320  //
 52321  // When INT!=0 and DB==0, set the PRNG seed to just INT.
 52322  //
 52323  // If INT==0 and DB==0 then use the default procedure of calling the
 52324  // xRandomness method on the default VFS to get the PRNG seed.
 52325  func prng_seed(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6699:26: */
 52326  	bp := tls.Alloc(24)
 52327  	defer tls.Free(24)
 52328  
 52329  	*(*int32)(unsafe.Pointer(bp + 16 /* i */)) = 0
 52330  	*(*uintptr)(unsafe.Pointer(bp + 20 /* db */)) = uintptr(0)
 52331  	if (objc != 2) && (objc != 3) {
 52332  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18667 /* "SEED ?DB?" */)
 52333  		return TCL_ERROR
 52334  	}
 52335  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &i */) != 0 {
 52336  		return TCL_ERROR
 52337  	}
 52338  	if (objc == 3) && (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+20 /* &db */) != 0) {
 52339  		return TCL_ERROR
 52340  	}
 52341  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PRNG_SEED, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 16 /* i */)), *(*uintptr)(unsafe.Pointer(bp + 20 /* db */))))
 52342  	return TCL_OK
 52343  }
 52344  
 52345  // tclcmd:  extra_schema_checks BOOLEAN
 52346  //
 52347  // Enable or disable schema checks when parsing the sqlite_schema file.
 52348  // This is always enabled in production, but it is sometimes useful to
 52349  // disable the checks in order to make some internal error states reachable
 52350  // for testing.
 52351  func extra_schema_checks(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6727:26: */
 52352  	bp := tls.Alloc(12)
 52353  	defer tls.Free(12)
 52354  
 52355  	*(*int32)(unsafe.Pointer(bp + 8 /* i */)) = 0
 52356  	if objc != 2 {
 52357  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 52358  		return TCL_ERROR
 52359  	}
 52360  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &i */) != 0 {
 52361  		return TCL_ERROR
 52362  	}
 52363  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* i */))))
 52364  	return TCL_OK
 52365  }
 52366  
 52367  // tclcmd:  database_may_be_corrupt
 52368  //
 52369  // Indicate that database files might be corrupt. In other words, set the normal
 52370  // state of operation.
 52371  func database_may_be_corrupt(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6749:26: */
 52372  	bp := tls.Alloc(8)
 52373  	defer tls.Free(8)
 52374  
 52375  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_NEVER_CORRUPT, libc.VaList(bp, 0))
 52376  	return TCL_OK
 52377  }
 52378  
 52379  // tclcmd:  database_never_corrupt
 52380  //
 52381  // Indicate that database files are always well-formed. This enables
 52382  // extra assert() statements that test conditions that are always true
 52383  // for well-formed databases.
 52384  func database_never_corrupt(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6765:26: */
 52385  	bp := tls.Alloc(8)
 52386  	defer tls.Free(8)
 52387  
 52388  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_NEVER_CORRUPT, libc.VaList(bp, 1))
 52389  	return TCL_OK
 52390  }
 52391  
 52392  // tclcmd:  pcache_stats
 52393  func test_pcache_stats(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6778:26: */
 52394  	bp := tls.Alloc(16)
 52395  	defer tls.Free(16)
 52396  
 52397  	// var nMin int32 at bp+8, 4
 52398  
 52399  	// var nMax int32 at bp+4, 4
 52400  
 52401  	// var nCurrent int32 at bp, 4
 52402  
 52403  	// var nRecyclable int32 at bp+12, 4
 52404  
 52405  	var pRet uintptr
 52406  
 52407  	sqlite3.Xsqlite3PcacheStats(tls, bp /* &nCurrent */, bp+4 /* &nMax */, bp+8 /* &nMin */, bp+12 /* &nRecyclable */)
 52408  
 52409  	pRet = tcl.XTcl_NewObj(tls)
 52410  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18685 /* "current" */, -1))
 52411  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp /* nCurrent */))))
 52412  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18693 /* "max" */, -1))
 52413  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* nMax */))))
 52414  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18697 /* "min" */, -1))
 52415  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 8 /* nMin */))))
 52416  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+18701 /* "recyclable" */, -1))
 52417  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* nRecyclable */))))
 52418  
 52419  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 52420  
 52421  	return TCL_OK
 52422  }
 52423  
 52424  func test_unlock_notify_cb(tls *libc.TLS, aArg uintptr, nArg int32) { /* test1.c:6808:13: */
 52425  	var ii int32
 52426  	for ii = 0; ii < nArg; ii++ {
 52427  		tcl.XTcl_EvalEx(tls, *(*uintptr)(unsafe.Pointer(aArg + uintptr(ii)*4)), ts+14153 /* "unlock_notify" */, -1, TCL_EVAL_GLOBAL)
 52428  	}
 52429  }
 52430  
 52431  // tclcmd:  sqlite3_unlock_notify db
 52432  func test_unlock_notify(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6820:26: */
 52433  	bp := tls.Alloc(4)
 52434  	defer tls.Free(4)
 52435  
 52436  	// var db uintptr at bp, 4
 52437  
 52438  	var rc int32
 52439  
 52440  	if objc != 2 {
 52441  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 52442  		return TCL_ERROR
 52443  	}
 52444  
 52445  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 52446  		return TCL_ERROR
 52447  	}
 52448  	rc = sqlite3.Xsqlite3_unlock_notify(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 52449  		f func(*libc.TLS, uintptr, int32)
 52450  	}{test_unlock_notify_cb})), interp)
 52451  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 52452  	return TCL_OK
 52453  }
 52454  
 52455  // tclcmd:  sqlite3_wal_checkpoint db ?NAME?
 52456  func test_wal_checkpoint(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6846:26: */
 52457  	bp := tls.Alloc(4)
 52458  	defer tls.Free(4)
 52459  
 52460  	var zDb uintptr = uintptr(0)
 52461  	// var db uintptr at bp, 4
 52462  
 52463  	var rc int32
 52464  
 52465  	if (objc != 3) && (objc != 2) {
 52466  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18712 /* "DB ?NAME?" */)
 52467  		return TCL_ERROR
 52468  	}
 52469  
 52470  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 52471  		return TCL_ERROR
 52472  	}
 52473  	if objc == 3 {
 52474  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52475  	}
 52476  	rc = sqlite3.Xsqlite3_wal_checkpoint(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb)
 52477  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 52478  	return TCL_OK
 52479  }
 52480  
 52481  // tclcmd:  sqlite3_wal_checkpoint_v2 db MODE ?NAME?
 52482  //
 52483  // This command calls the wal_checkpoint_v2() function with the specified
 52484  // mode argument (passive, full or restart). If present, the database name
 52485  // NAME is passed as the second argument to wal_checkpoint_v2(). If it the
 52486  // NAME argument is not present, a NULL pointer is passed instead.
 52487  //
 52488  // If wal_checkpoint_v2() returns any value other than SQLITE_BUSY or
 52489  // SQLITE_OK, then this command returns TCL_ERROR. The Tcl result is set
 52490  // to the error message obtained from sqlite3_errmsg().
 52491  //
 52492  // Otherwise, this command returns a list of three integers. The first integer
 52493  // is 1 if SQLITE_BUSY was returned, or 0 otherwise. The following two integers
 52494  // are the values returned via the output parameters by wal_checkpoint_v2() -
 52495  // the number of frames in the log and the number of frames in the log
 52496  // that have been checkpointed.
 52497  func test_wal_checkpoint_v2(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6890:26: */
 52498  	bp := tls.Alloc(68)
 52499  	defer tls.Free(68)
 52500  
 52501  	var zDb uintptr = uintptr(0)
 52502  	// var db uintptr at bp+32, 4
 52503  
 52504  	var rc int32
 52505  	// var eMode int32 at bp+36, 4
 52506  
 52507  	*(*int32)(unsafe.Pointer(bp + 60 /* nLog */)) = -555
 52508  	*(*int32)(unsafe.Pointer(bp + 64 /* nCkpt */)) = -555
 52509  	var pRet uintptr
 52510  
 52511  	*(*[5]uintptr)(unsafe.Pointer(bp + 40 /* aMode */)) = [5]uintptr{ts + 18722 /* "passive" */, ts + 18730 /* "full" */, ts + 18735 /* "restart" */, ts + 18743 /* "truncate" */, uintptr(0)}
 52512  
 52513  	if (objc != 3) && (objc != 4) {
 52514  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18752 /* "DB MODE ?NAME?" */)
 52515  		return TCL_ERROR
 52516  	}
 52517  
 52518  	if objc == 4 {
 52519  		zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 52520  	}
 52521  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0) || ((TCL_OK != tcl.XTcl_GetIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &eMode */)) &&
 52522  		(TCL_OK != tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+40 /* &aMode[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+18767 /* "mode" */, 0, bp+36 /* &eMode */))) {
 52523  		return TCL_ERROR
 52524  	}
 52525  
 52526  	rc = sqlite3.Xsqlite3_wal_checkpoint_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zDb, *(*int32)(unsafe.Pointer(bp + 36 /* eMode */)), bp+60 /* &nLog */, bp+64 /* &nCkpt */)
 52527  	if (rc != SQLITE_OK) && (rc != SQLITE_BUSY) {
 52528  		var zErrCode uintptr = sqlite3.Xsqlite3ErrName(tls, rc)
 52529  		tcl.XTcl_ResetResult(tls, interp)
 52530  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, zErrCode, ts+10280 /* " - " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */))), 0))
 52531  		return TCL_ERROR
 52532  	}
 52533  
 52534  	pRet = tcl.XTcl_NewObj(tls)
 52535  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, func() int32 {
 52536  		if rc == SQLITE_BUSY {
 52537  			return 1
 52538  		}
 52539  		return 0
 52540  	}()))
 52541  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 60 /* nLog */))))
 52542  	tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 64 /* nCkpt */))))
 52543  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 52544  
 52545  	return TCL_OK
 52546  }
 52547  
 52548  // tclcmd:  sqlite3_wal_autocheckpoint db VALUE
 52549  func test_wal_autocheckpoint(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6946:26: */
 52550  	bp := tls.Alloc(8)
 52551  	defer tls.Free(8)
 52552  
 52553  	// var db uintptr at bp, 4
 52554  
 52555  	var rc int32
 52556  	// var iVal int32 at bp+4, 4
 52557  
 52558  	if objc != 3 {
 52559  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18772 /* "DB VALUE" */)
 52560  		return TCL_ERROR
 52561  	}
 52562  
 52563  	if (getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) ||
 52564  		(tcl.XTcl_GetIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &iVal */) != 0) {
 52565  		return TCL_ERROR
 52566  	}
 52567  
 52568  	rc = sqlite3.Xsqlite3_wal_autocheckpoint(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 4 /* iVal */)))
 52569  	tcl.XTcl_ResetResult(tls, interp)
 52570  	if rc != SQLITE_OK {
 52571  		var zErrCode uintptr = sqlite3.Xsqlite3ErrName(tls, rc)
 52572  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, zErrCode, -1))
 52573  		return TCL_ERROR
 52574  	}
 52575  
 52576  	return TCL_OK
 52577  }
 52578  
 52579  // tclcmd:  test_sqlite3_log ?SCRIPT?
 52580  type LogCallback = struct {
 52581  	FpInterp uintptr
 52582  	FpObj    uintptr
 52583  } /* test1.c:6983:8 */
 52584  
 52585  // tclcmd:  test_sqlite3_log ?SCRIPT?
 52586  var logcallback = LogCallback{} /* test1.c:6986:3 */
 52587  
 52588  func xLogcallback(tls *libc.TLS, unused uintptr, err int32, zMsg uintptr) { /* test1.c:6987:13: */
 52589  	var pNew uintptr = tcl.XTcl_DuplicateObj(tls, logcallback.FpObj)
 52590  	(*Tcl_Obj)(unsafe.Pointer(pNew)).FrefCount++
 52591  	tcl.XTcl_ListObjAppendElement(tls,
 52592  		uintptr(0), pNew, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, err), -1))
 52593  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pNew, tcl.XTcl_NewStringObj(tls, zMsg, -1))
 52594  	tcl.XTcl_EvalObjEx(tls, logcallback.FpInterp, pNew, (TCL_EVAL_GLOBAL | TCL_EVAL_DIRECT))
 52595  	for ok := true; ok; ok = 0 != 0 {
 52596  		var _objPtr uintptr = pNew
 52597  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 52598  			tcl.XTclFreeObj(tls, _objPtr)
 52599  		}
 52600  	}
 52601  }
 52602  
 52603  func test_sqlite3_log(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:6997:26: */
 52604  	bp := tls.Alloc(32)
 52605  	defer tls.Free(32)
 52606  
 52607  	if objc > 2 {
 52608  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10650 /* "SCRIPT" */)
 52609  		return TCL_ERROR
 52610  	}
 52611  	if logcallback.FpObj != 0 {
 52612  		for ok := true; ok; ok = 0 != 0 {
 52613  			var _objPtr uintptr = logcallback.FpObj
 52614  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 52615  				tcl.XTclFreeObj(tls, _objPtr)
 52616  			}
 52617  		}
 52618  		logcallback.FpObj = uintptr(0)
 52619  		logcallback.FpInterp = uintptr(0)
 52620  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOG, libc.VaList(bp, uintptr(0), uintptr(0)))
 52621  	}
 52622  	if objc > 1 {
 52623  		logcallback.FpObj = *(*uintptr)(unsafe.Pointer(objv + 1*4))
 52624  		(*Tcl_Obj)(unsafe.Pointer(logcallback.FpObj)).FrefCount++
 52625  		logcallback.FpInterp = interp
 52626  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOG, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(&struct {
 52627  			f func(*libc.TLS, uintptr, int32, uintptr)
 52628  		}{xLogcallback})), uintptr(0)))
 52629  	}
 52630  	return TCL_OK
 52631  }
 52632  
 52633  //     tcl_objproc COMMANDNAME ARGS...
 52634  //
 52635  // Run a TCL command using its objProc interface.  Throw an error if
 52636  // the command has no objProc interface.
 52637  func runAsObjProc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7028:26: */
 52638  	bp := tls.Alloc(80)
 52639  	defer tls.Free(80)
 52640  
 52641  	// var cmdInfo Tcl_CmdInfo at bp+48, 32
 52642  
 52643  	if objc < 2 {
 52644  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18781 /* "COMMAND ..." */)
 52645  		return TCL_ERROR
 52646  	}
 52647  	if !(tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+48 /* &cmdInfo */) != 0) {
 52648  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15320, /* "command not foun..." */
 52649  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 52650  		return TCL_ERROR
 52651  	}
 52652  	if (*Tcl_CmdInfo)(unsafe.Pointer(bp+48 /* &cmdInfo */)).FobjProc == uintptr(0) {
 52653  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+18793, /* "command has no o..." */
 52654  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 52655  		return TCL_ERROR
 52656  	}
 52657  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 48 /* &cmdInfo */ + 4 /* &.objProc */))))(tls, (*Tcl_CmdInfo)(unsafe.Pointer(bp+48 /* &cmdInfo */)).FobjClientData, interp, (objc - 1), (objv + uintptr(1)*4))
 52658  }
 52659  
 52660  // WARNING: The following function, printExplainQueryPlan() is an exact
 52661  // copy of example code from eqp.in (eqp.html). If this code is modified,
 52662  // then the documentation copy needs to be modified as well.
 52663  // Argument pStmt is a prepared SQL statement. This function compiles
 52664  // an EXPLAIN QUERY PLAN command to report on the prepared statement,
 52665  // and prints the report to stdout using printf().
 52666  func printExplainQueryPlan(tls *libc.TLS, pStmt uintptr) int32 { /* test1.c:7063:5: */
 52667  	bp := tls.Alloc(44)
 52668  	defer tls.Free(44)
 52669  
 52670  	var zSql uintptr     // Input SQL
 52671  	var zExplain uintptr // SQL with EXPLAIN QUERY PLAN prepended
 52672  	// var pExplain uintptr at bp+40, 4
 52673  	// Compiled EXPLAIN QUERY PLAN command
 52674  	var rc int32 // Return code from sqlite3_prepare_v2()
 52675  
 52676  	zSql = sqlite3.Xsqlite3_sql(tls, pStmt)
 52677  	if zSql == uintptr(0) {
 52678  		return SQLITE_ERROR
 52679  	}
 52680  
 52681  	zExplain = sqlite3.Xsqlite3_mprintf(tls, ts+235 /* "EXPLAIN QUERY PL..." */, libc.VaList(bp, zSql))
 52682  	if zExplain == uintptr(0) {
 52683  		return SQLITE_NOMEM
 52684  	}
 52685  
 52686  	rc = sqlite3.Xsqlite3_prepare_v2(tls, sqlite3.Xsqlite3_db_handle(tls, pStmt), zExplain, -1, bp+40 /* &pExplain */, uintptr(0))
 52687  	sqlite3.Xsqlite3_free(tls, zExplain)
 52688  	if rc != SQLITE_OK {
 52689  		return rc
 52690  	}
 52691  
 52692  	for SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */))) {
 52693  		var iSelectid int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 0)
 52694  		var iOrder int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 1)
 52695  		var iFrom int32 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 2)
 52696  		var zDetail uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)), 3)
 52697  
 52698  		libc.Xprintf(tls, ts+18818 /* "%d %d %d %s\n" */, libc.VaList(bp+8, iSelectid, iOrder, iFrom, zDetail))
 52699  	}
 52700  
 52701  	return sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 40 /* pExplain */)))
 52702  }
 52703  
 52704  func test_print_eqp(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7091:26: */
 52705  	bp := tls.Alloc(4)
 52706  	defer tls.Free(4)
 52707  
 52708  	var rc int32
 52709  	// var pStmt uintptr at bp, 4
 52710  
 52711  	if objc != 2 {
 52712  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 52713  		return TCL_ERROR
 52714  	}
 52715  	if getStmtPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &pStmt */) != 0 {
 52716  		return TCL_ERROR
 52717  	}
 52718  	rc = printExplainQueryPlan(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 52719  	// This is needed on Windows so that a test case using this
 52720  	// function can open a read pipe and get the output of
 52721  	// printExplainQueryPlan() immediately.
 52722  	libc.Xfflush(tls, libc.Xstdout)
 52723  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 52724  	return TCL_OK
 52725  }
 52726  
 52727  // sqlite3_test_control VERB ARGS...
 52728  func test_test_control(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7119:26: */
 52729  	bp := tls.Alloc(128)
 52730  	defer tls.Free(128)
 52731  
 52732  	*(*[4]Verb)(unsafe.Pointer(bp + 64 /* aVerb */)) = [4]Verb{
 52733  		{FzName: ts + 18831 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_LOCALTIME_FAULT},
 52734  		{FzName: ts + 18863 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_SORTER_MMAP},
 52735  		{FzName: ts + 18891 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_IMPOSTER},
 52736  		{FzName: ts + 18916 /* "SQLITE_TESTCTRL_..." */, Fi: SQLITE_TESTCTRL_INTERNAL_FUNCTIONS},
 52737  	}
 52738  	// var iVerb int32 at bp+96, 4
 52739  
 52740  	var iFlag int32
 52741  	var rc int32
 52742  
 52743  	if objc < 2 {
 52744  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18951 /* "VERB ARGS..." */)
 52745  		return TCL_ERROR
 52746  	}
 52747  
 52748  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 52749  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+64 /* &aVerb[0] */, int32(unsafe.Sizeof(Verb{})), ts+18964 /* "VERB" */, 0, bp+96 /* &iVerb */)
 52750  	if rc != TCL_OK {
 52751  		return rc
 52752  	}
 52753  
 52754  	iFlag = (*Verb)(unsafe.Pointer(bp + 64 /* &aVerb */ + uintptr(*(*int32)(unsafe.Pointer(bp + 96 /* iVerb */)))*8)).Fi
 52755  	switch iFlag {
 52756  	case SQLITE_TESTCTRL_INTERNAL_FUNCTIONS:
 52757  		{
 52758  			*(*uintptr)(unsafe.Pointer(bp + 100 /* db */)) = uintptr(0)
 52759  			if objc != 3 {
 52760  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+1911 /* "DB" */)
 52761  				return TCL_ERROR
 52762  			}
 52763  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+100 /* &db */) != 0 {
 52764  				return TCL_ERROR
 52765  			}
 52766  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(bp + 100 /* db */))))
 52767  			break
 52768  
 52769  		}
 52770  	case SQLITE_TESTCTRL_LOCALTIME_FAULT:
 52771  		{
 52772  			// var val int32 at bp+104, 4
 52773  
 52774  			if objc != 3 {
 52775  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18969 /* "ONOFF" */)
 52776  				return TCL_ERROR
 52777  			}
 52778  			if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+104 /* &val */) != 0 {
 52779  				return TCL_ERROR
 52780  			}
 52781  			sqlite3.Xsqlite3_test_control(tls, iFlag, libc.VaList(bp+8, *(*int32)(unsafe.Pointer(bp + 104 /* val */))))
 52782  			break
 52783  
 52784  		}
 52785  
 52786  	case SQLITE_TESTCTRL_SORTER_MMAP:
 52787  		{
 52788  			// var val int32 at bp+112, 4
 52789  
 52790  			// var db uintptr at bp+108, 4
 52791  
 52792  			if objc != 4 {
 52793  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18975 /* "DB LIMIT" */)
 52794  				return TCL_ERROR
 52795  			}
 52796  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+108 /* &db */) != 0 {
 52797  				return TCL_ERROR
 52798  			}
 52799  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+112 /* &val */) != 0 {
 52800  				return TCL_ERROR
 52801  			}
 52802  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_SORTER_MMAP, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(bp + 108 /* db */)), *(*int32)(unsafe.Pointer(bp + 112 /* val */))))
 52803  			break
 52804  
 52805  		}
 52806  
 52807  	case SQLITE_TESTCTRL_IMPOSTER:
 52808  		{
 52809  			// var onOff int32 at bp+120, 4
 52810  
 52811  			// var tnum int32 at bp+124, 4
 52812  
 52813  			var zDbName uintptr
 52814  			// var db uintptr at bp+116, 4
 52815  
 52816  			if objc != 6 {
 52817  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+18984 /* "DB dbName onOff ..." */)
 52818  				return TCL_ERROR
 52819  			}
 52820  			if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+116 /* &db */) != 0 {
 52821  				return TCL_ERROR
 52822  			}
 52823  			zDbName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 52824  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+120 /* &onOff */) != 0 {
 52825  				return TCL_ERROR
 52826  			}
 52827  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*4)), bp+124 /* &tnum */) != 0 {
 52828  				return TCL_ERROR
 52829  			}
 52830  			sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_IMPOSTER, libc.VaList(bp+32, *(*uintptr)(unsafe.Pointer(bp + 116 /* db */)), zDbName, *(*int32)(unsafe.Pointer(bp + 120 /* onOff */)), *(*int32)(unsafe.Pointer(bp + 124 /* tnum */))))
 52831  			break
 52832  
 52833  		}
 52834  	}
 52835  
 52836  	tcl.XTcl_ResetResult(tls, interp)
 52837  	return TCL_OK
 52838  }
 52839  
 52840  type Verb = struct {
 52841  	FzName uintptr
 52842  	Fi     int32
 52843  } /* test1.c:7125:3 */
 52844  
 52845  // Value to indicate that there is no limit.
 52846  
 52847  // We can represent all limits.
 52848  
 52849  // Type for resource quantity measurement.
 52850  type rlim_t = uint64   /* resource.h:133:20 */
 52851  type rlim64_t = uint64 /* resource.h:136:20 */
 52852  
 52853  type rlimit = struct {
 52854  	Frlim_cur rlim_t
 52855  	Frlim_max rlim_t
 52856  } /* resource.h:139:1 */
 52857  
 52858  type rlimit64 = struct {
 52859  	Frlim_cur rlim64_t
 52860  	Frlim_max rlim64_t
 52861  } /* resource.h:148:1 */
 52862  
 52863  // Define struct rusage.
 52864  //    Copyright (C) 1994-2018 Free Software Foundation, Inc.
 52865  //    This file is part of the GNU C Library.
 52866  //
 52867  //    The GNU C Library is free software; you can redistribute it and/or
 52868  //    modify it under the terms of the GNU Lesser General Public
 52869  //    License as published by the Free Software Foundation; either
 52870  //    version 2.1 of the License, or (at your option) any later version.
 52871  //
 52872  //    The GNU C Library is distributed in the hope that it will be useful,
 52873  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 52874  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 52875  //    Lesser General Public License for more details.
 52876  //
 52877  //    You should have received a copy of the GNU Lesser General Public
 52878  //    License along with the GNU C Library; if not, see
 52879  //    <http://www.gnu.org/licenses/>.
 52880  
 52881  // bits/types.h -- definitions of __*_t types underlying *_t types.
 52882  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 52883  //    This file is part of the GNU C Library.
 52884  //
 52885  //    The GNU C Library is free software; you can redistribute it and/or
 52886  //    modify it under the terms of the GNU Lesser General Public
 52887  //    License as published by the Free Software Foundation; either
 52888  //    version 2.1 of the License, or (at your option) any later version.
 52889  //
 52890  //    The GNU C Library is distributed in the hope that it will be useful,
 52891  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 52892  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 52893  //    Lesser General Public License for more details.
 52894  //
 52895  //    You should have received a copy of the GNU Lesser General Public
 52896  //    License along with the GNU C Library; if not, see
 52897  //    <http://www.gnu.org/licenses/>.
 52898  
 52899  // Never include this file directly; use <sys/types.h> instead.
 52900  
 52901  // Structure which says how much of each resource has been used.
 52902  
 52903  // The purpose of all the unions is to have the kernel-compatible layout
 52904  //    while keeping the API type as 'long int', and among machines where
 52905  //    __syscall_slong_t is not 'long int', this only does the right thing
 52906  //    for little-endian ones, like x32.
 52907  type rusage = struct {
 52908  	Fru_utime struct {
 52909  		Ftv_sec  int32
 52910  		Ftv_usec int32
 52911  	}
 52912  	Fru_stime struct {
 52913  		Ftv_sec  int32
 52914  		Ftv_usec int32
 52915  	}
 52916  	F__16 struct{ Fru_maxrss int32 }
 52917  	F__20 struct{ Fru_ixrss int32 }
 52918  	F__24 struct{ Fru_idrss int32 }
 52919  	F__28 struct{ Fru_isrss int32 }
 52920  	F__32 struct{ Fru_minflt int32 }
 52921  	F__36 struct{ Fru_majflt int32 }
 52922  	F__40 struct{ Fru_nswap int32 }
 52923  	F__44 struct{ Fru_inblock int32 }
 52924  	F__48 struct{ Fru_oublock int32 }
 52925  	F__52 struct{ Fru_msgsnd int32 }
 52926  	F__56 struct{ Fru_msgrcv int32 }
 52927  	F__60 struct{ Fru_nsignals int32 }
 52928  	F__64 struct{ Fru_nvcsw int32 }
 52929  	F__68 struct{ Fru_nivcsw int32 }
 52930  } /* struct_rusage.h:31:1 */
 52931  
 52932  func test_getrusage(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7209:26: */
 52933  	bp := tls.Alloc(1144)
 52934  	defer tls.Free(1144)
 52935  
 52936  	// var buf [1024]int8 at bp+120, 1024
 52937  
 52938  	// var r rusage at bp+48, 72
 52939  
 52940  	libc.Xmemset(tls, bp+48 /* &r */, 0, uint32(unsafe.Sizeof(rusage{})))
 52941  	libc.Xgetrusage(tls, RUSAGE_SELF, bp+48 /* &r */)
 52942  
 52943  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([1024]int8{})), bp+120, /* &buf[0] */
 52944  		ts+19005, /* "ru_utime=%d.%06d..." */
 52945  		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),
 52946  			int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_stime.Ftv_sec), int32((*rusage)(unsafe.Pointer(bp+48 /* &r */)).Fru_stime.Ftv_usec),
 52947  			int32(*(*int32)(unsafe.Pointer(bp + 48 /* &r */ + 32 /* &.ru_minflt */))), int32(*(*int32)(unsafe.Pointer(bp + 48 /* &r */ + 36 /* &.ru_majflt */)))))
 52948  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+120 /* &buf[0] */, -1))
 52949  	return TCL_OK
 52950  }
 52951  
 52952  //      optimization_control DB OPT BOOLEAN
 52953  //
 52954  // Enable or disable query optimizations using the sqlite3_test_control()
 52955  // interface.  Disable if BOOLEAN is false and enable if BOOLEAN is true.
 52956  // OPT is the name of the optimization to be disabled.
 52957  func optimization_control(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7489:26: */
 52958  	bp := tls.Alloc(64)
 52959  	defer tls.Free(64)
 52960  
 52961  	var i int32
 52962  	// var db uintptr at bp+56, 4
 52963  
 52964  	var zOpt uintptr
 52965  	// var onoff int32 at bp+60, 4
 52966  
 52967  	var mask int32 = 0
 52968  
 52969  	if objc != 4 {
 52970  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19065 /* "DB OPT BOOLEAN" */)
 52971  		return TCL_ERROR
 52972  	}
 52973  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+56 /* &db */) != 0 {
 52974  		return TCL_ERROR
 52975  	}
 52976  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+60 /* &onoff */) != 0 {
 52977  		return TCL_ERROR
 52978  	}
 52979  	zOpt = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 52980  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aOpt)) / uint32(unsafe.Sizeof(struct {
 52981  		FzOptName uintptr
 52982  		Fmask     int32
 52983  	}{}))); i++ {
 52984  		if libc.Xstrcmp(tls, zOpt, aOpt[i].FzOptName) == 0 {
 52985  			mask = aOpt[i].Fmask
 52986  			break
 52987  		}
 52988  	}
 52989  	if *(*int32)(unsafe.Pointer(bp + 60 /* onoff */)) != 0 {
 52990  		mask = ^mask
 52991  	}
 52992  	if uint32(i) >= (uint32(unsafe.Sizeof(aOpt)) / uint32(unsafe.Sizeof(struct {
 52993  		FzOptName uintptr
 52994  		Fmask     int32
 52995  	}{}))) {
 52996  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19080, /* "unknown optimiza..." */
 52997  			uintptr(0)))
 52998  		for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aOpt)) / uint32(unsafe.Sizeof(struct {
 52999  			FzOptName uintptr
 53000  			Fmask     int32
 53001  		}{}))); i++ {
 53002  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+4755 /* " " */, aOpt[i].FzOptName, uintptr(0)))
 53003  		}
 53004  		return TCL_ERROR
 53005  	}
 53006  	sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_OPTIMIZATIONS, libc.VaList(bp+40, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), mask))
 53007  	return TCL_OK
 53008  }
 53009  
 53010  var aOpt = [13]struct {
 53011  	FzOptName uintptr
 53012  	Fmask     int32
 53013  }{
 53014  	{FzOptName: ts + 19121 /* "all" */, Fmask: libc.Int32FromUint32(SQLITE_AllOpts)},
 53015  	{FzOptName: ts + 19125 /* "none" */},
 53016  	{FzOptName: ts + 19130 /* "query-flattener" */, Fmask: SQLITE_QueryFlattener},
 53017  	{FzOptName: ts + 19146 /* "groupby-order" */, Fmask: SQLITE_GroupByOrder},
 53018  	{FzOptName: ts + 19160 /* "factor-constants" */, Fmask: SQLITE_FactorOutConst},
 53019  	{FzOptName: ts + 19177 /* "distinct-opt" */, Fmask: SQLITE_DistinctOpt},
 53020  	{FzOptName: ts + 19190 /* "cover-idx-scan" */, Fmask: SQLITE_CoverIdxScan},
 53021  	{FzOptName: ts + 19205 /* "order-by-idx-joi..." */, Fmask: SQLITE_OrderByIdxJoin},
 53022  	{FzOptName: ts + 19223 /* "transitive" */, Fmask: SQLITE_Transitive},
 53023  	{FzOptName: ts + 19234 /* "omit-noop-join" */, Fmask: SQLITE_OmitNoopJoin},
 53024  	{FzOptName: ts + 19249 /* "stat4" */, Fmask: SQLITE_Stat4},
 53025  	{FzOptName: ts + 19255 /* "skip-scan" */, Fmask: SQLITE_SkipScan},
 53026  	{FzOptName: ts + 19265 /* "push-down" */, Fmask: SQLITE_PushDown},
 53027  } /* test1.c:7503:5 */
 53028  
 53029  //     load_static_extension DB NAME ...
 53030  //
 53031  // Load one or more statically linked extensions.
 53032  func tclLoadStaticExtensionCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7550:26: */
 53033  	bp := tls.Alloc(72)
 53034  	defer tls.Free(72)
 53035  
 53036  	// var db uintptr at bp+64, 4
 53037  
 53038  	var zName uintptr
 53039  	var i int32
 53040  	var j int32
 53041  	var rc int32
 53042  	*(*uintptr)(unsafe.Pointer(bp + 68 /* zErrMsg */)) = uintptr(0)
 53043  	if objc < 3 {
 53044  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19275 /* "DB NAME ..." */)
 53045  		return TCL_ERROR
 53046  	}
 53047  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &db */) != 0 {
 53048  		return TCL_ERROR
 53049  	}
 53050  	for j = 2; j < objc; j++ {
 53051  		zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(j)*4)))
 53052  		for i = 0; i < (int32(uint32(unsafe.Sizeof(aExtension)) / uint32(unsafe.Sizeof(struct {
 53053  			FzExtName uintptr
 53054  			FpInit    uintptr
 53055  		}{})))); i++ {
 53056  			if libc.Xstrcmp(tls, zName, aExtension[i].FzExtName) == 0 {
 53057  				break
 53058  			}
 53059  		}
 53060  		if i >= (int32(uint32(unsafe.Sizeof(aExtension)) / uint32(unsafe.Sizeof(struct {
 53061  			FzExtName uintptr
 53062  			FpInit    uintptr
 53063  		}{})))) {
 53064  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19287 /* "no such extensio..." */, zName, uintptr(0)))
 53065  			return TCL_ERROR
 53066  		}
 53067  		if aExtension[i].FpInit != 0 {
 53068  			rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aExtension)) + uintptr(i)*8 + 4 /* &.pInit */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), bp+68 /* &zErrMsg */, uintptr(0))
 53069  		} else {
 53070  			rc = SQLITE_OK
 53071  		}
 53072  		if ((rc != SQLITE_OK) && (rc != (SQLITE_OK | (int32(1) << 8)))) || (*(*uintptr)(unsafe.Pointer(bp + 68 /* zErrMsg */)) != 0) {
 53073  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+19307 /* "initialization o..." */, zName, ts+19326 /* " failed: " */, *(*uintptr)(unsafe.Pointer(bp + 68 /* zErrMsg */)),
 53074  				uintptr(0)))
 53075  			sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 68 /* zErrMsg */)))
 53076  			return TCL_ERROR
 53077  		}
 53078  	}
 53079  	return TCL_OK
 53080  }
 53081  
 53082  var aExtension = [22]struct {
 53083  	FzExtName uintptr
 53084  	FpInit    uintptr
 53085  }{
 53086  	{FzExtName: ts + 19336 /* "amatch" */, FpInit: 0},
 53087  	{FzExtName: ts + 19343 /* "appendvfs" */, FpInit: 0},
 53088  	{FzExtName: ts + 3921 /* "carray" */, FpInit: 0},
 53089  	{FzExtName: ts + 19353 /* "closure" */, FpInit: 0},
 53090  	{FzExtName: ts + 4676 /* "csv" */, FpInit: 0},
 53091  	{FzExtName: ts + 4699 /* "decimal" */, FpInit: 0},
 53092  	{FzExtName: ts + 4757 /* "eval" */, FpInit: 0},
 53093  	{FzExtName: ts + 4835 /* "explain" */, FpInit: 0},
 53094  	{FzExtName: ts + 19361 /* "fileio" */, FpInit: 0},
 53095  	{FzExtName: ts + 5344 /* "fuzzer" */, FpInit: 0},
 53096  	{FzExtName: ts + 5368 /* "ieee754" */, FpInit: 0},
 53097  	{FzExtName: ts + 19368 /* "nextchar" */, FpInit: 0},
 53098  	{FzExtName: ts + 5948 /* "percentile" */, FpInit: 0},
 53099  	{FzExtName: ts + 6023 /* "prefixes" */, FpInit: 0},
 53100  	{FzExtName: ts + 6335 /* "regexp" */, FpInit: 0},
 53101  	{FzExtName: ts + 6350 /* "remember" */, FpInit: 0},
 53102  	{FzExtName: ts + 19377 /* "series" */, FpInit: 0},
 53103  	{FzExtName: ts + 19384 /* "spellfix" */, FpInit: 0},
 53104  	{FzExtName: ts + 19393 /* "totype" */, FpInit: 0},
 53105  	{FzExtName: ts + 8367 /* "unionvtab" */, FpInit: 0},
 53106  	{FzExtName: ts + 8909 /* "wholenumber" */, FpInit: 0},
 53107  	{FzExtName: ts + 9012 /* "zipfile" */, FpInit: 0},
 53108  } /* test1.c:7585:5 */
 53109  
 53110  //     sorter_test_fakeheap BOOL
 53111  //
 53112  func sorter_test_fakeheap(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7650:26: */
 53113  	bp := tls.Alloc(4)
 53114  	defer tls.Free(4)
 53115  
 53116  	// var bArg int32 at bp, 4
 53117  
 53118  	if objc != 2 {
 53119  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 53120  		return TCL_ERROR
 53121  	}
 53122  
 53123  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &bArg */) != 0 {
 53124  		return TCL_ERROR
 53125  	}
 53126  
 53127  	if *(*int32)(unsafe.Pointer(bp /* bArg */)) != 0 {
 53128  		if sqlite3.Xsqlite3Config.FpHeap == uintptr(0) {
 53129  			sqlite3.Xsqlite3Config.FpHeap = libc.UintptrFromInt32(-1)
 53130  		}
 53131  	} else {
 53132  		if sqlite3.Xsqlite3Config.FpHeap == (libc.UintptrFromInt32(-1)) {
 53133  			sqlite3.Xsqlite3Config.FpHeap = uintptr(0)
 53134  		}
 53135  	}
 53136  
 53137  	tcl.XTcl_ResetResult(tls, interp)
 53138  	return TCL_OK
 53139  }
 53140  
 53141  //     sorter_test_sort4_helper DB SQL1 NSTEP SQL2
 53142  //
 53143  // Compile SQL statement $SQL1 and step it $NSTEP times. For each row,
 53144  // check that the leftmost and rightmost columns returned are both integers,
 53145  // and that both contain the same value.
 53146  //
 53147  // Then execute statement $SQL2. Check that the statement returns the same
 53148  // set of integers in the same order as in the previous step (using $SQL1).
 53149  func sorter_test_sort4_helper(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7690:26: */
 53150  	bp := tls.Alloc(68)
 53151  	defer tls.Free(68)
 53152  
 53153  	var zSql1 uintptr
 53154  	var zSql2 uintptr
 53155  	// var nStep int32 at bp+60, 4
 53156  
 53157  	var iStep int32
 53158  	var iCksum1 uint32
 53159  	var iCksum2 uint32
 53160  	var rc int32
 53161  	var iB int32
 53162  	// var db uintptr at bp+56, 4
 53163  
 53164  	// var pStmt uintptr at bp+64, 4
 53165  
 53166  	var a int32
 53167  	var a1 int32
 53168  	iCksum1 = uint32(0)
 53169  	iCksum2 = uint32(0)
 53170  
 53171  	if !(objc != 5) {
 53172  		goto __1
 53173  	}
 53174  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19400 /* "DB SQL1 NSTEP SQ..." */)
 53175  	return TCL_ERROR
 53176  __1:
 53177  	;
 53178  
 53179  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+56 /* &db */) != 0) {
 53180  		goto __2
 53181  	}
 53182  	return TCL_ERROR
 53183  __2:
 53184  	;
 53185  	zSql1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 53186  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+60 /* &nStep */) != 0) {
 53187  		goto __3
 53188  	}
 53189  	return TCL_ERROR
 53190  __3:
 53191  	;
 53192  	zSql2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 53193  
 53194  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), zSql1, -1, bp+64 /* &pStmt */, uintptr(0))
 53195  	if !(rc != SQLITE_OK) {
 53196  		goto __4
 53197  	}
 53198  	goto sql_error
 53199  __4:
 53200  	;
 53201  
 53202  	iB = (sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))) - 1)
 53203  	iStep = 0
 53204  __5:
 53205  	if !((iStep < *(*int32)(unsafe.Pointer(bp + 60 /* nStep */))) && (SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */))))) {
 53206  		goto __7
 53207  	}
 53208  	a = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 0)
 53209  	if !(a != sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), iB)) {
 53210  		goto __8
 53211  	}
 53212  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+19419 /* "data error: (a!=..." */, 0))
 53213  	return TCL_ERROR
 53214  __8:
 53215  	;
 53216  
 53217  	iCksum1 = iCksum1 + ((iCksum1 << 3) + uint32(a))
 53218  	goto __6
 53219  __6:
 53220  	iStep++
 53221  	goto __5
 53222  	goto __7
 53223  __7:
 53224  	;
 53225  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))
 53226  	if !(rc != SQLITE_OK) {
 53227  		goto __9
 53228  	}
 53229  	goto sql_error
 53230  __9:
 53231  	;
 53232  
 53233  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */)), zSql2, -1, bp+64 /* &pStmt */, uintptr(0))
 53234  	if !(rc != SQLITE_OK) {
 53235  		goto __10
 53236  	}
 53237  	goto sql_error
 53238  __10:
 53239  	;
 53240  	iStep = 0
 53241  __11:
 53242  	if !(SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))) {
 53243  		goto __13
 53244  	}
 53245  	a1 = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)), 0)
 53246  	iCksum2 = iCksum2 + ((iCksum2 << 3) + uint32(a1))
 53247  	goto __12
 53248  __12:
 53249  	iStep++
 53250  	goto __11
 53251  	goto __13
 53252  __13:
 53253  	;
 53254  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* pStmt */)))
 53255  	if !(rc != SQLITE_OK) {
 53256  		goto __14
 53257  	}
 53258  	goto sql_error
 53259  __14:
 53260  	;
 53261  
 53262  	if !(iCksum1 != iCksum2) {
 53263  		goto __15
 53264  	}
 53265  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+19438 /* "checksum mismatc..." */, 0))
 53266  	return TCL_ERROR
 53267  __15:
 53268  	;
 53269  
 53270  	return TCL_OK
 53271  sql_error:
 53272  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+19456 /* "sql error: " */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 56 /* db */))), 0))
 53273  	return TCL_ERROR
 53274  }
 53275  
 53276  // tclcmd: bad_behavior TYPE
 53277  //
 53278  // Do some things that should trigger a valgrind or -fsanitize=undefined
 53279  // warning.  This is used to verify that errors and warnings output by those
 53280  // tools are detected by the test scripts.
 53281  //
 53282  //       TYPE       BEHAVIOR
 53283  //       1          Overflow a signed integer
 53284  //       2          Jump based on an uninitialized variable
 53285  //       3          Read after free
 53286  //       4          Panic
 53287  func test_bad_behavior(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7893:26: */
 53288  	bp := tls.Alloc(44)
 53289  	defer tls.Free(44)
 53290  
 53291  	// var iType int32 at bp, 4
 53292  
 53293  	var xyz int32
 53294  	var i int32 = *(*int32)(unsafe.Pointer(clientData))
 53295  	var j int32
 53296  	// var w [10]int32 at bp+4, 40
 53297  
 53298  	var a uintptr
 53299  	if objc != 2 {
 53300  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19468 /* "TYPE" */)
 53301  		return TCL_ERROR
 53302  	}
 53303  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &iType */) != 0 {
 53304  		return TCL_ERROR
 53305  	}
 53306  	switch *(*int32)(unsafe.Pointer(bp /* iType */)) {
 53307  	case 1:
 53308  		{
 53309  			xyz = (0x7fffff00 - i)
 53310  			xyz = xyz + (0x100)
 53311  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, xyz))
 53312  			break
 53313  
 53314  		}
 53315  	case 2:
 53316  		{
 53317  			*(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4)) = 5
 53318  			if *(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + uintptr(i)*4)) > 0 {
 53319  				*(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4))++
 53320  			}
 53321  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 4 /* &w[0] */ + 1*4))))
 53322  			break
 53323  
 53324  		}
 53325  	case 3:
 53326  		{
 53327  			a = libc.Xmalloc(tls, (uint32(unsafe.Sizeof(int32(0))) * uint32(10)))
 53328  			for j = 0; j < 10; j++ {
 53329  				*(*int32)(unsafe.Pointer(a + uintptr(j)*4)) = j
 53330  			}
 53331  			libc.Xfree(tls, a)
 53332  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(a + uintptr(i)*4))))
 53333  			break
 53334  
 53335  		}
 53336  	case 4:
 53337  		{
 53338  			tcl.XTcl_Panic(tls, ts+19473 /* "Deliberate panic" */, 0)
 53339  			break
 53340  
 53341  		}
 53342  	}
 53343  	return TCL_OK
 53344  }
 53345  
 53346  // tclcmd:   register_dbstat_vtab DB
 53347  //
 53348  // Cause the dbstat virtual table to be available on the connection DB
 53349  func test_register_dbstat_vtab(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7943:26: */
 53350  	bp := tls.Alloc(32)
 53351  	defer tls.Free(32)
 53352  
 53353  	var zDb uintptr
 53354  	// var cmdInfo Tcl_CmdInfo at bp, 32
 53355  
 53356  	if objc != 2 {
 53357  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 53358  		return TCL_ERROR
 53359  	}
 53360  
 53361  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 53362  	if tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp /* &cmdInfo */) != 0 {
 53363  		var db uintptr = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp /* &cmdInfo */)).FobjClientData)).Fdb
 53364  		sqlite3.Xsqlite3DbstatRegister(tls, db)
 53365  	}
 53366  	return TCL_OK
 53367  }
 53368  
 53369  // tclcmd:   sqlite3_db_config DB SETTING VALUE
 53370  //
 53371  // Invoke sqlite3_db_config() for one of the setting values.
 53372  func test_sqlite3_db_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:7977:26: */
 53373  	bp := tls.Alloc(24)
 53374  	defer tls.Free(24)
 53375  
 53376  	var i int32
 53377  	*(*int32)(unsafe.Pointer(bp + 20 /* v */)) = 0
 53378  	var zSetting uintptr
 53379  	// var db uintptr at bp+16, 4
 53380  
 53381  	if (objc != 4) && (objc != 3) {
 53382  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19490 /* "DB SETTING [VALU..." */)
 53383  		return TCL_ERROR
 53384  	}
 53385  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0 {
 53386  		return TCL_ERROR
 53387  	}
 53388  	zSetting = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 53389  	if sqlite3.Xsqlite3_strglob(tls, ts+19509 /* "SQLITE_*" */, zSetting) == 0 {
 53390  		zSetting += uintptr(7)
 53391  	}
 53392  	if sqlite3.Xsqlite3_strglob(tls, ts+19518 /* "DBCONFIG_*" */, zSetting) == 0 {
 53393  		zSetting += uintptr(9)
 53394  	}
 53395  	if sqlite3.Xsqlite3_strglob(tls, ts+19529 /* "ENABLE_*" */, zSetting) == 0 {
 53396  		zSetting += uintptr(7)
 53397  	}
 53398  	for i = 0; i < (int32(uint32(unsafe.Sizeof(aSetting)) / uint32(unsafe.Sizeof(struct {
 53399  		FzName uintptr
 53400  		FeVal  int32
 53401  	}{})))); i++ {
 53402  		if libc.Xstrcmp(tls, zSetting, aSetting[i].FzName) == 0 {
 53403  			break
 53404  		}
 53405  	}
 53406  	if i >= (int32(uint32(unsafe.Sizeof(aSetting)) / uint32(unsafe.Sizeof(struct {
 53407  		FzName uintptr
 53408  		FeVal  int32
 53409  	}{})))) {
 53410  		tcl.XTcl_SetObjResult(tls, interp,
 53411  			tcl.XTcl_NewStringObj(tls, ts+19538 /* "unknown sqlite3_..." */, -1))
 53412  		return TCL_ERROR
 53413  	}
 53414  	if objc == 4 {
 53415  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+20 /* &v */) != 0 {
 53416  			return TCL_ERROR
 53417  		}
 53418  	} else {
 53419  		*(*int32)(unsafe.Pointer(bp + 20 /* v */)) = -1
 53420  	}
 53421  	sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), aSetting[i].FeVal, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 20 /* v */)), bp+20 /* &v */))
 53422  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 20 /* v */))))
 53423  	return TCL_OK
 53424  }
 53425  
 53426  var aSetting = [14]struct {
 53427  	FzName uintptr
 53428  	FeVal  int32
 53429  }{
 53430  	{FzName: ts + 19572 /* "FKEY" */, FeVal: SQLITE_DBCONFIG_ENABLE_FKEY},
 53431  	{FzName: ts + 19577 /* "TRIGGER" */, FeVal: SQLITE_DBCONFIG_ENABLE_TRIGGER},
 53432  	{FzName: ts + 19585 /* "FTS3_TOKENIZER" */, FeVal: SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER},
 53433  	{FzName: ts + 19600 /* "LOAD_EXTENSION" */, FeVal: SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION},
 53434  	{FzName: ts + 19615 /* "NO_CKPT_ON_CLOSE" */, FeVal: SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE},
 53435  	{FzName: ts + 19632 /* "QPSG" */, FeVal: SQLITE_DBCONFIG_ENABLE_QPSG},
 53436  	{FzName: ts + 19637 /* "TRIGGER_EQP" */, FeVal: SQLITE_DBCONFIG_TRIGGER_EQP},
 53437  	{FzName: ts + 19649 /* "RESET_DB" */, FeVal: SQLITE_DBCONFIG_RESET_DATABASE},
 53438  	{FzName: ts + 19658 /* "DEFENSIVE" */, FeVal: SQLITE_DBCONFIG_DEFENSIVE},
 53439  	{FzName: ts + 19668 /* "WRITABLE_SCHEMA" */, FeVal: SQLITE_DBCONFIG_WRITABLE_SCHEMA},
 53440  	{FzName: ts + 19684 /* "LEGACY_ALTER_TAB..." */, FeVal: SQLITE_DBCONFIG_LEGACY_ALTER_TABLE},
 53441  	{FzName: ts + 19703 /* "DQS_DML" */, FeVal: SQLITE_DBCONFIG_DQS_DML},
 53442  	{FzName: ts + 19711 /* "DQS_DDL" */, FeVal: SQLITE_DBCONFIG_DQS_DDL},
 53443  	{FzName: ts + 19719 /* "LEGACY_FILE_FORM..." */, FeVal: SQLITE_DBCONFIG_LEGACY_FILE_FORMAT},
 53444  } /* test1.c:7986:5 */
 53445  
 53446  // tclcmd:   sqlite3_txn_state DB ?SCHEMA?
 53447  //
 53448  // Invoke sqlite3_txn_state(DB,SCHEMA) and return the
 53449  // numeric value that results.  Use NULL for SCHEMA if the 3 argument
 53450  // is omitted.
 53451  func test_sqlite3_txn_state(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8040:26: */
 53452  	bp := tls.Alloc(4)
 53453  	defer tls.Free(4)
 53454  
 53455  	// var db uintptr at bp, 4
 53456  
 53457  	var zSchema uintptr
 53458  	var iTxn int32
 53459  
 53460  	if (objc != 2) && (objc != 3) {
 53461  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19738 /* "DB ?SCHEMA?" */)
 53462  		return TCL_ERROR
 53463  	}
 53464  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 53465  		return TCL_ERROR
 53466  	}
 53467  	if objc == 3 {
 53468  		zSchema = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 53469  	} else {
 53470  		zSchema = uintptr(0)
 53471  	}
 53472  	iTxn = sqlite3.Xsqlite3_txn_state(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zSchema)
 53473  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iTxn))
 53474  	return TCL_OK
 53475  }
 53476  
 53477  // Change the name of the main database schema from "main" to "icecube".
 53478  func test_dbconfig_maindbname_icecube(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8064:26: */
 53479  	bp := tls.Alloc(12)
 53480  	defer tls.Free(12)
 53481  
 53482  	var rc int32
 53483  	// var db uintptr at bp+8, 4
 53484  
 53485  	if objc != 2 {
 53486  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 53487  		return TCL_ERROR
 53488  	} else {
 53489  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+8 /* &db */) != 0 {
 53490  			return TCL_ERROR
 53491  		}
 53492  		rc = sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* db */)), SQLITE_DBCONFIG_MAINDBNAME, libc.VaList(bp, ts+19750 /* "icecube" */))
 53493  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 53494  		return TCL_OK
 53495  	}
 53496  	return int32(0)
 53497  }
 53498  
 53499  // Usage: sqlite3_mmap_warm DB DBNAME
 53500  func test_mmap_warm(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8087:26: */
 53501  	bp := tls.Alloc(4)
 53502  	defer tls.Free(4)
 53503  
 53504  	if (objc != 2) && (objc != 3) {
 53505  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19758 /* "DB ?DBNAME?" */)
 53506  		return TCL_ERROR
 53507  	} else {
 53508  		var rc int32
 53509  		// var db uintptr at bp, 4
 53510  
 53511  		var zDb uintptr = uintptr(0)
 53512  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 53513  			return TCL_ERROR
 53514  		}
 53515  		if objc == 3 {
 53516  			zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 53517  		}
 53518  		rc = sqlite3_mmap_warm(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDb)
 53519  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 53520  		return TCL_OK
 53521  	}
 53522  	return int32(0)
 53523  }
 53524  
 53525  // Usage:  test_write_db DB OFFSET DATA
 53526  //
 53527  // Obtain the sqlite3_file* object for the database file for the "main" db
 53528  // of handle DB. Then invoke its xWrite method to write data DATA to offset
 53529  // OFFSET.
 53530  func test_write_db(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8120:26: */
 53531  	bp := tls.Alloc(24)
 53532  	defer tls.Free(24)
 53533  
 53534  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 53535  	*(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iOff */)) = int64(0)
 53536  	var aData uintptr = uintptr(0)
 53537  	*(*int32)(unsafe.Pointer(bp + 16 /* nData */)) = 0
 53538  	*(*uintptr)(unsafe.Pointer(bp + 20 /* pFile */)) = uintptr(0)
 53539  	var rc int32
 53540  
 53541  	if objc != 4 {
 53542  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19770 /* "DB OFFSET DATA" */)
 53543  		return TCL_ERROR
 53544  	}
 53545  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 53546  		return TCL_ERROR
 53547  	}
 53548  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+8 /* &iOff */) != 0 {
 53549  		return TCL_ERROR
 53550  	}
 53551  	aData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+16 /* &nData */)
 53552  
 53553  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp+20 /* &pFile */)
 53554  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 20 /* pFile */)))).FpMethods + 12 /* &.xWrite */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pFile */)), aData, *(*int32)(unsafe.Pointer(bp + 16 /* nData */)), *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iOff */)))
 53555  
 53556  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 53557  	return TCL_OK
 53558  }
 53559  
 53560  // Usage:  sqlite3_register_cksumvfs
 53561  //
 53562  func test_register_cksumvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8152:26: */
 53563  	if objc != 1 {
 53564  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 53565  		return TCL_ERROR
 53566  	} else {
 53567  		var rc int32 = sqlite3_register_cksumvfs(tls, uintptr(0))
 53568  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 53569  	}
 53570  	return TCL_OK
 53571  }
 53572  
 53573  // Usage:  sqlite3_unregister_cksumvfs
 53574  //
 53575  func test_unregister_cksumvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8173:26: */
 53576  	if objc != 1 {
 53577  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 53578  		return TCL_ERROR
 53579  	} else {
 53580  		var rc int32 = sqlite3_unregister_cksumvfs(tls)
 53581  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 53582  	}
 53583  	return TCL_OK
 53584  }
 53585  
 53586  // Usage:  decode_hexdb TEXT
 53587  //
 53588  // Example:   db deserialize [decode_hexdb $output_of_dbtotxt]
 53589  //
 53590  // This routine returns a byte-array for an SQLite database file that
 53591  // is constructed from a text input which is the output of the "dbtotxt"
 53592  // utility.
 53593  func test_decode_hexdb(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test1.c:8199:26: */
 53594  	bp := tls.Alloc(296)
 53595  	defer tls.Free(296)
 53596  
 53597  	var zIn uintptr = uintptr(0)
 53598  	var a uintptr = uintptr(0)
 53599  	*(*int32)(unsafe.Pointer(bp + 216 /* n */)) = 0
 53600  	var lineno int32 = 0
 53601  	var i int32
 53602  	var iNext int32
 53603  	var iOffset int32 = 0
 53604  	// var j int32 at bp+224, 4
 53605  
 53606  	// var k int32 at bp+228, 4
 53607  
 53608  	var rc int32
 53609  	// var x [16]uint32 at bp+232, 64
 53610  
 53611  	if objc != 2 {
 53612  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+19785 /* "HEXDB" */)
 53613  		return TCL_ERROR
 53614  	}
 53615  	zIn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 53616  	for i = 0; *(*int8)(unsafe.Pointer(zIn + uintptr(i))) != 0; i = iNext {
 53617  		lineno++
 53618  		for iNext = i; (*(*int8)(unsafe.Pointer(zIn + uintptr(iNext))) != 0) && (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iNext)))) != '\n'); iNext++ {
 53619  		}
 53620  		if int32(*(*int8)(unsafe.Pointer(zIn + uintptr(iNext)))) == '\n' {
 53621  			iNext++
 53622  		}
 53623  		for (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == ' ') || (int32(*(*int8)(unsafe.Pointer(zIn + uintptr(i)))) == '\t') {
 53624  			i++
 53625  		}
 53626  		if a == uintptr(0) {
 53627  			// var pgsz int32 at bp+220, 4
 53628  
 53629  			rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19791 /* "| size %d pagesi..." */, libc.VaList(bp, bp+216 /* &n */, bp+220 /* &pgsz */))
 53630  			if rc != 2 {
 53631  				continue
 53632  			}
 53633  			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) {
 53634  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+19813 /* "bad 'pagesize' f..." */, uintptr(0)))
 53635  				return TCL_ERROR
 53636  			}
 53637  			*(*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
 53638  			if *(*int32)(unsafe.Pointer(bp + 216 /* n */)) < 512 {
 53639  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+19834 /* "bad 'size' field" */, uintptr(0)))
 53640  				return TCL_ERROR
 53641  			}
 53642  			a = libc.Xmalloc(tls, uint32(*(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 53643  			if a == uintptr(0) {
 53644  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+1930 /* "out of memory" */, uintptr(0)))
 53645  				return TCL_ERROR
 53646  			}
 53647  			libc.Xmemset(tls, a, 0, uint32(*(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 53648  			continue
 53649  		}
 53650  		rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19851 /* "| page %d offset..." */, libc.VaList(bp+64, bp+224 /* &j */, bp+228 /* &k */))
 53651  		if rc == 2 {
 53652  			iOffset = *(*int32)(unsafe.Pointer(bp + 228 /* k */))
 53653  			continue
 53654  		}
 53655  		rc = libc.Xsscanf(tls, (zIn + uintptr(i)), ts+19871, /* "| %d: %x %x %x %..." */
 53656  			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),
 53657  				(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)))
 53658  		if rc == 17 {
 53659  			*(*int32)(unsafe.Pointer(bp + 228 /* k */)) = (iOffset + *(*int32)(unsafe.Pointer(bp + 224 /* j */)))
 53660  			if (*(*int32)(unsafe.Pointer(bp + 228 /* k */)) + 16) <= *(*int32)(unsafe.Pointer(bp + 216 /* n */)) {
 53661  				var ii int32
 53662  				for ii = 0; ii < 16; ii++ {
 53663  					*(*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)))
 53664  				}
 53665  			}
 53666  			continue
 53667  		}
 53668  	}
 53669  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, a, *(*int32)(unsafe.Pointer(bp + 216 /* n */))))
 53670  	libc.Xfree(tls, a)
 53671  	return TCL_OK
 53672  }
 53673  
 53674  // Register commands with the TCL interpreter.
 53675  func Sqlitetest1_Init(tls *libc.TLS, interp uintptr) int32 { /* test1.c:8271:5: */
 53676  	var i int32
 53677  
 53678  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd1)) / uint32(unsafe.Sizeof(struct {
 53679  		FzName uintptr
 53680  		FxProc uintptr
 53681  	}{}))); i++ {
 53682  		tcl.XTcl_CreateCommand(tls, interp, aCmd1[i].FzName, aCmd1[i].FxProc, uintptr(0), uintptr(0))
 53683  	}
 53684  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd1)) / uint32(unsafe.Sizeof(struct {
 53685  		FzName      uintptr
 53686  		FxProc      uintptr
 53687  		FclientData uintptr
 53688  	}{}))); i++ {
 53689  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd1[i].FzName,
 53690  			aObjCmd1[i].FxProc, aObjCmd1[i].FclientData, uintptr(0))
 53691  	}
 53692  	tcl.XTcl_LinkVar(tls, interp, ts+19925, /* "sqlite_search_co..." */
 53693  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_search_count)), TCL_LINK_INT)
 53694  	tcl.XTcl_LinkVar(tls, interp, ts+19945, /* "sqlite_found_cou..." */
 53695  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_found_count)), TCL_LINK_INT)
 53696  	tcl.XTcl_LinkVar(tls, interp, ts+19964, /* "sqlite_sort_coun..." */
 53697  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_sort_count)), TCL_LINK_INT)
 53698  	tcl.XTcl_LinkVar(tls, interp, ts+19982, /* "sqlite3_max_blob..." */
 53699  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_max_blobsize)), TCL_LINK_INT)
 53700  	tcl.XTcl_LinkVar(tls, interp, ts+20003, /* "sqlite_like_coun..." */
 53701  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_like_count)), TCL_LINK_INT)
 53702  	tcl.XTcl_LinkVar(tls, interp, ts+20021, /* "sqlite_interrupt..." */
 53703  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_interrupt_count)), TCL_LINK_INT)
 53704  	tcl.XTcl_LinkVar(tls, interp, ts+20044, /* "sqlite_open_file..." */
 53705  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_open_file_count)), TCL_LINK_INT)
 53706  	tcl.XTcl_LinkVar(tls, interp, ts+20067, /* "sqlite_current_t..." */
 53707  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_current_time)), TCL_LINK_INT)
 53708  	tcl.XTcl_LinkVar(tls, interp, ts+20087, /* "sqlite3_xferopt_..." */
 53709  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_xferopt_count)), TCL_LINK_INT)
 53710  	tcl.XTcl_LinkVar(tls, interp, ts+20109, /* "sqlite3_pager_re..." */
 53711  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_readdb_count)), TCL_LINK_INT)
 53712  	tcl.XTcl_LinkVar(tls, interp, ts+20136, /* "sqlite3_pager_wr..." */
 53713  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_writedb_count)), TCL_LINK_INT)
 53714  	tcl.XTcl_LinkVar(tls, interp, ts+20164, /* "sqlite3_pager_wr..." */
 53715  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_pager_writej_count)), TCL_LINK_INT)
 53716  	tcl.XTcl_LinkVar(tls, interp, ts+20191, /* "unaligned_string..." */
 53717  		uintptr(unsafe.Pointer(&unaligned_string_counter)), TCL_LINK_INT)
 53718  	tcl.XTcl_LinkVar(tls, interp, ts+20216, /* "sqlite_last_need..." */
 53719  		uintptr(unsafe.Pointer(&pzNeededCollation)), (TCL_LINK_STRING | TCL_LINK_READ_ONLY))
 53720  	{
 53721  		tcl.XTcl_LinkVar(tls, interp, ts+20245, /* "sqlite_query_pla..." */
 53722  			uintptr(unsafe.Pointer(&query_plan)), (TCL_LINK_STRING | TCL_LINK_READ_ONLY))
 53723  
 53724  	}
 53725  	tcl.XTcl_LinkVar(tls, interp, ts+20263, /* "sqlite_opentemp_..." */
 53726  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_opentemp_count)), TCL_LINK_INT)
 53727  	tcl.XTcl_LinkVar(tls, interp, ts+20285, /* "sqlite_static_bi..." */
 53728  		uintptr(unsafe.Pointer(&sqlite_static_bind_value)), TCL_LINK_STRING)
 53729  	tcl.XTcl_LinkVar(tls, interp, ts+20310, /* "sqlite_static_bi..." */
 53730  		uintptr(unsafe.Pointer(&sqlite_static_bind_nbyte)), TCL_LINK_INT)
 53731  	tcl.XTcl_LinkVar(tls, interp, ts+20335, /* "sqlite_temp_dire..." */
 53732  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_temp_directory)), TCL_LINK_STRING)
 53733  	tcl.XTcl_LinkVar(tls, interp, ts+20357, /* "sqlite_data_dire..." */
 53734  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_data_directory)), TCL_LINK_STRING)
 53735  	tcl.XTcl_LinkVar(tls, interp, ts+20379, /* "bitmask_size" */
 53736  		uintptr(unsafe.Pointer(&bitmask_size)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 53737  	tcl.XTcl_LinkVar(tls, interp, ts+20392, /* "longdouble_size" */
 53738  		uintptr(unsafe.Pointer(&longdouble_size)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 53739  	tcl.XTcl_LinkVar(tls, interp, ts+20408, /* "sqlite_sync_coun..." */
 53740  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_sync_count)), TCL_LINK_INT)
 53741  	tcl.XTcl_LinkVar(tls, interp, ts+20426, /* "sqlite_fullsync_..." */
 53742  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_fullsync_count)), TCL_LINK_INT)
 53743  	return TCL_OK
 53744  }
 53745  
 53746  var iZero int32 = 0 /* test1.c:8284:14 */
 53747  var aCmd1 = [40]struct {
 53748  	FzName uintptr
 53749  	FxProc uintptr
 53750  }{
 53751  	{FzName: ts + 20448 /* "db_enter" */, FxProc: 0},
 53752  	{FzName: ts + 20457 /* "db_leave" */, FxProc: 0},
 53753  	{FzName: ts + 20466 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53754  	{FzName: ts + 20486 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53755  	{FzName: ts + 20508 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53756  	{FzName: ts + 20529 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53757  	{FzName: ts + 20549 /* "sqlite3_snprintf..." */, FxProc: 0},
 53758  	{FzName: ts + 20570 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53759  	{FzName: ts + 20594 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53760  	{FzName: ts + 20617 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53761  	{FzName: ts + 20640 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53762  	{FzName: ts + 20666 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53763  	{FzName: ts + 20689 /* "sqlite3_mprintf_..." */, FxProc: 0},
 53764  	{FzName: ts + 20712 /* "sqlite3_snprintf..." */, FxProc: 0},
 53765  	{FzName: ts + 20733 /* "sqlite3_last_ins..." */, FxProc: 0},
 53766  	{FzName: ts + 20759 /* "sqlite3_exec_pri..." */, FxProc: 0},
 53767  	{FzName: ts + 20779 /* "sqlite3_exec_hex" */, FxProc: 0},
 53768  	{FzName: ts + 20796 /* "sqlite3_exec" */, FxProc: 0},
 53769  	{FzName: ts + 20809 /* "sqlite3_exec_nr" */, FxProc: 0},
 53770  	{FzName: ts + 20825 /* "sqlite3_get_tabl..." */, FxProc: 0},
 53771  	{FzName: ts + 20850 /* "sqlite3_close" */, FxProc: 0},
 53772  	{FzName: ts + 20864 /* "sqlite3_close_v2" */, FxProc: 0},
 53773  	{FzName: ts + 20881 /* "sqlite3_create_f..." */, FxProc: 0},
 53774  	{FzName: ts + 20905 /* "sqlite3_create_a..." */, FxProc: 0},
 53775  	{FzName: ts + 20930 /* "sqlite3_drop_mod..." */, FxProc: 0},
 53776  	{FzName: ts + 20951 /* "sqlite_register_..." */, FxProc: 0},
 53777  	{FzName: ts + 20981 /* "sqlite_abort" */, FxProc: 0},
 53778  	{FzName: ts + 20994 /* "sqlite_bind" */, FxProc: 0},
 53779  	{FzName: ts + 21006 /* "breakpoint" */, FxProc: 0},
 53780  	{FzName: ts + 21017 /* "sqlite3_key" */, FxProc: 0},
 53781  	{FzName: ts + 21029 /* "sqlite3_rekey" */, FxProc: 0},
 53782  	{FzName: ts + 21043 /* "sqlite_set_magic" */, FxProc: 0},
 53783  	{FzName: ts + 21060 /* "sqlite3_interrup..." */, FxProc: 0},
 53784  	{FzName: ts + 21078 /* "sqlite_delete_fu..." */, FxProc: 0},
 53785  	{FzName: ts + 21101 /* "sqlite_delete_co..." */, FxProc: 0},
 53786  	{FzName: ts + 21125 /* "sqlite3_get_auto..." */, FxProc: 0},
 53787  	{FzName: ts + 21148 /* "sqlite3_busy_tim..." */, FxProc: 0},
 53788  	{FzName: ts + 21169 /* "printf" */, FxProc: 0},
 53789  	{FzName: ts + 21176 /* "sqlite3IoTrace" */, FxProc: 0},
 53790  	{FzName: ts + 21191 /* "clang_sanitize_a..." */, FxProc: 0},
 53791  } /* test1.c:8288:5 */
 53792  var aObjCmd1 = [161]struct {
 53793  	FzName      uintptr
 53794  	FxProc      uintptr
 53795  	FclientData uintptr
 53796  }{
 53797  	{FzName: ts + 21214 /* "sqlite3_db_confi..." */, FxProc: 0},
 53798  	{FzName: ts + 21232 /* "sqlite3_txn_stat..." */, FxProc: 0},
 53799  	{FzName: ts + 21250 /* "bad_behavior" */, FxProc: 0, FclientData: 0},
 53800  	{FzName: ts + 21263 /* "register_dbstat_..." */, FxProc: 0},
 53801  	{FzName: ts + 21284 /* "sqlite3_connecti..." */, FxProc: 0},
 53802  	{FzName: ts + 21311 /* "intarray_addr" */, FxProc: 0},
 53803  	{FzName: ts + 21325 /* "int64array_addr" */, FxProc: 0},
 53804  	{FzName: ts + 21341 /* "doublearray_addr" */, FxProc: 0},
 53805  	{FzName: ts + 21358 /* "textarray_addr" */, FxProc: 0},
 53806  	{FzName: ts + 21373 /* "sqlite3_bind_int" */, FxProc: 0},
 53807  	{FzName: ts + 21390 /* "sqlite3_bind_zer..." */, FxProc: 0},
 53808  	{FzName: ts + 21412 /* "sqlite3_bind_zer..." */, FxProc: 0},
 53809  	{FzName: ts + 21436 /* "sqlite3_bind_int..." */, FxProc: 0},
 53810  	{FzName: ts + 21455 /* "sqlite3_bind_dou..." */, FxProc: 0},
 53811  	{FzName: ts + 21475 /* "sqlite3_bind_nul..." */, FxProc: 0},
 53812  	{FzName: ts + 21493 /* "sqlite3_bind_tex..." */, FxProc: 0},
 53813  	{FzName: ts + 21511 /* "sqlite3_bind_tex..." */, FxProc: 0},
 53814  	{FzName: ts + 21531 /* "sqlite3_bind_blo..." */, FxProc: 0},
 53815  	{FzName: ts + 21549 /* "sqlite3_carray_b..." */, FxProc: 0},
 53816  	{FzName: ts + 21569 /* "sqlite3_bind_par..." */, FxProc: 0},
 53817  	{FzName: ts + 21598 /* "sqlite3_bind_par..." */, FxProc: 0},
 53818  	{FzName: ts + 21626 /* "sqlite3_bind_par..." */, FxProc: 0},
 53819  	{FzName: ts + 21655 /* "sqlite3_clear_bi..." */, FxProc: 0},
 53820  	{FzName: ts + 21678 /* "sqlite3_sleep" */, FxProc: 0},
 53821  	{FzName: ts + 21692 /* "sqlite3_errcode" */, FxProc: 0},
 53822  	{FzName: ts + 21708 /* "sqlite3_extended..." */, FxProc: 0},
 53823  	{FzName: ts + 21733 /* "sqlite3_errmsg" */, FxProc: 0},
 53824  	{FzName: ts + 21748 /* "sqlite3_errmsg16" */, FxProc: 0},
 53825  	{FzName: ts + 21765 /* "sqlite3_open" */, FxProc: 0},
 53826  	{FzName: ts + 21778 /* "sqlite3_open16" */, FxProc: 0},
 53827  	{FzName: ts + 21793 /* "sqlite3_open_v2" */, FxProc: 0},
 53828  	{FzName: ts + 21809 /* "sqlite3_complete..." */, FxProc: 0},
 53829  	{FzName: ts + 21828 /* "sqlite3_normaliz..." */, FxProc: 0},
 53830  
 53831  	{FzName: ts + 21846 /* "sqlite3_prepare" */, FxProc: 0},
 53832  	{FzName: ts + 21862 /* "sqlite3_prepare1..." */, FxProc: 0},
 53833  	{FzName: ts + 21880 /* "sqlite3_prepare_..." */, FxProc: 0},
 53834  	{FzName: ts + 21899 /* "sqlite3_prepare_..." */, FxProc: 0},
 53835  	{FzName: ts + 21918 /* "sqlite3_prepare_..." */, FxProc: 0},
 53836  	{FzName: ts + 21942 /* "sqlite3_prepare1..." */, FxProc: 0},
 53837  	{FzName: ts + 21963 /* "sqlite3_finalize" */, FxProc: 0},
 53838  	{FzName: ts + 21980 /* "sqlite3_stmt_sta..." */, FxProc: 0},
 53839  	{FzName: ts + 22000 /* "sqlite3_reset" */, FxProc: 0},
 53840  	{FzName: ts + 22014 /* "sqlite3_expired" */, FxProc: 0},
 53841  	{FzName: ts + 22030 /* "sqlite3_transfer..." */, FxProc: 0},
 53842  	{FzName: ts + 22056 /* "sqlite3_changes" */, FxProc: 0},
 53843  	{FzName: ts + 22072 /* "sqlite3_step" */, FxProc: 0},
 53844  	{FzName: ts + 22085 /* "sqlite3_sql" */, FxProc: 0},
 53845  	{FzName: ts + 22097 /* "sqlite3_expanded..." */, FxProc: 0},
 53846  	{FzName: ts + 22118 /* "sqlite3_next_stm..." */, FxProc: 0},
 53847  	{FzName: ts + 22136 /* "sqlite3_stmt_rea..." */, FxProc: 0},
 53848  	{FzName: ts + 22158 /* "sqlite3_stmt_ise..." */, FxProc: 0},
 53849  	{FzName: ts + 22181 /* "sqlite3_stmt_bus..." */, FxProc: 0},
 53850  	{FzName: ts + 22199 /* "uses_stmt_journa..." */, FxProc: 0},
 53851  
 53852  	{FzName: ts + 22217 /* "sqlite3_release_..." */, FxProc: 0},
 53853  	{FzName: ts + 22240 /* "sqlite3_db_relea..." */, FxProc: 0},
 53854  	{FzName: ts + 22266 /* "sqlite3_db_cache..." */, FxProc: 0},
 53855  	{FzName: ts + 22288 /* "sqlite3_system_e..." */, FxProc: 0},
 53856  	{FzName: ts + 22309 /* "sqlite3_db_filen..." */, FxProc: 0},
 53857  	{FzName: ts + 22329 /* "sqlite3_db_reado..." */, FxProc: 0},
 53858  	{FzName: ts + 22349 /* "sqlite3_soft_hea..." */, FxProc: 0},
 53859  	{FzName: ts + 22373 /* "sqlite3_soft_hea..." */, FxProc: 0},
 53860  	{FzName: ts + 22399 /* "sqlite3_hard_hea..." */, FxProc: 0},
 53861  	{FzName: ts + 22425 /* "sqlite3_thread_c..." */, FxProc: 0},
 53862  	{FzName: ts + 22448 /* "sqlite3_pager_re..." */, FxProc: 0},
 53863  
 53864  	{FzName: ts + 22472 /* "sqlite3_load_ext..." */, FxProc: 0},
 53865  	{FzName: ts + 22495 /* "sqlite3_enable_l..." */, FxProc: 0},
 53866  	{FzName: ts + 22525 /* "sqlite3_extended..." */, FxProc: 0},
 53867  	{FzName: ts + 22555 /* "sqlite3_limit" */, FxProc: 0},
 53868  	{FzName: ts + 22569 /* "dbconfig_maindbn..." */, FxProc: 0},
 53869  
 53870  	{FzName: ts + 22597 /* "save_prng_state" */, FxProc: 0},
 53871  	{FzName: ts + 22613 /* "restore_prng_sta..." */, FxProc: 0},
 53872  	{FzName: ts + 22632 /* "reset_prng_state" */, FxProc: 0},
 53873  	{FzName: ts + 22649 /* "prng_seed" */, FxProc: 0},
 53874  	{FzName: ts + 22659 /* "extra_schema_che..." */, FxProc: 0},
 53875  	{FzName: ts + 22679 /* "database_never_c..." */, FxProc: 0},
 53876  	{FzName: ts + 22702 /* "database_may_be_..." */, FxProc: 0},
 53877  	{FzName: ts + 22726 /* "optimization_con..." */, FxProc: 0},
 53878  	{FzName: ts + 22747 /* "tcl_objproc" */, FxProc: 0},
 53879  
 53880  	// sqlite3_column_*() API
 53881  	{FzName: ts + 22759 /* "sqlite3_column_c..." */, FxProc: 0},
 53882  	{FzName: ts + 22780 /* "sqlite3_data_cou..." */, FxProc: 0},
 53883  	{FzName: ts + 22799 /* "sqlite3_column_t..." */, FxProc: 0},
 53884  	{FzName: ts + 22819 /* "sqlite3_column_b..." */, FxProc: 0},
 53885  	{FzName: ts + 22839 /* "sqlite3_column_d..." */, FxProc: 0},
 53886  	{FzName: ts + 22861 /* "sqlite3_column_i..." */, FxProc: 0},
 53887  	{FzName: ts + 22882 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 53888  	{FzName: ts + 22902 /* "sqlite3_column_n..." */, FxProc: 0, FclientData: 0},
 53889  	{FzName: ts + 22922 /* "sqlite3_column_i..." */, FxProc: 0, FclientData: 0},
 53890  	{FzName: ts + 22941 /* "sqlite3_column_b..." */, FxProc: 0, FclientData: 0},
 53891  	{FzName: ts + 22962 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 53892  	{FzName: ts + 22986 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 53893  	{FzName: ts + 23015 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 53894  	{FzName: ts + 23041 /* "sqlite3_column_o..." */, FxProc: 0, FclientData: 0},
 53895  
 53896  	{FzName: ts + 23068 /* "sqlite3_column_b..." */, FxProc: 0, FclientData: 0},
 53897  	{FzName: ts + 23091 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 53898  	{FzName: ts + 23113 /* "sqlite3_column_n..." */, FxProc: 0, FclientData: 0},
 53899  	{FzName: ts + 23135 /* "add_alignment_te..." */, FxProc: 0},
 53900  	{FzName: ts + 23165 /* "sqlite3_column_d..." */, FxProc: 0, FclientData: 0},
 53901  	{FzName: ts + 23191, /* "sqlite3_column_d..." */
 53902  		FxProc: 0, FclientData: 0},
 53903  	{FzName: ts + 23222 /* "sqlite3_column_t..." */, FxProc: 0, FclientData: 0},
 53904  	{FzName: ts + 23250 /* "sqlite3_column_o..." */, FxProc: 0, FclientData: 0},
 53905  	{FzName: ts + 23279 /* "sqlite3_create_c..." */, FxProc: 0},
 53906  	{FzName: ts + 23307 /* "sqlite3_global_r..." */, FxProc: 0},
 53907  	{FzName: ts + 23330 /* "working_64bit_in..." */, FxProc: 0},
 53908  	{FzName: ts + 23348 /* "vfs_unlink_test" */, FxProc: 0},
 53909  	{FzName: ts + 23364 /* "vfs_initfail_tes..." */, FxProc: 0},
 53910  	{FzName: ts + 23382 /* "vfs_unregister_a..." */, FxProc: 0},
 53911  	{FzName: ts + 23401 /* "vfs_reregister_a..." */, FxProc: 0},
 53912  	{FzName: ts + 23420 /* "file_control_tes..." */, FxProc: 0},
 53913  	{FzName: ts + 23438 /* "file_control_las..." */, FxProc: 0},
 53914  	{FzName: ts + 23466 /* "file_control_loc..." */, FxProc: 0},
 53915  	{FzName: ts + 23494 /* "file_control_chu..." */, FxProc: 0},
 53916  	{FzName: ts + 23522 /* "file_control_siz..." */, FxProc: 0},
 53917  	{FzName: ts + 23549 /* "file_control_dat..." */, FxProc: 0},
 53918  	{FzName: ts + 23575 /* "file_control_per..." */, FxProc: 0},
 53919  	{FzName: ts + 23600 /* "file_control_pow..." */, FxProc: 0},
 53920  	{FzName: ts + 23633 /* "file_control_vfs..." */, FxProc: 0},
 53921  	{FzName: ts + 23654 /* "file_control_res..." */, FxProc: 0},
 53922  	{FzName: ts + 23680 /* "file_control_tem..." */, FxProc: 0},
 53923  	{FzName: ts + 23706 /* "file_control_ext..." */, FxProc: 0},
 53924  	{FzName: ts + 23735 /* "sqlite3_vfs_list" */, FxProc: 0},
 53925  	{FzName: ts + 23752 /* "sqlite3_create_f..." */, FxProc: 0},
 53926  
 53927  	// Functions from os.h
 53928  	{FzName: ts + 23779 /* "add_test_collate" */, FxProc: 0},
 53929  	{FzName: ts + 23796 /* "add_test_collate..." */, FxProc: 0},
 53930  	{FzName: ts + 23820 /* "add_test_functio..." */, FxProc: 0},
 53931  	{FzName: ts + 23838 /* "add_test_utf16bi..." */, FxProc: 0},
 53932  	{FzName: ts + 23864 /* "sqlite3_test_err..." */, FxProc: 0},
 53933  	{FzName: ts + 23884 /* "tcl_variable_typ..." */, FxProc: 0},
 53934  	{FzName: ts + 23902 /* "sqlite3_enable_s..." */, FxProc: 0},
 53935  	{FzName: ts + 23930 /* "sqlite3_shared_c..." */, FxProc: 0},
 53936  	{FzName: ts + 23958 /* "sqlite3_libversi..." */, FxProc: 0},
 53937  	{FzName: ts + 23984 /* "sqlite3_table_co..." */, FxProc: 0},
 53938  	{FzName: ts + 24014 /* "sqlite3_blob_reo..." */, FxProc: 0},
 53939  	{FzName: ts + 24034 /* "pcache_stats" */, FxProc: 0},
 53940  	{FzName: ts + 24047 /* "sqlite3_unlock_n..." */, FxProc: 0},
 53941  	{FzName: ts + 24069 /* "sqlite3_wal_chec..." */, FxProc: 0},
 53942  	{FzName: ts + 24092 /* "sqlite3_wal_chec..." */, FxProc: 0},
 53943  	{FzName: ts + 24118 /* "sqlite3_wal_auto..." */, FxProc: 0},
 53944  	{FzName: ts + 24145 /* "test_sqlite3_log" */, FxProc: 0},
 53945  	{FzName: ts + 24162 /* "print_explain_qu..." */, FxProc: 0},
 53946  	{FzName: ts + 24187 /* "sqlite3_test_con..." */, FxProc: 0},
 53947  	{FzName: ts + 24208 /* "getrusage" */, FxProc: 0},
 53948  	{FzName: ts + 24218 /* "load_static_exte..." */, FxProc: 0},
 53949  	{FzName: ts + 24240 /* "sorter_test_fake..." */, FxProc: 0},
 53950  	{FzName: ts + 24261 /* "sorter_test_sort..." */, FxProc: 0},
 53951  	{FzName: ts + 24286 /* "vfs_current_time..." */, FxProc: 0},
 53952  	{FzName: ts + 24309 /* "sqlite3_snapshot..." */, FxProc: 0},
 53953  	{FzName: ts + 24330 /* "sqlite3_snapshot..." */, FxProc: 0},
 53954  	{FzName: ts + 24352 /* "sqlite3_snapshot..." */, FxProc: 0},
 53955  	{FzName: ts + 24374 /* "sqlite3_snapshot..." */, FxProc: 0},
 53956  	{FzName: ts + 24395 /* "sqlite3_snapshot..." */, FxProc: 0},
 53957  	{FzName: ts + 24420 /* "sqlite3_snapshot..." */, FxProc: 0},
 53958  	{FzName: ts + 24446 /* "sqlite3_snapshot..." */, FxProc: 0},
 53959  	{FzName: ts + 24473 /* "sqlite3_snapshot..." */, FxProc: 0},
 53960  	{FzName: ts + 24499 /* "sqlite3_delete_d..." */, FxProc: 0},
 53961  	{FzName: ts + 24523 /* "atomic_batch_wri..." */, FxProc: 0},
 53962  	{FzName: ts + 24542 /* "sqlite3_mmap_war..." */, FxProc: 0},
 53963  	{FzName: ts + 24560 /* "sqlite3_config_s..." */, FxProc: 0},
 53964  	{FzName: ts + 24585 /* "decode_hexdb" */, FxProc: 0},
 53965  	{FzName: ts + 24598 /* "test_write_db" */, FxProc: 0},
 53966  	{FzName: ts + 24612 /* "sqlite3_register..." */, FxProc: 0},
 53967  	{FzName: ts + 24638 /* "sqlite3_unregist..." */, FxProc: 0},
 53968  }                                                                               /* test1.c:8336:5 */
 53969  var bitmask_size int32 = (int32(uint32(unsafe.Sizeof(Bitmask(0))) * uint32(8))) /* test1.c:8564:14 */
 53970  var longdouble_size int32 = int32(unsafe.Sizeof(float64(0)))                    /* test1.c:8565:14 */
 53971  var query_plan uintptr = ts + 24666                                             /* "*** OBSOLETE VAR..." */ /* test1.c:8637:23 */
 53972  
 53973  // Page size and reserved size used for testing.
 53974  var test_pagesize int32 = 1024 /* test2.c:31:12 */
 53975  
 53976  // Dummy page reinitializer
 53977  func pager_test_reiniter(tls *libc.TLS, pNotUsed uintptr) { /* test2.c:36:13: */
 53978  	return
 53979  }
 53980  
 53981  // Usage:   pager_open FILENAME N-PAGE
 53982  //
 53983  // Open a new pager
 53984  func pager_open(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:45:26: */
 53985  	bp := tls.Alloc(184)
 53986  	defer tls.Free(184)
 53987  
 53988  	// var pageSize u32 at bp+80, 4
 53989  
 53990  	// var pPager uintptr at bp+76, 4
 53991  
 53992  	// var nPage int32 at bp+72, 4
 53993  
 53994  	var rc int32
 53995  	// var zBuf [100]int8 at bp+84, 100
 53996  
 53997  	if argc != 3 {
 53998  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 53999  			ts+24692 /* " FILENAME N-PAGE..." */, 0))
 54000  		return TCL_ERROR
 54001  	}
 54002  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+72 /* &nPage */) != 0 {
 54003  		return TCL_ERROR
 54004  	}
 54005  	rc = sqlite3.Xsqlite3PagerOpen(tls, sqlite3.Xsqlite3_vfs_find(tls, uintptr(0)), bp+76 /* &pPager */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), 0, 0,
 54006  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_MAIN_DB),
 54007  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{pager_test_reiniter})))
 54008  	if rc != SQLITE_OK {
 54009  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54010  		return TCL_ERROR
 54011  	}
 54012  	sqlite3.Xsqlite3PagerSetCachesize(tls, *(*uintptr)(unsafe.Pointer(bp + 76 /* pPager */)), *(*int32)(unsafe.Pointer(bp + 72 /* nPage */)))
 54013  	*(*u32)(unsafe.Pointer(bp + 80 /* pageSize */)) = u32(test_pagesize)
 54014  	sqlite3.Xsqlite3PagerSetPagesize(tls, *(*uintptr)(unsafe.Pointer(bp + 76 /* pPager */)), bp+80 /* &pageSize */, -1)
 54015  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+84 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 76 /* pPager */))))
 54016  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+84 /* &zBuf[0] */, 0))
 54017  	return TCL_OK
 54018  }
 54019  
 54020  // Usage:   pager_close ID
 54021  //
 54022  // Close the given pager.
 54023  func pager_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:82:26: */
 54024  	bp := tls.Alloc(48)
 54025  	defer tls.Free(48)
 54026  
 54027  	var pPager uintptr
 54028  	var rc int32
 54029  	if argc != 2 {
 54030  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54031  			ts+24710 /* " ID\"" */, 0))
 54032  		return TCL_ERROR
 54033  	}
 54034  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54035  	rc = sqlite3.Xsqlite3PagerClose(tls, pPager, uintptr(0))
 54036  	if rc != SQLITE_OK {
 54037  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54038  		return TCL_ERROR
 54039  	}
 54040  	return TCL_OK
 54041  }
 54042  
 54043  // Usage:   pager_rollback ID
 54044  //
 54045  // Rollback changes
 54046  func pager_rollback(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:109:26: */
 54047  	bp := tls.Alloc(48)
 54048  	defer tls.Free(48)
 54049  
 54050  	var pPager uintptr
 54051  	var rc int32
 54052  	if argc != 2 {
 54053  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54054  			ts+24710 /* " ID\"" */, 0))
 54055  		return TCL_ERROR
 54056  	}
 54057  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54058  	rc = sqlite3.Xsqlite3PagerRollback(tls, pPager)
 54059  	if rc != SQLITE_OK {
 54060  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54061  		return TCL_ERROR
 54062  	}
 54063  	return TCL_OK
 54064  }
 54065  
 54066  // Usage:   pager_commit ID
 54067  //
 54068  // Commit all changes
 54069  func pager_commit(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:136:26: */
 54070  	bp := tls.Alloc(64)
 54071  	defer tls.Free(64)
 54072  
 54073  	var pPager uintptr
 54074  	var rc int32
 54075  	if argc != 2 {
 54076  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54077  			ts+24710 /* " ID\"" */, 0))
 54078  		return TCL_ERROR
 54079  	}
 54080  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54081  	rc = sqlite3.Xsqlite3PagerCommitPhaseOne(tls, pPager, uintptr(0), 0)
 54082  	if rc != SQLITE_OK {
 54083  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54084  		return TCL_ERROR
 54085  	}
 54086  	rc = sqlite3.Xsqlite3PagerCommitPhaseTwo(tls, pPager)
 54087  	if rc != SQLITE_OK {
 54088  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54089  		return TCL_ERROR
 54090  	}
 54091  	return TCL_OK
 54092  }
 54093  
 54094  // Usage:   pager_stmt_begin ID
 54095  //
 54096  // Start a new checkpoint.
 54097  func pager_stmt_begin(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:168:26: */
 54098  	bp := tls.Alloc(48)
 54099  	defer tls.Free(48)
 54100  
 54101  	var pPager uintptr
 54102  	var rc int32
 54103  	if argc != 2 {
 54104  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54105  			ts+24710 /* " ID\"" */, 0))
 54106  		return TCL_ERROR
 54107  	}
 54108  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54109  	rc = sqlite3.Xsqlite3PagerOpenSavepoint(tls, pPager, 1)
 54110  	if rc != SQLITE_OK {
 54111  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54112  		return TCL_ERROR
 54113  	}
 54114  	return TCL_OK
 54115  }
 54116  
 54117  // Usage:   pager_stmt_rollback ID
 54118  //
 54119  // Rollback changes to a checkpoint
 54120  func pager_stmt_rollback(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:195:26: */
 54121  	bp := tls.Alloc(48)
 54122  	defer tls.Free(48)
 54123  
 54124  	var pPager uintptr
 54125  	var rc int32
 54126  	if argc != 2 {
 54127  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54128  			ts+24710 /* " ID\"" */, 0))
 54129  		return TCL_ERROR
 54130  	}
 54131  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54132  	rc = sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_ROLLBACK, 0)
 54133  	sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_RELEASE, 0)
 54134  	if rc != SQLITE_OK {
 54135  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54136  		return TCL_ERROR
 54137  	}
 54138  	return TCL_OK
 54139  }
 54140  
 54141  // Usage:   pager_stmt_commit ID
 54142  //
 54143  // Commit changes to a checkpoint
 54144  func pager_stmt_commit(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:223:26: */
 54145  	bp := tls.Alloc(48)
 54146  	defer tls.Free(48)
 54147  
 54148  	var pPager uintptr
 54149  	var rc int32
 54150  	if argc != 2 {
 54151  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54152  			ts+24710 /* " ID\"" */, 0))
 54153  		return TCL_ERROR
 54154  	}
 54155  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54156  	rc = sqlite3.Xsqlite3PagerSavepoint(tls, pPager, SAVEPOINT_RELEASE, 0)
 54157  	if rc != SQLITE_OK {
 54158  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54159  		return TCL_ERROR
 54160  	}
 54161  	return TCL_OK
 54162  }
 54163  
 54164  // Usage:   pager_stats ID
 54165  //
 54166  // Return pager statistics.
 54167  func pager_stats(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:250:26: */
 54168  	bp := tls.Alloc(140)
 54169  	defer tls.Free(140)
 54170  
 54171  	var pPager uintptr
 54172  	var i int32
 54173  	var a uintptr
 54174  	if argc != 2 {
 54175  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54176  			ts+24710 /* " ID\"" */, 0))
 54177  		return TCL_ERROR
 54178  	}
 54179  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54180  	a = sqlite3.Xsqlite3PagerStats(tls, pPager)
 54181  	for i = 0; i < 9; i++ {
 54182  		// var zBuf [100]int8 at bp+40, 100
 54183  
 54184  		tcl.XTcl_AppendElement(tls, interp, zName[i])
 54185  		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))))
 54186  		tcl.XTcl_AppendElement(tls, interp, bp+40 /* &zBuf[0] */)
 54187  	}
 54188  	return TCL_OK
 54189  }
 54190  
 54191  var zName = [9]uintptr{
 54192  	ts + 24715 /* "ref" */, ts + 24719 /* "page" */, ts + 18693 /* "max" */, ts + 12279 /* "size" */, ts + 10193 /* "state" */, ts + 24724, /* "err" */
 54193  	ts + 24728 /* "hit" */, ts + 24732 /* "miss" */, ts + 24737, /* "ovfl" */
 54194  } /* test2.c:266:17 */
 54195  
 54196  // Usage:   pager_pagecount ID
 54197  //
 54198  // Return the size of the database file.
 54199  func pager_pagecount(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:283:26: */
 54200  	bp := tls.Alloc(160)
 54201  	defer tls.Free(160)
 54202  
 54203  	var pPager uintptr
 54204  	// var zBuf [100]int8 at bp+60, 100
 54205  
 54206  	// var nPage int32 at bp+56, 4
 54207  
 54208  	if argc != 2 {
 54209  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54210  			ts+24710 /* " ID\"" */, 0))
 54211  		return TCL_ERROR
 54212  	}
 54213  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54214  	sqlite3.Xsqlite3PagerPagecount(tls, pPager, bp+56 /* &nPage */)
 54215  	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 */))))
 54216  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 54217  	return TCL_OK
 54218  }
 54219  
 54220  // Usage:   page_get ID PGNO
 54221  //
 54222  // Return a pointer to a page from the database.
 54223  func page_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:309:26: */
 54224  	bp := tls.Alloc(180)
 54225  	defer tls.Free(180)
 54226  
 54227  	var pPager uintptr
 54228  	// var zBuf [100]int8 at bp+80, 100
 54229  
 54230  	*(*uintptr)(unsafe.Pointer(bp + 76 /* pPage */)) = uintptr(0)
 54231  	// var pgno int32 at bp+72, 4
 54232  
 54233  	var rc int32
 54234  	if argc != 3 {
 54235  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54236  			ts+24742 /* " ID PGNO\"" */, 0))
 54237  		return TCL_ERROR
 54238  	}
 54239  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54240  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+72 /* &pgno */) != 0 {
 54241  		return TCL_ERROR
 54242  	}
 54243  	rc = sqlite3.Xsqlite3PagerSharedLock(tls, pPager)
 54244  	if rc == SQLITE_OK {
 54245  		rc = sqlite3.Xsqlite3PagerGet(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* pgno */))), bp+76 /* &pPage */, 0)
 54246  	}
 54247  	if rc != SQLITE_OK {
 54248  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54249  		return TCL_ERROR
 54250  	}
 54251  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+80 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 76 /* pPage */))))
 54252  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+80 /* &zBuf[0] */, 0))
 54253  	return TCL_OK
 54254  }
 54255  
 54256  // Usage:   page_lookup ID PGNO
 54257  //
 54258  // Return a pointer to a page if the page is already in cache.
 54259  // If not in cache, return an empty string.
 54260  func page_lookup(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:346:26: */
 54261  	bp := tls.Alloc(160)
 54262  	defer tls.Free(160)
 54263  
 54264  	var pPager uintptr
 54265  	// var zBuf [100]int8 at bp+60, 100
 54266  
 54267  	var pPage uintptr
 54268  	// var pgno int32 at bp+56, 4
 54269  
 54270  	if argc != 3 {
 54271  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54272  			ts+24742 /* " ID PGNO\"" */, 0))
 54273  		return TCL_ERROR
 54274  	}
 54275  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54276  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+56 /* &pgno */) != 0 {
 54277  		return TCL_ERROR
 54278  	}
 54279  	pPage = sqlite3.Xsqlite3PagerLookup(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 56 /* pgno */))))
 54280  	if pPage != 0 {
 54281  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+60 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+32, pPage))
 54282  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+60 /* &zBuf[0] */, 0))
 54283  	}
 54284  	return TCL_OK
 54285  }
 54286  
 54287  // Usage:   pager_truncate ID PGNO
 54288  func pager_truncate(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:374:26: */
 54289  	bp := tls.Alloc(36)
 54290  	defer tls.Free(36)
 54291  
 54292  	var pPager uintptr
 54293  	// var pgno int32 at bp+32, 4
 54294  
 54295  	if argc != 3 {
 54296  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54297  			ts+24742 /* " ID PGNO\"" */, 0))
 54298  		return TCL_ERROR
 54299  	}
 54300  	pPager = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54301  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+32 /* &pgno */) != 0 {
 54302  		return TCL_ERROR
 54303  	}
 54304  	sqlite3.Xsqlite3PagerTruncateImage(tls, pPager, uint32(*(*int32)(unsafe.Pointer(bp + 32 /* pgno */))))
 54305  	return TCL_OK
 54306  }
 54307  
 54308  // Usage:   page_unref PAGE
 54309  //
 54310  // Drop a pointer to a page.
 54311  func page_unref(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:399:26: */
 54312  	bp := tls.Alloc(32)
 54313  	defer tls.Free(32)
 54314  
 54315  	var pPage uintptr
 54316  	if argc != 2 {
 54317  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54318  			ts+24752 /* " PAGE\"" */, 0))
 54319  		return TCL_ERROR
 54320  	}
 54321  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54322  	sqlite3.Xsqlite3PagerUnref(tls, pPage)
 54323  	return TCL_OK
 54324  }
 54325  
 54326  // Usage:   page_read PAGE
 54327  //
 54328  // Return the content of a page
 54329  func page_read(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:421:26: */
 54330  	bp := tls.Alloc(148)
 54331  	defer tls.Free(148)
 54332  
 54333  	// var zBuf [100]int8 at bp+48, 100
 54334  
 54335  	var pPage uintptr
 54336  	if argc != 2 {
 54337  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54338  			ts+24752 /* " PAGE\"" */, 0))
 54339  		return TCL_ERROR
 54340  	}
 54341  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54342  	libc.Xmemcpy(tls, bp+48 /* &zBuf[0] */, sqlite3.Xsqlite3PagerGetData(tls, pPage), uint32(unsafe.Sizeof([100]int8{})))
 54343  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+48 /* &zBuf[0] */, 0))
 54344  	return TCL_OK
 54345  }
 54346  
 54347  // Usage:   page_number PAGE
 54348  //
 54349  // Return the page number for a page.
 54350  func page_number(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:445:26: */
 54351  	bp := tls.Alloc(156)
 54352  	defer tls.Free(156)
 54353  
 54354  	// var zBuf [100]int8 at bp+56, 100
 54355  
 54356  	var pPage uintptr
 54357  	if argc != 2 {
 54358  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54359  			ts+24752 /* " PAGE\"" */, 0))
 54360  		return TCL_ERROR
 54361  	}
 54362  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54363  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+56 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, sqlite3.Xsqlite3PagerPagenumber(tls, pPage)))
 54364  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 54365  	return TCL_OK
 54366  }
 54367  
 54368  // Usage:   page_write PAGE DATA
 54369  //
 54370  // Write something into a page.
 54371  func page_write(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:469:26: */
 54372  	bp := tls.Alloc(48)
 54373  	defer tls.Free(48)
 54374  
 54375  	var pPage uintptr
 54376  	var pData uintptr
 54377  	var rc int32
 54378  	if argc != 3 {
 54379  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54380  			ts+24759 /* " PAGE DATA\"" */, 0))
 54381  		return TCL_ERROR
 54382  	}
 54383  	pPage = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 54384  	rc = sqlite3.Xsqlite3PagerWrite(tls, pPage)
 54385  	if rc != SQLITE_OK {
 54386  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54387  		return TCL_ERROR
 54388  	}
 54389  	pData = sqlite3.Xsqlite3PagerGetData(tls, pPage)
 54390  	libc.Xstrncpy(tls, pData, *(*uintptr)(unsafe.Pointer(argv + 2*4)), (uint32(test_pagesize - 1)))
 54391  	*(*int8)(unsafe.Pointer(pData + uintptr((test_pagesize - 1)))) = int8(0)
 54392  	return TCL_OK
 54393  }
 54394  
 54395  // Usage:   fake_big_file  N  FILENAME
 54396  //
 54397  // Write a few bytes at the N megabyte point of FILENAME.  This will
 54398  // create a large file.  If the file was a valid SQLite database, then
 54399  // the next time the database is opened, SQLite will begin allocating
 54400  // new pages after N.  If N is 2096 or bigger, this will test the
 54401  // ability of SQLite to write to large files.
 54402  func fake_big_file(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:505:26: */
 54403  	bp := tls.Alloc(88)
 54404  	defer tls.Free(88)
 54405  
 54406  	var pVfs uintptr
 54407  	*(*uintptr)(unsafe.Pointer(bp + 84 /* fd */)) = uintptr(0)
 54408  	var rc int32
 54409  	// var n int32 at bp+80, 4
 54410  
 54411  	var offset i64
 54412  	var zFile uintptr
 54413  	var nFile int32
 54414  	if argc != 3 {
 54415  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54416  			ts+24771 /* " N-MEGABYTES FIL..." */, 0))
 54417  		return TCL_ERROR
 54418  	}
 54419  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+80 /* &n */) != 0 {
 54420  		return TCL_ERROR
 54421  	}
 54422  
 54423  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 54424  	nFile = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 54425  	zFile = sqlite3.Xsqlite3_malloc(tls, (nFile + 2))
 54426  	if zFile == uintptr(0) {
 54427  		return TCL_ERROR
 54428  	}
 54429  	libc.Xmemcpy(tls, zFile, *(*uintptr)(unsafe.Pointer(argv + 2*4)), (uint32(nFile + 1)))
 54430  	*(*int8)(unsafe.Pointer(zFile + uintptr((nFile + 1)))) = int8(0)
 54431  	rc = sqlite3.Xsqlite3OsOpenMalloc(tls, pVfs, zFile, bp+84, /* &fd */
 54432  		((SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE) | SQLITE_OPEN_MAIN_DB), uintptr(0))
 54433  	if rc != 0 {
 54434  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+24790 /* "open failed: " */, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54435  		sqlite3.Xsqlite3_free(tls, zFile)
 54436  		return TCL_ERROR
 54437  	}
 54438  	offset = i64(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))
 54439  	offset = offset * (int64(1024 * 1024))
 54440  	rc = sqlite3.Xsqlite3OsWrite(tls, *(*uintptr)(unsafe.Pointer(bp + 84 /* fd */)), ts+24804 /* "Hello, World!" */, 14, offset)
 54441  	sqlite3.Xsqlite3OsCloseFree(tls, *(*uintptr)(unsafe.Pointer(bp + 84 /* fd */)))
 54442  	sqlite3.Xsqlite3_free(tls, zFile)
 54443  	if rc != 0 {
 54444  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, ts+24818 /* "write failed: " */, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 54445  		return TCL_ERROR
 54446  	}
 54447  	return TCL_OK
 54448  }
 54449  
 54450  // test_control_pending_byte  PENDING_BYTE
 54451  //
 54452  // Set the PENDING_BYTE using the sqlite3_test_control() interface.
 54453  func testPendingByte(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:558:26: */
 54454  	bp := tls.Alloc(44)
 54455  	defer tls.Free(44)
 54456  
 54457  	// var pbyte int32 at bp+40, 4
 54458  
 54459  	var rc int32
 54460  	if argc != 2 {
 54461  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54462  			ts+24833 /* " PENDING-BYTE\"" */, uintptr(0)))
 54463  		return TCL_ERROR
 54464  	}
 54465  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+40 /* &pbyte */) != 0 {
 54466  		return TCL_ERROR
 54467  	}
 54468  	rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_PENDING_BYTE, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 40 /* pbyte */))))
 54469  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 54470  	return TCL_OK
 54471  }
 54472  
 54473  // The sqlite3FaultSim() callback:
 54474  var faultSimInterp uintptr = uintptr(0) /* test2.c:580:19 */
 54475  var faultSimScriptSize int32 = 0        /* test2.c:581:12 */
 54476  var faultSimScript uintptr              /* test2.c:582:13: */
 54477  
 54478  func faultSimCallback(tls *libc.TLS, x int32) int32 { /* test2.c:583:12: */
 54479  	bp := tls.Alloc(38)
 54480  	defer tls.Free(38)
 54481  
 54482  	// var zInt [30]int8 at bp+8, 30
 54483  
 54484  	var i int32
 54485  	var isNeg int32
 54486  	var rc int32
 54487  	if x == 0 {
 54488  		libc.Xmemcpy(tls, (faultSimScript + uintptr(faultSimScriptSize)), ts+14654 /* "0" */, uint32(2))
 54489  	} else {
 54490  		// Convert x to text without using any sqlite3 routines
 54491  		if x < 0 {
 54492  			isNeg = 1
 54493  			x = -x
 54494  		} else {
 54495  			isNeg = 0
 54496  		}
 54497  		*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + 29)) = int8(0)
 54498  		i = (int32(uint32(unsafe.Sizeof([30]int8{})) - uint32(2)))
 54499  	__1:
 54500  		if !((i > 0) && (x > 0)) {
 54501  			goto __3
 54502  		}
 54503  		{
 54504  			*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + uintptr(i))) = (int8((x % 10) + '0'))
 54505  
 54506  		}
 54507  		goto __2
 54508  	__2:
 54509  		i--
 54510  		x = x / (10)
 54511  		goto __1
 54512  		goto __3
 54513  	__3:
 54514  		;
 54515  		if isNeg != 0 {
 54516  			*(*int8)(unsafe.Pointer(bp + 8 /* &zInt[0] */ + uintptr(libc.PostDecInt32(&i, 1)))) = int8('-')
 54517  		}
 54518  		libc.Xmemcpy(tls, (faultSimScript + uintptr(faultSimScriptSize)), ((bp + 8 /* &zInt[0] */ + uintptr(i)) + uintptr(1)), (uint32(unsafe.Sizeof([30]int8{})) - uint32(i)))
 54519  	}
 54520  	rc = tcl.XTcl_Eval(tls, faultSimInterp, faultSimScript)
 54521  	if rc != 0 {
 54522  		libc.Xfprintf(tls, libc.Xstderr, ts+24848 /* "fault simulator ..." */, libc.VaList(bp, faultSimScript))
 54523  		rc = SQLITE_ERROR
 54524  	} else {
 54525  		rc = libc.Xatoi(tls, tcl.XTcl_GetStringResult(tls, faultSimInterp))
 54526  	}
 54527  	tcl.XTcl_ResetResult(tls, faultSimInterp)
 54528  	return rc
 54529  }
 54530  
 54531  // sqlite3_test_control_fault_install SCRIPT
 54532  //
 54533  // Arrange to invoke SCRIPT with the integer argument to sqlite3FaultSim()
 54534  // appended, whenever sqlite3FaultSim() is called.  Or, if SCRIPT is the
 54535  // empty string, cancel the sqlite3FaultSim() callback.
 54536  func faultInstallCmd(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:623:26: */
 54537  	bp := tls.Alloc(64)
 54538  	defer tls.Free(64)
 54539  
 54540  	var zScript uintptr
 54541  	var nScript int32
 54542  	var rc int32
 54543  	if (argc != 1) && (argc != 2) {
 54544  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54545  			ts+24884 /* " SCRIPT\"" */, uintptr(0)))
 54546  	}
 54547  	if argc == 2 {
 54548  		zScript = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 54549  	} else {
 54550  		zScript = ts + 489 /* "" */
 54551  	}
 54552  	nScript = int32(libc.Xstrlen(tls, zScript))
 54553  	if faultSimScript != 0 {
 54554  		libc.Xfree(tls, faultSimScript)
 54555  		faultSimScript = uintptr(0)
 54556  	}
 54557  	if nScript == 0 {
 54558  		rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_FAULT_INSTALL, libc.VaList(bp+32, 0))
 54559  	} else {
 54560  		faultSimScript = libc.Xmalloc(tls, (uint32(nScript + 100)))
 54561  		if faultSimScript == uintptr(0) {
 54562  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+1930 /* "out of memory" */, uintptr(0)))
 54563  			return SQLITE_ERROR
 54564  		}
 54565  		libc.Xmemcpy(tls, faultSimScript, zScript, uint32(nScript))
 54566  		*(*int8)(unsafe.Pointer(faultSimScript + uintptr(nScript))) = int8(' ')
 54567  		faultSimScriptSize = (nScript + 1)
 54568  		faultSimInterp = interp
 54569  		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}))))
 54570  	}
 54571  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 54572  	return SQLITE_OK
 54573  }
 54574  
 54575  // sqlite3BitvecBuiltinTest SIZE PROGRAM
 54576  //
 54577  // Invoke the SQLITE_TESTCTRL_BITVEC_TEST operator on test_control.
 54578  // See comments on sqlite3BitvecBuiltinTest() for additional information.
 54579  func testBitvecBuiltinTest(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test2.c:666:26: */
 54580  	bp := tls.Alloc(452)
 54581  	defer tls.Free(452)
 54582  
 54583  	// var sz int32 at bp+48, 4
 54584  
 54585  	var rc int32
 54586  	var nProg int32 = 0
 54587  	// var aProg [100]int32 at bp+52, 400
 54588  
 54589  	var z uintptr
 54590  	if argc != 3 {
 54591  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 54592  			ts+24893 /* " SIZE PROGRAM\"" */, uintptr(0)))
 54593  	}
 54594  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+48 /* &sz */) != 0 {
 54595  		return TCL_ERROR
 54596  	}
 54597  	z = *(*uintptr)(unsafe.Pointer(argv + 2*4))
 54598  	for (nProg < 99) && (*(*int8)(unsafe.Pointer(z)) != 0) {
 54599  		for (*(*int8)(unsafe.Pointer(z)) != 0) && !((int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0) {
 54600  			z++
 54601  		}
 54602  		if int32(*(*int8)(unsafe.Pointer(z))) == 0 {
 54603  			break
 54604  		}
 54605  		*(*int32)(unsafe.Pointer(bp + 52 /* &aProg[0] */ + uintptr(libc.PostIncInt32(&nProg, 1))*4)) = libc.Xatoi(tls, z)
 54606  		for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0 {
 54607  			z++
 54608  		}
 54609  	}
 54610  	*(*int32)(unsafe.Pointer(bp + 52 /* &aProg[0] */ + uintptr(nProg)*4)) = 0
 54611  	rc = sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BITVEC_TEST, libc.VaList(bp+32, *(*int32)(unsafe.Pointer(bp + 48 /* sz */)), bp+52 /* &aProg[0] */))
 54612  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 54613  	return TCL_OK
 54614  }
 54615  
 54616  // Register commands with the TCL interpreter.
 54617  func Sqlitetest2_Init(tls *libc.TLS, interp uintptr) int32 { /* test2.c:697:5: */
 54618  	var i int32
 54619  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd2)) / uint32(unsafe.Sizeof(struct {
 54620  		FzName uintptr
 54621  		FxProc uintptr
 54622  	}{}))); i++ {
 54623  		tcl.XTcl_CreateCommand(tls, interp, aCmd2[i].FzName, aCmd2[i].FxProc, uintptr(0), uintptr(0))
 54624  	}
 54625  	tcl.XTcl_LinkVar(tls, interp, ts+24908, /* "sqlite_io_error_..." */
 54626  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_pending)), TCL_LINK_INT)
 54627  	tcl.XTcl_LinkVar(tls, interp, ts+24932, /* "sqlite_io_error_..." */
 54628  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_persist)), TCL_LINK_INT)
 54629  	tcl.XTcl_LinkVar(tls, interp, ts+24956, /* "sqlite_io_error_..." */
 54630  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_hit)), TCL_LINK_INT)
 54631  	tcl.XTcl_LinkVar(tls, interp, ts+24976, /* "sqlite_io_error_..." */
 54632  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_io_error_hardhit)), TCL_LINK_INT)
 54633  	tcl.XTcl_LinkVar(tls, interp, ts+25000, /* "sqlite_diskfull_..." */
 54634  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_diskfull_pending)), TCL_LINK_INT)
 54635  	tcl.XTcl_LinkVar(tls, interp, ts+25024, /* "sqlite_diskfull" */
 54636  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3_diskfull)), TCL_LINK_INT)
 54637  	tcl.XTcl_LinkVar(tls, interp, ts+25040, /* "sqlite_pending_b..." */
 54638  		uintptr(unsafe.Pointer(&sqlite3.Xsqlite3PendingByte)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 54639  	return TCL_OK
 54640  }
 54641  
 54642  var aCmd2 = [20]struct {
 54643  	FzName uintptr
 54644  	FxProc uintptr
 54645  }{
 54646  	{FzName: ts + 25060 /* "pager_open" */, FxProc: 0},
 54647  	{FzName: ts + 25071 /* "pager_close" */, FxProc: 0},
 54648  	{FzName: ts + 25083 /* "pager_commit" */, FxProc: 0},
 54649  	{FzName: ts + 25096 /* "pager_rollback" */, FxProc: 0},
 54650  	{FzName: ts + 25111 /* "pager_stmt_begin" */, FxProc: 0},
 54651  	{FzName: ts + 25128 /* "pager_stmt_commi..." */, FxProc: 0},
 54652  	{FzName: ts + 25146 /* "pager_stmt_rollb..." */, FxProc: 0},
 54653  	{FzName: ts + 25166 /* "pager_stats" */, FxProc: 0},
 54654  	{FzName: ts + 25178 /* "pager_pagecount" */, FxProc: 0},
 54655  	{FzName: ts + 25194 /* "page_get" */, FxProc: 0},
 54656  	{FzName: ts + 25203 /* "page_lookup" */, FxProc: 0},
 54657  	{FzName: ts + 25215 /* "page_unref" */, FxProc: 0},
 54658  	{FzName: ts + 25226 /* "page_read" */, FxProc: 0},
 54659  	{FzName: ts + 25236 /* "page_write" */, FxProc: 0},
 54660  	{FzName: ts + 25247 /* "page_number" */, FxProc: 0},
 54661  	{FzName: ts + 25259 /* "pager_truncate" */, FxProc: 0},
 54662  	{FzName: ts + 25274 /* "fake_big_file" */, FxProc: 0},
 54663  	{FzName: ts + 25288 /* "sqlite3BitvecBui..." */, FxProc: 0},
 54664  	{FzName: ts + 25313 /* "sqlite3_test_con..." */, FxProc: 0},
 54665  	{FzName: ts + 25347 /* "sqlite3_test_con..." */, FxProc: 0},
 54666  } /* test2.c:707:5 */
 54667  
 54668  // 2001 September 15
 54669  //
 54670  // The author disclaims copyright to this source code.  In place of
 54671  // a legal notice, here is a blessing:
 54672  //
 54673  //    May you do good and not evil.
 54674  //    May you find forgiveness for yourself and forgive others.
 54675  //    May you share freely, never taking more than you give.
 54676  //
 54677  //
 54678  // This header file defines the interface that the sqlite B-Tree file
 54679  // subsystem.  See comments in the source code for a detailed description
 54680  // of what each interface routine does.
 54681  
 54682  // TODO: This definition is just included so other modules compile. It
 54683  // needs to be revisited.
 54684  
 54685  // If defined as non-zero, auto-vacuum is enabled by default. Otherwise
 54686  // it must be turned on for each database using "PRAGMA auto_vacuum = 1".
 54687  
 54688  // Forward declarations of structure
 54689  type Btree = Btree1       /* btree.h:39:22 */
 54690  type BtCursor = BtCursor1 /* btree.h:40:25 */
 54691  type BtShared = BtShared1 /* btree.h:41:25 */
 54692  
 54693  // 2004 April 6
 54694  //
 54695  // The author disclaims copyright to this source code.  In place of
 54696  // a legal notice, here is a blessing:
 54697  //
 54698  //    May you do good and not evil.
 54699  //    May you find forgiveness for yourself and forgive others.
 54700  //    May you share freely, never taking more than you give.
 54701  //
 54702  //
 54703  // This file implements an external (disk-based) database using BTrees.
 54704  // For a detailed discussion of BTrees, refer to
 54705  //
 54706  //     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
 54707  //     "Sorting And Searching", pages 473-480. Addison-Wesley
 54708  //     Publishing Company, Reading, Massachusetts.
 54709  //
 54710  // The basic idea is that each page of the file contains N database
 54711  // entries and N+1 pointers to subpages.
 54712  //
 54713  //   ----------------------------------------------------------------
 54714  //   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
 54715  //   ----------------------------------------------------------------
 54716  //
 54717  // All of the keys on the page that Ptr(0) points to have values less
 54718  // than Key(0).  All of the keys on page Ptr(1) and its subpages have
 54719  // values greater than Key(0) and less than Key(1).  All of the keys
 54720  // on Ptr(N) and its subpages have values greater than Key(N-1).  And
 54721  // so forth.
 54722  //
 54723  // Finding a particular key requires reading O(log(M)) pages from the
 54724  // disk where M is the number of entries in the tree.
 54725  //
 54726  // In this implementation, a single file can hold one or more separate
 54727  // BTrees.  Each BTree is identified by the index of its root page.  The
 54728  // key and data for any entry are combined to form the "payload".  A
 54729  // fixed amount of payload can be carried directly on the database
 54730  // page.  If the payload is larger than the preset amount then surplus
 54731  // bytes are stored on overflow pages.  The payload for an entry
 54732  // and the preceding pointer are combined to form a "Cell".  Each
 54733  // page has a small header which contains the Ptr(N) pointer and other
 54734  // information such as the size of key and data.
 54735  //
 54736  // FORMAT DETAILS
 54737  //
 54738  // The file is divided into pages.  The first page is called page 1,
 54739  // the second is page 2, and so forth.  A page number of zero indicates
 54740  // "no such page".  The page size can be any power of 2 between 512 and 65536.
 54741  // Each page can be either a btree page, a freelist page, an overflow
 54742  // page, or a pointer-map page.
 54743  //
 54744  // The first page is always a btree page.  The first 100 bytes of the first
 54745  // page contain a special header (the "file header") that describes the file.
 54746  // The format of the file header is as follows:
 54747  //
 54748  //   OFFSET   SIZE    DESCRIPTION
 54749  //      0      16     Header string: "SQLite format 3\000"
 54750  //     16       2     Page size in bytes.  (1 means 65536)
 54751  //     18       1     File format write version
 54752  //     19       1     File format read version
 54753  //     20       1     Bytes of unused space at the end of each page
 54754  //     21       1     Max embedded payload fraction (must be 64)
 54755  //     22       1     Min embedded payload fraction (must be 32)
 54756  //     23       1     Min leaf payload fraction (must be 32)
 54757  //     24       4     File change counter
 54758  //     28       4     Reserved for future use
 54759  //     32       4     First freelist page
 54760  //     36       4     Number of freelist pages in the file
 54761  //     40      60     15 4-byte meta values passed to higher layers
 54762  //
 54763  //     40       4     Schema cookie
 54764  //     44       4     File format of schema layer
 54765  //     48       4     Size of page cache
 54766  //     52       4     Largest root-page (auto/incr_vacuum)
 54767  //     56       4     1=UTF-8 2=UTF16le 3=UTF16be
 54768  //     60       4     User version
 54769  //     64       4     Incremental vacuum mode
 54770  //     68       4     Application-ID
 54771  //     72      20     unused
 54772  //     92       4     The version-valid-for number
 54773  //     96       4     SQLITE_VERSION_NUMBER
 54774  //
 54775  // All of the integer values are big-endian (most significant byte first).
 54776  //
 54777  // The file change counter is incremented when the database is changed
 54778  // This counter allows other processes to know when the file has changed
 54779  // and thus when they need to flush their cache.
 54780  //
 54781  // The max embedded payload fraction is the amount of the total usable
 54782  // space in a page that can be consumed by a single cell for standard
 54783  // B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default
 54784  // is to limit the maximum cell size so that at least 4 cells will fit
 54785  // on one page.  Thus the default max embedded payload fraction is 64.
 54786  //
 54787  // If the payload for a cell is larger than the max payload, then extra
 54788  // payload is spilled to overflow pages.  Once an overflow page is allocated,
 54789  // as many bytes as possible are moved into the overflow pages without letting
 54790  // the cell size drop below the min embedded payload fraction.
 54791  //
 54792  // The min leaf payload fraction is like the min embedded payload fraction
 54793  // except that it applies to leaf nodes in a LEAFDATA tree.  The maximum
 54794  // payload fraction for a LEAFDATA tree is always 100% (or 255) and it
 54795  // not specified in the header.
 54796  //
 54797  // Each btree pages is divided into three sections:  The header, the
 54798  // cell pointer array, and the cell content area.  Page 1 also has a 100-byte
 54799  // file header that occurs before the page header.
 54800  //
 54801  //      |----------------|
 54802  //      | file header    |   100 bytes.  Page 1 only.
 54803  //      |----------------|
 54804  //      | page header    |   8 bytes for leaves.  12 bytes for interior nodes
 54805  //      |----------------|
 54806  //      | cell pointer   |   |  2 bytes per cell.  Sorted order.
 54807  //      | array          |   |  Grows downward
 54808  //      |                |   v
 54809  //      |----------------|
 54810  //      | unallocated    |
 54811  //      | space          |
 54812  //      |----------------|   ^  Grows upwards
 54813  //      | cell content   |   |  Arbitrary order interspersed with freeblocks.
 54814  //      | area           |   |  and free space fragments.
 54815  //      |----------------|
 54816  //
 54817  // The page headers looks like this:
 54818  //
 54819  //   OFFSET   SIZE     DESCRIPTION
 54820  //      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
 54821  //      1       2      byte offset to the first freeblock
 54822  //      3       2      number of cells on this page
 54823  //      5       2      first byte of the cell content area
 54824  //      7       1      number of fragmented free bytes
 54825  //      8       4      Right child (the Ptr(N) value).  Omitted on leaves.
 54826  //
 54827  // The flags define the format of this btree page.  The leaf flag means that
 54828  // this page has no children.  The zerodata flag means that this page carries
 54829  // only keys and no data.  The intkey flag means that the key is an integer
 54830  // which is stored in the key size entry of the cell header rather than in
 54831  // the payload area.
 54832  //
 54833  // The cell pointer array begins on the first byte after the page header.
 54834  // The cell pointer array contains zero or more 2-byte numbers which are
 54835  // offsets from the beginning of the page to the cell content in the cell
 54836  // content area.  The cell pointers occur in sorted order.  The system strives
 54837  // to keep free space after the last cell pointer so that new cells can
 54838  // be easily added without having to defragment the page.
 54839  //
 54840  // Cell content is stored at the very end of the page and grows toward the
 54841  // beginning of the page.
 54842  //
 54843  // Unused space within the cell content area is collected into a linked list of
 54844  // freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset
 54845  // to the first freeblock is given in the header.  Freeblocks occur in
 54846  // increasing order.  Because a freeblock must be at least 4 bytes in size,
 54847  // any group of 3 or fewer unused bytes in the cell content area cannot
 54848  // exist on the freeblock chain.  A group of 3 or fewer free bytes is called
 54849  // a fragment.  The total number of bytes in all fragments is recorded.
 54850  // in the page header at offset 7.
 54851  //
 54852  //    SIZE    DESCRIPTION
 54853  //      2     Byte offset of the next freeblock
 54854  //      2     Bytes in this freeblock
 54855  //
 54856  // Cells are of variable length.  Cells are stored in the cell content area at
 54857  // the end of the page.  Pointers to the cells are in the cell pointer array
 54858  // that immediately follows the page header.  Cells is not necessarily
 54859  // contiguous or in order, but cell pointers are contiguous and in order.
 54860  //
 54861  // Cell content makes use of variable length integers.  A variable
 54862  // length integer is 1 to 9 bytes where the lower 7 bits of each
 54863  // byte are used.  The integer consists of all bytes that have bit 8 set and
 54864  // the first byte with bit 8 clear.  The most significant byte of the integer
 54865  // appears first.  A variable-length integer may not be more than 9 bytes long.
 54866  // As a special case, all 8 bytes of the 9th byte are used as data.  This
 54867  // allows a 64-bit integer to be encoded in 9 bytes.
 54868  //
 54869  //    0x00                      becomes  0x00000000
 54870  //    0x7f                      becomes  0x0000007f
 54871  //    0x81 0x00                 becomes  0x00000080
 54872  //    0x82 0x00                 becomes  0x00000100
 54873  //    0x80 0x7f                 becomes  0x0000007f
 54874  //    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678
 54875  //    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081
 54876  //
 54877  // Variable length integers are used for rowids and to hold the number of
 54878  // bytes of key and data in a btree cell.
 54879  //
 54880  // The content of a cell looks like this:
 54881  //
 54882  //    SIZE    DESCRIPTION
 54883  //      4     Page number of the left child. Omitted if leaf flag is set.
 54884  //     var    Number of bytes of data. Omitted if the zerodata flag is set.
 54885  //     var    Number of bytes of key. Or the key itself if intkey flag is set.
 54886  //      *     Payload
 54887  //      4     First page of the overflow chain.  Omitted if no overflow
 54888  //
 54889  // Overflow pages form a linked list.  Each page except the last is completely
 54890  // filled with data (pagesize - 4 bytes).  The last page can have as little
 54891  // as 1 byte of data.
 54892  //
 54893  //    SIZE    DESCRIPTION
 54894  //      4     Page number of next overflow page
 54895  //      *     Data
 54896  //
 54897  // Freelist pages come in two subtypes: trunk pages and leaf pages.  The
 54898  // file header points to the first in a linked list of trunk page.  Each trunk
 54899  // page points to multiple leaf pages.  The content of a leaf page is
 54900  // unspecified.  A trunk page looks like this:
 54901  //
 54902  //    SIZE    DESCRIPTION
 54903  //      4     Page number of next trunk page
 54904  //      4     Number of leaf pointers on this page
 54905  //      *     zero or more pages numbers of leaves
 54906  // 2001 September 15
 54907  //
 54908  // The author disclaims copyright to this source code.  In place of
 54909  // a legal notice, here is a blessing:
 54910  //
 54911  //    May you do good and not evil.
 54912  //    May you find forgiveness for yourself and forgive others.
 54913  //    May you share freely, never taking more than you give.
 54914  //
 54915  //
 54916  // Internal interface definitions for SQLite.
 54917  //
 54918  
 54919  // The following value is the maximum cell size assuming a maximum page
 54920  // size give above.
 54921  
 54922  // The maximum number of cells on a single page of the database.  This
 54923  // assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself
 54924  // plus 2 bytes for the index to the cell in the page header).  Such
 54925  // small cells will be rare, but they are possible.
 54926  
 54927  // Forward declarations
 54928  type MemPage1 = struct {
 54929  	FisInit          u8
 54930  	FbBusy           u8
 54931  	FintKey          u8
 54932  	FintKeyLeaf      u8
 54933  	Fpgno            Pgno
 54934  	Fleaf            u8
 54935  	FhdrOffset       u8
 54936  	FchildPtrSize    u8
 54937  	Fmax1bytePayload u8
 54938  	FnOverflow       u8
 54939  	_                [1]byte
 54940  	FmaxLocal        u16
 54941  	FminLocal        u16
 54942  	FcellOffset      u16
 54943  	FnFree           int32
 54944  	FnCell           u16
 54945  	FmaskPage        u16
 54946  	FaiOvfl          [4]u16
 54947  	FapOvfl          [4]uintptr
 54948  	FpBt             uintptr
 54949  	FaData           uintptr
 54950  	FaDataEnd        uintptr
 54951  	FaCellIdx        uintptr
 54952  	FaDataOfst       uintptr
 54953  	FpDbPage         uintptr
 54954  	FxCellSize       uintptr
 54955  	FxParseCell      uintptr
 54956  } /* btree.h:39:9 */
 54957  
 54958  // 2004 April 6
 54959  //
 54960  // The author disclaims copyright to this source code.  In place of
 54961  // a legal notice, here is a blessing:
 54962  //
 54963  //    May you do good and not evil.
 54964  //    May you find forgiveness for yourself and forgive others.
 54965  //    May you share freely, never taking more than you give.
 54966  //
 54967  //
 54968  // This file implements an external (disk-based) database using BTrees.
 54969  // For a detailed discussion of BTrees, refer to
 54970  //
 54971  //     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
 54972  //     "Sorting And Searching", pages 473-480. Addison-Wesley
 54973  //     Publishing Company, Reading, Massachusetts.
 54974  //
 54975  // The basic idea is that each page of the file contains N database
 54976  // entries and N+1 pointers to subpages.
 54977  //
 54978  //   ----------------------------------------------------------------
 54979  //   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
 54980  //   ----------------------------------------------------------------
 54981  //
 54982  // All of the keys on the page that Ptr(0) points to have values less
 54983  // than Key(0).  All of the keys on page Ptr(1) and its subpages have
 54984  // values greater than Key(0) and less than Key(1).  All of the keys
 54985  // on Ptr(N) and its subpages have values greater than Key(N-1).  And
 54986  // so forth.
 54987  //
 54988  // Finding a particular key requires reading O(log(M)) pages from the
 54989  // disk where M is the number of entries in the tree.
 54990  //
 54991  // In this implementation, a single file can hold one or more separate
 54992  // BTrees.  Each BTree is identified by the index of its root page.  The
 54993  // key and data for any entry are combined to form the "payload".  A
 54994  // fixed amount of payload can be carried directly on the database
 54995  // page.  If the payload is larger than the preset amount then surplus
 54996  // bytes are stored on overflow pages.  The payload for an entry
 54997  // and the preceding pointer are combined to form a "Cell".  Each
 54998  // page has a small header which contains the Ptr(N) pointer and other
 54999  // information such as the size of key and data.
 55000  //
 55001  // FORMAT DETAILS
 55002  //
 55003  // The file is divided into pages.  The first page is called page 1,
 55004  // the second is page 2, and so forth.  A page number of zero indicates
 55005  // "no such page".  The page size can be any power of 2 between 512 and 65536.
 55006  // Each page can be either a btree page, a freelist page, an overflow
 55007  // page, or a pointer-map page.
 55008  //
 55009  // The first page is always a btree page.  The first 100 bytes of the first
 55010  // page contain a special header (the "file header") that describes the file.
 55011  // The format of the file header is as follows:
 55012  //
 55013  //   OFFSET   SIZE    DESCRIPTION
 55014  //      0      16     Header string: "SQLite format 3\000"
 55015  //     16       2     Page size in bytes.  (1 means 65536)
 55016  //     18       1     File format write version
 55017  //     19       1     File format read version
 55018  //     20       1     Bytes of unused space at the end of each page
 55019  //     21       1     Max embedded payload fraction (must be 64)
 55020  //     22       1     Min embedded payload fraction (must be 32)
 55021  //     23       1     Min leaf payload fraction (must be 32)
 55022  //     24       4     File change counter
 55023  //     28       4     Reserved for future use
 55024  //     32       4     First freelist page
 55025  //     36       4     Number of freelist pages in the file
 55026  //     40      60     15 4-byte meta values passed to higher layers
 55027  //
 55028  //     40       4     Schema cookie
 55029  //     44       4     File format of schema layer
 55030  //     48       4     Size of page cache
 55031  //     52       4     Largest root-page (auto/incr_vacuum)
 55032  //     56       4     1=UTF-8 2=UTF16le 3=UTF16be
 55033  //     60       4     User version
 55034  //     64       4     Incremental vacuum mode
 55035  //     68       4     Application-ID
 55036  //     72      20     unused
 55037  //     92       4     The version-valid-for number
 55038  //     96       4     SQLITE_VERSION_NUMBER
 55039  //
 55040  // All of the integer values are big-endian (most significant byte first).
 55041  //
 55042  // The file change counter is incremented when the database is changed
 55043  // This counter allows other processes to know when the file has changed
 55044  // and thus when they need to flush their cache.
 55045  //
 55046  // The max embedded payload fraction is the amount of the total usable
 55047  // space in a page that can be consumed by a single cell for standard
 55048  // B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default
 55049  // is to limit the maximum cell size so that at least 4 cells will fit
 55050  // on one page.  Thus the default max embedded payload fraction is 64.
 55051  //
 55052  // If the payload for a cell is larger than the max payload, then extra
 55053  // payload is spilled to overflow pages.  Once an overflow page is allocated,
 55054  // as many bytes as possible are moved into the overflow pages without letting
 55055  // the cell size drop below the min embedded payload fraction.
 55056  //
 55057  // The min leaf payload fraction is like the min embedded payload fraction
 55058  // except that it applies to leaf nodes in a LEAFDATA tree.  The maximum
 55059  // payload fraction for a LEAFDATA tree is always 100% (or 255) and it
 55060  // not specified in the header.
 55061  //
 55062  // Each btree pages is divided into three sections:  The header, the
 55063  // cell pointer array, and the cell content area.  Page 1 also has a 100-byte
 55064  // file header that occurs before the page header.
 55065  //
 55066  //      |----------------|
 55067  //      | file header    |   100 bytes.  Page 1 only.
 55068  //      |----------------|
 55069  //      | page header    |   8 bytes for leaves.  12 bytes for interior nodes
 55070  //      |----------------|
 55071  //      | cell pointer   |   |  2 bytes per cell.  Sorted order.
 55072  //      | array          |   |  Grows downward
 55073  //      |                |   v
 55074  //      |----------------|
 55075  //      | unallocated    |
 55076  //      | space          |
 55077  //      |----------------|   ^  Grows upwards
 55078  //      | cell content   |   |  Arbitrary order interspersed with freeblocks.
 55079  //      | area           |   |  and free space fragments.
 55080  //      |----------------|
 55081  //
 55082  // The page headers looks like this:
 55083  //
 55084  //   OFFSET   SIZE     DESCRIPTION
 55085  //      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
 55086  //      1       2      byte offset to the first freeblock
 55087  //      3       2      number of cells on this page
 55088  //      5       2      first byte of the cell content area
 55089  //      7       1      number of fragmented free bytes
 55090  //      8       4      Right child (the Ptr(N) value).  Omitted on leaves.
 55091  //
 55092  // The flags define the format of this btree page.  The leaf flag means that
 55093  // this page has no children.  The zerodata flag means that this page carries
 55094  // only keys and no data.  The intkey flag means that the key is an integer
 55095  // which is stored in the key size entry of the cell header rather than in
 55096  // the payload area.
 55097  //
 55098  // The cell pointer array begins on the first byte after the page header.
 55099  // The cell pointer array contains zero or more 2-byte numbers which are
 55100  // offsets from the beginning of the page to the cell content in the cell
 55101  // content area.  The cell pointers occur in sorted order.  The system strives
 55102  // to keep free space after the last cell pointer so that new cells can
 55103  // be easily added without having to defragment the page.
 55104  //
 55105  // Cell content is stored at the very end of the page and grows toward the
 55106  // beginning of the page.
 55107  //
 55108  // Unused space within the cell content area is collected into a linked list of
 55109  // freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset
 55110  // to the first freeblock is given in the header.  Freeblocks occur in
 55111  // increasing order.  Because a freeblock must be at least 4 bytes in size,
 55112  // any group of 3 or fewer unused bytes in the cell content area cannot
 55113  // exist on the freeblock chain.  A group of 3 or fewer free bytes is called
 55114  // a fragment.  The total number of bytes in all fragments is recorded.
 55115  // in the page header at offset 7.
 55116  //
 55117  //    SIZE    DESCRIPTION
 55118  //      2     Byte offset of the next freeblock
 55119  //      2     Bytes in this freeblock
 55120  //
 55121  // Cells are of variable length.  Cells are stored in the cell content area at
 55122  // the end of the page.  Pointers to the cells are in the cell pointer array
 55123  // that immediately follows the page header.  Cells is not necessarily
 55124  // contiguous or in order, but cell pointers are contiguous and in order.
 55125  //
 55126  // Cell content makes use of variable length integers.  A variable
 55127  // length integer is 1 to 9 bytes where the lower 7 bits of each
 55128  // byte are used.  The integer consists of all bytes that have bit 8 set and
 55129  // the first byte with bit 8 clear.  The most significant byte of the integer
 55130  // appears first.  A variable-length integer may not be more than 9 bytes long.
 55131  // As a special case, all 8 bytes of the 9th byte are used as data.  This
 55132  // allows a 64-bit integer to be encoded in 9 bytes.
 55133  //
 55134  //    0x00                      becomes  0x00000000
 55135  //    0x7f                      becomes  0x0000007f
 55136  //    0x81 0x00                 becomes  0x00000080
 55137  //    0x82 0x00                 becomes  0x00000100
 55138  //    0x80 0x7f                 becomes  0x0000007f
 55139  //    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678
 55140  //    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081
 55141  //
 55142  // Variable length integers are used for rowids and to hold the number of
 55143  // bytes of key and data in a btree cell.
 55144  //
 55145  // The content of a cell looks like this:
 55146  //
 55147  //    SIZE    DESCRIPTION
 55148  //      4     Page number of the left child. Omitted if leaf flag is set.
 55149  //     var    Number of bytes of data. Omitted if the zerodata flag is set.
 55150  //     var    Number of bytes of key. Or the key itself if intkey flag is set.
 55151  //      *     Payload
 55152  //      4     First page of the overflow chain.  Omitted if no overflow
 55153  //
 55154  // Overflow pages form a linked list.  Each page except the last is completely
 55155  // filled with data (pagesize - 4 bytes).  The last page can have as little
 55156  // as 1 byte of data.
 55157  //
 55158  //    SIZE    DESCRIPTION
 55159  //      4     Page number of next overflow page
 55160  //      *     Data
 55161  //
 55162  // Freelist pages come in two subtypes: trunk pages and leaf pages.  The
 55163  // file header points to the first in a linked list of trunk page.  Each trunk
 55164  // page points to multiple leaf pages.  The content of a leaf page is
 55165  // unspecified.  A trunk page looks like this:
 55166  //
 55167  //    SIZE    DESCRIPTION
 55168  //      4     Page number of next trunk page
 55169  //      4     Number of leaf pointers on this page
 55170  //      *     zero or more pages numbers of leaves
 55171  // 2001 September 15
 55172  //
 55173  // The author disclaims copyright to this source code.  In place of
 55174  // a legal notice, here is a blessing:
 55175  //
 55176  //    May you do good and not evil.
 55177  //    May you find forgiveness for yourself and forgive others.
 55178  //    May you share freely, never taking more than you give.
 55179  //
 55180  //
 55181  // Internal interface definitions for SQLite.
 55182  //
 55183  
 55184  // The following value is the maximum cell size assuming a maximum page
 55185  // size give above.
 55186  
 55187  // The maximum number of cells on a single page of the database.  This
 55188  // assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself
 55189  // plus 2 bytes for the index to the cell in the page header).  Such
 55190  // small cells will be rare, but they are possible.
 55191  
 55192  // Forward declarations
 55193  type MemPage = MemPage1 /* btreeInt.h:232:24 */
 55194  type BtLock1 = struct {
 55195  	FpBtree uintptr
 55196  	FiTable Pgno
 55197  	FeLock  u8
 55198  	_       [3]byte
 55199  	FpNext  uintptr
 55200  } /* btree.h:39:9 */
 55201  
 55202  type BtLock = BtLock1 /* btreeInt.h:233:23 */
 55203  type CellInfo1 = struct {
 55204  	FnKey     i64
 55205  	FpPayload uintptr
 55206  	FnPayload u32
 55207  	FnLocal   u16
 55208  	FnSize    u16
 55209  	_         [4]byte
 55210  } /* btree.h:39:9 */
 55211  
 55212  type CellInfo = CellInfo1 /* btreeInt.h:234:25 */
 55213  
 55214  // Legal values for BtCursor.curFlags
 55215  
 55216  // Potential values for BtCursor.eState.
 55217  //
 55218  // CURSOR_INVALID:
 55219  //   Cursor does not point to a valid entry. This can happen (for example)
 55220  //   because the table is empty or because BtreeCursorFirst() has not been
 55221  //   called.
 55222  //
 55223  // CURSOR_VALID:
 55224  //   Cursor points to a valid entry. getPayload() etc. may be called.
 55225  //
 55226  // CURSOR_SKIPNEXT:
 55227  //   Cursor is valid except that the Cursor.skipNext field is non-zero
 55228  //   indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
 55229  //   operation should be a no-op.
 55230  //
 55231  // CURSOR_REQUIRESEEK:
 55232  //   The table that this cursor was opened on still exists, but has been
 55233  //   modified since the cursor was last used. The cursor position is saved
 55234  //   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
 55235  //   this state, restoreCursorPosition() can be called to attempt to
 55236  //   seek the cursor to the saved position.
 55237  //
 55238  // CURSOR_FAULT:
 55239  //   An unrecoverable error (an I/O error or a malloc failure) has occurred
 55240  //   on a different connection that shares the BtShared cache with this
 55241  //   cursor.  The error has left the cache in an inconsistent state.
 55242  //   Do nothing else with this cursor.  Any attempt to use the cursor
 55243  //   should return the error code stored in BtCursor.skipNext
 55244  
 55245  // The database page the PENDING_BYTE occupies. This page is never used.
 55246  
 55247  // These macros define the location of the pointer-map entry for a
 55248  // database page. The first argument to each is the number of usable
 55249  // bytes on each page of the database (often 1024). The second is the
 55250  // page number to look up in the pointer map.
 55251  //
 55252  // PTRMAP_PAGENO returns the database page number of the pointer-map
 55253  // page that stores the required pointer. PTRMAP_PTROFFSET returns
 55254  // the offset of the requested map entry.
 55255  //
 55256  // If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
 55257  // then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
 55258  // used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
 55259  // this test.
 55260  
 55261  // The pointer map is a lookup table that identifies the parent page for
 55262  // each child page in the database file.  The parent page is the page that
 55263  // contains a pointer to the child.  Every page in the database contains
 55264  // 0 or 1 parent pages.  (In this context 'database page' refers
 55265  // to any page that is not part of the pointer map itself.)  Each pointer map
 55266  // entry consists of a single byte 'type' and a 4 byte parent page number.
 55267  // The PTRMAP_XXX identifiers below are the valid types.
 55268  //
 55269  // The purpose of the pointer map is to facility moving pages from one
 55270  // position in the file to another as part of autovacuum.  When a page
 55271  // is moved, the pointer in its parent must be updated to point to the
 55272  // new location.  The pointer map is used to locate the parent page quickly.
 55273  //
 55274  // PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
 55275  //                  used in this case.
 55276  //
 55277  // PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
 55278  //                  is not used in this case.
 55279  //
 55280  // PTRMAP_OVERFLOW1: The database page is the first page in a list of
 55281  //                   overflow pages. The page number identifies the page that
 55282  //                   contains the cell with a pointer to this overflow page.
 55283  //
 55284  // PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
 55285  //                   overflow pages. The page-number identifies the previous
 55286  //                   page in the overflow page list.
 55287  //
 55288  // PTRMAP_BTREE: The database page is a non-root btree page. The page number
 55289  //               identifies the parent page in the btree.
 55290  
 55291  // A bunch of assert() statements to check the transaction state variables
 55292  // of handle p (type Btree*) are internally consistent.
 55293  
 55294  // The ISAUTOVACUUM macro is used within balance_nonroot() to determine
 55295  // if the database supports auto-vacuum or not. Because it is used
 55296  // within an expression that is an argument to another macro
 55297  // (sqliteMallocRaw), it is not possible to use conditional compilation.
 55298  // So, this macro is defined instead.
 55299  
 55300  // This structure is passed around through all the sanity checking routines
 55301  // in order to keep track of some global state information.
 55302  //
 55303  // The aRef[] array is allocated so that there is 1 bit for each page in
 55304  // the database. As the integrity-check proceeds, for each page used in
 55305  // the database the corresponding bit is set. This allows integrity-check to
 55306  // detect pages that are used twice and orphaned pages (both of which
 55307  // indicate corruption).
 55308  type IntegrityCk1 = struct {
 55309  	FpBt       uintptr
 55310  	FpPager    uintptr
 55311  	FaPgRef    uintptr
 55312  	FnPage     Pgno
 55313  	FmxErr     int32
 55314  	FnErr      int32
 55315  	FbOomFault int32
 55316  	FzPfx      uintptr
 55317  	Fv1        Pgno
 55318  	Fv2        int32
 55319  	FerrMsg    StrAccum
 55320  	Fheap      uintptr
 55321  	Fdb        uintptr
 55322  } /* btreeInt.h:692:9 */
 55323  
 55324  // Legal values for BtCursor.curFlags
 55325  
 55326  // Potential values for BtCursor.eState.
 55327  //
 55328  // CURSOR_INVALID:
 55329  //   Cursor does not point to a valid entry. This can happen (for example)
 55330  //   because the table is empty or because BtreeCursorFirst() has not been
 55331  //   called.
 55332  //
 55333  // CURSOR_VALID:
 55334  //   Cursor points to a valid entry. getPayload() etc. may be called.
 55335  //
 55336  // CURSOR_SKIPNEXT:
 55337  //   Cursor is valid except that the Cursor.skipNext field is non-zero
 55338  //   indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious()
 55339  //   operation should be a no-op.
 55340  //
 55341  // CURSOR_REQUIRESEEK:
 55342  //   The table that this cursor was opened on still exists, but has been
 55343  //   modified since the cursor was last used. The cursor position is saved
 55344  //   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in
 55345  //   this state, restoreCursorPosition() can be called to attempt to
 55346  //   seek the cursor to the saved position.
 55347  //
 55348  // CURSOR_FAULT:
 55349  //   An unrecoverable error (an I/O error or a malloc failure) has occurred
 55350  //   on a different connection that shares the BtShared cache with this
 55351  //   cursor.  The error has left the cache in an inconsistent state.
 55352  //   Do nothing else with this cursor.  Any attempt to use the cursor
 55353  //   should return the error code stored in BtCursor.skipNext
 55354  
 55355  // The database page the PENDING_BYTE occupies. This page is never used.
 55356  
 55357  // These macros define the location of the pointer-map entry for a
 55358  // database page. The first argument to each is the number of usable
 55359  // bytes on each page of the database (often 1024). The second is the
 55360  // page number to look up in the pointer map.
 55361  //
 55362  // PTRMAP_PAGENO returns the database page number of the pointer-map
 55363  // page that stores the required pointer. PTRMAP_PTROFFSET returns
 55364  // the offset of the requested map entry.
 55365  //
 55366  // If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
 55367  // then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
 55368  // used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
 55369  // this test.
 55370  
 55371  // The pointer map is a lookup table that identifies the parent page for
 55372  // each child page in the database file.  The parent page is the page that
 55373  // contains a pointer to the child.  Every page in the database contains
 55374  // 0 or 1 parent pages.  (In this context 'database page' refers
 55375  // to any page that is not part of the pointer map itself.)  Each pointer map
 55376  // entry consists of a single byte 'type' and a 4 byte parent page number.
 55377  // The PTRMAP_XXX identifiers below are the valid types.
 55378  //
 55379  // The purpose of the pointer map is to facility moving pages from one
 55380  // position in the file to another as part of autovacuum.  When a page
 55381  // is moved, the pointer in its parent must be updated to point to the
 55382  // new location.  The pointer map is used to locate the parent page quickly.
 55383  //
 55384  // PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
 55385  //                  used in this case.
 55386  //
 55387  // PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
 55388  //                  is not used in this case.
 55389  //
 55390  // PTRMAP_OVERFLOW1: The database page is the first page in a list of
 55391  //                   overflow pages. The page number identifies the page that
 55392  //                   contains the cell with a pointer to this overflow page.
 55393  //
 55394  // PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
 55395  //                   overflow pages. The page-number identifies the previous
 55396  //                   page in the overflow page list.
 55397  //
 55398  // PTRMAP_BTREE: The database page is a non-root btree page. The page number
 55399  //               identifies the parent page in the btree.
 55400  
 55401  // A bunch of assert() statements to check the transaction state variables
 55402  // of handle p (type Btree*) are internally consistent.
 55403  
 55404  // The ISAUTOVACUUM macro is used within balance_nonroot() to determine
 55405  // if the database supports auto-vacuum or not. Because it is used
 55406  // within an expression that is an argument to another macro
 55407  // (sqliteMallocRaw), it is not possible to use conditional compilation.
 55408  // So, this macro is defined instead.
 55409  
 55410  // This structure is passed around through all the sanity checking routines
 55411  // in order to keep track of some global state information.
 55412  //
 55413  // The aRef[] array is allocated so that there is 1 bit for each page in
 55414  // the database. As the integrity-check proceeds, for each page used in
 55415  // the database the corresponding bit is set. This allows integrity-check to
 55416  // detect pages that are used twice and orphaned pages (both of which
 55417  // indicate corruption).
 55418  type IntegrityCk = IntegrityCk1 /* btreeInt.h:692:28 */
 55419  
 55420  // A bogus sqlite3 connection structure for use in the btree
 55421  // tests.
 55422  var sDb sqlite31          /* test3.c:32:16: */
 55423  var nRefSqlite3 int32 = 0 /* test3.c:33:12 */
 55424  
 55425  // Usage:   btree_open FILENAME NCACHE
 55426  //
 55427  // Open a new database
 55428  func btree_open(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:40:26: */
 55429  	bp := tls.Alloc(180)
 55430  	defer tls.Free(180)
 55431  
 55432  	// var pBt uintptr at bp+76, 4
 55433  
 55434  	var rc int32
 55435  	// var nCache int32 at bp+72, 4
 55436  
 55437  	// var zBuf [100]int8 at bp+80, 100
 55438  
 55439  	var n int32
 55440  	var zFilename uintptr
 55441  	if argc != 3 {
 55442  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55443  			ts+25382 /* " FILENAME NCACHE..." */, 0))
 55444  		return TCL_ERROR
 55445  	}
 55446  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+72 /* &nCache */) != 0 {
 55447  		return TCL_ERROR
 55448  	}
 55449  	nRefSqlite3++
 55450  	if nRefSqlite3 == 1 {
 55451  		sDb.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 55452  		sDb.Fmutex = sqlite3.Xsqlite3MutexAlloc(tls, SQLITE_MUTEX_RECURSIVE)
 55453  		sqlite3.Xsqlite3_mutex_enter(tls, sDb.Fmutex)
 55454  	}
 55455  	n = int32(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 55456  	zFilename = sqlite3.Xsqlite3_malloc(tls, (n + 2))
 55457  	if zFilename == uintptr(0) {
 55458  		return TCL_ERROR
 55459  	}
 55460  	libc.Xmemcpy(tls, zFilename, *(*uintptr)(unsafe.Pointer(argv + 1*4)), (uint32(n + 1)))
 55461  	*(*int8)(unsafe.Pointer(zFilename + uintptr((n + 1)))) = int8(0)
 55462  	rc = sqlite3.Xsqlite3BtreeOpen(tls, sDb.FpVfs, zFilename, uintptr(unsafe.Pointer(&sDb)), bp+76 /* &pBt */, 0,
 55463  		((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_MAIN_DB))
 55464  	sqlite3.Xsqlite3_free(tls, zFilename)
 55465  	if rc != SQLITE_OK {
 55466  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55467  		return TCL_ERROR
 55468  	}
 55469  	sqlite3.Xsqlite3BtreeSetCacheSize(tls, *(*uintptr)(unsafe.Pointer(bp + 76 /* pBt */)), *(*int32)(unsafe.Pointer(bp + 72 /* nCache */)))
 55470  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+80 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(bp + 76 /* pBt */))))
 55471  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+80 /* &zBuf[0] */, 0))
 55472  	return TCL_OK
 55473  }
 55474  
 55475  // Usage:   btree_close ID
 55476  //
 55477  // Close the given database.
 55478  func btree_close(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:86:26: */
 55479  	bp := tls.Alloc(48)
 55480  	defer tls.Free(48)
 55481  
 55482  	var pBt uintptr
 55483  	var rc int32
 55484  	if argc != 2 {
 55485  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55486  			ts+24710 /* " ID\"" */, 0))
 55487  		return TCL_ERROR
 55488  	}
 55489  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55490  	rc = sqlite3.Xsqlite3BtreeClose(tls, pBt)
 55491  	if rc != SQLITE_OK {
 55492  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55493  		return TCL_ERROR
 55494  	}
 55495  	nRefSqlite3--
 55496  	if nRefSqlite3 == 0 {
 55497  		sqlite3.Xsqlite3_mutex_leave(tls, sDb.Fmutex)
 55498  		sqlite3.Xsqlite3_mutex_free(tls, sDb.Fmutex)
 55499  		sDb.Fmutex = uintptr(0)
 55500  		sDb.FpVfs = uintptr(0)
 55501  	}
 55502  	return TCL_OK
 55503  }
 55504  
 55505  // Usage:   btree_begin_transaction ID
 55506  //
 55507  // Start a new transaction
 55508  func btree_begin_transaction(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:121:26: */
 55509  	bp := tls.Alloc(48)
 55510  	defer tls.Free(48)
 55511  
 55512  	var pBt uintptr
 55513  	var rc int32
 55514  	if argc != 2 {
 55515  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55516  			ts+24710 /* " ID\"" */, 0))
 55517  		return TCL_ERROR
 55518  	}
 55519  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55520  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55521  	rc = sqlite3.Xsqlite3BtreeBeginTrans(tls, pBt, 1, uintptr(0))
 55522  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55523  	if rc != SQLITE_OK {
 55524  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55525  		return TCL_ERROR
 55526  	}
 55527  	return TCL_OK
 55528  }
 55529  
 55530  // Usage:   btree_pager_stats ID
 55531  //
 55532  // Returns pager statistics
 55533  func btree_pager_stats(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:150:26: */
 55534  	bp := tls.Alloc(140)
 55535  	defer tls.Free(140)
 55536  
 55537  	var pBt uintptr
 55538  	var i int32
 55539  	var a uintptr
 55540  
 55541  	if argc != 2 {
 55542  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55543  			ts+24710 /* " ID\"" */, 0))
 55544  		return TCL_ERROR
 55545  	}
 55546  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55547  
 55548  	// Normally in this file, with a b-tree handle opened using the
 55549  	// [btree_open] command it is safe to call sqlite3BtreeEnter() directly.
 55550  	// But this function is sometimes called with a btree handle obtained
 55551  	// from an open SQLite connection (using [btree_from_db]). In this case
 55552  	// we need to obtain the mutex for the controlling SQLite handle before
 55553  	// it is safe to call sqlite3BtreeEnter().
 55554  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55555  
 55556  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55557  	a = sqlite3.Xsqlite3PagerStats(tls, sqlite3.Xsqlite3BtreePager(tls, pBt))
 55558  	for i = 0; i < 11; i++ {
 55559  		// var zBuf [100]int8 at bp+40, 100
 55560  
 55561  		tcl.XTcl_AppendElement(tls, interp, zName1[i])
 55562  		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))))
 55563  		tcl.XTcl_AppendElement(tls, interp, bp+40 /* &zBuf[0] */)
 55564  	}
 55565  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55566  
 55567  	// Release the mutex on the SQLite handle that controls this b-tree
 55568  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55569  	return TCL_OK
 55570  }
 55571  
 55572  var zName1 = [11]uintptr{
 55573  	ts + 24715 /* "ref" */, ts + 24719 /* "page" */, ts + 18693 /* "max" */, ts + 12279 /* "size" */, ts + 10193 /* "state" */, ts + 24724, /* "err" */
 55574  	ts + 24728 /* "hit" */, ts + 24732 /* "miss" */, ts + 24737 /* "ovfl" */, ts + 25406 /* "read" */, ts + 25411, /* "write" */
 55575  } /* test3.c:179:17 */
 55576  
 55577  // Usage:   btree_cursor ID TABLENUM WRITEABLE
 55578  //
 55579  // Create a new cursor.  Return the ID for the cursor.
 55580  func btree_cursor(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:200:26: */
 55581  	bp := tls.Alloc(110)
 55582  	defer tls.Free(110)
 55583  
 55584  	var pBt uintptr
 55585  	// var iTable int32 at bp+72, 4
 55586  
 55587  	var pCur uintptr
 55588  	var rc int32 = SQLITE_OK
 55589  	// var wrFlag int32 at bp+76, 4
 55590  
 55591  	// var zBuf [30]int8 at bp+80, 30
 55592  
 55593  	if argc != 4 {
 55594  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55595  			ts+25417 /* " ID TABLENUM WRI..." */, 0))
 55596  		return TCL_ERROR
 55597  	}
 55598  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55599  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+72 /* &iTable */) != 0 {
 55600  		return TCL_ERROR
 55601  	}
 55602  	if tcl.XTcl_GetBoolean(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 3*4)), bp+76 /* &wrFlag */) != 0 {
 55603  		return TCL_ERROR
 55604  	}
 55605  	if *(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) != 0 {
 55606  		*(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) = BTREE_WRCSR
 55607  	}
 55608  	pCur = tcl.XTcl_Alloc(tls, uint32(sqlite3.Xsqlite3BtreeCursorSize(tls)))
 55609  	libc.Xmemset(tls, pCur, 0, uint32(sqlite3.Xsqlite3BtreeCursorSize(tls)))
 55610  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55611  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55612  	rc = sqlite3.Xsqlite3BtreeLockTable(tls, pBt, *(*int32)(unsafe.Pointer(bp + 72 /* iTable */)), libc.BoolUint8(!(!(*(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)) != 0))))
 55613  	if rc == SQLITE_OK {
 55614  		rc = sqlite3.Xsqlite3BtreeCursor(tls, pBt, uint32(*(*int32)(unsafe.Pointer(bp + 72 /* iTable */))), *(*int32)(unsafe.Pointer(bp + 76 /* wrFlag */)), uintptr(0), pCur)
 55615  	}
 55616  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55617  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55618  	if rc != 0 {
 55619  		tcl.XTcl_Free(tls, pCur)
 55620  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55621  		return TCL_ERROR
 55622  	}
 55623  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+80 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+48, pCur))
 55624  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+80 /* &zBuf[0] */, 0))
 55625  	return SQLITE_OK
 55626  }
 55627  
 55628  // Usage:   btree_close_cursor ID
 55629  //
 55630  // Close a cursor opened using btree_cursor.
 55631  func btree_close_cursor(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:249:26: */
 55632  	bp := tls.Alloc(48)
 55633  	defer tls.Free(48)
 55634  
 55635  	var pCur uintptr
 55636  	var rc int32
 55637  
 55638  	if argc != 2 {
 55639  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55640  			ts+24710 /* " ID\"" */, 0))
 55641  		return TCL_ERROR
 55642  	}
 55643  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55644  	{
 55645  		var pBt uintptr = (*BtCursor)(unsafe.Pointer(pCur)).FpBtree
 55646  		sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55647  		sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55648  		rc = sqlite3.Xsqlite3BtreeCloseCursor(tls, pCur)
 55649  		sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55650  		sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55651  
 55652  	}
 55653  	tcl.XTcl_Free(tls, pCur)
 55654  	if rc != 0 {
 55655  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55656  		return TCL_ERROR
 55657  	}
 55658  	return SQLITE_OK
 55659  }
 55660  
 55661  // Usage:   btree_next ID
 55662  //
 55663  // Move the cursor to the next entry in the table.  Return 0 on success
 55664  // or 1 if the cursor was already on the last entry in the table or if
 55665  // the table is empty.
 55666  func btree_next(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:291:26: */
 55667  	bp := tls.Alloc(172)
 55668  	defer tls.Free(172)
 55669  
 55670  	var pCur uintptr
 55671  	var rc int32
 55672  	var res int32 = 0
 55673  	// var zBuf [100]int8 at bp+72, 100
 55674  
 55675  	if argc != 2 {
 55676  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55677  			ts+24710 /* " ID\"" */, 0))
 55678  		return TCL_ERROR
 55679  	}
 55680  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55681  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55682  	rc = sqlite3.Xsqlite3BtreeNext(tls, pCur, 0)
 55683  	if rc == SQLITE_DONE {
 55684  		res = 1
 55685  		rc = SQLITE_OK
 55686  	}
 55687  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55688  	if rc != 0 {
 55689  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55690  		return TCL_ERROR
 55691  	}
 55692  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, res))
 55693  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 55694  	return SQLITE_OK
 55695  }
 55696  
 55697  // Usage:   btree_first ID
 55698  //
 55699  // Move the cursor to the first entry in the table.  Return 0 if the
 55700  // cursor was left point to something and 1 if the table is empty.
 55701  func btree_first(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:330:26: */
 55702  	bp := tls.Alloc(176)
 55703  	defer tls.Free(176)
 55704  
 55705  	var pCur uintptr
 55706  	var rc int32
 55707  	*(*int32)(unsafe.Pointer(bp + 72 /* res */)) = 0
 55708  	// var zBuf [100]int8 at bp+76, 100
 55709  
 55710  	if argc != 2 {
 55711  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55712  			ts+24710 /* " ID\"" */, 0))
 55713  		return TCL_ERROR
 55714  	}
 55715  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55716  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55717  	rc = sqlite3.Xsqlite3BtreeFirst(tls, pCur, bp+72 /* &res */)
 55718  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55719  	if rc != 0 {
 55720  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc), 0))
 55721  		return TCL_ERROR
 55722  	}
 55723  	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 */))))
 55724  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+76 /* &zBuf[0] */, 0))
 55725  	return SQLITE_OK
 55726  }
 55727  
 55728  // Usage:   btree_eof ID
 55729  //
 55730  // Return TRUE if the given cursor is not pointing at a valid entry.
 55731  // Return FALSE if the cursor does point to a valid entry.
 55732  func btree_eof(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:365:26: */
 55733  	bp := tls.Alloc(106)
 55734  	defer tls.Free(106)
 55735  
 55736  	var pCur uintptr
 55737  	var rc int32
 55738  	// var zBuf [50]int8 at bp+56, 50
 55739  
 55740  	if argc != 2 {
 55741  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55742  			ts+24710 /* " ID\"" */, 0))
 55743  		return TCL_ERROR
 55744  	}
 55745  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55746  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55747  	rc = sqlite3.Xsqlite3BtreeEof(tls, pCur)
 55748  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55749  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+56 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+32, rc))
 55750  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 55751  	return SQLITE_OK
 55752  }
 55753  
 55754  // Usage:   btree_payload_size ID
 55755  //
 55756  // Return the number of bytes of payload
 55757  func btree_payload_size(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:394:26: */
 55758  	bp := tls.Alloc(106)
 55759  	defer tls.Free(106)
 55760  
 55761  	var pCur uintptr
 55762  	var n u32
 55763  	// var zBuf [50]int8 at bp+56, 50
 55764  
 55765  	if argc != 2 {
 55766  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55767  			ts+24710 /* " ID\"" */, 0))
 55768  		return TCL_ERROR
 55769  	}
 55770  	pCur = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55771  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55772  	n = sqlite3.Xsqlite3BtreePayloadSize(tls, pCur)
 55773  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 55774  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+56 /* &zBuf[0] */, ts+18230 /* "%u" */, libc.VaList(bp+32, n))
 55775  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+56 /* &zBuf[0] */, 0))
 55776  	return SQLITE_OK
 55777  }
 55778  
 55779  // usage:   varint_test  START  MULTIPLIER  COUNT  INCREMENT
 55780  //
 55781  // This command tests the putVarint() and getVarint()
 55782  // routines, both for accuracy and for speed.
 55783  //
 55784  // An integer is written using putVarint() and read back with
 55785  // getVarint() and varified to be unchanged.  This repeats COUNT
 55786  // times.  The first integer is START*MULTIPLIER.  Each iteration
 55787  // increases the integer by INCREMENT.
 55788  //
 55789  // This command returns nothing if it works.  It returns an error message
 55790  // if something goes wrong.
 55791  func btree_varint_test(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:432:26: */
 55792  	bp := tls.Alloc(516)
 55793  	defer tls.Free(516)
 55794  
 55795  	// var start u32 at bp+184, 4
 55796  
 55797  	// var mult u32 at bp+188, 4
 55798  
 55799  	// var count u32 at bp+192, 4
 55800  
 55801  	// var incr u32 at bp+196, 4
 55802  
 55803  	var in u64
 55804  	// var out u64 at bp+504, 8
 55805  
 55806  	var n1 int32
 55807  	var n2 int32
 55808  	var i int32
 55809  	var j int32
 55810  	// var zBuf [100]uint8 at bp+200, 100
 55811  
 55812  	if argc != 5 {
 55813  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55814  			ts+25441 /* " START MULTIPLIE..." */, 0))
 55815  		return TCL_ERROR
 55816  	}
 55817  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+184 /* &start */) != 0 {
 55818  		return TCL_ERROR
 55819  	}
 55820  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+188 /* &mult */) != 0 {
 55821  		return TCL_ERROR
 55822  	}
 55823  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 3*4)), bp+192 /* &count */) != 0 {
 55824  		return TCL_ERROR
 55825  	}
 55826  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 4*4)), bp+196 /* &incr */) != 0 {
 55827  		return TCL_ERROR
 55828  	}
 55829  	in = u64(*(*u32)(unsafe.Pointer(bp + 184 /* start */)))
 55830  	in = in * (u64(*(*u32)(unsafe.Pointer(bp + 188 /* mult */))))
 55831  	for i = 0; i < int32(*(*u32)(unsafe.Pointer(bp + 192 /* count */))); i++ {
 55832  		// var zErr [200]int8 at bp+300, 200
 55833  
 55834  		n1 = sqlite3.Xsqlite3PutVarint(tls, bp+200 /* &zBuf[0] */, in)
 55835  		if (n1 > 9) || (n1 < 1) {
 55836  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 55837  				ts+25476 /* "putVarint return..." */, libc.VaList(bp+32, n1))
 55838  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+300 /* &zErr[0] */, 0))
 55839  			return TCL_ERROR
 55840  		}
 55841  		n2 = int32(sqlite3.Xsqlite3GetVarint(tls, bp+200 /* &zBuf[0] */, bp+504 /* &out */))
 55842  		if n1 != n2 {
 55843  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 55844  				ts+25526 /* "putVarint return..." */, libc.VaList(bp+56, n1, n2))
 55845  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, bp+300 /* &zErr[0] */, 0))
 55846  			return TCL_ERROR
 55847  		}
 55848  		if in != *(*u64)(unsafe.Pointer(bp + 504 /* out */)) {
 55849  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 55850  				ts+25574 /* "Wrote 0x%016llx ..." */, libc.VaList(bp+88, in, *(*u64)(unsafe.Pointer(bp + 504 /* out */))))
 55851  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+104, bp+300 /* &zErr[0] */, 0))
 55852  			return TCL_ERROR
 55853  		}
 55854  		if (in & uint64(0xffffffff)) == in {
 55855  			// var out32 u32 at bp+512, 4
 55856  
 55857  			n2 = int32(func() uint8 {
 55858  				if int32(*(*uint8)(unsafe.Pointer(bp + 200 /* zBuf */))) < int32(u8(0x80)) {
 55859  					return uint8(func() int32 {
 55860  						(*(*u32)(unsafe.Pointer(bp + 512 /* out32 */))) = u32(*(*uint8)(unsafe.Pointer(bp + 200 /* zBuf */)))
 55861  						return 1
 55862  					}())
 55863  				}
 55864  				return sqlite3.Xsqlite3GetVarint32(tls, bp+200 /* &zBuf[0] */, bp+512 /* &out32 */)
 55865  			}())
 55866  			*(*u64)(unsafe.Pointer(bp + 504 /* out */)) = u64(*(*u32)(unsafe.Pointer(bp + 512 /* out32 */)))
 55867  			if n1 != n2 {
 55868  				sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 55869  					ts+25613, /* "putVarint return..." */
 55870  					libc.VaList(bp+120, n1, n2))
 55871  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+136, bp+300 /* &zErr[0] */, 0))
 55872  				return TCL_ERROR
 55873  			}
 55874  			if in != *(*u64)(unsafe.Pointer(bp + 504 /* out */)) {
 55875  				sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([200]int8{})), bp+300, /* &zErr[0] */
 55876  					ts+25663, /* "Wrote 0x%016llx ..." */
 55877  					libc.VaList(bp+152, in, *(*u64)(unsafe.Pointer(bp + 504 /* out */))))
 55878  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+168, bp+300 /* &zErr[0] */, 0))
 55879  				return TCL_ERROR
 55880  			}
 55881  		}
 55882  
 55883  		// In order to get realistic timings, run getVarint 19 more times.
 55884  		// This is because getVarint is called about 20 times more often
 55885  		// than putVarint.
 55886  		for j = 0; j < 19; j++ {
 55887  			sqlite3.Xsqlite3GetVarint(tls, bp+200 /* &zBuf[0] */, bp+504 /* &out */)
 55888  		}
 55889  		in = in + (u64(*(*u32)(unsafe.Pointer(bp + 196 /* incr */))))
 55890  	}
 55891  	return TCL_OK
 55892  }
 55893  
 55894  // usage:   btree_from_db  DB-HANDLE
 55895  //
 55896  // This command returns the btree handle for the main database associated
 55897  // with the database-handle passed as the argument. Example usage:
 55898  //
 55899  // sqlite3 db test.db
 55900  // set bt [btree_from_db db]
 55901  func btree_from_db(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:516:26: */
 55902  	bp := tls.Alloc(204)
 55903  	defer tls.Free(204)
 55904  
 55905  	// var zBuf [100]int8 at bp+104, 100
 55906  
 55907  	// var info Tcl_CmdInfo at bp+72, 32
 55908  
 55909  	var db uintptr
 55910  	var pBt uintptr
 55911  	var iDb int32 = 0
 55912  
 55913  	if (argc != 2) && (argc != 3) {
 55914  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55915  			ts+25719 /* " DB-HANDLE ?N?\"" */, 0))
 55916  		return TCL_ERROR
 55917  	}
 55918  
 55919  	if 1 != tcl.XTcl_GetCommandInfo(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)), bp+72 /* &info */) {
 55920  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+25735 /* "No such db-handl..." */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+12415 /* "\"" */, 0))
 55921  		return TCL_ERROR
 55922  	}
 55923  	if argc == 3 {
 55924  		iDb = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 55925  	}
 55926  
 55927  	db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 72 /* &info */)).FobjClientData))
 55928  
 55929  	pBt = (*Db)(unsafe.Pointer((*sqlite31)(unsafe.Pointer(db)).FaDb + uintptr(iDb)*16)).FpBt
 55930  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+104 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp+64, pBt))
 55931  	tcl.XTcl_SetResult(tls, interp, bp+104 /* &zBuf[0] */, uintptr(1))
 55932  	return TCL_OK
 55933  }
 55934  
 55935  // Usage:   btree_ismemdb ID
 55936  //
 55937  // Return true if the B-Tree is currently stored entirely in memory.
 55938  func btree_ismemdb(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:556:26: */
 55939  	bp := tls.Alloc(32)
 55940  	defer tls.Free(32)
 55941  
 55942  	var pBt uintptr
 55943  	var res int32
 55944  	var pFile uintptr
 55945  
 55946  	if argc != 2 {
 55947  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 55948  			ts+24710 /* " ID\"" */, 0))
 55949  		return TCL_ERROR
 55950  	}
 55951  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55952  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55953  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55954  	pFile = sqlite3.Xsqlite3PagerFile(tls, sqlite3.Xsqlite3BtreePager(tls, pBt))
 55955  	res = (libc.Bool32((*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods == uintptr(0)))
 55956  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55957  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55958  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((res) != 0))))
 55959  	return SQLITE_OK
 55960  }
 55961  
 55962  // usage:   btree_set_cache_size ID NCACHE
 55963  //
 55964  // Set the size of the cache used by btree $ID.
 55965  func btree_set_cache_size(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test3.c:587:26: */
 55966  	bp := tls.Alloc(36)
 55967  	defer tls.Free(36)
 55968  
 55969  	// var nCache int32 at bp+32, 4
 55970  
 55971  	var pBt uintptr
 55972  
 55973  	if argc != 3 {
 55974  		tcl.XTcl_AppendResult(tls,
 55975  			interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)), ts+25756 /* " BT NCACHE\"" */, 0))
 55976  		return TCL_ERROR
 55977  	}
 55978  	pBt = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 55979  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+32 /* &nCache */) != 0 {
 55980  		return TCL_ERROR
 55981  	}
 55982  
 55983  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55984  	sqlite3.Xsqlite3BtreeEnter(tls, pBt)
 55985  	sqlite3.Xsqlite3BtreeSetCacheSize(tls, pBt, *(*int32)(unsafe.Pointer(bp + 32 /* nCache */)))
 55986  	sqlite3.Xsqlite3BtreeLeave(tls, pBt)
 55987  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer(pBt)).Fdb)).Fmutex)
 55988  	return TCL_OK
 55989  }
 55990  
 55991  // usage:   btree_insert CSR ?KEY? VALUE
 55992  //
 55993  // Set the size of the cache used by btree $ID.
 55994  func btree_insert(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test3.c:617:26: */
 55995  	bp := tls.Alloc(60)
 55996  	defer tls.Free(60)
 55997  
 55998  	var pCur uintptr
 55999  	// var rc int32 at bp+56, 4
 56000  
 56001  	// var x BtreePayload at bp+16, 40
 56002  
 56003  	if (objc != 4) && (objc != 3) {
 56004  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+25768 /* "?-intkey? CSR KE..." */)
 56005  		return TCL_ERROR
 56006  	}
 56007  
 56008  	libc.Xmemset(tls, bp+16 /* &x */, 0, uint32(unsafe.Sizeof(BtreePayload{})))
 56009  	if objc == 4 {
 56010  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+56 /* &rc */) != 0 {
 56011  			return TCL_ERROR
 56012  		}
 56013  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FnKey = sqlite3_int64(*(*int32)(unsafe.Pointer(bp + 56 /* rc */)))
 56014  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FpData = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), (bp + 16 /* &x */ + 28 /* &.nData */))
 56015  	} else {
 56016  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FpKey = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+56 /* &rc */)
 56017  		(*BtreePayload)(unsafe.Pointer(bp + 16 /* &x */)).FnKey = sqlite3_int64(*(*int32)(unsafe.Pointer(bp + 56 /* rc */)))
 56018  	}
 56019  	pCur = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 56020  
 56021  	sqlite3.Xsqlite3_mutex_enter(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).Fdb)).Fmutex)
 56022  	sqlite3.Xsqlite3BtreeEnter(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 56023  	*(*int32)(unsafe.Pointer(bp + 56 /* rc */)) = sqlite3.Xsqlite3BtreeInsert(tls, pCur, bp+16 /* &x */, 0, 0)
 56024  	sqlite3.Xsqlite3BtreeLeave(tls, (*BtCursor)(unsafe.Pointer(pCur)).FpBtree)
 56025  	sqlite3.Xsqlite3_mutex_leave(tls, (*sqlite31)(unsafe.Pointer((*Btree)(unsafe.Pointer((*BtCursor)(unsafe.Pointer(pCur)).FpBtree)).Fdb)).Fmutex)
 56026  
 56027  	tcl.XTcl_ResetResult(tls, interp)
 56028  	if *(*int32)(unsafe.Pointer(bp + 56 /* rc */)) != 0 {
 56029  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, *(*int32)(unsafe.Pointer(bp + 56 /* rc */))), 0))
 56030  		return TCL_ERROR
 56031  	}
 56032  	return TCL_OK
 56033  }
 56034  
 56035  // Register commands with the TCL interpreter.
 56036  func Sqlitetest3_Init(tls *libc.TLS, interp uintptr) int32 { /* test3.c:661:5: */
 56037  	var i int32
 56038  
 56039  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd3)) / uint32(unsafe.Sizeof(struct {
 56040  		FzName uintptr
 56041  		FxProc uintptr
 56042  	}{}))); i++ {
 56043  		tcl.XTcl_CreateCommand(tls, interp, aCmd3[i].FzName, aCmd3[i].FxProc, uintptr(0), uintptr(0))
 56044  	}
 56045  
 56046  	tcl.XTcl_CreateObjCommand(tls, interp, ts+25792 /* "btree_insert" */, *(*uintptr)(unsafe.Pointer(&struct {
 56047  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 56048  	}{btree_insert})), uintptr(0), uintptr(0))
 56049  
 56050  	return TCL_OK
 56051  }
 56052  
 56053  var aCmd3 = [14]struct {
 56054  	FzName uintptr
 56055  	FxProc uintptr
 56056  }{
 56057  	{FzName: ts + 25805 /* "btree_open" */, FxProc: 0},
 56058  	{FzName: ts + 25816 /* "btree_close" */, FxProc: 0},
 56059  	{FzName: ts + 25828 /* "btree_begin_tran..." */, FxProc: 0},
 56060  	{FzName: ts + 25852 /* "btree_pager_stat..." */, FxProc: 0},
 56061  	{FzName: ts + 25870 /* "btree_cursor" */, FxProc: 0},
 56062  	{FzName: ts + 25883 /* "btree_close_curs..." */, FxProc: 0},
 56063  	{FzName: ts + 25902 /* "btree_next" */, FxProc: 0},
 56064  	{FzName: ts + 25913 /* "btree_eof" */, FxProc: 0},
 56065  	{FzName: ts + 25923 /* "btree_payload_si..." */, FxProc: 0},
 56066  	{FzName: ts + 25942 /* "btree_first" */, FxProc: 0},
 56067  	{FzName: ts + 25954 /* "btree_varint_tes..." */, FxProc: 0},
 56068  	{FzName: ts + 25972 /* "btree_from_db" */, FxProc: 0},
 56069  	{FzName: ts + 25986 /* "btree_ismemdb" */, FxProc: 0},
 56070  	{FzName: ts + 26000 /* "btree_set_cache_..." */, FxProc: 0},
 56071  } /* test3.c:665:5 */
 56072  
 56073  // end block for C++
 56074  
 56075  // Local Variables:
 56076  // mode: c
 56077  // c-basic-offset: 4
 56078  // fill-column: 78
 56079  // End:
 56080  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56081  //    This file is part of the GNU C Library.
 56082  //
 56083  //    The GNU C Library is free software; you can redistribute it and/or
 56084  //    modify it under the terms of the GNU Lesser General Public
 56085  //    License as published by the Free Software Foundation; either
 56086  //    version 2.1 of the License, or (at your option) any later version.
 56087  //
 56088  //    The GNU C Library is distributed in the hope that it will be useful,
 56089  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56090  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56091  //    Lesser General Public License for more details.
 56092  //
 56093  //    You should have received a copy of the GNU Lesser General Public
 56094  //    License along with the GNU C Library; if not, see
 56095  //    <http://www.gnu.org/licenses/>.
 56096  
 56097  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 56098  
 56099  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56100  //    This file is part of the GNU C Library.
 56101  //
 56102  //    The GNU C Library is free software; you can redistribute it and/or
 56103  //    modify it under the terms of the GNU Lesser General Public
 56104  //    License as published by the Free Software Foundation; either
 56105  //    version 2.1 of the License, or (at your option) any later version.
 56106  //
 56107  //    The GNU C Library is distributed in the hope that it will be useful,
 56108  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56109  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56110  //    Lesser General Public License for more details.
 56111  //
 56112  //    You should have received a copy of the GNU Lesser General Public
 56113  //    License along with the GNU C Library; if not, see
 56114  //    <http://www.gnu.org/licenses/>.
 56115  
 56116  //	ISO C99 Standard: 7.21 String handling	<string.h>
 56117  
 56118  // Copyright (C) 2002-2018 Free Software Foundation, Inc.
 56119  //    This file is part of the GNU C Library.
 56120  //
 56121  //    The GNU C Library is free software; you can redistribute it and/or
 56122  //    modify it under the terms of the GNU Lesser General Public
 56123  //    License as published by the Free Software Foundation; either
 56124  //    version 2.1 of the License, or (at your option) any later version.
 56125  //
 56126  //    The GNU C Library is distributed in the hope that it will be useful,
 56127  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56128  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56129  //    Lesser General Public License for more details.
 56130  //
 56131  //    You should have received a copy of the GNU Lesser General Public
 56132  //    License along with the GNU C Library; if not, see
 56133  //    <http://www.gnu.org/licenses/>.
 56134  
 56135  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56136  //    This file is part of the GNU C Library.
 56137  //
 56138  //    The GNU C Library is free software; you can redistribute it and/or
 56139  //    modify it under the terms of the GNU Lesser General Public
 56140  //    License as published by the Free Software Foundation; either
 56141  //    version 2.1 of the License, or (at your option) any later version.
 56142  //
 56143  //    The GNU C Library is distributed in the hope that it will be useful,
 56144  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56145  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56146  //    Lesser General Public License for more details.
 56147  //
 56148  //    You should have received a copy of the GNU Lesser General Public
 56149  //    License along with the GNU C Library; if not, see
 56150  //    <http://www.gnu.org/licenses/>.
 56151  
 56152  // Copyright (C) 1992-2018 Free Software Foundation, Inc.
 56153  //    This file is part of the GNU C Library.
 56154  //
 56155  //    The GNU C Library is free software; you can redistribute it and/or
 56156  //    modify it under the terms of the GNU Lesser General Public
 56157  //    License as published by the Free Software Foundation; either
 56158  //    version 2.1 of the License, or (at your option) any later version.
 56159  //
 56160  //    The GNU C Library is distributed in the hope that it will be useful,
 56161  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56162  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56163  //    Lesser General Public License for more details.
 56164  //
 56165  //    You should have received a copy of the GNU Lesser General Public
 56166  //    License along with the GNU C Library; if not, see
 56167  //    <http://www.gnu.org/licenses/>.
 56168  
 56169  // Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface.
 56170  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 56171  //    This file is part of the GNU C Library.
 56172  //
 56173  //    The GNU C Library is free software; you can redistribute it and/or
 56174  //    modify it under the terms of the GNU Lesser General Public
 56175  //    License as published by the Free Software Foundation; either
 56176  //    version 2.1 of the License, or (at your option) any later version.
 56177  //
 56178  //    The GNU C Library is distributed in the hope that it will be useful,
 56179  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56180  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56181  //    Lesser General Public License for more details.
 56182  //
 56183  //    You should have received a copy of the GNU Lesser General Public
 56184  //    License along with the GNU C Library; if not, see
 56185  //    <http://www.gnu.org/licenses/>.
 56186  
 56187  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56188  //    This file is part of the GNU C Library.
 56189  //
 56190  //    The GNU C Library is free software; you can redistribute it and/or
 56191  //    modify it under the terms of the GNU Lesser General Public
 56192  //    License as published by the Free Software Foundation; either
 56193  //    version 2.1 of the License, or (at your option) any later version.
 56194  //
 56195  //    The GNU C Library is distributed in the hope that it will be useful,
 56196  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56197  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56198  //    Lesser General Public License for more details.
 56199  //
 56200  //    You should have received a copy of the GNU Lesser General Public
 56201  //    License along with the GNU C Library; if not, see
 56202  //    <http://www.gnu.org/licenses/>.
 56203  
 56204  // Get type definitions.
 56205  // bits/types.h -- definitions of __*_t types underlying *_t types.
 56206  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 56207  //    This file is part of the GNU C Library.
 56208  //
 56209  //    The GNU C Library is free software; you can redistribute it and/or
 56210  //    modify it under the terms of the GNU Lesser General Public
 56211  //    License as published by the Free Software Foundation; either
 56212  //    version 2.1 of the License, or (at your option) any later version.
 56213  //
 56214  //    The GNU C Library is distributed in the hope that it will be useful,
 56215  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56216  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56217  //    Lesser General Public License for more details.
 56218  //
 56219  //    You should have received a copy of the GNU Lesser General Public
 56220  //    License along with the GNU C Library; if not, see
 56221  //    <http://www.gnu.org/licenses/>.
 56222  
 56223  // Never include this file directly; use <sys/types.h> instead.
 56224  
 56225  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 56226  //
 56227  // This file is part of GCC.
 56228  //
 56229  // GCC is free software; you can redistribute it and/or modify
 56230  // it under the terms of the GNU General Public License as published by
 56231  // the Free Software Foundation; either version 3, or (at your option)
 56232  // any later version.
 56233  //
 56234  // GCC is distributed in the hope that it will be useful,
 56235  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 56236  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 56237  // GNU General Public License for more details.
 56238  //
 56239  // Under Section 7 of GPL version 3, you are granted additional
 56240  // permissions described in the GCC Runtime Library Exception, version
 56241  // 3.1, as published by the Free Software Foundation.
 56242  //
 56243  // You should have received a copy of the GNU General Public License and
 56244  // a copy of the GCC Runtime Library Exception along with this program;
 56245  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 56246  // <http://www.gnu.org/licenses/>.
 56247  
 56248  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 56249  
 56250  // Any one of these symbols __need_* means that GNU libc
 56251  //    wants us just to define one data type.  So don't define
 56252  //    the symbols that indicate this file's entire job has been done.
 56253  
 56254  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 56255  //    There's no way to win with the other order!  Sun lossage.
 56256  
 56257  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 56258  //    one less case to deal with in the following.
 56259  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 56260  
 56261  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 56262  //    defined if the corresponding type is *not* defined.
 56263  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 56264  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 56265  
 56266  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 56267  //    Just ignore it.
 56268  
 56269  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 56270  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 56271  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 56272  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 56273  //    If we find that the macros are still defined at this point, we must
 56274  //    invoke them so that the type is defined as expected.
 56275  
 56276  // In case nobody has defined these types, but we aren't running under
 56277  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 56278  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 56279  //    parts of GCC is compiled by an older compiler, that actually
 56280  //    include gstddef.h, such as collect2.
 56281  
 56282  // Signed type of difference of two pointers.
 56283  
 56284  // Define this type if we are doing the whole job,
 56285  //    or if we want this type in particular.
 56286  
 56287  // If this symbol has done its job, get rid of it.
 56288  
 56289  // Unsigned type of `sizeof' something.
 56290  
 56291  // Define this type if we are doing the whole job,
 56292  //    or if we want this type in particular.
 56293  
 56294  // Wide character type.
 56295  //    Locale-writers should change this as necessary to
 56296  //    be big enough to hold unique values not between 0 and 127,
 56297  //    and not (wchar_t) -1, for each defined multibyte character.
 56298  
 56299  // Define this type if we are doing the whole job,
 56300  //    or if we want this type in particular.
 56301  
 56302  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 56303  //     are already defined.
 56304  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 56305  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 56306  
 56307  // A null pointer constant.
 56308  
 56309  // Offset of member MEMBER in a struct of type TYPE.
 56310  
 56311  // NB: Include guard matches what <linux/time.h> uses.
 56312  
 56313  // Get system specific constant and data structure definitions.
 56314  // Definitions of constants and data structure for POSIX 1003.1b-1993
 56315  //    scheduling interface.
 56316  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 56317  //    This file is part of the GNU C Library.
 56318  //
 56319  //    The GNU C Library is free software; you can redistribute it and/or
 56320  //    modify it under the terms of the GNU Lesser General Public
 56321  //    License as published by the Free Software Foundation; either
 56322  //    version 2.1 of the License, or (at your option) any later version.
 56323  //
 56324  //    The GNU C Library is distributed in the hope that it will be useful,
 56325  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56326  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56327  //    Lesser General Public License for more details.
 56328  //
 56329  //    You should have received a copy of the GNU Lesser General Public
 56330  //    License along with the GNU C Library; if not, see
 56331  //    <http://www.gnu.org/licenses/>.
 56332  
 56333  // Scheduling algorithms.
 56334  
 56335  // Cloning flags.
 56336  
 56337  // Sched parameter structure.  Generic version.
 56338  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 56339  //    This file is part of the GNU C Library.
 56340  //
 56341  //    The GNU C Library is free software; you can redistribute it and/or
 56342  //    modify it under the terms of the GNU Lesser General Public
 56343  //    License as published by the Free Software Foundation; either
 56344  //    version 2.1 of the License, or (at your option) any later version.
 56345  //
 56346  //    The GNU C Library is distributed in the hope that it will be useful,
 56347  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56348  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56349  //    Lesser General Public License for more details.
 56350  //
 56351  //    You should have received a copy of the GNU Lesser General Public
 56352  //    License along with the GNU C Library;  if not, see
 56353  //    <http://www.gnu.org/licenses/>.
 56354  
 56355  // Data structure to describe a process' schedulability.
 56356  type sched_param = struct{ Fsched_priority int32 } /* struct_sched_param.h:23:1 */
 56357  
 56358  // Basic access functions.
 56359  
 56360  // Data structure to describe CPU mask.
 56361  type cpu_set_t = struct{ F__bits [32]uint32 } /* cpu-set.h:42:3 */
 56362  
 56363  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56364  //    This file is part of the GNU C Library.
 56365  //
 56366  //    The GNU C Library is free software; you can redistribute it and/or
 56367  //    modify it under the terms of the GNU Lesser General Public
 56368  //    License as published by the Free Software Foundation; either
 56369  //    version 2.1 of the License, or (at your option) any later version.
 56370  //
 56371  //    The GNU C Library is distributed in the hope that it will be useful,
 56372  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56373  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56374  //    Lesser General Public License for more details.
 56375  //
 56376  //    You should have received a copy of the GNU Lesser General Public
 56377  //    License along with the GNU C Library; if not, see
 56378  //    <http://www.gnu.org/licenses/>.
 56379  
 56380  //	ISO C99 Standard: 7.23 Date and time	<time.h>
 56381  
 56382  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 56383  //    This file is part of the GNU C Library.
 56384  //
 56385  //    The GNU C Library is free software; you can redistribute it and/or
 56386  //    modify it under the terms of the GNU Lesser General Public
 56387  //    License as published by the Free Software Foundation; either
 56388  //    version 2.1 of the License, or (at your option) any later version.
 56389  //
 56390  //    The GNU C Library is distributed in the hope that it will be useful,
 56391  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56392  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56393  //    Lesser General Public License for more details.
 56394  //
 56395  //    You should have received a copy of the GNU Lesser General Public
 56396  //    License along with the GNU C Library; if not, see
 56397  //    <http://www.gnu.org/licenses/>.
 56398  
 56399  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 56400  //
 56401  // This file is part of GCC.
 56402  //
 56403  // GCC is free software; you can redistribute it and/or modify
 56404  // it under the terms of the GNU General Public License as published by
 56405  // the Free Software Foundation; either version 3, or (at your option)
 56406  // any later version.
 56407  //
 56408  // GCC is distributed in the hope that it will be useful,
 56409  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 56410  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 56411  // GNU General Public License for more details.
 56412  //
 56413  // Under Section 7 of GPL version 3, you are granted additional
 56414  // permissions described in the GCC Runtime Library Exception, version
 56415  // 3.1, as published by the Free Software Foundation.
 56416  //
 56417  // You should have received a copy of the GNU General Public License and
 56418  // a copy of the GCC Runtime Library Exception along with this program;
 56419  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 56420  // <http://www.gnu.org/licenses/>.
 56421  
 56422  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 56423  
 56424  // Any one of these symbols __need_* means that GNU libc
 56425  //    wants us just to define one data type.  So don't define
 56426  //    the symbols that indicate this file's entire job has been done.
 56427  
 56428  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 56429  //    There's no way to win with the other order!  Sun lossage.
 56430  
 56431  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 56432  //    one less case to deal with in the following.
 56433  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 56434  
 56435  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 56436  //    defined if the corresponding type is *not* defined.
 56437  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 56438  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 56439  
 56440  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 56441  //    Just ignore it.
 56442  
 56443  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 56444  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 56445  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 56446  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 56447  //    If we find that the macros are still defined at this point, we must
 56448  //    invoke them so that the type is defined as expected.
 56449  
 56450  // In case nobody has defined these types, but we aren't running under
 56451  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 56452  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 56453  //    parts of GCC is compiled by an older compiler, that actually
 56454  //    include gstddef.h, such as collect2.
 56455  
 56456  // Signed type of difference of two pointers.
 56457  
 56458  // Define this type if we are doing the whole job,
 56459  //    or if we want this type in particular.
 56460  
 56461  // If this symbol has done its job, get rid of it.
 56462  
 56463  // Unsigned type of `sizeof' something.
 56464  
 56465  // Define this type if we are doing the whole job,
 56466  //    or if we want this type in particular.
 56467  
 56468  // Wide character type.
 56469  //    Locale-writers should change this as necessary to
 56470  //    be big enough to hold unique values not between 0 and 127,
 56471  //    and not (wchar_t) -1, for each defined multibyte character.
 56472  
 56473  // Define this type if we are doing the whole job,
 56474  //    or if we want this type in particular.
 56475  
 56476  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 56477  //     are already defined.
 56478  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 56479  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 56480  
 56481  // A null pointer constant.
 56482  
 56483  // Offset of member MEMBER in a struct of type TYPE.
 56484  
 56485  // This defines CLOCKS_PER_SEC, which is the number of processor clock
 56486  //    ticks per second, and possibly a number of other constants.
 56487  // System-dependent timing definitions.  Linux version.
 56488  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 56489  //    This file is part of the GNU C Library.
 56490  //
 56491  //    The GNU C Library is free software; you can redistribute it and/or
 56492  //    modify it under the terms of the GNU Lesser General Public
 56493  //    License as published by the Free Software Foundation; either
 56494  //    version 2.1 of the License, or (at your option) any later version.
 56495  //
 56496  //    The GNU C Library is distributed in the hope that it will be useful,
 56497  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56498  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56499  //    Lesser General Public License for more details.
 56500  //
 56501  //    You should have received a copy of the GNU Lesser General Public
 56502  //    License along with the GNU C Library; if not, see
 56503  //    <http://www.gnu.org/licenses/>.
 56504  
 56505  // Never include this file directly; use <time.h> instead.
 56506  
 56507  // bits/types.h -- definitions of __*_t types underlying *_t types.
 56508  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 56509  //    This file is part of the GNU C Library.
 56510  //
 56511  //    The GNU C Library is free software; you can redistribute it and/or
 56512  //    modify it under the terms of the GNU Lesser General Public
 56513  //    License as published by the Free Software Foundation; either
 56514  //    version 2.1 of the License, or (at your option) any later version.
 56515  //
 56516  //    The GNU C Library is distributed in the hope that it will be useful,
 56517  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56518  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56519  //    Lesser General Public License for more details.
 56520  //
 56521  //    You should have received a copy of the GNU Lesser General Public
 56522  //    License along with the GNU C Library; if not, see
 56523  //    <http://www.gnu.org/licenses/>.
 56524  
 56525  // Never include this file directly; use <sys/types.h> instead.
 56526  
 56527  // ISO/IEC 9899:1999 7.23.1: Components of time
 56528  //    The macro `CLOCKS_PER_SEC' is an expression with type `clock_t' that is
 56529  //    the number per second of the value returned by the `clock' function.
 56530  // CAE XSH, Issue 4, Version 2: <time.h>
 56531  //    The value of CLOCKS_PER_SEC is required to be 1 million on all
 56532  //    XSI-conformant systems.
 56533  
 56534  // Identifier for system-wide realtime clock.
 56535  // Monotonic system-wide clock.
 56536  // High-resolution timer from the CPU.
 56537  // Thread-specific CPU-time clock.
 56538  // Monotonic system-wide clock, not adjusted for frequency scaling.
 56539  // Identifier for system-wide realtime clock, updated only on ticks.
 56540  // Monotonic system-wide clock, updated only on ticks.
 56541  // Monotonic system-wide clock that includes time spent in suspension.
 56542  // Like CLOCK_REALTIME but also wakes suspended system.
 56543  // Like CLOCK_BOOTTIME but also wakes suspended system.
 56544  // Like CLOCK_REALTIME but in International Atomic Time.
 56545  
 56546  // Flag to indicate time is absolute.
 56547  
 56548  // Copyright (C) 1995-2018 Free Software Foundation, Inc.
 56549  //    This file is part of the GNU C Library.
 56550  //
 56551  //    The GNU C Library is free software; you can redistribute it and/or
 56552  //    modify it under the terms of the GNU Lesser General Public
 56553  //    License as published by the Free Software Foundation; either
 56554  //    version 2.1 of the License, or (at your option) any later version.
 56555  //
 56556  //    The GNU C Library is distributed in the hope that it will be useful,
 56557  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56558  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56559  //    Lesser General Public License for more details.
 56560  //
 56561  //    You should have received a copy of the GNU Lesser General Public
 56562  //    License along with the GNU C Library; if not, see
 56563  //    <http://www.gnu.org/licenses/>.
 56564  
 56565  // bits/types.h -- definitions of __*_t types underlying *_t types.
 56566  //    Copyright (C) 2002-2018 Free Software Foundation, Inc.
 56567  //    This file is part of the GNU C Library.
 56568  //
 56569  //    The GNU C Library is free software; you can redistribute it and/or
 56570  //    modify it under the terms of the GNU Lesser General Public
 56571  //    License as published by the Free Software Foundation; either
 56572  //    version 2.1 of the License, or (at your option) any later version.
 56573  //
 56574  //    The GNU C Library is distributed in the hope that it will be useful,
 56575  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 56576  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 56577  //    Lesser General Public License for more details.
 56578  //
 56579  //    You should have received a copy of the GNU Lesser General Public
 56580  //    License along with the GNU C Library; if not, see
 56581  //    <http://www.gnu.org/licenses/>.
 56582  
 56583  // Never include this file directly; use <sys/types.h> instead.
 56584  
 56585  // These definitions from linux/timex.h as of 3.18.
 56586  
 56587  type timex = struct {
 56588  	Fmodes     uint32
 56589  	Foffset    int32
 56590  	Ffreq      int32
 56591  	Fmaxerror  int32
 56592  	Festerror  int32
 56593  	Fstatus    int32
 56594  	Fconstant  int32
 56595  	Fprecision int32
 56596  	Ftolerance int32
 56597  	Ftime      struct {
 56598  		Ftv_sec  int32
 56599  		Ftv_usec int32
 56600  	}
 56601  	Ftick    int32
 56602  	Fppsfreq int32
 56603  	Fjitter  int32
 56604  	Fshift   int32
 56605  	Fstabil  int32
 56606  	Fjitcnt  int32
 56607  	Fcalcnt  int32
 56608  	Ferrcnt  int32
 56609  	Fstbcnt  int32
 56610  	Ftai     int32
 56611  	__84     uint32 /* int : 32 */
 56612  	__88     uint32 /* int : 32 */
 56613  	__92     uint32 /* int : 32 */
 56614  	__96     uint32 /* int : 32 */
 56615  	__100    uint32 /* int : 32 */
 56616  	__104    uint32 /* int : 32 */
 56617  	__108    uint32 /* int : 32 */
 56618  	__112    uint32 /* int : 32 */
 56619  	__116    uint32 /* int : 32 */
 56620  	__120    uint32 /* int : 32 */
 56621  	__124    uint32 /* int : 32 */
 56622  } /* timex.h:26:1 */
 56623  
 56624  // Conditional variable handling.
 56625  
 56626  // Cleanup buffers
 56627  type _pthread_cleanup_buffer = struct {
 56628  	F__routine    uintptr
 56629  	F__arg        uintptr
 56630  	F__canceltype int32
 56631  	F__prev       uintptr
 56632  } /* pthread.h:191:1 */
 56633  
 56634  // No special attributes by default.
 56635  
 56636  // Structure to hold the cleanup handler information.
 56637  type __pthread_cleanup_frame = struct {
 56638  	F__cancel_routine uintptr
 56639  	F__cancel_arg     uintptr
 56640  	F__do_it          int32
 56641  	F__cancel_type    int32
 56642  } /* pthread.h:541:1 */
 56643  
 56644  // Each thread is controlled by an instance of the following
 56645  // structure.
 56646  type Thread = struct {
 56647  	FzFilename  uintptr
 56648  	FxOp        uintptr
 56649  	FzArg       uintptr
 56650  	Fopnum      int32
 56651  	Fbusy       int32
 56652  	Fcompleted  int32
 56653  	Fdb         uintptr
 56654  	FpStmt      uintptr
 56655  	FzErr       uintptr
 56656  	FzStaticErr uintptr
 56657  	Frc         int32
 56658  	Fargc       int32
 56659  	Fargv       [100]uintptr
 56660  	Fcolv       [100]uintptr
 56661  } /* test4.c:33:23 */
 56662  
 56663  // There can be as many as 26 threads running at once.  Each is named
 56664  // by a capital letter: A, B, C, ..., Y, Z.
 56665  var threadset [26]Thread /* test4.c:61:15: */
 56666  
 56667  // The main loop for a thread.  Threads use busy waiting.
 56668  func test_thread_main(tls *libc.TLS, pArg uintptr) uintptr { /* test4.c:67:13: */
 56669  	var p uintptr = pArg
 56670  	if (*Thread)(unsafe.Pointer(p)).Fdb != 0 {
 56671  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 56672  	}
 56673  	sqlite3.Xsqlite3_open(tls, (*Thread)(unsafe.Pointer(p)).FzFilename, (p + 24 /* &.db */))
 56674  	if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*Thread)(unsafe.Pointer(p)).Fdb) {
 56675  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.Xstrdup(tls, sqlite3.Xsqlite3_errmsg(tls, (*Thread)(unsafe.Pointer(p)).Fdb))
 56676  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 56677  		(*Thread)(unsafe.Pointer(p)).Fdb = uintptr(0)
 56678  	}
 56679  	(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56680  	(*Thread)(unsafe.Pointer(p)).Fcompleted = 1
 56681  	for (*Thread)(unsafe.Pointer(p)).Fopnum <= (*Thread)(unsafe.Pointer(p)).Fcompleted {
 56682  		libc2.Xsched_yield(tls)
 56683  	}
 56684  	for (*Thread)(unsafe.Pointer(p)).FxOp != 0 {
 56685  		if ((*Thread)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread)(unsafe.Pointer(p)).FzErr != (*Thread)(unsafe.Pointer(p)).FzStaticErr) {
 56686  			sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzErr)
 56687  			(*Thread)(unsafe.Pointer(p)).FzErr = uintptr(0)
 56688  		}
 56689  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 4 /* &.xOp */))))(tls, p)
 56690  		(*Thread)(unsafe.Pointer(p)).Fcompleted++
 56691  		for (*Thread)(unsafe.Pointer(p)).Fopnum <= (*Thread)(unsafe.Pointer(p)).Fcompleted {
 56692  			libc2.Xsched_yield(tls)
 56693  		}
 56694  	}
 56695  	if (*Thread)(unsafe.Pointer(p)).FpStmt != 0 {
 56696  		sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 56697  		(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 56698  	}
 56699  	if (*Thread)(unsafe.Pointer(p)).Fdb != 0 {
 56700  		sqlite3.Xsqlite3_close(tls, (*Thread)(unsafe.Pointer(p)).Fdb)
 56701  		(*Thread)(unsafe.Pointer(p)).Fdb = uintptr(0)
 56702  	}
 56703  	if ((*Thread)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread)(unsafe.Pointer(p)).FzErr != (*Thread)(unsafe.Pointer(p)).FzStaticErr) {
 56704  		sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzErr)
 56705  		(*Thread)(unsafe.Pointer(p)).FzErr = uintptr(0)
 56706  	}
 56707  	(*Thread)(unsafe.Pointer(p)).Fcompleted++
 56708  	sqlite3.Xsqlite3_thread_cleanup(tls)
 56709  	return uintptr(0)
 56710  }
 56711  
 56712  // Get a thread ID which is an upper case letter.  Return the index.
 56713  // If the argument is not a valid thread ID put an error message in
 56714  // the interpreter and return -1.
 56715  func parse_thread_id(tls *libc.TLS, interp uintptr, zArg uintptr) int32 { /* test4.c:114:12: */
 56716  	bp := tls.Alloc(16)
 56717  	defer tls.Free(16)
 56718  
 56719  	if (((zArg == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zArg))) == 0)) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0)) || !((int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zArg)))))*2))) & int32(_ISupper)) != 0) {
 56720  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26021 /* "thread ID must b..." */, 0))
 56721  		return -1
 56722  	}
 56723  	return (int32(*(*int8)(unsafe.Pointer(zArg))) - 'A')
 56724  }
 56725  
 56726  // Usage:    thread_create NAME  FILENAME
 56727  //
 56728  // NAME should be an upper case letter.  Start the thread running with
 56729  // an open connection to the given database.
 56730  func tcl_thread_create(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:128:26: */
 56731  	bp := tls.Alloc(92)
 56732  	defer tls.Free(92)
 56733  
 56734  	var i int32
 56735  	// var x pthread_t at bp+88, 4
 56736  
 56737  	var rc int32
 56738  
 56739  	if argc != 3 {
 56740  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56741  			ts+26060 /* " ID FILENAME" */, 0))
 56742  		return TCL_ERROR
 56743  	}
 56744  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56745  	if i < 0 {
 56746  		return TCL_ERROR
 56747  	}
 56748  	if threadset[i].Fbusy != 0 {
 56749  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26073 /* "thread " */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+26081 /* " is already runn..." */, 0))
 56750  		return TCL_ERROR
 56751  	}
 56752  	threadset[i].Fbusy = 1
 56753  	sqlite3.Xsqlite3_free(tls, threadset[i].FzFilename)
 56754  	threadset[i].FzFilename = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 56755  	threadset[i].Fopnum = 1
 56756  	threadset[i].Fcompleted = 0
 56757  	rc = libc2.Xpthread_create(tls, bp+88 /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 56758  		f func(*libc.TLS, uintptr) uintptr
 56759  	}{test_thread_main})), (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56760  	if rc != 0 {
 56761  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+26101 /* "failed to create..." */, 0))
 56762  		sqlite3.Xsqlite3_free(tls, threadset[i].FzFilename)
 56763  		threadset[i].Fbusy = 0
 56764  		return TCL_ERROR
 56765  	}
 56766  	libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp + 88 /* x */)))
 56767  	return TCL_OK
 56768  }
 56769  
 56770  // Wait for a thread to reach its idle state.
 56771  func test_thread_wait(tls *libc.TLS, p uintptr) { /* test4.c:168:13: */
 56772  	for (*Thread)(unsafe.Pointer(p)).Fopnum > (*Thread)(unsafe.Pointer(p)).Fcompleted {
 56773  		libc2.Xsched_yield(tls)
 56774  	}
 56775  }
 56776  
 56777  // Usage:  thread_wait ID
 56778  //
 56779  // Wait on thread ID to reach its idle state.
 56780  func tcl_thread_wait(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:177:26: */
 56781  	bp := tls.Alloc(48)
 56782  	defer tls.Free(48)
 56783  
 56784  	var i int32
 56785  
 56786  	if argc != 2 {
 56787  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56788  			ts+26129 /* " ID" */, 0))
 56789  		return TCL_ERROR
 56790  	}
 56791  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56792  	if i < 0 {
 56793  		return TCL_ERROR
 56794  	}
 56795  	if !(threadset[i].Fbusy != 0) {
 56796  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56797  		return TCL_ERROR
 56798  	}
 56799  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56800  	return TCL_OK
 56801  }
 56802  
 56803  // Stop a thread.
 56804  func test_stop_thread(tls *libc.TLS, p uintptr) { /* test4.c:203:13: */
 56805  	test_thread_wait(tls, p)
 56806  	(*Thread)(unsafe.Pointer(p)).FxOp = uintptr(0)
 56807  	(*Thread)(unsafe.Pointer(p)).Fopnum++
 56808  	test_thread_wait(tls, p)
 56809  	sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzArg)
 56810  	(*Thread)(unsafe.Pointer(p)).FzArg = uintptr(0)
 56811  	sqlite3.Xsqlite3_free(tls, (*Thread)(unsafe.Pointer(p)).FzFilename)
 56812  	(*Thread)(unsafe.Pointer(p)).FzFilename = uintptr(0)
 56813  	(*Thread)(unsafe.Pointer(p)).Fbusy = 0
 56814  }
 56815  
 56816  // Usage:  thread_halt ID
 56817  //
 56818  // Cause a thread to shut itself down.  Wait for the shutdown to be
 56819  // completed.  If ID is "*" then stop all threads.
 56820  func tcl_thread_halt(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:221:26: */
 56821  	bp := tls.Alloc(48)
 56822  	defer tls.Free(48)
 56823  
 56824  	var i int32
 56825  
 56826  	if argc != 2 {
 56827  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56828  			ts+26129 /* " ID" */, 0))
 56829  		return TCL_ERROR
 56830  	}
 56831  	if (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*4))))) == '*') && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*4)) + 1))) == 0) {
 56832  		for i = 0; i < N_THREAD; i++ {
 56833  			if threadset[i].Fbusy != 0 {
 56834  				test_stop_thread(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56835  			}
 56836  		}
 56837  	} else {
 56838  		i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56839  		if i < 0 {
 56840  			return TCL_ERROR
 56841  		}
 56842  		if !(threadset[i].Fbusy != 0) {
 56843  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56844  			return TCL_ERROR
 56845  		}
 56846  		test_stop_thread(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56847  	}
 56848  	return TCL_OK
 56849  }
 56850  
 56851  // Usage: thread_argc  ID
 56852  //
 56853  // Wait on the most recent thread_step to complete, then return the
 56854  // number of columns in the result set.
 56855  func tcl_thread_argc(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:256:26: */
 56856  	bp := tls.Alloc(172)
 56857  	defer tls.Free(172)
 56858  
 56859  	var i int32
 56860  	// var zBuf [100]int8 at bp+72, 100
 56861  
 56862  	if argc != 2 {
 56863  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56864  			ts+26129 /* " ID" */, 0))
 56865  		return TCL_ERROR
 56866  	}
 56867  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56868  	if i < 0 {
 56869  		return TCL_ERROR
 56870  	}
 56871  	if !(threadset[i].Fbusy != 0) {
 56872  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56873  		return TCL_ERROR
 56874  	}
 56875  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56876  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, threadset[i].Fargc))
 56877  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 56878  	return TCL_OK
 56879  }
 56880  
 56881  // Usage: thread_argv  ID   N
 56882  //
 56883  // Wait on the most recent thread_step to complete, then return the
 56884  // value of the N-th columns in the result set.
 56885  func tcl_thread_argv(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:288:26: */
 56886  	bp := tls.Alloc(84)
 56887  	defer tls.Free(84)
 56888  
 56889  	var i int32
 56890  	// var n int32 at bp+80, 4
 56891  
 56892  	if argc != 3 {
 56893  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56894  			ts+26148 /* " ID N" */, 0))
 56895  		return TCL_ERROR
 56896  	}
 56897  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56898  	if i < 0 {
 56899  		return TCL_ERROR
 56900  	}
 56901  	if !(threadset[i].Fbusy != 0) {
 56902  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56903  		return TCL_ERROR
 56904  	}
 56905  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+80 /* &n */) != 0 {
 56906  		return TCL_ERROR
 56907  	}
 56908  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56909  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset[i].Fargc) {
 56910  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 56911  		return TCL_ERROR
 56912  	}
 56913  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848 + 48 /* &.argv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*4)), 0))
 56914  	return TCL_OK
 56915  }
 56916  
 56917  // Usage: thread_colname  ID   N
 56918  //
 56919  // Wait on the most recent thread_step to complete, then return the
 56920  // name of the N-th columns in the result set.
 56921  func tcl_thread_colname(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:324:26: */
 56922  	bp := tls.Alloc(84)
 56923  	defer tls.Free(84)
 56924  
 56925  	var i int32
 56926  	// var n int32 at bp+80, 4
 56927  
 56928  	if argc != 3 {
 56929  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56930  			ts+26148 /* " ID N" */, 0))
 56931  		return TCL_ERROR
 56932  	}
 56933  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56934  	if i < 0 {
 56935  		return TCL_ERROR
 56936  	}
 56937  	if !(threadset[i].Fbusy != 0) {
 56938  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56939  		return TCL_ERROR
 56940  	}
 56941  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+80 /* &n */) != 0 {
 56942  		return TCL_ERROR
 56943  	}
 56944  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56945  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset[i].Fargc) {
 56946  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 56947  		return TCL_ERROR
 56948  	}
 56949  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848 + 448 /* &.colv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*4)), 0))
 56950  	return TCL_OK
 56951  }
 56952  
 56953  // Usage: thread_result  ID
 56954  //
 56955  // Wait on the most recent operation to complete, then return the
 56956  // result code from that operation.
 56957  func tcl_thread_result(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:360:26: */
 56958  	bp := tls.Alloc(64)
 56959  	defer tls.Free(64)
 56960  
 56961  	var i int32
 56962  	var zName uintptr
 56963  
 56964  	if argc != 2 {
 56965  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56966  			ts+26129 /* " ID" */, 0))
 56967  		return TCL_ERROR
 56968  	}
 56969  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56970  	if i < 0 {
 56971  		return TCL_ERROR
 56972  	}
 56973  	if !(threadset[i].Fbusy != 0) {
 56974  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 56975  		return TCL_ERROR
 56976  	}
 56977  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 56978  	zName = sqlite3.Xsqlite3ErrName(tls, threadset[i].Frc)
 56979  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, zName, 0))
 56980  	return TCL_OK
 56981  }
 56982  
 56983  // Usage: thread_error  ID
 56984  //
 56985  // Wait on the most recent operation to complete, then return the
 56986  // error string.
 56987  func tcl_thread_error(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:392:26: */
 56988  	bp := tls.Alloc(64)
 56989  	defer tls.Free(64)
 56990  
 56991  	var i int32
 56992  
 56993  	if argc != 2 {
 56994  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 56995  			ts+26129 /* " ID" */, 0))
 56996  		return TCL_ERROR
 56997  	}
 56998  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 56999  	if i < 0 {
 57000  		return TCL_ERROR
 57001  	}
 57002  	if !(threadset[i].Fbusy != 0) {
 57003  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57004  		return TCL_ERROR
 57005  	}
 57006  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57007  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, threadset[i].FzErr, 0))
 57008  	return TCL_OK
 57009  }
 57010  
 57011  // This procedure runs in the thread to compile an SQL statement.
 57012  func do_compile(tls *libc.TLS, p uintptr) { /* test4.c:419:13: */
 57013  	if (*Thread)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 57014  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26181 /* "no database is o..." */)
 57015  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 57016  		return
 57017  	}
 57018  	if (*Thread)(unsafe.Pointer(p)).FpStmt != 0 {
 57019  		sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 57020  		(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 57021  	}
 57022  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_prepare(tls, (*Thread)(unsafe.Pointer(p)).Fdb, (*Thread)(unsafe.Pointer(p)).FzArg, -1, (p + 28 /* &.pStmt */), uintptr(0))
 57023  }
 57024  
 57025  // Usage: thread_compile ID SQL
 57026  //
 57027  // Compile a new virtual machine.
 57028  func tcl_thread_compile(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:437:26: */
 57029  	bp := tls.Alloc(56)
 57030  	defer tls.Free(56)
 57031  
 57032  	var i int32
 57033  	if argc != 3 {
 57034  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57035  			ts+26201 /* " ID SQL" */, 0))
 57036  		return TCL_ERROR
 57037  	}
 57038  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57039  	if i < 0 {
 57040  		return TCL_ERROR
 57041  	}
 57042  	if !(threadset[i].Fbusy != 0) {
 57043  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57044  		return TCL_ERROR
 57045  	}
 57046  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57047  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_compile}))
 57048  	sqlite3.Xsqlite3_free(tls, threadset[i].FzArg)
 57049  	threadset[i].FzArg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 57050  	threadset[i].Fopnum++
 57051  	return TCL_OK
 57052  }
 57053  
 57054  // This procedure runs in the thread to step the virtual machine.
 57055  func do_step(tls *libc.TLS, p uintptr) { /* test4.c:466:13: */
 57056  	var i int32
 57057  	if (*Thread)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 57058  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 57059  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 57060  		return
 57061  	}
 57062  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_step(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 57063  	if (*Thread)(unsafe.Pointer(p)).Frc == SQLITE_ROW {
 57064  		(*Thread)(unsafe.Pointer(p)).Fargc = sqlite3.Xsqlite3_column_count(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 57065  		for i = 0; i < sqlite3.Xsqlite3_data_count(tls, (*Thread)(unsafe.Pointer(p)).FpStmt); i++ {
 57066  			*(*uintptr)(unsafe.Pointer((p + 48 /* &.argv */) + uintptr(i)*4)) = sqlite3.Xsqlite3_column_text(tls, (*Thread)(unsafe.Pointer(p)).FpStmt, i)
 57067  		}
 57068  		for i = 0; i < (*Thread)(unsafe.Pointer(p)).Fargc; i++ {
 57069  			*(*uintptr)(unsafe.Pointer((p + 448 /* &.colv */) + uintptr(i)*4)) = sqlite3.Xsqlite3_column_name(tls, (*Thread)(unsafe.Pointer(p)).FpStmt, i)
 57070  		}
 57071  	}
 57072  }
 57073  
 57074  // Usage: thread_step ID
 57075  //
 57076  // Advance the virtual machine by one step
 57077  func tcl_thread_step(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:490:26: */
 57078  	bp := tls.Alloc(48)
 57079  	defer tls.Free(48)
 57080  
 57081  	var i int32
 57082  	if argc != 2 {
 57083  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57084  			ts+26238 /* " IDL" */, 0))
 57085  		return TCL_ERROR
 57086  	}
 57087  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57088  	if i < 0 {
 57089  		return TCL_ERROR
 57090  	}
 57091  	if !(threadset[i].Fbusy != 0) {
 57092  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57093  		return TCL_ERROR
 57094  	}
 57095  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57096  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_step}))
 57097  	threadset[i].Fopnum++
 57098  	return TCL_OK
 57099  }
 57100  
 57101  // This procedure runs in the thread to finalize a virtual machine.
 57102  func do_finalize(tls *libc.TLS, p uintptr) { /* test4.c:517:13: */
 57103  	if (*Thread)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 57104  		(*Thread)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 57105  		(*Thread)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 57106  		return
 57107  	}
 57108  	(*Thread)(unsafe.Pointer(p)).Frc = sqlite3.Xsqlite3_finalize(tls, (*Thread)(unsafe.Pointer(p)).FpStmt)
 57109  	(*Thread)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 57110  }
 57111  
 57112  // Usage: thread_finalize ID
 57113  //
 57114  // Finalize the virtual machine.
 57115  func tcl_thread_finalize(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:532:26: */
 57116  	bp := tls.Alloc(48)
 57117  	defer tls.Free(48)
 57118  
 57119  	var i int32
 57120  	if argc != 2 {
 57121  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57122  			ts+26238 /* " IDL" */, 0))
 57123  		return TCL_ERROR
 57124  	}
 57125  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57126  	if i < 0 {
 57127  		return TCL_ERROR
 57128  	}
 57129  	if !(threadset[i].Fbusy != 0) {
 57130  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57131  		return TCL_ERROR
 57132  	}
 57133  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57134  	threadset[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_finalize}))
 57135  	sqlite3.Xsqlite3_free(tls, threadset[i].FzArg)
 57136  	threadset[i].FzArg = uintptr(0)
 57137  	threadset[i].Fopnum++
 57138  	return TCL_OK
 57139  }
 57140  
 57141  // Usage: thread_swap ID ID
 57142  //
 57143  // Interchange the sqlite* pointer between two threads.
 57144  func tcl_thread_swap(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:563:26: */
 57145  	bp := tls.Alloc(64)
 57146  	defer tls.Free(64)
 57147  
 57148  	var i int32
 57149  	var j int32
 57150  	var temp uintptr
 57151  	if argc != 3 {
 57152  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57153  			ts+26243 /* " ID1 ID2" */, 0))
 57154  		return TCL_ERROR
 57155  	}
 57156  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57157  	if i < 0 {
 57158  		return TCL_ERROR
 57159  	}
 57160  	if !(threadset[i].Fbusy != 0) {
 57161  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57162  		return TCL_ERROR
 57163  	}
 57164  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57165  	j = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 57166  	if j < 0 {
 57167  		return TCL_ERROR
 57168  	}
 57169  	if !(threadset[j].Fbusy != 0) {
 57170  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26133 /* "no such thread" */, 0))
 57171  		return TCL_ERROR
 57172  	}
 57173  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(j)*848))
 57174  	temp = threadset[i].Fdb
 57175  	threadset[i].Fdb = threadset[j].Fdb
 57176  	threadset[j].Fdb = temp
 57177  	return TCL_OK
 57178  }
 57179  
 57180  // Usage: thread_db_get ID
 57181  //
 57182  // Return the database connection pointer for the given thread.  Then
 57183  // remove the pointer from the thread itself.  Afterwards, the thread
 57184  // can be stopped and the connection can be used by the main thread.
 57185  func tcl_thread_db_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:603:26: */
 57186  	bp := tls.Alloc(164)
 57187  	defer tls.Free(164)
 57188  
 57189  	var i int32
 57190  	// var zBuf [100]int8 at bp+64, 100
 57191  
 57192  	if argc != 2 {
 57193  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57194  			ts+26129 /* " ID" */, 0))
 57195  		return TCL_ERROR
 57196  	}
 57197  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57198  	if i < 0 {
 57199  		return TCL_ERROR
 57200  	}
 57201  	if !(threadset[i].Fbusy != 0) {
 57202  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57203  		return TCL_ERROR
 57204  	}
 57205  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57206  	sqlite3TestMakePointerStr(tls, interp, bp+64 /* &zBuf[0] */, threadset[i].Fdb)
 57207  	threadset[i].Fdb = uintptr(0)
 57208  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+64 /* &zBuf[0] */, uintptr(0)))
 57209  	return TCL_OK
 57210  }
 57211  
 57212  // Usage: thread_db_put ID DB
 57213  //
 57214  func tcl_thread_db_put(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:634:26: */
 57215  	bp := tls.Alloc(48)
 57216  	defer tls.Free(48)
 57217  
 57218  	var i int32
 57219  	if argc != 3 {
 57220  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57221  			ts+26252 /* " ID DB" */, 0))
 57222  		return TCL_ERROR
 57223  	}
 57224  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57225  	if i < 0 {
 57226  		return TCL_ERROR
 57227  	}
 57228  	if !(threadset[i].Fbusy != 0) {
 57229  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57230  		return TCL_ERROR
 57231  	}
 57232  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57233  
 57234  	threadset[i].Fdb = sqlite3TestTextToPtr(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 57235  	return TCL_OK
 57236  }
 57237  
 57238  // Usage: thread_stmt_get ID
 57239  //
 57240  // Return the database stmt pointer for the given thread.  Then
 57241  // remove the pointer from the thread itself.
 57242  func tcl_thread_stmt_get(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test4.c:666:26: */
 57243  	bp := tls.Alloc(164)
 57244  	defer tls.Free(164)
 57245  
 57246  	var i int32
 57247  	// var zBuf [100]int8 at bp+64, 100
 57248  
 57249  	if argc != 2 {
 57250  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 57251  			ts+26129 /* " ID" */, 0))
 57252  		return TCL_ERROR
 57253  	}
 57254  	i = parse_thread_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 57255  	if i < 0 {
 57256  		return TCL_ERROR
 57257  	}
 57258  	if !(threadset[i].Fbusy != 0) {
 57259  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 57260  		return TCL_ERROR
 57261  	}
 57262  	test_thread_wait(tls, (uintptr(unsafe.Pointer(&threadset)) + uintptr(i)*848))
 57263  	sqlite3TestMakePointerStr(tls, interp, bp+64 /* &zBuf[0] */, threadset[i].FpStmt)
 57264  	threadset[i].FpStmt = uintptr(0)
 57265  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, bp+64 /* &zBuf[0] */, uintptr(0)))
 57266  	return TCL_OK
 57267  }
 57268  
 57269  // Register commands with the TCL interpreter.
 57270  func Sqlitetest4_Init(tls *libc.TLS, interp uintptr) int32 { /* test4.c:696:5: */
 57271  	var i int32
 57272  
 57273  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd4)) / uint32(unsafe.Sizeof(struct {
 57274  		FzName uintptr
 57275  		FxProc uintptr
 57276  	}{}))); i++ {
 57277  		tcl.XTcl_CreateCommand(tls, interp, aCmd4[i].FzName, aCmd4[i].FxProc, uintptr(0), uintptr(0))
 57278  	}
 57279  	return TCL_OK
 57280  }
 57281  
 57282  var aCmd4 = [15]struct {
 57283  	FzName uintptr
 57284  	FxProc uintptr
 57285  }{
 57286  	{FzName: ts + 26259 /* "thread_create" */, FxProc: 0},
 57287  	{FzName: ts + 26273 /* "thread_wait" */, FxProc: 0},
 57288  	{FzName: ts + 26285 /* "thread_halt" */, FxProc: 0},
 57289  	{FzName: ts + 26297 /* "thread_argc" */, FxProc: 0},
 57290  	{FzName: ts + 26309 /* "thread_argv" */, FxProc: 0},
 57291  	{FzName: ts + 26321 /* "thread_colname" */, FxProc: 0},
 57292  	{FzName: ts + 26336 /* "thread_result" */, FxProc: 0},
 57293  	{FzName: ts + 26350 /* "thread_error" */, FxProc: 0},
 57294  	{FzName: ts + 26363 /* "thread_compile" */, FxProc: 0},
 57295  	{FzName: ts + 26378 /* "thread_step" */, FxProc: 0},
 57296  	{FzName: ts + 26390 /* "thread_finalize" */, FxProc: 0},
 57297  	{FzName: ts + 26406 /* "thread_swap" */, FxProc: 0},
 57298  	{FzName: ts + 26418 /* "thread_db_get" */, FxProc: 0},
 57299  	{FzName: ts + 26432 /* "thread_db_put" */, FxProc: 0},
 57300  	{FzName: ts + 26446 /* "thread_stmt_get" */, FxProc: 0},
 57301  } /* test4.c:700:5 */
 57302  
 57303  // end block for C++
 57304  
 57305  // Local Variables:
 57306  // mode: c
 57307  // c-basic-offset: 4
 57308  // fill-column: 78
 57309  // End:
 57310  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 57311  //    This file is part of the GNU C Library.
 57312  //
 57313  //    The GNU C Library is free software; you can redistribute it and/or
 57314  //    modify it under the terms of the GNU Lesser General Public
 57315  //    License as published by the Free Software Foundation; either
 57316  //    version 2.1 of the License, or (at your option) any later version.
 57317  //
 57318  //    The GNU C Library is distributed in the hope that it will be useful,
 57319  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 57320  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 57321  //    Lesser General Public License for more details.
 57322  //
 57323  //    You should have received a copy of the GNU Lesser General Public
 57324  //    License along with the GNU C Library; if not, see
 57325  //    <http://www.gnu.org/licenses/>.
 57326  
 57327  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 57328  
 57329  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 57330  //    This file is part of the GNU C Library.
 57331  //
 57332  //    The GNU C Library is free software; you can redistribute it and/or
 57333  //    modify it under the terms of the GNU Lesser General Public
 57334  //    License as published by the Free Software Foundation; either
 57335  //    version 2.1 of the License, or (at your option) any later version.
 57336  //
 57337  //    The GNU C Library is distributed in the hope that it will be useful,
 57338  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 57339  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 57340  //    Lesser General Public License for more details.
 57341  //
 57342  //    You should have received a copy of the GNU Lesser General Public
 57343  //    License along with the GNU C Library; if not, see
 57344  //    <http://www.gnu.org/licenses/>.
 57345  
 57346  //	ISO C99 Standard: 7.21 String handling	<string.h>
 57347  
 57348  // The first argument is a TCL UTF-8 string. Return the byte array
 57349  // object with the encoded representation of the string, including
 57350  // the NULL terminator.
 57351  func binarize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:33:26: */
 57352  	bp := tls.Alloc(4)
 57353  	defer tls.Free(4)
 57354  
 57355  	// var len int32 at bp, 4
 57356  
 57357  	var bytes uintptr
 57358  	var pRet uintptr
 57359  
 57360  	bytes = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &len */)
 57361  	pRet = tcl.XTcl_NewByteArrayObj(tls, bytes, (*(*int32)(unsafe.Pointer(bp /* len */)) + 1))
 57362  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 57363  	return TCL_OK
 57364  }
 57365  
 57366  // Usage: test_value_overhead <repeat-count> <do-calls>.
 57367  //
 57368  // This routine is used to test the overhead of calls to
 57369  // sqlite3_value_text(), on a value that contains a UTF-8 string. The idea
 57370  // is to figure out whether or not it is a problem to use sqlite3_value
 57371  // structures with collation sequence functions.
 57372  //
 57373  // If <do-calls> is 0, then the calls to sqlite3_value_text() are not
 57374  // actually made.
 57375  func test_value_overhead(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:61:26: */
 57376  	bp := tls.Alloc(80)
 57377  	defer tls.Free(80)
 57378  
 57379  	// var do_calls int32 at bp+36, 4
 57380  
 57381  	// var repeat_count int32 at bp+32, 4
 57382  
 57383  	var i int32
 57384  	// var val Mem at bp+40, 40
 57385  
 57386  	if objc != 3 {
 57387  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 57388  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)), ts+26462 /* " <repeat-count> ..." */, 0))
 57389  		return TCL_ERROR
 57390  	}
 57391  
 57392  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+32 /* &repeat_count */) != 0 {
 57393  		return TCL_ERROR
 57394  	}
 57395  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+36 /* &do_calls */) != 0 {
 57396  		return TCL_ERROR
 57397  	}
 57398  
 57399  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fflags = (u16((MEM_Str | MEM_Term) | MEM_Static))
 57400  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fz = ts + 26489 /* "hello world" */
 57401  	(*Mem)(unsafe.Pointer(bp + 40 /* &val */)).Fenc = u8(SQLITE_UTF8)
 57402  
 57403  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 32 /* repeat_count */)); i++ {
 57404  		if *(*int32)(unsafe.Pointer(bp + 36 /* do_calls */)) != 0 {
 57405  			sqlite3.Xsqlite3_value_text(tls, bp+40 /* &val */)
 57406  		}
 57407  	}
 57408  
 57409  	return TCL_OK
 57410  }
 57411  
 57412  func name_to_enc(tls *libc.TLS, interp uintptr, pObj uintptr) u8 { /* test5.c:94:11: */
 57413  	bp := tls.Alloc(64)
 57414  	defer tls.Free(64)
 57415  
 57416  	*(*[5]EncName)(unsafe.Pointer(bp + 24 /* encnames */)) = [5]EncName{
 57417  		{FzName: ts + 26501 /* "UTF8" */, Fenc: u8(SQLITE_UTF8)},
 57418  		{FzName: ts + 26506 /* "UTF16LE" */, Fenc: u8(SQLITE_UTF16LE)},
 57419  		{FzName: ts + 26514 /* "UTF16BE" */, Fenc: u8(SQLITE_UTF16BE)},
 57420  		{FzName: ts + 26522 /* "UTF16" */, Fenc: u8(SQLITE_UTF16)},
 57421  		{},
 57422  	}
 57423  	var pEnc uintptr
 57424  	var z uintptr = tcl.XTcl_GetString(tls, pObj)
 57425  	for pEnc = (bp + 24 /* &encnames */); (*EncName)(unsafe.Pointer(pEnc)).FzName != 0; pEnc += 8 {
 57426  		if 0 == sqlite3.Xsqlite3StrICmp(tls, z, (*EncName)(unsafe.Pointer(pEnc)).FzName) {
 57427  			break
 57428  		}
 57429  	}
 57430  	if !(int32((*EncName)(unsafe.Pointer(pEnc)).Fenc) != 0) {
 57431  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26528 /* "No such encoding..." */, z, 0))
 57432  	}
 57433  	if int32((*EncName)(unsafe.Pointer(pEnc)).Fenc) == SQLITE_UTF16 {
 57434  		return u8(SQLITE_UTF16LE)
 57435  	}
 57436  	return (*EncName)(unsafe.Pointer(pEnc)).Fenc
 57437  }
 57438  
 57439  type EncName = struct {
 57440  	FzName uintptr
 57441  	Fenc   u8
 57442  	_      [3]byte
 57443  } /* test5.c:95:3 */
 57444  
 57445  // Usage:   test_translate <string/blob> <from enc> <to enc> ?<transient>?
 57446  //
 57447  func test_translate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:125:26: */
 57448  	bp := tls.Alloc(44)
 57449  	defer tls.Free(44)
 57450  
 57451  	var enc_from u8
 57452  	var enc_to u8
 57453  	var pVal uintptr
 57454  	var z uintptr
 57455  	// var len int32 at bp+40, 4
 57456  
 57457  	var xDel uintptr = uintptr(0)
 57458  
 57459  	if (objc != 4) && (objc != 5) {
 57460  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 57461  			tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv)), uintptr(0)),
 57462  			ts+26547 /* " <string/blob> <..." */, 0))
 57463  		return TCL_ERROR
 57464  	}
 57465  	if objc == 5 {
 57466  		xDel = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free}))
 57467  	}
 57468  
 57469  	enc_from = name_to_enc(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 57470  	if !(enc_from != 0) {
 57471  		return TCL_ERROR
 57472  	}
 57473  	enc_to = name_to_enc(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 57474  	if !(enc_to != 0) {
 57475  		return TCL_ERROR
 57476  	}
 57477  
 57478  	pVal = sqlite3.Xsqlite3ValueNew(tls, uintptr(0))
 57479  
 57480  	if int32(enc_from) == SQLITE_UTF8 {
 57481  		z = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 57482  		if objc == 5 {
 57483  			z = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+32, z))
 57484  		}
 57485  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, z, enc_from, xDel)
 57486  	} else {
 57487  		z = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+40 /* &len */)
 57488  		if objc == 5 {
 57489  			var zTmp uintptr = z
 57490  			z = sqlite3.Xsqlite3_malloc(tls, *(*int32)(unsafe.Pointer(bp + 40 /* len */)))
 57491  			libc.Xmemcpy(tls, z, zTmp, uint32(*(*int32)(unsafe.Pointer(bp + 40 /* len */))))
 57492  		}
 57493  		sqlite3.Xsqlite3ValueSetStr(tls, pVal, -1, z, enc_from, xDel)
 57494  	}
 57495  
 57496  	z = sqlite3.Xsqlite3ValueText(tls, pVal, enc_to)
 57497  	*(*int32)(unsafe.Pointer(bp + 40 /* len */)) = (sqlite3.Xsqlite3ValueBytes(tls, pVal, enc_to) + (func() int32 {
 57498  		if int32(enc_to) == SQLITE_UTF8 {
 57499  			return 1
 57500  		}
 57501  		return 2
 57502  	}()))
 57503  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, z, *(*int32)(unsafe.Pointer(bp + 40 /* len */))))
 57504  
 57505  	sqlite3.Xsqlite3ValueFree(tls, pVal)
 57506  
 57507  	return TCL_OK
 57508  }
 57509  
 57510  func test_translate_selftest(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test5.c:189:26: */
 57511  	sqlite3.Xsqlite3UtfSelfTest(tls)
 57512  	return SQLITE_OK
 57513  }
 57514  
 57515  // Register commands with the TCL interpreter.
 57516  func Sqlitetest5_Init(tls *libc.TLS, interp uintptr) int32 { /* test5.c:205:5: */
 57517  	var i int32
 57518  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd5)) / uint32(unsafe.Sizeof(struct {
 57519  		FzName uintptr
 57520  		FxProc uintptr
 57521  	}{}))); i++ {
 57522  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd5[i].FzName, aCmd5[i].FxProc, uintptr(0), uintptr(0))
 57523  	}
 57524  	return SQLITE_OK
 57525  }
 57526  
 57527  var aCmd5 = [4]struct {
 57528  	FzName uintptr
 57529  	FxProc uintptr
 57530  }{
 57531  	{FzName: ts + 26582 /* "binarize" */, FxProc: 0},
 57532  	{FzName: ts + 26591 /* "test_value_overh..." */, FxProc: 0},
 57533  	{FzName: ts + 26611 /* "test_translate" */, FxProc: 0},
 57534  	{FzName: ts + 26626 /* "translate_selfte..." */, FxProc: 0},
 57535  } /* test5.c:209:5 */
 57536  
 57537  // end block for C++
 57538  
 57539  // Local Variables:
 57540  // mode: c
 57541  // c-basic-offset: 4
 57542  // fill-column: 78
 57543  // End:
 57544  
 57545  // #define TRACE_CRASHTEST
 57546  
 57547  type CrashFile1 = struct {
 57548  	FpMethod   uintptr
 57549  	FpRealFile uintptr
 57550  	FzName     uintptr
 57551  	Fflags     int32
 57552  	FzData     uintptr
 57553  	FnData     int32
 57554  	FiSize     i64
 57555  } /* test6.c:29:9 */
 57556  
 57557  // end block for C++
 57558  
 57559  // Local Variables:
 57560  // mode: c
 57561  // c-basic-offset: 4
 57562  // fill-column: 78
 57563  // End:
 57564  
 57565  // #define TRACE_CRASHTEST
 57566  
 57567  type CrashFile = CrashFile1 /* test6.c:29:26 */
 57568  type CrashGlobal1 = struct {
 57569  	FpWriteList             uintptr
 57570  	FpWriteListEnd          uintptr
 57571  	FiSectorSize            int32
 57572  	FiDeviceCharacteristics int32
 57573  	FiCrash                 int32
 57574  	FzCrashFile             [500]int8
 57575  } /* test6.c:30:9 */
 57576  
 57577  type CrashGlobal = CrashGlobal1 /* test6.c:30:28 */
 57578  type WriteBuffer1 = struct {
 57579  	FiOffset i64
 57580  	FnBuf    int32
 57581  	FzBuf    uintptr
 57582  	FpFile   uintptr
 57583  	FpNext   uintptr
 57584  } /* test6.c:30:9 */
 57585  
 57586  type WriteBuffer = WriteBuffer1 /* test6.c:31:28 */
 57587  
 57588  var g = CrashGlobal{FiSectorSize: SQLITE_DEFAULT_SECTOR_SIZE} /* test6.c:156:20 */
 57589  
 57590  // Set this global variable to 1 to enable crash testing.
 57591  var sqlite3CrashTestEnable int32 = 0 /* test6.c:161:12 */
 57592  
 57593  func crash_malloc(tls *libc.TLS, nByte int32) uintptr { /* test6.c:163:13: */
 57594  	return tcl.XTcl_AttemptAlloc(tls, size_t(nByte))
 57595  }
 57596  
 57597  func crash_free(tls *libc.TLS, p uintptr) { /* test6.c:166:13: */
 57598  	tcl.XTcl_Free(tls, p)
 57599  }
 57600  
 57601  func crash_realloc(tls *libc.TLS, p uintptr, n int32) uintptr { /* test6.c:169:13: */
 57602  	return tcl.XTcl_AttemptRealloc(tls, p, size_t(n))
 57603  }
 57604  
 57605  // Wrapper around the sqlite3OsWrite() function that avoids writing to the
 57606  // 512 byte block begining at offset PENDING_BYTE.
 57607  func writeDbFile(tls *libc.TLS, p uintptr, z uintptr, iAmt i64, iOff i64) int32 { /* test6.c:177:12: */
 57608  	var rc int32 = SQLITE_OK
 57609  	var iSkip int32 = 0
 57610  	if (iAmt - i64(iSkip)) > int64(0) {
 57611  		rc = sqlite3.Xsqlite3OsWrite(tls, (*CrashFile)(unsafe.Pointer(p)).FpRealFile, (z + uintptr(iSkip)), (int32(iAmt - i64(iSkip))), (iOff + i64(iSkip)))
 57612  	}
 57613  	return rc
 57614  }
 57615  
 57616  // Flush the write-list as if xSync() had been called on file handle
 57617  // pFile. If isCrash is true, simulate a crash.
 57618  func writeListSync(tls *libc.TLS, pFile uintptr, isCrash int32) int32 { /* test6.c:190:12: */
 57619  	bp := tls.Alloc(16)
 57620  	defer tls.Free(16)
 57621  
 57622  	var rc int32 = SQLITE_OK
 57623  	var iDc int32 = g.FiDeviceCharacteristics
 57624  	var pWrite uintptr
 57625  	var ppPtr uintptr
 57626  
 57627  	// If this is not a crash simulation, set pFinal to point to the
 57628  	// last element of the write-list that is associated with file handle
 57629  	// pFile.
 57630  	//
 57631  	// If this is a crash simulation, set pFinal to an arbitrarily selected
 57632  	// element of the write-list.
 57633  	var pFinal uintptr = uintptr(0)
 57634  	if !(isCrash != 0) {
 57635  		for pWrite = g.FpWriteList; pWrite != 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 57636  			if (*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile == pFile {
 57637  				pFinal = pWrite
 57638  			}
 57639  		}
 57640  	} else if (iDc & (SQLITE_IOCAP_SEQUENTIAL | SQLITE_IOCAP_SAFE_APPEND)) != 0 {
 57641  		var nWrite int32 = 0
 57642  		// var iFinal int32 at bp, 4
 57643  
 57644  		for pWrite = g.FpWriteList; pWrite != 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 57645  			nWrite++
 57646  		}
 57647  		sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp /* &iFinal */)
 57648  		*(*int32)(unsafe.Pointer(bp /* iFinal */)) = ((func() int32 {
 57649  			if *(*int32)(unsafe.Pointer(bp /* iFinal */)) < 0 {
 57650  				return (-1 * *(*int32)(unsafe.Pointer(bp /* iFinal */)))
 57651  			}
 57652  			return *(*int32)(unsafe.Pointer(bp /* iFinal */))
 57653  		}()) % nWrite)
 57654  		for pWrite = g.FpWriteList; *(*int32)(unsafe.Pointer(bp /* iFinal */)) > 0; pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 57655  			*(*int32)(unsafe.Pointer(bp /* iFinal */))--
 57656  		}
 57657  		pFinal = pWrite
 57658  	}
 57659  
 57660  	ppPtr = (uintptr(unsafe.Pointer(&g)) /* &.pWriteList */)
 57661  	for pWrite = *(*uintptr)(unsafe.Pointer(ppPtr)); (rc == SQLITE_OK) && (pWrite != 0); pWrite = *(*uintptr)(unsafe.Pointer(ppPtr)) {
 57662  		var pRealFile uintptr = (*CrashFile)(unsafe.Pointer((*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile)).FpRealFile
 57663  
 57664  		// (eAction==1)      -> write block out normally,
 57665  		// (eAction==2)      -> do nothing,
 57666  		// (eAction==3)      -> trash sectors.
 57667  		var eAction int32 = 0
 57668  		if !(isCrash != 0) {
 57669  			eAction = 2
 57670  			if ((*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile == pFile) || ((iDc & SQLITE_IOCAP_SEQUENTIAL) != 0) {
 57671  				eAction = 1
 57672  			}
 57673  		} else {
 57674  			// var random int8 at bp+4, 1
 57675  
 57676  			sqlite3.Xsqlite3_randomness(tls, 1, bp+4 /* &random */)
 57677  
 57678  			// Do not select option 3 (sector trashing) if the IOCAP_ATOMIC flag
 57679  			// is set or this is an OsTruncate(), not an Oswrite().
 57680  			if ((iDc & SQLITE_IOCAP_ATOMIC) != 0) || ((*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf == uintptr(0)) {
 57681  				*(*int8)(unsafe.Pointer(bp + 4 /* random */)) &= int8(0x01)
 57682  			}
 57683  
 57684  			// If IOCAP_SEQUENTIAL is set and this is not the final entry
 57685  			// in the truncated write-list, always select option 1 (write
 57686  			// out correctly).
 57687  			if ((iDc & SQLITE_IOCAP_SEQUENTIAL) != 0) && (pWrite != pFinal) {
 57688  				*(*int8)(unsafe.Pointer(bp + 4 /* random */)) = int8(0)
 57689  			}
 57690  
 57691  			// If IOCAP_SAFE_APPEND is set and this OsWrite() operation is
 57692  			// an append (first byte of the written region is 1 byte past the
 57693  			// current EOF), always select option 1 (write out correctly).
 57694  			if ((iDc & SQLITE_IOCAP_SAFE_APPEND) != 0) && ((*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf != 0) {
 57695  				// var iSize i64 at bp+8, 8
 57696  
 57697  				sqlite3.Xsqlite3OsFileSize(tls, pRealFile, bp+8 /* &iSize */)
 57698  				if *(*i64)(unsafe.Pointer(bp + 8 /* iSize */)) == (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset {
 57699  					*(*int8)(unsafe.Pointer(bp + 4 /* random */)) = int8(0)
 57700  				}
 57701  			}
 57702  
 57703  			if (int32(*(*int8)(unsafe.Pointer(bp + 4 /* random */))) & 0x06) == 0x06 {
 57704  				eAction = 3
 57705  			} else {
 57706  				eAction = func() int32 {
 57707  					if (int32(*(*int8)(unsafe.Pointer(bp + 4 /* random */))) & 0x01) != 0 {
 57708  						return 2
 57709  					}
 57710  					return 1
 57711  				}()
 57712  			}
 57713  		}
 57714  
 57715  		switch eAction {
 57716  		case 1:
 57717  			{ // Write out correctly
 57718  				if (*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf != 0 {
 57719  					rc = writeDbFile(tls,
 57720  						(*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile, (*WriteBuffer)(unsafe.Pointer(pWrite)).FzBuf, int64((*WriteBuffer)(unsafe.Pointer(pWrite)).FnBuf), (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset)
 57721  				} else {
 57722  					rc = sqlite3.Xsqlite3OsTruncate(tls, pRealFile, (*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset)
 57723  				}
 57724  				*(*uintptr)(unsafe.Pointer(ppPtr)) = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext
 57725  				crash_free(tls, pWrite)
 57726  				break
 57727  
 57728  			}
 57729  		case 2:
 57730  			{ // Do nothing
 57731  				ppPtr = (pWrite + 20 /* &.pNext */)
 57732  				break
 57733  
 57734  			}
 57735  		case 3:
 57736  			{ // Trash sectors
 57737  				var zGarbage uintptr
 57738  				var iFirst int32 = (int32((*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset / i64(g.FiSectorSize)))
 57739  				var iLast int32 = (int32((((*WriteBuffer)(unsafe.Pointer(pWrite)).FiOffset + i64((*WriteBuffer)(unsafe.Pointer(pWrite)).FnBuf)) - int64(1)) / i64(g.FiSectorSize)))
 57740  
 57741  				zGarbage = crash_malloc(tls, g.FiSectorSize)
 57742  				if zGarbage != 0 {
 57743  					var i sqlite3_int64
 57744  					for i = sqlite3_int64(iFirst); (rc == SQLITE_OK) && (i <= sqlite3_int64(iLast)); i++ {
 57745  						sqlite3.Xsqlite3_randomness(tls, g.FiSectorSize, zGarbage)
 57746  						rc = writeDbFile(tls,
 57747  							(*WriteBuffer)(unsafe.Pointer(pWrite)).FpFile, zGarbage, int64(g.FiSectorSize), (i * sqlite3_int64(g.FiSectorSize)))
 57748  					}
 57749  					crash_free(tls, zGarbage)
 57750  				} else {
 57751  					rc = SQLITE_NOMEM
 57752  				}
 57753  
 57754  				ppPtr = (pWrite + 20 /* &.pNext */)
 57755  				break
 57756  
 57757  			}
 57758  
 57759  		default:
 57760  
 57761  		}
 57762  
 57763  		if pWrite == pFinal {
 57764  			break
 57765  		}
 57766  	}
 57767  
 57768  	if (rc == SQLITE_OK) && (isCrash != 0) {
 57769  		libc.Xexit(tls, -1)
 57770  	}
 57771  
 57772  	for pWrite = g.FpWriteList; (pWrite != 0) && ((*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext != 0); pWrite = (*WriteBuffer)(unsafe.Pointer(pWrite)).FpNext {
 57773  	}
 57774  	g.FpWriteListEnd = pWrite
 57775  
 57776  	return rc
 57777  }
 57778  
 57779  // Add an entry to the end of the write-list.
 57780  func writeListAppend(tls *libc.TLS, pFile uintptr, iOffset sqlite3_int64, zBuf uintptr, nBuf int32) int32 { /* test6.c:362:12: */
 57781  	var pNew uintptr
 57782  
 57783  	pNew = crash_malloc(tls, (int32(uint32(unsafe.Sizeof(WriteBuffer{})) + uint32(nBuf))))
 57784  	if pNew == uintptr(0) {
 57785  		libc.Xfprintf(tls, libc.Xstderr, ts+26645 /* "out of memory in..." */, 0)
 57786  	}
 57787  	libc.Xmemset(tls, pNew, 0, (uint32(unsafe.Sizeof(WriteBuffer{})) + uint32(nBuf)))
 57788  	(*WriteBuffer)(unsafe.Pointer(pNew)).FiOffset = iOffset
 57789  	(*WriteBuffer)(unsafe.Pointer(pNew)).FnBuf = nBuf
 57790  	(*WriteBuffer)(unsafe.Pointer(pNew)).FpFile = pFile
 57791  	if zBuf != 0 {
 57792  		(*WriteBuffer)(unsafe.Pointer(pNew)).FzBuf = (pNew + 1*24)
 57793  		libc.Xmemcpy(tls, (*WriteBuffer)(unsafe.Pointer(pNew)).FzBuf, zBuf, uint32(nBuf))
 57794  	}
 57795  
 57796  	if g.FpWriteList != 0 {
 57797  
 57798  		(*WriteBuffer)(unsafe.Pointer(g.FpWriteListEnd)).FpNext = pNew
 57799  	} else {
 57800  		g.FpWriteList = pNew
 57801  	}
 57802  	g.FpWriteListEnd = pNew
 57803  
 57804  	return SQLITE_OK
 57805  }
 57806  
 57807  // Close a crash-file.
 57808  func cfClose(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:399:12: */
 57809  	var pCrash uintptr = pFile
 57810  	writeListSync(tls, pCrash, 0)
 57811  	sqlite3.Xsqlite3OsClose(tls, (*CrashFile)(unsafe.Pointer(pCrash)).FpRealFile)
 57812  	return SQLITE_OK
 57813  }
 57814  
 57815  // Read data from a crash-file.
 57816  func cfRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test6.c:409:12: */
 57817  	var pCrash uintptr = pFile
 57818  	var nCopy int32 = func() int32 {
 57819  		if (i64(iAmt)) < ((*CrashFile)(unsafe.Pointer(pCrash)).FiSize - iOfst) {
 57820  			return int32(i64(iAmt))
 57821  		}
 57822  		return (int32((*CrashFile)(unsafe.Pointer(pCrash)).FiSize - iOfst))
 57823  	}()
 57824  
 57825  	if nCopy > 0 {
 57826  		libc.Xmemcpy(tls, zBuf, ((*CrashFile)(unsafe.Pointer(pCrash)).FzData + uintptr(iOfst)), uint32(nCopy))
 57827  	}
 57828  
 57829  	// Check the file-size to see if this is a short-read
 57830  	if nCopy < iAmt {
 57831  		return (SQLITE_IOERR | (int32(2) << 8))
 57832  	}
 57833  
 57834  	return SQLITE_OK
 57835  }
 57836  
 57837  // Write data to a crash-file.
 57838  func cfWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test6.c:433:12: */
 57839  	var pCrash uintptr = pFile
 57840  	if (sqlite_int64(iAmt) + iOfst) > (*CrashFile)(unsafe.Pointer(pCrash)).FiSize {
 57841  		(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64((int32(sqlite_int64(iAmt) + iOfst)))
 57842  	}
 57843  	for (*CrashFile)(unsafe.Pointer(pCrash)).FiSize > i64((*CrashFile)(unsafe.Pointer(pCrash)).FnData) {
 57844  		var zNew uintptr
 57845  		var nNew int32 = (((*CrashFile)(unsafe.Pointer(pCrash)).FnData * 2) + 4096)
 57846  		zNew = crash_realloc(tls, (*CrashFile)(unsafe.Pointer(pCrash)).FzData, nNew)
 57847  		if !(zNew != 0) {
 57848  			return SQLITE_NOMEM
 57849  		}
 57850  		libc.Xmemset(tls, (zNew + uintptr((*CrashFile)(unsafe.Pointer(pCrash)).FnData)), 0, (uint32(nNew - (*CrashFile)(unsafe.Pointer(pCrash)).FnData)))
 57851  		(*CrashFile)(unsafe.Pointer(pCrash)).FnData = nNew
 57852  		(*CrashFile)(unsafe.Pointer(pCrash)).FzData = zNew
 57853  	}
 57854  	libc.Xmemcpy(tls, ((*CrashFile)(unsafe.Pointer(pCrash)).FzData + uintptr(iOfst)), zBuf, uint32(iAmt))
 57855  	return writeListAppend(tls, pFile, iOfst, zBuf, iAmt)
 57856  }
 57857  
 57858  // Truncate a crash-file.
 57859  func cfTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test6.c:461:12: */
 57860  	var pCrash uintptr = pFile
 57861  
 57862  	if (*CrashFile)(unsafe.Pointer(pCrash)).FiSize > size {
 57863  		(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64(int32(size))
 57864  	}
 57865  	return writeListAppend(tls, pFile, size, uintptr(0), 0)
 57866  }
 57867  
 57868  // Sync a crash-file.
 57869  func cfSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test6.c:473:12: */
 57870  	var pCrash uintptr = pFile
 57871  	var isCrash int32 = 0
 57872  
 57873  	var zName uintptr = (*CrashFile)(unsafe.Pointer(pCrash)).FzName
 57874  	var zCrashFile uintptr = uintptr(unsafe.Pointer(&g)) + 20 /* &.zCrashFile */
 57875  	var nName int32 = int32(libc.Xstrlen(tls, zName))
 57876  	var nCrashFile int32 = int32(libc.Xstrlen(tls, zCrashFile))
 57877  
 57878  	if (nCrashFile > 0) && (int32(*(*int8)(unsafe.Pointer(zCrashFile + uintptr((nCrashFile - 1))))) == '*') {
 57879  		nCrashFile--
 57880  		if nName > nCrashFile {
 57881  			nName = nCrashFile
 57882  		}
 57883  	}
 57884  
 57885  	if (nName == nCrashFile) && (0 == libc.Xmemcmp(tls, zName, zCrashFile, uint32(nName))) {
 57886  		if (libc.PreDecInt32(&g.FiCrash, 1)) == 0 {
 57887  			isCrash = 1
 57888  		}
 57889  	}
 57890  
 57891  	return writeListSync(tls, pCrash, isCrash)
 57892  }
 57893  
 57894  // Return the current file-size of the crash-file.
 57895  func cfFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test6.c:505:12: */
 57896  	var pCrash uintptr = pFile
 57897  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = (*CrashFile)(unsafe.Pointer(pCrash)).FiSize
 57898  	return SQLITE_OK
 57899  }
 57900  
 57901  // Calls related to file-locks are passed on to the real file handle.
 57902  func cfLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test6.c:514:12: */
 57903  	return sqlite3.Xsqlite3OsLock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, eLock)
 57904  }
 57905  
 57906  func cfUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test6.c:517:12: */
 57907  	return sqlite3.Xsqlite3OsUnlock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, eLock)
 57908  }
 57909  
 57910  func cfCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test6.c:520:12: */
 57911  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, pResOut)
 57912  }
 57913  
 57914  func cfFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test6.c:523:12: */
 57915  	if op == SQLITE_FCNTL_SIZE_HINT {
 57916  		var pCrash uintptr = pFile
 57917  		var nByte i64 = *(*i64)(unsafe.Pointer(pArg))
 57918  		if nByte > (*CrashFile)(unsafe.Pointer(pCrash)).FiSize {
 57919  			if SQLITE_OK == writeListAppend(tls, pFile, nByte, uintptr(0), 0) {
 57920  				(*CrashFile)(unsafe.Pointer(pCrash)).FiSize = i64(int32(nByte))
 57921  			}
 57922  		}
 57923  		return SQLITE_OK
 57924  	}
 57925  	return sqlite3.Xsqlite3OsFileControl(tls, (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile, op, pArg)
 57926  }
 57927  
 57928  // The xSectorSize() and xDeviceCharacteristics() functions return
 57929  // the global values configured by the [sqlite_crashparams] tcl
 57930  //  interface.
 57931  func cfSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:542:12: */
 57932  	return g.FiSectorSize
 57933  }
 57934  
 57935  func cfDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test6.c:545:12: */
 57936  	return g.FiDeviceCharacteristics
 57937  }
 57938  
 57939  // Pass-throughs for WAL support.
 57940  func cfShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test6.c:552:12: */
 57941  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 57942  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 56 /* &.xShmLock */))))(tls, pReal, ofst, n, flags)
 57943  }
 57944  
 57945  func cfShmBarrier(tls *libc.TLS, pFile uintptr) { /* test6.c:556:13: */
 57946  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 57947  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pReal)
 57948  }
 57949  
 57950  func cfShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) int32 { /* test6.c:560:12: */
 57951  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 57952  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pReal, delFlag)
 57953  }
 57954  
 57955  func cfShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, sz int32, w int32, pp uintptr) int32 { /* test6.c:564:12: */
 57956  	var pReal uintptr = (*CrashFile)(unsafe.Pointer(pFile)).FpRealFile
 57957  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 52 /* &.xShmMap */))))(tls, pReal, iRegion, sz, w, libc.AtomicLoadUintptr(&pp))
 57958  }
 57959  
 57960  var CrashFileVtab = sqlite3_io_methods{
 57961  	FiVersion:               2, // iVersion
 57962  	FxClose:                 0, // xClose
 57963  	FxRead:                  0, // xRead
 57964  	FxWrite:                 0, // xWrite
 57965  	FxTruncate:              0, // xTruncate
 57966  	FxSync:                  0, // xSync
 57967  	FxFileSize:              0, // xFileSize
 57968  	FxLock:                  0, // xLock
 57969  	FxUnlock:                0, // xUnlock
 57970  	FxCheckReservedLock:     0, // xCheckReservedLock
 57971  	FxFileControl:           0, // xFileControl
 57972  	FxSectorSize:            0, // xSectorSize
 57973  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 57974  	FxShmMap:                0, // xShmMap
 57975  	FxShmLock:               0, // xShmLock
 57976  	FxShmBarrier:            0, // xShmBarrier
 57977  	FxShmUnmap:              0, // xShmUnmap
 57978  } /* test6.c:575:33 */
 57979  
 57980  // Application data for the crash VFS
 57981  type crashAppData = struct{ FpOrig uintptr } /* test6.c:598:1 */
 57982  
 57983  // Open a crash-file file handle.
 57984  //
 57985  // The caller will have allocated pVfs->szOsFile bytes of space
 57986  // at pFile. This file uses this space for the CrashFile structure
 57987  // and allocates space for the "real" file structure using
 57988  // sqlite3_malloc(). The assumption here is (pVfs->szOsFile) is
 57989  // equal or greater than sizeof(CrashFile).
 57990  func cfOpen(tls *libc.TLS, pCfVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test6.c:611:12: */
 57991  	bp := tls.Alloc(8)
 57992  	defer tls.Free(8)
 57993  
 57994  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 57995  	var rc int32
 57996  	var pWrapper uintptr = pFile
 57997  	var pReal uintptr = (pWrapper + 1*32)
 57998  
 57999  	libc.Xmemset(tls, pWrapper, 0, uint32(unsafe.Sizeof(CrashFile{})))
 58000  	rc = sqlite3.Xsqlite3OsOpen(tls, pVfs, zName, pReal, flags, pOutFlags)
 58001  
 58002  	if rc == SQLITE_OK {
 58003  		// var iSize i64 at bp, 8
 58004  
 58005  		(*CrashFile)(unsafe.Pointer(pWrapper)).FpMethod = uintptr(unsafe.Pointer(&CrashFileVtab))
 58006  		(*CrashFile)(unsafe.Pointer(pWrapper)).FzName = zName
 58007  		(*CrashFile)(unsafe.Pointer(pWrapper)).FpRealFile = pReal
 58008  		rc = sqlite3.Xsqlite3OsFileSize(tls, pReal, bp /* &iSize */)
 58009  		(*CrashFile)(unsafe.Pointer(pWrapper)).FiSize = i64(int32(*(*i64)(unsafe.Pointer(bp /* iSize */))))
 58010  		(*CrashFile)(unsafe.Pointer(pWrapper)).Fflags = flags
 58011  	}
 58012  	if rc == SQLITE_OK {
 58013  		(*CrashFile)(unsafe.Pointer(pWrapper)).FnData = (int32(int64(4096) + (*CrashFile)(unsafe.Pointer(pWrapper)).FiSize))
 58014  		(*CrashFile)(unsafe.Pointer(pWrapper)).FzData = crash_malloc(tls, (*CrashFile)(unsafe.Pointer(pWrapper)).FnData)
 58015  		if (*CrashFile)(unsafe.Pointer(pWrapper)).FzData != 0 {
 58016  			// os_unix.c contains an assert() that fails if the caller attempts
 58017  			// to read data from the 512-byte locking region of a file opened
 58018  			// with the SQLITE_OPEN_MAIN_DB flag. This region of a database file
 58019  			// never contains valid data anyhow. So avoid doing such a read here.
 58020  			//
 58021  			// UPDATE: It also contains an assert() verifying that each call
 58022  			// to the xRead() method reads less than 128KB of data.
 58023  			var iOff i64
 58024  
 58025  			libc.Xmemset(tls, (*CrashFile)(unsafe.Pointer(pWrapper)).FzData, 0, uint32((*CrashFile)(unsafe.Pointer(pWrapper)).FnData))
 58026  			for iOff = int64(0); iOff < (*CrashFile)(unsafe.Pointer(pWrapper)).FiSize; iOff = iOff + (int64(512)) {
 58027  				var nRead int32 = (int32((*CrashFile)(unsafe.Pointer(pWrapper)).FiSize - iOff))
 58028  				if nRead > 512 {
 58029  					nRead = 512
 58030  				}
 58031  				rc = sqlite3.Xsqlite3OsRead(tls, pReal, ((*CrashFile)(unsafe.Pointer(pWrapper)).FzData + uintptr(iOff)), nRead, iOff)
 58032  			}
 58033  		} else {
 58034  			rc = SQLITE_NOMEM
 58035  		}
 58036  	}
 58037  	if (rc != SQLITE_OK) && ((*CrashFile)(unsafe.Pointer(pWrapper)).FpMethod != 0) {
 58038  		sqlite3.Xsqlite3OsClose(tls, pFile)
 58039  	}
 58040  	return rc
 58041  }
 58042  
 58043  func cfDelete(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test6.c:665:12: */
 58044  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58045  	return (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pVfs + 28 /* &.xDelete */))))(tls, pVfs, zPath, dirSync)
 58046  }
 58047  
 58048  func cfAccess(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test6.c:669:12: */
 58049  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58050  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 32 /* &.xAccess */))))(tls, pVfs, zPath, flags, pResOut)
 58051  }
 58052  
 58053  func cfFullPathname(tls *libc.TLS, pCfVfs uintptr, zPath uintptr, nPathOut int32, zPathOut uintptr) int32 { /* test6.c:678:12: */
 58054  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58055  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 36 /* &.xFullPathname */))))(tls, pVfs, zPath, nPathOut, zPathOut)
 58056  }
 58057  
 58058  func cfDlOpen(tls *libc.TLS, pCfVfs uintptr, zPath uintptr) uintptr { /* test6.c:687:13: */
 58059  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58060  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 40 /* &.xDlOpen */))))(tls, pVfs, zPath)
 58061  }
 58062  
 58063  func cfDlError(tls *libc.TLS, pCfVfs uintptr, nByte int32, zErrMsg uintptr) { /* test6.c:691:13: */
 58064  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58065  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pVfs + 44 /* &.xDlError */))))(tls, pVfs, nByte, zErrMsg)
 58066  }
 58067  
 58068  func cfDlSym(tls *libc.TLS, pCfVfs uintptr, pH uintptr, zSym uintptr) uintptr { /* test6.c:695:13: */
 58069  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58070  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 48 /* &.xDlSym */))))(tls, pVfs, pH, zSym)
 58071  }
 58072  
 58073  func cfDlClose(tls *libc.TLS, pCfVfs uintptr, pHandle uintptr) { /* test6.c:699:13: */
 58074  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58075  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pVfs + 52 /* &.xDlClose */))))(tls, pVfs, pHandle)
 58076  }
 58077  
 58078  func cfRandomness(tls *libc.TLS, pCfVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test6.c:703:12: */
 58079  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58080  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 56 /* &.xRandomness */))))(tls, pVfs, nByte, zBufOut)
 58081  }
 58082  
 58083  func cfSleep(tls *libc.TLS, pCfVfs uintptr, nMicro int32) int32 { /* test6.c:707:12: */
 58084  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58085  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pVfs + 60 /* &.xSleep */))))(tls, pVfs, nMicro)
 58086  }
 58087  
 58088  func cfCurrentTime(tls *libc.TLS, pCfVfs uintptr, pTimeOut uintptr) int32 { /* test6.c:711:12: */
 58089  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58090  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pVfs + 64 /* &.xCurrentTime */))))(tls, pVfs, pTimeOut)
 58091  }
 58092  
 58093  func cfGetLastError(tls *libc.TLS, pCfVfs uintptr, n int32, z uintptr) int32 { /* test6.c:715:12: */
 58094  	var pVfs uintptr = (*sqlite3_vfs)(unsafe.Pointer(pCfVfs)).FpAppData
 58095  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 68 /* &.xGetLastError */))))(tls, pVfs, n, z)
 58096  }
 58097  
 58098  func processDevSymArgs(tls *libc.TLS, interp uintptr, objc int32, objv uintptr, piDeviceChar uintptr, piSectorSize uintptr) int32 { /* test6.c:720:12: */
 58099  	bp := tls.Alloc(196)
 58100  	defer tls.Free(196)
 58101  
 58102  	*(*[14]DeviceFlag)(unsafe.Pointer(bp + 80 /* aFlag */)) = [14]DeviceFlag{
 58103  		{FzName: ts + 26683 /* "atomic" */, FiValue: SQLITE_IOCAP_ATOMIC},
 58104  		{FzName: ts + 26690 /* "atomic512" */, FiValue: SQLITE_IOCAP_ATOMIC512},
 58105  		{FzName: ts + 26700 /* "atomic1k" */, FiValue: SQLITE_IOCAP_ATOMIC1K},
 58106  		{FzName: ts + 26709 /* "atomic2k" */, FiValue: SQLITE_IOCAP_ATOMIC2K},
 58107  		{FzName: ts + 26718 /* "atomic4k" */, FiValue: SQLITE_IOCAP_ATOMIC4K},
 58108  		{FzName: ts + 26727 /* "atomic8k" */, FiValue: SQLITE_IOCAP_ATOMIC8K},
 58109  		{FzName: ts + 26736 /* "atomic16k" */, FiValue: SQLITE_IOCAP_ATOMIC16K},
 58110  		{FzName: ts + 26746 /* "atomic32k" */, FiValue: SQLITE_IOCAP_ATOMIC32K},
 58111  		{FzName: ts + 26756 /* "atomic64k" */, FiValue: SQLITE_IOCAP_ATOMIC64K},
 58112  		{FzName: ts + 26766 /* "sequential" */, FiValue: SQLITE_IOCAP_SEQUENTIAL},
 58113  		{FzName: ts + 26777 /* "safe_append" */, FiValue: SQLITE_IOCAP_SAFE_APPEND},
 58114  		{FzName: ts + 26789 /* "powersafe_overwr..." */, FiValue: SQLITE_IOCAP_POWERSAFE_OVERWRITE},
 58115  		{FzName: ts + 26809 /* "batch-atomic" */, FiValue: SQLITE_IOCAP_BATCH_ATOMIC},
 58116  		{},
 58117  	}
 58118  	var i int32
 58119  	var iDc int32 = 0
 58120  	*(*int32)(unsafe.Pointer(bp + 68 /* iSectorSize */)) = 0
 58121  	var setSectorsize int32 = 0
 58122  	var setDeviceChar int32 = 0
 58123  
 58124  	for i = 0; i < objc; i = i + (2) {
 58125  		// var nOpt int32 at bp+64, 4
 58126  
 58127  		var zOpt uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp+64 /* &nOpt */)
 58128  
 58129  		if (((*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) > 11) || (*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) < 2)) || (libc.Xstrncmp(tls, ts+26822 /* "-sectorsize" */, zOpt, uint32(*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)))) != 0)) &&
 58130  			(((*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) > 16) || (*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)) < 2)) || (libc.Xstrncmp(tls, ts+26834 /* "-characteristics" */, zOpt, uint32(*(*int32)(unsafe.Pointer(bp + 64 /* nOpt */)))) != 0)) {
 58131  			tcl.XTcl_AppendResult(tls, interp,
 58132  				libc.VaList(bp, ts+26851 /* "Bad option: \"" */, zOpt,
 58133  					ts+26865 /* "\" - must be \"-ch..." */, 0))
 58134  			return TCL_ERROR
 58135  		}
 58136  		if i == (objc - 1) {
 58137  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26913 /* "Option requires ..." */, zOpt, ts+12415 /* "\"" */, 0))
 58138  			return TCL_ERROR
 58139  		}
 58140  
 58141  		if int32(*(*int8)(unsafe.Pointer(zOpt + 1))) == 's' {
 58142  			if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+68 /* &iSectorSize */) != 0 {
 58143  				return TCL_ERROR
 58144  			}
 58145  			setSectorsize = 1
 58146  		} else {
 58147  			var j int32
 58148  			// var apObj uintptr at bp+76, 4
 58149  
 58150  			// var nObj int32 at bp+72, 4
 58151  
 58152  			if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+72 /* &nObj */, bp+76 /* &apObj */) != 0 {
 58153  				return TCL_ERROR
 58154  			}
 58155  			for j = 0; j < *(*int32)(unsafe.Pointer(bp + 72 /* nObj */)); j++ {
 58156  				var rc int32
 58157  				// var iChoice int32 at bp+192, 4
 58158  
 58159  				var pFlag uintptr = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 76 /* apObj */)) + uintptr(j)*4)))
 58160  				(*Tcl_Obj)(unsafe.Pointer(pFlag)).FrefCount++
 58161  				tcl.XTcl_UtfToLower(tls, tcl.XTcl_GetString(tls, pFlag))
 58162  
 58163  				rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 58164  					interp, pFlag, bp+80 /* &aFlag[0] */, int32(unsafe.Sizeof(DeviceFlag{})), ts+26944 /* "no such flag" */, 0, bp+192 /* &iChoice */)
 58165  				for ok := true; ok; ok = 0 != 0 {
 58166  					var _objPtr uintptr = pFlag
 58167  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 58168  						tcl.XTclFreeObj(tls, _objPtr)
 58169  					}
 58170  				}
 58171  				if rc != 0 {
 58172  					return TCL_ERROR
 58173  				}
 58174  
 58175  				iDc = iDc | ((*DeviceFlag)(unsafe.Pointer(bp + 80 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 192 /* iChoice */)))*8)).FiValue)
 58176  			}
 58177  			setDeviceChar = 1
 58178  		}
 58179  	}
 58180  
 58181  	if setDeviceChar != 0 {
 58182  		*(*int32)(unsafe.Pointer(piDeviceChar)) = iDc
 58183  	}
 58184  	if setSectorsize != 0 {
 58185  		*(*int32)(unsafe.Pointer(piSectorSize)) = *(*int32)(unsafe.Pointer(bp + 68 /* iSectorSize */))
 58186  	}
 58187  
 58188  	return TCL_OK
 58189  }
 58190  
 58191  type DeviceFlag = struct {
 58192  	FzName  uintptr
 58193  	FiValue int32
 58194  } /* test6.c:727:3 */
 58195  
 58196  // tclcmd:   sqlite3_crash_now
 58197  //
 58198  // Simulate a crash immediately. This function does not return
 58199  // (writeListSync() calls exit(-1)).
 58200  func crashNowCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:820:26: */
 58201  	if objc != 1 {
 58202  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58203  		return TCL_ERROR
 58204  	}
 58205  	writeListSync(tls, uintptr(0), 1)
 58206  
 58207  	return TCL_OK
 58208  }
 58209  
 58210  // tclcmd:   sqlite_crash_enable ENABLE ?DEFAULT?
 58211  //
 58212  // Parameter ENABLE must be a boolean value. If true, then the "crash"
 58213  // vfs is added to the system. If false, it is removed.
 58214  func crashEnableCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:841:26: */
 58215  	bp := tls.Alloc(8)
 58216  	defer tls.Free(8)
 58217  
 58218  	// var isEnable int32 at bp, 4
 58219  
 58220  	*(*int32)(unsafe.Pointer(bp + 4 /* isDefault */)) = 0
 58221  
 58222  	if (objc != 2) && (objc != 3) {
 58223  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+26957 /* "ENABLE ?DEFAULT?" */)
 58224  		return TCL_ERROR
 58225  	}
 58226  
 58227  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &isEnable */) != 0 {
 58228  		return TCL_ERROR
 58229  	}
 58230  	if (objc == 3) && (tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &isDefault */) != 0) {
 58231  		return TCL_ERROR
 58232  	}
 58233  
 58234  	if ((*(*int32)(unsafe.Pointer(bp /* isEnable */)) != 0) && (crashVfs.FpAppData != 0)) || (!(*(*int32)(unsafe.Pointer(bp /* isEnable */)) != 0) && !(int32(crashVfs.FpAppData) != 0)) {
 58235  		return TCL_OK
 58236  	}
 58237  
 58238  	if crashVfs.FpAppData == uintptr(0) {
 58239  		var pOriginalVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 58240  		crashVfs.FmxPathname = (*sqlite3_vfs)(unsafe.Pointer(pOriginalVfs)).FmxPathname
 58241  		crashVfs.FpAppData = pOriginalVfs
 58242  		crashVfs.FszOsFile = (int32(uint32(unsafe.Sizeof(CrashFile{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(pOriginalVfs)).FszOsFile)))
 58243  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&crashVfs)), *(*int32)(unsafe.Pointer(bp + 4 /* isDefault */)))
 58244  	} else {
 58245  		crashVfs.FpAppData = uintptr(0)
 58246  		sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&crashVfs)))
 58247  	}
 58248  
 58249  	return TCL_OK
 58250  }
 58251  
 58252  var crashVfs = sqlite3_vfs{
 58253  	FiVersion: 2,          // pNext
 58254  	FzName:    ts + 26974, /* "crash" */ // pAppData
 58255  
 58256  	FxOpen:         0, // xOpen
 58257  	FxDelete:       0, // xDelete
 58258  	FxAccess:       0, // xAccess
 58259  	FxFullPathname: 0, // xFullPathname
 58260  	FxDlOpen:       0, // xDlOpen
 58261  	FxDlError:      0, // xDlError
 58262  	FxDlSym:        0, // xDlSym
 58263  	FxDlClose:      0, // xDlClose
 58264  	FxRandomness:   0, // xRandomness
 58265  	FxSleep:        0, // xSleep
 58266  	FxCurrentTime:  0, // xCurrentTime
 58267  	FxGetLastError: 0, // xCurrentTimeInt64
 58268  } /* test6.c:849:22 */
 58269  
 58270  // tclcmd:   sqlite_crashparams ?OPTIONS? DELAY CRASHFILE
 58271  //
 58272  // This procedure implements a TCL command that enables crash testing
 58273  // in testfixture.  Once enabled, crash testing cannot be disabled.
 58274  //
 58275  // Available options are "-characteristics" and "-sectorsize". Both require
 58276  // an argument. For -sectorsize, this is the simulated sector size in
 58277  // bytes. For -characteristics, the argument must be a list of io-capability
 58278  // flags to simulate. Valid flags are "atomic", "atomic512", "atomic1K",
 58279  // "atomic2K", "atomic4K", "atomic8K", "atomic16K", "atomic32K",
 58280  // "atomic64K", "sequential" and "safe_append".
 58281  //
 58282  // Example:
 58283  //
 58284  //   sqlite_crashparams -sect 1024 -char {atomic sequential} ./test.db 1
 58285  //
 58286  func crashParamsObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:920:26: */
 58287  	bp := tls.Alloc(48)
 58288  	defer tls.Free(48)
 58289  
 58290  	// var iDelay int32 at bp+36, 4
 58291  
 58292  	var zCrashFile uintptr
 58293  	// var nCrashFile int32 at bp+32, 4
 58294  
 58295  	// var iDc int32 at bp+40, 4
 58296  
 58297  	// var iSectorSize int32 at bp+44, 4
 58298  
 58299  	*(*int32)(unsafe.Pointer(bp + 40 /* iDc */)) = -1
 58300  	*(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */)) = -1
 58301  
 58302  	if !(objc < 3) {
 58303  		goto __1
 58304  	}
 58305  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+26980 /* "?OPTIONS? DELAY ..." */)
 58306  	goto error
 58307  __1:
 58308  	;
 58309  
 58310  	zCrashFile = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-1))*4)), bp+32 /* &nCrashFile */)
 58311  	if !(uint32(*(*int32)(unsafe.Pointer(bp + 32 /* nCrashFile */))) >= uint32(unsafe.Sizeof([500]int8{}))) {
 58312  		goto __2
 58313  	}
 58314  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+27006 /* "Filename is too ..." */, zCrashFile, ts+12415 /* "\"" */, 0))
 58315  	goto error
 58316  __2:
 58317  	;
 58318  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((objc-2))*4)), bp+36 /* &iDelay */) != 0) {
 58319  		goto __3
 58320  	}
 58321  	goto error
 58322  __3:
 58323  	;
 58324  
 58325  	if !(processDevSymArgs(tls, interp, (objc-3), (objv+1*4), bp+40 /* &iDc */, bp+44 /* &iSectorSize */) != 0) {
 58326  		goto __4
 58327  	}
 58328  	return TCL_ERROR
 58329  __4:
 58330  	;
 58331  
 58332  	if !(*(*int32)(unsafe.Pointer(bp + 40 /* iDc */)) >= 0) {
 58333  		goto __5
 58334  	}
 58335  	g.FiDeviceCharacteristics = *(*int32)(unsafe.Pointer(bp + 40 /* iDc */))
 58336  __5:
 58337  	;
 58338  	if !(*(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */)) >= 0) {
 58339  		goto __6
 58340  	}
 58341  	g.FiSectorSize = *(*int32)(unsafe.Pointer(bp + 44 /* iSectorSize */))
 58342  __6:
 58343  	;
 58344  
 58345  	g.FiCrash = *(*int32)(unsafe.Pointer(bp + 36 /* iDelay */))
 58346  	libc.Xmemcpy(tls, uintptr(unsafe.Pointer(&g))+20 /* &.zCrashFile */, zCrashFile, (uint32(*(*int32)(unsafe.Pointer(bp + 32 /* nCrashFile */)) + 1)))
 58347  	sqlite3CrashTestEnable = 1
 58348  	return TCL_OK
 58349  
 58350  error:
 58351  	return TCL_ERROR
 58352  }
 58353  
 58354  func devSymObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:967:26: */
 58355  	bp := tls.Alloc(8)
 58356  	defer tls.Free(8)
 58357  
 58358  	*(*int32)(unsafe.Pointer(bp /* iDc */)) = -1
 58359  	*(*int32)(unsafe.Pointer(bp + 4 /* iSectorSize */)) = -1
 58360  
 58361  	if processDevSymArgs(tls, interp, (objc-1), (objv+1*4), bp /* &iDc */, bp+4 /* &iSectorSize */) != 0 {
 58362  		return TCL_ERROR
 58363  	}
 58364  	devsym_register(tls, *(*int32)(unsafe.Pointer(bp /* iDc */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSectorSize */)))
 58365  
 58366  	return TCL_OK
 58367  }
 58368  
 58369  // tclcmd: sqlite3_crash_on_write N
 58370  func writeCrashObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:989:26: */
 58371  	bp := tls.Alloc(4)
 58372  	defer tls.Free(4)
 58373  
 58374  	*(*int32)(unsafe.Pointer(bp /* nWrite */)) = 0
 58375  
 58376  	if objc != 2 {
 58377  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+27030 /* "NWRITE" */)
 58378  		return TCL_ERROR
 58379  	}
 58380  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &nWrite */) != 0 {
 58381  		return TCL_ERROR
 58382  	}
 58383  
 58384  	devsym_crash_on_write(tls, *(*int32)(unsafe.Pointer(bp /* nWrite */)))
 58385  	return TCL_OK
 58386  }
 58387  
 58388  // tclcmd: unregister_devsim
 58389  func dsUnregisterObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1013:26: */
 58390  
 58391  	if objc != 1 {
 58392  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58393  		return TCL_ERROR
 58394  	}
 58395  
 58396  	devsym_unregister(tls)
 58397  	return TCL_OK
 58398  }
 58399  
 58400  // tclcmd: register_jt_vfs ?-default? PARENT-VFS
 58401  func jtObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1033:26: */
 58402  	bp := tls.Alloc(48)
 58403  	defer tls.Free(48)
 58404  
 58405  	var zParent uintptr = uintptr(0)
 58406  
 58407  	if (objc != 2) && (objc != 3) {
 58408  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+27037 /* "?-default? PAREN..." */)
 58409  		return TCL_ERROR
 58410  	}
 58411  	zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 58412  	if objc == 3 {
 58413  		if libc.Xstrcmp(tls, zParent, ts+27059 /* "-default" */) != 0 {
 58414  			tcl.XTcl_AppendResult(tls, interp,
 58415  				libc.VaList(bp, ts+12321 /* "bad option \"" */, zParent, ts+27068 /* "\": must be -defa..." */, 0))
 58416  			return TCL_ERROR
 58417  		}
 58418  		zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 58419  	}
 58420  
 58421  	if !(int32(*(*int8)(unsafe.Pointer(zParent))) != 0) {
 58422  		zParent = uintptr(0)
 58423  	}
 58424  	if jt_register(tls, zParent, (libc.Bool32(objc == 3))) != 0 {
 58425  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+27088 /* "Error in jt_regi..." */, 0))
 58426  		return TCL_ERROR
 58427  	}
 58428  
 58429  	return TCL_OK
 58430  }
 58431  
 58432  // tclcmd: unregister_jt_vfs
 58433  func jtUnregisterObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test6.c:1071:26: */
 58434  
 58435  	if objc != 1 {
 58436  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 58437  		return TCL_ERROR
 58438  	}
 58439  
 58440  	jt_unregister(tls)
 58441  	return TCL_OK
 58442  }
 58443  
 58444  // This procedure registers the TCL procedures defined in this file.
 58445  func Sqlitetest6_Init(tls *libc.TLS, interp uintptr) int32 { /* test6.c:1093:5: */
 58446  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27109 /* "sqlite3_crash_en..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58447  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58448  	}{crashEnableCmd})), uintptr(0), uintptr(0))
 58449  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27130 /* "sqlite3_crashpar..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58450  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58451  	}{crashParamsObjCmd})), uintptr(0), uintptr(0))
 58452  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27150 /* "sqlite3_crash_no..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58453  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58454  	}{crashNowCmd})), uintptr(0), uintptr(0))
 58455  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27168 /* "sqlite3_simulate..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58456  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58457  	}{devSymObjCmd})), uintptr(0), uintptr(0))
 58458  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27192 /* "sqlite3_crash_on..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58459  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58460  	}{writeCrashObjCmd})), uintptr(0), uintptr(0))
 58461  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27215 /* "unregister_devsi..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58462  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58463  	}{dsUnregisterObjCmd})), uintptr(0), uintptr(0))
 58464  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27233 /* "register_jt_vfs" */, *(*uintptr)(unsafe.Pointer(&struct {
 58465  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58466  	}{jtObjCmd})), uintptr(0), uintptr(0))
 58467  	tcl.XTcl_CreateObjCommand(tls, interp, ts+27249 /* "unregister_jt_vf..." */, *(*uintptr)(unsafe.Pointer(&struct {
 58468  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 58469  	}{jtUnregisterObjCmd})), uintptr(0), uintptr(0))
 58470  	return TCL_OK
 58471  }
 58472  
 58473  // Each thread is controlled by an instance of the following
 58474  // structure.
 58475  type Thread1 = struct {
 58476  	FzFilename  uintptr
 58477  	FxOp        uintptr
 58478  	FzArg       uintptr
 58479  	Fopnum      int32
 58480  	Fbusy       int32
 58481  	Fcompleted  int32
 58482  	Fdb         uintptr
 58483  	FpStmt      uintptr
 58484  	FzErr       uintptr
 58485  	FzStaticErr uintptr
 58486  	Frc         int32
 58487  	Fargc       int32
 58488  	Fargv       [100]uintptr
 58489  	Fcolv       [100]uintptr
 58490  	FnServer    int32
 58491  } /* test7.c:53:23 */
 58492  
 58493  // There can be as many as 26 threads running at once.  Each is named
 58494  // by a capital letter: A, B, C, ..., Y, Z.
 58495  var threadset1 [26]Thread1 /* test7.c:90:15: */
 58496  
 58497  // The main loop for a thread.  Threads use busy waiting.
 58498  func client_main(tls *libc.TLS, pArg uintptr) uintptr { /* test7.c:95:13: */
 58499  	var p uintptr = pArg
 58500  	if (*Thread1)(unsafe.Pointer(p)).Fdb != 0 {
 58501  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 58502  	}
 58503  	sqlite3_client_open(tls, (*Thread1)(unsafe.Pointer(p)).FzFilename, (p + 24 /* &.db */))
 58504  	if SQLITE_OK != sqlite3.Xsqlite3_errcode(tls, (*Thread1)(unsafe.Pointer(p)).Fdb) {
 58505  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.Xstrdup(tls, sqlite3.Xsqlite3_errmsg(tls, (*Thread1)(unsafe.Pointer(p)).Fdb))
 58506  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 58507  		(*Thread1)(unsafe.Pointer(p)).Fdb = uintptr(0)
 58508  	}
 58509  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 58510  	(*Thread1)(unsafe.Pointer(p)).Fcompleted = 1
 58511  	for (*Thread1)(unsafe.Pointer(p)).Fopnum <= (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 58512  		libc2.Xsched_yield(tls)
 58513  	}
 58514  	for (*Thread1)(unsafe.Pointer(p)).FxOp != 0 {
 58515  		if ((*Thread1)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread1)(unsafe.Pointer(p)).FzErr != (*Thread1)(unsafe.Pointer(p)).FzStaticErr) {
 58516  			sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzErr)
 58517  			(*Thread1)(unsafe.Pointer(p)).FzErr = uintptr(0)
 58518  		}
 58519  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 4 /* &.xOp */))))(tls, p)
 58520  		(*Thread1)(unsafe.Pointer(p)).Fcompleted++
 58521  		for (*Thread1)(unsafe.Pointer(p)).Fopnum <= (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 58522  			libc2.Xsched_yield(tls)
 58523  		}
 58524  	}
 58525  	if (*Thread1)(unsafe.Pointer(p)).FpStmt != 0 {
 58526  		sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58527  		(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 58528  	}
 58529  	if (*Thread1)(unsafe.Pointer(p)).Fdb != 0 {
 58530  		sqlite3_client_close(tls, (*Thread1)(unsafe.Pointer(p)).Fdb)
 58531  		(*Thread1)(unsafe.Pointer(p)).Fdb = uintptr(0)
 58532  	}
 58533  	if ((*Thread1)(unsafe.Pointer(p)).FzErr != 0) && ((*Thread1)(unsafe.Pointer(p)).FzErr != (*Thread1)(unsafe.Pointer(p)).FzStaticErr) {
 58534  		sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzErr)
 58535  		(*Thread1)(unsafe.Pointer(p)).FzErr = uintptr(0)
 58536  	}
 58537  	(*Thread1)(unsafe.Pointer(p)).Fcompleted++
 58538  	sqlite3.Xsqlite3_thread_cleanup(tls)
 58539  	return uintptr(0)
 58540  }
 58541  
 58542  // Get a thread ID which is an upper case letter.  Return the index.
 58543  // If the argument is not a valid thread ID put an error message in
 58544  // the interpreter and return -1.
 58545  func parse_client_id(tls *libc.TLS, interp uintptr, zArg uintptr) int32 { /* test7.c:142:12: */
 58546  	bp := tls.Alloc(16)
 58547  	defer tls.Free(16)
 58548  
 58549  	if (((zArg == uintptr(0)) || (int32(*(*int8)(unsafe.Pointer(zArg))) == 0)) || (int32(*(*int8)(unsafe.Pointer(zArg + 1))) != 0)) || !((int32(*(*uint16)(unsafe.Pointer((*(*uintptr)(unsafe.Pointer(libc.X__ctype_b_loc(tls)))) + uintptr(int32(uint8(*(*int8)(unsafe.Pointer(zArg)))))*2))) & int32(_ISupper)) != 0) {
 58550  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+26021 /* "thread ID must b..." */, 0))
 58551  		return -1
 58552  	}
 58553  	return (int32(*(*int8)(unsafe.Pointer(zArg))) - 'A')
 58554  }
 58555  
 58556  // Usage:    client_create NAME  FILENAME
 58557  //
 58558  // NAME should be an upper case letter.  Start the thread running with
 58559  // an open connection to the given database.
 58560  func tcl_client_create(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:156:26: */
 58561  	bp := tls.Alloc(92)
 58562  	defer tls.Free(92)
 58563  
 58564  	var i int32
 58565  	// var x pthread_t at bp+88, 4
 58566  
 58567  	var rc int32
 58568  
 58569  	if argc != 3 {
 58570  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58571  			ts+26060 /* " ID FILENAME" */, 0))
 58572  		return TCL_ERROR
 58573  	}
 58574  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58575  	if i < 0 {
 58576  		return TCL_ERROR
 58577  	}
 58578  	if threadset1[i].Fbusy != 0 {
 58579  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26073 /* "thread " */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+26081 /* " is already runn..." */, 0))
 58580  		return TCL_ERROR
 58581  	}
 58582  	threadset1[i].Fbusy = 1
 58583  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzFilename)
 58584  	threadset1[i].FzFilename = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 58585  	threadset1[i].Fopnum = 1
 58586  	threadset1[i].Fcompleted = 0
 58587  	rc = libc2.Xpthread_create(tls, bp+88 /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 58588  		f func(*libc.TLS, uintptr) uintptr
 58589  	}{client_main})), (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58590  	if rc != 0 {
 58591  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+26101 /* "failed to create..." */, 0))
 58592  		sqlite3.Xsqlite3_free(tls, threadset1[i].FzFilename)
 58593  		threadset1[i].Fbusy = 0
 58594  		return TCL_ERROR
 58595  	}
 58596  	libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp + 88 /* x */)))
 58597  	if threadset1[i].FnServer == 0 {
 58598  		threadset1[i].FnServer = 1
 58599  		sqlite3_server_start2(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852 + 848 /* &.nServer */))
 58600  	}
 58601  	return TCL_OK
 58602  }
 58603  
 58604  // Wait for a thread to reach its idle state.
 58605  func client_wait(tls *libc.TLS, p uintptr) { /* test7.c:200:13: */
 58606  	for (*Thread1)(unsafe.Pointer(p)).Fopnum > (*Thread1)(unsafe.Pointer(p)).Fcompleted {
 58607  		libc2.Xsched_yield(tls)
 58608  	}
 58609  }
 58610  
 58611  // Usage:  client_wait ID
 58612  //
 58613  // Wait on thread ID to reach its idle state.
 58614  func tcl_client_wait(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:209:26: */
 58615  	bp := tls.Alloc(48)
 58616  	defer tls.Free(48)
 58617  
 58618  	var i int32
 58619  
 58620  	if argc != 2 {
 58621  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58622  			ts+26129 /* " ID" */, 0))
 58623  		return TCL_ERROR
 58624  	}
 58625  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58626  	if i < 0 {
 58627  		return TCL_ERROR
 58628  	}
 58629  	if !(threadset1[i].Fbusy != 0) {
 58630  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58631  		return TCL_ERROR
 58632  	}
 58633  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58634  	return TCL_OK
 58635  }
 58636  
 58637  // Stop a thread.
 58638  func stop_thread(tls *libc.TLS, p uintptr) { /* test7.c:235:13: */
 58639  	client_wait(tls, p)
 58640  	(*Thread1)(unsafe.Pointer(p)).FxOp = uintptr(0)
 58641  	(*Thread1)(unsafe.Pointer(p)).Fopnum++
 58642  	client_wait(tls, p)
 58643  	sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzArg)
 58644  	(*Thread1)(unsafe.Pointer(p)).FzArg = uintptr(0)
 58645  	sqlite3.Xsqlite3_free(tls, (*Thread1)(unsafe.Pointer(p)).FzFilename)
 58646  	(*Thread1)(unsafe.Pointer(p)).FzFilename = uintptr(0)
 58647  	(*Thread1)(unsafe.Pointer(p)).Fbusy = 0
 58648  }
 58649  
 58650  // Usage:  client_halt ID
 58651  //
 58652  // Cause a client thread to shut itself down.  Wait for the shutdown to be
 58653  // completed.  If ID is "*" then stop all client threads.
 58654  func tcl_client_halt(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:253:26: */
 58655  	bp := tls.Alloc(48)
 58656  	defer tls.Free(48)
 58657  
 58658  	var i int32
 58659  
 58660  	if argc != 2 {
 58661  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58662  			ts+26129 /* " ID" */, 0))
 58663  		return TCL_ERROR
 58664  	}
 58665  	if (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*4))))) == '*') && (int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(argv + 1*4)) + 1))) == 0) {
 58666  		for i = 0; i < N_THREAD; i++ {
 58667  			if threadset1[i].Fbusy != 0 {
 58668  				stop_thread(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58669  			}
 58670  		}
 58671  	} else {
 58672  		i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58673  		if i < 0 {
 58674  			return TCL_ERROR
 58675  		}
 58676  		if !(threadset1[i].Fbusy != 0) {
 58677  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58678  			return TCL_ERROR
 58679  		}
 58680  		stop_thread(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58681  	}
 58682  
 58683  	// If no client threads are still running, also stop the server
 58684  	for i = 0; (i < N_THREAD) && (threadset1[i].Fbusy == 0); i++ {
 58685  	}
 58686  	if i >= N_THREAD {
 58687  		sqlite3_server_stop(tls)
 58688  		for 1 != 0 {
 58689  			for i = 0; (i < N_THREAD) && (threadset1[i].FnServer == 0); i++ {
 58690  			}
 58691  			if i == N_THREAD {
 58692  				break
 58693  			}
 58694  			libc2.Xsched_yield(tls)
 58695  		}
 58696  	}
 58697  	return TCL_OK
 58698  }
 58699  
 58700  // Usage: client_argc  ID
 58701  //
 58702  // Wait on the most recent client_step to complete, then return the
 58703  // number of columns in the result set.
 58704  func tcl_client_argc(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:301:26: */
 58705  	bp := tls.Alloc(172)
 58706  	defer tls.Free(172)
 58707  
 58708  	var i int32
 58709  	// var zBuf [100]int8 at bp+72, 100
 58710  
 58711  	if argc != 2 {
 58712  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58713  			ts+26129 /* " ID" */, 0))
 58714  		return TCL_ERROR
 58715  	}
 58716  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58717  	if i < 0 {
 58718  		return TCL_ERROR
 58719  	}
 58720  	if !(threadset1[i].Fbusy != 0) {
 58721  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58722  		return TCL_ERROR
 58723  	}
 58724  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58725  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+72 /* &zBuf[0] */, ts+1238 /* "%d" */, libc.VaList(bp+48, threadset1[i].Fargc))
 58726  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+56, bp+72 /* &zBuf[0] */, 0))
 58727  	return TCL_OK
 58728  }
 58729  
 58730  // Usage: client_argv  ID   N
 58731  //
 58732  // Wait on the most recent client_step to complete, then return the
 58733  // value of the N-th columns in the result set.
 58734  func tcl_client_argv(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:333:26: */
 58735  	bp := tls.Alloc(84)
 58736  	defer tls.Free(84)
 58737  
 58738  	var i int32
 58739  	// var n int32 at bp+80, 4
 58740  
 58741  	if argc != 3 {
 58742  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58743  			ts+26148 /* " ID N" */, 0))
 58744  		return TCL_ERROR
 58745  	}
 58746  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58747  	if i < 0 {
 58748  		return TCL_ERROR
 58749  	}
 58750  	if !(threadset1[i].Fbusy != 0) {
 58751  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58752  		return TCL_ERROR
 58753  	}
 58754  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+80 /* &n */) != 0 {
 58755  		return TCL_ERROR
 58756  	}
 58757  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58758  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset1[i].Fargc) {
 58759  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 58760  		return TCL_ERROR
 58761  	}
 58762  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852 + 48 /* &.argv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*4)), 0))
 58763  	return TCL_OK
 58764  }
 58765  
 58766  // Usage: client_colname  ID   N
 58767  //
 58768  // Wait on the most recent client_step to complete, then return the
 58769  // name of the N-th columns in the result set.
 58770  func tcl_client_colname(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:369:26: */
 58771  	bp := tls.Alloc(84)
 58772  	defer tls.Free(84)
 58773  
 58774  	var i int32
 58775  	// var n int32 at bp+80, 4
 58776  
 58777  	if argc != 3 {
 58778  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58779  			ts+26148 /* " ID N" */, 0))
 58780  		return TCL_ERROR
 58781  	}
 58782  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58783  	if i < 0 {
 58784  		return TCL_ERROR
 58785  	}
 58786  	if !(threadset1[i].Fbusy != 0) {
 58787  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58788  		return TCL_ERROR
 58789  	}
 58790  	if tcl.XTcl_GetInt(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)), bp+80 /* &n */) != 0 {
 58791  		return TCL_ERROR
 58792  	}
 58793  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58794  	if (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 80 /* n */)) >= threadset1[i].Fargc) {
 58795  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26154 /* "column number ou..." */, 0))
 58796  		return TCL_ERROR
 58797  	}
 58798  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, *(*uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852 + 448 /* &.colv */) + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* n */)))*4)), 0))
 58799  	return TCL_OK
 58800  }
 58801  
 58802  // Usage: client_result  ID
 58803  //
 58804  // Wait on the most recent operation to complete, then return the
 58805  // result code from that operation.
 58806  func tcl_client_result(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:407:26: */
 58807  	bp := tls.Alloc(64)
 58808  	defer tls.Free(64)
 58809  
 58810  	var i int32
 58811  	var zName uintptr
 58812  
 58813  	if argc != 2 {
 58814  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58815  			ts+26129 /* " ID" */, 0))
 58816  		return TCL_ERROR
 58817  	}
 58818  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58819  	if i < 0 {
 58820  		return TCL_ERROR
 58821  	}
 58822  	if !(threadset1[i].Fbusy != 0) {
 58823  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58824  		return TCL_ERROR
 58825  	}
 58826  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58827  	zName = sqlite3.Xsqlite3ErrName(tls, threadset1[i].Frc)
 58828  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, zName, 0))
 58829  	return TCL_OK
 58830  }
 58831  
 58832  // Usage: client_error  ID
 58833  //
 58834  // Wait on the most recent operation to complete, then return the
 58835  // error string.
 58836  func tcl_client_error(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:439:26: */
 58837  	bp := tls.Alloc(64)
 58838  	defer tls.Free(64)
 58839  
 58840  	var i int32
 58841  
 58842  	if argc != 2 {
 58843  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58844  			ts+26129 /* " ID" */, 0))
 58845  		return TCL_ERROR
 58846  	}
 58847  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58848  	if i < 0 {
 58849  		return TCL_ERROR
 58850  	}
 58851  	if !(threadset1[i].Fbusy != 0) {
 58852  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58853  		return TCL_ERROR
 58854  	}
 58855  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58856  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, threadset1[i].FzErr, 0))
 58857  	return TCL_OK
 58858  }
 58859  
 58860  // This procedure runs in the thread to compile an SQL statement.
 58861  func do_compile1(tls *libc.TLS, p uintptr) { /* test7.c:466:13: */
 58862  	if (*Thread1)(unsafe.Pointer(p)).Fdb == uintptr(0) {
 58863  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26181 /* "no database is o..." */)
 58864  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 58865  		return
 58866  	}
 58867  	if (*Thread1)(unsafe.Pointer(p)).FpStmt != 0 {
 58868  		sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58869  		(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 58870  	}
 58871  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_prepare(tls, (*Thread1)(unsafe.Pointer(p)).Fdb, (*Thread1)(unsafe.Pointer(p)).FzArg, -1, (p + 28 /* &.pStmt */), uintptr(0))
 58872  }
 58873  
 58874  // Usage: client_compile ID SQL
 58875  //
 58876  // Compile a new virtual machine.
 58877  func tcl_client_compile(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:484:26: */
 58878  	bp := tls.Alloc(56)
 58879  	defer tls.Free(56)
 58880  
 58881  	var i int32
 58882  	if argc != 3 {
 58883  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58884  			ts+26201 /* " ID SQL" */, 0))
 58885  		return TCL_ERROR
 58886  	}
 58887  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58888  	if i < 0 {
 58889  		return TCL_ERROR
 58890  	}
 58891  	if !(threadset1[i].Fbusy != 0) {
 58892  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58893  		return TCL_ERROR
 58894  	}
 58895  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58896  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_compile1}))
 58897  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 58898  	threadset1[i].FzArg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+48, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 58899  	threadset1[i].Fopnum++
 58900  	return TCL_OK
 58901  }
 58902  
 58903  // This procedure runs in the thread to step the virtual machine.
 58904  func do_step1(tls *libc.TLS, p uintptr) { /* test7.c:513:13: */
 58905  	var i int32
 58906  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 58907  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 58908  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 58909  		return
 58910  	}
 58911  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_step(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58912  	if (*Thread1)(unsafe.Pointer(p)).Frc == SQLITE_ROW {
 58913  		(*Thread1)(unsafe.Pointer(p)).Fargc = sqlite3.Xsqlite3_column_count(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58914  		for i = 0; i < sqlite3.Xsqlite3_data_count(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt); i++ {
 58915  			*(*uintptr)(unsafe.Pointer((p + 48 /* &.argv */) + uintptr(i)*4)) = sqlite3.Xsqlite3_column_text(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt, i)
 58916  		}
 58917  		for i = 0; i < (*Thread1)(unsafe.Pointer(p)).Fargc; i++ {
 58918  			*(*uintptr)(unsafe.Pointer((p + 448 /* &.colv */) + uintptr(i)*4)) = sqlite3.Xsqlite3_column_name(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt, i)
 58919  		}
 58920  	}
 58921  }
 58922  
 58923  // Usage: client_step ID
 58924  //
 58925  // Advance the virtual machine by one step
 58926  func tcl_client_step(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:537:26: */
 58927  	bp := tls.Alloc(48)
 58928  	defer tls.Free(48)
 58929  
 58930  	var i int32
 58931  	if argc != 2 {
 58932  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58933  			ts+26238 /* " IDL" */, 0))
 58934  		return TCL_ERROR
 58935  	}
 58936  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58937  	if i < 0 {
 58938  		return TCL_ERROR
 58939  	}
 58940  	if !(threadset1[i].Fbusy != 0) {
 58941  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58942  		return TCL_ERROR
 58943  	}
 58944  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58945  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_step1}))
 58946  	threadset1[i].Fopnum++
 58947  	return TCL_OK
 58948  }
 58949  
 58950  // This procedure runs in the thread to finalize a virtual machine.
 58951  func do_finalize1(tls *libc.TLS, p uintptr) { /* test7.c:564:13: */
 58952  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 58953  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 58954  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 58955  		return
 58956  	}
 58957  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_finalize(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58958  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 58959  }
 58960  
 58961  // Usage: client_finalize ID
 58962  //
 58963  // Finalize the virtual machine.
 58964  func tcl_client_finalize(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:579:26: */
 58965  	bp := tls.Alloc(48)
 58966  	defer tls.Free(48)
 58967  
 58968  	var i int32
 58969  	if argc != 2 {
 58970  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 58971  			ts+26238 /* " IDL" */, 0))
 58972  		return TCL_ERROR
 58973  	}
 58974  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 58975  	if i < 0 {
 58976  		return TCL_ERROR
 58977  	}
 58978  	if !(threadset1[i].Fbusy != 0) {
 58979  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 58980  		return TCL_ERROR
 58981  	}
 58982  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 58983  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_finalize1}))
 58984  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 58985  	threadset1[i].FzArg = uintptr(0)
 58986  	threadset1[i].Fopnum++
 58987  	return TCL_OK
 58988  }
 58989  
 58990  // This procedure runs in the thread to reset a virtual machine.
 58991  func do_reset(tls *libc.TLS, p uintptr) { /* test7.c:608:13: */
 58992  	if (*Thread1)(unsafe.Pointer(p)).FpStmt == uintptr(0) {
 58993  		(*Thread1)(unsafe.Pointer(p)).FzErr = libc.AssignPtrUintptr(p+36 /* &.zStaticErr */, ts+26209 /* "no virtual machi..." */)
 58994  		(*Thread1)(unsafe.Pointer(p)).Frc = SQLITE_ERROR
 58995  		return
 58996  	}
 58997  	(*Thread1)(unsafe.Pointer(p)).Frc = sqlite3_client_reset(tls, (*Thread1)(unsafe.Pointer(p)).FpStmt)
 58998  	(*Thread1)(unsafe.Pointer(p)).FpStmt = uintptr(0)
 58999  }
 59000  
 59001  // Usage: client_reset ID
 59002  //
 59003  // Finalize the virtual machine.
 59004  func tcl_client_reset(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:623:26: */
 59005  	bp := tls.Alloc(48)
 59006  	defer tls.Free(48)
 59007  
 59008  	var i int32
 59009  	if argc != 2 {
 59010  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 59011  			ts+26238 /* " IDL" */, 0))
 59012  		return TCL_ERROR
 59013  	}
 59014  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 59015  	if i < 0 {
 59016  		return TCL_ERROR
 59017  	}
 59018  	if !(threadset1[i].Fbusy != 0) {
 59019  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 59020  		return TCL_ERROR
 59021  	}
 59022  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 59023  	threadset1[i].FxOp = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{do_reset}))
 59024  	sqlite3.Xsqlite3_free(tls, threadset1[i].FzArg)
 59025  	threadset1[i].FzArg = uintptr(0)
 59026  	threadset1[i].Fopnum++
 59027  	return TCL_OK
 59028  }
 59029  
 59030  // Usage: client_swap ID ID
 59031  //
 59032  // Interchange the sqlite* pointer between two threads.
 59033  func tcl_client_swap(tls *libc.TLS, NotUsed uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test7.c:654:26: */
 59034  	bp := tls.Alloc(64)
 59035  	defer tls.Free(64)
 59036  
 59037  	var i int32
 59038  	var j int32
 59039  	var temp uintptr
 59040  	if argc != 3 {
 59041  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 59042  			ts+26243 /* " ID1 ID2" */, 0))
 59043  		return TCL_ERROR
 59044  	}
 59045  	i = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 59046  	if i < 0 {
 59047  		return TCL_ERROR
 59048  	}
 59049  	if !(threadset1[i].Fbusy != 0) {
 59050  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+26133 /* "no such thread" */, 0))
 59051  		return TCL_ERROR
 59052  	}
 59053  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(i)*852))
 59054  	j = parse_client_id(tls, interp, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 59055  	if j < 0 {
 59056  		return TCL_ERROR
 59057  	}
 59058  	if !(threadset1[j].Fbusy != 0) {
 59059  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+26133 /* "no such thread" */, 0))
 59060  		return TCL_ERROR
 59061  	}
 59062  	client_wait(tls, (uintptr(unsafe.Pointer(&threadset1)) + uintptr(j)*852))
 59063  	temp = threadset1[i].Fdb
 59064  	threadset1[i].Fdb = threadset1[j].Fdb
 59065  	threadset1[j].Fdb = temp
 59066  	return TCL_OK
 59067  }
 59068  
 59069  // Register commands with the TCL interpreter.
 59070  func Sqlitetest7_Init(tls *libc.TLS, interp uintptr) int32 { /* test7.c:690:5: */
 59071  	var i int32
 59072  
 59073  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd6)) / uint32(unsafe.Sizeof(struct {
 59074  		FzName uintptr
 59075  		FxProc uintptr
 59076  	}{}))); i++ {
 59077  		tcl.XTcl_CreateCommand(tls, interp, aCmd6[i].FzName, aCmd6[i].FxProc, uintptr(0), uintptr(0))
 59078  	}
 59079  	return TCL_OK
 59080  }
 59081  
 59082  var aCmd6 = [13]struct {
 59083  	FzName uintptr
 59084  	FxProc uintptr
 59085  }{
 59086  	{FzName: ts + 27267 /* "client_create" */, FxProc: 0},
 59087  	{FzName: ts + 27281 /* "client_wait" */, FxProc: 0},
 59088  	{FzName: ts + 27293 /* "client_halt" */, FxProc: 0},
 59089  	{FzName: ts + 27305 /* "client_argc" */, FxProc: 0},
 59090  	{FzName: ts + 27317 /* "client_argv" */, FxProc: 0},
 59091  	{FzName: ts + 27329 /* "client_colname" */, FxProc: 0},
 59092  	{FzName: ts + 27344 /* "client_result" */, FxProc: 0},
 59093  	{FzName: ts + 27358 /* "client_error" */, FxProc: 0},
 59094  	{FzName: ts + 27371 /* "client_compile" */, FxProc: 0},
 59095  	{FzName: ts + 27386 /* "client_step" */, FxProc: 0},
 59096  	{FzName: ts + 27398 /* "client_reset" */, FxProc: 0},
 59097  	{FzName: ts + 27411 /* "client_finalize" */, FxProc: 0},
 59098  	{FzName: ts + 27427 /* "client_swap" */, FxProc: 0},
 59099  } /* test7.c:694:5 */
 59100  
 59101  // end block for C++
 59102  
 59103  // Local Variables:
 59104  // mode: c
 59105  // c-basic-offset: 4
 59106  // fill-column: 78
 59107  // End:
 59108  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 59109  //    This file is part of the GNU C Library.
 59110  //
 59111  //    The GNU C Library is free software; you can redistribute it and/or
 59112  //    modify it under the terms of the GNU Lesser General Public
 59113  //    License as published by the Free Software Foundation; either
 59114  //    version 2.1 of the License, or (at your option) any later version.
 59115  //
 59116  //    The GNU C Library is distributed in the hope that it will be useful,
 59117  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 59118  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 59119  //    Lesser General Public License for more details.
 59120  //
 59121  //    You should have received a copy of the GNU Lesser General Public
 59122  //    License along with the GNU C Library; if not, see
 59123  //    <http://www.gnu.org/licenses/>.
 59124  
 59125  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 59126  
 59127  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 59128  //    This file is part of the GNU C Library.
 59129  //
 59130  //    The GNU C Library is free software; you can redistribute it and/or
 59131  //    modify it under the terms of the GNU Lesser General Public
 59132  //    License as published by the Free Software Foundation; either
 59133  //    version 2.1 of the License, or (at your option) any later version.
 59134  //
 59135  //    The GNU C Library is distributed in the hope that it will be useful,
 59136  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 59137  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 59138  //    Lesser General Public License for more details.
 59139  //
 59140  //    You should have received a copy of the GNU Lesser General Public
 59141  //    License along with the GNU C Library; if not, see
 59142  //    <http://www.gnu.org/licenses/>.
 59143  
 59144  //	ISO C99 Standard: 7.21 String handling	<string.h>
 59145  
 59146  type echo_vtab1 = struct {
 59147  	Fbase          sqlite3_vtab
 59148  	Finterp        uintptr
 59149  	Fdb            uintptr
 59150  	FisPattern     int32
 59151  	FinTransaction int32
 59152  	FzThis         uintptr
 59153  	FzTableName    uintptr
 59154  	FzLogName      uintptr
 59155  	FnCol          int32
 59156  	FaIndex        uintptr
 59157  	FaCol          uintptr
 59158  } /* test8.c:27:9 */
 59159  
 59160  // end block for C++
 59161  
 59162  // Local Variables:
 59163  // mode: c
 59164  // c-basic-offset: 4
 59165  // fill-column: 78
 59166  // End:
 59167  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 59168  //    This file is part of the GNU C Library.
 59169  //
 59170  //    The GNU C Library is free software; you can redistribute it and/or
 59171  //    modify it under the terms of the GNU Lesser General Public
 59172  //    License as published by the Free Software Foundation; either
 59173  //    version 2.1 of the License, or (at your option) any later version.
 59174  //
 59175  //    The GNU C Library is distributed in the hope that it will be useful,
 59176  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 59177  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 59178  //    Lesser General Public License for more details.
 59179  //
 59180  //    You should have received a copy of the GNU Lesser General Public
 59181  //    License along with the GNU C Library; if not, see
 59182  //    <http://www.gnu.org/licenses/>.
 59183  
 59184  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 59185  
 59186  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 59187  //    This file is part of the GNU C Library.
 59188  //
 59189  //    The GNU C Library is free software; you can redistribute it and/or
 59190  //    modify it under the terms of the GNU Lesser General Public
 59191  //    License as published by the Free Software Foundation; either
 59192  //    version 2.1 of the License, or (at your option) any later version.
 59193  //
 59194  //    The GNU C Library is distributed in the hope that it will be useful,
 59195  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 59196  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 59197  //    Lesser General Public License for more details.
 59198  //
 59199  //    You should have received a copy of the GNU Lesser General Public
 59200  //    License along with the GNU C Library; if not, see
 59201  //    <http://www.gnu.org/licenses/>.
 59202  
 59203  //	ISO C99 Standard: 7.21 String handling	<string.h>
 59204  
 59205  type echo_vtab = echo_vtab1 /* test8.c:27:26 */
 59206  type echo_cursor1 = struct {
 59207  	Fbase  sqlite3_vtab_cursor
 59208  	FpStmt uintptr
 59209  } /* test8.c:28:9 */
 59210  
 59211  type echo_cursor = echo_cursor1 /* test8.c:28:28 */
 59212  
 59213  func simulateVtabError(tls *libc.TLS, p uintptr, zMethod uintptr) int32 { /* test8.c:97:12: */
 59214  	bp := tls.Alloc(152)
 59215  	defer tls.Free(152)
 59216  
 59217  	var zErr uintptr
 59218  	// var zVarname [128]int8 at bp+24, 128
 59219  
 59220  	*(*int8)(unsafe.Pointer(bp + 24 /* &zVarname[0] */ + 127)) = int8(0)
 59221  	sqlite3.Xsqlite3_snprintf(tls, 127, bp+24 /* &zVarname[0] */, ts+27439 /* "echo_module_fail..." */, libc.VaList(bp, zMethod, (*echo_vtab)(unsafe.Pointer(p)).FzTableName))
 59222  	zErr = tcl.XTcl_GetVar2(tls, (*echo_vtab)(unsafe.Pointer(p)).Finterp, bp+24 /* &zVarname[0] */, uintptr(0), TCL_GLOBAL_ONLY)
 59223  	if zErr != 0 {
 59224  		(*echo_vtab)(unsafe.Pointer(p)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+27463 /* "echo-vtab-error:..." */, libc.VaList(bp+16, zErr))
 59225  	}
 59226  	return (libc.Bool32(zErr != uintptr(0)))
 59227  }
 59228  
 59229  // Convert an SQL-style quoted string into a normal string by removing
 59230  // the quote characters.  The conversion is done in-place.  If the
 59231  // input does not begin with a quote character, then this routine
 59232  // is a no-op.
 59233  //
 59234  // Examples:
 59235  //
 59236  //     "abc"   becomes   abc
 59237  //     'xyz'   becomes   xyz
 59238  //     [pqr]   becomes   pqr
 59239  //     `mno`   becomes   mno
 59240  func dequoteString(tls *libc.TLS, z uintptr) { /* test8.c:122:13: */
 59241  	var quote int32
 59242  	var i int32
 59243  	var j int32
 59244  	if z == uintptr(0) {
 59245  		return
 59246  	}
 59247  	quote = int32(*(*int8)(unsafe.Pointer(z)))
 59248  	switch quote {
 59249  	case '\'':
 59250  		break
 59251  	case '"':
 59252  		break
 59253  	case '`':
 59254  		break // For MySQL compatibility
 59255  	case '[':
 59256  		quote = ']'
 59257  		break // For MS SqlServer compatibility
 59258  	default:
 59259  		return
 59260  	}
 59261  	i = 1
 59262  	j = 0
 59263  	for ; *(*int8)(unsafe.Pointer(z + uintptr(i))) != 0; i++ {
 59264  		if int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == quote {
 59265  			if int32(*(*int8)(unsafe.Pointer(z + uintptr((i + 1))))) == quote {
 59266  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(quote)
 59267  				i++
 59268  			} else {
 59269  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = int8(0)
 59270  				break
 59271  			}
 59272  		} else {
 59273  			*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&j, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(i)))
 59274  		}
 59275  	}
 59276  }
 59277  
 59278  // Retrieve the column names for the table named zTab via database
 59279  // connection db. SQLITE_OK is returned on success, or an sqlite error
 59280  // code otherwise.
 59281  //
 59282  // If successful, the number of columns is written to *pnCol. *paCol is
 59283  // set to point at sqlite3_malloc()'d space containing the array of
 59284  // nCol column names. The caller is responsible for calling sqlite3_free
 59285  // on *paCol.
 59286  func getColumnNames(tls *libc.TLS, db uintptr, zTab uintptr, paCol uintptr, pnCol uintptr) int32 { /* test8.c:159:12: */
 59287  	bp := tls.Alloc(20)
 59288  	defer tls.Free(20)
 59289  
 59290  	var aCol uintptr
 59291  	var zSql uintptr
 59292  	// var pStmt uintptr at bp+16, 4
 59293  
 59294  	var rc int32
 59295  	var nCol int32
 59296  	var zName uintptr
 59297  	var ii int32
 59298  	var nBytes int32
 59299  	var zSpace uintptr
 59300  	aCol = uintptr(0)
 59301  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0)
 59302  	rc = SQLITE_OK
 59303  	nCol = 0
 59304  
 59305  	// Prepare the statement "SELECT * FROM <tbl>". The column names
 59306  	// of the result set of the compiled SELECT will be the same as
 59307  	// the column names of table <tbl>.
 59308  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27483 /* "SELECT * FROM %Q" */, libc.VaList(bp, zTab))
 59309  	if !(!(zSql != 0)) {
 59310  		goto __1
 59311  	}
 59312  	rc = SQLITE_NOMEM
 59313  	goto out
 59314  __1:
 59315  	;
 59316  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0))
 59317  	sqlite3.Xsqlite3_free(tls, zSql)
 59318  
 59319  	if !(rc == SQLITE_OK) {
 59320  		goto __2
 59321  	}
 59322  	nCol = sqlite3.Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 59323  
 59324  	// Figure out how much space to allocate for the array of column names
 59325  	// (including space for the strings themselves). Then allocate it.
 59326  	nBytes = (int32(uint32(unsafe.Sizeof(uintptr(0))) * uint32(nCol)))
 59327  	ii = 0
 59328  __3:
 59329  	if !(ii < nCol) {
 59330  		goto __5
 59331  	}
 59332  	zName = sqlite3.Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), ii)
 59333  	if !(!(zName != 0)) {
 59334  		goto __6
 59335  	}
 59336  	rc = SQLITE_NOMEM
 59337  	goto out
 59338  __6:
 59339  	;
 59340  	nBytes = nBytes + (int32(libc.Xstrlen(tls, zName)) + 1)
 59341  	goto __4
 59342  __4:
 59343  	ii++
 59344  	goto __3
 59345  	goto __5
 59346  __5:
 59347  	;
 59348  	aCol = sqlite3.Xsqlite3MallocZero(tls, uint64(nBytes))
 59349  	if !(!(aCol != 0)) {
 59350  		goto __7
 59351  	}
 59352  	rc = SQLITE_NOMEM
 59353  	goto out
 59354  __7:
 59355  	;
 59356  
 59357  	// Copy the column names into the allocated space and set up the
 59358  	// pointers in the aCol[] array.
 59359  	zSpace = (aCol + uintptr(nCol)*4)
 59360  	ii = 0
 59361  __8:
 59362  	if !(ii < nCol) {
 59363  		goto __10
 59364  	}
 59365  	*(*uintptr)(unsafe.Pointer(aCol + uintptr(ii)*4)) = zSpace
 59366  	sqlite3.Xsqlite3_snprintf(tls, nBytes, zSpace, ts /* "%s" */, libc.VaList(bp+8, sqlite3.Xsqlite3_column_name(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), ii)))
 59367  	zSpace += (uintptr(int32(libc.Xstrlen(tls, zSpace)) + 1))
 59368  	goto __9
 59369  __9:
 59370  	ii++
 59371  	goto __8
 59372  	goto __10
 59373  __10:
 59374  	;
 59375  
 59376  __2:
 59377  	;
 59378  
 59379  	*(*uintptr)(unsafe.Pointer(paCol)) = aCol
 59380  	*(*int32)(unsafe.Pointer(pnCol)) = nCol
 59381  
 59382  out:
 59383  	sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 59384  	return rc
 59385  }
 59386  
 59387  // Parameter zTab is the name of a table in database db with nCol
 59388  // columns. This function allocates an array of integers nCol in
 59389  // size and populates it according to any implicit or explicit
 59390  // indices on table zTab.
 59391  //
 59392  // If successful, SQLITE_OK is returned and *paIndex set to point
 59393  // at the allocated array. Otherwise, an error code is returned.
 59394  //
 59395  // See comments associated with the member variable aIndex above
 59396  // "struct echo_vtab" for details of the contents of the array.
 59397  func getIndexArray(tls *libc.TLS, db uintptr, zTab uintptr, nCol int32, paIndex uintptr) int32 { /* test8.c:239:12: */
 59398  	bp := tls.Alloc(24)
 59399  	defer tls.Free(24)
 59400  
 59401  	// var pStmt uintptr at bp+16, 4
 59402  
 59403  	var aIndex uintptr
 59404  	var rc int32
 59405  	var zSql uintptr
 59406  	var cid int32
 59407  	var zIdx uintptr
 59408  	// var pStmt2 uintptr at bp+20, 4
 59409  
 59410  	var rc2 int32
 59411  	*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) = uintptr(0)
 59412  	aIndex = uintptr(0)
 59413  
 59414  	// Allocate space for the index array
 59415  	aIndex = sqlite3.Xsqlite3MallocZero(tls, (uint64(uint32(unsafe.Sizeof(int32(0))) * uint32(nCol))))
 59416  	if !(!(aIndex != 0)) {
 59417  		goto __1
 59418  	}
 59419  	rc = SQLITE_NOMEM
 59420  	goto get_index_array_out
 59421  __1:
 59422  	;
 59423  
 59424  	// Compile an sqlite pragma to loop through all indices on table zTab
 59425  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27500 /* "PRAGMA index_lis..." */, libc.VaList(bp, zTab))
 59426  	if !(!(zSql != 0)) {
 59427  		goto __2
 59428  	}
 59429  	rc = SQLITE_NOMEM
 59430  	goto get_index_array_out
 59431  __2:
 59432  	;
 59433  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+16 /* &pStmt */, uintptr(0))
 59434  	sqlite3.Xsqlite3_free(tls, zSql)
 59435  
 59436  	// For each index, figure out the left-most column and set the
 59437  	// corresponding entry in aIndex[] to 1.
 59438  __3:
 59439  	if !((*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) != 0) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */))) == SQLITE_ROW)) {
 59440  		goto __4
 59441  	}
 59442  	zIdx = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)), 1)
 59443  	*(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */)) = uintptr(0)
 59444  	if !(zIdx == uintptr(0)) {
 59445  		goto __5
 59446  	}
 59447  	goto __3
 59448  __5:
 59449  	;
 59450  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27522 /* "PRAGMA index_inf..." */, libc.VaList(bp+8, zIdx))
 59451  	if !(!(zSql != 0)) {
 59452  		goto __6
 59453  	}
 59454  	rc = SQLITE_NOMEM
 59455  	goto get_index_array_out
 59456  __6:
 59457  	;
 59458  	rc = sqlite3.Xsqlite3_prepare(tls, db, zSql, -1, bp+20 /* &pStmt2 */, uintptr(0))
 59459  	sqlite3.Xsqlite3_free(tls, zSql)
 59460  	if !((*(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */)) != 0) && (sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */))) == SQLITE_ROW)) {
 59461  		goto __7
 59462  	}
 59463  	cid = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */)), 1)
 59464  
 59465  	*(*int32)(unsafe.Pointer(aIndex + uintptr(cid)*4)) = 1
 59466  __7:
 59467  	;
 59468  	if !(*(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */)) != 0) {
 59469  		goto __8
 59470  	}
 59471  	rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pStmt2 */)))
 59472  __8:
 59473  	;
 59474  	if !(rc != SQLITE_OK) {
 59475  		goto __9
 59476  	}
 59477  	goto get_index_array_out
 59478  __9:
 59479  	;
 59480  	goto __3
 59481  __4:
 59482  	;
 59483  
 59484  get_index_array_out:
 59485  	if !(*(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)) != 0) {
 59486  		goto __10
 59487  	}
 59488  	rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pStmt */)))
 59489  	if !(rc == SQLITE_OK) {
 59490  		goto __11
 59491  	}
 59492  	rc = rc2
 59493  __11:
 59494  	;
 59495  __10:
 59496  	;
 59497  	if !(rc != SQLITE_OK) {
 59498  		goto __12
 59499  	}
 59500  	sqlite3.Xsqlite3_free(tls, aIndex)
 59501  	aIndex = uintptr(0)
 59502  __12:
 59503  	;
 59504  	*(*uintptr)(unsafe.Pointer(paIndex)) = aIndex
 59505  	return rc
 59506  }
 59507  
 59508  // Global Tcl variable $echo_module is a list. This routine appends
 59509  // the string element zArg to that list in interpreter interp.
 59510  func appendToEchoModule(tls *libc.TLS, interp uintptr, zArg uintptr) { /* test8.c:313:13: */
 59511  	var flags int32 = ((TCL_APPEND_VALUE | TCL_LIST_ELEMENT) | TCL_GLOBAL_ONLY)
 59512  	tcl.XTcl_SetVar2(tls, interp, ts+27544 /* "echo_module" */, uintptr(0), func() uintptr {
 59513  		if zArg != 0 {
 59514  			return zArg
 59515  		}
 59516  		return ts + 489 /* "" */
 59517  	}(), flags)
 59518  }
 59519  
 59520  // This function is called from within the echo-modules xCreate and
 59521  // xConnect methods. The argc and argv arguments are copies of those
 59522  // passed to the calling method. This function is responsible for
 59523  // calling sqlite3_declare_vtab() to declare the schema of the virtual
 59524  // table being created or connected.
 59525  //
 59526  // If the constructor was passed just one argument, i.e.:
 59527  //
 59528  //   CREATE TABLE t1 AS echo(t2);
 59529  //
 59530  // Then t2 is assumed to be the name of a *real* database table. The
 59531  // schema of the virtual table is declared by passing a copy of the
 59532  // CREATE TABLE statement for the real table to sqlite3_declare_vtab().
 59533  // Hence, the virtual table should have exactly the same column names and
 59534  // types as the real table.
 59535  func echoDeclareVtab(tls *libc.TLS, pVtab uintptr, db uintptr) int32 { /* test8.c:335:12: */
 59536  	bp := tls.Alloc(4)
 59537  	defer tls.Free(4)
 59538  
 59539  	var rc int32 = SQLITE_OK
 59540  
 59541  	if (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName != 0 {
 59542  		*(*uintptr)(unsafe.Pointer(bp /* pStmt */)) = uintptr(0)
 59543  		rc = sqlite3.Xsqlite3_prepare(tls, db,
 59544  			ts+27556, /* "SELECT sql FROM ..." */
 59545  			-1, bp /* &pStmt */, uintptr(0))
 59546  		if rc == SQLITE_OK {
 59547  			sqlite3.Xsqlite3_bind_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 1, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, -1, uintptr(0))
 59548  			if sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) == SQLITE_ROW {
 59549  				var rc2 int32
 59550  				var zCreateTable uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0)
 59551  				rc = sqlite3.Xsqlite3_declare_vtab(tls, db, zCreateTable)
 59552  				rc2 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 59553  				if rc == SQLITE_OK {
 59554  					rc = rc2
 59555  				}
 59556  			} else {
 59557  				rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 59558  				if rc == SQLITE_OK {
 59559  					rc = SQLITE_ERROR
 59560  				}
 59561  			}
 59562  			if rc == SQLITE_OK {
 59563  				rc = getColumnNames(tls, db, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, (pVtab + 48 /* &.aCol */), (pVtab + 40 /* &.nCol */))
 59564  			}
 59565  			if rc == SQLITE_OK {
 59566  				rc = getIndexArray(tls, db, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName, (*echo_vtab)(unsafe.Pointer(pVtab)).FnCol, (pVtab + 44 /* &.aIndex */))
 59567  			}
 59568  		}
 59569  	}
 59570  
 59571  	return rc
 59572  }
 59573  
 59574  // This function frees all runtime structures associated with the virtual
 59575  // table pVtab.
 59576  func echoDestructor(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:378:12: */
 59577  	var p uintptr = pVtab
 59578  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FaIndex)
 59579  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FaCol)
 59580  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzThis)
 59581  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzTableName)
 59582  	sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(p)).FzLogName)
 59583  	sqlite3.Xsqlite3_free(tls, p)
 59584  	return 0
 59585  }
 59586  
 59587  type EchoModule1 = struct {
 59588  	Finterp uintptr
 59589  	Fdb     uintptr
 59590  } /* test8.c:389:9 */
 59591  
 59592  type EchoModule = EchoModule1 /* test8.c:389:27 */
 59593  
 59594  // This function is called to do the work of the xConnect() method -
 59595  // to allocate the required in-memory structures for a newly connected
 59596  // virtual table.
 59597  func echoConstructor(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:400:12: */
 59598  	bp := tls.Alloc(32)
 59599  	defer tls.Free(32)
 59600  
 59601  	var rc int32
 59602  	var i int32
 59603  	var pVtab uintptr
 59604  
 59605  	// Allocate the sqlite3_vtab/echo_vtab structure itself
 59606  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(echo_vtab{})))
 59607  	if !(pVtab != 0) {
 59608  		return SQLITE_NOMEM
 59609  	}
 59610  	(*echo_vtab)(unsafe.Pointer(pVtab)).Finterp = (*EchoModule)(unsafe.Pointer(pAux)).Finterp
 59611  	(*echo_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 59612  
 59613  	// Allocate echo_vtab.zThis
 59614  	(*echo_vtab)(unsafe.Pointer(pVtab)).FzThis = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 2*4))))
 59615  	if !(int32((*echo_vtab)(unsafe.Pointer(pVtab)).FzThis) != 0) {
 59616  		echoDestructor(tls, pVtab)
 59617  		return SQLITE_NOMEM
 59618  	}
 59619  
 59620  	// Allocate echo_vtab.zTableName
 59621  	if argc > 3 {
 59622  		(*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, *(*uintptr)(unsafe.Pointer(argv + 3*4))))
 59623  		dequoteString(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)
 59624  		if ((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName != 0) && (int32(*(*int8)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))) == '*') {
 59625  			var z uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+27620 /* "%s%s" */, libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(argv + 2*4)), ((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName+1)))
 59626  			sqlite3.Xsqlite3_free(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)
 59627  			(*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName = z
 59628  			(*echo_vtab)(unsafe.Pointer(pVtab)).FisPattern = 1
 59629  		}
 59630  		if !(int32((*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName) != 0) {
 59631  			echoDestructor(tls, pVtab)
 59632  			return SQLITE_NOMEM
 59633  		}
 59634  	}
 59635  
 59636  	// Log the arguments to this function to Tcl var ::echo_module
 59637  	for i = 0; i < argc; i++ {
 59638  		appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 59639  	}
 59640  
 59641  	// Invoke sqlite3_declare_vtab and set up other members of the echo_vtab
 59642  	// structure. If an error occurs, delete the sqlite3_vtab structure and
 59643  	// return an error code.
 59644  	rc = echoDeclareVtab(tls, pVtab, db)
 59645  	if rc != SQLITE_OK {
 59646  		echoDestructor(tls, pVtab)
 59647  		return rc
 59648  	}
 59649  
 59650  	// Success. Set *ppVtab and return
 59651  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 59652  	return SQLITE_OK
 59653  }
 59654  
 59655  // Echo virtual table module xCreate method.
 59656  func echoCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:465:12: */
 59657  	bp := tls.Alloc(24)
 59658  	defer tls.Free(24)
 59659  
 59660  	var rc int32 = SQLITE_OK
 59661  	appendToEchoModule(tls, (*EchoModule)(unsafe.Pointer(pAux)).Finterp, ts+27625 /* "xCreate" */)
 59662  	rc = echoConstructor(tls, db, pAux, argc, argv, ppVtab, pzErr)
 59663  
 59664  	// If there were two arguments passed to the module at the SQL level
 59665  	// (i.e. "CREATE VIRTUAL TABLE tbl USING echo(arg1, arg2)"), then
 59666  	// the second argument is used as a table name. Attempt to create
 59667  	// such a table with a single column, "logmsg". This table will
 59668  	// be used to log calls to the xUpdate method. It will be deleted
 59669  	// when the virtual table is DROPed.
 59670  	//
 59671  	// Note: The main point of this is to test that we can drop tables
 59672  	// from within an xDestroy method call.
 59673  	if (rc == SQLITE_OK) && (argc == 5) {
 59674  		var zSql uintptr
 59675  		var pVtab uintptr = *(*uintptr)(unsafe.Pointer(ppVtab))
 59676  		(*echo_vtab)(unsafe.Pointer(pVtab)).FzLogName = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 4*4))))
 59677  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27633 /* "CREATE TABLE %Q(..." */, libc.VaList(bp+8, (*echo_vtab)(unsafe.Pointer(pVtab)).FzLogName))
 59678  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 59679  		sqlite3.Xsqlite3_free(tls, zSql)
 59680  		if rc != SQLITE_OK {
 59681  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, sqlite3.Xsqlite3_errmsg(tls, db)))
 59682  		}
 59683  	}
 59684  
 59685  	if (*(*uintptr)(unsafe.Pointer(ppVtab)) != 0) && (rc != SQLITE_OK) {
 59686  		echoDestructor(tls, *(*uintptr)(unsafe.Pointer(ppVtab)))
 59687  		*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 59688  	}
 59689  
 59690  	if rc == SQLITE_OK {
 59691  		(*echo_vtab)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(ppVtab)))).FinTransaction = 1
 59692  	}
 59693  
 59694  	return rc
 59695  }
 59696  
 59697  // Echo virtual table module xConnect method.
 59698  func echoConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test8.c:513:12: */
 59699  	appendToEchoModule(tls, (*EchoModule)(unsafe.Pointer(pAux)).Finterp, ts+27657 /* "xConnect" */)
 59700  	return echoConstructor(tls, db, pAux, argc, argv, ppVtab, pzErr)
 59701  }
 59702  
 59703  // Echo virtual table module xDisconnect method.
 59704  func echoDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:527:12: */
 59705  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27666 /* "xDisconnect" */)
 59706  	return echoDestructor(tls, pVtab)
 59707  }
 59708  
 59709  // Echo virtual table module xDestroy method.
 59710  func echoDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* test8.c:535:12: */
 59711  	bp := tls.Alloc(8)
 59712  	defer tls.Free(8)
 59713  
 59714  	var rc int32 = SQLITE_OK
 59715  	var p uintptr = pVtab
 59716  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27678 /* "xDestroy" */)
 59717  
 59718  	// Drop the "log" table, if one exists (see echoCreate() for details)
 59719  	if (p != 0) && ((*echo_vtab)(unsafe.Pointer(p)).FzLogName != 0) {
 59720  		var zSql uintptr
 59721  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+27687 /* "DROP TABLE %Q" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(p)).FzLogName))
 59722  		rc = sqlite3.Xsqlite3_exec(tls, (*echo_vtab)(unsafe.Pointer(p)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
 59723  		sqlite3.Xsqlite3_free(tls, zSql)
 59724  	}
 59725  
 59726  	if rc == SQLITE_OK {
 59727  		rc = echoDestructor(tls, pVtab)
 59728  	}
 59729  	return rc
 59730  }
 59731  
 59732  // Echo virtual table module xOpen method.
 59733  func echoOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test8.c:557:12: */
 59734  	var pCur uintptr
 59735  	if simulateVtabError(tls, pVTab, ts+27701 /* "xOpen" */) != 0 {
 59736  		return SQLITE_ERROR
 59737  	}
 59738  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(echo_cursor{})))
 59739  	*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 59740  	return func() int32 {
 59741  		if pCur != 0 {
 59742  			return SQLITE_OK
 59743  		}
 59744  		return SQLITE_NOMEM
 59745  	}()
 59746  }
 59747  
 59748  // Echo virtual table module xClose method.
 59749  func echoClose(tls *libc.TLS, cur uintptr) int32 { /* test8.c:570:12: */
 59750  	var rc int32
 59751  	var pCur uintptr = cur
 59752  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt
 59753  	(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 59754  	sqlite3.Xsqlite3_free(tls, pCur)
 59755  	rc = sqlite3.Xsqlite3_finalize(tls, pStmt)
 59756  	return rc
 59757  }
 59758  
 59759  // Return non-zero if the cursor does not currently point to a valid record
 59760  // (i.e if the scan has finished), or zero otherwise.
 59761  func echoEof(tls *libc.TLS, cur uintptr) int32 { /* test8.c:584:12: */
 59762  	return func() int32 {
 59763  		if (*echo_cursor)(unsafe.Pointer(cur)).FpStmt != 0 {
 59764  			return 0
 59765  		}
 59766  		return 1
 59767  	}()
 59768  }
 59769  
 59770  // Echo virtual table module xNext method.
 59771  func echoNext(tls *libc.TLS, cur uintptr) int32 { /* test8.c:591:12: */
 59772  	var rc int32 = SQLITE_OK
 59773  	var pCur uintptr = cur
 59774  
 59775  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+27707 /* "xNext" */) != 0 {
 59776  		return SQLITE_ERROR
 59777  	}
 59778  
 59779  	if (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt != 0 {
 59780  		rc = sqlite3.Xsqlite3_step(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 59781  		if rc == SQLITE_ROW {
 59782  			rc = SQLITE_OK
 59783  		} else {
 59784  			rc = sqlite3.Xsqlite3_finalize(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 59785  			(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 59786  		}
 59787  	}
 59788  
 59789  	return rc
 59790  }
 59791  
 59792  // Echo virtual table module xColumn method.
 59793  func echoColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test8.c:615:12: */
 59794  	var iCol int32 = (i + 1)
 59795  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(cur)).FpStmt
 59796  
 59797  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+27713 /* "xColumn" */) != 0 {
 59798  		return SQLITE_ERROR
 59799  	}
 59800  
 59801  	if !(pStmt != 0) {
 59802  		sqlite3.Xsqlite3_result_null(tls, ctx)
 59803  	} else {
 59804  
 59805  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, pStmt, iCol))
 59806  	}
 59807  	return SQLITE_OK
 59808  }
 59809  
 59810  // Echo virtual table module xRowid method.
 59811  func echoRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test8.c:635:12: */
 59812  	var pStmt uintptr = (*echo_cursor)(unsafe.Pointer(cur)).FpStmt
 59813  
 59814  	if simulateVtabError(tls, (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab, ts+2165 /* "xRowid" */) != 0 {
 59815  		return SQLITE_ERROR
 59816  	}
 59817  
 59818  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, pStmt, 0)
 59819  	return SQLITE_OK
 59820  }
 59821  
 59822  // Compute a simple hash of the null terminated string zString.
 59823  //
 59824  // This module uses only sqlite3_index_info.idxStr, not
 59825  // sqlite3_index_info.idxNum. So to test idxNum, when idxStr is set
 59826  // in echoBestIndex(), idxNum is set to the corresponding hash value.
 59827  // In echoFilter(), code assert()s that the supplied idxNum value is
 59828  // indeed the hash of the supplied idxStr.
 59829  func hashString(tls *libc.TLS, zString uintptr) int32 { /* test8.c:655:12: */
 59830  	var val u32 = u32(0)
 59831  	var ii int32
 59832  	for ii = 0; *(*int8)(unsafe.Pointer(zString + uintptr(ii))) != 0; ii++ {
 59833  		val = ((val << 3) + u32(int32(*(*int8)(unsafe.Pointer(zString + uintptr(ii))))))
 59834  	}
 59835  	return (int32(val & u32(0x7fffffff)))
 59836  }
 59837  
 59838  // Echo virtual table module xFilter method.
 59839  func echoFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test8.c:667:12: */
 59840  	var rc int32
 59841  	var i int32
 59842  
 59843  	var pCur uintptr = pVtabCursor
 59844  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 59845  	var db uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb
 59846  
 59847  	if simulateVtabError(tls, pVtab, ts+27721 /* "xFilter" */) != 0 {
 59848  		return SQLITE_ERROR
 59849  	}
 59850  
 59851  	// Check that idxNum matches idxStr
 59852  
 59853  	// Log arguments to the ::echo_module Tcl variable
 59854  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27721 /* "xFilter" */)
 59855  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, idxStr)
 59856  	for i = 0; i < argc; i++ {
 59857  		appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))))
 59858  	}
 59859  
 59860  	sqlite3.Xsqlite3_finalize(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt)
 59861  	(*echo_cursor)(unsafe.Pointer(pCur)).FpStmt = uintptr(0)
 59862  
 59863  	// Prepare the SQL statement created by echoBestIndex and bind the
 59864  	// runtime parameters passed to this function to it.
 59865  	rc = sqlite3.Xsqlite3_prepare(tls, db, idxStr, -1, (pCur + 4 /* &.pStmt */), uintptr(0))
 59866  
 59867  	for i = 0; (rc == SQLITE_OK) && (i < argc); i++ {
 59868  		rc = sqlite3.Xsqlite3_bind_value(tls, (*echo_cursor)(unsafe.Pointer(pCur)).FpStmt, (i + 1), *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 59869  	}
 59870  
 59871  	// If everything was successful, advance to the first row of the scan
 59872  	if rc == SQLITE_OK {
 59873  		rc = echoNext(tls, pVtabCursor)
 59874  	}
 59875  
 59876  	return rc
 59877  }
 59878  
 59879  // A helper function used by echoUpdate() and echoBestIndex() for
 59880  // manipulating strings in concert with the sqlite3_mprintf() function.
 59881  //
 59882  // Parameter pzStr points to a pointer to a string allocated with
 59883  // sqlite3_mprintf. The second parameter, zAppend, points to another
 59884  // string. The two strings are concatenated together and *pzStr
 59885  // set to point at the result. The initial buffer pointed to by *pzStr
 59886  // is deallocated via sqlite3_free().
 59887  //
 59888  // If the third argument, doFree, is true, then sqlite3_free() is
 59889  // also called to free the buffer pointed to by zAppend.
 59890  func string_concat(tls *libc.TLS, pzStr uintptr, zAppend uintptr, doFree int32, pRc uintptr) { /* test8.c:727:13: */
 59891  	bp := tls.Alloc(24)
 59892  	defer tls.Free(24)
 59893  
 59894  	var zIn uintptr = *(*uintptr)(unsafe.Pointer(pzStr))
 59895  	if (!(zAppend != 0) && (doFree != 0)) && (*(*int32)(unsafe.Pointer(pRc)) == SQLITE_OK) {
 59896  		*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 59897  	}
 59898  	if *(*int32)(unsafe.Pointer(pRc)) != SQLITE_OK {
 59899  		sqlite3.Xsqlite3_free(tls, zIn)
 59900  		zIn = uintptr(0)
 59901  	} else {
 59902  		if zIn != 0 {
 59903  			var zTemp uintptr = zIn
 59904  			zIn = sqlite3.Xsqlite3_mprintf(tls, ts+27620 /* "%s%s" */, libc.VaList(bp, zIn, zAppend))
 59905  			sqlite3.Xsqlite3_free(tls, zTemp)
 59906  		} else {
 59907  			zIn = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, zAppend))
 59908  		}
 59909  		if !(zIn != 0) {
 59910  			*(*int32)(unsafe.Pointer(pRc)) = SQLITE_NOMEM
 59911  		}
 59912  	}
 59913  	*(*uintptr)(unsafe.Pointer(pzStr)) = zIn
 59914  	if doFree != 0 {
 59915  		sqlite3.Xsqlite3_free(tls, zAppend)
 59916  	}
 59917  }
 59918  
 59919  // This function returns a pointer to an sqlite3_malloc()ed buffer
 59920  // containing the select-list (the thing between keywords SELECT and FROM)
 59921  // to query the underlying real table with for the scan described by
 59922  // argument pIdxInfo.
 59923  //
 59924  // If the current SQLite version is earlier than 3.10.0, this is just "*"
 59925  // (select all columns). Or, for version 3.10.0 and greater, the list of
 59926  // columns identified by the pIdxInfo->colUsed mask.
 59927  func echoSelectList(tls *libc.TLS, pTab uintptr, pIdxInfo uintptr) uintptr { /* test8.c:763:13: */
 59928  	bp := tls.Alloc(24)
 59929  	defer tls.Free(24)
 59930  
 59931  	var zRet uintptr = uintptr(0)
 59932  	if sqlite3.Xsqlite3_libversion_number(tls) < 3010000 {
 59933  		zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27729 /* ", *" */, 0)
 59934  	} else {
 59935  		var i int32
 59936  		for i = 0; i < (*echo_vtab)(unsafe.Pointer(pTab)).FnCol; i++ {
 59937  			if ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed & (sqlite3_uint64(uint64(1)) << (func() int32 {
 59938  				if i >= 63 {
 59939  					return 63
 59940  				}
 59941  				return i
 59942  			}()))) != 0 {
 59943  				zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27733 /* "%z, %s" */, libc.VaList(bp, zRet, *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pTab)).FaCol + uintptr(i)*4))))
 59944  			} else {
 59945  				zRet = sqlite3.Xsqlite3_mprintf(tls, ts+27740 /* "%z, NULL" */, libc.VaList(bp+16, zRet))
 59946  			}
 59947  			if !(zRet != 0) {
 59948  				break
 59949  			}
 59950  		}
 59951  	}
 59952  	return zRet
 59953  }
 59954  
 59955  // The echo module implements the subset of query constraints and sort
 59956  // orders that may take advantage of SQLite indices on the underlying
 59957  // real table. For example, if the real table is declared as:
 59958  //
 59959  //     CREATE TABLE real(a, b, c);
 59960  //     CREATE INDEX real_index ON real(b);
 59961  //
 59962  // then the echo module handles WHERE or ORDER BY clauses that refer
 59963  // to the column "b", but not "a" or "c". If a multi-column index is
 59964  // present, only its left most column is considered.
 59965  //
 59966  // This xBestIndex method encodes the proposed search strategy as
 59967  // an SQL query on the real table underlying the virtual echo module
 59968  // table and stores the query in sqlite3_index_info.idxStr. The SQL
 59969  // statement is of the form:
 59970  //
 59971  //   SELECT rowid, * FROM <real-table> ?<where-clause>? ?<order-by-clause>?
 59972  //
 59973  // where the <where-clause> and <order-by-clause> are determined
 59974  // by the contents of the structure pointed to by the pIdxInfo argument.
 59975  func echoBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test8.c:803:12: */
 59976  	bp := tls.Alloc(92)
 59977  	defer tls.Free(92)
 59978  
 59979  	var ii int32
 59980  	*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) = uintptr(0)
 59981  	var zCol uintptr = uintptr(0)
 59982  	var zNew uintptr
 59983  	var nArg int32 = 0
 59984  	var zSep uintptr = ts + 8838 /* "WHERE" */
 59985  	var pVtab uintptr = tab
 59986  	*(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)) = uintptr(0)
 59987  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 59988  
 59989  	var nRow int32 = 0
 59990  	var useIdx int32 = 0
 59991  	*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = SQLITE_OK
 59992  	var useCost int32 = 0
 59993  	var cost float64 = float64(0)
 59994  	var isIgnoreUsable int32 = 0
 59995  	if tcl.XTcl_GetVar2(tls, interp, ts+27749 /* "echo_module_igno..." */, uintptr(0), TCL_GLOBAL_ONLY) != 0 {
 59996  		isIgnoreUsable = 1
 59997  	}
 59998  
 59999  	if simulateVtabError(tls, pVtab, ts+27775 /* "xBestIndex" */) != 0 {
 60000  		return SQLITE_ERROR
 60001  	}
 60002  
 60003  	// Determine the number of rows in the table and store this value in local
 60004  	// variable nRow. The 'estimated-cost' of the scan will be the number of
 60005  	// rows in the table for a linear scan, or the log (base 2) of the
 60006  	// number of rows if the proposed scan uses an index.
 60007  	if tcl.XTcl_GetVar2(tls, interp, ts+27786 /* "echo_module_cost" */, uintptr(0), TCL_GLOBAL_ONLY) != 0 {
 60008  		cost = libc.Xatof(tls, tcl.XTcl_GetVar2(tls, interp, ts+27786 /* "echo_module_cost" */, uintptr(0), TCL_GLOBAL_ONLY))
 60009  		useCost = 1
 60010  	} else {
 60011  		*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27803 /* "SELECT count(*) ..." */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 60012  		if !(*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) != 0) {
 60013  			return SQLITE_NOMEM
 60014  		}
 60015  		*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_prepare(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb, *(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)), -1, bp+80 /* &pStmt */, uintptr(0))
 60016  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)))
 60017  		if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) != SQLITE_OK {
 60018  			return *(*int32)(unsafe.Pointer(bp + 88 /* rc */))
 60019  		}
 60020  		sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 60021  		nRow = sqlite3.Xsqlite3_column_int(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)), 0)
 60022  		*(*int32)(unsafe.Pointer(bp + 88 /* rc */)) = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* pStmt */)))
 60023  		if *(*int32)(unsafe.Pointer(bp + 88 /* rc */)) != SQLITE_OK {
 60024  			return *(*int32)(unsafe.Pointer(bp + 88 /* rc */))
 60025  		}
 60026  	}
 60027  
 60028  	zCol = echoSelectList(tls, pVtab, pIdxInfo)
 60029  	if !(zCol != 0) {
 60030  		return SQLITE_NOMEM
 60031  	}
 60032  	*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27827 /* "SELECT rowid%z F..." */, libc.VaList(bp+8, zCol, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 60033  	if !(*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) != 0) {
 60034  		return SQLITE_NOMEM
 60035  	}
 60036  
 60037  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 60038  		var pConstraint uintptr
 60039  		var pUsage uintptr
 60040  		var iCol int32
 60041  
 60042  		pConstraint = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 60043  		pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 60044  
 60045  		if !(isIgnoreUsable != 0) && !(int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fusable) != 0) {
 60046  			continue
 60047  		}
 60048  
 60049  		iCol = (*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).FiColumn
 60050  		if (iCol < 0) || (*(*int32)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaIndex + uintptr(iCol)*4)) != 0) {
 60051  			var zNewCol uintptr
 60052  			if iCol >= 0 {
 60053  				zNewCol = *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr(iCol)*4))
 60054  			} else {
 60055  				zNewCol = ts + 27850 /* "rowid" */
 60056  			}
 60057  			var zOp uintptr = uintptr(0)
 60058  			useIdx = 1
 60059  			switch int32((*sqlite3_index_constraint)(unsafe.Pointer(pConstraint)).Fop) {
 60060  			case SQLITE_INDEX_CONSTRAINT_EQ:
 60061  				zOp = ts + 27856 /* "=" */
 60062  				break
 60063  				fallthrough
 60064  			case SQLITE_INDEX_CONSTRAINT_LT:
 60065  				zOp = ts + 27858 /* "<" */
 60066  				break
 60067  				fallthrough
 60068  			case SQLITE_INDEX_CONSTRAINT_GT:
 60069  				zOp = ts + 27860 /* ">" */
 60070  				break
 60071  				fallthrough
 60072  			case SQLITE_INDEX_CONSTRAINT_LE:
 60073  				zOp = ts + 27862 /* "<=" */
 60074  				break
 60075  				fallthrough
 60076  			case SQLITE_INDEX_CONSTRAINT_GE:
 60077  				zOp = ts + 27865 /* ">=" */
 60078  				break
 60079  				fallthrough
 60080  			case SQLITE_INDEX_CONSTRAINT_MATCH:
 60081  				// Purposely translate the MATCH operator into a LIKE, which
 60082  				// will be used by the next block of code to construct a new
 60083  				// query.  It should also be noted here that the next block
 60084  				// of code requires the first letter of this operator to be
 60085  				// in upper-case to trigger the special MATCH handling (i.e.
 60086  				// wrapping the bound parameter with literal '%'s).
 60087  				zOp = ts + 27868 /* "LIKE" */
 60088  				break
 60089  				fallthrough
 60090  			case SQLITE_INDEX_CONSTRAINT_LIKE:
 60091  				zOp = ts + 27873 /* "like" */
 60092  				break
 60093  				fallthrough
 60094  			case SQLITE_INDEX_CONSTRAINT_GLOB:
 60095  				zOp = ts + 27878 /* "glob" */
 60096  				break
 60097  				fallthrough
 60098  			case SQLITE_INDEX_CONSTRAINT_REGEXP:
 60099  				zOp = ts + 6335 /* "regexp" */
 60100  				break
 60101  			}
 60102  			if zOp != 0 {
 60103  				if int32(*(*int8)(unsafe.Pointer(zOp))) == 'L' {
 60104  					zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27883, /* " %s %s LIKE (SEL..." */
 60105  						libc.VaList(bp+24, zSep, zNewCol))
 60106  				} else {
 60107  					zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27918 /* " %s %s %s ?" */, libc.VaList(bp+40, zSep, zNewCol, zOp))
 60108  				}
 60109  				string_concat(tls, bp+84 /* &zQuery */, zNew, 1, bp+88 /* &rc */)
 60110  				zSep = ts + 8865 /* "AND" */
 60111  				(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&nArg, 1)
 60112  				(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 60113  			}
 60114  		}
 60115  	}
 60116  
 60117  	// If there is only one term in the ORDER BY clause, and it is
 60118  	// on a column that this virtual table has an index for, then consume
 60119  	// the ORDER BY clause.
 60120  	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)) {
 60121  		var iCol int32 = (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).FiColumn
 60122  		var zNewCol uintptr
 60123  		if iCol >= 0 {
 60124  			zNewCol = *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr(iCol)*4))
 60125  		} else {
 60126  			zNewCol = ts + 27850 /* "rowid" */
 60127  		}
 60128  		var zDir uintptr
 60129  		if (*sqlite3_index_orderby)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy)).Fdesc != 0 {
 60130  			zDir = ts + 27930 /* "DESC" */
 60131  		} else {
 60132  			zDir = ts + 27935 /* "ASC" */
 60133  		}
 60134  		zNew = sqlite3.Xsqlite3_mprintf(tls, ts+27939 /* " ORDER BY %s %s" */, libc.VaList(bp+64, zNewCol, zDir))
 60135  		string_concat(tls, bp+84 /* &zQuery */, zNew, 1, bp+88 /* &rc */)
 60136  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).ForderByConsumed = 1
 60137  	}
 60138  
 60139  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, ts+27775 /* "xBestIndex" */)
 60140  
 60141  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, *(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)))
 60142  
 60143  	if !(*(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)) != 0) {
 60144  		return *(*int32)(unsafe.Pointer(bp + 88 /* rc */))
 60145  	}
 60146  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = hashString(tls, *(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */)))
 60147  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = *(*uintptr)(unsafe.Pointer(bp + 84 /* zQuery */))
 60148  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 60149  	if useCost != 0 {
 60150  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = cost
 60151  	} else if useIdx != 0 {
 60152  		// Approximation of log2(nRow).
 60153  		for ii = 0; uint32(ii) < ((uint32(unsafe.Sizeof(int32(0))) * uint32(8)) - uint32(1)); ii++ {
 60154  			if (nRow & (int32(1) << ii)) != 0 {
 60155  				(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(ii)
 60156  			}
 60157  		}
 60158  	} else {
 60159  		(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = float64(nRow)
 60160  	}
 60161  	return *(*int32)(unsafe.Pointer(bp + 88 /* rc */))
 60162  }
 60163  
 60164  // The xUpdate method for echo module virtual tables.
 60165  //
 60166  //    apData[0]  apData[1]  apData[2..]
 60167  //
 60168  //    INTEGER                              DELETE
 60169  //
 60170  //    INTEGER    NULL       (nCol args)    UPDATE (do not set rowid)
 60171  //    INTEGER    INTEGER    (nCol args)    UPDATE (with SET rowid = <arg1>)
 60172  //
 60173  //    NULL       NULL       (nCol args)    INSERT INTO (automatic rowid value)
 60174  //    NULL       INTEGER    (nCol args)    INSERT (incl. rowid value)
 60175  //
 60176  func echoUpdate(tls *libc.TLS, tab uintptr, nData int32, apData uintptr, pRowid uintptr) int32 { /* test8.c:969:5: */
 60177  	bp := tls.Alloc(116)
 60178  	defer tls.Free(116)
 60179  
 60180  	var pVtab uintptr = tab
 60181  	var db uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Fdb
 60182  	*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = SQLITE_OK
 60183  
 60184  	*(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)) = uintptr(0)
 60185  	*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) = uintptr(0) // SQL statement to execute
 60186  	var bindArgZero int32 = 0                                 // True to bind apData[0] to sql var no. nData
 60187  	var bindArgOne int32 = 0                                  // True to bind apData[1] to sql var no. 1
 60188  	var i int32                                               // Counter variable used by for loops
 60189  
 60190  	// Ticket #3083 - make sure we always start a transaction prior to
 60191  	// making any changes to a virtual table
 60192  
 60193  	if simulateVtabError(tls, pVtab, ts+27955 /* "xUpdate" */) != 0 {
 60194  		return SQLITE_ERROR
 60195  	}
 60196  
 60197  	// If apData[0] is an integer and nData>1 then do an UPDATE
 60198  	if (nData > 1) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_INTEGER) {
 60199  		var zSep uintptr = ts + 27963 /* " SET" */
 60200  		*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) = sqlite3.Xsqlite3_mprintf(tls, ts+27968 /* "UPDATE %Q" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 60201  		if !(*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) != 0) {
 60202  			*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = SQLITE_NOMEM
 60203  		}
 60204  
 60205  		bindArgOne = (libc.Bool32((*(*uintptr)(unsafe.Pointer(apData + 1*4)) != 0) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData + 1*4))) == SQLITE_INTEGER)))
 60206  		bindArgZero = 1
 60207  
 60208  		if bindArgOne != 0 {
 60209  			string_concat(tls, bp+96 /* &z */, ts+27978 /* " SET rowid=?1 " */, 0, bp+100 /* &rc */)
 60210  			zSep = ts + 4619 /* "," */
 60211  		}
 60212  		for i = 2; i < nData; i++ {
 60213  			if *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*4)) == uintptr(0) {
 60214  				continue
 60215  			}
 60216  			string_concat(tls, bp+96 /* &z */, sqlite3.Xsqlite3_mprintf(tls,
 60217  				ts+27993 /* "%s %Q=?%d" */, libc.VaList(bp+8, zSep, *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr((i-2))*4)), i)), 1, bp+100 /* &rc */)
 60218  			zSep = ts + 4619 /* "," */
 60219  		}
 60220  		string_concat(tls, bp+96 /* &z */, sqlite3.Xsqlite3_mprintf(tls, ts+28003 /* " WHERE rowid=?%d" */, libc.VaList(bp+32, nData)), 1, bp+100 /* &rc */)
 60221  	} else if (nData == 1) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_INTEGER) {
 60222  		*(*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))
 60223  		if !(*(*uintptr)(unsafe.Pointer(bp + 96 /* z */)) != 0) {
 60224  			*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = SQLITE_NOMEM
 60225  		}
 60226  		bindArgZero = 1
 60227  	} else if (nData > 2) && (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData))) == SQLITE_NULL) {
 60228  		var ii int32
 60229  		*(*uintptr)(unsafe.Pointer(bp + 104 /* zInsert */)) = uintptr(0)
 60230  		*(*uintptr)(unsafe.Pointer(bp + 108 /* zValues */)) = uintptr(0)
 60231  
 60232  		*(*uintptr)(unsafe.Pointer(bp + 104 /* zInsert */)) = sqlite3.Xsqlite3_mprintf(tls, ts+28052 /* "INSERT INTO %Q (" */, libc.VaList(bp+48, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 60233  		if !(*(*uintptr)(unsafe.Pointer(bp + 104 /* zInsert */)) != 0) {
 60234  			*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = SQLITE_NOMEM
 60235  		}
 60236  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apData + 1*4))) == SQLITE_INTEGER {
 60237  			bindArgOne = 1
 60238  			*(*uintptr)(unsafe.Pointer(bp + 108 /* zValues */)) = sqlite3.Xsqlite3_mprintf(tls, ts+3266 /* "?" */, 0)
 60239  			string_concat(tls, bp+104 /* &zInsert */, ts+27850 /* "rowid" */, 0, bp+100 /* &rc */)
 60240  		}
 60241  
 60242  		for ii = 2; ii < nData; ii++ {
 60243  			string_concat(tls, bp+104, /* &zInsert */
 60244  				sqlite3.Xsqlite3_mprintf(tls, ts+28069 /* "%s%Q" */, libc.VaList(bp+56, func() uintptr {
 60245  					if *(*uintptr)(unsafe.Pointer(bp + 108 /* zValues */)) != 0 {
 60246  						return ts + 90 /* ", " */
 60247  					}
 60248  					return ts + 489 /* "" */
 60249  				}(), *(*uintptr)(unsafe.Pointer((*echo_vtab)(unsafe.Pointer(pVtab)).FaCol + uintptr((ii-2))*4)))), 1, bp+100 /* &rc */)
 60250  			string_concat(tls, bp+108, /* &zValues */
 60251  				sqlite3.Xsqlite3_mprintf(tls, ts+28074 /* "%s?%d" */, libc.VaList(bp+72, func() uintptr {
 60252  					if *(*uintptr)(unsafe.Pointer(bp + 108 /* zValues */)) != 0 {
 60253  						return ts + 90 /* ", " */
 60254  					}
 60255  					return ts + 489 /* "" */
 60256  				}(), ii)), 1, bp+100 /* &rc */)
 60257  		}
 60258  
 60259  		string_concat(tls, bp+96 /* &z */, *(*uintptr)(unsafe.Pointer(bp + 104 /* zInsert */)), 1, bp+100 /* &rc */)
 60260  		string_concat(tls, bp+96 /* &z */, ts+28080 /* ") VALUES(" */, 0, bp+100 /* &rc */)
 60261  		string_concat(tls, bp+96 /* &z */, *(*uintptr)(unsafe.Pointer(bp + 108 /* zValues */)), 1, bp+100 /* &rc */)
 60262  		string_concat(tls, bp+96 /* &z */, ts+490 /* ")" */, 0, bp+100 /* &rc */)
 60263  	} else {
 60264  
 60265  		return SQLITE_ERROR
 60266  	}
 60267  
 60268  	if *(*int32)(unsafe.Pointer(bp + 100 /* rc */)) == SQLITE_OK {
 60269  		*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = sqlite3.Xsqlite3_prepare(tls, db, *(*uintptr)(unsafe.Pointer(bp + 96 /* z */)), -1, bp+112 /* &pStmt */, uintptr(0))
 60270  	}
 60271  
 60272  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 96 /* z */)))
 60273  	if *(*int32)(unsafe.Pointer(bp + 100 /* rc */)) == SQLITE_OK {
 60274  		if bindArgZero != 0 {
 60275  			sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)), nData, *(*uintptr)(unsafe.Pointer(apData)))
 60276  		}
 60277  		if bindArgOne != 0 {
 60278  			sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)), 1, *(*uintptr)(unsafe.Pointer(apData + 1*4)))
 60279  		}
 60280  		for i = 2; (i < nData) && (*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) == SQLITE_OK); i++ {
 60281  			if *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*4)) != 0 {
 60282  				*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = sqlite3.Xsqlite3_bind_value(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)), i, *(*uintptr)(unsafe.Pointer(apData + uintptr(i)*4)))
 60283  			}
 60284  		}
 60285  		if *(*int32)(unsafe.Pointer(bp + 100 /* rc */)) == SQLITE_OK {
 60286  			sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)))
 60287  			*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)))
 60288  		} else {
 60289  			sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 112 /* pStmt */)))
 60290  		}
 60291  	}
 60292  
 60293  	if (pRowid != 0) && (*(*int32)(unsafe.Pointer(bp + 100 /* rc */)) == SQLITE_OK) {
 60294  		*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_last_insert_rowid(tls, db)
 60295  	}
 60296  	if *(*int32)(unsafe.Pointer(bp + 100 /* rc */)) != SQLITE_OK {
 60297  		(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+27463 /* "echo-vtab-error:..." */, libc.VaList(bp+88, sqlite3.Xsqlite3_errmsg(tls, db)))
 60298  	}
 60299  
 60300  	return *(*int32)(unsafe.Pointer(bp + 100 /* rc */))
 60301  }
 60302  
 60303  // xBegin, xSync, xCommit and xRollback callbacks for echo module
 60304  // virtual tables. Do nothing other than add the name of the callback
 60305  // to the $::echo_module Tcl variable.
 60306  func echoTransactionCall(tls *libc.TLS, tab uintptr, zCall uintptr) int32 { /* test8.c:1102:12: */
 60307  	bp := tls.Alloc(8)
 60308  	defer tls.Free(8)
 60309  
 60310  	var z uintptr
 60311  	var pVtab uintptr = tab
 60312  	z = sqlite3.Xsqlite3_mprintf(tls, ts+28090 /* "echo(%s)" */, libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName))
 60313  	if z == uintptr(0) {
 60314  		return SQLITE_NOMEM
 60315  	}
 60316  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, zCall)
 60317  	appendToEchoModule(tls, (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp, z)
 60318  	sqlite3.Xsqlite3_free(tls, z)
 60319  	return SQLITE_OK
 60320  }
 60321  
 60322  func echoBegin(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1112:12: */
 60323  	var rc int32
 60324  	var pVtab uintptr = tab
 60325  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 60326  	var zVal uintptr
 60327  
 60328  	// Ticket #3083 - do not start a transaction if we are already in
 60329  	// a transaction
 60330  
 60331  	if simulateVtabError(tls, pVtab, ts+28099 /* "xBegin" */) != 0 {
 60332  		return SQLITE_ERROR
 60333  	}
 60334  
 60335  	rc = echoTransactionCall(tls, tab, ts+28099 /* "xBegin" */)
 60336  
 60337  	if rc == SQLITE_OK {
 60338  		// Check if the $::echo_module_begin_fail variable is defined. If it is,
 60339  		// and it is set to the name of the real table underlying this virtual
 60340  		// echo module table, then cause this xSync operation to fail.
 60341  		zVal = tcl.XTcl_GetVar2(tls, interp, ts+28106 /* "echo_module_begi..." */, uintptr(0), TCL_GLOBAL_ONLY)
 60342  		if (zVal != 0) && (0 == libc.Xstrcmp(tls, zVal, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)) {
 60343  			rc = SQLITE_ERROR
 60344  		}
 60345  	}
 60346  	if rc == SQLITE_OK {
 60347  		(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 1
 60348  	}
 60349  	return rc
 60350  }
 60351  
 60352  func echoSync(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1143:12: */
 60353  	var rc int32
 60354  	var pVtab uintptr = tab
 60355  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 60356  	var zVal uintptr
 60357  
 60358  	// Ticket #3083 - Only call xSync if we have previously started a
 60359  	// transaction
 60360  
 60361  	if simulateVtabError(tls, pVtab, ts+28129 /* "xSync" */) != 0 {
 60362  		return SQLITE_ERROR
 60363  	}
 60364  
 60365  	rc = echoTransactionCall(tls, tab, ts+28129 /* "xSync" */)
 60366  
 60367  	if rc == SQLITE_OK {
 60368  		// Check if the $::echo_module_sync_fail variable is defined. If it is,
 60369  		// and it is set to the name of the real table underlying this virtual
 60370  		// echo module table, then cause this xSync operation to fail.
 60371  		zVal = tcl.XTcl_GetVar2(tls, interp, ts+28135 /* "echo_module_sync..." */, uintptr(0), TCL_GLOBAL_ONLY)
 60372  		if (zVal != 0) && (0 == libc.Xstrcmp(tls, zVal, (*echo_vtab)(unsafe.Pointer(pVtab)).FzTableName)) {
 60373  			rc = -1
 60374  		}
 60375  	}
 60376  	return rc
 60377  }
 60378  
 60379  func echoCommit(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1171:12: */
 60380  	var pVtab uintptr = tab
 60381  	var rc int32
 60382  
 60383  	// Ticket #3083 - Only call xCommit if we have previously started
 60384  	// a transaction
 60385  
 60386  	if simulateVtabError(tls, pVtab, ts+28157 /* "xCommit" */) != 0 {
 60387  		return SQLITE_ERROR
 60388  	}
 60389  
 60390  	sqlite3.Xsqlite3BeginBenignMalloc(tls)
 60391  	rc = echoTransactionCall(tls, tab, ts+28157 /* "xCommit" */)
 60392  	sqlite3.Xsqlite3EndBenignMalloc(tls)
 60393  	(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 0
 60394  	return rc
 60395  }
 60396  
 60397  func echoRollback(tls *libc.TLS, tab uintptr) int32 { /* test8.c:1189:12: */
 60398  	var rc int32
 60399  	var pVtab uintptr = tab
 60400  
 60401  	// Ticket #3083 - Only call xRollback if we have previously started
 60402  	// a transaction
 60403  
 60404  	rc = echoTransactionCall(tls, tab, ts+28165 /* "xRollback" */)
 60405  	(*echo_vtab)(unsafe.Pointer(pVtab)).FinTransaction = 0
 60406  	return rc
 60407  }
 60408  
 60409  // Implementation of "GLOB" function on the echo module.  Pass
 60410  // all arguments to the ::echo_glob_overload procedure of TCL
 60411  // and return the result of that procedure as a string.
 60412  func overloadedGlobFunction(tls *libc.TLS, pContext uintptr, nArg int32, apArg uintptr) { /* test8.c:1207:13: */
 60413  	bp := tls.Alloc(212)
 60414  	defer tls.Free(212)
 60415  
 60416  	var interp uintptr = sqlite3.Xsqlite3_user_data(tls, pContext)
 60417  	// var str Tcl_DString at bp, 212
 60418  
 60419  	var i int32
 60420  	var rc int32
 60421  	tcl.XTcl_DStringInit(tls, bp /* &str */)
 60422  	tcl.XTcl_DStringAppendElement(tls, bp /* &str */, ts+28175 /* "::echo_glob_over..." */)
 60423  	for i = 0; i < nArg; i++ {
 60424  		tcl.XTcl_DStringAppendElement(tls, bp /* &str */, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*4))))
 60425  	}
 60426  	rc = tcl.XTcl_Eval(tls, interp, (*Tcl_DString)(unsafe.Pointer(bp /* &str */)).Fstring)
 60427  	tcl.XTcl_DStringFree(tls, bp /* &str */)
 60428  	if rc != 0 {
 60429  		sqlite3.Xsqlite3_result_error(tls, pContext, tcl.XTcl_GetStringResult(tls, interp), -1)
 60430  	} else {
 60431  		sqlite3.Xsqlite3_result_text(tls, pContext, tcl.XTcl_GetStringResult(tls, interp),
 60432  			-1, libc.UintptrFromInt32(-1))
 60433  	}
 60434  	tcl.XTcl_ResetResult(tls, interp)
 60435  }
 60436  
 60437  // This is the xFindFunction implementation for the echo module.
 60438  // SQLite calls this routine when the first argument of a function
 60439  // is a column of an echo virtual table.  This routine can optionally
 60440  // override the implementation of that function.  It will choose to
 60441  // do so if the function is named "glob", and a TCL command named
 60442  // ::echo_glob_overload exists.
 60443  func echoFindFunction(tls *libc.TLS, vtab uintptr, nArg int32, zFuncName uintptr, pxFunc uintptr, ppArg uintptr) int32 { /* test8.c:1240:12: */
 60444  	bp := tls.Alloc(32)
 60445  	defer tls.Free(32)
 60446  
 60447  	var pVtab uintptr = vtab
 60448  	var interp uintptr = (*echo_vtab)(unsafe.Pointer(pVtab)).Finterp
 60449  	// var info Tcl_CmdInfo at bp, 32
 60450  
 60451  	if libc.Xstrcmp(tls, zFuncName, ts+27878 /* "glob" */) != 0 {
 60452  		return 0
 60453  	}
 60454  	if tcl.XTcl_GetCommandInfo(tls, interp, ts+28175 /* "::echo_glob_over..." */, bp /* &info */) == 0 {
 60455  		return 0
 60456  	}
 60457  	*(*uintptr)(unsafe.Pointer(pxFunc)) = *(*uintptr)(unsafe.Pointer(&struct {
 60458  		f func(*libc.TLS, uintptr, int32, uintptr)
 60459  	}{overloadedGlobFunction}))
 60460  	*(*uintptr)(unsafe.Pointer(ppArg)) = interp
 60461  	return 1
 60462  }
 60463  
 60464  func echoRename(tls *libc.TLS, vtab uintptr, zNewName uintptr) int32 { /* test8.c:1261:12: */
 60465  	bp := tls.Alloc(24)
 60466  	defer tls.Free(24)
 60467  
 60468  	var rc int32 = SQLITE_OK
 60469  	var p uintptr = vtab
 60470  
 60471  	if simulateVtabError(tls, p, ts+28196 /* "xRename" */) != 0 {
 60472  		return SQLITE_ERROR
 60473  	}
 60474  
 60475  	if (*echo_vtab)(unsafe.Pointer(p)).FisPattern != 0 {
 60476  		var nThis int32 = int32(libc.Xstrlen(tls, (*echo_vtab)(unsafe.Pointer(p)).FzThis))
 60477  		var zSql uintptr = sqlite3.Xsqlite3_mprintf(tls, ts+28204, /* "ALTER TABLE %s R..." */
 60478  			libc.VaList(bp, (*echo_vtab)(unsafe.Pointer(p)).FzTableName, zNewName, ((*echo_vtab)(unsafe.Pointer(p)).FzTableName+uintptr(nThis))))
 60479  		rc = sqlite3.Xsqlite3_exec(tls, (*echo_vtab)(unsafe.Pointer(p)).Fdb, zSql, uintptr(0), uintptr(0), uintptr(0))
 60480  		sqlite3.Xsqlite3_free(tls, zSql)
 60481  	}
 60482  
 60483  	return rc
 60484  }
 60485  
 60486  func echoSavepoint(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1281:12: */
 60487  
 60488  	return SQLITE_OK
 60489  }
 60490  
 60491  func echoRelease(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1286:12: */
 60492  
 60493  	return SQLITE_OK
 60494  }
 60495  
 60496  func echoRollbackTo(tls *libc.TLS, pVTab uintptr, iSavepoint int32) int32 { /* test8.c:1291:12: */
 60497  
 60498  	return SQLITE_OK
 60499  }
 60500  
 60501  // A virtual table module that merely "echos" the contents of another
 60502  // table (like an SQL VIEW).
 60503  var echoModule = sqlite3_module{
 60504  	FiVersion:      1, // iVersion
 60505  	FxCreate:       0,
 60506  	FxConnect:      0,
 60507  	FxBestIndex:    0,
 60508  	FxDisconnect:   0,
 60509  	FxDestroy:      0,
 60510  	FxOpen:         0, // xOpen - open a cursor
 60511  	FxClose:        0, // xClose - close a cursor
 60512  	FxFilter:       0, // xFilter - configure scan constraints
 60513  	FxNext:         0, // xNext - advance a cursor
 60514  	FxEof:          0, // xEof
 60515  	FxColumn:       0, // xColumn - read data
 60516  	FxRowid:        0, // xRowid - read data
 60517  	FxUpdate:       0, // xUpdate - write data
 60518  	FxBegin:        0, // xBegin - begin transaction
 60519  	FxSync:         0, // xSync - sync transaction
 60520  	FxCommit:       0, // xCommit - commit transaction
 60521  	FxRollback:     0, // xRollback - rollback transaction
 60522  	FxFindFunction: 0, // xFindFunction - function overloading
 60523  	FxRename:       0, // xRename - rename the table
 60524  } /* test8.c:1300:23 */
 60525  
 60526  var echoModuleV2 = sqlite3_module{
 60527  	FiVersion:      2, // iVersion
 60528  	FxCreate:       0,
 60529  	FxConnect:      0,
 60530  	FxBestIndex:    0,
 60531  	FxDisconnect:   0,
 60532  	FxDestroy:      0,
 60533  	FxOpen:         0, // xOpen - open a cursor
 60534  	FxClose:        0, // xClose - close a cursor
 60535  	FxFilter:       0, // xFilter - configure scan constraints
 60536  	FxNext:         0, // xNext - advance a cursor
 60537  	FxEof:          0, // xEof
 60538  	FxColumn:       0, // xColumn - read data
 60539  	FxRowid:        0, // xRowid - read data
 60540  	FxUpdate:       0, // xUpdate - write data
 60541  	FxBegin:        0, // xBegin - begin transaction
 60542  	FxSync:         0, // xSync - sync transaction
 60543  	FxCommit:       0, // xCommit - commit transaction
 60544  	FxRollback:     0, // xRollback - rollback transaction
 60545  	FxFindFunction: 0, // xFindFunction - function overloading
 60546  	FxRename:       0, // xRename - rename the table
 60547  	FxSavepoint:    0,
 60548  	FxRelease:      0,
 60549  	FxRollbackTo:   0,
 60550  } /* test8.c:1323:23 */
 60551  
 60552  func moduleDestroy(tls *libc.TLS, p uintptr) { /* test8.c:1355:13: */
 60553  	var pMod uintptr = p
 60554  	sqlite3.Xsqlite3_create_function(tls, (*EchoModule)(unsafe.Pointer(pMod)).Fdb, ts+28234, /* "function_that_do..." */
 60555  		SQLITE_ANY, 1, uintptr(0), uintptr(0), uintptr(0), uintptr(0))
 60556  	sqlite3.Xsqlite3_free(tls, p)
 60557  }
 60558  
 60559  // Register the echo virtual table module.
 60560  func register_echo_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test8.c:1365:26: */
 60561  	bp := tls.Alloc(4)
 60562  	defer tls.Free(4)
 60563  
 60564  	var rc int32
 60565  	// var db uintptr at bp, 4
 60566  
 60567  	var pMod uintptr
 60568  	if objc != 2 {
 60569  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 60570  		return TCL_ERROR
 60571  	}
 60572  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 60573  		return TCL_ERROR
 60574  	}
 60575  
 60576  	// Virtual table module "echo"
 60577  	pMod = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(EchoModule{})))
 60578  	(*EchoModule)(unsafe.Pointer(pMod)).Finterp = interp
 60579  	(*EchoModule)(unsafe.Pointer(pMod)).Fdb = *(*uintptr)(unsafe.Pointer(bp /* db */))
 60580  	rc = sqlite3.Xsqlite3_create_module_v2(tls,
 60581  		*(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28272 /* "echo" */, uintptr(unsafe.Pointer(&echoModule)), pMod, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{moduleDestroy})))
 60582  
 60583  	// Virtual table module "echo_v2"
 60584  	if rc == SQLITE_OK {
 60585  		pMod = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(EchoModule{})))
 60586  		(*EchoModule)(unsafe.Pointer(pMod)).Finterp = interp
 60587  		(*EchoModule)(unsafe.Pointer(pMod)).Fdb = *(*uintptr)(unsafe.Pointer(bp /* db */))
 60588  		rc = sqlite3.Xsqlite3_create_module_v2(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28277, /* "echo_v2" */
 60589  			uintptr(unsafe.Pointer(&echoModuleV2)), pMod, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{moduleDestroy})))
 60590  	}
 60591  
 60592  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 60593  	return TCL_OK
 60594  }
 60595  
 60596  // Tcl interface to sqlite3_declare_vtab, invoked as follows from Tcl:
 60597  //
 60598  // sqlite3_declare_vtab DB SQL
 60599  func declare_vtab(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test8.c:1407:26: */
 60600  	bp := tls.Alloc(4)
 60601  	defer tls.Free(4)
 60602  
 60603  	// var db uintptr at bp, 4
 60604  
 60605  	var rc int32
 60606  	if objc != 3 {
 60607  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10524 /* "DB SQL" */)
 60608  		return TCL_ERROR
 60609  	}
 60610  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 60611  		return TCL_ERROR
 60612  	}
 60613  	rc = sqlite3.Xsqlite3_declare_vtab(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))))
 60614  	if rc != SQLITE_OK {
 60615  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp /* db */))), uintptr(1))
 60616  		return TCL_ERROR
 60617  	}
 60618  	return TCL_OK
 60619  }
 60620  
 60621  // Register commands with the TCL interpreter.
 60622  func Sqlitetest8_Init(tls *libc.TLS, interp uintptr) int32 { /* test8.c:1433:5: */
 60623  	var i int32
 60624  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd2)) / uint32(unsafe.Sizeof(struct {
 60625  		FzName      uintptr
 60626  		FxProc      uintptr
 60627  		FclientData uintptr
 60628  	}{}))); i++ {
 60629  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd2[i].FzName,
 60630  			aObjCmd2[i].FxProc, aObjCmd2[i].FclientData, uintptr(0))
 60631  	}
 60632  	return TCL_OK
 60633  }
 60634  
 60635  var aObjCmd2 = [2]struct {
 60636  	FzName      uintptr
 60637  	FxProc      uintptr
 60638  	FclientData uintptr
 60639  }{
 60640  	{FzName: ts + 28285 /* "register_echo_mo..." */, FxProc: 0},
 60641  	{FzName: ts + 28306 /* "sqlite3_declare_..." */, FxProc: 0},
 60642  } /* test8.c:1439:5 */
 60643  
 60644  // end block for C++
 60645  
 60646  // Local Variables:
 60647  // mode: c
 60648  // c-basic-offset: 4
 60649  // fill-column: 78
 60650  // End:
 60651  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 60652  //    This file is part of the GNU C Library.
 60653  //
 60654  //    The GNU C Library is free software; you can redistribute it and/or
 60655  //    modify it under the terms of the GNU Lesser General Public
 60656  //    License as published by the Free Software Foundation; either
 60657  //    version 2.1 of the License, or (at your option) any later version.
 60658  //
 60659  //    The GNU C Library is distributed in the hope that it will be useful,
 60660  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 60661  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 60662  //    Lesser General Public License for more details.
 60663  //
 60664  //    You should have received a copy of the GNU Lesser General Public
 60665  //    License along with the GNU C Library; if not, see
 60666  //    <http://www.gnu.org/licenses/>.
 60667  
 60668  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 60669  
 60670  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 60671  //    This file is part of the GNU C Library.
 60672  //
 60673  //    The GNU C Library is free software; you can redistribute it and/or
 60674  //    modify it under the terms of the GNU Lesser General Public
 60675  //    License as published by the Free Software Foundation; either
 60676  //    version 2.1 of the License, or (at your option) any later version.
 60677  //
 60678  //    The GNU C Library is distributed in the hope that it will be useful,
 60679  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 60680  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 60681  //    Lesser General Public License for more details.
 60682  //
 60683  //    You should have received a copy of the GNU Lesser General Public
 60684  //    License along with the GNU C Library; if not, see
 60685  //    <http://www.gnu.org/licenses/>.
 60686  
 60687  //	ISO C99 Standard: 7.21 String handling	<string.h>
 60688  
 60689  // c_collation_test
 60690  func c_collation_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:29:26: */
 60691  	bp := tls.Alloc(28)
 60692  	defer tls.Free(28)
 60693  
 60694  	var zErrFunction uintptr
 60695  	// var db uintptr at bp+24, 4
 60696  
 60697  	var rc int32
 60698  	zErrFunction = ts + 28327 /* "N/A" */
 60699  	if !(objc != 1) {
 60700  		goto __1
 60701  	}
 60702  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 60703  	return TCL_ERROR
 60704  __1:
 60705  	;
 60706  
 60707  	// Open a database.
 60708  	rc = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, bp+24 /* &db */)
 60709  	if !(rc != SQLITE_OK) {
 60710  		goto __2
 60711  	}
 60712  	zErrFunction = ts + 21765 /* "sqlite3_open" */
 60713  	goto error_out
 60714  __2:
 60715  	;
 60716  
 60717  	rc = sqlite3.Xsqlite3_create_collation(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), ts+13875 /* "collate" */, 456, uintptr(0), uintptr(0))
 60718  	if !(rc != SQLITE_MISUSE) {
 60719  		goto __3
 60720  	}
 60721  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 60722  	zErrFunction = ts + 28331 /* "sqlite3_create_c..." */
 60723  	goto error_out
 60724  __3:
 60725  	;
 60726  
 60727  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 60728  	return TCL_OK
 60729  
 60730  error_out:
 60731  	tcl.XTcl_ResetResult(tls, interp)
 60732  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 60733  	return TCL_ERROR
 60734  }
 60735  
 60736  // c_realloc_test
 60737  func c_realloc_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:70:26: */
 60738  	bp := tls.Alloc(24)
 60739  	defer tls.Free(24)
 60740  
 60741  	var p uintptr
 60742  	var zErrFunction uintptr
 60743  	zErrFunction = ts + 28327 /* "N/A" */
 60744  
 60745  	if !(objc != 1) {
 60746  		goto __1
 60747  	}
 60748  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 60749  	return TCL_ERROR
 60750  __1:
 60751  	;
 60752  
 60753  	p = sqlite3.Xsqlite3_malloc(tls, 5)
 60754  	if !(!(p != 0)) {
 60755  		goto __2
 60756  	}
 60757  	zErrFunction = ts + 28381 /* "sqlite3_malloc" */
 60758  	goto error_out
 60759  __2:
 60760  	;
 60761  
 60762  	// Test that realloc()ing a block of memory to a negative size is
 60763  	// the same as free()ing that memory.
 60764  	p = sqlite3.Xsqlite3_realloc(tls, p, -1)
 60765  	if !(p != 0) {
 60766  		goto __3
 60767  	}
 60768  	zErrFunction = ts + 28396 /* "sqlite3_realloc" */
 60769  	goto error_out
 60770  __3:
 60771  	;
 60772  
 60773  	return TCL_OK
 60774  
 60775  error_out:
 60776  	tcl.XTcl_ResetResult(tls, interp)
 60777  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 60778  	return TCL_ERROR
 60779  }
 60780  
 60781  // c_misuse_test
 60782  func c_misuse_test(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test9.c:111:26: */
 60783  	bp := tls.Alloc(32)
 60784  	defer tls.Free(32)
 60785  
 60786  	var zErrFunction uintptr
 60787  	// var db uintptr at bp+24, 4
 60788  
 60789  	// var pStmt uintptr at bp+28, 4
 60790  
 60791  	var rc int32
 60792  	zErrFunction = ts + 28327 /* "N/A" */
 60793  	*(*uintptr)(unsafe.Pointer(bp + 24 /* db */)) = uintptr(0)
 60794  
 60795  	if !(objc != 1) {
 60796  		goto __1
 60797  	}
 60798  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 60799  	return TCL_ERROR
 60800  __1:
 60801  	;
 60802  
 60803  	// Open a database. Then close it again. We need to do this so that
 60804  	// we have a "closed database handle" to pass to various API functions.
 60805  	rc = sqlite3.Xsqlite3_open(tls, ts+1662 /* ":memory:" */, bp+24 /* &db */)
 60806  	if !(rc != SQLITE_OK) {
 60807  		goto __2
 60808  	}
 60809  	zErrFunction = ts + 21765 /* "sqlite3_open" */
 60810  	goto error_out
 60811  __2:
 60812  	;
 60813  	sqlite3.Xsqlite3_close(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 60814  
 60815  	rc = sqlite3.Xsqlite3_errcode(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)))
 60816  	if !(rc != SQLITE_MISUSE) {
 60817  		goto __3
 60818  	}
 60819  	zErrFunction = ts + 21692 /* "sqlite3_errcode" */
 60820  	goto error_out
 60821  __3:
 60822  	;
 60823  
 60824  	*(*uintptr)(unsafe.Pointer(bp + 28 /* pStmt */)) = uintptr(1234)
 60825  	rc = sqlite3.Xsqlite3_prepare(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+28 /* &pStmt */, uintptr(0))
 60826  	if !(rc != SQLITE_MISUSE) {
 60827  		goto __4
 60828  	}
 60829  	zErrFunction = ts + 21846 /* "sqlite3_prepare" */
 60830  	goto error_out
 60831  __4:
 60832  	;
 60833  	// Verify that pStmt is zeroed even on a MISUSE error
 60834  
 60835  	*(*uintptr)(unsafe.Pointer(bp + 28 /* pStmt */)) = uintptr(1234)
 60836  	rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+28 /* &pStmt */, uintptr(0))
 60837  	if !(rc != SQLITE_MISUSE) {
 60838  		goto __5
 60839  	}
 60840  	zErrFunction = ts + 21880 /* "sqlite3_prepare_..." */
 60841  	goto error_out
 60842  __5:
 60843  	;
 60844  
 60845  	*(*uintptr)(unsafe.Pointer(bp + 28 /* pStmt */)) = uintptr(1234)
 60846  	rc = sqlite3.Xsqlite3_prepare16(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+28 /* &pStmt */, uintptr(0))
 60847  	if !(rc != SQLITE_MISUSE) {
 60848  		goto __6
 60849  	}
 60850  	zErrFunction = ts + 21862 /* "sqlite3_prepare1..." */
 60851  	goto error_out
 60852  __6:
 60853  	;
 60854  
 60855  	*(*uintptr)(unsafe.Pointer(bp + 28 /* pStmt */)) = uintptr(1234)
 60856  	rc = sqlite3.Xsqlite3_prepare16_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* db */)), uintptr(0), 0, bp+28 /* &pStmt */, uintptr(0))
 60857  	if !(rc != SQLITE_MISUSE) {
 60858  		goto __7
 60859  	}
 60860  	zErrFunction = ts + 21942 /* "sqlite3_prepare1..." */
 60861  	goto error_out
 60862  __7:
 60863  	;
 60864  
 60865  	return TCL_OK
 60866  
 60867  error_out:
 60868  	tcl.XTcl_ResetResult(tls, interp)
 60869  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28356 /* "Error testing fu..." */, zErrFunction, 0))
 60870  	return TCL_ERROR
 60871  }
 60872  
 60873  // Register commands with the TCL interpreter.
 60874  func Sqlitetest9_Init(tls *libc.TLS, interp uintptr) int32 { /* test9.c:188:5: */
 60875  	var i int32
 60876  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd3)) / uint32(unsafe.Sizeof(struct {
 60877  		FzName      uintptr
 60878  		FxProc      uintptr
 60879  		FclientData uintptr
 60880  	}{}))); i++ {
 60881  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd3[i].FzName,
 60882  			aObjCmd3[i].FxProc, aObjCmd3[i].FclientData, uintptr(0))
 60883  	}
 60884  	return TCL_OK
 60885  }
 60886  
 60887  var aObjCmd3 = [3]struct {
 60888  	FzName      uintptr
 60889  	FxProc      uintptr
 60890  	FclientData uintptr
 60891  }{
 60892  	{FzName: ts + 28412 /* "c_misuse_test" */, FxProc: 0},
 60893  	{FzName: ts + 28426 /* "c_realloc_test" */, FxProc: 0},
 60894  	{FzName: ts + 28441 /* "c_collation_test" */, FxProc: 0},
 60895  } /* test9.c:193:5 */
 60896  
 60897  // end block for C++
 60898  
 60899  // Local Variables:
 60900  // mode: c
 60901  // c-basic-offset: 4
 60902  // fill-column: 78
 60903  // End:
 60904  
 60905  // This routine registers the custom TCL commands defined in this
 60906  // module.  This should be the only procedure visible from outside
 60907  // of this module.
 60908  func Sqlitetestasync_Init(tls *libc.TLS, interp uintptr) int32 { /* test_async.c:238:5: */
 60909  	return TCL_OK
 60910  }
 60911  
 60912  // The following macros redefine the API routines so that they are
 60913  // redirected through the global sqlite3_api structure.
 60914  //
 60915  // This header file is also used by the loadext.c source file
 60916  // (part of the main SQLite library - not an extension) so that
 60917  // it can get access to the sqlite3_api_routines structure
 60918  // definition.  But the main library does not want to redefine
 60919  // the API.  So the redefinition macros are only valid if the
 60920  // SQLITE_CORE macros is undefined.
 60921  
 60922  // This case when the file is being statically linked into the
 60923  // application
 60924  
 60925  // tclcmd:   sqlite3_reset_auto_extension
 60926  //
 60927  // Reset all auto-extensions
 60928  func resetAutoExtObjCmd(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_autoext.c:196:26: */
 60929  	sqlite3.Xsqlite3_reset_auto_extension(tls)
 60930  	return SQLITE_OK
 60931  }
 60932  
 60933  // This procedure registers the TCL procs defined in this file.
 60934  func Sqlitetest_autoext_Init(tls *libc.TLS, interp uintptr) int32 { /* test_autoext.c:210:5: */
 60935  	tcl.XTcl_CreateObjCommand(tls, interp, ts+28458, /* "sqlite3_reset_au..." */
 60936  		*(*uintptr)(unsafe.Pointer(&struct {
 60937  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 60938  		}{resetAutoExtObjCmd})), uintptr(0), uintptr(0))
 60939  	return TCL_OK
 60940  }
 60941  
 60942  func backupTestCmd(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_backup.c:33:26: */
 60943  	bp := tls.Alloc(120)
 60944  	defer tls.Free(120)
 60945  
 60946  	*(*[5]BackupSubCommand)(unsafe.Pointer(bp /* aSub */)) = [5]BackupSubCommand{
 60947  		{FzCmd: ts + 10120 /* "step" */, FnArg: 1, FzArg: ts + 28487 /* "npage" */},
 60948  		{FzCmd: ts + 28493 /* "finish" */, FeCmd: uint32(1) /* BACKUP_FINISH */, FzArg: ts + 489 /* "" */},
 60949  		{FzCmd: ts + 28500 /* "remaining" */, FeCmd: uint32(2) /* BACKUP_REMAINING */, FzArg: ts + 489 /* "" */},
 60950  		{FzCmd: ts + 28510 /* "pagecount" */, FeCmd: uint32(3) /* BACKUP_PAGECOUNT */, FzArg: ts + 489 /* "" */},
 60951  		{},
 60952  	}
 60953  
 60954  	var p uintptr = clientData
 60955  	// var iCmd int32 at bp+80, 4
 60956  
 60957  	var rc int32
 60958  
 60959  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 60960  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &aSub[0] */, int32(unsafe.Sizeof(BackupSubCommand{})), ts+12161 /* "option" */, 0, bp+80 /* &iCmd */)
 60961  	if rc != TCL_OK {
 60962  		return rc
 60963  	}
 60964  	if objc != (2 + (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* iCmd */)))*16)).FnArg) {
 60965  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* iCmd */)))*16)).FzArg)
 60966  		return TCL_ERROR
 60967  	}
 60968  
 60969  	switch (*BackupSubCommand)(unsafe.Pointer(bp /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* iCmd */)))*16)).FeCmd {
 60970  
 60971  	case uint32(1) /* BACKUP_FINISH */ :
 60972  		{
 60973  			var zCmdName uintptr
 60974  			// var cmdInfo Tcl_CmdInfo at bp+84, 32
 60975  
 60976  			zCmdName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv)))
 60977  			tcl.XTcl_GetCommandInfo(tls, interp, zCmdName, bp+84 /* &cmdInfo */)
 60978  			(*Tcl_CmdInfo)(unsafe.Pointer(bp + 84 /* &cmdInfo */)).FdeleteProc = uintptr(0)
 60979  			tcl.XTcl_SetCommandInfo(tls, interp, zCmdName, bp+84 /* &cmdInfo */)
 60980  			tcl.XTcl_DeleteCommand(tls, interp, zCmdName)
 60981  
 60982  			rc = sqlite3.Xsqlite3_backup_finish(tls, p)
 60983  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 60984  			break
 60985  
 60986  		}
 60987  
 60988  	case uint32(0) /* BACKUP_STEP */ :
 60989  		{
 60990  			// var nPage int32 at bp+116, 4
 60991  
 60992  			if TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+116 /* &nPage */) {
 60993  				return TCL_ERROR
 60994  			}
 60995  			rc = sqlite3.Xsqlite3_backup_step(tls, p, *(*int32)(unsafe.Pointer(bp + 116 /* nPage */)))
 60996  			tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 60997  			break
 60998  
 60999  		}
 61000  
 61001  	case uint32(2) /* BACKUP_REMAINING */ :
 61002  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_backup_remaining(tls, p)))
 61003  		break
 61004  
 61005  	case uint32(3) /* BACKUP_PAGECOUNT */ :
 61006  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_backup_pagecount(tls, p)))
 61007  		break
 61008  	}
 61009  
 61010  	return TCL_OK
 61011  }
 61012  
 61013  type BackupSubCommand = struct {
 61014  	FzCmd uintptr
 61015  	FeCmd uint32
 61016  	FnArg int32
 61017  	FzArg uintptr
 61018  } /* test_backup.c:42:3 */
 61019  
 61020  func backupTestFinish(tls *libc.TLS, clientData ClientData) { /* test_backup.c:108:27: */
 61021  	var pBackup uintptr = clientData
 61022  	sqlite3.Xsqlite3_backup_finish(tls, pBackup)
 61023  }
 61024  
 61025  //     sqlite3_backup CMDNAME DESTHANDLE DESTNAME SRCHANDLE SRCNAME
 61026  //
 61027  func backupTestInit(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_backup.c:117:26: */
 61028  	bp := tls.Alloc(24)
 61029  	defer tls.Free(24)
 61030  
 61031  	var pBackup uintptr
 61032  	// var pDestDb uintptr at bp+16, 4
 61033  
 61034  	// var pSrcDb uintptr at bp+20, 4
 61035  
 61036  	var zDestName uintptr
 61037  	var zSrcName uintptr
 61038  	var zCmd uintptr
 61039  
 61040  	if objc != 6 {
 61041  		tcl.XTcl_WrongNumArgs(tls,
 61042  			interp, 1, objv, ts+28520 /* "CMDNAME DESTHAND..." */)
 61043  		return TCL_ERROR
 61044  	}
 61045  
 61046  	zCmd = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 61047  	getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), bp+16 /* &pDestDb */)
 61048  	zDestName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 61049  	getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4))), bp+20 /* &pSrcDb */)
 61050  	zSrcName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 5*4)))
 61051  
 61052  	pBackup = sqlite3.Xsqlite3_backup_init(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pDestDb */)), zDestName, *(*uintptr)(unsafe.Pointer(bp + 20 /* pSrcDb */)), zSrcName)
 61053  	if !(pBackup != 0) {
 61054  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28566 /* "sqlite3_backup_i..." */, 0))
 61055  		return TCL_ERROR
 61056  	}
 61057  
 61058  	tcl.XTcl_CreateObjCommand(tls, interp, zCmd, *(*uintptr)(unsafe.Pointer(&struct {
 61059  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 61060  	}{backupTestCmd})), pBackup, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{backupTestFinish})))
 61061  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 61062  	return TCL_OK
 61063  }
 61064  
 61065  func Sqlitetestbackup_Init(tls *libc.TLS, interp uintptr) int32 { /* test_backup.c:154:5: */
 61066  	tcl.XTcl_CreateObjCommand(tls, interp, ts+28595 /* "sqlite3_backup" */, *(*uintptr)(unsafe.Pointer(&struct {
 61067  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 61068  	}{backupTestInit})), uintptr(0), uintptr(0))
 61069  	return TCL_OK
 61070  }
 61071  
 61072  // end block for C++
 61073  
 61074  // Local Variables:
 61075  // mode: c
 61076  // c-basic-offset: 4
 61077  // fill-column: 78
 61078  // End:
 61079  
 61080  type tcl_vtab1 = struct {
 61081  	Fbase   sqlite3_vtab
 61082  	Finterp uintptr
 61083  	FpCmd   uintptr
 61084  	Fdb     uintptr
 61085  } /* test_bestindex.c:104:9 */
 61086  
 61087  // end block for C++
 61088  
 61089  // Local Variables:
 61090  // mode: c
 61091  // c-basic-offset: 4
 61092  // fill-column: 78
 61093  // End:
 61094  
 61095  type tcl_vtab = tcl_vtab1 /* test_bestindex.c:104:25 */
 61096  type tcl_cursor1 = struct {
 61097  	Fbase  sqlite3_vtab_cursor
 61098  	FpStmt uintptr
 61099  } /* test_bestindex.c:105:9 */
 61100  
 61101  type tcl_cursor = tcl_cursor1 /* test_bestindex.c:105:27 */
 61102  
 61103  // Dequote string z in place.
 61104  func tclDequote(tls *libc.TLS, z uintptr) { /* test_bestindex.c:126:13: */
 61105  	var q int8 = *(*int8)(unsafe.Pointer(z))
 61106  
 61107  	// Set stack variable q to the close-quote character
 61108  	if (((int32(q) == '[') || (int32(q) == '\'')) || (int32(q) == '"')) || (int32(q) == '`') {
 61109  		var iIn int32 = 1
 61110  		var iOut int32 = 0
 61111  		if int32(q) == '[' {
 61112  			q = int8(']')
 61113  		}
 61114  
 61115  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 61116  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(q) {
 61117  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(q) {
 61118  					// Character iIn was the close quote.
 61119  					iIn++
 61120  					break
 61121  				} else {
 61122  					// Character iIn and iIn+1 form an escaped quote character. Skip
 61123  					// the input cursor past both and copy a single quote character
 61124  					// to the output buffer.
 61125  					iIn = iIn + (2)
 61126  					*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = q
 61127  				}
 61128  			} else {
 61129  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 61130  			}
 61131  		}
 61132  
 61133  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 61134  	}
 61135  }
 61136  
 61137  // This function is the implementation of both the xConnect and xCreate
 61138  // methods of the fs virtual table.
 61139  //
 61140  // The argv[] array contains the following:
 61141  //
 61142  //   argv[0]   -> module name  ("fs")
 61143  //   argv[1]   -> database name
 61144  //   argv[2]   -> table name
 61145  //   argv[...] -> other module argument fields.
 61146  func tclConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_bestindex.c:168:12: */
 61147  	bp := tls.Alloc(8)
 61148  	defer tls.Free(8)
 61149  
 61150  	var interp uintptr = pAux
 61151  	var pTab uintptr = uintptr(0)
 61152  	var zCmd uintptr = uintptr(0)
 61153  	var pScript uintptr = uintptr(0)
 61154  	var rc int32 = SQLITE_OK
 61155  
 61156  	if argc != 4 {
 61157  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 61158  		return SQLITE_ERROR
 61159  	}
 61160  
 61161  	zCmd = sqlite3.Xsqlite3_malloc64(tls, (uint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))) + size_t(1))))
 61162  	pTab = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(tcl_vtab{})))
 61163  	if (zCmd != 0) && (pTab != 0) {
 61164  		libc.Xmemcpy(tls, zCmd, *(*uintptr)(unsafe.Pointer(argv + 3*4)), (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4))) + size_t(1)))
 61165  		tclDequote(tls, zCmd)
 61166  		libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(tcl_vtab{})))
 61167  
 61168  		(*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd = tcl.XTcl_NewStringObj(tls, zCmd, -1)
 61169  		(*tcl_vtab)(unsafe.Pointer(pTab)).Finterp = interp
 61170  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fdb = db
 61171  		(*Tcl_Obj)(unsafe.Pointer((*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)).FrefCount++
 61172  
 61173  		pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 61174  		(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 61175  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27657 /* "xConnect" */, -1))
 61176  
 61177  		rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 61178  		if rc != TCL_OK {
 61179  			*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, tcl.XTcl_GetStringResult(tls, interp)))
 61180  			rc = SQLITE_ERROR
 61181  		} else {
 61182  			rc = sqlite3.Xsqlite3_declare_vtab(tls, db, tcl.XTcl_GetStringResult(tls, interp))
 61183  		}
 61184  
 61185  		if rc != SQLITE_OK {
 61186  			sqlite3.Xsqlite3_free(tls, pTab)
 61187  			pTab = uintptr(0)
 61188  		}
 61189  	} else {
 61190  		rc = SQLITE_NOMEM
 61191  	}
 61192  
 61193  	sqlite3.Xsqlite3_free(tls, zCmd)
 61194  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 61195  	return rc
 61196  }
 61197  
 61198  // The xDisconnect and xDestroy methods are also the same
 61199  func tclDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_bestindex.c:224:12: */
 61200  	var pTab uintptr = pVtab
 61201  	for ok := true; ok; ok = 0 != 0 {
 61202  		var _objPtr uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd
 61203  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61204  			tcl.XTclFreeObj(tls, _objPtr)
 61205  		}
 61206  	}
 61207  	sqlite3.Xsqlite3_free(tls, pTab)
 61208  	return SQLITE_OK
 61209  }
 61210  
 61211  // Open a new tcl cursor.
 61212  func tclOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_bestindex.c:234:12: */
 61213  	var pCur uintptr
 61214  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(tcl_cursor{})))
 61215  	if pCur == uintptr(0) {
 61216  		return SQLITE_NOMEM
 61217  	}
 61218  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(tcl_cursor{})))
 61219  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 61220  	return SQLITE_OK
 61221  }
 61222  
 61223  // Close a tcl cursor.
 61224  func tclClose(tls *libc.TLS, cur uintptr) int32 { /* test_bestindex.c:246:12: */
 61225  	var pCur uintptr = cur
 61226  	if pCur != 0 {
 61227  		sqlite3.Xsqlite3_finalize(tls, (*tcl_cursor)(unsafe.Pointer(pCur)).FpStmt)
 61228  		sqlite3.Xsqlite3_free(tls, pCur)
 61229  	}
 61230  	return SQLITE_OK
 61231  }
 61232  
 61233  func tclNext(tls *libc.TLS, pVtabCursor uintptr) int32 { /* test_bestindex.c:255:12: */
 61234  	bp := tls.Alloc(8)
 61235  	defer tls.Free(8)
 61236  
 61237  	var pCsr uintptr = pVtabCursor
 61238  	if (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt != 0 {
 61239  		var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 61240  		var rc int32 = sqlite3.Xsqlite3_step(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt)
 61241  		if rc != SQLITE_ROW {
 61242  			var zErr uintptr
 61243  			rc = sqlite3.Xsqlite3_finalize(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt)
 61244  			(*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 61245  			if rc != SQLITE_OK {
 61246  				zErr = sqlite3.Xsqlite3_errmsg(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb)
 61247  				(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 61248  			}
 61249  		}
 61250  	}
 61251  	return SQLITE_OK
 61252  }
 61253  
 61254  func tclFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_bestindex.c:273:12: */
 61255  	bp := tls.Alloc(40)
 61256  	defer tls.Free(40)
 61257  
 61258  	var pCsr uintptr = pVtabCursor
 61259  	var pTab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 61260  	var interp uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).Finterp
 61261  	var pScript uintptr
 61262  	var pArg uintptr
 61263  	var ii int32
 61264  	var rc int32
 61265  
 61266  	pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 61267  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 61268  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27721 /* "xFilter" */, -1))
 61269  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewIntObj(tls, idxNum))
 61270  	if idxStr != 0 {
 61271  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, idxStr, -1))
 61272  	} else {
 61273  		tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 61274  	}
 61275  
 61276  	pArg = tcl.XTcl_NewObj(tls)
 61277  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 61278  	for ii = 0; ii < argc; ii++ {
 61279  		var zVal uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(ii)*4)))
 61280  		var pVal uintptr
 61281  		if zVal == uintptr(0) {
 61282  			pVal = tcl.XTcl_NewObj(tls)
 61283  		} else {
 61284  			pVal = tcl.XTcl_NewStringObj(tls, zVal, -1)
 61285  		}
 61286  		tcl.XTcl_ListObjAppendElement(tls, interp, pArg, pVal)
 61287  	}
 61288  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, pArg)
 61289  	for ok := true; ok; ok = 0 != 0 {
 61290  		var _objPtr uintptr = pArg
 61291  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61292  			tcl.XTclFreeObj(tls, _objPtr)
 61293  		}
 61294  	}
 61295  
 61296  	rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 61297  	if rc != TCL_OK {
 61298  		var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 61299  		rc = SQLITE_ERROR
 61300  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 61301  	} else {
 61302  		// Analyze the scripts return value. The return value should be a tcl
 61303  		// list object with an even number of elements. The first element of each
 61304  		// pair must be one of:
 61305  		//
 61306  		//   "sql"          (SQL statement to return data)
 61307  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 61308  		*(*uintptr)(unsafe.Pointer(bp + 36 /* apElem */)) = uintptr(0)
 61309  		// var nElem int32 at bp+32, 4
 61310  
 61311  		rc = tcl.XTcl_ListObjGetElements(tls, interp, pRes, bp+32 /* &nElem */, bp+36 /* &apElem */)
 61312  		if rc != TCL_OK {
 61313  			var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 61314  			rc = SQLITE_ERROR
 61315  			(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zErr))
 61316  		} else {
 61317  			for ii = 0; (rc == SQLITE_OK) && (ii < *(*int32)(unsafe.Pointer(bp + 32 /* nElem */))); ii = ii + (2) {
 61318  				var zCmd uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 36 /* apElem */)) + uintptr(ii)*4)))
 61319  				var p uintptr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 36 /* apElem */)) + uintptr((ii+1))*4))
 61320  				if sqlite3.Xsqlite3_stricmp(tls, ts+1808 /* "sql" */, zCmd) == 0 {
 61321  					var zSql uintptr = tcl.XTcl_GetString(tls, p)
 61322  					rc = sqlite3.Xsqlite3_prepare_v2(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 4 /* &.pStmt */), uintptr(0))
 61323  					if rc != SQLITE_OK {
 61324  						var zErr uintptr = sqlite3.Xsqlite3_errmsg(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).Fdb)
 61325  						(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+16, zErr))
 61326  					}
 61327  				} else {
 61328  					rc = SQLITE_ERROR
 61329  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+24, zCmd))
 61330  				}
 61331  			}
 61332  		}
 61333  	}
 61334  
 61335  	if rc == SQLITE_OK {
 61336  		rc = tclNext(tls, pVtabCursor)
 61337  	}
 61338  	return rc
 61339  }
 61340  
 61341  func tclColumn(tls *libc.TLS, pVtabCursor uintptr, ctx uintptr, i int32) int32 { /* test_bestindex.c:356:12: */
 61342  	var pCsr uintptr = pVtabCursor
 61343  	sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt, (i+1)))
 61344  	return SQLITE_OK
 61345  }
 61346  
 61347  func tclRowid(tls *libc.TLS, pVtabCursor uintptr, pRowid uintptr) int32 { /* test_bestindex.c:366:12: */
 61348  	var pCsr uintptr = pVtabCursor
 61349  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt, 0)
 61350  	return SQLITE_OK
 61351  }
 61352  
 61353  func tclEof(tls *libc.TLS, pVtabCursor uintptr) int32 { /* test_bestindex.c:372:12: */
 61354  	var pCsr uintptr = pVtabCursor
 61355  	return (libc.Bool32((*tcl_cursor)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 61356  }
 61357  
 61358  func tclBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_bestindex.c:377:12: */
 61359  	bp := tls.Alloc(68)
 61360  	defer tls.Free(68)
 61361  
 61362  	var pTab uintptr = tab
 61363  	var interp uintptr = (*tcl_vtab)(unsafe.Pointer(pTab)).Finterp
 61364  	var pArg uintptr
 61365  	var pScript uintptr
 61366  	var ii int32
 61367  	var rc int32 = SQLITE_OK
 61368  
 61369  	pScript = tcl.XTcl_DuplicateObj(tls, (*tcl_vtab)(unsafe.Pointer(pTab)).FpCmd)
 61370  	(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 61371  	tcl.XTcl_ListObjAppendElement(tls, interp, pScript, tcl.XTcl_NewStringObj(tls, ts+27775 /* "xBestIndex" */, -1))
 61372  
 61373  	pArg = tcl.XTcl_NewObj(tls)
 61374  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 61375  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 61376  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 61377  		var pElem uintptr = tcl.XTcl_NewObj(tls)
 61378  		var zOp uintptr = ts + 3266 /* "?" */
 61379  
 61380  		(*Tcl_Obj)(unsafe.Pointer(pElem)).FrefCount++
 61381  
 61382  		switch int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) {
 61383  		case SQLITE_INDEX_CONSTRAINT_EQ:
 61384  			zOp = ts + 28651 /* "eq" */
 61385  			break
 61386  		case SQLITE_INDEX_CONSTRAINT_GT:
 61387  			zOp = ts + 28654 /* "gt" */
 61388  			break
 61389  		case SQLITE_INDEX_CONSTRAINT_LE:
 61390  			zOp = ts + 28657 /* "le" */
 61391  			break
 61392  		case SQLITE_INDEX_CONSTRAINT_LT:
 61393  			zOp = ts + 28660 /* "lt" */
 61394  			break
 61395  		case SQLITE_INDEX_CONSTRAINT_GE:
 61396  			zOp = ts + 28663 /* "ge" */
 61397  			break
 61398  		case SQLITE_INDEX_CONSTRAINT_MATCH:
 61399  			zOp = ts + 28666 /* "match" */
 61400  			break
 61401  		case SQLITE_INDEX_CONSTRAINT_LIKE:
 61402  			zOp = ts + 27873 /* "like" */
 61403  			break
 61404  		case SQLITE_INDEX_CONSTRAINT_GLOB:
 61405  			zOp = ts + 27878 /* "glob" */
 61406  			break
 61407  		case SQLITE_INDEX_CONSTRAINT_REGEXP:
 61408  			zOp = ts + 6335 /* "regexp" */
 61409  			break
 61410  		case SQLITE_INDEX_CONSTRAINT_NE:
 61411  			zOp = ts + 28672 /* "ne" */
 61412  			break
 61413  		case SQLITE_INDEX_CONSTRAINT_ISNOT:
 61414  			zOp = ts + 28675 /* "isnot" */
 61415  			break
 61416  		case SQLITE_INDEX_CONSTRAINT_ISNOTNULL:
 61417  			zOp = ts + 28681 /* "isnotnull" */
 61418  			break
 61419  		case SQLITE_INDEX_CONSTRAINT_ISNULL:
 61420  			zOp = ts + 28691 /* "isnull" */
 61421  			break
 61422  		case SQLITE_INDEX_CONSTRAINT_IS:
 61423  			zOp = ts + 5712 /* "is" */
 61424  			break
 61425  		}
 61426  
 61427  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28698 /* "op" */, -1))
 61428  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, zOp, -1))
 61429  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28701 /* "column" */, -1))
 61430  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn))
 61431  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28708 /* "usable" */, -1))
 61432  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable)))
 61433  
 61434  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, pElem)
 61435  		for ok := true; ok; ok = 0 != 0 {
 61436  			var _objPtr uintptr = pElem
 61437  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61438  				tcl.XTclFreeObj(tls, _objPtr)
 61439  			}
 61440  		}
 61441  	}
 61442  
 61443  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, pArg)
 61444  	for ok1 := true; ok1; ok1 = 0 != 0 {
 61445  		var _objPtr uintptr = pArg
 61446  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61447  			tcl.XTclFreeObj(tls, _objPtr)
 61448  		}
 61449  	}
 61450  
 61451  	pArg = tcl.XTcl_NewObj(tls)
 61452  	(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 61453  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnOrderBy; ii++ {
 61454  		var pOrder uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaOrderBy + uintptr(ii)*8)
 61455  		var pElem uintptr = tcl.XTcl_NewObj(tls)
 61456  		(*Tcl_Obj)(unsafe.Pointer(pElem)).FrefCount++
 61457  
 61458  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28701 /* "column" */, -1))
 61459  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, (*sqlite3_index_orderby)(unsafe.Pointer(pOrder)).FiColumn))
 61460  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewStringObj(tls, ts+28715 /* "desc" */, -1))
 61461  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pElem, tcl.XTcl_NewIntObj(tls, int32((*sqlite3_index_orderby)(unsafe.Pointer(pOrder)).Fdesc)))
 61462  
 61463  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, pElem)
 61464  		for ok2 := true; ok2; ok2 = 0 != 0 {
 61465  			var _objPtr uintptr = pElem
 61466  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61467  				tcl.XTclFreeObj(tls, _objPtr)
 61468  			}
 61469  		}
 61470  	}
 61471  
 61472  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, pArg)
 61473  	for ok3 := true; ok3; ok3 = 0 != 0 {
 61474  		var _objPtr uintptr = pArg
 61475  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61476  			tcl.XTclFreeObj(tls, _objPtr)
 61477  		}
 61478  	}
 61479  
 61480  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pScript, tcl.XTcl_NewWideIntObj(tls, int64((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FcolUsed)))
 61481  
 61482  	rc = tcl.XTcl_EvalObjEx(tls, interp, pScript, TCL_EVAL_GLOBAL)
 61483  	for ok4 := true; ok4; ok4 = 0 != 0 {
 61484  		var _objPtr uintptr = pScript
 61485  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 61486  			tcl.XTclFreeObj(tls, _objPtr)
 61487  		}
 61488  	}
 61489  	if rc != TCL_OK {
 61490  		var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 61491  		rc = SQLITE_ERROR
 61492  		(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, zErr))
 61493  	} else {
 61494  		// Analyze the scripts return value. The return value should be a tcl
 61495  		// list object with an even number of elements. The first element of each
 61496  		// pair must be one of:
 61497  		//
 61498  		//   "orderby"          (value of orderByConsumed flag)
 61499  		//   "cost"             (value of estimatedCost field)
 61500  		//   "rows"             (value of estimatedRows field)
 61501  		//   "use"              (index of used constraint in aConstraint[])
 61502  		//   "idxnum"           (value of idxNum field)
 61503  		//   "idxstr"           (value of idxStr field)
 61504  		//   "omit"             (index of omitted constraint in aConstraint[])
 61505  		var pRes uintptr = tcl.XTcl_GetObjResult(tls, interp)
 61506  		*(*uintptr)(unsafe.Pointer(bp + 52 /* apElem */)) = uintptr(0)
 61507  		// var nElem int32 at bp+48, 4
 61508  
 61509  		rc = tcl.XTcl_ListObjGetElements(tls, interp, pRes, bp+48 /* &nElem */, bp+52 /* &apElem */)
 61510  		if rc != TCL_OK {
 61511  			var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 61512  			rc = SQLITE_ERROR
 61513  			(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, zErr))
 61514  		} else {
 61515  			var iArgv int32 = 1
 61516  			for ii = 0; (rc == SQLITE_OK) && (ii < *(*int32)(unsafe.Pointer(bp + 48 /* nElem */))); ii = ii + (2) {
 61517  				var zCmd uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52 /* apElem */)) + uintptr(ii)*4)))
 61518  				var p uintptr = *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 52 /* apElem */)) + uintptr((ii+1))*4))
 61519  				if sqlite3.Xsqlite3_stricmp(tls, ts+28720 /* "cost" */, zCmd) == 0 {
 61520  					rc = tcl.XTcl_GetDoubleFromObj(tls, interp, p, (pIdxInfo + 40 /* &.estimatedCost */))
 61521  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28725 /* "orderby" */, zCmd) == 0 {
 61522  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, (pIdxInfo + 32 /* &.orderByConsumed */))
 61523  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28733 /* "idxnum" */, zCmd) == 0 {
 61524  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, (pIdxInfo + 20 /* &.idxNum */))
 61525  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28740 /* "idxstr" */, zCmd) == 0 {
 61526  					sqlite3.Xsqlite3_free(tls, (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr)
 61527  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+16, tcl.XTcl_GetString(tls, p)))
 61528  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 61529  				} else if sqlite3.Xsqlite3_stricmp(tls, ts+28747 /* "rows" */, zCmd) == 0 {
 61530  					*(*Tcl_WideInt)(unsafe.Pointer(bp + 56 /* x */)) = int64(0)
 61531  					rc = tcl.XTcl_GetWideIntFromObj(tls, interp, p, bp+56 /* &x */)
 61532  					(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedRows = sqlite3_int64(tRowcnt(*(*Tcl_WideInt)(unsafe.Pointer(bp + 56 /* x */))))
 61533  				} else if (sqlite3.Xsqlite3_stricmp(tls, ts+28752 /* "use" */, zCmd) == 0) ||
 61534  					(sqlite3.Xsqlite3_stricmp(tls, ts+28756 /* "omit" */, zCmd) == 0) {
 61535  					// var iCons int32 at bp+64, 4
 61536  
 61537  					rc = tcl.XTcl_GetIntFromObj(tls, interp, p, bp+64 /* &iCons */)
 61538  					if rc == SQLITE_OK {
 61539  						if (*(*int32)(unsafe.Pointer(bp + 64 /* iCons */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 64 /* iCons */)) >= (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint) {
 61540  							rc = SQLITE_ERROR
 61541  							(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28761 /* "unexpected: %d" */, libc.VaList(bp+24, *(*int32)(unsafe.Pointer(bp + 64 /* iCons */))))
 61542  						} else {
 61543  							var bOmit int32 = (libc.Bool32((int32(*(*int8)(unsafe.Pointer(zCmd))) == 'o') || (int32(*(*int8)(unsafe.Pointer(zCmd))) == 'O')))
 61544  							(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(*(*int32)(unsafe.Pointer(bp + 64 /* iCons */)))*8)).FargvIndex = libc.PostIncInt32(&iArgv, 1)
 61545  							(*sqlite3_index_constraint_usage)(unsafe.Pointer((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(*(*int32)(unsafe.Pointer(bp + 64 /* iCons */)))*8)).Fomit = uint8(bOmit)
 61546  						}
 61547  					}
 61548  				} else {
 61549  					rc = SQLITE_ERROR
 61550  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+28636 /* "unexpected: %s" */, libc.VaList(bp+32, zCmd))
 61551  				}
 61552  				if (rc != SQLITE_OK) && ((*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg == uintptr(0)) {
 61553  					var zErr uintptr = tcl.XTcl_GetStringResult(tls, interp)
 61554  					(*tcl_vtab)(unsafe.Pointer(pTab)).Fbase.FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+40, zErr))
 61555  				}
 61556  			}
 61557  		}
 61558  	}
 61559  
 61560  	return rc
 61561  }
 61562  
 61563  // A virtual table module that provides read-only access to a
 61564  // Tcl global variable namespace.
 61565  var tclModule = sqlite3_module{ // iVersion
 61566  	FxCreate:     0,
 61567  	FxConnect:    0,
 61568  	FxBestIndex:  0,
 61569  	FxDisconnect: 0,
 61570  	FxDestroy:    0,
 61571  	FxOpen:       0, // xOpen - open a cursor
 61572  	FxClose:      0, // xClose - close a cursor
 61573  	FxFilter:     0, // xFilter - configure scan constraints
 61574  	FxNext:       0, // xNext - advance a cursor
 61575  	FxEof:        0, // xEof - check for end of scan
 61576  	FxColumn:     0, // xColumn - read data
 61577  	FxRowid:      0, // xRename
 61578  } /* test_bestindex.c:549:23 */
 61579  
 61580  // Register the echo virtual table module.
 61581  func register_tcl_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_bestindex.c:580:26: */
 61582  	bp := tls.Alloc(4)
 61583  	defer tls.Free(4)
 61584  
 61585  	// var db uintptr at bp, 4
 61586  
 61587  	if objc != 2 {
 61588  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 61589  		return TCL_ERROR
 61590  	}
 61591  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 61592  		return TCL_ERROR
 61593  	}
 61594  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+28776 /* "tcl" */, uintptr(unsafe.Pointer(&tclModule)), interp)
 61595  	return TCL_OK
 61596  }
 61597  
 61598  // Register commands with the TCL interpreter.
 61599  func Sqlitetesttcl_Init(tls *libc.TLS, interp uintptr) int32 { /* test_bestindex.c:604:5: */
 61600  	var i int32
 61601  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd4)) / uint32(unsafe.Sizeof(struct {
 61602  		FzName      uintptr
 61603  		FxProc      uintptr
 61604  		FclientData uintptr
 61605  	}{}))); i++ {
 61606  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd4[i].FzName,
 61607  			aObjCmd4[i].FxProc, aObjCmd4[i].FclientData, uintptr(0))
 61608  	}
 61609  	return TCL_OK
 61610  }
 61611  
 61612  var aObjCmd4 = [1]struct {
 61613  	FzName      uintptr
 61614  	FxProc      uintptr
 61615  	FclientData uintptr
 61616  }{
 61617  	{FzName: ts + 28780 /* "register_tcl_mod..." */, FxProc: 0},
 61618  } /* test_bestindex.c:610:5 */
 61619  
 61620  // Return a pointer to a buffer containing a text representation of the
 61621  // pointer passed as the only argument. The original pointer may be extracted
 61622  // from the text using sqlite3TestTextToPtr().
 61623  func ptrToText(tls *libc.TLS, p uintptr) uintptr { /* test_blob.c:37:13: */
 61624  	bp := tls.Alloc(8)
 61625  	defer tls.Free(8)
 61626  
 61627  	sqlite3.Xsqlite3_snprintf(tls, (int32(uint32(unsafe.Sizeof(buf)) - uint32(1))), uintptr(unsafe.Pointer(&buf)), ts+13802 /* "%p" */, libc.VaList(bp, p))
 61628  	return uintptr(unsafe.Pointer(&buf))
 61629  }
 61630  
 61631  var buf [100]int8 /* test_blob.c:38:15: */
 61632  
 61633  // Attempt to extract a blob handle (type sqlite3_blob*) from the Tcl
 61634  // object passed as the second argument. If successful, set *ppBlob to
 61635  // point to the blob handle and return TCL_OK. Otherwise, store an error
 61636  // message in the tcl interpreter and return TCL_ERROR. The final value
 61637  // of *ppBlob is undefined in this case.
 61638  //
 61639  // If the object contains a string that begins with "incrblob_", then it
 61640  // is assumed to be the name of a Tcl channel opened using the [db incrblob]
 61641  // command (see tclsqlite.c). Otherwise, it is assumed to be a pointer
 61642  // encoded using the ptrToText() routine or similar.
 61643  func blobHandleFromObj1(tls *libc.TLS, interp uintptr, pObj uintptr, ppBlob uintptr) int32 { /* test_blob.c:55:12: */
 61644  	bp := tls.Alloc(8)
 61645  	defer tls.Free(8)
 61646  
 61647  	var z uintptr
 61648  	// var n int32 at bp, 4
 61649  
 61650  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 61651  	if *(*int32)(unsafe.Pointer(bp /* n */)) == 0 {
 61652  		*(*uintptr)(unsafe.Pointer(ppBlob)) = uintptr(0)
 61653  	} else if (*(*int32)(unsafe.Pointer(bp /* n */)) > 9) && (0 == libc.Xmemcmp(tls, ts+28800 /* "incrblob_" */, z, uint32(9))) {
 61654  		// var notUsed int32 at bp+4, 4
 61655  
 61656  		var channel Tcl_Channel
 61657  		var instanceData ClientData
 61658  
 61659  		channel = tcl.XTcl_GetChannel(tls, interp, z, bp+4 /* &notUsed */)
 61660  		if !(channel != 0) {
 61661  			return TCL_ERROR
 61662  		}
 61663  
 61664  		tcl.XTcl_Flush(tls, channel)
 61665  		tcl.XTcl_Seek(tls, channel, int64(0), SEEK_SET)
 61666  
 61667  		instanceData = tcl.XTcl_GetChannelInstanceData(tls, channel)
 61668  		*(*uintptr)(unsafe.Pointer(ppBlob)) = *(*uintptr)(unsafe.Pointer(instanceData))
 61669  	} else {
 61670  		*(*uintptr)(unsafe.Pointer(ppBlob)) = sqlite3TestTextToPtr(tls, z)
 61671  	}
 61672  
 61673  	return TCL_OK
 61674  }
 61675  
 61676  // Like Tcl_GetString(), except that if the string is 0 bytes in size, a
 61677  // NULL Pointer is returned.
 61678  func blobStringFromObj(tls *libc.TLS, pObj uintptr) uintptr { /* test_blob.c:90:13: */
 61679  	bp := tls.Alloc(4)
 61680  	defer tls.Free(4)
 61681  
 61682  	// var n int32 at bp, 4
 61683  
 61684  	var z uintptr
 61685  	z = tcl.XTcl_GetStringFromObj(tls, pObj, bp /* &n */)
 61686  	return func() uintptr {
 61687  		if *(*int32)(unsafe.Pointer(bp /* n */)) != 0 {
 61688  			return z
 61689  		}
 61690  		return uintptr(0)
 61691  	}()
 61692  }
 61693  
 61694  // sqlite3_blob_open DB DATABASE TABLE COLUMN ROWID FLAGS VARNAME
 61695  //
 61696  // Tcl test harness for the sqlite3_blob_open() function.
 61697  func test_blob_open(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:102:26: */
 61698  	bp := tls.Alloc(24)
 61699  	defer tls.Free(24)
 61700  
 61701  	// var db uintptr at bp+4, 4
 61702  
 61703  	var zDb uintptr
 61704  	var zTable uintptr
 61705  	var zColumn uintptr
 61706  	// var iRowid Tcl_WideInt at bp+8, 8
 61707  
 61708  	// var flags int32 at bp, 4
 61709  
 61710  	var zVarname uintptr
 61711  	// var nVarname int32 at bp+16, 4
 61712  
 61713  	*(*uintptr)(unsafe.Pointer(bp + 20 /* pBlob */)) = bp /* &flags */ // Non-zero initialization
 61714  	var rc int32
 61715  
 61716  	if objc != 8 {
 61717  		var zUsage uintptr = ts + 28810 /* "DB DATABASE TABL..." */
 61718  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, zUsage)
 61719  		return TCL_ERROR
 61720  	}
 61721  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+4 /* &db */) != 0 {
 61722  		return TCL_ERROR
 61723  	}
 61724  	zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 61725  	zTable = blobStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 61726  	zColumn = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 61727  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*4)), bp+8 /* &iRowid */) != 0 {
 61728  		return TCL_ERROR
 61729  	}
 61730  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 6*4)), bp /* &flags */) != 0 {
 61731  		return TCL_ERROR
 61732  	}
 61733  	zVarname = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 7*4)), bp+16 /* &nVarname */)
 61734  
 61735  	if *(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)) > 0 {
 61736  		rc = sqlite3.Xsqlite3_blob_open(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* db */)), zDb, zTable, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iRowid */)), *(*int32)(unsafe.Pointer(bp /* flags */)), bp+20 /* &pBlob */)
 61737  		tcl.XTcl_SetVar2(tls, interp, zVarname, uintptr(0), ptrToText(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* pBlob */))), 0)
 61738  	} else {
 61739  		rc = sqlite3.Xsqlite3_blob_open(tls, *(*uintptr)(unsafe.Pointer(bp + 4 /* db */)), zDb, zTable, zColumn, *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* iRowid */)), *(*int32)(unsafe.Pointer(bp /* flags */)), uintptr(0))
 61740  	}
 61741  
 61742  	if rc == SQLITE_OK {
 61743  		tcl.XTcl_ResetResult(tls, interp)
 61744  	} else {
 61745  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 61746  		return TCL_ERROR
 61747  	}
 61748  	return TCL_OK
 61749  }
 61750  
 61751  // sqlite3_blob_close  HANDLE
 61752  func test_blob_close(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:153:26: */
 61753  	bp := tls.Alloc(4)
 61754  	defer tls.Free(4)
 61755  
 61756  	// var pBlob uintptr at bp, 4
 61757  
 61758  	var rc int32
 61759  
 61760  	if objc != 2 {
 61761  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 61762  		return TCL_ERROR
 61763  	}
 61764  
 61765  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &pBlob */) != 0 {
 61766  		return TCL_ERROR
 61767  	}
 61768  	rc = sqlite3.Xsqlite3_blob_close(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)))
 61769  
 61770  	if rc != 0 {
 61771  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 61772  	} else {
 61773  		tcl.XTcl_ResetResult(tls, interp)
 61774  	}
 61775  	return TCL_OK
 61776  }
 61777  
 61778  // sqlite3_blob_bytes  HANDLE
 61779  func test_blob_bytes(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:181:26: */
 61780  	bp := tls.Alloc(4)
 61781  	defer tls.Free(4)
 61782  
 61783  	// var pBlob uintptr at bp, 4
 61784  
 61785  	var nByte int32
 61786  
 61787  	if objc != 2 {
 61788  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 61789  		return TCL_ERROR
 61790  	}
 61791  
 61792  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &pBlob */) != 0 {
 61793  		return TCL_ERROR
 61794  	}
 61795  	nByte = sqlite3.Xsqlite3_blob_bytes(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)))
 61796  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nByte))
 61797  
 61798  	return TCL_OK
 61799  }
 61800  
 61801  // sqlite3_blob_read  CHANNEL OFFSET N
 61802  //
 61803  //   This command is used to test the sqlite3_blob_read() in ways that
 61804  //   the Tcl channel interface does not. The first argument should
 61805  //   be the name of a valid channel created by the [incrblob] method
 61806  //   of a database handle. This function calls sqlite3_blob_read()
 61807  //   to read N bytes from offset OFFSET from the underlying SQLite
 61808  //   blob handle.
 61809  //
 61810  //   On success, a byte-array object containing the read data is
 61811  //   returned. On failure, the interpreter result is set to the
 61812  //   text representation of the returned error code (i.e. "SQLITE_NOMEM")
 61813  //   and a Tcl exception is thrown.
 61814  func test_blob_read(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:217:26: */
 61815  	bp := tls.Alloc(28)
 61816  	defer tls.Free(28)
 61817  
 61818  	// var pBlob uintptr at bp+16, 4
 61819  
 61820  	// var nByte int32 at bp+24, 4
 61821  
 61822  	// var iOffset int32 at bp+20, 4
 61823  
 61824  	var zBuf uintptr = uintptr(0)
 61825  	var rc int32
 61826  
 61827  	if objc != 4 {
 61828  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28862 /* "CHANNEL OFFSET N" */)
 61829  		return TCL_ERROR
 61830  	}
 61831  
 61832  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &pBlob */) != 0 {
 61833  		return TCL_ERROR
 61834  	}
 61835  	if (TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+20 /* &iOffset */)) ||
 61836  		(TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+24 /* &nByte */)) {
 61837  		return TCL_ERROR
 61838  	}
 61839  
 61840  	if *(*int32)(unsafe.Pointer(bp + 24 /* nByte */)) > 0 {
 61841  		zBuf = tcl.XTcl_AttemptAlloc(tls, uint32(*(*int32)(unsafe.Pointer(bp + 24 /* nByte */))))
 61842  		if zBuf == uintptr(0) {
 61843  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+28879 /* "out of memory in..." */, 0))
 61844  			return TCL_ERROR
 61845  		}
 61846  	}
 61847  	rc = sqlite3.Xsqlite3_blob_read(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* pBlob */)), zBuf, *(*int32)(unsafe.Pointer(bp + 24 /* nByte */)), *(*int32)(unsafe.Pointer(bp + 20 /* iOffset */)))
 61848  	if rc == SQLITE_OK {
 61849  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, zBuf, *(*int32)(unsafe.Pointer(bp + 24 /* nByte */))))
 61850  	} else {
 61851  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 61852  	}
 61853  	tcl.XTcl_Free(tls, zBuf)
 61854  
 61855  	return func() int32 {
 61856  		if rc == SQLITE_OK {
 61857  			return TCL_OK
 61858  		}
 61859  		return TCL_ERROR
 61860  	}()
 61861  }
 61862  
 61863  // sqlite3_blob_write HANDLE OFFSET DATA ?NDATA?
 61864  //
 61865  //   This command is used to test the sqlite3_blob_write() in ways that
 61866  //   the Tcl channel interface does not. The first argument should
 61867  //   be the name of a valid channel created by the [incrblob] method
 61868  //   of a database handle. This function calls sqlite3_blob_write()
 61869  //   to write the DATA byte-array to the underlying SQLite blob handle.
 61870  //   at offset OFFSET.
 61871  //
 61872  //   On success, an empty string is returned. On failure, the interpreter
 61873  //   result is set to the text representation of the returned error code
 61874  //   (i.e. "SQLITE_NOMEM") and a Tcl exception is thrown.
 61875  func test_blob_write(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_blob.c:273:26: */
 61876  	bp := tls.Alloc(12)
 61877  	defer tls.Free(12)
 61878  
 61879  	// var pBlob uintptr at bp, 4
 61880  
 61881  	// var iOffset int32 at bp+4, 4
 61882  
 61883  	var rc int32
 61884  	var zBuf uintptr
 61885  	// var nBuf int32 at bp+8, 4
 61886  
 61887  	if (objc != 4) && (objc != 5) {
 61888  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28940 /* "HANDLE OFFSET DA..." */)
 61889  		return TCL_ERROR
 61890  	}
 61891  
 61892  	if blobHandleFromObj1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &pBlob */) != 0 {
 61893  		return TCL_ERROR
 61894  	}
 61895  	if TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &iOffset */) {
 61896  		return TCL_ERROR
 61897  	}
 61898  
 61899  	zBuf = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+8 /* &nBuf */)
 61900  	if (objc == 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+8 /* &nBuf */) != 0) {
 61901  		return TCL_ERROR
 61902  	}
 61903  	rc = sqlite3.Xsqlite3_blob_write(tls, *(*uintptr)(unsafe.Pointer(bp /* pBlob */)), zBuf, *(*int32)(unsafe.Pointer(bp + 8 /* nBuf */)), *(*int32)(unsafe.Pointer(bp + 4 /* iOffset */)))
 61904  	if rc != SQLITE_OK {
 61905  		tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 61906  	}
 61907  
 61908  	return func() int32 {
 61909  		if rc == SQLITE_OK {
 61910  			return TCL_OK
 61911  		}
 61912  		return TCL_ERROR
 61913  	}()
 61914  }
 61915  
 61916  // Register commands with the TCL interpreter.
 61917  func Sqlitetest_blob_Init(tls *libc.TLS, interp uintptr) int32 { /* test_blob.c:312:5: */
 61918  	var i int32
 61919  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd5)) / uint32(unsafe.Sizeof(struct {
 61920  		FzName uintptr
 61921  		FxProc uintptr
 61922  	}{}))); i++ {
 61923  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd5[i].FzName, aObjCmd5[i].FxProc, uintptr(0), uintptr(0))
 61924  	}
 61925  	return TCL_OK
 61926  }
 61927  
 61928  var aObjCmd5 = [5]struct {
 61929  	FzName uintptr
 61930  	FxProc uintptr
 61931  }{
 61932  	{FzName: ts + 28967 /* "sqlite3_blob_ope..." */, FxProc: 0},
 61933  	{FzName: ts + 28985 /* "sqlite3_blob_clo..." */, FxProc: 0},
 61934  	{FzName: ts + 29004 /* "sqlite3_blob_byt..." */, FxProc: 0},
 61935  	{FzName: ts + 29023 /* "sqlite3_blob_rea..." */, FxProc: 0},
 61936  	{FzName: ts + 29041 /* "sqlite3_blob_wri..." */, FxProc: 0},
 61937  } /* test_blob.c:317:5 */
 61938  
 61939  // end block for C++
 61940  
 61941  // Local Variables:
 61942  // mode: c
 61943  // c-basic-offset: 4
 61944  // fill-column: 78
 61945  // End:
 61946  
 61947  // Usage: sqlite3_shared_cache_report
 61948  //
 61949  // Return a list of file that are shared and the number of
 61950  // references to each file.
 61951  func sqlite3BtreeSharedCacheReport(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_btree.c:29:19: */
 61952  	var pBt uintptr
 61953  	var pRet uintptr = tcl.XTcl_NewObj(tls)
 61954  	for pBt = sqlite3.Xsqlite3SharedCacheList; pBt != 0; pBt = (*BtShared)(unsafe.Pointer(pBt)).FpNext {
 61955  		var zFile uintptr = sqlite3.Xsqlite3PagerFilename(tls, (*BtShared)(unsafe.Pointer(pBt)).FpPager, 1)
 61956  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, zFile, -1))
 61957  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, (*BtShared)(unsafe.Pointer(pBt)).FnRef))
 61958  	}
 61959  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 61960  	return TCL_OK
 61961  }
 61962  
 61963  // Print debugging information about all cursors to standard output.
 61964  func sqlite3BtreeCursorList(tls *libc.TLS, p uintptr) { /* test_btree.c:52:6: */
 61965  }
 61966  
 61967  // end block for C++
 61968  
 61969  // Local Variables:
 61970  // mode: c
 61971  // c-basic-offset: 4
 61972  // fill-column: 78
 61973  // End:
 61974  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 61975  //    This file is part of the GNU C Library.
 61976  //
 61977  //    The GNU C Library is free software; you can redistribute it and/or
 61978  //    modify it under the terms of the GNU Lesser General Public
 61979  //    License as published by the Free Software Foundation; either
 61980  //    version 2.1 of the License, or (at your option) any later version.
 61981  //
 61982  //    The GNU C Library is distributed in the hope that it will be useful,
 61983  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 61984  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 61985  //    Lesser General Public License for more details.
 61986  //
 61987  //    You should have received a copy of the GNU Lesser General Public
 61988  //    License along with the GNU C Library; if not, see
 61989  //    <http://www.gnu.org/licenses/>.
 61990  
 61991  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 61992  
 61993  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 61994  //    This file is part of the GNU C Library.
 61995  //
 61996  //    The GNU C Library is free software; you can redistribute it and/or
 61997  //    modify it under the terms of the GNU Lesser General Public
 61998  //    License as published by the Free Software Foundation; either
 61999  //    version 2.1 of the License, or (at your option) any later version.
 62000  //
 62001  //    The GNU C Library is distributed in the hope that it will be useful,
 62002  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 62003  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 62004  //    Lesser General Public License for more details.
 62005  //
 62006  //    You should have received a copy of the GNU Lesser General Public
 62007  //    License along with the GNU C Library; if not, see
 62008  //    <http://www.gnu.org/licenses/>.
 62009  
 62010  //	ISO C99 Standard: 7.21 String handling	<string.h>
 62011  
 62012  // Macro to stringify the results of the evaluation a pre-processor
 62013  // macro. i.e. so that STRINGVALUE(SQLITE_NOMEM) -> "7".
 62014  
 62015  // This routine sets entries in the global ::sqlite_options() array variable
 62016  // according to the compile-time configuration of the database.  Test
 62017  // procedures use this to determine when tests should be omitted.
 62018  func set_options(tls *libc.TLS, interp uintptr) { /* test_config.c:47:13: */
 62019  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29075 /* "malloc_usable_si..." */, ts+29094, /* "1" */
 62020  		TCL_GLOBAL_ONLY)
 62021  
 62022  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29096 /* "rowid32" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62023  
 62024  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29104 /* "casesensitivelik..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62025  
 62026  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29122 /* "configslower" */, ts+29135 /* "1.0" */, TCL_GLOBAL_ONLY)
 62027  
 62028  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29139 /* "curdir" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62029  
 62030  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29146 /* "win32malloc" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62031  
 62032  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29158 /* "debug" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62033  
 62034  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29164 /* "default_ckptfull..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62035  
 62036  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29186 /* "direct_read" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62037  
 62038  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29198 /* "dirsync" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62039  
 62040  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29206 /* "lfs" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62041  
 62042  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29210 /* "pagecache_overfl..." */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62043  
 62044  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29235 /* "mmap" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62045  
 62046  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29240, /* "worker_threads" */
 62047  		ts+29255 /* "8" */, TCL_GLOBAL_ONLY)
 62048  
 62049  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29257 /* "memdebug" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62050  
 62051  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29266 /* "8_3_names" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62052  
 62053  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29276 /* "cursorhints" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62054  
 62055  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29288 /* "hiddencolumns" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62056  
 62057  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13933 /* "deserialize" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62058  
 62059  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29302 /* "mathlib" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62060  
 62061  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29310 /* "mem3" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62062  
 62063  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29315 /* "mem5" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62064  
 62065  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29320 /* "offset_sql_func" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62066  
 62067  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14041 /* "preupdate" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62068  
 62069  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29336 /* "snapshot" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62070  
 62071  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29345 /* "mutex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62072  
 62073  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29351 /* "mutex_noop" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62074  
 62075  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29362 /* "altertable" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62076  
 62077  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+1818 /* "analyze" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62078  
 62079  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29373 /* "api_armor" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62080  
 62081  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29383 /* "atomicwrite" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62082  
 62083  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29395 /* "geopoly" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62084  
 62085  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29403 /* "json1" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62086  
 62087  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29409 /* "has_codec" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62088  
 62089  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29419 /* "like_match_blobs" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62090  
 62091  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+10584 /* "attach" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62092  
 62093  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29436 /* "auth" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62094  
 62095  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29441 /* "autoinc" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62096  
 62097  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13514 /* "autoindex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62098  
 62099  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29449 /* "autoreset" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62100  
 62101  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29459 /* "autovacuum" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62102  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29470, /* "default_autovacu..." */
 62103  		ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62104  
 62105  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29489 /* "between_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62106  
 62107  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29501 /* "builtin_test" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62108  
 62109  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29514 /* "bloblit" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62110  
 62111  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29522 /* "cast" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62112  
 62113  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29527 /* "check" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62114  
 62115  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29533 /* "cte" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62116  
 62117  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29537 /* "columnmetadata" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62118  
 62119  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29552 /* "oversize_cell_ch..." */, ts+14654, /* "0" */
 62120  		TCL_GLOBAL_ONLY)
 62121  
 62122  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29572 /* "compileoption_di..." */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62123  
 62124  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+13912 /* "complete" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62125  
 62126  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29592 /* "compound" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62127  
 62128  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29601 /* "conflict" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62129  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29610 /* "crashtest" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62130  
 62131  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29620 /* "datetime" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62132  
 62133  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29629 /* "decltype" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62134  
 62135  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29638 /* "deprecated" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62136  
 62137  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29649 /* "diskio" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62138  
 62139  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+4835 /* "explain" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62140  
 62141  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29656 /* "floatingpoint" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62142  
 62143  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29670 /* "foreignkey" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62144  
 62145  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29681 /* "fts1" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62146  
 62147  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29686 /* "fts2" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62148  
 62149  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29691 /* "fts3" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62150  
 62151  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29696 /* "fts5" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62152  
 62153  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29701 /* "fts3_unicode" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62154  
 62155  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29714 /* "fts4_deferred" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62156  
 62157  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29728 /* "gettable" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62158  
 62159  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29737 /* "icu" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62160  
 62161  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29741 /* "icu_collations" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62162  
 62163  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+11333 /* "incrblob" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62164  
 62165  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29756 /* "integrityck" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62166  
 62167  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29768 /* "legacyformat" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62168  
 62169  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29781 /* "like_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62170  
 62171  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29790 /* "load_ext" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62172  
 62173  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29799 /* "localtime" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62174  
 62175  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29809 /* "lookaside" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62176  
 62177  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29819, /* "long_double" */
 62178  		func() uintptr {
 62179  			if uint32(unsafe.Sizeof(float64(0))) > uint32(unsafe.Sizeof(float64(0))) {
 62180  				return ts + 29094 /* "1" */
 62181  			}
 62182  			return ts + 14654 /* "0" */
 62183  		}(),
 62184  		TCL_GLOBAL_ONLY)
 62185  
 62186  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29831 /* "memorydb" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62187  
 62188  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29840 /* "memorymanage" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62189  
 62190  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29853 /* "mergesort" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62191  
 62192  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29863 /* "null_trim" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62193  
 62194  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29873 /* "or_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62195  
 62196  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29880 /* "rbu" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62197  
 62198  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29884 /* "pager_pragmas" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62199  
 62200  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29898 /* "pragma" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62201  
 62202  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+10199 /* "progress" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62203  
 62204  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29905 /* "reindex" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62205  
 62206  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29913 /* "rtree" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62207  
 62208  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29919 /* "rtree_int_only" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62209  
 62210  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29934 /* "schema_pragmas" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62211  
 62212  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29949 /* "schema_version" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62213  
 62214  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29964 /* "session" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62215  
 62216  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+19249 /* "stat4" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62217  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29972 /* "stmtvtab" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62218  
 62219  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29981 /* "scanstatus" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62220  
 62221  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+29992 /* "lock_proxy_pragm..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62222  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30011 /* "prefer_proxy_loc..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62223  
 62224  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30032 /* "shared_cache" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62225  
 62226  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30045 /* "subquery" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62227  
 62228  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30054 /* "tclvar" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62229  
 62230  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30061, /* "threadsafe" */
 62231  		func() uintptr {
 62232  			if 1 != 0 {
 62233  				return ts + 29094 /* "1" */
 62234  			}
 62235  			return ts + 14654 /* "0" */
 62236  		}(), TCL_GLOBAL_ONLY)
 62237  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30072, /* "threadsafe1" */
 62238  		func() uintptr {
 62239  			if SQLITE_THREADSAFE == 1 {
 62240  				return ts + 29094 /* "1" */
 62241  			}
 62242  			return ts + 14654 /* "0" */
 62243  		}(), TCL_GLOBAL_ONLY)
 62244  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30084, /* "threadsafe2" */
 62245  		func() uintptr {
 62246  			if SQLITE_THREADSAFE == 2 {
 62247  				return ts + 29094 /* "1" */
 62248  			}
 62249  			return ts + 14654 /* "0" */
 62250  		}(), TCL_GLOBAL_ONLY)
 62251  
 62252  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30096 /* "tempdb" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62253  
 62254  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14126 /* "trace" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62255  
 62256  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30103 /* "trigger" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62257  
 62258  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30111 /* "truncate_opt" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62259  
 62260  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+16199 /* "utf16" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62261  
 62262  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30124 /* "vacuum" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62263  
 62264  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30131 /* "view" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62265  
 62266  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30136 /* "vtab" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62267  
 62268  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30141 /* "wal" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62269  
 62270  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30145 /* "wsd" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62271  
 62272  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30149 /* "update_delete_li..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62273  
 62274  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+14153 /* "unlock_notify" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62275  
 62276  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30169 /* "fast_secure_dele..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62277  
 62278  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30188 /* "secure_delete" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62279  
 62280  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30202 /* "userauth" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62281  
 62282  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30211 /* "multiplex_ext_ov..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62283  
 62284  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30235 /* "yytrackmaxstackd..." */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62285  
 62286  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30256 /* "sqllog" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62287  
 62288  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30263 /* "uri_00_error" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62289  
 62290  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30276 /* "normalize" */, ts+14654 /* "0" */, TCL_GLOBAL_ONLY)
 62291  
 62292  	tcl.XTcl_SetVar2(tls, interp, ts+29060 /* "sqlite_options" */, ts+30286 /* "windowfunc" */, ts+29094 /* "1" */, TCL_GLOBAL_ONLY)
 62293  
 62294  	{
 62295  		tcl.XTcl_LinkVar(tls, interp, ts+30297 /* "SQLITE_MAX_LENGT..." */, uintptr(unsafe.Pointer(&cv_MAX_LENGTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62296  	}
 62297  
 62298  	{
 62299  		tcl.XTcl_LinkVar(tls, interp, ts+30315 /* "SQLITE_MAX_COLUM..." */, uintptr(unsafe.Pointer(&cv_MAX_COLUMN)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62300  	}
 62301  
 62302  	{
 62303  		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))
 62304  	}
 62305  
 62306  	{
 62307  		tcl.XTcl_LinkVar(tls, interp, ts+30355 /* "SQLITE_MAX_EXPR_..." */, uintptr(unsafe.Pointer(&cv_MAX_EXPR_DEPTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62308  	}
 62309  
 62310  	{
 62311  		tcl.XTcl_LinkVar(tls, interp, ts+30377 /* "SQLITE_MAX_COMPO..." */, uintptr(unsafe.Pointer(&cv_MAX_COMPOUND_SELECT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62312  	}
 62313  
 62314  	{
 62315  		tcl.XTcl_LinkVar(tls, interp, ts+30404 /* "SQLITE_MAX_VDBE_..." */, uintptr(unsafe.Pointer(&cv_MAX_VDBE_OP)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62316  	}
 62317  
 62318  	{
 62319  		tcl.XTcl_LinkVar(tls, interp, ts+30423 /* "SQLITE_MAX_FUNCT..." */, uintptr(unsafe.Pointer(&cv_MAX_FUNCTION_ARG)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62320  	}
 62321  
 62322  	{
 62323  		tcl.XTcl_LinkVar(tls, interp, ts+30447 /* "SQLITE_MAX_VARIA..." */, uintptr(unsafe.Pointer(&cv_MAX_VARIABLE_NUMBER)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62324  	}
 62325  
 62326  	{
 62327  		tcl.XTcl_LinkVar(tls, interp, ts+30474 /* "SQLITE_MAX_PAGE_..." */, uintptr(unsafe.Pointer(&cv_MAX_PAGE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62328  	}
 62329  
 62330  	{
 62331  		tcl.XTcl_LinkVar(tls, interp, ts+30495 /* "SQLITE_MAX_PAGE_..." */, uintptr(unsafe.Pointer(&cv_MAX_PAGE_COUNT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62332  	}
 62333  
 62334  	{
 62335  		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))
 62336  	}
 62337  
 62338  	{
 62339  		tcl.XTcl_LinkVar(tls, interp, ts+30548 /* "SQLITE_MAX_TRIGG..." */, uintptr(unsafe.Pointer(&cv_MAX_TRIGGER_DEPTH)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62340  	}
 62341  
 62342  	{
 62343  		tcl.XTcl_LinkVar(tls, interp, ts+30573 /* "SQLITE_DEFAULT_C..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_CACHE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62344  	}
 62345  
 62346  	{
 62347  		tcl.XTcl_LinkVar(tls, interp, ts+30599 /* "SQLITE_DEFAULT_P..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_PAGE_SIZE)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62348  	}
 62349  
 62350  	{
 62351  		tcl.XTcl_LinkVar(tls, interp, ts+30624 /* "SQLITE_DEFAULT_F..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_FILE_FORMAT)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62352  	}
 62353  
 62354  	{
 62355  		tcl.XTcl_LinkVar(tls, interp, ts+30651 /* "SQLITE_DEFAULT_S..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_SYNCHRONOUS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62356  	}
 62357  
 62358  	{
 62359  		tcl.XTcl_LinkVar(tls, interp, ts+30678 /* "SQLITE_DEFAULT_W..." */, uintptr(unsafe.Pointer(&cv_DEFAULT_WAL_SYNCHRONOUS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62360  	}
 62361  
 62362  	{
 62363  		tcl.XTcl_LinkVar(tls, interp, ts+30709 /* "SQLITE_MAX_ATTAC..." */, uintptr(unsafe.Pointer(&cv_MAX_ATTACHED)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62364  	}
 62365  
 62366  	{
 62367  		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))
 62368  	}
 62369  
 62370  	{
 62371  		tcl.XTcl_LinkVar(tls, interp, ts+30758 /* "SQLITE_MAX_WORKE..." */, uintptr(unsafe.Pointer(&cv_MAX_WORKER_THREADS)), (TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62372  	}
 62373  
 62374  	{
 62375  		tcl.XTcl_LinkVar(tls, interp, ts+30784 /* "TEMP_STORE" */, uintptr(unsafe.Pointer(&cv_TEMP_STORE)),
 62376  			(TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62377  
 62378  	}
 62379  
 62380  	{
 62381  		tcl.XTcl_LinkVar(tls, interp, ts+30795 /* "__GNUC__" */, uintptr(unsafe.Pointer(&cv___GNUC__)),
 62382  			(TCL_LINK_INT | TCL_LINK_READ_ONLY))
 62383  
 62384  	}
 62385  }
 62386  
 62387  var cv_MAX_LENGTH int32 = SQLITE_MAX_LENGTH                           /* test_config.c:791:3 */
 62388  var cv_MAX_COLUMN int32 = SQLITE_MAX_COLUMN                           /* test_config.c:792:3 */
 62389  var cv_MAX_SQL_LENGTH int32 = SQLITE_MAX_SQL_LENGTH                   /* test_config.c:793:3 */
 62390  var cv_MAX_EXPR_DEPTH int32 = SQLITE_MAX_EXPR_DEPTH                   /* test_config.c:794:3 */
 62391  var cv_MAX_COMPOUND_SELECT int32 = SQLITE_MAX_COMPOUND_SELECT         /* test_config.c:795:3 */
 62392  var cv_MAX_VDBE_OP int32 = SQLITE_MAX_VDBE_OP                         /* test_config.c:796:3 */
 62393  var cv_MAX_FUNCTION_ARG int32 = SQLITE_MAX_FUNCTION_ARG               /* test_config.c:797:3 */
 62394  var cv_MAX_VARIABLE_NUMBER int32 = SQLITE_MAX_VARIABLE_NUMBER         /* test_config.c:798:3 */
 62395  var cv_MAX_PAGE_SIZE int32 = SQLITE_MAX_PAGE_SIZE                     /* test_config.c:799:3 */
 62396  var cv_MAX_PAGE_COUNT int32 = SQLITE_MAX_PAGE_COUNT                   /* test_config.c:800:3 */
 62397  var cv_MAX_LIKE_PATTERN_LENGTH int32 = SQLITE_MAX_LIKE_PATTERN_LENGTH /* test_config.c:801:3 */
 62398  var cv_MAX_TRIGGER_DEPTH int32 = SQLITE_MAX_TRIGGER_DEPTH             /* test_config.c:802:3 */
 62399  var cv_DEFAULT_CACHE_SIZE int32 = -2000                               /* test_config.c:803:3 */
 62400  var cv_DEFAULT_PAGE_SIZE int32 = SQLITE_DEFAULT_PAGE_SIZE             /* test_config.c:804:3 */
 62401  var cv_DEFAULT_FILE_FORMAT int32 = SQLITE_DEFAULT_FILE_FORMAT         /* test_config.c:805:3 */
 62402  var cv_DEFAULT_SYNCHRONOUS int32 = SQLITE_DEFAULT_SYNCHRONOUS         /* test_config.c:806:3 */
 62403  var cv_DEFAULT_WAL_SYNCHRONOUS int32 = SQLITE_DEFAULT_SYNCHRONOUS     /* test_config.c:807:3 */
 62404  var cv_MAX_ATTACHED int32 = SQLITE_MAX_ATTACHED                       /* test_config.c:808:3 */
 62405  var cv_MAX_DEFAULT_PAGE_SIZE int32 = SQLITE_MAX_DEFAULT_PAGE_SIZE     /* test_config.c:809:3 */
 62406  var cv_MAX_WORKER_THREADS int32 = SQLITE_MAX_WORKER_THREADS           /* test_config.c:810:3 */
 62407  var cv_TEMP_STORE int32 = SQLITE_TEMP_STORE                           /* test_config.c:813:22 */
 62408  var cv___GNUC__ int32 = 1                                             /* test_config.c:827:22 */
 62409  
 62410  // Register commands with the TCL interpreter.
 62411  func Sqliteconfig_Init(tls *libc.TLS, interp uintptr) int32 { /* test_config.c:838:5: */
 62412  	set_options(tls, interp)
 62413  	return TCL_OK
 62414  }
 62415  
 62416  //
 62417  // END OF REGISTRATION API
 62418  //
 62419  
 62420  //******* End of fts5.h ********
 62421  
 62422  // The following #defines are copied from test_multiplex.c
 62423  
 62424  // This routine is a copy of (most of) the code from SQLite function
 62425  // sqlite3FileSuffix3(). It modifies the filename in buffer z in the
 62426  // same way as SQLite does when in 8.3 filenames mode.
 62427  func sqlite3Delete83Name(tls *libc.TLS, z uintptr) { /* test_delete.c:46:13: */
 62428  	var i int32
 62429  	var sz int32
 62430  	sz = int32(libc.Xstrlen(tls, z))
 62431  	for i = (sz - 1); ((i > 0) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '/')) && (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) != '.'); i-- {
 62432  	}
 62433  	if (int32(*(*int8)(unsafe.Pointer(z + uintptr(i)))) == '.') && (sz > (i + 4)) {
 62434  		libc.Xmemmove(tls, (z + uintptr((i + 1))), (z + uintptr((sz - 3))), uint32(4))
 62435  	}
 62436  }
 62437  
 62438  // zFile is a filename. Assuming no error occurs, if this file exists,
 62439  // set *pbExists to true and unlink it. Or, if the file does not exist,
 62440  // set *pbExists to false before returning.
 62441  //
 62442  // If an error occurs, non-zero is returned. Or, if no error occurs, zero.
 62443  func sqlite3DeleteUnlinkIfExists(tls *libc.TLS, pVfs uintptr, zFile uintptr, pbExists uintptr) int32 { /* test_delete.c:60:12: */
 62444  	var rc int32 = SQLITE_ERROR
 62445  
 62446  	rc = libc.Xaccess(tls, zFile, F_OK)
 62447  	if rc != 0 {
 62448  		if (*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) == ENOENT {
 62449  			if pbExists != 0 {
 62450  				*(*int32)(unsafe.Pointer(pbExists)) = 0
 62451  			}
 62452  			rc = SQLITE_OK
 62453  		}
 62454  	} else {
 62455  		if pbExists != 0 {
 62456  			*(*int32)(unsafe.Pointer(pbExists)) = 1
 62457  		}
 62458  		rc = libc.Xunlink(tls, zFile)
 62459  	}
 62460  	return rc
 62461  }
 62462  
 62463  // Delete the database file identified by the string argument passed to this
 62464  // function. The string must contain a filename, not an SQLite URI.
 62465  func sqlite3_delete_database(tls *libc.TLS, zFile uintptr) int32 { /* test_delete.c:95:16: */
 62466  	bp := tls.Alloc(116)
 62467  	defer tls.Free(116)
 62468  
 62469  	var zBuf uintptr // Buffer to sprintf() filenames to
 62470  	var nBuf int32   // Size of buffer in bytes
 62471  	var rc int32 = 0 // System error code
 62472  	var i int32      // Iterate through azFmt[] and aMFile[]
 62473  
 62474  	*(*[4]uintptr)(unsafe.Pointer(bp + 24 /* azFmt */)) = [4]uintptr{ts /* "%s" */, ts + 30804 /* "%s-journal" */, ts + 30815 /* "%s-wal" */, ts + 30822 /* "%s-shm" */}
 62475  
 62476  	*(*[6]MFile)(unsafe.Pointer(bp + 40 /* aMFile */)) = [6]MFile{
 62477  		{FzFmt: ts + 30829 /* "%s%03d" */},
 62478  		{FzFmt: ts + 30836 /* "%s-journal%03d" */},
 62479  		{FzFmt: ts + 30851 /* "%s-wal%03d" */},
 62480  		{FzFmt: ts + 30829 /* "%s%03d" */, Fb83: 1},
 62481  		{FzFmt: ts + 30836 /* "%s-journal%03d" */, FiOffset: SQLITE_MULTIPLEX_JOURNAL_8_3_OFFSET, Fb83: 1},
 62482  		{FzFmt: ts + 30851 /* "%s-wal%03d" */, FiOffset: SQLITE_MULTIPLEX_WAL_8_3_OFFSET, Fb83: 1},
 62483  	}
 62484  
 62485  	var pVfs uintptr = uintptr(0)
 62486  
 62487  	// Allocate a buffer large enough for any of the files that need to be
 62488  	// deleted.
 62489  	nBuf = (int32(libc.Xstrlen(tls, zFile)) + 100)
 62490  	zBuf = sqlite3.Xsqlite3_malloc(tls, nBuf)
 62491  	if zBuf == uintptr(0) {
 62492  		return SQLITE_NOMEM
 62493  	}
 62494  
 62495  	// Delete both the regular and 8.3 filenames versions of the database,
 62496  	// journal, wal and shm files.
 62497  	for i = 0; (rc == 0) && (uint32(i) < (uint32(unsafe.Sizeof([4]uintptr{})) / uint32(unsafe.Sizeof(uintptr(0))))); i++ {
 62498  		sqlite3.Xsqlite3_snprintf(tls, nBuf, zBuf, *(*uintptr)(unsafe.Pointer(bp + 24 /* &azFmt[0] */ + uintptr(i)*4)), libc.VaList(bp, zFile))
 62499  		rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, uintptr(0))
 62500  		if (rc == 0) && (i != 0) {
 62501  			sqlite3Delete83Name(tls, zBuf)
 62502  			rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, uintptr(0))
 62503  		}
 62504  	}
 62505  
 62506  	// Delete any multiplexor files
 62507  	for i = 0; (rc == 0) && (uint32(i) < (uint32(unsafe.Sizeof([6]MFile{})) / uint32(unsafe.Sizeof(MFile{})))); i++ {
 62508  		var p uintptr = (bp + 40 /* &aMFile */ + uintptr(i)*12)
 62509  		var iChunk int32
 62510  		for iChunk = 1; iChunk <= MX_CHUNK_NUMBER; iChunk++ {
 62511  			// var bExists int32 at bp+112, 4
 62512  
 62513  			sqlite3.Xsqlite3_snprintf(tls, nBuf, zBuf, (*MFile)(unsafe.Pointer(p)).FzFmt, libc.VaList(bp+8, zFile, (iChunk+(*MFile)(unsafe.Pointer(p)).FiOffset)))
 62514  			if (*MFile)(unsafe.Pointer(p)).Fb83 != 0 {
 62515  				sqlite3Delete83Name(tls, zBuf)
 62516  			}
 62517  			rc = sqlite3DeleteUnlinkIfExists(tls, pVfs, zBuf, bp+112 /* &bExists */)
 62518  			if (*(*int32)(unsafe.Pointer(bp + 112 /* bExists */)) == 0) || (rc != 0) {
 62519  				break
 62520  			}
 62521  		}
 62522  	}
 62523  
 62524  	sqlite3.Xsqlite3_free(tls, zBuf)
 62525  	return func() int32 {
 62526  		if rc != 0 {
 62527  			return SQLITE_ERROR
 62528  		}
 62529  		return SQLITE_OK
 62530  	}()
 62531  }
 62532  
 62533  type MFile = struct {
 62534  	FzFmt    uintptr
 62535  	FiOffset int32
 62536  	Fb83     int32
 62537  } /* test_delete.c:105:3 */
 62538  
 62539  // end block for C++
 62540  
 62541  // Local Variables:
 62542  // mode: c
 62543  // c-basic-offset: 4
 62544  // fill-column: 78
 62545  // End:
 62546  
 62547  func Sqlitetest_demovfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_demovfs.c:686:5: */
 62548  	return TCL_OK
 62549  }
 62550  
 62551  // Maximum pathname length supported by the devsym backend.
 62552  
 62553  // Name used to identify this VFS.
 62554  
 62555  type devsym_file1 = struct {
 62556  	Fbase  sqlite3_file
 62557  	FpReal uintptr
 62558  } /* test_devsym.c:33:9 */
 62559  
 62560  // Maximum pathname length supported by the devsym backend.
 62561  
 62562  // Name used to identify this VFS.
 62563  
 62564  type devsym_file = devsym_file1 /* test_devsym.c:33:28 */
 62565  
 62566  type DevsymGlobal = struct {
 62567  	FpVfs        uintptr
 62568  	FiDeviceChar int32
 62569  	FiSectorSize int32
 62570  	FnWriteCrash int32
 62571  } /* test_devsym.c:76:1 */
 62572  
 62573  var g1 = DevsymGlobal{FiSectorSize: 512} /* test_devsym.c:82:21 */
 62574  
 62575  // Close an devsym-file.
 62576  func devsymClose(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:87:12: */
 62577  	var p uintptr = pFile
 62578  	sqlite3.Xsqlite3OsClose(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 62579  	return SQLITE_OK
 62580  }
 62581  
 62582  // Read data from an devsym-file.
 62583  func devsymRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:96:12: */
 62584  	var p uintptr = pFile
 62585  	return sqlite3.Xsqlite3OsRead(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 62586  }
 62587  
 62588  // Write data to an devsym-file.
 62589  func devsymWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:109:12: */
 62590  	var p uintptr = pFile
 62591  	return sqlite3.Xsqlite3OsWrite(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 62592  }
 62593  
 62594  // Truncate an devsym-file.
 62595  func devsymTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_devsym.c:122:12: */
 62596  	var p uintptr = pFile
 62597  	return sqlite3.Xsqlite3OsTruncate(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, size)
 62598  }
 62599  
 62600  // Sync an devsym-file.
 62601  func devsymSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_devsym.c:130:12: */
 62602  	var p uintptr = pFile
 62603  	return sqlite3.Xsqlite3OsSync(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags)
 62604  }
 62605  
 62606  // Return the current file-size of an devsym-file.
 62607  func devsymFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_devsym.c:138:12: */
 62608  	var p uintptr = pFile
 62609  	return sqlite3.Xsqlite3OsFileSize(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, pSize)
 62610  }
 62611  
 62612  // Lock an devsym-file.
 62613  func devsymLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_devsym.c:146:12: */
 62614  	var p uintptr = pFile
 62615  	return sqlite3.Xsqlite3OsLock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, eLock)
 62616  }
 62617  
 62618  // Unlock an devsym-file.
 62619  func devsymUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_devsym.c:154:12: */
 62620  	var p uintptr = pFile
 62621  	return sqlite3.Xsqlite3OsUnlock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, eLock)
 62622  }
 62623  
 62624  // Check if another file-handle holds a RESERVED lock on an devsym-file.
 62625  func devsymCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_devsym.c:162:12: */
 62626  	var p uintptr = pFile
 62627  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, pResOut)
 62628  }
 62629  
 62630  // File control method. For custom operations on an devsym-file.
 62631  func devsymFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_devsym.c:170:12: */
 62632  	var p uintptr = pFile
 62633  	return sqlite3.Xsqlite3OsFileControl(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, op, pArg)
 62634  }
 62635  
 62636  // Return the sector-size in bytes for an devsym-file.
 62637  func devsymSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:178:12: */
 62638  	return g1.FiSectorSize
 62639  }
 62640  
 62641  // Return the device characteristic flags supported by an devsym-file.
 62642  func devsymDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:185:12: */
 62643  	return g1.FiDeviceChar
 62644  }
 62645  
 62646  // Shared-memory methods are all pass-thrus.
 62647  func devsymShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_devsym.c:192:12: */
 62648  	var p uintptr = pFile
 62649  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 56 /* &.xShmLock */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, ofst, n, flags)
 62650  }
 62651  
 62652  func devsymShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, isWrite int32, pp uintptr) int32 { /* test_devsym.c:196:12: */
 62653  	var p uintptr = pFile
 62654  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 52 /* &.xShmMap */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, libc.AtomicLoadUintptr(&pp))
 62655  }
 62656  
 62657  func devsymShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_devsym.c:206:13: */
 62658  	var p uintptr = pFile
 62659  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 60 /* &.xShmBarrier */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 62660  }
 62661  
 62662  func devsymShmUnmap(tls *libc.TLS, pFile uintptr, delFlag int32) int32 { /* test_devsym.c:210:12: */
 62663  	var p uintptr = pFile
 62664  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 64 /* &.xShmUnmap */))))(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, delFlag)
 62665  }
 62666  
 62667  // Open an devsym file handle.
 62668  func devsymOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_devsym.c:220:12: */
 62669  	var rc int32
 62670  	var p uintptr = pFile
 62671  	(*devsym_file)(unsafe.Pointer(p)).FpReal = (p + 1*8)
 62672  	rc = sqlite3.Xsqlite3OsOpen(tls, g1.FpVfs, zName, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 62673  	if (*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 62674  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&devsym_io_methods))
 62675  	}
 62676  	return rc
 62677  }
 62678  
 62679  var devsym_io_methods = sqlite3_io_methods{
 62680  	FiVersion:               2, // iVersion
 62681  	FxClose:                 0, // xClose
 62682  	FxRead:                  0, // xRead
 62683  	FxWrite:                 0, // xWrite
 62684  	FxTruncate:              0, // xTruncate
 62685  	FxSync:                  0, // xSync
 62686  	FxFileSize:              0, // xFileSize
 62687  	FxLock:                  0, // xLock
 62688  	FxUnlock:                0, // xUnlock
 62689  	FxCheckReservedLock:     0, // xCheckReservedLock
 62690  	FxFileControl:           0, // xFileControl
 62691  	FxSectorSize:            0, // xSectorSize
 62692  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 62693  	FxShmMap:                0, // xShmMap
 62694  	FxShmLock:               0, // xShmLock
 62695  	FxShmBarrier:            0, // xShmBarrier
 62696  	FxShmUnmap:              0, // xShmUnmap
 62697  } /* test_devsym.c:227:27 */
 62698  
 62699  // Delete the file located at zPath. If the dirSync argument is true,
 62700  // ensure the file-system modifications are synced to disk before
 62701  // returning.
 62702  func devsymDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_devsym.c:262:12: */
 62703  	return sqlite3.Xsqlite3OsDelete(tls, g1.FpVfs, zPath, dirSync)
 62704  }
 62705  
 62706  // Test for access permissions. Return true if the requested permission
 62707  // is available, or false otherwise.
 62708  func devsymAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_devsym.c:270:12: */
 62709  	return sqlite3.Xsqlite3OsAccess(tls, g1.FpVfs, zPath, flags, pResOut)
 62710  }
 62711  
 62712  // Populate buffer zOut with the full canonical pathname corresponding
 62713  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 62714  // of at least (DEVSYM_MAX_PATHNAME+1) bytes.
 62715  func devsymFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_devsym.c:284:12: */
 62716  	return sqlite3.Xsqlite3OsFullPathname(tls, g1.FpVfs, zPath, nOut, zOut)
 62717  }
 62718  
 62719  // Populate the buffer pointed to by zBufOut with nByte bytes of
 62720  // random data.
 62721  func devsymRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_devsym.c:329:12: */
 62722  	return sqlite3.Xsqlite3OsRandomness(tls, g1.FpVfs, nByte, zBufOut)
 62723  }
 62724  
 62725  // Sleep for nMicro microseconds. Return the number of microseconds
 62726  // actually slept.
 62727  func devsymSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_devsym.c:337:12: */
 62728  	return sqlite3.Xsqlite3OsSleep(tls, g1.FpVfs, nMicro)
 62729  }
 62730  
 62731  // Return the current time as a Julian Day number in *pTimeOut.
 62732  func devsymCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_devsym.c:344:12: */
 62733  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g1.FpVfs + 64 /* &.xCurrentTime */))))(tls, g1.FpVfs, pTimeOut)
 62734  }
 62735  
 62736  // Return the sector-size in bytes for an writecrash-file.
 62737  func writecrashSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:351:12: */
 62738  	var p uintptr = pFile
 62739  	return sqlite3.Xsqlite3OsSectorSize(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 62740  }
 62741  
 62742  // Return the device characteristic flags supported by an writecrash-file.
 62743  func writecrashDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_devsym.c:359:12: */
 62744  	var p uintptr = pFile
 62745  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal)
 62746  }
 62747  
 62748  // Write data to an writecrash-file.
 62749  func writecrashWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_devsym.c:367:12: */
 62750  	var p uintptr = pFile
 62751  	if g1.FnWriteCrash > 0 {
 62752  		g1.FnWriteCrash--
 62753  		if g1.FnWriteCrash == 0 {
 62754  			libc.Xabort(tls)
 62755  		}
 62756  	}
 62757  	return sqlite3.Xsqlite3OsWrite(tls, (*devsym_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 62758  }
 62759  
 62760  // Open an writecrash file handle.
 62761  func writecrashOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_devsym.c:384:12: */
 62762  	var rc int32
 62763  	var p uintptr = pFile
 62764  	(*devsym_file)(unsafe.Pointer(p)).FpReal = (p + 1*8)
 62765  	rc = sqlite3.Xsqlite3OsOpen(tls, g1.FpVfs, zName, (*devsym_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 62766  	if (*sqlite3_file)(unsafe.Pointer((*devsym_file)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 62767  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&writecrash_io_methods))
 62768  	}
 62769  	return rc
 62770  }
 62771  
 62772  var writecrash_io_methods = sqlite3_io_methods{
 62773  	FiVersion:               2, // iVersion
 62774  	FxClose:                 0, // xClose
 62775  	FxRead:                  0, // xRead
 62776  	FxWrite:                 0, // xWrite
 62777  	FxTruncate:              0, // xTruncate
 62778  	FxSync:                  0, // xSync
 62779  	FxFileSize:              0, // xFileSize
 62780  	FxLock:                  0, // xLock
 62781  	FxUnlock:                0, // xUnlock
 62782  	FxCheckReservedLock:     0, // xCheckReservedLock
 62783  	FxFileControl:           0, // xFileControl
 62784  	FxSectorSize:            0, // xSectorSize
 62785  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 62786  	FxShmMap:                0, // xShmMap
 62787  	FxShmLock:               0, // xShmLock
 62788  	FxShmBarrier:            0, // xShmBarrier
 62789  	FxShmUnmap:              0, // xShmUnmap
 62790  } /* test_devsym.c:391:27 */
 62791  
 62792  var devsym_vfs = sqlite3_vfs{
 62793  	FiVersion:      2,                                   // iVersion
 62794  	FszOsFile:      int32(unsafe.Sizeof(devsym_file{})), // szOsFile
 62795  	FmxPathname:    DEVSYM_MAX_PATHNAME,                 // pNext
 62796  	FzName:         ts + 30862,                          /* "devsym" */ // pAppData
 62797  	FxOpen:         0,                                   // xOpen
 62798  	FxDelete:       0,                                   // xDelete
 62799  	FxAccess:       0,                                   // xAccess
 62800  	FxFullPathname: 0,                                   // xDlClose
 62801  	FxRandomness:   0,                                   // xRandomness
 62802  	FxSleep:        0,                                   // xSleep
 62803  	FxCurrentTime:  0,                                   // xCurrentTimeInt64
 62804  } /* test_devsym.c:421:20 */
 62805  
 62806  var writecrash_vfs = sqlite3_vfs{
 62807  	FiVersion:      2,                                   // iVersion
 62808  	FszOsFile:      int32(unsafe.Sizeof(devsym_file{})), // szOsFile
 62809  	FmxPathname:    DEVSYM_MAX_PATHNAME,                 // pNext
 62810  	FzName:         ts + 30869,                          /* "writecrash" */ // pAppData
 62811  	FxOpen:         0,                                   // xOpen
 62812  	FxDelete:       0,                                   // xDelete
 62813  	FxAccess:       0,                                   // xAccess
 62814  	FxFullPathname: 0,                                   // xDlClose
 62815  	FxRandomness:   0,                                   // xRandomness
 62816  	FxSleep:        0,                                   // xSleep
 62817  	FxCurrentTime:  0,                                   // xCurrentTimeInt64
 62818  } /* test_devsym.c:450:20 */
 62819  
 62820  // This procedure registers the devsym vfs with SQLite. If the argument is
 62821  // true, the devsym vfs becomes the new default vfs. It is the only publicly
 62822  // available function in this file.
 62823  func devsym_register(tls *libc.TLS, iDeviceChar int32, iSectorSize int32) { /* test_devsym.c:485:6: */
 62824  
 62825  	if g1.FpVfs == uintptr(0) {
 62826  		g1.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 62827  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 62828  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 62829  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&devsym_vfs)), 0)
 62830  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&writecrash_vfs)), 0)
 62831  	}
 62832  	if iDeviceChar >= 0 {
 62833  		g1.FiDeviceChar = iDeviceChar
 62834  	} else {
 62835  		g1.FiDeviceChar = 0
 62836  	}
 62837  	if iSectorSize >= 0 {
 62838  		g1.FiSectorSize = iSectorSize
 62839  	} else {
 62840  		g1.FiSectorSize = 512
 62841  	}
 62842  }
 62843  
 62844  func devsym_unregister(tls *libc.TLS) { /* test_devsym.c:506:6: */
 62845  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&devsym_vfs)))
 62846  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&writecrash_vfs)))
 62847  	g1.FpVfs = uintptr(0)
 62848  	g1.FiDeviceChar = 0
 62849  	g1.FiSectorSize = 0
 62850  }
 62851  
 62852  func devsym_crash_on_write(tls *libc.TLS, nWrite int32) { /* test_devsym.c:514:6: */
 62853  	if g1.FpVfs == uintptr(0) {
 62854  		g1.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 62855  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 62856  		*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(g1.FpVfs)).FszOsFile)
 62857  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&devsym_vfs)), 0)
 62858  		sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&writecrash_vfs)), 0)
 62859  	}
 62860  	g1.FnWriteCrash = nWrite
 62861  }
 62862  
 62863  // The next short section of defines are only done when not running on Windows
 62864  // or some other strange platform.
 62865  
 62866  type Tcl_StatBuf = stat /* tcl.h:470:25 */
 62867  
 62868  type stat64 = struct {
 62869  	Fst_dev     uint64
 62870  	F__pad1     uint32
 62871  	F__st_ino   uint32
 62872  	Fst_mode    uint32
 62873  	Fst_nlink   uint32
 62874  	Fst_uid     uint32
 62875  	Fst_gid     uint32
 62876  	Fst_rdev    uint64
 62877  	F__pad2     uint32
 62878  	_           [4]byte
 62879  	Fst_size    int64
 62880  	Fst_blksize int32
 62881  	_           [4]byte
 62882  	Fst_blocks  int64
 62883  	Fst_atim    struct {
 62884  		Ftv_sec  int32
 62885  		Ftv_nsec int32
 62886  	}
 62887  	Fst_mtim struct {
 62888  		Ftv_sec  int32
 62889  		Ftv_nsec int32
 62890  	}
 62891  	Fst_ctim struct {
 62892  		Ftv_sec  int32
 62893  		Ftv_nsec int32
 62894  	}
 62895  	Fst_ino uint64
 62896  } /* stat.h:95:1 */
 62897  
 62898  // statx-related definitions and declarations.
 62899  //    Copyright (C) 2018 Free Software Foundation, Inc.
 62900  //    This file is part of the GNU C Library.
 62901  //
 62902  //    The GNU C Library is free software; you can redistribute it and/or
 62903  //    modify it under the terms of the GNU Lesser General Public
 62904  //    License as published by the Free Software Foundation; either
 62905  //    version 2.1 of the License, or (at your option) any later version.
 62906  //
 62907  //    The GNU C Library is distributed in the hope that it will be useful,
 62908  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 62909  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 62910  //    Lesser General Public License for more details.
 62911  //
 62912  //    You should have received a copy of the GNU Lesser General Public
 62913  //    License along with the GNU C Library; if not, see
 62914  //    <http://www.gnu.org/licenses/>.
 62915  
 62916  // This interface is based on <linux/stat.h> in Linux.
 62917  
 62918  type statx_timestamp = struct {
 62919  	Ftv_sec                 int64
 62920  	Ftv_nsec                uint32
 62921  	F__statx_timestamp_pad1 [1]int32
 62922  } /* statx.h:25:1 */
 62923  
 62924  // Warning: The kernel may add additional fields to this struct in the
 62925  //    future.  Only use this struct for calling the statx function, not
 62926  //    for storing data.  (Expansion will be controlled by the mask
 62927  //    argument of the statx function.)
 62928  type statx = struct {
 62929  	Fstx_mask            uint32
 62930  	Fstx_blksize         uint32
 62931  	Fstx_attributes      uint64
 62932  	Fstx_nlink           uint32
 62933  	Fstx_uid             uint32
 62934  	Fstx_gid             uint32
 62935  	Fstx_mode            uint16
 62936  	F__statx_pad1        [1]uint16
 62937  	Fstx_ino             uint64
 62938  	Fstx_size            uint64
 62939  	Fstx_blocks          uint64
 62940  	Fstx_attributes_mask uint64
 62941  	Fstx_atime           struct {
 62942  		Ftv_sec                 int64
 62943  		Ftv_nsec                uint32
 62944  		F__statx_timestamp_pad1 [1]int32
 62945  	}
 62946  	Fstx_btime struct {
 62947  		Ftv_sec                 int64
 62948  		Ftv_nsec                uint32
 62949  		F__statx_timestamp_pad1 [1]int32
 62950  	}
 62951  	Fstx_ctime struct {
 62952  		Ftv_sec                 int64
 62953  		Ftv_nsec                uint32
 62954  		F__statx_timestamp_pad1 [1]int32
 62955  	}
 62956  	Fstx_mtime struct {
 62957  		Ftv_sec                 int64
 62958  		Ftv_nsec                uint32
 62959  		F__statx_timestamp_pad1 [1]int32
 62960  	}
 62961  	Fstx_rdev_major uint32
 62962  	Fstx_rdev_minor uint32
 62963  	Fstx_dev_major  uint32
 62964  	Fstx_dev_minor  uint32
 62965  	F__statx_pad2   [14]uint64
 62966  } /* statx.h:36:1 */
 62967  
 62968  type flock64 = struct {
 62969  	Fl_type   int16
 62970  	Fl_whence int16
 62971  	_         [4]byte
 62972  	Fl_start  int64
 62973  	Fl_len    int64
 62974  	Fl_pid    int32
 62975  	_         [4]byte
 62976  } /* fcntl.h:43:1 */
 62977  
 62978  // Include generic Linux declarations.
 62979  // O_*, F_*, FD_* bit values for Linux.
 62980  //    Copyright (C) 2001-2018 Free Software Foundation, Inc.
 62981  //    This file is part of the GNU C Library.
 62982  //
 62983  //    The GNU C Library is free software; you can redistribute it and/or
 62984  //    modify it under the terms of the GNU Lesser General Public
 62985  //    License as published by the Free Software Foundation; either
 62986  //    version 2.1 of the License, or (at your option) any later version.
 62987  //
 62988  //    The GNU C Library is distributed in the hope that it will be useful,
 62989  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 62990  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 62991  //    Lesser General Public License for more details.
 62992  //
 62993  //    You should have received a copy of the GNU Lesser General Public
 62994  //    License along with the GNU C Library; if not, see
 62995  //    <http://www.gnu.org/licenses/>.
 62996  
 62997  // This file contains shared definitions between Linux architectures
 62998  //    and is included by <bits/fcntl.h> to declare them.  The various
 62999  //    #ifndef cases allow the architecture specific file to define those
 63000  //    values with different values.
 63001  //
 63002  //    A minimal <bits/fcntl.h> contains just:
 63003  //
 63004  //    struct flock {...}
 63005  //    #ifdef __USE_LARGEFILE64
 63006  //    struct flock64 {...}
 63007  //    #endif
 63008  //    #include <bits/fcntl-linux.h>
 63009  
 63010  // Define struct iovec.
 63011  //    Copyright (C) 1996-2018 Free Software Foundation, Inc.
 63012  //    This file is part of the GNU C Library.
 63013  //
 63014  //    The GNU C Library is free software; you can redistribute it and/or
 63015  //    modify it under the terms of the GNU Lesser General Public
 63016  //    License as published by the Free Software Foundation; either
 63017  //    version 2.1 of the License, or (at your option) any later version.
 63018  //
 63019  //    The GNU C Library is distributed in the hope that it will be useful,
 63020  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 63021  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 63022  //    Lesser General Public License for more details.
 63023  //
 63024  //    You should have received a copy of the GNU Lesser General Public
 63025  //    License along with the GNU C Library; if not, see
 63026  //    <http://www.gnu.org/licenses/>.
 63027  
 63028  // Copyright (C) 1989-2018 Free Software Foundation, Inc.
 63029  //
 63030  // This file is part of GCC.
 63031  //
 63032  // GCC is free software; you can redistribute it and/or modify
 63033  // it under the terms of the GNU General Public License as published by
 63034  // the Free Software Foundation; either version 3, or (at your option)
 63035  // any later version.
 63036  //
 63037  // GCC is distributed in the hope that it will be useful,
 63038  // but WITHOUT ANY WARRANTY; without even the implied warranty of
 63039  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 63040  // GNU General Public License for more details.
 63041  //
 63042  // Under Section 7 of GPL version 3, you are granted additional
 63043  // permissions described in the GCC Runtime Library Exception, version
 63044  // 3.1, as published by the Free Software Foundation.
 63045  //
 63046  // You should have received a copy of the GNU General Public License and
 63047  // a copy of the GCC Runtime Library Exception along with this program;
 63048  // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 63049  // <http://www.gnu.org/licenses/>.
 63050  
 63051  // ISO C Standard:  7.17  Common definitions  <stddef.h>
 63052  
 63053  // Any one of these symbols __need_* means that GNU libc
 63054  //    wants us just to define one data type.  So don't define
 63055  //    the symbols that indicate this file's entire job has been done.
 63056  
 63057  // This avoids lossage on SunOS but only if stdtypes.h comes first.
 63058  //    There's no way to win with the other order!  Sun lossage.
 63059  
 63060  // On 4.3bsd-net2, make sure ansi.h is included, so we have
 63061  //    one less case to deal with in the following.
 63062  // On FreeBSD 5, machine/ansi.h does not exist anymore...
 63063  
 63064  // In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
 63065  //    defined if the corresponding type is *not* defined.
 63066  //    FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
 63067  //    NetBSD defines _I386_ANSI_H_ and _X86_64_ANSI_H_ instead of _ANSI_H_
 63068  
 63069  // Sequent's header files use _PTRDIFF_T_ in some conflicting way.
 63070  //    Just ignore it.
 63071  
 63072  // On VxWorks, <type/vxTypesBase.h> may have defined macros like
 63073  //    _TYPE_size_t which will typedef size_t.  fixincludes patched the
 63074  //    vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
 63075  //    not defined, and so that defining this macro defines _GCC_SIZE_T.
 63076  //    If we find that the macros are still defined at this point, we must
 63077  //    invoke them so that the type is defined as expected.
 63078  
 63079  // In case nobody has defined these types, but we aren't running under
 63080  //    GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE_TYPE__, and
 63081  //    __WCHAR_TYPE__ have reasonable values.  This can happen if the
 63082  //    parts of GCC is compiled by an older compiler, that actually
 63083  //    include gstddef.h, such as collect2.
 63084  
 63085  // Signed type of difference of two pointers.
 63086  
 63087  // Define this type if we are doing the whole job,
 63088  //    or if we want this type in particular.
 63089  
 63090  // If this symbol has done its job, get rid of it.
 63091  
 63092  // Unsigned type of `sizeof' something.
 63093  
 63094  // Define this type if we are doing the whole job,
 63095  //    or if we want this type in particular.
 63096  
 63097  // Wide character type.
 63098  //    Locale-writers should change this as necessary to
 63099  //    be big enough to hold unique values not between 0 and 127,
 63100  //    and not (wchar_t) -1, for each defined multibyte character.
 63101  
 63102  // Define this type if we are doing the whole job,
 63103  //    or if we want this type in particular.
 63104  
 63105  //  In 4.3bsd-net2, leave these undefined to indicate that size_t, etc.
 63106  //     are already defined.
 63107  //  BSD/OS 3.1 and FreeBSD [23].x require the MACHINE_ANSI_H check here.
 63108  //  NetBSD 5 requires the I386_ANSI_H and X86_64_ANSI_H checks here.
 63109  
 63110  // A null pointer constant.
 63111  
 63112  // Offset of member MEMBER in a struct of type TYPE.
 63113  
 63114  // Structure for scatter/gather I/O.
 63115  type iovec = struct {
 63116  	Fiov_base uintptr
 63117  	Fiov_len  size_t
 63118  } /* struct_iovec.h:26:1 */
 63119  
 63120  // Structure to use with F_GETOWN_EX and F_SETOWN_EX.
 63121  type f_owner_ex = struct {
 63122  	Ftype uint32
 63123  	Fpid  int32
 63124  } /* fcntl-linux.h:274:1 */
 63125  
 63126  // Types of seals.
 63127  
 63128  // Hint values for F_{GET,SET}_RW_HINT.
 63129  
 63130  // Define some more compatibility macros to be backward compatible with
 63131  //    BSD systems which did not managed to hide these kernel macros.
 63132  
 63133  // Advise to `posix_fadvise'.
 63134  
 63135  // Flags for SYNC_FILE_RANGE.
 63136  
 63137  // Flags for SPLICE and VMSPLICE.
 63138  
 63139  // Flags for fallocate.
 63140  // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
 63141  
 63142  // FALLOC_FL_COLLAPSE_RANGE is used to remove a range of a file
 63143  // without leaving a hole in the file. The contents of the file beyond
 63144  // the range being removed is appended to the start offset of the range
 63145  // being removed (i.e. the hole that was punched is "collapsed"),
 63146  // resulting in a file layout that looks like the range that was
 63147  // removed never existed. As such collapsing a range of a file changes
 63148  // the size of the file, reducing it by the same length of the range
 63149  // that has been removed by the operation.
 63150  //
 63151  // Different filesystems may implement different limitations on the
 63152  // granularity of the operation. Most will limit operations to
 63153  // filesystem block size boundaries, but this boundary may be larger or
 63154  // smaller depending on the filesystem and/or the configuration of the
 63155  // filesystem or file.
 63156  //
 63157  // Attempting to collapse a range that crosses the end of the file is
 63158  // considered an illegal operation - just use ftruncate(2) if you need
 63159  // to collapse a range that crosses EOF.
 63160  
 63161  // FALLOC_FL_ZERO_RANGE is used to convert a range of file to zeros preferably
 63162  // without issuing data IO. Blocks should be preallocated for the regions that
 63163  // span holes in the file, and the entire range is preferable converted to
 63164  // unwritten extents - even though file system may choose to zero out the
 63165  // extent or do whatever which will result in reading zeros from the range
 63166  // while the range remains allocated for the file.
 63167  //
 63168  // This can be also used to preallocate blocks past EOF in the same way as
 63169  // with fallocate. Flag FALLOC_FL_KEEP_SIZE should cause the inode
 63170  // size to remain the same.
 63171  
 63172  // FALLOC_FL_INSERT_RANGE is use to insert space within the file size without
 63173  // overwriting any existing data. The contents of the file beyond offset are
 63174  // shifted towards right by len bytes to create a hole.  As such, this
 63175  // operation will increase the size of the file by len bytes.
 63176  //
 63177  // Different filesystems may implement different limitations on the granularity
 63178  // of the operation. Most will limit operations to filesystem block size
 63179  // boundaries, but this boundary may be larger or smaller depending on
 63180  // the filesystem and/or the configuration of the filesystem or file.
 63181  //
 63182  // Attempting to insert space using this flag at OR beyond the end of
 63183  // the file is considered an illegal operation - just use ftruncate(2) or
 63184  // fallocate(2) with mode 0 for such type of operations.
 63185  
 63186  // FALLOC_FL_UNSHARE_RANGE is used to unshare shared blocks within the
 63187  // file size without overwriting any existing data. The purpose of this
 63188  // call is to preemptively reallocate any blocks that are subject to
 63189  // copy-on-write.
 63190  //
 63191  // Different filesystems may implement different limitations on the
 63192  // granularity of the operation. Most will limit operations to filesystem
 63193  // block size boundaries, but this boundary may be larger or smaller
 63194  // depending on the filesystem and/or the configuration of the filesystem
 63195  // or file.
 63196  //
 63197  // This flag can only be used with allocate-mode fallocate, which is
 63198  // to say that it cannot be used with the punch, zero, collapse, or
 63199  // insert range modes.
 63200  
 63201  // File handle structure.
 63202  type file_handle = struct {
 63203  	_             [0]uint32
 63204  	Fhandle_bytes uint32
 63205  	Fhandle_type  int32
 63206  } /* fcntl-linux.h:350:1 */
 63207  
 63208  type dirent64 = struct {
 63209  	Fd_ino    uint64
 63210  	Fd_off    int64
 63211  	Fd_reclen uint16
 63212  	Fd_type   uint8
 63213  	Fd_name   [256]int8
 63214  	_         [5]byte
 63215  } /* dirent.h:37:1 */
 63216  
 63217  type fs_vtab1 = struct {
 63218  	Fbase sqlite3_vtab
 63219  	Fdb   uintptr
 63220  	FzDb  uintptr
 63221  	FzTbl uintptr
 63222  } /* test_fs.c:96:9 */
 63223  
 63224  type fs_vtab = fs_vtab1 /* test_fs.c:96:24 */
 63225  type fs_cursor1 = struct {
 63226  	Fbase   sqlite3_vtab_cursor
 63227  	FpStmt  uintptr
 63228  	FzBuf   uintptr
 63229  	FnBuf   int32
 63230  	FnAlloc int32
 63231  } /* test_fs.c:97:9 */
 63232  
 63233  type fs_cursor = fs_cursor1 /* test_fs.c:97:26 */
 63234  
 63235  // ************************************************************************
 63236  //
 63237  // Start of fsdir implementation.
 63238  type FsdirVtab1 = struct{ Fbase sqlite3_vtab } /* test_fs.c:121:9 */
 63239  
 63240  // ************************************************************************
 63241  //
 63242  // Start of fsdir implementation.
 63243  type FsdirVtab = FsdirVtab1 /* test_fs.c:121:26 */
 63244  type FsdirCsr1 = struct {
 63245  	Fbase   sqlite3_vtab_cursor
 63246  	FzDir   uintptr
 63247  	FpDir   uintptr
 63248  	_       [4]byte
 63249  	FiRowid sqlite3_int64
 63250  	FpEntry uintptr
 63251  	_       [4]byte
 63252  } /* test_fs.c:122:9 */
 63253  
 63254  type FsdirCsr = FsdirCsr1 /* test_fs.c:122:25 */
 63255  
 63256  // This function is the implementation of both the xConnect and xCreate
 63257  // methods of the fsdir virtual table.
 63258  //
 63259  // The argv[] array contains the following:
 63260  //
 63261  //   argv[0]   -> module name  ("fs")
 63262  //   argv[1]   -> database name
 63263  //   argv[2]   -> table name
 63264  //   argv[...] -> other module argument fields.
 63265  func fsdirConnect1(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:146:12: */
 63266  	var pTab uintptr
 63267  
 63268  	if argc != 3 {
 63269  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 63270  		return SQLITE_ERROR
 63271  	}
 63272  
 63273  	pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FsdirVtab{})))
 63274  	if !(pTab != 0) {
 63275  		return SQLITE_NOMEM
 63276  	}
 63277  	libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(FsdirVtab{})))
 63278  
 63279  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 63280  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+30880 /* "CREATE TABLE xyz..." */)
 63281  
 63282  	return SQLITE_OK
 63283  }
 63284  
 63285  // xDestroy/xDisconnect implementation.
 63286  func fsdirDisconnect1(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:173:12: */
 63287  	sqlite3.Xsqlite3_free(tls, pVtab)
 63288  	return SQLITE_OK
 63289  }
 63290  
 63291  // xBestIndex implementation. The only constraint supported is:
 63292  //
 63293  //   (dir = ?)
 63294  func fsdirBestIndex1(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:183:12: */
 63295  	var ii int32
 63296  
 63297  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000000000.0
 63298  
 63299  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 63300  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 63301  		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) {
 63302  			var pUsage uintptr
 63303  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 63304  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 63305  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 63306  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 63307  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1.0
 63308  			break
 63309  		}
 63310  	}
 63311  
 63312  	return SQLITE_OK
 63313  }
 63314  
 63315  // xOpen implementation.
 63316  //
 63317  // Open a new fsdir cursor.
 63318  func fsdirOpen1(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:209:12: */
 63319  	var pCur uintptr
 63320  	// Allocate an extra 256 bytes because it is undefined how big dirent.d_name
 63321  	// is and we need enough space.  Linux provides plenty already, but
 63322  	// Solaris only provides one byte.
 63323  	pCur = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(FsdirCsr{})) + uint32(256))))
 63324  	if pCur == uintptr(0) {
 63325  		return SQLITE_NOMEM
 63326  	}
 63327  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(FsdirCsr{})))
 63328  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 63329  	return SQLITE_OK
 63330  }
 63331  
 63332  // Close a fsdir cursor.
 63333  func fsdirClose1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:224:12: */
 63334  	var pCur uintptr = cur
 63335  	if (*FsdirCsr)(unsafe.Pointer(pCur)).FpDir != 0 {
 63336  		libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCur)).FpDir)
 63337  	}
 63338  	sqlite3.Xsqlite3_free(tls, (*FsdirCsr)(unsafe.Pointer(pCur)).FzDir)
 63339  	sqlite3.Xsqlite3_free(tls, pCur)
 63340  	return SQLITE_OK
 63341  }
 63342  
 63343  // Skip the cursor to the next entry.
 63344  func fsdirNext1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:235:12: */
 63345  	var pCsr uintptr = cur
 63346  
 63347  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir != 0 {
 63348  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry = libc.Xreaddir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 63349  		if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry == uintptr(0) {
 63350  			libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 63351  			(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = uintptr(0)
 63352  		}
 63353  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid++
 63354  	}
 63355  
 63356  	return SQLITE_OK
 63357  }
 63358  
 63359  // xFilter method implementation.
 63360  func fsdirFilter1(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:253:12: */
 63361  	var pCsr uintptr = pVtabCursor
 63362  	var zDir uintptr
 63363  	var nDir int32
 63364  
 63365  	if (idxNum != 1) || (argc != 1) {
 63366  		return SQLITE_ERROR
 63367  	}
 63368  
 63369  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid = int64(0)
 63370  	sqlite3.Xsqlite3_free(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir)
 63371  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir != 0 {
 63372  		libc.Xclosedir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir)
 63373  		(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = uintptr(0)
 63374  	}
 63375  
 63376  	zDir = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 63377  	nDir = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 63378  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir = sqlite3.Xsqlite3_malloc(tls, (nDir + 1))
 63379  	if (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir == uintptr(0) {
 63380  		return SQLITE_NOMEM
 63381  	}
 63382  	libc.Xmemcpy(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir, zDir, (uint32(nDir + 1)))
 63383  
 63384  	(*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir = libc.Xopendir(tls, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir)
 63385  	return fsdirNext1(tls, pVtabCursor)
 63386  }
 63387  
 63388  // xEof method implementation.
 63389  func fsdirEof1(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:287:12: */
 63390  	var pCsr uintptr = cur
 63391  	return (libc.Bool32((*FsdirCsr)(unsafe.Pointer(pCsr)).FpDir == uintptr(0)))
 63392  }
 63393  
 63394  // xColumn method implementation.
 63395  func fsdirColumn1(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:295:12: */
 63396  	var pCsr uintptr = cur
 63397  	switch i {
 63398  	case 0: // dir
 63399  		sqlite3.Xsqlite3_result_text(tls, ctx, (*FsdirCsr)(unsafe.Pointer(pCsr)).FzDir, -1, uintptr(0))
 63400  		break
 63401  
 63402  	case 1: // name
 63403  		sqlite3.Xsqlite3_result_text(tls, ctx, (*FsdirCsr)(unsafe.Pointer(pCsr)).FpEntry+19 /* &.d_name */, -1, libc.UintptrFromInt32(-1))
 63404  		break
 63405  
 63406  	default:
 63407  
 63408  	}
 63409  
 63410  	return SQLITE_OK
 63411  }
 63412  
 63413  // xRowid method implementation.
 63414  func fsdirRowid1(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:316:12: */
 63415  	var pCsr uintptr = cur
 63416  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*FsdirCsr)(unsafe.Pointer(pCsr)).FiRowid
 63417  	return SQLITE_OK
 63418  }
 63419  
 63420  //
 63421  // End of fsdir implementation.
 63422  //
 63423  
 63424  // ************************************************************************
 63425  //
 63426  // Start of fstree implementation.
 63427  type FstreeVtab1 = struct {
 63428  	Fbase sqlite3_vtab
 63429  	Fdb   uintptr
 63430  } /* test_fs.c:328:9 */
 63431  
 63432  //
 63433  // End of fsdir implementation.
 63434  //
 63435  
 63436  // ************************************************************************
 63437  //
 63438  // Start of fstree implementation.
 63439  type FstreeVtab = FstreeVtab1 /* test_fs.c:328:27 */
 63440  type FstreeCsr1 = struct {
 63441  	Fbase  sqlite3_vtab_cursor
 63442  	FpStmt uintptr
 63443  	Ffd    int32
 63444  } /* test_fs.c:329:9 */
 63445  
 63446  type FstreeCsr = FstreeCsr1 /* test_fs.c:329:26 */
 63447  
 63448  // This function is the implementation of both the xConnect and xCreate
 63449  // methods of the fstree virtual table.
 63450  //
 63451  // The argv[] array contains the following:
 63452  //
 63453  //   argv[0]   -> module name  ("fs")
 63454  //   argv[1]   -> database name
 63455  //   argv[2]   -> table name
 63456  //   argv[...] -> other module argument fields.
 63457  func fstreeConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:352:12: */
 63458  	var pTab uintptr
 63459  
 63460  	if argc != 3 {
 63461  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 63462  		return SQLITE_ERROR
 63463  	}
 63464  
 63465  	pTab = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FstreeVtab{})))
 63466  	if !(pTab != 0) {
 63467  		return SQLITE_NOMEM
 63468  	}
 63469  	libc.Xmemset(tls, pTab, 0, uint32(unsafe.Sizeof(FstreeVtab{})))
 63470  	(*FstreeVtab)(unsafe.Pointer(pTab)).Fdb = db
 63471  
 63472  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pTab /* &.base */)
 63473  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+30909 /* "CREATE TABLE xyz..." */)
 63474  
 63475  	return SQLITE_OK
 63476  }
 63477  
 63478  // xDestroy/xDisconnect implementation.
 63479  func fstreeDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:380:12: */
 63480  	sqlite3.Xsqlite3_free(tls, pVtab)
 63481  	return SQLITE_OK
 63482  }
 63483  
 63484  // xBestIndex implementation. The only constraint supported is:
 63485  //
 63486  //   (dir = ?)
 63487  func fstreeBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:390:12: */
 63488  	var ii int32
 63489  
 63490  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 63491  		var p uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 63492  		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) ||
 63493  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_LIKE)) ||
 63494  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ)) {
 63495  			var pUsage uintptr
 63496  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 63497  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = int32((*sqlite3_index_constraint)(unsafe.Pointer(p)).Fop)
 63498  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 63499  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 100000.0
 63500  			return SQLITE_OK
 63501  		}
 63502  	}
 63503  
 63504  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1000000000.0
 63505  	return SQLITE_OK
 63506  }
 63507  
 63508  // xOpen implementation.
 63509  //
 63510  // Open a new fstree cursor.
 63511  func fstreeOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:418:12: */
 63512  	var pCur uintptr
 63513  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(FstreeCsr{})))
 63514  	if pCur == uintptr(0) {
 63515  		return SQLITE_NOMEM
 63516  	}
 63517  	libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(FstreeCsr{})))
 63518  	(*FstreeCsr)(unsafe.Pointer(pCur)).Ffd = -1
 63519  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 63520  	return SQLITE_OK
 63521  }
 63522  
 63523  func fstreeCloseFd(tls *libc.TLS, pCsr uintptr) { /* test_fs.c:428:13: */
 63524  	if (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd >= 0 {
 63525  		libc.Xclose(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd)
 63526  		(*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd = -1
 63527  	}
 63528  }
 63529  
 63530  // Close a fstree cursor.
 63531  func fstreeClose(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:438:12: */
 63532  	var pCsr uintptr = cur
 63533  	sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 63534  	fstreeCloseFd(tls, pCsr)
 63535  	sqlite3.Xsqlite3_free(tls, pCsr)
 63536  	return SQLITE_OK
 63537  }
 63538  
 63539  // Skip the cursor to the next entry.
 63540  func fstreeNext(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:449:12: */
 63541  	var pCsr uintptr = cur
 63542  	var rc int32
 63543  
 63544  	fstreeCloseFd(tls, pCsr)
 63545  	rc = sqlite3.Xsqlite3_step(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 63546  	if rc != SQLITE_ROW {
 63547  		rc = sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 63548  		(*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 63549  	} else {
 63550  		rc = SQLITE_OK
 63551  		(*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd = libc.Xopen(tls, sqlite3.Xsqlite3_column_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 0), O_RDONLY, 0)
 63552  	}
 63553  
 63554  	return rc
 63555  }
 63556  
 63557  // xFilter method implementation.
 63558  func fstreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:469:12: */
 63559  	bp := tls.Alloc(2)
 63560  	defer tls.Free(2)
 63561  
 63562  	var pCsr uintptr = pVtabCursor
 63563  	var pTab uintptr = (*FstreeCsr)(unsafe.Pointer(pCsr)).Fbase.FpVtab
 63564  	var rc int32
 63565  	var zSql uintptr = ts + 30945 /* "WITH r(d) AS (  ..." */
 63566  	var zRoot uintptr
 63567  	var nRoot int32
 63568  	var zPrefix uintptr
 63569  	var nPrefix int32
 63570  	var zDir uintptr
 63571  	var nDir int32
 63572  	*(*[2]int8)(unsafe.Pointer(bp /* aWild */)) = [2]int8{int8(0), int8(0)}
 63573  
 63574  	zRoot = ts + 31177 /* "/" */
 63575  	nRoot = 1
 63576  	zPrefix = ts + 489 /* "" */
 63577  	nPrefix = 0
 63578  
 63579  	zDir = zRoot
 63580  	nDir = nRoot
 63581  
 63582  	fstreeCloseFd(tls, pCsr)
 63583  	sqlite3.Xsqlite3_finalize(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt)
 63584  	(*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt = uintptr(0)
 63585  	rc = sqlite3.Xsqlite3_prepare_v2(tls, (*FstreeVtab)(unsafe.Pointer(pTab)).Fdb, zSql, -1, (pCsr + 4 /* &.pStmt */), uintptr(0))
 63586  	if rc != SQLITE_OK {
 63587  		return rc
 63588  	}
 63589  
 63590  	if idxNum != 0 {
 63591  		var zQuery uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 63592  		switch idxNum {
 63593  		case SQLITE_INDEX_CONSTRAINT_GLOB:
 63594  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */)) = int8('*')
 63595  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */ + 1)) = int8('?')
 63596  			break
 63597  			fallthrough
 63598  		case SQLITE_INDEX_CONSTRAINT_LIKE:
 63599  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */)) = int8('_')
 63600  			*(*int8)(unsafe.Pointer(bp /* &aWild[0] */ + 1)) = int8('%')
 63601  			break
 63602  		}
 63603  
 63604  		if sqlite3.Xsqlite3_strnicmp(tls, zQuery, zPrefix, nPrefix) == 0 {
 63605  			var i int32
 63606  			for i = nPrefix; *(*int8)(unsafe.Pointer(zQuery + uintptr(i))) != 0; i++ {
 63607  				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)))) {
 63608  					break
 63609  				}
 63610  				if int32(*(*int8)(unsafe.Pointer(zQuery + uintptr(i)))) == '/' {
 63611  					nDir = i
 63612  				}
 63613  			}
 63614  			zDir = zQuery
 63615  		}
 63616  	}
 63617  	if nDir == 0 {
 63618  		nDir = 1
 63619  	}
 63620  
 63621  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 1, zDir, nDir, libc.UintptrFromInt32(-1))
 63622  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 2, zRoot, nRoot, libc.UintptrFromInt32(-1))
 63623  	sqlite3.Xsqlite3_bind_text(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 3, zPrefix, nPrefix, libc.UintptrFromInt32(-1))
 63624  
 63625  	return fstreeNext(tls, pVtabCursor)
 63626  }
 63627  
 63628  // xEof method implementation.
 63629  func fstreeEof(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:557:12: */
 63630  	var pCsr uintptr = cur
 63631  	return (libc.Bool32((*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt == uintptr(0)))
 63632  }
 63633  
 63634  // xColumn method implementation.
 63635  func fstreeColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:565:12: */
 63636  	bp := tls.Alloc(104)
 63637  	defer tls.Free(104)
 63638  
 63639  	var pCsr uintptr = cur
 63640  	if i == 0 { // path
 63641  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).FpStmt, 0))
 63642  	} else {
 63643  		// var sBuf stat at bp, 104
 63644  
 63645  		libc.Xfstat(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd, bp /* &sBuf */)
 63646  
 63647  		if (((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode) & uint32(0170000)) == (uint32(0100000)) {
 63648  			if i == 1 {
 63649  				sqlite3.Xsqlite3_result_int64(tls, ctx, (*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_size)
 63650  			} else {
 63651  				var nRead int32
 63652  				var aBuf uintptr = sqlite3.Xsqlite3_malloc(tls, (int32((*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode + uint32(1))))
 63653  				if !(aBuf != 0) {
 63654  					return SQLITE_NOMEM
 63655  				}
 63656  				nRead = libc.Xread(tls, (*FstreeCsr)(unsafe.Pointer(pCsr)).Ffd, aBuf, (*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode)
 63657  				if uint32(nRead) != (*stat)(unsafe.Pointer(bp /* &sBuf */)).Fst_mode {
 63658  					return SQLITE_IOERR
 63659  				}
 63660  				sqlite3.Xsqlite3_result_blob(tls, ctx, aBuf, nRead, libc.UintptrFromInt32(-1))
 63661  				sqlite3.Xsqlite3_free(tls, aBuf)
 63662  			}
 63663  		}
 63664  	}
 63665  
 63666  	return SQLITE_OK
 63667  }
 63668  
 63669  // xRowid method implementation.
 63670  func fstreeRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:596:12: */
 63671  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
 63672  	return SQLITE_OK
 63673  }
 63674  
 63675  //
 63676  // End of fstree implementation.
 63677  //
 63678  
 63679  // This function is the implementation of both the xConnect and xCreate
 63680  // methods of the fs virtual table.
 63681  //
 63682  // The argv[] array contains the following:
 63683  //
 63684  //   argv[0]   -> module name  ("fs")
 63685  //   argv[1]   -> database name
 63686  //   argv[2]   -> table name
 63687  //   argv[...] -> other module argument fields.
 63688  func fsConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_fs.c:618:12: */
 63689  	var pVtab uintptr
 63690  	var nByte int32
 63691  	var zTbl uintptr
 63692  	var zDb uintptr = *(*uintptr)(unsafe.Pointer(argv + 1*4))
 63693  
 63694  	if argc != 4 {
 63695  		*(*uintptr)(unsafe.Pointer(pzErr)) = sqlite3.Xsqlite3_mprintf(tls, ts+28610 /* "wrong number of ..." */, 0)
 63696  		return SQLITE_ERROR
 63697  	}
 63698  	zTbl = *(*uintptr)(unsafe.Pointer(argv + 3*4))
 63699  
 63700  	nByte = (int32((((uint32(unsafe.Sizeof(fs_vtab{})) + uint32(int32(libc.Xstrlen(tls, zTbl)))) + uint32(1)) + uint32(int32(libc.Xstrlen(tls, zDb)))) + uint32(1)))
 63701  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(nByte))
 63702  	if !(pVtab != 0) {
 63703  		return SQLITE_NOMEM
 63704  	}
 63705  
 63706  	(*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl = (pVtab + 1*24)
 63707  	(*fs_vtab)(unsafe.Pointer(pVtab)).FzDb = ((*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl + uintptr((libc.Xstrlen(tls, zTbl) + size_t(1))))
 63708  	(*fs_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 63709  	libc.Xmemcpy(tls, (*fs_vtab)(unsafe.Pointer(pVtab)).FzTbl, zTbl, libc.Xstrlen(tls, zTbl))
 63710  	libc.Xmemcpy(tls, (*fs_vtab)(unsafe.Pointer(pVtab)).FzDb, zDb, libc.Xstrlen(tls, zDb))
 63711  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 63712  	sqlite3.Xsqlite3_declare_vtab(tls, db, ts+31179 /* "CREATE TABLE x(p..." */)
 63713  
 63714  	return SQLITE_OK
 63715  }
 63716  
 63717  // Note that for this virtual table, the xCreate and xConnect
 63718  // methods are identical.
 63719  
 63720  func fsDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_fs.c:653:12: */
 63721  	sqlite3.Xsqlite3_free(tls, pVtab)
 63722  	return SQLITE_OK
 63723  }
 63724  
 63725  // The xDisconnect and xDestroy methods are also the same
 63726  
 63727  // Open a new fs cursor.
 63728  func fsOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_fs.c:662:12: */
 63729  	var pCur uintptr
 63730  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(fs_cursor{})))
 63731  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 63732  	return SQLITE_OK
 63733  }
 63734  
 63735  // Close a fs cursor.
 63736  func fsClose(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:672:12: */
 63737  	var pCur uintptr = cur
 63738  	sqlite3.Xsqlite3_finalize(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt)
 63739  	sqlite3.Xsqlite3_free(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf)
 63740  	sqlite3.Xsqlite3_free(tls, pCur)
 63741  	return SQLITE_OK
 63742  }
 63743  
 63744  func fsNext(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:680:12: */
 63745  	var pCur uintptr = cur
 63746  	var rc int32
 63747  
 63748  	rc = sqlite3.Xsqlite3_step(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt)
 63749  	if (rc == SQLITE_ROW) || (rc == SQLITE_DONE) {
 63750  		rc = SQLITE_OK
 63751  	}
 63752  
 63753  	return rc
 63754  }
 63755  
 63756  func fsFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_fs.c:690:12: */
 63757  	bp := tls.Alloc(32)
 63758  	defer tls.Free(32)
 63759  
 63760  	var rc int32
 63761  	var pCur uintptr = pVtabCursor
 63762  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 63763  
 63764  	if idxNum == 1 {
 63765  		var zStmt uintptr = sqlite3.Xsqlite3_mprintf(tls,
 63766  			ts+31216 /* "SELECT * FROM %Q..." */, libc.VaList(bp, (*fs_vtab)(unsafe.Pointer(p)).FzDb, (*fs_vtab)(unsafe.Pointer(p)).FzTbl))
 63767  		if !(zStmt != 0) {
 63768  			return SQLITE_NOMEM
 63769  		}
 63770  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*fs_vtab)(unsafe.Pointer(p)).Fdb, zStmt, -1, (pCur + 4 /* &.pStmt */), uintptr(0))
 63771  		sqlite3.Xsqlite3_free(tls, zStmt)
 63772  		if rc == SQLITE_OK {
 63773  			sqlite3.Xsqlite3_bind_value(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 1, *(*uintptr)(unsafe.Pointer(argv)))
 63774  		}
 63775  	} else {
 63776  		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))
 63777  		if !(zStmt != 0) {
 63778  			return SQLITE_NOMEM
 63779  		}
 63780  		rc = sqlite3.Xsqlite3_prepare_v2(tls, (*fs_vtab)(unsafe.Pointer(p)).Fdb, zStmt, -1, (pCur + 4 /* &.pStmt */), uintptr(0))
 63781  		sqlite3.Xsqlite3_free(tls, zStmt)
 63782  	}
 63783  
 63784  	if rc == SQLITE_OK {
 63785  		rc = fsNext(tls, pVtabCursor)
 63786  	}
 63787  	return rc
 63788  }
 63789  
 63790  func fsColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_fs.c:722:12: */
 63791  	bp := tls.Alloc(104)
 63792  	defer tls.Free(104)
 63793  
 63794  	var pCur uintptr = cur
 63795  
 63796  	if i == 0 {
 63797  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 0))
 63798  	} else {
 63799  		var zFile uintptr = sqlite3.Xsqlite3_column_text(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 1)
 63800  		// var sbuf stat at bp, 104
 63801  
 63802  		var fd int32
 63803  		var n int32
 63804  		fd = libc.Xopen(tls, zFile, O_RDONLY, 0)
 63805  		if fd < 0 {
 63806  			return SQLITE_IOERR
 63807  		}
 63808  		libc.Xfstat(tls, fd, bp /* &sbuf */)
 63809  
 63810  		if (*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size >= int64((*fs_cursor)(unsafe.Pointer(pCur)).FnAlloc) {
 63811  			var nNew sqlite3_int64 = ((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size * int64(2))
 63812  			var zNew uintptr
 63813  			if nNew < int64(1024) {
 63814  				nNew = int64(1024)
 63815  			}
 63816  
 63817  			zNew = sqlite3.Xsqlite3Realloc(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, uint64(nNew))
 63818  			if zNew == uintptr(0) {
 63819  				libc.Xclose(tls, fd)
 63820  				return SQLITE_NOMEM
 63821  			}
 63822  			(*fs_cursor)(unsafe.Pointer(pCur)).FzBuf = zNew
 63823  			(*fs_cursor)(unsafe.Pointer(pCur)).FnAlloc = int32(nNew)
 63824  		}
 63825  
 63826  		n = libc.Xread(tls, fd, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, uint32((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size))
 63827  		libc.Xclose(tls, fd)
 63828  		if int64(n) != (*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size {
 63829  			return SQLITE_ERROR
 63830  		}
 63831  		(*fs_cursor)(unsafe.Pointer(pCur)).FnBuf = int32((*stat)(unsafe.Pointer(bp /* &sbuf */)).Fst_size)
 63832  		*(*int8)(unsafe.Pointer((*fs_cursor)(unsafe.Pointer(pCur)).FzBuf + uintptr((*fs_cursor)(unsafe.Pointer(pCur)).FnBuf))) = int8(0)
 63833  
 63834  		sqlite3.Xsqlite3_result_text(tls, ctx, (*fs_cursor)(unsafe.Pointer(pCur)).FzBuf, -1, libc.UintptrFromInt32(-1))
 63835  	}
 63836  	return SQLITE_OK
 63837  }
 63838  
 63839  func fsRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_fs.c:763:12: */
 63840  	var pCur uintptr = cur
 63841  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite3.Xsqlite3_column_int64(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt, 0)
 63842  	return SQLITE_OK
 63843  }
 63844  
 63845  func fsEof(tls *libc.TLS, cur uintptr) int32 { /* test_fs.c:769:12: */
 63846  	var pCur uintptr = cur
 63847  	return (libc.Bool32(sqlite3.Xsqlite3_data_count(tls, (*fs_cursor)(unsafe.Pointer(pCur)).FpStmt) == 0))
 63848  }
 63849  
 63850  func fsBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_fs.c:774:12: */
 63851  	var ii int32
 63852  
 63853  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 63854  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 63855  		if (((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn < 0) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0)) &&
 63856  			(int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) {
 63857  			var pUsage uintptr
 63858  			pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 63859  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(0)
 63860  			(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = 1
 63861  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxNum = 1
 63862  			(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 1.0
 63863  			break
 63864  		}
 63865  	}
 63866  
 63867  	return SQLITE_OK
 63868  }
 63869  
 63870  // A virtual table module that provides read-only access to a
 63871  // Tcl global variable namespace.
 63872  var fsModule = sqlite3_module{ // iVersion
 63873  	FxCreate:     0,
 63874  	FxConnect:    0,
 63875  	FxBestIndex:  0,
 63876  	FxDisconnect: 0,
 63877  	FxDestroy:    0,
 63878  	FxOpen:       0, // xOpen - open a cursor
 63879  	FxClose:      0, // xClose - close a cursor
 63880  	FxFilter:     0, // xFilter - configure scan constraints
 63881  	FxNext:       0, // xNext - advance a cursor
 63882  	FxEof:        0, // xEof - check for end of scan
 63883  	FxColumn:     0, // xColumn - read data
 63884  	FxRowid:      0, // xRename
 63885  } /* test_fs.c:798:23 */
 63886  
 63887  var fsdirModule = sqlite3_module{ // iVersion
 63888  	FxCreate:     0, // xCreate
 63889  	FxConnect:    0, // xConnect
 63890  	FxBestIndex:  0, // xBestIndex
 63891  	FxDisconnect: 0, // xDisconnect
 63892  	FxDestroy:    0, // xDestroy
 63893  	FxOpen:       0, // xOpen - open a cursor
 63894  	FxClose:      0, // xClose - close a cursor
 63895  	FxFilter:     0, // xFilter - configure scan constraints
 63896  	FxNext:       0, // xNext - advance a cursor
 63897  	FxEof:        0, // xEof - check for end of scan
 63898  	FxColumn:     0, // xColumn - read data
 63899  	FxRowid:      0, // xRename
 63900  } /* test_fs.c:821:23 */
 63901  
 63902  var fstreeModule = sqlite3_module{ // iVersion
 63903  	FxCreate:     0, // xCreate
 63904  	FxConnect:    0, // xConnect
 63905  	FxBestIndex:  0, // xBestIndex
 63906  	FxDisconnect: 0, // xDisconnect
 63907  	FxDestroy:    0, // xDestroy
 63908  	FxOpen:       0, // xOpen - open a cursor
 63909  	FxClose:      0, // xClose - close a cursor
 63910  	FxFilter:     0, // xFilter - configure scan constraints
 63911  	FxNext:       0, // xNext - advance a cursor
 63912  	FxEof:        0, // xEof - check for end of scan
 63913  	FxColumn:     0, // xColumn - read data
 63914  	FxRowid:      0, // xRename
 63915  } /* test_fs.c:844:23 */
 63916  
 63917  // Register the echo virtual table module.
 63918  func register_fs_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_fs.c:875:26: */
 63919  	bp := tls.Alloc(4)
 63920  	defer tls.Free(4)
 63921  
 63922  	// var db uintptr at bp, 4
 63923  
 63924  	if objc != 2 {
 63925  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 63926  		return TCL_ERROR
 63927  	}
 63928  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 63929  		return TCL_ERROR
 63930  	}
 63931  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+31250 /* "fs" */, uintptr(unsafe.Pointer(&fsModule)), interp)
 63932  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+5186 /* "fsdir" */, uintptr(unsafe.Pointer(&fsdirModule)), uintptr(0))
 63933  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+31253 /* "fstree" */, uintptr(unsafe.Pointer(&fstreeModule)), uintptr(0))
 63934  	return TCL_OK
 63935  }
 63936  
 63937  // Register commands with the TCL interpreter.
 63938  func Sqlitetestfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_fs.c:901:5: */
 63939  	var i int32
 63940  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd6)) / uint32(unsafe.Sizeof(struct {
 63941  		FzName      uintptr
 63942  		FxProc      uintptr
 63943  		FclientData uintptr
 63944  	}{}))); i++ {
 63945  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd6[i].FzName,
 63946  			aObjCmd6[i].FxProc, aObjCmd6[i].FclientData, uintptr(0))
 63947  	}
 63948  	return TCL_OK
 63949  }
 63950  
 63951  var aObjCmd6 = [1]struct {
 63952  	FzName      uintptr
 63953  	FxProc      uintptr
 63954  	FclientData uintptr
 63955  }{
 63956  	{FzName: ts + 31260 /* "register_fs_modu..." */, FxProc: 0},
 63957  } /* test_fs.c:907:5 */
 63958  
 63959  // Some versions of <linux/posix_types.h> define this macros.
 63960  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 63961  
 63962  // fd_set for select and pselect.
 63963  type fd_set2 = struct{ F__fds_bits [32]int32 } /* select.h:70:5 */
 63964  
 63965  // Allocate nByte bytes of space using sqlite3_malloc(). If the
 63966  // allocation fails, call sqlite3_result_error_nomem() to notify
 63967  // the database handle that malloc() has failed.
 63968  func testContextMalloc(tls *libc.TLS, context uintptr, nByte int32) uintptr { /* test_func.c:33:13: */
 63969  	var z uintptr = sqlite3.Xsqlite3_malloc(tls, nByte)
 63970  	if !(z != 0) && (nByte > 0) {
 63971  		sqlite3.Xsqlite3_result_error_nomem(tls, context)
 63972  	}
 63973  	return z
 63974  }
 63975  
 63976  // This function generates a string of random characters.  Used for
 63977  // generating test data.
 63978  func randStr(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:45:13: */
 63979  	bp := tls.Alloc(1004)
 63980  	defer tls.Free(1004)
 63981  
 63982  	var iMin int32
 63983  	var iMax int32
 63984  	var n int32
 63985  	// var r int32 at bp, 4
 63986  
 63987  	var i int32
 63988  	// var zBuf [1000]uint8 at bp+4, 1000
 63989  
 63990  	// It used to be possible to call randstr() with any number of arguments,
 63991  	// but now it is registered with SQLite as requiring exactly 2.
 63992  
 63993  	iMin = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 63994  	if iMin < 0 {
 63995  		iMin = 0
 63996  	}
 63997  	if uint32(iMin) >= uint32(unsafe.Sizeof([1000]uint8{})) {
 63998  		iMin = (int32(uint32(unsafe.Sizeof([1000]uint8{})) - uint32(1)))
 63999  	}
 64000  	iMax = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 64001  	if iMax < iMin {
 64002  		iMax = iMin
 64003  	}
 64004  	if uint32(iMax) >= uint32(unsafe.Sizeof([1000]uint8{})) {
 64005  		iMax = (int32(uint32(unsafe.Sizeof([1000]uint8{})) - uint32(1)))
 64006  	}
 64007  	n = iMin
 64008  	if iMax > iMin {
 64009  		sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(int32(0))), bp /* &r */)
 64010  		*(*int32)(unsafe.Pointer(bp /* r */)) &= 0x7fffffff
 64011  		n = n + (*(*int32)(unsafe.Pointer(bp /* r */)) % ((iMax + 1) - iMin))
 64012  	}
 64013  
 64014  	sqlite3.Xsqlite3_randomness(tls, n, bp+4 /* &zBuf[0] */)
 64015  	for i = 0; i < n; i++ {
 64016  		*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(i))) = zSrc[(uint32(*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(i)))) % (uint32(unsafe.Sizeof(zSrc)) - uint32(1)))]
 64017  	}
 64018  	*(*uint8)(unsafe.Pointer(bp + 4 /* &zBuf[0] */ + uintptr(n))) = uint8(0)
 64019  	sqlite3.Xsqlite3_result_text(tls, context, bp+4 /* zBuf */, n, libc.UintptrFromInt32(-1))
 64020  }
 64021  
 64022  var zSrc = *(*[79]uint8)(unsafe.Pointer(ts + 31279 /* "abcdefghijklmnop..." */)) /* test_func.c:46:30 */
 64023  
 64024  // The following two SQL functions are used to test returning a text
 64025  // result with a destructor. Function 'test_destructor' takes one argument
 64026  // and returns the same argument interpreted as TEXT. A destructor is
 64027  // passed with the sqlite3_result_text() call.
 64028  //
 64029  // SQL function 'test_destructor_count' returns the number of outstanding
 64030  // allocations made by 'test_destructor';
 64031  //
 64032  // WARNING: Not threadsafe.
 64033  var test_destructor_count_var int32 = 0 /* test_func.c:91:12 */
 64034  
 64035  func destructor(tls *libc.TLS, p uintptr) { /* test_func.c:92:13: */
 64036  	var zVal uintptr = p
 64037  
 64038  	zVal--
 64039  	sqlite3.Xsqlite3_free(tls, zVal)
 64040  	test_destructor_count_var--
 64041  }
 64042  
 64043  func test_destructor(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:99:13: */
 64044  	var zVal uintptr
 64045  	var len int32
 64046  
 64047  	test_destructor_count_var++
 64048  
 64049  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 64050  		return
 64051  	}
 64052  	len = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64053  	zVal = testContextMalloc(tls, pCtx, (len + 3))
 64054  	if !(zVal != 0) {
 64055  		return
 64056  	}
 64057  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 1)))) = int8(0)
 64058  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 2)))) = int8(0)
 64059  	zVal++
 64060  	libc.Xmemcpy(tls, zVal, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), uint32(len))
 64061  	sqlite3.Xsqlite3_result_text(tls, pCtx, zVal, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{destructor})))
 64062  }
 64063  
 64064  func test_destructor16(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:122:13: */
 64065  	var zVal uintptr
 64066  	var len int32
 64067  
 64068  	test_destructor_count_var++
 64069  
 64070  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 64071  		return
 64072  	}
 64073  	len = sqlite3.Xsqlite3_value_bytes16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64074  	zVal = testContextMalloc(tls, pCtx, (len + 3))
 64075  	if !(zVal != 0) {
 64076  		return
 64077  	}
 64078  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 1)))) = int8(0)
 64079  	*(*int8)(unsafe.Pointer(zVal + uintptr((len + 2)))) = int8(0)
 64080  	zVal++
 64081  	libc.Xmemcpy(tls, zVal, sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv))), uint32(len))
 64082  	sqlite3.Xsqlite3_result_text16(tls, pCtx, zVal, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{destructor})))
 64083  }
 64084  
 64085  func test_destructor_count(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:145:13: */
 64086  	sqlite3.Xsqlite3_result_int(tls, pCtx, test_destructor_count_var)
 64087  }
 64088  
 64089  func test_agg_errmsg16_step(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_func.c:165:13: */
 64090  }
 64091  
 64092  func test_agg_errmsg16_final(tls *libc.TLS, ctx uintptr) { /* test_func.c:167:13: */
 64093  	var z uintptr
 64094  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, ctx)
 64095  	sqlite3.Xsqlite3_aggregate_context(tls, ctx, 2048)
 64096  	z = sqlite3.Xsqlite3_errmsg16(tls, db)
 64097  	sqlite3.Xsqlite3_result_text16(tls, ctx, z, -1, libc.UintptrFromInt32(-1))
 64098  }
 64099  
 64100  // Routines for testing the sqlite3_get_auxdata() and sqlite3_set_auxdata()
 64101  // interface.
 64102  //
 64103  // The test_auxdata() SQL function attempts to register each of its arguments
 64104  // as auxiliary data.  If there are no prior registrations of aux data for
 64105  // that argument (meaning the argument is not a constant or this is its first
 64106  // call) then the result for that argument is 0.  If there is a prior
 64107  // registration, the result for that argument is 1.  The overall result
 64108  // is the individual argument results separated by spaces.
 64109  func free_test_auxdata(tls *libc.TLS, p uintptr) { /* test_func.c:188:13: */
 64110  	sqlite3.Xsqlite3_free(tls, p)
 64111  }
 64112  
 64113  func test_auxdata(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:189:13: */
 64114  	var i int32
 64115  	var zRet uintptr = testContextMalloc(tls, pCtx, (nArg * 2))
 64116  	if !(zRet != 0) {
 64117  		return
 64118  	}
 64119  	libc.Xmemset(tls, zRet, 0, (uint32(nArg * 2)))
 64120  	for i = 0; i < nArg; i++ {
 64121  		var z uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 64122  		if z != 0 {
 64123  			var n int32
 64124  			var zAux uintptr = sqlite3.Xsqlite3_get_auxdata(tls, pCtx, i)
 64125  			if zAux != 0 {
 64126  				*(*int8)(unsafe.Pointer(zRet + uintptr((i * 2)))) = int8('1')
 64127  
 64128  			} else {
 64129  				*(*int8)(unsafe.Pointer(zRet + uintptr((i * 2)))) = int8('0')
 64130  			}
 64131  			n = (int32(libc.Xstrlen(tls, z)) + 1)
 64132  			zAux = testContextMalloc(tls, pCtx, n)
 64133  			if zAux != 0 {
 64134  				libc.Xmemcpy(tls, zAux, z, uint32(n))
 64135  				sqlite3.Xsqlite3_set_auxdata(tls, pCtx, i, zAux, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{free_test_auxdata})))
 64136  			}
 64137  			*(*int8)(unsafe.Pointer(zRet + uintptr(((i * 2) + 1)))) = int8(' ')
 64138  		}
 64139  	}
 64140  	sqlite3.Xsqlite3_result_text(tls, pCtx, zRet, ((2 * nArg) - 1), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{free_test_auxdata})))
 64141  }
 64142  
 64143  // A function to test error reporting from user functions. This function
 64144  // returns a copy of its first argument as the error message.  If the
 64145  // second argument exists, it becomes the error code.
 64146  func test_error(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:226:13: */
 64147  	sqlite3.Xsqlite3_result_error(tls, pCtx, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv))), -1)
 64148  	if nArg == 2 {
 64149  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 64150  	}
 64151  }
 64152  
 64153  // Implementation of the counter(X) function.  If X is an integer
 64154  // constant, then the first invocation will return X.  The second X+1.
 64155  // and so forth.  Can be used (for example) to provide a sequence number
 64156  // in a result set.
 64157  func counterFunc(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:243:13: */
 64158  	var pCounter uintptr = sqlite3.Xsqlite3_get_auxdata(tls, pCtx, 0)
 64159  	if pCounter == uintptr(0) {
 64160  		pCounter = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(int32(0))))
 64161  		if pCounter == uintptr(0) {
 64162  			sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 64163  			return
 64164  		}
 64165  		*(*int32)(unsafe.Pointer(pCounter)) = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64166  		sqlite3.Xsqlite3_set_auxdata(tls, pCtx, 0, pCounter, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 64167  	} else {
 64168  		*(*int32)(unsafe.Pointer(pCounter))++
 64169  	}
 64170  	sqlite3.Xsqlite3_result_int(tls, pCtx, *(*int32)(unsafe.Pointer(pCounter)))
 64171  }
 64172  
 64173  // This function takes two arguments.  It performance UTF-8/16 type
 64174  // conversions on the first argument then returns a copy of the second
 64175  // argument.
 64176  //
 64177  // This function is used in cases such as the following:
 64178  //
 64179  //      SELECT test_isolation(x,x) FROM t1;
 64180  //
 64181  // We want to verify that the type conversions that occur on the
 64182  // first argument do not invalidate the second argument.
 64183  func test_isolation(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:276:13: */
 64184  	sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64185  	sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64186  	sqlite3.Xsqlite3_value_text16(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64187  	sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64188  	sqlite3.Xsqlite3_result_value(tls, pCtx, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 64189  }
 64190  
 64191  // Invoke an SQL statement recursively.  The function result is the
 64192  // first column of the first row of the result set.
 64193  func test_eval(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:294:13: */
 64194  	bp := tls.Alloc(12)
 64195  	defer tls.Free(12)
 64196  
 64197  	// var pStmt uintptr at bp+8, 4
 64198  
 64199  	var rc int32
 64200  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, pCtx)
 64201  	var zSql uintptr
 64202  
 64203  	zSql = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64204  	rc = sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, -1, bp+8 /* &pStmt */, uintptr(0))
 64205  	if rc == SQLITE_OK {
 64206  		rc = sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 64207  		if rc == SQLITE_ROW {
 64208  			sqlite3.Xsqlite3_result_value(tls, pCtx, sqlite3.Xsqlite3_column_value(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)), 0))
 64209  		}
 64210  		rc = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp + 8 /* pStmt */)))
 64211  	}
 64212  	if rc != 0 {
 64213  		var zErr uintptr
 64214  
 64215  		zErr = sqlite3.Xsqlite3_mprintf(tls, ts+31358 /* "sqlite3_prepare_..." */, libc.VaList(bp, sqlite3.Xsqlite3_errmsg(tls, db)))
 64216  		sqlite3.Xsqlite3_result_text(tls, pCtx, zErr, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 64217  		sqlite3.Xsqlite3_result_error_code(tls, pCtx, rc)
 64218  	}
 64219  }
 64220  
 64221  // convert one character from hex to binary
 64222  func testHexChar(tls *libc.TLS, c int8) int32 { /* test_func.c:326:12: */
 64223  	if (int32(c) >= '0') && (int32(c) <= '9') {
 64224  		return (int32(c) - '0')
 64225  	} else if (int32(c) >= 'a') && (int32(c) <= 'f') {
 64226  		return ((int32(c) - 'a') + 10)
 64227  	} else if (int32(c) >= 'A') && (int32(c) <= 'F') {
 64228  		return ((int32(c) - 'A') + 10)
 64229  	}
 64230  	return 0
 64231  }
 64232  
 64233  // Convert hex to binary.
 64234  func testHexToBin(tls *libc.TLS, zIn uintptr, zOut uintptr) { /* test_func.c:340:13: */
 64235  	for (*(*int8)(unsafe.Pointer(zIn)) != 0) && (*(*int8)(unsafe.Pointer(zIn + 1)) != 0) {
 64236  		*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zOut, 1))) = (int8((testHexChar(tls, *(*int8)(unsafe.Pointer(zIn))) << 4) + testHexChar(tls, *(*int8)(unsafe.Pointer(zIn + 1)))))
 64237  		zIn += uintptr(2)
 64238  	}
 64239  }
 64240  
 64241  //      hex_to_utf16be(HEX)
 64242  //
 64243  // Convert the input string from HEX into binary.  Then return the
 64244  // result using sqlite3_result_text16le().
 64245  func testHexToUtf16be(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:354:13: */
 64246  	var n int32
 64247  	var zIn uintptr
 64248  	var zOut uintptr
 64249  
 64250  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64251  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64252  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 64253  	if zOut == uintptr(0) {
 64254  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 64255  	} else {
 64256  		testHexToBin(tls, zIn, zOut)
 64257  		sqlite3.Xsqlite3_result_text16be(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 64258  	}
 64259  }
 64260  
 64261  //      hex_to_utf8(HEX)
 64262  //
 64263  // Convert the input string from HEX into binary.  Then return the
 64264  // result using sqlite3_result_text16le().
 64265  func testHexToUtf8(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:381:13: */
 64266  	var n int32
 64267  	var zIn uintptr
 64268  	var zOut uintptr
 64269  
 64270  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64271  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64272  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 64273  	if zOut == uintptr(0) {
 64274  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 64275  	} else {
 64276  		testHexToBin(tls, zIn, zOut)
 64277  		sqlite3.Xsqlite3_result_text(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 64278  	}
 64279  }
 64280  
 64281  //      hex_to_utf16le(HEX)
 64282  //
 64283  // Convert the input string from HEX into binary.  Then return the
 64284  // result using sqlite3_result_text16le().
 64285  func testHexToUtf16le(tls *libc.TLS, pCtx uintptr, nArg int32, argv uintptr) { /* test_func.c:408:13: */
 64286  	var n int32
 64287  	var zIn uintptr
 64288  	var zOut uintptr
 64289  
 64290  	n = sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64291  	zIn = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64292  	zOut = sqlite3.Xsqlite3_malloc(tls, (n / 2))
 64293  	if zOut == uintptr(0) {
 64294  		sqlite3.Xsqlite3_result_error_nomem(tls, pCtx)
 64295  	} else {
 64296  		testHexToBin(tls, zIn, zOut)
 64297  		sqlite3.Xsqlite3_result_text16le(tls, pCtx, zOut, (n / 2), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 64298  	}
 64299  }
 64300  
 64301  // SQL function:   real2hex(X)
 64302  //
 64303  // If argument X is a real number, then convert it into a string which is
 64304  // the big-endian hexadecimal representation of the ieee754 encoding of
 64305  // that number.  If X is not a real number, return NULL.
 64306  func real2hex(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:436:13: */
 64307  	bp := tls.Alloc(28)
 64308  	defer tls.Free(28)
 64309  
 64310  	// var v struct {Fi sqlite3_uint64;} at bp, 8
 64311  
 64312  	// var zOut [20]int8 at bp+8, 20
 64313  
 64314  	var i int32
 64315  	var bigEndian int32
 64316  	*(*sqlite3_uint64)(unsafe.Pointer(bp /* &v */)) = uint64(1)
 64317  	bigEndian = (libc.Bool32(int32(*(*uint8)(unsafe.Pointer((bp /* &v */ /* &.x */)))) == 0))
 64318  	*(*float64)(unsafe.Pointer(bp /* &v */)) = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64319  	for i = 0; i < 8; i++ {
 64320  		if bigEndian != 0 {
 64321  			*(*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))))
 64322  			*(*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))))
 64323  		} else {
 64324  			*(*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))))
 64325  			*(*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))))
 64326  		}
 64327  	}
 64328  	*(*int8)(unsafe.Pointer(bp + 8 /* &zOut[0] */ + 16)) = int8(0)
 64329  	sqlite3.Xsqlite3_result_text(tls, context, bp+8 /* &zOut[0] */, -1, libc.UintptrFromInt32(-1))
 64330  }
 64331  
 64332  //     test_extract(record, field)
 64333  //
 64334  // This function implements an SQL user-function that accepts a blob
 64335  // containing a formatted database record as the first argument. The
 64336  // second argument is the index of the field within that record to
 64337  // extract and return.
 64338  func test_extract(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:473:13: */
 64339  	bp := tls.Alloc(56)
 64340  	defer tls.Free(56)
 64341  
 64342  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 64343  	var pRec uintptr
 64344  	var pEndHdr uintptr // Points to one byte past record header
 64345  	var pHdr uintptr    // Current point in record header
 64346  	var pBody uintptr   // Current point in record data
 64347  	// var nHdr u64 at bp, 8
 64348  	// Bytes in record header
 64349  	var iIdx int32         // Required field
 64350  	var iCurrent int32 = 0 // Current field
 64351  
 64352  	pRec = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64353  	iIdx = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 64354  
 64355  	pHdr = (pRec + uintptr(sqlite3.Xsqlite3GetVarint(tls, pRec, bp /* &nHdr */)))
 64356  	pBody = libc.AssignUintptr(&pEndHdr, (pRec + uintptr(*(*u64)(unsafe.Pointer(bp /* nHdr */)))))
 64357  
 64358  	for iCurrent = 0; (pHdr < pEndHdr) && (iCurrent <= iIdx); iCurrent++ {
 64359  		// var iSerialType u64 at bp+48, 8
 64360  
 64361  		// var mem Mem at bp+8, 40
 64362  
 64363  		libc.Xmemset(tls, bp+8 /* &mem */, 0, uint32(unsafe.Sizeof(Mem{})))
 64364  		(*Mem)(unsafe.Pointer(bp + 8 /* &mem */)).Fdb = db
 64365  		(*Mem)(unsafe.Pointer(bp + 8 /* &mem */)).Fenc = (*sqlite31)(unsafe.Pointer(db)).Fenc
 64366  		pHdr += uintptr(sqlite3.Xsqlite3GetVarint(tls, pHdr, bp+48 /* &iSerialType */))
 64367  		pBody += uintptr(sqlite3.Xsqlite3VdbeSerialGet(tls, pBody, u32(*(*u64)(unsafe.Pointer(bp + 48 /* iSerialType */))), bp+8 /* &mem */))
 64368  
 64369  		if iCurrent == iIdx {
 64370  			sqlite3.Xsqlite3_result_value(tls, context, bp+8 /* &mem */)
 64371  		}
 64372  
 64373  		if (*Mem)(unsafe.Pointer(bp+8 /* &mem */)).FszMalloc != 0 {
 64374  			sqlite3.Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(bp+8 /* &mem */)).FzMalloc)
 64375  		}
 64376  	}
 64377  }
 64378  
 64379  //      test_decode(record)
 64380  //
 64381  // This function implements an SQL user-function that accepts a blob
 64382  // containing a formatted database record as its only argument. It returns
 64383  // a tcl list (type SQLITE_TEXT) containing each of the values stored
 64384  // in the record.
 64385  func test_decode(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:520:13: */
 64386  	bp := tls.Alloc(107)
 64387  	defer tls.Free(107)
 64388  
 64389  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 64390  	var pRec uintptr
 64391  	var pEndHdr uintptr // Points to one byte past record header
 64392  	var pHdr uintptr    // Current point in record header
 64393  	var pBody uintptr   // Current point in record data
 64394  	// var nHdr u64 at bp+32, 8
 64395  	// Bytes in record header
 64396  	var pRet uintptr // Return value
 64397  
 64398  	pRet = tcl.XTcl_NewObj(tls)
 64399  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 64400  
 64401  	pRec = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64402  
 64403  	pHdr = (pRec + uintptr(sqlite3.Xsqlite3GetVarint(tls, pRec, bp+32 /* &nHdr */)))
 64404  	pBody = libc.AssignUintptr(&pEndHdr, (pRec + uintptr(*(*u64)(unsafe.Pointer(bp + 32 /* nHdr */)))))
 64405  	for pHdr < pEndHdr {
 64406  		var pVal uintptr = uintptr(0)
 64407  		// var iSerialType u64 at bp+80, 8
 64408  
 64409  		// var mem Mem at bp+40, 40
 64410  
 64411  		libc.Xmemset(tls, bp+40 /* &mem */, 0, uint32(unsafe.Sizeof(Mem{})))
 64412  		(*Mem)(unsafe.Pointer(bp + 40 /* &mem */)).Fdb = db
 64413  		(*Mem)(unsafe.Pointer(bp + 40 /* &mem */)).Fenc = (*sqlite31)(unsafe.Pointer(db)).Fenc
 64414  		pHdr += uintptr(sqlite3.Xsqlite3GetVarint(tls, pHdr, bp+80 /* &iSerialType */))
 64415  		pBody += uintptr(sqlite3.Xsqlite3VdbeSerialGet(tls, pBody, u32(*(*u64)(unsafe.Pointer(bp + 80 /* iSerialType */))), bp+40 /* &mem */))
 64416  
 64417  		switch sqlite3.Xsqlite3_value_type(tls, bp+40 /* &mem */) {
 64418  		case SQLITE_TEXT:
 64419  			pVal = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, bp+40 /* &mem */), -1)
 64420  			break
 64421  
 64422  		case SQLITE_BLOB:
 64423  			{
 64424  				*(*[16]int8)(unsafe.Pointer(bp + 91 /* hexdigit */)) = [16]int8{
 64425  					int8('0'), int8('1'), int8('2'), int8('3'), int8('4'), int8('5'), int8('6'), int8('7'),
 64426  					int8('8'), int8('9'), int8('a'), int8('b'), int8('c'), int8('d'), int8('e'), int8('f'),
 64427  				}
 64428  				var n int32 = sqlite3.Xsqlite3_value_bytes(tls, bp+40 /* &mem */)
 64429  				var z uintptr = sqlite3.Xsqlite3_value_blob(tls, bp+40 /* &mem */)
 64430  				var i int32
 64431  				pVal = tcl.XTcl_NewStringObj(tls, ts+31406 /* "x'" */, -1)
 64432  				for i = 0; i < n; i++ {
 64433  					// var hex [3]int8 at bp+88, 3
 64434  
 64435  					*(*int8)(unsafe.Pointer(bp + 88 /* &hex[0] */)) = *(*int8)(unsafe.Pointer(bp + 91 /* &hexdigit[0] */ + uintptr(((int32(*(*u8)(unsafe.Pointer(z + uintptr(i)))) >> 4) & 0x0F))))
 64436  					*(*int8)(unsafe.Pointer(bp + 88 /* &hex[0] */ + 1)) = *(*int8)(unsafe.Pointer(bp + 91 /* &hexdigit[0] */ + uintptr((int32(*(*u8)(unsafe.Pointer(z + uintptr(i)))) & 0x0F))))
 64437  					*(*int8)(unsafe.Pointer(bp + 88 /* &hex[0] */ + 2)) = int8(0)
 64438  					tcl.XTcl_AppendStringsToObj(tls, pVal, libc.VaList(bp, bp+88 /* &hex[0] */, 0))
 64439  				}
 64440  				tcl.XTcl_AppendStringsToObj(tls, pVal, libc.VaList(bp+16, ts+5485 /* "'" */, 0))
 64441  				break
 64442  
 64443  			}
 64444  
 64445  		case SQLITE_FLOAT:
 64446  			pVal = tcl.XTcl_NewDoubleObj(tls, sqlite3.Xsqlite3_value_double(tls, bp+40 /* &mem */))
 64447  			break
 64448  
 64449  		case SQLITE_INTEGER:
 64450  			pVal = tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_value_int64(tls, bp+40 /* &mem */))
 64451  			break
 64452  
 64453  		case SQLITE_NULL:
 64454  			pVal = tcl.XTcl_NewStringObj(tls, ts+5707 /* "NULL" */, -1)
 64455  			break
 64456  
 64457  		default:
 64458  
 64459  		}
 64460  
 64461  		tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRet, pVal)
 64462  
 64463  		if (*Mem)(unsafe.Pointer(bp+40 /* &mem */)).FszMalloc != 0 {
 64464  			sqlite3.Xsqlite3DbFree(tls, db, (*Mem)(unsafe.Pointer(bp+40 /* &mem */)).FzMalloc)
 64465  		}
 64466  	}
 64467  
 64468  	sqlite3.Xsqlite3_result_text(tls, context, tcl.XTcl_GetString(tls, pRet), -1, libc.UintptrFromInt32(-1))
 64469  	for ok := true; ok; ok = 0 != 0 {
 64470  		var _objPtr uintptr = pRet
 64471  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 64472  			tcl.XTclFreeObj(tls, _objPtr)
 64473  		}
 64474  	}
 64475  }
 64476  
 64477  //       test_zeroblob(N)
 64478  //
 64479  // The implementation of scalar SQL function "test_zeroblob()". This is
 64480  // similar to the built-in zeroblob() function, except that it does not
 64481  // check that the integer parameter is within range before passing it
 64482  // to sqlite3_result_zeroblob().
 64483  func test_zeroblob(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:612:13: */
 64484  	var nZero int32 = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 64485  	sqlite3.Xsqlite3_result_zeroblob(tls, context, nZero)
 64486  }
 64487  
 64488  // test_getsubtype(V)
 64489  //
 64490  // Return the subtype for value V.
 64491  func test_getsubtype(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:625:13: */
 64492  	sqlite3.Xsqlite3_result_int(tls, context, int32(sqlite3.Xsqlite3_value_subtype(tls, *(*uintptr)(unsafe.Pointer(argv)))))
 64493  }
 64494  
 64495  // test_frombind(A,B,C,...)
 64496  //
 64497  // Return an integer bitmask that has a bit set for every argument
 64498  // (up to the first 63 arguments) that originates from a bind a parameter.
 64499  func test_frombind(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:638:13: */
 64500  	var m sqlite3_uint64 = uint64(0)
 64501  	var i int32
 64502  	for i = 0; (i < argc) && (i < 63); i++ {
 64503  		if sqlite3.Xsqlite3_value_frombind(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4))) != 0 {
 64504  			m = m | (sqlite3_uint64((uint64(1))) << i)
 64505  		}
 64506  	}
 64507  	sqlite3.Xsqlite3_result_int64(tls, context, sqlite3_int64(m))
 64508  }
 64509  
 64510  // test_setsubtype(V, T)
 64511  //
 64512  // Return the value V with its subtype changed to T
 64513  func test_setsubtype(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_func.c:655:13: */
 64514  	sqlite3.Xsqlite3_result_value(tls, context, *(*uintptr)(unsafe.Pointer(argv)))
 64515  	sqlite3.Xsqlite3_result_subtype(tls, context, uint32(sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))))
 64516  }
 64517  
 64518  func registerTestFunctions(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pThunk uintptr) int32 { /* test_func.c:664:12: */
 64519  	var i int32
 64520  
 64521  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aFuncs)) / uint32(unsafe.Sizeof(struct {
 64522  		FzName    uintptr
 64523  		FnArg     int8
 64524  		_         [3]byte
 64525  		FeTextRep uint32
 64526  		FxFunc    uintptr
 64527  	}{}))); i++ {
 64528  		sqlite3.Xsqlite3_create_function(tls, db, aFuncs[i].FzName, int32(aFuncs[i].FnArg),
 64529  			int32(aFuncs[i].FeTextRep), uintptr(0), aFuncs[i].FxFunc, uintptr(0), uintptr(0))
 64530  	}
 64531  
 64532  	sqlite3.Xsqlite3_create_function(tls, db, ts+31409 /* "test_agg_errmsg1..." */, 0, SQLITE_ANY, uintptr(0), uintptr(0),
 64533  		*(*uintptr)(unsafe.Pointer(&struct {
 64534  			f func(*libc.TLS, uintptr, int32, uintptr)
 64535  		}{test_agg_errmsg16_step})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{test_agg_errmsg16_final})))
 64536  
 64537  	return SQLITE_OK
 64538  }
 64539  
 64540  var aFuncs = [20]struct {
 64541  	FzName    uintptr
 64542  	FnArg     int8
 64543  	_         [3]byte
 64544  	FeTextRep uint32
 64545  	FxFunc    uintptr
 64546  }{
 64547  	{FzName: ts + 31427 /* "randstr" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64548  	{FzName: ts + 31435 /* "test_destructor" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64549  	{FzName: ts + 31451 /* "test_destructor1..." */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64550  	{FzName: ts + 31469 /* "hex_to_utf16be" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64551  	{FzName: ts + 31484 /* "hex_to_utf16le" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64552  	{FzName: ts + 31499 /* "hex_to_utf8" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64553  	{FzName: ts + 31511 /* "test_destructor_..." */, FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64554  	{FzName: ts + 31533 /* "test_auxdata" */, FnArg: int8(-1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64555  	{FzName: ts + 31546 /* "test_error" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64556  	{FzName: ts + 31546 /* "test_error" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64557  	{FzName: ts + 31557 /* "test_eval" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64558  	{FzName: ts + 31567 /* "test_isolation" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64559  	{FzName: ts + 31582 /* "test_counter" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64560  	{FzName: ts + 31595 /* "real2hex" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64561  	{FzName: ts + 31604 /* "test_decode" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64562  	{FzName: ts + 31616 /* "test_extract" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64563  	{FzName: ts + 31629 /* "test_zeroblob" */, FnArg: int8(1), FeTextRep: (uint32(SQLITE_UTF8 | SQLITE_DETERMINISTIC)), FxFunc: 0},
 64564  	{FzName: ts + 31643 /* "test_getsubtype" */, FnArg: int8(1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64565  	{FzName: ts + 31659 /* "test_setsubtype" */, FnArg: int8(2), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64566  	{FzName: ts + 31675 /* "test_frombind" */, FnArg: int8(-1), FeTextRep: uint32(SQLITE_UTF8), FxFunc: 0},
 64567  } /* test_func.c:674:5 */
 64568  
 64569  // TCLCMD:  autoinstall_test_functions
 64570  //
 64571  // Invoke this TCL command to use sqlite3_auto_extension() to cause
 64572  // the standard set of test functions to be loaded into each new
 64573  // database connection.
 64574  func autoinstall_test_funcs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:718:26: */
 64575  	var rc int32 = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 64576  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 64577  	}{registerTestFunctions})))
 64578  	if rc == SQLITE_OK {
 64579  		rc = sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 64580  			f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 64581  		}{Md5_Register})))
 64582  	}
 64583  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 64584  	return TCL_OK
 64585  }
 64586  
 64587  // A bogus step function and finalizer function.
 64588  func tStep(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_func.c:736:13: */
 64589  }
 64590  
 64591  func tFinal(tls *libc.TLS, a uintptr) { /* test_func.c:737:13: */
 64592  }
 64593  
 64594  // tclcmd:  abuse_create_function
 64595  //
 64596  // Make various calls to sqlite3_create_function that do not have valid
 64597  // parameters.  Verify that the error condition is detected and reported.
 64598  func abuse_create_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:746:26: */
 64599  	bp := tls.Alloc(20)
 64600  	defer tls.Free(20)
 64601  
 64602  	// var db uintptr at bp+16, 4
 64603  
 64604  	var rc int32
 64605  	var mxArg int32
 64606  
 64607  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0) {
 64608  		goto __1
 64609  	}
 64610  	return TCL_ERROR
 64611  __1:
 64612  	;
 64613  
 64614  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64615  		f func(*libc.TLS, uintptr, int32, uintptr)
 64616  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct {
 64617  		f func(*libc.TLS, uintptr, int32, uintptr)
 64618  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tFinal})))
 64619  	if !(rc != SQLITE_MISUSE) {
 64620  		goto __2
 64621  	}
 64622  	goto abuse_err
 64623  __2:
 64624  	;
 64625  
 64626  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64627  		f func(*libc.TLS, uintptr, int32, uintptr)
 64628  	}{tStep})), *(*uintptr)(unsafe.Pointer(&struct {
 64629  		f func(*libc.TLS, uintptr, int32, uintptr)
 64630  	}{tStep})), uintptr(0))
 64631  	if !(rc != SQLITE_MISUSE) {
 64632  		goto __3
 64633  	}
 64634  	goto abuse_err
 64635  __3:
 64636  	;
 64637  
 64638  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64639  		f func(*libc.TLS, uintptr, int32, uintptr)
 64640  	}{tStep})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tFinal})))
 64641  	if !(rc != SQLITE_MISUSE) {
 64642  		goto __4
 64643  	}
 64644  	goto abuse_err
 64645  __4:
 64646  	;
 64647  
 64648  	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})))
 64649  	if !(rc != SQLITE_MISUSE) {
 64650  		goto __5
 64651  	}
 64652  	goto abuse_err
 64653  __5:
 64654  	;
 64655  
 64656  	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 {
 64657  		f func(*libc.TLS, uintptr, int32, uintptr)
 64658  	}{tStep})), uintptr(0))
 64659  	if !(rc != SQLITE_MISUSE) {
 64660  		goto __6
 64661  	}
 64662  	goto abuse_err
 64663  __6:
 64664  	;
 64665  
 64666  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, -2, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64667  		f func(*libc.TLS, uintptr, int32, uintptr)
 64668  	}{tStep})), uintptr(0), uintptr(0))
 64669  	if !(rc != SQLITE_MISUSE) {
 64670  		goto __7
 64671  	}
 64672  	goto abuse_err
 64673  __7:
 64674  	;
 64675  
 64676  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), ts+31689 /* "tx" */, 128, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64677  		f func(*libc.TLS, uintptr, int32, uintptr)
 64678  	}{tStep})), uintptr(0), uintptr(0))
 64679  	if !(rc != SQLITE_MISUSE) {
 64680  		goto __8
 64681  	}
 64682  	goto abuse_err
 64683  __8:
 64684  	;
 64685  
 64686  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)),
 64687  
 64688  		ts+31692, /* "funcxx_123456789..." */
 64689  		1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64690  			f func(*libc.TLS, uintptr, int32, uintptr)
 64691  		}{tStep})), uintptr(0), uintptr(0))
 64692  	if !(rc != SQLITE_MISUSE) {
 64693  		goto __9
 64694  	}
 64695  	goto abuse_err
 64696  __9:
 64697  	;
 64698  
 64699  	// This last function registration should actually work.  Generate
 64700  	// a no-op function (that always returns NULL) and which has the
 64701  	// maximum-length function name and the maximum number of parameters.
 64702  	sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), SQLITE_LIMIT_FUNCTION_ARG, 10000)
 64703  	mxArg = sqlite3.Xsqlite3_limit(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), SQLITE_LIMIT_FUNCTION_ARG, -1)
 64704  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)),
 64705  
 64706  		ts+31949, /* "nullx_123456789_..." */
 64707  		mxArg, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64708  			f func(*libc.TLS, uintptr, int32, uintptr)
 64709  		}{tStep})), uintptr(0), uintptr(0))
 64710  	if !(rc != SQLITE_OK) {
 64711  		goto __10
 64712  	}
 64713  	goto abuse_err
 64714  __10:
 64715  	;
 64716  
 64717  	return TCL_OK
 64718  
 64719  abuse_err:
 64720  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32205, /* "sqlite3_create_f..." */
 64721  		uintptr(0)))
 64722  	return TCL_ERROR
 64723  }
 64724  
 64725  // SQLite user defined function to use with matchinfo() to calculate the
 64726  // relevancy of an FTS match. The value returned is the relevancy score
 64727  // (a real value greater than or equal to zero). A larger value indicates
 64728  // a more relevant document.
 64729  //
 64730  // The overall relevancy returned is the sum of the relevancies of each
 64731  // column value in the FTS table. The relevancy of a column value is the
 64732  // sum of the following for each reportable phrase in the FTS query:
 64733  //
 64734  //   (<hit count> / <global hit count>) * <column weight>
 64735  //
 64736  // where <hit count> is the number of instances of the phrase in the
 64737  // column value of the current row and <global hit count> is the number
 64738  // of instances of the phrase in the same column of all rows in the FTS
 64739  // table. The <column weight> is a weighting factor assigned to each
 64740  // column by the caller (see below).
 64741  //
 64742  // The first argument to this function must be the return value of the FTS
 64743  // matchinfo() function. Following this must be one argument for each column
 64744  // of the FTS table containing a numeric weight factor for the corresponding
 64745  // column. Example:
 64746  //
 64747  //     CREATE VIRTUAL TABLE documents USING fts3(title, content)
 64748  //
 64749  // The following query returns the docids of documents that match the full-text
 64750  // query <query> sorted from most to least relevant. When calculating
 64751  // relevance, query term instances in the 'title' column are given twice the
 64752  // weighting of those in the 'content' column.
 64753  //
 64754  //     SELECT docid FROM documents
 64755  //     WHERE documents MATCH <query>
 64756  //     ORDER BY rank(matchinfo(documents), 1.0, 0.5) DESC
 64757  func rankfunc(tls *libc.TLS, pCtx uintptr, nVal int32, apVal uintptr) { /* test_func.c:847:13: */
 64758  	var aMatchinfo uintptr // Return value of matchinfo()
 64759  	var nMatchinfo int32   // Number of elements in aMatchinfo[]
 64760  	var nCol int32         // Number of columns in the table
 64761  	var nPhrase int32      // Number of phrases in the query
 64762  	var iPhrase int32      // Current phrase
 64763  	var score float64
 64764  	var nHitCount int32
 64765  	var nGlobalHitCount int32
 64766  	var weight float64
 64767  	var iCol int32 // Current column
 64768  
 64769  	// Now iterate through each column in the users query. For each column,
 64770  	// increment the relevancy score by:
 64771  	//
 64772  	//   (<hit count> / <global hit count>) * <column weight>
 64773  	//
 64774  	// aPhraseinfo[] points to the start of the data for phrase iPhrase. So
 64775  	// the hit count and global hit counts for each column are found in
 64776  	// aPhraseinfo[iCol*3] and aPhraseinfo[iCol*3+1], respectively.
 64777  	var aPhraseinfo uintptr
 64778  	nCol = 0
 64779  	nPhrase = 0
 64780  	score = 0.0 // Value to return
 64781  
 64782  	// Check that the number of arguments passed to this function is correct.
 64783  	// If not, jump to wrong_number_args. Set aMatchinfo to point to the array
 64784  	// of unsigned integer values returned by FTS function matchinfo. Set
 64785  	// nPhrase to contain the number of reportable phrases in the users full-text
 64786  	// query, and nCol to the number of columns in the table. Then check that the
 64787  	// size of the matchinfo blob is as expected. Return an error if it is not.
 64788  	if !(nVal < 1) {
 64789  		goto __1
 64790  	}
 64791  	goto wrong_number_args
 64792  __1:
 64793  	;
 64794  	aMatchinfo = sqlite3.Xsqlite3_value_blob(tls, *(*uintptr)(unsafe.Pointer(apVal)))
 64795  	nMatchinfo = (int32(uint32(sqlite3.Xsqlite3_value_bytes(tls, *(*uintptr)(unsafe.Pointer(apVal)))) / uint32(unsafe.Sizeof(int32(0)))))
 64796  	if !(nMatchinfo >= 2) {
 64797  		goto __2
 64798  	}
 64799  	nPhrase = *(*int32)(unsafe.Pointer(aMatchinfo))
 64800  	nCol = *(*int32)(unsafe.Pointer(aMatchinfo + 1*4))
 64801  __2:
 64802  	;
 64803  	if !(nMatchinfo != (2 + ((3 * nCol) * nPhrase))) {
 64804  		goto __3
 64805  	}
 64806  	sqlite3.Xsqlite3_result_error(tls, pCtx,
 64807  		ts+32248 /* "invalid matchinf..." */, -1)
 64808  	return
 64809  __3:
 64810  	;
 64811  	if !(nVal != (1 + nCol)) {
 64812  		goto __4
 64813  	}
 64814  	goto wrong_number_args
 64815  __4:
 64816  	;
 64817  
 64818  	// Iterate through each phrase in the users query.
 64819  	iPhrase = 0
 64820  __5:
 64821  	if !(iPhrase < nPhrase) {
 64822  		goto __7
 64823  	} // Current column
 64824  
 64825  	// Now iterate through each column in the users query. For each column,
 64826  	// increment the relevancy score by:
 64827  	//
 64828  	//   (<hit count> / <global hit count>) * <column weight>
 64829  	//
 64830  	// aPhraseinfo[] points to the start of the data for phrase iPhrase. So
 64831  	// the hit count and global hit counts for each column are found in
 64832  	// aPhraseinfo[iCol*3] and aPhraseinfo[iCol*3+1], respectively.
 64833  	aPhraseinfo = (aMatchinfo + uintptr((2+((iPhrase*nCol)*3)))*4)
 64834  	iCol = 0
 64835  __8:
 64836  	if !(iCol < nCol) {
 64837  		goto __10
 64838  	}
 64839  	nHitCount = *(*int32)(unsafe.Pointer(aPhraseinfo + uintptr((3*iCol))*4))
 64840  	nGlobalHitCount = *(*int32)(unsafe.Pointer(aPhraseinfo + uintptr(((3*iCol)+1))*4))
 64841  	weight = sqlite3.Xsqlite3_value_double(tls, *(*uintptr)(unsafe.Pointer(apVal + uintptr((iCol+1))*4)))
 64842  	if !(nHitCount > 0) {
 64843  		goto __11
 64844  	}
 64845  	score = score + ((float64(nHitCount) / float64(nGlobalHitCount)) * weight)
 64846  __11:
 64847  	;
 64848  	goto __9
 64849  __9:
 64850  	iCol++
 64851  	goto __8
 64852  	goto __10
 64853  __10:
 64854  	;
 64855  	goto __6
 64856  __6:
 64857  	iPhrase++
 64858  	goto __5
 64859  	goto __7
 64860  __7:
 64861  	;
 64862  
 64863  	sqlite3.Xsqlite3_result_double(tls, pCtx, score)
 64864  	return
 64865  
 64866  	// Jump here if the wrong number of arguments are passed to this function
 64867  wrong_number_args:
 64868  	sqlite3.Xsqlite3_result_error(tls, pCtx, ts+32297 /* "wrong number of ..." */, -1)
 64869  }
 64870  
 64871  func install_fts3_rank_function(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_func.c:910:26: */
 64872  	bp := tls.Alloc(4)
 64873  	defer tls.Free(4)
 64874  
 64875  	// var db uintptr at bp, 4
 64876  
 64877  	if objc != 2 {
 64878  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 64879  		return TCL_ERROR
 64880  	}
 64881  
 64882  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 64883  		return TCL_ERROR
 64884  	}
 64885  	sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+32342 /* "rank" */, -1, SQLITE_UTF8, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 64886  		f func(*libc.TLS, uintptr, int32, uintptr)
 64887  	}{rankfunc})), uintptr(0), uintptr(0))
 64888  	return TCL_OK
 64889  }
 64890  
 64891  // Register commands with the TCL interpreter.
 64892  func Sqlitetest_func_Init(tls *libc.TLS, interp uintptr) int32 { /* test_func.c:933:5: */
 64893  	var i int32
 64894  
 64895  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd7)) / uint32(unsafe.Sizeof(struct {
 64896  		FzName uintptr
 64897  		FxProc uintptr
 64898  	}{}))); i++ {
 64899  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd7[i].FzName, aObjCmd7[i].FxProc, uintptr(0), uintptr(0))
 64900  	}
 64901  	sqlite3.Xsqlite3_initialize(tls)
 64902  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 64903  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 64904  	}{registerTestFunctions})))
 64905  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 64906  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 64907  	}{Md5_Register})))
 64908  	return TCL_OK
 64909  }
 64910  
 64911  var aObjCmd7 = [3]struct {
 64912  	FzName uintptr
 64913  	FxProc uintptr
 64914  }{
 64915  	{FzName: ts + 32347 /* "autoinstall_test..." */, FxProc: 0},
 64916  	{FzName: ts + 32374 /* "abuse_create_fun..." */, FxProc: 0},
 64917  	{FzName: ts + 32396 /* "install_fts3_ran..." */, FxProc: 0},
 64918  } /* test_func.c:937:5 */
 64919  
 64920  // Some versions of <linux/posix_types.h> define this macros.
 64921  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 64922  
 64923  // fd_set for select and pselect.
 64924  type fd_set3 = struct{ Ffds_bits [32]int32 } /* select.h:70:5 */
 64925  
 64926  // end block for C++
 64927  
 64928  // Local Variables:
 64929  // mode: c
 64930  // c-basic-offset: 4
 64931  // fill-column: 78
 64932  // End:
 64933  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 64934  //    This file is part of the GNU C Library.
 64935  //
 64936  //    The GNU C Library is free software; you can redistribute it and/or
 64937  //    modify it under the terms of the GNU Lesser General Public
 64938  //    License as published by the Free Software Foundation; either
 64939  //    version 2.1 of the License, or (at your option) any later version.
 64940  //
 64941  //    The GNU C Library is distributed in the hope that it will be useful,
 64942  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 64943  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 64944  //    Lesser General Public License for more details.
 64945  //
 64946  //    You should have received a copy of the GNU Lesser General Public
 64947  //    License along with the GNU C Library; if not, see
 64948  //    <http://www.gnu.org/licenses/>.
 64949  
 64950  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 64951  
 64952  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 64953  //    This file is part of the GNU C Library.
 64954  //
 64955  //    The GNU C Library is free software; you can redistribute it and/or
 64956  //    modify it under the terms of the GNU Lesser General Public
 64957  //    License as published by the Free Software Foundation; either
 64958  //    version 2.1 of the License, or (at your option) any later version.
 64959  //
 64960  //    The GNU C Library is distributed in the hope that it will be useful,
 64961  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 64962  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 64963  //    Lesser General Public License for more details.
 64964  //
 64965  //    You should have received a copy of the GNU Lesser General Public
 64966  //    License along with the GNU C Library; if not, see
 64967  //    <http://www.gnu.org/licenses/>.
 64968  
 64969  //	ISO C99 Standard: 7.21 String handling	<string.h>
 64970  
 64971  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 64972  //    This file is part of the GNU C Library.
 64973  //
 64974  //    The GNU C Library is free software; you can redistribute it and/or
 64975  //    modify it under the terms of the GNU Lesser General Public
 64976  //    License as published by the Free Software Foundation; either
 64977  //    version 2.1 of the License, or (at your option) any later version.
 64978  //
 64979  //    The GNU C Library is distributed in the hope that it will be useful,
 64980  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 64981  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 64982  //    Lesser General Public License for more details.
 64983  //
 64984  //    You should have received a copy of the GNU Lesser General Public
 64985  //    License along with the GNU C Library; if not, see
 64986  //    <http://www.gnu.org/licenses/>.
 64987  
 64988  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 64989  
 64990  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 64991  //    This file is part of the GNU C Library.
 64992  //
 64993  //    The GNU C Library is free software; you can redistribute it and/or
 64994  //    modify it under the terms of the GNU Lesser General Public
 64995  //    License as published by the Free Software Foundation; either
 64996  //    version 2.1 of the License, or (at your option) any later version.
 64997  //
 64998  //    The GNU C Library is distributed in the hope that it will be useful,
 64999  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 65000  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 65001  //    Lesser General Public License for more details.
 65002  //
 65003  //    You should have received a copy of the GNU Lesser General Public
 65004  //    License along with the GNU C Library; if not, see
 65005  //    <http://www.gnu.org/licenses/>.
 65006  
 65007  // void assert (int expression);
 65008  //
 65009  //    If NDEBUG is defined, do nothing.
 65010  //    If not, and EXPRESSION is zero, print an error message and abort.
 65011  
 65012  // void assert_perror (int errnum);
 65013  //
 65014  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 65015  //    error message with the error text for ERRNUM and abort.
 65016  //    (This is a GNU extension.)
 65017  
 65018  // Convert binary to hex.  The input zBuf[] contains N bytes of
 65019  // binary data.  zBuf[] is 2*n+1 bytes long.  Overwrite zBuf[]
 65020  // with a hexadecimal representation of its original binary input.
 65021  func sqlite3TestBinToHex(tls *libc.TLS, zBuf uintptr, N int32) { /* test_hexio.c:36:6: */
 65022  	bp := tls.Alloc(17)
 65023  	defer tls.Free(17)
 65024  
 65025  	*(*[17]uint8)(unsafe.Pointer(bp /* zHex */)) = *(*[17]uint8)(unsafe.Pointer(ts + 32423 /* "0123456789ABCDEF" */))
 65026  	var i int32
 65027  	var j int32
 65028  	var c uint8
 65029  	i = (N * 2)
 65030  	*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = uint8(0)
 65031  	for j = (N - 1); j >= 0; j-- {
 65032  		c = *(*uint8)(unsafe.Pointer(zBuf + uintptr(j)))
 65033  		*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = *(*uint8)(unsafe.Pointer(bp /* &zHex[0] */ + uintptr((int32(c) & 0xf))))
 65034  		*(*uint8)(unsafe.Pointer(zBuf + uintptr(libc.PostDecInt32(&i, 1)))) = *(*uint8)(unsafe.Pointer(bp /* &zHex[0] */ + uintptr((int32(c) >> 4))))
 65035  	}
 65036  
 65037  }
 65038  
 65039  // Convert hex to binary.  The input zIn[] contains N bytes of
 65040  // hexadecimal.  Convert this into binary and write aOut[] with
 65041  // the binary data.  Spaces in the original input are ignored.
 65042  // Return the number of bytes of binary rendered.
 65043  func sqlite3TestHexToBin(tls *libc.TLS, zIn uintptr, N int32, aOut uintptr) int32 { /* test_hexio.c:56:5: */
 65044  	bp := tls.Alloc(256)
 65045  	defer tls.Free(256)
 65046  
 65047  	*(*[256]uint8)(unsafe.Pointer(bp /* aMap */)) = [256]uint8{
 65048  		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),
 65049  		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),
 65050  		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),
 65051  		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),
 65052  		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),
 65053  		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),
 65054  		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),
 65055  		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),
 65056  		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),
 65057  		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),
 65058  		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),
 65059  		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),
 65060  		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),
 65061  		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),
 65062  		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),
 65063  		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),
 65064  	}
 65065  	var i int32
 65066  	var j int32
 65067  	var hi int32 = 1
 65068  	var c uint8
 65069  
 65070  	for i = libc.AssignInt32(&j, 0); i < N; i++ {
 65071  		c = *(*uint8)(unsafe.Pointer(bp /* &aMap[0] */ + uintptr(*(*uint8)(unsafe.Pointer(zIn + uintptr(i))))))
 65072  		if int32(c) == 0 {
 65073  			continue
 65074  		}
 65075  		if hi != 0 {
 65076  			*(*uint8)(unsafe.Pointer(aOut + uintptr(j))) = (uint8((int32(c) - 1) << 4))
 65077  			hi = 0
 65078  		} else {
 65079  			*(*uint8)(unsafe.Pointer(aOut + uintptr(libc.PostIncInt32(&j, 1)))) |= uint8((int32(c) - 1))
 65080  			hi = 1
 65081  		}
 65082  	}
 65083  	return j
 65084  }
 65085  
 65086  // Usage:   hexio_read  FILENAME  OFFSET  AMT
 65087  //
 65088  // Read AMT bytes from file FILENAME beginning at OFFSET from the
 65089  // beginning of the file.  Convert that information to hexadecimal
 65090  // and return the resulting HEX string.
 65091  func hexio_read(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:101:26: */
 65092  	bp := tls.Alloc(48)
 65093  	defer tls.Free(48)
 65094  
 65095  	// var offset int32 at bp+40, 4
 65096  
 65097  	// var amt int32 at bp+44, 4
 65098  
 65099  	var got int32
 65100  	var zFile uintptr
 65101  	var zBuf uintptr
 65102  	var in uintptr
 65103  
 65104  	if objc != 4 {
 65105  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32440 /* "FILENAME OFFSET ..." */)
 65106  		return TCL_ERROR
 65107  	}
 65108  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+40 /* &offset */) != 0 {
 65109  		return TCL_ERROR
 65110  	}
 65111  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+44 /* &amt */) != 0 {
 65112  		return TCL_ERROR
 65113  	}
 65114  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 65115  	zBuf = sqlite3.Xsqlite3_malloc(tls, ((*(*int32)(unsafe.Pointer(bp + 44 /* amt */)) * 2) + 1))
 65116  	if zBuf == uintptr(0) {
 65117  		return TCL_ERROR
 65118  	}
 65119  	in = libc.Xfopen(tls, zFile, ts+4263 /* "rb" */)
 65120  	if in == uintptr(0) {
 65121  		in = libc.Xfopen(tls, zFile, ts+32460 /* "r" */)
 65122  	}
 65123  	if in == uintptr(0) {
 65124  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32462 /* "cannot open inpu..." */, zFile, 0))
 65125  		return TCL_ERROR
 65126  	}
 65127  	libc.Xfseek(tls, in, int32(*(*int32)(unsafe.Pointer(bp + 40 /* offset */))), SEEK_SET)
 65128  	got = int32(libc.Xfread(tls, zBuf, uint32(1), uint32(*(*int32)(unsafe.Pointer(bp + 44 /* amt */))), in))
 65129  	libc.Xfclose(tls, in)
 65130  	if got < 0 {
 65131  		got = 0
 65132  	}
 65133  	sqlite3TestBinToHex(tls, zBuf, got)
 65134  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, zBuf, 0))
 65135  	sqlite3.Xsqlite3_free(tls, zBuf)
 65136  	return TCL_OK
 65137  }
 65138  
 65139  // Usage:   hexio_write  FILENAME  OFFSET  DATA
 65140  //
 65141  // Write DATA into file FILENAME beginning at OFFSET from the
 65142  // beginning of the file.  DATA is expressed in hexadecimal.
 65143  func hexio_write(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:151:26: */
 65144  	bp := tls.Alloc(32)
 65145  	defer tls.Free(32)
 65146  
 65147  	// var offset int32 at bp+24, 4
 65148  
 65149  	// var nIn int32 at bp+28, 4
 65150  
 65151  	var nOut int32
 65152  	var written int32
 65153  	var zFile uintptr
 65154  	var zIn uintptr
 65155  	var aOut uintptr
 65156  	var out uintptr
 65157  
 65158  	if objc != 4 {
 65159  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32486 /* "FILENAME OFFSET ..." */)
 65160  		return TCL_ERROR
 65161  	}
 65162  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+24 /* &offset */) != 0 {
 65163  		return TCL_ERROR
 65164  	}
 65165  	zFile = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 65166  	zIn = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+28 /* &nIn */)
 65167  	aOut = sqlite3.Xsqlite3_malloc(tls, (1 + (*(*int32)(unsafe.Pointer(bp + 28 /* nIn */)) / 2)))
 65168  	if aOut == uintptr(0) {
 65169  		return TCL_ERROR
 65170  	}
 65171  	nOut = sqlite3TestHexToBin(tls, zIn, *(*int32)(unsafe.Pointer(bp + 28 /* nIn */)), aOut)
 65172  	out = libc.Xfopen(tls, zFile, ts+32510 /* "r+b" */)
 65173  	if out == uintptr(0) {
 65174  		out = libc.Xfopen(tls, zFile, ts+32514 /* "r+" */)
 65175  	}
 65176  	if out == uintptr(0) {
 65177  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32517 /* "cannot open outp..." */, zFile, 0))
 65178  		return TCL_ERROR
 65179  	}
 65180  	libc.Xfseek(tls, out, int32(*(*int32)(unsafe.Pointer(bp + 24 /* offset */))), SEEK_SET)
 65181  	written = int32(libc.Xfwrite(tls, aOut, uint32(1), uint32(nOut), out))
 65182  	sqlite3.Xsqlite3_free(tls, aOut)
 65183  	libc.Xfclose(tls, out)
 65184  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, written))
 65185  	return TCL_OK
 65186  }
 65187  
 65188  // USAGE:   hexio_get_int   HEXDATA
 65189  //
 65190  // Interpret the HEXDATA argument as a big-endian integer.  Return
 65191  // the value of that integer.  HEXDATA can contain between 2 and 8
 65192  // hexadecimal digits.
 65193  func hexio_get_int(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:199:26: */
 65194  	bp := tls.Alloc(8)
 65195  	defer tls.Free(8)
 65196  
 65197  	var val int32
 65198  	// var nIn int32 at bp, 4
 65199  
 65200  	var nOut int32
 65201  	var zIn uintptr
 65202  	var aOut uintptr
 65203  	// var aNum [4]uint8 at bp+4, 4
 65204  
 65205  	if objc != 2 {
 65206  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32542 /* "HEXDATA" */)
 65207  		return TCL_ERROR
 65208  	}
 65209  	zIn = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &nIn */)
 65210  	aOut = sqlite3.Xsqlite3_malloc(tls, (1 + (*(*int32)(unsafe.Pointer(bp /* nIn */)) / 2)))
 65211  	if aOut == uintptr(0) {
 65212  		return TCL_ERROR
 65213  	}
 65214  	nOut = sqlite3TestHexToBin(tls, zIn, *(*int32)(unsafe.Pointer(bp /* nIn */)), aOut)
 65215  	if nOut >= 4 {
 65216  		libc.Xmemcpy(tls, bp+4 /* &aNum[0] */, aOut, uint32(4))
 65217  	} else {
 65218  		libc.Xmemset(tls, bp+4 /* &aNum[0] */, 0, uint32(unsafe.Sizeof([4]uint8{})))
 65219  		libc.Xmemcpy(tls, (bp + 4 /* &aNum */ + uintptr((4 - nOut))), aOut, uint32(nOut))
 65220  	}
 65221  	sqlite3.Xsqlite3_free(tls, aOut)
 65222  	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))))
 65223  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, val))
 65224  	return TCL_OK
 65225  }
 65226  
 65227  // USAGE:   hexio_render_int16   INTEGER
 65228  //
 65229  // Render INTEGER has a 16-bit big-endian integer in hexadecimal.
 65230  func hexio_render_int16(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:239:26: */
 65231  	bp := tls.Alloc(14)
 65232  	defer tls.Free(14)
 65233  
 65234  	// var val int32 at bp, 4
 65235  
 65236  	// var aNum [10]uint8 at bp+4, 10
 65237  
 65238  	if objc != 2 {
 65239  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2274 /* "INTEGER" */)
 65240  		return TCL_ERROR
 65241  	}
 65242  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &val */) != 0 {
 65243  		return TCL_ERROR
 65244  	}
 65245  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 8))
 65246  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 1)) = uint8(*(*int32)(unsafe.Pointer(bp /* val */)))
 65247  	sqlite3TestBinToHex(tls, bp+4 /* &aNum[0] */, 2)
 65248  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+4 /* aNum */, 4))
 65249  	return TCL_OK
 65250  }
 65251  
 65252  // USAGE:   hexio_render_int32   INTEGER
 65253  //
 65254  // Render INTEGER has a 32-bit big-endian integer in hexadecimal.
 65255  func hexio_render_int32(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:266:26: */
 65256  	bp := tls.Alloc(14)
 65257  	defer tls.Free(14)
 65258  
 65259  	// var val int32 at bp, 4
 65260  
 65261  	// var aNum [10]uint8 at bp+4, 10
 65262  
 65263  	if objc != 2 {
 65264  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2274 /* "INTEGER" */)
 65265  		return TCL_ERROR
 65266  	}
 65267  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &val */) != 0 {
 65268  		return TCL_ERROR
 65269  	}
 65270  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 24))
 65271  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 1)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 16))
 65272  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 2)) = (uint8(*(*int32)(unsafe.Pointer(bp /* val */)) >> 8))
 65273  	*(*uint8)(unsafe.Pointer(bp + 4 /* &aNum[0] */ + 3)) = uint8(*(*int32)(unsafe.Pointer(bp /* val */)))
 65274  	sqlite3TestBinToHex(tls, bp+4 /* &aNum[0] */, 4)
 65275  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, bp+4 /* aNum */, 8))
 65276  	return TCL_OK
 65277  }
 65278  
 65279  // USAGE:  utf8_to_utf8  HEX
 65280  //
 65281  // The argument is a UTF8 string represented in hexadecimal.
 65282  // The UTF8 might not be well-formed.  Run this string through
 65283  // sqlite3Utf8to8() convert it back to hex and return the result.
 65284  func utf8_to_utf8(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:296:26: */
 65285  	bp := tls.Alloc(16)
 65286  	defer tls.Free(16)
 65287  
 65288  	tcl.XTcl_AppendResult(tls, interp,
 65289  		libc.VaList(bp, ts+32550 /* "[utf8_to_utf8] u..." */, 0))
 65290  	return TCL_ERROR
 65291  }
 65292  
 65293  func getFts3Varint(tls *libc.TLS, p uintptr, v uintptr) int32 { /* test_hexio.c:328:12: */
 65294  	var q uintptr = p
 65295  	var x sqlite_uint64 = uint64(0)
 65296  	var y sqlite_uint64 = uint64(1)
 65297  	for (int32(*(*uint8)(unsafe.Pointer(q))) & 0x80) == 0x80 {
 65298  		x = x + (y * (sqlite_uint64(int32(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1)))) & 0x7f)))
 65299  		y <<= 7
 65300  	}
 65301  	x = x + (y * (sqlite_uint64(*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1))))))
 65302  	*(*sqlite_int64)(unsafe.Pointer(v)) = sqlite_int64(x)
 65303  	return ((int32(q) - int32(p)) / 1)
 65304  }
 65305  
 65306  func putFts3Varint(tls *libc.TLS, p uintptr, v sqlite_int64) int32 { /* test_hexio.c:340:12: */
 65307  	var q uintptr = p
 65308  	var vu sqlite_uint64 = sqlite_uint64(v)
 65309  	for ok := true; ok; ok = (vu != uint64(0)) {
 65310  		*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&q, 1))) = (uint8((vu & uint64(0x7f)) | uint64(0x80)))
 65311  		vu >>= 7
 65312  	}
 65313  	*(*uint8)(unsafe.Pointer(q + libc.UintptrFromInt32(-1))) &= uint8((0x7f)) // turn off high bit in final byte
 65314  
 65315  	return ((int32(q) - int32(p)) / 1)
 65316  }
 65317  
 65318  // USAGE:  read_fts3varint BLOB VARNAME
 65319  //
 65320  // Read a varint from the start of BLOB. Set variable VARNAME to contain
 65321  // the interpreted value. Return the number of bytes of BLOB consumed.
 65322  func read_fts3varint(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:358:26: */
 65323  	bp := tls.Alloc(16)
 65324  	defer tls.Free(16)
 65325  
 65326  	// var nBlob int32 at bp, 4
 65327  
 65328  	var zBlob uintptr
 65329  	// var iVal sqlite3_int64 at bp+8, 8
 65330  
 65331  	var nVal int32
 65332  
 65333  	if objc != 3 {
 65334  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32604 /* "BLOB VARNAME" */)
 65335  		return TCL_ERROR
 65336  	}
 65337  	zBlob = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &nBlob */)
 65338  
 65339  	nVal = getFts3Varint(tls, zBlob, bp+8 /* &iVal */)
 65340  	tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(0), tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* iVal */))), 0)
 65341  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nVal))
 65342  	return TCL_OK
 65343  }
 65344  
 65345  // USAGE:  make_fts3record ARGLIST
 65346  func make_fts3record(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_hexio.c:384:26: */
 65347  	bp := tls.Alloc(20)
 65348  	defer tls.Free(20)
 65349  
 65350  	*(*uintptr)(unsafe.Pointer(bp + 4 /* aArg */)) = uintptr(0)
 65351  	*(*int32)(unsafe.Pointer(bp /* nArg */)) = 0
 65352  	var aOut uintptr = uintptr(0)
 65353  	var nOut int32 = 0
 65354  	var nAlloc int32 = 0
 65355  	var i int32
 65356  
 65357  	if objc != 2 {
 65358  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32617 /* "LIST" */)
 65359  		return TCL_ERROR
 65360  	}
 65361  	if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &nArg */, bp+4 /* &aArg */) != 0 {
 65362  		return TCL_ERROR
 65363  	}
 65364  
 65365  	for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nArg */)); i++ {
 65366  		// var iVal sqlite3_int64 at bp+8, 8
 65367  
 65368  		if TCL_OK == tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* aArg */)) + uintptr(i)*4)), bp+8 /* &iVal */) {
 65369  			if (nOut + 10) > nAlloc {
 65370  				var nNew int32
 65371  				if nAlloc != 0 {
 65372  					nNew = (nAlloc * 2)
 65373  				} else {
 65374  					nNew = 128
 65375  				}
 65376  				var aNew uintptr = sqlite3.Xsqlite3_realloc(tls, aOut, nNew)
 65377  				if aNew == uintptr(0) {
 65378  					sqlite3.Xsqlite3_free(tls, aOut)
 65379  					return TCL_ERROR
 65380  				}
 65381  				aOut = aNew
 65382  				nAlloc = nNew
 65383  			}
 65384  			nOut = nOut + (putFts3Varint(tls, (aOut + uintptr(nOut)), *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* iVal */))))
 65385  		} else {
 65386  			*(*int32)(unsafe.Pointer(bp + 16 /* nVal */)) = 0
 65387  			var zVal uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* aArg */)) + uintptr(i)*4)), bp+16 /* &nVal */)
 65388  			for (nOut + *(*int32)(unsafe.Pointer(bp + 16 /* nVal */))) > nAlloc {
 65389  				var nNew int32
 65390  				if nAlloc != 0 {
 65391  					nNew = (nAlloc * 2)
 65392  				} else {
 65393  					nNew = 128
 65394  				}
 65395  				var aNew uintptr = sqlite3.Xsqlite3_realloc(tls, aOut, nNew)
 65396  				if aNew == uintptr(0) {
 65397  					sqlite3.Xsqlite3_free(tls, aOut)
 65398  					return TCL_ERROR
 65399  				}
 65400  				aOut = aNew
 65401  				nAlloc = nNew
 65402  			}
 65403  			libc.Xmemcpy(tls, (aOut + uintptr(nOut)), zVal, uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nVal */))))
 65404  			nOut = nOut + (*(*int32)(unsafe.Pointer(bp + 16 /* nVal */)))
 65405  		}
 65406  	}
 65407  
 65408  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewByteArrayObj(tls, aOut, nOut))
 65409  	sqlite3.Xsqlite3_free(tls, aOut)
 65410  	return TCL_OK
 65411  }
 65412  
 65413  // Register commands with the TCL interpreter.
 65414  func Sqlitetest_hexio_Init(tls *libc.TLS, interp uintptr) int32 { /* test_hexio.c:446:5: */
 65415  	var i int32
 65416  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd8)) / uint32(unsafe.Sizeof(struct {
 65417  		FzName uintptr
 65418  		FxProc uintptr
 65419  	}{}))); i++ {
 65420  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd8[i].FzName, aObjCmd8[i].FxProc, uintptr(0), uintptr(0))
 65421  	}
 65422  	return TCL_OK
 65423  }
 65424  
 65425  var aObjCmd8 = [8]struct {
 65426  	FzName uintptr
 65427  	FxProc uintptr
 65428  }{
 65429  	{FzName: ts + 32622 /* "hexio_read" */, FxProc: 0},
 65430  	{FzName: ts + 32633 /* "hexio_write" */, FxProc: 0},
 65431  	{FzName: ts + 32645 /* "hexio_get_int" */, FxProc: 0},
 65432  	{FzName: ts + 32659 /* "hexio_render_int..." */, FxProc: 0},
 65433  	{FzName: ts + 32678 /* "hexio_render_int..." */, FxProc: 0},
 65434  	{FzName: ts + 32697 /* "utf8_to_utf8" */, FxProc: 0},
 65435  	{FzName: ts + 32710 /* "read_fts3varint" */, FxProc: 0},
 65436  	{FzName: ts + 32726 /* "make_fts3record" */, FxProc: 0},
 65437  } /* test_hexio.c:450:5 */
 65438  
 65439  // end block for C++
 65440  
 65441  // Local Variables:
 65442  // mode: c
 65443  // c-basic-offset: 4
 65444  // fill-column: 78
 65445  // End:
 65446  
 65447  type Wrapped = struct {
 65448  	Fpcache      sqlite3_pcache_methods2
 65449  	Fmem         sqlite3_mem_methods
 65450  	Fmutex       sqlite3_mutex_methods
 65451  	Fmem_init    int32
 65452  	Fmem_fail    int32
 65453  	Fmutex_init  int32
 65454  	Fmutex_fail  int32
 65455  	Fpcache_init int32
 65456  	Fpcache_fail int32
 65457  } /* test_init.c:36:8 */
 65458  
 65459  // end block for C++
 65460  
 65461  // Local Variables:
 65462  // mode: c
 65463  // c-basic-offset: 4
 65464  // fill-column: 78
 65465  // End:
 65466  
 65467  var wrapped Wrapped /* test_init.c:47:3: */
 65468  
 65469  func wrMemInit(tls *libc.TLS, pAppData uintptr) int32 { /* test_init.c:49:12: */
 65470  	var rc int32
 65471  	if wrapped.Fmem_fail != 0 {
 65472  		rc = SQLITE_ERROR
 65473  	} else {
 65474  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 20 /* &.xInit */))))(tls, wrapped.Fmem.FpAppData)
 65475  	}
 65476  	if rc == SQLITE_OK {
 65477  		wrapped.Fmem_init = 1
 65478  	}
 65479  	return rc
 65480  }
 65481  
 65482  func wrMemShutdown(tls *libc.TLS, pAppData uintptr) { /* test_init.c:61:13: */
 65483  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 24 /* &.xShutdown */))))(tls, wrapped.Fmem.FpAppData)
 65484  	wrapped.Fmem_init = 0
 65485  }
 65486  
 65487  func wrMemMalloc(tls *libc.TLS, n int32) uintptr { /* test_init.c:65:13: */
 65488  	return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ /* &.xMalloc */))))(tls, n)
 65489  }
 65490  
 65491  func wrMemFree(tls *libc.TLS, p uintptr) { /* test_init.c:66:13: */
 65492  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 4 /* &.xFree */))))(tls, p)
 65493  }
 65494  
 65495  func wrMemRealloc(tls *libc.TLS, p uintptr, n int32) uintptr { /* test_init.c:67:13: */
 65496  	return (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 8 /* &.xRealloc */))))(tls, p, n)
 65497  }
 65498  
 65499  func wrMemSize(tls *libc.TLS, p uintptr) int32 { /* test_init.c:68:12: */
 65500  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 12 /* &.xSize */))))(tls, p)
 65501  }
 65502  
 65503  func wrMemRoundup(tls *libc.TLS, n int32) int32 { /* test_init.c:69:12: */
 65504  	return (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 52 /* &.mem */ + 16 /* &.xRoundup */))))(tls, n)
 65505  }
 65506  
 65507  func wrMutexInit(tls *libc.TLS) int32 { /* test_init.c:72:12: */
 65508  	var rc int32
 65509  	if wrapped.Fmutex_fail != 0 {
 65510  		rc = SQLITE_ERROR
 65511  	} else {
 65512  		rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ /* &.xMutexInit */))))(tls)
 65513  	}
 65514  	if rc == SQLITE_OK {
 65515  		wrapped.Fmutex_init = 1
 65516  	}
 65517  	return rc
 65518  }
 65519  
 65520  func wrMutexEnd(tls *libc.TLS) int32 { /* test_init.c:84:12: */
 65521  	(*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 4 /* &.xMutexEnd */))))(tls)
 65522  	wrapped.Fmutex_init = 0
 65523  	return SQLITE_OK
 65524  }
 65525  
 65526  func wrMutexAlloc(tls *libc.TLS, e int32) uintptr { /* test_init.c:89:22: */
 65527  	return (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 8 /* &.xMutexAlloc */))))(tls, e)
 65528  }
 65529  
 65530  func wrMutexFree(tls *libc.TLS, p uintptr) { /* test_init.c:92:13: */
 65531  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 12 /* &.xMutexFree */))))(tls, p)
 65532  }
 65533  
 65534  func wrMutexEnter(tls *libc.TLS, p uintptr) { /* test_init.c:95:13: */
 65535  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 16 /* &.xMutexEnter */))))(tls, p)
 65536  }
 65537  
 65538  func wrMutexTry(tls *libc.TLS, p uintptr) int32 { /* test_init.c:98:12: */
 65539  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 20 /* &.xMutexTry */))))(tls, p)
 65540  }
 65541  
 65542  func wrMutexLeave(tls *libc.TLS, p uintptr) { /* test_init.c:101:13: */
 65543  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 24 /* &.xMutexLeave */))))(tls, p)
 65544  }
 65545  
 65546  func wrMutexHeld(tls *libc.TLS, p uintptr) int32 { /* test_init.c:104:12: */
 65547  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 28 /* &.xMutexHeld */))))(tls, p)
 65548  }
 65549  
 65550  func wrMutexNotheld(tls *libc.TLS, p uintptr) int32 { /* test_init.c:107:12: */
 65551  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) + 84 /* &.mutex */ + 32 /* &.xMutexNotheld */))))(tls, p)
 65552  }
 65553  
 65554  func wrPCacheInit(tls *libc.TLS, pArg uintptr) int32 { /* test_init.c:113:12: */
 65555  	var rc int32
 65556  	if wrapped.Fpcache_fail != 0 {
 65557  		rc = SQLITE_ERROR
 65558  	} else {
 65559  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 8 /* &.xInit */))))(tls, wrapped.Fpcache.FpArg)
 65560  	}
 65561  	if rc == SQLITE_OK {
 65562  		wrapped.Fpcache_init = 1
 65563  	}
 65564  	return rc
 65565  }
 65566  
 65567  func wrPCacheShutdown(tls *libc.TLS, pArg uintptr) { /* test_init.c:125:13: */
 65568  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 12 /* &.xShutdown */))))(tls, wrapped.Fpcache.FpArg)
 65569  	wrapped.Fpcache_init = 0
 65570  }
 65571  
 65572  func wrPCacheCreate(tls *libc.TLS, a int32, b int32, c int32) uintptr { /* test_init.c:130:23: */
 65573  	return (*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 16 /* &.xCreate */))))(tls, a, b, c)
 65574  }
 65575  
 65576  func wrPCacheCachesize(tls *libc.TLS, p uintptr, n int32) { /* test_init.c:133:13: */
 65577  	(*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 20 /* &.xCachesize */))))(tls, p, n)
 65578  }
 65579  
 65580  func wrPCachePagecount(tls *libc.TLS, p uintptr) int32 { /* test_init.c:136:12: */
 65581  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 24 /* &.xPagecount */))))(tls, p)
 65582  }
 65583  
 65584  func wrPCacheFetch(tls *libc.TLS, p uintptr, a uint32, b int32) uintptr { /* test_init.c:139:28: */
 65585  	return (*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 28 /* &.xFetch */))))(tls, p, a, b)
 65586  }
 65587  
 65588  func wrPCacheUnpin(tls *libc.TLS, p uintptr, a uintptr, b int32) { /* test_init.c:142:13: */
 65589  	(*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 32 /* &.xUnpin */))))(tls, p, a, b)
 65590  }
 65591  
 65592  func wrPCacheRekey(tls *libc.TLS, p uintptr, a uintptr, b uint32, c uint32) { /* test_init.c:145:13: */
 65593  	(*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 36 /* &.xRekey */))))(tls, p, a, b, c)
 65594  }
 65595  
 65596  func wrPCacheTruncate(tls *libc.TLS, p uintptr, a uint32) { /* test_init.c:153:13: */
 65597  	(*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 40 /* &.xTruncate */))))(tls, p, a)
 65598  }
 65599  
 65600  func wrPCacheDestroy(tls *libc.TLS, p uintptr) { /* test_init.c:156:13: */
 65601  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */ + 44 /* &.xDestroy */))))(tls, p)
 65602  }
 65603  
 65604  func installInitWrappers(tls *libc.TLS) { /* test_init.c:160:13: */
 65605  	bp := tls.Alloc(168)
 65606  	defer tls.Free(168)
 65607  
 65608  	*(*sqlite3_mutex_methods)(unsafe.Pointer(bp + 48 /* mutexmethods */)) = sqlite3_mutex_methods{
 65609  		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 {
 65610  			f func(*libc.TLS, int32) uintptr
 65611  		}{wrMutexAlloc})),
 65612  		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 {
 65613  			f func(*libc.TLS, uintptr) int32
 65614  		}{wrMutexTry})),
 65615  		FxMutexLeave: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMutexLeave})), FxMutexHeld: *(*uintptr)(unsafe.Pointer(&struct {
 65616  			f func(*libc.TLS, uintptr) int32
 65617  		}{wrMutexHeld})), FxMutexNotheld: *(*uintptr)(unsafe.Pointer(&struct {
 65618  			f func(*libc.TLS, uintptr) int32
 65619  		}{wrMutexNotheld})),
 65620  	}
 65621  	*(*sqlite3_pcache_methods2)(unsafe.Pointer(bp + 116 /* pcachemethods */)) = sqlite3_pcache_methods2{
 65622  		FiVersion: 1,
 65623  		FxInit: *(*uintptr)(unsafe.Pointer(&struct {
 65624  			f func(*libc.TLS, uintptr) int32
 65625  		}{wrPCacheInit})), FxShutdown: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrPCacheShutdown})), FxCreate: *(*uintptr)(unsafe.Pointer(&struct {
 65626  			f func(*libc.TLS, int32, int32, int32) uintptr
 65627  		}{wrPCacheCreate})),
 65628  		FxCachesize: *(*uintptr)(unsafe.Pointer(&struct {
 65629  			f func(*libc.TLS, uintptr, int32)
 65630  		}{wrPCacheCachesize})), FxPagecount: *(*uintptr)(unsafe.Pointer(&struct {
 65631  			f func(*libc.TLS, uintptr) int32
 65632  		}{wrPCachePagecount})), FxFetch: *(*uintptr)(unsafe.Pointer(&struct {
 65633  			f func(*libc.TLS, uintptr, uint32, int32) uintptr
 65634  		}{wrPCacheFetch})),
 65635  		FxUnpin: *(*uintptr)(unsafe.Pointer(&struct {
 65636  			f func(*libc.TLS, uintptr, uintptr, int32)
 65637  		}{wrPCacheUnpin})), FxRekey: *(*uintptr)(unsafe.Pointer(&struct {
 65638  			f func(*libc.TLS, uintptr, uintptr, uint32, uint32)
 65639  		}{wrPCacheRekey})), FxTruncate: *(*uintptr)(unsafe.Pointer(&struct {
 65640  			f func(*libc.TLS, uintptr, uint32)
 65641  		}{wrPCacheTruncate})),
 65642  		FxDestroy: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrPCacheDestroy})),
 65643  	}
 65644  	*(*sqlite3_mem_methods)(unsafe.Pointer(bp + 84 /* memmethods */)) = sqlite3_mem_methods{
 65645  		FxMalloc: *(*uintptr)(unsafe.Pointer(&struct {
 65646  			f func(*libc.TLS, int32) uintptr
 65647  		}{wrMemMalloc})), FxFree: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMemFree})), FxRealloc: *(*uintptr)(unsafe.Pointer(&struct {
 65648  			f func(*libc.TLS, uintptr, int32) uintptr
 65649  		}{wrMemRealloc})),
 65650  		FxSize: *(*uintptr)(unsafe.Pointer(&struct {
 65651  			f func(*libc.TLS, uintptr) int32
 65652  		}{wrMemSize})), FxRoundup: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{wrMemRoundup})), FxInit: *(*uintptr)(unsafe.Pointer(&struct {
 65653  			f func(*libc.TLS, uintptr) int32
 65654  		}{wrMemInit})),
 65655  		FxShutdown: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{wrMemShutdown})),
 65656  	}
 65657  
 65658  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&wrapped)), 0, uint32(unsafe.Sizeof(wrapped)))
 65659  
 65660  	sqlite3.Xsqlite3_shutdown(tls)
 65661  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMUTEX, libc.VaList(bp, (uintptr(unsafe.Pointer(&wrapped))+84 /* &.mutex */)))
 65662  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp+8, (uintptr(unsafe.Pointer(&wrapped))+52 /* &.mem */)))
 65663  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETPCACHE2, libc.VaList(bp+16, (uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */)))
 65664  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+24, bp+48 /* &mutexmethods */))
 65665  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+32, bp+84 /* &memmethods */))
 65666  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+40, bp+116 /* &pcachemethods */))
 65667  }
 65668  
 65669  func init_wrapper_install(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:191:26: */
 65670  	bp := tls.Alloc(24)
 65671  	defer tls.Free(24)
 65672  
 65673  	var i int32
 65674  	installInitWrappers(tls)
 65675  	for i = 1; i < objc; i++ {
 65676  		var z uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)))
 65677  		if libc.Xstrcmp(tls, z, ts+32742 /* "mem" */) == 0 {
 65678  			wrapped.Fmem_fail = 1
 65679  		} else if libc.Xstrcmp(tls, z, ts+29345 /* "mutex" */) == 0 {
 65680  			wrapped.Fmutex_fail = 1
 65681  		} else if libc.Xstrcmp(tls, z, ts+32746 /* "pcache" */) == 0 {
 65682  			wrapped.Fpcache_fail = 1
 65683  		} else {
 65684  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32753 /* "Unknown argument..." */, z, ts+12415 /* "\"" */))
 65685  			return TCL_ERROR
 65686  		}
 65687  	}
 65688  	return TCL_OK
 65689  }
 65690  
 65691  func init_wrapper_uninstall(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:215:26: */
 65692  	bp := tls.Alloc(24)
 65693  	defer tls.Free(24)
 65694  
 65695  	if objc != 1 {
 65696  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 65697  		return TCL_ERROR
 65698  	}
 65699  
 65700  	sqlite3.Xsqlite3_shutdown(tls)
 65701  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp, (uintptr(unsafe.Pointer(&wrapped))+84 /* &.mutex */)))
 65702  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+8, (uintptr(unsafe.Pointer(&wrapped))+52 /* &.mem */)))
 65703  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+16, (uintptr(unsafe.Pointer(&wrapped)) /* &.pcache */)))
 65704  	return TCL_OK
 65705  }
 65706  
 65707  func init_wrapper_clear(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:233:26: */
 65708  	if objc != 1 {
 65709  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 65710  		return TCL_ERROR
 65711  	}
 65712  
 65713  	wrapped.Fmem_fail = 0
 65714  	wrapped.Fmutex_fail = 0
 65715  	wrapped.Fpcache_fail = 0
 65716  	return TCL_OK
 65717  }
 65718  
 65719  func init_wrapper_query(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_init.c:250:26: */
 65720  	var pRet uintptr
 65721  
 65722  	if objc != 1 {
 65723  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 65724  		return TCL_ERROR
 65725  	}
 65726  
 65727  	pRet = tcl.XTcl_NewObj(tls)
 65728  	if wrapped.Fmutex_init != 0 {
 65729  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+29345 /* "mutex" */, -1))
 65730  	}
 65731  	if wrapped.Fmem_init != 0 {
 65732  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+32742 /* "mem" */, -1))
 65733  	}
 65734  	if wrapped.Fpcache_init != 0 {
 65735  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, ts+32746 /* "pcache" */, -1))
 65736  	}
 65737  
 65738  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 65739  	return TCL_OK
 65740  }
 65741  
 65742  func Sqlitetest_init_Init(tls *libc.TLS, interp uintptr) int32 { /* test_init.c:278:5: */
 65743  	var i int32
 65744  
 65745  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd9)) / uint32(unsafe.Sizeof(struct {
 65746  		FzName uintptr
 65747  		FxProc uintptr
 65748  	}{}))); i++ {
 65749  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd9[i].FzName, aObjCmd9[i].FxProc, uintptr(0), uintptr(0))
 65750  	}
 65751  
 65752  	return TCL_OK
 65753  }
 65754  
 65755  var aObjCmd9 = [4]struct {
 65756  	FzName uintptr
 65757  	FxProc uintptr
 65758  }{
 65759  	{FzName: ts + 32773 /* "init_wrapper_ins..." */, FxProc: 0},
 65760  	{FzName: ts + 32794 /* "init_wrapper_que..." */, FxProc: 0},
 65761  	{FzName: ts + 32813 /* "init_wrapper_uni..." */, FxProc: 0},
 65762  	{FzName: ts + 32836 /* "init_wrapper_cle..." */, FxProc: 0},
 65763  } /* test_init.c:282:5 */
 65764  
 65765  //
 65766  // END OF REGISTRATION API
 65767  //
 65768  
 65769  //******* End of fts5.h ********
 65770  
 65771  // Make sure we can call this stuff from C++.
 65772  
 65773  // An sqlite3_intarray is an abstract type to stores an instance of
 65774  // an integer array.
 65775  type sqlite3_intarray1 = struct {
 65776  	Fn     int32
 65777  	Fa     uintptr
 65778  	FxFree uintptr
 65779  } /* test_intarray.h:99:9 */
 65780  
 65781  //
 65782  // END OF REGISTRATION API
 65783  //
 65784  
 65785  //******* End of fts5.h ********
 65786  
 65787  // Make sure we can call this stuff from C++.
 65788  
 65789  // An sqlite3_intarray is an abstract type to stores an instance of
 65790  // an integer array.
 65791  type sqlite3_intarray = sqlite3_intarray1 /* test_intarray.h:99:33 */
 65792  
 65793  // Objects used internally by the virtual table implementation
 65794  type intarray_vtab1 = struct {
 65795  	Fbase     sqlite3_vtab
 65796  	FpContent uintptr
 65797  } /* test_intarray.c:41:9 */
 65798  
 65799  // Objects used internally by the virtual table implementation
 65800  type intarray_vtab = intarray_vtab1 /* test_intarray.c:41:30 */
 65801  type intarray_cursor1 = struct {
 65802  	Fbase sqlite3_vtab_cursor
 65803  	Fi    int32
 65804  } /* test_intarray.c:42:9 */
 65805  
 65806  type intarray_cursor = intarray_cursor1 /* test_intarray.c:42:32 */
 65807  
 65808  // None of this works unless we have virtual tables.
 65809  
 65810  // Free an sqlite3_intarray object.
 65811  func intarrayFree(tls *libc.TLS, p uintptr) { /* test_intarray.c:64:13: */
 65812  	if (*sqlite3_intarray)(unsafe.Pointer(p)).FxFree != 0 {
 65813  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((p + 8 /* &.xFree */))))(tls, (*sqlite3_intarray)(unsafe.Pointer(p)).Fa)
 65814  	}
 65815  	sqlite3.Xsqlite3_free(tls, p)
 65816  }
 65817  
 65818  // Table destructor for the intarray module.
 65819  func intarrayDestroy(tls *libc.TLS, p uintptr) int32 { /* test_intarray.c:74:12: */
 65820  	var pVtab uintptr = p
 65821  	sqlite3.Xsqlite3_free(tls, pVtab)
 65822  	return 0
 65823  }
 65824  
 65825  // Table constructor for the intarray module.
 65826  func intarrayCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_intarray.c:83:12: */
 65827  	var rc int32 = SQLITE_NOMEM
 65828  	var pVtab uintptr = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(intarray_vtab{})))
 65829  
 65830  	if pVtab != 0 {
 65831  		libc.Xmemset(tls, pVtab, 0, uint32(unsafe.Sizeof(intarray_vtab{})))
 65832  		(*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent = pAux
 65833  		rc = sqlite3.Xsqlite3_declare_vtab(tls, db, ts+32855 /* "CREATE TABLE x(v..." */)
 65834  	}
 65835  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pVtab
 65836  	return rc
 65837  }
 65838  
 65839  // Open a new cursor on the intarray table.
 65840  func intarrayOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_intarray.c:106:12: */
 65841  	var rc int32 = SQLITE_NOMEM
 65842  	var pCur uintptr
 65843  	pCur = sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(intarray_cursor{})))
 65844  	if pCur != 0 {
 65845  		libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(intarray_cursor{})))
 65846  		*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 65847  		rc = SQLITE_OK
 65848  	}
 65849  	return rc
 65850  }
 65851  
 65852  // Close a intarray table cursor.
 65853  func intarrayClose(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:121:12: */
 65854  	var pCur uintptr = cur
 65855  	sqlite3.Xsqlite3_free(tls, pCur)
 65856  	return SQLITE_OK
 65857  }
 65858  
 65859  // Retrieve a column of data.
 65860  func intarrayColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_intarray.c:130:12: */
 65861  	var pCur uintptr = cur
 65862  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 65863  	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) {
 65864  		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)))
 65865  	}
 65866  	return SQLITE_OK
 65867  }
 65868  
 65869  // Retrieve the current rowid.
 65870  func intarrayRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_intarray.c:142:12: */
 65871  	var pCur uintptr = cur
 65872  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite_int64((*intarray_cursor)(unsafe.Pointer(pCur)).Fi)
 65873  	return SQLITE_OK
 65874  }
 65875  
 65876  func intarrayEof(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:148:12: */
 65877  	var pCur uintptr = cur
 65878  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 65879  	return (libc.Bool32((*intarray_cursor)(unsafe.Pointer(pCur)).Fi >= (*sqlite3_intarray)(unsafe.Pointer((*intarray_vtab)(unsafe.Pointer(pVtab)).FpContent)).Fn))
 65880  }
 65881  
 65882  // Advance the cursor to the next row.
 65883  func intarrayNext(tls *libc.TLS, cur uintptr) int32 { /* test_intarray.c:157:12: */
 65884  	var pCur uintptr = cur
 65885  	(*intarray_cursor)(unsafe.Pointer(pCur)).Fi++
 65886  	return SQLITE_OK
 65887  }
 65888  
 65889  // Reset a intarray table cursor.
 65890  func intarrayFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_intarray.c:166:12: */
 65891  	var pCur uintptr = pVtabCursor
 65892  	(*intarray_cursor)(unsafe.Pointer(pCur)).Fi = 0
 65893  	return SQLITE_OK
 65894  }
 65895  
 65896  // Analyse the WHERE condition.
 65897  func intarrayBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_intarray.c:179:12: */
 65898  	return SQLITE_OK
 65899  }
 65900  
 65901  // A virtual table module that merely echos method calls into TCL
 65902  // variables.
 65903  var intarrayModule = sqlite3_module{ // iVersion
 65904  	FxCreate:     0, // xCreate - create a new virtual table
 65905  	FxConnect:    0, // xConnect - connect to an existing vtab
 65906  	FxBestIndex:  0, // xBestIndex - find the best query index
 65907  	FxDisconnect: 0, // xDisconnect - disconnect a vtab
 65908  	FxDestroy:    0, // xDestroy - destroy a vtab
 65909  	FxOpen:       0, // xOpen - open a cursor
 65910  	FxClose:      0, // xClose - close a cursor
 65911  	FxFilter:     0, // xFilter - configure scan constraints
 65912  	FxNext:       0, // xNext - advance a cursor
 65913  	FxEof:        0, // xEof
 65914  	FxColumn:     0, // xColumn - read data
 65915  	FxRowid:      0, // xRename
 65916  } /* test_intarray.c:187:23 */
 65917  
 65918  // Invoke this routine to create a specific instance of an intarray object.
 65919  // The new intarray object is returned by the 3rd parameter.
 65920  //
 65921  // Each intarray object corresponds to a virtual table in the TEMP table
 65922  // with a name of zName.
 65923  //
 65924  // Destroy the intarray object by dropping the virtual table.  If not done
 65925  // explicitly by the application, the virtual table will be dropped implicitly
 65926  // by the system when the database connection is closed.
 65927  func sqlite3_intarray_create(tls *libc.TLS, db uintptr, zName uintptr, ppReturn uintptr) int32 { /* test_intarray.c:223:16: */
 65928  	bp := tls.Alloc(16)
 65929  	defer tls.Free(16)
 65930  
 65931  	var rc int32 = SQLITE_OK
 65932  	var p uintptr
 65933  
 65934  	*(*uintptr)(unsafe.Pointer(ppReturn)) = libc.AssignUintptr(&p, sqlite3.Xsqlite3_malloc64(tls, uint64(unsafe.Sizeof(sqlite3_intarray{}))))
 65935  	if p == uintptr(0) {
 65936  		return SQLITE_NOMEM
 65937  	}
 65938  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(sqlite3_intarray{})))
 65939  	rc = sqlite3.Xsqlite3_create_module_v2(tls, db, zName, uintptr(unsafe.Pointer(&intarrayModule)), p,
 65940  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{intarrayFree})))
 65941  	if rc == SQLITE_OK {
 65942  		var zSql uintptr
 65943  		zSql = sqlite3.Xsqlite3_mprintf(tls, ts+32897, /* "CREATE VIRTUAL T..." */
 65944  			libc.VaList(bp, zName, zName))
 65945  		rc = sqlite3.Xsqlite3_exec(tls, db, zSql, uintptr(0), uintptr(0), uintptr(0))
 65946  		sqlite3.Xsqlite3_free(tls, zSql)
 65947  	}
 65948  	return rc
 65949  }
 65950  
 65951  // Bind a new array array of integers to a specific intarray object.
 65952  //
 65953  // The array of integers bound must be unchanged for the duration of
 65954  // any query against the corresponding virtual table.  If the integer
 65955  // array does change or is deallocated undefined behavior will result.
 65956  func sqlite3_intarray_bind(tls *libc.TLS, pIntArray uintptr, nElements int32, aElements uintptr, xFree uintptr) int32 { /* test_intarray.c:257:16: */
 65957  	if (*sqlite3_intarray)(unsafe.Pointer(pIntArray)).FxFree != 0 {
 65958  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pIntArray + 8 /* &.xFree */))))(tls, (*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fa)
 65959  	}
 65960  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fn = nElements
 65961  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).Fa = aElements
 65962  	(*sqlite3_intarray)(unsafe.Pointer(pIntArray)).FxFree = xFree
 65963  	return SQLITE_OK
 65964  }
 65965  
 65966  //    sqlite3_intarray_create  DB  NAME
 65967  //
 65968  // Invoke the sqlite3_intarray_create interface.  A string that becomes
 65969  // the first parameter to sqlite3_intarray_bind.
 65970  func test_intarray_create(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_intarray.c:300:26: */
 65971  	bp := tls.Alloc(140)
 65972  	defer tls.Free(140)
 65973  
 65974  	// var db uintptr at bp+32, 4
 65975  
 65976  	var zName uintptr
 65977  	// var pArray uintptr at bp+36, 4
 65978  
 65979  	var rc int32 = SQLITE_OK
 65980  	// var zPtr [100]int8 at bp+40, 100
 65981  
 65982  	if objc != 3 {
 65983  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 65984  		return TCL_ERROR
 65985  	}
 65986  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 65987  		return TCL_ERROR
 65988  	}
 65989  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 65990  	rc = sqlite3_intarray_create(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), zName, bp+36 /* &pArray */)
 65991  	if rc != SQLITE_OK {
 65992  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 65993  		return TCL_ERROR
 65994  	}
 65995  	sqlite3TestMakePointerStr(tls, interp, bp+40 /* &zPtr[0] */, *(*uintptr)(unsafe.Pointer(bp + 36 /* pArray */)))
 65996  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, bp+40 /* &zPtr[0] */, uintptr(0)))
 65997  	return TCL_OK
 65998  }
 65999  
 66000  //    sqlite3_intarray_bind  INTARRAY  ?VALUE ...?
 66001  //
 66002  // Invoke the sqlite3_intarray_bind interface on the given array of integers.
 66003  func test_intarray_bind(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_intarray.c:335:26: */
 66004  	bp := tls.Alloc(40)
 66005  	defer tls.Free(40)
 66006  
 66007  	var pArray uintptr
 66008  	var rc int32 = SQLITE_OK
 66009  	var i int32
 66010  	var n int32
 66011  	var a uintptr
 66012  
 66013  	if objc < 2 {
 66014  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+32935 /* "INTARRAY" */)
 66015  		return TCL_ERROR
 66016  	}
 66017  	pArray = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 66018  	n = (objc - 2)
 66019  	a = sqlite3.Xsqlite3_malloc64(tls, (uint64(uint32(unsafe.Sizeof(sqlite3_int64(0))) * uint32(n))))
 66020  	if a == uintptr(0) {
 66021  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+32944 /* "SQLITE_NOMEM" */, uintptr(0)))
 66022  		return TCL_ERROR
 66023  	}
 66024  	for i = 0; i < n; i++ {
 66025  		*(*Tcl_WideInt)(unsafe.Pointer(bp + 32 /* x */)) = int64(0)
 66026  		tcl.XTcl_GetWideIntFromObj(tls, uintptr(0), *(*uintptr)(unsafe.Pointer(objv + uintptr((i+2))*4)), bp+32 /* &x */)
 66027  		*(*sqlite3_int64)(unsafe.Pointer(a + uintptr(i)*8)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 32 /* x */))
 66028  	}
 66029  	rc = sqlite3_intarray_bind(tls, pArray, n, a, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 66030  	if rc != SQLITE_OK {
 66031  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0)))
 66032  		return TCL_ERROR
 66033  	}
 66034  	return TCL_OK
 66035  }
 66036  
 66037  // Register commands with the TCL interpreter.
 66038  func Sqlitetestintarray_Init(tls *libc.TLS, interp uintptr) int32 { /* test_intarray.c:375:5: */
 66039  	var i int32
 66040  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd10)) / uint32(unsafe.Sizeof(struct {
 66041  		FzName      uintptr
 66042  		FxProc      uintptr
 66043  		FclientData uintptr
 66044  	}{}))); i++ {
 66045  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd10[i].FzName,
 66046  			aObjCmd10[i].FxProc, aObjCmd10[i].FclientData, uintptr(0))
 66047  	}
 66048  	return TCL_OK
 66049  }
 66050  
 66051  var aObjCmd10 = [2]struct {
 66052  	FzName      uintptr
 66053  	FxProc      uintptr
 66054  	FclientData uintptr
 66055  }{
 66056  	{FzName: ts + 32957 /* "sqlite3_intarray..." */, FxProc: 0},
 66057  	{FzName: ts + 32981 /* "sqlite3_intarray..." */, FxProc: 0},
 66058  } /* test_intarray.c:380:5 */
 66059  
 66060  // Maximum pathname length supported by the jt backend.
 66061  
 66062  // Name used to identify this VFS.
 66063  
 66064  type jt_file1 = struct {
 66065  	Fbase      sqlite3_file
 66066  	FzName     uintptr
 66067  	Fflags     int32
 66068  	FeLock     int32
 66069  	FnPage     u32
 66070  	FnPagesize u32
 66071  	FpWritable uintptr
 66072  	FaCksum    uintptr
 66073  	FnSync     int32
 66074  	_          [4]byte
 66075  	FiMaxOff   sqlite3_int64
 66076  	FpNext     uintptr
 66077  	FpReal     uintptr
 66078  } /* test_journal.c:111:9 */
 66079  
 66080  // Maximum pathname length supported by the jt backend.
 66081  
 66082  // Name used to identify this VFS.
 66083  
 66084  type jt_file = jt_file1 /* test_journal.c:111:24 */
 66085  
 66086  var jt_vfs = sqlite3_vfs{
 66087  	FiVersion:          2,                               // iVersion
 66088  	FszOsFile:          int32(unsafe.Sizeof(jt_file{})), // szOsFile
 66089  	FmxPathname:        JT_MAX_PATHNAME,                 // pNext
 66090  	FzName:             ts + 33003,                      /* "jt" */ // pAppData
 66091  	FxOpen:             0,                               // xOpen
 66092  	FxDelete:           0,                               // xDelete
 66093  	FxAccess:           0,                               // xAccess
 66094  	FxFullPathname:     0,                               // xFullPathname
 66095  	FxDlOpen:           0,                               // xDlOpen
 66096  	FxDlError:          0,                               // xDlError
 66097  	FxDlSym:            0,                               // xDlSym
 66098  	FxDlClose:          0,                               // xDlClose
 66099  	FxRandomness:       0,                               // xRandomness
 66100  	FxSleep:            0,                               // xSleep
 66101  	FxCurrentTime:      0,                               // xCurrentTime
 66102  	FxGetLastError:     0,                               // xGetLastError
 66103  	FxCurrentTimeInt64: 0,                               // xCurrentTimeInt64
 66104  } /* test_journal.c:165:20 */
 66105  
 66106  var jt_io_methods = sqlite3_io_methods{
 66107  	FiVersion:               1, // iVersion
 66108  	FxClose:                 0, // xClose
 66109  	FxRead:                  0, // xRead
 66110  	FxWrite:                 0, // xWrite
 66111  	FxTruncate:              0, // xTruncate
 66112  	FxSync:                  0, // xSync
 66113  	FxFileSize:              0, // xFileSize
 66114  	FxLock:                  0, // xLock
 66115  	FxUnlock:                0, // xUnlock
 66116  	FxCheckReservedLock:     0, // xCheckReservedLock
 66117  	FxFileControl:           0, // xFileControl
 66118  	FxSectorSize:            0, // xSectorSize
 66119  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 66120  } /* test_journal.c:187:27 */
 66121  
 66122  type JtGlobal = struct {
 66123  	FpVfs  uintptr
 66124  	FpList uintptr
 66125  } /* test_journal.c:203:1 */
 66126  
 66127  var g2 = JtGlobal{} /* test_journal.c:207:24 */
 66128  
 66129  // Functions to obtain and relinquish a mutex to protect g.pList. The
 66130  // STATIC_PRNG mutex is reused, purely for the sake of convenience.
 66131  func enterJtMutex(tls *libc.TLS) { /* test_journal.c:213:13: */
 66132  	sqlite3.Xsqlite3_mutex_enter(tls, sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_STATIC_PRNG))
 66133  }
 66134  
 66135  func leaveJtMutex(tls *libc.TLS) { /* test_journal.c:216:13: */
 66136  	sqlite3.Xsqlite3_mutex_leave(tls, sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_STATIC_PRNG))
 66137  }
 66138  
 66139  func stop_ioerr_simulation(tls *libc.TLS, piSave uintptr, piSave2 uintptr) { /* test_journal.c:222:13: */
 66140  	*(*int32)(unsafe.Pointer(piSave)) = libc.AtomicLoadInt32(&sqlite3.Xsqlite3_io_error_pending)
 66141  	*(*int32)(unsafe.Pointer(piSave2)) = sqlite3.Xsqlite3_io_error_hit
 66142  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(-1))
 66143  	sqlite3.Xsqlite3_io_error_hit = 0
 66144  }
 66145  
 66146  func start_ioerr_simulation(tls *libc.TLS, iSave int32, iSave2 int32) { /* test_journal.c:228:13: */
 66147  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(iSave))
 66148  	sqlite3.Xsqlite3_io_error_hit = iSave2
 66149  }
 66150  
 66151  // The jt_file pointed to by the argument may or may not be a file-handle
 66152  // open on a main database file. If it is, and a transaction is currently
 66153  // opened on the file, then discard all transaction related data.
 66154  func closeTransaction(tls *libc.TLS, p uintptr) { /* test_journal.c:238:13: */
 66155  	sqlite3.Xsqlite3BitvecDestroy(tls, (*jt_file)(unsafe.Pointer(p)).FpWritable)
 66156  	sqlite3.Xsqlite3_free(tls, (*jt_file)(unsafe.Pointer(p)).FaCksum)
 66157  	(*jt_file)(unsafe.Pointer(p)).FpWritable = uintptr(0)
 66158  	(*jt_file)(unsafe.Pointer(p)).FaCksum = uintptr(0)
 66159  	(*jt_file)(unsafe.Pointer(p)).FnSync = 0
 66160  }
 66161  
 66162  // Close an jt-file.
 66163  func jtClose(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:249:12: */
 66164  	var pp uintptr
 66165  	var p uintptr = pFile
 66166  
 66167  	closeTransaction(tls, p)
 66168  	enterJtMutex(tls)
 66169  	if (*jt_file)(unsafe.Pointer(p)).FzName != 0 {
 66170  		for pp = (uintptr(unsafe.Pointer(&g2)) + 4 /* &.pList */); *(*uintptr)(unsafe.Pointer(pp)) != p; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 48 /* &.pNext */) {
 66171  		}
 66172  		*(*uintptr)(unsafe.Pointer(pp)) = (*jt_file)(unsafe.Pointer(p)).FpNext
 66173  	}
 66174  	leaveJtMutex(tls)
 66175  	sqlite3.Xsqlite3OsClose(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 66176  	return SQLITE_OK
 66177  }
 66178  
 66179  // Read data from an jt-file.
 66180  func jtRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_journal.c:267:12: */
 66181  	var p uintptr = pFile
 66182  	return sqlite3.Xsqlite3OsRead(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 66183  }
 66184  
 66185  //
 66186  // Parameter zJournal is the name of a journal file that is currently
 66187  // open. This function locates and returns the handle opened on the
 66188  // corresponding database file by the pager that currently has the
 66189  // journal file opened. This file-handle is identified by the
 66190  // following properties:
 66191  //
 66192  //   a) SQLITE_OPEN_MAIN_DB was specified when the file was opened.
 66193  //
 66194  //   b) The file-name specified when the file was opened matches
 66195  //      all but the final 8 characters of the journal file name.
 66196  //
 66197  //   c) There is currently a reserved lock on the file. This
 66198  //      condition is waived if the noLock argument is non-zero.
 66199  //
 66200  func locateDatabaseHandle(tls *libc.TLS, zJournal uintptr, noLock int32) uintptr { /* test_journal.c:292:16: */
 66201  	var pMain uintptr = uintptr(0)
 66202  	enterJtMutex(tls)
 66203  	for pMain = g2.FpList; pMain != 0; pMain = (*jt_file)(unsafe.Pointer(pMain)).FpNext {
 66204  		var nName int32 = (int32(libc.Xstrlen(tls, zJournal) - libc.Xstrlen(tls, ts+33006 /* "-journal" */)))
 66205  		if (((((*jt_file)(unsafe.Pointer(pMain)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) &&
 66206  			(int32(libc.Xstrlen(tls, (*jt_file)(unsafe.Pointer(pMain)).FzName)) == nName)) &&
 66207  			(0 == libc.Xmemcmp(tls, (*jt_file)(unsafe.Pointer(pMain)).FzName, zJournal, uint32(nName)))) &&
 66208  			(((*jt_file)(unsafe.Pointer(pMain)).FeLock >= SQLITE_LOCK_RESERVED) || (noLock != 0)) {
 66209  			break
 66210  		}
 66211  	}
 66212  	leaveJtMutex(tls)
 66213  	return pMain
 66214  }
 66215  
 66216  // Parameter z points to a buffer of 4 bytes in size containing a
 66217  // unsigned 32-bit integer stored in big-endian format. Decode the
 66218  // integer and return its value.
 66219  func decodeUint32(tls *libc.TLS, z uintptr) u32 { /* test_journal.c:314:12: */
 66220  	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)))))
 66221  }
 66222  
 66223  // Calculate a checksum from the buffer of length n bytes pointed to
 66224  // by parameter z.
 66225  func genCksum(tls *libc.TLS, z uintptr, n int32) u32 { /* test_journal.c:322:12: */
 66226  	var i int32
 66227  	var cksum u32 = u32(0)
 66228  	for i = 0; i < n; i++ {
 66229  		cksum = ((cksum + u32(*(*uint8)(unsafe.Pointer(z + uintptr(i))))) + (cksum << 3))
 66230  	}
 66231  	return cksum
 66232  }
 66233  
 66234  // The first argument, zBuf, points to a buffer containing a 28 byte
 66235  // serialized journal header. This function deserializes four of the
 66236  // integer fields contained in the journal header and writes their
 66237  // values to the output variables.
 66238  //
 66239  // SQLITE_OK is returned if the journal-header is successfully
 66240  // decoded. Otherwise, SQLITE_ERROR.
 66241  func decodeJournalHdr(tls *libc.TLS, zBuf uintptr, pnRec uintptr, pnPage uintptr, pnSector uintptr, pnPagesize uintptr) int32 { /* test_journal.c:340:12: */
 66242  	bp := tls.Alloc(8)
 66243  	defer tls.Free(8)
 66244  
 66245  	*(*[8]uint8)(unsafe.Pointer(bp /* aMagic */)) = [8]uint8{uint8(0xd9), uint8(0xd5), uint8(0x05), uint8(0xf9), uint8(0x20), uint8(0xa1), uint8(0x63), uint8(0xd7)}
 66246  	if libc.Xmemcmp(tls, bp /* &aMagic[0] */, zBuf, uint32(8)) != 0 {
 66247  		return SQLITE_ERROR
 66248  	}
 66249  	if pnRec != 0 {
 66250  		*(*u32)(unsafe.Pointer(pnRec)) = decodeUint32(tls, (zBuf + 8))
 66251  	}
 66252  	if pnPage != 0 {
 66253  		*(*u32)(unsafe.Pointer(pnPage)) = decodeUint32(tls, (zBuf + 16))
 66254  	}
 66255  	if pnSector != 0 {
 66256  		*(*u32)(unsafe.Pointer(pnSector)) = decodeUint32(tls, (zBuf + 20))
 66257  	}
 66258  	if pnPagesize != 0 {
 66259  		*(*u32)(unsafe.Pointer(pnPagesize)) = decodeUint32(tls, (zBuf + 24))
 66260  	}
 66261  	return SQLITE_OK
 66262  }
 66263  
 66264  // This function is called when a new transaction is opened, just after
 66265  // the first journal-header is written to the journal file.
 66266  func openTransaction(tls *libc.TLS, pMain uintptr, pJournal uintptr) int32 { /* test_journal.c:360:12: */
 66267  	bp := tls.Alloc(8)
 66268  	defer tls.Free(8)
 66269  
 66270  	var aData uintptr
 66271  	var p uintptr = (*jt_file)(unsafe.Pointer(pMain)).FpReal
 66272  	var rc int32 = SQLITE_OK
 66273  
 66274  	closeTransaction(tls, pMain)
 66275  	aData = sqlite3.Xsqlite3_malloc(tls, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66276  	(*jt_file)(unsafe.Pointer(pMain)).FpWritable = sqlite3.Xsqlite3BitvecCreate(tls, (*jt_file)(unsafe.Pointer(pMain)).FnPage)
 66277  	(*jt_file)(unsafe.Pointer(pMain)).FaCksum = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(u32(0))) * ((*jt_file)(unsafe.Pointer(pMain)).FnPage + u32(1)))))
 66278  	(*jt_file)(unsafe.Pointer(pJournal)).FiMaxOff = int64(0)
 66279  
 66280  	if (!(int32((*jt_file)(unsafe.Pointer(pMain)).FpWritable) != 0) || !(int32((*jt_file)(unsafe.Pointer(pMain)).FaCksum) != 0)) || !(aData != 0) {
 66281  		rc = (SQLITE_IOERR | (int32(12) << 8))
 66282  	} else if (*jt_file)(unsafe.Pointer(pMain)).FnPage > u32(0) {
 66283  		var iTrunk u32
 66284  		// var iSave int32 at bp, 4
 66285  
 66286  		// var iSave2 int32 at bp+4, 4
 66287  
 66288  		stop_ioerr_simulation(tls, bp /* &iSave */, bp+4 /* &iSave2 */)
 66289  
 66290  		// Read the database free-list. Add the page-number for each free-list
 66291  		// leaf to the jt_file.pWritable bitvec.
 66292  		rc = sqlite3.Xsqlite3OsRead(tls, p, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), int64(0))
 66293  		if rc == SQLITE_OK {
 66294  			var nDbsize u32 = decodeUint32(tls, (aData + 28))
 66295  			if (nDbsize > u32(0)) && (libc.Xmemcmp(tls, (aData+24), (aData+92), uint32(4)) == 0) {
 66296  				var iPg u32
 66297  				for iPg = (nDbsize + u32(1)); iPg <= (*jt_file)(unsafe.Pointer(pMain)).FnPage; iPg++ {
 66298  					sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, iPg)
 66299  				}
 66300  			}
 66301  		}
 66302  		iTrunk = decodeUint32(tls, (aData + 32))
 66303  		for (rc == SQLITE_OK) && (iTrunk > u32(0)) {
 66304  			var nLeaf u32
 66305  			var iLeaf u32
 66306  			var iOff sqlite3_int64 = ((i64(iTrunk - u32(1))) * i64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66307  			rc = sqlite3.Xsqlite3OsRead(tls, p, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), iOff)
 66308  			nLeaf = decodeUint32(tls, (aData + 4))
 66309  			for iLeaf = u32(0); (rc == SQLITE_OK) && (iLeaf < nLeaf); iLeaf++ {
 66310  				var pgno u32 = decodeUint32(tls, (aData + uintptr((u32(8) + (u32(4) * iLeaf)))))
 66311  				sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)
 66312  			}
 66313  			iTrunk = decodeUint32(tls, aData)
 66314  		}
 66315  
 66316  		// Calculate and store a checksum for each page in the database file.
 66317  		if rc == SQLITE_OK {
 66318  			var ii int32
 66319  			for ii = 0; (rc == SQLITE_OK) && (ii < int32((*jt_file)(unsafe.Pointer(pMain)).FnPage)); ii++ {
 66320  				var iOff i64 = ((i64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize)) * i64(ii))
 66321  				if iOff == i64(sqlite3.Xsqlite3PendingByte) {
 66322  					continue
 66323  				}
 66324  				rc = sqlite3.Xsqlite3OsRead(tls, (*jt_file)(unsafe.Pointer(pMain)).FpReal, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), iOff)
 66325  				*(*u32)(unsafe.Pointer((*jt_file)(unsafe.Pointer(pMain)).FaCksum + uintptr(ii)*4)) = genCksum(tls, aData, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66326  				if ((ii + 1) == int32((*jt_file)(unsafe.Pointer(pMain)).FnPage)) && (rc == (SQLITE_IOERR | (int32(2) << 8))) {
 66327  					rc = SQLITE_OK
 66328  				}
 66329  			}
 66330  		}
 66331  
 66332  		start_ioerr_simulation(tls, *(*int32)(unsafe.Pointer(bp /* iSave */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSave2 */)))
 66333  	}
 66334  
 66335  	sqlite3.Xsqlite3_free(tls, aData)
 66336  	return rc
 66337  }
 66338  
 66339  // The first argument to this function is a handle open on a journal file.
 66340  // This function reads the journal file and adds the page number for each
 66341  // page in the journal to the Bitvec object passed as the second argument.
 66342  func readJournalFile(tls *libc.TLS, p uintptr, pMain uintptr) int32 { /* test_journal.c:433:12: */
 66343  	bp := tls.Alloc(52)
 66344  	defer tls.Free(52)
 66345  
 66346  	var rc int32
 66347  	// var zBuf [28]uint8 at bp+8, 28
 66348  
 66349  	var pReal uintptr
 66350  	var iOff sqlite3_int64
 66351  	var iSize sqlite3_int64
 66352  	var aPage uintptr
 66353  	// var iSave int32 at bp, 4
 66354  
 66355  	// var iSave2 int32 at bp+4, 4
 66356  
 66357  	var cksum u32
 66358  	_ = cksum
 66359  	var pgno u32
 66360  	// var nRec u32 at bp+36, 4
 66361  
 66362  	// var nPage u32 at bp+40, 4
 66363  
 66364  	// var nSector u32 at bp+44, 4
 66365  
 66366  	// var nPagesize u32 at bp+48, 4
 66367  
 66368  	var ii u32
 66369  	rc = SQLITE_OK
 66370  	pReal = (*jt_file)(unsafe.Pointer(p)).FpReal
 66371  	iOff = int64(0)
 66372  	iSize = (*jt_file)(unsafe.Pointer(p)).FiMaxOff
 66373  
 66374  	aPage = sqlite3.Xsqlite3_malloc(tls, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66375  	if !(!(aPage != 0)) {
 66376  		goto __1
 66377  	}
 66378  	return (SQLITE_IOERR | (int32(12) << 8))
 66379  __1:
 66380  	;
 66381  
 66382  	stop_ioerr_simulation(tls, bp /* &iSave */, bp+4 /* &iSave2 */)
 66383  
 66384  __2:
 66385  	if !((rc == SQLITE_OK) && (iOff < iSize)) {
 66386  		goto __3
 66387  	}
 66388  
 66389  	// Read and decode the next journal-header from the journal file.
 66390  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 28, iOff)
 66391  	if !((rc != SQLITE_OK) ||
 66392  		(decodeJournalHdr(tls, bp+8 /* &zBuf[0] */, bp+36 /* &nRec */, bp+40 /* &nPage */, bp+44 /* &nSector */, bp+48 /* &nPagesize */) != 0)) {
 66393  		goto __4
 66394  	}
 66395  	goto finish_rjf
 66396  __4:
 66397  	;
 66398  	iOff = iOff + (sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */))))
 66399  
 66400  	if !(*(*u32)(unsafe.Pointer(bp + 36 /* nRec */)) == u32(0)) {
 66401  		goto __5
 66402  	}
 66403  	// A trick. There might be another journal-header immediately
 66404  	// following this one. In this case, 0 records means 0 records,
 66405  	// not "read until the end of the file". See also ticket #2565.
 66406  	if !(iSize >= (iOff + sqlite3_int64(*(*u32)(unsafe.Pointer(bp + 44 /* nSector */))))) {
 66407  		goto __6
 66408  	}
 66409  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 28, iOff)
 66410  	if !((rc != SQLITE_OK) || (0 == decodeJournalHdr(tls, bp+8 /* &zBuf[0] */, uintptr(0), uintptr(0), uintptr(0), uintptr(0)))) {
 66411  		goto __7
 66412  	}
 66413  	goto __2
 66414  __7:
 66415  	;
 66416  __6:
 66417  	;
 66418  	*(*u32)(unsafe.Pointer(bp + 36 /* nRec */)) = (u32((iSize - iOff) / (sqlite3_int64((*jt_file)(unsafe.Pointer(pMain)).FnPagesize + u32(8)))))
 66419  __5:
 66420  	;
 66421  
 66422  	// Read all the records that follow the journal-header just read.
 66423  	ii = u32(0)
 66424  __8:
 66425  	if !(((rc == SQLITE_OK) && (ii < *(*u32)(unsafe.Pointer(bp + 36 /* nRec */)))) && (iOff < iSize)) {
 66426  		goto __10
 66427  	}
 66428  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, bp+8 /* &zBuf[0] */, 4, iOff)
 66429  	if !(rc == SQLITE_OK) {
 66430  		goto __11
 66431  	}
 66432  	pgno = decodeUint32(tls, bp+8 /* &zBuf[0] */)
 66433  	if !((pgno > u32(0)) && (pgno <= (*jt_file)(unsafe.Pointer(pMain)).FnPage)) {
 66434  		goto __12
 66435  	}
 66436  	if !(0 == sqlite3.Xsqlite3BitvecTest(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)) {
 66437  		goto __13
 66438  	}
 66439  	rc = sqlite3.Xsqlite3OsRead(tls, pReal, aPage, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize), (iOff + int64(4)))
 66440  	if !(rc == SQLITE_OK) {
 66441  		goto __14
 66442  	}
 66443  	cksum = genCksum(tls, aPage, int32((*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66444  
 66445  __14:
 66446  	;
 66447  __13:
 66448  	;
 66449  	sqlite3.Xsqlite3BitvecSet(tls, (*jt_file)(unsafe.Pointer(pMain)).FpWritable, pgno)
 66450  __12:
 66451  	;
 66452  	iOff = iOff + (sqlite3_int64(u32(8) + (*jt_file)(unsafe.Pointer(pMain)).FnPagesize))
 66453  __11:
 66454  	;
 66455  	goto __9
 66456  __9:
 66457  	ii++
 66458  	goto __8
 66459  	goto __10
 66460  __10:
 66461  	;
 66462  
 66463  	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 */))))
 66464  	goto __2
 66465  __3:
 66466  	;
 66467  
 66468  finish_rjf:
 66469  	start_ioerr_simulation(tls, *(*int32)(unsafe.Pointer(bp /* iSave */)), *(*int32)(unsafe.Pointer(bp + 4 /* iSave2 */)))
 66470  	sqlite3.Xsqlite3_free(tls, aPage)
 66471  	if !(rc == (SQLITE_IOERR | (int32(2) << 8))) {
 66472  		goto __15
 66473  	}
 66474  	rc = SQLITE_OK
 66475  __15:
 66476  	;
 66477  	return rc
 66478  }
 66479  
 66480  // Write data to an jt-file.
 66481  func jtWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_journal.c:512:12: */
 66482  	var rc int32
 66483  	var p uintptr = pFile
 66484  	if ((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 66485  		if iOfst == int64(0) {
 66486  			var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 66487  
 66488  			if iAmt == 28 {
 66489  				// Zeroing the first journal-file header. This is the end of a
 66490  				// transaction.
 66491  				closeTransaction(tls, pMain)
 66492  			} else if iAmt != 12 {
 66493  				// Writing the first journal header to a journal file. This happens
 66494  				// when a transaction is first started.
 66495  				var z uintptr = zBuf
 66496  				(*jt_file)(unsafe.Pointer(pMain)).FnPage = decodeUint32(tls, (z + 16))
 66497  				(*jt_file)(unsafe.Pointer(pMain)).FnPagesize = decodeUint32(tls, (z + 24))
 66498  				if SQLITE_OK != (libc.AssignInt32(&rc, openTransaction(tls, pMain, p))) {
 66499  					return rc
 66500  				}
 66501  			}
 66502  		}
 66503  		if (*jt_file)(unsafe.Pointer(p)).FiMaxOff < (iOfst + sqlite_int64(iAmt)) {
 66504  			(*jt_file)(unsafe.Pointer(p)).FiMaxOff = (iOfst + sqlite_int64(iAmt))
 66505  		}
 66506  	}
 66507  
 66508  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) && ((*jt_file)(unsafe.Pointer(p)).FpWritable != 0) {
 66509  		if (((iAmt < int32((*jt_file)(unsafe.Pointer(p)).FnPagesize)) &&
 66510  			(((*jt_file)(unsafe.Pointer(p)).FnPagesize % u32(iAmt)) == u32(0))) &&
 66511  			(iOfst >= (sqlite_int64(sqlite3.Xsqlite3PendingByte + 512)))) &&
 66512  			((iOfst + sqlite_int64(iAmt)) <= (sqlite_int64(u32(sqlite3.Xsqlite3PendingByte) + (*jt_file)(unsafe.Pointer(p)).FnPagesize))) {
 66513  			// No-op. This special case is hit when the backup code is copying a
 66514  			// to a database with a larger page-size than the source database and
 66515  			// it needs to fill in the non-locking-region part of the original
 66516  			// pending-byte page.
 66517  		} else {
 66518  			var pgno u32 = (u32((iOfst / sqlite_int64((*jt_file)(unsafe.Pointer(p)).FnPagesize)) + int64(1)))
 66519  			_ = pgno
 66520  
 66521  			// The following assert() statements may fail if this layer is used
 66522  			// with a connection in "PRAGMA synchronous=off" mode. If they
 66523  			// fail with sync=normal or sync=full, this may indicate problem.
 66524  
 66525  		}
 66526  	}
 66527  
 66528  	rc = sqlite3.Xsqlite3OsWrite(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 66529  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0) && (iAmt == 12) {
 66530  		var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 66531  		var rc2 int32 = readJournalFile(tls, p, pMain)
 66532  		if rc == SQLITE_OK {
 66533  			rc = rc2
 66534  		}
 66535  	}
 66536  	return rc
 66537  }
 66538  
 66539  // Truncate an jt-file.
 66540  func jtTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_journal.c:580:12: */
 66541  	var p uintptr = pFile
 66542  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0) && (size == int64(0)) {
 66543  		// Truncating a journal file. This is the end of a transaction.
 66544  		var pMain uintptr = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 66545  		closeTransaction(tls, pMain)
 66546  	}
 66547  	if (((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_DB) != 0) && ((*jt_file)(unsafe.Pointer(p)).FpWritable != 0) {
 66548  		var pgno u32
 66549  		var locking_page u32 = ((u32(sqlite3.Xsqlite3PendingByte) / (*jt_file)(unsafe.Pointer(p)).FnPagesize) + u32(1))
 66550  		_ = locking_page
 66551  		for pgno = (u32((size / sqlite_int64((*jt_file)(unsafe.Pointer(p)).FnPagesize)) + int64(1))); pgno <= (*jt_file)(unsafe.Pointer(p)).FnPage; pgno++ {
 66552  
 66553  		}
 66554  	}
 66555  	return sqlite3.Xsqlite3OsTruncate(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, size)
 66556  }
 66557  
 66558  // Sync an jt-file.
 66559  func jtSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_journal.c:600:12: */
 66560  	var p uintptr = pFile
 66561  
 66562  	if ((*jt_file)(unsafe.Pointer(p)).Fflags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 66563  		var rc int32
 66564  		var pMain uintptr // The associated database file
 66565  
 66566  		// The journal file is being synced. At this point, we inspect the
 66567  		// contents of the file up to this point and set each bit in the
 66568  		// jt_file.pWritable bitvec of the main database file associated with
 66569  		// this journal file.
 66570  		pMain = locateDatabaseHandle(tls, (*jt_file)(unsafe.Pointer(p)).FzName, 0)
 66571  
 66572  		// Set the bitvec values
 66573  		if (pMain != 0) && ((*jt_file)(unsafe.Pointer(pMain)).FpWritable != 0) {
 66574  			(*jt_file)(unsafe.Pointer(pMain)).FnSync++
 66575  			rc = readJournalFile(tls, p, pMain)
 66576  			if rc != SQLITE_OK {
 66577  				return rc
 66578  			}
 66579  		}
 66580  	}
 66581  
 66582  	return sqlite3.Xsqlite3OsSync(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, flags)
 66583  }
 66584  
 66585  // Return the current file-size of an jt-file.
 66586  func jtFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_journal.c:630:12: */
 66587  	var p uintptr = pFile
 66588  	return sqlite3.Xsqlite3OsFileSize(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, pSize)
 66589  }
 66590  
 66591  // Lock an jt-file.
 66592  func jtLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_journal.c:638:12: */
 66593  	var rc int32
 66594  	var p uintptr = pFile
 66595  	rc = sqlite3.Xsqlite3OsLock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, eLock)
 66596  	if (rc == SQLITE_OK) && (eLock > (*jt_file)(unsafe.Pointer(p)).FeLock) {
 66597  		(*jt_file)(unsafe.Pointer(p)).FeLock = eLock
 66598  	}
 66599  	return rc
 66600  }
 66601  
 66602  // Unlock an jt-file.
 66603  func jtUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_journal.c:651:12: */
 66604  	var rc int32
 66605  	var p uintptr = pFile
 66606  	rc = sqlite3.Xsqlite3OsUnlock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, eLock)
 66607  	if (rc == SQLITE_OK) && (eLock < (*jt_file)(unsafe.Pointer(p)).FeLock) {
 66608  		(*jt_file)(unsafe.Pointer(p)).FeLock = eLock
 66609  	}
 66610  	return rc
 66611  }
 66612  
 66613  // Check if another file-handle holds a RESERVED lock on an jt-file.
 66614  func jtCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_journal.c:664:12: */
 66615  	var p uintptr = pFile
 66616  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, pResOut)
 66617  }
 66618  
 66619  // File control method. For custom operations on an jt-file.
 66620  func jtFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_journal.c:672:12: */
 66621  	var p uintptr = pFile
 66622  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*jt_file)(unsafe.Pointer(p)).FpReal)).FpMethods + 40 /* &.xFileControl */))))(tls, (*jt_file)(unsafe.Pointer(p)).FpReal, op, pArg)
 66623  }
 66624  
 66625  // Return the sector-size in bytes for an jt-file.
 66626  func jtSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:680:12: */
 66627  	var p uintptr = pFile
 66628  	return sqlite3.Xsqlite3OsSectorSize(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 66629  }
 66630  
 66631  // Return the device characteristic flags supported by an jt-file.
 66632  func jtDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_journal.c:688:12: */
 66633  	var p uintptr = pFile
 66634  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*jt_file)(unsafe.Pointer(p)).FpReal)
 66635  }
 66636  
 66637  // Open an jt file handle.
 66638  func jtOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_journal.c:696:12: */
 66639  	var rc int32
 66640  	var p uintptr = pFile
 66641  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(0)
 66642  	(*jt_file)(unsafe.Pointer(p)).FpReal = (p + 1*56)
 66643  	(*sqlite3_file)(unsafe.Pointer((*jt_file)(unsafe.Pointer(p)).FpReal)).FpMethods = uintptr(0)
 66644  	rc = sqlite3.Xsqlite3OsOpen(tls, g2.FpVfs, zName, (*jt_file)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 66645  
 66646  	if rc == SQLITE_OK {
 66647  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&jt_io_methods))
 66648  		(*jt_file)(unsafe.Pointer(p)).FeLock = 0
 66649  		(*jt_file)(unsafe.Pointer(p)).FzName = zName
 66650  		(*jt_file)(unsafe.Pointer(p)).Fflags = flags
 66651  		(*jt_file)(unsafe.Pointer(p)).FpNext = uintptr(0)
 66652  		(*jt_file)(unsafe.Pointer(p)).FpWritable = uintptr(0)
 66653  		(*jt_file)(unsafe.Pointer(p)).FaCksum = uintptr(0)
 66654  		enterJtMutex(tls)
 66655  		if zName != 0 {
 66656  			(*jt_file)(unsafe.Pointer(p)).FpNext = g2.FpList
 66657  			g2.FpList = p
 66658  		}
 66659  		leaveJtMutex(tls)
 66660  	}
 66661  	return rc
 66662  }
 66663  
 66664  // Delete the file located at zPath. If the dirSync argument is true,
 66665  // ensure the file-system modifications are synced to disk before
 66666  // returning.
 66667  func jtDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_journal.c:733:12: */
 66668  	var nPath int32 = int32(libc.Xstrlen(tls, zPath))
 66669  	if (nPath > 8) && (0 == libc.Xstrcmp(tls, ts+33006 /* "-journal" */, (zPath+uintptr((nPath-8))))) {
 66670  		// Deleting a journal file. The end of a transaction.
 66671  		var pMain uintptr = locateDatabaseHandle(tls, zPath, 0)
 66672  		if pMain != 0 {
 66673  			closeTransaction(tls, pMain)
 66674  		}
 66675  	}
 66676  
 66677  	return sqlite3.Xsqlite3OsDelete(tls, g2.FpVfs, zPath, dirSync)
 66678  }
 66679  
 66680  // Test for access permissions. Return true if the requested permission
 66681  // is available, or false otherwise.
 66682  func jtAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_journal.c:750:12: */
 66683  	return sqlite3.Xsqlite3OsAccess(tls, g2.FpVfs, zPath, flags, pResOut)
 66684  }
 66685  
 66686  // Populate buffer zOut with the full canonical pathname corresponding
 66687  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 66688  // of at least (JT_MAX_PATHNAME+1) bytes.
 66689  func jtFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_journal.c:764:12: */
 66690  	return sqlite3.Xsqlite3OsFullPathname(tls, g2.FpVfs, zPath, nOut, zOut)
 66691  }
 66692  
 66693  // Open the dynamic library located at zPath and return a handle.
 66694  func jtDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_journal.c:776:13: */
 66695  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((g2.FpVfs + 40 /* &.xDlOpen */))))(tls, g2.FpVfs, zPath)
 66696  }
 66697  
 66698  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 66699  // utf-8 string describing the most recent error encountered associated
 66700  // with dynamic libraries.
 66701  func jtDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_journal.c:785:13: */
 66702  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((g2.FpVfs + 44 /* &.xDlError */))))(tls, g2.FpVfs, nByte, zErrMsg)
 66703  }
 66704  
 66705  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 66706  func jtDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* test_journal.c:792:13: */
 66707  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((g2.FpVfs + 48 /* &.xDlSym */))))(tls, g2.FpVfs, p, zSym)
 66708  }
 66709  
 66710  // Close the dynamic library handle pHandle.
 66711  func jtDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_journal.c:799:13: */
 66712  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((g2.FpVfs + 52 /* &.xDlClose */))))(tls, g2.FpVfs, pHandle)
 66713  }
 66714  
 66715  // Populate the buffer pointed to by zBufOut with nByte bytes of
 66716  // random data.
 66717  func jtRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_journal.c:807:12: */
 66718  	return sqlite3.Xsqlite3OsRandomness(tls, g2.FpVfs, nByte, zBufOut)
 66719  }
 66720  
 66721  // Sleep for nMicro microseconds. Return the number of microseconds
 66722  // actually slept.
 66723  func jtSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_journal.c:815:12: */
 66724  	return sqlite3.Xsqlite3OsSleep(tls, g2.FpVfs, nMicro)
 66725  }
 66726  
 66727  // Return the current time as a Julian Day number in *pTimeOut.
 66728  func jtCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_journal.c:822:12: */
 66729  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 64 /* &.xCurrentTime */))))(tls, g2.FpVfs, pTimeOut)
 66730  }
 66731  
 66732  // Return the current time as a Julian Day number in *pTimeOut.
 66733  func jtCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_journal.c:828:12: */
 66734  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 72 /* &.xCurrentTimeInt64 */))))(tls, g2.FpVfs, pTimeOut)
 66735  }
 66736  
 66737  func jtGetLastError(tls *libc.TLS, pVfs uintptr, n int32, z uintptr) int32 { /* test_journal.c:832:12: */
 66738  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((g2.FpVfs + 68 /* &.xGetLastError */))))(tls, g2.FpVfs, n, z)
 66739  }
 66740  
 66741  // *************************************************************************
 66742  //
 66743  // Start of public API.
 66744  
 66745  // Configure the jt VFS as a wrapper around the VFS named by parameter
 66746  // zWrap. If the isDefault parameter is true, then the jt VFS is installed
 66747  // as the new default VFS for SQLite connections. If isDefault is not
 66748  // true, then the jt VFS is installed as non-default. In this case it
 66749  // is available via its name, "jt".
 66750  func jt_register(tls *libc.TLS, zWrap uintptr, isDefault int32) int32 { /* test_journal.c:847:5: */
 66751  	g2.FpVfs = sqlite3.Xsqlite3_vfs_find(tls, zWrap)
 66752  	if g2.FpVfs == uintptr(0) {
 66753  		return SQLITE_ERROR
 66754  	}
 66755  	jt_vfs.FszOsFile = (int32(uint32(unsafe.Sizeof(jt_file{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FszOsFile)))
 66756  	if (*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FiVersion == 1 {
 66757  		jt_vfs.FiVersion = 1
 66758  	} else if (*sqlite3_vfs)(unsafe.Pointer(g2.FpVfs)).FxCurrentTimeInt64 == uintptr(0) {
 66759  		jt_vfs.FxCurrentTimeInt64 = uintptr(0)
 66760  	}
 66761  	sqlite3.Xsqlite3_vfs_register(tls, uintptr(unsafe.Pointer(&jt_vfs)), isDefault)
 66762  	return SQLITE_OK
 66763  }
 66764  
 66765  // Uninstall the jt VFS, if it is installed.
 66766  func jt_unregister(tls *libc.TLS) { /* test_journal.c:865:6: */
 66767  	sqlite3.Xsqlite3_vfs_unregister(tls, uintptr(unsafe.Pointer(&jt_vfs)))
 66768  }
 66769  
 66770  // end block for C++
 66771  
 66772  // Local Variables:
 66773  // mode: c
 66774  // c-basic-offset: 4
 66775  // fill-column: 78
 66776  // End:
 66777  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66778  //    This file is part of the GNU C Library.
 66779  //
 66780  //    The GNU C Library is free software; you can redistribute it and/or
 66781  //    modify it under the terms of the GNU Lesser General Public
 66782  //    License as published by the Free Software Foundation; either
 66783  //    version 2.1 of the License, or (at your option) any later version.
 66784  //
 66785  //    The GNU C Library is distributed in the hope that it will be useful,
 66786  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66787  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66788  //    Lesser General Public License for more details.
 66789  //
 66790  //    You should have received a copy of the GNU Lesser General Public
 66791  //    License along with the GNU C Library; if not, see
 66792  //    <http://www.gnu.org/licenses/>.
 66793  
 66794  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 66795  
 66796  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66797  //    This file is part of the GNU C Library.
 66798  //
 66799  //    The GNU C Library is free software; you can redistribute it and/or
 66800  //    modify it under the terms of the GNU Lesser General Public
 66801  //    License as published by the Free Software Foundation; either
 66802  //    version 2.1 of the License, or (at your option) any later version.
 66803  //
 66804  //    The GNU C Library is distributed in the hope that it will be useful,
 66805  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66806  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66807  //    Lesser General Public License for more details.
 66808  //
 66809  //    You should have received a copy of the GNU Lesser General Public
 66810  //    License along with the GNU C Library; if not, see
 66811  //    <http://www.gnu.org/licenses/>.
 66812  
 66813  //	ISO C99 Standard: 7.21 String handling	<string.h>
 66814  
 66815  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66816  //    This file is part of the GNU C Library.
 66817  //
 66818  //    The GNU C Library is free software; you can redistribute it and/or
 66819  //    modify it under the terms of the GNU Lesser General Public
 66820  //    License as published by the Free Software Foundation; either
 66821  //    version 2.1 of the License, or (at your option) any later version.
 66822  //
 66823  //    The GNU C Library is distributed in the hope that it will be useful,
 66824  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66825  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66826  //    Lesser General Public License for more details.
 66827  //
 66828  //    You should have received a copy of the GNU Lesser General Public
 66829  //    License along with the GNU C Library; if not, see
 66830  //    <http://www.gnu.org/licenses/>.
 66831  
 66832  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 66833  
 66834  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66835  //    This file is part of the GNU C Library.
 66836  //
 66837  //    The GNU C Library is free software; you can redistribute it and/or
 66838  //    modify it under the terms of the GNU Lesser General Public
 66839  //    License as published by the Free Software Foundation; either
 66840  //    version 2.1 of the License, or (at your option) any later version.
 66841  //
 66842  //    The GNU C Library is distributed in the hope that it will be useful,
 66843  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66844  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66845  //    Lesser General Public License for more details.
 66846  //
 66847  //    You should have received a copy of the GNU Lesser General Public
 66848  //    License along with the GNU C Library; if not, see
 66849  //    <http://www.gnu.org/licenses/>.
 66850  
 66851  // void assert (int expression);
 66852  //
 66853  //    If NDEBUG is defined, do nothing.
 66854  //    If not, and EXPRESSION is zero, print an error message and abort.
 66855  
 66856  // void assert_perror (int errnum);
 66857  //
 66858  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 66859  //    error message with the error text for ERRNUM and abort.
 66860  //    (This is a GNU extension.)
 66861  
 66862  // This structure is used to encapsulate the global state variables used
 66863  // by malloc() fault simulation.
 66864  type MemFault = struct {
 66865  	FiCountdown   int32
 66866  	FnRepeat      int32
 66867  	FnBenign      int32
 66868  	FnFail        int32
 66869  	FnOkBefore    int32
 66870  	FnOkAfter     int32
 66871  	Fenable       u8
 66872  	_             [3]byte
 66873  	FisInstalled  int32
 66874  	FisBenignMode int32
 66875  	Fm            sqlite3_mem_methods
 66876  } /* test_malloc.c:30:8 */
 66877  
 66878  // end block for C++
 66879  
 66880  // Local Variables:
 66881  // mode: c
 66882  // c-basic-offset: 4
 66883  // fill-column: 78
 66884  // End:
 66885  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66886  //    This file is part of the GNU C Library.
 66887  //
 66888  //    The GNU C Library is free software; you can redistribute it and/or
 66889  //    modify it under the terms of the GNU Lesser General Public
 66890  //    License as published by the Free Software Foundation; either
 66891  //    version 2.1 of the License, or (at your option) any later version.
 66892  //
 66893  //    The GNU C Library is distributed in the hope that it will be useful,
 66894  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66895  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66896  //    Lesser General Public License for more details.
 66897  //
 66898  //    You should have received a copy of the GNU Lesser General Public
 66899  //    License along with the GNU C Library; if not, see
 66900  //    <http://www.gnu.org/licenses/>.
 66901  
 66902  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 66903  
 66904  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66905  //    This file is part of the GNU C Library.
 66906  //
 66907  //    The GNU C Library is free software; you can redistribute it and/or
 66908  //    modify it under the terms of the GNU Lesser General Public
 66909  //    License as published by the Free Software Foundation; either
 66910  //    version 2.1 of the License, or (at your option) any later version.
 66911  //
 66912  //    The GNU C Library is distributed in the hope that it will be useful,
 66913  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66914  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66915  //    Lesser General Public License for more details.
 66916  //
 66917  //    You should have received a copy of the GNU Lesser General Public
 66918  //    License along with the GNU C Library; if not, see
 66919  //    <http://www.gnu.org/licenses/>.
 66920  
 66921  //	ISO C99 Standard: 7.21 String handling	<string.h>
 66922  
 66923  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66924  //    This file is part of the GNU C Library.
 66925  //
 66926  //    The GNU C Library is free software; you can redistribute it and/or
 66927  //    modify it under the terms of the GNU Lesser General Public
 66928  //    License as published by the Free Software Foundation; either
 66929  //    version 2.1 of the License, or (at your option) any later version.
 66930  //
 66931  //    The GNU C Library is distributed in the hope that it will be useful,
 66932  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66933  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66934  //    Lesser General Public License for more details.
 66935  //
 66936  //    You should have received a copy of the GNU Lesser General Public
 66937  //    License along with the GNU C Library; if not, see
 66938  //    <http://www.gnu.org/licenses/>.
 66939  
 66940  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 66941  
 66942  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 66943  //    This file is part of the GNU C Library.
 66944  //
 66945  //    The GNU C Library is free software; you can redistribute it and/or
 66946  //    modify it under the terms of the GNU Lesser General Public
 66947  //    License as published by the Free Software Foundation; either
 66948  //    version 2.1 of the License, or (at your option) any later version.
 66949  //
 66950  //    The GNU C Library is distributed in the hope that it will be useful,
 66951  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 66952  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 66953  //    Lesser General Public License for more details.
 66954  //
 66955  //    You should have received a copy of the GNU Lesser General Public
 66956  //    License along with the GNU C Library; if not, see
 66957  //    <http://www.gnu.org/licenses/>.
 66958  
 66959  // void assert (int expression);
 66960  //
 66961  //    If NDEBUG is defined, do nothing.
 66962  //    If not, and EXPRESSION is zero, print an error message and abort.
 66963  
 66964  // void assert_perror (int errnum);
 66965  //
 66966  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 66967  //    error message with the error text for ERRNUM and abort.
 66968  //    (This is a GNU extension.)
 66969  
 66970  // This structure is used to encapsulate the global state variables used
 66971  // by malloc() fault simulation.
 66972  var memfault MemFault /* test_malloc.c:41:3: */
 66973  
 66974  // This routine exists as a place to set a breakpoint that will
 66975  // fire on any simulated malloc() failure.
 66976  func sqlite3Fault(tls *libc.TLS) { /* test_malloc.c:47:13: */
 66977  	cnt1++
 66978  }
 66979  
 66980  var cnt1 int32 = 0 /* test_malloc.c:48:14 */
 66981  
 66982  // This routine exists as a place to set a breakpoint that will
 66983  // fire the first time any malloc() fails on a single test case.
 66984  // The sqlite3Fault() routine above runs on every malloc() failure.
 66985  // This routine only runs on the first such failure.
 66986  func sqlite3FirstFault(tls *libc.TLS) { /* test_malloc.c:58:13: */
 66987  	cnt2++
 66988  }
 66989  
 66990  var cnt2 int32 = 0 /* test_malloc.c:59:14 */
 66991  
 66992  // Check to see if a fault should be simulated.  Return true to simulate
 66993  // the fault.  Return false if the fault should not be simulated.
 66994  func faultsimStep(tls *libc.TLS) int32 { /* test_malloc.c:67:12: */
 66995  	if !(int32(memfault.Fenable) != 0) {
 66996  		memfault.FnOkAfter++
 66997  		return 0
 66998  	}
 66999  	if memfault.FiCountdown > 0 {
 67000  		memfault.FiCountdown--
 67001  		memfault.FnOkBefore++
 67002  		return 0
 67003  	}
 67004  	if memfault.FnFail == 0 {
 67005  		sqlite3FirstFault(tls)
 67006  	}
 67007  	sqlite3Fault(tls)
 67008  	memfault.FnFail++
 67009  	if memfault.FisBenignMode > 0 {
 67010  		memfault.FnBenign++
 67011  	}
 67012  	memfault.FnRepeat--
 67013  	if memfault.FnRepeat <= 0 {
 67014  		memfault.Fenable = u8(0)
 67015  	}
 67016  	return 1
 67017  }
 67018  
 67019  // A version of sqlite3_mem_methods.xMalloc() that includes fault simulation
 67020  // logic.
 67021  func faultsimMalloc(tls *libc.TLS, n int32) uintptr { /* test_malloc.c:94:13: */
 67022  	var p uintptr = uintptr(0)
 67023  	if !(faultsimStep(tls) != 0) {
 67024  		p = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&memfault)) + 36 /* &.m */ /* &.xMalloc */))))(tls, n)
 67025  	}
 67026  	return p
 67027  }
 67028  
 67029  // A version of sqlite3_mem_methods.xRealloc() that includes fault simulation
 67030  // logic.
 67031  func faultsimRealloc(tls *libc.TLS, pOld uintptr, n int32) uintptr { /* test_malloc.c:107:13: */
 67032  	var p uintptr = uintptr(0)
 67033  	if !(faultsimStep(tls) != 0) {
 67034  		p = (*(*func(*libc.TLS, uintptr, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&memfault)) + 36 /* &.m */ + 8 /* &.xRealloc */))))(tls, pOld, n)
 67035  	}
 67036  	return p
 67037  }
 67038  
 67039  // This routine configures the malloc failure simulation.  After
 67040  // calling this routine, the next nDelay mallocs will succeed, followed
 67041  // by a block of nRepeat failures, after which malloc() calls will begin
 67042  // to succeed again.
 67043  func faultsimConfig(tls *libc.TLS, nDelay int32, nRepeat int32) { /* test_malloc.c:121:13: */
 67044  	memfault.FiCountdown = nDelay
 67045  	memfault.FnRepeat = nRepeat
 67046  	memfault.FnBenign = 0
 67047  	memfault.FnFail = 0
 67048  	memfault.FnOkBefore = 0
 67049  	memfault.FnOkAfter = 0
 67050  	memfault.Fenable = (u8(libc.Bool32(nDelay >= 0)))
 67051  
 67052  	// Sometimes, when running multi-threaded tests, the isBenignMode
 67053  	// variable is not properly incremented/decremented so that it is
 67054  	// 0 when not inside a benign malloc block. This doesn't affect
 67055  	// the multi-threaded tests, as they do not use this system. But
 67056  	// it does affect OOM tests run later in the same process. So
 67057  	// zero the variable here, just to be sure.
 67058  	memfault.FisBenignMode = 0
 67059  }
 67060  
 67061  // Return the number of faults (both hard and benign faults) that have
 67062  // occurred since the injector was last configured.
 67063  func faultsimFailures(tls *libc.TLS) int32 { /* test_malloc.c:144:12: */
 67064  	return memfault.FnFail
 67065  }
 67066  
 67067  // Return the number of benign faults that have occurred since the
 67068  // injector was last configured.
 67069  func faultsimBenignFailures(tls *libc.TLS) int32 { /* test_malloc.c:152:12: */
 67070  	return memfault.FnBenign
 67071  }
 67072  
 67073  // Return the number of successes that will occur before the next failure.
 67074  // If no failures are scheduled, return -1.
 67075  func faultsimPending(tls *libc.TLS) int32 { /* test_malloc.c:160:12: */
 67076  	if memfault.Fenable != 0 {
 67077  		return memfault.FiCountdown
 67078  	} else {
 67079  		return -1
 67080  	}
 67081  	return int32(0)
 67082  }
 67083  
 67084  func faultsimBeginBenign(tls *libc.TLS) { /* test_malloc.c:169:13: */
 67085  	memfault.FisBenignMode++
 67086  }
 67087  
 67088  func faultsimEndBenign(tls *libc.TLS) { /* test_malloc.c:172:13: */
 67089  	memfault.FisBenignMode--
 67090  }
 67091  
 67092  // Add or remove the fault-simulation layer using sqlite3_config(). If
 67093  // the argument is non-zero, the
 67094  func faultsimInstall(tls *libc.TLS, install int32) int32 { /* test_malloc.c:180:12: */
 67095  	bp := tls.Alloc(136)
 67096  	defer tls.Free(136)
 67097  
 67098  	var rc int32
 67099  
 67100  	install = func() int32 {
 67101  		if install != 0 {
 67102  			return 1
 67103  		}
 67104  		return 0
 67105  	}()
 67106  
 67107  	if install == memfault.FisInstalled {
 67108  		return SQLITE_ERROR
 67109  	}
 67110  
 67111  	if install != 0 {
 67112  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp, (uintptr(unsafe.Pointer(&memfault))+36 /* &.m */)))
 67113  
 67114  		if rc == SQLITE_OK {
 67115  			*(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* m */)) = memfault.Fm
 67116  			(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* &m */)).FxMalloc = *(*uintptr)(unsafe.Pointer(&struct {
 67117  				f func(*libc.TLS, int32) uintptr
 67118  			}{faultsimMalloc}))
 67119  			(*sqlite3_mem_methods)(unsafe.Pointer(bp + 72 /* &m */)).FxRealloc = *(*uintptr)(unsafe.Pointer(&struct {
 67120  				f func(*libc.TLS, uintptr, int32) uintptr
 67121  			}{faultsimRealloc}))
 67122  			rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+8, bp+72 /* &m */))
 67123  		}
 67124  		sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,
 67125  			libc.VaList(bp+16, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) }{faultsimBeginBenign})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) }{faultsimEndBenign}))))
 67126  	} else {
 67127  		// var m2 sqlite3_mem_methods at bp+104, 32
 67128  
 67129  		// One should be able to reset the default memory allocator by storing
 67130  		// a zeroed allocator then calling GETMALLOC.
 67131  		libc.Xmemset(tls, bp+104 /* &m2 */, 0, uint32(unsafe.Sizeof(sqlite3_mem_methods{})))
 67132  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+32, bp+104 /* &m2 */))
 67133  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMALLOC, libc.VaList(bp+40, bp+104 /* &m2 */))
 67134  
 67135  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MALLOC, libc.VaList(bp+48, (uintptr(unsafe.Pointer(&memfault))+36 /* &.m */)))
 67136  		sqlite3.Xsqlite3_test_control(tls, SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS,
 67137  			libc.VaList(bp+56, uintptr(0), uintptr(0)))
 67138  	}
 67139  
 67140  	if rc == SQLITE_OK {
 67141  		memfault.FisInstalled = 1
 67142  	}
 67143  	return rc
 67144  }
 67145  
 67146  // Transform pointers to text and back again
 67147  func pointerToText(tls *libc.TLS, p uintptr, z uintptr) { /* test_malloc.c:239:13: */
 67148  	bp := tls.Alloc(16)
 67149  	defer tls.Free(16)
 67150  	*(*uintptr)(unsafe.Pointer(bp + 8)) = p
 67151  
 67152  	var i int32
 67153  	var k int32
 67154  	// var u uint32 at bp+12, 4
 67155  
 67156  	// var n sqlite3_uint64 at bp, 8
 67157  
 67158  	if *(*uintptr)(unsafe.Pointer(bp + 8 /* p */)) == uintptr(0) {
 67159  		libc.Xstrcpy(tls, z, ts+14654 /* "0" */)
 67160  		return
 67161  	}
 67162  	if uint32(unsafe.Sizeof(sqlite3_uint64(0))) == uint32(unsafe.Sizeof(uintptr(0))) {
 67163  		libc.Xmemcpy(tls, bp /* &n */, bp+8 /* &p */, uint32(unsafe.Sizeof(uintptr(0))))
 67164  	} else if uint32(unsafe.Sizeof(uint32(0))) == uint32(unsafe.Sizeof(uintptr(0))) {
 67165  		libc.Xmemcpy(tls, bp+12 /* &u */, bp+8 /* &p */, uint32(unsafe.Sizeof(uint32(0))))
 67166  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = sqlite3_uint64(*(*uint32)(unsafe.Pointer(bp + 12 /* u */)))
 67167  	} else {
 67168  
 67169  	}
 67170  	i = 0
 67171  	k = (int32((uint32(unsafe.Sizeof(uintptr(0))) * uint32(2)) - uint32(1)))
 67172  __1:
 67173  	if !(uint32(i) < (uint32(unsafe.Sizeof(uintptr(0))) * uint32(2))) {
 67174  		goto __3
 67175  	}
 67176  	{
 67177  		*(*int8)(unsafe.Pointer(z + uintptr(k))) = zHex[(*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) & uint64(0xf))]
 67178  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) >>= 4
 67179  
 67180  	}
 67181  	goto __2
 67182  __2:
 67183  	i++
 67184  	k--
 67185  	goto __1
 67186  	goto __3
 67187  __3:
 67188  	;
 67189  	*(*int8)(unsafe.Pointer(z + 8)) = int8(0)
 67190  }
 67191  
 67192  var zHex = *(*[17]int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */)) /* test_malloc.c:240:21 */
 67193  
 67194  func hexToInt(tls *libc.TLS, h int32) int32 { /* test_malloc.c:262:12: */
 67195  	if (h >= '0') && (h <= '9') {
 67196  		return (h - '0')
 67197  	} else if (h >= 'a') && (h <= 'f') {
 67198  		return ((h - 'a') + 10)
 67199  	} else {
 67200  		return -1
 67201  	}
 67202  	return int32(0)
 67203  }
 67204  
 67205  func textToPointer(tls *libc.TLS, z uintptr, pp uintptr) int32 { /* test_malloc.c:271:12: */
 67206  	bp := tls.Alloc(12)
 67207  	defer tls.Free(12)
 67208  
 67209  	*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = uint64(0)
 67210  	var i int32
 67211  	// var u uint32 at bp+8, 4
 67212  
 67213  	for i = 0; (uint32(i) < (uint32(unsafe.Sizeof(uintptr(0))) * uint32(2))) && (*(*int8)(unsafe.Pointer(z)) != 0); i++ {
 67214  		var v int32
 67215  		v = hexToInt(tls, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))
 67216  		if v < 0 {
 67217  			return TCL_ERROR
 67218  		}
 67219  		*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) = ((*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)) * uint64(16)) + sqlite3_uint64(v))
 67220  	}
 67221  	if int32(*(*int8)(unsafe.Pointer(z))) != 0 {
 67222  		return TCL_ERROR
 67223  	}
 67224  	if uint32(unsafe.Sizeof(sqlite3_uint64(0))) == uint32(unsafe.Sizeof(uintptr(0))) {
 67225  		libc.Xmemcpy(tls, pp, bp /* &n */, uint32(unsafe.Sizeof(sqlite3_uint64(0))))
 67226  	} else if uint32(unsafe.Sizeof(uint32(0))) == uint32(unsafe.Sizeof(uintptr(0))) {
 67227  		*(*uint32)(unsafe.Pointer(bp + 8 /* u */)) = uint32(*(*sqlite3_uint64)(unsafe.Pointer(bp /* n */)))
 67228  		libc.Xmemcpy(tls, pp, bp+8 /* &u */, uint32(unsafe.Sizeof(uint32(0))))
 67229  	} else {
 67230  
 67231  	}
 67232  	return TCL_OK
 67233  }
 67234  
 67235  // Usage:    sqlite3_malloc  NBYTES
 67236  //
 67237  // Raw test interface for sqlite3_malloc().
 67238  func test_malloc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:298:26: */
 67239  	bp := tls.Alloc(120)
 67240  	defer tls.Free(120)
 67241  
 67242  	// var nByte int32 at bp+16, 4
 67243  
 67244  	var p uintptr
 67245  	// var zOut [100]int8 at bp+20, 100
 67246  
 67247  	if objc != 2 {
 67248  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33015 /* "NBYTES" */)
 67249  		return TCL_ERROR
 67250  	}
 67251  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &nByte */) != 0 {
 67252  		return TCL_ERROR
 67253  	}
 67254  	p = sqlite3.Xsqlite3_malloc(tls, int32(uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nByte */)))))
 67255  	pointerToText(tls, p, bp+20 /* &zOut[0] */)
 67256  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+20 /* &zOut[0] */, uintptr(0)))
 67257  	return TCL_OK
 67258  }
 67259  
 67260  // Usage:    sqlite3_realloc  PRIOR  NBYTES
 67261  //
 67262  // Raw test interface for sqlite3_realloc().
 67263  func test_realloc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:323:26: */
 67264  	bp := tls.Alloc(148)
 67265  	defer tls.Free(148)
 67266  
 67267  	// var nByte int32 at bp+40, 4
 67268  
 67269  	// var pPrior uintptr at bp+44, 4
 67270  
 67271  	var p uintptr
 67272  	// var zOut [100]int8 at bp+48, 100
 67273  
 67274  	if objc != 3 {
 67275  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33022 /* "PRIOR NBYTES" */)
 67276  		return TCL_ERROR
 67277  	}
 67278  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+40 /* &nByte */) != 0 {
 67279  		return TCL_ERROR
 67280  	}
 67281  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+44 /* &pPrior */) != 0 {
 67282  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 67283  		return TCL_ERROR
 67284  	}
 67285  	p = sqlite3.Xsqlite3_realloc(tls, *(*uintptr)(unsafe.Pointer(bp + 44 /* pPrior */)), int32(uint32(*(*int32)(unsafe.Pointer(bp + 40 /* nByte */)))))
 67286  	pointerToText(tls, p, bp+48 /* &zOut[0] */)
 67287  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, bp+48 /* &zOut[0] */, uintptr(0)))
 67288  	return TCL_OK
 67289  }
 67290  
 67291  // Usage:    sqlite3_free  PRIOR
 67292  //
 67293  // Raw test interface for sqlite3_free().
 67294  func test_free(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:352:26: */
 67295  	bp := tls.Alloc(28)
 67296  	defer tls.Free(28)
 67297  
 67298  	// var pPrior uintptr at bp+24, 4
 67299  
 67300  	if objc != 2 {
 67301  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33049 /* "PRIOR" */)
 67302  		return TCL_ERROR
 67303  	}
 67304  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+24 /* &pPrior */) != 0 {
 67305  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 67306  		return TCL_ERROR
 67307  	}
 67308  	sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer(bp + 24 /* pPrior */)))
 67309  	return TCL_OK
 67310  }
 67311  
 67312  // Usage:    memset  ADDRESS  SIZE  HEX
 67313  //
 67314  // Set a chunk of memory (obtained from malloc, probably) to a
 67315  // specified hex pattern.
 67316  func test_memset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:383:26: */
 67317  	bp := tls.Alloc(168)
 67318  	defer tls.Free(168)
 67319  
 67320  	// var p uintptr at bp+56, 4
 67321  
 67322  	// var size int32 at bp+60, 4
 67323  
 67324  	// var n int32 at bp+64, 4
 67325  
 67326  	var i int32
 67327  	var zHex uintptr
 67328  	var zOut uintptr
 67329  	// var zBin [100]int8 at bp+68, 100
 67330  
 67331  	if objc != 4 {
 67332  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33055 /* "ADDRESS SIZE HEX" */)
 67333  		return TCL_ERROR
 67334  	}
 67335  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+56 /* &p */) != 0 {
 67336  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 67337  		return TCL_ERROR
 67338  	}
 67339  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+60 /* &size */) != 0 {
 67340  		return TCL_ERROR
 67341  	}
 67342  	if *(*int32)(unsafe.Pointer(bp + 60 /* size */)) <= 0 {
 67343  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+33072 /* "size must be pos..." */, uintptr(0)))
 67344  		return TCL_ERROR
 67345  	}
 67346  	zHex = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+64 /* &n */)
 67347  	if uint32(*(*int32)(unsafe.Pointer(bp + 64 /* n */))) > (uint32(unsafe.Sizeof([100]int8{})) * uint32(2)) {
 67348  		*(*int32)(unsafe.Pointer(bp + 64 /* n */)) = (int32(uint32(unsafe.Sizeof([100]int8{})) * uint32(2)))
 67349  	}
 67350  	*(*int32)(unsafe.Pointer(bp + 64 /* n */)) = sqlite3TestHexToBin(tls, zHex, *(*int32)(unsafe.Pointer(bp + 64 /* n */)), bp+68 /* &zBin[0] */)
 67351  	if *(*int32)(unsafe.Pointer(bp + 64 /* n */)) == 0 {
 67352  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, ts+33094 /* "no data" */, uintptr(0)))
 67353  		return TCL_ERROR
 67354  	}
 67355  	zOut = *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))
 67356  	for i = 0; i < *(*int32)(unsafe.Pointer(bp + 60 /* size */)); i++ {
 67357  		*(*int8)(unsafe.Pointer(zOut + uintptr(i))) = *(*int8)(unsafe.Pointer(bp + 68 /* &zBin[0] */ + uintptr((i % *(*int32)(unsafe.Pointer(bp + 64 /* n */))))))
 67358  	}
 67359  	return TCL_OK
 67360  }
 67361  
 67362  // Usage:    memget  ADDRESS  SIZE
 67363  //
 67364  // Return memory as hexadecimal text.
 67365  func test_memget(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:429:26: */
 67366  	bp := tls.Alloc(164)
 67367  	defer tls.Free(164)
 67368  
 67369  	// var p uintptr at bp+56, 4
 67370  
 67371  	// var size int32 at bp+60, 4
 67372  
 67373  	var n int32
 67374  	var zBin uintptr
 67375  	// var zHex [100]int8 at bp+64, 100
 67376  
 67377  	if objc != 3 {
 67378  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33102 /* "ADDRESS SIZE" */)
 67379  		return TCL_ERROR
 67380  	}
 67381  	if textToPointer(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+56 /* &p */) != 0 {
 67382  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33035 /* "bad pointer: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), uintptr(0)))
 67383  		return TCL_ERROR
 67384  	}
 67385  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+60 /* &size */) != 0 {
 67386  		return TCL_ERROR
 67387  	}
 67388  	if *(*int32)(unsafe.Pointer(bp + 60 /* size */)) <= 0 {
 67389  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+33072 /* "size must be pos..." */, uintptr(0)))
 67390  		return TCL_ERROR
 67391  	}
 67392  	zBin = *(*uintptr)(unsafe.Pointer(bp + 56 /* p */))
 67393  	for *(*int32)(unsafe.Pointer(bp + 60 /* size */)) > 0 {
 67394  		if uint32(*(*int32)(unsafe.Pointer(bp + 60 /* size */))) > ((uint32(unsafe.Sizeof([100]int8{})) - uint32(1)) / uint32(2)) {
 67395  			n = (int32((uint32(unsafe.Sizeof([100]int8{})) - uint32(1)) / uint32(2)))
 67396  		} else {
 67397  			n = *(*int32)(unsafe.Pointer(bp + 60 /* size */))
 67398  		}
 67399  		libc.Xmemcpy(tls, bp+64 /* &zHex[0] */, zBin, uint32(n))
 67400  		zBin += uintptr(n)
 67401  		*(*int32)(unsafe.Pointer(bp + 60 /* size */)) -= n
 67402  		sqlite3TestBinToHex(tls, bp+64 /* &zHex[0] */, n)
 67403  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+64 /* &zHex[0] */, uintptr(0)))
 67404  	}
 67405  	return TCL_OK
 67406  }
 67407  
 67408  // Usage:    sqlite3_memory_used
 67409  //
 67410  // Raw test interface for sqlite3_memory_used().
 67411  func test_memory_used(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:476:26: */
 67412  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_memory_used(tls)))
 67413  	return TCL_OK
 67414  }
 67415  
 67416  // Usage:    sqlite3_memory_highwater ?RESETFLAG?
 67417  //
 67418  // Raw test interface for sqlite3_memory_highwater().
 67419  func test_memory_highwater(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:491:26: */
 67420  	bp := tls.Alloc(4)
 67421  	defer tls.Free(4)
 67422  
 67423  	*(*int32)(unsafe.Pointer(bp /* resetFlag */)) = 0
 67424  	if (objc != 1) && (objc != 2) {
 67425  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33115 /* "?RESET?" */)
 67426  		return TCL_ERROR
 67427  	}
 67428  	if objc == 2 {
 67429  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &resetFlag */) != 0 {
 67430  			return TCL_ERROR
 67431  		}
 67432  	}
 67433  	tcl.XTcl_SetObjResult(tls, interp,
 67434  		tcl.XTcl_NewWideIntObj(tls, sqlite3.Xsqlite3_memory_highwater(tls, *(*int32)(unsafe.Pointer(bp /* resetFlag */)))))
 67435  	return TCL_OK
 67436  }
 67437  
 67438  // Usage:    sqlite3_memdebug_backtrace DEPTH
 67439  //
 67440  // Set the depth of backtracing.  If SQLITE_MEMDEBUG is not defined
 67441  // then this routine is a no-op.
 67442  func test_memdebug_backtrace(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:516:26: */
 67443  	bp := tls.Alloc(4)
 67444  	defer tls.Free(4)
 67445  
 67446  	// var depth int32 at bp, 4
 67447  
 67448  	if objc != 2 {
 67449  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33123 /* "DEPT" */)
 67450  		return TCL_ERROR
 67451  	}
 67452  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &depth */) != 0 {
 67453  		return TCL_ERROR
 67454  	}
 67455  	return TCL_OK
 67456  }
 67457  
 67458  // Usage:    sqlite3_memdebug_dump  FILENAME
 67459  //
 67460  // Write a summary of unfreed memory to FILENAME.
 67461  func test_memdebug_dump(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:542:26: */
 67462  	if objc != 2 {
 67463  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 67464  		return TCL_ERROR
 67465  	}
 67466  	return TCL_OK
 67467  }
 67468  
 67469  // Usage:    sqlite3_memdebug_malloc_count
 67470  //
 67471  // Return the total number of times malloc() has been called.
 67472  func test_memdebug_malloc_count(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:567:26: */
 67473  	var nMalloc int32 = -1
 67474  	if objc != 1 {
 67475  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 67476  		return TCL_ERROR
 67477  	}
 67478  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nMalloc))
 67479  	return TCL_OK
 67480  }
 67481  
 67482  // Usage:    sqlite3_memdebug_fail  COUNTER  ?OPTIONS?
 67483  //
 67484  // where options are:
 67485  //
 67486  //     -repeat    <count>
 67487  //     -benigncnt <varname>
 67488  //
 67489  // Arrange for a simulated malloc() failure after COUNTER successes.
 67490  // If a repeat count is specified, the fault is repeated that many
 67491  // times.
 67492  //
 67493  // Each call to this routine overrides the prior counter value.
 67494  // This routine returns the number of simulated failures that have
 67495  // happened since the previous call to this routine.
 67496  //
 67497  // To disable simulated failures, use a COUNTER of -1.
 67498  func test_memdebug_fail(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:607:26: */
 67499  	bp := tls.Alloc(36)
 67500  	defer tls.Free(36)
 67501  
 67502  	var ii int32
 67503  	// var iFail int32 at bp+24, 4
 67504  
 67505  	*(*int32)(unsafe.Pointer(bp + 32 /* nRepeat */)) = 1
 67506  	var pBenignCnt uintptr = uintptr(0)
 67507  	var nBenign int32
 67508  	var nFail int32 = 0
 67509  
 67510  	if objc < 2 {
 67511  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33137 /* "COUNTER ?OPTIONS..." */)
 67512  		return TCL_ERROR
 67513  	}
 67514  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+24 /* &iFail */) != 0 {
 67515  		return TCL_ERROR
 67516  	}
 67517  
 67518  	for ii = 2; ii < objc; ii = ii + (2) {
 67519  		// var nOption int32 at bp+28, 4
 67520  
 67521  		var zOption uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(ii)*4)), bp+28 /* &nOption */)
 67522  		var zErr uintptr = uintptr(0)
 67523  
 67524  		if (*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)) > 1) && (libc.Xstrncmp(tls, zOption, ts+33155 /* "-repeat" */, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)))) == 0) {
 67525  			if ii == (objc - 1) {
 67526  				zErr = ts + 13108 /* "option requires ..." */
 67527  			} else {
 67528  				if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((ii+1))*4)), bp+32 /* &nRepeat */) != 0 {
 67529  					return TCL_ERROR
 67530  				}
 67531  			}
 67532  		} else if (*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)) > 1) && (libc.Xstrncmp(tls, zOption, ts+33163 /* "-benigncnt" */, uint32(*(*int32)(unsafe.Pointer(bp + 28 /* nOption */)))) == 0) {
 67533  			if ii == (objc - 1) {
 67534  				zErr = ts + 13108 /* "option requires ..." */
 67535  			} else {
 67536  				pBenignCnt = *(*uintptr)(unsafe.Pointer(objv + uintptr((ii+1))*4))
 67537  			}
 67538  		} else {
 67539  			zErr = ts + 12914 /* "unknown option: " */
 67540  		}
 67541  
 67542  		if zErr != 0 {
 67543  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, zErr, zOption, 0))
 67544  			return TCL_ERROR
 67545  		}
 67546  	}
 67547  
 67548  	nBenign = faultsimBenignFailures(tls)
 67549  	nFail = faultsimFailures(tls)
 67550  	faultsimConfig(tls, *(*int32)(unsafe.Pointer(bp + 24 /* iFail */)), *(*int32)(unsafe.Pointer(bp + 32 /* nRepeat */)))
 67551  
 67552  	if pBenignCnt != 0 {
 67553  		tcl.XTcl_ObjSetVar2(tls, interp, pBenignCnt, uintptr(0), tcl.XTcl_NewIntObj(tls, nBenign), 0)
 67554  	}
 67555  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nFail))
 67556  	return TCL_OK
 67557  }
 67558  
 67559  // Usage:    sqlite3_memdebug_pending
 67560  //
 67561  // Return the number of malloc() calls that will succeed before a
 67562  // simulated failure occurs. A negative return value indicates that
 67563  // no malloc() failure is scheduled.
 67564  func test_memdebug_pending(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:673:26: */
 67565  	var nPending int32
 67566  	if objc != 1 {
 67567  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 67568  		return TCL_ERROR
 67569  	}
 67570  	nPending = faultsimPending(tls)
 67571  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, nPending))
 67572  	return TCL_OK
 67573  }
 67574  
 67575  // The following global variable keeps track of the number of tests
 67576  // that have run.  This variable is only useful when running in the
 67577  // debugger.
 67578  var sqlite3_memdebug_title_count int32 = 0 /* test_malloc.c:694:12 */
 67579  
 67580  // Usage:    sqlite3_memdebug_settitle TITLE
 67581  //
 67582  // Set a title string stored with each allocation.  The TITLE is
 67583  // typically the name of the test that was running when the
 67584  // allocation occurred.  The TITLE is stored with the allocation
 67585  // and can be used to figure out which tests are leaking memory.
 67586  //
 67587  // Each title overwrite the previous.
 67588  func test_memdebug_settitle(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:706:26: */
 67589  	sqlite3_memdebug_title_count++
 67590  	if objc != 2 {
 67591  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33174 /* "TITLE" */)
 67592  		return TCL_ERROR
 67593  	}
 67594  	return TCL_OK
 67595  }
 67596  
 67597  var aMallocLog Tcl_HashTable   /* test_malloc.c:732:22: */
 67598  var mallocLogEnabled int32 = 0 /* test_malloc.c:733:12 */
 67599  
 67600  type MallocLog1 = struct {
 67601  	FnCall int32
 67602  	FnByte int32
 67603  } /* test_malloc.c:735:9 */
 67604  
 67605  type MallocLog = MallocLog1 /* test_malloc.c:735:26 */
 67606  
 67607  func test_memdebug_log_clear(tls *libc.TLS) { /* test_malloc.c:772:13: */
 67608  	bp := tls.Alloc(12)
 67609  	defer tls.Free(12)
 67610  
 67611  	// var search Tcl_HashSearch at bp, 12
 67612  
 67613  	var pEntry uintptr
 67614  	for pEntry = tcl.XTcl_FirstHashEntry(tls, uintptr(unsafe.Pointer(&aMallocLog)), bp /* &search */); pEntry != 0; pEntry = tcl.XTcl_NextHashEntry(tls, bp /* &search */) {
 67615  		var pLog uintptr = (*Tcl_HashEntry)(unsafe.Pointer(pEntry)).FclientData
 67616  		tcl.XTcl_Free(tls, pLog)
 67617  	}
 67618  	tcl.XTcl_DeleteHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)))
 67619  	tcl.XTcl_InitHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)), (int32(uint32(10) * (func() uint32 {
 67620  		if uint32(unsafe.Sizeof(int32(0))) >= uint32(unsafe.Sizeof(uintptr(0))) {
 67621  			return uint32(1)
 67622  		}
 67623  		return (uint32(unsafe.Sizeof(uintptr(0))) / uint32(unsafe.Sizeof(int32(0))))
 67624  	}()))))
 67625  }
 67626  
 67627  func test_memdebug_log(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:787:26: */
 67628  	bp := tls.Alloc(64)
 67629  	defer tls.Free(64)
 67630  
 67631  	// var iSub int32 at bp, 4
 67632  
 67633  	if !(isInit != 0) {
 67634  		tcl.XTcl_InitHashTable(tls, uintptr(unsafe.Pointer(&aMallocLog)), (int32(uint32(10) * (func() uint32 {
 67635  			if uint32(unsafe.Sizeof(int32(0))) >= uint32(unsafe.Sizeof(uintptr(0))) {
 67636  				return uint32(1)
 67637  			}
 67638  			return (uint32(unsafe.Sizeof(uintptr(0))) / uint32(unsafe.Sizeof(int32(0))))
 67639  		}()))))
 67640  		isInit = 1
 67641  	}
 67642  
 67643  	if objc < 2 {
 67644  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 67645  	}
 67646  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&MB_strs)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp /* &iSub */) != 0 {
 67647  		return TCL_ERROR
 67648  	}
 67649  
 67650  	switch uint32(*(*int32)(unsafe.Pointer(bp /* iSub */))) {
 67651  	case uint32(0) /* MB_LOG_START */ :
 67652  		mallocLogEnabled = 1
 67653  		break
 67654  	case uint32(1) /* MB_LOG_STOP */ :
 67655  		mallocLogEnabled = 0
 67656  		break
 67657  	case uint32(2) /* MB_LOG_DUMP */ :
 67658  		{
 67659  			// var search Tcl_HashSearch at bp+4, 12
 67660  
 67661  			var pEntry uintptr
 67662  			var pRet uintptr = tcl.XTcl_NewObj(tls)
 67663  
 67664  			for pEntry = tcl.XTcl_FirstHashEntry(tls, uintptr(unsafe.Pointer(&aMallocLog)), bp+4 /* &search */); pEntry != 0; pEntry = tcl.XTcl_NextHashEntry(tls, bp+4 /* &search */) {
 67665  				// var apElem [12]uintptr at bp+16, 48
 67666  
 67667  				var pLog uintptr = (*Tcl_HashEntry)(unsafe.Pointer(pEntry)).FclientData
 67668  				var aKey uintptr = func() uintptr {
 67669  					if ((*Tcl_HashTable)(unsafe.Pointer((uintptr(unsafe.Pointer(&aMallocLog))))).FkeyType == (1)) || ((*Tcl_HashTable)(unsafe.Pointer((uintptr(unsafe.Pointer(&aMallocLog))))).FkeyType == (-1)) {
 67670  						return *(*uintptr)(unsafe.Pointer(pEntry + 16 /* &.key */))
 67671  					}
 67672  					return pEntry + 16 /* &.key */
 67673  				}()
 67674  				var ii int32
 67675  
 67676  				*(*uintptr)(unsafe.Pointer(bp + 16 /* &apElem[0] */)) = tcl.XTcl_NewIntObj(tls, (*MallocLog)(unsafe.Pointer(pLog)).FnCall)
 67677  				*(*uintptr)(unsafe.Pointer(bp + 16 /* &apElem[0] */ + 1*4)) = tcl.XTcl_NewIntObj(tls, (*MallocLog)(unsafe.Pointer(pLog)).FnByte)
 67678  				for ii = 0; ii < MALLOC_LOG_FRAMES; ii++ {
 67679  					*(*uintptr)(unsafe.Pointer(bp + 16 /* &apElem[0] */ + uintptr((ii+2))*4)) = tcl.XTcl_NewWideIntObj(tls, *(*Tcl_WideInt)(unsafe.Pointer(aKey + uintptr(ii)*8)))
 67680  				}
 67681  
 67682  				tcl.XTcl_ListObjAppendElement(tls, interp, pRet,
 67683  					tcl.XTcl_NewListObj(tls, (MALLOC_LOG_FRAMES+2), bp+16 /* &apElem[0] */))
 67684  			}
 67685  
 67686  			tcl.XTcl_SetObjResult(tls, interp, pRet)
 67687  			break
 67688  
 67689  		}
 67690  	case uint32(3) /* MB_LOG_CLEAR */ :
 67691  		{
 67692  			test_memdebug_log_clear(tls)
 67693  			break
 67694  
 67695  		}
 67696  
 67697  	case uint32(4) /* MB_LOG_SYNC */ :
 67698  		{
 67699  			break
 67700  
 67701  		}
 67702  	}
 67703  
 67704  	return TCL_OK
 67705  }
 67706  
 67707  var isInit int32 = 0                                                                                                                                    /* test_malloc.c:793:14 */
 67708  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 */
 67709  
 67710  // Usage:    sqlite3_config_pagecache SIZE N
 67711  //
 67712  // Set the page-cache memory buffer using SQLITE_CONFIG_PAGECACHE.
 67713  // The buffer is static and is of limited size.  N might be
 67714  // adjusted downward as needed to accommodate the requested size.
 67715  // The revised value of N is returned.
 67716  //
 67717  // A negative SIZE causes the buffer pointer to be NULL.
 67718  func test_config_pagecache(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:885:26: */
 67719  	bp := tls.Alloc(56)
 67720  	defer tls.Free(56)
 67721  
 67722  	// var sz int32 at bp+48, 4
 67723  
 67724  	// var N int32 at bp+52, 4
 67725  
 67726  	var pRes uintptr
 67727  	if objc != 3 {
 67728  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33223 /* "SIZE N" */)
 67729  		return TCL_ERROR
 67730  	}
 67731  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+48 /* &sz */) != 0 {
 67732  		return TCL_ERROR
 67733  	}
 67734  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+52 /* &N */) != 0 {
 67735  		return TCL_ERROR
 67736  	}
 67737  	libc.Xfree(tls, buf1)
 67738  	buf1 = uintptr(0)
 67739  
 67740  	// Set the return value
 67741  	pRes = tcl.XTcl_NewObj(tls)
 67742  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRes, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FszPage))
 67743  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pRes, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FnPage))
 67744  	tcl.XTcl_SetObjResult(tls, interp, pRes)
 67745  
 67746  	if *(*int32)(unsafe.Pointer(bp + 48 /* sz */)) < 0 {
 67747  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PAGECACHE, libc.VaList(bp, uintptr(0), 0, 0))
 67748  	} else {
 67749  		buf1 = libc.Xmalloc(tls, (uint32(*(*int32)(unsafe.Pointer(bp + 48 /* sz */)) * *(*int32)(unsafe.Pointer(bp + 52 /* N */)))))
 67750  		sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PAGECACHE, libc.VaList(bp+24, buf1, *(*int32)(unsafe.Pointer(bp + 48 /* sz */)), *(*int32)(unsafe.Pointer(bp + 52 /* N */))))
 67751  	}
 67752  	return TCL_OK
 67753  }
 67754  
 67755  var buf1 uintptr = uintptr(0) /* test_malloc.c:893:15 */
 67756  
 67757  // Usage:    sqlite3_config_alt_pcache INSTALL_FLAG DISCARD_CHANCE PRNG_SEED
 67758  //
 67759  // Set up the alternative test page cache.  Install if INSTALL_FLAG is
 67760  // true and uninstall (reverting to the default page cache) if INSTALL_FLAG
 67761  // is false.  DISCARD_CHANGE is an integer between 0 and 100 inclusive
 67762  // which determines the chance of discarding a page when unpinned.  100
 67763  // is certainty.  0 is never.  PRNG_SEED is the pseudo-random number generator
 67764  // seed.
 67765  func test_alt_pcache(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:928:26: */
 67766  	bp := tls.Alloc(32)
 67767  	defer tls.Free(32)
 67768  
 67769  	// var installFlag int32 at bp+16, 4
 67770  
 67771  	*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) = 0
 67772  	*(*int32)(unsafe.Pointer(bp + 24 /* prngSeed */)) = 0
 67773  	*(*int32)(unsafe.Pointer(bp + 28 /* highStress */)) = 0
 67774  	if (objc < 2) || (objc > 5) {
 67775  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 67776  			ts+33230 /* "INSTALLFLAG DISC..." */)
 67777  		return TCL_ERROR
 67778  	}
 67779  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &installFlag */) != 0 {
 67780  		return TCL_ERROR
 67781  	}
 67782  	if (objc >= 3) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+20 /* &discardChance */) != 0) {
 67783  		return TCL_ERROR
 67784  	}
 67785  	if (objc >= 4) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+24 /* &prngSeed */) != 0) {
 67786  		return TCL_ERROR
 67787  	}
 67788  	if (objc >= 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+28 /* &highStress */) != 0) {
 67789  		return TCL_ERROR
 67790  	}
 67791  	if (*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) < 0) || (*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */)) > 100) {
 67792  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+33277, /* "discard-chance s..." */
 67793  			uintptr(0)))
 67794  		return TCL_ERROR
 67795  	}
 67796  	installTestPCache(tls, *(*int32)(unsafe.Pointer(bp + 16 /* installFlag */)), uint32(*(*int32)(unsafe.Pointer(bp + 20 /* discardChance */))), uint32(*(*int32)(unsafe.Pointer(bp + 24 /* prngSeed */))),
 67797  		uint32(*(*int32)(unsafe.Pointer(bp + 28 /* highStress */))))
 67798  	return TCL_OK
 67799  }
 67800  
 67801  // Usage:    sqlite3_config_memstatus BOOLEAN
 67802  //
 67803  // Enable or disable memory status reporting using SQLITE_CONFIG_MEMSTATUS.
 67804  func test_config_memstatus(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:969:26: */
 67805  	bp := tls.Alloc(12)
 67806  	defer tls.Free(12)
 67807  
 67808  	// var enable int32 at bp+8, 4
 67809  
 67810  	var rc int32
 67811  	if objc != 2 {
 67812  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 67813  		return TCL_ERROR
 67814  	}
 67815  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &enable */) != 0 {
 67816  		return TCL_ERROR
 67817  	}
 67818  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MEMSTATUS, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* enable */))))
 67819  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 67820  	return TCL_OK
 67821  }
 67822  
 67823  // Usage:    sqlite3_config_lookaside  SIZE  COUNT
 67824  //
 67825  func test_config_lookaside(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:990:26: */
 67826  	bp := tls.Alloc(24)
 67827  	defer tls.Free(24)
 67828  
 67829  	// var sz int32 at bp+16, 4
 67830  
 67831  	// var cnt int32 at bp+20, 4
 67832  
 67833  	var pRet uintptr
 67834  	if objc != 3 {
 67835  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33320 /* "SIZE COUNT" */)
 67836  		return TCL_ERROR
 67837  	}
 67838  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &sz */) != 0 {
 67839  		return TCL_ERROR
 67840  	}
 67841  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+20 /* &cnt */) != 0 {
 67842  		return TCL_ERROR
 67843  	}
 67844  	pRet = tcl.XTcl_NewObj(tls)
 67845  	tcl.XTcl_ListObjAppendElement(tls,
 67846  		interp, pRet, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FszLookaside))
 67847  	tcl.XTcl_ListObjAppendElement(tls,
 67848  		interp, pRet, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3Config.FnLookaside))
 67849  	sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_LOOKASIDE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 16 /* sz */)), *(*int32)(unsafe.Pointer(bp + 20 /* cnt */))))
 67850  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 67851  	return TCL_OK
 67852  }
 67853  
 67854  // Usage:    sqlite3_db_config_lookaside  CONNECTION  BUFID  SIZE  COUNT
 67855  //
 67856  // There are two static buffers with BUFID 1 and 2.   Each static buffer
 67857  // is 10KB in size.  A BUFID of 0 indicates that the buffer should be NULL
 67858  // which will cause sqlite3_db_config() to allocate space on its own.
 67859  func test_db_config_lookaside(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1024:26: */
 67860  	bp := tls.Alloc(80)
 67861  	defer tls.Free(80)
 67862  
 67863  	var rc int32
 67864  	// var sz int32 at bp+72, 4
 67865  
 67866  	// var cnt int32 at bp+76, 4
 67867  
 67868  	// var db uintptr at bp+64, 4
 67869  
 67870  	// var bufid int32 at bp+68, 4
 67871  
 67872  	if objc != 5 {
 67873  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33331 /* "BUFID SIZE COUNT" */)
 67874  		return TCL_ERROR
 67875  	}
 67876  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+64 /* &db */) != 0 {
 67877  		return TCL_ERROR
 67878  	}
 67879  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+68 /* &bufid */) != 0 {
 67880  		return TCL_ERROR
 67881  	}
 67882  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+72 /* &sz */) != 0 {
 67883  		return TCL_ERROR
 67884  	}
 67885  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+76 /* &cnt */) != 0 {
 67886  		return TCL_ERROR
 67887  	}
 67888  	if *(*int32)(unsafe.Pointer(bp + 68 /* bufid */)) == 0 {
 67889  		rc = sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 64 /* db */)), SQLITE_DBCONFIG_LOOKASIDE, libc.VaList(bp, uintptr(0), *(*int32)(unsafe.Pointer(bp + 72 /* sz */)), *(*int32)(unsafe.Pointer(bp + 76 /* cnt */))))
 67890  	} else if ((*(*int32)(unsafe.Pointer(bp + 68 /* bufid */)) >= 1) && (*(*int32)(unsafe.Pointer(bp + 68 /* bufid */)) <= 2)) && ((uint32(*(*int32)(unsafe.Pointer(bp + 72 /* sz */)) * *(*int32)(unsafe.Pointer(bp + 76 /* cnt */)))) <= uint32(unsafe.Sizeof([10000]int8{}))) {
 67891  		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 + 68 /* bufid */)))*10000), *(*int32)(unsafe.Pointer(bp + 72 /* sz */)), *(*int32)(unsafe.Pointer(bp + 76 /* cnt */))))
 67892  	} else {
 67893  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+33348 /* "illegal argument..." */, uintptr(0)))
 67894  		return TCL_ERROR
 67895  	}
 67896  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 67897  	return TCL_OK
 67898  }
 67899  
 67900  var azBuf [2][10000]int8 /* test_malloc.c:1034:15: */
 67901  
 67902  // Usage:    sqlite3_config_heap NBYTE NMINALLOC
 67903  func test_config_heap(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1059:26: */
 67904  	bp := tls.Alloc(56)
 67905  	defer tls.Free(56)
 67906  	// Use this memory
 67907  	// var nByte int32 at bp+48, 4
 67908  	// Size of buffer to pass to sqlite3_config()
 67909  	// var nMinAlloc int32 at bp+52, 4
 67910  	// Size of minimum allocation
 67911  	var rc int32 // Return code of sqlite3_config()
 67912  
 67913  	var aArg uintptr = (objv + 1*4)
 67914  	var nArg int32 = (objc - 1)
 67915  
 67916  	if nArg != 2 {
 67917  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33386 /* "NBYTE NMINALLOC" */)
 67918  		return TCL_ERROR
 67919  	}
 67920  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg)), bp+48 /* &nByte */) != 0 {
 67921  		return TCL_ERROR
 67922  	}
 67923  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg + 1*4)), bp+52 /* &nMinAlloc */) != 0 {
 67924  		return TCL_ERROR
 67925  	}
 67926  
 67927  	if *(*int32)(unsafe.Pointer(bp + 48 /* nByte */)) == 0 {
 67928  		libc.Xfree(tls, zBuf)
 67929  		zBuf = uintptr(0)
 67930  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_HEAP, libc.VaList(bp, uintptr(0), 0, 0))
 67931  	} else {
 67932  		zBuf = libc.Xrealloc(tls, zBuf, uint32(*(*int32)(unsafe.Pointer(bp + 48 /* nByte */))))
 67933  		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 */))))
 67934  	}
 67935  
 67936  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 67937  	return TCL_OK
 67938  }
 67939  
 67940  var zBuf uintptr /* test_malloc.c:1065:15: */
 67941  
 67942  // Usage:    sqlite3_config_heap_size NBYTE
 67943  func test_config_heap_size(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1096:26: */
 67944  	bp := tls.Alloc(12)
 67945  	defer tls.Free(12)
 67946  
 67947  	// var nByte int32 at bp+8, 4
 67948  	// Size to pass to sqlite3_config()
 67949  	var rc int32 // Return code of sqlite3_config()
 67950  
 67951  	var aArg uintptr = (objv + 1*4)
 67952  	var nArg int32 = (objc - 1)
 67953  
 67954  	if nArg != 1 {
 67955  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+16691 /* "NBYTE" */)
 67956  		return TCL_ERROR
 67957  	}
 67958  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(aArg)), bp+8 /* &nByte */) != 0 {
 67959  		return TCL_ERROR
 67960  	}
 67961  
 67962  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_WIN32_HEAPSIZE, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* nByte */))))
 67963  
 67964  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 67965  	return TCL_OK
 67966  }
 67967  
 67968  // Usage:    sqlite3_config_error  [DB]
 67969  //
 67970  // Invoke sqlite3_config() or sqlite3_db_config() with invalid
 67971  // opcodes and verify that they return errors.
 67972  func test_config_error(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1126:26: */
 67973  	bp := tls.Alloc(36)
 67974  	defer tls.Free(36)
 67975  
 67976  	// var db uintptr at bp+32, 4
 67977  
 67978  	if (objc != 2) && (objc != 1) {
 67979  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33402 /* "[DB]" */)
 67980  		return TCL_ERROR
 67981  	}
 67982  	if objc == 2 {
 67983  		if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+32 /* &db */) != 0 {
 67984  			return TCL_ERROR
 67985  		}
 67986  		if sqlite3.Xsqlite3_db_config(tls, *(*uintptr)(unsafe.Pointer(bp + 32 /* db */)), 99999, 0) != SQLITE_ERROR {
 67987  			tcl.XTcl_AppendResult(tls, interp,
 67988  				libc.VaList(bp, ts+33407, /* "sqlite3_db_confi..." */
 67989  					uintptr(0)))
 67990  			return TCL_ERROR
 67991  		}
 67992  	} else {
 67993  		if sqlite3.Xsqlite3_config(tls, 99999, 0) != SQLITE_ERROR {
 67994  			tcl.XTcl_AppendResult(tls, interp,
 67995  				libc.VaList(bp+16, ts+33465, /* "sqlite3_config(9..." */
 67996  					uintptr(0)))
 67997  			return TCL_ERROR
 67998  		}
 67999  	}
 68000  	return TCL_OK
 68001  }
 68002  
 68003  // Usage:    sqlite3_config_uri  BOOLEAN
 68004  //
 68005  // Enables or disables interpretation of URI parameters by default using
 68006  // SQLITE_CONFIG_URI.
 68007  func test_config_uri(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1164:26: */
 68008  	bp := tls.Alloc(12)
 68009  	defer tls.Free(12)
 68010  
 68011  	var rc int32
 68012  	// var bOpenUri int32 at bp+8, 4
 68013  
 68014  	if objc != 2 {
 68015  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 68016  		return TCL_ERROR
 68017  	}
 68018  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &bOpenUri */) != 0 {
 68019  		return TCL_ERROR
 68020  	}
 68021  
 68022  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_URI, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* bOpenUri */))))
 68023  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68024  
 68025  	return TCL_OK
 68026  }
 68027  
 68028  // Usage:    sqlite3_config_cis  BOOLEAN
 68029  //
 68030  // Enables or disables the use of the covering-index scan optimization.
 68031  // SQLITE_CONFIG_COVERING_INDEX_SCAN.
 68032  func test_config_cis(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1193:26: */
 68033  	bp := tls.Alloc(12)
 68034  	defer tls.Free(12)
 68035  
 68036  	var rc int32
 68037  	// var bUseCis int32 at bp+8, 4
 68038  
 68039  	if objc != 2 {
 68040  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 68041  		return TCL_ERROR
 68042  	}
 68043  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &bUseCis */) != 0 {
 68044  		return TCL_ERROR
 68045  	}
 68046  
 68047  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_COVERING_INDEX_SCAN, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* bUseCis */))))
 68048  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68049  
 68050  	return TCL_OK
 68051  }
 68052  
 68053  // Usage:    sqlite3_config_pmasz  INTEGER
 68054  //
 68055  // Set the minimum PMA size.
 68056  func test_config_pmasz(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1221:26: */
 68057  	bp := tls.Alloc(12)
 68058  	defer tls.Free(12)
 68059  
 68060  	var rc int32
 68061  	// var iPmaSz int32 at bp+8, 4
 68062  
 68063  	if objc != 2 {
 68064  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10615 /* "BOOL" */)
 68065  		return TCL_ERROR
 68066  	}
 68067  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+8 /* &iPmaSz */) != 0 {
 68068  		return TCL_ERROR
 68069  	}
 68070  
 68071  	rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PMASZ, libc.VaList(bp, *(*int32)(unsafe.Pointer(bp + 8 /* iPmaSz */))))
 68072  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68073  
 68074  	return TCL_OK
 68075  }
 68076  
 68077  // Usage:    sqlite3_dump_memsys3  FILENAME
 68078  //           sqlite3_dump_memsys5  FILENAME
 68079  //
 68080  // Write a summary of unfreed memsys3 allocations to FILENAME.
 68081  func test_dump_memsys3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1251:26: */
 68082  	if objc != 2 {
 68083  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 68084  		return TCL_ERROR
 68085  	}
 68086  
 68087  	switch int32(clientData) {
 68088  	case 3:
 68089  		{
 68090  
 68091  		}
 68092  		fallthrough
 68093  	case 5:
 68094  		{
 68095  
 68096  		}
 68097  	}
 68098  	return TCL_OK
 68099  }
 68100  
 68101  // Usage:    sqlite3_status  OPCODE  RESETFLAG
 68102  //
 68103  // Return a list of three elements which are the sqlite3_status() return
 68104  // code, the current value, and the high-water mark value.
 68105  func test_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1287:26: */
 68106  	bp := tls.Alloc(16)
 68107  	defer tls.Free(16)
 68108  
 68109  	var rc int32
 68110  	// var iValue int32 at bp+8, 4
 68111  
 68112  	// var mxValue int32 at bp+12, 4
 68113  
 68114  	var i int32
 68115  	*(*int32)(unsafe.Pointer(bp /* op */)) = 0
 68116  	// var resetFlag int32 at bp+4, 4
 68117  
 68118  	var zOpName uintptr
 68119  	var pResult uintptr
 68120  	if objc != 3 {
 68121  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33516 /* "PARAMETER RESETF..." */)
 68122  		return TCL_ERROR
 68123  	}
 68124  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 68125  	for i = 0; i < (int32(uint32(unsafe.Sizeof(aOp1)) / uint32(unsafe.Sizeof(struct {
 68126  		FzName uintptr
 68127  		Fop    int32
 68128  	}{})))); i++ {
 68129  		if libc.Xstrcmp(tls, aOp1[i].FzName, zOpName) == 0 {
 68130  			*(*int32)(unsafe.Pointer(bp /* op */)) = aOp1[i].Fop
 68131  			break
 68132  		}
 68133  	}
 68134  	if i >= (int32(uint32(unsafe.Sizeof(aOp1)) / uint32(unsafe.Sizeof(struct {
 68135  		FzName uintptr
 68136  		Fop    int32
 68137  	}{})))) {
 68138  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &op */) != 0 {
 68139  			return TCL_ERROR
 68140  		}
 68141  	}
 68142  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &resetFlag */) != 0 {
 68143  		return TCL_ERROR
 68144  	}
 68145  	*(*int32)(unsafe.Pointer(bp + 8 /* iValue */)) = 0
 68146  	*(*int32)(unsafe.Pointer(bp + 12 /* mxValue */)) = 0
 68147  	rc = sqlite3.Xsqlite3_status(tls, *(*int32)(unsafe.Pointer(bp /* op */)), bp+8 /* &iValue */, bp+12 /* &mxValue */, *(*int32)(unsafe.Pointer(bp + 4 /* resetFlag */)))
 68148  	pResult = tcl.XTcl_NewObj(tls)
 68149  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, rc))
 68150  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 8 /* iValue */))))
 68151  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* mxValue */))))
 68152  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 68153  	return TCL_OK
 68154  }
 68155  
 68156  var aOp1 = [10]struct {
 68157  	FzName uintptr
 68158  	Fop    int32
 68159  }{
 68160  	{FzName: ts + 33536 /* "SQLITE_STATUS_ME..." */},
 68161  	{FzName: ts + 33562 /* "SQLITE_STATUS_MA..." */, Fop: SQLITE_STATUS_MALLOC_SIZE},
 68162  	{FzName: ts + 33588 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_USED},
 68163  	{FzName: ts + 33617 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_OVERFLOW},
 68164  	{FzName: ts + 33650 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PAGECACHE_SIZE},
 68165  	{FzName: ts + 33679 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_USED},
 68166  	{FzName: ts + 33706 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_OVERFLOW},
 68167  	{FzName: ts + 33737 /* "SQLITE_STATUS_SC..." */, Fop: SQLITE_STATUS_SCRATCH_SIZE},
 68168  	{FzName: ts + 33764 /* "SQLITE_STATUS_PA..." */, Fop: SQLITE_STATUS_PARSER_STACK},
 68169  	{FzName: ts + 33791 /* "SQLITE_STATUS_MA..." */, Fop: SQLITE_STATUS_MALLOC_COUNT},
 68170  } /* test_malloc.c:1299:5 */
 68171  
 68172  // Usage:    sqlite3_db_status  DATABASE  OPCODE  RESETFLAG
 68173  //
 68174  // Return a list of three elements which are the sqlite3_db_status() return
 68175  // code, the current value, and the high-water mark value.
 68176  func test_db_status(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1344:26: */
 68177  	bp := tls.Alloc(20)
 68178  	defer tls.Free(20)
 68179  
 68180  	var rc int32
 68181  	// var iValue int32 at bp+12, 4
 68182  
 68183  	// var mxValue int32 at bp+16, 4
 68184  
 68185  	var i int32
 68186  	*(*int32)(unsafe.Pointer(bp + 4 /* op */)) = 0
 68187  	// var resetFlag int32 at bp+8, 4
 68188  
 68189  	var zOpName uintptr
 68190  	// var db uintptr at bp, 4
 68191  
 68192  	var pResult uintptr
 68193  	if objc != 4 {
 68194  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33818 /* "DB PARAMETER RES..." */)
 68195  		return TCL_ERROR
 68196  	}
 68197  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 68198  		return TCL_ERROR
 68199  	}
 68200  	zOpName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 68201  	if libc.Xmemcmp(tls, zOpName, ts+33841 /* "SQLITE_" */, uint32(7)) == 0 {
 68202  		zOpName += uintptr(7)
 68203  	}
 68204  	if libc.Xmemcmp(tls, zOpName, ts+33849 /* "DBSTATUS_" */, uint32(9)) == 0 {
 68205  		zOpName += uintptr(9)
 68206  	}
 68207  	for i = 0; i < (int32(uint32(unsafe.Sizeof(aOp2)) / uint32(unsafe.Sizeof(struct {
 68208  		FzName uintptr
 68209  		Fop    int32
 68210  	}{})))); i++ {
 68211  		if libc.Xstrcmp(tls, aOp2[i].FzName, zOpName) == 0 {
 68212  			*(*int32)(unsafe.Pointer(bp + 4 /* op */)) = aOp2[i].Fop
 68213  			break
 68214  		}
 68215  	}
 68216  	if i >= (int32(uint32(unsafe.Sizeof(aOp2)) / uint32(unsafe.Sizeof(struct {
 68217  		FzName uintptr
 68218  		Fop    int32
 68219  	}{})))) {
 68220  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+4 /* &op */) != 0 {
 68221  			return TCL_ERROR
 68222  		}
 68223  	}
 68224  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+8 /* &resetFlag */) != 0 {
 68225  		return TCL_ERROR
 68226  	}
 68227  	*(*int32)(unsafe.Pointer(bp + 12 /* iValue */)) = 0
 68228  	*(*int32)(unsafe.Pointer(bp + 16 /* mxValue */)) = 0
 68229  	rc = sqlite3.Xsqlite3_db_status(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), *(*int32)(unsafe.Pointer(bp + 4 /* op */)), bp+12 /* &iValue */, bp+16 /* &mxValue */, *(*int32)(unsafe.Pointer(bp + 8 /* resetFlag */)))
 68230  	pResult = tcl.XTcl_NewObj(tls)
 68231  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, rc))
 68232  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 12 /* iValue */))))
 68233  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pResult, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer(bp + 16 /* mxValue */))))
 68234  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 68235  	return TCL_OK
 68236  }
 68237  
 68238  var aOp2 = [13]struct {
 68239  	FzName uintptr
 68240  	Fop    int32
 68241  }{
 68242  	{FzName: ts + 33859 /* "LOOKASIDE_USED" */},
 68243  	{FzName: ts + 33874 /* "CACHE_USED" */, Fop: SQLITE_DBSTATUS_CACHE_USED},
 68244  	{FzName: ts + 33885 /* "SCHEMA_USED" */, Fop: SQLITE_DBSTATUS_SCHEMA_USED},
 68245  	{FzName: ts + 33897 /* "STMT_USED" */, Fop: SQLITE_DBSTATUS_STMT_USED},
 68246  	{FzName: ts + 33907 /* "LOOKASIDE_HIT" */, Fop: SQLITE_DBSTATUS_LOOKASIDE_HIT},
 68247  	{FzName: ts + 33921 /* "LOOKASIDE_MISS_S..." */, Fop: SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE},
 68248  	{FzName: ts + 33941 /* "LOOKASIDE_MISS_F..." */, Fop: SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL},
 68249  	{FzName: ts + 33961 /* "CACHE_HIT" */, Fop: SQLITE_DBSTATUS_CACHE_HIT},
 68250  	{FzName: ts + 33971 /* "CACHE_MISS" */, Fop: SQLITE_DBSTATUS_CACHE_MISS},
 68251  	{FzName: ts + 33982 /* "CACHE_WRITE" */, Fop: SQLITE_DBSTATUS_CACHE_WRITE},
 68252  	{FzName: ts + 33994 /* "DEFERRED_FKS" */, Fop: SQLITE_DBSTATUS_DEFERRED_FKS},
 68253  	{FzName: ts + 34007 /* "CACHE_USED_SHARE..." */, Fop: SQLITE_DBSTATUS_CACHE_USED_SHARED},
 68254  	{FzName: ts + 34025 /* "CACHE_SPILL" */, Fop: SQLITE_DBSTATUS_CACHE_SPILL},
 68255  } /* test_malloc.c:1358:5 */
 68256  
 68257  // install_malloc_faultsim BOOLEAN
 68258  func test_install_malloc_faultsim(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1406:26: */
 68259  	bp := tls.Alloc(4)
 68260  	defer tls.Free(4)
 68261  
 68262  	var rc int32
 68263  	// var isInstall int32 at bp, 4
 68264  
 68265  	if objc != 2 {
 68266  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 68267  		return TCL_ERROR
 68268  	}
 68269  	if TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &isInstall */) {
 68270  		return TCL_ERROR
 68271  	}
 68272  	rc = faultsimInstall(tls, *(*int32)(unsafe.Pointer(bp /* isInstall */)))
 68273  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68274  	return TCL_OK
 68275  }
 68276  
 68277  // sqlite3_install_memsys3
 68278  func test_install_memsys3(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1430:26: */
 68279  	var rc int32 = SQLITE_MISUSE
 68280  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 68281  	return TCL_OK
 68282  }
 68283  
 68284  func test_vfs_oom_test(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_malloc.c:1445:26: */
 68285  	bp := tls.Alloc(4)
 68286  	defer tls.Free(4)
 68287  
 68288  	if objc > 2 {
 68289  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34037 /* "?INTEGER?" */)
 68290  		return TCL_ERROR
 68291  	} else if objc == 2 {
 68292  		// var iNew int32 at bp, 4
 68293  
 68294  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &iNew */) != 0 {
 68295  			return TCL_ERROR
 68296  		}
 68297  		sqlite3.Xsqlite3_memdebug_vfs_oom_test = *(*int32)(unsafe.Pointer(bp /* iNew */))
 68298  	}
 68299  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, sqlite3.Xsqlite3_memdebug_vfs_oom_test))
 68300  	return TCL_OK
 68301  }
 68302  
 68303  // Register commands with the TCL interpreter.
 68304  func Sqlitetest_malloc_Init(tls *libc.TLS, interp uintptr) int32 { /* test_malloc.c:1467:5: */
 68305  	var i int32
 68306  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd11)) / uint32(unsafe.Sizeof(struct {
 68307  		FzName      uintptr
 68308  		FxProc      uintptr
 68309  		FclientData int32
 68310  	}{}))); i++ {
 68311  		var c ClientData = uintptr(aObjCmd11[i].FclientData)
 68312  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd11[i].FzName, aObjCmd11[i].FxProc, c, uintptr(0))
 68313  	}
 68314  	return TCL_OK
 68315  }
 68316  
 68317  var aObjCmd11 = [32]struct {
 68318  	FzName      uintptr
 68319  	FxProc      uintptr
 68320  	FclientData int32
 68321  }{
 68322  	{FzName: ts + 28381 /* "sqlite3_malloc" */, FxProc: 0},
 68323  	{FzName: ts + 28396 /* "sqlite3_realloc" */, FxProc: 0},
 68324  	{FzName: ts + 34047 /* "sqlite3_free" */, FxProc: 0},
 68325  	{FzName: ts + 34060 /* "memset" */, FxProc: 0},
 68326  	{FzName: ts + 34067 /* "memget" */, FxProc: 0},
 68327  	{FzName: ts + 34074 /* "sqlite3_memory_u..." */, FxProc: 0},
 68328  	{FzName: ts + 34094 /* "sqlite3_memory_h..." */, FxProc: 0},
 68329  	{FzName: ts + 34119 /* "sqlite3_memdebug..." */, FxProc: 0},
 68330  	{FzName: ts + 34146 /* "sqlite3_memdebug..." */, FxProc: 0},
 68331  	{FzName: ts + 34168 /* "sqlite3_memdebug..." */, FxProc: 0},
 68332  	{FzName: ts + 34190 /* "sqlite3_memdebug..." */, FxProc: 0},
 68333  	{FzName: ts + 34215 /* "sqlite3_memdebug..." */, FxProc: 0},
 68334  	{FzName: ts + 34241 /* "sqlite3_memdebug..." */, FxProc: 0},
 68335  	{FzName: ts + 34271 /* "sqlite3_memdebug..." */, FxProc: 0},
 68336  	{FzName: ts + 34292 /* "sqlite3_config_p..." */, FxProc: 0},
 68337  	{FzName: ts + 34317 /* "sqlite3_config_a..." */, FxProc: 0},
 68338  	{FzName: ts + 34343 /* "sqlite3_status" */, FxProc: 0},
 68339  	{FzName: ts + 34358 /* "sqlite3_db_statu..." */, FxProc: 0},
 68340  	{FzName: ts + 34376 /* "install_malloc_f..." */, FxProc: 0},
 68341  	{FzName: ts + 34400 /* "sqlite3_config_h..." */, FxProc: 0},
 68342  	{FzName: ts + 34420 /* "sqlite3_config_h..." */, FxProc: 0},
 68343  	{FzName: ts + 34445 /* "sqlite3_config_m..." */, FxProc: 0},
 68344  	{FzName: ts + 34470 /* "sqlite3_config_l..." */, FxProc: 0},
 68345  	{FzName: ts + 34495 /* "sqlite3_config_e..." */, FxProc: 0},
 68346  	{FzName: ts + 34516 /* "sqlite3_config_u..." */, FxProc: 0},
 68347  	{FzName: ts + 34535 /* "sqlite3_config_c..." */, FxProc: 0},
 68348  	{FzName: ts + 34554 /* "sqlite3_config_p..." */, FxProc: 0},
 68349  	{FzName: ts + 34575 /* "sqlite3_db_confi..." */, FxProc: 0},
 68350  	{FzName: ts + 34603 /* "sqlite3_dump_mem..." */, FxProc: 0, FclientData: 3},
 68351  	{FzName: ts + 34624 /* "sqlite3_dump_mem..." */, FxProc: 0, FclientData: 5},
 68352  	{FzName: ts + 34645 /* "sqlite3_install_..." */, FxProc: 0},
 68353  	{FzName: ts + 34669 /* "sqlite3_memdebug..." */, FxProc: 0},
 68354  } /* test_malloc.c:1472:5 */
 68355  
 68356  // Some versions of <linux/posix_types.h> define this macros.
 68357  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 68358  
 68359  // fd_set for select and pselect.
 68360  type fd_set4 = struct{ F__fds_bits [32]int32 } /* select.h:70:5 */
 68361  
 68362  // end block for C++
 68363  
 68364  // Local Variables:
 68365  // mode: c
 68366  // c-basic-offset: 4
 68367  // fill-column: 78
 68368  // End:
 68369  
 68370  // This code implements the MD5 message-digest algorithm.
 68371  // The algorithm is due to Ron Rivest.  This code was
 68372  // written by Colin Plumb in 1993, no copyright is claimed.
 68373  // This code is in the public domain; do with it what you wish.
 68374  //
 68375  // Equivalent code is available from RSA Data Security, Inc.
 68376  // This code has been tested against that, and is equivalent,
 68377  // except that you don't need to include two pages of legalese
 68378  // with every copy.
 68379  //
 68380  // To compute the message digest of a chunk of bytes, declare an
 68381  // MD5Context structure, pass it to MD5Init, call MD5Update as
 68382  // needed on buffers full of bytes, and then call MD5Final, which
 68383  // will fill a supplied 16-byte array with the digest.
 68384  
 68385  // If compiled on a machine that doesn't have a 32-bit integer,
 68386  // you just set "uint32" to the appropriate datatype for an
 68387  // unsigned 32-bit integer.  For example:
 68388  //
 68389  //       cc -Duint32='unsigned long' md5.c
 68390  //
 68391  
 68392  type MD5Context1 = struct {
 68393  	FisInit int32
 68394  	Fbuf    [4]uint32
 68395  	Fbits   [2]uint32
 68396  	Fin     [64]uint8
 68397  } /* test_md5.c:57:1 */
 68398  
 68399  type MD5Context = MD5Context1 /* test_md5.c:63:27 */
 68400  
 68401  // Note: this code is harmless on little-endian machines.
 68402  func byteReverse(tls *libc.TLS, buf uintptr, longs uint32) { /* test_md5.c:68:13: */
 68403  	var t uint32
 68404  	for ok := true; ok; ok = libc.PreDecUint32(&longs, 1) != 0 {
 68405  		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)))))
 68406  		*(*uint32)(unsafe.Pointer(buf)) = t
 68407  		buf += uintptr(4)
 68408  	}
 68409  }
 68410  
 68411  // The four core functions - F1 is optimized somewhat
 68412  
 68413  // #define F1(x, y, z) (x & y | ~x & z)
 68414  
 68415  // This is the central step in the MD5 algorithm.
 68416  
 68417  // The core of the MD5 algorithm, this alters an existing MD5 hash to
 68418  // reflect the addition of 16 longwords of new data.  MD5Update blocks
 68419  // the data and converts bytes into longwords for this routine.
 68420  func MD5Transform(tls *libc.TLS, buf uintptr, in uintptr) { /* test_md5.c:94:13: */
 68421  	var a uint32
 68422  	var b uint32
 68423  	var c uint32
 68424  	var d uint32
 68425  
 68426  	a = *(*uint32)(unsafe.Pointer(buf))
 68427  	b = *(*uint32)(unsafe.Pointer(buf + 1*4))
 68428  	c = *(*uint32)(unsafe.Pointer(buf + 2*4))
 68429  	d = *(*uint32)(unsafe.Pointer(buf + 3*4))
 68430  
 68431  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in))) + 0xd76aa478)
 68432  	a = ((a << 7) | (a >> (32 - 7)))
 68433  	a = a + (b)
 68434  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xe8c7b756)
 68435  	d = ((d << 12) | (d >> (32 - 12)))
 68436  	d = d + (a)
 68437  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 2*4))) + uint32(0x242070db))
 68438  	c = ((c << 17) | (c >> (32 - 17)))
 68439  	c = c + (d)
 68440  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xc1bdceee)
 68441  	b = ((b << 22) | (b >> (32 - 22)))
 68442  	b = b + (c)
 68443  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xf57c0faf)
 68444  	a = ((a << 7) | (a >> (32 - 7)))
 68445  	a = a + (b)
 68446  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 5*4))) + uint32(0x4787c62a))
 68447  	d = ((d << 12) | (d >> (32 - 12)))
 68448  	d = d + (a)
 68449  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xa8304613)
 68450  	c = ((c << 17) | (c >> (32 - 17)))
 68451  	c = c + (d)
 68452  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 7*4))) + 0xfd469501)
 68453  	b = ((b << 22) | (b >> (32 - 22)))
 68454  	b = b + (c)
 68455  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x698098d8))
 68456  	a = ((a << 7) | (a >> (32 - 7)))
 68457  	a = a + (b)
 68458  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0x8b44f7af)
 68459  	d = ((d << 12) | (d >> (32 - 12)))
 68460  	d = d + (a)
 68461  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xffff5bb1)
 68462  	c = ((c << 17) | (c >> (32 - 17)))
 68463  	c = c + (d)
 68464  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 11*4))) + 0x895cd7be)
 68465  	b = ((b << 22) | (b >> (32 - 22)))
 68466  	b = b + (c)
 68467  	a = a + (((d ^ (b & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 12*4))) + uint32(0x6b901122))
 68468  	a = ((a << 7) | (a >> (32 - 7)))
 68469  	a = a + (b)
 68470  	d = d + (((c ^ (a & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 13*4))) + 0xfd987193)
 68471  	d = ((d << 12) | (d >> (32 - 12)))
 68472  	d = d + (a)
 68473  	c = c + (((b ^ (d & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xa679438e)
 68474  	c = ((c << 17) | (c >> (32 - 17)))
 68475  	c = c + (d)
 68476  	b = b + (((a ^ (c & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 15*4))) + uint32(0x49b40821))
 68477  	b = ((b << 22) | (b >> (32 - 22)))
 68478  	b = b + (c)
 68479  
 68480  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xf61e2562)
 68481  	a = ((a << 5) | (a >> (32 - 5)))
 68482  	a = a + (b)
 68483  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xc040b340)
 68484  	d = ((d << 9) | (d >> (32 - 9)))
 68485  	d = d + (a)
 68486  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 11*4))) + uint32(0x265e5a51))
 68487  	c = ((c << 14) | (c >> (32 - 14)))
 68488  	c = c + (d)
 68489  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in))) + 0xe9b6c7aa)
 68490  	b = ((b << 20) | (b >> (32 - 20)))
 68491  	b = b + (c)
 68492  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xd62f105d)
 68493  	a = ((a << 5) | (a >> (32 - 5)))
 68494  	a = a + (b)
 68495  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 10*4))) + uint32(0x02441453))
 68496  	d = ((d << 9) | (d >> (32 - 9)))
 68497  	d = d + (a)
 68498  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 15*4))) + 0xd8a1e681)
 68499  	c = ((c << 14) | (c >> (32 - 14)))
 68500  	c = c + (d)
 68501  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xe7d3fbc8)
 68502  	b = ((b << 20) | (b >> (32 - 20)))
 68503  	b = b + (c)
 68504  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 9*4))) + uint32(0x21e1cde6))
 68505  	a = ((a << 5) | (a >> (32 - 5)))
 68506  	a = a + (b)
 68507  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xc33707d6)
 68508  	d = ((d << 9) | (d >> (32 - 9)))
 68509  	d = d + (a)
 68510  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xf4d50d87)
 68511  	c = ((c << 14) | (c >> (32 - 14)))
 68512  	c = c + (d)
 68513  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x455a14ed))
 68514  	b = ((b << 20) | (b >> (32 - 20)))
 68515  	b = b + (c)
 68516  	a = a + (((c ^ (d & (b ^ c))) + *(*uint32)(unsafe.Pointer(in + 13*4))) + 0xa9e3e905)
 68517  	a = ((a << 5) | (a >> (32 - 5)))
 68518  	a = a + (b)
 68519  	d = d + (((b ^ (c & (a ^ b))) + *(*uint32)(unsafe.Pointer(in + 2*4))) + 0xfcefa3f8)
 68520  	d = ((d << 9) | (d >> (32 - 9)))
 68521  	d = d + (a)
 68522  	c = c + (((a ^ (b & (d ^ a))) + *(*uint32)(unsafe.Pointer(in + 7*4))) + uint32(0x676f02d9))
 68523  	c = ((c << 14) | (c >> (32 - 14)))
 68524  	c = c + (d)
 68525  	b = b + (((d ^ (a & (c ^ d))) + *(*uint32)(unsafe.Pointer(in + 12*4))) + 0x8d2a4c8a)
 68526  	b = ((b << 20) | (b >> (32 - 20)))
 68527  	b = b + (c)
 68528  
 68529  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xfffa3942)
 68530  	a = ((a << 4) | (a >> (32 - 4)))
 68531  	a = a + (b)
 68532  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 8*4))) + 0x8771f681)
 68533  	d = ((d << 11) | (d >> (32 - 11)))
 68534  	d = d + (a)
 68535  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 11*4))) + uint32(0x6d9d6122))
 68536  	c = ((c << 16) | (c >> (32 - 16)))
 68537  	c = c + (d)
 68538  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xfde5380c)
 68539  	b = ((b << 23) | (b >> (32 - 23)))
 68540  	b = b + (c)
 68541  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0xa4beea44)
 68542  	a = ((a << 4) | (a >> (32 - 4)))
 68543  	a = a + (b)
 68544  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 4*4))) + uint32(0x4bdecfa9))
 68545  	d = ((d << 11) | (d >> (32 - 11)))
 68546  	d = d + (a)
 68547  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 7*4))) + 0xf6bb4b60)
 68548  	c = ((c << 16) | (c >> (32 - 16)))
 68549  	c = c + (d)
 68550  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xbebfbc70)
 68551  	b = ((b << 23) | (b >> (32 - 23)))
 68552  	b = b + (c)
 68553  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 13*4))) + uint32(0x289b7ec6))
 68554  	a = ((a << 4) | (a >> (32 - 4)))
 68555  	a = a + (b)
 68556  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in))) + 0xeaa127fa)
 68557  	d = ((d << 11) | (d >> (32 - 11)))
 68558  	d = d + (a)
 68559  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0xd4ef3085)
 68560  	c = ((c << 16) | (c >> (32 - 16)))
 68561  	c = c + (d)
 68562  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 6*4))) + uint32(0x04881d05))
 68563  	b = ((b << 23) | (b >> (32 - 23)))
 68564  	b = b + (c)
 68565  	a = a + ((((b ^ c) ^ d) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0xd9d4d039)
 68566  	a = ((a << 4) | (a >> (32 - 4)))
 68567  	a = a + (b)
 68568  	d = d + ((((a ^ b) ^ c) + *(*uint32)(unsafe.Pointer(in + 12*4))) + 0xe6db99e5)
 68569  	d = ((d << 11) | (d >> (32 - 11)))
 68570  	d = d + (a)
 68571  	c = c + ((((d ^ a) ^ b) + *(*uint32)(unsafe.Pointer(in + 15*4))) + uint32(0x1fa27cf8))
 68572  	c = ((c << 16) | (c >> (32 - 16)))
 68573  	c = c + (d)
 68574  	b = b + ((((c ^ d) ^ a) + *(*uint32)(unsafe.Pointer(in + 2*4))) + 0xc4ac5665)
 68575  	b = ((b << 23) | (b >> (32 - 23)))
 68576  	b = b + (c)
 68577  
 68578  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in))) + 0xf4292244)
 68579  	a = ((a << 6) | (a >> (32 - 6)))
 68580  	a = a + (b)
 68581  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 7*4))) + uint32(0x432aff97))
 68582  	d = ((d << 10) | (d >> (32 - 10)))
 68583  	d = d + (a)
 68584  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 14*4))) + 0xab9423a7)
 68585  	c = ((c << 15) | (c >> (32 - 15)))
 68586  	c = c + (d)
 68587  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 5*4))) + 0xfc93a039)
 68588  	b = ((b << 21) | (b >> (32 - 21)))
 68589  	b = b + (c)
 68590  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 12*4))) + uint32(0x655b59c3))
 68591  	a = ((a << 6) | (a >> (32 - 6)))
 68592  	a = a + (b)
 68593  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 3*4))) + 0x8f0ccc92)
 68594  	d = ((d << 10) | (d >> (32 - 10)))
 68595  	d = d + (a)
 68596  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 10*4))) + 0xffeff47d)
 68597  	c = ((c << 15) | (c >> (32 - 15)))
 68598  	c = c + (d)
 68599  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 1*4))) + 0x85845dd1)
 68600  	b = ((b << 21) | (b >> (32 - 21)))
 68601  	b = b + (c)
 68602  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 8*4))) + uint32(0x6fa87e4f))
 68603  	a = ((a << 6) | (a >> (32 - 6)))
 68604  	a = a + (b)
 68605  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 15*4))) + 0xfe2ce6e0)
 68606  	d = ((d << 10) | (d >> (32 - 10)))
 68607  	d = d + (a)
 68608  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 6*4))) + 0xa3014314)
 68609  	c = ((c << 15) | (c >> (32 - 15)))
 68610  	c = c + (d)
 68611  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 13*4))) + uint32(0x4e0811a1))
 68612  	b = ((b << 21) | (b >> (32 - 21)))
 68613  	b = b + (c)
 68614  	a = a + (((c ^ (b | ^d)) + *(*uint32)(unsafe.Pointer(in + 4*4))) + 0xf7537e82)
 68615  	a = ((a << 6) | (a >> (32 - 6)))
 68616  	a = a + (b)
 68617  	d = d + (((b ^ (a | ^c)) + *(*uint32)(unsafe.Pointer(in + 11*4))) + 0xbd3af235)
 68618  	d = ((d << 10) | (d >> (32 - 10)))
 68619  	d = d + (a)
 68620  	c = c + (((a ^ (d | ^b)) + *(*uint32)(unsafe.Pointer(in + 2*4))) + uint32(0x2ad7d2bb))
 68621  	c = ((c << 15) | (c >> (32 - 15)))
 68622  	c = c + (d)
 68623  	b = b + (((d ^ (c | ^a)) + *(*uint32)(unsafe.Pointer(in + 9*4))) + 0xeb86d391)
 68624  	b = ((b << 21) | (b >> (32 - 21)))
 68625  	b = b + (c)
 68626  
 68627  	*(*uint32)(unsafe.Pointer(buf)) += (a)
 68628  	*(*uint32)(unsafe.Pointer(buf + 1*4)) += (b)
 68629  	*(*uint32)(unsafe.Pointer(buf + 2*4)) += (c)
 68630  	*(*uint32)(unsafe.Pointer(buf + 3*4)) += (d)
 68631  }
 68632  
 68633  // Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
 68634  // initialization constants.
 68635  func MD5Init(tls *libc.TLS, ctx uintptr) { /* test_md5.c:180:13: */
 68636  	(*MD5Context)(unsafe.Pointer(ctx)).FisInit = 1
 68637  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */))) = uint32(0x67452301)
 68638  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 1*4)) = 0xefcdab89
 68639  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 2*4)) = 0x98badcfe
 68640  	*(*uint32)(unsafe.Pointer((ctx + 4 /* &.buf */) + 3*4)) = uint32(0x10325476)
 68641  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */))) = uint32(0)
 68642  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4)) = uint32(0)
 68643  }
 68644  
 68645  // Update context to reflect the concatenation of another buffer full
 68646  // of bytes.
 68647  func MD5Update(tls *libc.TLS, ctx uintptr, buf uintptr, len uint32) { /* test_md5.c:195:6: */
 68648  	var t uint32
 68649  
 68650  	// Update bitcount
 68651  
 68652  	t = *(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */)))
 68653  	if (libc.AssignPtrUint32((ctx + 20 /* &.bits */), (t + (len << 3)))) < t {
 68654  		*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4))++
 68655  	} // Carry from low to high
 68656  	*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */) + 1*4)) += (len >> 29)
 68657  
 68658  	t = ((t >> 3) & uint32(0x3f)) // Bytes already in shsInfo->data
 68659  
 68660  	// Handle any leading odd-sized chunks
 68661  
 68662  	if t != 0 {
 68663  		var p uintptr = (ctx + 28 /* &.in */ + uintptr(t))
 68664  
 68665  		t = (uint32(64) - t)
 68666  		if len < t {
 68667  			libc.Xmemcpy(tls, p, buf, len)
 68668  			return
 68669  		}
 68670  		libc.Xmemcpy(tls, p, buf, t)
 68671  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 68672  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 68673  		buf += uintptr(t)
 68674  		len = len - (t)
 68675  	}
 68676  
 68677  	// Process data in 64-byte chunks
 68678  
 68679  	for len >= uint32(64) {
 68680  		libc.Xmemcpy(tls, ctx+28 /* &.in */, buf, uint32(64))
 68681  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 68682  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 68683  		buf += uintptr(64)
 68684  		len = len - (uint32(64))
 68685  	}
 68686  
 68687  	// Handle any remaining bytes of data.
 68688  
 68689  	libc.Xmemcpy(tls, ctx+28 /* &.in */, buf, len)
 68690  }
 68691  
 68692  // Final wrapup - pad to 64-byte boundary with the bit pattern
 68693  // 1 0* (64-bit count of bits processed, MSB-first)
 68694  func MD5Final(tls *libc.TLS, digest uintptr, ctx uintptr) { /* test_md5.c:243:13: */
 68695  	var count uint32
 68696  	var p uintptr
 68697  
 68698  	// Compute number of bytes mod 64
 68699  	count = ((*(*uint32)(unsafe.Pointer((ctx + 20 /* &.bits */))) >> 3) & uint32(0x3F))
 68700  
 68701  	// Set the first char of padding to 0x80.  This is safe since there is
 68702  	//            always at least one byte free
 68703  	p = ((ctx + 28 /* &.in */) + uintptr(count))
 68704  	*(*uint8)(unsafe.Pointer(libc.PostIncUintptr(&p, 1))) = uint8(0x80)
 68705  
 68706  	// Bytes of padding needed to make 64 bytes
 68707  	count = ((uint32(64 - 1)) - count)
 68708  
 68709  	// Pad out to 56 mod 64
 68710  	if count < uint32(8) {
 68711  		// Two lots of padding:  Pad the first block to 64 bytes
 68712  		libc.Xmemset(tls, p, 0, count)
 68713  		byteReverse(tls, ctx+28 /* &.in */, uint32(16))
 68714  		MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 68715  
 68716  		// Now fill the next block with 56 bytes
 68717  		libc.Xmemset(tls, ctx+28 /* &.in */, 0, uint32(56))
 68718  	} else {
 68719  		// Pad block to 56 bytes
 68720  		libc.Xmemset(tls, p, 0, (count - uint32(8)))
 68721  	}
 68722  	byteReverse(tls, ctx+28 /* &.in */, uint32(14))
 68723  
 68724  	// Append length in bits and transform
 68725  	libc.Xmemcpy(tls, ((ctx + 28 /* &.in */) + uintptr((14 * 4))), ctx+20 /* &.bits */, uint32(8))
 68726  
 68727  	MD5Transform(tls, ctx+4 /* &.buf */, ctx+28 /* &.in */)
 68728  	byteReverse(tls, ctx+4 /* &.buf */, uint32(4))
 68729  	libc.Xmemcpy(tls, digest, ctx+4 /* &.buf */, uint32(16))
 68730  }
 68731  
 68732  // Convert a 128-bit MD5 digest into a 32-digit base-16 number.
 68733  func MD5DigestToBase16(tls *libc.TLS, digest uintptr, zBuf uintptr) { /* test_md5.c:284:13: */
 68734  	var i int32
 68735  	var j int32
 68736  
 68737  	for j = libc.AssignInt32(&i, 0); i < 16; i++ {
 68738  		var a int32 = int32(*(*uint8)(unsafe.Pointer(digest + uintptr(i))))
 68739  		*(*int8)(unsafe.Pointer(zBuf + uintptr(libc.PostIncInt32(&j, 1)))) = zEncode[((a >> 4) & 0xf)]
 68740  		*(*int8)(unsafe.Pointer(zBuf + uintptr(libc.PostIncInt32(&j, 1)))) = zEncode[(a & 0xf)]
 68741  	}
 68742  	*(*int8)(unsafe.Pointer(zBuf + uintptr(j))) = int8(0)
 68743  }
 68744  
 68745  var zEncode = *(*[17]int8)(unsafe.Pointer(ts + 31389 /* "0123456789abcdef" */)) /* test_md5.c:285:21 */
 68746  
 68747  // Convert a 128-bit MD5 digest into sequency of eight 5-digit integers
 68748  // each representing 16 bits of the digest and separated from each
 68749  // other by a "-" character.
 68750  func MD5DigestToBase10x8(tls *libc.TLS, digest uintptr, zDigest uintptr) { /* test_md5.c:302:13: */
 68751  	bp := tls.Alloc(8)
 68752  	defer tls.Free(8)
 68753  
 68754  	var i int32
 68755  	var j int32
 68756  	var x uint32
 68757  	for i = libc.AssignInt32(&j, 0); i < 16; i = i + (2) {
 68758  		x = (uint32((int32(*(*uint8)(unsafe.Pointer(digest + uintptr(i)))) * 256) + int32(*(*uint8)(unsafe.Pointer(digest + uintptr((i + 1)))))))
 68759  		if i > 0 {
 68760  			*(*int8)(unsafe.Pointer(zDigest + uintptr(libc.PostIncInt32(&j, 1)))) = int8('-')
 68761  		}
 68762  		sqlite3.Xsqlite3_snprintf(tls, (50 - j), (zDigest + uintptr(j)), ts+34699 /* "%05u" */, libc.VaList(bp, x))
 68763  		j = j + (5)
 68764  	}
 68765  	*(*int8)(unsafe.Pointer(zDigest + uintptr(j))) = int8(0)
 68766  }
 68767  
 68768  // A TCL command for md5.  The argument is the text to be hashed.  The
 68769  // Result is the hash in base64.
 68770  func md5_cmd(tls *libc.TLS, cd uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test_md5.c:318:26: */
 68771  	bp := tls.Alloc(206)
 68772  	defer tls.Free(206)
 68773  
 68774  	// var ctx MD5Context at bp+48, 92
 68775  
 68776  	// var digest [16]uint8 at bp+140, 16
 68777  
 68778  	// var zBuf [50]int8 at bp+156, 50
 68779  
 68780  	var converter uintptr
 68781  
 68782  	if argc != 2 {
 68783  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 68784  			ts+15773 /* " TEXT\"" */, uintptr(0)))
 68785  		return TCL_ERROR
 68786  	}
 68787  	MD5Init(tls, bp+48 /* &ctx */)
 68788  	MD5Update(tls, bp+48 /* &ctx */, *(*uintptr)(unsafe.Pointer(argv + 1*4)), libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))))
 68789  	MD5Final(tls, bp+140 /* &digest[0] */, bp+48 /* &ctx */)
 68790  	converter = cd
 68791  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&converter)))(tls, bp+140 /* &digest[0] */, bp+156 /* &zBuf[0] */)
 68792  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, bp+156 /* &zBuf[0] */, uintptr(0)))
 68793  	return TCL_OK
 68794  }
 68795  
 68796  // A TCL command to take the md5 hash of a file.  The argument is the
 68797  // name of the file.
 68798  func md5file_cmd(tls *libc.TLS, cd uintptr, interp uintptr, argc int32, argv uintptr) int32 { /* test_md5.c:347:26: */
 68799  	bp := tls.Alloc(10428)
 68800  	defer tls.Free(10428)
 68801  
 68802  	var in uintptr
 68803  	var ofst int32
 68804  	var amt int32
 68805  	// var ctx MD5Context at bp+80, 92
 68806  
 68807  	var converter uintptr
 68808  	// var digest [16]uint8 at bp+10412, 16
 68809  
 68810  	// var zBuf [10240]int8 at bp+172, 10240
 68811  
 68812  	if (argc != 2) && (argc != 4) {
 68813  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410 /* "wrong # args: sh..." */, *(*uintptr)(unsafe.Pointer(argv)),
 68814  			ts+34704 /* " FILENAME [OFFSE..." */, uintptr(0)))
 68815  		return TCL_ERROR
 68816  	}
 68817  	if argc == 4 {
 68818  		ofst = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 2*4)))
 68819  		amt = libc.Xatoi(tls, *(*uintptr)(unsafe.Pointer(argv + 3*4)))
 68820  	} else {
 68821  		ofst = 0
 68822  		amt = 2147483647
 68823  	}
 68824  	in = libc.Xfopen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+4263 /* "rb" */)
 68825  	if in == uintptr(0) {
 68826  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+34728 /* "unable to open f..." */, *(*uintptr)(unsafe.Pointer(argv + 1*4)),
 68827  			ts+34750 /* "\" for reading" */, uintptr(0)))
 68828  		return TCL_ERROR
 68829  	}
 68830  	libc.Xfseek(tls, in, int32(ofst), SEEK_SET)
 68831  	MD5Init(tls, bp+80 /* &ctx */)
 68832  	for amt > 0 {
 68833  		var n int32
 68834  		n = int32(libc.Xfread(tls, bp+172 /* &zBuf[0] */, uint32(1), func() uint32 {
 68835  			if uint32(unsafe.Sizeof([10240]int8{})) <= uint32(amt) {
 68836  				return uint32(unsafe.Sizeof([10240]int8{}))
 68837  			}
 68838  			return uint32(amt)
 68839  		}(), in))
 68840  		if n <= 0 {
 68841  			break
 68842  		}
 68843  		MD5Update(tls, bp+80 /* &ctx */, bp+172 /* zBuf */, uint32(n))
 68844  		amt = amt - (n)
 68845  	}
 68846  	libc.Xfclose(tls, in)
 68847  	MD5Final(tls, bp+10412 /* &digest[0] */, bp+80 /* &ctx */)
 68848  	converter = cd
 68849  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(&converter)))(tls, bp+10412 /* &digest[0] */, bp+172 /* &zBuf[0] */)
 68850  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+172 /* &zBuf[0] */, uintptr(0)))
 68851  	return TCL_OK
 68852  }
 68853  
 68854  // Register the four new TCL commands for generating MD5 checksums
 68855  // with the TCL interpreter.
 68856  func Md5_Init(tls *libc.TLS, interp uintptr) int32 { /* test_md5.c:400:5: */
 68857  	tcl.XTcl_CreateCommand(tls, interp, ts+34764 /* "md5" */, *(*uintptr)(unsafe.Pointer(&struct {
 68858  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 68859  	}{md5_cmd})),
 68860  		*(*uintptr)(unsafe.Pointer(&struct {
 68861  			f func(*libc.TLS, uintptr, uintptr)
 68862  		}{MD5DigestToBase16})), uintptr(0))
 68863  	tcl.XTcl_CreateCommand(tls, interp, ts+34768 /* "md5-10x8" */, *(*uintptr)(unsafe.Pointer(&struct {
 68864  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 68865  	}{md5_cmd})),
 68866  		*(*uintptr)(unsafe.Pointer(&struct {
 68867  			f func(*libc.TLS, uintptr, uintptr)
 68868  		}{MD5DigestToBase10x8})), uintptr(0))
 68869  	tcl.XTcl_CreateCommand(tls, interp, ts+34777 /* "md5file" */, *(*uintptr)(unsafe.Pointer(&struct {
 68870  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 68871  	}{md5file_cmd})),
 68872  		*(*uintptr)(unsafe.Pointer(&struct {
 68873  			f func(*libc.TLS, uintptr, uintptr)
 68874  		}{MD5DigestToBase16})), uintptr(0))
 68875  	tcl.XTcl_CreateCommand(tls, interp, ts+34785 /* "md5file-10x8" */, *(*uintptr)(unsafe.Pointer(&struct {
 68876  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 68877  	}{md5file_cmd})),
 68878  		*(*uintptr)(unsafe.Pointer(&struct {
 68879  			f func(*libc.TLS, uintptr, uintptr)
 68880  		}{MD5DigestToBase10x8})), uintptr(0))
 68881  	return TCL_OK
 68882  }
 68883  
 68884  // During testing, the special md5sum() aggregate function is available.
 68885  // inside SQLite.  The following routines implement that function.
 68886  func md5step(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_md5.c:416:13: */
 68887  	var p uintptr
 68888  	var i int32
 68889  	if argc < 1 {
 68890  		return
 68891  	}
 68892  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(MD5Context{})))
 68893  	if p == uintptr(0) {
 68894  		return
 68895  	}
 68896  	if !((*MD5Context)(unsafe.Pointer(p)).FisInit != 0) {
 68897  		MD5Init(tls, p)
 68898  	}
 68899  	for i = 0; i < argc; i++ {
 68900  		var zData uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 68901  		if zData != 0 {
 68902  			MD5Update(tls, p, zData, uint32(int32(libc.Xstrlen(tls, zData))))
 68903  		}
 68904  	}
 68905  }
 68906  
 68907  func md5finalize(tls *libc.TLS, context uintptr) { /* test_md5.c:432:13: */
 68908  	bp := tls.Alloc(49)
 68909  	defer tls.Free(49)
 68910  
 68911  	var p uintptr
 68912  	// var digest [16]uint8 at bp, 16
 68913  
 68914  	// var zBuf [33]int8 at bp+16, 33
 68915  
 68916  	p = sqlite3.Xsqlite3_aggregate_context(tls, context, int32(unsafe.Sizeof(MD5Context{})))
 68917  	MD5Final(tls, bp /* &digest[0] */, p)
 68918  	MD5DigestToBase16(tls, bp /* &digest[0] */, bp+16 /* &zBuf[0] */)
 68919  	sqlite3.Xsqlite3_result_text(tls, context, bp+16 /* &zBuf[0] */, -1, libc.UintptrFromInt32(-1))
 68920  }
 68921  
 68922  func Md5_Register(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pThunk uintptr) int32 { /* test_md5.c:441:5: */
 68923  	var rc int32 = sqlite3.Xsqlite3_create_function(tls, db, ts+34798 /* "md5sum" */, -1, SQLITE_UTF8, uintptr(0), uintptr(0),
 68924  		*(*uintptr)(unsafe.Pointer(&struct {
 68925  			f func(*libc.TLS, uintptr, int32, uintptr)
 68926  		}{md5step})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{md5finalize})))
 68927  	sqlite3.Xsqlite3_overload_function(tls, db, ts+34798 /* "md5sum" */, -1) // To exercise this API
 68928  	return rc
 68929  }
 68930  
 68931  // The following macros redefine the API routines so that they are
 68932  // redirected through the global sqlite3_api structure.
 68933  //
 68934  // This header file is also used by the loadext.c source file
 68935  // (part of the main SQLite library - not an extension) so that
 68936  // it can get access to the sqlite3_api_routines structure
 68937  // definition.  But the main library does not want to redefine
 68938  // the API.  So the redefinition macros are only valid if the
 68939  // SQLITE_CORE macros is undefined.
 68940  
 68941  // This case when the file is being statically linked into the
 68942  // application
 68943  
 68944  // These should be defined to be the same as the values in
 68945  // sqliteInt.h.  They are defined separately here so that
 68946  // the multiplex VFS shim can be built as a loadable
 68947  // module.
 68948  
 68949  // Maximum chunk number
 68950  
 68951  // First chunk for rollback journal files
 68952  
 68953  //*********************** Shim Definitions *****************************
 68954  
 68955  // This is the limit on the chunk size.  It may be changed by calling
 68956  // the xFileControl() interface.  It will be rounded up to a
 68957  // multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
 68958  
 68959  // This used to be the default limit on number of chunks, but
 68960  // it is no longer enforced. There is currently no limit to the
 68961  // number of chunks.
 68962  //
 68963  // May be changed by calling the xFileControl() interface.
 68964  
 68965  //*********************** Object Definitions *****************************
 68966  
 68967  // Forward declaration of all object types
 68968  type multiplexGroup1 = struct {
 68969  	FaReal     uintptr
 68970  	FnReal     int32
 68971  	FzName     uintptr
 68972  	FnName     int32
 68973  	Fflags     int32
 68974  	FszChunk   uint32
 68975  	FbEnabled  uint8
 68976  	FbTruncate uint8
 68977  	_          [2]byte
 68978  } /* test_multiplex.c:106:9 */
 68979  
 68980  // The following macros redefine the API routines so that they are
 68981  // redirected through the global sqlite3_api structure.
 68982  //
 68983  // This header file is also used by the loadext.c source file
 68984  // (part of the main SQLite library - not an extension) so that
 68985  // it can get access to the sqlite3_api_routines structure
 68986  // definition.  But the main library does not want to redefine
 68987  // the API.  So the redefinition macros are only valid if the
 68988  // SQLITE_CORE macros is undefined.
 68989  
 68990  // This case when the file is being statically linked into the
 68991  // application
 68992  
 68993  // These should be defined to be the same as the values in
 68994  // sqliteInt.h.  They are defined separately here so that
 68995  // the multiplex VFS shim can be built as a loadable
 68996  // module.
 68997  
 68998  // Maximum chunk number
 68999  
 69000  // First chunk for rollback journal files
 69001  
 69002  //*********************** Shim Definitions *****************************
 69003  
 69004  // This is the limit on the chunk size.  It may be changed by calling
 69005  // the xFileControl() interface.  It will be rounded up to a
 69006  // multiple of MAX_PAGE_SIZE.  We default it here to 2GiB less 64KiB.
 69007  
 69008  // This used to be the default limit on number of chunks, but
 69009  // it is no longer enforced. There is currently no limit to the
 69010  // number of chunks.
 69011  //
 69012  // May be changed by calling the xFileControl() interface.
 69013  
 69014  //*********************** Object Definitions *****************************
 69015  
 69016  // Forward declaration of all object types
 69017  type multiplexGroup = multiplexGroup1 /* test_multiplex.c:106:31 */
 69018  type multiplexConn1 = struct {
 69019  	Fbase   sqlite3_file
 69020  	FpGroup uintptr
 69021  } /* test_multiplex.c:107:9 */
 69022  
 69023  type multiplexConn = multiplexConn1 /* test_multiplex.c:107:30 */
 69024  
 69025  // A "multiplex group" is a collection of files that collectively
 69026  // makeup a single SQLite DB file.  This allows the size of the DB
 69027  // to exceed the limits imposed by the file system.
 69028  //
 69029  // There is an instance of the following object for each defined multiplex
 69030  // group.
 69031  type multiplexReal = struct {
 69032  	Fp uintptr
 69033  	Fz uintptr
 69034  } /* test_multiplex.c:106:9 */
 69035  
 69036  //************************ Global Variables *********************************
 69037  // All global variables used by this file are containing within the following
 69038  // gMultiplex structure.
 69039  var gMultiplex struct {
 69040  	FpOrigVfs      uintptr
 69041  	FsThisVfs      sqlite3_vfs
 69042  	FsIoMethodsV1  sqlite3_io_methods
 69043  	FsIoMethodsV2  sqlite3_io_methods
 69044  	FisInitialized int32
 69045  } /* test_multiplex.c:176:3: */
 69046  
 69047  //************************ Utility Routines ********************************
 69048  // Compute a string length that is limited to what can be stored in
 69049  // lower 30 bits of a 32-bit signed integer.
 69050  //
 69051  // The value returned will never be negative.  Nor will it ever be greater
 69052  // than the actual length of the string.  For very long strings (greater
 69053  // than 1GiB) the value returned might be less than the true string length.
 69054  func multiplexStrlen30(tls *libc.TLS, z uintptr) int32 { /* test_multiplex.c:187:12: */
 69055  	var z2 uintptr = z
 69056  	if z == uintptr(0) {
 69057  		return 0
 69058  	}
 69059  	for *(*int8)(unsafe.Pointer(z2)) != 0 {
 69060  		z2++
 69061  	}
 69062  	return (0x3fffffff & ((int32(z2) - int32(z)) / 1))
 69063  }
 69064  
 69065  // Generate the file-name for chunk iChunk of the group with base name
 69066  // zBase. The file-name is written to buffer zOut before returning. Buffer
 69067  // zOut must be allocated by the caller so that it is at least (nBase+5)
 69068  // bytes in size, where nBase is the length of zBase, not including the
 69069  // nul-terminator.
 69070  //
 69071  // If iChunk is 0 (or 400 - the number for the first journal file chunk),
 69072  // the output is a copy of the input string. Otherwise, if
 69073  // SQLITE_ENABLE_8_3_NAMES is not defined or the input buffer does not contain
 69074  // a "." character, then the output is a copy of the input string with the
 69075  // three-digit zero-padded decimal representation if iChunk appended to it.
 69076  // For example:
 69077  //
 69078  //   zBase="test.db", iChunk=4  ->  zOut="test.db004"
 69079  //
 69080  // Or, if SQLITE_ENABLE_8_3_NAMES is defined and the input buffer contains
 69081  // a "." character, then everything after the "." is replaced by the
 69082  // three-digit representation of iChunk.
 69083  //
 69084  //   zBase="test.db", iChunk=4  ->  zOut="test.004"
 69085  //
 69086  // The output buffer string is terminated by 2 0x00 bytes. This makes it safe
 69087  // to pass to sqlite3_uri_parameter() and similar.
 69088  func multiplexFilename(tls *libc.TLS, zBase uintptr, nBase int32, flags int32, iChunk int32, zOut uintptr) { /* test_multiplex.c:219:13: */
 69089  	bp := tls.Alloc(8)
 69090  	defer tls.Free(8)
 69091  
 69092  	var n int32 = nBase
 69093  	libc.Xmemcpy(tls, zOut, zBase, (uint32(n + 1)))
 69094  	if (iChunk != 0) && (iChunk <= MX_CHUNK_NUMBER) {
 69095  		sqlite3.Xsqlite3_snprintf(tls, 4, (zOut + uintptr(n)), ts+34805 /* "%03d" */, libc.VaList(bp, iChunk))
 69096  		n = n + (3)
 69097  	}
 69098  
 69099  	*(*int8)(unsafe.Pointer(zOut + uintptr((n + 1)))) = int8(0)
 69100  }
 69101  
 69102  // Compute the filename for the iChunk-th chunk
 69103  func multiplexSubFilename(tls *libc.TLS, pGroup uintptr, iChunk int32) int32 { /* test_multiplex.c:256:12: */
 69104  	if iChunk >= (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal {
 69105  		var p uintptr
 69106  		p = sqlite3.Xsqlite3_realloc64(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal, (uint64((uint32(iChunk + 1)) * uint32(unsafe.Sizeof(multiplexReal{})))))
 69107  		if p == uintptr(0) {
 69108  			return SQLITE_NOMEM
 69109  		}
 69110  		libc.Xmemset(tls, (p + uintptr((*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal)*8), 0, (uint32(unsafe.Sizeof(multiplexReal{})) * (uint32((iChunk + 1) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal))))
 69111  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal = p
 69112  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal = (iChunk + 1)
 69113  	}
 69114  	if ((*multiplexGroup)(unsafe.Pointer(pGroup)).FzName != 0) && ((*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz == uintptr(0)) {
 69115  		var z uintptr
 69116  		var n int32 = (*multiplexGroup)(unsafe.Pointer(pGroup)).FnName
 69117  		z = sqlite3.Xsqlite3_malloc64(tls, (uint64(n + 5)))
 69118  		if z == uintptr(0) {
 69119  			return SQLITE_NOMEM
 69120  		}
 69121  		multiplexFilename(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FzName, (*multiplexGroup)(unsafe.Pointer(pGroup)).FnName, (*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags, iChunk, z)
 69122  		(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*8)).Fz = sqlite3.Xsqlite3_create_filename(tls, z, ts+489 /* "" */, ts+489 /* "" */, 0, uintptr(0))
 69123  		sqlite3.Xsqlite3_free(tls, z)
 69124  		if (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz == uintptr(0) {
 69125  			return SQLITE_NOMEM
 69126  		}
 69127  	}
 69128  	return SQLITE_OK
 69129  }
 69130  
 69131  // Translate an sqlite3_file* that is really a multiplexGroup* into
 69132  // the sqlite3_file* for the underlying original VFS.
 69133  //
 69134  // For chunk 0, the pGroup->flags determines whether or not a new file
 69135  // is created if it does not already exist.  For chunks 1 and higher, the
 69136  // file is created only if createFlag is 1.
 69137  func multiplexSubOpen(tls *libc.TLS, pGroup uintptr, iChunk int32, rc uintptr, pOutFlags uintptr, createFlag int32) uintptr { /* test_multiplex.c:289:21: */
 69138  	bp := tls.Alloc(20)
 69139  	defer tls.Free(20)
 69140  
 69141  	var pSubOpen uintptr = uintptr(0)
 69142  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 69143  
 69144  	*(*int32)(unsafe.Pointer(rc)) = multiplexSubFilename(tls, pGroup, iChunk)
 69145  	if ((*(*int32)(unsafe.Pointer(rc))) == SQLITE_OK) && ((libc.AssignUintptr(&pSubOpen, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fp)) == uintptr(0)) {
 69146  		var flags int32
 69147  		// var bExists int32 at bp+16, 4
 69148  
 69149  		flags = (*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags
 69150  		if createFlag != 0 {
 69151  			flags = flags | (SQLITE_OPEN_CREATE)
 69152  		} else if iChunk == 0 {
 69153  			// Fall through
 69154  		} else if (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz == uintptr(0) {
 69155  			return uintptr(0)
 69156  		} else {
 69157  			*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 32 /* &.xAccess */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz,
 69158  				SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 69159  			if (*(*int32)(unsafe.Pointer(rc)) != 0) || !(*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0) {
 69160  				if *(*int32)(unsafe.Pointer(rc)) != 0 {
 69161  					sqlite3.Xsqlite3_log(tls, *(*int32)(unsafe.Pointer(rc)), ts+34810, /* "multiplexor.xAcc..." */
 69162  						libc.VaList(bp, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz))
 69163  				}
 69164  				return uintptr(0)
 69165  			}
 69166  			flags = flags & (libc.CplInt32(SQLITE_OPEN_CREATE))
 69167  		}
 69168  		pSubOpen = sqlite3.Xsqlite3_malloc64(tls, uint64((*sqlite3_vfs)(unsafe.Pointer(pOrigVfs)).FszOsFile))
 69169  		if pSubOpen == uintptr(0) {
 69170  			*(*int32)(unsafe.Pointer(rc)) = (SQLITE_IOERR | (int32(12) << 8))
 69171  			return uintptr(0)
 69172  		}
 69173  		(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*8)).Fp = pSubOpen
 69174  		*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 24 /* &.xOpen */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz, pSubOpen,
 69175  			flags, pOutFlags)
 69176  		if (*(*int32)(unsafe.Pointer(rc))) != SQLITE_OK {
 69177  			sqlite3.Xsqlite3_log(tls, *(*int32)(unsafe.Pointer(rc)), ts+34844, /* "multiplexor.xOpe..." */
 69178  				libc.VaList(bp+8, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz))
 69179  			sqlite3.Xsqlite3_free(tls, pSubOpen)
 69180  			(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*8)).Fp = uintptr(0)
 69181  			return uintptr(0)
 69182  		}
 69183  	}
 69184  	return pSubOpen
 69185  }
 69186  
 69187  // Return the size, in bytes, of chunk number iChunk.  If that chunk
 69188  // does not exist, then return 0.  This function does not distingish between
 69189  // non-existant files and zero-length files.
 69190  func multiplexSubSize(tls *libc.TLS, pGroup uintptr, iChunk int32, rc uintptr) sqlite3_int64 { /* test_multiplex.c:357:22: */
 69191  	bp := tls.Alloc(8)
 69192  	defer tls.Free(8)
 69193  
 69194  	var pSub uintptr
 69195  	*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)) = int64(0)
 69196  
 69197  	if *(*int32)(unsafe.Pointer(rc)) != 0 {
 69198  		return int64(0)
 69199  	}
 69200  	pSub = multiplexSubOpen(tls, pGroup, iChunk, rc, uintptr(0), 0)
 69201  	if pSub == uintptr(0) {
 69202  		return int64(0)
 69203  	}
 69204  	*(*int32)(unsafe.Pointer(rc)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSub)).FpMethods + 24 /* &.xFileSize */))))(tls, pSub, bp /* &sz */)
 69205  	return *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 69206  }
 69207  
 69208  // This is the implementation of the multiplex_control() SQL function.
 69209  func multiplexControlFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { /* test_multiplex.c:375:13: */
 69210  	bp := tls.Alloc(4)
 69211  	defer tls.Free(4)
 69212  
 69213  	var rc int32 = SQLITE_OK
 69214  	var db uintptr = sqlite3.Xsqlite3_context_db_handle(tls, context)
 69215  	var op int32 = 0
 69216  	// var iVal int32 at bp, 4
 69217  
 69218  	if !(db != 0) || (argc != 2) {
 69219  		rc = SQLITE_ERROR
 69220  	} else {
 69221  		// extract params
 69222  		op = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv)))
 69223  		*(*int32)(unsafe.Pointer(bp /* iVal */)) = sqlite3.Xsqlite3_value_int(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 69224  		// map function op to file_control op
 69225  		switch op {
 69226  		case 1:
 69227  			op = MULTIPLEX_CTRL_ENABLE
 69228  			break
 69229  			fallthrough
 69230  		case 2:
 69231  			op = MULTIPLEX_CTRL_SET_CHUNK_SIZE
 69232  			break
 69233  			fallthrough
 69234  		case 3:
 69235  			op = MULTIPLEX_CTRL_SET_MAX_CHUNKS
 69236  			break
 69237  			fallthrough
 69238  		default:
 69239  			rc = SQLITE_NOTFOUND
 69240  			break
 69241  		}
 69242  	}
 69243  	if rc == SQLITE_OK {
 69244  		rc = sqlite3.Xsqlite3_file_control(tls, db, uintptr(0), op, bp /* &iVal */)
 69245  	}
 69246  	sqlite3.Xsqlite3_result_error_code(tls, context, rc)
 69247  }
 69248  
 69249  // This is the entry point to register the auto-extension for the
 69250  // multiplex_control() function.
 69251  func multiplexFuncInit(tls *libc.TLS, db uintptr, pzErrMsg uintptr, pApi uintptr) int32 { /* test_multiplex.c:417:12: */
 69252  	var rc int32
 69253  	rc = sqlite3.Xsqlite3_create_function(tls, db, ts+34876 /* "multiplex_contro..." */, 2, SQLITE_ANY,
 69254  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 69255  			f func(*libc.TLS, uintptr, int32, uintptr)
 69256  		}{multiplexControlFunc})), uintptr(0), uintptr(0))
 69257  	return rc
 69258  }
 69259  
 69260  // Close a single sub-file in the connection group.
 69261  func multiplexSubClose(tls *libc.TLS, pGroup uintptr, iChunk int32, pOrigVfs uintptr) { /* test_multiplex.c:431:13: */
 69262  	var pSubOpen uintptr = (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*8)).Fp
 69263  	if pSubOpen != 0 {
 69264  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 4 /* &.xClose */))))(tls, pSubOpen)
 69265  		if (pOrigVfs != 0) && ((*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz != 0) {
 69266  			(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz, 0)
 69267  		}
 69268  		sqlite3.Xsqlite3_free(tls, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fp)
 69269  	}
 69270  	sqlite3.Xsqlite3_free_filename(tls, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz)
 69271  	libc.Xmemset(tls, ((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(iChunk)*8), 0, uint32(unsafe.Sizeof(multiplexReal{})))
 69272  }
 69273  
 69274  // Deallocate memory held by a multiplexGroup
 69275  func multiplexFreeComponents(tls *libc.TLS, pGroup uintptr) { /* test_multiplex.c:451:13: */
 69276  	var i int32
 69277  	for i = 0; i < (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal; i++ {
 69278  		multiplexSubClose(tls, pGroup, i, uintptr(0))
 69279  	}
 69280  	sqlite3.Xsqlite3_free(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal)
 69281  	(*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal = uintptr(0)
 69282  	(*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal = 0
 69283  }
 69284  
 69285  //************************ VFS Method Wrappers ****************************
 69286  
 69287  // This is the xOpen method used for the "multiplex" VFS.
 69288  //
 69289  // Most of the work is done by the underlying original VFS.  This method
 69290  // simply links the new file into the appropriate multiplex group if it is a
 69291  // file that needs to be tracked.
 69292  func multiplexOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pConn uintptr, flags int32, pOutFlags uintptr) int32 { /* test_multiplex.c:469:12: */
 69293  	bp := tls.Alloc(20)
 69294  	defer tls.Free(20)
 69295  
 69296  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Result code
 69297  	var pMultiplexOpen uintptr                         // The new multiplex file descriptor
 69298  	var pGroup uintptr = uintptr(0)                    // Corresponding multiplexGroup object
 69299  	var pSubOpen uintptr = uintptr(0)                  // Real file descriptor
 69300  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs        // Real VFS
 69301  	var nName int32 = 0
 69302  	var sz int32 = 0
 69303  	var zToFree uintptr = uintptr(0)
 69304  
 69305  	_ = pVfs
 69306  	libc.Xmemset(tls, pConn, 0, uint32((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile))
 69307  
 69308  	// We need to create a group structure and manage
 69309  	// access to this group of files.
 69310  	pMultiplexOpen = pConn
 69311  
 69312  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69313  		// allocate space for group
 69314  		if zName != 0 {
 69315  			nName = multiplexStrlen30(tls, zName)
 69316  		} else {
 69317  			nName = 0
 69318  		}
 69319  		sz = (int32((uint32(unsafe.Sizeof(multiplexGroup{})) + // multiplexGroup
 69320  			uint32(nName)) + uint32(1))) // zName
 69321  		pGroup = sqlite3.Xsqlite3_malloc64(tls, uint64(sz))
 69322  		if pGroup == uintptr(0) {
 69323  			*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_NOMEM
 69324  		}
 69325  	}
 69326  
 69327  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69328  		var zUri uintptr
 69329  		if (flags & SQLITE_OPEN_URI) != 0 {
 69330  			zUri = zName
 69331  		} else {
 69332  			zUri = uintptr(0)
 69333  		}
 69334  		// assign pointers to extra space allocated
 69335  		libc.Xmemset(tls, pGroup, 0, uint32(sz))
 69336  		(*multiplexConn)(unsafe.Pointer(pMultiplexOpen)).FpGroup = pGroup
 69337  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = libc.Uint8(libc.Uint8FromInt32(-1))
 69338  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(sqlite3.Xsqlite3_uri_boolean(tls, zUri, ts+18743, /* "truncate" */
 69339  			(libc.Bool32((flags & SQLITE_OPEN_MAIN_DB) == 0))))
 69340  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = uint32(int32(sqlite3.Xsqlite3_uri_int64(tls, zUri, ts+34894, /* "chunksize" */
 69341  			int64(SQLITE_MULTIPLEX_CHUNK_SIZE))))
 69342  		(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = (((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk + uint32(0xffff)) & libc.Uint32FromInt32(libc.CplInt32(0xffff)))
 69343  		if zName != 0 {
 69344  			var p uintptr = (pGroup + 1*28)
 69345  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FzName = p
 69346  			libc.Xmemcpy(tls, (*multiplexGroup)(unsafe.Pointer(pGroup)).FzName, zName, (uint32(nName + 1)))
 69347  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FnName = nName
 69348  		}
 69349  		if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled != 0 {
 69350  			for (uint32(sqlite3.Xsqlite3PendingByte) % (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk) >= ((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk - uint32(65536)) {
 69351  				*(*uint32)(unsafe.Pointer(pGroup + 20 /* &.szChunk */)) += (uint32(65536))
 69352  			}
 69353  		}
 69354  		(*multiplexGroup)(unsafe.Pointer(pGroup)).Fflags = (flags & libc.CplInt32(SQLITE_OPEN_URI))
 69355  		*(*int32)(unsafe.Pointer(bp /* rc */)) = multiplexSubFilename(tls, pGroup, 1)
 69356  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69357  			pSubOpen = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, pOutFlags, 0)
 69358  			if (pSubOpen == uintptr(0)) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) {
 69359  				*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_CANTOPEN
 69360  			}
 69361  		}
 69362  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69363  			// var sz64 sqlite3_int64 at bp+8, 8
 69364  
 69365  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xFileSize */))))(tls, pSubOpen, bp+8 /* &sz64 */)
 69366  			if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (zName != 0) {
 69367  				// var bExists int32 at bp+16, 4
 69368  
 69369  				if (flags & SQLITE_OPEN_SUPER_JOURNAL) != 0 {
 69370  					(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(0)
 69371  				} else if *(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) == int64(0) {
 69372  					if (flags & SQLITE_OPEN_MAIN_JOURNAL) != 0 {
 69373  						// If opening a main journal file and the first chunk is zero
 69374  						// bytes in size, delete any subsequent chunks from the
 69375  						// file-system.
 69376  						var iChunk int32 = 1
 69377  						for ok := true; ok; ok = ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0)) {
 69378  							*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 32 /* &.xAccess */))))(tls, pOrigVfs,
 69379  								(*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz, SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 69380  							if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) != 0) {
 69381  								*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+uintptr(iChunk)*8)).Fz, 0)
 69382  								if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69383  									*(*int32)(unsafe.Pointer(bp /* rc */)) = multiplexSubFilename(tls, pGroup, libc.PreIncInt32(&iChunk, 1))
 69384  								}
 69385  							}
 69386  						}
 69387  					}
 69388  				} else {
 69389  					// If the first overflow file exists and if the size of the main file
 69390  					// is different from the chunk size, that means the chunk size is set
 69391  					// set incorrectly.  So fix it.
 69392  					//
 69393  					// Or, if the first overflow file does not exist and the main file is
 69394  					// larger than the chunk size, that means the chunk size is too small.
 69395  					// But we have no way of determining the intended chunk size, so
 69396  					// just disable the multiplexor all togethre.
 69397  					*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 32 /* &.xAccess */))))(tls, pOrigVfs, (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal+1*8)).Fz,
 69398  						SQLITE_ACCESS_EXISTS, bp+16 /* &bExists */)
 69399  					*(*int32)(unsafe.Pointer(bp + 16 /* bExists */)) = (libc.Bool32(multiplexSubSize(tls, pGroup, 1, bp /* &rc */) > int64(0)))
 69400  					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))) &&
 69401  						(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */)) != sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)) {
 69402  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = uint32(int32(*(*sqlite3_int64)(unsafe.Pointer(bp + 8 /* sz64 */))))
 69403  					} 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)) {
 69404  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(0)
 69405  					}
 69406  				}
 69407  			}
 69408  		}
 69409  
 69410  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69411  			if (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FiVersion == 1 {
 69412  				(*sqlite3_file)(unsafe.Pointer(pConn)).FpMethods = (uintptr(unsafe.Pointer(&gMultiplex)) + 92 /* &.sIoMethodsV1 */)
 69413  			} else {
 69414  				(*sqlite3_file)(unsafe.Pointer(pConn)).FpMethods = (uintptr(unsafe.Pointer(&gMultiplex)) + 168 /* &.sIoMethodsV2 */)
 69415  			}
 69416  		} else {
 69417  			multiplexFreeComponents(tls, pGroup)
 69418  			sqlite3.Xsqlite3_free(tls, pGroup)
 69419  		}
 69420  	}
 69421  	sqlite3.Xsqlite3_free(tls, zToFree)
 69422  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 69423  }
 69424  
 69425  // This is the xDelete method used for the "multiplex" VFS.
 69426  // It attempts to delete the filename specified.
 69427  func multiplexDelete(tls *libc.TLS, pVfs uintptr, zName uintptr, syncDir int32) int32 { /* test_multiplex.c:611:12: */
 69428  	bp := tls.Alloc(4)
 69429  	defer tls.Free(4)
 69430  
 69431  	var rc int32
 69432  	var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 69433  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, zName, syncDir)
 69434  	if rc == SQLITE_OK {
 69435  		// If the main chunk was deleted successfully, also delete any subsequent
 69436  		// chunks - starting with the last (highest numbered).
 69437  		var nName int32 = int32(libc.Xstrlen(tls, zName))
 69438  		var z uintptr
 69439  		z = sqlite3.Xsqlite3_malloc64(tls, (uint64(nName + 5)))
 69440  		if z == uintptr(0) {
 69441  			rc = (SQLITE_IOERR | (int32(12) << 8))
 69442  		} else {
 69443  			var iChunk int32 = 0
 69444  			// var bExists int32 at bp, 4
 69445  
 69446  			for ok := true; ok; ok = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bExists */)) != 0)) {
 69447  				multiplexFilename(tls, zName, nName, SQLITE_OPEN_MAIN_JOURNAL, libc.PreIncInt32(&iChunk, 1), z)
 69448  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 32 /* &.xAccess */))))(tls, pOrigVfs, z, SQLITE_ACCESS_EXISTS, bp /* &bExists */)
 69449  			}
 69450  			for (rc == SQLITE_OK) && (iChunk > 1) {
 69451  				multiplexFilename(tls, zName, nName, SQLITE_OPEN_MAIN_JOURNAL, libc.PreDecInt32(&iChunk, 1), z)
 69452  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, z, syncDir)
 69453  			}
 69454  			if rc == SQLITE_OK {
 69455  				iChunk = 0
 69456  				for ok1 := true; ok1; ok1 = ((rc == SQLITE_OK) && (*(*int32)(unsafe.Pointer(bp /* bExists */)) != 0)) {
 69457  					multiplexFilename(tls, zName, nName, SQLITE_OPEN_WAL, libc.PreIncInt32(&iChunk, 1), z)
 69458  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 32 /* &.xAccess */))))(tls, pOrigVfs, z, SQLITE_ACCESS_EXISTS, bp /* &bExists */)
 69459  				}
 69460  				for (rc == SQLITE_OK) && (iChunk > 1) {
 69461  					multiplexFilename(tls, zName, nName, SQLITE_OPEN_WAL, libc.PreDecInt32(&iChunk, 1), z)
 69462  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, z, syncDir)
 69463  				}
 69464  			}
 69465  		}
 69466  		sqlite3.Xsqlite3_free(tls, z)
 69467  	}
 69468  	return rc
 69469  }
 69470  
 69471  func multiplexAccess(tls *libc.TLS, a uintptr, b uintptr, c int32, d uintptr) int32 { /* test_multiplex.c:656:12: */
 69472  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 32 /* &.xAccess */))))(tls, gMultiplex.FpOrigVfs, b, c, d)
 69473  }
 69474  
 69475  func multiplexFullPathname(tls *libc.TLS, a uintptr, b uintptr, c int32, d uintptr) int32 { /* test_multiplex.c:659:12: */
 69476  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 36 /* &.xFullPathname */))))(tls, gMultiplex.FpOrigVfs, b, c, d)
 69477  }
 69478  
 69479  func multiplexDlOpen(tls *libc.TLS, a uintptr, b uintptr) uintptr { /* test_multiplex.c:662:13: */
 69480  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((gMultiplex.FpOrigVfs + 40 /* &.xDlOpen */))))(tls, gMultiplex.FpOrigVfs, b)
 69481  }
 69482  
 69483  func multiplexDlError(tls *libc.TLS, a uintptr, b int32, c uintptr) { /* test_multiplex.c:665:13: */
 69484  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((gMultiplex.FpOrigVfs + 44 /* &.xDlError */))))(tls, gMultiplex.FpOrigVfs, b, c)
 69485  }
 69486  
 69487  func multiplexDlSym(tls *libc.TLS, a uintptr, b uintptr, c uintptr) uintptr { /* test_multiplex.c:668:13: */
 69488  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((gMultiplex.FpOrigVfs + 48 /* &.xDlSym */))))(tls, gMultiplex.FpOrigVfs, b, c)
 69489  }
 69490  
 69491  func multiplexDlClose(tls *libc.TLS, a uintptr, b uintptr) { /* test_multiplex.c:671:13: */
 69492  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((gMultiplex.FpOrigVfs + 52 /* &.xDlClose */))))(tls, gMultiplex.FpOrigVfs, b)
 69493  }
 69494  
 69495  func multiplexRandomness(tls *libc.TLS, a uintptr, b int32, c uintptr) int32 { /* test_multiplex.c:674:12: */
 69496  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 56 /* &.xRandomness */))))(tls, gMultiplex.FpOrigVfs, b, c)
 69497  }
 69498  
 69499  func multiplexSleep(tls *libc.TLS, a uintptr, b int32) int32 { /* test_multiplex.c:677:12: */
 69500  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 60 /* &.xSleep */))))(tls, gMultiplex.FpOrigVfs, b)
 69501  }
 69502  
 69503  func multiplexCurrentTime(tls *libc.TLS, a uintptr, b uintptr) int32 { /* test_multiplex.c:680:12: */
 69504  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 64 /* &.xCurrentTime */))))(tls, gMultiplex.FpOrigVfs, b)
 69505  }
 69506  
 69507  func multiplexGetLastError(tls *libc.TLS, a uintptr, b int32, c uintptr) int32 { /* test_multiplex.c:683:12: */
 69508  	if (*sqlite3_vfs)(unsafe.Pointer(gMultiplex.FpOrigVfs)).FxGetLastError != 0 {
 69509  		return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 68 /* &.xGetLastError */))))(tls, gMultiplex.FpOrigVfs, b, c)
 69510  	} else {
 69511  		return 0
 69512  	}
 69513  	return int32(0)
 69514  }
 69515  
 69516  func multiplexCurrentTimeInt64(tls *libc.TLS, a uintptr, b uintptr) int32 { /* test_multiplex.c:690:12: */
 69517  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((gMultiplex.FpOrigVfs + 72 /* &.xCurrentTimeInt64 */))))(tls, gMultiplex.FpOrigVfs, b)
 69518  }
 69519  
 69520  //*********************** I/O Method Wrappers ******************************
 69521  
 69522  // xClose requests get passed through to the original VFS.
 69523  // We loop over all open chunk handles and close them.
 69524  // The group structure for this file is unlinked from
 69525  // our list of groups and freed.
 69526  func multiplexClose(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:701:12: */
 69527  	var p uintptr = pConn
 69528  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69529  	var rc int32 = SQLITE_OK
 69530  	multiplexFreeComponents(tls, pGroup)
 69531  	sqlite3.Xsqlite3_free(tls, pGroup)
 69532  	return rc
 69533  }
 69534  
 69535  // Pass xRead requests thru to the original VFS after
 69536  // determining the correct chunk to operate on.
 69537  // Break up reads across chunk boundaries.
 69538  func multiplexRead(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_multiplex.c:714:12: */
 69539  	bp := tls.Alloc(4)
 69540  	defer tls.Free(4)
 69541  
 69542  	var p uintptr = pConn
 69543  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69544  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 69545  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 69546  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 69547  		if pSubOpen == uintptr(0) {
 69548  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(1) << 8))
 69549  		} else {
 69550  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 69551  		}
 69552  	} else {
 69553  		for iAmt > 0 {
 69554  			var i int32 = (int32(iOfst / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69555  			var pSubOpen uintptr
 69556  			pSubOpen = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 1)
 69557  			if pSubOpen != 0 {
 69558  				var extra int32 = (int32((uint32((int32(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))) + iAmt)) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))
 69559  				if extra < 0 {
 69560  					extra = 0
 69561  				}
 69562  				iAmt = iAmt - (extra)
 69563  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt,
 69564  					(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69565  				if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 69566  					break
 69567  				}
 69568  				pBuf = (pBuf + uintptr(iAmt))
 69569  				iOfst = iOfst + (sqlite3_int64(iAmt))
 69570  				iAmt = extra
 69571  			} else {
 69572  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(1) << 8))
 69573  				break
 69574  			}
 69575  		}
 69576  	}
 69577  
 69578  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 69579  }
 69580  
 69581  // Pass xWrite requests thru to the original VFS after
 69582  // determining the correct chunk to operate on.
 69583  // Break up writes across chunk boundaries.
 69584  func multiplexWrite(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_multiplex.c:759:12: */
 69585  	bp := tls.Alloc(4)
 69586  	defer tls.Free(4)
 69587  
 69588  	var p uintptr = pConn
 69589  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69590  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 69591  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 69592  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 69593  		if pSubOpen == uintptr(0) {
 69594  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(3) << 8))
 69595  		} else {
 69596  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 12 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 69597  		}
 69598  	} else {
 69599  		for (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (iAmt > 0) {
 69600  			var i int32 = (int32(iOfst / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69601  			var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 1)
 69602  			if pSubOpen != 0 {
 69603  				var extra int32 = (int32((uint32((int32(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))) + iAmt)) - (*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk))
 69604  				if extra < 0 {
 69605  					extra = 0
 69606  				}
 69607  				iAmt = iAmt - (extra)
 69608  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 12 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt,
 69609  					(iOfst % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69610  				pBuf = (pBuf + uintptr(iAmt))
 69611  				iOfst = iOfst + (sqlite3_int64(iAmt))
 69612  				iAmt = extra
 69613  			}
 69614  		}
 69615  	}
 69616  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 69617  }
 69618  
 69619  // Pass xTruncate requests thru to the original VFS after
 69620  // determining the correct chunk to operate on.  Delete any
 69621  // chunks above the truncate mark.
 69622  func multiplexTruncate(tls *libc.TLS, pConn uintptr, size sqlite3_int64) int32 { /* test_multiplex.c:799:12: */
 69623  	bp := tls.Alloc(4)
 69624  	defer tls.Free(4)
 69625  
 69626  	var p uintptr = pConn
 69627  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69628  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 69629  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 69630  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 69631  		if pSubOpen == uintptr(0) {
 69632  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(6) << 8))
 69633  		} else {
 69634  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xTruncate */))))(tls, pSubOpen, size)
 69635  		}
 69636  	} else {
 69637  		var i int32
 69638  		var iBaseGroup int32 = (int32(size / sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69639  		var pSubOpen uintptr
 69640  		var pOrigVfs uintptr = gMultiplex.FpOrigVfs // Real VFS
 69641  		// delete the chunks above the truncate limit
 69642  		for i = ((*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal - 1); (i > iBaseGroup) && (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK); i-- {
 69643  			if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate != 0 {
 69644  				multiplexSubClose(tls, pGroup, i, pOrigVfs)
 69645  			} else {
 69646  				pSubOpen = multiplexSubOpen(tls, pGroup, i, bp /* &rc */, uintptr(0), 0)
 69647  				if pSubOpen != 0 {
 69648  					*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xTruncate */))))(tls, pSubOpen, int64(0))
 69649  				}
 69650  			}
 69651  		}
 69652  		if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 69653  			pSubOpen = multiplexSubOpen(tls, pGroup, iBaseGroup, bp /* &rc */, uintptr(0), 0)
 69654  			if pSubOpen != 0 {
 69655  				*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xTruncate */))))(tls, pSubOpen, (size % sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)))
 69656  			}
 69657  		}
 69658  		if *(*int32)(unsafe.Pointer(bp /* rc */)) != 0 {
 69659  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(6) << 8))
 69660  		}
 69661  	}
 69662  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 69663  }
 69664  
 69665  // Pass xSync requests through to the original VFS without change
 69666  func multiplexSync(tls *libc.TLS, pConn uintptr, flags int32) int32 { /* test_multiplex.c:839:12: */
 69667  	var p uintptr = pConn
 69668  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69669  	var rc int32 = SQLITE_OK
 69670  	var i int32
 69671  	for i = 0; i < (*multiplexGroup)(unsafe.Pointer(pGroup)).FnReal; i++ {
 69672  		var pSubOpen uintptr = (*multiplexReal)(unsafe.Pointer((*multiplexGroup)(unsafe.Pointer(pGroup)).FaReal + uintptr(i)*8)).Fp
 69673  		if pSubOpen != 0 {
 69674  			var rc2 int32 = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 20 /* &.xSync */))))(tls, pSubOpen, flags)
 69675  			if rc2 != SQLITE_OK {
 69676  				rc = rc2
 69677  			}
 69678  		}
 69679  	}
 69680  	return rc
 69681  }
 69682  
 69683  // Pass xFileSize requests through to the original VFS.
 69684  // Aggregate the size of all the chunks before returning.
 69685  func multiplexFileSize(tls *libc.TLS, pConn uintptr, pSize uintptr) int32 { /* test_multiplex.c:857:12: */
 69686  	bp := tls.Alloc(4)
 69687  	defer tls.Free(4)
 69688  
 69689  	var p uintptr = pConn
 69690  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69691  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 69692  	var i int32
 69693  	if !(int32((*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled) != 0) {
 69694  		var pSubOpen uintptr = multiplexSubOpen(tls, pGroup, 0, bp /* &rc */, uintptr(0), 0)
 69695  		if pSubOpen == uintptr(0) {
 69696  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (SQLITE_IOERR | (int32(7) << 8))
 69697  		} else {
 69698  			*(*int32)(unsafe.Pointer(bp /* rc */)) = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xFileSize */))))(tls, pSubOpen, pSize)
 69699  		}
 69700  	} else {
 69701  		*(*sqlite3_int64)(unsafe.Pointer(pSize)) = int64(0)
 69702  		for i = 0; *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK; i++ {
 69703  			var sz sqlite3_int64 = multiplexSubSize(tls, pGroup, i, bp /* &rc */)
 69704  			if sz == int64(0) {
 69705  				break
 69706  			}
 69707  			*(*sqlite3_int64)(unsafe.Pointer(pSize)) = ((sqlite3_int64(i) * sqlite3_int64((*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk)) + sz)
 69708  		}
 69709  	}
 69710  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 69711  }
 69712  
 69713  // Pass xLock requests through to the original VFS unchanged.
 69714  func multiplexLock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_multiplex.c:882:12: */
 69715  	bp := tls.Alloc(4)
 69716  	defer tls.Free(4)
 69717  
 69718  	var p uintptr = pConn
 69719  	// var rc int32 at bp, 4
 69720  
 69721  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69722  	if pSubOpen != 0 {
 69723  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 28 /* &.xLock */))))(tls, pSubOpen, lock)
 69724  	}
 69725  	return SQLITE_BUSY
 69726  }
 69727  
 69728  // Pass xUnlock requests through to the original VFS unchanged.
 69729  func multiplexUnlock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_multiplex.c:894:12: */
 69730  	bp := tls.Alloc(4)
 69731  	defer tls.Free(4)
 69732  
 69733  	var p uintptr = pConn
 69734  	// var rc int32 at bp, 4
 69735  
 69736  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69737  	if pSubOpen != 0 {
 69738  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xUnlock */))))(tls, pSubOpen, lock)
 69739  	}
 69740  	return (SQLITE_IOERR | (int32(8) << 8))
 69741  }
 69742  
 69743  // Pass xCheckReservedLock requests through to the original VFS unchanged.
 69744  func multiplexCheckReservedLock(tls *libc.TLS, pConn uintptr, pResOut uintptr) int32 { /* test_multiplex.c:906:12: */
 69745  	bp := tls.Alloc(4)
 69746  	defer tls.Free(4)
 69747  
 69748  	var p uintptr = pConn
 69749  	// var rc int32 at bp, 4
 69750  
 69751  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69752  	if pSubOpen != 0 {
 69753  		return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 36 /* &.xCheckReservedLock */))))(tls, pSubOpen, pResOut)
 69754  	}
 69755  	return (SQLITE_IOERR | (int32(14) << 8))
 69756  }
 69757  
 69758  // Pass xFileControl requests through to the original VFS unchanged,
 69759  // except for any MULTIPLEX_CTRL_* requests here.
 69760  func multiplexFileControl(tls *libc.TLS, pConn uintptr, op int32, pArg uintptr) int32 { /* test_multiplex.c:919:12: */
 69761  	bp := tls.Alloc(12)
 69762  	defer tls.Free(12)
 69763  
 69764  	var p uintptr = pConn
 69765  	var pGroup uintptr = (*multiplexConn)(unsafe.Pointer(p)).FpGroup
 69766  	*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_ERROR
 69767  	var pSubOpen uintptr
 69768  
 69769  	if !(gMultiplex.FisInitialized != 0) {
 69770  		return SQLITE_MISUSE
 69771  	}
 69772  	switch op {
 69773  	case MULTIPLEX_CTRL_ENABLE:
 69774  		if pArg != 0 {
 69775  			var bEnabled int32 = *(*int32)(unsafe.Pointer(pArg))
 69776  			(*multiplexGroup)(unsafe.Pointer(pGroup)).FbEnabled = uint8(bEnabled)
 69777  			*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 69778  		}
 69779  		break
 69780  	case MULTIPLEX_CTRL_SET_CHUNK_SIZE:
 69781  		if pArg != 0 {
 69782  			var szChunk uint32 = *(*uint32)(unsafe.Pointer(pArg))
 69783  			if szChunk < uint32(1) {
 69784  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_MISUSE
 69785  			} else {
 69786  				// Round up to nearest multiple of MAX_PAGE_SIZE.
 69787  				szChunk = (szChunk + (uint32(MAX_PAGE_SIZE - 1)))
 69788  				szChunk = szChunk & (libc.Uint32FromInt32(libc.CplInt32((MAX_PAGE_SIZE - 1))))
 69789  				(*multiplexGroup)(unsafe.Pointer(pGroup)).FszChunk = szChunk
 69790  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 69791  			}
 69792  		}
 69793  		break
 69794  	case MULTIPLEX_CTRL_SET_MAX_CHUNKS:
 69795  		*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 69796  		break
 69797  	case SQLITE_FCNTL_SIZE_HINT:
 69798  		fallthrough
 69799  	case SQLITE_FCNTL_CHUNK_SIZE:
 69800  		// no-op these
 69801  		*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 69802  		break
 69803  	case SQLITE_FCNTL_PRAGMA:
 69804  		{
 69805  			var aFcntl uintptr = pArg
 69806  			// EVIDENCE-OF: R-29875-31678 The argument to the SQLITE_FCNTL_PRAGMA
 69807  			// file control is an array of pointers to strings (char**) in which the
 69808  			// second element of the array is the name of the pragma and the third
 69809  			// element is the argument to the pragma or NULL if the pragma has no
 69810  			// argument.
 69811  			if (*(*uintptr)(unsafe.Pointer(aFcntl + 1*4)) != 0) && (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 1*4)), ts+34904 /* "multiplex_trunca..." */) == 0) {
 69812  				if (*(*uintptr)(unsafe.Pointer(aFcntl + 2*4)) != 0) && (*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(aFcntl + 2*4)))) != 0) {
 69813  					if (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*4)), ts+4039 /* "on" */) == 0) ||
 69814  						(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*4)), ts+29094 /* "1" */) == 0) {
 69815  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(1)
 69816  					} else if (sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*4)), ts+4403 /* "off" */) == 0) ||
 69817  						(sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(aFcntl + 2*4)), ts+14654 /* "0" */) == 0) {
 69818  						(*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate = uint8(0)
 69819  					}
 69820  				}
 69821  				// EVIDENCE-OF: R-27806-26076 The handler for an SQLITE_FCNTL_PRAGMA
 69822  				// file control can optionally make the first element of the char**
 69823  				// argument point to a string obtained from sqlite3_mprintf() or the
 69824  				// equivalent and that string will become the result of the pragma
 69825  				// or the error message if the pragma fails.
 69826  				*(*uintptr)(unsafe.Pointer(aFcntl)) = sqlite3.Xsqlite3_mprintf(tls, func() uintptr {
 69827  					if (*multiplexGroup)(unsafe.Pointer(pGroup)).FbTruncate != 0 {
 69828  						return ts + 4039 /* "on" */
 69829  					}
 69830  					return ts + 4403 /* "off" */
 69831  				}(), 0)
 69832  				*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = SQLITE_OK
 69833  				break
 69834  			}
 69835  			// If the multiplexor does not handle the pragma, pass it through
 69836  			// into the default case.
 69837  
 69838  		}
 69839  		fallthrough
 69840  	default:
 69841  		pSubOpen = multiplexSubOpen(tls, pGroup, 0, bp+8 /* &rc */, uintptr(0), 0)
 69842  		if pSubOpen != 0 {
 69843  			*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 40 /* &.xFileControl */))))(tls, pSubOpen, op, pArg)
 69844  			if (op == SQLITE_FCNTL_VFSNAME) && (*(*int32)(unsafe.Pointer(bp + 8 /* rc */)) == SQLITE_OK) {
 69845  				*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+34923 /* "multiplex/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 69846  			}
 69847  		}
 69848  		break
 69849  	}
 69850  	return *(*int32)(unsafe.Pointer(bp + 8 /* rc */))
 69851  }
 69852  
 69853  // Pass xSectorSize requests through to the original VFS unchanged.
 69854  func multiplexSectorSize(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:1004:12: */
 69855  	bp := tls.Alloc(4)
 69856  	defer tls.Free(4)
 69857  
 69858  	var p uintptr = pConn
 69859  	// var rc int32 at bp, 4
 69860  
 69861  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69862  	if (pSubOpen != 0) && ((*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FxSectorSize != 0) {
 69863  		return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 44 /* &.xSectorSize */))))(tls, pSubOpen)
 69864  	}
 69865  	return DEFAULT_SECTOR_SIZE
 69866  }
 69867  
 69868  // Pass xDeviceCharacteristics requests through to the original VFS unchanged.
 69869  func multiplexDeviceCharacteristics(tls *libc.TLS, pConn uintptr) int32 { /* test_multiplex.c:1016:12: */
 69870  	bp := tls.Alloc(4)
 69871  	defer tls.Free(4)
 69872  
 69873  	var p uintptr = pConn
 69874  	// var rc int32 at bp, 4
 69875  
 69876  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69877  	if pSubOpen != 0 {
 69878  		return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, pSubOpen)
 69879  	}
 69880  	return 0
 69881  }
 69882  
 69883  // Pass xShmMap requests through to the original VFS unchanged.
 69884  func multiplexShmMap(tls *libc.TLS, pConn uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) int32 { /* test_multiplex.c:1028:12: */
 69885  	bp := tls.Alloc(4)
 69886  	defer tls.Free(4)
 69887  
 69888  	var p uintptr = pConn
 69889  	// var rc int32 at bp, 4
 69890  
 69891  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69892  	if pSubOpen != 0 {
 69893  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 52 /* &.xShmMap */))))(tls, pSubOpen, iRegion, szRegion, bExtend, libc.AtomicLoadUintptr(&pp))
 69894  	}
 69895  	return SQLITE_IOERR
 69896  }
 69897  
 69898  // Pass xShmLock requests through to the original VFS unchanged.
 69899  func multiplexShmLock(tls *libc.TLS, pConn uintptr, ofst int32, n int32, flags int32) int32 { /* test_multiplex.c:1046:12: */
 69900  	bp := tls.Alloc(4)
 69901  	defer tls.Free(4)
 69902  
 69903  	var p uintptr = pConn
 69904  	// var rc int32 at bp, 4
 69905  
 69906  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69907  	if pSubOpen != 0 {
 69908  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 56 /* &.xShmLock */))))(tls, pSubOpen, ofst, n, flags)
 69909  	}
 69910  	return SQLITE_BUSY
 69911  }
 69912  
 69913  // Pass xShmBarrier requests through to the original VFS unchanged.
 69914  func multiplexShmBarrier(tls *libc.TLS, pConn uintptr) { /* test_multiplex.c:1063:13: */
 69915  	bp := tls.Alloc(4)
 69916  	defer tls.Free(4)
 69917  
 69918  	var p uintptr = pConn
 69919  	// var rc int32 at bp, 4
 69920  
 69921  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69922  	if pSubOpen != 0 {
 69923  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pSubOpen)
 69924  	}
 69925  }
 69926  
 69927  // Pass xShmUnmap requests through to the original VFS unchanged.
 69928  func multiplexShmUnmap(tls *libc.TLS, pConn uintptr, deleteFlag int32) int32 { /* test_multiplex.c:1074:12: */
 69929  	bp := tls.Alloc(4)
 69930  	defer tls.Free(4)
 69931  
 69932  	var p uintptr = pConn
 69933  	// var rc int32 at bp, 4
 69934  
 69935  	var pSubOpen uintptr = multiplexSubOpen(tls, (*multiplexConn)(unsafe.Pointer(p)).FpGroup, 0, bp /* &rc */, uintptr(0), 0)
 69936  	if pSubOpen != 0 {
 69937  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pSubOpen, deleteFlag)
 69938  	}
 69939  	return SQLITE_OK
 69940  }
 69941  
 69942  //************************* Public Interfaces ****************************
 69943  // CAPI: Initialize the multiplex VFS shim - sqlite3_multiplex_initialize()
 69944  //
 69945  // Use the VFS named zOrigVfsName as the VFS that does the actual work.
 69946  // Use the default if zOrigVfsName==NULL.
 69947  //
 69948  // The multiplex VFS shim is named "multiplex".  It will become the default
 69949  // VFS if makeDefault is non-zero.
 69950  //
 69951  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once
 69952  // during start-up.
 69953  func sqlite3_multiplex_initialize(tls *libc.TLS, zOrigVfsName uintptr, makeDefault int32) int32 { /* test_multiplex.c:1097:5: */
 69954  	var pOrigVfs uintptr
 69955  	if gMultiplex.FisInitialized != 0 {
 69956  		return SQLITE_MISUSE
 69957  	}
 69958  	pOrigVfs = sqlite3.Xsqlite3_vfs_find(tls, zOrigVfsName)
 69959  	if pOrigVfs == uintptr(0) {
 69960  		return SQLITE_ERROR
 69961  	}
 69962  
 69963  	gMultiplex.FisInitialized = 1
 69964  	gMultiplex.FpOrigVfs = pOrigVfs
 69965  	gMultiplex.FsThisVfs = *(*sqlite3_vfs)(unsafe.Pointer(pOrigVfs))
 69966  	*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&gMultiplex)) + 4 /* &.sThisVfs */ + 4 /* &.szOsFile */)) += int32((uint32(unsafe.Sizeof(multiplexConn{}))))
 69967  	gMultiplex.FsThisVfs.FzName = ts + 34936 /* "multiplex" */
 69968  	gMultiplex.FsThisVfs.FxOpen = *(*uintptr)(unsafe.Pointer(&struct {
 69969  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 69970  	}{multiplexOpen}))
 69971  	gMultiplex.FsThisVfs.FxDelete = *(*uintptr)(unsafe.Pointer(&struct {
 69972  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 69973  	}{multiplexDelete}))
 69974  	gMultiplex.FsThisVfs.FxAccess = *(*uintptr)(unsafe.Pointer(&struct {
 69975  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 69976  	}{multiplexAccess}))
 69977  	gMultiplex.FsThisVfs.FxFullPathname = *(*uintptr)(unsafe.Pointer(&struct {
 69978  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 69979  	}{multiplexFullPathname}))
 69980  	gMultiplex.FsThisVfs.FxDlOpen = *(*uintptr)(unsafe.Pointer(&struct {
 69981  		f func(*libc.TLS, uintptr, uintptr) uintptr
 69982  	}{multiplexDlOpen}))
 69983  	gMultiplex.FsThisVfs.FxDlError = *(*uintptr)(unsafe.Pointer(&struct {
 69984  		f func(*libc.TLS, uintptr, int32, uintptr)
 69985  	}{multiplexDlError}))
 69986  	gMultiplex.FsThisVfs.FxDlSym = *(*uintptr)(unsafe.Pointer(&struct {
 69987  		f func(*libc.TLS, uintptr, uintptr, uintptr) uintptr
 69988  	}{multiplexDlSym}))
 69989  	gMultiplex.FsThisVfs.FxDlClose = *(*uintptr)(unsafe.Pointer(&struct {
 69990  		f func(*libc.TLS, uintptr, uintptr)
 69991  	}{multiplexDlClose}))
 69992  	gMultiplex.FsThisVfs.FxRandomness = *(*uintptr)(unsafe.Pointer(&struct {
 69993  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 69994  	}{multiplexRandomness}))
 69995  	gMultiplex.FsThisVfs.FxSleep = *(*uintptr)(unsafe.Pointer(&struct {
 69996  		f func(*libc.TLS, uintptr, int32) int32
 69997  	}{multiplexSleep}))
 69998  	gMultiplex.FsThisVfs.FxCurrentTime = *(*uintptr)(unsafe.Pointer(&struct {
 69999  		f func(*libc.TLS, uintptr, uintptr) int32
 70000  	}{multiplexCurrentTime}))
 70001  	gMultiplex.FsThisVfs.FxGetLastError = *(*uintptr)(unsafe.Pointer(&struct {
 70002  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 70003  	}{multiplexGetLastError}))
 70004  	gMultiplex.FsThisVfs.FxCurrentTimeInt64 = *(*uintptr)(unsafe.Pointer(&struct {
 70005  		f func(*libc.TLS, uintptr, uintptr) int32
 70006  	}{multiplexCurrentTimeInt64}))
 70007  
 70008  	gMultiplex.FsIoMethodsV1.FiVersion = 1
 70009  	gMultiplex.FsIoMethodsV1.FxClose = *(*uintptr)(unsafe.Pointer(&struct {
 70010  		f func(*libc.TLS, uintptr) int32
 70011  	}{multiplexClose}))
 70012  	gMultiplex.FsIoMethodsV1.FxRead = *(*uintptr)(unsafe.Pointer(&struct {
 70013  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 70014  	}{multiplexRead}))
 70015  	gMultiplex.FsIoMethodsV1.FxWrite = *(*uintptr)(unsafe.Pointer(&struct {
 70016  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 70017  	}{multiplexWrite}))
 70018  	gMultiplex.FsIoMethodsV1.FxTruncate = *(*uintptr)(unsafe.Pointer(&struct {
 70019  		f func(*libc.TLS, uintptr, sqlite3_int64) int32
 70020  	}{multiplexTruncate}))
 70021  	gMultiplex.FsIoMethodsV1.FxSync = *(*uintptr)(unsafe.Pointer(&struct {
 70022  		f func(*libc.TLS, uintptr, int32) int32
 70023  	}{multiplexSync}))
 70024  	gMultiplex.FsIoMethodsV1.FxFileSize = *(*uintptr)(unsafe.Pointer(&struct {
 70025  		f func(*libc.TLS, uintptr, uintptr) int32
 70026  	}{multiplexFileSize}))
 70027  	gMultiplex.FsIoMethodsV1.FxLock = *(*uintptr)(unsafe.Pointer(&struct {
 70028  		f func(*libc.TLS, uintptr, int32) int32
 70029  	}{multiplexLock}))
 70030  	gMultiplex.FsIoMethodsV1.FxUnlock = *(*uintptr)(unsafe.Pointer(&struct {
 70031  		f func(*libc.TLS, uintptr, int32) int32
 70032  	}{multiplexUnlock}))
 70033  	gMultiplex.FsIoMethodsV1.FxCheckReservedLock = *(*uintptr)(unsafe.Pointer(&struct {
 70034  		f func(*libc.TLS, uintptr, uintptr) int32
 70035  	}{multiplexCheckReservedLock}))
 70036  	gMultiplex.FsIoMethodsV1.FxFileControl = *(*uintptr)(unsafe.Pointer(&struct {
 70037  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 70038  	}{multiplexFileControl}))
 70039  	gMultiplex.FsIoMethodsV1.FxSectorSize = *(*uintptr)(unsafe.Pointer(&struct {
 70040  		f func(*libc.TLS, uintptr) int32
 70041  	}{multiplexSectorSize}))
 70042  	gMultiplex.FsIoMethodsV1.FxDeviceCharacteristics = *(*uintptr)(unsafe.Pointer(&struct {
 70043  		f func(*libc.TLS, uintptr) int32
 70044  	}{multiplexDeviceCharacteristics}))
 70045  	gMultiplex.FsIoMethodsV2 = gMultiplex.FsIoMethodsV1
 70046  	gMultiplex.FsIoMethodsV2.FiVersion = 2
 70047  	gMultiplex.FsIoMethodsV2.FxShmMap = *(*uintptr)(unsafe.Pointer(&struct {
 70048  		f func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32
 70049  	}{multiplexShmMap}))
 70050  	gMultiplex.FsIoMethodsV2.FxShmLock = *(*uintptr)(unsafe.Pointer(&struct {
 70051  		f func(*libc.TLS, uintptr, int32, int32, int32) int32
 70052  	}{multiplexShmLock}))
 70053  	gMultiplex.FsIoMethodsV2.FxShmBarrier = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{multiplexShmBarrier}))
 70054  	gMultiplex.FsIoMethodsV2.FxShmUnmap = *(*uintptr)(unsafe.Pointer(&struct {
 70055  		f func(*libc.TLS, uintptr, int32) int32
 70056  	}{multiplexShmUnmap}))
 70057  	sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&gMultiplex)) + 4 /* &.sThisVfs */), makeDefault)
 70058  
 70059  	sqlite3.Xsqlite3_auto_extension(tls, *(*uintptr)(unsafe.Pointer(&struct {
 70060  		f func(*libc.TLS, uintptr, uintptr, uintptr) int32
 70061  	}{multiplexFuncInit})))
 70062  
 70063  	return SQLITE_OK
 70064  }
 70065  
 70066  // CAPI: Shutdown the multiplex system - sqlite3_multiplex_shutdown()
 70067  //
 70068  // All SQLite database connections must be closed before calling this
 70069  // routine.
 70070  //
 70071  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once while
 70072  // shutting down in order to free all remaining multiplex groups.
 70073  func sqlite3_multiplex_shutdown(tls *libc.TLS, eForce int32) int32 { /* test_multiplex.c:1158:5: */
 70074  	var rc int32 = SQLITE_OK
 70075  	if gMultiplex.FisInitialized == 0 {
 70076  		return SQLITE_MISUSE
 70077  	}
 70078  	gMultiplex.FisInitialized = 0
 70079  	sqlite3.Xsqlite3_vfs_unregister(tls, (uintptr(unsafe.Pointer(&gMultiplex)) + 4 /* &.sThisVfs */))
 70080  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&gMultiplex)), 0, uint32(unsafe.Sizeof(gMultiplex)))
 70081  	return rc
 70082  }
 70083  
 70084  // tclcmd: sqlite3_multiplex_initialize NAME MAKEDEFAULT
 70085  func test_multiplex_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1183:26: */
 70086  	bp := tls.Alloc(4)
 70087  	defer tls.Free(4)
 70088  
 70089  	var zName uintptr // Name of new multiplex VFS
 70090  	// var makeDefault int32 at bp, 4
 70091  	// True to make the new VFS the default
 70092  	var rc int32 // Value returned by multiplex_initialize()
 70093  
 70094  	_ = clientData
 70095  
 70096  	// Process arguments
 70097  	if objc != 3 {
 70098  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34946 /* "NAME MAKEDEFAULT" */)
 70099  		return TCL_ERROR
 70100  	}
 70101  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 70102  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &makeDefault */) != 0 {
 70103  		return TCL_ERROR
 70104  	}
 70105  	if int32(*(*int8)(unsafe.Pointer(zName))) == 0 {
 70106  		zName = uintptr(0)
 70107  	}
 70108  
 70109  	// Call sqlite3_multiplex_initialize()
 70110  	rc = sqlite3_multiplex_initialize(tls, zName, *(*int32)(unsafe.Pointer(bp /* makeDefault */)))
 70111  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 70112  
 70113  	return TCL_OK
 70114  }
 70115  
 70116  // tclcmd: sqlite3_multiplex_shutdown
 70117  func test_multiplex_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1214:26: */
 70118  	var rc int32 // Value returned by multiplex_shutdown()
 70119  
 70120  	_ = clientData
 70121  
 70122  	if (objc == 2) && (libc.Xstrcmp(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), ts+34963 /* "-force" */) != 0) {
 70123  		objc = 3
 70124  	}
 70125  	if (objc != 1) && (objc != 2) {
 70126  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34970 /* "?-force?" */)
 70127  		return TCL_ERROR
 70128  	}
 70129  
 70130  	// Call sqlite3_multiplex_shutdown()
 70131  	rc = sqlite3_multiplex_shutdown(tls, (libc.Bool32(objc == 2)))
 70132  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 70133  
 70134  	return TCL_OK
 70135  }
 70136  
 70137  // Tclcmd: test_multiplex_control HANDLE DBNAME SUB-COMMAND ?INT-VALUE?
 70138  func test_multiplex_control(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_multiplex.c:1242:26: */
 70139  	bp := tls.Alloc(128)
 70140  	defer tls.Free(128)
 70141  
 70142  	var rc int32 // Return code from file_control()
 70143  	// var idx int32 at bp+120, 4
 70144  	// Index in aSub[]
 70145  	// var cmdInfo Tcl_CmdInfo at bp+40, 32
 70146  	// Command info structure for HANDLE
 70147  	var db uintptr // Underlying db handle for HANDLE
 70148  	*(*int32)(unsafe.Pointer(bp + 124 /* iValue */)) = 0
 70149  	var pArg uintptr = uintptr(0)
 70150  
 70151  	*(*[4]struct {
 70152  		FzName   uintptr
 70153  		Fop      int32
 70154  		Fargtype int32
 70155  	})(unsafe.Pointer(bp + 72 /* aSub */)) = [4]struct {
 70156  		FzName   uintptr
 70157  		Fop      int32
 70158  		Fargtype int32
 70159  	}{
 70160  		{FzName: ts + 10608 /* "enable" */, Fop: MULTIPLEX_CTRL_ENABLE, Fargtype: 1},
 70161  		{FzName: ts + 34979 /* "chunk_size" */, Fop: MULTIPLEX_CTRL_SET_CHUNK_SIZE, Fargtype: 1},
 70162  		{FzName: ts + 34990 /* "max_chunks" */, Fop: MULTIPLEX_CTRL_SET_MAX_CHUNKS, Fargtype: 1},
 70163  		{},
 70164  	}
 70165  
 70166  	if objc != 5 {
 70167  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+35001 /* "HANDLE DBNAME SU..." */)
 70168  		return TCL_ERROR
 70169  	}
 70170  
 70171  	if 0 == tcl.XTcl_GetCommandInfo(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+40 /* &cmdInfo */) {
 70172  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35037 /* "expected databas..." */, 0))
 70173  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), ts+12415 /* "\"" */, 0))
 70174  		return TCL_ERROR
 70175  	} else {
 70176  		db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 40 /* &cmdInfo */)).FobjClientData))
 70177  	}
 70178  
 70179  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 70180  		interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+72 /* &aSub[0] */, int32(unsafe.Sizeof(struct {
 70181  			FzName   uintptr
 70182  			Fop      int32
 70183  			Fargtype int32
 70184  		}{})), ts+1875 /* "sub-command" */, 0, bp+120 /* &idx */)
 70185  	if rc != TCL_OK {
 70186  		return rc
 70187  	}
 70188  
 70189  	switch (*struct {
 70190  		FzName   uintptr
 70191  		Fop      int32
 70192  		Fargtype int32
 70193  	})(unsafe.Pointer(bp + 72 /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 120 /* idx */)))*12)).Fargtype {
 70194  	case 1:
 70195  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+124 /* &iValue */) != 0 {
 70196  			return TCL_ERROR
 70197  		}
 70198  		pArg = bp + 124 /* &iValue */
 70199  		break
 70200  	default:
 70201  		tcl.XTcl_WrongNumArgs(tls, interp, 4, objv, ts+2384 /* "SUB-COMMAND" */)
 70202  		return TCL_ERROR
 70203  	}
 70204  
 70205  	rc = sqlite3.Xsqlite3_file_control(tls, db, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), (*struct {
 70206  		FzName   uintptr
 70207  		Fop      int32
 70208  		Fargtype int32
 70209  	})(unsafe.Pointer(bp+72 /* &aSub */ +uintptr(*(*int32)(unsafe.Pointer(bp + 120 /* idx */)))*12)).Fop, pArg)
 70210  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 70211  	if rc == SQLITE_OK {
 70212  		return TCL_OK
 70213  	}
 70214  	return TCL_ERROR
 70215  }
 70216  
 70217  // This routine registers the custom TCL commands defined in this
 70218  // module.  This should be the only procedure visible from outside
 70219  // of this module.
 70220  func Sqlitemultiplex_Init(tls *libc.TLS, interp uintptr) int32 { /* test_multiplex.c:1306:5: */
 70221  	var i int32
 70222  
 70223  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd7)) / uint32(unsafe.Sizeof(struct {
 70224  		FzName uintptr
 70225  		FxProc uintptr
 70226  	}{}))); i++ {
 70227  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd7[i].FzName, aCmd7[i].FxProc, uintptr(0), uintptr(0))
 70228  	}
 70229  
 70230  	return TCL_OK
 70231  }
 70232  
 70233  var aCmd7 = [3]struct {
 70234  	FzName uintptr
 70235  	FxProc uintptr
 70236  }{
 70237  	{FzName: ts + 35069 /* "sqlite3_multiple..." */, FxProc: 0},
 70238  	{FzName: ts + 35098 /* "sqlite3_multiple..." */, FxProc: 0},
 70239  	{FzName: ts + 35125 /* "sqlite3_multiple..." */, FxProc: 0},
 70240  } /* test_multiplex.c:1310:5 */
 70241  
 70242  // CAPI3REF: Standard File Control Opcodes
 70243  // KEYWORDS: {file control opcodes} {file control opcode}
 70244  //
 70245  // These integer constants are opcodes for the xFileControl method
 70246  // of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
 70247  // interface.
 70248  //
 70249  // <ul>
 70250  // <li>[[SQLITE_FCNTL_LOCKSTATE]]
 70251  // The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
 70252  // opcode causes the xFileControl method to write the current state of
 70253  // the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
 70254  // [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
 70255  // into an integer that the pArg argument points to. This capability
 70256  // is used during testing and is only available when the SQLITE_TEST
 70257  // compile-time option is used.
 70258  //
 70259  // <li>[[SQLITE_FCNTL_SIZE_HINT]]
 70260  // The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
 70261  // layer a hint of how large the database file will grow to be during the
 70262  // current transaction.  This hint is not guaranteed to be accurate but it
 70263  // is often close.  The underlying VFS might choose to preallocate database
 70264  // file space based on this hint in order to help writes to the database
 70265  // file run faster.
 70266  //
 70267  // <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
 70268  // The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
 70269  // implements [sqlite3_deserialize()] to set an upper bound on the size
 70270  // of the in-memory database.  The argument is a pointer to a [sqlite3_int64].
 70271  // If the integer pointed to is negative, then it is filled in with the
 70272  // current limit.  Otherwise the limit is set to the larger of the value
 70273  // of the integer pointed to and the current database size.  The integer
 70274  // pointed to is set to the new limit.
 70275  //
 70276  // <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
 70277  // The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
 70278  // extends and truncates the database file in chunks of a size specified
 70279  // by the user. The fourth argument to [sqlite3_file_control()] should
 70280  // point to an integer (type int) containing the new chunk-size to use
 70281  // for the nominated database. Allocating database file space in large
 70282  // chunks (say 1MB at a time), may reduce file-system fragmentation and
 70283  // improve performance on some systems.
 70284  //
 70285  // <li>[[SQLITE_FCNTL_FILE_POINTER]]
 70286  // The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
 70287  // to the [sqlite3_file] object associated with a particular database
 70288  // connection.  See also [SQLITE_FCNTL_JOURNAL_POINTER].
 70289  //
 70290  // <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
 70291  // The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
 70292  // to the [sqlite3_file] object associated with the journal file (either
 70293  // the [rollback journal] or the [write-ahead log]) for a particular database
 70294  // connection.  See also [SQLITE_FCNTL_FILE_POINTER].
 70295  //
 70296  // <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
 70297  // No longer in use.
 70298  //
 70299  // <li>[[SQLITE_FCNTL_SYNC]]
 70300  // The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
 70301  // sent to the VFS immediately before the xSync method is invoked on a
 70302  // database file descriptor. Or, if the xSync method is not invoked
 70303  // because the user has configured SQLite with
 70304  // [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
 70305  // of the xSync method. In most cases, the pointer argument passed with
 70306  // this file-control is NULL. However, if the database file is being synced
 70307  // as part of a multi-database commit, the argument points to a nul-terminated
 70308  // string containing the transactions super-journal file name. VFSes that
 70309  // do not need this signal should silently ignore this opcode. Applications
 70310  // should not call [sqlite3_file_control()] with this opcode as doing so may
 70311  // disrupt the operation of the specialized VFSes that do require it.
 70312  //
 70313  // <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
 70314  // The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
 70315  // and sent to the VFS after a transaction has been committed immediately
 70316  // but before the database is unlocked. VFSes that do not need this signal
 70317  // should silently ignore this opcode. Applications should not call
 70318  // [sqlite3_file_control()] with this opcode as doing so may disrupt the
 70319  // operation of the specialized VFSes that do require it.
 70320  //
 70321  // <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
 70322  // ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
 70323  // retry counts and intervals for certain disk I/O operations for the
 70324  // windows [VFS] in order to provide robustness in the presence of
 70325  // anti-virus programs.  By default, the windows VFS will retry file read,
 70326  // file write, and file delete operations up to 10 times, with a delay
 70327  // of 25 milliseconds before the first retry and with the delay increasing
 70328  // by an additional 25 milliseconds with each subsequent retry.  This
 70329  // opcode allows these two values (10 retries and 25 milliseconds of delay)
 70330  // to be adjusted.  The values are changed for all database connections
 70331  // within the same process.  The argument is a pointer to an array of two
 70332  // integers where the first integer is the new retry count and the second
 70333  // integer is the delay.  If either integer is negative, then the setting
 70334  // is not changed but instead the prior value of that setting is written
 70335  // into the array entry, allowing the current retry settings to be
 70336  // interrogated.  The zDbName parameter is ignored.
 70337  //
 70338  // <li>[[SQLITE_FCNTL_PERSIST_WAL]]
 70339  // ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
 70340  // persistent [WAL | Write Ahead Log] setting.  By default, the auxiliary
 70341  // write ahead log ([WAL file]) and shared memory
 70342  // files used for transaction control
 70343  // are automatically deleted when the latest connection to the database
 70344  // closes.  Setting persistent WAL mode causes those files to persist after
 70345  // close.  Persisting the files is useful when other processes that do not
 70346  // have write permission on the directory containing the database file want
 70347  // to read the database file, as the WAL and shared memory files must exist
 70348  // in order for the database to be readable.  The fourth parameter to
 70349  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
 70350  // That integer is 0 to disable persistent WAL mode or 1 to enable persistent
 70351  // WAL mode.  If the integer is -1, then it is overwritten with the current
 70352  // WAL persistence setting.
 70353  //
 70354  // <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
 70355  // ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
 70356  // persistent "powersafe-overwrite" or "PSOW" setting.  The PSOW setting
 70357  // determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
 70358  // xDeviceCharacteristics methods. The fourth parameter to
 70359  // [sqlite3_file_control()] for this opcode should be a pointer to an integer.
 70360  // That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
 70361  // mode.  If the integer is -1, then it is overwritten with the current
 70362  // zero-damage mode setting.
 70363  //
 70364  // <li>[[SQLITE_FCNTL_OVERWRITE]]
 70365  // ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
 70366  // a write transaction to indicate that, unless it is rolled back for some
 70367  // reason, the entire database file will be overwritten by the current
 70368  // transaction. This is used by VACUUM operations.
 70369  //
 70370  // <li>[[SQLITE_FCNTL_VFSNAME]]
 70371  // ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
 70372  // all [VFSes] in the VFS stack.  The names are of all VFS shims and the
 70373  // final bottom-level VFS are written into memory obtained from
 70374  // [sqlite3_malloc()] and the result is stored in the char* variable
 70375  // that the fourth parameter of [sqlite3_file_control()] points to.
 70376  // The caller is responsible for freeing the memory when done.  As with
 70377  // all file-control actions, there is no guarantee that this will actually
 70378  // do anything.  Callers should initialize the char* variable to a NULL
 70379  // pointer in case this file-control is not implemented.  This file-control
 70380  // is intended for diagnostic use only.
 70381  //
 70382  // <li>[[SQLITE_FCNTL_VFS_POINTER]]
 70383  // ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
 70384  // [VFSes] currently in use.  ^(The argument X in
 70385  // sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
 70386  // of type "[sqlite3_vfs] **".  This opcodes will set *X
 70387  // to a pointer to the top-level VFS.)^
 70388  // ^When there are multiple VFS shims in the stack, this opcode finds the
 70389  // upper-most shim only.
 70390  //
 70391  // <li>[[SQLITE_FCNTL_PRAGMA]]
 70392  // ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
 70393  // file control is sent to the open [sqlite3_file] object corresponding
 70394  // to the database file to which the pragma statement refers. ^The argument
 70395  // to the [SQLITE_FCNTL_PRAGMA] file control is an array of
 70396  // pointers to strings (char**) in which the second element of the array
 70397  // is the name of the pragma and the third element is the argument to the
 70398  // pragma or NULL if the pragma has no argument.  ^The handler for an
 70399  // [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
 70400  // of the char** argument point to a string obtained from [sqlite3_mprintf()]
 70401  // or the equivalent and that string will become the result of the pragma or
 70402  // the error message if the pragma fails. ^If the
 70403  // [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
 70404  // [PRAGMA] processing continues.  ^If the [SQLITE_FCNTL_PRAGMA]
 70405  // file control returns [SQLITE_OK], then the parser assumes that the
 70406  // VFS has handled the PRAGMA itself and the parser generates a no-op
 70407  // prepared statement if result string is NULL, or that returns a copy
 70408  // of the result string if the string is non-NULL.
 70409  // ^If the [SQLITE_FCNTL_PRAGMA] file control returns
 70410  // any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
 70411  // that the VFS encountered an error while handling the [PRAGMA] and the
 70412  // compilation of the PRAGMA fails with an error.  ^The [SQLITE_FCNTL_PRAGMA]
 70413  // file control occurs at the beginning of pragma statement analysis and so
 70414  // it is able to override built-in [PRAGMA] statements.
 70415  //
 70416  // <li>[[SQLITE_FCNTL_BUSYHANDLER]]
 70417  // ^The [SQLITE_FCNTL_BUSYHANDLER]
 70418  // file-control may be invoked by SQLite on the database file handle
 70419  // shortly after it is opened in order to provide a custom VFS with access
 70420  // to the connection's busy-handler callback. The argument is of type (void**)
 70421  // - an array of two (void *) values. The first (void *) actually points
 70422  // to a function of type (int (*)(void *)). In order to invoke the connection's
 70423  // busy-handler, this function should be invoked with the second (void *) in
 70424  // the array as the only argument. If it returns non-zero, then the operation
 70425  // should be retried. If it returns zero, the custom VFS should abandon the
 70426  // current operation.
 70427  //
 70428  // <li>[[SQLITE_FCNTL_TEMPFILENAME]]
 70429  // ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
 70430  // to have SQLite generate a
 70431  // temporary filename using the same algorithm that is followed to generate
 70432  // temporary filenames for TEMP tables and other internal uses.  The
 70433  // argument should be a char** which will be filled with the filename
 70434  // written into memory obtained from [sqlite3_malloc()].  The caller should
 70435  // invoke [sqlite3_free()] on the result to avoid a memory leak.
 70436  //
 70437  // <li>[[SQLITE_FCNTL_MMAP_SIZE]]
 70438  // The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
 70439  // maximum number of bytes that will be used for memory-mapped I/O.
 70440  // The argument is a pointer to a value of type sqlite3_int64 that
 70441  // is an advisory maximum number of bytes in the file to memory map.  The
 70442  // pointer is overwritten with the old value.  The limit is not changed if
 70443  // the value originally pointed to is negative, and so the current limit
 70444  // can be queried by passing in a pointer to a negative number.  This
 70445  // file-control is used internally to implement [PRAGMA mmap_size].
 70446  //
 70447  // <li>[[SQLITE_FCNTL_TRACE]]
 70448  // The [SQLITE_FCNTL_TRACE] file control provides advisory information
 70449  // to the VFS about what the higher layers of the SQLite stack are doing.
 70450  // This file control is used by some VFS activity tracing [shims].
 70451  // The argument is a zero-terminated string.  Higher layers in the
 70452  // SQLite stack may generate instances of this file control if
 70453  // the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
 70454  //
 70455  // <li>[[SQLITE_FCNTL_HAS_MOVED]]
 70456  // The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
 70457  // pointer to an integer and it writes a boolean into that integer depending
 70458  // on whether or not the file has been renamed, moved, or deleted since it
 70459  // was first opened.
 70460  //
 70461  // <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
 70462  // The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
 70463  // underlying native file handle associated with a file handle.  This file
 70464  // control interprets its argument as a pointer to a native file handle and
 70465  // writes the resulting value there.
 70466  //
 70467  // <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
 70468  // The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging.  This
 70469  // opcode causes the xFileControl method to swap the file handle with the one
 70470  // pointed to by the pArg argument.  This capability is used during testing
 70471  // and only needs to be supported when SQLITE_TEST is defined.
 70472  //
 70473  // <li>[[SQLITE_FCNTL_WAL_BLOCK]]
 70474  // The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
 70475  // be advantageous to block on the next WAL lock if the lock is not immediately
 70476  // available.  The WAL subsystem issues this signal during rare
 70477  // circumstances in order to fix a problem with priority inversion.
 70478  // Applications should <em>not</em> use this file-control.
 70479  //
 70480  // <li>[[SQLITE_FCNTL_ZIPVFS]]
 70481  // The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
 70482  // VFS should return SQLITE_NOTFOUND for this opcode.
 70483  //
 70484  // <li>[[SQLITE_FCNTL_RBU]]
 70485  // The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
 70486  // the RBU extension only.  All other VFS should return SQLITE_NOTFOUND for
 70487  // this opcode.
 70488  //
 70489  // <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
 70490  // If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
 70491  // the file descriptor is placed in "batch write mode", which
 70492  // means all subsequent write operations will be deferred and done
 70493  // atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].  Systems
 70494  // that do not support batch atomic writes will return SQLITE_NOTFOUND.
 70495  // ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
 70496  // the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
 70497  // [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
 70498  // no VFS interface calls on the same [sqlite3_file] file descriptor
 70499  // except for calls to the xWrite method and the xFileControl method
 70500  // with [SQLITE_FCNTL_SIZE_HINT].
 70501  //
 70502  // <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
 70503  // The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
 70504  // operations since the previous successful call to
 70505  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
 70506  // This file control returns [SQLITE_OK] if and only if the writes were
 70507  // all performed successfully and have been committed to persistent storage.
 70508  // ^Regardless of whether or not it is successful, this file control takes
 70509  // the file descriptor out of batch write mode so that all subsequent
 70510  // write operations are independent.
 70511  // ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
 70512  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
 70513  //
 70514  // <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
 70515  // The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
 70516  // operations since the previous successful call to
 70517  // [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
 70518  // ^This file control takes the file descriptor out of batch write mode
 70519  // so that all subsequent write operations are independent.
 70520  // ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
 70521  // a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
 70522  //
 70523  // <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
 70524  // The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
 70525  // to block for up to M milliseconds before failing when attempting to
 70526  // obtain a file lock using the xLock or xShmLock methods of the VFS.
 70527  // The parameter is a pointer to a 32-bit signed integer that contains
 70528  // the value that M is to be set to. Before returning, the 32-bit signed
 70529  // integer is overwritten with the previous value of M.
 70530  //
 70531  // <li>[[SQLITE_FCNTL_DATA_VERSION]]
 70532  // The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
 70533  // a database file.  The argument is a pointer to a 32-bit unsigned integer.
 70534  // The "data version" for the pager is written into the pointer.  The
 70535  // "data version" changes whenever any change occurs to the corresponding
 70536  // database file, either through SQL statements on the same database
 70537  // connection or through transactions committed by separate database
 70538  // connections possibly in other processes. The [sqlite3_total_changes()]
 70539  // interface can be used to find if any database on the connection has changed,
 70540  // but that interface responds to changes on TEMP as well as MAIN and does
 70541  // not provide a mechanism to detect changes to MAIN only.  Also, the
 70542  // [sqlite3_total_changes()] interface responds to internal changes only and
 70543  // omits changes made by other database connections.  The
 70544  // [PRAGMA data_version] command provides a mechanism to detect changes to
 70545  // a single attached database that occur due to other database connections,
 70546  // but omits changes implemented by the database connection on which it is
 70547  // called.  This file control is the only mechanism to detect changes that
 70548  // happen either internally or externally and that are associated with
 70549  // a particular attached database.
 70550  //
 70551  // <li>[[SQLITE_FCNTL_CKPT_START]]
 70552  // The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
 70553  // in wal mode before the client starts to copy pages from the wal
 70554  // file to the database file.
 70555  //
 70556  // <li>[[SQLITE_FCNTL_CKPT_DONE]]
 70557  // The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
 70558  // in wal mode after the client has finished copying pages from the wal
 70559  // file to the database file, but before the *-shm file is updated to
 70560  // record the fact that the pages have been checkpointed.
 70561  // </ul>
 70562  //
 70563  // <li>[[SQLITE_FCNTL_EXTERNAL_READER]]
 70564  // The EXPERIMENTAL [SQLITE_FCNTL_EXTERNAL_READER] opcode is used to detect
 70565  // whether or not there is a database client in another process with a wal-mode
 70566  // transaction open on the database or not. It is only available on unix.The
 70567  // (void*) argument passed with this file-control should be a pointer to a
 70568  // value of type (int). The integer value is set to 1 if the database is a wal
 70569  // mode database and there exists at least one client in another process that
 70570  // currently has an SQL transaction open on the database. It is set to 0 if
 70571  // the database is not a wal-mode db, or if there is no such connection in any
 70572  // other process. This opcode cannot be used to detect transactions opened
 70573  // by clients within the current process, only within other processes.
 70574  // </ul>
 70575  //
 70576  // <li>[[SQLITE_FCNTL_CKSM_FILE]]
 70577  // Used by the cksmvfs VFS module only.
 70578  // </ul>
 70579  
 70580  // deprecated names
 70581  
 70582  // CAPI3REF: Mutex Handle
 70583  //
 70584  // The mutex module within SQLite defines [sqlite3_mutex] to be an
 70585  // abstract type for a mutex object.  The SQLite core never looks
 70586  // at the internal representation of an [sqlite3_mutex].  It only
 70587  // deals with pointers to the [sqlite3_mutex] object.
 70588  //
 70589  // Mutexes are created using [sqlite3_mutex_alloc()].
 70590  type sqlite3_mutex = sqlite3_mutex1 /* sqlite3.h:1206:30 */
 70591  
 70592  var aName = [15]uintptr{
 70593  	ts + 35151 /* "fast" */, ts + 35156 /* "recursive" */, ts + 35166 /* "static_main" */, ts + 35178, /* "static_mem" */
 70594  	ts + 35189 /* "static_open" */, ts + 35201 /* "static_prng" */, ts + 35213 /* "static_lru" */, ts + 35224, /* "static_pmem" */
 70595  	ts + 35236 /* "static_app1" */, ts + 35248 /* "static_app2" */, ts + 35260 /* "static_app3" */, ts + 35272, /* "static_vfs1" */
 70596  	ts + 35284 /* "static_vfs2" */, ts + 35296 /* "static_vfs3" */, uintptr(0),
 70597  } /* test_mutex.c:32:19 */
 70598  
 70599  // State variables
 70600  type test_mutex_globals = struct {
 70601  	FisInstalled int32
 70602  	FdisableInit int32
 70603  	FdisableTry  int32
 70604  	FisInit      int32
 70605  	Fm           sqlite3_mutex_methods
 70606  	FaCounter    [14]int32
 70607  	FaStatic     [12]sqlite3_mutex
 70608  } /* test_mutex.c:46:8 */
 70609  
 70610  // State variables
 70611  var g3 = test_mutex_globals{} /* test_mutex.c:54:3 */
 70612  
 70613  // Return true if the countable mutex is currently held
 70614  func counterMutexHeld(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:57:12: */
 70615  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 28 /* &.xMutexHeld */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70616  }
 70617  
 70618  // Return true if the countable mutex is not currently held
 70619  func counterMutexNotheld(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:62:12: */
 70620  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 32 /* &.xMutexNotheld */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70621  }
 70622  
 70623  // Initialize the countable mutex interface
 70624  // Or, if g.disableInit is non-zero, then do not initialize but instead
 70625  // return the value of g.disableInit as the result code.  This can be used
 70626  // to simulate an initialization failure.
 70627  func counterMutexInit(tls *libc.TLS) int32 { /* test_mutex.c:71:12: */
 70628  	var rc int32
 70629  	if g3.FdisableInit != 0 {
 70630  		return g3.FdisableInit
 70631  	}
 70632  	rc = (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ /* &.xMutexInit */))))(tls)
 70633  	g3.FisInit = 1
 70634  	return rc
 70635  }
 70636  
 70637  // Uninitialize the mutex subsystem
 70638  func counterMutexEnd(tls *libc.TLS) int32 { /* test_mutex.c:82:12: */
 70639  	g3.FisInit = 0
 70640  	return (*(*func(*libc.TLS) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 4 /* &.xMutexEnd */))))(tls)
 70641  }
 70642  
 70643  // Allocate a countable mutex
 70644  func counterMutexAlloc(tls *libc.TLS, eType int32) uintptr { /* test_mutex.c:90:22: */
 70645  	var pReal uintptr
 70646  	var pRet uintptr = uintptr(0)
 70647  
 70648  	pReal = (*(*func(*libc.TLS, int32) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 8 /* &.xMutexAlloc */))))(tls, eType)
 70649  	if !(pReal != 0) {
 70650  		return uintptr(0)
 70651  	}
 70652  
 70653  	if (eType == SQLITE_MUTEX_FAST) || (eType == SQLITE_MUTEX_RECURSIVE) {
 70654  		pRet = libc.Xmalloc(tls, uint32(unsafe.Sizeof(sqlite3_mutex{})))
 70655  	} else {
 70656  		var eStaticType int32 = (eType - ((SQLITE_MUTEX_STATIC_VFS3 + 1) - ((SQLITE_MUTEX_STATIC_VFS3 + 1) - (SQLITE_MUTEX_RECURSIVE + 1))))
 70657  
 70658  		pRet = ((uintptr(unsafe.Pointer(&g3)) + 108 /* &.aStatic */) + uintptr(eStaticType)*8)
 70659  	}
 70660  
 70661  	(*sqlite3_mutex)(unsafe.Pointer(pRet)).FeType = eType
 70662  	(*sqlite3_mutex)(unsafe.Pointer(pRet)).FpReal = pReal
 70663  	return pRet
 70664  }
 70665  
 70666  // Free a countable mutex
 70667  func counterMutexFree(tls *libc.TLS, p uintptr) { /* test_mutex.c:118:13: */
 70668  
 70669  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 12 /* &.xMutexFree */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70670  	if ((*sqlite3_mutex)(unsafe.Pointer(p)).FeType == SQLITE_MUTEX_FAST) || ((*sqlite3_mutex)(unsafe.Pointer(p)).FeType == SQLITE_MUTEX_RECURSIVE) {
 70671  		libc.Xfree(tls, p)
 70672  	}
 70673  }
 70674  
 70675  // Enter a countable mutex.  Block until entry is safe.
 70676  func counterMutexEnter(tls *libc.TLS, p uintptr) { /* test_mutex.c:129:13: */
 70677  
 70678  	*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 52 /* &.aCounter */) + uintptr((*sqlite3_mutex)(unsafe.Pointer(p)).FeType)*4))++
 70679  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 16 /* &.xMutexEnter */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70680  }
 70681  
 70682  // Try to enter a mutex.  Return true on success.
 70683  func counterMutexTry(tls *libc.TLS, p uintptr) int32 { /* test_mutex.c:140:12: */
 70684  
 70685  	*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 52 /* &.aCounter */) + uintptr((*sqlite3_mutex)(unsafe.Pointer(p)).FeType)*4))++
 70686  	if g3.FdisableTry != 0 {
 70687  		return SQLITE_BUSY
 70688  	}
 70689  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 20 /* &.xMutexTry */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70690  }
 70691  
 70692  // Leave a mutex
 70693  func counterMutexLeave(tls *libc.TLS, p uintptr) { /* test_mutex.c:151:13: */
 70694  
 70695  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */ + 24 /* &.xMutexLeave */))))(tls, (*sqlite3_mutex)(unsafe.Pointer(p)).FpReal)
 70696  }
 70697  
 70698  // sqlite3_shutdown
 70699  func test_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:159:26: */
 70700  	var rc int32
 70701  
 70702  	if objc != 1 {
 70703  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 70704  		return TCL_ERROR
 70705  	}
 70706  
 70707  	rc = sqlite3.Xsqlite3_shutdown(tls)
 70708  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 70709  	return TCL_OK
 70710  }
 70711  
 70712  // sqlite3_initialize
 70713  func test_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:180:26: */
 70714  	var rc int32
 70715  
 70716  	if objc != 1 {
 70717  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 70718  		return TCL_ERROR
 70719  	}
 70720  
 70721  	rc = sqlite3.Xsqlite3_initialize(tls)
 70722  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 70723  	return TCL_OK
 70724  }
 70725  
 70726  // install_mutex_counters BOOLEAN
 70727  func test_install_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:201:26: */
 70728  	bp := tls.Alloc(96)
 70729  	defer tls.Free(96)
 70730  
 70731  	var rc int32 = SQLITE_OK
 70732  	// var isInstall int32 at bp+56, 4
 70733  
 70734  	*(*sqlite3_mutex_methods)(unsafe.Pointer(bp + 60 /* counter_methods */)) = sqlite3_mutex_methods{
 70735  		FxMutexInit: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{counterMutexInit})),
 70736  		FxMutexEnd:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{counterMutexEnd})),
 70737  		FxMutexAlloc: *(*uintptr)(unsafe.Pointer(&struct {
 70738  			f func(*libc.TLS, int32) uintptr
 70739  		}{counterMutexAlloc})),
 70740  		FxMutexFree:  *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexFree})),
 70741  		FxMutexEnter: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexEnter})),
 70742  		FxMutexTry: *(*uintptr)(unsafe.Pointer(&struct {
 70743  			f func(*libc.TLS, uintptr) int32
 70744  		}{counterMutexTry})),
 70745  		FxMutexLeave: *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{counterMutexLeave})),
 70746  		FxMutexHeld: *(*uintptr)(unsafe.Pointer(&struct {
 70747  			f func(*libc.TLS, uintptr) int32
 70748  		}{counterMutexHeld})),
 70749  		FxMutexNotheld: *(*uintptr)(unsafe.Pointer(&struct {
 70750  			f func(*libc.TLS, uintptr) int32
 70751  		}{counterMutexNotheld})),
 70752  	}
 70753  
 70754  	if objc != 2 {
 70755  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+18677 /* "BOOLEAN" */)
 70756  		return TCL_ERROR
 70757  	}
 70758  	if TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+56 /* &isInstall */) {
 70759  		return TCL_ERROR
 70760  	}
 70761  
 70762  	if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) == g3.FisInstalled {
 70763  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35308 /* "mutex counters a..." */, 0))
 70764  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, func() uintptr {
 70765  			if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) != 0 {
 70766  				return ts + 35328 /* "already installe..." */
 70767  			}
 70768  			return ts + 35346 /* "not installed" */
 70769  		}(), 0))
 70770  		return TCL_ERROR
 70771  	}
 70772  
 70773  	if *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */)) != 0 {
 70774  
 70775  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETMUTEX, libc.VaList(bp+32, (uintptr(unsafe.Pointer(&g3))+16 /* &.m */)))
 70776  		if rc == SQLITE_OK {
 70777  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+40, bp+60 /* &counter_methods */))
 70778  		}
 70779  		g3.FdisableTry = 0
 70780  	} else {
 70781  
 70782  		rc = sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_MUTEX, libc.VaList(bp+48, (uintptr(unsafe.Pointer(&g3))+16 /* &.m */)))
 70783  		libc.Xmemset(tls, (uintptr(unsafe.Pointer(&g3)) + 16 /* &.m */), 0, uint32(unsafe.Sizeof(sqlite3_mutex_methods{})))
 70784  	}
 70785  
 70786  	if rc == SQLITE_OK {
 70787  		g3.FisInstalled = *(*int32)(unsafe.Pointer(bp + 56 /* isInstall */))
 70788  	}
 70789  
 70790  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 70791  	return TCL_OK
 70792  }
 70793  
 70794  // read_mutex_counters
 70795  func test_read_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:262:26: */
 70796  	var pRet uintptr
 70797  	var ii int32
 70798  
 70799  	if objc != 1 {
 70800  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 70801  		return TCL_ERROR
 70802  	}
 70803  
 70804  	pRet = tcl.XTcl_NewObj(tls)
 70805  	(*Tcl_Obj)(unsafe.Pointer(pRet)).FrefCount++
 70806  	for ii = 0; ii < (SQLITE_MUTEX_STATIC_VFS3 + 1); ii++ {
 70807  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewStringObj(tls, aName[ii], -1))
 70808  		tcl.XTcl_ListObjAppendElement(tls, interp, pRet, tcl.XTcl_NewIntObj(tls, *(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 52 /* &.aCounter */) + uintptr(ii)*4))))
 70809  	}
 70810  	tcl.XTcl_SetObjResult(tls, interp, pRet)
 70811  	for ok := true; ok; ok = 0 != 0 {
 70812  		var _objPtr uintptr = pRet
 70813  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 70814  			tcl.XTclFreeObj(tls, _objPtr)
 70815  		}
 70816  	}
 70817  
 70818  	return TCL_OK
 70819  }
 70820  
 70821  // clear_mutex_counters
 70822  func test_clear_mutex_counters(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:291:26: */
 70823  	var ii int32
 70824  
 70825  	if objc != 1 {
 70826  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 70827  		return TCL_ERROR
 70828  	}
 70829  
 70830  	for ii = 0; ii < (SQLITE_MUTEX_STATIC_VFS3 + 1); ii++ {
 70831  		*(*int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&g3)) + 52 /* &.aCounter */) + uintptr(ii)*4)) = 0
 70832  	}
 70833  	return TCL_OK
 70834  }
 70835  
 70836  // Create and free a mutex.  Return the mutex pointer.  The pointer
 70837  // will be invalid since the mutex has already been freed.  The
 70838  // return pointer just checks to see if the mutex really was allocated.
 70839  func test_alloc_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:315:26: */
 70840  	bp := tls.Alloc(124)
 70841  	defer tls.Free(124)
 70842  
 70843  	var p uintptr = sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST)
 70844  	// var zBuf [100]int8 at bp+24, 100
 70845  
 70846  	sqlite3.Xsqlite3_mutex_free(tls, p)
 70847  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([100]int8{})), bp+24 /* &zBuf[0] */, ts+13802 /* "%p" */, libc.VaList(bp, p))
 70848  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+8, bp+24 /* &zBuf[0] */, uintptr(0)))
 70849  	return TCL_OK
 70850  }
 70851  
 70852  // sqlite3_config OPTION
 70853  //
 70854  // OPTION can be either one of the keywords:
 70855  //
 70856  //            SQLITE_CONFIG_SINGLETHREAD
 70857  //            SQLITE_CONFIG_MULTITHREAD
 70858  //            SQLITE_CONFIG_SERIALIZED
 70859  //
 70860  // Or OPTION can be an raw integer.
 70861  func test_config(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:342:26: */
 70862  	bp := tls.Alloc(36)
 70863  	defer tls.Free(36)
 70864  
 70865  	*(*[4]ConfigOption)(unsafe.Pointer(bp /* aOpt */)) = [4]ConfigOption{
 70866  		{FzName: ts + 35360 /* "singlethread" */, FiValue: SQLITE_CONFIG_SINGLETHREAD},
 70867  		{FzName: ts + 35373 /* "multithread" */, FiValue: SQLITE_CONFIG_MULTITHREAD},
 70868  		{FzName: ts + 35385 /* "serialized" */, FiValue: SQLITE_CONFIG_SERIALIZED},
 70869  		{},
 70870  	}
 70871  	var s int32 = int32(unsafe.Sizeof(ConfigOption{}))
 70872  	// var i int32 at bp+32, 4
 70873  
 70874  	var rc int32
 70875  
 70876  	if objc != 2 {
 70877  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 70878  		return TCL_ERROR
 70879  	}
 70880  
 70881  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &aOpt[0] */, s, ts+17985 /* "flag" */, 0, bp+32 /* &i */) != 0 {
 70882  		if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+32 /* &i */) != 0 {
 70883  			return TCL_ERROR
 70884  		}
 70885  	} else {
 70886  		*(*int32)(unsafe.Pointer(bp + 32 /* i */)) = (*ConfigOption)(unsafe.Pointer(bp /* &aOpt */ + uintptr(*(*int32)(unsafe.Pointer(bp + 32 /* i */)))*8)).FiValue
 70887  	}
 70888  
 70889  	rc = sqlite3.Xsqlite3_config(tls, *(*int32)(unsafe.Pointer(bp + 32 /* i */)), 0)
 70890  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(1))
 70891  	return TCL_OK
 70892  }
 70893  
 70894  type ConfigOption = struct {
 70895  	FzName  uintptr
 70896  	FiValue int32
 70897  } /* test_mutex.c:348:3 */
 70898  
 70899  func getDbPointer1(tls *libc.TLS, pInterp uintptr, pObj uintptr) uintptr { /* test_mutex.c:379:16: */
 70900  	bp := tls.Alloc(32)
 70901  	defer tls.Free(32)
 70902  
 70903  	var db uintptr
 70904  	// var info Tcl_CmdInfo at bp, 32
 70905  
 70906  	var zCmd uintptr = tcl.XTcl_GetString(tls, pObj)
 70907  	if tcl.XTcl_GetCommandInfo(tls, pInterp, zCmd, bp /* &info */) != 0 {
 70908  		db = *(*uintptr)(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp /* &info */)).FobjClientData))
 70909  	} else {
 70910  		db = sqlite3TestTextToPtr(tls, zCmd)
 70911  	}
 70912  
 70913  	return db
 70914  }
 70915  
 70916  func getStaticMutexPointer(tls *libc.TLS, pInterp uintptr, pObj uintptr) uintptr { /* test_mutex.c:392:22: */
 70917  	bp := tls.Alloc(4)
 70918  	defer tls.Free(4)
 70919  
 70920  	// var iMutex int32 at bp, 4
 70921  
 70922  	if tcl.XTcl_GetIndexFromObjStruct(tls, pInterp, pObj, uintptr(unsafe.Pointer(&aName)), int32(unsafe.Sizeof(uintptr(0))), ts+35396 /* "mutex name" */, 0, bp /* &iMutex */) != 0 {
 70923  		return uintptr(0)
 70924  	}
 70925  
 70926  	return counterMutexAlloc(tls, *(*int32)(unsafe.Pointer(bp /* iMutex */)))
 70927  }
 70928  
 70929  func test_enter_static_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:404:26: */
 70930  	var pMutex uintptr
 70931  	if objc != 2 {
 70932  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 70933  		return TCL_ERROR
 70934  	}
 70935  	pMutex = getStaticMutexPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 70936  	if !(pMutex != 0) {
 70937  		return TCL_ERROR
 70938  	}
 70939  	sqlite3.Xsqlite3_mutex_enter(tls, pMutex)
 70940  	return TCL_OK
 70941  }
 70942  
 70943  func test_leave_static_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:423:26: */
 70944  	var pMutex uintptr
 70945  	if objc != 2 {
 70946  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+10397 /* "NAME" */)
 70947  		return TCL_ERROR
 70948  	}
 70949  	pMutex = getStaticMutexPointer(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 70950  	if !(pMutex != 0) {
 70951  		return TCL_ERROR
 70952  	}
 70953  	sqlite3.Xsqlite3_mutex_leave(tls, pMutex)
 70954  	return TCL_OK
 70955  }
 70956  
 70957  func test_enter_db_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:442:26: */
 70958  	var db uintptr
 70959  	if objc != 2 {
 70960  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 70961  		return TCL_ERROR
 70962  	}
 70963  	db = getDbPointer1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 70964  	if !(db != 0) {
 70965  		return TCL_ERROR
 70966  	}
 70967  	sqlite3.Xsqlite3_mutex_enter(tls, sqlite3.Xsqlite3_db_mutex(tls, db))
 70968  	return TCL_OK
 70969  }
 70970  
 70971  func test_leave_db_mutex(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_mutex.c:461:26: */
 70972  	var db uintptr
 70973  	if objc != 2 {
 70974  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 70975  		return TCL_ERROR
 70976  	}
 70977  	db = getDbPointer1(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 70978  	if !(db != 0) {
 70979  		return TCL_ERROR
 70980  	}
 70981  	sqlite3.Xsqlite3_mutex_leave(tls, sqlite3.Xsqlite3_db_mutex(tls, db))
 70982  	return TCL_OK
 70983  }
 70984  
 70985  func Sqlitetest_mutex_Init(tls *libc.TLS, interp uintptr) int32 { /* test_mutex.c:480:5: */
 70986  	var i int32
 70987  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd8)) / uint32(unsafe.Sizeof(struct {
 70988  		FzName uintptr
 70989  		FxProc uintptr
 70990  	}{}))); i++ {
 70991  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd8[i].FzName, aCmd8[i].FxProc, uintptr(0), uintptr(0))
 70992  	}
 70993  
 70994  	tcl.XTcl_LinkVar(tls, interp, ts+35407, /* "disable_mutex_in..." */
 70995  		(uintptr(unsafe.Pointer(&g3)) + 4 /* &.disableInit */), TCL_LINK_INT)
 70996  	tcl.XTcl_LinkVar(tls, interp, ts+35426, /* "disable_mutex_tr..." */
 70997  		(uintptr(unsafe.Pointer(&g3)) + 8 /* &.disableTry */), TCL_LINK_INT)
 70998  	return SQLITE_OK
 70999  }
 71000  
 71001  var aCmd8 = [11]struct {
 71002  	FzName uintptr
 71003  	FxProc uintptr
 71004  }{
 71005  	{FzName: ts + 35444 /* "sqlite3_shutdown" */, FxProc: 0},
 71006  	{FzName: ts + 35461 /* "sqlite3_initiali..." */, FxProc: 0},
 71007  	{FzName: ts + 35480 /* "sqlite3_config" */, FxProc: 0},
 71008  
 71009  	{FzName: ts + 35495 /* "enter_static_mut..." */, FxProc: 0},
 71010  	{FzName: ts + 35514 /* "leave_static_mut..." */, FxProc: 0},
 71011  
 71012  	{FzName: ts + 35533 /* "enter_db_mutex" */, FxProc: 0},
 71013  	{FzName: ts + 35548 /* "leave_db_mutex" */, FxProc: 0},
 71014  
 71015  	{FzName: ts + 35563 /* "alloc_dealloc_mu..." */, FxProc: 0},
 71016  	{FzName: ts + 35583 /* "install_mutex_co..." */, FxProc: 0},
 71017  	{FzName: ts + 35606 /* "read_mutex_count..." */, FxProc: 0},
 71018  	{FzName: ts + 35626 /* "clear_mutex_coun..." */, FxProc: 0},
 71019  } /* test_mutex.c:484:5 */
 71020  
 71021  // Maximum pathname length supported by the fs backend.
 71022  
 71023  // Name used to identify this VFS.
 71024  
 71025  type fs_real_file1 = struct {
 71026  	FpFile     uintptr
 71027  	FzName     uintptr
 71028  	FnDatabase int32
 71029  	FnJournal  int32
 71030  	FnBlob     int32
 71031  	FnRef      int32
 71032  	FpNext     uintptr
 71033  	FppThis    uintptr
 71034  } /* test_onefile.c:97:9 */
 71035  
 71036  // Maximum pathname length supported by the fs backend.
 71037  
 71038  // Name used to identify this VFS.
 71039  
 71040  type fs_real_file = fs_real_file1 /* test_onefile.c:97:29 */
 71041  
 71042  type fs_file1 = struct {
 71043  	Fbase  sqlite3_file
 71044  	FeType int32
 71045  	FpReal uintptr
 71046  } /* test_onefile.c:109:9 */
 71047  
 71048  type fs_file = fs_file1 /* test_onefile.c:109:24 */
 71049  
 71050  type tmp_file1 = struct {
 71051  	Fbase   sqlite3_file
 71052  	FnSize  int32
 71053  	FnAlloc int32
 71054  	FzAlloc uintptr
 71055  } /* test_onefile.c:116:9 */
 71056  
 71057  type tmp_file = tmp_file1 /* test_onefile.c:116:25 */
 71058  
 71059  type fs_vfs_t1 = struct {
 71060  	Fbase      sqlite3_vfs
 71061  	FpFileList uintptr
 71062  	FpParent   uintptr
 71063  } /* test_onefile.c:176:9 */
 71064  
 71065  type fs_vfs_t = fs_vfs_t1 /* test_onefile.c:176:25 */
 71066  
 71067  var fs_vfs = fs_vfs_t{
 71068  	Fbase: sqlite3_vfs{
 71069  		FiVersion:      1,          // pNext
 71070  		FzName:         ts + 31250, /* "fs" */ // pAppData
 71071  		FxOpen:         0,          // xOpen
 71072  		FxDelete:       0,          // xDelete
 71073  		FxAccess:       0,          // xAccess
 71074  		FxFullPathname: 0,          // xFullPathname
 71075  		FxDlOpen:       0,          // xDlOpen
 71076  		FxDlError:      0,          // xDlError
 71077  		FxDlSym:        0,          // xDlSym
 71078  		FxDlClose:      0,          // xDlClose
 71079  		FxRandomness:   0,          // xRandomness
 71080  		FxSleep:        0,          // xSleep
 71081  		FxCurrentTime:  0,          // xCurrentTimeInt64
 71082  	}, // pParent
 71083  } /* test_onefile.c:183:17 */
 71084  
 71085  var fs_io_methods = sqlite3_io_methods{
 71086  	FiVersion:               1, // iVersion
 71087  	FxClose:                 0, // xClose
 71088  	FxRead:                  0, // xRead
 71089  	FxWrite:                 0, // xWrite
 71090  	FxTruncate:              0, // xTruncate
 71091  	FxSync:                  0, // xSync
 71092  	FxFileSize:              0, // xFileSize
 71093  	FxLock:                  0, // xLock
 71094  	FxUnlock:                0, // xUnlock
 71095  	FxCheckReservedLock:     0, // xCheckReservedLock
 71096  	FxFileControl:           0, // xFileControl
 71097  	FxSectorSize:            0, // xSectorSize
 71098  	FxDeviceCharacteristics: 0, // xShmUnmap
 71099  } /* test_onefile.c:208:27 */
 71100  
 71101  var tmp_io_methods = sqlite3_io_methods{
 71102  	FiVersion:               1, // iVersion
 71103  	FxClose:                 0, // xClose
 71104  	FxRead:                  0, // xRead
 71105  	FxWrite:                 0, // xWrite
 71106  	FxTruncate:              0, // xTruncate
 71107  	FxSync:                  0, // xSync
 71108  	FxFileSize:              0, // xFileSize
 71109  	FxLock:                  0, // xLock
 71110  	FxUnlock:                0, // xUnlock
 71111  	FxCheckReservedLock:     0, // xCheckReservedLock
 71112  	FxFileControl:           0, // xFileControl
 71113  	FxSectorSize:            0, // xSectorSize
 71114  	FxDeviceCharacteristics: 0, // xShmUnmap
 71115  } /* test_onefile.c:229:27 */
 71116  
 71117  // Useful macros used in several places
 71118  
 71119  // Close a tmp-file.
 71120  func tmpClose(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:257:12: */
 71121  	var pTmp uintptr = pFile
 71122  	sqlite3.Xsqlite3_free(tls, (*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc)
 71123  	return SQLITE_OK
 71124  }
 71125  
 71126  // Read data from a tmp-file.
 71127  func tmpRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:266:12: */
 71128  	var pTmp uintptr = pFile
 71129  	if (sqlite_int64(iAmt) + iOfst) > sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize) {
 71130  		return (SQLITE_IOERR | (int32(2) << 8))
 71131  	}
 71132  	libc.Xmemcpy(tls, zBuf, ((*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc + uintptr(iOfst)), uint32(iAmt))
 71133  	return SQLITE_OK
 71134  }
 71135  
 71136  // Write data to a tmp-file.
 71137  func tmpWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:283:12: */
 71138  	var pTmp uintptr = pFile
 71139  	if (sqlite_int64(iAmt) + iOfst) > sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc) {
 71140  		var nNew int32 = (int32(int64(2) * ((sqlite_int64(iAmt) + iOfst) + sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc))))
 71141  		var zNew uintptr = sqlite3.Xsqlite3_realloc(tls, (*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc, nNew)
 71142  		if !(zNew != 0) {
 71143  			return SQLITE_NOMEM
 71144  		}
 71145  		(*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc = zNew
 71146  		(*tmp_file)(unsafe.Pointer(pTmp)).FnAlloc = nNew
 71147  	}
 71148  	libc.Xmemcpy(tls, ((*tmp_file)(unsafe.Pointer(pTmp)).FzAlloc + uintptr(iOfst)), zBuf, uint32(iAmt))
 71149  	(*tmp_file)(unsafe.Pointer(pTmp)).FnSize = func() int32 {
 71150  		if (sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)) > (iOfst + sqlite_int64(iAmt)) {
 71151  			return (*tmp_file)(unsafe.Pointer(pTmp)).FnSize
 71152  		}
 71153  		return (int32(iOfst + sqlite_int64(iAmt)))
 71154  	}()
 71155  	return SQLITE_OK
 71156  }
 71157  
 71158  // Truncate a tmp-file.
 71159  func tmpTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_onefile.c:307:12: */
 71160  	var pTmp uintptr = pFile
 71161  	(*tmp_file)(unsafe.Pointer(pTmp)).FnSize = func() int32 {
 71162  		if (sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)) < (size) {
 71163  			return (*tmp_file)(unsafe.Pointer(pTmp)).FnSize
 71164  		}
 71165  		return int32(size)
 71166  	}()
 71167  	return SQLITE_OK
 71168  }
 71169  
 71170  // Sync a tmp-file.
 71171  func tmpSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_onefile.c:316:12: */
 71172  	return SQLITE_OK
 71173  }
 71174  
 71175  // Return the current file-size of a tmp-file.
 71176  func tmpFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_onefile.c:323:12: */
 71177  	var pTmp uintptr = pFile
 71178  	*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*tmp_file)(unsafe.Pointer(pTmp)).FnSize)
 71179  	return SQLITE_OK
 71180  }
 71181  
 71182  // Lock a tmp-file.
 71183  func tmpLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:332:12: */
 71184  	return SQLITE_OK
 71185  }
 71186  
 71187  // Unlock a tmp-file.
 71188  func tmpUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:339:12: */
 71189  	return SQLITE_OK
 71190  }
 71191  
 71192  // Check if another file-handle holds a RESERVED lock on a tmp-file.
 71193  func tmpCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_onefile.c:346:12: */
 71194  	*(*int32)(unsafe.Pointer(pResOut)) = 0
 71195  	return SQLITE_OK
 71196  }
 71197  
 71198  // File control method. For custom operations on a tmp-file.
 71199  func tmpFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_onefile.c:354:12: */
 71200  	return SQLITE_OK
 71201  }
 71202  
 71203  // Return the sector-size in bytes for a tmp-file.
 71204  func tmpSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:361:12: */
 71205  	return 0
 71206  }
 71207  
 71208  // Return the device characteristic flags supported by a tmp-file.
 71209  func tmpDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:368:12: */
 71210  	return 0
 71211  }
 71212  
 71213  // Close an fs-file.
 71214  func fsClose1(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:375:12: */
 71215  	var rc int32 = SQLITE_OK
 71216  	var p uintptr = pFile
 71217  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71218  
 71219  	// Decrement the real_file ref-count.
 71220  	(*fs_real_file)(unsafe.Pointer(pReal)).FnRef--
 71221  
 71222  	// When the ref-count reaches 0, destroy the structure
 71223  	if (*fs_real_file)(unsafe.Pointer(pReal)).FnRef == 0 {
 71224  		*(*uintptr)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FppThis)) = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext
 71225  		if (*fs_real_file)(unsafe.Pointer(pReal)).FpNext != 0 {
 71226  			(*fs_real_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpNext)).FppThis = (*fs_real_file)(unsafe.Pointer(pReal)).FppThis
 71227  		}
 71228  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods + 4 /* &.xClose */))))(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile)
 71229  		sqlite3.Xsqlite3_free(tls, pReal)
 71230  	}
 71231  
 71232  	return rc
 71233  }
 71234  
 71235  // Read data from an fs-file.
 71236  func fsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:400:12: */
 71237  	var rc int32 = SQLITE_OK
 71238  	var p uintptr = pFile
 71239  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71240  	var pF uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 71241  
 71242  	if (((*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE) && ((sqlite_int64(iAmt) + iOfst) > sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase))) ||
 71243  		(((*fs_file)(unsafe.Pointer(p)).FeType == JOURNAL_FILE) && ((sqlite_int64(iAmt) + iOfst) > sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal))) {
 71244  		rc = (SQLITE_IOERR | (int32(2) << 8))
 71245  	} else if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 71246  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 8 /* &.xRead */))))(tls, pF, zBuf, iAmt, (iOfst + int64(BLOCKSIZE)))
 71247  	} else {
 71248  		// Journal file.
 71249  		var iRem int32 = iAmt
 71250  		var iBuf int32 = 0
 71251  		var ii int32 = int32(iOfst)
 71252  		for (iRem > 0) && (rc == SQLITE_OK) {
 71253  			var iRealOff int32 = (((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (BLOCKSIZE * ((ii / BLOCKSIZE) + 1))) + (ii % BLOCKSIZE))
 71254  			var iRealAmt int32 = func() int32 {
 71255  				if (iRem) < (BLOCKSIZE - (iRealOff % BLOCKSIZE)) {
 71256  					return iRem
 71257  				}
 71258  				return (BLOCKSIZE - (iRealOff % BLOCKSIZE))
 71259  			}()
 71260  
 71261  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 8 /* &.xRead */))))(tls, pF, ((zBuf) + uintptr(iBuf)), iRealAmt, int64(iRealOff))
 71262  			ii = ii + (iRealAmt)
 71263  			iBuf = iBuf + (iRealAmt)
 71264  			iRem = iRem - (iRealAmt)
 71265  		}
 71266  	}
 71267  
 71268  	return rc
 71269  }
 71270  
 71271  // Write data to an fs-file.
 71272  func fsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_onefile.c:439:12: */
 71273  	var rc int32 = SQLITE_OK
 71274  	var p uintptr = pFile
 71275  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71276  	var pF uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 71277  
 71278  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 71279  		if ((sqlite_int64(iAmt) + iOfst) + int64(BLOCKSIZE)) > (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) {
 71280  			rc = SQLITE_FULL
 71281  		} else {
 71282  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 12 /* &.xWrite */))))(tls, pF, zBuf, iAmt, (iOfst + int64(BLOCKSIZE)))
 71283  			if rc == SQLITE_OK {
 71284  				(*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase = func() int32 {
 71285  					if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)) > (sqlite_int64(iAmt) + iOfst) {
 71286  						return (*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase
 71287  					}
 71288  					return (int32(sqlite_int64(iAmt) + iOfst))
 71289  				}()
 71290  			}
 71291  		}
 71292  	} else {
 71293  		// Journal file.
 71294  		var iRem int32 = iAmt
 71295  		var iBuf int32 = 0
 71296  		var ii int32 = int32(iOfst)
 71297  		for (iRem > 0) && (rc == SQLITE_OK) {
 71298  			var iRealOff int32 = (((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - (BLOCKSIZE * ((ii / BLOCKSIZE) + 1))) + (ii % BLOCKSIZE))
 71299  			var iRealAmt int32 = func() int32 {
 71300  				if (iRem) < (BLOCKSIZE - (iRealOff % BLOCKSIZE)) {
 71301  					return iRem
 71302  				}
 71303  				return (BLOCKSIZE - (iRealOff % BLOCKSIZE))
 71304  			}()
 71305  
 71306  			if iRealOff < ((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase + BLOCKSIZE) {
 71307  				rc = SQLITE_FULL
 71308  			} else {
 71309  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 12 /* &.xWrite */))))(tls, pF, ((zBuf) + uintptr(iBuf)), iRealAmt, int64(iRealOff))
 71310  				ii = ii + (iRealAmt)
 71311  				iBuf = iBuf + (iRealAmt)
 71312  				iRem = iRem - (iRealAmt)
 71313  			}
 71314  		}
 71315  		if rc == SQLITE_OK {
 71316  			(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = func() int32 {
 71317  				if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) > (sqlite_int64(iAmt) + iOfst) {
 71318  					return (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal
 71319  				}
 71320  				return (int32(sqlite_int64(iAmt) + iOfst))
 71321  			}()
 71322  		}
 71323  	}
 71324  
 71325  	return rc
 71326  }
 71327  
 71328  // Truncate an fs-file.
 71329  func fsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_onefile.c:488:12: */
 71330  	var p uintptr = pFile
 71331  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71332  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 71333  		(*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase = func() int32 {
 71334  			if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)) < (size) {
 71335  				return (*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase
 71336  			}
 71337  			return int32(size)
 71338  		}()
 71339  	} else {
 71340  		(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = func() int32 {
 71341  			if (sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)) < (size) {
 71342  				return (*fs_real_file)(unsafe.Pointer(pReal)).FnJournal
 71343  			}
 71344  			return int32(size)
 71345  		}()
 71346  	}
 71347  	return SQLITE_OK
 71348  }
 71349  
 71350  // Sync an fs-file.
 71351  func fsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_onefile.c:502:12: */
 71352  	bp := tls.Alloc(4)
 71353  	defer tls.Free(4)
 71354  
 71355  	var p uintptr = pFile
 71356  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71357  	var pRealFile uintptr = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 71358  	var rc int32 = SQLITE_OK
 71359  
 71360  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 71361  		// var zSize [4]uint8 at bp, 4
 71362  
 71363  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */)) = (uint8((uint32((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase) & 0xFF000000) >> 24))
 71364  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 1)) = (uint8(((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x00FF0000) >> 16))
 71365  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 2)) = (uint8(((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x0000FF00) >> 8))
 71366  		*(*uint8)(unsafe.Pointer(bp /* &zSize[0] */ + 3)) = (uint8((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase & 0x000000FF))
 71367  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 12 /* &.xWrite */))))(tls, pRealFile, bp /* &zSize[0] */, 4, int64(0))
 71368  	}
 71369  	if rc == SQLITE_OK {
 71370  		rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 20 /* &.xSync */))))(tls, pRealFile, (flags & (libc.CplInt32(SQLITE_SYNC_DATAONLY))))
 71371  	}
 71372  
 71373  	return rc
 71374  }
 71375  
 71376  // Return the current file-size of an fs-file.
 71377  func fsFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_onefile.c:526:12: */
 71378  	var p uintptr = pFile
 71379  	var pReal uintptr = (*fs_file)(unsafe.Pointer(p)).FpReal
 71380  	if (*fs_file)(unsafe.Pointer(p)).FeType == DATABASE_FILE {
 71381  		*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnDatabase)
 71382  	} else {
 71383  		*(*sqlite_int64)(unsafe.Pointer(pSize)) = sqlite_int64((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal)
 71384  	}
 71385  	return SQLITE_OK
 71386  }
 71387  
 71388  // Lock an fs-file.
 71389  func fsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:540:12: */
 71390  	return SQLITE_OK
 71391  }
 71392  
 71393  // Unlock an fs-file.
 71394  func fsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_onefile.c:547:12: */
 71395  	return SQLITE_OK
 71396  }
 71397  
 71398  // Check if another file-handle holds a RESERVED lock on an fs-file.
 71399  func fsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_onefile.c:554:12: */
 71400  	*(*int32)(unsafe.Pointer(pResOut)) = 0
 71401  	return SQLITE_OK
 71402  }
 71403  
 71404  // File control method. For custom operations on an fs-file.
 71405  func fsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_onefile.c:562:12: */
 71406  	if op == SQLITE_FCNTL_PRAGMA {
 71407  		return SQLITE_NOTFOUND
 71408  	}
 71409  	return SQLITE_OK
 71410  }
 71411  
 71412  // Return the sector-size in bytes for an fs-file.
 71413  func fsSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:570:12: */
 71414  	return BLOCKSIZE
 71415  }
 71416  
 71417  // Return the device characteristic flags supported by an fs-file.
 71418  func fsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_onefile.c:577:12: */
 71419  	return 0
 71420  }
 71421  
 71422  // Open an fs file handle.
 71423  func fsOpen1(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_onefile.c:584:12: */
 71424  	bp := tls.Alloc(12)
 71425  	defer tls.Free(12)
 71426  
 71427  	var pFsVfs uintptr
 71428  	var p uintptr
 71429  	var pReal uintptr
 71430  	var eType int32
 71431  	var nName int32
 71432  	var rc int32
 71433  	var p2 uintptr
 71434  	// var zS [4]uint8 at bp+8, 4
 71435  
 71436  	var real_flags int32
 71437  	// var size sqlite3_int64 at bp, 8
 71438  
 71439  	var pRealFile uintptr
 71440  	var pParent uintptr
 71441  	pFsVfs = pVfs
 71442  	p = pFile
 71443  	pReal = uintptr(0)
 71444  	rc = SQLITE_OK
 71445  
 71446  	if !(0 == (flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_MAIN_JOURNAL))) {
 71447  		goto __1
 71448  	}
 71449  	p2 = pFile
 71450  	libc.Xmemset(tls, p2, 0, uint32(unsafe.Sizeof(tmp_file{})))
 71451  	(*tmp_file)(unsafe.Pointer(p2)).Fbase.FpMethods = uintptr(unsafe.Pointer(&tmp_io_methods))
 71452  	return SQLITE_OK
 71453  __1:
 71454  	;
 71455  
 71456  	eType = func() int32 {
 71457  		if (flags & (SQLITE_OPEN_MAIN_DB)) != 0 {
 71458  			return DATABASE_FILE
 71459  		}
 71460  		return JOURNAL_FILE
 71461  	}()
 71462  	(*fs_file)(unsafe.Pointer(p)).Fbase.FpMethods = uintptr(unsafe.Pointer(&fs_io_methods))
 71463  	(*fs_file)(unsafe.Pointer(p)).FeType = eType
 71464  
 71465  	nName = (int32(libc.Xstrlen(tls, zName)) - (func() int32 {
 71466  		if eType == JOURNAL_FILE {
 71467  			return 8
 71468  		}
 71469  		return 0
 71470  	}()))
 71471  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 71472  __2:
 71473  	if !((pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zName, uint32(nName)) != 0)) {
 71474  		goto __4
 71475  	}
 71476  	goto __3
 71477  __3:
 71478  	pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext
 71479  	goto __2
 71480  	goto __4
 71481  __4:
 71482  	;
 71483  
 71484  	if !(!(pReal != 0)) {
 71485  		goto __5
 71486  	}
 71487  	real_flags = ((flags & libc.CplInt32(SQLITE_OPEN_MAIN_DB)) | SQLITE_OPEN_TEMP_DB)
 71488  	pParent = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpParent
 71489  
 71490  	pReal = sqlite3.Xsqlite3_malloc(tls, (int32(uint32(unsafe.Sizeof(fs_real_file{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile))))
 71491  	if !(!(pReal != 0)) {
 71492  		goto __6
 71493  	}
 71494  	rc = SQLITE_NOMEM
 71495  	goto open_out
 71496  __6:
 71497  	;
 71498  	libc.Xmemset(tls, pReal, 0, (uint32(unsafe.Sizeof(fs_real_file{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)))
 71499  	(*fs_real_file)(unsafe.Pointer(pReal)).FzName = zName
 71500  	(*fs_real_file)(unsafe.Pointer(pReal)).FpFile = (pReal + 1*32)
 71501  
 71502  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 24 /* &.xOpen */))))(tls, pParent, zName, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile, real_flags, pOutFlags)
 71503  	if !(rc != SQLITE_OK) {
 71504  		goto __7
 71505  	}
 71506  	goto open_out
 71507  __7:
 71508  	;
 71509  	pRealFile = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 71510  
 71511  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 24 /* &.xFileSize */))))(tls, pRealFile, bp /* &size */)
 71512  	if !(rc != SQLITE_OK) {
 71513  		goto __8
 71514  	}
 71515  	goto open_out
 71516  __8:
 71517  	;
 71518  	if !(*(*sqlite3_int64)(unsafe.Pointer(bp /* size */)) == int64(0)) {
 71519  		goto __9
 71520  	}
 71521  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 12 /* &.xWrite */))))(tls, pRealFile, ts+35647 /* "\x00" */, 1, (int64(BLOBSIZE - 1)))
 71522  	(*fs_real_file)(unsafe.Pointer(pReal)).FnBlob = BLOBSIZE
 71523  	goto __10
 71524  __9:
 71525  	(*fs_real_file)(unsafe.Pointer(pReal)).FnBlob = int32(*(*sqlite3_int64)(unsafe.Pointer(bp /* size */)))
 71526  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 8 /* &.xRead */))))(tls, pRealFile, bp+8 /* &zS[0] */, 4, int64(0))
 71527  	(*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))))
 71528  	if !(rc == SQLITE_OK) {
 71529  		goto __11
 71530  	}
 71531  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pRealFile)).FpMethods + 8 /* &.xRead */))))(tls, pRealFile, bp+8 /* &zS[0] */, 4, (int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - 4)))
 71532  	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)) {
 71533  		goto __12
 71534  	}
 71535  	(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = (*fs_real_file)(unsafe.Pointer(pReal)).FnBlob
 71536  __12:
 71537  	;
 71538  __11:
 71539  	;
 71540  __10:
 71541  	;
 71542  
 71543  	if !(rc == SQLITE_OK) {
 71544  		goto __13
 71545  	}
 71546  	(*fs_real_file)(unsafe.Pointer(pReal)).FpNext = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 71547  	if !((*fs_real_file)(unsafe.Pointer(pReal)).FpNext != 0) {
 71548  		goto __14
 71549  	}
 71550  	(*fs_real_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpNext)).FppThis = (pReal + 24 /* &.pNext */)
 71551  __14:
 71552  	;
 71553  	(*fs_real_file)(unsafe.Pointer(pReal)).FppThis = (pFsVfs + 88 /* &.pFileList */)
 71554  	(*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList = pReal
 71555  __13:
 71556  	;
 71557  __5:
 71558  	;
 71559  
 71560  open_out:
 71561  	if !(pReal != 0) {
 71562  		goto __15
 71563  	}
 71564  	if !(rc == SQLITE_OK) {
 71565  		goto __16
 71566  	}
 71567  	(*fs_file)(unsafe.Pointer(p)).FpReal = pReal
 71568  	(*fs_real_file)(unsafe.Pointer(pReal)).FnRef++
 71569  	goto __17
 71570  __16:
 71571  	if !((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods != 0) {
 71572  		goto __18
 71573  	}
 71574  	(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*fs_real_file)(unsafe.Pointer(pReal)).FpFile)).FpMethods + 4 /* &.xClose */))))(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FpFile)
 71575  __18:
 71576  	;
 71577  	sqlite3.Xsqlite3_free(tls, pReal)
 71578  __17:
 71579  	;
 71580  __15:
 71581  	;
 71582  	return rc
 71583  }
 71584  
 71585  // Delete the file located at zPath. If the dirSync argument is true,
 71586  // ensure the file-system modifications are synced to disk before
 71587  // returning.
 71588  func fsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_onefile.c:686:12: */
 71589  	var rc int32 = SQLITE_OK
 71590  	var pFsVfs uintptr = pVfs
 71591  	var pReal uintptr
 71592  	var pF uintptr
 71593  	var nName int32 = (int32(libc.Xstrlen(tls, zPath)) - 8)
 71594  
 71595  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 71596  	for ; (pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zPath, uint32(nName)) != 0); pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext {
 71597  	}
 71598  	if pReal != 0 {
 71599  		pF = (*fs_real_file)(unsafe.Pointer(pReal)).FpFile
 71600  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pF)).FpMethods + 12 /* &.xWrite */))))(tls, pF, ts+35649 /* "\x00\x00\x00\x00" */, 4, (int64((*fs_real_file)(unsafe.Pointer(pReal)).FnBlob - BLOCKSIZE)))
 71601  		if rc == SQLITE_OK {
 71602  			(*fs_real_file)(unsafe.Pointer(pReal)).FnJournal = 0
 71603  		}
 71604  	}
 71605  	return rc
 71606  }
 71607  
 71608  // Test for access permissions. Return true if the requested permission
 71609  // is available, or false otherwise.
 71610  func fsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_onefile.c:712:12: */
 71611  	var pFsVfs uintptr = pVfs
 71612  	var pReal uintptr
 71613  	var isJournal int32 = 0
 71614  	var nName int32 = int32(libc.Xstrlen(tls, zPath))
 71615  
 71616  	if flags != SQLITE_ACCESS_EXISTS {
 71617  		var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71618  		return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 32 /* &.xAccess */))))(tls, pParent, zPath, flags, pResOut)
 71619  	}
 71620  
 71621  	if (nName > 8) && (libc.Xstrcmp(tls, ts+33006 /* "-journal" */, (zPath+uintptr((nName-8)))) == 0) {
 71622  		nName = nName - (8)
 71623  		isJournal = 1
 71624  	}
 71625  
 71626  	pReal = (*fs_vfs_t)(unsafe.Pointer(pFsVfs)).FpFileList
 71627  	for ; (pReal != 0) && (libc.Xstrncmp(tls, (*fs_real_file)(unsafe.Pointer(pReal)).FzName, zPath, uint32(nName)) != 0); pReal = (*fs_real_file)(unsafe.Pointer(pReal)).FpNext {
 71628  	}
 71629  
 71630  	*(*int32)(unsafe.Pointer(pResOut)) = (libc.Bool32((pReal != 0) && (!(isJournal != 0) || ((*fs_real_file)(unsafe.Pointer(pReal)).FnJournal > 0))))
 71631  	return SQLITE_OK
 71632  }
 71633  
 71634  // Populate buffer zOut with the full canonical pathname corresponding
 71635  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 71636  // of at least (FS_MAX_PATHNAME+1) bytes.
 71637  func fsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_onefile.c:746:12: */
 71638  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71639  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 36 /* &.xFullPathname */))))(tls, pParent, zPath, nOut, zOut)
 71640  }
 71641  
 71642  // Open the dynamic library located at zPath and return a handle.
 71643  func fsDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_onefile.c:759:13: */
 71644  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71645  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pParent + 40 /* &.xDlOpen */))))(tls, pParent, zPath)
 71646  }
 71647  
 71648  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 71649  // utf-8 string describing the most recent error encountered associated
 71650  // with dynamic libraries.
 71651  func fsDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_onefile.c:769:13: */
 71652  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71653  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer((pParent + 44 /* &.xDlError */))))(tls, pParent, nByte, zErrMsg)
 71654  }
 71655  
 71656  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 71657  func fsDlSym(tls *libc.TLS, pVfs uintptr, pH uintptr, zSym uintptr) uintptr { /* test_onefile.c:777:13: */
 71658  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71659  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer((pParent + 48 /* &.xDlSym */))))(tls, pParent, pH, zSym)
 71660  }
 71661  
 71662  // Close the dynamic library handle pHandle.
 71663  func fsDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_onefile.c:785:13: */
 71664  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71665  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer((pParent + 52 /* &.xDlClose */))))(tls, pParent, pHandle)
 71666  }
 71667  
 71668  // Populate the buffer pointed to by zBufOut with nByte bytes of
 71669  // random data.
 71670  func fsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_onefile.c:794:12: */
 71671  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71672  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 56 /* &.xRandomness */))))(tls, pParent, nByte, zBufOut)
 71673  }
 71674  
 71675  // Sleep for nMicro microseconds. Return the number of microseconds
 71676  // actually slept.
 71677  func fsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_onefile.c:803:12: */
 71678  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71679  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((pParent + 60 /* &.xSleep */))))(tls, pParent, nMicro)
 71680  }
 71681  
 71682  // Return the current time as a Julian Day number in *pTimeOut.
 71683  func fsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_onefile.c:811:12: */
 71684  	var pParent uintptr = (*fs_vfs_t)(unsafe.Pointer(pVfs)).FpParent
 71685  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((pParent + 64 /* &.xCurrentTime */))))(tls, pParent, pTimeOut)
 71686  }
 71687  
 71688  // This procedure registers the fs vfs with SQLite. If the argument is
 71689  // true, the fs vfs becomes the new default vfs. It is the only publicly
 71690  // available function in this file.
 71691  func fs_register(tls *libc.TLS) int32 { /* test_onefile.c:821:5: */
 71692  	if fs_vfs.FpParent != 0 {
 71693  		return SQLITE_OK
 71694  	}
 71695  	fs_vfs.FpParent = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 71696  	fs_vfs.Fbase.FmxPathname = (*sqlite3_vfs)(unsafe.Pointer(fs_vfs.FpParent)).FmxPathname
 71697  	fs_vfs.Fbase.FszOsFile = func() int32 {
 71698  		if (uint32(unsafe.Sizeof(tmp_file{}))) > (uint32(unsafe.Sizeof(fs_file{}))) {
 71699  			return int32(unsafe.Sizeof(tmp_file{}))
 71700  		}
 71701  		return int32(unsafe.Sizeof(fs_file{}))
 71702  	}()
 71703  	return sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&fs_vfs)) /* &.base */), 0)
 71704  }
 71705  
 71706  func SqlitetestOnefile_Init(tls *libc.TLS) int32 { /* test_onefile.c:830:7: */
 71707  	return fs_register(tls)
 71708  }
 71709  
 71710  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 71711  //    This file is part of the GNU C Library.
 71712  //
 71713  //    The GNU C Library is free software; you can redistribute it and/or
 71714  //    modify it under the terms of the GNU Lesser General Public
 71715  //    License as published by the Free Software Foundation; either
 71716  //    version 2.1 of the License, or (at your option) any later version.
 71717  //
 71718  //    The GNU C Library is distributed in the hope that it will be useful,
 71719  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 71720  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 71721  //    Lesser General Public License for more details.
 71722  //
 71723  //    You should have received a copy of the GNU Lesser General Public
 71724  //    License along with the GNU C Library; if not, see
 71725  //    <http://www.gnu.org/licenses/>.
 71726  
 71727  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 71728  
 71729  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 71730  //    This file is part of the GNU C Library.
 71731  //
 71732  //    The GNU C Library is free software; you can redistribute it and/or
 71733  //    modify it under the terms of the GNU Lesser General Public
 71734  //    License as published by the Free Software Foundation; either
 71735  //    version 2.1 of the License, or (at your option) any later version.
 71736  //
 71737  //    The GNU C Library is distributed in the hope that it will be useful,
 71738  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 71739  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 71740  //    Lesser General Public License for more details.
 71741  //
 71742  //    You should have received a copy of the GNU Lesser General Public
 71743  //    License along with the GNU C Library; if not, see
 71744  //    <http://www.gnu.org/licenses/>.
 71745  
 71746  // void assert (int expression);
 71747  //
 71748  //    If NDEBUG is defined, do nothing.
 71749  //    If not, and EXPRESSION is zero, print an error message and abort.
 71750  
 71751  // void assert_perror (int errnum);
 71752  //
 71753  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 71754  //    error message with the error text for ERRNUM and abort.
 71755  //    (This is a GNU extension.)
 71756  
 71757  // Maximum pathname length supported by the vfslog backend.
 71758  
 71759  type VfslogVfs1 = struct {
 71760  	Fbase        sqlite3_vfs
 71761  	FpVfs        uintptr
 71762  	FiNextFileId int32
 71763  	FpLog        uintptr
 71764  	_            [4]byte
 71765  	FiOffset     sqlite3_int64
 71766  	FnBuf        int32
 71767  	FaBuf        [8192]int8
 71768  	_            [4]byte
 71769  } /* test_osinst.c:117:9 */
 71770  
 71771  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 71772  //    This file is part of the GNU C Library.
 71773  //
 71774  //    The GNU C Library is free software; you can redistribute it and/or
 71775  //    modify it under the terms of the GNU Lesser General Public
 71776  //    License as published by the Free Software Foundation; either
 71777  //    version 2.1 of the License, or (at your option) any later version.
 71778  //
 71779  //    The GNU C Library is distributed in the hope that it will be useful,
 71780  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 71781  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 71782  //    Lesser General Public License for more details.
 71783  //
 71784  //    You should have received a copy of the GNU Lesser General Public
 71785  //    License along with the GNU C Library; if not, see
 71786  //    <http://www.gnu.org/licenses/>.
 71787  
 71788  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 71789  
 71790  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 71791  //    This file is part of the GNU C Library.
 71792  //
 71793  //    The GNU C Library is free software; you can redistribute it and/or
 71794  //    modify it under the terms of the GNU Lesser General Public
 71795  //    License as published by the Free Software Foundation; either
 71796  //    version 2.1 of the License, or (at your option) any later version.
 71797  //
 71798  //    The GNU C Library is distributed in the hope that it will be useful,
 71799  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 71800  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 71801  //    Lesser General Public License for more details.
 71802  //
 71803  //    You should have received a copy of the GNU Lesser General Public
 71804  //    License along with the GNU C Library; if not, see
 71805  //    <http://www.gnu.org/licenses/>.
 71806  
 71807  // void assert (int expression);
 71808  //
 71809  //    If NDEBUG is defined, do nothing.
 71810  //    If not, and EXPRESSION is zero, print an error message and abort.
 71811  
 71812  // void assert_perror (int errnum);
 71813  //
 71814  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 71815  //    error message with the error text for ERRNUM and abort.
 71816  //    (This is a GNU extension.)
 71817  
 71818  // Maximum pathname length supported by the vfslog backend.
 71819  
 71820  type VfslogVfs = VfslogVfs1 /* test_osinst.c:117:26 */
 71821  type VfslogFile1 = struct {
 71822  	Fbase    sqlite3_file
 71823  	FpReal   uintptr
 71824  	FpVfslog uintptr
 71825  	FiFileId int32
 71826  } /* test_osinst.c:118:9 */
 71827  
 71828  type VfslogFile = VfslogFile1 /* test_osinst.c:118:27 */
 71829  
 71830  var vfslog_vfs = sqlite3_vfs{
 71831  	FiVersion:          1,                                  // iVersion
 71832  	FszOsFile:          int32(unsafe.Sizeof(VfslogFile{})), // szOsFile
 71833  	FmxPathname:        INST_MAX_PATHNAME,                  // pAppData
 71834  	FxOpen:             0,                                  // xOpen
 71835  	FxDelete:           0,                                  // xDelete
 71836  	FxAccess:           0,                                  // xAccess
 71837  	FxFullPathname:     0,                                  // xFullPathname
 71838  	FxDlOpen:           0,                                  // xDlOpen
 71839  	FxDlError:          0,                                  // xDlError
 71840  	FxDlSym:            0,                                  // xDlSym
 71841  	FxDlClose:          0,                                  // xDlClose
 71842  	FxRandomness:       0,                                  // xRandomness
 71843  	FxSleep:            0,                                  // xSleep
 71844  	FxCurrentTime:      0,                                  // xCurrentTime
 71845  	FxGetLastError:     0,                                  // xGetLastError
 71846  	FxCurrentTimeInt64: 0,                                  // xCurrentTime
 71847  } /* test_osinst.c:180:20 */
 71848  
 71849  var vfslog_io_methods = sqlite3_io_methods{
 71850  	FiVersion:               2, // iVersion
 71851  	FxClose:                 0, // xClose
 71852  	FxRead:                  0, // xRead
 71853  	FxWrite:                 0, // xWrite
 71854  	FxTruncate:              0, // xTruncate
 71855  	FxSync:                  0, // xSync
 71856  	FxFileSize:              0, // xFileSize
 71857  	FxLock:                  0, // xLock
 71858  	FxUnlock:                0, // xUnlock
 71859  	FxCheckReservedLock:     0, // xCheckReservedLock
 71860  	FxFileControl:           0, // xFileControl
 71861  	FxSectorSize:            0, // xSectorSize
 71862  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 71863  	FxShmMap:                0, // xShmMap
 71864  	FxShmLock:               0, // xShmLock
 71865  	FxShmBarrier:            0, // xShmBarrier
 71866  	FxShmUnmap:              0, // xShmUnmap
 71867  } /* test_osinst.c:202:27 */
 71868  
 71869  // Convenience macros for operations on timevals.
 71870  //    NOTE: `timercmp' does not work for >= or <=.
 71871  
 71872  func vfslog_time(tls *libc.TLS) sqlite3_uint64 { /* test_osinst.c:224:23: */
 71873  	bp := tls.Alloc(8)
 71874  	defer tls.Free(8)
 71875  
 71876  	// var sTime timeval at bp, 8
 71877  
 71878  	libc.Xgettimeofday(tls, bp /* &sTime */, uintptr(0))
 71879  	return (sqlite3_uint64((*timeval)(unsafe.Pointer(bp /* &sTime */)).Ftv_usec) + (sqlite3_uint64((*timeval)(unsafe.Pointer(bp /* &sTime */)).Ftv_sec) * uint64(1000000)))
 71880  }
 71881  
 71882  // Close an vfslog-file.
 71883  func vfslogClose(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:256:12: */
 71884  	var t sqlite3_uint64
 71885  	var rc int32 = SQLITE_OK
 71886  	var p uintptr = pFile
 71887  
 71888  	t = vfslog_time(tls)
 71889  	if (*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods != 0 {
 71890  		rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 4 /* &.xClose */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 71891  	}
 71892  	t = (vfslog_time(tls) - t)
 71893  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_CLOSE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 71894  	return rc
 71895  }
 71896  
 71897  // Read data from an vfslog-file.
 71898  func vfslogRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_osinst.c:273:12: */
 71899  	var rc int32
 71900  	var t sqlite3_uint64
 71901  	var p uintptr = pFile
 71902  	t = vfslog_time(tls)
 71903  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 8 /* &.xRead */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, zBuf, iAmt, iOfst)
 71904  	t = (vfslog_time(tls) - t)
 71905  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_READ, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, iAmt, int32(iOfst))
 71906  	return rc
 71907  }
 71908  
 71909  // Write data to an vfslog-file.
 71910  func vfslogWrite(tls *libc.TLS, pFile uintptr, z uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_osinst.c:292:12: */
 71911  	var rc int32
 71912  	var t sqlite3_uint64
 71913  	var p uintptr = pFile
 71914  	t = vfslog_time(tls)
 71915  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 12 /* &.xWrite */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, z, iAmt, iOfst)
 71916  	t = (vfslog_time(tls) - t)
 71917  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_WRITE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, iAmt, int32(iOfst))
 71918  	return rc
 71919  }
 71920  
 71921  // Truncate an vfslog-file.
 71922  func vfslogTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_osinst.c:311:12: */
 71923  	var rc int32
 71924  	var t sqlite3_uint64
 71925  	var p uintptr = pFile
 71926  	t = vfslog_time(tls)
 71927  	rc = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 16 /* &.xTruncate */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, size)
 71928  	t = (vfslog_time(tls) - t)
 71929  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_TRUNCATE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, int32(size))
 71930  	return rc
 71931  }
 71932  
 71933  // Sync an vfslog-file.
 71934  func vfslogSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_osinst.c:325:12: */
 71935  	var rc int32
 71936  	var t sqlite3_uint64
 71937  	var p uintptr = pFile
 71938  	t = vfslog_time(tls)
 71939  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 20 /* &.xSync */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, flags)
 71940  	t = (vfslog_time(tls) - t)
 71941  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SYNC, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, flags, 0)
 71942  	return rc
 71943  }
 71944  
 71945  // Return the current file-size of an vfslog-file.
 71946  func vfslogFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_osinst.c:339:12: */
 71947  	var rc int32
 71948  	var t sqlite3_uint64
 71949  	var p uintptr = pFile
 71950  	t = vfslog_time(tls)
 71951  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 24 /* &.xFileSize */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, pSize)
 71952  	t = (vfslog_time(tls) - t)
 71953  	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))))
 71954  	return rc
 71955  }
 71956  
 71957  // Lock an vfslog-file.
 71958  func vfslogLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_osinst.c:353:12: */
 71959  	var rc int32
 71960  	var t sqlite3_uint64
 71961  	var p uintptr = pFile
 71962  	t = vfslog_time(tls)
 71963  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 28 /* &.xLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, eLock)
 71964  	t = (vfslog_time(tls) - t)
 71965  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_LOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, eLock, 0)
 71966  	return rc
 71967  }
 71968  
 71969  // Unlock an vfslog-file.
 71970  func vfslogUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_osinst.c:367:12: */
 71971  	var rc int32
 71972  	var t sqlite3_uint64
 71973  	var p uintptr = pFile
 71974  	t = vfslog_time(tls)
 71975  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 32 /* &.xUnlock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, eLock)
 71976  	t = (vfslog_time(tls) - t)
 71977  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_UNLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, eLock, 0)
 71978  	return rc
 71979  }
 71980  
 71981  // Check if another file-handle holds a RESERVED lock on an vfslog-file.
 71982  func vfslogCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_osinst.c:381:12: */
 71983  	var rc int32
 71984  	var t sqlite3_uint64
 71985  	var p uintptr = pFile
 71986  	t = vfslog_time(tls)
 71987  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 36 /* &.xCheckReservedLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, pResOut)
 71988  	t = (vfslog_time(tls) - t)
 71989  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_CHECKRESERVEDLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, *(*int32)(unsafe.Pointer(pResOut)), 0)
 71990  	return rc
 71991  }
 71992  
 71993  // File control method. For custom operations on an vfslog-file.
 71994  func vfslogFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_osinst.c:395:12: */
 71995  	bp := tls.Alloc(8)
 71996  	defer tls.Free(8)
 71997  
 71998  	var p uintptr = pFile
 71999  	var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 40 /* &.xFileControl */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, op, pArg)
 72000  	if (op == SQLITE_FCNTL_VFSNAME) && (rc == SQLITE_OK) {
 72001  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+35654 /* "vfslog/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 72002  	}
 72003  	return rc
 72004  }
 72005  
 72006  // Return the sector-size in bytes for an vfslog-file.
 72007  func vfslogSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:407:12: */
 72008  	var rc int32
 72009  	var t sqlite3_uint64
 72010  	var p uintptr = pFile
 72011  	t = vfslog_time(tls)
 72012  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 44 /* &.xSectorSize */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 72013  	t = (vfslog_time(tls) - t)
 72014  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SECTORSIZE, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72015  	return rc
 72016  }
 72017  
 72018  // Return the device characteristic flags supported by an vfslog-file.
 72019  func vfslogDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_osinst.c:421:12: */
 72020  	var rc int32
 72021  	var t sqlite3_uint64
 72022  	var p uintptr = pFile
 72023  	t = vfslog_time(tls)
 72024  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 72025  	t = (vfslog_time(tls) - t)
 72026  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_DEVCHAR, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72027  	return rc
 72028  }
 72029  
 72030  func vfslogShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_osinst.c:432:12: */
 72031  	var rc int32
 72032  	var t sqlite3_uint64
 72033  	var p uintptr = pFile
 72034  	t = vfslog_time(tls)
 72035  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 56 /* &.xShmLock */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, ofst, n, flags)
 72036  	t = (vfslog_time(tls) - t)
 72037  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMLOCK, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72038  	return rc
 72039  }
 72040  
 72041  func vfslogShmMap(tls *libc.TLS, pFile uintptr, iRegion int32, szRegion int32, isWrite int32, pp uintptr) int32 { /* test_osinst.c:442:12: */
 72042  	var rc int32
 72043  	var t sqlite3_uint64
 72044  	var p uintptr = pFile
 72045  	t = vfslog_time(tls)
 72046  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 52 /* &.xShmMap */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, iRegion, szRegion, isWrite, libc.AtomicLoadUintptr(&pp))
 72047  	t = (vfslog_time(tls) - t)
 72048  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMMAP, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72049  	return rc
 72050  }
 72051  
 72052  func vfslogShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_osinst.c:458:13: */
 72053  	var t sqlite3_uint64
 72054  	var p uintptr = pFile
 72055  	t = vfslog_time(tls)
 72056  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 60 /* &.xShmBarrier */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal)
 72057  	t = (vfslog_time(tls) - t)
 72058  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMBARRIER, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), SQLITE_OK, 0, 0)
 72059  }
 72060  
 72061  func vfslogShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* test_osinst.c:466:12: */
 72062  	var rc int32
 72063  	var t sqlite3_uint64
 72064  	var p uintptr = pFile
 72065  	t = vfslog_time(tls)
 72066  	rc = (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogFile)(unsafe.Pointer(p)).FpReal)).FpMethods + 64 /* &.xShmUnmap */))))(tls, (*VfslogFile)(unsafe.Pointer(p)).FpReal, deleteFlag)
 72067  	t = (vfslog_time(tls) - t)
 72068  	vfslog_call(tls, (*VfslogFile)(unsafe.Pointer(p)).FpVfslog, OS_SHMUNMAP, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72069  	return rc
 72070  }
 72071  
 72072  // Open an vfslog file handle.
 72073  func vfslogOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_osinst.c:481:12: */
 72074  	var rc int32
 72075  	var t sqlite3_uint64
 72076  	var p uintptr = pFile
 72077  	var pLog uintptr = pVfs
 72078  
 72079  	(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = uintptr(unsafe.Pointer(&vfslog_io_methods))
 72080  	(*VfslogFile)(unsafe.Pointer(p)).FpReal = (p + 1*16)
 72081  	(*VfslogFile)(unsafe.Pointer(p)).FpVfslog = pVfs
 72082  	(*VfslogFile)(unsafe.Pointer(p)).FiFileId = libc.PreIncInt32(&(*VfslogVfs)(unsafe.Pointer(pLog)).FiNextFileId, 1)
 72083  
 72084  	t = vfslog_time(tls)
 72085  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 24 /* &.xOpen */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zName, (*VfslogFile)(unsafe.Pointer(p)).FpReal, flags, pOutFlags)
 72086  	t = (vfslog_time(tls) - t)
 72087  
 72088  	vfslog_call(tls, pVfs, OS_OPEN, (*VfslogFile)(unsafe.Pointer(p)).FiFileId, int64(t), rc, 0, 0)
 72089  	vfslog_string(tls, pVfs, zName)
 72090  	return rc
 72091  }
 72092  
 72093  // Delete the file located at zPath. If the dirSync argument is true,
 72094  // ensure the file-system modifications are synced to disk before
 72095  // returning.
 72096  func vfslogDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_osinst.c:512:12: */
 72097  	var rc int32
 72098  	var t sqlite3_uint64
 72099  	t = vfslog_time(tls)
 72100  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 28 /* &.xDelete */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, dirSync)
 72101  	t = (vfslog_time(tls) - t)
 72102  	vfslog_call(tls, pVfs, OS_DELETE, 0, int64(t), rc, dirSync, 0)
 72103  	vfslog_string(tls, pVfs, zPath)
 72104  	return rc
 72105  }
 72106  
 72107  // Test for access permissions. Return true if the requested permission
 72108  // is available, or false otherwise.
 72109  func vfslogAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_osinst.c:527:12: */
 72110  	var rc int32
 72111  	var t sqlite3_uint64
 72112  	t = vfslog_time(tls)
 72113  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 32 /* &.xAccess */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, flags, pResOut)
 72114  	t = (vfslog_time(tls) - t)
 72115  	vfslog_call(tls, pVfs, OS_ACCESS, 0, int64(t), rc, flags, *(*int32)(unsafe.Pointer(pResOut)))
 72116  	vfslog_string(tls, pVfs, zPath)
 72117  	return rc
 72118  }
 72119  
 72120  // Populate buffer zOut with the full canonical pathname corresponding
 72121  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 72122  // of at least (INST_MAX_PATHNAME+1) bytes.
 72123  func vfslogFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_osinst.c:548:12: */
 72124  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 36 /* &.xFullPathname */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath, nOut, zOut)
 72125  }
 72126  
 72127  // Open the dynamic library located at zPath and return a handle.
 72128  func vfslogDlOpen(tls *libc.TLS, pVfs uintptr, zPath uintptr) uintptr { /* test_osinst.c:560:13: */
 72129  	return (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 40 /* &.xDlOpen */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, zPath)
 72130  }
 72131  
 72132  // Populate the buffer zErrMsg (size nByte bytes) with a human readable
 72133  // utf-8 string describing the most recent error encountered associated
 72134  // with dynamic libraries.
 72135  func vfslogDlError(tls *libc.TLS, pVfs uintptr, nByte int32, zErrMsg uintptr) { /* test_osinst.c:569:13: */
 72136  	(*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 44 /* &.xDlError */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nByte, zErrMsg)
 72137  }
 72138  
 72139  // Return a pointer to the symbol zSymbol in the dynamic library pHandle.
 72140  func vfslogDlSym(tls *libc.TLS, pVfs uintptr, p uintptr, zSym uintptr) uintptr { /* test_osinst.c:576:13: */
 72141  	return (*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 48 /* &.xDlSym */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, p, zSym)
 72142  }
 72143  
 72144  // Close the dynamic library handle pHandle.
 72145  func vfslogDlClose(tls *libc.TLS, pVfs uintptr, pHandle uintptr) { /* test_osinst.c:583:13: */
 72146  	(*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 52 /* &.xDlClose */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, pHandle)
 72147  }
 72148  
 72149  // Populate the buffer pointed to by zBufOut with nByte bytes of
 72150  // random data.
 72151  func vfslogRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_osinst.c:591:12: */
 72152  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 56 /* &.xRandomness */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nByte, zBufOut)
 72153  }
 72154  
 72155  // Sleep for nMicro microseconds. Return the number of microseconds
 72156  // actually slept.
 72157  func vfslogSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_osinst.c:599:12: */
 72158  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 60 /* &.xSleep */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, nMicro)
 72159  }
 72160  
 72161  // Return the current time as a Julian Day number in *pTimeOut.
 72162  func vfslogCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_osinst.c:606:12: */
 72163  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 64 /* &.xCurrentTime */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, pTimeOut)
 72164  }
 72165  
 72166  func vfslogGetLastError(tls *libc.TLS, pVfs uintptr, a int32, b uintptr) int32 { /* test_osinst.c:610:12: */
 72167  	return (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 68 /* &.xGetLastError */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, a, b)
 72168  }
 72169  
 72170  func vfslogCurrentTimeInt64(tls *libc.TLS, pVfs uintptr, p uintptr) int32 { /* test_osinst.c:613:12: */
 72171  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs + 72 /* &.xCurrentTimeInt64 */))))(tls, (*VfslogVfs)(unsafe.Pointer(pVfs)).FpVfs, p)
 72172  }
 72173  
 72174  func vfslog_flush(tls *libc.TLS, p uintptr) { /* test_osinst.c:617:13: */
 72175  
 72176  	var pending int32 = libc.AtomicLoadInt32(&sqlite3.Xsqlite3_io_error_pending)
 72177  	var persist int32 = sqlite3.Xsqlite3_io_error_persist
 72178  	var diskfull int32 = sqlite3.Xsqlite3_diskfull_pending
 72179  
 72180  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(0))
 72181  	sqlite3.Xsqlite3_io_error_persist = 0
 72182  	sqlite3.Xsqlite3_diskfull_pending = 0
 72183  
 72184  	if (*VfslogVfs)(unsafe.Pointer(p)).FnBuf != 0 {
 72185  		(*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods + 12 /* &.xWrite */))))(tls, (*VfslogVfs)(unsafe.Pointer(p)).FpLog, p+116 /* &.aBuf */, (*VfslogVfs)(unsafe.Pointer(p)).FnBuf, (*VfslogVfs)(unsafe.Pointer(p)).FiOffset)
 72186  		*(*sqlite3_int64)(unsafe.Pointer(p + 104 /* &.iOffset */)) += (sqlite3_int64((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 72187  		(*VfslogVfs)(unsafe.Pointer(p)).FnBuf = 0
 72188  	}
 72189  
 72190  	libc.AtomicStoreInt32(&sqlite3.Xsqlite3_io_error_pending, int32(pending))
 72191  	sqlite3.Xsqlite3_io_error_persist = persist
 72192  	sqlite3.Xsqlite3_diskfull_pending = diskfull
 72193  }
 72194  
 72195  func put32bits(tls *libc.TLS, p uintptr, v uint32) { /* test_osinst.c:645:13: */
 72196  	*(*uint8)(unsafe.Pointer(p)) = (uint8(v >> 24))
 72197  	*(*uint8)(unsafe.Pointer(p + 1)) = (uint8(v >> 16))
 72198  	*(*uint8)(unsafe.Pointer(p + 2)) = (uint8(v >> 8))
 72199  	*(*uint8)(unsafe.Pointer(p + 3)) = uint8(v)
 72200  }
 72201  
 72202  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: */
 72203  	var p uintptr = pVfs
 72204  	var zRec uintptr
 72205  	if (uint32(24 + (*VfslogVfs)(unsafe.Pointer(p)).FnBuf)) > uint32(unsafe.Sizeof([8192]int8{})) {
 72206  		vfslog_flush(tls, p)
 72207  	}
 72208  	zRec = ((p + 116 /* &.aBuf */) + uintptr((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 72209  	put32bits(tls, (zRec), uint32(eEvent))
 72210  	put32bits(tls, (zRec + 4), uint32(iFileid))
 72211  	put32bits(tls, (zRec + 8), (uint32(nClick & int64(0xffff))))
 72212  	put32bits(tls, (zRec + 12), uint32(return_code))
 72213  	put32bits(tls, (zRec + 16), uint32(size))
 72214  	put32bits(tls, (zRec + 20), uint32(offset))
 72215  	*(*int32)(unsafe.Pointer(p + 112 /* &.nBuf */)) += (24)
 72216  }
 72217  
 72218  func vfslog_string(tls *libc.TLS, pVfs uintptr, zStr uintptr) { /* test_osinst.c:676:13: */
 72219  	var p uintptr = pVfs
 72220  	var zRec uintptr
 72221  	var nStr int32
 72222  	if zStr != 0 {
 72223  		nStr = int32(libc.Xstrlen(tls, zStr))
 72224  	} else {
 72225  		nStr = 0
 72226  	}
 72227  	if (uint32((4 + nStr) + (*VfslogVfs)(unsafe.Pointer(p)).FnBuf)) > uint32(unsafe.Sizeof([8192]int8{})) {
 72228  		vfslog_flush(tls, p)
 72229  	}
 72230  	zRec = ((p + 116 /* &.aBuf */) + uintptr((*VfslogVfs)(unsafe.Pointer(p)).FnBuf))
 72231  	put32bits(tls, (zRec), uint32(nStr))
 72232  	if zStr != 0 {
 72233  		libc.Xmemcpy(tls, (zRec + 4), zStr, uint32(nStr))
 72234  	}
 72235  	*(*int32)(unsafe.Pointer(p + 112 /* &.nBuf */)) += (4 + nStr)
 72236  }
 72237  
 72238  func vfslog_finalize(tls *libc.TLS, p uintptr) { /* test_osinst.c:691:13: */
 72239  	if (*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods != 0 {
 72240  		vfslog_flush(tls, p)
 72241  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVfs)(unsafe.Pointer(p)).FpLog)).FpMethods + 4 /* &.xClose */))))(tls, (*VfslogVfs)(unsafe.Pointer(p)).FpLog)
 72242  	}
 72243  	sqlite3.Xsqlite3_free(tls, p)
 72244  }
 72245  
 72246  func sqlite3_vfslog_finalize(tls *libc.TLS, zVfs uintptr) int32 { /* test_osinst.c:699:5: */
 72247  	var pVfs uintptr
 72248  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, zVfs)
 72249  	if !(pVfs != 0) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != *(*uintptr)(unsafe.Pointer(&struct {
 72250  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 72251  	}{vfslogOpen}))) {
 72252  		return SQLITE_ERROR
 72253  	}
 72254  	sqlite3.Xsqlite3_vfs_unregister(tls, pVfs)
 72255  	vfslog_finalize(tls, pVfs)
 72256  	return SQLITE_OK
 72257  }
 72258  
 72259  func sqlite3_vfslog_new(tls *libc.TLS, zVfs uintptr, zParentVfs uintptr, zLog uintptr) int32 { /* test_osinst.c:710:5: */
 72260  	bp := tls.Alloc(4)
 72261  	defer tls.Free(4)
 72262  
 72263  	var p uintptr
 72264  	var pParent uintptr
 72265  	var nByte int32
 72266  	// var flags int32 at bp, 4
 72267  
 72268  	var rc int32
 72269  	var zFile uintptr
 72270  	var nVfs int32
 72271  
 72272  	pParent = sqlite3.Xsqlite3_vfs_find(tls, zParentVfs)
 72273  	if !(pParent != 0) {
 72274  		return SQLITE_ERROR
 72275  	}
 72276  
 72277  	nVfs = int32(libc.Xstrlen(tls, zVfs))
 72278  	nByte = (int32(((((uint32(unsafe.Sizeof(VfslogVfs{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)) + uint32(nVfs)) + uint32(1)) + uint32((*sqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname)) + uint32(1)))
 72279  	p = sqlite3.Xsqlite3_malloc(tls, nByte)
 72280  	libc.Xmemset(tls, p, 0, uint32(nByte))
 72281  
 72282  	(*VfslogVfs)(unsafe.Pointer(p)).FpVfs = pParent
 72283  	(*VfslogVfs)(unsafe.Pointer(p)).FpLog = (p + 1*8312)
 72284  	libc.Xmemcpy(tls, (p /* &.base */), uintptr(unsafe.Pointer(&vfslog_vfs)), uint32(unsafe.Sizeof(sqlite3_vfs{})))
 72285  	(*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName = (((*VfslogVfs)(unsafe.Pointer(p)).FpLog) + uintptr((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile))
 72286  	*(*int32)(unsafe.Pointer(p /* &.base */ + 4 /* &.szOsFile */)) += ((*sqlite3_vfs)(unsafe.Pointer(pParent)).FszOsFile)
 72287  	libc.Xmemcpy(tls, (*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName, zVfs, uint32(nVfs))
 72288  
 72289  	zFile = ((*VfslogVfs)(unsafe.Pointer(p)).Fbase.FzName + uintptr((nVfs + 1)))
 72290  	(*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 36 /* &.xFullPathname */))))(tls, pParent, zLog, (*sqlite3_vfs)(unsafe.Pointer(pParent)).FmxPathname, zFile)
 72291  
 72292  	*(*int32)(unsafe.Pointer(bp /* flags */)) = ((SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE) | SQLITE_OPEN_SUPER_JOURNAL)
 72293  	(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pParent + 28 /* &.xDelete */))))(tls, pParent, zFile, 0)
 72294  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pParent + 24 /* &.xOpen */))))(tls, pParent, zFile, (*VfslogVfs)(unsafe.Pointer(p)).FpLog, *(*int32)(unsafe.Pointer(bp /* flags */)), bp /* &flags */)
 72295  	if rc == SQLITE_OK {
 72296  		libc.Xmemcpy(tls, p+116 /* &.aBuf */, ts+35664 /* "sqlite_ostrace1...." */, uint32(20))
 72297  		(*VfslogVfs)(unsafe.Pointer(p)).FiOffset = int64(0)
 72298  		(*VfslogVfs)(unsafe.Pointer(p)).FnBuf = 20
 72299  		rc = sqlite3.Xsqlite3_vfs_register(tls, p, 1)
 72300  	}
 72301  	if rc != 0 {
 72302  		vfslog_finalize(tls, p)
 72303  	}
 72304  	return rc
 72305  }
 72306  
 72307  func sqlite3_vfslog_annotate(tls *libc.TLS, zVfs uintptr, zMsg uintptr) int32 { /* test_osinst.c:758:5: */
 72308  	var pVfs uintptr
 72309  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, zVfs)
 72310  	if !(pVfs != 0) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxOpen != *(*uintptr)(unsafe.Pointer(&struct {
 72311  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 72312  	}{vfslogOpen}))) {
 72313  		return SQLITE_ERROR
 72314  	}
 72315  	vfslog_call(tls, pVfs, OS_ANNOTATE, 0, int64(0), 0, 0, 0)
 72316  	vfslog_string(tls, pVfs, zMsg)
 72317  	return SQLITE_OK
 72318  }
 72319  
 72320  func vfslog_eventname(tls *libc.TLS, eEvent int32) uintptr { /* test_osinst.c:769:19: */
 72321  	var zEvent uintptr = uintptr(0)
 72322  
 72323  	switch eEvent {
 72324  	case OS_CLOSE:
 72325  		zEvent = ts + 35685 /* "xClose" */
 72326  		break
 72327  	case OS_READ:
 72328  		zEvent = ts + 35692 /* "xRead" */
 72329  		break
 72330  	case OS_WRITE:
 72331  		zEvent = ts + 35698 /* "xWrite" */
 72332  		break
 72333  	case OS_TRUNCATE:
 72334  		zEvent = ts + 35705 /* "xTruncate" */
 72335  		break
 72336  	case OS_SYNC:
 72337  		zEvent = ts + 28129 /* "xSync" */
 72338  		break
 72339  	case OS_FILESIZE:
 72340  		zEvent = ts + 35715 /* "xFilesize" */
 72341  		break
 72342  	case OS_LOCK:
 72343  		zEvent = ts + 35725 /* "xLock" */
 72344  		break
 72345  	case OS_UNLOCK:
 72346  		zEvent = ts + 35731 /* "xUnlock" */
 72347  		break
 72348  	case OS_CHECKRESERVEDLOCK:
 72349  		zEvent = ts + 35739 /* "xCheckResLock" */
 72350  		break
 72351  	case OS_FILECONTROL:
 72352  		zEvent = ts + 35753 /* "xFileControl" */
 72353  		break
 72354  	case OS_SECTORSIZE:
 72355  		zEvent = ts + 35766 /* "xSectorSize" */
 72356  		break
 72357  	case OS_DEVCHAR:
 72358  		zEvent = ts + 35778 /* "xDeviceChar" */
 72359  		break
 72360  	case OS_OPEN:
 72361  		zEvent = ts + 27701 /* "xOpen" */
 72362  		break
 72363  	case OS_DELETE:
 72364  		zEvent = ts + 35790 /* "xDelete" */
 72365  		break
 72366  	case OS_ACCESS:
 72367  		zEvent = ts + 35798 /* "xAccess" */
 72368  		break
 72369  	case OS_FULLPATHNAME:
 72370  		zEvent = ts + 35806 /* "xFullPathname" */
 72371  		break
 72372  	case OS_RANDOMNESS:
 72373  		zEvent = ts + 35820 /* "xRandomness" */
 72374  		break
 72375  	case OS_SLEEP:
 72376  		zEvent = ts + 35832 /* "xSleep" */
 72377  		break
 72378  	case OS_CURRENTTIME:
 72379  		zEvent = ts + 35839 /* "xCurrentTime" */
 72380  		break
 72381  
 72382  	case OS_SHMUNMAP:
 72383  		zEvent = ts + 35852 /* "xShmUnmap" */
 72384  		break
 72385  	case OS_SHMLOCK:
 72386  		zEvent = ts + 35862 /* "xShmLock" */
 72387  		break
 72388  	case OS_SHMBARRIER:
 72389  		zEvent = ts + 35871 /* "xShmBarrier" */
 72390  		break
 72391  	case OS_SHMMAP:
 72392  		zEvent = ts + 35883 /* "xShmMap" */
 72393  		break
 72394  
 72395  	case OS_ANNOTATE:
 72396  		zEvent = ts + 35891 /* "annotation" */
 72397  		break
 72398  	}
 72399  
 72400  	return zEvent
 72401  }
 72402  
 72403  type VfslogVtab1 = struct {
 72404  	Fbase  sqlite3_vtab
 72405  	FpFd   uintptr
 72406  	FnByte sqlite3_int64
 72407  	FzFile uintptr
 72408  	_      [4]byte
 72409  } /* test_osinst.c:804:9 */
 72410  
 72411  type VfslogVtab = VfslogVtab1 /* test_osinst.c:804:27 */
 72412  type VfslogCsr1 = struct {
 72413  	Fbase       sqlite3_vtab_cursor
 72414  	_           [4]byte
 72415  	FiRowid     sqlite3_int64
 72416  	FiOffset    sqlite3_int64
 72417  	FzTransient uintptr
 72418  	FnFile      int32
 72419  	FazFile     uintptr
 72420  	FaBuf       [1024]uint8
 72421  	_           [4]byte
 72422  } /* test_osinst.c:805:9 */
 72423  
 72424  type VfslogCsr = VfslogCsr1 /* test_osinst.c:805:26 */
 72425  
 72426  func get32bits(tls *libc.TLS, p uintptr) uint32 { /* test_osinst.c:830:21: */
 72427  	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)))))
 72428  }
 72429  
 72430  // The argument must point to a buffer containing a nul-terminated string.
 72431  // If the string begins with an SQL quote character it is overwritten by
 72432  // the dequoted version. Otherwise the buffer is left unmodified.
 72433  func dequote(tls *libc.TLS, z uintptr) { /* test_osinst.c:839:13: */
 72434  	var quote int8 // Quote character (if any )
 72435  	quote = *(*int8)(unsafe.Pointer(z))
 72436  	if (((int32(quote) == '[') || (int32(quote) == '\'')) || (int32(quote) == '"')) || (int32(quote) == '`') {
 72437  		var iIn int32 = 1  // Index of next byte to read from input
 72438  		var iOut int32 = 0 // Index of next byte to write to output
 72439  		if int32(quote) == '[' {
 72440  			quote = int8(']')
 72441  		}
 72442  		for *(*int8)(unsafe.Pointer(z + uintptr(iIn))) != 0 {
 72443  			if int32(*(*int8)(unsafe.Pointer(z + uintptr(iIn)))) == int32(quote) {
 72444  				if int32(*(*int8)(unsafe.Pointer(z + uintptr((iIn + 1))))) != int32(quote) {
 72445  					break
 72446  				}
 72447  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = quote
 72448  				iIn = iIn + (2)
 72449  			} else {
 72450  				*(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iOut, 1)))) = *(*int8)(unsafe.Pointer(z + uintptr(libc.PostIncInt32(&iIn, 1))))
 72451  			}
 72452  		}
 72453  		*(*int8)(unsafe.Pointer(z + uintptr(iOut))) = int8(0)
 72454  	}
 72455  }
 72456  
 72457  // Connect to or create a vfslog virtual table.
 72458  func vlogConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_osinst.c:863:12: */
 72459  	bp := tls.Alloc(12)
 72460  	defer tls.Free(12)
 72461  
 72462  	var pVfs uintptr // VFS used to read log file
 72463  	// var flags int32 at bp+8, 4
 72464  	// flags passed to pVfs->xOpen()
 72465  	var p uintptr
 72466  	var rc int32
 72467  	var nByte int32
 72468  	var zFile uintptr
 72469  
 72470  	*(*uintptr)(unsafe.Pointer(ppVtab)) = uintptr(0)
 72471  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 72472  	nByte = (int32((uint32(unsafe.Sizeof(VfslogVtab{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile)) + uint32((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname)))
 72473  	p = sqlite3.Xsqlite3_malloc(tls, nByte)
 72474  	if p == uintptr(0) {
 72475  		return SQLITE_NOMEM
 72476  	}
 72477  	libc.Xmemset(tls, p, 0, uint32(nByte))
 72478  
 72479  	(*VfslogVtab)(unsafe.Pointer(p)).FpFd = (p + 1*32)
 72480  	(*VfslogVtab)(unsafe.Pointer(p)).FzFile = (((*VfslogVtab)(unsafe.Pointer(p)).FpFd) + uintptr((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile))
 72481  
 72482  	zFile = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(argv + 3*4))))
 72483  	if !(zFile != 0) {
 72484  		sqlite3.Xsqlite3_free(tls, p)
 72485  		return SQLITE_NOMEM
 72486  	}
 72487  	dequote(tls, zFile)
 72488  	(*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 36 /* &.xFullPathname */))))(tls, pVfs, zFile, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname, (*VfslogVtab)(unsafe.Pointer(p)).FzFile)
 72489  	sqlite3.Xsqlite3_free(tls, zFile)
 72490  
 72491  	*(*int32)(unsafe.Pointer(bp + 8 /* flags */)) = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_SUPER_JOURNAL)
 72492  	rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pVfs + 24 /* &.xOpen */))))(tls, pVfs, (*VfslogVtab)(unsafe.Pointer(p)).FzFile, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, *(*int32)(unsafe.Pointer(bp + 8 /* flags */)), bp+8 /* &flags */)
 72493  
 72494  	if rc == SQLITE_OK {
 72495  		(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 24 /* &.xFileSize */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, (p + 16 /* &.nByte */))
 72496  		sqlite3.Xsqlite3_declare_vtab(tls, db,
 72497  			ts+35902 /* "CREATE TABLE xxx..." */)
 72498  		*(*uintptr)(unsafe.Pointer(ppVtab)) = (p /* &.base */)
 72499  	} else {
 72500  		sqlite3.Xsqlite3_free(tls, p)
 72501  	}
 72502  
 72503  	return rc
 72504  }
 72505  
 72506  // There is no "best-index". This virtual table always does a linear
 72507  // scan of the binary VFS log file.
 72508  func vlogBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_osinst.c:916:12: */
 72509  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FestimatedCost = 10.0
 72510  	return SQLITE_OK
 72511  }
 72512  
 72513  // Disconnect from or destroy a vfslog virtual table.
 72514  func vlogDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_osinst.c:924:12: */
 72515  	var p uintptr = pVtab
 72516  	if (*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods != 0 {
 72517  		(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 4 /* &.xClose */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd)
 72518  		(*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods = uintptr(0)
 72519  	}
 72520  	sqlite3.Xsqlite3_free(tls, p)
 72521  	return SQLITE_OK
 72522  }
 72523  
 72524  // Open a new vfslog cursor.
 72525  func vlogOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_osinst.c:937:12: */
 72526  	var pCsr uintptr // Newly allocated cursor object
 72527  
 72528  	pCsr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(VfslogCsr{})))
 72529  	if !(pCsr != 0) {
 72530  		return SQLITE_NOMEM
 72531  	}
 72532  	libc.Xmemset(tls, pCsr, 0, uint32(unsafe.Sizeof(VfslogCsr{})))
 72533  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCsr /* &.base */)
 72534  	return SQLITE_OK
 72535  }
 72536  
 72537  // Close a vfslog cursor.
 72538  func vlogClose(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:950:12: */
 72539  	var p uintptr = pCursor
 72540  	var i int32
 72541  	for i = 0; i < (*VfslogCsr)(unsafe.Pointer(p)).FnFile; i++ {
 72542  		sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(p)).FazFile + uintptr(i)*4)))
 72543  	}
 72544  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(p)).FazFile)
 72545  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(p)).FzTransient)
 72546  	sqlite3.Xsqlite3_free(tls, p)
 72547  	return SQLITE_OK
 72548  }
 72549  
 72550  // Move a vfslog cursor to the next entry in the file.
 72551  func vlogNext(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:965:12: */
 72552  	bp := tls.Alloc(4)
 72553  	defer tls.Free(4)
 72554  
 72555  	var pCsr uintptr = pCursor
 72556  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 72557  	var rc int32 = SQLITE_OK
 72558  	var nRead int32
 72559  
 72560  	sqlite3.Xsqlite3_free(tls, (*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient)
 72561  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient = uintptr(0)
 72562  
 72563  	nRead = 24
 72564  	if ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)) <= (*VfslogVtab)(unsafe.Pointer(p)).FnByte {
 72565  		var eEvent int32
 72566  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 8 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, pCsr+36 /* &.aBuf */, nRead, (*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset)
 72567  
 72568  		eEvent = int32(get32bits(tls, pCsr+36 /* &.aBuf */))
 72569  		if (rc == SQLITE_OK) &&
 72570  			(((eEvent == OS_OPEN) || (eEvent == OS_DELETE)) || (eEvent == OS_ACCESS)) {
 72571  			// var buf [4]int8 at bp, 4
 72572  
 72573  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 8 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, bp /* &buf[0] */, 4, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)))
 72574  			nRead = nRead + (4)
 72575  			if rc == SQLITE_OK {
 72576  				var nStr int32 = int32(get32bits(tls, bp /* buf */))
 72577  				var zStr uintptr = sqlite3.Xsqlite3_malloc(tls, (nStr + 1))
 72578  				rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer((*VfslogVtab)(unsafe.Pointer(p)).FpFd)).FpMethods + 8 /* &.xRead */))))(tls, (*VfslogVtab)(unsafe.Pointer(p)).FpFd, zStr, nStr, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset + sqlite3_int64(nRead)))
 72579  				*(*int8)(unsafe.Pointer(zStr + uintptr(nStr))) = int8(0)
 72580  				nRead = nRead + (nStr)
 72581  
 72582  				if eEvent == OS_OPEN {
 72583  					var iFileid int32 = int32(get32bits(tls, ((pCsr + 36 /* &.aBuf */) + 4)))
 72584  					if iFileid >= (*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile {
 72585  						var nNew int32 = (int32(uint32(unsafe.Sizeof(uintptr(0))) * (uint32(iFileid + 1))))
 72586  						(*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile = sqlite3.Xsqlite3_realloc(tls, (*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile, nNew)
 72587  						nNew = int32(uint32(nNew) - (uint32(unsafe.Sizeof(uintptr(0))) * uint32((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)))
 72588  						libc.Xmemset(tls, ((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)*4), 0, uint32(nNew))
 72589  						(*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile = (iFileid + 1)
 72590  					}
 72591  					sqlite3.Xsqlite3_free(tls, *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(iFileid)*4)))
 72592  					*(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(iFileid)*4)) = zStr
 72593  				} else {
 72594  					(*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient = zStr
 72595  				}
 72596  			}
 72597  		}
 72598  	}
 72599  
 72600  	*(*sqlite3_int64)(unsafe.Pointer(pCsr + 8 /* &.iRowid */)) += (int64(1))
 72601  	*(*sqlite3_int64)(unsafe.Pointer(pCsr + 16 /* &.iOffset */)) += (sqlite3_int64(nRead))
 72602  	return rc
 72603  }
 72604  
 72605  func vlogEof(tls *libc.TLS, pCursor uintptr) int32 { /* test_osinst.c:1016:12: */
 72606  	var pCsr uintptr = pCursor
 72607  	var p uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pCursor)).FpVtab
 72608  	return (libc.Bool32((*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset >= (*VfslogVtab)(unsafe.Pointer(p)).FnByte))
 72609  }
 72610  
 72611  func vlogFilter(tls *libc.TLS, pCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_osinst.c:1022:12: */
 72612  	var pCsr uintptr = pCursor
 72613  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FiRowid = int64(0)
 72614  	(*VfslogCsr)(unsafe.Pointer(pCsr)).FiOffset = int64(20)
 72615  	return vlogNext(tls, pCursor)
 72616  }
 72617  
 72618  func vlogColumn(tls *libc.TLS, pCursor uintptr, ctx uintptr, i int32) int32 { /* test_osinst.c:1033:12: */
 72619  	var val uint32
 72620  	var pCsr uintptr = pCursor
 72621  
 72622  	val = get32bits(tls, ((pCsr + 36 /* &.aBuf */) + uintptr((4 * i))))
 72623  
 72624  	switch i {
 72625  	case 0:
 72626  		{
 72627  			sqlite3.Xsqlite3_result_text(tls, ctx, vfslog_eventname(tls, int32(val)), -1, uintptr(0))
 72628  			break
 72629  
 72630  		}
 72631  	case 1:
 72632  		{
 72633  			var zStr uintptr = (*VfslogCsr)(unsafe.Pointer(pCsr)).FzTransient
 72634  			if (val != uint32(0)) && (val < uint32((*VfslogCsr)(unsafe.Pointer(pCsr)).FnFile)) {
 72635  				zStr = *(*uintptr)(unsafe.Pointer((*VfslogCsr)(unsafe.Pointer(pCsr)).FazFile + uintptr(val)*4))
 72636  			}
 72637  			sqlite3.Xsqlite3_result_text(tls, ctx, zStr, -1, libc.UintptrFromInt32(-1))
 72638  			break
 72639  
 72640  		}
 72641  	default:
 72642  		sqlite3.Xsqlite3_result_int(tls, ctx, int32(val))
 72643  		break
 72644  	}
 72645  
 72646  	return SQLITE_OK
 72647  }
 72648  
 72649  func vlogRowid(tls *libc.TLS, pCursor uintptr, pRowid uintptr) int32 { /* test_osinst.c:1065:12: */
 72650  	var pCsr uintptr = pCursor
 72651  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = (*VfslogCsr)(unsafe.Pointer(pCsr)).FiRowid
 72652  	return SQLITE_OK
 72653  }
 72654  
 72655  func sqlite3_vfslog_register(tls *libc.TLS, db uintptr) int32 { /* test_osinst.c:1071:5: */
 72656  
 72657  	sqlite3.Xsqlite3_create_module(tls, db, ts+35957 /* "vfslog" */, uintptr(unsafe.Pointer(&vfslog_module)), uintptr(0))
 72658  	return SQLITE_OK
 72659  }
 72660  
 72661  var vfslog_module = sqlite3_module{ // iVersion
 72662  	FxCreate:     0, // xCreate
 72663  	FxConnect:    0, // xConnect
 72664  	FxBestIndex:  0, // xBestIndex
 72665  	FxDisconnect: 0, // xDisconnect
 72666  	FxDestroy:    0, // xDestroy
 72667  	FxOpen:       0, // xOpen - open a cursor
 72668  	FxClose:      0, // xClose - close a cursor
 72669  	FxFilter:     0, // xFilter - configure scan constraints
 72670  	FxNext:       0, // xNext - advance a cursor
 72671  	FxEof:        0, // xEof - check for end of scan
 72672  	FxColumn:     0, // xColumn - read data
 72673  	FxRowid:      0, // xRename
 72674  } /* test_osinst.c:1072:25 */
 72675  
 72676  // end block for C++
 72677  
 72678  // Local Variables:
 72679  // mode: c
 72680  // c-basic-offset: 4
 72681  // fill-column: 78
 72682  // End:
 72683  
 72684  func test_vfslog(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_osinst.c:1116:26: */
 72685  	bp := tls.Alloc(108)
 72686  	defer tls.Free(108)
 72687  
 72688  	var db uintptr
 72689  	// var cmdInfo Tcl_CmdInfo at bp+76, 32
 72690  
 72691  	var rc int32 = SQLITE_ERROR
 72692  	// var iSub int32 at bp+72, 4
 72693  
 72694  	if objc < 2 {
 72695  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 72696  		return TCL_ERROR
 72697  	}
 72698  	if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), uintptr(unsafe.Pointer(&strs)), int32(unsafe.Sizeof(uintptr(0))), ts+1875 /* "sub-command" */, 0, bp+72 /* &iSub */) != 0 {
 72699  		return TCL_ERROR
 72700  	}
 72701  
 72702  	switch uint32(*(*int32)(unsafe.Pointer(bp + 72 /* iSub */))) {
 72703  	case uint32(0) /* VL_ANNOTATE */ :
 72704  		{
 72705  			var zVfs uintptr
 72706  			var zMsg uintptr
 72707  			if objc != 4 {
 72708  				tcl.XTcl_WrongNumArgs(tls, interp, 3, objv, ts+35964 /* "VFS" */)
 72709  				return TCL_ERROR
 72710  			}
 72711  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 72712  			zMsg = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 72713  			rc = sqlite3_vfslog_annotate(tls, zVfs, zMsg)
 72714  			if rc != SQLITE_OK {
 72715  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+35968 /* "failed" */, 0))
 72716  				return TCL_ERROR
 72717  			}
 72718  			break
 72719  
 72720  		}
 72721  	case uint32(1) /* VL_FINALIZE */ :
 72722  		{
 72723  			var zVfs uintptr
 72724  			if objc != 3 {
 72725  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+35964 /* "VFS" */)
 72726  				return TCL_ERROR
 72727  			}
 72728  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 72729  			rc = sqlite3_vfslog_finalize(tls, zVfs)
 72730  			if rc != SQLITE_OK {
 72731  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+16, ts+35968 /* "failed" */, 0))
 72732  				return TCL_ERROR
 72733  			}
 72734  			break
 72735  
 72736  		}
 72737  
 72738  	case uint32(2) /* VL_NEW */ :
 72739  		{
 72740  			var zVfs uintptr
 72741  			var zParent uintptr
 72742  			var zLog uintptr
 72743  			if objc != 5 {
 72744  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+35975 /* "VFS PARENT LOGFI..." */)
 72745  				return TCL_ERROR
 72746  			}
 72747  			zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 72748  			zParent = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 72749  			zLog = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 72750  			if int32(*(*int8)(unsafe.Pointer(zParent))) == 0 {
 72751  				zParent = uintptr(0)
 72752  			}
 72753  			rc = sqlite3_vfslog_new(tls, zVfs, zParent, zLog)
 72754  			if rc != SQLITE_OK {
 72755  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+32, ts+35968 /* "failed" */, 0))
 72756  				return TCL_ERROR
 72757  			}
 72758  			break
 72759  
 72760  		}
 72761  
 72762  	case uint32(3) /* VL_REGISTER */ :
 72763  		{
 72764  			var zDb uintptr
 72765  			if objc != 3 {
 72766  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+1911 /* "DB" */)
 72767  				return TCL_ERROR
 72768  			}
 72769  			zDb = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 72770  			if tcl.XTcl_GetCommandInfo(tls, interp, zDb, bp+76 /* &cmdInfo */) != 0 {
 72771  				db = (*struct{ Fdb uintptr })(unsafe.Pointer((*Tcl_CmdInfo)(unsafe.Pointer(bp + 76 /* &cmdInfo */)).FobjClientData)).Fdb
 72772  				rc = sqlite3_vfslog_register(tls, db)
 72773  			}
 72774  			if rc != SQLITE_OK {
 72775  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+35994 /* "bad sqlite3 hand..." */, zDb, uintptr(0)))
 72776  				return TCL_ERROR
 72777  			}
 72778  			break
 72779  
 72780  		}
 72781  	}
 72782  
 72783  	return TCL_OK
 72784  }
 72785  
 72786  var strs = [5]uintptr{ts + 36015 /* "annotate" */, ts + 36024 /* "finalize" */, ts + 14470 /* "new" */, ts + 36033 /* "register" */, uintptr(0)} /* test_osinst.c:1127:21 */
 72787  
 72788  func SqlitetestOsinst_Init(tls *libc.TLS, interp uintptr) int32 { /* test_osinst.c:1219:5: */
 72789  	tcl.XTcl_CreateObjCommand(tls, interp, ts+35957 /* "vfslog" */, *(*uintptr)(unsafe.Pointer(&struct {
 72790  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 72791  	}{test_vfslog})), uintptr(0), uintptr(0))
 72792  	return TCL_OK
 72793  }
 72794  
 72795  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 72796  //    This file is part of the GNU C Library.
 72797  //
 72798  //    The GNU C Library is free software; you can redistribute it and/or
 72799  //    modify it under the terms of the GNU Lesser General Public
 72800  //    License as published by the Free Software Foundation; either
 72801  //    version 2.1 of the License, or (at your option) any later version.
 72802  //
 72803  //    The GNU C Library is distributed in the hope that it will be useful,
 72804  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 72805  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 72806  //    Lesser General Public License for more details.
 72807  //
 72808  //    You should have received a copy of the GNU Lesser General Public
 72809  //    License along with the GNU C Library; if not, see
 72810  //    <http://www.gnu.org/licenses/>.
 72811  
 72812  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 72813  
 72814  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 72815  //    This file is part of the GNU C Library.
 72816  //
 72817  //    The GNU C Library is free software; you can redistribute it and/or
 72818  //    modify it under the terms of the GNU Lesser General Public
 72819  //    License as published by the Free Software Foundation; either
 72820  //    version 2.1 of the License, or (at your option) any later version.
 72821  //
 72822  //    The GNU C Library is distributed in the hope that it will be useful,
 72823  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 72824  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 72825  //    Lesser General Public License for more details.
 72826  //
 72827  //    You should have received a copy of the GNU Lesser General Public
 72828  //    License along with the GNU C Library; if not, see
 72829  //    <http://www.gnu.org/licenses/>.
 72830  
 72831  // void assert (int expression);
 72832  //
 72833  //    If NDEBUG is defined, do nothing.
 72834  //    If not, and EXPRESSION is zero, print an error message and abort.
 72835  
 72836  // void assert_perror (int errnum);
 72837  //
 72838  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 72839  //    error message with the error text for ERRNUM and abort.
 72840  //    (This is a GNU extension.)
 72841  
 72842  // Global data used by this test implementation.  There is no
 72843  // mutexing, which means this page cache will not work in a
 72844  // multi-threaded test.
 72845  type testpcacheGlobalType1 = struct {
 72846  	FpDummy        uintptr
 72847  	FnInstance     int32
 72848  	FdiscardChance uint32
 72849  	FprngSeed      uint32
 72850  	FhighStress    uint32
 72851  } /* test_pcache.c:33:9 */
 72852  
 72853  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 72854  //    This file is part of the GNU C Library.
 72855  //
 72856  //    The GNU C Library is free software; you can redistribute it and/or
 72857  //    modify it under the terms of the GNU Lesser General Public
 72858  //    License as published by the Free Software Foundation; either
 72859  //    version 2.1 of the License, or (at your option) any later version.
 72860  //
 72861  //    The GNU C Library is distributed in the hope that it will be useful,
 72862  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 72863  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 72864  //    Lesser General Public License for more details.
 72865  //
 72866  //    You should have received a copy of the GNU Lesser General Public
 72867  //    License along with the GNU C Library; if not, see
 72868  //    <http://www.gnu.org/licenses/>.
 72869  
 72870  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 72871  
 72872  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 72873  //    This file is part of the GNU C Library.
 72874  //
 72875  //    The GNU C Library is free software; you can redistribute it and/or
 72876  //    modify it under the terms of the GNU Lesser General Public
 72877  //    License as published by the Free Software Foundation; either
 72878  //    version 2.1 of the License, or (at your option) any later version.
 72879  //
 72880  //    The GNU C Library is distributed in the hope that it will be useful,
 72881  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 72882  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 72883  //    Lesser General Public License for more details.
 72884  //
 72885  //    You should have received a copy of the GNU Lesser General Public
 72886  //    License along with the GNU C Library; if not, see
 72887  //    <http://www.gnu.org/licenses/>.
 72888  
 72889  // void assert (int expression);
 72890  //
 72891  //    If NDEBUG is defined, do nothing.
 72892  //    If not, and EXPRESSION is zero, print an error message and abort.
 72893  
 72894  // void assert_perror (int errnum);
 72895  //
 72896  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 72897  //    error message with the error text for ERRNUM and abort.
 72898  //    (This is a GNU extension.)
 72899  
 72900  // Global data used by this test implementation.  There is no
 72901  // mutexing, which means this page cache will not work in a
 72902  // multi-threaded test.
 72903  type testpcacheGlobalType = testpcacheGlobalType1 /* test_pcache.c:33:37 */
 72904  var testpcacheGlobal testpcacheGlobalType         /* test_pcache.c:41:29: */
 72905  
 72906  // Initializer.
 72907  //
 72908  // Verify that the initializer is only called when the system is
 72909  // uninitialized.  Allocate some memory and report SQLITE_NOMEM if
 72910  // the allocation fails.  This provides a means to test the recovery
 72911  // from a failed initialization attempt.  It also verifies that the
 72912  // the destructor always gets call - otherwise there would be a
 72913  // memory leak.
 72914  func testpcacheInit(tls *libc.TLS, pArg uintptr) int32 { /* test_pcache.c:53:12: */
 72915  
 72916  	testpcacheGlobal.FpDummy = sqlite3.Xsqlite3_malloc(tls, 10)
 72917  	if testpcacheGlobal.FpDummy == uintptr(0) {
 72918  		return SQLITE_NOMEM
 72919  	}
 72920  	return SQLITE_OK
 72921  }
 72922  
 72923  // Destructor
 72924  //
 72925  // Verify that this is only called after initialization.
 72926  // Free the memory allocated by the initializer.
 72927  func testpcacheShutdown(tls *libc.TLS, pArg uintptr) { /* test_pcache.c:67:13: */
 72928  
 72929  	sqlite3.Xsqlite3_free(tls, testpcacheGlobal.FpDummy)
 72930  	testpcacheGlobal.FpDummy = uintptr(0)
 72931  }
 72932  
 72933  // Number of pages in a cache.
 72934  //
 72935  // The number of pages is a hard upper bound in this test module.
 72936  // If more pages are requested, sqlite3PcacheFetch() returns NULL.
 72937  //
 72938  // If testing with in-memory temp tables, provide a larger pcache.
 72939  // Some of the test cases need this.
 72940  
 72941  // Magic numbers used to determine validity of the page cache.
 72942  
 72943  // Private implementation of a page cache.
 72944  type testpcache1 = struct {
 72945  	FszPage     int32
 72946  	FszExtra    int32
 72947  	FbPurgeable int32
 72948  	FnFree      int32
 72949  	FnPinned    int32
 72950  	FiRand      uint32
 72951  	FiMagic     uint32
 72952  	Fa          [217]struct {
 72953  		Fpage     sqlite3_pcache_page
 72954  		Fkey      uint32
 72955  		FisPinned int32
 72956  	}
 72957  } /* test_pcache.c:100:9 */
 72958  
 72959  // Number of pages in a cache.
 72960  //
 72961  // The number of pages is a hard upper bound in this test module.
 72962  // If more pages are requested, sqlite3PcacheFetch() returns NULL.
 72963  //
 72964  // If testing with in-memory temp tables, provide a larger pcache.
 72965  // Some of the test cases need this.
 72966  
 72967  // Magic numbers used to determine validity of the page cache.
 72968  
 72969  // Private implementation of a page cache.
 72970  type testpcache = testpcache1 /* test_pcache.c:100:27 */
 72971  type testpcachePage = struct {
 72972  	Fpage     sqlite3_pcache_page
 72973  	Fkey      uint32
 72974  	FisPinned int32
 72975  } /* test_pcache.c:100:9 */
 72976  
 72977  // Get a random number using the PRNG in the given page cache.
 72978  func testpcacheRandom(tls *libc.TLS, p uintptr) uint32 { /* test_pcache.c:119:17: */
 72979  	var x uint32 = uint32(0)
 72980  	var i int32
 72981  	for i = 0; i < 4; i++ {
 72982  		(*testpcache)(unsafe.Pointer(p)).FiRand = (((*testpcache)(unsafe.Pointer(p)).FiRand * uint32(69069)) + uint32(5))
 72983  		x = ((x << 8) | (((*testpcache)(unsafe.Pointer(p)).FiRand >> 16) & uint32(0xff)))
 72984  	}
 72985  	return x
 72986  }
 72987  
 72988  // Allocate a new page cache instance.
 72989  func testpcacheCreate(tls *libc.TLS, szPage int32, szExtra int32, bPurgeable int32) uintptr { /* test_pcache.c:133:23: */
 72990  	var nMem int32
 72991  	var x uintptr
 72992  	var p uintptr
 72993  	var i int32
 72994  
 72995  	szPage = ((szPage + 7) & libc.CplInt32(7))
 72996  	nMem = (int32(uint32(unsafe.Sizeof(testpcache{})) + (uint32(TESTPCACHE_NPAGE * (szPage + szExtra)))))
 72997  	p = sqlite3.Xsqlite3_malloc(tls, nMem)
 72998  	if p == uintptr(0) {
 72999  		return uintptr(0)
 73000  	}
 73001  	x = (p + 1*3500)
 73002  	(*testpcache)(unsafe.Pointer(p)).FszPage = szPage
 73003  	(*testpcache)(unsafe.Pointer(p)).FszExtra = szExtra
 73004  	(*testpcache)(unsafe.Pointer(p)).FnFree = TESTPCACHE_NPAGE
 73005  	(*testpcache)(unsafe.Pointer(p)).FnPinned = 0
 73006  	(*testpcache)(unsafe.Pointer(p)).FiRand = testpcacheGlobal.FprngSeed
 73007  	(*testpcache)(unsafe.Pointer(p)).FbPurgeable = bPurgeable
 73008  	(*testpcache)(unsafe.Pointer(p)).FiMagic = uint32(TESTPCACHE_VALID)
 73009  	i = 0
 73010  __1:
 73011  	if !(i < TESTPCACHE_NPAGE) {
 73012  		goto __3
 73013  	}
 73014  	{
 73015  		(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fkey = uint32(0)
 73016  		(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).FisPinned = 0
 73017  		(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fpage.FpBuf = x
 73018  		(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fpage.FpExtra = (x + uintptr(szPage))
 73019  
 73020  	}
 73021  	goto __2
 73022  __2:
 73023  	i++
 73024  	x += (uintptr(szPage + szExtra))
 73025  	goto __1
 73026  	goto __3
 73027  __3:
 73028  	;
 73029  	testpcacheGlobal.FnInstance++
 73030  	return p
 73031  }
 73032  
 73033  // Set the cache size
 73034  func testpcacheCachesize(tls *libc.TLS, pCache uintptr, newSize int32) { /* test_pcache.c:168:13: */
 73035  	var p uintptr = pCache
 73036  	_ = p
 73037  
 73038  }
 73039  
 73040  // Return the number of pages in the cache that are being used.
 73041  // This includes both pinned and unpinned pages.
 73042  func testpcachePagecount(tls *libc.TLS, pCache uintptr) int32 { /* test_pcache.c:179:12: */
 73043  	var p uintptr = pCache
 73044  
 73045  	return (TESTPCACHE_NPAGE - (*testpcache)(unsafe.Pointer(p)).FnFree)
 73046  }
 73047  
 73048  // Fetch a page.
 73049  func testpcacheFetch(tls *libc.TLS, pCache uintptr, key uint32, createFlag int32) uintptr { /* test_pcache.c:190:28: */
 73050  	var p uintptr = pCache
 73051  	var i int32
 73052  	var j int32
 73053  
 73054  	// See if the page is already in cache.  Return immediately if it is
 73055  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 73056  		if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).Fkey == key {
 73057  			if !((*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).FisPinned != 0) {
 73058  				(*testpcache)(unsafe.Pointer(p)).FnPinned++
 73059  
 73060  				(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).FisPinned = 1
 73061  			}
 73062  			return ((p + 28 /* &.a */) + uintptr(i)*16 /* &.page */)
 73063  		}
 73064  	}
 73065  
 73066  	// If createFlag is 0, never allocate a new page
 73067  	if createFlag == 0 {
 73068  		return uintptr(0)
 73069  	}
 73070  
 73071  	// If no pages are available, always fail
 73072  	if (*testpcache)(unsafe.Pointer(p)).FnPinned == TESTPCACHE_NPAGE {
 73073  		return uintptr(0)
 73074  	}
 73075  
 73076  	// Do not allocate the last TESTPCACHE_RESERVE pages unless createFlag is 2
 73077  	if ((*testpcache)(unsafe.Pointer(p)).FnPinned >= (TESTPCACHE_NPAGE - TESTPCACHE_RESERVE)) && (createFlag < 2) {
 73078  		return uintptr(0)
 73079  	}
 73080  
 73081  	// Do not allocate if highStress is enabled and createFlag is not 2.
 73082  	//
 73083  	// The highStress setting causes pagerStress() to be called much more
 73084  	// often, which exercises the pager logic more intensely.
 73085  	if (testpcacheGlobal.FhighStress != 0) && (createFlag < 2) {
 73086  		return uintptr(0)
 73087  	}
 73088  
 73089  	// Find a free page to allocate if there are any free pages.
 73090  	// Withhold TESTPCACHE_RESERVE free pages until createFlag is 2.
 73091  	if ((*testpcache)(unsafe.Pointer(p)).FnFree > TESTPCACHE_RESERVE) || ((createFlag == 2) && ((*testpcache)(unsafe.Pointer(p)).FnFree > 0)) {
 73092  		j = (int32(testpcacheRandom(tls, p) % uint32(TESTPCACHE_NPAGE)))
 73093  		i = 0
 73094  	__1:
 73095  		if !(i < TESTPCACHE_NPAGE) {
 73096  			goto __3
 73097  		}
 73098  		{
 73099  			if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fkey == uint32(0) {
 73100  				(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(j)*16)).Fkey = key
 73101  				(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(j)*16)).FisPinned = 1
 73102  				libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fpage.FpBuf, 0, uint32((*testpcache)(unsafe.Pointer(p)).FszPage))
 73103  				libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fpage.FpExtra, 0, uint32((*testpcache)(unsafe.Pointer(p)).FszExtra))
 73104  				(*testpcache)(unsafe.Pointer(p)).FnPinned++
 73105  				(*testpcache)(unsafe.Pointer(p)).FnFree--
 73106  
 73107  				return ((p + 28 /* &.a */) + uintptr(j)*16 /* &.page */)
 73108  			}
 73109  
 73110  		}
 73111  		goto __2
 73112  	__2:
 73113  		i++
 73114  		j = ((j + 1) % TESTPCACHE_NPAGE)
 73115  		goto __1
 73116  		goto __3
 73117  	__3:
 73118  
 73119  		// The prior loop always finds a freepage to allocate
 73120  
 73121  	}
 73122  
 73123  	// If this cache is not purgeable then we have to fail.
 73124  	if (*testpcache)(unsafe.Pointer(p)).FbPurgeable == 0 {
 73125  		return uintptr(0)
 73126  	}
 73127  
 73128  	// If there are no free pages, recycle a page.  The page to
 73129  	// recycle is selected at random from all unpinned pages.
 73130  	j = (int32(testpcacheRandom(tls, p) % uint32(TESTPCACHE_NPAGE)))
 73131  	i = 0
 73132  __4:
 73133  	if !(i < TESTPCACHE_NPAGE) {
 73134  		goto __6
 73135  	}
 73136  	{
 73137  		if ((*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fkey > uint32(0)) && ((*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).FisPinned == 0) {
 73138  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(j)*16)).Fkey = key
 73139  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(j)*16)).FisPinned = 1
 73140  			libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fpage.FpBuf, 0, uint32((*testpcache)(unsafe.Pointer(p)).FszPage))
 73141  			libc.Xmemset(tls, (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(j)*16)).Fpage.FpExtra, 0, uint32((*testpcache)(unsafe.Pointer(p)).FszExtra))
 73142  			(*testpcache)(unsafe.Pointer(p)).FnPinned++
 73143  
 73144  			return ((p + 28 /* &.a */) + uintptr(j)*16 /* &.page */)
 73145  		}
 73146  
 73147  	}
 73148  	goto __5
 73149  __5:
 73150  	i++
 73151  	j = ((j + 1) % TESTPCACHE_NPAGE)
 73152  	goto __4
 73153  	goto __6
 73154  __6:
 73155  	;
 73156  
 73157  	// The previous loop always finds a page to recycle.
 73158  
 73159  	return uintptr(0)
 73160  }
 73161  
 73162  // Unpin a page.
 73163  func testpcacheUnpin(tls *libc.TLS, pCache uintptr, pOldPage uintptr, discard int32) { /* test_pcache.c:289:13: */
 73164  	var p uintptr = pCache
 73165  	var i int32
 73166  
 73167  	// Randomly discard pages as they are unpinned according to the
 73168  	// discardChance setting.  If discardChance is 0, the random discard
 73169  	// never happens.  If discardChance is 100, it always happens.
 73170  	if ((*testpcache)(unsafe.Pointer(p)).FbPurgeable != 0) &&
 73171  		((uint32(100) - testpcacheGlobal.FdiscardChance) <= (testpcacheRandom(tls, p) % uint32(100))) {
 73172  		discard = 1
 73173  	}
 73174  
 73175  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 73176  		if ((p + 28 /* &.a */) + uintptr(i)*16 /* &.page */) == pOldPage {
 73177  			// The pOldPage pointer always points to a pinned page
 73178  
 73179  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).FisPinned = 0
 73180  			(*testpcache)(unsafe.Pointer(p)).FnPinned--
 73181  
 73182  			if discard != 0 {
 73183  				(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fkey = uint32(0)
 73184  				(*testpcache)(unsafe.Pointer(p)).FnFree++
 73185  
 73186  			}
 73187  			return
 73188  		}
 73189  	}
 73190  
 73191  	// The pOldPage pointer always points to a valid page
 73192  
 73193  }
 73194  
 73195  // Rekey a single page.
 73196  func testpcacheRekey(tls *libc.TLS, pCache uintptr, pOldPage uintptr, oldKey uint32, newKey uint32) { /* test_pcache.c:334:13: */
 73197  	var p uintptr = pCache
 73198  	var i int32
 73199  
 73200  	// If there already exists another page at newKey, verify that
 73201  	// the other page is unpinned and discard it.
 73202  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 73203  		if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).Fkey == newKey {
 73204  			// The new key is never a page that is already pinned
 73205  
 73206  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fkey = uint32(0)
 73207  			(*testpcache)(unsafe.Pointer(p)).FnFree++
 73208  
 73209  			break
 73210  		}
 73211  	}
 73212  
 73213  	// Find the page to be rekeyed and rekey it.
 73214  	for i = 0; i < TESTPCACHE_NPAGE; i++ {
 73215  		if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).Fkey == oldKey {
 73216  			// The oldKey and pOldPage parameters match
 73217  
 73218  			// Page to be rekeyed must be pinned
 73219  
 73220  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fkey = newKey
 73221  			return
 73222  		}
 73223  	}
 73224  
 73225  	// Rekey is always given a valid page to work with
 73226  
 73227  }
 73228  
 73229  // Truncate the page cache.  Every page with a key of iLimit or larger
 73230  // is discarded.
 73231  func testpcacheTruncate(tls *libc.TLS, pCache uintptr, iLimit uint32) { /* test_pcache.c:382:13: */
 73232  	var p uintptr = pCache
 73233  	var i uint32
 73234  
 73235  	for i = uint32(0); i < uint32(TESTPCACHE_NPAGE); i++ {
 73236  		if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).Fkey >= iLimit {
 73237  			(*testpcachePage)(unsafe.Pointer((p + 28 /* &.a */) + uintptr(i)*16)).Fkey = uint32(0)
 73238  			if (*testpcachePage)(unsafe.Pointer((p+28 /* &.a */)+uintptr(i)*16)).FisPinned != 0 {
 73239  				(*testpcache)(unsafe.Pointer(p)).FnPinned--
 73240  
 73241  			}
 73242  			(*testpcache)(unsafe.Pointer(p)).FnFree++
 73243  
 73244  		}
 73245  	}
 73246  }
 73247  
 73248  // Destroy a page cache.
 73249  func testpcacheDestroy(tls *libc.TLS, pCache uintptr) { /* test_pcache.c:404:13: */
 73250  	var p uintptr = pCache
 73251  
 73252  	(*testpcache)(unsafe.Pointer(p)).FiMagic = TESTPCACHE_CLEAR
 73253  	sqlite3.Xsqlite3_free(tls, p)
 73254  	testpcacheGlobal.FnInstance--
 73255  }
 73256  
 73257  // Invoke this routine to register or unregister the testing pager cache
 73258  // implemented by this file.
 73259  //
 73260  // Install the test pager cache if installFlag is 1 and uninstall it if
 73261  // installFlag is 0.
 73262  //
 73263  // When installing, discardChance is a number between 0 and 100 that
 73264  // indicates the probability of discarding a page when unpinning the
 73265  // page.  0 means never discard (unless the discard flag is set).
 73266  // 100 means always discard.
 73267  func installTestPCache(tls *libc.TLS, installFlag int32, discardChance uint32, prngSeed uint32, highStress uint32) { /* test_pcache.c:427:6: */
 73268  	bp := tls.Alloc(24)
 73269  	defer tls.Free(24)
 73270  
 73271  	testpcacheGlobal.FdiscardChance = discardChance
 73272  	testpcacheGlobal.FprngSeed = (prngSeed ^ (prngSeed << 16))
 73273  	testpcacheGlobal.FhighStress = highStress
 73274  	if installFlag != isInstalled {
 73275  		if installFlag != 0 {
 73276  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_GETPCACHE2, libc.VaList(bp, uintptr(unsafe.Pointer(&defaultPcache))))
 73277  
 73278  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+8, uintptr(unsafe.Pointer(&testPcache))))
 73279  		} else {
 73280  
 73281  			sqlite3.Xsqlite3_config(tls, SQLITE_CONFIG_PCACHE2, libc.VaList(bp+16, uintptr(unsafe.Pointer(&defaultPcache))))
 73282  		}
 73283  		isInstalled = installFlag
 73284  	}
 73285  }
 73286  
 73287  var testPcache = sqlite3_pcache_methods2{
 73288  	FiVersion:   1,
 73289  	FpArg:       0,
 73290  	FxInit:      0,
 73291  	FxShutdown:  0,
 73292  	FxCreate:    0,
 73293  	FxCachesize: 0,
 73294  	FxPagecount: 0,
 73295  	FxFetch:     0,
 73296  	FxUnpin:     0,
 73297  	FxRekey:     0,
 73298  	FxTruncate:  0,
 73299  	FxDestroy:   0,
 73300  }                                         /* test_pcache.c:433:40 */
 73301  var defaultPcache sqlite3_pcache_methods2 /* test_pcache.c:447:34: */
 73302  var isInstalled int32 = 0                 /* test_pcache.c:448:14 */
 73303  
 73304  // The following object serves the same role as FILE in the standard C
 73305  // library.  It represents an open connection to a file on disk for I/O.
 73306  //
 73307  // A single quota_FILE should not be used by two or more threads at the
 73308  // same time.  Multiple threads can be using different quota_FILE objects
 73309  // simultaneously, but not the same quota_FILE object.
 73310  type quota_FILE1 = struct {
 73311  	Ff     uintptr
 73312  	_      [4]byte
 73313  	FiOfst sqlite3_int64
 73314  	FpFile uintptr
 73315  	_      [4]byte
 73316  } /* test_quota.h:145:9 */
 73317  
 73318  // The following object serves the same role as FILE in the standard C
 73319  // library.  It represents an open connection to a file on disk for I/O.
 73320  //
 73321  // A single quota_FILE should not be used by two or more threads at the
 73322  // same time.  Multiple threads can be using different quota_FILE objects
 73323  // simultaneously, but not the same quota_FILE object.
 73324  type quota_FILE = quota_FILE1 /* test_quota.h:145:27 */
 73325  
 73326  // Define some macros helping to catch buffer overflows.
 73327  
 73328  //*********************** Object Definitions *****************************
 73329  
 73330  // Forward declaration of all object types
 73331  type quotaGroup1 = struct {
 73332  	FzPattern  uintptr
 73333  	_          [4]byte
 73334  	FiLimit    sqlite3_int64
 73335  	FiSize     sqlite3_int64
 73336  	FxCallback uintptr
 73337  	FpArg      uintptr
 73338  	FxDestroy  uintptr
 73339  	FpNext     uintptr
 73340  	FppPrev    uintptr
 73341  	FpFiles    uintptr
 73342  } /* test_quota.h:145:9 */
 73343  
 73344  // Define some macros helping to catch buffer overflows.
 73345  
 73346  //*********************** Object Definitions *****************************
 73347  
 73348  // Forward declaration of all object types
 73349  type quotaGroup = quotaGroup1 /* test_quota.c:61:27 */
 73350  type quotaConn1 = struct {
 73351  	Fbase  sqlite3_file
 73352  	FpFile uintptr
 73353  } /* test_quota.c:62:9 */
 73354  
 73355  type quotaConn = quotaConn1 /* test_quota.c:62:26 */
 73356  type quotaFile1 = struct {
 73357  	FzFilename     uintptr
 73358  	FpGroup        uintptr
 73359  	FiSize         sqlite3_int64
 73360  	FnRef          int32
 73361  	FdeleteOnClose int32
 73362  	FpNext         uintptr
 73363  	FppPrev        uintptr
 73364  } /* test_quota.h:145:9 */
 73365  
 73366  type quotaFile = quotaFile1 /* test_quota.c:63:26 */
 73367  
 73368  //************************ Global Variables *********************************
 73369  // All global variables used by this file are containing within the following
 73370  // gQuota structure.
 73371  var gQuota struct {
 73372  	FpOrigVfs      uintptr
 73373  	FsThisVfs      sqlite3_vfs
 73374  	FsIoMethodsV1  sqlite3_io_methods
 73375  	FsIoMethodsV2  sqlite3_io_methods
 73376  	FisInitialized int32
 73377  	FpMutex        uintptr
 73378  	FpGroup        uintptr
 73379  } /* test_quota.c:183:3: */
 73380  
 73381  //************************ Utility Routines ********************************
 73382  // Acquire and release the mutex used to serialize access to the
 73383  // list of quotaGroups.
 73384  func quotaEnter(tls *libc.TLS) { /* test_quota.c:190:13: */
 73385  	sqlite3.Xsqlite3_mutex_enter(tls, gQuota.FpMutex)
 73386  }
 73387  
 73388  func quotaLeave(tls *libc.TLS) { /* test_quota.c:191:13: */
 73389  	sqlite3.Xsqlite3_mutex_leave(tls, gQuota.FpMutex)
 73390  }
 73391  
 73392  // Count the number of open files in a quotaGroup
 73393  func quotaGroupOpenFileCount(tls *libc.TLS, pGroup uintptr) int32 { /* test_quota.c:195:12: */
 73394  	var N int32 = 0
 73395  	var pFile uintptr = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 73396  	for pFile != 0 {
 73397  		if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 73398  			N++
 73399  		}
 73400  		pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 73401  	}
 73402  	return N
 73403  }
 73404  
 73405  // Remove a file from a quota group.
 73406  func quotaRemoveFile(tls *libc.TLS, pFile uintptr) { /* test_quota.c:207:13: */
 73407  	var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 73408  	*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 73409  	*(*uintptr)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FppPrev)) = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 73410  	if (*quotaFile)(unsafe.Pointer(pFile)).FpNext != 0 {
 73411  		(*quotaFile)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FpNext)).FppPrev = (*quotaFile)(unsafe.Pointer(pFile)).FppPrev
 73412  	}
 73413  	sqlite3.Xsqlite3_free(tls, pFile)
 73414  }
 73415  
 73416  // Remove all files from a quota group.  It is always the case that
 73417  // all files will be closed when this routine is called.
 73418  func quotaRemoveAllFiles(tls *libc.TLS, pGroup uintptr) { /* test_quota.c:218:13: */
 73419  	for (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles != 0 {
 73420  
 73421  		quotaRemoveFile(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles)
 73422  	}
 73423  }
 73424  
 73425  // If the reference count and threshold for a quotaGroup are both
 73426  // zero, then destroy the quotaGroup.
 73427  func quotaGroupDeref(tls *libc.TLS, pGroup uintptr) { /* test_quota.c:229:13: */
 73428  	if ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit == int64(0)) && (quotaGroupOpenFileCount(tls, pGroup) == 0) {
 73429  		quotaRemoveAllFiles(tls, pGroup)
 73430  		*(*uintptr)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev)) = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 73431  		if (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext != 0 {
 73432  			(*quotaGroup)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FpNext)).FppPrev = (*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev
 73433  		}
 73434  		if (*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy != 0 {
 73435  			(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pGroup + 32 /* &.xDestroy */))))(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 73436  		}
 73437  		sqlite3.Xsqlite3_free(tls, pGroup)
 73438  	}
 73439  }
 73440  
 73441  // Return TRUE if string z matches glob pattern zGlob.
 73442  //
 73443  // Globbing rules:
 73444  //
 73445  //      '*'       Matches any sequence of zero or more characters.
 73446  //
 73447  //      '?'       Matches exactly one character.
 73448  //
 73449  //     [...]      Matches one character from the enclosed list of
 73450  //                characters.
 73451  //
 73452  //     [^...]     Matches one character not in the enclosed list.
 73453  //
 73454  //     /          Matches "/" or "\\"
 73455  //
 73456  func quotaStrglob(tls *libc.TLS, zGlob uintptr, z uintptr) int32 { /* test_quota.c:256:12: */
 73457  	var c int32
 73458  	var c2 int32
 73459  	var cx int32
 73460  	var invert int32
 73461  	var seen int32
 73462  
 73463  	for (libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) != 0 {
 73464  		if c == '*' {
 73465  			for ((libc.AssignInt32(&c, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1)))))) == '*') || (c == '?') {
 73466  				if (c == '?') && ((int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0) {
 73467  					return 0
 73468  				}
 73469  			}
 73470  			if c == 0 {
 73471  				return 1
 73472  			} else if c == '[' {
 73473  				for (*(*int8)(unsafe.Pointer(z)) != 0) && (quotaStrglob(tls, (zGlob-uintptr(1)), z) == 0) {
 73474  					z++
 73475  				}
 73476  				return (libc.Bool32((int32(*(*int8)(unsafe.Pointer(z)))) != 0))
 73477  			}
 73478  			if c == '/' {
 73479  				cx = '\\'
 73480  			} else {
 73481  				cx = c
 73482  			}
 73483  			for (libc.AssignInt32(&c2, int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1)))))) != 0 {
 73484  				for (c2 != c) && (c2 != cx) {
 73485  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 73486  					if c2 == 0 {
 73487  						return 0
 73488  					}
 73489  				}
 73490  				if quotaStrglob(tls, zGlob, z) != 0 {
 73491  					return 1
 73492  				}
 73493  			}
 73494  			return 0
 73495  		} else if c == '?' {
 73496  			if (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) == 0 {
 73497  				return 0
 73498  			}
 73499  		} else if c == '[' {
 73500  			var prior_c int32 = 0
 73501  			seen = 0
 73502  			invert = 0
 73503  			c = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))
 73504  			if c == 0 {
 73505  				return 0
 73506  			}
 73507  			c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 73508  			if c2 == '^' {
 73509  				invert = 1
 73510  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 73511  			}
 73512  			if c2 == ']' {
 73513  				if c == ']' {
 73514  					seen = 1
 73515  				}
 73516  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 73517  			}
 73518  			for (c2 != 0) && (c2 != ']') {
 73519  				if (((c2 == '-') && (int32(*(*int8)(unsafe.Pointer(zGlob))) != ']')) && (int32(*(*int8)(unsafe.Pointer(zGlob))) != 0)) && (prior_c > 0) {
 73520  					c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 73521  					if (c >= prior_c) && (c <= c2) {
 73522  						seen = 1
 73523  					}
 73524  					prior_c = 0
 73525  				} else {
 73526  					if c == c2 {
 73527  						seen = 1
 73528  					}
 73529  					prior_c = c2
 73530  				}
 73531  				c2 = int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&zGlob, 1))))
 73532  			}
 73533  			if (c2 == 0) || ((seen ^ invert) == 0) {
 73534  				return 0
 73535  			}
 73536  		} else if c == '/' {
 73537  			if (int32(*(*int8)(unsafe.Pointer(z))) != '/') && (int32(*(*int8)(unsafe.Pointer(z))) != '\\') {
 73538  				return 0
 73539  			}
 73540  			z++
 73541  		} else {
 73542  			if c != (int32(*(*int8)(unsafe.Pointer(libc.PostIncUintptr(&z, 1))))) {
 73543  				return 0
 73544  			}
 73545  		}
 73546  	}
 73547  	return (libc.Bool32(int32(*(*int8)(unsafe.Pointer(z))) == 0))
 73548  }
 73549  
 73550  // Find a quotaGroup given the filename.
 73551  //
 73552  // Return a pointer to the quotaGroup object. Return NULL if not found.
 73553  func quotaGroupFind(tls *libc.TLS, zFilename uintptr) uintptr { /* test_quota.c:329:19: */
 73554  	var p uintptr
 73555  	for p = gQuota.FpGroup; (p != 0) && (quotaStrglob(tls, (*quotaGroup)(unsafe.Pointer(p)).FzPattern, zFilename) == 0); p = (*quotaGroup)(unsafe.Pointer(p)).FpNext {
 73556  	}
 73557  	return p
 73558  }
 73559  
 73560  // Translate an sqlite3_file* that is really a quotaConn* into
 73561  // the sqlite3_file* for the underlying original VFS.
 73562  func quotaSubOpen(tls *libc.TLS, pConn uintptr) uintptr { /* test_quota.c:339:21: */
 73563  	var p uintptr = pConn
 73564  	return (p + 1*8)
 73565  }
 73566  
 73567  // Find a file in a quota group and return a pointer to that file.
 73568  // Return NULL if the file is not in the group.
 73569  func quotaFindFile(tls *libc.TLS, pGroup uintptr, zName uintptr, createFlag int32) uintptr { /* test_quota.c:347:18: */
 73570  	var pFile uintptr = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 73571  	for (pFile != 0) && (libc.Xstrcmp(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, zName) != 0) {
 73572  		pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 73573  	}
 73574  	if (pFile == uintptr(0)) && (createFlag != 0) {
 73575  		var nName int32 = (int32(libc.Xstrlen(tls, zName) & size_t(0x3fffffff)))
 73576  		pFile = sqlite3.Xsqlite3_malloc(tls, (int32((uint32(unsafe.Sizeof(quotaFile{})) + uint32(nName)) + uint32(1))))
 73577  		if pFile != 0 {
 73578  			libc.Xmemset(tls, pFile, 0, uint32(unsafe.Sizeof(quotaFile{})))
 73579  			(*quotaFile)(unsafe.Pointer(pFile)).FzFilename = (pFile + 1*32)
 73580  			libc.Xmemcpy(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, zName, (uint32(nName + 1)))
 73581  			(*quotaFile)(unsafe.Pointer(pFile)).FpNext = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles
 73582  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles != 0 {
 73583  				(*quotaFile)(unsafe.Pointer((*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles)).FppPrev = (pFile + 24 /* &.pNext */)
 73584  			}
 73585  			(*quotaFile)(unsafe.Pointer(pFile)).FppPrev = (pGroup + 44 /* &.pFiles */)
 73586  			(*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles = pFile
 73587  			(*quotaFile)(unsafe.Pointer(pFile)).FpGroup = pGroup
 73588  		}
 73589  	}
 73590  	return pFile
 73591  }
 73592  
 73593  // Translate UTF8 to MBCS for use in fopen() calls.  Return a pointer to the
 73594  // translated text..  Call quota_mbcs_free() to deallocate any memory
 73595  // used to store the returned pointer when done.
 73596  func quota_utf8_to_mbcs(tls *libc.TLS, zUtf8 uintptr) uintptr { /* test_quota.c:377:13: */
 73597  	return zUtf8 // No-op on unix
 73598  }
 73599  
 73600  // Deallocate any memory allocated by quota_utf8_to_mbcs().
 73601  func quota_mbcs_free(tls *libc.TLS, zOld uintptr) { /* test_quota.c:408:13: */
 73602  	// No-op on unix
 73603  }
 73604  
 73605  //************************ VFS Method Wrappers ****************************
 73606  // This is the xOpen method used for the "quota" VFS.
 73607  //
 73608  // Most of the work is done by the underlying original VFS.  This method
 73609  // simply links the new file into the appropriate quota group if it is a
 73610  // file that needs to be tracked.
 73611  func quotaOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pConn uintptr, flags int32, pOutFlags uintptr) int32 { /* test_quota.c:424:12: */
 73612  	var rc int32                            // Result code
 73613  	var pQuotaOpen uintptr                  // The new quota file descriptor
 73614  	var pFile uintptr                       // Corresponding quotaFile obj
 73615  	var pGroup uintptr                      // The group file belongs to
 73616  	var pSubOpen uintptr                    // Real file descriptor
 73617  	var pOrigVfs uintptr = gQuota.FpOrigVfs // Real VFS
 73618  
 73619  	// If the file is not a main database file or a WAL, then use the
 73620  	// normal xOpen method.
 73621  	if (flags & (SQLITE_OPEN_MAIN_DB | SQLITE_OPEN_WAL)) == 0 {
 73622  		return (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 24 /* &.xOpen */))))(tls, pOrigVfs, zName, pConn, flags, pOutFlags)
 73623  	}
 73624  
 73625  	// If the name of the file does not match any quota group, then
 73626  	// use the normal xOpen method.
 73627  	quotaEnter(tls)
 73628  	pGroup = quotaGroupFind(tls, zName)
 73629  	if pGroup == uintptr(0) {
 73630  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 24 /* &.xOpen */))))(tls, pOrigVfs, zName, pConn, flags, pOutFlags)
 73631  	} else {
 73632  		// If we get to this point, it means the file needs to be quota tracked.
 73633  		pQuotaOpen = pConn
 73634  		pSubOpen = quotaSubOpen(tls, pConn)
 73635  		rc = (*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((pOrigVfs + 24 /* &.xOpen */))))(tls, pOrigVfs, zName, pSubOpen, flags, pOutFlags)
 73636  		if rc == SQLITE_OK {
 73637  			pFile = quotaFindFile(tls, pGroup, zName, 1)
 73638  			if pFile == uintptr(0) {
 73639  				quotaLeave(tls)
 73640  				(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 4 /* &.xClose */))))(tls, pSubOpen)
 73641  				return SQLITE_NOMEM
 73642  			}
 73643  			(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = (libc.Bool32((flags & SQLITE_OPEN_DELETEONCLOSE) != 0))
 73644  			(*quotaFile)(unsafe.Pointer(pFile)).FnRef++
 73645  			(*quotaConn)(unsafe.Pointer(pQuotaOpen)).FpFile = pFile
 73646  			if (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods)).FiVersion == 1 {
 73647  				(*quotaConn)(unsafe.Pointer(pQuotaOpen)).Fbase.FpMethods = (uintptr(unsafe.Pointer(&gQuota)) + 92 /* &.sIoMethodsV1 */)
 73648  			} else {
 73649  				(*quotaConn)(unsafe.Pointer(pQuotaOpen)).Fbase.FpMethods = (uintptr(unsafe.Pointer(&gQuota)) + 168 /* &.sIoMethodsV2 */)
 73650  			}
 73651  		}
 73652  	}
 73653  	quotaLeave(tls)
 73654  	return rc
 73655  }
 73656  
 73657  // This is the xDelete method used for the "quota" VFS.
 73658  //
 73659  // If the file being deleted is part of the quota group, then reduce
 73660  // the size of the quota group accordingly.  And remove the file from
 73661  // the set of files in the quota group.
 73662  func quotaDelete(tls *libc.TLS, pVfs uintptr, zName uintptr, syncDir int32) int32 { /* test_quota.c:486:12: */
 73663  	var rc int32                            // Result code
 73664  	var pFile uintptr                       // Files in the quota
 73665  	var pGroup uintptr                      // The group file belongs to
 73666  	var pOrigVfs uintptr = gQuota.FpOrigVfs // Real VFS
 73667  
 73668  	// Do the actual file delete
 73669  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((pOrigVfs + 28 /* &.xDelete */))))(tls, pOrigVfs, zName, syncDir)
 73670  
 73671  	// If the file just deleted is a member of a quota group, then remove
 73672  	// it from that quota group.
 73673  	if rc == SQLITE_OK {
 73674  		quotaEnter(tls)
 73675  		pGroup = quotaGroupFind(tls, zName)
 73676  		if pGroup != 0 {
 73677  			pFile = quotaFindFile(tls, pGroup, zName, 0)
 73678  			if pFile != 0 {
 73679  				if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 73680  					(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = 1
 73681  				} else {
 73682  					quotaRemoveFile(tls, pFile)
 73683  					quotaGroupDeref(tls, pGroup)
 73684  				}
 73685  			}
 73686  		}
 73687  		quotaLeave(tls)
 73688  	}
 73689  	return rc
 73690  }
 73691  
 73692  //*********************** I/O Method Wrappers ******************************
 73693  
 73694  // xClose requests get passed through to the original VFS.  But we
 73695  // also have to unlink the quotaConn from the quotaFile and quotaGroup.
 73696  // The quotaFile and/or quotaGroup are freed if they are no longer in use.
 73697  func quotaClose(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:528:12: */
 73698  	var p uintptr = pConn
 73699  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 73700  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73701  	var rc int32
 73702  	rc = (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 4 /* &.xClose */))))(tls, pSubOpen)
 73703  	quotaEnter(tls)
 73704  	(*quotaFile)(unsafe.Pointer(pFile)).FnRef--
 73705  	if (*quotaFile)(unsafe.Pointer(pFile)).FnRef == 0 {
 73706  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 73707  		if (*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose != 0 {
 73708  			(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 28 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 73709  			quotaRemoveFile(tls, pFile)
 73710  		}
 73711  		quotaGroupDeref(tls, pGroup)
 73712  	}
 73713  	quotaLeave(tls)
 73714  	return rc
 73715  }
 73716  
 73717  // Pass xRead requests directory thru to the original VFS without
 73718  // further processing.
 73719  func quotaRead(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_quota.c:551:12: */
 73720  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73721  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 8 /* &.xRead */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 73722  }
 73723  
 73724  // Check xWrite requests to see if they expand the file.  If they do,
 73725  // the perform a quota check before passing them through to the
 73726  // original VFS.
 73727  func quotaWrite(tls *libc.TLS, pConn uintptr, pBuf uintptr, iAmt int32, iOfst sqlite3_int64) int32 { /* test_quota.c:565:12: */
 73728  	var p uintptr = pConn
 73729  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73730  	var iEnd sqlite3_int64 = (iOfst + sqlite3_int64(iAmt))
 73731  	var pGroup uintptr
 73732  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 73733  	var szNew sqlite3_int64
 73734  
 73735  	if (*quotaFile)(unsafe.Pointer(pFile)).FiSize < iEnd {
 73736  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 73737  		quotaEnter(tls)
 73738  		szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 73739  		if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 73740  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback != 0 {
 73741  				(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr))(unsafe.Pointer((pGroup + 24 /* &.xCallback */))))(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, (pGroup + 8 /* &.iLimit */), szNew,
 73742  					(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 73743  			}
 73744  			if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 73745  				quotaLeave(tls)
 73746  				return SQLITE_FULL
 73747  			}
 73748  		}
 73749  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiSize = szNew
 73750  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iEnd
 73751  		quotaLeave(tls)
 73752  	}
 73753  	return (*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 12 /* &.xWrite */))))(tls, pSubOpen, pBuf, iAmt, iOfst)
 73754  }
 73755  
 73756  // Pass xTruncate requests thru to the original VFS.  If the
 73757  // success, update the file size.
 73758  func quotaTruncate(tls *libc.TLS, pConn uintptr, size sqlite3_int64) int32 { /* test_quota.c:602:12: */
 73759  	var p uintptr = pConn
 73760  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73761  	var rc int32 = (*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 16 /* &.xTruncate */))))(tls, pSubOpen, size)
 73762  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 73763  	var pGroup uintptr
 73764  	if rc == SQLITE_OK {
 73765  		quotaEnter(tls)
 73766  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 73767  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 73768  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = size
 73769  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (size)
 73770  		quotaLeave(tls)
 73771  	}
 73772  	return rc
 73773  }
 73774  
 73775  // Pass xSync requests through to the original VFS without change
 73776  func quotaSync(tls *libc.TLS, pConn uintptr, flags int32) int32 { /* test_quota.c:621:12: */
 73777  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73778  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 20 /* &.xSync */))))(tls, pSubOpen, flags)
 73779  }
 73780  
 73781  // Pass xFileSize requests through to the original VFS but then
 73782  // update the quotaGroup with the new size before returning.
 73783  func quotaFileSize(tls *libc.TLS, pConn uintptr, pSize uintptr) int32 { /* test_quota.c:629:12: */
 73784  	bp := tls.Alloc(8)
 73785  	defer tls.Free(8)
 73786  
 73787  	var p uintptr = pConn
 73788  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73789  	var pFile uintptr = (*quotaConn)(unsafe.Pointer(p)).FpFile
 73790  	var pGroup uintptr
 73791  	// var sz sqlite3_int64 at bp, 8
 73792  
 73793  	var rc int32
 73794  
 73795  	rc = (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 24 /* &.xFileSize */))))(tls, pSubOpen, bp /* &sz */)
 73796  	if rc == SQLITE_OK {
 73797  		quotaEnter(tls)
 73798  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 73799  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) -= ((*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 73800  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 73801  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (*(*sqlite3_int64)(unsafe.Pointer(bp /* sz */)))
 73802  		quotaLeave(tls)
 73803  		*(*sqlite3_int64)(unsafe.Pointer(pSize)) = *(*sqlite3_int64)(unsafe.Pointer(bp /* sz */))
 73804  	}
 73805  	return rc
 73806  }
 73807  
 73808  // Pass xLock requests through to the original VFS unchanged.
 73809  func quotaLock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_quota.c:652:12: */
 73810  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73811  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 28 /* &.xLock */))))(tls, pSubOpen, lock)
 73812  }
 73813  
 73814  // Pass xUnlock requests through to the original VFS unchanged.
 73815  func quotaUnlock(tls *libc.TLS, pConn uintptr, lock int32) int32 { /* test_quota.c:659:12: */
 73816  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73817  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 32 /* &.xUnlock */))))(tls, pSubOpen, lock)
 73818  }
 73819  
 73820  // Pass xCheckReservedLock requests through to the original VFS unchanged.
 73821  func quotaCheckReservedLock(tls *libc.TLS, pConn uintptr, pResOut uintptr) int32 { /* test_quota.c:666:12: */
 73822  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73823  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 36 /* &.xCheckReservedLock */))))(tls, pSubOpen, pResOut)
 73824  }
 73825  
 73826  // Pass xFileControl requests through to the original VFS unchanged.
 73827  func quotaFileControl(tls *libc.TLS, pConn uintptr, op int32, pArg uintptr) int32 { /* test_quota.c:673:12: */
 73828  	bp := tls.Alloc(8)
 73829  	defer tls.Free(8)
 73830  
 73831  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73832  	var rc int32 = (*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 40 /* &.xFileControl */))))(tls, pSubOpen, op, pArg)
 73833  	if (op == SQLITE_FCNTL_VFSNAME) && (rc == SQLITE_OK) {
 73834  		*(*uintptr)(unsafe.Pointer(pArg)) = sqlite3.Xsqlite3_mprintf(tls, ts+36042 /* "quota/%z" */, libc.VaList(bp, *(*uintptr)(unsafe.Pointer(pArg))))
 73835  	}
 73836  	return rc
 73837  }
 73838  
 73839  // Pass xSectorSize requests through to the original VFS unchanged.
 73840  func quotaSectorSize(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:686:12: */
 73841  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73842  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 44 /* &.xSectorSize */))))(tls, pSubOpen)
 73843  }
 73844  
 73845  // Pass xDeviceCharacteristics requests through to the original VFS unchanged.
 73846  func quotaDeviceCharacteristics(tls *libc.TLS, pConn uintptr) int32 { /* test_quota.c:693:12: */
 73847  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73848  	return (*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 48 /* &.xDeviceCharacteristics */))))(tls, pSubOpen)
 73849  }
 73850  
 73851  // Pass xShmMap requests through to the original VFS unchanged.
 73852  func quotaShmMap(tls *libc.TLS, pConn uintptr, iRegion int32, szRegion int32, bExtend int32, pp uintptr) int32 { /* test_quota.c:700:12: */
 73853  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73854  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 52 /* &.xShmMap */))))(tls, pSubOpen, iRegion, szRegion, bExtend, libc.AtomicLoadUintptr(&pp))
 73855  }
 73856  
 73857  // Pass xShmLock requests through to the original VFS unchanged.
 73858  func quotaShmLock(tls *libc.TLS, pConn uintptr, ofst int32, n int32, flags int32) int32 { /* test_quota.c:713:12: */
 73859  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73860  	return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 56 /* &.xShmLock */))))(tls, pSubOpen, ofst, n, flags)
 73861  }
 73862  
 73863  // Pass xShmBarrier requests through to the original VFS unchanged.
 73864  func quotaShmBarrier(tls *libc.TLS, pConn uintptr) { /* test_quota.c:725:13: */
 73865  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73866  	(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pSubOpen)
 73867  }
 73868  
 73869  // Pass xShmUnmap requests through to the original VFS unchanged.
 73870  func quotaShmUnmap(tls *libc.TLS, pConn uintptr, deleteFlag int32) int32 { /* test_quota.c:732:12: */
 73871  	var pSubOpen uintptr = quotaSubOpen(tls, pConn)
 73872  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pSubOpen)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pSubOpen, deleteFlag)
 73873  }
 73874  
 73875  //************************* Public Interfaces ****************************
 73876  // Initialize the quota VFS shim.  Use the VFS named zOrigVfsName
 73877  // as the VFS that does the actual work.  Use the default if
 73878  // zOrigVfsName==NULL.
 73879  //
 73880  // The quota VFS shim is named "quota".  It will become the default
 73881  // VFS if makeDefault is non-zero.
 73882  //
 73883  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once
 73884  // during start-up.
 73885  func sqlite3_quota_initialize(tls *libc.TLS, zOrigVfsName uintptr, makeDefault int32) int32 { /* test_quota.c:749:5: */
 73886  	var pOrigVfs uintptr
 73887  	if gQuota.FisInitialized != 0 {
 73888  		return SQLITE_MISUSE
 73889  	}
 73890  	pOrigVfs = sqlite3.Xsqlite3_vfs_find(tls, zOrigVfsName)
 73891  	if pOrigVfs == uintptr(0) {
 73892  		return SQLITE_ERROR
 73893  	}
 73894  
 73895  	gQuota.FpMutex = sqlite3.Xsqlite3_mutex_alloc(tls, SQLITE_MUTEX_FAST)
 73896  	if !(int32(gQuota.FpMutex) != 0) {
 73897  		return SQLITE_NOMEM
 73898  	}
 73899  	gQuota.FisInitialized = 1
 73900  	gQuota.FpOrigVfs = pOrigVfs
 73901  	gQuota.FsThisVfs = *(*sqlite3_vfs)(unsafe.Pointer(pOrigVfs))
 73902  	gQuota.FsThisVfs.FxOpen = *(*uintptr)(unsafe.Pointer(&struct {
 73903  		f func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32
 73904  	}{quotaOpen}))
 73905  	gQuota.FsThisVfs.FxDelete = *(*uintptr)(unsafe.Pointer(&struct {
 73906  		f func(*libc.TLS, uintptr, uintptr, int32) int32
 73907  	}{quotaDelete}))
 73908  	*(*int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&gQuota)) + 4 /* &.sThisVfs */ + 4 /* &.szOsFile */)) += int32((uint32(unsafe.Sizeof(quotaConn{}))))
 73909  	gQuota.FsThisVfs.FzName = ts + 36051 /* "quota" */
 73910  	gQuota.FsIoMethodsV1.FiVersion = 1
 73911  	gQuota.FsIoMethodsV1.FxClose = *(*uintptr)(unsafe.Pointer(&struct {
 73912  		f func(*libc.TLS, uintptr) int32
 73913  	}{quotaClose}))
 73914  	gQuota.FsIoMethodsV1.FxRead = *(*uintptr)(unsafe.Pointer(&struct {
 73915  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 73916  	}{quotaRead}))
 73917  	gQuota.FsIoMethodsV1.FxWrite = *(*uintptr)(unsafe.Pointer(&struct {
 73918  		f func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32
 73919  	}{quotaWrite}))
 73920  	gQuota.FsIoMethodsV1.FxTruncate = *(*uintptr)(unsafe.Pointer(&struct {
 73921  		f func(*libc.TLS, uintptr, sqlite3_int64) int32
 73922  	}{quotaTruncate}))
 73923  	gQuota.FsIoMethodsV1.FxSync = *(*uintptr)(unsafe.Pointer(&struct {
 73924  		f func(*libc.TLS, uintptr, int32) int32
 73925  	}{quotaSync}))
 73926  	gQuota.FsIoMethodsV1.FxFileSize = *(*uintptr)(unsafe.Pointer(&struct {
 73927  		f func(*libc.TLS, uintptr, uintptr) int32
 73928  	}{quotaFileSize}))
 73929  	gQuota.FsIoMethodsV1.FxLock = *(*uintptr)(unsafe.Pointer(&struct {
 73930  		f func(*libc.TLS, uintptr, int32) int32
 73931  	}{quotaLock}))
 73932  	gQuota.FsIoMethodsV1.FxUnlock = *(*uintptr)(unsafe.Pointer(&struct {
 73933  		f func(*libc.TLS, uintptr, int32) int32
 73934  	}{quotaUnlock}))
 73935  	gQuota.FsIoMethodsV1.FxCheckReservedLock = *(*uintptr)(unsafe.Pointer(&struct {
 73936  		f func(*libc.TLS, uintptr, uintptr) int32
 73937  	}{quotaCheckReservedLock}))
 73938  	gQuota.FsIoMethodsV1.FxFileControl = *(*uintptr)(unsafe.Pointer(&struct {
 73939  		f func(*libc.TLS, uintptr, int32, uintptr) int32
 73940  	}{quotaFileControl}))
 73941  	gQuota.FsIoMethodsV1.FxSectorSize = *(*uintptr)(unsafe.Pointer(&struct {
 73942  		f func(*libc.TLS, uintptr) int32
 73943  	}{quotaSectorSize}))
 73944  	gQuota.FsIoMethodsV1.FxDeviceCharacteristics = *(*uintptr)(unsafe.Pointer(&struct {
 73945  		f func(*libc.TLS, uintptr) int32
 73946  	}{quotaDeviceCharacteristics}))
 73947  	gQuota.FsIoMethodsV2 = gQuota.FsIoMethodsV1
 73948  	gQuota.FsIoMethodsV2.FiVersion = 2
 73949  	gQuota.FsIoMethodsV2.FxShmMap = *(*uintptr)(unsafe.Pointer(&struct {
 73950  		f func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32
 73951  	}{quotaShmMap}))
 73952  	gQuota.FsIoMethodsV2.FxShmLock = *(*uintptr)(unsafe.Pointer(&struct {
 73953  		f func(*libc.TLS, uintptr, int32, int32, int32) int32
 73954  	}{quotaShmLock}))
 73955  	gQuota.FsIoMethodsV2.FxShmBarrier = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{quotaShmBarrier}))
 73956  	gQuota.FsIoMethodsV2.FxShmUnmap = *(*uintptr)(unsafe.Pointer(&struct {
 73957  		f func(*libc.TLS, uintptr, int32) int32
 73958  	}{quotaShmUnmap}))
 73959  	sqlite3.Xsqlite3_vfs_register(tls, (uintptr(unsafe.Pointer(&gQuota)) + 4 /* &.sThisVfs */), makeDefault)
 73960  	return SQLITE_OK
 73961  }
 73962  
 73963  // Shutdown the quota system.
 73964  //
 73965  // All SQLite database connections must be closed before calling this
 73966  // routine.
 73967  //
 73968  // THIS ROUTINE IS NOT THREADSAFE.  Call this routine exactly once while
 73969  // shutting down in order to free all remaining quota groups.
 73970  func sqlite3_quota_shutdown(tls *libc.TLS) int32 { /* test_quota.c:798:5: */
 73971  	var pGroup uintptr
 73972  	if gQuota.FisInitialized == 0 {
 73973  		return SQLITE_MISUSE
 73974  	}
 73975  	for pGroup = gQuota.FpGroup; pGroup != 0; pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext {
 73976  		if quotaGroupOpenFileCount(tls, pGroup) > 0 {
 73977  			return SQLITE_MISUSE
 73978  		}
 73979  	}
 73980  	for gQuota.FpGroup != 0 {
 73981  		pGroup = gQuota.FpGroup
 73982  		gQuota.FpGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 73983  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit = int64(0)
 73984  
 73985  		quotaGroupDeref(tls, pGroup)
 73986  	}
 73987  	gQuota.FisInitialized = 0
 73988  	sqlite3.Xsqlite3_mutex_free(tls, gQuota.FpMutex)
 73989  	sqlite3.Xsqlite3_vfs_unregister(tls, (uintptr(unsafe.Pointer(&gQuota)) + 4 /* &.sThisVfs */))
 73990  	libc.Xmemset(tls, uintptr(unsafe.Pointer(&gQuota)), 0, uint32(unsafe.Sizeof(gQuota)))
 73991  	return SQLITE_OK
 73992  }
 73993  
 73994  // Create or destroy a quota group.
 73995  //
 73996  // The quota group is defined by the zPattern.  When calling this routine
 73997  // with a zPattern for a quota group that already exists, this routine
 73998  // merely updates the iLimit, xCallback, and pArg values for that quota
 73999  // group.  If zPattern is new, then a new quota group is created.
 74000  //
 74001  // If the iLimit for a quota group is set to zero, then the quota group
 74002  // is disabled and will be deleted when the last database connection using
 74003  // the quota group is closed.
 74004  //
 74005  // Calling this routine on a zPattern that does not exist and with a
 74006  // zero iLimit is a no-op.
 74007  //
 74008  // A quota group must exist with a non-zero iLimit prior to opening
 74009  // database connections if those connections are to participate in the
 74010  // quota group.  Creating a quota group does not affect database connections
 74011  // that are already open.
 74012  func sqlite3_quota_set(tls *libc.TLS, zPattern uintptr, iLimit sqlite3_int64, xCallback uintptr, pArg uintptr, xDestroy uintptr) int32 { /* test_quota.c:838:5: */
 74013  	var pGroup uintptr
 74014  	quotaEnter(tls)
 74015  	pGroup = gQuota.FpGroup
 74016  	for (pGroup != 0) && (libc.Xstrcmp(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, zPattern) != 0) {
 74017  		pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext
 74018  	}
 74019  	if pGroup == uintptr(0) {
 74020  		var nPattern int32 = (int32(libc.Xstrlen(tls, zPattern) & size_t(0x3fffffff)))
 74021  		if iLimit <= int64(0) {
 74022  			quotaLeave(tls)
 74023  			return SQLITE_OK
 74024  		}
 74025  		pGroup = sqlite3.Xsqlite3_malloc(tls, (int32((uint32(unsafe.Sizeof(quotaGroup{})) + uint32(nPattern)) + uint32(1))))
 74026  		if pGroup == uintptr(0) {
 74027  			quotaLeave(tls)
 74028  			return SQLITE_NOMEM
 74029  		}
 74030  		libc.Xmemset(tls, pGroup, 0, uint32(unsafe.Sizeof(quotaGroup{})))
 74031  		(*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern = (pGroup + 1*48)
 74032  		libc.Xmemcpy(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, zPattern, (uint32(nPattern + 1)))
 74033  		if gQuota.FpGroup != 0 {
 74034  			(*quotaGroup)(unsafe.Pointer(gQuota.FpGroup)).FppPrev = (pGroup + 36 /* &.pNext */)
 74035  		}
 74036  		(*quotaGroup)(unsafe.Pointer(pGroup)).FpNext = gQuota.FpGroup
 74037  		(*quotaGroup)(unsafe.Pointer(pGroup)).FppPrev = (uintptr(unsafe.Pointer(&gQuota)) + 252 /* &.pGroup */)
 74038  		gQuota.FpGroup = pGroup
 74039  	}
 74040  	(*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit = iLimit
 74041  	(*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback = xCallback
 74042  	if ((*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy != 0) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FpArg != pArg) {
 74043  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer((pGroup + 32 /* &.xDestroy */))))(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 74044  	}
 74045  	(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg = pArg
 74046  	(*quotaGroup)(unsafe.Pointer(pGroup)).FxDestroy = xDestroy
 74047  	quotaGroupDeref(tls, pGroup)
 74048  	quotaLeave(tls)
 74049  	return SQLITE_OK
 74050  }
 74051  
 74052  // Bring the named file under quota management.  Or if it is already under
 74053  // management, update its size.
 74054  func sqlite3_quota_file(tls *libc.TLS, zFilename uintptr) int32 { /* test_quota.c:891:5: */
 74055  	bp := tls.Alloc(16)
 74056  	defer tls.Free(16)
 74057  
 74058  	var zFull uintptr = uintptr(0)
 74059  	var fd uintptr
 74060  	var rc int32
 74061  	*(*int32)(unsafe.Pointer(bp /* outFlags */)) = 0
 74062  	// var iSize sqlite3_int64 at bp+8, 8
 74063  
 74064  	var nAlloc int32 = ((gQuota.FsThisVfs.FszOsFile + gQuota.FsThisVfs.FmxPathname) + 2)
 74065  
 74066  	// Allocate space for a file-handle and the full path for file zFilename
 74067  	fd = sqlite3.Xsqlite3_malloc(tls, nAlloc)
 74068  	if fd == uintptr(0) {
 74069  		rc = SQLITE_NOMEM
 74070  	} else {
 74071  		zFull = ((fd) + uintptr(gQuota.FsThisVfs.FszOsFile))
 74072  		rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 36 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 74073  			(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 74074  	}
 74075  
 74076  	if rc == SQLITE_OK {
 74077  		*(*int8)(unsafe.Pointer(zFull + uintptr((libc.Xstrlen(tls, zFull) + size_t(1))))) = int8(0)
 74078  		rc = quotaOpen(tls, (uintptr(unsafe.Pointer(&gQuota)) + 4 /* &.sThisVfs */), zFull, fd,
 74079  			(SQLITE_OPEN_READONLY | SQLITE_OPEN_MAIN_DB), bp /* &outFlags */)
 74080  		if rc == SQLITE_OK {
 74081  			(*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods + 24 /* &.xFileSize */))))(tls, fd, bp+8 /* &iSize */)
 74082  			(*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods + 4 /* &.xClose */))))(tls, fd)
 74083  		} else if rc == SQLITE_CANTOPEN {
 74084  			var pGroup uintptr
 74085  			var pFile uintptr
 74086  			quotaEnter(tls)
 74087  			pGroup = quotaGroupFind(tls, zFull)
 74088  			if pGroup != 0 {
 74089  				pFile = quotaFindFile(tls, pGroup, zFull, 0)
 74090  				if pFile != 0 {
 74091  					quotaRemoveFile(tls, pFile)
 74092  				}
 74093  			}
 74094  			quotaLeave(tls)
 74095  		}
 74096  	}
 74097  
 74098  	sqlite3.Xsqlite3_free(tls, fd)
 74099  	return rc
 74100  }
 74101  
 74102  // Open a potentially quotaed file for I/O.
 74103  func sqlite3_quota_fopen(tls *libc.TLS, zFilename uintptr, zMode uintptr) uintptr { /* test_quota.c:936:12: */
 74104  	var p uintptr
 74105  	var zFull uintptr
 74106  	var zFullTranslated uintptr
 74107  	var rc int32
 74108  	var pGroup uintptr
 74109  	var pFile uintptr
 74110  	p = uintptr(0)
 74111  	zFull = uintptr(0)
 74112  	zFullTranslated = uintptr(0)
 74113  
 74114  	zFull = sqlite3.Xsqlite3_malloc(tls, (gQuota.FsThisVfs.FmxPathname + 1))
 74115  	if !(zFull == uintptr(0)) {
 74116  		goto __1
 74117  	}
 74118  	return uintptr(0)
 74119  __1:
 74120  	;
 74121  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 36 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 74122  		(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 74123  	if !(rc != 0) {
 74124  		goto __2
 74125  	}
 74126  	goto quota_fopen_error
 74127  __2:
 74128  	;
 74129  	p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(quota_FILE{})))
 74130  	if !(p == uintptr(0)) {
 74131  		goto __3
 74132  	}
 74133  	goto quota_fopen_error
 74134  __3:
 74135  	;
 74136  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(quota_FILE{})))
 74137  	zFullTranslated = quota_utf8_to_mbcs(tls, zFull)
 74138  	if !(zFullTranslated == uintptr(0)) {
 74139  		goto __4
 74140  	}
 74141  	goto quota_fopen_error
 74142  __4:
 74143  	;
 74144  	(*quota_FILE)(unsafe.Pointer(p)).Ff = libc.Xfopen(tls, zFullTranslated, zMode)
 74145  	if !((*quota_FILE)(unsafe.Pointer(p)).Ff == uintptr(0)) {
 74146  		goto __5
 74147  	}
 74148  	goto quota_fopen_error
 74149  __5:
 74150  	;
 74151  	quotaEnter(tls)
 74152  	pGroup = quotaGroupFind(tls, zFull)
 74153  	if !(pGroup != 0) {
 74154  		goto __6
 74155  	}
 74156  	pFile = quotaFindFile(tls, pGroup, zFull, 1)
 74157  	if !(pFile == uintptr(0)) {
 74158  		goto __7
 74159  	}
 74160  	quotaLeave(tls)
 74161  	goto quota_fopen_error
 74162  __7:
 74163  	;
 74164  	(*quotaFile)(unsafe.Pointer(pFile)).FnRef++
 74165  	(*quota_FILE)(unsafe.Pointer(p)).FpFile = pFile
 74166  __6:
 74167  	;
 74168  	quotaLeave(tls)
 74169  	sqlite3.Xsqlite3_free(tls, zFull)
 74170  	return p
 74171  
 74172  quota_fopen_error:
 74173  	quota_mbcs_free(tls, zFullTranslated)
 74174  	sqlite3.Xsqlite3_free(tls, zFull)
 74175  	if !((p != 0) && ((*quota_FILE)(unsafe.Pointer(p)).Ff != 0)) {
 74176  		goto __8
 74177  	}
 74178  	libc.Xfclose(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74179  __8:
 74180  	;
 74181  	sqlite3.Xsqlite3_free(tls, p)
 74182  	return uintptr(0)
 74183  }
 74184  
 74185  // Read content from a quota_FILE
 74186  func sqlite3_quota_fread(tls *libc.TLS, pBuf uintptr, size size_t, nmemb size_t, p uintptr) size_t { /* test_quota.c:985:8: */
 74187  	return libc.Xfread(tls, pBuf, size, nmemb, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74188  }
 74189  
 74190  // Write content into a quota_FILE.  Invoke the quota callback and block
 74191  // the write if we exceed quota.
 74192  func sqlite3_quota_fwrite(tls *libc.TLS, pBuf uintptr, size size_t, nmemb size_t, p uintptr) size_t { /* test_quota.c:998:8: */
 74193  	var iOfst sqlite3_int64
 74194  	var iEnd sqlite3_int64
 74195  	var szNew sqlite3_int64
 74196  	var pFile uintptr
 74197  	var rc size_t
 74198  
 74199  	iOfst = sqlite3_int64(libc.Xftell(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff))
 74200  	iEnd = (iOfst + (sqlite3_int64(size * nmemb)))
 74201  	pFile = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 74202  	if (pFile != 0) && ((*quotaFile)(unsafe.Pointer(pFile)).FiSize < iEnd) {
 74203  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 74204  		quotaEnter(tls)
 74205  		szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 74206  		if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 74207  			if (*quotaGroup)(unsafe.Pointer(pGroup)).FxCallback != 0 {
 74208  				(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr))(unsafe.Pointer((pGroup + 24 /* &.xCallback */))))(tls, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, (pGroup + 8 /* &.iLimit */), szNew,
 74209  					(*quotaGroup)(unsafe.Pointer(pGroup)).FpArg)
 74210  			}
 74211  			if (szNew > (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit) && ((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit > int64(0)) {
 74212  				iEnd = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit - (*quotaGroup)(unsafe.Pointer(pGroup)).FiSize) + (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 74213  				nmemb = (size_t((iEnd - iOfst) / sqlite3_int64(size)))
 74214  				iEnd = (iOfst + (sqlite3_int64(size * nmemb)))
 74215  				szNew = (((*quotaGroup)(unsafe.Pointer(pGroup)).FiSize - (*quotaFile)(unsafe.Pointer(pFile)).FiSize) + iEnd)
 74216  			}
 74217  		}
 74218  		(*quotaGroup)(unsafe.Pointer(pGroup)).FiSize = szNew
 74219  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iEnd
 74220  		quotaLeave(tls)
 74221  	} else {
 74222  		pFile = uintptr(0)
 74223  	}
 74224  	rc = libc.Xfwrite(tls, pBuf, size, nmemb, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74225  
 74226  	// If the write was incomplete, adjust the file size and group size
 74227  	// downward
 74228  	if (rc < nmemb) && (pFile != 0) {
 74229  		var nWritten size_t = rc
 74230  		var iNewEnd sqlite3_int64 = (iOfst + (sqlite3_int64(size * nWritten)))
 74231  		if iNewEnd < iEnd {
 74232  			iNewEnd = iEnd
 74233  		}
 74234  		quotaEnter(tls)
 74235  		*(*sqlite3_int64)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FpGroup + 16 /* &.iSize */)) += (iNewEnd - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 74236  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = iNewEnd
 74237  		quotaLeave(tls)
 74238  	}
 74239  	return rc
 74240  }
 74241  
 74242  // Close an open quota_FILE stream.
 74243  func sqlite3_quota_fclose(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1054:5: */
 74244  	var rc int32
 74245  	var pFile uintptr
 74246  	rc = libc.Xfclose(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74247  	pFile = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 74248  	if pFile != 0 {
 74249  		quotaEnter(tls)
 74250  		(*quotaFile)(unsafe.Pointer(pFile)).FnRef--
 74251  		if (*quotaFile)(unsafe.Pointer(pFile)).FnRef == 0 {
 74252  			var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 74253  			if (*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose != 0 {
 74254  				(*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 28 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 74255  				quotaRemoveFile(tls, pFile)
 74256  			}
 74257  			quotaGroupDeref(tls, pGroup)
 74258  		}
 74259  		quotaLeave(tls)
 74260  	}
 74261  	sqlite3.Xsqlite3_free(tls, p)
 74262  	return rc
 74263  }
 74264  
 74265  // Flush memory buffers for a quota_FILE to disk.
 74266  func sqlite3_quota_fflush(tls *libc.TLS, p uintptr, doFsync int32) int32 { /* test_quota.c:1082:5: */
 74267  	var rc int32
 74268  	rc = libc.Xfflush(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74269  	if (rc == 0) && (doFsync != 0) {
 74270  		rc = libc.Xfsync(tls, libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff))
 74271  	}
 74272  	return (libc.Bool32(rc != 0))
 74273  }
 74274  
 74275  // Seek on a quota_FILE stream.
 74276  func sqlite3_quota_fseek(tls *libc.TLS, p uintptr, offset int32, whence int32) int32 { /* test_quota.c:1099:5: */
 74277  	return libc.Xfseek(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff, offset, whence)
 74278  }
 74279  
 74280  // rewind a quota_FILE stream.
 74281  func sqlite3_quota_rewind(tls *libc.TLS, p uintptr) { /* test_quota.c:1106:6: */
 74282  	libc.Xrewind(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74283  }
 74284  
 74285  // Tell the current location of a quota_FILE stream.
 74286  func sqlite3_quota_ftell(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1113:6: */
 74287  	return libc.Xftell(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74288  }
 74289  
 74290  // Test the error indicator for the given file.
 74291  func sqlite3_quota_ferror(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1120:5: */
 74292  	return libc.Xferror(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff)
 74293  }
 74294  
 74295  // Truncate a file to szNew bytes.
 74296  func sqlite3_quota_ftruncate(tls *libc.TLS, p uintptr, szNew sqlite3_int64) int32 { /* test_quota.c:1127:5: */
 74297  	var pFile uintptr = (*quota_FILE)(unsafe.Pointer(p)).FpFile
 74298  	var rc int32
 74299  	if ((libc.AssignUintptr(&pFile, (*quota_FILE)(unsafe.Pointer(p)).FpFile)) != uintptr(0)) && ((*quotaFile)(unsafe.Pointer(pFile)).FiSize < szNew) {
 74300  		var pGroup uintptr
 74301  		if (*quotaFile)(unsafe.Pointer(pFile)).FiSize < szNew {
 74302  			// This routine cannot be used to extend a file that is under
 74303  			// quota management.  Only true truncation is allowed.
 74304  			return -1
 74305  		}
 74306  		pGroup = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 74307  		quotaEnter(tls)
 74308  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (szNew - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 74309  		quotaLeave(tls)
 74310  	}
 74311  	rc = libc.Xftruncate(tls, libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff), szNew)
 74312  	if (pFile != 0) && (rc == 0) {
 74313  		var pGroup uintptr = (*quotaFile)(unsafe.Pointer(pFile)).FpGroup
 74314  		quotaEnter(tls)
 74315  		*(*sqlite3_int64)(unsafe.Pointer(pGroup + 16 /* &.iSize */)) += (szNew - (*quotaFile)(unsafe.Pointer(pFile)).FiSize)
 74316  		(*quotaFile)(unsafe.Pointer(pFile)).FiSize = szNew
 74317  		quotaLeave(tls)
 74318  	}
 74319  	return rc
 74320  }
 74321  
 74322  // Determine the time that the given file was last modified, in
 74323  // seconds size 1970.  Write the result into *pTime.  Return 0 on
 74324  // success and non-zero on any kind of error.
 74325  func sqlite3_quota_file_mtime(tls *libc.TLS, p uintptr, pTime uintptr) int32 { /* test_quota.c:1169:5: */
 74326  	bp := tls.Alloc(104)
 74327  	defer tls.Free(104)
 74328  
 74329  	var rc int32
 74330  	// var buf stat at bp, 104
 74331  
 74332  	rc = libc.Xfstat(tls, libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff), bp /* &buf */)
 74333  	if rc == 0 {
 74334  		*(*time_t)(unsafe.Pointer(pTime)) = (*stat)(unsafe.Pointer(bp /* &buf */)).Fst_mtim.Ftv_sec
 74335  	}
 74336  	return rc
 74337  }
 74338  
 74339  // Return the true size of the file, as reported by the operating
 74340  // system.
 74341  func sqlite3_quota_file_truesize(tls *libc.TLS, p uintptr) sqlite3_int64 { /* test_quota.c:1187:15: */
 74342  	bp := tls.Alloc(104)
 74343  	defer tls.Free(104)
 74344  
 74345  	var rc int32
 74346  	// var buf stat at bp, 104
 74347  
 74348  	rc = libc.Xfstat(tls, libc.Xfileno(tls, (*quota_FILE)(unsafe.Pointer(p)).Ff), bp /* &buf */)
 74349  	if rc == 0 {
 74350  		return (*stat)(unsafe.Pointer(bp /* &buf */)).Fst_size
 74351  	}
 74352  	return int64(-1)
 74353  }
 74354  
 74355  // Return the size of the file, as it is known to the quota subsystem.
 74356  func sqlite3_quota_file_size(tls *libc.TLS, p uintptr) sqlite3_int64 { /* test_quota.c:1203:15: */
 74357  	if (*quota_FILE)(unsafe.Pointer(p)).FpFile != 0 {
 74358  		return (*quotaFile)(unsafe.Pointer((*quota_FILE)(unsafe.Pointer(p)).FpFile)).FiSize
 74359  	}
 74360  	return int64(-1)
 74361  }
 74362  
 74363  // Determine the amount of data in bytes available for reading
 74364  // in the given file.
 74365  func sqlite3_quota_file_available(tls *libc.TLS, p uintptr) int32 { /* test_quota.c:1211:6: */
 74366  	var f uintptr = (*quota_FILE)(unsafe.Pointer(p)).Ff
 74367  	var pos1 int32
 74368  	var pos2 int32
 74369  	var rc int32
 74370  	pos1 = libc.Xftell(tls, f)
 74371  	if pos1 < 0 {
 74372  		return -1
 74373  	}
 74374  	rc = libc.Xfseek(tls, f, 0, SEEK_END)
 74375  	if rc != 0 {
 74376  		return -1
 74377  	}
 74378  	pos2 = libc.Xftell(tls, f)
 74379  	if pos2 < 0 {
 74380  		return -1
 74381  	}
 74382  	rc = libc.Xfseek(tls, f, pos1, SEEK_SET)
 74383  	if rc != 0 {
 74384  		return -1
 74385  	}
 74386  	return (pos2 - pos1)
 74387  }
 74388  
 74389  // Remove a managed file.  Update quotas accordingly.
 74390  func sqlite3_quota_remove(tls *libc.TLS, zFilename uintptr) int32 { /* test_quota.c:1229:5: */
 74391  	var zFull uintptr     // Full pathname for zFilename
 74392  	var nFull size_t      // Number of bytes in zFilename
 74393  	var rc int32          // Result code
 74394  	var pGroup uintptr    // Group containing zFilename
 74395  	var pFile uintptr     // A file in the group
 74396  	var pNextFile uintptr // next file in the group
 74397  	var diff int32        // Difference between filenames
 74398  	var c int8            // First character past end of pattern
 74399  
 74400  	zFull = sqlite3.Xsqlite3_malloc(tls, (gQuota.FsThisVfs.FmxPathname + 1))
 74401  	if zFull == uintptr(0) {
 74402  		return SQLITE_NOMEM
 74403  	}
 74404  	rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 36 /* &.xFullPathname */))))(tls, gQuota.FpOrigVfs, zFilename,
 74405  		(gQuota.FsThisVfs.FmxPathname + 1), zFull)
 74406  	if rc != 0 {
 74407  		sqlite3.Xsqlite3_free(tls, zFull)
 74408  		return rc
 74409  	}
 74410  
 74411  	// Figure out the length of the full pathname.  If the name ends with
 74412  	// / (or \ on windows) then remove the trailing /.
 74413  	nFull = libc.Xstrlen(tls, zFull)
 74414  	if (nFull > size_t(0)) && ((int32(*(*int8)(unsafe.Pointer(zFull + uintptr((nFull - size_t(1)))))) == '/') || (int32(*(*int8)(unsafe.Pointer(zFull + uintptr((nFull - size_t(1)))))) == '\\')) {
 74415  		nFull--
 74416  		*(*int8)(unsafe.Pointer(zFull + uintptr(nFull))) = int8(0)
 74417  	}
 74418  
 74419  	quotaEnter(tls)
 74420  	pGroup = quotaGroupFind(tls, zFull)
 74421  	if pGroup != 0 {
 74422  		for pFile = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles; (pFile != 0) && (rc == SQLITE_OK); pFile = pNextFile {
 74423  			pNextFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext
 74424  			diff = libc.Xstrncmp(tls, zFull, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, nFull)
 74425  			if (diff == 0) && ((((int32(libc.AssignInt8(&c, *(*int8)(unsafe.Pointer((*quotaFile)(unsafe.Pointer(pFile)).FzFilename + uintptr(nFull)))))) == 0) || (int32(c) == '/')) || (int32(c) == '\\')) {
 74426  				if (*quotaFile)(unsafe.Pointer(pFile)).FnRef != 0 {
 74427  					(*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose = 1
 74428  				} else {
 74429  					rc = (*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer((gQuota.FpOrigVfs + 28 /* &.xDelete */))))(tls, gQuota.FpOrigVfs, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename, 0)
 74430  					quotaRemoveFile(tls, pFile)
 74431  					quotaGroupDeref(tls, pGroup)
 74432  				}
 74433  			}
 74434  		}
 74435  	}
 74436  	quotaLeave(tls)
 74437  	sqlite3.Xsqlite3_free(tls, zFull)
 74438  	return rc
 74439  }
 74440  
 74441  // end block for C++
 74442  
 74443  // Local Variables:
 74444  // mode: c
 74445  // c-basic-offset: 4
 74446  // fill-column: 78
 74447  // End:
 74448  
 74449  // Argument passed to a TCL quota-over-limit callback.
 74450  type TclQuotaCallback1 = struct {
 74451  	Finterp  uintptr
 74452  	FpScript uintptr
 74453  } /* test_quota.c:1293:9 */
 74454  
 74455  // end block for C++
 74456  
 74457  // Local Variables:
 74458  // mode: c
 74459  // c-basic-offset: 4
 74460  // fill-column: 78
 74461  // End:
 74462  
 74463  // Argument passed to a TCL quota-over-limit callback.
 74464  type TclQuotaCallback = TclQuotaCallback1 /* test_quota.c:1293:33 */
 74465  
 74466  // This is the callback from a quota-over-limit.
 74467  func tclQuotaCallback(tls *libc.TLS, zFilename uintptr, piLimit uintptr, iSize sqlite3_int64, pArg uintptr) { /* test_quota.c:1305:13: */
 74468  	bp := tls.Alloc(16)
 74469  	defer tls.Free(16)
 74470  
 74471  	var p uintptr        // Callback script object
 74472  	var pEval uintptr    // Script to evaluate
 74473  	var pVarname uintptr // Name of variable to pass as 2nd arg
 74474  	// var rnd uint32 at bp, 4
 74475  	// Random part of pVarname
 74476  	var rc int32 // Tcl error code
 74477  
 74478  	p = pArg
 74479  	if p == uintptr(0) {
 74480  		return
 74481  	}
 74482  
 74483  	pVarname = tcl.XTcl_NewStringObj(tls, ts+36057 /* "::piLimit_" */, -1)
 74484  	(*Tcl_Obj)(unsafe.Pointer(pVarname)).FrefCount++
 74485  	sqlite3.Xsqlite3_randomness(tls, int32(unsafe.Sizeof(uint32(0))), bp /* &rnd */)
 74486  	tcl.XTcl_AppendObjToObj(tls, pVarname, tcl.XTcl_NewIntObj(tls, (int32(*(*uint32)(unsafe.Pointer(bp /* rnd */))&uint32(0x7FFFFFFF)))))
 74487  	tcl.XTcl_ObjSetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pVarname, uintptr(0), tcl.XTcl_NewWideIntObj(tls, *(*sqlite3_int64)(unsafe.Pointer(piLimit))), 0)
 74488  
 74489  	pEval = tcl.XTcl_DuplicateObj(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).FpScript)
 74490  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 74491  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewStringObj(tls, zFilename, -1))
 74492  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, pVarname)
 74493  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pEval, tcl.XTcl_NewWideIntObj(tls, iSize))
 74494  	rc = tcl.XTcl_EvalObjEx(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 74495  
 74496  	if rc == TCL_OK {
 74497  		// var x Tcl_WideInt at bp+8, 8
 74498  
 74499  		var pLimit uintptr = tcl.XTcl_ObjGetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pVarname, uintptr(0), 0)
 74500  		rc = tcl.XTcl_GetWideIntFromObj(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, pLimit, bp+8 /* &x */)
 74501  		*(*sqlite3_int64)(unsafe.Pointer(piLimit)) = *(*Tcl_WideInt)(unsafe.Pointer(bp + 8 /* x */))
 74502  		tcl.XTcl_UnsetVar2(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetString(tls, pVarname), uintptr(0), 0)
 74503  	}
 74504  
 74505  	for ok := true; ok; ok = 0 != 0 {
 74506  		var _objPtr uintptr = pEval
 74507  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 74508  			tcl.XTclFreeObj(tls, _objPtr)
 74509  		}
 74510  	}
 74511  	for ok1 := true; ok1; ok1 = 0 != 0 {
 74512  		var _objPtr uintptr = pVarname
 74513  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 74514  			tcl.XTclFreeObj(tls, _objPtr)
 74515  		}
 74516  	}
 74517  	if rc != TCL_OK {
 74518  		tcl.XTcl_BackgroundError(tls, (*TclQuotaCallback)(unsafe.Pointer(p)).Finterp)
 74519  	}
 74520  }
 74521  
 74522  // Destructor for a TCL quota-over-limit callback.
 74523  func tclCallbackDestructor(tls *libc.TLS, pObj uintptr) { /* test_quota.c:1349:13: */
 74524  	var p uintptr = pObj
 74525  	if p != 0 {
 74526  		for ok := true; ok; ok = 0 != 0 {
 74527  			var _objPtr uintptr = (*TclQuotaCallback)(unsafe.Pointer(p)).FpScript
 74528  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 74529  				tcl.XTclFreeObj(tls, _objPtr)
 74530  			}
 74531  		}
 74532  		sqlite3.Xsqlite3_free(tls, p)
 74533  	}
 74534  }
 74535  
 74536  // tclcmd: sqlite3_quota_initialize NAME MAKEDEFAULT
 74537  func test_quota_initialize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1360:26: */
 74538  	bp := tls.Alloc(4)
 74539  	defer tls.Free(4)
 74540  
 74541  	var zName uintptr // Name of new quota VFS
 74542  	// var makeDefault int32 at bp, 4
 74543  	// True to make the new VFS the default
 74544  	var rc int32 // Value returned by quota_initialize()
 74545  
 74546  	// Process arguments
 74547  	if objc != 3 {
 74548  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+34946 /* "NAME MAKEDEFAULT" */)
 74549  		return TCL_ERROR
 74550  	}
 74551  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74552  	if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &makeDefault */) != 0 {
 74553  		return TCL_ERROR
 74554  	}
 74555  	if int32(*(*int8)(unsafe.Pointer(zName))) == 0 {
 74556  		zName = uintptr(0)
 74557  	}
 74558  
 74559  	// Call sqlite3_quota_initialize()
 74560  	rc = sqlite3_quota_initialize(tls, zName, *(*int32)(unsafe.Pointer(bp /* makeDefault */)))
 74561  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 74562  
 74563  	return TCL_OK
 74564  }
 74565  
 74566  // tclcmd: sqlite3_quota_shutdown
 74567  func test_quota_shutdown(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1389:26: */
 74568  	var rc int32 // Value returned by quota_shutdown()
 74569  
 74570  	if objc != 1 {
 74571  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 74572  		return TCL_ERROR
 74573  	}
 74574  
 74575  	// Call sqlite3_quota_shutdown()
 74576  	rc = sqlite3_quota_shutdown(tls)
 74577  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 74578  
 74579  	return TCL_OK
 74580  }
 74581  
 74582  // tclcmd: sqlite3_quota_set PATTERN LIMIT SCRIPT
 74583  func test_quota_set(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1412:26: */
 74584  	bp := tls.Alloc(12)
 74585  	defer tls.Free(12)
 74586  
 74587  	var zPattern uintptr // File pattern to configure
 74588  	// var iLimit Tcl_WideInt at bp, 8
 74589  	// Initial quota in bytes
 74590  	var pScript uintptr // Tcl script to invoke to increase quota
 74591  	var rc int32        // Value returned by quota_set()
 74592  	var p uintptr       // Callback object
 74593  	// var nScript int32 at bp+8, 4
 74594  	// Length of callback script
 74595  	var xDestroy uintptr // Optional destructor for pArg
 74596  	var xCallback uintptr
 74597  
 74598  	// Process arguments
 74599  	if objc != 4 {
 74600  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36068 /* "PATTERN LIMIT SC..." */)
 74601  		return TCL_ERROR
 74602  	}
 74603  	zPattern = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74604  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &iLimit */) != 0 {
 74605  		return TCL_ERROR
 74606  	}
 74607  	pScript = *(*uintptr)(unsafe.Pointer(objv + 3*4))
 74608  	tcl.XTcl_GetStringFromObj(tls, pScript, bp+8 /* &nScript */)
 74609  
 74610  	if *(*int32)(unsafe.Pointer(bp + 8 /* nScript */)) > 0 {
 74611  		// Allocate a TclQuotaCallback object
 74612  		p = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(TclQuotaCallback{})))
 74613  		if !(p != 0) {
 74614  			tcl.XTcl_SetResult(tls, interp, ts+32944 /* "SQLITE_NOMEM" */, uintptr(0))
 74615  			return TCL_OK
 74616  		}
 74617  		libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(TclQuotaCallback{})))
 74618  		(*TclQuotaCallback)(unsafe.Pointer(p)).Finterp = interp
 74619  		(*Tcl_Obj)(unsafe.Pointer(pScript)).FrefCount++
 74620  		(*TclQuotaCallback)(unsafe.Pointer(p)).FpScript = pScript
 74621  		xDestroy = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{tclCallbackDestructor}))
 74622  		xCallback = *(*uintptr)(unsafe.Pointer(&struct {
 74623  			f func(*libc.TLS, uintptr, uintptr, sqlite3_int64, uintptr)
 74624  		}{tclQuotaCallback}))
 74625  	} else {
 74626  		p = uintptr(0)
 74627  		xDestroy = uintptr(0)
 74628  		xCallback = uintptr(0)
 74629  	}
 74630  
 74631  	// Invoke sqlite3_quota_set()
 74632  	rc = sqlite3_quota_set(tls, zPattern, *(*Tcl_WideInt)(unsafe.Pointer(bp /* iLimit */)), xCallback, p, xDestroy)
 74633  
 74634  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 74635  	return TCL_OK
 74636  }
 74637  
 74638  // tclcmd: sqlite3_quota_file FILENAME
 74639  func test_quota_file(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1466:26: */
 74640  	var zFilename uintptr // File pattern to configure
 74641  	var rc int32          // Value returned by quota_file()
 74642  
 74643  	// Process arguments
 74644  	if objc != 2 {
 74645  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 74646  		return TCL_ERROR
 74647  	}
 74648  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74649  
 74650  	// Invoke sqlite3_quota_file()
 74651  	rc = sqlite3_quota_file(tls, zFilename)
 74652  
 74653  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 74654  	return TCL_OK
 74655  }
 74656  
 74657  // tclcmd:  sqlite3_quota_dump
 74658  func test_quota_dump(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1492:26: */
 74659  	bp := tls.Alloc(1008)
 74660  	defer tls.Free(1008)
 74661  
 74662  	var pResult uintptr
 74663  	var pGroupTerm uintptr
 74664  	var pFileTerm uintptr
 74665  	var pGroup uintptr
 74666  	var pFile uintptr
 74667  
 74668  	pResult = tcl.XTcl_NewObj(tls)
 74669  	quotaEnter(tls)
 74670  	for pGroup = gQuota.FpGroup; pGroup != 0; pGroup = (*quotaGroup)(unsafe.Pointer(pGroup)).FpNext {
 74671  		pGroupTerm = tcl.XTcl_NewObj(tls)
 74672  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 74673  			tcl.XTcl_NewStringObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FzPattern, -1))
 74674  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 74675  			tcl.XTcl_NewWideIntObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FiLimit))
 74676  		tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm,
 74677  			tcl.XTcl_NewWideIntObj(tls, (*quotaGroup)(unsafe.Pointer(pGroup)).FiSize))
 74678  		for pFile = (*quotaGroup)(unsafe.Pointer(pGroup)).FpFiles; pFile != 0; pFile = (*quotaFile)(unsafe.Pointer(pFile)).FpNext {
 74679  			var i int32
 74680  			// var zTemp [1000]int8 at bp+8, 1000
 74681  
 74682  			pFileTerm = tcl.XTcl_NewObj(tls)
 74683  			sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([1000]int8{})), bp+8 /* &zTemp[0] */, ts /* "%s" */, libc.VaList(bp, (*quotaFile)(unsafe.Pointer(pFile)).FzFilename))
 74684  			for i = 0; *(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i))) != 0; i++ {
 74685  				if int32(*(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i)))) == '\\' {
 74686  					*(*int8)(unsafe.Pointer(bp + 8 /* &zTemp[0] */ + uintptr(i))) = int8('/')
 74687  				}
 74688  			}
 74689  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 74690  				tcl.XTcl_NewStringObj(tls, bp+8 /* &zTemp[0] */, -1))
 74691  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 74692  				tcl.XTcl_NewWideIntObj(tls, (*quotaFile)(unsafe.Pointer(pFile)).FiSize))
 74693  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 74694  				tcl.XTcl_NewWideIntObj(tls, int64((*quotaFile)(unsafe.Pointer(pFile)).FnRef)))
 74695  			tcl.XTcl_ListObjAppendElement(tls, interp, pFileTerm,
 74696  				tcl.XTcl_NewWideIntObj(tls, int64((*quotaFile)(unsafe.Pointer(pFile)).FdeleteOnClose)))
 74697  			tcl.XTcl_ListObjAppendElement(tls, interp, pGroupTerm, pFileTerm)
 74698  		}
 74699  		tcl.XTcl_ListObjAppendElement(tls, interp, pResult, pGroupTerm)
 74700  	}
 74701  	quotaLeave(tls)
 74702  	tcl.XTcl_SetObjResult(tls, interp, pResult)
 74703  	return TCL_OK
 74704  }
 74705  
 74706  // tclcmd: sqlite3_quota_fopen FILENAME MODE
 74707  func test_quota_fopen(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1540:26: */
 74708  	bp := tls.Alloc(58)
 74709  	defer tls.Free(58)
 74710  
 74711  	var zFilename uintptr // File pattern to configure
 74712  	var zMode uintptr     // Mode string
 74713  	var p uintptr         // Open string object
 74714  	// var zReturn [50]int8 at bp+8, 50
 74715  	// Name of pointer to return
 74716  
 74717  	// Process arguments
 74718  	if objc != 3 {
 74719  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36089 /* "FILENAME MODE" */)
 74720  		return TCL_ERROR
 74721  	}
 74722  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74723  	zMode = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 74724  	p = sqlite3_quota_fopen(tls, zFilename, zMode)
 74725  	sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+8 /* &zReturn[0] */, ts+13802 /* "%p" */, libc.VaList(bp, p))
 74726  	tcl.XTcl_SetResult(tls, interp, bp+8 /* &zReturn[0] */, uintptr(1))
 74727  	return TCL_OK
 74728  }
 74729  
 74730  // tclcmd: sqlite3_quota_fread HANDLE SIZE NELEM
 74731  func test_quota_fread(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1570:26: */
 74732  	bp := tls.Alloc(8)
 74733  	defer tls.Free(8)
 74734  
 74735  	var p uintptr
 74736  	var zBuf uintptr
 74737  	// var sz int32 at bp, 4
 74738  
 74739  	// var nElem int32 at bp+4, 4
 74740  
 74741  	var got size_t
 74742  
 74743  	if objc != 4 {
 74744  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36103 /* "HANDLE SIZE NELE..." */)
 74745  		return TCL_ERROR
 74746  	}
 74747  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74748  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &sz */) != 0 {
 74749  		return TCL_ERROR
 74750  	}
 74751  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &nElem */) != 0 {
 74752  		return TCL_ERROR
 74753  	}
 74754  	zBuf = sqlite3.Xsqlite3_malloc(tls, ((*(*int32)(unsafe.Pointer(bp /* sz */)) * *(*int32)(unsafe.Pointer(bp + 4 /* nElem */))) + 1))
 74755  	if zBuf == uintptr(0) {
 74756  		tcl.XTcl_SetResult(tls, interp, ts+1930 /* "out of memory" */, uintptr(0))
 74757  		return TCL_ERROR
 74758  	}
 74759  	got = sqlite3_quota_fread(tls, zBuf, uint32(*(*int32)(unsafe.Pointer(bp /* sz */))), uint32(*(*int32)(unsafe.Pointer(bp + 4 /* nElem */))), p)
 74760  	*(*int8)(unsafe.Pointer(zBuf + uintptr((got * size_t(*(*int32)(unsafe.Pointer(bp /* sz */))))))) = int8(0)
 74761  	tcl.XTcl_SetResult(tls, interp, zBuf, uintptr(1))
 74762  	sqlite3.Xsqlite3_free(tls, zBuf)
 74763  	return TCL_OK
 74764  }
 74765  
 74766  // tclcmd: sqlite3_quota_fwrite HANDLE SIZE NELEM CONTENT
 74767  func test_quota_fwrite(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1604:26: */
 74768  	bp := tls.Alloc(8)
 74769  	defer tls.Free(8)
 74770  
 74771  	var p uintptr
 74772  	var zBuf uintptr
 74773  	// var sz int32 at bp, 4
 74774  
 74775  	// var nElem int32 at bp+4, 4
 74776  
 74777  	var got size_t
 74778  
 74779  	if objc != 5 {
 74780  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36121 /* "HANDLE SIZE NELE..." */)
 74781  		return TCL_ERROR
 74782  	}
 74783  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74784  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &sz */) != 0 {
 74785  		return TCL_ERROR
 74786  	}
 74787  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &nElem */) != 0 {
 74788  		return TCL_ERROR
 74789  	}
 74790  	zBuf = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 74791  	got = sqlite3_quota_fwrite(tls, zBuf, uint32(*(*int32)(unsafe.Pointer(bp /* sz */))), uint32(*(*int32)(unsafe.Pointer(bp + 4 /* nElem */))), p)
 74792  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(got)))
 74793  	return TCL_OK
 74794  }
 74795  
 74796  // tclcmd: sqlite3_quota_fclose HANDLE
 74797  func test_quota_fclose(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1632:26: */
 74798  	var p uintptr
 74799  	var rc int32
 74800  
 74801  	if objc != 2 {
 74802  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74803  		return TCL_ERROR
 74804  	}
 74805  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74806  	rc = sqlite3_quota_fclose(tls, p)
 74807  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74808  	return TCL_OK
 74809  }
 74810  
 74811  // tclcmd: sqlite3_quota_fflush HANDLE ?HARDSYNC?
 74812  func test_quota_fflush(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1654:26: */
 74813  	bp := tls.Alloc(4)
 74814  	defer tls.Free(4)
 74815  
 74816  	var p uintptr
 74817  	var rc int32
 74818  	*(*int32)(unsafe.Pointer(bp /* doSync */)) = 0
 74819  
 74820  	if (objc != 2) && (objc != 3) {
 74821  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36147 /* "HANDLE ?HARDSYNC..." */)
 74822  		return TCL_ERROR
 74823  	}
 74824  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74825  	if objc == 3 {
 74826  		if tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &doSync */) != 0 {
 74827  			return TCL_ERROR
 74828  		}
 74829  	}
 74830  	rc = sqlite3_quota_fflush(tls, p, *(*int32)(unsafe.Pointer(bp /* doSync */)))
 74831  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74832  	return TCL_OK
 74833  }
 74834  
 74835  // tclcmd: sqlite3_quota_fseek HANDLE OFFSET WHENCE
 74836  func test_quota_fseek(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1680:26: */
 74837  	bp := tls.Alloc(20)
 74838  	defer tls.Free(20)
 74839  
 74840  	var p uintptr
 74841  	// var ofst int32 at bp+16, 4
 74842  
 74843  	var zWhence uintptr
 74844  	var whence int32
 74845  	var rc int32
 74846  
 74847  	if objc != 4 {
 74848  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36165 /* "HANDLE OFFSET WH..." */)
 74849  		return TCL_ERROR
 74850  	}
 74851  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74852  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &ofst */) != 0 {
 74853  		return TCL_ERROR
 74854  	}
 74855  	zWhence = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 74856  	if libc.Xstrcmp(tls, zWhence, ts+36186 /* "SEEK_SET" */) == 0 {
 74857  		whence = SEEK_SET
 74858  	} else if libc.Xstrcmp(tls, zWhence, ts+36195 /* "SEEK_CUR" */) == 0 {
 74859  		whence = SEEK_CUR
 74860  	} else if libc.Xstrcmp(tls, zWhence, ts+36204 /* "SEEK_END" */) == 0 {
 74861  		whence = SEEK_END
 74862  	} else {
 74863  		tcl.XTcl_AppendResult(tls, interp,
 74864  			libc.VaList(bp, ts+36213 /* "WHENCE should be..." */, uintptr(0)))
 74865  		return TCL_ERROR
 74866  	}
 74867  	rc = sqlite3_quota_fseek(tls, p, int32(*(*int32)(unsafe.Pointer(bp + 16 /* ofst */))), whence)
 74868  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74869  	return TCL_OK
 74870  }
 74871  
 74872  // tclcmd: sqlite3_quota_rewind HANDLE
 74873  func test_quota_rewind(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1718:26: */
 74874  	var p uintptr
 74875  	if objc != 2 {
 74876  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74877  		return TCL_ERROR
 74878  	}
 74879  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74880  	sqlite3_quota_rewind(tls, p)
 74881  	return TCL_OK
 74882  }
 74883  
 74884  // tclcmd: sqlite3_quota_ftell HANDLE
 74885  func test_quota_ftell(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1737:26: */
 74886  	var p uintptr
 74887  	var x sqlite3_int64
 74888  	if objc != 2 {
 74889  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74890  		return TCL_ERROR
 74891  	}
 74892  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74893  	x = sqlite3_int64(sqlite3_quota_ftell(tls, p))
 74894  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 74895  	return TCL_OK
 74896  }
 74897  
 74898  // tclcmd: sqlite3_quota_ftruncate HANDLE SIZE
 74899  func test_quota_ftruncate(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1758:26: */
 74900  	bp := tls.Alloc(8)
 74901  	defer tls.Free(8)
 74902  
 74903  	var p uintptr
 74904  	var x sqlite3_int64
 74905  	// var w Tcl_WideInt at bp, 8
 74906  
 74907  	var rc int32
 74908  	if objc != 3 {
 74909  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36262 /* "HANDLE SIZE" */)
 74910  		return TCL_ERROR
 74911  	}
 74912  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74913  	if tcl.XTcl_GetWideIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &w */) != 0 {
 74914  		return TCL_ERROR
 74915  	}
 74916  	x = *(*Tcl_WideInt)(unsafe.Pointer(bp /* w */))
 74917  	rc = sqlite3_quota_ftruncate(tls, p, x)
 74918  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74919  	return TCL_OK
 74920  }
 74921  
 74922  // tclcmd: sqlite3_quota_file_size HANDLE
 74923  func test_quota_file_size(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1783:26: */
 74924  	var p uintptr
 74925  	var x sqlite3_int64
 74926  	if objc != 2 {
 74927  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74928  		return TCL_ERROR
 74929  	}
 74930  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74931  	x = sqlite3_quota_file_size(tls, p)
 74932  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 74933  	return TCL_OK
 74934  }
 74935  
 74936  // tclcmd: sqlite3_quota_file_truesize HANDLE
 74937  func test_quota_file_truesize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1804:26: */
 74938  	var p uintptr
 74939  	var x sqlite3_int64
 74940  	if objc != 2 {
 74941  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74942  		return TCL_ERROR
 74943  	}
 74944  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74945  	x = sqlite3_quota_file_truesize(tls, p)
 74946  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 74947  	return TCL_OK
 74948  }
 74949  
 74950  // tclcmd: sqlite3_quota_file_mtime HANDLE
 74951  func test_quota_file_mtime(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1825:26: */
 74952  	bp := tls.Alloc(4)
 74953  	defer tls.Free(4)
 74954  
 74955  	var p uintptr
 74956  	// var t time_t at bp, 4
 74957  
 74958  	if objc != 2 {
 74959  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 74960  		return TCL_ERROR
 74961  	}
 74962  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 74963  	*(*time_t)(unsafe.Pointer(bp /* t */)) = 0
 74964  	sqlite3_quota_file_mtime(tls, p, bp /* &t */)
 74965  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, int64(*(*time_t)(unsafe.Pointer(bp /* t */)))))
 74966  	return TCL_OK
 74967  }
 74968  
 74969  // tclcmd: sqlite3_quota_remove FILENAME
 74970  func test_quota_remove(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1848:26: */
 74971  	var zFilename uintptr // File pattern to configure
 74972  	var rc int32
 74973  	if objc != 2 {
 74974  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33128 /* "FILENAME" */)
 74975  		return TCL_ERROR
 74976  	}
 74977  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74978  	rc = sqlite3_quota_remove(tls, zFilename)
 74979  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74980  	return TCL_OK
 74981  }
 74982  
 74983  // tclcmd: sqlite3_quota_glob PATTERN TEXT
 74984  //
 74985  // Test the glob pattern matching.  Return 1 if TEXT matches PATTERN
 74986  // and return 0 if it does not.
 74987  func test_quota_glob(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1872:26: */
 74988  	var zPattern uintptr // The glob pattern
 74989  	var zText uintptr    // Text to compare agains the pattern
 74990  	var rc int32
 74991  	if objc != 3 {
 74992  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+36274 /* "PATTERN TEXT" */)
 74993  		return TCL_ERROR
 74994  	}
 74995  	zPattern = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 74996  	zText = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 74997  	rc = quotaStrglob(tls, zPattern, zText)
 74998  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, rc))
 74999  	return TCL_OK
 75000  }
 75001  
 75002  // tclcmd: sqlite3_quota_file_available HANDLE
 75003  //
 75004  // Return the number of bytes from the current file point to the end of
 75005  // the file.
 75006  func test_quota_file_available(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1898:26: */
 75007  	var p uintptr
 75008  	var x sqlite3_int64
 75009  	if objc != 2 {
 75010  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 75011  		return TCL_ERROR
 75012  	}
 75013  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 75014  	x = sqlite3_int64(sqlite3_quota_file_available(tls, p))
 75015  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewWideIntObj(tls, x))
 75016  	return TCL_OK
 75017  }
 75018  
 75019  // tclcmd: sqlite3_quota_ferror HANDLE
 75020  //
 75021  // Return true if the file handle is in the error state.
 75022  func test_quota_ferror(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_quota.c:1921:26: */
 75023  	var p uintptr
 75024  	var x int32
 75025  	if objc != 2 {
 75026  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+28855 /* "HANDLE" */)
 75027  		return TCL_ERROR
 75028  	}
 75029  	p = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 75030  	x = sqlite3_quota_ferror(tls, p)
 75031  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, x))
 75032  	return TCL_OK
 75033  }
 75034  
 75035  // This routine registers the custom TCL commands defined in this
 75036  // module.  This should be the only procedure visible from outside
 75037  // of this module.
 75038  func Sqlitequota_Init(tls *libc.TLS, interp uintptr) int32 { /* test_quota.c:1944:5: */
 75039  	var i int32
 75040  
 75041  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aCmd9)) / uint32(unsafe.Sizeof(struct {
 75042  		FzName uintptr
 75043  		FxProc uintptr
 75044  	}{}))); i++ {
 75045  		tcl.XTcl_CreateObjCommand(tls, interp, aCmd9[i].FzName, aCmd9[i].FxProc, uintptr(0), uintptr(0))
 75046  	}
 75047  
 75048  	return TCL_OK
 75049  }
 75050  
 75051  var aCmd9 = [21]struct {
 75052  	FzName uintptr
 75053  	FxProc uintptr
 75054  }{
 75055  	{FzName: ts + 36287 /* "sqlite3_quota_in..." */, FxProc: 0},
 75056  	{FzName: ts + 36312 /* "sqlite3_quota_sh..." */, FxProc: 0},
 75057  	{FzName: ts + 36335 /* "sqlite3_quota_se..." */, FxProc: 0},
 75058  	{FzName: ts + 36353 /* "sqlite3_quota_fi..." */, FxProc: 0},
 75059  	{FzName: ts + 36372 /* "sqlite3_quota_du..." */, FxProc: 0},
 75060  	{FzName: ts + 36391 /* "sqlite3_quota_fo..." */, FxProc: 0},
 75061  	{FzName: ts + 36411 /* "sqlite3_quota_fr..." */, FxProc: 0},
 75062  	{FzName: ts + 36431 /* "sqlite3_quota_fw..." */, FxProc: 0},
 75063  	{FzName: ts + 36452 /* "sqlite3_quota_fc..." */, FxProc: 0},
 75064  	{FzName: ts + 36473 /* "sqlite3_quota_ff..." */, FxProc: 0},
 75065  	{FzName: ts + 36494 /* "sqlite3_quota_fs..." */, FxProc: 0},
 75066  	{FzName: ts + 36514 /* "sqlite3_quota_re..." */, FxProc: 0},
 75067  	{FzName: ts + 36535 /* "sqlite3_quota_ft..." */, FxProc: 0},
 75068  	{FzName: ts + 36555 /* "sqlite3_quota_ft..." */, FxProc: 0},
 75069  	{FzName: ts + 36579 /* "sqlite3_quota_fi..." */, FxProc: 0},
 75070  	{FzName: ts + 36603 /* "sqlite3_quota_fi..." */, FxProc: 0},
 75071  	{FzName: ts + 36631 /* "sqlite3_quota_fi..." */, FxProc: 0},
 75072  	{FzName: ts + 36656 /* "sqlite3_quota_re..." */, FxProc: 0},
 75073  	{FzName: ts + 36677 /* "sqlite3_quota_gl..." */, FxProc: 0},
 75074  	{FzName: ts + 36696 /* "sqlite3_quota_fi..." */, FxProc: 0},
 75075  	{FzName: ts + 36725 /* "sqlite3_quota_fe..." */, FxProc: 0},
 75076  } /* test_quota.c:1948:5 */
 75077  
 75078  // Type used to cache parameter information for the "circle" r-tree geometry
 75079  // callback.
 75080  type Circle1 = struct {
 75081  	FaBox [2]struct {
 75082  		Fxmin float64
 75083  		Fxmax float64
 75084  		Fymin float64
 75085  		Fymax float64
 75086  	}
 75087  	Fcenterx    float64
 75088  	Fcentery    float64
 75089  	Fradius     float64
 75090  	FmxArea     float64
 75091  	FeScoreType int32
 75092  	_           [4]byte
 75093  } /* test_rtree.c:31:9 */
 75094  
 75095  // Type used to cache parameter information for the "circle" r-tree geometry
 75096  // callback.
 75097  type Circle = Circle1 /* test_rtree.c:31:23 */
 75098  type Box = struct {
 75099  	Fxmin float64
 75100  	Fxmax float64
 75101  	Fymin float64
 75102  	Fymax float64
 75103  } /* test_rtree.c:31:9 */
 75104  
 75105  // Destructor function for Circle objects allocated by circle_geom().
 75106  func circle_del(tls *libc.TLS, p uintptr) { /* test_rtree.c:49:13: */
 75107  	sqlite3.Xsqlite3_free(tls, p)
 75108  }
 75109  
 75110  // Implementation of "circle" r-tree geometry callback.
 75111  func circle_geom(tls *libc.TLS, p uintptr, nCoord int32, aCoord uintptr, pRes uintptr) int32 { /* test_rtree.c:56:12: */
 75112  	var i int32         // Iterator variable
 75113  	var pCircle uintptr // Structure defining circular region
 75114  	var xmin float64
 75115  	var xmax float64 // X dimensions of box being tested
 75116  	var ymin float64
 75117  	var ymax float64 // X dimensions of box being tested
 75118  
 75119  	xmin = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord))
 75120  	xmax = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 1*8))
 75121  	ymin = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 2*8))
 75122  	ymax = *(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 3*8))
 75123  	pCircle = (*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser
 75124  	if pCircle == uintptr(0) {
 75125  		// If pUser is still 0, then the parameter values have not been tested
 75126  		// for correctness or stored into a Circle structure yet. Do this now.
 75127  
 75128  		// This geometry callback is for use with a 2-dimensional r-tree table.
 75129  		// Return an error if the table does not have exactly 2 dimensions.
 75130  		if nCoord != 4 {
 75131  			return SQLITE_ERROR
 75132  		}
 75133  
 75134  		// Test that the correct number of parameters (3) have been supplied,
 75135  		// and that the parameters are in range (that the radius of the circle
 75136  		// radius is greater than zero).
 75137  		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) {
 75138  			return SQLITE_ERROR
 75139  		}
 75140  
 75141  		// Allocate a structure to cache parameter data in. Return SQLITE_NOMEM
 75142  		// if the allocation fails.
 75143  		pCircle = libc.AssignPtrUintptr(p+12 /* &.pUser */, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Circle{}))))
 75144  		if !(pCircle != 0) {
 75145  			return SQLITE_NOMEM
 75146  		}
 75147  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{circle_del}))
 75148  
 75149  		// Record the center and radius of the circular region. One way that
 75150  		// tested bounding boxes that intersect the circular region are detected
 75151  		// is by testing if each corner of the bounding box lies within radius
 75152  		// units of the center of the circle.
 75153  		(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam))
 75154  		(*Circle)(unsafe.Pointer(pCircle)).Fcentery = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 1*8))
 75155  		(*Circle)(unsafe.Pointer(pCircle)).Fradius = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 2*8))
 75156  
 75157  		// Define two bounding box regions. The first, aBox[0], extends to
 75158  		// infinity in the X dimension. It covers the same range of the Y dimension
 75159  		// as the circular region. The second, aBox[1], extends to infinity in
 75160  		// the Y dimension and is constrained to the range of the circle in the
 75161  		// X dimension.
 75162  		//
 75163  		// Then imagine each box is split in half along its short axis by a line
 75164  		// that intersects the center of the circular region. A bounding box
 75165  		// being tested can be said to intersect the circular region if it contains
 75166  		// points from each half of either of the two infinite bounding boxes.
 75167  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmin = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 75168  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmax = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 75169  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymin = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75170  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymax = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75171  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmin = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75172  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmax = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75173  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymin = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 75174  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymax = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 75175  		(*Circle)(unsafe.Pointer(pCircle)).FmxArea = (((xmax - xmin) * (ymax - ymin)) + 1.0)
 75176  	}
 75177  
 75178  	// Check if any of the 4 corners of the bounding-box being tested lie
 75179  	// inside the circular region. If they do, then the bounding-box does
 75180  	// intersect the region of interest. Set the output variable to true and
 75181  	// return SQLITE_OK in this case.
 75182  	for i = 0; i < 4; i++ {
 75183  		var x float64
 75184  		if (i & 0x01) != 0 {
 75185  			x = xmax
 75186  		} else {
 75187  			x = xmin
 75188  		}
 75189  		var y float64
 75190  		if (i & 0x02) != 0 {
 75191  			y = ymax
 75192  		} else {
 75193  			y = ymin
 75194  		}
 75195  		var d2 float64
 75196  
 75197  		d2 = ((x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx) * (x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx))
 75198  		d2 = d2 + ((y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery) * (y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery))
 75199  		if d2 < ((*Circle)(unsafe.Pointer(pCircle)).Fradius * (*Circle)(unsafe.Pointer(pCircle)).Fradius) {
 75200  			*(*int32)(unsafe.Pointer(pRes)) = 1
 75201  			return SQLITE_OK
 75202  		}
 75203  	}
 75204  
 75205  	// Check if the bounding box covers any other part of the circular region.
 75206  	// See comments above for a description of how this test works. If it does
 75207  	// cover part of the circular region, set the output variable to true
 75208  	// and return SQLITE_OK.
 75209  	for i = 0; i < 2; i++ {
 75210  		if (((xmin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmin) &&
 75211  			(xmax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmax)) &&
 75212  			(ymin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymin)) &&
 75213  			(ymax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymax) {
 75214  			*(*int32)(unsafe.Pointer(pRes)) = 1
 75215  			return SQLITE_OK
 75216  		}
 75217  	}
 75218  
 75219  	// The specified bounding box does not intersect the circular region. Set
 75220  	// the output variable to zero and return SQLITE_OK.
 75221  	*(*int32)(unsafe.Pointer(pRes)) = 0
 75222  	return SQLITE_OK
 75223  }
 75224  
 75225  // Implementation of "circle" r-tree geometry callback using the
 75226  // 2nd-generation interface that allows scoring.
 75227  //
 75228  // Two calling forms:
 75229  //
 75230  //          Qcircle(X,Y,Radius,eType)        -- All values are doubles
 75231  //          Qcircle('x:X y:Y r:R e:ETYPE')   -- Single string parameter
 75232  func circle_query_func(tls *libc.TLS, p uintptr) int32 { /* test_rtree.c:168:12: */
 75233  	var i int32         // Iterator variable
 75234  	var pCircle uintptr // Structure defining circular region
 75235  	var xmin float64
 75236  	var xmax float64 // X dimensions of box being tested
 75237  	var ymin float64
 75238  	var ymax float64      // X dimensions of box being tested
 75239  	var nWithin int32 = 0 // Number of corners inside the circle
 75240  
 75241  	xmin = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord))
 75242  	xmax = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 1*8))
 75243  	ymin = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 2*8))
 75244  	ymax = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 3*8))
 75245  	pCircle = (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FpUser
 75246  	if pCircle == uintptr(0) {
 75247  		// If pUser is still 0, then the parameter values have not been tested
 75248  		// for correctness or stored into a Circle structure yet. Do this now.
 75249  
 75250  		// This geometry callback is for use with a 2-dimensional r-tree table.
 75251  		// Return an error if the table does not have exactly 2 dimensions.
 75252  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnCoord != 4 {
 75253  			return SQLITE_ERROR
 75254  		}
 75255  
 75256  		// Test that the correct number of parameters (1 or 4) have been supplied.
 75257  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 4) && ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 1) {
 75258  			return SQLITE_ERROR
 75259  		}
 75260  
 75261  		// Allocate a structure to cache parameter data in. Return SQLITE_NOMEM
 75262  		// if the allocation fails.
 75263  		pCircle = libc.AssignPtrUintptr(p+12 /* &.pUser */, sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Circle{}))))
 75264  		if !(pCircle != 0) {
 75265  			return SQLITE_NOMEM
 75266  		}
 75267  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{circle_del}))
 75268  
 75269  		// Record the center and radius of the circular region. One way that
 75270  		// tested bounding boxes that intersect the circular region are detected
 75271  		// is by testing if each corner of the bounding box lies within radius
 75272  		// units of the center of the circle.
 75273  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam == 4 {
 75274  			(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam))
 75275  			(*Circle)(unsafe.Pointer(pCircle)).Fcentery = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 1*8))
 75276  			(*Circle)(unsafe.Pointer(pCircle)).Fradius = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 2*8))
 75277  			(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = int32(*(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 3*8)))
 75278  		} else {
 75279  			var z uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FapSqlParam)))
 75280  			(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = 0.0
 75281  			(*Circle)(unsafe.Pointer(pCircle)).Fcentery = 0.0
 75282  			(*Circle)(unsafe.Pointer(pCircle)).Fradius = 0.0
 75283  			(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = 0
 75284  			for (z != 0) && (*(*int8)(unsafe.Pointer(z)) != 0) {
 75285  				if (int32(*(*int8)(unsafe.Pointer(z))) == 'r') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 75286  					(*Circle)(unsafe.Pointer(pCircle)).Fradius = libc.Xatof(tls, (z + 2))
 75287  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'x') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 75288  					(*Circle)(unsafe.Pointer(pCircle)).Fcenterx = libc.Xatof(tls, (z + 2))
 75289  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'y') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 75290  					(*Circle)(unsafe.Pointer(pCircle)).Fcentery = libc.Xatof(tls, (z + 2))
 75291  				} else if (int32(*(*int8)(unsafe.Pointer(z))) == 'e') && (int32(*(*int8)(unsafe.Pointer(z + 1))) == ':') {
 75292  					(*Circle)(unsafe.Pointer(pCircle)).FeScoreType = int32(libc.Xatof(tls, (z + 2)))
 75293  				} else if int32(*(*int8)(unsafe.Pointer(z))) == ' ' {
 75294  					z++
 75295  					continue
 75296  				}
 75297  				for (int32(*(*int8)(unsafe.Pointer(z))) != 0) && (int32(*(*int8)(unsafe.Pointer(z))) != ' ') {
 75298  					z++
 75299  				}
 75300  				for int32(*(*int8)(unsafe.Pointer(z))) == ' ' {
 75301  					z++
 75302  				}
 75303  			}
 75304  		}
 75305  		if (*Circle)(unsafe.Pointer(pCircle)).Fradius < 0.0 {
 75306  			sqlite3.Xsqlite3_free(tls, pCircle)
 75307  			return SQLITE_NOMEM
 75308  		}
 75309  
 75310  		// Define two bounding box regions. The first, aBox[0], extends to
 75311  		// infinity in the X dimension. It covers the same range of the Y dimension
 75312  		// as the circular region. The second, aBox[1], extends to infinity in
 75313  		// the Y dimension and is constrained to the range of the circle in the
 75314  		// X dimension.
 75315  		//
 75316  		// Then imagine each box is split in half along its short axis by a line
 75317  		// that intersects the center of the circular region. A bounding box
 75318  		// being tested can be said to intersect the circular region if it contains
 75319  		// points from each half of either of the two infinite bounding boxes.
 75320  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmin = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 75321  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fxmax = (*Circle)(unsafe.Pointer(pCircle)).Fcenterx
 75322  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymin = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75323  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */))).Fymax = ((*Circle)(unsafe.Pointer(pCircle)).Fcentery - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75324  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmin = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx + (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75325  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fxmax = ((*Circle)(unsafe.Pointer(pCircle)).Fcenterx - (*Circle)(unsafe.Pointer(pCircle)).Fradius)
 75326  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymin = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 75327  		(*Box)(unsafe.Pointer((pCircle /* &.aBox */) + 1*32)).Fymax = (*Circle)(unsafe.Pointer(pCircle)).Fcentery
 75328  		(*Circle)(unsafe.Pointer(pCircle)).FmxArea = (float64(200.0) * 200.0)
 75329  	}
 75330  
 75331  	// Check if any of the 4 corners of the bounding-box being tested lie
 75332  	// inside the circular region. If they do, then the bounding-box does
 75333  	// intersect the region of interest. Set the output variable to true and
 75334  	// return SQLITE_OK in this case.
 75335  	for i = 0; i < 4; i++ {
 75336  		var x float64
 75337  		if (i & 0x01) != 0 {
 75338  			x = xmax
 75339  		} else {
 75340  			x = xmin
 75341  		}
 75342  		var y float64
 75343  		if (i & 0x02) != 0 {
 75344  			y = ymax
 75345  		} else {
 75346  			y = ymin
 75347  		}
 75348  		var d2 float64
 75349  
 75350  		d2 = ((x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx) * (x - (*Circle)(unsafe.Pointer(pCircle)).Fcenterx))
 75351  		d2 = d2 + ((y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery) * (y - (*Circle)(unsafe.Pointer(pCircle)).Fcentery))
 75352  		if d2 < ((*Circle)(unsafe.Pointer(pCircle)).Fradius * (*Circle)(unsafe.Pointer(pCircle)).Fradius) {
 75353  			nWithin++
 75354  		}
 75355  	}
 75356  
 75357  	// Check if the bounding box covers any other part of the circular region.
 75358  	// See comments above for a description of how this test works. If it does
 75359  	// cover part of the circular region, set the output variable to true
 75360  	// and return SQLITE_OK.
 75361  	if nWithin == 0 {
 75362  		for i = 0; i < 2; i++ {
 75363  			if (((xmin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmin) &&
 75364  				(xmax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fxmax)) &&
 75365  				(ymin <= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymin)) &&
 75366  				(ymax >= (*Box)(unsafe.Pointer((pCircle /* &.aBox */)+uintptr(i)*32)).Fymax) {
 75367  				nWithin = 1
 75368  				break
 75369  			}
 75370  		}
 75371  	}
 75372  
 75373  	if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 1 {
 75374  		// Depth first search
 75375  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = sqlite3_rtree_dbl((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel)
 75376  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 2 {
 75377  		// Breadth first search
 75378  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 75379  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 3 {
 75380  		// Depth-first search, except sort the leaf nodes by area with
 75381  		// the largest area first
 75382  		if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel == 1 {
 75383  			(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (1.0 - (((xmax - xmin) * (ymax - ymin)) / (*Circle)(unsafe.Pointer(pCircle)).FmxArea))
 75384  			if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore < 0.01 {
 75385  				(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = 0.01
 75386  			}
 75387  		} else {
 75388  			(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = 0.0
 75389  		}
 75390  	} else if (*Circle)(unsafe.Pointer(pCircle)).FeScoreType == 4 {
 75391  		// Depth-first search, except exclude odd rowids
 75392  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = sqlite3_rtree_dbl((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel)
 75393  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiRowid & int64(1)) != 0 {
 75394  			nWithin = 0
 75395  		}
 75396  	} else {
 75397  		// Breadth-first search, except exclude odd rowids
 75398  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 75399  		if ((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiRowid & int64(1)) != 0 {
 75400  			nWithin = 0
 75401  		}
 75402  	}
 75403  	if nWithin == 0 {
 75404  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = NOT_WITHIN
 75405  	} else if nWithin >= 4 {
 75406  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 75407  	} else {
 75408  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = PARTLY_WITHIN
 75409  	}
 75410  	return SQLITE_OK
 75411  }
 75412  
 75413  // Implementation of "breadthfirstsearch" r-tree geometry callback using the
 75414  // 2nd-generation interface that allows scoring.
 75415  //
 75416  //     ... WHERE id MATCH breadthfirstsearch($x0,$x1,$y0,$y1) ...
 75417  //
 75418  // It returns all entries whose bounding boxes overlap with $x0,$x1,$y0,$y1.
 75419  func bfs_query_func(tls *libc.TLS, p uintptr) int32 { /* test_rtree.c:329:12: */
 75420  	var x0 float64
 75421  	var x1 float64
 75422  	var y0 float64
 75423  	var y1 float64 // Dimensions of box being tested
 75424  	var bx0 float64
 75425  	var bx1 float64
 75426  	var by0 float64
 75427  	var by1 float64 // Boundary of the query function
 75428  
 75429  	if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FnParam != 4 {
 75430  		return SQLITE_ERROR
 75431  	}
 75432  	x0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord))
 75433  	x1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 1*8))
 75434  	y0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 2*8))
 75435  	y1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaCoord + 3*8))
 75436  	bx0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam))
 75437  	bx1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 1*8))
 75438  	by0 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 2*8))
 75439  	by1 = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FaParam + 3*8))
 75440  	(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FrScore = (sqlite3_rtree_dbl(100 - (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FiLevel))
 75441  	if (*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeParentWithin == FULLY_WITHIN {
 75442  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 75443  	} else if (((x0 >= bx0) && (x1 <= bx1)) && (y0 >= by0)) && (y1 <= by1) {
 75444  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = FULLY_WITHIN
 75445  	} else if (((x1 >= bx0) && (x0 <= bx1)) && (y1 >= by0)) && (y0 <= by1) {
 75446  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = PARTLY_WITHIN
 75447  	} else {
 75448  		(*sqlite3_rtree_query_info)(unsafe.Pointer(p)).FeWithin = NOT_WITHIN
 75449  	}
 75450  	return SQLITE_OK
 75451  }
 75452  
 75453  // END of implementation of "circle" geometry callback.
 75454  //
 75455  //
 75456  
 75457  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75458  //    This file is part of the GNU C Library.
 75459  //
 75460  //    The GNU C Library is free software; you can redistribute it and/or
 75461  //    modify it under the terms of the GNU Lesser General Public
 75462  //    License as published by the Free Software Foundation; either
 75463  //    version 2.1 of the License, or (at your option) any later version.
 75464  //
 75465  //    The GNU C Library is distributed in the hope that it will be useful,
 75466  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75467  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75468  //    Lesser General Public License for more details.
 75469  //
 75470  //    You should have received a copy of the GNU Lesser General Public
 75471  //    License along with the GNU C Library; if not, see
 75472  //    <http://www.gnu.org/licenses/>.
 75473  
 75474  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 75475  
 75476  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75477  //    This file is part of the GNU C Library.
 75478  //
 75479  //    The GNU C Library is free software; you can redistribute it and/or
 75480  //    modify it under the terms of the GNU Lesser General Public
 75481  //    License as published by the Free Software Foundation; either
 75482  //    version 2.1 of the License, or (at your option) any later version.
 75483  //
 75484  //    The GNU C Library is distributed in the hope that it will be useful,
 75485  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75486  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75487  //    Lesser General Public License for more details.
 75488  //
 75489  //    You should have received a copy of the GNU Lesser General Public
 75490  //    License along with the GNU C Library; if not, see
 75491  //    <http://www.gnu.org/licenses/>.
 75492  
 75493  // void assert (int expression);
 75494  //
 75495  //    If NDEBUG is defined, do nothing.
 75496  //    If not, and EXPRESSION is zero, print an error message and abort.
 75497  
 75498  // void assert_perror (int errnum);
 75499  //
 75500  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 75501  //    error message with the error text for ERRNUM and abort.
 75502  //    (This is a GNU extension.)
 75503  
 75504  // tcl.h --
 75505  //
 75506  //	This header file describes the externally-visible facilities of the
 75507  //	Tcl interpreter.
 75508  //
 75509  // Copyright (c) 1987-1994 The Regents of the University of California.
 75510  // Copyright (c) 1993-1996 Lucent Technologies.
 75511  // Copyright (c) 1994-1998 Sun Microsystems, Inc.
 75512  // Copyright (c) 1998-2000 by Scriptics Corporation.
 75513  // Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
 75514  //
 75515  // See the file "license.terms" for information on usage and redistribution of
 75516  // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 75517  
 75518  // Local Variables:
 75519  // mode: c
 75520  // c-basic-offset: 4
 75521  // fill-column: 78
 75522  // End:
 75523  
 75524  type Cube1 = struct {
 75525  	Fx      float64
 75526  	Fy      float64
 75527  	Fz      float64
 75528  	Fwidth  float64
 75529  	Fheight float64
 75530  	Fdepth  float64
 75531  } /* test_rtree.c:366:9 */
 75532  
 75533  // END of implementation of "circle" geometry callback.
 75534  //
 75535  //
 75536  
 75537  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75538  //    This file is part of the GNU C Library.
 75539  //
 75540  //    The GNU C Library is free software; you can redistribute it and/or
 75541  //    modify it under the terms of the GNU Lesser General Public
 75542  //    License as published by the Free Software Foundation; either
 75543  //    version 2.1 of the License, or (at your option) any later version.
 75544  //
 75545  //    The GNU C Library is distributed in the hope that it will be useful,
 75546  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75547  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75548  //    Lesser General Public License for more details.
 75549  //
 75550  //    You should have received a copy of the GNU Lesser General Public
 75551  //    License along with the GNU C Library; if not, see
 75552  //    <http://www.gnu.org/licenses/>.
 75553  
 75554  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 75555  
 75556  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75557  //    This file is part of the GNU C Library.
 75558  //
 75559  //    The GNU C Library is free software; you can redistribute it and/or
 75560  //    modify it under the terms of the GNU Lesser General Public
 75561  //    License as published by the Free Software Foundation; either
 75562  //    version 2.1 of the License, or (at your option) any later version.
 75563  //
 75564  //    The GNU C Library is distributed in the hope that it will be useful,
 75565  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75566  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75567  //    Lesser General Public License for more details.
 75568  //
 75569  //    You should have received a copy of the GNU Lesser General Public
 75570  //    License along with the GNU C Library; if not, see
 75571  //    <http://www.gnu.org/licenses/>.
 75572  
 75573  // void assert (int expression);
 75574  //
 75575  //    If NDEBUG is defined, do nothing.
 75576  //    If not, and EXPRESSION is zero, print an error message and abort.
 75577  
 75578  // void assert_perror (int errnum);
 75579  //
 75580  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 75581  //    error message with the error text for ERRNUM and abort.
 75582  //    (This is a GNU extension.)
 75583  
 75584  // tcl.h --
 75585  //
 75586  //	This header file describes the externally-visible facilities of the
 75587  //	Tcl interpreter.
 75588  //
 75589  // Copyright (c) 1987-1994 The Regents of the University of California.
 75590  // Copyright (c) 1993-1996 Lucent Technologies.
 75591  // Copyright (c) 1994-1998 Sun Microsystems, Inc.
 75592  // Copyright (c) 1998-2000 by Scriptics Corporation.
 75593  // Copyright (c) 2002 by Kevin B. Kenny.  All rights reserved.
 75594  //
 75595  // See the file "license.terms" for information on usage and redistribution of
 75596  // this file, and for a DISCLAIMER OF ALL WARRANTIES.
 75597  
 75598  // Local Variables:
 75599  // mode: c
 75600  // c-basic-offset: 4
 75601  // fill-column: 78
 75602  // End:
 75603  
 75604  type Cube = Cube1 /* test_rtree.c:366:21 */
 75605  
 75606  func cube_context_free(tls *libc.TLS, p uintptr) { /* test_rtree.c:376:13: */
 75607  	sqlite3.Xsqlite3_free(tls, p)
 75608  }
 75609  
 75610  // The context pointer registered along with the 'cube' callback is
 75611  // always ((void *)&gHere). This is just to facilitate testing, it is not
 75612  // actually used for anything.
 75613  var gHere int32 = 42 /* test_rtree.c:385:12 */
 75614  
 75615  // Implementation of a simple r-tree geom callback to test for intersection
 75616  // of r-tree rows with a "cube" shape. Cubes are defined by six scalar
 75617  // coordinates as follows:
 75618  //
 75619  //   cube(x, y, z, width, height, depth)
 75620  //
 75621  // The width, height and depth parameters must all be greater than zero.
 75622  func cube_geom(tls *libc.TLS, p uintptr, nCoord int32, aCoord uintptr, piRes uintptr) int32 { /* test_rtree.c:396:12: */
 75623  	var pCube uintptr = (*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser
 75624  
 75625  	if pCube == uintptr(0) {
 75626  		if (((((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FnParam != 6) || (nCoord != 6)) ||
 75627  			(*(*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) {
 75628  			return SQLITE_ERROR
 75629  		}
 75630  		pCube = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Cube{})))
 75631  		if !(pCube != 0) {
 75632  			return SQLITE_NOMEM
 75633  		}
 75634  		(*Cube)(unsafe.Pointer(pCube)).Fx = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam))
 75635  		(*Cube)(unsafe.Pointer(pCube)).Fy = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 1*8))
 75636  		(*Cube)(unsafe.Pointer(pCube)).Fz = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 2*8))
 75637  		(*Cube)(unsafe.Pointer(pCube)).Fwidth = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 3*8))
 75638  		(*Cube)(unsafe.Pointer(pCube)).Fheight = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 4*8))
 75639  		(*Cube)(unsafe.Pointer(pCube)).Fdepth = *(*sqlite3_rtree_dbl)(unsafe.Pointer((*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FaParam + 5*8))
 75640  
 75641  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FpUser = pCube
 75642  		(*sqlite3_rtree_geometry)(unsafe.Pointer(p)).FxDelUser = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{cube_context_free}))
 75643  	}
 75644  
 75645  	*(*int32)(unsafe.Pointer(piRes)) = 0
 75646  	if (((((*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord)) <= ((*Cube)(unsafe.Pointer(pCube)).Fx + (*Cube)(unsafe.Pointer(pCube)).Fwidth)) &&
 75647  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 1*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fx)) &&
 75648  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 2*8)) <= ((*Cube)(unsafe.Pointer(pCube)).Fy + (*Cube)(unsafe.Pointer(pCube)).Fheight))) &&
 75649  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 3*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fy)) &&
 75650  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 4*8)) <= ((*Cube)(unsafe.Pointer(pCube)).Fz + (*Cube)(unsafe.Pointer(pCube)).Fdepth))) &&
 75651  		(*(*sqlite3_rtree_dbl)(unsafe.Pointer(aCoord + 5*8)) >= (*Cube)(unsafe.Pointer(pCube)).Fz) {
 75652  		*(*int32)(unsafe.Pointer(piRes)) = 1
 75653  	}
 75654  
 75655  	return SQLITE_OK
 75656  }
 75657  
 75658  func register_cube_geom(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_rtree.c:443:26: */
 75659  	bp := tls.Alloc(4)
 75660  	defer tls.Free(4)
 75661  
 75662  	// var db uintptr at bp, 4
 75663  
 75664  	var rc int32
 75665  
 75666  	if objc != 2 {
 75667  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 75668  		return TCL_ERROR
 75669  	}
 75670  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 75671  		return TCL_ERROR
 75672  	}
 75673  	rc = sqlite3.Xsqlite3_rtree_geometry_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36746 /* "cube" */, *(*uintptr)(unsafe.Pointer(&struct {
 75674  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 75675  	}{cube_geom})), uintptr(unsafe.Pointer(&gHere)))
 75676  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 75677  	return TCL_OK
 75678  }
 75679  
 75680  func register_circle_geom(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_rtree.c:471:26: */
 75681  	bp := tls.Alloc(4)
 75682  	defer tls.Free(4)
 75683  
 75684  	// var db uintptr at bp, 4
 75685  
 75686  	var rc int32
 75687  
 75688  	if objc != 2 {
 75689  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 75690  		return TCL_ERROR
 75691  	}
 75692  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 75693  		return TCL_ERROR
 75694  	}
 75695  	rc = sqlite3.Xsqlite3_rtree_geometry_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36751 /* "circle" */, *(*uintptr)(unsafe.Pointer(&struct {
 75696  		f func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32
 75697  	}{circle_geom})), uintptr(0))
 75698  	if rc == SQLITE_OK {
 75699  		rc = sqlite3.Xsqlite3_rtree_query_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36758, /* "Qcircle" */
 75700  			*(*uintptr)(unsafe.Pointer(&struct {
 75701  				f func(*libc.TLS, uintptr) int32
 75702  			}{circle_query_func})), uintptr(0), uintptr(0))
 75703  	}
 75704  	if rc == SQLITE_OK {
 75705  		rc = sqlite3.Xsqlite3_rtree_query_callback(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+36766, /* "breadthfirstsear..." */
 75706  			*(*uintptr)(unsafe.Pointer(&struct {
 75707  				f func(*libc.TLS, uintptr) int32
 75708  			}{bfs_query_func})), uintptr(0), uintptr(0))
 75709  	}
 75710  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 75711  	return TCL_OK
 75712  }
 75713  
 75714  func Sqlitetestrtree_Init(tls *libc.TLS, interp uintptr) int32 { /* test_rtree.c:507:5: */
 75715  	tcl.XTcl_CreateObjCommand(tls, interp, ts+36785 /* "register_cube_ge..." */, *(*uintptr)(unsafe.Pointer(&struct {
 75716  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75717  	}{register_cube_geom})), uintptr(0), uintptr(0))
 75718  	tcl.XTcl_CreateObjCommand(tls, interp, ts+36804 /* "register_circle_..." */, *(*uintptr)(unsafe.Pointer(&struct {
 75719  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 75720  	}{register_circle_geom})), uintptr(0), uintptr(0))
 75721  	return TCL_OK
 75722  }
 75723  
 75724  // Some versions of <linux/posix_types.h> define this macros.
 75725  // It's easier to assume 8-bit bytes than to get CHAR_BIT.
 75726  
 75727  // fd_set for select and pselect.
 75728  type fd_set5 = struct{ Ffds_bits [32]int32 } /* select.h:70:5 */
 75729  
 75730  // end block for C++
 75731  
 75732  // Local Variables:
 75733  // mode: c
 75734  // c-basic-offset: 4
 75735  // fill-column: 78
 75736  // End:
 75737  
 75738  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75739  //    This file is part of the GNU C Library.
 75740  //
 75741  //    The GNU C Library is free software; you can redistribute it and/or
 75742  //    modify it under the terms of the GNU Lesser General Public
 75743  //    License as published by the Free Software Foundation; either
 75744  //    version 2.1 of the License, or (at your option) any later version.
 75745  //
 75746  //    The GNU C Library is distributed in the hope that it will be useful,
 75747  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75748  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75749  //    Lesser General Public License for more details.
 75750  //
 75751  //    You should have received a copy of the GNU Lesser General Public
 75752  //    License along with the GNU C Library; if not, see
 75753  //    <http://www.gnu.org/licenses/>.
 75754  
 75755  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 75756  
 75757  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75758  //    This file is part of the GNU C Library.
 75759  //
 75760  //    The GNU C Library is free software; you can redistribute it and/or
 75761  //    modify it under the terms of the GNU Lesser General Public
 75762  //    License as published by the Free Software Foundation; either
 75763  //    version 2.1 of the License, or (at your option) any later version.
 75764  //
 75765  //    The GNU C Library is distributed in the hope that it will be useful,
 75766  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75767  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75768  //    Lesser General Public License for more details.
 75769  //
 75770  //    You should have received a copy of the GNU Lesser General Public
 75771  //    License along with the GNU C Library; if not, see
 75772  //    <http://www.gnu.org/licenses/>.
 75773  
 75774  //	ISO C99 Standard: 7.21 String handling	<string.h>
 75775  
 75776  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75777  //    This file is part of the GNU C Library.
 75778  //
 75779  //    The GNU C Library is free software; you can redistribute it and/or
 75780  //    modify it under the terms of the GNU Lesser General Public
 75781  //    License as published by the Free Software Foundation; either
 75782  //    version 2.1 of the License, or (at your option) any later version.
 75783  //
 75784  //    The GNU C Library is distributed in the hope that it will be useful,
 75785  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75786  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75787  //    Lesser General Public License for more details.
 75788  //
 75789  //    You should have received a copy of the GNU Lesser General Public
 75790  //    License along with the GNU C Library; if not, see
 75791  //    <http://www.gnu.org/licenses/>.
 75792  
 75793  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 75794  
 75795  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75796  //    This file is part of the GNU C Library.
 75797  //
 75798  //    The GNU C Library is free software; you can redistribute it and/or
 75799  //    modify it under the terms of the GNU Lesser General Public
 75800  //    License as published by the Free Software Foundation; either
 75801  //    version 2.1 of the License, or (at your option) any later version.
 75802  //
 75803  //    The GNU C Library is distributed in the hope that it will be useful,
 75804  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75805  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75806  //    Lesser General Public License for more details.
 75807  //
 75808  //    You should have received a copy of the GNU Lesser General Public
 75809  //    License along with the GNU C Library; if not, see
 75810  //    <http://www.gnu.org/licenses/>.
 75811  
 75812  // void assert (int expression);
 75813  //
 75814  //    If NDEBUG is defined, do nothing.
 75815  //    If not, and EXPRESSION is zero, print an error message and abort.
 75816  
 75817  // void assert_perror (int errnum);
 75818  //
 75819  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 75820  //    error message with the error text for ERRNUM and abort.
 75821  //    (This is a GNU extension.)
 75822  
 75823  type schema_vtab1 = struct {
 75824  	Fbase sqlite3_vtab
 75825  	Fdb   uintptr
 75826  } /* test_schema.c:53:9 */
 75827  
 75828  // end block for C++
 75829  
 75830  // Local Variables:
 75831  // mode: c
 75832  // c-basic-offset: 4
 75833  // fill-column: 78
 75834  // End:
 75835  
 75836  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75837  //    This file is part of the GNU C Library.
 75838  //
 75839  //    The GNU C Library is free software; you can redistribute it and/or
 75840  //    modify it under the terms of the GNU Lesser General Public
 75841  //    License as published by the Free Software Foundation; either
 75842  //    version 2.1 of the License, or (at your option) any later version.
 75843  //
 75844  //    The GNU C Library is distributed in the hope that it will be useful,
 75845  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75846  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75847  //    Lesser General Public License for more details.
 75848  //
 75849  //    You should have received a copy of the GNU Lesser General Public
 75850  //    License along with the GNU C Library; if not, see
 75851  //    <http://www.gnu.org/licenses/>.
 75852  
 75853  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 75854  
 75855  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75856  //    This file is part of the GNU C Library.
 75857  //
 75858  //    The GNU C Library is free software; you can redistribute it and/or
 75859  //    modify it under the terms of the GNU Lesser General Public
 75860  //    License as published by the Free Software Foundation; either
 75861  //    version 2.1 of the License, or (at your option) any later version.
 75862  //
 75863  //    The GNU C Library is distributed in the hope that it will be useful,
 75864  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75865  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75866  //    Lesser General Public License for more details.
 75867  //
 75868  //    You should have received a copy of the GNU Lesser General Public
 75869  //    License along with the GNU C Library; if not, see
 75870  //    <http://www.gnu.org/licenses/>.
 75871  
 75872  //	ISO C99 Standard: 7.21 String handling	<string.h>
 75873  
 75874  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75875  //    This file is part of the GNU C Library.
 75876  //
 75877  //    The GNU C Library is free software; you can redistribute it and/or
 75878  //    modify it under the terms of the GNU Lesser General Public
 75879  //    License as published by the Free Software Foundation; either
 75880  //    version 2.1 of the License, or (at your option) any later version.
 75881  //
 75882  //    The GNU C Library is distributed in the hope that it will be useful,
 75883  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75884  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75885  //    Lesser General Public License for more details.
 75886  //
 75887  //    You should have received a copy of the GNU Lesser General Public
 75888  //    License along with the GNU C Library; if not, see
 75889  //    <http://www.gnu.org/licenses/>.
 75890  
 75891  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 75892  
 75893  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 75894  //    This file is part of the GNU C Library.
 75895  //
 75896  //    The GNU C Library is free software; you can redistribute it and/or
 75897  //    modify it under the terms of the GNU Lesser General Public
 75898  //    License as published by the Free Software Foundation; either
 75899  //    version 2.1 of the License, or (at your option) any later version.
 75900  //
 75901  //    The GNU C Library is distributed in the hope that it will be useful,
 75902  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 75903  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 75904  //    Lesser General Public License for more details.
 75905  //
 75906  //    You should have received a copy of the GNU Lesser General Public
 75907  //    License along with the GNU C Library; if not, see
 75908  //    <http://www.gnu.org/licenses/>.
 75909  
 75910  // void assert (int expression);
 75911  //
 75912  //    If NDEBUG is defined, do nothing.
 75913  //    If not, and EXPRESSION is zero, print an error message and abort.
 75914  
 75915  // void assert_perror (int errnum);
 75916  //
 75917  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 75918  //    error message with the error text for ERRNUM and abort.
 75919  //    (This is a GNU extension.)
 75920  
 75921  type schema_vtab = schema_vtab1 /* test_schema.c:53:28 */
 75922  type schema_cursor1 = struct {
 75923  	Fbase        sqlite3_vtab_cursor
 75924  	FpDbList     uintptr
 75925  	FpTableList  uintptr
 75926  	FpColumnList uintptr
 75927  	Frowid       int32
 75928  } /* test_schema.c:54:9 */
 75929  
 75930  type schema_cursor = schema_cursor1 /* test_schema.c:54:30 */
 75931  
 75932  // None of this works unless we have virtual tables.
 75933  
 75934  // Table destructor for the schema module.
 75935  func schemaDestroy(tls *libc.TLS, pVtab uintptr) int32 { /* test_schema.c:79:12: */
 75936  	sqlite3.Xsqlite3_free(tls, pVtab)
 75937  	return 0
 75938  }
 75939  
 75940  // Table constructor for the schema module.
 75941  func schemaCreate(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_schema.c:87:12: */
 75942  	var rc int32 = SQLITE_NOMEM
 75943  	var pVtab uintptr = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(schema_vtab{})))
 75944  	if pVtab != 0 {
 75945  		libc.Xmemset(tls, pVtab, 0, uint32(unsafe.Sizeof(schema_vtab{})))
 75946  		(*schema_vtab)(unsafe.Pointer(pVtab)).Fdb = db
 75947  		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..." */)
 75948  	}
 75949  	*(*uintptr)(unsafe.Pointer(ppVtab)) = pVtab
 75950  	return rc
 75951  }
 75952  
 75953  // Open a new cursor on the schema table.
 75954  func schemaOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_schema.c:110:12: */
 75955  	var rc int32 = SQLITE_NOMEM
 75956  	var pCur uintptr
 75957  	pCur = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(schema_cursor{})))
 75958  	if pCur != 0 {
 75959  		libc.Xmemset(tls, pCur, 0, uint32(unsafe.Sizeof(schema_cursor{})))
 75960  		*(*uintptr)(unsafe.Pointer(ppCursor)) = pCur
 75961  		rc = SQLITE_OK
 75962  	}
 75963  	return rc
 75964  }
 75965  
 75966  // Close a schema table cursor.
 75967  func schemaClose(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:125:12: */
 75968  	var pCur uintptr = cur
 75969  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList)
 75970  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList)
 75971  	sqlite3.Xsqlite3_finalize(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList)
 75972  	sqlite3.Xsqlite3_free(tls, pCur)
 75973  	return SQLITE_OK
 75974  }
 75975  
 75976  // Retrieve a column of data.
 75977  func schemaColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_schema.c:137:12: */
 75978  	var pCur uintptr = cur
 75979  	switch i {
 75980  	case 0:
 75981  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 1))
 75982  		break
 75983  	case 1:
 75984  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList, 0))
 75985  		break
 75986  	default:
 75987  		sqlite3.Xsqlite3_result_value(tls, ctx, sqlite3.Xsqlite3_column_value(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList, (i-2)))
 75988  		break
 75989  	}
 75990  	return SQLITE_OK
 75991  }
 75992  
 75993  // Retrieve the current rowid.
 75994  func schemaRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_schema.c:156:12: */
 75995  	var pCur uintptr = cur
 75996  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = sqlite_int64((*schema_cursor)(unsafe.Pointer(pCur)).Frowid)
 75997  	return SQLITE_OK
 75998  }
 75999  
 76000  func finalize(tls *libc.TLS, ppStmt uintptr) int32 { /* test_schema.c:162:12: */
 76001  	var rc int32 = sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(ppStmt)))
 76002  	*(*uintptr)(unsafe.Pointer(ppStmt)) = uintptr(0)
 76003  	return rc
 76004  }
 76005  
 76006  func schemaEof(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:168:12: */
 76007  	var pCur uintptr = cur
 76008  	return func() int32 {
 76009  		if (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList != 0 {
 76010  			return 0
 76011  		}
 76012  		return 1
 76013  	}()
 76014  }
 76015  
 76016  // Advance the cursor to the next row.
 76017  func schemaNext(tls *libc.TLS, cur uintptr) int32 { /* test_schema.c:176:12: */
 76018  	bp := tls.Alloc(24)
 76019  	defer tls.Free(24)
 76020  
 76021  	var rc int32
 76022  	var pCur uintptr
 76023  	var pVtab uintptr
 76024  	var zSql uintptr
 76025  	var pDbList uintptr
 76026  	rc = SQLITE_OK
 76027  	pCur = cur
 76028  	pVtab = (*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab
 76029  	zSql = uintptr(0)
 76030  
 76031  __1:
 76032  	if !(!(int32((*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList) != 0) || (SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpColumnList))) {
 76033  		goto __2
 76034  	}
 76035  	if !(SQLITE_OK != (libc.AssignInt32(&rc, finalize(tls, (pCur+12 /* &.pColumnList */))))) {
 76036  		goto __3
 76037  	}
 76038  	goto next_exit
 76039  __3:
 76040  	;
 76041  
 76042  __4:
 76043  	if !(!(int32((*schema_cursor)(unsafe.Pointer(pCur)).FpTableList) != 0) || (SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList))) {
 76044  		goto __5
 76045  	}
 76046  	if !(SQLITE_OK != (libc.AssignInt32(&rc, finalize(tls, (pCur+8 /* &.pTableList */))))) {
 76047  		goto __6
 76048  	}
 76049  	goto next_exit
 76050  __6:
 76051  	;
 76052  
 76053  __7:
 76054  	if !(SQLITE_ROW != sqlite3.Xsqlite3_step(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList)) {
 76055  		goto __8
 76056  	}
 76057  	rc = finalize(tls, (pCur + 4 /* &.pDbList */))
 76058  	goto next_exit
 76059  	goto __7
 76060  __8:
 76061  	;
 76062  
 76063  	// Set zSql to the SQL to pull the list of tables from the
 76064  	// sqlite_schema (or sqlite_temp_schema) table of the database
 76065  	// identified by the row pointed to by the SQL statement pCur->pDbList
 76066  	// (iterating through a "PRAGMA database_list;" statement).
 76067  	if !(sqlite3.Xsqlite3_column_int(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 0) == 1) {
 76068  		goto __9
 76069  	}
 76070  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 76071  		ts+36897 /* "SELECT name FROM..." */, 0)
 76072  	goto __10
 76073  __9:
 76074  	pDbList = (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList
 76075  	zSql = sqlite3.Xsqlite3_mprintf(tls,
 76076  		ts+36952, /* "SELECT name FROM..." */
 76077  		libc.VaList(bp, sqlite3.Xsqlite3_column_text(tls, pDbList, 1)))
 76078  __10:
 76079  	;
 76080  	if !(!(zSql != 0)) {
 76081  		goto __11
 76082  	}
 76083  	rc = SQLITE_NOMEM
 76084  	goto next_exit
 76085  __11:
 76086  	;
 76087  
 76088  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, (pCur + 8 /* &.pTableList */), uintptr(0))
 76089  	sqlite3.Xsqlite3_free(tls, zSql)
 76090  	if !(rc != SQLITE_OK) {
 76091  		goto __12
 76092  	}
 76093  	goto next_exit
 76094  __12:
 76095  	;
 76096  	goto __4
 76097  __5:
 76098  	;
 76099  
 76100  	// Set zSql to the SQL to the table_info pragma for the table currently
 76101  	// identified by the rows pointed to by statements pCur->pDbList and
 76102  	// pCur->pTableList.
 76103  	zSql = sqlite3.Xsqlite3_mprintf(tls, ts+37005, /* "PRAGMA %Q.table_..." */
 76104  		libc.VaList(bp+8, sqlite3.Xsqlite3_column_text(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpDbList, 1),
 76105  			sqlite3.Xsqlite3_column_text(tls, (*schema_cursor)(unsafe.Pointer(pCur)).FpTableList, 0)))
 76106  
 76107  	if !(!(zSql != 0)) {
 76108  		goto __13
 76109  	}
 76110  	rc = SQLITE_NOMEM
 76111  	goto next_exit
 76112  __13:
 76113  	;
 76114  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, zSql, -1, (pCur + 12 /* &.pColumnList */), uintptr(0))
 76115  	sqlite3.Xsqlite3_free(tls, zSql)
 76116  	if !(rc != SQLITE_OK) {
 76117  		goto __14
 76118  	}
 76119  	goto next_exit
 76120  __14:
 76121  	;
 76122  	goto __1
 76123  __2:
 76124  	;
 76125  	(*schema_cursor)(unsafe.Pointer(pCur)).Frowid++
 76126  
 76127  next_exit:
 76128  	// TODO: Handle rc
 76129  	return rc
 76130  }
 76131  
 76132  // Reset a schema table cursor.
 76133  func schemaFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_schema.c:247:12: */
 76134  	var rc int32
 76135  	var pVtab uintptr = (*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab
 76136  	var pCur uintptr = pVtabCursor
 76137  	(*schema_cursor)(unsafe.Pointer(pCur)).Frowid = 0
 76138  	finalize(tls, (pCur + 8 /* &.pTableList */))
 76139  	finalize(tls, (pCur + 12 /* &.pColumnList */))
 76140  	finalize(tls, (pCur + 4 /* &.pDbList */))
 76141  	rc = sqlite3.Xsqlite3_prepare(tls, (*schema_vtab)(unsafe.Pointer(pVtab)).Fdb, ts+37030 /* "PRAGMA database_..." */, -1, (pCur + 4 /* &.pDbList */), uintptr(0))
 76142  	return func() int32 {
 76143  		if rc == SQLITE_OK {
 76144  			return schemaNext(tls, pVtabCursor)
 76145  		}
 76146  		return rc
 76147  	}()
 76148  }
 76149  
 76150  // Analyse the WHERE condition.
 76151  func schemaBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_schema.c:266:12: */
 76152  	return SQLITE_OK
 76153  }
 76154  
 76155  // A virtual table module that merely echos method calls into TCL
 76156  // variables.
 76157  var schemaModule = sqlite3_module{ // iVersion
 76158  	FxCreate:     0,
 76159  	FxConnect:    0,
 76160  	FxBestIndex:  0,
 76161  	FxDisconnect: 0,
 76162  	FxDestroy:    0,
 76163  	FxOpen:       0, // xOpen - open a cursor
 76164  	FxClose:      0, // xClose - close a cursor
 76165  	FxFilter:     0, // xFilter - configure scan constraints
 76166  	FxNext:       0, // xNext - advance a cursor
 76167  	FxEof:        0, // xEof
 76168  	FxColumn:     0, // xColumn - read data
 76169  	FxRowid:      0, // xRename
 76170  } /* test_schema.c:274:23 */
 76171  
 76172  // Register the schema virtual table module.
 76173  func register_schema_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_schema.c:309:26: */
 76174  	bp := tls.Alloc(4)
 76175  	defer tls.Free(4)
 76176  
 76177  	// var db uintptr at bp, 4
 76178  
 76179  	if objc != 2 {
 76180  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 76181  		return TCL_ERROR
 76182  	}
 76183  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 76184  		return TCL_ERROR
 76185  	}
 76186  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+4669 /* "schema" */, uintptr(unsafe.Pointer(&schemaModule)), uintptr(0))
 76187  	return TCL_OK
 76188  }
 76189  
 76190  // Register commands with the TCL interpreter.
 76191  func Sqlitetestschema_Init(tls *libc.TLS, interp uintptr) int32 { /* test_schema.c:330:5: */
 76192  	var i int32
 76193  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd12)) / uint32(unsafe.Sizeof(struct {
 76194  		FzName      uintptr
 76195  		FxProc      uintptr
 76196  		FclientData uintptr
 76197  	}{}))); i++ {
 76198  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd12[i].FzName,
 76199  			aObjCmd12[i].FxProc, aObjCmd12[i].FclientData, uintptr(0))
 76200  	}
 76201  	return TCL_OK
 76202  }
 76203  
 76204  var aObjCmd12 = [1]struct {
 76205  	FzName      uintptr
 76206  	FxProc      uintptr
 76207  	FclientData uintptr
 76208  }{
 76209  	{FzName: ts + 37051 /* "register_schema_..." */, FxProc: 0},
 76210  } /* test_schema.c:335:5 */
 76211  
 76212  // 2001-09-15
 76213  //
 76214  // The author disclaims copyright to this source code.  In place of
 76215  // a legal notice, here is a blessing:
 76216  //
 76217  //    May you do good and not evil.
 76218  //    May you find forgiveness for yourself and forgive others.
 76219  //    May you share freely, never taking more than you give.
 76220  //
 76221  //
 76222  // This header file defines the interface that the SQLite library
 76223  // presents to client programs.  If a C-function, structure, datatype,
 76224  // or constant definition does not appear in this file, then it is
 76225  // not a published API of SQLite, is subject to change without
 76226  // notice, and should not be referenced by programs that use SQLite.
 76227  //
 76228  // Some of the definitions that are in this file are marked as
 76229  // "experimental".  Experimental interfaces are normally new
 76230  // features recently added to SQLite.  We do not anticipate changes
 76231  // to experimental interfaces but reserve the right to make minor changes
 76232  // if experience from use "in the wild" suggest such changes are prudent.
 76233  //
 76234  // The official C-language API documentation for SQLite is derived
 76235  // from comments in this file.  This file is the authoritative source
 76236  // on how SQLite interfaces are supposed to operate.
 76237  //
 76238  // The name of this file under configuration management is "sqlite.h.in".
 76239  // The makefile makes some minor changes to this file (such as inserting
 76240  // the version number) and changes its name to "sqlite3.h" as
 76241  // part of the build process.
 76242  
 76243  //******* Begin file sqlite3rtree.h ********
 76244  // 2010 August 30
 76245  //
 76246  // The author disclaims copyright to this source code.  In place of
 76247  // a legal notice, here is a blessing:
 76248  //
 76249  //    May you do good and not evil.
 76250  //    May you find forgiveness for yourself and forgive others.
 76251  //    May you share freely, never taking more than you give.
 76252  //
 76253  //
 76254  
 76255  //******* End of sqlite3rtree.h ********
 76256  //******* Begin file sqlite3session.h ********
 76257  
 76258  //******* End of sqlite3session.h ********
 76259  //******* Begin file fts5.h ********
 76260  // 2014 May 31
 76261  //
 76262  // The author disclaims copyright to this source code.  In place of
 76263  // a legal notice, here is a blessing:
 76264  //
 76265  //    May you do good and not evil.
 76266  //    May you find forgiveness for yourself and forgive others.
 76267  //    May you share freely, never taking more than you give.
 76268  //
 76269  //
 76270  //
 76271  // Interfaces to extend FTS5. Using the interfaces defined in this file,
 76272  // FTS5 may be extended with:
 76273  //
 76274  //     * custom tokenizers, and
 76275  //     * custom auxiliary functions.
 76276  
 76277  //******* End of fts5.h ********
 76278  
 76279  // Messages are passed from client to server and back again as
 76280  // instances of the following structure.
 76281  type SqlMessage1 = struct {
 76282  	Fop           int32
 76283  	FpDb          uintptr
 76284  	FpStmt        uintptr
 76285  	FerrCode      int32
 76286  	FzIn          uintptr
 76287  	FnByte        int32
 76288  	FzOut         uintptr
 76289  	FpNext        uintptr
 76290  	FpPrev        uintptr
 76291  	FclientMutex  pthread_mutex_t
 76292  	_             [4]byte
 76293  	FclientWakeup pthread_cond_t
 76294  } /* test_server.c:221:9 */
 76295  
 76296  // 2001-09-15
 76297  //
 76298  // The author disclaims copyright to this source code.  In place of
 76299  // a legal notice, here is a blessing:
 76300  //
 76301  //    May you do good and not evil.
 76302  //    May you find forgiveness for yourself and forgive others.
 76303  //    May you share freely, never taking more than you give.
 76304  //
 76305  //
 76306  // This header file defines the interface that the SQLite library
 76307  // presents to client programs.  If a C-function, structure, datatype,
 76308  // or constant definition does not appear in this file, then it is
 76309  // not a published API of SQLite, is subject to change without
 76310  // notice, and should not be referenced by programs that use SQLite.
 76311  //
 76312  // Some of the definitions that are in this file are marked as
 76313  // "experimental".  Experimental interfaces are normally new
 76314  // features recently added to SQLite.  We do not anticipate changes
 76315  // to experimental interfaces but reserve the right to make minor changes
 76316  // if experience from use "in the wild" suggest such changes are prudent.
 76317  //
 76318  // The official C-language API documentation for SQLite is derived
 76319  // from comments in this file.  This file is the authoritative source
 76320  // on how SQLite interfaces are supposed to operate.
 76321  //
 76322  // The name of this file under configuration management is "sqlite.h.in".
 76323  // The makefile makes some minor changes to this file (such as inserting
 76324  // the version number) and changes its name to "sqlite3.h" as
 76325  // part of the build process.
 76326  
 76327  //******* Begin file sqlite3rtree.h ********
 76328  // 2010 August 30
 76329  //
 76330  // The author disclaims copyright to this source code.  In place of
 76331  // a legal notice, here is a blessing:
 76332  //
 76333  //    May you do good and not evil.
 76334  //    May you find forgiveness for yourself and forgive others.
 76335  //    May you share freely, never taking more than you give.
 76336  //
 76337  //
 76338  
 76339  //******* End of sqlite3rtree.h ********
 76340  //******* Begin file sqlite3session.h ********
 76341  
 76342  //******* End of sqlite3session.h ********
 76343  //******* Begin file fts5.h ********
 76344  // 2014 May 31
 76345  //
 76346  // The author disclaims copyright to this source code.  In place of
 76347  // a legal notice, here is a blessing:
 76348  //
 76349  //    May you do good and not evil.
 76350  //    May you find forgiveness for yourself and forgive others.
 76351  //    May you share freely, never taking more than you give.
 76352  //
 76353  //
 76354  //
 76355  // Interfaces to extend FTS5. Using the interfaces defined in this file,
 76356  // FTS5 may be extended with:
 76357  //
 76358  //     * custom tokenizers, and
 76359  //     * custom auxiliary functions.
 76360  
 76361  //******* End of fts5.h ********
 76362  
 76363  // Messages are passed from client to server and back again as
 76364  // instances of the following structure.
 76365  type SqlMessage = SqlMessage1 /* test_server.c:221:27 */
 76366  
 76367  // Legal values for SqlMessage.op
 76368  
 76369  // State information about the server is stored in a static variable
 76370  // named "g" as follows:
 76371  type ServerState = struct {
 76372  	FqueueMutex   pthread_mutex_t
 76373  	FserverMutex  pthread_mutex_t
 76374  	FserverWakeup pthread_cond_t
 76375  	FserverHalt   int32
 76376  	FpQueueHead   uintptr
 76377  	FpQueueTail   uintptr
 76378  	_             [4]byte
 76379  } /* test_server.c:252:8 */
 76380  
 76381  // Legal values for SqlMessage.op
 76382  
 76383  // State information about the server is stored in a static variable
 76384  // named "g" as follows:
 76385  var g4 = ServerState{} /* test_server.c:259:3 */
 76386  
 76387  // Send a message to the server.  Block until we get a reply.
 76388  //
 76389  // The mutex and condition variable in the message are uninitialized
 76390  // when this routine is called.  This routine takes care of
 76391  // initializing them and destroying them when it has finished.
 76392  func sendToServer(tls *libc.TLS, pMsg uintptr) { /* test_server.c:272:13: */
 76393  	// Initialize the mutex and condition variable on the message
 76394  	libc2.Xpthread_mutex_init(tls, (pMsg + 36 /* &.clientMutex */), uintptr(0))
 76395  	libc2.Xpthread_cond_init(tls, (pMsg + 64 /* &.clientWakeup */), uintptr(0))
 76396  
 76397  	// Add the message to the head of the server's message queue.
 76398  	libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 76399  	(*SqlMessage)(unsafe.Pointer(pMsg)).FpNext = g4.FpQueueHead
 76400  	if g4.FpQueueHead == uintptr(0) {
 76401  		g4.FpQueueTail = pMsg
 76402  	} else {
 76403  		(*SqlMessage)(unsafe.Pointer(g4.FpQueueHead)).FpPrev = pMsg
 76404  	}
 76405  	(*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev = uintptr(0)
 76406  	g4.FpQueueHead = pMsg
 76407  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 76408  
 76409  	// Signal the server that the new message has be queued, then
 76410  	// block waiting for the server to process the message.
 76411  	libc2.Xpthread_mutex_lock(tls, (pMsg + 36 /* &.clientMutex */))
 76412  	libc2.Xpthread_cond_signal(tls, (uintptr(unsafe.Pointer(&g4)) + 48 /* &.serverWakeup */))
 76413  	for (*SqlMessage)(unsafe.Pointer(pMsg)).Fop != MSG_Done {
 76414  		libc2.Xpthread_cond_wait(tls, (pMsg + 64 /* &.clientWakeup */), (pMsg + 36 /* &.clientMutex */))
 76415  	}
 76416  	libc2.Xpthread_mutex_unlock(tls, (pMsg + 36 /* &.clientMutex */))
 76417  
 76418  	// Destroy the mutex and condition variable of the message.
 76419  	libc2.Xpthread_mutex_destroy(tls, (pMsg + 36 /* &.clientMutex */))
 76420  	libc2.Xpthread_cond_destroy(tls, (pMsg + 64 /* &.clientWakeup */))
 76421  }
 76422  
 76423  // The following 6 routines are client-side implementations of the
 76424  // core SQLite interfaces:
 76425  //
 76426  //        sqlite3_open
 76427  //        sqlite3_prepare
 76428  //        sqlite3_step
 76429  //        sqlite3_reset
 76430  //        sqlite3_finalize
 76431  //        sqlite3_close
 76432  //
 76433  // Clients should use the following client-side routines instead of
 76434  // the core routines above.
 76435  //
 76436  //        sqlite3_client_open
 76437  //        sqlite3_client_prepare
 76438  //        sqlite3_client_step
 76439  //        sqlite3_client_reset
 76440  //        sqlite3_client_finalize
 76441  //        sqlite3_client_close
 76442  //
 76443  // Each of these routines creates a message for the desired operation,
 76444  // sends that message to the server, waits for the server to process
 76445  // then message and return a response.
 76446  func sqlite3_client_open(tls *libc.TLS, zDatabaseName uintptr, ppDb uintptr) int32 { /* test_server.c:332:5: */
 76447  	bp := tls.Alloc(112)
 76448  	defer tls.Free(112)
 76449  
 76450  	// var msg SqlMessage at bp, 112
 76451  
 76452  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Open
 76453  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzIn = zDatabaseName
 76454  	sendToServer(tls, bp /* &msg */)
 76455  	*(*uintptr)(unsafe.Pointer(ppDb)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb
 76456  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76457  }
 76458  
 76459  func sqlite3_client_prepare(tls *libc.TLS, pDb uintptr, zSql uintptr, nByte int32, ppStmt uintptr, pzTail uintptr) int32 { /* test_server.c:340:5: */
 76460  	bp := tls.Alloc(112)
 76461  	defer tls.Free(112)
 76462  
 76463  	// var msg SqlMessage at bp, 112
 76464  
 76465  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Prepare
 76466  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb = pDb
 76467  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzIn = zSql
 76468  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FnByte = nByte
 76469  	sendToServer(tls, bp /* &msg */)
 76470  	*(*uintptr)(unsafe.Pointer(ppStmt)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt
 76471  	if pzTail != 0 {
 76472  		*(*uintptr)(unsafe.Pointer(pzTail)) = (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FzOut
 76473  	}
 76474  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76475  }
 76476  
 76477  func sqlite3_client_step(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:357:5: */
 76478  	bp := tls.Alloc(112)
 76479  	defer tls.Free(112)
 76480  
 76481  	// var msg SqlMessage at bp, 112
 76482  
 76483  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Step
 76484  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 76485  	sendToServer(tls, bp /* &msg */)
 76486  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76487  }
 76488  
 76489  func sqlite3_client_reset(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:364:5: */
 76490  	bp := tls.Alloc(112)
 76491  	defer tls.Free(112)
 76492  
 76493  	// var msg SqlMessage at bp, 112
 76494  
 76495  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Reset
 76496  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 76497  	sendToServer(tls, bp /* &msg */)
 76498  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76499  }
 76500  
 76501  func sqlite3_client_finalize(tls *libc.TLS, pStmt uintptr) int32 { /* test_server.c:371:5: */
 76502  	bp := tls.Alloc(112)
 76503  	defer tls.Free(112)
 76504  
 76505  	// var msg SqlMessage at bp, 112
 76506  
 76507  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Finalize
 76508  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpStmt = pStmt
 76509  	sendToServer(tls, bp /* &msg */)
 76510  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76511  }
 76512  
 76513  func sqlite3_client_close(tls *libc.TLS, pDb uintptr) int32 { /* test_server.c:378:5: */
 76514  	bp := tls.Alloc(112)
 76515  	defer tls.Free(112)
 76516  
 76517  	// var msg SqlMessage at bp, 112
 76518  
 76519  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).Fop = MSG_Close
 76520  	(*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FpDb = pDb
 76521  	sendToServer(tls, bp /* &msg */)
 76522  	return (*SqlMessage)(unsafe.Pointer(bp /* &msg */)).FerrCode
 76523  }
 76524  
 76525  // This routine implements the server.  To start the server, first
 76526  // make sure g.serverHalt is false, then create a new detached thread
 76527  // on this procedure.  See the sqlite3_server_start() routine below
 76528  // for an example.  This procedure loops until g.serverHalt becomes
 76529  // true.
 76530  func sqlite3_server(tls *libc.TLS, NotUsed uintptr) uintptr { /* test_server.c:393:6: */
 76531  	if libc2.Xpthread_mutex_trylock(tls, (uintptr(unsafe.Pointer(&g4))+24 /* &.serverMutex */)) != 0 {
 76532  		return uintptr(0) // Another server is already running
 76533  	}
 76534  	sqlite3.Xsqlite3_enable_shared_cache(tls, 1)
 76535  	for !(g4.FserverHalt != 0) {
 76536  		var pMsg uintptr
 76537  
 76538  		// Remove the last message from the message queue.
 76539  		libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 76540  		for (g4.FpQueueTail == uintptr(0)) && (g4.FserverHalt == 0) {
 76541  			libc2.Xpthread_cond_wait(tls, (uintptr(unsafe.Pointer(&g4)) + 48 /* &.serverWakeup */), (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 76542  		}
 76543  		pMsg = g4.FpQueueTail
 76544  		if pMsg != 0 {
 76545  			if (*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev != 0 {
 76546  				(*SqlMessage)(unsafe.Pointer((*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev)).FpNext = uintptr(0)
 76547  			} else {
 76548  				g4.FpQueueHead = uintptr(0)
 76549  			}
 76550  			g4.FpQueueTail = (*SqlMessage)(unsafe.Pointer(pMsg)).FpPrev
 76551  		}
 76552  		libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) /* &.queueMutex */))
 76553  		if pMsg == uintptr(0) {
 76554  			break
 76555  		}
 76556  
 76557  		// Process the message just removed
 76558  		libc2.Xpthread_mutex_lock(tls, (pMsg + 36 /* &.clientMutex */))
 76559  		switch (*SqlMessage)(unsafe.Pointer(pMsg)).Fop {
 76560  		case MSG_Open:
 76561  			{
 76562  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_open(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FzIn, (pMsg + 4 /* &.pDb */))
 76563  				break
 76564  
 76565  			}
 76566  		case MSG_Prepare:
 76567  			{
 76568  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_prepare(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpDb, (*SqlMessage)(unsafe.Pointer(pMsg)).FzIn, (*SqlMessage)(unsafe.Pointer(pMsg)).FnByte,
 76569  					(pMsg + 8 /* &.pStmt */), (pMsg + 24 /* &.zOut */))
 76570  				break
 76571  
 76572  			}
 76573  		case MSG_Step:
 76574  			{
 76575  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_step(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 76576  				break
 76577  
 76578  			}
 76579  		case MSG_Reset:
 76580  			{
 76581  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_reset(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 76582  				break
 76583  
 76584  			}
 76585  		case MSG_Finalize:
 76586  			{
 76587  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_finalize(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpStmt)
 76588  				break
 76589  
 76590  			}
 76591  		case MSG_Close:
 76592  			{
 76593  				(*SqlMessage)(unsafe.Pointer(pMsg)).FerrCode = sqlite3.Xsqlite3_close(tls, (*SqlMessage)(unsafe.Pointer(pMsg)).FpDb)
 76594  				break
 76595  
 76596  			}
 76597  		}
 76598  
 76599  		// Signal the client that the message has been processed.
 76600  		(*SqlMessage)(unsafe.Pointer(pMsg)).Fop = MSG_Done
 76601  		libc2.Xpthread_mutex_unlock(tls, (pMsg + 36 /* &.clientMutex */))
 76602  		libc2.Xpthread_cond_signal(tls, (pMsg + 64 /* &.clientWakeup */))
 76603  	}
 76604  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) + 24 /* &.serverMutex */))
 76605  	return uintptr(0)
 76606  }
 76607  
 76608  // Start a server thread if one is not already running.  If there
 76609  // is aleady a server thread running, the new thread will quickly
 76610  // die and this routine is effectively a no-op.
 76611  func sqlite3_server_start(tls *libc.TLS) { /* test_server.c:465:6: */
 76612  	bp := tls.Alloc(4)
 76613  	defer tls.Free(4)
 76614  
 76615  	// var x pthread_t at bp, 4
 76616  
 76617  	var rc int32
 76618  	g4.FserverHalt = 0
 76619  	rc = libc2.Xpthread_create(tls, bp /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 76620  		f func(*libc.TLS, uintptr) uintptr
 76621  	}{sqlite3_server})), uintptr(0))
 76622  	if rc == 0 {
 76623  		libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp /* x */)))
 76624  	}
 76625  }
 76626  
 76627  // A wrapper around sqlite3_server() that decrements the int variable
 76628  // pointed to by the first argument after the sqlite3_server() call
 76629  // returns.
 76630  func serverWrapper(tls *libc.TLS, pnDecr uintptr) uintptr { /* test_server.c:480:13: */
 76631  	var p uintptr = sqlite3_server(tls, uintptr(0))
 76632  	(*(*int32)(unsafe.Pointer(pnDecr)))--
 76633  	return p
 76634  }
 76635  
 76636  // This function is the similar to sqlite3_server_start(), except that
 76637  // the integer pointed to by the first argument is decremented when
 76638  // the server thread exits.
 76639  func sqlite3_server_start2(tls *libc.TLS, pnDecr uintptr) { /* test_server.c:491:6: */
 76640  	bp := tls.Alloc(4)
 76641  	defer tls.Free(4)
 76642  
 76643  	// var x pthread_t at bp, 4
 76644  
 76645  	var rc int32
 76646  	g4.FserverHalt = 0
 76647  	rc = libc2.Xpthread_create(tls, bp /* &x */, uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 76648  		f func(*libc.TLS, uintptr) uintptr
 76649  	}{serverWrapper})), pnDecr)
 76650  	if rc == 0 {
 76651  		libc2.Xpthread_detach(tls, *(*pthread_t)(unsafe.Pointer(bp /* x */)))
 76652  	}
 76653  }
 76654  
 76655  // If a server thread is running, then stop it.  If no server is
 76656  // running, this routine is effectively a no-op.
 76657  //
 76658  // This routine waits until the server has actually stopped before
 76659  // returning.
 76660  func sqlite3_server_stop(tls *libc.TLS) { /* test_server.c:508:6: */
 76661  	g4.FserverHalt = 1
 76662  	libc2.Xpthread_cond_broadcast(tls, (uintptr(unsafe.Pointer(&g4)) + 48 /* &.serverWakeup */))
 76663  	libc2.Xpthread_mutex_lock(tls, (uintptr(unsafe.Pointer(&g4)) + 24 /* &.serverMutex */))
 76664  	libc2.Xpthread_mutex_unlock(tls, (uintptr(unsafe.Pointer(&g4)) + 24 /* &.serverMutex */))
 76665  }
 76666  
 76667  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 76668  //    This file is part of the GNU C Library.
 76669  //
 76670  //    The GNU C Library is free software; you can redistribute it and/or
 76671  //    modify it under the terms of the GNU Lesser General Public
 76672  //    License as published by the Free Software Foundation; either
 76673  //    version 2.1 of the License, or (at your option) any later version.
 76674  //
 76675  //    The GNU C Library is distributed in the hope that it will be useful,
 76676  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 76677  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 76678  //    Lesser General Public License for more details.
 76679  //
 76680  //    You should have received a copy of the GNU Lesser General Public
 76681  //    License along with the GNU C Library; if not, see
 76682  //    <http://www.gnu.org/licenses/>.
 76683  
 76684  //	ISO C99 Standard: 7.2 Diagnostics	<assert.h>
 76685  
 76686  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 76687  //    This file is part of the GNU C Library.
 76688  //
 76689  //    The GNU C Library is free software; you can redistribute it and/or
 76690  //    modify it under the terms of the GNU Lesser General Public
 76691  //    License as published by the Free Software Foundation; either
 76692  //    version 2.1 of the License, or (at your option) any later version.
 76693  //
 76694  //    The GNU C Library is distributed in the hope that it will be useful,
 76695  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 76696  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 76697  //    Lesser General Public License for more details.
 76698  //
 76699  //    You should have received a copy of the GNU Lesser General Public
 76700  //    License along with the GNU C Library; if not, see
 76701  //    <http://www.gnu.org/licenses/>.
 76702  
 76703  // void assert (int expression);
 76704  //
 76705  //    If NDEBUG is defined, do nothing.
 76706  //    If not, and EXPRESSION is zero, print an error message and abort.
 76707  
 76708  // void assert_perror (int errnum);
 76709  //
 76710  //    If NDEBUG is defined, do nothing.  If not, and ERRNUM is not zero, print an
 76711  //    error message with the error text for ERRNUM and abort.
 76712  //    (This is a GNU extension.)
 76713  
 76714  // A structure to collect a busy-handler callback and argument and a count
 76715  // of the number of times it has been invoked.
 76716  type SuperlockBusy1 = struct {
 76717  	FxBusy    uintptr
 76718  	FpBusyArg uintptr
 76719  	FnBusy    int32
 76720  } /* test_superlock.c:29:1 */
 76721  
 76722  type SuperlockBusy = SuperlockBusy1 /* test_superlock.c:34:30 */
 76723  
 76724  // An instance of the following structure is allocated for each active
 76725  // superlock. The opaque handle returned by sqlite3demo_superlock() is
 76726  // actually a pointer to an instance of this structure.
 76727  type Superlock1 = struct {
 76728  	Fdb   uintptr
 76729  	FbWal int32
 76730  } /* test_superlock.c:41:1 */
 76731  
 76732  type Superlock = Superlock1 /* test_superlock.c:45:26 */
 76733  
 76734  // The pCtx pointer passed to this function is actually a pointer to a
 76735  // SuperlockBusy structure. Invoke the busy-handler function encapsulated
 76736  // by the structure and return the result.
 76737  func superlockBusyHandler(tls *libc.TLS, pCtx uintptr, UNUSED int32) int32 { /* test_superlock.c:52:12: */
 76738  	var pBusy uintptr = pCtx
 76739  	if (*SuperlockBusy)(unsafe.Pointer(pBusy)).FxBusy == uintptr(0) {
 76740  		return 0
 76741  	}
 76742  	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))
 76743  }
 76744  
 76745  // This function is used to determine if the main database file for
 76746  // connection db is open in WAL mode or not. If no error occurs and the
 76747  // database file is in WAL mode, set *pbWal to true and return SQLITE_OK.
 76748  // If it is not in WAL mode, set *pbWal to false.
 76749  //
 76750  // If an error occurs, return an SQLite error code. The value of *pbWal
 76751  // is undefined in this case.
 76752  func superlockIsWal(tls *libc.TLS, pLock uintptr) int32 { /* test_superlock.c:67:12: */
 76753  	bp := tls.Alloc(4)
 76754  	defer tls.Free(4)
 76755  
 76756  	var rc int32 // Return Code
 76757  	// var pStmt uintptr at bp, 4
 76758  	// Compiled PRAGMA journal_mode statement
 76759  
 76760  	rc = sqlite3.Xsqlite3_prepare(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+37074 /* "PRAGMA main.jour..." */, -1, bp /* &pStmt */, uintptr(0))
 76761  	if rc != SQLITE_OK {
 76762  		return rc
 76763  	}
 76764  
 76765  	(*Superlock)(unsafe.Pointer(pLock)).FbWal = 0
 76766  	if SQLITE_ROW == sqlite3.Xsqlite3_step(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */))) {
 76767  		var zMode uintptr = sqlite3.Xsqlite3_column_text(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)), 0)
 76768  		if ((zMode != 0) && (libc.Xstrlen(tls, zMode) == size_t(3))) && (sqlite3.Xsqlite3_strnicmp(tls, ts+30141 /* "wal" */, zMode, 3) == 0) {
 76769  			(*Superlock)(unsafe.Pointer(pLock)).FbWal = 1
 76770  		}
 76771  	}
 76772  
 76773  	return sqlite3.Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp /* pStmt */)))
 76774  }
 76775  
 76776  // Obtain an exclusive shm-lock on nByte bytes starting at offset idx
 76777  // of the file fd. If the lock cannot be obtained immediately, invoke
 76778  // the busy-handler until either it is obtained or the busy-handler
 76779  // callback returns 0.
 76780  func superlockShmLock(tls *libc.TLS, fd uintptr, idx int32, nByte int32, pBusy uintptr) int32 { /* test_superlock.c:91:12: */
 76781  	var rc int32
 76782  	var xShmLock uintptr = (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer(fd)).FpMethods)).FxShmLock
 76783  	for ok := true; ok; ok = ((rc == SQLITE_BUSY) && (superlockBusyHandler(tls, pBusy, 0) != 0)) {
 76784  		rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(&xShmLock)))(tls, fd, idx, nByte, (SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE))
 76785  	}
 76786  	return rc
 76787  }
 76788  
 76789  // Obtain the extra locks on the database file required for WAL databases.
 76790  // Invoke the supplied busy-handler as required.
 76791  func superlockWalLock(tls *libc.TLS, db uintptr, pBusy uintptr) int32 { /* test_superlock.c:109:12: */
 76792  	bp := tls.Alloc(8)
 76793  	defer tls.Free(8)
 76794  
 76795  	var rc int32                                             // Return code
 76796  	*(*uintptr)(unsafe.Pointer(bp /* fd */)) = uintptr(0)    // Main database file handle
 76797  	*(*uintptr)(unsafe.Pointer(bp + 4 /* p */)) = uintptr(0) // Pointer to first page of shared memory
 76798  
 76799  	// Obtain a pointer to the sqlite3_file object open on the main db file.
 76800  	rc = sqlite3.Xsqlite3_file_control(tls, db, ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp /* &fd */)
 76801  	if rc != SQLITE_OK {
 76802  		return rc
 76803  	}
 76804  
 76805  	// Obtain the "recovery" lock. Normally, this lock is only obtained by
 76806  	// clients running database recovery.
 76807  	rc = superlockShmLock(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 2, 1, pBusy)
 76808  	if rc != SQLITE_OK {
 76809  		return rc
 76810  	}
 76811  
 76812  	// Zero the start of the first shared-memory page. This means that any
 76813  	// clients that open read or write transactions from this point on will
 76814  	// have to run recovery before proceeding. Since they need the "recovery"
 76815  	// lock that this process is holding to do that, no new read or write
 76816  	// transactions may now be opened. Nor can a checkpoint be run, for the
 76817  	// same reason.
 76818  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 52 /* &.xShmMap */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 0, (32 * 1024), 1, bp+4 /* &p */)
 76819  	if rc != SQLITE_OK {
 76820  		return rc
 76821  	}
 76822  	libc.Xmemset(tls, libc.AtomicLoadPUintptr(bp+4 /* p */), 0, uint32(32))
 76823  
 76824  	// Obtain exclusive locks on all the "read-lock" slots. Once these locks
 76825  	// are held, it is guaranteed that there are no active reader, writer or
 76826  	// checkpointer clients.
 76827  	rc = superlockShmLock(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 3, (SQLITE_SHM_NLOCK - 3), pBusy)
 76828  	return rc
 76829  }
 76830  
 76831  // Release a superlock held on a database file. The argument passed to
 76832  // this function must have been obtained from a successful call to
 76833  // sqlite3demo_superlock().
 76834  func sqlite3demo_superunlock(tls *libc.TLS, pLock uintptr) { /* test_superlock.c:151:6: */
 76835  	bp := tls.Alloc(4)
 76836  	defer tls.Free(4)
 76837  
 76838  	var p uintptr = pLock
 76839  	if (*Superlock)(unsafe.Pointer(p)).FbWal != 0 {
 76840  		var rc int32 // Return code
 76841  		var flags int32 = (SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE)
 76842  		*(*uintptr)(unsafe.Pointer(bp /* fd */)) = uintptr(0)
 76843  		rc = sqlite3.Xsqlite3_file_control(tls, (*Superlock)(unsafe.Pointer(p)).Fdb, ts+85 /* "main" */, SQLITE_FCNTL_FILE_POINTER, bp /* &fd */)
 76844  		if rc == SQLITE_OK {
 76845  			(*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 56 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 2, 1, flags)
 76846  			(*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp /* fd */)))).FpMethods + 56 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp /* fd */)), 3, (SQLITE_SHM_NLOCK - 3), flags)
 76847  		}
 76848  	}
 76849  	sqlite3.Xsqlite3_close(tls, (*Superlock)(unsafe.Pointer(p)).Fdb)
 76850  	sqlite3.Xsqlite3_free(tls, p)
 76851  }
 76852  
 76853  // Obtain a superlock on the database file identified by zPath, using the
 76854  // locking primitives provided by VFS zVfs. If successful, SQLITE_OK is
 76855  // returned and output variable *ppLock is populated with an opaque handle
 76856  // that may be used with sqlite3demo_superunlock() to release the lock.
 76857  //
 76858  // If an error occurs, *ppLock is set to 0 and an SQLite error code
 76859  // (e.g. SQLITE_BUSY) is returned.
 76860  //
 76861  // If a required lock cannot be obtained immediately and the xBusy parameter
 76862  // to this function is not NULL, then xBusy is invoked in the same way
 76863  // as a busy-handler registered with SQLite (using sqlite3_busy_handler())
 76864  // until either the lock can be obtained or the busy-handler function returns
 76865  // 0 (indicating "give up").
 76866  func sqlite3demo_superlock(tls *libc.TLS, zPath uintptr, zVfs uintptr, xBusy uintptr, pBusyArg uintptr, ppLock uintptr) int32 { /* test_superlock.c:182:5: */
 76867  	bp := tls.Alloc(12)
 76868  	defer tls.Free(12)
 76869  
 76870  	*(*SuperlockBusy)(unsafe.Pointer(bp /* busy */)) = SuperlockBusy{} // Busy handler wrapper object
 76871  	var rc int32                                                       // Return code
 76872  	var pLock uintptr
 76873  
 76874  	pLock = sqlite3.Xsqlite3_malloc(tls, int32(unsafe.Sizeof(Superlock{})))
 76875  	if !(pLock != 0) {
 76876  		return SQLITE_NOMEM
 76877  	}
 76878  	libc.Xmemset(tls, pLock, 0, uint32(unsafe.Sizeof(Superlock{})))
 76879  
 76880  	// Open a database handle on the file to superlock.
 76881  	rc = sqlite3.Xsqlite3_open_v2(tls,
 76882  		zPath, (pLock /* &.db */), (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE), zVfs)
 76883  
 76884  	// Install a busy-handler and execute a BEGIN EXCLUSIVE. If this is not
 76885  	// a WAL database, this is all we need to do.
 76886  	//
 76887  	// A wrapper function is used to invoke the busy-handler instead of
 76888  	// registering the busy-handler function supplied by the user directly
 76889  	// with SQLite. This is because the same busy-handler function may be
 76890  	// invoked directly later on when attempting to obtain the extra locks
 76891  	// required in WAL mode. By using the wrapper, we are able to guarantee
 76892  	// that the "nBusy" integer parameter passed to the users busy-handler
 76893  	// represents the total number of busy-handler invocations made within
 76894  	// this call to sqlite3demo_superlock(), including any made during the
 76895  	// "BEGIN EXCLUSIVE".
 76896  	if rc == SQLITE_OK {
 76897  		(*SuperlockBusy)(unsafe.Pointer(bp /* &busy */)).FxBusy = xBusy
 76898  		(*SuperlockBusy)(unsafe.Pointer(bp /* &busy */)).FpBusyArg = pBusyArg
 76899  		sqlite3.Xsqlite3_busy_handler(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, *(*uintptr)(unsafe.Pointer(&struct {
 76900  			f func(*libc.TLS, uintptr, int32) int32
 76901  		}{superlockBusyHandler})), bp /* &busy */)
 76902  		rc = sqlite3.Xsqlite3_exec(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+13687 /* "BEGIN EXCLUSIVE" */, uintptr(0), uintptr(0), uintptr(0))
 76903  	}
 76904  
 76905  	// If the BEGIN EXCLUSIVE was executed successfully and this is a WAL
 76906  	// database, call superlockWalLock() to obtain the extra locks required
 76907  	// to prevent readers, writers and/or checkpointers from accessing the
 76908  	// db while this process is holding the superlock.
 76909  	//
 76910  	// Before attempting any WAL locks, commit the transaction started above
 76911  	// to drop the WAL read and write locks currently held. Otherwise, the
 76912  	// new WAL locks may conflict with the old.
 76913  	if rc == SQLITE_OK {
 76914  		if (SQLITE_OK == (libc.AssignInt32(&rc, superlockIsWal(tls, pLock)))) && ((*Superlock)(unsafe.Pointer(pLock)).FbWal != 0) {
 76915  			rc = sqlite3.Xsqlite3_exec(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, ts+12098 /* "COMMIT" */, uintptr(0), uintptr(0), uintptr(0))
 76916  			if rc == SQLITE_OK {
 76917  				rc = superlockWalLock(tls, (*Superlock)(unsafe.Pointer(pLock)).Fdb, bp /* &busy */)
 76918  			}
 76919  		}
 76920  	}
 76921  
 76922  	if rc != SQLITE_OK {
 76923  		sqlite3demo_superunlock(tls, pLock)
 76924  		*(*uintptr)(unsafe.Pointer(ppLock)) = uintptr(0)
 76925  	} else {
 76926  		*(*uintptr)(unsafe.Pointer(ppLock)) = pLock
 76927  	}
 76928  
 76929  	return rc
 76930  }
 76931  
 76932  // end block for C++
 76933  
 76934  // Local Variables:
 76935  // mode: c
 76936  // c-basic-offset: 4
 76937  // fill-column: 78
 76938  // End:
 76939  
 76940  type InterpAndScript1 = struct {
 76941  	Finterp  uintptr
 76942  	FpScript uintptr
 76943  } /* test_superlock.c:268:1 */
 76944  
 76945  type InterpAndScript = InterpAndScript1 /* test_superlock.c:272:32 */
 76946  
 76947  func superunlock_del(tls *libc.TLS, cd ClientData) { /* test_superlock.c:274:27: */
 76948  	sqlite3demo_superunlock(tls, cd)
 76949  }
 76950  
 76951  func superunlock_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_superlock.c:278:26: */
 76952  	if objc != 1 {
 76953  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+489 /* "" */)
 76954  		return TCL_ERROR
 76955  	}
 76956  	tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 76957  	return TCL_OK
 76958  }
 76959  
 76960  func superlock_busy(tls *libc.TLS, pCtx uintptr, nBusy int32) int32 { /* test_superlock.c:292:12: */
 76961  	bp := tls.Alloc(4)
 76962  	defer tls.Free(4)
 76963  
 76964  	var p uintptr = pCtx
 76965  	var pEval uintptr                            // Script to evaluate
 76966  	*(*int32)(unsafe.Pointer(bp /* iVal */)) = 0 // Value to return
 76967  
 76968  	pEval = tcl.XTcl_DuplicateObj(tls, (*InterpAndScript)(unsafe.Pointer(p)).FpScript)
 76969  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 76970  	tcl.XTcl_ListObjAppendElement(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewIntObj(tls, nBusy))
 76971  	tcl.XTcl_EvalObjEx(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 76972  	tcl.XTcl_GetIntFromObj(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp, tcl.XTcl_GetObjResult(tls, (*InterpAndScript)(unsafe.Pointer(p)).Finterp), bp /* &iVal */)
 76973  	for ok := true; ok; ok = 0 != 0 {
 76974  		var _objPtr uintptr = pEval
 76975  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 76976  			tcl.XTclFreeObj(tls, _objPtr)
 76977  		}
 76978  	}
 76979  
 76980  	return *(*int32)(unsafe.Pointer(bp /* iVal */))
 76981  }
 76982  
 76983  // Tclcmd: sqlite3demo_superlock CMDNAME PATH VFS BUSY-HANDLER-SCRIPT
 76984  func superlock_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_superlock.c:310:26: */
 76985  	bp := tls.Alloc(28)
 76986  	defer tls.Free(28)
 76987  
 76988  	// var pLock uintptr at bp+24, 4
 76989  	// Lock context
 76990  	var zPath uintptr
 76991  	var zVfs uintptr = uintptr(0)
 76992  	*(*InterpAndScript)(unsafe.Pointer(bp + 16 /* busy */)) = InterpAndScript{}
 76993  	var xBusy uintptr = uintptr(0) // Busy handler callback
 76994  	var rc int32                   // Return code from sqlite3demo_superlock()
 76995  
 76996  	if (objc < 3) || (objc > 5) {
 76997  		tcl.XTcl_WrongNumArgs(tls,
 76998  			interp, 1, objv, ts+37099 /* "CMDNAME PATH ?VF..." */)
 76999  		return TCL_ERROR
 77000  	}
 77001  
 77002  	zPath = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 77003  
 77004  	if objc > 3 {
 77005  		zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 77006  		if libc.Xstrlen(tls, zVfs) == size_t(0) {
 77007  			zVfs = uintptr(0)
 77008  		}
 77009  	}
 77010  	if objc > 4 {
 77011  		(*InterpAndScript)(unsafe.Pointer(bp + 16 /* &busy */)).Finterp = interp
 77012  		(*InterpAndScript)(unsafe.Pointer(bp + 16 /* &busy */)).FpScript = *(*uintptr)(unsafe.Pointer(objv + 4*4))
 77013  		xBusy = *(*uintptr)(unsafe.Pointer(&struct {
 77014  			f func(*libc.TLS, uintptr, int32) int32
 77015  		}{superlock_busy}))
 77016  	}
 77017  
 77018  	rc = sqlite3demo_superlock(tls, zPath, zVfs, xBusy, bp+16 /* &busy */, bp+24 /* &pLock */)
 77019  
 77020  	if rc != SQLITE_OK {
 77021  		tcl.XTcl_ResetResult(tls, interp)
 77022  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, sqlite3.Xsqlite3ErrStr(tls, rc), 0))
 77023  		return TCL_ERROR
 77024  	}
 77025  
 77026  	tcl.XTcl_CreateObjCommand(tls,
 77027  		interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), *(*uintptr)(unsafe.Pointer(&struct {
 77028  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 77029  		}{superunlock_cmd})), *(*uintptr)(unsafe.Pointer(bp + 24 /* pLock */)), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{superunlock_del})))
 77030  	tcl.XTcl_SetObjResult(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 77031  	return TCL_OK
 77032  }
 77033  
 77034  func SqliteSuperlock_Init(tls *libc.TLS, interp uintptr) int32 { /* test_superlock.c:359:5: */
 77035  	tcl.XTcl_CreateObjCommand(tls, interp, ts+37140 /* "sqlite3demo_supe..." */, *(*uintptr)(unsafe.Pointer(&struct {
 77036  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 77037  	}{superlock_cmd})), uintptr(0), uintptr(0))
 77038  	return TCL_OK
 77039  }
 77040  
 77041  // Define error_t.
 77042  //    Copyright (C) 1991-2018 Free Software Foundation, Inc.
 77043  //    This file is part of the GNU C Library.
 77044  //
 77045  //    The GNU C Library is free software; you can redistribute it and/or
 77046  //    modify it under the terms of the GNU Lesser General Public
 77047  //    License as published by the Free Software Foundation; either
 77048  //    version 2.1 of the License, or (at your option) any later version.
 77049  //
 77050  //    The GNU C Library is distributed in the hope that it will be useful,
 77051  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 77052  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 77053  //    Lesser General Public License for more details.
 77054  //
 77055  //    You should have received a copy of the GNU Lesser General Public
 77056  //    License along with the GNU C Library; if not, see
 77057  //    <http://www.gnu.org/licenses/>.
 77058  
 77059  type error_t = int32 /* error_t.h:22:13 */
 77060  
 77061  type TestSyscallGlobal = struct {
 77062  	FbPersist         int32
 77063  	FnCount           int32
 77064  	FnFail            int32
 77065  	Fpgsz             int32
 77066  	Forig_getpagesize sqlite3_syscall_ptr
 77067  } /* test_syscall.c:97:8 */
 77068  
 77069  var gSyscall = TestSyscallGlobal{} /* test_syscall.c:103:3 */
 77070  
 77071  type TestSyscallArray = struct {
 77072  	FzName         uintptr
 77073  	FxTest         sqlite3_syscall_ptr
 77074  	FxOrig         sqlite3_syscall_ptr
 77075  	Fdefault_errno int32
 77076  	Fcustom_errno  int32
 77077  } /* test_syscall.c:127:1 */
 77078  
 77079  var aSyscall = [19]TestSyscallArray{
 77080  	/*  0 */ {FzName: ts + 37162 /* "open" */, FxTest: 0, Fdefault_errno: EACCES},
 77081  	/*  1 */ {FzName: ts + 10125 /* "close" */, FxTest: 0},
 77082  	/*  2 */ {FzName: ts + 37167 /* "access" */, FxTest: 0},
 77083  	/*  3 */ {FzName: ts + 37174 /* "getcwd" */, FxTest: 0},
 77084  	/*  4 */ {FzName: ts + 37181 /* "stat" */, FxTest: 0},
 77085  	/*  5 */ {FzName: ts + 37186 /* "fstat" */, FxTest: 0},
 77086  	/*  6 */ {FzName: ts + 37192 /* "ftruncate" */, FxTest: 0, Fdefault_errno: EIO},
 77087  	/*  7 */ {FzName: ts + 37202 /* "fcntl" */, FxTest: 0, Fdefault_errno: EACCES},
 77088  	/*  8 */ {FzName: ts + 25406 /* "read" */, FxTest: 0},
 77089  	/*  9 */ {FzName: ts + 37208 /* "pread" */, FxTest: 0},
 77090  	/* 10 */ {FzName: ts + 37214 /* "pread64" */, FxTest: 0},
 77091  	/* 11 */ {FzName: ts + 25411 /* "write" */, FxTest: 0},
 77092  	/* 12 */ {FzName: ts + 37222 /* "pwrite" */, FxTest: 0},
 77093  	/* 13 */ {FzName: ts + 37229 /* "pwrite64" */, FxTest: 0},
 77094  	/* 14 */ {FzName: ts + 37238 /* "fchmod" */, FxTest: 0},
 77095  	/* 15 */ {FzName: ts + 37245 /* "fallocate" */, FxTest: 0},
 77096  	/* 16 */ {FzName: ts + 29235 /* "mmap" */, FxTest: 0},
 77097  	/* 17 */ {FzName: ts + 37255 /* "mremap" */, FxTest: 0},
 77098  	{},
 77099  } /* test_syscall.c:133:3 */
 77100  
 77101  // This function is called exactly once from within each invocation of a
 77102  // system call wrapper in this file. It returns 1 if the function should
 77103  // fail, or 0 if it should succeed.
 77104  func tsIsFail(tls *libc.TLS) int32 { /* test_syscall.c:181:12: */
 77105  	gSyscall.FnCount--
 77106  	if (gSyscall.FnCount == 0) || ((gSyscall.FnFail != 0) && (gSyscall.FbPersist != 0)) {
 77107  		gSyscall.FnFail++
 77108  		return 1
 77109  	}
 77110  	return 0
 77111  }
 77112  
 77113  // Return the current error-number value for function zFunc. zFunc must be
 77114  // the name of a system call in the aSyscall[] table.
 77115  //
 77116  // Usually, the current error-number is the value that errno should be set
 77117  // to if the named system call fails. The exception is "fallocate". See
 77118  // comments above the implementation of ts_fallocate() for details.
 77119  func tsErrno(tls *libc.TLS, zFunc uintptr) int32 { /* test_syscall.c:198:12: */
 77120  	var i int32
 77121  	var nFunc int32 = int32(libc.Xstrlen(tls, zFunc))
 77122  	for i = 0; aSyscall[i].FzName != 0; i++ {
 77123  		if libc.Xstrlen(tls, aSyscall[i].FzName) != size_t(nFunc) {
 77124  			continue
 77125  		}
 77126  		if libc.Xmemcmp(tls, aSyscall[i].FzName, zFunc, uint32(nFunc)) != 0 {
 77127  			continue
 77128  		}
 77129  		return aSyscall[i].Fcustom_errno
 77130  	}
 77131  
 77132  	return 0
 77133  }
 77134  
 77135  /*
 77136  ** A wrapper around tsIsFail(). If tsIsFail() returns non-zero, set the
 77137  ** value of errno before returning.
 77138   */
 77139  func tsIsFailErrno(tls *libc.TLS, zFunc uintptr) int32 { /* test_syscall.c:215:12: */
 77140  	if tsIsFail(tls) != 0 {
 77141  		(*(*int32)(unsafe.Pointer(libc.X__errno_location(tls)))) = tsErrno(tls, zFunc)
 77142  		return 1
 77143  	}
 77144  	return 0
 77145  }
 77146  
 77147  // A wrapper around open().
 77148  func ts_open(tls *libc.TLS, zFile uintptr, flags int32, mode int32) int32 { /* test_syscall.c:226:12: */
 77149  	if tsIsFailErrno(tls, ts+37162 /* "open" */) != 0 {
 77150  		return -1
 77151  	}
 77152  	return (*(*func(*libc.TLS, uintptr, int32, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8 /* &.xOrig */))))(tls, zFile, flags, mode)
 77153  }
 77154  
 77155  // A wrapper around close().
 77156  func ts_close(tls *libc.TLS, fd int32) int32 { /* test_syscall.c:236:12: */
 77157  	if tsIsFail(tls) != 0 {
 77158  		// Even if simulating an error, close the original file-descriptor.
 77159  		// This is to stop the test process from running out of file-descriptors
 77160  		// when running a long test. If a call to close() appears to fail, SQLite
 77161  		// never attempts to use the file-descriptor afterwards (or even to close
 77162  		// it a second time).
 77163  		(*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*20 + 8 /* &.xOrig */))))(tls, fd)
 77164  		return -1
 77165  	}
 77166  	return (*(*func(*libc.TLS, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 1*20 + 8 /* &.xOrig */))))(tls, fd)
 77167  }
 77168  
 77169  // A wrapper around access().
 77170  func ts_access(tls *libc.TLS, zPath uintptr, mode int32) int32 { /* test_syscall.c:252:12: */
 77171  	if tsIsFail(tls) != 0 {
 77172  		return -1
 77173  	}
 77174  	return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 2*20 + 8 /* &.xOrig */))))(tls, zPath, mode)
 77175  }
 77176  
 77177  // A wrapper around getcwd().
 77178  func ts_getcwd(tls *libc.TLS, zPath uintptr, nPath size_t) uintptr { /* test_syscall.c:262:13: */
 77179  	if tsIsFail(tls) != 0 {
 77180  		return uintptr(0)
 77181  	}
 77182  	return (*(*func(*libc.TLS, uintptr, size_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 3*20 + 8 /* &.xOrig */))))(tls, zPath, nPath)
 77183  }
 77184  
 77185  // A wrapper around stat().
 77186  func ts_stat(tls *libc.TLS, zPath uintptr, p uintptr) int32 { /* test_syscall.c:272:12: */
 77187  	if tsIsFail(tls) != 0 {
 77188  		return -1
 77189  	}
 77190  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 4*20 + 8 /* &.xOrig */))))(tls, zPath, p)
 77191  }
 77192  
 77193  // A wrapper around fstat().
 77194  func ts_fstat(tls *libc.TLS, fd int32, p uintptr) int32 { /* test_syscall.c:282:12: */
 77195  	if tsIsFailErrno(tls, ts+37186 /* "fstat" */) != 0 {
 77196  		return -1
 77197  	}
 77198  	return (*(*func(*libc.TLS, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 5*20 + 8 /* &.xOrig */))))(tls, fd, p)
 77199  }
 77200  
 77201  // A wrapper around ftruncate().
 77202  func ts_ftruncate(tls *libc.TLS, fd int32, n off_t) int32 { /* test_syscall.c:292:12: */
 77203  	if tsIsFailErrno(tls, ts+37192 /* "ftruncate" */) != 0 {
 77204  		return -1
 77205  	}
 77206  	return (*(*func(*libc.TLS, int32, off_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 6*20 + 8 /* &.xOrig */))))(tls, fd, n)
 77207  }
 77208  
 77209  // A wrapper around fcntl().
 77210  func ts_fcntl(tls *libc.TLS, fd int32, cmd int32, va uintptr) int32 { /* test_syscall.c:302:12: */
 77211  	bp := tls.Alloc(8)
 77212  	defer tls.Free(8)
 77213  
 77214  	var ap va_list
 77215  	_ = ap
 77216  	var pArg uintptr
 77217  	if tsIsFailErrno(tls, ts+37202 /* "fcntl" */) != 0 {
 77218  		return -1
 77219  	}
 77220  	ap = va
 77221  	pArg = libc.VaUintptr(&ap)
 77222  	return (*(*func(*libc.TLS, int32, int32, uintptr) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 7*20 + 8 /* &.xOrig */))))(tls, fd, cmd, libc.VaList(bp, pArg))
 77223  }
 77224  
 77225  // A wrapper around read().
 77226  func ts_read(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t) int32 { /* test_syscall.c:316:12: */
 77227  	if tsIsFailErrno(tls, ts+25406 /* "read" */) != 0 {
 77228  		return -1
 77229  	}
 77230  	return (*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 8*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf)
 77231  }
 77232  
 77233  // A wrapper around pread().
 77234  func ts_pread(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off off_t) int32 { /* test_syscall.c:326:12: */
 77235  	if tsIsFailErrno(tls, ts+37208 /* "pread" */) != 0 {
 77236  		return -1
 77237  	}
 77238  	return (*(*func(*libc.TLS, int32, uintptr, size_t, off_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 9*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off)
 77239  }
 77240  
 77241  // A wrapper around pread64().
 77242  func ts_pread64(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off sqlite3_uint64) int32 { /* test_syscall.c:336:12: */
 77243  	if tsIsFailErrno(tls, ts+37214 /* "pread64" */) != 0 {
 77244  		return -1
 77245  	}
 77246  	return (*(*func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 10*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off)
 77247  }
 77248  
 77249  // A wrapper around write().
 77250  func ts_write(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t) int32 { /* test_syscall.c:346:12: */
 77251  	if tsIsFailErrno(tls, ts+25411 /* "write" */) != 0 {
 77252  		if tsErrno(tls, ts+25411 /* "write" */) == EINTR {
 77253  			(*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, (nBuf / size_t(2)))
 77254  		}
 77255  		return -1
 77256  	}
 77257  	return (*(*func(*libc.TLS, int32, uintptr, size_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 11*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf)
 77258  }
 77259  
 77260  // A wrapper around pwrite().
 77261  func ts_pwrite(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off off_t) int32 { /* test_syscall.c:357:12: */
 77262  	if tsIsFailErrno(tls, ts+37222 /* "pwrite" */) != 0 {
 77263  		return -1
 77264  	}
 77265  	return (*(*func(*libc.TLS, int32, uintptr, size_t, off_t) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 12*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off)
 77266  }
 77267  
 77268  // A wrapper around pwrite64().
 77269  func ts_pwrite64(tls *libc.TLS, fd int32, aBuf uintptr, nBuf size_t, off sqlite3_uint64) int32 { /* test_syscall.c:367:12: */
 77270  	if tsIsFailErrno(tls, ts+37229 /* "pwrite64" */) != 0 {
 77271  		return -1
 77272  	}
 77273  	return (*(*func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) ssize_t)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 13*20 + 8 /* &.xOrig */))))(tls, fd, aBuf, nBuf, off)
 77274  }
 77275  
 77276  // A wrapper around fchmod().
 77277  func ts_fchmod(tls *libc.TLS, fd int32, mode mode_t) int32 { /* test_syscall.c:377:12: */
 77278  	if tsIsFail(tls) != 0 {
 77279  		return -1
 77280  	}
 77281  	return (*(*func(*libc.TLS, int32, mode_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 14*20 + 8 /* &.xOrig */))))(tls, fd, mode)
 77282  }
 77283  
 77284  // A wrapper around fallocate().
 77285  //
 77286  // SQLite assumes that the fallocate() function is compatible with
 77287  // posix_fallocate(). According to the Linux man page (2009-09-30):
 77288  //
 77289  //   posix_fallocate() returns  zero on success, or an error number on
 77290  //   failure. Note that errno is not set.
 77291  func ts_fallocate(tls *libc.TLS, fd int32, off off_t, len off_t) int32 { /* test_syscall.c:393:12: */
 77292  	if tsIsFail(tls) != 0 {
 77293  		return tsErrno(tls, ts+37245 /* "fallocate" */)
 77294  	}
 77295  	return (*(*func(*libc.TLS, int32, off_t, off_t) int32)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 15*20 + 8 /* &.xOrig */))))(tls, fd, off, len)
 77296  }
 77297  
 77298  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: */
 77299  	if tsIsFailErrno(tls, ts+29235 /* "mmap" */) != 0 {
 77300  		return libc.UintptrFromInt32(-1)
 77301  	}
 77302  	return (*(*func(*libc.TLS, uintptr, size_t, int32, int32, int32, off_t) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 16*20 + 8 /* &.xOrig */))))(tls, pAddr, nByte, prot, flags, fd, iOff)
 77303  }
 77304  
 77305  func ts_mremap(tls *libc.TLS, a uintptr, b size_t, c size_t, d int32, va uintptr) uintptr { /* test_syscall.c:414:13: */
 77306  	bp := tls.Alloc(8)
 77307  	defer tls.Free(8)
 77308  
 77309  	var ap va_list
 77310  	_ = ap
 77311  	var pArg uintptr
 77312  	if tsIsFailErrno(tls, ts+37255 /* "mremap" */) != 0 {
 77313  		return libc.UintptrFromInt32(-1)
 77314  	}
 77315  	ap = va
 77316  	pArg = libc.VaUintptr(&ap)
 77317  	return (*(*func(*libc.TLS, uintptr, size_t, size_t, int32, uintptr) uintptr)(unsafe.Pointer((uintptr(unsafe.Pointer(&aSyscall)) + 17*20 + 8 /* &.xOrig */))))(tls, a, b, c, d, libc.VaList(bp, pArg))
 77318  }
 77319  
 77320  func test_syscall_install(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:425:26: */
 77321  	bp := tls.Alloc(12)
 77322  	defer tls.Free(12)
 77323  
 77324  	var pVfs uintptr
 77325  	// var nElem int32 at bp, 4
 77326  
 77327  	var i int32
 77328  	// var apElem uintptr at bp+4, 4
 77329  
 77330  	if objc != 3 {
 77331  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37262 /* "SYSCALL-LIST" */)
 77332  		return TCL_ERROR
 77333  	}
 77334  	if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &nElem */, bp+4 /* &apElem */) != 0 {
 77335  		return TCL_ERROR
 77336  	}
 77337  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77338  
 77339  	for i = 0; i < *(*int32)(unsafe.Pointer(bp /* nElem */)); i++ {
 77340  		// var iCall int32 at bp+8, 4
 77341  
 77342  		var rc int32 = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 77343  			*(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 4 /* apElem */)) + uintptr(i)*4)), uintptr(unsafe.Pointer(&aSyscall)), int32(unsafe.Sizeof(TestSyscallArray{})), ts+37275 /* "system-call" */, 0, bp+8 /* &iCall */)
 77344  		if rc != 0 {
 77345  			return rc
 77346  		}
 77347  		if aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].FxOrig == uintptr(0) {
 77348  			aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].FxOrig = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 80 /* &.xGetSystemCall */))))(tls, pVfs, aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].FzName)
 77349  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls, pVfs, aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].FzName, aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].FxTest)
 77350  		}
 77351  		aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].Fcustom_errno = aSyscall[*(*int32)(unsafe.Pointer(bp + 8 /* iCall */))].Fdefault_errno
 77352  	}
 77353  
 77354  	return TCL_OK
 77355  }
 77356  
 77357  func test_syscall_uninstall(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:461:26: */
 77358  	var pVfs uintptr
 77359  	var i int32
 77360  
 77361  	if objc != 2 {
 77362  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 77363  		return TCL_ERROR
 77364  	}
 77365  
 77366  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77367  	for i = 0; aSyscall[i].FzName != 0; i++ {
 77368  		if aSyscall[i].FxOrig != 0 {
 77369  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls, pVfs, aSyscall[i].FzName, uintptr(0))
 77370  			aSyscall[i].FxOrig = uintptr(0)
 77371  		}
 77372  	}
 77373  	return TCL_OK
 77374  }
 77375  
 77376  func test_syscall_reset(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:485:26: */
 77377  	bp := tls.Alloc(4)
 77378  	defer tls.Free(4)
 77379  
 77380  	var pVfs uintptr
 77381  	var i int32
 77382  	var rc int32
 77383  
 77384  	if (objc != 2) && (objc != 3) {
 77385  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 77386  		return TCL_ERROR
 77387  	}
 77388  
 77389  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77390  	if objc == 2 {
 77391  		rc = (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls, pVfs, uintptr(0), uintptr(0))
 77392  		for i = 0; aSyscall[i].FzName != 0; i++ {
 77393  			aSyscall[i].FxOrig = uintptr(0)
 77394  		}
 77395  	} else {
 77396  		// var nFunc int32 at bp, 4
 77397  
 77398  		var zFunc uintptr = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &nFunc */)
 77399  		rc = (*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls, pVfs, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), uintptr(0))
 77400  		for i = 0; (rc == SQLITE_OK) && (aSyscall[i].FzName != 0); i++ {
 77401  			if libc.Xstrlen(tls, aSyscall[i].FzName) != size_t(*(*int32)(unsafe.Pointer(bp /* nFunc */))) {
 77402  				continue
 77403  			}
 77404  			if libc.Xmemcmp(tls, aSyscall[i].FzName, zFunc, uint32(*(*int32)(unsafe.Pointer(bp /* nFunc */)))) != 0 {
 77405  				continue
 77406  			}
 77407  			aSyscall[i].FxOrig = uintptr(0)
 77408  		}
 77409  	}
 77410  	if rc != SQLITE_OK {
 77411  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 77412  		return TCL_ERROR
 77413  	}
 77414  
 77415  	tcl.XTcl_ResetResult(tls, interp)
 77416  	return TCL_OK
 77417  }
 77418  
 77419  func test_syscall_exists(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:523:26: */
 77420  	var pVfs uintptr
 77421  	var x sqlite3_syscall_ptr
 77422  
 77423  	if objc != 3 {
 77424  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 77425  		return TCL_ERROR
 77426  	}
 77427  
 77428  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77429  	x = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 80 /* &.xGetSystemCall */))))(tls, pVfs, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))))
 77430  
 77431  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (libc.Bool32((libc.Bool32(x != uintptr(0))) != 0))))
 77432  	return TCL_OK
 77433  }
 77434  
 77435  func test_syscall_fault(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:544:26: */
 77436  	bp := tls.Alloc(8)
 77437  	defer tls.Free(8)
 77438  
 77439  	*(*int32)(unsafe.Pointer(bp /* nCount */)) = 0
 77440  	*(*int32)(unsafe.Pointer(bp + 4 /* bPersist */)) = 0
 77441  
 77442  	if (objc != 2) && (objc != 4) {
 77443  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37287 /* "?COUNT PERSIST?" */)
 77444  		return TCL_ERROR
 77445  	}
 77446  
 77447  	if objc == 4 {
 77448  		if (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp /* &nCount */) != 0) ||
 77449  			(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &bPersist */) != 0) {
 77450  			return TCL_ERROR
 77451  		}
 77452  	}
 77453  
 77454  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, gSyscall.FnFail))
 77455  	gSyscall.FnCount = *(*int32)(unsafe.Pointer(bp /* nCount */))
 77456  	gSyscall.FbPersist = *(*int32)(unsafe.Pointer(bp + 4 /* bPersist */))
 77457  	gSyscall.FnFail = 0
 77458  	return TCL_OK
 77459  }
 77460  
 77461  func test_syscall_errno(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:573:26: */
 77462  	bp := tls.Alloc(104)
 77463  	defer tls.Free(104)
 77464  
 77465  	// var iCall int32 at bp, 4
 77466  
 77467  	// var iErrno int32 at bp+100, 4
 77468  
 77469  	var rc int32
 77470  
 77471  	*(*[12]Errno)(unsafe.Pointer(bp + 4 /* aErrno */)) = [12]Errno{
 77472  		{Fz: ts + 37303 /* "EACCES" */, Fi: EACCES},
 77473  		{Fz: ts + 37310 /* "EINTR" */, Fi: EINTR},
 77474  		{Fz: ts + 37316 /* "EIO" */, Fi: EIO},
 77475  		{Fz: ts + 37320 /* "EOVERFLOW" */, Fi: EOVERFLOW},
 77476  		{Fz: ts + 37330 /* "ENOMEM" */, Fi: ENOMEM},
 77477  		{Fz: ts + 37337 /* "EAGAIN" */, Fi: EAGAIN},
 77478  		{Fz: ts + 37344 /* "ETIMEDOUT" */, Fi: ETIMEDOUT},
 77479  		{Fz: ts + 37354 /* "EBUSY" */, Fi: EBUSY},
 77480  		{Fz: ts + 37360 /* "EPERM" */, Fi: EPERM},
 77481  		{Fz: ts + 37366 /* "EDEADLK" */, Fi: EDEADLK},
 77482  		{Fz: ts + 37374 /* "ENOLCK" */, Fi: ENOLCK},
 77483  		{},
 77484  	}
 77485  
 77486  	if objc != 4 {
 77487  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37381 /* "SYSCALL ERRNO" */)
 77488  		return TCL_ERROR
 77489  	}
 77490  
 77491  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 77492  		*(*uintptr)(unsafe.Pointer(objv + 2*4)), uintptr(unsafe.Pointer(&aSyscall)), int32(unsafe.Sizeof(TestSyscallArray{})), ts+37275 /* "system-call" */, 0, bp /* &iCall */)
 77493  	if rc != TCL_OK {
 77494  		return rc
 77495  	}
 77496  	rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 77497  		*(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &aErrno[0] */, int32(unsafe.Sizeof(Errno{})), ts+37395 /* "errno" */, 0, bp+100 /* &iErrno */)
 77498  	if rc != TCL_OK {
 77499  		return rc
 77500  	}
 77501  
 77502  	aSyscall[*(*int32)(unsafe.Pointer(bp /* iCall */))].Fcustom_errno = (*Errno)(unsafe.Pointer(bp + 4 /* &aErrno */ + uintptr(*(*int32)(unsafe.Pointer(bp + 100 /* iErrno */)))*8)).Fi
 77503  	return TCL_OK
 77504  }
 77505  
 77506  type Errno = struct {
 77507  	Fz uintptr
 77508  	Fi int32
 77509  } /* test_syscall.c:583:3 */
 77510  
 77511  func test_syscall_list(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:619:26: */
 77512  	var zSys uintptr
 77513  	var pVfs uintptr
 77514  	var pList uintptr
 77515  
 77516  	if objc != 2 {
 77517  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 77518  		return TCL_ERROR
 77519  	}
 77520  
 77521  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77522  	pList = tcl.XTcl_NewObj(tls)
 77523  	(*Tcl_Obj)(unsafe.Pointer(pList)).FrefCount++
 77524  	for zSys = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 84 /* &.xNextSystemCall */))))(tls, pVfs, uintptr(0)); zSys != uintptr(0); zSys = (*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer((pVfs + 84 /* &.xNextSystemCall */))))(tls, pVfs, zSys) {
 77525  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, zSys, -1))
 77526  	}
 77527  
 77528  	tcl.XTcl_SetObjResult(tls, interp, pList)
 77529  	for ok := true; ok; ok = 0 != 0 {
 77530  		var _objPtr uintptr = pList
 77531  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77532  			tcl.XTclFreeObj(tls, _objPtr)
 77533  		}
 77534  	}
 77535  	return TCL_OK
 77536  }
 77537  
 77538  func test_syscall_defaultvfs(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:649:26: */
 77539  	var pVfs uintptr
 77540  
 77541  	if objc != 2 {
 77542  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+489 /* "" */)
 77543  		return TCL_ERROR
 77544  	}
 77545  
 77546  	pVfs = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77547  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName, -1))
 77548  	return TCL_OK
 77549  }
 77550  
 77551  func ts_getpagesize(tls *libc.TLS) int32 { /* test_syscall.c:667:12: */
 77552  	return gSyscall.Fpgsz
 77553  }
 77554  
 77555  func test_syscall_pagesize(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:671:26: */
 77556  	bp := tls.Alloc(20)
 77557  	defer tls.Free(20)
 77558  
 77559  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77560  	// var pgsz int32 at bp+16, 4
 77561  
 77562  	if objc != 3 {
 77563  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+37401 /* "PGSZ" */)
 77564  		return TCL_ERROR
 77565  	}
 77566  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &pgsz */) != 0 {
 77567  		return TCL_ERROR
 77568  	}
 77569  
 77570  	if *(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) < 0 {
 77571  		if gSyscall.Forig_getpagesize != 0 {
 77572  			(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls, pVfs, ts+37406 /* "getpagesize" */, gSyscall.Forig_getpagesize)
 77573  		}
 77574  	} else {
 77575  		if (*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) < 512) || ((*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) & (*(*int32)(unsafe.Pointer(bp + 16 /* pgsz */)) - 1)) != 0) {
 77576  			tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+37418 /* "pgsz out of rang..." */, 0))
 77577  			return TCL_ERROR
 77578  		}
 77579  		gSyscall.Forig_getpagesize = (*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer((pVfs + 80 /* &.xGetSystemCall */))))(tls, pVfs, ts+37406 /* "getpagesize" */)
 77580  		gSyscall.Fpgsz = *(*int32)(unsafe.Pointer(bp + 16 /* pgsz */))
 77581  		(*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer((pVfs + 76 /* &.xSetSystemCall */))))(tls,
 77582  			pVfs, ts+37406 /* "getpagesize" */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS) int32 }{ts_getpagesize})))
 77583  	}
 77584  
 77585  	return TCL_OK
 77586  }
 77587  
 77588  func test_syscall(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_syscall.c:706:26: */
 77589  	bp := tls.Alloc(100)
 77590  	defer tls.Free(100)
 77591  
 77592  	*(*[10]SyscallCmd)(unsafe.Pointer(bp + 16 /* aCmd */)) = [10]SyscallCmd{
 77593  		{FzName: ts + 37436 /* "fault" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77594  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77595  		}{test_syscall_fault}))},
 77596  		{FzName: ts + 37442 /* "install" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77597  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77598  		}{test_syscall_install}))},
 77599  		{FzName: ts + 37450 /* "uninstall" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77600  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77601  		}{test_syscall_uninstall}))},
 77602  		{FzName: ts + 7379 /* "reset" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77603  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77604  		}{test_syscall_reset}))},
 77605  		{FzName: ts + 37395 /* "errno" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77606  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77607  		}{test_syscall_errno}))},
 77608  		{FzName: ts + 13977 /* "exists" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77609  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77610  		}{test_syscall_exists}))},
 77611  		{FzName: ts + 37460 /* "list" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77612  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77613  		}{test_syscall_list}))},
 77614  		{FzName: ts + 37465 /* "defaultvfs" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77615  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77616  		}{test_syscall_defaultvfs}))},
 77617  		{FzName: ts + 37476 /* "pagesize" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77618  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77619  		}{test_syscall_pagesize}))},
 77620  		{},
 77621  	}
 77622  	// var iCmd int32 at bp+96, 4
 77623  
 77624  	var rc int32
 77625  	var pVfs uintptr = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 77626  
 77627  	if objc < 2 {
 77628  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+33180 /* "SUB-COMMAND ..." */)
 77629  		return TCL_ERROR
 77630  	}
 77631  	if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion < 3) || ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FxSetSystemCall == uintptr(0)) {
 77632  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+37485 /* "VFS does not sup..." */, 0))
 77633  		rc = TCL_ERROR
 77634  	} else {
 77635  		rc = tcl.XTcl_GetIndexFromObjStruct(tls, interp,
 77636  			*(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+16 /* &aCmd[0] */, int32(unsafe.Sizeof(SyscallCmd{})), ts+1875 /* "sub-command" */, 0, bp+96 /* &iCmd */)
 77637  	}
 77638  	if rc != TCL_OK {
 77639  		return rc
 77640  	}
 77641  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((bp + 16 /* &aCmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 96 /* iCmd */)))*8 + 4 /* &.xCmd */))))(tls, clientData, interp, objc, objv)
 77642  }
 77643  
 77644  type SyscallCmd = struct {
 77645  	FzName uintptr
 77646  	FxCmd  uintptr
 77647  } /* test_syscall.c:712:3 */
 77648  
 77649  func SqlitetestSyscall_Init(tls *libc.TLS, interp uintptr) int32 { /* test_syscall.c:747:5: */
 77650  	bp := tls.Alloc(8)
 77651  	defer tls.Free(8)
 77652  
 77653  	*(*[1]SyscallCmd)(unsafe.Pointer(bp /* aCmd */)) = [1]SyscallCmd{
 77654  		{FzName: ts + 37521 /* "test_syscall" */, FxCmd: *(*uintptr)(unsafe.Pointer(&struct {
 77655  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 77656  		}{test_syscall}))},
 77657  	}
 77658  	var i int32
 77659  
 77660  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof([1]SyscallCmd{})) / uint32(unsafe.Sizeof(SyscallCmd{}))); i++ {
 77661  		tcl.XTcl_CreateObjCommand(tls, interp, (*SyscallCmd)(unsafe.Pointer(bp /* &aCmd */ +uintptr(i)*8)).FzName, (*SyscallCmd)(unsafe.Pointer(bp /* &aCmd */ +uintptr(i)*8)).FxCmd, uintptr(0), uintptr(0))
 77662  	}
 77663  	return TCL_OK
 77664  }
 77665  
 77666  // This routine is the primary export of this file.
 77667  //
 77668  // Configure the interpreter passed as the first argument to have access
 77669  // to the commands and linked variables that make up:
 77670  //
 77671  //   * the [sqlite3] extension itself,
 77672  //
 77673  //   * If SQLITE_TCLMD5 or SQLITE_TEST is defined, the Md5 commands, and
 77674  //
 77675  //   * If SQLITE_TEST is set, the various test interfaces used by the Tcl
 77676  //     test suite.
 77677  func sqlite3TestInit(tls *libc.TLS, interp uintptr) uintptr { /* test_tclsh.c:58:12: */
 77678  	bp := tls.Alloc(48)
 77679  	defer tls.Free(48)
 77680  
 77681  	// var cmdInfo Tcl_CmdInfo at bp+16, 32
 77682  
 77683  	/* Since the primary use case for this binary is testing of SQLite,
 77684  	 ** be sure to generate core files if we crash */
 77685  	{
 77686  		// var x rlimit at bp, 16
 77687  
 77688  		libc.Xgetrlimit(tls, RLIMIT_CORE, bp /* &x */)
 77689  		(*rlimit)(unsafe.Pointer(bp /* &x */)).Frlim_cur = (*rlimit)(unsafe.Pointer(bp /* &x */)).Frlim_max
 77690  		libc.Xsetrlimit(tls, RLIMIT_CORE, bp /* &x */)
 77691  
 77692  	}
 77693  
 77694  	if tcl.XTcl_GetCommandInfo(tls, interp, ts+14728 /* "sqlite3" */, bp+16 /* &cmdInfo */) == 0 {
 77695  		Sqlite3_Init(tls, interp)
 77696  	}
 77697  	Md5_Init(tls, interp)
 77698  	Sqliteconfig_Init(tls, interp)
 77699  	Sqlitetest1_Init(tls, interp)
 77700  	Sqlitetest2_Init(tls, interp)
 77701  	Sqlitetest3_Init(tls, interp)
 77702  	Sqlitetest4_Init(tls, interp)
 77703  	Sqlitetest5_Init(tls, interp)
 77704  	Sqlitetest6_Init(tls, interp)
 77705  	Sqlitetest7_Init(tls, interp)
 77706  	Sqlitetest8_Init(tls, interp)
 77707  	Sqlitetest9_Init(tls, interp)
 77708  	Sqlitetestasync_Init(tls, interp)
 77709  	Sqlitetest_autoext_Init(tls, interp)
 77710  	Sqlitetest_blob_Init(tls, interp)
 77711  	Sqlitetest_demovfs_Init(tls, interp)
 77712  	Sqlitetest_func_Init(tls, interp)
 77713  	Sqlitetest_hexio_Init(tls, interp)
 77714  	Sqlitetest_init_Init(tls, interp)
 77715  	Sqlitetest_malloc_Init(tls, interp)
 77716  	Sqlitetest_mutex_Init(tls, interp)
 77717  	Sqlitetestschema_Init(tls, interp)
 77718  	Sqlitetesttclvar_Init(tls, interp)
 77719  	Sqlitetestfs_Init(tls, interp)
 77720  	SqlitetestThread_Init(tls, interp)
 77721  	SqlitetestOnefile_Init(tls)
 77722  	SqlitetestOsinst_Init(tls, interp)
 77723  	Sqlitetestbackup_Init(tls, interp)
 77724  	Sqlitetestintarray_Init(tls, interp)
 77725  	Sqlitetestvfs_Init(tls, interp)
 77726  	Sqlitetestrtree_Init(tls, interp)
 77727  	Sqlitequota_Init(tls, interp)
 77728  	Sqlitemultiplex_Init(tls, interp)
 77729  	SqliteSuperlock_Init(tls, interp)
 77730  	SqlitetestSyscall_Init(tls, interp)
 77731  	TestSession_Init(tls, interp)
 77732  	Fts5tcl_Init(tls, interp)
 77733  	SqliteRbu_Init(tls, interp)
 77734  	Sqlitetesttcl_Init(tls, interp)
 77735  
 77736  	TestExpert_Init(tls, interp)
 77737  	Sqlitetest_window_Init(tls, interp)
 77738  	Sqlitetestvdbecov_Init(tls, interp)
 77739  
 77740  	tcl.XTcl_CreateObjCommand(tls,
 77741  		interp, ts+37534 /* "load_testfixture..." */, *(*uintptr)(unsafe.Pointer(&struct {
 77742  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 77743  		}{load_testfixture_extensions})), uintptr(0), uintptr(0))
 77744  	return uintptr(0)
 77745  }
 77746  
 77747  // tclcmd:   load_testfixture_extensions
 77748  func load_testfixture_extensions(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_tclsh.c:185:26: */
 77749  	var slave uintptr
 77750  	if objc != 2 {
 77751  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+37562 /* "SLAVE" */)
 77752  		return TCL_ERROR
 77753  	}
 77754  
 77755  	slave = tcl.XTcl_GetSlave(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 77756  	if !(slave != 0) {
 77757  		return TCL_ERROR
 77758  	}
 77759  
 77760  	sqlite3TestInit(tls, slave)
 77761  	return TCL_OK
 77762  }
 77763  
 77764  // end block for C++
 77765  
 77766  // Local Variables:
 77767  // mode: c
 77768  // c-basic-offset: 4
 77769  // fill-column: 78
 77770  // End:
 77771  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 77772  //    This file is part of the GNU C Library.
 77773  //
 77774  //    The GNU C Library is free software; you can redistribute it and/or
 77775  //    modify it under the terms of the GNU Lesser General Public
 77776  //    License as published by the Free Software Foundation; either
 77777  //    version 2.1 of the License, or (at your option) any later version.
 77778  //
 77779  //    The GNU C Library is distributed in the hope that it will be useful,
 77780  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 77781  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 77782  //    Lesser General Public License for more details.
 77783  //
 77784  //    You should have received a copy of the GNU Lesser General Public
 77785  //    License along with the GNU C Library; if not, see
 77786  //    <http://www.gnu.org/licenses/>.
 77787  
 77788  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 77789  
 77790  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 77791  //    This file is part of the GNU C Library.
 77792  //
 77793  //    The GNU C Library is free software; you can redistribute it and/or
 77794  //    modify it under the terms of the GNU Lesser General Public
 77795  //    License as published by the Free Software Foundation; either
 77796  //    version 2.1 of the License, or (at your option) any later version.
 77797  //
 77798  //    The GNU C Library is distributed in the hope that it will be useful,
 77799  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 77800  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 77801  //    Lesser General Public License for more details.
 77802  //
 77803  //    You should have received a copy of the GNU Lesser General Public
 77804  //    License along with the GNU C Library; if not, see
 77805  //    <http://www.gnu.org/licenses/>.
 77806  
 77807  //	ISO C99 Standard: 7.21 String handling	<string.h>
 77808  
 77809  // Characters that make up the idxStr created by xBestIndex for xFilter.
 77810  
 77811  type tclvar_vtab1 = struct {
 77812  	Fbase   sqlite3_vtab
 77813  	Finterp uintptr
 77814  } /* test_tclvar.c:58:9 */
 77815  
 77816  // end block for C++
 77817  
 77818  // Local Variables:
 77819  // mode: c
 77820  // c-basic-offset: 4
 77821  // fill-column: 78
 77822  // End:
 77823  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 77824  //    This file is part of the GNU C Library.
 77825  //
 77826  //    The GNU C Library is free software; you can redistribute it and/or
 77827  //    modify it under the terms of the GNU Lesser General Public
 77828  //    License as published by the Free Software Foundation; either
 77829  //    version 2.1 of the License, or (at your option) any later version.
 77830  //
 77831  //    The GNU C Library is distributed in the hope that it will be useful,
 77832  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 77833  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 77834  //    Lesser General Public License for more details.
 77835  //
 77836  //    You should have received a copy of the GNU Lesser General Public
 77837  //    License along with the GNU C Library; if not, see
 77838  //    <http://www.gnu.org/licenses/>.
 77839  
 77840  //	ISO C99 Standard: 7.20 General utilities	<stdlib.h>
 77841  
 77842  // Copyright (C) 1991-2018 Free Software Foundation, Inc.
 77843  //    This file is part of the GNU C Library.
 77844  //
 77845  //    The GNU C Library is free software; you can redistribute it and/or
 77846  //    modify it under the terms of the GNU Lesser General Public
 77847  //    License as published by the Free Software Foundation; either
 77848  //    version 2.1 of the License, or (at your option) any later version.
 77849  //
 77850  //    The GNU C Library is distributed in the hope that it will be useful,
 77851  //    but WITHOUT ANY WARRANTY; without even the implied warranty of
 77852  //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 77853  //    Lesser General Public License for more details.
 77854  //
 77855  //    You should have received a copy of the GNU Lesser General Public
 77856  //    License along with the GNU C Library; if not, see
 77857  //    <http://www.gnu.org/licenses/>.
 77858  
 77859  //	ISO C99 Standard: 7.21 String handling	<string.h>
 77860  
 77861  // Characters that make up the idxStr created by xBestIndex for xFilter.
 77862  
 77863  type tclvar_vtab = tclvar_vtab1 /* test_tclvar.c:58:28 */
 77864  type tclvar_cursor1 = struct {
 77865  	Fbase   sqlite3_vtab_cursor
 77866  	FpList1 uintptr
 77867  	FpList2 uintptr
 77868  	Fi1     int32
 77869  	Fi2     int32
 77870  } /* test_tclvar.c:59:9 */
 77871  
 77872  type tclvar_cursor = tclvar_cursor1 /* test_tclvar.c:59:30 */
 77873  
 77874  // Methods for the tclvar module
 77875  func tclvarConnect(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintptr, ppVtab uintptr, pzErr uintptr) int32 { /* test_tclvar.c:80:12: */
 77876  	var pVtab uintptr
 77877  	pVtab = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(tclvar_vtab{})))
 77878  	if pVtab == uintptr(0) {
 77879  		return SQLITE_NOMEM
 77880  	}
 77881  	*(*uintptr)(unsafe.Pointer(ppVtab)) = (pVtab /* &.base */)
 77882  	(*tclvar_vtab)(unsafe.Pointer(pVtab)).Finterp = pAux
 77883  	sqlite3.Xsqlite3_declare_vtab(tls, db, uintptr(unsafe.Pointer(&zSchema)))
 77884  	return SQLITE_OK
 77885  }
 77886  
 77887  var zSchema =
 77888  
 77889  // Base name
 77890  // Array index
 77891  // Value
 77892  // base(index) name
 77893  *(*[100]int8)(unsafe.Pointer(ts + 37568 /* "CREATE TABLE x( ..." */)) /* test_tclvar.c:88:21 */
 77894  
 77895  // Note that for this virtual table, the xCreate and xConnect
 77896  // methods are identical.
 77897  
 77898  func tclvarDisconnect(tls *libc.TLS, pVtab uintptr) int32 { /* test_tclvar.c:105:12: */
 77899  	sqlite3.Xsqlite3_free(tls, pVtab)
 77900  	return SQLITE_OK
 77901  }
 77902  
 77903  // The xDisconnect and xDestroy methods are also the same
 77904  
 77905  // Open a new tclvar cursor.
 77906  func tclvarOpen(tls *libc.TLS, pVTab uintptr, ppCursor uintptr) int32 { /* test_tclvar.c:114:12: */
 77907  	var pCur uintptr
 77908  	pCur = sqlite3.Xsqlite3MallocZero(tls, uint64(unsafe.Sizeof(tclvar_cursor{})))
 77909  	*(*uintptr)(unsafe.Pointer(ppCursor)) = (pCur /* &.base */)
 77910  	return SQLITE_OK
 77911  }
 77912  
 77913  // Close a tclvar cursor.
 77914  func tclvarClose(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:124:12: */
 77915  	var pCur uintptr = cur
 77916  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 != 0 {
 77917  		for ok := true; ok; ok = 0 != 0 {
 77918  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1
 77919  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77920  				tcl.XTclFreeObj(tls, _objPtr)
 77921  			}
 77922  		}
 77923  	}
 77924  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 77925  		for ok1 := true; ok1; ok1 = 0 != 0 {
 77926  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 77927  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77928  				tcl.XTclFreeObj(tls, _objPtr)
 77929  			}
 77930  		}
 77931  	}
 77932  	sqlite3.Xsqlite3_free(tls, pCur)
 77933  	return SQLITE_OK
 77934  }
 77935  
 77936  // Returns 1 if data is ready, or 0 if not.
 77937  func next2(tls *libc.TLS, interp uintptr, pCur uintptr, pObj uintptr) int32 { /* test_tclvar.c:139:12: */
 77938  	bp := tls.Alloc(4)
 77939  	defer tls.Free(4)
 77940  
 77941  	var p uintptr
 77942  
 77943  	if pObj != 0 {
 77944  		if !(int32((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2) != 0) {
 77945  			p = tcl.XTcl_NewStringObj(tls, ts+37668 /* "array names" */, -1)
 77946  			(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 77947  			tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, pObj)
 77948  			tcl.XTcl_EvalObjEx(tls, interp, p, TCL_EVAL_GLOBAL)
 77949  			for ok := true; ok; ok = 0 != 0 {
 77950  				var _objPtr uintptr = p
 77951  				if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77952  					tcl.XTclFreeObj(tls, _objPtr)
 77953  				}
 77954  			}
 77955  			(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = tcl.XTcl_GetObjResult(tls, interp)
 77956  			(*Tcl_Obj)(unsafe.Pointer((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2)).FrefCount++
 77957  
 77958  		} else {
 77959  			*(*int32)(unsafe.Pointer(bp /* n */)) = 0
 77960  			(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2++
 77961  			tcl.XTcl_ListObjLength(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2, bp /* &n */)
 77962  			if (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 >= *(*int32)(unsafe.Pointer(bp /* n */)) {
 77963  				for ok1 := true; ok1; ok1 = 0 != 0 {
 77964  					var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 77965  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 77966  						tcl.XTclFreeObj(tls, _objPtr)
 77967  					}
 77968  				}
 77969  				(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = uintptr(0)
 77970  				(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 = 0
 77971  				return 0
 77972  			}
 77973  		}
 77974  	}
 77975  
 77976  	return 1
 77977  }
 77978  
 77979  func tclvarNext(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:168:12: */
 77980  	bp := tls.Alloc(8)
 77981  	defer tls.Free(8)
 77982  
 77983  	// var pObj uintptr at bp+4, 4
 77984  
 77985  	*(*int32)(unsafe.Pointer(bp /* n */)) = 0
 77986  	var ok int32 = 0
 77987  
 77988  	var pCur uintptr = cur
 77989  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).Finterp
 77990  
 77991  	tcl.XTcl_ListObjLength(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, bp /* &n */)
 77992  	for !(ok != 0) && ((*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1 < *(*int32)(unsafe.Pointer(bp /* n */))) {
 77993  		tcl.XTcl_ListObjIndex(tls, uintptr(0), (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1, bp+4 /* &pObj */)
 77994  		ok = next2(tls, interp, pCur, *(*uintptr)(unsafe.Pointer(bp + 4 /* pObj */)))
 77995  		if !(ok != 0) {
 77996  			(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1++
 77997  		}
 77998  	}
 77999  
 78000  	return 0
 78001  }
 78002  
 78003  func tclvarFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintptr, argc int32, argv uintptr) int32 { /* test_tclvar.c:188:12: */
 78004  	var pCur uintptr = pVtabCursor
 78005  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(pVtabCursor)).FpVtab)).Finterp
 78006  	var p uintptr = tcl.XTcl_NewStringObj(tls, ts+37680 /* "tclvar_filter_cm..." */, -1)
 78007  
 78008  	var zEq uintptr = ts + 489     /* "" */
 78009  	var zMatch uintptr = ts + 489  /* "" */
 78010  	var zGlob uintptr = ts + 489   /* "" */
 78011  	var zRegexp uintptr = ts + 489 /* "" */
 78012  	var zLike uintptr = ts + 489   /* "" */
 78013  	var i int32
 78014  
 78015  	for i = 0; *(*int8)(unsafe.Pointer(idxStr + uintptr(i))) != 0; i++ {
 78016  		switch int32(*(*int8)(unsafe.Pointer(idxStr + uintptr(i)))) {
 78017  		case 'e':
 78018  			zEq = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 78019  			break
 78020  		case 'm':
 78021  			zMatch = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 78022  			break
 78023  		case 'g':
 78024  			zGlob = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 78025  			break
 78026  		case 'r':
 78027  			zRegexp = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 78028  			break
 78029  		case 'l':
 78030  			zLike = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + uintptr(i)*4)))
 78031  			break
 78032  		default:
 78033  
 78034  		}
 78035  	}
 78036  
 78037  	(*Tcl_Obj)(unsafe.Pointer(p)).FrefCount++
 78038  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zEq, -1))
 78039  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zMatch, -1))
 78040  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zGlob, -1))
 78041  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zRegexp, -1))
 78042  	tcl.XTcl_ListObjAppendElement(tls, uintptr(0), p, tcl.XTcl_NewStringObj(tls, zLike, -1))
 78043  
 78044  	tcl.XTcl_EvalObjEx(tls, interp, p, TCL_EVAL_GLOBAL)
 78045  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 != 0 {
 78046  		for ok := true; ok; ok = 0 != 0 {
 78047  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1
 78048  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78049  				tcl.XTclFreeObj(tls, _objPtr)
 78050  			}
 78051  		}
 78052  	}
 78053  	if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 78054  		for ok1 := true; ok1; ok1 = 0 != 0 {
 78055  			var _objPtr uintptr = (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2
 78056  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78057  				tcl.XTclFreeObj(tls, _objPtr)
 78058  			}
 78059  		}
 78060  		(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 = uintptr(0)
 78061  	}
 78062  	(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1 = 0
 78063  	(*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2 = 0
 78064  	(*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1 = tcl.XTcl_GetObjResult(tls, interp)
 78065  	(*Tcl_Obj)(unsafe.Pointer((*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1)).FrefCount++
 78066  
 78067  	for ok2 := true; ok2; ok2 = 0 != 0 {
 78068  		var _objPtr uintptr = p
 78069  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78070  			tcl.XTclFreeObj(tls, _objPtr)
 78071  		}
 78072  	}
 78073  	return tclvarNext(tls, pVtabCursor)
 78074  }
 78075  
 78076  func tclvarColumn(tls *libc.TLS, cur uintptr, ctx uintptr, i int32) int32 { /* test_tclvar.c:250:12: */
 78077  	bp := tls.Alloc(24)
 78078  	defer tls.Free(24)
 78079  
 78080  	// var p1 uintptr at bp+16, 4
 78081  
 78082  	// var p2 uintptr at bp+20, 4
 78083  
 78084  	var z1 uintptr
 78085  	var z2 uintptr = ts + 489 /* "" */
 78086  	var pCur uintptr = cur
 78087  	var interp uintptr = (*tclvar_vtab)(unsafe.Pointer((*sqlite3_vtab_cursor)(unsafe.Pointer(cur)).FpVtab)).Finterp
 78088  
 78089  	tcl.XTcl_ListObjIndex(tls, interp, (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList1, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi1, bp+16 /* &p1 */)
 78090  	tcl.XTcl_ListObjIndex(tls, interp, (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2, (*tclvar_cursor)(unsafe.Pointer(pCur)).Fi2, bp+20 /* &p2 */)
 78091  	z1 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* p1 */)))
 78092  	if *(*uintptr)(unsafe.Pointer(bp + 20 /* p2 */)) != 0 {
 78093  		z2 = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(bp + 20 /* p2 */)))
 78094  	}
 78095  	switch i {
 78096  	case 0:
 78097  		{
 78098  			sqlite3.Xsqlite3_result_text(tls, ctx, z1, -1, libc.UintptrFromInt32(-1))
 78099  			break
 78100  
 78101  		}
 78102  	case 1:
 78103  		{
 78104  			sqlite3.Xsqlite3_result_text(tls, ctx, z2, -1, libc.UintptrFromInt32(-1))
 78105  			break
 78106  
 78107  		}
 78108  	case 2:
 78109  		{
 78110  			var pVal uintptr = tcl.XTcl_GetVar2Ex(tls, interp, z1, func() uintptr {
 78111  				if *(*int8)(unsafe.Pointer(z2)) != 0 {
 78112  					return z2
 78113  				}
 78114  				return uintptr(0)
 78115  			}(), TCL_GLOBAL_ONLY)
 78116  			sqlite3.Xsqlite3_result_text(tls, ctx, tcl.XTcl_GetString(tls, pVal), -1, libc.UintptrFromInt32(-1))
 78117  			break
 78118  
 78119  		}
 78120  	case 3:
 78121  		{
 78122  			var z3 uintptr
 78123  			if *(*uintptr)(unsafe.Pointer(bp + 20 /* p2 */)) != 0 {
 78124  				z3 = sqlite3.Xsqlite3_mprintf(tls, ts+37698 /* "%s(%s)" */, libc.VaList(bp, z1, z2))
 78125  				sqlite3.Xsqlite3_result_text(tls, ctx, z3, -1, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sqlite3.Xsqlite3_free})))
 78126  			} else {
 78127  				sqlite3.Xsqlite3_result_text(tls, ctx, z1, -1, libc.UintptrFromInt32(-1))
 78128  			}
 78129  			break
 78130  
 78131  		}
 78132  	}
 78133  	return SQLITE_OK
 78134  }
 78135  
 78136  func tclvarRowid(tls *libc.TLS, cur uintptr, pRowid uintptr) int32 { /* test_tclvar.c:292:12: */
 78137  	*(*sqlite_int64)(unsafe.Pointer(pRowid)) = int64(0)
 78138  	return SQLITE_OK
 78139  }
 78140  
 78141  func tclvarEof(tls *libc.TLS, cur uintptr) int32 { /* test_tclvar.c:297:12: */
 78142  	var pCur uintptr = cur
 78143  	return func() int32 {
 78144  		if (*tclvar_cursor)(unsafe.Pointer(pCur)).FpList2 != 0 {
 78145  			return 0
 78146  		}
 78147  		return 1
 78148  	}()
 78149  }
 78150  
 78151  // If nul-terminated string zStr does not already contain the character
 78152  // passed as the second argument, append it and return 0. Or, if there is
 78153  // already an instance of x in zStr, do nothing return 1;
 78154  //
 78155  // There is guaranteed to be enough room in the buffer pointed to by zStr
 78156  // for the new character and nul-terminator.
 78157  func tclvarAddToIdxstr(tls *libc.TLS, zStr uintptr, x int8) int32 { /* test_tclvar.c:310:12: */
 78158  	var i int32
 78159  	for i = 0; *(*int8)(unsafe.Pointer(zStr + uintptr(i))) != 0; i++ {
 78160  		if int32(*(*int8)(unsafe.Pointer(zStr + uintptr(i)))) == int32(x) {
 78161  			return 1
 78162  		}
 78163  	}
 78164  	*(*int8)(unsafe.Pointer(zStr + uintptr(i))) = x
 78165  	*(*int8)(unsafe.Pointer(zStr + uintptr((i + 1)))) = int8(0)
 78166  	return 0
 78167  }
 78168  
 78169  // Return true if variable $::tclvar_set_omit exists and is set to true.
 78170  // False otherwise.
 78171  func tclvarSetOmit(tls *libc.TLS, interp uintptr) int32 { /* test_tclvar.c:324:12: */
 78172  	bp := tls.Alloc(4)
 78173  	defer tls.Free(4)
 78174  
 78175  	var rc int32
 78176  	*(*int32)(unsafe.Pointer(bp /* res */)) = 0
 78177  	var pRes uintptr
 78178  	rc = tcl.XTcl_Eval(tls, interp,
 78179  		ts+37705 /* "expr {[info exis..." */)
 78180  	if rc == TCL_OK {
 78181  		pRes = tcl.XTcl_GetObjResult(tls, interp)
 78182  		rc = tcl.XTcl_GetBooleanFromObj(tls, uintptr(0), pRes, bp /* &res */)
 78183  	}
 78184  	return (libc.Bool32((rc == TCL_OK) && (*(*int32)(unsafe.Pointer(bp /* res */)) != 0)))
 78185  }
 78186  
 78187  // The xBestIndex() method. This virtual table supports the following
 78188  // operators:
 78189  //
 78190  //     name = ?                    (omit flag clear)
 78191  //     name MATCH ?                (omit flag set)
 78192  //     value GLOB ?                (omit flag set iff $::tclvar_set_omit)
 78193  //     value REGEXP ?              (omit flag set iff $::tclvar_set_omit)
 78194  //     value LIKE ?                (omit flag set iff $::tclvar_set_omit)
 78195  //
 78196  // For each constraint present, the corresponding TCLVAR_XXX character is
 78197  // appended to the idxStr value.
 78198  func tclvarBestIndex(tls *libc.TLS, tab uintptr, pIdxInfo uintptr) int32 { /* test_tclvar.c:351:12: */
 78199  	var pTab uintptr = tab
 78200  	var ii int32
 78201  	var zStr uintptr = sqlite3.Xsqlite3_malloc(tls, 32)
 78202  	var iStr int32 = 0
 78203  
 78204  	if zStr == uintptr(0) {
 78205  		return SQLITE_NOMEM
 78206  	}
 78207  	*(*int8)(unsafe.Pointer(zStr)) = int8(0)
 78208  
 78209  	for ii = 0; ii < (*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FnConstraint; ii++ {
 78210  		var pCons uintptr = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraint + uintptr(ii)*12)
 78211  		var pUsage uintptr
 78212  
 78213  		pUsage = ((*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FaConstraintUsage + uintptr(ii)*8)
 78214  		if (*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fusable != 0 {
 78215  			// name = ?
 78216  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_EQ) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 0) {
 78217  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('e')) {
 78218  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 78219  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(0)
 78220  				}
 78221  			}
 78222  
 78223  			// name MATCH ?
 78224  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_MATCH) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 0) {
 78225  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('m')) {
 78226  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 78227  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(1)
 78228  				}
 78229  			}
 78230  
 78231  			// value GLOB ?
 78232  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_GLOB) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 78233  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('g')) {
 78234  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 78235  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 78236  				}
 78237  			}
 78238  
 78239  			// value REGEXP ?
 78240  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_REGEXP) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 78241  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('r')) {
 78242  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 78243  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 78244  				}
 78245  			}
 78246  
 78247  			// value LIKE ?
 78248  			if (int32((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).Fop) == SQLITE_INDEX_CONSTRAINT_LIKE) && ((*sqlite3_index_constraint)(unsafe.Pointer(pCons)).FiColumn == 2) {
 78249  				if 0 == tclvarAddToIdxstr(tls, zStr, int8('l')) {
 78250  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).FargvIndex = libc.PreIncInt32(&iStr, 1)
 78251  					(*sqlite3_index_constraint_usage)(unsafe.Pointer(pUsage)).Fomit = uint8(tclvarSetOmit(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp))
 78252  				}
 78253  			}
 78254  		}
 78255  	}
 78256  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FidxStr = zStr
 78257  	(*sqlite3_index_info)(unsafe.Pointer(pIdxInfo)).FneedToFreeIdxStr = 1
 78258  
 78259  	return SQLITE_OK
 78260  }
 78261  
 78262  // Invoked for any UPDATE, INSERT, or DELETE against a tclvar table
 78263  func tclvarUpdate(tls *libc.TLS, tab uintptr, argc int32, argv uintptr, pRowid uintptr) int32 { /* test_tclvar.c:416:12: */
 78264  	var pTab uintptr = tab
 78265  	if argc == 1 {
 78266  		// A DELETE operation.  The variable to be deleted is stored in argv[0]
 78267  		var zVar uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 78268  		tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zVar, uintptr(0), TCL_GLOBAL_ONLY)
 78269  		return SQLITE_OK
 78270  	}
 78271  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_NULL {
 78272  		// An INSERT operation
 78273  		var zValue uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)))
 78274  		var zName uintptr
 78275  		if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 5*4))) != SQLITE_TEXT {
 78276  			(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+37766 /* "the 'fullname' c..." */, 0)
 78277  			return SQLITE_ERROR
 78278  		}
 78279  		zName = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 5*4)))
 78280  		if zValue != 0 {
 78281  			tcl.XTcl_SetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zName, uintptr(0), zValue, TCL_GLOBAL_ONLY)
 78282  		} else {
 78283  			tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zName, uintptr(0), TCL_GLOBAL_ONLY)
 78284  		}
 78285  		return SQLITE_OK
 78286  	}
 78287  	if (sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv))) == SQLITE_TEXT) &&
 78288  		(sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4))) == SQLITE_TEXT) {
 78289  		// An UPDATE operation
 78290  		var zOldName uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv)))
 78291  		var zNewName uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)))
 78292  		var zValue uintptr = sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(argv + 4*4)))
 78293  
 78294  		if (libc.Xstrcmp(tls, zOldName, zNewName) != 0) || (zValue == uintptr(0)) {
 78295  			tcl.XTcl_UnsetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zOldName, uintptr(0), TCL_GLOBAL_ONLY)
 78296  		}
 78297  		if zValue != uintptr(0) {
 78298  			tcl.XTcl_SetVar2(tls, (*tclvar_vtab)(unsafe.Pointer(pTab)).Finterp, zNewName, uintptr(0), zValue, TCL_GLOBAL_ONLY)
 78299  		}
 78300  		return SQLITE_OK
 78301  	}
 78302  	(*sqlite3_vtab)(unsafe.Pointer(tab)).FzErrMsg = sqlite3.Xsqlite3_mprintf(tls, ts+37801 /* "prohibited TCL v..." */, 0)
 78303  	return SQLITE_ERROR
 78304  }
 78305  
 78306  // A virtual table module that provides read-only access to a
 78307  // Tcl global variable namespace.
 78308  var tclvarModule = sqlite3_module{ // iVersion
 78309  	FxCreate:     0,
 78310  	FxConnect:    0,
 78311  	FxBestIndex:  0,
 78312  	FxDisconnect: 0,
 78313  	FxDestroy:    0,
 78314  	FxOpen:       0, // xOpen - open a cursor
 78315  	FxClose:      0, // xClose - close a cursor
 78316  	FxFilter:     0, // xFilter - configure scan constraints
 78317  	FxNext:       0, // xNext - advance a cursor
 78318  	FxEof:        0, // xEof - check for end of scan
 78319  	FxColumn:     0, // xColumn - read data
 78320  	FxRowid:      0, // xRowid - read data
 78321  	FxUpdate:     0, // xRename
 78322  } /* test_tclvar.c:469:23 */
 78323  
 78324  // Register the echo virtual table module.
 78325  func register_tclvar_module(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_tclvar.c:500:26: */
 78326  	bp := tls.Alloc(4)
 78327  	defer tls.Free(4)
 78328  
 78329  	var rc int32 = TCL_OK
 78330  	// var db uintptr at bp, 4
 78331  
 78332  	if objc != 2 {
 78333  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 78334  		return TCL_ERROR
 78335  	}
 78336  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 78337  		return TCL_ERROR
 78338  	}
 78339  	sqlite3.Xsqlite3_create_module(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+30054 /* "tclvar" */, uintptr(unsafe.Pointer(&tclvarModule)), interp)
 78340  	rc = tcl.XTcl_Eval(tls, interp,
 78341  
 78342  		ts+37832 /* "proc like {patte..." */)
 78343  	return rc
 78344  }
 78345  
 78346  // Register commands with the TCL interpreter.
 78347  func Sqlitetesttclvar_Init(tls *libc.TLS, interp uintptr) int32 { /* test_tclvar.c:546:5: */
 78348  	var i int32
 78349  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd13)) / uint32(unsafe.Sizeof(struct {
 78350  		FzName      uintptr
 78351  		FxProc      uintptr
 78352  		FclientData uintptr
 78353  	}{}))); i++ {
 78354  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd13[i].FzName,
 78355  			aObjCmd13[i].FxProc, aObjCmd13[i].FclientData, uintptr(0))
 78356  	}
 78357  	return TCL_OK
 78358  }
 78359  
 78360  var aObjCmd13 = [1]struct {
 78361  	FzName      uintptr
 78362  	FxProc      uintptr
 78363  	FclientData uintptr
 78364  }{
 78365  	{FzName: ts + 38368 /* "register_tclvar_..." */, FxProc: 0},
 78366  } /* test_tclvar.c:552:5 */
 78367  
 78368  // Define some macros helping to catch buffer overflows.
 78369  
 78370  // One of these is allocated for each thread created by [sqlthread spawn].
 78371  type SqlThread1 = struct {
 78372  	Fparent   Tcl_ThreadId
 78373  	Finterp   uintptr
 78374  	FzScript  uintptr
 78375  	FzVarname uintptr
 78376  } /* test_thread.c:36:9 */
 78377  
 78378  // Define some macros helping to catch buffer overflows.
 78379  
 78380  // One of these is allocated for each thread created by [sqlthread spawn].
 78381  type SqlThread = SqlThread1 /* test_thread.c:36:26 */
 78382  
 78383  // A custom Tcl_Event type used by this module. When the event is
 78384  // handled, script zScript is evaluated in interpreter interp. If
 78385  // the evaluation throws an exception (returns TCL_ERROR), then the
 78386  // error is handled by Tcl_BackgroundError(). If no error occurs,
 78387  // the result is simply discarded.
 78388  type EvalEvent1 = struct {
 78389  	Fbase    Tcl_Event
 78390  	FzScript uintptr
 78391  	Finterp  uintptr
 78392  } /* test_thread.c:51:9 */
 78393  
 78394  // A custom Tcl_Event type used by this module. When the event is
 78395  // handled, script zScript is evaluated in interpreter interp. If
 78396  // the evaluation throws an exception (returns TCL_ERROR), then the
 78397  // error is handled by Tcl_BackgroundError(). If no error occurs,
 78398  // the result is simply discarded.
 78399  type EvalEvent = EvalEvent1 /* test_thread.c:51:26 */
 78400  
 78401  // Handler for events of type EvalEvent.
 78402  func tclScriptEvent(tls *libc.TLS, evPtr uintptr, flags int32) int32 { /* test_thread.c:79:26: */
 78403  	var rc int32
 78404  	var p uintptr = evPtr
 78405  	rc = tcl.XTcl_Eval(tls, (*EvalEvent)(unsafe.Pointer(p)).Finterp, (*EvalEvent)(unsafe.Pointer(p)).FzScript)
 78406  	if rc != TCL_OK {
 78407  		tcl.XTcl_BackgroundError(tls, (*EvalEvent)(unsafe.Pointer(p)).Finterp)
 78408  	}
 78409  	_ = flags
 78410  	return 1
 78411  }
 78412  
 78413  // Register an EvalEvent to evaluate the script pScript in the
 78414  // parent interpreter/thread of SqlThread p.
 78415  func postToParent(tls *libc.TLS, p uintptr, pScript uintptr) { /* test_thread.c:94:13: */
 78416  	bp := tls.Alloc(4)
 78417  	defer tls.Free(4)
 78418  
 78419  	var pEvent uintptr
 78420  	var zMsg uintptr
 78421  	// var nMsg int32 at bp, 4
 78422  
 78423  	zMsg = tcl.XTcl_GetStringFromObj(tls, pScript, bp /* &nMsg */)
 78424  	pEvent = tcl.XTcl_Alloc(tls, ((uint32(unsafe.Sizeof(EvalEvent{})) + uint32(*(*int32)(unsafe.Pointer(bp /* nMsg */)))) + uint32(1)))
 78425  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.FnextPtr = uintptr(0)
 78426  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.Fproc = *(*uintptr)(unsafe.Pointer(&struct {
 78427  		f func(*libc.TLS, uintptr, int32) int32
 78428  	}{tclScriptEvent}))
 78429  	(*EvalEvent)(unsafe.Pointer(pEvent)).FzScript = (pEvent + 1*16)
 78430  	libc.Xmemcpy(tls, (*EvalEvent)(unsafe.Pointer(pEvent)).FzScript, zMsg, (uint32(*(*int32)(unsafe.Pointer(bp /* nMsg */)) + 1)))
 78431  	(*EvalEvent)(unsafe.Pointer(pEvent)).Finterp = (*SqlThread)(unsafe.Pointer(p)).Finterp
 78432  
 78433  	tcl.XTcl_ThreadQueueEvent(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent, pEvent, TCL_QUEUE_TAIL)
 78434  	tcl.XTcl_ThreadAlert(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent)
 78435  }
 78436  
 78437  // The main function for threads created with [sqlthread spawn].
 78438  func tclScriptThread(tls *libc.TLS, pSqlThread ClientData) { /* test_thread.c:114:29: */
 78439  	var interp uintptr
 78440  	var pRes uintptr
 78441  	var pList uintptr
 78442  	var rc int32
 78443  	var p uintptr = pSqlThread
 78444  
 78445  	interp = tcl.XTcl_CreateInterp(tls)
 78446  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38391 /* "clock_seconds" */, *(*uintptr)(unsafe.Pointer(&struct {
 78447  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78448  	}{clock_seconds_proc})), uintptr(0), uintptr(0))
 78449  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38405 /* "sqlthread" */, *(*uintptr)(unsafe.Pointer(&struct {
 78450  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78451  	}{sqlthread_proc})), pSqlThread, uintptr(0))
 78452  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38415 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78453  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78454  	}{blocking_step_proc})), uintptr(0), uintptr(0))
 78455  	tcl.XTcl_CreateObjCommand(tls, interp,
 78456  		ts+38437 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78457  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78458  		}{blocking_prepare_v2_proc})), uintptr(1), uintptr(0))
 78459  	tcl.XTcl_CreateObjCommand(tls, interp,
 78460  		ts+38465 /* "sqlite3_nonblock..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78461  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78462  		}{blocking_prepare_v2_proc})), uintptr(0), uintptr(0))
 78463  	Sqlitetest1_Init(tls, interp)
 78464  	Sqlitetest_mutex_Init(tls, interp)
 78465  	Sqlite3_Init(tls, interp)
 78466  
 78467  	rc = tcl.XTcl_Eval(tls, interp, (*SqlThread)(unsafe.Pointer(p)).FzScript)
 78468  	pRes = tcl.XTcl_GetObjResult(tls, interp)
 78469  	pList = tcl.XTcl_NewObj(tls)
 78470  	(*Tcl_Obj)(unsafe.Pointer(pList)).FrefCount++
 78471  	(*Tcl_Obj)(unsafe.Pointer(pRes)).FrefCount++
 78472  
 78473  	if rc != TCL_OK {
 78474  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, ts+10309 /* "error" */, -1))
 78475  		tcl.XTcl_ListObjAppendElement(tls, interp, pList, pRes)
 78476  		postToParent(tls, p, pList)
 78477  		for ok := true; ok; ok = 0 != 0 {
 78478  			var _objPtr uintptr = pList
 78479  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78480  				tcl.XTclFreeObj(tls, _objPtr)
 78481  			}
 78482  		}
 78483  		pList = tcl.XTcl_NewObj(tls)
 78484  	}
 78485  
 78486  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, ts+38496 /* "set" */, -1))
 78487  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, tcl.XTcl_NewStringObj(tls, (*SqlThread)(unsafe.Pointer(p)).FzVarname, -1))
 78488  	tcl.XTcl_ListObjAppendElement(tls, interp, pList, pRes)
 78489  	postToParent(tls, p, pList)
 78490  
 78491  	tcl.XTcl_Free(tls, p)
 78492  	for ok1 := true; ok1; ok1 = 0 != 0 {
 78493  		var _objPtr uintptr = pList
 78494  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78495  			tcl.XTclFreeObj(tls, _objPtr)
 78496  		}
 78497  	}
 78498  	for ok2 := true; ok2; ok2 = 0 != 0 {
 78499  		var _objPtr uintptr = pRes
 78500  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 78501  			tcl.XTclFreeObj(tls, _objPtr)
 78502  		}
 78503  	}
 78504  	tcl.XTcl_DeleteInterp(tls, interp)
 78505  	for tcl.XTcl_DoOneEvent(tls, ((libc.CplInt32((int32(1) << 1)))|(int32(1)<<1))) != 0 {
 78506  	}
 78507  	tcl.XTcl_ExitThread(tls, 0)
 78508  
 78509  }
 78510  
 78511  // sqlthread spawn VARNAME SCRIPT
 78512  //
 78513  //     Spawn a new thread with its own Tcl interpreter and run the
 78514  //     specified SCRIPT(s) in it. The thread terminates after running
 78515  //     the script. The result of the script is stored in the variable
 78516  //     VARNAME.
 78517  //
 78518  //     The caller can wait for the script to terminate using [vwait VARNAME].
 78519  func sqlthread_spawn(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:174:26: */
 78520  	bp := tls.Alloc(28)
 78521  	defer tls.Free(28)
 78522  
 78523  	// var x Tcl_ThreadId at bp+24, 4
 78524  
 78525  	var pNew uintptr
 78526  	var rc int32
 78527  	// var nVarname int32 at bp+16, 4
 78528  
 78529  	var zVarname uintptr
 78530  	// var nScript int32 at bp+20, 4
 78531  
 78532  	var zScript uintptr
 78533  
 78534  	// Parameters for thread creation
 78535  	var nStack int32 = 0
 78536  	var flags int32 = 0000
 78537  
 78538  	_ = clientData
 78539  	_ = objc
 78540  
 78541  	zVarname = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &nVarname */)
 78542  	zScript = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+20 /* &nScript */)
 78543  
 78544  	pNew = tcl.XTcl_Alloc(tls, (((uint32(unsafe.Sizeof(SqlThread{})) + uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)))) + uint32(*(*int32)(unsafe.Pointer(bp + 20 /* nScript */)))) + uint32(2)))
 78545  	(*SqlThread)(unsafe.Pointer(pNew)).FzVarname = (pNew + 1*16)
 78546  	(*SqlThread)(unsafe.Pointer(pNew)).FzScript = ((*SqlThread)(unsafe.Pointer(pNew)).FzVarname + uintptr((*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)) + 1)))
 78547  	libc.Xmemcpy(tls, (*SqlThread)(unsafe.Pointer(pNew)).FzVarname, zVarname, (uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nVarname */)) + 1)))
 78548  	libc.Xmemcpy(tls, (*SqlThread)(unsafe.Pointer(pNew)).FzScript, zScript, (uint32(*(*int32)(unsafe.Pointer(bp + 20 /* nScript */)) + 1)))
 78549  	(*SqlThread)(unsafe.Pointer(pNew)).Fparent = tcl.XTcl_GetCurrentThread(tls)
 78550  	(*SqlThread)(unsafe.Pointer(pNew)).Finterp = interp
 78551  
 78552  	rc = tcl.XTcl_CreateThread(tls, bp+24 /* &x */, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{tclScriptThread})), pNew, nStack, flags)
 78553  	if rc != TCL_OK {
 78554  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38500 /* "Error in Tcl_Cre..." */, 0))
 78555  		tcl.XTcl_Free(tls, pNew)
 78556  		return TCL_ERROR
 78557  	}
 78558  
 78559  	return TCL_OK
 78560  }
 78561  
 78562  // sqlthread parent SCRIPT
 78563  //
 78564  //     This can be called by spawned threads only. It sends the specified
 78565  //     script back to the parent thread for execution. The result of
 78566  //     evaluating the SCRIPT is returned. The parent thread must enter
 78567  //     the event loop for this to work - otherwise the caller will
 78568  //     block indefinitely.
 78569  //
 78570  //     NOTE: At the moment, this doesn't work. FIXME.
 78571  func sqlthread_parent(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:227:26: */
 78572  	bp := tls.Alloc(20)
 78573  	defer tls.Free(20)
 78574  
 78575  	var pEvent uintptr
 78576  	var zMsg uintptr
 78577  	// var nMsg int32 at bp+16, 4
 78578  
 78579  	var p uintptr = clientData
 78580  
 78581  	_ = objc
 78582  
 78583  	if p == uintptr(0) {
 78584  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38528 /* "no parent thread" */, 0))
 78585  		return TCL_ERROR
 78586  	}
 78587  
 78588  	zMsg = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+16 /* &nMsg */)
 78589  	pEvent = tcl.XTcl_Alloc(tls, ((uint32(unsafe.Sizeof(EvalEvent{})) + uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nMsg */)))) + uint32(1)))
 78590  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.FnextPtr = uintptr(0)
 78591  	(*EvalEvent)(unsafe.Pointer(pEvent)).Fbase.Fproc = *(*uintptr)(unsafe.Pointer(&struct {
 78592  		f func(*libc.TLS, uintptr, int32) int32
 78593  	}{tclScriptEvent}))
 78594  	(*EvalEvent)(unsafe.Pointer(pEvent)).FzScript = (pEvent + 1*16)
 78595  	libc.Xmemcpy(tls, (*EvalEvent)(unsafe.Pointer(pEvent)).FzScript, zMsg, (uint32(*(*int32)(unsafe.Pointer(bp + 16 /* nMsg */)) + 1)))
 78596  	(*EvalEvent)(unsafe.Pointer(pEvent)).Finterp = (*SqlThread)(unsafe.Pointer(p)).Finterp
 78597  	tcl.XTcl_ThreadQueueEvent(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent, pEvent, TCL_QUEUE_TAIL)
 78598  	tcl.XTcl_ThreadAlert(tls, (*SqlThread)(unsafe.Pointer(p)).Fparent)
 78599  
 78600  	return TCL_OK
 78601  }
 78602  
 78603  func xBusy(tls *libc.TLS, pArg uintptr, nBusy int32) int32 { /* test_thread.c:259:12: */
 78604  	_ = pArg
 78605  	_ = nBusy
 78606  	sqlite3.Xsqlite3_sleep(tls, 50)
 78607  	return 1 // Try again...
 78608  }
 78609  
 78610  // sqlthread open
 78611  //
 78612  //     Open a database handle and return the string representation of
 78613  //     the pointer value.
 78614  func sqlthread_open(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:272:26: */
 78615  	bp := tls.Alloc(120)
 78616  	defer tls.Free(120)
 78617  
 78618  	var zFilename uintptr
 78619  	// var db uintptr at bp+16, 4
 78620  
 78621  	// var zBuf [100]int8 at bp+20, 100
 78622  
 78623  	_ = clientData
 78624  	_ = objc
 78625  
 78626  	zFilename = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 78627  	sqlite3.Xsqlite3_open(tls, zFilename, bp+16 /* &db */)
 78628  	Md5_Register(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), uintptr(0), uintptr(0))
 78629  	sqlite3.Xsqlite3_busy_handler(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), *(*uintptr)(unsafe.Pointer(&struct {
 78630  		f func(*libc.TLS, uintptr, int32) int32
 78631  	}{xBusy})), uintptr(0))
 78632  
 78633  	if sqlite3TestMakePointerStr(tls, interp, bp+20 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */))) != 0 {
 78634  		return TCL_ERROR
 78635  	}
 78636  	tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, bp+20 /* &zBuf[0] */, 0))
 78637  
 78638  	return TCL_OK
 78639  }
 78640  
 78641  // sqlthread open
 78642  //
 78643  //     Return the current thread-id (Tcl_GetCurrentThread()) cast to
 78644  //     an integer.
 78645  func sqlthread_id(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:306:26: */
 78646  	var id Tcl_ThreadId = tcl.XTcl_GetCurrentThread(tls)
 78647  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(id)))
 78648  	_ = clientData
 78649  	_ = objc
 78650  	_ = objv
 78651  	return TCL_OK
 78652  }
 78653  
 78654  // Dispatch routine for the sub-commands of [sqlthread].
 78655  func sqlthread_proc(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:324:26: */
 78656  	bp := tls.Alloc(84)
 78657  	defer tls.Free(84)
 78658  
 78659  	*(*[5]struct {
 78660  		FzName  uintptr
 78661  		FxProc  uintptr
 78662  		FnArg   int32
 78663  		FzUsage uintptr
 78664  	})(unsafe.Pointer(bp /* aSub */)) = [5]struct {
 78665  		FzName  uintptr
 78666  		FxProc  uintptr
 78667  		FnArg   int32
 78668  		FzUsage uintptr
 78669  	}{
 78670  		{FzName: ts + 38545 /* "parent" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 78671  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78672  		}{sqlthread_parent})), FnArg: 1, FzUsage: ts + 10650 /* "SCRIPT" */},
 78673  		{FzName: ts + 38552 /* "spawn" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 78674  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78675  		}{sqlthread_spawn})), FnArg: 2, FzUsage: ts + 38558 /* "VARNAME SCRIPT" */},
 78676  		{FzName: ts + 37162 /* "open" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 78677  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78678  		}{sqlthread_open})), FnArg: 1, FzUsage: ts + 38573 /* "DBNAME" */},
 78679  		{FzName: ts + 38580 /* "id" */, FxProc: *(*uintptr)(unsafe.Pointer(&struct {
 78680  			f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78681  		}{sqlthread_id})), FzUsage: ts + 489 /* "" */},
 78682  		{},
 78683  	}
 78684  	var pSub uintptr
 78685  	var rc int32
 78686  	// var iIndex int32 at bp+80, 4
 78687  
 78688  	if objc < 2 {
 78689  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+2384 /* "SUB-COMMAND" */)
 78690  		return TCL_ERROR
 78691  	}
 78692  
 78693  	rc = tcl.XTcl_GetIndexFromObjStruct(tls,
 78694  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp /* &aSub[0] */, int32(unsafe.Sizeof(struct {
 78695  			FzName  uintptr
 78696  			FxProc  uintptr
 78697  			FnArg   int32
 78698  			FzUsage uintptr
 78699  		}{})), ts+1875 /* "sub-command" */, 0, bp+80 /* &iIndex */)
 78700  	if rc != TCL_OK {
 78701  		return rc
 78702  	}
 78703  	pSub = (bp /* &aSub */ + uintptr(*(*int32)(unsafe.Pointer(bp + 80 /* iIndex */)))*16)
 78704  
 78705  	if objc < ((*struct {
 78706  		FzName  uintptr
 78707  		FxProc  uintptr
 78708  		FnArg   int32
 78709  		FzUsage uintptr
 78710  	})(unsafe.Pointer(pSub)).FnArg + 2) {
 78711  		tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, (*struct {
 78712  			FzName  uintptr
 78713  			FxProc  uintptr
 78714  			FnArg   int32
 78715  			FzUsage uintptr
 78716  		})(unsafe.Pointer(pSub)).FzUsage)
 78717  		return TCL_ERROR
 78718  	}
 78719  
 78720  	return (*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer((pSub + 4 /* &.xProc */))))(tls, clientData, interp, objc, objv)
 78721  }
 78722  
 78723  /*
 78724  ** The [clock_seconds] command. This is more or less the same as the
 78725  ** regular tcl [clock seconds], except that it is available in testfixture
 78726  ** when linked against both Tcl 8.4 and 8.5. Because [clock seconds] is
 78727  ** implemented as a script in Tcl 8.5, it is not usually available to
 78728  ** testfixture.
 78729   */
 78730  func clock_seconds_proc(tls *libc.TLS, clientData ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:372:26: */
 78731  	bp := tls.Alloc(8)
 78732  	defer tls.Free(8)
 78733  
 78734  	// var now Tcl_Time at bp, 8
 78735  
 78736  	tcl.XTcl_GetTime(tls, bp /* &now */)
 78737  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32((*Tcl_Time)(unsafe.Pointer(bp /* &now */)).Fsec)))
 78738  	_ = clientData
 78739  	_ = objc
 78740  	_ = objv
 78741  	return TCL_OK
 78742  }
 78743  
 78744  // A pointer to an instance of this structure is passed as the user-context
 78745  // pointer when registering for an unlock-notify callback.
 78746  type UnlockNotification1 = struct {
 78747  	Ffired int32
 78748  	_      [4]byte
 78749  	Fcond  pthread_cond_t
 78750  	Fmutex pthread_mutex_t
 78751  } /* test_thread.c:410:9 */
 78752  
 78753  // A pointer to an instance of this structure is passed as the user-context
 78754  // pointer when registering for an unlock-notify callback.
 78755  type UnlockNotification = UnlockNotification1 /* test_thread.c:410:35 */
 78756  
 78757  // This function is an unlock-notify callback registered with SQLite.
 78758  func unlock_notify_cb(tls *libc.TLS, apArg uintptr, nArg int32) { /* test_thread.c:420:13: */
 78759  	var i int32
 78760  	for i = 0; i < nArg; i++ {
 78761  		var p uintptr = *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*4))
 78762  		libc2.Xpthread_mutex_lock(tls, (p + 56 /* &.mutex */))
 78763  		(*UnlockNotification)(unsafe.Pointer(p)).Ffired = 1
 78764  		libc2.Xpthread_cond_signal(tls, (p + 8 /* &.cond */))
 78765  		libc2.Xpthread_mutex_unlock(tls, (p + 56 /* &.mutex */))
 78766  	}
 78767  }
 78768  
 78769  // This function assumes that an SQLite API call (either sqlite3_prepare_v2()
 78770  // or sqlite3_step()) has just returned SQLITE_LOCKED. The argument is the
 78771  // associated database connection.
 78772  //
 78773  // This function calls sqlite3_unlock_notify() to register for an
 78774  // unlock-notify callback, then blocks until that callback is delivered
 78775  // and returns SQLITE_OK. The caller should then retry the failed operation.
 78776  //
 78777  // Or, if sqlite3_unlock_notify() indicates that to block would deadlock
 78778  // the system, then this function returns SQLITE_LOCKED immediately. In
 78779  // this case the caller should not retry the operation and should roll
 78780  // back the current transaction (if any).
 78781  func wait_for_unlock_notify(tls *libc.TLS, db uintptr) int32 { /* test_thread.c:445:12: */
 78782  	bp := tls.Alloc(80)
 78783  	defer tls.Free(80)
 78784  
 78785  	var rc int32
 78786  	// var un UnlockNotification at bp, 80
 78787  
 78788  	// Initialize the UnlockNotification structure.
 78789  	(*UnlockNotification)(unsafe.Pointer(bp /* &un */)).Ffired = 0
 78790  	libc2.Xpthread_mutex_init(tls, (bp /* &un */ + 56 /* &.mutex */), uintptr(0))
 78791  	libc2.Xpthread_cond_init(tls, (bp /* &un */ + 8 /* &.cond */), uintptr(0))
 78792  
 78793  	// Register for an unlock-notify callback.
 78794  	rc = sqlite3.Xsqlite3_unlock_notify(tls, db, *(*uintptr)(unsafe.Pointer(&struct {
 78795  		f func(*libc.TLS, uintptr, int32)
 78796  	}{unlock_notify_cb})), bp /* &un */)
 78797  
 78798  	// The call to sqlite3_unlock_notify() always returns either SQLITE_LOCKED
 78799  	// or SQLITE_OK.
 78800  	//
 78801  	// If SQLITE_LOCKED was returned, then the system is deadlocked. In this
 78802  	// case this function needs to return SQLITE_LOCKED to the caller so
 78803  	// that the current transaction can be rolled back. Otherwise, block
 78804  	// until the unlock-notify callback is invoked, then return SQLITE_OK.
 78805  	if rc == SQLITE_OK {
 78806  		libc2.Xpthread_mutex_lock(tls, (bp /* &un */ + 56 /* &.mutex */))
 78807  		if !((*UnlockNotification)(unsafe.Pointer(bp /* &un */)).Ffired != 0) {
 78808  			libc2.Xpthread_cond_wait(tls, (bp /* &un */ + 8 /* &.cond */), (bp /* &un */ + 56 /* &.mutex */))
 78809  		}
 78810  		libc2.Xpthread_mutex_unlock(tls, (bp /* &un */ + 56 /* &.mutex */))
 78811  	}
 78812  
 78813  	// Destroy the mutex and condition variables.
 78814  	libc2.Xpthread_cond_destroy(tls, (bp /* &un */ + 8 /* &.cond */))
 78815  	libc2.Xpthread_mutex_destroy(tls, (bp /* &un */ + 56 /* &.mutex */))
 78816  
 78817  	return rc
 78818  }
 78819  
 78820  // This function is a wrapper around the SQLite function sqlite3_step().
 78821  // It functions in the same way as step(), except that if a required
 78822  // shared-cache lock cannot be obtained, this function may block waiting for
 78823  // the lock to become available. In this scenario the normal API step()
 78824  // function always returns SQLITE_LOCKED.
 78825  //
 78826  // If this function returns SQLITE_LOCKED, the caller should rollback
 78827  // the current transaction (if any) and try again later. Otherwise, the
 78828  // system may become deadlocked.
 78829  func sqlite3_blocking_step(tls *libc.TLS, pStmt uintptr) int32 { /* test_thread.c:492:5: */
 78830  	var rc int32
 78831  	for SQLITE_LOCKED == (libc.AssignInt32(&rc, sqlite3.Xsqlite3_step(tls, pStmt))) {
 78832  		rc = wait_for_unlock_notify(tls, sqlite3.Xsqlite3_db_handle(tls, pStmt))
 78833  		if rc != SQLITE_OK {
 78834  			break
 78835  		}
 78836  		sqlite3.Xsqlite3_reset(tls, pStmt)
 78837  	}
 78838  	return rc
 78839  }
 78840  
 78841  // This function is a wrapper around the SQLite function sqlite3_prepare_v2().
 78842  // It functions in the same way as prepare_v2(), except that if a required
 78843  // shared-cache lock cannot be obtained, this function may block waiting for
 78844  // the lock to become available. In this scenario the normal API prepare_v2()
 78845  // function always returns SQLITE_LOCKED.
 78846  //
 78847  // If this function returns SQLITE_LOCKED, the caller should rollback
 78848  // the current transaction (if any) and try again later. Otherwise, the
 78849  // system may become deadlocked.
 78850  func sqlite3_blocking_prepare_v2(tls *libc.TLS, db uintptr, zSql uintptr, nSql int32, ppStmt uintptr, pz uintptr) int32 { /* test_thread.c:513:5: */
 78851  	var rc int32
 78852  	for SQLITE_LOCKED == (libc.AssignInt32(&rc, sqlite3.Xsqlite3_prepare_v2(tls, db, zSql, nSql, ppStmt, pz))) {
 78853  		rc = wait_for_unlock_notify(tls, db)
 78854  		if rc != SQLITE_OK {
 78855  			break
 78856  		}
 78857  	}
 78858  	return rc
 78859  }
 78860  
 78861  // END_SQLITE_BLOCKING_STEP
 78862  
 78863  // Usage: sqlite3_blocking_step STMT
 78864  //
 78865  // Advance the statement to the next row.
 78866  func blocking_step_proc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:534:26: */
 78867  	var pStmt uintptr
 78868  	var rc int32
 78869  
 78870  	if objc != 2 {
 78871  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+17418 /* "STMT" */)
 78872  		return TCL_ERROR
 78873  	}
 78874  
 78875  	pStmt = sqlite3TestTextToPtr(tls, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))))
 78876  	rc = sqlite3_blocking_step(tls, pStmt)
 78877  
 78878  	tcl.XTcl_SetResult(tls, interp, sqlite3.Xsqlite3ErrName(tls, rc), uintptr(0))
 78879  	return TCL_OK
 78880  }
 78881  
 78882  // Usage: sqlite3_blocking_prepare_v2 DB sql bytes ?tailvar?
 78883  // Usage: sqlite3_nonblocking_prepare_v2 DB sql bytes ?tailvar?
 78884  func blocking_prepare_v2_proc(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_thread.c:560:26: */
 78885  	bp := tls.Alloc(146)
 78886  	defer tls.Free(146)
 78887  
 78888  	// var db uintptr at bp+80, 4
 78889  
 78890  	var zSql uintptr
 78891  	// var bytes int32 at bp+84, 4
 78892  
 78893  	*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) = uintptr(0)
 78894  	*(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) = uintptr(0)
 78895  	// var zBuf [50]int8 at bp+96, 50
 78896  
 78897  	var rc int32
 78898  	var isBlocking int32 = libc.BoolInt32(!(clientData == uintptr(0)))
 78899  
 78900  	if (objc != 5) && (objc != 4) {
 78901  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+15410, /* "wrong # args: sh..." */
 78902  			tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))), ts+17464 /* " DB sql bytes ta..." */, 0))
 78903  		return TCL_ERROR
 78904  	}
 78905  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+80 /* &db */) != 0 {
 78906  		return TCL_ERROR
 78907  	}
 78908  	zSql = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 78909  	if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+84 /* &bytes */) != 0 {
 78910  		return TCL_ERROR
 78911  	}
 78912  
 78913  	if isBlocking != 0 {
 78914  		rc = sqlite3_blocking_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)), bp+88 /* &pStmt */, bp+92 /* &zTail */)
 78915  	} else {
 78916  		rc = sqlite3.Xsqlite3_prepare_v2(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */)), zSql, *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)), bp+88 /* &pStmt */, bp+92 /* &zTail */)
 78917  	}
 78918  
 78919  	if (*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)) != 0) && (objc >= 5) {
 78920  		if *(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) >= 0 {
 78921  			*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) = (*(*int32)(unsafe.Pointer(bp + 84 /* bytes */)) - ((int32(*(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */))) - int32(zSql)) / 1))
 78922  		}
 78923  		tcl.XTcl_ObjSetVar2(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), uintptr(0), tcl.XTcl_NewStringObj(tls, *(*uintptr)(unsafe.Pointer(bp + 92 /* zTail */)), *(*int32)(unsafe.Pointer(bp + 84 /* bytes */))), 0)
 78924  	}
 78925  	if rc != SQLITE_OK {
 78926  
 78927  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([50]int8{})), bp+96 /* &zBuf[0] */, ts+38583 /* "%s " */, libc.VaList(bp+32, sqlite3.Xsqlite3ErrName(tls, rc)))
 78928  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+40, bp+96 /* &zBuf[0] */, sqlite3.Xsqlite3_errmsg(tls, *(*uintptr)(unsafe.Pointer(bp + 80 /* db */))), 0))
 78929  		return TCL_ERROR
 78930  	}
 78931  
 78932  	if *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */)) != 0 {
 78933  		if sqlite3TestMakePointerStr(tls, interp, bp+96 /* &zBuf[0] */, *(*uintptr)(unsafe.Pointer(bp + 88 /* pStmt */))) != 0 {
 78934  			return TCL_ERROR
 78935  		}
 78936  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+64, bp+96 /* &zBuf[0] */, 0))
 78937  	}
 78938  	return TCL_OK
 78939  }
 78940  
 78941  //
 78942  // End of implementation of [sqlite3_blocking_step].
 78943  //
 78944  
 78945  // Register commands with the TCL interpreter.
 78946  func SqlitetestThread_Init(tls *libc.TLS, interp uintptr) int32 { /* test_thread.c:619:5: */
 78947  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38405 /* "sqlthread" */, *(*uintptr)(unsafe.Pointer(&struct {
 78948  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78949  	}{sqlthread_proc})), uintptr(0), uintptr(0))
 78950  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38391 /* "clock_seconds" */, *(*uintptr)(unsafe.Pointer(&struct {
 78951  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 78952  	}{clock_seconds_proc})), uintptr(0), uintptr(0))
 78953  	tcl.XTcl_CreateObjCommand(tls, interp, ts+38415 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78954  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78955  	}{blocking_step_proc})), uintptr(0), uintptr(0))
 78956  	tcl.XTcl_CreateObjCommand(tls, interp,
 78957  		ts+38437 /* "sqlite3_blocking..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78958  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78959  		}{blocking_prepare_v2_proc})), uintptr(1), uintptr(0))
 78960  	tcl.XTcl_CreateObjCommand(tls, interp,
 78961  		ts+38465 /* "sqlite3_nonblock..." */, *(*uintptr)(unsafe.Pointer(&struct {
 78962  			f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 78963  		}{blocking_prepare_v2_proc})), uintptr(0), uintptr(0))
 78964  	return TCL_OK
 78965  }
 78966  
 78967  // end block for C++
 78968  
 78969  // Local Variables:
 78970  // mode: c
 78971  // c-basic-offset: 4
 78972  // fill-column: 78
 78973  // End:
 78974  
 78975  func Sqlitetestvdbecov_Init(tls *libc.TLS, interp uintptr) int32 { /* test_vdbecov.c:113:5: */
 78976  	return TCL_OK
 78977  }
 78978  
 78979  // end block for C++
 78980  
 78981  // Local Variables:
 78982  // mode: c
 78983  // c-basic-offset: 4
 78984  // fill-column: 78
 78985  // End:
 78986  
 78987  type Testvfs1 = struct {
 78988  	FzName        uintptr
 78989  	FpParent      uintptr
 78990  	FpVfs         uintptr
 78991  	Finterp       uintptr
 78992  	FpScript      uintptr
 78993  	FpBuffer      uintptr
 78994  	FisNoshm      int32
 78995  	FisFullshm    int32
 78996  	Fmask         int32
 78997  	Fioerr_err    TestFaultInject
 78998  	Ffull_err     TestFaultInject
 78999  	Fcantopen_err TestFaultInject
 79000  	FiDevchar     int32
 79001  	FiSectorsize  int32
 79002  } /* test_vfs.c:37:9 */
 79003  
 79004  // end block for C++
 79005  
 79006  // Local Variables:
 79007  // mode: c
 79008  // c-basic-offset: 4
 79009  // fill-column: 78
 79010  // End:
 79011  
 79012  type Testvfs = Testvfs1 /* test_vfs.c:37:24 */
 79013  type TestvfsBuffer1 = struct {
 79014  	FzFile uintptr
 79015  	Fpgsz  int32
 79016  	FaPage [1024]uintptr
 79017  	FpFile uintptr
 79018  	FpNext uintptr
 79019  } /* test_vfs.c:37:9 */
 79020  
 79021  type TestvfsBuffer = TestvfsBuffer1 /* test_vfs.c:39:30 */
 79022  type TestvfsFile1 = struct {
 79023  	Fbase sqlite3_file
 79024  	FpFd  uintptr
 79025  } /* test_vfs.c:40:9 */
 79026  
 79027  type TestvfsFile = TestvfsFile1 /* test_vfs.c:40:28 */
 79028  type TestvfsFd1 = struct {
 79029  	FpVfs       uintptr
 79030  	FzFilename  uintptr
 79031  	FpReal      uintptr
 79032  	FpShmId     uintptr
 79033  	FpShm       uintptr
 79034  	Fexcllock   u32
 79035  	Fsharedlock u32
 79036  	FpNext      uintptr
 79037  } /* test_vfs.c:37:9 */
 79038  
 79039  type TestvfsFd = TestvfsFd1 /* test_vfs.c:41:26 */
 79040  
 79041  type TestFaultInject1 = struct {
 79042  	FiCnt   int32
 79043  	FeFault int32
 79044  	FnFail  int32
 79045  } /* test_vfs.c:37:9 */
 79046  
 79047  type TestFaultInject = TestFaultInject1 /* test_vfs.c:69:32 */
 79048  
 79049  var tvfs_io_methods = sqlite3_io_methods{
 79050  	FiVersion:               3, // iVersion
 79051  	FxClose:                 0, // xClose
 79052  	FxRead:                  0, // xRead
 79053  	FxWrite:                 0, // xWrite
 79054  	FxTruncate:              0, // xTruncate
 79055  	FxSync:                  0, // xSync
 79056  	FxFileSize:              0, // xFileSize
 79057  	FxLock:                  0, // xLock
 79058  	FxUnlock:                0, // xUnlock
 79059  	FxCheckReservedLock:     0, // xCheckReservedLock
 79060  	FxFileControl:           0, // xFileControl
 79061  	FxSectorSize:            0, // xSectorSize
 79062  	FxDeviceCharacteristics: 0, // xDeviceCharacteristics
 79063  	FxShmMap:                0, // xShmMap
 79064  	FxShmLock:               0, // xShmLock
 79065  	FxShmBarrier:            0, // xShmBarrier
 79066  	FxShmUnmap:              0, // xShmUnmap
 79067  	FxFetch:                 0,
 79068  	FxUnfetch:               0,
 79069  } /* test_vfs.c:204:27 */
 79070  
 79071  func tvfsResultCode(tls *libc.TLS, p uintptr, pRc uintptr) int32 { /* test_vfs.c:226:12: */
 79072  	bp := tls.Alloc(72)
 79073  	defer tls.Free(72)
 79074  
 79075  	*(*[9]errcode)(unsafe.Pointer(bp /* aCode */)) = [9]errcode{
 79076  		{FzCode: ts + 1988 /* "SQLITE_OK" */},
 79077  		{FeCode: SQLITE_ERROR, FzCode: ts + 1975 /* "SQLITE_ERROR" */},
 79078  		{FeCode: SQLITE_IOERR, FzCode: ts + 38587 /* "SQLITE_IOERR" */},
 79079  		{FeCode: SQLITE_LOCKED, FzCode: ts + 38600 /* "SQLITE_LOCKED" */},
 79080  		{FeCode: SQLITE_BUSY, FzCode: ts + 38614 /* "SQLITE_BUSY" */},
 79081  		{FeCode: SQLITE_READONLY, FzCode: ts + 38626 /* "SQLITE_READONLY" */},
 79082  		{FeCode: (SQLITE_READONLY | (int32(5) << 8)), FzCode: ts + 38642 /* "SQLITE_READONLY_..." */},
 79083  		{FeCode: SQLITE_NOTFOUND, FzCode: ts + 38667 /* "SQLITE_NOTFOUND" */},
 79084  		{FeCode: -1, FzCode: ts + 38683 /* "SQLITE_OMIT" */},
 79085  	}
 79086  	var z uintptr
 79087  	var i int32
 79088  
 79089  	z = tcl.XTcl_GetStringResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79090  	for i = 0; i < (int32(uint32(unsafe.Sizeof([9]errcode{})) / uint32(unsafe.Sizeof(errcode{})))); i++ {
 79091  		if 0 == libc.Xstrcmp(tls, z, (*errcode)(unsafe.Pointer(bp /* &aCode */ +uintptr(i)*8)).FzCode) {
 79092  			*(*int32)(unsafe.Pointer(pRc)) = (*errcode)(unsafe.Pointer(bp /* &aCode */ + uintptr(i)*8)).FeCode
 79093  			return 1
 79094  		}
 79095  	}
 79096  
 79097  	return 0
 79098  }
 79099  
 79100  type errcode = struct {
 79101  	FeCode int32
 79102  	FzCode uintptr
 79103  } /* test_vfs.c:227:3 */
 79104  
 79105  func tvfsInjectFault(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:256:12: */
 79106  	var ret int32 = 0
 79107  	if (*TestFaultInject)(unsafe.Pointer(p)).FeFault != 0 {
 79108  		(*TestFaultInject)(unsafe.Pointer(p)).FiCnt--
 79109  		if ((*TestFaultInject)(unsafe.Pointer(p)).FiCnt == 0) || (((*TestFaultInject)(unsafe.Pointer(p)).FiCnt < 0) && ((*TestFaultInject)(unsafe.Pointer(p)).FeFault == FAULT_INJECT_PERSISTENT)) {
 79110  			ret = 1
 79111  			(*TestFaultInject)(unsafe.Pointer(p)).FnFail++
 79112  		}
 79113  	}
 79114  	return ret
 79115  }
 79116  
 79117  func tvfsInjectIoerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:269:12: */
 79118  	return tvfsInjectFault(tls, (p + 36 /* &.ioerr_err */))
 79119  }
 79120  
 79121  func tvfsInjectFullerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:273:12: */
 79122  	return tvfsInjectFault(tls, (p + 48 /* &.full_err */))
 79123  }
 79124  
 79125  func tvfsInjectCantopenerr(tls *libc.TLS, p uintptr) int32 { /* test_vfs.c:276:12: */
 79126  	return tvfsInjectFault(tls, (p + 60 /* &.cantopen_err */))
 79127  }
 79128  
 79129  func tvfsExecTcl(tls *libc.TLS, p uintptr, zMethod uintptr, arg1 uintptr, arg2 uintptr, arg3 uintptr, arg4 uintptr) { /* test_vfs.c:281:13: */
 79130  	var rc int32 // Return code from Tcl_EvalObj()
 79131  	var pEval uintptr
 79132  
 79133  	pEval = tcl.XTcl_DuplicateObj(tls, (*Testvfs)(unsafe.Pointer(p)).FpScript)
 79134  	(*Tcl_Obj)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpScript)).FrefCount++
 79135  	tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, zMethod, -1))
 79136  	if arg1 != 0 {
 79137  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg1)
 79138  	}
 79139  	if arg2 != 0 {
 79140  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg2)
 79141  	}
 79142  	if arg3 != 0 {
 79143  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg3)
 79144  	}
 79145  	if arg4 != 0 {
 79146  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, arg4)
 79147  	}
 79148  
 79149  	rc = tcl.XTcl_EvalObjEx(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 79150  	if rc != TCL_OK {
 79151  		tcl.XTcl_BackgroundError(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79152  		tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79153  	}
 79154  }
 79155  
 79156  // Close an tvfs-file.
 79157  func tvfsClose(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:317:12: */
 79158  	var pTestfile uintptr = pFile
 79159  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd
 79160  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79161  
 79162  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_CLOSE_MASK) != 0) {
 79163  		tvfsExecTcl(tls, p, ts+35685, /* "xClose" */
 79164  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 79165  	}
 79166  
 79167  	if (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId != 0 {
 79168  		for ok := true; ok; ok = 0 != 0 {
 79169  			var _objPtr uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId
 79170  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 79171  				tcl.XTclFreeObj(tls, _objPtr)
 79172  			}
 79173  		}
 79174  		(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = uintptr(0)
 79175  	}
 79176  	if (*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods != 0 {
 79177  		tcl.XTcl_Free(tls, (*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods)
 79178  	}
 79179  	sqlite3.Xsqlite3OsClose(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 79180  	tcl.XTcl_Free(tls, pFd)
 79181  	(*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd = uintptr(0)
 79182  	return SQLITE_OK
 79183  }
 79184  
 79185  // Read data from an tvfs-file.
 79186  func tvfsRead(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_vfs.c:344:12: */
 79187  	bp := tls.Alloc(4)
 79188  	defer tls.Free(4)
 79189  
 79190  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79191  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79192  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79193  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_READ_MASK) != 0) {
 79194  		tvfsExecTcl(tls, p, ts+35692, /* "xRead" */
 79195  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 79196  		tvfsResultCode(tls, p, bp /* &rc */)
 79197  	}
 79198  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_READ_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 79199  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 79200  	}
 79201  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 79202  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsRead(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, zBuf, iAmt, iOfst)
 79203  	}
 79204  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79205  }
 79206  
 79207  // Write data to an tvfs-file.
 79208  func tvfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqlite_int64) int32 { /* test_vfs.c:371:12: */
 79209  	bp := tls.Alloc(4)
 79210  	defer tls.Free(4)
 79211  
 79212  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79213  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79214  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79215  
 79216  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0) {
 79217  		tvfsExecTcl(tls, p, ts+35698, /* "xWrite" */
 79218  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 79219  			tcl.XTcl_NewWideIntObj(tls, iOfst), tcl.XTcl_NewIntObj(tls, iAmt))
 79220  		tvfsResultCode(tls, p, bp /* &rc */)
 79221  		if *(*int32)(unsafe.Pointer(bp /* rc */)) < 0 {
 79222  			return SQLITE_OK
 79223  		}
 79224  	}
 79225  
 79226  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (tvfsInjectFullerr(tls, p) != 0) {
 79227  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_FULL
 79228  	}
 79229  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 79230  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 79231  	}
 79232  
 79233  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 79234  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsWrite(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, zBuf, iAmt, iOfst)
 79235  	}
 79236  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79237  }
 79238  
 79239  // Truncate an tvfs-file.
 79240  func tvfsTruncate(tls *libc.TLS, pFile uintptr, size sqlite_int64) int32 { /* test_vfs.c:406:12: */
 79241  	bp := tls.Alloc(4)
 79242  	defer tls.Free(4)
 79243  
 79244  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79245  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79246  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79247  
 79248  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_TRUNCATE_MASK) != 0) {
 79249  		tvfsExecTcl(tls, p, ts+35705, /* "xTruncate" */
 79250  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 79251  		tvfsResultCode(tls, p, bp /* &rc */)
 79252  	}
 79253  
 79254  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 79255  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsTruncate(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, size)
 79256  	}
 79257  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79258  }
 79259  
 79260  // Sync an tvfs-file.
 79261  func tvfsSync(tls *libc.TLS, pFile uintptr, flags int32) int32 { /* test_vfs.c:427:12: */
 79262  	bp := tls.Alloc(4)
 79263  	defer tls.Free(4)
 79264  
 79265  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79266  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79267  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79268  
 79269  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SYNC_MASK) != 0) {
 79270  		var zFlags uintptr = uintptr(0)
 79271  
 79272  		switch flags {
 79273  		case SQLITE_SYNC_NORMAL:
 79274  			zFlags = ts + 16869 /* "normal" */
 79275  			break
 79276  			fallthrough
 79277  		case SQLITE_SYNC_FULL:
 79278  			zFlags = ts + 18730 /* "full" */
 79279  			break
 79280  			fallthrough
 79281  		case (SQLITE_SYNC_NORMAL | SQLITE_SYNC_DATAONLY):
 79282  			zFlags = ts + 38695 /* "normal|dataonly" */
 79283  			break
 79284  			fallthrough
 79285  		case (SQLITE_SYNC_FULL | SQLITE_SYNC_DATAONLY):
 79286  			zFlags = ts + 38711 /* "full|dataonly" */
 79287  			break
 79288  			fallthrough
 79289  		default:
 79290  
 79291  		}
 79292  
 79293  		tvfsExecTcl(tls, p, ts+28129, /* "xSync" */
 79294  			tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 79295  			tcl.XTcl_NewStringObj(tls, zFlags, -1), uintptr(0))
 79296  		tvfsResultCode(tls, p, bp /* &rc */)
 79297  	}
 79298  
 79299  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (tvfsInjectFullerr(tls, p) != 0) {
 79300  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_FULL
 79301  	}
 79302  
 79303  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 79304  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsSync(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, flags)
 79305  	}
 79306  
 79307  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79308  }
 79309  
 79310  // Return the current file-size of an tvfs-file.
 79311  func tvfsFileSize(tls *libc.TLS, pFile uintptr, pSize uintptr) int32 { /* test_vfs.c:471:12: */
 79312  	var p uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79313  	return sqlite3.Xsqlite3OsFileSize(tls, (*TestvfsFd)(unsafe.Pointer(p)).FpReal, pSize)
 79314  }
 79315  
 79316  // Lock an tvfs-file.
 79317  func tvfsLock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_vfs.c:479:12: */
 79318  	bp := tls.Alloc(38)
 79319  	defer tls.Free(38)
 79320  
 79321  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79322  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79323  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_LOCK_MASK) != 0) {
 79324  		// var zLock [30]int8 at bp+8, 30
 79325  
 79326  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zLock[0] */, ts+1238 /* "%d" */, libc.VaList(bp, eLock))
 79327  		tvfsExecTcl(tls, p, ts+35725 /* "xLock" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 79328  			tcl.XTcl_NewStringObj(tls, bp+8 /* &zLock[0] */, -1), uintptr(0), uintptr(0))
 79329  	}
 79330  	return sqlite3.Xsqlite3OsLock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, eLock)
 79331  }
 79332  
 79333  // Unlock an tvfs-file.
 79334  func tvfsUnlock(tls *libc.TLS, pFile uintptr, eLock int32) int32 { /* test_vfs.c:494:12: */
 79335  	bp := tls.Alloc(38)
 79336  	defer tls.Free(38)
 79337  
 79338  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79339  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79340  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_UNLOCK_MASK) != 0) {
 79341  		// var zLock [30]int8 at bp+8, 30
 79342  
 79343  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([30]int8{})), bp+8 /* &zLock[0] */, ts+1238 /* "%d" */, libc.VaList(bp, eLock))
 79344  		tvfsExecTcl(tls, p, ts+35731 /* "xUnlock" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 79345  			tcl.XTcl_NewStringObj(tls, bp+8 /* &zLock[0] */, -1), uintptr(0), uintptr(0))
 79346  	}
 79347  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_WRITE_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 79348  		return (SQLITE_IOERR | (int32(8) << 8))
 79349  	}
 79350  	return sqlite3.Xsqlite3OsUnlock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, eLock)
 79351  }
 79352  
 79353  // Check if another file-handle holds a RESERVED lock on an tvfs-file.
 79354  func tvfsCheckReservedLock(tls *libc.TLS, pFile uintptr, pResOut uintptr) int32 { /* test_vfs.c:512:12: */
 79355  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79356  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79357  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_CKLOCK_MASK) != 0) {
 79358  		tvfsExecTcl(tls, p, ts+38725 /* "xCheckReservedLo..." */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 79359  			uintptr(0), uintptr(0), uintptr(0))
 79360  	}
 79361  	return sqlite3.Xsqlite3OsCheckReservedLock(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, pResOut)
 79362  }
 79363  
 79364  // File control method. For custom operations on an tvfs-file.
 79365  func tvfsFileControl(tls *libc.TLS, pFile uintptr, op int32, pArg uintptr) int32 { /* test_vfs.c:525:12: */
 79366  	bp := tls.Alloc(44)
 79367  	defer tls.Free(44)
 79368  
 79369  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79370  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79371  	if op == SQLITE_FCNTL_PRAGMA {
 79372  		var argv uintptr = pArg
 79373  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+10309 /* "error" */) == 0 {
 79374  			var rc int32 = SQLITE_ERROR
 79375  			if *(*uintptr)(unsafe.Pointer(argv + 2*4)) != 0 {
 79376  				var z uintptr = *(*uintptr)(unsafe.Pointer(argv + 2*4))
 79377  				var x int32 = libc.Xatoi(tls, z)
 79378  				if x != 0 {
 79379  					rc = x
 79380  					for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x04) != 0 {
 79381  						z++
 79382  					}
 79383  					for (int32(sqlite3.Xsqlite3CtypeMap[uint8(*(*int8)(unsafe.Pointer(z)))]) & 0x01) != 0 {
 79384  						z++
 79385  					}
 79386  				}
 79387  				if *(*int8)(unsafe.Pointer(z)) != 0 {
 79388  					*(*uintptr)(unsafe.Pointer(argv)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp, z))
 79389  				}
 79390  			}
 79391  			return rc
 79392  		}
 79393  		if sqlite3.Xsqlite3_stricmp(tls, *(*uintptr)(unsafe.Pointer(argv + 1*4)), ts+4655 /* "filename" */) == 0 {
 79394  			*(*uintptr)(unsafe.Pointer(argv)) = sqlite3.Xsqlite3_mprintf(tls, ts /* "%s" */, libc.VaList(bp+8, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename))
 79395  			return SQLITE_OK
 79396  		}
 79397  	}
 79398  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_FCNTL_MASK) != 0) {
 79399  		*(*[3]Fcntl)(unsafe.Pointer(bp + 16 /* aF */)) = [3]Fcntl{
 79400  			{FiFnctl: SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, FzFnctl: ts + 38744 /* "BEGIN_ATOMIC_WRI..." */},
 79401  			{FiFnctl: SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, FzFnctl: ts + 38763 /* "COMMIT_ATOMIC_WR..." */},
 79402  			{FiFnctl: SQLITE_FCNTL_ZIPVFS, FzFnctl: ts + 38783 /* "ZIPVFS" */},
 79403  		}
 79404  		var i int32
 79405  		for i = 0; uint32(i) < (uint32(unsafe.Sizeof([3]Fcntl{})) / uint32(unsafe.Sizeof(Fcntl{}))); i++ {
 79406  			if op == (*Fcntl)(unsafe.Pointer(bp+16 /* &aF */ +uintptr(i)*8)).FiFnctl {
 79407  				break
 79408  			}
 79409  		}
 79410  		if uint32(i) < (uint32(unsafe.Sizeof([3]Fcntl{})) / uint32(unsafe.Sizeof(Fcntl{}))) {
 79411  			*(*int32)(unsafe.Pointer(bp + 40 /* rc */)) = 0
 79412  			tvfsExecTcl(tls, p, ts+35753, /* "xFileControl" */
 79413  				tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1),
 79414  				tcl.XTcl_NewStringObj(tls, (*Fcntl)(unsafe.Pointer(bp+16 /* &aF */ +uintptr(i)*8)).FzFnctl, -1),
 79415  				uintptr(0), uintptr(0))
 79416  			tvfsResultCode(tls, p, bp+40 /* &rc */)
 79417  			if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) != 0 {
 79418  				return func() int32 {
 79419  					if *(*int32)(unsafe.Pointer(bp + 40 /* rc */)) < 0 {
 79420  						return SQLITE_OK
 79421  					}
 79422  					return *(*int32)(unsafe.Pointer(bp + 40 /* rc */))
 79423  				}()
 79424  			}
 79425  		}
 79426  	}
 79427  	return sqlite3.Xsqlite3OsFileControl(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, op, pArg)
 79428  }
 79429  
 79430  type Fcntl = struct {
 79431  	FiFnctl int32
 79432  	FzFnctl uintptr
 79433  } /* test_vfs.c:550:5 */
 79434  
 79435  // Return the sector-size in bytes for an tvfs-file.
 79436  func tvfsSectorSize(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:579:12: */
 79437  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79438  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79439  	if (*Testvfs)(unsafe.Pointer(p)).FiSectorsize >= 0 {
 79440  		return (*Testvfs)(unsafe.Pointer(p)).FiSectorsize
 79441  	}
 79442  	return sqlite3.Xsqlite3OsSectorSize(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 79443  }
 79444  
 79445  // Return the device characteristic flags supported by an tvfs-file.
 79446  func tvfsDeviceCharacteristics(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:591:12: */
 79447  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79448  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79449  	if (*Testvfs)(unsafe.Pointer(p)).FiDevchar >= 0 {
 79450  		return (*Testvfs)(unsafe.Pointer(p)).FiDevchar
 79451  	}
 79452  	return sqlite3.Xsqlite3OsDeviceCharacteristics(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)
 79453  }
 79454  
 79455  // Open an tvfs file handle.
 79456  func tvfsOpen(tls *libc.TLS, pVfs uintptr, zName uintptr, pFile uintptr, flags int32, pOutFlags uintptr) int32 { /* test_vfs.c:603:12: */
 79457  	bp := tls.Alloc(4)
 79458  	defer tls.Free(4)
 79459  
 79460  	// var rc int32 at bp, 4
 79461  
 79462  	var pTestfile uintptr = pFile
 79463  	var pFd uintptr
 79464  	var pId uintptr = uintptr(0)
 79465  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 79466  
 79467  	pFd = tcl.XTcl_Alloc(tls, (uint32(unsafe.Sizeof(TestvfsFd{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent))).FszOsFile)))
 79468  	libc.Xmemset(tls, pFd, 0, (uint32(unsafe.Sizeof(TestvfsFd{})) + uint32((*sqlite3_vfs)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent))).FszOsFile)))
 79469  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = uintptr(0)
 79470  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = uintptr(0)
 79471  	(*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename = zName
 79472  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs = pVfs
 79473  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpReal = (pFd + 1*32)
 79474  	libc.Xmemset(tls, pTestfile, 0, uint32(unsafe.Sizeof(TestvfsFile{})))
 79475  	(*TestvfsFile)(unsafe.Pointer(pTestfile)).FpFd = pFd
 79476  
 79477  	// Evaluate the Tcl script:
 79478  	//
 79479  	//   SCRIPT xOpen FILENAME KEY-VALUE-ARGS
 79480  	//
 79481  	// If the script returns an SQLite error code other than SQLITE_OK, an
 79482  	// error is returned to the caller. If it returns SQLITE_OK, the new
 79483  	// connection is named "anon". Otherwise, the value returned by the
 79484  	// script is used as the connection name.
 79485  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79486  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_OPEN_MASK) != 0) {
 79487  		var pArg uintptr = tcl.XTcl_NewObj(tls)
 79488  		(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 79489  		if (flags & SQLITE_OPEN_MAIN_DB) != 0 {
 79490  			var z uintptr = (zName + uintptr((libc.Xstrlen(tls, zName) + size_t(1))))
 79491  			for *(*int8)(unsafe.Pointer(z)) != 0 {
 79492  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, tcl.XTcl_NewStringObj(tls, z, -1))
 79493  				z += (uintptr(libc.Xstrlen(tls, z) + size_t(1)))
 79494  				tcl.XTcl_ListObjAppendElement(tls, uintptr(0), pArg, tcl.XTcl_NewStringObj(tls, z, -1))
 79495  				z += (uintptr(libc.Xstrlen(tls, z) + size_t(1)))
 79496  			}
 79497  		}
 79498  		tvfsExecTcl(tls, p, ts+27701 /* "xOpen" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), pArg, uintptr(0), uintptr(0))
 79499  		for ok := true; ok; ok = 0 != 0 {
 79500  			var _objPtr uintptr = pArg
 79501  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 79502  				tcl.XTclFreeObj(tls, _objPtr)
 79503  			}
 79504  		}
 79505  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 79506  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 79507  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 79508  			}
 79509  		} else {
 79510  			pId = tcl.XTcl_GetObjResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79511  		}
 79512  	}
 79513  
 79514  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_OPEN_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 79515  		return SQLITE_IOERR
 79516  	}
 79517  	if tvfsInjectCantopenerr(tls, p) != 0 {
 79518  		return SQLITE_CANTOPEN
 79519  	}
 79520  	if tvfsInjectFullerr(tls, p) != 0 {
 79521  		return SQLITE_FULL
 79522  	}
 79523  
 79524  	if !(pId != 0) {
 79525  		pId = tcl.XTcl_NewStringObj(tls, ts+38790 /* "anon" */, -1)
 79526  	}
 79527  	(*Tcl_Obj)(unsafe.Pointer(pId)).FrefCount++
 79528  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId = pId
 79529  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79530  
 79531  	*(*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)
 79532  	if (*sqlite3_file)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)).FpMethods != 0 {
 79533  		var pMethods uintptr
 79534  		var nByte int32
 79535  
 79536  		if (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion > 1 {
 79537  			nByte = int32(unsafe.Sizeof(sqlite3_io_methods{}))
 79538  		} else {
 79539  			nByte = int32((uintptr(0) + 52 /* &.xShmMap */))
 79540  		}
 79541  
 79542  		pMethods = tcl.XTcl_Alloc(tls, uint32(nByte))
 79543  		libc.Xmemcpy(tls, pMethods, uintptr(unsafe.Pointer(&tvfs_io_methods)), uint32(nByte))
 79544  		(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion = (*sqlite3_io_methods1)(unsafe.Pointer((*sqlite3_file)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpReal)).FpMethods)).FiVersion
 79545  		if (*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion > (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion {
 79546  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FiVersion = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion
 79547  		}
 79548  		if ((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion > 1) && ((*Testvfs)(unsafe.Pointer(((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData))).FisNoshm != 0) {
 79549  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmUnmap = uintptr(0)
 79550  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmLock = uintptr(0)
 79551  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmBarrier = uintptr(0)
 79552  			(*sqlite3_io_methods)(unsafe.Pointer(pMethods)).FxShmMap = uintptr(0)
 79553  		}
 79554  		(*sqlite3_file)(unsafe.Pointer(pFile)).FpMethods = pMethods
 79555  	}
 79556  
 79557  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79558  }
 79559  
 79560  // Delete the file located at zPath. If the dirSync argument is true,
 79561  // ensure the file-system modifications are synced to disk before
 79562  // returning.
 79563  func tvfsDelete(tls *libc.TLS, pVfs uintptr, zPath uintptr, dirSync int32) int32 { /* test_vfs.c:702:12: */
 79564  	bp := tls.Alloc(4)
 79565  	defer tls.Free(4)
 79566  
 79567  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79568  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 79569  
 79570  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_DELETE_MASK) != 0) {
 79571  		tvfsExecTcl(tls, p, ts+35790, /* "xDelete" */
 79572  			tcl.XTcl_NewStringObj(tls, zPath, -1), tcl.XTcl_NewIntObj(tls, dirSync), uintptr(0), uintptr(0))
 79573  		tvfsResultCode(tls, p, bp /* &rc */)
 79574  	}
 79575  	if *(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK {
 79576  		*(*int32)(unsafe.Pointer(bp /* rc */)) = sqlite3.Xsqlite3OsDelete(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, dirSync)
 79577  	}
 79578  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79579  }
 79580  
 79581  // Test for access permissions. Return true if the requested permission
 79582  // is available, or false otherwise.
 79583  func tvfsAccess(tls *libc.TLS, pVfs uintptr, zPath uintptr, flags int32, pResOut uintptr) int32 { /* test_vfs.c:722:12: */
 79584  	bp := tls.Alloc(4)
 79585  	defer tls.Free(4)
 79586  
 79587  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 79588  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_ACCESS_MASK) != 0) {
 79589  		// var rc int32 at bp, 4
 79590  
 79591  		var zArg uintptr = uintptr(0)
 79592  		if flags == SQLITE_ACCESS_EXISTS {
 79593  			zArg = ts + 38795 /* "SQLITE_ACCESS_EX..." */
 79594  		}
 79595  		if flags == SQLITE_ACCESS_READWRITE {
 79596  			zArg = ts + 38816 /* "SQLITE_ACCESS_RE..." */
 79597  		}
 79598  		if flags == SQLITE_ACCESS_READ {
 79599  			zArg = ts + 38840 /* "SQLITE_ACCESS_RE..." */
 79600  		}
 79601  		tvfsExecTcl(tls, p, ts+35798, /* "xAccess" */
 79602  			tcl.XTcl_NewStringObj(tls, zPath, -1), tcl.XTcl_NewStringObj(tls, zArg, -1), uintptr(0), uintptr(0))
 79603  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 79604  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 79605  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 79606  			}
 79607  		} else {
 79608  			var interp uintptr = (*Testvfs)(unsafe.Pointer(p)).Finterp
 79609  			if TCL_OK == tcl.XTcl_GetBooleanFromObj(tls, uintptr(0), tcl.XTcl_GetObjResult(tls, interp), pResOut) {
 79610  				return SQLITE_OK
 79611  			}
 79612  		}
 79613  	}
 79614  	return sqlite3.Xsqlite3OsAccess(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, flags, pResOut)
 79615  }
 79616  
 79617  // Populate buffer zOut with the full canonical pathname corresponding
 79618  // to the pathname in zPath. zOut is guaranteed to point to a buffer
 79619  // of at least (DEVSYM_MAX_PATHNAME+1) bytes.
 79620  func tvfsFullPathname(tls *libc.TLS, pVfs uintptr, zPath uintptr, nOut int32, zOut uintptr) int32 { /* test_vfs.c:755:12: */
 79621  	bp := tls.Alloc(4)
 79622  	defer tls.Free(4)
 79623  
 79624  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData
 79625  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_FULLPATHNAME_MASK) != 0) {
 79626  		// var rc int32 at bp, 4
 79627  
 79628  		tvfsExecTcl(tls, p, ts+35806 /* "xFullPathname" */, tcl.XTcl_NewStringObj(tls, zPath, -1), uintptr(0), uintptr(0), uintptr(0))
 79629  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 79630  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 79631  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 79632  			}
 79633  		}
 79634  	}
 79635  	return sqlite3.Xsqlite3OsFullPathname(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, zPath, nOut, zOut)
 79636  }
 79637  
 79638  // Populate the buffer pointed to by zBufOut with nByte bytes of
 79639  // random data.
 79640  func tvfsRandomness(tls *libc.TLS, pVfs uintptr, nByte int32, zBufOut uintptr) int32 { /* test_vfs.c:808:12: */
 79641  	return sqlite3.Xsqlite3OsRandomness(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, nByte, zBufOut)
 79642  }
 79643  
 79644  // Sleep for nMicro microseconds. Return the number of microseconds
 79645  // actually slept.
 79646  func tvfsSleep(tls *libc.TLS, pVfs uintptr, nMicro int32) int32 { /* test_vfs.c:816:12: */
 79647  	return sqlite3.Xsqlite3OsSleep(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, nMicro)
 79648  }
 79649  
 79650  // Return the current time as a Julian Day number in *pTimeOut.
 79651  func tvfsCurrentTime(tls *libc.TLS, pVfs uintptr, pTimeOut uintptr) int32 { /* test_vfs.c:823:12: */
 79652  	return (*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent + 64 /* &.xCurrentTime */))))(tls, (*Testvfs)(unsafe.Pointer((*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData)).FpParent, pTimeOut)
 79653  }
 79654  
 79655  func tvfsShmOpen(tls *libc.TLS, pFile uintptr) int32 { /* test_vfs.c:827:12: */
 79656  	bp := tls.Alloc(4)
 79657  	defer tls.Free(4)
 79658  
 79659  	var p uintptr
 79660  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK // Return code
 79661  	var pBuffer uintptr                                // Buffer to open connection to
 79662  	var pFd uintptr                                    // The testvfs file structure
 79663  
 79664  	pFd = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79665  	p = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79666  
 79667  	// Evaluate the Tcl script:
 79668  	//
 79669  	//   SCRIPT xShmOpen FILENAME
 79670  	tcl.XTcl_ResetResult(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp)
 79671  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMOPEN_MASK) != 0) {
 79672  		tvfsExecTcl(tls, p, ts+38859 /* "xShmOpen" */, tcl.XTcl_NewStringObj(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, -1), uintptr(0), uintptr(0), uintptr(0))
 79673  		if tvfsResultCode(tls, p, bp /* &rc */) != 0 {
 79674  			if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 79675  				return *(*int32)(unsafe.Pointer(bp /* rc */))
 79676  			}
 79677  		}
 79678  	}
 79679  
 79680  	if (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMOPEN_MASK) != 0) && (tvfsInjectIoerr(tls, p) != 0) {
 79681  		return SQLITE_IOERR
 79682  	}
 79683  
 79684  	// Search for a TestvfsBuffer. Create a new one if required.
 79685  	for pBuffer = (*Testvfs)(unsafe.Pointer(p)).FpBuffer; pBuffer != 0; pBuffer = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext {
 79686  		if 0 == libc.Xstrcmp(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile) {
 79687  			break
 79688  		}
 79689  	}
 79690  	if !(pBuffer != 0) {
 79691  		var szName int32 = int32(libc.Xstrlen(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename))
 79692  		var nByte int32 = (int32((uint32(unsafe.Sizeof(TestvfsBuffer{})) + uint32(szName)) + uint32(1)))
 79693  		pBuffer = tcl.XTcl_Alloc(tls, uint32(nByte))
 79694  		libc.Xmemset(tls, pBuffer, 0, uint32(nByte))
 79695  		(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile = (pBuffer + 1*4112)
 79696  		libc.Xmemcpy(tls, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile, (*TestvfsFd)(unsafe.Pointer(pFd)).FzFilename, (uint32(szName + 1)))
 79697  		(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext = (*Testvfs)(unsafe.Pointer(p)).FpBuffer
 79698  		(*Testvfs)(unsafe.Pointer(p)).FpBuffer = pBuffer
 79699  	}
 79700  
 79701  	// Connect the TestvfsBuffer to the new TestvfsShm handle and return.
 79702  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpNext = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile
 79703  	(*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile = pFd
 79704  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = pBuffer
 79705  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79706  }
 79707  
 79708  func tvfsAllocPage(tls *libc.TLS, p uintptr, iPage int32, pgsz int32) { /* test_vfs.c:877:13: */
 79709  
 79710  	if *(*uintptr)(unsafe.Pointer((p + 8 /* &.aPage */) + uintptr(iPage)*4)) == uintptr(0) {
 79711  		*(*uintptr)(unsafe.Pointer((p + 8 /* &.aPage */) + uintptr(iPage)*4)) = tcl.XTcl_Alloc(tls, uint32(pgsz))
 79712  		libc.Xmemset(tls, *(*uintptr)(unsafe.Pointer((p + 8 /* &.aPage */) + uintptr(iPage)*4)), 0, uint32(pgsz))
 79713  		(*TestvfsBuffer)(unsafe.Pointer(p)).Fpgsz = pgsz
 79714  	}
 79715  }
 79716  
 79717  func tvfsShmMap(tls *libc.TLS, pFile uintptr, iPage int32, pgsz int32, isWrite int32, pp uintptr) int32 { /* test_vfs.c:886:12: */
 79718  	bp := tls.Alloc(4)
 79719  	defer tls.Free(4)
 79720  
 79721  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79722  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79723  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79724  
 79725  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 79726  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 79727  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 52 /* &.xShmMap */))))(tls, pReal, iPage, pgsz, isWrite, libc.AtomicLoadUintptr(&pp))
 79728  	}
 79729  
 79730  	if uintptr(0) == (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm {
 79731  		*(*int32)(unsafe.Pointer(bp /* rc */)) = tvfsShmOpen(tls, pFile)
 79732  		if *(*int32)(unsafe.Pointer(bp /* rc */)) != SQLITE_OK {
 79733  			return *(*int32)(unsafe.Pointer(bp /* rc */))
 79734  		}
 79735  	}
 79736  
 79737  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMMAP_MASK) != 0) {
 79738  		var pArg uintptr = tcl.XTcl_NewObj(tls)
 79739  		(*Tcl_Obj)(unsafe.Pointer(pArg)).FrefCount++
 79740  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, iPage))
 79741  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, pgsz))
 79742  		tcl.XTcl_ListObjAppendElement(tls, (*Testvfs)(unsafe.Pointer(p)).Finterp, pArg, tcl.XTcl_NewIntObj(tls, isWrite))
 79743  		tvfsExecTcl(tls, p, ts+35883, /* "xShmMap" */
 79744  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, pArg, uintptr(0))
 79745  		tvfsResultCode(tls, p, bp /* &rc */)
 79746  		for ok := true; ok; ok = 0 != 0 {
 79747  			var _objPtr uintptr = pArg
 79748  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 79749  				tcl.XTclFreeObj(tls, _objPtr)
 79750  			}
 79751  		}
 79752  	}
 79753  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMMAP_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 79754  		*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_IOERR
 79755  	}
 79756  
 79757  	if ((*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) && (isWrite != 0)) && !(int32(*(*uintptr)(unsafe.Pointer(((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm + 8 /* &.aPage */) + uintptr(iPage)*4))) != 0) {
 79758  		tvfsAllocPage(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm, iPage, pgsz)
 79759  	}
 79760  	if (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_OK) || (*(*int32)(unsafe.Pointer(bp /* rc */)) == SQLITE_READONLY) {
 79761  		*(*uintptr)(unsafe.Pointer(libc.AtomicLoadUintptr(&pp))) = *(*uintptr)(unsafe.Pointer(((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm + 8 /* &.aPage */) + uintptr(iPage)*4))
 79762  	}
 79763  
 79764  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79765  }
 79766  
 79767  func tvfsShmLock(tls *libc.TLS, pFile uintptr, ofst int32, n int32, flags int32) int32 { /* test_vfs.c:936:12: */
 79768  	bp := tls.Alloc(100)
 79769  	defer tls.Free(100)
 79770  
 79771  	*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_OK
 79772  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79773  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79774  	var nLock int32
 79775  	// var zLock [80]int8 at bp+16, 80
 79776  
 79777  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 79778  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 79779  		return (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 56 /* &.xShmLock */))))(tls, pReal, ofst, n, flags)
 79780  	}
 79781  
 79782  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMLOCK_MASK) != 0) {
 79783  		sqlite3.Xsqlite3_snprintf(tls, int32(unsafe.Sizeof([80]int8{})), bp+16 /* &zLock[0] */, ts+18265 /* "%d %d" */, libc.VaList(bp, ofst, n))
 79784  		nLock = int32(libc.Xstrlen(tls, bp+16 /* &zLock[0] */))
 79785  		if (flags & SQLITE_SHM_LOCK) != 0 {
 79786  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38868 /* " lock" */)
 79787  		} else {
 79788  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38874 /* " unlock" */)
 79789  		}
 79790  		nLock = nLock + (int32(libc.Xstrlen(tls, (bp + 16 /* &zLock */ + uintptr(nLock)))))
 79791  		if (flags & SQLITE_SHM_SHARED) != 0 {
 79792  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38882 /* " shared" */)
 79793  		} else {
 79794  			libc.Xstrcpy(tls, (bp + 16 /* &zLock */ + uintptr(nLock)), ts+38890 /* " exclusive" */)
 79795  		}
 79796  		tvfsExecTcl(tls, p, ts+35862, /* "xShmLock" */
 79797  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId,
 79798  			tcl.XTcl_NewStringObj(tls, bp+16 /* &zLock[0] */, -1), uintptr(0))
 79799  		tvfsResultCode(tls, p, bp+96 /* &rc */)
 79800  	}
 79801  
 79802  	if ((*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMLOCK_MASK) != 0)) && (tvfsInjectIoerr(tls, p) != 0) {
 79803  		*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_IOERR
 79804  	}
 79805  
 79806  	if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK {
 79807  		var isLock int32 = (flags & SQLITE_SHM_LOCK)
 79808  		var isExcl int32 = (flags & SQLITE_SHM_EXCLUSIVE)
 79809  		var mask u32 = (u32(((int32(1) << n) - 1) << ofst))
 79810  		if isLock != 0 {
 79811  			var p2 uintptr
 79812  			for p2 = (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FpFile; p2 != 0; p2 = (*TestvfsFd)(unsafe.Pointer(p2)).FpNext {
 79813  				if p2 == pFd {
 79814  					continue
 79815  				}
 79816  				if (((*TestvfsFd)(unsafe.Pointer(p2)).Fexcllock & mask) != 0) || ((isExcl != 0) && (((*TestvfsFd)(unsafe.Pointer(p2)).Fsharedlock & mask) != 0)) {
 79817  					*(*int32)(unsafe.Pointer(bp + 96 /* rc */)) = SQLITE_BUSY
 79818  					break
 79819  				}
 79820  			}
 79821  			if *(*int32)(unsafe.Pointer(bp + 96 /* rc */)) == SQLITE_OK {
 79822  				if isExcl != 0 {
 79823  					*(*u32)(unsafe.Pointer(pFd + 20 /* &.excllock */)) |= (mask)
 79824  				}
 79825  				if !(isExcl != 0) {
 79826  					*(*u32)(unsafe.Pointer(pFd + 24 /* &.sharedlock */)) |= (mask)
 79827  				}
 79828  			}
 79829  		} else {
 79830  			if isExcl != 0 {
 79831  				*(*u32)(unsafe.Pointer(pFd + 20 /* &.excllock */)) &= (^mask)
 79832  			}
 79833  			if !(isExcl != 0) {
 79834  				*(*u32)(unsafe.Pointer(pFd + 24 /* &.sharedlock */)) &= (^mask)
 79835  			}
 79836  		}
 79837  	}
 79838  
 79839  	return *(*int32)(unsafe.Pointer(bp + 96 /* rc */))
 79840  }
 79841  
 79842  func tvfsShmBarrier(tls *libc.TLS, pFile uintptr) { /* test_vfs.c:1004:13: */
 79843  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79844  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79845  
 79846  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMBARRIER_MASK) != 0) {
 79847  		var z uintptr
 79848  		if (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm != 0 {
 79849  			z = (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile
 79850  		} else {
 79851  			z = ts + 489 /* "" */
 79852  		}
 79853  		tvfsExecTcl(tls, p, ts+35871 /* "xShmBarrier" */, tcl.XTcl_NewStringObj(tls, z, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 79854  	}
 79855  
 79856  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 79857  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 79858  		(*(*func(*libc.TLS, uintptr))(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 60 /* &.xShmBarrier */))))(tls, pReal)
 79859  		return
 79860  	}
 79861  }
 79862  
 79863  func tvfsShmUnmap(tls *libc.TLS, pFile uintptr, deleteFlag int32) int32 { /* test_vfs.c:1020:12: */
 79864  	bp := tls.Alloc(4)
 79865  	defer tls.Free(4)
 79866  
 79867  	*(*int32)(unsafe.Pointer(bp /* rc */)) = SQLITE_OK
 79868  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79869  	var p uintptr = (*sqlite3_vfs)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpVfs)).FpAppData
 79870  	var pBuffer uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpShm
 79871  	var ppFd uintptr
 79872  
 79873  	if (*Testvfs)(unsafe.Pointer(p)).FisFullshm != 0 {
 79874  		var pReal uintptr = (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal
 79875  		return (*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(pReal)).FpMethods + 64 /* &.xShmUnmap */))))(tls, pReal, deleteFlag)
 79876  	}
 79877  
 79878  	if !(pBuffer != 0) {
 79879  		return SQLITE_OK
 79880  	}
 79881  
 79882  	if ((*Testvfs)(unsafe.Pointer(p)).FpScript != 0) && (((*Testvfs)(unsafe.Pointer(p)).Fmask & TESTVFS_SHMCLOSE_MASK) != 0) {
 79883  		tvfsExecTcl(tls, p, ts+35852, /* "xShmUnmap" */
 79884  			tcl.XTcl_NewStringObj(tls, (*TestvfsBuffer)(unsafe.Pointer((*TestvfsFd)(unsafe.Pointer(pFd)).FpShm)).FzFile, -1), (*TestvfsFd)(unsafe.Pointer(pFd)).FpShmId, uintptr(0), uintptr(0))
 79885  		tvfsResultCode(tls, p, bp /* &rc */)
 79886  	}
 79887  
 79888  	for ppFd = (pBuffer + 4104 /* &.pFile */); *(*uintptr)(unsafe.Pointer(ppFd)) != pFd; ppFd = (*(*uintptr)(unsafe.Pointer(ppFd)) + 28 /* &.pNext */) {
 79889  	}
 79890  
 79891  	*(*uintptr)(unsafe.Pointer(ppFd)) = (*TestvfsFd)(unsafe.Pointer(pFd)).FpNext
 79892  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpNext = uintptr(0)
 79893  
 79894  	if (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpFile == uintptr(0) {
 79895  		var i int32
 79896  		var pp uintptr
 79897  		for pp = (p + 20 /* &.pBuffer */); *(*uintptr)(unsafe.Pointer(pp)) != pBuffer; pp = (*(*uintptr)(unsafe.Pointer(pp)) + 4108 /* &.pNext */) {
 79898  		}
 79899  		*(*uintptr)(unsafe.Pointer(pp)) = (*TestvfsBuffer)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(pp)))).FpNext
 79900  		for i = 0; *(*uintptr)(unsafe.Pointer((pBuffer + 8 /* &.aPage */) + uintptr(i)*4)) != 0; i++ {
 79901  			tcl.XTcl_Free(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 8 /* &.aPage */) + uintptr(i)*4)))
 79902  		}
 79903  		tcl.XTcl_Free(tls, pBuffer)
 79904  	}
 79905  	(*TestvfsFd)(unsafe.Pointer(pFd)).FpShm = uintptr(0)
 79906  
 79907  	return *(*int32)(unsafe.Pointer(bp /* rc */))
 79908  }
 79909  
 79910  func tvfsFetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, iAmt int32, pp uintptr) int32 { /* test_vfs.c:1065:12: */
 79911  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79912  	return sqlite3.Xsqlite3OsFetch(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, iOfst, iAmt, pp)
 79913  }
 79914  
 79915  func tvfsUnfetch(tls *libc.TLS, pFile uintptr, iOfst sqlite3_int64, p uintptr) int32 { /* test_vfs.c:1075:12: */
 79916  	var pFd uintptr = (*TestvfsFile)(unsafe.Pointer(pFile)).FpFd
 79917  	return sqlite3.Xsqlite3OsUnfetch(tls, (*TestvfsFd)(unsafe.Pointer(pFd)).FpReal, iOfst, p)
 79918  }
 79919  
 79920  func testvfs_obj_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1080:26: */
 79921  	bp := tls.Alloc(348)
 79922  	defer tls.Free(348)
 79923  
 79924  	var p uintptr = cd
 79925  	*(*[10]TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* aSubcmd */)) = [10]TestvfsSubcmd{
 79926  		{FzName: ts + 38901 /* "shm" */},
 79927  		{FzName: ts + 10601 /* "delete" */, FeCmd: uint32(1) /* CMD_DELETE */},
 79928  		{FzName: ts + 38905 /* "filter" */, FeCmd: uint32(2) /* CMD_FILTER */},
 79929  		{FzName: ts + 38912 /* "ioerr" */, FeCmd: uint32(3) /* CMD_IOERR */},
 79930  		{FzName: ts + 38918 /* "fullerr" */, FeCmd: uint32(7) /* CMD_FULLERR */},
 79931  		{FzName: ts + 38926 /* "cantopenerr" */, FeCmd: uint32(8) /* CMD_CANTOPENERR */},
 79932  		{FzName: ts + 38938 /* "script" */, FeCmd: uint32(4) /* CMD_SCRIPT */},
 79933  		{FzName: ts + 38945 /* "devchar" */, FeCmd: uint32(5) /* CMD_DEVCHAR */},
 79934  		{FzName: ts + 38953 /* "sectorsize" */, FeCmd: uint32(6) /* CMD_SECTORSIZE */},
 79935  		{},
 79936  	}
 79937  	// var i int32 at bp+176, 4
 79938  
 79939  	if objc < 2 {
 79940  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1860 /* "SUBCOMMAND ..." */)
 79941  		return TCL_ERROR
 79942  	}
 79943  	if tcl.XTcl_GetIndexFromObjStruct(tls,
 79944  		interp, *(*uintptr)(unsafe.Pointer(objv + 1*4)), bp+96 /* &aSubcmd[0] */, int32(unsafe.Sizeof(TestvfsSubcmd{})), ts+38964 /* "subcommand" */, 0, bp+176 /* &i */) != 0 {
 79945  		return TCL_ERROR
 79946  	}
 79947  	tcl.XTcl_ResetResult(tls, interp)
 79948  
 79949  	switch (*TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* &aSubcmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*8)).FeCmd {
 79950  	case uint32(0) /* CMD_SHM */ :
 79951  		{
 79952  			var pObj uintptr
 79953  			var rc int32
 79954  			var pBuffer uintptr
 79955  			var zName uintptr
 79956  			if (objc != 3) && (objc != 4) {
 79957  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+38975 /* "FILE ?VALUE?" */)
 79958  				return TCL_ERROR
 79959  			}
 79960  			zName = tcl.XTcl_Alloc(tls, uint32((*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname))
 79961  			rc = (*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(((*Testvfs)(unsafe.Pointer(p)).FpParent + 36 /* &.xFullPathname */))))(tls,
 79962  				(*Testvfs)(unsafe.Pointer(p)).FpParent, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))),
 79963  				(*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname, zName)
 79964  			if rc != SQLITE_OK {
 79965  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+38988, /* "failed to get fu..." */
 79966  					tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 0))
 79967  				tcl.XTcl_Free(tls, zName)
 79968  				return TCL_ERROR
 79969  			}
 79970  			for pBuffer = (*Testvfs)(unsafe.Pointer(p)).FpBuffer; pBuffer != 0; pBuffer = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FpNext {
 79971  				if 0 == libc.Xstrcmp(tls, (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).FzFile, zName) {
 79972  					break
 79973  				}
 79974  			}
 79975  			tcl.XTcl_Free(tls, zName)
 79976  			if !(pBuffer != 0) {
 79977  				tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+24, ts+39014 /* "no such file: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 0))
 79978  				return TCL_ERROR
 79979  			}
 79980  			if objc == 4 {
 79981  				// var n int32 at bp+180, 4
 79982  
 79983  				var a uintptr = tcl.XTcl_GetByteArrayFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+180 /* &n */)
 79984  				var pgsz int32 = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).Fpgsz
 79985  				if pgsz == 0 {
 79986  					pgsz = 65536
 79987  				}
 79988  				for *(*int32)(unsafe.Pointer(bp + 176 /* i */)) = 0; (*(*int32)(unsafe.Pointer(bp + 176 /* i */)) * pgsz) < *(*int32)(unsafe.Pointer(bp + 180 /* n */)); *(*int32)(unsafe.Pointer(bp + 176 /* i */))++ {
 79989  					var nByte int32 = pgsz
 79990  					tvfsAllocPage(tls, pBuffer, *(*int32)(unsafe.Pointer(bp + 176 /* i */)), pgsz)
 79991  					if (*(*int32)(unsafe.Pointer(bp + 180 /* n */)) - (*(*int32)(unsafe.Pointer(bp + 176 /* i */)) * pgsz)) < pgsz {
 79992  						nByte = *(*int32)(unsafe.Pointer(bp + 180 /* n */))
 79993  					}
 79994  					libc.Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 8 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*4)), (a + uintptr((*(*int32)(unsafe.Pointer(bp + 176 /* i */)) * pgsz))), uint32(nByte))
 79995  				}
 79996  			}
 79997  
 79998  			pObj = tcl.XTcl_NewObj(tls)
 79999  			for *(*int32)(unsafe.Pointer(bp + 176 /* i */)) = 0; *(*uintptr)(unsafe.Pointer((pBuffer + 8 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*4)) != 0; *(*int32)(unsafe.Pointer(bp + 176 /* i */))++ {
 80000  				var pgsz int32 = (*TestvfsBuffer)(unsafe.Pointer(pBuffer)).Fpgsz
 80001  				if pgsz == 0 {
 80002  					pgsz = 65536
 80003  				}
 80004  				tcl.XTcl_AppendObjToObj(tls, pObj, tcl.XTcl_NewByteArrayObj(tls, *(*uintptr)(unsafe.Pointer((pBuffer + 8 /* &.aPage */) + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*4)), pgsz))
 80005  			}
 80006  			tcl.XTcl_SetObjResult(tls, interp, pObj)
 80007  			break
 80008  
 80009  		}
 80010  
 80011  	// TESTVFS filter METHOD-LIST
 80012  	//
 80013  	//     Activate special processing for those methods contained in the list
 80014  	case uint32(2) /* CMD_FILTER */ :
 80015  		{
 80016  			*(*uintptr)(unsafe.Pointer(bp + 188 /* apElem */)) = uintptr(0)
 80017  			*(*int32)(unsafe.Pointer(bp + 184 /* nElem */)) = 0
 80018  			var mask int32 = 0
 80019  			if objc != 3 {
 80020  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+32617 /* "LIST" */)
 80021  				return TCL_ERROR
 80022  			}
 80023  			if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+184 /* &nElem */, bp+188 /* &apElem */) != 0 {
 80024  				return TCL_ERROR
 80025  			}
 80026  			tcl.XTcl_ResetResult(tls, interp)
 80027  			for *(*int32)(unsafe.Pointer(bp + 176 /* i */)) = 0; *(*int32)(unsafe.Pointer(bp + 176 /* i */)) < *(*int32)(unsafe.Pointer(bp + 184 /* nElem */)); *(*int32)(unsafe.Pointer(bp + 176 /* i */))++ {
 80028  				var iMethod int32
 80029  				var zElem uintptr = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 188 /* apElem */)) + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*4)))
 80030  				for iMethod = 0; iMethod < (int32(uint32(unsafe.Sizeof(vfsmethod)) / uint32(unsafe.Sizeof(VfsMethod{})))); iMethod++ {
 80031  					if libc.Xstrcmp(tls, zElem, vfsmethod[iMethod].FzName) == 0 {
 80032  						mask = mask | (vfsmethod[iMethod].Fmask)
 80033  						break
 80034  					}
 80035  				}
 80036  				if iMethod == (int32(uint32(unsafe.Sizeof(vfsmethod)) / uint32(unsafe.Sizeof(VfsMethod{})))) {
 80037  					tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+48, ts+39029 /* "unknown method: " */, zElem, 0))
 80038  					return TCL_ERROR
 80039  				}
 80040  			}
 80041  			(*Testvfs)(unsafe.Pointer(p)).Fmask = mask
 80042  			break
 80043  
 80044  		}
 80045  
 80046  	//  TESTVFS script ?SCRIPT?
 80047  	//
 80048  	//  Query or set the script to be run when filtered VFS events
 80049  	//  occur.
 80050  	case uint32(4) /* CMD_SCRIPT */ :
 80051  		{
 80052  			if objc == 3 {
 80053  				// var nByte int32 at bp+192, 4
 80054  
 80055  				if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 80056  					for ok := true; ok; ok = 0 != 0 {
 80057  						var _objPtr uintptr = (*Testvfs)(unsafe.Pointer(p)).FpScript
 80058  						if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80059  							tcl.XTclFreeObj(tls, _objPtr)
 80060  						}
 80061  					}
 80062  					(*Testvfs)(unsafe.Pointer(p)).FpScript = uintptr(0)
 80063  				}
 80064  				tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+192 /* &nByte */)
 80065  				if *(*int32)(unsafe.Pointer(bp + 192 /* nByte */)) > 0 {
 80066  					(*Testvfs)(unsafe.Pointer(p)).FpScript = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 80067  					(*Tcl_Obj)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpScript)).FrefCount++
 80068  				}
 80069  			} else if objc != 2 {
 80070  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+13719 /* "?SCRIPT?" */)
 80071  				return TCL_ERROR
 80072  			}
 80073  
 80074  			tcl.XTcl_ResetResult(tls, interp)
 80075  			if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 80076  				tcl.XTcl_SetObjResult(tls, interp, (*Testvfs)(unsafe.Pointer(p)).FpScript)
 80077  			}
 80078  
 80079  			break
 80080  
 80081  		}
 80082  
 80083  	// TESTVFS ioerr ?IFAIL PERSIST?
 80084  	//
 80085  	//   Where IFAIL is an integer and PERSIST is boolean.
 80086  	case uint32(8) /* CMD_CANTOPENERR */ :
 80087  		fallthrough
 80088  	case uint32(3) /* CMD_IOERR */ :
 80089  		fallthrough
 80090  	case uint32(7) /* CMD_FULLERR */ :
 80091  		{
 80092  			var pTest uintptr = uintptr(0)
 80093  			var iRet int32
 80094  
 80095  			switch (*TestvfsSubcmd)(unsafe.Pointer(bp + 96 /* &aSubcmd */ + uintptr(*(*int32)(unsafe.Pointer(bp + 176 /* i */)))*8)).FeCmd {
 80096  			case uint32(3) /* CMD_IOERR */ :
 80097  				pTest = (p + 36 /* &.ioerr_err */)
 80098  				break
 80099  			case uint32(7) /* CMD_FULLERR */ :
 80100  				pTest = (p + 48 /* &.full_err */)
 80101  				break
 80102  			case uint32(8) /* CMD_CANTOPENERR */ :
 80103  				pTest = (p + 60 /* &.cantopen_err */)
 80104  				break
 80105  			default:
 80106  			}
 80107  			iRet = (*TestFaultInject)(unsafe.Pointer(pTest)).FnFail
 80108  			(*TestFaultInject)(unsafe.Pointer(pTest)).FnFail = 0
 80109  			(*TestFaultInject)(unsafe.Pointer(pTest)).FeFault = 0
 80110  			(*TestFaultInject)(unsafe.Pointer(pTest)).FiCnt = 0
 80111  
 80112  			if objc == 4 {
 80113  				// var iCnt int32 at bp+196, 4
 80114  
 80115  				// var iPersist int32 at bp+200, 4
 80116  
 80117  				if (TCL_OK != tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+196 /* &iCnt */)) ||
 80118  					(TCL_OK != tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+200 /* &iPersist */)) {
 80119  					return TCL_ERROR
 80120  				}
 80121  				(*TestFaultInject)(unsafe.Pointer(pTest)).FeFault = func() int32 {
 80122  					if *(*int32)(unsafe.Pointer(bp + 200 /* iPersist */)) != 0 {
 80123  						return FAULT_INJECT_PERSISTENT
 80124  					}
 80125  					return FAULT_INJECT_TRANSIENT
 80126  				}()
 80127  				(*TestFaultInject)(unsafe.Pointer(pTest)).FiCnt = *(*int32)(unsafe.Pointer(bp + 196 /* iCnt */))
 80128  			} else if objc != 2 {
 80129  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39046 /* "?CNT PERSIST?" */)
 80130  				return TCL_ERROR
 80131  			}
 80132  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, iRet))
 80133  			break
 80134  
 80135  		}
 80136  
 80137  	case uint32(1) /* CMD_DELETE */ :
 80138  		{
 80139  			tcl.XTcl_DeleteCommand(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv))))
 80140  			break
 80141  
 80142  		}
 80143  
 80144  	case uint32(5) /* CMD_DEVCHAR */ :
 80145  		{
 80146  			*(*[16]DeviceFlag)(unsafe.Pointer(bp + 212 /* aFlag */)) = [16]DeviceFlag{
 80147  				{FzName: ts + 39060 /* "default" */, FiValue: -1},
 80148  				{FzName: ts + 26683 /* "atomic" */, FiValue: SQLITE_IOCAP_ATOMIC},
 80149  				{FzName: ts + 26690 /* "atomic512" */, FiValue: SQLITE_IOCAP_ATOMIC512},
 80150  				{FzName: ts + 26700 /* "atomic1k" */, FiValue: SQLITE_IOCAP_ATOMIC1K},
 80151  				{FzName: ts + 26709 /* "atomic2k" */, FiValue: SQLITE_IOCAP_ATOMIC2K},
 80152  				{FzName: ts + 26718 /* "atomic4k" */, FiValue: SQLITE_IOCAP_ATOMIC4K},
 80153  				{FzName: ts + 26727 /* "atomic8k" */, FiValue: SQLITE_IOCAP_ATOMIC8K},
 80154  				{FzName: ts + 26736 /* "atomic16k" */, FiValue: SQLITE_IOCAP_ATOMIC16K},
 80155  				{FzName: ts + 26746 /* "atomic32k" */, FiValue: SQLITE_IOCAP_ATOMIC32K},
 80156  				{FzName: ts + 26756 /* "atomic64k" */, FiValue: SQLITE_IOCAP_ATOMIC64K},
 80157  				{FzName: ts + 26766 /* "sequential" */, FiValue: SQLITE_IOCAP_SEQUENTIAL},
 80158  				{FzName: ts + 26777 /* "safe_append" */, FiValue: SQLITE_IOCAP_SAFE_APPEND},
 80159  				{FzName: ts + 39068 /* "undeletable_when..." */, FiValue: SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},
 80160  				{FzName: ts + 26789 /* "powersafe_overwr..." */, FiValue: SQLITE_IOCAP_POWERSAFE_OVERWRITE},
 80161  				{FzName: ts + 39090 /* "immutable" */, FiValue: SQLITE_IOCAP_IMMUTABLE},
 80162  				{},
 80163  			}
 80164  			var pRet uintptr
 80165  			var iFlag int32
 80166  
 80167  			if objc > 3 {
 80168  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39100 /* "?ATTR-LIST?" */)
 80169  				return TCL_ERROR
 80170  			}
 80171  			if objc == 3 {
 80172  				var j int32
 80173  				var iNew int32 = 0
 80174  				*(*uintptr)(unsafe.Pointer(bp + 208 /* flags */)) = uintptr(0)
 80175  				*(*int32)(unsafe.Pointer(bp + 204 /* nFlags */)) = 0
 80176  
 80177  				if tcl.XTcl_ListObjGetElements(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+204 /* &nFlags */, bp+208 /* &flags */) != 0 {
 80178  					return TCL_ERROR
 80179  				}
 80180  
 80181  				for j = 0; j < *(*int32)(unsafe.Pointer(bp + 204 /* nFlags */)); j++ {
 80182  					*(*int32)(unsafe.Pointer(bp + 340 /* idx */)) = 0
 80183  					if tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 208 /* flags */)) + uintptr(j)*4)), bp+212, /* &aFlag[0] */
 80184  						int32(unsafe.Sizeof(DeviceFlag{})), ts+17985 /* "flag" */, 0, bp+340 /* &idx */) != 0 {
 80185  						return TCL_ERROR
 80186  					}
 80187  					if ((*DeviceFlag)(unsafe.Pointer(bp+212 /* &aFlag */ +uintptr(*(*int32)(unsafe.Pointer(bp + 340 /* idx */)))*8)).FiValue < 0) && (*(*int32)(unsafe.Pointer(bp + 204 /* nFlags */)) > 1) {
 80188  						tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp+72, ts+39112 /* "bad flags: " */, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4))), 0))
 80189  						return TCL_ERROR
 80190  					}
 80191  					iNew = iNew | ((*DeviceFlag)(unsafe.Pointer(bp + 212 /* &aFlag */ + uintptr(*(*int32)(unsafe.Pointer(bp + 340 /* idx */)))*8)).FiValue)
 80192  				}
 80193  
 80194  				(*Testvfs)(unsafe.Pointer(p)).FiDevchar = (iNew | 0x10000000)
 80195  			}
 80196  
 80197  			pRet = tcl.XTcl_NewObj(tls)
 80198  			for iFlag = 0; uint32(iFlag) < (uint32(unsafe.Sizeof([16]DeviceFlag{})) / uint32(unsafe.Sizeof(DeviceFlag{}))); iFlag++ {
 80199  				if ((*Testvfs)(unsafe.Pointer(p)).FiDevchar & (*DeviceFlag)(unsafe.Pointer(bp+212 /* &aFlag */ +uintptr(iFlag)*8)).FiValue) != 0 {
 80200  					tcl.XTcl_ListObjAppendElement(tls,
 80201  						interp, pRet, tcl.XTcl_NewStringObj(tls, (*DeviceFlag)(unsafe.Pointer(bp+212 /* &aFlag */ +uintptr(iFlag)*8)).FzName, -1))
 80202  				}
 80203  			}
 80204  			tcl.XTcl_SetObjResult(tls, interp, pRet)
 80205  
 80206  			break
 80207  
 80208  		}
 80209  
 80210  	case uint32(6) /* CMD_SECTORSIZE */ :
 80211  		{
 80212  			if objc > 3 {
 80213  				tcl.XTcl_WrongNumArgs(tls, interp, 2, objv, ts+39124 /* "?VALUE?" */)
 80214  				return TCL_ERROR
 80215  			}
 80216  			if objc == 3 {
 80217  				*(*int32)(unsafe.Pointer(bp + 344 /* iNew */)) = 0
 80218  				if tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 2*4)), bp+344 /* &iNew */) != 0 {
 80219  					return TCL_ERROR
 80220  				}
 80221  				(*Testvfs)(unsafe.Pointer(p)).FiSectorsize = *(*int32)(unsafe.Pointer(bp + 344 /* iNew */))
 80222  			}
 80223  			tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, (*Testvfs)(unsafe.Pointer(p)).FiSectorsize))
 80224  			break
 80225  
 80226  		}
 80227  	}
 80228  
 80229  	return TCL_OK
 80230  }
 80231  
 80232  type TestvfsSubcmd = struct {
 80233  	FzName uintptr
 80234  	FeCmd  uint32
 80235  } /* test_vfs.c:1092:3 */
 80236  
 80237  type VfsMethod = struct {
 80238  	FzName uintptr
 80239  	Fmask  int32
 80240  } /* test_vfs.c:1179:14 */
 80241  
 80242  var vfsmethod = [18]VfsMethod{
 80243  	{FzName: ts + 38859 /* "xShmOpen" */, Fmask: TESTVFS_SHMOPEN_MASK},
 80244  	{FzName: ts + 35862 /* "xShmLock" */, Fmask: TESTVFS_SHMLOCK_MASK},
 80245  	{FzName: ts + 35871 /* "xShmBarrier" */, Fmask: TESTVFS_SHMBARRIER_MASK},
 80246  	{FzName: ts + 35852 /* "xShmUnmap" */, Fmask: TESTVFS_SHMCLOSE_MASK},
 80247  	{FzName: ts + 35883 /* "xShmMap" */, Fmask: TESTVFS_SHMMAP_MASK},
 80248  	{FzName: ts + 28129 /* "xSync" */, Fmask: TESTVFS_SYNC_MASK},
 80249  	{FzName: ts + 35790 /* "xDelete" */, Fmask: TESTVFS_DELETE_MASK},
 80250  	{FzName: ts + 35698 /* "xWrite" */, Fmask: TESTVFS_WRITE_MASK},
 80251  	{FzName: ts + 35692 /* "xRead" */, Fmask: TESTVFS_READ_MASK},
 80252  	{FzName: ts + 35705 /* "xTruncate" */, Fmask: TESTVFS_TRUNCATE_MASK},
 80253  	{FzName: ts + 27701 /* "xOpen" */, Fmask: TESTVFS_OPEN_MASK},
 80254  	{FzName: ts + 35685 /* "xClose" */, Fmask: TESTVFS_CLOSE_MASK},
 80255  	{FzName: ts + 35798 /* "xAccess" */, Fmask: TESTVFS_ACCESS_MASK},
 80256  	{FzName: ts + 35806 /* "xFullPathname" */, Fmask: TESTVFS_FULLPATHNAME_MASK},
 80257  	{FzName: ts + 35731 /* "xUnlock" */, Fmask: TESTVFS_UNLOCK_MASK},
 80258  	{FzName: ts + 35725 /* "xLock" */, Fmask: TESTVFS_LOCK_MASK},
 80259  	{FzName: ts + 38725 /* "xCheckReservedLo..." */, Fmask: TESTVFS_CKLOCK_MASK},
 80260  	{FzName: ts + 35753 /* "xFileControl" */, Fmask: TESTVFS_FCNTL_MASK},
 80261  } /* test_vfs.c:1182:9 */
 80262  
 80263  func testvfs_obj_del(tls *libc.TLS, cd ClientData) { /* test_vfs.c:1393:27: */
 80264  	var p uintptr = cd
 80265  	if (*Testvfs)(unsafe.Pointer(p)).FpScript != 0 {
 80266  		for ok := true; ok; ok = 0 != 0 {
 80267  			var _objPtr uintptr = (*Testvfs)(unsafe.Pointer(p)).FpScript
 80268  			if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80269  				tcl.XTclFreeObj(tls, _objPtr)
 80270  			}
 80271  		}
 80272  	}
 80273  	sqlite3.Xsqlite3_vfs_unregister(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs)
 80274  	libc.Xmemset(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs, 0, uint32(unsafe.Sizeof(sqlite3_vfs{})))
 80275  	tcl.XTcl_Free(tls, (*Testvfs)(unsafe.Pointer(p)).FpVfs)
 80276  	libc.Xmemset(tls, p, 0, uint32(unsafe.Sizeof(Testvfs{})))
 80277  	tcl.XTcl_Free(tls, p)
 80278  }
 80279  
 80280  // Usage:  testvfs VFSNAME ?SWITCHES?
 80281  //
 80282  // Switches are:
 80283  //
 80284  //   -noshm   BOOLEAN             (True to omit shm methods. Default false)
 80285  //   -default BOOLEAN             (True to make the vfs default. Default false)
 80286  //
 80287  // This command creates two things when it is invoked: an SQLite VFS, and
 80288  // a Tcl command. Both are named VFSNAME. The VFS is installed. It is not
 80289  // installed as the default VFS.
 80290  //
 80291  // The VFS passes all file I/O calls through to the underlying VFS.
 80292  //
 80293  // Whenever the xShmMap method of the VFS
 80294  // is invoked, the SCRIPT is executed as follows:
 80295  //
 80296  //   SCRIPT xShmMap    FILENAME ID
 80297  //
 80298  // The value returned by the invocation of SCRIPT above is interpreted as
 80299  // an SQLite error code and returned to SQLite. Either a symbolic
 80300  // "SQLITE_OK" or numeric "0" value may be returned.
 80301  //
 80302  // The contents of the shared-memory buffer associated with a given file
 80303  // may be read and set using the following command:
 80304  //
 80305  //   VFSNAME shm FILENAME ?NEWVALUE?
 80306  //
 80307  // When the xShmLock method is invoked by SQLite, the following script is
 80308  // run:
 80309  //
 80310  //   SCRIPT xShmLock    FILENAME ID LOCK
 80311  //
 80312  // where LOCK is of the form "OFFSET NBYTE lock/unlock shared/exclusive"
 80313  func testvfs_cmd(tls *libc.TLS, cd ClientData, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1438:26: */
 80314  	bp := tls.Alloc(28)
 80315  	defer tls.Free(28)
 80316  
 80317  	var p uintptr    // New object
 80318  	var pVfs uintptr // New VFS
 80319  	var zVfs uintptr
 80320  	var nByte int32 // Bytes of space to allocate at p
 80321  
 80322  	var i int32
 80323  	// var isNoshm int32 at bp+4, 4
 80324  	// True if -noshm is passed
 80325  	// var isFullshm int32 at bp+24, 4
 80326  	// True if -fullshm is passed
 80327  	// var isDefault int32 at bp+8, 4
 80328  	// True if -default is passed
 80329  	// var szOsFile int32 at bp+12, 4
 80330  	// Value passed to -szosfile
 80331  	// var mxPathname int32 at bp+16, 4
 80332  	// Value passed to -mxpathname
 80333  	// var iVersion int32 at bp+20, 4
 80334  
 80335  	// var nSwitch int32 at bp, 4
 80336  
 80337  	var zSwitch uintptr
 80338  	*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) = 0
 80339  	*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) = 0
 80340  	*(*int32)(unsafe.Pointer(bp + 8 /* isDefault */)) = 0
 80341  	*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */)) = 0
 80342  	*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) = -1
 80343  	*(*int32)(unsafe.Pointer(bp + 20 /* iVersion */)) = 3 // Value passed to -iversion
 80344  
 80345  	if !((objc < 2) || (0 != (objc % 2))) {
 80346  		goto __1
 80347  	}
 80348  	goto bad_args
 80349  __1:
 80350  	;
 80351  	i = 2
 80352  __2:
 80353  	if !(i < objc) {
 80354  		goto __4
 80355  	}
 80356  	zSwitch = tcl.XTcl_GetStringFromObj(tls, *(*uintptr)(unsafe.Pointer(objv + uintptr(i)*4)), bp /* &nSwitch */)
 80357  
 80358  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39132 /* "-noshm" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80359  		goto __5
 80360  	}
 80361  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+4 /* &isNoshm */) != 0) {
 80362  		goto __7
 80363  	}
 80364  	return TCL_ERROR
 80365  __7:
 80366  	;
 80367  	if !(*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) != 0) {
 80368  		goto __8
 80369  	}
 80370  	*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) = 0
 80371  __8:
 80372  	;
 80373  	goto __6
 80374  __5:
 80375  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+27059 /* "-default" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80376  		goto __9
 80377  	}
 80378  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+8 /* &isDefault */) != 0) {
 80379  		goto __11
 80380  	}
 80381  	return TCL_ERROR
 80382  __11:
 80383  	;
 80384  	goto __10
 80385  __9:
 80386  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39139 /* "-szosfile" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80387  		goto __12
 80388  	}
 80389  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+12 /* &szOsFile */) != 0) {
 80390  		goto __14
 80391  	}
 80392  	return TCL_ERROR
 80393  __14:
 80394  	;
 80395  	goto __13
 80396  __12:
 80397  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39149 /* "-mxpathname" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80398  		goto __15
 80399  	}
 80400  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+16 /* &mxPathname */) != 0) {
 80401  		goto __17
 80402  	}
 80403  	return TCL_ERROR
 80404  __17:
 80405  	;
 80406  	goto __16
 80407  __15:
 80408  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39161 /* "-iversion" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80409  		goto __18
 80410  	}
 80411  	if !(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+20 /* &iVersion */) != 0) {
 80412  		goto __20
 80413  	}
 80414  	return TCL_ERROR
 80415  __20:
 80416  	;
 80417  	goto __19
 80418  __18:
 80419  	if !((*(*int32)(unsafe.Pointer(bp /* nSwitch */)) > 2) && (0 == libc.Xstrncmp(tls, ts+39171 /* "-fullshm" */, zSwitch, uint32(*(*int32)(unsafe.Pointer(bp /* nSwitch */)))))) {
 80420  		goto __21
 80421  	}
 80422  	if !(tcl.XTcl_GetBooleanFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + uintptr((i+1))*4)), bp+24 /* &isFullshm */) != 0) {
 80423  		goto __23
 80424  	}
 80425  	return TCL_ERROR
 80426  __23:
 80427  	;
 80428  	if !(*(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */)) != 0) {
 80429  		goto __24
 80430  	}
 80431  	*(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */)) = 0
 80432  __24:
 80433  	;
 80434  	goto __22
 80435  __21:
 80436  	goto bad_args
 80437  __22:
 80438  	;
 80439  __19:
 80440  	;
 80441  __16:
 80442  	;
 80443  __13:
 80444  	;
 80445  __10:
 80446  	;
 80447  __6:
 80448  	;
 80449  	goto __3
 80450  __3:
 80451  	i = i + (2)
 80452  	goto __2
 80453  	goto __4
 80454  __4:
 80455  	;
 80456  
 80457  	if !(uint32(*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */))) < uint32(unsafe.Sizeof(TestvfsFile{}))) {
 80458  		goto __25
 80459  	}
 80460  	*(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */)) = int32(unsafe.Sizeof(TestvfsFile{}))
 80461  __25:
 80462  	;
 80463  
 80464  	zVfs = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4)))
 80465  	nByte = (int32((uint32(unsafe.Sizeof(Testvfs{})) + uint32(int32(libc.Xstrlen(tls, zVfs)))) + uint32(1)))
 80466  	p = tcl.XTcl_Alloc(tls, uint32(nByte))
 80467  	libc.Xmemset(tls, p, 0, uint32(nByte))
 80468  	(*Testvfs)(unsafe.Pointer(p)).FiDevchar = -1
 80469  	(*Testvfs)(unsafe.Pointer(p)).FiSectorsize = -1
 80470  
 80471  	// Create the new object command before querying SQLite for a default VFS
 80472  	// to use for 'real' IO operations. This is because creating the new VFS
 80473  	// may delete an existing [testvfs] VFS of the same name. If such a VFS
 80474  	// is currently the default, the new [testvfs] may end up calling the
 80475  	// methods of a deleted object.
 80476  	tcl.XTcl_CreateObjCommand(tls, interp, zVfs, *(*uintptr)(unsafe.Pointer(&struct {
 80477  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 80478  	}{testvfs_obj_cmd})), p, *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, ClientData) }{testvfs_obj_del})))
 80479  	(*Testvfs)(unsafe.Pointer(p)).FpParent = sqlite3.Xsqlite3_vfs_find(tls, uintptr(0))
 80480  	(*Testvfs)(unsafe.Pointer(p)).Finterp = interp
 80481  
 80482  	(*Testvfs)(unsafe.Pointer(p)).FzName = (p + 1*80)
 80483  	libc.Xmemcpy(tls, (*Testvfs)(unsafe.Pointer(p)).FzName, zVfs, (libc.Xstrlen(tls, zVfs) + size_t(1)))
 80484  
 80485  	pVfs = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(sqlite3_vfs{})))
 80486  	libc.Xmemcpy(tls, pVfs, uintptr(unsafe.Pointer(&tvfs_vfs)), uint32(unsafe.Sizeof(sqlite3_vfs{})))
 80487  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FpAppData = p
 80488  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FiVersion = *(*int32)(unsafe.Pointer(bp + 20 /* iVersion */))
 80489  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FzName = (*Testvfs)(unsafe.Pointer(p)).FzName
 80490  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname = (*sqlite3_vfs)(unsafe.Pointer((*Testvfs)(unsafe.Pointer(p)).FpParent)).FmxPathname
 80491  	if !((*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) >= 0) && (*(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */)) < (*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname)) {
 80492  		goto __26
 80493  	}
 80494  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FmxPathname = *(*int32)(unsafe.Pointer(bp + 16 /* mxPathname */))
 80495  __26:
 80496  	;
 80497  	(*sqlite3_vfs)(unsafe.Pointer(pVfs)).FszOsFile = *(*int32)(unsafe.Pointer(bp + 12 /* szOsFile */))
 80498  	(*Testvfs)(unsafe.Pointer(p)).FpVfs = pVfs
 80499  	(*Testvfs)(unsafe.Pointer(p)).FisNoshm = *(*int32)(unsafe.Pointer(bp + 4 /* isNoshm */))
 80500  	(*Testvfs)(unsafe.Pointer(p)).FisFullshm = *(*int32)(unsafe.Pointer(bp + 24 /* isFullshm */))
 80501  	(*Testvfs)(unsafe.Pointer(p)).Fmask = TESTVFS_ALL_MASK
 80502  
 80503  	sqlite3.Xsqlite3_vfs_register(tls, pVfs, *(*int32)(unsafe.Pointer(bp + 8 /* isDefault */)))
 80504  
 80505  	return TCL_OK
 80506  
 80507  bad_args:
 80508  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39180 /* "VFSNAME ?-noshm ..." */)
 80509  	return TCL_ERROR
 80510  }
 80511  
 80512  var tvfs_vfs = sqlite3_vfs{
 80513  	FiVersion:      3, // pAppData
 80514  	FxOpen:         0, // xOpen
 80515  	FxDelete:       0, // xDelete
 80516  	FxAccess:       0, // xAccess
 80517  	FxFullPathname: 0, // xDlClose
 80518  	FxRandomness:   0, // xRandomness
 80519  	FxSleep:        0, // xSleep
 80520  	FxCurrentTime:  0, // xNextSystemCall
 80521  } /* test_vfs.c:1444:22 */
 80522  
 80523  // tclcmd: vfs_shmlock DB DBNAME (shared|exclusive) (lock|unlock) OFFSET N
 80524  func test_vfs_shmlock(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1586:26: */
 80525  	bp := tls.Alloc(48)
 80526  	defer tls.Free(48)
 80527  
 80528  	*(*[3]uintptr)(unsafe.Pointer(bp + 4 /* azArg1 */)) = [3]uintptr{ts + 39284 /* "shared" */, ts + 14439 /* "exclusive" */, uintptr(0)}
 80529  	*(*[3]uintptr)(unsafe.Pointer(bp + 20 /* azArg2 */)) = [3]uintptr{ts + 39291 /* "lock" */, ts + 39296 /* "unlock" */, uintptr(0)}
 80530  	*(*uintptr)(unsafe.Pointer(bp /* db */)) = uintptr(0)
 80531  	var rc int32 = SQLITE_OK
 80532  	var zDbname uintptr = uintptr(0)
 80533  	*(*int32)(unsafe.Pointer(bp + 16 /* iArg1 */)) = 0
 80534  	*(*int32)(unsafe.Pointer(bp + 32 /* iArg2 */)) = 0
 80535  	*(*int32)(unsafe.Pointer(bp + 36 /* iOffset */)) = 0
 80536  	*(*int32)(unsafe.Pointer(bp + 40 /* n */)) = 0
 80537  	// var pFd uintptr at bp+44, 4
 80538  
 80539  	if objc != 7 {
 80540  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv,
 80541  			ts+39303 /* "DB DBNAME (share..." */)
 80542  		return TCL_ERROR
 80543  	}
 80544  
 80545  	zDbname = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 80546  	if ((((getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) ||
 80547  		(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+4 /* &azArg1[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+39355 /* "ARG" */, 0, bp+16 /* &iArg1 */) != 0)) ||
 80548  		(tcl.XTcl_GetIndexFromObjStruct(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+20 /* &azArg2[0] */, int32(unsafe.Sizeof(uintptr(0))), ts+39355 /* "ARG" */, 0, bp+32 /* &iArg2 */) != 0)) ||
 80549  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 5*4)), bp+36 /* &iOffset */) != 0)) ||
 80550  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 6*4)), bp+40 /* &n */) != 0) {
 80551  		return TCL_ERROR
 80552  	}
 80553  
 80554  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zDbname, SQLITE_FCNTL_FILE_POINTER, bp+44 /* &pFd */)
 80555  	if *(*uintptr)(unsafe.Pointer(bp + 44 /* pFd */)) == uintptr(0) {
 80556  		return TCL_ERROR
 80557  	}
 80558  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 44 /* pFd */)))).FpMethods + 56 /* &.xShmLock */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 44 /* pFd */)), *(*int32)(unsafe.Pointer(bp + 36 /* iOffset */)), *(*int32)(unsafe.Pointer(bp + 40 /* n */)),
 80559  		((func() int32 {
 80560  			if *(*int32)(unsafe.Pointer(bp + 16 /* iArg1 */)) == 0 {
 80561  				return SQLITE_SHM_SHARED
 80562  			}
 80563  			return SQLITE_SHM_EXCLUSIVE
 80564  		}()) |
 80565  			(func() int32 {
 80566  				if *(*int32)(unsafe.Pointer(bp + 32 /* iArg2 */)) == 0 {
 80567  					return SQLITE_SHM_LOCK
 80568  				}
 80569  				return SQLITE_SHM_UNLOCK
 80570  			}())))
 80571  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 80572  	return TCL_OK
 80573  }
 80574  
 80575  func test_vfs_set_readmark(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_vfs.c:1632:26: */
 80576  	bp := tls.Alloc(36)
 80577  	defer tls.Free(36)
 80578  
 80579  	*(*uintptr)(unsafe.Pointer(bp + 16 /* db */)) = uintptr(0)
 80580  	var rc int32 = SQLITE_OK
 80581  	var zDbname uintptr = uintptr(0)
 80582  	*(*int32)(unsafe.Pointer(bp + 20 /* iSlot */)) = 0
 80583  	*(*int32)(unsafe.Pointer(bp + 24 /* iVal */)) = -1
 80584  	// var pFd uintptr at bp+28, 4
 80585  
 80586  	*(*uintptr)(unsafe.Pointer(bp + 32 /* pShm */)) = uintptr(0)
 80587  	var aShm uintptr
 80588  	var iOff int32
 80589  
 80590  	if (objc != 4) && (objc != 5) {
 80591  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39359 /* "DB DBNAME SLOT ?..." */)
 80592  		return TCL_ERROR
 80593  	}
 80594  
 80595  	zDbname = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 80596  	if ((getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp+16 /* &db */) != 0) ||
 80597  		(tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 3*4)), bp+20 /* &iSlot */) != 0)) ||
 80598  		((objc == 5) && (tcl.XTcl_GetIntFromObj(tls, interp, *(*uintptr)(unsafe.Pointer(objv + 4*4)), bp+24 /* &iVal */) != 0)) {
 80599  		return TCL_ERROR
 80600  	}
 80601  
 80602  	sqlite3.Xsqlite3_file_control(tls, *(*uintptr)(unsafe.Pointer(bp + 16 /* db */)), zDbname, SQLITE_FCNTL_FILE_POINTER, bp+28 /* &pFd */)
 80603  	if *(*uintptr)(unsafe.Pointer(bp + 28 /* pFd */)) == uintptr(0) {
 80604  		return TCL_ERROR
 80605  	}
 80606  	rc = (*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(((*sqlite3_file)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 28 /* pFd */)))).FpMethods + 52 /* &.xShmMap */))))(tls, *(*uintptr)(unsafe.Pointer(bp + 28 /* pFd */)), 0, (32 * 1024), 0, bp+32 /* &pShm */)
 80607  	if rc != SQLITE_OK {
 80608  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 80609  		return TCL_ERROR
 80610  	}
 80611  	if libc.AtomicLoadPUintptr(bp+32 /* pShm */) == uintptr(0) {
 80612  		tcl.XTcl_AppendResult(tls, interp, libc.VaList(bp, ts+39382 /* "*-shm is not yet..." */, 0))
 80613  		return TCL_ERROR
 80614  	}
 80615  	aShm = libc.AtomicLoadPUintptr(bp + 32 /* pShm */)
 80616  	iOff = (((12 * 2) + 1) + *(*int32)(unsafe.Pointer(bp + 20 /* iSlot */)))
 80617  
 80618  	if objc == 5 {
 80619  		*(*u32)(unsafe.Pointer(aShm + uintptr(iOff)*4)) = u32(*(*int32)(unsafe.Pointer(bp + 24 /* iVal */)))
 80620  	}
 80621  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewIntObj(tls, int32(*(*u32)(unsafe.Pointer(aShm + uintptr(iOff)*4)))))
 80622  
 80623  	return TCL_OK
 80624  }
 80625  
 80626  func Sqlitetestvfs_Init(tls *libc.TLS, interp uintptr) int32 { /* test_vfs.c:1685:5: */
 80627  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39406 /* "testvfs" */, *(*uintptr)(unsafe.Pointer(&struct {
 80628  		f func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32
 80629  	}{testvfs_cmd})), uintptr(0), uintptr(0))
 80630  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39414 /* "vfs_shmlock" */, *(*uintptr)(unsafe.Pointer(&struct {
 80631  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 80632  	}{test_vfs_shmlock})), uintptr(0), uintptr(0))
 80633  	tcl.XTcl_CreateObjCommand(tls, interp, ts+39426 /* "vfs_set_readmark" */, *(*uintptr)(unsafe.Pointer(&struct {
 80634  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 80635  	}{test_vfs_set_readmark})), uintptr(0), uintptr(0))
 80636  	return TCL_OK
 80637  }
 80638  
 80639  // 2015 November 30
 80640  //
 80641  // The author disclaims copyright to this source code.  In place of
 80642  // a legal notice, here is a blessing:
 80643  //
 80644  //    May you do good and not evil.
 80645  //    May you find forgiveness for yourself and forgive others.
 80646  //    May you share freely, never taking more than you give.
 80647  //
 80648  //
 80649  // This file contains code to implement most of the opendir() family of
 80650  // POSIX functions on Win32 using the MSVCRT.
 80651  
 80652  type TestWindow1 = struct {
 80653  	FxStep    uintptr
 80654  	FxFinal   uintptr
 80655  	FxValue   uintptr
 80656  	FxInverse uintptr
 80657  	Finterp   uintptr
 80658  } /* test_window.c:24:9 */
 80659  
 80660  type TestWindow = TestWindow1 /* test_window.c:24:27 */
 80661  
 80662  type TestWindowCtx1 = struct{ FpVal uintptr } /* test_window.c:33:9 */
 80663  
 80664  type TestWindowCtx = TestWindowCtx1 /* test_window.c:33:30 */
 80665  
 80666  func doTestWindowStep(tls *libc.TLS, bInverse int32, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:38:13: */
 80667  	var i int32
 80668  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, ctx)
 80669  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, func() uintptr {
 80670  		if bInverse != 0 {
 80671  			return (*TestWindow)(unsafe.Pointer(p)).FxInverse
 80672  		}
 80673  		return (*TestWindow)(unsafe.Pointer(p)).FxStep
 80674  	}())
 80675  	var pCtx uintptr = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(TestWindowCtx{})))
 80676  
 80677  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 80678  	if pCtx != 0 {
 80679  		var zResult uintptr
 80680  		var rc int32
 80681  		if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 80682  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_DuplicateObj(tls, (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal))
 80683  		} else {
 80684  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 80685  		}
 80686  		for i = 0; i < nArg; i++ {
 80687  			var pArg uintptr
 80688  			pArg = tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3_value_text(tls, *(*uintptr)(unsafe.Pointer(apArg + uintptr(i)*4))), -1)
 80689  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, pArg)
 80690  		}
 80691  		rc = tcl.XTcl_EvalObjEx(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 80692  		if rc != TCL_OK {
 80693  			zResult = tcl.XTcl_GetStringResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp)
 80694  			sqlite3.Xsqlite3_result_error(tls, ctx, zResult, -1)
 80695  		} else {
 80696  			if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 80697  				for ok := true; ok; ok = 0 != 0 {
 80698  					var _objPtr uintptr = (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal
 80699  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80700  						tcl.XTclFreeObj(tls, _objPtr)
 80701  					}
 80702  				}
 80703  			}
 80704  			(*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal = tcl.XTcl_DuplicateObj(tls, tcl.XTcl_GetObjResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp))
 80705  			(*Tcl_Obj)(unsafe.Pointer((*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal)).FrefCount++
 80706  		}
 80707  	}
 80708  	for ok1 := true; ok1; ok1 = 0 != 0 {
 80709  		var _objPtr uintptr = pEval
 80710  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80711  			tcl.XTclFreeObj(tls, _objPtr)
 80712  		}
 80713  	}
 80714  }
 80715  
 80716  func doTestWindowFinalize(tls *libc.TLS, bValue int32, ctx uintptr) { /* test_window.c:76:13: */
 80717  	var p uintptr = sqlite3.Xsqlite3_user_data(tls, ctx)
 80718  	var pEval uintptr = tcl.XTcl_DuplicateObj(tls, func() uintptr {
 80719  		if bValue != 0 {
 80720  			return (*TestWindow)(unsafe.Pointer(p)).FxValue
 80721  		}
 80722  		return (*TestWindow)(unsafe.Pointer(p)).FxFinal
 80723  	}())
 80724  	var pCtx uintptr = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(TestWindowCtx{})))
 80725  
 80726  	(*Tcl_Obj)(unsafe.Pointer(pEval)).FrefCount++
 80727  	if pCtx != 0 {
 80728  		var zResult uintptr
 80729  		var rc int32
 80730  		if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 80731  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_DuplicateObj(tls, (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal))
 80732  		} else {
 80733  			tcl.XTcl_ListObjAppendElement(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, tcl.XTcl_NewStringObj(tls, ts+489 /* "" */, -1))
 80734  		}
 80735  
 80736  		rc = tcl.XTcl_EvalObjEx(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp, pEval, TCL_EVAL_GLOBAL)
 80737  		zResult = tcl.XTcl_GetStringResult(tls, (*TestWindow)(unsafe.Pointer(p)).Finterp)
 80738  		if rc != TCL_OK {
 80739  			sqlite3.Xsqlite3_result_error(tls, ctx, zResult, -1)
 80740  		} else {
 80741  			sqlite3.Xsqlite3_result_text(tls, ctx, zResult, -1, libc.UintptrFromInt32(-1))
 80742  		}
 80743  
 80744  		if bValue == 0 {
 80745  			if (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal != 0 {
 80746  				for ok := true; ok; ok = 0 != 0 {
 80747  					var _objPtr uintptr = (*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal
 80748  					if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80749  						tcl.XTclFreeObj(tls, _objPtr)
 80750  					}
 80751  				}
 80752  			}
 80753  			(*TestWindowCtx)(unsafe.Pointer(pCtx)).FpVal = uintptr(0)
 80754  		}
 80755  	}
 80756  	for ok1 := true; ok1; ok1 = 0 != 0 {
 80757  		var _objPtr uintptr = pEval
 80758  		if libc.PostDecInt32(&(*Tcl_Obj)(unsafe.Pointer((_objPtr))).FrefCount, 1) <= 1 {
 80759  			tcl.XTclFreeObj(tls, _objPtr)
 80760  		}
 80761  	}
 80762  }
 80763  
 80764  func testWindowStep(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:107:13: */
 80765  	doTestWindowStep(tls, 0, ctx, nArg, apArg)
 80766  }
 80767  
 80768  func testWindowInverse(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:114:13: */
 80769  	doTestWindowStep(tls, 1, ctx, nArg, apArg)
 80770  }
 80771  
 80772  func testWindowFinal(tls *libc.TLS, ctx uintptr) { /* test_window.c:122:13: */
 80773  	doTestWindowFinalize(tls, 0, ctx)
 80774  }
 80775  
 80776  func testWindowValue(tls *libc.TLS, ctx uintptr) { /* test_window.c:125:13: */
 80777  	doTestWindowFinalize(tls, 1, ctx)
 80778  }
 80779  
 80780  func testWindowDestroy(tls *libc.TLS, pCtx uintptr) { /* test_window.c:129:13: */
 80781  	tcl.XTcl_Free(tls, pCtx)
 80782  }
 80783  
 80784  // Usage: sqlite3_create_window_function DB NAME XSTEP XFINAL XVALUE XINVERSE
 80785  func test_create_window(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:136:26: */
 80786  	bp := tls.Alloc(4)
 80787  	defer tls.Free(4)
 80788  
 80789  	var pNew uintptr
 80790  	// var db uintptr at bp, 4
 80791  
 80792  	var zName uintptr
 80793  	var rc int32
 80794  
 80795  	if objc != 7 {
 80796  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+39443 /* "DB NAME XSTEP XF..." */)
 80797  		return TCL_ERROR
 80798  	}
 80799  
 80800  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 80801  		return TCL_ERROR
 80802  	}
 80803  	zName = tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 2*4)))
 80804  	pNew = tcl.XTcl_Alloc(tls, uint32(unsafe.Sizeof(TestWindow{})))
 80805  	libc.Xmemset(tls, pNew, 0, uint32(unsafe.Sizeof(TestWindow{})))
 80806  	(*TestWindow)(unsafe.Pointer(pNew)).FxStep = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 3*4)))
 80807  	(*TestWindow)(unsafe.Pointer(pNew)).FxFinal = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 4*4)))
 80808  	(*TestWindow)(unsafe.Pointer(pNew)).FxValue = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 5*4)))
 80809  	(*TestWindow)(unsafe.Pointer(pNew)).FxInverse = tcl.XTcl_DuplicateObj(tls, *(*uintptr)(unsafe.Pointer(objv + 6*4)))
 80810  	(*TestWindow)(unsafe.Pointer(pNew)).Finterp = interp
 80811  
 80812  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxStep)).FrefCount++
 80813  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxFinal)).FrefCount++
 80814  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxValue)).FrefCount++
 80815  	(*Tcl_Obj)(unsafe.Pointer((*TestWindow)(unsafe.Pointer(pNew)).FxInverse)).FrefCount++
 80816  
 80817  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), zName, -1, SQLITE_UTF8, pNew,
 80818  		*(*uintptr)(unsafe.Pointer(&struct {
 80819  			f func(*libc.TLS, uintptr, int32, uintptr)
 80820  		}{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 {
 80821  			f func(*libc.TLS, uintptr, int32, uintptr)
 80822  		}{testWindowInverse})),
 80823  		*(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowDestroy})))
 80824  	if rc != SQLITE_OK {
 80825  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 80826  		return TCL_ERROR
 80827  	}
 80828  
 80829  	return TCL_OK
 80830  }
 80831  
 80832  func test_create_window_misuse(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:179:26: */
 80833  	bp := tls.Alloc(4)
 80834  	defer tls.Free(4)
 80835  
 80836  	// var db uintptr at bp, 4
 80837  
 80838  	var rc int32
 80839  
 80840  	if !(objc != 2) {
 80841  		goto __1
 80842  	}
 80843  	tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 80844  	return TCL_ERROR
 80845  __1:
 80846  	;
 80847  	if !(getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0) {
 80848  		goto __2
 80849  	}
 80850  	return TCL_ERROR
 80851  __2:
 80852  	;
 80853  
 80854  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 80855  		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 {
 80856  			f func(*libc.TLS, uintptr, int32, uintptr)
 80857  		}{testWindowInverse})),
 80858  		uintptr(0))
 80859  	if !(rc != SQLITE_MISUSE) {
 80860  		goto __3
 80861  	}
 80862  	goto error
 80863  __3:
 80864  	;
 80865  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 80866  		*(*uintptr)(unsafe.Pointer(&struct {
 80867  			f func(*libc.TLS, uintptr, int32, uintptr)
 80868  		}{testWindowStep})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), *(*uintptr)(unsafe.Pointer(&struct {
 80869  			f func(*libc.TLS, uintptr, int32, uintptr)
 80870  		}{testWindowInverse})),
 80871  		uintptr(0))
 80872  	if !(rc != SQLITE_MISUSE) {
 80873  		goto __4
 80874  	}
 80875  	goto error
 80876  __4:
 80877  	;
 80878  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 80879  		*(*uintptr)(unsafe.Pointer(&struct {
 80880  			f func(*libc.TLS, uintptr, int32, uintptr)
 80881  		}{testWindowStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 80882  			f func(*libc.TLS, uintptr, int32, uintptr)
 80883  		}{testWindowInverse})),
 80884  		uintptr(0))
 80885  	if !(rc != SQLITE_MISUSE) {
 80886  		goto __5
 80887  	}
 80888  	goto error
 80889  __5:
 80890  	;
 80891  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39480 /* "fff" */, -1, SQLITE_UTF8, uintptr(0),
 80892  		*(*uintptr)(unsafe.Pointer(&struct {
 80893  			f func(*libc.TLS, uintptr, int32, uintptr)
 80894  		}{testWindowStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowFinal})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{testWindowValue})), uintptr(0),
 80895  		uintptr(0))
 80896  	if !(rc != SQLITE_MISUSE) {
 80897  		goto __6
 80898  	}
 80899  	goto error
 80900  __6:
 80901  	;
 80902  
 80903  	return TCL_OK
 80904  
 80905  error:
 80906  	tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, ts+39484 /* "misuse test erro..." */, -1))
 80907  	return TCL_ERROR
 80908  }
 80909  
 80910  // xStep for sumint().
 80911  func sumintStep(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:225:13: */
 80912  	var pInt uintptr
 80913  
 80914  	if sqlite3.Xsqlite3_value_type(tls, *(*uintptr)(unsafe.Pointer(apArg))) != SQLITE_INTEGER {
 80915  		sqlite3.Xsqlite3_result_error(tls, ctx, ts+39502 /* "invalid argument" */, -1)
 80916  		return
 80917  	}
 80918  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(sqlite3_int64(0))))
 80919  	if pInt != 0 {
 80920  		*(*sqlite3_int64)(unsafe.Pointer(pInt)) += (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))))
 80921  	}
 80922  }
 80923  
 80924  // xInverse for sumint().
 80925  func sumintInverse(tls *libc.TLS, ctx uintptr, nArg int32, apArg uintptr) { /* test_window.c:246:13: */
 80926  	var pInt uintptr
 80927  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, int32(unsafe.Sizeof(sqlite3_int64(0))))
 80928  	*(*sqlite3_int64)(unsafe.Pointer(pInt)) -= (sqlite3.Xsqlite3_value_int64(tls, *(*uintptr)(unsafe.Pointer(apArg))))
 80929  }
 80930  
 80931  // xFinal for sumint().
 80932  func sumintFinal(tls *libc.TLS, ctx uintptr) { /* test_window.c:259:13: */
 80933  	var res sqlite3_int64 = int64(0)
 80934  	var pInt uintptr
 80935  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, 0)
 80936  	if pInt != 0 {
 80937  		res = *(*sqlite3_int64)(unsafe.Pointer(pInt))
 80938  	}
 80939  	sqlite3.Xsqlite3_result_int64(tls, ctx, res)
 80940  }
 80941  
 80942  // xValue for sumint().
 80943  func sumintValue(tls *libc.TLS, ctx uintptr) { /* test_window.c:270:13: */
 80944  	var res sqlite3_int64 = int64(0)
 80945  	var pInt uintptr
 80946  	pInt = sqlite3.Xsqlite3_aggregate_context(tls, ctx, 0)
 80947  	if pInt != 0 {
 80948  		res = *(*sqlite3_int64)(unsafe.Pointer(pInt))
 80949  	}
 80950  	sqlite3.Xsqlite3_result_int64(tls, ctx, res)
 80951  }
 80952  
 80953  func test_create_sumint(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:278:26: */
 80954  	bp := tls.Alloc(4)
 80955  	defer tls.Free(4)
 80956  
 80957  	// var db uintptr at bp, 4
 80958  
 80959  	var rc int32
 80960  
 80961  	if objc != 2 {
 80962  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 80963  		return TCL_ERROR
 80964  	}
 80965  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 80966  		return TCL_ERROR
 80967  	}
 80968  
 80969  	rc = sqlite3.Xsqlite3_create_window_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39519 /* "sumint" */, 1, SQLITE_UTF8, uintptr(0),
 80970  		*(*uintptr)(unsafe.Pointer(&struct {
 80971  			f func(*libc.TLS, uintptr, int32, uintptr)
 80972  		}{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 {
 80973  			f func(*libc.TLS, uintptr, int32, uintptr)
 80974  		}{sumintInverse})),
 80975  		uintptr(0))
 80976  
 80977  	if rc != SQLITE_OK {
 80978  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 80979  		return TCL_ERROR
 80980  	}
 80981  	return TCL_OK
 80982  }
 80983  
 80984  func test_override_sum(tls *libc.TLS, clientData uintptr, interp uintptr, objc int32, objv uintptr) int32 { /* test_window.c:305:26: */
 80985  	bp := tls.Alloc(4)
 80986  	defer tls.Free(4)
 80987  
 80988  	// var db uintptr at bp, 4
 80989  
 80990  	var rc int32
 80991  
 80992  	if objc != 2 {
 80993  		tcl.XTcl_WrongNumArgs(tls, interp, 1, objv, ts+1911 /* "DB" */)
 80994  		return TCL_ERROR
 80995  	}
 80996  	if getDbPointer(tls, interp, tcl.XTcl_GetString(tls, *(*uintptr)(unsafe.Pointer(objv + 1*4))), bp /* &db */) != 0 {
 80997  		return TCL_ERROR
 80998  	}
 80999  
 81000  	rc = sqlite3.Xsqlite3_create_function(tls, *(*uintptr)(unsafe.Pointer(bp /* db */)), ts+39526 /* "sum" */, -1, SQLITE_UTF8, uintptr(0),
 81001  		uintptr(0), *(*uintptr)(unsafe.Pointer(&struct {
 81002  			f func(*libc.TLS, uintptr, int32, uintptr)
 81003  		}{sumintStep})), *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, uintptr) }{sumintFinal})))
 81004  
 81005  	if rc != SQLITE_OK {
 81006  		tcl.XTcl_SetObjResult(tls, interp, tcl.XTcl_NewStringObj(tls, sqlite3.Xsqlite3ErrName(tls, rc), -1))
 81007  		return TCL_ERROR
 81008  	}
 81009  	return TCL_OK
 81010  }
 81011  
 81012  func Sqlitetest_window_Init(tls *libc.TLS, interp uintptr) int32 { /* test_window.c:331:5: */
 81013  	var i int32
 81014  	for i = 0; uint32(i) < (uint32(unsafe.Sizeof(aObjCmd14)) / uint32(unsafe.Sizeof(struct {
 81015  		FzName      uintptr
 81016  		FxProc      uintptr
 81017  		FclientData int32
 81018  	}{}))); i++ {
 81019  		var c ClientData = uintptr(aObjCmd14[i].FclientData)
 81020  		tcl.XTcl_CreateObjCommand(tls, interp, aObjCmd14[i].FzName, aObjCmd14[i].FxProc, c, uintptr(0))
 81021  	}
 81022  	return TCL_OK
 81023  }
 81024  
 81025  var aObjCmd14 = [4]struct {
 81026  	FzName      uintptr
 81027  	FxProc      uintptr
 81028  	FclientData int32
 81029  }{
 81030  	{FzName: ts + 39530 /* "sqlite3_create_w..." */, FxProc: 0},
 81031  	{FzName: ts + 39561 /* "test_create_wind..." */, FxProc: 0},
 81032  	{FzName: ts + 39596 /* "test_create_sumi..." */, FxProc: 0},
 81033  	{FzName: ts + 39615 /* "test_override_su..." */, FxProc: 0},
 81034  } /* test_window.c:336:5 */
 81035  
 81036  // 2008 September 1
 81037  //
 81038  // The author disclaims copyright to this source code.  In place of
 81039  // a legal notice, here is a blessing:
 81040  //
 81041  //    May you do good and not evil.
 81042  //    May you find forgiveness for yourself and forgive others.
 81043  //    May you share freely, never taking more than you give.
 81044  //
 81045  //
 81046  //
 81047  // The code in this file contains sample implementations of the
 81048  // sqlite3_wsd_init() and sqlite3_wsd_find() functions required if the
 81049  // SQLITE_OMIT_WSD symbol is defined at build time.
 81050  
 81051  func init() {
 81052  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 4 /* .xClose */)) = cfClose                                                         // test6.c:577:3:
 81053  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 8 /* .xRead */)) = cfRead                             // test6.c:578:3:
 81054  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 12 /* .xWrite */)) = cfWrite                          // test6.c:579:3:
 81055  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 16 /* .xTruncate */)) = cfTruncate                                    // test6.c:580:3:
 81056  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 20 /* .xSync */)) = cfSync                                                   // test6.c:581:3:
 81057  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 24 /* .xFileSize */)) = cfFileSize                                         // test6.c:582:3:
 81058  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 28 /* .xLock */)) = cfLock                                                   // test6.c:583:3:
 81059  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 32 /* .xUnlock */)) = cfUnlock                                               // test6.c:584:3:
 81060  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 36 /* .xCheckReservedLock */)) = cfCheckReservedLock                       // test6.c:585:3:
 81061  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 40 /* .xFileControl */)) = cfFileControl                            // test6.c:586:3:
 81062  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 44 /* .xSectorSize */)) = cfSectorSize                                              // test6.c:587:3:
 81063  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 48 /* .xDeviceCharacteristics */)) = cfDeviceCharacteristics                        // test6.c:588:3:
 81064  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 52 /* .xShmMap */)) = cfShmMap                        // test6.c:589:3:
 81065  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 56 /* .xShmLock */)) = cfShmLock                               // test6.c:590:3:
 81066  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 60 /* .xShmBarrier */)) = cfShmBarrier                                                    // test6.c:591:3:
 81067  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CrashFileVtab)) + 64 /* .xShmUnmap */)) = cfShmUnmap                                           // test6.c:592:3:
 81068  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 4 /* .xCreate */)) = csvtabCreate            // csv.c:874:3:
 81069  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 8 /* .xConnect */)) = csvtabConnect          // csv.c:875:3:
 81070  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 12 /* .xBestIndex */)) = csvtabBestIndex                                       // csv.c:876:3:
 81071  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 16 /* .xDisconnect */)) = csvtabDisconnect                                              // csv.c:877:3:
 81072  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 20 /* .xDestroy */)) = csvtabDisconnect                                                 // csv.c:878:3:
 81073  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 24 /* .xOpen */)) = csvtabOpen                                                 // csv.c:879:3:
 81074  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 28 /* .xClose */)) = csvtabClose                                                        // csv.c:880:3:
 81075  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 32 /* .xFilter */)) = csvtabFilter                      // csv.c:881:3:
 81076  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 36 /* .xNext */)) = csvtabNext                                                          // csv.c:882:3:
 81077  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 40 /* .xEof */)) = csvtabEof                                                            // csv.c:883:3:
 81078  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 44 /* .xColumn */)) = csvtabColumn                                      // csv.c:884:3:
 81079  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModule)) + 48 /* .xRowid */)) = csvtabRowid                                               // csv.c:885:3:
 81080  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 4 /* .xCreate */)) = csvtabCreate   // csv.c:906:3:
 81081  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 8 /* .xConnect */)) = csvtabConnect // csv.c:907:3:
 81082  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 12 /* .xBestIndex */)) = csvtabBestIndex                              // csv.c:908:3:
 81083  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 16 /* .xDisconnect */)) = csvtabDisconnect                                     // csv.c:909:3:
 81084  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 20 /* .xDestroy */)) = csvtabDisconnect                                        // csv.c:910:3:
 81085  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 24 /* .xOpen */)) = csvtabOpen                                        // csv.c:911:3:
 81086  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 28 /* .xClose */)) = csvtabClose                                               // csv.c:912:3:
 81087  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 32 /* .xFilter */)) = csvtabFilter             // csv.c:913:3:
 81088  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 36 /* .xNext */)) = csvtabNext                                                 // csv.c:914:3:
 81089  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 40 /* .xEof */)) = csvtabEof                                                   // csv.c:915:3:
 81090  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 44 /* .xColumn */)) = csvtabColumn                             // csv.c:916:3:
 81091  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 48 /* .xRowid */)) = csvtabRowid                                      // csv.c:917:3:
 81092  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&CsvModuleFauxWrite)) + 52 /* .xUpdate */)) = csvtabUpdate                    // csv.c:918:3:
 81093  	*(*func(*libc.TLS, ClientData, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 8 /* .closeProc */)) = incrblobClose                              // tclsqlite.c:372:3:
 81094  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 12 /* .inputProc */)) = incrblobInput             // tclsqlite.c:373:3:
 81095  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 16 /* .outputProc */)) = incrblobOutput           // tclsqlite.c:374:3:
 81096  	*(*func(*libc.TLS, ClientData, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 20 /* .seekProc */)) = incrblobSeek                 // tclsqlite.c:375:3:
 81097  	*(*func(*libc.TLS, ClientData, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 32 /* .watchProc */)) = incrblobWatch                                     // tclsqlite.c:378:3:
 81098  	*(*func(*libc.TLS, ClientData, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&IncrblobChannelType)) + 36 /* .getHandleProc */)) = incrblobHandle                 // tclsqlite.c:379:3:
 81099  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 4 /* .xProc */)) = f5tCreateTokenizer                            // fts5_tcl.c:1129:42:
 81100  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 16 /* .xProc */)) = f5tTokenizerReturn                              // fts5_tcl.c:1130:42:
 81101  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 28 /* .xProc */)) = f5tTokenize                                     // fts5_tcl.c:1131:42:
 81102  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 40 /* .xProc */)) = f5tCreateFunction                               // fts5_tcl.c:1132:42:
 81103  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 52 /* .xProc */)) = f5tMayBeCorrupt                                 // fts5_tcl.c:1133:42:
 81104  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 64 /* .xProc */)) = f5tTokenHash                                    // fts5_tcl.c:1134:42:
 81105  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 76 /* .xProc */)) = f5tRegisterMatchinfo                            // fts5_tcl.c:1135:42:
 81106  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd)) + 88 /* .xProc */)) = f5tRegisterTok                                  // fts5_tcl.c:1136:45:
 81107  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81108  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81109  	}{db_enter})) // test1.c:8289:41:
 81110  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81111  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81112  	}{db_leave})) // test1.c:8290:41:
 81113  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81114  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81115  	}{sqlite3_mprintf_int})) // test1.c:8291:41:
 81116  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81117  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81118  	}{sqlite3_mprintf_int64})) // test1.c:8292:41:
 81119  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81120  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81121  	}{sqlite3_mprintf_long})) // test1.c:8293:41:
 81122  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81123  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81124  	}{sqlite3_mprintf_str})) // test1.c:8294:41:
 81125  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81126  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81127  	}{sqlite3_snprintf_str})) // test1.c:8295:41:
 81128  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81129  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81130  	}{sqlite3_mprintf_stronly})) // test1.c:8296:41:
 81131  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81132  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81133  	}{sqlite3_mprintf_double})) // test1.c:8297:41:
 81134  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81135  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81136  	}{sqlite3_mprintf_scaled})) // test1.c:8298:41:
 81137  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81138  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81139  	}{sqlite3_mprintf_hexdouble})) // test1.c:8299:39:
 81140  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 92 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81141  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81142  	}{test_mprintf_z})) // test1.c:8300:41:
 81143  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 100 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81144  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81145  	}{test_mprintf_n})) // test1.c:8301:41:
 81146  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 108 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81147  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81148  	}{test_snprintf_int})) // test1.c:8302:41:
 81149  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 116 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81150  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81151  	}{test_last_rowid})) // test1.c:8303:41:
 81152  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 124 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81153  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81154  	}{test_exec_printf})) // test1.c:8304:41:
 81155  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 132 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81156  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81157  	}{test_exec_hex})) // test1.c:8305:41:
 81158  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 140 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81159  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81160  	}{test_exec})) // test1.c:8306:41:
 81161  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 148 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81162  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81163  	}{test_exec_nr})) // test1.c:8307:41:
 81164  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 156 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81165  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81166  	}{test_get_table_printf})) // test1.c:8309:41:
 81167  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 164 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81168  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81169  	}{sqlite_test_close})) // test1.c:8311:41:
 81170  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 172 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81171  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81172  	}{sqlite_test_close_v2})) // test1.c:8312:41:
 81173  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 180 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81174  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81175  	}{test_create_function})) // test1.c:8313:41:
 81176  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 188 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81177  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81178  	}{test_create_aggregate})) // test1.c:8314:41:
 81179  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 196 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81180  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81181  	}{test_drop_modules})) // test1.c:8315:41:
 81182  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 204 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81183  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81184  	}{test_register_func})) // test1.c:8316:41:
 81185  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 212 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81186  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81187  	}{sqlite_abort})) // test1.c:8317:41:
 81188  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 220 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81189  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81190  	}{test_bind})) // test1.c:8318:41:
 81191  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 228 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81192  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81193  	}{test_breakpoint})) // test1.c:8319:41:
 81194  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 236 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81195  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81196  	}{test_key})) // test1.c:8320:41:
 81197  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 244 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81198  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81199  	}{test_rekey})) // test1.c:8321:41:
 81200  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 252 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81201  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81202  	}{sqlite_set_magic})) // test1.c:8322:41:
 81203  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 260 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81204  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81205  	}{test_interrupt})) // test1.c:8323:41:
 81206  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 268 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81207  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81208  	}{delete_function})) // test1.c:8324:41:
 81209  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 276 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81210  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81211  	}{delete_collation})) // test1.c:8325:41:
 81212  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 284 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81213  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81214  	}{get_autocommit})) // test1.c:8326:41:
 81215  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 292 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81216  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81217  	}{test_busy_timeout})) // test1.c:8327:41:
 81218  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 300 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81219  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81220  	}{test_printf})) // test1.c:8328:41:
 81221  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 308 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81222  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81223  	}{test_io_trace})) // test1.c:8329:39:
 81224  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd1)) + 316 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81225  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81226  	}{clang_sanitize_address})) // test1.c:8330:41:
 81227  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81228  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81229  	}{pager_open})) // test2.c:708:34:
 81230  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81231  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81232  	}{pager_close})) // test2.c:709:34:
 81233  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81234  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81235  	}{pager_commit})) // test2.c:710:34:
 81236  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81237  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81238  	}{pager_rollback})) // test2.c:711:34:
 81239  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81240  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81241  	}{pager_stmt_begin})) // test2.c:712:34:
 81242  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81243  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81244  	}{pager_stmt_commit})) // test2.c:713:34:
 81245  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81246  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81247  	}{pager_stmt_rollback})) // test2.c:714:34:
 81248  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81249  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81250  	}{pager_stats})) // test2.c:715:34:
 81251  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81252  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81253  	}{pager_pagecount})) // test2.c:716:34:
 81254  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81255  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81256  	}{page_get})) // test2.c:717:34:
 81257  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81258  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81259  	}{page_lookup})) // test2.c:718:34:
 81260  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 92 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81261  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81262  	}{page_unref})) // test2.c:719:34:
 81263  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 100 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81264  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81265  	}{page_read})) // test2.c:720:34:
 81266  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 108 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81267  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81268  	}{page_write})) // test2.c:721:34:
 81269  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 116 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81270  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81271  	}{page_number})) // test2.c:722:34:
 81272  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 124 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81273  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81274  	}{pager_truncate})) // test2.c:723:34:
 81275  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 132 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81276  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81277  	}{fake_big_file})) // test2.c:725:34:
 81278  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 140 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81279  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81280  	}{testBitvecBuiltinTest})) // test2.c:727:34:
 81281  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 148 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81282  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81283  	}{testPendingByte})) // test2.c:728:45:
 81284  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd2)) + 156 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81285  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81286  	}{faultInstallCmd})) // test2.c:729:45:
 81287  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81288  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81289  	}{btree_open})) // test3.c:666:36:
 81290  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81291  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81292  	}{btree_close})) // test3.c:667:36:
 81293  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81294  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81295  	}{btree_begin_transaction})) // test3.c:668:36:
 81296  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81297  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81298  	}{btree_pager_stats})) // test3.c:669:36:
 81299  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81300  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81301  	}{btree_cursor})) // test3.c:670:36:
 81302  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81303  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81304  	}{btree_close_cursor})) // test3.c:671:36:
 81305  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81306  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81307  	}{btree_next})) // test3.c:672:36:
 81308  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81309  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81310  	}{btree_eof})) // test3.c:673:36:
 81311  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81312  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81313  	}{btree_payload_size})) // test3.c:674:36:
 81314  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81315  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81316  	}{btree_first})) // test3.c:675:36:
 81317  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81318  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81319  	}{btree_varint_test})) // test3.c:676:36:
 81320  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 92 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81321  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81322  	}{btree_from_db})) // test3.c:677:36:
 81323  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 100 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81324  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81325  	}{btree_ismemdb})) // test3.c:678:36:
 81326  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd3)) + 108 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81327  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81328  	}{btree_set_cache_size})) // test3.c:679:36:
 81329  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81330  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81331  	}{tcl_thread_create})) // test4.c:701:29:
 81332  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81333  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81334  	}{tcl_thread_wait})) // test4.c:702:29:
 81335  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81336  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81337  	}{tcl_thread_halt})) // test4.c:703:29:
 81338  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81339  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81340  	}{tcl_thread_argc})) // test4.c:704:29:
 81341  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81342  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81343  	}{tcl_thread_argv})) // test4.c:705:29:
 81344  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81345  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81346  	}{tcl_thread_colname})) // test4.c:706:29:
 81347  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81348  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81349  	}{tcl_thread_result})) // test4.c:707:29:
 81350  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81351  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81352  	}{tcl_thread_error})) // test4.c:708:29:
 81353  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81354  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81355  	}{tcl_thread_compile})) // test4.c:709:29:
 81356  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81357  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81358  	}{tcl_thread_step})) // test4.c:710:29:
 81359  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81360  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81361  	}{tcl_thread_finalize})) // test4.c:711:29:
 81362  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 92 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81363  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81364  	}{tcl_thread_swap})) // test4.c:712:29:
 81365  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 100 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81366  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81367  	}{tcl_thread_db_get})) // test4.c:713:29:
 81368  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 108 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81369  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81370  	}{tcl_thread_db_put})) // test4.c:714:29:
 81371  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd4)) + 116 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81372  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81373  	}{tcl_thread_stmt_get})) // test4.c:715:29:
 81374  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81375  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81376  	}{binarize})) // test5.c:210:34:
 81377  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81378  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81379  	}{test_value_overhead})) // test5.c:211:34:
 81380  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81381  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81382  	}{test_translate})) // test5.c:212:34:
 81383  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd5)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81384  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81385  	}{test_translate_selftest})) // test5.c:213:34:
 81386  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81387  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81388  	}{tcl_client_create})) // test7.c:695:29:
 81389  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81390  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81391  	}{tcl_client_wait})) // test7.c:696:29:
 81392  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81393  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81394  	}{tcl_client_halt})) // test7.c:697:29:
 81395  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81396  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81397  	}{tcl_client_argc})) // test7.c:698:29:
 81398  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81399  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81400  	}{tcl_client_argv})) // test7.c:699:29:
 81401  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81402  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81403  	}{tcl_client_colname})) // test7.c:700:29:
 81404  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81405  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81406  	}{tcl_client_result})) // test7.c:701:29:
 81407  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81408  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81409  	}{tcl_client_error})) // test7.c:702:29:
 81410  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81411  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81412  	}{tcl_client_compile})) // test7.c:703:29:
 81413  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81414  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81415  	}{tcl_client_step})) // test7.c:704:29:
 81416  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81417  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81418  	}{tcl_client_reset})) // test7.c:705:29:
 81419  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 92 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81420  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81421  	}{tcl_client_finalize})) // test7.c:706:29:
 81422  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd6)) + 100 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81423  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81424  	}{tcl_client_swap})) // test7.c:707:29:
 81425  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 4 /* .xProc */)) = test_multiplex_initialize  // test_multiplex.c:1311:39:
 81426  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 12 /* .xProc */)) = test_multiplex_shutdown   // test_multiplex.c:1312:37:
 81427  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd7)) + 20 /* .xProc */)) = test_multiplex_control // test_multiplex.c:1313:36:
 81428  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 4 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81429  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81430  	}{test_shutdown})) // test_mutex.c:485:34:
 81431  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 12 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81432  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81433  	}{test_initialize})) // test_mutex.c:486:34:
 81434  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 20 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81435  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81436  	}{test_config})) // test_mutex.c:487:34:
 81437  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 28 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81438  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81439  	}{test_enter_static_mutex})) // test_mutex.c:489:34:
 81440  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 36 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81441  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81442  	}{test_leave_static_mutex})) // test_mutex.c:490:34:
 81443  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 44 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81444  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81445  	}{test_enter_db_mutex})) // test_mutex.c:492:34:
 81446  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 52 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81447  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81448  	}{test_leave_db_mutex})) // test_mutex.c:493:34:
 81449  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 60 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81450  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81451  	}{test_alloc_mutex})) // test_mutex.c:495:34:
 81452  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 68 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81453  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81454  	}{test_install_mutex_counters})) // test_mutex.c:496:34:
 81455  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 76 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81456  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81457  	}{test_read_mutex_counters})) // test_mutex.c:497:34:
 81458  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd8)) + 84 /* .xProc */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81459  		f func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32
 81460  	}{test_clear_mutex_counters})) // test_mutex.c:498:34:
 81461  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 4 /* .xProc */)) = test_quota_initialize                 // test_quota.c:1949:38:
 81462  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 12 /* .xProc */)) = test_quota_shutdown                  // test_quota.c:1950:38:
 81463  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 20 /* .xProc */)) = test_quota_set                       // test_quota.c:1951:38:
 81464  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 28 /* .xProc */)) = test_quota_file                      // test_quota.c:1952:38:
 81465  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 36 /* .xProc */)) = test_quota_dump                      // test_quota.c:1953:38:
 81466  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 44 /* .xProc */)) = test_quota_fopen                     // test_quota.c:1954:38:
 81467  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 52 /* .xProc */)) = test_quota_fread                     // test_quota.c:1955:38:
 81468  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 60 /* .xProc */)) = test_quota_fwrite                    // test_quota.c:1956:38:
 81469  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 68 /* .xProc */)) = test_quota_fclose                    // test_quota.c:1957:38:
 81470  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 76 /* .xProc */)) = test_quota_fflush                    // test_quota.c:1958:38:
 81471  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 84 /* .xProc */)) = test_quota_fseek                     // test_quota.c:1959:38:
 81472  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 92 /* .xProc */)) = test_quota_rewind                    // test_quota.c:1960:38:
 81473  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 100 /* .xProc */)) = test_quota_ftell                    // test_quota.c:1961:38:
 81474  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 108 /* .xProc */)) = test_quota_ftruncate                // test_quota.c:1962:38:
 81475  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 116 /* .xProc */)) = test_quota_file_size                // test_quota.c:1963:38:
 81476  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 124 /* .xProc */)) = test_quota_file_truesize            // test_quota.c:1964:38:
 81477  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 132 /* .xProc */)) = test_quota_file_mtime               // test_quota.c:1965:38:
 81478  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 140 /* .xProc */)) = test_quota_remove                   // test_quota.c:1966:38:
 81479  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 148 /* .xProc */)) = test_quota_glob                     // test_quota.c:1967:38:
 81480  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 156 /* .xProc */)) = test_quota_file_available           // test_quota.c:1968:38:
 81481  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aCmd9)) + 164 /* .xProc */)) = test_quota_ferror                   // test_quota.c:1969:38:
 81482  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 4 /* .pInit */)) = sqlite3_amatch_init                     // test1.c:7586:32:
 81483  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 12 /* .pInit */)) = sqlite3_appendvfs_init                 // test1.c:7587:32:
 81484  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 20 /* .pInit */)) = sqlite3_carray_init                    // test1.c:7588:32:
 81485  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 28 /* .pInit */)) = sqlite3_closure_init                   // test1.c:7589:32:
 81486  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 36 /* .pInit */)) = sqlite3_csv_init                       // test1.c:7590:32:
 81487  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 44 /* .pInit */)) = sqlite3_decimal_init                   // test1.c:7591:32:
 81488  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 52 /* .pInit */)) = sqlite3_eval_init                      // test1.c:7592:32:
 81489  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 60 /* .pInit */)) = sqlite3_explain_init                   // test1.c:7593:32:
 81490  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 68 /* .pInit */)) = sqlite3_fileio_init                    // test1.c:7594:32:
 81491  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 76 /* .pInit */)) = sqlite3_fuzzer_init                    // test1.c:7595:32:
 81492  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 84 /* .pInit */)) = sqlite3_ieee_init                      // test1.c:7596:32:
 81493  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 92 /* .pInit */)) = sqlite3_nextchar_init                  // test1.c:7597:32:
 81494  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 100 /* .pInit */)) = sqlite3_percentile_init               // test1.c:7598:32:
 81495  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 108 /* .pInit */)) = sqlite3_prefixes_init                 // test1.c:7600:32:
 81496  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 116 /* .pInit */)) = sqlite3_regexp_init                   // test1.c:7602:32:
 81497  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 124 /* .pInit */)) = sqlite3_remember_init                 // test1.c:7603:32:
 81498  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 132 /* .pInit */)) = sqlite3_series_init                   // test1.c:7604:32:
 81499  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 140 /* .pInit */)) = sqlite3_spellfix_init                 // test1.c:7605:32:
 81500  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 148 /* .pInit */)) = sqlite3_totype_init                   // test1.c:7606:32:
 81501  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 156 /* .pInit */)) = sqlite3_unionvtab_init                // test1.c:7607:32:
 81502  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 164 /* .pInit */)) = sqlite3_wholenumber_init              // test1.c:7608:32:
 81503  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aExtension)) + 172 /* .pInit */)) = sqlite3_zipfile_init                  // test1.c:7610:32:
 81504  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 8 /* .xFunc */)) = decimalFunc                                          // decimal.c:608:29:
 81505  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 20 /* .xFunc */)) = decimalCmpFunc                                      // decimal.c:609:29:
 81506  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 32 /* .xFunc */)) = decimalAddFunc                                      // decimal.c:610:29:
 81507  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 44 /* .xFunc */)) = decimalSubFunc                                      // decimal.c:611:29:
 81508  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc)) + 56 /* .xFunc */)) = decimalMulFunc                                      // decimal.c:612:29:
 81509  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 12 /* .xFunc */)) = ieee754func                                        // ieee754.c:270:36:
 81510  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 28 /* .xFunc */)) = ieee754func                                        // ieee754.c:271:36:
 81511  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 44 /* .xFunc */)) = ieee754func                                        // ieee754.c:272:36:
 81512  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 60 /* .xFunc */)) = ieee754func                                        // ieee754.c:273:36:
 81513  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 76 /* .xFunc */)) = ieee754func_to_blob                                // ieee754.c:274:36:
 81514  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFunc1)) + 92 /* .xFunc */)) = ieee754func_from_blob                              // ieee754.c:275:36:
 81515  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 12 /* .xFunc */)) = randStr                                            // test_func.c:675:48:
 81516  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 28 /* .xFunc */)) = test_destructor                                    // test_func.c:676:48:
 81517  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 44 /* .xFunc */)) = test_destructor16                                  // test_func.c:678:48:
 81518  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 60 /* .xFunc */)) = testHexToUtf16be                                   // test_func.c:679:48:
 81519  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 76 /* .xFunc */)) = testHexToUtf16le                                   // test_func.c:680:48:
 81520  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 92 /* .xFunc */)) = testHexToUtf8                                      // test_func.c:682:48:
 81521  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 108 /* .xFunc */)) = test_destructor_count                             // test_func.c:683:48:
 81522  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 124 /* .xFunc */)) = test_auxdata                                      // test_func.c:684:48:
 81523  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 140 /* .xFunc */)) = test_error                                        // test_func.c:685:48:
 81524  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 156 /* .xFunc */)) = test_error                                        // test_func.c:686:48:
 81525  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 172 /* .xFunc */)) = test_eval                                         // test_func.c:687:48:
 81526  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 188 /* .xFunc */)) = test_isolation                                    // test_func.c:688:48:
 81527  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 204 /* .xFunc */)) = counterFunc                                       // test_func.c:689:48:
 81528  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 220 /* .xFunc */)) = real2hex                                          // test_func.c:690:48:
 81529  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 236 /* .xFunc */)) = test_decode                                       // test_func.c:691:48:
 81530  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 252 /* .xFunc */)) = test_extract                                      // test_func.c:692:48:
 81531  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 268 /* .xFunc */)) = test_zeroblob                                     // test_func.c:693:62:
 81532  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 284 /* .xFunc */)) = test_getsubtype                                   // test_func.c:694:48:
 81533  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 300 /* .xFunc */)) = test_setsubtype                                   // test_func.c:695:48:
 81534  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&aFuncs)) + 316 /* .xFunc */)) = test_frombind                                     // test_func.c:696:48:
 81535  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 4 /* .xProc */)) = test_sqlite3rbu                  // test_rbu.c:370:21:
 81536  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 12 /* .xProc */)) = test_sqlite3rbu_vacuum          // test_rbu.c:371:28:
 81537  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 20 /* .xProc */)) = test_sqlite3rbu_create_vfs      // test_rbu.c:372:32:
 81538  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 28 /* .xProc */)) = test_sqlite3rbu_destroy_vfs     // test_rbu.c:373:33:
 81539  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd)) + 36 /* .xProc */)) = test_sqlite3rbu_internal_test   // test_rbu.c:374:35:
 81540  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 4 /* .xProc */)) = test_sqlite3_db_config             // test1.c:8337:41:
 81541  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 16 /* .xProc */)) = test_sqlite3_txn_state            // test1.c:8338:41:
 81542  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 28 /* .xProc */)) = test_bad_behavior              // test1.c:8339:41:
 81543  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 32 /* .clientData */)) = uintptr(unsafe.Pointer(&iZero))                                              // test1.c:8339:61:
 81544  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 40 /* .xProc */)) = test_register_dbstat_vtab         // test1.c:8340:41:
 81545  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 52 /* .xProc */)) = get_sqlite_pointer                // test1.c:8341:41:
 81546  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 64 /* .xProc */)) = test_intarray_addr                // test1.c:8342:41:
 81547  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 76 /* .xProc */)) = test_int64array_addr              // test1.c:8343:41:
 81548  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 88 /* .xProc */)) = test_doublearray_addr             // test1.c:8344:41:
 81549  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 100 /* .xProc */)) = test_textarray_addr              // test1.c:8345:41:
 81550  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 112 /* .xProc */)) = test_bind_int                    // test1.c:8346:41:
 81551  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 124 /* .xProc */)) = test_bind_zeroblob               // test1.c:8347:41:
 81552  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 136 /* .xProc */)) = test_bind_zeroblob64             // test1.c:8348:41:
 81553  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 148 /* .xProc */)) = test_bind_int64                  // test1.c:8349:41:
 81554  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 160 /* .xProc */)) = test_bind_double                 // test1.c:8350:41:
 81555  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 172 /* .xProc */)) = test_bind_null                   // test1.c:8351:41:
 81556  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 184 /* .xProc */)) = test_bind_text                   // test1.c:8352:41:
 81557  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 196 /* .xProc */)) = test_bind_text16                 // test1.c:8353:41:
 81558  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 208 /* .xProc */)) = test_bind_blob                   // test1.c:8354:41:
 81559  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 220 /* .xProc */)) = test_carray_bind                 // test1.c:8356:41:
 81560  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 232 /* .xProc */)) = test_bind_parameter_count        // test1.c:8358:41:
 81561  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 244 /* .xProc */)) = test_bind_parameter_name         // test1.c:8359:41:
 81562  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 256 /* .xProc */)) = test_bind_parameter_index        // test1.c:8360:41:
 81563  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 268 /* .xProc */)) = test_clear_bindings              // test1.c:8361:41:
 81564  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 280 /* .xProc */)) = test_sleep                       // test1.c:8362:41:
 81565  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 292 /* .xProc */)) = test_errcode                     // test1.c:8363:41:
 81566  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 304 /* .xProc */)) = test_ex_errcode                  // test1.c:8364:41:
 81567  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 316 /* .xProc */)) = test_errmsg                      // test1.c:8365:41:
 81568  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 328 /* .xProc */)) = test_errmsg16                    // test1.c:8366:41:
 81569  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 340 /* .xProc */)) = test_open                        // test1.c:8367:41:
 81570  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 352 /* .xProc */)) = test_open16                      // test1.c:8368:41:
 81571  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 364 /* .xProc */)) = test_open_v2                     // test1.c:8369:41:
 81572  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 376 /* .xProc */)) = test_complete16                  // test1.c:8370:41:
 81573  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 388 /* .xProc */)) = test_normalize                   // test1.c:8371:41:
 81574  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 400 /* .xProc */)) = test_prepare                     // test1.c:8373:41:
 81575  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 412 /* .xProc */)) = test_prepare16                   // test1.c:8374:41:
 81576  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 424 /* .xProc */)) = test_prepare_v2                  // test1.c:8375:41:
 81577  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 436 /* .xProc */)) = test_prepare_v3                  // test1.c:8376:41:
 81578  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 448 /* .xProc */)) = test_prepare_tkt3134             // test1.c:8377:41:
 81579  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 460 /* .xProc */)) = test_prepare16_v2                // test1.c:8378:41:
 81580  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 472 /* .xProc */)) = test_finalize                    // test1.c:8379:41:
 81581  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 484 /* .xProc */)) = test_stmt_status                 // test1.c:8380:41:
 81582  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 496 /* .xProc */)) = test_reset                       // test1.c:8381:41:
 81583  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 508 /* .xProc */)) = test_expired                     // test1.c:8382:41:
 81584  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 520 /* .xProc */)) = test_transfer_bind               // test1.c:8383:41:
 81585  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 532 /* .xProc */)) = test_changes                     // test1.c:8384:41:
 81586  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 544 /* .xProc */)) = test_step                        // test1.c:8385:41:
 81587  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 556 /* .xProc */)) = test_sql                         // test1.c:8386:41:
 81588  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 568 /* .xProc */)) = test_ex_sql                      // test1.c:8387:41:
 81589  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 580 /* .xProc */)) = test_next_stmt                   // test1.c:8391:41:
 81590  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 592 /* .xProc */)) = test_stmt_readonly               // test1.c:8392:41:
 81591  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 604 /* .xProc */)) = test_stmt_isexplain              // test1.c:8393:41:
 81592  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 616 /* .xProc */)) = test_stmt_busy                   // test1.c:8394:41:
 81593  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 628 /* .xProc */)) = uses_stmt_journal                // test1.c:8395:41:
 81594  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 640 /* .xProc */)) = test_release_memory              // test1.c:8397:41:
 81595  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 652 /* .xProc */)) = test_db_release_memory           // test1.c:8398:41:
 81596  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 664 /* .xProc */)) = test_db_cacheflush               // test1.c:8399:41:
 81597  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 676 /* .xProc */)) = test_system_errno                // test1.c:8400:41:
 81598  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 688 /* .xProc */)) = test_db_filename                 // test1.c:8401:41:
 81599  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 700 /* .xProc */)) = test_db_readonly                 // test1.c:8402:41:
 81600  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 712 /* .xProc */)) = test_soft_heap_limit             // test1.c:8403:41:
 81601  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 724 /* .xProc */)) = test_soft_heap_limit             // test1.c:8404:41:
 81602  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 736 /* .xProc */)) = test_hard_heap_limit             // test1.c:8405:41:
 81603  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 748 /* .xProc */)) = test_thread_cleanup              // test1.c:8406:41:
 81604  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 760 /* .xProc */)) = test_pager_refcounts             // test1.c:8407:41:
 81605  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 772 /* .xProc */)) = test_load_extension           // test1.c:8409:41:
 81606  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 784 /* .xProc */)) = test_enable_load              // test1.c:8410:41:
 81607  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 796 /* .xProc */)) = test_extended_result_codes    // test1.c:8411:41:
 81608  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 808 /* .xProc */)) = test_limit                    // test1.c:8412:41:
 81609  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 820 /* .xProc */)) = test_dbconfig_maindbname_icecube // test1.c:8413:41:
 81610  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 832 /* .xProc */)) = save_prng_state               // test1.c:8415:41:
 81611  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 844 /* .xProc */)) = restore_prng_state            // test1.c:8416:41:
 81612  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 856 /* .xProc */)) = reset_prng_state              // test1.c:8417:41:
 81613  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 868 /* .xProc */)) = prng_seed                     // test1.c:8418:41:
 81614  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 880 /* .xProc */)) = extra_schema_checks           // test1.c:8419:41:
 81615  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 892 /* .xProc */)) = database_never_corrupt        // test1.c:8420:41:
 81616  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 904 /* .xProc */)) = database_may_be_corrupt       // test1.c:8421:41:
 81617  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 916 /* .xProc */)) = optimization_control             // test1.c:8422:41:
 81618  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 928 /* .xProc */)) = runAsObjProc                     // test1.c:8431:41:
 81619  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 940 /* .xProc */)) = test_column_count                // test1.c:8434:41:
 81620  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 952 /* .xProc */)) = test_data_count                  // test1.c:8435:41:
 81621  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 964 /* .xProc */)) = test_column_type                 // test1.c:8436:41:
 81622  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 976 /* .xProc */)) = test_column_blob                 // test1.c:8437:41:
 81623  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 988 /* .xProc */)) = test_column_double               // test1.c:8438:41:
 81624  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1000 /* .xProc */)) = test_column_int64               // test1.c:8439:41:
 81625  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1012 /* .xProc */)) = test_stmt_utf8                  // test1.c:8440:33:
 81626  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1016 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81627  		f func(*libc.TLS, uintptr, int32) uintptr
 81628  	}{sqlite3.Xsqlite3_column_text})) // test1.c:8440:50:
 81629  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1024 /* .xProc */)) = test_stmt_utf8 // test1.c:8441:33:
 81630  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1028 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81631  		f func(*libc.TLS, uintptr, int32) uintptr
 81632  	}{sqlite3.Xsqlite3_column_name})) // test1.c:8441:50:
 81633  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1036 /* .xProc */)) = test_stmt_int // test1.c:8442:33:
 81634  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1040 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81635  		f func(*libc.TLS, uintptr, int32) int32
 81636  	}{sqlite3.Xsqlite3_column_int})) // test1.c:8442:50:
 81637  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1048 /* .xProc */)) = test_stmt_int // test1.c:8443:33:
 81638  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1052 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81639  		f func(*libc.TLS, uintptr, int32) int32
 81640  	}{sqlite3.Xsqlite3_column_bytes})) // test1.c:8443:50:
 81641  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1060 /* .xProc */)) = test_stmt_utf8 // test1.c:8445:34:
 81642  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1064 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81643  		f func(*libc.TLS, uintptr, int32) uintptr
 81644  	}{sqlite3.Xsqlite3_column_decltype})) // test1.c:8445:49:
 81645  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1072 /* .xProc */)) = test_stmt_utf8 // test1.c:8448:34:
 81646  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1076 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81647  		f func(*libc.TLS, uintptr, int32) uintptr
 81648  	}{sqlite3.Xsqlite3_column_database_name})) // test1.c:8448:49:
 81649  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1084 /* .xProc */)) = test_stmt_utf8 // test1.c:8449:31:
 81650  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1088 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81651  		f func(*libc.TLS, uintptr, int32) uintptr
 81652  	}{sqlite3.Xsqlite3_column_table_name})) // test1.c:8449:46:
 81653  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1096 /* .xProc */)) = test_stmt_utf8 // test1.c:8450:32:
 81654  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1100 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81655  		f func(*libc.TLS, uintptr, int32) uintptr
 81656  	}{sqlite3.Xsqlite3_column_origin_name})) // test1.c:8450:47:
 81657  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1108 /* .xProc */)) = test_stmt_int // test1.c:8454:34:
 81658  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1112 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81659  		f func(*libc.TLS, uintptr, int32) int32
 81660  	}{sqlite3.Xsqlite3_column_bytes16})) // test1.c:8454:49:
 81661  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1120 /* .xProc */)) = test_stmt_utf16 // test1.c:8455:34:
 81662  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1124 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81663  		f func(*libc.TLS, uintptr, int32) uintptr
 81664  	}{sqlite3.Xsqlite3_column_text16})) // test1.c:8455:51:
 81665  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1132 /* .xProc */)) = test_stmt_utf16 // test1.c:8456:34:
 81666  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1136 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81667  		f func(*libc.TLS, uintptr, int32) uintptr
 81668  	}{sqlite3.Xsqlite3_column_name16})) // test1.c:8456:51:
 81669  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1144 /* .xProc */)) = add_alignment_test_collations // test1.c:8457:41:
 81670  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1156 /* .xProc */)) = test_stmt_utf16               // test1.c:8459:36:
 81671  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1160 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81672  		f func(*libc.TLS, uintptr, int32) uintptr
 81673  	}{sqlite3.Xsqlite3_column_decltype16})) // test1.c:8459:52:
 81674  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1168 /* .xProc */)) = test_stmt_utf16 // test1.c:8463:3:
 81675  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1172 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81676  		f func(*libc.TLS, uintptr, int32) uintptr
 81677  	}{sqlite3.Xsqlite3_column_database_name16})) // test1.c:8463:20:
 81678  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1180 /* .xProc */)) = test_stmt_utf16 // test1.c:8464:33:
 81679  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1184 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81680  		f func(*libc.TLS, uintptr, int32) uintptr
 81681  	}{sqlite3.Xsqlite3_column_table_name16})) // test1.c:8464:50:
 81682  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1192 /* .xProc */)) = test_stmt_utf16 // test1.c:8465:34:
 81683  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1196 /* .clientData */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81684  		f func(*libc.TLS, uintptr, int32) uintptr
 81685  	}{sqlite3.Xsqlite3_column_origin_name16})) // test1.c:8465:51:
 81686  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1204 /* .xProc */)) = test_create_collation_v2         // test1.c:8468:39:
 81687  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1216 /* .xProc */)) = test_global_recover                 // test1.c:8469:38:
 81688  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1228 /* .xProc */)) = working_64bit_int                // test1.c:8470:38:
 81689  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1240 /* .xProc */)) = vfs_unlink_test                  // test1.c:8471:38:
 81690  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1252 /* .xProc */)) = vfs_initfail_test                // test1.c:8472:38:
 81691  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1264 /* .xProc */)) = vfs_unregister_all               // test1.c:8473:38:
 81692  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1276 /* .xProc */)) = vfs_reregister_all               // test1.c:8474:38:
 81693  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1288 /* .xProc */)) = file_control_test                // test1.c:8475:38:
 81694  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1300 /* .xProc */)) = file_control_lasterrno_test      // test1.c:8476:39:
 81695  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1312 /* .xProc */)) = file_control_lockproxy_test      // test1.c:8477:39:
 81696  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1324 /* .xProc */)) = file_control_chunksize_test      // test1.c:8478:39:
 81697  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1336 /* .xProc */)) = file_control_sizehint_test       // test1.c:8479:39:
 81698  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1348 /* .xProc */)) = file_control_data_version        // test1.c:8480:39:
 81699  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1360 /* .xProc */)) = file_control_persist_wal         // test1.c:8486:39:
 81700  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1372 /* .xProc */)) = file_control_powersafe_overwrite // test1.c:8487:43:
 81701  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1384 /* .xProc */)) = file_control_vfsname             // test1.c:8488:39:
 81702  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1396 /* .xProc */)) = file_control_reservebytes        // test1.c:8489:39:
 81703  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1408 /* .xProc */)) = file_control_tempfilename        // test1.c:8490:39:
 81704  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1420 /* .xProc */)) = file_control_external_reader     // test1.c:8491:42:
 81705  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1432 /* .xProc */)) = vfs_list                         // test1.c:8492:38:
 81706  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1444 /* .xProc */)) = test_create_function_v2          // test1.c:8493:38:
 81707  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1456 /* .xProc */)) = test_collate                        // test1.c:8497:35:
 81708  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1468 /* .xProc */)) = test_collate_needed                 // test1.c:8498:35:
 81709  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1480 /* .xProc */)) = test_function                       // test1.c:8499:35:
 81710  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1492 /* .xProc */)) = test_utf16bin_collate               // test1.c:8500:40:
 81711  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1504 /* .xProc */)) = test_errstr                         // test1.c:8502:35:
 81712  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1516 /* .xProc */)) = tcl_variable_type                   // test1.c:8503:35:
 81713  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1528 /* .xProc */)) = test_enable_shared               // test1.c:8505:39:
 81714  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1540 /* .xProc */)) = sqlite3BtreeSharedCacheReport       // test1.c:8506:39:
 81715  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1552 /* .xProc */)) = test_libversion_number           // test1.c:8508:37:
 81716  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1564 /* .xProc */)) = test_table_column_metadata       // test1.c:8509:41:
 81717  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1576 /* .xProc */)) = test_blob_reopen                 // test1.c:8511:31:
 81718  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1588 /* .xProc */)) = test_pcache_stats                // test1.c:8513:30:
 81719  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1600 /* .xProc */)) = test_unlock_notify               // test1.c:8515:33:
 81720  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1612 /* .xProc */)) = test_wal_checkpoint              // test1.c:8517:36:
 81721  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1624 /* .xProc */)) = test_wal_checkpoint_v2           // test1.c:8518:36:
 81722  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1636 /* .xProc */)) = test_wal_autocheckpoint          // test1.c:8519:37:
 81723  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1648 /* .xProc */)) = test_sqlite3_log                 // test1.c:8520:36:
 81724  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1660 /* .xProc */)) = test_print_eqp                      // test1.c:8522:36:
 81725  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1672 /* .xProc */)) = test_test_control                   // test1.c:8524:32:
 81726  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1684 /* .xProc */)) = test_getrusage                      // test1.c:8526:21:
 81727  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1696 /* .xProc */)) = tclLoadStaticExtensionCmd           // test1.c:8528:33:
 81728  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1708 /* .xProc */)) = sorter_test_fakeheap                // test1.c:8529:32:
 81729  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1720 /* .xProc */)) = sorter_test_sort4_helper            // test1.c:8530:36:
 81730  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1732 /* .xProc */)) = vfsCurrentTimeInt64                 // test1.c:8544:44:
 81731  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1744 /* .xProc */)) = test_snapshot_get                   // test1.c:8546:32:
 81732  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1756 /* .xProc */)) = test_snapshot_open                  // test1.c:8547:33:
 81733  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1768 /* .xProc */)) = test_snapshot_free                  // test1.c:8548:33:
 81734  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1780 /* .xProc */)) = test_snapshot_cmp                   // test1.c:8549:32:
 81735  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1792 /* .xProc */)) = test_snapshot_recover               // test1.c:8550:36:
 81736  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1804 /* .xProc */)) = test_snapshot_get_blob              // test1.c:8551:37:
 81737  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1816 /* .xProc */)) = test_snapshot_open_blob             // test1.c:8552:38:
 81738  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1828 /* .xProc */)) = test_snapshot_cmp_blob              // test1.c:8553:37:
 81739  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1840 /* .xProc */)) = test_delete_database                // test1.c:8555:35:
 81740  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1852 /* .xProc */)) = test_atomic_batch_write             // test1.c:8556:35:
 81741  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1864 /* .xProc */)) = test_mmap_warm                      // test1.c:8557:35:
 81742  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1876 /* .xProc */)) = test_config_sorterref               // test1.c:8558:36:
 81743  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1888 /* .xProc */)) = test_decode_hexdb                   // test1.c:8559:36:
 81744  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1900 /* .xProc */)) = test_write_db                       // test1.c:8560:36:
 81745  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1912 /* .xProc */)) = test_register_cksumvfs              // test1.c:8561:37:
 81746  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd1)) + 1924 /* .xProc */)) = test_unregister_cksumvfs            // test1.c:8562:39:
 81747  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd10)) + 4 /* .xProc */)) = test_intarray_create               // test_intarray.c:381:35:
 81748  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd10)) + 16 /* .xProc */)) = test_intarray_bind                // test_intarray.c:382:33:
 81749  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 4 /* .xProc */)) = test_malloc                           // test_malloc.c:1473:38:
 81750  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 16 /* .xProc */)) = test_realloc                         // test_malloc.c:1474:38:
 81751  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 28 /* .xProc */)) = test_free                            // test_malloc.c:1475:38:
 81752  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 40 /* .xProc */)) = test_memset                          // test_malloc.c:1476:38:
 81753  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 52 /* .xProc */)) = test_memget                          // test_malloc.c:1477:38:
 81754  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 64 /* .xProc */)) = test_memory_used                     // test_malloc.c:1478:38:
 81755  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 76 /* .xProc */)) = test_memory_highwater                // test_malloc.c:1479:38:
 81756  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 88 /* .xProc */)) = test_memdebug_backtrace              // test_malloc.c:1480:38:
 81757  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 100 /* .xProc */)) = test_memdebug_dump                  // test_malloc.c:1481:38:
 81758  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 112 /* .xProc */)) = test_memdebug_fail                  // test_malloc.c:1482:38:
 81759  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 124 /* .xProc */)) = test_memdebug_pending               // test_malloc.c:1483:38:
 81760  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 136 /* .xProc */)) = test_memdebug_settitle              // test_malloc.c:1484:38:
 81761  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 148 /* .xProc */)) = test_memdebug_malloc_count          // test_malloc.c:1485:41:
 81762  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 160 /* .xProc */)) = test_memdebug_log                   // test_malloc.c:1486:38:
 81763  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 172 /* .xProc */)) = test_config_pagecache               // test_malloc.c:1487:38:
 81764  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 184 /* .xProc */)) = test_alt_pcache                     // test_malloc.c:1488:38:
 81765  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 196 /* .xProc */)) = test_status                         // test_malloc.c:1489:38:
 81766  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 208 /* .xProc */)) = test_db_status                      // test_malloc.c:1490:38:
 81767  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 220 /* .xProc */)) = test_install_malloc_faultsim        // test_malloc.c:1491:38:
 81768  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 232 /* .xProc */)) = test_config_heap                    // test_malloc.c:1492:38:
 81769  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 244 /* .xProc */)) = test_config_heap_size               // test_malloc.c:1493:38:
 81770  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 256 /* .xProc */)) = test_config_memstatus               // test_malloc.c:1494:38:
 81771  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 268 /* .xProc */)) = test_config_lookaside               // test_malloc.c:1495:38:
 81772  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 280 /* .xProc */)) = test_config_error                   // test_malloc.c:1496:38:
 81773  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 292 /* .xProc */)) = test_config_uri                     // test_malloc.c:1497:38:
 81774  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 304 /* .xProc */)) = test_config_cis                     // test_malloc.c:1498:38:
 81775  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 316 /* .xProc */)) = test_config_pmasz                   // test_malloc.c:1499:38:
 81776  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 328 /* .xProc */)) = test_db_config_lookaside            // test_malloc.c:1500:38:
 81777  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 340 /* .xProc */)) = test_dump_memsys3                   // test_malloc.c:1501:38:
 81778  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 352 /* .xProc */)) = test_dump_memsys3                   // test_malloc.c:1502:38:
 81779  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 364 /* .xProc */)) = test_install_memsys3                // test_malloc.c:1503:38:
 81780  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd11)) + 376 /* .xProc */)) = test_vfs_oom_test                   // test_malloc.c:1504:41:
 81781  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd12)) + 4 /* .xProc */)) = register_schema_module             // test_schema.c:336:34:
 81782  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd13)) + 4 /* .xProc */)) = register_tclvar_module             // test_tclvar.c:553:36:
 81783  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 4 /* .xProc */)) = test_create_window                    // test_window.c:337:42:
 81784  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 16 /* .xProc */)) = test_create_window_misuse            // test_window.c:338:46:
 81785  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 28 /* .xProc */)) = test_create_sumint                   // test_window.c:339:30:
 81786  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd14)) + 40 /* .xProc */)) = test_override_sum                    // test_window.c:340:29:
 81787  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd2)) + 4 /* .xProc */)) = register_echo_module                // test8.c:1440:38:
 81788  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd2)) + 16 /* .xProc */)) = declare_vtab                       // test8.c:1441:38:
 81789  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 4 /* .xProc */)) = c_misuse_test                       // test9.c:194:28:
 81790  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 16 /* .xProc */)) = c_realloc_test                     // test9.c:195:28:
 81791  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd3)) + 28 /* .xProc */)) = c_collation_test                   // test9.c:196:28:
 81792  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd4)) + 4 /* .xProc */)) = register_tcl_module                 // test_bestindex.c:611:33:
 81793  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 4 /* .xProc */)) = test_blob_open                      // test_blob.c:318:40:
 81794  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 12 /* .xProc */)) = test_blob_close                    // test_blob.c:319:40:
 81795  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 20 /* .xProc */)) = test_blob_bytes                    // test_blob.c:320:40:
 81796  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 28 /* .xProc */)) = test_blob_read                     // test_blob.c:321:40:
 81797  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd5)) + 36 /* .xProc */)) = test_blob_write                    // test_blob.c:322:40:
 81798  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd6)) + 4 /* .xProc */)) = register_fs_module                  // test_fs.c:908:32:
 81799  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 4 /* .xProc */)) = autoinstall_test_funcs                 // test_func.c:938:41:
 81800  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 12 /* .xProc */)) = abuse_create_function                 // test_func.c:939:41:
 81801  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd7)) + 20 /* .xProc */)) = install_fts3_rank_function            // test_func.c:940:41:
 81802  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 4 /* .xProc */)) = hexio_read                             // test_hexio.c:451:40:
 81803  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 12 /* .xProc */)) = hexio_write                           // test_hexio.c:452:40:
 81804  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 20 /* .xProc */)) = hexio_get_int                         // test_hexio.c:453:40:
 81805  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 28 /* .xProc */)) = hexio_render_int16                    // test_hexio.c:454:40:
 81806  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 36 /* .xProc */)) = hexio_render_int32                    // test_hexio.c:455:40:
 81807  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 44 /* .xProc */)) = utf8_to_utf8                          // test_hexio.c:456:40:
 81808  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 52 /* .xProc */)) = read_fts3varint                       // test_hexio.c:457:40:
 81809  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd8)) + 60 /* .xProc */)) = make_fts3record                       // test_hexio.c:458:40:
 81810  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 4 /* .xProc */)) = init_wrapper_install                // test_init.c:283:32:
 81811  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 12 /* .xProc */)) = init_wrapper_query                 // test_init.c:284:32:
 81812  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 20 /* .xProc */)) = init_wrapper_uninstall             // test_init.c:285:32:
 81813  	*(*func(*libc.TLS, ClientData, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&aObjCmd9)) + 28 /* .xProc */)) = init_wrapper_clear                 // test_init.c:286:32:
 81814  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 4 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81815  		f func(*libc.TLS, uintptr, int32, int32) int32
 81816  	}{ts_open})) // test_syscall.c:134:27:
 81817  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 24 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct{ f func(*libc.TLS, int32) int32 }{ts_close})) // test_syscall.c:135:27:
 81818  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 44 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81819  		f func(*libc.TLS, uintptr, int32) int32
 81820  	}{ts_access})) // test_syscall.c:136:27:
 81821  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 64 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81822  		f func(*libc.TLS, uintptr, size_t) uintptr
 81823  	}{ts_getcwd})) // test_syscall.c:137:27:
 81824  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 84 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81825  		f func(*libc.TLS, uintptr, uintptr) int32
 81826  	}{ts_stat})) // test_syscall.c:138:27:
 81827  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 104 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81828  		f func(*libc.TLS, int32, uintptr) int32
 81829  	}{ts_fstat})) // test_syscall.c:139:27:
 81830  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 124 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81831  		f func(*libc.TLS, int32, off_t) int32
 81832  	}{ts_ftruncate})) // test_syscall.c:140:27:
 81833  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 144 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81834  		f func(*libc.TLS, int32, int32, uintptr) int32
 81835  	}{ts_fcntl})) // test_syscall.c:141:27:
 81836  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 164 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81837  		f func(*libc.TLS, int32, uintptr, size_t) int32
 81838  	}{ts_read})) // test_syscall.c:142:27:
 81839  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 184 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81840  		f func(*libc.TLS, int32, uintptr, size_t, off_t) int32
 81841  	}{ts_pread})) // test_syscall.c:143:27:
 81842  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 204 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81843  		f func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) int32
 81844  	}{ts_pread64})) // test_syscall.c:144:27:
 81845  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 224 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81846  		f func(*libc.TLS, int32, uintptr, size_t) int32
 81847  	}{ts_write})) // test_syscall.c:145:27:
 81848  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 244 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81849  		f func(*libc.TLS, int32, uintptr, size_t, off_t) int32
 81850  	}{ts_pwrite})) // test_syscall.c:146:27:
 81851  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 264 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81852  		f func(*libc.TLS, int32, uintptr, size_t, sqlite3_uint64) int32
 81853  	}{ts_pwrite64})) // test_syscall.c:147:27:
 81854  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 284 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81855  		f func(*libc.TLS, int32, mode_t) int32
 81856  	}{ts_fchmod})) // test_syscall.c:148:27:
 81857  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 304 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81858  		f func(*libc.TLS, int32, off_t, off_t) int32
 81859  	}{ts_fallocate})) // test_syscall.c:149:27:
 81860  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 324 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81861  		f func(*libc.TLS, uintptr, size_t, int32, int32, int32, off_t) uintptr
 81862  	}{ts_mmap})) // test_syscall.c:150:27:
 81863  	*(*sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&aSyscall)) + 344 /* .xTest */)) = *(*uintptr)(unsafe.Pointer(&struct {
 81864  		f func(*libc.TLS, uintptr, size_t, size_t, int32, uintptr) uintptr
 81865  	}{ts_mremap})) // test_syscall.c:151:27:
 81866  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 4 /* .xCreate */)) = amatchConnect            // amatch.c:1456:3:
 81867  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 8 /* .xConnect */)) = amatchConnect           // amatch.c:1457:3:
 81868  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 12 /* .xBestIndex */)) = amatchBestIndex                                        // amatch.c:1458:3:
 81869  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 16 /* .xDisconnect */)) = amatchDisconnect                                               // amatch.c:1459:3:
 81870  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 20 /* .xDestroy */)) = amatchDisconnect                                                  // amatch.c:1460:3:
 81871  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 24 /* .xOpen */)) = amatchOpen                                                  // amatch.c:1461:3:
 81872  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 28 /* .xClose */)) = amatchClose                                                         // amatch.c:1462:3:
 81873  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 32 /* .xFilter */)) = amatchFilter                       // amatch.c:1463:3:
 81874  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 36 /* .xNext */)) = amatchNext                                                           // amatch.c:1464:3:
 81875  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 40 /* .xEof */)) = amatchEof                                                             // amatch.c:1465:3:
 81876  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 44 /* .xColumn */)) = amatchColumn                                       // amatch.c:1466:3:
 81877  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 48 /* .xRowid */)) = amatchRowid                                                // amatch.c:1467:3:
 81878  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&amatchModule)) + 52 /* .xUpdate */)) = amatchUpdate                              // amatch.c:1468:3:
 81879  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 4 /* .xClose */)) = apndClose                                                         // appendvfs.c:204:3:
 81880  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 8 /* .xRead */)) = apndRead                            // appendvfs.c:205:3:
 81881  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 12 /* .xWrite */)) = apndWrite                         // appendvfs.c:206:3:
 81882  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 16 /* .xTruncate */)) = apndTruncate                                   // appendvfs.c:207:3:
 81883  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 20 /* .xSync */)) = apndSync                                                   // appendvfs.c:208:3:
 81884  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 24 /* .xFileSize */)) = apndFileSize                                         // appendvfs.c:209:3:
 81885  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 28 /* .xLock */)) = apndLock                                                   // appendvfs.c:210:3:
 81886  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 32 /* .xUnlock */)) = apndUnlock                                               // appendvfs.c:211:3:
 81887  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 36 /* .xCheckReservedLock */)) = apndCheckReservedLock                       // appendvfs.c:212:3:
 81888  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 40 /* .xFileControl */)) = apndFileControl                            // appendvfs.c:213:3:
 81889  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 44 /* .xSectorSize */)) = apndSectorSize                                              // appendvfs.c:214:3:
 81890  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 48 /* .xDeviceCharacteristics */)) = apndDeviceCharacteristics                        // appendvfs.c:215:3:
 81891  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 52 /* .xShmMap */)) = apndShmMap                        // appendvfs.c:216:3:
 81892  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 56 /* .xShmLock */)) = apndShmLock                               // appendvfs.c:217:3:
 81893  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 60 /* .xShmBarrier */)) = apndShmBarrier                                                    // appendvfs.c:218:3:
 81894  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 64 /* .xShmUnmap */)) = apndShmUnmap                                           // appendvfs.c:219:3:
 81895  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 68 /* .xFetch */)) = apndFetch                         // appendvfs.c:220:3:
 81896  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_io_methods)) + 72 /* .xUnfetch */)) = apndUnfetch                            // appendvfs.c:221:3:
 81897  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 24 /* .xOpen */)) = apndOpen                               // appendvfs.c:184:3:
 81898  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 28 /* .xDelete */)) = apndDelete                                             // appendvfs.c:185:3:
 81899  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 32 /* .xAccess */)) = apndAccess                                    // appendvfs.c:186:3:
 81900  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 36 /* .xFullPathname */)) = apndFullPathname                        // appendvfs.c:187:3:
 81901  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 40 /* .xDlOpen */)) = apndDlOpen                                                  // appendvfs.c:188:3:
 81902  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 44 /* .xDlError */)) = apndDlError                                                 // appendvfs.c:189:3:
 81903  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 48 /* .xDlSym */)) = apndDlSym                                           // appendvfs.c:190:3:
 81904  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 52 /* .xDlClose */)) = apndDlClose                                                        // appendvfs.c:191:3:
 81905  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 56 /* .xRandomness */)) = apndRandomness                                     // appendvfs.c:192:3:
 81906  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 60 /* .xSleep */)) = apndSleep                                                        // appendvfs.c:193:3:
 81907  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 64 /* .xCurrentTime */)) = apndCurrentTime                                          // appendvfs.c:194:3:
 81908  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 68 /* .xGetLastError */)) = apndGetLastError                                 // appendvfs.c:195:3:
 81909  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 72 /* .xCurrentTimeInt64 */)) = apndCurrentTimeInt64                                // appendvfs.c:196:3:
 81910  	*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 76 /* .xSetSystemCall */)) = apndSetSystemCall                 // appendvfs.c:197:3:
 81911  	*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 80 /* .xGetSystemCall */)) = apndGetSystemCall                        // appendvfs.c:198:3:
 81912  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&apnd_vfs)) + 84 /* .xNextSystemCall */)) = apndNextSystemCall                                  // appendvfs.c:199:3:
 81913  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 8 /* .xConnect */)) = carrayConnect           // carray.c:368:3:
 81914  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 12 /* .xBestIndex */)) = carrayBestIndex                                        // carray.c:369:3:
 81915  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 16 /* .xDisconnect */)) = carrayDisconnect                                               // carray.c:370:3:
 81916  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 24 /* .xOpen */)) = carrayOpen                                                  // carray.c:372:3:
 81917  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 28 /* .xClose */)) = carrayClose                                                         // carray.c:373:3:
 81918  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 32 /* .xFilter */)) = carrayFilter                       // carray.c:374:3:
 81919  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 36 /* .xNext */)) = carrayNext                                                           // carray.c:375:3:
 81920  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 40 /* .xEof */)) = carrayEof                                                             // carray.c:376:3:
 81921  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 44 /* .xColumn */)) = carrayColumn                                       // carray.c:377:3:
 81922  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&carrayModule)) + 48 /* .xRowid */)) = carrayRowid                                                // carray.c:378:3:
 81923  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 4 /* .xClose */)) = cksmClose                                                         // cksumvfs.c:274:3:
 81924  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 8 /* .xRead */)) = cksmRead                            // cksumvfs.c:275:3:
 81925  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 12 /* .xWrite */)) = cksmWrite                         // cksumvfs.c:276:3:
 81926  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 16 /* .xTruncate */)) = cksmTruncate                                   // cksumvfs.c:277:3:
 81927  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 20 /* .xSync */)) = cksmSync                                                   // cksumvfs.c:278:3:
 81928  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 24 /* .xFileSize */)) = cksmFileSize                                         // cksumvfs.c:279:3:
 81929  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 28 /* .xLock */)) = cksmLock                                                   // cksumvfs.c:280:3:
 81930  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 32 /* .xUnlock */)) = cksmUnlock                                               // cksumvfs.c:281:3:
 81931  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 36 /* .xCheckReservedLock */)) = cksmCheckReservedLock                       // cksumvfs.c:282:3:
 81932  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 40 /* .xFileControl */)) = cksmFileControl                            // cksumvfs.c:283:3:
 81933  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 44 /* .xSectorSize */)) = cksmSectorSize                                              // cksumvfs.c:284:3:
 81934  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 48 /* .xDeviceCharacteristics */)) = cksmDeviceCharacteristics                        // cksumvfs.c:285:3:
 81935  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 52 /* .xShmMap */)) = cksmShmMap                        // cksumvfs.c:286:3:
 81936  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 56 /* .xShmLock */)) = cksmShmLock                               // cksumvfs.c:287:3:
 81937  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 60 /* .xShmBarrier */)) = cksmShmBarrier                                                    // cksumvfs.c:288:3:
 81938  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 64 /* .xShmUnmap */)) = cksmShmUnmap                                           // cksumvfs.c:289:3:
 81939  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 68 /* .xFetch */)) = cksmFetch                         // cksumvfs.c:290:3:
 81940  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_io_methods)) + 72 /* .xUnfetch */)) = cksmUnfetch                            // cksumvfs.c:291:3:
 81941  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 24 /* .xOpen */)) = cksmOpen                               // cksumvfs.c:254:3:
 81942  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 28 /* .xDelete */)) = cksmDelete                                             // cksumvfs.c:255:3:
 81943  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 32 /* .xAccess */)) = cksmAccess                                    // cksumvfs.c:256:3:
 81944  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 36 /* .xFullPathname */)) = cksmFullPathname                        // cksumvfs.c:257:3:
 81945  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 40 /* .xDlOpen */)) = cksmDlOpen                                                  // cksumvfs.c:258:3:
 81946  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 44 /* .xDlError */)) = cksmDlError                                                 // cksumvfs.c:259:3:
 81947  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 48 /* .xDlSym */)) = cksmDlSym                                           // cksumvfs.c:260:3:
 81948  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 52 /* .xDlClose */)) = cksmDlClose                                                        // cksumvfs.c:261:3:
 81949  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 56 /* .xRandomness */)) = cksmRandomness                                     // cksumvfs.c:262:3:
 81950  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 60 /* .xSleep */)) = cksmSleep                                                        // cksumvfs.c:263:3:
 81951  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 64 /* .xCurrentTime */)) = cksmCurrentTime                                          // cksumvfs.c:264:3:
 81952  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 68 /* .xGetLastError */)) = cksmGetLastError                                 // cksumvfs.c:265:3:
 81953  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 72 /* .xCurrentTimeInt64 */)) = cksmCurrentTimeInt64                                // cksumvfs.c:266:3:
 81954  	*(*func(*libc.TLS, uintptr, uintptr, sqlite3_syscall_ptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 76 /* .xSetSystemCall */)) = cksmSetSystemCall                 // cksumvfs.c:267:3:
 81955  	*(*func(*libc.TLS, uintptr, uintptr) sqlite3_syscall_ptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 80 /* .xGetSystemCall */)) = cksmGetSystemCall                        // cksumvfs.c:268:3:
 81956  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&cksm_vfs)) + 84 /* .xNextSystemCall */)) = cksmNextSystemCall                                  // cksumvfs.c:269:3:
 81957  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 4 /* .xCreate */)) = closureConnect          // closure.c:920:3:
 81958  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 8 /* .xConnect */)) = closureConnect         // closure.c:921:3:
 81959  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 12 /* .xBestIndex */)) = closureBestIndex                                      // closure.c:922:3:
 81960  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 16 /* .xDisconnect */)) = closureDisconnect                                             // closure.c:923:3:
 81961  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 20 /* .xDestroy */)) = closureDisconnect                                                // closure.c:924:3:
 81962  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 24 /* .xOpen */)) = closureOpen                                                // closure.c:925:3:
 81963  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 28 /* .xClose */)) = closureClose                                                       // closure.c:926:3:
 81964  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 32 /* .xFilter */)) = closureFilter                     // closure.c:927:3:
 81965  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 36 /* .xNext */)) = closureNext                                                         // closure.c:928:3:
 81966  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 40 /* .xEof */)) = closureEof                                                           // closure.c:929:3:
 81967  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 44 /* .xColumn */)) = closureColumn                                     // closure.c:930:3:
 81968  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&closureModule)) + 48 /* .xRowid */)) = closureRowid                                              // closure.c:931:3:
 81969  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 24 /* .xOpen */)) = cfOpen                                 // test6.c:857:5:
 81970  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 28 /* .xDelete */)) = cfDelete                                               // test6.c:858:5:
 81971  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 32 /* .xAccess */)) = cfAccess                                      // test6.c:859:5:
 81972  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 36 /* .xFullPathname */)) = cfFullPathname                          // test6.c:860:5:
 81973  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 40 /* .xDlOpen */)) = cfDlOpen                                                    // test6.c:861:5:
 81974  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 44 /* .xDlError */)) = cfDlError                                                   // test6.c:862:5:
 81975  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 48 /* .xDlSym */)) = cfDlSym                                             // test6.c:863:5:
 81976  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 52 /* .xDlClose */)) = cfDlClose                                                          // test6.c:864:5:
 81977  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 56 /* .xRandomness */)) = cfRandomness                                       // test6.c:865:5:
 81978  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 60 /* .xSleep */)) = cfSleep                                                          // test6.c:866:5:
 81979  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 64 /* .xCurrentTime */)) = cfCurrentTime                                            // test6.c:867:5:
 81980  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&crashVfs)) + 68 /* .xGetLastError */)) = cfGetLastError                                   // test6.c:868:5:
 81981  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 4 /* .xClose */)) = devsymClose                                                     // test_devsym.c:229:3:
 81982  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 8 /* .xRead */)) = devsymRead                         // test_devsym.c:230:3:
 81983  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 12 /* .xWrite */)) = devsymWrite                      // test_devsym.c:231:3:
 81984  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 16 /* .xTruncate */)) = devsymTruncate                                // test_devsym.c:232:3:
 81985  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 20 /* .xSync */)) = devsymSync                                               // test_devsym.c:233:3:
 81986  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 24 /* .xFileSize */)) = devsymFileSize                                     // test_devsym.c:234:3:
 81987  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 28 /* .xLock */)) = devsymLock                                               // test_devsym.c:235:3:
 81988  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 32 /* .xUnlock */)) = devsymUnlock                                           // test_devsym.c:236:3:
 81989  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 36 /* .xCheckReservedLock */)) = devsymCheckReservedLock                   // test_devsym.c:237:3:
 81990  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 40 /* .xFileControl */)) = devsymFileControl                        // test_devsym.c:238:3:
 81991  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 44 /* .xSectorSize */)) = devsymSectorSize                                          // test_devsym.c:239:3:
 81992  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 48 /* .xDeviceCharacteristics */)) = devsymDeviceCharacteristics                    // test_devsym.c:240:3:
 81993  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 52 /* .xShmMap */)) = devsymShmMap                    // test_devsym.c:241:3:
 81994  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 56 /* .xShmLock */)) = devsymShmLock                           // test_devsym.c:242:3:
 81995  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 60 /* .xShmBarrier */)) = devsymShmBarrier                                                // test_devsym.c:243:3:
 81996  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_io_methods)) + 64 /* .xShmUnmap */)) = devsymShmUnmap                                       // test_devsym.c:244:3:
 81997  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 24 /* .xOpen */)) = devsymOpen                           // test_devsym.c:428:3:
 81998  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 28 /* .xDelete */)) = devsymDelete                                         // test_devsym.c:429:3:
 81999  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 32 /* .xAccess */)) = devsymAccess                                // test_devsym.c:430:3:
 82000  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 36 /* .xFullPathname */)) = devsymFullPathname                    // test_devsym.c:431:3:
 82001  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 56 /* .xRandomness */)) = devsymRandomness                                 // test_devsym.c:443:3:
 82002  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 60 /* .xSleep */)) = devsymSleep                                                    // test_devsym.c:444:3:
 82003  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&devsym_vfs)) + 64 /* .xCurrentTime */)) = devsymCurrentTime                                      // test_devsym.c:445:3:
 82004  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 4 /* .xCreate */)) = echoCreate                 // test8.c:1302:3:
 82005  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 8 /* .xConnect */)) = echoConnect               // test8.c:1303:3:
 82006  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 12 /* .xBestIndex */)) = echoBestIndex                                            // test8.c:1304:3:
 82007  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 16 /* .xDisconnect */)) = echoDisconnect                                                   // test8.c:1305:3:
 82008  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 20 /* .xDestroy */)) = echoDestroy                                                         // test8.c:1306:3:
 82009  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 24 /* .xOpen */)) = echoOpen                                                      // test8.c:1307:3:
 82010  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 28 /* .xClose */)) = echoClose                                                             // test8.c:1308:3:
 82011  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 32 /* .xFilter */)) = echoFilter                           // test8.c:1309:3:
 82012  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 36 /* .xNext */)) = echoNext                                                               // test8.c:1310:3:
 82013  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 40 /* .xEof */)) = echoEof                                                                 // test8.c:1311:3:
 82014  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 44 /* .xColumn */)) = echoColumn                                           // test8.c:1312:3:
 82015  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 48 /* .xRowid */)) = echoRowid                                                    // test8.c:1313:3:
 82016  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 52 /* .xUpdate */)) = echoUpdate                                  // test8.c:1314:3:
 82017  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 56 /* .xBegin */)) = echoBegin                                                             // test8.c:1315:3:
 82018  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 60 /* .xSync */)) = echoSync                                                               // test8.c:1316:3:
 82019  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 64 /* .xCommit */)) = echoCommit                                                           // test8.c:1317:3:
 82020  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 68 /* .xRollback */)) = echoRollback                                                       // test8.c:1318:3:
 82021  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 72 /* .xFindFunction */)) = echoFindFunction             // test8.c:1319:3:
 82022  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModule)) + 76 /* .xRename */)) = echoRename                                                  // test8.c:1320:3:
 82023  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 4 /* .xCreate */)) = echoCreate               // test8.c:1325:3:
 82024  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 8 /* .xConnect */)) = echoConnect             // test8.c:1326:3:
 82025  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 12 /* .xBestIndex */)) = echoBestIndex                                          // test8.c:1327:3:
 82026  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 16 /* .xDisconnect */)) = echoDisconnect                                                 // test8.c:1328:3:
 82027  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 20 /* .xDestroy */)) = echoDestroy                                                       // test8.c:1329:3:
 82028  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 24 /* .xOpen */)) = echoOpen                                                    // test8.c:1330:3:
 82029  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 28 /* .xClose */)) = echoClose                                                           // test8.c:1331:3:
 82030  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 32 /* .xFilter */)) = echoFilter                         // test8.c:1332:3:
 82031  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 36 /* .xNext */)) = echoNext                                                             // test8.c:1333:3:
 82032  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 40 /* .xEof */)) = echoEof                                                               // test8.c:1334:3:
 82033  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 44 /* .xColumn */)) = echoColumn                                         // test8.c:1335:3:
 82034  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 48 /* .xRowid */)) = echoRowid                                                  // test8.c:1336:3:
 82035  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 52 /* .xUpdate */)) = echoUpdate                                // test8.c:1337:3:
 82036  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 56 /* .xBegin */)) = echoBegin                                                           // test8.c:1338:3:
 82037  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 60 /* .xSync */)) = echoSync                                                             // test8.c:1339:3:
 82038  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 64 /* .xCommit */)) = echoCommit                                                         // test8.c:1340:3:
 82039  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 68 /* .xRollback */)) = echoRollback                                                     // test8.c:1341:3:
 82040  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 72 /* .xFindFunction */)) = echoFindFunction           // test8.c:1342:3:
 82041  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 76 /* .xRename */)) = echoRename                                                // test8.c:1343:3:
 82042  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 80 /* .xSavepoint */)) = echoSavepoint                                            // test8.c:1344:3:
 82043  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 84 /* .xRelease */)) = echoRelease                                                // test8.c:1345:3:
 82044  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&echoModuleV2)) + 88 /* .xRollbackTo */)) = echoRollbackTo                                          // test8.c:1346:3:
 82045  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 4 /* .xCreate */)) = expertConnect            // sqlite3expert.c:625:5:
 82046  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 8 /* .xConnect */)) = expertConnect           // sqlite3expert.c:626:5:
 82047  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 12 /* .xBestIndex */)) = expertBestIndex                                        // sqlite3expert.c:627:5:
 82048  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 16 /* .xDisconnect */)) = expertDisconnect                                               // sqlite3expert.c:628:5:
 82049  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 20 /* .xDestroy */)) = expertDisconnect                                                  // sqlite3expert.c:629:5:
 82050  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 24 /* .xOpen */)) = expertOpen                                                  // sqlite3expert.c:630:5:
 82051  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 28 /* .xClose */)) = expertClose                                                         // sqlite3expert.c:631:5:
 82052  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 32 /* .xFilter */)) = expertFilter                       // sqlite3expert.c:632:5:
 82053  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 36 /* .xNext */)) = expertNext                                                           // sqlite3expert.c:633:5:
 82054  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 40 /* .xEof */)) = expertEof                                                             // sqlite3expert.c:634:5:
 82055  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 44 /* .xColumn */)) = expertColumn                                       // sqlite3expert.c:635:5:
 82056  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 48 /* .xRowid */)) = expertRowid                                                // sqlite3expert.c:636:5:
 82057  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&expertModule)) + 52 /* .xUpdate */)) = expertUpdate                              // sqlite3expert.c:637:5:
 82058  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 8 /* .xConnect */)) = explainConnect         // explain.c:274:3:
 82059  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 12 /* .xBestIndex */)) = explainBestIndex                                      // explain.c:275:3:
 82060  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 16 /* .xDisconnect */)) = explainDisconnect                                             // explain.c:276:3:
 82061  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 24 /* .xOpen */)) = explainOpen                                                // explain.c:278:3:
 82062  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 28 /* .xClose */)) = explainClose                                                       // explain.c:279:3:
 82063  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 32 /* .xFilter */)) = explainFilter                     // explain.c:280:3:
 82064  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 36 /* .xNext */)) = explainNext                                                         // explain.c:281:3:
 82065  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 40 /* .xEof */)) = explainEof                                                           // explain.c:282:3:
 82066  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 44 /* .xColumn */)) = explainColumn                                     // explain.c:283:3:
 82067  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&explainModule)) + 48 /* .xRowid */)) = explainRowid                                              // explain.c:284:3:
 82068  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 4 /* .xCreate */)) = fsConnect                    // test_fs.c:800:3:
 82069  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 8 /* .xConnect */)) = fsConnect                   // test_fs.c:801:3:
 82070  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 12 /* .xBestIndex */)) = fsBestIndex                                                // test_fs.c:802:3:
 82071  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 16 /* .xDisconnect */)) = fsDisconnect                                                       // test_fs.c:803:3:
 82072  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 20 /* .xDestroy */)) = fsDisconnect                                                          // test_fs.c:804:3:
 82073  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 24 /* .xOpen */)) = fsOpen                                                          // test_fs.c:805:3:
 82074  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 28 /* .xClose */)) = fsClose                                                                 // test_fs.c:806:3:
 82075  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 32 /* .xFilter */)) = fsFilter                               // test_fs.c:807:3:
 82076  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 36 /* .xNext */)) = fsNext                                                                   // test_fs.c:808:3:
 82077  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 40 /* .xEof */)) = fsEof                                                                     // test_fs.c:809:3:
 82078  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 44 /* .xColumn */)) = fsColumn                                               // test_fs.c:810:3:
 82079  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsModule)) + 48 /* .xRowid */)) = fsRowid                                                        // test_fs.c:811:3:
 82080  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 4 /* .xClose */)) = fsClose1                                                            // test_onefile.c:210:3:
 82081  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 8 /* .xRead */)) = fsRead                                // test_onefile.c:211:3:
 82082  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 12 /* .xWrite */)) = fsWrite                             // test_onefile.c:212:3:
 82083  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 16 /* .xTruncate */)) = fsTruncate                                       // test_onefile.c:213:3:
 82084  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 20 /* .xSync */)) = fsSync                                                       // test_onefile.c:214:3:
 82085  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 24 /* .xFileSize */)) = fsFileSize                                             // test_onefile.c:215:3:
 82086  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 28 /* .xLock */)) = fsLock                                                       // test_onefile.c:216:3:
 82087  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 32 /* .xUnlock */)) = fsUnlock                                                   // test_onefile.c:217:3:
 82088  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 36 /* .xCheckReservedLock */)) = fsCheckReservedLock                           // test_onefile.c:218:3:
 82089  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 40 /* .xFileControl */)) = fsFileControl                                // test_onefile.c:219:3:
 82090  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 44 /* .xSectorSize */)) = fsSectorSize                                                  // test_onefile.c:220:3:
 82091  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_io_methods)) + 48 /* .xDeviceCharacteristics */)) = fsDeviceCharacteristics                            // test_onefile.c:221:3:
 82092  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 24 /* .xOpen */)) = fsOpen1                                  // test_onefile.c:191:5:
 82093  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 28 /* .xDelete */)) = fsDelete                                                 // test_onefile.c:192:5:
 82094  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 32 /* .xAccess */)) = fsAccess                                        // test_onefile.c:193:5:
 82095  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 36 /* .xFullPathname */)) = fsFullPathname                            // test_onefile.c:194:5:
 82096  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 40 /* .xDlOpen */)) = fsDlOpen                                                      // test_onefile.c:195:5:
 82097  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 44 /* .xDlError */)) = fsDlError                                                     // test_onefile.c:196:5:
 82098  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 48 /* .xDlSym */)) = fsDlSym                                               // test_onefile.c:197:5:
 82099  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 52 /* .xDlClose */)) = fsDlClose                                                            // test_onefile.c:198:5:
 82100  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 56 /* .xRandomness */)) = fsRandomness                                         // test_onefile.c:199:5:
 82101  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 60 /* .xSleep */)) = fsSleep                                                            // test_onefile.c:200:5:
 82102  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fs_vfs)) + 64 /* .xCurrentTime */)) = fsCurrentTime                                              // test_onefile.c:201:5:
 82103  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 4 /* .xCreate */)) = fsdirConnect1             // test_fs.c:823:3:
 82104  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 8 /* .xConnect */)) = fsdirConnect1            // test_fs.c:824:3:
 82105  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 12 /* .xBestIndex */)) = fsdirBestIndex1                                         // test_fs.c:825:3:
 82106  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 16 /* .xDisconnect */)) = fsdirDisconnect1                                                // test_fs.c:826:3:
 82107  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 20 /* .xDestroy */)) = fsdirDisconnect1                                                   // test_fs.c:827:3:
 82108  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 24 /* .xOpen */)) = fsdirOpen1                                                   // test_fs.c:828:3:
 82109  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 28 /* .xClose */)) = fsdirClose1                                                          // test_fs.c:829:3:
 82110  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 32 /* .xFilter */)) = fsdirFilter1                        // test_fs.c:830:3:
 82111  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 36 /* .xNext */)) = fsdirNext1                                                            // test_fs.c:831:3:
 82112  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 40 /* .xEof */)) = fsdirEof1                                                              // test_fs.c:832:3:
 82113  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 44 /* .xColumn */)) = fsdirColumn1                                        // test_fs.c:833:3:
 82114  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule)) + 48 /* .xRowid */)) = fsdirRowid1                                                 // test_fs.c:834:3:
 82115  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 8 /* .xConnect */)) = fsdirConnect            // fileio.c:942:5:
 82116  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 12 /* .xBestIndex */)) = fsdirBestIndex                                         // fileio.c:943:5:
 82117  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 16 /* .xDisconnect */)) = fsdirDisconnect                                                // fileio.c:944:5:
 82118  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 24 /* .xOpen */)) = fsdirOpen                                                   // fileio.c:946:5:
 82119  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 28 /* .xClose */)) = fsdirClose                                                          // fileio.c:947:5:
 82120  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 32 /* .xFilter */)) = fsdirFilter                        // fileio.c:948:5:
 82121  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 36 /* .xNext */)) = fsdirNext                                                            // fileio.c:949:5:
 82122  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 40 /* .xEof */)) = fsdirEof                                                              // fileio.c:950:5:
 82123  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 44 /* .xColumn */)) = fsdirColumn                                        // fileio.c:951:5:
 82124  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fsdirModule1)) + 48 /* .xRowid */)) = fsdirRowid                                                 // fileio.c:952:5:
 82125  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 4 /* .xCreate */)) = fstreeConnect            // test_fs.c:846:3:
 82126  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 8 /* .xConnect */)) = fstreeConnect           // test_fs.c:847:3:
 82127  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 12 /* .xBestIndex */)) = fstreeBestIndex                                        // test_fs.c:848:3:
 82128  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 16 /* .xDisconnect */)) = fstreeDisconnect                                               // test_fs.c:849:3:
 82129  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 20 /* .xDestroy */)) = fstreeDisconnect                                                  // test_fs.c:850:3:
 82130  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 24 /* .xOpen */)) = fstreeOpen                                                  // test_fs.c:851:3:
 82131  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 28 /* .xClose */)) = fstreeClose                                                         // test_fs.c:852:3:
 82132  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 32 /* .xFilter */)) = fstreeFilter                       // test_fs.c:853:3:
 82133  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 36 /* .xNext */)) = fstreeNext                                                           // test_fs.c:854:3:
 82134  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 40 /* .xEof */)) = fstreeEof                                                             // test_fs.c:855:3:
 82135  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 44 /* .xColumn */)) = fstreeColumn                                       // test_fs.c:856:3:
 82136  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fstreeModule)) + 48 /* .xRowid */)) = fstreeRowid                                                // test_fs.c:857:3:
 82137  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 4 /* .xCreate */)) = fts5tokConnectMethod   // fts5_test_tok.c:453:6:
 82138  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 8 /* .xConnect */)) = fts5tokConnectMethod  // fts5_test_tok.c:454:6:
 82139  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 12 /* .xBestIndex */)) = fts5tokBestIndexMethod                               // fts5_test_tok.c:455:6:
 82140  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 16 /* .xDisconnect */)) = fts5tokDisconnectMethod                                      // fts5_test_tok.c:456:6:
 82141  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 20 /* .xDestroy */)) = fts5tokDisconnectMethod                                         // fts5_test_tok.c:457:6:
 82142  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 24 /* .xOpen */)) = fts5tokOpenMethod                                         // fts5_test_tok.c:458:6:
 82143  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 28 /* .xClose */)) = fts5tokCloseMethod                                                // fts5_test_tok.c:459:6:
 82144  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 32 /* .xFilter */)) = fts5tokFilterMethod              // fts5_test_tok.c:460:6:
 82145  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 36 /* .xNext */)) = fts5tokNextMethod                                                  // fts5_test_tok.c:461:6:
 82146  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 40 /* .xEof */)) = fts5tokEofMethod                                                    // fts5_test_tok.c:462:6:
 82147  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 44 /* .xColumn */)) = fts5tokColumnMethod                              // fts5_test_tok.c:463:6:
 82148  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fts5tok_module)) + 48 /* .xRowid */)) = fts5tokRowidMethod                                       // fts5_test_tok.c:464:6:
 82149  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 4 /* .xCreate */)) = fuzzerConnect            // fuzzer.c:1149:3:
 82150  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 8 /* .xConnect */)) = fuzzerConnect           // fuzzer.c:1150:3:
 82151  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 12 /* .xBestIndex */)) = fuzzerBestIndex                                        // fuzzer.c:1151:3:
 82152  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 16 /* .xDisconnect */)) = fuzzerDisconnect                                               // fuzzer.c:1152:3:
 82153  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 20 /* .xDestroy */)) = fuzzerDisconnect                                                  // fuzzer.c:1153:3:
 82154  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 24 /* .xOpen */)) = fuzzerOpen                                                  // fuzzer.c:1154:3:
 82155  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 28 /* .xClose */)) = fuzzerClose                                                         // fuzzer.c:1155:3:
 82156  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 32 /* .xFilter */)) = fuzzerFilter                       // fuzzer.c:1156:3:
 82157  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 36 /* .xNext */)) = fuzzerNext                                                           // fuzzer.c:1157:3:
 82158  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 40 /* .xEof */)) = fuzzerEof                                                             // fuzzer.c:1158:3:
 82159  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 44 /* .xColumn */)) = fuzzerColumn                                       // fuzzer.c:1159:3:
 82160  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&fuzzerModule)) + 48 /* .xRowid */)) = fuzzerRowid                                                // fuzzer.c:1160:3:
 82161  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 4 /* .xCreate */)) = intarrayCreate         // test_intarray.c:189:3:
 82162  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 8 /* .xConnect */)) = intarrayCreate        // test_intarray.c:190:3:
 82163  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 12 /* .xBestIndex */)) = intarrayBestIndex                                    // test_intarray.c:191:3:
 82164  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 16 /* .xDisconnect */)) = intarrayDestroy                                              // test_intarray.c:192:3:
 82165  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 20 /* .xDestroy */)) = intarrayDestroy                                                 // test_intarray.c:193:3:
 82166  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 24 /* .xOpen */)) = intarrayOpen                                              // test_intarray.c:194:3:
 82167  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 28 /* .xClose */)) = intarrayClose                                                     // test_intarray.c:195:3:
 82168  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 32 /* .xFilter */)) = intarrayFilter                   // test_intarray.c:196:3:
 82169  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 36 /* .xNext */)) = intarrayNext                                                       // test_intarray.c:197:3:
 82170  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 40 /* .xEof */)) = intarrayEof                                                         // test_intarray.c:198:3:
 82171  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 44 /* .xColumn */)) = intarrayColumn                                   // test_intarray.c:199:3:
 82172  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&intarrayModule)) + 48 /* .xRowid */)) = intarrayRowid                                            // test_intarray.c:200:3:
 82173  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 4 /* .xClose */)) = jtClose                                                             // test_journal.c:189:3:
 82174  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 8 /* .xRead */)) = jtRead                                // test_journal.c:190:3:
 82175  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 12 /* .xWrite */)) = jtWrite                             // test_journal.c:191:3:
 82176  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 16 /* .xTruncate */)) = jtTruncate                                       // test_journal.c:192:3:
 82177  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 20 /* .xSync */)) = jtSync                                                       // test_journal.c:193:3:
 82178  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 24 /* .xFileSize */)) = jtFileSize                                             // test_journal.c:194:3:
 82179  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 28 /* .xLock */)) = jtLock                                                       // test_journal.c:195:3:
 82180  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 32 /* .xUnlock */)) = jtUnlock                                                   // test_journal.c:196:3:
 82181  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 36 /* .xCheckReservedLock */)) = jtCheckReservedLock                           // test_journal.c:197:3:
 82182  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 40 /* .xFileControl */)) = jtFileControl                                // test_journal.c:198:3:
 82183  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 44 /* .xSectorSize */)) = jtSectorSize                                                  // test_journal.c:199:3:
 82184  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_io_methods)) + 48 /* .xDeviceCharacteristics */)) = jtDeviceCharacteristics                            // test_journal.c:200:3:
 82185  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 24 /* .xOpen */)) = jtOpen                                   // test_journal.c:172:3:
 82186  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 28 /* .xDelete */)) = jtDelete                                                 // test_journal.c:173:3:
 82187  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 32 /* .xAccess */)) = jtAccess                                        // test_journal.c:174:3:
 82188  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 36 /* .xFullPathname */)) = jtFullPathname                            // test_journal.c:175:3:
 82189  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 40 /* .xDlOpen */)) = jtDlOpen                                                      // test_journal.c:176:3:
 82190  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 44 /* .xDlError */)) = jtDlError                                                     // test_journal.c:177:3:
 82191  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 48 /* .xDlSym */)) = jtDlSym                                               // test_journal.c:178:3:
 82192  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 52 /* .xDlClose */)) = jtDlClose                                                            // test_journal.c:179:3:
 82193  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 56 /* .xRandomness */)) = jtRandomness                                         // test_journal.c:180:3:
 82194  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 60 /* .xSleep */)) = jtSleep                                                            // test_journal.c:181:3:
 82195  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 64 /* .xCurrentTime */)) = jtCurrentTime                                              // test_journal.c:182:3:
 82196  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 68 /* .xGetLastError */)) = jtGetLastError                                     // test_journal.c:183:3:
 82197  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&jt_vfs)) + 72 /* .xCurrentTimeInt64 */)) = jtCurrentTimeInt64                                    // test_journal.c:184:3:
 82198  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 8 /* .xConnect */)) = prefixesConnect       // prefixes.c:230:21:
 82199  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 12 /* .xBestIndex */)) = prefixesBestIndex                                    // prefixes.c:231:21:
 82200  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 16 /* .xDisconnect */)) = prefixesDisconnect                                           // prefixes.c:232:21:
 82201  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 24 /* .xOpen */)) = prefixesOpen                                              // prefixes.c:234:21:
 82202  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 28 /* .xClose */)) = prefixesClose                                                     // prefixes.c:235:21:
 82203  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 32 /* .xFilter */)) = prefixesFilter                   // prefixes.c:236:21:
 82204  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 36 /* .xNext */)) = prefixesNext                                                       // prefixes.c:237:21:
 82205  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 40 /* .xEof */)) = prefixesEof                                                         // prefixes.c:238:21:
 82206  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 44 /* .xColumn */)) = prefixesColumn                                   // prefixes.c:239:21:
 82207  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&prefixesModule)) + 48 /* .xRowid */)) = prefixesRowid                                            // prefixes.c:240:21:
 82208  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&pzNeededCollation)) + 0)) = uintptr(unsafe.Pointer(&zNeededCollation))                                                           // test1.c:3130:34:
 82209  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 4 /* .xCreate */)) = schemaCreate             // test_schema.c:276:3:
 82210  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 8 /* .xConnect */)) = schemaCreate            // test_schema.c:277:3:
 82211  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 12 /* .xBestIndex */)) = schemaBestIndex                                        // test_schema.c:278:3:
 82212  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 16 /* .xDisconnect */)) = schemaDestroy                                                  // test_schema.c:279:3:
 82213  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 20 /* .xDestroy */)) = schemaDestroy                                                     // test_schema.c:280:3:
 82214  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 24 /* .xOpen */)) = schemaOpen                                                  // test_schema.c:281:3:
 82215  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 28 /* .xClose */)) = schemaClose                                                         // test_schema.c:282:3:
 82216  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 32 /* .xFilter */)) = schemaFilter                       // test_schema.c:283:3:
 82217  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 36 /* .xNext */)) = schemaNext                                                           // test_schema.c:284:3:
 82218  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 40 /* .xEof */)) = schemaEof                                                             // test_schema.c:285:3:
 82219  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 44 /* .xColumn */)) = schemaColumn                                       // test_schema.c:286:3:
 82220  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&schemaModule)) + 48 /* .xRowid */)) = schemaRowid                                                // test_schema.c:287:3:
 82221  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 8 /* .xConnect */)) = seriesConnect           // series.c:400:3:
 82222  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 12 /* .xBestIndex */)) = seriesBestIndex                                        // series.c:401:3:
 82223  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 16 /* .xDisconnect */)) = seriesDisconnect                                               // series.c:402:3:
 82224  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 24 /* .xOpen */)) = seriesOpen                                                  // series.c:404:3:
 82225  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 28 /* .xClose */)) = seriesClose                                                         // series.c:405:3:
 82226  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 32 /* .xFilter */)) = seriesFilter                       // series.c:406:3:
 82227  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 36 /* .xNext */)) = seriesNext                                                           // series.c:407:3:
 82228  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 40 /* .xEof */)) = seriesEof                                                             // series.c:408:3:
 82229  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 44 /* .xColumn */)) = seriesColumn                                       // series.c:409:3:
 82230  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&seriesModule)) + 48 /* .xRowid */)) = seriesRowid                                                // series.c:410:3:
 82231  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 4 /* .xCreate */)) = spellfix1Create       // spellfix.c:2993:3:
 82232  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 8 /* .xConnect */)) = spellfix1Connect     // spellfix.c:2994:3:
 82233  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 12 /* .xBestIndex */)) = spellfix1BestIndex                                  // spellfix.c:2995:3:
 82234  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 16 /* .xDisconnect */)) = spellfix1Disconnect                                         // spellfix.c:2996:3:
 82235  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 20 /* .xDestroy */)) = spellfix1Destroy                                               // spellfix.c:2997:3:
 82236  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 24 /* .xOpen */)) = spellfix1Open                                            // spellfix.c:2998:3:
 82237  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 28 /* .xClose */)) = spellfix1Close                                                   // spellfix.c:2999:3:
 82238  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 32 /* .xFilter */)) = spellfix1Filter                 // spellfix.c:3000:3:
 82239  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 36 /* .xNext */)) = spellfix1Next                                                     // spellfix.c:3001:3:
 82240  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 40 /* .xEof */)) = spellfix1Eof                                                       // spellfix.c:3002:3:
 82241  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 44 /* .xColumn */)) = spellfix1Column                                 // spellfix.c:3003:3:
 82242  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 48 /* .xRowid */)) = spellfix1Rowid                                          // spellfix.c:3004:3:
 82243  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 52 /* .xUpdate */)) = spellfix1Update                        // spellfix.c:3005:3:
 82244  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&spellfix1Module)) + 76 /* .xRename */)) = spellfix1Rename                                        // spellfix.c:3011:3:
 82245  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 4 /* .xCreate */)) = tclConnect                  // test_bestindex.c:551:3:
 82246  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 8 /* .xConnect */)) = tclConnect                 // test_bestindex.c:552:3:
 82247  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 12 /* .xBestIndex */)) = tclBestIndex                                              // test_bestindex.c:553:3:
 82248  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 16 /* .xDisconnect */)) = tclDisconnect                                                     // test_bestindex.c:554:3:
 82249  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 20 /* .xDestroy */)) = tclDisconnect                                                        // test_bestindex.c:555:3:
 82250  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 24 /* .xOpen */)) = tclOpen                                                        // test_bestindex.c:556:3:
 82251  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 28 /* .xClose */)) = tclClose                                                               // test_bestindex.c:557:3:
 82252  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 32 /* .xFilter */)) = tclFilter                             // test_bestindex.c:558:3:
 82253  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 36 /* .xNext */)) = tclNext                                                                 // test_bestindex.c:559:3:
 82254  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 40 /* .xEof */)) = tclEof                                                                   // test_bestindex.c:560:3:
 82255  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 44 /* .xColumn */)) = tclColumn                                             // test_bestindex.c:561:3:
 82256  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclModule)) + 48 /* .xRowid */)) = tclRowid                                                      // test_bestindex.c:562:3:
 82257  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 4 /* .xCreate */)) = tclvarConnect            // test_tclvar.c:471:3:
 82258  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 8 /* .xConnect */)) = tclvarConnect           // test_tclvar.c:472:3:
 82259  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 12 /* .xBestIndex */)) = tclvarBestIndex                                        // test_tclvar.c:473:3:
 82260  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 16 /* .xDisconnect */)) = tclvarDisconnect                                               // test_tclvar.c:474:3:
 82261  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 20 /* .xDestroy */)) = tclvarDisconnect                                                  // test_tclvar.c:475:3:
 82262  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 24 /* .xOpen */)) = tclvarOpen                                                  // test_tclvar.c:476:3:
 82263  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 28 /* .xClose */)) = tclvarClose                                                         // test_tclvar.c:477:3:
 82264  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 32 /* .xFilter */)) = tclvarFilter                       // test_tclvar.c:478:3:
 82265  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 36 /* .xNext */)) = tclvarNext                                                           // test_tclvar.c:479:3:
 82266  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 40 /* .xEof */)) = tclvarEof                                                             // test_tclvar.c:480:3:
 82267  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 44 /* .xColumn */)) = tclvarColumn                                       // test_tclvar.c:481:3:
 82268  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 48 /* .xRowid */)) = tclvarRowid                                                // test_tclvar.c:482:3:
 82269  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tclvarModule)) + 52 /* .xUpdate */)) = tclvarUpdate                              // test_tclvar.c:483:3:
 82270  	*(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 4 /* .pArg */)) = uintptr(unsafe.Pointer(&testpcacheGlobal))                                                      // test_pcache.c:435:5:
 82271  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 8 /* .xInit */)) = testpcacheInit                                                          // test_pcache.c:436:5:
 82272  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 12 /* .xShutdown */)) = testpcacheShutdown                                                       // test_pcache.c:437:5:
 82273  	*(*func(*libc.TLS, int32, int32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 16 /* .xCreate */)) = testpcacheCreate                                       // test_pcache.c:438:5:
 82274  	*(*func(*libc.TLS, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 20 /* .xCachesize */)) = testpcacheCachesize                                              // test_pcache.c:439:5:
 82275  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 24 /* .xPagecount */)) = testpcachePagecount                                               // test_pcache.c:440:5:
 82276  	*(*func(*libc.TLS, uintptr, uint32, int32) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 28 /* .xFetch */)) = testpcacheFetch                                      // test_pcache.c:441:5:
 82277  	*(*func(*libc.TLS, uintptr, uintptr, int32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 32 /* .xUnpin */)) = testpcacheUnpin                                             // test_pcache.c:442:5:
 82278  	*(*func(*libc.TLS, uintptr, uintptr, uint32, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 36 /* .xRekey */)) = testpcacheRekey                                    // test_pcache.c:443:5:
 82279  	*(*func(*libc.TLS, uintptr, uint32))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 40 /* .xTruncate */)) = testpcacheTruncate                                               // test_pcache.c:444:5:
 82280  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&testPcache)) + 44 /* .xDestroy */)) = testpcacheDestroy                                                         // test_pcache.c:445:5:
 82281  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 4 /* .xClose */)) = tmpClose                                                           // test_onefile.c:231:3:
 82282  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 8 /* .xRead */)) = tmpRead                              // test_onefile.c:232:3:
 82283  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 12 /* .xWrite */)) = tmpWrite                           // test_onefile.c:233:3:
 82284  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 16 /* .xTruncate */)) = tmpTruncate                                     // test_onefile.c:234:3:
 82285  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 20 /* .xSync */)) = tmpSync                                                     // test_onefile.c:235:3:
 82286  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 24 /* .xFileSize */)) = tmpFileSize                                           // test_onefile.c:236:3:
 82287  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 28 /* .xLock */)) = tmpLock                                                     // test_onefile.c:237:3:
 82288  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 32 /* .xUnlock */)) = tmpUnlock                                                 // test_onefile.c:238:3:
 82289  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 36 /* .xCheckReservedLock */)) = tmpCheckReservedLock                         // test_onefile.c:239:3:
 82290  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 40 /* .xFileControl */)) = tmpFileControl                              // test_onefile.c:240:3:
 82291  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 44 /* .xSectorSize */)) = tmpSectorSize                                                // test_onefile.c:241:3:
 82292  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tmp_io_methods)) + 48 /* .xDeviceCharacteristics */)) = tmpDeviceCharacteristics                          // test_onefile.c:242:3:
 82293  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 4 /* .xClose */)) = tvfsClose                                                         // test_vfs.c:206:3:
 82294  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 8 /* .xRead */)) = tvfsRead                            // test_vfs.c:207:3:
 82295  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 12 /* .xWrite */)) = tvfsWrite                         // test_vfs.c:208:3:
 82296  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 16 /* .xTruncate */)) = tvfsTruncate                                   // test_vfs.c:209:3:
 82297  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 20 /* .xSync */)) = tvfsSync                                                   // test_vfs.c:210:3:
 82298  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 24 /* .xFileSize */)) = tvfsFileSize                                         // test_vfs.c:211:3:
 82299  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 28 /* .xLock */)) = tvfsLock                                                   // test_vfs.c:212:3:
 82300  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 32 /* .xUnlock */)) = tvfsUnlock                                               // test_vfs.c:213:3:
 82301  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 36 /* .xCheckReservedLock */)) = tvfsCheckReservedLock                       // test_vfs.c:214:3:
 82302  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 40 /* .xFileControl */)) = tvfsFileControl                            // test_vfs.c:215:3:
 82303  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 44 /* .xSectorSize */)) = tvfsSectorSize                                              // test_vfs.c:216:3:
 82304  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 48 /* .xDeviceCharacteristics */)) = tvfsDeviceCharacteristics                        // test_vfs.c:217:3:
 82305  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 52 /* .xShmMap */)) = tvfsShmMap                        // test_vfs.c:218:3:
 82306  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 56 /* .xShmLock */)) = tvfsShmLock                               // test_vfs.c:219:3:
 82307  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 60 /* .xShmBarrier */)) = tvfsShmBarrier                                                    // test_vfs.c:220:3:
 82308  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 64 /* .xShmUnmap */)) = tvfsShmUnmap                                           // test_vfs.c:221:3:
 82309  	*(*func(*libc.TLS, uintptr, sqlite3_int64, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 68 /* .xFetch */)) = tvfsFetch                         // test_vfs.c:222:3:
 82310  	*(*func(*libc.TLS, uintptr, sqlite3_int64, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_io_methods)) + 72 /* .xUnfetch */)) = tvfsUnfetch                            // test_vfs.c:223:3:
 82311  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 24 /* .xOpen */)) = tvfsOpen                               // test_vfs.c:1451:5:
 82312  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 28 /* .xDelete */)) = tvfsDelete                                             // test_vfs.c:1452:5:
 82313  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 32 /* .xAccess */)) = tvfsAccess                                    // test_vfs.c:1453:5:
 82314  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 36 /* .xFullPathname */)) = tvfsFullPathname                        // test_vfs.c:1454:5:
 82315  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 56 /* .xRandomness */)) = tvfsRandomness                                     // test_vfs.c:1466:5:
 82316  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 60 /* .xSleep */)) = tvfsSleep                                                        // test_vfs.c:1467:5:
 82317  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&tvfs_vfs)) + 64 /* .xCurrentTime */)) = tvfsCurrentTime                                          // test_vfs.c:1468:5:
 82318  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 4 /* .xCreate */)) = unionConnect              // unionvtab.c:1332:5:
 82319  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 8 /* .xConnect */)) = unionConnect             // unionvtab.c:1333:5:
 82320  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 12 /* .xBestIndex */)) = unionBestIndex                                          // unionvtab.c:1334:5:
 82321  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 16 /* .xDisconnect */)) = unionDisconnect                                                 // unionvtab.c:1335:5:
 82322  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 20 /* .xDestroy */)) = unionDisconnect                                                    // unionvtab.c:1336:5:
 82323  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 24 /* .xOpen */)) = unionOpen                                                    // unionvtab.c:1337:5:
 82324  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 28 /* .xClose */)) = unionClose                                                           // unionvtab.c:1338:5:
 82325  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 32 /* .xFilter */)) = unionFilter                         // unionvtab.c:1339:5:
 82326  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 36 /* .xNext */)) = unionNext                                                             // unionvtab.c:1340:5:
 82327  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 40 /* .xEof */)) = unionEof                                                               // unionvtab.c:1341:5:
 82328  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 44 /* .xColumn */)) = unionColumn                                         // unionvtab.c:1342:5:
 82329  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&unionModule)) + 48 /* .xRowid */)) = unionRowid                                                  // unionvtab.c:1343:5:
 82330  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 4 /* .xClose */)) = vfslogClose                                                     // test_osinst.c:204:3:
 82331  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 8 /* .xRead */)) = vfslogRead                        // test_osinst.c:205:3:
 82332  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 12 /* .xWrite */)) = vfslogWrite                     // test_osinst.c:206:3:
 82333  	*(*func(*libc.TLS, uintptr, sqlite3_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 16 /* .xTruncate */)) = vfslogTruncate                               // test_osinst.c:207:3:
 82334  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 20 /* .xSync */)) = vfslogSync                                               // test_osinst.c:208:3:
 82335  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 24 /* .xFileSize */)) = vfslogFileSize                                     // test_osinst.c:209:3:
 82336  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 28 /* .xLock */)) = vfslogLock                                               // test_osinst.c:210:3:
 82337  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 32 /* .xUnlock */)) = vfslogUnlock                                           // test_osinst.c:211:3:
 82338  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 36 /* .xCheckReservedLock */)) = vfslogCheckReservedLock                   // test_osinst.c:212:3:
 82339  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 40 /* .xFileControl */)) = vfslogFileControl                        // test_osinst.c:213:3:
 82340  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 44 /* .xSectorSize */)) = vfslogSectorSize                                          // test_osinst.c:214:3:
 82341  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 48 /* .xDeviceCharacteristics */)) = vfslogDeviceCharacteristics                    // test_osinst.c:215:3:
 82342  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 52 /* .xShmMap */)) = vfslogShmMap                    // test_osinst.c:216:3:
 82343  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 56 /* .xShmLock */)) = vfslogShmLock                           // test_osinst.c:217:3:
 82344  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 60 /* .xShmBarrier */)) = vfslogShmBarrier                                                // test_osinst.c:218:3:
 82345  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_io_methods)) + 64 /* .xShmUnmap */)) = vfslogShmUnmap                                       // test_osinst.c:219:3:
 82346  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 4 /* .xCreate */)) = vlogConnect             // test_osinst.c:1074:5:
 82347  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 8 /* .xConnect */)) = vlogConnect            // test_osinst.c:1075:5:
 82348  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 12 /* .xBestIndex */)) = vlogBestIndex                                         // test_osinst.c:1076:5:
 82349  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 16 /* .xDisconnect */)) = vlogDisconnect                                                // test_osinst.c:1077:5:
 82350  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 20 /* .xDestroy */)) = vlogDisconnect                                                   // test_osinst.c:1078:5:
 82351  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 24 /* .xOpen */)) = vlogOpen                                                   // test_osinst.c:1079:5:
 82352  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 28 /* .xClose */)) = vlogClose                                                          // test_osinst.c:1080:5:
 82353  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 32 /* .xFilter */)) = vlogFilter                        // test_osinst.c:1081:5:
 82354  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 36 /* .xNext */)) = vlogNext                                                            // test_osinst.c:1082:5:
 82355  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 40 /* .xEof */)) = vlogEof                                                              // test_osinst.c:1083:5:
 82356  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 44 /* .xColumn */)) = vlogColumn                                        // test_osinst.c:1084:5:
 82357  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_module)) + 48 /* .xRowid */)) = vlogRowid                                                 // test_osinst.c:1085:5:
 82358  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 24 /* .xOpen */)) = vfslogOpen                           // test_osinst.c:187:3:
 82359  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 28 /* .xDelete */)) = vfslogDelete                                         // test_osinst.c:188:3:
 82360  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 32 /* .xAccess */)) = vfslogAccess                                // test_osinst.c:189:3:
 82361  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 36 /* .xFullPathname */)) = vfslogFullPathname                    // test_osinst.c:190:3:
 82362  	*(*func(*libc.TLS, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 40 /* .xDlOpen */)) = vfslogDlOpen                                              // test_osinst.c:191:3:
 82363  	*(*func(*libc.TLS, uintptr, int32, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 44 /* .xDlError */)) = vfslogDlError                                             // test_osinst.c:192:3:
 82364  	*(*func(*libc.TLS, uintptr, uintptr, uintptr) uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 48 /* .xDlSym */)) = vfslogDlSym                                       // test_osinst.c:193:3:
 82365  	*(*func(*libc.TLS, uintptr, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 52 /* .xDlClose */)) = vfslogDlClose                                                    // test_osinst.c:194:3:
 82366  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 56 /* .xRandomness */)) = vfslogRandomness                                 // test_osinst.c:195:3:
 82367  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 60 /* .xSleep */)) = vfslogSleep                                                    // test_osinst.c:196:3:
 82368  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 64 /* .xCurrentTime */)) = vfslogCurrentTime                                      // test_osinst.c:197:3:
 82369  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 68 /* .xGetLastError */)) = vfslogGetLastError                             // test_osinst.c:198:3:
 82370  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&vfslog_vfs)) + 72 /* .xCurrentTimeInt64 */)) = vfslogCurrentTimeInt64                            // test_osinst.c:199:3:
 82371  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 4 /* .xCreate */)) = wholenumberConnect  // wholenumber.c:238:3:
 82372  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 8 /* .xConnect */)) = wholenumberConnect // wholenumber.c:239:3:
 82373  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 12 /* .xBestIndex */)) = wholenumberBestIndex                              // wholenumber.c:240:3:
 82374  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 16 /* .xDisconnect */)) = wholenumberDisconnect                                     // wholenumber.c:241:3:
 82375  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 20 /* .xDestroy */)) = wholenumberDisconnect                                        // wholenumber.c:242:3:
 82376  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 24 /* .xOpen */)) = wholenumberOpen                                        // wholenumber.c:243:3:
 82377  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 28 /* .xClose */)) = wholenumberClose                                               // wholenumber.c:244:3:
 82378  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 32 /* .xFilter */)) = wholenumberFilter             // wholenumber.c:245:3:
 82379  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 36 /* .xNext */)) = wholenumberNext                                                 // wholenumber.c:246:3:
 82380  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 40 /* .xEof */)) = wholenumberEof                                                   // wholenumber.c:247:3:
 82381  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 44 /* .xColumn */)) = wholenumberColumn                             // wholenumber.c:248:3:
 82382  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&wholenumberModule)) + 48 /* .xRowid */)) = wholenumberRowid                                      // wholenumber.c:249:3:
 82383  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 4 /* .xClose */)) = devsymClose                                                 // test_devsym.c:393:3:
 82384  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 8 /* .xRead */)) = devsymRead                     // test_devsym.c:394:3:
 82385  	*(*func(*libc.TLS, uintptr, uintptr, int32, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 12 /* .xWrite */)) = writecrashWrite              // test_devsym.c:395:3:
 82386  	*(*func(*libc.TLS, uintptr, sqlite_int64) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 16 /* .xTruncate */)) = devsymTruncate                            // test_devsym.c:396:3:
 82387  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 20 /* .xSync */)) = devsymSync                                           // test_devsym.c:397:3:
 82388  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 24 /* .xFileSize */)) = devsymFileSize                                 // test_devsym.c:398:3:
 82389  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 28 /* .xLock */)) = devsymLock                                           // test_devsym.c:399:3:
 82390  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 32 /* .xUnlock */)) = devsymUnlock                                       // test_devsym.c:400:3:
 82391  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 36 /* .xCheckReservedLock */)) = devsymCheckReservedLock               // test_devsym.c:401:3:
 82392  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 40 /* .xFileControl */)) = devsymFileControl                    // test_devsym.c:402:3:
 82393  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 44 /* .xSectorSize */)) = writecrashSectorSize                                  // test_devsym.c:403:3:
 82394  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 48 /* .xDeviceCharacteristics */)) = writecrashDeviceCharacteristics            // test_devsym.c:404:3:
 82395  	*(*func(*libc.TLS, uintptr, int32, int32, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 52 /* .xShmMap */)) = devsymShmMap                // test_devsym.c:405:3:
 82396  	*(*func(*libc.TLS, uintptr, int32, int32, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 56 /* .xShmLock */)) = devsymShmLock                       // test_devsym.c:406:3:
 82397  	*(*func(*libc.TLS, uintptr))(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 60 /* .xShmBarrier */)) = devsymShmBarrier                                            // test_devsym.c:407:3:
 82398  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_io_methods)) + 64 /* .xShmUnmap */)) = devsymShmUnmap                                   // test_devsym.c:408:3:
 82399  	*(*func(*libc.TLS, uintptr, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 24 /* .xOpen */)) = writecrashOpen                   // test_devsym.c:457:3:
 82400  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 28 /* .xDelete */)) = devsymDelete                                     // test_devsym.c:458:3:
 82401  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 32 /* .xAccess */)) = devsymAccess                            // test_devsym.c:459:3:
 82402  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 36 /* .xFullPathname */)) = devsymFullPathname                // test_devsym.c:460:3:
 82403  	*(*func(*libc.TLS, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 56 /* .xRandomness */)) = devsymRandomness                             // test_devsym.c:472:3:
 82404  	*(*func(*libc.TLS, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 60 /* .xSleep */)) = devsymSleep                                                // test_devsym.c:473:3:
 82405  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&writecrash_vfs)) + 64 /* .xCurrentTime */)) = devsymCurrentTime                                  // test_devsym.c:474:3:
 82406  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 4 /* .xCreate */)) = zipfileConnect          // zipfile.c:2150:5:
 82407  	*(*func(*libc.TLS, uintptr, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 8 /* .xConnect */)) = zipfileConnect         // zipfile.c:2151:5:
 82408  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 12 /* .xBestIndex */)) = zipfileBestIndex                                      // zipfile.c:2152:5:
 82409  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 16 /* .xDisconnect */)) = zipfileDisconnect                                             // zipfile.c:2153:5:
 82410  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 20 /* .xDestroy */)) = zipfileDisconnect                                                // zipfile.c:2154:5:
 82411  	*(*func(*libc.TLS, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 24 /* .xOpen */)) = zipfileOpen                                                // zipfile.c:2155:5:
 82412  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 28 /* .xClose */)) = zipfileClose                                                       // zipfile.c:2156:5:
 82413  	*(*func(*libc.TLS, uintptr, int32, uintptr, int32, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 32 /* .xFilter */)) = zipfileFilter                     // zipfile.c:2157:5:
 82414  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 36 /* .xNext */)) = zipfileNext                                                         // zipfile.c:2158:5:
 82415  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 40 /* .xEof */)) = zipfileEof                                                           // zipfile.c:2159:5:
 82416  	*(*func(*libc.TLS, uintptr, uintptr, int32) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 44 /* .xColumn */)) = zipfileColumn                                     // zipfile.c:2160:5:
 82417  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 52 /* .xUpdate */)) = zipfileUpdate                            // zipfile.c:2162:5:
 82418  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 56 /* .xBegin */)) = zipfileBegin                                                       // zipfile.c:2163:5:
 82419  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 64 /* .xCommit */)) = zipfileCommit                                                     // zipfile.c:2165:5:
 82420  	*(*func(*libc.TLS, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 68 /* .xRollback */)) = zipfileRollback                                                 // zipfile.c:2166:5:
 82421  	*(*func(*libc.TLS, uintptr, int32, uintptr, uintptr, uintptr) int32)(unsafe.Pointer(uintptr(unsafe.Pointer(&zipfileModule)) + 72 /* .xFindFunction */)) = zipfileFindFunction       // zipfile.c:2167:5:
 82422  }
 82423  
 82424  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"
 82425  var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data