// File: /workspace/github_cpp_makefile_star2_O3/rossy[P]crossc/SPIRV-Cross/spirv_msl.cpp
// Function: spirv_cross::CompilerMSL::maybe_emit_array_assignment(unsigned int, unsigned int)
bool CompilerMSL::maybe_emit_array_assignment(uint32_t id_lhs, uint32_t id_rhs)
{
	// We only care about assignments of an entire array
	auto &type = expression_type(id_rhs);
	if (type.array.size() == 0)
		return false;

	auto *var = maybe_get<SPIRVariable>(id_lhs);

	// Is this a remapped, static constant? Don't do anything.
	if (var && var->remapped_variable && var->statically_assigned)
		return true;

	if (ir.ids[id_rhs].get_type() == TypeConstant && var && var->deferred_declaration)
	{
		// Special case, if we end up declaring a variable when assigning the constant array,
		// we can avoid the copy by directly assigning the constant expression.
		// This is likely necessary to be able to use a variable as a true look-up table, as it is unlikely
		// the compiler will be able to optimize the spvArrayCopy() into a constant LUT.
		// After a variable has been declared, we can no longer assign constant arrays in MSL unfortunately.
		statement(to_expression(id_lhs), " = ", constant_expression(get<SPIRConstant>(id_rhs)), ";");
		return true;
	}

	// Ensure the LHS variable has been declared
	auto *p_v_lhs = maybe_get_backing_variable(id_lhs);
	if (p_v_lhs)
		flush_variable_declaration(p_v_lhs->self);

	emit_array_copy(to_expression(id_lhs), id_rhs);
	register_write(id_lhs);

	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %rbx
movl %edx, %esi
callq 0x12a72
movq 0x20(%rax), %r12
movq 0x28(%rax), %r13
cmpq %r12, %r13
je 0x9278c
movq %rbx, %rdi
movl %ebp, %esi
callq 0xc7b4
testq %rax, %rax
je 0x92729
cmpb $0x1, 0x5b(%rax)
jne 0x92687
cmpb $0x0, 0x39(%rax)
jne 0x9278c
movl %r14d, %ecx
movq 0x20(%rbx), %rdx
shlq $0x4, %rcx
cmpl $0x3, 0x8(%rdx,%rcx)
jne 0x92729
cmpb $0x1, 0x59(%rax)
jne 0x92729
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x33f8a
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1c036
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2deba
leaq 0x2c382(%rip), %rdx     # 0xbea5a
leaq 0x2c412(%rip), %r8      # 0xbeaf1
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
callq 0x56396
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9270c
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x9278c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x9278c
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12c9a
testq %rax, %rax
je 0x92743
movl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0x43a7a
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x33f8a
movq (%rbx), %rax
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
callq *0x150(%rax)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x92782
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12e12
cmpq %r12, %r13
setne %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x927c6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x927c6
jmp 0x927c3
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x927e1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0
nop