#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 */
double era_sinh(double);
double fabs(double);
double nextafter(double, double);
int /*<<< orphan*/ printf(char *, double, ...);
double sinh(double);
void testAllValues(double from, double to) {
  double sinhera = era_sinh(from), sinhc = sinh(from);
  double worstera = 0, worstc = 0, worstInput = 0;
  double worstDeviation = 0;
  long long counter = 0;
  while (from != to) {
    sinhera = era_sinh(from);
    sinhc = sinh(from);
    if (counter == 1000000) {
      counter = 0;
      printf("I'm at input value %.17g\n", from);
    }
    if (sinhc != 0 && fabs(sinhera - sinhc) / sinhc > worstDeviation) {
      worstDeviation = fabs(sinhera - sinhc) / sinhc;
      worstera = sinhera;
      worstc = sinhc;
      worstInput = from;
    }
    counter = counter + 1;
    from = nextafter(from, to);
  }
  printf("The worst relative error was found to be %.17g%% for input %.17g. "
         "Our function returned %.17g, the C function returned %.17g.\n",
         worstDeviation * 100, worstInput, worstera, worstc);
}


x86 assembly (clang, -O0):
<testAllValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11b3 <testAllValues+0x73>
jp     11b3 <testAllValues+0x73>
jmp    129e <testAllValues+0x15e>
movsd  -0x8(%rbp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x20(%rbp)
cmpq   $0xf4240,-0x48(%rbp)
jne    11fa <testAllValues+0xba>
movq   $0x0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe2d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1217 <testAllValues+0xd7>
jp     1217 <testAllValues+0xd7>
jmp    1279 <testAllValues+0x139>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xde8(%rip),%xmm1
pand   %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1279 <testAllValues+0x139>
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xdc3(%rip),%xmm1
pand   %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1050 <nextafter@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1198 <testAllValues+0x58>
movsd  0xd5a(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
lea    0xd79(%rip),%rdi
mov    $0x4,%al
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAllValues>:
push   %r14
push   %rbx
sub    $0x48,%rsp
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x8(%rsp)
call   1060 <era_sinh@plt>
movsd  0x8(%rsp),%xmm0
ucomisd 0xe9a(%rip),%xmm0
ja     12dc <testAllValues+0x19c>
movsd  0xe94(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     12dc <testAllValues+0x19c>
ucomisd 0x30(%rsp),%xmm0
jne    118c <testAllValues+0x4c>
jnp    127f <testAllValues+0x13f>
xor    %ebx,%ebx
lea    0xe9b(%rip),%r14
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
xorpd  %xmm1,%xmm1
movsd  %xmm1,0x28(%rsp)
jmp    11e3 <testAllValues+0xa3>
nop
movsd  0x8(%rsp),%xmm0
add    $0x1,%rbx
movsd  0x30(%rsp),%xmm1
call   1050 <nextafter@plt>
ucomisd 0x30(%rsp),%xmm0
jne    11e3 <testAllValues+0xa3>
jnp    12a7 <testAllValues+0x167>
movsd  %xmm0,0x8(%rsp)
call   1060 <era_sinh@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sinh@plt>
movapd %xmm0,%xmm3
cmp    $0xf4240,%rbx
jne    122a <testAllValues+0xea>
mov    %r14,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
movsd  %xmm3,0x38(%rsp)
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm3
xor    %ebx,%ebx
ucomisd 0xde6(%rip),%xmm3
jne    1236 <testAllValues+0xf6>
jnp    11c0 <testAllValues+0x80>
movsd  0x40(%rsp),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm3,%xmm1
andpd  0xdd4(%rip),%xmm1
divsd  %xmm3,%xmm1
ucomisd 0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
jbe    11c6 <testAllValues+0x86>
movsd  %xmm2,0x28(%rsp)
movsd  %xmm3,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
jmp    11c6 <testAllValues+0x86>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  0xd5b(%rip),%xmm0
lea    0xd8e(%rip),%rdi
movsd  0x18(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
mov    $0x4,%al
add    $0x48,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
call   1030 <sinh@plt>
movsd  0x8(%rsp),%xmm0
jmp    117e <testAllValues+0x3e>

LLVM IR (-O0):
@.str = [26 x i8] c"I'm at input value %.17g\0A\00"
@.str.1 = [127 x i8] c"The worst relative error was found to be %.17g%% for input %.17g. Our function returned %.17g, the C function returned %.17g.\0A\00"
define void @testAllValues(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i64
store double %0, double* %3
store double %1, double* %4
%12 = load double, double* %3
%13 = call double @era_sinh(double %12)
store double %13, double* %5
%14 = load double, double* %3
%15 = call double @sinh(double %14)
store double %15, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store double 0.000000e+00, double* %10
store i64 0, i64* %11
br label %16
16: ; preds = %52, %2
%17 = load double, double* %3
%18 = load double, double* %4
%19 = fcmp une double %17, %18
br i1 %19, label %20, label %58
20: ; preds = %16
%21 = load double, double* %3
%22 = call double @era_sinh(double %21)
store double %22, double* %5
%23 = load double, double* %3
%24 = call double @sinh(double %23)
store double %24, double* %6
%25 = load i64, i64* %11
%26 = icmp eq i64 %25, 1000000
br i1 %26, label %27, label %30
27: ; preds = %20
store i64 0, i64* %11
%28 = load double, double* %3
%29 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %28)
br label %30
30: ; preds = %27, %20
%31 = load double, double* %6
%32 = fcmp une double %31, 0.000000e+00
br i1 %32, label %33, label %52
33: ; preds = %30
%34 = load double, double* %5
%35 = load double, double* %6
%36 = fsub double %34, %35
%37 = call double @llvm.fabs.f64(double %36)
%38 = load double, double* %6
%39 = fdiv double %37, %38
%40 = load double, double* %10
%41 = fcmp ogt double %39, %40
br i1 %41, label %42, label %52
42: ; preds = %33
%43 = load double, double* %5
%44 = load double, double* %6
%45 = fsub double %43, %44
%46 = call double @llvm.fabs.f64(double %45)
%47 = load double, double* %6
%48 = fdiv double %46, %47
store double %48, double* %10
%49 = load double, double* %5
store double %49, double* %7
%50 = load double, double* %6
store double %50, double* %8
%51 = load double, double* %3
store double %51, double* %9
br label %52
52: ; preds = %42, %33, %30
%53 = load i64, i64* %11
%54 = add nsw i64 %53, 1
store i64 %54, i64* %11
%55 = load double, double* %3
%56 = load double, double* %4
%57 = call double @nextafter(double %55, double %56)
store double %57, double* %3
br label %16
58: ; preds = %16
%59 = load double, double* %10
%60 = fmul double %59, 1.000000e+02
%61 = load double, double* %9
%62 = load double, double* %7
%63 = load double, double* %8
%64 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.1, i64 0, i64 0), double %60, double %61, double %62, double %63)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"I'm at input value %.17g\0A\00"
@.str.1 = [127 x i8] c"The worst relative error was found to be %.17g%% for input %.17g. Our function returned %.17g, the C function returned %.17g.\0A\00"
define void @testAllValues(double %0, double %1) {
%3 = tail call double @era_sinh(double %0)
%4 = fcmp olt double %0, -7.100000e+02
%5 = fcmp ogt double %0, 7.100000e+02
%6 = or i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call double @sinh(double %0)
br label %9
9: ; preds = %2, %7
%10 = fcmp une double %0, %1
br i1 %10, label %11, label %40
11: ; preds = %9, %32
%12 = phi i64 [ %37, %32 ], [ 0, %9 ]
%13 = phi double [ %36, %32 ], [ 0.000000e+00, %9 ]
%14 = phi double [ %35, %32 ], [ 0.000000e+00, %9 ]
%15 = phi double [ %34, %32 ], [ 0.000000e+00, %9 ]
%16 = phi double [ %33, %32 ], [ 0.000000e+00, %9 ]
%17 = phi double [ %38, %32 ], [ %0, %9 ]
%18 = tail call double @era_sinh(double %17)
%19 = tail call double @sinh(double %17)
%20 = icmp eq i64 %12, 1000000
br i1 %20, label %21, label %23
21: ; preds = %11
%22 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %17)
br label %23
23: ; preds = %21, %11
%24 = phi i64 [ 0, %21 ], [ %12, %11 ]
%25 = fcmp une double %19, 0.000000e+00
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = fsub double %18, %19
%28 = tail call double @llvm.fabs.f64(double %27)
%29 = fdiv double %28, %19
%30 = fcmp ogt double %29, %13
br i1 %30, label %31, label %32
31: ; preds = %26
br label %32
32: ; preds = %31, %26, %23
%33 = phi double [ %18, %31 ], [ %16, %26 ], [ %16, %23 ]
%34 = phi double [ %19, %31 ], [ %15, %26 ], [ %15, %23 ]
%35 = phi double [ %17, %31 ], [ %14, %26 ], [ %14, %23 ]
%36 = phi double [ %29, %31 ], [ %13, %26 ], [ %13, %23 ]
%37 = add nsw i64 %24, 1
%38 = tail call double @nextafter(double %17, double %1)
%39 = fcmp une double %38, %1
br i1 %39, label %11, label %40
40: ; preds = %32, %9
%41 = phi double [ 0.000000e+00, %9 ], [ %33, %32 ]
%42 = phi double [ 0.000000e+00, %9 ], [ %34, %32 ]
%43 = phi double [ 0.000000e+00, %9 ], [ %35, %32 ]
%44 = phi double [ 0.000000e+00, %9 ], [ %36, %32 ]
%45 = fmul double %44, 1.000000e+02
%46 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.1, i64 0, i64 0), double %45, double %43, double %41, double %42)
ret void
}