// File: /workspace/github_cpp_makefile_star2_O3/momohatt[P]seccampDB/database.cpp
// Function: DataBase::recover()
void DataBase::recover() {
    LOG;
    ifstream ifs_log(logfilename_);
    string line;
    vector<string> buf;
    bool in_transaction = false;

    while (getline(ifs_log, line)) {
        if (line == "")
            continue;

       if (line == "{") {
            if (in_transaction) {
                UNREACHABLE;
                return;
            }
            in_transaction = true;
            continue;
        }
        if (line == "}") {
            if (!in_transaction) {
                UNREACHABLE;
                return;
            }
            in_transaction = false;
            continue;
        }

        buf.push_back(line);
    }

    DBDiff diff = {};
    deserialize(diff, buf);
    for (const auto& [key, value] : diff) {
        if (value.first == New) {
            table[key].value = value.second;
        } else {
            table.erase(key);
        }
    }

    ifs_log.close();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rdi, %rbx
leaq 0x6aa5(%rip), %rdi      # 0xc508
leaq 0x6ace(%rip), %rsi      # 0xc538
xorl %r15d, %r15d
movl $0x10a, %edx            # imm = 0x10A
xorl %eax, %eax
callq 0x3060
leaq 0x58(%rbx), %rsi
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x33c0
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r15, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x30(%rsp), %rax
movq $0x0, 0x8(%rsp)
movq %r15, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%rax)
leaq 0x10(%rsp), %r12
leaq 0x6aa1(%rip), %r13      # 0xc567
leaq 0x6a73(%rip), %rbp      # 0xc540
movq 0x90(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3270
movsbl %al, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x3440
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5b7b
movq %r12, %rdi
movq %r13, %rsi
callq 0x30b0
testl %eax, %eax
je 0x5acd
movq %r12, %rdi
movq %rbp, %rsi
callq 0x30b0
testl %eax, %eax
sete %r15b
je 0x5b46
movq %r12, %rdi
leaq 0x6a14(%rip), %rsi      # 0xc542
callq 0x30b0
testl %eax, %eax
je 0x5b5e
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x738c
jmp 0x5acd
testb $0x1, 0x8(%rsp)
movl %r15d, %eax
movq %rax, 0x8(%rsp)
je 0x5acd
jmp 0x5c66
testb $0x1, 0x8(%rsp)
movl %r15d, %eax
movq %rax, 0x8(%rsp)
jne 0x5acd
callq 0x352a
jmp 0x5c21
leaq 0x68(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r15)
xorl %eax, %eax
movq %rax, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
movq %rax, 0x20(%r15)
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x767a
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x5e42
leaq 0x48(%rsp), %rdi
callq 0x3fa6
movq 0x78(%rsp), %r14
cmpq %r15, %r14
je 0x5c0a
leaq 0x20(%r14), %rsi
cmpl $0x0, 0x40(%r14)
je 0x5bec
movq %rbx, %rdi
callq 0x9664
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9718
jmp 0x5bfa
movl 0x44(%r14), %ebp
movq %rbx, %rdi
callq 0x7446
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x31d0
movq %rax, %r14
cmpq %r15, %rax
jne 0x5bcc
leaq 0x90(%rsp), %rdi
callq 0x3080
leaq 0x60(%rsp), %rdi
callq 0x7f56
leaq 0x20(%rsp), %rbx
leaq 0x30(%rsp), %rdi
callq 0x3fa6
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5c47
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x90(%rsp), %rdi
callq 0x3090
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3554
jmp 0x5c21
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3fa6
jmp 0x5c81
jmp 0x5c7e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x7f56
jmp 0x5c90
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3fa6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5cb6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x90(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3410
nop