// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r15d
testq %rdi, %rdi
je 0x9d58
movq %rdi, %rbx
testl %r15d, %r15d
jle 0x9d6e
cmpl $0x7ffffeff, %r15d      # imm = 0x7FFFFEFF
ja 0x9d76
movq %rbx, %rdi
callq *0x7d6f8(%rip)          # 0x87438
movl %eax, %r14d
movl %r15d, %edi
callq *0x7d6f4(%rip)          # 0x87440
movl %eax, %edi
subl %r14d, %edi
jne 0x9d8b
movq %rbx, %r13
jmp 0x9d79
movl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9c40
movq %rbx, %rdi
callq 0x9c7b
xorl %r13d, %r13d
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %eax, %r12d
cmpl $0x0, 0x7d66b(%rip)     # 0x87400
je 0x9e3d
movl %r15d, 0x7ef52(%rip)    # 0x88cf4
cmpl %r15d, 0x7ef73(%rip)    # 0x88d1c
jge 0x9db2
movl %r15d, 0x7ef6a(%rip)    # 0x88d1c
movslq 0x7ef27(%rip), %rax     # 0x88ce0
movq 0x7ef80(%rip), %rcx     # 0x88d40
movslq %edi, %rdx
subq %rdx, %rcx
cmpq %rax, %rcx
jg 0x9dd0
callq 0x15566
movq %rbx, %rdi
movl %r12d, %esi
callq *0x7d654(%rip)          # 0x87430
movq %rax, %r13
testq %rax, %rax
jne 0x9e05
cmpq $0x0, 0x7ef5c(%rip)     # 0x88d48
je 0x9e05
movl %r15d, %edi
callq 0x15566
movq %rbx, %rdi
movl %r12d, %esi
callq *0x7d62e(%rip)          # 0x87430
movq %rax, %r13
testq %r13, %r13
je 0x9d76
movq %r13, %rdi
callq *0x7d621(%rip)          # 0x87438
subl %r14d, %eax
addl 0x7eec0(%rip), %eax     # 0x88ce0
movl %eax, 0x7eeba(%rip)     # 0x88ce0
cmpl 0x7eedc(%rip), %eax     # 0x88d08
jle 0x9d79
movl %eax, 0x7eed0(%rip)     # 0x88d08
jmp 0x9d79
movq 0x7d5ec(%rip), %rax     # 0x87430
movq %rbx, %rdi
movl %r12d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax