// File: /workspace/github_cpp_makefile_star2_O1/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 0x70e5(%rip), %rbx      # 0x11fc0
leaq 0x2352(%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 0x2323(%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 0x22fd(%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 0x22d6(%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 0x22b0(%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 0x2262(%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 0x71e5(%rip), %r14      # 0x12250
movq 0x18(%r14), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0xb0c8
leaq -0x40(%rbp), %rbx
leaq -0x50(%rbp), %r12
movq 0x6f39(%rip), %r13      # 0x11fc0
leaq 0x40(%r15), %rsi
movq %r12, %rdi
callq 0x914e
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %r13, %rdi
callq 0x3270
movq -0x50(%rbp), %rdi
cmpq %rbx, %rdi
je 0xb0b8
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
movq %r15, %rdi
callq 0x3180
movq %rax, %r15
cmpq %r14, %rax
jne 0xb087
movq 0x6ef1(%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 0x21a2(%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 0x2175(%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 0xab37
leaq 0x2134(%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 0x2105(%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 0xb215
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
movq %r14, %rdi
callq 0x3380