// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::type_to_glsl[abi:cxx11](spirv_cross::SPIRType const&, unsigned int)
string CompilerGLSL::type_to_glsl(const SPIRType &type, uint32_t id)
{
	// Ignore the pointer type since GLSL doesn't have pointers.

	switch (type.basetype)
	{
	case SPIRType::Struct:
		// Need OpName lookup here to get a "sensible" name for a struct.
		if (backend.explicit_struct_type)
			return join("struct ", to_name(type.self));
		else
			return to_name(type.self);

	case SPIRType::Image:
	case SPIRType::SampledImage:
		return image_type_glsl(type, id);

	case SPIRType::Sampler:
		// The depth field is set by calling code based on the variable ID of the sampler, effectively reintroducing
		// this distinction into the type system.
		return comparison_ids.count(id) ? "samplerShadow" : "sampler";

	case SPIRType::Void:
		return "void";

	default:
		break;
	}

	if (type.basetype == SPIRType::UInt && is_legacy())
		SPIRV_CROSS_THROW("Unsigned integers are not supported on legacy targets.");

	if (type.vecsize == 1 && type.columns == 1) // Scalar builtin
	{
		switch (type.basetype)
		{
		case SPIRType::Boolean:
			return "bool";
		case SPIRType::Int:
			return backend.basic_int_type;
		case SPIRType::UInt:
			return backend.basic_uint_type;
		case SPIRType::AtomicCounter:
			return "atomic_uint";
		case SPIRType::Half:
			return "float16_t";
		case SPIRType::Float:
			return "float";
		case SPIRType::Double:
			return "double";
		case SPIRType::Int64:
			return "int64_t";
		case SPIRType::UInt64:
			return "uint64_t";
		default:
			return "???";
		}
	}
	else if (type.vecsize > 1 && type.columns == 1) // Vector builtin
	{
		switch (type.basetype)
		{
		case SPIRType::Boolean:
			return join("bvec", type.vecsize);
		case SPIRType::Int:
			return join("ivec", type.vecsize);
		case SPIRType::UInt:
			return join("uvec", type.vecsize);
		case SPIRType::Half:
			return join("f16vec", type.vecsize);
		case SPIRType::Float:
			return join("vec", type.vecsize);
		case SPIRType::Double:
			return join("dvec", type.vecsize);
		case SPIRType::Int64:
			return join("i64vec", type.vecsize);
		case SPIRType::UInt64:
			return join("u64vec", type.vecsize);
		default:
			return "???";
		}
	}
	else if (type.vecsize == type.columns) // Simple Matrix builtin
	{
		switch (type.basetype)
		{
		case SPIRType::Boolean:
			return join("bmat", type.vecsize);
		case SPIRType::Int:
			return join("imat", type.vecsize);
		case SPIRType::UInt:
			return join("umat", type.vecsize);
		case SPIRType::Half:
			return join("f16mat", type.vecsize);
		case SPIRType::Float:
			return join("mat", type.vecsize);
		case SPIRType::Double:
			return join("dmat", type.vecsize);
		// Matrix types not supported for int64/uint64.
		default:
			return "???";
		}
	}
	else
	{
		switch (type.basetype)
		{
		case SPIRType::Boolean:
			return join("bmat", type.columns, "x", type.vecsize);
		case SPIRType::Int:
			return join("imat", type.columns, "x", type.vecsize);
		case SPIRType::UInt:
			return join("umat", type.columns, "x", type.vecsize);
		case SPIRType::Half:
			return join("f16mat", type.columns, "x", type.vecsize);
		case SPIRType::Float:
			return join("mat", type.columns, "x", type.vecsize);
		case SPIRType::Double:
			return join("dmat", type.columns, "x", type.vecsize);
		// Matrix types not supported for int64/uint64.
		default:
			return "???";
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl %ecx, 0x4(%rsp)
movl 0xc(%rdx), %eax
leal -0x1(%rax), %edi
cmpl $0xe, %edi
ja 0x4cf02
leaq 0x6a44d(%rip), %r8      # 0xb7254
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
movq (%rsi), %rax
movq %rbx, %rdi
callq *0xb0(%rax)
jmp 0x4ced4
addq $0x360, %rsi            # imm = 0x360
leaq 0x4(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1fbce
testq %rax, %rax
leaq 0x71c76(%rip), %rcx     # 0xbeab8
leaq 0x6ea4a(%rip), %rsi     # 0xbb893
cmoveq %rcx, %rsi
leaq 0xd(%rsi), %rdx
leaq 0x7(%rsi), %rcx
testq %rax, %rax
cmoveq %rcx, %rdx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
jmp 0x4cecc
cmpb $0x1, 0x623(%rsi)
jne 0x4cf90
movl 0x8(%rdx), %edx
movq (%rsi), %rax
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x6abd8(%rip), %rsi     # 0xb7a67
movq %rbx, %rdi
movq %r14, %rdx
callq 0x58ad7
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ced4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x4ced4
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6be3c(%rip), %rsi     # 0xb8d01
leaq 0x6be39(%rip), %rdx     # 0xb8d05
movq %rbx, %rdi
callq 0x7c64
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpb $0x0, 0x43c(%rsi)
movl $0x12b, %ecx            # imm = 0x12B
movl $0x81, %edi
cmovnel %ecx, %edi
cmpl %edi, 0x438(%rsi)
jbe 0x4d1c7
movl 0x14(%rdx), %ecx
movl 0x18(%rdx), %edi
movl %ecx, %r8d
xorl $0x1, %r8d
movl %edi, %r9d
xorl $0x1, %r9d
orl %r8d, %r9d
jne 0x4cf51
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x4cff0
leaq 0x6a3da(%rip), %rcx     # 0xb7308
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6b875(%rip), %rsi     # 0xb87ba
leaq 0x6b872(%rip), %rdx     # 0xb87be
jmp 0x4cecc
leaq 0x14(%rdx), %r8
cmpl $0x1, %edi
sete %sil
cmpl $0x2, %ecx
setae %r9b
andb %sil, %r9b
addl $-0x2, %eax
cmpb $0x1, %r9b
jne 0x4cfa6
cmpl $0x9, %eax
ja 0x4cff0
leaq 0x6a365(%rip), %rcx     # 0xb72e0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e92d(%rip), %rsi     # 0xbb8b8
jmp 0x4d138
movl 0x8(%rdx), %edx
movq (%rsi), %rax
movq %rbx, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
jmp 0x4ced4
cmpl %edi, %ecx
jne 0x4cfcb
cmpl $0x9, %eax
ja 0x4cff0
leaq 0x6a302(%rip), %rcx     # 0xb72b8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e91b(%rip), %rsi     # 0xbb8e1
jmp 0x4d138
cmpl $0x9, %eax
ja 0x4cff0
addq $0x18, %rdx
leaq 0x6a2b5(%rip), %rcx     # 0xb7290
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e8f6(%rip), %rsi     # 0xbb8e1
jmp 0x4d14f
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6e8b6(%rip), %rsi     # 0xbb8b4
leaq 0x6e8b2(%rip), %rdx     # 0xbb8b7
jmp 0x4cecc
movq 0x610(%rsi), %rsi
jmp 0x4d034
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6b783(%rip), %rsi     # 0xb87a4
leaq 0x6b787(%rip), %rdx     # 0xb87af
jmp 0x4cecc
movq 0x608(%rsi), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
jmp 0x4ced4
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6e84d(%rip), %rsi     # 0xbb8a1
leaq 0x6e84f(%rip), %rdx     # 0xbb8aa
jmp 0x4cecc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x769ef(%rip), %rsi     # 0xc3a5d
leaq 0x769ed(%rip), %rdx     # 0xc3a62
jmp 0x4cecc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6e824(%rip), %rsi     # 0xbb8ac
leaq 0x6e824(%rip), %rdx     # 0xbb8b3
jmp 0x4cecc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6e809(%rip), %rsi     # 0xbb8ab
leaq 0x6e80a(%rip), %rdx     # 0xbb8b3
jmp 0x4cecc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x71fb6(%rip), %rsi     # 0xbf072
leaq 0x71fb5(%rip), %rdx     # 0xbf078
jmp 0x4cecc
leaq 0x6e7f8(%rip), %rsi     # 0xbb8c7
jmp 0x4d16a
leaq 0x6e7e2(%rip), %rsi     # 0xbb8bd
jmp 0x4d138
leaq 0x6e7f2(%rip), %rsi     # 0xbb8d6
jmp 0x4d19c
leaq 0x6e7de(%rip), %rsi     # 0xbb8ce
jmp 0x4d138
leaq 0x6e7c9(%rip), %rsi     # 0xbb8c2
jmp 0x4d138
leaq 0x6e7d1(%rip), %rsi     # 0xbb8d3
jmp 0x4d16a
leaq 0x6e7cf(%rip), %rsi     # 0xbb8da
jmp 0x4d16a
leaq 0x6e7d7(%rip), %rsi     # 0xbb8eb
jmp 0x4d138
leaq 0x6e7ce(%rip), %rsi     # 0xbb8eb
jmp 0x4d14f
leaq 0x6e7d1(%rip), %rsi     # 0xbb8f7
jmp 0x4d138
leaq 0x6e7c8(%rip), %rsi     # 0xbb8f7
jmp 0x4d14f
leaq 0x6e7ae(%rip), %rsi     # 0xbb8e6
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58b63
jmp 0x4ced4
leaq 0x6e797(%rip), %rsi     # 0xbb8e6
leaq 0x6dc37(%rip), %rcx     # 0xbad8d
movq %rbx, %rdi
callq 0x58d07
jmp 0x4ced4
leaq 0x6e786(%rip), %rsi     # 0xbb8f0
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58bef
jmp 0x4ced4
leaq 0x6e76f(%rip), %rsi     # 0xbb8f0
leaq 0x6dc05(%rip), %rcx     # 0xbad8d
movq %rbx, %rdi
callq 0x58da5
jmp 0x4ced4
leaq 0x6e757(%rip), %rsi     # 0xbb8f3
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58c7b
jmp 0x4ced4
leaq 0x6e740(%rip), %rsi     # 0xbb8f3
leaq 0x6dbd3(%rip), %rcx     # 0xbad8d
movq %rbx, %rdi
callq 0x58e43
jmp 0x4ced4
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6bed6(%rip), %rsi     # 0xb90ba
leaq 0x6bf05(%rip), %rdx     # 0xb90f0
leaq 0x8(%rsp), %rdi
callq 0x7c64
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xafb8c(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xafb64(%rip), %rsi     # 0xfcd80
movq 0xb0db5(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4d24d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x4d24d
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x4d27a
movq %rbx, %rdi
callq 0x6200
jmp 0x4d27a
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4d27a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0