// File: /workspace/github_cpp_makefile_star2_O2/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 $0xb8, %rsp
movq %rsi, %r13
leaq 0x60(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movq %rdi, 0x8(%rsp)
movq (%rsi), %rsi
movq (%rsi), %rax
movq %rax, 0x18(%rsp)
leaq 0x58(%rsp), %rdi
callq 0x50cda
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0x5167a
movq (%r13), %rax
movq 0x8(%r13), %rcx
pushq $0x1
popq %r14
leaq 0x58(%rsp), %rbx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r14, %rdx
jbe 0x4e64f
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
cmpq %r12, %rdx
jbe 0x4e64a
leaq (%rax,%r14,8), %rsi
movq %rbx, %rdi
callq 0x50cda
movq (%r13), %rsi
addq %r15, %rsi
movq %rax, %rdi
callq 0xdd4a
incq %r12
movq (%r13), %rax
movq 0x8(%r13), %rcx
addq $0x8, %r15
jmp 0x4e60f
incq %r14
jmp 0x4e5fa
movq %r13, 0x10(%rsp)
leaq 0x58(%rsp), %r15
leaq 0x88(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq 0x10(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, 0x30(%rsp)
movl $0x0, (%rsp)
cmpq 0x30(%rsp), %rbx
je 0x4e7a8
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
movq 0x8(%rax), %rcx
subq (%rax), %rcx
movq %rcx, 0x38(%rsp)
movq (%rbx), %rax
movq 0x30(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x4e6c5
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x4e6c5
movq %rcx, 0x8(%rax)
movq (%rbx), %rax
movq 0x28(%rax), %r14
movq 0x30(%rax), %r12
cmpq %r12, %r14
je 0x4e749
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
leaq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0x50d2a
movq %r15, %rdi
movq %r14, %rsi
callq 0x50cda
movq %r13, %rdi
movq %rax, %rsi
callq 0x50d2a
movq %rbp, %rdi
leaq 0x40(%rsp), %rsi
movq %r13, %rdx
callq 0x4df9c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
movq %rax, %rdi
movq %rbp, %rsi
callq 0x517d6
movq %rbp, %rdi
callq 0x1ff9a
movq %r13, %rdi
callq 0x1ff9a
leaq 0x40(%rsp), %rdi
callq 0x1ff9a
addq $0x8, %r14
jmp 0x4e6d0
movq (%rbx), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
cmpq (%rcx), %rax
je 0x4e76f
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
movq %rax, %rdi
movq %rbx, %rsi
callq 0xdd4a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x50cda
movq 0x38(%rsp), %rcx
shrq $0x3, %rcx
movslq %ecx, %rcx
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
cmpq %rdx, %rcx
setne %al
movl (%rsp), %ecx
orb %al, %cl
movl %ecx, (%rsp)
addq $0x8, %rbx
jmp 0x4e67e
testb $0x1, (%rsp)
jne 0x4e666
xorps %xmm0, %xmm0
movq 0x8(%rsp), %rax
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rbx
movq 0x8(%rax), %rax
movq %rax, (%rsp)
leaq 0xa0(%rsp), %r15
cmpq (%rsp), %rbx
je 0x4e852
movq (%rbx), %rax
movq 0x40(%rax), %r12
movq 0x48(%rax), %r14
cmpq %r14, %r12
je 0x4e84c
movq (%r12), %r13
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x50cda
movq %r15, %rdi
movq %rax, %rsi
callq 0x50d2a
movq %r13, %rdi
movq %r15, %rsi
callq 0x50d77
movl %eax, %ebp
movq %r15, %rdi
callq 0x1ff9a
testb %bpl, %bpl
je 0x4e846
movq (%rbx), %rax
movq (%r12), %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x5185c
addq $0x8, %r12
jmp 0x4e7eb
addq $0x8, %rbx
jmp 0x4e7da
leaq 0x58(%rsp), %rdi
callq 0x50dec
movq 0x8(%rsp), %rax
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e8ab
jmp 0x4e877
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x51828
jmp 0x4e8bd
jmp 0x4e8ab
jmp 0x4e8ab
movq %rax, %rbx
jmp 0x4e89c
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x1ff9a
leaq 0x88(%rsp), %rdi
callq 0x1ff9a
jmp 0x4e8b3
movq %rax, %rbx
jmp 0x4e8bd
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x1ff9a
leaq 0x58(%rsp), %rdi
callq 0x50dec
movq %rbx, %rdi
callq 0x84d0