// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::legacy_tex_op(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, spirv_cross::SPIRType const&, unsigned int, unsigned int)
string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtype, uint32_t lod, uint32_t tex)
{
	const char *type;
	switch (imgtype.image.dim)
	{
	case spv::Dim1D:
		type = (imgtype.image.arrayed && !options.es) ? "1DArray" : "1D";
		break;
	case spv::Dim2D:
		type = (imgtype.image.arrayed && !options.es) ? "2DArray" : "2D";
		break;
	case spv::Dim3D:
		type = "3D";
		break;
	case spv::DimCube:
		type = "Cube";
		break;
	case spv::DimBuffer:
		type = "Buffer";
		break;
	case spv::DimSubpassData:
		type = "2D";
		break;
	default:
		type = "";
		break;
	}

	bool use_explicit_lod = check_explicit_lod_allowed(lod);

	if (op == "textureLod" || op == "textureProjLod" || op == "textureGrad" || op == "textureProjGrad")
	{
		if (is_legacy_es())
		{
			if (use_explicit_lod)
				require_extension_internal("GL_EXT_shader_texture_lod");
		}
		else if (is_legacy())
			require_extension_internal("GL_ARB_shader_texture_lod");
	}

	if (op == "textureLodOffset" || op == "textureProjLodOffset")
	{
		if (is_legacy_es())
			SPIRV_CROSS_THROW(join(op, " not allowed in legacy ES"));

		require_extension_internal("GL_EXT_gpu_shader4");
	}

	// GLES has very limited support for shadow samplers.
	// Basically shadow2D and shadow2DProj work through EXT_shadow_samplers,
	// everything else can just throw
	if (image_is_comparison(imgtype, tex) && is_legacy_es())
	{
		if (op == "texture" || op == "textureProj")
			require_extension_internal("GL_EXT_shadow_samplers");
		else
			SPIRV_CROSS_THROW(join(op, " not allowed on depth samplers in legacy ES"));
	}

	bool is_es_and_depth = is_legacy_es() && image_is_comparison(imgtype, tex);
	std::string type_prefix = image_is_comparison(imgtype, tex) ? "shadow" : "texture";

	if (op == "texture")
		return is_es_and_depth ? join(type_prefix, type, "EXT") : join(type_prefix, type);
	else if (op == "textureLod")
	{
		if (use_explicit_lod)
			return join(type_prefix, type, is_legacy_es() ? "LodEXT" : "Lod");
		else
			return join(type_prefix, type);
	}
	else if (op == "textureProj")
		return join(type_prefix, type, is_es_and_depth ? "ProjEXT" : "Proj");
	else if (op == "textureGrad")
		return join(type_prefix, type, is_legacy_es() ? "GradEXT" : is_legacy_desktop() ? "GradARB" : "Grad");
	else if (op == "textureProjLod")
	{
		if (use_explicit_lod)
			return join(type_prefix, type, is_legacy_es() ? "ProjLodEXT" : "ProjLod");
		else
			return join(type_prefix, type, "Proj");
	}
	else if (op == "textureLodOffset")
	{
		if (use_explicit_lod)
			return join(type_prefix, type, "LodOffset");
		else
			return join(type_prefix, type);
	}
	else if (op == "textureProjGrad")
		return join(type_prefix, type,
		            is_legacy_es() ? "ProjGradEXT" : is_legacy_desktop() ? "ProjGradARB" : "ProjGrad");
	else if (op == "textureProjLodOffset")
	{
		if (use_explicit_lod)
			return join(type_prefix, type, "ProjLodOffset");
		else
			return join(type_prefix, type, "ProjOffset");
	}
	else
	{
		SPIRV_CROSS_THROW(join("Unsupported legacy texture op: ", op));
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %r9d, %r12d
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl 0x84(%rcx), %eax
cmpq $0x6, %rax
ja 0x3ac2b
leaq 0x7abd4(%rip), %rcx     # 0xb57d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7ccce(%rip), %rax     # 0xb78de
leaq 0x7ccd0(%rip), %rcx     # 0xb78e7
jmp 0x3ac42
leaq 0x7cd14(%rip), %rax     # 0xb7934
jmp 0x3ac71
leaq 0x7cccc(%rip), %rax     # 0xb78f5
jmp 0x3ac71
leaq 0x79c7d(%rip), %rax     # 0xb48af
jmp 0x3ac71
leaq 0x7ccba(%rip), %rax     # 0xb78f5
leaq 0x7ccbc(%rip), %rcx     # 0xb78fe
testb $0x1, 0x43c(%r15)
cmovneq %rax, %rcx
cmpb $0x0, 0x89(%r13)
cmoveq %rax, %rcx
movq %rcx, 0x10(%rsp)
jmp 0x3ac76
leaq 0x7cce2(%rip), %rax     # 0xb794a
jmp 0x3ac71
leaq 0x7cccc(%rip), %rax     # 0xb793d
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movl %r8d, %esi
callq 0x3aaca
movb %al, 0xf(%rsp)
leaq 0x7c9da(%rip), %rsi     # 0xb7666
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3acd5
leaq 0x7ca23(%rip), %rsi     # 0xb76c2
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3acd5
leaq 0x7c996(%rip), %rsi     # 0xb7648
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3acd5
leaq 0x7c9d7(%rip), %rsi     # 0xb769c
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3ad80
movb 0x43c(%r15), %al
movl 0x438(%r15), %ecx
cmpl $0x12c, %ecx            # imm = 0x12C
setb %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x3ad2e
cmpb $0x0, 0xf(%rsp)
je 0x3ad80
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7d63e(%rip), %rsi     # 0xb834c
leaq 0x7d650(%rip), %rdx     # 0xb8365
leaq 0x18(%rsp), %rdi
callq 0x7be0
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26356
jmp 0x3ad69
cmpl $0x82, %ecx
setae %cl
orb %cl, %al
jne 0x3ad80
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7d61b(%rip), %rsi     # 0xb8366
leaq 0x7d62d(%rip), %rdx     # 0xb837f
leaq 0x18(%rsp), %rdi
callq 0x7be0
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26356
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3ad80
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7c8ea(%rip), %rsi     # 0xb7671
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3ada6
leaq 0x7c937(%rip), %rsi     # 0xb76d1
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3ae06
cmpb $0x1, 0x43c(%r15)
jne 0x3adc1
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
jbe 0x3b244
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7d5c9(%rip), %rsi     # 0xb839a
leaq 0x7d5d4(%rip), %rdx     # 0xb83ac
leaq 0x18(%rsp), %rdi
callq 0x7be0
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26356
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3ae06
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b12c
testb %al, %al
je 0x3aea2
cmpb $0x1, 0x43c(%r15)
jne 0x3aea2
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3aea2
leaq 0x8770e(%rip), %rsi     # 0xc2548
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3ae5d
leaq 0x7c843(%rip), %rsi     # 0xb7690
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3b2a0
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7d540(%rip), %rsi     # 0xb83ad
leaq 0x7d54f(%rip), %rdx     # 0xb83c3
leaq 0x18(%rsp), %rdi
callq 0x7be0
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26356
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3aea2
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
xorl %ebp, %ebp
cmpb $0x1, 0x43c(%r15)
jne 0x3aecb
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3aecb
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b12c
movl %eax, %ebp
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b12c
leaq 0x7d510(%rip), %rcx     # 0xb83f0
leaq 0x87661(%rip), %rsi     # 0xc2548
testb %al, %al
cmovneq %rcx, %rsi
leaq 0x28(%rsp), %r12
movq %r12, -0x10(%r12)
movzbl %al, %edx
xorq $0x7, %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7be0
leaq 0x87636(%rip), %rsi     # 0xc2548
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3afec
leaq 0x7c73d(%rip), %rsi     # 0xb7666
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b013
leaq 0x7c750(%rip), %rsi     # 0xb7690
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b066
leaq 0x7c6f1(%rip), %rsi     # 0xb7648
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b09a
leaq 0x7c754(%rip), %rsi     # 0xb76c2
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b0fc
leaq 0x7c6ec(%rip), %rsi     # 0xb7671
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b14c
leaq 0x7c700(%rip), %rsi     # 0xb769c
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b1c4
leaq 0x7c71e(%rip), %rsi     # 0xb76d1
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3b2f9
cmpb $0x0, 0xf(%rsp)
je 0x3b226
leaq 0x7c703(%rip), %rcx     # 0xb76d8
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x546d0
jmp 0x3b180
testb %bpl, %bpl
je 0x3b16e
leaq 0x7d416(%rip), %rcx     # 0xb8412
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54388
jmp 0x3b180
cmpb $0x0, 0xf(%rsp)
je 0x3b16e
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x7d3d3(%rip), %rax     # 0xb8403
leaq 0x7c636(%rip), %rcx     # 0xb766d
cmovaeq %rcx, %rax
cmpb $0x0, 0x43c(%r15)
cmoveq %rcx, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x544cc
jmp 0x3b180
leaq 0x7d38a(%rip), %rax     # 0xb83f7
leaq 0x7c623(%rip), %rdx     # 0xb7697
testb %bpl, %bpl
cmovneq %rax, %rdx
leaq 0x38(%rsp), %rcx
movq %rdx, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x544cc
jmp 0x3b180
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x82d94(%rip), %rcx     # 0xbde41
leaq 0x7d366(%rip), %rdx     # 0xb841a
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x7d33c(%rip), %rax     # 0xb840e
cmovaeq %rdx, %rax
testb %sil, %sil
cmoveq %rdx, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x544cc
jmp 0x3b180
cmpb $0x0, 0xf(%rsp)
je 0x3b1a9
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x7d2e6(%rip), %rax     # 0xb83ff
leaq 0x7c5a9(%rip), %rcx     # 0xb76c9
cmovaeq %rcx, %rax
cmpb $0x0, 0x43c(%r15)
cmoveq %rcx, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x544cc
jmp 0x3b180
cmpb $0x0, 0xf(%rsp)
je 0x3b16e
leaq 0x7c51e(%rip), %rcx     # 0xb7678
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54624
jmp 0x3b180
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54434
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x3b197
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7c4e7(%rip), %rcx     # 0xb7697
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54578
jmp 0x3b180
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x7c4cc(%rip), %rcx     # 0xb76a3
leaq 0x7d238(%rip), %rdx     # 0xb8416
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x7d20e(%rip), %rax     # 0xb840a
cmovaeq %rdx, %rax
testb %sil, %sil
cmoveq %rdx, %rax
leaq 0x38(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x544cc
jmp 0x3b180
leaq 0x7c4c0(%rip), %rcx     # 0xb76ed
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x5477c
jmp 0x3b180
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d128(%rip), %rdx     # 0xb8380
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x54270
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc0b4c(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc0b24(%rip), %rsi     # 0xfbdb0
movq 0xc1d45(%rip), %rdx     # 0xfcfd8
movq %r15, %rdi
callq 0x6470
jmp 0x3b350
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d110(%rip), %rdx     # 0xb83c4
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x542fc
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc0af0(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc0ac8(%rip), %rsi     # 0xfbdb0
movq 0xc1ce9(%rip), %rdx     # 0xfcfd8
movq %r15, %rdi
callq 0x6470
jmp 0x3b350
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d115(%rip), %rsi     # 0xb8422
leaq 0x38(%rsp), %rdi
movq %r14, %rdx
callq 0x54828
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc0a97(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc0a6f(%rip), %rsi     # 0xfbdb0
movq 0xc1c90(%rip), %rdx     # 0xfcfd8
movq %r15, %rdi
callq 0x6470
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3b36e
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x3b378
jmp 0x3b3d1
movq %rax, %rbx
movq %r15, %rdi
callq 0x6200
jmp 0x3b3d1
jmp 0x3b3ce
jmp 0x3b3ce
jmp 0x3b39c
jmp 0x3b3c1
jmp 0x3b3ce
jmp 0x3b3ce
jmp 0x3b3ce
jmp 0x3b3dd
jmp 0x3b3dd
jmp 0x3b3fb
jmp 0x3b3fb
jmp 0x3b3dd
jmp 0x3b3fb
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3b3ba
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x3b3c4
jmp 0x3b3fe
movq %rax, %rbx
movq %r15, %rdi
callq 0x6200
jmp 0x3b3fe
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3b3ea
jmp 0x3b3fe
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3b3fe
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x3b3fe
jmp 0x3b3fb
movq %rax, %rbx
movq %rbx, %rdi
callq 0x64a0