// File: /workspace/github_c_makefile_star2_O3/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 0xa4a4
movq %rdi, %rbx
testl %r15d, %r15d
jle 0xa4ba
cmpl $0x7ffffeff, %r15d      # imm = 0x7FFFFEFF
ja 0xa4c2
movq %rbx, %rdi
callq *0x89fac(%rip)          # 0x94438
movl %eax, %r14d
movl %r15d, %edi
callq *0x89fa8(%rip)          # 0x94440
movl %eax, %edx
subl %r14d, %edx
jne 0xa4d7
movq %rbx, %r13
jmp 0xa4c5
movl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa38c
movq %rbx, %rdi
callq 0xa3c7
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, 0x89f1f(%rip)     # 0x94400
je 0xa5ed
movl %r15d, 0x8b806(%rip)    # 0x95cf4
cmpl %r15d, 0x8b827(%rip)    # 0x95d1c
jge 0xa4fe
movl %r15d, 0x8b81e(%rip)    # 0x95d1c
movl %r14d, -0x2c(%rbp)
movslq 0x8b7d7(%rip), %rsi     # 0x95ce0
movq 0x8b830(%rip), %rax     # 0x95d40
movslq %edx, %rcx
subq %rcx, %rax
cmpq %rsi, %rax
jg 0xa54d
movq 0x8b826(%rip), %r14     # 0x95d48
testq %r14, %r14
je 0xa54d
movq 0x8b822(%rip), %r13     # 0x95d50
movq $0x0, 0x8b80f(%rip) # 0x95d48
movq %r13, %rdi
callq *%r14
movq %r14, 0x8b802(%rip)     # 0x95d48
movq %r13, 0x8b803(%rip)     # 0x95d50
movq %rbx, %rdi
movl %r12d, %esi
callq *0x89ed7(%rip)          # 0x94430
movq %rax, %r13
testq %rax, %rax
sete %al
movq 0x8b7df(%rip), %r14     # 0x95d48
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa5b5
movslq 0x8b763(%rip), %rsi     # 0x95ce0
movq 0x8b7cc(%rip), %r13     # 0x95d50
movq $0x0, 0x8b7b9(%rip) # 0x95d48
movq %r13, %rdi
movl %r15d, %edx
callq *%r14
movq %r14, 0x8b7a9(%rip)     # 0x95d48
movq %r13, 0x8b7aa(%rip)     # 0x95d50
movq %rbx, %rdi
movl %r12d, %esi
callq *0x89e7e(%rip)          # 0x94430
movq %rax, %r13
testq %r13, %r13
je 0xa4c2
movq %r13, %rdi
callq *0x89e71(%rip)          # 0x94438
subl -0x2c(%rbp), %eax
addl 0x8b710(%rip), %eax     # 0x95ce0
movl %eax, 0x8b70a(%rip)     # 0x95ce0
cmpl 0x8b72c(%rip), %eax     # 0x95d08
jle 0xa4c5
movl %eax, 0x8b720(%rip)     # 0x95d08
jmp 0xa4c5
movq 0x89e3c(%rip), %rax     # 0x94430
movq %rbx, %rdi
movl %r12d, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%rax