// File: /workspace/github_cpp_makefile_star2_O1/momohatt[P]seccampDB/database.cpp
// Function: Transaction::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
optional<int> Transaction::get(Key key) {
    TXLOG;

    if (!has_key(key)) {
        wait();
        return nullopt;
    }

    // read from the write set
    if (write_set.count(key) > 0) {
        if (write_set[key].first != New) {
            UNREACHABLE;
            return nullopt;
        }
        // db_->get_lock(this, key, DataBase::Read);
        wait();
        scheduler_->log(id_, key, Read);
        return write_set[key].second;
    }

    while (!db_->get_lock(this, key, Read)) {
        wait();
    }
    lock_set.push_back(key);
    wait();
    scheduler_->log(id_, key, Read);
    return db_->table[key].value;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movl 0x74(%rdi), %esi
leaq 0x7ae1(%rip), %rdi      # 0xc4c0
leaq 0x7659(%rip), %rdx      # 0xc03f
movl $0x43, %ecx
xorl %eax, %eax
callq 0x3060
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x68(%rsp), %r15
movq %r15, %rdi
callq 0x840a
movq %r14, %rdi
movq %r15, %rsi
callq 0x4c56
movl %eax, %ebp
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x4a36
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x32a0
testb %bpl, %bpl
je 0x4af3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8ada
leaq 0x8(%r14), %rcx
cmpq %rcx, %rax
je 0x4b03
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7428
cmpl $0x0, (%rax)
jne 0x4c0c
movq %r14, %rdi
callq 0x438e
movl 0x74(%r14), %ebp
leaq 0x58(%rsp), %r13
movl $0x98, %r15d
addq 0xe0(%r14), %r15
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x840a
leaq 0x4(%rsp), %rsi
movl %ebp, (%rsi)
movq %rsp, %rcx
movl $0x0, (%rcx)
movq %r15, %rdi
movq %r12, %rdx
callq 0x7a72
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x4ad6
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x32a0
movabsq $0x100000000, %r15      # imm = 0x100000000
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7428
movl 0x4(%rax), %eax
jmp 0x4bf5
movq %r14, %rdi
callq 0x438e
xorl %r15d, %r15d
jmp 0x4bf5
leaq 0x18(%rsp), %r13
leaq 0x8(%rsp), %r15
movq 0xd8(%r14), %r12
movq %r13, 0x8(%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x840a
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x4836
movl %eax, %ebp
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4b54
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32a0
testb %bpl, %bpl
jne 0x4b63
movq %r14, %rdi
callq 0x438e
jmp 0x4b0d
leaq 0x30(%r14), %rdi
movq %rbx, %rsi
callq 0x73ea
movq %r14, %rdi
callq 0x438e
movl 0x74(%r14), %ebp
leaq 0x38(%rsp), %r13
movl $0x98, %r15d
addq 0xe0(%r14), %r15
movq %r13, -0x10(%r13)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x840a
leaq 0x4(%rsp), %rsi
movl %ebp, (%rsi)
movq %rsp, %rcx
movl $0x0, (%rcx)
movq %r15, %rdi
movq %r12, %rdx
callq 0x7a72
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x4bda
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x32a0
movabsq $0x100000000, %r15      # imm = 0x100000000
movq 0xd8(%r14), %rdi
movq %rbx, %rsi
callq 0x74a4
movl (%rax), %eax
movl %eax, %eax
orq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x34d5
jmp 0x4afb
movq %rax, %rbx
movq 0x28(%rsp), %rdi
jmp 0x4c3c
movq %rax, %rbx
movq 0x48(%rsp), %rdi
jmp 0x4c3c
movq %rax, %rbx
movq 0x68(%rsp), %rdi
jmp 0x4c3c
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x4c4d
movq (%r13), %rsi
incq %rsi
callq 0x32a0
movq %rbx, %rdi
callq 0x3410
nop