// File: /workspace/github_c_makefile_star2_O0/ammarfaizi2[P]riyuu/src/third_party/cjson/cJSON_Utils.c
// Function: cJSONUtils_FindPointerFromObjectTo
CJSON_PUBLIC(char *) cJSONUtils_FindPointerFromObjectTo(const cJSON * const object, const cJSON * const target)
{
    size_t child_index = 0;
    cJSON *current_child = 0;

    if ((object == NULL) || (target == NULL))
    {
        return NULL;
    }

    if (object == target)
    {
        /* found */
        return (char*)cJSONUtils_strdup((const unsigned char*)"");
    }

    /* recursively search all children of the object or array */
    for (current_child = object->child; current_child != NULL; (void)(current_child = current_child->next), child_index++)
    {
        unsigned char *target_pointer = (unsigned char*)cJSONUtils_FindPointerFromObjectTo(current_child, target);
        /* found the target? */
        if (target_pointer != NULL)
        {
            if (cJSON_IsArray(object))
            {
                /* reserve enough memory for a 64 bit integer + '/' and '\0' */
                unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + 20 + sizeof("/"));
                /* check if conversion to unsigned long is valid
                 * This should be eliminated at compile time by dead code elimination
                 * if size_t is an alias of unsigned long, or if it is bigger */
                if (child_index > ULONG_MAX)
                {
                    cJSON_free(target_pointer);
                    return NULL;
                }
                sprintf((char*)full_pointer, "/%lu%s", (unsigned long)child_index, target_pointer); /* /<array_index><path> */
                cJSON_free(target_pointer);

                return (char*)full_pointer;
            }

            if (cJSON_IsObject(object))
            {
                unsigned char *full_pointer = (unsigned char*)cJSON_malloc(strlen((char*)target_pointer) + pointer_encoded_length((unsigned char*)current_child->string) + 2);
                full_pointer[0] = '/';
                encode_string_as_pointer(full_pointer + 1, (unsigned char*)current_child->string);
                strcat((char*)full_pointer, (char*)target_pointer);
                cJSON_free(target_pointer);

                return (char*)full_pointer;
            }

            /* reached leaf of the tree, found nothing */
            cJSON_free(target_pointer);
            return NULL;
        }
    }

    /* not found */
    return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x7e8e
cmpq $0x0, -0x18(%rbp)
jne 0x7e9b
movq $0x0, -0x8(%rbp)
jmp 0x8016
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x7eba
leaq 0x4629(%rip), %rdi      # 0xc4d5
callq 0x8020
movq %rax, -0x8(%rbp)
jmp 0x8016
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x800e
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7e60
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x7ff0
movq -0x10(%rbp), %rdi
callq 0x5dc0
cmpl $0x0, %eax
je 0x7f65
movq -0x30(%rbp), %rdi
callq 0x2160
movq %rax, %rdi
addq $0x14, %rdi
addq $0x2, %rdi
callq 0x6200
movq %rax, -0x38(%rbp)
cmpq $-0x1, -0x20(%rbp)
jbe 0x7f35
movq -0x30(%rbp), %rdi
callq 0x6220
movq $0x0, -0x8(%rbp)
jmp 0x8016
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rdx
movq -0x30(%rbp), %rcx
leaq 0x43f0(%rip), %rsi      # 0xc338
movb $0x0, %al
callq 0x22f0
movq -0x30(%rbp), %rdi
callq 0x6220
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8016
movq -0x10(%rbp), %rdi
callq 0x5e00
cmpl $0x0, %eax
je 0x7fdd
movq -0x30(%rbp), %rdi
callq 0x2160
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x8090
movq -0x48(%rbp), %rdi
addq %rax, %rdi
addq $0x2, %rdi
callq 0x6200
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movb $0x2f, (%rax)
movq -0x40(%rbp), %rdi
addq $0x1, %rdi
movq -0x28(%rbp), %rax
movq 0x38(%rax), %rsi
callq 0x8100
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x21e0
movq -0x30(%rbp), %rdi
callq 0x6220
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x8016
movq -0x30(%rbp), %rdi
callq 0x6220
movq $0x0, -0x8(%rbp)
jmp 0x8016
jmp 0x7ff2
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x7ec6
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq