// File: /workspace/github_cpp_makefile_star2_O3/luooofan[P]hblzbd_compiler/src/Pass/loop_unroll.cpp
// Function: find_back(std::vector<IRBasicBlock*, std::allocator<IRBasicBlock*>>)
vector<pair<IRBasicBlock*, IRBasicBlock*> > find_back(vector<IRBasicBlock*> bb_list) {
  // 计算必经节点集
  map<IRBasicBlock*, vector<IRBasicBlock*> > dom;
  dom[bb_list[0]] = {bb_list[0]};
  for (int i = 1; i < bb_list.size(); i++) {
    for (int j = 0; j < bb_list.size(); j++) dom[bb_list[i]].push_back(bb_list[j]);
  }
  bool flag = true;
  while (flag) {
    flag = false;
    for (auto& bb : bb_list) {
      int last = dom[bb].size();
      if (bb->pred_.size() == 0) dom[bb].clear();
      for (auto& pred : bb->pred_) dom[bb] = cross(dom[bb], dom[pred]);
      if (bb != bb_list[0]) dom[bb].push_back(bb);
      flag |= (last != dom[bb].size());
    }
  }

  // 计算回边
  vector<pair<IRBasicBlock*, IRBasicBlock*> > back;
  for (auto& bb : bb_list) {
    for (auto& suc : bb->succ_) {
      if (have(suc, dom[bb])) back.push_back(make_pair(bb, suc));
    }
  }
  return back;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
leaq 0x38(%rsp), %rax
movl $0x0, (%rax)
xorl %ecx, %ecx
movq %rcx, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq (%rsi), %rsi
movq (%rsi), %rax
movq %rax, 0x10(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x67e04
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x6867e
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
cmpq $0x9, %rdx
jb 0x63956
movl $0x1, %ebx
leaq 0x30(%rsp), %r15
cmpq %rax, %rcx
je 0x63956
xorl %r12d, %r12d
xorl %r13d, %r13d
leaq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x67e04
movq (%r14), %rdx
addq %r12, %rdx
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x63929
movq (%rdx), %rcx
movq %rcx, (%rsi)
addq $0x8, 0x8(%rax)
jmp 0x63931
movq %rax, %rdi
callq 0x117de
incq %r13
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
addq $0x8, %r12
cmpq %r13, %rdx
ja 0x63900
incq %rbx
cmpq %rbx, %rdx
ja 0x638f5
movq (%r14), %r15
movq 0x8(%r14), %rax
movq %rax, 0x28(%rsp)
cmpq %rax, %r15
je 0x63c18
xorl %ebp, %ebp
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
movq 0x8(%rax), %rbx
subq (%rax), %rbx
movq (%r15), %rax
movq 0x30(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x639a8
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x639a8
movq %rcx, 0x8(%rax)
movq (%r15), %rax
movq 0x28(%rax), %r12
movq 0x30(%rax), %r13
cmpq %r13, %r12
je 0x63a9f
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
leaq 0x78(%rsp), %rdi
movq %rax, %rsi
callq 0x67e6a
leaq 0x30(%rsp), %rdi
movq %r12, %rsi
callq 0x67e04
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x67e6a
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x62e4c
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
movq (%rax), %rdi
movq 0x10(%rax), %rsi
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%rax)
movq 0x20(%rsp), %rcx
movq %rcx, 0x10(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x63a5e
subq %rdi, %rsi
callq 0x82a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x63a5e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x63a75
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x63a8f
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
addq $0x8, %r12
cmpq %r13, %r12
jne 0x639bc
movq (%r15), %rax
movq (%r14), %rcx
cmpq (%rcx), %rax
je 0x63ad6
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x63acb
movq (%r15), %rcx
movq %rcx, (%rsi)
addq $0x8, 0x8(%rax)
jmp 0x63ad6
movq %rax, %rdi
movq %r15, %rdx
callq 0x117de
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
shrq $0x3, %rbx
movslq %ebx, %rcx
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
cmpq %rdx, %rcx
setne %al
orb %al, %bpl
addq $0x8, %r15
cmpq 0x28(%rsp), %r15
jne 0x6396d
testb $0x1, %bpl
jne 0x63956
movq (%r14), %r15
movq 0x8(%r14), %rcx
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq %rcx, 0x28(%rsp)
cmpq %rcx, %r15
je 0x63c2b
leaq 0x90(%rsp), %r12
movq (%r15), %rax
movq 0x40(%rax), %rbp
movq 0x48(%rax), %rbx
cmpq %rbx, %rbp
je 0x63c07
movq (%rbp), %r13
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
callq 0x67e04
movq %r12, %rdi
movq %rax, %rsi
callq 0x67e6a
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
cmpq %rax, %rdi
je 0x63ba8
leaq 0x8(%rdi), %rcx
cmpq %r13, -0x8(%rcx)
sete %r14b
je 0x63bab
leaq 0x8(%rcx), %rdx
cmpq %rax, %rcx
movq %rdx, %rcx
jne 0x63b90
jmp 0x63bab
xorl %r14d, %r14d
testq %rdi, %rdi
je 0x63bc0
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
testb %r14b, %r14b
je 0x63bfe
movq (%r15), %rax
movq (%rbp), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq 0x8(%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x63bf4
movups 0x10(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x63bfe
leaq 0x10(%rsp), %rdx
callq 0x68780
addq $0x8, %rbp
jmp 0x63b52
addq $0x8, %r15
cmpq 0x28(%rsp), %r15
jne 0x63b47
jmp 0x63c2b
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x30(%rsp), %rdi
callq 0x67eea
movq 0x8(%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x63ca2
jmp 0x63c52
jmp 0x63ca2
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x63cc4
movq 0x10(%rax), %rsi
jmp 0x63cbc
jmp 0x63ca2
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x63c89
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
jmp 0x63c89
movq %rax, %r14
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x63caa
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
jmp 0x63caa
movq %rax, %r14
jmp 0x63cc4
movq %rax, %r14
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x63cc4
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
leaq 0x30(%rsp), %rdi
callq 0x67eea
movq %r14, %rdi
callq 0x8540