// File: /workspace/github_c_makefile_star2_O2/lengjingzju[P]json/json.c
// Function: json_get_items
int json_get_items(json_object *json, json_items_t *items)
{
    json_object *pos = NULL;

    items->count = 0;
    if (json->type_member == JSON_ARRAY) {
        json_list_for_each_entry(pos, &json->value.head, list, json_object) {
            if (items->count == items->total) {
                items->total += JSON_ITEM_NUM_PLUS_DEF;
                json_item_t *new_items = (json_item_t *)json_realloc(items->items, items->total * sizeof(json_item_t));
                if (new_items) {
                    items->items = new_items;
                } else {
                    JsonErr("malloc failed!\n");
                    json_free(items->items);
                    items->items = NULL;
                    goto err;
                }
            }
            items->items[items->count++].json = pos;
        }
        return 0;
    }

    if (json->type_member == JSON_OBJECT) {
        json_list_for_each_entry(pos, &json->value.head, list, json_object) {
            if (items->count == items->total) {
                items->total += JSON_ITEM_NUM_PLUS_DEF;
                json_item_t *new_items = (json_item_t *)json_realloc(items->items, items->total * sizeof(json_item_t));
                if (new_items) {
                    items->items = new_items;
                } else {
                    JsonErr("malloc failed!\n");
                    json_free(items->items);
                    items->items = NULL;
                    goto err;
                }
            }
            items->items[items->count].hash = json_string_hash_code(&pos->jkey);
            items->items[items->count++].json = pos;
        }
        json_object_items_sort(items);
        return 0;
    }

    return -1;
err:
    json_free_items(items);
    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
andl $0x0, 0x8(%rsi)
movl 0x8(%rdi), %eax
andl $0xf, %eax
pushq $-0x1
popq %r14
cmpl $0x9, %eax
je 0x2f1d
cmpl $0x8, %eax
jne 0x3017
addq $0x18, %r15
xorl %esi, %esi
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x2f79
movq 0x10(%rbx), %rax
cmpl 0x4(%rbx), %esi
jne 0x2f08
addl $0x10, %esi
movl %esi, 0x4(%rbx)
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x2230
testq %rax, %rax
je 0x2fd4
movq %rax, 0x10(%rbx)
movl 0x8(%rbx), %esi
movl %esi, %ecx
leal 0x1(%rsi), %edx
movl %edx, 0x8(%rbx)
shlq $0x4, %rcx
movq %r12, 0x8(%rax,%rcx)
movl %edx, %esi
jmp 0x2ed0
addq $0x18, %r15
xorl %esi, %esi
movq %r15, %r12
movq (%r12), %r12
cmpq %r15, %r12
je 0x2f81
cmpl 0x4(%rbx), %esi
jne 0x2f54
addl $0x10, %esi
movl %esi, 0x4(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2230
testq %rax, %rax
je 0x2fdb
movq %rax, 0x10(%rbx)
leaq 0x8(%r12), %rdi
callq 0x2130
movq 0x10(%rbx), %rcx
movl 0x8(%rbx), %edx
leal 0x1(%rdx), %esi
shlq $0x4, %rdx
movl %eax, (%rcx,%rdx)
movl %esi, 0x8(%rbx)
movq %r12, 0x8(%rcx,%rdx)
jmp 0x2f26
xorl %r14d, %r14d
jmp 0x3017
andb $-0x2, (%rbx)
xorl %r14d, %r14d
cmpl $0x2, %esi
jb 0x3017
movq 0x10(%rbx), %rdi
movl %esi, %esi
leaq 0x4850(%rip), %rcx      # 0x77ed
pushq $0x10
popq %r15
movq %r15, %rdx
callq 0x2090
movl 0x8(%rbx), %eax
xorl %r14d, %r14d
xorl %ecx, %ecx
incq %rcx
cmpq %rax, %rcx
jae 0x3017
movq 0x10(%rbx), %rdx
movl -0x10(%rdx,%r15), %esi
leaq 0x10(%r15), %rdi
cmpl (%rdx,%r15), %esi
movq %rdi, %r15
jne 0x2fb1
orb $0x1, (%rbx)
jmp 0x3017
movl $0x2cc, %edx            # imm = 0x2CC
jmp 0x2fe0
movl $0x2df, %edx            # imm = 0x2DF
leaq 0x72b9(%rip), %rdi      # 0xa2a0
leaq 0x72f0(%rip), %rsi      # 0xa2de
xorl %eax, %eax
callq 0x2100
leaq 0x77a8(%rip), %rdi      # 0xa7a4
callq 0x2080
movq 0x10(%rbx), %rdi
callq 0x2050
andq $0x0, 0x10(%rbx)
movq %rbx, %rdi
callq 0x20f0
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq