// File: /workspace/github_cpp_makefile_star2_O2/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, 0x24(%rsp)
movl 0xc(%rdx), %eax
leal -0xd(%rax), %edi
cmpl $0x2, %edi
jb 0x51037
cmpl $0x1, %eax
je 0x5106f
cmpl $0xf, %eax
je 0x51041
cmpl $0xc, %eax
jne 0x5108c
cmpb $0x1, 0x623(%rsi)
jne 0x510ca
movl 0x8(%rdx), %edx
movq (%rsi), %rax
movq %rsp, %r14
pushq $0x1
popq %rcx
movq %r14, %rdi
callq *0x38(%rax)
leaq 0x40a15(%rip), %rsi     # 0x91a37
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4691c
movq %rsp, %rdi
callq 0x6548
jmp 0x51081
movq %rbx, %rdi
callq 0x50fa8
jmp 0x51081
addq $0x360, %rsi            # imm = 0x360
leaq 0x24(%rsp), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x1aeea
testq %rax, %rax
leaq 0x4595d(%rip), %rax     # 0x969bf
leaq 0x4593f(%rip), %rsi     # 0x969a8
cmoveq %rax, %rsi
jmp 0x51076
leaq 0x41c5b(%rip), %rsi     # 0x92cd1
movq %rsp, %rdx
movq %rbx, %rdi
callq 0x6100
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 0x510db
addl $-0x2, %eax
cmpl $0x9, %eax
ja 0x5113a
leaq 0x44f94(%rip), %rcx     # 0x9604c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x416c2(%rip), %rsi     # 0x9278a
jmp 0x51076
movl 0x8(%rdx), %edx
movq (%rsi), %rax
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq *0x38(%rax)
jmp 0x51081
leaq 0x14(%rdx), %r8
cmpl $0x1, %edi
sete %sil
cmpl $0x2, %ecx
setae %cl
andb %sil, %cl
addl $-0x2, %eax
cmpb $0x1, %cl
jne 0x51118
cmpl $0x9, %eax
ja 0x5113a
leaq 0x44f21(%rip), %rcx     # 0x96024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x41677(%rip), %rsi     # 0x9278a
jmp 0x51282
cmpl $0x9, %eax
ja 0x5113a
addq $0x18, %rdx
leaq 0x44ed4(%rip), %rcx     # 0x95ffc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x41652(%rip), %rsi     # 0x9278a
jmp 0x511ad
leaq 0x44743(%rip), %rsi     # 0x95884
jmp 0x51076
movq 0x610(%rsi), %rsi
jmp 0x51076
leaq 0x4161b(%rip), %rsi     # 0x92774
jmp 0x51076
movq 0x608(%rsi), %rsi
jmp 0x51076
leaq 0x4585b(%rip), %rsi     # 0x969cc
jmp 0x51076
leaq 0x4c868(%rip), %rsi     # 0x9d9e5
jmp 0x51076
leaq 0x446f3(%rip), %rsi     # 0x9587c
jmp 0x51076
leaq 0x446e6(%rip), %rsi     # 0x9587b
jmp 0x51076
leaq 0x47e69(%rip), %rsi     # 0x9900a
jmp 0x51076
leaq 0x4c831(%rip), %rsi     # 0x9d9de
leaq 0x43ba9(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
callq 0x46ac4
jmp 0x51081
leaq 0x47e42(%rip), %rsi     # 0x9900a
leaq 0x43b8e(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
callq 0x46b40
jmp 0x51081
leaq 0x4114c(%rip), %rsi     # 0x9232f
leaq 0x43b73(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
callq 0x46bbc
jmp 0x51081
leaq 0x457ce(%rip), %rsi     # 0x969cc
leaq 0x43b58(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
callq 0x5ef33
jmp 0x51081
leaq 0x4c7cc(%rip), %rsi     # 0x9d9e5
leaq 0x43b3d(%rip), %rcx     # 0x94d5d
movq %rbx, %rdi
callq 0x5efaf
jmp 0x51081
leaq 0x45798(%rip), %rsi     # 0x969cc
movq %rbx, %rdi
movq %r8, %rdx
callq 0x5ee5f
jmp 0x51081
leaq 0x410e4(%rip), %rsi     # 0x9232f
movq %rbx, %rdi
movq %r8, %rdx
callq 0x46a5a
jmp 0x51081
leaq 0x4c783(%rip), %rsi     # 0x9d9e5
movq %rbx, %rdi
movq %r8, %rdx
callq 0x5eec9
jmp 0x51081
leaq 0x47d91(%rip), %rsi     # 0x9900a
jmp 0x512a2
leaq 0x4c75c(%rip), %rsi     # 0x9d9de
movq %rbx, %rdi
movq %r8, %rdx
callq 0x46986
jmp 0x51081
leaq 0x4460a(%rip), %rsi     # 0x958a3
jmp 0x512a2
leaq 0x44608(%rip), %rsi     # 0x958aa
movq %rbx, %rdi
movq %r8, %rdx
callq 0x469f0
jmp 0x51081
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop