// File: /workspace/github_cpp_makefile_star2_O1/AshOlogn[P]ash-language-interpreter/src/executor.cpp
// Function: executeNewAssignmentStatement(NewAssignmentStatementNode*)
void executeNewAssignmentStatement(NewAssignmentStatementNode* node) {
  
  //get stuff out of the node first
  SymbolTable* symbolTable = node->symbolTable;
  std::string variable = node->variable;
  ParseDataType type = node->type;
	ParseDataType subType = node->subType;
  
  //add variable to table
  if(node->value != NULL) {

    ParseData d = node->value->evaluate();
				
		if(type == ARRAY_T) {

			//if array, change array value's subtype to fit variable's subtype
			Array* arr = (Array*) d.value.allocated;
			arr->subtype = subType;
			symbolTable->declare(variable, d);

		} else {
			//consider implicit casting
    	symbolTable->declare(variable, castHelper(d, type));
		}

  } else {
    
    ParseData d;
    d.type = symbolTable->get(variable).type;
    symbolTable->declare(variable, castHelper(d, type));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %r15
movq 0x10(%rdi), %rbx
leaq -0x38(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x18(%rdi), %rsi
movq 0x20(%rdi), %rdx
addq %rsi, %rdx
leaq -0x48(%rbp), %rdi
callq 0x8ac2
movl 0x38(%r15), %r14d
movq 0x40(%r15), %rdi
testq %rdi, %rdi
je 0x1702b
movl 0x3c(%r15), %r13d
movq (%rdi), %rax
callq *(%rax)
movl %eax, %r12d
movq %rdx, %r15
cmpl $0xc, %r14d
jne 0x170d5
movl %r13d, (%r15)
leaq -0xb8(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xc8(%rbp), %rdi
callq 0x8ac2
leaq -0xc8(%rbp), %rsi
movq %rbx, %rdi
movl %r12d, %edx
movq %r15, %rcx
leaq -0x38(%rbp), %r13
callq 0x16598
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x170b0
jmp 0x170b5
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x88(%rbp), %rdi
callq 0x8ac2
leaq -0x88(%rbp), %rsi
movq %rbx, %rdi
callq 0x1669a
movl %eax, %r15d
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x1706e
callq 0x41e0
leaq -0x58(%rbp), %r12
movq %r12, -0x10(%r12)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0x68(%rbp), %rdi
callq 0x8ac2
movl %r15d, %edi
movl %r14d, %edx
callq 0x150d0
movq %rdx, %rcx
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
movl %eax, %edx
callq 0x16598
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x170b5
callq 0x41e0
movq -0x48(%rbp), %rdi
cmpq %r13, %rdi
je 0x170c3
callq 0x41e0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x98(%rbp), %r13
movq %r13, -0x10(%r13)
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq %rsi, %rdx
leaq -0xa8(%rbp), %rdi
callq 0x8ac2
movl %r12d, %edi
movq %r15, %rsi
movl %r14d, %edx
callq 0x150d0
movq %rdx, %rcx
leaq -0xa8(%rbp), %rsi
movq %rbx, %rdi
movl %eax, %edx
callq 0x16598
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
leaq -0x38(%rbp), %r13
jne 0x170b0
jmp 0x170b5
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
cmpq %r14, %rdi
jne 0x1716b
jmp 0x17175
jmp 0x17172
jmp 0x17172
movq %rax, %rbx
movq -0x88(%rbp), %rdi
jmp 0x17166
jmp 0x17172
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
cmpq %r13, %rdi
jne 0x1716b
jmp 0x17175
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r12, %rdi
je 0x17175
callq 0x41e0
jmp 0x17175
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x17187
callq 0x41e0
movq %rbx, %rdi
callq 0x4380