// File: /workspace/github_cpp_makefile_star2_O1/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, %bl
cmpb $0x0, 0x98(%rsi)
jne 0x23e63
movq %rdx, %r14
movq %rsi, %r13
movq %rdi, %rbp
movb $0x1, 0x98(%rsi)
movq 0x20(%rsi), %r12
cmpq 0x28(%rsi), %r12
sete %r15b
movq %rsi, 0x10(%rsp)
je 0x23c10
movq %rbp, 0x8(%rsp)
leaq 0x28(%rsp), %rbp
addq $0x40, %r12
leaq 0x15b95(%rip), %rbx     # 0x395bd
movq 0x8(%r12), %rdx
cmpq 0x8(%r14), %rdx
jne 0x23a50
testq %rdx, %rdx
je 0x23c07
movq (%r14), %rsi
movq (%r12), %rdi
callq 0x42b0
testl %eax, %eax
je 0x23c07
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5474
movq %r13, %rdi
leaq 0x14a97(%rip), %rsi     # 0x38504
callq 0x4510
movq %rbp, 0x18(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x23a95
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
jmp 0x23a9c
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x20(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq %r12, %rdi
xorl %edx, %edx
callq 0x44a0
movq %rax, %r13
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x23ae2
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x23afe
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42a0
cmpq $-0x1, %r13
jne 0x23c12
leaq 0x38(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5474
movq %r13, %rdi
leaq 0x149df(%rip), %rsi     # 0x38504
callq 0x4510
movq %rbp, 0x18(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x23b4d
movq %rdx, 0x18(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x28(%rsp)
jmp 0x23b54
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x20(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x20(%r12), %r13
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq %r13, %rdi
xorl %edx, %edx
callq 0x44a0
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x23b9f
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x42a0
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x23bbb
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42a0
cmpq $-0x1, %rbx
jne 0x23c12
movq -0x18(%r12), %rdx
cmpq 0x8(%r14), %rdx
jne 0x23be1
testq %rdx, %rdx
je 0x23c1b
movq (%r14), %rsi
movq (%r13), %rdi
callq 0x42b0
testl %eax, %eax
je 0x23c1b
leaq 0x68(%r12), %rax
addq $0x28, %r12
movq 0x10(%rsp), %r13
cmpq 0x28(%r13), %r12
sete %r15b
movq %rax, %r12
leaq 0x159bc(%rip), %rbx     # 0x395bd
jne 0x23a28
xorl %ebx, %ebx
movq 0x8(%rsp), %rbp
jmp 0x23c45
jmp 0x23c45
xorl %ebx, %ebx
movq 0x8(%rsp), %rbp
jmp 0x23c40
movq 0x8(%rsp), %rbp
leaq 0xb8(%rbp), %rdi
addq $-0x40, %r12
movq %r12, %rsi
callq 0x243bc
leaq 0xc0(%rbp), %rcx
cmpq %rcx, %rax
sete %bl
movq 0x10(%rsp), %r13
testb $0x1, %r15b
je 0x23e63
movq 0x80(%r13), %rdx
testq %rdx, %rdx
je 0x23d0d
leaq 0x108(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x78(%r13), %rsi
addq %rsi, %rdx
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
callq 0xca12
leaq 0x10(%rbp), %rdx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2be3a
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23cb1
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 0xca12
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x239cc
movl %eax, %ebx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23e63
movq 0xe8(%rsp), %rsi
incq %rsi
callq 0x42a0
jmp 0x23e63
movq 0x60(%r13), %rdx
movb $0x1, %bl
testq %rdx, %rdx
je 0x23e63
leaq 0xc8(%rsp), %r15
movq %r15, -0x10(%r15)
movq 0x58(%r13), %rsi
addq %rsi, %rdx
leaq 0xb8(%rsp), %rbx
movq %rbx, %rdi
callq 0xca12
leaq 0x10(%rbp), %r12
movq %rbp, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2be3a
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23d71
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 0xca12
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x239cc
movl %eax, %ebx
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0x23dc4
movq 0xa8(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x88(%rsp), %r13
movq %r13, -0x10(%r13)
movq 0x10(%rsp), %rax
movq 0x38(%rax), %rsi
movq 0x40(%rax), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %r15
movq %r15, %rdi
callq 0xca12
movq %rbp, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x2be3a
movq %rax, %r15
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x23e18
movq 0x88(%rsp), %rsi
incq %rsi
callq 0x42a0
leaq 0x68(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %r14
movq %r14, %rdi
callq 0xca12
movq %rbp, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x239cc
movl %eax, %ebp
movq 0x58(%rsp), %rdi
cmpq %r12, %rdi
je 0x23e60
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x42a0
andb %bpl, %bl
andb $0x1, %bl
movl %ebx, %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 %r12, %rdi
je 0x23f3c
movq 0x68(%rsp), %rsi
jmp 0x23f34
movq %rax, %rbx
movq 0x78(%rsp), %rdi
cmpq %r13, %rdi
je 0x23f3c
movq 0x88(%rsp), %rsi
jmp 0x23f34
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r15, %rdi
je 0x23f3c
movq 0xa8(%rsp), %rsi
jmp 0x23f34
movq %rax, %rbx
movq 0xb8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23f3c
movq 0xc8(%rsp), %rsi
jmp 0x23f34
movq %rax, %rbx
movq 0xd8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23f3c
movq 0xe8(%rsp), %rsi
jmp 0x23f34
movq %rax, %rbx
movq 0xf8(%rsp), %rdi
cmpq %r15, %rdi
je 0x23f3c
movq 0x108(%rsp), %rsi
jmp 0x23f34
jmp 0x23f1d
movq %rax, %rbx
movq 0x38(%rsp), %rdi
leaq 0x48(%rsp), %rax
cmpq %rax, %rdi
je 0x23f3c
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x42a0
movq %rbx, %rdi
callq 0x44c0