// File: /workspace/github_cpp_makefile_star2_O3/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 $0x20, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movl %edx, %eax
movq 0x68(%rsi), %rcx
movl (%rcx,%rax,4), %esi
callq 0x1b382
movq %rax, %rsi
movl 0xc(%rax), %ecx
cmpl $0xf, %ecx
ja 0xa01a5
movl $0xe103, %eax           # imm = 0xE103
btl %ecx, %eax
jb 0xa027f
movq 0x28(%rsi), %rax
cmpq %rax, 0x20(%rsi)
je 0xa021f
movl 0x50(%rsi), %ecx
leaq -0x1(%rcx), %rdx
addq $0x3e, %rcx
testq %rdx, %rdx
cmovnsq %rdx, %rcx
sarq $0x6, %rcx
shlq $0x3, %rcx
addq 0x48(%rsi), %rcx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
leaq 0x3f(%rsi), %rdi
andq %rdx, %rdi
xorl %r8d, %r8d
cmpq %rsi, %rdi
setbe %r8b
movq -0x8(%rcx,%r8,8), %rcx
addq $-0x4, %rax
btq %rdx, %rcx
jb 0xa0205
movl (%rax), %esi
movq %r14, %rdi
callq 0x1b4c6
addq $0x10, %rax
movl (%rax), %r12d
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x1550e
cmpl $0x1, %r12d
adcl $0x0, %r12d
jmp 0xa026b
cmpl $0xc, %ecx
jne 0xa0238
movq %r14, %rdi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x156bc
movl 0x10(%rsi), %ebp
movl 0x14(%rsi), %eax
shrl $0x3, %ebp
movl 0x18(%rsi), %r12d
cmpl $0x3, %eax
jne 0xa0267
movl 0x8(%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
movl $0xa, %ecx
callq 0x1406a
movzbl %al, %ecx
movl $0x4, %eax
subl %ecx, %eax
imull %ebp, %r12d
imull %eax, %r12d
movq %r12, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x6140
movq %rax, %rbx
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2316b(%rip), %rsi     # 0xc3407
leaq 0x23183(%rip), %rdx     # 0xc3426
movq %rsp, %rdi
callq 0x7be0
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x5bb08(%rip), %rax     # 0xfbdc8
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x5bae0(%rip), %rsi     # 0xfbdb0
movq 0x5cd01(%rip), %rdx     # 0xfcfd8
movq %rbx, %rdi
callq 0x6470
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xa02f8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
testb %bpl, %bpl
jne 0xa0302
jmp 0xa030a
movq %rax, %r14
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0