// File: /workspace/github_c_makefile_star2_O1/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
movq %r8, -0x30(%rbp)
movl %edx, %r15d
movl %esi, -0x54(%rbp)
movq %rdi, %r13
movl %ecx, -0x5c(%rbp)
movl %ecx, %r14d
movl %edx, -0x58(%rbp)
testl %r14d, %r14d
jle 0x34569
cmpl $0x0, 0x1c(%r13)
je 0x34569
leal -0x1(%r14), %r12d
testl %r15d, %r15d
jle 0x34393
movq %r13, %rdi
movl %r15d, %esi
movq -0x30(%rbp), %rdx
callq 0x34de1
testl %eax, %eax
je 0x343ba
xorl %ebx, %ebx
jmp 0x3455e
xorl %ebx, %ebx
movq %r13, %rdi
movq -0x30(%rbp), %rsi
leaq 0x45d80(%rip), %rdx     # 0x7a123
movl %r14d, %ecx
movl -0x5c(%rbp), %r8d
movl -0x58(%rbp), %r9d
xorl %eax, %eax
callq 0x34ce9
jmp 0x3455e
movq 0x8(%r13), %rdi
movl %r15d, %esi
leaq -0x68(%rbp), %rdx
xorl %ecx, %ecx
callq 0xd803
testl %eax, %eax
je 0x343ef
xorl %ebx, %ebx
movq %r13, %rdi
movq -0x30(%rbp), %rsi
leaq 0x45d7c(%rip), %rdx     # 0x7a15c
movl %r15d, %ecx
xorl %eax, %eax
callq 0x34ce9
jmp 0x3455e
movq -0x68(%rbp), %rbx
movq 0x8(%rbx), %rcx
cmpl $0x0, -0x54(%rbp)
je 0x344ab
movl %r12d, -0x50(%rbp)
movzbl 0x4(%rcx), %edi
movzbl 0x5(%rcx), %r9d
movzbl 0x6(%rcx), %eax
movq %rax, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movzbl 0x7(%rcx), %r8d
movq (%r13), %rax
cmpb $0x0, 0x21(%rax)
je 0x34455
movq %rdi, -0x38(%rbp)
movq %r13, %rdi
movl %r15d, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl %r8d, -0x4c(%rbp)
movq -0x30(%rbp), %r8
movq %r9, %r12
callq 0x34578
movq %r12, %r9
movl -0x4c(%rbp), %r8d
movq -0x38(%rbp), %rdi
shll $0x18, %edi
shll $0x10, %r9d
leal (%r9,%rdi), %esi
movq -0x40(%rbp), %r12
shll $0x8, %r12d
orl %r12d, %esi
orl %r8d, %esi
movq (%r13), %rax
movl 0x34(%rax), %eax
leal 0x3(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x2, %ecx
addl $-0x2, %ecx
cmpl %ecx, %esi
jle 0x344e3
movq %r13, %rdi
movq -0x30(%rbp), %rsi
leaq 0x45cdd(%rip), %rdx     # 0x7a172
movl %r15d, %ecx
xorl %eax, %eax
callq 0x34ce9
addl $-0x2, %r14d
movl %r14d, %r12d
jmp 0x3454a
cmpl $0x1, %r14d
je 0x3454e
movq (%r13), %rax
cmpb $0x0, 0x21(%rax)
je 0x3454e
movl (%rcx), %esi
bswapl %esi
movq %r13, %rdi
movl $0x4, %edx
movq %rcx, %r14
movl %r15d, %ecx
movq -0x30(%rbp), %r8
callq 0x34578
movq %r14, %rcx
jmp 0x3454e
movq %rbx, -0x40(%rbp)
movl %esi, -0x38(%rbp)
testl %esi, %esi
movq -0x30(%rbp), %r15
jle 0x3453e
addl %r9d, %edi
addl %r8d, %r12d
addl %edi, %r12d
xorl %ebx, %ebx
movq -0x48(%rbp), %rax
movl 0x8(%rax,%rbx,4), %r14d
bswapl %r14d
movq (%r13), %rax
cmpb $0x0, 0x21(%rax)
je 0x34528
movq %r13, %rdi
movl %r14d, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movq %r15, %r8
callq 0x34578
movq %r13, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x34de1
incq %rbx
cmpq %rbx, %r12
jne 0x344fd
movl -0x50(%rbp), %r12d
subl -0x38(%rbp), %r12d
movq -0x40(%rbp), %rbx
movq -0x48(%rbp), %rcx
movl (%rcx), %r15d
bswapl %r15d
movq %rbx, %rdi
callq 0xdcd4
movb $0x1, %bl
movl %r12d, %r14d
testb %bl, %bl
jne 0x3435c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq