// File: /workspace/github_cpp_makefile_star2_O2/AshOlogn[P]ash-language-interpreter/src/parsetoken.cpp
// Function: toStringParseData(ParseData)
char* toStringParseData(ParseData d) {

  switch(d.type) {

    case INT8_T: {
      int8_t val = (int8_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case INT16_T: {
      int16_t val = (int16_t) d.value.integer;  
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case INT32_T: {
      int32_t val = (int32_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case INT64_T: {
      int64_t val = (int64_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case UINT8_T: {
      uint8_t val = (uint8_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case UINT16_T: {
      uint16_t val = (uint16_t) d.value.integer;  
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case UINT32_T: {
      uint32_t val = (uint32_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case UINT64_T: {
      uint64_t val = (uint64_t) d.value.integer;
      std::string str = std::to_string(val);
      return copyString(str.c_str());
    }

    case CHAR_T: {
      char val = (char) ((uint8_t) d.value.integer);
      char* c = new char[2];
      c[0] = val;
      c[1] = '\0';
      return c; 
    }

    case DOUBLE_T: {
      std::string str = std::to_string((double) d.value.floatingPoint);
      return copyString(str.c_str());
    }
    
    case BOOL_T: {
     
      if(d.value.integer) {
        return copyString("true");
      } else {
        return copyString("false");
      }
    }

    case STRING_T: {
      return copyString((char*) d.value.allocated);
    }

		case ARRAY_T: {

			Array* arr = (Array*) d.value.allocated;
			uint32_t length = arr->length;
			ParseData* values = arr->values;

			std::string str("[");

			if(length > 0)
				str.append(toStringParseData(values[0]));
			
			for(uint32_t i = 1; i < length; i++) {
				str.append(", ");
				str.append(toStringParseData(values[i]));
			}
			str.append("]");

			return copyString(str.c_str());
		}
		
		case VOID_T: {
			return copyString("VOID");
		}

    default: {
      return copyString("INVALID");
    }

  }

  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0xf, %edi
ja 0x755f
movq %rsi, %r14
movl %edi, %eax
leaq 0x15781(%rip), %rcx     # 0x1cb24
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsbl %r14b, %esi
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x5847
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
leaq 0x15c5e(%rip), %rdi     # 0x1d02e
jmp 0x75a6
movq %r14, %xmm0
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x7688
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
movzbl %r14b, %esi
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x5847
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
movl 0x4(%r14), %r15d
movq 0x8(%r14), %r12
leaq 0x15d0e(%rip), %rsi     # 0x1d12d
leaq -0x48(%rbp), %rdi
leaq -0x49(%rbp), %rdx
callq 0x40a0
testq %r15, %r15
je 0x744b
movl (%r12), %edi
movq 0x8(%r12), %rsi
callq 0x737d
leaq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x4360
addq $0x18, %r12
pushq $0x1
popq %r13
leaq 0x15bd1(%rip), %rbx     # 0x1d02b
leaq -0x48(%rbp), %r14
cmpq %r15, %r13
jae 0x7568
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4360
movl -0x8(%r12), %edi
movq (%r12), %rsi
callq 0x737d
movq %r14, %rdi
movq %rax, %rsi
callq 0x4360
incq %r13
addq $0x10, %r12
jmp 0x745e
movzwl %r14w, %esi
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x5847
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
movq %r14, %rdi
jmp 0x75a6
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x75e6
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x5847
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
movswl %r14w, %esi
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x5847
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x54e9
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7646
movq (%rbx), %rdi
callq 0x152e4
jmp 0x7581
testq %r14, %r14
je 0x759f
leaq 0x15191(%rip), %rdi     # 0x1c6da
jmp 0x75a6
pushq $0x2
popq %rdi
callq 0x4030
movq %rax, %rbx
movb %r14b, (%rax)
movb $0x0, 0x1(%rax)
jmp 0x758d
leaq 0x15888(%rip), %rdi     # 0x1cdee
jmp 0x75a6
leaq 0x15403(%rip), %rsi     # 0x1c972
leaq -0x48(%rbp), %rdi
callq 0x4360
movq -0x48(%rbp), %rdi
callq 0x152e4
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x40e0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x15139(%rip), %rdi     # 0x1c6df
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x152e4
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
movq %rax, %rbx
jmp 0x75de
jmp 0x75d2
jmp 0x75d2
jmp 0x75d2
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x40e0
movq %rbx, %rdi
callq 0x4340