// File: Davidc2525[P]Leaf/compiler/backend/x86_64_linux/generator.cpp
// Function: x86_64_linux_generator_visitor::visit2(LEAF::AST::FloatConst*)
void x86_64_linux_generator_visitor::visit2(FloatConst *number)
{
    UPDATE_STATICS
    if (!number->in_data)
    {
        string *label_data = new string(number->adr_label->c_str());
        label_data->append(" dq ");
        char *chars_val = new char[20];
        sprintf(chars_val, "%.7lf", number->value);
        label_data->append(chars_val);
        assembly->get_program()->section(Sections::data)->add(new RegisterOperand(label_data->c_str()));
        number->in_data = true;
    }

    Section *st = assembly->get_program()->section(Sections::text);
    Section *dt = assembly->get_program()->section(Sections::data);
    Register *current_reg = this->reg;
    this->reg = this->rp->reserve_by_size(128);
    if (this->ax == Load)
    {
        DInstruccion *i = new DInstruccion("movss");
        MemoryOperand *ops = new MemoryOperand();
        RegisterOperand *adr_label = new RegisterOperand(number->adr_label->c_str());
        ops->add_operand(adr_label);
        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("addss");
        MemoryOperand *ops = new MemoryOperand();
        RegisterOperand *adr_label = new RegisterOperand(number->adr_label->c_str());
        ops->add_operand(adr_label);
        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 $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
movl 0x8(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
testb $0x1, 0x30(%rax)
jne 0x2fb18
movl $0x20, %edi
callq 0x62e0
movq %rax, -0xb0(%rbp)
movq %rax, -0xb8(%rbp)
movb $0x1, -0x2d(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x6120
movq %rax, -0xa8(%rbp)
leaq -0x19(%rbp), %rdi
movq %rdi, -0xa0(%rbp)
callq 0x6500
movq -0xb0(%rbp), %rdi
movq -0xa8(%rbp), %rsi
movq -0xa0(%rbp), %rdx
callq 0xada0
jmp 0x2f9f1
movb $0x0, -0x2d(%rbp)
leaq -0x19(%rbp), %rdi
callq 0x6340
movq -0xb8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x678b(%rip), %rsi      # 0x3619f
callq 0x6540
movl $0x14, %edi
callq 0x6040
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rax
movss 0x24(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
leaq 0x6765(%rip), %rsi      # 0x361a4
movb $0x1, %al
callq 0x60a0
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x6540
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xb010
movq %rax, %rdi
xorl %esi, %esi
callq 0x1c3c0
movq %rax, -0xd0(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, -0xc0(%rbp)
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rdi
callq 0x6120
movq -0xc0(%rbp), %rdi
movq %rax, %rsi
callq 0x1b1e0
jmp 0x2faa6
movq -0xc8(%rbp), %rsi
movq -0xd0(%rbp), %rdi
callq 0x18670
movq -0x10(%rbp), %rax
movb $0x1, 0x30(%rax)
jmp 0x2fb18
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x19(%rbp), %rdi
callq 0x6340
testb $0x1, -0x2d(%rbp)
jne 0x2fae0
jmp 0x2faf1
movq -0xb8(%rbp), %rdi
movl $0x20, %esi
callq 0x62f0
jmp 0x2fefe
movq -0xc8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x98(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xb010
movq %rax, %rdi
movl $0x2, %esi
callq 0x1c3c0
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq 0x10(%rax), %rdi
callq 0xb010
movq %rax, %rdi
xorl %esi, %esi
callq 0x1c3c0
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq 0x20(%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x30(%rax), %rdi
movq (%rdi), %rax
movl $0x80, %esi
callq *0x78(%rax)
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpl $0x1, 0x38(%rax)
jne 0x2fd3d
movl $0x28, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
leaq 0x65e8(%rip), %rsi      # 0x36199
callq 0x1a4e0
jmp 0x2fbb8
movq -0xd8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x20, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
callq 0x1b360
jmp 0x2fbe1
movq -0xe0(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, -0xe8(%rbp)
movq %rax, -0xf0(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x6120
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x1b1e0
jmp 0x2fc22
movq -0xf0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x1b420
movl $0x10, %edi
callq 0x62e0
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x100(%rbp)
movq 0x20(%rax), %rdi
callq 0x21350
movq %rax, -0xf8(%rbp)
jmp 0x2fc67
movq -0xf8(%rbp), %rsi
movq -0x100(%rbp), %rdi
callq 0x1b1e0
jmp 0x2fc7c
movq -0x100(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x58(%rbp), %rdi
movq -0x70(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x40(%rbp), %rdi
movq -0x58(%rbp), %rsi
callq 0x18670
jmp 0x2fd3d
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x28, %esi
callq 0x62f0
jmp 0x2fefe
movq -0xe0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x20, %esi
callq 0x62f0
jmp 0x2fefe
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x100(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x98(%rbp), %rax
cmpl $0x2, 0x38(%rax)
jne 0x2fef5
movl $0x28, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x108(%rbp)
leaq 0x643e(%rip), %rsi      # 0x361aa
callq 0x1a4e0
jmp 0x2fd73
movq -0x108(%rbp), %rax
movq %rax, -0x78(%rbp)
movl $0x20, %edi
callq 0x62e0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x110(%rbp)
callq 0x1b360
jmp 0x2fd9c
movq -0x110(%rbp), %rax
movq %rax, -0x80(%rbp)
movl $0x10, %edi
callq 0x62e0
movq %rax, -0x118(%rbp)
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x6120
movq -0x118(%rbp), %rdi
movq %rax, %rsi
callq 0x1b1e0
jmp 0x2fddd
movq -0x120(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x1b420
movl $0x10, %edi
callq 0x62e0
movq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, -0x130(%rbp)
movq 0x20(%rax), %rdi
callq 0x21350
movq %rax, -0x128(%rbp)
jmp 0x2fe28
movq -0x128(%rbp), %rsi
movq -0x130(%rbp), %rdi
callq 0x1b1e0
jmp 0x2fe3d
movq -0x130(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x78(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq (%rdi), %rax
callq *0x20(%rax)
movq -0x40(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x18670
jmp 0x2fef5
movq -0x108(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x28, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x110(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x20, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x120(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2fefe
movq -0x130(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x10, %esi
callq 0x62f0
jmp 0x2fefe
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x64f0
nopw (%rax,%rax)