// File: /workspace/github_cpp_makefile_star2_O3/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 0x96707
movb 0x88(%r14), %al
testb %al, %al
leaq 0x2c37e(%rip), %rcx     # 0xc29e8
leaq 0x2c38f(%rip), %rsi     # 0xc2a00
cmovneq %rcx, %rsi
leaq 0x10(%rsi), %rdx
leaq 0x17(%rsi), %rcx
testb %al, %al
cmovneq %rcx, %rdx
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq %rbx, %rdi
callq 0x7be0
movl 0x80(%r14), %esi
movq %r15, %rdi
callq 0xa3ea
movq (%r15), %r8
leaq 0x88(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
callq *0x98(%r8)
leaq 0x21a2b(%rip), %rcx     # 0xb80ed
leaq 0x88(%rsp), %rdi
movl $0x1, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x62c0
leaq 0x78(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x96842
movq %rdx, 0x68(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x78(%rsp)
jmp 0x9684a
movl %r8d, %ebp
movl %edx, %r13d
movq %r14, 0x60(%rsp)
movq %r15, %rdi
movl %edx, %esi
callq 0x7a260
testq %rax, %rax
je 0x96725
movl 0x10(%rax), %r13d
movq %rsp, %r14
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x33f8a
leaq 0x2410c(%rip), %rsi     # 0xba849
movq %r14, %rdi
callq 0x64e0
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x96767
movq %rdx, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x9676f
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x10(%rsp), %r14
movq -0x10(%r14), %rdi
cmpq %r14, %rdi
je 0x967a1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movb 0x7df(%r15), %al
xorb $0x1, %al
orb %r12b, %al
jne 0x967f5
movq %r15, %rdi
movq 0x60(%rsp), %rsi
callq 0x14b1c
testb %al, %al
je 0x967f5
leaq 0x2c2a5(%rip), %rsi     # 0xc2a6c
movq %rsp, %rdi
movq %rbx, %rdx
callq 0x7a29a
movq %rsp, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6310
movq (%r15), %rdi
cmpq %r14, %rdi
je 0x967f5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x2c283(%rip), %rax     # 0xc2a7f
leaq 0x212a7(%rip), %rcx     # 0xb7aaa
testb %r12b, %r12b
cmovneq %rax, %rcx
leaq 0x2c9f4(%rip), %rsi     # 0xc3205
testb %bpl, %bpl
cmoveq %rcx, %rsi
movq %rbx, %rdi
callq 0x64e0
cmpb $0x0, 0x100(%rsp)
je 0x96acf
leaq 0x2c251(%rip), %rsi     # 0xc2a86
movq %rbx, %rdi
callq 0x64e0
jmp 0x96acf
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
leaq 0x68(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x2c1a4(%rip), %rsi     # 0xc2a11
callq 0x64e0
leaq 0x30(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x96899
movq %rdx, 0x20(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x30(%rsp)
jmp 0x968a0
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%r15), %rax
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq *0x98(%rax)
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %r8
movq 0x48(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %edi
cmpq %rbp, %rcx
je 0x968f0
movq 0x30(%rsp), %rdi
movq 0x40(%rsp), %rsi
cmpq %rdi, %rax
jbe 0x96913
leaq 0x50(%rsp), %r9
movl $0xf, %edi
cmpq %r9, %rsi
je 0x9690e
movq 0x50(%rsp), %rdi
cmpq %rdi, %rax
jbe 0x9691f
leaq 0x20(%rsp), %rdi
callq 0x60b0
jmp 0x9692d
leaq 0x40(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x62c0
leaq 0x10(%rsp), %rdx
movq %rdx, -0x10(%rdx)
movq (%rax), %rsi
leaq 0x10(%rax), %rcx
cmpq %rcx, %rsi
je 0x96950
movq %rsi, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x96956
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
leaq 0x10(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x9699f
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x969ba
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x969d1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x969e8
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96a09
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x6260
movl 0x84(%r14), %eax
cmpl $0x1, %eax
je 0x96a59
cmpl $0x3, %eax
jne 0x96ae4
leaq 0x2c015(%rip), %rsi     # 0xc2a3a
movq %rbx, %rdi
callq 0x64e0
cmpb $0x1, 0x89(%r14)
jne 0x96a46
leaq 0x2bfe6(%rip), %rsi     # 0xc2a24
movq %rbx, %rdi
callq 0x64e0
cmpb $0x1, 0x88(%r14)
jne 0x96ac0
leaq 0x2bfd4(%rip), %r15     # 0xc2a2b
jmp 0x96ab5
leaq 0x2bfbb(%rip), %rsi     # 0xc2a1b
movq %rbx, %rdi
callq 0x64e0
cmpb $0x1, 0x89(%r14)
jne 0x96a81
leaq 0x2bfab(%rip), %rsi     # 0xc2a24
movq %rbx, %rdi
callq 0x64e0
leaq 0x2bfab(%rip), %r15     # 0xc2a33
cmpb $0x1, 0x88(%r14)
jne 0x96ab5
leaq 0x2bf92(%rip), %rsi     # 0xc2a2b
movq %rbx, %rdi
callq 0x64e0
movb 0x88(%r14), %al
notb %al
orb 0xf0(%rsp), %al
testb $0x1, %al
je 0x96ac0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x64e0
leaq 0x1d735(%rip), %rsi     # 0xb41fc
movq %rbx, %rdi
callq 0x64e0
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r13
movq %rsp, %rdi
movq %r15, (%rdi)
leaq 0x2bf45(%rip), %rsi     # 0xc2a43
leaq 0x2bf66(%rip), %rdx     # 0xc2a6b
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %r13, %rdi
callq 0x6320
leaq 0x652a9(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r13)
xorl %ebp, %ebp
leaq 0x65280(%rip), %rsi     # 0xfbdb0
movq 0x664a1(%rip), %rdx     # 0xfcfd8
movq %r13, %rdi
callq 0x6470
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x96b58
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x96b65
jmp 0x96c43
movq %rax, %r14
movq %r13, %rdi
callq 0x6200
jmp 0x96c43
jmp 0x96c2d
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96b9a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96b9a
movq %rax, %r14
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96bba
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96bba
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %rbp, %rdi
je 0x96bd6
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96bd6
movq %rax, %r14
movq 0x68(%rsp), %rdi
cmpq %r13, %rdi
je 0x96bf2
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96bf2
movq %rax, %r14
leaq 0x98(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96c43
movq 0x98(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x96c43
movq %rax, %r14
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x96c57
movq 0x10(%rsp), %rsi
jmp 0x96c4f
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r13, %rdi
je 0x96c57
movq (%r13), %rsi
jmp 0x96c4f
jmp 0x96c40
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r12, %rdi
je 0x96c57
movq (%r12), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0
nop