// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/cJSON.c
// Function: parse_object(cJSON*, parse_buffer*)
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--;

    if (head != NULL) {
        head->prev = current_item;
    }

    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 0x2eb05
movq %rsi, %rbx
incq %rax
movq %rax, 0x18(%rsi)
movq 0x10(%rsi), %rax
cmpq 0x8(%rsi), %rax
jae 0x2eb05
movq (%rbx), %rcx
cmpb $0x7b, (%rcx,%rax)
jne 0x2eb05
movq %rdi, %r14
incq %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x2c8ec
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x2ea05
movq (%rbx), %rcx
cmpb $0x7d, (%rcx,%rax)
jne 0x2ea11
decq 0x18(%rbx)
xorl %r13d, %r13d
movl $0x40, 0x18(%r14)
movq %r13, 0x10(%r14)
incq %rax
movq %rax, 0x10(%rbx)
movl $0x1, %ebp
jmp 0x2eb05
decq %rax
movq %rax, 0x10(%rbx)
jmp 0x2eb05
decq %rax
movq %rax, 0x10(%rbx)
xorl %r12d, %r12d
xorl %ebp, %ebp
movl $0x40, %edi
callq *0x20(%rbx)
testq %rax, %rax
je 0x2eb16
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 0x2ea56
movq %r15, (%rbp)
movq %rbp, 0x8(%r15)
movq %r12, %r13
incq 0x10(%rbx)
movq %rbx, %rdi
callq 0x2c8ec
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2e675
testl %eax, %eax
je 0x2eaf8
movq %rbx, %rdi
callq 0x2c8ec
movq 0x20(%r15), %rax
movq %rax, 0x38(%r15)
movq $0x0, 0x20(%r15)
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x2eaf8
movq (%rbx), %rcx
cmpb $0x3a, (%rcx,%rax)
jne 0x2eaf8
incq %rax
movq %rax, 0x10(%rbx)
movq %rbx, %rdi
callq 0x2c8ec
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2c59f
testl %eax, %eax
je 0x2eaf8
movq %rbx, %rdi
callq 0x2c8ec
movq 0x10(%rbx), %rax
cmpq 0x8(%rbx), %rax
jae 0x2eaf8
movq (%rbx), %rcx
movzbl (%rcx,%rax), %ecx
movq %r13, %r12
movq %r15, %rbp
cmpl $0x2c, %ecx
je 0x2ea1d
cmpl $0x7d, %ecx
jne 0x2eaf8
decq 0x18(%rbx)
movq %r15, 0x8(%r13)
jmp 0x2e9e8
movq %r13, %r12
movq %r12, %rdi
callq 0x2c288
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 0x2eafb
jmp 0x2eb03