#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
int compare_double(double *f1, double *f2) {
  if (((f1 != NULL) && (f2 != NULL)) != 1) {
    fprintf(
        stderr, "assertion fails in file %s, line %d\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/Starlink/match/refs/heads/master/atpmatch.c",
        3869);
    exit(1);
  };
  if (*f1 > *f2) {
    return (1);
  }
  if (*f1 < *f2) {
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<compare_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x19(%rbp)
je     114b <compare_double+0x2b>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x1,%eax
je     1187 <compare_double+0x67>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
lea    0xeb2(%rip),%rdx
mov    $0xf1d,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    11a9 <compare_double+0x89>
movl   $0x1,-0x4(%rbp)
jmp    11d6 <compare_double+0xb6>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    11cf <compare_double+0xaf>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d6 <compare_double+0xb6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_double>:
push   %rax
test   %rdi,%rdi
je     114c <compare_double+0x2c>
test   %rsi,%rsi
je     114c <compare_double+0x2c>
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
pop    %rcx
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
lea    0xec2(%rip),%rdx
mov    $0xf1d,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"assertion fails in file %s, line %d\0A\00"
@.str.1 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Starlink/match/refs/heads/master/atpmatch.c\00"
define i32 @compare_double(double* %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
%6 = load double*, double** %4
%7 = icmp ne double* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load double*, double** %5
%10 = icmp ne double* %9, null
br label %11
11: ; preds = %8, %2
%12 = phi i1 [ false, %2 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.1, i64 0, i64 0), i32 3869)
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %11
%20 = load double*, double** %4
%21 = load double, double* %20
%22 = load double*, double** %5
%23 = load double, double* %22
%24 = fcmp ogt double %21, %23
br i1 %24, label %25, label %26
25: ; preds = %19
store i32 1, i32* %3
br label %34
26: ; preds = %19
%27 = load double*, double** %4
%28 = load double, double* %27
%29 = load double*, double** %5
%30 = load double, double* %29
%31 = fcmp olt double %28, %30
br i1 %31, label %32, label %33
32: ; preds = %26
store i32 -1, i32* %3
br label %34
33: ; preds = %26
store i32 0, i32* %3
br label %34
34: ; preds = %33, %32, %25
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"assertion fails in file %s, line %d\0A\00"
@.str.1 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Starlink/match/refs/heads/master/atpmatch.c\00"
define i32 @compare_double(double* %0, double* %1) {
%3 = icmp ne double* %0, null
%4 = icmp ne double* %1, null
%5 = and i1 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.1, i64 0, i64 0), i32 3869)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = load double, double* %0
%12 = load double, double* %1
%13 = fcmp ogt double %11, %12
%14 = fcmp olt double %11, %12
%15 = sext i1 %14 to i32
%16 = select i1 %13, i32 1, i32 %15
ret i32 %16
}