#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;
double M_SQRT1_2;
double M_SQRT2;
double err_bound(int, double, double, double, double);
scalar_t__ f(double);
double fabs(scalar_t__);
int /*<<< orphan*/ printf(char *, int, double, double);
scalar_t__ sinc_approx(int, double, double, double, double);
int main() {
  int i, N;
  double alpha = 0.5;
  double beta = 1.5;
  double K = 1.5;
  double d = M_PI / 6.0;
  double s, t;
  double err, maxerr;
  for (N = 2; N <= 120; 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)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe84(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e58(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xe64(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x78,-0xc(%rbp)
jg     135c <main+0x20c>
movsd  0xe5a(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe4d(%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     130b <main+0x1bb>
mov    0x2dad(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2da0(%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    129f <main+0x14f>
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    12f8 <main+0x1a8>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12fd <main+0x1ad>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1212 <main+0xc2>
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    0xcd7(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    11ac <main+0x5c>
mov    0x2c65(%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    $0x28,%rsp
mov    0x2e83(%rip),%rax
movsd  (%rax),%xmm0
divsd  0xe8f(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%r12d
mov    0x2e4c(%rip),%r13
mov    0x2e4d(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  0xe70(%rip),%xmm0
call   1030 <f@plt>
mov    %rax,%r15
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0xe5f(%rip),%xmm1
movsd  0xe5f(%rip),%xmm2
movsd  0xe47(%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  0xe24(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  0x20(%rsp),%xmm1
mulsd  0x0(%r13),%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  (%r14),%xmm0
movsd  %xmm0,0x18(%rsp)
movapd %xmm1,%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0xde0(%rip),%xmm1
movsd  0xde0(%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)
movsd  0x18(%rsp),%xmm0
call   1030 <f@plt>
mov    %rax,%rbx
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0xd97(%rip),%xmm1
movsd  0xd97(%rip),%xmm2
movsd  0x18(%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    11f0 <main+0xa0>
mov    %r12d,%edi
movsd  0xd61(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xd4b(%rip),%xmm2
movaps %xmm0,%xmm3
call   1060 <err_bound@plt>
movaps %xmm0,%xmm1
lea    0xd49(%rip),%rdi
mov    %r12d,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
lea    0x5(%r12),%eax
cmp    $0x74,%r12d
mov    %eax,%r12d
jb     1190 <main+0x40>
mov    0x2cca(%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 = 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
%11 = alloca double
store i32 0, i32* %1
store double 5.000000e-01, double* %4
store double 1.500000e+00, double* %5
store double 1.500000e+00, double* %6
%12 = load double, double* @M_PI
%13 = fdiv double %12, 6.000000e+00
store double %13, double* %7
store i32 2, i32* %3
br label %14
14: ; preds = %83, %0
%15 = load i32, i32* %3
%16 = icmp sle i32 %15, 120
br i1 %16, label %17, label %86
17: ; preds = %14
store double 1.000000e+00, double* %8
store double 1.000000e+00, double* %9
%18 = load double, double* %9
%19 = call i64 @f(double %18)
%20 = load i32, i32* %3
%21 = load double, double* %7
%22 = load double, double* %4
%23 = load double, double* %5
%24 = load double, double* %9
%25 = call i64 @sinc_approx(i32 %20, double %21, double %22, double %23, double %24)
%26 = sub nsw i64 %19, %25
%27 = call double @fabs(i64 %26)
store double %27, double* %11
store i32 1, i32* %2
br label %28
28: ; preds = %70, %17
%29 = load i32, i32* %2
%30 = icmp sle i32 %29, 100
br i1 %30, label %31, label %73
31: ; preds = %28
%32 = load double, double* @M_SQRT1_2
%33 = load double, double* %8
%34 = fmul double %33, %32
store double %34, double* %8
%35 = load double, double* @M_SQRT2
%36 = load double, double* %9
%37 = fmul double %36, %35
store double %37, double* %9
%38 = load double, double* %8
%39 = call i64 @f(double %38)
%40 = load i32, i32* %3
%41 = load double, double* %7
%42 = load double, double* %4
%43 = load double, double* %5
%44 = load double, double* %8
%45 = call i64 @sinc_approx(i32 %40, double %41, double %42, double %43, double %44)
%46 = sub nsw i64 %39, %45
%47 = call double @fabs(i64 %46)
store double %47, double* %10
%48 = load double, double* %11
%49 = load double, double* %10
%50 = fcmp olt double %48, %49
br i1 %50, label %51, label %53
51: ; preds = %31
%52 = load double, double* %10
store double %52, double* %11
br label %53
53: ; preds = %51, %31
%54 = load double, double* %9
%55 = call i64 @f(double %54)
%56 = load i32, i32* %3
%57 = load double, double* %7
%58 = load double, double* %4
%59 = load double, double* %5
%60 = load double, double* %9
%61 = call i64 @sinc_approx(i32 %56, double %57, double %58, double %59, double %60)
%62 = sub nsw i64 %55, %61
%63 = call double @fabs(i64 %62)
store double %63, double* %10
%64 = load double, double* %11
%65 = load double, double* %10
%66 = fcmp olt double %64, %65
br i1 %66, label %67, label %69
67: ; preds = %53
%68 = load double, double* %10
store double %68, double* %11
br label %69
69: ; preds = %67, %53
br label %70
70: ; preds = %69
%71 = load i32, i32* %2
%72 = add nsw i32 %71, 1
store i32 %72, i32* %2
br label %28
73: ; preds = %28
%74 = load i32, i32* %3
%75 = load double, double* %11
%76 = load i32, i32* %3
%77 = load double, double* %6
%78 = load double, double* %7
%79 = load double, double* %4
%80 = load double, double* %5
%81 = call double @err_bound(i32 %76, double %77, double %78, double %79, double %80)
%82 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %74, double %75, double %81)
br label %83
83: ; preds = %73
%84 = load i32, i32* %3
%85 = add nsw i32 %84, 5
store i32 %85, i32* %3
br label %14
86: ; preds = %14
%87 = load i32, i32* @EXIT_SUCCESS
ret i32 %87
}

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