// File: /workspace/github_cpp_makefile_star2_O3/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 0xa3ea
movq %rax, %r15
movl 0x8(%rax), %edx
movq (%rbx), %rax
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq *0x38(%rax)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x156bc
addq $0xf, %rax
shrq $0x4, %rax
movq %rax, 0x18(%rsp)
leaq 0xc(%rsp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x19950
testb %al, %al
je 0x2aa33
xorl %eax, %eax
leaq 0x170(%rsp), %rcx
movl %eax, -0xc8(%rcx)
leaq 0xd1bb4(%rip), %r15     # 0xfc3e0
addq $0x10, %r15
movq %r15, -0xd0(%rcx)
movl %eax, -0xc0(%rcx)
movl $0x1, -0xb8(%rcx)
movq %rax, -0x88(%rcx)
movl %eax, -0x80(%rcx)
movq %rax, -0x78(%rcx)
movb $0x0, -0x70(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, -0xb0(%rcx)
movups %xmm0, -0xa0(%rcx)
movl %eax, -0x90(%rcx)
movl $0x8, -0x6c(%rcx)
movups %xmm0, -0x68(%rcx)
movq %rax, -0x58(%rcx)
movq %rax, -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)
leal -0x4(%rax), %ecx
cmpl $0x2, %ecx
jb 0x2a8c3
cmpl $0xa, %eax
jne 0x2aaa2
leaq 0x8(%rbx), %rsi
leaq 0x60(%rsp), %rdi
movq %r14, %rdx
callq 0x2460e
leaq 0xa0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0x2b8e0
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 0x921ce(%rip), %rax     # 0xbcae2
leaq 0x20(%rsp), %r10
leaq 0x983cc(%rip), %r11     # 0xc2cec
leaq 0x8c6f1(%rip), %rsi     # 0xb7018
leaq 0x89f80(%rip), %r8      # 0xb48ae
leaq 0x18(%rsp), %rdx
leaq 0x28(%rsp), %rcx
leaq 0x48(%rsp), %r9
movq %rbx, %rdi
pushq %rax
pushq %r10
pushq %r11
callq 0x51d94
addq $0x20, %rsp
leaq 0x140(%rsp), %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2a971
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x68(%rsp), %rdi
callq 0xd570
movq %r15, 0xa0(%rsp)
movq %rbx, %rdi
callq 0xde80
movq 0x108(%rsp), %rdi
testq %rdi, %rdi
je 0x2a9a8
movq 0x118(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
movq 0xd8(%rsp), %rdi
testq %rdi, %rdi
je 0x2a9ed
movq 0xf8(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
xorl %eax, %eax
movq %rax, 0xd8(%rsp)
movl %eax, 0xe0(%rsp)
movq %rax, 0xe8(%rsp)
movl %eax, 0xf0(%rsp)
movq %rax, 0xf8(%rsp)
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0x2aa0a
movq 0xd0(%rsp), %rsi
subq %rdi, %rsi
callq 0x6260
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2aa25
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0xb0(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8c609(%rip), %rsi     # 0xb705c
leaq 0x8c638(%rip), %rdx     # 0xb7092
leaq 0xa0(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0xa0(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xd1347(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xd131f(%rip), %rsi     # 0xfbdb0
movq 0xd2540(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
jmp 0x2ab06
movl $0x10, %edi
callq 0x6140
movq %rax, %r14
leaq 0x70(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x8c562(%rip), %rsi     # 0xb7021
leaq 0x8c595(%rip), %rdx     # 0xb705b
leaq 0x60(%rsp), %rdi
callq 0x7be0
movb $0x1, %bpl
leaq 0x60(%rsp), %rsi
movq %r14, %rdi
callq 0x6320
leaq 0xd12e1(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%r14)
xorl %ebp, %ebp
leaq 0xd12b9(%rip), %rsi     # 0xfbdb0
movq 0xd24da(%rip), %rdx     # 0xfcfd8
movq %r14, %rdi
callq 0x6470
movq %rax, %rbx
movq 0x60(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ab20
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x2ab2a
jmp 0x2ab9c
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x2ab9c
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
cmpq %r15, %rdi
je 0x2ab54
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0x2ab5e
jmp 0x2abb0
movq %rax, %rbx
movq %r14, %rdi
callq 0x6200
jmp 0x2abb0
movq %rax, %rbx
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2ab8d
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x2ab8d
jmp 0x2ab8a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0xd570
jmp 0x2ab9c
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x1be02
jmp 0x2abb0
jmp 0x2abad
movq %rax, %rbx
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2abcb
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop