// File: momohatt[P]seccampDB/utils.cpp
// Function: parse_query(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Query parse_query(string input) {
    Query q = Query();
    vector<string> fields = words(input);

    if (fields[0] == "set") {
        assert(fields.size() == 3);
        q.cmd = Query::Set;
        q.arg1 = fields[1];
        q.arg2 = stoi(fields[2]);
    } else if (fields[0] == "get") {
        assert(fields.size() == 2);
        q.cmd = Query::Get;
        q.arg1 = fields[1];
    } else if (fields[0] == "del") {
        assert(fields.size() == 2);
        q.cmd = Query::Del;
        q.arg1 = fields[1];
    } else if (fields[0] == "begin") {
        assert(fields.size() == 1);
        q.cmd = Query::Begin;
    } else if (fields[0] == "commit") {
        assert(fields.size() == 1);
        q.cmd = Query::Commit;
    } else if (fields[0] == "abort") {
        assert(fields.size() == 2);
        q.cmd = Query::Abort;
    } else if (fields[0] == "keys") {
        assert(fields.size() == 1);
        q.cmd = Query::Keys;
    } else {
        q.cmd = Query::Unknown;
    }
    return q;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rsi, -0x48(%rbp)
movq %rdi, -0x58(%rbp)
movq %rdi, %rax
movq %rax, -0x50(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movb $0x0, -0x11(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
callq 0x4240
movq -0x48(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x39b0
jmp 0x3cf5
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x182f8(%rip), %rsi     # 0x1c004
callq 0x42c0
movb %al, -0x59(%rbp)
jmp 0x3d16
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x3d22
jmp 0x3dda
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x3, %rax
jne 0x3d33
jmp 0x3d7d
leaq 0x182ce(%rip), %rdi     # 0x1c008
leaq 0x182da(%rip), %rsi     # 0x1c01b
movl $0x31, %edx
leaq 0x182d8(%rip), %rcx     # 0x1c025
callq 0x3200
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x40c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41e0
jmp 0x40c6
movq -0x58(%rbp), %rax
movl $0x0, (%rax)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x42f0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rdi
callq 0x3050
jmp 0x3da7
leaq -0x30(%rbp), %rdi
movl $0x2, %esi
callq 0x42f0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x4330
movl %eax, -0x60(%rbp)
jmp 0x3dcb
movq -0x58(%rbp), %rax
movl -0x60(%rbp), %ecx
movl %ecx, 0x28(%rax)
jmp 0x40a0
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x1824e(%rip), %rsi     # 0x1c03f
callq 0x42c0
movb %al, -0x61(%rbp)
jmp 0x3dfb
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x3e04
jmp 0x3e63
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x2, %rax
jne 0x3e15
jmp 0x3e34
leaq 0x18227(%rip), %rdi     # 0x1c043
leaq 0x181f8(%rip), %rsi     # 0x1c01b
movl $0x36, %edx
leaq 0x181f6(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x1, (%rax)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x42f0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rdi
callq 0x3050
jmp 0x3e5e
jmp 0x409e
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x181dc(%rip), %rsi     # 0x1c056
callq 0x42c0
movb %al, -0x62(%rbp)
jmp 0x3e84
movb -0x62(%rbp), %al
testb $0x1, %al
jne 0x3e8d
jmp 0x3eec
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x2, %rax
jne 0x3e9e
jmp 0x3ebd
leaq 0x1819e(%rip), %rdi     # 0x1c043
leaq 0x1816f(%rip), %rsi     # 0x1c01b
movl $0x3a, %edx
leaq 0x1816d(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x2, (%rax)
leaq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x42f0
movq -0x58(%rbp), %rdi
movq %rax, %rsi
addq $0x8, %rdi
callq 0x3050
jmp 0x3ee7
jmp 0x409c
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x18157(%rip), %rsi     # 0x1c05a
callq 0x42c0
movb %al, -0x63(%rbp)
jmp 0x3f0d
movb -0x63(%rbp), %al
testb $0x1, %al
jne 0x3f16
jmp 0x3f55
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x1, %rax
jne 0x3f27
jmp 0x3f46
leaq 0x18132(%rip), %rdi     # 0x1c060
leaq 0x180e6(%rip), %rsi     # 0x1c01b
movl $0x3e, %edx
leaq 0x180e4(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x3, (%rax)
jmp 0x409a
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x18107(%rip), %rsi     # 0x1c073
callq 0x42c0
movb %al, -0x64(%rbp)
jmp 0x3f76
movb -0x64(%rbp), %al
testb $0x1, %al
jne 0x3f7f
jmp 0x3fbe
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x1, %rax
jne 0x3f90
jmp 0x3faf
leaq 0x180c9(%rip), %rdi     # 0x1c060
leaq 0x1807d(%rip), %rsi     # 0x1c01b
movl $0x41, %edx
leaq 0x1807b(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x4, (%rax)
jmp 0x4098
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x180a5(%rip), %rsi     # 0x1c07a
callq 0x42c0
movb %al, -0x65(%rbp)
jmp 0x3fdf
movb -0x65(%rbp), %al
testb $0x1, %al
jne 0x3fe8
jmp 0x4024
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x2, %rax
jne 0x3ff9
jmp 0x4018
leaq 0x18043(%rip), %rdi     # 0x1c043
leaq 0x18014(%rip), %rsi     # 0x1c01b
movl $0x44, %edx
leaq 0x18012(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x5, (%rax)
jmp 0x4096
xorl %eax, %eax
movl %eax, %esi
leaq -0x30(%rbp), %rdi
callq 0x42f0
movq %rax, %rdi
leaq 0x18045(%rip), %rsi     # 0x1c080
callq 0x42c0
movb %al, -0x66(%rbp)
jmp 0x4045
movb -0x66(%rbp), %al
testb $0x1, %al
jne 0x404e
jmp 0x408a
leaq -0x30(%rbp), %rdi
callq 0x4310
cmpq $0x1, %rax
jne 0x405f
jmp 0x407e
leaq 0x17ffa(%rip), %rdi     # 0x1c060
leaq 0x17fae(%rip), %rsi     # 0x1c01b
movl $0x47, %edx
leaq 0x17fac(%rip), %rcx     # 0x1c025
callq 0x3200
movq -0x58(%rbp), %rax
movl $0x6, (%rax)
jmp 0x4094
movq -0x58(%rbp), %rax
movl $0x7, (%rax)
jmp 0x4096
jmp 0x4098
jmp 0x409a
jmp 0x409c
jmp 0x409e
jmp 0x40a0
movb $0x1, -0x11(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x41e0
testb $0x1, -0x11(%rbp)
jne 0x40bc
movq -0x58(%rbp), %rdi
callq 0x4370
movq -0x50(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x4370
movq -0x38(%rbp), %rdi
callq 0x3540
nopl (%rax,%rax)