// File: /workspace/github_cpp_makefile_star2_O1/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 0x1b9de
movq %rax, %rsi
movl 0xc(%rax), %ecx
cmpl $0xf, %ecx
ja 0xa1019
movl $0xe103, %eax           # imm = 0xE103
btl %ecx, %eax
jb 0xa10f3
movq 0x28(%rsi), %rax
cmpq %rax, 0x20(%rsi)
je 0xa1093
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 0xa1079
movl (%rax), %esi
movq %r14, %rdi
callq 0x1bb22
addq $0x10, %rax
movl (%rax), %r12d
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x1570e
cmpl $0x1, %r12d
adcl $0x0, %r12d
jmp 0xa10df
cmpl $0xc, %ecx
jne 0xa10ac
movq %r14, %rdi
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x158c2
movl 0x10(%rsi), %ebp
movl 0x14(%rsi), %eax
shrl $0x3, %ebp
movl 0x18(%rsi), %r12d
cmpl $0x3, %eax
jne 0xa10db
movl 0x8(%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
movl $0xa, %ecx
callq 0x14222
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 0x23327(%rip), %rsi     # 0xc4437
leaq 0x2333f(%rip), %rdx     # 0xc4456
movq %rsp, %rdi
callq 0x7c64
movb $0x1, %bpl
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x6320
leaq 0x5bc64(%rip), %rax     # 0xfcd98
addq $0x10, %rax
movq %rax, (%rbx)
xorl %ebp, %ebp
leaq 0x5bc3c(%rip), %rsi     # 0xfcd80
movq 0x5ce8d(%rip), %rdx     # 0xfdfd8
movq %rbx, %rdi
callq 0x6470
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xa1174
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0xa1174
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0xa1181
movq %rbx, %rdi
callq 0x6200
movq %r14, %rdi
callq 0x64a0
nop