// File: /workspace/github_c_makefile_star2_O1/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, %r14d
movl %r8d, %ebx
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rax
movq %rdi, -0x50(%rbp)
testq %rsi, %rsi
je 0x197a3
cmpb $0x0, (%rax)
sete %r15b
jmp 0x197a6
movb $0x1, %r15b
testq %rax, %rax
movq %rax, -0x68(%rbp)
je 0x197c2
leaq 0x60016(%rip), %rsi     # 0x797cc
movq %rax, %rdi
callq 0x8530
testl %eax, %eax
je 0x197d8
testb %r15b, %r15b
je 0x197d0
movb $0x1, %al
cmpb $0x2, 0x4f(%r13)
je 0x197da
movl %r14d, %eax
shrb $0x7, %al
jmp 0x197da
movb $0x1, %al
movl %ebx, %ecx
orl $0x2, %ecx
testb $0x1, %al
cmovel %ebx, %ecx
movl %ecx, -0x3c(%rbp)
movb %al, -0x29(%rbp)
orb %r15b, %al
movl %r14d, %ebx
andl $0xfffffcff, %ebx       # imm = 0xFFFFFCFF
orl $0x200, %ebx            # imm = 0x200
testb $0x1, %al
cmovel %r14d, %ebx
testl $0x100, %r14d           # imm = 0x100
cmovel %r14d, %ebx
movl $0x48, %edi
callq 0xa2a2
testq %rax, %rax
je 0x19922
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movq $0x0, 0x40(%rax)
movq %r13, (%rax)
movq %rax, 0x30(%rax)
movl $0x1, 0x38(%rax)
testb %r15b, %r15b
movq %r13, -0x60(%rbp)
jne 0x1986c
testb $0x40, %bl
sete %al
andb -0x29(%rbp), %al
btl $0x11, %ebx
setae %cl
orb %al, %cl
je 0x199b9
xorl %eax, %eax
xorl %r13d, %r13d
movl %eax, %r15d
testq %r13, %r13
je 0x1992d
cmpb $0x0, 0x11(%r14)
je 0x19d32
movq -0x60(%rbp), %rax
movslq 0x28(%rax), %rax
testq %rax, %rax
jle 0x19d32
movq -0x60(%rbp), %rcx
movq 0x20(%rcx), %rcx
shlq $0x5, %rax
xorl %edx, %edx
movq 0x8(%rcx,%rdx), %rsi
testq %rsi, %rsi
je 0x198b7
cmpb $0x0, 0x11(%rsi)
jne 0x198c5
addq $0x20, %rdx
cmpq %rdx, %rax
jne 0x198a7
jmp 0x19d32
movq %rsi, %rax
movq 0x28(%rsi), %rsi
testq %rsi, %rsi
jne 0x198c5
movq 0x8(%r14), %rdx
cmpq 0x8(%rax), %rdx
jae 0x198f3
movq %rax, 0x20(%r14)
addq $0x28, %rax
movq $0x0, 0x28(%r14)
movq %rax, %rcx
jmp 0x19d2f
movq %rax, %rcx
movq 0x20(%rax), %rax
testq %rax, %rax
je 0x19d1d
cmpq %rdx, 0x8(%rax)
jb 0x198f3
movq %rax, 0x20(%r14)
movq %rcx, 0x28(%r14)
movq %r14, %rdx
testq %rax, %rax
jne 0x19d27
jmp 0x19d2b
movl $0x7, %r15d
jmp 0x19d9f
movq %r12, -0x80(%rbp)
movl $0x88, %edi
callq 0xa2a2
xorl %r12d, %r12d
testq %rax, %rax
je 0x19a20
movq %rax, -0xa8(%rbp)
movq %rax, %r13
movl $0x88, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x8200
movl $0x400, -0x110(%rbp)    # imm = 0x400
movq -0x50(%rbp), %r15
movl 0x4(%r15), %eax
leal 0x7(%rax), %ecx
andl $-0x8, %ecx
cmpl $0x31, %eax
movl $0x30, %edx
cmovgel %ecx, %edx
movq $0x0, (%r13)
movl -0x3c(%rbp), %eax
andl $0x2, %eax
movl %eax, -0x94(%rbp)
movq %r14, -0x78(%rbp)
movq %rdx, -0x58(%rbp)
jne 0x19a32
movq $0x0, -0x70(%rbp)
xorl %r8d, %r8d
movq -0x68(%rbp), %rax
jmp 0x19ba7
movq %r12, -0x80(%rbp)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %r15d
incl %r15d
movl %r15d, %edi
callq 0xa2a2
movb $0x1, 0x11(%r14)
testq %rax, %rax
je 0x19ab7
movq %rax, %r12
cmpb $0x0, -0x29(%rbp)
movq -0x68(%rbp), %rsi
je 0x19acd
testq %rsi, %rsi
je 0x19b1a
movq $-0x1, %rdx
cmpb $0x0, 0x1(%rsi,%rdx)
leaq 0x1(%rdx), %rdx
jne 0x199ff
movq $0x0, -0x38(%rbp)
andl $0x3fffffff, %edx       # imm = 0x3FFFFFFF
incq %rdx
jmp 0x19b27
movl $0x7, %r15d
xorl %r13d, %r13d
movq -0x80(%rbp), %r12
jmp 0x19d36
movq -0x68(%rbp), %rax
testq %rax, %rax
je 0x19b07
cmpb $0x0, (%rax)
je 0x19b9b
xorl %r15d, %r15d
cmpb $0x0, (%rax,%r15)
leaq 0x1(%r15), %r15
jne 0x19a4b
decl %r15d
andl $0x3fffffff, %r15d      # imm = 0x3FFFFFFF
incl %r15d
movl %r15d, %edi
callq 0xa2a2
testq %rax, %rax
je 0x1a03f
movq %rax, %rdi
movb $0x1, %al
movq %rax, -0x70(%rbp)
movl %r15d, %edx
movq -0x68(%rbp), %rsi
movq %rdi, %r15
callq 0x82f0
movq %r15, %r8
xorl %r12d, %r12d
cmpb $0x0, (%r8,%r12)
leaq 0x1(%r12), %r12
jne 0x19a92
decl %r12d
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
xorl %eax, %eax
movq -0x50(%rbp), %r15
movq -0x58(%rbp), %rdx
jmp 0x19ba7
movq $0x0, -0x38(%rbp)
movl $0x7, %r15d
movq %r14, %r12
xorl %r13d, %r13d
jmp 0x19b03
movq $0x0, -0x38(%rbp)
movb $0x0, (%r12)
movq -0x50(%rbp), %rdi
movl %r15d, %edx
movq %r12, %rcx
callq *0x40(%rdi)
testl %eax, %eax
je 0x19b2f
movl %eax, %r15d
movq %r12, %rdi
callq 0xa2e8
xorl %r13d, %r13d
movq %r14, %r12
movl %r15d, %eax
movq %rax, -0x38(%rbp)
xorl %ecx, %ecx
jmp 0x19b78
movb $0x1, %al
movq %rax, -0x70(%rbp)
xorl %r8d, %r8d
xorl %r12d, %r12d
xorl %eax, %eax
jmp 0x19ba7
movq $0x0, -0x38(%rbp)
movl $0x1, %edx
movq %r12, %rdi
callq 0x82f0
movq 0x7c422(%rip), %r13     # 0x95f58
movl $0x13, %r15d
testq %r13, %r13
je 0x19b76
movq %r14, -0x78(%rbp)
movq (%r13), %r14
movq 0xd0(%r14), %rsi
movq %r12, %rdi
callq 0x8530
testl %eax, %eax
jne 0x19b69
movq -0x50(%rbp), %rax
cmpq %rax, (%r14)
je 0x19db4
movq 0x68(%r13), %r13
testq %r13, %r13
jne 0x19b45
movq -0x78(%rbp), %r14
movb $0x1, %cl
movq %r12, %rdi
movq %rcx, %r12
callq 0xa2e8
movl %r12d, %eax
testb %al, %al
movq -0x80(%rbp), %r12
movq -0x38(%rbp), %rax
jne 0x19871
jmp 0x19d9f
movb $0x1, %cl
movq %rcx, -0x70(%rbp)
xorl %r8d, %r8d
xorl %r12d, %r12d
testq %rax, %rax
movq %rax, -0x90(%rbp)
je 0x19cfd
cmpb $0x0, (%rax)
je 0x19cfd
movl 0x8(%r15), %r12d
leal 0x2(,%r12,2), %edi
incl %r12d
callq 0xa2a2
movq %rax, %r8
testq %rax, %rax
je 0x19d09
movb $0x0, (%r8)
movq %r15, %rdi
movq -0x90(%rbp), %rsi
movl %r12d, %edx
movq %r8, %rcx
movq %r8, -0x38(%rbp)
callq *0x40(%r15)
movq -0x38(%rbp), %r8
movl %eax, %edx
xorl %r12d, %r12d
cmpb $0x0, (%r8,%r12)
leaq 0x1(%r12), %r12
jne 0x19c05
movq $-0x1, %rax
movq -0x90(%rbp), %rcx
cmpb $0x0, 0x1(%rcx,%rax)
leaq 0x1(%rax), %rax
jne 0x19c1f
decl %r12d
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
leaq (%rax,%rcx), %rsi
incq %rsi
cmpb $0x0, (%rsi)
movq %rsi, %r14
je 0x19c87
movq %rsi, %r14
movq $-0x1, %rax
cmpb $0x0, 0x1(%r14,%rax)
leaq 0x1(%rax), %rax
jne 0x19c4b
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
addq %r14, %rax
incq %rax
movq $-0x1, %rcx
cmpb $0x0, 0x1(%rax,%rcx)
leaq 0x1(%rcx), %rcx
jne 0x19c69
andl $0x3fffffff, %ecx       # imm = 0x3FFFFFFF
leaq (%rax,%rcx), %r14
incq %r14
cmpb $0x0, (%r14)
jne 0x19c44
andl $0x3fffffff, %r12d      # imm = 0x3FFFFFFF
subl %esi, %r14d
testl %edx, %edx
jne 0x19cd0
leal 0x8(%r12), %eax
xorl %edx, %edx
cmpl 0x8(%r15), %eax
jle 0x19cd0
movq %rsi, %r15
leaq 0x5fa30(%rip), %rsi     # 0x796dc
leaq 0x5f886(%rip), %rcx     # 0x79539
movl $0xe, %edi
movl $0xa7b1, %edx           # imm = 0xA7B1
xorl %eax, %eax
callq 0xb8cc
movq %r15, %rsi
movl $0xe, %edx
movq -0x38(%rbp), %r8
incl %r14d
testl %edx, %edx
je 0x19e0c
movq %r8, %rdi
movq %rdx, %r15
movq %rsi, -0x88(%rbp)
callq 0xa2e8
movq -0x88(%rbp), %rsi
movq %r15, %rcx
movq -0x38(%rbp), %r8
jmp 0x19d16
xorl %ecx, %ecx
xorl %esi, %esi
xorl %r14d, %r14d
jmp 0x19e1c
movl $0x7, %r15d
xorl %ecx, %ecx
xorl %esi, %esi
xorl %r14d, %r14d
xorl %eax, %eax
jmp 0x19e10
movq %rax, 0x20(%r14)
movq %r14, %rax
movq %rcx, %rdx
movq %rdx, 0x28(%rax)
addq $0x20, %rcx
movq %r14, (%rcx)
movq %r14, (%r12)
testl %r15d, %r15d
je 0x19d68
testq %r13, %r13
je 0x19d4e
movq (%r13), %rdi
testq %rdi, %rdi
je 0x19d4e
callq 0x1a57b
movq %r13, %rdi
callq 0xa2e8
movq %r14, %rdi
callq 0xa2e8
movq $0x0, (%r12)
jmp 0x19d9f
movq (%r14), %rcx
movq 0x8(%r14), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x40(%rax)
jne 0x19d9f
movq (%rax), %rax
movq 0x110(%rax), %rax
movl $0x7d0, 0x1c(%rax)      # imm = 0x7D0
movq 0x40(%rax), %rdi
testq %rdi, %rdi
je 0x19d9f
movl $0x7d0, %esi            # imm = 0x7D0
callq *0x7a731(%rip)          # 0x944d0
movl %r15d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x60(%rbp), %rax
movslq 0x28(%rax), %rcx
testq %rcx, %rcx
setle %sil
movq -0x78(%rbp), %r14
jle 0x19dff
movq 0x20(%rax), %rdx
leaq 0x1(%rcx), %rax
shlq $0x5, %rcx
addq %rdx, %rcx
addq $-0x18, %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0x19dee
cmpq %r13, 0x8(%rdx)
je 0x1a35e
decq %rax
addq $-0x20, %rcx
cmpq $0x2, %rax
setl %sil
jge 0x19ddc
movq %r13, 0x8(%r14)
incl 0x60(%r13)
jmp 0x1a374
movb $0x1, %al
xorl %ecx, %ecx
movq -0x58(%rbp), %rdx
testb %al, %al
je 0x1a190
movq %rsi, -0x88(%rbp)
movq %rcx, -0xa0(%rbp)
movq %r8, -0x38(%rbp)
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
addl $0x7, %eax
andl $-0x8, %eax
leal (%r12,%r12,2), %ecx
leal (%rcx,%rdx,2), %ecx
addl %r14d, %ecx
leal (%rax,%rcx), %r15d
addl $0x189, %r15d           # imm = 0x189
movl %r15d, %edi
callq 0xa2a2
testq %rax, %rax
je 0x1a036
movslq %r15d, %rdx
movq %rax, %rdi
xorl %esi, %esi
movq %rax, -0x48(%rbp)
callq 0x8200
movq -0x48(%rbp), %r8
leaq 0x128(%r8), %rax
movq %rax, 0x110(%r8)
leaq 0x178(%r8), %rax
movq %rax, 0x48(%r8)
movq -0x50(%rbp), %rcx
movslq 0x4(%rcx), %rax
addq $0x7, %rax
andq $-0x8, %rax
leaq (%r8,%rax), %rdi
addq $0x178, %rdi            # imm = 0x178
movq %rdi, 0x58(%r8)
movslq -0x58(%rbp), %rax
addq %rax, %rdi
movq %rdi, 0x50(%r8)
addq %rax, %rdi
movq %rdi, 0xd0(%r8)
movq -0x38(%rbp), %rsi
testq %rsi, %rsi
movq %rcx, %rax
je 0x19f93
movslq %r12d, %r15
leal (%r14,%r12), %eax
incl %eax
cltq
addq %rdi, %rax
movq %rax, 0xd8(%r8)
movq %r15, %rdx
callq 0x82f0
testl %r14d, %r14d
je 0x19f15
movslq %r14d, %rdx
incl %r12d
movslq %r12d, %rdi
movq -0x48(%rbp), %rax
addq 0xd0(%rax), %rdi
movq -0x88(%rbp), %rsi
callq 0x82f0
movq -0x48(%rbp), %r12
movq 0xd8(%r12), %rdi
movq -0x38(%rbp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x82f0
movq 0xd8(%r12), %rax
movabsq $0x6c616e72756f6a2d, %rcx # imm = 0x6C616E72756F6A2D
movq %rcx, (%rax,%r15)
movw $0x0, 0x8(%rax,%r15)
movq 0xd8(%r12), %rax
leaq 0x9(%rax,%r15), %rdi
movq %rdi, 0x120(%r12)
movq %r14, %rsi
movq %r15, %rdx
callq 0x82f0
movq 0x120(%r12), %rax
movl $0x6c61772d, (%rax,%r15) # imm = 0x6C61772D
movb $0x0, 0x4(%rax,%r15)
movq %r14, %rdi
callq 0xa2e8
movq -0x50(%rbp), %rax
movq %r12, %r8
movq %rax, (%r8)
movl %ebx, 0xb4(%r8)
movq -0x90(%rbp), %rcx
testq %rcx, %rcx
je 0x1a01d
cmpb $0x0, (%rcx)
je 0x1a01d
movq %rax, %rdi
leaq -0xac(%rbp), %r15
movl $0x0, (%r15)
movq 0x48(%r8), %rdx
movq 0xd0(%r8), %rsi
andl $0x87f7f, %ebx          # imm = 0x87F7F
movl %ebx, %ecx
movq %r15, %r8
callq *0x28(%rdi)
movq -0x48(%rbp), %r8
movl (%r15), %ebx
andl $0x1, %ebx
movl %eax, %ecx
orl %ebx, %ecx
jne 0x1a050
movq %r8, %rdi
movq %rax, %r14
callq 0x1a6b3
movq -0x48(%rbp), %r8
movq %r14, %rax
movl 0xb8(%r8), %ecx
cmpl %ecx, -0x110(%rbp)
jae 0x1a050
cmpl $0x2001, %ecx           # imm = 0x2001
jb 0x1a04a
movl $0x2000, -0x110(%rbp)   # imm = 0x2000
jmp 0x1a050
movw $0x401, 0x13(%r8)       # imm = 0x401
andl $0x1, %ebx
movb $0x1, %r12b
xorl %r14d, %r14d
movq -0xa0(%rbp), %rax
jmp 0x1a056
movq -0x38(%rbp), %rdi
callq 0xa2e8
movl $0x7, %r15d
jmp 0x1a190
movl %ecx, -0x110(%rbp)
movb $0x1, %r14b
xorl %r12d, %r12d
movl %eax, %r15d
testl %eax, %eax
jne 0x1a078
leaq -0x110(%rbp), %rsi
movq %r8, %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x1a405
movq -0x48(%rbp), %r8
movl %eax, %r15d
testl %r15d, %r15d
je 0x1a0a7
movq 0x48(%r8), %rbx
movq (%rbx), %rax
testq %rax, %rax
je 0x1a09a
movq %rbx, %rdi
callq *0x8(%rax)
movq -0x48(%rbp), %r8
movq $0x0, (%rbx)
movq %r8, %rdi
callq 0xa2e8
jmp 0x1a190
movl -0x3c(%rbp), %r15d
andl $0x1, %r15d
movl -0x94(%rbp), %edx
movl %edx, %eax
shrl %eax
xorl $0x1, %eax
xorl %ecx, %ecx
testl %edx, %edx
movl -0x110(%rbp), %edx
leaq 0x642(%rip), %rsi       # 0x1a70f
cmoveq %rsi, %rcx
movq 0x110(%r8), %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 %r8, 0x38(%rsi)
movl $0x64, 0x1c(%rsi)
movl %r15d, %eax
xorb $0x1, %al
movb %al, 0xa(%r8)
movl $0x3fffffff, 0xc0(%r8) # imm = 0x3FFFFFFF
movb %r12b, 0x10(%r8)
movb %r12b, 0x8(%r8)
movb %r12b, 0x15(%r8)
movq -0x70(%rbp), %rax
movb %al, 0x12(%r8)
movb %bl, 0x11(%r8)
movb %r12b, 0xb(%r8)
testb %r14b, %r14b
je 0x1a147
movl $0x2220201, 0xc(%r8)    # imm = 0x2220201
movw $0x78, 0xb0(%r8)
movq $-0x1, 0xc8(%r8)
movq %r8, %rdi
callq 0x1a6b3
movq -0x48(%rbp), %rcx
testb $0x3, -0x3c(%rbp)
je 0x1a17b
testl %r15d, %r15d
sete %al
addb %al, %al
addb $0x2, %al
movb %al, 0x9(%rcx)
leaq 0x216(%rip), %rax       # 0x1a398
movq %rax, 0x100(%rcx)
movq %rcx, (%r13)
xorl %r15d, %r15d
testl %r15d, %r15d
movq -0x80(%rbp), %r12
movq -0x78(%rbp), %r14
jne 0x1a224
movq (%r13), %rdi
movq -0x60(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, 0xa0(%rdi)
callq 0x1cde1
movq (%r13), %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 0x1a221
xorl %ebx, %ebx
leaq -0x110(%rbp), %rsi
movl $0x64, %edx
xorl %ecx, %ecx
callq *0x10(%rax)
movl %eax, %r15d
cmpl $0x20a, %eax            # imm = 0x20A
cmovel %ebx, %r15d
jmp 0x1a224
xorl %r15d, %r15d
testl %r15d, %r15d
jne 0x19d36
movl -0x3c(%rbp), %eax
movb %al, 0x20(%r13)
movq -0x60(%rbp), %rax
movq %rax, 0x8(%r13)
movq (%r13), %rdx
leaq 0x173(%rip), %rax       # 0x1a3ba
movq %rax, 0xe0(%rdx)
movq %r13, 0xe8(%rdx)
movq 0x48(%rdx), %rdi
movq (%rdi), %rax
testq %rax, %rax
je 0x1a270
addq $0xe0, %rdx
movl $0xf, %esi
callq *0x50(%rax)
movq %r13, 0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r13)
movq (%r13), %rdi
cmpb $0x0, 0x11(%rdi)
movq -0xa8(%rbp), %rsi
je 0x1a292
orb $0x1, 0x26(%r13)
movzbl -0x100(%rbp), %ecx
shll $0x8, %ecx
movzbl -0xff(%rbp), %edx
shll $0x10, %edx
leal (%rdx,%rcx), %eax
addq $0x30, %rsi
movl %eax, 0x30(%r13)
addl %edx, %ecx
addl $0xfffeffff, %ecx       # imm = 0xFFFEFFFF
cmpl $0xffff01ff, %ecx       # imm = 0xFFFF01FF
jb 0x1a2cb
leal 0x1ffff(%rax), %ecx
testl %eax, %ecx
je 0x1a2e9
cmpq $0x0, -0x68(%rbp)
sete %al
movl $0x0, (%rsi)
xorl %ebx, %ebx
orb -0x29(%rbp), %al
jne 0x1a314
movw $0x0, 0x21(%r13)
jmp 0x1a314
movzbl -0xfc(%rbp), %ebx
orw $0x2, 0x26(%r13)
movl -0xdc(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x21(%r13)
movl -0xd0(%rbp), %eax
bswapl %eax
testl %eax, %eax
setne 0x22(%r13)
movl %ebx, %edx
callq 0x1a405
testl %eax, %eax
je 0x1a327
movl %eax, %r15d
jmp 0x19d36
movl 0x30(%r13), %eax
subl %ebx, %eax
movl %eax, 0x34(%r13)
xorl %r15d, %r15d
cmpb $0x0, 0x11(%r14)
je 0x1987d
movl $0x1, 0x60(%r13)
movq 0x7bc0a(%rip), %rax     # 0x95f58
movq %rax, 0x68(%r13)
movq %r13, 0x7bbff(%rip)     # 0x95f58
jmp 0x1987d
movq %r12, %rdi
movl %esi, %r15d
callq 0xa2e8
movq %r14, %rdi
callq 0xa2e8
movl %r15d, %esi
movl $0x13, %r15d
movq $0x0, -0x38(%rbp)
movl $0x0, %eax
testb $0x1, %sil
movb $0x1, %cl
jne 0x19b78
jmp 0x19b86