// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rdi, (%rsp)
leaq 0x30(%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 0x28(%rsp), %rdi
callq 0x68bb2
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x69442
movq 0x8(%r13), %rax
subq (%r13), %rax
cmpq $0x9, %rax
movq %r13, 0x8(%rsp)
jb 0x646e9
movl $0x1, %ebx
leaq 0x28(%rsp), %r15
movq (%r13), %rax
cmpq %rax, 0x8(%r13)
je 0x646d5
xorl %r14d, %r14d
xorl %r12d, %r12d
leaq (%rax,%rbx,8), %rsi
movq %r15, %rdi
callq 0x68bb2
movq (%r13), %rdx
addq %r14, %rdx
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x646b2
movq (%rdx), %rcx
movq %rcx, (%rsi)
addq $0x8, 0x8(%rax)
jmp 0x646ba
movq %rax, %rdi
callq 0x11b10
incq %r12
movq (%r13), %rax
movq 0x8(%r13), %rcx
subq %rax, %rcx
sarq $0x3, %rcx
addq $0x8, %r14
cmpq %r12, %rcx
ja 0x64688
incq %rbx
movq 0x8(%r13), %rax
subq (%r13), %rax
sarq $0x3, %rax
cmpq %rbx, %rax
ja 0x64678
movq (%r13), %r15
movq 0x8(%r13), %rax
movq %rax, 0x58(%rsp)
cmpq %rax, %r15
je 0x64888
xorl %ebx, %ebx
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
movq 0x8(%rax), %rbp
subq (%rax), %rbp
movq (%r15), %rax
movq 0x30(%rax), %rcx
cmpq 0x28(%rax), %rcx
jne 0x6473c
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x6473c
movq %rcx, 0x8(%rax)
movq (%r15), %rax
movq 0x28(%rax), %r12
movq 0x30(%rax), %r14
cmpq %r14, %r12
je 0x64805
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
leaq 0x78(%rsp), %rdi
movq %rax, %rsi
callq 0x68c18
leaq 0x28(%rsp), %rdi
movq %r12, %rsi
callq 0x68bb2
leaq 0x60(%rsp), %rdi
movq %rax, %rsi
callq 0x68c18
leaq 0x10(%rsp), %rdi
leaq 0x78(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x63bd8
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
leaq 0x10(%rsp), %r13
movq %rax, %rdi
movq %r13, %rsi
callq 0x6953a
movq (%r13), %rdi
testq %rdi, %rdi
je 0x647cb
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x647e2
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x647fc
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
addq $0x8, %r12
jmp 0x64747
movq (%r15), %rax
movq 0x8(%rsp), %rcx
movq (%rcx), %rcx
cmpq (%rcx), %rax
je 0x64844
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x64839
movq (%r15), %rcx
movq %rcx, (%rsi)
addq $0x8, 0x8(%rax)
jmp 0x64844
movq %rax, %rdi
movq %r15, %rdx
callq 0x11b10
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
shrq $0x3, %rbp
movslq %ebp, %rcx
movq 0x8(%rax), %rdx
subq (%rax), %rdx
sarq $0x3, %rdx
cmpq %rdx, %rcx
setne %al
orb %al, %bl
addq $0x8, %r15
cmpq 0x58(%rsp), %r15
jne 0x64701
testb $0x1, %bl
movq 0x8(%rsp), %r13
jne 0x646e9
xorps %xmm0, %xmm0
movq (%rsp), %rax
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
movq (%r13), %r15
movq 0x8(%r13), %rax
movq %rax, 0x8(%rsp)
cmpq %rax, %r15
je 0x64989
leaq 0x90(%rsp), %r12
movq (%r15), %rax
movq 0x40(%rax), %rbp
movq 0x48(%rax), %rbx
cmpq %rbx, %rbp
je 0x6497a
movq (%rbp), %r13
leaq 0x28(%rsp), %rdi
movq %r15, %rsi
callq 0x68bb2
movq %r12, %rdi
movq %rax, %rsi
callq 0x68c18
movq 0x90(%rsp), %rdi
movq 0x98(%rsp), %rax
cmpq %rax, %rdi
setne %r14b
je 0x6491f
cmpq %r13, (%rdi)
je 0x6491f
leaq 0x8(%rdi), %rcx
cmpq %rax, %rcx
setne %r14b
je 0x6491f
leaq 0x8(%rcx), %rdx
cmpq %r13, (%rcx)
movq %rdx, %rcx
jne 0x6490a
testq %rdi, %rdi
je 0x64934
movq 0xa0(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
testb %r14b, %r14b
je 0x64971
movq (%r15), %rax
movq (%rbp), %rcx
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq (%rsp), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x64967
movups 0x10(%rsp), %xmm0
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rdi)
jmp 0x64971
leaq 0x10(%rsp), %rdx
callq 0x69572
addq $0x8, %rbp
jmp 0x648c3
addq $0x8, %r15
cmpq 0x8(%rsp), %r15
jne 0x648b8
leaq 0x28(%rsp), %rdi
callq 0x68c98
movq (%rsp), %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x649fe
jmp 0x649af
jmp 0x649fe
movq %rax, %r14
movq (%rsp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x64a20
movq 0x10(%rax), %rsi
jmp 0x64a18
jmp 0x649fe
movq %rax, %r14
jmp 0x649e5
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x649e5
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x64a06
movq 0x70(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
jmp 0x64a06
movq %rax, %r14
jmp 0x64a20
movq %rax, %r14
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x64a20
movq 0x88(%rsp), %rsi
subq %rdi, %rsi
callq 0x82a0
leaq 0x28(%rsp), %rdi
callq 0x68c98
movq %r14, %rdi
callq 0x8540