// File: /workspace/github_cpp_makefile_star2_O3/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 0x28c9
movq %rsi, %r14
movq %rdi, %r15
leaq 0xb4a(%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 0x288b
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x2882
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x2888
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x288b
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x268e
addl $-0x3, %r14d
jmp 0x288b
movq %r15, 0x20(%rsp)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xad7(%rip), %rsi       # 0x31bc
leaq 0xad1(%rip), %rdx       # 0x31bd
leaq 0x28(%rsp), %rdi
callq 0x1bc2
movq 0x8(%r14), %rax
movq (%rax), %r13
movq 0x8(%rax), %rbx
cmpq %rbx, %r13
je 0x27b7
leaq 0x10(%rsp), %rbp
leaq 0x48(%rsp), %r14
leaq 0xaa3(%rip), %r15       # 0x31be
leaq 0x28(%rsp), %r12
movq (%r13), %rsi
movq %r14, %rdi
callq 0x2636
movq %r14, %rdi
movq %r15, %rsi
callq 0x1150
movq %rbp, (%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x2758
movq %rdx, (%rsp)
movq (%rcx), %rdx
movq %rdx, 0x10(%rsp)
jmp 0x275f
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 0x2796
callq 0x10b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x27aa
callq 0x10b0
addq $0x8, %r13
cmpq %rbx, %r13
jne 0x2720
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 0x2a46
leaq 0x9d0(%rip), %rsi       # 0x31c1
movq %r15, %rdi
callq 0x1150
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x28b7
callq 0x10b0
jmp 0x28b7
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 0x28b0
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 0x2a46
jmp 0x28b7
cvtss2sd 0x8(%r14), %xmm0
movq 0x276e(%rip), %rsi      # 0x4fd8
leaq 0x952(%rip), %rcx       # 0x31c3
movl $0x3a, %edx
movq %r15, %rdi
movb $0x1, %al
callq 0x2995
jmp 0x28b7
addl $-0x2, %r14d
jmp 0x288b
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 0x2928
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 0x2907
jmp 0x290c
jmp 0x28dd
movq %rax, %r14
jmp 0x290c
movq %rax, %r14
jmp 0x28f8
movq %rax, %r14
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x28f8
callq 0x10b0
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x290c
callq 0x10b0
movq 0x28(%rsp), %rdi
leaq 0x38(%rsp), %rax
cmpq %rax, %rdi
je 0x2920
callq 0x10b0
movq %r14, %rdi
callq 0x1130