// File: /workspace/github_c_makefile_star2_O0/lengjingzju[P]json/json.c
// Function: json_print_string
static int _json_print_string(json_print_t *print_ptr, json_string_t *jstr)
{
#define _JSON_PRINT_SEGMENT()     do {  \
    size = str - bak - 1;               \
    memcpy(print_ptr->cur, bak, size);  \
    print_ptr->cur += size;             \
    bak = str;                          \
} while(0)

    char ch = '\0';
    size_t len = 0, size = 0, alloced = 0;
    const char *str = NULL, *bak = NULL, *end = NULL;

    str = jstr->str;
    len = jstr->len;
    end = str + len;
    if (likely(!jstr->escaped)) {
        alloced = len + 3;
        _PRINT_PTR_REALLOC(alloced);
        *print_ptr->cur++ = '\"';
        memcpy(print_ptr->cur, str, len);
        print_ptr->cur += len;
        *print_ptr->cur++ = '\"';
        return 0;
    }

#if JSON_PRINT_UTF16_SUPPORT
    alloced = (len << 2) + (len << 1) + 3;
#else
    alloced = (len << 1) + 3;
#endif
    _PRINT_PTR_REALLOC(alloced);
    *print_ptr->cur++ = '\"';

    bak = str;
    while (str < end) {
        switch ((*str++)) {
        case '\"': ch = '\"'; break;
        case '\\': ch = '\\'; break;
        case '\b': ch = 'b' ; break;
        case '\f': ch = 'f' ; break;
        case '\n': ch = 'n' ; break;
        case '\r': ch = 'r' ; break;
        case '\t': ch = 't' ; break;
        case '\v': ch = 'v' ; break;
        default:
#if JSON_PRINT_UTF16_SUPPORT
            {
                unsigned char uc = (unsigned char)(*(str-1));
                if (uc < ' ') {
                    _JSON_PRINT_SEGMENT();
                    *print_ptr->cur++ = '\\';
                    *print_ptr->cur++ = 'u';
                    *print_ptr->cur++ = '0';
                    *print_ptr->cur++ = '0';
                    *print_ptr->cur++ = hex_array[uc >> 4 & 0xf];
                    *print_ptr->cur++ = hex_array[uc & 0xf];
                }
            }
#endif
            continue;
        }

        _JSON_PRINT_SEGMENT();
        *print_ptr->cur++ = '\\';
        *print_ptr->cur++ = ch;
    }

    ++str;
    _JSON_PRINT_SEGMENT();
    *print_ptr->cur++ = '\"';
    return 0;
err:
    JsonErr("malloc failed!\n");
    return -1;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movq %rsi, 0x40(%rsp)
movb $0x0, 0x3f(%rsp)
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq $0x0, 0x8(%rsp)
movq 0x40(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movl (%rax), %eax
shrl $0x8, %eax
movl %eax, %eax
movq %rax, 0x30(%rsp)
movq 0x18(%rsp), %rax
addq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rax
movl (%rax), %eax
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5d0d
movq 0x30(%rsp), %rax
addq $0x3, %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rdx
movq 0x8(%rdx), %rdx
subq %rdx, %rax
subq %rax, %rcx
xorl %eax, %eax
cmpq 0x20(%rsp), %rcx
movb %al, 0x7(%rsp)
jae 0x5c8c
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq *%rax
cmpl $0x0, %eax
setl %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5ca6
jmp 0x5f53
jmp 0x5ca8
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movb $0x22, (%rax)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rsp), %rsi
movq 0x30(%rsp), %rdx
callq 0x1150
movq 0x30(%rsp), %rcx
movq 0x48(%rsp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movb $0x22, (%rax)
movl $0x0, 0x54(%rsp)
jmp 0x5f85
movq 0x30(%rsp), %rax
shlq %rax
addq $0x3, %rax
movq %rax, 0x20(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rcx
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x48(%rsp), %rdx
movq 0x8(%rdx), %rdx
subq %rdx, %rax
subq %rax, %rcx
xorl %eax, %eax
cmpq 0x20(%rsp), %rcx
movb %al, 0x6(%rsp)
jae 0x5d6b
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x48(%rsp), %rdi
movq 0x20(%rsp), %rsi
callq *%rax
cmpl $0x0, %eax
setl %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x5d85
jmp 0x5f53
jmp 0x5d87
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movb $0x22, (%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
cmpq 0x8(%rsp), %rax
jae 0x5eda
movq 0x18(%rsp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, 0x18(%rsp)
movsbl (%rax), %eax
movl %eax, (%rsp)
subl $0x8, %eax
je 0x5e29
jmp 0x5dd5
movl (%rsp), %eax
subl $0x9, %eax
je 0x5e45
jmp 0x5ddf
movl (%rsp), %eax
subl $0xa, %eax
je 0x5e37
jmp 0x5de9
movl (%rsp), %eax
subl $0xb, %eax
je 0x5e4c
jmp 0x5df3
movl (%rsp), %eax
subl $0xc, %eax
je 0x5e30
jmp 0x5dfd
movl (%rsp), %eax
subl $0xd, %eax
je 0x5e3e
jmp 0x5e07
movl (%rsp), %eax
subl $0x22, %eax
je 0x5e1b
jmp 0x5e11
movl (%rsp), %eax
subl $0x5c, %eax
je 0x5e22
jmp 0x5e53
movb $0x22, 0x3f(%rsp)
jmp 0x5e58
movb $0x5c, 0x3f(%rsp)
jmp 0x5e58
movb $0x62, 0x3f(%rsp)
jmp 0x5e58
movb $0x66, 0x3f(%rsp)
jmp 0x5e58
movb $0x6e, 0x3f(%rsp)
jmp 0x5e58
movb $0x72, 0x3f(%rsp)
jmp 0x5e58
movb $0x74, 0x3f(%rsp)
jmp 0x5e58
movb $0x76, 0x3f(%rsp)
jmp 0x5e58
jmp 0x5da8
jmp 0x5e5a
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1150
movq 0x28(%rsp), %rcx
movq 0x48(%rsp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movb $0x5c, (%rax)
movb 0x3f(%rsp), %cl
movq 0x48(%rsp), %rdx
movq 0x10(%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, 0x10(%rdx)
movb %cl, (%rax)
jmp 0x5da8
movq 0x18(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x10(%rsp), %rcx
subq %rcx, %rax
subq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x10(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x1150
movq 0x28(%rsp), %rcx
movq 0x48(%rsp), %rax
addq 0x10(%rax), %rcx
movq %rcx, 0x10(%rax)
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movb $0x22, (%rax)
movl $0x0, 0x54(%rsp)
jmp 0x5f85
jmp 0x5f55
leaq 0xaa98(%rip), %rdi      # 0x109f4
leaq 0xadb9(%rip), %rsi      # 0x10d1c
movl $0x62a, %edx            # imm = 0x62A
movb $0x0, %al
callq 0x10c0
leaq 0xaa90(%rip), %rdi      # 0x10a06
movb $0x0, %al
callq 0x10c0
movl $0xffffffff, 0x54(%rsp) # imm = 0xFFFFFFFF
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nop