// File: /workspace/github_cpp_makefile_star2_O2/kram[P]kram/./src/vm/value.cpp
// Function: Value::print[abi:cxx11](bool)
std::string Value::print(bool print_type) {
	std::stringstream res;

	if (print_type) {
		std::string i = "UNKNOWN";
		switch (this->type) {
			case Type::NUL: i = "NUL"; break;
			case Type::STRING: i = "STRING"; break;
			case Type::NUMBER: i = "NUMBER"; break;
			case Type::BOOL: i = "BOOL"; break;
			case Type::REFERENCE: i = "REFERENCE"; break;
			case Type::FUNCTION: i = "FUNCTION"; break;
			case Type::CLASS: i = "CLASS"; break;
			case Type::NAME: i = "NAME"; break;
		}

		res << i << "<";
	}

	switch (this->type) {
		case Type::NUL:
			res << "NULL";
			break;

		case Type::STRING:
			res << *this->data.strval;
			break;

		case Type::NUMBER:
			res << std::setprecision (std::numeric_limits<double>::digits10 + 1);
			res << this->data.number;
			break;

		case Type::BOOL:
			if (this->getBool()) {
				res << "true";
			} else {
				res << "false";
			}
			break;

		// We can probably prettify these even further, eg print what a REFERENCE is actually pointing to.
		// But that is for another time.
		case Type::REFERENCE: res << "REFERENCE"; break;
		case Type::FUNCTION: res << "FUNCTION"; break;
		case Type::CLASS: res << "CLASS"; break;
		case Type::NAME: res << "NAME"; break;
	}

	if (print_type) {
		res << ">";
	}

	return res.str();
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x28(%rsp), %rdi
callq 0x31a0
testl %ebp, %ebp
je 0xbeb1
leaq 0x528d(%rip), %rsi      # 0x110e5
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x30f0
movl 0x8(%r14), %eax
cmpq $0x8, %rax
jae 0xbe89
leaq 0x5e54(%rip), %rcx      # 0x11ccc
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
leaq 0x8(%rsp), %rdi
callq 0x33c0
leaq 0x38(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3200
leaq 0x53f8(%rip), %rsi      # 0x11297
movq %rax, %rdi
callq 0x3220
leaq 0x8(%rsp), %rdi
callq 0x3130
movl 0x8(%r14), %eax
cmpq $0x7, %rax
ja 0xbf56
leaq 0x5de6(%rip), %rcx      # 0x11cac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x5fab(%rip), %rsi      # 0x11e81
jmp 0xbf4c
leaq 0x5f98(%rip), %rsi      # 0x11e77
jmp 0xbf4c
leaq 0x38(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x10, 0x40(%rsp,%rax)
movsd (%r14), %xmm0
callq 0x3320
jmp 0xbf56
xorpd %xmm0, %xmm0
ucomisd (%r14), %xmm0
leaq 0x38(%rsp), %rdi
leaq 0x5330(%rip), %rax      # 0x11247
leaq 0x532e(%rip), %rsi      # 0x1124c
cmovneq %rax, %rsi
jmp 0xbf51
leaq 0x61a8(%rip), %rsi      # 0x120d3
jmp 0xbf4c
leaq 0x38(%rsp), %rdi
movq (%r14), %rsi
callq 0x3200
jmp 0xbf56
leaq 0x51e9(%rip), %rsi      # 0x1112c
jmp 0xbf4c
leaq 0x51da(%rip), %rsi      # 0x11126
leaq 0x38(%rsp), %rdi
callq 0x3220
testb %bpl, %bpl
je 0xbf6c
leaq 0x38(%rsp), %rdi
leaq 0x5328(%rip), %rsi      # 0x1128f
callq 0x3220
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x3310
leaq 0x28(%rsp), %rdi
callq 0x31b0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xbfa3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3130
jmp 0xbfa6
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x31b0
movq %rbx, %rdi
callq 0x3390