// File: /workspace/github_cpp_makefile_star2_O1/SunriseFox[P]very-simple-c-compiler/./src/asm.cpp
// Function: getRegNum(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int getRegNum(const string& reg) {

    if (reg.size() > 0 && reg.at(0) != '%')
        return -1;

    string tmp;
    if (reg.find("ax") != string::npos || reg.find("al") != string::npos) return 0;
    if (reg.find("bx") != string::npos || reg.find("bl") != string::npos) return 1;
    if (reg.find("cx") != string::npos || reg.find("cl") != string::npos) return 2;
    if (reg.find("dx") != string::npos || reg.find("dl") != string::npos) return 3;

    if (reg.find("si") != string::npos) return 4;
    if (reg.find("di") != string::npos) return 5;

    if (reg.find("8") != string::npos) return 6;
    if (reg.find("9") != string::npos) return 7;
    if (reg.find("10") != string::npos) return 8;
    if (reg.find("11") != string::npos) return 9;
    if (reg.find("12") != string::npos) return 10;
    if (reg.find("13") != string::npos) return 11;
    if (reg.find("14") != string::npos) return 12;
    if (reg.find("15") != string::npos) return 13;

    cerr << "unknown reg" << endl;
    throw 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x3baa
movq (%rbx), %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpb $0x25, (%rax)
jne 0x3e59
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x9634(%rip), %rsi      # 0xd1fa
xorl %r14d, %r14d
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x95bc(%rip), %rsi      # 0xd1a5
xorl %r14d, %r14d
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x95f3(%rip), %rsi      # 0xd1ff
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x1, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9577(%rip), %rsi      # 0xd1a9
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x95b2(%rip), %rsi      # 0xd204
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x2, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9535(%rip), %rsi      # 0xd1ad
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9571(%rip), %rsi      # 0xd209
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x3, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x94f3(%rip), %rsi      # 0xd1b1
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9530(%rip), %rsi      # 0xd20e
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x4, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x950f(%rip), %rsi      # 0xd213
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x5, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x953a(%rip), %rsi      # 0xd264
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x6, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9518(%rip), %rsi      # 0xd268
movl $0x1, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x7, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x94f6(%rip), %rsi      # 0xd26c
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x8, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x94d5(%rip), %rsi      # 0xd271
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0x9, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x94b4(%rip), %rsi      # 0xd276
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0xa, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x9497(%rip), %rsi      # 0xd27b
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0xb, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x947a(%rip), %rsi      # 0xd280
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0xc, %r14d
cmpq $-0x1, %rax
jne 0x3e43
leaq 0x945d(%rip), %rsi      # 0xd285
movl $0x2, %ecx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x33b0
movl $0xd, %r14d
cmpq $-0x1, %rax
je 0x3e66
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3e59
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
movl %r14d, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq 0xf183(%rip), %rdi      # 0x12ff0
leaq 0x942f(%rip), %rsi      # 0xd2a3
movl $0xb, %edx
callq 0x3260
movq 0xf16b(%rip), %rdi      # 0x12ff0
callq 0x3100
movl $0x4, %edi
callq 0x3110
movl $0x0, (%rax)
movq 0xf0f7(%rip), %rsi      # 0x12f98
movq %rax, %rdi
xorl %edx, %edx
callq 0x3390
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x3ec4
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3200
movq %rbx, %rdi
callq 0x33d0