// File: /workspace/github_cpp_makefile_star2_O3/AshOlogn[P]ash-language-interpreter/src/casteval.cpp
// Function: castHelper(ParseData, ParseDataType)
ParseData castHelper(ParseData orig, ParseDataType finalType) {
  
  ParseDataType origType = orig.type;
  ParseData d;
  d.type = finalType;
  
  switch(origType) {
        
		case ARRAY_T: {
			if(finalType == ARRAY_T)
				d.value.allocated = orig.value.allocated;
			break;
		}
    
    case BOOL_T: {
      
      switch(finalType) {
        case BOOL_T: d.value.integer = orig.value.integer; break;
        case CHAR_T: d.value.integer = (unsigned char) orig.value.integer; break;
        case INT32_T: d.value.integer = (int32_t) orig.value.integer; break;
        case INT64_T: d.value.integer = (int64_t) orig.value.integer; break;
        case UINT32_T: d.value.integer = (uint32_t) orig.value.integer; break;
        case UINT64_T: d.value.integer = (uint64_t) orig.value.integer; break;
        case DOUBLE_T: d.value.floatingPoint = (double) orig.value.integer; break;
        case STRING_T: {
          d.value.allocated = (void*) copyString((orig.value.integer) ? "true" : "false");
          break;
        }
      } 
    }
    
    case CHAR_T: {
      switch(finalType) {
        case BOOL_T: d.value.integer = (orig.value.integer) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((unsigned char) orig.value.integer); break;
        case INT32_T: d.value.integer = (int32_t) ((unsigned char) orig.value.integer); break;
        case INT64_T: d.value.integer = (int64_t) ((unsigned char) orig.value.integer); break;
        case UINT32_T: d.value.integer = (uint32_t) ((unsigned char) orig.value.integer); break;
        case UINT64_T: d.value.integer = (uint64_t) ((unsigned char) orig.value.integer); break;
        case DOUBLE_T: d.value.floatingPoint = (double) ((unsigned char) orig.value.integer); break;
        case STRING_T: {
          char* res = new char[2];
          res[0] = (unsigned char) orig.value.integer;
          res[1] = '\0';
          d.value.allocated = (void*) res;
          break;
        }
      }
      break;
    }
    
    case INT32_T: {
      switch(finalType) {
        case BOOL_T: d.value.integer = (orig.value.integer) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((int32_t) orig.value.integer); break;
        case INT32_T: d.value.integer = (int32_t) orig.value.integer; break;
        case INT64_T: d.value.integer = (int64_t) ((int32_t) orig.value.integer); break;
        case UINT32_T: d.value.integer = (uint32_t) ((int32_t) orig.value.integer); break;
        case UINT64_T: d.value.integer = (uint64_t) ((int32_t) orig.value.integer); break;
        case DOUBLE_T: d.value.floatingPoint = (double) ((int32_t) orig.value.integer); break;
        case STRING_T: {
          d.value.allocated = (void*) copyString(std::to_string((int32_t) orig.value.integer).c_str());
          break;
        }
      }
      break;
    }
    
    case INT64_T: {
      switch(finalType) {
        case BOOL_T: d.value.integer = (orig.value.integer) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((int64_t) orig.value.integer); break;
        case INT32_T: d.value.integer = (int32_t) ((int64_t) orig.value.integer); break;
        case INT64_T: d.value.integer = (int64_t) ((int64_t) orig.value.integer); break;
        case UINT32_T: d.value.integer = (uint32_t) ((int64_t) orig.value.integer); break;
        case UINT64_T: d.value.integer = (uint64_t) ((int64_t) orig.value.integer); break;
        case DOUBLE_T: d.value.floatingPoint = (double) ((int64_t) orig.value.integer); break;
        case STRING_T: {
          d.value.allocated = (void*) copyString(std::to_string((int64_t) orig.value.integer).c_str());
          break;
        }
      }
      break;
    }
    
    case UINT32_T: {
      switch(finalType) {
        case BOOL_T: d.value.integer = (orig.value.integer) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((uint32_t) orig.value.integer); break;
        case INT32_T: d.value.integer = (int32_t) orig.value.integer; break;
        case INT64_T: d.value.integer = (int64_t) ((uint32_t) orig.value.integer); break;
        case UINT32_T: d.value.integer = (uint32_t) ((uint32_t) orig.value.integer); break;
        case UINT64_T: d.value.integer = (uint64_t) ((uint32_t) orig.value.integer); break;
        case DOUBLE_T: d.value.floatingPoint = (double) ((uint32_t) orig.value.integer); break;
        case STRING_T: {
          d.value.allocated = (void*) copyString(std::to_string((uint32_t) orig.value.integer).c_str());
          break;
        }
      }
      break;
    }
    
    case UINT64_T: {
      switch(finalType) {
        case BOOL_T: d.value.integer = (orig.value.integer) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((uint64_t) orig.value.integer); break;
        case INT32_T: d.value.integer = (int32_t) ((uint64_t) orig.value.integer); break;
        case INT64_T: d.value.integer = (int64_t) ((uint64_t) orig.value.integer); break;
        case UINT32_T: d.value.integer = (uint32_t) ((uint64_t) orig.value.integer); break;
        case UINT64_T: d.value.integer = (uint64_t) ((uint64_t) orig.value.integer); break;
        case DOUBLE_T: d.value.floatingPoint = (double) ((uint64_t) orig.value.integer); break;
        case STRING_T: {
          d.value.allocated = (void*) copyString(std::to_string((uint64_t) orig.value.integer).c_str());
          break;
        }
      }
      break;
    }
    
    case DOUBLE_T: {
      
      switch(finalType) {
        case BOOL_T: d.value.integer = (std::abs((double) orig.value.floatingPoint) > 1.0e-16) ? 1 : 0; break;
        case CHAR_T: d.value.integer = (unsigned char) ((double) orig.value.floatingPoint); break;  
        case INT32_T: d.value.integer = (int32_t) ((double) orig.value.floatingPoint); break; 
        case INT64_T: d.value.integer = (int64_t) ((double) orig.value.floatingPoint); break; 
        case UINT32_T: d.value.integer = (uint32_t) ((double) orig.value.floatingPoint); break; 
        case UINT64_T: d.value.integer = (uint64_t) ((double) orig.value.floatingPoint); break; 
        case DOUBLE_T: d.value.floatingPoint = orig.value.floatingPoint; break;
        case STRING_T: {
          d.value.allocated = (void*) copyString(std::to_string((double) orig.value.floatingPoint).c_str());
          break;
        }
      }
      break;
    }
    
    case STRING_T: {
      if(finalType == STRING_T) {
        d.value.allocated = (void*) copyString((char*) orig.value.allocated);
      }
      
      break;
    }
    
  }
  
  return d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edx, %ebx
movq %rsi, %r14
addl $-0x2, %edi
cmpl $0xa, %edi
ja 0x15385
leaq 0xdb7f(%rip), %rax      # 0x22c38
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdc2f(%rip), %rcx      # 0x22d04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvtsi2sd %r14d, %xmm0
jmp 0x151a1
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdbe1(%rip), %rcx      # 0x22cdc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvtsi2sd %r14, %xmm0
jmp 0x151a1
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdc0b(%rip), %rcx      # 0x22d2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdc17(%rip), %rcx      # 0x22d54
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %r14b, %eax
cvtsi2sd %eax, %xmm0
jmp 0x151a1
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdb01(%rip), %rcx      # 0x22c64
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %r14
jmp 0x15385
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdb24(%rip), %rcx      # 0x22cb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
movq %xmm0, %r14
jmp 0x15385
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x15385
leaq 0xdace(%rip), %rcx      # 0x22c8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq %r14d, %r14
jmp 0x15385
movzbl %r14b, %r14d
jmp 0x15385
cmpl $0xb, %ebx
jne 0x15385
movq %r14, %rdi
callq 0x175e8
jmp 0x15354
xorl %eax, %eax
testq %r14, %r14
setne %al
jmp 0x15354
movl %r14d, %r14d
jmp 0x15385
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x1548b
movq (%r15), %rdi
callq 0x175e8
jmp 0x15370
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x155c4
movq (%r15), %rdi
callq 0x175e8
jmp 0x15370
movq %r14, %xmm0
punpckldq 0xa068(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0xa070(%rip), %xmm0     # 0x1f2c0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %xmm1, %r14
jmp 0x15385
btrq $0x3f, %r14
movq %r14, %xmm0
xorl %r14d, %r14d
ucomisd 0xd9b5(%rip), %xmm0     # 0x22c30
seta %r14b
jmp 0x15385
movq %r14, %xmm0
cvttsd2si %xmm0, %r14
jmp 0x15385
movq %r14, %xmm0
movq 0x16d19(%rip), %rsi     # 0x2bfb8
leaq 0x9dad(%rip), %rcx      # 0x1f053
leaq -0x38(%rbp), %r14
movl $0x148, %edx            # imm = 0x148
movq %r14, %rdi
movb $0x1, %al
callq 0x88c9
movq (%r14), %rdi
callq 0x175e8
jmp 0x15370
movq %r14, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %r14d
jmp 0x15385
movq %r14, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xa727(%rip), %xmm0     # 0x1fa18
cvttsd2si %xmm0, %r14
andq %rcx, %r14
orq %rax, %r14
jmp 0x15385
movq %r14, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %r14d
jmp 0x15385
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x153e1
movq (%r15), %rdi
callq 0x175e8
jmp 0x15370
testq %r14, %r14
leaq 0x93cc(%rip), %rax      # 0x1e6ff
leaq 0x93c0(%rip), %rdi      # 0x1e6fa
cmoveq %rax, %rdi
callq 0x175e8
movl $0x2, %edi
callq 0x4030
movb %r14b, (%rax)
movb $0x0, 0x1(%rax)
movq %rax, %r14
jmp 0x15385
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x1553f
movq (%r15), %rdi
callq 0x175e8
movq %rax, %r14
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15385
callq 0x41e0
movl %ebx, %eax
movq %r14, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1539d
jmp 0x1539d
jmp 0x1539d
jmp 0x1539d
movq %rax, %rbx
leaq -0x28(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x153b2
callq 0x41e0
movq %rbx, %rdi
callq 0x4380