// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: pager_unlock
static void pager_unlock(Pager *pPager){

  assert( pPager->eState==PAGER_READER 
       || pPager->eState==PAGER_OPEN 
       || pPager->eState==PAGER_ERROR 
  );

  sqlite3BitvecDestroy(pPager->pInJournal);
  pPager->pInJournal = 0;
  releaseAllSavepoints(pPager);

  if( pagerUseWal(pPager) ){
    assert( !isOpen(pPager->jfd) );
    sqlite3WalEndReadTransaction(pPager->pWal);
    pPager->eState = PAGER_OPEN;
  }else if( !pPager->exclusiveMode ){
    int rc;                       /* Error code returned by pagerUnlockDb() */
    int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0;

    /* If the operating system support deletion of open files, then
    ** close the journal file when dropping the database lock.  Otherwise
    ** another connection with journal_mode=delete might delete the file
    ** out from under us.
    */
    assert( (PAGER_JOURNALMODE_MEMORY   & 5)!=1 );
    assert( (PAGER_JOURNALMODE_OFF      & 5)!=1 );
    assert( (PAGER_JOURNALMODE_WAL      & 5)!=1 );
    assert( (PAGER_JOURNALMODE_DELETE   & 5)!=1 );
    assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 );
    assert( (PAGER_JOURNALMODE_PERSIST  & 5)==1 );
    if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN)
     || 1!=(pPager->journalMode & 5)
    ){
      sqlite3OsClose(pPager->jfd);
    }

    /* If the pager is in the ERROR state and the call to unlock the database
    ** file fails, set the current lock to UNKNOWN_LOCK. See the comment
    ** above the #define for UNKNOWN_LOCK for an explanation of why this
    ** is necessary.
    */
    rc = pagerUnlockDb(pPager, NO_LOCK);
    if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){
      pPager->eLock = UNKNOWN_LOCK;
    }

    /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here
    ** without clearing the error code. This is intentional - the error
    ** code is cleared and the cache reset in the block below.
    */
    assert( pPager->errCode || pPager->eState!=PAGER_ERROR );
    pPager->changeCountDone = 0;
    pPager->eState = PAGER_OPEN;
  }

  /* If Pager.errCode is set, the contents of the pager cache cannot be
  ** trusted. Now that there are no outstanding references to the pager,
  ** it can safely move back to PAGER_OPEN state. This happens in both
  ** normal and exclusive-locking mode.
  */
  if( pPager->errCode ){
    assert( !MEMDB );
    pager_reset(pPager);
    pPager->changeCountDone = pPager->tempFile;
    pPager->eState = PAGER_OPEN;
    pPager->errCode = SQLITE_OK;
    if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0);
  }

  pPager->journalOff = 0;
  pPager->journalHdr = 0;
  pPager->setMaster = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rdi
callq 0x26630
movq -0x8(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x8(%rbp), %rdi
callq 0x26690
movq -0x8(%rbp), %rdi
callq 0x211a0
cmpl $0x0, %eax
je 0x25519
movq -0x8(%rbp), %rax
movq 0x118(%rax), %rdi
callq 0x26740
movq -0x8(%rbp), %rax
movb $0x0, 0x13(%rax)
jmp 0x255bf
movq -0x8(%rbp), %rax
cmpb $0x0, 0x8(%rax)
jne 0x255bd
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
cmpq $0x0, (%rax)
je 0x25547
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0x210d0
movl %eax, -0x14(%rbp)
jmp 0x2554e
xorl %eax, %eax
movl %eax, -0x14(%rbp)
jmp 0x2554e
movl -0x14(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %ecx
andl $0x800, %ecx            # imm = 0x800
xorl %eax, %eax
cmpl %ecx, %eax
je 0x25577
movq -0x8(%rbp), %rax
movzbl 0x9(%rax), %ecx
andl $0x5, %ecx
movl $0x1, %eax
cmpl %ecx, %eax
je 0x25584
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rdi
callq 0x20ea0
movq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x26790
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
je 0x255ad
movq -0x8(%rbp), %rax
movzbl 0x13(%rax), %eax
cmpl $0x6, %eax
jne 0x255ad
movq -0x8(%rbp), %rax
movb $0x5, 0x14(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x15(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x13(%rax)
jmp 0x255bf
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
je 0x25616
movq -0x8(%rbp), %rdi
callq 0x24fc0
movq -0x8(%rbp), %rax
movb 0x10(%rax), %cl
movq -0x8(%rbp), %rax
movb %cl, 0x15(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x13(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x2c(%rax)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x94(%rax)
je 0x25614
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x25a70
jmp 0x25616
movq -0x8(%rbp), %rax
movq $0x0, 0x60(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x68(%rax)
movq -0x8(%rbp), %rax
movb $0x0, 0x16(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)