// File: /workspace/github_c_makefile_star2_O2/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 0xd55e
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4090(%rip), %rcx      # 0x11580
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%r14), %rdx
leaq 0x40c2(%rip), %rsi      # 0x115c6
jmp 0xd585
leaq 0x4047(%rip), %rdx      # 0x11554
jmp 0xd61f
leaq 0x3842(%rip), %rdx      # 0x10d5b
leaq 0x383d(%rip), %rcx      # 0x10d5d
jmp 0xd626
movq 0x18(%r14), %rdx
leaq 0x409d(%rip), %rsi      # 0x115cd
jmp 0xd585
leaq 0x3826(%rip), %rdx      # 0x10d5f
leaq 0x3a1e(%rip), %rcx      # 0x10f5e
jmp 0xd626
leaq 0x409f(%rip), %rsi      # 0x115eb
jmp 0xd70d
movq 0x18(%r14), %rdx
leaq 0x4060(%rip), %rsi      # 0x115bc
jmp 0xd585
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%r14), %rdx
leaq 0x2fd1(%rip), %rsi      # 0x10549
jmp 0xd585
movq 0x20(%r14), %rdx
leaq 0x4054(%rip), %rsi      # 0x115d9
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xef89
movsd 0x18(%r14), %xmm0
leaq 0x4020(%rip), %rsi      # 0x115ca
movq %rbx, %rdi
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xef89
movq 0x18(%r14), %rdi
callq 0x2110
leaq 0x1(%rax), %rdi
callq 0xd438
movq %rax, %r15
movq 0x18(%r14), %rsi
movq %rax, %rdi
callq 0x2080
movq %r15, %rdi
callq 0xa2c2
movq %rax, %r14
leaq 0x35fb(%rip), %rsi      # 0x10bf0
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0xef89
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x23f0
leaq 0x38e5(%rip), %rdx      # 0x10f04
leaq 0x38bf(%rip), %rcx      # 0x10ee5
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xd768
cmpb $0x1, 0x18(%r14)
jne 0xd75f
leaq 0x3f2a(%rip), %rsi      # 0x1157b
jmp 0xd747
movq 0x18(%r14), %r12
leaq 0x3700(%rip), %rsi      # 0x10d61
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0xef89
movq %r12, %rdi
callq 0x5218
movl %eax, %r14d
movq %r12, %rdi
callq 0x521c
movq %rax, %r15
movq %r12, %rdi
callq 0x5256
leal -0x1(%r14), %r13d
testl %r14d, %r14d
cmovlel %ebp, %r14d
movq %rax, %r12
xorl %ebp, %ebp
cmpq %rbp, %r14
je 0xd6ed
movq (%r15,%rbp,8), %rdx
movq %rbx, %rdi
leaq 0x3f1f(%rip), %rsi      # 0x115cd
xorl %eax, %eax
callq 0xef89
movq %rbx, %rdi
leaq 0x3e8b(%rip), %rsi      # 0x1154a
xorl %eax, %eax
callq 0xef89
movq (%r12,%rbp,8), %rsi
movq %rbx, %rdi
callq 0xd4d0
cmpq %rbp, %r13
je 0xd6e8
movq %rbx, %rdi
leaq 0x3e69(%rip), %rsi      # 0x1154a
xorl %eax, %eax
callq 0xef89
incq %rbp
jmp 0xd69b
movq %r15, %rdi
callq 0x23f0
movq %r12, %rdi
callq 0x23f0
leaq 0x384a(%rip), %rsi      # 0x10f4e
jmp 0xd747
leaq 0x3ed9(%rip), %rsi      # 0x115e6
movq %rbx, %rdi
xorl %eax, %eax
callq 0xef89
movq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0xd4d0
leaq 0x3e20(%rip), %rsi      # 0x1154a
movq %rbx, %rdi
xorl %eax, %eax
callq 0xef89
movq 0x28(%r14), %rsi
movq %rbx, %rdi
callq 0xd4d0
leaq 0x3616(%rip), %rsi      # 0x10d5d
movq %rbx, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xef89
leaq 0x3e6d(%rip), %rsi      # 0x115d3
jmp 0xd747