// File: /workspace/github_c_makefile_star2_O1/shifengbin[P]bishe/Output/../Persistence/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_BKPT;
    }
    put4byte(pPage->aData, iTo);
  }else{
    u8 isInitOrig = pPage->isInit;
    int i;
    int nCell;
    int rc;

    rc = 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
         && pCell+info.nSize-1<=pPage->aData+pPage->maskPage
         && 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_BKPT;
      }
      put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
    }

    pPage->isInit = isInitOrig;
  }
  return SQLITE_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %r15d
movq %rdi, %r14
cmpl $0x4, %ecx
jne 0x28352
movq 0x50(%r14), %rax
movl (%rax), %ecx
bswapl %ecx
cmpl %esi, %ecx
jne 0x28374
bswapl %r15d
movl %r15d, (%rax)
jmp 0x2851d
movl %ecx, %r12d
movl %esi, -0x34(%rbp)
movb (%r14), %al
movb %al, -0x29(%rbp)
movq %r14, %rdi
callq 0x21dda
xorl %ebx, %ebx
testl %eax, %eax
je 0x2839e
movl %eax, %r13d
jmp 0x28519
leaq 0x5515d(%rip), %rsi     # 0x7d4d8
leaq 0x54dfb(%rip), %rcx     # 0x7d17d
movl $0xb, %r13d
movl $0xb, %edi
movl $0xe453, %edx           # imm = 0xE453
xorl %eax, %eax
callq 0xa4b0
jmp 0x28520
movzwl 0x12(%r14), %eax
testl %eax, %eax
movl -0x34(%rbp), %esi
je 0x284c2
movl %r15d, %ecx
shrl $0x18, %ecx
movl %ecx, -0x44(%rbp)
movl %r15d, %ecx
shrl $0x10, %ecx
movl %ecx, -0x40(%rbp)
movl %r15d, -0x30(%rbp)
shrl $0x8, %r15d
movl %r15d, -0x3c(%rbp)
movl %eax, -0x38(%rbp)
movl %eax, %r15d
xorl %ebx, %ebx
movzwl 0x14(%r14), %eax
movq 0x60(%r14), %rcx
movzbl (%rcx,%rbx,2), %edx
shll $0x8, %edx
movzbl 0x1(%rcx,%rbx,2), %r13d
orl %edx, %r13d
andl %eax, %r13d
addq 0x50(%r14), %r13
cmpb $0x3, %r12b
jne 0x2843a
movq %r14, %rdi
movq %r13, %rsi
leaq -0x60(%rbp), %rdx
callq *0x80(%r14)
movzwl -0x4c(%rbp), %edx
xorl %eax, %eax
movb $0x1, %cl
cmpl %edx, -0x50(%rbp)
jbe 0x28431
movzwl -0x4a(%rbp), %edx
leaq (%rdx,%r13), %rsi
decq %rsi
movzwl 0x14(%r14), %edi
addq 0x50(%r14), %rdi
cmpq %rdi, %rsi
jbe 0x2847b
movl -0x34(%rbp), %esi
testb %cl, %cl
jne 0x28467
jmp 0x28469
movl (%r13), %eax
bswapl %eax
cmpl %esi, %eax
jne 0x28467
movl -0x44(%rbp), %eax
movb %al, (%r13)
movl -0x40(%rbp), %eax
movb %al, 0x1(%r13)
movl -0x3c(%rbp), %eax
movb %al, 0x2(%r13)
movl -0x30(%rbp), %eax
movb %al, 0x3(%r13)
movl $0x2, %eax
jmp 0x28469
xorl %eax, %eax
testl %eax, %eax
jne 0x284b0
incq %rbx
cmpq %rbx, %r15
jne 0x283d4
jmp 0x284b9
addq %rdx, %r13
movl -0x4(%r13), %edx
bswapl %edx
movl -0x34(%rbp), %esi
cmpl %esi, %edx
jne 0x28434
movl -0x44(%rbp), %eax
movb %al, -0x4(%r13)
movl -0x40(%rbp), %eax
movb %al, -0x3(%r13)
movl -0x3c(%rbp), %eax
movb %al, -0x2(%r13)
movl -0x30(%rbp), %eax
movb %al, -0x1(%r13)
movl $0x2, %eax
xorl %ecx, %ecx
jmp 0x28434
movl -0x30(%rbp), %r15d
movl -0x38(%rbp), %eax
jmp 0x284c2
movl -0x38(%rbp), %eax
movl %eax, %ebx
movl -0x30(%rbp), %r15d
cmpl %eax, %ebx
movb -0x29(%rbp), %dil
jne 0x284eb
cmpb $0x5, %r12b
jne 0x284f2
movq 0x50(%r14), %rax
movzbl 0x6(%r14), %ecx
movl 0x8(%rax,%rcx), %edx
bswapl %edx
cmpl %esi, %edx
jne 0x284f2
bswapl %r15d
movl %r15d, 0x8(%rax,%rcx)
movb %dil, (%r14)
movb $0x1, %bl
jmp 0x28519
leaq 0x54fdf(%rip), %rsi     # 0x7d4d8
leaq 0x54c7d(%rip), %rcx     # 0x7d17d
xorl %ebx, %ebx
movl $0xb, %r13d
movl $0xb, %edi
movl $0xe477, %edx           # imm = 0xE477
xorl %eax, %eax
callq 0xa4b0
testb %bl, %bl
je 0x28520
xorl %r13d, %r13d
movl %r13d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq