// File: luooofan[P]hblzbd_compiler/src/Pass/dominant.cpp
// Function: ComputeDominance::AncestorWithLowestSemi(IRBasicBlock*)
ComputeDominance::BB* ComputeDominance::AncestorWithLowestSemi(ComputeDominance::BB* v) {
  MyAssert(ancestor.find(v) != ancestor.end());
  // 从a到v(included)这段已经算过了 存在best[v]里 compute min(dfnum[semi[y]])
  auto a = ancestor[v];
  MyAssert(nullptr != a);  // 不会出现a为空的情况 根节点不会被链入到ancestor中
  if (ancestor.find(a) != ancestor.end()) {
    // 把当前生成树森林中v的最小的祖先到a(included)这段也算了 存在best[a]里 即b
    auto b = AncestorWithLowestSemi(a);
    // 更新 使更新后从ancestor[a]到v(included)这段都算过 存在best[v]里
    ancestor[v] = ancestor[a];
    if (dfnum[semi[b]] < dfnum[semi[best[v]]]) {
      best[v] = b;
    }
  }
  return best[v];
}

// Assembly:
subq $0x78, %rsp
movq %rdi, 0x70(%rsp)
movq %rsi, 0x68(%rsp)
movq 0x70(%rsp), %rdi
movq %rdi, 0x30(%rsp)
addq $0xc0, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa5fd0
movq 0x30(%rsp), %rdi
movq %rax, 0x60(%rsp)
addq $0xc0, %rdi
callq 0xa6000
movq %rax, 0x58(%rsp)
leaq 0x60(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0xa5fb0
xorb $-0x1, %al
testb $0x1, %al
jne 0xa51bb
jmp 0xa5212
movq 0xa6e26(%rip), %rdi     # 0x14bfe8
leaq 0x54f2f(%rip), %rsi     # 0xfa0f8
callq 0x8330
movq %rax, %rdi
leaq 0x5876c(%rip), %rsi     # 0xfd944
callq 0x8330
movq %rax, %rdi
leaq 0x56203(%rip), %rsi     # 0xfb3ea
callq 0x8330
movq %rax, %rdi
movl $0x17, %esi
callq 0x8650
movq %rax, %rdi
movq 0xa6d7d(%rip), %rsi     # 0x14bf80
callq 0x8380
movl $0xff, %edi
callq 0x8460
movq 0x30(%rsp), %rdi
addq $0xc0, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa6030
movq (%rax), %rax
movq %rax, 0x50(%rsp)
xorl %eax, %eax
cmpq 0x50(%rsp), %rax
jne 0xa5290
movq 0xa6da8(%rip), %rdi     # 0x14bfe8
leaq 0x54eb1(%rip), %rsi     # 0xfa0f8
callq 0x8330
movq %rax, %rdi
leaq 0x586ee(%rip), %rsi     # 0xfd944
callq 0x8330
movq %rax, %rdi
leaq 0x56185(%rip), %rsi     # 0xfb3ea
callq 0x8330
movq %rax, %rdi
movl $0x1a, %esi
callq 0x8650
movq %rax, %rdi
movq 0xa6cff(%rip), %rsi     # 0x14bf80
callq 0x8380
movl $0xff, %edi
callq 0x8460
movq 0x30(%rsp), %rdi
addq $0xc0, %rdi
leaq 0x50(%rsp), %rsi
callq 0xa5fd0
movq 0x30(%rsp), %rdi
movq %rax, 0x48(%rsp)
addq $0xc0, %rdi
callq 0xa6000
movq %rax, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xa5fb0
testb $0x1, %al
jne 0xa52d9
jmp 0xa53db
movq 0x30(%rsp), %rdi
movq 0x50(%rsp), %rsi
callq 0xa5160
movq 0x30(%rsp), %rdi
movq %rax, 0x38(%rsp)
addq $0xc0, %rdi
leaq 0x50(%rsp), %rsi
callq 0xa6030
movq 0x30(%rsp), %rdi
movq (%rax), %rax
movq %rax, 0x8(%rsp)
addq $0xc0, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa6030
movq 0x8(%rsp), %rcx
movq 0x30(%rsp), %rdi
movq %rcx, (%rax)
movq %rdi, %rax
addq $0x50, %rax
movq %rax, 0x10(%rsp)
addq $0x130, %rdi            # imm = 0x130
leaq 0x38(%rsp), %rsi
callq 0xa6030
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0xa6060
movq 0x30(%rsp), %rdi
movl (%rax), %eax
movl %eax, 0x2c(%rsp)
movq %rdi, %rax
addq $0x50, %rax
movq %rax, 0x20(%rsp)
movq %rdi, %rax
addq $0x130, %rax            # imm = 0x130
movq %rax, 0x18(%rsp)
addq $0xf8, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa6030
movq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0xa6030
movq 0x20(%rsp), %rdi
movq %rax, %rsi
callq 0xa6060
movq %rax, %rcx
movl 0x2c(%rsp), %eax
cmpl (%rcx), %eax
jge 0xa53d9
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
movq %rax, (%rsp)
addq $0xf8, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa6030
movq (%rsp), %rcx
movq %rcx, (%rax)
jmp 0xa53db
movq 0x30(%rsp), %rdi
addq $0xf8, %rdi
leaq 0x68(%rsp), %rsi
callq 0xa6030
movq (%rax), %rax
addq $0x78, %rsp
retq
nopl (%rax)