// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::MemberSorter::sort()
void CompilerMSL::MemberSorter::sort()
{
	// Create a temporary array of consecutive member indices and sort it based on how
	// the members should be reordered, based on builtin and sorting aspect meta info.
	size_t mbr_cnt = type.member_types.size();
	vector<uint32_t> mbr_idxs(mbr_cnt);
	iota(mbr_idxs.begin(), mbr_idxs.end(), 0); // Fill with consecutive indices
	std::sort(mbr_idxs.begin(), mbr_idxs.end(), *this); // Sort member indices based on sorting aspect

	// Move type and meta member info to the order defined by the sorted member indices.
	// This is done by creating temporary copies of both member types and meta, and then
	// copying back to the original content at the sorted indices.
	auto mbr_types_cpy = type.member_types;
	auto mbr_meta_cpy = meta.members;
	for (uint32_t mbr_idx = 0; mbr_idx < mbr_cnt; mbr_idx++)
	{
		type.member_types[mbr_idx] = mbr_types_cpy[mbr_idxs[mbr_idx]];
		meta.members[mbr_idx] = mbr_meta_cpy[mbr_idxs[mbr_idx]];
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq (%rax), %rdi
addq $0x68, %rdi
callq 0x8650
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
callq 0x8d10
movq -0xc8(%rbp), %rsi
movq -0xc0(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x32880
jmp 0xfa6de
leaq -0x29(%rbp), %rdi
callq 0x9390
leaq -0x28(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x86d0
movq -0xd8(%rbp), %rdi
movq %rax, -0x48(%rbp)
callq 0x8700
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
xorl %edx, %edx
callq 0x117cc0
jmp 0xfa71c
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x86d0
movq -0xe0(%rbp), %rdi
movq %rax, -0x58(%rbp)
callq 0x8700
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movq %rcx, -0x60(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x70(%rbp)
movups (%rax), %xmm0
movaps %xmm0, -0x80(%rbp)
movq -0x58(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x70(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x10(%rax)
movaps -0x80(%rbp), %xmm0
movups %xmm0, (%rax)
callq 0x117d20
jmp 0xfa77a
movq -0xd0(%rbp), %rax
movq (%rax), %rsi
addq $0x68, %rsi
leaq -0x98(%rbp), %rdi
callq 0x3c300
jmp 0xfa796
movq -0xd0(%rbp), %rax
movq 0x8(%rax), %rsi
addq $0xd0, %rsi
leaq -0xb0(%rbp), %rdi
callq 0x370b0
jmp 0xfa7b6
movl $0x0, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
cmpq -0x10(%rbp), %rax
jae 0xfa8e7
movl -0xb4(%rbp), %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x8630
movl (%rax), %eax
movl %eax, %esi
leaq -0x98(%rbp), %rdi
callq 0x8630
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movl (%rcx), %ecx
movl %ecx, -0xf4(%rbp)
movq (%rax), %rdi
addq $0x68, %rdi
movl -0xb4(%rbp), %eax
movl %eax, %esi
callq 0x8630
movl -0xf4(%rbp), %ecx
movq -0xf0(%rbp), %rdi
movl %ecx, (%rax)
movl -0xb4(%rbp), %eax
movl %eax, %esi
callq 0x8630
movl (%rax), %eax
movl %eax, %esi
leaq -0xb0(%rbp), %rdi
callq 0x2fa30
movq %rax, %rcx
movq -0xd0(%rbp), %rax
movq %rcx, -0xe8(%rbp)
movq 0x8(%rax), %rdi
addq $0xd0, %rdi
movl -0xb4(%rbp), %eax
movl %eax, %esi
callq 0x2fa30
movq -0xe8(%rbp), %rsi
movq %rax, %rdi
callq 0x38270
jmp 0xfa884
jmp 0xfa886
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0xfa7c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x9390
jmp 0xfa926
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfa91d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0xfa911
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x17f70
jmp 0xfa911
leaq -0xb0(%rbp), %rdi
callq 0x17f70
leaq -0x98(%rbp), %rdi
callq 0x8430
leaq -0x28(%rbp), %rdi
callq 0x8430
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
leaq -0x98(%rbp), %rdi
callq 0x8430
leaq -0x28(%rbp), %rdi
callq 0x8430
movq -0x38(%rbp), %rdi
callq 0x7640
nop