// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_mix_op(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int)
void CompilerGLSL::emit_mix_op(uint32_t result_type, uint32_t id, uint32_t left, uint32_t right, uint32_t lerp)
{
	auto &lerptype = expression_type(lerp);
	auto &restype = get<SPIRType>(result_type);

	string mix_op;
	bool has_boolean_mix = backend.boolean_mix_support &&
	                       ((options.es && options.version >= 310) || (!options.es && options.version >= 450));
	bool trivial_mix = to_trivial_mix_op(restype, mix_op, left, right, lerp);

	// Cannot use boolean mix when the lerp argument is just one boolean,
	// fall back to regular trinary statements.
	if (lerptype.vecsize == 1)
		has_boolean_mix = false;

	// If we can reduce the mix to a simple cast, do so.
	// This helps for cases like int(bool), uint(bool) which is implemented with
	// OpSelect bool 1 0.
	if (trivial_mix)
	{
		emit_unary_func_op(result_type, id, lerp, mix_op.c_str());
	}
	else if (!has_boolean_mix && lerptype.basetype == SPIRType::Boolean)
	{
		// Boolean mix not supported on desktop without extension.
		// Was added in OpenGL 4.5 with ES 3.1 compat.
		//
		// Could use GL_EXT_shader_integer_mix on desktop at least,
		// but Apple doesn't support it. :(
		// Just implement it as ternary expressions.
		auto expr = to_ternary_expression(get<SPIRType>(result_type), lerp, right, left);
		emit_op(result_type, id, expr, should_forward(left) && should_forward(right) && should_forward(lerp));
		inherit_expression_dependencies(id, left);
		inherit_expression_dependencies(id, right);
		inherit_expression_dependencies(id, lerp);
	}
	else
		emit_trinary_func_op(result_type, id, left, right, lerp, "mix");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, %ebx
movl %r8d, 0x10(%rsp)
movl %ecx, %r12d
movl %edx, 0x14(%rsp)
movl %esi, %r13d
movq %rdi, %r14
movl %r9d, %esi
callq 0x12aba
movq %rax, %rbp
movq %r14, %rdi
movl %r13d, %esi
callq 0xa426
leaq 0x28(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq $0x0, -0x8(%rcx)
movb $0x0, (%rcx)
cmpb $0x1, 0x62a(%r14)
jne 0x3bca1
movb 0x43c(%r14), %cl
movl 0x438(%r14), %edx
cmpl $0x136, %edx            # imm = 0x136
setae %sil
movb $0x1, %r15b
testb %sil, %cl
jne 0x3bca4
cmpl $0x1c2, %edx            # imm = 0x1C2
setae %dl
notb %cl
andb %dl, %cl
movl %ecx, %r15d
jmp 0x3bca4
xorl %r15d, %r15d
leaq 0x18(%rsp), %rdx
movq %r14, %rdi
movq %rax, %rsi
movl %r12d, %ecx
movl 0x10(%rsp), %r8d
movl %ebx, %r9d
callq 0x35384
testb %al, %al
je 0x3bcde
movq 0x18(%rsp), %r8
movq %r14, %rdi
movl %r13d, %esi
movl 0x14(%rsp), %edx
movl %ebx, %ecx
callq 0x3a790
jmp 0x3bdc8
cmpl $0x1, 0x14(%rbp)
setne %al
testb %r15b, %al
jne 0x3bd44
cmpl $0x2, 0xc(%rbp)
jne 0x3bd44
movq %r14, %rdi
movl %r13d, %esi
callq 0xa426
leaq 0x38(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
movl %ebx, %ecx
movl 0x10(%rsp), %r8d
movl %r12d, %r9d
callq 0x3551e
movq %r14, %rdi
movl %r12d, %esi
callq 0x39e96
movl 0x14(%rsp), %ebp
testb %al, %al
je 0x3bd6b
movq %r14, %rdi
movl 0x10(%rsp), %esi
callq 0x39e96
testb %al, %al
je 0x3bd6b
movq %r14, %rdi
movl %ebx, %esi
callq 0x39e96
jmp 0x3bd6d
leaq 0x7c82f(%rip), %rax     # 0xb857a
movq %rax, (%rsp)
movq %r14, %rdi
movl %r13d, %esi
movl 0x14(%rsp), %edx
movl %r12d, %ecx
movl 0x10(%rsp), %r8d
movl %ebx, %r9d
callq 0x3ae2a
jmp 0x3bdc8
xorl %eax, %eax
movzbl %al, %r8d
leaq 0x38(%rsp), %rcx
movq %r14, %rdi
movl %r13d, %esi
movl %ebp, %edx
xorl %r9d, %r9d
callq 0x39bea
movq %r14, %rdi
movl %ebp, %esi
movl %r12d, %edx
callq 0x164e0
movq %r14, %rdi
movl %ebp, %esi
movl 0x10(%rsp), %edx
callq 0x164e0
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x164e0
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bdc8
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x3bde4
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3be15
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3be18
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x3be18
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x3be34
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0