// File: /workspace/github_c_makefile_star2_O2/phase[P]o/o.c
// Function: tos
S tos(O o){
    S r,t;L z,i;switch(o->t){
    case TD:r=alc(BZ)/*hope this is big enough!*/;sprintf(r,"%f",o->d);z=strlen(r)-1;while(r[z]=='0')r[z--]=0;if(r[z]=='.')r[z]=0;BK;
    case TS:r=alc(o->s.z+1);memcpy(r,o->s.s,o->s.z);r[o->s.z]=0;BK;
    case TA:r=alc(1);r[0]='[';z=1;for(i=0;i<len(o->a);++i){L l;if(i){r=rlc(r,z+1);r[z++]=',';}t=tos(o->a->st[i]);l=strlen(t);r=rlc(r,z+l);memcpy(r+z,t,l);z+=l;DL(t);}r=rlc(r,z+2);r[z]=']';r[z+1]=0;BK;
    case TCB:r=alc(o->s.z+3);r[0]='{';memcpy(r+1,o->s.s,o->s.z);memcpy(r+1+o->s.z,"}",2);BK;
    case TR:{L lv;S tv;t=tos(o->e.k);tv=tos(o->e.v);z=strlen(t);lv=strlen(tv);r=alc(z+lv+5);sprintf(r,"{%s: %s}",t,tv);DL(t);DL(tv);}BK;
    }R r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, -0x30(%rbp)
movl (%rdi), %eax
cmpq $0x4, %rax
ja 0x2a5a
leaq 0x579a(%rip), %rcx      # 0x8004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x800, %edi            # imm = 0x800
callq 0x23e8
movq %rax, %r14
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm0
leaq 0x5ad3(%rip), %rsi      # 0x8363
movq %r14, %rdi
movb $0x1, %al
callq 0x2220
movq %r14, %rdi
callq 0x20e0
addq %r14, %rax
decq %rax
movzbl (%rax), %ecx
cmpl $0x30, %ecx
jne 0x2a50
movb $0x0, (%rax)
decq %rax
jmp 0x28a8
movq -0x30(%rbp), %rbx
movq 0x8(%rbx), %rdi
callq 0x2842
movq %rax, %r15
movq 0x10(%rbx), %rdi
callq 0x2842
movq %rax, %rbx
movq %r15, %rdi
callq 0x20e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x20e0
leaq (%r14,%rax), %rdi
addq $0x5, %rdi
callq 0x23e8
movq %rax, %r14
leaq 0x5a64(%rip), %rsi      # 0x8366
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2220
movq %r15, %rdi
callq 0x2030
movq %rbx, %rdi
callq 0x2030
jmp 0x2a5a
pushq $0x1
popq %r15
movq %r15, %rdi
callq 0x23e8
movq %rax, -0x38(%rbp)
movb $0x5b, (%rax)
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
cmpq 0x8(%rax), %r13
jae 0x29d5
testq %r13, %r13
movq -0x38(%rbp), %rdi
je 0x2979
leaq 0x1(%r15), %r12
movq %r12, %rsi
callq 0x2404
movq %rax, %r14
movb $0x2c, (%rax,%r15)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %r12, %r15
jmp 0x297c
movq %rdi, %r14
movq (%rax), %rax
movq (%rax,%r13,8), %rdi
callq 0x2842
movq %rax, %r12
movq %rax, %rdi
callq 0x20e0
movq %r13, -0x40(%rbp)
movq %rax, %r13
leaq (%rax,%r15), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2404
movq %rax, -0x38(%rbp)
addq %rax, %r15
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq -0x40(%rbp), %r13
callq 0x21a0
movq %r12, %rdi
callq 0x2030
incq %r13
movq %rbx, %r15
jmp 0x293d
leaq 0x2(%r15), %rsi
movq -0x38(%rbp), %rdi
callq 0x2404
movq %rax, %r14
movw $0x5d, (%rax,%r15)
jmp 0x2a5a
movq -0x30(%rbp), %rbx
movq 0x10(%rbx), %rdi
addq $0x3, %rdi
callq 0x23e8
movq %rax, %r14
movb $0x7b, (%rax)
leaq 0x1(%rax), %rdi
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rbx
movq %rbx, %rdx
callq 0x21a0
movw $0x7d, 0x1(%r14,%rbx)
jmp 0x2a5a
movq -0x30(%rbp), %rbx
movq 0x10(%rbx), %rdi
incq %rdi
callq 0x23e8
movq %rax, %r14
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rbx
movq %rax, %rdi
movq %rbx, %rdx
callq 0x21a0
movb $0x0, (%r14,%rbx)
jmp 0x2a5a
cmpl $0x2e, %ecx
jne 0x2a5a
movb $0x0, (%rax)
jmp 0x2a5a
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq