#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 number_good(double);
int numcmp(double x1, double x2) {
  if (x1 < x2)
    return (-1);
  else if (x1 > x2)
    return (1);
  else if (x1 == x2)
    return (0);
  else {
    int good1, good2;
    good1 = number_good(x1);
    good2 = number_good(x2);
    if (good1 && (!good2))
      return (-1);
    else if ((!good1) && good2)
      return (1);
    else
      return (0);
  }
}


x86 assembly (clang, -O0):
<numcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <numcmp+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e1 <numcmp+0xd1>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    115e <numcmp+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <numcmp+0xd1>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1180 <numcmp+0x70>
jp     1180 <numcmp+0x70>
movl   $0x0,-0x4(%rbp)
jmp    11e1 <numcmp+0xd1>
movsd  -0x10(%rbp),%xmm0
call   1030 <number_good@plt>
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <number_good@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     11ba <numcmp+0xaa>
cmpl   $0x0,-0x20(%rbp)
jne    11ba <numcmp+0xaa>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e1 <numcmp+0xd1>
cmpl   $0x0,-0x1c(%rbp)
jne    11da <numcmp+0xca>
cmpl   $0x0,-0x20(%rbp)
je     11da <numcmp+0xca>
movl   $0x1,-0x4(%rbp)
jmp    11e1 <numcmp+0xd1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numcmp>:
mov    $0xffffffff,%eax
ucomisd %xmm0,%xmm1
ja     1130 <numcmp+0x20>
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
ja     1130 <numcmp+0x20>
xor    %eax,%eax
ucomisd %xmm1,%xmm0
jne    1131 <numcmp+0x21>
jp     1131 <numcmp+0x21>
ret
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
call   1030 <number_good@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1030 <number_good@plt>
test   %ebx,%ebx
sete   %cl
test   %eax,%eax
setne  %dl
and    %cl,%dl
movzbl %dl,%ecx
cmp    $0x1,%eax
sbb    %eax,%eax
or     %ecx,%eax
test   %ebx,%ebx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @numcmp(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store double %0, double* %4
store double %1, double* %5
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %41
12: ; preds = %2
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %3
br label %41
17: ; preds = %12
%18 = load double, double* %4
%19 = load double, double* %5
%20 = fcmp oeq double %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 0, i32* %3
br label %41
22: ; preds = %17
%23 = load double, double* %4
%24 = call i32 @number_good(double %23)
store i32 %24, i32* %6
%25 = load double, double* %5
%26 = call i32 @number_good(double %25)
store i32 %26, i32* %7
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %22
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %29
store i32 -1, i32* %3
br label %41
33: ; preds = %29, %22
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
br i1 %35, label %40, label %36
36: ; preds = %33
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %40
39: ; preds = %36
store i32 1, i32* %3
br label %41
40: ; preds = %36, %33
store i32 0, i32* %3
br label %41
41: ; preds = %40, %39, %32, %21, %16, %11
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
define i32 @numcmp(double %0, double %1) {
%3 = fcmp olt double %0, %1
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = fcmp ogt double %0, %1
br i1 %5, label %17, label %6
6: ; preds = %4
%7 = fcmp oeq double %0, %1
br i1 %7, label %17, label %8
8: ; preds = %6
%9 = tail call i32 @number_good(double %0)
%10 = tail call i32 @number_good(double %1)
%11 = icmp eq i32 %9, 0
%12 = icmp ne i32 %10, 0
%13 = select i1 %11, i1 true, i1 %12
%14 = select i1 %11, i1 %12, i1 false
%15 = zext i1 %14 to i32
%16 = select i1 %13, i32 %15, i32 -1
br label %17
17: ; preds = %6, %4, %2, %8
%18 = phi i32 [ %16, %8 ], [ -1, %2 ], [ 1, %4 ], [ 0, %6 ]
ret i32 %18
}