// File: /workspace/github_c_makefile_star2_O3/lengjingzju[P]json/json.c
// Function: json_search_object_item
json_object *json_search_object_item(json_items_t *items, json_string_t *jkey, uint32_t hash)
{
    int left = 0, right = 0, middle = 0, i = 0, count = 0;
    json_object *json = NULL;
    if (!hash)
        hash = json_string_hash_code(jkey);

    count = items->count;
    if (!count)
        return NULL;

    right = count - 1;
    while (left <= right) {
        middle = (left + right) >> 1;
        if (hash == items->items[middle].hash) {
            if (!items->conflicted)
                return items->items[middle].json;

            if (jkey->len) {
                for (i = middle; i < count; ++i) {
                    if (hash != items->items[i].hash)
                        break;
                    json = items->items[i].json;
                    if (jkey->len == json->jkey.len && memcmp(jkey->str, json->key_member, jkey->len) == 0)
                        return json;
                }
                for (i = middle - 1; i >= 0; --i) {
                    if (hash != items->items[i].hash)
                        break;
                    json = items->items[i].json;
                    if (jkey->len == json->jkey.len && memcmp(jkey->str, json->key_member, jkey->len) == 0)
                        return json;
                }
            } else {
                for (i = middle; i < count; ++i) {
                    if (hash != items->items[i].hash)
                        break;
                    json = items->items[i].json;
                    if (!json->jkey.len)
                        return json;
                }
                for (i = middle - 1; i >= 0; --i) {
                    if (hash != items->items[i].hash)
                        break;
                    json = items->items[i].json;
                    if (!json->jkey.len)
                        return json;
                }
            }
            return NULL;
        }

        if (hash > items->items[middle].hash)
            left = middle + 1;
        else
            right = middle - 1;
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movq %rdi, %r8
testl %edx, %edx
jne 0x48e2
movq %rbx, %rdi
movq %r8, %r14
callq 0x2110
movq %r14, %r8
movl %eax, %edx
movl 0x8(%r8), %edi
xorl %r12d, %r12d
testl %edi, %edi
jle 0x4a5b
leal -0x1(%rdi), %r13d
movq 0x10(%r8), %rbp
xorl %r14d, %r14d
leal (%r14,%r13), %r15d
movl %r15d, %ecx
shrl %ecx
movq %rcx, %rax
shlq $0x4, %rax
movl (%rbp,%rax), %esi
cmpl %esi, %edx
je 0x492c
ja 0x491d
decl %ecx
movl %ecx, %r13d
jmp 0x4922
incl %ecx
movl %ecx, %r14d
cmpl %r13d, %r14d
jle 0x48fc
jmp 0x4a5b
testb $0x1, (%r8)
jne 0x493e
addq %rax, %rbp
movq 0x8(%rbp), %r12
jmp 0x4a5b
movl (%rbx), %eax
movq %rax, 0x8(%rsp)
cmpq $0x100, %rax            # imm = 0x100
jae 0x49c6
movl %r14d, %esi
movl %r13d, %eax
addq %rsi, %rax
shrq %rax
cmpl %edi, %ecx
jge 0x498e
movq %rax, %rcx
shlq $0x4, %rcx
addq %rbp, %rcx
addq $0x8, %rcx
movl %eax, %esi
cmpl -0x8(%rcx), %edx
jne 0x498e
movq (%rcx), %r12
cmpl $0x100, 0x8(%r12)       # imm = 0x100
jb 0x4a5b
addq $0x10, %rcx
incl %esi
cmpl %esi, %edi
jg 0x496d
leaq 0x1(%rax), %rcx
shlq $0x4, %rax
addq %rbp, %rax
addq $-0x8, %rax
decq %rcx
jle 0x4a58
cmpl -0x8(%rax), %edx
jne 0x4a58
movq (%rax), %r12
addq $-0x10, %rax
cmpl $0x100, 0x8(%r12)       # imm = 0x100
jae 0x499d
jmp 0x4a5b
movq %rbx, 0x18(%rsp)
cmpl %edi, %ecx
movl %edx, 0x14(%rsp)
jge 0x4a52
movq 0x8(%rsp), %rax
movl %eax, %ecx
shrl $0x8, %ecx
movl %r14d, %eax
movl %r13d, %esi
addq %rax, %rsi
shrq %rsi
movq %rsi, %rax
shlq $0x4, %rax
leaq (%rax,%rbp), %rbx
addq $0x8, %rbx
movq %rdi, 0x28(%rsp)
movq %rcx, 0x20(%rsp)
cmpl -0x8(%rbx), %edx
jne 0x4a52
movq (%rbx), %r12
movl 0x8(%r12), %eax
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x4a48
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq %rsi, 0x30(%rsp)
movq 0x10(%r12), %rsi
movq %rcx, %rdx
callq 0x21d0
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rdi
movl 0x14(%rsp), %edx
testl %eax, %eax
je 0x4a5b
addq $0x10, %rbx
incl %esi
cmpl %esi, %edi
jg 0x4a02
cmpl $0x2, %r15d
jae 0x4a6d
xorl %r12d, %r12d
movq %r12, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
shrl $0x8, %eax
movq %rax, 0x8(%rsp)
movl %r14d, %eax
movl %r13d, %ecx
addq %rax, %rcx
shrq %rcx
leaq 0x1(%rcx), %r14
shlq $0x4, %rcx
leaq (%rcx,%rbp), %r15
addq $-0x8, %r15
cmpl -0x8(%r15), %edx
jne 0x4a58
movq (%r15), %r12
movl 0x8(%r12), %eax
shrl $0x8, %eax
cmpl %eax, 0x8(%rsp)
jne 0x4acd
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%r12), %rsi
movq 0x8(%rsp), %rdx
callq 0x21d0
movl 0x14(%rsp), %edx
testl %eax, %eax
je 0x4a5b
decq %r14
addq $-0x10, %r15
movl $0x0, %r12d
cmpq $0x1, %r14
ja 0x4a96
jmp 0x4a5b