// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3Realloc
SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, int nBytes){
  int nOld, nNew, nDiff;
  void *pNew;
  if( pOld==0 ){
    return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */
  }
  if( nBytes<=0 ){
    sqlite3_free(pOld); /* IMP: R-31593-10574 */
    return 0;
  }
  if( nBytes>=0x7fffff00 ){
    /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */
    return 0;
  }
  nOld = sqlite3MallocSize(pOld);
  /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second
  ** argument to xRealloc is always a value returned by a prior call to
  ** xRoundup. */
  nNew = sqlite3GlobalConfig.m.xRoundup(nBytes);
  if( nOld==nNew ){
    pNew = pOld;
  }else if( sqlite3GlobalConfig.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes);
    nDiff = nNew - nOld;
    if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= 
          mem0.alarmThreshold-nDiff ){
      sqlite3MallocAlarm(nDiff);
    }
    assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) );
    assert( sqlite3MemdebugNoType(pOld, ~MEMTYPE_HEAP) );
    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
    if( pNew==0 && mem0.alarmCallback ){
      sqlite3MallocAlarm(nBytes);
      pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
    }
    if( pNew ){
      nNew = sqlite3MallocSize(pNew);
      sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
    }
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
  }
  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */
  return pNew;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa567
movl -0x14(%rbp), %edi
callq 0xa3c0
movq %rax, -0x8(%rbp)
jmp 0xa691
cmpl $0x0, -0x14(%rbp)
jg 0xa583
movq -0x10(%rbp), %rdi
callq 0xa420
movq $0x0, -0x8(%rbp)
jmp 0xa691
cmpl $0x7fffff00, -0x14(%rbp) # imm = 0x7FFFFF00
jl 0xa599
movq $0x0, -0x8(%rbp)
jmp 0xa691
movq -0x10(%rbp), %rdi
callq 0x9990
movl %eax, -0x18(%rbp)
movq 0xc5f24(%rip), %rax     # 0xd04d0
movl -0x14(%rbp), %edi
callq *%rax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jne 0xa5c9
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0xa689
cmpl $0x0, 0xc5ec0(%rip)     # 0xd0490
je 0xa673
movl -0x14(%rbp), %esi
movl $0x5, %edi
callq 0x1b9e0
movl -0x1c(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, -0x20(%rbp)
xorl %edi, %edi
callq 0x1b8f0
cltq
movq 0xc7864(%rip), %rcx     # 0xd1e60
movslq -0x20(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jl 0xa610
movl -0x20(%rbp), %edi
callq 0x1ba40
movq 0xc5ea9(%rip), %rax     # 0xd04c0
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq *%rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xa651
cmpq $0x0, 0xc7835(%rip)     # 0xd1e68
je 0xa651
movl -0x14(%rbp), %edi
callq 0x1ba40
movq 0xc5e7c(%rip), %rax     # 0xd04c0
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq *%rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa671
movq -0x28(%rbp), %rdi
callq 0x9990
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
subl -0x18(%rbp), %esi
xorl %edi, %edi
callq 0xa490
jmp 0xa687
movq 0xc5e46(%rip), %rax     # 0xd04c0
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq *%rax
movq %rax, -0x28(%rbp)
jmp 0xa689
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)