// File: /workspace/github_c_makefile_star2_O2/ukontainer[P]sqlite-bench/sqlite3.c
// Function: openDatabase
static int openDatabase(
  const char *zFilename, /* Database filename UTF-8 encoded */
  sqlite3 **ppDb,        /* OUT: Returned database handle */
  unsigned int flags,    /* Operational flags */
  const char *zVfs       /* Name of the VFS to use */
){
  sqlite3 *db;                    /* Store allocated handle here */
  int rc;                         /* Return code */
  int isThreadsafe;               /* True for threadsafe connections */
  char *zOpen = 0;                /* Filename argument to pass to BtreeOpen() */
  char *zErrMsg = 0;              /* Error message from sqlite3ParseUri() */

#ifdef SQLITE_ENABLE_API_ARMOR
  if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
#endif
  *ppDb = 0;
#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ) return rc;
#endif

  if( sqlite3GlobalConfig.bCoreMutex==0 ){
    isThreadsafe = 0;
  }else if( flags & SQLITE_OPEN_NOMUTEX ){
    isThreadsafe = 0;
  }else if( flags & SQLITE_OPEN_FULLMUTEX ){
    isThreadsafe = 1;
  }else{
    isThreadsafe = sqlite3GlobalConfig.bFullMutex;
  }

  if( flags & SQLITE_OPEN_PRIVATECACHE ){
    flags &= ~SQLITE_OPEN_SHAREDCACHE;
  }else if( sqlite3GlobalConfig.sharedCacheEnabled ){
    flags |= SQLITE_OPEN_SHAREDCACHE;
  }

  /* Remove harmful bits from the flags parameter
  **
  ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were
  ** dealt with in the previous code block.  Besides these, the only
  ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY,
  ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE,
  ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits.  Silently mask
  ** off all other flags.
  */
  flags &=  ~( SQLITE_OPEN_DELETEONCLOSE |
               SQLITE_OPEN_EXCLUSIVE |
               SQLITE_OPEN_MAIN_DB |
               SQLITE_OPEN_TEMP_DB | 
               SQLITE_OPEN_TRANSIENT_DB | 
               SQLITE_OPEN_MAIN_JOURNAL | 
               SQLITE_OPEN_TEMP_JOURNAL | 
               SQLITE_OPEN_SUBJOURNAL | 
               SQLITE_OPEN_MASTER_JOURNAL |
               SQLITE_OPEN_NOMUTEX |
               SQLITE_OPEN_FULLMUTEX |
               SQLITE_OPEN_WAL
             );

  /* Allocate the sqlite data structure */
  db = sqlite3MallocZero( sizeof(sqlite3) );
  if( db==0 ) goto opendb_out;
  if( isThreadsafe 
#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS
   || sqlite3GlobalConfig.bCoreMutex
#endif
  ){
    db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
    if( db->mutex==0 ){
      sqlite3_free(db);
      db = 0;
      goto opendb_out;
    }
    if( isThreadsafe==0 ){
      sqlite3MutexWarnOnContention(db->mutex);
    }
  }
  sqlite3_mutex_enter(db->mutex);
  db->errMask = 0xff;
  db->nDb = 2;
  db->magic = SQLITE_MAGIC_BUSY;
  db->aDb = db->aDbStatic;
  db->lookaside.bDisable = 1;

  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
  db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS;
  db->autoCommit = 1;
  db->nextAutovac = -1;
  db->szMmap = sqlite3GlobalConfig.szMmap;
  db->nextPagesize = 0;
  db->nMaxSorterMmap = 0x7FFFFFFF;
  db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill
#if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX
                 | SQLITE_AutoIndex
#endif
#if SQLITE_DEFAULT_CKPTFULLFSYNC
                 | SQLITE_CkptFullFSync
#endif
#if SQLITE_DEFAULT_FILE_FORMAT<4
                 | SQLITE_LegacyFileFmt
#endif
#ifdef SQLITE_ENABLE_LOAD_EXTENSION
                 | SQLITE_LoadExtension
#endif
#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS
                 | SQLITE_RecTriggers
#endif
#if defined(SQLITE_DEFAULT_FOREIGN_KEYS) && SQLITE_DEFAULT_FOREIGN_KEYS
                 | SQLITE_ForeignKeys
#endif
#if defined(SQLITE_REVERSE_UNORDERED_SELECTS)
                 | SQLITE_ReverseOrder
#endif
#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK)
                 | SQLITE_CellSizeCk
#endif
#if defined(SQLITE_ENABLE_FTS3_TOKENIZER)
                 | SQLITE_Fts3Tokenizer
#endif
#if defined(SQLITE_ENABLE_QPSG)
                 | SQLITE_EnableQPSG
#endif
      ;
  sqlite3HashInit(&db->aCollSeq);
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3HashInit(&db->aModule);
#endif

  /* Add the default collation sequence BINARY. BINARY works for both UTF-8
  ** and UTF-16, so add a version for each to avoid any unnecessary
  ** conversions. The only error that can occur here is a malloc() failure.
  **
  ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating
  ** functions:
  */
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0);
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0);
  createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0);
  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
  createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
  if( db->mallocFailed ){
    goto opendb_out;
  }
  /* EVIDENCE-OF: R-08308-17224 The default collating function for all
  ** strings is BINARY. 
  */
  db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
  assert( db->pDfltColl!=0 );

  /* Parse the filename/URI argument
  **
  ** Only allow sensible combinations of bits in the flags argument.  
  ** Throw an error if any non-sense combination is used.  If we
  ** do not block illegal combinations here, it could trigger
  ** assert() statements in deeper layers.  Sensible combinations
  ** are:
  **
  **  1:  SQLITE_OPEN_READONLY
  **  2:  SQLITE_OPEN_READWRITE
  **  6:  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
  */
  db->openFlags = flags;
  assert( SQLITE_OPEN_READONLY  == 0x01 );
  assert( SQLITE_OPEN_READWRITE == 0x02 );
  assert( SQLITE_OPEN_CREATE    == 0x04 );
  testcase( (1<<(flags&7))==0x02 ); /* READONLY */
  testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
  testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
  if( ((1<<(flags&7)) & 0x46)==0 ){
    rc = SQLITE_MISUSE_BKPT;  /* IMP: R-65497-44594 */
  }else{
    rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
  }
  if( rc!=SQLITE_OK ){
    if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
    sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
    sqlite3_free(zErrMsg);
    goto opendb_out;
  }

  /* Open the backend database driver */
  rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0,
                        flags | SQLITE_OPEN_MAIN_DB);
  if( rc!=SQLITE_OK ){
    if( rc==SQLITE_IOERR_NOMEM ){
      rc = SQLITE_NOMEM_BKPT;
    }
    sqlite3Error(db, rc);
    goto opendb_out;
  }
  sqlite3BtreeEnter(db->aDb[0].pBt);
  db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
  if( !db->mallocFailed ) ENC(db) = SCHEMA_ENC(db);
  sqlite3BtreeLeave(db->aDb[0].pBt);
  db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);

  /* The default safety_level for the main database is FULL; for the temp
  ** database it is OFF. This matches the pager layer defaults.  
  */
  db->aDb[0].zDbSName = "main";
  db->aDb[0].safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
  db->aDb[1].zDbSName = "temp";
  db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF;

  db->magic = SQLITE_MAGIC_OPEN;
  if( db->mallocFailed ){
    goto opendb_out;
  }

  /* Register all built-in functions, but do not attempt to read the
  ** database schema yet. This is delayed until the first time the database
  ** is accessed.
  */
  sqlite3Error(db, SQLITE_OK);
  sqlite3RegisterPerConnectionBuiltinFunctions(db);
  rc = sqlite3_errcode(db);

#ifdef SQLITE_ENABLE_FTS5
  /* Register any built-in FTS5 module before loading the automatic
  ** extensions. This allows automatic extensions to register FTS5 
  ** tokenizers and auxiliary functions.  */
  if( !db->mallocFailed && rc==SQLITE_OK ){
    rc = sqlite3Fts5Init(db);
  }
#endif

  /* Load automatic extensions - extensions that have been registered
  ** using the sqlite3_automatic_extension() API.
  */
  if( rc==SQLITE_OK ){
    sqlite3AutoLoadExtensions(db);
    rc = sqlite3_errcode(db);
    if( rc!=SQLITE_OK ){
      goto opendb_out;
    }
  }

#ifdef SQLITE_ENABLE_FTS1
  if( !db->mallocFailed ){
    extern int sqlite3Fts1Init(sqlite3*);
    rc = sqlite3Fts1Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS2
  if( !db->mallocFailed && rc==SQLITE_OK ){
    extern int sqlite3Fts2Init(sqlite3*);
    rc = sqlite3Fts2Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS3 /* automatically defined by SQLITE_ENABLE_FTS4 */
  if( !db->mallocFailed && rc==SQLITE_OK ){
    rc = sqlite3Fts3Init(db);
  }
#endif

#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
  if( !db->mallocFailed && rc==SQLITE_OK ){
    rc = sqlite3IcuInit(db);
  }
#endif

#ifdef SQLITE_ENABLE_RTREE
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3RtreeInit(db);
  }
#endif

#ifdef SQLITE_ENABLE_DBPAGE_VTAB
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3DbpageRegister(db);
  }
#endif

#ifdef SQLITE_ENABLE_DBSTAT_VTAB
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3DbstatRegister(db);
  }
#endif

#ifdef SQLITE_ENABLE_JSON1
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3Json1Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_STMTVTAB
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3StmtVtabInit(db);
  }
#endif

  /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
  ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
  ** mode.  Doing nothing at all also makes NORMAL the default.
  */
#ifdef SQLITE_DEFAULT_LOCKING_MODE
  db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
  sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
                          SQLITE_DEFAULT_LOCKING_MODE);
#endif

  if( rc ) sqlite3Error(db, rc);

  /* Enable the lookaside-malloc subsystem */
  setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
                        sqlite3GlobalConfig.nLookaside);

  sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);

opendb_out:
  if( db ){
    assert( db->mutex!=0 || isThreadsafe==0
           || sqlite3GlobalConfig.bFullMutex==0 );
    sqlite3_mutex_leave(db->mutex);
  }
  rc = sqlite3_errcode(db);
  assert( db!=0 || rc==SQLITE_NOMEM );
  if( rc==SQLITE_NOMEM ){
    sqlite3_close(db);
    db = 0;
  }else if( rc!=SQLITE_OK ){
    db->magic = SQLITE_MAGIC_SICK;
  }
  *ppDb = db;
#ifdef SQLITE_ENABLE_SQLLOG
  if( sqlite3GlobalConfig.xSqllog ){
    /* Opening a db handle. Fourth parameter is passed 0. */
    void *pArg = sqlite3GlobalConfig.pSqllogArg;
    sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0);
  }
#endif
#if defined(SQLITE_HAS_CODEC)
  if( rc==SQLITE_OK ){
    const char *zKey;
    if( (zKey = sqlite3_uri_parameter(zOpen, "hexkey"))!=0 && zKey[0] ){
      u8 iByte;
      int i;
      char zDecoded[40];
      for(i=0, iByte=0; i<sizeof(zDecoded)*2 && sqlite3Isxdigit(zKey[i]); i++){
        iByte = (iByte<<4) + sqlite3HexToInt(zKey[i]);
        if( (i&1)!=0 ) zDecoded[i/2] = iByte;
      }
      sqlite3_key_v2(db, 0, zDecoded, i/2);
    }else if( (zKey = sqlite3_uri_parameter(zOpen, "key"))!=0 ){
      sqlite3_key_v2(db, 0, zKey, sqlite3Strlen30(zKey));
    }
  }
#endif
  sqlite3_free(zOpen);
  return rc & 0xff;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, %r15
movl %edx, %r13d
andq $0x0, 0x18(%rsp)
movq %rsi, %rbp
andq $0x0, 0x38(%rsp)
movq %rdi, %rbx
andq $0x0, (%rsi)
callq 0x404482
testl %eax, %eax
jne 0x411a03
movq %rbx, 0x40(%rsp)
movb $0x1, %bl
testw %r13w, %r13w
js 0x41150f
cmpl $0x0, 0x181c3c(%rip)    # 0x593134
je 0x41150f
btl $0x10, %r13d
jb 0x41150d
cmpl $0x0, 0x181c30(%rip)    # 0x593138
sete %bl
jmp 0x41150f
xorl %ebx, %ebx
btl $0x12, %r13d
jb 0x41152b
movl %r13d, %eax
orl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, 0x181d67(%rip)    # 0x59328c
cmovnel %eax, %r13d
jmp 0x411532
andl $0xfffdffff, %r13d      # imm = 0xFFFDFFFF
movl %r13d, %r12d
andl $0xfff600e7, %r12d      # imm = 0xFFF600E7
movl %r12d, 0xc(%rsp)
movl $0x2a8, %edi            # imm = 0x2A8
callq 0x407d85
testq %rax, %rax
je 0x41175c
movq %rax, %r14
testb %bl, %bl
je 0x411579
movq %r15, 0x28(%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x18(%r14), %rax
movq %rax, 0x30(%rsp)
movq 0x18(%r14), %rdi
testq %rdi, %rdi
jne 0x4115b2
jmp 0x4115b8
cmpl $0x0, 0x181bb4(%rip)    # 0x593134
je 0x41174f
pushq $0x1
popq %rdi
callq *0x181c21(%rip)         # 0x5931b0
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x411754
movq %rax, %rdi
movq %r15, 0x28(%rsp)
movq %rbp, 0x10(%rsp)
leaq 0x18(%r14), %rax
movq %rax, 0x30(%rsp)
callq *0x181c08(%rip)         # 0x5931c0
movl $0xff, 0x54(%r14)
movl $0x2, 0x28(%r14)
movl $0xf03b7906, 0x70(%r14) # imm = 0xF03B7906
movq %r14, %rax
addq $0x238, %rax            # imm = 0x238
movq %rax, 0x20(%r14)
movl $0x1, 0x160(%r14)
movaps 0x1294f1(%rip), %xmm0   # 0x53aae0
movups %xmm0, 0x7c(%r14)
movaps 0x1294f5(%rip), %xmm0   # 0x53aaf0
movups %xmm0, 0x8c(%r14)
movups 0x1294f2(%rip), %xmm0   # 0x53aafc
movups %xmm0, 0x98(%r14)
andl $0x0, 0xa8(%r14)
movb $0x1, 0x5f(%r14)
movb $-0x1, 0x64(%r14)
movq 0x181c3d(%rip), %rax    # 0x593268
movq %rax, 0x40(%r14)
andl $0x0, 0x6c(%r14)
movl $0x7fffffff, 0xac(%r14) # imm = 0x7FFFFFFF
orl $0x48060, 0x30(%r14)    # imm = 0x48060
xorps %xmm0, %xmm0
movups %xmm0, 0x208(%r14)
andq $0x0, 0x218(%r14)
movups %xmm0, 0x1c0(%r14)
andq $0x0, 0x1d0(%r14)
leaq 0x12952f(%rip), %r15    # 0x53aba0
leaq 0x46b65(%rip), %rbp     # 0x4581dd
pushq $0x1
popq %rbx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
xorl %ecx, %ecx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x411b2d
pushq $0x3
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x411b2d
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x411b2d
leaq 0x12fc57(%rip), %rsi    # 0x54131a
leaq 0x5966d(%rip), %r8      # 0x46ad37
movq %r14, %rdi
movl %ebx, %edx
xorl %ecx, %ecx
xorl %r9d, %r9d
callq 0x411b2d
leaq 0x1316b1(%rip), %rsi    # 0x542d91
pushq $0x1
popq %rcx
movq %r14, %rdi
movl %ebx, %edx
movq %rbp, %r8
xorl %r9d, %r9d
callq 0x411b2d
cmpb $0x0, 0x61(%r14)
movq 0x10(%rsp), %rbp
jne 0x4119b7
leaq 0x129496(%rip), %rdx    # 0x53aba0
pushq $0x1
popq %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x433b85
movq %rax, 0x10(%r14)
movl %r12d, 0x4c(%r14)
andl $0x7, %r13d
pushq $0x46
popq %rax
btl %r13d, %eax
jae 0x411764
leaq 0xc(%rsp), %rdx
leaq 0x18(%rsp), %r8
leaq 0x38(%rsp), %r9
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq %r14, %rcx
callq 0x4647a9
jmp 0x41176e
andq $0x0, 0x18(%r14)
movq %r14, %rdi
callq 0x404c6c
xorl %r14d, %r14d
jmp 0x4119ca
movl $0x25cf9, %edi          # imm = 0x25CF9
callq 0x403dfd
movl %eax, %ebx
testl %eax, %eax
je 0x4117b0
cmpl $0x7, %ebx
jne 0x411781
movq %r14, %rdi
callq 0x40a1fe
movq 0x38(%rsp), %r15
testq %r15, %r15
leaq 0x126c53(%rip), %rdx    # 0x5383e3
cmoveq %r15, %rdx
movq %r14, %rdi
movl %ebx, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x407c96
movq %r15, %rdi
callq 0x404c6c
jmp 0x4119b7
movq 0x18(%rsp), %rsi
movq (%r14), %rdi
movq 0x20(%r14), %rcx
addq $0x8, %rcx
movl $0x100, %r9d            # imm = 0x100
orl 0xc(%rsp), %r9d
movq %r14, %rdx
xorl %r8d, %r8d
callq 0x415147
testl %eax, %eax
je 0x4117f2
cmpl $0xc0a, %eax            # imm = 0xC0A
pushq $0x7
popq %rsi
cmovnel %eax, %esi
movq %r14, %rdi
callq 0x407da3
jmp 0x4119b7
movq 0x20(%r14), %rax
movq 0x8(%rax), %rdi
callq 0x4083c8
movq 0x20(%r14), %rax
movq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x464c9e
movq 0x20(%r14), %rcx
movq %rax, 0x18(%rcx)
cmpb $0x0, 0x61(%r14)
jne 0x411825
movb 0x71(%rax), %al
movb %al, 0x5e(%r14)
movq 0x8(%rcx), %rdi
callq 0x4092a1
movq %r14, %rdi
xorl %esi, %esi
callq 0x464c9e
movq 0x20(%r14), %rcx
movq %rax, 0x38(%rcx)
leaq 0x14ddc6(%rip), %rax    # 0x55f60d
movq %rax, (%rcx)
movb $0x3, 0x10(%rcx)
leaq 0x12ce2d(%rip), %rax    # 0x53e682
movq %rax, 0x20(%rcx)
movb $0x1, 0x30(%rcx)
movl $0xa029a697, 0x70(%r14) # imm = 0xA029A697
cmpb $0x0, 0x61(%r14)
jne 0x4119b7
movq %r14, %rdi
xorl %esi, %esi
callq 0x407da3
leaq 0x131516(%rip), %rsi    # 0x542d97
pushq $0x2
popq %rdx
movq %r14, %rdi
callq 0x410af8
cmpl $0x7, %eax
jne 0x411899
movq %r14, %rdi
callq 0x40a1fe
movq %r14, %rdi
callq 0x4113ee
testl %eax, %eax
je 0x4118d7
movq %r14, %rdi
movl %eax, %esi
callq 0x407da3
movl 0x18189b(%rip), %edx    # 0x593150
movl 0x181899(%rip), %ecx    # 0x593154
movq %r14, %rdi
xorl %esi, %esi
callq 0x410218
movq %r14, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x410f9b
jmp 0x4119b7
cmpl $0x0, 0x186172(%rip)    # 0x597a50
je 0x4119a7
xorl %r15d, %r15d
pushq $0x1
popq %rbp
testl %ebp, %ebp
movq 0x10(%rsp), %rbp
je 0x4119a7
movb $0x1, %r12b
cmpl $0x0, 0x181833(%rip)    # 0x593134
je 0x411922
pushq $0x2
popq %rdi
callq *0x1818a4(%rip)         # 0x5931b0
testq %rax, %rax
je 0x411922
movq %rax, %rbx
movq %rax, %rdi
callq *0x1818a3(%rip)         # 0x5931c0
xorl %r12d, %r12d
jmp 0x411924
xorl %ebx, %ebx
cmpl 0x186125(%rip), %r15d   # 0x597a50
jae 0x411940
movq 0x186124(%rip), %rax    # 0x597a58
movl %r15d, %ecx
movq (%rax,%rcx,8), %r13
pushq $0x1
popq %rbp
jmp 0x411945
xorl %r13d, %r13d
xorl %ebp, %ebp
testb %r12b, %r12b
jne 0x411953
movq %rbx, %rdi
callq *0x18187d(%rip)         # 0x5931d0
andq $0x0, 0x20(%rsp)
testq %r13, %r13
je 0x411995
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x17f2c3(%rip), %rdx    # 0x590c30
callq *%r13
movq 0x20(%rsp), %rcx
testl %eax, %eax
je 0x411997
xorl %ebp, %ebp
movq %r14, %rdi
movl %eax, %esi
leaq 0x131416(%rip), %rdx    # 0x542d9d
xorl %eax, %eax
callq 0x407c96
movq 0x20(%rsp), %rcx
jmp 0x411997
xorl %ecx, %ecx
movq %rcx, %rdi
callq 0x404c6c
incl %r15d
jmp 0x4118ea
movq %r14, %rdi
callq 0x4113ee
testl %eax, %eax
je 0x4118af
movq 0x30(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x4119ca
callq *0x181806(%rip)         # 0x5931d0
movq %r14, %rdi
callq 0x4113ee
movl %eax, %ebx
testl %eax, %eax
je 0x4119f2
cmpl $0x7, %ebx
jne 0x4119ea
movq %r14, %rdi
callq 0x4103ae
xorl %r14d, %r14d
jmp 0x4119f2
movl $0x4b771290, 0x70(%r14) # imm = 0x4B771290
movq %r14, (%rbp)
movq 0x18(%rsp), %rdi
callq 0x404c6c
movzbl %bl, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq