// File: /workspace/github_c_makefile_star2_O3/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: checkList
static void checkList(
  IntegrityCk *pCheck,  /* Integrity checking context */
  int isFreeList,       /* True for a freelist.  False for overflow page list */
  int iPage,            /* Page number for first page in the list */
  int N,                /* Expected number of pages in the list */
  char *zContext        /* Context for error messages */
){
  int i;
  int expected = N;
  int iFirst = iPage;
  while( N-- > 0 && pCheck->mxErr ){
    DbPage *pOvflPage;
    unsigned char *pOvflData;
    if( iPage<1 ){
      checkAppendMsg(pCheck, zContext,
         "%d of %d pages missing from overflow list starting at %d",
          N+1, expected, iFirst);
      break;
    }
    if( checkRef(pCheck, iPage, zContext) ) break;
    if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){
      checkAppendMsg(pCheck, zContext, "failed to get page %d", iPage);
      break;
    }
    pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
    if( isFreeList ){
      int n = get4byte(&pOvflData[4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pCheck->pBt->autoVacuum ){
        checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0, zContext);
      }
#endif
      if( n>(int)pCheck->pBt->usableSize/4-2 ){
        checkAppendMsg(pCheck, zContext,
           "freelist leaf count too big on page %d", iPage);
        N--;
      }else{
        for(i=0; i<n; i++){
          Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
          if( pCheck->pBt->autoVacuum ){
            checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0, zContext);
          }
#endif
          checkRef(pCheck, iFreePage, zContext);
        }
        N -= n;
      }
    }
#ifndef SQLITE_OMIT_AUTOVACUUM
    else{
      /* If this database supports auto-vacuum and iPage is not the last
      ** page in this overflow list, check that the pointer-map entry for
      ** the following page matches iPage.
      */
      if( pCheck->pBt->autoVacuum && N>0 ){
        i = get4byte(pOvflData);
        checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage, zContext);
      }
    }
#endif
    iPage = get4byte(pOvflData);
    sqlite3PagerUnref(pOvflPage);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, -0x38(%rbp)
movl %esi, -0x60(%rbp)
movl %ecx, -0x34(%rbp)
testl %ecx, %ecx
jle 0x34cbb
movq %r8, %rbx
movl -0x38(%rbp), %r15d
movl -0x34(%rbp), %eax
movl %eax, %r13d
movq %rdi, -0x30(%rbp)
movq %r8, -0x48(%rbp)
cmpl $0x0, 0x1c(%rdi)
je 0x34cbb
testl %r15d, %r15d
jle 0x34c85
movl %r15d, %esi
movq %rbx, %rdx
movq %rdi, %r14
callq 0x35526
testl %eax, %eax
jne 0x34cbb
movq 0x8(%r14), %rdi
movl %r15d, %esi
leaq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd8e2
testl %eax, %eax
jne 0x34ca3
leal -0x1(%r13), %r14d
movq -0x68(%rbp), %rdi
movq 0x8(%rdi), %rcx
cmpl $0x0, -0x60(%rbp)
je 0x34bac
movl %r14d, -0x5c(%rbp)
movq %rdi, -0x40(%rbp)
movzbl 0x4(%rcx), %r12d
movzbl 0x5(%rcx), %ebx
movzbl 0x6(%rcx), %eax
movq %rax, -0x50(%rbp)
movq %rcx, -0x58(%rbp)
movzbl 0x7(%rcx), %r8d
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
cmpb $0x0, 0x21(%rax)
je 0x34b5a
movl %r15d, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl %r8d, %r14d
movq -0x48(%rbp), %r8
callq 0x34cca
movl %r14d, %r8d
movq -0x30(%rbp), %rdi
movq (%rdi), %rax
shll $0x18, %r12d
shll $0x10, %ebx
leal (%rbx,%r12), %esi
movq -0x50(%rbp), %r14
shll $0x8, %r14d
orl %r14d, %esi
orl %r8d, %esi
movl 0x34(%rax), %eax
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x2, %ecx
addl $-0x2, %ecx
cmpl %ecx, %esi
jle 0x34bf0
movq -0x48(%rbp), %rbx
movq %rbx, %rsi
leaq 0x455dc(%rip), %rdx     # 0x7a172
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3542e
addl $-0x2, %r13d
movl %r13d, %r14d
jmp 0x34c60
movq %r13, %rax
cmpl $0x1, %eax
movq -0x30(%rbp), %rdx
je 0x34c68
movq (%rdx), %rax
cmpb $0x0, 0x21(%rax)
je 0x34c68
movl (%rcx), %esi
bswapl %esi
movq %rdi, -0x40(%rbp)
movq %rdx, %rdi
movl $0x4, %edx
movq %rcx, %r13
movl %r15d, %ecx
movq %rbx, %r8
callq 0x34cca
movq %r13, %rcx
movq -0x40(%rbp), %rdi
jmp 0x34c68
movl %esi, -0x50(%rbp)
testl %esi, %esi
jle 0x34c54
movq %r14, %rdx
movq %rdi, %r13
addl %ebx, %r12d
addl %r8d, %edx
addl %r12d, %edx
movq %rdx, %r12
xorl %ebx, %ebx
movq -0x58(%rbp), %rax
movl 0x8(%rax,%rbx,4), %r15d
bswapl %r15d
movq (%r13), %rax
cmpb $0x0, 0x21(%rax)
movq -0x48(%rbp), %r14
je 0x34c3e
movq %r13, %rdi
movl %r15d, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x34cca
movq -0x30(%rbp), %r13
movq %r13, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x35526
incq %rbx
cmpq %rbx, %r12
jne 0x34c0b
movl -0x5c(%rbp), %r14d
subl -0x50(%rbp), %r14d
movq -0x48(%rbp), %rbx
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rcx
movl (%rcx), %r15d
bswapl %r15d
callq 0xddd3
movl %r14d, %r13d
testl %r14d, %r14d
movq -0x30(%rbp), %rdi
jg 0x34ab2
jmp 0x34cbb
leaq 0x45497(%rip), %rdx     # 0x7a123
movq %rbx, %rsi
movl %r13d, %ecx
movl -0x34(%rbp), %r8d
movl -0x38(%rbp), %r9d
xorl %eax, %eax
callq 0x3542e
jmp 0x34cbb
leaq 0x454b2(%rip), %rdx     # 0x7a15c
movq -0x30(%rbp), %rdi
movq %rbx, %rsi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3542e
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq