// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl %ecx, 0x34(%rsp)
movl 0xc(%rdx), %eax
decl %eax
cmpl $0xe, %eax
ja 0x3e0fb
leaq 0x531ea(%rip), %rdx     # 0x91224
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movq (%r15), %rax
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq *0xb0(%rax)
jmp 0x3e0dd
addq $0x360, %r15            # imm = 0x360
leaq 0x34(%rsp), %rsi
movq %r15, %rdi
callq 0x1aeea
testq %rax, %rax
leaq 0x5a9d8(%rip), %rax     # 0x98a50
leaq 0x577e4(%rip), %rsi     # 0x95863
cmoveq %rax, %rsi
jmp 0x3e0d0
cmpb $0x1, 0x623(%r15)
jne 0x3e180
movl 0x8(%r14), %edx
movq (%r15), %rax
leaq 0x10(%rsp), %r14
pushq $0x1
popq %rcx
movq %r14, %rdi
movq %r15, %rsi
callq *0x38(%rax)
leaq 0x53985(%rip), %rsi     # 0x91a37
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4691c
leaq 0x10(%rsp), %rdi
callq 0x6548
jmp 0x3e0dd
leaq 0x54c01(%rip), %rsi     # 0x92cd1
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
callq 0x41b9c
testb %al, %al
jne 0x3e35d
movl 0x14(%r14), %eax
movl 0x18(%r14), %ecx
movl %eax, %edx
xorl $0x1, %edx
movl %ecx, %esi
xorl $0x1, %esi
orl %edx, %esi
jne 0x3e13a
movl 0xc(%r14), %eax
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x3e1e9
leaq 0x531b0(%rip), %rcx     # 0x912d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x54652(%rip), %rsi     # 0x9278a
jmp 0x3e0d0
leaq 0x14(%r14), %r8
cmpl $0x1, %ecx
sete %dl
cmpl $0x2, %eax
setae %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x3e198
movl 0xc(%r14), %eax
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x3e1e9
leaq 0x53145(%rip), %rcx     # 0x912b0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5770d(%rip), %rsi     # 0x95888
jmp 0x3e2c5
movl 0x8(%r14), %edx
movq (%r15), %rax
pushq $0x1
popq %rcx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x38(%rax)
jmp 0x3e0dd
movl 0xc(%r14), %edx
addl $-0x2, %edx
cmpl %ecx, %eax
jne 0x3e1c4
cmpl $0x9, %edx
ja 0x3e1e9
leaq 0x530d9(%rip), %rax     # 0x91288
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x576f2(%rip), %rsi     # 0x958b1
jmp 0x3e2c5
cmpl $0x9, %edx
ja 0x3e1e9
addq $0x18, %r14
leaq 0x5308c(%rip), %rax     # 0x91260
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x576cd(%rip), %rsi     # 0x958b1
jmp 0x3e2dc
leaq 0x57694(%rip), %rsi     # 0x95884
jmp 0x3e0d0
movq 0x610(%r15), %rsi
jmp 0x3e0d0
leaq 0x5456c(%rip), %rsi     # 0x92774
jmp 0x3e0d0
movq 0x608(%r15), %rsi
jmp 0x3e0d0
leaq 0x57651(%rip), %rsi     # 0x95871
jmp 0x3e0d0
leaq 0x5f7b9(%rip), %rsi     # 0x9d9e5
jmp 0x3e0d0
leaq 0x57644(%rip), %rsi     # 0x9587c
jmp 0x3e0d0
leaq 0x57637(%rip), %rsi     # 0x9587b
jmp 0x3e0d0
leaq 0x5adba(%rip), %rsi     # 0x9900a
jmp 0x3e0d0
leaq 0x5763b(%rip), %rsi     # 0x95897
jmp 0x3e2fa
leaq 0x57625(%rip), %rsi     # 0x9588d
jmp 0x3e2c5
leaq 0x57635(%rip), %rsi     # 0x958a6
jmp 0x3e32f
leaq 0x57621(%rip), %rsi     # 0x9589e
jmp 0x3e2c5
leaq 0x5760c(%rip), %rsi     # 0x95892
jmp 0x3e2c5
leaq 0x57614(%rip), %rsi     # 0x958a3
jmp 0x3e2fa
leaq 0x57612(%rip), %rsi     # 0x958aa
jmp 0x3e2fa
leaq 0x5761a(%rip), %rsi     # 0x958bb
jmp 0x3e2c5
leaq 0x57611(%rip), %rsi     # 0x958bb
jmp 0x3e2dc
leaq 0x57614(%rip), %rsi     # 0x958c7
jmp 0x3e2c5
leaq 0x5760b(%rip), %rsi     # 0x958c7
jmp 0x3e2dc
leaq 0x575f1(%rip), %rsi     # 0x958b6
movq %rbx, %rdi
movq %r8, %rdx
callq 0x46986
jmp 0x3e0dd
leaq 0x575da(%rip), %rsi     # 0x958b6
leaq 0x56a7a(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
movq %r14, %rdx
callq 0x46ac4
jmp 0x3e0dd
leaq 0x575c6(%rip), %rsi     # 0x958c0
movq %rbx, %rdi
movq %r8, %rdx
callq 0x469f0
jmp 0x3e0dd
leaq 0x575af(%rip), %rsi     # 0x958c0
leaq 0x56a45(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
movq %r14, %rdx
callq 0x46b40
jmp 0x3e0dd
leaq 0x57594(%rip), %rsi     # 0x958c3
movq %rbx, %rdi
movq %r8, %rdx
callq 0x46a5a
jmp 0x3e0dd
leaq 0x5757d(%rip), %rsi     # 0x958c3
leaq 0x56a10(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
movq %r14, %rdx
callq 0x46bbc
jmp 0x3e0dd
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x54d1b(%rip), %rsi     # 0x9308a
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xa8a29(%rip), %rsi     # 0xe6dc0
movq 0xa9c42(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x3e3bd
jmp 0x3e3d4
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
jmp 0x3e3d4
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6548
movq %r14, %rdi
callq 0x64b0