// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::variable_decl[abi:cxx11](spirv_cross::SPIRVariable const&)
string CompilerGLSL::variable_decl(const SPIRVariable &variable)
{
	// Ignore the pointer type since GLSL doesn't have pointers.
	auto &type = get<SPIRType>(variable.basetype);

	auto res = join(to_qualifiers_glsl(variable.self), variable_decl(type, to_name(variable.self), variable.self));

	if (variable.loop_variable && variable.static_expression)
	{
		uint32_t expr = variable.static_expression;
		if (ir.ids[expr].get_type() != TypeUndef)
			res += join(" = ", to_expression(variable.static_expression));
	}
	else if (variable.initializer)
	{
		uint32_t expr = variable.initializer;
		if (ir.ids[expr].get_type() != TypeUndef)
			res += join(" = ", to_initializer_expression(variable));
	}
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x140(%rbp)
movq %rdi, %rax
movq %rax, -0x138(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x130(%rbp)
movq -0x18(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq -0x130(%rbp), %rsi
movq %rax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x128(%rax), %rax
leaq -0x48(%rbp), %rdi
callq *%rax
movq -0x130(%rbp), %rsi
movq -0x20(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0x88(%rbp), %rdi
movl $0x1, %ecx
callq *%rax
jmp 0x62df5
movq -0x128(%rbp), %rdx
movq -0x130(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %r8d
movq (%rsi), %rax
movq 0xc8(%rax), %rax
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rcx
callq *%rax
jmp 0x62e24
movq -0x140(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x68(%rbp), %rdx
callq 0xa0120
jmp 0x62e3a
leaq -0x68(%rbp), %rdi
callq 0x7708
leaq -0x88(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x18(%rbp), %rax
testb $0x1, 0x64(%rax)
je 0x62fde
movq -0x18(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x62fde
movq -0x130(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0x98(%rbp)
addq $0x20, %rdi
movl -0x98(%rbp), %eax
movl %eax, %esi
callq 0xbdb0
movq %rax, %rdi
callq 0xfa00
movl %eax, -0x144(%rbp)
jmp 0x62ea9
movl -0x144(%rbp), %eax
cmpl $0xd, %eax
je 0x62fd9
movq -0x130(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %edx
leaq -0xd8(%rbp), %rdi
callq 0x71b50
jmp 0x62ed4
leaq 0xe6134(%rip), %rsi     # 0x14900f
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rdx
callq 0xa7430
jmp 0x62ef0
movq -0x140(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x7470
jmp 0x62f05
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0xd8(%rbp), %rdi
callq 0x7708
jmp 0x62fd9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x62f71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x62f65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x7708
leaq -0x88(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
jmp 0x63111
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x63105
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x62fc8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0xd8(%rbp), %rdi
callq 0x7708
jmp 0x63105
jmp 0x630df
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x630dd
movq -0x130(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0xdc(%rbp)
addq $0x20, %rdi
movl -0xdc(%rbp), %eax
movl %eax, %esi
callq 0xbdb0
movq %rax, %rdi
callq 0xfa00
movl %eax, -0x148(%rbp)
jmp 0x63021
movl -0x148(%rbp), %eax
cmpl $0xd, %eax
je 0x630db
movq -0x130(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x160(%rax), %rax
leaq -0x120(%rbp), %rdi
callq *%rax
jmp 0x63050
leaq 0xe5fb8(%rip), %rsi     # 0x14900f
leaq -0x100(%rbp), %rdi
leaq -0x120(%rbp), %rdx
callq 0xa7430
jmp 0x6306c
movq -0x140(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x7470
jmp 0x63081
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x630db
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
jmp 0x630cd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x90(%rbp)
movl %eax, -0x94(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0x63105
jmp 0x630dd
jmp 0x630df
movb $0x1, -0x21(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x630f5
movq -0x140(%rbp), %rdi
callq 0x7708
movq -0x138(%rbp), %rax
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
movq -0x140(%rbp), %rdi
callq 0x7708
movq -0x90(%rbp), %rdi
callq 0x7640
nopl (%rax)