// File: /workspace/github_cpp_makefile_star2_O3/luooofan[P]hblzbd_compiler/src/Pass/loop_invariant_extrapolation.cpp
// Function: check3(int, std::vector<std::vector<int, std::allocator<int>>, std::allocator<std::vector<int, std::allocator<int>>>>, std::vector<int, std::allocator<int>>, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::map<int, IRBasicBlock*, std::less<int>, std::allocator<std::pair<int const, IRBasicBlock*>>>, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int>>>)
bool check3(int enter, vector<vector<int> > to, vector<int> out, int def, string name, map<int, IRBasicBlock*> id_bb,
            vector<pair<int, int> > use)  // 这个入口节点直接用新建的那个基本块，好写
// enter用新建的那个空基本块作为入口，to就是图，out是出口节点，不能出去，因为有check2，所以def只会有1次，
//所以这里def是int，然后x的use情况
{
  queue<int> qqq;
  set<int> vis;
  qqq.push(enter);
  while (!qqq.empty()) {
    int x = qqq.front();
    qqq.pop();
    if (x == def) continue;  // 条件2保证只有1个def。此处是遇到def则可以了
    if (vis.find(x) != vis.end()) continue;
    auto bb = id_bb[x];
    for (int i = 0; i < bb->ir_list_.size(); i++) {
      auto op1 = bb->ir_list_[i]->opn1_.name_, op2 = bb->ir_list_[i]->opn2_.name_, res = bb->ir_list_[i]->res_.name_;
      if (op1 == name || op2 == name) return false;
      if (res == name) break;
    }
    vis.insert(x);
    for (int i = 0; i < to[x].size(); i++) {
      int y = to[x][i];
      if (vis.find(y) != vis.end()) continue;
      qqq.push(y);
    }
  }
  return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %r9, 0xb0(%rsp)
movq %r8, %r14
movl %ecx, 0x8(%rsp)
movq %rsi, 0xa8(%rsp)
movl %edi, %ebp
movl %edi, 0xc(%rsp)
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %r12
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
xorl %r15d, %r15d
movq %r12, %rdi
xorl %esi, %esi
callq 0x275f8
leaq 0xe0(%rsp), %rbx
movl $0x0, (%rbx)
movq %r15, 0x8(%rbx)
movq %rbx, 0x10(%rbx)
movq %rbx, 0x18(%rbx)
movq %r15, 0x20(%rbx)
movq 0x30(%r12), %rax
movq 0x40(%r12), %rcx
addq $-0x4, %rcx
cmpq %rcx, %rax
je 0x5ad1c
movl %ebp, (%rax)
addq $0x4, %rax
movq %rax, 0x80(%rsp)
jmp 0x5ad33
leaq 0x50(%rsp), %rdi
leaq 0xc(%rsp), %rsi
callq 0x2776e
movq 0x80(%rsp), %rax
movl 0x8(%rsp), %ebp
movq 0x60(%rsp), %rcx
cmpq %rcx, %rax
je 0x5b0aa
movl (%rcx), %eax
movl %eax, 0x4(%rsp)
movq 0x70(%rsp), %rdx
addq $-0x4, %rdx
cmpq %rdx, %rcx
je 0x5ad5f
addq $0x4, %rcx
jmp 0x5ad95
movq 0x68(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x82a0
movq 0x78(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x78(%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x68(%rsp)
leaq 0x200(%rcx), %rax
movq %rax, 0x70(%rsp)
movl 0x4(%rsp), %eax
movq %rcx, 0x60(%rsp)
cmpl %ebp, %eax
je 0x5b097
movq 0xe8(%rsp), %rdi
testq %rdi, %rdi
je 0x5ade8
movq %rbx, %r8
movq %r8, %rcx
movq %rdi, %rdx
movl 0x20(%rdi), %esi
xorl %edi, %edi
cmpl %eax, %esi
setl %dil
movq %rdx, %r8
cmovlq %rcx, %r8
movq 0x10(%rdx,%rdi,8), %rdi
testq %rdi, %rdi
jne 0x5adb2
cmpq %rbx, %r8
je 0x5ade8
cmpl %eax, %esi
cmovlq %rcx, %rdx
cmpl 0x20(%rdx), %eax
jge 0x5b097
movq 0xb0(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x605dc
movq (%rax), %rbp
movq 0x8(%rbp), %rax
cmpq %rax, 0x10(%rbp)
je 0x5afa2
xorl %r15d, %r15d
movq (%rax,%r15,8), %rax
leaq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movq 0x10(%rax), %rsi
movq 0x18(%rax), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0xc6dc
movq 0x8(%rbp), %rax
movq (%rax,%r15,8), %rax
leaq 0x40(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0x50(%rax), %rsi
movq 0x58(%rax), %rdx
addq %rsi, %rdx
leaq 0x30(%rsp), %rdi
callq 0xc6dc
movq 0x8(%rbp), %rax
movq (%rax,%r15,8), %rax
leaq 0xc8(%rsp), %rcx
movq %rcx, 0xb8(%rsp)
movq 0x90(%rax), %rsi
movq 0x98(%rax), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0xc6dc
movq 0x18(%rsp), %rdx
movq 0x8(%r14), %r12
cmpq %r12, %rdx
jne 0x5aeb2
testq %rdx, %rdx
je 0x5af04
movq (%r14), %rsi
movq 0x10(%rsp), %rdi
callq 0x82b0
testl %eax, %eax
je 0x5af04
cmpq %r12, 0x38(%rsp)
jne 0x5aed2
testq %r12, %r12
je 0x5af04
movq (%r14), %rsi
movq 0x30(%rsp), %rdi
movq %r12, %rdx
callq 0x82b0
testl %eax, %eax
je 0x5af04
cmpq %r12, 0xc0(%rsp)
jne 0x5af09
testq %r12, %r12
je 0x5af8e
movq (%r14), %rsi
movq 0xb8(%rsp), %rdi
movq %r12, %rdx
callq 0x82b0
testl %eax, %eax
sete %r13b
setne %r12b
jmp 0x5af0f
xorl %r12d, %r12d
jmp 0x5af0c
movb $0x1, %r12b
xorl %r13d, %r13d
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x5af34
movq 0xc8(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5af50
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5af6c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x82a0
testb %r12b, %r12b
je 0x5af99
incq %r15
movq 0x8(%rbp), %rax
movq 0x10(%rbp), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %r15, %rcx
ja 0x5ae0e
jmp 0x5afa2
movb $0x1, %r13b
xorl %r12d, %r12d
jmp 0x5af0f
testb %r13b, %r13b
je 0x5b08e
leaq 0xd8(%rsp), %rdi
leaq 0x4(%rsp), %rsi
callq 0x3a804
movl 0x8(%rsp), %ebp
movslq 0x4(%rsp), %rcx
movq 0xa8(%rsp), %r12
movq (%r12), %rax
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
je 0x5b097
xorl %r15d, %r15d
movl (%rcx,%r15,4), %ecx
movl %ecx, 0x10(%rsp)
movq 0xe8(%rsp), %r8
testq %r8, %r8
je 0x5b02b
movq %rbx, %r9
movq %r9, %rdx
movq %r8, %rsi
movl 0x20(%r8), %edi
xorl %r8d, %r8d
cmpl %ecx, %edi
setl %r8b
movq %rsi, %r9
cmovlq %rdx, %r9
movq 0x10(%rsi,%r8,8), %r8
testq %r8, %r8
jne 0x5aff7
cmpq %rbx, %r9
je 0x5b02b
cmpl %ecx, %edi
cmovlq %rdx, %rsi
cmpl 0x20(%rsi), %ecx
jge 0x5b067
movq 0x80(%rsp), %rdx
movq 0x90(%rsp), %rsi
addq $-0x4, %rsi
cmpq %rsi, %rdx
je 0x5b054
movl %ecx, (%rdx)
addq $0x4, %rdx
movq %rdx, 0x80(%rsp)
jmp 0x5b067
leaq 0x50(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x2776e
movq (%r12), %rax
incq %r15
movslq 0x4(%rsp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq (%rax,%rdx,8), %rcx
movq 0x8(%rax,%rdx,8), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r15, %rdx
ja 0x5afdf
jmp 0x5b097
testb %r12b, %r12b
movl 0x8(%rsp), %ebp
je 0x5b0d7
movq 0x60(%rsp), %rcx
cmpq %rcx, 0x80(%rsp)
jne 0x5ad45
movb $0x1, %bl
leaq 0xd8(%rsp), %rdi
callq 0x3b008
leaq 0x50(%rsp), %rdi
callq 0x26126
movl %ebx, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x5b0ac
jmp 0x5b123
jmp 0x5b123
jmp 0x5b123
movq %rax, %rbx
jmp 0x5b105
movq %rax, %rbx
movq 0x30(%rsp), %rdi
leaq 0x40(%rsp), %rax
cmpq %rax, %rdi
je 0x5b105
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x82a0
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x5b126
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x82a0
jmp 0x5b126
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x3b008
leaq 0x50(%rsp), %rdi
callq 0x26126
movq %rbx, %rdi
callq 0x8540