// File: /workspace/github_c_makefile_star2_O2/mruby-zest[P]osc-bridge/src/mm_json.h
// Function: mm_json_load
MM_JSON_API enum mm_json_status
mm_json_load(struct mm_json_token *toks, mm_json_size max, mm_json_size *read,
            const mm_json_char *json, mm_json_size length)
{
    enum mm_json_status status = MM_JSON_OK;
    struct mm_json_token tok;
    struct mm_json_iter iter;

    MM_JSON_ASSERT(toks);
    MM_JSON_ASSERT(json);
    MM_JSON_ASSERT(length);
    MM_JSON_ASSERT(max);
    MM_JSON_ASSERT(read);

    if (!toks || !json || !length || !max || !read)
        return MM_JSON_INVAL;
    if (*read >= max)
        return MM_JSON_OUT_OF_TOKEN;

    iter = mm_json_begin(json, length);
    iter = mm_json_read(&tok, &iter);
    if (iter.err && iter.len)
        return MM_JSON_PARSING_ERROR;

    while (iter.len) {
        toks[*read] = tok;
        *read += 1;
        if (*read > max) return MM_JSON_OUT_OF_TOKEN;
        if (toks[*read-1].type == MM_JSON_OBJECT ||  toks[*read-1].type == MM_JSON_ARRAY) {
            status = mm_json_load(toks, max, read, toks[*read-1].str, toks[*read-1].len);
            if (status != MM_JSON_OK) return status;
        }

        iter = mm_json_read(&tok, &iter);
        if (iter.err && iter.src && iter.len)
            return MM_JSON_PARSING_ERROR;
    }
    return status;
}

// Assembly:
pushq $0x1
popq %rax
testq %rdx, %rdx
je 0x4cf4
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %rsi, %r15
testq %rsi, %rsi
je 0x4ce6
movq %rdi, %r12
testq %rdi, %rdi
je 0x4ce6
movq %rcx, %rbx
testq %rcx, %rcx
je 0x4ce6
movq %r8, %r13
testq %r8, %r8
je 0x4ce6
movq %rdx, %r14
pushq $0x2
popq %rax
cmpq %r15, (%rdx)
jae 0x4ce6
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rax
movaps %xmm0, (%rax)
callq 0x40cc
leaq -0x50(%rbp), %rdx
movq %rbx, 0x10(%rdx)
movq %r13, 0x18(%rdx)
leaq -0x70(%rbp), %rbx
leaq -0x98(%rbp), %rsi
movq %rbx, %rdi
movq %rdx, %r13
callq 0x465c
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movaps %xmm1, 0x10(%r13)
movaps %xmm0, (%r13)
cmpl $0x0, (%r13)
setne %cl
movq 0x18(%r13), %rax
testq %rax, %rax
setne %dl
pushq $0x3
popq %rbx
testb %dl, %cl
jne 0x4ce4
leaq -0x50(%rbp), %r13
testq %rax, %rax
je 0x4cf5
imulq $0x28, (%r14), %rax
movq -0x78(%rbp), %rcx
movq %rcx, 0x20(%r12,%rax)
movups -0x98(%rbp), %xmm0
movups -0x88(%rbp), %xmm1
movups %xmm1, 0x10(%r12,%rax)
movups %xmm0, (%r12,%rax)
movq (%r14), %rcx
leaq 0x1(%rcx), %rax
movq %rax, (%r14)
cmpq %r15, %rax
ja 0x4cf9
imulq $0x28, %rcx, %rcx
movl 0x20(%r12,%rcx), %ecx
decl %ecx
cmpl $0x1, %ecx
ja 0x4c9b
imulq $0x28, %rax, %rax
movq -0x28(%r12,%rax), %rcx
movq -0x20(%r12,%rax), %r8
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4b6a
testl %eax, %eax
jne 0x4ce6
leaq -0x70(%rbp), %rdi
leaq -0x98(%rbp), %rsi
movq %r13, %rdx
callq 0x465c
movups -0x70(%rbp), %xmm0
movups -0x60(%rbp), %xmm1
movaps %xmm1, -0x40(%rbp)
movaps %xmm0, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
setne %cl
movq -0x38(%rbp), %rax
cmpq $0x0, -0x40(%rbp)
setne %dl
andb %cl, %dl
testq %rax, %rax
setne %cl
andb %dl, %cl
cmpb $0x1, %cl
jne 0x4c29
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x4ce6
pushq $0x2
popq %rax
jmp 0x4ce6