#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 abs(int);
double era_sinh(double);
int /*<<< orphan*/ printf(char *, double, double, ...);
double sinh(double);
int main() {
  double d = 0;
  double maxDiviation = 0;
  double maxErrorD = 0;
  int i = 0;
  do {
    double ms = era_sinh(d);
    double s = sinh(d);
    double diviation = abs(1 - ms / s);
    if (diviation > maxDiviation) {
      maxDiviation = diviation;
      maxErrorD = d;
    }
    if (i % 1000000 == 0) {
      i = 0;
      printf("d: %f my_sinh: %9.4e sinh: %9.4e delta: %9.4e\n", d, ms, s,
             ms / s - 1);
    }
    i += 1;
    d += 0.00001;
  } while (d <= 710);
  printf("d: %f diviation: %f", maxErrorD, maxDiviation);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sinh@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm1
divsd  -0x38(%rbp),%xmm1
movsd  0xe62(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <abs@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11d4 <main+0x94>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1222 <main+0xe2>
movl   $0x0,-0x24(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
divsd  -0x38(%rbp),%xmm3
movsd  0xdf0(%rip),%xmm4
subsd  %xmm4,%xmm3
lea    0xdfd(%rip),%rdi
mov    $0x4,%al
call   1050 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
movsd  0xdd5(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xdcb(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jae    116e <main+0x2e>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xde6(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
lea    0xecd(%rip),%rbx
xorpd  %xmm2,%xmm2
xorpd  %xmm1,%xmm1
movapd %xmm1,0x10(%rsp)
jmp    11c2 <main+0x82>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movapd 0x30(%rsp),%xmm3
movapd %xmm3,%xmm0
cmpltsd %xmm4,%xmm0
movapd %xmm0,%xmm1
movapd 0x10(%rsp),%xmm2
andpd  %xmm2,%xmm1
andnpd 0x40(%rsp),%xmm0
orpd   %xmm1,%xmm0
maxsd  %xmm3,%xmm4
add    $0x1,%ebp
addsd  0xe6a(%rip),%xmm2
movsd  0xe6a(%rip),%xmm1
movapd %xmm2,0x10(%rsp)
ucomisd %xmm2,%xmm1
movapd %xmm4,%xmm2
jb     126e <main+0x12e>
movapd %xmm2,0x30(%rsp)
movapd %xmm0,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
call   1060 <era_sinh@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
call   1030 <sinh@plt>
movsd  0x8(%rsp),%xmm1
movsd  %xmm0,0x28(%rsp)
divsd  %xmm0,%xmm1
movsd  0xdff(%rip),%xmm0
movsd  %xmm1,0x20(%rsp)
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <abs@plt>
movapd %xmm0,%xmm4
imul   $0x68c26139,%ebp,%eax
add    $0x218c0,%eax
ror    $0x6,%eax
cmp    $0x10c6,%eax
ja     1170 <main+0x30>
movsd  0x20(%rsp),%xmm3
addsd  0xdc9(%rip),%xmm3
mov    %rbx,%rdi
movapd 0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
mov    $0x4,%al
movsd  %xmm4,0x8(%rsp)
call   1050 <printf@plt>
movsd  0x8(%rsp),%xmm4
xor    %ebp,%ebp
jmp    1170 <main+0x30>
lea    0xdda(%rip),%rdi
movapd %xmm4,%xmm1
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"d: %f my_sinh: %9.4e sinh: %9.4e delta: %9.4e\0A\00"
@.str.1 = [20 x i8] c"d: %f diviation: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %3
store double 0.000000e+00, double* %4
store i32 0, i32* %5
br label %9
9: ; preds = %44, %0
%10 = load double, double* %2
%11 = call double @era_sinh(double %10)
store double %11, double* %6
%12 = load double, double* %2
%13 = call double @sinh(double %12)
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fdiv double %14, %15
%17 = fsub double 1.000000e+00, %16
%18 = fptosi double %17 to i32
%19 = call double @abs(i32 %18)
store double %19, double* %8
%20 = load double, double* %8
%21 = load double, double* %3
%22 = fcmp ogt double %20, %21
br i1 %22, label %23, label %26
23: ; preds = %9
%24 = load double, double* %8
store double %24, double* %3
%25 = load double, double* %2
store double %25, double* %4
br label %26
26: ; preds = %23, %9
%27 = load i32, i32* %5
%28 = srem i32 %27, 1000000
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %39
30: ; preds = %26
store i32 0, i32* %5
%31 = load double, double* %2
%32 = load double, double* %6
%33 = load double, double* %7
%34 = load double, double* %6
%35 = load double, double* %7
%36 = fdiv double %34, %35
%37 = fsub double %36, 1.000000e+00
%38 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double %31, double %32, double %33, double %37)
br label %39
39: ; preds = %30, %26
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
%42 = load double, double* %2
%43 = fadd double %42, 1.000000e-05
store double %43, double* %2
br label %44
44: ; preds = %39
%45 = load double, double* %2
%46 = fcmp ole double %45, 7.100000e+02
br i1 %46, label %9, label %47
47: ; preds = %44
%48 = load double, double* %4
%49 = load double, double* %3
%50 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %48, double %49)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"d: %f my_sinh: %9.4e sinh: %9.4e delta: %9.4e\0A\00"
@.str.1 = [20 x i8] c"d: %f diviation: %f\00"
define i32 @main() {
br label %1
1: ; preds = %20, %0
%2 = phi i32 [ 0, %0 ], [ %22, %20 ]
%3 = phi double [ 0.000000e+00, %0 ], [ %13, %20 ]
%4 = phi double [ 0.000000e+00, %0 ], [ %14, %20 ]
%5 = phi double [ 0.000000e+00, %0 ], [ %23, %20 ]
%6 = tail call double @era_sinh(double %5)
%7 = tail call double @sinh(double %5)
%8 = fdiv double %6, %7
%9 = fsub double 1.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = tail call double @abs(i32 %10)
%12 = fcmp ogt double %11, %4
%13 = select i1 %12, double %5, double %3
%14 = select i1 %12, double %11, double %4
%15 = srem i32 %2, 1000000
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %1
%18 = fadd double %8, -1.000000e+00
%19 = tail call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), double %5, double %6, double %7, double %18)
br label %20
20: ; preds = %17, %1
%21 = phi i32 [ 0, %17 ], [ %2, %1 ]
%22 = add nsw i32 %21, 1
%23 = fadd double %5, 1.000000e-05
%24 = fcmp ugt double %23, 7.100000e+02
br i1 %24, label %25, label %1
25: ; preds = %20
%26 = tail call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %13, double %14)
ret i32 0
}