// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_spv_amd_gcn_shader_op(unsigned int, unsigned int, unsigned int, unsigned int const*, unsigned int)
void CompilerGLSL::emit_spv_amd_gcn_shader_op(uint32_t result_type, uint32_t id, uint32_t eop, const uint32_t *args,
                                              uint32_t)
{
	require_extension_internal("GL_AMD_gcn_shader");

	enum AMDGCNShader
	{
		CubeFaceIndexAMD = 1,
		CubeFaceCoordAMD = 2,
		TimeAMD = 3
	};

	auto op = static_cast<AMDGCNShader>(eop);

	switch (op)
	{
	case CubeFaceIndexAMD:
		emit_unary_func_op(result_type, id, args[0], "cubeFaceIndexAMD");
		break;
	case CubeFaceCoordAMD:
		emit_unary_func_op(result_type, id, args[0], "cubeFaceCoordAMD");
		break;
	case TimeAMD:
	{
		string expr = "timeAMD()";
		emit_op(result_type, id, expr, true);
		register_control_dependent_expression(id);
		break;
	}

	default:
		statement("// unimplemented SPV AMD gcn shader op ", eop);
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movq %r8, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x98(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x90(%rbp)
callq 0x7650
movq -0x90(%rbp), %rdx
leaq 0xc32b0(%rip), %rsi     # 0x142df9
leaq -0x48(%rbp), %rdi
callq 0x7520
jmp 0x7fb54
movq -0x98(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x589d0
jmp 0x7fb66
leaq -0x48(%rbp), %rdi
callq 0x7708
leaq -0x49(%rbp), %rdi
callq 0x73d0
movl -0x14(%rbp), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x9c(%rbp)
subl $0x1, %eax
je 0x7fbdc
jmp 0x7fb8e
movl -0x9c(%rbp), %eax
subl $0x2, %eax
je 0x7fc00
jmp 0x7fb9b
movl -0x9c(%rbp), %eax
subl $0x3, %eax
je 0x7fc24
jmp 0x7fcca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7fbce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7708
leaq -0x49(%rbp), %rdi
callq 0x73d0
jmp 0x7fcea
movq -0x98(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x20(%rbp), %rax
movl (%rax), %ecx
leaq 0xc3215(%rip), %r8      # 0x142e0b
callq 0x79220
jmp 0x7fce1
movq -0x98(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
movq -0x20(%rbp), %rax
movl (%rax), %ecx
leaq 0xc3202(%rip), %r8      # 0x142e1c
callq 0x79220
jmp 0x7fce1
leaq -0x81(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x7650
movq -0xa8(%rbp), %rdx
leaq 0xc31e8(%rip), %rsi     # 0x142e2d
leaq -0x80(%rbp), %rdi
callq 0x7520
jmp 0x7fc50
leaq -0x81(%rbp), %rdi
callq 0x73d0
movq -0x98(%rbp), %rdi
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x80(%rbp), %rcx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x784f0
jmp 0x7fc7d
movq -0x98(%rbp), %rdi
movl -0x10(%rbp), %esi
callq 0x7c5f0
jmp 0x7fc8e
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0x7fce1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x81(%rbp), %rdi
callq 0x73d0
jmp 0x7fcea
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0x7fcea
movq -0x98(%rbp), %rdi
leaq 0xc315f(%rip), %rsi     # 0x142e37
leaq -0x14(%rbp), %rdx
callq 0xa4170
addq $0xb0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)