#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ cl_object_type_check(void *, int);
int cl_object_comparator(const void *p1, const void *p2) {
  void *o1 = *((void **)p1);
  void *o2 = *((void **)p2);
  assert(cl_object_type_check(o1, 0x0));
  assert(cl_object_type_check(o2, 0x0));
  return o1 == o2 ? 0 : o1 < o2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<cl_object_comparator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <cl_object_type_check@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1040 <cl_object_type_check@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1182 <cl_object_comparator+0x62>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    119d <cl_object_comparator+0x7d>
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rsi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmovb  %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_object_comparator>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%r14
mov    (%rsi),%rbx
xor    %ebp,%ebp
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <cl_object_type_check@plt>
mov    %eax,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <cl_object_type_check@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmp    %rbx,%r14
setae  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cl_object_comparator(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i8*, i8** %5
%14 = call i32 @cl_object_type_check(i8* %13, i32 0)
%15 = call i32 @assert(i32 %14)
%16 = load i8*, i8** %6
%17 = call i32 @cl_object_type_check(i8* %16, i32 0)
%18 = call i32 @assert(i32 %17)
%19 = load i8*, i8** %5
%20 = load i8*, i8** %6
%21 = icmp eq i8* %19, %20
br i1 %21, label %22, label %23
22: ; preds = %2
br label %29
23: ; preds = %2
%24 = load i8*, i8** %5
%25 = load i8*, i8** %6
%26 = icmp ult i8* %24, %25
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 -1, i32 1
br label %29
29: ; preds = %23, %22
%30 = phi i32 [ 0, %22 ], [ %28, %23 ]
ret i32 %30
}

LLVM IR (-O2):
define i32 @cl_object_comparator(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @cl_object_type_check(i8* %4, i32 0)
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @cl_object_type_check(i8* %6, i32 0)
%10 = tail call i32 @assert(i32 %9)
%11 = icmp eq i8* %4, %6
%12 = icmp ult i8* %4, %6
%13 = select i1 %12, i32 -1, i32 1
%14 = select i1 %11, i32 0, i32 %13
ret i32 %14
}