#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double era_sinh(double);
double fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, double, double, double, double);
double sinh(double);
void testValuesInRange(double from, double to, double step, FILE *fp) {
  double sinhera = era_sinh(from), sinhc = sinh(from);
  double worstera = 0, worstc = 0, worstInput = 0;
  double worstDeviation = 0;
  fprintf(fp, "input,era_sinh,c_sinh\n");
  while (from <= to) {
    sinhera = era_sinh(from);
    sinhc = sinh(from);
    fprintf(fp, "%.17g,%.17g,%.17g\n", from, sinhera, sinhc);
    if (sinhc != 0 && fabs(sinhera - sinhc) / sinhc > worstDeviation) {
      worstDeviation = fabs(sinhera - sinhc) / sinhc;
      worstera = sinhera;
      worstc = sinhc;
      worstInput = from;
    }
    from = from + step;
  }
  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):
<testValuesInRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1291 <testValuesInRange+0x151>
movsd  -0x8(%rbp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
lea    0xe40(%rip),%rsi
mov    $0x3,%al
call   1050 <fprintf@plt>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    121b <testValuesInRange+0xdb>
jp     121b <testValuesInRange+0xdb>
jmp    127d <testValuesInRange+0x13d>
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movaps 0xde4(%rip),%xmm1
pand   %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    127d <testValuesInRange+0x13d>
movsd  -0x28(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movaps 0xdbf(%rip),%xmm1
pand   %xmm1,%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11ab <testValuesInRange+0x6b>
movsd  0xd67(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
lea    0xd96(%rip),%rdi
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testValuesInRange>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%rbx
movsd  %xmm2,0x38(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,(%rsp)
call   1070 <era_sinh@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe83(%rip),%xmm0
ja     1301 <testValuesInRange+0x1b1>
movsd  0xe7d(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1301 <testValuesInRange+0x1b1>
lea    0xe94(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
movsd  (%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
ucomisd %xmm1,%xmm0
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jae    121a <testValuesInRange+0xca>
movsd  0x8(%rsp),%xmm0
mulsd  0xe1b(%rip),%xmm0
lea    0xe5e(%rip),%rdi
movsd  0x10(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
add    $0x48,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
lea    0xe26(%rip),%r14
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
jmp    1267 <testValuesInRange+0x117>
nopl   0x0(%rax,%rax,1)
movsd  (%rsp),%xmm1
addsd  0x38(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     11e7 <testValuesInRange+0x97>
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1070 <era_sinh@plt>
movsd  %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sinh@plt>
movapd %xmm0,%xmm2
movsd  %xmm0,0x40(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  (%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mov    $0x3,%al
call   1050 <fprintf@plt>
movsd  0x40(%rsp),%xmm3
ucomisd 0xd63(%rip),%xmm3
jne    12b9 <testValuesInRange+0x169>
jnp    1250 <testValuesInRange+0x100>
movsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm0
subsd  %xmm3,%xmm0
andpd  0xd51(%rip),%xmm0
divsd  %xmm3,%xmm0
ucomisd 0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
jbe    1255 <testValuesInRange+0x105>
movsd  %xmm2,0x20(%rsp)
movsd  %xmm3,0x18(%rsp)
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
jmp    1255 <testValuesInRange+0x105>
call   1030 <sinh@plt>
jmp    1195 <testValuesInRange+0x45>

LLVM IR (-O0):
@.str = [23 x i8] c"input,era_sinh,c_sinh\0A\00"
@.str.1 = [19 x i8] c"%.17g,%.17g,%.17g\0A\00"
@.str.2 = [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 @testValuesInRange(double %0, double %1, double %2, i32* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32* %3, i32** %8
%15 = load double, double* %5
%16 = call double @era_sinh(double %15)
store double %16, double* %9
%17 = load double, double* %5
%18 = call double @sinh(double %17)
store double %18, double* %10
store double 0.000000e+00, double* %11
store double 0.000000e+00, double* %12
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %14
%19 = load i32*, i32** %8
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %56, %4
%22 = load double, double* %5
%23 = load double, double* %6
%24 = fcmp ole double %22, %23
br i1 %24, label %25, label %60
25: ; preds = %21
%26 = load double, double* %5
%27 = call double @era_sinh(double %26)
store double %27, double* %9
%28 = load double, double* %5
%29 = call double @sinh(double %28)
store double %29, double* %10
%30 = load i32*, i32** %8
%31 = load double, double* %5
%32 = load double, double* %9
%33 = load double, double* %10
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %31, double %32, double %33)
%35 = load double, double* %10
%36 = fcmp une double %35, 0.000000e+00
br i1 %36, label %37, label %56
37: ; preds = %25
%38 = load double, double* %9
%39 = load double, double* %10
%40 = fsub double %38, %39
%41 = call double @llvm.fabs.f64(double %40)
%42 = load double, double* %10
%43 = fdiv double %41, %42
%44 = load double, double* %14
%45 = fcmp ogt double %43, %44
br i1 %45, label %46, label %56
46: ; preds = %37
%47 = load double, double* %9
%48 = load double, double* %10
%49 = fsub double %47, %48
%50 = call double @llvm.fabs.f64(double %49)
%51 = load double, double* %10
%52 = fdiv double %50, %51
store double %52, double* %14
%53 = load double, double* %9
store double %53, double* %11
%54 = load double, double* %10
store double %54, double* %12
%55 = load double, double* %5
store double %55, double* %13
br label %56
56: ; preds = %46, %37, %25
%57 = load double, double* %5
%58 = load double, double* %7
%59 = fadd double %57, %58
store double %59, double* %5
br label %21
60: ; preds = %21
%61 = load double, double* %14
%62 = fmul double %61, 1.000000e+02
%63 = load double, double* %13
%64 = load double, double* %11
%65 = load double, double* %12
%66 = call i32 @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.2, i64 0, i64 0), double %62, double %63, double %64, double %65)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"input,era_sinh,c_sinh\0A\00"
@.str.1 = [19 x i8] c"%.17g,%.17g,%.17g\0A\00"
@.str.2 = [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 @testValuesInRange(double %0, double %1, double %2, i32* nocapture %3) {
%5 = tail call double @era_sinh(double %0)
%6 = fcmp olt double %0, -7.100000e+02
%7 = fcmp ogt double %0, 7.100000e+02
%8 = or i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call double @sinh(double %0)
br label %11
11: ; preds = %4, %9
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i64 22, i64 1, i32* %3)
%13 = fcmp ugt double %0, %1
br i1 %13, label %37, label %14
14: ; preds = %11, %30
%15 = phi double [ %34, %30 ], [ 0.000000e+00, %11 ]
%16 = phi double [ %33, %30 ], [ 0.000000e+00, %11 ]
%17 = phi double [ %32, %30 ], [ 0.000000e+00, %11 ]
%18 = phi double [ %31, %30 ], [ 0.000000e+00, %11 ]
%19 = phi double [ %35, %30 ], [ %0, %11 ]
%20 = tail call double @era_sinh(double %19)
%21 = tail call double @sinh(double %19)
%22 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), double %19, double %20, double %21)
%23 = fcmp une double %21, 0.000000e+00
br i1 %23, label %24, label %30
24: ; preds = %14
%25 = fsub double %20, %21
%26 = tail call double @llvm.fabs.f64(double %25)
%27 = fdiv double %26, %21
%28 = fcmp ogt double %27, %15
br i1 %28, label %29, label %30
29: ; preds = %24
br label %30
30: ; preds = %29, %24, %14
%31 = phi double [ %20, %29 ], [ %18, %24 ], [ %18, %14 ]
%32 = phi double [ %21, %29 ], [ %17, %24 ], [ %17, %14 ]
%33 = phi double [ %19, %29 ], [ %16, %24 ], [ %16, %14 ]
%34 = phi double [ %27, %29 ], [ %15, %24 ], [ %15, %14 ]
%35 = fadd double %19, %2
%36 = fcmp ugt double %35, %1
br i1 %36, label %37, label %14
37: ; preds = %30, %11
%38 = phi double [ 0.000000e+00, %11 ], [ %31, %30 ]
%39 = phi double [ 0.000000e+00, %11 ], [ %32, %30 ]
%40 = phi double [ 0.000000e+00, %11 ], [ %33, %30 ]
%41 = phi double [ 0.000000e+00, %11 ], [ %34, %30 ]
%42 = fmul double %41, 1.000000e+02
%43 = tail call i32 @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.2, i64 0, i64 0), double %42, double %40, double %38, double %39)
ret void
}