#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 */
long double fabsl(long double);
long double log10l(long double);
long double log_delta(long double a_in, long double b_in) {
  long double a = fabsl(a_in);
  long double b = fabsl(b_in);
  long double ratio = 0.0;
  if (a < b) {
    b = a;
    a = fabsl(b_in);
  }
  if (b == a) {
    return 0.0;
  }
  if ((b == 0) && (a == 0)) {
    return 0;
  }
  if (b == 0) {
    return fabsl(log10l(a));
  }
  ratio = fabsl(log10l(a / b));
  return ratio;
}


x86 assembly (clang, -O0):
<log_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fabs
fstpt  -0x40(%rbp)
fldt   -0x30(%rbp)
fabs
fstpt  -0x50(%rbp)
fldz
fstpt  -0x60(%rbp)
fldt   -0x40(%rbp)
fldt   -0x50(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jbe    115c <log_delta+0x4c>
jmp    114e <log_delta+0x3e>
fldt   -0x40(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x30(%rbp)
fabs
fstpt  -0x40(%rbp)
fldt   -0x50(%rbp)
fldt   -0x40(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    1183 <log_delta+0x73>
jp     1183 <log_delta+0x73>
jmp    1179 <log_delta+0x69>
fldz
fstpt  -0x10(%rbp)
jmp    1215 <log_delta+0x105>
fldt   -0x50(%rbp)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11c5 <log_delta+0xb5>
jp     11c5 <log_delta+0xb5>
jmp    119f <log_delta+0x8f>
fldt   -0x40(%rbp)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11c5 <log_delta+0xb5>
jp     11c5 <log_delta+0xb5>
jmp    11bb <log_delta+0xab>
fldz
fstpt  -0x10(%rbp)
jmp    1215 <log_delta+0x105>
fldt   -0x50(%rbp)
fldz
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jne    11f8 <log_delta+0xe8>
jp     11f8 <log_delta+0xe8>
jmp    11e1 <log_delta+0xd1>
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <log10l@plt>
fabs
fstpt  -0x10(%rbp)
jmp    1215 <log_delta+0x105>
fldt   -0x40(%rbp)
fldt   -0x50(%rbp)
fdivrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <log10l@plt>
fabs
fstpt  -0x60(%rbp)
fldt   -0x60(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_delta>:
sub    $0x18,%rsp
fldt   0x30(%rsp)
fldt   0x20(%rsp)
fabs
fxch   %st(1)
fabs
fucomi %st(1),%st
fld    %st(1)
fcmovnbe %st(1),%st
fxch   %st(1)
fcmovnbe %st(2),%st
fstp   %st(2)
fxch   %st(1)
fucomi %st(1),%st
fldz
jne    1138 <log_delta+0x28>
jnp    1150 <log_delta+0x40>
fstp   %st(0)
fldz
fxch   %st(1)
fucomi %st(1),%st
fxch   %st(1)
jne    115d <log_delta+0x4d>
jp     115d <log_delta+0x4d>
fxch   %st(2)
fucomi %st(2),%st
fxch   %st(2)
jne    115d <log_delta+0x4d>
jp     115d <log_delta+0x4d>
fstp   %st(1)
fstp   %st(1)
fstp   %st(0)
fldz
add    $0x18,%rsp
ret
fxch   %st(1)
fucomi %st(1),%st
fstp   %st(1)
fld1
fcmovne %st(1),%st
fcmovu %st(1),%st
fstp   %st(1)
fdivrp %st,%st(1)
fstpt  (%rsp)
call   1030 <log10l@plt>
fabs
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @log_delta(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%9 = load x86_fp80, x86_fp80* %4
%10 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %9)
store x86_fp80 %10, x86_fp80* %6
%11 = load x86_fp80, x86_fp80* %5
%12 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %11)
store x86_fp80 %12, x86_fp80* %7
store x86_fp80 0xK00000000000000000000, x86_fp80* %8
%13 = load x86_fp80, x86_fp80* %6
%14 = load x86_fp80, x86_fp80* %7
%15 = fcmp olt x86_fp80 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load x86_fp80, x86_fp80* %6
store x86_fp80 %17, x86_fp80* %7
%18 = load x86_fp80, x86_fp80* %5
%19 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %18)
store x86_fp80 %19, x86_fp80* %6
br label %20
20: ; preds = %16, %2
%21 = load x86_fp80, x86_fp80* %7
%22 = load x86_fp80, x86_fp80* %6
%23 = fcmp oeq x86_fp80 %21, %22
br i1 %23, label %24, label %25
24: ; preds = %20
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
br label %46
25: ; preds = %20
%26 = load x86_fp80, x86_fp80* %7
%27 = fcmp oeq x86_fp80 %26, 0xK00000000000000000000
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load x86_fp80, x86_fp80* %6
%30 = fcmp oeq x86_fp80 %29, 0xK00000000000000000000
br i1 %30, label %31, label %32
31: ; preds = %28
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
br label %46
32: ; preds = %28, %25
%33 = load x86_fp80, x86_fp80* %7
%34 = fcmp oeq x86_fp80 %33, 0xK00000000000000000000
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = load x86_fp80, x86_fp80* %6
%37 = call x86_fp80 @log10l(x86_fp80 %36)
%38 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %37)
store x86_fp80 %38, x86_fp80* %3
br label %46
39: ; preds = %32
%40 = load x86_fp80, x86_fp80* %6
%41 = load x86_fp80, x86_fp80* %7
%42 = fdiv x86_fp80 %40, %41
%43 = call x86_fp80 @log10l(x86_fp80 %42)
%44 = call x86_fp80 @llvm.fabs.f80(x86_fp80 %43)
store x86_fp80 %44, x86_fp80* %8
%45 = load x86_fp80, x86_fp80* %8
store x86_fp80 %45, x86_fp80* %3
br label %46
46: ; preds = %39, %35, %31, %24
%47 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %47
}

LLVM IR (-O2):
define x86_fp80 @log_delta(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %0)
%4 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %1)
%5 = fcmp olt x86_fp80 %3, %4
%6 = select i1 %5, x86_fp80 %4, x86_fp80 %3
%7 = select i1 %5, x86_fp80 %3, x86_fp80 %4
%8 = fcmp oeq x86_fp80 %7, %6
br i1 %8, label %18, label %9
9: ; preds = %2
%10 = fcmp oeq x86_fp80 %7, 0xK00000000000000000000
%11 = fcmp oeq x86_fp80 %6, 0xK00000000000000000000
%12 = select i1 %10, i1 %11, i1 false
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = select i1 %10, x86_fp80 0xK3FFF8000000000000000, x86_fp80 %7
%15 = fdiv x86_fp80 %6, %14
%16 = tail call x86_fp80 @log10l(x86_fp80 %15)
%17 = tail call x86_fp80 @llvm.fabs.f80(x86_fp80 %16)
br label %18
18: ; preds = %13, %9, %2
%19 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ 0xK00000000000000000000, %9 ], [ %17, %13 ]
ret x86_fp80 %19
}