// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_cfg.cpp
// Function: spirv_cross::CFG::post_order_visit(unsigned int)
bool CFG::post_order_visit(uint32_t block_id)
{
	// If we have already branched to this block (back edge), stop recursion.
	// If our branches are back-edges, we do not record them.
	// We have to record crossing edges however.
	if (visit_order[block_id] >= 0)
		return !is_back_edge(block_id);

	// Block back-edges from recursively revisiting ourselves.
	visit_order[block_id] = 0;

	// First visit our branch targets.
	auto &block = compiler.get<SPIRBlock>(block_id);
	switch (block.terminator)
	{
	case SPIRBlock::Direct:
		if (post_order_visit(block.next_block))
			add_branch(block_id, block.next_block);
		break;

	case SPIRBlock::Select:
		if (post_order_visit(block.true_block))
			add_branch(block_id, block.true_block);
		if (post_order_visit(block.false_block))
			add_branch(block_id, block.false_block);
		break;

	case SPIRBlock::MultiSelect:
		for (auto &target : block.cases)
		{
			if (post_order_visit(target.block))
				add_branch(block_id, target.block);
		}
		if (block.default_block && post_order_visit(block.default_block))
			add_branch(block_id, block.default_block);
		break;

	default:
		break;
	}

	// If this is a loop header, add an implied branch to the merge target.
	// This is needed to avoid annoying cases with do { ... } while(false) loops often generated by inliners.
	// To the CFG, this is linear control flow, but we risk picking the do/while scope as our dominating block.
	// This makes sure that if we are accessing a variable outside the do/while, we choose the loop header as dominator.
	if (block.merge == SPIRBlock::MergeLoop)
		add_branch(block_id, block.merge_block);

	// Then visit ourselves. Start counting at one, to let 0 be a magic value for testing back vs. crossing edges.
	visit_order[block_id] = ++visit_count;
	post_order.push_back(block_id);
	return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %esi, 0x4(%rsp)
movl %esi, %eax
movq 0x58(%rdi), %rcx
cmpl $0x0, (%rcx,%rax,4)
js 0x749c
setne %al
jmp 0x75e3
movq %rdi, %rbx
movl $0x0, (%rcx,%rax,4)
movq (%rdi), %rdi
movl 0x4(%rsp), %esi
callq 0x78fe
movq %rax, %r14
movl 0xc(%rax), %eax
cmpl $0x3, %eax
je 0x7526
cmpl $0x2, %eax
je 0x74ec
cmpl $0x1, %eax
jne 0x7583
movl 0x18(%r14), %esi
movq %rbx, %rdi
callq 0x747c
testb %al, %al
je 0x7583
movl 0x4(%rsp), %esi
movl 0x18(%r14), %edx
jmp 0x757b
movl 0x2c(%r14), %esi
movq %rbx, %rdi
callq 0x747c
testb %al, %al
je 0x750c
movl 0x4(%rsp), %esi
movl 0x2c(%r14), %edx
movq %rbx, %rdi
callq 0x75f0
movl 0x30(%r14), %esi
movq %rbx, %rdi
callq 0x747c
testb %al, %al
je 0x7583
movl 0x4(%rsp), %esi
movl 0x30(%r14), %edx
jmp 0x757b
movq 0x98(%r14), %r15
movq 0xa0(%r14), %r12
cmpq %r12, %r15
je 0x755f
movl 0x4(%r15), %esi
movq %rbx, %rdi
callq 0x747c
testb %al, %al
je 0x7559
movl 0x4(%rsp), %esi
movl 0x4(%r15), %edx
movq %rbx, %rdi
callq 0x75f0
addq $0x8, %r15
jmp 0x7534
movl 0x34(%r14), %esi
testl %esi, %esi
je 0x7583
movq %rbx, %rdi
callq 0x747c
testb %al, %al
je 0x7583
movl 0x4(%rsp), %esi
movl 0x34(%r14), %edx
movq %rbx, %rdi
callq 0x75f0
cmpl $0x1, 0x10(%r14)
jne 0x759a
movl 0x4(%rsp), %esi
movl 0x1c(%r14), %edx
movq %rbx, %rdi
callq 0x75f0
movl 0x88(%rbx), %eax
incl %eax
movl %eax, 0x88(%rbx)
movl 0x4(%rsp), %ecx
movq 0x58(%rbx), %rdx
movl %eax, (%rdx,%rcx,4)
movq 0x78(%rbx), %rsi
cmpq 0x80(%rbx), %rsi
je 0x75d0
movl 0x4(%rsp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rbx)
jmp 0x75e1
addq $0x70, %rbx
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x7a00
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop