// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::is_member_packable(spirv_cross::SPIRType&, unsigned int)
bool CompilerMSL::is_member_packable(SPIRType &ib_type, uint32_t index)
{
	// We've already marked it as packable
	if (has_member_decoration(ib_type.self, index, DecorationCPacked))
		return true;

	auto &mbr_type = get<SPIRType>(ib_type.member_types[index]);

	// Only 3-element vectors or 3-row matrices need to be packed.
	if (mbr_type.vecsize != 3)
		return false;

	// Only row-major matrices need to be packed.
	if (is_matrix(mbr_type) && !has_member_decoration(ib_type.self, index, DecorationRowMajor))
		return false;

	uint32_t component_size = mbr_type.width / 8;
	uint32_t unpacked_mbr_size = component_size * (mbr_type.vecsize + 1) * mbr_type.columns;
	if (is_array(mbr_type))
	{
		// If member is an array, and the array stride is larger than the type needs, don't pack it.
		// Take into consideration multi-dimentional arrays.
		uint32_t md_elem_cnt = 1;
		size_t last_elem_idx = mbr_type.array.size() - 1;
		for (uint32_t i = 0; i < last_elem_idx; i++)
			md_elem_cnt *= max(to_array_size_literal(mbr_type, i), 1U);

		uint32_t unpacked_array_stride = unpacked_mbr_size * md_elem_cnt;
		uint32_t array_stride = type_struct_member_array_stride(ib_type, index);
		return unpacked_array_stride > array_stride;
	}
	else
	{
		// Pack if there is not enough space between this member and next.
		// If last member, only pack if it's a row-major matrix.
		if (index < ib_type.member_types.size() - 1)
		{
			uint32_t mbr_offset_curr = get_member_decoration(ib_type.self, index, DecorationOffset);
			uint32_t mbr_offset_next = get_member_decoration(ib_type.self, index + 1, DecorationOffset);
			return unpacked_mbr_size > mbr_offset_next - mbr_offset_curr;
		}
		else
			return is_matrix(mbr_type);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl 0x8(%rsi), %esi
movl $0xa, %ecx
callq 0x14222
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x90244
movl %ebx, %r13d
movq 0x68(%r15), %rax
movl (%rax,%r13,4), %esi
movq %r14, %rdi
callq 0xa426
cmpl $0x3, 0x14(%rax)
jne 0x901c6
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0x134f8
testb %al, %al
je 0x90158
movl 0x8(%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
movl $0x4, %ecx
callq 0x14222
testb %al, %al
je 0x901c6
movl 0x10(%r12), %eax
movl 0x14(%r12), %ebp
shrl $0x3, %eax
incl %ebp
imull %eax, %ebp
imull 0x18(%r12), %ebp
movq %r14, %rdi
movq %r12, %rsi
callq 0x1350a
testb %al, %al
je 0x901ca
movl %ebp, (%rsp)
movl %ebx, 0x4(%rsp)
movq 0x28(%r12), %rbx
subq 0x20(%r12), %rbx
sarq $0x2, %rbx
decq %rbx
je 0x90227
xorl %r13d, %r13d
movl $0x1, %ebp
movq %r14, %rdi
movq %r12, %rsi
movl %r13d, %edx
callq 0x298ca
cmpl $0x1, %eax
adcl $0x0, %eax
imull %eax, %ebp
incl %r13d
cmpq %r13, %rbx
ja 0x901a5
jmp 0x9022c
xorl %eax, %eax
jmp 0x90244
movq 0x70(%r15), %rax
subq 0x68(%r15), %rax
sarq $0x2, %rax
decq %rax
cmpq %r13, %rax
jbe 0x9020e
movl 0x8(%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
movl $0x23, %ecx
callq 0x14e6c
movl %eax, %r12d
movl 0x8(%r15), %esi
incl %ebx
movq %r14, %rdi
movl %ebx, %edx
movl $0x23, %ecx
callq 0x14e6c
subl %r12d, %eax
jmp 0x9023f
movq %r14, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x134f8
movl $0x1, %ebp
imull (%rsp), %ebp
movq %r14, %rdi
movq %r15, %rsi
movl 0x4(%rsp), %edx
callq 0x1570e
cmpl %eax, %ebp
seta %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop