// File: rossy[P]crossc/SPIRV-Cross/spirv_cpp.cpp
// Function: spirv_cross::CompilerCPP::variable_decl(spirv_cross::SPIRType const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned int)
string CompilerCPP::variable_decl(const SPIRType &type, const string &name, uint32_t /* id */)
{
	string base = type_to_glsl(type);
	remap_variable_type_name(type, name, base);
	bool runtime = false;

	for (uint32_t i = 0; i < type.array.size(); i++)
	{
		auto &array = type.array[i];
		if (!array && type.array_size_literal[i])
		{
			// Avoid using runtime arrays with std::array since this is undefined.
			// Runtime arrays cannot be passed around as values, so this is fine.
			runtime = true;
		}
		else
			base = join("std::array<", base, ", ", to_array_size(type, i), ">");
	}
	base += ' ';
	return base + name + (runtime ? "[1]" : "");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0xe8(%rbp)
movq %rdi, %rax
movq %rax, -0xe0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq -0x10(%rbp), %rsi
movq %rsi, -0xd8(%rbp)
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x48(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
xorl %ecx, %ecx
callq *%rax
movq -0xd8(%rbp), %rdi
movq -0xd0(%rbp), %rcx
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xf3f0
jmp 0xe415
movb $0x0, -0x55(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq %rax, -0xf0(%rbp)
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x8650
movq %rax, %rcx
movq -0xf0(%rbp), %rax
cmpq %rcx, %rax
jae 0xe54a
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
movl -0x5c(%rbp), %eax
movl %eax, %esi
callq 0x8570
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpl $0x0, (%rax)
jne 0xe4a9
movq -0x18(%rbp), %rdi
addq $0x38, %rdi
movl -0x5c(%rbp), %eax
movl %eax, %esi
callq 0x118c0
movb %al, -0xf1(%rbp)
jmp 0xe483
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0xe48f
jmp 0xe4a9
movb $0x1, -0x55(%rbp)
jmp 0xe53a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xe5da
movq -0xd8(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x5c(%rbp), %ecx
leaq -0xa8(%rbp), %rdi
callq 0x85c10
jmp 0xe4c5
leaq 0x1300e2(%rip), %rsi    # 0x13e5ae
leaq 0x1360bc(%rip), %rcx    # 0x14458f
leaq 0x12fd11(%rip), %r9     # 0x13e1eb
leaq -0x88(%rbp), %rdi
leaq -0x48(%rbp), %rdx
leaq -0xa8(%rbp), %r8
callq 0x11730
jmp 0xe4f3
leaq -0x48(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x7430
leaq -0x88(%rbp), %rdi
callq 0x7708
leaq -0xa8(%rbp), %rdi
callq 0x7708
jmp 0xe53a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x7708
jmp 0xe5da
jmp 0xe53c
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0xe420
leaq -0x48(%rbp), %rdi
movl $0x20, %esi
callq 0x7220
jmp 0xe55a
movq -0x20(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x11960
jmp 0xe570
movq -0xe8(%rbp), %rdi
movb -0x55(%rbp), %cl
leaq 0x130039(%rip), %rax    # 0x13e5ba
leaq 0x130316(%rip), %rdx    # 0x13e89e
testb $0x1, %cl
cmovneq %rax, %rdx
leaq -0xc8(%rbp), %rsi
callq 0x11910
jmp 0xe59d
leaq -0xc8(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0xe0(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x50(%rbp), %rdi
callq 0x7640
nopl (%rax)