// File: /workspace/github_c_makefile_star2_O2/xapi-project[P]rrd-client-lib/parson/parson.c
// Function: json_serialize_string
static int json_serialize_string(const char *string, char *buf) {
    size_t i = 0, len = strlen(string);
    char c = '\0';
    int written = -1, written_total = 0;
    APPEND_STRING("\"");
    for (i = 0; i < len; i++) {
        c = string[i];
        switch (c) {
            case '\"': APPEND_STRING("\\\""); break;
            case '\\': APPEND_STRING("\\\\"); break;
            case '/':  APPEND_STRING("\\/"); break; /* to make json embeddable in xml\/html */
            case '\b': APPEND_STRING("\\b"); break;
            case '\f': APPEND_STRING("\\f"); break;
            case '\n': APPEND_STRING("\\n"); break;
            case '\r': APPEND_STRING("\\r"); break;
            case '\t': APPEND_STRING("\\t"); break;
            case '\x00': APPEND_STRING("\\u0000"); break;
            case '\x01': APPEND_STRING("\\u0001"); break;
            case '\x02': APPEND_STRING("\\u0002"); break;
            case '\x03': APPEND_STRING("\\u0003"); break;
            case '\x04': APPEND_STRING("\\u0004"); break;
            case '\x05': APPEND_STRING("\\u0005"); break;
            case '\x06': APPEND_STRING("\\u0006"); break;
            case '\x07': APPEND_STRING("\\u0007"); break;
            /* '\x08' duplicate: '\b' */
            /* '\x09' duplicate: '\t' */
            /* '\x0a' duplicate: '\n' */
            case '\x0b': APPEND_STRING("\\u000b"); break;
            /* '\x0c' duplicate: '\f' */
            /* '\x0d' duplicate: '\r' */
            case '\x0e': APPEND_STRING("\\u000e"); break;
            case '\x0f': APPEND_STRING("\\u000f"); break;
            case '\x10': APPEND_STRING("\\u0010"); break;
            case '\x11': APPEND_STRING("\\u0011"); break;
            case '\x12': APPEND_STRING("\\u0012"); break;
            case '\x13': APPEND_STRING("\\u0013"); break;
            case '\x14': APPEND_STRING("\\u0014"); break;
            case '\x15': APPEND_STRING("\\u0015"); break;
            case '\x16': APPEND_STRING("\\u0016"); break;
            case '\x17': APPEND_STRING("\\u0017"); break;
            case '\x18': APPEND_STRING("\\u0018"); break;
            case '\x19': APPEND_STRING("\\u0019"); break;
            case '\x1a': APPEND_STRING("\\u001a"); break;
            case '\x1b': APPEND_STRING("\\u001b"); break;
            case '\x1c': APPEND_STRING("\\u001c"); break;
            case '\x1d': APPEND_STRING("\\u001d"); break;
            case '\x1e': APPEND_STRING("\\u001e"); break;
            case '\x1f': APPEND_STRING("\\u001f"); break;
            default:
                if (buf != NULL) {
                    buf[0] = c;
                    buf += 1;
                }
                written_total += 1;
                break;
        }
    }
    APPEND_STRING("\"");
    return written_total;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r13
movq %rdi, %r14
callq 0x1110
movq %rax, %r15
leaq 0xa8e(%rip), %rsi       # 0x54d3
movq %r13, %rdi
callq 0x49b7
movl %eax, %ebp
pushq $-0x1
popq %rax
testl %ebp, %ebp
js 0x4c67
movl %ebp, %r12d
addq %r13, %r12
testq %r13, %r13
cmoveq %r13, %r12
xorl %r13d, %r13d
leaq 0x953(%rip), %rbx       # 0x53c4
cmpq %r13, %r15
je 0x4c49
movzbl (%r14,%r13), %eax
cmpq $0x2f, %rax
ja 0x4a9a
movslq (%rbx,%rax,4), %rcx
addq %rbx, %rcx
jmpq *%rcx
leaq 0xa55(%rip), %rsi       # 0x54ea
jmp 0x4c20
cmpl $0x5c, %eax
jne 0x4aae
movq %r12, %rdi
leaq 0xa2c(%rip), %rsi       # 0x54d5
jmp 0x4c23
testq %r12, %r12
je 0x4c42
movb %al, (%r12)
incq %r12
jmp 0x4c45
leaq 0xa08(%rip), %rsi       # 0x54d2
jmp 0x4c20
leaq 0xa02(%rip), %rsi       # 0x54d8
jmp 0x4c20
leaq 0xa86(%rip), %rsi       # 0x5568
jmp 0x4c20
leaq 0xa96(%rip), %rsi       # 0x5584
jmp 0x4c20
leaq 0xaa6(%rip), %rsi       # 0x55a0
jmp 0x4c20
leaq 0xa69(%rip), %rsi       # 0x556f
jmp 0x4c20
leaq 0x9cc(%rip), %rsi       # 0x54de
jmp 0x4c20
leaq 0xa27(%rip), %rsi       # 0x5545
jmp 0x4c20
leaq 0xa06(%rip), %rsi       # 0x5530
jmp 0x4c20
leaq 0x9ec(%rip), %rsi       # 0x5522
jmp 0x4c20
leaq 0x9a5(%rip), %rsi       # 0x54e7
jmp 0x4c20
leaq 0x9db(%rip), %rsi       # 0x5529
jmp 0x4c20
leaq 0x9c1(%rip), %rsi       # 0x551b
jmp 0x4c20
leaq 0xa17(%rip), %rsi       # 0x557d
jmp 0x4c20
leaq 0x9e8(%rip), %rsi       # 0x555a
jmp 0x4c20
leaq 0x988(%rip), %rsi       # 0x5506
jmp 0x4c20
leaq 0x9b4(%rip), %rsi       # 0x553e
jmp 0x4c20
leaq 0x9bd(%rip), %rsi       # 0x5553
jmp 0x4c20
leaq 0x956(%rip), %rsi       # 0x54f8
jmp 0x4c20
leaq 0x946(%rip), %rsi       # 0x54f1
jmp 0x4c20
leaq 0x92d(%rip), %rsi       # 0x54e1
jmp 0x4c20
leaq 0x957(%rip), %rsi       # 0x5514
jmp 0x4c20
leaq 0x939(%rip), %rsi       # 0x54ff
jmp 0x4c20
leaq 0x915(%rip), %rsi       # 0x54e4
jmp 0x4c20
leaq 0x903(%rip), %rsi       # 0x54db
jmp 0x4c20
leaq 0x9b1(%rip), %rsi       # 0x5592
jmp 0x4c20
leaq 0x923(%rip), %rsi       # 0x550d
jmp 0x4c20
leaq 0x998(%rip), %rsi       # 0x558b
jmp 0x4c20
leaq 0x93b(%rip), %rsi       # 0x5537
jmp 0x4c20
leaq 0x95c(%rip), %rsi       # 0x5561
jmp 0x4c20
leaq 0x968(%rip), %rsi       # 0x5576
jmp 0x4c20
leaq 0x935(%rip), %rsi       # 0x554c
jmp 0x4c20
leaq 0x979(%rip), %rsi       # 0x5599
movq %r12, %rdi
callq 0x49b7
testl %eax, %eax
js 0x4c64
movl %eax, %ecx
addq %r12, %rcx
testq %r12, %r12
cmovneq %rcx, %r12
addl %eax, %ebp
incq %r13
jmp 0x4a71
xorl %r12d, %r12d
incl %ebp
jmp 0x4c3a
leaq 0x883(%rip), %rsi       # 0x54d3
movq %r12, %rdi
callq 0x49b7
addl %eax, %ebp
testl %eax, %eax
pushq $-0x1
popq %rax
cmovnsl %ebp, %eax
jmp 0x4c67
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq