// File: /workspace/github_cpp_makefile_star2_O2/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 0x6323(%rip), %rdi      # 0xb528
leaq 0x634c(%rip), %rsi      # 0xb558
movl $0x0, 0xc(%rsp)
movl $0x10a, %edx            # imm = 0x10A
xorl %eax, %eax
callq 0x3050
leaq 0x58(%rbx), %rsi
leaq 0x90(%rsp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x33c0
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, (%r15)
andq $0x0, 0x10(%r15)
leaq 0x40(%rsp), %r12
leaq 0x6322(%rip), %r13      # 0xb587
movq %r14, %rdi
movq %r12, %rsi
callq 0x3070
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x5307
movq %r12, %rdi
movq %r13, %rsi
callq 0x3bf1
testb %al, %al
jne 0x5265
movq %r12, %rdi
leaq 0x62c5(%rip), %rsi      # 0xb560
callq 0x3bf1
movl %eax, %ebp
testb %al, %al
jne 0x52c6
movq %r12, %rdi
leaq 0x62b2(%rip), %rsi      # 0xb562
callq 0x3bf1
testb %al, %al
jne 0x52d8
movq %r15, %rdi
movq %r12, %rsi
callq 0x6094
jmp 0x5265
testb $0x1, 0xc(%rsp)
movl %ebp, %eax
movl %eax, 0xc(%rsp)
je 0x5265
jmp 0x53d2
testb $0x1, 0xc(%rsp)
movl %ebp, %eax
movl %eax, 0xc(%rsp)
jne 0x5265
movq 0xcce4(%rip), %rax      # 0x11fd0
movq (%rax), %rdi
leaq 0x6202(%rip), %rsi      # 0xb4f8
leaq 0x625b(%rip), %rdx      # 0xb558
movl $0x11e, %ecx            # imm = 0x11E
jmp 0x53ef
leaq 0x68(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r15)
andq $0x0, 0x8(%r15)
movq %r15, 0x10(%r15)
movq %r15, 0x18(%r15)
andq $0x0, 0x20(%r15)
leaq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x6364
leaq 0x60(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x5546
leaq 0x28(%rsp), %rdi
callq 0x3ba2
movq 0x78(%rsp), %r14
cmpq %r15, %r14
je 0x5388
leaq 0x20(%r14), %rsi
cmpl $0x0, 0x40(%r14)
je 0x536d
movq %rbx, %rdi
callq 0x8478
jmp 0x537b
movl 0x44(%r14), %ebp
movq %rbx, %rdi
callq 0x6140
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x31d0
movq %rax, %r14
jmp 0x5353
leaq 0x90(%rsp), %rdi
callq 0x3080
leaq 0x60(%rsp), %rdi
callq 0x6cce
leaq 0x10(%rsp), %rdi
callq 0x3ba2
leaq 0x40(%rsp), %rdi
callq 0x3498
leaq 0x90(%rsp), %rdi
callq 0x3090
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xcbf7(%rip), %rax      # 0x11fd0
movq (%rax), %rdi
leaq 0x6115(%rip), %rsi      # 0xb4f8
leaq 0x616e(%rip), %rdx      # 0xb558
movl $0x116, %ecx            # imm = 0x116
xorl %eax, %eax
callq 0x3350
jmp 0x539f
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3ba2
jmp 0x540c
jmp 0x5409
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x6cce
jmp 0x541b
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3ba2
leaq 0x40(%rsp), %rdi
callq 0x3498
leaq 0x90(%rsp), %rdi
callq 0x3090
movq %rbx, %rdi
callq 0x3410