// File: /workspace/github_cpp_makefile_star2_O2/devaigergely81[P]flex-bison-example/code_generator_implementation.cc
// Function: operator_code(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string operator_code(std::string op) {
    std::stringstream ss;
    if(op == "+") {
        ss << "add eax,ecx" << std::endl;
    } else if(op == "-") {
        ss << "sub eax,ecx" << std::endl;
    } else if(op == "*") {
        ss << "xor edx,edx" << std::endl;
        ss << "mul ecx" << std::endl;
    } else if(op == "/") {
        ss << "xor edx,edx" << std::endl;
        ss << "div ecx" << std::endl;   
    } else if(op == "%") {
        ss << "xor edx,edx" << std::endl;
        ss << "div ecx" << std::endl;
        ss << "mov eax,edx" << std::endl;
    } else if(op == "<") {
        ss << "cmp eax,ecx" << std::endl;
        ss << "mov al,0" << std::endl;
        ss << "mov cx,1" << std::endl;
        ss << "cmovb ax,cx" << std::endl;
    } else if(op == "<=") {
        ss << "cmp eax,ecx" << std::endl;
        ss << "mov al,0" << std::endl;
        ss << "mov cx,1" << std::endl;
        ss << "cmovbe ax,cx" << std::endl;
    } else if(op == ">") {
        ss << "cmp eax,ecx" << std::endl;
        ss << "mov al,0" << std::endl;
        ss << "mov cx,1" << std::endl;
        ss << "cmova ax,cx" << std::endl;
    } else if(op == ">=") {
        ss << "cmp eax,ecx" << std::endl;
        ss << "mov al,0" << std::endl;
        ss << "mov cx,1" << std::endl;
        ss << "cmovae ax,cx" << std::endl;
    } else if(op == "and") {
        ss << "cmp al,1" << std::endl;
        ss << "cmove ax,cx" << std::endl;
    } else if(op == "or") {
        ss << "cmp al,0" << std::endl;
        ss << "cmove ax,cx" << std::endl;
    } else {
        error(-1, std::string("Bug: Unsupported binary operator: ") + op);
    }
    return ss.str();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1d0, %rsp            # imm = 0x1D0
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x3170
leaq 0x29e5(%rip), %rsi      # 0xae01
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8431
leaq 0x2cc1(%rip), %rsi      # 0xb0f0
jmp 0x844b
leaq 0x29cb(%rip), %rsi      # 0xae03
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x848c
leaq 0x2cb1(%rip), %rsi      # 0xb0fc
leaq -0x1d0(%rbp), %r14
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq -0x1c8(%rbp), %rsi
movq %rbx, %rdi
callq 0x3300
leaq -0x1e0(%rbp), %rdi
callq 0x3190
movq %rbx, %rax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2972(%rip), %rsi      # 0xae05
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x84c6
leaq -0x1d0(%rbp), %r14
leaq 0x2c5b(%rip), %rsi      # 0xb108
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2c50(%rip), %rsi      # 0xb114
jmp 0x8452
leaq 0x293a(%rip), %rsi      # 0xae07
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8503
leaq -0x1d0(%rbp), %r14
leaq 0x2c21(%rip), %rsi      # 0xb108
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2c1e(%rip), %rsi      # 0xb11c
jmp 0x8452
leaq 0x28ff(%rip), %rsi      # 0xae09
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8557
leaq -0x1d0(%rbp), %r14
leaq 0x2be4(%rip), %rsi      # 0xb108
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2be1(%rip), %rsi      # 0xb11c
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2bd2(%rip), %rsi      # 0xb124
jmp 0x8452
leaq 0x28ad(%rip), %rsi      # 0xae0b
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x85c2
leaq -0x1d0(%rbp), %r14
leaq 0x2bb8(%rip), %rsi      # 0xb130
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2bad(%rip), %rsi      # 0xb13c
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2b9f(%rip), %rsi      # 0xb145
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2b91(%rip), %rsi      # 0xb14e
jmp 0x8452
leaq 0x2846(%rip), %rsi      # 0xae0f
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x862d
leaq -0x1d0(%rbp), %r14
leaq 0x2b4d(%rip), %rsi      # 0xb130
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2b42(%rip), %rsi      # 0xb13c
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2b34(%rip), %rsi      # 0xb145
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2b32(%rip), %rsi      # 0xb15a
jmp 0x8452
leaq 0x27d9(%rip), %rsi      # 0xae0d
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8698
leaq -0x1d0(%rbp), %r14
leaq 0x2ae2(%rip), %rsi      # 0xb130
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2ad7(%rip), %rsi      # 0xb13c
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2ac9(%rip), %rsi      # 0xb145
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2ad4(%rip), %rsi      # 0xb167
jmp 0x8452
leaq 0x2773(%rip), %rsi      # 0xae12
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8703
leaq -0x1d0(%rbp), %r14
leaq 0x2a77(%rip), %rsi      # 0xb130
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2a6c(%rip), %rsi      # 0xb13c
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2a5e(%rip), %rsi      # 0xb145
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2a75(%rip), %rsi      # 0xb173
jmp 0x8452
leaq 0x270b(%rip), %rsi      # 0xae15
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8736
leaq -0x1d0(%rbp), %r14
leaq 0x2a5c(%rip), %rsi      # 0xb180
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
jmp 0x8767
leaq 0x26ea(%rip), %rsi      # 0xae27
movq %r14, %rdi
callq 0x4fcd
testb %al, %al
je 0x8773
leaq -0x1d0(%rbp), %r14
leaq 0x2a3e(%rip), %rsi      # 0xb195
movq %r14, %rdi
callq 0x31f0
movq %rax, %rdi
callq 0x3120
leaq 0x2a1b(%rip), %rsi      # 0xb189
jmp 0x8452
leaq 0x2a24(%rip), %rsi      # 0xb19e
leaq -0x38(%rbp), %rdi
leaq -0x11(%rbp), %rdx
callq 0x4f92
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0x7916
pushq $-0x1
popq %rdi
leaq -0x58(%rbp), %rsi
callq 0x6b74
leaq -0x58(%rbp), %rdi
callq 0x3110
leaq -0x38(%rbp), %rdi
callq 0x3110
jmp 0x8462
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x3110
jmp 0x87cb
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x3110
jmp 0x87db
jmp 0x87d8
movq %rax, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x3190
movq %rbx, %rdi
callq 0x3370