// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x1e0(%rbp), %rdi
callq 0x3190
leaq 0x38a8(%rip), %rsi      # 0xce01
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x96c3
leaq 0x3893(%rip), %rsi      # 0xce03
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x96fb
leaq 0x387e(%rip), %rsi      # 0xce05
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9733
leaq 0x3869(%rip), %rsi      # 0xce07
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x97aa
leaq 0x3854(%rip), %rsi      # 0xce09
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9821
leaq 0x383f(%rip), %rsi      # 0xce0b
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9924
leaq 0x382c(%rip), %rsi      # 0xce0f
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9998
leaq 0x3813(%rip), %rsi      # 0xce0d
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9a0c
leaq 0x3801(%rip), %rsi      # 0xce12
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9a80
leaq 0x37ed(%rip), %rsi      # 0xce15
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9af1
leaq 0x37e8(%rip), %rsi      # 0xce27
movq %r14, %rdi
callq 0x30b0
testl %eax, %eax
je 0x9b2a
leaq -0x28(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x3b40(%rip), %rsi      # 0xd19e
leaq 0x3b5b(%rip), %rdx      # 0xd1c0
leaq -0x38(%rbp), %rdi
callq 0x525a
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rsi
movq %r14, %rdx
callq 0xb21d
leaq -0x58(%rbp), %rsi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x73ec
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96a5
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x98e5
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x98e5
leaq -0x1d0(%rbp), %r14
leaq 0x3a1f(%rip), %rsi      # 0xd0f0
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
jmp 0x98d2
leaq -0x1d0(%rbp), %r14
leaq 0x39f3(%rip), %rsi      # 0xd0fc
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
jmp 0x98d2
leaq -0x1d0(%rbp), %r14
leaq 0x39c7(%rip), %rsi      # 0xd108
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x3994(%rip), %rsi      # 0xd114
movl $0x7, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
jmp 0x98d2
leaq -0x1d0(%rbp), %r14
leaq 0x3950(%rip), %rsi      # 0xd108
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x3925(%rip), %rsi      # 0xd11c
movl $0x7, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
jmp 0x98d2
leaq -0x1d0(%rbp), %r14
leaq 0x38d9(%rip), %rsi      # 0xd108
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x38ae(%rip), %rsi      # 0xd11c
movl $0x7, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x3877(%rip), %rsi      # 0xd124
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq -0x1d0(%rbp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %r14, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq -0x1c8(%rbp), %rsi
movq %rbx, %rdi
callq 0x3320
movq 0x86ad(%rip), %rsi      # 0x11fa8
leaq -0x1e0(%rbp), %rdi
callq 0x31b0
leaq -0x160(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0x1d0(%rbp), %r14
leaq 0x37fe(%rip), %rsi      # 0xd130
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x37ee(%rip), %rsi      # 0xd13c
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x37db(%rip), %rsi      # 0xd145
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x37c8(%rip), %rsi      # 0xd14e
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
jmp 0x9b61
leaq -0x1d0(%rbp), %r14
leaq 0x378a(%rip), %rsi      # 0xd130
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x377a(%rip), %rsi      # 0xd13c
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3767(%rip), %rsi      # 0xd145
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3760(%rip), %rsi      # 0xd15a
movl $0xc, %edx
movq %r14, %rdi
callq 0x3270
jmp 0x9b61
leaq -0x1d0(%rbp), %r14
leaq 0x3716(%rip), %rsi      # 0xd130
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3706(%rip), %rsi      # 0xd13c
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x36f3(%rip), %rsi      # 0xd145
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x36f9(%rip), %rsi      # 0xd167
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
jmp 0x9b61
leaq -0x1d0(%rbp), %r14
leaq 0x36a2(%rip), %rsi      # 0xd130
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3692(%rip), %rsi      # 0xd13c
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x367f(%rip), %rsi      # 0xd145
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3691(%rip), %rsi      # 0xd173
movl $0xc, %edx
movq %r14, %rdi
callq 0x3270
jmp 0x9b61
leaq -0x1d0(%rbp), %r14
leaq 0x3681(%rip), %rsi      # 0xd180
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x366e(%rip), %rsi      # 0xd189
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
jmp 0x9b61
leaq -0x1d0(%rbp), %r14
leaq 0x365d(%rip), %rsi      # 0xd195
movl $0x8, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
leaq 0x3635(%rip), %rsi      # 0xd189
movl $0xb, %edx
movq %r14, %rdi
callq 0x3270
movq %r14, %rdi
callq 0x3130
jmp 0x98e5
movq %rax, %rbx
leaq -0x48(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9b8f
movq -0x48(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x9b8f
movq %rax, %rbx
movq -0x38(%rbp), %rdi
cmpq %r15, %rdi
je 0x9bab
movq -0x28(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x9bab
jmp 0x9ba8
movq %rax, %rbx
movq 0x83f6(%rip), %rsi      # 0x11fa8
leaq -0x1e0(%rbp), %rdi
callq 0x31b0
leaq -0x160(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3380