// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::to_trivial_mix_op(spirv_cross::SPIRType const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, unsigned int, unsigned int, unsigned int)
bool CompilerGLSL::to_trivial_mix_op(const SPIRType &type, string &op, uint32_t left, uint32_t right, uint32_t lerp)
{
	auto *cleft = maybe_get<SPIRConstant>(left);
	auto *cright = maybe_get<SPIRConstant>(right);
	auto &lerptype = expression_type(lerp);

	// If our targets aren't constants, we cannot use construction.
	if (!cleft || !cright)
		return false;

	// If our targets are spec constants, we cannot use construction.
	if (cleft->specialization || cright->specialization)
		return false;

	// We can only use trivial construction if we have a scalar
	// (should be possible to do it for vectors as well, but that is overkill for now).
	if (lerptype.basetype != SPIRType::Boolean || lerptype.vecsize > 1)
		return false;

	// If our bool selects between 0 and 1, we can cast from bool instead, making our trivial constructor.
	bool ret = false;
	switch (type.basetype)
	{
	case SPIRType::Int:
	case SPIRType::UInt:
		ret = cleft->scalar() == 0 && cright->scalar() == 1;
		break;

	case SPIRType::Half:
		ret = cleft->scalar_f16() == 0.0f && cright->scalar_f16() == 1.0f;
		break;

	case SPIRType::Float:
		ret = cleft->scalar_f32() == 0.0f && cright->scalar_f32() == 1.0f;
		break;

	case SPIRType::Double:
		ret = cleft->scalar_f64() == 0.0 && cright->scalar_f64() == 1.0;
		break;

	case SPIRType::Int64:
	case SPIRType::UInt64:
		ret = cleft->scalar_u64() == 0 && cright->scalar_u64() == 1;
		break;

	default:
		break;
	}

	if (ret)
		op = type_to_glsl_constructor(type);
	return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movl %r8d, %r12d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl %ecx, %esi
callq 0x54236
movq %rax, %r13
movq %r15, %rdi
movl %r12d, %esi
callq 0x54236
movq %rax, %r12
movq %r15, %rdi
movl %ebp, %esi
callq 0x12a72
testq %r13, %r13
sete %cl
testq %r12, %r12
sete %dl
orb %cl, %dl
jne 0x34cee
cmpb $0x0, 0x108(%r13)
jne 0x34cee
cmpb $0x0, 0x108(%r12)
je 0x34d01
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
cmpl $0x2, 0xc(%rax)
jne 0x34cf0
cmpl $0x1, 0x14(%rax)
ja 0x34cf0
movl 0xc(%r14), %eax
xorl %ebp, %ebp
addl $-0x4, %eax
cmpl $0x7, %eax
ja 0x34cf0
leaq 0x80a68(%rip), %rcx     # 0xb578c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, 0x10(%r13)
jne 0x34cee
cmpl $0x1, 0x10(%r12)
jne 0x34cee
jmp 0x34dec
cmpq $0x0, 0x10(%r13)
jne 0x34cee
cmpq $0x1, 0x10(%r12)
jne 0x34cee
jmp 0x34dec
movss 0x10(%r13), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x34cee
jp 0x34cee
movss 0x10(%r12), %xmm0
ucomiss 0x8174d(%rip), %xmm0    # 0xb64c0
jmp 0x34d9e
movsd 0x10(%r13), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x34cee
jp 0x34cee
movsd 0x10(%r12), %xmm0
ucomisd 0x8170a(%rip), %xmm0    # 0xb64a8
jne 0x34cee
jnp 0x34dec
jmp 0x34cee
xorl %ebp, %ebp
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5342a
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x34cf0
jp 0x34cf0
xorl %ebp, %ebp
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x5342a
ucomiss 0x816e0(%rip), %xmm0    # 0xb64c0
jne 0x34cf0
jp 0x34cf0
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x34a5c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6310
movq (%r12), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x34e25
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movb $0x1, %bpl
jmp 0x34cf0
nop