#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 */
scalar_t__ fabs(double const);
int comp(const double *a, const double *b) {
  if (fabs(*a) < fabs(*b))
    return 1;
  else if (fabs(*a) > fabs(*b))
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jge    115a <comp+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    119b <comp+0x8b>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jle    1194 <comp+0x84>
movl   $0xffffffff,-0x4(%rbp)
jmp    119b <comp+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsd  (%rdi),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rbx
movsd  (%r14),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
mov    $0x1,%eax
cmp    %rcx,%rbx
jl     1162 <comp+0x52>
movsd  (%r15),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rbx
movsd  (%r14),%xmm0
call   1030 <fabs@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rbx
setg   %al
neg    %eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @comp(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 = load double, double* %6
%8 = call i64 @fabs(double %7)
%9 = load double*, double** %5
%10 = load double, double* %9
%11 = call i64 @fabs(double %10)
%12 = icmp slt i64 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %3
br label %24
14: ; preds = %2
%15 = load double*, double** %4
%16 = load double, double* %15
%17 = call i64 @fabs(double %16)
%18 = load double*, double** %5
%19 = load double, double* %18
%20 = call i64 @fabs(double %19)
%21 = icmp sgt i64 %17, %20
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 -1, i32* %3
br label %24
23: ; preds = %14
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %13
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @comp(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = tail call i64 @fabs(double %3)
%5 = load double, double* %1
%6 = tail call i64 @fabs(double %5)
%7 = icmp slt i64 %4, %6
br i1 %7, label %15, label %8
8: ; preds = %2
%9 = load double, double* %0
%10 = tail call i64 @fabs(double %9)
%11 = load double, double* %1
%12 = tail call i64 @fabs(double %11)
%13 = icmp sgt i64 %10, %12
%14 = sext i1 %13 to i32
br label %15
15: ; preds = %8, %2
%16 = phi i32 [ 1, %2 ], [ %14, %8 ]
ret i32 %16
}