#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, 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_4;
  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)
movsd  0xe9e(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe89(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e58(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x8c,-0xc(%rbp)
jg     1353 <main+0x203>
movsd  0xe5b(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe4e(%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     1302 <main+0x1b2>
mov    0x2db6(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2da9(%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    1296 <main+0x146>
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    12ef <main+0x19f>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12f4 <main+0x1a4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1209 <main+0xb9>
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    0xcd8(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    11a0 <main+0x50>
mov    0x2c6e(%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
movsd  %xmm0,0x10(%rsp)
mov    $0x2,%r12d
mov    0x2e54(%rip),%r13
mov    0x2e55(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  0xe68(%rip),%xmm0
call   1030 <f@plt>
mov    %rax,%r15
mov    %r12d,%edi
movsd  0x10(%rsp),%xmm0
movsd  0xe57(%rip),%xmm1
movsd  0xe57(%rip),%xmm2
movsd  0xe3f(%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  0xe1c(%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  0xdd8(%rip),%xmm1
movsd  0xdd8(%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  0xd8f(%rip),%xmm1
movsd  0xd8f(%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  0xd59(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xd43(%rip),%xmm2
movaps %xmm0,%xmm3
call   1060 <err_bound@plt>
movaps %xmm0,%xmm1
lea    0xd41(%rip),%rdi
mov    %r12d,%esi
movsd  0x8(%rsp),%xmm0
call   1040 <printf@plt>
lea    0x5(%r12),%eax
cmp    $0x88,%r12d
mov    %eax,%r12d
jb     1190 <main+0x40>
mov    0x2cc7(%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
%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_4
store double %12, double* %7
store i32 2, i32* %3
br label %13
13: ; preds = %82, %0
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 140
br i1 %15, label %16, label %85
16: ; preds = %13
store double 1.000000e+00, double* %8
store double 1.000000e+00, double* %9
%17 = load double, double* %9
%18 = call i64 @f(double %17)
%19 = load i32, i32* %3
%20 = load double, double* %7
%21 = load double, double* %4
%22 = load double, double* %5
%23 = load double, double* %9
%24 = call i64 @sinc_approx(i32 %19, double %20, double %21, double %22, double %23)
%25 = sub nsw i64 %18, %24
%26 = call double @fabs(i64 %25)
store double %26, double* %11
store i32 1, i32* %2
br label %27
27: ; preds = %69, %16
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 100
br i1 %29, label %30, label %72
30: ; preds = %27
%31 = load double, double* @M_SQRT1_2
%32 = load double, double* %8
%33 = fmul double %32, %31
store double %33, double* %8
%34 = load double, double* @M_SQRT2
%35 = load double, double* %9
%36 = fmul double %35, %34
store double %36, double* %9
%37 = load double, double* %8
%38 = call i64 @f(double %37)
%39 = load i32, i32* %3
%40 = load double, double* %7
%41 = load double, double* %4
%42 = load double, double* %5
%43 = load double, double* %8
%44 = call i64 @sinc_approx(i32 %39, double %40, double %41, double %42, double %43)
%45 = sub nsw i64 %38, %44
%46 = call double @fabs(i64 %45)
store double %46, double* %10
%47 = load double, double* %11
%48 = load double, double* %10
%49 = fcmp olt double %47, %48
br i1 %49, label %50, label %52
50: ; preds = %30
%51 = load double, double* %10
store double %51, double* %11
br label %52
52: ; preds = %50, %30
%53 = load double, double* %9
%54 = call i64 @f(double %53)
%55 = load i32, i32* %3
%56 = load double, double* %7
%57 = load double, double* %4
%58 = load double, double* %5
%59 = load double, double* %9
%60 = call i64 @sinc_approx(i32 %55, double %56, double %57, double %58, double %59)
%61 = sub nsw i64 %54, %60
%62 = call double @fabs(i64 %61)
store double %62, double* %10
%63 = load double, double* %11
%64 = load double, double* %10
%65 = fcmp olt double %63, %64
br i1 %65, label %66, label %68
66: ; preds = %52
%67 = load double, double* %10
store double %67, double* %11
br label %68
68: ; preds = %66, %52
br label %69
69: ; preds = %68
%70 = load i32, i32* %2
%71 = add nsw i32 %70, 1
store i32 %71, i32* %2
br label %27
72: ; preds = %27
%73 = load i32, i32* %3
%74 = load double, double* %11
%75 = load i32, i32* %3
%76 = load double, double* %6
%77 = load double, double* %7
%78 = load double, double* %4
%79 = load double, double* %5
%80 = call double @err_bound(i32 %75, double %76, double %77, double %78, double %79)
%81 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %73, double %74, double %80)
br label %82
82: ; preds = %72
%83 = load i32, i32* %3
%84 = add nsw i32 %83, 5
store i32 %84, i32* %3
br label %13
85: ; preds = %13
%86 = load i32, i32* @EXIT_SUCCESS
ret i32 %86
}

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