// File: rossy[P]crossc/SPIRV-Cross/spirv_cfg.cpp
// Function: spirv_cross::CFG::build_immediate_dominators()
void CFG::build_immediate_dominators()
{
	// Traverse the post-order in reverse and build up the immediate dominator tree.
	fill(begin(immediate_dominators), end(immediate_dominators), 0);
	immediate_dominators[func.entry_block] = func.entry_block;

	for (auto i = post_order.size(); i; i--)
	{
		uint32_t block = post_order[i - 1];
		auto &pred = preceding_edges[block];
		if (pred.empty()) // This is for the entry block, but we've already set up the dominators.
			continue;

		for (auto &edge : pred)
		{
			if (immediate_dominators[block])
			{
				assert(immediate_dominators[edge]);
				immediate_dominators[block] = find_common_dominator(block, edge);
			}
			else
				immediate_dominators[block] = edge;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x60(%rbp)
addq $0x40, %rdi
callq 0x85d0
movq -0x60(%rbp), %rdi
movq %rax, -0x10(%rbp)
addq $0x40, %rdi
callq 0x8600
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x8590
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rcx
movl 0x60(%rcx), %ecx
movl %ecx, -0x64(%rbp)
movq %rax, %rdi
addq $0x40, %rdi
movq 0x8(%rax), %rax
movl 0x60(%rax), %eax
movl %eax, %esi
callq 0x8630
movl -0x64(%rbp), %ecx
movq -0x60(%rbp), %rdi
movl %ecx, (%rax)
addq $0x70, %rdi
callq 0x8650
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x7bda
movq -0x60(%rbp), %rdi
addq $0x70, %rdi
movq -0x28(%rbp), %rsi
subq $0x1, %rsi
callq 0x8630
movq -0x60(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
addq $0x10, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x8670
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x8690
testb $0x1, %al
jne 0x7acd
jmp 0x7ad2
jmp 0x7bc9
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x86d0
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rdi
callq 0x8700
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x8730
testb $0x1, %al
jne 0x7b0a
jmp 0x7bc7
leaq -0x48(%rbp), %rdi
callq 0x8770
movq -0x60(%rbp), %rdi
movq %rax, -0x58(%rbp)
addq $0x40, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x8630
cmpl $0x0, (%rax)
je 0x7b97
movq -0x60(%rbp), %rdi
addq $0x40, %rdi
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, %esi
callq 0x8630
cmpl $0x0, (%rax)
je 0x7b4a
jmp 0x7b69
leaq 0x1364bf(%rip), %rdi    # 0x13e010
leaq 0x1364d3(%rip), %rsi    # 0x13e02b
movl $0x44, %edx
leaq 0x1364e1(%rip), %rcx    # 0x13e045
callq 0x7260
movq -0x60(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x58(%rbp), %rax
movl (%rax), %edx
callq 0x7be0
movq -0x60(%rbp), %rdi
movl %eax, -0x68(%rbp)
addq $0x40, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x8630
movl -0x68(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x7bb7
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x6c(%rbp)
addq $0x40, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %esi
callq 0x8630
movl -0x6c(%rbp), %ecx
movl %ecx, (%rax)
jmp 0x7bb9
leaq -0x48(%rbp), %rdi
callq 0x8790
jmp 0x7af4
jmp 0x7bc9
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x7a83
addq $0x70, %rsp
popq %rbp
retq