// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3BtreeOpen
SQLITE_PRIVATE int sqlite3BtreeOpen(
  sqlite3_vfs *pVfs,      /* VFS to use for this b-tree */
  const char *zFilename,  /* Name of the file containing the BTree database */
  sqlite3 *db,            /* Associated database handle */
  Btree **ppBtree,        /* Pointer to new Btree object written here */
  int flags,              /* Options */
  int vfsFlags            /* Flags passed through to sqlite3_vfs.xOpen() */
){
  BtShared *pBt = 0;             /* Shared part of btree structure */
  Btree *p;                      /* Handle to return */
  sqlite3_mutex *mutexOpen = 0;  /* Prevents a race condition. Ticket #3537 */
  int rc = SQLITE_OK;            /* Result code from this function */
  u8 nReserve;                   /* Byte of unused space on each page */
  unsigned char zDbHeader[100];  /* Database header content */

  /* True if opening an ephemeral, temporary database */
  const int isTempDb = zFilename==0 || zFilename[0]==0;

  /* Set the variable isMemdb to true for an in-memory database, or 
  ** false for a file-based database.
  */
#ifdef SQLITE_OMIT_MEMORYDB
  const int isMemdb = 0;
#else
  const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0)
                       || (isTempDb && sqlite3TempInMemory(db))
                       || (vfsFlags & SQLITE_OPEN_MEMORY)!=0;
#endif

  assert( db!=0 );
  assert( pVfs!=0 );
  assert( sqlite3_mutex_held(db->mutex) );
  assert( (flags&0xff)==flags );   /* flags fit in 8 bits */

  /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */
  assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 );

  /* A BTREE_SINGLE database is always a temporary and/or ephemeral */
  assert( (flags & BTREE_SINGLE)==0 || isTempDb );

  if( isMemdb ){
    flags |= BTREE_MEMORY;
  }
  if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){
    vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
  }
  p = sqlite3MallocZero(sizeof(Btree));
  if( !p ){
    return SQLITE_NOMEM;
  }
  p->inTrans = TRANS_NONE;
  p->db = db;
#ifndef SQLITE_OMIT_SHARED_CACHE
  p->lock.pBtree = p;
  p->lock.iTable = 1;
#endif

#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
  /*
  ** If this Btree is a candidate for shared cache, try to find an
  ** existing BtShared object that we can share with
  */
  if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){
    if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){
      int nFullPathname = pVfs->mxPathname+1;
      char *zFullPathname = sqlite3Malloc(nFullPathname);
      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )
      p->sharable = 1;
      if( !zFullPathname ){
        sqlite3_free(p);
        return SQLITE_NOMEM;
      }
      if( isMemdb ){
        memcpy(zFullPathname, zFilename, sqlite3Strlen30(zFilename)+1);
      }else{
        rc = sqlite3OsFullPathname(pVfs, zFilename,
                                   nFullPathname, zFullPathname);
        if( rc ){
          sqlite3_free(zFullPathname);
          sqlite3_free(p);
          return rc;
        }
      }
#if SQLITE_THREADSAFE
      mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN);
      sqlite3_mutex_enter(mutexOpen);
      mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
      sqlite3_mutex_enter(mutexShared);
#endif
      for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){
        assert( pBt->nRef>0 );
        if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0))
                 && sqlite3PagerVfs(pBt->pPager)==pVfs ){
          int iDb;
          for(iDb=db->nDb-1; iDb>=0; iDb--){
            Btree *pExisting = db->aDb[iDb].pBt;
            if( pExisting && pExisting->pBt==pBt ){
              sqlite3_mutex_leave(mutexShared);
              sqlite3_mutex_leave(mutexOpen);
              sqlite3_free(zFullPathname);
              sqlite3_free(p);
              return SQLITE_CONSTRAINT;
            }
          }
          p->pBt = pBt;
          pBt->nRef++;
          break;
        }
      }
      sqlite3_mutex_leave(mutexShared);
      sqlite3_free(zFullPathname);
    }
#ifdef SQLITE_DEBUG
    else{
      /* In debug mode, we mark all persistent databases as sharable
      ** even when they are not.  This exercises the locking code and
      ** gives more opportunity for asserts(sqlite3_mutex_held())
      ** statements to find locking problems.
      */
      p->sharable = 1;
    }
#endif
  }
#endif
  if( pBt==0 ){
    /*
    ** The following asserts make sure that structures used by the btree are
    ** the right size.  This is to guard against size changes that result
    ** when compiling on a different architecture.
    */
    assert( sizeof(i64)==8 || sizeof(i64)==4 );
    assert( sizeof(u64)==8 || sizeof(u64)==4 );
    assert( sizeof(u32)==4 );
    assert( sizeof(u16)==2 );
    assert( sizeof(Pgno)==4 );
  
    pBt = sqlite3MallocZero( sizeof(*pBt) );
    if( pBt==0 ){
      rc = SQLITE_NOMEM;
      goto btree_open_out;
    }
    rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
                          EXTRA_SIZE, flags, vfsFlags, pageReinit);
    if( rc==SQLITE_OK ){
      sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap);
      rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
    }
    if( rc!=SQLITE_OK ){
      goto btree_open_out;
    }
    pBt->openFlags = (u8)flags;
    pBt->db = db;
    sqlite3PagerSetBusyhandler(pBt->pPager, btreeInvokeBusyHandler, pBt);
    p->pBt = pBt;
  
    pBt->pCursor = 0;
    pBt->pPage1 = 0;
    if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
#ifdef SQLITE_SECURE_DELETE
    pBt->btsFlags |= BTS_SECURE_DELETE;
#endif
    pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
    if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
         || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
      pBt->pageSize = 0;
#ifndef SQLITE_OMIT_AUTOVACUUM
      /* If the magic name ":memory:" will create an in-memory database, then
      ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if
      ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if
      ** SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a
      ** regular file-name. In this case the auto-vacuum applies as per normal.
      */
      if( zFilename && !isMemdb ){
        pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0);
        pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
      }
#endif
      nReserve = 0;
    }else{
      nReserve = zDbHeader[20];
      pBt->btsFlags |= BTS_PAGESIZE_FIXED;
#ifndef SQLITE_OMIT_AUTOVACUUM
      pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
      pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
#endif
    }
    rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
    if( rc ) goto btree_open_out;
    pBt->usableSize = pBt->pageSize - nReserve;
    assert( (pBt->pageSize & 7)==0 );  /* 8-byte alignment of pageSize */
   
#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
    /* Add the new BtShared object to the linked list sharable BtShareds.
    */
    if( p->sharable ){
      MUTEX_LOGIC( sqlite3_mutex *mutexShared; )
      pBt->nRef = 1;
      MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);)
      if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){
        pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
        if( pBt->mutex==0 ){
          rc = SQLITE_NOMEM;
          db->mallocFailed = 0;
          goto btree_open_out;
        }
      }
      sqlite3_mutex_enter(mutexShared);
      pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList);
      GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt;
      sqlite3_mutex_leave(mutexShared);
    }
#endif
  }

#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
  /* If the new Btree uses a sharable pBtShared, then link the new
  ** Btree into the list of all sharable Btrees for the same connection.
  ** The list is kept in ascending order by pBt address.
  */
  if( p->sharable ){
    int i;
    Btree *pSib;
    for(i=0; i<db->nDb; i++){
      if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){
        while( pSib->pPrev ){ pSib = pSib->pPrev; }
        if( p->pBt<pSib->pBt ){
          p->pNext = pSib;
          p->pPrev = 0;
          pSib->pPrev = p;
        }else{
          while( pSib->pNext && pSib->pNext->pBt<p->pBt ){
            pSib = pSib->pNext;
          }
          p->pNext = pSib->pNext;
          p->pPrev = pSib;
          if( p->pNext ){
            p->pNext->pPrev = p;
          }
          pSib->pNext = p;
        }
        break;
      }
    }
  }
#endif
  *ppBtree = p;

btree_open_out:
  if( rc!=SQLITE_OK ){
    if( pBt && pBt->pPager ){
      sqlite3PagerClose(pBt->pPager);
    }
    sqlite3_free(pBt);
    sqlite3_free(p);
    *ppBtree = 0;
  }else{
    /* If the B-Tree was successfully opened, set the pager-cache size to the
    ** default value. Except, when opening on an existing shared pager-cache,
    ** do not change the pager-cache size.
    */
    if( sqlite3BtreeSchema(p, 0, 0)==0 ){
      sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE);
    }
  }
  if( mutexOpen ){
    assert( sqlite3_mutex_held(mutexOpen) );
    sqlite3_mutex_leave(mutexOpen);
  }
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %r9d, %ebx
movl %r8d, %r15d
movq %rcx, -0xa8(%rbp)
movq %rdx, %r13
movq %rdi, -0x30(%rbp)
testq %rsi, %rsi
movq %rsi, -0x60(%rbp)
je 0x17614
movq %rsi, %rax
movb (%rsi), %r14b
testb %r14b, %r14b
sete %r12b
leaq 0x541ee(%rip), %rsi     # 0x6b7ec
movq %rax, %rdi
callq 0x8510
testl %eax, %eax
je 0x1761e
testb %r14b, %r14b
je 0x17614
xorl %r12d, %r12d
jmp 0x1762a
movb $0x1, %r12b
cmpb $0x2, 0x4f(%r13)
jne 0x1762a
orl $0x2, %r15d
movl %r15d, -0x34(%rbp)
movb $0x1, %cl
jmp 0x17640
movl %ebx, %eax
andl $0x80, %eax
movl %eax, %ecx
shrl $0x7, %ecx
shrl $0x6, %eax
orl %eax, %r15d
movl %r15d, -0x34(%rbp)
movl %ecx, -0x64(%rbp)
movl %ecx, %eax
orb %r12b, %al
movl %ebx, %r15d
andl $0xfffffcff, %r15d      # imm = 0xFFFFFCFF
orl $0x200, %r15d           # imm = 0x200
testb $0x1, %al
cmovel %ebx, %r15d
testw $0x100, %bx             # imm = 0x100
cmovel %ebx, %r15d
pushq $0x48
popq %rdi
callq 0xbeb2
pushq $0x7
popq %rbx
testq %rax, %rax
je 0x17f31
movq %rax, %r14
movb $0x0, 0x10(%rax)
movq %r13, (%rax)
movq %rax, 0x30(%rax)
movl $0x1, 0x38(%rax)
testb %r12b, %r12b
jne 0x17770
testb $0x40, %r15b
sete %al
andb -0x64(%rbp), %al
btl $0x11, %r15d
setae %cl
orb %al, %cl
jne 0x17770
movq %r13, -0x40(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %r13d
incl %r13d
movl %r13d, %edi
callq 0x9c40
movb $0x1, 0x11(%r14)
testq %rax, %rax
je 0x1771e
movq %rax, %r12
cmpb $0x0, -0x64(%rbp)
je 0x176fa
movq -0x60(%rbp), %rbx
movq %rbx, %rdi
callq 0x8f8e
leal 0x1(%rax), %edx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x82c0
jmp 0x1772b
movb $0x0, (%r12)
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl %r13d, %edx
movq %r12, %rcx
callq *0x40(%rdi)
testl %eax, %eax
je 0x1772b
movl %eax, %ebx
movq %r12, %rdi
callq 0x9c7b
movq %r14, %rdi
callq 0x9c7b
jmp 0x17f31
leaq 0x71826(%rip), %rbx     # 0x88f58
movq (%rbx), %rbx
testq %rbx, %rbx
je 0x17764
movq (%rbx), %r13
movq 0xd0(%r13), %rsi
movq %r12, %rdi
callq 0x8510
testl %eax, %eax
jne 0x1775e
movq -0x30(%rbp), %rax
cmpq %rax, (%r13)
je 0x17bc1
addq $0x68, %rbx
jmp 0x17732
movq %r12, %rdi
callq 0x9c7b
movq -0x40(%rbp), %r13
movl $0x88, %edi
callq 0xbeb2
movq %rax, %r12
testq %rax, %rax
je 0x17872
movl $0x400, -0x110(%rbp)    # imm = 0x400
movq -0x30(%rbp), %rbx
movl 0x4(%rbx), %eax
leal 0x7(%rax), %ecx
andl $-0x8, %ecx
cmpl $0x31, %eax
pushq $0x30
popq %rdx
cmovgel %ecx, %edx
andq $0x0, (%r12)
movl -0x34(%rbp), %ecx
andl $0x2, %ecx
movq %r12, -0x88(%rbp)
movl %ecx, -0x9c(%rbp)
jne 0x1787a
movq -0x60(%rbp), %rax
testq %rax, %rax
je 0x178e4
cmpb $0x0, (%rax)
je 0x1795e
movq %rdx, -0x90(%rbp)
movl 0x8(%rbx), %ebx
leal 0x2(,%rbx,2), %edi
callq 0x9c40
testq %rax, %rax
je 0x1791a
movq %r13, -0x40(%rbp)
incl %ebx
movb $0x0, (%rax)
movq -0x30(%rbp), %rdi
movq -0x60(%rbp), %r12
movq %rax, %r13
movq %r12, %rsi
movl %ebx, %edx
movq %rax, %rcx
callq *0x40(%rdi)
movl %eax, %ebx
movq %r13, -0x48(%rbp)
movq %r13, %rdi
callq 0x8f8e
movq %rax, -0x98(%rbp)
movq %r12, %rdi
callq 0x8f8e
movl %eax, %eax
addq %rax, %r12
incq %r12
movq %r12, -0x58(%rbp)
cmpb $0x0, (%r12)
je 0x1791f
movq %r12, %rdi
callq 0x8f8e
movl %eax, %eax
leaq (%rax,%r12), %r13
leaq (%rax,%r12), %rdi
incq %rdi
callq 0x8f8e
movl %eax, %eax
leaq (%rax,%r13), %r12
addq $0x2, %r12
jmp 0x17841
pushq $0x7
popq %rbx
jmp 0x17f16
movq -0x60(%rbp), %rsi
testq %rsi, %rsi
je 0x178fc
cmpb $0x0, (%rsi)
je 0x1797c
movq %rdx, -0x90(%rbp)
xorl %r12d, %r12d
xorl %edi, %edi
callq 0xf173
testq %rax, %rax
je 0x1791a
movq %r14, -0x50(%rbp)
movq %r13, -0x40(%rbp)
movq %rax, -0x48(%rbp)
movq %rax, %rdi
callq 0x8f8e
movl %eax, %ecx
movb $0x1, %al
movq %rax, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movb $0x1, %al
movq %rax, -0x70(%rbp)
movq $0x0, -0x58(%rbp)
movq -0x30(%rbp), %rbx
movq -0x90(%rbp), %rdx
jmp 0x179ab
movq %r14, -0x50(%rbp)
movq %r13, -0x40(%rbp)
movq $0x0, -0x78(%rbp)
movb $0x1, %al
movq %rax, -0x80(%rbp)
jmp 0x17972
movq %r14, -0x50(%rbp)
movb $0x1, %al
movq %rax, -0x70(%rbp)
movq %r13, -0x40(%rbp)
movq $0x0, -0x78(%rbp)
movb $0x1, %al
movq %rax, -0x80(%rbp)
jmp 0x17996
pushq $0x7
popq %rbx
jmp 0x17952
testl %ebx, %ebx
jne 0x17949
movq -0x98(%rbp), %rcx
movl %ecx, %eax
addl $0x8, %eax
movq -0x30(%rbp), %rbx
cmpl 0x8(%rbx), %eax
jle 0x17c1b
movl $0xa7b1, %edi           # imm = 0xA7B1
callq 0x16cb0
pushq $0xe
popq %rbx
movq -0x48(%rbp), %rdi
callq 0x9c7b
movq -0x88(%rbp), %r12
jmp 0x17f08
movq %r14, -0x50(%rbp)
movq %r13, -0x40(%rbp)
movq $0x0, -0x80(%rbp)
movq %rax, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
jmp 0x17996
movq %r14, -0x50(%rbp)
movb $0x1, %al
movq %rax, -0x70(%rbp)
movq %r13, -0x40(%rbp)
movq $0x0, -0x80(%rbp)
movq %rsi, -0x78(%rbp)
movq $0x0, -0x48(%rbp)
xorl %ecx, %ecx
movq $0x0, -0x58(%rbp)
xorl %r12d, %r12d
movl 0x4(%rbx), %eax
addl $0x7, %eax
andl $-0x8, %eax
movq %rcx, -0x98(%rbp)
leal (%rcx,%rcx,2), %ecx
leal (%rcx,%rdx,2), %ecx
addl %r12d, %ecx
leal (%rax,%rcx), %edi
addl $0x189, %edi            # imm = 0x189
movq %rdx, %r14
callq 0xbeb2
testq %rax, %rax
je 0x17b71
movq %rax, %r13
addq $0x128, %rax            # imm = 0x128
movq %rax, 0x110(%r13)
leaq 0x178(%r13), %rax
movq %rax, 0x48(%r13)
movslq 0x4(%rbx), %rax
addq $0x7, %rax
andq $-0x8, %rax
leaq (%rax,%r13), %rdi
addq $0x178, %rdi            # imm = 0x178
movq %rdi, 0x58(%r13)
movslq %r14d, %rax
addq %rax, %rdi
movq %rdi, 0x50(%r13)
addq %rax, %rdi
movq %rdi, 0xd0(%r13)
movq -0x48(%rbp), %rsi
testq %rsi, %rsi
je 0x17ae3
movl -0x98(%rbp), %ebx
leal (%r12,%rbx), %eax
incl %eax
cltq
addq %rdi, %rax
movq %rax, 0xd8(%r13)
movq %rbx, %rdx
callq 0x82c0
testl %r12d, %r12d
je 0x17a72
movslq %r12d, %rdx
leal 0x1(%rbx), %eax
movl %eax, %edi
addq 0xd0(%r13), %rdi
movq -0x58(%rbp), %rsi
callq 0x82c0
movq 0xd8(%r13), %rdi
movq -0x48(%rbp), %r12
movq %r12, %rsi
movq %rbx, %rdx
callq 0x82c0
movq 0xd8(%r13), %rax
movabsq $0x6c616e72756f6a2d, %rcx # imm = 0x6C616E72756F6A2D
andw $0x0, 0x8(%rax,%rbx)
movq %rcx, (%rax,%rbx)
movq 0xd8(%r13), %rax
leaq (%rax,%rbx), %rdi
addq $0x9, %rdi
movq %rdi, 0x120(%r13)
movq %r12, %rsi
movq %rbx, %rdx
callq 0x82c0
movq 0x120(%r13), %rax
movl $0x6c61772d, (%rax,%rbx) # imm = 0x6C61772D
movb $0x0, 0x4(%rax,%rbx)
movq %r12, %rdi
callq 0x9c7b
movq -0x30(%rbp), %rbx
movq %rbx, (%r13)
movl %r15d, 0xb4(%r13)
cmpb $0x0, -0x80(%rbp)
jne 0x17b53
movq -0x78(%rbp), %rax
cmpb $0x0, (%rax)
je 0x17b53
leaq -0xac(%rbp), %r12
andl $0x0, (%r12)
movq 0x48(%r13), %rdx
movq 0xd0(%r13), %rsi
andl $0x87f7f, %r15d         # imm = 0x87F7F
movq %rbx, %rdi
movl %r15d, %ecx
movq %r12, %r8
callq *0x28(%rbx)
movl %eax, %ebx
movl (%r12), %r15d
andl $0x1, %r15d
orl %r15d, %eax
movq -0x50(%rbp), %r14
je 0x17b8d
testl %ebx, %ebx
movq -0x88(%rbp), %r12
jne 0x17c8b
movb $0x1, %al
movl %eax, -0x30(%rbp)
jmp 0x17c69
movw $0x401, 0x13(%r13)      # imm = 0x401
andl $0x1, %r15d
movb $0x1, %r12b
movl $0x0, -0x30(%rbp)
movq -0x50(%rbp), %r14
jmp 0x17c6c
movq -0x48(%rbp), %rdi
callq 0x9c7b
pushq $0x7
popq %rbx
movq -0x88(%rbp), %r12
movq -0x50(%rbp), %r14
jmp 0x17f08
movq %r13, %rdi
callq 0x1832e
movl 0xb8(%r13), %eax
cmpl $0x401, %eax            # imm = 0x401
jb 0x17c61
cmpl $0x2001, %eax           # imm = 0x2001
jb 0x17c5b
movl $0x2000, -0x110(%rbp)   # imm = 0x2000
jmp 0x17c61
movq -0x40(%rbp), %r13
movl 0x28(%r13), %eax
movq %rax, %rcx
shlq $0x5, %rcx
addq $-0x18, %rcx
testl %eax, %eax
jle 0x17bf3
movq 0x20(%r13), %rdx
movq (%rdx,%rcx), %rdx
testq %rdx, %rdx
je 0x17beb
cmpq %rbx, 0x8(%rdx)
je 0x17c43
decl %eax
addq $-0x20, %rcx
jmp 0x17bd4
movq %rbx, 0x8(%r14)
incl 0x60(%rbx)
movq %r12, %rdi
callq 0x9c7b
testq %rbx, %rbx
je 0x17770
cmpb $0x0, 0x11(%r14)
jne 0x17f79
jmp 0x18004
movq %r14, -0x50(%rbp)
subl -0x58(%rbp), %r12d
incl %r12d
movq $0x0, -0x80(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x0, -0x70(%rbp)
jmp 0x178d8
movq %r12, %rdi
callq 0x9c7b
movq %r14, %rdi
callq 0x9c7b
pushq $0x13
popq %rbx
jmp 0x17f31
movl %eax, -0x110(%rbp)
movb $0x1, %al
movl %eax, -0x30(%rbp)
xorl %r15d, %r15d
xorl %r12d, %r12d
leaq -0x110(%rbp), %rsi
pushq $-0x1
popq %rdx
movq %r13, %rdi
callq 0x180ad
testl %eax, %eax
je 0x17cae
movl %eax, %ebx
movq -0x88(%rbp), %r12
movq 0x48(%r13), %r15
movq (%r15), %rax
testq %rax, %rax
je 0x17ca1
movq %r15, %rdi
callq *0x8(%rax)
andq $0x0, (%r15)
movq %r13, %rdi
callq 0x9c7b
jmp 0x17f08
movl -0x34(%rbp), %ebx
andl $0x1, %ebx
movl -0x9c(%rbp), %edx
movl %edx, %eax
shrl %eax
xorl $0x1, %eax
xorl %ecx, %ecx
testl %edx, %edx
movl -0x110(%rbp), %edx
leaq 0x69a(%rip), %rsi       # 0x1836c
cmoveq %rsi, %rcx
movq 0x110(%r13), %rsi
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rsi)
movups %xmm0, 0x30(%rsi)
movups %xmm0, 0x10(%rsi)
movups %xmm0, 0x40(%rsi)
movups %xmm0, (%rsi)
movl %edx, 0x20(%rsi)
movl $0x78, 0x24(%rsi)
movl %eax, 0x28(%rsi)
movq %rcx, 0x30(%rsi)
movq %r13, 0x38(%rsi)
movl $0x64, 0x1c(%rsi)
movl %ebx, %eax
xorb $0x1, %al
movb %al, 0xa(%r13)
movl $0x3fffffff, 0xc0(%r13) # imm = 0x3FFFFFFF
movb %r12b, 0x10(%r13)
movb %r12b, 0x8(%r13)
movb %r12b, 0x15(%r13)
movq -0x70(%rbp), %rax
movb %al, 0x12(%r13)
movb %r15b, 0x11(%r13)
movb %r12b, 0xb(%r13)
cmpb $0x0, -0x30(%rbp)
je 0x17d4c
movl $0x2220201, 0xc(%r13)   # imm = 0x2220201
movw $0x78, 0xb0(%r13)
orq $-0x1, 0xc8(%r13)
movq %r13, %rdi
callq 0x1832e
testb $0x3, -0x34(%rbp)
movq -0x60(%rbp), %r15
movq -0x88(%rbp), %r12
je 0x17d84
testl %ebx, %ebx
sete %al
addb %al, %al
addb $0x2, %al
movb %al, 0x9(%r13)
leaq 0x2ad(%rip), %rax       # 0x18038
movq %rax, 0x100(%r13)
movq %r13, (%r12)
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, 0xa0(%r13)
movq %r13, %rdi
callq 0x1a685
movq (%r12), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
andl $0x0, -0xb0(%rbp)
movaps %xmm0, -0x110(%rbp)
movq 0x48(%rax), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x17e11
leaq -0x110(%rbp), %rsi
pushq $0x64
popq %rdx
xorl %ecx, %ecx
callq *0x10(%rax)
cmpl $0x20a, %eax            # imm = 0x20A
je 0x17e11
movl %eax, %ebx
testl %eax, %eax
jne 0x17f08
movl -0x34(%rbp), %eax
movb %al, 0x20(%r12)
movq -0x40(%rbp), %r13
movq %r13, 0x8(%r12)
movq (%r12), %rdx
leaq 0x22d(%rip), %rax       # 0x1805a
movq %rax, 0xe0(%rdx)
movq %r12, 0xe8(%rdx)
movq 0x48(%rdx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x17e58
addq $0xe0, %rdx
pushq $0xf
popq %rsi
callq *0x50(%rax)
movq (%r12), %rdx
movq %r12, 0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r12)
cmpb $0x0, 0x11(%rdx)
je 0x17e71
orb $0x1, 0x26(%r12)
movzbl -0x100(%rbp), %ecx
shll $0x8, %ecx
movzbl -0xff(%rbp), %edi
shll $0x10, %edi
leal (%rdi,%rcx), %eax
movq %r12, %rsi
addq $0x30, %rsi
movl %eax, 0x30(%r12)
addl %edi, %ecx
addl $0xfffeffff, %ecx       # imm = 0xFFFEFFFF
cmpl $0xffff01ff, %ecx       # imm = 0xFFFF01FF
jb 0x17eae
leal 0x1ffff(%rax), %ecx
testl %eax, %ecx
je 0x17ec8
testq %r15, %r15
sete %al
andl $0x0, (%rsi)
xorl %r15d, %r15d
orb -0x64(%rbp), %al
jne 0x17ef7
andw $0x0, 0x21(%r12)
jmp 0x17ef7
movzbl -0xfc(%rbp), %r15d
orw $0x2, 0x26(%r12)
movl -0xdc(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x21(%r12)
movl -0xd0(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x22(%r12)
movq %rdx, %rdi
movl %r15d, %edx
callq 0x180ad
testl %eax, %eax
je 0x17f45
movl %eax, %ebx
movq (%r12), %rdi
testq %rdi, %rdi
je 0x17f16
callq 0x181e5
movq %r12, %rdi
callq 0x9c7b
movq %r14, %rdi
callq 0x9c7b
movq -0xa8(%rbp), %rax
andq $0x0, (%rax)
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x30(%r12), %eax
subl %r15d, %eax
movl %eax, 0x34(%r12)
cmpb $0x0, 0x11(%r14)
je 0x18004
movl $0x1, 0x60(%r12)
movq 0x70feb(%rip), %rax     # 0x88f58
movq %rax, 0x68(%r12)
movq %r12, 0x70fdf(%rip)     # 0x88f58
movl 0x28(%r13), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
shlq $0x5, %rax
cmpq %rcx, %rax
je 0x18004
movq 0x20(%r13), %rdx
movq 0x8(%rdx,%rcx), %rsi
testq %rsi, %rsi
je 0x17fa1
cmpb $0x0, 0x11(%rsi)
jne 0x17fa7
addq $0x20, %rcx
jmp 0x17f88
movq %rsi, %rdx
movq 0x28(%rsi), %rsi
testq %rsi, %rsi
jne 0x17fa7
movq 0x8(%r14), %rdi
pushq $0x20
popq %rax
cmpq 0x8(%rdx), %rdi
jae 0x17fc8
leaq 0x28(%rdx), %rdi
xorl %ecx, %ecx
jmp 0x17ff6
movq %rdx, %rsi
movq %rsi, %rcx
movq 0x20(%rsi), %rsi
testq %rsi, %rsi
je 0x17ff0
cmpq %rdi, 0x8(%rsi)
jb 0x17fcb
leaq 0x20(%rcx), %rdi
movq %rsi, 0x20(%r14)
pushq $0x28
popq %rax
movq %rcx, %rdx
movq %r14, %rcx
jmp 0x17ff9
leaq 0x20(%rcx), %rdi
xorl %edx, %edx
movq %r14, %rsi
movq %rdx, (%r14,%rax)
movq %rcx, 0x28(%rsi)
movq %r14, (%rdi)
movq -0xa8(%rbp), %rax
movq %r14, (%rax)
movq (%r14), %rcx
movq 0x8(%r14), %rax
movq %rcx, 0x8(%rax)
xorl %ebx, %ebx
cmpq $0x0, 0x40(%rax)
jne 0x17f31
movq (%rax), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x182f5
jmp 0x17f31