// File: /workspace/github_cpp_makefile_star2_O2/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 0x3034d
leaq 0x604b6(%rip), %rcx     # 0x907b4
movslq (%rcx,%rax,4), %rdx
addq %rcx, %rdx
leaq 0x625c9(%rip), %rax     # 0x928d5
jmpq *%rdx
leaq 0x625a9(%rip), %rax     # 0x928be
leaq 0x625ab(%rip), %rcx     # 0x928c7
jmp 0x30325
leaq 0x625b9(%rip), %rcx     # 0x928de
testb $0x1, 0x43c(%r15)
cmovneq %rax, %rcx
cmpb $0x0, 0x89(%r13)
cmoveq %rax, %rcx
movq %rcx, 0x10(%rsp)
jmp 0x3036b
leaq 0x625d2(%rip), %rax     # 0x9291d
jmp 0x30366
leaq 0x5f533(%rip), %rax     # 0x8f887
jmp 0x30366
leaq 0x625b7(%rip), %rax     # 0x92914
jmp 0x30366
leaq 0x625c4(%rip), %rax     # 0x9292a
movq %rax, 0x10(%rsp)
movq %r15, %rdi
movl %r8d, %esi
callq 0x301f4
movl %eax, %ebp
leaq 0x622c7(%rip), %rsi     # 0x92646
movq %r14, %rdi
callq 0x17431
testb %al, %al
jne 0x303c4
leaq 0x62310(%rip), %rsi     # 0x926a2
movq %r14, %rdi
callq 0x17431
testb %al, %al
jne 0x303c4
leaq 0x62283(%rip), %rsi     # 0x92628
movq %r14, %rdi
callq 0x17431
testb %al, %al
jne 0x303c4
leaq 0x622c4(%rip), %rsi     # 0x9267c
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x3043e
cmpb $0x1, 0x43c(%r15)
jne 0x30405
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x30405
testb %bpl, %bpl
je 0x3043e
leaq 0x62f45(%rip), %rsi     # 0x9332c
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x6100
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x21390
jmp 0x30434
movq %r15, %rdi
callq 0x41b9c
testb %al, %al
je 0x3043e
leaq 0x62f2e(%rip), %rsi     # 0x93346
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x6100
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x21390
leaq 0x18(%rsp), %rdi
callq 0x6548
leaq 0x6220c(%rip), %rsi     # 0x92651
movq %r14, %rdi
callq 0x17431
testb %al, %al
jne 0x30464
leaq 0x62259(%rip), %rsi     # 0x926b1
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x304ac
cmpb $0x1, 0x43c(%r15)
jne 0x3047f
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
jbe 0x30899
leaq 0x62ef4(%rip), %rsi     # 0x9337a
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x6100
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x21390
leaq 0x18(%rsp), %rdi
callq 0x6548
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x16cd4
testb %al, %al
je 0x3052c
cmpb $0x1, 0x43c(%r15)
jne 0x3052c
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3052c
leaq 0x6d024(%rip), %rsi     # 0x9d500
movq %r14, %rdi
callq 0x17431
testb %al, %al
jne 0x304ff
leaq 0x62181(%rip), %rsi     # 0x92670
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x308e5
leaq 0x62e87(%rip), %rsi     # 0x9338d
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x6100
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x21390
leaq 0x18(%rsp), %rdi
callq 0x6548
movb %bpl, 0xf(%rsp)
movq %rbx, %rbp
xorl %ebx, %ebx
cmpb $0x1, 0x43c(%r15)
jne 0x3055d
cmpl $0x12b, 0x438(%r15) # imm = 0x12B
ja 0x3055d
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x16cd4
movl %eax, %ebx
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x16cd4
leaq 0x62e5e(%rip), %rcx     # 0x933d0
leaq 0x6cf87(%rip), %rsi     # 0x9d500
testb %al, %al
cmovneq %rcx, %rsi
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x6100
leaq 0x6cf6b(%rip), %rsi     # 0x9d500
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x305c7
testb %bl, %bl
je 0x30783
leaq 0x62e42(%rip), %rcx     # 0x933f2
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43c7f
jmp 0x30795
leaq 0x62078(%rip), %rsi     # 0x92646
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x3062d
cmpb $0x0, 0xf(%rsp)
je 0x30783
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x62dec(%rip), %rax     # 0x933e3
leaq 0x6204f(%rip), %rcx     # 0x9264d
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 %rbp, %rdi
callq 0x43d63
jmp 0x30795
leaq 0x6203c(%rip), %rsi     # 0x92670
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x30673
leaq 0x62d90(%rip), %rax     # 0x933d7
leaq 0x62029(%rip), %rdx     # 0x92677
testb %bl, %bl
cmovneq %rax, %rdx
leaq 0x38(%rsp), %rcx
movq %rdx, (%rcx)
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43d63
jmp 0x30795
leaq 0x61fae(%rip), %rsi     # 0x92628
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x306e8
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x68738(%rip), %rcx     # 0x98dd1
leaq 0x62d5a(%rip), %rdx     # 0x933fa
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x62d30(%rip), %rax     # 0x933ee
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 %rbp, %rdi
callq 0x43d63
jmp 0x30795
leaq 0x61fb3(%rip), %rsi     # 0x926a2
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x3074b
cmpb $0x0, 0xf(%rsp)
je 0x307b1
cmpl $0x12c, 0x438(%r15) # imm = 0x12C
leaq 0x62cc7(%rip), %rax     # 0x933df
leaq 0x61f8a(%rip), %rcx     # 0x926a9
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 %rbp, %rdi
callq 0x43d63
jmp 0x30795
leaq 0x61eff(%rip), %rsi     # 0x92651
movq %r14, %rdi
callq 0x17431
testb %al, %al
movb 0xf(%rsp), %r12b
je 0x307cc
testb %r12b, %r12b
je 0x30783
leaq 0x61ee9(%rip), %rcx     # 0x92658
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43e57
jmp 0x30795
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43cf9
leaq 0x18(%rsp), %rdi
callq 0x6548
movq %rbp, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x61ebf(%rip), %rcx     # 0x92677
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43ddd
jmp 0x30795
leaq 0x61ea9(%rip), %rsi     # 0x9267c
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x30841
movl 0x438(%r15), %eax
cmpl $0x82, %eax
leaq 0x61e91(%rip), %rcx     # 0x92683
leaq 0x62bfd(%rip), %rdx     # 0x933f6
cmovaeq %rcx, %rdx
movb 0x43c(%r15), %sil
testb %sil, %sil
cmovneq %rcx, %rdx
cmpl $0x12c, %eax            # imm = 0x12C
leaq 0x62bd3(%rip), %rax     # 0x933ea
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 %rbp, %rdi
callq 0x43d63
jmp 0x30795
leaq 0x61e69(%rip), %rsi     # 0x926b1
movq %r14, %rdi
callq 0x17431
testb %al, %al
je 0x3092e
testb %r12b, %r12b
je 0x3087b
leaq 0x61e54(%rip), %rcx     # 0x926b8
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43ed1
jmp 0x30795
leaq 0x61e4b(%rip), %rcx     # 0x926cd
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rbp, %rdi
callq 0x43f4b
jmp 0x30795
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r15
leaq 0x62ab5(%rip), %rdx     # 0x93360
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x43bab
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xb64ef(%rip), %rsi     # 0xe6dc0
movq 0xb7708(%rip), %rdx     # 0xe7fe0
movq %r15, %rdi
callq 0x6490
jmp 0x30975
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r15
leaq 0x62aad(%rip), %rdx     # 0x933a4
leaq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x43c15
movb $0x1, %bpl
leaq 0x18(%rsp), %rsi
movq %r15, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xb64a3(%rip), %rsi     # 0xe6dc0
movq 0xb76bc(%rip), %rdx     # 0xe7fe0
movq %r15, %rdi
callq 0x6490
jmp 0x30975
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r15
leaq 0x62ac2(%rip), %rsi     # 0x93402
leaq 0x38(%rsp), %rdi
movq %r14, %rdx
callq 0x43fc5
movb $0x1, %bpl
leaq 0x38(%rsp), %rsi
movq %r15, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xb645a(%rip), %rsi     # 0xe6dc0
movq 0xb7673(%rip), %rdx     # 0xe7fe0
movq %r15, %rdi
callq 0x6490
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x3098c
jmp 0x309d6
movq %rax, %rbx
movq %r15, %rdi
callq 0x6200
jmp 0x309d6
jmp 0x309d3
jmp 0x309d3
jmp 0x309d3
jmp 0x309b0
jmp 0x309c4
jmp 0x309d3
jmp 0x309d3
jmp 0x309d3
jmp 0x309d3
jmp 0x309e4
jmp 0x309e4
jmp 0x309d3
jmp 0x309e4
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x309c7
jmp 0x309e7
movq %rax, %rbx
movq %r15, %rdi
callq 0x6200
jmp 0x309e7
jmp 0x309d3
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x6548
jmp 0x309e7
jmp 0x309e4
movq %rax, %rbx
movq %rbx, %rdi
callq 0x64b0
nop