// File: /workspace/github_cpp_makefile_star2_O1/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 0x6d931
leaq 0x4eae9(%rip), %rdx     # 0xbc164
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x51a77(%rip), %rax     # 0xbf10d
jmp 0x6d89e
movl (%r15), %ecx
leaq 0x51c11(%rip), %r8      # 0xbf2b6
jmp 0x6d9a3
movl (%r15), %ecx
leaq 0x51a68(%rip), %r8      # 0xbf11c
jmp 0x6d9a3
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x51a8b(%rip), %r9      # 0xbf152
jmp 0x6d7ec
cmpb $0x0, 0x796(%r14)
jne 0x6d6e6
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51b67(%rip), %r8      # 0xbf257
jmp 0x6d9a3
movl (%r15), %ecx
leaq 0x51bab(%rip), %r8      # 0xbf2aa
jmp 0x6d9a3
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x51a26(%rip), %r9      # 0xbf138
jmp 0x6d7ec
cmpb $0x0, 0x797(%r14)
jne 0x6d731
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51acc(%rip), %r8      # 0xbf207
jmp 0x6d9a3
cmpb $0x0, 0x794(%r14)
jne 0x6d75a
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51a6f(%rip), %r8      # 0xbf1d3
jmp 0x6d9a3
movq %r14, %rdi
movl %ebp, %esi
callq 0xa426
movl 0x14(%rax), %ecx
movl 0x18(%rax), %eax
movl %ecx, %edx
xorl $0x2, %edx
movl %eax, %esi
xorl $0x2, %esi
orl %edx, %esi
jne 0x6d953
cmpb $0x0, 0x79a(%r14)
jne 0x6d999
movb $0x1, 0x79a(%r14)
jmp 0x6d991
movl (%r15), %ecx
leaq 0x518ff(%rip), %r8      # 0xbf0af
jmp 0x6d9a3
cmpb $0x0, 0x795(%r14)
jne 0x6d7cf
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x519c6(%rip), %r8      # 0xbf19f
jmp 0x6d9a3
movl (%r15), %ecx
movl 0x4(%r15), %r8d
leaq 0x51926(%rip), %r9      # 0xbf112
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3a8a0
cmpb $0x0, 0x796(%r14)
jne 0x6d81c
movb $0x1, %al
movb %al, 0x796(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51a17(%rip), %r8      # 0xbf23d
jmp 0x6d9a3
cmpb $0x0, 0x795(%r14)
jne 0x6d845
movb $0x1, %al
movb %al, 0x795(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51969(%rip), %r8      # 0xbf1b8
jmp 0x6d9a3
movl (%r15), %ecx
leaq 0x51857(%rip), %r8      # 0xbf0b5
jmp 0x6d9a3
cmpb $0x0, 0x792(%r14)
jne 0x6d87d
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x518fd(%rip), %r8      # 0xbf184
jmp 0x6d9a3
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl 0x8(%r15), %r9d
leaq 0x5187a(%rip), %rax     # 0xbf118
movq %rax, (%rsp)
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x3ae2a
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x792(%r14)
jne 0x6d8d3
movb $0x1, %al
movb %al, 0x792(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x5188e(%rip), %r8      # 0xbf16b
jmp 0x6d9a3
cmpb $0x0, 0x797(%r14)
jne 0x6d8fc
movb $0x1, %al
movb %al, 0x797(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x5191b(%rip), %r8      # 0xbf221
jmp 0x6d9a3
cmpb $0x0, 0x794(%r14)
jne 0x6d925
movb $0x1, %al
movb %al, 0x794(%r14)
movb %al, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x518bd(%rip), %r8      # 0xbf1ec
jmp 0x6d9a3
cmpl $0x2, %ecx
je 0x6da88
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
movq %r15, %r8
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3e548
movl %ecx, %edx
xorl $0x3, %edx
movl %eax, %esi
xorl $0x3, %esi
orl %edx, %esi
jne 0x6d975
cmpb $0x0, 0x79b(%r14)
jne 0x6d999
movb $0x1, 0x79b(%r14)
jmp 0x6d991
xorl $0x4, %ecx
xorl $0x4, %eax
orl %ecx, %eax
jne 0x6d999
cmpb $0x0, 0x79c(%r14)
jne 0x6d999
movb $0x1, 0x79c(%r14)
movb $0x1, 0x1d0(%r14)
movl (%r15), %ecx
leaq 0x51920(%rip), %r8      # 0xbf2c3
movq %r14, %rdi
movl %ebp, %esi
movl %ebx, %edx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3a790
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x51708(%rip), %rsi     # 0xbf0de
leaq 0x5172f(%rip), %rdx     # 0xbf10c
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8f39a(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8f372(%rip), %rsi     # 0xfcd80
movq 0x905c3(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6daec
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x51834(%rip), %rsi     # 0xbf273
leaq 0x51863(%rip), %rdx     # 0xbf2a9
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8f331(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8f309(%rip), %rsi     # 0xfcd80
movq 0x9055a(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6daec
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x51615(%rip), %rsi     # 0xbf0ba
leaq 0x51631(%rip), %rdx     # 0xbf0dd
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x8f2cb(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x8f2a3(%rip), %rsi     # 0xfcd80
movq 0x904f4(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
jmp 0x6daf4
jmp 0x6db10
jmp 0x6daf4
jmp 0x6db10
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6db16
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x6db16
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x6db23
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0
nop