// File: /workspace/github_c_makefile_star2_O0/mruby-zest[P]osc-bridge/src/mm_json.h
// Function: mm_json_query_del
MM_JSON_API struct mm_json_token*
mm_json_query_del(struct mm_json_token *toks, mm_json_size count,
    const mm_json_char *path, mm_json_char delemiter)
{
    mm_json_size i = 0;
    mm_json_int begin = 1;
    struct mm_json_token *iter = NULL;
    /* iterator to step over each token in the toks array */
    struct mm_json_token name;
    /* current segment in the path to search in the tree for */
    struct mm_json_token array;
    /* array token to store the current path segment array index */
    struct mm_json_object {mm_json_size index, size;} obj;
    /* current object iterator with current pair index and total pairs in object */

    MM_JSON_ASSERT(toks);
    MM_JSON_ASSERT(count);
    if (!toks || !count) return iter;
    if (!path) return &toks[i];

    iter = &toks[i];
    array.len = 0;
    array.str = NULL;

    path = mm_json_path_parse_name(&name, path, delemiter);
    while (1) {
        if (iter->type == MM_JSON_OBJECT || iter->type == MM_JSON_ARRAY || begin) {
            /* setup iteration over elements inside a object or array */
            obj.index = 0;
            if (begin) {
                begin = 0;
                obj.size = count;
            } else if (iter->type == MM_JSON_OBJECT) {
                obj.size = iter->children;
                if ((i + 1) > count) return NULL;
                iter = &toks[++i];
            } else {
                mm_json_number n;
                mm_json_size j = 0;

                /* array object so set iterator to array index */
                if (!mm_json_path_parse_array(&array, &name))
                    return NULL;
                if ((i+1) >= count)
                    return NULL;
                if (array.len < 1)
                    return NULL;
                if (mm_json_convert(&n, &array) != MM_JSON_NUMBER)
                    return NULL;
                if ((mm_json_size)n >= iter->children)
                    return NULL;
                array.str = NULL;
                array.len = 0;

                /* iterate over each array element and find the correct index */
                iter++; i++;
                for (j = 0; j < n; ++j) {
                    if (iter->type == MM_JSON_ARRAY || iter->type == MM_JSON_OBJECT) {
                        i = i + (iter->sub) + 1;
                    } else i += 1;
                    if (i > count)
                        return NULL;
                    iter = &toks[i];
                }
                if (!path) return iter;
                path = mm_json_path_parse_name(&name, path, delemiter);
            }
            continue;
        }
        {
            /* check if current table element is equal to the current path  */
            if (!mm_json_lcmp(iter, name.str, name.len)) {
                /* correct token found and end of path */
                if (!path) {
                    if ((i + 1) > count)
                        return NULL;
                    return (iter + 1);
                }
                /* check if path points to invalid token */
                if ((i+1) > count)
                    return NULL;
                if(toks[i+1].type != MM_JSON_OBJECT && toks[i+1].type != MM_JSON_ARRAY)
                    return NULL;

                /* look deeper into child object/array */
                iter = &toks[++i];
                path = mm_json_path_parse_name(&name, path, delemiter);
            } else {
                /* key is not correct iterate until end of object */
                if (++obj.index >= obj.size)
                    return NULL;
                if ((i + 1) >= count)
                    return NULL;
                if (iter[1].type == MM_JSON_ARRAY || iter[1].type == MM_JSON_OBJECT) {
                    i = i + (iter[1].sub + 2);
                } else i = i + 2;
                if (i >= count)
                    return NULL;
                iter = &toks[i];
            }
        }
    }
    return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movb %cl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movb %al, -0x21(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x6671
cmpq $0x0, -0x18(%rbp)
jne 0x667e
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6ac8
cmpq $0x0, -0x20(%rbp)
jne 0x669a
movq -0x10(%rbp), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x90(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movsbl -0x21(%rbp), %edx
callq 0x6ae0
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x1, 0x20(%rax)
je 0x66f3
movq -0x40(%rbp), %rax
cmpl $0x2, 0x20(%rax)
je 0x66f3
cmpl $0x0, -0x34(%rbp)
je 0x694d
movq $0x0, -0xa0(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x671b
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x98(%rbp)
jmp 0x6948
movq -0x40(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x676f
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jbe 0x674f
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x6946
movq $0x0, -0xb0(%rbp)
leaq -0x90(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x6c80
cmpl $0x0, %eax
jne 0x679c
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x30(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jb 0x67b7
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
cmpq $0x1, -0x88(%rbp)
jae 0x67ce
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
leaq -0xa8(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x53a0
cmpl $0x3, %eax
je 0x67f3
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movsd -0xa8(%rbp), %xmm0
movsd 0x5835(%rip), %xmm2     # 0xc038
movaps %xmm0, %xmm1
subsd %xmm2, %xmm1
cvttsd2si %xmm1, %rcx
cvttsd2si %xmm0, %rax
movq %rax, %rdx
sarq $0x3f, %rdx
andq %rdx, %rcx
orq %rcx, %rax
movq -0x40(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x6838
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq $0x0, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x40(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0xb0(%rbp)
movaps 0x5798(%rip), %xmm0     # 0xc010
movq -0xb0(%rbp), %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
movapd 0x5794(%rip), %xmm0     # 0xc020
subpd %xmm0, %xmm1
movaps %xmm1, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm0, %xmm1
movsd -0xa8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x691d
movq -0x40(%rbp), %rax
cmpl $0x2, 0x20(%rax)
je 0x68bd
movq -0x40(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x68d3
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
addq 0x18(%rcx), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x68df
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0x68f6
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x6871
cmpq $0x0, -0x20(%rbp)
jne 0x6931
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6ac8
movq -0x20(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movsbl -0x21(%rbp), %edx
callq 0x6ae0
movq %rax, -0x20(%rbp)
jmp 0x6948
jmp 0x66d5
movq -0x40(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x6d80
cmpl $0x0, %eax
jne 0x6a29
cmpq $0x0, -0x20(%rbp)
jne 0x699a
movq -0x30(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jbe 0x6989
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x40(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x8(%rbp)
jmp 0x6ac8
movq -0x30(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jbe 0x69b5
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x20(%rax)
je 0x69f4
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, 0x20(%rax)
je 0x69f4
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rsi
leaq -0x68(%rbp), %rdi
movsbl -0x21(%rbp), %edx
callq 0x6ae0
movq %rax, -0x20(%rbp)
jmp 0x6ac3
movq -0xa0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xa0(%rbp)
cmpq -0x98(%rbp), %rax
jb 0x6a4e
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x30(%rbp), %rax
addq $0x1, %rax
cmpq -0x18(%rbp), %rax
jb 0x6a66
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x40(%rbp), %rax
cmpl $0x2, 0x48(%rax)
je 0x6a7a
movq -0x40(%rbp), %rax
cmpl $0x1, 0x48(%rax)
jne 0x6a93
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq 0x40(%rcx), %rcx
addq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
jmp 0x6a9f
movq -0x30(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x18(%rbp), %rax
jb 0x6ab3
movq $0x0, -0x8(%rbp)
jmp 0x6ac8
movq -0x10(%rbp), %rax
imulq $0x28, -0x30(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
jmp 0x66d5
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)