// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: checkList
static void checkList(
  IntegrityCk *pCheck,  /* Integrity checking context */
  int isFreeList,       /* True for a freelist.  False for overflow page list */
  Pgno iPage,           /* Page number for first page in the list */
  u32 N                 /* Expected number of pages in the list */
){
  int i;
  u32 expected = N;
  int nErrAtStart = pCheck->nErr;
  while( iPage!=0 && pCheck->mxErr ){
    DbPage *pOvflPage;
    unsigned char *pOvflData;
    if( checkRef(pCheck, iPage) ) break;
    N--;
    if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
      checkAppendMsg(pCheck, "failed to get page %d", iPage);
      break;
    }
    pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
    if( isFreeList ){
      u32 n = (u32)get4byte(&pOvflData[4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pCheck->pBt->autoVacuum ){
        checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
      }
#endif
      if( n>pCheck->pBt->usableSize/4-2 ){
        checkAppendMsg(pCheck,
           "freelist leaf count too big on page %d", iPage);
        N--;
      }else{
        for(i=0; i<(int)n; i++){
          Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
          if( pCheck->pBt->autoVacuum ){
            checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0);
          }
#endif
          checkRef(pCheck, iFreePage);
        }
        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);
      }
    }
#endif
    iPage = get4byte(pOvflData);
    sqlite3PagerUnref(pOvflPage);
  }
  if( N && nErrAtStart==pCheck->nErr ){
    checkAppendMsg(pCheck,
      "%s is %d but should be %d",
      isFreeList ? "size" : "overflow list length",
      expected-N, expected);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x20(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x10(%rbp)
movb %al, -0x39(%rbp)
je 0x40cdde
movq -0x8(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x40cdea
jmp 0x40cf7b
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x40da90
cmpl $0x0, %eax
je 0x40ce00
jmp 0x40cf7b
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x10(%rbp), %esi
leaq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3c6020
cmpl $0x0, %eax
je 0x40ce3e
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq 0x19eebc(%rip), %rsi    # 0x5abcee
movb $0x0, %al
callq 0x40cfd0
jmp 0x40cf7b
movq -0x28(%rbp), %rdi
callq 0x3c6290
movq %rax, -0x30(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x40cf29
movq -0x30(%rbp), %rdi
addq $0x4, %rdi
callq 0x3db720
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpb $0x0, 0x21(%rax)
je 0x40ce85
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x40d110
movl -0x34(%rbp), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movl 0x38(%rcx), %ecx
shrl $0x2, %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jbe 0x40cebc
movq -0x8(%rbp), %rdi
movl -0x10(%rbp), %edx
leaq 0x19ee5a(%rip), %rsi    # 0x5abd04
movb $0x0, %al
callq 0x40cfd0
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x40cf27
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x40cf1c
movq -0x30(%rbp), %rdi
movl -0x18(%rbp), %eax
shll $0x2, %eax
addl $0x8, %eax
cltq
addq %rax, %rdi
callq 0x3db720
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpb $0x0, 0x21(%rax)
je 0x40cf05
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %esi
movl $0x2, %edx
xorl %ecx, %ecx
callq 0x40d110
movq -0x8(%rbp), %rdi
movl -0x38(%rbp), %esi
callq 0x40da90
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x40cec3
movl -0x34(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
jmp 0x40cf61
movq -0x8(%rbp), %rax
movq (%rax), %rax
movzbl 0x21(%rax), %eax
cmpl $0x0, %eax
je 0x40cf5f
cmpl $0x0, -0x14(%rbp)
jbe 0x40cf5f
movq -0x30(%rbp), %rdi
callq 0x3db720
movl %eax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x10(%rbp), %ecx
movl $0x4, %edx
callq 0x40d110
jmp 0x40cf61
movq -0x30(%rbp), %rdi
callq 0x3db720
movl %eax, -0x10(%rbp)
movq -0x28(%rbp), %rdi
callq 0x3c62b0
jmp 0x40cdc5
cmpl $0x0, -0x14(%rbp)
je 0x40cfc1
movl -0x20(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x40cfc1
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %ecx
leaq 0x19edaa(%rip), %rdx    # 0x5abd45
leaq 0x127b4e(%rip), %rax    # 0x534af0
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movl -0x1c(%rbp), %ecx
subl -0x14(%rbp), %ecx
movl -0x1c(%rbp), %r8d
leaq 0x19ed71(%rip), %rsi    # 0x5abd2b
movb $0x0, %al
callq 0x40cfd0
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)