// File: /workspace/github_c_makefile_star2_O2/ammarfaizi2[P]riyuu/src/third_party/cjson/cJSON_Utils.c
// Function: compare_json(cJSON*, cJSON*, int)
static cJSON_bool compare_json(cJSON *a, cJSON *b, const cJSON_bool case_sensitive)
{
    if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)))
    {
        /* mismatched type. */
        return false;
    }
    switch (a->type & 0xFF)
    {
        case cJSON_Number:
            /* numeric mismatch. */
            if ((a->valueint != b->valueint) || (a->valuedouble != b->valuedouble))
            {
                return false;
            }
            else
            {
                return true;
            }

        case cJSON_String:
            /* string mismatch. */
            if (strcmp(a->valuestring, b->valuestring) != 0)
            {
                return false;
            }
            else
            {
                return true;
            }

        case cJSON_Array:
            for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next)
            {
                cJSON_bool identical = compare_json(a, b, case_sensitive);
                if (!identical)
                {
                    return false;
                }
            }

            /* array size mismatch? (one of both children is not NULL) */
            if ((a != NULL) || (b != NULL))
            {
                return false;
            }
            else
            {
                return true;
            }

        case cJSON_Object:
            sort_object(a, case_sensitive);
            sort_object(b, case_sensitive);
            for ((void)(a = a->child), b = b->child; (a != NULL) && (b != NULL); (void)(a = a->next), b = b->next)
            {
                cJSON_bool identical = false;
                /* compare object keys */
                if (compare_strings((unsigned char*)a->string, (unsigned char*)b->string, case_sensitive))
                {
                    /* missing member */
                    return false;
                }
                identical = compare_json(a, b, case_sensitive);
                if (!identical)
                {
                    return false;
                }
            }

            /* object length mismatch (one of both children is not null) */
            if ((a != NULL) || (b != NULL))
            {
                return false;
            }
            else
            {
                return true;
            }

        default:
            break;
    }

    /* null, true or false */
    return true;
}

// Assembly:
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x610c
xorl %ecx, %ecx
jmp 0x6222
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x18(%rdi), %eax
movzbl 0x18(%rsi), %ecx
cmpl %ecx, %eax
jne 0x6168
addl $-0x8, %eax
roll $0x1d, %eax
movb $0x1, %cl
cmpl $0x7, %eax
ja 0x6218
movl %edx, %r15d
leaq 0x10a5(%rip), %rdx      # 0x71e8
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x28(%r14), %eax
cmpl 0x28(%rbx), %eax
jne 0x6168
movsd 0x30(%r14), %xmm0
ucomisd 0x30(%rbx), %xmm0
jne 0x6168
jnp 0x6218
xorl %ecx, %ecx
jmp 0x6218
addq $0x10, %r14
addq $0x10, %rbx
movq (%r14), %r14
movq (%rbx), %rbx
testq %r14, %r14
je 0x6212
testq %rbx, %rbx
je 0x6212
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x60f5
xorl %ecx, %ecx
testl %eax, %eax
jne 0x6177
jmp 0x6218
movq 0x20(%r14), %rdi
movq 0x20(%rbx), %rsi
callq 0x2220
testl %eax, %eax
jmp 0x6215
movq %r14, %rdi
movl %r15d, %esi
callq 0x5de0
movq %rbx, %rdi
movl %r15d, %esi
callq 0x5de0
addq $0x10, %r14
addq $0x10, %rbx
movq (%r14), %r14
movq (%rbx), %rbx
testq %r14, %r14
je 0x6212
testq %rbx, %rbx
je 0x6212
movq 0x38(%r14), %rdi
movq 0x38(%rbx), %rsi
movl %r15d, %edx
callq 0x63d2
testl %eax, %eax
jne 0x6168
movq %r14, %rdi
movq %rbx, %rsi
movl %r15d, %edx
callq 0x60f5
xorl %ecx, %ecx
testl %eax, %eax
jne 0x61d4
jmp 0x6218
orq %rbx, %r14
sete %cl
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
movzbl %cl, %eax
retq