// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %rdi
callq 0x3190
testl %ebp, %ebp
je 0xd2b0
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x5eaa(%rip), %rsi      # 0x130e5
leaq 0x5eaa(%rip), %rdx      # 0x130ec
movq %rsp, %rdi
callq 0x47cc
movl 0x8(%r14), %eax
cmpq $0x8, %rax
jae 0xd27b
leaq 0x6b29(%rip), %rdx      # 0x13d84
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
leaq 0x6b3f(%rip), %rdx      # 0x13da8
movq (%rdx,%rax,8), %r8
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
xorl %esi, %esi
callq 0x3320
leaq 0x30(%rsp), %rdi
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
callq 0x32a0
leaq 0x60ba(%rip), %rsi      # 0x1334f
movl $0x1, %edx
movq %rax, %rdi
callq 0x32a0
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xd2b0
callq 0x3230
movl 0x8(%r14), %eax
cmpq $0x7, %rax
ja 0xd384
leaq 0x6a9f(%rip), %rcx      # 0x13d64
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x4, %edx
leaq 0x6ca3(%rip), %rsi      # 0x13f7d
jmp 0xd37a
movl $0x9, %edx
leaq 0x6c88(%rip), %rsi      # 0x13f73
jmp 0xd37a
leaq 0x30(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq $0x10, 0x38(%rsp,%rax)
movsd (%r14), %xmm0
callq 0x3350
jmp 0xd384
xorpd %xmm0, %xmm0
xorl %edx, %edx
ucomisd (%r14), %xmm0
setne %dl
leaq 0x30(%rsp), %rdi
leaq 0x5fd4(%rip), %rax      # 0x132ff
leaq 0x5fd2(%rip), %rsi      # 0x13304
cmovneq %rax, %rsi
xorq $0x5, %rdx
jmp 0xd37f
movl $0x4, %edx
leaq 0x6f0f(%rip), %rsi      # 0x14257
jmp 0xd37a
leaq 0x30(%rsp), %rdi
movq (%r14), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x32a0
jmp 0xd384
movl $0x8, %edx
leaq 0x5dc0(%rip), %rsi      # 0x1312c
jmp 0xd37a
movl $0x5, %edx
leaq 0x5dac(%rip), %rsi      # 0x13126
leaq 0x30(%rsp), %rdi
callq 0x32a0
testb %bpl, %bpl
je 0xd39f
leaq 0x30(%rsp), %rdi
leaq 0x5fb2(%rip), %rsi      # 0x13347
movl $0x1, %edx
callq 0x32a0
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x3340
movq 0xec05(%rip), %rsi      # 0x1bfb8
leaq 0x20(%rsp), %rdi
callq 0x31b0
leaq 0xa0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0xd3f0
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0xd3f3
callq 0x3230
jmp 0xd3f3
movq %rax, %rbx
movq 0xebbe(%rip), %rsi      # 0x1bfb8
leaq 0x20(%rsp), %rdi
callq 0x31b0
leaq 0xa0(%rsp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x33c0
nop