// File: /workspace/github_cpp_makefile_star2_O1/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 0x3b437
leaq 0x7b3d8(%rip), %rcx     # 0xb67e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7d4d2(%rip), %rax     # 0xb88ee
leaq 0x7d4d4(%rip), %rcx     # 0xb88f7
jmp 0x3b44e
leaq 0x7d518(%rip), %rax     # 0xb8944
jmp 0x3b47d
leaq 0x7d4d0(%rip), %rax     # 0xb8905
jmp 0x3b47d
leaq 0x7a471(%rip), %rax     # 0xb58af
jmp 0x3b47d
leaq 0x7d4be(%rip), %rax     # 0xb8905
leaq 0x7d4c0(%rip), %rcx     # 0xb890e
testb $0x1, 0x43c(%r15)
cmovneq %rax, %rcx
cmpb $0x0, 0x89(%r13)
cmoveq %rax, %rcx
movq %rcx, 0x10(%rsp)
jmp 0x3b482
leaq 0x7d4e6(%rip), %rax     # 0xb895a
jmp 0x3b47d
leaq 0x7d4d0(%rip), %rax     # 0xb894d
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movl %r8d, %esi
callq 0x3b2d4
movb %al, 0xf(%rsp)
leaq 0x7d1de(%rip), %rsi     # 0xb8676
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b4e1
leaq 0x7d227(%rip), %rsi     # 0xb86d2
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b4e1
leaq 0x7d19a(%rip), %rsi     # 0xb8658
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b4e1
leaq 0x7d1db(%rip), %rsi     # 0xb86ac
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3b58c
movb 0x43c(%r15), %al
movl 0x438(%r15), %ecx
cmpl $0x12c, %ecx            # imm = 0x12C
setb %dl
andb %al, %dl
cmpb $0x1, %dl
jne 0x3b53a
cmpb $0x0, 0xf(%rsp)
je 0x3b58c
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7de42(%rip), %rsi     # 0xb935c
leaq 0x7de54(%rip), %rdx     # 0xb9375
leaq 0x18(%rsp), %rdi
callq 0x7c64
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26a0a
jmp 0x3b575
cmpl $0x82, %ecx
setae %cl
orb %cl, %al
jne 0x3b58c
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7de1f(%rip), %rsi     # 0xb9376
leaq 0x7de31(%rip), %rdx     # 0xb938f
leaq 0x18(%rsp), %rdi
callq 0x7c64
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26a0a
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3b58c
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7d0ee(%rip), %rsi     # 0xb8681
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b5b2
leaq 0x7d13b(%rip), %rsi     # 0xb86e1
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3b612
cmpb $0x1, 0x43c(%r15)
jne 0x3b5cd
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
jbe 0x3ba50
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7ddcd(%rip), %rsi     # 0xb93aa
leaq 0x7ddd8(%rip), %rdx     # 0xb93bc
leaq 0x18(%rsp), %rdi
callq 0x7c64
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26a0a
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3b612
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b812
testb %al, %al
je 0x3b6ae
cmpb $0x1, 0x43c(%r15)
jne 0x3b6ae
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3b6ae
leaq 0x87f32(%rip), %rsi     # 0xc3578
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b669
leaq 0x7d047(%rip), %rsi     # 0xb86a0
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3baac
leaq 0x28(%rsp), %rbp
movq %rbp, -0x10(%rbp)
leaq 0x7dd44(%rip), %rsi     # 0xb93bd
leaq 0x7dd53(%rip), %rdx     # 0xb93d3
leaq 0x18(%rsp), %rdi
callq 0x7c64
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x26a0a
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3b6ae
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
xorl %ebp, %ebp
cmpb $0x1, 0x43c(%r15)
jne 0x3b6d7
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3b6d7
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b812
movl %eax, %ebp
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x1b812
leaq 0x7dd14(%rip), %rcx     # 0xb9400
leaq 0x87e85(%rip), %rsi     # 0xc3578
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 0x7c64
leaq 0x87e5a(%rip), %rsi     # 0xc3578
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b7f8
leaq 0x7cf41(%rip), %rsi     # 0xb8676
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b81f
leaq 0x7cf54(%rip), %rsi     # 0xb86a0
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b872
leaq 0x7cef5(%rip), %rsi     # 0xb8658
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b8a6
leaq 0x7cf58(%rip), %rsi     # 0xb86d2
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b908
leaq 0x7cef0(%rip), %rsi     # 0xb8681
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b958
leaq 0x7cf04(%rip), %rsi     # 0xb86ac
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
je 0x3b9d0
leaq 0x7cf22(%rip), %rsi     # 0xb86e1
movq %r14, %rdi
callq 0x60a0
testl %eax, %eax
jne 0x3bb05
cmpb $0x0, 0xf(%rsp)
je 0x3ba32
leaq 0x7cf07(%rip), %rcx     # 0xb86e8
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54eca
jmp 0x3b98c
testb %bpl, %bpl
je 0x3b97a
leaq 0x7dc1a(%rip), %rcx     # 0xb9422
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54b82
jmp 0x3b98c
cmpb $0x0, 0xf(%rsp)
je 0x3b97a
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x7dbd7(%rip), %rax     # 0xb9413
leaq 0x7ce3a(%rip), %rcx     # 0xb867d
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 0x54cc6
jmp 0x3b98c
leaq 0x7db8e(%rip), %rax     # 0xb9407
leaq 0x7ce27(%rip), %rdx     # 0xb86a7
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 0x54cc6
jmp 0x3b98c
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x83580(%rip), %rcx     # 0xbee39
leaq 0x7db6a(%rip), %rdx     # 0xb942a
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x7db40(%rip), %rax     # 0xb941e
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 0x54cc6
jmp 0x3b98c
cmpb $0x0, 0xf(%rsp)
je 0x3b9b5
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x7daea(%rip), %rax     # 0xb940f
leaq 0x7cdad(%rip), %rcx     # 0xb86d9
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 0x54cc6
jmp 0x3b98c
cmpb $0x0, 0xf(%rsp)
je 0x3b97a
leaq 0x7cd22(%rip), %rcx     # 0xb8688
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54e1e
jmp 0x3b98c
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54c2e
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
je 0x3b9a3
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 0x7cceb(%rip), %rcx     # 0xb86a7
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54d72
jmp 0x3b98c
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x7ccd0(%rip), %rcx     # 0xb86b3
leaq 0x7da3c(%rip), %rdx     # 0xb9426
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x7da12(%rip), %rax     # 0xb941a
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 0x54cc6
jmp 0x3b98c
leaq 0x7ccc4(%rip), %rcx     # 0xb86fd
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x54f76
jmp 0x3b98c
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d92c(%rip), %rdx     # 0xb9390
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x54a6a
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc1310(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc12e8(%rip), %rsi     # 0xfcd80
movq 0xc2539(%rip), %rdx     # 0xfdfd8
movq %r15, %rdi
callq 0x6470
jmp 0x3bb5c
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d914(%rip), %rdx     # 0xb93d4
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x54af6
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc12b4(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc128c(%rip), %rsi     # 0xfcd80
movq 0xc24dd(%rip), %rdx     # 0xfdfd8
movq %r15, %rdi
callq 0x6470
jmp 0x3bb5c
movl $0x10, %edi
callq 0x6140
movq %rax, %r15
leaq 0x7d919(%rip), %rsi     # 0xb9432
leaq 0x38(%rsp), %rdi
movq %r14, %rdx
callq 0x55022
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %r15, %rdi
callq 0x6320
leaq 0xc125b(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%r15)
xorl %ebp, %ebp
leaq 0xc1233(%rip), %rsi     # 0xfcd80
movq 0xc2484(%rip), %rdx     # 0xfdfd8
movq %r15, %rdi
callq 0x6470
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bb82
movq 0x48(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x3bb82
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3bbe3
movq %r15, %rdi
callq 0x6200
jmp 0x3bbe3
jmp 0x3bbe0
jmp 0x3bbe0
jmp 0x3bbab
jmp 0x3bbcb
jmp 0x3bbe0
jmp 0x3bbe0
jmp 0x3bbe0
jmp 0x3bbef
jmp 0x3bbef
jmp 0x3bc0d
jmp 0x3bc0d
jmp 0x3bbef
jmp 0x3bc0d
movq %rax, %rbx
leaq 0x28(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bbd1
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x3bbd1
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x3bc10
movq %r15, %rdi
callq 0x6200
jmp 0x3bc10
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %r12, %rdi
jne 0x3bbfc
jmp 0x3bc10
movq %rax, %rbx
movq 0x18(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3bc10
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x3bc10
jmp 0x3bc0d
movq %rax, %rbx
movq %rbx, %rdi
callq 0x64a0