// File: /workspace/github_c_makefile_star2_O0/barabo[P]advanced-shell-history/src/sqlite3.c
// Function: sqlite3MallocInit
SQLITE_PRIVATE int sqlite3MallocInit(void){
  if( sqlite3GlobalConfig.m.xMalloc==0 ){
    sqlite3MemSetDefault();
  }
  memset(&mem0, 0, sizeof(mem0));
  if( sqlite3GlobalConfig.bCoreMutex ){
    mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100
      && sqlite3GlobalConfig.nScratch>0 ){
    int i, n, sz;
    ScratchFreeslot *pSlot;
    sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);
    sqlite3GlobalConfig.szScratch = sz;
    pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;
    n = sqlite3GlobalConfig.nScratch;
    mem0.pScratchFree = pSlot;
    mem0.nScratchFree = n;
    for(i=0; i<n-1; i++){
      pSlot->pNext = (ScratchFreeslot*)(sz+(char*)pSlot);
      pSlot = pSlot->pNext;
    }
    pSlot->pNext = 0;
    mem0.pScratchEnd = (void*)&pSlot[1];
  }else{
    mem0.pScratchEnd = 0;
    sqlite3GlobalConfig.pScratch = 0;
    sqlite3GlobalConfig.szScratch = 0;
    sqlite3GlobalConfig.nScratch = 0;
  }
  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
      || sqlite3GlobalConfig.nPage<1 ){
    sqlite3GlobalConfig.pPage = 0;
    sqlite3GlobalConfig.szPage = 0;
    sqlite3GlobalConfig.nPage = 0;
  }
  return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
cmpq $0x0, 0xb9400(%rip)     # 0xd04b0
jne 0x170b7
callq 0x17e50
leaq 0xbad9a(%rip), %rdi     # 0xd1e58
xorl %esi, %esi
movl $0x38, %edx
callq 0x8200
cmpl $0x0, 0xb93c3(%rip)     # 0xd0494
je 0x170df
movl $0x8, %eax
movq %rax, 0xbad79(%rip)     # 0xd1e58
cmpq $0x0, 0xb94e1(%rip)     # 0xd05c8
je 0x1719d
cmpl $0x64, 0xb94dc(%rip)    # 0xd05d0
jl 0x1719d
cmpl $0x0, 0xb94d3(%rip)     # 0xd05d4
jle 0x1719d
movl 0xb94c3(%rip), %eax     # 0xd05d0
andl $-0x8, %eax
movl %eax, -0xc(%rbp)
movl -0xc(%rbp), %eax
movl %eax, 0xb94b4(%rip)     # 0xd05d0
movq 0xb94a5(%rip), %rax     # 0xd05c8
movq %rax, -0x18(%rbp)
movl 0xb94a7(%rip), %eax     # 0xd05d4
movl %eax, -0x8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, 0xbad45(%rip)     # 0xd1e80
movl -0x8(%rbp), %eax
movl %eax, 0xbad44(%rip)     # 0xd1e88
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
movl -0x8(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x17181
movl -0xc(%rbp), %eax
movq -0x18(%rbp), %rcx
cltq
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x1714b
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, 0xbacdd(%rip)     # 0xd1e78
jmp 0x171c7
movq $0x0, 0xbacd0(%rip) # 0xd1e78
movq $0x0, 0xb9415(%rip) # 0xd05c8
movl $0x0, 0xb9413(%rip)     # 0xd05d0
movl $0x0, 0xb940d(%rip)     # 0xd05d4
cmpq $0x0, 0xb9409(%rip)     # 0xd05d8
je 0x171e6
cmpl $0x200, 0xb9405(%rip)   # imm = 0x200
jl 0x171e6
cmpl $0x1, 0xb9400(%rip)     # 0xd05e4
jge 0x17205
movq $0x0, 0xb93e7(%rip) # 0xd05d8
movl $0x0, 0xb93e5(%rip)     # 0xd05e0
movl $0x0, 0xb93df(%rip)     # 0xd05e4
movq 0xb92cc(%rip), %rax     # 0xd04d8
movq 0xb92d5(%rip), %rdi     # 0xd04e8
callq *%rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)