// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: checkTreePage
static int checkTreePage(
  IntegrityCk *pCheck,  /* Context for the sanity check */
  Pgno iPage,           /* Page number of the page to check */
  i64 *piMinKey,        /* Write minimum integer primary key here */
  i64 maxKey            /* Error if integer primary key greater than this */
){
  MemPage *pPage = 0;      /* The page being analyzed */
  int i;                   /* Loop counter */
  int rc;                  /* Result code from subroutine call */
  int depth = -1, d2;      /* Depth of a subtree */
  int pgno;                /* Page number */
  int nFrag;               /* Number of fragmented bytes on the page */
  int hdr;                 /* Offset to the page header */
  int cellStart;           /* Offset to the start of the cell pointer array */
  int nCell;               /* Number of cells */
  int doCoverageCheck = 1; /* True if cell coverage checking should be done */
  int keyCanBeEqual = 1;   /* True if IPK can be equal to maxKey
                           ** False if IPK must be strictly less than maxKey */
  u8 *data;                /* Page content */
  u8 *pCell;               /* Cell content */
  u8 *pCellIdx;            /* Next element of the cell pointer array */
  BtShared *pBt;           /* The BtShared object that owns pPage */
  u32 pc;                  /* Address of a cell */
  u32 usableSize;          /* Usable size of the page */
  u32 contentOffset;       /* Offset to the start of the cell content area */
  u32 *heap = 0;           /* Min-heap used for checking cell coverage */
  u32 x, prev = 0;         /* Next and previous entry on the min-heap */
  const char *saved_zPfx = pCheck->zPfx;
  int saved_v1 = pCheck->v1;
  int saved_v2 = pCheck->v2;
  u8 savedIsInit = 0;

  /* Check that the page exists
  */
  pBt = pCheck->pBt;
  usableSize = pBt->usableSize;
  if( iPage==0 ) return 0;
  if( checkRef(pCheck, iPage) ) return 0;
  pCheck->zPfx = "Page %u: ";
  pCheck->v1 = iPage;
  if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
    checkAppendMsg(pCheck,
       "unable to get the page. error code=%d", rc);
    goto end_of_check;
  }

  /* Clear MemPage.isInit to make sure the corruption detection code in
  ** btreeInitPage() is executed.  */
  savedIsInit = pPage->isInit;
  pPage->isInit = 0;
  if( (rc = btreeInitPage(pPage))!=0 ){
    assert( rc==SQLITE_CORRUPT );  /* The only possible error from InitPage */
    checkAppendMsg(pCheck,
                   "btreeInitPage() returns error code %d", rc);
    goto end_of_check;
  }
  if( (rc = btreeComputeFreeSpace(pPage))!=0 ){
    assert( rc==SQLITE_CORRUPT );
    checkAppendMsg(pCheck, "free space corruption", rc);
    goto end_of_check;
  }
  data = pPage->aData;
  hdr = pPage->hdrOffset;

  /* Set up for cell analysis */
  pCheck->zPfx = "On tree page %u cell %d: ";
  contentOffset = get2byteNotZero(&data[hdr+5]);
  assert( contentOffset<=usableSize );  /* Enforced by btreeInitPage() */

  /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
  ** number of cells on the page. */
  nCell = get2byte(&data[hdr+3]);
  assert( pPage->nCell==nCell );

  /* EVIDENCE-OF: R-23882-45353 The cell pointer array of a b-tree page
  ** immediately follows the b-tree page header. */
  cellStart = hdr + 12 - 4*pPage->leaf;
  assert( pPage->aCellIdx==&data[cellStart] );
  pCellIdx = &data[cellStart + 2*(nCell-1)];

  if( !pPage->leaf ){
    /* Analyze the right-child page of internal pages */
    pgno = get4byte(&data[hdr+8]);
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum ){
      pCheck->zPfx = "On page %u at right child: ";
      checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
    }
#endif
    depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
    keyCanBeEqual = 0;
  }else{
    /* For leaf pages, the coverage check will occur in the same loop
    ** as the other cell checks, so initialize the heap.  */
    heap = pCheck->heap;
    heap[0] = 0;
  }

  /* EVIDENCE-OF: R-02776-14802 The cell pointer array consists of K 2-byte
  ** integer offsets to the cell contents. */
  for(i=nCell-1; i>=0 && pCheck->mxErr; i--){
    CellInfo info;

    /* Check cell size */
    pCheck->v2 = i;
    assert( pCellIdx==&data[cellStart + i*2] );
    pc = get2byteAligned(pCellIdx);
    pCellIdx -= 2;
    if( pc<contentOffset || pc>usableSize-4 ){
      checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
                             pc, contentOffset, usableSize-4);
      doCoverageCheck = 0;
      continue;
    }
    pCell = &data[pc];
    pPage->xParseCell(pPage, pCell, &info);
    if( pc+info.nSize>usableSize ){
      checkAppendMsg(pCheck, "Extends off end of page");
      doCoverageCheck = 0;
      continue;
    }

    /* Check for integer primary key out of range */
    if( pPage->intKey ){
      if( keyCanBeEqual ? (info.nKey > maxKey) : (info.nKey >= maxKey) ){
        checkAppendMsg(pCheck, "Rowid %lld out of order", info.nKey);
      }
      maxKey = info.nKey;
      keyCanBeEqual = 0;     /* Only the first key on the page may ==maxKey */
    }

    /* Check the content overflow list */
    if( info.nPayload>info.nLocal ){
      u32 nPage;       /* Number of pages on the overflow chain */
      Pgno pgnoOvfl;   /* First page of the overflow chain */
      assert( pc + info.nSize - 4 <= usableSize );
      nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4);
      pgnoOvfl = get4byte(&pCell[info.nSize - 4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pBt->autoVacuum ){
        checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage);
      }
#endif
      checkList(pCheck, 0, pgnoOvfl, nPage);
    }

    if( !pPage->leaf ){
      /* Check sanity of left child page for internal pages */
      pgno = get4byte(pCell);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pBt->autoVacuum ){
        checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
      }
#endif
      d2 = checkTreePage(pCheck, pgno, &maxKey, maxKey);
      keyCanBeEqual = 0;
      if( d2!=depth ){
        checkAppendMsg(pCheck, "Child page depth differs");
        depth = d2;
      }
    }else{
      /* Populate the coverage-checking heap for leaf pages */
      btreeHeapInsert(heap, (pc<<16)|(pc+info.nSize-1));
    }
  }
  *piMinKey = maxKey;

  /* Check for complete coverage of the page
  */
  pCheck->zPfx = 0;
  if( doCoverageCheck && pCheck->mxErr>0 ){
    /* For leaf pages, the min-heap has already been initialized and the
    ** cells have already been inserted.  But for internal pages, that has
    ** not yet been done, so do it now */
    if( !pPage->leaf ){
      heap = pCheck->heap;
      heap[0] = 0;
      for(i=nCell-1; i>=0; i--){
        u32 size;
        pc = get2byteAligned(&data[cellStart+i*2]);
        size = pPage->xCellSize(pPage, &data[pc]);
        btreeHeapInsert(heap, (pc<<16)|(pc+size-1));
      }
    }
    /* Add the freeblocks to the min-heap
    **
    ** EVIDENCE-OF: R-20690-50594 The second field of the b-tree page header
    ** is the offset of the first freeblock, or zero if there are no
    ** freeblocks on the page.
    */
    i = get2byte(&data[hdr+1]);
    while( i>0 ){
      int size, j;
      assert( (u32)i<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
      size = get2byte(&data[i+2]);
      assert( (u32)(i+size)<=usableSize ); /* due to btreeComputeFreeSpace() */
      btreeHeapInsert(heap, (((u32)i)<<16)|(i+size-1));
      /* EVIDENCE-OF: R-58208-19414 The first 2 bytes of a freeblock are a
      ** big-endian integer which is the offset in the b-tree page of the next
      ** freeblock in the chain, or zero if the freeblock is the last on the
      ** chain. */
      j = get2byte(&data[i]);
      /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
      ** increasing offset. */
      assert( j==0 || j>i+size );     /* Enforced by btreeComputeFreeSpace() */
      assert( (u32)j<=usableSize-4 ); /* Enforced by btreeComputeFreeSpace() */
      i = j;
    }
    /* Analyze the min-heap looking for overlap between cells and/or
    ** freeblocks, and counting the number of untracked bytes in nFrag.
    **
    ** Each min-heap entry is of the form:    (start_address<<16)|end_address.
    ** There is an implied first entry the covers the page header, the cell
    ** pointer index, and the gap between the cell pointer index and the start
    ** of cell content.
    **
    ** The loop below pulls entries from the min-heap in order and compares
    ** the start_address against the previous end_address.  If there is an
    ** overlap, that means bytes are used multiple times.  If there is a gap,
    ** that gap is added to the fragmentation count.
    */
    nFrag = 0;
    prev = contentOffset - 1;   /* Implied first min-heap entry */
    while( btreeHeapPull(heap,&x) ){
      if( (prev&0xffff)>=(x>>16) ){
        checkAppendMsg(pCheck,
          "Multiple uses for byte %u of page %u", x>>16, iPage);
        break;
      }else{
        nFrag += (x>>16) - (prev&0xffff) - 1;
        prev = x;
      }
    }
    nFrag += usableSize - (prev&0xffff) - 1;
    /* EVIDENCE-OF: R-43263-13491 The total number of bytes in all fragments
    ** is stored in the fifth field of the b-tree page header.
    ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
    ** number of fragmented free bytes within the cell content area.
    */
    if( heap[0]==0 && nFrag!=data[hdr+7] ){
      checkAppendMsg(pCheck,
          "Fragmentation of %d bytes reported as %d on page %u",
          nFrag, data[hdr+7], iPage);
    }
  }

end_of_check:
  if( !doCoverageCheck ) pPage->isInit = savedIsInit;
  releasePage(pPage);
  pCheck->zPfx = saved_zPfx;
  pCheck->v1 = saved_v1;
  pCheck->v2 = saved_v2;
  return depth+1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rcx, %r14
movq %rcx, 0x30(%rsp)
movq $0x0, 0x78(%rsp)
xorl %ecx, %ecx
testl %esi, %esi
je 0x2a6abf
movl %esi, %ebp
movq %rdi, %rbx
movq %rdx, 0xb0(%rsp)
movq (%rdi), %r12
movq 0x28(%rdi), %r13
movsd 0x30(%rdi), %xmm0
movaps %xmm0, 0xd0(%rsp)
movl 0x38(%r12), %r15d
callq 0x2a71af
xorl %ecx, %ecx
testl %eax, %eax
jne 0x2a6abf
leaq 0x12ff3e(%rip), %rax    # 0x3d6950
movq %rax, 0x28(%rbx)
movl %ebp, 0x30(%rbx)
leaq 0x78(%rsp), %rdx
movq %r12, %rdi
movl %ebp, %esi
xorl %ecx, %ecx
callq 0x28ced9
testl %eax, %eax
je 0x2a6a52
leaq 0x12ff25(%rip), %rsi    # 0x3d695a
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2a6807
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x78(%rsp), %r15
testq %r15, %r15
jne 0x2a6aa0
jmp 0x2a6aad
movq %r15, 0x68(%rsp)
movq 0x78(%rsp), %r15
movb (%r15), %al
movb %al, 0xb(%rsp)
movb $0x0, (%r15)
movq %r15, %rdi
callq 0x28b010
testl %eax, %eax
je 0x2a6a7c
leaq 0x12ff06(%rip), %rsi    # 0x3d6980
jmp 0x2a6a8f
movq %r15, %rdi
callq 0x2a0957
testl %eax, %eax
je 0x2a6ad3
leaq 0x12ff17(%rip), %rsi    # 0x3d69a6
movq %rbx, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x2a6807
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
movq 0x70(%r15), %rdi
movl %ecx, %ebp
callq 0x28ab87
movl %ebp, %ecx
movq %r13, 0x28(%rbx)
movaps 0xd0(%rsp), %xmm0
movlps %xmm0, 0x30(%rbx)
incl %ecx
movl %ecx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x70(%rsp)
movq 0x50(%r15), %rdx
movzbl 0x9(%r15), %esi
leaq 0x12fed4(%rip), %rax    # 0x3d69bc
movq %rax, 0x28(%rbx)
movzbl 0x5(%rdx,%rsi), %eax
shll $0x8, %eax
movzbl 0x6(%rdx,%rsi), %ecx
leal (%rax,%rcx), %r8d
decl %r8d
movzbl 0x3(%rdx,%rsi), %eax
shll $0x8, %eax
movzbl 0x4(%rdx,%rsi), %ecx
movq %rax, 0x60(%rsp)
movq %rcx, 0x90(%rsp)
addl %ecx, %eax
movq %rax, 0xa0(%rsp)
movq %r15, 0x28(%rsp)
movzbl 0x8(%r15), %eax
leal (,%rax,4), %ecx
movq %rsi, %rdi
subq %rcx, %rdi
testl %eax, %eax
movq %rdx, 0x40(%rsp)
movq %r13, 0x48(%rsp)
movq %rsi, 0x98(%rsp)
je 0x2a6b71
movq 0x58(%rbx), %r13
movl $0x0, (%r13)
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movl $0x1, %ecx
movq 0x68(%rsp), %r15
jmp 0x2a6bd6
movl %r8d, 0x18(%rsp)
movq %rdi, 0x50(%rsp)
movl 0x8(%rdx,%rsi), %r12d
bswapl %r12d
movq 0x70(%rsp), %rax
cmpb $0x0, 0x21(%rax)
movq 0x68(%rsp), %r15
je 0x2a6bb0
leaq 0x12fe3c(%rip), %rax    # 0x3d69d6
movq %rax, 0x28(%rbx)
movq %rbx, %rdi
movl %r12d, %esi
movl $0x5, %edx
movl %ebp, %ecx
callq 0x2a6916
leaq 0x30(%rsp), %rdx
movq %rbx, %rdi
movl %r12d, %esi
movq %r14, %rcx
callq 0x2a69aa
movl %eax, 0xc(%rsp)
xorl %r13d, %r13d
xorl %ecx, %ecx
movq 0x50(%rsp), %rdi
movl 0x18(%rsp), %r8d
addq $0xc, %rdi
movzwl %r8w, %r9d
movq 0xa0(%rsp), %rax
testl %eax, %eax
movq %r9, 0x10(%rsp)
movb 0xb(%rsp), %dl
movq %rdi, 0x50(%rsp)
je 0x2a6f0d
movl %ecx, 0x24(%rsp)
leal (%rdi,%rax,2), %eax
addl $-0x2, %eax
movslq %eax, %rdi
leal 0x1(%r9), %eax
movl %eax, 0x8c(%rsp)
addq 0x40(%rsp), %rdi
movq 0x60(%rsp), %rax
movq 0x90(%rsp), %rcx
addl %ecx, %eax
decl %eax
leal -0x4(%r15), %ecx
movl %ecx, 0x5c(%rsp)
leal -0x5(%r15), %ecx
movl %ecx, 0x88(%rsp)
movl $0x1, 0x3c(%rsp)
cmpl $0x0, 0x1c(%rbx)
je 0x2a6ed8
movq %rax, 0x18(%rsp)
movl %eax, 0x34(%rbx)
movq %rdi, %r12
movzwl (%rdi), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
cmpl %r9d, %r14d
setbe %al
movl 0x5c(%rsp), %r8d
cmpl %r8d, %r14d
seta %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x2a6ca2
movl $0x0, 0x3c(%rsp)
movq %rbx, %rdi
leaq 0x12fd63(%rip), %rsi    # 0x3d69f2
movl %r14d, %edx
movl 0x8c(%rsp), %ecx
xorl %eax, %eax
callq 0x2a6807
jmp 0x2a6cf3
movl %r14d, %esi
addq 0x40(%rsp), %rsi
movq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rsi, 0xa8(%rsp)
leaq 0xb8(%rsp), %rdx
callq *0x80(%r15)
movzwl 0xce(%rsp), %eax
addl %r14d, %eax
cmpl 0x68(%rsp), %eax
jbe 0x2a6d18
movl $0x0, 0x3c(%rsp)
movq %rbx, %rdi
leaq 0x12fd24(%rip), %rsi    # 0x3d6a10
xorl %eax, %eax
callq 0x2a6807
movq 0x10(%rsp), %r9
movb 0xb(%rsp), %dl
movq %r12, %rdi
movq 0x18(%rsp), %rcx
addq $-0x2, %rdi
leal -0x1(%rcx), %eax
testl %ecx, %ecx
jg 0x2a6c45
jmp 0x2a6ed8
cmpb $0x0, 0x2(%r15)
je 0x2a6d69
movq 0xb8(%rsp), %rdx
movq 0x30(%rsp), %rax
cmpl $0x0, 0x24(%rsp)
je 0x2a6ea4
cmpq %rax, %rdx
jle 0x2a6d55
movq %rbx, %rdi
leaq 0x12fce2(%rip), %rsi    # 0x3d6a28
xorl %eax, %eax
callq 0x2a6807
movq 0xb8(%rsp), %rdx
movq 0x10(%rsp), %r9
movq %rdx, 0x30(%rsp)
movl $0x0, 0x24(%rsp)
jmp 0x2a6d6e
movq 0x10(%rsp), %r9
movl 0xc8(%rsp), %eax
movzwl 0xcc(%rsp), %ecx
cmpl %ecx, %eax
jbe 0x2a6deb
addl 0x88(%rsp), %eax
subl %ecx, %eax
xorl %edx, %edx
divl 0x5c(%rsp)
movl %eax, %r8d
movzwl 0xce(%rsp), %eax
movq 0xa8(%rsp), %rcx
movl -0x4(%rcx,%rax), %edx
bswapl %edx
movq 0x70(%rsp), %rax
cmpb $0x0, 0x21(%rax)
je 0x2a6dd9
movq %rbx, %rdi
movl %edx, %esi
movl %edx, 0x84(%rsp)
movl $0x3, %edx
movl %ebp, %ecx
movl %r8d, %r15d
callq 0x2a6916
movl 0x84(%rsp), %edx
movl %r15d, %r8d
movq %rbx, %rdi
xorl %esi, %esi
movl %r8d, %ecx
callq 0x2a65f9
movq 0x10(%rsp), %r9
movq 0x28(%rsp), %rax
cmpb $0x0, 0x8(%rax)
je 0x2a6e51
movzwl 0xce(%rsp), %eax
movl %r14d, %ecx
shll $0x10, %ecx
leal (%r14,%rax), %edx
decl %edx
orl %ecx, %edx
movl (%r13), %eax
incl %eax
movl %eax, (%r13)
movl %edx, (%r13,%rax,4)
cmpl $0x2, %eax
jb 0x2a6cf8
movq %r12, %rdi
movl %eax, %ecx
shrl %eax
movl (%r13,%rax,4), %edx
movl (%r13,%rcx,4), %esi
cmpl %esi, %edx
jbe 0x2a6e48
movl %esi, (%r13,%rax,4)
movl %edx, (%r13,%rcx,4)
cmpl $0x3, %ecx
ja 0x2a6e27
movb 0xb(%rsp), %dl
jmp 0x2a6cff
movq 0xa8(%rsp), %rax
movl (%rax), %r14d
bswapl %r14d
movq 0x70(%rsp), %rax
cmpb $0x0, 0x21(%rax)
je 0x2a6e7c
movq %rbx, %rdi
movl %r14d, %esi
movl $0x5, %edx
movl %ebp, %ecx
callq 0x2a6916
movq 0x30(%rsp), %rcx
movq %rbx, %rdi
movl %r14d, %esi
leaq 0x30(%rsp), %rdx
callq 0x2a69aa
cmpl 0xc(%rsp), %eax
jne 0x2a6eb2
movl $0x0, 0x24(%rsp)
jmp 0x2a6cf3
cmpq %rax, %rdx
jge 0x2a6d3c
jmp 0x2a6d55
movl %eax, %r14d
movl $0x0, 0x24(%rsp)
movq %rbx, %rdi
leaq 0x12fb79(%rip), %rsi    # 0x3d6a40
xorl %eax, %eax
callq 0x2a6807
movl %r14d, 0xc(%rsp)
jmp 0x2a6cf3
movq 0x30(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq %rax, (%rcx)
movq $0x0, 0x28(%rbx)
cmpl $0x0, 0x3c(%rsp)
jne 0x2a6f25
movq 0x28(%rsp), %r15
movb %dl, (%r15)
movq 0x48(%rsp), %r13
movl 0xc(%rsp), %ecx
jmp 0x2a6aa0
movq 0x30(%rsp), %rax
movq 0xb0(%rsp), %rcx
movq %rax, (%rcx)
movq $0x0, 0x28(%rbx)
movq 0x28(%rsp), %r15
cmpl $0x0, 0x1c(%rbx)
jle 0x2a7139
cmpb $0x0, 0x8(%r15)
jne 0x2a6ff5
movq 0x58(%rbx), %r13
movl $0x0, (%r13)
cmpl $0x0, 0xa0(%rsp)
je 0x2a6ff5
movq 0x60(%rsp), %rax
orl 0x90(%rsp), %eax
movq 0x50(%rsp), %rcx
addq 0x40(%rsp), %rcx
movq %rcx, 0x50(%rsp)
movq %rax, 0x60(%rsp)
movzwl -0x2(%rcx,%rax,2), %eax
rolw $0x8, %ax
movzwl %ax, %r14d
movq 0x40(%rsp), %rax
leaq (%rax,%r14), %rsi
movq %r15, %rdi
callq *0x78(%r15)
movzwl %ax, %eax
movl %r14d, %ecx
shll $0x10, %ecx
leal (%r14,%rax), %edx
decl %edx
orl %ecx, %edx
movl (%r13), %eax
incl %eax
movl %eax, (%r13)
movl %edx, (%r13,%rax,4)
cmpl $0x2, %eax
jb 0x2a6fdc
movl %eax, %ecx
shrl %eax
movl (%r13,%rax,4), %edx
movl (%r13,%rcx,4), %esi
cmpl %esi, %edx
jbe 0x2a6fdc
movl %esi, (%r13,%rax,4)
movl %edx, (%r13,%rcx,4)
cmpl $0x3, %ecx
ja 0x2a6fbb
movq 0x60(%rsp), %rcx
leaq -0x1(%rcx), %rax
cmpq $0x1, %rcx
movq 0x50(%rsp), %rcx
jg 0x2a6f74
movq 0x10(%rsp), %r9
movq 0x40(%rsp), %r8
movq 0x98(%rsp), %rax
movzwl 0x1(%r8,%rax), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x2a7074
movzwl %ax, %ecx
movl %ecx, %eax
movzwl 0x2(%r8,%rax), %edx
rolw $0x8, %dx
movzwl %dx, %edx
movl %ecx, %esi
shll $0x10, %esi
addl %ecx, %edx
decl %edx
orl %esi, %edx
movl (%r13), %ecx
incl %ecx
movl %ecx, (%r13)
movl %edx, (%r13,%rcx,4)
cmpl $0x2, %ecx
jb 0x2a7063
movl %ecx, %edx
shrl %ecx
movl (%r13,%rcx,4), %esi
movl (%r13,%rdx,4), %edi
cmpl %edi, %esi
jbe 0x2a7063
movl %edi, (%r13,%rcx,4)
movl %esi, (%r13,%rdx,4)
cmpl $0x3, %edx
ja 0x2a7042
movzwl (%r8,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %ecx
testw %cx, %cx
jne 0x2a7014
movl (%r13), %eax
xorl %r14d, %r14d
testl %eax, %eax
je 0x2a715d
movl %r9d, %r15d
movl %eax, %ecx
movl 0x4(%r13), %r9d
movl %eax, %eax
movl (%r13,%rax,4), %edx
movl %edx, 0x4(%r13)
movl $0xffffffff, (%r13,%rax,4) # imm = 0xFFFFFFFF
leal -0x1(%rcx), %eax
movl %eax, (%r13)
cmpl $0x3, %ecx
jb 0x2a7116
movl 0x4(%r13), %ecx
movl 0xc(%r13), %edx
cmpl 0x8(%r13), %edx
movl $0x0, %edx
adcl $0x2, %edx
movl (%r13,%rdx,4), %edi
cmpl %edi, %ecx
jb 0x2a7116
leaq (,%rdx,4), %r8
addq %r13, %r8
movl $0x1, %esi
movl %esi, %eax
movl %edx, %esi
movl %edi, (%r13,%rax,4)
movl %ecx, (%r8)
leal (%rsi,%rsi), %edi
movl (%r13), %eax
cmpl %eax, %edi
ja 0x2a7116
movl %edi, %edx
movl (%r13,%rdx,4), %r8d
movl %edi, %edx
orl $0x1, %edx
cmpl (%r13,%rdx,4), %r8d
cmovbel %edi, %edx
leaq (,%rdx,4), %r8
addq %r13, %r8
movl (%r8), %edi
cmpl %edi, %ecx
jae 0x2a70d9
movzwl %r15w, %ecx
movl %r9d, %edx
shrl $0x10, %edx
cmpl %edx, %ecx
jae 0x2a7140
notl %ecx
addl %ecx, %r14d
addl %edx, %r14d
movl %r9d, %r15d
testl %eax, %eax
jne 0x2a7086
jmp 0x2a715d
movq 0x48(%rsp), %r13
jmp 0x2a71a6
leaq 0x12f912(%rip), %rsi    # 0x3d6a59
movq %rbx, %rdi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x2a6807
cmpl $0x0, (%r13)
movl %r15d, %r9d
jne 0x2a719c
notl %r9d
orl $0xffff0000, %r9d       # imm = 0xFFFF0000
movq 0x68(%rsp), %rdx
addl %r9d, %edx
addl %r14d, %edx
movq 0x40(%rsp), %rax
movq 0x98(%rsp), %rcx
movzbl 0x7(%rax,%rcx), %ecx
cmpl %ecx, %edx
je 0x2a719c
leaq 0x12f8ef(%rip), %rsi    # 0x3d6a7e
movq %rbx, %rdi
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2a6807
movq 0x48(%rsp), %r13
movq 0x28(%rsp), %r15
movl 0xc(%rsp), %ecx
jmp 0x2a6a4b