// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::argument_decl[abi:cxx11](spirv_cross::SPIRFunction::Parameter const&)
string CompilerMSL::argument_decl(const SPIRFunction::Parameter &arg)
{

	auto &var = get<SPIRVariable>(arg.id);
	auto &type = expression_type(arg.id);

	// If we need to modify the name of the variable, make sure we use the original variable.
	// Our alias is just a shadow variable.
	uint32_t name_id = var.self;
	if (arg.alias_global_variable && var.basevariable)
		name_id = var.basevariable;

	bool constref = !arg.alias_global_variable && type.pointer && arg.write_count == 0;

	bool type_is_image = type.basetype == SPIRType::Image || type.basetype == SPIRType::SampledImage ||
	                     type.basetype == SPIRType::Sampler;

	// Arrays of images/samplers in MSL are always const.
	if (!type.array.empty() && type_is_image)
		constref = true;

	string decl;
	if (constref)
		decl += "const ";

	bool builtin = is_builtin_variable(var);
	if (builtin)
		decl += builtin_type_decl(static_cast<BuiltIn>(get_decoration(arg.id, DecorationBuiltIn)));
	else
		decl += type_to_glsl(type, arg.id);

	bool opaque_handle = type.storage == StorageClassUniformConstant;

	if (!builtin && !opaque_handle && !type.pointer &&
	    (type.storage == StorageClassFunction || type.storage == StorageClassGeneric))
	{
		// If the argument is a pure value and not an opaque type, we will pass by value.
		decl += " ";
		decl += to_expression(name_id);
	}
	else if (is_array(type) && !type_is_image)
	{
		// Arrays of images and samplers are special cased.
		if (get<SPIRVariable>(name_id).storage == StorageClassUniform ||
		    get<SPIRVariable>(name_id).storage == StorageClassStorageBuffer)
			// If an array of buffers, declare an array of pointers, since we
			// can't have an array of references.
			decl += "*";
		decl += " (&";
		decl += to_expression(name_id);
		decl += ")";
		decl += type_to_array_glsl(type);
	}
	else if (!opaque_handle)
	{
		decl += "&";
		decl += " ";
		decl += to_expression(name_id);
	}
	else
	{
		decl += " ";
		decl += to_expression(name_id);
	}

	return decl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, (%rsp)
movl 0x4(%rdx), %esi
movq %r14, %rdi
callq 0x9c0e
movq %rax, %r13
movl 0x4(%r12), %esi
movq %r14, %rdi
callq 0x104b0
movq %rax, %r15
movl 0x8(%r13), %eax
movl 0x1c(%r13), %ebp
testl %ebp, %ebp
cmovel %eax, %ebp
cmpb $0x0, 0x10(%r12)
cmovel %eax, %ebp
jne 0x77e66
cmpb $0x1, 0x60(%r15)
jne 0x77e66
cmpl $0x0, 0xc(%r12)
sete %al
jmp 0x77e68
xorl %eax, %eax
movq (%rsp), %rsi
movl 0xc(%r15), %ebx
addl $-0x10, %ebx
cmpl $-0x3, %ebx
setae %cl
movq 0x20(%r15), %rdx
orb %al, %cl
cmpq 0x28(%r15), %rdx
movzbl %cl, %ecx
movzbl %al, %eax
cmovnel %ecx, %eax
leaq 0x10(%rsi), %rcx
movq %rcx, (%rsi)
andq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
testb $0x1, %al
je 0x77eb0
leaq 0x1a2d0(%rip), %rsi     # 0x92177
movq (%rsp), %rdi
callq 0x64d0
movq %r14, %rdi
movq %r13, %rsi
callq 0x10c60
testb %al, %al
je 0x77f04
movl 0x4(%r12), %esi
pushq $0xb
popq %rdx
movq %r14, %rdi
callq 0x12174
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x7bf9e
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
leaq 0x8(%rsp), %rdi
callq 0x6548
cmpl $0x0, 0x64(%r15)
sete %r12b
jmp 0x77f84
movl 0x4(%r12), %ecx
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *0x98(%rax)
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
leaq 0x8(%rsp), %rdi
callq 0x6548
movl 0x64(%r15), %eax
testl %eax, %eax
je 0x77f81
addl $-0x9, %eax
xorl %r12d, %r12d
cmpl $-0x2, %eax
jb 0x77f84
cmpb $0x0, 0x60(%r15)
jne 0x77f84
leaq 0x17930(%rip), %rsi     # 0x8f886
movq (%rsp), %rdi
callq 0x64d0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2b9f0
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
jmp 0x780a9
movb $0x1, %r12b
movq %r14, %rdi
movq %r15, %rsi
callq 0x10d6c
cmpl $-0x3, %ebx
setae %cl
xorb $0x1, %al
orb %cl, %al
jne 0x78038
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c0e
cmpl $0x2, 0x10(%rax)
je 0x77fbf
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c0e
cmpl $0xc, 0x10(%rax)
jne 0x77fcf
leaq 0x1759d(%rip), %rsi     # 0x8f563
movq (%rsp), %rdi
callq 0x64d0
leaq 0x25ebe(%rip), %rsi     # 0x9de94
movq (%rsp), %rdi
callq 0x64d0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2b9f0
leaq 0x8(%rsp), %rsi
movq (%rsp), %rbx
movq %rbx, %rdi
callq 0x64f0
leaq 0x8(%rsp), %rdi
callq 0x6548
leaq 0x1d9e5(%rip), %rsi     # 0x959f5
movq %rbx, %rdi
callq 0x64d0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2547c
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
jmp 0x780a9
testb %r12b, %r12b
je 0x7806c
leaq 0x17842(%rip), %rsi     # 0x8f886
movq (%rsp), %rdi
callq 0x64d0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2b9f0
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
jmp 0x780a9
leaq 0x25652(%rip), %rsi     # 0x9d6c5
movq (%rsp), %rdi
callq 0x64d0
leaq 0x17803(%rip), %rsi     # 0x8f886
movq (%rsp), %rdi
callq 0x64d0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x2b9f0
leaq 0x8(%rsp), %rsi
movq (%rsp), %rdi
callq 0x64f0
leaq 0x8(%rsp), %rdi
callq 0x6548
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x780dc
jmp 0x780f3
jmp 0x780dc
jmp 0x780f3
jmp 0x780dc
jmp 0x780f3
jmp 0x780dc
jmp 0x780f3
jmp 0x780dc
jmp 0x780f3
jmp 0x780dc
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x6548
jmp 0x780f6
jmp 0x780f3
jmp 0x780f3
jmp 0x780f3
jmp 0x780f3
movq %rax, %r14
movq (%rsp), %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0
nop