#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*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int dcmp(const void *a, const void *b) {
  const double da = *(const double *)a;
  const double db = *(const double *)b;
  if (da > db)
    return 1;
  if (db > da)
    return -1;
  if (da == db)
    return 0;
  fprintf(stderr, "No NaNs permitted in output.\n");
  abort();
  return 0;
}


x86 assembly (clang, -O0):
<dcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1166 <dcmp+0x46>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <dcmp+0xa0>
movsd  -0x28(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1182 <dcmp+0x62>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c0 <dcmp+0xa0>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11a4 <dcmp+0x84>
jp     11a4 <dcmp+0x84>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <dcmp+0xa0>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe4c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcmp>:
push   %rax
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
ja     1149 <dcmp+0x29>
mov    $0xffffffff,%eax
ucomisd %xmm0,%xmm1
ja     1149 <dcmp+0x29>
xor    %eax,%eax
ucomisd %xmm1,%xmm0
jne    114b <dcmp+0x2b>
jp     114b <dcmp+0x2b>
pop    %rcx
ret
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"No NaNs permitted in output.\0A\00"
define i32 @dcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %32
18: ; preds = %2
%19 = load double, double* %7
%20 = load double, double* %6
%21 = fcmp ogt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %3
br label %32
23: ; preds = %18
%24 = load double, double* %6
%25 = load double, double* %7
%26 = fcmp oeq double %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 0, i32* %3
br label %32
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%31 = call i32 (...) @abort()
unreachable
32: ; preds = %27, %22, %17
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"No NaNs permitted in output.\0A\00"
define i32 @dcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = fcmp ogt double %6, %4
br i1 %9, label %16, label %10
10: ; preds = %8
%11 = fcmp oeq double %4, %6
br i1 %11, label %16, label %12
12: ; preds = %10
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 (...) @abort()
unreachable
16: ; preds = %10, %8, %2
%17 = phi i32 [ 1, %2 ], [ -1, %8 ], [ 0, %10 ]
ret i32 %17
}