// File: Lartu[P]coraldb/source/checkpoint.cpp
// Function: load_checkpoint()
void load_checkpoint()
{
    size_t loaded = 0;
    std::string line;
    std::ifstream checkpoint_file(global_filename);
    std::cout << "CoralDB: Attempting to load checkpoint file " << global_filename << std::endl;
    std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
    while (std::getline(checkpoint_file, line))
    {
        if (execute_command(line, 0) == 0)
        {
            ++loaded;
        }
        else
        {
            err_malformed_command_load(line);
        }
    }
    std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
    std::cout << "CoralDB: Executed " << loaded << " startup commands in " << std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() << " ms" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2c0, %rsp            # imm = 0x2C0
movq $0x0, -0x8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3430
leaq 0xc50d(%rip), %rsi      # 0x113b0
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x34b0
jmp 0x4eb6
movq 0xc10b(%rip), %rdi      # 0x10fc8
leaq 0x630a(%rip), %rsi      # 0xb1ce
callq 0x3300
movq %rax, -0x268(%rbp)
jmp 0x4ed2
movq -0x268(%rbp), %rdi
leaq 0xc4d0(%rip), %rsi      # 0x113b0
callq 0x32a0
movq %rax, -0x270(%rbp)
jmp 0x4eee
movq -0x270(%rbp), %rdi
movq 0xc0ac(%rip), %rsi      # 0x10fa8
callq 0x3320
jmp 0x4f03
callq 0x33e0
movq %rax, -0x248(%rbp)
leaq -0x230(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3080
movq %rax, -0x278(%rbp)
jmp 0x4f28
movq -0x278(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33a0
movb %al, -0x279(%rbp)
jmp 0x4f46
movb -0x279(%rbp), %al
testb $0x1, %al
jne 0x4f52
jmp 0x4fca
leaq -0x28(%rbp), %rdi
xorl %esi, %esi
callq 0x3ca0
movl %eax, -0x280(%rbp)
jmp 0x4f65
movl -0x280(%rbp), %eax
cmpl $0x0, %eax
jne 0x4fb8
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x4fc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x50f4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x30c0
jmp 0x50f4
leaq -0x28(%rbp), %rdi
callq 0x3a50
jmp 0x4fc3
jmp 0x4fc5
jmp 0x4f0f
callq 0x33e0
movq %rax, -0x250(%rbp)
movq 0xbfeb(%rip), %rdi      # 0x10fc8
leaq 0x6217(%rip), %rsi      # 0xb1fb
callq 0x3300
movq %rax, -0x288(%rbp)
jmp 0x4ff2
movq -0x288(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x30a0
movq %rax, -0x290(%rbp)
jmp 0x500b
movq -0x290(%rbp), %rdi
leaq 0x61f5(%rip), %rsi      # 0xb20e
callq 0x3300
movq %rax, -0x298(%rbp)
jmp 0x5027
leaq -0x250(%rbp), %rdi
leaq -0x248(%rbp), %rsi
callq 0x6450
movq %rax, -0x2a0(%rbp)
jmp 0x5043
movq -0x2a0(%rbp), %rax
movq %rax, -0x260(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x6420
movq %rax, -0x2a8(%rbp)
jmp 0x5066
movq -0x2a8(%rbp), %rax
movq %rax, -0x258(%rbp)
leaq -0x258(%rbp), %rdi
callq 0x64a0
movq %rax, -0x2b0(%rbp)
jmp 0x5089
movq -0x2b0(%rbp), %rsi
movq -0x298(%rbp), %rdi
callq 0x3530
movq %rax, -0x2b8(%rbp)
jmp 0x50a5
movq -0x2b8(%rbp), %rdi
leaq 0x6171(%rip), %rsi      # 0xb224
callq 0x3300
movq %rax, -0x2c0(%rbp)
jmp 0x50c1
movq -0x2c0(%rbp), %rdi
movq 0xbed9(%rip), %rsi      # 0x10fa8
callq 0x3320
jmp 0x50d6
leaq -0x230(%rbp), %rdi
callq 0x30c0
leaq -0x28(%rbp), %rdi
callq 0x3578
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
leaq -0x28(%rbp), %rdi
callq 0x3578
movq -0x238(%rbp), %rdi
callq 0x3500
nopl (%rax)