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

    Register& registerC = rb.getRegister(l.two, b, {registerB}, false, true);
    updateRegisterState(b, rb, registerC, l.two);
    registerC.variableName = l.two;

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

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

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

    auto lines = MathOperations::generateDivision(
        registerB.name, registerC.name, 
        registerD.name, registerE.name,
        registerF.name, l);

    b.lines.insert(b.lines.end(), lines.begin(), lines.end());

    updateRegisterState(b, rb, registerD, l.one);
    registerD.variableName = 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 $0x2e8, %rsp            # imm = 0x2E8
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
leaq 0x2d8(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
addq %rsi, %rdx
leaq 0x2c8(%rsp), %rbx
movq %rbx, %rdi
callq 0xca12
xorps %xmm0, %xmm0
leaq 0x200(%rsp), %rcx
movaps %xmm0, (%rcx)
movq $0x0, 0x10(%rcx)
movq %r13, 0x18(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movq %r12, 0x10(%rsp)
movq %r12, %rdx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x7d06
movq %rax, %rbx
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0x27806
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x2c8(%rsp), %rdi
cmpq %r14, %rdi
je 0x27823
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x2b8(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x2a8(%rsp), %r14
movq %r14, %rdi
callq 0xca12
movq %rbp, %rdi
movq %rbx, %rcx
movq %r14, %r8
callq 0x28ed2
leaq 0x20(%r15), %r13
movq 0x2a8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2787a
movq 0x2b8(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
addq $0x30, %rdi
movq %rdi, 0x118(%rsp)
movq %r13, %rsi
callq 0x4170
movb $0x1, 0x50(%rbx)
leaq 0x1f0(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
leaq 0x1e0(%rsp), %rdi
callq 0xca12
leaq 0xc0(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x168(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0xc2ee
leaq 0x1e0(%rsp), %rsi
leaq 0x168(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0x7d06
movq %rax, %r14
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0x27924
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %r13, 0x108(%rsp)
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x27949
movq 0x1f0(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x298(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
leaq 0x288(%rsp), %r12
movq %r12, %rdi
callq 0xca12
movq %rbp, %rdi
movq %r14, %rcx
movq %r12, %r8
callq 0x28ed2
leaq 0x40(%r15), %r12
movq 0x288(%rsp), %rdi
cmpq %r13, %rdi
je 0x2799f
movq 0x298(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %r14, %rdi
addq $0x30, %rdi
movq %r12, %rsi
callq 0x4170
leaq 0x1d0(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x10b81(%rip), %rsi     # 0x38543
leaq 0x10b85(%rip), %rdx     # 0x3854e
leaq 0x1c0(%rsp), %rdi
callq 0x54fc
leaq 0xc0(%rsp), %rsi
movq %rbx, (%rsi)
movq %r14, 0x8(%rsi)
leaq 0x150(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x2, %edx
callq 0xc2ee
leaq 0x1c0(%rsp), %rsi
leaq 0x150(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x6d22
movq %rax, %r13
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x27a3b
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq %rbp, 0x110(%rsp)
movq 0x1c0(%rsp), %rdi
cmpq %r12, %rdi
je 0x27a60
movq 0x1d0(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x0, (%r13)
movq %r13, %rdi
addq $0x30, %rdi
movq 0x38(%r13), %rdx
leaq 0x10669(%rip), %rcx     # 0x380e3
movq %rdi, 0x100(%rsp)
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
leaq 0x1b0(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x10a98(%rip), %rsi     # 0x38537
leaq 0x10a9c(%rip), %rdx     # 0x38542
leaq 0x1a0(%rsp), %rdi
callq 0x54fc
leaq 0xc0(%rsp), %rsi
movq %rbx, (%rsi)
movq %r14, 0x8(%rsi)
movq %r13, 0x10(%rsi)
leaq 0x138(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x3, %edx
callq 0xc2ee
leaq 0x1a0(%rsp), %rsi
leaq 0x138(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x6d22
movq %rax, %r12
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x27b1c
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x1a0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x27b39
movq 0x1b0(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x0, (%r12)
movq %r12, %rdi
addq $0x30, %rdi
movq 0x38(%r12), %rdx
leaq 0x1058f(%rip), %rcx     # 0x380e3
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x109de(%rip), %rsi     # 0x3854f
leaq 0x109e2(%rip), %rdx     # 0x3855a
leaq 0xe0(%rsp), %rdi
callq 0x54fc
leaq 0xc0(%rsp), %rsi
movq %rbx, (%rsi)
movq %r14, 0x8(%rsi)
movq %r13, 0x10(%rsi)
movq %r12, 0x18(%rsi)
leaq 0x120(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x4, %edx
callq 0xc2ee
leaq 0xe0(%rsp), %rsi
leaq 0x120(%rsp), %rcx
movq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rdx
callq 0x6d22
movq %rax, %rbp
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x27bf2
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x27c17
movq 0xf0(%rsp), %rsi
incq %rsi
callq 0x42a0
movl $0x0, (%rbp)
movq %rbp, %rdi
addq $0x30, %rdi
movq 0x38(%rbp), %rdx
leaq 0x104b3(%rip), %rcx     # 0x380e3
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %rdx
addq %rsi, %rdx
leaq 0xa0(%rsp), %rdi
callq 0xca12
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
addq %rsi, %rdx
leaq 0x80(%rsp), %rdi
callq 0xca12
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
addq %rsi, %rdx
leaq 0x60(%rsp), %rdi
callq 0xca12
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%r12), %rsi
movq 0x18(%r12), %rdx
addq %rsi, %rdx
leaq 0x40(%rsp), %rdi
callq 0xca12
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x10(%rbp), %rsi
movq 0x18(%rbp), %rdx
addq %rsi, %rdx
leaq 0x20(%rsp), %rdi
callq 0xca12
leaq 0x230(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x220(%rsp), %r14
movq %r14, %rdi
callq 0xca12
leaq 0x240(%rsp), %rdi
leaq 0x250(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
leaq 0x260(%rsp), %rdi
leaq 0x270(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
addq %rsi, %rdx
callq 0xca12
movl 0x60(%r15), %eax
movl %eax, 0x280(%rsp)
movq %r14, (%rsp)
leaq 0xc0(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
leaq 0x80(%rsp), %rdx
leaq 0x60(%rsp), %rcx
leaq 0x40(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0x101b0
movq 0x260(%rsp), %rdi
cmpq %rbp, %rdi
leaq 0x70(%rsp), %r14
je 0x27daa
movq 0x270(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x240(%rsp), %rdi
cmpq %r12, %rdi
movq 0x110(%rsp), %r12
leaq 0x230(%rsp), %rbp
je 0x27dd7
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x220(%rsp), %rdi
cmpq %rbp, %rdi
je 0x27df4
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x27e10
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x27e2c
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x60(%rsp), %rdi
cmpq %r14, %rdi
je 0x27e43
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x27e68
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x27e8d
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x10(%rsp), %rdi
movq 0x28(%rdi), %rsi
addq $0x20, %rdi
movq 0xc0(%rsp), %rdx
movq 0xc8(%rsp), %rcx
callq 0xc3f4
leaq 0x190(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x20(%r15), %rsi
movq 0x28(%r15), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %rdi
callq 0xca12
leaq 0x180(%rsp), %r8
movq %r12, %rdi
movq %r13, %rcx
callq 0x28ed2
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x27f03
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x100(%rsp), %rdi
movq 0x108(%rsp), %rsi
callq 0x4170
movb $0x1, 0x50(%r13)
movl $0x0, (%rbx)
movq 0x38(%rbx), %rdx
leaq 0x101b5(%rip), %rcx     # 0x380e3
movq 0x118(%rsp), %rdi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0x4440
movb $0x0, 0x50(%rbx)
leaq 0xc0(%rsp), %rdi
callq 0xbf5e
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x180(%rsp), %rdi
cmpq %r14, %rdi
je 0x2822f
movq 0x190(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2822f
jmp 0x2822c
movq %rax, %rbx
leaq 0x220(%rsp), %rdi
callq 0xbf10
jmp 0x27ff2
movq %rax, %rbx
movq 0x240(%rsp), %rdi
cmpq %r12, %rdi
je 0x27fc8
movq 0x250(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27fc8
movq %rax, %rbx
movq 0x220(%rsp), %rdi
leaq 0x230(%rsp), %rax
cmpq %rax, %rdi
je 0x27ff2
movq 0x230(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x27ff2
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x28013
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x28013
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x28034
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x28034
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x28055
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x28055
movq %rax, %rbx
movq 0x80(%rsp), %rdi
leaq 0x90(%rsp), %rax
cmpq %rax, %rdi
je 0x2807f
movq 0x90(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2807f
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x2823c
movq 0xb0(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x120(%rsp), %rdi
testq %rdi, %rdi
je 0x280ca
movq 0x130(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x280ca
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
leaq 0xf0(%rsp), %rax
cmpq %rax, %rdi
je 0x2823c
movq 0xf0(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x138(%rsp), %rdi
testq %rdi, %rdi
je 0x28115
movq 0x148(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x28115
movq %rax, %rbx
movq 0x1a0(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2823c
movq 0x1b0(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x150(%rsp), %rdi
testq %rdi, %rdi
je 0x28158
movq 0x160(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x28158
movq %rax, %rbx
movq 0x1c0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2823c
movq 0x1d0(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x288(%rsp), %rdi
cmpq %r13, %rdi
je 0x2823c
movq 0x298(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x168(%rsp), %rdi
testq %rdi, %rdi
je 0x281bc
movq 0x178(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
jmp 0x281bc
movq %rax, %rbx
movq 0x1e0(%rsp), %rdi
cmpq %r12, %rdi
je 0x2823c
movq 0x1f0(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x2a8(%rsp), %rdi
cmpq %r12, %rdi
je 0x2823c
movq 0x2b8(%rsp), %rsi
jmp 0x28222
movq %rax, %rbx
movq 0x200(%rsp), %rdi
testq %rdi, %rdi
je 0x2820d
movq 0x210(%rsp), %rsi
subq %rdi, %rsi
callq 0x42a0
movq 0x2c8(%rsp), %rdi
cmpq %r14, %rdi
je 0x2823c
movq 0x2d8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x2823c
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0xbf5e
movq %rbx, %rdi
callq 0x44c0