// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/flowgraph.c
// Function: domtree_build
void domtree_build(struct entrypoint *ep)
{
	struct basic_block *entry = ep->entry->bb;
	struct basic_block **doms;
	struct basic_block *bb;
	unsigned int size;
	int max_level = 0;
	int changed;

	// First calculate the (reverse) postorder.
	// This will give use us:
	//	- the links to do a reverse postorder traversal
	//	- the order number for each block
	size = cfg_postorder(ep);

	// initialize the dominators array
	doms = calloc(size, sizeof(*doms));
	assert(entry->postorder_nr == size-1);
	doms[size-1] = entry;

	do {
		struct basic_block *b;

		changed = 0;
		FOR_EACH_PTR(ep->bbs, b) {
			struct basic_block *p;
			int bnr = b->postorder_nr;
			struct basic_block *new_idom = NULL;

			if (b == entry)
				continue;	// ignore entry node

			FOR_EACH_PTR(b->parents, p) {
				unsigned int pnr = p->postorder_nr;
				if (!doms[pnr])
					continue;
				if (!new_idom) {
					new_idom = p;
					continue;
				}

				new_idom = intersect_dom(doms, p, new_idom);
			} END_FOR_EACH_PTR(p);

			assert(new_idom);
			if (doms[bnr] != new_idom) {
				doms[bnr] = new_idom;
				changed = 1;
			}
		} END_FOR_EACH_PTR(b);
	} while (changed);

	FOR_EACH_PTR(ep->bbs, bb) {
		free_ptr_list(&bb->doms);
	} END_FOR_EACH_PTR(bb);

	// set the idom links
	FOR_EACH_PTR(ep->bbs, bb) {
		struct basic_block *idom = doms[bb->postorder_nr];

		if (bb == entry)
			continue;	// ignore entry node

		bb->idom = idom;
		add_bb(&idom->doms, bb);
	} END_FOR_EACH_PTR(bb);
	entry->idom = NULL;

	// set the dominance levels
	FOR_EACH_PTR(ep->bbs, bb) {
		struct basic_block *idom = bb->idom;
		int level = idom ? idom->dom_level + 1 : 0;

		bb->dom_level = level;
		if (max_level < level)
			max_level = level;
	} END_FOR_EACH_PTR(bb);
	ep->dom_levels = max_level + 1;

	free(doms);
	if (dbg_domtree)
		debug_domtree(ep);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq 0x28(%rdi), %rax
movq 0x8(%rax), %r15
callq 0x3da98
movl %eax, %ebp
movl %eax, %edi
movl $0x8, %esi
callq 0xe1b0
decl %ebp
cmpl %ebp, 0x58(%r15)
jne 0x3e002
movq %rax, %r14
movl %ebp, %eax
movq %r15, (%r14,%rax,8)
movq %rbx, 0x8(%rsp)
movq 0x18(%rbx), %rax
movq %rax, (%rsp)
testq %rax, %rax
je 0x3de38
movq $0x0, 0x10(%rsp)
movq (%rsp), %rcx
movzwl (%rcx), %eax
movsbl %al, %edx
testw %dx, %dx
jle 0x3ddc7
movzwl %dx, %edx
movzwl %ax, %esi
xorl %edi, %edi
movq 0x18(%rcx,%rdi,8), %r8
cmpl $0x100, %esi            # imm = 0x100
jb 0x3dcf2
testq %r8, %r8
je 0x3ddbb
cmpq %r15, %r8
je 0x3ddbb
movq 0x18(%r8), %r9
testq %r9, %r9
je 0x3dd97
movq %r9, %r10
xorl %eax, %eax
movzwl (%r10), %r11d
movsbl %r11b, %ebx
testw %bx, %bx
jle 0x3dd82
movzwl %bx, %r13d
movzwl %r11w, %ebp
xorl %ebx, %ebx
movq 0x18(%r10,%rbx,8), %r11
cmpl $0x100, %ebp            # imm = 0x100
jb 0x3dd36
testq %r11, %r11
je 0x3dd72
movl 0x58(%r11), %r12d
cmpq $0x0, (%r14,%r12,8)
je 0x3dd72
testq %rax, %rax
je 0x3dd75
movl 0x58(%rax), %eax
cmpl %eax, %r12d
jne 0x3dd5b
jmp 0x3dd75
movslq %r12d, %r11
movq (%r14,%r11,8), %r11
movl 0x58(%r11), %r12d
cmpl %eax, %r12d
jl 0x3dd50
jmp 0x3dd6b
cltq
movq (%r14,%rax,8), %rax
movl 0x58(%rax), %eax
cmpl %r12d, %eax
jl 0x3dd62
jmp 0x3dd49
movq %rax, %r11
incq %rbx
movq %r11, %rax
cmpq %r13, %rbx
jne 0x3dd24
jmp 0x3dd85
movq %rax, %r11
movq 0x10(%r10), %r10
movq %r11, %rax
cmpq %r9, %r10
jne 0x3dd0d
jmp 0x3dd9a
xorl %r11d, %r11d
testq %r11, %r11
je 0x3dfe3
movslq 0x58(%r8), %rax
cmpq %r11, (%r14,%rax,8)
je 0x3ddbb
movq %r11, (%r14,%rax,8)
movl $0x1, %eax
movq %rax, 0x10(%rsp)
incq %rdi
cmpq %rdx, %rdi
jne 0x3dcdc
movq 0x10(%rcx), %rcx
cmpq (%rsp), %rcx
jne 0x3dcc5
movq (%rsp), %rcx
cmpl $0x0, 0x10(%rsp)
movl $0x0, %eax
movq %rax, 0x10(%rsp)
jne 0x3dcc5
cmpq $0x0, (%rsp)
je 0x3de38
movq (%rsp), %rbx
movzwl (%rbx), %eax
testb %al, %al
jle 0x3de2e
xorl %r12d, %r12d
movq 0x18(%rbx,%r12,8), %rdi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x3de17
testq %rdi, %rdi
je 0x3de20
addq $0x40, %rdi
callq 0x22cf3
incq %r12
movl (%rbx), %eax
movsbq %al, %rcx
cmpq %rcx, %r12
jl 0x3de03
movq 0x10(%rbx), %rbx
cmpq (%rsp), %rbx
jne 0x3ddf9
movq 0x8(%rsp), %rax
movq 0x18(%rax), %rbx
testq %rbx, %rbx
je 0x3dea3
movq %rbx, %r12
movzwl (%r12), %eax
testb %al, %al
jle 0x3de99
xorl %r13d, %r13d
movq 0x18(%r12,%r13,8), %rsi
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
setae %al
testq %rsi, %rsi
sete %cl
testb %cl, %al
jne 0x3de89
cmpq %r15, %rsi
je 0x3de89
movslq 0x58(%rsi), %rax
movq (%r14,%rax,8), %rdi
movq %rdi, 0x30(%rsi)
addq $0x40, %rdi
callq 0x2285b
incq %r13
movl (%r12), %eax
movsbq %al, %rcx
cmpq %rcx, %r13
jl 0x3de55
movq 0x10(%r12), %r12
cmpq %rbx, %r12
jne 0x3de49
movq $0x0, 0x30(%r15)
movq 0x8(%rsp), %r9
movq 0x18(%r9), %rcx
testq %rcx, %rcx
je 0x3df13
xorl %eax, %eax
movq %rcx, %rdx
movzwl (%rdx), %edi
testb %dil, %dil
jle 0x3df06
xorl %esi, %esi
movq 0x18(%rdx,%rsi,8), %r8
movzwl %di, %edi
cmpl $0x100, %edi            # imm = 0x100
jb 0x3dedd
testq %r8, %r8
je 0x3def8
movq 0x30(%r8), %rdi
testq %rdi, %rdi
je 0x3deed
movl 0x3c(%rdi), %edi
incl %edi
jmp 0x3deef
xorl %edi, %edi
movl %edi, 0x3c(%r8)
cmpl %edi, %eax
cmovlel %edi, %eax
incq %rsi
movl (%rdx), %edi
movsbq %dil, %r8
cmpq %r8, %rsi
jl 0x3dec8
movq 0x10(%rdx), %rdx
cmpq %rcx, %rdx
jne 0x3debe
incl %eax
jmp 0x3df18
movl $0x1, %eax
movl %eax, 0x30(%r9)
movq %r14, %rdi
callq 0xe030
leaq 0x29e81(%rip), %rax     # 0x67dac
cmpl $0x0, (%rax)
je 0x3dfd4
movq 0x8(%rsp), %rbx
movq (%rbx), %rax
movq 0x18(%rax), %rdi
callq 0x2e465
leaq 0xe3ca(%rip), %rdi      # 0x4c316
movq %rax, %rsi
xorl %eax, %eax
callq 0xe0f0
movq 0x18(%rbx), %rbx
testq %rbx, %rbx
je 0x3dfd4
leaq 0xe3bd(%rip), %r14      # 0x4c323
movq %rbx, %r13
movzwl (%r13), %eax
testb %al, %al
jle 0x3dfcb
xorl %ebp, %ebp
movq 0x18(%r13,%rbp,8), %r15
movzwl %ax, %eax
cmpl $0x100, %eax            # imm = 0x100
jb 0x3df88
testq %r15, %r15
je 0x3dfbb
movq 0x8(%rsp), %rax
movq 0x28(%rax), %rax
cmpq 0x8(%rax), %r15
je 0x3dfbb
movq %r15, %rdi
callq 0x12271
movq %rax, %r12
movq 0x30(%r15), %rdi
callq 0x12271
movq %r14, %rdi
movq %r12, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0xe0f0
incq %rbp
movl (%r13), %eax
movsbq %al, %rcx
cmpq %rcx, %rbp
jl 0x3df74
movq 0x10(%r13), %r13
cmpq %rbx, %r13
jne 0x3df69
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe2ff(%rip), %rdi      # 0x4c2e9
leaq 0xe2c4(%rip), %rsi      # 0x4c2b5
leaq 0xe2c9(%rip), %rcx      # 0x4c2c1
movl $0xa1, %edx
callq 0xe120
leaq 0xe28e(%rip), %rdi      # 0x4c297
leaq 0xe2a5(%rip), %rsi      # 0x4c2b5
leaq 0xe2aa(%rip), %rcx      # 0x4c2c1
movl $0x86, %edx
callq 0xe120