// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::to_function_name[abi:cxx11](unsigned int, spirv_cross::SPIRType const&, bool, bool, bool, bool, bool, bool, bool, unsigned int)
string CompilerMSL::to_function_name(uint32_t img, const SPIRType &imgtype, bool is_fetch, bool is_gather, bool, bool,
                                     bool has_offset, bool, bool has_dref, uint32_t)
{
	// Special-case gather. We have to alter the component being looked up
	// in the swizzle case.
	if (msl_options.swizzle_texture_samples && is_gather)
	{
		string fname = imgtype.image.depth ? "spvGatherCompareSwizzle" : "spvGatherSwizzle";
		fname += "<" + type_to_glsl(get<SPIRType>(imgtype.image.type)) + ", metal::" + type_to_glsl(imgtype);
		// Add the arg types ourselves. Yes, this sucks, but Clang can't
		// deduce template pack parameters in the middle of an argument list.
		switch (imgtype.image.dim)
		{
		case Dim2D:
			fname += ", float2";
			if (imgtype.image.arrayed)
				fname += ", uint";
			if (imgtype.image.depth)
				fname += ", float";
			if (!imgtype.image.depth || has_offset)
				fname += ", int2";
			break;
		case DimCube:
			fname += ", float3";
			if (imgtype.image.arrayed)
				fname += ", uint";
			if (imgtype.image.depth)
				fname += ", float";
			break;
		default:
			SPIRV_CROSS_THROW("Invalid texture dimension for gather op.");
		}
		fname += ">";
		return fname;
	}

	auto *combined = maybe_get<SPIRCombinedImageSampler>(img);

	// Texture reference
	string fname = to_expression(combined ? combined->image : img) + ".";
	if (msl_options.swizzle_texture_samples && !is_gather && is_sampled_image_type(imgtype))
		fname = "spvTextureSwizzle(" + fname;

	// Texture function and sampler
	if (is_fetch)
		fname += "read";
	else if (is_gather)
		fname += "gather";
	else
		fname += "sample";

	if (has_dref)
		fname += "_compare";

	return fname;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %r9d, %r12d
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movb 0x7df(%rsi), %al
andb %r12b, %al
cmpb $0x1, %al
jne 0x78483
leaq 0x25657(%rip), %rax     # 0x9d9a0
leaq 0x25668(%rip), %rsi     # 0x9d9b8
cmpb $0x0, 0x88(%r14)
cmovneq %rax, %rsi
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x6100
movl 0x80(%r14), %esi
movq %r15, %rdi
movq %rbx, %r13
callq 0x90a4
movq (%r15), %r8
leaq 0x68(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x98(%r8)
leaq 0x1ad36(%rip), %rsi     # 0x930cd
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x463dd
leaq 0x25619(%rip), %rdx     # 0x9d9c9
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xab3f
movq (%r15), %rax
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq *0x98(%rax)
movq %rsp, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x48(%rsp), %rdx
callq 0x1743e
movq %rsp, %rsi
movq %r13, %rdi
callq 0x64f0
movq %rsp, %rdi
callq 0x6548
leaq 0x48(%rsp), %rdi
callq 0x6548
leaq 0x28(%rsp), %rdi
callq 0x6548
leaq 0x88(%rsp), %rdi
callq 0x6548
leaq 0x68(%rsp), %rdi
callq 0x6548
movl 0x84(%r14), %eax
cmpl $0x1, %eax
je 0x78560
cmpl $0x3, %eax
jne 0x785eb
leaq 0x255aa(%rip), %rsi     # 0x9d9f2
movq %r13, %rdi
callq 0x64d0
cmpb $0x1, 0x89(%r14)
jne 0x78469
leaq 0x2557b(%rip), %rsi     # 0x9d9dc
movq %r13, %rdi
callq 0x64d0
cmpb $0x1, 0x88(%r14)
jne 0x785c7
leaq 0x25565(%rip), %r15     # 0x9d9e3
jmp 0x785bc
movl %r8d, %ebp
movl %edx, %r13d
movq %rbx, 0x20(%rsp)
movq %r15, %rdi
movl %edx, %esi
callq 0x625ca
testq %rax, %rax
je 0x784a1
movl 0x10(%rax), %r13d
movq %rsp, %rbx
movq %rbx, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x2b9f0
leaq 0x1d370(%rip), %rdx     # 0x95829
movq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0xab3f
movq %rsp, %rdi
callq 0x6548
movb 0x7df(%r15), %al
xorb $0x1, %al
orb %r12b, %al
jne 0x78516
movq %r15, %rdi
movq %r14, %rsi
callq 0x11ea2
testb %al, %al
je 0x78516
leaq 0x2552f(%rip), %rsi     # 0x9da24
movq %rsp, %rdi
movq %r13, %rdx
callq 0x625ff
movq %rsp, %rbx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x6320
movq %rbx, %rdi
callq 0x6548
leaq 0x2551a(%rip), %rax     # 0x9da37
leaq 0x1a566(%rip), %rcx     # 0x92a8a
testb %r12b, %r12b
cmovneq %rax, %rcx
leaq 0x25c8b(%rip), %rsi     # 0x9e1bd
testb %bpl, %bpl
cmoveq %rcx, %rsi
movq %r13, %rdi
callq 0x64d0
cmpb $0x0, 0x100(%rsp)
je 0x785d6
leaq 0x254e8(%rip), %rsi     # 0x9da3e
movq %r13, %rdi
callq 0x64d0
jmp 0x785d6
leaq 0x2546c(%rip), %rsi     # 0x9d9d3
movq %r13, %rdi
callq 0x64d0
cmpb $0x1, 0x89(%r14)
jne 0x78588
leaq 0x2545c(%rip), %rsi     # 0x9d9dc
movq %r13, %rdi
callq 0x64d0
leaq 0x2545c(%rip), %r15     # 0x9d9eb
cmpb $0x1, 0x88(%r14)
jne 0x785bc
leaq 0x25443(%rip), %rsi     # 0x9d9e3
movq %r13, %rdi
callq 0x64d0
movb 0x88(%r14), %al
notb %al
orb 0xf0(%rsp), %al
testb $0x1, %al
je 0x785c7
movq %r13, %rdi
movq %r15, %rsi
callq 0x64d0
leaq 0x16c06(%rip), %rsi     # 0x8f1d4
movq %r13, %rdi
callq 0x64d0
movq %r13, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r15
leaq 0x253fe(%rip), %rsi     # 0x9d9fb
movq %rsp, %rdi
leaq 0x28(%rsp), %rdx
callq 0x6100
movb $0x1, %bl
movq %rsp, %rsi
movq %r15, %rdi
callq 0x6f6e
xorl %ebx, %ebx
leaq 0x6e7a0(%rip), %rsi     # 0xe6dc0
movq 0x6f9b9(%rip), %rdx     # 0xe7fe0
movq %r15, %rdi
callq 0x6490
movq %rax, %r14
movq %rsp, %rdi
callq 0x6548
testb %bl, %bl
jne 0x78643
jmp 0x786b2
movq %rax, %r14
movq %r15, %rdi
callq 0x6200
jmp 0x786b2
jmp 0x786a3
movq %rax, %r14
movq %rsp, %rdi
callq 0x6548
jmp 0x7865f
movq %rax, %r14
leaq 0x48(%rsp), %rdi
callq 0x6548
jmp 0x7866e
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x6548
jmp 0x7867d
movq %rax, %r14
leaq 0x88(%rsp), %rdi
callq 0x6548
jmp 0x7868f
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x6548
jmp 0x786b2
movq %rax, %r14
movq %rsp, %rdi
jmp 0x786b5
movq %rax, %r14
movq 0x20(%rsp), %rdi
jmp 0x786b5
jmp 0x786af
movq %rax, %r14
movq %r13, %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0