// File: /workspace/github_c_makefile_star2_O1/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x0, 0x8(%rsi)
movl 0x8(%rdi), %eax
andl $0xf, %eax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x9, %eax
je 0x4862
cmpl $0x8, %eax
jne 0x4994
movq 0x18(%r14), %r15
addq $0x18, %r14
cmpq %r14, %r15
je 0x485b
leaq 0x7b05(%rip), %r12      # 0xc2da
leaq 0x7fc4(%rip), %r13      # 0xc7a0
xorl %ebp, %ebp
movl 0x4(%rbx), %esi
cmpl %esi, 0x8(%rbx)
jne 0x483d
addl $0x10, %esi
movl %esi, 0x4(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2210
movl $0x0, %ecx
testq %rax, %rax
jne 0x4831
leaq 0x7a92(%rip), %rdi      # 0xc29c
movq %r12, %rsi
movl $0x2cc, %edx            # imm = 0x2CC
xorl %eax, %eax
callq 0x20f0
movq %r13, %rdi
callq 0x2090
movq 0x10(%rbx), %rdi
callq 0x2050
movl $0x7, %ecx
xorl %eax, %eax
movq %rax, 0x10(%rbx)
testl %ecx, %ecx
jne 0x4961
movq 0x10(%rbx), %rax
movl 0x8(%rbx), %ecx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
shlq $0x4, %rcx
movq %r15, 0x8(%rax,%rcx)
movq (%r15), %r15
cmpq %r14, %r15
jne 0x47de
xorl %ebp, %ebp
jmp 0x4994
movq 0x18(%r14), %rbp
addq $0x18, %r14
cmpq %r14, %rbp
je 0x4911
leaq 0x7a22(%rip), %r15      # 0xc29c
leaq 0x7a59(%rip), %r12      # 0xc2da
leaq 0x7f18(%rip), %r13      # 0xc7a0
movl 0x4(%rbx), %esi
cmpl %esi, 0x8(%rbx)
jne 0x48e2
addl $0x10, %esi
movl %esi, 0x4(%rbx)
movq 0x10(%rbx), %rdi
shlq $0x4, %rsi
callq 0x2210
testq %rax, %rax
je 0x48ac
xorl %ecx, %ecx
jmp 0x48d6
movq %r15, %rdi
movq %r12, %rsi
movl $0x2df, %edx            # imm = 0x2DF
xorl %eax, %eax
callq 0x20f0
movq %r13, %rdi
callq 0x2090
movq 0x10(%rbx), %rdi
callq 0x2050
movl $0x7, %ecx
xorl %eax, %eax
movq %rax, 0x10(%rbx)
testl %ecx, %ecx
jne 0x4968
leaq 0x8(%rbp), %rdi
callq 0x2120
movq 0x10(%rbx), %rcx
movl 0x8(%rbx), %edx
leal 0x1(%rdx), %esi
shlq $0x4, %rdx
movl %eax, (%rcx,%rdx)
movl %esi, 0x8(%rbx)
movq %rbp, 0x8(%rcx,%rdx)
movq (%rbp), %rbp
cmpq %r14, %rbp
jne 0x4888
andb $-0x2, (%rbx)
movl 0x8(%rbx), %esi
xorl %ebp, %ebp
cmpq $0x2, %rsi
jb 0x4994
movq 0x10(%rbx), %rdi
leaq 0x46f9(%rip), %rcx      # 0x9023
movl $0x10, %r14d
movl $0x10, %edx
callq 0x20a0
movl 0x8(%rbx), %eax
cmpq $0x2, %rax
jb 0x4994
movq 0x10(%rbx), %rcx
shlq $0x4, %rax
movl -0x10(%rcx,%r14), %edx
cmpl (%rcx,%r14), %edx
je 0x4991
addq $0x10, %r14
cmpq %r14, %rax
jne 0x494b
jmp 0x4994
cmpl $0x7, %ecx
je 0x496d
jmp 0x4994
cmpl $0x7, %ecx
jne 0x498f
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x497b
callq 0x2050
xorl %eax, %eax
movq %rax, 0x10(%rbx)
andb $-0x2, (%rbx)
movq %rax, 0x4(%rbx)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x4994
jmp 0x4994
orb $0x1, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq