// File: /workspace/github_c_makefile_star2_O3/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
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
movabsq $0x100000000, %rdi      # imm = 0x100000000
movzbl 0x1(%r13), %r8d
testl %r8d, %r8d
je 0x5a6a
incq %r13
cmpl $0x5c, %r8d
je 0x582a
addq %rdi, %rsi
incl %eax
addl $0x100, %edx            # imm = 0x100
cmpl $0x22, %r8d
jne 0x57d9
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 0x5af7
leaq 0x8(%rsp), %rax
movq %r13, (%rax)
movb $0x5c, %al
movq %r13, %rsi
cmpb $0x5c, %al
je 0x585a
movzbl %al, %eax
testl %eax, %eax
je 0x5a6a
incq %r13
cmpl $0x22, %eax
je 0x59e1
movq %r13, %rbp
jmp 0x5916
leaq 0x2(%r13), %rbp
movb 0x1(%r13), %bl
movzbl %bl, %eax
cmpl $0x61, %eax
jle 0x5886
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x58bb
leaq 0x4b83(%rip), %rdx      # 0xa3fc
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movb $0xa, %bl
jmp 0x58d9
cmpl $0x26, %eax
jg 0x58a7
cmpl $0xa, %eax
je 0x5966
cmpl $0xd, %eax
je 0x599e
cmpl $0x22, %eax
je 0x58d9
jmp 0x5a37
cmpl $0x27, %eax
je 0x58d9
cmpl $0x2f, %eax
je 0x58d9
cmpl $0x5c, %eax
je 0x58d9
jmp 0x5a37
movb $0x8, %bl
cmpl $0x62, %eax
je 0x58d9
cmpl $0x66, %eax
jne 0x5a37
movb $0xc, %bl
jmp 0x58d9
movb $0xb, %bl
jmp 0x58d9
movb $0x9, %bl
jmp 0x58d9
movb $0xd, %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 0x5837
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 0x794f
testl %eax, %eax
je 0x5b06
movl %eax, %eax
addq %rax, %r13
movq %r13, %rbp
movq %r13, %rsi
jmp 0x5916
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 0x5913
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 0x5913
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 0x5af7
leaq 0x4a1e(%rip), %rdi      # 0xa45c
leaq 0x4dd8(%rip), %rsi      # 0xa81d
movl $0xc5c, %edx            # imm = 0xC5C
xorl %eax, %eax
callq 0x10c0
addq $0x3, %r13
leaq 0x4ceb(%rip), %rdi      # 0xa747
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 0x5acc
leaq 0x20(%rsp), %rbx
movaps %xmm0, 0x10(%rbx)
addq 0x10(%r14), %rsi
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x1050
leaq 0x49bd(%rip), %rdi      # 0xa45c
leaq 0x4d77(%rip), %rsi      # 0xa81d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10c0
leaq 0x4c23(%rip), %rdi      # 0xa6dc
leaq 0x4c2b(%rip), %rsi      # 0xa6eb
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x5af2
leaq 0x4989(%rip), %rdi      # 0xa45c
leaq 0x4d43(%rip), %rsi      # 0xa81d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10c0
leaq 0x4bfe(%rip), %rdi      # 0xa6eb
callq 0x1060
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x494f(%rip), %rdi      # 0xa45c
leaq 0x4d09(%rip), %rsi      # 0xa81d
movl $0xc55, %edx            # imm = 0xC55
xorl %eax, %eax
callq 0x10c0
leaq 0x4c05(%rip), %rdi      # 0xa72c
jmp 0x5a5f