// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0xa
popq %rcx
callq 0x117ba
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x73cb5
movl %ebx, %ebp
movq 0x68(%r15), %rax
movl (%rax,%rbp,4), %esi
movq %r14, %rdi
callq 0x90a4
cmpl $0x3, 0x14(%rax)
jne 0x73c56
movq %rax, %r12
movq %r14, %rdi
movq %rax, %rsi
callq 0x10d5a
testb %al, %al
je 0x73bec
movl 0x8(%r15), %esi
pushq $0x4
popq %rcx
movq %r14, %rdi
movl %ebx, %edx
callq 0x117ba
testb %al, %al
je 0x73c56
movl 0x10(%r12), %eax
movl 0x14(%r12), %r13d
shrl $0x3, %eax
incl %r13d
imull %eax, %r13d
imull 0x18(%r12), %r13d
movq %r14, %rdi
movq %r12, %rsi
callq 0x10d6c
testb %al, %al
je 0x73c5a
movl %r13d, (%rsp)
movl %ebx, 0x4(%rsp)
movq 0x28(%r12), %rbx
subq 0x20(%r12), %rbx
sarq $0x2, %rbx
decq %rbx
pushq $0x1
popq %r13
xorl %ebp, %ebp
movl %ebp, %eax
cmpq %rax, %rbx
jbe 0x73c9b
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x23a9a
cmpl $0x1, %eax
adcl $0x0, %eax
imull %eax, %r13d
incl %ebp
jmp 0x73c34
xorl %eax, %eax
jmp 0x73cb5
movq 0x70(%r15), %rax
subq 0x68(%r15), %rax
sarq $0x2, %rax
decq %rax
cmpq %rbp, %rax
jbe 0x73cc4
movl 0x8(%r15), %esi
pushq $0x23
popq %rbp
movq %r14, %rdi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x12036
movl %eax, %r12d
movl 0x8(%r15), %esi
incl %ebx
movq %r14, %rdi
movl %ebx, %edx
movl %ebp, %ecx
callq 0x12036
subl %r12d, %eax
jmp 0x73caf
imull (%rsp), %r13d
movq %r14, %rdi
movq %r15, %rsi
movl 0x4(%rsp), %edx
callq 0x1272c
cmpl %eax, %r13d
seta %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10d5a
nop