// File: /workspace/github_cpp_makefile_star2_O3/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 0x4c768
leaq 0x69bd7(%rip), %r8      # 0xb6244
movslq (%r8,%rdi,4), %rdi
addq %r8, %rdi
jmpq *%rdi
movq (%rsi), %rax
movq %rbx, %rdi
callq *0xb0(%rax)
jmp 0x4c73a
addq $0x360, %rsi            # imm = 0x360
leaq 0x4(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1f4b4
testq %rax, %rax
leaq 0x71418(%rip), %rcx     # 0xbdac0
leaq 0x6e1d4(%rip), %rsi     # 0xba883
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 0x4c732
cmpb $0x1, 0x623(%rsi)
jne 0x4c7f6
movl 0x8(%rdx), %edx
movq (%rsi), %rax
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x6a362(%rip), %rsi     # 0xb6a57
movq %rbx, %rdi
movq %r14, %rdx
callq 0x582dd
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4c73a
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x4c73a
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6b5c6(%rip), %rsi     # 0xb7cf1
leaq 0x6b5c3(%rip), %rdx     # 0xb7cf5
movq %rbx, %rdi
callq 0x7be0
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 0x4ca2d
movl 0x14(%rdx), %ecx
movl 0x18(%rdx), %edi
movl %ecx, %r8d
xorl $0x1, %r8d
movl %edi, %r9d
xorl $0x1, %r9d
orl %r8d, %r9d
jne 0x4c7b7
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x4c856
leaq 0x69b64(%rip), %rcx     # 0xb62f8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6afff(%rip), %rsi     # 0xb77aa
leaq 0x6affc(%rip), %rdx     # 0xb77ae
jmp 0x4c732
leaq 0x14(%rdx), %r8
cmpl $0x1, %edi
sete %sil
cmpl $0x2, %ecx
setae %r9b
andb %sil, %r9b
addl $-0x2, %eax
cmpb $0x1, %r9b
jne 0x4c80c
cmpl $0x9, %eax
ja 0x4c856
leaq 0x69aef(%rip), %rcx     # 0xb62d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e0b7(%rip), %rsi     # 0xba8a8
jmp 0x4c99e
movl 0x8(%rdx), %edx
movq (%rsi), %rax
movq %rbx, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
jmp 0x4c73a
cmpl %edi, %ecx
jne 0x4c831
cmpl $0x9, %eax
ja 0x4c856
leaq 0x69a8c(%rip), %rcx     # 0xb62a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e0a5(%rip), %rsi     # 0xba8d1
jmp 0x4c99e
cmpl $0x9, %eax
ja 0x4c856
addq $0x18, %rdx
leaq 0x69a3f(%rip), %rcx     # 0xb6280
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x6e080(%rip), %rsi     # 0xba8d1
jmp 0x4c9b5
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6e040(%rip), %rsi     # 0xba8a4
leaq 0x6e03c(%rip), %rdx     # 0xba8a7
jmp 0x4c732
movq 0x610(%rsi), %rsi
jmp 0x4c89a
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6af0d(%rip), %rsi     # 0xb7794
leaq 0x6af11(%rip), %rdx     # 0xb779f
jmp 0x4c732
movq 0x608(%rsi), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
jmp 0x4c73a
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6dfd7(%rip), %rsi     # 0xba891
leaq 0x6dfd9(%rip), %rdx     # 0xba89a
jmp 0x4c732
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x76159(%rip), %rsi     # 0xc2a2d
leaq 0x76157(%rip), %rdx     # 0xc2a32
jmp 0x4c732
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6dfae(%rip), %rsi     # 0xba89c
leaq 0x6dfae(%rip), %rdx     # 0xba8a3
jmp 0x4c732
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x6df93(%rip), %rsi     # 0xba89b
leaq 0x6df94(%rip), %rdx     # 0xba8a3
jmp 0x4c732
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x71758(%rip), %rsi     # 0xbe07a
leaq 0x71757(%rip), %rdx     # 0xbe080
jmp 0x4c732
leaq 0x6df82(%rip), %rsi     # 0xba8b7
jmp 0x4c9d0
leaq 0x6df6c(%rip), %rsi     # 0xba8ad
jmp 0x4c99e
leaq 0x6df7c(%rip), %rsi     # 0xba8c6
jmp 0x4ca02
leaq 0x6df68(%rip), %rsi     # 0xba8be
jmp 0x4c99e
leaq 0x6df53(%rip), %rsi     # 0xba8b2
jmp 0x4c99e
leaq 0x6df5b(%rip), %rsi     # 0xba8c3
jmp 0x4c9d0
leaq 0x6df59(%rip), %rsi     # 0xba8ca
jmp 0x4c9d0
leaq 0x6df61(%rip), %rsi     # 0xba8db
jmp 0x4c99e
leaq 0x6df58(%rip), %rsi     # 0xba8db
jmp 0x4c9b5
leaq 0x6df5b(%rip), %rsi     # 0xba8e7
jmp 0x4c99e
leaq 0x6df52(%rip), %rsi     # 0xba8e7
jmp 0x4c9b5
leaq 0x6df38(%rip), %rsi     # 0xba8d6
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58369
jmp 0x4c73a
leaq 0x6df21(%rip), %rsi     # 0xba8d6
leaq 0x6d3c1(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x5850d
jmp 0x4c73a
leaq 0x6df10(%rip), %rsi     # 0xba8e0
movq %rbx, %rdi
movq %r8, %rdx
callq 0x583f5
jmp 0x4c73a
leaq 0x6def9(%rip), %rsi     # 0xba8e0
leaq 0x6d38f(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x585ab
jmp 0x4c73a
leaq 0x6dee1(%rip), %rsi     # 0xba8e3
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58481
jmp 0x4c73a
leaq 0x6deca(%rip), %rsi     # 0xba8e3
leaq 0x6d35d(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x58649
jmp 0x4c73a
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x6b660(%rip), %rsi     # 0xb80aa
leaq 0x6b68f(%rip), %rdx     # 0xb80e0
leaq 0x8(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0xaf356(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0xaf32e(%rip), %rsi     # 0xfbdb0
movq 0xb054f(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x4caab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x4cab5
jmp 0x4cadd
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
jmp 0x4cadd
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4cadd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0
nop