// File: /workspace/github_c_makefile_star2_O2/lengjingzju[P]json/json.c
// Function: json_parse_string_reuse
static int _json_parse_string_reuse(json_parse_t *parse_ptr, char end_ch UNUSED_END_CH, json_string_t *jstr, json_mem_mgr_t *mgr UNUSED_ATTR)
{
    char *str = NULL, *end = NULL, *last = NULL, *bak = NULL, *ptr= NULL;
    int len = 0, seq_len = 0, size = 0;
    char c = '\0', ch = '\0';
    int escaped = 0;

    memset(jstr, 0, sizeof(json_string_t));
    end = parse_ptr->str + parse_ptr->size;
    str = parse_ptr->str + parse_ptr->offset;
    bak = str;
    ptr = str;
    jstr->str = str;

    while (1) {
        switch ((c = *str++)) {
        case '\"':
#if JSON_PARSE_SPECIAL_QUOTES
        case '\'':
        case ':':
            if (c == end_ch)
#endif
            {
                len = (int)(str - bak - 1);
                _UPDATE_PARSE_OFFSET(len);
                ptr[len] = '\0';
                jstr->escaped = escaped != 0;
                jstr->len = len;
                return len;
            }
#if JSON_PARSE_SPECIAL_QUOTES
            if (c == '\"' && !escaped)
                escaped = -1;
            break;
#endif

        case '\0':
            goto err;
        case '\\':
            --str;
            last = str;
            ptr += str - bak;
            goto next;
#if !JSON_PARSE_SPECIAL_CHAR
        case '\b': case '\f': case '\n': case '\r': case '\t': case '\v':
            JsonErr("tab and linebreak can't be existed in string in standard json!\n");
            goto err;
#endif
        default:
            break;
        }
    }

next:
    while (1) {
        switch ((c = *str++)) {
        case '\"':
#if JSON_PARSE_SPECIAL_QUOTES
        case '\'':
        case ':':
            if (c == end_ch)
#endif
            {
                size = (int)(str - last - 1);
                memmove(ptr, last, size);
                ptr += size;
                *ptr = '\0';
                len = (int)(str - bak - 1);
                _UPDATE_PARSE_OFFSET(len);
                jstr->escaped = 1;
                jstr->len = (uint32_t)(ptr - bak);
                return jstr->len;
            }
            break;

        case '\0':
            goto err;
        case '\\':
            switch ((*str++)) {
            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;
            case '\"': ch = '\"'; break;
            case '\'': ch = '\''; break;
            case '\\': ch = '\\'; break;
            case '/' : ch = '/' ; break;
#if JSON_PARSE_SPECIAL_CHAR
            case '\r':
                size = (int)(str - last - 2);
                memmove(ptr, last, size);
                ptr += size;
                if (*str == '\n')
                    ++str;
                last = str;
                continue;

            case '\n':
                size = (int)(str - last - 2);
                memmove(ptr, last, size);
                ptr += size;
                last = str;
                continue;
#endif
            case 'u' :
                str -= 2;
                size = (int)(str - last);
                memmove(ptr, last, size);
                ptr += size;
                if (unlikely((seq_len = utf16_literal_to_utf8((unsigned char*)str,
                    (unsigned char*)end, (unsigned char**)&ptr)) == 0)) {
                    JsonErr("invalid utf16 code(\\u%c)!\n", str[2]);
                    goto err;
                }
                str += seq_len;
                last = str;
                continue;
            default :
                JsonErr("invalid escape character(\\%c)!\n", str[1]);
                goto err;
            }

            size = (int)(str - last - 2);
            memmove(ptr, last, size);
            ptr += size;
            *ptr++ = ch;
            last = str;
            break;
#if !JSON_PARSE_SPECIAL_CHAR
        case '\b': case '\f': case '\n': case '\r': case '\t': case '\v':
            JsonErr("tab and linebreak can't be existed in string in standard json!\n");
            goto err;
#endif
        default:
            break;
        }
    }

err:
    memset(jstr, 0, sizeof(json_string_t));
    JsonPareseErr("parse string failed!");
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq 0x10(%rdi), %rcx
movq 0x30(%rdi), %rax
movq 0x8(%rdi), %r15
addq %rax, %r15
leaq (%rax,%rcx), %rsi
movq %rdx, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
movq %rsi, 0x8(%rdx)
leaq -0x1(%rax,%rcx), %r13
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
pushq $-0x1
popq %rax
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
movabsq $0x100000000, %rdi      # imm = 0x100000000
movzbl 0x1(%r13), %r8d
testl %r8d, %r8d
je 0x43f8
incq %r13
cmpl $0x5c, %r8d
je 0x41c7
addq %rdi, %rsi
incl %eax
addl $0x100, %edx            # imm = 0x100
cmpl $0x22, %r8d
jne 0x4176
sarq $0x20, %rsi
addq %rsi, %rcx
movq %rcx, 0x10(%r14)
movq 0x18(%rsp), %rcx
movb $0x0, (%rcx,%rsi)
movl $0xef, %ecx
movq 0x10(%rsp), %rsi
andl (%rsi), %ecx
addl %edx, %ecx
movl %ecx, (%rsi)
jmp 0x4481
leaq 0x8(%rsp), %rax
movq %r13, (%rax)
movb $0x5c, %al
movq %r13, %rsi
cmpb $0x5c, %al
je 0x41f7
movzbl %al, %eax
testl %eax, %eax
je 0x43f8
incq %r13
cmpl $0x22, %eax
je 0x436f
movq %r13, %rbp
jmp 0x42ec
leaq 0x2(%r13), %rbp
movb 0x1(%r13), %bl
movzbl %bl, %eax
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
jbe 0x424c
cmpl $0xa, %eax
je 0x42f7
cmpl $0xd, %eax
je 0x432c
cmpl $0x22, %eax
je 0x42af
cmpl $0x27, %eax
je 0x42af
cmpl $0x2f, %eax
je 0x42af
cmpl $0x5c, %eax
je 0x42af
movb $0x8, %bl
cmpl $0x62, %eax
je 0x42af
cmpl $0x66, %eax
jne 0x43c5
movb $0xc, %bl
jmp 0x42af
leaq 0x41c1(%rip), %rdx      # 0x8414
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movb $0xa, %bl
jmp 0x42af
movb $0x9, %bl
jmp 0x42af
movl %r13d, %eax
subl %esi, %eax
movq 0x8(%rsp), %r12
movslq %eax, %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1190
addq %rbx, %r12
movq %r12, 0x8(%rsp)
movq %r13, %rdi
movq %r15, %rsi
leaq 0x8(%rsp), %rdx
callq 0x6117
testl %eax, %eax
je 0x4490
movl %eax, %eax
addq %rax, %r13
movq %r13, %rbp
movq %r13, %rsi
jmp 0x42ec
movb $0xd, %bl
jmp 0x42af
movb $0xb, %bl
movl %ebp, %r12d
subl %esi, %r12d
movq 0x8(%rsp), %r13
shlq $0x20, %r12
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
addq %rax, %r12
sarq $0x20, %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x1190
leaq (%r12,%r13), %rax
incq %rax
movq %rax, 0x8(%rsp)
movb %bl, -0x1(%rax)
movq %rbp, %rsi
movb (%rbp), %al
movq %rbp, %r13
jmp 0x41d4
movl %ebp, %r12d
subl %esi, %r12d
movq 0x8(%rsp), %r13
shlq $0x20, %r12
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
addq %rax, %r12
sarq $0x20, %r12
movq %r13, %rdi
movq %r12, %rdx
callq 0x1190
addq %r13, %r12
movq %r12, 0x8(%rsp)
jmp 0x42e9
movl %ebp, %ebx
subl %esi, %ebx
movq 0x8(%rsp), %r12
shlq $0x20, %rbx
movabsq $-0x200000000, %rax     # imm = 0xFFFFFFFE00000000
addq %rax, %rbx
sarq $0x20, %rbx
movq %r12, %rdi
movq %rbx, %rdx
callq 0x1190
addq %r12, %rbx
movq %rbx, 0x8(%rsp)
cmpb $0xa, 0x2(%r13)
leaq 0x3(%r13), %rax
cmoveq %rax, %rbp
jmp 0x42e9
movl %esi, %eax
notl %eax
addl %r13d, %eax
movq 0x8(%rsp), %r15
movslq %eax, %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x1190
leaq (%r15,%r12), %rax
movb $0x0, (%r15,%r12)
movq 0x18(%rsp), %rdx
movl %edx, %ecx
notl %ecx
addl %r13d, %ecx
movslq %ecx, %rcx
addq %rcx, 0x10(%r14)
movq 0x10(%rsp), %rsi
movzbl (%rsi), %ecx
subl %edx, %eax
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
orl $0x10, %edx
movl %edx, (%rsi)
andl $0xffffff, %eax         # imm = 0xFFFFFF
jmp 0x4481
leaq 0x4090(%rip), %rdi      # 0x845c
leaq 0x444a(%rip), %rsi      # 0x881d
movl $0xc5c, %edx            # imm = 0xC5C
xorl %eax, %eax
callq 0x10c0
addq $0x3, %r13
leaq 0x435d(%rip), %rdi      # 0x8747
movq %r13, %rbp
movsbl (%rbp), %esi
xorl %eax, %eax
callq 0x10c0
xorps %xmm0, %xmm0
movq 0x10(%rsp), %rax
movups %xmm0, (%rax)
movq 0x30(%r14), %rsi
testq %rsi, %rsi
je 0x4458
leaq 0x20(%rsp), %rbx
movaps %xmm0, 0x10(%rbx)
addq 0x10(%r14), %rsi
pushq $0x1f
popq %rdx
movq %rbx, %rdi
callq 0x1050
leaq 0x4031(%rip), %rdi      # 0x845c
leaq 0x43eb(%rip), %rsi      # 0x881d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10c0
leaq 0x4297(%rip), %rdi      # 0x86dc
leaq 0x429f(%rip), %rsi      # 0x86eb
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x447e
leaq 0x3ffd(%rip), %rdi      # 0x845c
leaq 0x43b7(%rip), %rsi      # 0x881d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10c0
leaq 0x4272(%rip), %rdi      # 0x86eb
callq 0x1060
pushq $-0x1
popq %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3fc5(%rip), %rdi      # 0x845c
leaq 0x437f(%rip), %rsi      # 0x881d
movl $0xc55, %edx            # imm = 0xC55
xorl %eax, %eax
callq 0x10c0
leaq 0x427b(%rip), %rdi      # 0x872c
jmp 0x43ed