// File: /workspace/github_c_makefile_star2_O1/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 0x2991c8
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 0x299217
testl %r14d, %r14d
jne 0x29921f
leaq 0x146132(%rip), %rsi    # 0x3df31f
leaq 0x14623c(%rip), %rdx    # 0x3df430
leaq 0x145f8a(%rip), %r8     # 0x3df185
movl $0xb, %edi
movl $0xffcc, %ecx           # imm = 0xFFCC
xorl %eax, %eax
callq 0x27e637
movl $0xb, (%rbx)
jmp 0x2992c2
movl %ecx, %r12d
xorl %r15d, %r15d
jmp 0x29925e
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 0x22d87a(%rip), %eax    # 0x4c6ac0
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 0x299279
movl %eax, (%rbx)
jmp 0x2992c2
movq 0x8(%rsp), %rdi
movq 0x10(%rdi), %rax
cmpb $0x0, (%rax)
je 0x2992cf
leaq 0x146091(%rip), %rsi    # 0x3df31f
leaq 0x14619b(%rip), %rdx    # 0x3df430
leaq 0x145ee9(%rip), %r8     # 0x3df185
movl $0xb, %edi
movl $0xffd9, %ecx           # imm = 0xFFD9
xorl %eax, %eax
callq 0x27e637
movl $0xb, (%rbx)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2992c2
callq 0x2949b7
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 0x299333
movq 0x8(%rdi), %rdx
movl %eax, %esi
cmpb %bpl, (%rdx,%rsi)
jne 0x2992f4
movl 0x1(%rdx,%rsi), %eax
bswapl %eax
cmpl %r12d, %eax
je 0x2992b3
movq %rdx, %r14
movq %rsi, %r15
callq 0x280e3a
movl %eax, (%rbx)
testl %eax, %eax
jne 0x2992b3
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 0x2992b3
leaq 0x145fe5(%rip), %rsi    # 0x3df31f
leaq 0x1460ef(%rip), %rdx    # 0x3df430
leaq 0x145e3d(%rip), %r8     # 0x3df185
movl $0xb, %edi
movl $0xffde, %ecx           # imm = 0xFFDE
jmp 0x2992a6