// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: modifyPagePointer
static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  if( eType==PTRMAP_OVERFLOW2 ){
    /* The pointer is always the first 4 bytes of the page in this case.  */
    if( get4byte(pPage->aData)!=iFrom ){
      return SQLITE_CORRUPT_PAGE(pPage);
    }
    put4byte(pPage->aData, iTo);
  }else{
    int i;
    int nCell;
    int rc;

    rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
    if( rc ) return rc;
    nCell = pPage->nCell;

    for(i=0; i<nCell; i++){
      u8 *pCell = findCell(pPage, i);
      if( eType==PTRMAP_OVERFLOW1 ){
        CellInfo info;
        pPage->xParseCell(pPage, pCell, &info);
        if( info.nLocal<info.nPayload ){
          if( pCell+info.nSize > pPage->aData+pPage->pBt->usableSize ){
            return SQLITE_CORRUPT_PAGE(pPage);
          }
          if( iFrom==get4byte(pCell+info.nSize-4) ){
            put4byte(pCell+info.nSize-4, iTo);
            break;
          }
        }
      }else{
        if( get4byte(pCell)==iFrom ){
          put4byte(pCell, iTo);
          break;
        }
      }
    }

    if( i==nCell ){
      if( eType!=PTRMAP_BTREE ||
          get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
        return SQLITE_CORRUPT_PAGE(pPage);
      }
      put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
    }
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movb %al, -0x19(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x4, %eax
jne 0x3eaca9
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x3db720
cmpl -0x14(%rbp), %eax
je 0x3eac94
movl $0x109f7, %edi          # imm = 0x109F7
callq 0x3dff80
movl %eax, -0x4(%rbp)
jmp 0x3eae8e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movl -0x18(%rbp), %esi
callq 0x3dd200
jmp 0x3eae87
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x0, %eax
je 0x3eacbc
xorl %eax, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3eacc8
movq -0x10(%rbp), %rdi
callq 0x3e4130
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x28(%rbp)
cmpl $0x0, -0x28(%rbp)
je 0x3eacdf
movl -0x28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3eae8e
movq -0x10(%rbp), %rax
movzwl 0x18(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3eae23
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
movzwl 0x1a(%rcx), %ecx
movq -0x10(%rbp), %rdx
movq 0x60(%rdx), %rdx
movl -0x20(%rbp), %esi
shll %esi
movslq %esi, %rsi
movzbl (%rdx,%rsi), %edx
shll $0x8, %edx
movq -0x10(%rbp), %rsi
movq 0x60(%rsi), %rsi
movl -0x20(%rbp), %edi
shll %edi
movslq %edi, %rdi
movzbl 0x1(%rsi,%rdi), %esi
orl %esi, %edx
andl %edx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movzbl -0x19(%rbp), %eax
cmpl $0x3, %eax
jne 0x3eadf5
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq *%rax
movzwl -0x34(%rbp), %eax
cmpl -0x38(%rbp), %eax
jae 0x3eadf3
movq -0x30(%rbp), %rax
movzwl -0x32(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq -0x10(%rbp), %rdx
movq 0x48(%rdx), %rdx
movl 0x38(%rdx), %edx
addq %rdx, %rcx
cmpq %rcx, %rax
jbe 0x3eadb1
movl $0x10a0a, %edi          # imm = 0x10A0A
callq 0x3dff80
movl %eax, -0x4(%rbp)
jmp 0x3eae8e
movl -0x14(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rdi
addq $-0x4, %rdi
callq 0x3db720
movl %eax, %ecx
movl -0x50(%rbp), %eax
cmpl %ecx, %eax
jne 0x3eadf1
movq -0x30(%rbp), %rdi
movzwl -0x32(%rbp), %eax
cltq
addq %rax, %rdi
addq $-0x4, %rdi
movl -0x18(%rbp), %esi
callq 0x3dd200
jmp 0x3eae23
jmp 0x3eadf3
jmp 0x3eae13
movq -0x30(%rbp), %rdi
callq 0x3db720
cmpl -0x14(%rbp), %eax
jne 0x3eae11
movq -0x30(%rbp), %rdi
movl -0x18(%rbp), %esi
callq 0x3dd200
jmp 0x3eae23
jmp 0x3eae13
jmp 0x3eae15
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x3eacf1
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
jne 0x3eae85
movzbl -0x19(%rbp), %eax
cmpl $0x5, %eax
jne 0x3eae56
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
addl $0x8, %eax
cltq
addq %rax, %rdi
callq 0x3db720
cmpl -0x14(%rbp), %eax
je 0x3eae65
movl $0x10a1c, %edi          # imm = 0x10A1C
callq 0x3dff80
movl %eax, -0x4(%rbp)
jmp 0x3eae8e
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdi
movq -0x10(%rbp), %rax
movzbl 0x9(%rax), %eax
addl $0x8, %eax
cltq
addq %rax, %rdi
movl -0x18(%rbp), %esi
callq 0x3dd200
jmp 0x3eae87
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)