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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e6f(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe7e(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
mov    0x2e41(%rip),%rax
imul   (%rax),%edi
add    $0x1,%edi
movsd  0xe53(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1080 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
mov    0x2e1d(%rip),%rax
cvtsi2sdl (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x8c,-0xc(%rbp)
jg     1386 <main+0x226>
movsd  0xe28(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe1b(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x58(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
call   1070 <sinc_approx@plt>
mov    -0x58(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1335 <main+0x1d5>
mov    0x2d7b(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2d6e(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x60(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
call   1070 <sinc_approx@plt>
mov    -0x60(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12c9 <main+0x169>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <f@plt>
mov    %rax,-0x68(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm3
call   1070 <sinc_approx@plt>
mov    -0x68(%rbp),%rdi
sub    %rax,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1322 <main+0x1c2>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1327 <main+0x1c7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    123c <main+0xdc>
mov    -0xc(%rbp),%eax
mov    %eax,-0x74(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0xc(%rbp),%edi
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
call   1060 <err_bound@plt>
mov    -0x74(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x70(%rbp),%xmm0
lea    0xca5(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    11d3 <main+0x73>
mov    0x2c33(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    0x2e73(%rip),%rax
movsd  (%rax),%xmm1
mov    0x2e60(%rip),%rbx
mov    (%rbx),%edi
imul   %edi,%edi
add    $0x1,%edi
movsd  0xe70(%rip),%xmm0
movsd  %xmm1,0x18(%rsp)
mulsd  %xmm1,%xmm0
call   1080 <pow@plt>
movsd  %xmm0,0x30(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%r12d
mov    0x2e09(%rip),%r13
mov    0x2e0a(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
movsd  0xe30(%rip),%xmm0
call   1030 <f@plt>
mov    %rax,%r15
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0xe19(%rip),%xmm2
movsd  0xe09(%rip),%xmm3
call   1070 <sinc_approx@plt>
sub    %rax,%r15
mov    %r15,%rdi
call   1050 <fabs@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0x64,%ebp
movsd  0xde6(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  %xmm0,0x28(%rsp)
xchg   %ax,%ax
movsd  0x28(%rsp),%xmm1
mulsd  0x0(%r13),%xmm1
movsd  %xmm1,0x28(%rsp)
movsd  0x20(%rsp),%xmm0
mulsd  (%r14),%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm1,%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0xd9a(%rip),%xmm2
movsd  0x28(%rsp),%xmm3
call   1070 <sinc_approx@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1050 <fabs@plt>
maxsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0xd53(%rip),%xmm2
movsd  0x20(%rsp),%xmm3
call   1070 <sinc_approx@plt>
sub    %rax,%rbx
mov    %rbx,%rdi
call   1050 <fabs@plt>
maxsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0xffffffff,%ebp
jne    1230 <main+0xd0>
mov    %r12d,%edi
movsd  0x30(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
movsd  0xd0b(%rip),%xmm3
call   1060 <err_bound@plt>
movapd %xmm0,%xmm1
lea    0xd03(%rip),%rdi
mov    %r12d,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
lea    0x5(%r12),%eax
cmp    $0x88,%r12d
mov    %eax,%r12d
jb     11d0 <main+0x70>
mov    0x2c81(%rip),%rax
mov    (%rax),%eax
add    $0x38,%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_PI_2 = global i32 0
@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
%11 = alloca double
store i32 0, i32* %1
%12 = load double, double* @M_PI_4
store double %12, double* %4
store double 7.500000e-01, double* %5
%13 = load i32, i32* @M_PI_2
%14 = load i32, i32* @M_PI_2
%15 = mul nsw i32 %13, %14
%16 = add nsw i32 1, %15
%17 = load double, double* %4
%18 = fmul double 5.000000e-01, %17
%19 = call double @pow(i32 %16, double %18)
store double %19, double* %6
%20 = load i32, i32* @M_PI_2
%21 = sitofp i32 %20 to double
store double %21, double* %7
store i32 2, i32* %3
br label %22
22: ; preds = %91, %0
%23 = load i32, i32* %3
%24 = icmp sle i32 %23, 140
br i1 %24, label %25, label %94
25: ; preds = %22
store double 1.000000e+00, double* %8
store double 1.000000e+00, double* %9
%26 = load double, double* %9
%27 = call i64 @f(double %26)
%28 = load i32, i32* %3
%29 = load double, double* %7
%30 = load double, double* %4
%31 = load double, double* %5
%32 = load double, double* %9
%33 = call i64 @sinc_approx(i32 %28, double %29, double %30, double %31, double %32)
%34 = sub nsw i64 %27, %33
%35 = call double @fabs(i64 %34)
store double %35, double* %11
store i32 1, i32* %2
br label %36
36: ; preds = %78, %25
%37 = load i32, i32* %2
%38 = icmp sle i32 %37, 100
br i1 %38, label %39, label %81
39: ; preds = %36
%40 = load double, double* @M_SQRT1_2
%41 = load double, double* %8
%42 = fmul double %41, %40
store double %42, double* %8
%43 = load double, double* @M_SQRT2
%44 = load double, double* %9
%45 = fmul double %44, %43
store double %45, double* %9
%46 = load double, double* %8
%47 = call i64 @f(double %46)
%48 = load i32, i32* %3
%49 = load double, double* %7
%50 = load double, double* %4
%51 = load double, double* %5
%52 = load double, double* %8
%53 = call i64 @sinc_approx(i32 %48, double %49, double %50, double %51, double %52)
%54 = sub nsw i64 %47, %53
%55 = call double @fabs(i64 %54)
store double %55, double* %10
%56 = load double, double* %11
%57 = load double, double* %10
%58 = fcmp olt double %56, %57
br i1 %58, label %59, label %61
59: ; preds = %39
%60 = load double, double* %10
store double %60, double* %11
br label %61
61: ; preds = %59, %39
%62 = load double, double* %9
%63 = call i64 @f(double %62)
%64 = load i32, i32* %3
%65 = load double, double* %7
%66 = load double, double* %4
%67 = load double, double* %5
%68 = load double, double* %9
%69 = call i64 @sinc_approx(i32 %64, double %65, double %66, double %67, double %68)
%70 = sub nsw i64 %63, %69
%71 = call double @fabs(i64 %70)
store double %71, double* %10
%72 = load double, double* %11
%73 = load double, double* %10
%74 = fcmp olt double %72, %73
br i1 %74, label %75, label %77
75: ; preds = %61
%76 = load double, double* %10
store double %76, double* %11
br label %77
77: ; preds = %75, %61
br label %78
78: ; preds = %77
%79 = load i32, i32* %2
%80 = add nsw i32 %79, 1
store i32 %80, i32* %2
br label %36
81: ; preds = %36
%82 = load i32, i32* %3
%83 = load double, double* %11
%84 = load i32, i32* %3
%85 = load double, double* %6
%86 = load double, double* %7
%87 = load double, double* %4
%88 = load double, double* %5
%89 = call double @err_bound(i32 %84, double %85, double %86, double %87, double %88)
%90 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %82, double %83, double %89)
br label %91
91: ; preds = %81
%92 = load i32, i32* %3
%93 = add nsw i32 %92, 5
store i32 %93, i32* %3
br label %22
94: ; preds = %22
%95 = load i32, i32* @EXIT_SUCCESS
ret i32 %95
}

LLVM IR (-O2):
@M_PI_4 = global double 0.000000e+00
@M_PI_2 = global i32 0
@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 = load i32, i32* @M_PI_2
%3 = mul nsw i32 %2, %2
%4 = add nuw nsw i32 %3, 1
%5 = fmul double %1, 5.000000e-01
%6 = tail call double @pow(i32 %4, double %5)
%7 = load i32, i32* @M_PI_2
%8 = sitofp i32 %7 to double
br label %9
9: ; preds = %0, %38
%10 = phi i32 [ 2, %0 ], [ %41, %38 ]
%11 = tail call i64 @f(double 1.000000e+00)
%12 = tail call i64 @sinc_approx(i32 %10, double %8, double %1, double 7.500000e-01, double 1.000000e+00)
%13 = sub nsw i64 %11, %12
%14 = tail call double @fabs(i64 %13)
br label %15
15: ; preds = %9, %15
%16 = phi double [ %14, %9 ], [ %35, %15 ]
%17 = phi double [ 1.000000e+00, %9 ], [ %23, %15 ]
%18 = phi double [ 1.000000e+00, %9 ], [ %21, %15 ]
%19 = phi i32 [ 1, %9 ], [ %36, %15 ]
%20 = load double, double* @M_SQRT1_2
%21 = fmul double %18, %20
%22 = load double, double* @M_SQRT2
%23 = fmul double %17, %22
%24 = tail call i64 @f(double %21)
%25 = tail call i64 @sinc_approx(i32 %10, double %8, double %1, double 7.500000e-01, double %21)
%26 = sub nsw i64 %24, %25
%27 = tail call double @fabs(i64 %26)
%28 = fcmp olt double %16, %27
%29 = select i1 %28, double %27, double %16
%30 = tail call i64 @f(double %23)
%31 = tail call i64 @sinc_approx(i32 %10, double %8, double %1, double 7.500000e-01, double %23)
%32 = sub nsw i64 %30, %31
%33 = tail call double @fabs(i64 %32)
%34 = fcmp olt double %29, %33
%35 = select i1 %34, double %33, double %29
%36 = add nuw nsw i32 %19, 1
%37 = icmp eq i32 %36, 101
br i1 %37, label %38, label %15
38: ; preds = %15
%39 = tail call double @err_bound(i32 %10, double %6, double %8, double %1, double 7.500000e-01)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10, double %35, double %39)
%41 = add nuw nsw i32 %10, 5
%42 = icmp ult i32 %10, 136
br i1 %42, label %9, label %43
43: ; preds = %38
%44 = load i32, i32* @EXIT_SUCCESS
ret i32 %44
}