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

	// Block names should never alias.
	auto buffer_name = to_name(type.self, false);
	size_t buffer_size = (get_declared_struct_size(type) + 15) / 16;

	SPIRType::BaseType basic_type;
	if (get_common_basic_type(type, basic_type))
	{
		SPIRType tmp;
		tmp.basetype = basic_type;
		tmp.vecsize = 4;
		if (basic_type != SPIRType::Float && basic_type != SPIRType::Int && basic_type != SPIRType::UInt)
			SPIRV_CROSS_THROW("Basic types in a flattened UBO must be float, int or uint.");

		auto flags = ir.get_buffer_block_flags(var);
		statement("uniform ", flags_to_precision_qualifiers_glsl(tmp, flags), type_to_glsl(tmp), " ", buffer_name, "[",
		          buffer_size, "];");
	}
	else
		SPIRV_CROSS_THROW("All basic types in a flattened block must be the same.");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %r14
movq %rdi, %rbx
movl 0xc(%rsi), %esi
callq 0x90a4
movq %rax, %r15
movl 0x8(%rax), %edx
movq (%rbx), %rax
leaq 0x80(%rsp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq *0x38(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x12882
addq $0xf, %rax
shrq $0x4, %rax
movq %rax, 0x18(%rsp)
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x15b7a
testb %al, %al
je 0x24bf4
leaq 0x170(%rsp), %rcx
andl $0x0, -0xc8(%rcx)
leaq 0xc296a(%rip), %rax     # 0xe73f0
addq $0x10, %rax
movq %rax, -0xd0(%rcx)
andl $0x0, -0xc0(%rcx)
movl $0x1, -0xb8(%rcx)
andq $0x0, -0x88(%rcx)
andl $0x0, -0x80(%rcx)
andq $0x0, -0x78(%rcx)
movb $0x0, -0x70(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, -0xb0(%rcx)
movups %xmm0, -0xa0(%rcx)
andl $0x0, -0x90(%rcx)
movl $0x8, -0x6c(%rcx)
movups %xmm0, -0x68(%rcx)
andq $0x0, -0x58(%rcx)
andq $0x0, -0x38(%rcx)
movq %rcx, -0x30(%rcx)
movq $0x1, -0x28(%rcx)
movups %xmm0, -0x20(%rcx)
movl $0x3f800000, -0x10(%rcx) # imm = 0x3F800000
movups %xmm0, -0x8(%rcx)
movl 0xc(%rsp), %eax
movl %eax, -0xc4(%rcx)
movl $0x4, -0xbc(%rcx)
cmpl $0xa, %eax
ja 0x24c45
movl $0x430, %ecx            # imm = 0x430
btl %eax, %ecx
jae 0x24c45
leaq 0x8(%rbx), %rsi
leaq 0x40(%rsp), %rdi
movq %r14, %rdx
callq 0x1fb0a
leaq 0xa0(%rsp), %rsi
leaq 0x40(%rsp), %rdx
movq %rbx, %rdi
callq 0x25714
movq %rax, 0x10(%rsp)
movq (%rbx), %rax
leaq 0x20(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movq %rbx, %rsi
xorl %ecx, %ecx
callq *0x98(%rax)
subq $0x8, %rsp
leaq 0x72ef7(%rip), %rax     # 0x97a72
leaq 0x20(%rsp), %r10
leaq 0x7911d(%rip), %r11     # 0x9dca4
leaq 0x6d46a(%rip), %rsi     # 0x91ff8
leaq 0x6acf1(%rip), %r8      # 0x8f886
leaq 0x18(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x88(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
pushq %r11
callq 0x42000
addq $0x20, %rsp
leaq 0x20(%rsp), %rdi
callq 0x6548
leaq 0x48(%rsp), %rdi
callq 0xb51c
leaq 0xa0(%rsp), %rdi
callq 0x17a3e
leaq 0x80(%rsp), %rdi
callq 0x6548
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x6d436(%rip), %rsi     # 0x9203c
leaq 0xa0(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xc218c(%rip), %rsi     # 0xe6dc0
movq 0xc33a5(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
jmp 0x24c8e
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %r14
leaq 0x6d3aa(%rip), %rsi     # 0x92001
leaq 0x40(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0xc2141(%rip), %rsi     # 0xe6dc0
movq 0xc335a(%rip), %rdx     # 0xe7fe0
movq %r14, %rdi
callq 0x6490
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x24ca5
jmp 0x24cf6
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x24cf6
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x24cc9
jmp 0x24d0a
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x24d0a
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x6548
jmp 0x24ce7
jmp 0x24ce4
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0xb51c
jmp 0x24cf6
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x17a3e
jmp 0x24d0a
jmp 0x24d07
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x6548
movq %rbx, %rdi
callq 0x64b0
nop