// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/external/sqlite-3.33.0/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);
  /* EVIDENCE-OF: R-05119-02637 The 4-byte big-endian integer at offset 36
  ** stores stores the total number of pages on the freelist. */
  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' */
    u32 nSearch = 0;   /* Count of the number of search attempts */

    /* 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 ){
        /* EVIDENCE-OF: R-01506-11053 The first integer on a freelist trunk page
        ** is the page number of the next freelist trunk page in the list or
        ** zero if this is the last freelist trunk page. */
        iTrunk = get4byte(&pPrevTrunk->aData[0]);
      }else{
        /* EVIDENCE-OF: R-59841-13798 The 4-byte big-endian integer at offset 32
        ** stores the page number of the first page of the freelist, or zero if
        ** the freelist is empty. */
        iTrunk = get4byte(&pPage1->aData[32]);
      }
      testcase( iTrunk==mxPage );
      if( iTrunk>mxPage || nSearch++ > n ){
        rc = SQLITE_CORRUPT_PGNO(pPrevTrunk ? pPrevTrunk->pgno : 1);
      }else{
        rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0);
      }
      if( rc ){
        pTrunk = 0;
        goto end_allocate_page;
      }
      assert( pTrunk!=0 );
      assert( pTrunk->aData!=0 );
      /* EVIDENCE-OF: R-13523-04394 The second integer on a freelist trunk page
      ** is the number of leaf page pointers to follow. */
      k = get4byte(&pTrunk->aData[4]);
      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_PGNO(iTrunk);
        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_PGNO(iTrunk);
            goto end_allocate_page;
          }
          testcase( iNewTrunk==mxPage );
          rc = btreeGetUnusedPage(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_PGNO(iTrunk);
          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 = btreeGetUnusedPage(pBt, *pPgno, ppPage, noContent);
          if( rc==SQLITE_OK ){
            rc = sqlite3PagerWrite((*ppPage)->pDbPage);
            if( rc!=SQLITE_OK ){
              releasePage(*ppPage);
              *ppPage = 0;
            }
          }
          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 = btreeGetUnusedPage(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 = btreeGetUnusedPage(pBt, *pPgno, ppPage, bNoContent);
    if( rc ) return rc;
    rc = sqlite3PagerWrite((*ppPage)->pDbPage);
    if( rc!=SQLITE_OK ){
      releasePage(*ppPage);
      *ppPage = 0;
    }
    TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
  }

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, 0x28(%rsp)
movq %rsi, %r14
movq %rdi, %r12
andq $0x0, 0x60(%rsp)
movq 0x18(%rdi), %rbx
movl 0x40(%rdi), %r13d
movq 0x50(%rbx), %rdi
addq $0x24, %rdi
callq 0x22fc59
movl %r13d, 0x1c(%rsp)
cmpl %r13d, %eax
jae 0x23775b
testl %eax, %eax
je 0x237773
cmpb $0x2, %bpl
movl %r15d, 0x4(%rsp)
movq %rbx, 0x10(%rsp)
movq %r14, %r13
movq %rax, 0x68(%rsp)
je 0x23789c
movzbl %bpl, %ecx
cmpl $0x1, %ecx
jne 0x23774d
cmpl %r15d, 0x1c(%rsp)
jae 0x237d52
movq $0x0, 0x8(%rsp)
jmp 0x2378a3
movl $0x11313, %edi          # imm = 0x11313
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x232547
movq %rbx, %rax
xorl %ebx, %ebx
cmpb $0x0, 0x23(%r12)
sete %r13b
movq 0x70(%rax), %rdi
callq 0x2236f2
testl %eax, %eax
jne 0x2378b0
movl 0x40(%r12), %ecx
leal 0x1(%rcx), %ebp
movl %ebp, 0x40(%r12)
movl 0x2032ca(%rip), %eax    # 0x43aa70
xorl %edx, %edx
divl 0x34(%r12)
cmpl %eax, %ecx
jne 0x2377bb
addl $0x2, %ecx
movl %ecx, 0x40(%r12)
movl %ecx, %ebp
movb %r13b, %bl
cmpb $0x0, 0x21(%r12)
je 0x237844
movq %r12, %rdi
movl %ebp, %esi
callq 0x236d49
cmpl %ebp, %eax
movq 0x28(%rsp), %rcx
jne 0x237849
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
movq %r12, %rdi
movl %ebp, %esi
movl %ebx, %ecx
callq 0x2381f0
testl %eax, %eax
jne 0x2378b0
movq %r12, %r13
movq 0x58(%rsp), %r12
movq 0x70(%r12), %rdi
callq 0x2236f2
movl %eax, %r15d
movq %r12, %rdi
callq 0x2376c6
testl %r15d, %r15d
jne 0x237dea
movq %r13, %r12
movl 0x40(%r13), %ecx
leal 0x1(%rcx), %ebp
movl %ebp, 0x40(%r13)
movl 0x203240(%rip), %eax    # 0x43aa70
xorl %edx, %edx
divl 0x34(%r13)
cmpl %eax, %ecx
jne 0x237844
addl $0x2, %ecx
movl %ecx, 0x40(%r12)
movl %ecx, %ebp
movq 0x28(%rsp), %rcx
movq 0x18(%r12), %rax
movq 0x50(%rax), %rax
bswapl %ebp
movl %ebp, 0x1c(%rax)
movl 0x40(%r12), %esi
movl %esi, (%rcx)
movq %r12, %rdi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x2381f0
testl %eax, %eax
jne 0x2378b0
movq (%r14), %rax
movq 0x70(%rax), %rdi
callq 0x2236f2
testl %eax, %eax
je 0x237daa
movl %eax, %r15d
movq (%r14), %rdi
callq 0x2376c6
andq $0x0, (%r14)
xorl %r14d, %r14d
xorl %ebp, %ebp
jmp 0x237dda
movb $0x1, %al
movq %rax, 0x8(%rsp)
movq 0x70(%rbx), %rdi
callq 0x2236f2
testl %eax, %eax
je 0x2378b8
movl %eax, %r15d
jmp 0x237dea
movl %ebp, 0x34(%rsp)
movq 0x50(%rbx), %rax
movq 0x68(%rsp), %rcx
decl %ecx
bswapl %ecx
movl %ecx, 0x24(%rax)
xorl %r14d, %r14d
movl $0x0, 0x44(%rsp)
movq %r12, 0x50(%rsp)
movq %r14, %rbp
testq %r14, %r14
je 0x2378ea
movq 0x50(%rbp), %rdi
jmp 0x2378f2
movq 0x50(%rbx), %rdi
addq $0x20, %rdi
callq 0x22fc59
movl %eax, %ebx
cmpl 0x1c(%rsp), %eax
movq 0x68(%rsp), %rax
ja 0x237d84
cmpl %eax, 0x44(%rsp)
ja 0x237d84
movq %r12, %rdi
movl %ebx, %esi
leaq 0x60(%rsp), %rdx
xorl %ecx, %ecx
callq 0x2381f0
testl %eax, %eax
jne 0x237d8e
movq %rbp, 0x20(%rsp)
movq 0x60(%rsp), %r14
movq 0x50(%r14), %rbp
leaq 0x4(%rbp), %rdi
callq 0x22fc59
movq 0x8(%rsp), %rcx
testb %cl, %cl
jne 0x2379bd
testl %eax, %eax
jne 0x2379bd
movq 0x70(%r14), %rdi
callq 0x2236f2
testl %eax, %eax
movq 0x20(%rsp), %rbp
jne 0x237dd7
movq 0x28(%rsp), %rax
movl %ebx, (%rax)
movq 0x10(%rsp), %rbx
movq 0x50(%rbx), %rax
movq 0x50(%r14), %rcx
movl (%rcx), %ecx
movl %ecx, 0x20(%rax)
movq %r13, %r12
movq %r14, (%r13)
andq $0x0, 0x60(%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r15d, %r15d
incl 0x44(%rsp)
movq %rbp, %rdi
callq 0x2376c6
testb %r13b, %r13b
movb $0x1, %al
movq %rax, 0x8(%rsp)
movq %r12, %r13
movq 0x50(%rsp), %r12
jne 0x2378dc
jmp 0x237895
movl 0x38(%r12), %edx
shrl $0x2, %edx
addl $-0x2, %edx
cmpl %edx, %eax
ja 0x237d96
testb %cl, %cl
movl 0x4(%rsp), %r15d
je 0x2379ed
cmpb $0x2, 0x34(%rsp)
sete %dl
cmpl %r15d, %ebx
setb %cl
je 0x237a49
andb %cl, %dl
jne 0x237a49
testl %eax, %eax
je 0x237b3d
movq %r14, 0x38(%rsp)
xorl %r14d, %r14d
testl %r15d, %r15d
movq %rax, 0x48(%rsp)
je 0x237c0b
movl %eax, %ebx
cmpb $0x2, 0x34(%rsp)
jne 0x237b57
pushq $0x8
popq %r12
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x237c01
movl %r12d, %edi
andl $-0x4, %edi
addq %rbp, %rdi
callq 0x22fc59
cmpl 0x4(%rsp), %eax
jbe 0x237bfe
incq %r15
addq $0x4, %r12
jmp 0x237a1f
movq %rax, 0x48(%rsp)
movq 0x28(%rsp), %rax
movl %ebx, (%rax)
movq %r14, (%r13)
movq 0x70(%r14), %rdi
callq 0x2236f2
testl %eax, %eax
movq 0x20(%rsp), %rbp
jne 0x237dd7
cmpl $0x0, 0x48(%rsp)
je 0x237bcb
movq 0x50(%r14), %rdi
addq $0x8, %rdi
callq 0x22fc59
cmpl 0x1c(%rsp), %eax
ja 0x237dcd
movq %r12, %rdi
movl %eax, 0x8(%rsp)
movl %eax, %esi
leaq 0x58(%rsp), %rdx
xorl %ecx, %ecx
callq 0x2381f0
testl %eax, %eax
jne 0x237dd7
movq 0x58(%rsp), %rbx
movq 0x70(%rbx), %rdi
callq 0x2236f2
testl %eax, %eax
jne 0x237dfc
movq 0x50(%rbx), %rax
movq 0x50(%r14), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
movq 0x50(%rbx), %rax
movq 0x48(%rsp), %rdx
leal -0x1(%rdx), %ecx
bswapl %ecx
movl %ecx, 0x4(%rax)
movq 0x50(%rbx), %rdi
addq $0x8, %rdi
movq 0x50(%r14), %rsi
addq $0xc, %rsi
leal -0x4(,%rdx,4), %edx
callq 0x17630
movq %rbx, %rdi
callq 0x2376c6
movl 0x8(%rsp), %ecx
bswapl %ecx
testq %rbp, %rbp
je 0x237d19
movl %ecx, 0x8(%rsp)
movq 0x70(%rbp), %rdi
callq 0x2236f2
testl %eax, %eax
movq 0x10(%rsp), %rbx
jne 0x237dd7
movq 0x50(%rbp), %rax
movl 0x8(%rsp), %ecx
movl %ecx, (%rax)
jmp 0x237d25
movq %r13, %r12
xorl %r15d, %r15d
movq 0x20(%rsp), %rbp
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r13
jmp 0x237994
movq %r13, 0x70(%rsp)
leaq 0x8(%rbp), %rdi
callq 0x22fc59
subl %r15d, %eax
movl %eax, %r15d
negl %r15d
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmovol %ecx, %r15d
testl %eax, %eax
cmovnsl %eax, %r15d
xorl %r14d, %r14d
pushq $0xc
popq %r13
pushq $0x1
popq %r12
cmpq %r12, %rbx
je 0x237bc4
movl %r13d, %edi
andl $-0x4, %edi
addq %rbp, %rdi
callq 0x22fc59
subl 0x4(%rsp), %eax
movl %eax, %ecx
negl %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmovol %edx, %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
cmpl %r15d, %ecx
cmovll %r12d, %r14d
cmovll %ecx, %r15d
incq %r12
addq $0x4, %r13
jmp 0x237b88
movq 0x70(%rsp), %r13
jmp 0x237c01
testq %rbp, %rbp
movq 0x10(%rsp), %rbx
je 0x237d2d
movq 0x70(%rbp), %rdi
callq 0x2236f2
testl %eax, %eax
jne 0x237dd7
movq %r13, %r12
movq 0x50(%rbp), %rax
movq 0x50(%r14), %rcx
movl (%rcx), %ecx
movl %ecx, (%rax)
jmp 0x237985
movl %r15d, %r14d
movq 0x50(%rsp), %r12
movl 0x4(%rsp), %r15d
leal 0x8(,%r14,4), %ebx
addq %rbp, %rbx
movq %rbx, %rdi
callq 0x22fc59
cmpl 0x1c(%rsp), %eax
ja 0x237db4
cmpb $0x2, 0x34(%rsp)
setne %cl
cmpl %r15d, %eax
setae %dl
je 0x237c60
orb %dl, %cl
je 0x237c60
cmpb $0x0, 0x8(%rsp)
je 0x237c60
movq %r13, %r12
xorl %r15d, %r15d
movb $0x1, %r13b
movq 0x20(%rsp), %rbp
movq 0x10(%rsp), %rbx
movq 0x38(%rsp), %r14
jmp 0x237994
movq 0x28(%rsp), %rcx
movl %eax, (%rcx)
movq 0x38(%rsp), %rax
movq 0x70(%rax), %rdi
callq 0x2236f2
testl %eax, %eax
jne 0x237dbe
movq 0x48(%rsp), %rcx
leal -0x1(%rcx), %eax
cmpl %eax, %r14d
jae 0x237c97
leal 0x4(,%rcx,4), %ecx
movl (%rbp,%rcx), %ecx
movl %ecx, (%rbx)
bswapl %eax
movl %eax, 0x4(%rbp)
movq 0x28(%rsp), %rax
movl (%rax), %ebx
movq 0x60(%r12), %rdi
pushq $0x1
popq %rcx
testq %rdi, %rdi
movq 0x38(%rsp), %r14
je 0x237cc9
xorl %ecx, %ecx
cmpl %ebx, (%rdi)
jb 0x237cc9
movl %ebx, %esi
callq 0x230beb
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
movq %r12, %rdi
movl %ebx, %esi
movq %r13, %rdx
callq 0x2381f0
xorl %r15d, %r15d
testl %eax, %eax
movq 0x20(%rsp), %rbp
je 0x237ced
movq %r13, %r12
xorl %r13d, %r13d
movl %eax, %r15d
jmp 0x237d48
movq (%r13), %rax
movq 0x70(%rax), %rdi
callq 0x2236f2
testl %eax, %eax
je 0x237d42
movl %eax, %ebx
movq (%r13), %rdi
callq 0x2376c6
movq %r13, %r12
andq $0x0, (%r13)
xorl %r13d, %r13d
movl %ebx, %r15d
jmp 0x237d48
movq 0x10(%rsp), %rbx
movq 0x50(%rbx), %rax
movl %ecx, 0x20(%rax)
movq %r13, %r12
jmp 0x237985
movq %r13, %r12
movq 0x50(%rbx), %rax
movq 0x50(%r14), %rcx
movl (%rcx), %ecx
movl %ecx, 0x20(%rax)
jmp 0x237985
movq %r13, %r12
xorl %r13d, %r13d
movq 0x10(%rsp), %rbx
jmp 0x237994
leaq 0x58(%rsp), %rbx
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x237626
movl %eax, %r15d
cmpb $0x2, (%rbx)
movq 0x10(%rsp), %rbx
sete %al
movq %rax, 0x8(%rsp)
testl %r15d, %r15d
jne 0x237dea
jmp 0x2378a3
movl $0x1134b, %edi          # imm = 0x1134B
callq 0x232547
movl %eax, %r15d
xorl %r14d, %r14d
jmp 0x237dda
movl $0x11368, %edi          # imm = 0x11368
callq 0x232547
movl %eax, %r15d
movq 0x20(%rsp), %rbp
jmp 0x237dda
xorl %r14d, %r14d
xorl %ebp, %ebp
xorl %r15d, %r15d
jmp 0x237dda
movl $0x113cb, %edi          # imm = 0x113CB
callq 0x232547
movl %eax, %r15d
movq 0x20(%rsp), %rbp
movq 0x38(%rsp), %r14
jmp 0x237dda
movl $0x1138a, %edi          # imm = 0x1138A
callq 0x232547
movl %eax, %r15d
movq %r14, %rdi
callq 0x2376c6
movq %rbp, %rdi
callq 0x2376c6
movl %r15d, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r15d
movq %rbx, %rdi
callq 0x2376c6
jmp 0x237dda