// File: /workspace/github_c_makefile_star2_O3/lengjingzju[P]json/json.c
// Function: json_parse_value
static int _json_parse_value(json_parse_t *parse_ptr, json_object **root)
{
    json_string_t jkey = {0};
    char *str = NULL;
    json_object *item = NULL, *parent = NULL;
    json_object **item_array = NULL;
    int item_depth = -1, item_total = 0;

    goto next3;

next1:
    if (unlikely(item_depth >= item_total - 1)) {
        item_total += JSON_ITEM_NUM_PLUS_DEF;
        json_object **new_array = (json_object **)json_realloc(item_array, sizeof(json_object *) * item_total);
        if (new_array) {
            item_array = new_array;
        } else {
            JsonErr("malloc failed!\n");
            json_free(item_array);
            item_array = NULL;
            goto err;
        }
    }
    item_array[++item_depth] = item;
    parent = item;
    *root = *item_array;
    if (parent->type_member == JSON_ARRAY)
        goto next3;

next2:
    if (unlikely(_json_parse_key(parse_ptr, &jkey) < 0)) {
        goto err;
    }

next3:
    if (unlikely((item = (json_object *)_parse_alloc(parse_ptr, sizeof(json_object), &parse_ptr->mem->obj_mgr)) == NULL)) {
        JsonErr("malloc failed!\n");
        goto err;
    }
    memcpy(&item->jkey, &jkey, sizeof(json_string_t));
    memset(&jkey, 0, sizeof(json_string_t));

    parse_ptr->skip_blank(parse_ptr);
    _get_parse_ptr(parse_ptr, 0, 128, &str);

    switch (*str) {
    case '{':
        item->type_member = JSON_OBJECT;
        INIT_JSON_LIST_HEAD(&item->value.head);
        _UPDATE_PARSE_OFFSET(1);

        parse_ptr->skip_blank(parse_ptr);
        _get_parse_ptr(parse_ptr, 0, 1, &str);
        if (likely(*str != '}')) {
            if (parent)
                json_list_add_tail(&item->list, &parent->value.head);
            goto next1;
        } else {
            _UPDATE_PARSE_OFFSET(1);
        }
        break;

    case '[':
        item->type_member = JSON_ARRAY;
        INIT_JSON_LIST_HEAD(&item->value.head);
        _UPDATE_PARSE_OFFSET(1);

        parse_ptr->skip_blank(parse_ptr);
        _get_parse_ptr(parse_ptr, 0, 1, &str);
        if (likely(*str != ']')) {
            if (parent)
                json_list_add_tail(&item->list, &parent->value.head);
            goto next1;
        } else {
            _UPDATE_PARSE_OFFSET(1);
        }
        break;

    default:
        if (_json_parse_single_value(parse_ptr, str, &item->jkey, &item->value) < 0)
            goto err;
        break;
    }

    if (parent) {
        json_list_add_tail(&item->list, &parent->value.head);
        item = NULL;
    }

next4:
    if (likely(item_depth >= 0)) {
        parse_ptr->skip_blank(parse_ptr);
        _get_parse_ptr(parse_ptr, 0, 1, &str);
        if (parent->type_member == JSON_OBJECT) {
            switch (*str) {
            case ',':
                _UPDATE_PARSE_OFFSET(1);
#if !JSON_PARSE_LAST_COMMA
                goto next2;
#else
                parse_ptr->skip_blank(parse_ptr);
                _get_parse_ptr(parse_ptr, 0, 1, &str);
                if (*str != '}')
                    goto next2;
                FALLTHROUGH_ATTR;
#endif
            case '}':
                _UPDATE_PARSE_OFFSET(1);
                if (likely(item_depth > 0)) {
                    parent = item_array[--item_depth];
                    goto next4;
                }
                break;
            default:
                JsonPareseErr("invalid object!");
                goto err;
            }
        } else {
            switch (*str) {
            case ',':
                _UPDATE_PARSE_OFFSET(1);
#if !JSON_PARSE_LAST_COMMA
                goto next3;
#else
                parse_ptr->skip_blank(parse_ptr);
                _get_parse_ptr(parse_ptr, 0, 1, &str);
                if (*str != ']')
                    goto next3;
                FALLTHROUGH_ATTR;
#endif
            case ']':
                _UPDATE_PARSE_OFFSET(1);
                if (likely(item_depth > 0)) {
                    parent = item_array[--item_depth];
                    goto next4;
                }
                break;
            default:
                JsonPareseErr("invalid array!");
                goto err;
            }
        }
    }

    if (item_array) {
        *root = *item_array;
        json_free(item_array);
    } else {
        *root = item;
    }

    return 0;

err:
    if (item_array) {
        *root = *item_array;
        json_free(item_array);
    } else {
        if (!(*root)) {
            *root = item;
            item = NULL;
        }
    }

    if (parse_ptr->mem == &s_invalid_json_mem) {
        if (item)
            json_free(item);
        if (jkey.str)
            json_free(jkey.str);
    }
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, 0x10(%rsp)
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
leaq 0x8(%rsp), %rbp
movq $0x0, (%rbp)
xorl %r13d, %r13d
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
xorl %r15d, %r15d
movq $0x0, 0x18(%rsp)
movq %r13, %r12
movq 0x38(%rbx), %rsi
leaq 0xaf4c(%rip), %rax      # 0x10228
cmpq %rax, %rsi
je 0x52f1
addq $0x8, %rsi
movl $0x28, %edi
callq 0x4033
jmp 0x52fb
movl $0x28, %edi
callq 0x1150
movq %rax, %r13
testq %rax, %rax
je 0x56ae
movaps 0x20(%rsp), %xmm0
movups %xmm0, 0x8(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x80, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movq 0x8(%rsp), %rsi
movzbl (%rsi), %eax
cmpl $0x5b, %eax
je 0x538d
cmpl $0x7b, %eax
jne 0x53d7
movl 0x8(%r13), %eax
andl $-0x10, %eax
orl $0x9, %eax
movl %eax, 0x8(%r13)
leaq 0x18(%r13), %rax
movq %rax, 0x18(%r13)
movq %rax, 0x20(%r13)
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x1, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movq 0x8(%rsp), %rax
cmpb $0x7d, (%rax)
jne 0x54dd
jmp 0x53d1
movl 0x8(%r13), %eax
andl $-0x10, %eax
orl $0x8, %eax
movl %eax, 0x8(%r13)
leaq 0x18(%r13), %rax
movq %rax, 0x18(%r13)
movq %rax, 0x20(%r13)
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x1, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movq 0x8(%rsp), %rax
cmpb $0x5d, (%rax)
jne 0x54dd
incq 0x10(%rbx)
jmp 0x53ef
leaq 0x8(%r13), %rdx
leaq 0x18(%r13), %rcx
movq %rbx, %rdi
callq 0x2093
testl %eax, %eax
js 0x5672
testq %r12, %r12
je 0x540b
movq 0x20(%r12), %rax
movq (%rax), %rcx
movq %rcx, (%r13)
movq %r13, (%rax)
movq %r13, 0x20(%r12)
xorl %r13d, %r13d
testl %r14d, %r14d
js 0x5694
movl %r14d, %r14d
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x1, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movl 0x8(%r12), %ecx
andl $0xf, %ecx
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x9, %ecx
jne 0x547d
cmpl $0x7d, %eax
je 0x54b5
cmpl $0x2c, %eax
jne 0x55ce
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x1, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movq 0x8(%rsp), %rax
cmpb $0x7d, (%rax)
je 0x54b5
jmp 0x552e
cmpl $0x5d, %eax
je 0x54b5
cmpl $0x2c, %eax
jne 0x5579
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x1, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %rbp, %rcx
callq 0x7498
movq 0x8(%rsp), %rax
cmpb $0x5d, (%rax)
jne 0x52d1
incq 0x10(%rbx)
testq %r14, %r14
je 0x5694
leaq -0x1(%r14), %rax
movl %eax, %ecx
movq (%r15,%rcx,8), %r12
testq %r14, %r14
movq %rax, %r14
jg 0x5417
jmp 0x5699
testq %r12, %r12
je 0x54f6
movq 0x20(%r12), %rax
movq (%rax), %rcx
movq %rcx, (%r13)
movq %r13, (%rax)
movq %r13, 0x20(%r12)
movq 0x18(%rsp), %r12
leal -0x1(%r12), %eax
cmpl %eax, %r14d
jge 0x554f
movslq %r14d, %rax
incl %r14d
movq %r13, 0x8(%r15,%rax,8)
movq (%r15), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movl 0x8(%r13), %eax
andl $0xf, %eax
movq %r13, %r12
cmpl $0x8, %eax
je 0x52ce
movq %r13, (%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x1e6c
movq %r12, %r13
testl %eax, %eax
jns 0x52ce
jmp 0x5676
movslq %r12d, %rax
leaq 0x80(,%rax,8), %rsi
movq %r15, %rdi
callq 0x1180
testq %rax, %rax
je 0x56cc
addl $0x10, %r12d
movq %r12, 0x18(%rsp)
movq %rax, %r15
jmp 0x5505
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x5629
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movaps %xmm0, 0x10(%r14)
addq 0x10(%rbx), %rsi
movl $0x1f, %edx
movq %r14, %rdi
callq 0x1050
leaq 0x4eb1(%rip), %rdi      # 0xa45c
leaq 0x51b5(%rip), %rsi      # 0xa767
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0x10c0
leaq 0x5117(%rip), %rdi      # 0xa6dc
leaq 0x51bd(%rip), %rsi      # 0xa789
jmp 0x561d
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x564c
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movaps %xmm0, 0x10(%r14)
addq 0x10(%rbx), %rsi
movl $0x1f, %edx
movq %r14, %rdi
callq 0x1050
leaq 0x4e60(%rip), %rdi      # 0xa45c
leaq 0x5164(%rip), %rsi      # 0xa767
movl $0xb53, %edx            # imm = 0xB53
xorl %eax, %eax
callq 0x10c0
leaq 0x50c6(%rip), %rdi      # 0xa6dc
leaq 0x515c(%rip), %rsi      # 0xa779
movq %r14, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x5672
leaq 0x4e2c(%rip), %rdi      # 0xa45c
leaq 0x5130(%rip), %rsi      # 0xa767
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0x10c0
leaq 0x513f(%rip), %rdi      # 0xa789
jmp 0x566d
leaq 0x4e09(%rip), %rdi      # 0xa45c
leaq 0x510d(%rip), %rsi      # 0xa767
movl $0xb53, %edx            # imm = 0xB53
xorl %eax, %eax
callq 0x10c0
leaq 0x510c(%rip), %rdi      # 0xa779
callq 0x1060
movq %r13, (%rsp)
movq (%rsp), %r13
testq %r15, %r15
je 0x56fa
movq (%r15), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq %r15, %rdi
callq 0x1030
jmp 0x5705
testq %r15, %r15
je 0x56bd
movq (%r15), %rax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
movq %r15, %rdi
callq 0x1030
jmp 0x56c5
callq 0x26cf
movq $0x0, (%rsp)
jmp 0x5676
movq 0x10(%rsp), %rax
movq %r13, (%rax)
xorl %ebp, %ebp
jmp 0x574f
leaq 0x4d89(%rip), %rdi      # 0xa45c
leaq 0x508d(%rip), %rsi      # 0xa767
movl $0xaf2, %edx            # imm = 0xAF2
xorl %eax, %eax
callq 0x10c0
leaq 0x5273(%rip), %rdi      # 0xa960
callq 0x1060
movq %r15, %rdi
callq 0x1030
movq 0x10(%rsp), %rax
cmpq $0x0, (%rax)
je 0x5726
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0xab17(%rip), %rax      # 0x10228
cmpq %rax, 0x38(%rbx)
jne 0x574f
testq %r13, %r13
je 0x573b
movq %r13, %rdi
callq 0x1030
jmp 0x573b
movq %r13, (%rax)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
leaq 0xaaf3(%rip), %rax      # 0x10228
cmpq %rax, 0x38(%rbx)
jne 0x574f
movq 0x28(%rsp), %rdi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x574f
callq 0x1030
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq