// File: Davidc2525[P]Leaf/compiler/backend/x86_64_linux/generator.cpp
// Function: x86_64_linux_generator_visitor::visit2(LEAF::AST::IntConst*)
void x86_64_linux_generator_visitor::visit2(IntConst *number)
{
    UPDATE_STATICS
    Section *st = assembly->get_program()->section(Sections::text);
    if (this->ax == Load)
    {
        DInstruccion *i = new DInstruccion("mov");
        InmediateIntOperand *ops = new InmediateIntOperand(number->value);
        RegisterOperand *opd = new RegisterOperand(this->reg->getName());
        i->add_operand(opd);
        i->add_operand(ops);
        st->add(i);
    }

    if (this->ax == op_types::Plus)
    {
        DInstruccion *i = new DInstruccion("add");
        InmediateIntOperand *ops = new InmediateIntOperand(number->value);
        RegisterOperand *opd = new RegisterOperand(this->reg->getName());
        i->add_operand(opd);
        i->add_operand(ops);
        st->add(i);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq 0x10(%rax), %rdi
callq 0xb010
movq %rax, %rdi
movl $0x2, %esi
callq 0x1c3c0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x18(%rbp)
cmpl $0x1, 0x38(%rax)
jne 0x2f626
movl $0x28, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
leaq 0x6c5f(%rip), %rsi      # 0x36189
callq 0x1a4e0
jmp 0x2f531
movq -0x68(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
callq 0x1b0f0
jmp 0x2f55b
movq -0x70(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0x80(%rbp)
movq 0x20(%rax), %rdi
callq 0x21350
movq %rax, -0x78(%rbp)
jmp 0x2f587
movq -0x78(%rbp), %rsi
movq -0x80(%rbp), %rdi
callq 0x1b1e0
jmp 0x2f596
movq -0x80(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x20(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x18670
jmp 0x2f626
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x28, %esi
callq 0x62f0
jmp 0x2f76f
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2f76f
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2f76f
movq -0x60(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x2f766
movl $0x28, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x88(%rbp)
leaq 0x6b2e(%rip), %rsi      # 0x36180
callq 0x1a4e0
jmp 0x2f659
movq -0x88(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movl 0x24(%rax), %esi
callq 0x1b0f0
jmp 0x2f689
movq -0x90(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, %rcx
movq -0x60(%rbp), %rax
movq %rcx, -0xa0(%rbp)
movq 0x20(%rax), %rdi
callq 0x21350
movq %rax, -0x98(%rbp)
jmp 0x2f6be
movq -0x98(%rbp), %rsi
movq -0xa0(%rbp), %rdi
callq 0x1b1e0
jmp 0x2f6d3
movq -0xa0(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x18670
jmp 0x2f766
movq -0x88(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x28, %esi
callq 0x62f0
jmp 0x2f76f
movq -0x90(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2f76f
movq -0xa0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2f76f
addq $0xa0, %rsp
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x64f0
nopl (%rax,%rax)