// File: /workspace/github_c_makefile_star2_O3/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 %ebp, %ebp
cmpq $0x3e7, %rax            # imm = 0x3E7
ja 0x75ee
movq %rsi, %rbx
incq %rax
movq %rax, 0x18(%rsi)
movq 0x10(%rsi), %rax
cmpq 0x8(%rsi), %rax
jae 0x75ee
movq (%rbx), %rcx
cmpb $0x7b, (%rcx,%rax)
jne 0x75ee
movq %rdi, %r14
incq %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x54ef
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x74fb
movq (%rbx), %rcx
cmpb $0x7d, (%rcx,%rax)
jne 0x7507
xorl %r13d, %r13d
decq 0x18(%rbx)
movl $0x40, 0x18(%r14)
movq %r13, 0x10(%r14)
incq %rax
movq %rax, 0x10(%rbx)
movl $0x1, %ebp
jmp 0x75ee
decq %rax
movq %rax, 0x10(%rbx)
jmp 0x75ee
decq %rax
movq %rax, 0x10(%rbx)
xorl %r12d, %r12d
xorl %ebp, %ebp
movl $0x40, %edi
callq *0x20(%rbx)
testq %rax, %rax
je 0x75ff
movq %rax, %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, (%rax)
movq %rax, %r13
testq %r12, %r12
je 0x754c
movq %r15, (%rbp)
movq %rbp, 0x8(%r15)
movq %r12, %r13
incq 0x10(%rbx)
movq %rbx, %rdi
callq 0x54ef
movq %r15, %rdi
movq %rbx, %rsi
callq 0x716b
testl %eax, %eax
je 0x75e1
movq %rbx, %rdi
callq 0x54ef
movq 0x20(%r15), %rax
movq %rax, 0x38(%r15)
movq $0x0, 0x20(%r15)
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x75e1
movq (%rbx), %rcx
cmpb $0x3a, (%rcx,%rax)
jne 0x75e1
incq %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x54ef
movq %r15, %rdi
movq %rbx, %rsi
callq 0x51cd
testl %eax, %eax
je 0x75e1
movq %rbx, %rdi
callq 0x54ef
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x75e1
movq (%rbx), %rcx
movzbl (%rcx,%rax), %ecx
movq %r13, %r12
movq %r15, %rbp
cmpl $0x2c, %ecx
je 0x7513
cmpl $0x7d, %ecx
je 0x74da
movq %r13, %r12
movq %r12, %rdi
callq 0x4fa4
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
jne 0x75e4
jmp 0x75ec