// File: /workspace/github_c_makefile_star2_O0/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:
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 0x3eab19
jmp 0x3eac48
cmpl $0x0, -0xc(%rbp)
jne 0x3eab36
movl $0xffcc, %edi           # imm = 0xFFCC
callq 0x3dff80
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x3eac48
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x3e8c00
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
movl -0x34(%rbp), %esi
leaq -0x28(%rbp), %rdx
xorl %ecx, %ecx
callq 0x3c6020
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0x3eab71
movl -0x3c(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x3eac48
movq -0x28(%rbp), %rdi
callq 0x3e40f0
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x3eab99
movl $0xffd9, %edi           # imm = 0xFFD9
callq 0x3dff80
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x3eac3f
movl -0xc(%rbp), %eax
subl -0x34(%rbp), %eax
subl $0x1, %eax
imull $0x5, %eax, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
jge 0x3eabc2
movl $0xffde, %edi           # imm = 0xFFDE
callq 0x3dff80
movl %eax, %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
jmp 0x3eac3f
movq -0x28(%rbp), %rdi
callq 0x3c6290
movq %rax, -0x30(%rbp)
movzbl -0xd(%rbp), %eax
movq -0x30(%rbp), %rcx
movslq -0x38(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
cmpl %ecx, %eax
jne 0x3eabfc
movq -0x30(%rbp), %rdi
movl -0x38(%rbp), %eax
addl $0x1, %eax
cltq
addq %rax, %rdi
callq 0x3db720
cmpl -0x14(%rbp), %eax
je 0x3eac3d
movq -0x28(%rbp), %rdi
callq 0x3c6610
movl %eax, %ecx
movl %ecx, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
cmpl $0x0, -0x3c(%rbp)
jne 0x3eac3b
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 0x3dd200
jmp 0x3eac3d
jmp 0x3eac3f
movq -0x28(%rbp), %rdi
callq 0x3c62b0
addq $0x40, %rsp
popq %rbp
retq
nop