// File: /workspace/github_cpp_makefile_star2_O3/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 $0x38, %rsp
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
movl 0x4(%rdx), %esi
movq %r14, %rdi
callq 0xb3ca
movq %rax, %r13
movl 0x4(%r12), %esi
movq %r14, %rdi
callq 0x12a72
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 0x95fe7
cmpb $0x1, 0x60(%r15)
jne 0x95fe7
cmpl $0x0, 0xc(%r12)
sete %al
jmp 0x95fe9
xorl %eax, %eax
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
movq 0x8(%rsp), %rcx
leaq 0x10(%rcx), %rdx
movq %rdx, 0x30(%rsp)
movq %rdx, (%rcx)
movq $0x0, 0x8(%rcx)
movb $0x0, 0x10(%rcx)
testb $0x1, %al
je 0x9603b
leaq 0x21166(%rip), %rsi     # 0xb7197
movq 0x8(%rsp), %rdi
callq 0x64e0
movq %r14, %rdi
movq %r13, %rsi
callq 0x13330
testb %al, %al
je 0x960a8
movl 0x4(%r12), %esi
movq %r14, %rdi
movl $0xb, %edx
callq 0x14e6e
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x9e382
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9609a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
cmpl $0x0, 0x64(%r15)
sete %r13b
jmp 0x96155
movl 0x4(%r12), %ecx
movq (%r14), %rax
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *0x98(%rax)
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
leaq 0x20(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x960f1
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x64(%r15), %eax
testl %eax, %eax
je 0x96152
addl $-0x9, %eax
xorl %r13d, %r13d
cmpl $-0x2, %eax
jb 0x96155
cmpb $0x0, 0x60(%r15)
jne 0x96155
leaq 0x1e79c(%rip), %rsi     # 0xb48ae
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x33f8a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
jne 0x962c6
jmp 0x962d3
movb $0x1, %r13b
movq %r14, %rdi
movq %r15, %rsi
callq 0x13482
cmpl $-0x3, %ebx
setae %cl
xorb $0x1, %al
orb %cl, %al
jne 0x96238
movq %r14, %rdi
movl %ebp, %esi
callq 0xb3ca
cmpl $0x2, 0x10(%rax)
je 0x96190
movq %r14, %rdi
movl %ebp, %esi
callq 0xb3ca
cmpl $0xc, 0x10(%rax)
jne 0x961a1
leaq 0x1e3f4(%rip), %rsi     # 0xb458b
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x2cd34(%rip), %rsi     # 0xc2edc
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x33f8a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
leaq 0x20(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x961f0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x2481e(%rip), %rsi     # 0xbaa15
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2b55a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x962c6
jmp 0x962d3
testb %r13b, %r13b
je 0x96273
leaq 0x1e66a(%rip), %rsi     # 0xb48ae
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x33f8a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
jmp 0x962b8
leaq 0x2c493(%rip), %rsi     # 0xc270d
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x1e623(%rip), %rsi     # 0xb48ae
movq 0x8(%rsp), %rdi
callq 0x64e0
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x33f8a
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x8(%rsp), %rdi
callq 0x60b0
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x962d3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x8(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r12, %rdi
jne 0x96328
jmp 0x96342
jmp 0x9633f
jmp 0x96317
jmp 0x9633f
jmp 0x96317
jmp 0x9633f
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x96328
jmp 0x96342
jmp 0x9633f
jmp 0x96317
jmp 0x9633f
jmp 0x96317
movq %rax, %r14
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96342
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96342
jmp 0x9633f
jmp 0x9633f
jmp 0x9633f
jmp 0x9633f
movq %rax, %r14
movq 0x8(%rsp), %rax
movq (%rax), %rdi
cmpq 0x30(%rsp), %rdi
je 0x96361
movq 0x30(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0
nop