// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x6419
cmpq $0x0, -0x28(%rbp)
je 0x6419
cmpq $0x0, -0x30(%rbp)
je 0x6419
cmpq $0x0, -0x18(%rbp)
je 0x6419
cmpq $0x0, -0x20(%rbp)
jne 0x6425
movl $0x1, -0x4(%rbp)
jmp 0x661f
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jb 0x643e
movl $0x2, -0x4(%rbp)
jmp 0x661f
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0xa0(%rbp), %rdi
callq 0x5b40
movq -0xa0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x98(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x5b90
movq -0xc0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x80(%rbp)
je 0x64d7
cmpq $0x0, -0x68(%rbp)
je 0x64d7
movl $0x3, -0x4(%rbp)
jmp 0x661f
jmp 0x64d9
cmpq $0x0, -0x68(%rbp)
je 0x6619
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
imulq $0x28, (%rax), %rax
addq %rax, %rdi
leaq -0x60(%rbp), %rsi
movl $0x28, %edx
callq 0x21e0
movq -0x20(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jbe 0x6528
movl $0x2, -0x4(%rbp)
jmp 0x661f
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x1, 0x20(%rax)
je 0x6560
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
cmpl $0x2, 0x20(%rax)
jne 0x65b7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %r8
movq (%r8), %r8
subq $0x1, %r8
imulq $0x28, %r8, %r8
addq %r8, %rax
movq 0x8(%rax), %r8
callq 0x63d0
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x65b5
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x661f
jmp 0x65b7
leaq -0xe0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x5b90
movq -0xe0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpl $0x0, -0x80(%rbp)
je 0x6614
cmpq $0x0, -0x70(%rbp)
je 0x6614
cmpq $0x0, -0x68(%rbp)
je 0x6614
movl $0x3, -0x4(%rbp)
jmp 0x661f
jmp 0x64d9
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax,%rax)