// File: /workspace/github_c_makefile_star2_O1/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 $0x58, %rsp
movq %rdx, %r8
movq %rdi, %r9
movabsq $-0x100000000, %r11     # imm = 0xFFFFFFFF00000000
movq $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
movq 0x10(%rdi), %rcx
movq 0x30(%rdi), %rax
movq 0x8(%rdi), %rdx
addq %rax, %rdx
movq %rdx, 0x28(%rsp)
leaq (%rax,%rcx), %r10
movq %r10, 0x8(%rsp)
movq %r10, 0x8(%r8)
leaq -0x1(%rax,%rcx), %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl $0xffffff00, %edx       # imm = 0xFFFFFF00
movq %r11, %rsi
movabsq $0x100000000, %rbx      # imm = 0x100000000
movzbl 0x1(%r12), %edi
testl %edi, %edi
je 0x573f
incq %r12
cmpl $0x5c, %edi
je 0x5481
addq %rbx, %rsi
incl %eax
addl $0x100, %edx            # imm = 0x100
cmpl $0x22, %edi
jne 0x5439
sarq $0x20, %rsi
addq %rsi, %rcx
movq %rcx, 0x10(%r9)
movb $0x0, (%r10,%rsi)
movl $0xef, %ecx
andl (%r8), %ecx
addl %edx, %ecx
movl %ecx, (%r8)
jmp 0x57cb
leaq 0x8(%rsp), %rax
movq %r12, (%rax)
leaq 0x4f6c(%rip), %rdx      # 0xa3fc
movq %r8, 0x10(%rsp)
movq %r9, 0x18(%rsp)
movq %r12, %rbx
movl $0x2, %r14d
movq $-0x1, %r13
movl $0x1, %r15d
movq %r11, %rbp
movzbl -0x1(%rbx,%r15), %eax
testl %eax, %eax
je 0x573f
incq %r14
incq %r13
movabsq $0x100000000, %rcx      # imm = 0x100000000
addq %rcx, %rbp
incq %r15
cmpl $0x5c, %eax
je 0x54e6
cmpl $0x22, %eax
jne 0x54b3
jmp 0x569d
leaq (%rbx,%r15), %r12
movb -0x1(%rbx,%r15), %cl
movzbl %cl, %eax
cmpl $0x61, %eax
movq %r10, 0x20(%rsp)
jle 0x5515
leal -0x6e(%rax), %ecx
cmpl $0x8, %ecx
ja 0x5560
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movb $0xa, %r15b
jmp 0x5620
cmpl $0x26, %eax
jg 0x553d
cmpl $0xa, %eax
je 0x55db
cmpl $0xd, %eax
je 0x5670
cmpl $0x22, %eax
movl %ecx, %r15d
je 0x5620
jmp 0x5707
cmpl $0x27, %eax
je 0x561d
cmpl $0x2f, %eax
movl %ecx, %r15d
je 0x5620
cmpl $0x5c, %eax
je 0x5620
jmp 0x5707
movb $0x8, %r15b
cmpl $0x62, %eax
je 0x5620
cmpl $0x66, %eax
jne 0x5707
movb $0xc, %r15b
jmp 0x5620
movb $0xb, %r15b
jmp 0x5620
movb $0x9, %r15b
jmp 0x5620
movb $0xd, %r15b
jmp 0x5620
addq %rbx, %r13
movq 0x8(%rsp), %r14
sarq $0x20, %rbp
movq %r14, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x11a0
addq %r14, %rbp
movq %rbp, 0x8(%rsp)
movq %r13, %rdi
movq 0x28(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x79c3
testl %eax, %eax
je 0x57da
movl %eax, %eax
addq %rax, %r13
movq %r13, %r12
jmp 0x564b
movq 0x8(%rsp), %r13
sarq $0x20, %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
movq %r9, %r14
movq %r10, %r15
movq %r11, %rbx
callq 0x11a0
leaq 0x4dfa(%rip), %rdx      # 0xa3fc
movq %rbx, %r11
movq %r15, %r10
movq %r14, %r9
movq 0x10(%rsp), %r8
addq %r13, %rbp
movq %rbp, 0x8(%rsp)
jmp 0x549a
movl %ecx, %r15d
movq 0x8(%rsp), %r13
sarq $0x20, %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x11a0
leaq 0x1(,%rbp), %rax
addq %r13, %rax
movq %rax, 0x8(%rsp)
movb %r15b, -0x1(%rax)
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
movq 0x20(%rsp), %r10
movabsq $-0x100000000, %r11     # imm = 0xFFFFFFFF00000000
leaq 0x4d91(%rip), %rdx      # 0xa3fc
jmp 0x549a
movq 0x8(%rsp), %r13
sarq $0x20, %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x11a0
addq %r13, %rbp
movq %rbp, 0x8(%rsp)
addq %rbx, %r14
cmpb $0xa, (%rbx,%r15)
cmoveq %r14, %r12
jmp 0x564b
movq 0x8(%rsp), %r15
movq %rbp, %r13
sarq $0x20, %r13
movq %r15, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %r10, %r12
movq %r11, %r14
callq 0x11a0
leaq (%r15,%r13), %rax
movq %rax, 0x8(%rsp)
movb $0x0, (%r15,%r13)
imulq %r12, %r14
shlq $0x20, %rbx
addq %rbp, %rbx
addq %r14, %rbx
sarq $0x20, %rbx
movq 0x18(%rsp), %rcx
addq %rbx, 0x10(%rcx)
movq 0x10(%rsp), %rsi
movzbl (%rsi), %ecx
subl %r12d, %eax
movl %eax, %edx
shll $0x8, %edx
orl %ecx, %edx
orl $0x10, %edx
movl %edx, (%rsi)
andl $0xffffff, %eax         # imm = 0xFFFFFF
jmp 0x57cb
leaq 0x4d4e(%rip), %rdi      # 0xa45c
leaq 0x5108(%rip), %rsi      # 0xa81d
movl $0xc5c, %edx            # imm = 0xC5C
xorl %eax, %eax
callq 0x10d0
addq %r14, %rbx
leaq 0x501c(%rip), %rdi      # 0xa747
movsbl (%rbx), %esi
xorl %eax, %eax
callq 0x10d0
movq 0x10(%rsp), %r8
movq 0x18(%rsp), %r9
xorps %xmm0, %xmm0
movups %xmm0, (%r8)
movq 0x30(%r9), %rsi
testq %rsi, %rsi
je 0x57a0
leaq 0x30(%rsp), %rbx
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
addq 0x10(%r9), %rsi
movl $0x1f, %edx
movq %rbx, %rdi
callq 0x1050
leaq 0x4ce9(%rip), %rdi      # 0xa45c
leaq 0x50a3(%rip), %rsi      # 0xa81d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10d0
leaq 0x4f4f(%rip), %rdi      # 0xa6dc
leaq 0x4f57(%rip), %rsi      # 0xa6eb
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10d0
jmp 0x57c6
leaq 0x4cb5(%rip), %rdi      # 0xa45c
leaq 0x506f(%rip), %rsi      # 0xa81d
movl $0xc72, %edx            # imm = 0xC72
xorl %eax, %eax
callq 0x10d0
leaq 0x4f2a(%rip), %rdi      # 0xa6eb
callq 0x1070
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4c7b(%rip), %rdi      # 0xa45c
leaq 0x5035(%rip), %rsi      # 0xa81d
movl $0xc55, %edx            # imm = 0xC55
xorl %eax, %eax
callq 0x10d0
addq %r15, %rbx
leaq 0x4f2e(%rip), %rdi      # 0xa72c
jmp 0x572b