// File: /workspace/github_c_makefile_star2_O0/tomcatzh[P]RealityBenchmark/external/cJSON.c
// Function: cJSON_Compare
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive)
{
    if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a))
    {
        return false;
    }

    /* check if type is valid */
    switch (a->type & 0xFF)
    {
        case cJSON_False:
        case cJSON_True:
        case cJSON_NULL:
        case cJSON_Number:
        case cJSON_String:
        case cJSON_Raw:
        case cJSON_Array:
        case cJSON_Object:
            break;

        default:
            return false;
    }

    /* identical objects are equal */
    if (a == b)
    {
        return true;
    }

    switch (a->type & 0xFF)
    {
        /* in these cases and equal type is enough */
        case cJSON_False:
        case cJSON_True:
        case cJSON_NULL:
            return true;

        case cJSON_Number:
            if (a->valuedouble == b->valuedouble)
            {
                return true;
            }
            return false;

        case cJSON_String:
        case cJSON_Raw:
            if ((a->valuestring == NULL) || (b->valuestring == NULL))
            {
                return false;
            }
            if (strcmp(a->valuestring, b->valuestring) == 0)
            {
                return true;
            }

            return false;

        case cJSON_Array:
        {
            cJSON *a_element = a->child;
            cJSON *b_element = b->child;

            for (; (a_element != NULL) && (b_element != NULL);)
            {
                if (!cJSON_Compare(a_element, b_element, case_sensitive))
                {
                    return false;
                }

                a_element = a_element->next;
                b_element = b_element->next;
            }

            /* one of the arrays is longer than the other */
            if (a_element != b_element) {
                return false;
            }

            return true;
        }

        case cJSON_Object:
        {
            cJSON *a_element = NULL;
            cJSON *b_element = NULL;
            cJSON_ArrayForEach(a_element, a)
            {
                /* TODO This has O(n^2) runtime, which is horrible! */
                b_element = get_object_item(b, a_element->string, case_sensitive);
                if (b_element == NULL)
                {
                    return false;
                }

                if (!cJSON_Compare(a_element, b_element, case_sensitive))
                {
                    return false;
                }
            }

            /* doing this twice, once on a and b to prevent true comparison if a subset of b
             * TODO: Do this the proper way, this is just a fix for now */
            cJSON_ArrayForEach(b_element, b)
            {
                a_element = get_object_item(a, b_element->string, case_sensitive);
                if (a_element == NULL)
                {
                    return false;
                }

                if (!cJSON_Compare(b_element, a_element, case_sensitive))
                {
                    return false;
                }
            }

            return true;
        }

        default:
            return false;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x94bc
cmpq $0x0, -0x18(%rbp)
je 0x94bc
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
andl $0xff, %eax
movq -0x18(%rbp), %rcx
movl 0x18(%rcx), %ecx
andl $0xff, %ecx
cmpl %ecx, %eax
jne 0x94bc
movq -0x10(%rbp), %rdi
callq 0x9230
cmpl $0x0, %eax
je 0x94c8
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
movzbl 0x18(%rax), %eax
movl %eax, -0x44(%rbp)
decl %eax
subl $0x2, %eax
jb 0x951a
jmp 0x94dc
movl -0x44(%rbp), %eax
subl $0x4, %eax
je 0x951a
jmp 0x94e6
movl -0x44(%rbp), %eax
subl $0x8, %eax
je 0x951a
jmp 0x94f0
movl -0x44(%rbp), %eax
subl $0x10, %eax
je 0x951a
jmp 0x94fa
movl -0x44(%rbp), %eax
subl $0x20, %eax
je 0x951a
jmp 0x9504
movl -0x44(%rbp), %eax
subl $0x40, %eax
je 0x951a
jmp 0x950e
movl -0x44(%rbp), %eax
subl $0x80, %eax
jne 0x951c
jmp 0x951a
jmp 0x9528
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jne 0x953e
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
movzbl 0x18(%rax), %eax
movl %eax, -0x48(%rbp)
decl %eax
subl $0x2, %eax
jb 0x959b
jmp 0x9552
movl -0x48(%rbp), %eax
subl $0x4, %eax
je 0x959b
jmp 0x955c
movl -0x48(%rbp), %eax
subl $0x8, %eax
je 0x95a7
jmp 0x9566
movl -0x48(%rbp), %eax
subl $0x10, %eax
je 0x95d5
jmp 0x9570
movl -0x48(%rbp), %eax
subl $0x20, %eax
je 0x9629
jmp 0x957e
movl -0x48(%rbp), %eax
subl $0x40, %eax
je 0x96bc
jmp 0x958c
movl -0x48(%rbp), %eax
subl $0x80, %eax
je 0x95d5
jmp 0x97dd
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
movsd 0x30(%rax), %xmm0
movq -0x18(%rbp), %rax
ucomisd 0x30(%rax), %xmm0
jne 0x95c9
jp 0x95c9
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x95eb
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
jne 0x95f7
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0x2320
cmpl $0x0, %eax
jne 0x961d
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x49(%rbp)
je 0x9658
cmpq $0x0, -0x30(%rbp)
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x9661
jmp 0x969a
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x9470
cmpl $0x0, %eax
jne 0x9682
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x9641
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0x96b0
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x96e1
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0x96e9
xorl %eax, %eax
movq %rax, -0x58(%rbp)
jmp 0x96e9
movq -0x58(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x9753
movq -0x18(%rbp), %rdi
movq -0x38(%rbp), %rax
movq 0x38(%rax), %rsi
movl -0x1c(%rbp), %edx
callq 0x7690
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x9723
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x9470
cmpl $0x0, %eax
jne 0x9744
movl $0x0, -0x4(%rbp)
jmp 0x97e4
jmp 0x9746
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x96f1
cmpq $0x0, -0x18(%rbp)
je 0x9768
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x9770
xorl %eax, %eax
movq %rax, -0x60(%rbp)
jmp 0x9770
movq -0x60(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x97d4
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rax
movq 0x38(%rax), %rsi
movl -0x1c(%rbp), %edx
callq 0x7690
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x97a7
movl $0x0, -0x4(%rbp)
jmp 0x97e4
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x9470
cmpl $0x0, %eax
jne 0x97c5
movl $0x0, -0x4(%rbp)
jmp 0x97e4
jmp 0x97c7
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x9778
movl $0x1, -0x4(%rbp)
jmp 0x97e4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)