// File: /workspace/github_cpp_makefile_star2_O2/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 $0x58, %rsp
movl %ecx, %ebp
movq %rdx, %r13
movq %rsi, %r14
movq %rdi, %r15
movq 0x20(%rsi), %rax
movq 0x28(%rsi), %rdx
cmpq %rdx, %rax
je 0x238db
subq %rax, %rdx
shrq $0x2, %rdx
decl %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x23a9a
movl %eax, %ebx
movq %r15, %rdi
movq %r14, %rsi
movq %r13, %rdx
movl %ebp, %ecx
callq 0x237e2
movl %eax, %r10d
imull %ebx, %r10d
movl %r10d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %ebx
movq %r15, 0x8(%rsp)
cmpl $0xc, 0xc(%r14)
jne 0x239d6
xorl %ebp, %ebp
pushq $0x1
popq %rax
movl %eax, %r15d
xorl %r10d, %r10d
movl %ebx, %r13d
movq %r14, (%rsp)
movl %ebp, %ebp
movq 0x70(%r14), %rax
subq 0x68(%r14), %rax
sarq $0x2, %rax
cmpq %rbp, %rax
jbe 0x238c9
movq %r10, 0x10(%rsp)
movl 0x8(%r14), %eax
movq 0x8(%rsp), %r12
movq 0x38(%r12), %rcx
imulq $0x148, %rax, %rax      # imm = 0x148
leaq (%rcx,%rax), %rdi
addq $0xd0, %rdi
movq %rbp, %rsi
callq 0x41c9e
leaq 0x60(%rax), %rsi
leaq 0x18(%rsp), %rdi
callq 0x934a
movq 0x68(%r14), %rax
movl (%rax,%rbp,4), %esi
movq %r12, %rdi
callq 0x90a4
movq %rax, %rbx
movq %r12, %rdi
movq %rax, %rsi
leaq 0x18(%rsp), %r14
movq %r14, %rdx
movl %r13d, %ecx
callq 0x23554
movl %r13d, %ecx
movl %eax, %r13d
movq %r12, %rdi
movl 0xc(%rbx), %r12d
movq %rbx, %rsi
movq %r14, %rdx
movl %ecx, %r14d
callq 0x23876
movl %eax, %ebx
cmpl $0xc, %r12d
pushq $0x1
popq %r12
cmovel %r13d, %r12d
cmpl %r15d, %r13d
cmoval %r13d, %r15d
movq 0x10(%rsp), %rax
addl %r15d, %eax
decl %eax
negl %r15d
andl %eax, %r15d
addl %r15d, %ebx
leaq 0x20(%rsp), %rdi
callq 0xb51c
incl %ebp
movl %r12d, %r15d
movl %ebx, %r10d
movl %r14d, %r13d
movq (%rsp), %r14
jmp 0x238ff
movq %r14, %rsi
callq 0x234b2
movl 0x14(%r14), %esi
movl 0x18(%r14), %edx
movl %esi, %ecx
imull %eax, %ecx
xorl %r10d, %r10d
cmpl $0x1, %edx
cmovel %ecx, %r10d
movq (%r13), %r8
movl %r8d, %edi
shrb $0x5, %dil
cmpl $0x2, %edx
setae %r9b
andb %dil, %r9b
pushq $0x35
popq %rdi
cmpb $0x1, %r9b
movl %ebx, %r9d
jne 0x23a2b
cmpl $0x5, %r9d
ja 0x23a55
btl %r9d, %edi
jae 0x23a55
imull %edx, %eax
shll $0x2, %eax
movl %eax, %r10d
shrb $0x4, %r8b
cmpl $0x2, %esi
setae %al
testb %al, %r8b
je 0x238c9
cmpl $0x5, %r9d
ja 0x23a6e
btl %r9d, %edi
jae 0x23a6e
shll $0x2, %ecx
movl %ecx, %r10d
jmp 0x238c9
cmpl $0x3, %esi
jne 0x23a78
testb $0x10, %r8b
jne 0x23a3e
imull %eax, %edx
shll $0x2, %edx
movl %edx, %r10d
jmp 0x238c9
cmpl $0x3, %edx
je 0x23a4a
imull %edx, %ecx
jmp 0x23a4d
movl %ecx, %r10d
imull %edx, %r10d
jmp 0x23a2b
jmp 0x23a85
jmp 0x23a85
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0xb51c
movq %rbx, %rdi
callq 0x64b0