// File: rossy[P]crossc/SPIRV-Cross/spirv_cpp.cpp
// Function: spirv_cross::CompilerCPP::emit_interface_block(spirv_cross::SPIRVariable const&)
void CompilerCPP::emit_interface_block(const SPIRVariable &var)
{
	add_resource_name(var.self);

	auto &type = get<SPIRType>(var.basetype);

	const char *qual = var.storage == StorageClassInput ? "StageInput" : "StageOutput";
	const char *lowerqual = var.storage == StorageClassInput ? "stage_input" : "stage_output";
	auto instance_name = to_name(var.self);
	uint32_t location = ir.meta[var.self].decoration.location;

	string buffer_name;
	auto flags = ir.meta[type.self].decoration.decoration_flags;
	if (flags.get(DecorationBlock))
	{
		emit_block_struct(type);
		buffer_name = to_name(type.self);
	}
	else
		buffer_name = type_to_glsl(type);

	statement("internal::", qual, "<", buffer_name, type_to_array_glsl(type), "> ", instance_name, "__;");
	statement_no_indent("#define ", instance_name, " __res->", instance_name, "__.get()");
	resource_registrations.push_back(join("s.register_", lowerqual, "(", instance_name, "__", ", ", location, ");"));
	statement("");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x150(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x5c1d0
movq -0x150(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0xc(%rax), %esi
callq 0xea90
movq -0x150(%rbp), %rsi
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
leaq 0x131f95(%rip), %rcx    # 0x13e20e
leaq 0x131f99(%rip), %rax    # 0x13e219
cmoveq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
subl $0x1, %eax
leaq 0x13be50(%rip), %rcx    # 0x1480e9
leaq 0x131f85(%rip), %rax    # 0x13e225
cmoveq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0x48(%rbp), %rdi
movl $0x1, %ecx
callq *%rax
movq -0x150(%rbp), %rdi
addq $0x38, %rdi
movq %rdi, -0x148(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movl 0xa4(%rax), %eax
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x7530
movq -0x148(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, %esi
callq 0xead0
movq %rax, %rsi
addq $0x60, %rsi
leaq -0xb0(%rbp), %rdi
callq 0xef10
jmp 0xc31d
leaq -0xb0(%rbp), %rdi
movl $0x2, %esi
callq 0xef50
movb %al, -0x151(%rbp)
jmp 0xc336
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0xc345
jmp 0xc3c8
movq -0x150(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xc1d0
jmp 0xc357
movq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0xe0(%rbp), %rdi
movl $0x1, %ecx
callq *%rax
jmp 0xc37c
leaq -0x70(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x7430
leaq -0xe0(%rbp), %rdi
callq 0x7708
jmp 0xc406
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xc5a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
jmp 0xc59a
movq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq (%rsi), %rax
movq 0x98(%rax), %rax
leaq -0x100(%rbp), %rdi
xorl %ecx, %ecx
callq *%rax
jmp 0xc3ea
leaq -0x70(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x7430
leaq -0x100(%rbp), %rdi
callq 0x7708
movq -0x150(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x120(%rbp), %rdi
callq 0x61340
jmp 0xc41f
movq -0x150(%rbp), %rdi
leaq 0x131daa(%rip), %rcx    # 0x13e1d7
movq %rsp, %rax
movq %rcx, 0x10(%rax)
leaq -0x48(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x131d91(%rip), %rcx    # 0x13e1d4
movq %rcx, (%rax)
leaq 0x131de5(%rip), %rsi    # 0x13e232
leaq 0x13617d(%rip), %rcx    # 0x1425d1
leaq -0x20(%rbp), %rdx
leaq -0x70(%rbp), %r8
leaq -0x120(%rbp), %r9
callq 0xefc0
jmp 0xc46a
leaq -0x120(%rbp), %rdi
callq 0x7708
movq -0x150(%rbp), %rdi
leaq 0x131d57(%rip), %rsi    # 0x13e1db
leaq 0x131d59(%rip), %rcx    # 0x13e1e4
leaq 0x131d5b(%rip), %r9     # 0x13e1ed
leaq -0x48(%rbp), %r8
movq %r8, %rdx
callq 0xec60
jmp 0xc4a0
movq -0x150(%rbp), %rax
addq $0x788, %rax            # imm = 0x788
movq %rax, -0x160(%rbp)
leaq 0x13cbea(%rip), %rcx    # 0x1490a5
movq %rsp, %rax
movq %rcx, 0x10(%rax)
leaq -0x4c(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x1380be(%rip), %rcx    # 0x14458f
movq %rcx, (%rax)
leaq 0x131d62(%rip), %rsi    # 0x13e23d
leaq 0x140e4b(%rip), %rcx    # 0x14d32d
leaq 0x131d22(%rip), %r9     # 0x13e20b
leaq -0x140(%rbp), %rdi
leaq -0x28(%rbp), %rdx
leaq -0x48(%rbp), %r8
callq 0xf160
jmp 0xc4ff
movq -0x160(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xecd0
jmp 0xc514
leaq -0x140(%rbp), %rdi
callq 0x7708
movq -0x150(%rbp), %rdi
leaq 0x132370(%rip), %rsi    # 0x13e89e
callq 0xedf0
jmp 0xc535
leaq -0xb0(%rbp), %rdi
callq 0xf250
leaq -0x70(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7708
jmp 0xc59a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xb8(%rbp)
movl %eax, -0xbc(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x7708
leaq -0xb0(%rbp), %rdi
callq 0xf250
leaq -0x70(%rbp), %rdi
callq 0x7708
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0xb8(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)