// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::can_use_io_location(spv::StorageClass, bool)
bool CompilerGLSL::can_use_io_location(StorageClass storage, bool block)
{
	// Location specifiers are must have in SPIR-V, but they aren't really supported in earlier versions of GLSL.
	// Be very explicit here about how to solve the issue.
	if ((get_execution_model() != ExecutionModelVertex && storage == StorageClassInput) ||
	    (get_execution_model() != ExecutionModelFragment && storage == StorageClassOutput))
	{
		uint32_t minimum_desktop_version = block ? 440 : 410;
		// ARB_enhanced_layouts vs ARB_separate_shader_objects ...

		if (!options.es && options.version < minimum_desktop_version && !options.separate_shader_objects)
			return false;
		else if (options.es && options.version < 310)
			return false;
	}

	if ((get_execution_model() == ExecutionModelVertex && storage == StorageClassInput) ||
	    (get_execution_model() == ExecutionModelFragment && storage == StorageClassOutput))
	{
		if (options.es && options.version < 300)
			return false;
		else if (!options.es && options.version < 330)
			return false;
	}

	if (storage == StorageClassUniform || storage == StorageClassUniformConstant)
	{
		if (options.es && options.version < 310)
			return false;
		else if (!options.es && options.version < 430)
			return false;
	}

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
andb $0x1, %al
movb %al, -0x15(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x28(%rbp)
callq 0x25400
cmpl $0x0, %eax
je 0x5cfbe
cmpl $0x1, -0x14(%rbp)
je 0x5cfd2
movq -0x28(%rbp), %rdi
callq 0x25400
cmpl $0x4, %eax
je 0x5d046
cmpl $0x3, -0x14(%rbp)
jne 0x5d046
movq -0x28(%rbp), %rax
movb -0x15(%rbp), %sil
movl $0x19a, %ecx            # imm = 0x19A
movl $0x1b8, %edx            # imm = 0x1B8
testb $0x1, %sil
cmovnel %edx, %ecx
movl %ecx, -0x1c(%rbp)
testb $0x1, 0x43c(%rax)
jne 0x5d01c
movq -0x28(%rbp), %rax
movl 0x438(%rax), %eax
cmpl -0x1c(%rbp), %eax
jae 0x5d01c
movq -0x28(%rbp), %rax
testb $0x1, 0x43f(%rax)
jne 0x5d01c
movb $0x0, -0x1(%rbp)
jmp 0x5d115
movq -0x28(%rbp), %rax
testb $0x1, 0x43c(%rax)
je 0x5d042
movq -0x28(%rbp), %rax
cmpl $0x136, 0x438(%rax)     # imm = 0x136
jae 0x5d042
movb $0x0, -0x1(%rbp)
jmp 0x5d115
jmp 0x5d044
jmp 0x5d046
movq -0x28(%rbp), %rdi
callq 0x25400
cmpl $0x0, %eax
jne 0x5d05a
cmpl $0x1, -0x14(%rbp)
je 0x5d06e
movq -0x28(%rbp), %rdi
callq 0x25400
cmpl $0x4, %eax
jne 0x5d0bb
cmpl $0x3, -0x14(%rbp)
jne 0x5d0bb
movq -0x28(%rbp), %rax
testb $0x1, 0x43c(%rax)
je 0x5d094
movq -0x28(%rbp), %rax
cmpl $0x12c, 0x438(%rax)     # imm = 0x12C
jae 0x5d094
movb $0x0, -0x1(%rbp)
jmp 0x5d115
movq -0x28(%rbp), %rax
testb $0x1, 0x43c(%rax)
jne 0x5d0b7
movq -0x28(%rbp), %rax
cmpl $0x14a, 0x438(%rax)     # imm = 0x14A
jae 0x5d0b7
movb $0x0, -0x1(%rbp)
jmp 0x5d115
jmp 0x5d0b9
jmp 0x5d0bb
cmpl $0x2, -0x14(%rbp)
je 0x5d0c7
cmpl $0x0, -0x14(%rbp)
jne 0x5d111
movq -0x28(%rbp), %rax
testb $0x1, 0x43c(%rax)
je 0x5d0ea
movq -0x28(%rbp), %rax
cmpl $0x136, 0x438(%rax)     # imm = 0x136
jae 0x5d0ea
movb $0x0, -0x1(%rbp)
jmp 0x5d115
movq -0x28(%rbp), %rax
testb $0x1, 0x43c(%rax)
jne 0x5d10d
movq -0x28(%rbp), %rax
cmpl $0x1ae, 0x438(%rax)     # imm = 0x1AE
jae 0x5d10d
movb $0x0, -0x1(%rbp)
jmp 0x5d115
jmp 0x5d10f
jmp 0x5d111
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq