// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/sqlite-3.33.0/sqlite3.c
// Function: ptrmapPut
static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){
  DbPage *pDbPage;  /* The pointer map page */
  u8 *pPtrmap;      /* The pointer map data */
  Pgno iPtrmap;     /* The pointer map page number */
  int offset;       /* Offset in pointer map page */
  int rc;           /* Return code from subfunctions */

  if( *pRC ) return;

  assert( sqlite3_mutex_held(pBt->mutex) );
  /* The super-journal page number must never be used as a pointer map page */
  assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) );

  assert( pBt->autoVacuum );
  if( key==0 ){
    *pRC = SQLITE_CORRUPT_BKPT;
    return;
  }
  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage, 0);
  if( rc!=SQLITE_OK ){
    *pRC = rc;
    return;
  }
  if( ((char*)sqlite3PagerGetExtra(pDbPage))[0]!=0 ){
    /* The first byte of the extra data is the MemPage.isInit byte.
    ** If that byte is set, it means this page is also being used
    ** as a btree page. */
    *pRC = SQLITE_CORRUPT_BKPT;
    goto ptrmap_exit;
  }
  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  if( offset<0 ){
    *pRC = SQLITE_CORRUPT_BKPT;
    goto ptrmap_exit;
  }
  assert( offset <= (int)pBt->usableSize-5 );
  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);

  if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
    TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
    *pRC= rc = sqlite3PagerWrite(pDbPage);
    if( rc==SQLITE_OK ){
      pPtrmap[offset] = eType;
      put4byte(&pPtrmap[offset+1], parent);
    }
  }

ptrmap_exit:
  sqlite3PagerUnref(pDbPage);
}

// Assembly:
cmpl $0x0, (%r8)
je 0x28f45c
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movl %edx, %ebp
movl %esi, %r14d
cmpl $0x1, %esi
je 0x28f4ab
testl %r14d, %r14d
jne 0x28f4b3
leaq 0x14674a(%rip), %rsi    # 0x3d5bcb
leaq 0x146854(%rip), %rdx    # 0x3d5cdc
leaq 0x1465a2(%rip), %r8     # 0x3d5a31
movl $0xb, %edi
movl $0xffcc, %ecx           # imm = 0xFFCC
xorl %eax, %eax
callq 0x274d08
movl $0xb, (%rbx)
jmp 0x28f556
movl %ecx, %r12d
xorl %r15d, %r15d
jmp 0x28f4f2
movl %ecx, %r12d
movl 0x38(%rdi), %eax
movl $0xcccccccd, %esi       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x22, %rsi
incl %esi
leal -0x2(%r14), %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %esi
subl %edx, %ecx
movl 0x22c5e6(%rip), %eax    # 0x4bbac0
xorl %edx, %edx
divl 0x34(%rdi)
leal 0x1(%rcx), %edx
xorl %esi, %esi
cmpl %eax, %edx
sete %sil
leal (%rcx,%rsi), %r15d
addl $0x2, %r15d
movq (%rdi), %rdi
leaq 0x8(%rsp), %rdx
movl %r15d, %esi
xorl %ecx, %ecx
callq *0x108(%rdi)
testl %eax, %eax
je 0x28f50d
movl %eax, (%rbx)
jmp 0x28f556
movq 0x8(%rsp), %rdi
movq 0x10(%rdi), %rax
cmpb $0x0, (%rax)
je 0x28f563
leaq 0x1466a9(%rip), %rsi    # 0x3d5bcb
leaq 0x1467b3(%rip), %rdx    # 0x3d5cdc
leaq 0x146501(%rip), %r8     # 0x3d5a31
movl $0xb, %edi
movl $0xffd9, %ecx           # imm = 0xFFD9
xorl %eax, %eax
callq 0x274d08
movl $0xb, (%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x28f556
callq 0x28ab87
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
notl %r15d
addl %r14d, %r15d
leal (%r15,%r15,4), %eax
testl %eax, %eax
js 0x28f5c7
movq 0x8(%rdi), %rdx
movl %eax, %esi
cmpb %bpl, (%rdx,%rsi)
jne 0x28f588
movl 0x1(%rdx,%rsi), %eax
bswapl %eax
cmpl %r12d, %eax
je 0x28f547
movq %rdx, %r14
movq %rsi, %r15
callq 0x2774a1
movl %eax, (%rbx)
testl %eax, %eax
jne 0x28f547
movq %r15, %rsi
movq %r14, %rdx
movb %bpl, (%r14,%r15)
movl %r12d, %ecx
movl %r12d, %eax
shrl $0x18, %eax
movb %al, 0x1(%r14,%r15)
movl %r12d, %eax
shrl $0x10, %eax
movb %al, 0x2(%r14,%r15)
movb %ch, 0x3(%rdx,%rsi)
movb %cl, 0x4(%r14,%r15)
jmp 0x28f547
leaq 0x1465fd(%rip), %rsi    # 0x3d5bcb
leaq 0x146707(%rip), %rdx    # 0x3d5cdc
leaq 0x146455(%rip), %r8     # 0x3d5a31
movl $0xb, %edi
movl $0xffde, %ecx           # imm = 0xFFDE
jmp 0x28f53a