// File: 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
subq $0x2c0, %rsp            # imm = 0x2C0
movl %edi, -0x18(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x18(%rbp), %eax
movq %rax, -0x208(%rbp)
subq $0xf, %rax
ja 0xc597
movq -0x208(%rbp), %rax
leaq 0x340a0(%rip), %rcx     # 0x3ffb4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movb -0x10(%rbp), %al
movb %al, -0x19(%rbp)
movsbl -0x19(%rbp), %esi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x218(%rbp)
callq 0x7570
movq -0x218(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x210(%rbp)
jmp 0xbf54
movq -0x210(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movw -0x10(%rbp), %ax
movw %ax, -0x4e(%rbp)
movswl -0x4e(%rbp), %esi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x7570
movq -0x228(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x220(%rbp)
jmp 0xbfc0
movq -0x220(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movl -0x10(%rbp), %eax
movl %eax, -0x74(%rbp)
movl -0x74(%rbp), %esi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x7570
movq -0x238(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x230(%rbp)
jmp 0xc02c
movq -0x230(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0xc600
movq -0x248(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x240(%rbp)
jmp 0xc0a7
movq -0x240(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movb -0x10(%rbp), %al
movb %al, -0xc1(%rbp)
movzbl -0xc1(%rbp), %esi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x258(%rbp)
callq 0x7570
movq -0x258(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x250(%rbp)
jmp 0xc120
movq -0x250(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movw -0x10(%rbp), %ax
movw %ax, -0xea(%rbp)
movzwl -0xea(%rbp), %esi
leaq -0x110(%rbp), %rdi
movq %rdi, -0x268(%rbp)
callq 0x7570
movq -0x268(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x260(%rbp)
jmp 0xc19b
movq -0x260(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movl -0x10(%rbp), %eax
movl %eax, -0x114(%rbp)
movl -0x114(%rbp), %esi
leaq -0x138(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x6e40
movq -0x278(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x270(%rbp)
jmp 0xc213
movq -0x270(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movq -0x10(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x140(%rbp), %rsi
leaq -0x160(%rbp), %rdi
movq %rdi, -0x288(%rbp)
callq 0xc730
movq -0x288(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x280(%rbp)
jmp 0xc28e
movq -0x280(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movq -0x10(%rbp), %rax
movb %al, -0x161(%rbp)
movl $0x2, %edi
callq 0x4030
movq %rax, -0x170(%rbp)
movb -0x161(%rbp), %cl
movq -0x170(%rbp), %rax
movb %cl, (%rax)
movq -0x170(%rbp), %rax
movb $0x0, 0x1(%rax)
movq -0x170(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xc5a7
movsd -0x10(%rbp), %xmm0
leaq -0x190(%rbp), %rdi
movq %rdi, -0x298(%rbp)
callq 0xc810
movq -0x298(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x290(%rbp)
jmp 0xc341
movq -0x290(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
cmpq $0x0, -0x10(%rbp)
je 0xc396
leaq 0x3351e(%rip), %rdi     # 0x3f8a6
callq 0x2fb10
movq %rax, -0x8(%rbp)
jmp 0xc5a7
leaq 0x3350e(%rip), %rdi     # 0x3f8ab
callq 0x2fb10
movq %rax, -0x8(%rbp)
jmp 0xc5a7
movq -0x10(%rbp), %rdi
callq 0x2fb10
movq %rax, -0x8(%rbp)
jmp 0xc5a7
movq -0x10(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x198(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x19c(%rbp)
movq -0x198(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x1a8(%rbp)
leaq -0x1c9(%rbp), %rdi
movq %rdi, -0x2a0(%rbp)
callq 0x4430
movq -0x2a0(%rbp), %rdx
leaq 0x33f62(%rip), %rsi     # 0x4036d
leaq -0x1c8(%rbp), %rdi
callq 0x4350
jmp 0xc419
leaq -0x1c9(%rbp), %rdi
callq 0x4290
cmpl $0x0, -0x19c(%rbp)
jbe 0xc4ab
movq -0x1a8(%rbp), %rax
movups (%rax), %xmm0
movaps %xmm0, -0x1e0(%rbp)
movl -0x1e0(%rbp), %edi
movq -0x1d8(%rbp), %rsi
callq 0xbee0
movq %rax, -0x2a8(%rbp)
jmp 0xc45a
movq -0x2a8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x4460
jmp 0xc46f
jmp 0xc4ab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1c9(%rbp), %rdi
callq 0x4290
jmp 0xc5b4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x4170
jmp 0xc5b4
movl $0x1, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
cmpl -0x19c(%rbp), %eax
jae 0xc53a
leaq 0x33da1(%rip), %rsi     # 0x4026b
leaq -0x1c8(%rbp), %rdi
callq 0x4460
jmp 0xc4d8
movq -0x1a8(%rbp), %rax
movl -0x1e4(%rbp), %ecx
shlq $0x4, %rcx
movups (%rax,%rcx), %xmm0
movaps %xmm0, -0x200(%rbp)
movl -0x200(%rbp), %edi
movq -0x1f8(%rbp), %rsi
callq 0xbee0
movq %rax, -0x2b0(%rbp)
jmp 0xc50f
movq -0x2b0(%rbp), %rsi
leaq -0x1c8(%rbp), %rdi
callq 0x4460
jmp 0xc524
jmp 0xc526
movl -0x1e4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1e4(%rbp)
jmp 0xc4b5
leaq 0x33655(%rip), %rsi     # 0x3fb96
leaq -0x1c8(%rbp), %rdi
callq 0x4460
jmp 0xc54f
leaq -0x1c8(%rbp), %rdi
callq 0x40e0
movq %rax, %rdi
callq 0x2fb10
movq %rax, -0x2b8(%rbp)
jmp 0xc56c
movq -0x2b8(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x4170
jmp 0xc5a7
leaq 0x33ce2(%rip), %rdi     # 0x4026e
callq 0x2fb10
movq %rax, -0x8(%rbp)
jmp 0xc5a7
leaq 0x33a90(%rip), %rdi     # 0x4002e
callq 0x2fb10
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2c0, %rsp            # imm = 0x2C0
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x4420
nopl (%rax)