// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::sampler_type[abi:cxx11](spirv_cross::SPIRType const&)
std::string CompilerMSL::sampler_type(const SPIRType &type)
{
	if (!type.array.empty())
	{
		if (!msl_options.supports_msl_version(2))
			SPIRV_CROSS_THROW("MSL 2.0 or greater is required for arrays of samplers.");

		if (type.array.size() > 1)
			SPIRV_CROSS_THROW("Arrays of arrays of samplers are not supported in MSL.");

		// Arrays of samplers in MSL must be declared with a special array<T, N> syntax ala C++11 std::array.
		uint32_t array_size =
		    type.array_size_literal.back() ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
		if (array_size == 0)
			SPIRV_CROSS_THROW("Unsized array of samplers is not supported in MSL.");

		auto &parent = get<SPIRType>(get_non_pointer_type(type).parent_type);
		return join("array<", sampler_type(parent), ", ", array_size, ">");
	}
	else
		return "sampler";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x8690
testb $0x1, %al
jne 0x10300d
movq -0xd8(%rbp), %rdi
addq $0x7cc, %rdi            # imm = 0x7CC
movl $0x2, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x1160d0
testb $0x1, %al
jne 0x102d64
movb $0x1, -0x4d(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xf8(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x7650
movq -0xf0(%rbp), %rdx
leaq 0x4a8fb(%rip), %rsi     # 0x14d5da
leaq -0x38(%rbp), %rdi
callq 0x7520
jmp 0x102cea
movq -0xf8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x9c50
jmp 0x102cfc
movq -0xf8(%rbp), %rdi
movb $0x0, -0x4d(%rbp)
leaq 0xab0ca(%rip), %rsi     # 0x1addd8
leaq -0xf9085(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x10307d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x102d42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x7708
leaq -0x39(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x4d(%rbp)
jne 0x102d53
jmp 0x102d5f
movq -0xf8(%rbp), %rdi
callq 0x72c0
jmp 0x103074
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x8650
cmpq $0x1, %rax
jbe 0x102e33
movb $0x1, -0x72(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x108(%rbp)
leaq -0x71(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x7650
movq -0x100(%rbp), %rdx
leaq 0x4a863(%rip), %rsi     # 0x14d611
leaq -0x70(%rbp), %rdi
callq 0x7520
jmp 0x102db9
movq -0x108(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x9c50
jmp 0x102dcb
movq -0x108(%rbp), %rdi
movb $0x0, -0x72(%rbp)
leaq 0xaaffb(%rip), %rsi     # 0x1addd8
leaq -0xf9154(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x10307d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x102e11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x7708
leaq -0x71(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x72(%rbp)
jne 0x102e22
jmp 0x102e2e
movq -0x108(%rbp), %rdi
callq 0x72c0
jmp 0x103074
movq -0x18(%rbp), %rdi
addq $0x38, %rdi
callq 0x2fe70
testb $0x1, %al
jne 0x102e46
jmp 0x102e5d
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x2fe30
movl (%rax), %eax
movl %eax, -0x10c(%rbp)
jmp 0x102e8a
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x2fe30
movq -0xd8(%rbp), %rdi
movl (%rax), %esi
callq 0x31910
movq %rax, %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x2f560
movl %eax, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
movl %eax, -0x78(%rbp)
cmpl $0x0, -0x78(%rbp)
jne 0x102f6d
movb $0x1, -0x9a(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x120(%rbp)
leaq -0x99(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x7650
movq -0x118(%rbp), %rdx
leaq 0x4a772(%rip), %rsi     # 0x14d648
leaq -0x98(%rbp), %rdi
callq 0x7520
jmp 0x102ee4
movq -0x120(%rbp), %rdi
leaq -0x98(%rbp), %rsi
callq 0x9c50
jmp 0x102ef9
movq -0x120(%rbp), %rdi
movb $0x0, -0x9a(%rbp)
leaq 0xaaeca(%rip), %rsi     # 0x1addd8
leaq -0xf9285(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x10307d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x102f45
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x7708
leaq -0x99(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x9a(%rbp)
jne 0x102f5c
jmp 0x102f68
movq -0x120(%rbp), %rdi
callq 0x72c0
jmp 0x103074
movq -0xd8(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x22e00
movq -0xd8(%rbp), %rdi
movl 0x9c(%rax), %esi
callq 0xea90
movq -0xd8(%rbp), %rsi
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x128(%rbp)
callq 0x102c40
movq -0xe8(%rbp), %rdi
movq -0x128(%rbp), %rdx
leaq 0x3b5e7(%rip), %rsi     # 0x13e5b3
leaq 0x415bc(%rip), %rcx     # 0x14458f
leaq 0x3b211(%rip), %r9      # 0x13e1eb
leaq -0x78(%rbp), %r8
callq 0x117b90
jmp 0x102fe5
leaq -0xc8(%rbp), %rdi
callq 0x7708
jmp 0x103064
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x7708
jmp 0x103074
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x7650
movq -0xe8(%rbp), %rdi
movq -0x130(%rbp), %rdx
leaq 0x44ff2(%rip), %rsi     # 0x148027
callq 0x7520
jmp 0x10303c
leaq -0xc9(%rbp), %rdi
callq 0x73d0
jmp 0x103064
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc9(%rbp), %rdi
callq 0x73d0
jmp 0x103074
movq -0xe0(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x7640
nopl (%rax)