// File: /workspace/github_c_makefile_star2_O0/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
subq $0x40, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movb %al, -0xd(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x2dd69
jmp 0x2de70
cmpl $0x0, -0xc(%rbp)
jne 0x2dd86
movl $0xc4d8, %edi           # imm = 0xC4D8
callq 0x24410
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x2de70
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x2b950
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %esi
leaq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0xe5f0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x2ddc1
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x2de70
movl -0xc(%rbp), %eax
subl -0x34(%rbp), %eax
subl $0x1, %eax
imull $0x5, %eax, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jge 0x2ddea
movl $0xc4e3, %edi           # imm = 0xC4E3
callq 0x24410
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x2de67
movq -0x28(%rbp), %rdi
callq 0xec10
movq %rax, -0x30(%rbp)
movzbl -0xd(%rbp), %eax
movq -0x30(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x2de24
movq -0x30(%rbp), %rdi
movl -0x38(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
callq 0x20a50
cmpl -0x14(%rbp), %eax
je 0x2de65
movq -0x28(%rbp), %rdi
callq 0xef80
movl %eax, %ecx
movl %ecx, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x3c(%rbp)
jne 0x2de63
movb -0xd(%rbp), %dl
movq -0x30(%rbp), %rax
movslq -0x38(%rbp), %rcx
movb %dl, (%rax,%rcx)
movq -0x30(%rbp), %rdi
movl -0x38(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
movl -0x14(%rbp), %esi
callq 0x22060
jmp 0x2de65
jmp 0x2de67
movq -0x28(%rbp), %rdi
callq 0xec30
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)