// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flattened_access_chain_matrix[abi:cxx11](unsigned int, unsigned int const*, unsigned int, spirv_cross::SPIRType const&, unsigned int, unsigned int, bool)
std::string CompilerGLSL::flattened_access_chain_matrix(uint32_t base, const uint32_t *indices, uint32_t count,
                                                        const SPIRType &target_type, uint32_t offset,
                                                        uint32_t matrix_stride, bool need_transpose)
{
	assert(matrix_stride);
	SPIRType tmp_type = target_type;
	if (need_transpose)
		swap(tmp_type.vecsize, tmp_type.columns);

	std::string expr;

	expr += type_to_glsl_constructor(tmp_type);
	expr += "(";

	for (uint32_t i = 0; i < tmp_type.columns; i++)
	{
		if (i != 0)
			expr += ", ";

		expr += flattened_access_chain_vector(base, indices, count, tmp_type, offset + i * matrix_stride, matrix_stride,
		                                      /* need_transpose= */ false);
	}

	expr += ")";

	return expr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movq %rdi, -0x180(%rbp)
movq %rdi, %rax
movq %rax, -0x178(%rbp)
movb 0x20(%rbp), %al
movl 0x18(%rbp), %r10d
movl 0x10(%rbp), %r10d
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %al
movb %al, -0x31(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpl $0x0, 0x18(%rbp)
je 0x87ba6
jmp 0x87bc5
leaq 0xbbf94(%rip), %rdi     # 0x143b41
leaq 0xb9678(%rip), %rsi     # 0x14122c
movl $0x15e8, %edx           # imm = 0x15E8
leaq 0xbbf8f(%rip), %rcx     # 0x143b4f
callq 0x7260
movq -0x30(%rbp), %rsi
leaq -0x110(%rbp), %rdi
callq 0x3d730
testb $0x1, -0x31(%rbp)
je 0x87bf6
leaq -0x110(%rbp), %rdi
addq $0x14, %rdi
leaq -0x110(%rbp), %rsi
addq $0x18, %rsi
callq 0x48a80
movq -0x180(%rbp), %rdi
movb $0x0, -0x111(%rbp)
callq 0x7530
movq -0x170(%rbp), %rsi
leaq -0x138(%rbp), %rdi
leaq -0x110(%rbp), %rdx
callq 0x72bf0
jmp 0x87c25
movq -0x180(%rbp), %rdi
leaq -0x138(%rbp), %rsi
callq 0x7470
jmp 0x87c3a
leaq -0x138(%rbp), %rdi
callq 0x7708
movq -0x180(%rbp), %rdi
leaq 0xc56d9(%rip), %rsi     # 0x14d32d
callq 0x7340
jmp 0x87c5b
movl $0x0, -0x148(%rbp)
movl -0x148(%rbp), %eax
cmpl -0xf8(%rbp), %eax
jae 0x87d70
cmpl $0x0, -0x148(%rbp)
je 0x87cd1
movq -0x180(%rbp), %rdi
leaq 0xbc901(%rip), %rsi     # 0x14458f
callq 0x7340
jmp 0x87c95
jmp 0x87cd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
jmp 0x87dbd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x7708
jmp 0x87dbd
movq -0x170(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movl 0x10(%rbp), %edi
movl -0x148(%rbp), %eax
movl 0x18(%rbp), %r9d
imull %r9d, %eax
addl %eax, %edi
movq %rsp, %rax
movl %r9d, 0x8(%rax)
movl %edi, (%rax)
movl $0x0, 0x10(%rax)
leaq -0x168(%rbp), %rdi
leaq -0x110(%rbp), %r9
callq 0x87df0
jmp 0x87d1b
movq -0x180(%rbp), %rdi
leaq -0x168(%rbp), %rsi
callq 0x7470
jmp 0x87d30
leaq -0x168(%rbp), %rdi
callq 0x7708
movl -0x148(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x148(%rbp)
jmp 0x87c65
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x140(%rbp)
movl %eax, -0x144(%rbp)
leaq -0x168(%rbp), %rdi
callq 0x7708
jmp 0x87dbd
movq -0x180(%rbp), %rdi
leaq 0xbd17b(%rip), %rsi     # 0x144ef9
callq 0x7340
jmp 0x87d85
movb $0x1, -0x111(%rbp)
testb $0x1, -0x111(%rbp)
jne 0x87da1
movq -0x180(%rbp), %rdi
callq 0x7708
leaq -0x110(%rbp), %rdi
callq 0x314e0
movq -0x178(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq
movq -0x180(%rbp), %rdi
callq 0x7708
leaq -0x110(%rbp), %rdi
callq 0x314e0
movq -0x140(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)