#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 EXIT_SUCCESS;
double M_PI_4;
double M_SQRT1_2;
double M_SQRT2;
double err_bound(int, double, double, double);
scalar_t__ f(double);
double fabs(scalar_t__);
double pow(double, double);
int /*<<< orphan*/ printf(char *, int, double, double);
scalar_t__ sinc_approx(int, double, double, double);
int main() {
  int i, N;
  double K = pow(M_PI_4, M_PI_4);
  double d = 1.5;
  double mu = M_PI_4;
  double s, t;
  double err, maxerr;
  for (N = 2; N <= 50; N += 5) {
    s = 1;
    t = 1;
    maxerr = fabs(f(t) - sinc_approx(N, d, mu, t));
    for (i = 1; i <= 100; i++) {
      s *= M_SQRT1_2;
      t *= M_SQRT2;
      err = fabs(f(s) - sinc_approx(N, d, mu, s));
      if (maxerr < err)
        maxerr = err;
      err = fabs(f(t) - sinc_approx(N, d, mu, t));
      if (maxerr < err)
        maxerr = err;
    }
    printf("%d\t%e\t%e\n", N, maxerr, err_bound(N, K, d, mu));
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e72(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2e67(%rip),%rax
movsd  (%rax),%xmm1
call   1080 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe69(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e45(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x32,-0xc(%rbp)
jg     134f <main+0x1ef>
movsd  0xe43(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe36(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x50(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
call   1070 <sinc_approx@plt>
mov    -0x50(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1303 <main+0x1a3>
mov    0x2dab(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2d9e(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x58(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1070 <sinc_approx@plt>
mov    -0x58(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    129c <main+0x13c>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x60(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
call   1070 <sinc_approx@plt>
mov    -0x60(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12f0 <main+0x190>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    12f5 <main+0x195>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1214 <main+0xb4>
mov    -0xc(%rbp),%eax
mov    %eax,-0x6c(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <err_bound@plt>
mov    -0x6c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
lea    0xcd4(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    11b3 <main+0x53>
mov    0x2c72(%rip),%rax
mov    (%rax),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e73(%rip),%rbx
movsd  (%rbx),%xmm0
movaps %xmm0,%xmm1
call   1080 <pow@plt>
movsd  %xmm0,0x20(%rsp)
movsd  (%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x2,%r12d
mov    0x2e32(%rip),%r13
mov    0x2e33(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0xe48(%rip),%xmm0
call   1030 <f@plt>
mov    %rax,%r15
mov    %r12d,%edi
movsd  0xe3d(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0xe27(%rip),%xmm2
call   1070 <sinc_approx@plt>
sub    %rax,%r15
mov    %r15,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,(%rsp)
mov    $0x64,%ebp
movsd  0xe05(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  0x18(%rsp),%xmm1
mulsd  0x0(%r13),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  (%r14),%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0xdbe(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1070 <sinc_approx@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1050 <fabs@plt>
maxsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0xd7f(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1070 <sinc_approx@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1050 <fabs@plt>
maxsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
add    $0xffffffff,%ebp
jne    1210 <main+0xb0>
mov    %r12d,%edi
movsd  0x20(%rsp),%xmm0
movsd  0xd3f(%rip),%xmm1
movsd  0x8(%rsp),%xmm2
call   1060 <err_bound@plt>
movaps %xmm0,%xmm1
lea    0xd32(%rip),%rdi
mov    %r12d,%esi
movsd  (%rsp),%xmm0
call   1040 <printf@plt>
lea    0x5(%r12),%eax
cmp    $0x2e,%r12d
mov    %eax,%r12d
jb     11b0 <main+0x50>
mov    0x2cc4(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI_4 = global double 0.000000e+00
@M_SQRT1_2 = global double 0.000000e+00
@M_SQRT2 = global double 0.000000e+00
@.str = [10 x i8] c"%d\09%e\09%e\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
%11 = load double, double* @M_PI_4
%12 = load double, double* @M_PI_4
%13 = call double @pow(double %11, double %12)
store double %13, double* %4
store double 1.500000e+00, double* %5
%14 = load double, double* @M_PI_4
store double %14, double* %6
store i32 2, i32* %3
br label %15
15: ; preds = %80, %0
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 50
br i1 %17, label %18, label %83
18: ; preds = %15
store double 1.000000e+00, double* %7
store double 1.000000e+00, double* %8
%19 = load double, double* %8
%20 = call i64 @f(double %19)
%21 = load i32, i32* %3
%22 = load double, double* %5
%23 = load double, double* %6
%24 = load double, double* %8
%25 = call i64 @sinc_approx(i32 %21, double %22, double %23, double %24)
%26 = sub nsw i64 %20, %25
%27 = call double @fabs(i64 %26)
store double %27, double* %10
store i32 1, i32* %2
br label %28
28: ; preds = %68, %18
%29 = load i32, i32* %2
%30 = icmp sle i32 %29, 100
br i1 %30, label %31, label %71
31: ; preds = %28
%32 = load double, double* @M_SQRT1_2
%33 = load double, double* %7
%34 = fmul double %33, %32
store double %34, double* %7
%35 = load double, double* @M_SQRT2
%36 = load double, double* %8
%37 = fmul double %36, %35
store double %37, double* %8
%38 = load double, double* %7
%39 = call i64 @f(double %38)
%40 = load i32, i32* %3
%41 = load double, double* %5
%42 = load double, double* %6
%43 = load double, double* %7
%44 = call i64 @sinc_approx(i32 %40, double %41, double %42, double %43)
%45 = sub nsw i64 %39, %44
%46 = call double @fabs(i64 %45)
store double %46, double* %9
%47 = load double, double* %10
%48 = load double, double* %9
%49 = fcmp olt double %47, %48
br i1 %49, label %50, label %52
50: ; preds = %31
%51 = load double, double* %9
store double %51, double* %10
br label %52
52: ; preds = %50, %31
%53 = load double, double* %8
%54 = call i64 @f(double %53)
%55 = load i32, i32* %3
%56 = load double, double* %5
%57 = load double, double* %6
%58 = load double, double* %8
%59 = call i64 @sinc_approx(i32 %55, double %56, double %57, double %58)
%60 = sub nsw i64 %54, %59
%61 = call double @fabs(i64 %60)
store double %61, double* %9
%62 = load double, double* %10
%63 = load double, double* %9
%64 = fcmp olt double %62, %63
br i1 %64, label %65, label %67
65: ; preds = %52
%66 = load double, double* %9
store double %66, double* %10
br label %67
67: ; preds = %65, %52
br label %68
68: ; preds = %67
%69 = load i32, i32* %2
%70 = add nsw i32 %69, 1
store i32 %70, i32* %2
br label %28
71: ; preds = %28
%72 = load i32, i32* %3
%73 = load double, double* %10
%74 = load i32, i32* %3
%75 = load double, double* %4
%76 = load double, double* %5
%77 = load double, double* %6
%78 = call double @err_bound(i32 %74, double %75, double %76, double %77)
%79 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %72, double %73, double %78)
br label %80
80: ; preds = %71
%81 = load i32, i32* %3
%82 = add nsw i32 %81, 5
store i32 %82, i32* %3
br label %15
83: ; preds = %15
%84 = load i32, i32* @EXIT_SUCCESS
ret i32 %84
}

LLVM IR (-O2):
@M_PI_4 = global double 0.000000e+00
@M_SQRT1_2 = global double 0.000000e+00
@M_SQRT2 = global double 0.000000e+00
@.str = [10 x i8] c"%d\09%e\09%e\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = load double, double* @M_PI_4
%2 = tail call double @pow(double %1, double %1)
%3 = load double, double* @M_PI_4
br label %4
4: ; preds = %0, %33
%5 = phi i32 [ 2, %0 ], [ %36, %33 ]
%6 = tail call i64 @f(double 1.000000e+00)
%7 = tail call i64 @sinc_approx(i32 %5, double 1.500000e+00, double %3, double 1.000000e+00)
%8 = sub nsw i64 %6, %7
%9 = tail call double @fabs(i64 %8)
br label %10
10: ; preds = %4, %10
%11 = phi double [ %9, %4 ], [ %30, %10 ]
%12 = phi double [ 1.000000e+00, %4 ], [ %18, %10 ]
%13 = phi double [ 1.000000e+00, %4 ], [ %16, %10 ]
%14 = phi i32 [ 1, %4 ], [ %31, %10 ]
%15 = load double, double* @M_SQRT1_2
%16 = fmul double %13, %15
%17 = load double, double* @M_SQRT2
%18 = fmul double %12, %17
%19 = tail call i64 @f(double %16)
%20 = tail call i64 @sinc_approx(i32 %5, double 1.500000e+00, double %3, double %16)
%21 = sub nsw i64 %19, %20
%22 = tail call double @fabs(i64 %21)
%23 = fcmp olt double %11, %22
%24 = select i1 %23, double %22, double %11
%25 = tail call i64 @f(double %18)
%26 = tail call i64 @sinc_approx(i32 %5, double 1.500000e+00, double %3, double %18)
%27 = sub nsw i64 %25, %26
%28 = tail call double @fabs(i64 %27)
%29 = fcmp olt double %24, %28
%30 = select i1 %29, double %28, double %24
%31 = add nuw nsw i32 %14, 1
%32 = icmp eq i32 %31, 101
br i1 %32, label %33, label %10
33: ; preds = %10
%34 = tail call double @err_bound(i32 %5, double %2, double 1.500000e+00, double %3)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5, double %30, double %34)
%36 = add nuw nsw i32 %5, 5
%37 = icmp ult i32 %5, 46
br i1 %37, label %4, label %38
38: ; preds = %33
%39 = load i32, i32* @EXIT_SUCCESS
ret i32 %39
}