// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flush_phi(unsigned int, unsigned int)
void CompilerGLSL::flush_phi(uint32_t from, uint32_t to)
{
	auto &child = get<SPIRBlock>(to);

	for (auto &phi : child.phi_variables)
	{
		if (phi.parent == from)
		{
			auto &var = get<SPIRVariable>(phi.function_variable);

			// A Phi variable might be a loop variable, so flush to static expression.
			if (var.loop_variable && !var.loop_variable_enable)
				var.static_expression = phi.local_variable;
			else
			{
				flush_variable_declaration(phi.function_variable);

				// This might be called in continue block, so make sure we
				// use this to emit ESSL 1.0 compliant increments/decrements.
				auto lhs = to_expression(phi.function_variable);
				auto rhs = to_expression(phi.local_variable);
				if (!optimize_read_modify_write(get<SPIRType>(var.basetype), lhs, rhs))
					statement(lhs, " = ", rhs, ";");
			}

			register_write(phi.function_variable);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x98(%rbp)
movl -0x10(%rbp), %esi
callq 0x87d0
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x50, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x40910
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x40940
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x40970
testb $0x1, %al
jne 0x997c8
jmp 0x99948
leaq -0x28(%rbp), %rdi
callq 0x409b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl 0x4(%rax), %eax
cmpl -0xc(%rbp), %eax
jne 0x99938
movq -0x98(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %esi
callq 0xfec0
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
testb $0x1, 0x64(%rax)
je 0x99822
movq -0x40(%rbp), %rax
testb $0x1, 0x65(%rax)
jne 0x99822
movq -0x38(%rbp), %rax
movl (%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x3c(%rax)
jmp 0x99925
movq -0x98(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x88710
movq -0x98(%rbp), %rsi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %edx
leaq -0x60(%rbp), %rdi
callq 0x71b50
movq -0x98(%rbp), %rsi
movq -0x38(%rbp), %rax
movl (%rax), %edx
leaq -0x80(%rbp), %rdi
callq 0x71b50
jmp 0x99864
movq -0x98(%rbp), %rdi
movq -0x40(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0xa0(%rbp)
jmp 0x99880
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdi
leaq -0x60(%rbp), %rdx
leaq -0x80(%rbp), %rcx
callq 0x88f40
movb %al, -0xa1(%rbp)
jmp 0x998a3
movb -0xa1(%rbp), %al
testb $0x1, %al
jne 0x99906
jmp 0x998af
movq -0x98(%rbp), %rdi
leaq 0xaf752(%rip), %rdx     # 0x14900f
leaq 0xaf7e2(%rip), %r8      # 0x1490a6
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rcx
callq 0xa4890
jmp 0x998d3
jmp 0x99906
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0x9991a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0x9991a
leaq -0x80(%rbp), %rdi
callq 0x7708
leaq -0x60(%rbp), %rdi
callq 0x7708
jmp 0x99925
leaq -0x60(%rbp), %rdi
callq 0x7708
jmp 0x99951
movq -0x98(%rbp), %rdi
movq -0x38(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x1fd60
jmp 0x9993a
leaq -0x28(%rbp), %rdi
callq 0x409d0
jmp 0x997b2
addq $0xb0, %rsp
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x7640
nopl (%rax)