// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::emit_glsl_op(unsigned int, unsigned int, unsigned int, unsigned int const*, unsigned int)
void CompilerHLSL::emit_glsl_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args, uint32_t count)
{
	GLSLstd450 op = static_cast<GLSLstd450>(eop);

	switch (op)
	{
	case GLSLstd450InverseSqrt:
		emit_unary_func_op(result_type, id, args[0], "rsqrt");
		break;

	case GLSLstd450Fract:
		emit_unary_func_op(result_type, id, args[0], "frac");
		break;

	case GLSLstd450RoundEven:
		SPIRV_CROSS_THROW("roundEven is not supported on HLSL.");

	case GLSLstd450Acosh:
	case GLSLstd450Asinh:
	case GLSLstd450Atanh:
		SPIRV_CROSS_THROW("Inverse hyperbolics are not supported on HLSL.");

	case GLSLstd450FMix:
	case GLSLstd450IMix:
		emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "lerp");
		break;

	case GLSLstd450Atan2:
		emit_binary_func_op(result_type, id, args[0], args[1], "atan2");
		break;

	case GLSLstd450Fma:
		emit_trinary_func_op(result_type, id, args[0], args[1], args[2], "mad");
		break;

	case GLSLstd450InterpolateAtCentroid:
		emit_unary_func_op(result_type, id, args[0], "EvaluateAttributeAtCentroid");
		break;
	case GLSLstd450InterpolateAtSample:
		emit_binary_func_op(result_type, id, args[0], args[1], "EvaluateAttributeAtSample");
		break;
	case GLSLstd450InterpolateAtOffset:
		emit_binary_func_op(result_type, id, args[0], args[1], "EvaluateAttributeSnapped");
		break;

	case GLSLstd450PackHalf2x16:
		if (!requires_fp16_packing)
		{
			requires_fp16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packHalf2x16");
		break;

	case GLSLstd450UnpackHalf2x16:
		if (!requires_fp16_packing)
		{
			requires_fp16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackHalf2x16");
		break;

	case GLSLstd450PackSnorm4x8:
		if (!requires_snorm8_packing)
		{
			requires_snorm8_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packSnorm4x8");
		break;

	case GLSLstd450UnpackSnorm4x8:
		if (!requires_snorm8_packing)
		{
			requires_snorm8_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackSnorm4x8");
		break;

	case GLSLstd450PackUnorm4x8:
		if (!requires_unorm8_packing)
		{
			requires_unorm8_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packUnorm4x8");
		break;

	case GLSLstd450UnpackUnorm4x8:
		if (!requires_unorm8_packing)
		{
			requires_unorm8_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackUnorm4x8");
		break;

	case GLSLstd450PackSnorm2x16:
		if (!requires_snorm16_packing)
		{
			requires_snorm16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packSnorm2x16");
		break;

	case GLSLstd450UnpackSnorm2x16:
		if (!requires_snorm16_packing)
		{
			requires_snorm16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackSnorm2x16");
		break;

	case GLSLstd450PackUnorm2x16:
		if (!requires_unorm16_packing)
		{
			requires_unorm16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_packUnorm2x16");
		break;

	case GLSLstd450UnpackUnorm2x16:
		if (!requires_unorm16_packing)
		{
			requires_unorm16_packing = true;
			force_recompile = true;
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_unpackUnorm2x16");
		break;

	case GLSLstd450PackDouble2x32:
	case GLSLstd450UnpackDouble2x32:
		SPIRV_CROSS_THROW("packDouble2x32/unpackDouble2x32 not supported in HLSL.");

	case GLSLstd450FindILsb:
		emit_unary_func_op(result_type, id, args[0], "firstbitlow");
		break;
	case GLSLstd450FindSMsb:
	case GLSLstd450FindUMsb:
		emit_unary_func_op(result_type, id, args[0], "firstbithigh");
		break;

	case GLSLstd450MatrixInverse:
	{
		auto &type = get<SPIRType>(result_type);
		if (type.vecsize == 2 && type.columns == 2)
		{
			if (!requires_inverse_2x2)
			{
				requires_inverse_2x2 = true;
				force_recompile = true;
			}
		}
		else if (type.vecsize == 3 && type.columns == 3)
		{
			if (!requires_inverse_3x3)
			{
				requires_inverse_3x3 = true;
				force_recompile = true;
			}
		}
		else if (type.vecsize == 4 && type.columns == 4)
		{
			if (!requires_inverse_4x4)
			{
				requires_inverse_4x4 = true;
				force_recompile = true;
			}
		}
		emit_unary_func_op(result_type, id, args[0], "SPIRV_Cross_Inverse");
		break;
	}

	default:
		CompilerGLSL::emit_glsl_op(result_type, id, eop, args, count);
		break;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %r8, %r15
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leal -0xa(%rcx), %eax
cmpl $0x44, %eax
ja 0x584b9
leaq 0x3dee1(%rip), %rdx     # 0x960e4
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x40e87(%rip), %rax     # 0x990a5
jmp 0x58426
movl (%r15), %ecx
leaq 0x41021(%rip), %r8      # 0x9924e
jmp 0x5852b
movl (%r15), %ecx
leaq 0x40e78(%rip), %r8      # 0x990b4
jmp 0x5852b
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x40e9b(%rip), %r9      # 0x990ea
jmp 0x58374
cmpb $0x0, 0x796(%r14)
jne 0x5826e
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40f77(%rip), %r8      # 0x991ef
jmp 0x5852b
movl (%r15), %ecx
leaq 0x40fbb(%rip), %r8      # 0x99242
jmp 0x5852b
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x40e36(%rip), %r9      # 0x990d0
jmp 0x58374
cmpb $0x0, 0x797(%r14)
jne 0x582b9
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40edc(%rip), %r8      # 0x9919f
jmp 0x5852b
cmpb $0x0, 0x794(%r14)
jne 0x582e2
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40e7f(%rip), %r8      # 0x9916b
jmp 0x5852b
movq %r14, %rdi
movl %ebp, %esi
callq 0x90a4
movl 0x14(%rax), %ecx
movl 0x18(%rax), %eax
movl %ecx, %edx
xorl $0x2, %edx
movl %eax, %esi
xorl $0x2, %esi
orl %edx, %esi
jne 0x584db
cmpb $0x0, 0x79a(%r14)
jne 0x58521
movb $0x1, 0x79a(%r14)
jmp 0x58519
movl (%r15), %ecx
leaq 0x40d0f(%rip), %r8      # 0x99047
jmp 0x5852b
cmpb $0x0, 0x795(%r14)
jne 0x58357
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40dd6(%rip), %r8      # 0x99137
jmp 0x5852b
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x40d36(%rip), %r9      # 0x990aa
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2fab8
cmpb $0x0, 0x796(%r14)
jne 0x583a4
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40e27(%rip), %r8      # 0x991d5
jmp 0x5852b
cmpb $0x0, 0x795(%r14)
jne 0x583cd
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40d79(%rip), %r8      # 0x99150
jmp 0x5852b
movl (%r15), %ecx
leaq 0x40c67(%rip), %r8      # 0x9904d
jmp 0x5852b
cmpb $0x0, 0x792(%r14)
jne 0x58405
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40d0d(%rip), %r8      # 0x9911c
jmp 0x5852b
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x40c8a(%rip), %rax     # 0x990b0
movq %rax, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x2fe8e
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x792(%r14)
jne 0x5845b
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40c9e(%rip), %r8      # 0x99103
jmp 0x5852b
cmpb $0x0, 0x797(%r14)
jne 0x58484
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40d2b(%rip), %r8      # 0x991b9
jmp 0x5852b
cmpb $0x0, 0x794(%r14)
jne 0x584ad
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40ccd(%rip), %r8      # 0x99184
jmp 0x5852b
cmpl $0x2, %ecx
je 0x585da
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
movq %r15, %r8
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x32812
movl %ecx, %edx
xorl $0x3, %edx
movl %eax, %esi
xorl $0x3, %esi
orl %edx, %esi
jne 0x584fd
cmpb $0x0, 0x79b(%r14)
jne 0x58521
movb $0x1, 0x79b(%r14)
jmp 0x58519
xorl $0x4, %ecx
xorl $0x4, %eax
orl %ecx, %eax
jne 0x58521
cmpb $0x0, 0x79c(%r14)
jne 0x58521
movb $0x1, 0x79c(%r14)
movb $0x1, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x40d30(%rip), %r8      # 0x9925b
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2f9ee
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x40b23(%rip), %rsi     # 0x99076
leaq 0x18(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x8e845(%rip), %rsi     # 0xe6dc0
movq 0x8fa5e(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x58623
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x40c6a(%rip), %rsi     # 0x9920b
leaq 0x18(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x8e7f7(%rip), %rsi     # 0xe6dc0
movq 0x8fa10(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x58623
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x40a66(%rip), %rsi     # 0x99052
leaq 0x18(%rsp), %rdi
leaq 0x17(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x8e7ac(%rip), %rsi     # 0xe6dc0
movq 0x8f9c5(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
jmp 0x5862b
jmp 0x5863f
jmp 0x5862b
jmp 0x5863f
movq %rax, %r14
leaq 0x18(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x58642
jmp 0x5864a
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64b0