// File: /workspace/github_cpp_makefile_star2_O3/devaigergely81[P]flex-bison-example/code_generator_implementation.cc
// Function: generate_code(std::__cxx11::list<instruction*, std::allocator<instruction*>>*)
void generate_code(std::list<instruction*>* commands) {
    std::cout << "global main" << std::endl;
    std::cout << "extern write_natural" << std::endl;
    std::cout << "extern read_natural" << std::endl;
    std::cout << "extern write_boolean" << std::endl;
    std::cout << "extern read_boolean" << std::endl;
    std::cout << std::endl;
    std::cout << "section .bss" << std::endl;
    std::map<std::string,symbol>::iterator it;
    for(it = symbol_table.begin(); it != symbol_table.end(); ++it) {
        std::cout << it->second.get_code();
    }
    std::cout << std::endl;
    std::cout << "section .text" << std::endl;
    std::cout << "main:" << std::endl;
    generate_code_of_commands(std::cout, commands);
    std::cout << "xor eax,eax" << std::endl;
    std::cout << "ret" << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, -0x30(%rbp)
movq 0x7261(%rip), %rbx      # 0x11fc0
leaq 0x24ce(%rip), %rsi      # 0xd234
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x249f(%rip), %rsi      # 0xd240
movl $0x14, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x2479(%rip), %rsi      # 0xd255
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x2452(%rip), %rsi      # 0xd269
movl $0x14, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x242c(%rip), %rsi      # 0xd27e
movl $0x13, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x23de(%rip), %rsi      # 0xd292
movl $0xc, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x7361(%rip), %r14      # 0x12250
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0xaf4c
leaq -0x40(%rbp), %rbx
leaq -0x50(%rbp), %r12
movq 0x70b5(%rip), %r13      # 0x11fc0
leaq 0x40(%r15), %rsi
movq %r12, %rdi
callq 0x8fde
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r13, %rdi
callq 0x3270
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xaf3c
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
movq %r15, %rdi
callq 0x3180
movq %rax, %r15
cmpq %r14, %rax
jne 0xaf0b
movq 0x706d(%rip), %rbx      # 0x11fc0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x231e(%rip), %rsi      # 0xd29f
movl $0xd, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x22f1(%rip), %rsi      # 0xd2ad
movl $0x5, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
movq %rbx, %rdi
movq -0x30(%rbp), %rsi
callq 0xa9bb
leaq 0x22b0(%rip), %rsi      # 0xd2b3
movl $0xb, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
leaq 0x2281(%rip), %rsi      # 0xd2bf
movl $0x3, %edx
movq %rbx, %rdi
callq 0x3270
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3030
movq %rax, %rdi
callq 0x3170
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xb099
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
movq %r14, %rdi
callq 0x3380