// File: /workspace/github_cpp_makefile_star2_O1/ConsoleTVs[P]VirtualMachine/src/values.cpp
// Function: VM::Value::to_string[abi:cxx11]()
std::string Value::to_string()
{
    switch (this->type) {
        case VALUE_INTEGER: { return std::to_string(this->ivalue); }
        case VALUE_FLOAT: { return std::to_string(this->fvalue); }
        case VALUE_BOOLEAN: { return std::to_string(this->bvalue ? 1 : 0); }
        case VALUE_STRING: { return *this->svalue; }
        case VALUE_LIST: {
            // Printing a list is a bit more elaborate :)
            std::string result = "[";

            for (auto element : *this->lvalue) {
                result += element->to_string() + ", ";
            }

            // This will pop the last ',' and the ' '
            result.pop_back(); result.pop_back();

            return result + "]";
        }
        default: { printf("Error converting value to int.\n"); }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movzbl (%rsi), %eax
cmpq $0x4, %rax
ja 0x29e5
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa2e(%rip), %rcx       # 0x31a8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x8(%r14), %ebx
movl %ebx, %ebp
negl %ebp
cmovsl %ebx, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x29a7
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x299e
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x29a4
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x29a7
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x27aa
addl $-0x3, %r14d
jmp 0x29a7
movq %r15, 0x20(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x9bb(%rip), %rsi       # 0x31bc
leaq 0x9b5(%rip), %rdx       # 0x31bd
leaq 0x28(%rsp), %rdi
callq 0x1c78
movq 0x8(%r14), %rax
movq (%rax), %r13
movq 0x8(%rax), %rbx
cmpq %rbx, %r13
je 0x28d3
leaq 0x10(%rsp), %rbp
leaq 0x48(%rsp), %r14
leaq 0x987(%rip), %r15       # 0x31be
leaq 0x28(%rsp), %r12
movq (%r13), %rsi
movq %r14, %rdi
callq 0x2752
movq %r14, %rdi
movq %r15, %rsi
callq 0x1150
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2874
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x287b
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x1040
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28b2
callq 0x10b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x28c6
callq 0x10b0
addq $0x8, %r13
cmpq %rbx, %r13
jne 0x283c
leaq 0x28(%rsp), %r14
movq %r14, %rdi
callq 0x10f0
movq %r14, %rdi
callq 0x10f0
movq 0x20(%rsp), %r15
leaq 0x10(%r15), %rbx
movq %rbx, (%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x2b62
leaq 0x8b4(%rip), %rsi       # 0x31c1
movq %r15, %rdi
callq 0x1150
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x29d3
callq 0x10b0
jmp 0x29d3
movzbl 0x8(%r14), %ebp
leaq 0x10(%r15), %rax
movq %rax, (%r15)
movl $0x1, %esi
movq %r15, %rdi
movl $0x2d, %edx
callq 0x10e0
movq (%r15), %rdi
movl $0x1, %esi
jmp 0x29cc
movq 0x8(%r14), %rax
leaq 0x10(%r15), %rcx
movq %rcx, (%r15)
movq (%rax), %rsi
movq 0x8(%rax), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x2b62
jmp 0x29d3
cvtss2sd 0x8(%r14), %xmm0
movq 0x2652(%rip), %rsi      # 0x4fd8
leaq 0x836(%rip), %rcx       # 0x31c3
movl $0x3a, %edx
movq %r15, %rdi
movb $0x1, %al
callq 0x2ab1
jmp 0x29d3
addl $-0x2, %r14d
jmp 0x29a7
decl %r14d
shrl $0x1f, %ebx
movl %ebx, %esi
addl %r14d, %esi
leaq 0x10(%r15), %rax
movq %rax, (%r15)
movq %r15, %rdi
movl $0x2d, %edx
callq 0x10e0
movq (%r15), %rdi
addq %rbx, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x2a44
movq %r15, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x11b0
movq %rax, %r14
movq (%r15), %rdi
cmpq %rbx, %rdi
jne 0x2a23
jmp 0x2a28
jmp 0x29f9
movq %rax, %r14
jmp 0x2a28
movq %rax, %r14
jmp 0x2a14
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x2a14
callq 0x10b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x2a28
callq 0x10b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2a3c
callq 0x10b0
movq %r14, %rdi
callq 0x1130