// File: /workspace/github_cpp_makefile_star2_O2/marxn[P]pupp/src/parser/operation.cpp
// Function: Operation::AddOperation(ConstValue*, ConstValue*)
ConstValue * Operation::AddOperation(ConstValue * left, ConstValue * right)
{
        ConstValue * result = NULL;
        if(left->GetType()==Integer && right->GetType()==Integer)
        {
                result = new IntegerValue(static_cast<IntegerValue*>(left)->GetValue() + static_cast<IntegerValue*>(right)->GetValue());
        }
        else if(left->GetType()==Integer && right->GetType()==Decimal)
        {
                DecimalValue leftvalue(static_cast<IntegerValue*>(left));
                result = new DecimalValue(leftvalue + *static_cast<DecimalValue*>(right));
        }
        else if(left->GetType()==Decimal && right->GetType()==Integer)
        {
                DecimalValue rightvalue(static_cast<IntegerValue*>(right));
                result = new DecimalValue(*static_cast<DecimalValue*>(left) + rightvalue);
        }
        else if(left->GetType()==Decimal && right->GetType()==Decimal)
        {
                DecimalValue * value1 = static_cast<DecimalValue*>(left);
                DecimalValue * value2 = static_cast<DecimalValue*>(right);

                result = new DecimalValue(*value1 + *value2);        
        }
        else if(left->GetType()==Integer && right->GetType()==String)
        {
                StringValue * rightvalue = static_cast<StringValue*>(right);

                if(rightvalue->LooksLikeInteger())
                {
                        IntegerValue * value1 = static_cast<IntegerValue*>(left);
                        IntegerValue value2(rightvalue->toString());
                        result = new IntegerValue(value1->GetValue() + value2.GetValue());
                }
                else if(rightvalue->LooksLikeDecimal())
                {
                        DecimalValue value1(static_cast<IntegerValue*>(left));
                        DecimalValue value2(rightvalue->toString());

                        result = new DecimalValue(value1 + value2);
                }
                else
                {
                        result = left->DupValue();
                }
        }
        else if(left->GetType()==String && right->GetType()==Integer)
        {
                StringValue * leftvalue = static_cast<StringValue*>(left);
                if(leftvalue->LooksLikeInteger())
                {
                        IntegerValue value1(leftvalue->toString());
                        IntegerValue * value2 = static_cast<IntegerValue*>(right);
                        result = new IntegerValue(value1.GetValue() + value2->GetValue());
                }
                else if(leftvalue->LooksLikeDecimal())
                {
                        DecimalValue value1(leftvalue->toString());
                        DecimalValue value2(static_cast<IntegerValue*>(right));

                        result = new DecimalValue(value1 + value2);
                }
                else
                {
                        result = right->DupValue();
                }
        }
        else if(left->GetType()==Decimal && right->GetType()==String)
        {
                StringValue * rightvalue = static_cast<StringValue*>(right);

                if(rightvalue->LooksLikeInteger())
                {
                        DecimalValue * value1 = static_cast<DecimalValue*>(left);
                        DecimalValue value2(right->toString());

                        result = new DecimalValue(*value1 + value2);
                }
                else if(rightvalue->LooksLikeDecimal())
                {
                        DecimalValue * value1 = static_cast<DecimalValue*>(left);

                        DecimalValue value2(right->toString());
                        result = new DecimalValue(*value1 + value2);
                }
                else
                {
                        result = left->DupValue();
                }
        }
        else if(left->GetType()==String && right->GetType()==Decimal)
        {
                StringValue * leftvalue = static_cast<StringValue*>(left);

                if(leftvalue->LooksLikeInteger())
                {
                        DecimalValue value1(left->toString());

                        DecimalValue * value2 = static_cast<DecimalValue*>(right);
                        result = new DecimalValue(value1 + *value2);
                }
                else if(leftvalue->LooksLikeDecimal())
                {
                        DecimalValue value1(leftvalue->toString());

                        DecimalValue * value2 = static_cast<DecimalValue*>(right);

                        result = new DecimalValue(value1 + *value2);
                }
                else
                {
                        result = right->DupValue();
                }
        }
        else if(left->GetType()==String && right->GetType()==String)
        {
                result = new StringValue(left->toString() + right->toString());
        }
        else
        {
                result = new NullValue;
        }
        return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rsi, %r14
movq %rdi, %r15
callq 0x6cbc
cmpl $0x1, %eax
jne 0xbe9e
movq %r14, %rdi
callq 0x6cbc
cmpl $0x1, %eax
jne 0xbe9e
pushq $0x18
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %r15, %rdi
callq 0x6fe4
movq %rax, %r15
movq %r14, %rdi
callq 0x6fe4
addq %r15, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6f90
jmp 0xc1f2
movq %r15, %rdi
callq 0x6cbc
cmpl $0x1, %eax
jne 0xbede
movq %r14, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xbede
movq %rsp, %rdi
movq %r15, %rsi
callq 0x713a
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x7254
jmp 0xbf1c
movq %r15, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xbf29
movq %r14, %rdi
callq 0x6cbc
cmpl $0x1, %eax
jne 0xbf29
movq %rsp, %rdi
movq %r14, %rsi
callq 0x713a
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x7254
movq %rsp, %rdi
callq 0x71e2
jmp 0xc1f2
movq %r15, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xbf61
movq %r14, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xbf61
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x7254
jmp 0xc1f2
movq %r15, %rdi
callq 0x6cbc
cmpl $0x1, %eax
jne 0xbfe8
movq %r14, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xbfe8
movq %r14, %rdi
callq 0x6ed4
testb %al, %al
je 0xc202
movq (%r14), %rax
leaq 0x150(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x6fa6
leaq 0x150(%rsp), %rdi
callq 0x6130
pushq $0x18
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %r15, %rdi
callq 0x6fe4
movq %rax, %r14
movq %rsp, %rdi
callq 0x6fe4
addq %r14, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6f90
jmp 0xc06e
movq %r15, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xc07b
movq %r14, %rdi
callq 0x6cbc
cmpl $0x1, %eax
jne 0xc07b
movq %r15, %rdi
callq 0x6ed4
testb %al, %al
je 0xc261
movq (%r15), %rax
leaq 0x130(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x6fa6
leaq 0x130(%rsp), %rdi
callq 0x6130
pushq $0x18
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6fe4
movq %rax, %r15
movq %r14, %rdi
callq 0x6fe4
addq %r15, %rax
movq %rbx, %rdi
movq %rax, %rsi
callq 0x6f90
movq %rsp, %rdi
callq 0x817e
jmp 0xc1f2
movq %r15, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xc0ef
movq %r14, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xc0ef
movq %r14, %rdi
callq 0x6ed4
testb %al, %al
je 0xc2d4
movq (%r14), %rax
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7098
leaq 0xf0(%rsp), %rdi
callq 0x6130
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x7254
jmp 0xbf1c
movq %r15, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xc163
movq %r14, %rdi
callq 0x6cbc
cmpl $0x2, %eax
jne 0xc163
movq %r15, %rdi
callq 0x6ed4
testb %al, %al
je 0xc332
movq (%r15), %rax
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7098
leaq 0xb0(%rsp), %rdi
callq 0x6130
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x7254
jmp 0xbf1c
movq %r15, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xc1df
movq %r14, %rdi
callq 0x6cbc
cmpl $0x4, %eax
jne 0xc1df
pushq $0x30
popq %rdi
callq 0x6260
movq %rax, %rbx
movq (%r15), %rax
movq %rsp, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq (%r14), %rax
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x50(%rsp), %rdi
movq %rsp, %rsi
leaq 0x28(%rsp), %rdx
callq 0x1067f
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0x6e18
leaq 0x50(%rsp), %rdi
callq 0x6130
leaq 0x28(%rsp), %rdi
callq 0x6130
movq %rsp, %rdi
callq 0x6130
jmp 0xc1f2
pushq $0x10
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rax, %rdi
callq 0x6da8
movq %rbx, %rax
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x6f42
testb %al, %al
je 0xc32a
movq %rsp, %rdi
movq %r15, %rsi
callq 0x713a
movq (%r14), %rax
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0x7098
leaq 0x70(%rsp), %rdi
callq 0x6130
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rsi
leaq 0x28(%rsp), %rdx
movq %rax, %rdi
callq 0x7254
jmp 0xc2c5
movq %r15, %rdi
callq 0x6f42
testb %al, %al
je 0xc388
movq (%r15), %rax
leaq 0x110(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7098
leaq 0x110(%rsp), %rdi
callq 0x6130
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq 0x713a
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rsi
leaq 0x28(%rsp), %rdx
movq %rax, %rdi
callq 0x7254
leaq 0x28(%rsp), %rdi
callq 0x71e2
jmp 0xbf1c
movq %r14, %rdi
callq 0x6f42
testb %al, %al
je 0xc32a
movq (%r14), %rax
leaq 0xd0(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7098
leaq 0xd0(%rsp), %rdi
callq 0x6130
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x7254
jmp 0xbf1c
movq (%r15), %rax
movq %r15, %rdi
jmp 0xc38e
movq %r15, %rdi
callq 0x6f42
testb %al, %al
je 0xc388
movq (%r15), %rax
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq *0x18(%rax)
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x7098
leaq 0x90(%rsp), %rdi
callq 0x6130
pushq $0x28
popq %rdi
callq 0x6260
movq %rax, %rbx
movq %rsp, %rsi
movq %rax, %rdi
movq %r14, %rdx
callq 0x7254
jmp 0xbf1c
movq (%r14), %rax
movq %r14, %rdi
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r14
popq %r15
jmpq *0x10(%rax)
jmp 0xc4d8
jmp 0xc4e8
movq %rax, %r14
leaq 0x90(%rsp), %rdi
jmp 0xc4a5
jmp 0xc4d8
jmp 0xc4e8
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
jmp 0xc4a5
jmp 0xc404
jmp 0xc414
jmp 0xc4e8
movq %rax, %r14
leaq 0x110(%rsp), %rdi
jmp 0xc4a5
jmp 0xc4d8
jmp 0xc4e8
movq %rax, %r14
leaq 0xb0(%rsp), %rdi
jmp 0xc4a5
movq %rax, %r14
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x6270
jmp 0xc417
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x71e2
jmp 0xc4eb
movq %rax, %r14
leaq 0x70(%rsp), %rdi
callq 0x6130
jmp 0xc4eb
jmp 0xc4e8
jmp 0xc4d8
jmp 0xc4e8
movq %rax, %r14
leaq 0xf0(%rsp), %rdi
jmp 0xc4a5
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x6130
jmp 0xc466
movq %rax, %r14
leaq 0x28(%rsp), %rdi
callq 0x6130
jmp 0xc475
movq %rax, %r14
movq %rsp, %rdi
callq 0x6130
jmp 0xc482
movq %rax, %r14
pushq $0x30
jmp 0xc4fa
jmp 0xc495
movq %rax, %r14
leaq 0x130(%rsp), %rdi
jmp 0xc4a5
movq %rax, %r14
jmp 0xc4ca
movq %rax, %r14
leaq 0x150(%rsp), %rdi
callq 0x6130
jmp 0xc503
movq %rax, %r14
pushq $0x10
jmp 0xc4fa
jmp 0xc4bc
movq %rax, %r14
pushq $0x28
jmp 0xc4fa
movq %rax, %r14
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x6270
movq %rsp, %rdi
callq 0x817e
jmp 0xc503
jmp 0xc4d8
jmp 0xc4e8
movq %rax, %r14
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x6270
jmp 0xc4eb
movq %rax, %r14
movq %rsp, %rdi
callq 0x71e2
jmp 0xc503
movq %rax, %r14
pushq $0x18
popq %rsi
movq %rbx, %rdi
callq 0x6270
movq %r14, %rdi
callq 0x6460
nop