// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::to_sampler_expression[abi:cxx11](unsigned int)
string CompilerMSL::to_sampler_expression(uint32_t id)
{
	auto *combined = maybe_get<SPIRCombinedImageSampler>(id);
	auto expr = to_expression(combined ? combined->image : id);
	auto index = expr.find_first_of('[');

	uint32_t samp_id = 0;
	if (combined)
		samp_id = combined->sampler;

	if (index == string::npos)
		return samp_id ? to_expression(samp_id) : expr + sampler_name_suffix;
	else
	{
		auto image_expr = expr.substr(0, index);
		auto array_expr = expr.substr(index);
		return samp_id ? to_expression(samp_id) : (image_expr + sampler_name_suffix + array_expr);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xe0(%rbp)
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
movl -0x14(%rbp), %esi
callq 0xdc700
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xf32a4
movq -0x20(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xe4(%rbp)
jmp 0xf32ad
movl -0x14(%rbp), %eax
movl %eax, -0xe4(%rbp)
movq -0xd0(%rbp), %rsi
movl -0xe4(%rbp), %edx
leaq -0x40(%rbp), %rdi
callq 0x71b50
leaq -0x40(%rbp), %rdi
movl $0x5b, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x7230
movq %rax, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xf32f1
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x4c(%rbp)
cmpq $-0x1, -0x48(%rbp)
jne 0xf3357
cmpl $0x0, -0x4c(%rbp)
je 0xf3318
movq -0xd0(%rbp), %rsi
movq -0xe0(%rbp), %rdi
movl -0x4c(%rbp), %edx
callq 0x71b50
jmp 0xf3316
jmp 0xf333a
movq -0xe0(%rbp), %rdi
movq -0xd0(%rbp), %rdx
addq $0x9a0, %rdx            # imm = 0x9A0
leaq -0x40(%rbp), %rsi
callq 0x11960
jmp 0xf3338
jmp 0xf333a
movl $0x1, -0x60(%rbp)
jmp 0xf3486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xf349f
movq -0x48(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
leaq -0x80(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x73a0
jmp 0xf336e
movq -0x48(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movq $-0x1, %rcx
callq 0x73a0
jmp 0xf338b
movl -0x4c(%rbp), %eax
movb $0x0, -0xc1(%rbp)
cmpl $0x0, %eax
je 0xf33b4
movq -0xd0(%rbp), %rsi
movq -0xe0(%rbp), %rdi
movl -0x4c(%rbp), %edx
callq 0x71b50
jmp 0xf33b2
jmp 0xf33f9
movq -0xd0(%rbp), %rdx
addq $0x9a0, %rdx            # imm = 0x9A0
leaq -0xc0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x11960
jmp 0xf33d4
movq -0xe0(%rbp), %rdi
movb $0x1, -0xc1(%rbp)
leaq -0xc0(%rbp), %rsi
leaq -0xa0(%rbp), %rdx
callq 0xa1530
jmp 0xf33f7
jmp 0xf33f9
testb $0x1, -0xc1(%rbp)
jne 0xf3404
jmp 0xf3410
leaq -0xc0(%rbp), %rdi
callq 0x7708
movl $0x1, -0x60(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x7708
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0xf3486
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xf347b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xf346f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
testb $0x1, -0xc1(%rbp)
jne 0xf3461
jmp 0xf346d
leaq -0xc0(%rbp), %rdi
callq 0x7708
jmp 0xf346f
leaq -0xa0(%rbp), %rdi
callq 0x7708
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0xf349f
leaq -0x40(%rbp), %rdi
callq 0x7708
movq -0xd8(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x40(%rbp), %rdi
callq 0x7708
movq -0x58(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)