// File: /workspace/github_c_makefile_star2_O0/mruby-zest[P]osc-bridge/src/mm_json.h
// Function: mm_json_read
MM_JSON_API struct mm_json_iter
mm_json_read(struct mm_json_token *obj, const struct mm_json_iter* prev)
{
    struct mm_json_iter iter;
    mm_json_size len;
    const mm_json_char *cur;
    mm_json_int utf8_remain = 0;

    MM_JSON_ASSERT(obj);
    MM_JSON_ASSERT(prev);
    if (!prev || !obj || !prev->src || !prev->len || prev->err) {
        /* case either invalid iterator or eof  */
        struct mm_json_iter it = MM_JSON_ITER_NULL;
        *obj = MM_JSON_TOKEN_NULL;
        it.err = 1;
        return it;
    }

    iter = *prev;
    *obj = MM_JSON_TOKEN_NULL;
    iter.err = 0;
    if (!iter.go) /* begin of parsing process */
        iter.go = mm_json_go_struct;

    len = iter.len;
    for (cur = iter.src; len; cur++, len--) {
        const unsigned char *tbl = (const unsigned char*)iter.go;
        unsigned char c = (unsigned char)*cur;
        if (c == '\0') {
            iter.src = 0;
            iter.len = 0;
        }
        switch (tbl[c]) {
        case MM_JSON_STATE_FAILED: {
            iter.err = 1;
            return iter;
        } break;
        case MM_JSON_STATE_LOOP: break;
        case MM_JSON_STATE_SEP: {
            if (iter.depth == 2)
                obj->children--;
        } break;
        case MM_JSON_STATE_UP: {
            if (iter.depth > 1) {
                if (iter.depth == 2)
                    obj->children++;
                obj->sub++;
            }
            if (iter.depth++ == 1)
                obj->str = cur;
        } break;
        case MM_JSON_STATE_DOWN: {
            if (--iter.depth == 1) {
                obj->len = (mm_json_size)(cur - obj->str) + 1;
                if (iter.depth != 1 || !obj->str)
                    goto l_loop;
                goto l_yield;
            }
        } break;
        case MM_JSON_STATE_QUP: {
            iter.go = mm_json_go_string;
            if (iter.depth == 1) {
                obj->str = cur;
            } else {
                if (iter.depth == 2)
                    obj->children++;
                obj->sub++;
            }
        } break;
        case MM_JSON_STATE_QDOWN: {
            iter.go = mm_json_go_struct;
            if (iter.depth == 1) {
                obj->len = (mm_json_size)(cur - obj->str) + 1;
                if (iter.depth != 1 || !obj->str)
                    goto l_loop;
                goto l_yield;
            }
        } break;
        case MM_JSON_STATE_ESC: {
            iter.go = mm_json_go_esc;
        } break;
        case MM_JSON_STATE_UNESC: {
            iter.go = mm_json_go_string;
        } break;
        case MM_JSON_STATE_BARE: {
            if (iter.depth == 1) {
                obj->str = cur;
            } else {
                if (iter.depth == 2)
                    obj->children++;
                obj->sub++;
            }
            iter.go = mm_json_go_bare;
        } break;
        case MM_JSON_STATE_UNBARE: {
            iter.go = mm_json_go_struct;
            if (iter.depth == 1) {
                obj->len = (mm_json_size)(cur - obj->str);
                obj->type = (enum mm_json_token_type)mm_json_type(obj);
                if (obj->type == MM_JSON_STRING)
                    mm_json_deq(obj);
                iter.src = cur;
                iter.len = len;
                return iter;
            }
            cur--; len++;
        } break;
        case MM_JSON_STATE_UTF8_2: {
            iter.go = mm_json_go_utf8;
            utf8_remain = 1;
        } break;
        case MM_JSON_STATE_UTF8_3: {
            iter.go = mm_json_go_utf8;
            utf8_remain = 2;
        } break;
        case MM_JSON_STATE_UTF8_4: {
            iter.go = mm_json_go_utf8;
            utf8_remain = 3;
        } break;
        case MM_JSON_STATE_UTF8_NEXT: {
            if (!--utf8_remain)
                iter.go = mm_json_go_string;
        } break;
        default:
            break;
        }
        l_loop:;
    }

    if (!iter.depth) {
        /* reached eof */
        iter.src = 0;
        iter.len = 0;
        if (obj->str) {
            obj->len = (mm_json_size)((cur-1) - obj->str);
            obj->type = (enum mm_json_token_type)mm_json_type(obj);
            if (obj->type == MM_JSON_STRING)
                mm_json_deq(obj);
        }
        return iter;
    }
    return iter;

l_yield:
    iter.src = cur + 1;
    iter.len = len - 1;
    obj->type = mm_json_type(obj);
    if (obj->type == MM_JSON_STRING)
        mm_json_deq(obj);
    return iter;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x68(%rbp)
movq %rdi, -0x60(%rbp)
movq %rsi, -0x8(%rbp)
movq %rdx, -0x10(%rbp)
movl $0x0, -0x44(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5bdc
cmpq $0x0, -0x8(%rbp)
je 0x5bdc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x5bdc
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x5bdc
movq -0x10(%rbp), %rax
cmpl $0x0, (%rax)
je 0x5c10
movq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x2130
movq -0x8(%rbp), %rdi
leaq 0x6a21(%rip), %rsi      # 0xc618
movl $0x28, %edx
callq 0x21e0
movq -0x68(%rbp), %rax
movl $0x1, (%rax)
jmp 0x60dc
movq -0x10(%rbp), %rax
movq (%rax), %rcx
movq %rcx, -0x30(%rbp)
movq 0x8(%rax), %rcx
movq %rcx, -0x28(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x69da(%rip), %rsi      # 0xc618
movl $0x28, %edx
callq 0x21e0
movl $0x0, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x5c61
leaq 0xa5c3(%rip), %rax      # 0x10220
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x5fca
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
movb (%rax), %al
movb %al, -0x51(%rbp)
movzbl -0x51(%rbp), %eax
cmpl $0x0, %eax
jne 0x5ca6
movq $0x0, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x50(%rbp), %rax
movzbl -0x51(%rbp), %ecx
movzbl (%rax,%rcx), %eax
movq %rax, -0x70(%rbp)
subq $0xe, %rax
ja 0x5fa7
movq -0x70(%rbp), %rax
leaq 0x6911(%rip), %rcx      # 0xc5dc
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x68(%rbp), %rax
movl $0x1, -0x30(%rbp)
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x60dc
jmp 0x5fa9
cmpl $0x2, -0x2c(%rbp)
jne 0x5d1e
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x5fa9
cmpl $0x1, -0x2c(%rbp)
jle 0x5d4f
cmpl $0x2, -0x2c(%rbp)
jne 0x5d3f
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movl -0x2c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x2c(%rbp)
cmpl $0x1, %eax
jne 0x5d6a
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5fa9
movl -0x2c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x1, %eax
jne 0x5db1
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq %rax, %rcx
addq $0x1, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x1, -0x2c(%rbp)
jne 0x5da7
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x5dac
jmp 0x5fab
jmp 0x607c
jmp 0x5fa9
leaq 0xa663(%rip), %rax      # 0x10420
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x2c(%rbp)
jne 0x5dd4
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5dfa
cmpl $0x2, -0x2c(%rbp)
jne 0x5dea
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
jmp 0x5fa9
leaq 0xa41a(%rip), %rax      # 0x10220
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x2c(%rbp)
jne 0x5e44
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq %rax, %rcx
addq $0x1, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpl $0x1, -0x2c(%rbp)
jne 0x5e3a
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x5e3f
jmp 0x5fab
jmp 0x607c
jmp 0x5fa9
leaq 0xa7d0(%rip), %rax      # 0x10620
movq %rax, -0x28(%rbp)
jmp 0x5fa9
leaq 0xa5c0(%rip), %rax      # 0x10420
movq %rax, -0x28(%rbp)
jmp 0x5fa9
cmpl $0x1, -0x2c(%rbp)
jne 0x5e7c
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5ea2
cmpl $0x2, -0x2c(%rbp)
jne 0x5e92
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
leaq 0xa477(%rip), %rax      # 0x10320
movq %rax, -0x28(%rbp)
jmp 0x5fa9
leaq 0xa367(%rip), %rax      # 0x10220
movq %rax, -0x28(%rbp)
cmpl $0x1, -0x2c(%rbp)
jne 0x5f36
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x60f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
cmpl $0x4, 0x20(%rax)
jne 0x5efe
movq -0x8(%rbp), %rdi
callq 0x61c0
movq -0x68(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, -0x20(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, -0x18(%rbp)
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x60dc
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5fa9
leaq 0xa5c9(%rip), %rax      # 0x10520
movq %rax, -0x28(%rbp)
movl $0x1, -0x44(%rbp)
jmp 0x5fa9
leaq 0xa5b5(%rip), %rax      # 0x10520
movq %rax, -0x28(%rbp)
movl $0x2, -0x44(%rbp)
jmp 0x5fa9
leaq 0xa5a1(%rip), %rax      # 0x10520
movq %rax, -0x28(%rbp)
movl $0x3, -0x44(%rbp)
jmp 0x5fa9
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, %eax
jne 0x5fa5
leaq 0xa47f(%rip), %rax      # 0x10420
movq %rax, -0x28(%rbp)
jmp 0x5fa9
jmp 0x5fa9
jmp 0x5fab
jmp 0x5fad
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x5c71
cmpl $0x0, -0x2c(%rbp)
jne 0x6057
movq $0x0, -0x20(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x602f
movq -0x40(%rbp), %rcx
addq $-0x1, %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
subq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
callq 0x60f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
cmpl $0x4, 0x20(%rax)
jne 0x602d
movq -0x8(%rbp), %rdi
callq 0x61c0
jmp 0x602f
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x60dc
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
jmp 0x60dc
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x38(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
callq 0x60f0
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
cmpl $0x4, 0x20(%rax)
jne 0x60b9
movq -0x8(%rbp), %rdi
callq 0x61c0
movq -0x68(%rbp), %rax
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq -0x60(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)