// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x18(%rbp)
subq $0xe, %rax
ja 0x15d09
movq -0x18(%rbp), %rax
leaq 0x5db1(%rip), %rcx      # 0x1b870
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x5dd1(%rip), %rsi      # 0x1b8ac
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x5dbc(%rip), %rsi      # 0x1b8b6
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movsd 0x18(%rax), %xmm0
leaq 0x5da0(%rip), %rsi      # 0x1b8ba
movb $0x1, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x49f8(%rip), %rsi      # 0x1a531
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdx
leaq 0x5d65(%rip), %rsi      # 0x1b8bd
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x15d10
jmp 0x15d09
movq -0x10(%rbp), %rax
testb $0x1, 0x18(%rax)
je 0x15b94
movq -0x8(%rbp), %rdi
leaq 0x5cde(%rip), %rsi      # 0x1b869
movb $0x0, %al
callq 0x18b40
jmp 0x15ba6
movq -0x8(%rbp), %rdi
leaq 0x5d24(%rip), %rsi      # 0x1b8c3
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x5d0b(%rip), %rsi      # 0x1b8c9
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
leaq 0x5d01(%rip), %rsi      # 0x1b8d6
movb $0x0, %al
callq 0x18b40
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x15a90
movq -0x8(%rbp), %rdi
leaq 0x5c40(%rip), %rsi      # 0x1b838
movb $0x0, %al
callq 0x18b40
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x15a90
movq -0x8(%rbp), %rdi
leaq 0x5432(%rip), %rsi      # 0x1b04d
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
leaq 0x5ca9(%rip), %rsi      # 0x1b8db
movb $0x0, %al
callq 0x18b40
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x15a90
movq -0x8(%rbp), %rdi
leaq 0x5be3(%rip), %rsi      # 0x1b838
movb $0x0, %al
callq 0x18b40
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x15a90
movq -0x8(%rbp), %rdi
leaq 0x53d5(%rip), %rsi      # 0x1b04d
movb $0x0, %al
callq 0x18b40
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x15d80
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x53a5(%rip), %rdx      # 0x1b04b
leaq 0x53a0(%rip), %rcx      # 0x1b04d
callq 0x15e80
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x538c(%rip), %rdx      # 0x1b04f
leaq 0x5582(%rip), %rcx      # 0x1b24c
callq 0x15e80
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x5512(%rip), %rdx      # 0x1b1f2
leaq 0x4d53(%rip), %rcx      # 0x1aa3a
callq 0x15e80
jmp 0x15d09
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
leaq 0x5b45(%rip), %rdx      # 0x1b842
leaq 0x4d36(%rip), %rcx      # 0x1aa3a
callq 0x15e80
addq $0x20, %rsp
popq %rbp
retq
nop