// File: /workspace/github_cpp_makefile_star2_O1/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 0x6a9b(%rip), %rdi      # 0xc508
leaq 0x6ac4(%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 0x6a97(%rip), %r13      # 0xc567
leaq 0x6a69(%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 0x5b85
movq %r12, %rdi
movq %r13, %rsi
callq 0x30b0
testl %eax, %eax
je 0x5ad7
movq %r12, %rdi
movq %rbp, %rsi
callq 0x30b0
testl %eax, %eax
sete %r15b
je 0x5b50
movq %r12, %rdi
leaq 0x6a0a(%rip), %rsi      # 0xc542
callq 0x30b0
testl %eax, %eax
je 0x5b68
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x73ea
jmp 0x5ad7
testb $0x1, 0x8(%rsp)
movl %r15d, %eax
movq %rax, 0x8(%rsp)
je 0x5ad7
jmp 0x5c78
testb $0x1, 0x8(%rsp)
movl %r15d, %eax
movq %rax, 0x8(%rsp)
jne 0x5ad7
callq 0x352a
jmp 0x5c33
leaq 0x68(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0x8(%r15)
movaps %xmm0, 0x18(%r15)
movaps %xmm0, -0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
movq $0x0, 0x20(%r15)
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x76e6
leaq 0x60(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x5e54
leaq 0x48(%rsp), %rdi
callq 0x3fa8
movq 0x78(%rsp), %r14
cmpq %r15, %r14
je 0x5c1c
leaq 0x20(%r14), %rsi
cmpl $0x0, 0x40(%r14)
je 0x5bfe
movq %rbx, %rdi
callq 0x9716
movq %rbx, %rdi
movq %rax, %rsi
callq 0x97be
jmp 0x5c0c
movl 0x44(%r14), %ebp
movq %rbx, %rdi
callq 0x74a4
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x31d0
movq %rax, %r14
cmpq %r15, %rax
jne 0x5bde
leaq 0x90(%rsp), %rdi
callq 0x3080
leaq 0x60(%rsp), %rdi
callq 0x7fc6
leaq 0x20(%rsp), %rbx
leaq 0x30(%rsp), %rdi
callq 0x3fa8
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
je 0x5c59
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 0x5c33
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x3fa8
jmp 0x5c93
jmp 0x5c90
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x7fc6
jmp 0x5ca2
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x3fa8
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5cc8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x32a0
leaq 0x90(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3410
nop