// File: /workspace/github_c_makefile_star2_O1/barabo[P]advanced-shell-history/src/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 master-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);
  if( rc!=SQLITE_OK ){
    *pRC = rc;
    return;
  }
  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:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x0, (%r8)
je 0x22b2c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r8, %rbx
movl %edx, %r14d
movl %esi, %r15d
cmpl $0x1, %esi
je 0x22b66
testl %r15d, %r15d
jne 0x22b6e
leaq 0x56cce(%rip), %rsi     # 0x79814
leaq 0x569ec(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xc4d8, %edx           # imm = 0xC4D8
xorl %eax, %eax
callq 0xb8cc
movl $0xb, (%rbx)
jmp 0x22b1d
movl %ecx, %r13d
xorl %r12d, %r12d
jmp 0x22bad
movl %ecx, %r13d
movl 0x34(%rdi), %eax
movl $0xcccccccd, %esi       # imm = 0xCCCCCCCD
imulq %rax, %rsi
shrq $0x22, %rsi
incl %esi
leal -0x2(%r15), %ecx
movl %ecx, %eax
xorl %edx, %edx
divl %esi
subl %edx, %ecx
movl 0x71cab(%rip), %eax     # 0x94840
xorl %edx, %edx
divl 0x30(%rdi)
leal 0x1(%rcx), %edx
xorl %esi, %esi
cmpl %eax, %edx
sete %sil
leal (%rcx,%rsi), %r12d
addl $0x2, %r12d
movq (%rdi), %rdi
leaq -0x30(%rbp), %rdx
movl %r12d, %esi
xorl %ecx, %ecx
callq 0xd803
testl %eax, %eax
je 0x22bc9
movl %eax, (%rbx)
jmp 0x22b1d
notl %r12d
addl %r15d, %r12d
leal (%r12,%r12,4), %eax
testl %eax, %eax
js 0x22c31
movq -0x30(%rbp), %rdi
movq 0x8(%rdi), %rdx
movl %eax, %esi
cmpb %r14b, (%rdx,%rsi)
jne 0x22bf2
movl 0x1(%rdx,%rsi), %eax
bswapl %eax
cmpl %r13d, %eax
je 0x22c56
movq %rdx, %r15
movq %rsi, %r12
callq 0xdebf
movl %eax, (%rbx)
testl %eax, %eax
jne 0x22c56
movq %r12, %rsi
movq %r15, %rdx
movb %r14b, (%r15,%r12)
movl %r13d, %ecx
movl %r13d, %eax
shrl $0x18, %eax
movb %al, 0x1(%r15,%r12)
movl %r13d, %eax
shrl $0x10, %eax
movb %al, 0x2(%r15,%r12)
movb %ch, 0x3(%rdx,%rsi)
movb %cl, 0x4(%r15,%r12)
jmp 0x22c56
leaq 0x56bdc(%rip), %rsi     # 0x79814
leaq 0x568fa(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xc4e3, %edx           # imm = 0xC4E3
xorl %eax, %eax
callq 0xb8cc
movl $0xb, (%rbx)
movq -0x30(%rbp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdcd4