// File: /workspace/github_cpp_makefile_star2_O3/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 0x12a72
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 0x41e64
movq %r15, %rdi
movl %r13d, %esi
callq 0x12a72
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 0x43669
leaq 0x10(%rbx), %r12
movq %r12, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movl 0x14(%r14), %eax
cmpl $0x2, %eax
jb 0x434dd
leaq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x34a5c
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 0x434ca
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7f7a0(%rip), %rsi     # 0xc2c71
movq %rbx, %rdi
callq 0x64e0
movl 0x14(%r14), %eax
testl %eax, %eax
je 0x437b5
movq %r12, 0x18(%rsp)
xorl %r13d, %r13d
movl $0xd1b71759, %r12d      # imm = 0xD1B71759
testl %r13d, %r13d
je 0x43507
movq %rbx, %rdi
leaq 0x76ba9(%rip), %rsi     # 0xba0ab
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 0x4381f
movl %eax, %ebp
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq %rbx, %rdi
leaq 0x7f7a2(%rip), %rsi     # 0xc2cec
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 0x435b2
movl $0x4, %eax
movl %r15d, %ecx
cmpl $0x63, %ecx
jbe 0x435ab
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x435b0
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x435b2
movl %ecx, %edx
imulq %r12, %rdx
shrq $0x2d, %rdx
addl $0x4, %eax
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x4357a
addl $-0x3, %eax
jmp 0x435b2
addl $-0x2, %eax
jmp 0x435b2
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 0x20b57
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 0x43609
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
leaq 0x7a52b(%rip), %rsi     # 0xbdb3e
callq 0x64e0
andl $0x3, %ebp
leaq 0xb908e(%rip), %rax     # 0xfc6b0
movq (%rax,%rbp,8), %rsi
testq %rsi, %rsi
je 0x43800
movq %rbx, %rdi
callq 0x64e0
incl %r13d
movl 0x14(%r14), %eax
cmpl %eax, %r13d
jb 0x434f3
cmpl $0x1, %eax
movq 0x18(%rsp), %r12
jbe 0x437b5
leaq 0x773b9(%rip), %rsi     # 0xbaa15
movq %rbx, %rdi
callq 0x64e0
jmp 0x437b5
movl 0x80(%rsp), %eax
movl 0x10(%r14), %ecx
shrl $0x3, %ecx
xorl %edx, %edx
divl %ecx
testl %edx, %edx
jne 0x4383e
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 0x7f63a(%rip), %rsi     # 0xc2cec
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 0x43721
movl $0x4, %eax
movl $0xd1b71759, %ecx       # imm = 0xD1B71759
movl %ebp, %edx
cmpl $0x63, %edx
jbe 0x4371a
cmpl $0x3e7, %edx            # imm = 0x3E7
jbe 0x4371f
cmpl $0x2710, %edx           # imm = 0x2710
jb 0x43721
movl %edx, %esi
imulq %rcx, %rsi
shrq $0x2d, %rsi
addl $0x4, %eax
cmpl $0x1869f, %edx          # imm = 0x1869F
movl %esi, %edx
ja 0x436e9
addl $-0x3, %eax
jmp 0x43721
addl $-0x2, %eax
jmp 0x43721
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 0x20b57
movq 0x20(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x60b0
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
je 0x43772
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x7a3c5(%rip), %rsi     # 0xbdb3e
movq %rbx, %rdi
callq 0x64e0
movl 0x14(%r14), %eax
decl %eax
cmpl $0x4, %eax
jae 0x4385d
andl $0x3, %r15d
movl %eax, %eax
shlq $0x5, %rax
leaq 0xb8f0f(%rip), %rcx     # 0xfc6b0
addq %rax, %rcx
movq (%rcx,%r15,8), %rsi
testq %rsi, %rsi
je 0x43800
movq %rbx, %rdi
callq 0x64e0
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x437d0
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x437eb
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 0x77586(%rip), %rdi     # 0xbad8d
leaq 0x7353a(%rip), %rsi     # 0xb6d48
leaq 0x77553(%rip), %rcx     # 0xbad68
movl $0x10a, %edx            # imm = 0x10A
callq 0x61b0
leaq 0x75edc(%rip), %rdi     # 0xb9702
leaq 0x7351b(%rip), %rsi     # 0xb6d48
leaq 0x75efe(%rip), %rcx     # 0xb9732
movl $0x1619, %edx           # imm = 0x1619
callq 0x61b0
leaq 0x75f84(%rip), %rdi     # 0xb97c9
leaq 0x734fc(%rip), %rsi     # 0xb6d48
leaq 0x75edf(%rip), %rcx     # 0xb9732
movl $0x162e, %edx           # imm = 0x162E
callq 0x61b0
leaq 0x774e7(%rip), %rdi     # 0xbad4b
leaq 0x734dd(%rip), %rsi     # 0xb6d48
leaq 0x774f6(%rip), %rcx     # 0xbad68
movl $0x108, %edx            # imm = 0x108
callq 0x61b0
movq %r12, 0x18(%rsp)
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq -0x10(%rax), %rdi
jmp 0x438cb
jmp 0x43891
movq %r12, 0x18(%rsp)
jmp 0x438df
movq %r13, 0x18(%rsp)
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %r12, %rdi
jne 0x438d0
jmp 0x438e2
jmp 0x438b3
movq %rax, %r14
jmp 0x43917
movq %r13, 0x18(%rsp)
jmp 0x438df
jmp 0x438df
jmp 0x438df
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x438e2
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x438e2
movq %rax, %r14
movq (%rbx), %rdi
cmpq 0x18(%rsp), %rdi
je 0x438fc
movq 0x18(%rsp), %rax
movq (%rax), %rsi
incq %rsi
callq 0x6260
leaq 0x50(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43917
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x70(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x43932
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x6260
movq %r14, %rdi
callq 0x64a0