// File: /workspace/github_c_makefile_star2_O2/lengjingzju[P]json/json.c
// Function: json_parse_string
static int _json_parse_string(json_parse_t *parse_ptr, char end_ch, json_string_t *jstr, json_mem_mgr_t *mgr)
{
    char *ptr = NULL, *str = NULL;
    int escaped = 0;
    int len = 0, total = 0;

    memset(jstr, 0, sizeof(json_string_t));
    if (unlikely((total = _parse_strlen(parse_ptr, end_ch, &escaped)) < 0)) {
        return -1;
    }
    len = total;
    _get_parse_ptr(parse_ptr, 0, total, &str);

    if (unlikely((ptr = (char *)_parse_alloc(parse_ptr, len + 1, mgr)) == NULL)) {
        JsonErr("malloc failed!\n");
        return -1;
    }

    if (likely(escaped != 1)) {
        memcpy(ptr, str, len);
        ptr[len] = '\0';
    } else {
        if (unlikely((len = _parse_strcpy(ptr, str, len)) < 0)) {
            JsonErr("_parse_strcpy failed!\n");
            if (parse_ptr->mem == &s_invalid_json_mem)
                json_free(ptr);
            goto err;
        }
    }
    _UPDATE_PARSE_OFFSET(total);

    jstr->escaped = escaped != 0;
    jstr->len = len;
    jstr->str = ptr;
    return len;

err:
    JsonPareseErr("parse string failed!");
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, %r12
andq $0x0, 0x8(%rsp)
leaq 0x4(%rsp), %rsi
andl $0x0, (%rsi)
movq %rdx, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
callq 0x5cd1
pushq $-0x1
popq %rbx
testl %eax, %eax
js 0x3b40
movl %eax, %r13d
movl %eax, %ebp
leaq 0x8(%rsp), %rcx
movq %r14, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x5b5b
leal 0x1(%r13), %esi
movq %r14, %rdi
movq %r12, %rdx
callq 0x5e62
testq %rax, %rax
je 0x3b51
movq %rax, %r12
movl 0x4(%rsp), %ebx
movq 0x8(%rsp), %rsi
movq %rax, %rdi
cmpl $0x1, %ebx
je 0x3b79
movq %rbp, %rdx
callq 0x1140
movb $0x0, (%r12,%rbp)
addq %rbp, 0x10(%r14)
xorl %eax, %eax
testl %ebx, %ebx
setne %al
movl $0xef, %ecx
andl (%r15), %ecx
shll $0x4, %eax
orl %eax, %ecx
movl %r13d, %eax
shll $0x8, %eax
orl %ecx, %eax
movl %eax, (%r15)
movq %r12, 0x8(%r15)
movl %r13d, %ebx
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4904(%rip), %rdi      # 0x845c
leaq 0x4b6a(%rip), %rsi      # 0x86c9
movl $0xa14, %edx            # imm = 0xA14
xorl %eax, %eax
callq 0x10c0
leaq 0x4dee(%rip), %rdi      # 0x8960
callq 0x1060
jmp 0x3b40
movl %r13d, %edx
callq 0x5e82
movl %eax, %r13d
testl %eax, %eax
jns 0x3b16
leaq 0x48cd(%rip), %rdi      # 0x845c
leaq 0x4b33(%rip), %rsi      # 0x86c9
movl $0xa1d, %edx            # imm = 0xA1D
xorl %eax, %eax
callq 0x10c0
leaq 0x4d93(%rip), %rdi      # 0x893c
callq 0x1060
leaq 0xa673(%rip), %rax      # 0xe228
cmpq %rax, 0x38(%r14)
jne 0x3bc3
movq %r12, %rdi
callq 0x1030
movq 0x30(%r14), %rsi
testq %rsi, %rsi
je 0x3c1c
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r15
movaps %xmm0, 0x10(%r15)
addq 0x10(%r14), %rsi
pushq $0x1f
popq %rdx
movq %r15, %rdi
callq 0x1050
leaq 0x486d(%rip), %rdi      # 0x845c
leaq 0x4ad3(%rip), %rsi      # 0x86c9
movl $0xa2b, %edx            # imm = 0xA2B
xorl %eax, %eax
callq 0x10c0
leaq 0x4ad3(%rip), %rdi      # 0x86dc
leaq 0x4adb(%rip), %rsi      # 0x86eb
movq %r15, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x3c42
leaq 0x4839(%rip), %rdi      # 0x845c
leaq 0x4a9f(%rip), %rsi      # 0x86c9
movl $0xa2b, %edx            # imm = 0xA2B
xorl %eax, %eax
callq 0x10c0
leaq 0x4aae(%rip), %rdi      # 0x86eb
callq 0x1060
pushq $-0x1
popq %rbx
jmp 0x3b40