// File: /workspace/github_c_makefile_star2_O2/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, 0x8(%rsp)
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r13
andq $0x0, (%r13)
leaq 0x20(%rsp), %rax
movaps %xmm0, (%rax)
xorl %r15d, %r15d
pushq $-0x1
popq %r14
xorl %ebp, %ebp
movq $0x0, 0x18(%rsp)
movq %r15, %r12
movq 0x38(%rbx), %rdx
addq $0x8, %rdx
movq %rbx, %rdi
pushq $0x28
popq %rsi
callq 0x5e62
testq %rax, %rax
je 0x405d
movq %rax, %r15
movaps 0x20(%rsp), %xmm0
movups %xmm0, 0x8(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq %rbx, %rdi
callq *0x40(%rbx)
movl $0x80, %edx
movq %rbx, %rdi
xorl %esi, %esi
movq %r13, %rcx
callq 0x5b5b
movq 0x10(%rsp), %rsi
movzbl (%rsi), %eax
cmpl $0x5b, %eax
je 0x3d2f
cmpl $0x7b, %eax
jne 0x3d7a
movl 0x8(%r15), %eax
andl $-0x10, %eax
orl $0x9, %eax
movl %eax, 0x8(%r15)
movq %r15, %rax
addq $0x18, %rax
movq %rax, 0x18(%r15)
movq %rax, 0x20(%r15)
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x5b5b
movq 0x10(%rsp), %rax
cmpb $0x7d, (%rax)
jne 0x3e6b
jmp 0x3d74
movl 0x8(%r15), %eax
andl $-0x10, %eax
orl $0x8, %eax
movl %eax, 0x8(%r15)
movq %r15, %rax
addq $0x18, %rax
movq %rax, 0x18(%r15)
movq %rax, 0x20(%r15)
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x5b5b
movq 0x10(%rsp), %rax
cmpb $0x5d, (%rax)
jne 0x3e6b
incq 0x10(%rbx)
jmp 0x3d95
leaq 0x8(%r15), %rdx
movq %r15, %rcx
addq $0x18, %rcx
movq %rbx, %rdi
callq 0x64e0
testl %eax, %eax
js 0x4009
testq %r12, %r12
je 0x3db0
movq 0x20(%r12), %rax
movq (%rax), %rcx
movq %rcx, (%r15)
movq %r15, (%rax)
movq %r15, 0x20(%r12)
xorl %r15d, %r15d
testl %r14d, %r14d
js 0x4033
movq %rbx, %rdi
callq *0x40(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x5b5b
movl 0x8(%r12), %ecx
andl $0xf, %ecx
movq 0x10(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x9, %ecx
jne 0x3e1b
cmpl $0x7d, %eax
je 0x3e51
cmpl $0x2c, %eax
jne 0x3f14
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x5b5b
movq 0x10(%rsp), %rax
cmpb $0x7d, (%rax)
je 0x3e51
jmp 0x3ebf
cmpl $0x5d, %eax
je 0x3e51
cmpl $0x2c, %eax
jne 0x3f67
incq 0x10(%rbx)
movq %rbx, %rdi
callq *0x40(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
pushq $0x1
popq %rdx
movq %r13, %rcx
callq 0x5b5b
movq 0x10(%rsp), %rax
cmpb $0x5d, (%rax)
jne 0x3c8a
incq 0x10(%rbx)
testl %r14d, %r14d
je 0x4033
decl %r14d
movq (%rbp,%r14,8), %r12
jmp 0x3db0
testq %r12, %r12
je 0x3e83
movq 0x20(%r12), %rax
movq (%rax), %rcx
movq %rcx, (%r15)
movq %r15, (%rax)
movq %r15, 0x20(%r12)
movq 0x18(%rsp), %rcx
leal -0x1(%rcx), %eax
cmpl %eax, %r14d
jge 0x3ee0
movq 0x8(%rsp), %rcx
movq %rbp, %rdx
movslq %r14d, %rax
incl %r14d
movq %r15, 0x8(%rdx,%rax,8)
movq %rdx, %rbp
movq (%rdx), %rax
movq %rax, (%rcx)
movl 0x8(%r15), %eax
andl $0xf, %eax
movq %r15, %r12
cmpl $0x8, %eax
je 0x3c87
movq %r15, (%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x62b9
movq %r12, %r15
testl %eax, %eax
jns 0x3c87
jmp 0x400d
movslq %ecx, %rax
leaq 0x80(,%rax,8), %rsi
movq %rbp, %r12
movq %rbp, %rdi
movq %rcx, %rbp
callq 0x1180
testq %rax, %rax
je 0x408d
addl $0x10, %ebp
movq %rbp, 0x18(%rsp)
movq %rax, %rdx
movq 0x8(%rsp), %rcx
jmp 0x3e98
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x3fc0
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movaps %xmm0, 0x10(%r14)
addq 0x10(%rbx), %rsi
pushq $0x1f
popq %rdx
movq %r14, %rdi
callq 0x1050
leaq 0x4518(%rip), %rdi      # 0x845c
leaq 0x481c(%rip), %rsi      # 0x8767
movl $0xb53, %edx            # imm = 0xB53
xorl %eax, %eax
callq 0x10c0
leaq 0x477e(%rip), %rdi      # 0x86dc
leaq 0x4814(%rip), %rsi      # 0x8779
jmp 0x3fb4
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x3fe3
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r14
movaps %xmm0, 0x10(%r14)
addq 0x10(%rbx), %rsi
pushq $0x1f
popq %rdx
movq %r14, %rdi
callq 0x1050
leaq 0x44c9(%rip), %rdi      # 0x845c
leaq 0x47cd(%rip), %rsi      # 0x8767
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0x10c0
leaq 0x472f(%rip), %rdi      # 0x86dc
leaq 0x47d5(%rip), %rsi      # 0x8789
movq %r14, %rdx
xorl %eax, %eax
callq 0x10c0
jmp 0x4009
leaq 0x4495(%rip), %rdi      # 0x845c
leaq 0x4799(%rip), %rsi      # 0x8767
movl $0xb53, %edx            # imm = 0xB53
xorl %eax, %eax
callq 0x10c0
leaq 0x4798(%rip), %rdi      # 0x8779
jmp 0x4004
leaq 0x4472(%rip), %rdi      # 0x845c
leaq 0x4776(%rip), %rsi      # 0x8767
movl $0xb6b, %edx            # imm = 0xB6B
xorl %eax, %eax
callq 0x10c0
leaq 0x4785(%rip), %rdi      # 0x8789
callq 0x1060
movq %r15, (%rsp)
movq (%rsp), %r15
testq %rbp, %rbp
je 0x40bb
movq (%rbp), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rbp, %rdi
callq 0x1030
jmp 0x40cc
testq %rbp, %rbp
je 0x404e
movq (%rbp), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movq %rbp, %rdi
callq 0x1030
jmp 0x4056
movq 0x8(%rsp), %rax
movq %r15, (%rax)
xorl %ebp, %ebp
jmp 0x40ee
leaq 0x43f8(%rip), %rdi      # 0x845c
leaq 0x46fc(%rip), %rsi      # 0x8767
movq $0x0, (%rsp)
movl $0xb05, %edx            # imm = 0xB05
xorl %eax, %eax
callq 0x10c0
leaq 0x48da(%rip), %rdi      # 0x8960
callq 0x1060
jmp 0x400d
leaq 0x43c8(%rip), %rdi      # 0x845c
leaq 0x46cc(%rip), %rsi      # 0x8767
movl $0xaf2, %edx            # imm = 0xAF2
xorl %eax, %eax
callq 0x10c0
leaq 0x48b2(%rip), %rdi      # 0x8960
callq 0x1060
movq %r12, %rdi
callq 0x1030
movq 0x8(%rsp), %rax
cmpq $0x0, (%rax)
jne 0x40cc
movq %r15, (%rax)
xorl %r15d, %r15d
pushq $-0x1
popq %rbp
leaq 0xa152(%rip), %rax      # 0xe228
cmpq %rax, 0x38(%rbx)
jne 0x40ee
movq %r15, %rdi
callq 0x1030
movq 0x28(%rsp), %rdi
callq 0x1030
movl %ebp, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq