// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x10(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5c300
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %edi
movl $0x8, %esi
callq 0x111a0
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x58(%rax), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x5c698
jmp 0x5c6b7
leaq 0x108bc(%rip), %rdi     # 0x6cf5b
leaq 0x108d3(%rip), %rsi     # 0x6cf79
movl $0x86, %edx
leaq 0x108d3(%rip), %rcx     # 0x6cf85
callq 0x11120
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x2c(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x5c6fa
jmp 0x5c8e1
jmp 0x5c6fc
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x48(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5c8c9
movq -0x48(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5c74e
cmpq $0x0, -0x38(%rbp)
jne 0x5c74e
jmp 0x5c8bb
movq -0x38(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x64(%rbp)
movq $0x0, -0x70(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x5c76f
jmp 0x5c8bb
jmp 0x5c771
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x78(%rbp)
jne 0x5c79c
jmp 0x5c868
jmp 0x5c79e
movl $0x0, -0x8c(%rbp)
movl -0x8c(%rbp), %eax
movq -0x80(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5c850
movq -0x80(%rbp), %rax
movslq -0x8c(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5c7f6
cmpq $0x0, -0x60(%rbp)
jne 0x5c7f6
jmp 0x5c83c
movq -0x60(%rbp), %rax
movl 0x58(%rax), %eax
movl %eax, -0x90(%rbp)
movq -0x18(%rbp), %rax
movl -0x90(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0x5c816
jmp 0x5c83c
cmpq $0x0, -0x70(%rbp)
jne 0x5c827
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x5c83c
movq -0x18(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x70(%rbp), %rdx
callq 0x5cc60
movq %rax, -0x70(%rbp)
movl -0x8c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8c(%rbp)
jmp 0x5c7a8
jmp 0x5c852
movq -0x80(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x80(%rbp)
cmpq -0x78(%rbp), %rax
jne 0x5c79e
cmpq $0x0, -0x70(%rbp)
je 0x5c871
jmp 0x5c890
leaq 0x10735(%rip), %rdi     # 0x6cfad
leaq 0x106fa(%rip), %rsi     # 0x6cf79
movl $0xa1, %edx
leaq 0x106fa(%rip), %rcx     # 0x6cf85
callq 0x11120
movq -0x18(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x70(%rbp), %rax
je 0x5c8b9
movq -0x70(%rbp), %rdx
movq -0x18(%rbp), %rax
movslq -0x64(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x1, -0x2c(%rbp)
jmp 0x5c8bb
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x5c703
jmp 0x5c8cb
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq -0x40(%rbp), %rax
jne 0x5c6fc
jmp 0x5c8e3
cmpl $0x0, -0x2c(%rbp)
jne 0x5c6cb
jmp 0x5c8ef
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0x98(%rbp)
jne 0x5c929
jmp 0x5c9cb
jmp 0x5c92b
movl $0x0, -0xac(%rbp)
movl -0xac(%rbp), %eax
movq -0xa0(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5c9aa
movq -0xa0(%rbp), %rax
movslq -0xac(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0xa0(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5c988
cmpq $0x0, -0x20(%rbp)
jne 0x5c988
jmp 0x5c999
jmp 0x5c98a
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
callq 0x31cd0
jmp 0x5c999
movl -0xac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
jmp 0x5c935
jmp 0x5c9ac
movq -0xa0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa0(%rbp)
cmpq -0x98(%rbp), %rax
jne 0x5c92b
jmp 0x5c9cd
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, -0xb8(%rbp)
jne 0x5ca07
jmp 0x5cae5
jmp 0x5ca09
movl $0x0, -0xcc(%rbp)
movl -0xcc(%rbp), %eax
movq -0xc0(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5cac4
movq -0xc0(%rbp), %rax
movslq -0xcc(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0xc0(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5ca6a
cmpq $0x0, -0x20(%rbp)
jne 0x5ca6a
jmp 0x5cab0
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x58(%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd8(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x5ca8d
jmp 0x5cab0
movq -0xd8(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0xd8(%rbp), %rdi
addq $0x40, %rdi
movq -0x20(%rbp), %rsi
callq 0x5cce0
movl -0xcc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xcc(%rbp)
jmp 0x5ca13
jmp 0x5cac6
movq -0xc0(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
cmpq -0xb8(%rbp), %rax
jne 0x5ca09
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xf0(%rbp)
cmpq $0x0, -0xe0(%rbp)
jne 0x5cb2b
jmp 0x5cc2a
jmp 0x5cb2d
movl $0x0, -0xf4(%rbp)
movl -0xf4(%rbp), %eax
movq -0xe8(%rbp), %rcx
movw (%rcx), %cx
shlw $0x8, %cx
sarw $0x8, %cx
movswl %cx, %ecx
cmpl %ecx, %eax
jge 0x5cc09
movq -0xe8(%rbp), %rax
movslq -0xf4(%rbp), %rcx
movq 0x18(%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0xe8(%rbp), %rax
movw (%rax), %ax
sarw $0x8, %ax
cwtl
cmpl $0x0, %eax
je 0x5cb8e
cmpq $0x0, -0x20(%rbp)
jne 0x5cb8e
jmp 0x5cbf5
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x100(%rbp)
cmpq $0x0, -0x100(%rbp)
je 0x5cbbc
movq -0x100(%rbp), %rax
movl 0x3c(%rax), %eax
addl $0x1, %eax
movl %eax, -0x108(%rbp)
jmp 0x5cbc6
xorl %eax, %eax
movl %eax, -0x108(%rbp)
jmp 0x5cbc6
movl -0x108(%rbp), %eax
movl %eax, -0x104(%rbp)
movl -0x104(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x3c(%rax)
movl -0x28(%rbp), %eax
cmpl -0x104(%rbp), %eax
jge 0x5cbf3
movl -0x104(%rbp), %eax
movl %eax, -0x28(%rbp)
jmp 0x5cbf5
movl -0xf4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xf4(%rbp)
jmp 0x5cb37
jmp 0x5cc0b
movq -0xe8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xe8(%rbp)
cmpq -0xe0(%rbp), %rax
jne 0x5cb2d
movl -0x28(%rbp), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x18(%rbp), %rdi
callq 0x11030
leaq 0x30545(%rip), %rax     # 0x8d18c
cmpl $0x0, (%rax)
je 0x5cc55
movq -0x8(%rbp), %rdi
callq 0x5cd10
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nop