// File: /workspace/github_cpp_makefile_star2_O1/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 0x8ac2
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 0x8ac2
leaq -0xb0(%rbp), %rsi
movq %rbx, %rdi
callq 0x1669a
movl %eax, %r15d
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x17212
callq 0x41e0
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
movq %rdx, %r14
cmpl $0xc, %r15d
jne 0x172c5
leaq -0x80(%rbp), %r15
movq %r15, -0x10(%r15)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x90(%rbp), %rdi
callq 0x8ac2
leaq -0x90(%rbp), %rsi
movq %rbx, %rdi
callq 0x1669a
movq %rdx, %r12
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
je 0x17269
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 0x172bb
movq 0x8(%r14), %r14
xorl %ebx, %ebx
movl (%r14,%rbx), %edi
movq 0x8(%r14,%rbx), %rsi
movl %r15d, %edx
callq 0x150d0
movl %eax, (%r13,%rbx)
movq %rdx, 0x8(%r13,%rbx)
addq $0x10, %rbx
cmpq %rbx, %r12
jne 0x17297
movq -0x50(%rbp), %rax
movq %r13, 0x8(%rax)
jmp 0x17311
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 0x8ac2
movl %r12d, %edi
movq %r14, %rsi
movl %r15d, %edx
callq 0x150d0
movq %rdx, %rcx
leaq -0x70(%rbp), %rsi
movq %rbx, %rdi
movl %eax, %edx
callq 0x165c2
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
je 0x17311
callq 0x41e0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x17323
callq 0x41e0
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x17372
movq %rax, %rbx
movq -0x90(%rbp), %rdi
cmpq %r15, %rdi
jne 0x17367
jmp 0x17375
jmp 0x17372
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r13, %rdi
jne 0x17367
jmp 0x17375
movq %rax, %rbx
movq -0xb0(%rbp), %rdi
cmpq %r12, %rdi
je 0x17375
callq 0x41e0
jmp 0x17375
jmp 0x17372
jmp 0x17372
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x17387
callq 0x41e0
movq %rbx, %rdi
callq 0x4380