// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/src/parser/constval.cpp
// Function: ConstValueCast(ConstValue*, DataType)
ConstValue * ConstValueCast(ConstValue * value, DataType dst_type)
{
        switch(dst_type)
        {
                case String:
                        return new StringValue(value->toString());
                break;
                case Decimal:
                        return new DecimalValue(value->toString());
                break;
                case Integer:
                        {
                                string s = value->toString();
                                long value = 0;
                                if(sscanf(s.c_str(), "%ld", &value)==0)
                                {
                                        return NULL;
                                }
                        }

                        return new IntegerValue(value->toString());
                break;
                case Boolean:
                        if(value->GetType()!=Boolean)
                        {
                                string s = value->toString();
                                if(s=="0" || s=="")
                                {
                                        return new BooleanValue(false);
                                }

                                return new BooleanValue(true);
                        }

                        value->DupValue();
                break;
        }

        return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x90, %rsp
decl %esi
cmpl $0x3, %esi
ja 0x9617
movq %rdi, %r14
leaq 0x2bb24(%rip), %rax     # 0x35070
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq (%r14), %rax
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x68(%rsp), %rdx
movq $0x0, (%rdx)
movq (%r15), %rdi
leaq 0x3129b(%rip), %rsi     # 0x3a817
xorl %eax, %eax
callq 0x6240
movl %eax, %ebx
movq (%r15), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x959f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6270
testl %ebx, %ebx
je 0x9617
movl $0x18, %edi
callq 0x6260
movq %rax, %rbx
movq (%r14), %rax
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
callq *0x18(%rax)
movl $0x1, 0x8(%rbx)
leaq 0x3c72c(%rip), %rax     # 0x45cf8
movq %rax, (%rbx)
leaq 0x80(%rsp), %r15
movq -0x10(%r15), %r14
movq %r14, %rdi
callq 0x6350
movq %rax, 0x10(%rbx)
cmpq %r15, %r14
je 0x972e
movq 0x80(%rsp), %rsi
incq %rsi
movq %r14, %rdi
jmp 0x9729
cmpl $0x3, 0x8(%r14)
jne 0x96a6
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
xorl %ebx, %ebx
jmp 0x972e
movl $0x30, %edi
callq 0x6260
movq %rax, %rbx
movq (%r14), %rax
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x7f4c
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x972e
movq 0x58(%rsp), %rsi
jmp 0x9726
movl $0x28, %edi
callq 0x6260
movq %rax, %rbx
movq (%r14), %rax
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x8222
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x972e
movq 0x38(%rsp), %rsi
jmp 0x9726
movq (%r14), %rax
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq *0x18(%rax)
leaq 0x308a5(%rip), %rsi     # 0x39f63
movq %rbx, %rdi
callq 0x60c0
testl %eax, %eax
je 0x96f0
leaq 0x2b94d(%rip), %rsi     # 0x3501e
leaq 0x8(%rsp), %rdi
callq 0x60c0
testl %eax, %eax
je 0x96f0
movl $0x10, %edi
callq 0x6260
movq %rax, %rbx
movb $0x1, %al
jmp 0x96ff
movl $0x10, %edi
callq 0x6260
movq %rax, %rbx
xorl %eax, %eax
movl $0x3, 0x8(%rbx)
leaq 0x3c64b(%rip), %rcx     # 0x45d58
movq %rcx, (%rbx)
movb %al, 0xc(%rbx)
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x972e
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x6270
movq %rbx, %rax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97bd
movq 0x18(%rsp), %rsi
incq %rsi
jmp 0x97b8
movq %rax, %r14
movl $0x18, %esi
jmp 0x97b5
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97a6
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6270
jmp 0x97a6
movq %rax, %r14
leaq 0x58(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x97b0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6270
jmp 0x97b0
movq %rax, %r14
movl $0x28, %esi
jmp 0x97b5
movq %rax, %r14
movl $0x30, %esi
movq %rbx, %rdi
callq 0x6270
movq %r14, %rdi
callq 0x6460
nop