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

    std::string argument = l.two;
    if (l.one == l.two)
    {
        argument = "";
    }

    Register& registerC = rb.getRegistersForOperation(argument, b, {registerB});
    registerC.state = RegisterState::UNKNOWN;
    registerC.variableName = "";

    if (l.one == l.two)
    {
        b.lines.push_back({"COPY", registerC.name, registerB.name});
    }

    Register& registerD = rb.getRegistersForOperation("TEMPORARY_2", b, {registerB, registerC});
    registerD.state = RegisterState::UNKNOWN;
    registerD.variableName = "";

    auto lines = MathOperations::generateMultiplication(registerB.name, registerC.name, registerD.name, l);
    b.lines.insert(b.lines.end(), lines.begin(), lines.end());

    registerD.variableName = l.one;
    updateRegisterState(b, rb, registerD, l.one);
    registerD.needToSafe = true;

    registerB.state = RegisterState::UNKNOWN;
    registerB.variableName = "";
    registerB.needToSafe = false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rcx, %r15
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, 0x10(%rsp)
leaq 0x250(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
addq %rsi, %rdx
leaq 0x240(%rsp), %rbx
movq %rbx, %rdi
callq 0xca12
xorps %xmm0, %xmm0
leaq 0x1a0(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %r14, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x7d06
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0x26df7
movq 0x1b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %r13, 0x18(%rsp)
leaq 0x20(%r15), %r13
movq 0x240(%rsp), %rdi
cmpq %r12, %rdi
je 0x26e1d
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
addq $0x30, %rdi
movq %rdi, 0xe0(%rsp)
movq %r13, 0xe8(%rsp)
movq %r13, %rsi
callq 0x4170
leaq 0x230(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x220(%rsp), %r12
movq %r12, %rdi
callq 0xca12
movq 0x10(%rsp), %rdi
movq %rbx, %rcx
movq %r12, %r8
callq 0x28ed2
movq 0x220(%rsp), %rdi
cmpq %r13, %rdi
je 0x26e90
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x42a0
movb $0x1, 0x50(%rbx)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xca12
movq 0x28(%r15), %rdx
cmpq 0x48(%r15), %rdx
movq 0x18(%rsp), %r13
jne 0x26ef1
testq %rdx, %rdx
je 0x26ed7
movq 0x20(%r15), %rdi
movq 0x40(%r15), %rsi
callq 0x42b0
testl %eax, %eax
jne 0x26ef1
leaq 0x20(%rsp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x111fc(%rip), %rcx     # 0x380e3
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
leaq 0x190(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %rdi
callq 0xca12
leaq 0x260(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x108(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0xc2ee
leaq 0x180(%rsp), %rsi
leaq 0x108(%rsp), %rcx
movq %r14, %rdi
movq %r13, %rdx
callq 0x6d22
movq %rax, %rbp
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x26f75
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x180(%rsp), %rdi
cmpq %r12, %rdi
je 0x26f92
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x0, (%rbp)
movq %rbp, %rdi
addq $0x30, %rdi
movq 0x38(%rbp), %rdx
leaq 0x11138(%rip), %rcx     # 0x380e3
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movq 0x28(%r15), %rdx
cmpq 0x48(%r15), %rdx
jne 0x2714d
testq %rdx, %rdx
je 0x26fdd
movq 0x20(%r15), %rdi
movq 0x40(%r15), %rsi
callq 0x42b0
testl %eax, %eax
jne 0x2714d
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x110d5(%rip), %rsi     # 0x380c5
leaq 0x110d2(%rip), %rdx     # 0x380c9
leaq 0xc0(%rsp), %rdi
callq 0x54fc
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0xca12
leaq 0x170(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x160(%rsp), %rdi
callq 0xca12
leaq 0x260(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
leaq 0x160(%rsp), %rcx
callq 0xbe58
leaq 0x20(%r13), %rdi
leaq 0x260(%rsp), %rsi
callq 0xcf0e
leaq 0x2b0(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x270a4
movq 0x2b0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x290(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x270c5
movq 0x290(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x270(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x270e6
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x160(%rsp), %rdi
cmpq %r12, %rdi
je 0x27103
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
leaq 0xd0(%rsp), %r12
je 0x27130
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2714d
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x150(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x113d6(%rip), %rsi     # 0x38537
leaq 0x113da(%rip), %rdx     # 0x38542
leaq 0x140(%rsp), %rdi
callq 0x54fc
leaq 0x260(%rsp), %rsi
movq %rbx, (%rsi)
movq %rbp, 0x8(%rsi)
leaq 0xf0(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
callq 0xc2ee
leaq 0x140(%rsp), %rsi
leaq 0xf0(%rsp), %rcx
movq %r14, %rdi
movq %r13, %rdx
callq 0x6d22
movq %rax, %r14
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x271d6
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x140(%rsp), %rdi
cmpq %r12, %rdi
je 0x271f3
movq 0x150(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x0, (%r14)
movq %r14, %r12
addq $0x30, %r12
movq 0x38(%r14), %rdx
leaq 0x10ed7(%rip), %rcx     # 0x380e3
movq %r12, %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xca12
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xca12
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xca12
leaq 0x1c8(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x1b8(%rsp), %rdi
callq 0xca12
leaq 0x1d8(%rsp), %rdi
leaq 0x1e8(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
leaq 0x1f8(%rsp), %rdi
leaq 0x208(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
movl 0x60(%r15), %eax
leaq 0x1b8(%rsp), %r8
movl %eax, 0x60(%r8)
leaq 0x260(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x60(%rsp), %rdx
leaq 0x40(%rsp), %rcx
callq 0xd562
movq 0x1f8(%rsp), %rdi
cmpq %r13, %rdi
je 0x27330
movq 0x208(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x1d8(%rsp), %rdi
cmpq %rbp, %rdi
movq 0x18(%rsp), %r13
je 0x27352
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x1b8(%rsp), %rdi
leaq 0x1c8(%rsp), %rax
cmpq %rax, %rdi
je 0x27377
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27393
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x273af
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x273d4
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x28(%r13), %rsi
addq $0x20, %r13
movq 0x260(%rsp), %rdx
movq 0x268(%rsp), %rcx
movq %r13, %rdi
callq 0xc3f4
movq %r12, %rdi
movq 0xe8(%rsp), %rsi
callq 0x4170
leaq 0x130(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x120(%rsp), %rdi
callq 0xca12
leaq 0x120(%rsp), %r8
movq 0x10(%rsp), %rdi
movq %r14, %rcx
callq 0x28ed2
movq 0x120(%rsp), %rdi
cmpq %r12, %rdi
je 0x2745b
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x42a0
movb $0x1, 0x50(%r14)
movl $0x0, (%rbx)
movq 0x38(%rbx), %rdx
leaq 0x10c72(%rip), %rcx     # 0x380e3
movq 0xe0(%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movb $0x0, 0x50(%rbx)
leaq 0x260(%rsp), %rdi
callq 0xbf5e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x274b0
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0xbf10
jmp 0x274d7
movq %rax, %rbx
movq 0x160(%rsp), %rdi
cmpq %r12, %rdi
je 0x274f9
movq 0x170(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x274f9
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x27523
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27523
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x27743
movq 0xd0(%rsp), %rsi
jmp 0x276d3
jmp 0x2772e
jmp 0x2772e
movq %rax, %rbx
movq 0x120(%rsp), %rdi
cmpq %r12, %rdi
je 0x27736
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27736
jmp 0x27733
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
callq 0xbf10
jmp 0x275e2
movq %rax, %rbx
movq 0x1d8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x275b8
movq 0x1e8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x275b8
movq %rax, %rbx
movq 0x1b8(%rsp), %rdi
leaq 0x1c8(%rsp), %rax
cmpq %rax, %rdi
je 0x275e2
movq 0x1c8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x275e2
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27603
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27603
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x27624
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27624
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x27743
movq 0x90(%rsp), %rsi
jmp 0x276d3
jmp 0x2772e
jmp 0x2772e
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
testq %rdi, %rdi
je 0x27679
movq 0x100(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x27679
movq %rax, %rbx
movq 0x140(%rsp), %rdi
cmpq %r12, %rdi
je 0x27743
movq 0x150(%rsp), %rsi
jmp 0x276d3
jmp 0x2772e
movq %rax, %rbx
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x276be
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x276be
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r12, %rdi
je 0x27743
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27743
movq %rax, %rbx
movq 0x220(%rsp), %rdi
cmpq %r13, %rdi
je 0x2775f
movq 0x230(%rsp), %rsi
jmp 0x27757
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
testq %rdi, %rdi
je 0x27717
movq 0x1b0(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x240(%rsp), %rdi
cmpq %r12, %rdi
je 0x2775f
movq 0x250(%rsp), %rsi
jmp 0x27757
movq %rax, %rbx
jmp 0x27743
movq %rax, %rbx
leaq 0x260(%rsp), %rdi
callq 0xbf5e
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2775f
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0
nop