#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 */
int exp(double);
int fabs(scalar_t__);
double pow(int, int);
int /*<<< orphan*/ printf(char *, double, scalar_t__, int, double, int);
scalar_t__ sinh(double);
int main() {
  int i = 0;
  int k = 0;
  double x = 0;
  double s_k = 0;
  double a_k = 0;
  for (i = 2; i >= -15; i--) {
    x = pow(10, i);
    s_k = 0;
    a_k = x;
    k = 1;
    while (a_k >= 1.e-15) {
      s_k += a_k;
      a_k *= (x * x) / (2 * k * (2 * k + 1));
      k++;
    }
    printf("%.3le %+.8le %+.8le %+.8le %+.8le\n", x, sinh(x),
           (exp(x) - exp(-x)) / 2, s_k, fabs(sinh(x) - s_k) / fabs(sinh(x)));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x2,-0x8(%rbp)
cmpl   $0xfffffff1,-0x8(%rbp)
jl     12ed <main+0x19d>
mov    -0x8(%rbp),%esi
mov    $0xa,%edi
call   1070 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0xc(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe32(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     1223 <main+0xd3>
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c1 <main+0x71>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sinh@plt>
mov    %rax,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <exp@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1060 <exp@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sinh@plt>
cvtsi2sd %rax,%xmm0
subsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
call   1050 <fabs@plt>
mov    %eax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sinh@plt>
mov    %rax,%rdi
call   1050 <fabs@plt>
movsd  -0x48(%rbp),%xmm0
mov    -0x40(%rbp),%rsi
movsd  -0x38(%rbp),%xmm1
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cltd
idiv   %ecx
mov    -0x2c(%rbp),%edx
mov    %eax,%ecx
lea    0xd2e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    118c <main+0x3c>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    $0x2,%r12d
lea    0xeb7(%rip),%r14
jmp    120c <main+0xbc>
xchg   %ax,%ax
movsd  %xmm6,0x18(%rsp)
movapd %xmm0,(%rsp)
call   1030 <sinh@plt>
mov    %rax,%r15
movaps (%rsp),%xmm0
call   1060 <exp@plt>
mov    %eax,%ebp
movaps (%rsp),%xmm0
xorps  0xe77(%rip),%xmm0
call   1060 <exp@plt>
sub    %eax,%ebp
mov    %ebp,%ebx
shr    $0x1f,%ebx
add    %ebp,%ebx
sar    %ebx
movaps (%rsp),%xmm0
call   1030 <sinh@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
subsd  0x18(%rsp),%xmm0
cvttsd2si %xmm0,%rdi
call   1050 <fabs@plt>
mov    %eax,%ebp
movaps (%rsp),%xmm0
call   1030 <sinh@plt>
mov    %rax,%rdi
call   1050 <fabs@plt>
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %r14,%rdi
movapd (%rsp),%xmm0
mov    %r15,%rsi
mov    %ebx,%edx
movsd  0x18(%rsp),%xmm1
mov    %eax,%ecx
call   1040 <printf@plt>
lea    -0x1(%r12),%eax
cmp    $0xfffffff1,%r12d
mov    %eax,%r12d
jle    127b <main+0x12b>
mov    $0xa,%edi
mov    %r12d,%esi
call   1070 <pow@plt>
xorpd  %xmm6,%xmm6
movsd  0xddb(%rip),%xmm4
ucomisd %xmm4,%xmm0
jb     1170 <main+0x20>
movapd %xmm0,%xmm5
mulsd  %xmm0,%xmm5
xorpd  %xmm6,%xmm6
mov    $0x3,%eax
movapd %xmm0,%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addsd  %xmm1,%xmm6
lea    -0x1(%rax),%ecx
imul   %eax,%ecx
xorps  %xmm2,%xmm2
cvtsi2sd %ecx,%xmm2
movapd %xmm5,%xmm3
divsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm1
add    $0x2,%eax
ucomisd %xmm4,%xmm1
jae    1250 <main+0x100>
jmp    1170 <main+0x20>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"%.3le %+.8le %+.8le %+.8le %+.8le\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store i32 2, i32* %2
br label %7
7: ; preds = %60, %0
%8 = load i32, i32* %2
%9 = icmp sge i32 %8, -15
br i1 %9, label %10, label %63
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call double @pow(i32 10, i32 %11)
store double %12, double* %4
store double 0.000000e+00, double* %5
%13 = load double, double* %4
store double %13, double* %6
store i32 1, i32* %3
br label %14
14: ; preds = %17, %10
%15 = load double, double* %6
%16 = fcmp oge double %15, 1.000000e-15
br i1 %16, label %17, label %36
17: ; preds = %14
%18 = load double, double* %6
%19 = load double, double* %5
%20 = fadd double %19, %18
store double %20, double* %5
%21 = load double, double* %4
%22 = load double, double* %4
%23 = fmul double %21, %22
%24 = load i32, i32* %3
%25 = mul nsw i32 2, %24
%26 = load i32, i32* %3
%27 = mul nsw i32 2, %26
%28 = add nsw i32 %27, 1
%29 = mul nsw i32 %25, %28
%30 = sitofp i32 %29 to double
%31 = fdiv double %23, %30
%32 = load double, double* %6
%33 = fmul double %32, %31
store double %33, double* %6
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %14
36: ; preds = %14
%37 = load double, double* %4
%38 = load double, double* %4
%39 = call i64 @sinh(double %38)
%40 = load double, double* %4
%41 = call i32 @exp(double %40)
%42 = load double, double* %4
%43 = fneg double %42
%44 = call i32 @exp(double %43)
%45 = sub nsw i32 %41, %44
%46 = sdiv i32 %45, 2
%47 = load double, double* %5
%48 = load double, double* %4
%49 = call i64 @sinh(double %48)
%50 = sitofp i64 %49 to double
%51 = load double, double* %5
%52 = fsub double %50, %51
%53 = fptosi double %52 to i64
%54 = call i32 @fabs(i64 %53)
%55 = load double, double* %4
%56 = call i64 @sinh(double %55)
%57 = call i32 @fabs(i64 %56)
%58 = sdiv i32 %54, %57
%59 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %37, i64 %39, i32 %46, double %47, i32 %58)
br label %60
60: ; preds = %36
%61 = load i32, i32* %2
%62 = add nsw i32 %61, -1
store i32 %62, i32* %2
br label %7
63: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"%.3le %+.8le %+.8le %+.8le %+.8le\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %20
%2 = phi i32 [ 2, %0 ], [ %37, %20 ]
%3 = tail call double @pow(i32 10, i32 %2)
%4 = fcmp ult double %3, 1.000000e-15
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = fmul double %3, %3
br label %7
7: ; preds = %5, %7
%8 = phi double [ %3, %5 ], [ %17, %7 ]
%9 = phi double [ 0.000000e+00, %5 ], [ %11, %7 ]
%10 = phi i32 [ 1, %5 ], [ %18, %7 ]
%11 = fadd double %9, %8
%12 = shl nuw nsw i32 %10, 1
%13 = or i32 %12, 1
%14 = mul nsw i32 %13, %12
%15 = sitofp i32 %14 to double
%16 = fdiv double %6, %15
%17 = fmul double %8, %16
%18 = add nuw nsw i32 %10, 1
%19 = fcmp ult double %17, 1.000000e-15
br i1 %19, label %20, label %7
20: ; preds = %7, %1
%21 = phi double [ 0.000000e+00, %1 ], [ %11, %7 ]
%22 = tail call i64 @sinh(double %3)
%23 = tail call i32 @exp(double %3)
%24 = fneg double %3
%25 = tail call i32 @exp(double %24)
%26 = sub nsw i32 %23, %25
%27 = sdiv i32 %26, 2
%28 = tail call i64 @sinh(double %3)
%29 = sitofp i64 %28 to double
%30 = fsub double %29, %21
%31 = fptosi double %30 to i64
%32 = tail call i32 @fabs(i64 %31)
%33 = tail call i64 @sinh(double %3)
%34 = tail call i32 @fabs(i64 %33)
%35 = sdiv i32 %32, %34
%36 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %3, i64 %22, i32 %27, double %21, i32 %35)
%37 = add nsw i32 %2, -1
%38 = icmp sgt i32 %2, -15
br i1 %38, label %1, label %39
39: ; preds = %20
ret i32 0
}