// File: /workspace/github_cpp_makefile_star2_O2/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::get_declared_struct_member_size(spirv_cross::SPIRType const&, unsigned int) const
size_t CompilerMSL::get_declared_struct_member_size(const SPIRType &struct_type, uint32_t index) const
{
	auto &type = get<SPIRType>(struct_type.member_types[index]);

	switch (type.basetype)
	{
	case SPIRType::Unknown:
	case SPIRType::Void:
	case SPIRType::AtomicCounter:
	case SPIRType::Image:
	case SPIRType::SampledImage:
	case SPIRType::Sampler:
		SPIRV_CROSS_THROW("Querying size of opaque object.");

	default:
	{
		// For arrays, we can use ArrayStride to get an easy check.
		// Runtime arrays will have zero size so force to min of one.
		if (!type.array.empty())
		{
			bool array_size_literal = type.array_size_literal.back();
			uint32_t array_size =
			    array_size_literal ? type.array.back() : get<SPIRConstant>(type.array.back()).scalar();
			return type_struct_member_array_stride(struct_type, index) * max(array_size, 1u);
		}

		if (type.basetype == SPIRType::Struct)
			return get_declared_struct_size(type);

		uint32_t component_size = type.width / 8;
		uint32_t vecsize = type.vecsize;
		uint32_t columns = type.columns;

		// An unpacked 3-element vector or matrix column is the same memory size as a 4-element.
		if (vecsize == 3 && !has_member_decoration(struct_type.self, index, DecorationCPacked))
			vecsize = 4;

		return component_size * vecsize * columns;
	}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl %edx, %eax
movq 0x68(%rsi), %rcx
movl (%rcx,%rax,4), %esi
callq 0x16fc8
movq %rax, %r12
movl 0xc(%rax), %eax
cmpl $0xf, %eax
ja 0x7d471
movl $0xe103, %ecx           # imm = 0xE103
btl %eax, %ecx
jb 0x7d524
movq 0x20(%r12), %rcx
cmpq 0x28(%r12), %rcx
je 0x7d4c0
movq %r12, %rdi
addq $0x38, %rdi
callq 0x1760e
movl %eax, %ecx
movq 0x28(%r12), %rax
addq $-0x4, %rax
testb %cl, %cl
jne 0x7d4a6
movl (%rax), %esi
movq %r14, %rdi
callq 0x1708c
addq $0x10, %rax
movl (%rax), %r12d
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x1272c
cmpl $0x1, %r12d
adcl $0x0, %r12d
jmp 0x7d510
cmpl $0xc, %eax
jne 0x7d4dc
movq %r14, %rdi
movq %r12, %rsi
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x12882
movl 0x10(%r12), %ebp
movl 0x14(%r12), %eax
shrl $0x3, %ebp
movl 0x18(%r12), %r12d
cmpl $0x3, %eax
jne 0x7d50c
movl 0x8(%r15), %esi
pushq $0xa
popq %rcx
movq %r14, %rdi
movl %ebx, %edx
callq 0x117ba
movzbl %al, %ecx
pushq $0x4
popq %rax
subl %ecx, %eax
imull %ebp, %r12d
imull %eax, %r12d
movq %r12, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x6140
movq %rax, %rbx
leaq 0x20e89(%rip), %rsi     # 0x9e3bf
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x6100
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x6f6e
xorl %ebp, %ebp
leaq 0x69862(%rip), %rsi     # 0xe6dc0
movq 0x6aa7b(%rip), %rdx     # 0xe7fe0
movq %rbx, %rdi
callq 0x6490
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0x6548
testb %bpl, %bpl
jne 0x7d584
jmp 0x7d58c
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64b0