// File: rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::convert_row_major_matrix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, spirv_cross::SPIRType const&, bool)
string CompilerMSL::convert_row_major_matrix(string exp_str, const SPIRType &exp_type, bool is_packed)
{
	strip_enclosed_expression(exp_str);

	string func_name;

	// Square and packed matrices can just use transpose
	if (exp_type.columns == exp_type.vecsize || is_packed)
		func_name = "transpose";
	else
		func_name = string("spvConvertFromRowMajor") + to_string(exp_type.columns) + "x" + to_string(exp_type.vecsize);

	return join(func_name, "(", exp_str, ")");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdx, -0x138(%rbp)
movq %rsi, %rdx
movq -0x138(%rbp), %rsi
movq %rdi, -0x130(%rbp)
movb %r8b, %al
movq %rdi, %r8
movq %r8, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x10(%rbp), %rdi
callq 0x724d0
leaq -0x48(%rbp), %rdi
callq 0x7530
movq -0x20(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x14(%rcx), %eax
je 0x106bfd
testb $0x1, -0x21(%rbp)
je 0x106c25
leaq 0x3b016(%rip), %rsi     # 0x141c1a
leaq -0x48(%rbp), %rdi
callq 0x7510
jmp 0x106c0f
jmp 0x106dd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106e11
leaq -0xd9(%rbp), %rdi
movq %rdi, -0x140(%rbp)
callq 0x7650
movq -0x140(%rbp), %rdx
leaq 0x466cb(%rip), %rsi     # 0x14d311
leaq -0xd8(%rbp), %rdi
callq 0x7520
jmp 0x106c54
movq -0x20(%rbp), %rax
movl 0x18(%rax), %esi
leaq -0x100(%rbp), %rdi
callq 0x45220
jmp 0x106c69
leaq -0xb8(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x100(%rbp), %rdx
callq 0x2f7f0
jmp 0x106c85
leaq 0x3d5d5(%rip), %rdx     # 0x144261
leaq -0x98(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x11910
jmp 0x106ca1
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
leaq -0x120(%rbp), %rdi
callq 0x45220
jmp 0x106cb6
leaq -0x78(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x2f7f0
jmp 0x106ccf
leaq -0x48(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x7430
leaq -0x78(%rbp), %rdi
callq 0x7708
leaq -0x120(%rbp), %rdi
callq 0x7708
leaq -0x98(%rbp), %rdi
callq 0x7708
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0xd8(%rbp), %rdi
callq 0x7708
leaq -0xd9(%rbp), %rdi
callq 0x73d0
jmp 0x106dd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106dc3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106db7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106dab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106d9f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x106d93
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x7708
leaq -0x98(%rbp), %rdi
callq 0x7708
leaq -0xb8(%rbp), %rdi
callq 0x7708
leaq -0x100(%rbp), %rdi
callq 0x7708
leaq -0xd8(%rbp), %rdi
callq 0x7708
leaq -0xd9(%rbp), %rdi
callq 0x73d0
jmp 0x106e11
movq -0x138(%rbp), %rcx
movq -0x130(%rbp), %rdi
leaq 0x46547(%rip), %rdx     # 0x14d32d
leaq 0x3e10c(%rip), %r8      # 0x144ef9
leaq -0x48(%rbp), %rsi
callq 0xdd3c0
jmp 0x106df8
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x128(%rbp), %rax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x7708
movq -0x50(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)