// File: /workspace/github_c_makefile_star2_O1/janet-lang[P]janet/src/core/pp.c
// Function: janet_escape_string_impl
static void janet_escape_string_impl(JanetBuffer *buffer, const uint8_t *str, int32_t len) {
    janet_buffer_push_u8(buffer, '"');
    for (int32_t i = 0; i < len; ++i) {
        uint8_t c = str[i];
        switch (c) {
            case '"':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\\"", 2);
                break;
            case '\n':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\n", 2);
                break;
            case '\r':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\r", 2);
                break;
            case '\0':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\0", 2);
                break;
            case '\f':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\f", 2);
                break;
            case '\v':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\v", 2);
                break;
            case '\a':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\a", 2);
                break;
            case '\b':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\b", 2);
                break;
            case 27:
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\e", 2);
                break;
            case '\\':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\\\", 2);
                break;
            case '\t':
                janet_buffer_push_bytes(buffer, (const uint8_t *)"\\t", 2);
                break;
            default:
                if (c < 32 || c > 126) {
                    uint8_t buf[4];
                    buf[0] = '\\';
                    buf[1] = 'x';
                    buf[2] = janet_base64[(c >> 4) & 0xF];
                    buf[3] = janet_base64[c & 0xF];
                    janet_buffer_push_bytes(buffer, buf, 4);
                } else {
                    janet_buffer_push_u8(buffer, c);
                }
                break;
        }
    }
    janet_buffer_push_u8(buffer, '"');
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movl $0x22, %esi
callq 0x179a7
testl %r15d, %r15d
jle 0x403b2
movl %r15d, %r13d
xorl %r15d, %r15d
leaq 0x29245(%rip), %r12     # 0x694e8
movzbl (%r14,%r15), %esi
cmpl $0x1a, %esi
jg 0x402d0
cmpl $0xd, %esi
ja 0x40371
movl %esi, %eax
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq %rbx, %rdi
leaq 0x293b4(%rip), %rsi     # 0x6967f
jmp 0x40359
cmpl $0x1b, %esi
je 0x40343
cmpl $0x5c, %esi
je 0x4034f
cmpl $0x22, %esi
jne 0x40371
movq %rbx, %rdi
leaq 0x29389(%rip), %rsi     # 0x69676
jmp 0x40359
movq %rbx, %rdi
leaq 0x29380(%rip), %rsi     # 0x69679
jmp 0x40359
movq %rbx, %rdi
leaq 0x2937d(%rip), %rsi     # 0x69682
jmp 0x40359
movq %rbx, %rdi
leaq 0x2937a(%rip), %rsi     # 0x6968b
jmp 0x40359
movq %rbx, %rdi
leaq 0x2936b(%rip), %rsi     # 0x69688
jmp 0x40359
movq %rbx, %rdi
leaq 0x2936b(%rip), %rsi     # 0x69694
jmp 0x40359
movq %rbx, %rdi
leaq 0x29347(%rip), %rsi     # 0x6967c
jmp 0x40359
movq %rbx, %rdi
leaq 0x29344(%rip), %rsi     # 0x69685
jmp 0x40359
movq %rbx, %rdi
leaq 0x29341(%rip), %rsi     # 0x6968e
jmp 0x40359
movq %rbx, %rdi
leaq 0x29338(%rip), %rsi     # 0x69691
movl $0x2, %edx
callq 0x17925
incq %r15
cmpq %r15, %r13
jne 0x402a3
jmp 0x403b2
movl %esi, %eax
addb $-0x7f, %al
cmpb $-0x60, %al
ja 0x403a8
movw $0x785c, -0x2c(%rbp)    # imm = 0x785C
movl %esi, %eax
shrl $0x4, %eax
leaq 0x2c235(%rip), %rcx     # 0x6c5c0
movb (%rcx,%rax), %al
movb %al, -0x2a(%rbp)
andl $0xf, %esi
movb (%rcx,%rsi), %al
movb %al, -0x29(%rbp)
movq %rbx, %rdi
leaq -0x2c(%rbp), %rsi
movl $0x4, %edx
jmp 0x4035e
movq %rbx, %rdi
callq 0x179a7
jmp 0x40363
movq %rbx, %rdi
movl $0x22, %esi
callq 0x179a7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq