// File: /workspace/github_cpp_makefile_star2_O2/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 0x1364e
leaq 0xd893(%rip), %rax      # 0x20c38
movslq (%rax,%rdi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd943(%rip), %rcx      # 0x20d04
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvtsi2sd %r14d, %xmm0
jmp 0x1348d
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd8f5(%rip), %rcx      # 0x20cdc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cvtsi2sd %r14, %xmm0
jmp 0x1348d
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd91f(%rip), %rcx      # 0x20d2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd92b(%rip), %rcx      # 0x20d54
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %r14b, %eax
cvtsi2sd %eax, %xmm0
jmp 0x1348d
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd815(%rip), %rcx      # 0x20c64
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r14, %xmm0
cvttsd2si %xmm0, %eax
movslq %eax, %r14
jmp 0x1364e
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd838(%rip), %rcx      # 0x20cb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl %r14d, %eax
cvtsi2sd %rax, %xmm0
movq %xmm0, %r14
jmp 0x1364e
leal -0x2(%rbx), %eax
cmpl $0x9, %eax
ja 0x1364e
leaq 0xd7e2(%rip), %rcx      # 0x20c8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq %r14d, %r14
jmp 0x1364e
movzbl %r14b, %r14d
jmp 0x1364e
cmpl $0xb, %ebx
jne 0x1364e
movq %r14, %rdi
callq 0x152e4
jmp 0x13626
xorl %eax, %eax
testq %r14, %r14
setne %al
jmp 0x13626
movl %r14d, %r14d
jmp 0x1364e
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x75e6
movq (%r15), %rdi
callq 0x152e4
jmp 0x13642
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x7646
movq (%r15), %rdi
callq 0x152e4
jmp 0x13642
movq %r14, %xmm0
punpckldq 0x9d7c(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x9d84(%rip), %xmm0     # 0x1d2c0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movq %xmm1, %r14
jmp 0x1364e
btrq $0x3f, %r14
movq %r14, %xmm0
xorl %r14d, %r14d
ucomisd 0xd6c9(%rip), %xmm0     # 0x20c30
seta %r14b
jmp 0x1364e
movq %r14, %xmm0
cvttsd2si %xmm0, %r14
jmp 0x1364e
movq %r14, %xmm0
leaq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x7688
movq (%r14), %rdi
callq 0x152e4
jmp 0x13642
movq %r14, %xmm0
cvttsd2si %xmm0, %rax
movl %eax, %r14d
jmp 0x1364e
movq %r14, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xa450(%rip), %xmm0     # 0x1da18
cvttsd2si %xmm0, %r14
andq %rcx, %r14
orq %rax, %r14
jmp 0x1364e
movq %r14, %xmm0
cvttsd2si %xmm0, %eax
movzbl %al, %r14d
jmp 0x1364e
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x5847
movq (%r15), %rdi
callq 0x152e4
jmp 0x13642
testq %r14, %r14
leaq 0x90d8(%rip), %rax      # 0x1c6df
leaq 0x90cc(%rip), %rdi      # 0x1c6da
cmoveq %rax, %rdi
callq 0x152e4
pushq $0x2
popq %rdi
callq 0x4030
movb %r14b, (%rax)
movb $0x0, 0x1(%rax)
movq %rax, %r14
jmp 0x1364e
leaq -0x38(%rbp), %r15
movq %r15, %rdi
movl %r14d, %esi
callq 0x54e9
movq (%r15), %rdi
callq 0x152e4
movq %rax, %r14
leaq -0x38(%rbp), %rdi
callq 0x40e0
movl %ebx, %eax
movq %r14, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x13666
jmp 0x13666
jmp 0x13666
jmp 0x13666
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4340