// File: /workspace/github_c_makefile_star2_O1/antirez[P]stonky/stonky.c
// Function: cJSON_Select
cJSON *cJSON_Select(cJSON *o, const char *fmt, ...) {
    int next = JSEL_INVALID;        /* Type of the next selector. */
    char token[JSEL_MAX_TOKEN+1];   /* Current token. */
    int tlen;                       /* Current length of the token. */
    va_list ap;

    va_start(ap,fmt);
    const char *p = fmt;
    tlen = 0;
    while(1) {
        /* Our four special chars (plus the end of the string) signal the
         * end of the previous token and the start of the next one. */
        if (tlen && (*p == '\0' || strchr(".[]:",*p))) {
            token[tlen] = '\0';
            if (next == JSEL_INVALID) {
                goto notfound;
            } else if (next == JSEL_ARRAY) {
                if (!cJSON_IsArray(o)) goto notfound;
                int idx = atoi(token); /* cJSON API index is int. */
                if ((o = cJSON_GetArrayItem(o,idx)) == NULL)
                    goto notfound;
            } else if (next == JSEL_OBJ) {
                if (!cJSON_IsObject(o)) goto notfound;
                if ((o = cJSON_GetObjectItemCaseSensitive(o,token)) == NULL)
                    goto notfound;
            } else if (next == JSEL_TYPECHECK) {
                if (token[0] == 's' && !cJSON_IsString(o)) goto notfound;
                if (token[0] == 'n' && !cJSON_IsNumber(o)) goto notfound;
                if (token[0] == 'o' && !cJSON_IsObject(o)) goto notfound;
                if (token[0] == 'a' && !cJSON_IsArray(o)) goto notfound;
                if (token[0] == 'b' && !cJSON_IsBool(o)) goto notfound;
                if (token[0] == '!' && !cJSON_IsNull(o)) goto notfound;
            }
        } else if (next != JSEL_INVALID) {
            /* Otherwise accumulate characters in the current token, note that
             * the above check for JSEL_NEXT_INVALID prevents us from
             * accumulating at the start of the fmt string if no token was
             * yet selected. */
            if (*p != '*') {
                token[tlen] = *p++;
                tlen++;
                if (tlen > JSEL_MAX_TOKEN) goto notfound;
                continue;
            } else {
                /* The "*" character is special: if we are in the context
                 * of an array, we read an integer from the variable argument
                 * list, then concatenate it to the current string.
                 *
                 * If the context is an object, we read a string pointer
                 * from the variable argument string and concatenate the
                 * string to the current token. */
                int len;
                char buf[64];
                char *s;
                if (next == JSEL_ARRAY) {
                    int idx = va_arg(ap,int);
                    len = snprintf(buf,sizeof(buf),"%d",idx);
                    s = buf;
                } else if (next == JSEL_OBJ) {
                    s = va_arg(ap,char*);
                    len = strlen(s);
                } else {
                    goto notfound;
                }
                /* Common path. */
                if (tlen+len > JSEL_MAX_TOKEN) goto notfound;
                memcpy(token+tlen,buf,len);
                tlen += len;
                p++;
                continue;
            }
        }
        /* Select the next token type according to its type specifier. */
        if (*p == ']') p++; /* Skip closing "]", it's just useless syntax. */
        if (*p == '\0') break;
        else if (*p == '.') next = JSEL_OBJ;
        else if (*p == '[') next = JSEL_ARRAY;
        else if (*p == ':') next = JSEL_TYPECHECK;
        else goto notfound;
        tlen = 0; /* A new token starts. */
        p++; /* Token starts at next character. */
    }

cleanup:
    va_end(ap);
    return o;

notfound:
    o = NULL;
    goto cleanup;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
movq %rsi, %rbx
movq %rdi, 0x8(%rsp)
leaq 0x180(%rsp), %rsi
movq %rdx, 0x10(%rsi)
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x7d3a
movaps %xmm0, 0x1b0(%rsp)
movaps %xmm1, 0x1c0(%rsp)
movaps %xmm2, 0x1d0(%rsp)
movaps %xmm3, 0x1e0(%rsp)
movaps %xmm4, 0x1f0(%rsp)
movaps %xmm5, 0x200(%rsp)
movaps %xmm6, 0x210(%rsp)
movaps %xmm7, 0x220(%rsp)
movq %rsi, 0x20(%rsp)
leaq 0x270(%rsp), %rax
movq %rax, 0x18(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, 0x10(%rsp)
movq $0x0, 0x28(%rsp)
xorl %r12d, %r12d
movq %rbx, %r13
xorl %r15d, %r15d
testl %r15d, %r15d
je 0x7d99
movsbl (%r13), %esi
testl %esi, %esi
je 0x7ea3
movl $0x5, %edx
leaq 0x6b6e(%rip), %rdi      # 0xe8f9
callq 0x22b0
testq %rax, %rax
jne 0x7ea3
testl %r12d, %r12d
je 0x7ee2
movb (%r13), %al
cmpb $0x2a, %al
jne 0x7ddb
movl $0x4, %r14d
cmpl $0x1, %r12d
je 0x7dfe
cmpl $0x2, %r12d
jne 0x7e68
movl 0x10(%rsp), %ecx
cmpq $0x28, %rcx
ja 0x7e19
movq %rcx, %rax
addq 0x20(%rsp), %rax
addl $0x8, %ecx
movl %ecx, 0x10(%rsp)
jmp 0x7e27
incq %r13
movslq %r15d, %rcx
movb %al, 0x30(%rsp,%rcx)
leal 0x1(%r15), %eax
cmpl $0xff, %r15d
movl %eax, %r15d
jle 0x7d6d
jmp 0x7ffc
movl 0x10(%rsp), %ecx
cmpq $0x28, %rcx
ja 0x7e46
movq %rcx, %rax
addq 0x20(%rsp), %rax
addl $0x8, %ecx
movl %ecx, 0x10(%rsp)
jmp 0x7e54
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x18(%rsp)
movl (%rax), %ecx
movl $0x40, %esi
leaq 0x140(%rsp), %rdi
leaq 0x81b8(%rip), %rdx      # 0xfff5
xorl %eax, %eax
callq 0x23f0
jmp 0x7e5c
movq 0x18(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x18(%rsp)
movq (%rax), %rdi
callq 0x2100
leal (%rax,%r15), %ebp
cmpl $0x100, %ebp            # imm = 0x100
jle 0x7e6d
movl %r15d, %ebp
jmp 0x7e91
movslq %r15d, %rcx
leaq (%rsp,%rcx), %rdi
addq $0x30, %rdi
movslq %eax, %rdx
leaq 0x140(%rsp), %rsi
callq 0x21d0
incq %r13
movl $0x2, %r14d
movl %ebp, %r15d
cmpl $0x2, %r14d
je 0x7d6d
jmp 0x7ff6
movslq %r15d, %rax
movb $0x0, 0x30(%rsp,%rax)
movl %r12d, %eax
leaq 0x68ab(%rip), %rcx      # 0xe760
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4d89
testl %eax, %eax
je 0x7ffc
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x3a36
jmp 0x7f15
movq %rbx, %r13
movq 0x8(%rsp), %rbx
jmp 0x7f21
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x4d7a
testl %eax, %eax
je 0x7ffc
leaq 0x30(%rsp), %rdi
callq 0x23d0
movq %rbx, %rdi
movl %eax, %esi
callq 0x394d
testq %rax, %rax
je 0x7ffc
movq %rax, %rbx
xorl %eax, %eax
cmpb $0x5d, (%r13)
sete %al
movzbl (%r13,%rax), %ecx
cmpl $0x39, %ecx
jle 0x7f4c
cmpl $0x3a, %ecx
je 0x7f5c
cmpl $0x5b, %ecx
jne 0x7ffc
movl $0x2, %r12d
jmp 0x7f62
movl $0x1, %r12d
cmpl $0x2e, %ecx
je 0x7f62
jmp 0x8015
movl $0x3, %r12d
movq %rbx, 0x8(%rsp)
addq %rax, %r13
incq %r13
movq %r13, %rbx
jmp 0x7d6a
cmpb $0x73, 0x30(%rsp)
movq 0x8(%rsp), %rbx
jne 0x7f8d
movq %rbx, %rdi
callq 0x29f6
testl %eax, %eax
je 0x7ffc
cmpb $0x6e, 0x30(%rsp)
jne 0x7fa0
movq %rbx, %rdi
callq 0x2a1e
testl %eax, %eax
je 0x7ffc
cmpb $0x6f, 0x30(%rsp)
jne 0x7fb3
movq %rbx, %rdi
callq 0x4d89
testl %eax, %eax
je 0x7ffc
cmpb $0x61, 0x30(%rsp)
jne 0x7fc6
movq %rbx, %rdi
callq 0x4d7a
testl %eax, %eax
je 0x7ffc
cmpb $0x62, 0x30(%rsp)
jne 0x7fd9
movq %rbx, %rdi
callq 0x4d5c
testl %eax, %eax
je 0x7ffc
cmpb $0x21, 0x30(%rsp)
jne 0x7f21
movq %rbx, %rdi
callq 0x4d6b
testl %eax, %eax
jne 0x7f21
jmp 0x7ffc
cmpl $0x4, %r14d
jne 0x8003
movq 0x28(%rsp), %rax
jmp 0x8003
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testl %ecx, %ecx
jne 0x7ffc
movq %rbx, 0x28(%rsp)
jmp 0x7ffc