// File: /workspace/github_c_makefile_star2_O2/mattn[P]orelang/ore.c
// Function: ore_value_to_str
static char*
ore_value_to_str(ore_context* ore, ore_value v) {
  kstring_t ks = { 0, 0, NULL };

  switch (v.t) {
    case ORE_TYPE_NIL:
      kputs("nil", &ks);
      break;
    case ORE_TYPE_BOOL:
      if (v.v.b)
        kputs("true", &ks);
      else
        kputs("false", &ks);
      break;
    case ORE_TYPE_INT:
      ksprintf(&ks, "%d", v.v.i);
      break;
    case ORE_TYPE_FLOAT:
      ksprintf(&ks, "%f", v.v.d);
      break;
    case ORE_TYPE_STRING:
      kputs(v.v.s->p, &ks);
      break;
    case ORE_TYPE_ARRAY:
      {
        ore_array_t* a = (ore_array_t*) v.v.a->p;
        ore_array_iter_t* k;
        ore_array_iter_t* b = kl_begin(a);
        kputc('[', &ks);
        for (k = b; k != kl_end(a); k = kl_next(k)) {
          if (k != b) {
            kputc(',', &ks);
          }
          char* s = ore_value_to_str(ore, kl_val(k));
          kputs(s, &ks);
          free(s);
        }
        kputc(']', &ks);
      }
      break;
    case ORE_TYPE_HASH:
      {
        ore_hash_t* h = (ore_hash_t*) v.v.h->p;
        ore_hash_iter_t k;
        int n = 0;
        kputc('{', &ks);
        for (k = kh_begin(h); k != kh_end(h); k++) {
          if (!kh_exist(h, k)) continue;
          if (n > 0) {
            kputc(',', &ks);
          }
          const char* key = kh_key(h, k);
          kputs(key, &ks);
          kputs(": ", &ks);
          kputs(ore_value_to_str(ore, kh_val(h, k)), &ks);
          n++;
        }
        kputc('}', &ks);
      }
      break;
    case ORE_TYPE_REGEXP:
      kputs(v.v.r->p, &ks);
      break;
    case ORE_TYPE_FUNC:
      ksprintf(&ks, "<func-0x%p>", v.v.f.x.o);
      break;
    case ORE_TYPE_CFUNC:
      ksprintf(&ks, "<func-0x%p>", v.v.f.x.c);
      break;
    case ORE_TYPE_ENV:
      ksprintf(&ks, "<env-0x%p>", v.v.e->p);
      break;
    case ORE_TYPE_CLASS:
      kputs(v.v.c->n, &ks);
      break;
    case ORE_TYPE_CCLASS:
      kputs(v.v.c->n, &ks);
      break;
    case ORE_TYPE_OBJECT:
      ksprintf(&ks, "<%s-0x%p>", ((ore_class*)v.v.o->c)->n, v.v.o);
      break;
    default:
      kputs("<unknown>", &ks);
      break;
  }
  return ks.s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
andq $0x0, 0x40(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movl 0x80(%rsp), %ecx
cmpq $0xd, %rcx
ja 0xfb54
leaq 0x80(%rsp), %rax
leaq 0xff2(%rip), %rdx       # 0x10930
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movq 0x8(%rax), %rax
movq (%rax), %rdi
leaq 0x30(%rsp), %rsi
callq 0xfb6c
jmp 0xfb40
movq 0x18(%rax), %rdx
leaq 0x278b(%rip), %rsi      # 0x120f3
jmp 0xfa36
movq 0x8(%rax), %rax
movq (%rax), %r15
pushq $0x7b
popq %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0xfc05
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpl (%r15), %r13d
je 0xfa21
movq 0x10(%r15), %rax
movl %r13d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %eax
movl %r12d, %ecx
andb $0x1e, %cl
shrl %cl, %eax
testb $0x3, %al
jne 0xfa15
testl %ebp, %ebp
jle 0xf9bd
pushq $0x2c
popq %rdi
movq %rbx, %rsi
callq 0xfc05
movq 0x18(%r15), %rax
movl %r13d, %r14d
movq (%rax,%r14,8), %rdi
movq %rbx, %rsi
callq 0xfb6c
leaq 0x2716(%rip), %rdi      # 0x120ed
movq %rbx, %rsi
callq 0xfb6c
movq 0x20(%r15), %rax
imulq $0x28, %r14, %rcx
movq 0x20(%rax,%rcx), %rdx
movq %rdx, 0x20(%rsp)
movups (%rax,%rcx), %xmm0
movups 0x10(%rax,%rcx), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xf902
movq %rax, %rdi
movq %rbx, %rsi
callq 0xfb6c
incl %ebp
incl %r13d
addl $0x2, %r12d
jmp 0xf98c
pushq $0x7d
jmp 0xfb15
movq 0x8(%rax), %rax
movq (%rax), %rdx
leaq 0x26c9(%rip), %rsi      # 0x120ff
leaq 0x30(%rsp), %rdi
xorl %eax, %eax
callq 0x8e66
jmp 0xfb40
movl 0x8(%rax), %edx
leaq 0x269f(%rip), %rsi      # 0x120f0
leaq 0x30(%rsp), %rdi
xorl %eax, %eax
callq 0x8e66
jmp 0xfb40
movsd 0x8(%rax), %xmm0
leaq 0x25a3(%rip), %rsi      # 0x12011
leaq 0x30(%rsp), %rdi
movb $0x1, %al
callq 0x8e66
jmp 0xfb40
leaq 0x103a(%rip), %rdi      # 0x10ac0
jmp 0xf94e
cmpl $0x0, 0x8(%rax)
je 0xfb60
leaq 0x1019(%rip), %rdi      # 0x10ab5
jmp 0xf94e
movq 0x8(%rax), %rax
movq (%rax), %r15
movq (%r15), %r12
pushq $0x5b
popq %rdi
leaq 0x30(%rsp), %rbx
movq %rbx, %rsi
callq 0xfc05
pushq $0x2c
popq %rbp
movq %r12, %r13
cmpq 0x8(%r15), %r13
je 0xfb13
cmpq %r12, %r13
je 0xfad6
movl %ebp, %edi
movq %rbx, %rsi
callq 0xfc05
movq 0x20(%r13), %rax
movq %rax, 0x20(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xf902
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0xfb6c
movq %r14, %rdi
callq 0x22c0
movq 0x28(%r13), %r13
jmp 0xfac1
pushq $0x5d
popq %rdi
leaq 0x30(%rsp), %rsi
callq 0xfc05
jmp 0xfb40
movq 0x8(%rax), %rcx
movq 0x8(%rcx), %rax
movq (%rax), %rdx
leaq 0x25d6(%rip), %rsi      # 0x1210a
leaq 0x30(%rsp), %rdi
xorl %eax, %eax
callq 0x8e66
movq 0x40(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x25b9(%rip), %rdi      # 0x12114
jmp 0xf94e
leaq 0xf53(%rip), %rdi       # 0x10aba
jmp 0xf94e