#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*/ _throw_null_fn(char *, int);
int Cyc_Tcutil_star_cmp(int (*cmp)(void *, void *), void *a1, void *a2) {
  if (a1 == a2)
    return 0;
  if (a1 == 0 && a2 != 0)
    return -1;
  if (a1 != 0 && a2 == 0)
    return 1;
  return ({
    ({
      int (*_tmp786)(void *, void *) = cmp;
      void *_tmp785 = (void *)({
        void *_cks_null = (void *)(a1);
        if (!_cks_null)
          (_throw_null_fn("tcutil.cyc", 1375));
        _cks_null;
      });
      _tmp786(_tmp785, (void *)({
                void *_cks_null = (void *)(a2);
                if (!_cks_null)
                  (_throw_null_fn("tcutil.cyc", 1375));
                _cks_null;
              }));
    });
  });
}


x86 assembly (clang, -O0):
<Cyc_Tcutil_star_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    113e <Cyc_Tcutil_star_cmp+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1217 <Cyc_Tcutil_star_cmp+0x107>
cmpq   $0x0,-0x18(%rbp)
jne    1160 <Cyc_Tcutil_star_cmp+0x50>
cmpq   $0x0,-0x20(%rbp)
je     1160 <Cyc_Tcutil_star_cmp+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1217 <Cyc_Tcutil_star_cmp+0x107>
cmpq   $0x0,-0x18(%rbp)
je     1182 <Cyc_Tcutil_star_cmp+0x72>
cmpq   $0x0,-0x20(%rbp)
jne    1182 <Cyc_Tcutil_star_cmp+0x72>
movl   $0x1,-0x4(%rbp)
jmp    1217 <Cyc_Tcutil_star_cmp+0x107>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11ae <Cyc_Tcutil_star_cmp+0x9e>
lea    0xe5c(%rip),%rdi
mov    $0x55f,%esi
call   1030 <_throw_null_fn@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    11f2 <Cyc_Tcutil_star_cmp+0xe2>
lea    0xe18(%rip),%rdi
mov    $0x55f,%esi
call   1030 <_throw_null_fn@plt>
mov    -0x70(%rbp),%rax
mov    -0x68(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    %rcx,-0x60(%rbp)
mov    -0x60(%rbp),%rsi
call   *%rax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Tcutil_star_cmp>:
push   %r15
push   %r14
push   %rbx
cmp    %rdx,%rsi
je     1158 <Cyc_Tcutil_star_cmp+0x48>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rcx
test   %rsi,%rsi
jne    1132 <Cyc_Tcutil_star_cmp+0x22>
mov    $0xffffffff,%eax
test   %r14,%r14
jne    115a <Cyc_Tcutil_star_cmp+0x4a>
test   %rbx,%rbx
je     1141 <Cyc_Tcutil_star_cmp+0x31>
mov    $0x1,%eax
test   %r14,%r14
je     115a <Cyc_Tcutil_star_cmp+0x4a>
test   %rbx,%rbx
je     1160 <Cyc_Tcutil_star_cmp+0x50>
test   %r14,%r14
je     117c <Cyc_Tcutil_star_cmp+0x6c>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    *%rcx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe99(%rip),%rdi
mov    $0x55f,%esi
mov    %rcx,%r15
call   1030 <_throw_null_fn@plt>
mov    %r15,%rcx
test   %r14,%r14
jne    114b <Cyc_Tcutil_star_cmp+0x3b>
lea    0xe7d(%rip),%rdi
mov    $0x55f,%esi
mov    %rcx,%r15
call   1030 <_throw_null_fn@plt>
mov    %r15,%rcx
jmp    114b <Cyc_Tcutil_star_cmp+0x3b>

LLVM IR (-O0):
@.str = [11 x i8] c"tcutil.cyc\00"
define i32 @Cyc_Tcutil_star_cmp(i32 (i8*, i8*)* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32 (i8*, i8*)*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32 (i8*, i8*)*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
store i32 (i8*, i8*)* %0, i32 (i8*, i8*)** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = icmp eq i8* %16, %17
br i1 %18, label %19, label %20
19: ; preds = %3
store i32 0, i32* %4
br label %57
20: ; preds = %3
%21 = load i8*, i8** %6
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i8*, i8** %7
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 -1, i32* %4
br label %57
27: ; preds = %23, %20
%28 = load i8*, i8** %6
%29 = icmp ne i8* %28, null
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i8*, i8** %7
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 1, i32* %4
br label %57
34: ; preds = %30, %27
%35 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %5
store i32 (i8*, i8*)* %35, i32 (i8*, i8*)** %9
%36 = load i8*, i8** %6
store i8* %36, i8** %11
%37 = load i8*, i8** %11
%38 = icmp ne i8* %37, null
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = call i32 @_throw_null_fn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1375)
br label %41
41: ; preds = %39, %34
%42 = load i8*, i8** %11
store i8* %42, i8** %12
%43 = load i8*, i8** %12
store i8* %43, i8** %10
%44 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %9
%45 = load i8*, i8** %10
%46 = load i8*, i8** %7
store i8* %46, i8** %14
%47 = load i8*, i8** %14
%48 = icmp ne i8* %47, null
br i1 %48, label %51, label %49
49: ; preds = %41
%50 = call i32 @_throw_null_fn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1375)
br label %51
51: ; preds = %49, %41
%52 = load i8*, i8** %14
store i8* %52, i8** %15
%53 = load i8*, i8** %15
%54 = call i32 %44(i8* %45, i8* %53)
store i32 %54, i32* %13
%55 = load i32, i32* %13
store i32 %55, i32* %8
%56 = load i32, i32* %8
store i32 %56, i32* %4
br label %57
57: ; preds = %51, %33, %26, %19
%58 = load i32, i32* %4
ret i32 %58
}

LLVM IR (-O2):
@.str = [11 x i8] c"tcutil.cyc\00"
define i32 @Cyc_Tcutil_star_cmp(i32 (i8*, i8*)* nocapture %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %1, %2
br i1 %4, label %21, label %5
5: ; preds = %3
%6 = icmp eq i8* %1, null
%7 = icmp ne i8* %2, null
%8 = and i1 %6, %7
br i1 %8, label %21, label %9
9: ; preds = %5
%10 = icmp ne i8* %1, null
%11 = icmp eq i8* %2, null
%12 = and i1 %10, %11
br i1 %12, label %21, label %13
13: ; preds = %9
br i1 %10, label %16, label %14
14: ; preds = %13
%15 = tail call i32 @_throw_null_fn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1375)
br label %16
16: ; preds = %14, %13
br i1 %7, label %19, label %17
17: ; preds = %16
%18 = tail call i32 @_throw_null_fn(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1375)
br label %19
19: ; preds = %17, %16
%20 = tail call i32 %0(i8* %1, i8* %2)
br label %21
21: ; preds = %9, %5, %3, %19
%22 = phi i32 [ %20, %19 ], [ 0, %3 ], [ -1, %5 ], [ 1, %9 ]
ret i32 %22
}