// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
movl 0x4(%rdx), %esi
movq %r14, %rdi
callq 0xb40a
movq %rax, %r12
movl 0x4(%r13), %esi
movq %r14, %rdi
callq 0x12aba
movq %rax, %r15
movl 0x8(%r12), %eax
movl 0x1c(%r12), %ebp
testl %ebp, %ebp
cmovel %eax, %ebp
cmpb $0x0, 0x10(%r13)
cmovel %eax, %ebp
jne 0x96c62
cmpb $0x1, 0x60(%r15)
jne 0x96c62
cmpl $0x0, 0xc(%r13)
sete %al
jmp 0x96c64
xorl %eax, %eax
movl 0xc(%r15), %ebx
addl $-0x10, %ebx
cmpl $-0x3, %ebx
setb %cl
movq 0x20(%r15), %rdx
cmpq 0x28(%r15), %rdx
sete %dl
orb %cl, %dl
movq 0x28(%rsp), %rcx
leaq 0x10(%rcx), %rsi
movq %rsi, 0x30(%rsp)
movq %rsi, (%rcx)
movq $0x0, 0x8(%rcx)
movb $0x0, 0x10(%rcx)
cmpb $0x1, %dl
jne 0x96ca4
testb %al, %al
je 0x96cb5
leaq 0x214fc(%rip), %rsi     # 0xb81a7
movq 0x28(%rsp), %rdi
callq 0x64e0
movq %r14, %rdi
movq %r12, %rsi
callq 0x133a2
movl %eax, %r12d
testb %al, %al
je 0x96cfd
movl 0x4(%r13), %esi
movq %r14, %rdi
movl $0xb, %edx
callq 0x14ff6
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x9f194
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rdi
callq 0x60b0
jmp 0x96d29
movl 0x4(%r13), %ecx
movq (%r14), %rax
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq *0x98(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rdi
callq 0x60b0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96d44
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x64(%r15), %r13d
testl %r13d, %r13d
sete %al
orb %al, %r12b
jne 0x96d67
leal -0x9(%r13), %eax
cmpl $-0x2, %eax
setb %al
orb 0x60(%r15), %al
je 0x96e8b
movq %r14, %rdi
movq %r15, %rsi
movq 0x28(%rsp), %r12
callq 0x1350a
cmpl $-0x3, %ebx
setae %cl
xorb $0x1, %al
orb %cl, %al
jne 0x96e45
movq %r14, %rdi
movl %ebp, %esi
callq 0xb40a
cmpl $0x2, 0x10(%rax)
je 0x96da7
movq %r14, %rdi
movl %ebp, %esi
callq 0xb40a
cmpl $0xc, 0x10(%rax)
jne 0x96db6
leaq 0x1e7dd(%rip), %rsi     # 0xb558b
movq %r12, %rdi
callq 0x64e0
leaq 0x2d14f(%rip), %rsi     # 0xc3f0c
movq %r12, %rdi
callq 0x64e0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x345e6
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x60b0
leaq 0x18(%rsp), %rbx
movq -0x10(%rbx), %rdi
cmpq %rbx, %rdi
je 0x96e01
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x24c1d(%rip), %rsi     # 0xbba25
movq %r12, %rdi
callq 0x64e0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x2bb66
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x60b0
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x96f00
jmp 0x96f0d
testl %r13d, %r13d
je 0x96ec2
leaq 0x2c8ec(%rip), %rsi     # 0xc373d
movq %r12, %rdi
callq 0x64e0
leaq 0x1ea4e(%rip), %rsi     # 0xb58ae
movq %r12, %rdi
callq 0x64e0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x345e6
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x60b0
jmp 0x96ef2
leaq 0x1ea1c(%rip), %rsi     # 0xb58ae
movq 0x28(%rsp), %r12
movq %r12, %rdi
callq 0x64e0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x345e6
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x60b0
jmp 0x96ef2
leaq 0x1e9e5(%rip), %rsi     # 0xb58ae
movq %r12, %rdi
callq 0x64e0
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x345e6
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x60b0
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96f0d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x96f42
jmp 0x96f6a
jmp 0x96f42
jmp 0x96f6a
jmp 0x96f42
jmp 0x96f6a
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %rbx, %rdi
jne 0x96f53
jmp 0x96f6d
jmp 0x96f6a
jmp 0x96f42
jmp 0x96f6a
jmp 0x96f42
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96f6d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96f6d
jmp 0x96f6a
jmp 0x96f6a
jmp 0x96f6a
jmp 0x96f6a
movq %rax, %r14
movq 0x28(%rsp), %rax
movq (%rax), %rdi
cmpq 0x30(%rsp), %rdi
je 0x96f8c
movq 0x30(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0