// File: /workspace/github_cpp_makefile_star2_O3/AshOlogn[P]ash-language-interpreter/src/executor.cpp
// Function: executeAssignmentStatement(AssignmentStatementNode*)
void executeAssignmentStatement(AssignmentStatementNode* node) {
	
  //get stuff out of the node first
  SymbolTable* symbolTable = node->symbolTable;
  std::string variable = node->variable;
  AbstractExpressionNode* value = node->value;
  
  ParseDataType type = (symbolTable->get(variable)).type;
  ParseData d = value->evaluate();

	if(type == ARRAY_T) {

		//deep copy of array, casting as necessary
		Array* arr = (Array*) (symbolTable->get(variable)).value.allocated;
		ParseDataType subType = arr->subtype;

		Array* origArr = (Array*) d.value.allocated;
		uint32_t length = arr->length = origArr->length;
		
		ParseData* values = new ParseData[length];
		ParseData* origValues = origArr->values;

		for(uint32_t i = 0; i < length; i++) {
			values[i] = castHelper(origValues[i], subType);
		}

		arr->values = values;

	} else {
		//update variable value (innermost scope)
  	symbolTable->update(variable, castHelper(d, type));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdi, %r14
movq 0x10(%rdi), %rbx
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %r15
movq %r15, %rdi
callq 0x897a
movq 0x38(%r14), %r14
leaq -0xa0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0xb0(%rbp), %rdi
callq 0x897a
leaq -0xb0(%rbp), %rsi
movq %rbx, %rdi
callq 0x165ec
movl %eax, %r15d
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x1714a
callq 0x41e0
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movq %rdx, %r14
cmpl $0xc, %r15d
jne 0x171fd
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x897a
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x165ec
movq %rdx, %r12
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x171a1
callq 0x41e0
movl (%r12), %r15d
movl 0x4(%r14), %ebx
movq %r12, -0x50(%rbp)
movl %ebx, 0x4(%r12)
movq %rbx, %r12
shlq $0x4, %r12
movq %r12, %rdi
callq 0x4030
movq %rax, %r13
testq %rbx, %rbx
je 0x171f3
movq 0x8(%r14), %r14
xorl %ebx, %ebx
movl (%r14,%rbx), %edi
movq 0x8(%r14,%rbx), %rsi
movl %r15d, %edx
callq 0x15094
movl %eax, (%r13,%rbx)
movq %rdx, 0x8(%r13,%rbx)
addq $0x10, %rbx
cmpq %rbx, %r12
jne 0x171cf
movq -0x50(%rbp), %rax
movq %r13, 0x8(%rax)
jmp 0x17249
movl %eax, %r12d
leaq -0x60(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x70(%rbp), %rdi
callq 0x897a
movl %r12d, %edi
movq %r14, %rsi
movl %r15d, %edx
callq 0x15094
movq %rdx, %rcx
leaq -0x70(%rbp), %rsi
movq %rbx, %rdi
movl %eax, %edx
callq 0x16514
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x17249
callq 0x41e0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x1725b
callq 0x41e0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x172aa
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
jne 0x1729f
jmp 0x172ad
jmp 0x172aa
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
jne 0x1729f
jmp 0x172ad
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x172ad
callq 0x41e0
jmp 0x172ad
jmp 0x172aa
jmp 0x172aa
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x172bf
callq 0x41e0
movq %rbx, %rdi
callq 0x4380