// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::get_declared_struct_member_alignment(spirv_cross::SPIRType const&, unsigned int) const
size_t CompilerMSL::get_declared_struct_member_alignment(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 alignment of opaque object.");

	case SPIRType::Struct:
		return 16; // Per Vulkan spec section 14.5.4

	default:
	{
		// Alignment of packed type is the same as the underlying component or column size.
		// Alignment of unpacked type is the same as the vector size.
		// Alignment of 3-elements vector is the same as 4-elements (including packed using column).
		if (member_is_packed_type(struct_type, index))
			return (type.width / 8) * (type.columns == 3 ? 4 : type.columns);
		else
			return (type.width / 8) * (type.vecsize == 3 ? 4 : type.vecsize);
	}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rdi
addq $0x68, %rdi
movl -0x1c(%rbp), %eax
movl %eax, %esi
callq 0x8570
movq -0x70(%rbp), %rdi
movl (%rax), %esi
callq 0x2e6b0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x64(%rbp)
subl $0x2, %eax
jb 0xfad39
jmp 0xfad10
movl -0x64(%rbp), %eax
subl $0x8, %eax
je 0xfad39
jmp 0xfad1a
movl -0x64(%rbp), %eax
subl $0xc, %eax
je 0xfaddf
jmp 0xfad28
movl -0x64(%rbp), %eax
addl $-0xd, %eax
subl $0x2, %eax
ja 0xfadec
jmp 0xfad39
movb $0x1, -0x5d(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0x80(%rbp)
leaq -0x49(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x7650
movq -0x78(%rbp), %rdx
leaq 0x52d80(%rip), %rsi     # 0x14dae3
leaq -0x48(%rbp), %rdi
callq 0x7520
jmp 0xfad6e
movq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x9c50
jmp 0xfad7d
movq -0x80(%rbp), %rdi
movb $0x0, -0x5d(%rbp)
leaq 0xb304c(%rip), %rsi     # 0x1addd8
leaq -0xf1103(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0xfaeac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xfadc0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x7708
leaq -0x49(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x5d(%rbp)
jne 0xfadd1
jmp 0xfadda
movq -0x80(%rbp), %rdi
callq 0x72c0
jmp 0xfaea3
movq $0x10, -0x8(%rbp)
jmp 0xfae96
movq -0x70(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x85e00
testb $0x1, %al
jne 0xfae02
jmp 0xfae4d
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x3, %eax
movl %eax, -0x84(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x3, 0x18(%rax)
jne 0xfae29
movl $0x4, %eax
movl %eax, -0x88(%rbp)
jmp 0xfae36
movq -0x28(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x88(%rbp)
movl -0x84(%rbp), %eax
movl -0x88(%rbp), %ecx
imull %ecx, %eax
movl %eax, %eax
movq %rax, -0x8(%rbp)
jmp 0xfae96
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
shrl $0x3, %eax
movl %eax, -0x8c(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x3, 0x14(%rax)
jne 0xfae74
movl $0x4, %eax
movl %eax, -0x90(%rbp)
jmp 0xfae81
movq -0x28(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x90(%rbp)
movl -0x8c(%rbp), %eax
movl -0x90(%rbp), %ecx
imull %ecx, %eax
movl %eax, %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x7640
nopl (%rax)