// File: /workspace/github_cpp_makefile_star2_O1/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 0x4f1f1
testb $0x18, %r15b
jne 0x4f2d5
movl %ecx, (%rsp)
movl %r8d, %r14d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78fe
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 0x34d0e
leaq 0x6c8bd(%rip), %rsi     # 0xbba14
leaq 0x6c8c7(%rip), %rcx     # 0xbba25
movq %rbx, %rdi
movq %r15, %rdx
callq 0x595be
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f184
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x6ca5c(%rip), %rsi     # 0xbbbe7
movq %rbx, %rdi
callq 0x5a5fc
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4ef9e
movq %rbx, %rdi
callq 0x4358a
movq 0x80(%rbx), %rax
testb $0x16, (%rax,%r13)
je 0x4f2e4
leaq 0x6866c(%rip), %rsi     # 0xb7833
movq %rbx, %rdi
callq 0x594b8
leaq 0x6ca11(%rip), %rsi     # 0xbbbe7
movq %rbx, %rdi
callq 0x5a5fc
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %edx
jmp 0x4f2c8
movl %ecx, (%rsp)
movl %r8d, 0x4(%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x78fe
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 0x345e6
leaq 0x6c7e3(%rip), %rsi     # 0xbba0f
leaq 0x6c7f2(%rip), %rcx     # 0xbba25
movq %rbx, %rdi
movq %r13, %rdx
callq 0x59356
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f259
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x6c987(%rip), %rsi     # 0xbbbe7
movq %rbx, %rdi
callq 0x5a5fc
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl (%rsp), %edx
callq 0x4ef9e
movq %rbx, %rdi
callq 0x4358a
testb $0x18, %r15b
je 0x4f29b
movq 0x80(%rbx), %rax
testb $0x16, (%rax,%r14)
je 0x4f326
leaq 0x68591(%rip), %rsi     # 0xb7833
movq %rbx, %rdi
callq 0x594b8
leaq 0x6c936(%rip), %rsi     # 0xbbbe7
movq %rbx, %rdi
callq 0x5a5fc
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl 0x4(%rsp), %edx
callq 0x4ef9e
movq %rbx, %rdi
callq 0x4358a
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl (%rsp), %esi
callq 0x78fe
movq 0x50(%rax), %rcx
movq 0x58(%rax), %rax
cmpq %rax, %rcx
setne %dl
je 0x4f31c
cmpl %ebp, 0x4(%rcx)
je 0x4f31c
addq $0xc, %rcx
cmpq %rax, %rcx
setne %dl
je 0x4f31c
leaq 0xc(%rcx), %rsi
cmpl %ebp, 0x4(%rcx)
movq %rsi, %rcx
jne 0x4f308
testb %dl, %dl
movl (%rsp), %r14d
jne 0x4f373
jmp 0x4f2d5
movq %rbx, %rdi
movl 0x4(%rsp), %esi
callq 0x78fe
movq 0x50(%rax), %rcx
movq 0x58(%rax), %rax
cmpq %rax, %rcx
setne %dl
je 0x4f366
cmpl %ebp, 0x4(%rcx)
movl 0x4(%rsp), %r14d
je 0x4f36b
addq $0xc, %rcx
cmpq %rax, %rcx
setne %dl
je 0x4f36b
leaq 0xc(%rcx), %rsi
cmpl %ebp, 0x4(%rcx)
movq %rsi, %rcx
jne 0x4f350
jmp 0x4f36b
movl 0x4(%rsp), %r14d
testb %dl, %dl
je 0x4f2d5
leaq 0x684b9(%rip), %rsi     # 0xb7833
movq %rbx, %rdi
callq 0x594b8
leaq 0x6c85e(%rip), %rsi     # 0xbbbe7
movq %rbx, %rdi
callq 0x5a5fc
incl 0x638(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x4ec3e
jmp 0x4f2cd
jmp 0x4f3ab
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4f3c9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop