// File: marxn[P]pupp/src/parser/expression.cpp
// Function: SetExpression::Calculate(NodeContext*)
ConstValue * SetExpression::Calculate(NodeContext * context)
{
        long index = 0;
        MapValue * result = new MapValue;
        list<KVValue*> tobedone;

        list<Expression*>::iterator i;
        for(i = this->ExprList->begin(); i!=this->ExprList->end(); i++)
        {
                ConstValue * value = (*i)->Calculate(context);
                if(value->GetType()==KeyValue)
                {
                        tobedone.push_back(static_cast<KVValue*>(value));
                }
                else
                {
                        IntegerValue * key = new IntegerValue(index);
                        ValueBox * vb = new ValueBox(value);

                        KVValue * kv = new KVValue(key, vb);
                        result->AddKV(kv);

                        vb->Destroy();
                        delete kv;
                        delete key;
                        delete value;
                        index++;
                }
        }

        list<KVValue*>::iterator j;
        for(j = tobedone.begin(); j!=tobedone.end(); j++)
        {
                KVValue * value = *j;
                result->AddKV(value);
                delete value;
        }

        return result;
}

// Assembly:
subq $0x118, %rsp            # imm = 0x118
movq %rdi, 0x110(%rsp)
movq %rsi, 0x108(%rsp)
movq 0x110(%rsp), %rax
movq %rax, 0x50(%rsp)
movq $0x0, 0x100(%rsp)
movl $0x40, %edi
callq 0x62f0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, 0x58(%rsp)
callq 0x91d0
jmp 0xdeec
movq 0x58(%rsp), %rax
movq %rax, 0xf8(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x11260
leaq 0xc8(%rsp), %rdi
callq 0x11270
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x11290
movq %rax, 0xc0(%rsp)
movq 0xc0(%rsp), %rax
movq %rax, 0xc8(%rsp)
movq 0x50(%rsp), %rax
movq 0x18(%rax), %rdi
callq 0x112e0
movq %rax, 0xb8(%rsp)
leaq 0xc8(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0x112c0
testb $0x1, %al
jne 0xdf6d
jmp 0xe1f5
leaq 0xc8(%rsp), %rdi
callq 0x11310
movq (%rax), %rdi
movq 0x108(%rsp), %rsi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq %rax, 0x48(%rsp)
jmp 0xdf95
movq 0x48(%rsp), %rax
movq %rax, 0xb0(%rsp)
movq 0xb0(%rsp), %rdi
callq 0x7870
movl %eax, 0x44(%rsp)
jmp 0xdfb5
movl 0x44(%rsp), %eax
cmpl $0x5, %eax
jne 0xe02b
movq 0xb0(%rsp), %rax
movq %rax, 0xa8(%rsp)
leaq 0xd0(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x11340
jmp 0xdfe5
jmp 0xe1d7
movq 0x58(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
movl $0x40, %esi
callq 0x6300
jmp 0xe2dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
jmp 0xe2cf
movl $0x18, %edi
callq 0x62f0
movq %rax, 0x38(%rsp)
jmp 0xe03c
movq 0x38(%rsp), %rdi
movq 0x100(%rsp), %rsi
callq 0x7eb0
jmp 0xe050
movq 0x38(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl $0x10, %edi
callq 0x62f0
movq %rax, 0x30(%rsp)
jmp 0xe06e
movq 0x30(%rsp), %rdi
movq 0xb0(%rsp), %rsi
callq 0x78a0
jmp 0xe082
movq 0x30(%rsp), %rax
movq %rax, 0x98(%rsp)
movl $0x20, %edi
callq 0x62f0
movq %rax, 0x28(%rsp)
jmp 0xe0a0
movq 0x28(%rsp), %rdi
movq 0xa0(%rsp), %rsi
movq 0x98(%rsp), %rdx
callq 0x8e80
jmp 0xe0bc
movq 0x28(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xf8(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x94d0
jmp 0xe0e0
movq 0x98(%rsp), %rdi
callq 0x7970
jmp 0xe0ef
movq 0x90(%rsp), %rax
movq %rax, 0x20(%rsp)
cmpq $0x0, %rax
je 0xe10d
movq 0x20(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xa0(%rsp), %rax
movq %rax, 0x18(%rsp)
cmpq $0x0, %rax
je 0xe12b
movq 0x18(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0xb0(%rsp), %rax
movq %rax, 0x10(%rsp)
cmpq $0x0, %rax
je 0xe149
movq 0x10(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x100(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x100(%rsp)
jmp 0xe1d7
movq 0x38(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
movl $0x18, %esi
callq 0x6300
jmp 0xe2cf
movq 0x30(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
movl $0x10, %esi
callq 0x6300
jmp 0xe2cf
movq 0x28(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xf0(%rsp)
movl %eax, 0xec(%rsp)
movl $0x20, %esi
callq 0x6300
jmp 0xe2cf
jmp 0xe1d9
leaq 0xc8(%rsp), %rdi
xorl %esi, %esi
callq 0x11380
movq %rax, 0x88(%rsp)
jmp 0xdf39
leaq 0x80(%rsp), %rdi
callq 0x113b0
leaq 0xd0(%rsp), %rdi
callq 0x113d0
movq %rax, 0x78(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x80(%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x11420
movq %rax, 0x70(%rsp)
leaq 0x80(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x11400
testb $0x1, %al
jne 0xe24b
jmp 0xe2aa
leaq 0x80(%rsp), %rdi
callq 0x11450
movq (%rax), %rax
movq %rax, 0x68(%rsp)
movq 0xf8(%rsp), %rdi
movq 0x68(%rsp), %rsi
callq 0x94d0
jmp 0xe274
movq 0x68(%rsp), %rax
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
je 0xe28f
movq 0x8(%rsp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0xe291
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
callq 0x11470
movq %rax, 0x60(%rsp)
jmp 0xe221
movq 0xf8(%rsp), %rax
movq %rax, (%rsp)
leaq 0xd0(%rsp), %rdi
callq 0x114a0
movq (%rsp), %rax
addq $0x118, %rsp            # imm = 0x118
retq
leaq 0xd0(%rsp), %rdi
callq 0x114a0
movq 0xf0(%rsp), %rdi
callq 0x6550
nopl (%rax)