// File: /workspace/github_c_makefile_star2_O3/janet-lang[P]janet/src/core/pp.c
// Function: print_jdn_one
static int print_jdn_one(struct pretty *S, Janet x, int depth) {
    if (depth == 0) return 1;
    switch (janet_type(x)) {
        case JANET_NIL:
        case JANET_BOOLEAN:
        case JANET_BUFFER:
        case JANET_STRING:
            janet_description_b(S->buffer, x);
            break;
        case JANET_NUMBER:
            janet_buffer_ensure(S->buffer, S->buffer->count + BUFSIZE, 2);
            double num = janet_unwrap_number(x);
            if (isnan(num)) return 1;
            if (isinf(num)) return 1;
            janet_buffer_dtostr(S->buffer, num);
            break;
        case JANET_SYMBOL:
        case JANET_KEYWORD:
            if (contains_bad_chars(janet_unwrap_keyword(x), janet_type(x) == JANET_SYMBOL)) return 1;
            janet_description_b(S->buffer, x);
            break;
        case JANET_TUPLE: {
            JanetTuple t = janet_unwrap_tuple(x);
            int isb = janet_tuple_flag(t) & JANET_TUPLE_FLAG_BRACKETCTOR;
            janet_buffer_push_u8(S->buffer, isb ? '[' : '(');
            for (int32_t i = 0; i < janet_tuple_length(t); i++) {
                if (i) janet_buffer_push_u8(S->buffer, ' ');
                if (print_jdn_one(S, t[i], depth - 1)) return 1;
            }
            janet_buffer_push_u8(S->buffer, isb ? ']' : ')');
        }
        break;
        case JANET_ARRAY: {
            janet_table_put(&S->seen, x, janet_wrap_true());
            JanetArray *a = janet_unwrap_array(x);
            janet_buffer_push_cstring(S->buffer, "@[");
            for (int32_t i = 0; i < a->count; i++) {
                if (i) janet_buffer_push_u8(S->buffer, ' ');
                if (print_jdn_one(S, a->data[i], depth - 1)) return 1;
            }
            janet_buffer_push_u8(S->buffer, ']');
        }
        break;
        case JANET_TABLE: {
            janet_table_put(&S->seen, x, janet_wrap_true());
            JanetTable *tab = janet_unwrap_table(x);
            janet_buffer_push_cstring(S->buffer, "@{");
            int isFirst = 1;
            for (int32_t i = 0; i < tab->capacity; i++) {
                const JanetKV *kv = tab->data + i;
                if (janet_checktype(kv->key, JANET_NIL)) continue;
                if (!isFirst) janet_buffer_push_u8(S->buffer, ' ');
                isFirst = 0;
                if (print_jdn_one(S, kv->key, depth - 1)) return 1;
                janet_buffer_push_u8(S->buffer, ' ');
                if (print_jdn_one(S, kv->value, depth - 1)) return 1;
            }
            janet_buffer_push_u8(S->buffer, '}');
        }
        break;
        case JANET_STRUCT: {
            JanetStruct st = janet_unwrap_struct(x);
            janet_buffer_push_u8(S->buffer, '{');
            int isFirst = 1;
            for (int32_t i = 0; i < janet_struct_capacity(st); i++) {
                const JanetKV *kv = st + i;
                if (janet_checktype(kv->key, JANET_NIL)) continue;
                if (!isFirst) janet_buffer_push_u8(S->buffer, ' ');
                isFirst = 0;
                if (print_jdn_one(S, kv->key, depth - 1)) return 1;
                janet_buffer_push_u8(S->buffer, ' ');
                if (print_jdn_one(S, kv->value, depth - 1)) return 1;
            }
            janet_buffer_push_u8(S->buffer, '}');
        }
        break;
        default:
            return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x1, %r15d
testl %edx, %edx
je 0x408b0
movq %rsi, %r12
movq %rsi, %xmm0
movq %rsi, %rax
shrq $0x2f, %rax
andl $0xf, %eax
xorl %ebx, %ebx
ucomisd %xmm0, %xmm0
cmovpl %eax, %ebx
cmpl $0xb, %ebx
ja 0x408b0
movl %edx, %r14d
movq %rdi, %r13
leaq 0x28035(%rip), %rax     # 0x68500
movslq (%rax,%rbx,4), %rcx
addq %rax, %rcx
movq %rdi, -0x30(%rbp)
jmpq *%rcx
movq (%r13), %rdi
movq %r12, %rsi
callq 0x3eb9c
jmp 0x408ad
movq %r12, %rdi
callq 0x4ebc4
movq %rax, %r14
cmpl $0x5, %ebx
setne %al
movl -0x8(%r14), %r13d
testq %r13, %r13
sete %cl
orb %al, %cl
jne 0x40515
movb (%r14), %al
addb $-0x30, %al
cmpb $0xa, %al
jb 0x408b0
movq %r14, %rdi
movl %r13d, %esi
callq 0x38a86
testl %eax, %eax
je 0x408b0
testl %r13d, %r13d
jle 0x40566
movzbl (%r14), %edi
callq 0x38a68
testl %eax, %eax
je 0x408b0
movl $0x1, %ecx
movq %rcx, %rbx
cmpq %rcx, %r13
je 0x4055d
movzbl (%r14,%rbx), %edi
callq 0x38a68
leaq 0x1(%rbx), %rcx
testl %eax, %eax
jne 0x40543
cmpq %r13, %rbx
jb 0x408b0
movq -0x30(%rbp), %rax
movq (%rax), %rdi
jmp 0x404dc
leaq 0x28(%r13), %r15
movabsq $-0x6ffffffffffff, %rdi # imm = 0xFFF9000000000001
callq 0x4ece6
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x476f0
movq %r12, %rdi
callq 0x4ebc4
movq %rax, %r15
movq (%r13), %rdi
leaq 0x28125(%rip), %rsi     # 0x686ce
callq 0x17878
movl 0x14(%r15), %eax
testl %eax, %eax
jle 0x40804
movabsq $-0x800000000000, %rdi  # imm = 0xFFFF800000000000
movabsq $-0x7800000000000, %r8  # imm = 0xFFF8800000000000
decl %r14d
movl $0x1, %ecx
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %r15, -0x38(%rbp)
movq 0x20(%r15), %rbx
movq (%rbx,%r13), %rsi
movq %rsi, %rdx
andq %rdi, %rdx
cmpq %r8, %rdx
je 0x40672
movl %r14d, %r15d
testl %ecx, %ecx
jne 0x4060f
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movl $0x20, %esi
callq 0x17947
movq (%rbx,%r13), %rsi
movq -0x30(%rbp), %r14
movq %r14, %rdi
movl %r15d, %edx
callq 0x4047b
testl %eax, %eax
jne 0x4090e
movq (%r14), %rdi
movl $0x20, %esi
callq 0x17947
movq 0x8(%rbx,%r13), %rsi
movq %r14, %rdi
movl %r15d, %edx
callq 0x4047b
testl %eax, %eax
movl %r15d, %r14d
movl $0x1, %r15d
jne 0x408b0
movq -0x38(%rbp), %r15
movl 0x14(%r15), %eax
xorl %ecx, %ecx
movabsq $-0x800000000000, %rdi  # imm = 0xFFFF800000000000
movabsq $-0x7800000000000, %r8  # imm = 0xFFF8800000000000
incq %r12
movslq %eax, %rdx
addq $0x10, %r13
cmpq %rdx, %r12
jl 0x405e0
jmp 0x40804
movq -0x30(%rbp), %rax
leaq 0x28(%rax), %r13
movabsq $-0x6ffffffffffff, %rdi # imm = 0xFFF9000000000001
callq 0x4ece6
movq %r13, %rdi
movq -0x30(%rbp), %r13
movq %r12, %rsi
movq %rax, %rdx
callq 0x476f0
movq %r12, %rdi
callq 0x4ebc4
movq %rax, %r12
movq (%r13), %rdi
leaq 0x27fb6(%rip), %rsi     # 0x6867f
callq 0x17878
cmpl $0x0, 0x10(%r12)
jle 0x40717
decl %r14d
xorl %ebx, %ebx
testq %rbx, %rbx
je 0x406ee
movq (%r13), %rdi
movl $0x20, %esi
callq 0x17947
movq 0x18(%r12), %rax
movq (%rax,%rbx,8), %rsi
movq %r13, %rdi
movl %r14d, %edx
callq 0x4047b
testl %eax, %eax
jne 0x408b0
incq %rbx
movslq 0x10(%r12), %rax
cmpq %rax, %rbx
jl 0x406db
movq (%r13), %rdi
movl $0x5d, %esi
jmp 0x408a8
movq %r12, %rdi
callq 0x4ebc4
movq %rax, %rbx
movq (%r13), %rdi
movl $0x7b, %esi
callq 0x17947
movq %rbx, -0x38(%rbp)
movl -0x10(%rbx), %eax
testl %eax, %eax
jle 0x40804
movabsq $-0x800000000000, %rdi  # imm = 0xFFFF800000000000
movabsq $-0x7800000000000, %r8  # imm = 0xFFF8800000000000
decl %r14d
movl $0x1, %ecx
xorl %r13d, %r13d
movq -0x38(%rbp), %r12
movq -0x30(%rbp), %rbx
movq (%r12), %rsi
movq %rsi, %rdx
andq %rdi, %rdx
cmpq %r8, %rdx
je 0x407f1
testl %ecx, %ecx
jne 0x4079c
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movl $0x20, %esi
callq 0x17947
movq (%r12), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x4047b
testl %eax, %eax
jne 0x408b0
movq (%rbx), %rdi
movl $0x20, %esi
callq 0x17947
movq 0x8(%r12), %rsi
movq %rbx, %rdi
movl %r14d, %edx
callq 0x4047b
testl %eax, %eax
jne 0x408b0
movq -0x38(%rbp), %rax
movl -0x10(%rax), %eax
xorl %ecx, %ecx
movabsq $-0x800000000000, %rdi  # imm = 0xFFFF800000000000
movabsq $-0x7800000000000, %r8  # imm = 0xFFF8800000000000
incq %r13
movslq %eax, %rdx
addq $0x10, %r12
cmpq %rdx, %r13
jl 0x40774
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movl $0x7d, %esi
jmp 0x408a8
movq %r12, %rdi
callq 0x4ebc4
movq %rax, %r12
movq %r13, %rax
movl -0x20(%r12), %r13d
movq (%rax), %rdi
btl $0x10, %r13d
movl $0x28, %eax
movl $0x5b, %esi
cmovael %eax, %esi
callq 0x17947
cmpl $0x0, -0x10(%r12)
jle 0x4088f
decl %r14d
xorl %ebx, %ebx
movl %r14d, %r15d
testq %rbx, %rbx
movq -0x30(%rbp), %r14
je 0x40868
movq (%r14), %rdi
movl $0x20, %esi
callq 0x17947
movq (%r12,%rbx,8), %rsi
movq %r14, %rdi
movl %r15d, %r14d
movl %r15d, %edx
callq 0x4047b
testl %eax, %eax
jne 0x4090e
incq %rbx
movslq -0x10(%r12), %rax
cmpq %rax, %rbx
jl 0x4084f
btl $0x10, %r13d
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movl $0x29, %eax
movl $0x5d, %esi
cmovael %eax, %esi
callq 0x17947
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
ucomisd %xmm0, %xmm0
setp %bl
movq (%r13), %rdi
movl 0x10(%rdi), %esi
addl $0x40, %esi
movl $0x2, %edx
movsd %xmm0, -0x38(%rbp)
callq 0x1771e
btrq $0x3f, %r12
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
cmpq %rax, %r12
sete %al
orb %bl, %al
jne 0x408b0
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movsd -0x38(%rbp), %xmm0
callq 0x46393
jmp 0x408ad
movl $0x1, %r15d
jmp 0x408b0
nop