// File: /workspace/github_c_makefile_star2_O3/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, %r13d
movq %rcx, %r12
movq %rdx, -0x68(%rbp)
movq %rdi, -0x60(%rbp)
testq %rsi, %rsi
movq %rsi, -0x58(%rbp)
je 0x19653
movq %rsi, %rax
movb (%rsi), %r15b
testb %r15b, %r15b
sete %r14b
leaq 0x6018f(%rip), %rsi     # 0x797cc
movq %rax, %rdi
callq 0x8530
testl %eax, %eax
je 0x19660
testb %r15b, %r15b
je 0x19653
xorl %r14d, %r14d
jmp 0x19668
movb $0x1, %r14b
movq -0x68(%rbp), %rax
cmpb $0x2, 0x4f(%rax)
jne 0x19668
orl $0x2, %r13d
movb $0x1, %cl
jmp 0x1967a
movl %ebx, %eax
andl $0x80, %eax
movl %eax, %ecx
shrl $0x7, %ecx
shrl $0x6, %eax
orl %eax, %r13d
movl %r13d, -0x44(%rbp)
movl %ecx, -0x6c(%rbp)
movl %ecx, %eax
orb %r14b, %al
movl %ebx, %r15d
andl $0xfffffcff, %r15d      # imm = 0xFFFFFCFF
orl $0x200, %r15d           # imm = 0x200
testb $0x1, %al
cmovel %ebx, %r15d
testl $0x100, %ebx            # imm = 0x100
cmovel %ebx, %r15d
cmpl $0x0, 0x7ad52(%rip)     # 0x94400
je 0x196c9
leaq -0x110(%rbp), %rbx
movl $0x48, %edi
movq %rbx, %rsi
callq 0x171f8
movq (%rbx), %rax
jmp 0x196d4
movl $0x48, %edi
callq *0x7ad4c(%rip)          # 0x94420
movl $0x7, %r13d
testq %rax, %rax
je 0x19e3d
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rax)
movups %xmm0, 0x38(%rax)
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x8(%rax)
movq -0x68(%rbp), %rcx
movq %rcx, (%rax)
movq %rax, 0x30(%rax)
movq %rax, -0x40(%rbp)
movl $0x1, 0x38(%rax)
testb %r14b, %r14b
jne 0x19806
testb $0x40, %r15b
sete %al
andb -0x6c(%rbp), %al
btl $0x11, %r15d
setae %cl
orb %al, %cl
jne 0x19806
movq -0x60(%rbp), %rax
movl 0x8(%rax), %r14d
incl %r14d
movl %r14d, %edi
callq 0xa38c
movq -0x40(%rbp), %rdi
movb $0x1, 0x11(%rdi)
testq %rax, %rax
je 0x197a9
movq %rax, %rbx
cmpb $0x0, -0x6c(%rbp)
movq %r12, -0x50(%rbp)
je 0x19782
movq -0x58(%rbp), %rsi
testq %rsi, %rsi
je 0x197b3
movq $-0x1, %rdx
cmpb $0x0, 0x1(%rsi,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x1976c
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
incq %rdx
jmp 0x197b8
movb $0x0, (%rbx)
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl %r14d, %edx
movq %rbx, %rcx
callq *0x40(%rdi)
testl %eax, %eax
je 0x197c0
movl %eax, %r13d
movq %rbx, %rdi
callq 0xa3c7
movq -0x40(%rbp), %rdi
callq 0xa3c7
jmp 0x19e3d
movl $0x1, %edx
movq %rbx, %rdi
callq 0x82f0
movq 0x7c791(%rip), %r14     # 0x95f58
testq %r14, %r14
movq -0x60(%rbp), %r13
je 0x197fa
movq (%r14), %r12
movq 0xd0(%r12), %rsi
movq %rbx, %rdi
callq 0x8530
testl %eax, %eax
jne 0x197f1
cmpq %r13, (%r12)
je 0x19d2b
movq 0x68(%r14), %r14
testq %r14, %r14
jne 0x197d0
movq %rbx, %rdi
callq 0xa3c7
movq -0x50(%rbp), %r12
cmpl $0x0, 0x7abf3(%rip)     # 0x94400
je 0x19828
leaq -0x110(%rbp), %rbx
movl $0x88, %edi
movq %rbx, %rsi
callq 0x171f8
movq (%rbx), %r14
jmp 0x19836
movl $0x88, %edi
callq *0x7abed(%rip)          # 0x94420
movq %rax, %r14
movl -0x44(%rbp), %ebx
movq -0x60(%rbp), %r13
testq %r14, %r14
je 0x19979
movq %r12, -0x50(%rbp)
xorl %r12d, %r12d
movl $0x88, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x8200
movl $0x400, -0x110(%rbp)    # imm = 0x400
movl 0x4(%r13), %eax
leal 0x7(%rax), %ecx
andl $-0x8, %ecx
cmpl $0x31, %eax
movl $0x30, %edx
cmovgel %ecx, %edx
movq $0x0, (%r14)
andl $0x2, %ebx
movq %r14, -0x98(%rbp)
movq %rdx, -0xa0(%rbp)
jne 0x19984
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x19a27
cmpb $0x0, (%rax)
je 0x19a67
movl 0x8(%r13), %r14d
leal 0x2(,%r14,2), %edi
callq 0xa38c
testq %rax, %rax
je 0x19c8c
movl %ebx, -0x2c(%rbp)
incl %r14d
movb $0x0, (%rax)
movq %r13, %rdi
movq -0x58(%rbp), %rsi
movl %r14d, %edx
movq %rax, %rcx
movq %rax, -0x38(%rbp)
callq *0x40(%r13)
movq -0x38(%rbp), %rdi
movl %eax, %r13d
xorl %r12d, %r12d
cmpb $0x0, (%rdi,%r12)
leaq 0x1(%r12), %r12
jne 0x198f1
movq $-0x1, %rbx
movq -0x58(%rbp), %rax
cmpb $0x0, 0x1(%rax,%rbx)
leaq 0x1(%rbx), %rbx
jne 0x19908
andl $0x3fffffff, %ebx       # imm = 0x3FFFFFFF
leaq (%rax,%rbx), %rdx
incq %rdx
cmpb $0x0, (%rdx)
movq -0x98(%rbp), %r14
je 0x19ccf
movq %rdx, %rax
xorl %ecx, %ecx
cmpb $0x0, 0x1(%rax,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x19935
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
leaq (%rax,%rcx), %rbx
incq %rbx
movq $-0x1, %rcx
cmpb $0x0, 0x1(%rbx,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x19954
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
leaq (%rbx,%rcx), %rax
incq %rax
cmpb $0x0, (%rax)
jne 0x19933
addq %rcx, %rbx
jmp 0x19cd2
movl $0x7, %r13d
jmp 0x19e24
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x19a40
cmpb $0x0, (%rax)
je 0x19a86
xorl %r14d, %r14d
cmpb $0x0, 0x1(%rax,%r14)
leaq 0x1(%r14), %r14
jne 0x1999d
andl $0x3fffffff, %r14d      # imm = 0x3FFFFFFF
incl %r14d
movl %r14d, %edi
callq 0xa38c
testq %rax, %rax
je 0x19c8c
movl %ebx, -0x2c(%rbp)
movl %r14d, %edx
movq %rax, %rdi
movq -0x58(%rbp), %rsi
movq %rax, -0x38(%rbp)
callq 0x82f0
movq -0x38(%rbp), %rax
xorl %r12d, %r12d
cmpb $0x0, (%rax,%r12)
leaq 0x1(%r12), %r12
jne 0x199e1
decl %r12d
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
movq $0x0, -0x88(%rbp)
movb $0x1, %al
movq %rax, -0x90(%rbp)
movb $0x1, %al
movq %rax, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
xorl %ebx, %ebx
movq -0xa0(%rbp), %rdx
jmp 0x19ab6
movl %ebx, -0x2c(%rbp)
movq $0x0, -0x88(%rbp)
movb $0x1, %al
movq %rax, -0x90(%rbp)
jmp 0x19a7c
movb $0x1, %al
movq %rax, -0x78(%rbp)
movl %ebx, -0x2c(%rbp)
movb $0x1, %al
movq %rax, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x38(%rbp)
jmp 0x19aac
movl %ebx, -0x2c(%rbp)
movq $0x0, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movq $0x0, -0x78(%rbp)
jmp 0x19aa1
movb $0x1, %cl
movq %rcx, -0x78(%rbp)
movl %ebx, -0x2c(%rbp)
movq $0x0, -0x90(%rbp)
movq %rax, -0x88(%rbp)
movq $0x0, -0x38(%rbp)
xorl %r12d, %r12d
movq $0x0, -0x80(%rbp)
xorl %ebx, %ebx
movl 0x4(%r13), %eax
addl $0x7, %eax
andl $-0x8, %eax
leal (%r12,%r12,2), %ecx
leal (%rcx,%rdx,2), %ecx
addl %ebx, %ecx
leal (%rax,%rcx), %r13d
addl $0x189, %r13d           # imm = 0x189
movl %r13d, %edi
callq 0xa38c
testq %rax, %rax
je 0x19c83
movq %rax, %r14
movslq %r13d, %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x8200
leaq 0x128(%r14), %rax
movq %rax, 0x110(%r14)
leaq 0x178(%r14), %rax
movq %rax, 0x48(%r14)
movq -0x60(%rbp), %rcx
movslq 0x4(%rcx), %rax
addq $0x7, %rax
andq $-0x8, %rax
leaq (%r14,%rax), %rdi
addq $0x178, %rdi            # imm = 0x178
movq %rdi, 0x58(%r14)
movslq -0xa0(%rbp), %rax
addq %rax, %rdi
movq %rdi, 0x50(%r14)
addq %rax, %rdi
movq %rdi, 0xd0(%r14)
movq -0x38(%rbp), %rsi
testq %rsi, %rsi
movq %rcx, %rax
je 0x19c01
movl %r12d, %r13d
leal (%rbx,%r13), %eax
incl %eax
cltq
addq %rdi, %rax
movq %rax, 0xd8(%r14)
movq %r13, %rdx
callq 0x82f0
testl %ebx, %ebx
je 0x19b8f
movslq %ebx, %rdx
leal 0x1(%r13), %eax
movl %eax, %edi
addq 0xd0(%r14), %rdi
movq -0x80(%rbp), %rsi
callq 0x82f0
movq 0xd8(%r14), %rdi
movq -0x38(%rbp), %rbx
movq %rbx, %rsi
movq %r13, %rdx
callq 0x82f0
movq 0xd8(%r14), %rax
movabsq $0x6c616e72756f6a2d, %rcx # imm = 0x6C616E72756F6A2D
movq %rcx, (%rax,%r13)
movw $0x0, 0x8(%rax,%r13)
movq 0xd8(%r14), %rax
leaq 0x9(%rax,%r13), %rdi
movq %rdi, 0x120(%r14)
movq %rbx, %rsi
movq %r13, %rdx
callq 0x82f0
movq 0x120(%r14), %rax
movl $0x6c61772d, (%rax,%r13) # imm = 0x6C61772D
movb $0x0, 0x4(%rax,%r13)
movq %rbx, %rdi
callq 0xa3c7
movq -0x60(%rbp), %rax
movq %rax, (%r14)
movl %r15d, 0xb4(%r14)
cmpb $0x0, -0x90(%rbp)
jne 0x19c6e
movq -0x88(%rbp), %rcx
cmpb $0x0, (%rcx)
je 0x19c6e
leaq -0xa4(%rbp), %rbx
movl $0x0, (%rbx)
movq 0x48(%r14), %rdx
movq 0xd0(%r14), %rsi
andl $0x87f7f, %r15d         # imm = 0x87F7F
movq %rax, %rdi
movl %r15d, %ecx
movq %rbx, %r8
callq *0x28(%rax)
movl %eax, %r13d
movl (%rbx), %r15d
andl $0x1, %r15d
orl %r15d, %eax
je 0x19c9b
testl %r13d, %r13d
movq -0x50(%rbp), %r12
jne 0x19def
movb $0x1, %bl
jmp 0x19dcd
movw $0x401, 0x13(%r14)      # imm = 0x401
andl $0x1, %r15d
movb $0x1, %r12b
xorl %ebx, %ebx
jmp 0x19dd0
movq -0x38(%rbp), %rdi
callq 0xa3c7
movl $0x7, %r13d
movq -0x50(%rbp), %r12
jmp 0x19e10
movq %r14, %rdi
callq 0x1a4fb
movl 0xb8(%r14), %eax
cmpl $0x401, %eax            # imm = 0x401
jb 0x19dc8
cmpl $0x2001, %eax           # imm = 0x2001
jb 0x19dc2
movl $0x2000, -0x110(%rbp)   # imm = 0x2000
jmp 0x19dc8
addq %rax, %rbx
testl %r13d, %r13d
jne 0x19d1d
decl %r12d
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
leal 0x8(%r12), %eax
movq -0x60(%rbp), %r13
cmpl 0x8(%r13), %eax
jle 0x19d96
leaq 0x5f9e1(%rip), %rsi     # 0x796dc
leaq 0x5f837(%rip), %rcx     # 0x79539
movl $0xe, %r13d
movl $0xe, %edi
movl $0xa7b1, %edx           # imm = 0xA7B1
xorl %eax, %eax
callq 0xb9c7
movq -0x38(%rbp), %rdi
callq 0xa3c7
movq -0x50(%rbp), %r12
jmp 0x19e17
movq -0x68(%rbp), %rax
movslq 0x28(%rax), %rcx
testq %rcx, %rcx
movq -0x50(%rbp), %r12
jle 0x19d72
movq -0x68(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x1(%rcx), %rax
shlq $0x5, %rcx
addq %rdx, %rcx
addq $-0x18, %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x19d65
cmpq %r14, 0x8(%rdx)
je 0x1a14c
decq %rax
addq $-0x20, %rcx
cmpq $0x2, %rax
jae 0x19d53
movq -0x40(%rbp), %r15
movq %r14, 0x8(%r15)
incl 0x60(%r14)
movq %rbx, %rdi
callq 0xa3c7
cmpb $0x0, 0x11(%r15)
jne 0x1a0e8
jmp 0x1a1ae
movq %rdx, -0x80(%rbp)
subl %edx, %ebx
addl $0x2, %ebx
movq $0x0, -0x90(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x88(%rbp)
movq $0x0, -0x78(%rbp)
jmp 0x19a1b
movl %eax, -0x110(%rbp)
movb $0x1, %bl
xorl %r15d, %r15d
xorl %r12d, %r12d
leaq -0x110(%rbp), %rsi
movq %r14, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1a26a
testl %eax, %eax
je 0x19e52
movl %eax, %r13d
movq -0x50(%rbp), %r12
movq 0x48(%r14), %rbx
movq (%rbx), %rax
testq %rax, %rax
je 0x19e08
movq %rbx, %rdi
callq *0x8(%rax)
movq $0x0, (%rbx)
movq %r14, %rdi
callq 0xa3c7
movq -0x98(%rbp), %r14
movq (%r14), %rdi
testq %rdi, %rdi
je 0x19e24
callq 0x1a3c3
movq %r14, %rdi
callq 0xa3c7
movq -0x40(%rbp), %rdi
callq 0xa3c7
movq $0x0, (%r12)
movl %r13d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x44(%rbp), %r13d
andl $0x1, %r13d
movl -0x2c(%rbp), %edx
movl %edx, %eax
shrl %eax
xorl $0x1, %eax
xorl %ecx, %ecx
testl %edx, %edx
movl -0x110(%rbp), %edx
leaq 0x6e3(%rip), %rsi       # 0x1a558
cmoveq %rsi, %rcx
movq 0x110(%r14), %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 %r14, 0x38(%rsi)
movl $0x64, 0x1c(%rsi)
movl %r13d, %eax
xorb $0x1, %al
movb %al, 0xa(%r14)
movl $0x3fffffff, 0xc0(%r14) # imm = 0x3FFFFFFF
movb %r12b, 0x10(%r14)
movb %r12b, 0x8(%r14)
movb %r12b, 0x15(%r14)
movq -0x78(%rbp), %rax
movb %al, 0x12(%r14)
movb %r15b, 0x11(%r14)
movb %r12b, 0xb(%r14)
testb %bl, %bl
je 0x19eee
movl $0x2220201, 0xc(%r14)   # imm = 0x2220201
movw $0x78, 0xb0(%r14)
movq $-0x1, 0xc8(%r14)
movq %r14, %rdi
callq 0x1a4fb
testb $0x3, -0x44(%rbp)
movq -0x50(%rbp), %r12
je 0x19f23
testl %r13d, %r13d
sete %al
addb %al, %al
addb $0x2, %al
movb %al, 0x9(%r14)
leaq 0x2d3(%rip), %rax       # 0x1a1fd
movq %rax, 0x100(%r14)
movq -0x98(%rbp), %rcx
movq %r14, (%rcx)
movq -0x68(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, 0xa0(%r14)
movq %r14, %rdi
movq %rcx, %r14
callq 0x1cc2a
movq (%r14), %rax
xorps %xmm0, %xmm0
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
movaps %xmm0, -0x100(%rbp)
movaps %xmm0, -0x110(%rbp)
movl $0x0, -0xb0(%rbp)
movq 0x48(%rax), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x19fbe
leaq -0x110(%rbp), %rsi
movl $0x64, %edx
xorl %ecx, %ecx
callq *0x10(%rax)
cmpl $0x20a, %eax            # imm = 0x20A
je 0x19fbe
movl %eax, %r13d
testl %eax, %eax
jne 0x19e17
movl -0x44(%rbp), %eax
movb %al, 0x20(%r14)
movq -0x68(%rbp), %rax
movq %rax, 0x8(%r14)
movq (%r14), %rdx
leaq 0x248(%rip), %rax       # 0x1a21f
movq %rax, 0xe0(%rdx)
movq %r14, 0xe8(%rdx)
movq 0x48(%rdx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x1a003
addq $0xe0, %rdx
movl $0xf, %esi
callq *0x50(%rax)
movq (%r14), %rdx
movq -0x40(%rbp), %rax
movq %r14, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
cmpb $0x0, 0x11(%rdx)
je 0x1a01e
orb $0x1, 0x26(%r14)
movzbl -0x100(%rbp), %ecx
shll $0x8, %ecx
movzbl -0xff(%rbp), %edi
shll $0x10, %edi
leal (%rdi,%rcx), %eax
leaq 0x30(%r14), %rsi
movl %eax, 0x30(%r14)
addl %edi, %ecx
addl $0xfffeffff, %ecx       # imm = 0xFFFEFFFF
cmpl $0xffff01ff, %ecx       # imm = 0xFFFF01FF
jb 0x1a057
leal 0x1ffff(%rax), %ecx
testl %eax, %ecx
je 0x1a075
cmpq $0x0, -0x58(%rbp)
sete %al
movl $0x0, (%rsi)
xorl %ebx, %ebx
orb -0x6c(%rbp), %al
jne 0x1a0a0
movw $0x0, 0x21(%r14)
jmp 0x1a0a0
movzbl -0xfc(%rbp), %ebx
orw $0x2, 0x26(%r14)
movl -0xdc(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x21(%r14)
movl -0xd0(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x22(%r14)
movq %rdx, %rdi
movl %ebx, %edx
callq 0x1a26a
testl %eax, %eax
je 0x1a0b6
movl %eax, %r13d
jmp 0x19e17
movl 0x30(%r14), %eax
subl %ebx, %eax
movl %eax, 0x34(%r14)
movq -0x40(%rbp), %rax
cmpb $0x0, 0x11(%rax)
je 0x1a1ae
movl $0x1, 0x60(%r14)
movq 0x7be7b(%rip), %rax     # 0x95f58
movq %rax, 0x68(%r14)
movq %r14, 0x7be70(%rip)     # 0x95f58
movq -0x68(%rbp), %rax
movslq 0x28(%rax), %rax
testq %rax, %rax
jle 0x1a1ae
movq -0x68(%rbp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x1a117
cmpb $0x0, 0x11(%rsi)
jne 0x1a125
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x1a107
jmp 0x1a1ae
movq %rsi, %rdx
movq 0x28(%rsi), %rsi
testq %rsi, %rsi
jne 0x1a125
movq -0x40(%rbp), %r8
movq 0x8(%r8), %rdi
movl $0x20, %eax
cmpq 0x8(%rdx), %rdi
jae 0x1a168
leaq 0x28(%rdx), %rdi
xorl %ecx, %ecx
jmp 0x1a1a0
movq %rbx, %rdi
callq 0xa3c7
movq -0x40(%rbp), %rdi
callq 0xa3c7
movl $0x13, %r13d
jmp 0x19e3d
movq %rdx, %rsi
movq %rsi, %rcx
movq 0x20(%rsi), %rsi
testq %rsi, %rsi
je 0x1a196
cmpq %rdi, 0x8(%rsi)
jb 0x1a16b
leaq 0x20(%rcx), %rdi
movq -0x40(%rbp), %r8
movq %rsi, 0x20(%r8)
movl $0x28, %eax
movq %rcx, %rdx
movq %r8, %rcx
jmp 0x1a1a3
leaq 0x20(%rcx), %rdi
xorl %edx, %edx
movq -0x40(%rbp), %r8
movq %r8, %rsi
movq %rdx, (%r8,%rax)
movq %rcx, 0x28(%rsi)
movq %r8, (%rdi)
movq -0x40(%rbp), %rax
movq %rax, (%r12)
movq (%rax), %rcx
movq 0x8(%rax), %rax
movq %rcx, 0x8(%rax)
xorl %r13d, %r13d
cmpq $0x0, 0x40(%rax)
jne 0x19e3d
movq (%rax), %rax
movq 0x110(%rax), %rax
movl $0x7d0, 0x1c(%rax)      # imm = 0x7D0
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x19e3d
movl $0x7d0, %esi            # imm = 0x7D0
callq *0x7a2d8(%rip)          # 0x944d0
jmp 0x19e3d