// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_hlsl.cpp
// Function: spirv_cross::CompilerHLSL::type_to_glsl[abi:cxx11](spirv_cross::SPIRType const&, unsigned int)
string CompilerHLSL::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_hlsl(type, id);

	case SPIRType::Sampler:
		return comparison_ids.count(id) ? "SamplerComparisonState" : "SamplerState";

	case SPIRType::Void:
		return "void";

	default:
		break;
	}

	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 "min16float";
		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("bool", type.vecsize);
		case SPIRType::Int:
			return join("int", type.vecsize);
		case SPIRType::UInt:
			return join("uint", type.vecsize);
		case SPIRType::Half:
			return join("min16float", type.vecsize);
		case SPIRType::Float:
			return join("float", type.vecsize);
		case SPIRType::Double:
			return join("double", type.vecsize);
		case SPIRType::Int64:
			return join("i64vec", type.vecsize);
		case SPIRType::UInt64:
			return join("u64vec", type.vecsize);
		default:
			return "???";
		}
	}
	else
	{
		switch (type.basetype)
		{
		case SPIRType::Boolean:
			return join("bool", type.columns, "x", type.vecsize);
		case SPIRType::Int:
			return join("int", type.columns, "x", type.vecsize);
		case SPIRType::UInt:
			return join("uint", type.columns, "x", type.vecsize);
		case SPIRType::Half:
			return join("min16float", type.columns, "x", type.vecsize);
		case SPIRType::Float:
			return join("float", type.columns, "x", type.vecsize);
		case SPIRType::Double:
			return join("double", type.columns, "x", type.vecsize);
		// Matrix types not supported for int64/uint64.
		default:
			return "???";
		}
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl %ecx, 0x4(%rsp)
movl 0xc(%rdx), %eax
cmpl $0xc, %eax
jle 0x636e9
leal -0xd(%rax), %edi
cmpl $0x2, %edi
jae 0x6374d
movq %rbx, %rdi
callq 0x6369a
jmp 0x637b3
cmpl $0x1, %eax
je 0x63796
cmpl $0xc, %eax
jne 0x637be
cmpb $0x1, 0x623(%rsi)
jne 0x6380a
movl 0x8(%rdx), %edx
movq (%rsi), %rax
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x53332(%rip), %rsi     # 0xb6a57
movq %rbx, %rdi
movq %r14, %rdx
callq 0x582dd
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x637b3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x637b3
cmpl $0xf, %eax
jne 0x637be
addq $0x360, %rsi            # imm = 0x360
leaq 0x4(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1f4b4
testq %rax, %rax
leaq 0x582bc(%rip), %rcx     # 0xbba2f
leaq 0x5829e(%rip), %rsi     # 0xbba18
cmoveq %rcx, %rsi
leaq 0x16(%rsi), %rdx
leaq 0xc(%rsi), %rcx
testq %rax, %rax
cmoveq %rcx, %rdx
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
jmp 0x637ab
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5454d(%rip), %rsi     # 0xb7cf1
leaq 0x5454a(%rip), %rdx     # 0xb7cf5
movq %rbx, %rdi
callq 0x7be0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movl 0x14(%rdx), %ecx
movl 0x18(%rdx), %edi
movl %ecx, %r8d
xorl $0x1, %r8d
movl %edi, %r9d
xorl $0x1, %r9d
orl %r8d, %r9d
jne 0x6381d
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x6387f
leaq 0x578d2(%rip), %rcx     # 0xbb0bc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x53fa9(%rip), %rsi     # 0xb77aa
leaq 0x53fa6(%rip), %rdx     # 0xb77ae
jmp 0x637ab
movl 0x8(%rdx), %edx
movq (%rsi), %rax
movq %rbx, %rdi
movl $0x1, %ecx
callq *0x38(%rax)
jmp 0x637b3
leaq 0x14(%rdx), %r8
cmpl $0x1, %edi
sete %sil
cmpl $0x2, %ecx
setae %cl
andb %sil, %cl
addl $-0x2, %eax
cmpb $0x1, %cl
jne 0x6385a
cmpl $0x9, %eax
ja 0x6387f
leaq 0x5784f(%rip), %rcx     # 0xbb094
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x53f55(%rip), %rsi     # 0xb77aa
jmp 0x63a33
cmpl $0x9, %eax
ja 0x6387f
addq $0x18, %rdx
leaq 0x57802(%rip), %rcx     # 0xbb06c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x53f30(%rip), %rsi     # 0xb77aa
jmp 0x6395e
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x57017(%rip), %rsi     # 0xba8a4
leaq 0x57013(%rip), %rdx     # 0xba8a7
jmp 0x637ab
movq 0x610(%rsi), %rsi
jmp 0x638c3
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x53ee4(%rip), %rsi     # 0xb7794
leaq 0x53ee8(%rip), %rdx     # 0xb779f
jmp 0x637ab
movq 0x608(%rsi), %rsi
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
callq 0x6100
jmp 0x637b3
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x58159(%rip), %rsi     # 0xbba3c
leaq 0x5815c(%rip), %rdx     # 0xbba46
jmp 0x637ab
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5f130(%rip), %rsi     # 0xc2a2d
leaq 0x5f12e(%rip), %rdx     # 0xc2a32
jmp 0x637ab
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x56f85(%rip), %rsi     # 0xba89c
leaq 0x56f85(%rip), %rdx     # 0xba8a3
jmp 0x637ab
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x56f6a(%rip), %rsi     # 0xba89b
leaq 0x56f6b(%rip), %rdx     # 0xba8a3
jmp 0x637ab
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x5a72f(%rip), %rsi     # 0xbe07a
leaq 0x5a72e(%rip), %rdx     # 0xbe080
jmp 0x637ab
leaq 0x5f0c8(%rip), %rsi     # 0xc2a26
leaq 0x56418(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x5850d
jmp 0x637b3
leaq 0x5a701(%rip), %rsi     # 0xbe07a
leaq 0x563fd(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x585ab
jmp 0x637b3
leaq 0x539bb(%rip), %rsi     # 0xb734f
leaq 0x563e2(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x58649
jmp 0x637b3
leaq 0x5808d(%rip), %rsi     # 0xbba3c
leaq 0x563c7(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x754b8
jmp 0x637b3
leaq 0x5f063(%rip), %rsi     # 0xc2a2d
leaq 0x563ac(%rip), %rcx     # 0xb9d7d
movq %rbx, %rdi
callq 0x75556
jmp 0x637b3
leaq 0x58057(%rip), %rsi     # 0xbba3c
movq %rbx, %rdi
movq %r8, %rdx
callq 0x753a0
jmp 0x637b3
leaq 0x53953(%rip), %rsi     # 0xb734f
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58481
jmp 0x637b3
leaq 0x5f01a(%rip), %rsi     # 0xc2a2d
movq %rbx, %rdi
movq %r8, %rdx
callq 0x7542c
jmp 0x637b3
leaq 0x5a650(%rip), %rsi     # 0xbe07a
jmp 0x63a53
leaq 0x5eff3(%rip), %rsi     # 0xc2a26
movq %rbx, %rdi
movq %r8, %rdx
callq 0x58369
jmp 0x637b3
leaq 0x56e79(%rip), %rsi     # 0xba8c3
jmp 0x63a53
leaq 0x56e77(%rip), %rsi     # 0xba8ca
movq %rbx, %rdi
movq %r8, %rdx
callq 0x583f5
jmp 0x637b3
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x63a81
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop