// File: /workspace/github_cpp_makefile_star2_O3/Merulo[P]CompilerJFTT/src/IRs/SecondIR.cpp
// Function: SecondIR::canRemoveRecursive(Block&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool SecondIR::canRemoveRecursive(Block& b, std::string name)
{
    if (b.visited)
    {
        return true;
    }
    b.visited = true;
    for (auto line = b.lines.begin(); line != b.lines.end(); line++)
    {
        if(line->two == name)
        {
            return false;
        }
        if (line->two.find("(" + name + ")") != std::string::npos)
        {
            return false;
        }
        if (line->one.find("(" + name + ")") != std::string::npos)
        {
            return false;
        }  
        if (line->one == name)
        {
            if (_banned.find(line->operation) != _banned.end())
            {
                return false;
            } 
            return true;
        }       
    }
    if (!b.blockJump.empty())
    {
        Block& nextBlock = getBlockByName(b.blockJump, _blocks);
        return canRemoveRecursive(nextBlock, name);
    }
    else if (!b.blockIfFalse.empty())
    {
        Block& blockTrue = getBlockByName(b.blockIfFalse, _blocks);
        bool r1 = canRemoveRecursive(blockTrue, name);  
        Block& blockFalse = getBlockByName(b.blockIfTrue, _blocks);
        bool r2 = canRemoveRecursive(blockFalse, name);  
        return r1 && r2;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movb $0x1, %r13b
cmpb $0x0, 0x98(%rsi)
jne 0x23bc7
movq %rdx, %r14
movq %rdi, 0x28(%rsp)
movb $0x1, 0x98(%rsi)
movq 0x20(%rsi), %r12
cmpq 0x28(%rsi), %r12
movq %rsi, 0x50(%rsp)
je 0x23975
leaq 0x18(%rsp), %r15
movq 0x8(%r14), %r13
addq $0x40, %r12
leaq 0x14e2c(%rip), %rbp     # 0x385bd
leaq 0x30(%rsp), %rbx
cmpq %r13, 0x8(%r12)
jne 0x237bd
testq %r13, %r13
je 0x23a3a
movq (%r14), %rsi
movq (%r12), %rdi
movq %r13, %rdx
callq 0x42b0
testl %eax, %eax
je 0x23a3a
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x5344
movq %rbx, %rdi
leaq 0x13d2f(%rip), %rsi     # 0x37504
callq 0x4510
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x237fd
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x23804
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x44a0
movq %rax, %r13
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x2384a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x23866
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
cmpq $-0x1, %r13
jne 0x23a3a
movq %rbx, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x5344
movq %rbx, %rdi
leaq 0x13c7c(%rip), %rsi     # 0x37504
callq 0x4510
movq %r15, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x238b0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x238b7
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x20(%r12), %rbp
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rbp, %rdi
xorl %edx, %edx
callq 0x44a0
movq %rax, %r13
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23902
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x2391e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
cmpq $-0x1, %r13
jne 0x23a3a
movq -0x18(%r12), %rdx
movq 0x8(%r14), %r13
cmpq %r13, %rdx
jne 0x23953
testq %rdx, %rdx
je 0x23ba1
movq (%r14), %rsi
movq (%rbp), %rdi
callq 0x42b0
testl %eax, %eax
je 0x23ba1
leaq 0x68(%r12), %rax
addq $0x28, %r12
movq 0x50(%rsp), %rsi
cmpq 0x28(%rsi), %r12
movq %rax, %r12
leaq 0x14c4e(%rip), %rbp     # 0x385bd
jne 0x23796
movq 0x80(%rsi), %rdx
testq %rdx, %rdx
je 0x23a42
leaq 0x108(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x78(%rsi), %rsi
addq %rsi, %rdx
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
callq 0xc7aa
movq 0x28(%rsp), %r12
leaq 0x10(%r12), %rdx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x2bb9e
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x239dd
movq 0x108(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xe8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %r14
movq %r14, %rdi
callq 0xc7aa
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2373a
movl %eax, %r13d
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23bc7
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x23bc7
xorl %r13d, %r13d
jmp 0x23bc7
movq 0x60(%rsi), %rdx
testq %rdx, %rdx
movq 0x28(%rsp), %rbp
movb $0x1, %r13b
je 0x23bc7
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x58(%rsi), %rsi
addq %rsi, %rdx
leaq 0xb8(%rsp), %r12
movq %r12, %rdi
callq 0xc7aa
leaq 0x10(%rbp), %rbx
movq %rbp, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x2bb9e
movq %rax, %r12
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23aac
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0xa8(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %r13
movq %r13, %rdi
callq 0xc7aa
movq %rbp, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2373a
movl %eax, %r13d
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0x23b00
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x88(%rsp), %r12
movq %r12, -0x10(%r12)
movq 0x50(%rsp), %rax
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %r15
movq %r15, %rdi
callq 0xc7aa
movq %rbp, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2bb9e
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x23b55
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x68(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0xc7aa
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2373a
movl %eax, %ebx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x23b9c
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x42a0
andb %bl, %r13b
jmp 0x23bc7
movq 0x28(%rsp), %rbx
leaq 0xb8(%rbx), %rdi
addq $-0x40, %r12
movq %r12, %rsi
callq 0x24168
addq $0xc0, %rbx
cmpq %rbx, %rax
sete %r13b
movl %r13d, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x58(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c9e
movq 0x68(%rsp), %rsi
jmp 0x23c96
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r12, %rdi
je 0x23c9e
movq 0x88(%rsp), %rsi
jmp 0x23c96
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c9e
movq 0xa8(%rsp), %rsi
jmp 0x23c96
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c9e
movq 0xc8(%rsp), %rsi
jmp 0x23c96
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c9e
movq 0xe8(%rsp), %rsi
jmp 0x23c96
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23c9e
movq 0x108(%rsp), %rsi
jmp 0x23c96
jmp 0x23c7f
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x23c9e
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0