// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movq %r8, %rbx
movl %edx, %r15d
movl %esi, -0x44(%rbp)
movq %rdi, %r12
movl %ecx, -0x34(%rbp)
movl %ecx, %r14d
movl %edx, -0x38(%rbp)
testl %r14d, %r14d
jle 0x2f926
cmpl $0x0, 0x1c(%r12)
je 0x2f926
testl %r15d, %r15d
jle 0x2f8ee
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
callq 0x3013e
testl %eax, %eax
jne 0x2f926
movq 0x8(%r12), %rdi
movl %r15d, %esi
leaq -0x58(%rbp), %rdx
xorl %ecx, %ecx
callq 0xca7d
testl %eax, %eax
jne 0x2f90f
leal -0x1(%r14), %r13d
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rcx
cmpl $0x0, -0x44(%rbp)
movq %rax, -0x50(%rbp)
je 0x2f82c
movl %r13d, -0x40(%rbp)
movq %rcx, -0x30(%rbp)
leaq 0x4(%rcx), %rdi
callq 0x180a3
movl %eax, %r13d
movq (%r12), %rax
cmpb $0x0, 0x21(%rax)
je 0x2f7f8
movq %r12, %rdi
movl %r15d, %esi
pushq $0x2
popq %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2f935
movq (%r12), %rax
movl 0x34(%rax), %eax
cltd
pushq $0x4
popq %rcx
idivl %ecx
addl $-0x2, %eax
cmpl %eax, %r13d
jle 0x2f864
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x3c97c(%rip), %rdx     # 0x6c192
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3004c
addl $-0x2, %r14d
movl %r14d, %r13d
jmp 0x2f8c9
cmpl $0x1, %r14d
je 0x2f8e9
movq (%r12), %rax
cmpb $0x0, 0x21(%rax)
movq %rcx, %r14
je 0x2f8cd
movq %r14, %rdi
callq 0x180a3
movq %r12, %rdi
movl %eax, %esi
pushq $0x4
popq %rdx
movl %r15d, %ecx
movq %rbx, %r8
callq 0x2f935
jmp 0x2f8cd
movq -0x30(%rbp), %rax
leaq 0x8(%rax), %r14
testl %r13d, %r13d
movl %r13d, %eax
movl $0x0, %r13d
movl %eax, -0x3c(%rbp)
cmovgl %eax, %r13d
subq $0x1, %r13
jb 0x2f8c1
movq %r14, %rdi
callq 0x180a3
movl %eax, %r15d
movq (%r12), %rax
cmpb $0x0, 0x21(%rax)
je 0x2f8ad
movq %r12, %rdi
movl %r15d, %esi
pushq $0x2
popq %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x2f935
movq %r12, %rdi
movl %r15d, %esi
movq %rbx, %rdx
callq 0x3013e
addq $0x4, %r14
jmp 0x2f87f
movl -0x40(%rbp), %r13d
subl -0x3c(%rbp), %r13d
movq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x180a3
movl %eax, %r15d
movq -0x50(%rbp), %rdi
callq 0xcf6e
movl %r13d, %r14d
jmp 0x2f75e
movq %rcx, %r14
jmp 0x2f8cd
leaq 0x3c84e(%rip), %rdx     # 0x6c143
movq %r12, %rdi
movq %rbx, %rsi
movl %r14d, %ecx
movl -0x34(%rbp), %r8d
movl -0x38(%rbp), %r9d
xorl %eax, %eax
callq 0x3004c
jmp 0x2f926
leaq 0x3c866(%rip), %rdx     # 0x6c17c
movq %r12, %rdi
movq %rbx, %rsi
movl %r15d, %ecx
xorl %eax, %eax
callq 0x3004c
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq