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

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

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

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

    /* 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 next 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 array */
    }

success:
    input_buffer->depth--;

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

    input_buffer->offset++;

    return true;

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

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x3e8, 0x18(%rax)      # imm = 0x3E8
jb 0x9e3a
movl $0x0, -0x4(%rbp)
jmp 0xa064
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5b, %eax
je 0x9e67
jmp 0xa04d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rdi
callq 0x6e00
cmpq $0x0, -0x18(%rbp)
je 0x9eba
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x0, %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x9eba
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5d, %eax
jne 0x9eba
jmp 0xa00d
cmpq $0x0, -0x18(%rbp)
je 0x9ed7
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x0, %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jb 0x9eec
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0xa04d
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rdi
addq $0x20, %rdi
callq 0x6ae0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x9f19
jmp 0xa04d
cmpq $0x0, -0x20(%rbp)
jne 0x9f2e
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq %rax, -0x28(%rbp)
jmp 0x9f4d
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rdi
callq 0x6e00
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x6b20
cmpl $0x0, %eax
jne 0x9f7d
jmp 0xa04d
movq -0x18(%rbp), %rdi
callq 0x6e00
xorl %eax, %eax
cmpq $0x0, -0x18(%rbp)
movb %al, -0x31(%rbp)
je 0x9fc9
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x0, %rcx
movq -0x18(%rbp), %rdx
xorl %eax, %eax
cmpq 0x8(%rdx), %rcx
movb %al, -0x31(%rbp)
jae 0x9fc9
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
sete %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x9efc
cmpq $0x0, -0x18(%rbp)
je 0xa009
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x0, %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0xa009
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x10(%rcx), %rcx
movzbl (%rax,%rcx), %eax
cmpl $0x5d, %eax
je 0xa00b
jmp 0xa04d
jmp 0xa00d
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x20, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xa064
cmpq $0x0, -0x20(%rbp)
je 0xa05d
movq -0x20(%rbp), %rdi
callq 0x67e0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)