// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: allocateBtreePage
static int allocateBtreePage(
  BtShared *pBt,         /* The btree */
  MemPage **ppPage,      /* Store pointer to the allocated page here */
  Pgno *pPgno,           /* Store the page number here */
  Pgno nearby,           /* Search for a page near this one */
  u8 eMode               /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */
){
  MemPage *pPage1;
  int rc;
  u32 n;     /* Number of pages on the freelist */
  u32 k;     /* Number of leaves on the trunk of the freelist */
  MemPage *pTrunk = 0;
  MemPage *pPrevTrunk = 0;
  Pgno mxPage;     /* Total size of the database file */

  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) );
  pPage1 = pBt->pPage1;
  mxPage = btreePagecount(pBt);
  n = get4byte(&pPage1->aData[36]);
  testcase( n==mxPage-1 );
  if( n>=mxPage ){
    return SQLITE_CORRUPT_BKPT;
  }
  if( n>0 ){
    /* There are pages on the freelist.  Reuse one of those pages. */
    Pgno iTrunk;
    u8 searchList = 0; /* If the free-list must be searched for 'nearby' */
    
    /* If eMode==BTALLOC_EXACT and a query of the pointer-map
    ** shows that the page 'nearby' is somewhere on the free-list, then
    ** the entire-list will be searched for that page.
    */
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( eMode==BTALLOC_EXACT ){
      if( nearby<=mxPage ){
        u8 eType;
        assert( nearby>0 );
        assert( pBt->autoVacuum );
        rc = ptrmapGet(pBt, nearby, &eType, 0);
        if( rc ) return rc;
        if( eType==PTRMAP_FREEPAGE ){
          searchList = 1;
        }
      }
    }else if( eMode==BTALLOC_LE ){
      searchList = 1;
    }
#endif

    /* Decrement the free-list count by 1. Set iTrunk to the index of the
    ** first free-list trunk page. iPrevTrunk is initially 1.
    */
    rc = sqlite3PagerWrite(pPage1->pDbPage);
    if( rc ) return rc;
    put4byte(&pPage1->aData[36], n-1);

    /* The code within this loop is run only once if the 'searchList' variable
    ** is not true. Otherwise, it runs once for each trunk-page on the
    ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT)
    ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT)
    */
    do {
      pPrevTrunk = pTrunk;
      if( pPrevTrunk ){
        iTrunk = get4byte(&pPrevTrunk->aData[0]);
      }else{
        iTrunk = get4byte(&pPage1->aData[32]);
      }
      testcase( iTrunk==mxPage );
      if( iTrunk>mxPage ){
        rc = SQLITE_CORRUPT_BKPT;
      }else{
        rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0);
      }
      if( rc ){
        pTrunk = 0;
        goto end_allocate_page;
      }
      assert( pTrunk!=0 );
      assert( pTrunk->aData!=0 );

      k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */
      if( k==0 && !searchList ){
        /* The trunk has no leaves and the list is not being searched. 
        ** So extract the trunk page itself and use it as the newly 
        ** allocated page */
        assert( pPrevTrunk==0 );
        rc = sqlite3PagerWrite(pTrunk->pDbPage);
        if( rc ){
          goto end_allocate_page;
        }
        *pPgno = iTrunk;
        memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
        *ppPage = pTrunk;
        pTrunk = 0;
        TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
      }else if( k>(u32)(pBt->usableSize/4 - 2) ){
        /* Value of k is out of range.  Database corruption */
        rc = SQLITE_CORRUPT_BKPT;
        goto end_allocate_page;
#ifndef SQLITE_OMIT_AUTOVACUUM
      }else if( searchList 
            && (nearby==iTrunk || (iTrunk<nearby && eMode==BTALLOC_LE)) 
      ){
        /* The list is being searched and this trunk page is the page
        ** to allocate, regardless of whether it has leaves.
        */
        *pPgno = iTrunk;
        *ppPage = pTrunk;
        searchList = 0;
        rc = sqlite3PagerWrite(pTrunk->pDbPage);
        if( rc ){
          goto end_allocate_page;
        }
        if( k==0 ){
          if( !pPrevTrunk ){
            memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
          }else{
            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);
            if( rc!=SQLITE_OK ){
              goto end_allocate_page;
            }
            memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4);
          }
        }else{
          /* The trunk page is required by the caller but it contains 
          ** pointers to free-list leaves. The first leaf becomes a trunk
          ** page in this case.
          */
          MemPage *pNewTrunk;
          Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);
          if( iNewTrunk>mxPage ){ 
            rc = SQLITE_CORRUPT_BKPT;
            goto end_allocate_page;
          }
          testcase( iNewTrunk==mxPage );
          rc = btreeGetPage(pBt, iNewTrunk, &pNewTrunk, 0);
          if( rc!=SQLITE_OK ){
            goto end_allocate_page;
          }
          rc = sqlite3PagerWrite(pNewTrunk->pDbPage);
          if( rc!=SQLITE_OK ){
            releasePage(pNewTrunk);
            goto end_allocate_page;
          }
          memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4);
          put4byte(&pNewTrunk->aData[4], k-1);
          memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4);
          releasePage(pNewTrunk);
          if( !pPrevTrunk ){
            assert( sqlite3PagerIswriteable(pPage1->pDbPage) );
            put4byte(&pPage1->aData[32], iNewTrunk);
          }else{
            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);
            if( rc ){
              goto end_allocate_page;
            }
            put4byte(&pPrevTrunk->aData[0], iNewTrunk);
          }
        }
        pTrunk = 0;
        TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
#endif
      }else if( k>0 ){
        /* Extract a leaf from the trunk */
        u32 closest;
        Pgno iPage;
        unsigned char *aData = pTrunk->aData;
        if( nearby>0 ){
          u32 i;
          closest = 0;
          if( eMode==BTALLOC_LE ){
            for(i=0; i<k; i++){
              iPage = get4byte(&aData[8+i*4]);
              if( iPage<=nearby ){
                closest = i;
                break;
              }
            }
          }else{
            int dist;
            dist = sqlite3AbsInt32(get4byte(&aData[8]) - nearby);
            for(i=1; i<k; i++){
              int d2 = sqlite3AbsInt32(get4byte(&aData[8+i*4]) - nearby);
              if( d2<dist ){
                closest = i;
                dist = d2;
              }
            }
          }
        }else{
          closest = 0;
        }

        iPage = get4byte(&aData[8+closest*4]);
        testcase( iPage==mxPage );
        if( iPage>mxPage ){
          rc = SQLITE_CORRUPT_BKPT;
          goto end_allocate_page;
        }
        testcase( iPage==mxPage );
        if( !searchList 
         || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE)) 
        ){
          int noContent;
          *pPgno = iPage;
          TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
                 ": %d more free pages\n",
                 *pPgno, closest+1, k, pTrunk->pgno, n-1));
          rc = sqlite3PagerWrite(pTrunk->pDbPage);
          if( rc ) goto end_allocate_page;
          if( closest<k-1 ){
            memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
          }
          put4byte(&aData[4], k-1);
          noContent = !btreeGetHasContent(pBt, *pPgno) ? PAGER_GET_NOCONTENT : 0;
          rc = btreeGetPage(pBt, *pPgno, ppPage, noContent);
          if( rc==SQLITE_OK ){
            rc = sqlite3PagerWrite((*ppPage)->pDbPage);
            if( rc!=SQLITE_OK ){
              releasePage(*ppPage);
            }
          }
          searchList = 0;
        }
      }
      releasePage(pPrevTrunk);
      pPrevTrunk = 0;
    }while( searchList );
  }else{
    /* There are no pages on the freelist, so append a new page to the
    ** database image.
    **
    ** Normally, new pages allocated by this block can be requested from the
    ** pager layer with the 'no-content' flag set. This prevents the pager
    ** from trying to read the pages content from disk. However, if the
    ** current transaction has already run one or more incremental-vacuum
    ** steps, then the page we are about to allocate may contain content
    ** that is required in the event of a rollback. In this case, do
    ** not set the no-content flag. This causes the pager to load and journal
    ** the current page content before overwriting it.
    **
    ** Note that the pager will not actually attempt to load or journal 
    ** content for any page that really does lie past the end of the database
    ** file on disk. So the effects of disabling the no-content optimization
    ** here are confined to those pages that lie between the end of the
    ** database image and the end of the database file.
    */
    int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate)) ? PAGER_GET_NOCONTENT : 0;

    rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
    if( rc ) return rc;
    pBt->nPage++;
    if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++;

#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){
      /* If *pPgno refers to a pointer-map page, allocate two new pages
      ** at the end of the file instead of one. The first allocated page
      ** becomes a new pointer-map page, the second is used by the caller.
      */
      MemPage *pPg = 0;
      TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
      assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
      rc = btreeGetPage(pBt, pBt->nPage, &pPg, bNoContent);
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pPg->pDbPage);
        releasePage(pPg);
      }
      if( rc ) return rc;
      pBt->nPage++;
      if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; }
    }
#endif
    put4byte(28 + (u8*)pBt->pPage1->aData, pBt->nPage);
    *pPgno = pBt->nPage;

    assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );
    rc = btreeGetPage(pBt, *pPgno, ppPage, bNoContent);
    if( rc ) return rc;
    rc = sqlite3PagerWrite((*ppPage)->pDbPage);
    if( rc!=SQLITE_OK ){
      releasePage(*ppPage);
    }
    TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
  }

  assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );

end_allocate_page:
  releasePage(pTrunk);
  releasePage(pPrevTrunk);
  if( rc==SQLITE_OK ){
    if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){
      releasePage(*ppPage);
      return SQLITE_CORRUPT_BKPT;
    }
    (*ppPage)->isInit = 0;
  }else{
    *ppPage = 0;
  }
  assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) );
  return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, -0x6c(%rbp)
movq $0x0, -0x88(%rbp)
movq 0x18(%rdi), %r15
movl 0x3c(%rdi), %ecx
movq 0x50(%r15), %rax
movl 0x24(%rax), %r12d
bswapl %r12d
movl %ecx, -0x4c(%rbp)
cmpl %ecx, %r12d
jae 0x21b74
movq %rsi, %r13
movq %rdi, %rbx
testl %r12d, %r12d
movq %rdi, -0x58(%rbp)
movq %rdx, -0x68(%rbp)
je 0x21b9d
cmpb $0x2, %r8b
movq %r15, -0x40(%rbp)
movl %r8d, -0x5c(%rbp)
je 0x21ceb
movzbl %r8b, %eax
cmpl $0x1, %eax
jne 0x21b6c
movl -0x6c(%rbp), %esi
cmpl %esi, -0x4c(%rbp)
jae 0x22210
xorl %r14d, %r14d
jmp 0x21cee
leaq 0x57c99(%rip), %rsi     # 0x79814
leaq 0x579b7(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd52e, %edx           # imm = 0xD52E
xorl %eax, %eax
callq 0xb9c7
jmp 0x21cfd
xorl %r12d, %r12d
cmpb $0x0, 0x23(%rbx)
sete %r14b
movq 0x68(%r15), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x21cfb
movq %rbx, %rdi
movl 0x3c(%rbx), %r8d
leal 0x1(%r8), %esi
movl %esi, 0x3c(%rbx)
movl 0x72c73(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rbx)
movl %eax, %ecx
cmpl %eax, %r8d
jne 0x21be4
addl $0x2, %r8d
movl %r8d, 0x3c(%rdi)
movl %r8d, %esi
movb %r14b, %r12b
cmpb $0x0, 0x21(%rdi)
je 0x21c94
xorl %eax, %eax
cmpl $0x2, %esi
jb 0x21c2d
movl 0x34(%rdi), %eax
movl $0xcccccccd, %r8d       # imm = 0xCCCCCCCD
imulq %rax, %r8
shrq $0x22, %r8
incl %r8d
leal -0x2(%rsi), %r9d
movl %r9d, %eax
xorl %edx, %edx
divl %r8d
subl %edx, %r9d
leal 0x1(%r9), %eax
xorl %edx, %edx
cmpl %ecx, %eax
sete %dl
leal (%r9,%rdx), %eax
addl $0x2, %eax
cmpl %esi, %eax
movq -0x68(%rbp), %rcx
jne 0x21c98
leaq -0x80(%rbp), %rdx
movq $0x0, (%rdx)
movl %r12d, %ecx
callq 0x20068
testl %eax, %eax
jne 0x21cfb
movq -0x80(%rbp), %r14
movq 0x68(%r14), %rdi
callq 0xdfbf
movl %eax, %ebx
movq 0x68(%r14), %rdi
callq 0xddd3
testl %ebx, %ebx
jne 0x21cfd
movq -0x58(%rbp), %rdi
movl 0x3c(%rdi), %ecx
leal 0x1(%rcx), %esi
movl %esi, 0x3c(%rdi)
movl 0x72bbd(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rdi)
cmpl %eax, %ecx
jne 0x21c94
addl $0x2, %ecx
movl %ecx, 0x3c(%rdi)
movl %ecx, %esi
movq -0x68(%rbp), %rcx
movq 0x18(%rdi), %rax
movq 0x50(%rax), %rax
bswapl %esi
movl %esi, 0x1c(%rax)
movl 0x3c(%rdi), %esi
movl %esi, (%rcx)
movq %r13, %rdx
movl %r12d, %ecx
callq 0x20068
testl %eax, %eax
jne 0x21cfb
movq (%r13), %rax
movq 0x68(%rax), %rdi
callq 0xdfbf
testl %eax, %eax
je 0x2232f
movl %eax, %ebx
movq (%r13), %rax
testq %rax, %rax
je 0x22322
movq 0x68(%rax), %rdi
callq 0xddd3
jmp 0x22322
movb $0x1, %r14b
movq 0x68(%r15), %rdi
callq 0xdfbf
testl %eax, %eax
je 0x21d0e
movl %eax, %ebx
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x50(%r15), %rax
decl %r12d
bswapl %r12d
movl %r12d, 0x24(%rax)
xorl %eax, %eax
movq %r13, -0x30(%rbp)
testq %rax, %rax
movq %rax, -0x48(%rbp)
je 0x21d4d
movq 0x50(%rax), %rax
movzbl (%rax), %ecx
shll $0x18, %ecx
movzbl 0x1(%rax), %edx
shll $0x10, %edx
orl %ecx, %edx
movzbl 0x2(%rax), %ecx
shll $0x8, %ecx
orl %edx, %ecx
addq $0x3, %rax
jmp 0x21d6e
movq 0x50(%r15), %rax
movzbl 0x20(%rax), %ecx
shll $0x18, %ecx
movzbl 0x21(%rax), %edx
shll $0x10, %edx
orl %ecx, %edx
movzbl 0x22(%rax), %ecx
shll $0x8, %ecx
orl %edx, %ecx
addq $0x23, %rax
movq -0x58(%rbp), %rdi
movzbl (%rax), %r15d
orl %ecx, %r15d
cmpl -0x4c(%rbp), %r15d
ja 0x2223a
movl %r15d, %esi
leaq -0x88(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20068
testl %eax, %eax
jne 0x22263
movq -0x88(%rbp), %rax
movq %rax, -0x38(%rbp)
movq 0x50(%rax), %r12
movl 0x4(%r12), %r13d
bswapl %r13d
testb %r14b, %r14b
jne 0x21e10
testl %r13d, %r13d
jne 0x21e10
movq -0x38(%rbp), %r12
movq 0x68(%r12), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x2226a
movq -0x68(%rbp), %rax
movl %r15d, (%rax)
movq -0x40(%rbp), %r15
movq 0x50(%r15), %rax
movq 0x50(%r12), %rcx
movl (%rcx), %ecx
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %r13
movq %r12, (%r13)
movq $0x0, -0x88(%rbp)
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %ebx, %ebx
movq -0x48(%rbp), %rdx
jmp 0x221dd
movq -0x58(%rbp), %rax
movl 0x34(%rax), %eax
shrl $0x2, %eax
addl $-0x2, %eax
cmpl %eax, %r13d
ja 0x22275
testb %r14b, %r14b
movl -0x6c(%rbp), %r9d
je 0x21e42
cmpb $0x2, -0x5c(%rbp)
sete %al
cmpl %r9d, %r15d
setb %cl
je 0x21e96
andb %cl, %al
jne 0x21e96
testl %r13d, %r13d
je 0x21fbb
xorl %r15d, %r15d
testl %r9d, %r9d
je 0x2206b
cmpb $0x2, -0x5c(%rbp)
movl $0x7fffffff, %r10d      # imm = 0x7FFFFFFF
jne 0x21fc2
movl %r13d, %eax
movl $0x8, %ecx
xorl %edx, %edx
movl %ecx, %esi
andl $-0x4, %esi
movl (%r12,%rsi), %esi
bswapl %esi
cmpl %r9d, %esi
jbe 0x22068
incq %rdx
addq $0x4, %rcx
cmpq %rdx, %rax
jne 0x21e71
jmp 0x2206b
movq -0x68(%rbp), %rax
movl %r15d, (%rax)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %r12
movq %r12, (%rax)
movq 0x68(%r12), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x2226a
testl %r13d, %r13d
je 0x2202a
movq 0x50(%r12), %rax
movzbl 0x8(%rax), %edi
movl %edi, %ecx
shll $0x18, %ecx
movzbl 0x9(%rax), %r12d
movl %r12d, %edx
shll $0x10, %edx
orl %ecx, %edx
movzbl 0xa(%rax), %r14d
movl %r14d, %esi
shll $0x8, %esi
orl %edx, %esi
movzbl 0xb(%rax), %r15d
orl %r15d, %esi
cmpl -0x4c(%rbp), %esi
ja 0x222d0
movl %edi, -0x78(%rbp)
movq -0x58(%rbp), %rdi
leaq -0x80(%rbp), %rdx
xorl %ecx, %ecx
callq 0x20068
testl %eax, %eax
jne 0x222cc
movl %r15d, -0x8c(%rbp)
movq -0x80(%rbp), %r15
movq 0x68(%r15), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x222ef
movq 0x50(%r15), %rax
movq -0x38(%rbp), %rdx
movq 0x50(%rdx), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq 0x50(%r15), %rax
leal -0x1(%r13), %ecx
bswapl %ecx
movl %ecx, 0x4(%rax)
movq 0x50(%r15), %rdi
addq $0x8, %rdi
movq 0x50(%rdx), %rsi
addq $0xc, %rsi
leal -0x4(,%r13,4), %edx
callq 0x82f0
movq 0x68(%r15), %rdi
callq 0xddd3
movq -0x48(%rbp), %rdx
testq %rdx, %rdx
je 0x22183
movq 0x68(%rdx), %rdi
movq %rdx, %r15
callq 0xdfbf
testl %eax, %eax
movq -0x30(%rbp), %r13
jne 0x2236f
movq 0x50(%r15), %rax
movl -0x78(%rbp), %ecx
movb %cl, (%rax)
movb %r12b, 0x1(%rax)
movb %r14b, 0x2(%rax)
addq $0x3, %rax
movq %r15, %rdx
movq -0x40(%rbp), %r15
jmp 0x221a1
xorl %ebx, %ebx
jmp 0x2209f
cmpl $0x1, %r13d
je 0x2206b
movl 0x8(%r12), %ecx
bswapl %ecx
subl %r9d, %ecx
movl %ecx, %eax
negl %eax
cmovol %r10d, %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movl %r13d, %ecx
xorl %r15d, %r15d
movl $0x1, %edx
movl $0xc, %esi
movl %esi, %edi
andl $-0x4, %edi
movl (%r12,%rdi), %edi
bswapl %edi
subl %r9d, %edi
movl %edi, %r8d
negl %r8d
cmovol %r10d, %r8d
testl %edi, %edi
cmovnsl %edi, %r8d
cmpl %eax, %r8d
cmovll %edx, %r15d
cmovll %r8d, %eax
incq %rdx
addq $0x4, %rsi
cmpq %rdx, %rcx
jne 0x21ff3
jmp 0x2206b
movq -0x48(%rbp), %rdx
testq %rdx, %rdx
movq -0x40(%rbp), %r15
je 0x221ab
movq 0x68(%rdx), %rdi
movq %rdx, %r14
callq 0xdfbf
testl %eax, %eax
movq -0x30(%rbp), %r13
jne 0x22373
movq 0x50(%r14), %rax
movq 0x50(%r12), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq %r14, %rdx
jmp 0x221bd
movl %edx, %r15d
leal 0x8(,%r15,4), %esi
movl (%r12,%rsi), %eax
bswapl %eax
cmpl -0x4c(%rbp), %eax
ja 0x2229b
cmpb $0x2, -0x5c(%rbp)
setne %cl
cmpl %r9d, %eax
setae %dl
je 0x220b4
orb %dl, %cl
je 0x220b4
testb %r14b, %r14b
je 0x220b4
xorl %ebx, %ebx
movb $0x1, %r14b
movq -0x30(%rbp), %r13
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %r15
movq -0x38(%rbp), %r12
jmp 0x221dd
movq %rsi, -0x78(%rbp)
movq -0x68(%rbp), %r14
movl %eax, (%r14)
movq -0x38(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0xdfbf
testl %eax, %eax
jne 0x222cc
leal -0x1(%r13), %eax
cmpl %eax, %r15d
jae 0x220f1
leal 0x4(,%r13,4), %ecx
movl (%r12,%rcx), %ecx
movq -0x78(%rbp), %rdx
movl %ecx, (%r12,%rdx)
bswapl %eax
movl %eax, 0x4(%r12)
movl (%r14), %ebx
movq -0x58(%rbp), %rax
movq 0x58(%rax), %rdi
testq %rdi, %rdi
movq -0x40(%rbp), %r15
je 0x2212a
xorl %ecx, %ecx
cmpl %ebx, (%rdi)
movq -0x30(%rbp), %r13
movq -0x38(%rbp), %r12
jb 0x22137
movl %ebx, %esi
callq 0x1b0b1
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
jmp 0x22137
movl $0x1, %ecx
movq -0x30(%rbp), %r13
movq -0x38(%rbp), %r12
movq -0x58(%rbp), %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x20068
xorl %ebx, %ebx
testl %eax, %eax
je 0x22155
xorl %r14d, %r14d
movl %eax, %ebx
jmp 0x21e07
movq (%r13), %rax
movq 0x68(%rax), %rdi
callq 0xdfbf
testl %eax, %eax
je 0x221d2
movl %eax, %r15d
movq (%r13), %rax
testq %rax, %rax
je 0x2217b
movq 0x68(%rax), %rdi
callq 0xddd3
xorl %r14d, %r14d
movl %r15d, %ebx
jmp 0x221d5
movq -0x40(%rbp), %r15
movq 0x50(%r15), %rax
movl -0x78(%rbp), %ecx
movb %cl, 0x20(%rax)
movb %r12b, 0x21(%rax)
movb %r14b, 0x22(%rax)
addq $0x23, %rax
movq -0x30(%rbp), %r13
movl -0x8c(%rbp), %ecx
movb %cl, (%rax)
jmp 0x221bd
movq 0x50(%r15), %rax
movq 0x50(%r12), %rcx
movl (%rcx), %ecx
movl %ecx, 0x20(%rax)
movq -0x30(%rbp), %r13
movq $0x0, -0x88(%rbp)
xorl %r12d, %r12d
xorl %r14d, %r14d
xorl %ebx, %ebx
jmp 0x221dd
xorl %r14d, %r14d
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %r15
testq %rdx, %rdx
je 0x221eb
movq 0x68(%rdx), %rdi
callq 0xddd3
movq %r12, %rax
testb %r14b, %r14b
movb $0x1, %r14b
jne 0x21d22
movq $0x0, -0x48(%rbp)
testq %r12, %r12
jne 0x22302
jmp 0x2230c
leaq -0x80(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x21a08
cmpb $0x2, (%r15)
movq -0x40(%rbp), %r15
sete %r14b
testl %eax, %eax
jne 0x21cfb
jmp 0x21cee
leaq 0x575d3(%rip), %rsi     # 0x79814
leaq 0x572f1(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd55f, %edx           # imm = 0xD55F
xorl %eax, %eax
callq 0xb9c7
jmp 0x2230c
movl %eax, %ebx
jmp 0x2230c
movl %eax, %ebx
movq -0x30(%rbp), %r13
jmp 0x22302
leaq 0x57598(%rip), %rsi     # 0x79814
leaq 0x572b6(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd57b, %edx           # imm = 0xD57B
xorl %eax, %eax
callq 0xb9c7
jmp 0x222fa
leaq 0x57572(%rip), %rsi     # 0x79814
leaq 0x57290(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd5de, %edx           # imm = 0xD5DE
xorl %eax, %eax
callq 0xb9c7
movq -0x30(%rbp), %r13
movq -0x38(%rbp), %r12
jmp 0x22202
movl %eax, %ebx
jmp 0x222fa
leaq 0x5753d(%rip), %rsi     # 0x79814
leaq 0x5725b(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd59d, %edx           # imm = 0xD59D
jmp 0x22292
movl %eax, %ebx
movq 0x68(%r15), %rdi
callq 0xddd3
movq -0x30(%rbp), %r13
movq -0x38(%rbp), %r12
movq 0x68(%r12), %rdi
callq 0xddd3
movq -0x48(%rbp), %rax
testq %rax, %rax
je 0x2231e
movq 0x68(%rax), %rdi
callq 0xddd3
testl %ebx, %ebx
je 0x2232f
movq $0x0, (%r13)
jmp 0x21cfd
movq (%r13), %rax
movq 0x68(%rax), %rdi
cmpw $0x2, 0x2e(%rdi)
jl 0x22365
callq 0xddd3
leaq 0x574ca(%rip), %rsi     # 0x79814
leaq 0x571e8(%rip), %rcx     # 0x79539
movl $0xb, %ebx
movl $0xb, %edi
movl $0xd640, %edx           # imm = 0xD640
jmp 0x21b91
movb $0x0, (%rax)
xorl %ebx, %ebx
jmp 0x21cfd
movl %eax, %ebx
jmp 0x222fe
movl %eax, %ebx
jmp 0x22302