// File: /workspace/github_c_makefile_star2_O1/tomcatzh[P]RealityBenchmark/external/cJSON.c
// Function: parse_object
static cJSON_bool parse_object(cJSON * const item, parse_buffer * const input_buffer)
{
    cJSON *head = NULL; /* linked list head */
    cJSON *current_item = NULL;

    if (input_buffer->depth >= CJSON_NESTING_LIMIT)
    {
        return false; /* to deeply nested */
    }
    input_buffer->depth++;

    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{'))
    {
        goto fail; /* not an object */
    }

    input_buffer->offset++;
    buffer_skip_whitespace(input_buffer);
    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}'))
    {
        goto success; /* empty object */
    }

    /* check if we skipped to the end of the buffer */
    if (cannot_access_at_index(input_buffer, 0))
    {
        input_buffer->offset--;
        goto fail;
    }

    /* step back to character in front of the first element */
    input_buffer->offset--;
    /* loop through the comma separated array elements */
    do
    {
        /* allocate next item */
        cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
        if (new_item == NULL)
        {
            goto fail; /* allocation failure */
        }

        /* attach next item to list */
        if (head == NULL)
        {
            /* start the linked list */
            current_item = head = new_item;
        }
        else
        {
            /* add to the end and advance */
            current_item->next = new_item;
            new_item->prev = current_item;
            current_item = new_item;
        }

        /* parse the name of the child */
        input_buffer->offset++;
        buffer_skip_whitespace(input_buffer);
        if (!parse_string(current_item, input_buffer))
        {
            goto fail; /* failed to parse name */
        }
        buffer_skip_whitespace(input_buffer);

        /* swap valuestring and string, because we parsed the name */
        current_item->string = current_item->valuestring;
        current_item->valuestring = NULL;

        if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':'))
        {
            goto fail; /* invalid object */
        }

        /* parse the value */
        input_buffer->offset++;
        buffer_skip_whitespace(input_buffer);
        if (!parse_value(current_item, input_buffer))
        {
            goto fail; /* failed to parse value */
        }
        buffer_skip_whitespace(input_buffer);
    }
    while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));

    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}'))
    {
        goto fail; /* expected end of object */
    }

success:
    input_buffer->depth--;

    item->type = cJSON_Object;
    item->child = head;

    input_buffer->offset++;
    return true;

fail:
    if (head != NULL)
    {
        cJSON_Delete(head);
    }

    return false;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x18(%rsi), %rax
xorl %ebx, %ebx
cmpq $0x3e7, %rax            # imm = 0x3E7
ja 0x7831
movq %rsi, %r14
incq %rax
movq %rax, 0x18(%rsi)
movq 0x10(%rsi), %rax
xorl %ebx, %ebx
cmpq 0x8(%rsi), %rax
jae 0x7821
movq (%r14), %rcx
cmpb $0x7b, (%rcx,%rax)
jne 0x7821
movq %rdi, %r15
incq %rax
movq %rax, 0x10(%r14)
movq %r14, %rdi
callq 0x5643
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rax
cmpq %rcx, %rax
jae 0x781a
movq (%r14), %rdx
cmpb $0x7d, (%rdx,%rax)
jne 0x7716
xorl %r12d, %r12d
decq 0x18(%r14)
movl $0x40, 0x18(%r15)
movq %r12, 0x10(%r15)
incq 0x10(%r14)
movl $0x1, %ebx
jmp 0x7831
cmpq %rcx, %rax
jae 0x781a
decq %rax
movq %rax, 0x10(%r14)
xorl %r12d, %r12d
xorl %ebp, %ebp
movl $0x40, %edi
callq *0x20(%r14)
testq %rax, %rax
je 0x77e6
movq %rax, %r13
movq %rbp, %rax
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r13)
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
movq %r13, %rbp
testq %r12, %r12
je 0x776c
movq %r13, (%rax)
movq %rax, 0x8(%r13)
movq %r12, %rbp
incq 0x10(%r14)
movq %r14, %rdi
callq 0x5643
movq %r13, %rdi
movq %r14, %rsi
callq 0x730a
testl %eax, %eax
je 0x77dc
movq %r14, %rdi
callq 0x5643
movq 0x20(%r13), %rax
movq %rax, 0x38(%r13)
movq $0x0, 0x20(%r13)
movq 0x10(%r14), %rax
cmpq 0x8(%r14), %rax
jae 0x77dc
movq (%r14), %rcx
cmpb $0x3a, (%rcx,%rax)
jne 0x77dc
incq %rax
movq %rax, 0x10(%r14)
movq %r14, %rdi
callq 0x5643
movq %r13, %rdi
movq %r14, %rsi
callq 0x52bc
testl %eax, %eax
je 0x77dc
movq %r14, %rdi
callq 0x5643
movb $0x1, %al
jmp 0x77de
xorl %eax, %eax
movq %rbp, %r12
movq %r13, %rbp
jmp 0x77e8
xorl %eax, %eax
testb %al, %al
je 0x7824
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rax
cmpq %rcx, %rax
jae 0x7824
movq (%r14), %rdx
cmpb $0x2c, (%rdx,%rax)
je 0x772b
cmpq %rcx, %rax
jae 0x7824
movq (%r14), %rcx
cmpb $0x7d, (%rcx,%rax)
je 0x76f8
jmp 0x7824
decq %rax
movq %rax, 0x10(%r14)
xorl %r12d, %r12d
testq %r12, %r12
je 0x7831
movq %r12, %rdi
callq 0x506a
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq