// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %r8, %r15
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
leal -0xa(%rcx), %eax
cmpl $0x44, %eax
ja 0x6d013
leaq 0x4e3f7(%rip), %rdx     # 0xbb154
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x5139d(%rip), %rax     # 0xbe115
jmp 0x6cf80
movl (%r15), %ecx
leaq 0x51537(%rip), %r8      # 0xbe2be
jmp 0x6d085
movl (%r15), %ecx
leaq 0x5138e(%rip), %r8      # 0xbe124
jmp 0x6d085
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x513b1(%rip), %r9      # 0xbe15a
jmp 0x6cece
cmpb $0x0, 0x796(%r14)
jne 0x6cdc8
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x5148d(%rip), %r8      # 0xbe25f
jmp 0x6d085
movl (%r15), %ecx
leaq 0x514d1(%rip), %r8      # 0xbe2b2
jmp 0x6d085
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x5134c(%rip), %r9      # 0xbe140
jmp 0x6cece
cmpb $0x0, 0x797(%r14)
jne 0x6ce13
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x513f2(%rip), %r8      # 0xbe20f
jmp 0x6d085
cmpb $0x0, 0x794(%r14)
jne 0x6ce3c
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51395(%rip), %r8      # 0xbe1db
jmp 0x6d085
movq %r14, %rdi
movl %ebp, %esi
callq 0xa3ea
movl 0x14(%rax), %ecx
movl 0x18(%rax), %eax
movl %ecx, %edx
xorl $0x2, %edx
movl %eax, %esi
xorl $0x2, %esi
orl %edx, %esi
jne 0x6d035
cmpb $0x0, 0x79a(%r14)
jne 0x6d07b
movb $0x1, 0x79a(%r14)
jmp 0x6d073
movl (%r15), %ecx
leaq 0x51225(%rip), %r8      # 0xbe0b7
jmp 0x6d085
cmpb $0x0, 0x795(%r14)
jne 0x6ceb1
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x512ec(%rip), %r8      # 0xbe1a7
jmp 0x6d085
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x5124c(%rip), %r9      # 0xbe11a
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3a096
cmpb $0x0, 0x796(%r14)
jne 0x6cefe
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x5133d(%rip), %r8      # 0xbe245
jmp 0x6d085
cmpb $0x0, 0x795(%r14)
jne 0x6cf27
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x5128f(%rip), %r8      # 0xbe1c0
jmp 0x6d085
movl (%r15), %ecx
leaq 0x5117d(%rip), %r8      # 0xbe0bd
jmp 0x6d085
cmpb $0x0, 0x792(%r14)
jne 0x6cf5f
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51223(%rip), %r8      # 0xbe18c
jmp 0x6d085
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x511a0(%rip), %rax     # 0xbe120
movq %rax, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x3a620
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x792(%r14)
jne 0x6cfb5
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x511b4(%rip), %r8      # 0xbe173
jmp 0x6d085
cmpb $0x0, 0x797(%r14)
jne 0x6cfde
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51241(%rip), %r8      # 0xbe229
jmp 0x6d085
cmpb $0x0, 0x794(%r14)
jne 0x6d007
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x511e3(%rip), %r8      # 0xbe1f4
jmp 0x6d085
cmpl $0x2, %ecx
je 0x6d16a
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
movq %r15, %r8
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3dce4
movl %ecx, %edx
xorl $0x3, %edx
movl %eax, %esi
xorl $0x3, %esi
orl %edx, %esi
jne 0x6d057
cmpb $0x0, 0x79b(%r14)
jne 0x6d07b
movb $0x1, 0x79b(%r14)
jmp 0x6d073
xorl $0x4, %ecx
xorl $0x4, %eax
orl %ecx, %eax
jne 0x6d07b
cmpb $0x0, 0x79c(%r14)
jne 0x6d07b
movb $0x1, 0x79c(%r14)
movb $0x1, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51246(%rip), %r8      # 0xbe2cb
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x39f86
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5102e(%rip), %rsi     # 0xbe0e6
leaq 0x51055(%rip), %rdx     # 0xbe114
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8ece8(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8ecc0(%rip), %rsi     # 0xfbdb0
movq 0x8fee1(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6d1ce
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5115a(%rip), %rsi     # 0xbe27b
leaq 0x51189(%rip), %rdx     # 0xbe2b1
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8ec7f(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8ec57(%rip), %rsi     # 0xfbdb0
movq 0x8fe78(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6d1ce
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x50f3b(%rip), %rsi     # 0xbe0c2
leaq 0x50f57(%rip), %rdx     # 0xbe0e5
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8ec19(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8ebf1(%rip), %rsi     # 0xfbdb0
movq 0x8fe12(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6d1d6
jmp 0x6d1f7
jmp 0x6d1d6
jmp 0x6d1f7
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6d1f0
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x6d1fa
jmp 0x6d202
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0