// File: /workspace/github_cpp_makefile_star2_O1/Merulo[P]CompilerJFTT/src/IRs/FourthIR.cpp
// Function: FourthIR::handleConst(RegisterBlock&, Block&, Line&)
void FourthIR::handleConst(RegisterBlock& rb, Block& b, Line& l)
{
    Register& r = rb.getRegister(l.one, b, {}, true, false);
    r.variableName = l.one;
    r.needToSafe = true;

    auto regs = rb.getRegisters();
    std::vector<std::pair<std::string, unsigned long long>> options = {{r.name, 0}};
    for(auto& reg : regs)
    {
        if (b.blockName != "Block_0")
        {
            break;
        }
        if (reg.state == RegisterState::CONSTVARIABLE)
        {
            options.push_back({reg.name, reg.constValue});
        }
    }

    auto lines = NumberGenerator::generateConstFrom(std::stoull(l.two), options);
    b.lines.insert(b.lines.end(), lines.begin(), lines.end()); 

    updateRegisterState(b, rb, r, l.one);
    r.constValue = std::stoull(l.two);
    if (r.state == RegisterState::VARIABLE)
    {
        r.state = RegisterState::CONSTVARIABLE;
        r.constValue = std::stoull(l.two);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, %rbp
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, 0x40(%rsp)
leaq 0xd0(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
addq %rsi, %rdx
leaq 0xc0(%rsp), %r14
movq %r14, %rdi
callq 0xca12
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x7d06
movq %rax, %r14
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x251cd
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
leaq 0x20(%rbp), %r15
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x251ee
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
addq $0x30, %rdi
movq %r15, %rsi
callq 0x4170
movb $0x1, 0x50(%r14)
leaq 0xa8(%rsp), %rdi
movq %r13, %rsi
callq 0x5602
leaq 0x28(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0xca12
movq %rbp, 0x8(%rsp)
leaq 0x18(%rsp), %rsi
movq $0x0, 0x20(%rsi)
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rcx
movl $0x1, %edx
callq 0xc182
movq %r14, 0x48(%rsp)
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x25275
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa8(%rsp), %r14
movq 0xb0(%rsp), %r15
cmpq %r15, %r14
je 0x252fc
leaq 0x1329e(%rip), %r13     # 0x3852f
leaq 0x18(%rsp), %rbp
movq %r12, %rdi
movq %r13, %rsi
callq 0x40d0
testl %eax, %eax
jne 0x252fc
cmpl $0x4, (%r14)
jne 0x252f3
movq %rbx, 0x18(%rsp)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
movq %rbp, %rdi
callq 0xca12
movq 0x8(%r14), %rax
movq %rax, 0x38(%rsp)
leaq 0x90(%rsp), %rdi
movq %rbp, %rsi
callq 0x2b224
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x252f3
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0x58, %r14
cmpq %r15, %r14
jne 0x25296
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rbp
callq 0x4050
movq %rax, %r13
movl (%rax), %r14d
movl $0x0, (%rax)
leaq 0x10(%rsp), %rbx
movq %rbp, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x43c0
cmpq %rbp, (%rbx)
je 0x254de
movq %rax, %r15
movl (%r13), %eax
testl %eax, %eax
je 0x25355
cmpl $0x22, %eax
movq 0x8(%rsp), %rbp
jne 0x2535e
leaq 0x12dd2(%rip), %rdi     # 0x38122
callq 0x43f0
movl %r14d, (%r13)
movq 0x8(%rsp), %rbp
leaq 0xe0(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x2a0aa
leaq 0x18(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
movq %r15, %rsi
callq 0x187fc
movq 0x48(%rsp), %r14
leaq 0xe0(%rsp), %rdi
callq 0xc1cc
movq 0x28(%r12), %rsi
addq $0x20, %r12
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq %r12, %rdi
callq 0xc3f4
leaq 0x60(%rsp), %rbx
movq %rbx, -0x10(%rbx)
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
addq %rsi, %rdx
leaq 0x50(%rsp), %rdi
callq 0xca12
leaq 0x50(%rsp), %r8
movq 0x40(%rsp), %rdi
movq %r14, %rcx
callq 0x28ed2
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x253fc
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rbp), %rbx
movl (%r13), %ebp
movl $0x0, (%r13)
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x43c0
cmpq %rbx, (%r15)
je 0x254ea
movl (%r13), %ecx
testl %ecx, %ecx
je 0x25443
cmpl $0x22, %ecx
jne 0x25447
leaq 0x12ce4(%rip), %rdi     # 0x38122
callq 0x43f0
movl %ebp, (%r13)
movq %rax, 0x8(%r14)
cmpl $0x1, (%r14)
jne 0x254a8
movl $0x4, (%r14)
movq 0x8(%rsp), %rax
movq 0x40(%rax), %rbx
movl (%r13), %ebp
movl $0x0, (%r13)
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x43c0
cmpq %rbx, (%r15)
je 0x254f6
movl (%r13), %ecx
testl %ecx, %ecx
je 0x254a0
cmpl $0x22, %ecx
jne 0x254a4
leaq 0x12c87(%rip), %rdi     # 0x38122
callq 0x43f0
movl %ebp, (%r13)
movq %rax, 0x8(%r14)
leaq 0x18(%rsp), %rdi
callq 0xbf5e
leaq 0x90(%rsp), %rdi
callq 0xc1cc
leaq 0xa8(%rsp), %rdi
callq 0xbe28
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x12c3d(%rip), %rdi     # 0x38122
callq 0x41a0
leaq 0x12c31(%rip), %rdi     # 0x38122
callq 0x41a0
leaq 0x12c25(%rip), %rdi     # 0x38122
callq 0x41a0
jmp 0x255b5
movq %rax, %r15
movq 0x50(%rsp), %rdi
cmpq %rbx, %rdi
je 0x255c3
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x255c3
jmp 0x2552c
movq %rax, %r15
jmp 0x255c3
movq %rax, %r15
leaq 0xe0(%rsp), %rdi
callq 0xc1cc
jmp 0x255fe
jmp 0x255fb
movq %rax, %r15
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x2560b
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2560b
movq %rax, %r15
jmp 0x2560b
movq %rax, %r15
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0x25596
movq 0x80(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xc0(%rsp), %rdi
cmpq %rbx, %rdi
je 0x25618
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x25618
movq %rax, %r15
cmpl $0x0, (%r13)
jne 0x255c3
movl %ebp, (%r13)
leaq 0x18(%rsp), %rdi
callq 0xbf5e
jmp 0x255fe
movq %rax, %r15
cmpl $0x0, (%r13)
jne 0x255fe
movl %r14d, (%r13)
jmp 0x255fe
movq %rax, %r15
movq 0x18(%rsp), %rdi
cmpq %rbx, %rdi
je 0x255fe
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x255fe
movq %rax, %r15
leaq 0x90(%rsp), %rdi
callq 0xc1cc
leaq 0xa8(%rsp), %rdi
callq 0xbe28
movq %r15, %rdi
callq 0x44c0