// File: /workspace/github_c_makefile_star2_O1/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 0x4555
movq %rbx, %rdi
movq %r8, %r14
callq 0x2120
movq %r14, %r8
movl %eax, %edx
movl 0x8(%r8), %edi
xorl %r12d, %r12d
testl %edi, %edi
jle 0x46dd
leal -0x1(%rdi), %r14d
movq 0x10(%r8), %rbp
xorl %r13d, %r13d
leal (%r14,%r13), %r15d
movl %r15d, %eax
shrl %eax
movq %rax, %rcx
shlq $0x4, %rcx
movl (%rbp,%rcx), %esi
cmpl %esi, %edx
je 0x459f
ja 0x4590
decl %eax
movl %eax, %r14d
jmp 0x4595
incl %eax
movl %eax, %r13d
cmpl %r14d, %r13d
jle 0x456f
jmp 0x46dd
testb $0x1, (%r8)
jne 0x45b1
addq %rcx, %rbp
movq 0x8(%rbp), %r12
jmp 0x46dd
movl (%rbx), %ecx
movq %rcx, 0x8(%rsp)
cmpq $0x100, %rcx            # imm = 0x100
jae 0x4648
cmpl %edi, %eax
jge 0x4604
movl %r13d, %ecx
movl %r14d, %eax
addq %rcx, %rax
shrq %rax
movq %rax, %rcx
shlq $0x4, %rcx
addq %rbp, %rcx
addq $0x8, %rcx
cmpl -0x8(%rcx), %edx
jne 0x4604
movq (%rcx), %r12
cmpl $0x100, 0x8(%r12)       # imm = 0x100
jb 0x46dd
addq $0x10, %rcx
incl %eax
cmpl %eax, %edi
jg 0x45e3
movl %r13d, %eax
movl %r14d, %ecx
addq %rax, %rcx
shrq %rcx
leaq 0x1(%rcx), %rax
shlq $0x4, %rcx
addq %rbp, %rcx
addq $-0x8, %rcx
decq %rax
jle 0x46da
cmpl -0x8(%rcx), %edx
jne 0x46da
movq (%rcx), %r12
addq $-0x10, %rcx
cmpl $0x100, 0x8(%r12)       # imm = 0x100
jae 0x461f
jmp 0x46dd
movq %rbx, 0x18(%rsp)
cmpl %edi, %eax
movl %edx, 0x14(%rsp)
jge 0x46d4
movq 0x8(%rsp), %rax
movl %eax, %ecx
shrl $0x8, %ecx
movl %r13d, %eax
movl %r14d, %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 0x46d4
movq (%rbx), %r12
movl 0x8(%r12), %eax
shrl $0x8, %eax
cmpl %eax, %ecx
jne 0x46ca
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq %rsi, 0x30(%rsp)
movq 0x10(%r12), %rsi
movq %rcx, %rdx
callq 0x21e0
movq 0x30(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rsp), %rdi
movl 0x14(%rsp), %edx
testl %eax, %eax
je 0x46dd
addq $0x10, %rbx
incl %esi
cmpl %esi, %edi
jg 0x4684
cmpl $0x2, %r15d
jae 0x46ef
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 %r13d, %eax
movl %r14d, %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 0x46da
movq (%r15), %r12
movl 0x8(%r12), %eax
shrl $0x8, %eax
cmpl %eax, 0x8(%rsp)
jne 0x474f
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%r12), %rsi
movq 0x8(%rsp), %rdx
callq 0x21e0
movl 0x14(%rsp), %edx
testl %eax, %eax
je 0x46dd
decq %r14
addq $-0x10, %r15
movl $0x0, %r12d
cmpq $0x1, %r14
jg 0x4718
jmp 0x46dd