// File: /workspace/github_c_makefile_star2_O0/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
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movb $0x1, %al
cmpq $0x0, -0x18(%rbp)
movb %al, -0xf9(%rbp)
je 0x1f8fc
movq -0x18(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
movb %al, -0xf9(%rbp)
movb -0xf9(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xc4(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x1f933
movq -0x18(%rbp), %rdi
leaq 0x8e9a4(%rip), %rsi     # 0xae2c3
callq 0x85d0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0xfa(%rbp)
je 0x1f968
cmpl $0x0, -0xc4(%rbp)
je 0x1f954
movq -0x20(%rbp), %rdi
callq 0x200c0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0xfa(%rbp)
jne 0x1f968
movl -0x30(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
setne %al
movb %al, -0xfa(%rbp)
movb -0xfa(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0xc8(%rbp)
cmpl $0x0, -0xc8(%rbp)
je 0x1f98b
movl -0x2c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x2c(%rbp)
movl -0x30(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1f9ba
cmpl $0x0, -0xc8(%rbp)
jne 0x1f9aa
cmpl $0x0, -0xc4(%rbp)
je 0x1f9ba
movl -0x30(%rbp), %eax
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
orl $0x200, %eax            # imm = 0x200
movl %eax, -0x30(%rbp)
movl $0x48, %edi
callq 0xd860
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x1f9db
movl $0x7, -0x4(%rbp)
jmp 0x200aa
movq -0x40(%rbp), %rax
movb $0x0, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x40(%rbp), %rax
movl $0x1, 0x38(%rax)
cmpl $0x0, -0xc4(%rbp)
jne 0x1fc37
cmpl $0x0, -0xc8(%rbp)
je 0x1fa2a
movl -0x30(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
je 0x1fc37
movl -0x30(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
je 0x1fc35
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
movl -0xcc(%rbp), %edi
callq 0xa3c0
movq %rax, -0xd8(%rbp)
movq -0x40(%rbp), %rax
movb $0x1, 0x11(%rax)
cmpq $0x0, -0xd8(%rbp)
jne 0x1fa84
movq -0x40(%rbp), %rdi
callq 0xa420
movl $0x7, -0x4(%rbp)
jmp 0x200aa
cmpl $0x0, -0xc8(%rbp)
je 0x1faca
movq -0xd8(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x18(%rbp), %rdi
callq 0x92f0
movq -0x110(%rbp), %rdi
movq -0x108(%rbp), %rsi
addl $0x1, %eax
movslq %eax, %rdx
callq 0x82f0
jmp 0x1fb0f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0xcc(%rbp), %edx
movq -0xd8(%rbp), %rcx
callq 0x200e0
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x1fb0d
movq -0xd8(%rbp), %rdi
callq 0xa420
movq -0x40(%rbp), %rdi
callq 0xa420
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x200aa
jmp 0x1fb0f
movq 0xb2562(%rip), %rax     # 0xd2078
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1fc29
movq -0xd8(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
xorl %esi, %esi
callq 0x20120
movq -0x118(%rbp), %rdi
movq %rax, %rsi
callq 0x85d0
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %eax
jne 0x1fc16
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x20160
cmpq -0x10(%rbp), %rax
jne 0x1fc16
movq -0x20(%rbp), %rax
movl 0x28(%rax), %eax
subl $0x1, %eax
movl %eax, -0xdc(%rbp)
cmpl $0x0, -0xdc(%rbp)
jl 0x1fbfb
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xdc(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0xe8(%rbp)
cmpq $0x0, -0xe8(%rbp)
je 0x1fbe8
movq -0xe8(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x38(%rbp), %rax
jne 0x1fbe8
movq -0xd8(%rbp), %rdi
callq 0xa420
movq -0x40(%rbp), %rdi
callq 0xa420
movl $0x13, -0x4(%rbp)
jmp 0x200aa
jmp 0x1fbea
movl -0xdc(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x1fb82
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movl 0x60(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x60(%rax)
jmp 0x1fc29
jmp 0x1fc18
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x1fb1a
movq -0xd8(%rbp), %rdi
callq 0xa420
jmp 0x1fc37
cmpq $0x0, -0x38(%rbp)
jne 0x1fe92
movl $0x88, %edi
callq 0xd860
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x1fc63
movl $0x7, -0x4c(%rbp)
jmp 0x2002d
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x2c(%rbp), %r8d
movl -0x30(%rbp), %r9d
movl $0x78, %ecx
leaq 0xc3d(%rip), %rax       # 0x208c0
movq %rax, (%rsp)
callq 0x20180
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jne 0x1fcc4
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x20910
movq -0x38(%rbp), %rax
movq (%rax), %rdi
leaq -0xc0(%rbp), %rdx
movl $0x64, %esi
callq 0x20940
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x1fccf
jmp 0x2002d
movl -0x2c(%rbp), %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x20(%rax)
movq -0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
leaq 0xd27(%rip), %rsi       # 0x20a20
callq 0x209b0
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x1b8d0
cmpb $0x0, %al
je 0x1fd41
movq -0x38(%rbp), %rax
movzwl 0x26(%rax), %ecx
orl $0x1, %ecx
movw %cx, 0x26(%rax)
movzbl -0xb0(%rbp), %ecx
shll $0x8, %ecx
movzbl -0xaf(%rbp), %eax
shll $0x10, %eax
orl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x38(%rbp), %rax
cmpl $0x200, 0x30(%rax)      # imm = 0x200
jb 0x1fd8e
movq -0x38(%rbp), %rax
cmpl $0x10000, 0x30(%rax)    # imm = 0x10000
ja 0x1fd8e
movq -0x38(%rbp), %rax
movl 0x30(%rax), %eax
subl $0x1, %eax
movq -0x38(%rbp), %rcx
andl 0x30(%rcx), %eax
cmpl $0x0, %eax
je 0x1fdbf
movq -0x38(%rbp), %rax
movl $0x0, 0x30(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x1fdb9
cmpl $0x0, -0xc8(%rbp)
jne 0x1fdb9
movq -0x38(%rbp), %rax
movb $0x0, 0x21(%rax)
movq -0x38(%rbp), %rax
movb $0x0, 0x22(%rax)
movb $0x0, -0x4d(%rbp)
jmp 0x1fe27
movb -0xac(%rbp), %al
movb %al, -0x4d(%rbp)
movq -0x38(%rbp), %rax
movzwl 0x26(%rax), %ecx
orl $0x2, %ecx
movw %cx, 0x26(%rax)
leaq -0xc0(%rbp), %rdi
addq $0x34, %rdi
callq 0x20a50
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x21(%rax)
leaq -0xc0(%rbp), %rdi
addq $0x40, %rdi
callq 0x20a50
movl %eax, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x22(%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x30, %rsi
movzbl -0x4d(%rbp), %edx
callq 0x20a90
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
je 0x1fe4d
jmp 0x2002d
movq -0x38(%rbp), %rax
movl 0x30(%rax), %ecx
movzbl -0x4d(%rbp), %eax
subl %eax, %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x34(%rax)
movq -0x40(%rbp), %rax
cmpb $0x0, 0x11(%rax)
je 0x1fe90
movq -0x38(%rbp), %rax
movl $0x1, 0x60(%rax)
movq 0xb21fb(%rip), %rcx     # 0xd2078
movq -0x38(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x38(%rbp), %rax
movq %rax, 0xb21e8(%rip)     # 0xd2078
jmp 0x1fe92
movq -0x40(%rbp), %rax
cmpb $0x0, 0x11(%rax)
je 0x20022
movl $0x0, -0xec(%rbp)
movl -0xec(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jge 0x20020
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xec(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0xf8(%rbp)
cmpq $0x0, %rax
je 0x2000a
movq -0xf8(%rbp), %rax
movzbl 0x11(%rax), %eax
cmpl $0x0, %eax
je 0x2000a
jmp 0x1fefe
movq -0xf8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x1ff20
movq -0xf8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0xf8(%rbp)
jmp 0x1fefe
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq -0xf8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x1ff64
movq -0xf8(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x40(%rbp), %rcx
movq -0xf8(%rbp), %rax
movq %rcx, 0x28(%rax)
jmp 0x20008
jmp 0x1ff66
movq -0xf8(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x20(%rcx)
movb %al, -0x119(%rbp)
je 0x1ff9c
movq -0xf8(%rbp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
cmpq 0x8(%rcx), %rax
setb %al
movb %al, -0x119(%rbp)
movb -0x119(%rbp), %al
testb $0x1, %al
jne 0x1ffa8
jmp 0x1ffbc
movq -0xf8(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0xf8(%rbp)
jmp 0x1ff66
movq -0xf8(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0xf8(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x1fff9
movq -0x40(%rbp), %rcx
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rax
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rcx
movq -0xf8(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x20020
jmp 0x2000c
movl -0xec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x1feaa
jmp 0x20022
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
cmpl $0x0, -0x4c(%rbp)
je 0x2006f
cmpq $0x0, -0x38(%rbp)
je 0x20050
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x20050
movq -0x38(%rbp), %rax
movq (%rax), %rdi
callq 0x20c30
movq -0x38(%rbp), %rdi
callq 0xa420
movq -0x40(%rbp), %rdi
callq 0xa420
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
jmp 0x2009b
movq -0x40(%rbp), %rdi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x20d30
cmpq $0x0, %rax
jne 0x20099
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x20da0
jmp 0x2009b
cmpq $0x0, -0x48(%rbp)
je 0x200a4
jmp 0x200a4
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)