// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::type_to_packed_size(spirv_cross::SPIRType const&, spirv_cross::Bitset const&, spirv_cross::BufferPackingStandard)
uint32_t CompilerGLSL::type_to_packed_size(const SPIRType &type, const Bitset &flags, BufferPackingStandard packing)
{
	if (!type.array.empty())
	{
		return to_array_size_literal(type, uint32_t(type.array.size()) - 1) *
		       type_to_packed_array_stride(type, flags, packing);
	}

	uint32_t size = 0;

	if (type.basetype == SPIRType::Struct)
	{
		uint32_t pad_alignment = 1;

		for (uint32_t i = 0; i < type.member_types.size(); i++)
		{
			auto member_flags = ir.meta[type.self].members.at(i).decoration_flags;
			auto &member_type = get<SPIRType>(type.member_types[i]);

			uint32_t packed_alignment = type_to_packed_alignment(member_type, member_flags, packing);
			uint32_t alignment = max(packed_alignment, pad_alignment);

			// The next member following a struct member is aligned to the base alignment of the struct that came before.
			// GL 4.5 spec, 7.6.2.2.
			if (member_type.basetype == SPIRType::Struct)
				pad_alignment = packed_alignment;
			else
				pad_alignment = 1;

			size = (size + alignment - 1) & ~(alignment - 1);
			size += type_to_packed_size(member_type, member_flags, packing);
		}
	}
	else
	{
		const uint32_t base_alignment = type_to_packed_base_size(type, packing);

		if (type.columns == 1)
			size = type.vecsize * base_alignment;

		if (flags.get(DecorationColMajor) && type.columns > 1)
		{
			if (packing_is_vec4_padded(packing))
				size = type.columns * 4 * base_alignment;
			else if (type.vecsize == 3)
				size = type.columns * 4 * base_alignment;
			else
				size = type.columns * type.vecsize * base_alignment;
		}

		if (flags.get(DecorationRowMajor) && type.vecsize > 1)
		{
			if (packing_is_vec4_padded(packing))
				size = type.vecsize * 4 * base_alignment;
			else if (type.columns == 3)
				size = type.vecsize * 4 * base_alignment;
			else
				size = type.vecsize * type.columns * base_alignment;
		}
	}

	return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %ecx, %r15d
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq 0x20(%rsi), %rax
movq 0x28(%rsi), %rdx
cmpq %rdx, %rax
je 0x29675
subq %rax, %rdx
shrq $0x2, %rdx
decl %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x298ca
movl %eax, %ebp
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x2957a
movl %eax, %r13d
imull %ebp, %r13d
movl %r13d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0xc, 0xc(%r14)
jne 0x297f9
movq 0x70(%r14), %rax
cmpq 0x68(%r14), %rax
je 0x2987f
movl %r15d, (%rsp)
movl $0x1, %r15d
xorl %ebp, %ebp
xorl %ecx, %ecx
movl $0x1, %r12d
movq %r14, 0x10(%rsp)
movq %rbx, 0x8(%rsp)
movq %rcx, 0x18(%rsp)
movl %r15d, 0x4(%rsp)
movl 0x8(%r14), %eax
movq 0x38(%rbx), %rcx
imulq $0x148, %rax, %rdx      # imm = 0x148
movq 0xd0(%rcx,%rdx), %rax
movq 0xd8(%rcx,%rdx), %rdx
subq %rax, %rdx
sarq $0x4, %rdx
movabsq $0x4ec4ec4ec4ec4ec5, %rcx # imm = 0x4EC4EC4EC4EC4EC5
imulq %rcx, %rdx
cmpq %rbp, %rdx
jbe 0x2989f
imulq $0xd0, %rbp, %rcx
leaq (%rax,%rcx), %rsi
addq $0x68, %rsi
movq -0x8(%rsi), %rax
movq %rax, 0x28(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x30(%rsp)
movq 0x8(%rsi), %rax
movq %rax, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq 0x18(%rsi), %rax
movq %rax, 0x48(%rsp)
movups 0x20(%rsi), %xmm0
leaq 0x30(%rsp), %rdi
movups %xmm0, 0x20(%rdi)
movq %rcx, 0x60(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x20(%rsp), %rdx
callq 0xd402
movq 0x68(%r14), %rax
movl (%rax,%rbp,4), %esi
movq %rbx, %rdi
callq 0xa426
movl (%rsp), %r15d
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
leaq 0x28(%rsp), %rdx
movl %r15d, %ecx
callq 0x29242
movl %eax, %ebp
movl 0xc(%r13), %r14d
movq %rbx, %rdi
movq %r13, %rsi
leaq 0x28(%rsp), %rdx
movl %r15d, %ecx
callq 0x2960e
movl 0x4(%rsp), %r15d
movl %eax, %r13d
cmpl $0xc, %r14d
movl $0x1, %r14d
cmovel %ebp, %r14d
cmpl %r12d, %ebp
cmoval %ebp, %r12d
movq 0x18(%rsp), %rax
addl %r12d, %eax
decl %eax
negl %r12d
andl %eax, %r12d
addl %r12d, %r13d
leaq 0x30(%rsp), %rdi
callq 0xd5b0
movl %r15d, %ebp
movq 0x10(%rsp), %rbx
movq 0x70(%rbx), %rax
subq 0x68(%rbx), %rax
sarq $0x2, %rax
incl %r15d
movl %r13d, %ecx
movl %r14d, %r12d
cmpq %rbp, %rax
movq %rbx, %r14
movq 0x8(%rsp), %rbx
ja 0x296ac
jmp 0x29663
movq %r14, %rsi
callq 0x29170
movl 0x14(%r14), %esi
movl 0x18(%r14), %edx
movl %esi, %ecx
imull %eax, %ecx
xorl %r13d, %r13d
cmpl $0x1, %edx
cmovel %ecx, %r13d
movq (%r12), %rdi
movl %edi, %r8d
shrb $0x5, %r8b
cmpl $0x2, %edx
setae %r9b
andb %r8b, %r9b
cmpb $0x1, %r9b
jne 0x2984e
cmpl $0x5, %r15d
ja 0x29887
movl $0x35, %r8d
btl %r15d, %r8d
jae 0x29887
imull %edx, %eax
shll $0x2, %eax
movl %eax, %r13d
shrb $0x4, %dil
cmpl $0x2, %esi
setae %al
andb %dil, %al
cmpb $0x1, %al
jne 0x29663
cmpl $0x5, %r15d
ja 0x29895
movl $0x35, %eax
btl %r15d, %eax
jae 0x29895
shll $0x2, %ecx
movl %ecx, %r13d
jmp 0x29663
xorl %r13d, %r13d
jmp 0x29663
cmpl $0x3, %esi
je 0x29845
movl %ecx, %r13d
imull %edx, %r13d
jmp 0x2984e
cmpl $0x3, %edx
je 0x29874
imull %edx, %ecx
jmp 0x29877
leaq 0x8b873(%rip), %rdi     # 0xb5119
movq %rbp, %rsi
xorl %eax, %eax
callq 0x63d0
jmp 0x298b4
jmp 0x298b4
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0xd5b0
movq %rbx, %rdi
callq 0x64a0
nop