// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::emit_buffer_block_native(spirv_cross::SPIRVariable const&)
void CompilerGLSL::emit_buffer_block_native(const SPIRVariable &var)
{
	auto &type = get<SPIRType>(var.basetype);

	Bitset flags = ir.get_buffer_block_flags(var);
	bool ssbo = var.storage == StorageClassStorageBuffer ||
	            ir.meta[type.self].decoration.decoration_flags.get(DecorationBufferBlock);
	bool is_restrict = ssbo && flags.get(DecorationRestrict);
	bool is_writeonly = ssbo && flags.get(DecorationNonReadable);
	bool is_readonly = ssbo && flags.get(DecorationNonWritable);
	bool is_coherent = ssbo && flags.get(DecorationCoherent);

	// Block names should never alias, but from HLSL input they kind of can because block types are reused for UAVs ...
	auto buffer_name = to_name(type.self, false);

	auto &block_namespace = ssbo ? block_ssbo_names : block_ubo_names;

	// Shaders never use the block by interface name, so we don't
	// have to track this other than updating name caches.
	if (ir.meta[type.self].decoration.alias.empty() || block_namespace.find(buffer_name) != end(block_namespace))
		buffer_name = get_block_fallback_name(var.self);

	// Make sure we get something unique.
	add_variable(block_namespace, buffer_name);

	// If for some reason buffer_name is an illegal name, make a final fallback to a workaround name.
	// This cannot conflict with anything else, so we're safe now.
	if (buffer_name.empty())
		buffer_name = join("_", get<SPIRType>(var.basetype).self, "_", var.self);

	// Instance names cannot alias block names.
	resource_names.insert(buffer_name);

	// Save for post-reflection later.
	declared_block_names[var.self] = buffer_name;

	statement(layout_for_variable(var), is_coherent ? "coherent " : "", is_restrict ? "restrict " : "",
	          is_writeonly ? "writeonly " : "", is_readonly ? "readonly " : "", ssbo ? "buffer " : "uniform ",
	          buffer_name);

	begin_scope();

	type.member_name_cache.clear();

	uint32_t i = 0;
	for (auto &member : type.member_types)
	{
		add_member_name(type, i);
		emit_struct_member(type, member, i);
		i++;
	}

	add_resource_name(var.self);
	end_scope_decl(to_name(var.self) + type_to_array_glsl(type));
	statement("");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r13
movq %rdi, %r14
movl 0xc(%rsi), %esi
callq 0xa426
movq %rax, %rbx
leaq 0x8(%r14), %rsi
leaq 0xb8(%rsp), %rdi
movq %r13, %rdx
callq 0x24ca0
movb $0x1, %r12b
cmpl $0xc, 0x10(%r13)
je 0x2b4b9
movl 0x8(%rbx), %eax
movq 0x38(%r14), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
movb 0x60(%rcx,%rax), %r12b
andb $0x8, %r12b
shrb $0x3, %r12b
movq 0xb8(%rsp), %rbp
movl 0x8(%rbx), %edx
movq (%r14), %rax
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
xorl %ecx, %ecx
callq *0x38(%rax)
leaq 0x530(%r14), %r15
leaq 0x568(%r14), %rax
testb %r12b, %r12b
cmovneq %rax, %r15
movl 0x8(%rbx), %eax
movq 0x38(%r14), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
cmpq $0x0, 0x8(%rcx,%rax)
je 0x2b511
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x20e88
testq %rax, %rax
je 0x2b549
movl 0x8(%r13), %edx
movq (%r14), %rax
movq %rsp, %rdi
movq %r14, %rsi
callq *0x20(%rax)
leaq 0x28(%rsp), %rdi
movq %rsp, %rsi
callq 0x6170
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b549
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, 0x20(%rsp)
leaq 0x28(%rsp), %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2b9f6
cmpq $0x0, 0x30(%rsp)
jne 0x2b5b9
movl 0xc(%r13), %esi
movq %r14, %rdi
callq 0xa426
addq $0x8, %rax
leaq 0x8(%r13), %r8
leaq 0x93a2e(%rip), %rcx     # 0xbefaf
movq %rsp, %rdi
movq %rcx, %rsi
movq %rax, %rdx
callq 0x5234c
leaq 0x28(%rsp), %rdi
movq %rsp, %r15
movq %r15, %rsi
callq 0x6310
movq (%r15), %rdi
leaq 0x10(%rsp), %rax
cmpq %rax, %rdi
je 0x2b5b9
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x488(%r14), %rbx
movq %rsp, %rdx
movq %rbx, (%rdx)
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x20fa0
leaq 0x3d8(%r14), %rdi
leaq 0x8(%r13), %rsi
movq %rsi, 0x90(%rsp)
callq 0x5b5a2
leaq 0x28(%rsp), %r15
movq %rax, %rdi
movq %r15, %rsi
callq 0x6170
movq %rsp, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x29c10
movl %ebp, %eax
shrl $0x13, %eax
andl $0x1, %eax
andb %r12b, %al
movl %ebp, %edi
shrl $0x19, %edi
andl $0x1, %edi
andb %r12b, %dil
movl %ebp, %esi
shrl $0x18, %esi
andl $0x1, %esi
andb %r12b, %sil
shrl $0x17, %ebp
andl $0x1, %ebp
andb %r12b, %bpl
leaq 0x9332b(%rip), %rcx     # 0xbe965
leaq 0x8a26e(%rip), %r9      # 0xb58af
cmoveq %r9, %rcx
leaq 0x68(%rsp), %rdx
movq %rcx, (%rdx)
leaq 0x8c9b5(%rip), %r8      # 0xb8009
testb %al, %al
cmoveq %r9, %r8
leaq 0x48(%rsp), %rcx
testb %dil, %dil
leaq 0x8c9aa(%rip), %rax     # 0xb8013
cmoveq %r9, %rax
movq %r8, (%rcx)
leaq 0xb0(%rsp), %r8
movq %rax, (%r8)
leaq 0x8c99c(%rip), %rax     # 0xb801e
testb %sil, %sil
cmoveq %r9, %rax
leaq 0xa8(%rsp), %r9
movq %rax, (%r9)
leaq 0x932ea(%rip), %rax     # 0xbe985
leaq 0x8c986(%rip), %rsi     # 0xb8028
testb %r12b, %r12b
cmovneq %rax, %rsi
leaq 0xa0(%rsp), %rax
movq %rsi, (%rax)
movq %rsp, %rsi
movq %r14, %rdi
pushq %r15
pushq %rax
callq 0x523ea
addq $0x10, %rsp
leaq 0x10(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x2b6e1
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x904ff(%rip), %rsi     # 0xbbbe7
movq %r14, %rdi
callq 0x5a5fc
movq %rbx, 0x88(%rsp)
movq %r14, %rbx
incl 0x638(%r14)
movq 0x20(%rsp), %r15
movq %r15, %rdi
addq $0xa0, %rdi
callq 0xd978
movq 0x68(%r15), %r14
movq 0x70(%r15), %rax
movq %rax, 0x98(%rsp)
cmpq %rax, %r14
je 0x2b79a
xorl %ebp, %ebp
movq %rsp, %r15
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movl %ebp, %edx
callq 0x2881c
movl (%r14), %r12d
movq %r13, (%rsp)
movq %r15, %rdi
leaq 0x8a15f(%rip), %rdx     # 0xb58af
movq %rdx, %rsi
callq 0x7c64
movq %rbx, %rdi
movq (%rbx), %rax
movq 0x20(%rsp), %rsi
movl %r12d, %edx
movl %ebp, %ecx
movq %r15, %r8
xorl %r9d, %r9d
callq *0xa8(%rax)
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2b78a
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
incl %ebp
addq $0x4, %r14
cmpq 0x98(%rsp), %r14
jne 0x2b730
movq 0x90(%rsp), %r14
movl (%r14), %eax
imulq $0x148, %rax, %rdx      # imm = 0x148
addq 0x38(%rbx), %rdx
movq %rbx, %rdi
movq 0x88(%rsp), %rsi
callq 0x2b9f6
movl (%r14), %edx
movq (%rbx), %rax
leaq 0x68(%rsp), %rdi
movq %rbx, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
leaq 0x48(%rsp), %rdi
movq %rbx, %rsi
movq 0x20(%rsp), %rdx
callq 0x2bb66
leaq 0x78(%rsp), %r14
movq -0x10(%r14), %rcx
movq -0x8(%r14), %r8
movq 0x50(%rsp), %rdx
leaq (%rdx,%r8), %rax
movl $0xf, %esi
cmpq %r14, %rcx
je 0x2b80d
movq 0x78(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x2b82c
leaq 0x58(%rsp), %rdi
movl $0xf, %esi
cmpq %rdi, -0x10(%rdi)
je 0x2b827
movq 0x58(%rsp), %rsi
cmpq %rsi, %rax
jbe 0x2b83d
movq 0x48(%rsp), %rsi
leaq 0x68(%rsp), %rdi
callq 0x60b0
jmp 0x2b84b
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x62c0
movq %r13, (%rsp)
movq (%rax), %rdx
leaq 0x10(%rax), %rcx
cmpq %rcx, %rdx
je 0x2b869
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x2b871
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq %rax, %rdx
addq $0x8, %rdx
movq 0x8(%rax), %rsi
movq %rsi, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, (%rdx)
movb $0x0, (%rcx)
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x2ba8e
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2b8af
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b8ca
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6260
movq 0x68(%rsp), %rdi
cmpq %r14, %rdi
je 0x2b8e1
movq 0x78(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x89fc7(%rip), %rsi     # 0xb58af
movq %rbx, %rdi
callq 0xa700
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b90b
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0xc0(%rsp), %rdi
callq 0xd5b0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2b9a7
jmp 0x2b9a7
jmp 0x2b987
jmp 0x2b9a7
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2b950
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2b950
movq %rax, %rbx
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b970
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2b970
movq %rax, %rbx
leaq 0x78(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b9aa
movq 0x78(%rsp), %rsi
jmp 0x2b9eb
jmp 0x2b9a7
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x2b9e6
jmp 0x2b9aa
jmp 0x2b9a7
movq %rax, %rbx
jmp 0x2b9c5
jmp 0x2b9a7
jmp 0x2b9a7
jmp 0x2b9a7
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2b9c5
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0xc0(%rsp), %rdi
callq 0xd5b0
movq %rbx, %rdi
callq 0x64a0
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r13, %rdi
je 0x2b9aa
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2b9aa
nop