// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::convert_separate_image_to_expression[abi:cxx11](unsigned int)
std::string CompilerGLSL::convert_separate_image_to_expression(uint32_t id)
{
	auto *var = maybe_get_backing_variable(id);

	// If we are fetching from a plain OpTypeImage, we must combine with a dummy sampler in GLSL.
	// In Vulkan GLSL, we can make use of the newer GL_EXT_samplerless_texture_functions.
	if (var)
	{
		auto &type = get<SPIRType>(var->basetype);
		if (type.basetype == SPIRType::Image && type.image.sampled == 1 && type.image.dim != DimBuffer)
		{
			if (options.vulkan_semantics)
			{
				// Newer glslang supports this extension to deal with texture2D as argument to texture functions.
				if (dummy_sampler_id)
					SPIRV_CROSS_THROW("Vulkan GLSL should not have a dummy sampler for combining.");
				require_extension_internal("GL_EXT_samplerless_texture_functions");
			}
			else
			{
				if (!dummy_sampler_id)
					SPIRV_CROSS_THROW(
					    "Cannot find dummy sampler ID. Was build_dummy_sampler_for_combined_images() called?");

				return to_combined_image_sampler(id, dummy_sampler_id);
			}
		}
	}

	return to_expression(id);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0xc8(%rbp)
movq %rdi, %rax
movq %rax, -0xc0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
movl -0x14(%rbp), %esi
callq 0x1fa90
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x7cd3f
movq -0xb8(%rbp), %rdi
movq -0x20(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0xd, 0xc(%rax)
jne 0x7cd3d
movq -0x28(%rbp), %rax
cmpl $0x1, 0x8c(%rax)
jne 0x7cd3d
movq -0x28(%rbp), %rax
cmpl $0x5, 0x84(%rax)
je 0x7cd3d
movq -0xb8(%rbp), %rax
testb $0x1, 0x43e(%rax)
je 0x7cc3c
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x39c(%rax)
je 0x7cbb0
movb $0x1, -0x5d(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xd8(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
callq 0x7650
movq -0xd0(%rbp), %rdx
leaq 0xc5f42(%rip), %rsi     # 0x142a6d
leaq -0x48(%rbp), %rdi
callq 0x7520
jmp 0x7cb36
movq -0xd8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9c50
jmp 0x7cb48
movq -0xd8(%rbp), %rdi
movb $0x0, -0x5d(%rbp)
leaq 0x13127e(%rip), %rsi    # 0x1addd8
leaq -0x72ed1(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x7cd6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7cb8e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7708
leaq -0x49(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x5d(%rbp)
jne 0x7cb9f
jmp 0x7cbab
movq -0xd8(%rbp), %rdi
callq 0x72c0
jmp 0x7cd65
leaq -0x81(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x7650
movq -0xe0(%rbp), %rdx
leaq 0xc5ed7(%rip), %rsi     # 0x142aa8
leaq -0x80(%rbp), %rdi
callq 0x7520
jmp 0x7cbdc
movq -0xb8(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x589d0
jmp 0x7cbee
leaq -0x80(%rbp), %rdi
callq 0x7708
leaq -0x81(%rbp), %rdi
callq 0x73d0
jmp 0x7cd3b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7cc2b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x7708
leaq -0x81(%rbp), %rdi
callq 0x73d0
jmp 0x7cd65
movq -0xb8(%rbp), %rax
cmpl $0x0, 0x39c(%rax)
jne 0x7cd1d
movb $0x1, -0xaa(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xf0(%rbp)
leaq -0xa9(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x7650
movq -0xe8(%rbp), %rdx
leaq 0xc5e44(%rip), %rsi     # 0x142acd
leaq -0xa8(%rbp), %rdi
callq 0x7520
jmp 0x7cc97
movq -0xf0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x9c50
jmp 0x7ccac
movq -0xf0(%rbp), %rdi
movb $0x0, -0xaa(%rbp)
leaq 0x131117(%rip), %rsi    # 0x1addd8
leaq -0x73038(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x7cd6e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7ccf8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x7708
leaq -0xa9(%rbp), %rdi
callq 0x73d0
testb $0x1, -0xaa(%rbp)
jne 0x7cd0f
jmp 0x7cd1b
movq -0xf0(%rbp), %rdi
callq 0x72c0
jmp 0x7cd65
movq -0xb8(%rbp), %rsi
movq -0xc8(%rbp), %rdi
movl -0x14(%rbp), %edx
movl 0x39c(%rsi), %ecx
callq 0x7afa0
jmp 0x7cd55
jmp 0x7cd3d
jmp 0x7cd3f
movq -0xb8(%rbp), %rsi
movq -0xc8(%rbp), %rdi
movl -0x14(%rbp), %edx
callq 0x71b50
movq -0xc0(%rbp), %rax
addq $0xf0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x7640
nop