// File: /workspace/github_cpp_makefile_star2_O1/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 0x12aba
movq 0x20(%rax), %r12
movq 0x28(%rax), %r13
cmpq %r12, %r13
je 0x933b1
movq %rbx, %rdi
movl %ebp, %esi
callq 0xc7f4
testq %rax, %rax
je 0x932a3
cmpb $0x1, 0x5b(%rax)
jne 0x932a3
cmpb $0x0, 0x39(%rax)
jne 0x933b1
testq %rax, %rax
je 0x9334e
movl %r14d, %ecx
shlq $0x4, %rcx
movq 0x20(%rbx), %rdx
cmpl $0x3, 0x8(%rdx,%rcx)
jne 0x9334e
cmpb $0x1, 0x59(%rax)
jne 0x9334e
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x345e6
movq %rbx, %rdi
movl %r14d, %esi
callq 0x1c66e
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2e53a
leaq 0x2c755(%rip), %rdx     # 0xbfa52
leaq 0x2c7e5(%rip), %r8      # 0xbfae9
leaq 0x8(%rsp), %rsi
leaq 0x28(%rsp), %rcx
movq %rbx, %rdi
callq 0x56b90
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x93331
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x933b1
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x933b1
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12cda
testq %rax, %rax
je 0x93368
movl 0x8(%rax), %esi
movq %rbx, %rdi
callq 0x4434c
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x345e6
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 0x933a7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12e52
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 0x933eb
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6260
jmp 0x933eb
jmp 0x933e8
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x93406
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6260
movq %rbx, %rdi
callq 0x64a0