// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::branch(unsigned int, unsigned int, unsigned int, unsigned int)
void CompilerGLSL::branch(uint32_t from, uint32_t cond, uint32_t true_block, uint32_t false_block)
{
	// If we branch directly to a selection merge target, we don't really need a code path.
	bool true_sub = !is_conditional(true_block);
	bool false_sub = !is_conditional(false_block);

	if (true_sub)
	{
		emit_block_hints(get<SPIRBlock>(from));
		statement("if (", to_expression(cond), ")");
		begin_scope();
		branch(from, true_block);
		end_scope();

		if (false_sub || is_continue(false_block) || is_break(false_block))
		{
			statement("else");
			begin_scope();
			branch(from, false_block);
			end_scope();
		}
		else if (flush_phi_required(from, false_block))
		{
			statement("else");
			begin_scope();
			flush_phi(from, false_block);
			end_scope();
		}
	}
	else if (false_sub && !true_sub)
	{
		// Only need false path, use negative conditional.
		emit_block_hints(get<SPIRBlock>(from));
		statement("if (!", to_enclosed_expression(cond), ")");
		begin_scope();
		branch(from, false_block);
		end_scope();

		if (is_continue(true_block) || is_break(true_block))
		{
			statement("else");
			begin_scope();
			branch(from, true_block);
			end_scope();
		}
		else if (flush_phi_required(from, true_block))
		{
			statement("else");
			begin_scope();
			flush_phi(from, true_block);
			end_scope();
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edx, %r12d
movl %esi, %ebp
movq %rdi, %rbx
movl %ecx, %r13d
movq 0x80(%rdi), %rax
testb $0x18, (%rax,%r13)
movl %r8d, %r14d
movb (%rax,%r14), %r15b
je 0x4ea2f
testb $0x18, %r15b
jne 0x4eb0f
movl %ecx, (%rsp)
movl %r8d, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7870
movq (%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq *0x158(%rcx)
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x34600
leaq 0x6c06f(%rip), %rsi     # 0xbaa04
leaq 0x6c079(%rip), %rcx     # 0xbaa15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x58dc4
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4e9c2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x6c20e(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4e7dc
movq %rbx, %rdi
callq 0x42d5a
movq 0x80(%rbx), %rax
testb $0x16, (%rax,%r13)
je 0x4eb1e
leaq 0x67e1e(%rip), %rsi     # 0xb6823
movq %rbx, %rdi
callq 0x58cbe
leaq 0x6c1c3(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %edx
jmp 0x4eb02
movl %ecx, (%rsp)
movl %r8d, 0x4(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x7870
movq (%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rsi
callq *0x158(%rcx)
leaq 0x8(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq 0x33f8a
leaq 0x6bf95(%rip), %rsi     # 0xba9ff
leaq 0x6bfa4(%rip), %rcx     # 0xbaa15
movq %rbx, %rdi
movq %r13, %rdx
callq 0x58b5c
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ea97
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x6c139(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %edx
callq 0x4e7dc
movq %rbx, %rdi
callq 0x42d5a
testb $0x18, %r15b
je 0x4ead5
movq 0x80(%rbx), %rax
testb $0x16, (%rax,%r14)
je 0x4eb45
leaq 0x67d47(%rip), %rsi     # 0xb6823
movq %rbx, %rdi
callq 0x58cbe
leaq 0x6c0ec(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl 0x4(%rsp), %edx
callq 0x4e7dc
movq %rbx, %rdi
callq 0x42d5a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl (%rsp), %r15d
movl %r15d, %esi
callq 0x7870
movq 0x50(%rax), %rcx
movq 0x58(%rax), %rax
cmpq %rax, %rcx
je 0x4eb0f
cmpl %ebp, 0x4(%rcx)
je 0x4eb6d
addq $0xc, %rcx
jmp 0x4eb35
movq %rbx, %rdi
movl 0x4(%rsp), %r14d
movl %r14d, %esi
callq 0x7870
movq 0x50(%rax), %rcx
movq 0x58(%rax), %rax
cmpq %rax, %rcx
je 0x4eb0f
cmpl %ebp, 0x4(%rcx)
je 0x4eb9b
addq $0xc, %rcx
jmp 0x4eb5d
leaq 0x67caf(%rip), %rsi     # 0xb6823
movq %rbx, %rdi
callq 0x58cbe
leaq 0x6c054(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl %r15d, %edx
jmp 0x4ebc7
leaq 0x67c81(%rip), %rsi     # 0xb6823
movq %rbx, %rdi
callq 0x58cbe
leaq 0x6c026(%rip), %rsi     # 0xbabd7
movq %rbx, %rdi
callq 0x59e02
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4e47c
jmp 0x4eb07
jmp 0x4ebd3
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ebf1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop