// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %r14d
movq %rdi, %r15
cmpl $0x4, %ecx
jne 0x28f626
movq 0x50(%r15), %rax
movl (%rax), %ecx
bswapl %ecx
cmpl %r14d, %ecx
jne 0x28f6e1
bswapl %edx
movl %edx, (%rax)
movl $0x0, 0x4(%rsp)
jmp 0x28f788
movl %ecx, %r12d
movl %edx, 0x8(%rsp)
cmpb $0x0, (%r15)
je 0x28f70a
movzwl 0x18(%r15), %eax
movl $0x0, 0x4(%rsp)
movl $0x0, %ebx
testl %eax, %eax
je 0x28f72d
movl %eax, 0xc(%rsp)
movl %eax, %ebp
xorl %ebx, %ebx
movzwl 0x1a(%r15), %eax
movq 0x60(%r15), %rcx
movzbl (%rcx,%rbx,2), %edx
shll $0x8, %edx
movzbl 0x1(%rcx,%rbx,2), %r13d
orl %edx, %r13d
andl %eax, %r13d
addq 0x50(%r15), %r13
cmpb $0x3, %r12b
jne 0x28f6c8
movq %r15, %rdi
movq %r13, %rsi
leaq 0x10(%rsp), %rdx
callq *0x80(%r15)
movzwl 0x24(%rsp), %eax
cmpl %eax, 0x20(%rsp)
jbe 0x28f6d3
movzwl 0x26(%rsp), %eax
addq %rax, %r13
movq 0x48(%r15), %rax
movl 0x38(%rax), %eax
addq 0x50(%r15), %rax
cmpq %rax, %r13
ja 0x28f79b
movl -0x4(%r13), %eax
bswapl %eax
cmpl %r14d, %eax
jne 0x28f6d3
jmp 0x28f7c4
movl (%r13), %eax
bswapl %eax
cmpl %r14d, %eax
je 0x28f71f
incq %rbx
cmpq %rbx, %rbp
jne 0x28f659
jmp 0x28f731
leaq 0x1464e3(%rip), %rsi    # 0x3d5bcb
leaq 0x1465ed(%rip), %rdx    # 0x3d5cdc
leaq 0x14633b(%rip), %r8     # 0x3d5a31
movl $0xb, 0x4(%rsp)
movl $0xb, %edi
movl $0x109f7, %ecx          # imm = 0x109F7
jmp 0x28f781
movq %r15, %rdi
callq 0x28b010
movl %eax, 0x4(%rsp)
testl %eax, %eax
jne 0x28f788
jmp 0x28f637
movl 0x8(%rsp), %eax
bswapl %eax
movl %eax, (%r13)
movl 0xc(%rsp), %eax
cmpl %eax, %ebx
jne 0x28f788
cmpb $0x5, %r12b
jne 0x28f75a
movq 0x50(%r15), %rax
movzbl 0x9(%r15), %ecx
movl 0x8(%rax,%rcx), %edx
bswapl %edx
cmpl %r14d, %edx
jne 0x28f75a
movl 0x8(%rsp), %edx
bswapl %edx
movl %edx, 0x8(%rax,%rcx)
jmp 0x28f619
leaq 0x14646a(%rip), %rsi    # 0x3d5bcb
leaq 0x146574(%rip), %rdx    # 0x3d5cdc
leaq 0x1462c2(%rip), %r8     # 0x3d5a31
movl $0xb, 0x4(%rsp)
movl $0xb, %edi
movl $0x10a1c, %ecx          # imm = 0x10A1C
xorl %eax, %eax
callq 0x274d08
movl 0x4(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x146429(%rip), %rsi    # 0x3d5bcb
leaq 0x146533(%rip), %rdx    # 0x3d5cdc
leaq 0x146281(%rip), %r8     # 0x3d5a31
movl $0xb, 0x4(%rsp)
movl $0xb, %edi
movl $0x10a0a, %ecx          # imm = 0x10A0A
jmp 0x28f781
movl 0x8(%rsp), %eax
bswapl %eax
movl %eax, -0x4(%r13)
jmp 0x28f619