// File: rossy[P]crossc/SPIRV-Cross/spirv_glsl.cpp
// Function: spirv_cross::CompilerGLSL::access_chain[abi:cxx11](unsigned int, unsigned int const*, unsigned int, spirv_cross::SPIRType const&, bool*, bool*)
string CompilerGLSL::access_chain(uint32_t base, const uint32_t *indices, uint32_t count, const SPIRType &target_type,
                                  bool *out_need_transpose, bool *result_is_packed)
{
	if (flattened_buffer_blocks.count(base))
	{
		uint32_t matrix_stride = 0;
		bool need_transpose = false;
		flattened_access_chain_offset(expression_type(base), indices, count, 0, 16, &need_transpose, &matrix_stride);

		if (out_need_transpose)
			*out_need_transpose = target_type.columns > 1 && need_transpose;
		if (result_is_packed)
			*result_is_packed = false;

		return flattened_access_chain(base, indices, count, target_type, 0, matrix_stride, need_transpose);
	}
	else if (flattened_structs.count(base) && count > 0)
	{
		auto chain = access_chain_internal(base, indices, count, false, true).substr(1);
		if (out_need_transpose)
			*out_need_transpose = false;
		if (result_is_packed)
			*result_is_packed = false;
		return sanitize_underscores(join(to_name(base), "_", chain));
	}
	else
	{
		return access_chain_internal(base, indices, count, false, false, out_need_transpose, result_is_packed);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x108(%rbp)
movq %rdi, %rax
movq %rax, -0x100(%rbp)
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
addq $0x678, %rdi            # imm = 0x678
leaq -0x14(%rbp), %rsi
callq 0x13520
cmpq $0x0, %rax
je 0x860cf
movq -0xf8(%rbp), %rdi
movl $0x0, -0x34(%rbp)
movb $0x0, -0x35(%rbp)
movl -0x14(%rbp), %esi
callq 0x1f760
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
leaq -0x60(%rbp), %rdi
xorl %r9d, %r9d
leaq -0x35(%rbp), %r10
leaq -0x34(%rbp), %rax
movl $0x10, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x862e0
leaq -0x60(%rbp), %rdi
callq 0xa4730
cmpq $0x0, 0x10(%rbp)
je 0x8607b
movq -0x30(%rbp), %rcx
xorl %eax, %eax
cmpl $0x1, 0x18(%rcx)
movb %al, -0x109(%rbp)
jbe 0x8606c
movb -0x35(%rbp), %al
movb %al, -0x109(%rbp)
movb -0x109(%rbp), %cl
movq 0x10(%rbp), %rax
andb $0x1, %cl
movb %cl, (%rax)
cmpq $0x0, 0x18(%rbp)
je 0x86089
movq 0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movq -0x30(%rbp), %r9
movl -0x34(%rbp), %r10d
movb -0x35(%rbp), %al
xorl %r11d, %r11d
andb $0x1, %al
movl $0x0, (%rsp)
movl %r10d, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x87100
jmp 0x862b9
movq -0xf8(%rbp), %rdi
addq $0x6b0, %rdi            # imm = 0x6B0
leaq -0x14(%rbp), %rsi
callq 0x13520
cmpq $0x0, %rax
je 0x8627f
cmpl $0x0, -0x24(%rbp)
jbe 0x8627f
movq -0xf8(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movq %rsp, %rax
movq $0x0, 0x10(%rax)
movq $0x0, 0x8(%rax)
movl $0x1, (%rax)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x118(%rbp)
xorl %r9d, %r9d
callq 0x73610
movq -0x118(%rbp), %rsi
leaq -0x80(%rbp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x73a0
jmp 0x86159
leaq -0xa0(%rbp), %rdi
callq 0x7708
cmpq $0x0, 0x10(%rbp)
je 0x86198
movq 0x10(%rbp), %rax
movb $0x0, (%rax)
jmp 0x86198
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x7708
jmp 0x862c9
cmpq $0x0, 0x18(%rbp)
je 0x861a6
movq 0x18(%rbp), %rax
movb $0x0, (%rax)
movq -0xf8(%rbp), %rsi
movl -0x14(%rbp), %edx
movq (%rsi), %rax
movq 0x38(%rax), %rax
leaq -0xf0(%rbp), %rdi
movl $0x1, %ecx
callq *%rax
jmp 0x861c7
leaq 0xc2350(%rip), %rdx     # 0x14851e
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
leaq -0x80(%rbp), %rcx
callq 0x9ff30
jmp 0x861e7
movq -0x108(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x577c0
jmp 0x861fc
leaq -0xd0(%rbp), %rdi
callq 0x7708
leaq -0xf0(%rbp), %rdi
callq 0x7708
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0x862b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x86274
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x86268
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x7708
leaq -0xf0(%rbp), %rdi
callq 0x7708
leaq -0x80(%rbp), %rdi
callq 0x7708
jmp 0x862c9
movq -0xf8(%rbp), %rsi
movq -0x108(%rbp), %rdi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
movl -0x24(%rbp), %r8d
movq 0x10(%rbp), %r10
movq 0x18(%rbp), %rax
xorl %r9d, %r9d
movl $0x0, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x73610
movq -0x100(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x7640
nopw %cs:(%rax,%rax)