// File: pranavmodx[P]modlang/src/evaluator.cpp
// Function: Evaluator::evalHashMapLiteral(HashMapLiteral*, Environment*)
Object *Evaluator::evalHashMapLiteral(HashMapLiteral *hashMapLiteral, Environment *env)
{
	HashMap *hashMap = new HashMap();

	for (auto pair : hashMapLiteral->pairs)
	{
		Object *key = Eval(pair.key, env);

		if (key->type() == ERROR_OBJ)
			return key;

		Object *value = Eval(pair.value, env);

		if (value->type() == ERROR_OBJ)
		{
			delete hashMap;
			return value;
		}

		HashKey hashKey(key->type(), key->inspect());
		HashMapPairObj hashMapPairObj(key, value);

		hashMap->pairs[hashKey] = hashMapPairObj;
	}

	return hashMap;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x150(%rbp)
movl $0x40, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, -0x148(%rbp)
xorl %esi, %esi
movl $0x40, %edx
callq 0x5170
movq -0x148(%rbp), %rdi
callq 0x388f0
movq -0x148(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1c030
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rdi
callq 0x1c060
movq %rax, -0x40(%rbp)
leaq -0x38(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x1c090
testb $0x1, %al
jne 0x35025
jmp 0x35254
leaq -0x38(%rbp), %rdi
callq 0x1c0d0
movq -0x150(%rbp), %rdi
movq (%rax), %rcx
movq %rcx, -0x50(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x32080
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rsi
movq (%rsi), %rax
leaq -0x78(%rbp), %rdi
callq *(%rax)
leaq -0x78(%rbp), %rdi
leaq 0x32393(%rip), %rsi     # 0x67400
callq 0x16920
movb %al, -0x151(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x5518
movb -0x151(%rbp), %al
testb $0x1, %al
jne 0x3508d
jmp 0x3509a
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3525c
movq -0x150(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x32080
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rsi
movq (%rsi), %rax
leaq -0xa0(%rbp), %rdi
callq *(%rax)
leaq -0xa0(%rbp), %rdi
leaq 0x32330(%rip), %rsi     # 0x67400
callq 0x16920
movb %al, -0x152(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x5518
movb -0x152(%rbp), %al
testb $0x1, %al
jne 0x350f3
jmp 0x3512e
movq -0x28(%rbp), %rax
movq %rax, -0x160(%rbp)
cmpq $0x0, %rax
je 0x35121
movq -0x160(%rbp), %rdi
callq 0x38930
movq -0x160(%rbp), %rdi
movl $0x40, %esi
callq 0x52b0
movq -0x80(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3525c
movq -0x58(%rbp), %rsi
movq (%rsi), %rax
movq (%rax), %rax
leaq -0x100(%rbp), %rdi
callq *%rax
movq -0x58(%rbp), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0x120(%rbp), %rdi
callq *%rax
jmp 0x35157
leaq -0xe0(%rbp), %rdi
leaq -0x100(%rbp), %rsi
leaq -0x120(%rbp), %rdx
callq 0x37af0
jmp 0x35173
leaq -0x120(%rbp), %rdi
callq 0x5518
leaq -0x100(%rbp), %rdi
callq 0x5518
movq -0x58(%rbp), %rsi
movq -0x80(%rbp), %rdx
leaq -0x140(%rbp), %rdi
callq 0x37c20
jmp 0x351a1
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
leaq -0xe0(%rbp), %rsi
callq 0x38960
movq %rax, -0x168(%rbp)
jmp 0x351be
movq -0x168(%rbp), %rax
movq -0x140(%rbp), %rcx
movq %rcx, (%rax)
movq -0x138(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq -0xe0(%rbp), %rdi
callq 0x37bf0
leaq -0x38(%rbp), %rdi
callq 0x1c0f0
jmp 0x3500f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
jmp 0x35226
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x5518
leaq -0x100(%rbp), %rdi
callq 0x5518
jmp 0x35269
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x128(%rbp)
movl %eax, -0x12c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x37bf0
jmp 0x35269
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x128(%rbp), %rdi
callq 0x5490
nopw %cs:(%rax,%rax)