// File: /workspace/github_c_makefile_star2_O1/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 0xa3c5
movq %rdi, %rbx
testl %r15d, %r15d
jle 0xa3db
cmpl $0x7ffffeff, %r15d      # imm = 0x7FFFFEFF
jg 0xa3e3
movq %rbx, %rdi
callq *0x8a08b(%rip)          # 0x94438
movl %eax, %r14d
movl %r15d, %edi
callq *0x8a087(%rip)          # 0x94440
movl %eax, %edx
subl %r14d, %edx
jne 0xa3f8
movq %rbx, %r13
jmp 0xa3e6
movl %r15d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa2a2
movq %rbx, %rdi
callq 0xa2e8
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, 0x89ffe(%rip)     # 0x94400
je 0xa50e
movl %r15d, 0x8b8e5(%rip)    # 0x95cf4
cmpl %r15d, 0x8b906(%rip)    # 0x95d1c
jge 0xa41f
movl %r15d, 0x8b8fd(%rip)    # 0x95d1c
movl %r14d, -0x2c(%rbp)
movslq 0x8b8b6(%rip), %rsi     # 0x95ce0
movq 0x8b90f(%rip), %rax     # 0x95d40
movslq %edx, %rcx
subq %rcx, %rax
cmpq %rsi, %rax
jg 0xa46e
movq 0x8b905(%rip), %r14     # 0x95d48
testq %r14, %r14
je 0xa46e
movq 0x8b901(%rip), %r13     # 0x95d50
movq $0x0, 0x8b8ee(%rip) # 0x95d48
movq %r13, %rdi
callq *%r14
movq %r14, 0x8b8e1(%rip)     # 0x95d48
movq %r13, 0x8b8e2(%rip)     # 0x95d50
movq %rbx, %rdi
movl %r12d, %esi
callq *0x89fb6(%rip)          # 0x94430
movq %rax, %r13
testq %rax, %rax
sete %al
movq 0x8b8be(%rip), %r14     # 0x95d48
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xa4d6
movslq 0x8b842(%rip), %rsi     # 0x95ce0
movq 0x8b8ab(%rip), %r13     # 0x95d50
movq $0x0, 0x8b898(%rip) # 0x95d48
movq %r13, %rdi
movl %r15d, %edx
callq *%r14
movq %r14, 0x8b888(%rip)     # 0x95d48
movq %r13, 0x8b889(%rip)     # 0x95d50
movq %rbx, %rdi
movl %r12d, %esi
callq *0x89f5d(%rip)          # 0x94430
movq %rax, %r13
testq %r13, %r13
je 0xa3e3
movq %r13, %rdi
callq *0x89f50(%rip)          # 0x94438
subl -0x2c(%rbp), %eax
addl 0x8b7ef(%rip), %eax     # 0x95ce0
movl %eax, 0x8b7e9(%rip)     # 0x95ce0
cmpl 0x8b80b(%rip), %eax     # 0x95d08
jle 0xa3e6
movl %eax, 0x8b7ff(%rip)     # 0x95d08
jmp 0xa3e6
movq 0x89f1b(%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