// File: /workspace/github_c_makefile_star2_O1/bloomsource[P]dns_update/cjson.c
// Function: cJSON_Compare
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 = NULL;
            cJSON *b_element = NULL;
            for (a_element = a->child, b_element = b->child;
                    (a_element != NULL) && (b_element != NULL);
                    a_element = a_element->next, b_element = b_element->next)
            {
                if (!cJSON_Compare(a_element, b_element, case_sensitive))
                {
                    return false;
                }
            }

            return true;
        }

        case cJSON_Object:
        {
            cJSON *a_element = NULL;
            cJSON_ArrayForEach(a_element, a)
            {
                /* TODO This has O(n^2) runtime, which is horrible! */
                cJSON *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;
                }
            }

            return true;
        }

        default:
            return false;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x5551
xorl %r15d, %r15d
movzbl %r15b, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %r14
movl 0x18(%rdi), %eax
xorl %r15d, %r15d
testb %al, %al
je 0x5542
movq %rsi, %rbx
movl 0x18(%rsi), %ecx
xorl %eax, %ecx
movzbl %cl, %ecx
testl %ecx, %ecx
jne 0x5542
movl %edx, %ebp
movzbl %al, %eax
leal -0x1(%rax), %ecx
cmpl $0x3f, %ecx
ja 0x5615
movabsq $-0x7fffffff7fff7f75, %rdx # imm = 0x800000008000808B
btq %rcx, %rdx
jae 0x5615
movb $0x1, %r15b
cmpq %rbx, %r14
je 0x5542
cmpl $0xf, %eax
jg 0x55c8
cmpl $0x2, %ecx
jb 0x5542
cmpl $0x4, %eax
je 0x5542
cmpl $0x8, %eax
jne 0x553f
movsd 0x30(%rbx), %xmm0
cmpeqsd 0x30(%r14), %xmm0
movq %xmm0, %r15
andl $0x1, %r15d
jmp 0x5542
cmpl $0x3f, %eax
jg 0x5625
cmpl $0x10, %eax
je 0x5635
cmpl $0x20, %eax
jne 0x553f
addq $0x10, %r14
addq $0x10, %rbx
movq (%rbx), %rbx
movq (%r14), %r14
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %r15b
orb %al, %r15b
jne 0x5542
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x5528
testl %eax, %eax
jne 0x55e3
jmp 0x5542
cmpl $0x80, %eax
jne 0x553f
jmp 0x5592
cmpl $0x40, %eax
je 0x565f
cmpl $0x80, %eax
jne 0x553f
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x553f
movq 0x20(%rbx), %rsi
testq %rsi, %rsi
je 0x553f
callq 0x2180
testl %eax, %eax
sete %r15b
jmp 0x5542
addq $0x10, %r14
movq (%r14), %r14
testq %r14, %r14
sete %r15b
je 0x5542
movq 0x38(%r14), %rsi
movq %rbx, %rdi
movl %ebp, %edx
callq 0x4727
testq %rax, %rax
je 0x5542
movq %r14, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0x5528
testl %eax, %eax
jne 0x5663
jmp 0x5542