// File: /workspace/github_cpp_makefile_star2_O1/rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::flattened_access_chain_vector[abi:cxx11](unsigned int, unsigned int const*, unsigned int, spirv_cross::SPIRType const&, unsigned int, unsigned int, bool)
std::string CompilerGLSL::flattened_access_chain_vector(uint32_t base, const uint32_t *indices, uint32_t count,
                                                        const SPIRType &target_type, uint32_t offset,
                                                        uint32_t matrix_stride, bool need_transpose)
{
	auto result = flattened_access_chain_offset(expression_type(base), indices, count, offset, 16);

	auto buffer_name = to_name(expression_type(base).self);

	if (need_transpose)
	{
		std::string expr;

		if (target_type.vecsize > 1)
		{
			expr += type_to_glsl_constructor(target_type);
			expr += "(";
		}

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

			uint32_t component_offset = result.second + i * matrix_stride;

			assert(component_offset % (target_type.width / 8) == 0);
			uint32_t index = component_offset / (target_type.width / 8);

			expr += buffer_name;
			expr += "[";
			expr += result.first; // this is a series of N1 * k1 + N2 * k2 + ... that is either empty or ends with a +
			expr += convert_to_string(index / 4);
			expr += "]";

			expr += vector_swizzle(1, index % 4);
		}

		if (target_type.vecsize > 1)
		{
			expr += ")";
		}

		return expr;
	}
	else
	{
		assert(result.second % (target_type.width / 8) == 0);
		uint32_t index = result.second / (target_type.width / 8);

		std::string expr;

		expr += buffer_name;
		expr += "[";
		expr += result.first; // this is a series of N1 * k1 + N2 * k2 + ... that is either empty or ends with a +
		expr += convert_to_string(index / 4);
		expr += "]";

		expr += vector_swizzle(target_type.vecsize, index % 4);

		return expr;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %r14
movl %r8d, %ebp
movq %rcx, %r12
movl %edx, %r13d
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movl %edx, %esi
callq 0x12aba
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rsp)
movl $0x10, (%rsp)
leaq 0x60(%rsp), %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r12, %rcx
movl %ebp, %r8d
movl 0xc0(%rsp), %r9d
callq 0x4268a
movq %r15, %rdi
movl %r13d, %esi
callq 0x12aba
movl 0x8(%rax), %edx
movq (%r15), %rax
leaq 0x40(%rsp), %rdi
movq %r15, %rsi
movl $0x1, %ecx
callq *0x38(%rax)
cmpb $0x0, 0xd0(%rsp)
je 0x43e8a
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
cmpl $0x2, 0x14(%r14)
jb 0x43cfb
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x35152
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43cec
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7ffae(%rip), %rsi     # 0xc3ca1
movq %rbx, %rdi
callq 0x64e0
cmpl $0x0, 0x14(%r14)
je 0x43fd6
movq %r12, 0x18(%rsp)
xorl %r13d, %r13d
movl $0xd1b71759, %r12d      # imm = 0xD1B71759
testl %r13d, %r13d
je 0x43d28
movq %rbx, %rdi
leaq 0x77398(%rip), %rsi     # 0xbb0bb
callq 0x64e0
movl %r13d, %eax
imull 0xc8(%rsp), %eax
addl 0x80(%rsp), %eax
movl 0x10(%r14), %ecx
shrl $0x3, %ecx
xorl %edx, %edx
divl %ecx
testl %edx, %edx
jne 0x44040
movl %eax, %ebp
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq %rbx, %rdi
leaq 0x7ffb1(%rip), %rsi     # 0xc3d1c
callq 0x64e0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movl %ebp, %r15d
shrl $0x2, %r15d
movl $0x1, %eax
cmpl $0x28, %ebp
jb 0x43dd3
movl $0x4, %eax
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x43dcc
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x43dd1
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x43dd3
movl %ecx, %edx
imulq %r12, %rdx
shrq $0x2d, %rdx
addl $0x4, %eax
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x43d9b
addl $-0x3, %eax
jmp 0x43dd3
addl $-0x2, %eax
jmp 0x43dd3
decl %eax
movl %eax, %esi
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x20(%rsp), %rdi
xorl %edx, %edx
callq 0x62f0
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %r15d, %edx
callq 0x21251
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x43e2a
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
leaq 0x7ad02(%rip), %rsi     # 0xbeb36
callq 0x64e0
andl $0x3, %ebp
leaq 0xb986d(%rip), %rax     # 0xfd6b0
movq (%rax,%rbp,8), %rsi
testq %rsi, %rsi
je 0x44021
movq %rbx, %rdi
callq 0x64e0
incl %r13d
movl 0x14(%r14), %eax
cmpl %eax, %r13d
jb 0x43d14
cmpl $0x1, %eax
movq 0x18(%rsp), %r12
jbe 0x43fd6
leaq 0x77ba8(%rip), %rsi     # 0xbba25
movq %rbx, %rdi
callq 0x64e0
jmp 0x43fd6
movl 0x80(%rsp), %eax
movl 0x10(%r14), %ecx
shrl $0x3, %ecx
xorl %edx, %edx
divl %ecx
testl %edx, %edx
jne 0x4405f
movl %eax, %r15d
leaq 0x10(%rbx), %r13
movq %r13, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
leaq 0x7fe49(%rip), %rsi     # 0xc3d1c
movq %rbx, %rdi
callq 0x64e0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movl %r15d, %ebp
shrl $0x2, %ebp
movl $0x1, %eax
cmpl $0x28, %r15d
jb 0x43f42
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x43f3b
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x43f40
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x43f42
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x43f0a
addl $-0x3, %eax
jmp 0x43f42
addl $-0x2, %eax
jmp 0x43f42
decl %eax
movl %eax, %esi
leaq 0x30(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x20(%rsp), %rdi
xorl %edx, %edx
callq 0x62f0
movq 0x20(%rsp), %rdi
movl 0x28(%rsp), %esi
movl %ebp, %edx
callq 0x21251
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x43f93
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7ab9c(%rip), %rsi     # 0xbeb36
movq %rbx, %rdi
callq 0x64e0
movl 0x14(%r14), %eax
decl %eax
cmpl $0x4, %eax
jae 0x4407e
andl $0x3, %r15d
movl %eax, %eax
shlq $0x5, %rax
leaq 0xb96ee(%rip), %rcx     # 0xfd6b0
addq %rax, %rcx
movq (%rcx,%r15,8), %rsi
testq %rsi, %rsi
je 0x44021
movq %rbx, %rdi
callq 0x64e0
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43ff1
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4400c
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x77d75(%rip), %rdi     # 0xbbd9d
leaq 0x73d29(%rip), %rsi     # 0xb7d58
leaq 0x77d42(%rip), %rcx     # 0xbbd78
movl $0x10a, %edx            # imm = 0x10A
callq 0x61b0
leaq 0x766cb(%rip), %rdi     # 0xba712
leaq 0x73d0a(%rip), %rsi     # 0xb7d58
leaq 0x766ed(%rip), %rcx     # 0xba742
movl $0x1619, %edx           # imm = 0x1619
callq 0x61b0
leaq 0x76773(%rip), %rdi     # 0xba7d9
leaq 0x73ceb(%rip), %rsi     # 0xb7d58
leaq 0x766ce(%rip), %rcx     # 0xba742
movl $0x162e, %edx           # imm = 0x162E
callq 0x61b0
leaq 0x77cd6(%rip), %rdi     # 0xbbd5b
leaq 0x73ccc(%rip), %rsi     # 0xb7d58
leaq 0x77ce5(%rip), %rcx     # 0xbbd78
movl $0x108, %edx            # imm = 0x108
callq 0x61b0
movq %r12, 0x18(%rsp)
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x440ec
jmp 0x440b2
movq %r12, 0x18(%rsp)
jmp 0x44100
movq %r13, 0x18(%rsp)
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x440f1
jmp 0x44103
jmp 0x440d4
movq %rax, %r14
jmp 0x44138
movq %r13, 0x18(%rsp)
jmp 0x44100
jmp 0x44100
jmp 0x44100
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x44103
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x44103
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x18(%rsp), %rdi
je 0x4411d
movq 0x18(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x44138
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x44153
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0
nop