// File: /workspace/github_c_makefile_star2_O1/voithos[P]awl/src/print.c
// Function: awlval_write_sb
static void awlval_write_sb(stringbuilder_t* sb, const awlval* v) {
    switch (v->type) {
        case AWLVAL_ERR:
            stringbuilder_write(sb, "Error: %s", v->err);
            break;

        case AWLVAL_INT:
            stringbuilder_write(sb, "%li", v->lng);
            break;

        case AWLVAL_FLOAT:
            stringbuilder_write(sb, "%f", v->dbl);
            break;

        case AWLVAL_SYM:
            stringbuilder_write(sb, "%s", v->sym);
            break;

        case AWLVAL_QSYM:
            stringbuilder_write(sb, ":'%s'", v->sym);
            break;

        case AWLVAL_STR:
            awlval_print_str(sb, v);
            break;

        case AWLVAL_BOOL:
            if (v->bln) {
                stringbuilder_write(sb, "true");
            } else {
                stringbuilder_write(sb, "false");
            }
            break;

        case AWLVAL_BUILTIN:
            stringbuilder_write(sb, "<builtin %s>", v->builtin_name);
            break;

        case AWLVAL_FN:
            stringbuilder_write(sb, "(fn ");
            awlval_write_sb(sb, v->formals);
            stringbuilder_write(sb, " ");
            awlval_write_sb(sb, v->body);
            stringbuilder_write(sb, ")");
            break;

        case AWLVAL_MACRO:
            stringbuilder_write(sb, "(macro ");
            awlval_write_sb(sb, v->formals);
            stringbuilder_write(sb, " ");
            awlval_write_sb(sb, v->body);
            stringbuilder_write(sb, ")");
            break;

        case AWLVAL_DICT:
            awlval_dict_print(sb, v->d);
            break;

        case AWLVAL_SEXPR:
            awlval_expr_print(sb, v, "(", ")");
            break;

        case AWLVAL_QEXPR:
            awlval_expr_print(sb, v, "{", "}");
            break;

        case AWLVAL_EEXPR:
            awlval_expr_print(sb, v, "\\", "");
            break;

        case AWLVAL_CEXPR:
            awlval_expr_print(sb, v, "@", "");
            break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl (%rsi), %eax
cmpq $0xe, %rax
ja 0xfce8
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x38b6(%rip), %rcx      # 0x13530
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r14), %rdx
leaq 0x38e8(%rip), %rsi      # 0x13576
jmp 0xfd0f
leaq 0x386d(%rip), %rdx      # 0x13504
jmp 0xfdb4
leaq 0x3068(%rip), %rdx      # 0x12d0b
leaq 0x3063(%rip), %rcx      # 0x12d0d
jmp 0xfdbb
movq 0x18(%r14), %rdx
leaq 0x38c3(%rip), %rsi      # 0x1357d
jmp 0xfd0f
leaq 0x304c(%rip), %rdx      # 0x12d0f
leaq 0x3244(%rip), %rcx      # 0x12f0e
jmp 0xfdbb
leaq 0x38c5(%rip), %rsi      # 0x1359b
jmp 0xfea1
movq 0x18(%r14), %rdx
leaq 0x3886(%rip), %rsi      # 0x1356c
jmp 0xfd0f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r14), %rdx
leaq 0x2847(%rip), %rsi      # 0x12549
jmp 0xfd0f
movq 0x20(%r14), %rdx
leaq 0x387a(%rip), %rsi      # 0x13589
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a1e
movsd 0x18(%r14), %xmm0
leaq 0x3846(%rip), %rsi      # 0x1357a
movq %rbx, %rdi
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a1e
movq 0x18(%r14), %r14
movq %r14, %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0x2290
testq %rax, %rax
je 0xfefc
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x2080
movq %r15, %rdi
callq 0xbeed
movq %rax, %r14
leaq 0x2e16(%rip), %rsi      # 0x12ba0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x11a1e
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23f0
leaq 0x3100(%rip), %rdx      # 0x12eb4
leaq 0x30da(%rip), %rcx      # 0x12e95
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xff01
cmpb $0x1, 0x18(%r14)
jne 0xfef3
leaq 0x3745(%rip), %rsi      # 0x1352b
jmp 0xfedb
movq 0x18(%r14), %r15
leaq 0x2f1b(%rip), %rsi      # 0x12d11
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11a1e
movq %r15, %rdi
callq 0x5de6
movl %eax, %r12d
movq %r15, %rdi
callq 0x5dea
movq %rax, %r14
movq %r15, %rdi
callq 0x5e31
movq %rax, %r15
testl %r12d, %r12d
jle 0xfe81
leal -0x1(%r12), %ebp
movl %r12d, %r12d
xorl %r13d, %r13d
movq (%r14,%r13,8), %rdx
movq %rbx, %rdi
leaq 0x373e(%rip), %rsi      # 0x1357d
xorl %eax, %eax
callq 0x11a1e
movq %rbx, %rdi
leaq 0x36aa(%rip), %rsi      # 0x134fa
xorl %eax, %eax
callq 0x11a1e
movq (%r15,%r13,8), %rsi
movq %rbx, %rdi
callq 0xfc5a
cmpq %r13, %rbp
je 0xfe79
movq %rbx, %rdi
leaq 0x3688(%rip), %rsi      # 0x134fa
xorl %eax, %eax
callq 0x11a1e
incq %r13
cmpq %r13, %r12
jne 0xfe31
movq %r14, %rdi
callq 0x23f0
movq %r15, %rdi
callq 0x23f0
leaq 0x3066(%rip), %rsi      # 0x12efe
jmp 0xfedb
leaq 0x36f5(%rip), %rsi      # 0x13596
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11a1e
movq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0xfc5a
leaq 0x363c(%rip), %rsi      # 0x134fa
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11a1e
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0xfc5a
leaq 0x2e32(%rip), %rsi      # 0x12d0d
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11a1e
leaq 0x3689(%rip), %rsi      # 0x13583
jmp 0xfedb
callq 0x2650