// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
cmpl $0x0, (%r8)
je 0x2272b
addq $0x18, %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 0x22765
testl %r15d, %r15d
jne 0x2276d
leaq 0x570cf(%rip), %rsi     # 0x79814
leaq 0x56ded(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xc4d8, %edx           # imm = 0xC4D8
xorl %eax, %eax
callq 0xb9c7
movl $0xb, (%rbx)
jmp 0x2271c
movl %ecx, %r13d
xorl %r12d, %r12d
jmp 0x227ac
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 0x720ac(%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 0xd8e2
testl %eax, %eax
je 0x227c8
movl %eax, (%rbx)
jmp 0x2271c
notl %r12d
addl %r15d, %r12d
leal (%r12,%r12,4), %eax
testl %eax, %eax
js 0x22835
movq -0x30(%rbp), %r15
movq 0x8(%r15), %rdx
movl %eax, %esi
cmpb %r14b, (%rdx,%rsi)
jne 0x227f1
movl 0x1(%rdx,%rsi), %eax
bswapl %eax
cmpl %r13d, %eax
je 0x2285e
movq %rsi, -0x38(%rbp)
movq %rdx, %r12
movq %r15, %rdi
callq 0xdfbf
movl %eax, (%rbx)
testl %eax, %eax
jne 0x2285e
movq %r12, %rdx
movq -0x38(%rbp), %rsi
movb %r14b, (%r12,%rsi)
movl %r13d, %ecx
movl %r13d, %eax
shrl $0x18, %eax
movb %al, 0x1(%r12,%rsi)
movl %r13d, %eax
shrl $0x10, %eax
movb %al, 0x2(%r12,%rsi)
movb %ch, 0x3(%rdx,%rsi)
movb %cl, 0x4(%r12,%rsi)
jmp 0x2285e
leaq 0x56fd8(%rip), %rsi     # 0x79814
leaq 0x56cf6(%rip), %rcx     # 0x79539
movl $0xb, %edi
movl $0xc4e3, %edx           # imm = 0xC4E3
xorl %eax, %eax
callq 0xb9c7
movl $0xb, (%rbx)
movq -0x30(%rbp), %r15
movq %r15, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xddd3