// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::add_convert_row_major_matrix_function(unsigned int, unsigned int)
void CompilerMSL::add_convert_row_major_matrix_function(uint32_t cols, uint32_t rows)
{
	SPVFuncImpl spv_func;
	if (cols == rows) // Square matrix...just use transpose() function
		return;
	else if (cols == 2 && rows == 3)
		spv_func = SPVFuncImplRowMajor2x3;
	else if (cols == 2 && rows == 4)
		spv_func = SPVFuncImplRowMajor2x4;
	else if (cols == 3 && rows == 2)
		spv_func = SPVFuncImplRowMajor3x2;
	else if (cols == 3 && rows == 4)
		spv_func = SPVFuncImplRowMajor3x4;
	else if (cols == 4 && rows == 2)
		spv_func = SPVFuncImplRowMajor4x2;
	else if (cols == 4 && rows == 3)
		spv_func = SPVFuncImplRowMajor4x3;
	else
		SPIRV_CROSS_THROW("Could not convert row-major matrix.");

	auto rslt = spv_function_implementations.insert(spv_func);
	if (rslt.second)
	{
		add_pragma_line("#pragma clang diagnostic ignored \"-Wmissing-prototypes\"");
		force_recompile = true;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl -0xc(%rbp), %eax
cmpl -0x10(%rbp), %eax
jne 0x1067ed
jmp 0x106a17
cmpl $0x2, -0xc(%rbp)
jne 0x106805
cmpl $0x3, -0x10(%rbp)
jne 0x106805
movl $0x12, -0x14(%rbp)
jmp 0x10693f
cmpl $0x2, -0xc(%rbp)
jne 0x10681d
cmpl $0x4, -0x10(%rbp)
jne 0x10681d
movl $0x13, -0x14(%rbp)
jmp 0x10693d
cmpl $0x3, -0xc(%rbp)
jne 0x106835
cmpl $0x2, -0x10(%rbp)
jne 0x106835
movl $0x14, -0x14(%rbp)
jmp 0x10693b
cmpl $0x3, -0xc(%rbp)
jne 0x10684d
cmpl $0x4, -0x10(%rbp)
jne 0x10684d
movl $0x15, -0x14(%rbp)
jmp 0x106939
cmpl $0x4, -0xc(%rbp)
jne 0x106865
cmpl $0x2, -0x10(%rbp)
jne 0x106865
movl $0x16, -0x14(%rbp)
jmp 0x106937
cmpl $0x4, -0xc(%rbp)
jne 0x10687d
cmpl $0x3, -0x10(%rbp)
jne 0x10687d
movl $0x17, -0x14(%rbp)
jmp 0x106935
movb $0x1, -0x4d(%rbp)
movl $0x10, %edi
callq 0x71a0
movq %rax, -0xb0(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x7650
movq -0xa8(%rbp), %rdx
leaq 0x46a3d(%rip), %rsi     # 0x14d2ed
leaq -0x38(%rbp), %rdi
callq 0x7520
jmp 0x1068bb
movq -0xb0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x9c50
jmp 0x1068cd
movq -0xb0(%rbp), %rdi
movb $0x0, -0x4d(%rbp)
leaq 0xa74f9(%rip), %rsi     # 0x1addd8
leaq -0xfcc56(%rip), %rdx    # 0x9c90
callq 0x7610
jmp 0x106a29
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x106913
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x7708
leaq -0x39(%rbp), %rdi
callq 0x73d0
testb $0x1, -0x4d(%rbp)
jne 0x106924
jmp 0x106930
movq -0xb0(%rbp), %rdi
callq 0x72c0
jmp 0x106a20
jmp 0x106937
jmp 0x106939
jmp 0x10693b
jmp 0x10693d
jmp 0x10693f
jmp 0x106941
movq -0xa0(%rbp), %rdi
addq $0x7e0, %rdi            # imm = 0x7E0
leaq -0x14(%rbp), %rsi
callq 0x1170d0
movb %dl, -0x68(%rbp)
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x60(%rbp)
movb -0x68(%rbp), %al
movb %al, -0x58(%rbp)
testb $0x1, -0x58(%rbp)
je 0x106a17
leaq -0x91(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x7650
movq -0xb8(%rbp), %rdx
leaq 0x44087(%rip), %rsi     # 0x14aa1f
leaq -0x90(%rbp), %rdi
callq 0x7520
jmp 0x1069a6
movq -0xa0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xf9250
jmp 0x1069bb
leaq -0x90(%rbp), %rdi
callq 0x7708
leaq -0x91(%rbp), %rdi
callq 0x73d0
movq -0xa0(%rbp), %rax
movb $0x1, 0x1d0(%rax)
jmp 0x106a17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x106a09
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x7708
leaq -0x91(%rbp), %rdi
callq 0x73d0
jmp 0x106a20
addq $0xc0, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x7640
nopl (%rax)