// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::func_type_decl[abi:cxx11](spirv_cross::SPIRType&)
string CompilerMSL::func_type_decl(SPIRType &type)
{
	// The regular function return type. If not processing the entry point function, that's all we need
	string return_type = type_to_glsl(type) + type_to_array_glsl(type);
	if (!processing_entry_point)
		return return_type;

	// If an outgoing interface block has been defined, and it should be returned, override the entry point return type
	bool ep_should_return_output = !get_is_rasterization_disabled();
	if (stage_out_var_id && ep_should_return_output)
	{
		auto &so_var = get<SPIRVariable>(stage_out_var_id);
		auto &so_type = get<SPIRType>(so_var.basetype);
		return_type = type_to_glsl(so_type) + type_to_array_glsl(type);
	}

	// Prepend a entry type, based on the execution model
	string entry_type;
	auto &execution = get_entry_point();
	switch (execution.model)
	{
	case ExecutionModelVertex:
		entry_type = "vertex";
		break;
	case ExecutionModelFragment:
		entry_type =
		    execution.flags.get(ExecutionModeEarlyFragmentTests) ? "fragment [[ early_fragment_tests ]]" : "fragment";
		break;
	case ExecutionModelGLCompute:
	case ExecutionModelKernel:
		entry_type = "kernel";
		break;
	default:
		entry_type = "unknown";
		break;
	}

	return entry_type + " " + return_type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x160(%rbp)
movq %rdi, %rax
movq %rax, -0x158(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0x150(%rbp)
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x58(%rbp), %rdi
xorl %ecx, %ecx
callq *%rax
movq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x78(%rbp), %rdi
callq 0x61340
jmp 0x10068f
leaq -0x38(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x78(%rbp), %rdx
callq 0x2f7f0
jmp 0x1006a2
leaq -0x78(%rbp), %rdi
callq 0x7708
leaq -0x58(%rbp), %rdi
callq 0x7708
movq -0x150(%rbp), %rax
testb $0x1, 0x5d8(%rax)
jne 0x10071a
movq -0x160(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x7210
movl $0x1, -0x88(%rbp)
jmp 0x100a23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x10070c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x7708
leaq -0x58(%rbp), %rdi
callq 0x7708
jmp 0x100a45
movq -0x150(%rbp), %rdi
callq 0x113f70
movb %al, -0x161(%rbp)
jmp 0x10072e
movq -0x150(%rbp), %rax
movb -0x161(%rbp), %cl
xorb $-0x1, %cl
andb $0x1, %cl
movb %cl, -0x89(%rbp)
cmpl $0x0, 0x930(%rax)
je 0x100898
testb $0x1, -0x89(%rbp)
je 0x100898
movq -0x150(%rbp), %rdi
movl 0x930(%rdi), %esi
callq 0xfec0
movq %rax, -0x170(%rbp)
jmp 0x10077c
movq -0x150(%rbp), %rdi
movq -0x170(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0x178(%rbp)
jmp 0x1007a9
movq -0x150(%rbp), %rsi
movq -0x178(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdx
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0xe0(%rbp), %rdi
xorl %ecx, %ecx
callq *%rax
jmp 0x1007dc
movq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x100(%rbp), %rdi
callq 0x61340
jmp 0x1007f5
leaq -0xc0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x2f7f0
jmp 0x100811
leaq -0x38(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x7430
leaq -0xc0(%rbp), %rdi
callq 0x7708
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0xe0(%rbp), %rdi
callq 0x7708
jmp 0x100898
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x100a3c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x100887
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0xe0(%rbp), %rdi
callq 0x7708
jmp 0x100a3c
leaq -0x120(%rbp), %rdi
callq 0x7530
movq -0x150(%rbp), %rdi
callq 0x25150
movq %rax, -0x180(%rbp)
jmp 0x1008b9
movq -0x180(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rax
movl 0xb8(%rax), %eax
movl %eax, -0x184(%rbp)
testl %eax, %eax
je 0x100914
jmp 0x1008e0
movl -0x184(%rbp), %eax
subl $0x4, %eax
je 0x10092b
jmp 0x1008ed
movl -0x184(%rbp), %eax
addl $-0x5, %eax
subl $0x2, %eax
jb 0x100973
jmp 0x10098a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
jmp 0x100a15
leaq 0x4cff9(%rip), %rsi     # 0x14d914
leaq -0x120(%rbp), %rdi
callq 0x7510
jmp 0x100929
jmp 0x1009a1
movq -0x128(%rbp), %rdi
addq $0x60, %rdi
movl $0x9, %esi
callq 0xef50
movb %al, -0x185(%rbp)
jmp 0x100948
movb -0x185(%rbp), %cl
leaq 0x4cb43(%rip), %rax     # 0x14d498
leaq 0x4cb60(%rip), %rsi     # 0x14d4bc
testb $0x1, %cl
cmovneq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x7510
jmp 0x100971
jmp 0x1009a1
leaq 0x4cb4b(%rip), %rsi     # 0x14d4c5
leaq -0x120(%rbp), %rdi
callq 0x7510
jmp 0x100988
jmp 0x1009a1
leaq 0x4cb3b(%rip), %rsi     # 0x14d4cc
leaq -0x120(%rbp), %rdi
callq 0x7510
jmp 0x10099f
jmp 0x1009a1
leaq 0x3def5(%rip), %rdx     # 0x13e89d
leaq -0x148(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x2f8c0
jmp 0x1009bd
movq -0x160(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0xa1530
jmp 0x1009d6
leaq -0x148(%rbp), %rdi
callq 0x7708
movl $0x1, -0x88(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x100a23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x80(%rbp)
movl %eax, -0x84(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x7708
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x100a3c
leaq -0x38(%rbp), %rdi
callq 0x7708
movq -0x158(%rbp), %rax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
leaq -0x38(%rbp), %rdi
callq 0x7708
movq -0x80(%rbp), %rdi
callq 0x7640
nop